"use strict";$((function(){var e=$(".datatables-customer-order"),t=baseUrl+"app/ecommerce/order/details",r={1:{title:"Ready to  Pickup",class:"bg-label-info"},2:{title:"Dispatched",class:"bg-label-warning"},3:{title:"Delivered",class:"bg-label-success"},4:{title:"Out for delivery",class:"bg-label-primary"}};if(e.length){var a=e.DataTable({ajax:assetsPath+"json/ecommerce-customer-order.json",columns:[{data:""},{data:"id"},{data:"order"},{data:"date"},{data:"status"},{data:"spent"},{data:" "}],columnDefs:[{className:"control",searchable:!1,orderable:!1,responsivePriority:2,targets:0,render:function(e,t,r,a){return""}},{targets:1,orderable:!1,searchable:!1,responsivePriority:3,checkboxes:!0,render:function(){return'<input type="checkbox" class="dt-checkboxes form-check-input">'},checkboxes:{selectAllRender:'<input type="checkbox" class="form-check-input">'}},{targets:2,responsivePriority:4,render:function(e,r,a,s){var n=a.order;return"<a href='"+t+"' class='fw-medium'><span>#"+n+"</span></a>"}},{targets:3,render:function(e,t,r,a){return'<span class="text-nowrap">'+new Date(r.date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+"</span > "}},{targets:4,render:function(e,t,a,s){var n=a.status;return'<span class="badge '+r[n].class+'" text-capitalized>'+r[n].title+"</span>"}},{targets:5,render:function(e,t,r,a){return"<span >"+r.spent+"</span>"}},{targets:-1,title:"Actions",searchable:!1,orderable:!1,render:function(e,t,r,a){return'<div class="text-xxl-center"><button class="btn btn-sm btn-icon dropdown-toggle hide-arrow" data-bs-toggle="dropdown"><i class="bx bx-dots-vertical-rounded"></i></button><div class="dropdown-menu dropdown-menu-end m-0"><a href="javascript:;" class="dropdown-item">View</a><a href="javascript:;" class="dropdown-item  delete-record">Delete</a></div></div>'}}],order:[[2,"desc"]],dom:'<"card-header d-flex flex-wrap py-3 py-sm-2"<"head-label text-center me-4 ms-1">f>t<"row mx-4"<"col-md-12 col-xl-6 text-center text-xl-start pb-2 pb-lg-0 pe-0"i><"col-md-12 col-xl-6 d-flex justify-content-center justify-content-xl-end"p>>',lengthMenu:[6,30,50,70,100],language:{sLengthMenu:"_MENU_",search:"",searchPlaceholder:"Search order"},responsive:{details:{display:$.fn.dataTable.Responsive.display.modal({header:function(e){return"Details of "+e.data().order}}),type:"column",renderer:function(e,t,r){var a=$.map(r,(function(e,t){return""!==e.title?'<tr data-dt-row="'+e.rowIndex+'" data-dt-column="'+e.columnIndex+'"><td>'+e.title+":</td> <td>"+e.data+"</td></tr>":""})).join("");return!!a&&$('<table class="table"/><tbody />').append(a)}}}});$("div.head-label").html('<h5 class="card-title mb-0 text-nowrap">Orders placed</h5>')}$(".datatables-orders tbody").on("click",".delete-record",(function(){a.row($(this).parents("tr")).remove().draw()})),setTimeout((()=>{$(".dataTables_filter .form-control").removeClass("form-control-sm"),$(".dataTables_length .form-select").removeClass("form-select-sm")}),300)}));
