Sindbad~EG File Manager

Current Path : /home/infinitibizsol/.trash/static/js/
Upload File :
Current File : /home/infinitibizsol/.trash/static/js/824.182b2e35.chunk.js

"use strict";(self.webpackChunk_minimal_material_kit_react=self.webpackChunk_minimal_material_kit_react||[]).push([[824],{4469:function(e,t,n){var r=n(6459),i=n(4165),o=n(5861),a=n(1243),c=n(6382),s=n(9113),u=localStorage.getItem("userToken");(0,c.hg)("products/create",function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var r,o;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.rejectWithValue,e.prev=1,o={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(u)}},a.Z.post("".concat(s.v,"/product"),t,o).then((function(e){console.log("Product Action",null===e||void 0===e?void 0:e.data)})),e.next=10;break;case 6:if(e.prev=6,e.t0=e.catch(1),!e.t0.response||!e.t0.response.data.message){e.next=10;break}return e.abrupt("return",r(e.t0.response.data.message));case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(t,n){return e.apply(this,arguments)}}()),(0,c.hg)("products/get",function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var r,o,c,l,d;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.id,o=n.rejectWithValue,console.log("[getProductsForBrand]",r),e.prev=3,c={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(u)}},e.next=7,a.Z.get("".concat(s.v,"/product/").concat(r),c);case 7:if(l=e.sent,!(d=l.data)){e.next=12;break}return console.log("[getProductsForBrand]",d),e.abrupt("return",d);case 12:e.next=18;break;case 14:if(e.prev=14,e.t0=e.catch(3),!e.t0.response||!e.t0.response.data.message){e.next=18;break}return e.abrupt("return",o(e.t0.response.data.message));case 18:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(t,n){return e.apply(this,arguments)}}()),(0,c.hg)("products/getAll",function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var o,c,l,d;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,r.Z)(t),o=n.rejectWithValue,e.prev=2,c={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(u)}},e.next=6,a.Z.get("".concat(s.v,"/products"),c);case 6:if(l=e.sent,!(d=l.data)){e.next=10;break}return e.abrupt("return",d.products);case 10:e.next=16;break;case 12:if(e.prev=12,e.t0=e.catch(2),!e.t0.response||!e.t0.response.data.message){e.next=16;break}return e.abrupt("return",o(e.t0.response.data.message));case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(t,n){return e.apply(this,arguments)}}()),(0,c.hg)("product/edit",function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var r,o,c,l,d,p,h,f;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.id,o=t.values,c=n.rejectWithValue,e.prev=2,l={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(u)}},console.log("Action",r,o),e.next=7,a.Z.put("".concat(s.v,"/product/").concat(r),o,l);case 7:return null!==(d=e.sent)&&void 0!==d&&d.data&&console.log("Product edit payload",null===d||void 0===d?void 0:d.data),e.abrupt("return",null===d||void 0===d?void 0:d.data);case 12:if(e.prev=12,e.t0=e.catch(2),!e.t0.response){e.next=18;break}return e.abrupt("return",c(null===e.t0||void 0===e.t0||null===(p=e.t0.response)||void 0===p||null===(h=p.data)||void 0===h||null===(f=h.error)||void 0===f?void 0:f.message));case 18:return e.abrupt("return",c(e.t0.message));case 19:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(t,n){return e.apply(this,arguments)}}()),(0,c.hg)("product/delete",function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var r,o,c,l,d,p,h;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.rejectWithValue,e.prev=1,o={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(u)}},e.next=5,a.Z.delete("".concat(s.v,"/product/").concat(t),o);case 5:if(c=e.sent,!(l=c.data)){e.next=9;break}return e.abrupt("return",l);case 9:e.next=18;break;case 11:if(e.prev=11,e.t0=e.catch(1),!e.t0.response){e.next=17;break}return e.abrupt("return",r(null===e.t0||void 0===e.t0||null===(d=e.t0.response)||void 0===d||null===(p=d.data)||void 0===p||null===(h=p.error)||void 0===h?void 0:h.message));case 17:return e.abrupt("return",r(e.t0.message));case 18:case"end":return e.stop()}}),e,null,[[1,11]])})));return function(t,n){return e.apply(this,arguments)}}()),(0,c.hg)("product/sort",function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var r,o,c,l,d,p,h,f,x,v;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sortBy,o=t.sort,c=n.rejectWithValue,e.prev=2,l=s.v+"/product/filter",r&&(l=s.v+"/product/filter?sortBy=".concat(r,"&sort=").concat(o)),d={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(u)}},e.next=8,a.Z.get("".concat(l),d);case 8:if(p=e.sent,!(h=p.data)){e.next=13;break}return console.log("Product sort payload",h),e.abrupt("return",h);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(2),!e.t0.response){e.next=21;break}return e.abrupt("return",c(null===e.t0||void 0===e.t0||null===(f=e.t0.response)||void 0===f||null===(x=f.data)||void 0===x||null===(v=x.error)||void 0===v?void 0:v.message));case 21:return e.abrupt("return",c(e.t0.message));case 22:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(t,n){return e.apply(this,arguments)}}())},824:function(e,t,n){n.r(t);var r=n(1413),i=n(3433),o=n(9439),a=n(2791),c=n(1614),s=n(3767),u=n(890),l=n(4518),d=n(1889),p=n(8096),h=n(4613),f=n(9321),x=n(3786),v=n(2199),g=n(5523),m=n(9174),j=n(7391),Z=n(7621),b=n(9504),y=n(3400),C=n(5078),k=(n(5985),n(4600)),P=n(3609),w=n(7689),A=n(9434),_=(n(4469),n(9113)),W=n(1243),z=n(184);window.Buffer=window.Buffer||n(9778).lW;var B={upper:["XS","S","M","L","XL"],lower:[28,29,30,31,32,33,34,35,36,37,38,39,40],feet:[35,36,37,38,39,40,41,42,43,44,45,46,47]};t.default=function(){var e=(0,w.s0)(),t=((0,A.I0)(),(0,a.useState)([])),n=(0,o.Z)(t,2),S=n[0],N=n[1],I=(0,a.useState)([]),T=(0,o.Z)(I,2),q=T[0],R=T[1],V=(0,a.useState)(""),L=(0,o.Z)(V,2),U=L[0],D=L[1],Q=(0,A.v9)((function(e){return e.auth})),E=Q.brandInfo,F=Q.userInfo,M=null===F||void 0===F?void 0:F.user_role,O=null===E||void 0===E?void 0:E.brand_id,H=localStorage.getItem("userToken");(0,a.useEffect)((function(){W.Z.get("".concat(_.v,"/brands/"),{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(H)}}).then((function(e){N(e.data)})).catch((function(e){console.log("[Error]",e)}))}),[H]),(0,a.useEffect)((function(){W.Z.get("".concat(_.v,"/category/"),{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(H)}}).then((function(e){R(null===e||void 0===e?void 0:e.data)})).catch((function(e){console.log("[Error]",e)}))}),[H]);var X=(0,a.useRef)(),G=(0,a.useRef)(),J=(0,a.useState)([]),K=(0,o.Z)(J,2),Y=K[0],$=K[1];return(0,z.jsxs)(c.Z,{children:[(0,z.jsxs)(s.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",mb:5,children:[(0,z.jsx)(u.Z,{variant:"h4",sx:{mb:5},children:"Create Products"}),(0,z.jsx)(l.Z,{variant:"contained",onClick:function(){return e("/dashboard/".concat(M,"/products"),{replace:!0})},children:"Back To Product"})]}),(0,z.jsx)(C.l0,{onSubmit:function(){console.log("Submit")},initialValues:{name:"",category:"",brand:"brand"===(null===F||void 0===F?void 0:F.user_role)?O:"",productCode:"",color:"",size:[],price:0,quantity:1,discount:0,description:"",imgUrl:[]},validate:function(e){console.log("[validate]",e.size);var t={};return e.name||(t.name="Name is required!"),e.category||(t.category="Category is required!"),e.brand||"brand"===(null===F||void 0===F?void 0:F.user_role)||(t.brand="Brand name is required!"),0===e.price&&(t.price="Price is required!"),e.description||(t.description="Description is required!"),e.quantity||(t.quantity="Quantity is required!"),e.productCode||(t.productCode="ProductCode is required!"),e.color||(t.color="Color is required!"),console.log("ere",t),t},mutators:{onChangeQuantity:function(e,t,n){n.changeValue(t,"quantity",(function(t){return function(t){return t>1||1===t&&1==e?Number(null!==t&&void 0!==t?t:1)+Number(e):1}(t)}))},onChangeCheckBox:function(e,t,n){n.changeValue(t,"size",(function(t){return-1!==(n=t).indexOf(e[0])?n.filter((function(t){return t!==e[0]})):[].concat((0,i.Z)(n),[e[0]]);var n}))}},render:function(e){var t=e.handleSubmit,n=(e.errors,e.form);return(0,z.jsxs)("form",{onSubmit:t,children:[(0,z.jsxs)(d.ZP,{container:!0,spacing:4,children:[(0,z.jsx)(d.ZP,{item:!0,xs:6,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"name",children:function(e){return(0,z.jsx)(k.Z,(0,r.Z)({label:"Product Name"},e))}})}),(0,z.jsx)(d.ZP,{item:!0,xs:6,children:(0,z.jsx)(C.gN,{fullWidth:!0,component:"select",name:"category",children:function(e){var t=e.input;e.meta,e.options;return(0,z.jsxs)(p.Z,{fullWidth:!0,children:[(0,z.jsx)(h.Z,{id:"brand-label",children:"Product Category"}),(0,z.jsx)(f.Z,(0,r.Z)((0,r.Z)({labelId:"brand-label",name:"category",options:q,MenuProps:{style:{maxHeight:300}}},t),{},{children:null===q||void 0===q?void 0:q.map((function(e,t){return(0,z.jsx)(x.Z,{value:e._id,children:e.categoryName},t)}))}))]})}})}),"brand"!==(null===F||void 0===F?void 0:F.user_role)&&(0,z.jsx)(d.ZP,{item:!0,xs:4,mt:3,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"brand",children:function(e){var t,n=e.input;e.meta,e.options;return(0,z.jsxs)(p.Z,{fullWidth:!0,children:[(0,z.jsx)(h.Z,{id:"brand-label",children:"Brand Name"}),(0,z.jsx)(f.Z,{labelId:"brand-label",name:"brand",options:S,onChange:function(e){return n.onChange(e)},MenuProps:{style:{maxHeight:300}},children:null===S||void 0===S||null===(t=S.brands)||void 0===t?void 0:t.map((function(e,t){return(0,z.jsx)(x.Z,{value:e._id,children:e.brandName},t)}))})]})}})}),(0,z.jsx)(d.ZP,{item:!0,xs:4,mt:3,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"productCode",children:function(e){return(0,z.jsx)(k.Z,(0,r.Z)({label:"Product Code"},e))}})}),(0,z.jsx)(d.ZP,{item:!0,xs:4,mt:3,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"color",children:function(e){return(0,z.jsx)(k.Z,(0,r.Z)({label:"Product Color"},e))}})}),(0,z.jsx)(d.ZP,{item:!0,xs:"brand"!==(null===F||void 0===F?void 0:F.user_role)?4:6,mt:3,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"price",children:function(e){return(0,z.jsx)(k.Z,(0,r.Z)({label:"Price",type:"number",style:{paddingRight:0},InputProps:{inputProps:{min:0}}},e))}})}),(0,z.jsx)(d.ZP,{item:!0,xs:"brand"!==(null===F||void 0===F?void 0:F.user_role)?4:6,mt:3,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"quantity",children:function(e){return(0,z.jsx)(k.Z,(0,r.Z)({label:"Available Quantity",type:"number",style:{paddingRight:0},InputProps:{inputProps:{max:100,min:0},endAdornment:(0,z.jsxs)(v.Z,{size:"small","aria-label":"small button group",orientation:"vertical",children:[(0,z.jsx)(l.Z,{color:"primary",variant:"text",onClick:function(){return n.mutators.onChangeQuantity(1)},children:(0,z.jsx)(P.Z,{icon:"eva:plus-fill"})}),(0,z.jsx)(l.Z,{color:"error",variant:"text",onClick:function(){return n.mutators.onChangeQuantity(-1)},children:(0,z.jsx)(P.Z,{icon:"eva:minus-fill"})})]})}},e))}})}),(0,z.jsx)(d.ZP,{item:!0,xs:"brand"!==(null===F||void 0===F?void 0:F.user_role)?4:6,mt:3,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"discount",children:function(e){return(0,z.jsx)(k.Z,(0,r.Z)({label:"Discount",type:"number",style:{paddingRight:0},InputProps:{inputProps:{min:0}}},e))}})}),q.find((function(e){return e._id===n.getState().values.category}))&&(0,z.jsx)(d.ZP,{item:!0,xs:"brand"!==(null===F||void 0===F?void 0:F.user_role)?12:6,children:(0,z.jsx)(C.gN,{fullWidth:!0,name:"size",type:"checkbox",children:function(e){var t,i;return(0,z.jsxs)(p.Z,{fullWidth:!0,children:["Available Size:",(0,z.jsx)(d.ZP,{item:!0,lg:12,children:""!==q.find((function(e){return e._id===n.getState().values.category}))&&(null===(t=B[null===(i=q.find((function(e){return e._id===n.getState().values.category})))||void 0===i?void 0:i.sizeType])||void 0===t?void 0:t.map((function(t,i){return(0,z.jsx)(g.Z,{control:(0,z.jsx)(m.Z,(0,r.Z)({name:t,onChange:function(e){n.mutators.onChangeCheckBox(t)}},e)),label:t},i)})))})]})}})}),(0,z.jsx)(d.ZP,{item:!0,xs:12,children:(0,z.jsx)(C.gN,{name:"description",render:function(e){var t=e.input;return(0,z.jsx)(j.Z,(0,r.Z)((0,r.Z)({fullWidth:!0},t),{},{label:"Product Description",multiline:!0,rows:6}))}})}),(0,z.jsx)(u.Z,{variant:"h4",sx:{marginTop:5,marginLeft:5},children:"Upload Images:"}),(0,z.jsxs)(d.ZP,{item:!0,xs:12,style:{flexDirection:"row",display:"flex"},children:[(null===Y||void 0===Y?void 0:Y.length)>0&&(null===Y||void 0===Y?void 0:Y.map((function(e){return(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(Z.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center",display:"grid",marginRight:5},children:[(0,z.jsx)(P.Z,{icon:"mdi:close-circle-outline",sx:{width:25,height:25,position:"absolute",right:5,top:5,zIndex:9999},onClick:function(){return function(e){var t=Y.filter((function(t){return t!==e}));$(t)}(e)}}),(0,z.jsx)(b.Z,{children:(0,z.jsx)("img",{src:URL.createObjectURL(e),alt:""})})]})})}))),(0,z.jsx)(Z.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center"},children:(0,z.jsxs)(b.Z,{style:{justifyContent:"center"},children:[(0,z.jsx)("input",{ref:X,style:{display:"none"},type:"file",accept:"image/*",onChange:function(e){return $((function(t){return[].concat((0,i.Z)(t),[e.target.files[0]])}))},multiple:!0}),(0,z.jsx)(y.Z,{onClick:function(){return X.current.click()},children:(0,z.jsx)(P.Z,{icon:"mdi:file-image-plus-outline",sx:{width:80,height:80}})})]})})]}),(0,z.jsxs)(u.Z,{variant:"h4",sx:{marginTop:5,marginLeft:5},children:["Upload Size Chart"," ",(0,z.jsx)("span",{style:{color:"#b2b2b2"},children:"(optional)"}),":"]}),(0,z.jsxs)(d.ZP,{item:!0,xs:12,style:{flexDirection:"row",display:"flex"},children:[U&&(0,z.jsxs)(Z.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center",display:"grid",marginRight:5},children:[(0,z.jsx)(P.Z,{icon:"mdi:close-circle-outline",sx:{width:25,height:25,position:"absolute",right:5,top:5,zIndex:9999},onClick:function(){return D("")}}),(0,z.jsx)(b.Z,{children:(0,z.jsx)("img",{src:URL.createObjectURL(U)})})]}),(0,z.jsx)(Z.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center"},children:(0,z.jsxs)(b.Z,{style:{justifyContent:"center"},children:[(0,z.jsx)("input",{ref:G,style:{display:"none"},type:"file",accept:"image/*",onChange:function(e){return D((function(){return e.target.files[0]}))}}),(0,z.jsx)(y.Z,{onClick:function(){return G.current.click()},children:(0,z.jsx)(P.Z,{icon:"mdi:file-image-plus-outline",sx:{width:80,height:80}})})]})})]})]}),(0,z.jsx)(d.ZP,{container:!0,direction:"row",justifyContent:"center",alignItems:"center",m:4,children:(0,z.jsx)(l.Z,{variant:"contained",size:"large",type:"submit",children:"Save"})})]})}})]})}}}]);
//# sourceMappingURL=824.182b2e35.chunk.js.map

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists