@accounter/client 0.0.11-alpha-20260126102906-e2f97aac11150a8d1bac3d3fba7a2805e5a71368 → 0.0.11-alpha-20260126121840-9987d09cc7cb596314ad01124c1061feba2117b0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/assets/{Checkbox-Dmuz3t7B.js → Checkbox-D5PsdcQv.js} +1 -1
- package/dist/assets/{MultiSelect-DBeIExB5.js → MultiSelect-C5wjF9jC.js} +1 -1
- package/dist/assets/{Progress---sZILQb.js → Progress-CUpt9lUI.js} +1 -1
- package/dist/assets/{Table-BQv3frL8.js → Table-pGQWLQ8H.js} +1 -1
- package/dist/assets/{Typography-B8Kph7eR.js → Typography-B3aRT5ej.js} +1 -1
- package/dist/assets/{accordion-Bn08_4fN.js → accordion-Bd6kAhfN.js} +1 -1
- package/dist/assets/{accountant-approvals-DuNl7y6H.js → accountant-approvals-BJGkKn8O.js} +1 -1
- package/dist/assets/{accounter-table-DTsgtq5M.js → accounter-table-CioecC_Y.js} +1 -1
- package/dist/assets/{addDays-DTiBTTns.js → addDays-DhQZBfTq.js} +1 -1
- package/dist/assets/{all-charges-DPyM-a74.js → all-charges-UjLePnh5.js} +1 -1
- package/dist/assets/{arrow-up-down-VY6mkkTR.js → arrow-up-down-YhPbp1Ud.js} +1 -1
- package/dist/assets/{building-2-CMKd_bU8.js → building-2-Df516nsd.js} +1 -1
- package/dist/assets/{business-BVMKhHFx.js → business-CryBsRqy.js} +1 -1
- package/dist/assets/{business-extended-info-B94y5ZK6.js → business-extended-info-zz1obrFs.js} +1 -1
- package/dist/assets/{business-header-BC86M-9m.js → business-header-DL-hzsQ4.js} +1 -1
- package/dist/assets/{business-ledger-filters-es3H4rPK.js → business-ledger-filters-Dh6IJIbe.js} +1 -1
- package/dist/assets/{business-ledger-single-U3zkqgW2.js → business-ledger-single-ebXw596v.js} +1 -1
- package/dist/assets/{business-trip-BUKYnQkG.js → business-trip-Bn5hm1D5.js} +1 -1
- package/dist/assets/charge-DhvD1RST.js +1 -0
- package/dist/assets/{charges-filters-CFCAP-bP.js → charges-filters-BLSfy08K.js} +1 -1
- package/dist/assets/{charges-ledger-validation-CCTNRpCE.js → charges-ledger-validation-BOn22w9P.js} +1 -1
- package/dist/assets/charges-table-Bjk5Mz--.js +7 -0
- package/dist/assets/{contracts-ljjcB_x7.js → contracts-iKKpsNnL.js} +1 -1
- package/dist/assets/{data-table-column-header-CZ1dXiU0.js → data-table-column-header--gzXkv5r.js} +1 -1
- package/dist/assets/{data-table-pagination-XAlQIbO9.js → data-table-pagination-CLXUcmJJ.js} +1 -1
- package/dist/assets/{deposits-transactions-table-2rtRFZgK.js → deposits-transactions-table-CV-YceTW.js} +1 -1
- package/dist/assets/{download-csv-button-CMQBUQeX.js → download-csv-button-DVLHjMAB.js} +1 -1
- package/dist/assets/{download-csv-BSGaUZsM.js → download-csv-weF1Lwst.js} +1 -1
- package/dist/assets/{editable-business-trip-CED1Su3d.js → editable-business-trip-DRSlJ54m.js} +1 -1
- package/dist/assets/{eye-off-Buv7eciz.js → eye-off-DWYC0Eax.js} +1 -1
- package/dist/assets/{funnel-Cfb9Pxmr.js → funnel-0IvwyZBf.js} +1 -1
- package/dist/assets/{index-CPMJQkvw.js → index-1oajNqKA.js} +1 -1
- package/dist/assets/{index-CcZll7L2.js → index-AI_GyykK.js} +1 -1
- package/dist/assets/{index-B4OP8iL7.js → index-B6VKQBtu.js} +1 -1
- package/dist/assets/{index-DIrLsKod.js → index-BA-I_zCt.js} +1 -1
- package/dist/assets/{index-DRBzHdu9.js → index-BESPuoZl.js} +1 -1
- package/dist/assets/{index-8fdLByFg.js → index-BFEE5U-A.js} +1 -1
- package/dist/assets/{index-DGAT1KYx.js → index-BINmUTjA.js} +1 -1
- package/dist/assets/{index-DokXNUuN.js → index-BoVSybOL.js} +1 -1
- package/dist/assets/{index-C7p19nIa.js → index-BrgWieYs.js} +1 -1
- package/dist/assets/{index-CSdQtH7c.js → index-Bw_9Tifu.js} +1 -1
- package/dist/assets/{index-BN-I0GSO.js → index-CAAL0SGN.js} +1 -1
- package/dist/assets/{index-Dq33WQoi.js → index-CGpiJ6wl.js} +1 -1
- package/dist/assets/{index-X9rrwleE.js → index-CHzieg87.js} +1 -1
- package/dist/assets/{index-B0hZ0TDG.js → index-CVefTdZ8.js} +1 -1
- package/dist/assets/{index-DOy0Yf1i.js → index-CYLoUT7S.js} +1 -1
- package/dist/assets/{index-Dal_ULkA.js → index-CgvjLFyG.js} +1 -1
- package/dist/assets/{index-DzzUoyj4.js → index-CkPv0ZF8.js} +1 -1
- package/dist/assets/{index-X3RoQQa9.js → index-Cm0VDoDd.js} +1 -1
- package/dist/assets/{index-rI994S3C.js → index-D1_HHRLX.js} +4 -4
- package/dist/assets/{index-BhFsGqUx.js → index-DSAS0BpU.js} +1 -1
- package/dist/assets/{index-7gCTV42h.js → index-DZFQ92ui.js} +1 -1
- package/dist/assets/{index-3ev2Q3E9.js → index-D_XfDEW8.js} +1 -1
- package/dist/assets/{index-Bui9zV-z.js → index-DaDghnaZ.js} +1 -1
- package/dist/assets/{index-DJY6AKiM.js → index-MPZl3TTq.js} +1 -1
- package/dist/assets/{index-GlUqZUgQ.js → index-ajJcMQms.js} +1 -1
- package/dist/assets/{index-CjG9JDZB.js → index-v8SIf-h9.js} +1 -1
- package/dist/assets/{index.es-C2YDJ0AL.js → index.es-Dkm1W8bL.js} +1 -1
- package/dist/assets/issue-document-yi3XXbpe.js +1 -0
- package/dist/assets/{login-page-BimTSmTC.js → login-page-B5bqhOTx.js} +1 -1
- package/dist/assets/{missing-info-charges-CVhY60ZL.js → missing-info-charges-DiIM7lBQ.js} +1 -1
- package/dist/assets/{modal-BXR_xgUm.js → modal-CNW2FGYc.js} +1 -1
- package/dist/assets/{modify-contract-dialog-flMl2p_T.js → modify-contract-dialog-BBPR_IL8.js} +1 -1
- package/dist/assets/{page-layout-DMGj5xhW.js → page-layout-BOjYoqoi.js} +1 -1
- package/dist/assets/{page-not-found-B_GB5ntj.js → page-not-found-UQZi0ekr.js} +1 -1
- package/dist/assets/{panel-top-open-Bf39HBrp.js → panel-top-open-Bxnxp1BU.js} +1 -1
- package/dist/assets/{report-commentary-row-BMyeQR9J.js → report-commentary-row-BtmSnv64.js} +1 -1
- package/dist/assets/{save-jkuyCWyY.js → save-BHNOV5fu.js} +1 -1
- package/dist/assets/{similar-transactions-modal-DX3CPrMo.js → similar-transactions-modal-BTidmv0G.js} +1 -1
- package/dist/assets/{sub-CEXBz_OW.js → sub-6-HnNA3H.js} +1 -1
- package/dist/assets/subMonths-nC9-M0qS.js +1 -0
- package/dist/assets/{summary-CPKS_69D.js → summary-C5TvRXn1.js} +1 -1
- package/dist/assets/{toggle-expansion-button-Y2eS7nqg.js → toggle-expansion-button-Dg_XsE6y.js} +1 -1
- package/dist/assets/{update-accountant-status-zL6vnwU9.js → update-accountant-status-CU6mIJqS.js} +1 -1
- package/dist/assets/{use-issue-monthly-documents-D9vQpbaZ.js → use-issue-monthly-documents-CdxtNiuP.js} +1 -1
- package/dist/assets/{use-url-query-CqWra6gD.js → use-url-query-RoURh24O.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/common/merge-charges/index.tsx +1 -1
- package/src/components/common/modals/preview-document-modal.tsx +5 -2
- package/src/gql/graphql.ts +1 -1
- package/dist/assets/charge-DuqIMfNm.js +0 -1
- package/dist/assets/charges-table-BJtpvXfL.js +0 -7
- package/dist/assets/issue-document-zNxGzRkY.js +0 -1
- package/dist/assets/subMonths-DY4HlBVa.js +0 -1
package/dist/assets/{modify-contract-dialog-flMl2p_T.js → modify-contract-dialog-BBPR_IL8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as re,bK as N,bL as S,g as K,c9 as se,r as p,t as k,i as Q,ca as ie,cb as B,bJ as G,ay as V,u as ce,cc as oe,E as le,G as de,w,j as e,D as ue,aL as me,B as C,ag as pe,a3 as U,x as he,al as xe,am as je,an as ye,V as ge,Y as o,Z as l,_ as d,$ as u,I as f,a1 as m,af as Ce,a4 as fe,ao as T,ap as O,aq as I,ar as L,as as A,at as _,aQ as De,bb as be,a2 as we,au as ke,aa as ve,cd as Ne,aw as v,ae as H,ax as Te,be as Oe,bf as Ie,ac as Le,ab as Ae,ad as J,aA as Se}from"./index-rI994S3C.js";const Pe=[["path",{d:"M5 7a2 2 0 0 0-2 2v11",key:"1yhqjt"}],["path",{d:"M5.803 18H5a2 2 0 0 0 0 4h9.5a.5.5 0 0 0 .5-.5V21",key:"edzzo5"}],["path",{d:"M9 15V4a2 2 0 0 1 2-2h9.5a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H11a2 2 0 0 1 0-4h10",key:"1nwzrg"}]],Ee=re("book-copy",Pe);function Me(c){switch(c){case N.Annual:return"Annual";case N.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${c}`)}}function Be(c){switch(c){case S.Enterprise:return"Enterprise";case S.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${c}`)}}const Ve="createContract",Fe=()=>{const[{fetching:c},h]=K(se),g=p.useCallback(async x=>{const y=`Error creating new contract for client[${x.input.clientId}]`,s=`${Ve}-${x.input.clientId}`;k.loading("Creating contract",{id:s});try{const i=await h(x);Q(i,y,s)&&k.success("Success",{id:s,description:`Contract for client ${x.input.clientId} was successfully created`})}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{creating:c,createContract:g}},$e="updateContract",ze=()=>{const[{fetching:c},h]=K(ie),g=p.useCallback(async x=>{const y=`Error updating contract ID [${x.contractId}]`,s=`${$e}-${x.contractId}`;k.loading("Updating contract",{id:s});try{const i=await h(x),D=Q(i,y,s,"updateContract");if(D)return k.success("Success",{id:s,description:"Contract updated"}),D.updateContract}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{updating:c,updateContract:g}},Re=ve({id:Se().optional(),startDate:J("Start date is required"),endDate:J("End date is required"),pos:Ae(H()),paymentAmount:Le().min(0,"Payment amount must be non-negative"),paymentCurrency:v(Object.values(V),"Currency is required"),productType:v(Object.values(G)).optional(),msCloudLink:Oe().optional().or(Ie("")),billingCycle:v(Object.values(N)).optional(),subscriptionPlan:v(Object.values(S)).optional(),isActive:Te(),defaultRemark:H().optional(),defaultDocumentType:v(Object.values(B)),operationsLimit:Ne().min(BigInt(0),"Operations limit must be non-negative")}),qe={startDate:"",endDate:"",pos:[],paymentAmount:0,paymentCurrency:V.Usd,productType:G.Hive,msCloudLink:void 0,billingCycle:N.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:B.Proforma,operationsLimit:BigInt(0)};function _e({clientId:c,contract:h,contractId:g,onDone:x,duplicate:y}){const{isEditing:s,isDuplicating:i}=p.useMemo(()=>{const t=!!h||!!g,n=y===!0&&t;return{isEditing:t&&!n,isDuplicating:n}},[h,g,y]),[D,b]=p.useState(!1),[P,X]=p.useState(!1),[r,F]=p.useState(qe),[$,z]=p.useState(""),{updateContract:R,updating:Y}=ze(),{createContract:E,creating:Z}=Fe(),[{data:M,fetching:W}]=ce({query:oe,pause:!g||!D,variables:{contractId:g??""}}),a=le({resolver:de(Re),defaultValues:r}),q=()=>{const t=$.trim();if(t){const n=a.getValues("pos");n.includes(t)||a.setValue("pos",[...n,t],{shouldDirty:!0}),z("")}},ee=t=>{const n=a.getValues("pos");a.setValue("pos",n.filter((j,ae)=>ae!==t),{shouldDirty:!0})};p.useEffect(()=>{h&&F(h)},[h]),p.useEffect(()=>{if(M?.contractsById){const t=M.contractsById,n={startDate:t.startDate,endDate:t.endDate,pos:t.purchaseOrders,paymentAmount:t.amount.raw,paymentCurrency:t.amount.currency,productType:t.product??void 0,msCloudLink:t.msCloud?.toString()??void 0,billingCycle:t.billingCycle,subscriptionPlan:t.plan??void 0,isActive:t.isActive,defaultRemark:t.remarks??void 0,defaultDocumentType:t.documentType,operationsLimit:BigInt(t.operationsLimit)};F({id:t.id,...n})}},[M]);const te=p.useMemo(()=>r?JSON.stringify(r):null,[r]);p.useEffect(()=>{r&&a.reset({startDate:r.startDate,endDate:r.endDate,pos:r.pos,paymentAmount:r.paymentAmount,paymentCurrency:r.paymentCurrency,productType:r.productType,msCloudLink:r.msCloudLink,billingCycle:r.billingCycle,subscriptionPlan:r.subscriptionPlan,isActive:r.isActive,defaultRemark:r.defaultRemark,defaultDocumentType:r.defaultDocumentType,operationsLimit:BigInt(r.operationsLimit)})},[te,a.reset]);const ne=p.useCallback(async t=>{if(i||s){if(!r?.id)return;if(i){if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit,deactivateContracts:P?[r.id]:void 0}})}else await R({contractId:r.id,input:{amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}else{if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}b(!1),x?.()},[r,x,E,R,c,a,s,i,P]);return e.jsxs(ue,{open:D,onOpenChange:b,children:[e.jsx(me,{asChild:!0,children:s?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(pe,{className:"size-5"})}):i?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(Ee,{className:"size-5"})}):e.jsxs(C,{size:"sm",onClick:()=>b(!0),children:[e.jsx(U,{className:"size-4 mr-2"}),"New Contract"]})}),e.jsxs(he,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(xe,{children:[e.jsx(je,{children:s?"Edit Contract":"Create New Contract"}),e.jsx(ye,{children:s?"Update contract details":i?"Create a new contract based on an existing one":"Add a new contract with all required details"})]}),W?e.jsx(e.Fragment,{children:"Fetching contract details..."}):e.jsx(ge,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(ne),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"operationsLimit",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Operations Limit"}),e.jsx(u,{children:e.jsx(f,{placeholder:"500",...t,value:t.value?.toLocaleString(),onChange:n=>{const j=n.target.value.replace(/[^0-9]/g,"");t.onChange(BigInt(j||0))}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"pos",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Purchase Orders"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{placeholder:"Add PO...",value:$,onChange:n=>z(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),q())}}),e.jsx(C,{type:"button",size:"sm",onClick:q,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.value?.map((n,j)=>e.jsxs(Ce,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[n,j===(t.value?.length??0)-1&&e.jsx(C,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>ee(j),children:e.jsx(fe,{className:"size-3 cursor-pointer flex-shrink-0"})})]},n))}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"startDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"Start Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"endDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"End Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(o,{control:a.control,name:"paymentAmount",render:({field:t})=>e.jsxs(l,{className:"md:col-span-2",children:[e.jsx(d,{children:"Payment Amount"}),e.jsx(u,{children:e.jsx(f,{type:"number",placeholder:"24000",...t,onChange:n=>{t.onChange(n?.target.value?Number(n?.target.value):void 0)}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"paymentCurrency",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Currency"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(V).map(n=>e.jsx(A,{value:n,children:n},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"productType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Product Type"}),e.jsx(u,{children:e.jsx(f,{placeholder:"Cloud Services",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"billingCycle",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Billing Cycle"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(N).map(n=>e.jsx(A,{value:n,children:Me(n)},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"subscriptionPlan",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Subscription Plan"}),e.jsx(u,{children:e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(S).map(n=>e.jsx(A,{value:n,children:Be(n)},n))})]})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"isActive",render:({field:t})=>e.jsxs(l,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(d,{className:"text-base",children:"Active Status"})}),e.jsx(u,{children:e.jsx(_,{checked:t.value,onCheckedChange:t.onChange})})]})})]}),e.jsx(o,{control:a.control,name:"msCloudLink",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"MS Cloud Link"}),e.jsx(u,{children:e.jsx(f,{type:"url",placeholder:"https://portal.azure.com/contract-id",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultDocumentType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Document Type"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(B).map(n=>e.jsx(A,{value:n,children:De(n)},n))})]}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultRemark",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Remark"}),e.jsx(u,{children:e.jsx(be,{placeholder:"Enter default remark for this contract...",rows:3,...t})}),e.jsx(m,{})]})}),i&&e.jsxs("div",{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(we,{className:"text-base",children:"Deactivate Original Contract"})}),e.jsx(_,{checked:P,onCheckedChange:X})]})]}),e.jsxs(ke,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(C,{type:"submit",disabled:Z||Y,children:s?"Update Contract":"Create Contract"})]})]})})]})]})}export{_e as M,Be as a,Me as s};
|
|
1
|
+
import{v as re,bK as N,bL as S,g as K,c9 as se,r as p,t as k,i as Q,ca as ie,cb as B,bJ as G,ay as V,u as ce,cc as oe,E as le,G as de,w,j as e,D as ue,aL as me,B as C,ag as pe,a3 as U,x as he,al as xe,am as je,an as ye,V as ge,Y as o,Z as l,_ as d,$ as u,I as f,a1 as m,af as Ce,a4 as fe,ao as T,ap as O,aq as I,ar as L,as as A,at as _,aQ as De,bb as be,a2 as we,au as ke,aa as ve,cd as Ne,aw as v,ae as H,ax as Te,be as Oe,bf as Ie,ac as Le,ab as Ae,ad as J,aA as Se}from"./index-D1_HHRLX.js";const Pe=[["path",{d:"M5 7a2 2 0 0 0-2 2v11",key:"1yhqjt"}],["path",{d:"M5.803 18H5a2 2 0 0 0 0 4h9.5a.5.5 0 0 0 .5-.5V21",key:"edzzo5"}],["path",{d:"M9 15V4a2 2 0 0 1 2-2h9.5a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H11a2 2 0 0 1 0-4h10",key:"1nwzrg"}]],Ee=re("book-copy",Pe);function Me(c){switch(c){case N.Annual:return"Annual";case N.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${c}`)}}function Be(c){switch(c){case S.Enterprise:return"Enterprise";case S.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${c}`)}}const Ve="createContract",Fe=()=>{const[{fetching:c},h]=K(se),g=p.useCallback(async x=>{const y=`Error creating new contract for client[${x.input.clientId}]`,s=`${Ve}-${x.input.clientId}`;k.loading("Creating contract",{id:s});try{const i=await h(x);Q(i,y,s)&&k.success("Success",{id:s,description:`Contract for client ${x.input.clientId} was successfully created`})}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{creating:c,createContract:g}},$e="updateContract",ze=()=>{const[{fetching:c},h]=K(ie),g=p.useCallback(async x=>{const y=`Error updating contract ID [${x.contractId}]`,s=`${$e}-${x.contractId}`;k.loading("Updating contract",{id:s});try{const i=await h(x),D=Q(i,y,s,"updateContract");if(D)return k.success("Success",{id:s,description:"Contract updated"}),D.updateContract}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{updating:c,updateContract:g}},Re=ve({id:Se().optional(),startDate:J("Start date is required"),endDate:J("End date is required"),pos:Ae(H()),paymentAmount:Le().min(0,"Payment amount must be non-negative"),paymentCurrency:v(Object.values(V),"Currency is required"),productType:v(Object.values(G)).optional(),msCloudLink:Oe().optional().or(Ie("")),billingCycle:v(Object.values(N)).optional(),subscriptionPlan:v(Object.values(S)).optional(),isActive:Te(),defaultRemark:H().optional(),defaultDocumentType:v(Object.values(B)),operationsLimit:Ne().min(BigInt(0),"Operations limit must be non-negative")}),qe={startDate:"",endDate:"",pos:[],paymentAmount:0,paymentCurrency:V.Usd,productType:G.Hive,msCloudLink:void 0,billingCycle:N.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:B.Proforma,operationsLimit:BigInt(0)};function _e({clientId:c,contract:h,contractId:g,onDone:x,duplicate:y}){const{isEditing:s,isDuplicating:i}=p.useMemo(()=>{const t=!!h||!!g,n=y===!0&&t;return{isEditing:t&&!n,isDuplicating:n}},[h,g,y]),[D,b]=p.useState(!1),[P,X]=p.useState(!1),[r,F]=p.useState(qe),[$,z]=p.useState(""),{updateContract:R,updating:Y}=ze(),{createContract:E,creating:Z}=Fe(),[{data:M,fetching:W}]=ce({query:oe,pause:!g||!D,variables:{contractId:g??""}}),a=le({resolver:de(Re),defaultValues:r}),q=()=>{const t=$.trim();if(t){const n=a.getValues("pos");n.includes(t)||a.setValue("pos",[...n,t],{shouldDirty:!0}),z("")}},ee=t=>{const n=a.getValues("pos");a.setValue("pos",n.filter((j,ae)=>ae!==t),{shouldDirty:!0})};p.useEffect(()=>{h&&F(h)},[h]),p.useEffect(()=>{if(M?.contractsById){const t=M.contractsById,n={startDate:t.startDate,endDate:t.endDate,pos:t.purchaseOrders,paymentAmount:t.amount.raw,paymentCurrency:t.amount.currency,productType:t.product??void 0,msCloudLink:t.msCloud?.toString()??void 0,billingCycle:t.billingCycle,subscriptionPlan:t.plan??void 0,isActive:t.isActive,defaultRemark:t.remarks??void 0,defaultDocumentType:t.documentType,operationsLimit:BigInt(t.operationsLimit)};F({id:t.id,...n})}},[M]);const te=p.useMemo(()=>r?JSON.stringify(r):null,[r]);p.useEffect(()=>{r&&a.reset({startDate:r.startDate,endDate:r.endDate,pos:r.pos,paymentAmount:r.paymentAmount,paymentCurrency:r.paymentCurrency,productType:r.productType,msCloudLink:r.msCloudLink,billingCycle:r.billingCycle,subscriptionPlan:r.subscriptionPlan,isActive:r.isActive,defaultRemark:r.defaultRemark,defaultDocumentType:r.defaultDocumentType,operationsLimit:BigInt(r.operationsLimit)})},[te,a.reset]);const ne=p.useCallback(async t=>{if(i||s){if(!r?.id)return;if(i){if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit,deactivateContracts:P?[r.id]:void 0}})}else await R({contractId:r.id,input:{amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}else{if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}b(!1),x?.()},[r,x,E,R,c,a,s,i,P]);return e.jsxs(ue,{open:D,onOpenChange:b,children:[e.jsx(me,{asChild:!0,children:s?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(pe,{className:"size-5"})}):i?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(Ee,{className:"size-5"})}):e.jsxs(C,{size:"sm",onClick:()=>b(!0),children:[e.jsx(U,{className:"size-4 mr-2"}),"New Contract"]})}),e.jsxs(he,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(xe,{children:[e.jsx(je,{children:s?"Edit Contract":"Create New Contract"}),e.jsx(ye,{children:s?"Update contract details":i?"Create a new contract based on an existing one":"Add a new contract with all required details"})]}),W?e.jsx(e.Fragment,{children:"Fetching contract details..."}):e.jsx(ge,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(ne),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"operationsLimit",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Operations Limit"}),e.jsx(u,{children:e.jsx(f,{placeholder:"500",...t,value:t.value?.toLocaleString(),onChange:n=>{const j=n.target.value.replace(/[^0-9]/g,"");t.onChange(BigInt(j||0))}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"pos",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Purchase Orders"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{placeholder:"Add PO...",value:$,onChange:n=>z(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),q())}}),e.jsx(C,{type:"button",size:"sm",onClick:q,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.value?.map((n,j)=>e.jsxs(Ce,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[n,j===(t.value?.length??0)-1&&e.jsx(C,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>ee(j),children:e.jsx(fe,{className:"size-3 cursor-pointer flex-shrink-0"})})]},n))}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"startDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"Start Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"endDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"End Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(o,{control:a.control,name:"paymentAmount",render:({field:t})=>e.jsxs(l,{className:"md:col-span-2",children:[e.jsx(d,{children:"Payment Amount"}),e.jsx(u,{children:e.jsx(f,{type:"number",placeholder:"24000",...t,onChange:n=>{t.onChange(n?.target.value?Number(n?.target.value):void 0)}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"paymentCurrency",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Currency"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(V).map(n=>e.jsx(A,{value:n,children:n},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"productType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Product Type"}),e.jsx(u,{children:e.jsx(f,{placeholder:"Cloud Services",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"billingCycle",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Billing Cycle"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(N).map(n=>e.jsx(A,{value:n,children:Me(n)},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"subscriptionPlan",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Subscription Plan"}),e.jsx(u,{children:e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(S).map(n=>e.jsx(A,{value:n,children:Be(n)},n))})]})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"isActive",render:({field:t})=>e.jsxs(l,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(d,{className:"text-base",children:"Active Status"})}),e.jsx(u,{children:e.jsx(_,{checked:t.value,onCheckedChange:t.onChange})})]})})]}),e.jsx(o,{control:a.control,name:"msCloudLink",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"MS Cloud Link"}),e.jsx(u,{children:e.jsx(f,{type:"url",placeholder:"https://portal.azure.com/contract-id",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultDocumentType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Document Type"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(O,{children:e.jsx(I,{})})}),e.jsx(L,{children:Object.values(B).map(n=>e.jsx(A,{value:n,children:De(n)},n))})]}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultRemark",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Remark"}),e.jsx(u,{children:e.jsx(be,{placeholder:"Enter default remark for this contract...",rows:3,...t})}),e.jsx(m,{})]})}),i&&e.jsxs("div",{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(we,{className:"text-base",children:"Deactivate Original Contract"})}),e.jsx(_,{checked:P,onCheckedChange:X})]})]}),e.jsxs(ke,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(C,{type:"submit",disabled:Z||Y,children:s?"Update Contract":"Create Contract"})]})]})})]})]})}export{_e as M,Be as a,Me as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,X as x}from"./index-
|
|
1
|
+
import{j as e,X as x}from"./index-D1_HHRLX.js";function r({children:t,title:a,description:s,headerActions:l}){return e.jsxs("div",{className:"flex flex-col gap-5",id:"main-page",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"w-full text-2xl font-bold tracking-tight md:text-3xl",children:a}),s&&e.jsx("p",{className:"mt-2 text-gray-500",children:s})]}),l]}),e.jsx(x,{}),t]})}export{r as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,J as a,K as e,O as r,W as d}from"./index-
|
|
1
|
+
import{j as s,J as a,K as e,O as r,W as d}from"./index-D1_HHRLX.js";const o=()=>s.jsxs(a,{className:"m-5",children:[s.jsx(e,{children:s.jsx(r,{children:"404"})}),s.jsx(d,{children:s.jsx("p",{children:"Page not found"})})]});export{o as PageNotFound};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as e}from"./index-
|
|
1
|
+
import{v as e}from"./index-D1_HHRLX.js";const t=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]],a=e("panel-top-close",t);const o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]],c=e("panel-top-open",o);export{a as P,c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,a6 as c,gc as m,j as t,gd as j}from"./index-
|
|
1
|
+
import{r as i,a6 as c,gc as m,j as t,gd as j}from"./index-D1_HHRLX.js";import{T as h}from"./toggle-expansion-button-Dg_XsE6y.js";import{T as x}from"./Table-pGQWLQ8H.js";const p=({subCommentaryData:o,dataRow:a})=>{const[s,l]=i.useState(!1),r=o.map(e=>c(m,e)),d=t.jsx(h,{toggleExpansion:l,isExpanded:s});return t.jsxs(t.Fragment,{children:[a(d),s&&t.jsx("tr",{children:t.jsx("td",{colSpan:99,children:t.jsxs(x,{striped:!0,highlightOnHover:!0,className:"ml-8 w-full h-full",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Entity"}),t.jsx("th",{children:"Amount"})]})}),t.jsxs("tbody",{children:[r?.sort((e,n)=>e.financialEntity.name.localeCompare(n.financialEntity.name)).map(e=>t.jsxs("tr",{children:[t.jsx("td",{children:e.financialEntity.name}),t.jsx("td",{children:e.amount.formatted})]},e.financialEntity.id)),t.jsx("tr",{children:t.jsx("td",{colSpan:8})})]})]})})})]})},f=({commentaryData:o,dataRow:a})=>{const[s,l]=i.useState(!1),{records:r}=c(j,o),d=r.length?t.jsx(h,{toggleExpansion:l,isExpanded:s}):null;return t.jsxs(t.Fragment,{children:[a(d),s&&t.jsx("tr",{children:t.jsx("td",{colSpan:99,children:t.jsxs(x,{striped:!0,highlightOnHover:!0,className:"ml-8 w-full h-full",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Sort Code"}),t.jsx("th",{children:"Amount"}),t.jsx("th",{})]})}),t.jsxs("tbody",{children:[r?.sort((e,n)=>e.sortCode.key-n.sortCode.key).map(e=>t.jsx(p,{dataRow:n=>t.jsxs("tr",{children:[t.jsxs("td",{children:[e.sortCode.key," - ",e.sortCode.name]}),t.jsx("td",{children:e.amount.formatted}),t.jsx("td",{children:n})]},e.sortCode.key),subCommentaryData:e.records},e.sortCode.key)),t.jsx("tr",{children:t.jsx("td",{colSpan:8})})]})]})})})]})};export{f as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as a}from"./index-
|
|
1
|
+
import{v as a}from"./index-D1_HHRLX.js";const e=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],o=a("save",e);export{o as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as j,g as C,h2 as b,r as g,t as p,i as S,j as a,ai as m,h3 as k,h4 as v,u as A,h5 as I,D as M,x as R,y as N,c as B,aF as f,bY as $,c5 as E,c6 as F,al as V,am as U,B as K,J as _,bO as H,bP as L,bQ as T,bR as P,c2 as y,bS as O,bT as Q,p as w,w as D}from"./index-
|
|
1
|
+
import{v as j,g as C,h2 as b,r as g,t as p,i as S,j as a,ai as m,h3 as k,h4 as v,u as A,h5 as I,D as M,x as R,y as N,c as B,aF as f,bY as $,c5 as E,c6 as F,al as V,am as U,B as K,J as _,bO as H,bP as L,bQ as T,bR as P,c2 as y,bS as O,bT as Q,p as w,w as D}from"./index-D1_HHRLX.js";import{B as x}from"./building-2-Df516nsd.js";const W=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]],q=j("badge-question-mark",W);const J=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],Y=j("bitcoin",J),Z="updateTransaction",ne=()=>{const[{fetching:e},s]=C(b),n=g.useCallback(async i=>{const d=`Error updating transaction ID [${i.transactionId}]`,c=`${Z}-${i.transactionId}`;p.loading("Updating Transaction",{id:c});try{const l=await s(i),o=S(l,d,c,"updateTransaction");if(o)return p.success("Success",{id:c,description:"Transaction updated"}),o.updateTransaction}catch(l){console.error(`${d}: ${l}`),p.error("Error",{id:c,description:d,duration:1e5,closeButton:!0})}},[s]);return{fetching:e,updateTransaction:n}},ce=e=>{switch(e){case m.BankAccount:return a.jsx(x,{className:"h-5 w-5"});case m.CreditCard:return a.jsx(k,{className:"h-5 w-5"});case m.CryptoWallet:return a.jsx(Y,{className:"h-5 w-5"});case m.BankDepositAccount:return a.jsx(x,{className:"h-5 w-5"});case m.ForeignSecurities:return a.jsx(x,{className:"h-5 w-5"});default:return a.jsx(q,{className:"h-5 w-5"})}},z=e=>{switch(e){case m.BankAccount:return"Bank Account";case m.CreditCard:return"Credit Card";case m.CryptoWallet:return"Crypto Wallet";case m.BankDepositAccount:return"Bank Deposit Account";case m.ForeignSecurities:return"Foreign Securities";default:return"Unknown Account Type"}},G="updateTransactions",X=()=>{const[{fetching:e},s]=C(v),n=g.useCallback(async i=>{const d=Array.isArray(i.transactionIds)?i.transactionIds.join(", "):i.transactionIds,c=`Error updating transactions ID [${d}]`,l=`${G}-${d}`;p.loading("Updating Transactions",{id:l});try{const o=await s(i),u=S(o,c,l,"updateTransactions");if(u)return p.success("Success",{id:l,description:"Transactions updated"}),u.updateTransactions.transactions.map(h=>h.id)}catch(o){console.error(`${c}: ${o}`),p.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[s]);return{fetching:e,updateTransactions:n}},ee=[{id:"select",header:({table:e})=>a.jsx(w,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:s=>e.toggleAllPageRowsSelected(!!s),"aria-label":"Select all"}),cell:({row:e})=>a.jsx(w,{checked:e.getIsSelected(),onCheckedChange:s=>e.toggleSelected(!!s),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1},{accessorKey:"accountType",header:"Type",cell:({row:e})=>a.jsx("div",{children:e.getValue("accountType")})},{accessorKey:"accountName",header:"Account",cell:({row:e})=>a.jsx("div",{children:e.getValue("accountName")})},{accessorKey:"amountRaw",header:"Amount",cell:({row:e})=>a.jsx("div",{children:e.original.amountFormatted})},{accessorKey:"sourceDescription",header:"Description",cell:({row:e})=>a.jsx("div",{children:e.getValue("sourceDescription")})},{accessorKey:"eventDate",header:"Event Date",cell:({row:e})=>a.jsx("div",{children:D(e.getValue("eventDate"),"yyyy-MM-dd")})},{accessorKey:"valueDate",header:"Value Date",cell:({row:e})=>a.jsx("div",{children:e.getValue("valueDate")?D(e.getValue("valueDate"),"yyyy-MM-dd"):""})}];function oe({transactionId:e,counterpartyId:s,open:n,onOpenChange:i,onClose:d}){const[{data:c,fetching:l},o]=A({pause:!0,query:I,variables:{transactionId:e,withMissingInfo:!0}});g.useEffect(()=>{n&&s&&o()},[n,s,o,e]);const u=g.useCallback(r=>{i(r),n&&!r&&d?.()},[i,d,n]),h=g.useMemo(()=>{const r=c?.similarTransactions.map(t=>({id:t.id,amountRaw:t.amount.raw,amountFormatted:t.amount.formatted,sourceDescription:t.sourceDescription,eventDate:new Date(t.eventDate),valueDate:t.effectiveDate?new Date(t.effectiveDate):void 0,accountType:z(t.account.type),accountName:t.account.name}))??[];return c&&r.length===0&&u(!1),r},[c,u]);return a.jsx(M,{open:n&&!!s&&h.length>0,onOpenChange:u,children:a.jsx(R,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",children:a.jsx(N,{fallback:a.jsx("div",{children:"Error fetching similar transactions"}),children:l?a.jsx(B,{}):s?a.jsx(ae,{data:h,counterpartyId:s,onOpenChange:u}):null})})})}function ae({data:e,counterpartyId:s,onOpenChange:n}){const[i,d]=f.useState([]),[c,l]=f.useState({}),o=$({data:e,columns:ee,onSortingChange:d,getCoreRowModel:F(),getSortedRowModel:E(),onRowSelectionChange:l,state:{sorting:i,rowSelection:c}}),{updateTransactions:u}=X(),h=g.useCallback(async()=>{const r=o.getSelectedRowModel().rows.map(t=>t.original.id);await u({transactionIds:r,fields:{counterpartyId:s}}),n(!1)},[u,n,o,s]);return g.useEffect(()=>{e.length===0&&n(!1)},[e.length,n]),e.length?a.jsxs(a.Fragment,{children:[a.jsxs(V,{className:"flex flex-row items-center justify-between",children:[a.jsx(U,{children:"Transactions"}),a.jsx(K,{onClick:h,children:"Approve selected"})]}),a.jsx(_,{children:a.jsxs(H,{children:[a.jsx(L,{children:o.getHeaderGroups().map(r=>a.jsx(T,{children:r.headers.map(t=>a.jsx(P,{children:t.isPlaceholder?null:y(t.column.columnDef.header,t.getContext())},t.id))},r.id))}),a.jsx(O,{children:o.getRowModel().rows.map(r=>a.jsx(T,{"data-state":r.getIsSelected()&&"selected",children:r.getVisibleCells().map(t=>a.jsx(Q,{children:y(t.column.columnDef.cell,t.getContext())},t.id))},r.id))})]})})]}):null}export{oe as S,z as a,ce as g,ne as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gH as f}from"./index-
|
|
1
|
+
import{gH as f}from"./index-D1_HHRLX.js";import{a as y}from"./addDays-DhQZBfTq.js";import{s as S}from"./subMonths-nC9-M0qS.js";function T(s,t,o){return y(s,-t,o)}function g(s,t,o){const{years:n=0,months:u=0,weeks:r=0,days:c=0,hours:m=0,minutes:a=0,seconds:e=0}=t,i=S(s,u+n*12,o),b=T(i,c+r*7,o),h=a+m*60,d=(e+h*60)*1e3;return f(s,+b-d)}export{g as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{gO as n}from"./index-D1_HHRLX.js";function a(o,s,t){return n(o,-s,t)}export{a as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f$ as Tr,g0 as Rr,g1 as Lr,r as g,by as C,ev as T,eu as $,bz as P,aF as _,fu as kr,ew as ie,bA as R,dw as Be,eS as le,g2 as Fe,g3 as zr,fY as pe,d8 as ce,ey as Ar,bv as S,eT as Br,eA as Fr,ep as Hr,j as l,a6 as de,g4 as Vr,g as Xr,g5 as Gr,t as se,i as Ur,bX as Wr,g6 as Kr,f2 as Yr,R as qr,w as me,g7 as Zr,g8 as Jr,dp as F,ay as H}from"./index-rI994S3C.js";import{U as Qr}from"./update-accountant-status-zL6vnwU9.js";import{T as et}from"./Table-BQv3frL8.js";function rt(e,r,t){const[n,o]=Tr(t?.in,e,r),i=ge(n,o),a=Math.abs(Rr(n,o));n.setDate(n.getDate()-i*a);const s=+(ge(n,o)===-i),c=i*(a-s);return c===0?0:c}function ge(e,r){const t=e.getFullYear()-r.getFullYear()||e.getMonth()-r.getMonth()||e.getDate()-r.getDate()||e.getHours()-r.getHours()||e.getMinutes()-r.getMinutes()||e.getSeconds()-r.getSeconds()||e.getMilliseconds()-r.getMilliseconds();return t<0?-1:t>0?1:t}function ve(e,r,t){const n=Lr(e,t?.in);return n.setHours(r),n}function G(e,r){let t=e;for(;(t=t.parentElement)&&!t.matches(r););return t}function tt(e,r,t){for(let n=e-1;n>=0;n-=1)if(!r[n].disabled)return n;if(t){for(let n=r.length-1;n>-1;n-=1)if(!r[n].disabled)return n}return e}function nt(e,r,t){for(let n=e+1;n<r.length;n+=1)if(!r[n].disabled)return n;if(t){for(let n=0;n<r.length;n+=1)if(!r[n].disabled)return n}return e}function ot(e,r,t){return G(e,t)===G(r,t)}function at({parentSelector:e,siblingSelector:r,onKeyDown:t,loop:n=!0,activateOnFocus:o=!1,dir:i="rtl",orientation:a}){return s=>{var c;t?.(s);const f=Array.from(((c=G(s.currentTarget,e))==null?void 0:c.querySelectorAll(r))||[]).filter(v=>ot(s.currentTarget,v,e)),d=f.findIndex(v=>s.currentTarget===v),u=nt(d,f,n),m=tt(d,f,n);switch(s.key){case"ArrowRight":break;case"ArrowLeft":break;case"ArrowUp":{s.stopPropagation(),s.preventDefault(),f[m].focus(),o&&f[m].click();break}case"ArrowDown":{s.stopPropagation(),s.preventDefault(),f[u].focus(),o&&f[u].click();break}case"Home":{s.stopPropagation(),s.preventDefault(),!f[0].disabled&&f[0].focus();break}case"End":{s.stopPropagation(),s.preventDefault();const v=f.length-1;!f[v].disabled&&f[v].focus();break}}}}function st(e,r,t){var n;return t?Array.from(((n=G(t,r))==null?void 0:n.querySelectorAll(e))||[]).findIndex(o=>o===t):null}function N(e,r){return t=>{e?.(t),r?.(t)}}function it(){const[e,r]=g.useState(-1);return[e,{setHovered:r,resetHovered:()=>r(-1)}]}const lt={xs:$(12),sm:$(18),md:$(24),lg:$(34),xl:$(42)};var ct=C((e,{color:r,transitionDuration:t},{size:n})=>{const o=T({size:n,sizes:lt}),i=r||(e.colorScheme==="dark"?e.white:e.black);return{root:{borderRadius:e.radius.sm,width:`calc(${o} + ${e.spacing.xs})`,height:`calc(${o} + ${e.spacing.xs})`,padding:`calc(${e.spacing.xs} / 2)`,cursor:"pointer"},burger:{position:"relative",userSelect:"none",boxSizing:"border-box","&, &::before, &::after":{display:"block",width:o,height:`calc(${o} / 12)`,backgroundColor:i,outline:`${$(1)} solid transparent`,transitionProperty:"background-color, transform",transitionDuration:`${t}ms`,"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?"0ms":void 0}},"&::before, &::after":{position:"absolute",content:'""',left:0},"&::before":{top:`calc((${o} / 3) * -1)`},"&::after":{top:`calc(${o} / 3)`},"&[data-opened]":{backgroundColor:"transparent","&::before":{transform:`translateY(calc(${o} / 3)) rotate(45deg)`},"&::after":{transform:`translateY(calc(-${o} / 3)) rotate(-45deg)`}}}}}),dt=Object.defineProperty,U=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,_e=(e,r,t)=>r in e?dt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ft=(e,r)=>{for(var t in r||(r={}))He.call(r,t)&&_e(e,t,r[t]);if(U)for(var t of U(r))Ve.call(r,t)&&_e(e,t,r[t]);return e},ut=(e,r)=>{var t={};for(var n in e)He.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&U)for(var n of U(e))r.indexOf(n)<0&&Ve.call(e,n)&&(t[n]=e[n]);return t};const pt={size:"md",transitionDuration:300},Xe=g.forwardRef((e,r)=>{const t=P("Burger",pt,e),{className:n,opened:o,color:i,size:a,classNames:s,styles:c,transitionDuration:f,variant:d}=t,u=ut(t,["className","opened","color","size","classNames","styles","transitionDuration","variant"]),{classes:m,cx:v}=ct({color:i,transitionDuration:f},{classNames:s,styles:c,name:"Burger",variant:d,size:a});return _.createElement(kr,ft({className:v(m.root,n),ref:r},u),_.createElement("div",{"data-opened":o||void 0,className:m.burger}))});Xe.displayName="@mantine/core/Burger";const Ge=g.createContext({padding:0}),mt=Ge.Provider,gt=()=>g.useContext(Ge).padding;var vt=C((e,{padding:r,withBorder:t,inheritPadding:n})=>{const o=T({size:r,sizes:e.spacing}),i=`calc(-1 * ${o})`,a=e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3];return{cardSection:{display:"block",marginLeft:i,marginRight:i,paddingLeft:n?o:void 0,paddingRight:n?o:void 0,borderTop:t?`${$(1)} solid ${a}`:void 0,borderBottom:t?`${$(1)} solid ${a}`:void 0,"& + &":{borderTop:0},"&[data-first]":{marginTop:i,borderTop:0,borderBottom:t?`${$(1)} solid ${a}`:void 0},"&[data-last]":{marginBottom:i,borderBottom:0}}}}),_t=Object.defineProperty,W=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,ye=(e,r,t)=>r in e?_t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,yt=(e,r)=>{for(var t in r||(r={}))Ue.call(r,t)&&ye(e,t,r[t]);if(W)for(var t of W(r))We.call(r,t)&&ye(e,t,r[t]);return e},ht=(e,r)=>{var t={};for(var n in e)Ue.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&W)for(var n of W(e))r.indexOf(n)<0&&We.call(e,n)&&(t[n]=e[n]);return t};const xt={withBorder:!1,inheritPadding:!1},Ke=g.forwardRef((e,r)=>{const t=P("CardSection",xt,e),{className:n,withBorder:o,inheritPadding:i,unstyled:a,variant:s}=t,c=ht(t,["className","withBorder","inheritPadding","unstyled","variant"]),{classes:f,cx:d}=vt({padding:gt(),withBorder:o,inheritPadding:i},{name:"Card",unstyled:a,variant:s});return _.createElement(R,yt({className:d(f.cardSection,n),ref:r},c))});Ke.displayName="@mantine/core/CardSection";const Ye=ie(Ke);var wt=C(e=>({root:{position:"relative",overflow:"hidden",backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white}})),Ot=Object.defineProperty,K=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,he=(e,r,t)=>r in e?Ot(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,$t=(e,r)=>{for(var t in r||(r={}))qe.call(r,t)&&he(e,t,r[t]);if(K)for(var t of K(r))Ze.call(r,t)&&he(e,t,r[t]);return e},Pt=(e,r)=>{var t={};for(var n in e)qe.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&K)for(var n of K(e))r.indexOf(n)<0&&Ze.call(e,n)&&(t[n]=e[n]);return t};const bt={padding:"md"},fe=g.forwardRef((e,r)=>{const t=P("Card",bt,e),{className:n,padding:o,radius:i,children:a,unstyled:s,variant:c}=t,f=Pt(t,["className","padding","radius","children","unstyled","variant"]),{classes:d,cx:u}=wt(null,{name:"Card",unstyled:s,variant:c}),m=g.Children.toArray(a),v=m.map((p,y)=>typeof p=="object"&&p&&"type"in p&&p.type===Ye?g.cloneElement(p,{variant:c,padding:o,"data-first":y===0||void 0,"data-last":y===m.length-1||void 0}):p);return _.createElement(mt,{value:{padding:o}},_.createElement(Be,$t({className:u(d.root,n),radius:i,p:o,ref:r},f),v))});fe.Section=Ye;fe.displayName="@mantine/core/Card";const mo=ie(fe),[St,jt]=le("Grid component was not found in tree");var Et=Object.defineProperty,xe=Object.getOwnPropertySymbols,It=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,we=(e,r,t)=>r in e?Et(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Nt=(e,r)=>{for(var t in r||(r={}))It.call(r,t)&&we(e,t,r[t]);if(xe)for(var t of xe(r))Ct.call(r,t)&&we(e,t,r[t]);return e};const ue=(e,r)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(r/e)}%`:void 0,Je=(e,r,t)=>t||e==="auto"||e==="content"?"unset":ue(e,r),Qe=(e,r)=>{if(e)return e==="auto"||r?1:0},er=(e,r)=>e===0?0:e?`${100/(r/e)}%`:void 0,rr=(e,r)=>typeof e<"u"?`calc(${T({size:e,sizes:r.spacing})} / 2)`:void 0;function Mt({sizes:e,offsets:r,orders:t,theme:n,columns:o,gutters:i,grow:a}){return Fe.reduce((s,c)=>(s[`@media (min-width: ${zr(n.breakpoints[c])})`]={order:t[c],flexBasis:ue(e[c],o),padding:rr(i[c],n),flexShrink:0,width:e[c]==="content"?"auto":void 0,maxWidth:Je(e[c],o,a),marginLeft:er(r[c],o),flexGrow:Qe(e[c],a)},s),{})}var Dt=C((e,{gutter:r,gutterXs:t,gutterSm:n,gutterMd:o,gutterLg:i,gutterXl:a,grow:s,offset:c,offsetXs:f,offsetSm:d,offsetMd:u,offsetLg:m,offsetXl:v,columns:p,span:y,xs:h,sm:x,md:w,lg:j,xl:D,order:L,orderXs:k,orderSm:z,orderMd:A,orderLg:E,orderXl:O})=>({col:Nt({boxSizing:"border-box",flexGrow:Qe(y,s),order:L,padding:rr(r,e),marginLeft:er(c,p),flexBasis:ue(y,p),flexShrink:0,width:y==="content"?"auto":void 0,maxWidth:Je(y,p,s)},Mt({sizes:{xs:h,sm:x,md:w,lg:j,xl:D},offsets:{xs:f,sm:d,md:u,lg:m,xl:v},orders:{xs:k,sm:z,md:A,lg:E,xl:O},gutters:{xs:t,sm:n,md:o,lg:i,xl:a},theme:e,columns:p,grow:s}))})),Tt=Object.defineProperty,Y=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,Oe=(e,r,t)=>r in e?Tt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Rt=(e,r)=>{for(var t in r||(r={}))tr.call(r,t)&&Oe(e,t,r[t]);if(Y)for(var t of Y(r))nr.call(r,t)&&Oe(e,t,r[t]);return e},Lt=(e,r)=>{var t={};for(var n in e)tr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Y)for(var n of Y(e))r.indexOf(n)<0&&nr.call(e,n)&&(t[n]=e[n]);return t};const kt={};function zt(e){return e==="auto"||e==="content"?!0:typeof e=="number"&&e>0&&e%1===0}const or=g.forwardRef((e,r)=>{const t=P("GridCol",kt,e),{children:n,span:o,offset:i,offsetXs:a,offsetSm:s,offsetMd:c,offsetLg:f,offsetXl:d,xs:u,sm:m,md:v,lg:p,xl:y,order:h,orderXs:x,orderSm:w,orderMd:j,orderLg:D,orderXl:L,className:k,unstyled:z,variant:A}=t,E=Lt(t,["children","span","offset","offsetXs","offsetSm","offsetMd","offsetLg","offsetXl","xs","sm","md","lg","xl","order","orderXs","orderSm","orderMd","orderLg","orderXl","className","unstyled","variant"]),O=jt(),M=o||O.columns,{classes:B,cx:X}=Dt({gutter:O.gutter,gutterXs:O.gutterXs,gutterSm:O.gutterSm,gutterMd:O.gutterMd,gutterLg:O.gutterLg,gutterXl:O.gutterXl,offset:i,offsetXs:a,offsetSm:s,offsetMd:c,offsetLg:f,offsetXl:d,xs:u,sm:m,md:v,lg:p,xl:y,order:h,orderXs:x,orderSm:w,orderMd:j,orderLg:D,orderXl:L,grow:O.grow,columns:O.columns,span:M},{unstyled:z,name:"Grid",variant:A});return!zt(M)||M>O.columns?null:_.createElement(R,Rt({className:X(B.col,k),ref:r},E),n)});or.displayName="@mantine/core/Col";var At=Object.defineProperty,$e=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Pe=(e,r,t)=>r in e?At(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Ht=(e,r)=>{for(var t in r||(r={}))Bt.call(r,t)&&Pe(e,t,r[t]);if($e)for(var t of $e(r))Ft.call(r,t)&&Pe(e,t,r[t]);return e};function Vt(e,r){return Fe.reduce((t,n)=>(typeof e[n]<"u"&&(t[`@media (min-width: ${r.breakpoints[n]})`]={margin:`calc(-${T({size:e[n],sizes:r.spacing})} / 2)`}),t),{})}var Xt=C((e,{justify:r,align:t,gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c})=>({root:Ht({margin:`calc(-${T({size:n,sizes:e.spacing})} / 2)`,display:"flex",flexWrap:"wrap",justifyContent:r,alignItems:t},Vt({xs:o,sm:i,md:a,lg:s,xl:c},e))})),Gt=Object.defineProperty,q=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,be=(e,r,t)=>r in e?Gt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Ut=(e,r)=>{for(var t in r||(r={}))ar.call(r,t)&&be(e,t,r[t]);if(q)for(var t of q(r))sr.call(r,t)&&be(e,t,r[t]);return e},Wt=(e,r)=>{var t={};for(var n in e)ar.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&q)for(var n of q(e))r.indexOf(n)<0&&sr.call(e,n)&&(t[n]=e[n]);return t};const Kt={gutter:"md",justify:"flex-start",align:"stretch",columns:12},b=g.forwardRef((e,r)=>{const t=P("Grid",Kt,e),{gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c,children:f,grow:d,justify:u,align:m,columns:v,className:p,unstyled:y,variant:h}=t,x=Wt(t,["gutter","gutterXs","gutterSm","gutterMd","gutterLg","gutterXl","children","grow","justify","align","columns","className","unstyled","variant"]),{classes:w,cx:j}=Xt({gutter:n,justify:u,align:m,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c},{unstyled:y,name:"Grid",variant:h});return _.createElement(St,{value:{gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c,grow:d,columns:v}},_.createElement(R,Ut({className:j(w.root,p),ref:r},x),f))});b.Col=or;b.displayName="@mantine/core/Grid";function Yt({open:e,close:r,openDelay:t,closeDelay:n}){const o=g.useRef(-1),i=g.useRef(-1),a=()=>{window.clearTimeout(o.current),window.clearTimeout(i.current)},s=()=>{a(),t===0?e():o.current=window.setTimeout(e,t)},c=()=>{a(),n===0?r():i.current=window.setTimeout(r,n)};return g.useEffect(()=>a,[]),{openDropdown:s,closeDropdown:c}}const[qt,Zt]=le("List component was not found in tree");var Jt=C((e,{spacing:r,center:t})=>({itemWrapper:{ref:pe("itemWrapper"),display:"inline-flex",flexDirection:"column",whiteSpace:"normal"},item:{whiteSpace:"nowrap",lineHeight:t?1:e.lineHeight,"&:not(:first-of-type)":{marginTop:T({size:r,sizes:e.spacing})},"&[data-with-icon]":{listStyle:"none",[`& .${pe("itemWrapper")}`]:{display:"inline-flex",alignItems:t?"center":"flex-start",flexDirection:"row"}}},itemIcon:{display:"inline-block",verticalAlign:"middle",marginRight:e.spacing.sm}})),Qt=Object.defineProperty,Z=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,Se=(e,r,t)=>r in e?Qt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,en=(e,r)=>{for(var t in r||(r={}))ir.call(r,t)&&Se(e,t,r[t]);if(Z)for(var t of Z(r))lr.call(r,t)&&Se(e,t,r[t]);return e},rn=(e,r)=>{var t={};for(var n in e)ir.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Z)for(var n of Z(e))r.indexOf(n)<0&&lr.call(e,n)&&(t[n]=e[n]);return t};const tn={},cr=g.forwardRef((e,r)=>{const t=P("ListItem",tn,e),{className:n,children:o,icon:i}=t,a=rn(t,["className","children","icon"]),{icon:s,spacing:c,center:f,listStyleType:d,size:u,withPadding:m,classNames:v,styles:p,unstyled:y,variant:h}=Zt(),x=i||s,{classes:w,cx:j}=Jt({withPadding:m,listStyleType:d,center:f,spacing:c},{classNames:v,styles:p,unstyled:y,name:"List",variant:h,size:u});return _.createElement(R,en({component:"li",className:j(w.item,n),"data-with-icon":!!x||void 0,ref:r},a),_.createElement("div",{className:w.itemWrapper},x&&_.createElement("span",{className:w.itemIcon},x),_.createElement("span",null,o)))});cr.displayName="@mantine/core/ListItem";var nn=Object.defineProperty,on=Object.defineProperties,an=Object.getOwnPropertyDescriptors,je=Object.getOwnPropertySymbols,sn=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,Ee=(e,r,t)=>r in e?nn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,cn=(e,r)=>{for(var t in r||(r={}))sn.call(r,t)&&Ee(e,t,r[t]);if(je)for(var t of je(r))ln.call(r,t)&&Ee(e,t,r[t]);return e},dn=(e,r)=>on(e,an(r)),fn=C((e,{withPadding:r,listStyleType:t},{size:n})=>({root:dn(cn({},e.fn.fontStyles()),{listStyleType:t,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,fontSize:T({size:n,sizes:e.fontSizes}),lineHeight:e.lineHeight,margin:0,paddingLeft:r?e.spacing.xl:0,listStylePosition:"inside"})})),un=Object.defineProperty,J=Object.getOwnPropertySymbols,dr=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable,Ie=(e,r,t)=>r in e?un(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,pn=(e,r)=>{for(var t in r||(r={}))dr.call(r,t)&&Ie(e,t,r[t]);if(J)for(var t of J(r))fr.call(r,t)&&Ie(e,t,r[t]);return e},mn=(e,r)=>{var t={};for(var n in e)dr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&J)for(var n of J(e))r.indexOf(n)<0&&fr.call(e,n)&&(t[n]=e[n]);return t};const gn={type:"unordered",size:"md",spacing:0},Q=g.forwardRef((e,r)=>{const t=P("List",gn,e),{children:n,type:o,size:i,listStyleType:a,withPadding:s,center:c,spacing:f,icon:d,className:u,styles:m,classNames:v,unstyled:p,variant:y}=t,h=mn(t,["children","type","size","listStyleType","withPadding","center","spacing","icon","className","styles","classNames","unstyled","variant"]),{classes:x,cx:w}=fn({withPadding:s,listStyleType:a,center:c,spacing:f},{classNames:v,styles:m,name:"List",unstyled:p,size:i,variant:y});return _.createElement(qt,{value:{spacing:f,center:c,icon:d,listStyleType:a,size:i,withPadding:s,classNames:v,styles:m,unstyled:p,variant:y}},_.createElement(R,pn({component:o==="unordered"?"ul":"ol",className:w(x.root,u),ref:r},h),n))});Q.Item=cr;Q.displayName="@mantine/core/List";const ur={context:"Menu component was not found in the tree",children:"Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[vn,V]=le(ur.context);var _n=C(e=>({divider:{marginTop:$(4),marginBottom:$(4),borderTop:`${$(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`}})),yn=Object.defineProperty,ee=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,Ce=(e,r,t)=>r in e?yn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,hn=(e,r)=>{for(var t in r||(r={}))pr.call(r,t)&&Ce(e,t,r[t]);if(ee)for(var t of ee(r))mr.call(r,t)&&Ce(e,t,r[t]);return e},xn=(e,r)=>{var t={};for(var n in e)pr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ee)for(var n of ee(e))r.indexOf(n)<0&&mr.call(e,n)&&(t[n]=e[n]);return t};const wn={},gr=g.forwardRef((e,r)=>{const t=P("MenuDivider",wn,e),{children:n,className:o}=t,i=xn(t,["children","className"]),{classNames:a,styles:s,unstyled:c,variant:f}=V(),{classes:d,cx:u}=_n(null,{name:"Menu",classNames:a,styles:s,unstyled:c,variant:f});return _.createElement(R,hn({className:u(d.divider,o),ref:r},i))});gr.displayName="@mantine/core/MenuDivider";var On=Object.defineProperty,re=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,Ne=(e,r,t)=>r in e?On(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,$n=(e,r)=>{for(var t in r||(r={}))vr.call(r,t)&&Ne(e,t,r[t]);if(re)for(var t of re(r))_r.call(r,t)&&Ne(e,t,r[t]);return e},Pn=(e,r)=>{var t={};for(var n in e)vr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&re)for(var n of re(e))r.indexOf(n)<0&&_r.call(e,n)&&(t[n]=e[n]);return t};const bn={};function yr(e){const r=P("MenuDropdown",bn,e),{children:t,onMouseEnter:n,onMouseLeave:o}=r,i=Pn(r,["children","onMouseEnter","onMouseLeave"]),a=g.useRef(),s=V(),c=u=>{var m;(u.key==="ArrowUp"||u.key==="ArrowDown")&&(u.preventDefault(),(m=a.current.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||m.focus())},f=N(n,()=>s.trigger==="hover"&&s.openDropdown()),d=N(o,()=>s.trigger==="hover"&&s.closeDropdown());return _.createElement(ce.Dropdown,$n({onMouseEnter:f,onMouseLeave:d,role:"menu","aria-orientation":"vertical"},i),_.createElement("div",{tabIndex:-1,"data-menu-dropdown":!0,"data-autofocus":!0,onKeyDown:c,ref:a,style:{outline:0}},t))}yr.displayName="@mantine/core/MenuDropdown";var Sn=Object.defineProperty,jn=Object.defineProperties,En=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Cn=Object.prototype.propertyIsEnumerable,De=(e,r,t)=>r in e?Sn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Nn=(e,r)=>{for(var t in r||(r={}))In.call(r,t)&&De(e,t,r[t]);if(Me)for(var t of Me(r))Cn.call(r,t)&&De(e,t,r[t]);return e},Mn=(e,r)=>jn(e,En(r)),Dn=C((e,{color:r,radius:t})=>({item:Mn(Nn({},e.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:e.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",textDecoration:"none",boxSizing:"border-box",padding:`${e.spacing.xs} ${e.spacing.sm}`,cursor:"pointer",borderRadius:e.fn.radius(t),color:r?e.fn.variant({variant:"filled",primaryFallback:!1,color:r}).background:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"flex",alignItems:"center","&:disabled":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],pointerEvents:"none",userSelect:"none"},"&[data-hovered]":{backgroundColor:r?e.fn.variant({variant:"light",color:r}).background:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[3],.35):e.colors.gray[1]}}),itemLabel:{flex:1},itemIcon:{display:"flex",justifyContent:"center",alignItems:"center",marginRight:e.spacing.xs},itemRightSection:{}})),Tn=Object.defineProperty,Rn=Object.defineProperties,Ln=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,Te=(e,r,t)=>r in e?Tn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,kn=(e,r)=>{for(var t in r||(r={}))hr.call(r,t)&&Te(e,t,r[t]);if(te)for(var t of te(r))xr.call(r,t)&&Te(e,t,r[t]);return e},zn=(e,r)=>Rn(e,Ln(r)),An=(e,r)=>{var t={};for(var n in e)hr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&te)for(var n of te(e))r.indexOf(n)<0&&xr.call(e,n)&&(t[n]=e[n]);return t};const Bn={},wr=g.forwardRef((e,r)=>{const t=P("MenuItem",Bn,e),{children:n,className:o,color:i,closeMenuOnClick:a,icon:s,rightSection:c}=t,f=An(t,["children","className","color","closeMenuOnClick","icon","rightSection"]),d=V(),{classes:u,cx:m,theme:v}=Dn({radius:d.radius,color:i},{name:"Menu",classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),p=g.useRef(),y=d.getItemIndex(p.current),h=f,x=N(h.onMouseLeave,()=>d.setHovered(-1)),w=N(h.onMouseEnter,()=>d.setHovered(d.getItemIndex(p.current))),j=N(h.onClick,()=>{typeof a=="boolean"?a&&d.closeDropdownImmediately():d.closeOnItemClick&&d.closeDropdownImmediately()}),D=N(h.onFocus,()=>d.setHovered(d.getItemIndex(p.current)));return _.createElement(R,zn(kn({component:"button",type:"button"},f),{tabIndex:-1,onFocus:D,className:m(u.item,o),ref:Ar(p,r),role:"menuitem","data-menu-item":!0,"data-hovered":d.hovered===y?!0:void 0,onMouseEnter:w,onMouseLeave:x,onClick:j,onKeyDown:at({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:d.loop,dir:v.dir,orientation:"vertical",onKeyDown:h.onKeydown})}),s&&_.createElement("div",{className:u.itemIcon},s),n&&_.createElement("div",{className:u.itemLabel},n),c&&_.createElement("div",{className:u.itemRightSection},c))});wr.displayName="@mantine/core/MenuItem";const Fn=ie(wr);var Hn=C(e=>({label:{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontWeight:500,fontSize:e.fontSizes.xs,padding:`calc(${e.spacing.xs} / 2) ${e.spacing.sm}`,cursor:"default"}})),Vn=Object.defineProperty,ne=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Re=(e,r,t)=>r in e?Vn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Xn=(e,r)=>{for(var t in r||(r={}))Or.call(r,t)&&Re(e,t,r[t]);if(ne)for(var t of ne(r))$r.call(r,t)&&Re(e,t,r[t]);return e},Gn=(e,r)=>{var t={};for(var n in e)Or.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ne)for(var n of ne(e))r.indexOf(n)<0&&$r.call(e,n)&&(t[n]=e[n]);return t};const Un={},Pr=g.forwardRef((e,r)=>{const t=P("MenuLabel",Un,e),{children:n,className:o}=t,i=Gn(t,["children","className"]),{classNames:a,styles:s,unstyled:c,variant:f}=V(),{classes:d,cx:u}=Hn(null,{name:"Menu",classNames:a,styles:s,unstyled:c,variant:f});return _.createElement(S,Xn({className:u(d.label,o),ref:r},i),n)});Pr.displayName="@mantine/core/MenuLabel";var Wn=Object.defineProperty,oe=Object.getOwnPropertySymbols,br=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Le=(e,r,t)=>r in e?Wn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Kn=(e,r)=>{for(var t in r||(r={}))br.call(r,t)&&Le(e,t,r[t]);if(oe)for(var t of oe(r))Sr.call(r,t)&&Le(e,t,r[t]);return e},Yn=(e,r)=>{var t={};for(var n in e)br.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&oe)for(var n of oe(e))r.indexOf(n)<0&&Sr.call(e,n)&&(t[n]=e[n]);return t};const qn={refProp:"ref"},jr=g.forwardRef((e,r)=>{const t=P("MenuTarget",qn,e),{children:n,refProp:o}=t,i=Yn(t,["children","refProp"]);if(!Br(n))throw new Error(ur.children);const a=V(),s=N(n.props.onClick,()=>a.trigger==="click"&&a.toggleDropdown()),c=N(n.props.onMouseEnter,()=>a.trigger==="hover"&&a.openDropdown()),f=N(n.props.onMouseLeave,()=>a.trigger==="hover"&&a.closeDropdown());return _.createElement(ce.Target,Kn({refProp:o,popupType:"menu",ref:r},i),g.cloneElement(n,{onClick:s,onMouseEnter:c,onMouseLeave:f,"data-expanded":a.opened?!0:void 0}))});jr.displayName="@mantine/core/MenuTarget";var Zn=C({dropdown:{padding:$(4)}}),Jn=Object.defineProperty,Qn=Object.defineProperties,eo=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,ke=(e,r,t)=>r in e?Jn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ze=(e,r)=>{for(var t in r||(r={}))Er.call(r,t)&&ke(e,t,r[t]);if(ae)for(var t of ae(r))Ir.call(r,t)&&ke(e,t,r[t]);return e},Ae=(e,r)=>Qn(e,eo(r)),ro=(e,r)=>{var t={};for(var n in e)Er.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ae)for(var n of ae(e))r.indexOf(n)<0&&Ir.call(e,n)&&(t[n]=e[n]);return t};const to={closeOnItemClick:!0,loop:!0,trigger:"click",openDelay:0,closeDelay:100};function I(e){const r=P("Menu",to,e),{children:t,onOpen:n,onClose:o,opened:i,defaultOpened:a,onChange:s,closeOnItemClick:c,loop:f,closeOnEscape:d,trigger:u,openDelay:m,closeDelay:v,classNames:p,styles:y,unstyled:h,radius:x,variant:w}=r,j=ro(r,["children","onOpen","onClose","opened","defaultOpened","onChange","closeOnItemClick","loop","closeOnEscape","trigger","openDelay","closeDelay","classNames","styles","unstyled","radius","variant"]),{classes:D,cx:L}=Zn(),[k,{setHovered:z,resetHovered:A}]=it(),[E,O]=Fr({value:i,defaultValue:a,finalValue:!1,onChange:s}),M=()=>{O(!1),E&&o?.()},B=()=>{O(!0),!E&&n?.()},X=()=>E?M():B(),{openDropdown:Cr,closeDropdown:Nr}=Yt({open:B,close:M,closeDelay:v,openDelay:m}),Mr=Dr=>st("[data-menu-item]","[data-menu-dropdown]",Dr);return Hr(()=>{A()},[E]),_.createElement(vn,{value:{opened:E,toggleDropdown:X,getItemIndex:Mr,hovered:k,setHovered:z,closeOnItemClick:c,closeDropdown:u==="click"?M:Nr,openDropdown:u==="click"?B:Cr,closeDropdownImmediately:M,loop:f,trigger:u,radius:x,classNames:p,styles:y,unstyled:h,variant:w}},_.createElement(ce,Ae(ze({},j),{radius:x,opened:E,onChange:X,defaultOpened:a,trapFocus:u==="click"&&E,closeOnEscape:d&&u==="click",__staticSelector:"Menu",classNames:Ae(ze({},p),{dropdown:L(D.dropdown,p?.dropdown)}),styles:y,unstyled:h,variant:w}),t))}I.displayName="@mantine/core/Menu";I.Item=Fn;I.Label=Pr;I.Dropdown=yr;I.Target=jr;I.Divider=gr;function no({data:e,onChange:r}){const t=de(Vr,e),[n,o]=g.useState(t.accountantApproval);return g.useEffect(()=>{n==null&&t.accountantApproval!=null&&o(t.accountantApproval)},[n,t.accountantApproval]),l.jsx(Qr,{value:n,businessTripId:t.id,onChange:r})}const oo="creditShareholdersBusinessTripTravelAndSubsistence",ao=()=>{const[{fetching:e},r]=Xr(Gr),t=g.useCallback(async n=>{const o=`Error crediting shareholders for trip ID ${n.businessTripId}`,i=`${oo}-${n.businessTripId}`;se.loading("Crediting Shareholders",{id:i});try{const a=await r(n),s=Ur(a,o,i);s&&se.success("Shareholders Credited",{id:i,description:`${s.creditShareholdersBusinessTripTravelAndSubsistence.length} Corresponding charges were successfully generated`})}catch(a){console.error(`${o}: ${a}`),se.error("Error",{id:i,description:o,duration:1e5,closeButton:!0})}},[r]);return{fetching:e,creditShareholders:t}};function so({businessTripId:e}){const[r,t]=g.useState(!1),{creditShareholders:n}=ao();return l.jsxs(I,{shadow:"md",width:200,opened:r,children:[l.jsx(I.Target,{children:l.jsx(Xe,{opened:r,onClick:o=>{o.stopPropagation(),t(i=>!i)}})}),l.jsxs(I.Dropdown,{children:[l.jsx(I.Label,{children:"Summarize Trip"}),l.jsx(Wr,{onConfirm:()=>{n({businessTripId:e})},title:"Credit shareholders with travel and subsistence surplus?",children:l.jsx(I.Item,{icon:l.jsx(Kr,{size:14}),children:"Credit surplus T&S"})})]})]})}const go=({data:e,onChange:r})=>{const t=de(Zr,e),{name:n,dates:o,purpose:i,destination:a}=t;return l.jsxs(b,{children:[l.jsxs(b.Col,{span:12,className:"flex flex-row justify-between items-center",children:[l.jsx(S,{fz:"xl",children:n}),l.jsxs("div",{className:"flex flex-row gap-2",children:[l.jsx(no,{data:t,onChange:r}),l.jsx(Yr,{isLink:!0,content:`${window.location.origin}${qr.BUSINESS_TRIPS.DETAIL(t.id)}`}),l.jsx(so,{businessTripId:t.id})]})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["From Date:",l.jsx(S,{fz:"lg",children:o?.start?me(new Date(o.start),"dd/MM/yy"):"Missing"})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["To Date:",l.jsx(S,{fz:"lg",children:o?.end?me(new Date(o.end),"dd/MM/yy"):"Missing"})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["Destination:",l.jsx(S,{fz:"lg",children:a?.name})]}),l.jsxs(b.Col,{xl:4,lg:6,md:12,orderMd:6,children:["Description:",l.jsx(S,{fz:"lg",children:i})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["Total Days:",l.jsx(S,{fz:"lg",children:o?io(o.start,o.end):"Missing"})]})]})};function io(e,r){return rt(ve(new Date(r),22),ve(new Date(e),6))+1}function lo(e){return e.split("_").map(co).join(" ")}function co(e){return e.slice(0,1).toUpperCase()+e.slice(1,e.length).toLowerCase()}const vo=({data:e})=>{const{summary:r}=de(Jr,e);return r?l.jsxs("div",{className:"flex flex-col gap-2 mt-5",children:[r.errors?.length&&l.jsxs(Be,{shadow:"xs",p:"md",children:[l.jsx(S,{c:"red",children:"Errors:"}),l.jsx(Q,{size:"sm",withPadding:!0,children:r.errors.map((t,n)=>l.jsx(Q.Item,{children:l.jsx(S,{c:"red",children:t})},n))})]}),l.jsxs(et,{highlightOnHover:!0,withBorder:!0,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Expense Type"}),l.jsxs("th",{children:["Total ",F(H.Usd)]}),l.jsxs("th",{children:["Total ",F(H.Ils)]}),l.jsxs("th",{children:["Max Taxable ",F(H.Usd)]}),l.jsxs("th",{children:["Taxable ",F(H.Usd)]}),l.jsxs("th",{children:["Taxable ",F(H.Ils)]}),l.jsx("th",{children:"Excess Expenditure"})]})}),l.jsx("tbody",{children:r.rows.map(t=>l.jsxs("tr",{children:[l.jsx("td",{children:lo(t.type)}),l.jsx("td",{children:t.totalForeignCurrency?.formatted}),l.jsx("td",{children:t.totalLocalCurrency?.formatted}),l.jsx("td",{children:t.maxTaxableForeignCurrency?.formatted}),l.jsx("td",{children:t.taxableForeignCurrency?.formatted}),l.jsx("td",{children:t.taxableLocalCurrency?.formatted}),l.jsx("td",{children:t.excessExpenditure?.formatted})]},t.type))})]}),l.jsxs(b,{justify:"flex-end",children:[l.jsxs(b.Col,{lg:2,md:4,children:["Excess Expenditure Tax:",l.jsxs(S,{fz:"lg",children:[r.excessTax??"0","%"]})]}),l.jsx(b.Col,{lg:2,md:3,className:"flex flex-col justify-end",children:l.jsx(S,{fz:"lg",children:r.excessExpenditure?.formatted??"0.00"})})]})]}):l.jsx(S,{children:"Loading..."})};export{Xe as B,mo as C,b as G,Q as L,I as M,go as R,vo as S};
|
|
1
|
+
import{f$ as Tr,g0 as Rr,g1 as Lr,r as g,by as C,ev as T,eu as $,bz as P,aF as _,fu as kr,ew as ie,bA as R,dw as Be,eS as le,g2 as Fe,g3 as zr,fY as pe,d8 as ce,ey as Ar,bv as S,eT as Br,eA as Fr,ep as Hr,j as l,a6 as de,g4 as Vr,g as Xr,g5 as Gr,t as se,i as Ur,bX as Wr,g6 as Kr,f2 as Yr,R as qr,w as me,g7 as Zr,g8 as Jr,dp as F,ay as H}from"./index-D1_HHRLX.js";import{U as Qr}from"./update-accountant-status-CU6mIJqS.js";import{T as et}from"./Table-pGQWLQ8H.js";function rt(e,r,t){const[n,o]=Tr(t?.in,e,r),i=ge(n,o),a=Math.abs(Rr(n,o));n.setDate(n.getDate()-i*a);const s=+(ge(n,o)===-i),c=i*(a-s);return c===0?0:c}function ge(e,r){const t=e.getFullYear()-r.getFullYear()||e.getMonth()-r.getMonth()||e.getDate()-r.getDate()||e.getHours()-r.getHours()||e.getMinutes()-r.getMinutes()||e.getSeconds()-r.getSeconds()||e.getMilliseconds()-r.getMilliseconds();return t<0?-1:t>0?1:t}function ve(e,r,t){const n=Lr(e,t?.in);return n.setHours(r),n}function G(e,r){let t=e;for(;(t=t.parentElement)&&!t.matches(r););return t}function tt(e,r,t){for(let n=e-1;n>=0;n-=1)if(!r[n].disabled)return n;if(t){for(let n=r.length-1;n>-1;n-=1)if(!r[n].disabled)return n}return e}function nt(e,r,t){for(let n=e+1;n<r.length;n+=1)if(!r[n].disabled)return n;if(t){for(let n=0;n<r.length;n+=1)if(!r[n].disabled)return n}return e}function ot(e,r,t){return G(e,t)===G(r,t)}function at({parentSelector:e,siblingSelector:r,onKeyDown:t,loop:n=!0,activateOnFocus:o=!1,dir:i="rtl",orientation:a}){return s=>{var c;t?.(s);const f=Array.from(((c=G(s.currentTarget,e))==null?void 0:c.querySelectorAll(r))||[]).filter(v=>ot(s.currentTarget,v,e)),d=f.findIndex(v=>s.currentTarget===v),u=nt(d,f,n),m=tt(d,f,n);switch(s.key){case"ArrowRight":break;case"ArrowLeft":break;case"ArrowUp":{s.stopPropagation(),s.preventDefault(),f[m].focus(),o&&f[m].click();break}case"ArrowDown":{s.stopPropagation(),s.preventDefault(),f[u].focus(),o&&f[u].click();break}case"Home":{s.stopPropagation(),s.preventDefault(),!f[0].disabled&&f[0].focus();break}case"End":{s.stopPropagation(),s.preventDefault();const v=f.length-1;!f[v].disabled&&f[v].focus();break}}}}function st(e,r,t){var n;return t?Array.from(((n=G(t,r))==null?void 0:n.querySelectorAll(e))||[]).findIndex(o=>o===t):null}function N(e,r){return t=>{e?.(t),r?.(t)}}function it(){const[e,r]=g.useState(-1);return[e,{setHovered:r,resetHovered:()=>r(-1)}]}const lt={xs:$(12),sm:$(18),md:$(24),lg:$(34),xl:$(42)};var ct=C((e,{color:r,transitionDuration:t},{size:n})=>{const o=T({size:n,sizes:lt}),i=r||(e.colorScheme==="dark"?e.white:e.black);return{root:{borderRadius:e.radius.sm,width:`calc(${o} + ${e.spacing.xs})`,height:`calc(${o} + ${e.spacing.xs})`,padding:`calc(${e.spacing.xs} / 2)`,cursor:"pointer"},burger:{position:"relative",userSelect:"none",boxSizing:"border-box","&, &::before, &::after":{display:"block",width:o,height:`calc(${o} / 12)`,backgroundColor:i,outline:`${$(1)} solid transparent`,transitionProperty:"background-color, transform",transitionDuration:`${t}ms`,"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?"0ms":void 0}},"&::before, &::after":{position:"absolute",content:'""',left:0},"&::before":{top:`calc((${o} / 3) * -1)`},"&::after":{top:`calc(${o} / 3)`},"&[data-opened]":{backgroundColor:"transparent","&::before":{transform:`translateY(calc(${o} / 3)) rotate(45deg)`},"&::after":{transform:`translateY(calc(-${o} / 3)) rotate(-45deg)`}}}}}),dt=Object.defineProperty,U=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,_e=(e,r,t)=>r in e?dt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ft=(e,r)=>{for(var t in r||(r={}))He.call(r,t)&&_e(e,t,r[t]);if(U)for(var t of U(r))Ve.call(r,t)&&_e(e,t,r[t]);return e},ut=(e,r)=>{var t={};for(var n in e)He.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&U)for(var n of U(e))r.indexOf(n)<0&&Ve.call(e,n)&&(t[n]=e[n]);return t};const pt={size:"md",transitionDuration:300},Xe=g.forwardRef((e,r)=>{const t=P("Burger",pt,e),{className:n,opened:o,color:i,size:a,classNames:s,styles:c,transitionDuration:f,variant:d}=t,u=ut(t,["className","opened","color","size","classNames","styles","transitionDuration","variant"]),{classes:m,cx:v}=ct({color:i,transitionDuration:f},{classNames:s,styles:c,name:"Burger",variant:d,size:a});return _.createElement(kr,ft({className:v(m.root,n),ref:r},u),_.createElement("div",{"data-opened":o||void 0,className:m.burger}))});Xe.displayName="@mantine/core/Burger";const Ge=g.createContext({padding:0}),mt=Ge.Provider,gt=()=>g.useContext(Ge).padding;var vt=C((e,{padding:r,withBorder:t,inheritPadding:n})=>{const o=T({size:r,sizes:e.spacing}),i=`calc(-1 * ${o})`,a=e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3];return{cardSection:{display:"block",marginLeft:i,marginRight:i,paddingLeft:n?o:void 0,paddingRight:n?o:void 0,borderTop:t?`${$(1)} solid ${a}`:void 0,borderBottom:t?`${$(1)} solid ${a}`:void 0,"& + &":{borderTop:0},"&[data-first]":{marginTop:i,borderTop:0,borderBottom:t?`${$(1)} solid ${a}`:void 0},"&[data-last]":{marginBottom:i,borderBottom:0}}}}),_t=Object.defineProperty,W=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,ye=(e,r,t)=>r in e?_t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,yt=(e,r)=>{for(var t in r||(r={}))Ue.call(r,t)&&ye(e,t,r[t]);if(W)for(var t of W(r))We.call(r,t)&&ye(e,t,r[t]);return e},ht=(e,r)=>{var t={};for(var n in e)Ue.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&W)for(var n of W(e))r.indexOf(n)<0&&We.call(e,n)&&(t[n]=e[n]);return t};const xt={withBorder:!1,inheritPadding:!1},Ke=g.forwardRef((e,r)=>{const t=P("CardSection",xt,e),{className:n,withBorder:o,inheritPadding:i,unstyled:a,variant:s}=t,c=ht(t,["className","withBorder","inheritPadding","unstyled","variant"]),{classes:f,cx:d}=vt({padding:gt(),withBorder:o,inheritPadding:i},{name:"Card",unstyled:a,variant:s});return _.createElement(R,yt({className:d(f.cardSection,n),ref:r},c))});Ke.displayName="@mantine/core/CardSection";const Ye=ie(Ke);var wt=C(e=>({root:{position:"relative",overflow:"hidden",backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white}})),Ot=Object.defineProperty,K=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,he=(e,r,t)=>r in e?Ot(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,$t=(e,r)=>{for(var t in r||(r={}))qe.call(r,t)&&he(e,t,r[t]);if(K)for(var t of K(r))Ze.call(r,t)&&he(e,t,r[t]);return e},Pt=(e,r)=>{var t={};for(var n in e)qe.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&K)for(var n of K(e))r.indexOf(n)<0&&Ze.call(e,n)&&(t[n]=e[n]);return t};const bt={padding:"md"},fe=g.forwardRef((e,r)=>{const t=P("Card",bt,e),{className:n,padding:o,radius:i,children:a,unstyled:s,variant:c}=t,f=Pt(t,["className","padding","radius","children","unstyled","variant"]),{classes:d,cx:u}=wt(null,{name:"Card",unstyled:s,variant:c}),m=g.Children.toArray(a),v=m.map((p,y)=>typeof p=="object"&&p&&"type"in p&&p.type===Ye?g.cloneElement(p,{variant:c,padding:o,"data-first":y===0||void 0,"data-last":y===m.length-1||void 0}):p);return _.createElement(mt,{value:{padding:o}},_.createElement(Be,$t({className:u(d.root,n),radius:i,p:o,ref:r},f),v))});fe.Section=Ye;fe.displayName="@mantine/core/Card";const mo=ie(fe),[St,jt]=le("Grid component was not found in tree");var Et=Object.defineProperty,xe=Object.getOwnPropertySymbols,It=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,we=(e,r,t)=>r in e?Et(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Nt=(e,r)=>{for(var t in r||(r={}))It.call(r,t)&&we(e,t,r[t]);if(xe)for(var t of xe(r))Ct.call(r,t)&&we(e,t,r[t]);return e};const ue=(e,r)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(r/e)}%`:void 0,Je=(e,r,t)=>t||e==="auto"||e==="content"?"unset":ue(e,r),Qe=(e,r)=>{if(e)return e==="auto"||r?1:0},er=(e,r)=>e===0?0:e?`${100/(r/e)}%`:void 0,rr=(e,r)=>typeof e<"u"?`calc(${T({size:e,sizes:r.spacing})} / 2)`:void 0;function Mt({sizes:e,offsets:r,orders:t,theme:n,columns:o,gutters:i,grow:a}){return Fe.reduce((s,c)=>(s[`@media (min-width: ${zr(n.breakpoints[c])})`]={order:t[c],flexBasis:ue(e[c],o),padding:rr(i[c],n),flexShrink:0,width:e[c]==="content"?"auto":void 0,maxWidth:Je(e[c],o,a),marginLeft:er(r[c],o),flexGrow:Qe(e[c],a)},s),{})}var Dt=C((e,{gutter:r,gutterXs:t,gutterSm:n,gutterMd:o,gutterLg:i,gutterXl:a,grow:s,offset:c,offsetXs:f,offsetSm:d,offsetMd:u,offsetLg:m,offsetXl:v,columns:p,span:y,xs:h,sm:x,md:w,lg:j,xl:D,order:L,orderXs:k,orderSm:z,orderMd:A,orderLg:E,orderXl:O})=>({col:Nt({boxSizing:"border-box",flexGrow:Qe(y,s),order:L,padding:rr(r,e),marginLeft:er(c,p),flexBasis:ue(y,p),flexShrink:0,width:y==="content"?"auto":void 0,maxWidth:Je(y,p,s)},Mt({sizes:{xs:h,sm:x,md:w,lg:j,xl:D},offsets:{xs:f,sm:d,md:u,lg:m,xl:v},orders:{xs:k,sm:z,md:A,lg:E,xl:O},gutters:{xs:t,sm:n,md:o,lg:i,xl:a},theme:e,columns:p,grow:s}))})),Tt=Object.defineProperty,Y=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,Oe=(e,r,t)=>r in e?Tt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Rt=(e,r)=>{for(var t in r||(r={}))tr.call(r,t)&&Oe(e,t,r[t]);if(Y)for(var t of Y(r))nr.call(r,t)&&Oe(e,t,r[t]);return e},Lt=(e,r)=>{var t={};for(var n in e)tr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Y)for(var n of Y(e))r.indexOf(n)<0&&nr.call(e,n)&&(t[n]=e[n]);return t};const kt={};function zt(e){return e==="auto"||e==="content"?!0:typeof e=="number"&&e>0&&e%1===0}const or=g.forwardRef((e,r)=>{const t=P("GridCol",kt,e),{children:n,span:o,offset:i,offsetXs:a,offsetSm:s,offsetMd:c,offsetLg:f,offsetXl:d,xs:u,sm:m,md:v,lg:p,xl:y,order:h,orderXs:x,orderSm:w,orderMd:j,orderLg:D,orderXl:L,className:k,unstyled:z,variant:A}=t,E=Lt(t,["children","span","offset","offsetXs","offsetSm","offsetMd","offsetLg","offsetXl","xs","sm","md","lg","xl","order","orderXs","orderSm","orderMd","orderLg","orderXl","className","unstyled","variant"]),O=jt(),M=o||O.columns,{classes:B,cx:X}=Dt({gutter:O.gutter,gutterXs:O.gutterXs,gutterSm:O.gutterSm,gutterMd:O.gutterMd,gutterLg:O.gutterLg,gutterXl:O.gutterXl,offset:i,offsetXs:a,offsetSm:s,offsetMd:c,offsetLg:f,offsetXl:d,xs:u,sm:m,md:v,lg:p,xl:y,order:h,orderXs:x,orderSm:w,orderMd:j,orderLg:D,orderXl:L,grow:O.grow,columns:O.columns,span:M},{unstyled:z,name:"Grid",variant:A});return!zt(M)||M>O.columns?null:_.createElement(R,Rt({className:X(B.col,k),ref:r},E),n)});or.displayName="@mantine/core/Col";var At=Object.defineProperty,$e=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Pe=(e,r,t)=>r in e?At(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Ht=(e,r)=>{for(var t in r||(r={}))Bt.call(r,t)&&Pe(e,t,r[t]);if($e)for(var t of $e(r))Ft.call(r,t)&&Pe(e,t,r[t]);return e};function Vt(e,r){return Fe.reduce((t,n)=>(typeof e[n]<"u"&&(t[`@media (min-width: ${r.breakpoints[n]})`]={margin:`calc(-${T({size:e[n],sizes:r.spacing})} / 2)`}),t),{})}var Xt=C((e,{justify:r,align:t,gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c})=>({root:Ht({margin:`calc(-${T({size:n,sizes:e.spacing})} / 2)`,display:"flex",flexWrap:"wrap",justifyContent:r,alignItems:t},Vt({xs:o,sm:i,md:a,lg:s,xl:c},e))})),Gt=Object.defineProperty,q=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,be=(e,r,t)=>r in e?Gt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Ut=(e,r)=>{for(var t in r||(r={}))ar.call(r,t)&&be(e,t,r[t]);if(q)for(var t of q(r))sr.call(r,t)&&be(e,t,r[t]);return e},Wt=(e,r)=>{var t={};for(var n in e)ar.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&q)for(var n of q(e))r.indexOf(n)<0&&sr.call(e,n)&&(t[n]=e[n]);return t};const Kt={gutter:"md",justify:"flex-start",align:"stretch",columns:12},b=g.forwardRef((e,r)=>{const t=P("Grid",Kt,e),{gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c,children:f,grow:d,justify:u,align:m,columns:v,className:p,unstyled:y,variant:h}=t,x=Wt(t,["gutter","gutterXs","gutterSm","gutterMd","gutterLg","gutterXl","children","grow","justify","align","columns","className","unstyled","variant"]),{classes:w,cx:j}=Xt({gutter:n,justify:u,align:m,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c},{unstyled:y,name:"Grid",variant:h});return _.createElement(St,{value:{gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:s,gutterXl:c,grow:d,columns:v}},_.createElement(R,Ut({className:j(w.root,p),ref:r},x),f))});b.Col=or;b.displayName="@mantine/core/Grid";function Yt({open:e,close:r,openDelay:t,closeDelay:n}){const o=g.useRef(-1),i=g.useRef(-1),a=()=>{window.clearTimeout(o.current),window.clearTimeout(i.current)},s=()=>{a(),t===0?e():o.current=window.setTimeout(e,t)},c=()=>{a(),n===0?r():i.current=window.setTimeout(r,n)};return g.useEffect(()=>a,[]),{openDropdown:s,closeDropdown:c}}const[qt,Zt]=le("List component was not found in tree");var Jt=C((e,{spacing:r,center:t})=>({itemWrapper:{ref:pe("itemWrapper"),display:"inline-flex",flexDirection:"column",whiteSpace:"normal"},item:{whiteSpace:"nowrap",lineHeight:t?1:e.lineHeight,"&:not(:first-of-type)":{marginTop:T({size:r,sizes:e.spacing})},"&[data-with-icon]":{listStyle:"none",[`& .${pe("itemWrapper")}`]:{display:"inline-flex",alignItems:t?"center":"flex-start",flexDirection:"row"}}},itemIcon:{display:"inline-block",verticalAlign:"middle",marginRight:e.spacing.sm}})),Qt=Object.defineProperty,Z=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,Se=(e,r,t)=>r in e?Qt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,en=(e,r)=>{for(var t in r||(r={}))ir.call(r,t)&&Se(e,t,r[t]);if(Z)for(var t of Z(r))lr.call(r,t)&&Se(e,t,r[t]);return e},rn=(e,r)=>{var t={};for(var n in e)ir.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Z)for(var n of Z(e))r.indexOf(n)<0&&lr.call(e,n)&&(t[n]=e[n]);return t};const tn={},cr=g.forwardRef((e,r)=>{const t=P("ListItem",tn,e),{className:n,children:o,icon:i}=t,a=rn(t,["className","children","icon"]),{icon:s,spacing:c,center:f,listStyleType:d,size:u,withPadding:m,classNames:v,styles:p,unstyled:y,variant:h}=Zt(),x=i||s,{classes:w,cx:j}=Jt({withPadding:m,listStyleType:d,center:f,spacing:c},{classNames:v,styles:p,unstyled:y,name:"List",variant:h,size:u});return _.createElement(R,en({component:"li",className:j(w.item,n),"data-with-icon":!!x||void 0,ref:r},a),_.createElement("div",{className:w.itemWrapper},x&&_.createElement("span",{className:w.itemIcon},x),_.createElement("span",null,o)))});cr.displayName="@mantine/core/ListItem";var nn=Object.defineProperty,on=Object.defineProperties,an=Object.getOwnPropertyDescriptors,je=Object.getOwnPropertySymbols,sn=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,Ee=(e,r,t)=>r in e?nn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,cn=(e,r)=>{for(var t in r||(r={}))sn.call(r,t)&&Ee(e,t,r[t]);if(je)for(var t of je(r))ln.call(r,t)&&Ee(e,t,r[t]);return e},dn=(e,r)=>on(e,an(r)),fn=C((e,{withPadding:r,listStyleType:t},{size:n})=>({root:dn(cn({},e.fn.fontStyles()),{listStyleType:t,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,fontSize:T({size:n,sizes:e.fontSizes}),lineHeight:e.lineHeight,margin:0,paddingLeft:r?e.spacing.xl:0,listStylePosition:"inside"})})),un=Object.defineProperty,J=Object.getOwnPropertySymbols,dr=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable,Ie=(e,r,t)=>r in e?un(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,pn=(e,r)=>{for(var t in r||(r={}))dr.call(r,t)&&Ie(e,t,r[t]);if(J)for(var t of J(r))fr.call(r,t)&&Ie(e,t,r[t]);return e},mn=(e,r)=>{var t={};for(var n in e)dr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&J)for(var n of J(e))r.indexOf(n)<0&&fr.call(e,n)&&(t[n]=e[n]);return t};const gn={type:"unordered",size:"md",spacing:0},Q=g.forwardRef((e,r)=>{const t=P("List",gn,e),{children:n,type:o,size:i,listStyleType:a,withPadding:s,center:c,spacing:f,icon:d,className:u,styles:m,classNames:v,unstyled:p,variant:y}=t,h=mn(t,["children","type","size","listStyleType","withPadding","center","spacing","icon","className","styles","classNames","unstyled","variant"]),{classes:x,cx:w}=fn({withPadding:s,listStyleType:a,center:c,spacing:f},{classNames:v,styles:m,name:"List",unstyled:p,size:i,variant:y});return _.createElement(qt,{value:{spacing:f,center:c,icon:d,listStyleType:a,size:i,withPadding:s,classNames:v,styles:m,unstyled:p,variant:y}},_.createElement(R,pn({component:o==="unordered"?"ul":"ol",className:w(x.root,u),ref:r},h),n))});Q.Item=cr;Q.displayName="@mantine/core/List";const ur={context:"Menu component was not found in the tree",children:"Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[vn,V]=le(ur.context);var _n=C(e=>({divider:{marginTop:$(4),marginBottom:$(4),borderTop:`${$(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`}})),yn=Object.defineProperty,ee=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,Ce=(e,r,t)=>r in e?yn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,hn=(e,r)=>{for(var t in r||(r={}))pr.call(r,t)&&Ce(e,t,r[t]);if(ee)for(var t of ee(r))mr.call(r,t)&&Ce(e,t,r[t]);return e},xn=(e,r)=>{var t={};for(var n in e)pr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ee)for(var n of ee(e))r.indexOf(n)<0&&mr.call(e,n)&&(t[n]=e[n]);return t};const wn={},gr=g.forwardRef((e,r)=>{const t=P("MenuDivider",wn,e),{children:n,className:o}=t,i=xn(t,["children","className"]),{classNames:a,styles:s,unstyled:c,variant:f}=V(),{classes:d,cx:u}=_n(null,{name:"Menu",classNames:a,styles:s,unstyled:c,variant:f});return _.createElement(R,hn({className:u(d.divider,o),ref:r},i))});gr.displayName="@mantine/core/MenuDivider";var On=Object.defineProperty,re=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,Ne=(e,r,t)=>r in e?On(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,$n=(e,r)=>{for(var t in r||(r={}))vr.call(r,t)&&Ne(e,t,r[t]);if(re)for(var t of re(r))_r.call(r,t)&&Ne(e,t,r[t]);return e},Pn=(e,r)=>{var t={};for(var n in e)vr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&re)for(var n of re(e))r.indexOf(n)<0&&_r.call(e,n)&&(t[n]=e[n]);return t};const bn={};function yr(e){const r=P("MenuDropdown",bn,e),{children:t,onMouseEnter:n,onMouseLeave:o}=r,i=Pn(r,["children","onMouseEnter","onMouseLeave"]),a=g.useRef(),s=V(),c=u=>{var m;(u.key==="ArrowUp"||u.key==="ArrowDown")&&(u.preventDefault(),(m=a.current.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||m.focus())},f=N(n,()=>s.trigger==="hover"&&s.openDropdown()),d=N(o,()=>s.trigger==="hover"&&s.closeDropdown());return _.createElement(ce.Dropdown,$n({onMouseEnter:f,onMouseLeave:d,role:"menu","aria-orientation":"vertical"},i),_.createElement("div",{tabIndex:-1,"data-menu-dropdown":!0,"data-autofocus":!0,onKeyDown:c,ref:a,style:{outline:0}},t))}yr.displayName="@mantine/core/MenuDropdown";var Sn=Object.defineProperty,jn=Object.defineProperties,En=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Cn=Object.prototype.propertyIsEnumerable,De=(e,r,t)=>r in e?Sn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Nn=(e,r)=>{for(var t in r||(r={}))In.call(r,t)&&De(e,t,r[t]);if(Me)for(var t of Me(r))Cn.call(r,t)&&De(e,t,r[t]);return e},Mn=(e,r)=>jn(e,En(r)),Dn=C((e,{color:r,radius:t})=>({item:Mn(Nn({},e.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:e.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",textDecoration:"none",boxSizing:"border-box",padding:`${e.spacing.xs} ${e.spacing.sm}`,cursor:"pointer",borderRadius:e.fn.radius(t),color:r?e.fn.variant({variant:"filled",primaryFallback:!1,color:r}).background:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"flex",alignItems:"center","&:disabled":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],pointerEvents:"none",userSelect:"none"},"&[data-hovered]":{backgroundColor:r?e.fn.variant({variant:"light",color:r}).background:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[3],.35):e.colors.gray[1]}}),itemLabel:{flex:1},itemIcon:{display:"flex",justifyContent:"center",alignItems:"center",marginRight:e.spacing.xs},itemRightSection:{}})),Tn=Object.defineProperty,Rn=Object.defineProperties,Ln=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,Te=(e,r,t)=>r in e?Tn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,kn=(e,r)=>{for(var t in r||(r={}))hr.call(r,t)&&Te(e,t,r[t]);if(te)for(var t of te(r))xr.call(r,t)&&Te(e,t,r[t]);return e},zn=(e,r)=>Rn(e,Ln(r)),An=(e,r)=>{var t={};for(var n in e)hr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&te)for(var n of te(e))r.indexOf(n)<0&&xr.call(e,n)&&(t[n]=e[n]);return t};const Bn={},wr=g.forwardRef((e,r)=>{const t=P("MenuItem",Bn,e),{children:n,className:o,color:i,closeMenuOnClick:a,icon:s,rightSection:c}=t,f=An(t,["children","className","color","closeMenuOnClick","icon","rightSection"]),d=V(),{classes:u,cx:m,theme:v}=Dn({radius:d.radius,color:i},{name:"Menu",classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),p=g.useRef(),y=d.getItemIndex(p.current),h=f,x=N(h.onMouseLeave,()=>d.setHovered(-1)),w=N(h.onMouseEnter,()=>d.setHovered(d.getItemIndex(p.current))),j=N(h.onClick,()=>{typeof a=="boolean"?a&&d.closeDropdownImmediately():d.closeOnItemClick&&d.closeDropdownImmediately()}),D=N(h.onFocus,()=>d.setHovered(d.getItemIndex(p.current)));return _.createElement(R,zn(kn({component:"button",type:"button"},f),{tabIndex:-1,onFocus:D,className:m(u.item,o),ref:Ar(p,r),role:"menuitem","data-menu-item":!0,"data-hovered":d.hovered===y?!0:void 0,onMouseEnter:w,onMouseLeave:x,onClick:j,onKeyDown:at({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:d.loop,dir:v.dir,orientation:"vertical",onKeyDown:h.onKeydown})}),s&&_.createElement("div",{className:u.itemIcon},s),n&&_.createElement("div",{className:u.itemLabel},n),c&&_.createElement("div",{className:u.itemRightSection},c))});wr.displayName="@mantine/core/MenuItem";const Fn=ie(wr);var Hn=C(e=>({label:{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontWeight:500,fontSize:e.fontSizes.xs,padding:`calc(${e.spacing.xs} / 2) ${e.spacing.sm}`,cursor:"default"}})),Vn=Object.defineProperty,ne=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Re=(e,r,t)=>r in e?Vn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Xn=(e,r)=>{for(var t in r||(r={}))Or.call(r,t)&&Re(e,t,r[t]);if(ne)for(var t of ne(r))$r.call(r,t)&&Re(e,t,r[t]);return e},Gn=(e,r)=>{var t={};for(var n in e)Or.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ne)for(var n of ne(e))r.indexOf(n)<0&&$r.call(e,n)&&(t[n]=e[n]);return t};const Un={},Pr=g.forwardRef((e,r)=>{const t=P("MenuLabel",Un,e),{children:n,className:o}=t,i=Gn(t,["children","className"]),{classNames:a,styles:s,unstyled:c,variant:f}=V(),{classes:d,cx:u}=Hn(null,{name:"Menu",classNames:a,styles:s,unstyled:c,variant:f});return _.createElement(S,Xn({className:u(d.label,o),ref:r},i),n)});Pr.displayName="@mantine/core/MenuLabel";var Wn=Object.defineProperty,oe=Object.getOwnPropertySymbols,br=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Le=(e,r,t)=>r in e?Wn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Kn=(e,r)=>{for(var t in r||(r={}))br.call(r,t)&&Le(e,t,r[t]);if(oe)for(var t of oe(r))Sr.call(r,t)&&Le(e,t,r[t]);return e},Yn=(e,r)=>{var t={};for(var n in e)br.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&oe)for(var n of oe(e))r.indexOf(n)<0&&Sr.call(e,n)&&(t[n]=e[n]);return t};const qn={refProp:"ref"},jr=g.forwardRef((e,r)=>{const t=P("MenuTarget",qn,e),{children:n,refProp:o}=t,i=Yn(t,["children","refProp"]);if(!Br(n))throw new Error(ur.children);const a=V(),s=N(n.props.onClick,()=>a.trigger==="click"&&a.toggleDropdown()),c=N(n.props.onMouseEnter,()=>a.trigger==="hover"&&a.openDropdown()),f=N(n.props.onMouseLeave,()=>a.trigger==="hover"&&a.closeDropdown());return _.createElement(ce.Target,Kn({refProp:o,popupType:"menu",ref:r},i),g.cloneElement(n,{onClick:s,onMouseEnter:c,onMouseLeave:f,"data-expanded":a.opened?!0:void 0}))});jr.displayName="@mantine/core/MenuTarget";var Zn=C({dropdown:{padding:$(4)}}),Jn=Object.defineProperty,Qn=Object.defineProperties,eo=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,ke=(e,r,t)=>r in e?Jn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ze=(e,r)=>{for(var t in r||(r={}))Er.call(r,t)&&ke(e,t,r[t]);if(ae)for(var t of ae(r))Ir.call(r,t)&&ke(e,t,r[t]);return e},Ae=(e,r)=>Qn(e,eo(r)),ro=(e,r)=>{var t={};for(var n in e)Er.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ae)for(var n of ae(e))r.indexOf(n)<0&&Ir.call(e,n)&&(t[n]=e[n]);return t};const to={closeOnItemClick:!0,loop:!0,trigger:"click",openDelay:0,closeDelay:100};function I(e){const r=P("Menu",to,e),{children:t,onOpen:n,onClose:o,opened:i,defaultOpened:a,onChange:s,closeOnItemClick:c,loop:f,closeOnEscape:d,trigger:u,openDelay:m,closeDelay:v,classNames:p,styles:y,unstyled:h,radius:x,variant:w}=r,j=ro(r,["children","onOpen","onClose","opened","defaultOpened","onChange","closeOnItemClick","loop","closeOnEscape","trigger","openDelay","closeDelay","classNames","styles","unstyled","radius","variant"]),{classes:D,cx:L}=Zn(),[k,{setHovered:z,resetHovered:A}]=it(),[E,O]=Fr({value:i,defaultValue:a,finalValue:!1,onChange:s}),M=()=>{O(!1),E&&o?.()},B=()=>{O(!0),!E&&n?.()},X=()=>E?M():B(),{openDropdown:Cr,closeDropdown:Nr}=Yt({open:B,close:M,closeDelay:v,openDelay:m}),Mr=Dr=>st("[data-menu-item]","[data-menu-dropdown]",Dr);return Hr(()=>{A()},[E]),_.createElement(vn,{value:{opened:E,toggleDropdown:X,getItemIndex:Mr,hovered:k,setHovered:z,closeOnItemClick:c,closeDropdown:u==="click"?M:Nr,openDropdown:u==="click"?B:Cr,closeDropdownImmediately:M,loop:f,trigger:u,radius:x,classNames:p,styles:y,unstyled:h,variant:w}},_.createElement(ce,Ae(ze({},j),{radius:x,opened:E,onChange:X,defaultOpened:a,trapFocus:u==="click"&&E,closeOnEscape:d&&u==="click",__staticSelector:"Menu",classNames:Ae(ze({},p),{dropdown:L(D.dropdown,p?.dropdown)}),styles:y,unstyled:h,variant:w}),t))}I.displayName="@mantine/core/Menu";I.Item=Fn;I.Label=Pr;I.Dropdown=yr;I.Target=jr;I.Divider=gr;function no({data:e,onChange:r}){const t=de(Vr,e),[n,o]=g.useState(t.accountantApproval);return g.useEffect(()=>{n==null&&t.accountantApproval!=null&&o(t.accountantApproval)},[n,t.accountantApproval]),l.jsx(Qr,{value:n,businessTripId:t.id,onChange:r})}const oo="creditShareholdersBusinessTripTravelAndSubsistence",ao=()=>{const[{fetching:e},r]=Xr(Gr),t=g.useCallback(async n=>{const o=`Error crediting shareholders for trip ID ${n.businessTripId}`,i=`${oo}-${n.businessTripId}`;se.loading("Crediting Shareholders",{id:i});try{const a=await r(n),s=Ur(a,o,i);s&&se.success("Shareholders Credited",{id:i,description:`${s.creditShareholdersBusinessTripTravelAndSubsistence.length} Corresponding charges were successfully generated`})}catch(a){console.error(`${o}: ${a}`),se.error("Error",{id:i,description:o,duration:1e5,closeButton:!0})}},[r]);return{fetching:e,creditShareholders:t}};function so({businessTripId:e}){const[r,t]=g.useState(!1),{creditShareholders:n}=ao();return l.jsxs(I,{shadow:"md",width:200,opened:r,children:[l.jsx(I.Target,{children:l.jsx(Xe,{opened:r,onClick:o=>{o.stopPropagation(),t(i=>!i)}})}),l.jsxs(I.Dropdown,{children:[l.jsx(I.Label,{children:"Summarize Trip"}),l.jsx(Wr,{onConfirm:()=>{n({businessTripId:e})},title:"Credit shareholders with travel and subsistence surplus?",children:l.jsx(I.Item,{icon:l.jsx(Kr,{size:14}),children:"Credit surplus T&S"})})]})]})}const go=({data:e,onChange:r})=>{const t=de(Zr,e),{name:n,dates:o,purpose:i,destination:a}=t;return l.jsxs(b,{children:[l.jsxs(b.Col,{span:12,className:"flex flex-row justify-between items-center",children:[l.jsx(S,{fz:"xl",children:n}),l.jsxs("div",{className:"flex flex-row gap-2",children:[l.jsx(no,{data:t,onChange:r}),l.jsx(Yr,{isLink:!0,content:`${window.location.origin}${qr.BUSINESS_TRIPS.DETAIL(t.id)}`}),l.jsx(so,{businessTripId:t.id})]})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["From Date:",l.jsx(S,{fz:"lg",children:o?.start?me(new Date(o.start),"dd/MM/yy"):"Missing"})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["To Date:",l.jsx(S,{fz:"lg",children:o?.end?me(new Date(o.end),"dd/MM/yy"):"Missing"})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["Destination:",l.jsx(S,{fz:"lg",children:a?.name})]}),l.jsxs(b.Col,{xl:4,lg:6,md:12,orderMd:6,children:["Description:",l.jsx(S,{fz:"lg",children:i})]}),l.jsxs(b.Col,{xl:2,lg:3,md:6,children:["Total Days:",l.jsx(S,{fz:"lg",children:o?io(o.start,o.end):"Missing"})]})]})};function io(e,r){return rt(ve(new Date(r),22),ve(new Date(e),6))+1}function lo(e){return e.split("_").map(co).join(" ")}function co(e){return e.slice(0,1).toUpperCase()+e.slice(1,e.length).toLowerCase()}const vo=({data:e})=>{const{summary:r}=de(Jr,e);return r?l.jsxs("div",{className:"flex flex-col gap-2 mt-5",children:[r.errors?.length&&l.jsxs(Be,{shadow:"xs",p:"md",children:[l.jsx(S,{c:"red",children:"Errors:"}),l.jsx(Q,{size:"sm",withPadding:!0,children:r.errors.map((t,n)=>l.jsx(Q.Item,{children:l.jsx(S,{c:"red",children:t})},n))})]}),l.jsxs(et,{highlightOnHover:!0,withBorder:!0,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Expense Type"}),l.jsxs("th",{children:["Total ",F(H.Usd)]}),l.jsxs("th",{children:["Total ",F(H.Ils)]}),l.jsxs("th",{children:["Max Taxable ",F(H.Usd)]}),l.jsxs("th",{children:["Taxable ",F(H.Usd)]}),l.jsxs("th",{children:["Taxable ",F(H.Ils)]}),l.jsx("th",{children:"Excess Expenditure"})]})}),l.jsx("tbody",{children:r.rows.map(t=>l.jsxs("tr",{children:[l.jsx("td",{children:lo(t.type)}),l.jsx("td",{children:t.totalForeignCurrency?.formatted}),l.jsx("td",{children:t.totalLocalCurrency?.formatted}),l.jsx("td",{children:t.maxTaxableForeignCurrency?.formatted}),l.jsx("td",{children:t.taxableForeignCurrency?.formatted}),l.jsx("td",{children:t.taxableLocalCurrency?.formatted}),l.jsx("td",{children:t.excessExpenditure?.formatted})]},t.type))})]}),l.jsxs(b,{justify:"flex-end",children:[l.jsxs(b.Col,{lg:2,md:4,children:["Excess Expenditure Tax:",l.jsxs(S,{fz:"lg",children:[r.excessTax??"0","%"]})]}),l.jsx(b.Col,{lg:2,md:3,className:"flex flex-col justify-end",children:l.jsx(S,{fz:"lg",children:r.excessExpenditure?.formatted??"0.00"})})]})]}):l.jsx(S,{children:"Loading..."})};export{Xe as B,mo as C,b as G,Q as L,I as M,go as R,vo as S};
|
package/dist/assets/{toggle-expansion-button-Y2eS7nqg.js → toggle-expansion-button-Dg_XsE6y.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,T as l,B as p}from"./index-
|
|
1
|
+
import{j as n,T as l,B as p}from"./index-D1_HHRLX.js";import{P as r,a as c}from"./panel-top-open-Bxnxp1BU.js";function u(t){const{toggleExpansion:e,isExpanded:o,onClickAction:s}=t;return n.jsx(l,{content:"Expand info",children:n.jsx(p,{variant:o?"default":"outline",onClick:i=>{i.stopPropagation(),e(a=>(s&&s(a),!a))},className:"size-7.5",children:o?n.jsx(r,{className:"size-5"}):n.jsx(c,{className:"size-5"})})})}export{u as T};
|
package/dist/assets/{update-accountant-status-zL6vnwU9.js → update-accountant-status-CU6mIJqS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as w,g as C,hF as U,r as d,t as p,i as I,hG as j,hH as c,a4 as m,e as b,j as o,bZ as y,b_ as $,B as k,c0 as B,dU as v}from"./index-
|
|
1
|
+
import{v as w,g as C,hF as U,r as d,t as p,i as I,hG as j,hH as c,a4 as m,e as b,j as o,bZ as y,b_ as $,B as k,c0 as B,dU as v}from"./index-D1_HHRLX.js";const D=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],x=w("clock",D),N="updateBusinessTripAccountantApproval",E=()=>{const[{fetching:t},i]=C(U),u=d.useCallback(async e=>{const n=`Error toggling accountant approval for trip [${e.businessTripId}]`,a=`${N}-${e.businessTripId}`;p.loading("Updating accountant approval status",{id:a});try{const s=await i(e),r=I(s,n,a);if(r)return p.success("Success",{id:a,description:"Accountant approval status updated"}),r.updateBusinessTripAccountantApproval}catch(s){console.error(`${n}: ${s}`),p.error("Error",{id:a,description:n,duration:1e5,closeButton:!0})}},[i]);return{fetching:t,updateBusinessTripAccountantApproval:u}},S="updateChargeAccountantApproval",M=()=>{const[{fetching:t},i]=C(j),u=d.useCallback(async e=>{const n=`Error toggling accountant approval to ledger record ID [${e.chargeId}]`,a=`${S}-${e.chargeId}`;p.loading("Updating approval status",{id:a});try{const s=await i(e),r=I(s,n,a,"updateChargeAccountantApproval");if(r)return p.success("Success",{id:a,description:"Accountant approval was updated"}),r.updateChargeAccountantApproval}catch(s){console.error(`${n}: ${s}`),p.error("Error",{id:a,description:n,duration:1e5,closeButton:!0})}},[i]);return{fetching:t,updateChargeAccountantApproval:u}},O={[c.Approved]:{icon:b,color:"text-green-600",bgColor:"hover:bg-green-50",label:"Approved",value:c.Approved},[c.Pending]:{icon:x,color:"text-yellow-600",bgColor:"hover:bg-yellow-50",label:"Pending",value:c.Pending},[c.Unapproved]:{icon:m,color:"text-red-600",bgColor:"hover:bg-red-50",label:"Unapproved",value:c.Unapproved}},P=t=>O[t];function F(t){const{onChange:i,value:u}=t,[e,n]=d.useState(u??c.Unapproved),{updateChargeAccountantApproval:a}=M(),{updateBusinessTripAccountantApproval:s}=E(),r=P(e),T=r.icon,l=d.useCallback(async g=>{const f=e;n(g);let h=null;t.chargeId?h=await a({chargeId:t.chargeId,status:g}):t.businessTripId&&(h=await s({businessTripId:t.businessTripId,status:g})),h||n(f),i?.()},[t.chargeId,a,t.businessTripId,s,e,i]);d.useEffect(()=>{u&&n(u)},[u]);const A=!t.chargeId&&!t.businessTripId;return o.jsxs(y,{children:[o.jsx($,{asChild:!0,disabled:A,children:o.jsx(k,{variant:"ghost",size:"sm",className:`h-7 w-7 p-0 ${r.bgColor}`,title:r.label,disabled:A,children:o.jsx(T,{className:`h-3.5 w-3.5 ${r.color}`})})}),o.jsxs(B,{align:"center",children:[o.jsxs(v,{onClick:()=>l(c.Approved),children:[o.jsx(b,{className:"h-4 w-4 mr-2 text-green-600"}),"Approved"]}),o.jsxs(v,{onClick:()=>l(c.Pending),children:[o.jsx(x,{className:"h-4 w-4 mr-2 text-yellow-600"}),"Pending"]}),o.jsxs(v,{onClick:()=>l(c.Unapproved),children:[o.jsx(m,{className:"h-4 w-4 mr-2 text-red-600"}),"Unapproved"]})]})]})}export{F as U,O as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e,D,aL as C,bU as I,bV as E,B as p,ag as T,bW as P,x as k,dB as F,dC as A,J as v,W as f,L as y,dD as S,e as B,K as G,O,dE as M,bp as R,bh as L,dF as q,g as z,t as h,i as H,dG as V}from"./index-
|
|
1
|
+
import{r as a,j as e,D,aL as C,bU as I,bV as E,B as p,ag as T,bW as P,x as k,dB as F,dC as A,J as v,W as f,L as y,dD as S,e as B,K as G,O,dE as M,bp as R,bh as L,dF as q,g as z,t as h,i as H,dG as V}from"./index-D1_HHRLX.js";function K({onApprove:u,draft:o}){const[l,r]=a.useState(!1),s=t=>{u(t),r(!1)};return e.jsxs(D,{open:l,onOpenChange:r,children:[e.jsx(C,{asChild:!0,type:"button",children:e.jsxs(I,{children:[e.jsx(E,{asChild:!0,type:"button",children:e.jsx(p,{className:"size-7.5",variant:"secondary",onClick:()=>r(t=>!t),type:"button",children:e.jsx(T,{className:"size-5"})})}),e.jsx(P,{children:e.jsx("p",{children:"Edit document"})})]})}),e.jsx(k,{className:"w-7xl sm:max-w-[95%] max-h-[90vh] overflow-y-auto",children:e.jsx("div",{className:"min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Edit Document"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Modify and preview your accounting document before issuing"})]}),e.jsx(W,{onApprove:s,draft:o})]})})})]})}function W({onApprove:u,draft:o}){const[l,r]=a.useState(!1),[s,t]=a.useState(null),{previewDocument:d,fetching:i}=F(),[n,N]=a.useState(o),b=a.useCallback((c,m)=>{N(x=>({...x,[c]:m}))},[]);a.useEffect(()=>{r(!1)},[n]);const j=a.useCallback(async()=>{try{const c=await d({input:n});if(!c)throw new Error("No preview data returned");t(c),r(!0)}catch(c){console.error("Failed to generate preview:",c)}},[n,d]);a.useEffect(()=>{s||j()},[s,j]);const g=n.income?.reduce((c,m)=>{const x=m.price*m.quantity,w=x*((m.vatRate||0)/100);return c+x+w},0)||0;return e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{formData:n,updateFormData:b}),e.jsx(v,{children:e.jsxs(f,{className:"pt-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(p,{onClick:j,disabled:i||l,variant:"outline",className:"flex-1 bg-transparent",children:i?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),"Preview"]})}),e.jsxs(p,{onClick:()=>u(n),className:"flex-1",children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Accept Changes"]})]}),g>0&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"flex justify-between items-center font-medium text-blue-900",children:[e.jsx("span",{children:"Total Document Amount:"}),e.jsxs("span",{children:[g.toFixed(2)," ",n.currency]})]})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(v,{className:"h-fit",children:[e.jsx(G,{children:e.jsx(O,{children:"Document Preview"})}),e.jsx(f,{children:e.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50",children:i?e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"w-8 h-8 animate-spin mx-auto mb-4 text-gray-400"}),e.jsx("p",{className:"text-gray-500",children:"Generating document preview..."})]}):s?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"bg-white shadow-lg rounded-lg overflow-hidden",children:e.jsx("div",{className:"aspect-[8.5/11] bg-white border",children:e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(M,{src:s}),!l&&e.jsx("p",{className:"text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded",children:"Preview may be outdated"})]})})})})}):e.jsxs("div",{className:"text-center",children:[e.jsx(R,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-gray-500 mb-2",children:"No preview available"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Click Preview to generate document"})]})})})]}),n.client&&e.jsx(L,{businessId:n.client?.id,linkedDocumentIds:n.linkedDocumentIds??[]}),e.jsx(q,{documentType:n.type})]})]})}const $="issue-monthly-documents",U=()=>{const[{fetching:u},o]=z(V),l=a.useCallback(async r=>{const s="Error issuing monthly documents",t=$;h.loading("Issuing documents",{id:t});try{const d=await o(r),i=H(d,s,t);if(i?.issueGreenInvoiceDocuments?.success){h.success("Success",{id:t,description:"Documents issued successfully"});return}i?.issueGreenInvoiceDocuments?.errors&&console.error(i.issueGreenInvoiceDocuments.errors),h.error("Error",{id:t,description:s,duration:1e5,closeButton:!0})}catch(d){console.error(`${s}: ${d}`),h.error("Error",{id:t,description:s,duration:1e5,closeButton:!0})}},[o]);return{fetching:u,issueDocuments:l}};export{W as E,K as a,U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i4 as a,r as s}from"./index-
|
|
1
|
+
import{i4 as a,r as s}from"./index-D1_HHRLX.js";function c(){const{search:n}=a(),t=s.useMemo(()=>new URLSearchParams(n),[n]),r=s.useCallback(()=>{if(window.history.pushState){const o=t.keys().next().done?"":`?${t.toString()}`,e=window.location.protocol+"//"+window.location.host+window.location.pathname+o;window.history.pushState({path:e},"",e)}},[t]);return{query:t,queryString:()=>t.toString(),get:o=>t?.get(o),set:(o,e)=>{e==null?t.delete(o):t.set(o,e),r()}}}export{c as u};
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" href="/icons/accounter-logo.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Accounter</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-D1_HHRLX.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BbIoj0ZC.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -56,7 +56,7 @@ export function MergeChargesButton(props: {
|
|
|
56
56
|
</DialogTrigger>
|
|
57
57
|
<DialogContent className="w-[90vw] sm:max-w-[95%] max-h-[90vh] overflow-y-auto">
|
|
58
58
|
<DialogHeader>
|
|
59
|
-
<DialogTitle>
|
|
59
|
+
<DialogTitle>Merge Charges</DialogTitle>
|
|
60
60
|
</DialogHeader>
|
|
61
61
|
<MergeChargesSelectionForm
|
|
62
62
|
chargeIds={Array.from(distinctIDs)}
|
|
@@ -333,7 +333,7 @@ export function PreviewDocumentModal({
|
|
|
333
333
|
return (
|
|
334
334
|
<Dialog open={open} onOpenChange={setOpen}>
|
|
335
335
|
{(!setExternalOpen || !!trigger) && (
|
|
336
|
-
<DialogTrigger>
|
|
336
|
+
<DialogTrigger onClick={e => e.stopPropagation()}>
|
|
337
337
|
<Tooltip>
|
|
338
338
|
<TooltipTrigger>
|
|
339
339
|
{trigger ?? (
|
|
@@ -348,7 +348,10 @@ export function PreviewDocumentModal({
|
|
|
348
348
|
</Tooltip>
|
|
349
349
|
</DialogTrigger>
|
|
350
350
|
)}
|
|
351
|
-
<DialogContent
|
|
351
|
+
<DialogContent
|
|
352
|
+
className="w-[90vw] sm:max-w-[95%] max-h-[90vh] overflow-y-auto"
|
|
353
|
+
onClick={e => e.stopPropagation()}
|
|
354
|
+
>
|
|
352
355
|
<DialogHeader>
|
|
353
356
|
<DialogTitle>Issue New Document</DialogTitle>
|
|
354
357
|
</DialogHeader>
|
package/src/gql/graphql.ts
CHANGED
|
@@ -1669,7 +1669,7 @@ export type DocumentClientInput = {
|
|
|
1669
1669
|
phone?: InputMaybe<Scalars['String']['input']>;
|
|
1670
1670
|
self?: InputMaybe<Scalars['Boolean']['input']>;
|
|
1671
1671
|
taxId?: InputMaybe<Scalars['String']['input']>;
|
|
1672
|
-
|
|
1672
|
+
zipCode?: InputMaybe<Scalars['String']['input']>;
|
|
1673
1673
|
};
|
|
1674
1674
|
|
|
1675
1675
|
/** document discount info */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n,b as h,u,r as d,j as a,c as g,C as f}from"./index-rI994S3C.js";import{C as l}from"./charges-table-BJtpvXfL.js";import"./toggle-expansion-button-Y2eS7nqg.js";import"./panel-top-open-Bf39HBrp.js";import"./update-accountant-status-zL6vnwU9.js";import"./index-C7p19nIa.js";import"./similar-transactions-modal-DX3CPrMo.js";import"./building-2-CMKd_bU8.js";import"./addDays-DTiBTTns.js";import"./Table-BQv3frL8.js";import"./summary-CPKS_69D.js";import"./accordion-Bn08_4fN.js";import"./deposits-transactions-table-2rtRFZgK.js";import"./Checkbox-Dmuz3t7B.js";import"./data-table-column-header-CZ1dXiU0.js";import"./eye-off-Buv7eciz.js";const R=({chargeId:s})=>{const{chargeId:i}=n(),t=s||i;let r;try{r=h()}catch{}const[{data:c,fetching:m},e]=u({query:f,pause:!t||!!r,variables:{chargeId:t??""}});d.useEffect(()=>{t&&!r&&e()},[t,r,e]);const o=r||c,p=!r&&m;return t?p?a.jsx(g,{}):a.jsx(l,{data:o?.charge?[o.charge]:[],isAllOpened:!0}):a.jsx("div",{children:"Charge not found"})};export{R as Charge};
|