File manager - Edit - /home/autoph/public_html/projects/tickets-autohub/public/js/authentication/employee/index.js
Back
(function () { "use strict"; var search_type_filter = []; var userTableAssignment = null; var id = null; function delay(callback, ms) { var timer = 0; return function () { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } // function initActionEdit(){ // $("[data-action-edit]").each(function(e){ // $(this).on('click', function(e){ // var row = $(this).closest("tr"); // id = userTableAssignment.row(row).data().id; // window.open("/roles/assignment/" + id); // // window.location.href = "/roles/assignment/" + id; // }); // }); // } function MigrateEmployee() { $('[data-action-migrate]').each(function () { $(this).on('click', function (e) { var row = $(this).closest('tr'); id = userTableAssignment.row(row).data().id; Swal.fire({ title: 'Are you sure?', text: "Do you want to migrate this employee?", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, migrate it!', cancelButtonText: 'Cancel' }).then((result) => { if (result.isConfirmed) { $.ajax({ type: "POST", url: "/employee/migrate-employee", dataType: 'json', data: { id: id, }, // processData: false, // contentType: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function (result) { if (result.status == 1) { toastRWithTime(result.message,"success"); userTableAssignment.draw(false); } if (result.status == 0) { toastRWithTime(result.message,"error"); userTableAssignment.draw(false); } }, error: function (error) { console.log(error); } }); } }); }); }); } function initActionDestroy() { } function getDataTableData() { var data = {}; // data.status = $('select[name="status"]').val(); return data; } function initList() { $("#txt_search").on( "keyup", delay(function (e) { userTableAssignment.search($("#txt_search").val()).draw(); }, 500) ); var search_type_default = "Name"; var search_types = ["Name", "ASA ID"]; $.each(search_types, function (i, n) { $("._ticket_search_type").append( `<li class="dropdown-item cursor-pointer py-0"><span class="text-sm">` + n + `</span></li>` ); }); $("._ticket_search_type li").each(function () { if ($(this).text() == search_type_default) { $(this).removeClass("active").addClass("active"); var active_items_arr = []; active_items_arr.push(search_type_default); search_type_filter = JSON.stringify(active_items_arr); } $(this).on("click", function () { //remove all selected menu $("._ticket_search_type") .find("li.active") .map(function () { $(this).removeClass("active"); }); $(this).toggleClass("active"); var active_items = $("._ticket_search_type") .find("li.active") .map(function () { var item = {}; // item.id = this.value; item.status = $(this).text(); return item; }); var active_items_arr = []; $.each(active_items, function (i, n) { active_items_arr.push(n.status); }); search_type_filter = JSON.stringify(active_items_arr); // refreshOrcrPlateTable(); // if ($('#txt_search').val() != '') { userTableAssignment.ajax.reload(); // } }); }); var cols = [ { title: "Record ID", data: 'id', className: 'align-middle p-1 dt-left', orderable: true, width: "10%", }, { title: "Employee ID", data: 'asa_id', className: 'align-middle p-1 dt-left', orderable: true, width: "10%", }, { title: "Name", data: null, className: 'align-middle p-1 dt-left', orderable: true, width: "40%", render: function (data, type, row, meta) { let migrationStatus = ''; if (data.status === 1) { migrationStatus = '<span class="text-success">Migrated</span>'; } else if (data.status === null) { migrationStatus = '<span class="text-warning">Not Migrated</span>'; } else { migrationStatus = '<span class="text-danger">Unknown Status</span>'; } return `<span>` + data.f_name + " " + data.l_name + `</span><br> <span class="text-info">${data.email}</span><br> <span class="text-muted">${data.position}</span> <br> ${migrationStatus} `; } }, { title: "Action", data: null, className: 'align-middle p-1 dt-left', orderable: true, width: "10%", render: function (data, type, row, meta) { return ` <div class="btn-group"> <button class="btn btn-sm btn-light dropdown-toggle no-caret" type="button" data-bs-toggle="dropdown" aria-expanded="false" title="Actions"> <i class="fa fa-ellipsis-v" aria-hidden="true"></i> </button> <ul class="dropdown-menu dropdown-menu-end"> <li><a class="dropdown-item btn-warning" data-action-migrate style="cursor:pointer;"><i class="fa fa-download text-success"></i> Migrate</a></li> </ul> </div> `; // <a data-action-remove style="cursor:pointer; width: fit-content;" class="m-1 btn btn-sm btn-danger btn-icon" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a> } }, ]; userTableAssignment = $('#userTableAssignment').DataTable({ fnDrawCallback: function () { // initActionEdit(); // initActionDestroy(); MigrateEmployee(); }, order: [[0, "desc"]], retrieve: true, columns: cols, paging: true, lengthChange: false, searching: true, pageLength: 10, info: true, autoWidth: true, responsive: true, processing: true, serverSide: true, autoWidth: true, columnDefs: [ { width: '20%', targets: 0 } ], fixedColumns: true, ajax: { url: '/employee/listArchivedEmployee', data: function (d) { return $.extend({}, d, { search_type: search_type_filter, data: getDataTableData(), }) }, error: function (settings, techNote, message) { // console.error(settings); toastRWithTime("Please check your filter parameter", "error"); } }, sDom: "lrtip", }); } function addNoCaretStyle() { var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.no-caret::after { display: none !important; }'; document.head.appendChild(style); } // Call the function to add the style addNoCaretStyle(); $(function (e) { initList(); $('[name="_reloadUserTableAssignment"]').on('click', function (e) { userTableAssignment.draw(false); }); }); })();
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.18 |
proxy
|
phpinfo
|
Settings