/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include('header.php'); $datenow = date('Y-m-d'); ?> <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"> <div class="row"> <div class="col-lg-3 mb-2"> <button class="btn btn-md btn-primary" onclick="form_add()"><i class="fa fa-plus"></i> เพิ่มแจ้งเตือน</button> </div> </div> </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 id="show_table"></div> <!----- ตาราง ----> </div> </div> </div> </div> </div> <!--- init layout --> <?php include('footer.php'); ?> <div class="modal fade" id="myModal" 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 form_add() { $("#myModal").modal("show"); $("#showModal").load("ajax/notifications/get_modal_add.php", "data", function(response, status, request) { }); } function GetModalEdit(id) { $("#myModal").modal("show"); $("#showModal").load("ajax/notifications/get_modal_edit.php", { id: id }, function(response, status, request) { }); } function GetTable() { $.ajax({ type: "POST", url: "ajax/notifications/get_table.php", data: "data", dataType: "html", success: function(response) { $("#Loading").hide(); $("#show_table").html(response); $('.dataTables-example').DataTable({ ordering: false, pageLength: 50, responsive: true, }); } }); } function AddNoti() { let formData = new FormData($("#form_add")[0]); $.ajax({ type: "POST", url: "ajax/notifications/add_notification.php", contentType: false, processData: false, cache: false, data: formData, 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 EditNoti() { let formData = new FormData($("#form_edit")[0]); $.ajax({ type: "POST", url: "ajax/notifications/edit_notification.php", contentType: false, processData: false, cache: false, data: formData, 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 }); } } }); } </script> </body> </html>