File manager - Edit - /home/autoph/public_html/projects/Rating-AutoHub/public/js/auth/profile.js
Back
(function(e){ "use strict"; var search_type_filter = []; var companiesList = 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 getDataTableData(){ var data = {}; return data; } function initList(){ $('.txt_search').on("keyup",delay(function(e){ companiesList.search($('.txt_search').val()).draw() },500)); const search_type_default = "Company"; const search_types = ["Company", "Code"]; $.each(search_types, function (i, n) { $(".system-search-type").append( `<li class="dropdown-item cursor-pointer py-0"><span class="text-sm">` + n + `</span></li>` ); }); $(".system-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 $(".system-search-type") .find("li.active") .map(function () { $(this).removeClass("active"); }); $(this).toggleClass("active"); var active_items = $(".system-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() != '') { companiesList.draw(false); // } }); }); var cols = [ { title: "ID", data: 'id', className: 'align-middle p-1 dt-left', orderable: true, width: "5%", }, { title: "Code", data: 'code', className: 'align-middle p-1 dt-left', orderable: true, width: "40%", }, { title: "Company", data: 'name', className: 'align-middle p-1 dt-left', orderable: true, width: "40%", }, // { // title: "Action", // data: null, // orderable: false, // width: "20%", // className: "align-middle p-1 dt-center", // render: function (data, type, row, meta) { // return ` // <div class="row justify-content-center"> // <a data-action-update style="cursor:pointer; width: fit-content;" class="m-1 btn btn-sm btn-primary btn-icon" title="Edit"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</a> // <a data-action-remove style="cursor:pointer; width: fit-content;" class="m-1 btn btn-sm btn-danger btn-icon" title="Remove"><i class="fa fa-trash" aria-hidden="true"></i> Remove</a> // </div> // `; // }, // }, ]; companiesList = $('#companiesTable').DataTable({ fnDrawCallback: function () { // initActionRemove(); // initActionUpdate(); }, order: [[0, "desc"]], retrieve: true, columns: cols, paging: true, lengthChange: false, searching: true, pageLength: 5, info: true, autoWidth: true, responsive: true, processing: true, serverSide: true, autoWidth: true, columnDefs: [ { width: '20%', targets: 0 } ], fixedColumns: true, ajax: { url:'/companies/fetchall', data: function (d){ return $.extend({},d,{ search_type: search_type_filter, data: getDataTableData(), }) } }, sDom: "lrtip", }); } $(function(){ $('.edit-profile').on('submit', function(e){ e.preventDefault(); var formData = new FormData(this); $.ajax({ type:"POST", url:"/update-profile", dataType: 'json', data: formData, processData: false, contentType: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(e){ console.log(e); toastRWithTime(e.message,'success'); window.location.reload(); // setTimeout(function() { // window.location.href = "/"; // }, 5000); }, error: function(error){ console.log(error); toastRWithTime(error.responseJSON.message,"error"); } }); }); $('#import_company').on('click', function(e){ $.ajax({ type:"POST", url:"/import_comp", dataType: 'json', data: null, processData: false, contentType: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(e){ console.log(e); toastRWithTime(e.message,'Success'); // window.location.reload(); }, error: function(error){ console.log(error); toastRWithTime(error.responseJSON.message,"error"); } }); }); initList(); $('#reload_list').on('click', function(e){ companiesList.draw(false); }); }); })();
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings