PageSourceSearch

https://bro-depot.com/_next/static/chunks/pages/catalog/[companyName]/order-482a6d716964a2a9.js

js bro-depot.com collected 2026-10-04 02:40:17 UTC 33,633 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3322],{67524:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/catalog/[companyName]/order",function(){return r(95780)}])},51077:function(e,n,r){"use strict";var t=r(85893),i=r(29630),a=r(62400),l=r(56027);n.Z=function(e){var n=e.Icon,r=e.message,s=(0,a.N)().onViewHomepage;return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-7 py-12 text-slate-400",children:[(0,t.jsx)(n,{size:40,color:"#94a3b8"}),(0,t.jsx)(i.Z,{variant:"body1",sx:{color:"#94a3b8"},children:r}),(0,t.jsx)(l.Pp,{variant:"contained",onClick:function(){return s()},sx:{borderRadius:function(e){return e.shape.borderRadius}},children:"Continue Shopping"})]})}},7464:function(e,n,r){"use strict";r.d(n,{BT:function(){return u},f2:function(){return v}});var t=r(26042),i=r(69396),a=r(85893),l=r(96277),s=r(96486),o=r(11163),c=r(67294),d=(0,c.createContext)(void 0),u=function(e){var n=e.children,r=e.defaultFilters,u=e.companyId,v=e.storeParamsInUrl,p=void 0!==v&&v,f=(0,o.useRouter)(),m=f.query,h=(0,c.useState)((function(){return p&&m.page?Number(m.page):0})),x=h[0],g=h[1],j=(0,c.useState)((function(){return p&&m.pageSize?Number(m.pageSize):10})),b=j[0],y=j[1],Z=(0,c.useState)((function(){return p&&m.filters?JSON.parse(m.filters):r||{}})),P=Z[0],w=Z[1],I=(0,c.useState)([]),N=I[0],S=I[1],C=(0,l.Vhd)({variables:{filter:(0,i.Z)((0,t.Z)({},P),{companyId:u}),page:x,perPage:b,sortField:"createdAt",sortOrder:l.Asd.Desc}}),O=C.refetch,k=C.loading,R=C.data,_=(0,c.useMemo)((function(){return{rows:(null===R||void 0===R?void 0:R.allInvoices.invoices)||[],totalRows:(null===R||void 0===R?void 0:R.allInvoices.total)||0}}),[R]),A=_.rows,T=_.totalRows;(0,c.useEffect)((function(){S([])}),[P]);var E=(0,c.useMemo)((function(){return(0,s.debounce)((function(e){var n=e.filters,r=e.page,a=e.pageSize;f.replace({query:(0,i.Z)((0,t.Z)({},f.query),{filters:JSON.stringify(n),page:r,pageSize:a})},void 0,{shallow:!0})}),100)}),[]);(0,c.useEffect)((function(){return p&&E({filters:P,page:x,pageSize:b}),function(){return E.cancel()}}),[p,x,P,b,E]);var M=(0,c.useMemo)((function(){return{rows:A,totalRows:T,filters:P,setFilters:w,page:x,setPage:g,pageSize:b,setPageSize:y,selectedIds:N,setSelectedIds:S,loading:k,refetch:O,companyId:u}}),[A,P,T,x,b,N,k,O,u]);return(0,a.jsx)(d.Provider,{value:M,children:n})},v=(d.Consumer,function(){var e=(0,c.useContext)(d);if(!e)throw new Error("No Context.Provider found when calling useContext.");return e})},18908:function(e,n,r){"use strict";var t=r(85893),i=r(83674),a=r(81719),l=r(29630),s=r(69417),o=r(5605),c=(0,a.ZP)(l.Z)((function(e){return{bcolor:e.theme.palette["catalog-dark"].main,fontWeight:800}}));n.Z=function(e){var n=e.tableRowSx,r=e.hideLastColumnArea,a=void 0!==r&&r,l=(0,i.q)().isSmallScreen;return(0,t.jsxs)(s.Z,{sx:n,children:[(0,t.jsx)(o.Z,{width:"10%",hidden:l,children:(0,t.jsx)(c,{variant:"body2"})}),(0,t.jsx)(o.Z,{width:"20%",children:(0,t.jsx)(c,{variant:"body2",children:"Product"})}),(0,t.jsx)(o.Z,{width:"20%",align:"center",children:(0,t.jsx)(c,{variant:"body2",children:"Status"})}),(0,t.jsx)(o.Z,{width:"15%",align:"center",children:(0,t.jsx)(c,{variant:"body2",children:"Qty"})}),(0,t.jsx)(o.Z,{width:"15%",align:"center",children:(0,t.jsx)(c,{variant:"body2",children:"Total"})}),(0,t.jsx)(o.Z,{width:"10%",align:"center",children:(0,t.jsx)(c,{variant:"body2",children:"Memo"})}),(0,t.jsx)(o.Z,{width:"5%",align:"center",hidden:a})]})}},67490:function(e,n,r){"use strict";var t=r(85893),i=r(12508),a=r(49837),l=r(75278);n.Z=function(e){var n=e.header,r=e.children;return(0,t.jsx)(a.Z,{className:"w-full p-4 lg:-ml-4",sx:{minHeight:{xs:"10vh",lg:"50vh"},backgroundColor:function(e){return e.palette.background.paper}},children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 pl-2",children:[(0,t.jsxs)(l.b,{className:"flex items-center pb-2",variant:"h5",children:[(0,t.jsx)(i.W1,{className:"inline-block pr-1",color:"inherit",size:28}),n||"Search"]}),r]})})}},27809:function(e,n,r){"use strict";var t=r(85893),i=r(3021);n.Z=function(e){var n=e.page,r=e.onChange,a=e.total,l=e.pageSize,s=Math.ceil(a/l);return(0,t.jsx)("div",{className:"mt-2 flex justify-end",children:(0,t.jsx)(i.Z,{count:s,page:n+1,onChange:function(e,n){r(n-1)}})})}},72175:function(e,n,r){"use strict";r.d(n,{T:function(){return P},Z:function(){return w}});var t,i=r(85893),a=r(36599),l=r(81719),s=r(14924),o=r(20986),c=r(12207),d=r(96277),u=r(36270),v=r(9601),p=r(17494),f=r(51221),m=r(72162),h=r(30120),x=r(29630),g=r(54225),j=r(69295),b=r(51085),y=(t={},(0,s.Z)(t,d.Gvn.SalesOrder,"View Order"),(0,s.Z)(t,d.Gvn.ShippingOrder,"View Order"),(0,s.Z)(t,d.Gvn.ShippingBackcharge,"View Shipping Order"),(0,s.Z)(t,d.Gvn.SupplierOffer,"View Supplier Offer"),(0,s.Z)(t,d.Gvn.Rfq,"View RFQ Request"),(0,s.Z)(t,d.Gvn.SystemTicket,"Ticket"),(0,s.Z)(t,d.Gvn.OrderCart,"View Purchase Cart"),t),Z=function(e){var n,r,t,a=e.row,l=a.title,s=a.topic,d=a.message,Z=a.payload,P=(a.refData,a.updatedAt),w=null!==(n=(0,c.q3)(P))&&void 0!==n?n:"-",I=(0,b.Z)(new Date(P)),N=1===(0,j.Z)(new Date,new Date(P)),S=s.topic,C=Boolean(c.vs[S]);return(0,i.jsxs)(u.Z,{children:[(0,i.jsxs)(v.Z,{children:[(0,i.jsx)(p.Z,{color:I?"error":N?"warning":"primary"}),(0,i.jsx)(f.Z,{})]}),(0,i.jsxs)(m.Z,{sx:{mt:0,mb:function(e){return"".concat(e.spacing(2)," !important")}},children:[(0,i.jsxs)(h.Z,{sx:{mb:2.5,display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsxs)(x.Z,{sx:{mr:2,fontWeight:600},children:[l," ",(0,c.Mt)(l)]}),(0,i.jsx)(x.Z,{variant:"caption",sx:{color:"text.disabled"},children:w})]}),(0,i.jsx)(x.Z,{variant:"body2",sx:{mb:2},children:d}),(0,i.jsxs)(h.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,c.fr)(S),C?(0,i.jsxs)(g.Z,{size:"small",onClick:function(){return(0,c.HM)(Z,S)},children:[null!==(r=y[S])&&void 0!==r?r:"View",(0,i.jsx)(o.sG,{id:"click-me",className:"ml-2 !text-primary dark:!text-primary"})]}):(0,i.jsx)(x.Z,{variant:"subtitle2",sx:{ml:2,fontWeight:600},children:null!==(t=y[S])&&void 0!==t?t:"Notification"})]})]})]})},P=(0,l.ZP)(a.Z)({paddingLeft:0,paddingRight:0,"& .MuiTimelineItem-root":{width:"100%","&:before":{display:"none"}}}),w=function(e){var n=e.rows;return(0,i.jsx)(P,{sx:{my:0,py:0},children:null===n||void 0===n?void 0:n.map((function(e,n){return(0,i.jsx)(Z,{row:e},n)}))})}},48129:function(e,n,r){"use strict";r.d(n,{as:function(){return h},r:function(){return x}});var t=r(26042),i=r(69396),a=r(85893),l=r(6798),s=r(96277),o=r(4451),c=r(23837),d=r(96486),u=r(67294),v=(0,u.createContext)(void 0),p=new Set(Object.values(s.iFo)),f=new Set(Object.values(s.sQ8)),m=function(e){var n=e;if(null==n.status||p.has(n.status)||(n=(0,i.Z)((0,t.Z)({},n),{status:void 0})),null!=n.substatus){var r=n.substatus.filter((function(e){return f.has(e)}));r.length!==n.substatus.length&&(n=(0,i.Z)((0,t.Z)({},n),{substatus:r.length>0?r:void 0}))}return n},h=function(e){var n=e.children,r=e.defaultFilters,i=e.storeParamsInUrl,p=void 0!==i&&i,f=(0,o.a)(),h=f.preferredCurrency,x=f.user,g=(0,u.useMemo)((function(){var e=(0,c.b)(x);return(0,l.qF)(null===e||void 0===e?void 0:e.company.id)}),[x]),j=(0,u.useState)((function(){if(p){var e,n=null!==(e=(0,l.E$)("page",g))&&void 0!==e?e:0;return Number(n)}return 0})),b=j[0],y=j[1],Z=(0,u.useState)((function(){if(p){var e,n=null!==(e=(0,l.E$)("pageSize",g))&&void 0!==e?e:10;return Number(n)}return 10})),P=Z[0],w=Z[1],I=(0,u.useState)((function(){if(p){var e=(0,l.E$)("filters",g);if(e)return n=(0,t.Z)({},e),m(n)}var n;return(0,t.Z)({},r)})),N=I[0],S=I[1],C=(0,u.useState)([]),O=C[0],k=C[1],R=(0,u.useMemo)((function(){return m(N)}),[N]),_=(0,s.K1)({variables:{filter:R,page:b,perPage:P,sortField:"createdAt",sortOrder:s.Asd.Desc,convertCurrency:h||void 0},skip:!(null===x||void 0===x?void 0:x.id),notifyOnNetworkStatusChange:!1}),A=_.refetch,T=_.loading,E=_.data,M=(0,u.useMemo)((function(){return{rows:(null===E||void 0===E?void 0:E.allPurchaseOrders.orders)||[],totalRows:(null===E||void 0===E?void 0:E.allPurchaseOrders.total)||0}}),[E]),D=M.rows,z=M.totalRows,F=(0,s.GuH)({skip:!(null===x||void 0===x?void 0:x.id)}),L=F.data,W=F.refetch,Q=(0,u.useMemo)((function(){return null===L||void 0===L?void 0:L.getPoCount}),[null===L||void 0===L?void 0:L.getPoCount]),G=(0,s.pQQ)().data,U=(0,u.useMemo)((function(){return(0,d.debounce)((function(){A(),W()}),500,{leading:!1,trailing:!0})}),[A,W]);(0,u.useEffect)((function(){var e;(null===G||void 0===G||null===(e=G.subscribeToOrderListInvalidation)||void 0===e?void 0:e.listType)===s.OXv.PurchaseOrder&&U()}),[G,U]),(0,u.useEffect)((function(){return function(){U.cancel()}}),[U]);var V=(0,u.useMemo)((function(){return(0,d.debounce)((function(e){var n=e.filters,r={page:e.page,pageSize:e.pageSize,filters:n};g&&(0,l.lj)(r,g)}),100)}),[g]);(0,u.useEffect)((function(){return p&&V({filters:N,page:b,pageSize:P}),function(){return V.cancel()}}),[p,b,N,P,V]);var B=(0,u.useMemo)((function(){return{queryResult:_,rows:D,totalRows:z,defaultFilters:r,filters:N,setFilters:S,handledFilters:R,page:b,setPage:y,pageSize:P,setPageSize:w,selectedIds:O,setSelectedIds:k,loading:T,refetch:A,poCounts:Q}}
1),[_,D,r,N,R,z,b,P,O,T,A,Q]);return(0,a.jsx)(v.Provider,{value:B,children:n})},x=(v.Consumer,function(){var e=(0,u.useContext)(v);if(!e)throw new Error("No Context.Provider found when calling useContext.");return e})},95780:function(e,n,r){"use strict";r.r(n),r.d(n,{__N_SSG:function(){return nn},default:function(){return rn}});var t=r(85893),i=r(14924),a=r(26042),l=r(69396),s=r(29815),o=r(53273),c=r(48129),d=r(74098),u=r(47018),v=r(96277),p=r(29630),f=r(79072),m=r(30120),h=r(62135),x=r(54225),g=r(51077),j=r(43879),b=r(67490),y=r(27809),Z=r(2699),P=r(5837),w=r(55031),I=r(67062),N=r(81719),S=r(96486),C=r(75278),O=r(23585),k=r(47568),R=r(70655),_=r(43085),A=r(67294),T=r(5548),E=(0,N.ZP)(m.Z)((function(e){var n=e.theme,r=e.disabled;return{cursor:"pointer",padding:n.spacing(.5),textDecorationLine:"underline",color:r?"#94a3b8":n.palette["catalog-dark"].main,pointerEvents:r?"none":"auto","&:hover":{color:n.palette["catalog-primary"].main}}})),M=function(e){var n=e.orderId,r=(0,T.Z)().onOpenInvoice,i=(0,A.useState)(!1),a=i[0],l=i[1],s=(0,T.Z)(),o=s.onInvoiceQuery,c=s.loading,d=function(){var e=(0,k.Z)((function(){var e;return(0,R.__generator)(this,(function(t){switch(t.label){case 0:return[4,o({orderId:n,isActive:!0})];case 1:return 0===(null===(e=t.sent().data)||void 0===e?void 0:e.allInvoices.total)?((0,_.x9)("No invoices found!"),l(!0),[2]):((null===e||void 0===e?void 0:e.allInvoices)&&(null===e||void 0===e?void 0:e.allInvoices.invoices).forEach((function(e){r(e.number)})),[2])}}))}));return function(){return e.apply(this,arguments)}}();return(0,t.jsxs)(E,{onClick:d,disabled:a,children:[c&&(0,t.jsx)("div",{className:"loading-text",children:(0,t.jsx)(p.Z,{variant:"body2",color:"inherit",children:"Loading"})}),(0,t.jsx)(p.Z,{variant:"body2",color:"inherit",sx:[c&&{display:"none"}],children:"Print All Invoices"})]})},D=r(20986),z=r(31812),F=r(17575),L=r(96556),W=r(13882);var Q,G=r(89479),U=r(94805),V=r(29143),B=r(7464),q=r(4095),H=function(){var e=(0,B.f2)(),n=e.loading,r=e.rows,i=1===r.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.Z,{loading:n}),r.map((function(e,n){var r=!(!i||0!==n)||void 0;return(0,t.jsx)(q.ZP,{invoice:e,isExpanded:r},e.id)}))]})},Y=(0,V.Ue)((function(e){var n=e.isOpen,r=e.onResolve,i=(e.onReject,e.orderNumber),a=e.companyId,l=function(){return r(!1)};return(0,t.jsx)(U.Z,{isOpen:n,setIsOpen:function(e){(0,S.isFunction)(e)?console.log("UpdateDropshipPricePromptDialogBase setIsOpen isFunction: PLEASE DOUBLE CHECK"):!0===e||l()},dialogProps:{open:n,onClose:function(){return l()},maxWidth:"lg"},button:(0,t.jsx)("div",{}),title:"Invoices",children:(0,t.jsx)(B.BT,{defaultFilters:{orderNumber:i,companyId:a,toPay:!0},companyId:a,children:(0,t.jsx)("div",{onClick:G.UW,className:"relative",children:(0,t.jsx)(H,{})})})})})),K=r(72175),X=r(3032),J=r(80562),$=r(40061),ee=r(19248),ne=r(36270),re=r(9601),te=r(17494),ie=r(51221),ae=r(72162),le=r(33821),se=r(32912),oe=r(828),ce=r(80723),de=r(5952),ue=r(67302),ve=r(1427),pe=r(76366),fe=r(47533),me=r(91359),he=r(87536),xe=r(74231),ge=xe.Ry().shape({content:xe.Z_().required(),thumbnail:xe.Z_().nullable(),type:xe.nK().required()}),je=xe.Ry().shape({id:xe.Z_().required(),refNumber:xe.Z_().nullable(),remark:xe.Z_().nullable(),files:xe.IX().of(ge)}),be=function(e){var n=e.onSubmit,r=e.defaultValues,i=(0,he.cI)({defaultValues:r,resolver:(0,fe.X)(je)}),a=i.handleSubmit,l=(i.control,i.formState.errors,function(){var e=(0,k.Z)((function(e){return(0,R.__generator)(this,(function(r){switch(r.label){case 0:return[4,n(e)];case 1:return r.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}());return(0,t.jsx)(pe.e,{methods:i,onSubmit:a(l),defaultValues:r,children:(0,t.jsxs)(me.Z,{children:[(0,t.jsx)(de.Z,{name:"id",defaultValues:r,methods:i}),(0,t.jsxs)(f.ZP,{container:!0,spacing:5,children:[(0,t.jsx)(f.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(ve.Z,{name:"refNumber",textFieldProps:{fullWidth:!0,placeholder:"Reference"},defaultValues:r})}),(0,t.jsx)(f.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(ve.Z,{name:"remark",textFieldProps:{fullWidth:!0,placeholder:"Remarks"},defaultValues:r})}),(0,t.jsx)(f.ZP,{item:!0,xs:12,children:(0,t.jsx)(ue.Z,{name:"files",defaultValues:r,imageUploaderProps:{acceptedFileExtensions:{"application/pdf":[]},buttonColor:"catalog-primary"}})})]}),(0,t.jsx)(f.ZP,{item:!0,xs:12,sx:{pt:function(e){return"".concat(e.spacing(7)," !important")}},children:(0,t.jsx)(x.Z,{type:"submit",variant:"contained",sx:{mr:2},color:"catalog-primary",children:"Update"})})]})})},ye=function(e){var n=e.receiptId,r=e.files,i=e.refNumber,s=e.remark,o=(0,A.useState)(!1),c=o[0],d=o[1],u=function(){return d(!1)},p=(0,oe.Z)((0,v.Q0_)(),2),f=p[0],m=p[1],h=(m.loading,m.error,m.client,(0,A.useMemo)((function(){return{id:n,files:r,refNumber:i,remark:s}}),[n,r,i,s])),g=function(){var e=(0,k.Z)((function(e){var n,r,t,i,s;return(0,R.__generator)(this,(function(o){switch(o.label){case 0:n=(0,ce.x)(h.files,e.files),r
1=(0,l.Z)((0,a.Z)({},e),{files:n}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,f({variables:{updateReceiptInput:r}})];case 2:return t=o.sent(),(i=t.data)&&i.updateReceipt.id&&((0,_.x9)("Receipt updated successfully"),u()),[3,4];case 3:return s=o.sent(),console.error(s),[3,4];case 4:return[2]}}))}));return function(n){return e.apply(this,arguments)}}();return(0,t.jsx)(U.Z,{isOpen:c,setIsOpen:d,maxWidth:"md",dialogProps:{open:c,onClose:function(){return u()}},button:(0,t.jsx)(x.Z,{size:"small",color:"catalog-primary",onClick:function(){return d(!0)},children:"Edit"}),title:"",description:"",children:(0,t.jsx)("div",{className:"m-2",children:(0,t.jsx)(be,{onSubmit:g,defaultValues:h})})})},Ze=function(e){var n=e.receipt,r=n.id,a=n.number,l=(n.status,n.totalPrice),s=n.createdAt,o=n.files,c=n.refNumber,d=n.remark;return(0,t.jsxs)(ne.Z,{children:[(0,t.jsxs)(re.Z,{children:[(0,t.jsx)(te.Z,{color:"catalog-primary"}),(0,t.jsx)(ie.Z,{})]}),(0,t.jsxs)(ae.Z,{sx:{mt:0,mb:function(e){return"".concat(e.spacing(2)," !important")}},children:[(0,t.jsxs)(m.Z,{sx:{mb:2.5,display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)(p.Z,{sx:{mr:2,fontWeight:600},children:(0,t.jsxs)(C.b,{variant:"body1",color:"white",fontWeight:500,children:["Receipt #",(0,t.jsx)(w.Z,{text:"".concat(a),mode:w.r.LIGHT})]})}),(0,t.jsx)(p.Z,{variant:"caption",sx:{color:"text.disabled"},children:(0,se.default)(new Date(s),"dd MMM HH:mm")})]}),(0,t.jsxs)("div",{className:"mb-2 flex flex-row gap-2",children:[(0,t.jsx)(p.Z,{variant:"body2",children:"Total:"}),(0,t.jsxs)(p.Z,{variant:"body2",sx:{color:"text.primary",letterSpacing:".25px",fontWeight:600},children:[null===l||void 0===l?void 0:l.currency," ",(0,$.IY)(null===l||void 0===l?void 0:l.amount)]})]}),(0,t.jsxs)("div",{className:"mb-2 flex flex-row gap-2",children:[(0,t.jsx)(p.Z,{variant:"body2",children:"Ref:"}),(0,t.jsx)(p.Z,{variant:"body2",sx:{color:"text.primary",letterSpacing:".25px",fontWeight:600},children:c})]}),(0,t.jsxs)("div",{className:"mb-2 flex flex-row gap-2",children:[(0,t.jsx)(p.Z,{variant:"body2",children:"Remark:"}),(0,t.jsx)(p.Z,{variant:"body2",sx:{color:"text.primary",letterSpacing:".25px",fontWeight:600},children:d})]}),(0,t.jsxs)(m.Z,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,t.jsx)(p.Z,{variant:"body2",children:"Files: "}),0===o.length&&(0,t.jsx)("span",{children:"-"}),(0,t.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:null===o||void 0===o?void 0:o.map((function(e,n){var r,a=(r={},(0,i.Z)(r,v.Tv5.Document,ee.Te),(0,i.Z)(r,v.Tv5.Image,ee.ZK),(0,i.Z)(r,v.Tv5.Video,ee.OJ),r)[e.type];return(0,t.jsx)("div",{children:(0,t.jsx)(le.Z,{badgeContent:n+1,children:(0,t.jsx)("a",{href:e.content,target:"_blank",rel:"noopener noreferrer",children:(0,t.jsx)("div",{className:"rounded-lg p-2 hover:bg-gray-400/50 hover:text-white ",children:(0,t.jsx)(a,{className:"h-4 w-4 "})})})})},e.content)}))}),(0,t.jsx)(ye,{receiptId:r,files:o,refNumber:c,remark:d})]})]})]})},Pe=function(e){var n=e.receipts,r=(0,X.k)(),i=r.isOpen,a=r.setIsOpen,l=r.openModal,s=r.closeModal,o="Pending approval Receipts";return(0,t.jsx)(U.Z,{isOpen:i,setIsOpen:a,dialogProps:{onClose:function(){return s()}},button:(0,t.jsx)(F.Z,{title:o,placement:"top",children:(0,t.jsx)(J.Z,{size:"small",onClick:l,children:(0,t.jsx)(D.dY,{className:"text-white"})})}),title:o,children:(0,t.jsx)("div",{children:(0,t.jsx)(K.T,{sx:{my:0,py:0},children:null===n||void 0===n?void 0:n.map((function(e){return(0,t.jsx)(Ze,{receipt:e},e.number)}))})})})};!function(e){e.PAID="Paid",e.PARTIAL_PAID="Partial paid",e.ALLOW_PAYMENT="Allow payment",e.WAITING_FOR_INVOICE="Waiting for invoice"}(Q||(Q={}));var we=function(e){var n=e.orderNumber,r=e.pendingReceipts,i=e.paidStatus,a=e.unpaidInvoiceCount,l=e.companyId,s=e.invoiceMustPayBefore,o=(0,T.Z)().loading,c=null,d=s&&new Date>new Date(s);s&&(c=function(e,n){return(0,W.Z)(1,arguments),(0,L.Z)(e,Date.now(),n)}(new Date(s)));var u=i===v.QU8.Paid?Q.PAID:a>0?Q.ALLOW_PAYMENT:Q.WAITING_FOR_INVOICE,p=function(){var e=(0,k.Z)((function(){return(0,R.__generator)(this,(function(e){switch(e.label){case 0:return[4,Y({orderNumber:n,companyId:l})];case 1:return e.sent(),[2]}}))}));return function(){return e.apply(this,arguments)}}(),f=r.length>0,m=r.filter((function(e){return!!e.ePaymentLink})),h=m.length>0;return u===Q.WAITING_FOR_INVOICE?(0,t.jsx)(P.UP,{size:"small",label:u,variant:"filled",sx:{color:"white",backgroundColor:function(e){return e.palette["catalog-primary"].main}}}):u===Q.ALLOW_PAYMENT?(0,t.jsxs)(t.Fragment,{children:[h&&m.map((function(e){var n,r=null!==(n=e.ePaymentLink)&&void 0!==n?n:void 0;return(0,t.jsxs)("a",{href:r,className:"relative",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(P.UP,{size:"small",label:(0,t.jsx)("div",{className:"min-w-[11rem] pl-2",children:"Proceed with Payment"}),variant:"filled",color:"warning"}),(0,t.jsx)("div",{className:"absolute bottom-0 right-0",id:"click-me",children:(0,t.jsx)(D.sG,{className:"!text-catalog-primary"})})]},r)})),f&&(0,t.jsx)(P.UP,{size:"small",label:(0,t.jsxs)("div",{children:["Receipt pending approval",(0,t.jsx)(Pe,{receipts:r})]}),variant:"filled",color:"catalog-primary"}),i===v.QU8.PartialPaid?(0,t.jsx)(P.UP,{size:"small",label:Q.PARTIAL_PAID,variant:"filled",color:"catalog-primary"}):null,!d&&!f&&(0,t.jsx)(F.Z,{title:"Order will be cancelled if no payment receive!",children:(0,t.jsx)(P.UP,{size:"small",label:"Must pay within ".concat(c),variant:"filled",color:"error"})}),!f&&d&&(0,t.jsx)(P.UP,{size:"small",label:"Invoice unpaid and order cancelled!",variant:"filled",color:"error"}),(0,t.jsx)(z.Z,{variant:"contained",loading:o,sx:{color:"white",backgroundColor:function(e){return e.palette["catalog-primary"].main},"&:hover":{backgroundColor:function(e){return e.palette["catalog-dark"].main}}},onClick:p,children:"Pay"})]}):u===Q.PAID?(0,t.jsx)(P.UP,{size:"small",label:u,variant:"filled",color:"success"}):null},Ie=r(86777),Ne=r(90244),Se=r(93978),Ce=r(39807),Oe=r(87611),ke=r(69417),Re=r(5605),_e=function(e){var n=e.label,r=e.cost,i=e.tableRowSx,a=e.hideLastColumnArea,l=void 0!==a&&a,s=e.bearer;return(0,t.jsxs)(ke.Z,{sx:i,children:[(0,t.jsx)(Re.Z,{colSpan:4,width:"10%",align:"left",children:(0,t.jsx)(p.Z,{variant:"body2",children:n})}),(0,t.jsx)(Re.Z,{width:"20%",align:"right",children:(0,t.jsxs)(p.Z,{variant:"body2",sx:{color:"text.primary",letterSpacing:".25px"},children:[s===v.EVR.Buyer?"":"-"," ",r.currency," ",r&&(0,$.IY)(r.amount)]})}),(0,t.jsx)(Re.Z,{}),(0,t.jsx)(Re.Z,{width:"5%",align:"center",hidden:l})]})},Ae=r(7297),Te=r(68806),Ee=r(4451);function Me(){var e=(0,Ae.Z)(["\n  ","\n  ","\n"]);return Me=function(){return e},e}var De=(0,Te.Ps)(Me(),v.Rr8,v.a85);var ze,Fe=function(e){var n=e.order,r=e.orderItems,i=e.hideLastColumnArea,s=void 0!==i&&i,o=(null===n||void 0===n?void 0:n.id)||"",c=(null===n||void 0===n?void 0:n.totalOrderItems)||0,d=(0,A.useState)(!1),u=d[0],p=d[1],f=(0,A.useState)(null),m=f[0],h=f[1],g=(0,Ee.a)().preferredCurrency,j=(0,oe.Z)((0,v.IBn)(),2),b=j[0],y=j[1],Z=(y.loading,y.client),P=function(){var e=(0,k.Z)((function(){var e,r,t,i,s,c=arguments;return(0,R.__generator)(this,(function(d){switch(d.label){case 0:if(e=c.length>0&&void 0!==c[0]?c[0]:-1,r=c.length>1&&void 0!==c[1]?c[1]:0,!n)return[2];d.label=1;case 1:return d.trys.push([1,3,,4]),h(null),[4,b({variables:{filter:{orderId:o},limit:e,offSet:r,convertCurrency:g||void 0}})];case 2:return(null===(t=d.sent().data)||void 0===t?void 0:t.allCacheOrderItems)&&t.allCacheOrderItems.length>0&&(i=(0,l.Z)((0,a.Z)({},n),{orderItems:t.allCacheOrderItems}),Z.cache.modify({id:Z.cache.identify(n),fields:{orderItems:function(){return t.allCacheOrderItems}}}),Z.writeFragment({id:"Order:".concat(o),fragment:De,fragmentName:"PurchaseOrderFragment",data:i}),setTimeout((function(){Z.cache.gc()}),100)),[3,4];case 3:return s=d.sent(),console.error("Error fetching order items:",s),h("Failed to load items. Please try again."),[3,4];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),w=function(){var e=(0,k.Z)((function(){return(0,R.__generator)(this,(function(e){switch(e.label){case 0:return p(!0),[4,P()];case 1:return e.sent(),setTimeout((function(){p(!1)}),500),[2]}}))}));return function(){return e.apply(this,arguments)}}(),I=function(){var e=(0,k.Z)((function(){return(0,R.__generator)(this,(function(e){switch(e.label){case 0:return p(!0),[4,P(4,0)];case 1:return e.sent(),setTimeout((function(){p(!1)}),500),[2]}}))}));return function(){return e.apply(this,arguments)}}();return r&&n?r.length===c&&c<=5?null:(0,t.jsxs)(ke.Z,{children:[(0,t.jsx)(Re.Z,{colSpan:6,children:(0,t.jsxs)("div",{className:"flex w-full gap-2 flex-col",children:[m&&(0,t.jsx)("div",{className:"text-error text-sm mb-1",children:m}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("div",{className:"animate-pulse",hidden:(null===r||void 0===r?void 0:r.length)===c,children:(0,t.jsxs)(x.Z,{onClick:w,color:"error",variant:"outlined",size:"small",children:[u&&(0,t.jsx)(D.Ho,{className:"mr-2 animate-spin"}),(0,t.jsxs)("div",{className:"font-bold text-catalog-primary",children:["Load All ",c," Items ..."]})]})}),(0,t.jsx)("div",{className:"animate-pulse",hidden:!(null===r||void 0===r?void 0:r.length)||r.length<=5,children:(0,t.jsxs)(x.Z,{onClick:I,color:"primary",variant:"outlined",size:"small",children:[u&&(0,t.jsx)(D.Ho,{className:"mr-2 animate-spin"}),(0,t.jsx)("div",{className:"font-bold text-primary",children:"Load Less Items ..."})]})})]})]})}),(0,t.jsx)(Re.Z,{width:"5%",align:"center",hidden:s})]}):null},Le=r(18908).Z,We=r(83674),Qe=function(e){var n=e.totalPrice,r=e.tableRowSx,i=e.hideLastColumnArea,a=void 0!==i&&i,l=(0,We.q)().isSmallScreen?2:3;return(0,t.jsxs)(ke.Z,{sx:r,children:[(0,t.jsx)(Re.Z,{colSpan:l}),(0,t.jsx)(Re.Z,{width:"10%",align:"center",children:(0,t.jsx)(p.Z,{variant:"body2",children:"Total:"})}),(0,t.jsx)(Re.Z,{width:"20%",align:"right",children:(0,t.jsxs)(p.Z,{variant:"body2",sx:{color:"text.primary",letterSpacing:".25px",fontWeight:600},children:[n.currency," ",n&&(0,$.IY)(n.amount)]})}),(0,t.jsx)(Re.Z,{}),(0,t.jsx)(Re.Z,{width:"5%",align:"center",hidden:a})]})},Ge=r(88628),Ue=function(e){var n=e.companyId,r=e.order,i=e.totalPrice,a={getOrderItemStatus:function(e){var n=e.clientCatalogStatus,r=e.confirmedQuantity,t=e.shippingDetails,i={label:n,type:Oe.Ss.ORDER};if(!t||!r)return[i];var a=(0,S.map)((0,S.entries)((0,S.groupBy)(t,"shippingStatus")),(function(e){var n=(0,oe.Z)(e,2),r=n[0],t=n[1];return{shippingStatus:r,trackingNumber:t.reduce((function(e,n,r){return r===t.length-1?"".concat(e+n.trackingNumber):"".concat(e+n.trackingNumber,", ")}),""),totalQuantity:t.reduce((function(e,n){return e+n.shipQuantity}),0)}})),l=a.reduce((function(e,n){return e+n.totalQuantity}),0),o=a.map((function(e){var n=e.shippingStatus,r=e.trackingNumber,t=e.totalQuantity;return{label:"".concat(n,"\nTracking #: ").concat(r," (Qty:").concat(t,")"),type:Oe.Ss.SHIPPING}}));return l<r?(0,s.Z)(o).concat([i]):o},getGroupDetailsString:function(e){var n,r;return null===e||void 0===e?void 0:e.filter((function(e){return(null!==(n=e.quantity)&&void 0!==n?n:0)>0})).map((function(e){return"".concat(null!==(r=e.quantity)&&void 0!==r?r:0," ").concat(e.unit)})).join(", ")}},l=a.getOrderItemStatus,o=a.getGroupDetailsString;if(!r)return null;var c=r.orderItems,d=r.orderCosts;if(!c)return null;var u=!0;return(0,t.jsx)(Ie.Z,{className:"w-full",children:(0,t.jsxs)(Ne.Z,{size:"small",children:[(0,t.jsx)(Se.Z,{children:(0,t.jsx)(Le,{hideLastColumnArea:!0})}),(0,t.jsxs)(Ce.Z,{children:[null===c||void 0===c?void 0:c.map((function(e){var r,i,a,s,c=e.id,d=e.quantity,u=e.confirmedQuantity,p=e.balanceOrderQuantity,f=e.checkedOutPrice,m=e.checkedOutPrice2,h=e.adjustedPrice2,x=e.adjustedPrice,g=e.orderItemSnapshot,j=e.depoBalType,b=e.remarks,y=e.depositRate,Z=e.balanceByOrderNumber,P=e.depositByOrderNumber,w=e.groupDetails,N=e.eligibleDiscountTier,S=g.productName,C=g.images,O=g.barcode,k=g.offer,R=g.sku,_=g.sellerSnapshotCatalogId,T=g.depoFullPrice,E=C[0],M=u||d,D=null!==(r=null===x||void 0===x?void 0:x.amount)&&void 0!==r?r:null===f||void 0===f?void 0:f.amount,z=null!==(i=null===x||void 0===x?void 0:x.currency)&&void 0!==i?i:null===f||void 0===f?void 0:f.currency,F=M*D,L=null!==(a=null===h||void 0===h?void 0:h.amount)&&void 0!==a?a:null===m||void 0===m?void 0:m.amount,W=null!==(s=null===h||void 0===h?void 0:h.currency)&&void 0!==s?s:null===x||void 0===x?void 0:x.currency,Q=M*L,G=T?T*M:0,U=j===v.Au2.Deposit&&u!==p?p:null,V=l(e),B=o(w);return(0,t.jsx)(A.Fragment,{children:(0,t.jsx)(Ge.Z,{deposit:{type:j,rate:y,fullPrice:T?{currency:z,amount:G}:null,depositOrderNumber:P,balanceOrderNumber:Z},status:V,productCatalogId:_,image:E,name:S,quantity:M,newQuantity:U,quantityDetails:B,oriTotal:{amount:F,currency:z},convertedTotal:{amount:Q,currency:W},companyId:n,barcode:O,sku:R,releaseDate:(0,I.p6)(null===k||void 0===k?void 0:k.releaseDate,"dd-MM-yy"),deadline:(0,I.p6)(null===k||void 0===k?void 0:k.orderDeadline,"dd-MM-yy"),remarks:b,eligibleDiscountDetails:N,isOrderTable:!0})},c)})),(0,t.jsx)(Fe,{order:r,orderItems:c,hideLastColumnArea:u}),null===d||void 0===d?void 0:d.map((function(e){var n=e.price,r=e.name,i=e.id,a=e.bearer;return(0,t.jsx)(_e,{label:r,cost:n,hideLastColumnArea:u,bearer:a},i)})),(0,t.jsx)(Qe,{totalPrice:i,hideLastColumnArea:u})]})]})})},Ve=(0,N.ZP)(m.Z)((function(e){var n=e.theme;return{borderRadius:n.shape.borderRadius,borderBottomLeftRadius:0,borderBottomRightRadius:0,backgroundColor:n.palette["catalog-primary"].main,padding:"0.45rem 0.75rem"}})),Be=function(e){var n=e.companyId,r=e.orders,i=e.loading;return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(O.Z,{loading:i}),r.map((function(e){var r,i,a=e.id,l=e.number,s=e.createdAt,o=e.remarks,c=e.status,d=e.unpaidInvoices,u=e.paidStatus,m=e.shipTo,h=e.billTo,x=e.totalPrice,g=x.buyerTotalPrice,j=x.totalPrice,b=(0,I.p6)(s,"dd-MM-yy"),y=(v.QU8.Paid,null!==(i=null===d||void 0===d?void 0:d.length)&&void 0!==i?i:0),Z=null===(r=null===d||void 0===d?void 0:d.find((function(e){return e.mustPayBefore})))||void 0===r?void 0:r.mustPayBefore,N=d&&(null===d||void 0===d?void 0:d.length)>0?(0,S.flatten)(null===d||void 0===d?void 0:d.map((function(e){var n=e.receipts.filter((function(e){return e.status===v.sAb.Pending}));return null!==n&&void 0!==n?n:[]}))):[];return(0,t.jsxs)("div",{className:"relative mb-4 flex flex-col gap-1 rounded-xl border-[1px] pb-2 lg:mb-10",children:[(0,t.jsxs)(Ve,{className:"flex w-full flex-row items-center gap-3",children:[(0,t.jsxs)(C.b,{variant:"h6",fontWeight:700,sx:{textTransform:"uppercase"},children:["Ordered on ",b]}
1),(0,t.jsxs)(p.Z,{variant:"body1",color:"white",fontWeight:500,children:["Order #",(0,t.jsx)(w.Z,{text:"".concat(l),mode:w.r.DARK})]}),(0,t.jsx)(P.UP,{className:"absolute right-3 top-2 lg:top-3",size:"small",label:c,variant:"filled",sx:{color:"white",backgroundColor:function(e){return e.palette["catalog-dark"].main}}})]}),(0,t.jsx)(Ue,{companyId:n,order:e,totalPrice:g||j}),(0,t.jsxs)(f.ZP,{container:!0,spacing:2,className:"px-4",children:[(0,t.jsx)(f.ZP,{item:!0,xs:12,md:8,children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)(p.Z,{variant:"caption",children:["Shipping address: ",null===m||void 0===m?void 0:m.address1," ",null===m||void 0===m?void 0:m.address2,null===m||void 0===m?void 0:m.postcode," ",null===m||void 0===m?void 0:m.city," ",null===m||void 0===m?void 0:m.country]}),(0,t.jsxs)(p.Z,{variant:"caption",children:["Billing address: ",null===h||void 0===h?void 0:h.address1," ",null===h||void 0===h?void 0:h.address2,null===h||void 0===h?void 0:h.postcode," ",null===h||void 0===h?void 0:h.city," ",null===h||void 0===h?void 0:h.country]}),(0,t.jsxs)(p.Z,{variant:"caption",children:["Remarks: ",null!==o&&void 0!==o?o:"-"]})]})}),(0,t.jsx)(f.ZP,{item:!0,xs:12,md:4,className:"flex md:justify-end",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(we,{pendingReceipts:N,paidStatus:u,unpaidInvoiceCount:y,orderNumber:l,companyId:n,invoiceMustPayBefore:Z}),(0,t.jsx)(M,{orderId:a})]})})]})]},a)}))]})};!function(e){e.PAYMENT="Payment",e.SHIPPING="Shipping"}(ze||(ze={}));var qe=[{label:"Paid",value:v.sQ8.Paid,type:ze.PAYMENT},{label:"Unpaid",value:v.sQ8.Unpaid,type:ze.PAYMENT},{label:"Shipped",value:v.sQ8.Shipped,type:ze.SHIPPING}],He=function(e){var n=e.companyId,r=(0,c.r)(),P=r.rows,w=r.loading,I=r.page,N=r.setPage,S=r.pageSize,C=r.totalRows,O=r.filters,k=r.setFilters,R=function(e,n){k((0,l.Z)((0,a.Z)({},O),(0,i.Z)({},e,n)))},_=function(e,n){var r=[v.sQ8.Paid,v.sQ8.Unpaid],t=[v.sQ8.Shipped];switch(e){case ze.PAYMENT:var i,a,l=null!==(a=null===(i=O.substatus)||void 0===i?void 0:i.filter((function(e){return!r.includes(e)})))&&void 0!==a?a:[];R("substatus",n?(0,s.Z)(l).concat([n]):l);break;case ze.SHIPPING:var o,c,d=null!==(c=null===(o=O.substatus)||void 0===o?void 0:o.filter((function(e){return!t.includes(e)})))&&void 0!==c?c:[];R("substatus",n?(0,s.Z)(d).concat([n]):d)}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{title:(0,t.jsx)("div",{className:"flex items-center justify-center",children:(0,t.jsx)(p.Z,{variant:"h3",children:"Order History"})})}),(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(Z.Z,{activeStep:j.c1.ORDER})}),(0,t.jsxs)(f.ZP,{container:!0,spacing:2,children:[(0,t.jsx)(f.ZP,{item:!0,xs:12,lg:3,sx:{display:{xs:"none",lg:"block"},marginTop:4},children:(0,t.jsxs)(b.Z,{children:[(0,t.jsx)(o.Z,{name:"sku",placeholder:"Search Sku",value:(null===O||void 0===O?void 0:O.sku)||"",onChange:R}),(0,t.jsx)(o.Z,{name:"number",placeholder:"Search Order #",value:(null===O||void 0===O?void 0:O.number)||"",onChange:R}),(0,t.jsxs)("div",{className:"flex w-full flex-col items-center justify-between",children:[(0,t.jsx)(p.Z,{variant:"body2",children:"Order Status:"}),(0,t.jsx)(m.Z,{className:"flex items-center gap-2",sx:{mr:"1.5rem",my:1,mb:"0.5rem"},children:(0,t.jsx)("div",{className:"grow",children:(0,t.jsx)(h.Z,{size:"small",color:"catalog-primary",children:qe.map((function(e,n,r){var i=!1;return Array.isArray(O.substatus)?O.substatus.includes(e.value)&&(i=!0):"string"===typeof O.substatus&&(i=!0),(0,t.jsx)(x.Z,{onClick:function(){_(e.type,i?null:e.value)},variant:i?"contained":"outlined",children:e.label},n)}))})})})]})]})}),(0,t.jsx)(f.ZP,{item:!0,xs:12,lg:9,sx:{marginTop:4},children:P.length>0||w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Be,{companyId:n,orders:P,loading:w}),(0,t.jsx)(y.Z,{page:I,pageSize:S,total:C,onChange:N})]}):(0,t.jsx)(g.Z,{Icon:d.oM,message:"No orders found."})})]})]})},Ye=function(e){var n=e.children,r=e.companyId;return(0,t.jsx)(c.as,{defaultFilters:{supplierId:r},children:n})},Ke=r(71383),Xe=r(85769),Je=r(63121),$e=r(78142),en=function(){var e=(0,$e._Y)(),n=(0,Je.w)({companyName:e}),r=null===n||void 0===n?void 0:n.id;return r?(0,t.jsx)("div",{className:"mx-auto max-w-7xl px-4 py-6 lg:px-0",children:(0,t.jsxs)(Ye,{companyId:r,children:[(0,t.jsx)(Ke.Z,{label:"Order"}),(0,t.jsx)(He,{companyId:r})]})}):null},nn=!0,rn=en;en.getLayout=function(e){return(0,t.jsx)(Xe.Z,{children:e})},en.guestGuard=!1,en.authGuard=!1,en.setConfig=function(){return{mode:"light"}}}},function(e){e.O(0,[2876,630,4980,4577,7536,1524,4231,5428,1718,5836,5734,3747,1717,2268,9591,2512,1090,7247,5
1780,1280,2020,8507,3021,1115,7384,4738,5686,9495,6732,5646,9714,2068,6778,1039,4503,6446,2180,7297,309,7545,9329,9721,1197,7302,4015,5992,5769,4760,8321,9774,2888,179],(function(){return n=67524,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.