PK Z+
profile.jsnu [ (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(
`
` +
n +
``
);
});
$(".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 `
//
// `;
// },
// },
];
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);
});
});
})();PK ZDu reset_password.jsnu [ (function(e){
"use strict";
$(function(){
$('.reset-form').on('submit', function(e){
e.preventDefault();
var formData = new FormData(this);
formData.append('id', id);
formData.append('url',window.location.href);
$.ajax({
type:"POST",
url:"/reset-password",
dataType: 'json',
data: formData,
processData: false,
contentType: false,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(e){
toastRWithTime("Success",'success');
setTimeout(function() {
window.location.href = "/";
}, 5000);
},
error: function(error){
toastRWithTime("Wrong username or password","error");
}
});
});
});
})();PK Z&