"use strict";var KTDatatableChildRemoteDataDemo={init:function(){var t;t=$("#kt_datatable").KTDatatable({data:{type:"remote",source:{read:{url:HOST_URL+"/api/datatables/demos/customers.php"}},pageSize:10,serverPaging:!0,serverFiltering:!1,serverSorting:!0},layout:{scroll:!1,footer:!1},sortable:!0,pagination:!0,detail:{title:"Load sub table",content:function(t){$("
").attr("id","child_data_ajax_"+t.data.RecordID).appendTo(t.detailCell).KTDatatable({data:{type:"remote",source:{read:{url:HOST_URL+"/api/datatables/demos/orders.php",params:{query:{generalSearch:"",CustomerID:t.data.RecordID}}}},pageSize:5,serverPaging:!0,serverFiltering:!1,serverSorting:!0},layout:{scroll:!1,footer:!1,spinner:{type:1,theme:"default"}},sortable:!0,columns:[{field:"RecordID",title:"#",sortable:!1,width:30},{field:"OrderID",title:"Order ID",template:function(t){return""+t.OrderID+" - "+t.ShipCountry+""}},{field:"ShipCountry",title:"Country",width:100},{field:"ShipAddress",title:"Ship Address"},{field:"ShipName",title:"Ship Name"},{field:"TotalPayment",title:"Payment",type:"number"},{field:"Status",title:"Status",template:function(t){var e={1:{title:"Pending",class:"label-light-primary"},2:{title:"Delivered",class:" label-light-danger"},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''+e[t.Status].title+""}},{field:"Type",title:"Type",autoHide:!1,template:function(t){var e={1:{title:"Online",state:"danger"},2:{title:"Retail",state:"primary"},3:{title:"Direct",state:"success"}};return''+e[t.Type].title+""}}]})}},search:{input:$("#kt_datatable_search_query"),key:"generalSearch"},columns:[{field:"RecordID",title:"",sortable:!1,width:30,textAlign:"center"},{field:"checkbox",title:"",template:"{{RecordID}}",sortable:!1,width:20,textAlign:"center",selector:{class:"kt-checkbox--solid"}},{field:"FirstName",title:"First Name",sortable:"asc"},{field:"LastName",title:"Last Name"},{field:"Company",title:"Company"},{field:"Email",title:"Email"},{field:"Address",title:"Address"},{field:"Status",title:"Status",template:function(t){var e={1:{title:"Pending",class:"label-light-primary"},2:{title:"Delivered",class:" label-light-danger"},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''+e[t.Status].title+""}},{field:"Type",title:"Type",autoHide:!1,template:function(t){var e={1:{title:"Online",state:"danger"},2:{title:"Retail",state:"primary"},3:{title:"Direct",state:"success"}};return''+e[t.Type].title+""}},{field:"Actions",width:125,title:"Actions",sortable:!1,overflow:"visible",autoHide:!1,template:function(){return'\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t '}}]}),$("#kt_datatable_search_status").on("change",function(){t.search($(this).val().toLowerCase(),"Status")}),$("#kt_datatable_search_type").on("change",function(){t.search($(this).val().toLowerCase(),"Type")}),$("#kt_datatable_search_status, #kt_datatable_search_type").selectpicker()}};jQuery(document).ready(function(){KTDatatableChildRemoteDataDemo.init()});