var productListAllData=[{id:1,product:{img:"assets/images/products/img-1.png",title:"Half Sleeve Round Neck T-Shirts",category:"Fashion"},stock:"12",price:"215.00",orders:"48",rating:"4.2",published:{publishDate:"12 Oct, 2021",publishTime:"10:05 AM"}},{id:2,product:{img:"assets/images/products/img-2.png",title:"Urban Ladder Pashe Chair",category:"Furniture"},stock:"06",price:"160.00",orders:"30",rating:"4.3",published:{publishDate:"06 Jan, 2021",publishTime:"01:31 PM"}},{id:3,product:{img:"assets/images/products/img-3.png",title:"350 ml Glass Grocery Container",category:"Grocery"},stock:"10",price:"125.00",orders:"48",rating:"4.5",published:{publishDate:"26 Mar, 2021",publishTime:"11:40 AM"}},{id:4,product:{img:"assets/images/products/img-4.png",title:"Fabric Dual Tone Living Room Chair",category:"Furniture"},stock:"15",price:"340.00",orders:"40",rating:"4.2",published:{publishDate:"19 Apr, 2021",publishTime:"02:51 PM"}},{id:5,product:{img:"assets/images/products/img-5.png",title:"Crux Motorsports Helmet",category:"Automotive Accessories"},stock:"08",price:"175.00",orders:"55",rating:"4.4",published:{publishDate:"30 Mar, 2021",publishTime:"09:42 AM"}},{id:6,product:{img:"assets/images/products/img-6.png",title:"Half Sleeve T-Shirts (Blue)",category:"Fashion"},stock:"15",price:"225.00",orders:"48",rating:"4.2",published:{publishDate:"12 Oct, 2021",publishTime:"04:55 PM"}},{id:7,product:{img:"assets/images/products/img-7.png",title:"Noise Evolve Smartwatch",category:"Watches"},stock:"12",price:"105.00",orders:"45",rating:"4.3",published:{publishDate:"15 May, 2021",publishTime:"03:40 PM"}},{id:8,product:{img:"assets/images/products/img-8.png",title:"Sweatshirt for Men (Pink)",category:"Fashion"},stock:"20",price:"120.00",orders:"48",rating:"4.2",published:{publishDate:"21 Jun, 2021",publishTime:"12:18 PM"}},{id:9,product:{img:"assets/images/products/img-9.png",title:"Reusable Ecological Coffee Cup",category:"Grocery"},stock:"14",price:"325.00",orders:"55",rating:"4.3",published:{publishDate:"15 Jan, 2021",publishTime:"10:29 PM"}},{id:10,product:{img:"assets/images/products/img-10.png",title:"Travel Carrying Pouch Bag",category:"Kids"},stock:"20",price:"180.00",orders:"60",rating:"4.3",published:{publishDate:"15 Jun, 2021",publishTime:"03:51 PM"}},{id:11,product:{img:"assets/images/products/img-1.png",title:"Half Sleeve Round Neck T-Shirts",category:"Fashion"},stock:"12",price:"215.00",orders:"48",rating:"4.2",published:{publishDate:"12 Oct, 2021",publishTime:"10:05 AM"}},{id:12,product:{img:"assets/images/products/img-2.png",title:"Urban Ladder Pashe Chair",category:"Furniture"},stock:"06",price:"160.00",orders:"30",rating:"4.3",published:{publishDate:"06 Jan, 2021",publishTime:"01:31 PM"}}],inputValueJson=sessionStorage.getItem("inputValue"),editinputValueJson=(inputValueJson&&(inputValueJson=JSON.parse(inputValueJson),Array.from(inputValueJson).forEach(e=>{productListAllData.unshift(e)})),sessionStorage.getItem("editInputValue")),productListAll=(editinputValueJson&&(editinputValueJson=JSON.parse(editinputValueJson),productListAllData=productListAllData.map(function(e){return e.id==editinputValueJson.id?editinputValueJson:e})),document.getElementById("addproduct-btn").addEventListener("click",function(){sessionStorage.setItem("editInputValue","")}),new gridjs.Grid({columns:[{name:"#",width:"40px",sort:{enabled:!1},data:function(e){return gridjs.html('
\t\t\t\t\t\t\t\t\t\t\t\t\t\t
')}},{name:"Product",width:"360px",data:function(e){return gridjs.html('
'+e.product.title+'

Category : '+e.product.category+"

")}},{name:"Stock",width:"94px"},{name:"Price",width:"101px",formatter:function(e){return gridjs.html("$"+e)}},{name:"Orders",width:"84px"},{name:"Rating",width:"105px",formatter:function(e){return gridjs.html(''+e+"")}},{name:"Published",width:"220px",data:function(e){return gridjs.html(e.published.publishDate+''+e.published.publishTime+"")}},{name:"Action",width:"80px",sort:{enabled:!1},formatter:function(e,t){t=(new DOMParser).parseFromString(t._cells[0].data.props.content,"text/html").body.querySelector(".checkbox-product-list .form-check-input").value;return gridjs.html('')}}],className:{th:"text-muted"},pagination:{limit:10},sort:!0,data:productListAllData}).render(document.getElementById("table-product-list-all"))),productListPublishedData=[{id:1,product:{img:"assets/images/products/img-2.png",title:"Urban Ladder Pashe Chair",category:"Furniture"},stock:"06",price:"160.00",orders:"30",rating:"4.3",published:{publishDate:"06 Jan, 2021",publishTime:"01:31 PM"}},{id:2,product:{img:"assets/images/products/img-6.png",title:"Half Sleeve T-Shirts (Blue)",category:"Fashion"},stock:"15",price:"125.00",orders:"48",rating:"4.2",published:{publishDate:"12 Oct, 2021",publishTime:"04:55 PM"}},{id:3,product:{img:"assets/images/products/img-4.png",title:"Fabric Dual Tone Living Room Chair",category:"Furniture"},stock:"15",price:"140.00",orders:"40",rating:"4.2",published:{publishDate:"19 Apr, 2021",publishTime:"02:51 PM"}},{id:4,product:{img:"assets/images/products/img-4.png",title:"350 ml Glass Grocery Container",category:"Grocery"},stock:"10",price:"125.00",orders:"48",rating:"4.5",published:{publishDate:"26 Mar, 2021",publishTime:"11:40 AM"}},{id:5,product:{img:"assets/images/products/img-5.png",title:"Crux Motorsports Helmet",category:"Automotive Accessories"},stock:"08",price:"135.00",orders:"55",rating:"4.4",published:{publishDate:"30 Mar, 2021",publishTime:"09:42 AM"}}],productListPublished=new gridjs.Grid({columns:[{name:"#",width:"40px",sort:{enabled:!1},formatter:function(e){return gridjs.html('
\t\t\t\t\t\t\t\t\t\t\t\t\t\t
')}},{name:"Product",width:"360px",data:function(e){return gridjs.html('
'+e.product.title+'

Category : '+e.product.category+"

")}},{name:"Stock",width:"94px"},{name:"Price",width:"101px",formatter:function(e){return gridjs.html("$"+e)}},{name:"Orders",width:"84px"},{name:"Rating",width:"105px",formatter:function(e){return gridjs.html(''+e+"")}},{name:"Published",width:"220px",data:function(e){return gridjs.html(e.published.publishDate+''+e.published.publishTime+"")}},{name:"Action",width:"80px",sort:{enabled:!1},formatter:function(e,t){return gridjs.html('')}}],className:{th:"text-muted"},pagination:{limit:10},sort:!0,data:productListPublishedData}).render(document.getElementById("table-product-list-published")),searchProductList=document.getElementById("searchProductList"),slider=(searchProductList.addEventListener("keyup",function(){var e=searchProductList.value.toLowerCase();function t(e,t){return e.filter(function(e){return-1!==e.product.title.toLowerCase().indexOf(t.toLowerCase())})}var i=t(productListAllData,e),e=t(productListPublishedData,e);productListAll.updateConfig({data:i}).forceRender(),productListPublished.updateConfig({data:e}).forceRender(),checkRemoveItem()}),Array.from(document.querySelectorAll(".filter-list a")).forEach(function(r){r.addEventListener("click",function(){var e=document.querySelector(".filter-list a.active"),t=(e&&e.classList.remove("active"),r.classList.add("active"),r.querySelector(".listname").innerHTML),e=productListAllData.filter(e=>e.product.category===t),i=productListPublishedData.filter(e=>e.product.category===t);productListAll.updateConfig({data:e}).forceRender(),productListPublished.updateConfig({data:i}).forceRender(),checkRemoveItem()})}),document.getElementById("product-price-range")),minCostInput=(noUiSlider.create(slider,{start:[0,2e3],step:10,margin:20,connect:!0,behaviour:"tap-drag",range:{min:0,max:2e3},format:wNumb({decimals:0,prefix:"$ "})}),document.getElementById("minCost")),maxCostInput=document.getElementById("maxCost"),filterDataAll="",filterDataPublished="",filterChoicesInput=(slider.noUiSlider.on("update",function(e,t){var i=productListAllData,r=productListPublishedData,s=(t?maxCostInput.value=e[t]:minCostInput.value=e[t],maxCostInput.value.substr(2)),a=minCostInput.value.substr(2);filterDataAll=i.filter(e=>parseFloat(e.price)>=a&&parseFloat(e.price)<=s),filterDataPublished=r.filter(e=>parseFloat(e.price)>=a&&parseFloat(e.price)<=s),productListAll.updateConfig({data:filterDataAll}).forceRender(),productListPublished.updateConfig({data:filterDataPublished}).forceRender(),checkRemoveItem()}),minCostInput.addEventListener("change",function(){slider.noUiSlider.set([null,this.value])}),maxCostInput.addEventListener("change",function(){slider.noUiSlider.set([null,this.value])}),new Choices(document.getElementById("filter-choices-input"),{addItems:!0,delimiter:",",editItems:!0,maxItemCount:10,removeItems:!0,removeItemButton:!0})),searchBrandsOptions=(Array.from(document.querySelectorAll(".filter-accordion .accordion-item")).forEach(function(r){var s=r.querySelectorAll(".filter-check .form-check .form-check-input:checked").length;r.querySelector(".filter-badge").innerHTML=s,Array.from(r.querySelectorAll(".form-check .form-check-input")).forEach(function(t){var i=t.value;t.checked&&filterChoicesInput.setValue([i]),t.addEventListener("click",function(e){t.checked?(s++,r.querySelector(".filter-badge").innerHTML=s,r.querySelector(".filter-badge").style.display=0