/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include('header.php'); include('./config/main_function.php'); $secure = "cAh3DrJACzw4RbU"; $connection = connectDB($secure); ?> <body class="top-navigation"> <div id="wrapper"> <div id="page-wrapper" class="gray-bg"> <div class="wrapper wrapper-content animated fadeInRight"> <div class="row"> <div class="col-md-12 col-12 mb-3"> <div class="ibox-content"> <button class="btn btn-sm btn-primary" type="button" onclick="AddMenber();"> เพิ่มสมาชิก </button> <button class="btn btn-sm btn-info" type="button" onclick="ExcelList();"> Excel </button> <!-- <button class="btn btn-sm btn-success" type="button" onclick="ModalAdd();"> button </button> --> </div> </div> </div> <div class="table-responsive"> <div id="Loading"> <div class="spiner-example"> <div class="sk-spinner sk-spinner-wave"> <div class="sk-rect1"></div> <div class="sk-rect2"></div> <div class="sk-rect3"></div> <div class="sk-rect4"></div> <div class="sk-rect5"></div> </div> </div> </div> <div id="showTable"></div> </div> </div> </div> </div> <!--- init layout --> <?php include('footer.php'); ?> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-xl modal-dialog-centered"> <div class="modal-content animated fadeIn"> <div id="showModal"></div> </div> </div> </div> <!-- --> <script> $(document).ready(function() { MemberList(); }); function MemberList() { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const id = urlParams.get('id'); $.ajax({ type: "post", url: "ajax/certification_detail/get_table.php", data: { id: id }, dataType: "html", success: function(response) { $("#showTable").html(response); $("#showTable table").dataTable({ ordering: false, pageLength: 50, responsive: true, }); $('#Loading').hide(); } }); } function AddMenber() { $('#myModal').modal('show') $("#showModal").load("ajax/certification_detail/modal_add_member.php", "data", function(response, status, request) { this; // dom element }); } function AddCerMember() { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const id = urlParams.get('id'); let member_citizen = $("#member_citizen").val(); $.ajax({ type: "POST", url: "ajax/certification_detail/add_member.php", data: { id: id, member_citizen: member_citizen }, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); MemberList(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: 'บันทึกไม่สำเร็จ', type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 2) { swal({ title: 'แจ้งเตือน', text: 'ไม่พบสมาชิก', type: 'warning', showConfirmButton: false, timer: 1500 }); }else if (data.result == 3) { swal({ title: 'แจ้งเตือน', text: 'รายชื่อสมาชิกซ้ำ', type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: 'ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } } }); } function DeleteData(member_id) { swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { $.ajax({ type: "POST", url: "ajax/certification_detail/delete_member.php", data: { member_id: member_id }, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'ลบข้อมูลเรียบร้อย', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); MemberList(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: 'ลบข้อมูลไม่สำเร็จ', type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: 'ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } } }); }) } $.extend({ redirectPost: function(location, args) { var form = ''; $.each(args, function(key, value) { form += '<input type="hidden" name="' + key + '" value="' + value + '">'; }); $('<form action="' + location + '" method="POST">' + form + '</form>').appendTo('body') .submit(); } }); function ExcelList() { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const cer_id = urlParams.get('id'); var redirect = 'ajax/certification_detail/export_detail.php'; $.redirectPost(redirect, { cer_id: cer_id }); } function ApproveMember(member_id, status, register_type) { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const cer_id = urlParams.get('id'); swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { $.ajax({ type: "POST", url: "ajax/certification_detail/approve_member.php", data: { cer_id: cer_id, member_id: member_id, status: status, register_type: register_type }, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกข้อมูลสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); MemberList(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: 'เกิดข้อผิดพลาดระหว่างบันทึก กรุณาลองใหม่', type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: 'ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } } }); }) } </script> </body> </html>