PageSourceSearch

https://bro-depot.com/_next/static/chunks/pages/apps/payment-credit-5657c64b8b90d915.js

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

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4298],{17955:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/apps/payment-credit",function(){return t(41596)}])},42209:function(e,n,t){"use strict";t.d(n,{Z:function(){return y}});var r=t(85893),i=t(50332),l=t(56302),a=t(1427),s=t(76366),o=t(47533),c=t(79072),d=t(29630),u=t(44373),m=t(54225),x=t(96486),f=t(67294),h=t(87536),p=t(43524),v=t(83254),j=t(59707),g=t(95676),Z=t(86893);var b=function(e){var n=e.defaultValues,t=(0,h.Gc)(),i=t.control,l=(t.trigger,t.clearErrors,(0,h.Dq)({control:i,name:"addresses",keyName:"uid"})),s=l.fields,o=l.append,x=(l.prepend,l.remove);return l.swap,l.move,l.insert,(0,h.cl)({control:i}).errors,(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-3 flex",children:(0,r.jsx)(d.Z,{variant:"body2",sx:{fontWeight:600},children:"Address Profiles"})}),null===s||void 0===s?void 0:s.map((function(e,t){var i="addresses.".concat(t);return(0,r.jsx)("div",{children:(0,r.jsxs)(c.ZP,{container:!0,spacing:3,sx:{pb:6},children:[(0,r.jsx)(c.ZP,{item:!0,xs:6,children:(0,r.jsxs)(d.Z,{variant:"body2",sx:{fontWeight:600},children:["Address #",t+1]})}),(0,r.jsx)(c.ZP,{item:!0,xs:6,children:(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(m.Z,{variant:"text",type:"button",color:"error",sx:{mt:1},onClick:function(){return x(t)},children:(0,r.jsx)(Z.Ybf,{className:"stroke-current text-base"})})})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{label:"Company Name",name:"".concat(i,".companyName"),textFieldProps:{fullWidth:!0,placeholder:"xx Company",autoFocus:!1},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{label:"Tel No.",name:"".concat(i,".telNo"),textFieldProps:{fullWidth:!0,autoFocus:!1},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,children:(0,r.jsx)(u.Z,{sx:{m:0,p:0},children:(0,r.jsx)(d.Z,{variant:"caption",children:"Address Details"})})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{label:"Address 1",name:"".concat(i,".address1"),textFieldProps:{fullWidth:!0,placeholder:"1, Infinite Road",autoFocus:!1},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{label:"Address 2",name:"".concat(i,".address2"),textFieldProps:{fullWidth:!0,placeholder:"Apt. 1",autoFocus:!1},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{label:"City",name:"".concat(i,".city"),textFieldProps:{fullWidth:!0,placeholder:"Melaka",autoFocus:!1},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{label:"Postcode",name:"".concat(i,".postcode"),textFieldProps:{fullWidth:!0,placeholder:""},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(g.Z,{label:"State",name:"".concat(i,".state"),countryFieldName:"".concat(i,".country"),selectProps:{placeholder:"Melaka"},defaultValues:n})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(j.Z,{label:"Country",name:"".concat(i,".country"),selectProps:{placeholder:"Melaka"},defaultValues:n})})]})},e.uid)})),(0,r.jsx)(m.Z,{sx:{mt:6},size:"small",variant:"outlined",onClick:function(){o(p.nK)},type:"button",children:"+ Add Address"})]})};var y=function(e){var n,t=e.defaultValues,j=e.onSubmit,g=e.mode,Z=void 0===g?i.R.Create:g,y=e.onAdd,C=e.onDelete,P=e.onEdit,k=(0,x.merge)({},p.tR,t),w=(0,h.cI)({defaultValues:k,resolver:(0,o.X)(p._K)}),N=w.handleSubmit,S=(w.formState,w.reset),z=function(e){j(e)};return(0,f.useEffect)((function(){var e=(0,x.merge)({},p.tR,t);S(e)}),[t]),(0,r.jsx)("div",{children:(0,r.jsx)(s.e,{methods:w,onSubmit:N(z),defaultValues:k,children:(0,r.jsxs)(c.ZP,{container:!0,spacing:6,children:[(0,r.jsx)(c.ZP,{item:!0,xs:12,children:(0,r.jsx)(d.Z,{variant:"body2",sx:{fontWeight:600},children:"Basic Details"})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{name:"name",defaultValues:k,textFieldProps:{autoFocus:!0}})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{name:"email",textFieldProps:{fullWidth:!0,placeholder:"[email protected]",autoFocus:!1},defaultValues:k})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(a.Z,{name:"telNo",textFieldProps:{fullWidth:!0,placeholder:"+1 123 456 7890",autoF
1ocus:!1},defaultValues:k})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,r.jsx)(l.Z,{name:"baseCurrency",label:"Base Currency",defaultValues:k})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,children:(0,r.jsx)(u.Z,{})}),Z===i.R.Create&&(0,r.jsx)(c.ZP,{item:!0,xs:12,children:(0,r.jsx)(b,{defaultValues:k})}),Z===i.R.Update&&(0,r.jsx)(c.ZP,{item:!0,xs:12,children:(0,r.jsx)(v.Z,{addresses:null!==(n=k.addresses)&&void 0!==n?n:[],onAdd:y,onDelete:C,onEdit:P})}),(0,r.jsx)(c.ZP,{item:!0,xs:12,sx:{pt:function(e){return"".concat(e.spacing(7)," !important")}},children:(0,r.jsx)(m.Z,{variant:"contained",sx:{mr:4},onClick:N(z),children:"Submit"})})]})})})}},99816:function(e,n,t){"use strict";t.d(n,{V:function(){return N},Z:function(){return w}});var r=t(47568),i=t(26042),l=t(69396),a=t(828),s=t(70655),o=t(85893),c=t(20986),d=t(74098),u=t(96277),m=t(67836),x=t(80562),f=t(32631),h=t(35966),p=t(70754),v=t(96486),j=t(67294),g=t(87536),Z=(t(602),t(86806)),b=t(42209),y=t(53722),C=t(45209),P=t(43085),k=function(e){var n=e.isOpen,t=e.setIsOpen,i=e.onCreateCustomer,l=function(){t(!1)},c=(0,a.Z)((0,u.NvL)(),2),d=c[0],m=c[1],x=m.loading,f=m.client,h=function(){var e=(0,r.Z)((function(e){var n,t;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return[4,d({variables:{createCustomerDto:e}})];case 1:return n=r.sent(),(null===(t=n.data)||void 0===t?void 0:t.createCustomer.id)&&(i&&i(t.createCustomer),(0,P.x9)("Customer created successfully"),l()),f.refetchQueries({include:[u.Hyy]}),[2]}}))}));return function(n){return e.apply(this,arguments)}}();return(0,o.jsx)(C.Z,{isOpen:n,setIsOpen:t,dialogProps:{fullWidth:!0,maxWidth:"md",onClose:function(){return l()}},button:" ",title:"Create customer",description:"",children:(0,o.jsxs)("div",{hidden:!n,className:"p-5",children:[(0,o.jsx)(y.Z,{open:x}),(0,o.jsx)(b.Z,{onSubmit:h})]})})};function w(e){var n=e.label,t=e.onChange,f=e.value,g=e.error,b=e.multiple,y=e.enableCreate,C=(0,j.useMemo)((function(){return(0,Z.y)("simple-customer-autocomplete")}
1),[]),P=(0,j.useState)(!1),w=P[0],N=P[1],S=(0,j.useState)(""),z=S[0],_=S[1],A=(0,j.useState)(void 0),O=A[0],I=A[1],T=(0,j.useState)(0),F=T[0],W=T[1],D=(0,a.Z)((0,u.Bg8)({variables:{filter:O,page:F,perPage:30,sortField:"name",sortOrder:u.Asd.Asc}}),2),E=D[0],V=D[1],R=V.fetchMore,M=V.data,B=V.loading,q=(0,j.useState)(!1),U=q[0],H=q[1],L=null===M||void 0===M?void 0:M.allCustomers.total,G=(null===M||void 0===M?void 0:M.allCustomers.customers)||[];(0,j.useEffect)((function(){if(!M)return(0,r.Z)((function(){return(0,s.__generator)(this,(function(e){return E(),[2]}))}))(),function(){!1}}),[M,E]);var Q=(0,j.useCallback)((0,r.Z)((function(){return(0,s.__generator)(this,(function(e){return R({variables:{filter:O,page:F+1,perPage:30,sortField:"name",sortOrder:u.Asd.Asc}}),W((function(e){return e+1})),[2]}))})),[F]),X=(0,v.debounce)(Q,400),$=function(){var e=(0,r.Z)((function(e){return(0,s.__generator)(this,(function(n){return e?(I((function(n){return(0,l.Z)((0,i.Z)({},n),{name:e})})),W(0),E(),[2]):[2]}))}));return function(n){return e.apply(this,arguments)}}(),K=(0,j.useCallback)((0,v.debounce)((function(e){$(e)}),600),[]);return(0,j.useEffect)((function(){K(z)}),[z]),(0,j.useEffect)((function(){w||I(void 0)}),[w]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(h.Z,{id:C,open:w,disableCloseOnSelect:b,multiple:b,value:f,inputValue:z,onInputChange:function(e,n,t){_(n)},onChange:function(e,n){t(n)},onOpen:function(){N(!0)},onClose:function(){N(!1)},size:"small",isOptionEqualToValue:function(e,n){return e.value===n.value},getOptionLabel:function(e){return e.label||""},options:G,loading:B,filterOptions:function(e){return e},ListboxProps:{style:{maxHeight:"250px"},onScroll:function(e){e.stopPropagation();var n=e.currentTarget,t=n.scrollTop;if(Math.round(n.scrollHeight-t)-25<=n.clientHeight){L!==G.length&&X()}}},renderOption:function(e,n,t){var r=!!n.eSystemId;return(0,o.jsxs)("ul",(0,l.Z)((0,i.Z)({},e),{children:[n.label," ",(0,o.jsx)("div",{hidden:!r,className:"ml-1",children:(0,o.jsx)(d._m,{className:"text-info"})})]}))},renderInput:function(e){return(0,o.jsx)(m.Z,(0,l.Z)((0,i.Z)({},e),{label:n,error:g,placeholder:"",InputProps:(0,l.Z)((0,i.Z)({},e.InputProps),{startAdornment:(0,o.jsx)(x.Z,{size:"small",onClick:function(){return H(!0)},children:(0,o.jsx)(c.dt,{})}),endAdornment:(0,o.jsxs)(o.Fragment,{children:[B?(0,o.jsx)(p.Z,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})}))}}),y?(0,o.jsx)(k,{isOpen:U,setIsOpen:H,onCreateCustomer:function(e){var n=e.id,r=e.name;t({value:n,label:r})}}):null]})}var N=function(e){var n,t=e.methods,r=e.name,l=e.label,a=e.defaultValue,s=e.defaultValues,c=e.controllerProps,d=e.multiple,u=void 0!==d&&d,m=e.enableCreate,x=void 0!==m&&m,h=t.control,p=(0,g.cl)({control:h}).errors,j=(0,v.get)(p,r),Z=a||(0,v.get)(s,r);void 0===l&&(0,v.startCase)(r);return(0,o.jsxs)("div",{children:[(0,o.jsx)(g.Qr,(0,i.Z)({name:r,control:h,defaultValue:Z,render:function(e){var n=e.field,t=n.value,r=n.onChange;return(0,o.jsx)(w,{value:t,label:l,onChange:r,error:Boolean(j),multiple:u,enableCreate:x})}},c)),j&&(0,o.jsx)(f.Z,{sx:{color:"error.main"},children:null===(n=(0,v.get)(j,"message"))||void 0===n?void 0:n.toString()})]})}},41596:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return me}});var r=t(85893),i=t(14924),l=t(26042),a=t(69396),s=t(29815),o=t(45408),c=t(25941),d=t(61283),u=t(19668),m=t(74230),x=t(94062),f=t(47018),h=t(96277),p=t(67062),v=t(30120),j=t(29630),g=t(68346),Z=t(23378),b=t(9144),y=t(90244),C=t(93978),P=t(69417),k=t(560
15),w=t(39807),N=t(79072),S=t(70754),z=t(49837),_=t(25836),A=t(67294),O=t(85518),I=t(5434),T=t(47568),F=t(82670),W=t(828),D=t(70655),E=t(93930),V=t(20986),R=t(43085),M=t(17575),B=t(80562),q=t(43963),U=t(67836),H=t(54225),L=["Late order request","Not enough stock","Not enough quantity","Price too high","Price too low","Supplier issue","Missing payment","Buyer request cancel","No Response"],G=function(e){var n=e.paymentCredit,t=n.status,i=n.id,l=(0,A.useState)(t),a=l[0],s=l[1],o=(0,A.useState)(null),c=o[0],d=o[1],u=(0,A.useState)(""),m=u[0],x=u[1],f=function(e,n){d(e.currentTarget),s(n)},p=function(){d(null)},v=Boolean(c),j=v?"payment-credit-status-popover":void 0,g=(0,W.Z)((0,h.Aq_)({refetchQueries:[h.FdC]}),2),Z=g[0],b=g[1],y=b.loading,C=b.client,P=function(){var e=(0,T.Z)((function(){var e,n,t,r,l,s;return(0,D.__generator)(this,(function(o){switch(o.label){case 0:if(!i)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Z({variables:{input:{id:i,status:a,rejectReason:m||void 0}}})];case 2:return t=o.sent(),(r=null===(e=t.errors)||void 0===e?void 0:e[0])?((0,R._N)(null!==(l=r.message)&&void 0!==l?l:"Failed to update payment credit"),[2]):((null===(n=t.data)||void 0===n?void 0:n.updatePaymentCredit.id)&&((0,R.x9)("Payment credit has been updated successfully"),C.cache.evict({fieldName:"allInvoices"}),C.cache.evict({fieldName:"allInvoicesWithOrder"}),C.cache.evict({fieldName:"allReceipts"}),C.cache.gc(),p()),[3,4]);case 3:return s=o.sent(),(0,R._N)((0,F.Z)(s,Error)?s.message:"Failed to update payment credit"),[3,4];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),k=(0,A.useCallback)((function(e){x(e)}),[]),w=t===h.kkz.Pending,N=t===h.kkz.Pending||t===h.kkz.Approved;return(0,r.jsxs)("div",{children:[(0,r.jsx)(M.Z,{title:"Update status",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[w&&(0,r.jsx)(B.Z,{color:"success",size:"small",onClick:function(e){return f(e,h.kkz.Approved)},children:(0,r.jsx)(V.Ye,{})}),N&&(0,r.jsx)(B.Z,{color:"error",size:"small",onClick:function(e){return f(e,h.kkz.Canceled)},children:(0,r.jsx)(V.Tw,{})})]})}),(0,r.jsx)(q.ZP,{id:j,open:v,anchorEl:c,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,r.jsxs)("div",{className:"mx-5 my-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(V.zM,{}),(0,r.jsx)("span",{children:"Are you sure?"})]}),a===h.kkz.Canceled&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)(U.Z,{id:"reject-payment-credit-reason-input",value:m,label:"Rejection reason",size:"small",onChange:function(e){x(e.target.value)},sx:{minWidth:"20rem"},InputProps:{autoComplete:"off"}}),(0,r.jsx)(E.b,{reasonList:L,onSelectReason:k})]}),(0,r.jsx)("div",{className:"mt-1 flex justify-end",children:(0,r.jsx)(H.Z,{color:a===h.kkz.Approved?"success":"error",onClick:P,disabled:y,children:a===h.kkz.Approved?"Approve":"Cancel"})})]})})]})},Q=[{headerName:"Number",field:"number",flex:1,minWidth:200,renderCell:function(e){var n=e.value;return(0,r.jsx)("span",{children:n})}},{headerName:"Source",field:"sourceType",flex:1,minWidth:160,renderCell:function(e){var n=e.row;return n.sourceType===h.DU1.SalesOrder&&n.salesOrder?(0,r.jsx)(g.Z,{href:"/order-management/sales-order/view?id=".concat(n.salesOrder.id),underline:"hover",onClick:function(e){return e.stopPropagation()},children:(0,r.jsx)(Z.Z,{label:n.salesOrder.number,size:"small",variant:"outlined",color:"primary",clickable:!0,sx:{fontSize:"0.75rem",height:22}})}):(0,r.jsx)(Z.Z,{label:"Payment",size:"small",variant:"outlined",sx:{fontSize:"0.75rem",height:22}})}},{headerName:"Customer",field:"customer",flex:1,minWidth:150,renderCell:function(e){var n,t=e.row;return(0,r.jsx)("span",{children:null===(n=t.customer)||void 0===n?void 0:n.name})}},{headerName:"Amount",field:"totalPrice",flex:1,minWidth:150,renderCell:function(e){var n=e.value;return(0,r.jsx)(c.C,{amount:null===n||void 0===n?void 0:n.amount,currency:null===n||void 0===n?void 0:n.currency})}},{headerName:"Available",field:"availableBalance",flex:1,minWidth:120,renderCell:function(e){var n,t=e.value,i=e.row;return(0,r.jsx)(c.C,{amount:t,currency:null===(n=i.totalPrice)||void 0===n?void 0:n.currency})}},{headerName:"Status",field:"status",flex:1,minWidth:120,maxWidth:150,renderCell:function(e){var n=e.row.status;return(0,r.jsx)("div",{children:n===h.kkz.Pending?(0,r.jsx)(Z.Z,{size:"small",label:"Pending",color:"warning"}):n===h.kkz.Approved?(0,r.jsx)(Z.Z,{size:"small",label:"Approved",color:"success"}):(0,r.jsx)(Z.Z,{size:"small",label:"Canceled",color:"error"})})}},{headerName:"Date",field:"createdAt",flex:1,minWidth:130,renderCell:function(e){var n,t=e.row;return(0,r.jsx)("span",{children:(0,p.p6)(null!==(n=t.creditDate)&&void 0!==n?n:t.createdAt)})}},{headerName:"Created By",field:"createdBy",flex:1,minWidth:120,renderCell:function(e){var n,t=e.row;return(0,r.jsx)("span",{children:null===(n=t.createdBy)||void 0===n?void 0:n.userName})}},{headerName:"",field:"actions",width:80,renderCell:function(e){var n=e.row;return(0,r.jsx)(G,{paymentCredit:n})}}],X=t(99816),$=t(91359),K=t(31538),Y=function(e){var n,t,i,l=e.filters,a=e.handleFilter,s=(0,A.useState)(null),o=s[0],c=s[1];return(0,r.jsx)($.Z,{children:(0,r.jsxs)(N.ZP,{container:!0,spacing:6,children:[(0,r.jsx)(N.ZP,{item:!0,xs:12,sm:3,children:(0,r.jsxs)(U.Z,{select:!0,fullWidth:!0,label:"Status",size:"small",value:null!==(n=l.status)&&void 0!==n?n:"",onChange:function(e){return a("status",e.target.value||void 0)},children:[(0,r.jsx)(K.Z,{value:"",children:"All"}),(0,r.jsx)(K.Z,{value:h.kkz.Pending,children:"Pending"}),(0,r.jsx)(K.Z,{value:h.kkz.Approved,children:"Approved"}),(0,r.jsx)(K.Z,{value:h.kkz.Canceled,children:"Canceled"})]})}),(0,r.jsx)(N.ZP,{item:!0,xs:12,sm:3,children:(0,r.jsxs)(U.Z,{select:!0,fullWidth:!0,label:"Source",size:"small",value:null!==(t=l.sourceType)&&void 0!==t?t:"",onChange:function(e){return a("sourceType",e.target.value||void 0)},children:[(0,r.jsx)(K.Z,{value:"",children:"All"}),(0,r.jsx)(K.Z,{value:h.DU1.Payment,children:"Payment"}),(0,r.jsx)(K.Z,{value:h.DU1.SalesOrder,children:"Sales Order"})]})}),(0,r.jsx)(N.ZP,{item:!0,xs:12,sm:3,children:(0,r.jsx)(U.Z,{fullWidth:!0,label:"Search by Number",size:"small",value:null!==(i=l.number)&&void 0!==i?i:"",onCh
1ange:function(e){return a("number",e.target.value||void 0)}})}),(0,r.jsx)(N.ZP,{item:!0,xs:12,sm:3,children:(0,r.jsx)(X.Z,{label:"Customer",value:o,onChange:function(e){c(e),a("customerId",(null===e||void 0===e?void 0:e.value)||void 0)},error:!1,multiple:!1,enableCreate:!1})})]})})},J=t(33342),ee=t(85214),ne=t(81284),te=t(94138),re=t(44373),ie=function(e){var n=e.label,t=e.value;return(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("span",{className:"shrink-0 opacity-60",children:[n,":"]}),(0,r.jsx)("span",{className:"ml-2 truncate text-right font-medium",children:null!==t&&void 0!==t?t:"-"})]})},le=function(e){var n,t,i,l,a,s,o,d,u=e.row,m=u.status,x=m===h.kkz.Pending?(0,r.jsx)(te.I,{label:"Pending",color:"warning"}):m===h.kkz.Approved?(0,r.jsx)(te.I,{label:"Approved",color:"success"}):(0,r.jsx)(te.I,{label:"Canceled",color:"error"}),f=u.sourceType===h.DU1.SalesOrder&&!!u.salesOrder;return(0,r.jsx)(z.Z,{className:"w-full",children:(0,r.jsxs)($.Z,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsx)("div",{className:"min-w-0 flex-1",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("strong",{className:"app-clickable break-words",children:u.number}),x]})}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:(0,r.jsx)(G,{paymentCredit:u})})]}),(0,r.jsx)(re.Z,{className:"!my-2"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-1 text-sm",children:[(0,r.jsx)(ie,{label:"Source",value:f?(0,r.jsx)(g.Z,{href:"/order-management/sales-order/view?id=".concat(null===(n=u.salesOrder)||void 0===n?void 0:n.id),underline:"hover",onClick:function(e){return e.stopPropagation()},children:(0,r.jsx)(Z.Z,{label:null===(t=u.salesOrder)||void 0===t?void 0:t.number,size:"small",variant:"outlined",color:"primary",clickable:!0,sx:{fontSize:"0.75rem",height:22}})}):"Payment"}),(0,r.jsx)(ie,{label:"Customer",value:(null===(i=u.customer)||void 0===i?void 0:i.name)||"-"}),(0,r.jsx)(ie,{label:"Amount",value:(0,r.jsx)(c.C,{amount:null===(l=u.totalPrice)||void 0===l?void 0:l.amount,currency:null===(a=u.totalPrice)||void 0===a?void 0:a.currency})}),(0,r.jsx)(ie,{label:"Available",value:(0,r.jsx)(c.C,{amount:u.availableBalance,currency:null===(s=u.totalPrice)||void 0===s?void 0:s.currency})}),(0,r.jsx)(ie,{label:"Date",value:(0,p.p6)(null!==(d=u.creditDate)&&void 0!==d?d:u.createdAt)}),(0,r.jsx)(ie,{label:"Created By",value:(null===(o=u.createdBy)||void 0===o?void 0:o.userName)||"-"})]})]})})},ae=function(e){var n=e.rows;return(0,r.jsx)(ee.Z,{children:null===n||void 0===n?void 0:n.map((function(e,n){return(0,r.jsx)(ne.ZP,{sx:(0,J.g)(n),children:(0,r.jsx)(le,{row:e})},e.id)}))})},se=function(){return(0,r.jsx)(m.D,{})},oe=function(e){var n,t,i,l,a=e.row,s=null!==(n=a.creditApplications)&&void 0!==n?n:[],o=null!==(t=a.files)&&void 0!==t?t:[];return(0,r.jsxs)(v.Z,{sx:{p:2,bgcolor:"background.default"},children:[a.sourceType===h.DU1.SalesOrder&&a.salesOrder&&(0,r.jsxs)(v.Z,{sx:{mb:2},children:[(0,r.jsx)(j.Z,{variant:"subtitle2",sx:{mb:.5},children:"Source: Sales Order"}),(0,r.jsx)(g.Z,{href:"/order-management/sales-order/view?id=".concat(a.salesOrder.id),underline:"hover",children:(0,r.jsx)(Z.Z,{label:a.salesOrder.number,size:"small",variant:"outlined",color:"primary",clickable:!0,sx:{fontSize:"0.75rem",height:24}})})]}),o.length>0&&(0,r.jsxs)(v.Z,{sx:{mb:2},children:[(0,r.jsxs)(j.Z,{variant:"subtitle2",sx:{mb:1},children:["Attachments (",o.length,")"]}),(0,r.jsx)(b.Z,{direction:"row",spacing:1,flexWrap:"wrap",children:o.map((function(e){return(0,r.jsx)(Z.Z,{icon:(0,r.jsx)(I._b$,{size:14}),label:null!==(i=e.type)&&void 0!==i?i:"File",size:"small",variant:"outlined",clickable:!0,component:g.Z,href:e.content,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.75rem",height:24}},e.id)}))})]}),(0,r.jsxs)(j.Z,{variant:"subtitle2",sx:{mb:1},children:["Credit Applications (",s.length,")"]}),0===s.length?(0,r.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:"No credit applications yet"}):(0,r.jsxs)(y.Z,{size:"small",children:[(0,r.jsx)(C.Z,{children:(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(k.Z,{sx:{fontWeight:600},children:"#"}),(0,r.jsx)(k.Z,{sx:{fontWeight:600},children:"Receipt Number"}),(0,r.jsx)(k.Z,{sx:{fontWeight:600},children:"Invoice"}),(0,r.jsx)(k.Z,{sx:{fontWeight:600},children:"Sales Order"}),(0,r.jsx)(k.Z,{sx:{fontWeight:600},children:"Amount"}),(0,r.jsx)(k.Z,{sx:{fontWeight:600},children:"Date"})]})}),(0,r.jsx)(w.Z,{children:s.map((function(e,n){var t,i,a,s,o,d,u,m,x;return(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(k.Z,{children:n+1}),(0,r.jsx)(k.Z,{children:(0,r.jsx)(Z.Z,{label:null!==(l=null===(t=e.receipt)||void 0===t?void 0:t.number)&&void 0!==l?l:"-",size:"small",variant:"outlined",color:"Approved"===(null===(i=e.receipt)||void 0===i?void 0:i.status)?"success":"default",sx:{fontSize:"0.75rem",he
1ight:22}})}),(0,r.jsx)(k.Z,{children:(null===(a=e.receipt)||void 0===a||null===(s=a.invoice)||void 0===s?void 0:s.number)?(0,r.jsx)(Z.Z,{label:e.receipt.invoice.number,size:"small",variant:"outlined",color:"secondary",sx:{fontSize:"0.75rem",height:22}}):(0,r.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:"-"})}),(0,r.jsx)(k.Z,{children:(null===(o=e.receipt)||void 0===o||null===(d=o.invoice)||void 0===d||null===(u=d.salesOrder)||void 0===u?void 0:u.number)?(0,r.jsx)(Z.Z,{label:e.receipt.invoice.salesOrder.number,size:"small",variant:"outlined",color:"primary",sx:{fontSize:"0.75rem",height:22}}):(0,r.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:"-"})}),(0,r.jsx)(k.Z,{children:(0,r.jsx)(c.C,{amount:null===(m=e.appliedAmount)||void 0===m?void 0:m.amount,currency:null===(x=e.appliedAmount)||void 0===x?void 0:x.currency})}),(0,r.jsx)(k.Z,{children:(0,r.jsx)(j.Z,{variant:"body2",children:(0,p.p6)(e.createdAt)})})]},e.id)}))})]})]})},ce=function(){var e=(0,A.useState)(0),n=e[0],t=e[1],c=(0,A.useState)(20),m=c[0],p=c[1],v=(0,A.useState)({}),g=v[0],Z=v[1],b=(0,h.CRG)({variables:{filter:g,page:n,perPage:m,sortField:"createdAt",sortOrder:h.Asd.Desc}}),y=b.data,C=b.loading,P=(null===y||void 0===y?void 0:y.allPaymentCredits.paymentCredits)||[],k=(null===y||void 0===y?void 0:y.allPaymentCredits.total)||0,w=(0,A.useCallback)((function(){return"auto"}),[]),I=(0,A.useCallback)((function(e,n){Z((function(t){return(0,a.Z)((0,l.Z)({},t),(0,i.Z)({},e,n))}))}),[]),T=(0,A.useState)([]),F=T[0],W=T[1],D=(0,A.useCallback)((function(e){return(0,r.jsx)(oe,{row:e.row})}),[]),E=(0,A.useCallback)((function(){return"auto"}),[]),V=(0,A.useCallback)((function(e){W((function(n){return n.includes(e.id)?n.filter((function(n){return n!==e.id})):(0,s.Z)(n).concat([e.id])}))}),[]);return(0,r.jsxs)(N.ZP,{container:!0,spacing:6,children:[(0,r.jsx)(f.Z,{title:(0,r.jsx)(j.Z,{variant:"h5",children:"All Payment Credits"}),subtitle:(0,r.jsx)(j.Z,{variant:"body2",children:"Find all of your company's payment credits"})}),(0,r.jsx)(N.ZP,{item:!0,xs:12,children:(0,r.jsx)(N.ZP,{container:!0,spacing:6,children:(0,r.jsxs)(N.ZP,{item:!0,xs:12,children:[(0,r.jsx)(Y,{filters:g,handleFilter:I}),O.tq?(0,r.jsxs)("div",{className:"pb-16",children:[C&&!P.length?(0,r.jsx)("div",{className:"flex justify-center py-10",children:(0,r.jsx)(S.Z,{})}):P.length?(0,r.jsx)(ae,{rows:P}):(0,r.jsx)(o.u,{compact:!0,variant:"filtered",title:"No payment credits match your filters"}),(0,r.jsx)(x.Z,{page:n,setPage:t,pageSize:m,setPageSize:p,totalRows:k,rowsPerPageOption:[10,25,50,100]})]}):(0,r.jsx)(z.Z,{children:(0,r.jsx)(d.Z,{children:(0,r.jsx)(_.s,{pagination:!0,page:n,pageSize:m,rowCount:k,columns:Q,rows:P,loading:C,getRowSpacing:u.ab,getRowHeight:w,paginationMode:"server",onPageSizeChange:function(e){return p(e)},onPageChange:function(e){return t(e)},components:{Toolbar:se,Pagination:x.Z},autoHeight:!0,componentsProps:{pagination:{page:n,setPage:t,pageSize:m,setPageSize:p,totalRows:k}},disableSelectionOnClick:!0,keepNonExistentRowsSelected:!0,rowsPerPageOptions:[10,25,50,100],getDetailPanelContent:D,getDetailPanelHeight:E,detailPanelExpandedRowIds:F,onDetailPanelExpandedRowIdsChange:W,onRowClick:V,initialState:{pinnedColumns:{left:[],right:["actions"]}},sx:[u.Dr,{"& .MuiDataGrid-row":{cursor:"pointer"},"& .MuiDataGrid-detailPanel":{bgcolor:"background.default"}}]})})})]})})})]})},de=t(11780),ue=function(){return(0,r.jsx)(ce,{})},me=ue;ue.acl={action:"manage",subject:de.p6.CatalogUser}},99647:function(e,n,t){var r=t(83454);!function(){var n={189:function(){!function(e,n){"use strict";if(!e.setImmediate){var t,i=1,l={},a=!1,s=e.document,o=Object.getPrototypeOf&&Object.getPrototypeOf(e);o=o&&o.setTimeout?o:e,"[object process]"==={}.toString.call(e.process)?t=function(e){r.nextTick((function(){u(e)}))}:function(){if(e.postMessage&&!e.importScripts){var n=!0,t=e.onmessage;return e.onmessage=function(){n=!1},e.postMessage("","*"),e.onmessage=t,n}}()?function(){var n="setImmediate$"+Math.random()+"$",r=function(t){t.source===e&&"string"===typeof t.data&&0===t.data.indexOf(n)&&u(+t.data.slice(n.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),t=function(t){e.postMessage(n+t,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){u(e.data)},t=function(n){e.port2.postMessage(n)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;t=function(n){var t=s.createElement("script");t.onreadystatechange=function(){u(n),t.onreadystatechange=null,e.removeChild(t),t=null},e.appendChild(t)}}():t=function(e){setTimeout(u,0,e)},o.setImmediate=function(e){"function"!==typeof e&&(e=new Function(""+e));for(var n=new Array(arguments.length-1),r=0;r<n.length;r++)n[r]=arguments[r+1];var a={callback:e,args:n};return l[i]=a,t(i),i++},o.clearImmediate=c}function c(e){delete l[e]}function d(e){var n=e.callback,t=e.args;switch(t.length){case 0:n();break;case 1:n(t[0]);break;case 2:n(t[0],t[1]);break;case 3:n(t[0],t[1],t[2]);break;default:n.apply(undefined,t)}}function u(e){if(a)setTimeout(u,0,e);else{var n=l[e];
1if(n){a=!0;try{d(n)}finally{c(e),a=!1}}}}}("undefined"===typeof self?"undefined"===typeof t.g?this:t.g:self)}};"undefined"!==typeof __nccwpck_require__&&(__nccwpck_require__.ab="//");n[189](),e.exports={}}()},602:function(e,n,t){!function(){var n={845:function(e,n,r){var i="undefined"!==typeof t.g&&t.g||"undefined"!==typeof self&&self||window,l=Function.prototype.apply;function a(e,n){this._id=e,this._clearFn=n}n.setTimeout=function(){return new a(l.call(setTimeout,i,arguments),clearTimeout)},n.setInterval=function(){return new a(l.call(setInterval,i,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},n.enroll=function(e,n){clearTimeout(e._idleTimeoutId),e._idleTimeout=n},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var n=e._idleTimeout;n>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),n))},r(505),n.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof t.g&&t.g.setImmediate||this&&this.setImmediate,n.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof t.g&&t.g.clearImmediate||this&&this.clearImmediate},505:function(e){"use strict";e.exports=t(99647)}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var l=r[e]={exports:{}},a=!0;try{n[e].call(l.exports,l,l.exports,i),a=!1}finally{a&&delete r[e]}return l.exports}i.ab="//";var l=i(845);e.exports=l}()}},function(e){e.O(0,[2876,630,4980,7536,1524,4231,5428,1718,5836,5734,3747,1717,2268,9591,2512,1090,7247,5780,1280,2020,8507,3021,1115,7384,4738,5686,5646,9714,2068,6778,1039,4503,6446,2180,7297,309,7545,9329,9721,1197,7302,9774,2888,179],(function(){return n=17955,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.