pos-gis/public/assets/js/pages/crud/ktdatatable/advanced/modal.min.js

1 line
428 KiB
JavaScript
Raw Normal View History

2024-10-07 06:13:42 +00:00
"use strict";var KTDatatableModal=function(){var e=function(e){var a=$("#kt_datatable_sub"),t=a.KTDatatable({data:{type:"remote",source:{read:{url:HOST_URL+"/api/datatables/demos/orders.php",params:{query:{generalSearch:"",CustomerID:e}}}},pageSize:10,serverPaging:!0,serverFiltering:!1,serverSorting:!0},layout:{theme:"default",scroll:!0,height:350,footer:!1},search:{input:a.find("#kt_datatable_search_query_2"),key:"generalSearch"},sortable:!0,columns:[{field:"RecordID",title:"#",sortable:!1,width:30},{field:"OrderID",title:"Order ID",template:function(e){return"<span>"+e.OrderID+" - "+e.ShipCountry+"</span>"}},{field:"ShipCountry",title:"Country",width:100},{field:"ShipAddress",title:"Ship Address"},{field:"ShipName",title:"Ship Name",autoHide:!1},{field:"TotalPayment",title:"Payment",type:"number"},{field:"Status",title:"Status",template:function(e){var a={1:{title:"Pending",class:"label-primary"},2:{title:"Delivered",class:" label-success"},3:{title:"Canceled",class:" label-primary"},4:{title:"Success",class:" label-success"},5:{title:"Info",class:" label-info"},6:{title:"Danger",class:" label-danger"},7:{title:"Warning",class:" label-warning"}};return'<span class="label font-weight-bold label-lg '+a[e.Status].class+' label-inline label-pill">'+a[e.Status].title+"</span>"}},{field:"Type",title:"Type",autoHide:!1,template:function(e){var a={1:{title:"Online",state:"danger"},2:{title:"Retail",state:"primary"},3:{title:"Direct",state:"accent"}};return'<span class="label label-'+a[e.Type].state+' label-dot"></span>&nbsp;<span class="font-weight-bold text-'+a[e.Type].state+'">'+a[e.Type].title+"</span>"}}]}),s=t.closest(".modal");$("#kt_datatable_search_status_2").on("change",function(){t.search($(this).val().toLowerCase(),"Status")}),$("#kt_datatable_search_type_2").on("change",function(){t.search($(this).val().toLowerCase(),"Type")}),$("#kt_datatable_search_status_2, #kt_datatable_search_type_2").selectpicker(),t.hide(),s.on("shown.bs.modal",function(){var e=$(this).find(".modal-content");t.spinnerCallback(!0,e),t.spinnerCallback(!1,e)}).on("hidden.bs.modal",function(){a.KTDatatable("destroy")}),t.on("datatable-on-layout-updated",function(){t.show(),t.redraw()})};return{init:function(){!function(){var a=$("#kt_datatable"),t=a.KTDatatable({data:{type:"remote",source:{read:{url:HOST_URL+"/api/datatables/demos/customers.php"}},pageSize:10,serverPaging:!0,serverFiltering:!1,serverSorting:!0},layout:{theme:"default",scroll:!1,height:null,footer:!1},sortable:!0,pagination:!0,search:{input:a.find("#kt_datatable_search_query"),key:"generalSearch"},columns:[{field:"RecordID",title:"",sortable:!1,width:30,textAlign:"center"},{field:"FirstName",title:"First Name",sortable:"asc"},{field:"LastName",title:"Last Name"},{field:"Company",title:"Company"},{field:"Email",title:"Email"},{field:"Phone",title:"Phone"},{field:"Status",title:"Status",template:function(e){var a={1:{title:"Pending",class:"label-light-primary"},2:{title:"Delivered",class:" label-light-success"},3:{title:"Canceled",class:" label-light-primary"},4:{title:"Success",class:" label-light-success"},5:{title:"Info",class:" label-light-info"},6:{title:"Danger",class:" label-light-danger"},7:{title:"Warning",class:" label-light-warning"}};return'<span class="label label-lg font-weight-bold'+a[e.Status].class+' label-inline">'+a[e.Status].title+"</span>"}},{field:"Type",title:"Type",autoHide:!1,template:function(e){var a={1:{title:"Online",state:"danger"},2:{title:"Retail",state:"primary"},3:{title:"Direct",state:"accent"}};return'<span class="label label-'+a[e.Type].state+' label-dot mr-2"></span><span class="font-weight-bold text-'+a[e.Type].state+'">'+a[e.Type].title+"</span>"}},{field:"Actions",width:130,title:"Actions",sortable:!1,overflow:"visible",textAlign:"left",autoHide:!1,template:function(e){return'\t\t <button data-record-id="'+e.RecordID+'" class="btn btn-sm btn-clean" title="View records">\t\t <i class="flaticon2-document"></i> Details\t\t </button>'}}]});t.closest(".card");$("#kt_datatable_search_status")