{"size": 14990, "ext": "js", "max_stars_repo_path": "sneakerx-app/dist/spa/js/9.356b5c6a.js", "max_stars_repo_name": "DicSo92/SneakerX", "max_stars_repo_stars_event_min_datetime": "2021-08-30T16:10:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-30T16:10:46.000Z", "max_issues_repo_path": "sneakerx-app/dist/spa/js/9.356b5c6a.js", "max_issues_repo_name": "DicSo92/SneakerX", "max_issues_repo_issues_event_min_datetime": "2021-02-02T17:42:06.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-02T17:42:06.000Z", "max_forks_repo_path": "sneakerx-app/dist/spa/js/9.356b5c6a.js", "max_forks_repo_name": "DicSo92/SneakerX", "max_forks_repo_forks_event_min_datetime": "2020-07-08T06:10:03.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-08T06:10:03.000Z"}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 14990.0, "max_line_length": 14990, "alphanum_fraction": 0.6735156771}
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[9],{"011b":function(e,t,a){"use strict";var n=a("bb9d"),i=a.n(n);i.a},"394e":function(e,t,a){"use strict";var n=a("4b76"),i=a.n(n);i.a},"4b76":function(e,t,a){},"90fb":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("q-page",{staticClass:"column items-center",attrs:{padding:""}},[a("q-card",{staticClass:"full-width"},[a("q-card-section",{staticClass:"bg-grey-10 text-white flex full-width"},[a("div",{staticClass:"text-h6"},[e._v("Brand / List")]),a("q-space"),a("div",{staticClass:"flex"},[a("q-btn",{staticClass:"q-mr-sm",attrs:{color:"white",outline:"",icon:"edit",label:"Edit",disable:!e.selected.length},on:{click:e.editBrand}}),a("q-btn",{staticClass:"q-mr-sm",attrs:{color:"purple-9",icon:"add",label:"Add"},on:{click:e.addBrand}}),a("q-btn",{attrs:{color:"red-10",icon:"delete",label:"Delete",disable:!e.selected.length},on:{click:e.deleteBrand}})],1)],1),a("q-separator"),a("q-card-section",[a("BrandsList",{on:{selectedChange:e.changeSelect}})],1)],1),a("AddModal"),a("EditModal")],1)},i=[],s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"full-width"},[a("q-table",{staticClass:"BrandTable",attrs:{title:"Treats",data:e.brands,columns:e.columns,"visible-columns":e.visibleColumns,"row-key":"name",selection:"single",selected:e.selected,loading:e.loading},on:{"update:selected":function(t){e.selected=t}},scopedSlots:e._u([{key:"top",fn:function(){return[a("q-icon",{attrs:{name:"local_offer",size:"lg"}}),a("q-space"),a("q-input",{staticClass:"q-mr-md",attrs:{borderless:"",dense:"",debounce:"300",placeholder:"Search"},model:{value:e.search,callback:function(t){e.search=t},expression:"search"}},[a("q-icon",{attrs:{slot:"append",name:"search"},slot:"append"})],1),a("q-select",{staticStyle:{"min-width":"150px"},attrs:{multiple:"",outlined:"",dense:"","options-dense":"","display-value":e.$q.lang.table.columns,"emit-value":"","map-options":"",options:e.columns,"option-value":"name","options-cover":""},model:{value:e.visibleColumns,callback:function(t){e.visibleColumns=t},expression:"visibleColumns"}})]},proxy:!0},{key:"header",fn:function(t){return[a("q-tr",{attrs:{props:t}},[a("q-th",{attrs:{"auto-width":""}}),e._l(t.cols,(function(n){return a("q-th",{key:n.name,staticClass:"text-italic text-purple",attrs:{props:t}},[e._v("\n          "+e._s(n.label)+"\n        ")])}))],2)]}},{key:"body",fn:function(t){return[a("q-tr",{attrs:{props:t}},[a("q-td",[a("q-checkbox",{attrs:{color:"black"},model:{value:t.selected,callback:function(a){e.$set(t,"selected",a)},expression:"props.selected"}})],1),a("q-td",{key:"id",attrs:{props:t,"auto-width":""}},[e._v("\n          "+e._s(t.row.id)+" #\n        ")]),a("q-td",{key:"image",staticClass:"columnImage",attrs:{props:t,"auto-width":""}},[a("img",{staticClass:"image",attrs:{src:t.row.image?t.row.image:"statics/no-image.jpg",alt:""}})]),a("q-td",{key:"name",attrs:{props:t}},[a("div",{staticClass:"text-pre-wrap text-bold"},[e._v(e._s(t.row.name))])]),a("q-td",{key:"description",attrs:{props:t}},[a("div",{staticClass:"columnDescription",class:t.row.description?"":"text-red-5"},[e._v("\n            "+e._s(t.row.description?t.row.description:"No description")+"\n          ")])]),a("q-td",{key:"created_at",staticClass:"text-caption text-grey-7",attrs:{props:t}},[e._v(e._s(e.cFormatDate(t.row.created_at))+"\n        ")]),a("q-td",{key:"updated_at",staticClass:"text-caption text-grey-7",attrs:{props:t}},[e._v(e._s(e.cFormatDate(t.row.updated_at))+"\n        ")]),a("q-td",{key:"banner",attrs:{props:t,"auto-width":""}},[a("div",{staticClass:"flex justify-end items-center"},[a("img",{staticClass:"banner",attrs:{src:t.row.banner?t.row.banner:"statics/no-image.jpg",alt:""}})])])],1)]}},{key:"no-data",fn:function(t){var n=t.icon,i=t.message;t.filter;return[a("div",{staticClass:"full-width row flex-center text-accent q-gutter-sm"},[a("q-icon",{attrs:{size:"2em",name:"sentiment_dissatisfied"}}),a("span",[e._v("\n          Well this is sad... "+e._s(i)+"\n        ")]),a("q-icon",{attrs:{size:"2em",name:e.search?"filter_b_and_w":n}})],1)]}}])})],1)},o=[],r=(a("20d6"),a("d8ad")),l=a("cf57"),d=a("bd4c"),c={name:"BrandsList",data:function(){return{brands:[],loading:!0,search:"",pagination:{sortBy:"id",descending:!1,rowsPerPage:6},selected:[],visibleColumns:["id","image","name","description","banner"],columns:[{name:"id",required:!0,label:"ID",field:function(e){return e.id},align:"left",sortable:!0},{name:"image",align:"center",label:"Image",field:"image"},{name:"name",align:"left",label:"Name",field:"name",sortable:!0},{name:"description",align:"left",label:"Description",field:"description",sortable:!0},{name:"created_at",label:"Created At",field:"created_at",sortable:!0},{name:"updated_at",label:"Updated At",field:"updated_at",sortable:!0},{name:"banner",label:"Banner",field:"banner",align:"right"}]}},created:function(){var e=this;this.getBrands(),this.$root.$on("deleteBrand",(function(t){e.deleteBrand(t)}))},mounted:function(){var e=this;r["a"].$on("refreshBrands",(function(){e.getBrands()}))},watch:{selected:function(e){this.$emit("selectedChange",e)}},methods:{cFormatDate:function(e){return d["a"].formatDate(e,"DD/MM/YY HH:mm")},getBrands:function(){var e=this;this.loading=!0,this.$axios.get("/api/admin/brands").then((function(t){console.log(t),e.brands=t.data,e.loading=!1})).catch((function(t){console.log("error"),console.log(t),e.loading=!1}))},deleteBrand:function(e){var t=this;this.$q.loading.show({message:"Deleting Brand..."}),this.$axios.delete("/api/admin/brands/".concat(e)).then((function(a){console.log(a),t.brands.splice(t.brands.findIndex((function(t){return t.id===e})),1),t.hideLoading("Brand Deleted")})).catch((function(e){console.log(e),t.hideLoading("An error occurred : "+e.message)}))},hideLoading:function(e){var t=this;this.$q.loading.show({spinner:l["a"],spinnerColor:"red",messageColor:"black",backgroundColor:"yellow",message:e}),this.timer=setTimeout((function(){t.$q.loading.hide(),t.timer=void 0}),2e3)}},beforeDestroy:function(){var e=this;this.$root.$off("deleteBrand",(function(t){e.deleteBrand(t)}))}},u=c,m=(a("394e"),a("2877")),g=a("eebe"),p=a.n(g),h=a("eaac"),f=a("0016"),b=a("2c91"),v=a("27f9"),q=a("ddd8"),w=a("bd08"),C=a("357e"),B=a("db86"),x=a("8f8e"),_=Object(m["a"])(u,s,o,!1,null,"255eada0",null),y=_.exports;p()(_,"components",{QTable:h["a"],QIcon:f["a"],QSpace:b["a"],QInput:v["a"],QSelect:q["a"],QTr:w["a"],QTh:C["a"],QTd:B["a"],QCheckbox:x["a"]});var k=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("q-dialog",{model:{value:e.showEdit,callback:function(t){e.showEdit=t},expression:"showEdit"}},[a("q-card",{staticStyle:{width:"700px","max-width":"80vw"}},[a("q-card-section",[a("q-form",{staticClass:"q-gutter-md",on:{submit:e.addBrand}},[a("q-input",{attrs:{filled:"",label:"Brand Name *",hint:"Main Name","lazy-rules":"",rules:[function(e){return e&&e.length>0||"Please type something"}]},model:{value:e.name,callback:function(t){e.name=t},expression:"name"}}),a("q-editor",{attrs:{"min-height":"5rem","toolbar-toggle-color":"yellow-9"},model:{value:e.description,callback:function(t){e.description=t},expression:"description"}}),a("div",{staticClass:"flex justify-between"},[a("q-uploader",{attrs:{label:"Banner (Restricted to images)",accept:".jpg, image/*","hide-upload-btn":"",square:"",color:"grey-10"},on:{added:function(t){return e.toggleImagesData(t,!0,"banner")},removed:function(t){return e.toggleImagesData(t,!1,"banner")}}}),a("q-uploader",{attrs:{label:"Image (Restricted to images)",accept:".jpg, image/*","hide-upload-btn":"",square:"",color:"grey-10"},on:{added:function(t){return e.toggleImagesData(t,!0,"image")},removed:function(t){return e.toggleImagesData(t,!1,"image")}}})],1),a("div",[a("q-btn",{attrs:{loading:e.loading,color:"purple-10",label:"Submit",type:"submit","icon-right":"send"},scopedSlots:e._u([{key:"loading",fn:function(){return[a("q-spinner-hourglass",{staticClass:"on-left"}),e._v("\n              Loading...\n            ")]},proxy:!0}])}),a("q-btn",{staticClass:"q-ml-sm",attrs:{label:"Cancel",color:"black",flat:""},on:{click:function(t){e.showEdit=!1}}})],1)],1)],1)],1)],1)},I=[],Q=(a("7f7f"),{name:"AddModal",data:function(){return{showEdit:!1,name:"",description:"",bannerFile:null,imageFile:null,loading:!1}},mounted:function(){var e=this;this.$root.$on("showAddBrand",(function(t){e.showEdit=!!t}))},methods:{addBrand:function(){var e=this;this.loading=!0;var t={headers:{"content-type":"multipart/form-data"}},a=new FormData;a.append("name",this.name),a.append("description",this.description),this.bannerFile&&a.append("banner",this.bannerFile),this.imageFile&&a.append("image",this.imageFile),this.$axios.post("/api/admin/brands",a,t).then((function(t){console.log(t),e.showEdit=!1,e.name="",e.description="",e.bannerFile=null,e.imageFile=null,r["a"].$emit("refreshBrands"),e.loading=!1})).catch((function(t){console.log(t),e.loading=!1}))},toggleImagesData:function(e,t,a){"banner"===a?this.bannerFile=t?e[0]:null:"image"===a&&(this.imageFile=t?e[0]:null)}}}),$=Q,E=a("24e8"),D=a("f09f"),F=a("a370"),S=a("0378"),j=a("d66b"),T=a("ee89"),A=a("9c40"),M=a("9149"),L=Object(m["a"])($,k,I,!1,null,"2b9586c9",null),N=L.exports;p()(L,"components",{QDialog:E["a"],QCard:D["a"],QCardSection:F["a"],QForm:S["a"],QInput:v["a"],QEditor:j["a"],QUploader:T["a"],QBtn:A["a"],QSpinnerHourglass:M["a"]});var z=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("q-dialog",{model:{value:e.showEdit,callback:function(t){e.showEdit=t},expression:"showEdit"}},[a("q-card",{staticStyle:{width:"700px","max-width":"80vw"}},[a("q-card-section",[a("q-form",{staticClass:"q-gutter-md",on:{submit:e.editBrand}},[a("q-input",{attrs:{filled:"",label:"Brand Name *",hint:"Main Name","lazy-rules":"",rules:[function(e){return e&&e.length>0||"Please type something"}]},model:{value:e.name,callback:function(t){e.name=t},expression:"name"}}),a("q-editor",{attrs:{"min-height":"5rem","toolbar-toggle-color":"yellow-9"},model:{value:e.description,callback:function(t){e.description=t},expression:"description"}}),a("div",{staticClass:"row"},[a("div",{staticClass:"col"},[a("p",[e._v("Current Banner : "),e.currentBanner?e._e():a("span",{staticClass:"text-red-8"},[e._v("Nothing")])]),e.currentBanner?a("div",{staticClass:"flex flex-center relative-position"},[a("q-btn",{staticClass:"deleteBtn",attrs:{round:"",loading:e.loadingBanner,color:"red-9",size:"md",icon:"delete"},on:{click:function(t){return e.removeImage("banner")}},scopedSlots:e._u([{key:"loading",fn:function(){return[a("q-spinner-facebook")]},proxy:!0}],null,!1,4102112682)}),a("q-img",{staticClass:"currentImages",attrs:{src:e.currentBanner,alt:""}})],1):e._e()]),a("div",{staticClass:"col"},[a("p",[e._v("Current Image : "),e.currentImage?e._e():a("span",{staticClass:"text-red-8"},[e._v("Nothing")])]),e.currentImage?a("div",{staticClass:"flex flex-center relative-position"},[a("q-btn",{staticClass:"deleteBtn",attrs:{round:"",loading:e.loadingImage,color:"red-9",size:"md",icon:"delete"},on:{click:function(t){return e.removeImage("image")}},scopedSlots:e._u([{key:"loading",fn:function(){return[a("q-spinner-facebook")]},proxy:!0}],null,!1,4102112682)}),a("q-img",{staticClass:"currentImages",attrs:{src:e.currentImage,alt:""}})],1):e._e()])]),a("div",{staticClass:"flex justify-between"},[a("q-uploader",{attrs:{label:"Change Banner (.jpg,.png,.jpeg,...)",accept:".jpg, image/*","hide-upload-btn":"",square:"",color:"grey-10"},on:{added:function(t){return e.toggleImagesData(t,!0,"banner")},removed:function(t){return e.toggleImagesData(t,!1,"banner")}}}),a("q-uploader",{attrs:{label:"Change Image (.jpg,.png,.jpeg,...)",accept:".jpg, image/*","hide-upload-btn":"",square:"",color:"grey-10"},on:{added:function(t){return e.toggleImagesData(t,!0,"image")},removed:function(t){return e.toggleImagesData(t,!1,"image")}}})],1),a("div",[a("q-btn",{attrs:{loading:e.loading,color:"purple-10",label:"Submit",type:"submit","icon-right":"send"},scopedSlots:e._u([{key:"loading",fn:function(){return[a("q-spinner-hourglass",{staticClass:"on-left"}),e._v("\n              Loading...\n            ")]},proxy:!0}])}),a("q-btn",{staticClass:"q-ml-sm",attrs:{label:"Cancel",color:"black",flat:""},on:{click:function(t){e.showEdit=!1}}})],1)],1)],1)],1)],1)},P=[],H={name:"AddModal",data:function(){return{showEdit:!1,brandToEdit:null,name:"",description:"",bannerFile:null,imageFile:null,currentBanner:null,currentImage:null,loadingBanner:!1,loadingImage:!1,loading:!1}},mounted:function(){var e=this;this.$root.$on("showEditBrand",(function(t,a){e.brandToEdit=a,e.name=a.name,e.description=a.description,e.bannerFile=null,e.imageFile=null,e.currentBanner=a.banner,e.currentImage=a.image,e.showEdit=!!t}))},methods:{editBrand:function(){var e=this;this.loading=!0;var t={headers:{"content-type":"multipart/form-data"}},a=new FormData;this.name!==this.brandToEdit.name&&a.append("name",this.name),this.description!==this.brandToEdit.description&&a.append("description",this.description),this.bannerFile&&a.append("banner",this.bannerFile),this.imageFile&&a.append("image",this.imageFile),this.$axios.post("/api/admin/brands/".concat(this.brandToEdit.id),a,t).then((function(t){console.log(t),e.loading=!1,e.showEdit=!1,r["a"].$emit("refreshBrands")})).catch((function(t){console.log(t),e.loading=!1}))},removeImage:function(e){var t=this;"banner"===e&&(this.loadingBanner=!0),"image"===e&&(this.loadingImage=!0),this.$axios.delete("/api/admin/brands/imageDelete/".concat(this.brandToEdit.id,"?type=").concat(e)).then((function(a){console.log(a),"banner"===e?(t.loadingBanner=!1,t.currentBanner=null):"image"===e&&(t.loadingImage=!1,t.currentImage=null),r["a"].$emit("refreshBrands")})).catch((function(a){console.log(a),"banner"===e&&(t.loadingBanner=!1),"image"===e&&(t.loadingImage=!1)}))},toggleImagesData:function(e,t,a){"banner"===a?this.bannerFile=t?e[0]:null:"image"===a&&(this.imageFile=t?e[0]:null)}}},O=H,U=(a("011b"),a("e669")),J=a("068f"),R=Object(m["a"])(O,z,P,!1,null,"bb225e3c",null),Y=R.exports;p()(R,"components",{QDialog:E["a"],QCard:D["a"],QCardSection:F["a"],QForm:S["a"],QInput:v["a"],QEditor:j["a"],QBtn:A["a"],QSpinnerFacebook:U["a"],QImg:J["a"],QUploader:T["a"],QSpinnerHourglass:M["a"]});var W={name:"Brands",components:{BrandsList:y,AddModal:N,EditModal:Y},data:function(){return{selected:[]}},created:function(){},mounted:function(){},computed:{},methods:{changeSelect:function(e){this.selected=e},addBrand:function(){this.$root.$emit("showAddBrand",!0)},editBrand:function(){this.$root.$emit("showEditBrand",!0,this.selected[0])},deleteBrand:function(){this.$root.$emit("deleteBrand",this.selected[0].id)}}},G=W,K=a("9989"),V=a("eb85"),X=Object(m["a"])(G,n,i,!1,null,"2939e6fc",null);t["default"]=X.exports;p()(X,"components",{QPage:K["a"],QCard:D["a"],QCardSection:F["a"],QSpace:b["a"],QBtn:A["a"],QSeparator:V["a"]})},bb9d:function(e,t,a){}}]);