text: document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll('[data-plugin="choices"]');for(i=0;i<e.length;++i){var t=e[i];new Choices(t,{placeholderValue:"This is a placeholder set in the config",searchPlaceholderValue:"Search results here"})}}),flatpickr("#datepicker-range",{mode:"range",dateFormat:"d M, Y"}),flatpickr("#date-field",{dateFormat:"d M, Y"});var checkAll=document.getElementById("checkAll");checkAll&&(checkAll.onclick=function(){for(var e=document.querySelectorAll('.form-check-all input[type="checkbox"]'),t=0;t<e.length;t++)e[t].checked=this.checked,e[t].checked?e[t].closest("tr").classList.add("table-active"):e[t].closest("tr").classList.remove("table-active")});var perPage=8,options={valueNames:["id","customer_name","email","country","date","invoice_amount","status"],page:perPage,pagination:!0,plugins:[ListPagination({left:2,right:2})]},invoiceList=new List("invoiceList",options).on("updated",function(e){0==e.matchingItems.length?document.getElementsByClassName("noresult")[0].style.display="block":document.getElementsByClassName("noresult")[0].style.display="none";var t=1==e.i,n=e.i>e.matchingItems.length-e.page;document.querySelector(".pagination-prev.disabled")&&document.querySelector(".pagination-prev.disabled").classList.remove("disabled"),document.querySelector(".pagination-next.disabled")&&document.querySelector(".pagination-next.disabled").classList.remove("disabled"),t&&document.querySelector(".pagination-prev").classList.add("disabled"),n&&document.querySelector(".pagination-next").classList.add("disabled"),e.matchingItems.length<=perPage?document.querySelector(".pagination-wrap").style.display="none":document.querySelector(".pagination-wrap").style.display="flex",e.matchingItems.length==perPage&&document.querySelector(".pagination.listjs-pagination").firstElementChild.children[0].click(),0<e.matchingItems.length?document.getElementsByClassName("noresult")[0].style.display="none":document.getElementsByClassName("noresult")[0].style.display="block"});isCount=(new DOMParser).parseFromString(invoiceList.items.slice(-1)[0]._values.id,"text/html");var isValue=isCount.body.firstElementChild.innerHTML,idField=document.getElementById("orderId"),customerNameField=document.getElementById("customername-field"),emailField=document.getElementById("email-field"),dateField=document.getElementById("date-field"),countryField=document.getElementById("country-field"),statusField=document.getElementById("delivered-status"),addBtn=document.getElementById("add-btn"),editBtn=document.getElementById("edit-btn"),removeBtns=document.getElementsByClassName("remove-item-btn"),editBtns=document.getElementsByClassName("edit-item-btn");function filterContact(e){var t=e;invoiceList.filter(function(e){matchData=(new DOMParser).parseFromString(e.values().status,"text/html");e=matchData.body.firstElementChild.innerHTML;return"All"==e||"All"==t||e==t}),invoiceList.update()}function updateList(){var t=document.querySelector("input[name=status]:checked").value;data=userList.filter(function(e){return"All"==t||e.values().sts==t}),userList.update()}refreshCallbacks(),filterContact("All");var table=document.getElementById("invoiceTable"),tr=table.getElementsByTagName("tr"),trlist=table.querySelectorAll(".list tr");function SearchData(){var a=document.getElementById("idStatus").value,l=document.getElementById("datepicker-range").value,c=l.split(" to ")[0],r=l.split(" to ")[1];invoiceList.filter(function(e){matchData=(new DOMParser).parseFromString(e.values().status,"text/html");var t=matchData.body.firstElementChild.innerHTML,n=!1,i=!1,n="all"==t||"all"==a||t==a,i=new Date(e.values().date.slice(0,12))>=new Date(c)&&new Date(e.values().date.slice(0,12))<=new Date(r);return n&&i||(n&&""==l?n:i&&""==l?i:void 0)}),invoiceList.update()}function ischeckboxcheck(){document.getElementsByName("checkAll").forEach(function(e){e.addEventListener("click",function(e){e.target.checked?e.target.closest("tr").classList.add("table-active"):e.target.closest("tr").classList.remove("table-active")})})}function refreshCallbacks(){removeBtns.forEach(function(e){e.addEventListener("click",function(e){e.target.closest("tr").children[1].innerText,itemId=e.target.closest("tr").children[1].innerText,invoiceList.get({id:itemId}).forEach(function(e){deleteid=(new DOMParser).parseFromString(e._values.id,"text/html");var t=deleteid.body.firstElementChild;deleteid.body.firstElementChild.innerHTML==itemId&&document.getElementById("delete-record").addEventListener("click",function(){invoiceList.remove("id",t.outerHTML),document.getElementById("deleteOrder").click()})})})})}function clearFields(){customerNameField.value="",emailField.value="",dateField.value="",countryField.value=""}document.querySelector("#invoiceList").addEventListener("click",function(){refreshCallbacks(),ischeckboxcheck()}),document.querySelector(".pagination-next").addEventListener("click",function(){!document.querySelector(".pagination.listjs-pagination")||document.querySelector(".pagination.listjs-pagination").querySelector(".active")&&document.querySelector(".pagination.listjs-pagination").querySelector(".active").nextElementSibling.children[0].click()}),document.querySelector(".pagination-prev").addEventListener("click",function(){!document.querySelector(".pagination.listjs-pagination")||document.querySelector(".pagination.listjs-pagination").querySelector(".active")&&document.querySelector(".pagination.listjs-pagination").querySelector(".active").previousSibling.children[0].click()});