@accounter/client 0.0.8-alpha-20251023071611-4357687c6963ad74c80f62140eb0de9252d7bca7 → 0.0.8-alpha-20251023122652-765c7f951395441461726b3b4345eebd020632d7

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-iZ--iyJF.js → Checkbox-CpANMiXr.js} +1 -1
  3. package/dist/assets/{Progress-CSjfE5bV.js → Progress-BEKiyNRK.js} +1 -1
  4. package/dist/assets/{Typography-D14P1nN1.js → Typography-C0c5augK.js} +1 -1
  5. package/dist/assets/{accordion-CcwG2M8I.js → accordion-ZFVTCyDy.js} +1 -1
  6. package/dist/assets/{accountant-approvals-3mWk2IJb.js → accountant-approvals-CpzuSBgK.js} +1 -1
  7. package/dist/assets/{all-charges-kAC8rw9C.js → all-charges-BTyaAlp7.js} +1 -1
  8. package/dist/assets/{arrow-up-down-BS_znu7y.js → arrow-up-down-PQdrJdei.js} +1 -1
  9. package/dist/assets/{business-Cv0e_Q3p.js → business-DiQFqEHI.js} +1 -1
  10. package/dist/assets/{business-transactions-single-B23INPyA.js → business-transactions-single-DJqvqlMO.js} +1 -1
  11. package/dist/assets/{business-trip-c4pY18e_.js → business-trip-BXAjI1mO.js} +1 -1
  12. package/dist/assets/{charges-filters-DaVBQ_jS.js → charges-filters-r7FjeZLc.js} +1 -1
  13. package/dist/assets/{charges-ledger-validation-DZtDlOTx.js → charges-ledger-validation-CFc_zJFO.js} +1 -1
  14. package/dist/assets/{chart-BgPuhGqj.js → chart-C5LuxRSv.js} +1 -1
  15. package/dist/assets/{data-table-pagination-P75qqcV4.js → data-table-pagination-g2cF8_uB.js} +1 -1
  16. package/dist/assets/{editable-business-trip-80Bf0nf4.js → editable-business-trip-DyQsUJjl.js} +1 -1
  17. package/dist/assets/{index-ASrM5c3z.js → index-2g0J28D2.js} +1 -1
  18. package/dist/assets/{index-BIiK-vW-.js → index-6-J73JPC.js} +1 -1
  19. package/dist/assets/{index-CmRugx3-.js → index-B5j8Fmt8.js} +1 -1
  20. package/dist/assets/{index-D-K_l8g8.js → index-BSBV6pv2.js} +1 -1
  21. package/dist/assets/{index-1yUzw9-e.js → index-BSg8ocop.js} +1 -1
  22. package/dist/assets/{index-BopVOgtm.js → index-Bpef3vuz.js} +1 -1
  23. package/dist/assets/{index-CNBPVFd1.js → index-BziuNiXZ.js} +1 -1
  24. package/dist/assets/{index-DfYVR_1G.js → index-C0OGGVXE.js} +1 -1
  25. package/dist/assets/{index-Cca4zCek.js → index-C7KKktQ5.js} +1 -1
  26. package/dist/assets/{index-Ucx6U5YY.js → index-C99l-a0m.js} +1 -1
  27. package/dist/assets/{index-DmBjrSud.js → index-CE3kLG2a.js} +1 -1
  28. package/dist/assets/{index-D3y74IdY.js → index-CJdrnxxy.js} +1 -1
  29. package/dist/assets/{index-iLt1WIM9.js → index-CN2818Wt.js} +167 -167
  30. package/dist/assets/{index-Bt1Iynf-.js → index-CjDRKTTf.js} +1 -1
  31. package/dist/assets/{index-Buu6jU2e.js → index-D2xdQJAx.js} +1 -1
  32. package/dist/assets/{index-BtF8NkXw.js → index-DGvh10a7.js} +1 -1
  33. package/dist/assets/{index-BUJZ6CG6.js → index-DLI6Z9VU.js} +1 -1
  34. package/dist/assets/{index-DWdQvLZN.js → index-DXL1qPt9.js} +1 -1
  35. package/dist/assets/{index-DUDlwA28.js → index-Is4LJW4y.js} +1 -1
  36. package/dist/assets/{index-D7rFUnXc.js → index-S6eSocQH.js} +1 -1
  37. package/dist/assets/{index-CgVLV78R.js → index-T-JiUNDA.js} +1 -1
  38. package/dist/assets/{index-D0eVaZI5.js → index-gBZ-7Z07.js} +1 -1
  39. package/dist/assets/{index-BwJkbwi9.js → index-o_W5PWRq.js} +1 -1
  40. package/dist/assets/{index.es-VMf2fRct.js → index.es-DZgQ4YcV.js} +1 -1
  41. package/dist/assets/{issue-document-BustWthK.js → issue-document-D-JoFiMZ.js} +1 -1
  42. package/dist/assets/{login-page-DbBOFdaj.js → login-page-DsHy5amR.js} +1 -1
  43. package/dist/assets/{missing-info-charges-sf4ZGQoC.js → missing-info-charges-CPnjfjfW.js} +1 -1
  44. package/dist/assets/page-not-found-CYmXF0n2.js +1 -0
  45. package/dist/assets/{pencil-1-tPx_Bq.js → pencil-BUwX_eHK.js} +1 -1
  46. package/dist/assets/{report-commentary-row-BqTwvfOv.js → report-commentary-row-Bpvvtwpd.js} +1 -1
  47. package/dist/assets/{save-CMGkGXCM.js → save-Ck68rh6u.js} +1 -1
  48. package/dist/assets/{similar-charges-by-business-modal-Dj7iCQhJ.js → similar-charges-by-business-modal-bUtiFfAw.js} +1 -1
  49. package/dist/assets/{sub-3l-gAINS.js → sub-C2zifPY5.js} +1 -1
  50. package/dist/assets/subMonths-uUfFviD2.js +1 -0
  51. package/dist/index.html +1 -1
  52. package/package.json +1 -1
  53. package/src/providers/urql-client.ts +2 -29
  54. package/src/providers/urql-error-handler.ts +27 -0
  55. package/src/providers/urql.tsx +2 -29
  56. package/dist/assets/page-not-found-CzE13z4R.js +0 -1
  57. package/dist/assets/subMonths-LVothVpu.js +0 -1
