(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5f6a4092"],{"6fba":function(e,t,n){"use strict";n.d(t,"d",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"e",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"c",(function(){return o}));n("96cf");var r=n("3b8d"),i=n("dfbe"),a=function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["b"].get("/design-blocks");case 2:return e.abrupt("return",e.sent.data);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),o=function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["b"].get("/design-blocks/".concat(t));case 2:return e.abrupt("return",e.sent.data);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),s=function(e){return i["b"].post("/design-blocks",e)},c=function(e){return i["b"].put("/design-blocks/".concat(e._id),e)},l=function(e){return i["b"].delete("/design-blocks/".concat(e))}},a584:function(e,t,n){"use strict";n.r(t);n("7f7f");var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"d-flex justify-content-between align-items-end flex-wrap"},[t("div",{staticClass:"d-flex mb-3 align-center"},[t("div",[t("label",[e._v("Design Block Category")]),t("select",{directives:[{name:"model",rawName:"v-model",value:e.editDesignBlockCategory,expression:"editDesignBlockCategory"}],staticClass:"form-control",on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.editDesignBlockCategory=t.target.multiple?n:n[0]}}},[t("option",{attrs:{selected:"",disabled:""}},[e._v("Choose Design Block Category")]),e._l(e.sortedDesignBlocksCategories,(function(n){return t("option",{key:n._id,domProps:{value:n}},[e._v("\n          "+e._s(n.name)+"\n        ")])}))],2)]),t("div",{staticClass:"align-self-end ml-2"},[t("button",{staticClass:"btn btn-light",attrs:{type:"button"},on:{click:function(t){return e.openDesignBlockCategoryForm(e.editDesignBlockCategory)}}},[e._v("\n        Edit\n      ")])]),t("div",{staticClass:"align-self-end ml-2"},[t("button",{staticClass:"btn btn-light",attrs:{type:"button"},on:{click:function(t){return e.$refs.deleteCategoryConfirm.show()}}},[t("i",{staticClass:"far fa-trash"})])])]),t("div",{staticClass:"d-flex mb-3"},[t("button",{staticClass:"btn btn-light",attrs:{type:"button"},on:{click:function(t){return e.openDesignBlockCategoryForm({})}}},[e._v("\n      Add Design Block Category\n    ")])]),t("b-modal",{ref:"designBlockCategoryForm",attrs:{"hide-footer":"","hide-header":""}},[t("div",{staticClass:"d-flex justify-content-between align-items-center"},[t("h3",[e._v(e._s(e.currentDesignBlockCategory._id?"Edit":"Add")+" Design Block Category")]),t("a",{staticClass:"text-secondary",on:{click:e.hideDesignBlockCategoryModal}},[t("i",{staticClass:"far fa-times fa-1x"})])]),t("div",{staticClass:"col-md-6 col-12 p-0"},[t("validated-input",{ref:"designBlockCategoryName",attrs:{label:"Category Name",validate:"required"},model:{value:e.currentDesignBlockCategory.name,callback:function(t){e.$set(e.currentDesignBlockCategory,"name",t)},expression:"currentDesignBlockCategory.name"}}),t("div",{staticClass:"form-inline mt-3"},[t("button",{staticClass:"btn btn-primary",attrs:{type:"button"},on:{click:function(t){return e.submit("DesignBlockCategory")}}},[e._v("Save")]),t("a",{staticClass:"ml-3",on:{click:e.hideDesignBlockCategoryModal}},[e._v("Cancel")])])],1)]),t("b-modal",{ref:"deleteCategoryConfirm",attrs:{title:"Delete Design Block Category"},on:{ok:e.deleteDesignBlockCategory}},[t("p",{staticClass:"mb-0"},[e._v("\n      Are you sure you want to remove the "),t("b",[e._v(e._s(e.editDesignBlockCategory.name))]),e._v(" design block category?\n    ")]),t("small",[e._v("All design blocks assigned on this category also will be deleted.")])])],1)},i=[],a=(n("20d6"),n("7514"),n("96cf"),n("3b8d")),o=n("6fba"),s=n("caaa"),c={data:function(){return{designBlocks:[],designBlockCategories:[],designBlockToDelete:{},editDesignBlockCategory:{},currentDesignBlockCategory:{},selectedDesignBlockCategory:{}}},watch:{"editDesignBlockCategory._id":function(e){localStorage.setItem("editDesignBlockCategory",e)}},created:function(){var e=Object(a["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["d"])();case 2:return this.designBlocks=e.sent.data,e.next=5,Object(s["c"])();case 5:this.designBlockCategories=e.sent,this.editDesignBlockCategory=this.selectedDesignBlockCategory=this.activeDesignBlockCategory;case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),computed:{activeDesignBlockCategory:function(){var e=localStorage.getItem("editDesignBlockCategory");return e?this.designBlockCategories.find((function(t){return t._id===e})):this.designBlockCategories.length&&this.designBlockCategories[0]},sortedDesignBlocksCategories:function(){return _.orderBy(this.designBlockCategories,["name"],["asc"])}},methods:{beforeRequest:function(e){e.fields=["name"]},onFinishLoadData:function(e){e.data;var t=e.totalCategories;this.tabFilters[0].criteria.length||(this.tabFilters[0].criteria=t.map((function(e){return{name:"".concat(e._id.name,"(").concat(e.total,")"),value:e._id._id}})))},deleteDesignBlockCategory:function(){var e=Object(a["a"])(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(s["b"])(this.editDesignBlockCategory._id);case 2:t=this.designBlockCategories.findIndex((function(e){return e._id===n.editDesignBlockCategory._id})),this.designBlocks=this.designBlocks.filter((function(e){return e.designBlockCategory!==n.designBlockCategories[t]._id})),this.designBlockCategories.splice(t,1),this.editDesignBlockCategory=this.selectedDesignBlockCategory=this.activeDesignBlockCategory;case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),filteredProducts:function(e){return this.products=e.filter((function(e){return!!e}))},showDesignBlockCategoryModal:function(){this.$refs.designBlockCategoryForm.show()},hideDesignBlockCategoryModal:function(){this.$refs.designBlockCategoryForm.hide()},openDesignBlockCategoryForm:function(e){this.currentDesignBlockCategory=_.cloneDeep(e),this.showDesignBlockCategoryModal()},submit:function(){var e=Object(a["a"])(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.$refs.designBlockCategoryName.$validator.validateAll();case 2:if(!this.$refs.designBlockCategoryName.errors||!this.$refs.designBlockCategoryName.errors.items.length){e.next=4;break}return e.abrupt("return");case 4:if(e.prev=4,!this.currentDesignBlockCategory._id){e.next=14;break}return e.next=8,Object(s["d"])(this.currentDesignBlockCategory);case 8:t=e.sent.model,n=this.designBlockCategories.findIndex((function(e){return e._id===t._id})),this.$set(this.designBlockCategories,n,t),this.editDesignBlockCategory=_.cloneDeep(t),e.next=18;break;case 14:return e.next=16,Object(s["a"])(this.currentDesignBlockCategory);case 16:r=e.sent.model,this.designBlockCategories.push(r);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e["catch"](4),this.notificateError(e.t0.data?e.t0.data.message||e.t0:e.t0.message||e.t0);case 23:this.hideDesignBlockCategoryModal();case 24:case"end":return e.stop()}}),e,this,[[4,20]])})));function t(){return e.apply(this,arguments)}return t}()}},l=c,u=n("2877"),g=Object(u["a"])(l,r,i,!1,null,null,null);t["default"]=g.exports},caaa:function(e,t,n){"use strict";n.d(t,"c",(function(){return a})),n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return s}));n("96cf");var r=n("3b8d"),i=n("dfbe"),a=function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["b"].get("/design-block-categories");case 2:return e.abrupt("return",e.sent.data);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),o=function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["b"].post("/design-block-categories",t);case 2:return e.abrupt("return",e.sent.data);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),s=function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["b"].put("/design-block-categories/".concat(t._id),t);case 2:return e.abrupt("return",e.sent.data);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),c=function(e){return i["b"].delete("/design-block-categories/".concat(e))}}}]);
//# sourceMappingURL=chunk-5f6a4092.ae087d25.js.map