1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8238],{53332:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/apps/inventory/dashboard",function(){return t(75165)}])},47018:function(e,n,t){"use strict";var r=t(85893),i=t(79072);n.Z=function(e){var n=e.title,t=e.subtitle;return(0,r.jsxs)(i.ZP,{item:!0,xs:12,children:[n,t||null]})}},89479:function(e,n,t){"use strict";t.d(n,{Tg:function(){return i},UW:function(){return r},jW:function(){return a}});var r=function(e){return e.stopPropagation()},i=function(e){return e.stopPropagation()},a=function(e){var n;e.ctrlKey&&"KeyA"===e.code&&(null===(n=e.target)||void 0===n||n.select()),e.stopPropagation()}},25941:function(e,n,t){"use strict";t.d(n,{C:function(){return s}});var r=t(26042),i=t(69396),a=t(85893),o=t(96486),s=function(e){var n=e.amount,t=e.currency,s=e.leftPlaceholder,l=e.rightPlaceholder,u=e.rootDivProps,c=e.rootClassName,d=e.currencyClassName,h=e.amountClassName;return(0,o.isNil)(n)?null:(0,a.jsxs)("div",(0,i.Z)((0,r.Z)({className:"flex items-center ".concat(c)},u),{children:[s,(0,a.jsx)("span",{className:"mr-2 ".concat(d),children:null!==t&&void 0!==t?t:"??"}),(0,a.jsx)("span",{className:"font-bold tabular-nums ".concat(h),children:Number(n).toFixed(2)}),l]}))}},94805:function(e,n,t){"use strict";var r=t(26042),i=t(69396),a=t(85893),o=t(9942),s=t(54225),l=t(29620),u=t(80562),c=t(95398),d=t(30120),h=t(29630),v=t(67294),f=t(20986),p=(0,v.forwardRef)((function(e,n){return(0,a.jsx)(o.Z,(0,r.Z)({ref:n},e))}));n.Z=function(e){var n,t=e.children,o=e.isOpen,m=e.setIsOpen,x=e.dialogProps,g=e.button,b=e.buttonContent,j=void 0===b?"Open":b,w=e.title,P=e.description,y=e.maxWidth,C=void 0===y?"md":y,Z=(0,v.useCallback)((function(e,n){m(!1)}),[]),N=(0,v.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:N,children:j}),(0,a.jsxs)(l.Z,(0,i.Z)((0,r.Z)({fullWidth:!0,maxWidth:C,scroll:"paper",onClose:Z,TransitionComponent:p,open:o},x),{PaperProps:(0,i.Z)((0,r.Z)({},null===x||void 0===x?void 0:x.PaperProps),{sx:(0,r.Z)({position:"relative"},null===x||void 0===x||null===(n=x.PaperProps)||void 0===n?void 0:n.sx)}),children:[(0,a.jsx)(u.Z,{size:"small",onClick:function(){return m(!1)},sx:{position:"absolute",right:"1rem",top:"1rem",zIndex:1},children:(0,a.jsx)(f.Tw,{})}),(0,a.jsxs)(c.Z,{sx:{pb:6,px:[4,11],pt:[5,8.5]},children:[(w||P)&&(0,a.jsxs)(d.Z,{sx:{mb:8,textAlign:"center"},children:[w&&(0,a.jsx)(h.Z,{variant:"h6",sx:{mb:2,lineHeight:"2rem"},children:w}),P&&(0,a.jsx)(h.Z,{variant:"body2",children:P})]}),t]})]}))]})}},3032:function(e,n,t){"use strict";t.d(n,{k:function(){return i}});var r=t(67294),i=function(){var e=(0,r.useState)(!1),n=e[0],t=e[1],i=(0,r.useCallback)((function(){t(!0)}),[]),a=(0,r.useCallback)((function(){t(!1)}),[]);return{isOpen:n,setIsOpen:t,openModal:i,closeModal:a}}},87811:function(e,n,t){"use strict";t.d(n,{AD:function(){return l},G6:function(){return o},HD:function(){return c},Ms:function(){return a},Ye:function(){return u},qg:function(){return s}});var r=t(80471),i=t(86893),a=i.rH8,o=i.bTu,s=i.YFh,l=i.Tfp,u=r.kEI,c=r.BM_},94062:function(e,n,t){"use strict";t.d(n,{Z:function(){return x}});var r=t(85893),i=t(87811),a=t(30120),o=t(89125),s=t(54225),l=t(81719),u=t(20986),c=t(67836),d=t(96486),h=t(67294),v=(0,l.ZP)(s.Z,{name:"StyledButton",slot:"Wrapper"})((function(){return{margin:0,padding:0,paddingLeft:5,paddingRight:5,minWidth:"10px"}})),f=function(e){var n=e.onPageChange,t=(0,h.useState)(""),i=t[0],a=t[1],o=(0,h.useId)();return(0,r.jsx)("div",{children:(0,r.jsx)(c.Z,{id:"go-to-page-".concat(o),value:i,label:"Go To",size:"small",onChange:function(e){return function(e){var n=e.target.value.replace(/[^0-9]/g,"");a(n)}(e)},sx:{minWidth:"5.5rem"},InputProps:{autoComplete:"off",endAdornment:(0,r.jsx)(v,{onClick:function(e){return function(e){var t=(0,d.parseInt)(i);n(e,t>0?t-1:t),a("")}(e)},children:(0,r.jsx)(u.Ye,{size:28})})}})})},p=(0,l.ZP)(s.Z,{name:"StyledButton",slot:"Wrapper"})((function(){return{marginRight:"0.5rem",minWidth:"40px"}})),m=function(e){var n=e.count,t=e.page,o=e.onPageChange,l=e.rowsPerPage,u=e.showFirstButton,c=e.showLastButton,d=0===n?0:Math.ceil(n/l)-1;return(0,r.jsxs)(a.Z,{className:"mx-8 flex items-center",children:[u&&(0,r.jsx)(p,{size:"small",variant:"text",disabled:0===t,onClick:function(e){return o(e,0)},children:(0,r.jsx)(i.HD,{size:20})}),(0,r.jsx)(p,{size:"small",variant:"text",disabled:0===t,onClick:function(e){return o(e,t-1)},children:(0,r.jsx)(i.qg,{size:20})}),function(){var e=t>=3?t-3:0,r=Math.ceil(n/l),i=r<6?r:6,a=e+i,o=a>r?Math.abs(a-r):0;return Array.from({length:i},(function(n,t){return e-o+t}))}().map((function(e){return(0,r.jsx)(s.Z,{size:"small",sx:{mr:1,minWidth:"32px"},variant:t===e?"contained":"outlined",onClick:function(n){return o(n,e)},children:e+1},e)}
1)),(0,r.jsx)(p,{size:"small",variant:"text",disabled:n<=l*(t+1),onClick:function(e){return o(e,t+1)},children:(0,r.jsx)(i.AD,{size:20})}),c&&(0,r.jsx)(p,{size:"small",variant:"text",disabled:t===d,onClick:function(e){o(e,d)},children:(0,r.jsx)(i.Ye,{size:20})}),(0,r.jsx)(f,{onPageChange:o})]})},x=function(e){var n=e.page,t=e.setPage,i=e.pageSize,a=e.setPageSize,s=e.rowsPerPageOption,l=void 0===s?[10,25,50]:s,u=e.showFirstButton,c=void 0===u||u,d=e.showLastButton,h=void 0===d||d,v=e.totalRows;return(0,r.jsx)(o.Z,{rowsPerPageOptions:l,component:"div",count:v,rowsPerPage:i,page:Math.min(v/i,n),onPageChange:function(e,n){t(n)},onRowsPerPageChange:function(e){a(+e.target.value),t(0)},labelRowsPerPage:"",ActionsComponent:m,showFirstButton:c,showLastButton:h})}},75165:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return k}});var r=t(85893),i=t(96277),a=t(4451),o=t(67294),s=(0,o.createContext)(void 0),l=function(e){var n=e.children,t=e.skipQuery,l=void 0!==t&&t,u=(0,a.a)().loading,c=(0,o.useState)((function(){return 0})),d=c[0],h=c[1],v=(0,o.useState)((function(){return 100})),f=v[0],p=v[1],m=(0,o.useState)((function(){return{groupType:i.xHO.Brand}})),x=m[0],g=m[1],b=(0,o.useState)([]),j=b[0],w=b[1],P=(0,i.spQ)({notifyOnNetworkStatusChange:!0,fetchPolicy:"cache-and-network",context:{disableBatch:!0},variables:{filter:x},skip:u||l}),y=P.refetch,C=P.loading,Z=(P.client,(0,o.useMemo)((function(){var e,n=null===(e=P.data)||void 0===e?void 0:e.allGrouppedInventories;return{inventoryDashboardList:(null===n||void 0===n?void 0:n.grouppedInventories)||[],inventoryDashboardCount:(null===n||void 0===n?void 0:n.total)||0}}),[P.data])),N=Z.inventoryDashboardList,k=Z.inventoryDashboardCount;(0,o.useEffect)((function(){w([])}),[]);var S=(0,o.useMemo)((function(){return{queryResult:P,inventoryDashboardList:N,inventoryDashboardCount:k,filters:x,setFilters:g,page:d,setPage:h,pageSize:f,setPageSize:p,selectedIds:j,setSelectedIds:w,loading:C,refetch:y}}),[P,N,k,x,d,h,f,p,j,C,y]);return(0,r.jsx)(s.Provider,{value:S,children:n})},u=(s.Consumer,t(26042)),c=t(25941),d=t(94062),h=t(47018),v=t(79072),f=t(29630),p=t(49837),m=t(25836),x=t(89479),g=t(94805),b=t(3032),j=t(17575),w=function(e){var n=e.value;return(0,r.jsx)(j.Z,{title:null!==n&&void 0!==n?n:"",placement:"top-start",arrow:!0,children:(0,r.jsx)("span",{className:"block truncate",children:null!==n&&void 0!==n?n:"-"})})},P=[{field:"stockInPoNumber",headerName:"PO Number",flex:1,minWidth:140,renderCell:function(e){var n=e.value;return(0,r.jsx)(w,{value:n})}},{field:"name",headerName:"Name",flex:1.5,minWidth:200,renderCell:function(e){var n=e.value;return(0,r.jsx)(w,{value:n})}},{field:"barcode",headerName:"Barcode",flex:.8,minWidth:120,renderCell:function(e){var n=e.value;return(0,r.jsx)(w,{value:n})}},{field:"sku",headerName:"SKU",flex:1,minWidth:140,renderCell:function(e){var n=e.value;return(0,r.jsx)(w,{value:n})}},{field:"stockInQuantity",headerName:"Stock In Qty",flex:.5,minWidth:100,type:"number",headerAlign:"right",align:"right"},{field:"soldQuantity",headerName:"Sold Qty",flex:.5,minWidth:80,type:"number",headerAlign:"right",align:"right"},{field:"availableQuantity",headerName:"Available Qty",flex:.5,minWidth:110,type:"number",headerAlign:"right",align:"right",cellClassName:function(e){var n=e.row,t=n.stockInQuantity;return n.availableQuantity/t*100<=50?"text-red-700 font-semibold":"text-green-700"}},{field:"cost",headerName:"Unit Cost",flex:.6,minWidth:110,type:"number",headerAlign:"right",align:"right",valueGetter:function(e){var n;return null===(n=e.row.cost)||void 0===n?void 0:n.amount},renderCell:function(e){var n=e.row;return n.cost?(0,r.jsx)(c.C,{amount:n.cost.amount,currency:n.cost.currency}):"-"}}];var y=function(e){var n=e.row,t=(0,b.k)(),i=t.isOpen,a=t.setIsOpen,o=t.openModal,s=t.closeModal;return(0,r.jsx)("div",{onClick:x.UW,children:(0,r.jsx)(g.Z,{isOpen:i,setIsOpen:a,dialogProps:{maxWidth:"xl",onClose:function(){return s()}},button:(0,r.jsx)(j.Z,{title:"View Item Breakdown by FIFO",placement:"top",children:(0,r.jsx)("button",{onClick:o,type:"button",className:"rounded border border-catalog-primary/50 bg-catalog-primary/5 px-2 text-catalog-primary hover:scale-105\n hover:text-catalog-primary active:scale-100",children:"View Breakdown"})}),title:"Item Breakdown by FIFO \u2014 ".concat(n.entity.name),children:(0,r.jsx)(C,{row:n})})})},C=function(e){var n,t,a,s,l=e.row.entity.id,u=(0,o.useState)(0),c=u[0],h=u[1],v=(0,o.useState)(50),p=v[0],x=v[1],g=(0,i.T0I)({variables:{filter:{typeId:l,type:i.xHO.Brand,hasAvailableQuantity:!0},page:c,perPage:p}}),b=g.loading,j=g.data,w=null!==(a=null===j||void 0===j||null===(n=j.allStockInOrderRecords)||void 0===n?void 0:n.orderStockInRecords)&&void 0!==a?a:[],y=null!==(s=null===j||void 0===j||null===(t=j.allStockInOrderRecords)||void 0===t?void 0:t.total)&&void 0!==s?s:0;return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-2 flex items-center justify-between",children:(0,r.jsxs)(f.Z,{variant:"body2",color:"text.secondary",children:[y," record",1!==y?"s":""," with available stock"]})}),(0,r.jsx)("div",{className:"h-[65vh]",children:(0,r.jsx)(m.s,{
1columns:P,rows:w,rowCount:y,loading:b,rowHeight:32,paginationMode:"server",page:c,pageSize:p,hideFooter:!0,disableColumnMenu:!0,disableSelectionOnClick:!0})}),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsx)(d.Z,{page:c,setPage:h,pageSize:p,setPageSize:x,totalRows:y,rowsPerPageOption:[25,50,100]})})]})},Z=[{field:"name",headerName:"Name",width:250,valueGetter:function(e){return e.row.entity.name}},{field:"quantity",headerName:"Quantity",width:100},{field:"cost",headerName:"Cost",width:300,valueGetter:function(e){return e.row.totalCosts.amount},renderCell:function(e){var n=e.row.totalCosts;return(0,r.jsx)("div",{children:(0,r.jsx)(c.C,{amount:n.amount,currency:n.currency})})}},{field:"actions",headerName:"Actions",width:300,sortable:!1,renderCell:function(e){var n=e.row;n.totalCosts;return(0,r.jsx)("div",{children:(0,r.jsx)(y,{row:n})})}}];var N=function(e){var n=function(){var e=(0,o.useContext)(s);if(!e)throw new Error("No Context.Provider found when calling useContext.");return e}(),t=(n.filters,n.inventoryDashboardCount),i=n.inventoryDashboardList,a=n.loading,l=n.page,c=n.setPage,x=n.pageSize,g=n.setPageSize,b=(0,o.useMemo)((function(){return{initialState:{pinnedColumns:{right:["actions"]},sorting:{sortModel:[{field:"name",sort:"asc"}]}},rowHeight:30,rowsPerPageOptions:[10,25,50,100],keepNonExistentRowsSelected:!0,componentsProps:{pagination:{page:l,setPage:c,pageSize:x,setPageSize:g,totalRows:t}},components:{Pagination:d.Z},onPageSizeChange:g,paginationMode:"server",getRowId:function(e){return e.entity.id}}}),[l,x,t,c,g]);return(0,r.jsx)("div",{children:(0,r.jsxs)(v.ZP,{container:!0,spacing:6,children:[(0,r.jsx)(v.ZP,{item:!0,xs:12,children:(0,r.jsx)("div",{className:"flex justify-between",children:(0,r.jsx)(h.Z,{title:(0,r.jsx)(f.Z,{variant:"h5",children:"Inventory Dashboard"}),subtitle:(0,r.jsx)(f.Z,{variant:"body2",children:"Find all your inventory counts grouped by brand"})})})}),(0,r.jsx)(v.ZP,{item:!0,xs:12,children:(0,r.jsx)(v.ZP,{container:!0,spacing:6,children:(0,r.jsx)(v.ZP,{item:!0,xs:12,children:(0,r.jsx)(p.Z,{children:(0,r.jsx)("div",{className:"h-[73vh]",children:(0,r.jsx)(m.s,(0,u.Z)({page:l,pageSize:x,rowCount:t,columns:Z,rows:i,loading:a,hideFooter:!0},b))})})})})})]})})},k=function(){return(0,r.jsx)(l,{children:(0,r.jsx)(N,{})})}}},function(e){e.O(0,[5428,1718,5836,9774,2888,179],(function(){return n=53332,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
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.