Sindbad~EG File Manager

Current Path : /home/infinitibizsol/public_html/auction-sync.com/static/js/
Upload File :
Current File : /home/infinitibizsol/public_html/auction-sync.com/static/js/540.061ae377.chunk.js

"use strict";(self.webpackChunk_minimal_material_kit_react=self.webpackChunk_minimal_material_kit_react||[]).push([[540],{4469:(e,t,n)=>{var i=n(1243),o=n(6382),r=n(9113);const l=n(644).Z.getItem("userToken");(0,o.hg)("products/create",(async(e,t)=>{let{rejectWithValue:n}=t;try{const t={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(l)}};i.Z.post("".concat(r.v,"/product"),e,t).then((e=>{console.log("Product Action",null===e||void 0===e?void 0:e.data)}))}catch(o){if(o.response&&o.response.data.message)return n(o.response.data.message)}})),(0,o.hg)("products/get",(async(e,t)=>{let{id:n}=e,{rejectWithValue:o}=t;console.log("[getProductsForBrand]",n);try{const e={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(l)}},{data:t}=await i.Z.get("".concat(r.v,"/product/").concat(n),e);if(t)return console.log("[getProductsForBrand]",t),t}catch(a){if(a.response&&a.response.data.message)return o(a.response.data.message)}})),(0,o.hg)("products/getAll",(async(e,t)=>{let{}=e,{rejectWithValue:n}=t;try{const e={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(l)}},{data:t}=await i.Z.get("".concat(r.v,"/products"),e);if(t)return t.products}catch(o){if(o.response&&o.response.data.message)return n(o.response.data.message)}})),(0,o.hg)("product/edit",(async(e,t)=>{let{id:n,values:o}=e,{rejectWithValue:a}=t;try{const e={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(l)}};console.log("Action",n,o);const t=await i.Z.put("".concat(r.v,"/product/").concat(n),o,e);return null!==t&&void 0!==t&&t.data&&console.log("Product edit payload",null===t||void 0===t?void 0:t.data),null===t||void 0===t?void 0:t.data}catch(u){var s,d,c;return u.response?a(null===u||void 0===u||null===(s=u.response)||void 0===s||null===(d=s.data)||void 0===d||null===(c=d.error)||void 0===c?void 0:c.message):a(u.message)}})),(0,o.hg)("product/delete",(async(e,t)=>{let{rejectWithValue:n}=t;try{const t={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(l)}},{data:n}=await i.Z.delete("".concat(r.v,"/product/").concat(e),t);if(n)return n}catch(d){var o,a,s;return d.response?n(null===d||void 0===d||null===(o=d.response)||void 0===o||null===(a=o.data)||void 0===a||null===(s=a.error)||void 0===s?void 0:s.message):n(d.message)}})),(0,o.hg)("product/sort",(async(e,t)=>{let{sortBy:n,sort:o}=e,{rejectWithValue:a}=t;try{let e=r.v+"/product/filter";n&&(e=r.v+"/product/filter?sortBy=".concat(n,"&sort=").concat(o));const t={headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(l)}},{data:a}=await i.Z.get("".concat(e),t);if(a)return console.log("Product sort payload",a),a}catch(u){var s,d,c;return u.response?a(null===u||void 0===u||null===(s=u.response)||void 0===s||null===(d=s.data)||void 0===d||null===(c=d.error)||void 0===c?void 0:c.message):a(u.message)}}))},2540:(e,t,n)=>{n.r(t),n.d(t,{default:()=>k});var i=n(2791),o=n(1614),r=n(3767),l=n(890),a=n(4518),s=n(1889),d=n(8096),c=n(4613),u=n(9321),p=n(3786),h=n(2199),v=n(5523),g=n(9174),m=n(7391),x=n(7621),j=n(9504),y=n(3400),f=n(5078),Z=(n(5985),n(4600)),b=n(3609),C=n(7689),P=n(9434),w=(n(4469),n(184));window.Buffer=window.Buffer||n(9778).lW;const _={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"]},k=()=>{var e,t,n,k,W,z,A,S,B,N,I,q,T,R;const V=(0,C.s0)(),{state:L}=((0,P.I0)(),(0,C.TH)()),U=null===L||void 0===L||null===(e=L.product)||void 0===e?void 0:e._id;console.log("State",L),console.log("productId",U);const[D,Q]=(0,i.useState)([]),[F,H]=(0,i.useState)([]),[M,O]=(0,i.useState)(),{brandInfo:X,userInfo:E}=(0,P.v9)((e=>e.auth)),G=null===E||void 0===E?void 0:E.user_role,J=(null===X||void 0===X||X.brand_id,(0,i.useRef)()),K=(0,i.useRef)(),[Y,$]=(0,i.useState)([]);return(0,w.jsxs)(o.Z,{children:[(0,w.jsxs)(r.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",mb:5,children:[(0,w.jsx)(l.Z,{variant:"h4",sx:{mb:5},children:"Edit Product"}),(0,w.jsx)(a.Z,{variant:"contained",onClick:()=>V("/dashboard/".concat(G,"/products"),{replace:!0}),children:"Back To Product"})]}),(0,w.jsx)(f.l0,{onSubmit:()=>{console.log("Submit")},initialValues:{name:null===L||void 0===L||null===(t=L.product)||void 0===t?void 0:t.name,category:null===L||void 0===L||null===(n=L.product)||void 0===n||null===(k=n.category)||void 0===k?void 0:k._id,brand:null===L||void 0===L||null===(W=L.product)||void 0===W||null===(z=W.brand)||void 0===z?void 0:z._id,productCode:null===L||void 0===L||null===(A=L.product)||void 0===A?void 0:A.productCode,color:null===L||void 0===L||null===(S=L.product)||void 0===S?void 0:S.color,size:null===L||void 0===L||null===(B=L.product)||void 0===B?void 0:B.size,price:null===L||void 0===L||null===(N=L.product)||void 0===N?void 0:N.price,quantity:null===L||void 0===L||null===(I=L.product)||void 0===I?void 0:I.quantity,discount:null===L||void 0===L||null===(q=L.product)||void 0===q?void 0:q.discount,description:null===L||void 0===L||null===(T=L.product)||void 0===T?void 0:T.description,imgUrl:null===L||void 0===L||null===(R=L.product)||void 0===R?void 0:R.imgUrl},validate:e=>{console.log("[validate]",e.size);const t={};return e.name||(t.name="Name is required!"),e.category||(t.category="Category is required!"),e.brand||"brand"===(null===E||void 0===E?void 0:E.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:(e,t,n)=>{n.changeValue(t,"quantity",(t=>(t=>{if(t>1||1===t&&1==e)return Number(null!==t&&void 0!==t?t:1)+Number(e);return 1})(t)))},onChangeCheckBox:(e,t,n)=>{n.changeValue(t,"size",(t=>{return-1!==(n=t).indexOf(e[0])?n.filter((t=>t!==e[0])):[...n,e[0]];var n}))}},render:e=>{let{handleSubmit:t,errors:n,form:i}=e;return(0,w.jsxs)("form",{onSubmit:t,children:[(0,w.jsxs)(s.ZP,{container:!0,spacing:4,children:[(0,w.jsx)(s.ZP,{item:!0,xs:6,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"name",children:e=>(0,w.jsx)(Z.Z,{label:"Product Name",...e})})}),(0,w.jsx)(s.ZP,{item:!0,xs:6,children:(0,w.jsx)(f.gN,{fullWidth:!0,component:"select",name:"category",children:e=>{let{input:t,meta:n,options:i}=e;return(0,w.jsxs)(d.Z,{fullWidth:!0,children:[(0,w.jsx)(c.Z,{id:"brand-label",children:"Product Category"}),(0,w.jsx)(u.Z,{labelId:"brand-label",name:"category",options:F,MenuProps:{style:{maxHeight:300}},...t,children:null===F||void 0===F?void 0:F.map(((e,t)=>(0,w.jsx)(p.Z,{value:e._id,children:e.categoryName},t)))})]})}})}),"brand"!==(null===E||void 0===E?void 0:E.user_role)&&(0,w.jsx)(s.ZP,{item:!0,xs:4,mt:3,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"brand",children:e=>{var t;let{input:n,meta:i,options:o}=e;return(0,w.jsxs)(d.Z,{fullWidth:!0,children:[(0,w.jsx)(c.Z,{id:"brand-label",children:"Brand Name"}),(0,w.jsx)(u.Z,{labelId:"brand-label",name:"brand",options:D,onChange:e=>n.onChange(e),MenuProps:{style:{maxHeight:300}},...n,children:null===D||void 0===D||null===(t=D.brands)||void 0===t?void 0:t.map(((e,t)=>(0,w.jsx)(p.Z,{value:e._id,children:e.brandName},t)))})]})}})}),(0,w.jsx)(s.ZP,{item:!0,xs:4,mt:3,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"productCode",children:e=>(0,w.jsx)(Z.Z,{label:"Product Code",...e})})}),(0,w.jsx)(s.ZP,{item:!0,xs:4,mt:3,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"color",children:e=>(0,w.jsx)(Z.Z,{label:"Product Color",...e})})}),(0,w.jsx)(s.ZP,{item:!0,xs:"brand"!==(null===E||void 0===E?void 0:E.user_role)?4:6,mt:3,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"price",children:e=>(0,w.jsx)(Z.Z,{label:"Price",type:"number",style:{paddingRight:0},InputProps:{inputProps:{min:0}},...e})})}),(0,w.jsx)(s.ZP,{item:!0,xs:"brand"!==(null===E||void 0===E?void 0:E.user_role)?4:6,mt:3,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"quantity",children:e=>(0,w.jsx)(Z.Z,{label:"Available Quantity",type:"number",style:{paddingRight:0},InputProps:{inputProps:{max:100,min:0},endAdornment:(0,w.jsxs)(h.Z,{size:"small","aria-label":"small button group",orientation:"vertical",children:[(0,w.jsx)(a.Z,{color:"primary",variant:"text",onClick:()=>i.mutators.onChangeQuantity(1),children:(0,w.jsx)(b.Z,{icon:"eva:plus-fill"})}),(0,w.jsx)(a.Z,{color:"error",variant:"text",onClick:()=>i.mutators.onChangeQuantity(-1),children:(0,w.jsx)(b.Z,{icon:"eva:minus-fill"})})]})},...e})})}),(0,w.jsx)(s.ZP,{item:!0,xs:"brand"!==(null===E||void 0===E?void 0:E.user_role)?4:6,mt:3,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"discount",children:e=>(0,w.jsx)(Z.Z,{label:"Discount",type:"number",style:{paddingRight:0},InputProps:{inputProps:{min:0}},...e})})}),F.find((e=>e._id===i.getState().values.category))&&(0,w.jsx)(s.ZP,{item:!0,xs:"brand"!==(null===E||void 0===E?void 0:E.user_role)?12:6,children:(0,w.jsx)(f.gN,{fullWidth:!0,name:"size",type:"checkbox",children:e=>{var t,n;return(0,w.jsxs)(d.Z,{fullWidth:!0,children:["Available Size:",(0,w.jsx)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-evenly",padding:10},children:""!==F.find((e=>e._id===i.getState().values.category))&&(null===(t=_[null===(n=F.find((e=>e._id===i.getState().values.category)))||void 0===n?void 0:n.sizeType])||void 0===t?void 0:t.map(((t,n)=>(0,w.jsx)(v.Z,{control:(0,w.jsx)(g.Z,{name:t,onChange:e=>{i.mutators.onChangeCheckBox(t)},checked:i.getState().values.size.includes(t),...e}),label:t},n))))})]})}})}),(0,w.jsx)(s.ZP,{item:!0,xs:12,children:(0,w.jsx)(f.gN,{name:"description",render:e=>{let{input:t}=e;return(0,w.jsx)(m.Z,{fullWidth:!0,...t,label:"Product Description",multiline:!0,rows:6})}})}),(0,w.jsx)(l.Z,{variant:"h4",sx:{marginTop:5,marginLeft:5},children:"Upload Images:"}),(0,w.jsxs)(s.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((e=>(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(x.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center",display:"grid",marginRight:5},children:[(0,w.jsx)(b.Z,{icon:"mdi:close-circle-outline",sx:{width:25,height:25,position:"absolute",right:5,top:5,zIndex:9999},onClick:()=>(e=>{const t=Y.filter((t=>t!==e));$(t)})(e)}),(0,w.jsx)(j.Z,{children:(0,w.jsx)("img",{src:URL.createObjectURL(e),alt:""})})]})})))),(0,w.jsx)(x.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center"},children:(0,w.jsxs)(j.Z,{style:{justifyContent:"center"},children:[(0,w.jsx)("input",{ref:J,style:{display:"none"},type:"file",accept:"image/*",onChange:e=>$((t=>[...t,e.target.files[0]])),multiple:!0}),(0,w.jsx)(y.Z,{onClick:()=>J.current.click(),children:(0,w.jsx)(b.Z,{icon:"mdi:file-image-plus-outline",sx:{width:80,height:80}})})]})})]}),(0,w.jsxs)(l.Z,{variant:"h4",sx:{marginTop:5,marginLeft:5},children:["Upload Size Chart ",(0,w.jsx)("span",{style:{color:"#b2b2b2"},children:"(optional)"}),":"]}),(0,w.jsxs)(s.ZP,{item:!0,xs:12,style:{flexDirection:"row",display:"flex"},children:[M&&(0,w.jsxs)(x.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center",display:"grid",marginRight:5},children:[(0,w.jsx)(b.Z,{icon:"mdi:close-circle-outline",sx:{width:25,height:25,position:"absolute",right:5,top:5,zIndex:9999},onClick:()=>O("")}),(0,w.jsx)(j.Z,{children:(0,w.jsx)("img",{src:URL.createObjectURL(M)})})]}),(0,w.jsx)(x.Z,{sx:{width:150,height:150,justifyContent:"center",alignContent:"center"},children:(0,w.jsxs)(j.Z,{style:{justifyContent:"center"},children:[(0,w.jsx)("input",{ref:K,style:{display:"none"},type:"file",accept:"image/*",onChange:e=>O((()=>e.target.files[0]))}),(0,w.jsx)(y.Z,{onClick:()=>K.current.click(),children:(0,w.jsx)(b.Z,{icon:"mdi:file-image-plus-outline",sx:{width:80,height:80}})})]})})]})]}),(0,w.jsx)(s.ZP,{container:!0,direction:"row",justifyContent:"center",alignItems:"center",m:4,children:(0,w.jsx)(a.Z,{variant:"contained",size:"large",type:"submit",children:"Save"})})]})}})]})}}}]);
//# sourceMappingURL=540.061ae377.chunk.js.map

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