/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include('header.php'); ?> <style> </style> <!-- <style> .line-vertical { border-left: 1px solid rgba(0, 0, 0, .1); ; height: 90%; position: absolute; left: 50%; } .hidden-color { display: none; } #myBtn { display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99; font-size: 10px; border: none; outline: none; background-color: #9BCDD2; color: white; cursor: pointer; padding: 15px; border-radius: 4px; } #myBtn:hover { background-color: #555; } </style> --> <!-- <div class="row wrapper border-bottom white-bg page-heading"> <div class="col-lg-10"> <h2>Blog</h2> <ol class="breadcrumb"> <li class="breadcrumb-item"> <a href="index.php">หน้าแรก</a> </li> <li class="breadcrumb-item active"> <strong>Blog</strong> </li> </ol> </div> <div class="col-lg-2"></div> </div> --> <body class="top-navigation"> <div class="wrapper wrapper-content animated fadeInDown"> <div class="ibox"> <div class="ibox-title"> <div class="col-lg-9 mb-2 ml-4"> รายการข่าวเฉพาะสมาชิก </div> <div class="ibox-tools"> <button type="button" class="btn-sm btn btn-primary" onclick="AddData();"><i class="fa fa-plus"></i> เพิ่ม Blog</button> </div> </div> <div class="ibox-title"> <div class="row"> <div class="col-lg-3"> <div class="form-group" style="margin-left: 2.5rem;"> <input type="checkbox" class="js-switch" id="show_status" value="1" checked onchange="GetTable()" /> <label style="margin-top: 7px; margin-left: 10px;"> แสดงเฉพาะใช้งาน </label> </div> </div> <div class="col-lg-6"> <div class="form-group"> <div class="input-group mb-3"> <input type="text" class="form-control" id="search" name="search" placeholder="ค้นหาข่าว" aria-describedby="button-addon2"> <div class="input-group-append"> <button class="btn btn-primary text-white" type="button" id="button-addon2" onclick="GetTable()"> <i class="fa fa-search"></i> </button> </div> </div> </div> </div> </div> </div> <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="ibox-content" id="show_data"> </div> </div> </div> <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" id="loader_modal"> <div id="showModal"></div> </div> </div> </div> <?php include('footer.php'); ?> <script> $(document).ready(function() { GetTable(); $(".select2").select2({ width: "100%" }); var mem = $('#data_1 .input-group.date').datepicker({ todayBtn: "linked", keyboardNavigation: false, forceParse: false, calendarWeeks: true, autoclose: true }); var elem = document.querySelector('.js-switch'); var switchery = new Switchery(elem, { color: '#1AB394' }); }); function AddData() { $('#myModal').modal('show'); $('#showModal').load("ajax/blog_setting_member/modal_add.php", function() { $('#description').summernote({ height: 200, toolbar: [ ['style', ['bold', 'italic', 'underline', 'clear']], ['font', ['strikethrough', 'superscript', 'subscript']], ['fontsize'], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], ['height', ['height']], ['insert', ['link', 'hr']] ], callbacks: { onPaste: function(e) { var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); e.preventDefault(); setTimeout(function() { document.execCommand('insertText', false, bufferText); }, 10); } } }); $("#create_date").datepicker({ todayBtn: "linked", keyboardNavigation: false, forceParse: false, autoclose: true, format: "dd/mm/yyyy" }); $("#AddFormSubmit").click(function() { let create_date = $('#create_date').val(); let blog_title = $('#blog_title').val(); if (create_date == "" || blog_title == "") { swal({ title: 'แจ้งเตือน', text: 'กรุณากรอกข้อมูลให้ครบ', type: "warning", showConfirmButton: false }); setTimeout(function() { swal.close(); }, 1500); return false; } swal({ title: "ยืนยัน การเพิ่มข้อมูล ?", type: "warning", showCancelButton: true, confirmButtonColor: "#1AB394", confirmButtonText: "ยืนยัน", cancelButtonText: "ตรวจสอบอีกครั้ง", closeOnConfirm: false }, function() { $(".confirm").prop('disabled', true); let admin_id = localStorage.getItem("admin_id"); let myForm = document.getElementById('form_add'); let formData = new FormData(myForm); formData.append("member_id", admin_id) $.ajax({ url: 'ajax/blog_setting_member/add.php', type: 'POST', dataType: 'json', contentType: false, cache: false, processData: false, data: formData, success: function(data) { $(".confirm").prop('disabled', false); if (data.result == 1) { GetTable(); swal({ title: "แจ้งเตือน", text: "เพิ่มข้อมูลสำเร็จ", type: "success", showConfirmButton: false }); setTimeout(function() { $('#myModal').modal('hide'); swal.close(); }, 1000); } else if (data.result == 0) { swal({ title: "แจ้งเตือน", text: "เพิ่มข้อมูลไม่สำเร็จ", type: "error", showConfirmButton: false }); setTimeout(function() { swal.close(); }, 2000); } else { swal({ title: "แจ้งเตือน", text: "ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง", type: "error", showConfirmButton: true }); } } }); }); }); }); } function GetTable() { const date_start = $("#date_start").val(); const date_end = $("#date_end").val(); if (document.getElementById('show_status').checked) { num_chk = 1; } else { num_chk = 0; } $("#show_status").val(num_chk); const show_status = $("#show_status").val(); const search = $("#search").val(); $.ajax({ type: "post", url: "ajax/blog_setting_member/get_table.php", dataType: "html", data: { show_status: show_status, date_start: date_start, date_end: date_end, search: search }, success: function(response) { $("#show_data").html(response); $('table').DataTable({ pageLength: 25, responsive: true, ordering: false }); $('#Loading').hide(); } }); } function ChangeStatus(button, id) { $.ajax({ type: "POST", url: "ajax/blog_setting_member/change_status.php", data: { id: id, }, dataType: "json", success: function(data) { if (data.result == 1) { if (data.status == 1) { $(button).addClass('btn-primary').removeClass('btn-danger').html('กำลังแสดง'); if ($("#show_status").not(':checked')) { $('#tr_' + id).fadeOut(700); } else { } } else if (data.status == 0) { $(button).addClass('btn-danger').removeClass('btn-primary').html('ไม่แสดง'); if ($("#show_status").is(':checked')) { $('#tr_' + id).fadeOut(700); } else { } } } else { swal({ title: 'Error', text: 'Error', type: 'warning', showConfirmButton: false, timer: 1000 }); } } }); } function DeleteContent(id) { swal({ title: "ยืนยัน การลบ?", type: "warning", showCancelButton: true, confirmButtonColor: "#1AB394", confirmButtonText: "ยืนยัน", cancelButtonText: "ตรวจสอบอีกครั้ง", closeOnConfirm: false }, function() { $.ajax({ type: "POST", url: "ajax/blog_setting_member/content_list_delete.php", data: { id: id, }, dataType: "json", success: function(data) { if (data.result == 1) { GetTable(); swal({ title: "แจ้งเตือน", text: "ลบข้อมูลสำเร็จ", type: "success", showConfirmButton: false }); setTimeout(function() { swal.close(); }, 1000); } else { swal({ title: 'Error', text: 'Error', type: 'warning', showConfirmButton: false, timer: 1500 }); } } }); }); } </script> </body> </html>