/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include ('header.php'); $datenow = date('Y-m-d'); ?> <style> .select2-dropdown { z-index: 9999; } </style> <body class="top-navigation"> <div id="wrapper" class=""> <div id="page-wrapper" class="gray-bg shadow-sm rounded"> <div class="wrapper wrapper-content animated fadeInRight"> <div id="member_count"></div> <div class="ibox"> <div class="ibox-title"> <div class="row"> <div class="col-lg-9 mb-2 ml-4"> ประกาศงานทั้งหมด </div> </div> </div> <div class="ibox-title"> <div class="row px-3"> <div class="col-lg-2"> <div class="form-group"> <label class="font-">สถานะการอนุมัติประกาศ</label> <div class="input-group"> <select class="form-select" id="approve_status" style="width: 100%;"> <option value="x">ทั้งหมด</option> <option value="9" selected>รออนุมัติ</option> <option value="1">อนุมัติแล้ว</option> <option value="0">ปฏิเสธ</option> </select> </div> </div> </div> <div class="col-lg-2"> <div class="form-group"> <div class="input-group mt-4"> <button type="button" class="btn btn-primary mt-1" onclick="GetJobTable()"><i class="fa fa-search"></i> ค้นหา</button> </div> </div> </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-md modal-dialog-centered"> <div class="modal-content animated fadeIn"> <div id="showModal"></div> </div> </div> </div> <script> $(document).ready(function () { $(".form-select").select2(); GetJobTable() }); function GetJobTable() { const approve_status = $("#approve_status").val(); $.ajax({ type: "POST", url: "ajax/job_post/get_table.php", data: { approve_status: approve_status }, dataType: "html", success: function (response) { $("#Loading").hide(); $("#show_table").html(response); $('.dataTables-example').DataTable({ ordering: false, pageLength: 50, responsive: true, }); } }); } function ApprovePost(job_id, status) { console.log(job_id); if (status == 0) { $("#myModal").modal("show"); $.ajax({ type: 'POST', url: 'ajax/job_post/get_modal', data: { job_id : job_id , status : status }, dataType: 'html', success: function (data) { $('#showModal').html(data); $('#myModal').modal("show"); } }); }else if(status == 1 ){ $.ajax({ type: "POST", url: "ajax/job_post/update_remark", data: { job_id : job_id , status : '1' }, dataType: "json", success: function (data) { if (data.result == 1) { swal({ title: 'บันทึกข้อมูลสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 },function(){ swal.close(); $("#myModal").modal('hide'); GetJobTable(); }); } 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 }); } },error: function (jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); } } function Add() { let remark = $('#remark').val(); if (remark == '') { swal({ title: 'แจ้งเตือน', text: 'กรุณากรอกข้อมูล', type: "warning", showConfirmButton: false }); setTimeout(function () { swal.close(); }, 1500); return false; } swal({ title: "แจ้งเตือน", text: "ยืนยัน การบันทึกหรือไม่ ?", type: "warning", showCancelButton: true, confirmButtonColor: "#1AB394", confirmButtonText: "ยืนยัน", cancelButtonText: "ตรวจสอบอีกครั้ง", closeOnConfirm: false }, function () { let myForm = document.getElementById('form_update_remark'); let formData = new FormData(myForm); $.ajax({ url: 'ajax/job_post/update_remark.php', type: 'POST', dataType: 'json', contentType: false, cache: false, processData: false, data: formData, success: function (data) { if (data.result == 1) { swal({ title: "บันทึกสำเร็จ", text: "บันทึกสำเร็จ", type: "success", showConfirmButton: false }); setTimeout(function () { swal.close(); $('#myModal').modal('hide'); GetJobTable(); }, 1500); } else if (data.result == 0) { swal({ title: "แจ้งเตือน", text: "บันทึกไม่สำเร็จ", type: "error", showConfirmButton: false }); setTimeout(function () { swal.close(); }, 1500); } else if (data.result == 9) { swal({ title: "แจ้งเตือน", text: "Session หมดอายุ หรือ ไม่สามารถเชื่อมต่อฐานข้อมูลได้", type: "error", showConfirmButton: false }); setTimeout(function () { localStorage.clear(); window.location.assign("../index.php"); swal.close(); }, 1500); } else { swal({ title: "แจ้งเตือน", text: "ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง!!", type: "error", showConfirmButton: true }); } } }); }); } </script> </body> </html>