@accounter/client 0.0.9-alpha-20251231172137-dddfa0e87bba85e9878d2202a7a08c091d3a072c → 0.0.9-alpha-20260101081119-f4fd523dc93f219c8dca6d3d5df3081a060b4568
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 +17 -1
- package/dist/assets/{Checkbox-DjYfysLQ.js → Checkbox-CIjNLOvn.js} +1 -1
- package/dist/assets/{MultiSelect-BD7TiyFi.js → MultiSelect-E2FPCJdH.js} +1 -1
- package/dist/assets/{Progress-BGe6eqTK.js → Progress-DMJQvFdk.js} +1 -1
- package/dist/assets/{Table-CvPVUBGR.js → Table-0rvmS2wr.js} +1 -1
- package/dist/assets/{Typography-DYfTIQ9E.js → Typography-4nqQ7puF.js} +1 -1
- package/dist/assets/{YearPickerInput-KXBFZT0r.js → YearPickerInput-XVeVR1Oa.js} +1 -1
- package/dist/assets/{accordion-9oIj6aBX.js → accordion-L1IRyzyA.js} +1 -1
- package/dist/assets/{accountant-approvals--NVi1WNl.js → accountant-approvals-D3Rk9Awv.js} +1 -1
- package/dist/assets/{accounter-table-BPhdMaz1.js → accounter-table-DO07S-Ok.js} +1 -1
- package/dist/assets/{addDays-WRhtMNwP.js → addDays-B1nYv7cD.js} +1 -1
- package/dist/assets/{all-charges-arcBoOZI.js → all-charges-Bl4rmLPr.js} +1 -1
- package/dist/assets/{arrow-up-down-qrpLj_VC.js → arrow-up-down-RAyr4F6x.js} +1 -1
- package/dist/assets/{building-2-BqoUIYTv.js → building-2-CJWjJWAd.js} +1 -1
- package/dist/assets/{business-D1UESgbs.js → business-CD7jRx3V.js} +1 -1
- package/dist/assets/{business-extended-info-pVXBlqa8.js → business-extended-info-CZ8kd93o.js} +1 -1
- package/dist/assets/{business-header-JSRtchUY.js → business-header-DnJ4wJTw.js} +1 -1
- package/dist/assets/{business-ledger-filters-Dk6NSKoV.js → business-ledger-filters-b6ihKqcv.js} +1 -1
- package/dist/assets/{business-ledger-single-uvIkUZgL.js → business-ledger-single-CTJvfW-L.js} +1 -1
- package/dist/assets/{business-trip-C2CvWBAW.js → business-trip-D71-CjJS.js} +1 -1
- package/dist/assets/{charge-Lvg4y24H.js → charge-BKa3ocZT.js} +1 -1
- package/dist/assets/{charges-filters-B-sOEaZh.js → charges-filters-f-g5zs9d.js} +1 -1
- package/dist/assets/{charges-ledger-validation-CeANhh8s.js → charges-ledger-validation-C1uzo7m-.js} +1 -1
- package/dist/assets/{charges-table-BmIFJP9B.js → charges-table-BlXyOjYT.js} +1 -1
- package/dist/assets/{chart-CjKqHefu.js → chart-CVakbbuJ.js} +1 -1
- package/dist/assets/{contracts-COyusiVp.js → contracts-BEtzHuzD.js} +1 -1
- package/dist/assets/{data-table-column-header-Bb8YefMr.js → data-table-column-header-Dm4KLrte.js} +1 -1
- package/dist/assets/{data-table-pagination-B0lEp6Kn.js → data-table-pagination-DXDS4nhy.js} +1 -1
- package/dist/assets/{deposits-transactions-table-BGWV_o2J.js → deposits-transactions-table-CTYnxtJU.js} +1 -1
- package/dist/assets/{download-csv-button-BJBOkT9V.js → download-csv-button-BMcEBrSS.js} +1 -1
- package/dist/assets/{editable-business-trip-Cs82BdC1.js → editable-business-trip-Bp6IxoxB.js} +1 -1
- package/dist/assets/{eye-off-CzZqG4x5.js → eye-off-CEEw38cP.js} +1 -1
- package/dist/assets/{funnel-B_esqPkd.js → funnel-wCPsNKWN.js} +1 -1
- package/dist/assets/{index-DNh6yAJt.js → index-B0iyn-mI.js} +1 -1
- package/dist/assets/{index-CDf5ehig.js → index-B8pw7b-t.js} +1 -1
- package/dist/assets/{index-Cr98UVLb.js → index-BXce2cs4.js} +1 -1
- package/dist/assets/{index-BXTyDG4y.js → index-B_RJNtUo.js} +1 -1
- package/dist/assets/{index-D5_Z08Zt.js → index-Bhwo2jRi.js} +1 -1
- package/dist/assets/{index-DKa-18hA.js → index-Bnf9EGJh.js} +1 -1
- package/dist/assets/{index-BDqqTuZ7.js → index-BwIk76Fe.js} +1 -1
- package/dist/assets/{index-D6aqKVWr.js → index-CDqlmlUs.js} +1 -1
- package/dist/assets/{index-BSS6FK0T.js → index-CJQEWig2.js} +50 -50
- package/dist/assets/{index-DiSe2roU.js → index-CLejPZ03.js} +1 -1
- package/dist/assets/{index-BfD1LaZl.js → index-CeNpBiZt.js} +1 -1
- package/dist/assets/{index-Bk84cVaB.js → index-CoZLNRyy.js} +1 -1
- package/dist/assets/{index-CcgWtq-8.js → index-D740cLRg.js} +1 -1
- package/dist/assets/{index-BL3ZcZMt.js → index-D9594uhM.js} +1 -1
- package/dist/assets/{index-D3F32uWe.js → index-DI-u7X-4.js} +1 -1
- package/dist/assets/{index-sLf28GuC.js → index-DKpeP7IO.js} +1 -1
- package/dist/assets/{index-DptIXaYu.js → index-DM8ePwsN.js} +1 -1
- package/dist/assets/{index-DQVt2_1v.js → index-DMYTBz5s.js} +1 -1
- package/dist/assets/{index-Dl-yRsLc.js → index-DSnmInPt.js} +1 -1
- package/dist/assets/{index-ZKB1iywJ.js → index-Dc3RBoFY.js} +1 -1
- package/dist/assets/{index-DBDqi8y7.js → index-DpHMidPk.js} +1 -1
- package/dist/assets/{index-CkajRhzm.js → index-Dtg9Ebru.js} +1 -1
- package/dist/assets/{index-BkLi1t0h.js → index-MwL919Y6.js} +1 -1
- package/dist/assets/{index-ChCpA9LF.js → index-aKsfgLig.js} +1 -1
- package/dist/assets/{index-DhnrB3n7.js → index-oG-TuXTF.js} +1 -1
- package/dist/assets/{index-C5qooFq6.js → index-qmr8EzkY.js} +1 -1
- package/dist/assets/{index.es-CzYdazso.js → index.es-D5j_e-90.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-l81s3dH_.js → insert-business-trip-modal-DAddh4SL.js} +1 -1
- package/dist/assets/issue-document-DhsyLMjh.js +1 -0
- package/dist/assets/{list-plus-Bl9bDWr3.js → list-plus-D47DH24w.js} +1 -1
- package/dist/assets/{login-page-B2vj_Vi9.js → login-page-BrIhzx0o.js} +1 -1
- package/dist/assets/{match-document-modal-BW7Tu7Cn.js → match-document-modal-CIlUk8Ew.js} +1 -1
- package/dist/assets/{missing-info-charges-CxSW8wv4.js → missing-info-charges-D-yagKqj.js} +1 -1
- package/dist/assets/{modal-CnWz1mbU.js → modal-B-dHSlvi.js} +1 -1
- package/dist/assets/{modify-contract-dialog-kpUxLkRE.js → modify-contract-dialog-CPd5HePs.js} +1 -1
- package/dist/assets/{page-layout-D5L-cVYf.js → page-layout-B2gYTWUz.js} +1 -1
- package/dist/assets/{page-not-found-Dka294QE.js → page-not-found-DNb-8ubr.js} +1 -1
- package/dist/assets/{panel-top-open-BM-oB523.js → panel-top-open-et1B6Qub.js} +1 -1
- package/dist/assets/{report-commentary-row-BKrfBAWW.js → report-commentary-row-BEtZ8QZo.js} +1 -1
- package/dist/assets/{save-C3c_dc6e.js → save-DYKKYhD4.js} +1 -1
- package/dist/assets/{similar-transactions-modal-BSXSuyS_.js → similar-transactions-modal-DPUwmIYc.js} +1 -1
- package/dist/assets/{sub-DNnP4yzZ.js → sub-CP-0oRhw.js} +1 -1
- package/dist/assets/subMonths-Cu93C5UH.js +1 -0
- package/dist/assets/{summary-dBKqS0oP.js → summary-CzvCns1x.js} +1 -1
- package/dist/assets/{toggle-expansion-button-SCGtyuX7.js → toggle-expansion-button-CERf5wnd.js} +1 -1
- package/dist/assets/{use-issue-monthly-documents-B5iJSj4z.js → use-issue-monthly-documents-BxcraBxY.js} +1 -1
- package/dist/assets/{use-url-query-BNmqlRtS.js → use-url-query-B4uMZFi3.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/issue-document-DCyxZcVW.js +0 -1
- package/dist/assets/subMonths-BxrBFcPp.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,bA as w,bH as O,j as e,bB as K,B as c,aC as U,z,w as v,dq as _,V as B,dr as H,bD as D,bE as M,bF as I,Y as L,Z as q,_ as G,$ as Q,at as J,F as X,u as Y,bX as Z,L as $,ds as W,dt as ee,bN as te,bO as se,bP as S,bQ as ae,c1 as T,bR as ne,bS as k,bY as re,bZ as ie,b$ as le,c0 as oe,du as ce,c4 as de,c3 as me,c5 as ue}from"./index-BSS6FK0T.js";import{u as P}from"./use-url-query-BNmqlRtS.js";import{a as ge}from"./accounter-table-BPhdMaz1.js";import{D as he}from"./data-table-pagination-B0lEp6Kn.js";import{P as V}from"./modal-CnWz1mbU.js";import{P as xe}from"./page-layout-D5L-cVYf.js";import{F as pe}from"./funnel-B_esqPkd.js";import{M as R}from"./MultiSelect-BD7TiyFi.js";import{s as je}from"./sub-DNnP4yzZ.js";import{A as b}from"./arrow-up-down-qrpLj_VC.js";import"./Table-CvPVUBGR.js";import"./addDays-WRhtMNwP.js";import"./subMonths-BxrBFcPp.js";function fe({filter:t,setFilter:s,closeModal:x}){const{userContext:p}=r.useContext(U),h=z({defaultValues:{ownerIDs:p?.context.adminBusinessId?[p.context.adminBusinessId]:void 0,toDate:v(new Date,"yyyy-MM-dd"),fromDate:v(je(new Date,{years:1}),"yyyy-MM-dd"),...t}}),{control:o,handleSubmit:y}=h,{selectableFinancialEntities:i,fetching:d}=_(),C=a=>{s(a),x()};function m(){s({}),x()}return e.jsxs(e.Fragment,{children:[d?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(B,{...h,children:e.jsxs("form",{onSubmit:y(C),children:[e.jsxs(H,{cols:2,children:[e.jsx(D,{name:"ownerIDs",control:o,defaultValue:t.ownerIDs,render:({field:a,fieldState:g})=>e.jsx(R,{...a,data:i,value:a.value??[],disabled:d,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:g.error?.message,withinPortal:!0})}),e.jsx(D,{name:"businessIDs",control:o,defaultValue:t.businessIDs,render:({field:a,fieldState:g})=>e.jsx(R,{...a,data:i,value:a.value??[],disabled:d,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:g.error?.message,withinPortal:!0})}),e.jsx(D,{name:"fromDate",control:o,defaultValue:t.fromDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:g})=>e.jsx(I,{...a,onChange:l=>{const j=l?typeof l=="string"?l:v(l,"yyyy-MM-dd"):void 0;j!==a.value&&a.onChange(j)},value:a.value?new Date(a.value):void 0,error:g.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(D,{name:"toDate",control:o,defaultValue:t.toDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:g})=>e.jsx(I,{...a,onChange:l=>{const j=l?typeof l=="string"?l:v(l,"yyyy-MM-dd"):void 0;j!==a.value&&a.onChange(j)},value:a.value?new Date(a.value):void 0,error:g.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(L,{name:"unmatched",control:o,render:({field:a})=>e.jsxs(q,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(G,{children:"Unmatched only"})}),e.jsx(Q,{children:e.jsx(J,{defaultChecked:t.unmatched??!1,onCheckedChange:a.onChange})})]})})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:d,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:m,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:x,children:"Cancel"})]})]})})]})}function be({filter:t={},setFilter:s,initiallyOpened:x=!1}){const[p,h]=r.useState(x),[o,y]=r.useState(!w(t)),{get:i,set:d}=P();r.useEffect(()=>{const m=w(t)?null:encodeURIComponent(JSON.stringify(t)),a=i("documentsFilters");m!==a&&d("documentsFilters",m)},[t,i,d]);const C=r.useCallback(m=>{O(m,t)||(s(m),y(!w(m)))},[t,s]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(V,{opened:p,onClose:()=>h(!1),content:e.jsx(fe,{filter:t,setFilter:C,closeModal:()=>h(!1)}),modalSize:"xl"}),e.jsx(K,{inline:!0,size:16,disabled:!o,children:e.jsx(c,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>h(!0),children:e.jsx(pe,{className:"size-5"})})})]})}const E=[{accessorKey:"__typename",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Type"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>{const{__typename:s}=t.original;return e.jsx("div",{className:"text-left font-medium",children:s})}},{accessorKey:"image",header:()=>e.jsx("div",{className:"text-left",children:"Image"}),cell:({row:t})=>{const{image:s}=t.original;return e.jsx("div",{className:"text-left font-medium",children:s?e.jsx("img",{alt:"missing img",src:s?.toString(),height:80,width:80}):"No image"})}},{accessorKey:"file",header:()=>e.jsx("div",{className:"text-left",children:"File"}),cell:({row:t})=>{const{file:s}=t.original;return e.jsx("div",{className:"text-left font-medium",children:s&&e.jsx(c,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{target:"_blank",rel:"noreferrer",href:s?.toString(),children:"Open"})})})}},{accessorKey:"date",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Date"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"date"in t.original&&t.original.date?e.jsx("div",{className:"text-left font-medium",children:v(new Date(t.original.date),"dd/MM/yy")}):null},{accessorKey:"serialNumber",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Serial Number"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"serialNumber"in t.original&&t.original.serialNumber?e.jsx("div",{className:"text-left font-medium",children:t.original.serialNumber}):null},{accessorKey:"vat.raw",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"VAT"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"vat"in t.original&&t.original.vat?.formatted?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.vat.formatted}):null},{accessorKey:"amount.raw",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Amount"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"amount"in t.original&&t.original.amount?.formatted?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.amount.formatted}):null},{accessorKey:"creditor.name",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Creditor"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"creditor"in t.original&&t.original.creditor?.name?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.creditor.name}):null},{accessorKey:"debtor.name",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Debtor"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"debtor"in t.original&&t.original.debtor?.name?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.debtor.name}):null},{accessorKey:"charge.transactions[0].id",header:()=>e.jsx("div",{className:"text-left",children:"Related Transaction"}),cell:({row:t})=>t.original.charge?.transactions?.[0]?.id?e.jsx(ge,{items:t.original.charge?.transactions??[],columns:[{title:"Transaction Amount",value:s=>s?.amount.formatted},{title:"Transaction Created At",value:s=>s?.eventDate?v(new Date(s.eventDate),"dd/MM/yy"):null},{title:"Transaction Effective Date",value:s=>s?.effectiveDate?v(new Date(s.effectiveDate),"dd/MM/yy"):null},{title:"Transaction Description",value:s=>s?.sourceDescription}]}):"No Related Transaction"}],Ee=()=>{const[t,s]=r.useState(null),[x,p]=r.useState(!1),{get:h}=P(),o=h("documentsFilters"),y=r.useMemo(()=>{if(o)try{return JSON.parse(decodeURIComponent(o))}catch{return}},[o]),[i,d]=r.useState(y),[C,m]=r.useState([]),[a,g]=r.useState({}),{setFiltersContext:l}=r.useContext(X),[{data:j,fetching:F},N]=Y({query:ce,variables:{filters:i??{}},pause:!0});r.useEffect(()=>{i&&N()},[i,N]);const f=Z({data:j?.documentsByFilters??[],columns:E,getCoreRowModel:ue(),getPaginationRowModel:me(),onSortingChange:m,getSortedRowModel:de(),onColumnVisibilityChange:g,state:{sorting:C,columnVisibility:a}}),A=f.getState().pagination.pageIndex;return r.useEffect(()=>{l(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(he,{table:f}),e.jsx(be,{filter:i,setFilter:d,initiallyOpened:!i})]}))},[f,F,i,l,d,y,A]),e.jsx(xe,{title:"Documents",description:"All documents",headerActions:e.jsxs("div",{className:"flex items-center py-4 gap-4",children:[e.jsxs(re,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(c,{className:"ml-auto",children:"Columns"})}),e.jsx(le,{align:"end",children:f.getAllColumns().filter(n=>n.getCanHide()).map(n=>e.jsx(oe,{className:"capitalize",checked:n.getIsVisible(),onCheckedChange:u=>n.toggleVisibility(!!u),children:n.id},n.id))})]}),e.jsx(c,{onClick:()=>p(!0),children:"Upload Documents"})]}),children:F?e.jsx($,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx(W,{open:x,onOpenChange:p,onChange:N}),t&&e.jsx(V,{modalSize:"45%",content:e.jsx(ee,{src:t}),opened:!!t,onClose:()=>s(null)}),e.jsxs(te,{children:[e.jsx(se,{children:f.getHeaderGroups().map(n=>e.jsx(S,{children:n.headers.map(u=>e.jsx(ae,{children:u.isPlaceholder?null:T(u.column.columnDef.header,u.getContext())},u.id))},n.id))}),e.jsx(ne,{children:f.getRowModel().rows?.length?f.getRowModel().rows.map(n=>e.jsx(S,{"data-state":n.getIsSelected()&&"selected",children:n.getVisibleCells().map(u=>e.jsx(k,{children:T(u.column.columnDef.cell,u.getContext())},u.id))},n.id)):e.jsx(S,{children:e.jsx(k,{colSpan:E.length,className:"h-24 text-center",children:"No results."})})})]})]})})};export{Ee as DocumentsReport,E as columns};
|
|
1
|
+
import{r,bA as w,bH as O,j as e,bB as K,B as c,aC as U,z,w as v,dq as _,V as B,dr as H,bD as D,bE as M,bF as I,Y as L,Z as q,_ as G,$ as Q,at as J,F as X,u as Y,bX as Z,L as $,ds as W,dt as ee,bN as te,bO as se,bP as S,bQ as ae,c1 as T,bR as ne,bS as k,bY as re,bZ as ie,b$ as le,c0 as oe,du as ce,c4 as de,c3 as me,c5 as ue}from"./index-CJQEWig2.js";import{u as P}from"./use-url-query-B4uMZFi3.js";import{a as ge}from"./accounter-table-DO07S-Ok.js";import{D as he}from"./data-table-pagination-DXDS4nhy.js";import{P as V}from"./modal-B-dHSlvi.js";import{P as xe}from"./page-layout-B2gYTWUz.js";import{F as pe}from"./funnel-wCPsNKWN.js";import{M as R}from"./MultiSelect-E2FPCJdH.js";import{s as je}from"./sub-CP-0oRhw.js";import{A as b}from"./arrow-up-down-RAyr4F6x.js";import"./Table-0rvmS2wr.js";import"./addDays-B1nYv7cD.js";import"./subMonths-Cu93C5UH.js";function fe({filter:t,setFilter:s,closeModal:x}){const{userContext:p}=r.useContext(U),h=z({defaultValues:{ownerIDs:p?.context.adminBusinessId?[p.context.adminBusinessId]:void 0,toDate:v(new Date,"yyyy-MM-dd"),fromDate:v(je(new Date,{years:1}),"yyyy-MM-dd"),...t}}),{control:o,handleSubmit:y}=h,{selectableFinancialEntities:i,fetching:d}=_(),C=a=>{s(a),x()};function m(){s({}),x()}return e.jsxs(e.Fragment,{children:[d?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(B,{...h,children:e.jsxs("form",{onSubmit:y(C),children:[e.jsxs(H,{cols:2,children:[e.jsx(D,{name:"ownerIDs",control:o,defaultValue:t.ownerIDs,render:({field:a,fieldState:g})=>e.jsx(R,{...a,data:i,value:a.value??[],disabled:d,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:g.error?.message,withinPortal:!0})}),e.jsx(D,{name:"businessIDs",control:o,defaultValue:t.businessIDs,render:({field:a,fieldState:g})=>e.jsx(R,{...a,data:i,value:a.value??[],disabled:d,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:g.error?.message,withinPortal:!0})}),e.jsx(D,{name:"fromDate",control:o,defaultValue:t.fromDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:g})=>e.jsx(I,{...a,onChange:l=>{const j=l?typeof l=="string"?l:v(l,"yyyy-MM-dd"):void 0;j!==a.value&&a.onChange(j)},value:a.value?new Date(a.value):void 0,error:g.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(D,{name:"toDate",control:o,defaultValue:t.toDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:g})=>e.jsx(I,{...a,onChange:l=>{const j=l?typeof l=="string"?l:v(l,"yyyy-MM-dd"):void 0;j!==a.value&&a.onChange(j)},value:a.value?new Date(a.value):void 0,error:g.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(L,{name:"unmatched",control:o,render:({field:a})=>e.jsxs(q,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(G,{children:"Unmatched only"})}),e.jsx(Q,{children:e.jsx(J,{defaultChecked:t.unmatched??!1,onCheckedChange:a.onChange})})]})})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:d,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:m,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:x,children:"Cancel"})]})]})})]})}function be({filter:t={},setFilter:s,initiallyOpened:x=!1}){const[p,h]=r.useState(x),[o,y]=r.useState(!w(t)),{get:i,set:d}=P();r.useEffect(()=>{const m=w(t)?null:encodeURIComponent(JSON.stringify(t)),a=i("documentsFilters");m!==a&&d("documentsFilters",m)},[t,i,d]);const C=r.useCallback(m=>{O(m,t)||(s(m),y(!w(m)))},[t,s]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(V,{opened:p,onClose:()=>h(!1),content:e.jsx(fe,{filter:t,setFilter:C,closeModal:()=>h(!1)}),modalSize:"xl"}),e.jsx(K,{inline:!0,size:16,disabled:!o,children:e.jsx(c,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>h(!0),children:e.jsx(pe,{className:"size-5"})})})]})}const E=[{accessorKey:"__typename",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Type"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>{const{__typename:s}=t.original;return e.jsx("div",{className:"text-left font-medium",children:s})}},{accessorKey:"image",header:()=>e.jsx("div",{className:"text-left",children:"Image"}),cell:({row:t})=>{const{image:s}=t.original;return e.jsx("div",{className:"text-left font-medium",children:s?e.jsx("img",{alt:"missing img",src:s?.toString(),height:80,width:80}):"No image"})}},{accessorKey:"file",header:()=>e.jsx("div",{className:"text-left",children:"File"}),cell:({row:t})=>{const{file:s}=t.original;return e.jsx("div",{className:"text-left font-medium",children:s&&e.jsx(c,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{target:"_blank",rel:"noreferrer",href:s?.toString(),children:"Open"})})})}},{accessorKey:"date",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Date"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"date"in t.original&&t.original.date?e.jsx("div",{className:"text-left font-medium",children:v(new Date(t.original.date),"dd/MM/yy")}):null},{accessorKey:"serialNumber",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Serial Number"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"serialNumber"in t.original&&t.original.serialNumber?e.jsx("div",{className:"text-left font-medium",children:t.original.serialNumber}):null},{accessorKey:"vat.raw",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"VAT"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"vat"in t.original&&t.original.vat?.formatted?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.vat.formatted}):null},{accessorKey:"amount.raw",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Amount"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"amount"in t.original&&t.original.amount?.formatted?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.amount.formatted}):null},{accessorKey:"creditor.name",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Creditor"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"creditor"in t.original&&t.original.creditor?.name?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.creditor.name}):null},{accessorKey:"debtor.name",header:({column:t})=>e.jsxs(c,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[e.jsx("div",{className:"text-left",children:"Debtor"}),e.jsx(b,{className:"ml-2 h-4 w-4"})]}),cell:({row:t})=>"debtor"in t.original&&t.original.debtor?.name?e.jsx("div",{className:"text-left font-medium whitespace-nowrap",children:t.original.debtor.name}):null},{accessorKey:"charge.transactions[0].id",header:()=>e.jsx("div",{className:"text-left",children:"Related Transaction"}),cell:({row:t})=>t.original.charge?.transactions?.[0]?.id?e.jsx(ge,{items:t.original.charge?.transactions??[],columns:[{title:"Transaction Amount",value:s=>s?.amount.formatted},{title:"Transaction Created At",value:s=>s?.eventDate?v(new Date(s.eventDate),"dd/MM/yy"):null},{title:"Transaction Effective Date",value:s=>s?.effectiveDate?v(new Date(s.effectiveDate),"dd/MM/yy"):null},{title:"Transaction Description",value:s=>s?.sourceDescription}]}):"No Related Transaction"}],Ee=()=>{const[t,s]=r.useState(null),[x,p]=r.useState(!1),{get:h}=P(),o=h("documentsFilters"),y=r.useMemo(()=>{if(o)try{return JSON.parse(decodeURIComponent(o))}catch{return}},[o]),[i,d]=r.useState(y),[C,m]=r.useState([]),[a,g]=r.useState({}),{setFiltersContext:l}=r.useContext(X),[{data:j,fetching:F},N]=Y({query:ce,variables:{filters:i??{}},pause:!0});r.useEffect(()=>{i&&N()},[i,N]);const f=Z({data:j?.documentsByFilters??[],columns:E,getCoreRowModel:ue(),getPaginationRowModel:me(),onSortingChange:m,getSortedRowModel:de(),onColumnVisibilityChange:g,state:{sorting:C,columnVisibility:a}}),A=f.getState().pagination.pageIndex;return r.useEffect(()=>{l(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(he,{table:f}),e.jsx(be,{filter:i,setFilter:d,initiallyOpened:!i})]}))},[f,F,i,l,d,y,A]),e.jsx(xe,{title:"Documents",description:"All documents",headerActions:e.jsxs("div",{className:"flex items-center py-4 gap-4",children:[e.jsxs(re,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(c,{className:"ml-auto",children:"Columns"})}),e.jsx(le,{align:"end",children:f.getAllColumns().filter(n=>n.getCanHide()).map(n=>e.jsx(oe,{className:"capitalize",checked:n.getIsVisible(),onCheckedChange:u=>n.toggleVisibility(!!u),children:n.id},n.id))})]}),e.jsx(c,{onClick:()=>p(!0),children:"Upload Documents"})]}),children:F?e.jsx($,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx(W,{open:x,onOpenChange:p,onChange:N}),t&&e.jsx(V,{modalSize:"45%",content:e.jsx(ee,{src:t}),opened:!!t,onClose:()=>s(null)}),e.jsxs(te,{children:[e.jsx(se,{children:f.getHeaderGroups().map(n=>e.jsx(S,{children:n.headers.map(u=>e.jsx(ae,{children:u.isPlaceholder?null:T(u.column.columnDef.header,u.getContext())},u.id))},n.id))}),e.jsx(ne,{children:f.getRowModel().rows?.length?f.getRowModel().rows.map(n=>e.jsx(S,{"data-state":n.getIsSelected()&&"selected",children:n.getVisibleCells().map(u=>e.jsx(k,{children:T(u.column.columnDef.cell,u.getContext())},u.id))},n.id)):e.jsx(S,{children:e.jsx(k,{colSpan:E.length,className:"h-24 text-center",children:"No results."})})})]})]})})};export{Ee as DocumentsReport,E as columns};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as x,cd as h,G as T,r,j as s,bB as g,ce as j,F as B,T as w,at as C,L as v,a3 as E,cf as P}from"./index-
|
|
1
|
+
import{u as x,cd as h,G as T,r,j as s,bB as g,ce as j,F as B,T as w,at as C,L as v,a3 as E,cf as P}from"./index-CJQEWig2.js";import{E as y,P as L,C as b}from"./editable-business-trip-Bp6IxoxB.js";import{I as F}from"./insert-business-trip-modal-DAddh4SL.js";import{P as I}from"./page-layout-B2gYTWUz.js";import{A as m}from"./summary-CzvCns1x.js";import"./list-plus-D47DH24w.js";import"./Table-0rvmS2wr.js";import"./toggle-expansion-button-CERf5wnd.js";import"./panel-top-open-et1B6Qub.js";import"./MultiSelect-E2FPCJdH.js";import"./similar-transactions-modal-DPUwmIYc.js";const S=({data:d,isOpened:o,shouldValidate:l})=>{const e=T(j,d),[{data:i,fetching:a}]=x({pause:!l,query:h,variables:{id:e.id}}),c=r.useMemo(()=>l?i?.businessTrip&&(i.businessTrip.uncategorizedTransactions?.length||i?.businessTrip.summary?.errors?.length):!1,[i]),u=c||e?.accountantApproval!=="APPROVED";return s.jsxs(m.Item,{value:e.id,children:[s.jsx(m.Control,{children:s.jsx(g,{inline:!0,size:12,processing:a,disabled:!u,color:c?"red":"yellow",zIndex:"auto",children:e.name})}),s.jsx(m.Panel,{children:o&&s.jsx(y,{tripId:e.id,isExtended:!0},e.id)})]})},Q=()=>{const{setFiltersContext:d}=r.useContext(B),[o,l]=r.useState([]),[e,i]=r.useState(!1),[{data:a,fetching:c}]=x({query:P});r.useEffect(()=>{if(!a?.allBusinessTrips?.length){l([]);return}const t=a.allBusinessTrips.sort((n,p)=>n.dates?.start&&p.dates?.start?n.dates.start<p.dates.start?1:-1:n.dates?.start?-1:p.dates?.start?1:n.name.toLocaleLowerCase()<p.name.toLocaleLowerCase()?-1:1);l(t)},[a?.allBusinessTrips]);const[u,f]=r.useState([]);return r.useEffect(()=>{d(s.jsxs("div",{className:"flex flex-row gap-x-5",children:[s.jsx(F,{}),s.jsx(w,{content:"Toggle business trips validation",children:s.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[s.jsx(C,{checked:e??!1,onCheckedChange:t=>i(t)}),s.jsx("span",{className:"text-sm text-gray-500",children:"Validate"})]})}),s.jsx(L,{filename:"business_trips"})]}))},[a,c,d,e]),s.jsx(I,{title:"Business Trips",description:"Manage business trips",children:o.length===0&&c?s.jsx(v,{className:"h-10 w-10 animate-spin mr-2 self-center"}):s.jsx(b,{children:s.jsx(m,{className:"w-full",multiple:!0,value:u,onChange:f,chevron:s.jsx(E,{size:"1rem"}),styles:{chevron:{"&[data-rotate]":{transform:"rotate(45deg)"}}},children:o?.map(t=>s.jsx(S,{data:o.find(n=>n.id===t.id),shouldValidate:e,isOpened:u.includes(t.id)},t.id))})})})};export{Q as BusinessTrips};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as I,h as w,r as d,t as p,i as E,u as N,k as M,j as e,c as k,l as A,B as F,m as S,n as L,P as D,I as P,F as T,o as $,L as z,p as R,R as j,q as U,s as q}from"./index-
|
|
1
|
+
import{g as I,h as w,r as d,t as p,i as E,u as N,k as M,j as e,c as k,l as A,B as F,m as S,n as L,P as D,I as P,F as T,o as $,L as z,p as R,R as j,q as U,s as q}from"./index-CJQEWig2.js";import{u as v}from"./use-url-query-B4uMZFi3.js";import{B as O}from"./business-header-DnJ4wJTw.js";import{C as _,M as Q}from"./Checkbox-CIjNLOvn.js";import{P as V}from"./page-layout-B2gYTWUz.js";import"./building-2-CJWjJWAd.js";const H="mergeBusinesses",K=()=>{const[{fetching:a},o]=I(w),u=d.useCallback(async c=>{const l=`Error merging into business ID [${c.targetBusinessId}]`,n=`${H}-${c.targetBusinessId}`;p.loading("Merging Businesses",{id:n});try{const r=await o(c),t=E(r,l,n);if(t)return p.success("Success",{id:n,description:"Businesses merged"}),t.mergeBusinesses.id}catch(r){console.error(`${l}: ${r}`),p.error("Error",{id:n,description:l,duration:1e5,closeButton:!0})}},[o]);return{fetching:a,mergeBusinesses:u}};function G({businessIds:a,onDone:o,resetMerge:u}){const{mergeBusinesses:c,fetching:l}=K(),n=Array.from(new Set(a)),[{data:r,fetching:t}]=N({query:M,variables:{businessIds:n}}),[x,h]=d.useState(r?.businesses[0]),s=r?.businesses.length!==n.length&&"Some businesses were not Found"||void 0,m=r?.businesses||[],b=d.useCallback(async()=>{if(!x){p.error("Error",{description:"No main business selected"});return}if(n.length<2){p.error("Error",{description:"At least 2 businesses are required to execute a merge"});return}return await c({targetBusinessId:x.id,businessIdsToMerge:n.filter(g=>g!==x.id)}),u(),o()},[x,n,c,o,u]);return e.jsxs(e.Fragment,{children:[t&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx(k,{})}),!t&&s&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx("h3",{className:"sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900",children:s})}),!t&&!s&&e.jsxs(e.Fragment,{children:[e.jsxs("table",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:"Main"}),m.map(g=>e.jsx("td",{children:e.jsx("div",{className:"flex items-center justify-center mx-2 px-2 py-2 border-2 border-b-0 rounded-t-xl",children:e.jsx(_,{checked:g.id===x?.id,size:"xl",onClick:()=>{h(g)}})})},g.id))]}),e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),m.map(g=>e.jsx("td",{children:g.name},g.id))]})]}),e.jsxs("div",{className:"flex justify-center gap-5 mt-5",children:[e.jsx("button",{type:"button",className:" text-white bg-blue-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-blue-600 rounded-sm text-lg",disabled:t||l,onClick:b,children:"Accept"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:o,children:"Cancel"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:()=>{u(),o()},children:"Reset Merge"})]})]})]})}function J(a){const[o,{close:u,open:c}]=A(!1),{selected:l,resetMerge:n}=a,r=new Set(l.map(({id:m})=>m)),t=r.size>=1,[x,h]=d.useState(t?"default":"outline");d.useEffect(()=>{h(t?"default":"outline")},[t]);const s=d.useCallback(()=>{u(),l.map(({onChange:m})=>m())},[l,u]);return e.jsxs(e.Fragment,{children:[e.jsx(F,{onClick:()=>{t&&c()},disabled:!t,variant:x,className:S("size-7.5",t?" bg-blue-500 hover:bg-blue-500/90":""),size:"icon",children:e.jsx(Q,{className:"size-5"})}),e.jsx(L,{opened:o,onClose:u,size:"auto",centered:!0,children:e.jsx(G,{businessIds:Array.from(r),onDone:s,resetMerge:n})})]})}function W({activePage:a,setPage:o,totalPages:u=1,businessName:c,setBusinessName:l}){const{get:n,set:r}=v(),[t,x]=d.useState(c);d.useEffect(()=>{const s=a>0?a.toFixed(0):void 0,m=n("page");s!==m&&s!=="0"&&r("page",s)},[a,n,r]),d.useEffect(()=>{const s=setTimeout(()=>{l(t)},600);return()=>{clearTimeout(s)}},[t,l]);const h=s=>{x(s)};return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(D,{className:"flex-fit w-fit mx-0",currentPageIndex:a,onChange:o,totalPages:u}),e.jsx(P,{className:"w-72",placeholder:"Business Name",defaultValue:c??void 0,onChange:s=>h(s.target.value===""?void 0:s.target.value)})]})}const ne=()=>{const{get:a}=v(),[o,u]=d.useState(a("page")?Number(a("page")):0),[c,l]=d.useState(a("name")?a("name"):void 0),{setFiltersContext:n}=d.useContext(T),[{data:r,fetching:t},x]=N({query:q,variables:{page:o,limit:100,name:c}}),h=$(),[s,m]=d.useState([]),b=d.useCallback((i,f)=>{s.map(B=>B.id).includes(i)?m(s.filter(B=>B.id!==i)):m([...s,{id:i,onChange:f}])},[s]);function g(){m([])}d.useEffect(()=>{n(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(W,{activePage:o,setPage:u,businessName:c,setBusinessName:l,totalPages:r?.allBusinesses?.pageInfo.totalPages}),e.jsx(J,{selected:s,resetMerge:g})]}))},[r,o,c,n,u,l,s]);const y=r?.allBusinesses?.nodes.filter(i=>i.__typename==="LtdFinancialEntity").sort((i,f)=>i.name.toLowerCase()>f.name.toLowerCase()?1:-1)??[],C=new Set(s.map(i=>i.id));return e.jsx(V,{title:`Businesses (${r?.allBusinesses?.pageInfo.totalRecords??""})`,description:"All businesses",headerActions:e.jsx("div",{className:"flex items-center py-4 gap-4",children:e.jsx(U,{description:"",onAdd:()=>x()})}),children:t?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(z,{className:S("h-10 w-10 animate-spin mr-2")})}):e.jsx("div",{className:"space-y-2",children:y.map(i=>e.jsx("div",{className:"group relative border rounded-lg hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"pl-4 flex items-center",children:e.jsx(R,{checked:C.has(i.id),onCheckedChange:()=>{b(i.id,()=>{})},className:"h-4 w-4 rounded border-gray-300 cursor-pointer",onClick:f=>f.stopPropagation()})}),e.jsx("div",{role:"button",tabIndex:0,className:"flex-1 cursor-pointer",onClick:()=>{h(j.BUSINESSES.DETAIL(i.id),{state:{from:j.BUSINESSES.ALL}})},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),h(j.BUSINESSES.DETAIL(i.id),{state:{from:j.BUSINESSES.ALL}}))},children:e.jsx(O,{data:i})})]})},i.id))})})};export{ne as Businesses};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,B as u,a as y,F as g,u as P,L as D,gd as w}from"./index-
|
|
1
|
+
import{r as c,j as e,B as u,a as y,F as g,u as P,L as D,gd as w}from"./index-CJQEWig2.js";import{d as R}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{P as E}from"./page-layout-B2gYTWUz.js";import{R as d}from"./report-commentary-row-BEtZ8QZo.js";import{P as v}from"./modal-B-dHSlvi.js";import{Y as p}from"./YearPickerInput-XVeVR1Oa.js";import{F}from"./funnel-wCPsNKWN.js";import{T as C}from"./Table-0rvmS2wr.js";import"./toggle-expansion-button-CERf5wnd.js";import"./panel-top-open-et1B6Qub.js";function A({year:l,setYear:h,referenceYears:o,setReferenceYears:j}){const[m,x]=c.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(v,{opened:m,onClose:()=>x(!1),withCloseButton:!0,content:e.jsxs(e.Fragment,{children:[e.jsx(p,{label:"Change report year",value:new Date(l,0,1),onChange:n=>n&&h(n?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),e.jsx(p,{type:"multiple",label:"Pick reference years",value:o?.map(n=>new Date(n,0,1)),onChange:n=>j(n.map(i=>i.getFullYear()).filter(i=>l!==i)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),e.jsx(u,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>x(!0),children:e.jsx(F,{className:"size-5"})})]})}const I=()=>{const{year:l}=y(),{setFiltersContext:h}=c.useContext(g),[o,j]=c.useState(l?Number(l):new Date().getFullYear()),[m,x]=c.useState([]),[{data:n,fetching:i}]=P({query:R(w),variables:{reportYear:o,referenceYears:m}});c.useEffect(()=>{h(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(A,{year:o,setYear:j,referenceYears:m,setReferenceYears:x})}))},[o,i,h,m,x]);const f=n?.profitAndLossReport,r=f?.report,s=f?.reference??[];return e.jsx(E,{title:"Profit and Loss Report",children:i?e.jsx(D,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:r&&e.jsxs(C,{highlightOnHover:!0,fontSize:"md",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{children:o},o),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.year},t.year))]})}),e.jsxs("tbody",{children:[e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("th",{children:"Revenue"}),e.jsx("th",{children:r.revenue.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("th",{children:a.revenue.amount.formatted},a.year))]}),commentaryData:r.revenue}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Cost of Sales"}),e.jsx("td",{children:r.costOfSales.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.costOfSales.amount.formatted},a.year))]}),commentaryData:r.costOfSales}),e.jsxs("tr",{children:[e.jsx("th",{children:"Gross Profit"}),e.jsx("th",{children:r.grossProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.grossProfit.formatted},t.year))]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses"}),e.jsx("td",{children:r.researchAndDevelopmentExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.researchAndDevelopmentExpenses.amount.formatted},a.year))]}),commentaryData:r.researchAndDevelopmentExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Marketing Expenses"}),e.jsx("td",{children:r.marketingExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.marketingExpenses.amount.formatted},a.year))]}),commentaryData:r.marketingExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Management and General Expenses"}),e.jsx("td",{children:r.managementAndGeneralExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.managementAndGeneralExpenses.amount.formatted},a.year))]}),commentaryData:r.managementAndGeneralExpenses}),e.jsxs("tr",{children:[e.jsx("th",{children:"Operating Profit"}),e.jsx("th",{children:r.operatingProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.operatingProfit.formatted},t.year))]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Financial Expenses"}),e.jsx("td",{children:r.financialExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.financialExpenses.amount.formatted},a.year))]}),commentaryData:r.financialExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Other Income"}),e.jsx("td",{children:r.otherIncome.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.otherIncome.amount.formatted},a.year))]}),commentaryData:r.otherIncome}),e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:r.profitBeforeTax.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.profitBeforeTax.formatted},t.year))]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Tax"}),e.jsx("td",{children:r.tax.formatted}),e.jsx("td",{}),s.map(t=>e.jsx("td",{children:t.tax.formatted},t.year))]})]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Net Profit"}),e.jsx("th",{children:r.netProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.netProfit.formatted},t.year))]})})]})})})};export{I as ProfitAndLossReport};
|