@@ -1 +1 @@
1
- import{j as e,ds as D,dw as t,Y as y,cV as n,D as N,eQ as v,d0 as T,r as d,u as w,d3 as A,ao as I,ap as O,B as S,d2 as P,ar as L,k as M,dk as U,l as V,a4 as f,a5 as C,a6 as R,a7 as q,aQ as B,a9 as F,aO as k,aC as Q,F as $,U as _,a as z,c as H,w as G,dq as J,dr as K,dt as o,dv as W,eR as X}from"./index-iLt1WIM9.js";const Z=({record:a})=>{const s=N(v,a);return e.jsxs(D,{children:[e.jsx(t,{children:a.description}),e.jsx(t,{children:y(new Date(a.purchaseDate),"dd/MM/yyyy")}),e.jsx(t,{children:a.activationDate?y(new Date(a.activationDate),"dd/MM/yyyy"):void 0}),e.jsx(t,{children:s.originalCost?n(s.originalCost,0):void 0}),e.jsx(t,{children:s.reportYearDelta?n(s.reportYearDelta,0):void 0}),e.jsx(t,{children:n(s.totalDepreciableCosts,0)}),e.jsxs(t,{children:[n(a.statutoryDepreciationRate,0),"%"]}),e.jsx(t,{children:a.claimedDepreciationRate?`${n(a.claimedDepreciationRate,1)}%`:"-"}),e.jsx(t,{children:s.reportYearClaimedDepreciation?n(s.reportYearClaimedDepreciation,0):"-"}),e.jsx(t,{children:s.pastYearsAccumulatedDepreciation?n(s.pastYearsAccumulatedDepreciation,0):"-"}),e.jsx(t,{children:s.totalDepreciation?n(s.totalDepreciation,0):"-"}),e.jsx(t,{children:s.netValue?n(s.netValue,0):"-"})]})};function Y(a){return!a||T(a)?null:encodeURIComponent(JSON.stringify(a))}const b="depreciationReportFilters";function ee({filter:a,setFilter:s,close:r}){const p=M({defaultValues:{...a}}),{control:c,handleSubmit:x}=p,{selectableFinancialEntities:u,fetching:l}=U(),j=i=>{s({...i,year:Number(i.year)}),r()};return e.jsx(V,{...p,children:e.jsxs("form",{onSubmit:x(j),className:"space-y-4",children:[e.jsx(f,{name:"year",control:c,rules:{required:"Year is required",validate:i=>{const m=Number(i);return Number.isNaN(m)||m<2e3||m>2100?"Invalid year":!0}},render:({field:i})=>e.jsxs(C,{children:[e.jsx(R,{children:"Year"}),e.jsx(q,{children:e.jsx(B,{...i,hideControls:!0,decimalScale:0})}),e.jsx(F,{})]})}),e.jsx(f,{name:"financialEntityId",defaultValue:a?.financialEntityId,control:c,render:({field:i})=>e.jsxs(C,{children:[e.jsx(R,{children:"Owner"}),e.jsx(k,{...i,data:u,value:i.value??void 0,disabled:l,placeholder:"Select a financial entity",formPart:!0}),e.jsx(F,{})]})}),e.jsx(Q,{children:e.jsx(S,{type:"submit",disabled:l,children:"Filter"})})]})})}function ae({filter:a,setFilter:s}){const[r,p]=d.useState(!1),{get:c,set:x}=w();d.useEffect(()=>{const l=Y(a),j=c(b);l!==j&&x(b,l)},[a,c,x]);const u=d.useCallback(l=>{A(l,a)||s(l)},[a,s]);return e.jsxs(I,{open:r,onOpenChange:p,children:[e.jsx(O,{asChild:!0,children:e.jsx(S,{variant:"outline",size:"icon",children:e.jsx(P,{size:20})})}),e.jsx(L,{className:"sm:max-w-[425px]",children:e.jsx(ee,{filter:a,setFilter:u,close:()=>p(!1)})})]})}const g=({data:a,groupName:s})=>{const r=N(v,a);return e.jsxs(D,{className:"font-bold border-b border-black",children:[e.jsx(t,{children:s?"Group Total":"Overall Total"}),e.jsx(t,{colSpan:2,children:s}),e.jsx(t,{children:r.originalCost?n(r.originalCost,0):void 0}),e.jsx(t,{children:r.reportYearDelta?n(r.reportYearDelta,0):void 0}),e.jsx(t,{children:r.totalDepreciableCosts?n(r.totalDepreciableCosts,0):void 0}),e.jsx(t,{}),e.jsx(t,{}),e.jsx(t,{children:r.reportYearClaimedDepreciation?n(r.reportYearClaimedDepreciation,0):void 0}),e.jsx(t,{children:r.pastYearsAccumulatedDepreciation?n(r.pastYearsAccumulatedDepreciation,0):void 0}),e.jsx(t,{children:r.totalDepreciation?n(r.totalDepreciation,0):void 0}),e.jsx(t,{children:r.netValue?n(r.netValue,0):void 0})]})};function te(a){const s=new URLSearchParams,r=Y(a);return r&&s.append(b,r),`/reports/depreciation${s.size>0?`?${s}`:""}`}const re=()=>{const{setFiltersContext:a}=d.useContext($),{userContext:s}=d.useContext(_),{get:r}=w(),p=d.useMemo(()=>{const i={financialEntityId:s?.context.adminBusinessId,year:new Date().getFullYear()},m=r(b);if(m)try{return JSON.parse(decodeURIComponent(m))}catch(h){console.error("Failed to parse depreciation report filters from URL",h)}return i},[s?.context.adminBusinessId]),[c,x]=d.useState(p),[{data:u,fetching:l}]=z({query:X,variables:{filters:c}});d.useEffect(()=>{a(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(ae,{filter:c,setFilter:x})}))},[c,a,x]);const j=d.useMemo(()=>`Depreciation Report for ${c.year}`,[c.year]);return e.jsx(H,{title:"Depreciation Report",description:j,children:l?e.jsx(G,{}):e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsxs(D,{className:"font-bold text-xl",children:[e.jsx(o,{colSpan:6,className:"text-center border-x",children:"List of Assets and Costs"}),e.jsx(o,{colSpan:5,className:"text-center border-x",children:"Depreciation"}),e.jsx(o,{className:"text-center border-x",children:"Remaining"})]}),e.jsxs(D,{className:"border-b border-black",children:[e.jsx(o,{className:"whitespace-normal",children:"Assets List and Descriptions"}),e.jsx(o,{className:"whitespace-normal",children:"Date of Purchase"}),e.jsx(o,{className:"whitespace-normal",children:"Activation Date"}),e.jsx(o,{className:"whitespace-normal",children:"Original Cost"}),e.jsx(o,{className:"whitespace-normal",children:"Changes During the Year"}),e.jsx(o,{className:"whitespace-normal",children:"Total Depreciable Assets"}),e.jsx(o,{className:"whitespace-normal",children:"Statutory Depreciation Rate"}),e.jsx(o,{className:"whitespace-normal",children:"Claimed Depreciation Rate"}),e.jsx(o,{className:"whitespace-normal",children:"Depreciation Claimed This Year"}),e.jsx(o,{className:"whitespace-normal",children:"Previous Tax Years Accumulated Depreciation"}),e.jsx(o,{className:"whitespace-normal",children:"Total Depreciation"}),e.jsx(o,{className:"whitespace-normal",children:"Net Book Value"})]})]}),e.jsx(W,{children:u?.depreciationReport&&e.jsxs(e.Fragment,{children:[u.depreciationReport.categories.map((i,m)=>e.jsxs(d.Fragment,{children:[e.jsxs(D,{className:"font-bold",children:[e.jsx(t,{children:`Category ${m+1}`}),e.jsx(t,{colSpan:2,children:i.category.name}),e.jsx(t,{colSpan:3}),e.jsxs(t,{children:[n(i.category.percentage,0),"%"]}),e.jsx(t,{colSpan:5})]}),i.records.sort((h,E)=>h.purchaseDate.localeCompare(E.purchaseDate)).map(h=>e.jsx(Z,{record:h},h.id)),e.jsx(g,{data:i.summary,groupName:i.category.name})]},i.id)),e.jsx(g,{data:u.depreciationReport.summary})]})})]})})};export{re as DepreciationReport,te as getDepreciationReportHref};
1
+ import{j as e,ds as D,dw as t,Y as y,cV as n,D as N,eQ as v,d0 as T,r as d,u as w,d3 as A,ao as I,ap as O,B as S,d2 as P,ar as L,k as M,dk as U,l as V,a4 as f,a5 as C,a6 as R,a7 as q,aQ as B,a9 as F,aO as k,aC as Q,F as $,U as _,a as z,c as H,w as G,dq as J,dr as K,dt as o,dv as W,eR as X}from"./index-CN2818Wt.js";const Z=({record:a})=>{const s=N(v,a);return e.jsxs(D,{children:[e.jsx(t,{children:a.description}),e.jsx(t,{children:y(new Date(a.purchaseDate),"dd/MM/yyyy")}),e.jsx(t,{children:a.activationDate?y(new Date(a.activationDate),"dd/MM/yyyy"):void 0}),e.jsx(t,{children:s.originalCost?n(s.originalCost,0):void 0}),e.jsx(t,{children:s.reportYearDelta?n(s.reportYearDelta,0):void 0}),e.jsx(t,{children:n(s.totalDepreciableCosts,0)}),e.jsxs(t,{children:[n(a.statutoryDepreciationRate,0),"%"]}),e.jsx(t,{children:a.claimedDepreciationRate?`${n(a.claimedDepreciationRate,1)}%`:"-"}),e.jsx(t,{children:s.reportYearClaimedDepreciation?n(s.reportYearClaimedDepreciation,0):"-"}),e.jsx(t,{children:s.pastYearsAccumulatedDepreciation?n(s.pastYearsAccumulatedDepreciation,0):"-"}),e.jsx(t,{children:s.totalDepreciation?n(s.totalDepreciation,0):"-"}),e.jsx(t,{children:s.netValue?n(s.netValue,0):"-"})]})};function Y(a){return!a||T(a)?null:encodeURIComponent(JSON.stringify(a))}const b="depreciationReportFilters";function ee({filter:a,setFilter:s,close:r}){const p=M({defaultValues:{...a}}),{control:c,handleSubmit:x}=p,{selectableFinancialEntities:u,fetching:l}=U(),j=i=>{s({...i,year:Number(i.year)}),r()};return e.jsx(V,{...p,children:e.jsxs("form",{onSubmit:x(j),className:"space-y-4",children:[e.jsx(f,{name:"year",control:c,rules:{required:"Year is required",validate:i=>{const m=Number(i);return Number.isNaN(m)||m<2e3||m>2100?"Invalid year":!0}},render:({field:i})=>e.jsxs(C,{children:[e.jsx(R,{children:"Year"}),e.jsx(q,{children:e.jsx(B,{...i,hideControls:!0,decimalScale:0})}),e.jsx(F,{})]})}),e.jsx(f,{name:"financialEntityId",defaultValue:a?.financialEntityId,control:c,render:({field:i})=>e.jsxs(C,{children:[e.jsx(R,{children:"Owner"}),e.jsx(k,{...i,data:u,value:i.value??void 0,disabled:l,placeholder:"Select a financial entity",formPart:!0}),e.jsx(F,{})]})}),e.jsx(Q,{children:e.jsx(S,{type:"submit",disabled:l,children:"Filter"})})]})})}function ae({filter:a,setFilter:s}){const[r,p]=d.useState(!1),{get:c,set:x}=w();d.useEffect(()=>{const l=Y(a),j=c(b);l!==j&&x(b,l)},[a,c,x]);const u=d.useCallback(l=>{A(l,a)||s(l)},[a,s]);return e.jsxs(I,{open:r,onOpenChange:p,children:[e.jsx(O,{asChild:!0,children:e.jsx(S,{variant:"outline",size:"icon",children:e.jsx(P,{size:20})})}),e.jsx(L,{className:"sm:max-w-[425px]",children:e.jsx(ee,{filter:a,setFilter:u,close:()=>p(!1)})})]})}const g=({data:a,groupName:s})=>{const r=N(v,a);return e.jsxs(D,{className:"font-bold border-b border-black",children:[e.jsx(t,{children:s?"Group Total":"Overall Total"}),e.jsx(t,{colSpan:2,children:s}),e.jsx(t,{children:r.originalCost?n(r.originalCost,0):void 0}),e.jsx(t,{children:r.reportYearDelta?n(r.reportYearDelta,0):void 0}),e.jsx(t,{children:r.totalDepreciableCosts?n(r.totalDepreciableCosts,0):void 0}),e.jsx(t,{}),e.jsx(t,{}),e.jsx(t,{children:r.reportYearClaimedDepreciation?n(r.reportYearClaimedDepreciation,0):void 0}),e.jsx(t,{children:r.pastYearsAccumulatedDepreciation?n(r.pastYearsAccumulatedDepreciation,0):void 0}),e.jsx(t,{children:r.totalDepreciation?n(r.totalDepreciation,0):void 0}),e.jsx(t,{children:r.netValue?n(r.netValue,0):void 0})]})};function te(a){const s=new URLSearchParams,r=Y(a);return r&&s.append(b,r),`/reports/depreciation${s.size>0?`?${s}`:""}`}const re=()=>{const{setFiltersContext:a}=d.useContext($),{userContext:s}=d.useContext(_),{get:r}=w(),p=d.useMemo(()=>{const i={financialEntityId:s?.context.adminBusinessId,year:new Date().getFullYear()},m=r(b);if(m)try{return JSON.parse(decodeURIComponent(m))}catch(h){console.error("Failed to parse depreciation report filters from URL",h)}return i},[s?.context.adminBusinessId]),[c,x]=d.useState(p),[{data:u,fetching:l}]=z({query:X,variables:{filters:c}});d.useEffect(()=>{a(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(ae,{filter:c,setFilter:x})}))},[c,a,x]);const j=d.useMemo(()=>`Depreciation Report for ${c.year}`,[c.year]);return e.jsx(H,{title:"Depreciation Report",description:j,children:l?e.jsx(G,{}):e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsxs(D,{className:"font-bold text-xl",children:[e.jsx(o,{colSpan:6,className:"text-center border-x",children:"List of Assets and Costs"}),e.jsx(o,{colSpan:5,className:"text-center border-x",children:"Depreciation"}),e.jsx(o,{className:"text-center border-x",children:"Remaining"})]}),e.jsxs(D,{className:"border-b border-black",children:[e.jsx(o,{className:"whitespace-normal",children:"Assets List and Descriptions"}),e.jsx(o,{className:"whitespace-normal",children:"Date of Purchase"}),e.jsx(o,{className:"whitespace-normal",children:"Activation Date"}),e.jsx(o,{className:"whitespace-normal",children:"Original Cost"}),e.jsx(o,{className:"whitespace-normal",children:"Changes During the Year"}),e.jsx(o,{className:"whitespace-normal",children:"Total Depreciable Assets"}),e.jsx(o,{className:"whitespace-normal",children:"Statutory Depreciation Rate"}),e.jsx(o,{className:"whitespace-normal",children:"Claimed Depreciation Rate"}),e.jsx(o,{className:"whitespace-normal",children:"Depreciation Claimed This Year"}),e.jsx(o,{className:"whitespace-normal",children:"Previous Tax Years Accumulated Depreciation"}),e.jsx(o,{className:"whitespace-normal",children:"Total Depreciation"}),e.jsx(o,{className:"whitespace-normal",children:"Net Book Value"})]})]}),e.jsx(W,{children:u?.depreciationReport&&e.jsxs(e.Fragment,{children:[u.depreciationReport.categories.map((i,m)=>e.jsxs(d.Fragment,{children:[e.jsxs(D,{className:"font-bold",children:[e.jsx(t,{children:`Category ${m+1}`}),e.jsx(t,{colSpan:2,children:i.category.name}),e.jsx(t,{colSpan:3}),e.jsxs(t,{children:[n(i.category.percentage,0),"%"]}),e.jsx(t,{colSpan:5})]}),i.records.sort((h,E)=>h.purchaseDate.localeCompare(E.purchaseDate)).map(h=>e.jsx(Z,{record:h},h.id)),e.jsx(g,{data:i.summary,groupName:i.category.name})]},i.id)),e.jsx(g,{data:u.depreciationReport.summary})]})})]})})};export{re as DepreciationReport,te as getDepreciationReportHref};
@@ -1 +1 @@
1
- import{r as h,j as e,d1 as u,eL as p,B as y,d2 as g,bp as D,F as P,a as R,c as w,L as E,R as v,eM as F}from"./index-iLt1WIM9.js";import{d as C}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{R as d}from"./report-commentary-row-BqTwvfOv.js";function A({year:l,setYear:m,referenceYears:o,setReferenceYears:j}){const[c,x]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(u,{opened:c,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&&m(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(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>x(!0),children:e.jsx(g,{className:"size-5"})})]})}const b=()=>{const{year:l}=D(),{setFiltersContext:m}=h.useContext(P),[o,j]=h.useState(l?Number(l):new Date().getFullYear()),[c,x]=h.useState([]),[{data:n,fetching:i}]=R({query:C(F),variables:{reportYear:o,referenceYears:c}});h.useEffect(()=>{m(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(A,{year:o,setYear:j,referenceYears:c,setReferenceYears:x})}))},[o,i,m,c,x]);const f=n?.profitAndLossReport,a=f?.report,s=f?.reference??[];return e.jsx(w,{title:"Profit and Loss Report",children:i?e.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:a&&e.jsxs(v,{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:a.revenue.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("th",{children:r.revenue.amount.formatted},r.year))]}),commentaryData:a.revenue}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Cost of Sales"}),e.jsx("td",{children:a.costOfSales.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.costOfSales.amount.formatted},r.year))]}),commentaryData:a.costOfSales}),e.jsxs("tr",{children:[e.jsx("th",{children:"Gross Profit"}),e.jsx("th",{children:a.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:a.researchAndDevelopmentExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.researchAndDevelopmentExpenses.amount.formatted},r.year))]}),commentaryData:a.researchAndDevelopmentExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Marketing Expenses"}),e.jsx("td",{children:a.marketingExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.marketingExpenses.amount.formatted},r.year))]}),commentaryData:a.marketingExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Management and General Expenses"}),e.jsx("td",{children:a.managementAndGeneralExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.managementAndGeneralExpenses.amount.formatted},r.year))]}),commentaryData:a.managementAndGeneralExpenses}),e.jsxs("tr",{children:[e.jsx("th",{children:"Operating Profit"}),e.jsx("th",{children:a.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:a.financialExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.financialExpenses.amount.formatted},r.year))]}),commentaryData:a.financialExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Other Income"}),e.jsx("td",{children:a.otherIncome.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.otherIncome.amount.formatted},r.year))]}),commentaryData:a.otherIncome}),e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:a.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:a.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:a.netProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.netProfit.formatted},t.year))]})})]})})})};export{b as ProfitAndLossReport};
1
+ import{r as h,j as e,d1 as u,eL as p,B as y,d2 as g,bp as D,F as P,a as R,c as w,L as E,R as v,eM as F}from"./index-CN2818Wt.js";import{d as C}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{R as d}from"./report-commentary-row-Bpvvtwpd.js";function A({year:l,setYear:m,referenceYears:o,setReferenceYears:j}){const[c,x]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(u,{opened:c,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&&m(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(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>x(!0),children:e.jsx(g,{className:"size-5"})})]})}const b=()=>{const{year:l}=D(),{setFiltersContext:m}=h.useContext(P),[o,j]=h.useState(l?Number(l):new Date().getFullYear()),[c,x]=h.useState([]),[{data:n,fetching:i}]=R({query:C(F),variables:{reportYear:o,referenceYears:c}});h.useEffect(()=>{m(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(A,{year:o,setYear:j,referenceYears:c,setReferenceYears:x})}))},[o,i,m,c,x]);const f=n?.profitAndLossReport,a=f?.report,s=f?.reference??[];return e.jsx(w,{title:"Profit and Loss Report",children:i?e.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:a&&e.jsxs(v,{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:a.revenue.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("th",{children:r.revenue.amount.formatted},r.year))]}),commentaryData:a.revenue}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Cost of Sales"}),e.jsx("td",{children:a.costOfSales.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.costOfSales.amount.formatted},r.year))]}),commentaryData:a.costOfSales}),e.jsxs("tr",{children:[e.jsx("th",{children:"Gross Profit"}),e.jsx("th",{children:a.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:a.researchAndDevelopmentExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.researchAndDevelopmentExpenses.amount.formatted},r.year))]}),commentaryData:a.researchAndDevelopmentExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Marketing Expenses"}),e.jsx("td",{children:a.marketingExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.marketingExpenses.amount.formatted},r.year))]}),commentaryData:a.marketingExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Management and General Expenses"}),e.jsx("td",{children:a.managementAndGeneralExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.managementAndGeneralExpenses.amount.formatted},r.year))]}),commentaryData:a.managementAndGeneralExpenses}),e.jsxs("tr",{children:[e.jsx("th",{children:"Operating Profit"}),e.jsx("th",{children:a.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:a.financialExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.financialExpenses.amount.formatted},r.year))]}),commentaryData:a.financialExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Other Income"}),e.jsx("td",{children:a.otherIncome.amount.formatted}),e.jsx("th",{children:t}),s.map(r=>e.jsx("td",{children:r.otherIncome.amount.formatted},r.year))]}),commentaryData:a.otherIncome}),e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:a.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:a.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:a.netProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.netProfit.formatted},t.year))]})})]})})})};export{b as ProfitAndLossReport};
@@ -1,4 +1,4 @@
1
- import{V as q,r as d,j as e,D as p,B as g,P as w,b as y,C as F,en as G,eo as H,ep as _,eq as J,cV as D,co as M,J as E,K as R,er as T,es as Q,et as Y,R as V,eu as $,ev as K,ew as W,ex as X,a as z,t as Z,ey as ee,T as te,ez as se,u as k,U as O,d0 as ae,d1 as ne,d2 as re,k as oe,dk as ie,bR as A,bS as S,eA as N,de as ce,Y as I,d3 as le,F as de,c as he,L as xe,E as ue,I as me,M as pe,eB as ge}from"./index-iLt1WIM9.js";import{d as B}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{M as je}from"./index-DfYVR_1G.js";import{c as fe}from"./charges-filters-DaVBQ_jS.js";import"./Checkbox-iZ--iyJF.js";import"./sub-3l-gAINS.js";import"./subMonths-LVothVpu.js";/**
1
+ import{V as q,r as d,j as e,D as p,B as g,P as w,b as y,C as F,en as G,eo as H,ep as _,eq as J,cV as D,co as M,J as E,K as R,er as T,es as Q,et as Y,R as V,eu as $,ev as K,ew as W,ex as X,a as z,t as Z,ey as ee,T as te,ez as se,u as k,U as O,d0 as ae,d1 as ne,d2 as re,k as oe,dk as ie,bR as A,bS as S,eA as N,de as ce,Y as I,d3 as le,F as de,c as he,L as xe,E as ue,I as me,M as pe,eB as ge}from"./index-CN2818Wt.js";import{d as B}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{M as je}from"./index-C0OGGVXE.js";import{c as fe}from"./charges-filters-r7FjeZLc.js";import"./Checkbox-CpANMiXr.js";import"./sub-C2zifPY5.js";import"./subMonths-uUfFviD2.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.