/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include('header.php'); ?> <body class="top-navigation"> <div id="wrapper"> <div id="page-wrapper" class="gray-bg"> <div class="wrapper wrapper-content animated fadeInRight"> <div class="ibox"> <div class="ibox-title"> <button class="btn btn-sm btn-primary" type="button" onclick="ModalAdd();"> <i class="fa fa-plus"></i> เพิ่มรอบรับรอง </button> </div> <div class="ibox-content"> <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 class="table-responsive" id="showTable"></div> </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-lg modal-dialog-centered"> <div class="modal-content animated fadeIn"> <div id="showModal"></div> </div> </div> </div> <script> $(document).ready(function() { getTable(); }); function getTable() { $.ajax({ type: "post", url: "ajax/certification/get_table.php", data: {}, dataType: "html", success: function(response) { $("#showTable").html(response); $("#showTable table").dataTable({ ordering: false }); $('#Loading').hide(); } }); } function ModalAdd() { $("#myModal").modal('show'); $.ajax({ type: "POST", url: "ajax/certification/modal_add.php", dataType: "html", success: function(response) { $("#showModal").html(response); } }); } function AddCertification() { var formData = new FormData($("#form_add")[0]); formData.append('admin_id', localStorage.getItem("admin_id")); $.ajax({ type: "POST", url: "ajax/certification/certification_add.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); getTable(); }); } 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 }); } } }); } function GetModalEditCer(certification_lot_id) { $("#myModal").modal("show"); $("#showModal").load("ajax/certification/modal_edit.php", { certification_lot_id: certification_lot_id }, function() { }); } function UpdateCertification() { var formData = new FormData($("#form_add")[0]); formData.append('admin_id', localStorage.getItem("admin_id")); $.ajax({ type: "POST", url: "ajax/certification/certification_update.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); getTable(); }); } 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 }); } } }); } function DeleteData(certification_lot_id) { swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { $.ajax({ type: "POST", url: "ajax/certification/certification_delete.php", data: { certification_lot_id: certification_lot_id }, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'ลบข้อมูลเรียบร้อย', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); getTable(); }); } 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>