text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5cd8afe0"],{"1dde":function(t,e,c){var n=c("d039"),r=c("b622"),o=c("2d00"),i=r("species");t.exports=function(t){return o>=51||!n((function(){var e=[],c=e.constructor={};return c[i]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},2532:function(t,e,c){"use strict";var n=c("23e7"),r=c("e330"),o=c("5a34"),i=c("1d80"),u=c("577e"),l=c("ab13"),a=r("".indexOf);n({target:"String",proto:!0,forced:!l("includes")},{includes:function(t){return!!~a(u(i(this)),u(o(t)),arguments.length>1?arguments[1]:void 0)}})},"498a":function(t,e,c){"use strict";var n=c("23e7"),r=c("58a8").trim,o=c("c8d2");n({target:"String",proto:!0,forced:o("trim")},{trim:function(){return r(this)}})},"4de4":function(t,e,c){"use strict";var n=c("23e7"),r=c("b727").filter,o=c("1dde"),i=o("filter");n({target:"Array",proto:!0,forced:!i},{filter:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},5899:function(t,e){t.exports="\t\n\v\f\r                　\u2028\u2029\ufeff"},"58a8":function(t,e,c){var n=c("e330"),r=c("1d80"),o=c("577e"),i=c("5899"),u=n("".replace),l="["+i+"]",a=RegExp("^"+l+l+"*"),d=RegExp(l+l+"*$"),s=function(t){return function(e){var c=o(r(e));return 1&t&&(c=u(c,a,"")),2&t&&(c=u(c,d,"")),c}};t.exports={start:s(1),end:s(2),trim:s(3)}},b64b:function(t,e,c){var n=c("23e7"),r=c("7b0b"),o=c("df75"),i=c("d039"),u=i((function(){o(1)}));n({target:"Object",stat:!0,forced:u},{keys:function(t){return o(r(t))}})},c3fb:function(t,e,c){"use strict";c.r(e);c("b0c0"),c("a4d3"),c("e01a");var n=c("7a23"),r=function(t){return Object(n["D"])("data-v-1cc5da1c"),t=t(),Object(n["B"])(),t},o={class:"grid"},i={class:"col-12"},u={class:"card"},l={class:"my-2"},a={class:"flex flex-column md:flex-row md:justify-content-between md:align-items-center"},d=r((function(){return Object(n["j"])("h5",{class:"m-0"},"Manage Products",-1)})),s={class:"block mt-2 md:mt-0 p-input-icon-left"},b=r((function(){return Object(n["j"])("i",{class:"pi pi-search"},null,-1)})),p=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Code",-1)})),f=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Name",-1)})),j=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Image",-1)})),O=["src","alt"],m=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Price",-1)})),h=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Category",-1)})),g=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Rating",-1)})),v=r((function(){return Object(n["j"])("span",{class:"p-column-title"},"Status",-1)})),y=["src","alt"],S={class:"field"},P=r((function(){return Object(n["j"])("label",{for:"name"},"Name",-1)})),w={key:0,class:"p-invalid"},k={class:"field"},C=r((function(){return Object(n["j"])("label",{for:"description"},"Description",-1)})),D={class:"field"},V=r((function(){return Object(n["j"])("label",{for:"inventoryStatus",class:"mb-3"},"Inventory Status",-1)})),x={key:0},I={key:1},U={key:2},A={class:"field"},M=r((function(){return Object(n["j"])("label",{class:"mb-3"},"Category",-1)})),N={class:"formgrid grid"},_={class:"field-radiobutton col-6"},L=r((function(){return Object(n["j"])("label",{for:"category1"},"Accessories",-1)})),T={class:"field-radiobutton col-6"},R=r((function(){return Object(n["j"])("label",{for:"category2"},"Clothing",-1)})),E={class:"field-radiobutton col-6"},F=r((function(){return Object(n["j"])("label",{for:"category3"},"Electronics",-1)})),q={class:"field-radiobutton col-6"},B=r((function(){return Object(n["j"])("label",{for:"category4"},"Fitness",-1)})),K={class:"formgrid grid"},$={class:"field col"},z=r((function(){return Object(n["j"])("label",{for:"price"},"Price",-1)})),J={class:"field col"},Y=r((function(){return Object(n["j"])("label",{for:"quantity"},"Quantity",-1)})),Q={class:"flex align-items-center justify-content-center"},W=r((function(){return Object(n["j"])("i",{class:"pi pi-exclamation-triangle mr-3",style:{"font-size":"2rem"}},null,-1)})),G={key:0},H=Object(n["m"])("Are you sure you want to delete "),X=Object(n["m"])("?"),Z={class:"flex align-items-center justify-content-center"},tt=r((function(){return Object(n["j"])("i",{class:"pi pi-exclamation-triangle mr-3",style:{"font-size":"2rem"}},null,-1)})),et={key:0};function ct(t,e,c,r,ct,nt){var rt=Object(n["I"])("Toast"),ot=Object(n["I"])("Button"),it=Object(n["I"])("FileUpload"),ut=Object(n["I"])("Toolbar"),lt=Object(n["I"])("InputText"),at=Object(n["I"])("Column"),dt=Object(n["I"])("Rating"),st=Object(n["I"])("DataTable"),bt=Object(n["I"])("Textarea"),pt=Object(n["I"])("Dropdown"),ft=Object(n["I"])("RadioButton"),jt=Object(n["I"])("InputNumber"),Ot=Object(n["I"])("Dialog");return Object(n["A"])(),Object(n["i"])("div",o,[Object(n["j"])("div",i,[Object(n["j"])("div",u,[Object(n["n"])(rt),Object(n["n"])(ut,{class:"mb-4"},{start:Object(n["S"])((function(){return[Object(n["j"])("div",l,[Object(n["n"])(ot,{label:"New",icon:"pi pi-plus",class:"p-button-success mr-2",onClick:nt.openNew},null,8,["onClick"]),Object(n["n"])(ot,{label:"Delete",icon:"pi pi-trash",class:"p-button-danger",onClick:nt.confirmDeleteSelected,disabled:!ct.selectedProducts||!ct.selectedProducts.length},null,8,["onClick","disabled"])])]})),end:Object(n["S"])((function(){return[Object(n["n"])(it,{mode:"basic",accept:"image/*",maxFileSize:1e6,label:"Import",chooseLabel:"Import",class:"mr-2 inline-block"}),Object(n["n"])(ot,{label:"Export",icon:"pi pi-upload",class:"p-button-help",onClick:e[0]||(e[0]=function(t){return nt.exportCSV(t)})})]})),_:1}),Object(n["n"])(st,{ref:"dt",value:ct.products,selection:ct.selectedProducts,"onUpdate:selection":e[2]||(e[2]=function(t){return ct.selectedProducts=t}),dataKey:"id",paginator:!0,rows:10,filters:ct.filters,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",rowsPerPageOptions:[5,10,25],currentPageReportTemplate:"Showing {first} to {last} of {totalRecords} products",responsiveLayout:"scroll"},{header:Object(n["S"])((function(){return[Object(n["j"])("div",a,[d,Object(n["j"])("span",s,[b,Object(n["n"])(lt,{modelValue:ct.filters["global"].value,"onUpdate:modelValue":e[1]||(e[1]=function(t){return ct.filters["global"].value=t}),placeholder:"Search..."},null,8,["modelValue"])])])]})),default:Object(n["S"])((function(){return[Object(n["n"])(at,{selectionMode:"multiple",headerStyle:"width: 3rem"}),Object(n["n"])(at,{field:"code",header:"Code",sortable:!0,headerStyle:"width:14%; min-width:10rem;"},{body:Object(n["S"])((function(t){return[p,Object(n["m"])(" "+Object(n["M"])(t.data.code),1)]})),_:1}),Object(n["n"])(at,{field:"name",header:"Name",sortable:!0,headerStyle:"width:14%; min-width:10rem;"},{body:Object(n["S"])((function(t){return[f,Object(n["m"])(" "+Object(n["M"])(t.data.name),1)]})),_:1}),Object(n["n"])(at,{header:"Image",headerStyle:"width:14%; min-width:10rem;"},{body:Object(n["S"])((function(t){return[j,Object(n["j"])("img",{src:"images/product/"+t.data.image,alt:t.data.image,class:"shadow-2",width:"100"},null,8,O)]})),_:1}),Object(n["n"])(at,{field:"price",header:"Price",sortable:!0,headerStyle:"width:14%; min-width:8rem;"},{body:Object(n["S"])((function(t){return[m,Object(n["m"])(" "+Object(n["M"])(nt.formatCurrency(t.data.price)),1)]})),_:1}),Object(n["n"])(at,{field:"category",header:"Category",sortable:!0,headerStyle:"width:14%; min-width:10rem;"},{body:Object(n["S"])((function(t){return[h,Object(n["m"])(" "+Object(n["M"])(nt.formatCurrency(t.data.category)),1)]})),_:1}),Object(n["n"])(at,{field:"rating",header:"Reviews",sortable:!0,headerStyle:"width:14%; min-width:10rem;"},{body:Object(n["S"])((function(t){return[g,Object(n["n"])(dt,{modelValue:t.data.rating,readonly:!0,cancel:!1},null,8,["modelValue"])]})),_:1}),Object(n["n"])(at,{field:"inventoryStatus",header:"Status",sortable:!0,headerStyle:"width:14%; min-width:10rem;"},{body:Object(n["S"])((function(t){return[v,Object(n["j"])("span",{class:Object(n["u"])("product-badge status-"+(t.data.inventoryStatus?t.data.inventoryStatus.toLowerCase():""))},Object(n["M"])(t.data.inventoryStatus),3)]})),_:1}),Object(n["n"])(at,null,{body:Object(n["S"])((function(t){return[Object(n["n"])(ot,{icon:"pi pi-pencil",class:"p-button-rounded p-button-success mr-2",onClick:function(e){return nt.editProduct(t.data)}},null,8,["onClick"]),Object(n["n"])(ot,{icon:"pi pi-trash",class:"p-button-rounded p-button-warning mt-2",onClick:function(e){return nt.confirmDeleteProduct(t.data)}},null,8,["onClick"])]})),_:1})]})),_:1},8,["value","selection","filters"]),Object(n["n"])(Ot,{visible:ct.productDialog,"onUpdate:visible":e[12]||(e[12]=function(t){return ct.productDialog=t}),style:{width:"450px"},header:"Product Details",modal:!0,class:"p-fluid"},{footer:Object(n["S"])((function(){return[Object(n["n"])(ot,{label:"Cancel",icon:"pi pi-times",class:"p-button-text",onClick:nt.hideDialog},null,8,["onClick"]),Object(n["n"])(ot,{label:"Save",icon:"pi pi-check",class:"p-button-text",onClick:nt.saveProduct},null,8,["onClick"])]})),default:Object(n["S"])((function(){return[ct.product.image?(Object(n["A"])(),Object(n["i"])("img",{key:0,src:"images/product/"+ct.product.image,alt:ct.product.image,width:"150",class:"mt-0 mx-auto mb-5 block shadow-2"},null,8,y)):Object(n["h"])("",!0),Object(n["j"])("div",S,[P,Object(n["n"])(lt,{id:"name",modelValue:ct.product.name,"onUpdate:modelValue":e[3]||(e[3]=function(t){return ct.product.name=t}),modelModifiers:{trim:!0},required:"true",autofocus:"",class:Object(n["u"])({"p-invalid":ct.submitted&&!ct.product.name})},null,8,["modelValue","class"]),ct.submitted&&!ct.product.name?(Object(n["A"])(),Object(n["i"])("small",w,"Name is required.")):Object(n["h"])("",!0)]),Object(n["j"])("div",k,[C,Object(n["n"])(bt,{id:"description",modelValue:ct.product.description,"onUpdate:modelValue":e[4]||(e[4]=function(t){return ct.product.description=t}),required:"true",rows:"3",cols:"20"},null,8,["modelValue"])]),Object(n["j"])("div",D,[V,Object(n["n"])(pt,{id:"inventoryStatus",modelValue:ct.product.inventoryStatus,"onUpdate:modelValue":e[5]||(e[5]=function(t){return ct.product.inventoryStatus=t}),options:ct.statuses,optionLabel:"label",placeholder:"Select a Status"},{value:Object(n["S"])((function(t){return[t.value&&t.value.value?(Object(n["A"])(),Object(n["i"])("div",x,[Object(n["j"])("span",{class:Object(n["u"])("product-badge status-"+t.value.value)},Object(n["M"])(t.value.label),3)])):t.value&&!t.value.value?(Object(n["A"])(),Object(n["i"])("div",I,[Object(n["j"])("span",{class:Object(n["u"])("product-badge status-"+t.value.toLowerCase())},Object(n["M"])(t.value),3)])):(Object(n["A"])(),Object(n["i"])("span",U,Object(n["M"])(t.placeholder),1))]})),_:1},8,["modelValue","options"])]),Object(n["j"])("div",A,[M,Object(n["j"])("div",N,[Object(n["j"])("div",_,[Object(n["n"])(ft,{id:"category1",name:"category",value:"Accessories",modelValue:ct.product.category,"onUpdate:modelValue":e[6]||(e[6]=function(t){return ct.product.category=t})},null,8,["modelValue"]),L]),Object(n["j"])("div",T,[Object(n["n"])(ft,{id:"category2",name:"category",value:"Clothing",modelValue:ct.product.category,"onUpdate:modelValue":e[7]||(e[7]=function(t){return ct.product.category=t})},null,8,["modelValue"]),R]),Object(n["j"])("div",E,[Object(n["n"])(ft,{id:"category3",name:"category",value:"Electronics",modelValue:ct.product.category,"onUpdate:modelValue":e[8]||(e[8]=function(t){return ct.product.category=t})},null,8,["modelValue"]),F]),Object(n["j"])("div",q,[Object(n["n"])(ft,{id:"category4",name:"category",value:"Fitness",modelValue:ct.product.category,"onUpdate:modelValue":e[9]||(e[9]=function(t){return ct.product.category=t})},null,8,["modelValue"]),B])])]),Object(n["j"])("div",K,[Object(n["j"])("div",$,[z,Object(n["n"])(jt,{id:"price",modelValue:ct.product.price,"onUpdate:modelValue":e[10]||(e[10]=function(t){return ct.product.price=t}),mode:"currency",currency:"USD",locale:"en-US"},null,8,["modelValue"])]),Object(n["j"])("div",J,[Y,Object(n["n"])(jt,{id:"quantity",modelValue:ct.product.quantity,"onUpdate:modelValue":e[11]||(e[11]=function(t){return ct.product.quantity=t}),integeronly:""},null,8,["modelValue"])])])]})),_:1},8,["visible"]),Object(n["n"])(Ot,{visible:ct.deleteProductDialog,"onUpdate:visible":e[14]||(e[14]=function(t){return ct.deleteProductDialog=t}),style:{width:"450px"},header:"Confirm",modal:!0},{footer:Object(n["S"])((function(){return[Object(n["n"])(ot,{label:"No",icon:"pi pi-times",class:"p-button-text",onClick:e[13]||(e[13]=function(t){return ct.deleteProductDialog=!1})}),Object(n["n"])(ot,{label:"Yes",icon:"pi pi-check",class:"p-button-text",onClick:nt.deleteProduct},null,8,["onClick"])]})),default:Object(n["S"])((function(){return[Object(n["j"])("div",Q,[W,ct.product?(Object(n["A"])(),Object(n["i"])("span",G,[H,Object(n["j"])("b",null,Object(n["M"])(ct.product.name),1),X])):Object(n["h"])("",!0)])]})),_:1},8,["visible"]),Object(n["n"])(Ot,{visible:ct.deleteProductsDialog,"onUpdate:visible":e[16]||(e[16]=function(t){return ct.deleteProductsDialog=t}),style:{width:"450px"},header:"Confirm",modal:!0},{footer:Object(n["S"])((function(){return[Object(n["n"])(ot,{label:"No",icon:"pi pi-times",class:"p-button-text",onClick:e[15]||(e[15]=function(t){return ct.deleteProductsDialog=!1})}),Object(n["n"])(ot,{label:"Yes",icon:"pi pi-check",class:"p-button-text",onClick:nt.deleteSelectedProducts},null,8,["onClick"])]})),default:Object(n["S"])((function(){return[Object(n["j"])("div",Z,[tt,ct.product?(Object(n["A"])(),Object(n["i"])("span",et,"Are you sure you want to delete the selected products?")):Object(n["h"])("",!0)])]})),_:1},8,["visible"])])])])}c("b64b"),c("4de4"),c("d3b7"),c("e439"),c("159b"),c("dbb4");function nt(t,e,c){return e in t?Object.defineProperty(t,e,{value:c,enumerable:!0,configurable:!0,writable:!0}):t[e]=c,t}function rt(t,e){var c=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),c.push.apply(c,n)}return c}function ot(t){for(var e=1;e<arguments.length;e++){var c=null!=arguments[e]?arguments[e]:{};e%2?rt(Object(c),!0).forEach((function(e){nt(t,e,c[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(c)):rt(Object(c)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(c,e))}))}return t}c("498a"),c("caad"),c("2532");var it=c("0393"),ut=c("e9c0"),lt={data:function(){return{products:null,productDialog:!1,deleteProductDialog:!1,deleteProductsDialog:!1,product:{},selectedProducts:null,filters:{},submitted:!1,statuses:[{label:"INSTOCK",value:"instock"},{label:"LOWSTOCK",value:"lowstock"},{label:"OUTOFSTOCK",value:"outofstock"}]}},productService:null,created:function(){this.productService=new ut["a"],this.initFilters()},mounted:function(){var t=this;this.productService.getProducts().then((function(e){return t.products=e}))},methods:{formatCurrency:function(t){if(t)return t.toLocaleString("en-US",{style:"currency",currency:"USD"})},openNew:function(){this.product={},this.submitted=!1,this.productDialog=!0},hideDialog:function(){this.productDialog=!1,this.submitted=!1},saveProduct:function(){this.submitted=!0,this.product.name.trim()&&(this.product.id?(this.product.inventoryStatus=this.product.inventoryStatus.value?this.product.inventoryStatus.value:this.product.inventoryStatus,this.products[this.findIndexById(this.product.id)]=this.product,this.$toast.add({severity:"success",summary:"Successful",detail:"Product Updated",life:3e3})):(this.product.id=this.createId(),this.product.code=this.createId(),this.product.image="product-placeholder.svg",this.product.inventoryStatus=this.product.inventoryStatus?this.product.inventoryStatus.value:"INSTOCK",this.products.push(this.product),this.$toast.add({severity:"success",summary:"Successful",detail:"Product Created",life:3e3})),this.productDialog=!1,this.product={})},editProduct:function(t){this.product=ot({},t),this.productDialog=!0},confirmDeleteProduct:function(t){this.product=t,this.deleteProductDialog=!0},deleteProduct:function(){var t=this;this.products=this.products.filter((function(e){return e.id!==t.product.id})),this.deleteProductDialog=!1,this.product={},this.$toast.add({severity:"success",summary:"Successful",detail:"Product Deleted",life:3e3})},findIndexById:function(t){for(var e=-1,c=0;c<this.products.length;c++)if(this.products[c].id===t){e=c;break}return e},createId:function(){for(var t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",c=0;c<5;c++)t+=e.charAt(Math.floor(Math.random()*e.length));return t},exportCSV:function(){this.$refs.dt.exportCSV()},confirmDeleteSelected:function(){this.deleteProductsDialog=!0},deleteSelectedProducts:function(){var t=this;this.products=this.products.filter((function(e){return!t.selectedProducts.includes(e)})),this.deleteProductsDialog=!1,this.selectedProducts=null,this.$toast.add({severity:"success",summary:"Successful",detail:"Products Deleted",life:3e3})},initFilters:function(){this.filters={global:{value:null,matchMode:it["a"].CONTAINS}}}}},at=(c("e348"),c("6b0d")),dt=c.n(at);const st=dt()(lt,[["render",ct],["__scopeId","data-v-1cc5da1c"]]);e["default"]=st},c8d2:function(t,e,c){var n=c("5e77").PROPER,r=c("d039"),o=c("5899"),i="​᠎";t.exports=function(t){return r((function(){return!!o[t]()||i[t]()!==i||n&&o[t].name!==t}))}},caad:function(t,e,c){"use strict";var n=c("23e7"),r=c("4d64").includes,o=c("44d2");n({target:"Array",proto:!0},{includes:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),o("includes")},dbb4:function(t,e,c){var n=c("23e7"),r=c("83ab"),o=c("56ef"),i=c("fc6a"),u=c("06cf"),l=c("8418");n({target:"Object",stat:!0,sham:!r},{getOwnPropertyDescriptors:function(t){var e,c,n=i(t),r=u.f,a=o(n),d={},s=0;while(a.length>s)c=r(n,e=a[s++]),void 0!==c&&l(d,e,c);return d}})},e348:function(t,e,c){"use strict";c("fe11")},e439:function(t,e,c){var n=c("23e7"),r=c("d039"),o=c("fc6a"),i=c("06cf").f,u=c("83ab"),l=r((function(){i(1)})),a=!u||l;n({target:"Object",stat:!0,forced:a,sham:!u},{getOwnPropertyDescriptor:function(t,e){return i(o(t),e)}})},fe11:function(t,e,c){}}]);
  //# sourceMappingURL=chunk-5cd8afe0.c14cda37.js.map