/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
ajax
/
officer_list
/
up file
home
<?php session_start(); include('../../../config/main_function.php'); $secure = "cAh3DrJACzw4RbU"; $connection = connectDB($secure); if ($connection) { $admin_id = mysqli_real_escape_string($connection, $_POST['admin_id']); $sql_select = "SELECT * FROM tbl_admin WHERE admin_id = '$admin_id' "; $res_select = mysqli_query($connection, $sql_select) or die($connection->error); $row = mysqli_fetch_assoc($res_select); $munu_access = explode(",", $row['menu_access']); } else { echo "Connection Error"; } $munu_access_num = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]; $munu_access_title = [ "สมาชิก", "สมาชิกที่มีสถานะ", "รอบรับรอง", "นำเข้าข้อมูล", "ใบวางบิล", "ใบเสร็จ", "ตั้งค่าบัญชีธนาคาร", "ตั้งค่าบทความ", "ตั้งค่าสไลด์", "ตั้งค่าโค้ดส่วนลด", "ตั้งค่าตำแหน่งในใบสมัคร", "กำหนดสิทธิผู้ใช้งาน", "ตั้งค่าเว็บไซต์", "อนุมัติโพสข่าว" ]; ?> <div class="modal-header"> <h4 class="modal-title">กำหนดเมนู</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> </div> <div class="modal-body"> <label for="">กำหนดเมนู</label> <div class="row px-3"> <input type="hidden" value="<?php echo $admin_id; ?>" id="admin_id" name="admin_id"> <?php for ($i = 0; $i < count($munu_access_num); $i++) { ?> <div class="col-6"> <input class="form-check-input" type="checkbox" value="<?php echo $munu_access_num[$i] ?>" id="permission<?php echo $i; ?>" id="menu<?php echo $i; ?>" name="menu" <?php echo in_array($munu_access_num[$i], $munu_access) ? "checked" : "" ?>> <label class="form-check-label menuaccess" for="permission<?php echo $i; ?>"> <?php echo $munu_access_title[$i] ?> </label> </div> <?php } ?> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" onclick="SubmitMenuAccess()"><i class="fa fa-check"></i> บันทึก</button> <button type="button" class="btn btn-white" data-dismiss="modal">ปิด</button> </div> <script> // function SubmitMenuAccess() { // let admin_id = $("#admin_id").val(); // let menu_access = []; // $("input[name='menu']:checked").each(function(i) { // menu_access[i] = $(this).val(); // }); // $.ajax({ // type: "POST", // url: "ajax/officer_list/update_access.php", // data: { // admin_id: admin_id, // menu_access: menu_access // }, // dataType: "json", // success: function(data) { // if (data.result == 1) { // swal({ // title: 'บันทึกข้อมูลเรียบร้อย', // type: 'success', // showConfirmButton: false, // timer: 1500 // }, function() { // swal.close(); // $("#myModal").modal('hide'); // }); // } 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 // }); // } // }); // } </script>