PageSourceSearch

https://bro-depot.com/_next/static/chunks/pages/apps/warehouse-cf70e26b9ba82012.js

js bro-depot.com collected 2026-10-04 02:39:44 UTC 34,283 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7572],{1696:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/apps/warehouse",function(){return n(21843)}])},47018:function(e,r,n){"use strict";var t=n(85893),o=n(79072);r.Z=function(e){var r=e.title,n=e.subtitle;return(0,t.jsxs)(o.ZP,{item:!0,xs:12,children:[r,n||null]})}},91560:function(e,r,n){"use strict";var t=n(85893);r.Z=function(e){var r=e.address,n=r.address1,o=r.address2,a=r.city,i=r.postcode,s=r.country,l=r.state;return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:n}),(0,t.jsxs)("div",{children:[o," ",a]}),(0,t.jsxs)("div",{children:[i," ",l," ",s]})]})}},30463:function(e,r,n){"use strict";var t=n(26042),o=n(69396),a=n(99534),i=n(85893),s=n(55343),l=n(67836),c=n(32631),u=n(96486),d=n(87536),h=n(6328);r.Z=function(e){var r,n=e.methods,f=e.name,x=e.label,p=e.defaultValue,m=e.defaultValues,v=e.rules,g=e.textFieldProps,j=e.controllerProps,b=e.formControlProps,Z=void 0===b?h.f:b,w=n.control,y=(0,d.cl)({control:w}).errors,k=(0,u.get)(y,f),C=p||(0,u.get)(m,f),P=(0,h.V)(f,x);return(0,i.jsxs)(s.Z,(0,o.Z)((0,t.Z)({},Z),{children:[(0,i.jsx)(d.Qr,(0,t.Z)({name:f,control:w,defaultValue:C,rules:v,render:function(e){var r=e.field,n=r.value,o=r.onChange,s=r.onBlur,c=g||{},u=c.onBlur,d=(0,a.Z)(c,["onBlur"]),h=u?function(e){s(),u(e)}:s;return(0,i.jsx)(l.Z,(0,t.Z)({value:n||"",onBlur:h,onChange:function(e){return o(e)},error:Boolean(k),label:P,size:"small"},d))}},j)),k&&(0,i.jsx)(c.Z,{sx:{color:"error.main"},children:null===(r=k.message)||void 0===r?void 0:r.toString()})]}))}},76366:function(e,r,n){"use strict";n.d(r,{e:function(){return d}});var t=n(26042),o=n(69396),a=n(85893),i=n(43085),s=n(63015),l=n(11767),c=n(67294),u=n(87536);function d(e){var r=e.defaultValues,n=e.methods,d=e.children,h=e.onSubmit,f=e.formProps,x=(0,s.T)({selector:l.TV}).isUploadingState;return(0,a.jsx)(u.RV,(0,o.Z)((0,t.Z)({},n),{children:(0,a.jsx)("form",(0,o.Z)((0,t.Z)({onSubmit:function(e){e.preventDefault(),x?(0,i.JT)("Please wait for any pending uploads to complete before submitting the form.",{icon:"\u26a0\ufe0f"}):h(e),e.stopPropagation()}},f),{children:c.Children.map(d,(function(e){return null===e?null:e.props.name?(0,c.createElement)(e.type,(0,t.Z)({},(0,o.Z)((0,t.Z)({},e.props),{defaultValues:r,key:e.props.name}))):e}))}))}))}},1427:function(e,r,n){"use strict";var t=n(85893),o=n(87536),a=n(30463);r.Z=function(e){var r=e.name,n=e.defaultValue,i=e.label,s=e.rules,l=e.defaultValues,c=e.controllerProps,u=e.formControlProps,d=e.textFieldProps,h=(0,o.Gc)();return(0,t.jsx)(a.Z,{name:r,label:i,rules:s,defaultValue:n,defaultValues:l,controllerProps:c,formControlProps:u,textFieldProps:d,methods:h})}},45408:function(e,r,n){"use strict";n.d(r,{u:function(){return x}});var t=n(51438),o=n(88029),a=n(82337),i=n(85893),s=n(30120),l=n(29630),c=n(49837),u=n(54225),d=n(67294),h=n(5434),f=n(49535),x=function(e){var r=e.variant,n=void 0===r?"empty":r,t=e.icon,o=e.title,a=e.description,c=e.action,u=e.compact,d=(0,f.HF)(),x=function(){switch(n){case"error":return d.color.negative;case"filtered":return d.color.warning;default:return d.color.inkSubtle}}(),p="error"===n?(0,i.jsx)(h.UPv,{size:u?22:36,color:x}):(0,i.jsx)(h.Pye,{size:u?22:36,color:x});return(0,i.jsxs)(s.Z,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",py:u?2:4,px:2,gap:u?.5:1,sx:{color:d.color.inkMuted,width:"100%"},children:[(0,i.jsx)(s.Z,{display:"flex",alignItems:"center",justifyContent:"center",children:null!==t&&void 0!==t?t:p}),(0,i.jsx)(l.Z,{variant:u?"body2":"subtitle2",fontWeight:700,sx:{color:d.color.ink},children:o}),a?(0,i.jsx)(l.Z,{variant:"caption",sx:{color:d.color.inkMuted,maxWidth:360},children:a}):null,c?(0,i.jsx)(s.Z,{mt:u?.5:1,children:c}):null]})},p=function(e){var r=e.message,n=e.fallbackRef,t=e.onReset,o=(0,f.HF)();return(0,i.jsx)(c.Z,{elevation:0,role:"alert","aria-live":"assertive",ref:n,tabIndex:-1,sx:{borderRadius:o.space.cardRadius,border:"1px solid ".concat(o.color.border),bgcolor:o.color.surface,my:3,outline:"none"},children:(0,i.jsx)(x,{variant:"error",title:"Dashboard failed to load",description:r,action:(0,i.jsx)(u.Z,{variant:"outlined",size:"small",startIcon:(0,i.jsx)(h.la_,{}),onClick:t,children:"Retry"})})})},m=function(e){(0,o.Z)(n,e);var r=(0,a.Z)(n);function n(e){var o;return(0,t.Z)(this,n),(o=r.call(this,e)).fallbackRef=(0,d.createRef)(),o.reset=function(){o.setState({error:null})},o.state={error:null},o}var l=n.prototype;return l.componentDidUpdate=function(e,r){var n;(r.error&&!this.state.error&&queueMicrotask((function(){if("undefined"!==typeof document){var e=document.getElementById("product-dashboard-root"),r=null===e||void 0===e?void 0:e.querySelector('button, a, input, [tabindex]:not
1([tabindex="-1"])');null===r||void 0===r||r.focus()}})),!r.error&&this.state.error)&&(null===(n=this.fallbackRef.current)||void 0===n||n.focus())},l.componentDidCatch=function(e,r){console.error("[ProductDashboardPage] error:",{error:e,info:r})},l.render=function(){return this.state.error?(0,i.jsx)(p,{message:this.state.error.message||"Something went wrong.",fallbackRef:this.fallbackRef,onReset:this.reset}):(0,i.jsx)(s.Z,{id:"product-dashboard-root",sx:{width:"100%"},children:this.props.children})},n.getDerivedStateFromError=function(e){return{error:e}},n}(d.Component);r.Z=m},49535:function(e,r,n){"use strict";n.d(r,{HF:function(){return x},cX:function(){return m}});var t=n(26042),o=n(62097),a=n(5434),i=Object.freeze({kpiPrimaryValue:Object.freeze({fontSize:"2rem",fontWeight:700,lineHeight:1.15,letterSpacing:"-0.5px",fontVariantNumeric:"tabular-nums"}),kpiSecondaryValue:Object.freeze({fontSize:"1.375rem",fontWeight:700,lineHeight:1.25,letterSpacing:"-0.3px",fontVariantNumeric:"tabular-nums"}),kpiLabel:Object.freeze({fontSize:"0.7rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.8px"}),sectionTitle:Object.freeze({fontSize:"0.75rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"1px"}),caption:Object.freeze({fontSize:"0.7rem",fontWeight:500})}),s=Object.freeze({cardPadding:2.5,cardRadius:3,gridGutter:2.5,sectionGap:3}),l=Object.freeze({surface:"#FFFFFF",surfaceMuted:"#F9FAFB",border:"#E5E7EB",ink:"#111827",inkMuted:"#4B5563",inkSubtle:"#6B7280",accent:"#2563EB",accentSoft:"rgba(37, 99, 235, 0.08)",accentBorder:"rgba(37, 99, 235, 0.28)",positive:"#047857",positiveSoft:"rgba(4, 120, 87, 0.08)",positiveBorder:"rgba(4, 120, 87, 0.28)",warning:"#B45309",warningSoft:"rgba(180, 83, 9, 0.10)",warningBorder:"rgba(180, 83, 9, 0.28)",negative:"#B91C1C",negativeSoft:"rgba(185, 28, 28, 0.08)",negativeBorder:"rgba(185, 28, 28, 0.28)",neutral:"#6B7280",neutralSoft:"rgba(107, 114, 128, 0.08)"}),c=Object.freeze({surface:"#30334E",surfaceMuted:"#282A42",border:"rgba(234, 234, 255, 0.12)",ink:"rgba(234, 234, 255, 0.87)",inkMuted:"rgba(234, 234, 255, 0.68)",inkSubtle:"rgba(234, 234, 255, 0.45)",accent:"#60A5FA",accentSoft:"rgba(96, 165, 250, 0.15)",accentBorder:"rgba(96, 165, 250, 0.35)",positive:"#34D399",positiveSoft:"rgba(52, 211, 153, 0.15)",positiveBorder:"rgba(52, 211, 153, 0.35)",warning:"#FBBF24",warningSoft:"rgba(251, 191, 36, 0.15)",warningBorder:"rgba(251, 191, 36, 0.35)",negative:"#FC8181",negativeSoft:"rgba(252, 129, 129, 0.15)",negativeBorder:"rgba(252, 129, 129, 0.35)",neutral:"#94A3B8",neutralSoft:"rgba(148, 163, 184, 0.15)"}),u={gridStroke:"#EEF2F6",tickFill:"#9CA3AF",fee:{commission:"#DC2626",shipping:"#0E7490",transaction:"#7C3AED",discount:"#D97706",refund:"#BE123C",other:"#6B7280"},channel:{shopee:"#EE4D2D",shopify:"#5A9F37",woocommerce:"#7B3DAD",b2b:"#2563EB",direct:"#475569",other:"#6B7280"},gradient:{revenueArea:{from:"rgba(37, 99, 235, 0.32)",to:"rgba(37, 99, 235, 0.02)"},profitArea:{from:"rgba(4, 120, 87, 0.32)",to:"rgba(4, 120, 87, 0.02)"}},gauge:{track:"#E5E7EB",bandGood:"#047857",bandWarn:"#B45309",bandBad:"#B91C1C"}},d={gridStroke:"rgba(234, 234, 255, 0.08)",tickFill:"rgba(234, 234, 255, 0.55)",fee:{commission:"#FC8181",shipping:"#22D3EE",transaction:"#A78BFA",discount:"#FBBF24",refund:"#FCA5A5",other:"#94A3B8"},channel:{shopee:"#FF8A6E",shopify:"#86C66B",woocommerce:"#B679E5",b2b:"#60A5FA",direct:"#94A3B8",other:"#94A3B8"},gradient:{revenueArea:{from:"rgba(96, 165, 250, 0.40)",to:"rgba(96, 165, 250, 0.04)"},profitArea:{from:"rgba(52, 211, 153, 0.40)",to:"rgba(52, 211, 153, 0.04)"}},gauge:{track:"rgba(234, 234, 255, 0.12)",bandGood:"#34D399",bandWarn:"#FBBF24",bandBad:"#F87171"}},h={revenueTrendMinHeight:300,inventoryBarMinHeight:220},f=function(e){return{color:"dark"===e?c:l,type:i,space:s,chart:(0,t.Z)({},h,"dark"===e?d:u)}},x=function(){var e="dark"===(0,o.Z)().palette.mode?"dark":"light";return f(e)},p=f("light"),m=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p,t=Number.isFinite(e)?e:0,o=Math.abs(t)<.5,i=t>0,s=i&&!r||!i&&r;return o?{tone:"neutral",color:n.color.neutral,softBg:n.color.neutralSoft,TrendIcon:a.OtB,sign:""}:s?{tone:"positive",color:n.color.positive,softBg:n.color.positiveSoft,TrendIcon:i?a.gSd:a.ZuN,sign:i?"+":"-"}:{tone:"negative",color:n.color.negative,softBg:n.color.negativeSoft,TrendIcon:i?a.gSd:a.ZuN,sign:i?"+":"-"}}},79506:function(e,r,n){"use strict";n.d(r,{Zu:function(){return j}});var t=n(26042),o=n(69396),a=n(85893),i=n(96277),s=n(57891),l=n(32631),c=n(35966),u=n(70754),d=n(67836),h=n(96486),f=n(67294),x=n(87536),p=n(86806);
1function m(e){var r=e.label,n=e.onChange,l=e.value,h=e.error,x=e.multiple,m=e.enableAutofillWarehouse,v=e.autoCompleteProps,g=l,j=(0,f.useState)(!1),b=j[0],Z=j[1],w=(0,i.c34)(),y=(0,f.useMemo)((function(){var e;return null===(e=w.data)||void 0===e?void 0:e.myCompany.defaultWarehouse}),[w]),k=(0,i.DKt)({variables:{filter:void 0,sortField:"name",sortOrder:i.Asd.Asc}}),C=k.loading,P=k.data,S=null===P||void 0===P?void 0:P.allWarehouses.total,N=(0,f.useMemo)((function(){return(null===P||void 0===P?void 0:P.allWarehouses.warehouses)||[]}),[P]);(0,f.useEffect)((function(){if(N.length){if(g&&"object"===typeof g&&"value"in g){if(N.some((function(e){return e.value===g.value})))return;console.warn("Warehouse with ID ".concat(g.value," not found in available options"))}if(m)if(1===S)n(N[0]);else if(y&&!(0,s.Q)(y)){var e={value:y.id,label:y.name};n(e)}}}),[m,y,S,N,g,n]);var B=(0,f.useMemo)((function(){return(0,p.y)("simple-warehouse-autocomplete")}),[]);return(0,a.jsx)(c.Z,(0,o.Z)((0,t.Z)({},v),{id:B,open:b,disableCloseOnSelect:x,multiple:x,value:g,onChange:function(e,r){n(r)},onOpen:function(){Z(!0)},onClose:function(){Z(!1)},size:"small",isOptionEqualToValue:function(e,r){return!(!r||"object"!==typeof r||!("value"in r))&&e.value===r.value},getOptionLabel:function(e){return e?"string"===typeof e?e:e.label||"":""},options:N,loading:C,renderInput:function(e){return(0,a.jsx)(d.Z,(0,o.Z)((0,t.Z)({},e),{label:r,error:h,placeholder:"",InputProps:(0,o.Z)((0,t.Z)({},e.InputProps),{endAdornment:(0,a.jsxs)(a.Fragment,{children:[C?(0,a.jsx)(u.Z,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})}))}}))}function v(e,r){return(0,h.isEqual)(e.value,r.value)}var g=(0,f.memo)(m,v),j=function(e){var r,n=e.methods,o=e.name,i=e.label,s=e.defaultValue,c=e.defaultValues,u=e.controllerProps,d=e.enableAutofillWarehouse,f=void 0===d||d,p=e.multiple,m=void 0!==p&&p,v=e.autoCompleteProps,j=n.control,b=(0,x.cl)({control:j}).errors,Z=(0,h.get)(b,o),w=s||(0,h.get)(c,o);void 0===i&&(0,h.startCase)(o);return(0,a.jsxs)("div",{children:[(0,a.jsx)(x.Qr,(0,t.Z)({name:o,control:j,defaultValue:w,render:function(e){var r=e.field,n=r.value,t=r.onChange;return(0,a.jsx)(g,{value:n,label:i,onChange:t,error:Boolean(Z),multiple:m,enableAutofillWarehouse:f,autoCompleteProps:v})}},u)),Z&&(0,a.jsx)(l.Z,{sx:{color:"error.main"},children:null===(r=(0,h.get)(Z,"message"))||void 0===r?void 0:r.toString()})]})}},48942:function(e,r,n){"use strict";n.d(r,{L:function(){return i}});var t=n(85893),o=n(20986),a=n(30120),i=function(e){var r=e.value,n=e.trueLabel,i=e.falseLabel,s=e.size,l=!!r,c=l?"#2e7d32":"#9e9e9e",u=l?n:i,d="small"===(void 0===s?"small":s)?"0.95rem":"1.2rem";return(0,t.jsxs)(a.Z,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,px:u?1:.5,py:.25,borderRadius:"999px",border:"1.5px solid ".concat(c,"66"),backgroundColor:"".concat(c,"1f"),color:c,fontSize:"0.72rem",fontWeight:600,lineHeight:1,userSelect:"none"},children:[l?(0,t.jsx)(o.Ye,{style:{fontSize:d}}):(0,t.jsx)(o.lY,{style:{fontSize:d}}),u&&(0,t.jsx)("span",{children:u})]})}},62554:function(e,r,n){"use strict";var t=n(26042),o=n(69396),a=n(85893),i=n(17575),s=n(30120),l=n(80562);r.Z=function(e){var r=e.title,n=void 0===r?"":r,c=e.onClick,u=e.iconButtonProps,d=e.children;return(0,a.jsx)(i.Z,{title:n,children:(0,a.jsx)(s.Z,{children:(0,a.jsx)(l.Z,(0,o.Z)((0,t.Z)({sx:{color:"text.secondary",textDecoration:"none",mr:.5},onClick:c,size:"small"},u),{children:d}))})})}},94138:function(e,r,n){"use strict";n.d(r,{I:function(){return c}});var t=n(26042),o=n(99534),a=n(85893),i=n(62097),s=n(23378),l=n(41796),c=function(e){var r=e.label,n=e.color,c=e.sx,u=(0,o.Z)(e,["label","color","sx"]),d=(0,i.Z)(),h=d.palette[n];return(0,a.jsx)(s.Z,(0,t.Z)({size:"small",label:r,sx:(0,t.Z)({backgroundColor:(0,l.Fq)(h.main,.12),color:"dark"===d.palette.mode?h.light:h.dark,fontWeight:500},c)},u))}},19668:function(e,r,n){"use strict";n.d(r,{Dr:function(){return t},ab:function(){return o},cm:function(){return a}});var t={"& .MuiDataGrid-row":{margin:"0 !important",border:"none !important",borderRadius:"0 !important",boxShadow:"none !important"},"& .MuiDataGrid-cell":{borderBottom:function(e){return"1px solid ".concat(e.palette.divider," 
1!important")}},"& .MuiDataGrid-pinnedColumns":{boxShadow:"none !important"},"& .MuiDataGrid-pinnedColumns .MuiDataGrid-row":{margin:"0 !important",border:"none !important",borderRadius:"0 !important",boxShadow:"none !important"}},o=function(){return{top:0,bottom:0}},a="pr-20"},94805:function(e,r,n){"use strict";var t=n(26042),o=n(69396),a=n(85893),i=n(9942),s=n(54225),l=n(29620),c=n(80562),u=n(95398),d=n(30120),h=n(29630),f=n(67294),x=n(20986),p=(0,f.forwardRef)((function(e,r){return(0,a.jsx)(i.Z,(0,t.Z)({ref:r},e))}));r.Z=function(e){var r,n=e.children,i=e.isOpen,m=e.setIsOpen,v=e.dialogProps,g=e.button,j=e.buttonContent,b=void 0===j?"Open":j,Z=e.title,w=e.description,y=e.maxWidth,k=void 0===y?"md":y,C=(0,f.useCallback)((function(e,r){m(!1)}),[]),P=(0,f.useCallback)((function(e){m(!0)}),[]);return(0,a.jsxs)(a.Fragment,{children:[g||(0,a.jsx)(s.Z,{variant:"contained",sx:{mb:2.5,whiteSpace:"nowrap"},onClick:P,children:b}),(0,a.jsxs)(l.Z,(0,o.Z)((0,t.Z)({fullWidth:!0,maxWidth:k,scroll:"paper",onClose:C,TransitionComponent:p,open:i},v),{PaperProps:(0,o.Z)((0,t.Z)({},null===v||void 0===v?void 0:v.PaperProps),{sx:(0,t.Z)({position:"relative"},null===v||void 0===v||null===(r=v.PaperProps)||void 0===r?void 0:r.sx)}),children:[(0,a.jsx)(c.Z,{size:"small",onClick:function(){return m(!1)},sx:{position:"absolute",right:"1rem",top:"1rem",zIndex:1},children:(0,a.jsx)(x.Tw,{})}),(0,a.jsxs)(u.Z,{sx:{pb:6,px:[4,11],pt:[5,8.5]},children:[(Z||w)&&(0,a.jsxs)(d.Z,{sx:{mb:8,textAlign:"center"},children:[Z&&(0,a.jsx)(h.Z,{variant:"h6",sx:{mb:2,lineHeight:"2rem"},children:Z}),w&&(0,a.jsx)(h.Z,{variant:"body2",children:w})]}),n]})]}))]})}},19165:function(e,r,n){"use strict";n.d(r,{$:function(){return s},Au:function(){return l},cW:function(){return i}});var t=n(63750),o=n(89583),a=n(14578),i=t.NbQ,s=o.qau,l=a.$YN},33342:function(e,r,n){"use strict";n.d(r,{g:function(){return o}});var t=n(41796),o=function(e){return function(e){return{p:0,pb:1.5,"& .MuiCard-root":{backgroundColor:e.palette.background.paper,border:"1px solid ".concat((0,t.Fq)(e.palette.text.primary,.2)),boxShadow:e.shadows[1],transition:"box-shadow .2s ease, border-color .2s ease","&:hover":{boxShadow:"dark"===e.palette.mode?"0px 12px 28px -6px rgba(20, 21, 33, 0.55), 0px 4px 10px -4px rgba(20, 21, 33, 0.34)":"0px 12px 28px -6px rgba(76, 78, 100, 0.4), 0px 4px 10px -4px rgba(76, 78, 100, 0.22)",borderColor:(0,t.Fq)(e.palette.text.primary,.28)}}}}}},74230:function(e,r,n){"use strict";n.d(r,{D:function(){return i}});var t=n(85893),o=n(42176),a=n(6132);function i(e){var r=e.rightContent;return(0,t.jsx)(o.D,{sx:{backgroundColor:function(e){return e.palette.background.paper}},children:(0,t.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,t.jsx)("div",{children:(0,t.jsx)(a.S,{})}),r]})})}},9887:function(e,r,n){"use strict";n.d(r,{CG:function(){return a},TL:function(){return o}});n(67294);var t=n(9473),o=function(){return(0,t.I0)()},a=t.v9},63015:function(e,r,n){"use strict";n.d(r,{T:function(){return i}});var t=n(9887),o=n(67294),a=n(11767),i=function(e){var r=e.selector,n=(0,t.TL)(),i=(0,t.CG)(r),s=(0,o.useCallback)((function(e){n((0,a.kP)(e))}),[n]);return(0,o.useEffect)((function(){return function(){s(!1)}}),[s]),{isUploadingState:i,setIsUploadingState:s}}},57891:function(e,r,n){"use strict";n.d(r,{Q:function(){return t}});var t=function(e){var r=!0;return!e||(Object.keys(e).forEach((function(n){var t=e[n];void 0!==t&&("number"===typeof t?Number.isNaN(t)||(r=!1):null!==t&&(r=!1))})),r)}},21843:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return Oe}});var t=n(85893),o=n(45408),a=n(19668),i=n(74230),s=n(94062),l=n(47018),c=n(96277),u=n(54225),d=n(79072),h=n(29630),f=n(70754),x=n(49837),p=n(39410),m=n(25836),v=n(41664),g=n.n(v),j=n(67294),b=n(85518),Z=n(20986),w=n(67062),y=n(23378),k=n(17575),C=n(80562),P=n(18377),S=n(86010),N=n(91560),B=n(47568),F=n(828),z=n(70655),A=n(62554),D=n(4451),W=n(43085),I=n(43963);var E,O,T=function(e){var r=e.warehouse,n=(0,D.a)().user,o=(0,j.useState)(null),a=o[0],i=o[1],s=Boolean(a),l=s?"delete-inventory-popover":void 0,d=r.id,h=(0,F.Z)((0,c.qt9)({variables:{warehouseId:d},refetchQueries:[c.zX4]}),2),f=h[0],x=h[1].loading,p=function(){var e=(0,B.Z)((function(){var e;return(0,z.__generator)(this,(function(r){switch(r.label){case 0:return[4,f()];case 1:return(null===(e=r.sent().data)||void 0===e?void 0:e.deleteWarehouse)&&(0,W.x9)("Warehouse deleted"),[2]}}))}));return function(){return e.apply(this,arguments)}}();return(0,t.jsxs)("div",{hidden:!(null===n||void 0===n?void 0:n.isSuperAdmin),children:[(0,t.jsx)(A.Z,{title:"Delete",iconButtonProps:{color:"primary",onClick:function(e){i(e.currentTarget)}},children:(0,t.jsx)(Z.pJ,{className:"text-red-500"})}),(0,t.jsx)(I.ZP,{id:l,open:s,anchorEl:a,onClose:function(){i(null)},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,t.jsxs)("div",{className:"mx-5 my-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-red-500",children:(0,t.jsx)(Z.zM,{})}),(0,t.jsx)("span",{children:"Are you sure? "})]}),(0,t.jsx)("div",{className:"mt-1 flex justify-end",children:(0,t.jsx)(u.Z,{color:"error",onClick:p,disabled:x,children:"Delete"})})]})})]})},R=n(14924),V=n(26042),M=n(78203),_=n(74098),q=n(30120),H=n(60684),G=n(13264),U=n(69396),L=n(99534),X=n(1427),Q=n(76366),Y=n(79506),J=n(47533),$=n(44373),K=n(41470),ee=n(22841),re=n(15497),ne=n(96486),te=n(87536),oe=n(74231),ae=oe.Ry().shape({value:oe.Z_().required("Please select a warehouse"),label:oe.Z_().nullable()}),ie=oe.Ry().shape({name:oe.Z_().nullable(),remarks:oe.Z_().nullable(),warehouseId:ae.required("Please select a warehouse")}),se={remarks:"",name:"",countMode:c.AcX.Cycle,warehouseId:{value:"",label:""}}
1,le=function(e){var r,n=e.onSubmit,o=e.defaultValues,a=(0,ne.merge)({},se,o),i=(0,te.cI)({defaultValues:a,resolver:(0,J.X)(ie)}),s=i.handleSubmit,l=i.formState.isSubmitting,f=function(){var e=(0,B.Z)((function(e){var r,t,o;return(0,z.__generator)(this,(function(a){switch(a.label){case 0:return r=e.warehouseId,t=(0,L.Z)(e,["warehouseId"]),o=(0,U.Z)((0,V.Z)({},t),{warehouseId:null===r||void 0===r?void 0:r.value}),[4,n(o)];case 1:return a.sent(),[2]}}))}));return function(r){return e.apply(this,arguments)}}();return(0,t.jsx)(Q.e,{methods:i,onSubmit:s(f),defaultValues:a,children:(0,t.jsxs)(d.ZP,{container:!0,spacing:6,sx:{pt:5},children:[(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsxs)(h.Z,{variant:"body1",children:["Warehouse",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})}),(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsx)(Y.Zu,{methods:i,name:"warehouseId",defaultValues:a,label:"Select warehouse"})}),(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsx)($.Z,{})}),(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsx)(X.Z,{name:"name",textFieldProps:{fullWidth:!0},defaultValues:a})}),(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsx)(X.Z,{name:"remarks",textFieldProps:{fullWidth:!0,placeholder:"Write your remarks here.",multiline:!0,minRows:2},defaultValues:a})}),(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsx)($.Z,{})}),(0,t.jsxs)(d.ZP,{item:!0,xs:12,children:[(0,t.jsx)(h.Z,{variant:"body1",children:"Count mode"}),(0,t.jsx)(h.Z,{variant:"caption",color:"text.secondary",component:"p",sx:{mb:1},children:"Choose how the warehouse operates during the count. You will decide what to compare (only scanned items, or everything) when you finish counting."}),(0,t.jsx)(te.Qr,{name:"countMode",control:i.control,render:function(e){var n=e.field;return(0,t.jsxs)(K.Z,(0,U.Z)((0,V.Z)({},n),{value:null!==(r=n.value)&&void 0!==r?r:c.AcX.Cycle,children:[(0,t.jsx)(ee.Z,{value:c.AcX.Cycle,control:(0,t.jsx)(re.Z,{}),label:"Cycle count \u2014 warehouse stays open (orders and shipping continue during the count)"}),(0,t.jsx)(ee.Z,{value:c.AcX.Full,control:(0,t.jsx)(re.Z,{}),label:"Full count \u2014 close warehouse (shipping is paused until the count is done)"})]}))}})]}),(0,t.jsx)(d.ZP,{item:!0,xs:12,sx:{pt:function(e){return"".concat(e.spacing(7)," !important")}},children:(0,t.jsx)(u.Z,{type:"submit",variant:"contained",sx:{mr:4},disabled:l,children:"Submit"})})]})})},ce=(0,G.Z)(q.Z)((function(e){var r=e.theme;return{display:"flex",alignItems:"center",padding:r.spacing(3,4),justifyContent:"between",width:"100%",backgroundColor:r.palette.background.default}})),ue=function(e){var r=e.isOngoing,n=e.warehouse,o=(0,j.useState)(!1),a=o[0],i=o[1],s=function(){i(!1)},l=(0,F.Z)((0,c.Dzm)({refetchQueries:[c.zX4]}),1)[0],u=function(){var e=(0,B.Z)((function(e){var r,n,t,o;return(0,z.__generator)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,l({variables:{createStockTakeDto:e}})];case 1:return(null===(n=a.sent().data)||void 0===n||null===(r=n.createStockTake)||void 0===r?void 0:r.id)&&
1((0,W.x9)("Stock take created successfully."),s()),[3,3];case 2:return t=a.sent(),(0,W._N)(null!==(o=null===t||void 0===t?void 0:t.message)&&void 0!==o?o:"Failed to create stock take. Please try again."),[3,3];case 3:return[2]}}))}));return function(r){return e.apply(this,arguments)}}(),d=(0,j.useMemo)((function(){return{warehouseId:n}}),[n]);return(0,t.jsxs)("div",{children:[(0,t.jsx)(k.Z,{title:"Create Stock Take",placement:"top",children:(0,t.jsx)(C.Z,{size:"small",color:"primary",sx:{textDecoration:"none",mr:.5},onClick:function(){i(!0)},disabled:r,children:(0,t.jsx)(_.yJ,{})})}),(0,t.jsxs)(H.ZP,{open:a,anchor:"right",variant:"temporary",onClose:s,sx:{"& .MuiDrawer-paper":{width:{xs:300,sm:400}}},children:[(0,t.jsx)(ce,{children:(0,t.jsx)("div",{className:"grow font-bold",children:"Create Stock Take"})}),(0,t.jsx)(q.Z,{sx:{px:5,py:4},hidden:!a,children:(0,t.jsx)(le,{onSubmit:u,defaultValues:d})})]})]})},de=n(94805),he=n(19165),fe=n(88673),xe=n(1254),pe=function(e){var r=e.warehouseId,n=(0,j.useState)(!1),o=n[0],a=n[1],i={status:c.x6P.PendingForResolve,warehouseId:r||void 0};return(0,t.jsx)(de.Z,{isOpen:o,setIsOpen:a,dialogProps:{open:o,onClose:function(){a(!1)},maxWidth:"xl"}
1,button:(0,t.jsx)(A.Z,{title:"Past stock takes",iconButtonProps:{color:"primary",onClick:function(){return a(!0)}},children:(0,t.jsx)(he.cW,{})}),title:"View Past Stock Take Records",description:"",children:(0,t.jsx)(xe.j,{defaultFilters:i,children:(0,t.jsx)(fe.Z,{})})})},me=n(5837),ve=n(45135),ge=n(91359),je=n(11163),be=(E={},(0,R.Z)(E,c.x6P.Canceled,"error"),(0,R.Z)(E,c.x6P.Completed,"success"),(0,R.Z)(E,c.x6P.Ongoing,"primary"),(0,R.Z)(E,c.x6P.PendingForResolve,"warning"),E),Ze=(0,G.Z)(x.Z)((function(e){var r=e.theme;return{"&:hover":{border:"1px solid ".concat(r.palette.primary.main),cursor:"pointer"}}})),we=function(e){var r,n=e.stockTakeDetails,o=e.row,a=(0,je.useRouter)(),i=(0,te.U2)(n,"name"),s=(0,te.U2)(n,"status"),l=(0,te.U2)(n,"number"),u=(0,te.U2)(n,"createdAt"),d=null!==(r=(0,te.U2)(n,"createdBy.userName"))&&void 0!==r?r:"",f=u?(0,w.p6)(u):"-";if(!n)return(0,t.jsx)(ve.Z,{severity:"info",className:"flex grow",children:"No ongoing stock take."});var x;return(0,t.jsx)(Ze,{className:"flex grow",children:(0,t.jsx)(k.Z,{title:(0,t.jsxs)("div",{className:"flex flex-row items-center",children:[(0,t.jsx)(Z.ON,{className:"mr-1"}),"View Items"]}),children:(0,t.jsx)(ge.Z,{onClick:function(){s===c.x6P.Ongoing?a.push({pathname:"/apps/stock-take/scan",query:{id:null===n||void 0===n?void 0:n.id,warehouseId:o.id}}):s===c.x6P.PendingForResolve&&a.push({pathname:"/apps/stock-take/result",query:{id:null===n||void 0===n?void 0:n.id,warehouseId:o.id}})},children:(0,t.jsxs)(q.Z,{className:"mt-1 flex flex-col gap-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(me.UP,{size:"small",label:(0,t.jsx)("div",{className:"w-30 truncate text-center",children:(0,ne.startCase)(s)}),color:null!==(x=be[s])&&void 0!==x?x:"secondary",variant:"filled"}),(0,t.jsx)(k.Z,{title:"# ".concat(l),placement:"top",children:(0,t.jsx)(h.Z,{variant:"body1",className:"mb-1 line-clamp-2",children:i})})]}),(0,t.jsxs)(h.Z,{fontSize:12,children:[(0,t.jsx)(_.tB,{className:"mr-1 inline-block"}),d," | ",f]})]})})})})},ye=function(e){var r,n,o=e.stockTakeDetails,a=e.row,i=!!o,s=null!==(r=(0,te.U2)(a,"name"))&&void 0!==r?r:"",l={value:a.id,label:s};return(0,t.jsxs)(d.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(d.ZP,{item:!0,xs:9,children:(0,t.jsx)("div",{className:"flex h-full w-full flex-wrap items-center justify-center",children:(0,t.jsx)(we,(0,V.Z)({},e))})}),(0,t.jsx)(d.ZP,{item:!0,xs:1,children:(0,t.jsx)($.Z,{orientation:"vertical"})}),(0,t.jsx)(d.ZP,{item:!0,xs:2,children:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-start gap-y-1",children:[(0,t.jsx)(ue,{isOngoing:i,warehouse:l}),(0,t.jsx)(M.Z,{isOngoing:i,stockTakeId:null!==(n=null===o||void 0===o?void 0:o.id)&&void 0!==n?n:""}),(0,t.jsx)(pe,{warehouseId:a.id})]})})]})},ke=[{headerName:"Name",field:"name",flex:1,minWidth:140,renderCell:function(e){var r=e.value,n=e.row,o=(n.company,n.isCompanyDefault);return(0,t.jsxs)("div",{className:"flex w-full flex-col items-center justify-between",children:[(0,t.jsx)("strong",{children:r}),(0,t.jsx)("div",{className:(0,S.Z)({hidden:!o}),children:(0,t.jsx)(y.Z,{size:"small",label:"Default",color:"info",sx:{mr:1,height:20,fontSize:"0.75rem",fontWeight:500}})})]})}},{headerName:"Contact",field:"contactName",minWidth:180,renderCell:function(e){var r=e.row,n=r.contactName,o=r.contactNo;return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:n}),(0,t.jsx)("div",{children:o})]})}},{headerName:"Address",field:"address",flex:2,minWidth:320,renderCell:function(e){var r=e.row.address;return(0,t.jsx)("div",{children:(0,t.jsx)(N.Z,{address:r})})}},{headerName:"StockTake",field:"ongoingStockTake",flex:2,minWidth:300,renderCell:function(e){var r=e.value,n=e.row;return(0,t.jsx)(ye,{stockTakeDetails:r,row:n})}},{headerName:"Created",field:"createdAt",minWidth:160,renderCell:function(e){var r=e.value,n=(e.row,(0,w.p6)(r));return(0,t.jsx)("div",{className:"flex flex-wrap justify-center gap-y-2",children:(0,t.jsx)("div",{children:n})})}},{headerName:"Actions",field:"actions",minWidth:130,renderCell:function(e){var r=e.row;return(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:"mx-2 flex flex-wrap gap-2",children:[(0,t.jsx)(k.Z,{title:"Edit",children:(0,t.jsx)(P.Z,{children:(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/update-warehouse",query:{id:r.id}},passHref:!0,children:(0,t.jsx)(C.Z,{component:"a",size:"small",sx:{color:"text.secondary",textDecoration:"none",mr:.5},children:(0,t.jsx)(Z.dY,{})})})})}),(0,t.jsx)(k.Z,{title:"Manage warehouse users",children:(0,t.jsx)(P.Z,{children:(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/warehouse-users",query:{id:r.id,name:r.name}},passHref:!0,children:(0,t.jsx)(C.Z,{component:"a",size:"small",sx:{color:"text.secondary",textDecoration:"none",mr:.5},children:(0,t.jsx)(Z.lj,{})})})})}),(0,t.jsx)(T,{warehouse:r})]})})}}],Ce=n(33342),Pe=n(85214),Se=n(81284),Ne=n(48942),Be=n(94138),Fe=function(e){var r=e.label,n=e.value;return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"shrink-0 opacity-60",children:[r,":"]}),(0,t.jsx)("span",{className:"ml-2 truncate text-right font-medium",children:n||"-"})]})},ze=(O={},(0,R.Z)(O,c.x6P.Canceled,"error"),(0,R.Z)(O,c.x6P.Completed,"success"),(0,R.Z)(O,c.x6P.Ongoing,"info"),(0,R.Z)(O,c.x6P.PendingForResolve,"warning"),O),Ae=function(e){var r,n=e.row,o=n.address,a=[null===o||void 0===o?void 0:o.address1,null===o||void 0===o?void 0:o.address2,null===o||void 0===o?void 0:o.city,null===o||void 0===o?void 0:o.postcode,null===o||void 0===o?void 0:o.state,null===o||void 0===o?void 0:o.country].filter(
1Boolean).join(", ")||null,i=[n.contactName,n.contactNo].filter(Boolean).map(String).join(" \xb7 ")||null,s=n.ongoingStockTake,l=(0,w.p6)(n.createdAt);return(0,t.jsx)(x.Z,{className:"w-full",children:(0,t.jsxs)(ge.Z,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/update-warehouse",query:{id:n.id}},children:(0,t.jsx)("strong",{className:"app-clickable break-words",children:n.name})}),n.isCompanyDefault?(0,t.jsx)(Ne.L,{value:!0,trueLabel:"Default"}):null]})}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,t.jsx)(k.Z,{title:"Edit",children:(0,t.jsx)(P.Z,{children:(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/update-warehouse",query:{id:n.id}},passHref:!0,children:(0,t.jsx)(C.Z,{component:"a",size:"small",sx:{color:"text.secondary",textDecoration:"none"},children:(0,t.jsx)(Z.dY,{})})})})}),(0,t.jsx)(k.Z,{title:"Manage warehouse users",children:(0,t.jsx)(P.Z,{children:(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/warehouse-users",query:{id:n.id,name:n.name}},passHref:!0,children:(0,t.jsx)(C.Z,{component:"a",size:"small",sx:{color:"text.secondary",textDecoration:"none"},children:(0,t.jsx)(Z.lj,{})})})})}),(0,t.jsx)(T,{warehouse:n})]})]}),(0,t.jsx)($.Z,{className:"!my-2"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-1 text-sm",children:[(0,t.jsx)(Fe,{label:"Contact",value:i}),(0,t.jsx)(Fe,{label:"Address",value:a}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"shrink-0 opacity-60",children:"Stock Take:"}),(0,t.jsx)("span",{className:"ml-2 text-right",children:s?(0,t.jsx)(Be.I,{label:(0,ne.startCase)(String(s.status)),color:null!==(r=ze[s.status])&&void 0!==r?r:"secondary"}):(0,t.jsx)("span",{className:"font-medium",children:"-"})})]}),(0,t.jsx)(Fe,{label:"Created",value:l})]})]})})},De=function(e){var r=e.rows;return(0,t.jsx)(Pe.Z,{children:null===r||void 0===r?void 0:r.map((function(e,r){return(0,t.jsx)(Se.ZP,{sx:(0,Ce.g)(r),children:(0,t.jsx)(Ae,{row:e})},e.id)}))})},We=function(){return(0,t.jsx)(i.D,{rightContent:(0,t.jsx)("div",{children:(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/create-warehouse"},children:(0,t.jsx)(u.Z,{size:"medium",sx:{m:2},variant:"contained",children:"Create warehouse"})})})})},Ie=function(e){var r=(0,j.useState)(0),n=r[0],i=r[1],v=(0,j.useState)(10),Z=v[0],w=v[1],y=(0,c.Wnn)({variables:{page:n,perPage:Z,sortField:"createdAt",sortOrder:c.Asd.Desc}}),k=y.data,C=y.loading,P=(y.error,y.refetch,(null===k||void 0===k?void 0:k.allWarehouses.warehouses)||[]),S=(null===k||void 0===k?void 0:k.allWarehouses.total)||0;return(0,t.jsxs)(d.ZP,{container:!0,spacing:6,children:[(0,t.jsx)(l.Z,{title:(0,t.jsx)(h.Z,{variant:"h5",children:"Warehouse"}),subtitle:(0,t.jsx)(h.Z,{variant:"body2",children:"All warehouses under your company"})}),(0,t.jsx)(d.ZP,{item:!0,xs:12,children:(0,t.jsx)(d.ZP,{container:!0,spacing:6,children:(0,t.jsx)(d.ZP,{item:!0,xs:12,children:b.tq?(0,t.jsxs)("div",{className:"pb-16",children:[(0,t.jsx)("div",{className:"mb-2 flex justify-end",children:(0,t.jsx)(g(),{href:{pathname:"/apps/warehouse/create-warehouse"},children:(0,t.jsx)(u.Z,{size:"medium",variant:"contained",children:"Create warehouse"})})}),C&&!P.length?(0,t.jsx)("div",{className:"flex justify-center py-10",children:(0,t.jsx)(f.Z,{})}):P.length?(0,t.jsx)(De,{rows:P}):(0,t.jsx)(o.u,{compact:!0,variant:"filtered",title:"No warehouses found"}),(0,t.jsx)(s.Z,{page:n,setPage:i,pageSize:Z,setPageSize:w,totalRows:S,rowsPerPageOption:[10,25,50,100]})]}):(0,t.jsx)(x.Z,{children:(0,t.jsx)("div",{className:"flex h-full min-h-screen w-full",children:(0,t.jsx)("div",{className:"grow",children:(0,t.jsx)(m.s,{getRowHeight:function(){return"auto"},pagination:!0,page:n,pageSize:Z,rowCount:S,columns:ke,rows:P,loading:C,getRowSpacing:a.ab,sx:a.Dr,paginationMode:"server",onPageSizeChange:w,components:{Toolbar:We,Pagination:s.Z},componentsProps:{pagination:{page:n,setPage:i,pageSize:Z,setPageSize:w,totalRows:S}},checkboxSelection:!0,disableSelectionOnClick:!0,keepNonExistentRowsSelected:!0,rowsPerPageOptions:[10,25,50,100],initialState:{pinnedColumns:{left:[p.n.field],right:["actions"]}}})})})})})})})]})},Ee=function(){return(0,t.jsx)(Ie,{})},Oe=Ee;Ee.acl={action:"all",subject:"warehouse"}},86806:function(e,r,n){"use strict";n.d(r,{y:function(){return t}});var t=function(e){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"autocomplete",r=Date.now().toString(36),n=Math.random().toString(36).substring(2,15);return"".concat(e,"-").concat(r,"-").concat(n)}(e.toLowerCase().replace(/\s+/g,"-"))}}},function(e){e.O(0,[2876,7536,1524,4231,5428,1718,5836,5040,8673,9774,2888,179],(function(){return r=1696,e(e.s=r);var r}));var r=e.O();_N_E=r}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.