@accounter/client 0.0.8-alpha-20251029232510-4bc0c8b8c08a26f0c27788725ae584e515236d20 → 0.0.8-alpha-20251029233659-8fb74309c9f1de4f20423db029c5740e2df4bb5d
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 -15
- package/dist/assets/{Checkbox-Cmx4P-eR.js → Checkbox-CSPHEKoR.js} +2 -2
- package/dist/assets/{MultiSelect-tfWMeMsf.js → MultiSelect-CszuVk07.js} +1 -1
- package/dist/assets/{Pagination-p2BVFuhf.js → Pagination-Cp6iKPSu.js} +1 -1
- package/dist/assets/{Progress-BwoJerOb.js → Progress-ByaKYSXX.js} +1 -1
- package/dist/assets/{Table-Cve82Lq5.js → Table-CQ4GTcIY.js} +1 -1
- package/dist/assets/{Typography-CAgQOS4U.js → Typography-Cn08y9HC.js} +1 -1
- package/dist/assets/{YearPickerInput-BPVLgEAY.js → YearPickerInput-BsQymTcP.js} +1 -1
- package/dist/assets/{accordion-Ca5XgpUz.js → accordion-CG93-Cqs.js} +1 -1
- package/dist/assets/accountant-approvals-Dxy1hGw7.js +1 -0
- package/dist/assets/{accounter-table-CBlUbpQl.js → accounter-table-Dgvw-xm_.js} +1 -1
- package/dist/assets/{addDays-ClGDfhvI.js → addDays-Di-hbHs3.js} +1 -1
- package/dist/assets/{all-charges-DV7V8QJ6.js → all-charges-DRl4EcMG.js} +1 -1
- package/dist/assets/{arrow-up-down-DMdWvrmz.js → arrow-up-down-Hh3TlLSU.js} +1 -1
- package/dist/assets/{building-2-Y3dys8Pf.js → building-2-DGfYgfU_.js} +1 -1
- package/dist/assets/business-aamFaOhr.js +27 -0
- package/dist/assets/business-extended-info-CeEMIazB.js +13 -0
- package/dist/assets/{business-header-S5R7Fq8P.js → business-header-BphijNiC.js} +1 -1
- package/dist/assets/business-transactions-filters-DYBvDjKs.js +1 -0
- package/dist/assets/business-transactions-single-B77wu9sA.js +1 -0
- package/dist/assets/business-trip-C1cYIMHX.js +1 -0
- package/dist/assets/{charge-C79C95t6.js → charge-D-99eJ1v.js} +1 -1
- package/dist/assets/{charges-filters-RFRXF1Oa.js → charges-filters-Dxaf2lVd.js} +1 -1
- package/dist/assets/{charges-ledger-validation-DTglElRA.js → charges-ledger-validation-BAY3PYth.js} +1 -1
- package/dist/assets/charges-table-CNWVDMmv.js +62 -0
- package/dist/assets/{chart-2MG3qLL8.js → chart-DM5P1yGj.js} +1 -1
- package/dist/assets/{data-table-pagination-Dhmbf7BR.js → data-table-pagination-TG7sqb1-.js} +1 -1
- package/dist/assets/download-csv-button-jQXIlRax.js +1 -0
- package/dist/assets/{editable-business-trip-BlqinsvU.js → editable-business-trip-DlAsZ0aQ.js} +2 -2
- package/dist/assets/{funnel-B2plvroD.js → funnel-BQEGwl1q.js} +1 -1
- package/dist/assets/{index-Csdsjvrl.js → index--OgMtW-2.js} +2 -2
- package/dist/assets/index-B-USUC2v.js +1 -0
- package/dist/assets/index-BYfofaiM.js +1 -0
- package/dist/assets/{index-C6OmHOHr.js → index-BmZql10x.js} +213 -213
- package/dist/assets/{index-Bs4RBq4h.js → index-CFY-4iKE.js} +1 -1
- package/dist/assets/{index-C4gCwrJJ.js → index-CGQclWiq.js} +1 -1
- package/dist/assets/index-CIY9x3TF.js +6 -0
- package/dist/assets/{index-arYAg9nt.js → index-CJEUQmMx.js} +1 -1
- package/dist/assets/{index-DKZGNBg3.js → index-CXRSu47J.js} +2 -2
- package/dist/assets/{index-DemO-kJJ.js → index-CiXTFJcq.js} +2 -2
- package/dist/assets/{index-CSEktEoZ.js → index-CkIv3Veq.js} +7 -7
- package/dist/assets/{index-BRNnfzgV.js → index-ClzPFBOc.js} +2 -2
- package/dist/assets/{index-qMYyjtmt.js → index-CzEcZ0Dn.js} +2 -2
- package/dist/assets/{index-HG5RXBPG.js → index-D9zE4pLO.js} +1 -1
- package/dist/assets/{index-DZ6Bqs7R.js → index-DKjsW6q7.js} +7 -7
- package/dist/assets/{index-C0ZATVhv.js → index-DOh5XsM3.js} +2 -2
- package/dist/assets/index-DROHY2Kd.js +1 -0
- package/dist/assets/index-DWXHJxFq.css +1 -0
- package/dist/assets/index-DgbPiRkF.js +1 -0
- package/dist/assets/{index-5R7-0kTp.js → index-DkKTDpFK.js} +1 -1
- package/dist/assets/{index-Cn4t95Q9.js → index-DnFwBDCa.js} +1 -1
- package/dist/assets/index-Dt4KpoN0.js +1 -0
- package/dist/assets/{index-BdRubi2c.js → index-IuUe41KG.js} +1 -1
- package/dist/assets/{index-eIVAASqp.js → index-NofRnQ8o.js} +1 -1
- package/dist/assets/{index-P9_YuS6e.js → index-WaN-m0WB.js} +1 -1
- package/dist/assets/index-juMfNCjV.js +1 -0
- package/dist/assets/{index.es-BrfHJ6Yj.js → index.es-BJEu0vdb.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-COXHjjIY.js → insert-business-trip-modal-CXgUJdgl.js} +2 -2
- package/dist/assets/issue-document-BSkWYnI5.js +1 -0
- package/dist/assets/{list-plus-DbuCDPM8.js → list-plus-BlHtPDEN.js} +1 -1
- package/dist/assets/{login-page-ChNFTZLU.js → login-page-DmCLAM1G.js} +1 -1
- package/dist/assets/{match-document-modal-Cp2DKG3j.js → match-document-modal-KjnSxB69.js} +4 -4
- package/dist/assets/{missing-info-charges-IUzXIDY1.js → missing-info-charges-BiEeQwER.js} +1 -1
- package/dist/assets/{modal-CCAYjiOC.js → modal-dLkQjDNz.js} +1 -1
- package/dist/assets/{page-layout-DpwpZHY3.js → page-layout-DxGYaCiw.js} +1 -1
- package/dist/assets/{page-not-found-NbOMK1Jv.js → page-not-found-ChLEFKCs.js} +1 -1
- package/dist/assets/{panel-top-open-CNX1-h4c.js → panel-top-open-CWsfFRNu.js} +1 -1
- package/dist/assets/{pencil-Z4i9z0vF.js → pencil-BEefjySD.js} +1 -1
- package/dist/assets/{report-commentary-row-C4I-ATEX.js → report-commentary-row-Cci0ntye.js} +1 -1
- package/dist/assets/{save-D0kOxdMh.js → save-BkV97OA1.js} +1 -1
- package/dist/assets/similar-transactions-modal-8T9lL2yX.js +1 -0
- package/dist/assets/sub-DdivcKGZ.js +1 -0
- package/dist/assets/subMonths-Kz3NJUOL.js +1 -0
- package/dist/assets/{summary-CkpRtdVA.js → summary-DzLJ6sUY.js} +1 -1
- package/dist/assets/{toggle-expansion-button-Babot8nj.js → toggle-expansion-button-BzVlE1kb.js} +1 -1
- package/dist/assets/tooltip-Ht3m2Q26.js +1 -0
- package/dist/assets/{use-url-query-BSUiacze.js → use-url-query-DV9K0FAR.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/app.tsx +108 -0
- package/src/components/business/admin-business-section.tsx +103 -299
- package/src/components/business/index.tsx +1 -33
- package/src/components/business/transactions-section.tsx +2 -24
- package/src/components/{business-ledger → business-transactions}/business-extended-info.tsx +27 -25
- package/src/components/{business-ledger/business-ledger-filters.tsx → business-transactions/business-transactions-filters.tsx} +12 -12
- package/src/components/{business-ledger/business-ledger-single.tsx → business-transactions/business-transactions-single.tsx} +13 -13
- package/src/components/{business-ledger → business-transactions}/download-csv.tsx +25 -25
- package/src/components/{business-ledger → business-transactions}/index.tsx +15 -15
- package/src/components/charges/charge-extended-info.tsx +4 -45
- package/src/components/layout/sidelinks.tsx +2 -2
- package/src/components/ledger-table/columns.tsx +4 -4
- package/src/components/ledger-table/index.tsx +181 -141
- package/src/components/reports/conto/custom-node.tsx +1 -1
- package/src/components/reports/trial-balance-report/trial-balance-report-account.tsx +1 -1
- package/src/components/tags/index.tsx +2 -4
- package/src/components/transactions-table/columns.tsx +9 -9
- package/src/components/transactions-table/index.tsx +21 -43
- package/src/gql/gql.ts +15 -33
- package/src/gql/graphql.ts +423 -234
- package/src/providers/index.tsx +56 -0
- package/src/router/config.tsx +14 -14
- package/src/router/routes.ts +2 -2
- package/dist/assets/accountant-approvals-BXTzXE96.js +0 -1
- package/dist/assets/business-CRd0ns94.js +0 -37
- package/dist/assets/business-extended-info-BKVk3weU.js +0 -13
- package/dist/assets/business-ledger-filters-C_x4y5uJ.js +0 -1
- package/dist/assets/business-ledger-single-Dku8gbU9.js +0 -1
- package/dist/assets/business-trip-CB51p6xt.js +0 -1
- package/dist/assets/charges-table-D3WwcB50.js +0 -62
- package/dist/assets/download-csv-button-BQSz29rY.js +0 -1
- package/dist/assets/index--xgmdJzW.js +0 -1
- package/dist/assets/index-BUJm5I0K.css +0 -1
- package/dist/assets/index-BgLtHIxa.js +0 -1
- package/dist/assets/index-CIdZZL-X.js +0 -1
- package/dist/assets/index-DA3Ccstm.js +0 -1
- package/dist/assets/index-DhRIY5eN.js +0 -1
- package/dist/assets/index-aEEtRfbo.js +0 -1
- package/dist/assets/index-nshyF-PE.js +0 -6
- package/dist/assets/issue-document-CBKTg1VC.js +0 -1
- package/dist/assets/similar-transactions-modal-DgD48GZ2.js +0 -1
- package/dist/assets/sub-BAZr7Qdd.js +0 -1
- package/dist/assets/subMonths-Df-03cZk.js +0 -1
- package/dist/assets/tooltip-DStdzzhK.js +0 -1
- package/src/components/business/balance-section.tsx +0 -26
- package/src/components/business/ledger-section.tsx +0 -49
- package/src/components/ui/pagination.tsx +0 -194
- package/src/providers/index.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,cV as D,cZ as a,x as f,cu as n,J as N,fX as v,r as d,bt as T,D as E,aO as A,B as Y,z as I,bm as O,G as V,cO as M,V as P,X as y,Y as C,Z as F,_ as B,as as L,a0 as R,al as U,aT as _,F as k,a8 as q,u as z,c as G,cT as J,cU as Q,cW as o,cY as $,fY as H}from"./index-BmZql10x.js";import{u as w}from"./use-url-query-DV9K0FAR.js";import{P as X}from"./page-layout-DxGYaCiw.js";import{F as Z}from"./funnel-BQEGwl1q.js";const W=({record:s})=>{const t=N(v,s);return e.jsxs(D,{children:[e.jsx(a,{children:s.description}),e.jsx(a,{children:f(new Date(s.purchaseDate),"dd/MM/yyyy")}),e.jsx(a,{children:s.activationDate?f(new Date(s.activationDate),"dd/MM/yyyy"):void 0}),e.jsx(a,{children:t.originalCost?n(t.originalCost,0):void 0}),e.jsx(a,{children:t.reportYearDelta?n(t.reportYearDelta,0):void 0}),e.jsx(a,{children:n(t.totalDepreciableCosts,0)}),e.jsxs(a,{children:[n(s.statutoryDepreciationRate,0),"%"]}),e.jsx(a,{children:s.claimedDepreciationRate?`${n(s.claimedDepreciationRate,1)}%`:"-"}),e.jsx(a,{children:t.reportYearClaimedDepreciation?n(t.reportYearClaimedDepreciation,0):"-"}),e.jsx(a,{children:t.pastYearsAccumulatedDepreciation?n(t.pastYearsAccumulatedDepreciation,0):"-"}),e.jsx(a,{children:t.totalDepreciation?n(t.totalDepreciation,0):"-"}),e.jsx(a,{children:t.netValue?n(t.netValue,0):"-"})]})};function K(s){return!s||O(s)?null:encodeURIComponent(JSON.stringify(s))}const b="depreciationReportFilters";function ee({filter:s,setFilter:t,close:r}){const m=V({defaultValues:{...s}}),{control:c,handleSubmit:x}=m,{selectableFinancialEntities:u,fetching:l}=M(),j=i=>{t({...i,year:Number(i.year)}),r()};return e.jsx(P,{...m,children:e.jsxs("form",{onSubmit:x(j),className:"space-y-4",children:[e.jsx(y,{name:"year",control:c,rules:{required:"Year is required",validate:i=>{const p=Number(i);return Number.isNaN(p)||p<2e3||p>2100?"Invalid year":!0}},render:({field:i})=>e.jsxs(C,{children:[e.jsx(F,{children:"Year"}),e.jsx(B,{children:e.jsx(L,{...i,hideControls:!0,decimalScale:0})}),e.jsx(R,{})]})}),e.jsx(y,{name:"financialEntityId",defaultValue:s?.financialEntityId,control:c,render:({field:i})=>e.jsxs(C,{children:[e.jsx(F,{children:"Owner"}),e.jsx(U,{...i,data:u,value:i.value??void 0,disabled:l,placeholder:"Select a financial entity",formPart:!0}),e.jsx(R,{})]})}),e.jsx(_,{children:e.jsx(Y,{type:"submit",disabled:l,children:"Filter"})})]})})}function ae({filter:s,setFilter:t}){const[r,m]=d.useState(!1),{get:c,set:x}=w();d.useEffect(()=>{const l=K(s),j=c(b);l!==j&&x(b,l)},[s,c,x]);const u=d.useCallback(l=>{T(l,s)||t(l)},[s,t]);return e.jsxs(E,{open:r,onOpenChange:m,children:[e.jsx(A,{asChild:!0,children:e.jsx(Y,{variant:"outline",size:"icon",children:e.jsx(Z,{size:20})})}),e.jsx(I,{className:"sm:max-w-[425px]",children:e.jsx(ee,{filter:s,setFilter:u,close:()=>m(!1)})})]})}const g=({data:s,groupName:t})=>{const r=N(v,s);return e.jsxs(D,{className:"font-bold border-b border-black",children:[e.jsx(a,{children:t?"Group Total":"Overall Total"}),e.jsx(a,{colSpan:2,children:t}),e.jsx(a,{children:r.originalCost?n(r.originalCost,0):void 0}),e.jsx(a,{children:r.reportYearDelta?n(r.reportYearDelta,0):void 0}),e.jsx(a,{children:r.totalDepreciableCosts?n(r.totalDepreciableCosts,0):void 0}),e.jsx(a,{}),e.jsx(a,{}),e.jsx(a,{children:r.reportYearClaimedDepreciation?n(r.reportYearClaimedDepreciation,0):void 0}),e.jsx(a,{children:r.pastYearsAccumulatedDepreciation?n(r.pastYearsAccumulatedDepreciation,0):void 0}),e.jsx(a,{children:r.totalDepreciation?n(r.totalDepreciation,0):void 0}),e.jsx(a,{children:r.netValue?n(r.netValue,0):void 0})]})},ne=()=>{const{setFiltersContext:s}=d.useContext(k),{userContext:t}=d.useContext(q),{get:r}=w(),m=d.useMemo(()=>{const i={financialEntityId:t?.context.adminBusinessId,year:new Date().getFullYear()},p=r(b);if(p)try{return JSON.parse(decodeURIComponent(p))}catch(h){console.error("Failed to parse depreciation report filters from URL",h)}return i},[t?.context.adminBusinessId]),[c,x]=d.useState(m),[{data:u,fetching:l}]=z({query:H,variables:{filters:c}});d.useEffect(()=>{s(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(ae,{filter:c,setFilter:x})}))},[c,s,x]);const j=d.useMemo(()=>`Depreciation Report for ${c.year}`,[c.year]);return e.jsx(X,{title:"Depreciation Report",description:j,children:l?e.jsx(G,{}):e.jsxs(J,{children:[e.jsxs(Q,{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($,{children:u?.depreciationReport&&e.jsxs(e.Fragment,{children:[u.depreciationReport.categories.map((i,p)=>e.jsxs(d.Fragment,{children:[e.jsxs(D,{className:"font-bold",children:[e.jsx(a,{children:`Category ${p+1}`}),e.jsx(a,{colSpan:2,children:i.category.name}),e.jsx(a,{colSpan:3}),e.jsxs(a,{children:[n(i.category.percentage,0),"%"]}),e.jsx(a,{colSpan:5})]}),i.records.sort((h,S)=>h.purchaseDate.localeCompare(S.purchaseDate)).map(h=>e.jsx(W,{record:h},h.id)),e.jsx(g,{data:i.summary,groupName:i.category.name})]},i.id)),e.jsx(g,{data:u.depreciationReport.summary})]})})]})})};export{ne as DepreciationReport};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,bp as w,bw as O,j as e,bq as U,B as c,ae as K,G as _,x as b,cQ as z,W as B,cR as H,bs as D,bt as M,bu as I,Y as L,Z as G,_ as q,$ as Q,an as J,F as W,u as X,cS as Y,L as Z,cT as $,cU as ee,cV as te,cW as se,cX as S,cY as ae,cZ as T,c_ as ne,c$ as k,d0 as re,d1 as ie,d2 as le,d3 as oe,d4 as ce,d5 as de,d6 as me,d7 as ue}from"./index-C6OmHOHr.js";import{u as P}from"./use-url-query-BSUiacze.js";import{a as ge}from"./accounter-table-CBlUbpQl.js";import{D as xe}from"./data-table-pagination-Dhmbf7BR.js";import{P as V}from"./modal-CCAYjiOC.js";import{P as he}from"./page-layout-DpwpZHY3.js";import{F as pe}from"./funnel-B2plvroD.js";import{M as R}from"./MultiSelect-tfWMeMsf.js";import{s as je}from"./sub-BAZr7Qdd.js";import{A as v}from"./arrow-up-down-DMdWvrmz.js";import"./Pagination-p2BVFuhf.js";import"./create-event-handler-BiA-1lGu.js";import"./Table-Cve82Lq5.js";import"./addDays-ClGDfhvI.js";import"./subMonths-Df-03cZk.js";function fe({filter:t,setFilter:s,closeModal:h}){const{userContext:p}=r.useContext(K),x=_({defaultValues:{ownerIDs:p?.context.adminBusinessId?[p.context.adminBusinessId]:void 0,toDate:b(new Date,"yyyy-MM-dd"),fromDate:b(je(new Date,{years:1}),"yyyy-MM-dd"),...t}}),{control:o,handleSubmit:y}=x,{selectableFinancialEntities:i,fetching:d}=z(),C=a=>{s(a),h()};function m(){s({}),h()}return e.jsxs(e.Fragment,{children:[d?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(B,{...x,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:b(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:b(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(G,{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(q,{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:h,children:"Cancel"})]})]})})]})}function ve({filter:t={},setFilter:s,initiallyOpened:h=!1}){const[p,x]=r.useState(h),[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:()=>x(!1),content:e.jsx(fe,{filter:t,setFilter:C,closeModal:()=>x(!1)}),modalSize:"xl"}),e.jsx(U,{inline:!0,size:16,disabled:!o,children:e.jsx(c,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>x(!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(v,{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(v,{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:b(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(v,{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(v,{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(v,{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(v,{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(v,{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?b(new Date(s.eventDate),"dd/MM/yy"):null},{title:"Transaction Effective Date",value:s=>s?.effectiveDate?b(new Date(s.effectiveDate),"dd/MM/yy"):null},{title:"Transaction Description",value:s=>s?.sourceDescription}]}):"No Related Transaction"}],Ve=()=>{const[t,s]=r.useState(null),[h,p]=r.useState(!1),{get:x}=P(),o=x("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(W),[{data:j,fetching:F},N]=X({query:ce,variables:{filters:i??{}},pause:!0});r.useEffect(()=>{i&&N()},[i,N]);const f=Y({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(xe,{table:f}),e.jsx(ve,{filter:i,setFilter:d,initiallyOpened:!i})]}))},[f,F,i,l,d,y,A]),e.jsx(he,{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(Z,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx($,{open:h,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{Ve as DocumentsReport,E as columns};
|
|
1
|
+
import{r,bm as w,bt as A,j as e,bn as U,B as c,a8 as K,G as _,x as b,cO as z,V as B,cP as H,bp as D,bq as M,br as I,X as L,Y as G,Z as q,_ as Q,ah as X,F as J,u as Y,cQ as Z,L as W,cR as $,cS as ee,cT as te,cU as se,cV as S,cW as ae,cX as T,cY as ne,cZ as k,c_ as re,c$ as ie,d0 as le,d1 as oe,d2 as ce,d3 as de,d4 as me,d5 as ue}from"./index-BmZql10x.js";import{u as P}from"./use-url-query-DV9K0FAR.js";import{a as ge}from"./accounter-table-Dgvw-xm_.js";import{D as he}from"./data-table-pagination-TG7sqb1-.js";import{P as V}from"./modal-dLkQjDNz.js";import{P as xe}from"./page-layout-DxGYaCiw.js";import{F as pe}from"./funnel-BQEGwl1q.js";import{M as R}from"./MultiSelect-CszuVk07.js";import{s as je}from"./sub-DdivcKGZ.js";import{A as v}from"./arrow-up-down-Hh3TlLSU.js";import"./Pagination-Cp6iKPSu.js";import"./create-event-handler-BiA-1lGu.js";import"./Table-CQ4GTcIY.js";import"./addDays-Di-hbHs3.js";import"./subMonths-Kz3NJUOL.js";function fe({filter:t,setFilter:s,closeModal:x}){const{userContext:p}=r.useContext(K),h=_({defaultValues:{ownerIDs:p?.context.adminBusinessId?[p.context.adminBusinessId]:void 0,toDate:b(new Date,"yyyy-MM-dd"),fromDate:b(je(new Date,{years:1}),"yyyy-MM-dd"),...t}}),{control:o,handleSubmit:y}=h,{selectableFinancialEntities:i,fetching:d}=z(),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:b(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:b(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(G,{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(q,{children:"Unmatched only"})}),e.jsx(Q,{children:e.jsx(X,{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 ve({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=>{A(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(U,{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(v,{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(v,{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:b(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(v,{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(v,{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(v,{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(v,{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(v,{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?b(new Date(s.eventDate),"dd/MM/yy"):null},{title:"Transaction Effective Date",value:s=>s?.effectiveDate?b(new Date(s.effectiveDate),"dd/MM/yy"):null},{title:"Transaction Description",value:s=>s?.sourceDescription}]}):"No Related Transaction"}],Ve=()=>{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(J),[{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}}),O=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(ve,{filter:i,setFilter:d,initiallyOpened:!i})]}))},[f,F,i,l,d,y,O]),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(W,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx($,{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{Ve as DocumentsReport,E as columns};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{v as fn,gp as te,fG as R,fE as ye,gq as Re,gr as hn,dv as mn,j as i,T as ut,bS as ft,R as ht,B as H,m as E,bQ as yn,gs as gn,e6 as pn,u as mt,gt as vn,G as yt,r as S,cO as gt,d as xn,V as pt,e7 as bn,X as se,Y as re,Z as oe,am as Dn,_ as he,an as kn,ao as Mn,ap as wn,ar as Cn,a0 as ie,bq as vt,x as le,ah as Sn,a5 as On,g as Nn,gu as jn,t as Te,i as Tn,L as Wn,al as Qe,bp as Je,bK as En,br as _n,gv as In,I as xt,gw as Fn,gx as Yn,fF as Bn,gy as Pn,gz as An,gA as Rn,gB as zn,gC as qn,gD as Hn,gE as $n,gF as bt,ab as m,gG as Zn,gH as Un,dn as ne,gI as Xe,gJ as Kn,gK as Ln,a_ as Gn,gL as Vn,ec as Qn,ed as Jn,gM as Xn,D as es,aO as ts,z as ns,aP as ss,aQ as rs,cu as os,bo as as,cp as is,q as cs,e as ls,dm as ae,fB as ds,J as us,fo as fs,cQ as hs,d3 as ms,d5 as ys,cT as gs,cU as ps,cV as We,cW as vs,cX as et,cY as xs,cZ as tt}from"./index-BmZql10x.js";import{u as qe,S as bs}from"./similar-transactions-modal-8T9lL2yX.js";import{a as Dt}from"./addDays-Di-hbHs3.js";import{L as Ds}from"./list-plus-BlHtPDEN.js";import{T as ks}from"./tooltip-Ht3m2Q26.js";/**
|
|
2
|
+
* @license lucide-react v0.548.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ms=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ws=fn("external-link",Ms);function Cs(e,t,s){return Dt(e,t*7,s)}function Ss(e,t){let s,n=t?.in;return e.forEach(r=>{!n&&typeof r=="object"&&(n=te.bind(null,r));const a=R(r,n);(!s||s<a||isNaN(+a))&&(s=a)}),te(n,s||NaN)}function Os(e,t){let s,n=t?.in;return e.forEach(r=>{!n&&typeof r=="object"&&(n=te.bind(null,r));const a=R(r,n);(!s||s>a||isNaN(+a))&&(s=a)}),te(n,s||NaN)}function Ns(e,t,s){const[n,r]=ye(s?.in,e,t);return+Re(n)==+Re(r)}function js(e,t,s){const[n,r]=ye(s?.in,e,t),a=n.getFullYear()-r.getFullYear(),c=n.getMonth()-r.getMonth();return a*12+c}function Ts(e,t){const s=R(e,t?.in),n=s.getMonth();return s.setFullYear(s.getFullYear(),n+1,0),s.setHours(23,59,59,999),s}function kt(e,t){const[s,n]=ye(e,t.start,t.end);return{start:s,end:n}}function Ws(e,t){const{start:s,end:n}=kt(t?.in,e);let r=+s>+n;const a=r?+s:+n,c=r?n:s;c.setHours(0,0,0,0),c.setDate(1);let o=1;const l=[];for(;+c<=a;)l.push(te(s,c)),c.setMonth(c.getMonth()+o);return r?l.reverse():l}function Es(e,t){const s=R(e,t?.in);return s.setDate(1),s.setHours(0,0,0,0),s}function _s(e,t){const{start:s,end:n}=kt(t?.in,e);let r=+s>+n;const a=r?+s:+n,c=r?n:s;c.setHours(0,0,0,0),c.setMonth(0,1);let o=1;const l=[];for(;+c<=a;)l.push(te(s,c)),c.setFullYear(c.getFullYear()+o);return r?l.reverse():l}function Mt(e,t){const s=hn(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,r=R(e,t?.in),a=r.getDay(),c=(a<n?-7:0)+6-(a-n);return r.setDate(r.getDate()+c),r.setHours(23,59,59,999),r}function Is(e,t){return Mt(e,{...t,weekStartsOn:1})}function Fs(e,t){const s=R(e,t?.in),n=s.getFullYear(),r=s.getMonth(),a=te(s,0);return a.setFullYear(n,r+1,0),a.setHours(0,0,0,0),a.getDate()}function Ys(e,t){return R(e,t?.in).getMonth()}function Bs(e,t){return R(e,t?.in).getFullYear()}function Ps(e,t){return+R(e)>+R(t)}function As(e,t){return+R(e)<+R(t)}function Rs(e,t,s){const[n,r]=ye(s?.in,e,t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function zs(e,t,s){const[n,r]=ye(s?.in,e,t);return n.getFullYear()===r.getFullYear()}function qs(e,t,s){const n=R(e,s?.in),r=n.getFullYear(),a=n.getDate(),c=te(e,0);c.setFullYear(r,t,15),c.setHours(0,0,0,0);const o=Fs(c);return n.setMonth(t,Math.min(a,o)),n}function Hs(e,t,s){const n=R(e,s?.in);return isNaN(+n)?te(e,NaN):(n.setFullYear(t),n)}var Ee={exports:{}},_e,nt;function $s(){if(nt)return _e;nt=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _e=e,_e}var Ie,st;function Zs(){if(st)return Ie;st=1;var e=$s();function t(){}function s(){}return s.resetWarningCache=t,Ie=function(){function n(c,o,l,d,f,u){if(u!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}n.isRequired=n;function r(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:r,element:n,elementType:n,instanceOf:r,node:n,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:s,resetWarningCache:t};return a.PropTypes=a,a},Ie}var rt;function Us(){return rt||(rt=1,Ee.exports=Zs()()),Ee.exports}var Ks=Us();const sa=mn(Ks);function Ls(e){return i.jsx(ut,{label:"To Charge",children:i.jsx(ft,{to:ht.CHARGES.DETAIL(e.chargeId),target:"_blank",rel:"noreferrer",onClick:t=>t.stopPropagation(),className:"inline-block",children:i.jsx(H,{...e,className:E("size-7.5",e.className),variant:"ghost",children:i.jsx(ws,{className:"size-5"})})})})}function Gs({transactionId:e}){const{updateTransaction:t}=qe();function s(){t({transactionId:e,fields:{chargeId:pn}})}return i.jsx(yn,{onConfirm:s,title:"Are you sure you want to unlink this transaction from the charge?",children:i.jsx(H,{variant:"ghost",size:"icon",className:"size-7.5",children:i.jsx(gn,{className:"size-5"})})})}const Vs=({transactionID:e,onDone:t,onChange:s})=>{const[{data:n,fetching:r}]=mt({query:vn,variables:{transactionIDs:[e]}}),a=n?.transactionsByIDs?.[0],c=yt({defaultValues:a??{}});S.useEffect(()=>{a&&c.reset(a)},[a,c]);const{control:o,handleSubmit:l,formState:{dirtyFields:d}}=c,{updateTransaction:f,fetching:u}=qe(),h=x=>{if(!a)return;const g=On(x,d);t?.(),g&&Object.keys(g).length>0&&f({transactionId:a.id,fields:g}).then(s)},{selectableFinancialEntities:y,fetching:C}=gt();return i.jsxs(i.Fragment,{children:[r&&i.jsx(xn,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}),!r&&a&&i.jsx(pt,{...c,children:i.jsxs("form",{onSubmit:l(h),children:[i.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:i.jsxs(bn,{cols:3,children:[i.jsx(se,{name:"counterpartyId",control:o,defaultValue:a.counterparty?.id,rules:{minLength:{value:2,message:"Minimum 2 characters"}},render:({field:x})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Counterparty"}),i.jsxs(Dn,{onValueChange:x.onChange,value:x.value??void 0,disabled:C,children:[i.jsx(he,{children:i.jsx(kn,{className:"w-full truncate",children:i.jsx(Mn,{placeholder:"Scroll to see all options"})})}),i.jsx(wn,{onClick:g=>g.stopPropagation(),children:y.map(({value:g,label:k})=>i.jsx(Cn,{value:g,children:k},g))})]}),i.jsx(ie,{})]})}),a?.account.__typename==="CardFinancialAccount"?i.jsx(se,{name:"effectiveDate",control:o,rules:{pattern:{value:vt,message:"Date must be im format yyyy-mm-dd"}},render:({field:x})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Effective Date"}),i.jsx(he,{children:i.jsx(zo,{...x,onChange:g=>{const k=g?le(g,"yyyy-MM-dd"):void 0;k!==x.value&&x.onChange(k)},value:x.value?new Date(x.value):void 0})}),i.jsx(ie,{})]})}):i.jsx(i.Fragment,{}),i.jsx(se,{name:"isFee",control:o,defaultValue:a.isFee,render:({field:x})=>i.jsxs(re,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[i.jsx("div",{className:"space-y-0.5",children:i.jsx(oe,{children:"Fee Transaction"})}),i.jsx(he,{children:i.jsx(Sn,{checked:x.value===!0,onCheckedChange:x.onChange})})]})})]})}),i.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[i.jsx("button",{type:"submit",onClick:()=>l(h),className:"mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",disabled:u||Object.keys(d).length===0,children:"Accept"}),i.jsx("button",{type:"button",className:"mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:t,children:"Cancel"})]})]})})]})},Qs="insertMiscExpense",Js=()=>{const[{fetching:e},t]=Nn(jn),s=S.useCallback(async n=>{const r="Error creating misc expense",a=`${Qs}-${n.chargeId}`;Te.loading("Creating misc expense",{id:a});try{const c=await t(n),o=Tn(c,r,a);if(o)return Te.success("Success",{id:a,description:"Misc expense was created"}),o.insertMiscExpense}catch(c){console.error(`${r}: ${c}`),Te.error("Error",{id:a,description:r,duration:1e5,closeButton:!0})}},[t]);return{fetching:e,insertMiscExpense:s}},Xs=({onDone:e,defaultValues:t={},chargeId:s})=>{const{insertMiscExpense:n,fetching:r}=Js(),a=S.useCallback(async c=>{await n({chargeId:s,fields:c}),e()},[n,s,e]);return i.jsx(er,{defaultValues:t,onInsertDone:a,fetching:r})},er=({onInsertDone:e,defaultValues:t,fetching:s})=>{const n=o=>{o&&Object.keys(o).length>0&&e(o)},r=yt({defaultValues:{...t}}),{handleSubmit:a,formState:{dirtyFields:c}}=r;return i.jsx(pt,{...r,children:i.jsx("form",{onSubmit:a(n),noValidate:!0,children:i.jsxs("div",{className:"px-5 flex flex-col gap-5 relative",children:[s&&i.jsx("div",{className:"absolute bg-white/60 z-10 h-full w-full flex items-center justify-center",children:i.jsx("div",{className:"flex items-center",children:i.jsx("span",{className:"text-3xl mr-4",children:i.jsx(Wn,{className:"h-10 w-10 animate-spin mr-2 self-center"})})})}),i.jsx(tr,{formManager:r,isInsert:!0}),i.jsx("div",{className:"flex justify-right gap-5 mt-5",children:i.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",disabled:s||Object.keys(c).length===0,children:"Accept"})})]})})})},tr=({formManager:e,isInsert:t})=>{const{control:s,setValue:n}=e,{selectableFinancialEntities:r,fetching:a}=gt();return i.jsxs(i.Fragment,{children:[i.jsx(se,{name:"creditorId",control:s,rules:{required:t?"Required":void 0},render:({field:c})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Creditor"}),i.jsx(Qe,{...c,data:r,value:c.value??void 0,disabled:a,placeholder:"Select creditor",formPart:!0}),i.jsx(ie,{})]})}),i.jsx(se,{name:"debtorId",control:s,rules:{required:t?"Required":void 0},render:({field:c})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Debtor"}),i.jsx(Qe,{...c,data:r,value:c.value??void 0,disabled:a,placeholder:"Select debtor",formPart:!0}),i.jsx(ie,{})]})}),i.jsx(Je,{name:"amount",control:s,rules:{required:t?"Required":void 0},render:({field:c,fieldState:o})=>i.jsx(Je,{name:"currency",control:s,rules:{required:t?"Required":void 0},render:({field:l,fieldState:d})=>i.jsx(En,{...c,required:t,value:c.value??void 0,error:o.error?.message||d.error?.message,label:"Amount",currencyCodeProps:{...l,required:t,label:"Currency"}})})}),i.jsx(se,{name:"invoiceDate",control:s,rules:{...t?{required:"Required"}:{},pattern:{value:vt,message:"Date must be im format yyyy-mm-dd"}},render:({field:c})=>{const o=c.value?new Date(c.value):void 0;return i.jsxs(re,{children:[i.jsx(oe,{children:"Invoice Date"}),i.jsx(he,{children:i.jsx(_n,{...c,required:t,onChange:l=>{const d=l?typeof l=="string"?l:le(l,"yyyy-MM-dd"):void 0;d!==c.value&&(n("invoiceDate",d),c.onChange(d))},value:o,valueFormat:"DD/MM/YYYY"})}),i.jsx(ie,{})]})}}),i.jsx(se,{name:"valueDate",control:s,rules:{...t?{required:"Required"}:{},validate:c=>c?!Number.isNaN(c.getTime())||"Invalid date and time format":!0},render:({field:c})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Value Date"}),i.jsx(he,{children:i.jsx(In,{...c,onChange:o=>{n("valueDate",o),c.onChange(o)},onPointerEnterCapture:()=>{},onPointerLeaveCapture:()=>{},required:t,placeholder:"Pick date and time",valueFormat:"DD/MM/YYYY HH:mm:ss",withSeconds:!0})}),i.jsx(ie,{})]})}),i.jsx(se,{name:"description",control:s,rules:{required:t?"Required":void 0},render:({field:c})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Description"}),i.jsx(he,{children:i.jsx(xt,{...c,required:t,value:c.value??void 0})}),i.jsx(ie,{})]})})]})};function nr(e,t,s="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:s}).format(t).split(/\s/g).slice(2).join(" ")}const sr={},me={};function ce(e,t){try{const n=(sr[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return n in me?me[n]:ot(n,n.split(":"))}catch{if(e in me)return me[e];const s=e?.match(rr);return s?ot(e,s.slice(1)):NaN}}const rr=/([+-]\d\d):?(\d\d)?/;function ot(e,t){const s=+(t[0]||0),n=+(t[1]||0),r=+(t[2]||0)/60;return me[e]=s*60+n>0?s*60+n+r:s*60-n-r}class V extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(ce(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),wt(this),ze(this)):this.setTime(Date.now())}static tz(t,...s){return s.length?new V(...s,t):new V(Date.now(),t)}withTimeZone(t){return new V(+this,t)}getTimezoneOffset(){const t=-ce(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),ze(this),+this}[Symbol.for("constructDateFrom")](t){return new V(+new Date(t),this.timeZone)}}const at=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!at.test(e))return;const t=e.replace(at,"$1UTC");V.prototype[t]&&(e.startsWith("get")?V.prototype[e]=function(){return this.internal[t]()}:(V.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),or(this),+this},V.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),ze(this),+this}))});function ze(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ce(e.timeZone,e)*60))}function or(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),wt(e)}function wt(e){const t=ce(e.timeZone,e),s=t>0?Math.floor(t):Math.ceil(t),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const r=-new Date(+e).getTimezoneOffset(),a=-new Date(+n).getTimezoneOffset(),c=r-a,o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();c&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+c);const l=r-s;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const d=new Date(+e);d.setUTCSeconds(0);const f=r>0?d.getSeconds():(d.getSeconds()-60)%60,u=Math.round(-(ce(e.timeZone,e)*60))%60;(u||f)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+f));const h=ce(e.timeZone,e),y=h>0?Math.floor(h):Math.ceil(h),x=-new Date(+e).getTimezoneOffset()-y,g=y!==s,k=x-l;if(g&&k){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+k);const T=ce(e.timeZone,e),b=T>0?Math.floor(T):Math.ceil(T),j=y-b;j&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+j),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+j))}}class B extends V{static tz(t,...s){return s.length?new B(...s,t):new B(Date.now(),t)}toISOString(){const[t,s,n]=this.tzComponents(),r=`${t}${s}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,s,n,r]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${n} ${s} ${r}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[s,n,r]=this.tzComponents();return`${t} GMT${s}${n}${r} (${nr(this.timeZone,this)})`}toLocaleString(t,s){return Date.prototype.toLocaleString.call(this,t,{...s,timeZone:s?.timeZone||this.timeZone})}toLocaleDateString(t,s){return Date.prototype.toLocaleDateString.call(this,t,{...s,timeZone:s?.timeZone||this.timeZone})}toLocaleTimeString(t,s){return Date.prototype.toLocaleTimeString.call(this,t,{...s,timeZone:s?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),s=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),r=String(Math.abs(t)%60).padStart(2,"0");return[s,n,r]}withTimeZone(t){return new B(+this,t)}[Symbol.for("constructDateFrom")](t){return new B(+new Date(t),this.timeZone)}}const it=5,ar=4;function ir(e,t){const s=t.startOfMonth(e),n=s.getDay()>0?s.getDay():7,r=t.addDays(e,-n+1),a=t.addDays(r,it*7-1);return t.getMonth(e)===t.getMonth(a)?it:ar}function Ct(e,t){const s=t.startOfMonth(e),n=s.getDay();return n===1?s:n===0?t.addDays(s,-6):t.addDays(s,-1*(n-1))}function cr(e,t){const s=Ct(e,t),n=ir(e,t);return t.addDays(s,n*7-1)}class ${constructor(t,s){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?B.tz(this.options.timeZone):new this.Date,this.newDate=(n,r,a)=>this.overrides?.newDate?this.overrides.newDate(n,r,a):this.options.timeZone?new B(n,r,a,this.options.timeZone):new Date(n,r,a),this.addDays=(n,r)=>this.overrides?.addDays?this.overrides.addDays(n,r):Dt(n,r),this.addMonths=(n,r)=>this.overrides?.addMonths?this.overrides.addMonths(n,r):Fn(n,r),this.addWeeks=(n,r)=>this.overrides?.addWeeks?this.overrides.addWeeks(n,r):Cs(n,r),this.addYears=(n,r)=>this.overrides?.addYears?this.overrides.addYears(n,r):Yn(n,r),this.differenceInCalendarDays=(n,r)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,r):Bn(n,r),this.differenceInCalendarMonths=(n,r)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,r):js(n,r),this.eachMonthOfInterval=n=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):Ws(n),this.eachYearOfInterval=n=>{const r=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(n):_s(n),a=new Set(r.map(o=>this.getYear(o)));if(a.size===r.length)return r;const c=[];return a.forEach(o=>{c.push(new Date(o,0,1))}),c},this.endOfBroadcastWeek=n=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):cr(n,this),this.endOfISOWeek=n=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(n):Is(n),this.endOfMonth=n=>this.overrides?.endOfMonth?this.overrides.endOfMonth(n):Ts(n),this.endOfWeek=(n,r)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(n,r):Mt(n,this.options),this.endOfYear=n=>this.overrides?.endOfYear?this.overrides.endOfYear(n):Pn(n),this.format=(n,r,a)=>{const c=this.overrides?.format?this.overrides.format(n,r,this.options):le(n,r,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(c):c},this.getISOWeek=n=>this.overrides?.getISOWeek?this.overrides.getISOWeek(n):An(n),this.getMonth=(n,r)=>this.overrides?.getMonth?this.overrides.getMonth(n,this.options):Ys(n,this.options),this.getYear=(n,r)=>this.overrides?.getYear?this.overrides.getYear(n,this.options):Bs(n,this.options),this.getWeek=(n,r)=>this.overrides?.getWeek?this.overrides.getWeek(n,this.options):Rn(n,this.options),this.isAfter=(n,r)=>this.overrides?.isAfter?this.overrides.isAfter(n,r):Ps(n,r),this.isBefore=(n,r)=>this.overrides?.isBefore?this.overrides.isBefore(n,r):As(n,r),this.isDate=n=>this.overrides?.isDate?this.overrides.isDate(n):zn(n),this.isSameDay=(n,r)=>this.overrides?.isSameDay?this.overrides.isSameDay(n,r):Ns(n,r),this.isSameMonth=(n,r)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(n,r):Rs(n,r),this.isSameYear=(n,r)=>this.overrides?.isSameYear?this.overrides.isSameYear(n,r):zs(n,r),this.max=n=>this.overrides?.max?this.overrides.max(n):Ss(n),this.min=n=>this.overrides?.min?this.overrides.min(n):Os(n),this.setMonth=(n,r)=>this.overrides?.setMonth?this.overrides.setMonth(n,r):qs(n,r),this.setYear=(n,r)=>this.overrides?.setYear?this.overrides.setYear(n,r):Hs(n,r),this.startOfBroadcastWeek=(n,r)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):Ct(n,this),this.startOfDay=n=>this.overrides?.startOfDay?this.overrides.startOfDay(n):Re(n),this.startOfISOWeek=n=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(n):qn(n),this.startOfMonth=n=>this.overrides?.startOfMonth?this.overrides.startOfMonth(n):Es(n),this.startOfWeek=(n,r)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(n,this.options):Hn(n,this.options),this.startOfYear=n=>this.overrides?.startOfYear?this.overrides.startOfYear(n):$n(n),this.options={locale:bt,...t},this.overrides=s}getDigitMap(){const{numerals:t="latn"}=this.options,s=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let r=0;r<10;r++)n[r.toString()]=s.format(r);return n}replaceDigits(t){const s=this.getDigitMap();return t.replace(/\d/g,n=>s[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&$.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:s,timeZone:n,numerals:r}=this.options,a=s?.code;if(a&&$.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:"long",year:"numeric",timeZone:n,numberingSystem:r}).format(t)}catch{}const c=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,c)}}$.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Q=new $;class St{constructor(t,s,n=Q){this.date=t,this.displayMonth=s,this.outside=!!(s&&!n.isSameMonth(t,s)),this.dateLib=n}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class lr{constructor(t,s){this.date=t,this.weeks=s}}class dr{constructor(t,s){this.days=s,this.weekNumber=t}}function ur(e){return m.createElement("button",{...e})}function fr(e){return m.createElement("span",{...e})}function hr(e){const{size:t=24,orientation:s="left",className:n}=e;return m.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},s==="up"&&m.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),s==="down"&&m.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),s==="left"&&m.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),s==="right"&&m.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function mr(e){const{day:t,modifiers:s,...n}=e;return m.createElement("td",{...n})}function yr(e){const{day:t,modifiers:s,...n}=e,r=m.useRef(null);return m.useEffect(()=>{s.focused&&r.current?.focus()},[s.focused]),m.createElement("button",{ref:r,...n})}var p;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(p||(p={}));var F;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(F||(F={}));var L;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(L||(L={}));var q;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(q||(q={}));function gr(e){const{options:t,className:s,components:n,classNames:r,...a}=e,c=[r[p.Dropdown],s].join(" "),o=t?.find(({value:l})=>l===a.value);return m.createElement("span",{"data-disabled":a.disabled,className:r[p.DropdownRoot]},m.createElement(n.Select,{className:c,...a},t?.map(({value:l,label:d,disabled:f})=>m.createElement(n.Option,{key:l,value:l,disabled:f},d))),m.createElement("span",{className:r[p.CaptionLabel],"aria-hidden":!0},o?.label,m.createElement(n.Chevron,{orientation:"down",size:18,className:r[p.Chevron]})))}function pr(e){return m.createElement("div",{...e})}function vr(e){return m.createElement("div",{...e})}function xr(e){const{calendarMonth:t,displayIndex:s,...n}=e;return m.createElement("div",{...n},e.children)}function br(e){const{calendarMonth:t,displayIndex:s,...n}=e;return m.createElement("div",{...n})}function Dr(e){return m.createElement("table",{...e})}function kr(e){return m.createElement("div",{...e})}const Ot=S.createContext(void 0);function ge(){const e=S.useContext(Ot);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Mr(e){const{components:t}=ge();return m.createElement(t.Dropdown,{...e})}function wr(e){const{onPreviousClick:t,onNextClick:s,previousMonth:n,nextMonth:r,...a}=e,{components:c,classNames:o,labels:{labelPrevious:l,labelNext:d}}=ge(),f=S.useCallback(h=>{r&&s?.(h)},[r,s]),u=S.useCallback(h=>{n&&t?.(h)},[n,t]);return m.createElement("nav",{...a},m.createElement(c.PreviousMonthButton,{type:"button",className:o[p.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":l(n),onClick:u},m.createElement(c.Chevron,{disabled:n?void 0:!0,className:o[p.Chevron],orientation:"left"})),m.createElement(c.NextMonthButton,{type:"button",className:o[p.NextMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:f},m.createElement(c.Chevron,{disabled:r?void 0:!0,orientation:"right",className:o[p.Chevron]})))}function Cr(e){const{components:t}=ge();return m.createElement(t.Button,{...e})}function Sr(e){return m.createElement("option",{...e})}function Or(e){const{components:t}=ge();return m.createElement(t.Button,{...e})}function Nr(e){const{rootRef:t,...s}=e;return m.createElement("div",{...s,ref:t})}function jr(e){return m.createElement("select",{...e})}function Tr(e){const{week:t,...s}=e;return m.createElement("tr",{...s})}function Wr(e){return m.createElement("th",{...e})}function Er(e){return m.createElement("thead",{"aria-hidden":!0},m.createElement("tr",{...e}))}function _r(e){const{week:t,...s}=e;return m.createElement("th",{...s})}function Ir(e){return m.createElement("th",{...e})}function Fr(e){return m.createElement("tbody",{...e})}function Yr(e){const{components:t}=ge();return m.createElement(t.Dropdown,{...e})}const Br=Object.freeze(Object.defineProperty({__proto__:null,Button:ur,CaptionLabel:fr,Chevron:hr,Day:mr,DayButton:yr,Dropdown:gr,DropdownNav:pr,Footer:vr,Month:xr,MonthCaption:br,MonthGrid:Dr,Months:kr,MonthsDropdown:Mr,Nav:wr,NextMonthButton:Cr,Option:Sr,PreviousMonthButton:Or,Root:Nr,Select:jr,Week:Tr,WeekNumber:_r,WeekNumberHeader:Ir,Weekday:Wr,Weekdays:Er,Weeks:Fr,YearsDropdown:Yr},Symbol.toStringTag,{value:"Module"}));function X(e,t,s=!1,n=Q){let{from:r,to:a}=e;const{differenceInCalendarDays:c,isSameDay:o}=n;return r&&a?(c(a,r)<0&&([r,a]=[a,r]),c(t,r)>=(s?1:0)&&c(a,t)>=(s?1:0)):!s&&a?o(a,t):!s&&r?o(r,t):!1}function Nt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function He(e){return!!(e&&typeof e=="object"&&"from"in e)}function jt(e){return!!(e&&typeof e=="object"&&"after"in e)}function Tt(e){return!!(e&&typeof e=="object"&&"before"in e)}function Wt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Et(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ee(e,t,s=Q){const n=Array.isArray(t)?t:[t],{isSameDay:r,differenceInCalendarDays:a,isAfter:c}=s;return n.some(o=>{if(typeof o=="boolean")return o;if(s.isDate(o))return r(e,o);if(Et(o,s))return o.includes(e);if(He(o))return X(o,e,!1,s);if(Wt(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(e.getDay()):o.dayOfWeek===e.getDay();if(Nt(o)){const l=a(o.before,e),d=a(o.after,e),f=l>0,u=d<0;return c(o.before,o.after)?u&&f:f||u}return jt(o)?a(e,o.after)>0:Tt(o)?a(o.before,e)>0:typeof o=="function"?o(e):!1})}function Pr(e,t,s,n,r){const{disabled:a,hidden:c,modifiers:o,showOutsideDays:l,broadcastCalendar:d,today:f}=t,{isSameDay:u,isSameMonth:h,startOfMonth:y,isBefore:C,endOfMonth:x,isAfter:g}=r,k=s&&y(s),T=n&&x(n),b={[F.focused]:[],[F.outside]:[],[F.disabled]:[],[F.hidden]:[],[F.today]:[]},j={};for(const v of e){const{date:D,displayMonth:M}=v,N=!!(M&&!h(D,M)),Y=!!(k&&C(D,k)),P=!!(T&&g(D,T)),A=!!(a&&ee(D,a,r)),Z=!!(c&&ee(D,c,r))||Y||P||!d&&!l&&N||d&&l===!1&&N,de=u(D,f??r.today());N&&b.outside.push(v),A&&b.disabled.push(v),Z&&b.hidden.push(v),de&&b.today.push(v),o&&Object.keys(o).forEach(ue=>{const fe=o?.[ue];fe&&ee(D,fe,r)&&(j[ue]?j[ue].push(v):j[ue]=[v])})}return v=>{const D={[F.focused]:!1,[F.disabled]:!1,[F.hidden]:!1,[F.outside]:!1,[F.today]:!1},M={};for(const N in b){const Y=b[N];D[N]=Y.some(P=>P===v)}for(const N in j)M[N]=j[N].some(Y=>Y===v);return{...D,...M}}}function Ar(e,t,s={}){return Object.entries(e).filter(([,r])=>r===!0).reduce((r,[a])=>(s[a]?r.push(s[a]):t[F[a]]?r.push(t[F[a]]):t[L[a]]&&r.push(t[L[a]]),r),[t[p.Day]])}function Rr(e){return{...Br,...e}}function zr(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([s,n])=>{s.startsWith("data-")&&(t[s]=n)}),t}function $e(){const e={};for(const t in p)e[p[t]]=`rdp-${p[t]}`;for(const t in F)e[F[t]]=`rdp-${F[t]}`;for(const t in L)e[L[t]]=`rdp-${L[t]}`;for(const t in q)e[q[t]]=`rdp-${q[t]}`;return e}function _t(e,t,s){return(s??new $(t)).formatMonthYear(e)}const qr=_t;function Hr(e,t,s){return(s??new $(t)).format(e,"d")}function $r(e,t=Q){return t.format(e,"LLLL")}function Zr(e,t,s){return(s??new $(t)).format(e,"cccccc")}function Ur(e,t=Q){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function Kr(){return""}function It(e,t=Q){return t.format(e,"yyyy")}const Lr=It,Gr=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:_t,formatDay:Hr,formatMonthCaption:qr,formatMonthDropdown:$r,formatWeekNumber:Ur,formatWeekNumberHeader:Kr,formatWeekdayName:Zr,formatYearCaption:Lr,formatYearDropdown:It},Symbol.toStringTag,{value:"Module"}));function Vr(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...Gr,...e}}function Qr(e,t,s,n,r){const{startOfMonth:a,startOfYear:c,endOfYear:o,eachMonthOfInterval:l,getMonth:d}=r;return l({start:c(e),end:o(e)}).map(h=>{const y=n.formatMonthDropdown(h,r),C=d(h),x=t&&h<a(t)||s&&h>a(s)||!1;return{value:C,label:y,disabled:x}})}function Jr(e,t={},s={}){let n={...t?.[p.Day]};return Object.entries(e).filter(([,r])=>r===!0).forEach(([r])=>{n={...n,...s?.[r]}}),n}function Xr(e,t,s){const n=e.today(),r=t?e.startOfISOWeek(n):e.startOfWeek(n),a=[];for(let c=0;c<7;c++){const o=e.addDays(r,c);a.push(o)}return a}function eo(e,t,s,n,r=!1){if(!e||!t)return;const{startOfYear:a,endOfYear:c,eachYearOfInterval:o,getYear:l}=n,d=a(e),f=c(t),u=o({start:d,end:f});return r&&u.reverse(),u.map(h=>{const y=s.formatYearDropdown(h,n);return{value:l(h),label:y,disabled:!1}})}function Ft(e,t,s,n){let r=(n??new $(s)).format(e,"PPPP");return t.today&&(r=`Today, ${r}`),t.selected&&(r=`${r}, selected`),r}const to=Ft;function Yt(e,t,s){return(s??new $(t)).formatMonthYear(e)}const no=Yt;function so(e,t,s,n){let r=(n??new $(s)).format(e,"PPPP");return t?.today&&(r=`Today, ${r}`),r}function ro(e){return"Choose the Month"}function oo(){return""}function ao(e){return"Go to the Next Month"}function io(e){return"Go to the Previous Month"}function co(e,t,s){return(s??new $(t)).format(e,"cccc")}function lo(e,t){return`Week ${e}`}function uo(e){return"Week Number"}function fo(e){return"Choose the Year"}const ho=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:no,labelDay:to,labelDayButton:Ft,labelGrid:Yt,labelGridcell:so,labelMonthDropdown:ro,labelNav:oo,labelNext:ao,labelPrevious:io,labelWeekNumber:lo,labelWeekNumberHeader:uo,labelWeekday:co,labelYearDropdown:fo},Symbol.toStringTag,{value:"Module"})),pe=e=>e instanceof HTMLElement?e:null,Fe=e=>[...e.querySelectorAll("[data-animated-month]")??[]],mo=e=>pe(e.querySelector("[data-animated-month]")),Ye=e=>pe(e.querySelector("[data-animated-caption]")),Be=e=>pe(e.querySelector("[data-animated-weeks]")),yo=e=>pe(e.querySelector("[data-animated-nav]")),go=e=>pe(e.querySelector("[data-animated-weekdays]"));function po(e,t,{classNames:s,months:n,focused:r,dateLib:a}){const c=S.useRef(null),o=S.useRef(n),l=S.useRef(!1);S.useLayoutEffect(()=>{const d=o.current;if(o.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||d.length===0||n.length!==d.length)return;const f=a.isSameMonth(n[0].date,d[0].date),u=a.isAfter(n[0].date,d[0].date),h=u?s[q.caption_after_enter]:s[q.caption_before_enter],y=u?s[q.weeks_after_enter]:s[q.weeks_before_enter],C=c.current,x=e.current.cloneNode(!0);if(x instanceof HTMLElement?(Fe(x).forEach(b=>{if(!(b instanceof HTMLElement))return;const j=mo(b);j&&b.contains(j)&&b.removeChild(j);const v=Ye(b);v&&v.classList.remove(h);const D=Be(b);D&&D.classList.remove(y)}),c.current=x):c.current=null,l.current||f||r)return;const g=C instanceof HTMLElement?Fe(C):[],k=Fe(e.current);if(k?.every(T=>T instanceof HTMLElement)&&g&&g.every(T=>T instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const T=yo(e.current);T&&(T.style.zIndex="1"),k.forEach((b,j)=>{const v=g[j];if(!v)return;b.style.position="relative",b.style.overflow="hidden";const D=Ye(b);D&&D.classList.add(h);const M=Be(b);M&&M.classList.add(y);const N=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),T&&(T.style.zIndex=""),D&&D.classList.remove(h),M&&M.classList.remove(y),b.style.position="",b.style.overflow="",b.contains(v)&&b.removeChild(v)};v.style.pointerEvents="none",v.style.position="absolute",v.style.overflow="hidden",v.setAttribute("aria-hidden","true");const Y=go(v);Y&&(Y.style.opacity="0");const P=Ye(v);P&&(P.classList.add(u?s[q.caption_before_exit]:s[q.caption_after_exit]),P.addEventListener("animationend",N));const A=Be(v);A&&A.classList.add(u?s[q.weeks_before_exit]:s[q.weeks_after_exit]),b.insertBefore(v,b.firstChild)})}})}function vo(e,t,s,n){const r=e[0],a=e[e.length-1],{ISOWeek:c,fixedWeeks:o,broadcastCalendar:l}=s??{},{addDays:d,differenceInCalendarDays:f,differenceInCalendarMonths:u,endOfBroadcastWeek:h,endOfISOWeek:y,endOfMonth:C,endOfWeek:x,isAfter:g,startOfBroadcastWeek:k,startOfISOWeek:T,startOfWeek:b}=n,j=l?k(r,n):c?T(r):b(r),v=l?h(a):c?y(C(a)):x(C(a)),D=f(v,j),M=u(a,r)+1,N=[];for(let A=0;A<=D;A++){const Z=d(j,A);if(t&&g(Z,t))break;N.push(Z)}const P=(l?35:42)*M;if(o&&N.length<P){const A=P-N.length;for(let Z=0;Z<A;Z++){const de=d(N[N.length-1],1);N.push(de)}}return N}function xo(e){const t=[];return e.reduce((s,n)=>{const r=n.weeks.reduce((a,c)=>a.concat(c.days.slice()),t.slice());return s.concat(r.slice())},t.slice())}function bo(e,t,s,n){const{numberOfMonths:r=1}=s,a=[];for(let c=0;c<r;c++){const o=n.addMonths(e,c);if(t&&o>t)break;a.push(o)}return a}function ct(e,t,s,n){const{month:r,defaultMonth:a,today:c=n.today(),numberOfMonths:o=1}=e;let l=r||a||c;const{differenceInCalendarMonths:d,addMonths:f,startOfMonth:u}=n;if(s&&d(s,l)<o-1){const h=-1*(o-1);l=f(s,h)}return t&&d(l,t)<0&&(l=t),u(l)}function Do(e,t,s,n){const{addDays:r,endOfBroadcastWeek:a,endOfISOWeek:c,endOfMonth:o,endOfWeek:l,getISOWeek:d,getWeek:f,startOfBroadcastWeek:u,startOfISOWeek:h,startOfWeek:y}=n,C=e.reduce((x,g)=>{const k=s.broadcastCalendar?u(g,n):s.ISOWeek?h(g):y(g),T=s.broadcastCalendar?a(g):s.ISOWeek?c(o(g)):l(o(g)),b=t.filter(M=>M>=k&&M<=T),j=s.broadcastCalendar?35:42;if(s.fixedWeeks&&b.length<j){const M=t.filter(N=>{const Y=j-b.length;return N>T&&N<=r(T,Y)});b.push(...M)}const v=b.reduce((M,N)=>{const Y=s.ISOWeek?d(N):f(N),P=M.find(Z=>Z.weekNumber===Y),A=new St(N,g,n);return P?P.days.push(A):M.push(new dr(Y,[A])),M},[]),D=new lr(g,v);return x.push(D),x},[]);return s.reverseMonths?C.reverse():C}function ko(e,t){let{startMonth:s,endMonth:n}=e;const{startOfYear:r,startOfDay:a,startOfMonth:c,endOfMonth:o,addYears:l,endOfYear:d,newDate:f,today:u}=t,{fromYear:h,toYear:y,fromMonth:C,toMonth:x}=e;!s&&C&&(s=C),!s&&h&&(s=t.newDate(h,0,1)),!n&&x&&(n=x),!n&&y&&(n=f(y,11,31));const g=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return s?s=c(s):h?s=f(h,0,1):!s&&g&&(s=r(l(e.today??u(),-100))),n?n=o(n):y?n=f(y,11,31):!n&&g&&(n=d(e.today??u())),[s&&a(s),n&&a(n)]}function Mo(e,t,s,n){if(s.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:a=1}=s,{startOfMonth:c,addMonths:o,differenceInCalendarMonths:l}=n,d=r?a:1,f=c(e);if(!t)return o(f,d);if(!(l(t,e)<a))return o(f,d)}function wo(e,t,s,n){if(s.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:a}=s,{startOfMonth:c,addMonths:o,differenceInCalendarMonths:l}=n,d=r?a??1:1,f=c(e);if(!t)return o(f,-d);if(!(l(f,t)<=0))return o(f,-d)}function Co(e){const t=[];return e.reduce((s,n)=>s.concat(n.weeks.slice()),t.slice())}function De(e,t){const[s,n]=S.useState(e);return[t===void 0?s:t,n]}function So(e,t){const[s,n]=ko(e,t),{startOfMonth:r,endOfMonth:a}=t,c=ct(e,s,n,t),[o,l]=De(c,e.month?c:void 0);S.useEffect(()=>{const D=ct(e,s,n,t);l(D)},[e.timeZone]);const d=bo(o,n,e,t),f=vo(d,e.endMonth?a(e.endMonth):void 0,e,t),u=Do(d,f,e,t),h=Co(u),y=xo(u),C=wo(o,s,e,t),x=Mo(o,n,e,t),{disableNavigation:g,onMonthChange:k}=e,T=D=>h.some(M=>M.days.some(N=>N.isEqualTo(D))),b=D=>{if(g)return;let M=r(D);s&&M<r(s)&&(M=r(s)),n&&M>r(n)&&(M=r(n)),l(M),k?.(M)};return{months:u,weeks:h,days:y,navStart:s,navEnd:n,previousMonth:C,nextMonth:x,goToMonth:b,goToDay:D=>{T(D)||b(D.date)}}}var G;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(G||(G={}));function lt(e){return!e[F.disabled]&&!e[F.hidden]&&!e[F.outside]}function Oo(e,t,s,n){let r,a=-1;for(const c of e){const o=t(c);lt(o)&&(o[F.focused]&&a<G.FocusedModifier?(r=c,a=G.FocusedModifier):n?.isEqualTo(c)&&a<G.LastFocused?(r=c,a=G.LastFocused):s(c.date)&&a<G.Selected?(r=c,a=G.Selected):o[F.today]&&a<G.Today&&(r=c,a=G.Today))}return r||(r=e.find(c=>lt(t(c)))),r}function No(e,t,s,n,r,a,c){const{ISOWeek:o,broadcastCalendar:l}=a,{addDays:d,addMonths:f,addWeeks:u,addYears:h,endOfBroadcastWeek:y,endOfISOWeek:C,endOfWeek:x,max:g,min:k,startOfBroadcastWeek:T,startOfISOWeek:b,startOfWeek:j}=c;let D={day:d,week:u,month:f,year:h,startOfWeek:M=>l?T(M,c):o?b(M):j(M),endOfWeek:M=>l?y(M):o?C(M):x(M)}[e](s,t==="after"?1:-1);return t==="before"&&n?D=g([n,D]):t==="after"&&r&&(D=k([r,D])),D}function Bt(e,t,s,n,r,a,c,o=0){if(o>365)return;const l=No(e,t,s.date,n,r,a,c),d=!!(a.disabled&&ee(l,a.disabled,c)),f=!!(a.hidden&&ee(l,a.hidden,c)),u=l,h=new St(l,u,c);return!d&&!f?h:Bt(e,t,h,n,r,a,c,o+1)}function jo(e,t,s,n,r){const{autoFocus:a}=e,[c,o]=S.useState(),l=Oo(t.days,s,n||(()=>!1),c),[d,f]=S.useState(a?l:void 0);return{isFocusTarget:x=>!!l?.isEqualTo(x),setFocused:f,focused:d,blur:()=>{o(d),f(void 0)},moveFocus:(x,g)=>{if(!d)return;const k=Bt(x,g,d,t.navStart,t.navEnd,e,r);k&&(e.disableNavigation&&!t.days.some(b=>b.isEqualTo(k))||(t.goToDay(k),f(k)))}}}function To(e,t){const{selected:s,required:n,onSelect:r}=e,[a,c]=De(s,r?s:void 0),o=r?s:a,{isSameDay:l}=t,d=y=>o?.some(C=>l(C,y))??!1,{min:f,max:u}=e;return{selected:o,select:(y,C,x)=>{let g=[...o??[]];if(d(y)){if(o?.length===f||n&&o?.length===1)return;g=o?.filter(k=>!l(k,y))}else o?.length===u?g=[y]:g=[...g,y];return r||c(g),r?.(g,y,C,x),g},isSelected:d}}function Wo(e,t,s=0,n=0,r=!1,a=Q){const{from:c,to:o}=t||{},{isSameDay:l,isAfter:d,isBefore:f}=a;let u;if(!c&&!o)u={from:e,to:s>0?void 0:e};else if(c&&!o)l(c,e)?s===0?u={from:c,to:e}:r?u={from:c,to:void 0}:u=void 0:f(e,c)?u={from:e,to:c}:u={from:c,to:e};else if(c&&o)if(l(c,e)&&l(o,e))r?u={from:c,to:o}:u=void 0;else if(l(c,e))u={from:c,to:s>0?void 0:e};else if(l(o,e))u={from:e,to:s>0?void 0:e};else if(f(e,c))u={from:e,to:o};else if(d(e,c))u={from:c,to:e};else if(d(e,o))u={from:c,to:e};else throw new Error("Invalid range");if(u?.from&&u?.to){const h=a.differenceInCalendarDays(u.to,u.from);n>0&&h>n?u={from:e,to:void 0}:s>1&&h<s&&(u={from:e,to:void 0})}return u}function Eo(e,t,s=Q){const n=Array.isArray(t)?t:[t];let r=e.from;const a=s.differenceInCalendarDays(e.to,e.from),c=Math.min(a,6);for(let o=0;o<=c;o++){if(n.includes(r.getDay()))return!0;r=s.addDays(r,1)}return!1}function dt(e,t,s=Q){return X(e,t.from,!1,s)||X(e,t.to,!1,s)||X(t,e.from,!1,s)||X(t,e.to,!1,s)}function _o(e,t,s=Q){const n=Array.isArray(t)?t:[t];if(n.filter(o=>typeof o!="function").some(o=>typeof o=="boolean"?o:s.isDate(o)?X(e,o,!1,s):Et(o,s)?o.some(l=>X(e,l,!1,s)):He(o)?o.from&&o.to?dt(e,{from:o.from,to:o.to},s):!1:Wt(o)?Eo(e,o.dayOfWeek,s):Nt(o)?s.isAfter(o.before,o.after)?dt(e,{from:s.addDays(o.after,1),to:s.addDays(o.before,-1)},s):ee(e.from,o,s)||ee(e.to,o,s):jt(o)||Tt(o)?ee(e.from,o,s)||ee(e.to,o,s):!1))return!0;const c=n.filter(o=>typeof o=="function");if(c.length){let o=e.from;const l=s.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=l;d++){if(c.some(f=>f(o)))return!0;o=s.addDays(o,1)}}return!1}function Io(e,t){const{disabled:s,excludeDisabled:n,selected:r,required:a,onSelect:c}=e,[o,l]=De(r,c?r:void 0),d=c?r:o;return{selected:d,select:(h,y,C)=>{const{min:x,max:g}=e,k=h?Wo(h,d,x,g,a,t):void 0;return n&&s&&k?.from&&k.to&&_o({from:k.from,to:k.to},s,t)&&(k.from=h,k.to=void 0),c||l(k),c?.(k,h,y,C),k},isSelected:h=>d&&X(d,h,!1,t)}}function Fo(e,t){const{selected:s,required:n,onSelect:r}=e,[a,c]=De(s,r?s:void 0),o=r?s:a,{isSameDay:l}=t;return{selected:o,select:(u,h,y)=>{let C=u;return!n&&o&&o&&l(u,o)&&(C=void 0),r||c(C),r?.(C,u,h,y),C},isSelected:u=>o?l(o,u):!1}}function Yo(e,t){const s=Fo(e,t),n=To(e,t),r=Io(e,t);switch(e.mode){case"single":return s;case"multiple":return n;case"range":return r;default:return}}function Bo(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new B(t.today,t.timeZone)),t.month&&(t.month=new B(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new B(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new B(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new B(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new B(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(O=>new B(O,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new B(t.selected.from,t.timeZone):void 0,to:t.selected.to?new B(t.selected.to,t.timeZone):void 0}));const{components:s,formatters:n,labels:r,dateLib:a,locale:c,classNames:o}=S.useMemo(()=>{const O={...bt,...t.locale};return{dateLib:new $({locale:O,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:Rr(t.components),formatters:Vr(t.formatters),labels:{...ho,...t.labels},locale:O,classNames:{...$e(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:l,mode:d,navLayout:f,numberOfMonths:u=1,onDayBlur:h,onDayClick:y,onDayFocus:C,onDayKeyDown:x,onDayMouseEnter:g,onDayMouseLeave:k,onNextClick:T,onPrevClick:b,showWeekNumber:j,styles:v}=t,{formatCaption:D,formatDay:M,formatMonthDropdown:N,formatWeekNumber:Y,formatWeekNumberHeader:P,formatWeekdayName:A,formatYearDropdown:Z}=n,de=So(t,a),{days:ue,months:fe,navStart:ve,navEnd:ke,previousMonth:U,nextMonth:K,goToMonth:J}=de,Me=Pr(ue,t,ve,ke,a),{isSelected:we,select:Ce,selected:xe}=Yo(t,a)??{},{blur:Ze,focused:Ue,isFocusTarget:Pt,moveFocus:Ke,setFocused:be}=jo(t,de,Me,we??(()=>!1),a),{labelDayButton:At,labelGridcell:Rt,labelGrid:zt,labelMonthDropdown:qt,labelNav:Le,labelPrevious:Ht,labelNext:$t,labelWeekday:Zt,labelWeekNumber:Ut,labelWeekNumberHeader:Kt,labelYearDropdown:Lt}=r,Gt=S.useMemo(()=>Xr(a,t.ISOWeek),[a,t.ISOWeek]),Ge=d!==void 0||y!==void 0,Se=S.useCallback(()=>{U&&(J(U),b?.(U))},[U,J,b]),Oe=S.useCallback(()=>{K&&(J(K),T?.(K))},[J,K,T]),Vt=S.useCallback((O,I)=>w=>{w.preventDefault(),w.stopPropagation(),be(O),Ce?.(O.date,I,w),y?.(O.date,I,w)},[Ce,y,be]),Qt=S.useCallback((O,I)=>w=>{be(O),C?.(O.date,I,w)},[C,be]),Jt=S.useCallback((O,I)=>w=>{Ze(),h?.(O.date,I,w)},[Ze,h]),Xt=S.useCallback((O,I)=>w=>{const _={ArrowLeft:[w.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[w.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[w.shiftKey?"year":"week","after"],ArrowUp:[w.shiftKey?"year":"week","before"],PageUp:[w.shiftKey?"year":"month","before"],PageDown:[w.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(_[w.key]){w.preventDefault(),w.stopPropagation();const[z,W]=_[w.key];Ke(z,W)}x?.(O.date,I,w)},[Ke,x,t.dir]),en=S.useCallback((O,I)=>w=>{g?.(O.date,I,w)},[g]),tn=S.useCallback((O,I)=>w=>{k?.(O.date,I,w)},[k]),nn=S.useCallback(O=>I=>{const w=Number(I.target.value),_=a.setMonth(a.startOfMonth(O),w);J(_)},[a,J]),sn=S.useCallback(O=>I=>{const w=Number(I.target.value),_=a.setYear(a.startOfMonth(O),w);J(_)},[a,J]),{className:rn,style:on}=S.useMemo(()=>({className:[o[p.Root],t.className].filter(Boolean).join(" "),style:{...v?.[p.Root],...t.style}}),[o,t.className,t.style,v]),an=zr(t),Ve=S.useRef(null);po(Ve,!!t.animate,{classNames:o,months:fe,focused:Ue,dateLib:a});const cn={dayPickerProps:t,selected:xe,select:Ce,isSelected:we,months:fe,nextMonth:K,previousMonth:U,goToMonth:J,getModifiers:Me,components:s,classNames:o,styles:v,labels:r,formatters:n};return m.createElement(Ot.Provider,{value:cn},m.createElement(s.Root,{rootRef:t.animate?Ve:void 0,className:rn,style:on,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...an},m.createElement(s.Months,{className:o[p.Months],style:v?.[p.Months]},!t.hideNavigation&&!f&&m.createElement(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:o[p.Nav],style:v?.[p.Nav],"aria-label":Le(),onPreviousClick:Se,onNextClick:Oe,previousMonth:U,nextMonth:K}),fe.map((O,I)=>m.createElement(s.Month,{"data-animated-month":t.animate?"true":void 0,className:o[p.Month],style:v?.[p.Month],key:I,displayIndex:I,calendarMonth:O},f==="around"&&!t.hideNavigation&&I===0&&m.createElement(s.PreviousMonthButton,{type:"button",className:o[p.PreviousMonthButton],tabIndex:U?void 0:-1,"aria-disabled":U?void 0:!0,"aria-label":Ht(U),onClick:Se,"data-animated-button":t.animate?"true":void 0},m.createElement(s.Chevron,{disabled:U?void 0:!0,className:o[p.Chevron],orientation:t.dir==="rtl"?"right":"left"})),m.createElement(s.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:o[p.MonthCaption],style:v?.[p.MonthCaption],calendarMonth:O,displayIndex:I},l?.startsWith("dropdown")?m.createElement(s.DropdownNav,{className:o[p.Dropdowns],style:v?.[p.Dropdowns]},(()=>{const w=l==="dropdown"||l==="dropdown-months"?m.createElement(s.MonthsDropdown,{key:"month",className:o[p.MonthsDropdown],"aria-label":qt(),classNames:o,components:s,disabled:!!t.disableNavigation,onChange:nn(O.date),options:Qr(O.date,ve,ke,n,a),style:v?.[p.Dropdown],value:a.getMonth(O.date)}):m.createElement("span",{key:"month"},N(O.date,a)),_=l==="dropdown"||l==="dropdown-years"?m.createElement(s.YearsDropdown,{key:"year",className:o[p.YearsDropdown],"aria-label":Lt(a.options),classNames:o,components:s,disabled:!!t.disableNavigation,onChange:sn(O.date),options:eo(ve,ke,n,a,!!t.reverseYears),style:v?.[p.Dropdown],value:a.getYear(O.date)}):m.createElement("span",{key:"year"},Z(O.date,a));return a.getMonthYearOrder()==="year-first"?[_,w]:[w,_]})(),m.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},D(O.date,a.options,a))):m.createElement(s.CaptionLabel,{className:o[p.CaptionLabel],role:"status","aria-live":"polite"},D(O.date,a.options,a))),f==="around"&&!t.hideNavigation&&I===u-1&&m.createElement(s.NextMonthButton,{type:"button",className:o[p.NextMonthButton],tabIndex:K?void 0:-1,"aria-disabled":K?void 0:!0,"aria-label":$t(K),onClick:Oe,"data-animated-button":t.animate?"true":void 0},m.createElement(s.Chevron,{disabled:K?void 0:!0,className:o[p.Chevron],orientation:t.dir==="rtl"?"left":"right"})),I===u-1&&f==="after"&&!t.hideNavigation&&m.createElement(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:o[p.Nav],style:v?.[p.Nav],"aria-label":Le(),onPreviousClick:Se,onNextClick:Oe,previousMonth:U,nextMonth:K}),m.createElement(s.MonthGrid,{role:"grid","aria-multiselectable":d==="multiple"||d==="range","aria-label":zt(O.date,a.options,a)||void 0,className:o[p.MonthGrid],style:v?.[p.MonthGrid]},!t.hideWeekdays&&m.createElement(s.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:o[p.Weekdays],style:v?.[p.Weekdays]},j&&m.createElement(s.WeekNumberHeader,{"aria-label":Kt(a.options),className:o[p.WeekNumberHeader],style:v?.[p.WeekNumberHeader],scope:"col"},P()),Gt.map(w=>m.createElement(s.Weekday,{"aria-label":Zt(w,a.options,a),className:o[p.Weekday],key:String(w),style:v?.[p.Weekday],scope:"col"},A(w,a.options,a)))),m.createElement(s.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:o[p.Weeks],style:v?.[p.Weeks]},O.weeks.map(w=>m.createElement(s.Week,{className:o[p.Week],key:w.weekNumber,style:v?.[p.Week],week:w},j&&m.createElement(s.WeekNumber,{week:w,style:v?.[p.WeekNumber],"aria-label":Ut(w.weekNumber,{locale:c}),className:o[p.WeekNumber],scope:"row",role:"rowheader"},Y(w.weekNumber,a)),w.days.map(_=>{const{date:z}=_,W=Me(_);if(W[F.focused]=!W.hidden&&!!Ue?.isEqualTo(_),W[L.selected]=we?.(z)||W.selected,He(xe)){const{from:Ne,to:je}=xe;W[L.range_start]=!!(Ne&&je&&a.isSameDay(z,Ne)),W[L.range_end]=!!(Ne&&je&&a.isSameDay(z,je)),W[L.range_middle]=X(xe,z,!0,a)}const ln=Jr(W,v,t.modifiersStyles),dn=Ar(W,o,t.modifiersClassNames),un=!Ge&&!W.hidden?Rt(z,W,a.options,a):void 0;return m.createElement(s.Day,{key:`${a.format(z,"yyyy-MM-dd")}_${a.format(_.displayMonth,"yyyy-MM")}`,day:_,modifiers:W,className:dn.join(" "),style:ln,role:"gridcell","aria-selected":W.selected||void 0,"aria-label":un,"data-day":a.format(z,"yyyy-MM-dd"),"data-month":_.outside?a.format(z,"yyyy-MM"):void 0,"data-selected":W.selected||void 0,"data-disabled":W.disabled||void 0,"data-hidden":W.hidden||void 0,"data-outside":_.outside||void 0,"data-focused":W.focused||void 0,"data-today":W.today||void 0},!W.hidden&&Ge?m.createElement(s.DayButton,{className:o[p.DayButton],style:v?.[p.DayButton],type:"button",day:_,modifiers:W,disabled:W.disabled||void 0,tabIndex:Pt(_)?0:-1,"aria-label":At(z,W,a.options,a),onClick:Vt(_,W),onBlur:Jt(_,W),onFocus:Qt(_,W),onKeyDown:Xt(_,W),onMouseEnter:en(_,W),onMouseLeave:tn(_,W)},M(z,a.options,a)):!W.hidden&&M(_.date,a.options,a))})))))))),t.footer&&m.createElement(s.Footer,{className:o[p.Footer],style:v?.[p.Footer],role:"status","aria-live":"polite"},t.footer)))}function Po({className:e,classNames:t,showOutsideDays:s=!0,captionLayout:n="label",buttonVariant:r="ghost",formatters:a,components:c,...o}){const l=$e();return i.jsx(Bo,{showOutsideDays:s,className:E("bg-white group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent dark:bg-gray-950",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:n,formatters:{formatMonthDropdown:d=>d.toLocaleString("default",{month:"short"}),...a},classNames:{root:E("w-fit",l.root),months:E("flex gap-4 flex-col md:flex-row relative",l.months),month:E("flex flex-col w-full gap-4",l.month),nav:E("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",l.nav),button_previous:E(Xe({variant:r}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",l.button_previous),button_next:E(Xe({variant:r}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",l.button_next),month_caption:E("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",l.month_caption),dropdowns:E("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",l.dropdowns),dropdown_root:E("relative has-focus:border-gray-950 border border-gray-200 shadow-xs has-focus:ring-gray-950/50 has-focus:ring-[3px] rounded-md dark:has-focus:border-gray-300 dark:border-gray-800 dark:has-focus:ring-gray-300/50",l.dropdown_root),dropdown:E("absolute bg-white inset-0 opacity-0 dark:bg-gray-950",l.dropdown),caption_label:E("select-none font-medium",n==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-gray-500 [&>svg]:size-3.5 dark:[&>svg]:text-gray-400",l.caption_label),table:"w-full border-collapse",weekdays:E("flex",l.weekdays),weekday:E("text-gray-500 rounded-md flex-1 font-normal text-[0.8rem] select-none dark:text-gray-400",l.weekday),week:E("flex w-full mt-2",l.week),week_number_header:E("select-none w-(--cell-size)",l.week_number_header),week_number:E("text-[0.8rem] select-none text-gray-500 dark:text-gray-400",l.week_number),day:E("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",l.day),range_start:E("rounded-l-md bg-gray-100 dark:bg-gray-800",l.range_start),range_middle:E("rounded-none",l.range_middle),range_end:E("rounded-r-md bg-gray-100 dark:bg-gray-800",l.range_end),today:E("bg-gray-100 text-gray-900 rounded-md data-[selected=true]:rounded-none dark:bg-gray-800 dark:text-gray-50",l.today),outside:E("text-gray-500 aria-selected:text-gray-500 dark:text-gray-400 dark:aria-selected:text-gray-400",l.outside),disabled:E("text-gray-500 opacity-50 dark:text-gray-400",l.disabled),hidden:E("invisible",l.hidden),...t},components:{Root:({className:d,rootRef:f,...u})=>i.jsx("div",{"data-slot":"calendar",ref:f,className:E(d),...u}),Chevron:({className:d,orientation:f,...u})=>f==="left"?i.jsx(Zn,{className:E("size-4",d),...u}):f==="right"?i.jsx(Un,{className:E("size-4",d),...u}):i.jsx(ne,{className:E("size-4",d),...u}),DayButton:Ao,WeekNumber:({children:d,...f})=>i.jsx("td",{...f,children:i.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:d})}),...c},...o})}function Ao({className:e,day:t,modifiers:s,...n}){const r=$e(),a=m.useRef(null);return m.useEffect(()=>{s.focused&&a.current?.focus()},[s.focused]),i.jsx(H,{ref:a,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":s.selected&&!s.range_start&&!s.range_end&&!s.range_middle,"data-range-start":s.range_start,"data-range-end":s.range_end,"data-range-middle":s.range_middle,className:E("data-[selected-single=true]:bg-gray-900 data-[selected-single=true]:text-gray-50 data-[range-middle=true]:bg-gray-100 data-[range-middle=true]:text-gray-900 data-[range-start=true]:bg-gray-900 data-[range-start=true]:text-gray-50 data-[range-end=true]:bg-gray-900 data-[range-end=true]:text-gray-50 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-gray-900 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70 dark:data-[selected-single=true]:bg-gray-50 dark:data-[selected-single=true]:text-gray-900 dark:data-[range-middle=true]:bg-gray-800 dark:data-[range-middle=true]:text-gray-50 dark:data-[range-start=true]:bg-gray-50 dark:data-[range-start=true]:text-gray-900 dark:data-[range-end=true]:bg-gray-50 dark:data-[range-end=true]:text-gray-900 dark:dark:hover:text-gray-50",r.day,e),...n})}function Pe(e){return e?le(e,"yyyy-MM-dd"):""}function Ro(e){return e?!Number.isNaN(e.getTime()):!1}function zo({value:e,onChange:t,disabled:s,...n}){const[r,a]=m.useState(!1),[c,o]=m.useState(e),[l,d]=m.useState(Pe(e));return S.useEffect(()=>{e&&d(Pe(e))},[e]),i.jsxs("div",{className:"relative flex gap-2",children:[i.jsx(xt,{...n,disabled:s,value:l,onChange:f=>{d(f.target.value);const u=f.target.value?new Date(f.target.value):void 0;Ro(u)&&(t?.(u),o(u))},onKeyDown:f=>{f.key==="ArrowDown"&&(f.preventDefault(),a(!0))}}),i.jsxs(Kn,{open:r,onOpenChange:a,children:[i.jsx(Ln,{asChild:!0,children:i.jsxs(H,{id:"date-picker",variant:"ghost",className:"absolute top-1/2 right-2 size-6 -translate-y-1/2",disabled:s,children:[i.jsx(Gn,{className:"size-3.5"}),i.jsx("span",{className:"sr-only",children:"Select date"})]})}),i.jsx(Vn,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:i.jsx(Po,{mode:"single",selected:e,captionLayout:"dropdown",month:c,onMonthChange:o,onSelect:f=>{t?.(f),d(Pe(f??void 0)),a(!1)}})})]})]})}const qo=({close:e,transactionID:t,onChange:s})=>t?i.jsx(Qn,{modalSize:"fit-content",position:"bottom",title:i.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[i.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Edit Transaction:"}),i.jsxs("div",{className:"flex flex-row gap-2",children:["ID: ",t,i.jsx(Jn,{content:t}),i.jsx(Gs,{transactionId:t})]})]}),opened:!!t,onClose:e,children:i.jsx(Vs,{transactionID:t,onDone:e,onChange:s})}):null,Ho=({onDone:e,transactionId:t,chargeId:s})=>{const[n,r]=S.useState(!1),[{data:a,fetching:c}]=mt({query:Xn,pause:!t,variables:{transactionId:t}}),o=a?.transactionsByIDs[0];function l(){r(!1),e?.()}return i.jsxs(es,{open:n,onOpenChange:r,children:[i.jsx(ts,{asChild:!0,children:i.jsx(ut,{label:"Insert Related Misc Expense",children:i.jsx(H,{variant:"ghost",size:"icon",className:"size-7.5",disabled:c,children:i.jsx(Ds,{className:"size-5"})})})}),i.jsxs(ns,{className:"sm:max-w-[425px]",children:[i.jsx(ss,{children:i.jsx(rs,{children:"Insert Misc Expense"})}),o&&i.jsx(Xs,{onDone:l,chargeId:s,defaultValues:{amount:o?.amount.raw?Math.abs(o?.amount.raw):void 0,currency:o?.amount.currency,invoiceDate:o?.eventDate,valueDate:o?.exactEffectiveDate||o?.effectiveDate?new Date(o.exactEffectiveDate??o.effectiveDate):void 0,creditorId:(o?.amount.raw??0)>0?o?.counterparty?.id:void 0,debtorId:(o?.amount.raw??0)<0?o?.counterparty?.id:void 0}})]})]})},$o=({transaction:e})=>{const t="effectiveDate"in e?e.effectiveDate:void 0;return i.jsxs("div",{className:"flex flex-col justify-center",children:[i.jsx("div",{children:t&&le(new Date(t),"dd/MM/yy")}),e.sourceEffectiveDate&&i.jsxs("div",{className:"text-xs text-gray-500",children:["(Originally ",le(new Date(e.sourceEffectiveDate),"dd/MM/yy"),")"]})]})},Zo=({transaction:e})=>{const t="eventDate"in e?e.eventDate:void 0;return i.jsx("div",{className:"flex flex-col justify-center",children:t&&le(new Date(t),"dd/MM/yy")})},Uo=({transaction:e})=>{const t="amount"in e?e.amount:void 0;return i.jsxs("div",{style:{color:Number(t?.raw)>0?"green":"red",whiteSpace:"nowrap"},children:[t?.formatted,i.jsx("br",{}),e.cryptoExchangeRate&&i.jsxs("span",{style:{color:"gray",marginLeft:"0.5rem"},children:[`(Rate: ${e.cryptoExchangeRate.rate})`,i.jsx("br",{}),t?.raw?`${os(t.raw*e.cryptoExchangeRate.rate)}$`:null]})]})},Ko=({transaction:e})=>{const{account:t}=e,s=t.type,n=t.name;return i.jsxs("div",{className:"flex flex-col justify-center",children:[i.jsx("p",{children:s}),i.jsx("p",{children:n})]})},Lo=({transaction:e})=>{const t="sourceDescription"in e?e.sourceDescription:"Missing";return i.jsx("div",{className:"flex flex-wrap",children:i.jsx("div",{className:"flex flex-col justify-center",children:t})})},Go=({transaction:e})=>i.jsx("div",{className:"flex flex-wrap",children:i.jsx("div",{className:"flex flex-col justify-center",children:e.referenceKey})});function Vo({transaction:e,onChange:t}){const{id:s,counterparty:n,missingInfoSuggestions:r,id:a,sourceDescription:c,enableEdit:o}=e,l=!!r?.business&&o,d=l?r?.business?.name:"Missing",f=l?r?.business?.id:null,u=n?.name??d,[h,y]=S.useState(!1),{updateTransaction:C,fetching:x}=qe(),g=S.useCallback(async N=>{await C({transactionId:a,fields:{counterpartyId:N}}),y(!0)},[a,C]),k=S.useCallback(async N=>{await g(N),t?.()},[g,t]),{selectableBusinesses:T,fetching:b}=as(),[j,v]=S.useState(f??null),[D,M]=S.useState(c);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-wrap flex-col justify-center",children:n?.id?i.jsx(ft,{to:ht.BUSINESSES.DETAIL(n.id),target:"_blank",rel:"noreferrer",onClick:N=>N.stopPropagation(),className:"inline-flex items-center font-semibold",children:u}):i.jsxs(i.Fragment,{children:[i.jsx(is,{options:T,value:j,onChange:v,search:D,onSearchChange:M,placeholder:"Choose or create a business",empty:D?i.jsx(cs,{description:D,onAdd:k}):null}),i.jsx(ks,{content:"Approve",children:i.jsx(H,{variant:"outline",size:"icon",onClick:()=>j&&g(j),disabled:x||b||!j,children:i.jsx(ls,{className:"size-4"})})})]})}),i.jsx(bs,{transactionId:s,counterpartyId:n?.id??j,open:h,onOpenChange:y,onClose:t})]})}const Ae=[{accessorKey:"counterparty.name",header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Counterparty",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx(Vo,{transaction:e.original})},{accessorKey:"eventDate",sortingFn:e=>"eventDate"in e.original&&e.original.eventDate?new Date(e.original.eventDate).getTime():0,header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Event Date",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx(Zo,{transaction:e.original})},{accessorKey:"effectiveDate",sortingFn:e=>"effectiveDate"in e.original&&e.original.effectiveDate?new Date(e.original.effectiveDate).getTime():0,header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Debit Date",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx($o,{transaction:e.original})},{accessorKey:"amount.raw",header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Amount",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx(Uo,{transaction:e.original})},{accessorKey:"account.name",header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Account",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx(Ko,{transaction:e.original})},{accessorKey:"sourceDescription",header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Description",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx(Lo,{transaction:e.original})},{accessorKey:"referenceKey",header:({column:e})=>i.jsxs(H,{variant:"ghost",children:["Reference#",e.getIsSorted()&&(e.getIsSorted()==="asc"?i.jsx(ae,{className:"ml-2 h-4 w-4"}):i.jsx(ne,{className:"ml-2 h-4 w-4"}))]}),cell:({row:e})=>i.jsx(Go,{transaction:e.original})}],Qo={accessorKey:"id",header:"Actions",cell:({row:e})=>e.original.enableEdit?i.jsxs(i.Fragment,{children:[i.jsx(ds,{onClick:e.original.editTransaction}),i.jsx(Ho,{chargeId:e.original.chargeId,transactionId:e.original.id,onDone:e.original.onUpdate})]}):e.original.enableChargeLink?i.jsx(Ls,{chargeId:e.original.chargeId}):null},ra=({transactionsProps:e,onChange:t=()=>{},enableEdit:s,enableChargeLink:n})=>{const[r,a]=S.useState(void 0),[c,o]=S.useState([]),l=S.useMemo(()=>e.map(h=>us(fs,h)),[e]),d=S.useMemo(()=>l?.map(h=>({...h,editTransaction:()=>a(h.id),onUpdate:t,enableEdit:s,enableChargeLink:n})),[l,t,s,n]),f=S.useMemo(()=>s||n?[...Ae,Qo]:Ae,[s,n]),u=hs({data:d,columns:f,getCoreRowModel:ys(),onSortingChange:o,getSortedRowModel:ms(),state:{sorting:c}});return i.jsxs(i.Fragment,{children:[i.jsxs(gs,{children:[i.jsx(ps,{children:u.getHeaderGroups().map(h=>i.jsx(We,{children:h.headers.map(y=>i.jsx(vs,{colSpan:y.colSpan,children:y.isPlaceholder?null:et(y.column.columnDef.header,y.getContext())},y.id))},h.id))}),i.jsx(xs,{children:u.getRowModel().rows?.length?u.getRowModel().rows.map(h=>i.jsx(We,{children:h.getVisibleCells().map(y=>i.jsx(tt,{children:et(y.column.columnDef.cell,y.getContext())},y.id))},h.id)):i.jsx(We,{children:i.jsx(tt,{colSpan:Ae.length,className:"h-24 text-center",children:"No results."})})})]}),i.jsx(qo,{transactionID:r,close:()=>a(void 0),onChange:t})]})};export{Uo as A,Vo as C,$o as D,ws as E,Xs as I,tr as M,sa as P,Go as S,ra as T,Zo as a,Ko as b,Lo as c,Ls as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as k,h as M,r as a,t as j,i as A,u as N,k as F,j as e,c as L,l as P,B as S,m as v,n as T,I as z,F as D,o as $,T as O,L as R,p as U,R as b,q,s as _}from"./index-
|
|
1
|
+
import{g as k,h as M,r as a,t as j,i as A,u as N,k as F,j as e,c as L,l as P,B as S,m as v,n as T,I as z,F as D,o as $,T as O,L as R,p as U,R as b,q,s as _}from"./index-BmZql10x.js";import{u as C}from"./use-url-query-DV9K0FAR.js";import{B as Q}from"./business-header-BphijNiC.js";import{C as V,M as H}from"./Checkbox-CSPHEKoR.js";import{P as K}from"./page-layout-DxGYaCiw.js";import{P as G}from"./Pagination-Cp6iKPSu.js";import{P as J,a as W}from"./panel-top-open-CWsfFRNu.js";import"./building-2-DGfYgfU_.js";import"./create-event-handler-BiA-1lGu.js";const X="mergeBusinesses",Y=()=>{const[{fetching:o},d]=k(M),u=a.useCallback(async l=>{const c=`Error merging into business ID [${l.targetBusinessId}]`,t=`${X}-${l.targetBusinessId}`;j.loading("Merging Businesses",{id:t});try{const i=await d(l),s=A(i,c,t);if(s)return j.success("Success",{id:t,description:"Businesses merged"}),s.mergeBusinesses.id}catch(i){console.error(`${c}: ${i}`),j.error("Error",{id:t,description:c,duration:1e5,closeButton:!0})}},[d]);return{fetching:o,mergeBusinesses:u}};function Z({businessIds:o,onDone:d,resetMerge:u}){const{mergeBusinesses:l,fetching:c}=Y(),t=Array.from(new Set(o)),[{data:i,fetching:s}]=N({query:F,variables:{businessIds:t}}),[m,h]=a.useState(i?.businesses[0]),n=i?.businesses.length!==t.length&&"Some businesses were not Found"||void 0,g=i?.businesses||[],p=a.useCallback(async()=>{if(!m){j.error("Error",{description:"No main business selected"});return}if(t.length<2){j.error("Error",{description:"At least 2 businesses are required to execute a merge"});return}return await l({targetBusinessId:m.id,businessIdsToMerge:t.filter(x=>x!==m.id)}),u(),d()},[m,t,l,d,u]);return e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx(L,{})}),!s&&n&&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:n})}),!s&&!n&&e.jsxs(e.Fragment,{children:[e.jsxs("table",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:"Main"}),g.map(x=>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(V,{checked:x.id===m?.id,size:"xl",onClick:()=>{h(x)}})})},x.id))]}),e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),g.map(x=>e.jsx("td",{children:x.name},x.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:s||c,onClick:p,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:d,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(),d()},children:"Reset Merge"})]})]})]})}function ee(o){const[d,{close:u,open:l}]=P(!1),{selected:c,resetMerge:t}=o,i=new Set(c.map(({id:g})=>g)),s=i.size>=1,[m,h]=a.useState(s?"default":"outline");a.useEffect(()=>{h(s?"default":"outline")},[s]);const n=a.useCallback(()=>{u(),c.map(({onChange:g})=>g())},[c,u]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{onClick:()=>{s&&l()},disabled:!s,variant:m,className:v("size-7.5",s?" bg-blue-500 hover:bg-blue-500/90":""),size:"icon",children:e.jsx(H,{className:"size-5"})}),e.jsx(T,{opened:d,onClose:u,size:"auto",centered:!0,children:e.jsx(Z,{businessIds:Array.from(i),onDone:n,resetMerge:t})})]})}function se({activePage:o,setPage:d,totalPages:u=1,businessName:l,setBusinessName:c}){const{get:t,set:i}=C(),[s,m]=a.useState(l);a.useEffect(()=>{const n=o>1?o.toFixed(0):void 0,g=t("page");n!==g&&n!=="1"&&i("page",n)},[o,t,i]),a.useEffect(()=>{const n=setTimeout(()=>{c(s)},600);return()=>{clearTimeout(n)}},[s,c]);const h=n=>{m(n)};return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(G,{className:"flex-auto",value:o,onChange:d,total:u}),e.jsx(z,{className:"w-72",placeholder:"Business Name",defaultValue:l??void 0,onChange:n=>h(n.target.value===""?void 0:n.target.value)})]})}const ue=()=>{const{get:o}=C(),[d,u]=a.useState(!1),[l,c]=a.useState(o("page")?Number(o("page")):1),[t,i]=a.useState(o("name")?o("page"):void 0),{setFiltersContext:s}=a.useContext(D),[{data:m,fetching:h},n]=N({query:_,variables:{page:l,limit:100,name:t}}),g=$(),[p,x]=a.useState([]),y=a.useCallback((r,f)=>{p.map(B=>B.id).includes(r)?x(p.filter(B=>B.id!==r)):x([...p,{id:r,onChange:f}])},[p]);function I(){x([])}a.useEffect(()=>{s(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(se,{activePage:l,setPage:c,businessName:t,setBusinessName:i,totalPages:m?.allBusinesses?.pageInfo.totalPages}),e.jsx(O,{label:"Expand all businesses",children:e.jsx(S,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>u(r=>!r),children:d?e.jsx(J,{className:"size-5"}):e.jsx(W,{className:"size-5"})})}),e.jsx(ee,{selected:p,resetMerge:I})]}))},[m,l,t,d,s,c,i,u,p]);const E=m?.allBusinesses?.nodes.filter(r=>r.__typename==="LtdFinancialEntity").sort((r,f)=>r.name.toLowerCase()>f.name.toLowerCase()?1:-1)??[],w=new Set(p.map(r=>r.id));return e.jsx(K,{title:`Businesses (${m?.allBusinesses?.pageInfo.totalRecords??""})`,description:"All businesses",headerActions:e.jsx("div",{className:"flex items-center py-4 gap-4",children:e.jsx(q,{description:"",onAdd:()=>n()})}),children:h?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(R,{className:v("h-10 w-10 animate-spin mr-2")})}):e.jsx("div",{className:"space-y-2",children:E.map(r=>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(U,{checked:w.has(r.id),onCheckedChange:()=>{y(r.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:()=>{g(b.BUSINESSES.DETAIL(r.id),{state:{from:b.BUSINESSES.ALL}})},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),g(b.BUSINESSES.DETAIL(r.id),{state:{from:b.BUSINESSES.ALL}}))},children:e.jsx(Q,{data:r})})]})},r.id))})})};export{ue as Businesses};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{v as z,r as b,
|
|
1
|
+
import{v as z,r as b,bo as Q,j as e,D as U,aO as W,B as g,z as G,aP as J,aQ as K,b8 as T,al as Z,a_ as R,am as A,an as O,ao as k,ap as E,ar as D,cu as X,J as j,bf as w,fZ as M,f_ as ee,f$ as S,g0 as se,g1 as I,g2 as L,g3 as P,g4 as N,g5 as p,g6 as B,g7 as _,dh as re,g8 as te,ba as ae,bb as le,bc as v,g9 as $,F as de,u as ne,K as oe,N as ce,W as ie,ga as me}from"./index-BmZql10x.js";import{F as V}from"./funnel-BQEGwl1q.js";import{B as ue}from"./building-2-DGfYgfU_.js";import{S as xe}from"./save-BkV97OA1.js";/**
|
|
2
2
|
* @license lucide-react v0.548.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const he=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],be=z("eye-off",he),C=["2020","2021","2022","2023"];function je({selectedBusiness:t,setSelectedBusiness:d,selectedYear:s,setSelectedYear:c,referenceYear:l,setReferenceYear:o}){const[n,r]=b.useState(!s||!t),{selectableBusinesses:a,fetching:i}=U(),h=b.useMemo(()=>t?a.find(f=>f.value===t)?.label??"":"",[a,t]);return e.jsxs(G,{open:n,onOpenChange:r,children:[e.jsx(Q,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx($,{className:"h-4 w-4"}),"מסננים",e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full",children:[h," • ",s]})]})}),e.jsxs(W,{className:"sm:max-w-md",dir:"rtl",children:[e.jsx(J,{children:e.jsxs(X,{className:"flex items-center gap-2",children:[e.jsx($,{className:"h-5 w-5"}),"מסנני דוח"]})}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"business-select",className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4"}),"בחירת עסק"]}),e.jsx(K,{onChange:x=>d(x??void 0),data:a,value:t,disabled:i,placeholder:"Scroll to see all options",triggerProps:{className:"w-full"}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"year-select",className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),"שנת דיווח"]}),e.jsxs(A,{value:s,onValueChange:c,children:[e.jsx(O,{id:"year-select",children:e.jsx(k,{})}),e.jsx(E,{children:C.map(x=>e.jsx(D,{value:x,children:x},x))})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",C.join(", ")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"reference-year-select",className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),"שנת השוואה"]}),e.jsxs(A,{value:l,onValueChange:x=>o(x==="none"?void 0:x),children:[e.jsx(O,{id:"reference-year-select",children:e.jsx(k,{})}),e.jsxs(E,{children:[e.jsx(D,{value:"none",children:"ללא"},"none"),C.map(x=>e.jsx(D,{value:x,children:x},x))]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",C.join(", ")]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(g,{variant:"outline",onClick:()=>r(!1),children:"ביטול"}),e.jsx(g,{onClick:()=>r(!1),children:"אישור"})]})]})]})]})}const m=({label:t,value:d,code:s,referenceValue:c,showEmptyFields:l,showChange:o=!1})=>{const n=h=>l?!0:!r(h),r=h=>!h||h.trim()===""||h==="0"||h==="0.00",a=(h,x)=>{if(!x)return null;const f=q=>Number.parseFloat(q.replace(/[,\s₪]/g,""))||0,_=f(h),F=f(x);return F===0?null:(_-F)/F*100};if(!n(d))return null;const i=o?a(d,c):null;return e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-200",dir:"rtl",children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[t," ",s&&`(${s})`]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium ${r(d)?"text-gray-400":""}`,children:r(d)?"0":d}),i!==null&&e.jsxs("span",{className:`text-xs px-1 py-0.5 rounded ${i>0?"text-green-700 bg-green-100":i<0?"text-red-700 bg-red-100":"text-gray-700 bg-gray-100"}`,children:[i>0?"+":"",i.toFixed(1),"%"]})]})]})},u=({codes:t,referenceCodes:d,code:s,showEmptyFields:c})=>{const{value:l,label:o}=b.useMemo(()=>{const r=t.find(a=>a.code===s);return{value:r?.amount||0,label:r?.label||"לא זוהה קוד"}},[t,s]),n=b.useMemo(()=>d?.find(r=>r.code===s)?.amount.toString()||"",[d,s]);return e.jsx(m,{label:o,value:Z(l,0),code:String(s),showChange:!0,showEmptyFields:c,referenceValue:n})},pe=[{title:"מזומנים ושווי מזומנים",codes:[7110,7120,7150],sumCode:7100},{title:"ניירות ערך",codes:[7215,7225,7230,7290,7295],sumCode:7200},{title:"לקוחות",codes:[7310,7320,7330,7350,7360,7380,7390],sumCode:7300},{title:"חייבים ויתרות חובה",codes:[7410,7420,7430,7440,7450,7461,7462,7470,7490],sumCode:7400},{title:"מסים נדחים לזמן קצר",codes:[7610,7620,7690],sumCode:7600},{title:"הלוואות לזמן קצר",codes:[7711,7712,7720],sumCode:7700},{title:"מלאי",codes:[7805,7810,7815,7820,7825,7830,7840,7850,7860,7870,7890],sumCode:7800}],ge=[{title:"רכוש קבוע",codes:[8010,8020,8025,8030,8040,8050,8060,8080,8090,8095,8100,8105,8110,8120,8130,8140,8150,8160,8170,8180,8190],sumCode:8e3},{title:"נכסים לא שוטפים מוחזקים למכירה",codes:[8710],sumCode:8700},{title:"הוצאות מראש לזמן ארוך",codes:[8210,8220,8290],sumCode:8200},{title:"השקעות בחברות מוחזקות כלולות ומאוחדות",codes:[8315,8325,8335,8340,8350],sumCode:8300},{title:'השקעות בחברות אחרות כולל ני"ע סחירים מוחזקים לזמן ארוך',codes:[8410,8420,8440,8450,8460,8490],sumCode:8400},{title:"מסים נדחים לזמן ארוך",codes:[8510,8520,8590],sumCode:8500},{title:"הוצאות נדחות ורכוש אחר",codes:[8610,8620,8630,8640,8690],sumCode:8600}],fe=[{title:"בנקים והלואות לזמן קצר",codes:[9110,9120,9130,9140,9151,9152,9190],sumCode:9100},{title:"ספקים ונותני שירותים",codes:[9210,9220,9230,9290],sumCode:9200},{title:"זכאים ויתרות זכות",codes:[9310,9320,9330,9340,9350,9360,9370,9410,9420,9431,9432,9435,9440,9450,9460,9470,9480,9490],sumCode:9400},{title:"עתודה למסים נדחים לזמן קצר",codes:[9510,9520,9530],sumCode:9500}],Ne=[{title:"התחייבויות לזמן ארוך",codes:[9605,9610,9620,9631,9632,9640,9650,9660,9670,9690],sumCode:9600},{title:"התחייבויות בשל סיום יחסי עובד-מעביד",codes:[9710,9720,9790],sumCode:9700},{title:"עתודה למסים נדחים לזמן ארוך",codes:[9810,9820,9890],sumCode:9800}],ve=[{title:"הון עצמי",codes:[9910,9920,9930,9940,9950,9960,9980],sumCode:9900}];function Ce({data:t,referenceData:d,showEmptyFields:s=!1}){const l=j(M,t).balanceSheet||[],n=j(M,d)?.balanceSheet||[];return e.jsx(w,{value:"balanceSheet",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"נתוני המאזן"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-lg font-bold text-blue-800 border-b pb-2",children:"נכסים"}),e.jsx("div",{className:"bg-blue-100 p-4 rounded-md border-2 border-blue-300",children:e.jsx("h5",{className:"font-bold",children:"רכוש שוטף"})}),pe.map(r=>e.jsxs("div",{className:"bg-blue-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),e.jsx("div",{className:"bg-blue-100 p-4 rounded-md border-2 border-blue-300",children:e.jsx(u,{codes:l,code:7e3,showEmptyFields:s})}),ge.map(r=>e.jsxs("div",{className:"bg-blue-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),e.jsx("div",{className:"bg-blue-100 p-4 rounded-md border-2 border-blue-300",children:e.jsx(u,{codes:l,code:8888,showEmptyFields:s})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-lg font-bold text-red-800 border-b pb-2",children:"התחייבויות והון"}),e.jsx("div",{className:"bg-red-100 p-4 rounded-md border-2 border-red-300",children:e.jsx("h5",{className:"font-bold",children:"התחייבויות שוטפות"})}),fe.map(r=>e.jsxs("div",{className:"bg-red-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),e.jsx("div",{className:"bg-red-100 p-4 rounded-md border-2 border-red-300",children:e.jsx(u,{codes:l,code:9e3,showEmptyFields:s})}),Ne.map(r=>e.jsxs("div",{className:"bg-red-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),ve.map(r=>e.jsxs("div",{className:"bg-green-50 p-4 rounded-md",children:[e.jsx("h5",{className:"font-bold mb-3",children:r.title}),e.jsx("div",{className:"space-y-2",children:r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a))})]},r.title)),e.jsx("div",{className:"bg-red-100 p-4 rounded-md border-2 border-red-300",children:e.jsx(u,{codes:l,code:9999,showEmptyFields:s})})]})]})]})})}const ye=t=>{switch(t){case"1":return"תעשייתי";case"2":return"מסחרי";case"3":return"נותני שירותים";case"99":return"הדיווח כולל יותר מעסק אחד";default:return""}},Se=t=>{switch(t){case S.Cash:return"מזומן";case S.Accrual:return"מצטבר";case S.DollarRegulations:return"לפי תקנות דולריות";default:return""}},we=t=>{switch(t){case I.Shekels:return"שקלים";case I.Dollars:return"דולרים";default:return""}},Fe=t=>{switch(t){case L.DoubleEntry:return"כפולה";case L.SingleEntry:return"חד-צידית";default:return""}},Te=t=>{switch(t){case B.Computerized:return"ממוחשב";case B.Manual:return"ידני";default:return""}},De=t=>{switch(t){case N.Option_1:return"חלופה 1";case N.Option_2Adjustments:return"התאמות חשבונאיות למי שיישם את חלופה 2 בהוראת ביצוע 7/2010";case N.Option_3Adjustments:return"התאמות חשבונאיות למי שיישם את חלופה 3 בהוראת ביצוע 7/2010";case N.None:return"ללא חלופה";default:return""}},Re=t=>{switch(t){case p.Unqualified:return"נוסח אחיד (בלתי מסוייג)";case p.UnqualifiedWithGoingConcern:return"בנוסח אחיד עם הפניית תשומת לב להערת עסק חי";case p.UnqualifiedWithOtherEmphases:return"בנוסח אחיד עם הפניות תשומת לב אחרת";case p.Qualified:return"הסתייגות";case p.Adverse:return"שלילית";case p.Disclaimer:return"המנעות";case p.None:return"אין חוות דעת";default:return""}},y=t=>t==null?"":t?"כן":"לא";function Ae({data:t,businessInfo:d}){const{header:s}=j(ee,t),c=j(se,d);return e.jsx(w,{value:"header",className:"border rounded-md p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",dir:"rtl",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"פרטים מזהים"}),e.jsx(m,{label:"השם הרשום",value:c.name,showEmptyFields:!0}),e.jsx(m,{label:"תיאור העיסוק המדווח",value:s.businessDescription??"",showEmptyFields:!0}),e.jsx(m,{label:"מספר זהות",value:s.idNumber,showEmptyFields:!0}),e.jsx(m,{label:"מספר תיק",value:s.taxFileNumber,showEmptyFields:!0}),e.jsx(m,{label:'תיק מדווח למע"מ',value:s.vatFileNumber??"",showEmptyFields:!0}),e.jsx(m,{label:"מספר תיק ניכויים",value:s.withholdingTaxFileNumber??"",showEmptyFields:!0})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"פרטי העסק"}),e.jsx(m,{value:ye(s.businessType),label:"סוג העסק המדווח",showEmptyFields:!0}),e.jsx(m,{label:"שיטת דיווח",value:Se(s.reportingMethod),showEmptyFields:!0}),s.reportingMethod===S.DollarRegulations&&e.jsx(m,{label:"מטבע הסכומים",value:we(s.currencyType),showEmptyFields:!0}),e.jsx(m,{label:"הסכום באלפים",value:y(s.amountsInThousands),showEmptyFields:!0}),e.jsx(m,{label:"שיטת חשבונאות",value:Fe(s.accountingMethod),showEmptyFields:!0}),e.jsx(m,{label:"הנהלת חשבונות",value:Te(s.accountingSystem),showEmptyFields:!0}),e.jsx(m,{label:"חייב ברישום תוכנה",value:y(!!s.softwareRegistrationNumber),showEmptyFields:!0}),s.softwareRegistrationNumber&&e.jsx(m,{label:"מספר תעודת רישום",value:s.softwareRegistrationNumber,showEmptyFields:!0}),e.jsx(m,{label:"דוח בגין שותפות",value:y(!!s.isPartnership),showEmptyFields:!0}),s.isPartnership&&e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"מספר שותפים",value:s.partnershipCount?.toString()??"",showEmptyFields:!0}),e.jsx(m,{label:"חלקי ברווחי השותפות",value:`${s.partnershipProfitShare}%`,showEmptyFields:!0})]}),e.jsx(m,{label:"יישום תקני חשבונאות (IFRS)",value:y(!!s.ifrsImplementationYear||!!s.ifrsReportingOption),showEmptyFields:!0}),(!!s.ifrsImplementationYear||!!s.ifrsReportingOption)&&e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"החל משנת המס",value:s.ifrsImplementationYear??"",showEmptyFields:!0}),e.jsx(m,{label:"דווח בחלופה",value:De(s.ifrsReportingOption),showEmptyFields:!0})]}),e.jsx(m,{label:"מספר ענף כלכלי של המדווח",value:s.industryCode,showEmptyFields:!0}),e.jsx(m,{label:"חוות דעת המבקר",value:Re(s.auditOpinionType),showEmptyFields:!0})]})]})})}const Oe=[{title:"הכנסות ממכירות ומתן שירותים",color:"text-blue-700",codes:[1010,1015,1020,1025,1030,1040,1051,1052,1090],sumCode:1e3},{title:"עלות המכירות ומתן השירותים וביצוע עבודות",color:"text-purple-700",codes:[1306,1308,1307,1310,1320,1330,1340,1350,1360,1371,1372,1390,1400,1450],sumCode:1300},{title:"עלויות ייצור ועלויות אצל קבלן בונה",color:"text-rose-700",codes:[2005,2006,2011,2012,2015,2020,2025,2030,2035,2040,2045,2050,2060,2066,2067,2068,2070,2075,2080,2085,2090,2095],sumCode:2e3},{title:"הוצאות מחקר ופיתוח",color:"text-amber-700",codes:[2510,2520,2530,2540,2550,2560,2570,2590],sumCode:2500},{title:"הוצאות מכירה",color:"text-green-700",codes:[3011,3013,3012,3015,3020,3025,3030,3040,3045,3050,3060,3066,3067,3068,3070,3075,3080,3085,3090,3100,3120,3190],sumCode:3e3},{title:"הוצאות הנהלה וכלליות",color:"text-cyan-700",codes:[3511,3513,3512,3515,3520,3530,3535,3540,3545,3550,3560,3566,3567,3568,3570,3575,3580,3590,3595,3600,3610,3620,3625,3631,3632,3640,3650,3660,3665,3680,3685,3690],sumCode:3500},{title:"הוצאות מימון",color:"text-indigo-700",codes:[5010,5020,5025,5030,5040,5050,5051,5090],sumCode:5e3},{title:"הכנסות מימון",color:"text-fuchsia-700",codes:[5110,5121,5122,5130,5150,5160,5190],sumCode:5100},{title:"הכנסות אחרות",color:"text-red-700",codes:[5210,5220,5230,5236,5237,5240,5250,5260,5270,5290],sumCode:5200},{title:"הוצאות אחרות",color:"text-yellow-700",codes:[5310,5320,5330,5390],sumCode:5300}],ke=[{title:"מסים על הכנסה",color:"text-sky-700",codes:[5610,5620,5630],sumCode:5600},{title:"ייעוד הרווחים",color:"text-violet-700",codes:[5710],sumCode:5700},{title:"רווח/הפסד אקויטי",color:"text-pink-700",codes:[5810],sumCode:5800}];function Ee({selectedYear:t,referenceYear:d,data:s,referenceData:c,showEmptyFields:l=!1}){const{profitAndLoss:o}=j(P,s),r=j(P,c)?.profitAndLoss||[];return e.jsx(w,{value:"profitLoss",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"נתוני רווח והפסד"}),d&&t!==d&&e.jsxs("span",{className:"text-sm text-blue-600 bg-blue-50 px-2 py-1 rounded",children:["מציג שינויים לעומת ",d]})]}),Oe.map(a=>e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:`font-bold mb-4 ${a.color}`,children:a.title}),e.jsxs("div",{className:"space-y-2",children:[a.codes.map(i=>e.jsx(u,{codes:o,referenceCodes:r,code:i,showEmptyFields:l},i)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:o,referenceCodes:r,code:a.sumCode,showEmptyFields:l})})]})]},a.title)),e.jsx("div",{className:"bg-emerald-50 p-4 rounded-md border-2 border-emerald-200",children:e.jsx(u,{codes:o,referenceCodes:r,code:6666,showEmptyFields:l})}),ke.map(a=>e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:`font-bold mb-4 ${a.color}`,children:a.title}),e.jsxs("div",{className:"space-y-2",children:[a.codes.map(i=>e.jsx(u,{codes:o,referenceCodes:r,code:i,showEmptyFields:l},i)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:o,referenceCodes:r,code:a.sumCode,showEmptyFields:l})})]})]},a.title))]})})}const Me=[{title:"התאמות חשבונאיות למי שיישם את חלופה 2 בהוראת ביצוע 7/2010 בנושא IFRS",color:"red",codes:[103,104]},{title:"התאמות נדרשות לצרכי מס (הוסף/הפחת)",color:"yellow",codes:[110,120,130,135,140,150,160,170,180,181,182,183,184,190,200,300,310,320,330,350,360],sumCode:370},{title:"התאמות חשבונאיות למי שיישם את חלופה 3 בהוראת ביצוע 7/2010 בנושא IFRS שלא מצאו את ביטויין בהתאמות הנדרשות לצרכי מס",color:"emerald",codes:[383],sumCode:400},{title:"יישום הוראות חוקי מס נוספים",color:"sky",codes:[430,480,490],sumCode:500},{title:"נתונים נוספים",color:"violet",codes:[510,520,530,540,550,570,575,580,585,590]},{title:"בשותפות",color:"pink",codes:[600]}],H={red:{header:"text-red-700",sum:"bg-red-50 border-red-200"},yellow:{header:"text-yellow-700",sum:"bg-yellow-50 border-yellow-200"},emerald:{header:"text-emerald-700",sum:"bg-emerald-50 border-emerald-200"},sky:{header:"text-sky-700",sum:"bg-sky-50 border-sky-200"},violet:{header:"text-violet-700",sum:"bg-violet-50 border-violet-200"},pink:{header:"text-pink-700",sum:"bg-pink-50 border-pink-200"}};function Ie({data:t,referenceData:d,showEmptyFields:s=!1}){const{taxAdjustment:c}=j(V,t),o=j(V,d)?.taxAdjustment||[];return e.jsx(w,{value:"taxAdjustment",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:'נתוני דו"ח התאמה למס'}),e.jsx("div",{className:"bg-emerald-50 p-4 rounded-md border-2 border-emerald-200",children:e.jsx(u,{codes:c,referenceCodes:o,code:100,showEmptyFields:s})}),Me.map(n=>{const{header:r,sum:a}=H[n.color]||H.red;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:"font-bold mb-4 "+r,children:n.title}),e.jsx("div",{className:"space-y-2",children:n.codes.map(i=>e.jsx(u,{codes:c,referenceCodes:o,code:i,showEmptyFields:s},i))})]}),n.sumCode&&e.jsx("div",{className:"p-4 rounded-md border-2 "+a,children:e.jsx(u,{codes:c,referenceCodes:o,code:n.sumCode,showEmptyFields:s})})]},n.title)})]})})}function Le({data:t,referenceData:d,businessInfo:s,selectedYear:c,referenceYear:l}){const o=j(Y,t),n=j(Y,d),[r,a]=b.useState("header"),[i,h]=b.useState(!0);return e.jsxs("div",{className:"p-4 border-gray-300",dir:"rtl",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g,{variant:i?"outline":"default",size:"sm",onClick:()=>h(!i),className:"flex items-center gap-2",children:[i?e.jsx(be,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"}),i?"הסתר שדות ריקים":"הצג שדות ריקים"]}),e.jsx("span",{className:"text-sm text-gray-500",children:i?"מציג את כל השדות":"מציג רק שדות עם נתונים"})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(te,{className:"h-4 w-4"}),"הורד"]}),e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(xe,{className:"h-4 w-4"}),"שמור"]})]})]}),e.jsxs(ae,{value:r,onValueChange:a,className:"w-full",children:[e.jsxs(le,{className:"grid grid-cols-4 w-full",dir:"rtl",children:[e.jsx(v,{value:"header",children:"פרטים מזהים"}),e.jsx(v,{value:"profitLoss",children:"רווח והפסד"}),e.jsx(v,{value:"taxAdjustment",children:"התאמה למס"}),e.jsx(v,{value:"balanceSheet",children:"מאזן"})]}),e.jsx(Ae,{data:o,businessInfo:s}),e.jsx(Ee,{selectedYear:c,referenceYear:l,data:o,referenceData:n,showEmptyFields:i}),e.jsx(Ie,{data:o,referenceData:n,showEmptyFields:i}),e.jsx(Ce,{data:o,referenceData:n,showEmptyFields:i})]})]})}function _e(){const{setFiltersContext:t}=b.useContext(de),[d,s]=b.useState(void 0),[c,l]=b.useState(void 0),[o,n]=b.useState(void 0),[{data:r,fetching:a}]=ne({query:me,variables:{year:c?Number.parseInt(c,10):0,businessId:d},pause:!c||!d});return b.useEffect(()=>{t(e.jsx("div",{className:"flex flex-row gap-x-5",dir:"rtl",children:e.jsx(je,{selectedBusiness:d,setSelectedBusiness:s,selectedYear:c,setSelectedYear:l,referenceYear:o,setReferenceYear:n})}))},[t,d,c,o]),e.jsx("div",{className:"container mx-auto",dir:"rtl",children:e.jsxs(oe,{className:"border-2 border-gray-300",children:[e.jsx(ce,{className:"bg-gray-100 border-b-2 border-gray-300 flex flex-row justify-between items-center",children:e.jsxs("div",{className:"text-center w-full",children:[e.jsx("h1",{className:"text-2xl font-bold",children:'נספח לטופס הדו"ח השנתי ליחיד ולחבר בני אדם'}),e.jsxs("h2",{className:"text-xl",children:["לשנת המס ",c]}),e.jsx("p",{className:"text-sm",children:'נתוני הדוחות הכספיים, מאזן, רווח והפסד ודו"ח ההתאמה למס'})]})}),e.jsx(ie,{className:"p-0",children:e.jsx(Be,{fetching:a,data:r,selectedBusiness:d,selectedYear:c,referenceYear:o})})]})})}function Be({fetching:t,data:d,selectedBusiness:s,selectedYear:c,referenceYear:l}){if(t)return e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"טוען נתונים..."})});if(!c||!s)return e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"יש לבחור עסק ושנת דיווח"})});const o=d?.shaam6111.data;return o?e.jsx(Le,{data:o,businessInfo:d.shaam6111.business,selectedBusiness:s,selectedYear:c,referenceYear:l}):e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"אין נתונים זמינים עבור העסק והשנה שנבחרו"})})}export{_e as Shaam6111Report};
|
|
6
|
+
*/const he=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],be=z("eye-off",he),C=["2020","2021","2022","2023"];function je({selectedBusiness:t,setSelectedBusiness:d,selectedYear:s,setSelectedYear:c,referenceYear:l,setReferenceYear:o}){const[n,r]=b.useState(!s||!t),{selectableBusinesses:a,fetching:i}=Q(),h=b.useMemo(()=>t?a.find(f=>f.value===t)?.label??"":"",[a,t]);return e.jsxs(U,{open:n,onOpenChange:r,children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4"}),"מסננים",e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full",children:[h," • ",s]})]})}),e.jsxs(G,{className:"sm:max-w-md",dir:"rtl",children:[e.jsx(J,{children:e.jsxs(K,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5"}),"מסנני דוח"]})}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"business-select",className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4"}),"בחירת עסק"]}),e.jsx(Z,{onChange:x=>d(x??void 0),data:a,value:t,disabled:i,placeholder:"Scroll to see all options",triggerProps:{className:"w-full"}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"year-select",className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),"שנת דיווח"]}),e.jsxs(A,{value:s,onValueChange:c,children:[e.jsx(O,{id:"year-select",children:e.jsx(k,{})}),e.jsx(E,{children:C.map(x=>e.jsx(D,{value:x,children:x},x))})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",C.join(", ")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"reference-year-select",className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),"שנת השוואה"]}),e.jsxs(A,{value:l,onValueChange:x=>o(x==="none"?void 0:x),children:[e.jsx(O,{id:"reference-year-select",children:e.jsx(k,{})}),e.jsxs(E,{children:[e.jsx(D,{value:"none",children:"ללא"},"none"),C.map(x=>e.jsx(D,{value:x,children:x},x))]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",C.join(", ")]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(g,{variant:"outline",onClick:()=>r(!1),children:"ביטול"}),e.jsx(g,{onClick:()=>r(!1),children:"אישור"})]})]})]})]})}const m=({label:t,value:d,code:s,referenceValue:c,showEmptyFields:l,showChange:o=!1})=>{const n=h=>l?!0:!r(h),r=h=>!h||h.trim()===""||h==="0"||h==="0.00",a=(h,x)=>{if(!x)return null;const f=q=>Number.parseFloat(q.replace(/[,\s₪]/g,""))||0,H=f(h),F=f(x);return F===0?null:(H-F)/F*100};if(!n(d))return null;const i=o?a(d,c):null;return e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-200",dir:"rtl",children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[t," ",s&&`(${s})`]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium ${r(d)?"text-gray-400":""}`,children:r(d)?"0":d}),i!==null&&e.jsxs("span",{className:`text-xs px-1 py-0.5 rounded ${i>0?"text-green-700 bg-green-100":i<0?"text-red-700 bg-red-100":"text-gray-700 bg-gray-100"}`,children:[i>0?"+":"",i.toFixed(1),"%"]})]})]})},u=({codes:t,referenceCodes:d,code:s,showEmptyFields:c})=>{const{value:l,label:o}=b.useMemo(()=>{const r=t.find(a=>a.code===s);return{value:r?.amount||0,label:r?.label||"לא זוהה קוד"}},[t,s]),n=b.useMemo(()=>d?.find(r=>r.code===s)?.amount.toString()||"",[d,s]);return e.jsx(m,{label:o,value:X(l,0),code:String(s),showChange:!0,showEmptyFields:c,referenceValue:n})},pe=[{title:"מזומנים ושווי מזומנים",codes:[7110,7120,7150],sumCode:7100},{title:"ניירות ערך",codes:[7215,7225,7230,7290,7295],sumCode:7200},{title:"לקוחות",codes:[7310,7320,7330,7350,7360,7380,7390],sumCode:7300},{title:"חייבים ויתרות חובה",codes:[7410,7420,7430,7440,7450,7461,7462,7470,7490],sumCode:7400},{title:"מסים נדחים לזמן קצר",codes:[7610,7620,7690],sumCode:7600},{title:"הלוואות לזמן קצר",codes:[7711,7712,7720],sumCode:7700},{title:"מלאי",codes:[7805,7810,7815,7820,7825,7830,7840,7850,7860,7870,7890],sumCode:7800}],ge=[{title:"רכוש קבוע",codes:[8010,8020,8025,8030,8040,8050,8060,8080,8090,8095,8100,8105,8110,8120,8130,8140,8150,8160,8170,8180,8190],sumCode:8e3},{title:"נכסים לא שוטפים מוחזקים למכירה",codes:[8710],sumCode:8700},{title:"הוצאות מראש לזמן ארוך",codes:[8210,8220,8290],sumCode:8200},{title:"השקעות בחברות מוחזקות כלולות ומאוחדות",codes:[8315,8325,8335,8340,8350],sumCode:8300},{title:'השקעות בחברות אחרות כולל ני"ע סחירים מוחזקים לזמן ארוך',codes:[8410,8420,8440,8450,8460,8490],sumCode:8400},{title:"מסים נדחים לזמן ארוך",codes:[8510,8520,8590],sumCode:8500},{title:"הוצאות נדחות ורכוש אחר",codes:[8610,8620,8630,8640,8690],sumCode:8600}],fe=[{title:"בנקים והלואות לזמן קצר",codes:[9110,9120,9130,9140,9151,9152,9190],sumCode:9100},{title:"ספקים ונותני שירותים",codes:[9210,9220,9230,9290],sumCode:9200},{title:"זכאים ויתרות זכות",codes:[9310,9320,9330,9340,9350,9360,9370,9410,9420,9431,9432,9435,9440,9450,9460,9470,9480,9490],sumCode:9400},{title:"עתודה למסים נדחים לזמן קצר",codes:[9510,9520,9530],sumCode:9500}],Ne=[{title:"התחייבויות לזמן ארוך",codes:[9605,9610,9620,9631,9632,9640,9650,9660,9670,9690],sumCode:9600},{title:"התחייבויות בשל סיום יחסי עובד-מעביד",codes:[9710,9720,9790],sumCode:9700},{title:"עתודה למסים נדחים לזמן ארוך",codes:[9810,9820,9890],sumCode:9800}],ve=[{title:"הון עצמי",codes:[9910,9920,9930,9940,9950,9960,9980],sumCode:9900}];function Ce({data:t,referenceData:d,showEmptyFields:s=!1}){const l=j(M,t).balanceSheet||[],n=j(M,d)?.balanceSheet||[];return e.jsx(w,{value:"balanceSheet",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"נתוני המאזן"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-lg font-bold text-blue-800 border-b pb-2",children:"נכסים"}),e.jsx("div",{className:"bg-blue-100 p-4 rounded-md border-2 border-blue-300",children:e.jsx("h5",{className:"font-bold",children:"רכוש שוטף"})}),pe.map(r=>e.jsxs("div",{className:"bg-blue-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),e.jsx("div",{className:"bg-blue-100 p-4 rounded-md border-2 border-blue-300",children:e.jsx(u,{codes:l,code:7e3,showEmptyFields:s})}),ge.map(r=>e.jsxs("div",{className:"bg-blue-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),e.jsx("div",{className:"bg-blue-100 p-4 rounded-md border-2 border-blue-300",children:e.jsx(u,{codes:l,code:8888,showEmptyFields:s})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-lg font-bold text-red-800 border-b pb-2",children:"התחייבויות והון"}),e.jsx("div",{className:"bg-red-100 p-4 rounded-md border-2 border-red-300",children:e.jsx("h5",{className:"font-bold",children:"התחייבויות שוטפות"})}),fe.map(r=>e.jsxs("div",{className:"bg-red-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),e.jsx("div",{className:"bg-red-100 p-4 rounded-md border-2 border-red-300",children:e.jsx(u,{codes:l,code:9e3,showEmptyFields:s})}),Ne.map(r=>e.jsxs("div",{className:"bg-red-50 p-4 rounded-md",children:[e.jsx("h6",{className:"font-bold mb-3",children:r.title}),e.jsxs("div",{className:"space-y-2",children:[r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:l,referenceCodes:n,code:r.sumCode,showEmptyFields:s})})]})]},r.title)),ve.map(r=>e.jsxs("div",{className:"bg-green-50 p-4 rounded-md",children:[e.jsx("h5",{className:"font-bold mb-3",children:r.title}),e.jsx("div",{className:"space-y-2",children:r.codes.map(a=>e.jsx(u,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a))})]},r.title)),e.jsx("div",{className:"bg-red-100 p-4 rounded-md border-2 border-red-300",children:e.jsx(u,{codes:l,code:9999,showEmptyFields:s})})]})]})]})})}const ye=t=>{switch(t){case"1":return"תעשייתי";case"2":return"מסחרי";case"3":return"נותני שירותים";case"99":return"הדיווח כולל יותר מעסק אחד";default:return""}},Se=t=>{switch(t){case S.Cash:return"מזומן";case S.Accrual:return"מצטבר";case S.DollarRegulations:return"לפי תקנות דולריות";default:return""}},we=t=>{switch(t){case I.Shekels:return"שקלים";case I.Dollars:return"דולרים";default:return""}},Fe=t=>{switch(t){case L.DoubleEntry:return"כפולה";case L.SingleEntry:return"חד-צידית";default:return""}},Te=t=>{switch(t){case P.Computerized:return"ממוחשב";case P.Manual:return"ידני";default:return""}},De=t=>{switch(t){case N.Option_1:return"חלופה 1";case N.Option_2Adjustments:return"התאמות חשבונאיות למי שיישם את חלופה 2 בהוראת ביצוע 7/2010";case N.Option_3Adjustments:return"התאמות חשבונאיות למי שיישם את חלופה 3 בהוראת ביצוע 7/2010";case N.None:return"ללא חלופה";default:return""}},Re=t=>{switch(t){case p.Unqualified:return"נוסח אחיד (בלתי מסוייג)";case p.UnqualifiedWithGoingConcern:return"בנוסח אחיד עם הפניית תשומת לב להערת עסק חי";case p.UnqualifiedWithOtherEmphases:return"בנוסח אחיד עם הפניות תשומת לב אחרת";case p.Qualified:return"הסתייגות";case p.Adverse:return"שלילית";case p.Disclaimer:return"המנעות";case p.None:return"אין חוות דעת";default:return""}},y=t=>t==null?"":t?"כן":"לא";function Ae({data:t,businessInfo:d}){const{header:s}=j(ee,t),c=j(se,d);return e.jsx(w,{value:"header",className:"border rounded-md p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",dir:"rtl",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"פרטים מזהים"}),e.jsx(m,{label:"השם הרשום",value:c.name,showEmptyFields:!0}),e.jsx(m,{label:"תיאור העיסוק המדווח",value:s.businessDescription??"",showEmptyFields:!0}),e.jsx(m,{label:"מספר זהות",value:s.idNumber,showEmptyFields:!0}),e.jsx(m,{label:"מספר תיק",value:s.taxFileNumber,showEmptyFields:!0}),e.jsx(m,{label:'תיק מדווח למע"מ',value:s.vatFileNumber??"",showEmptyFields:!0}),e.jsx(m,{label:"מספר תיק ניכויים",value:s.withholdingTaxFileNumber??"",showEmptyFields:!0})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"פרטי העסק"}),e.jsx(m,{value:ye(s.businessType),label:"סוג העסק המדווח",showEmptyFields:!0}),e.jsx(m,{label:"שיטת דיווח",value:Se(s.reportingMethod),showEmptyFields:!0}),s.reportingMethod===S.DollarRegulations&&e.jsx(m,{label:"מטבע הסכומים",value:we(s.currencyType),showEmptyFields:!0}),e.jsx(m,{label:"הסכום באלפים",value:y(s.amountsInThousands),showEmptyFields:!0}),e.jsx(m,{label:"שיטת חשבונאות",value:Fe(s.accountingMethod),showEmptyFields:!0}),e.jsx(m,{label:"הנהלת חשבונות",value:Te(s.accountingSystem),showEmptyFields:!0}),e.jsx(m,{label:"חייב ברישום תוכנה",value:y(!!s.softwareRegistrationNumber),showEmptyFields:!0}),s.softwareRegistrationNumber&&e.jsx(m,{label:"מספר תעודת רישום",value:s.softwareRegistrationNumber,showEmptyFields:!0}),e.jsx(m,{label:"דוח בגין שותפות",value:y(!!s.isPartnership),showEmptyFields:!0}),s.isPartnership&&e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"מספר שותפים",value:s.partnershipCount?.toString()??"",showEmptyFields:!0}),e.jsx(m,{label:"חלקי ברווחי השותפות",value:`${s.partnershipProfitShare}%`,showEmptyFields:!0})]}),e.jsx(m,{label:"יישום תקני חשבונאות (IFRS)",value:y(!!s.ifrsImplementationYear||!!s.ifrsReportingOption),showEmptyFields:!0}),(!!s.ifrsImplementationYear||!!s.ifrsReportingOption)&&e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"החל משנת המס",value:s.ifrsImplementationYear??"",showEmptyFields:!0}),e.jsx(m,{label:"דווח בחלופה",value:De(s.ifrsReportingOption),showEmptyFields:!0})]}),e.jsx(m,{label:"מספר ענף כלכלי של המדווח",value:s.industryCode,showEmptyFields:!0}),e.jsx(m,{label:"חוות דעת המבקר",value:Re(s.auditOpinionType),showEmptyFields:!0})]})]})})}const Oe=[{title:"הכנסות ממכירות ומתן שירותים",color:"text-blue-700",codes:[1010,1015,1020,1025,1030,1040,1051,1052,1090],sumCode:1e3},{title:"עלות המכירות ומתן השירותים וביצוע עבודות",color:"text-purple-700",codes:[1306,1308,1307,1310,1320,1330,1340,1350,1360,1371,1372,1390,1400,1450],sumCode:1300},{title:"עלויות ייצור ועלויות אצל קבלן בונה",color:"text-rose-700",codes:[2005,2006,2011,2012,2015,2020,2025,2030,2035,2040,2045,2050,2060,2066,2067,2068,2070,2075,2080,2085,2090,2095],sumCode:2e3},{title:"הוצאות מחקר ופיתוח",color:"text-amber-700",codes:[2510,2520,2530,2540,2550,2560,2570,2590],sumCode:2500},{title:"הוצאות מכירה",color:"text-green-700",codes:[3011,3013,3012,3015,3020,3025,3030,3040,3045,3050,3060,3066,3067,3068,3070,3075,3080,3085,3090,3100,3120,3190],sumCode:3e3},{title:"הוצאות הנהלה וכלליות",color:"text-cyan-700",codes:[3511,3513,3512,3515,3520,3530,3535,3540,3545,3550,3560,3566,3567,3568,3570,3575,3580,3590,3595,3600,3610,3620,3625,3631,3632,3640,3650,3660,3665,3680,3685,3690],sumCode:3500},{title:"הוצאות מימון",color:"text-indigo-700",codes:[5010,5020,5025,5030,5040,5050,5051,5090],sumCode:5e3},{title:"הכנסות מימון",color:"text-fuchsia-700",codes:[5110,5121,5122,5130,5150,5160,5190],sumCode:5100},{title:"הכנסות אחרות",color:"text-red-700",codes:[5210,5220,5230,5236,5237,5240,5250,5260,5270,5290],sumCode:5200},{title:"הוצאות אחרות",color:"text-yellow-700",codes:[5310,5320,5330,5390],sumCode:5300}],ke=[{title:"מסים על הכנסה",color:"text-sky-700",codes:[5610,5620,5630],sumCode:5600},{title:"ייעוד הרווחים",color:"text-violet-700",codes:[5710],sumCode:5700},{title:"רווח/הפסד אקויטי",color:"text-pink-700",codes:[5810],sumCode:5800}];function Ee({selectedYear:t,referenceYear:d,data:s,referenceData:c,showEmptyFields:l=!1}){const{profitAndLoss:o}=j(B,s),r=j(B,c)?.profitAndLoss||[];return e.jsx(w,{value:"profitLoss",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:"נתוני רווח והפסד"}),d&&t!==d&&e.jsxs("span",{className:"text-sm text-blue-600 bg-blue-50 px-2 py-1 rounded",children:["מציג שינויים לעומת ",d]})]}),Oe.map(a=>e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:`font-bold mb-4 ${a.color}`,children:a.title}),e.jsxs("div",{className:"space-y-2",children:[a.codes.map(i=>e.jsx(u,{codes:o,referenceCodes:r,code:i,showEmptyFields:l},i)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:o,referenceCodes:r,code:a.sumCode,showEmptyFields:l})})]})]},a.title)),e.jsx("div",{className:"bg-emerald-50 p-4 rounded-md border-2 border-emerald-200",children:e.jsx(u,{codes:o,referenceCodes:r,code:6666,showEmptyFields:l})}),ke.map(a=>e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:`font-bold mb-4 ${a.color}`,children:a.title}),e.jsxs("div",{className:"space-y-2",children:[a.codes.map(i=>e.jsx(u,{codes:o,referenceCodes:r,code:i,showEmptyFields:l},i)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(u,{codes:o,referenceCodes:r,code:a.sumCode,showEmptyFields:l})})]})]},a.title))]})})}const Me=[{title:"התאמות חשבונאיות למי שיישם את חלופה 2 בהוראת ביצוע 7/2010 בנושא IFRS",color:"red",codes:[103,104]},{title:"התאמות נדרשות לצרכי מס (הוסף/הפחת)",color:"yellow",codes:[110,120,130,135,140,150,160,170,180,181,182,183,184,190,200,300,310,320,330,350,360],sumCode:370},{title:"התאמות חשבונאיות למי שיישם את חלופה 3 בהוראת ביצוע 7/2010 בנושא IFRS שלא מצאו את ביטויין בהתאמות הנדרשות לצרכי מס",color:"emerald",codes:[383],sumCode:400},{title:"יישום הוראות חוקי מס נוספים",color:"sky",codes:[430,480,490],sumCode:500},{title:"נתונים נוספים",color:"violet",codes:[510,520,530,540,550,570,575,580,585,590]},{title:"בשותפות",color:"pink",codes:[600]}],Y={red:{header:"text-red-700",sum:"bg-red-50 border-red-200"},yellow:{header:"text-yellow-700",sum:"bg-yellow-50 border-yellow-200"},emerald:{header:"text-emerald-700",sum:"bg-emerald-50 border-emerald-200"},sky:{header:"text-sky-700",sum:"bg-sky-50 border-sky-200"},violet:{header:"text-violet-700",sum:"bg-violet-50 border-violet-200"},pink:{header:"text-pink-700",sum:"bg-pink-50 border-pink-200"}};function Ie({data:t,referenceData:d,showEmptyFields:s=!1}){const{taxAdjustment:c}=j(_,t),o=j(_,d)?.taxAdjustment||[];return e.jsx(w,{value:"taxAdjustment",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:'נתוני דו"ח התאמה למס'}),e.jsx("div",{className:"bg-emerald-50 p-4 rounded-md border-2 border-emerald-200",children:e.jsx(u,{codes:c,referenceCodes:o,code:100,showEmptyFields:s})}),Me.map(n=>{const{header:r,sum:a}=Y[n.color]||Y.red;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:"font-bold mb-4 "+r,children:n.title}),e.jsx("div",{className:"space-y-2",children:n.codes.map(i=>e.jsx(u,{codes:c,referenceCodes:o,code:i,showEmptyFields:s},i))})]}),n.sumCode&&e.jsx("div",{className:"p-4 rounded-md border-2 "+a,children:e.jsx(u,{codes:c,referenceCodes:o,code:n.sumCode,showEmptyFields:s})})]},n.title)})]})})}function Le({data:t,referenceData:d,businessInfo:s,selectedYear:c,referenceYear:l}){const o=j($,t),n=j($,d),[r,a]=b.useState("header"),[i,h]=b.useState(!0);return e.jsxs("div",{className:"p-4 border-gray-300",dir:"rtl",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g,{variant:i?"outline":"default",size:"sm",onClick:()=>h(!i),className:"flex items-center gap-2",children:[i?e.jsx(be,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"}),i?"הסתר שדות ריקים":"הצג שדות ריקים"]}),e.jsx("span",{className:"text-sm text-gray-500",children:i?"מציג את כל השדות":"מציג רק שדות עם נתונים"})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(te,{className:"h-4 w-4"}),"הורד"]}),e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(xe,{className:"h-4 w-4"}),"שמור"]})]})]}),e.jsxs(ae,{value:r,onValueChange:a,className:"w-full",children:[e.jsxs(le,{className:"grid grid-cols-4 w-full",dir:"rtl",children:[e.jsx(v,{value:"header",children:"פרטים מזהים"}),e.jsx(v,{value:"profitLoss",children:"רווח והפסד"}),e.jsx(v,{value:"taxAdjustment",children:"התאמה למס"}),e.jsx(v,{value:"balanceSheet",children:"מאזן"})]}),e.jsx(Ae,{data:o,businessInfo:s}),e.jsx(Ee,{selectedYear:c,referenceYear:l,data:o,referenceData:n,showEmptyFields:i}),e.jsx(Ie,{data:o,referenceData:n,showEmptyFields:i}),e.jsx(Ce,{data:o,referenceData:n,showEmptyFields:i})]})]})}function He(){const{setFiltersContext:t}=b.useContext(de),[d,s]=b.useState(void 0),[c,l]=b.useState(void 0),[o,n]=b.useState(void 0),[{data:r,fetching:a}]=ne({query:me,variables:{year:c?Number.parseInt(c,10):0,businessId:d},pause:!c||!d});return b.useEffect(()=>{t(e.jsx("div",{className:"flex flex-row gap-x-5",dir:"rtl",children:e.jsx(je,{selectedBusiness:d,setSelectedBusiness:s,selectedYear:c,setSelectedYear:l,referenceYear:o,setReferenceYear:n})}))},[t,d,c,o]),e.jsx("div",{className:"container mx-auto",dir:"rtl",children:e.jsxs(oe,{className:"border-2 border-gray-300",children:[e.jsx(ce,{className:"bg-gray-100 border-b-2 border-gray-300 flex flex-row justify-between items-center",children:e.jsxs("div",{className:"text-center w-full",children:[e.jsx("h1",{className:"text-2xl font-bold",children:'נספח לטופס הדו"ח השנתי ליחיד ולחבר בני אדם'}),e.jsxs("h2",{className:"text-xl",children:["לשנת המס ",c]}),e.jsx("p",{className:"text-sm",children:'נתוני הדוחות הכספיים, מאזן, רווח והפסד ודו"ח ההתאמה למס'})]})}),e.jsx(ie,{className:"p-0",children:e.jsx(Pe,{fetching:a,data:r,selectedBusiness:d,selectedYear:c,referenceYear:o})})]})})}function Pe({fetching:t,data:d,selectedBusiness:s,selectedYear:c,referenceYear:l}){if(t)return e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"טוען נתונים..."})});if(!c||!s)return e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"יש לבחור עסק ושנת דיווח"})});const o=d?.shaam6111.data;return o?e.jsx(Le,{data:o,businessInfo:d.shaam6111.business,selectedBusiness:s,selectedYear:c,referenceYear:l}):e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"אין נתונים זמינים עבור העסק והשנה שנבחרו"})})}export{He as Shaam6111Report};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as h,
|
|
1
|
+
import{r as h,bm as S,j as e,bn as N,B as y,G as $,bo as k,a8 as R,V as O,bp as f,bq as D,br as C,x as F,X as A,Y as E,Z as z,_ as P,ah as M,bt as L,bj as w,T as B,a$ as j,aN as p,J as V,dl as _,cu as v,F as G,u as q,dm as U,dn as Z,L as H,dp as J}from"./index-BmZql10x.js";import{u as I}from"./use-url-query-DV9K0FAR.js";import{P as Q}from"./page-layout-DxGYaCiw.js";import{P as X}from"./modal-dLkQjDNz.js";import{F as K}from"./funnel-BQEGwl1q.js";import{M as T}from"./MultiSelect-CszuVk07.js";import{D as W}from"./download-csv-button-jQXIlRax.js";import{B as Y}from"./business-extended-info-CeEMIazB.js";import{P as ee,a as te}from"./panel-top-open-CWsfFRNu.js";import{T as se}from"./Table-CQ4GTcIY.js";function re({filter:t,setFilter:s,closeModal:i}){const n=$({defaultValues:{...t}}),{control:a,handleSubmit:o}=n,{selectableBusinesses:r,fetching:u}=k(),{userContext:m}=h.useContext(R),c=l=>{l.fromDate?.trim()===""&&(l.fromDate=void 0),l.toDate?.trim()===""&&(l.toDate=void 0),s(l),i()};function d(){s({}),i()}return e.jsxs(e.Fragment,{children:[u?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(O,{...n,children:e.jsxs("form",{onSubmit:o(c),className:"space-y-2",children:[e.jsx(f,{name:"ownerIds",control:a,defaultValue:void 0,render:({field:l,fieldState:b})=>e.jsx(T,{...l,data:r,value:l.value??(m?.context.adminBusinessId?[m?.context.adminBusinessId]:void 0),disabled:u,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(f,{name:"businessIDs",control:a,defaultValue:void 0,render:({field:l,fieldState:b})=>e.jsx(T,{...l,data:r,value:l.value??void 0,disabled:u,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(f,{name:"fromDate",control:a,defaultValue:t.fromDate,rules:{required:"Required",pattern:{value:D,message:"Date must be im format yyyy-mm-dd"}},render:({field:l,fieldState:b})=>e.jsx(C,{...l,onChange:x=>{const g=x?typeof x=="string"?x:F(x,"yyyy-MM-dd"):void 0;g!==l.value&&l.onChange(g)},value:l.value?new Date(l.value):void 0,label:"From Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(f,{name:"toDate",control:a,defaultValue:t.toDate,rules:{pattern:{value:D,message:"Date must be im format yyyy-mm-dd"}},render:({field:l,fieldState:b})=>e.jsx(C,{...l,onChange:x=>{const g=x?typeof x=="string"?x:F(x,"yyyy-MM-dd"):void 0;g!==l.value&&l.onChange(g)},value:l.value?new Date(l.value):void 0,label:"To Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(A,{name:"isShowZeroedAccounts",control:a,render:({field:l})=>e.jsxs(E,{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(z,{children:"Show zeroed accounts"})}),e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(P,{children:e.jsx(M,{defaultChecked:t.isShowZeroedAccounts??!1,onCheckedChange:l.onChange,checked:l.value===!0})}),e.jsx("span",{children:l.value?"show":"remove"})]})]})}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",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:d,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:i,children:"Cancel"})]})]})})]})}function ae({filter:t,setFilter:s}){const[i,n]=h.useState(!1),[a,o]=h.useState(!S(t)),{get:r,set:u}=I();function m(d){return Object.entries(d??{}).filter(([b,x])=>x!==void 0&&Array.isArray(x)&&x.length>0).length>0}function c(d){L(d,t)||(s(d),o(m(d)))}return h.useEffect(()=>{const d=S(t)?null:encodeURIComponent(JSON.stringify(t)),l=r("trialBalanceReportFilters");d!==l&&u("trialBalanceReportFilters",d)},[t,r,u]),e.jsxs(e.Fragment,{children:[e.jsx(X,{opened:i,onClose:()=>n(!1),content:e.jsx(re,{filter:t,setFilter:c,closeModal:()=>n(!1)})}),e.jsx(N,{inline:!0,size:16,disabled:!a,children:e.jsx(y,{variant:"outline",onClick:()=>n(!0),className:"p-2",children:e.jsx(K,{size:20})})})]})}const ne=({data:t,fromDate:s,toDate:i})=>{const n=h.useCallback(async()=>{const a=oe(t),o=`trial_balance_report${s?`_${s}`:""}${i?`_${i}`:""}`;return{fileContent:a,fileName:o}},[t,s,i]);return e.jsx(W,{createFileVariables:n})},oe=t=>{let s="";s+=`Sort Code,Account Name,Debit,Credit,Balance\r
|
|
2
2
|
`;for(const[i,n]of Object.entries(t)){const a=ie(i,n);s+=a}return s+=`Report total:,,${Object.values(t).reduce((i,n)=>i+n.totalDebit,0)},${Object.values(t).reduce((i,n)=>i+n.totalCredit,0)},${Object.values(t).reduce((i,n)=>i+n.sum,0)}\r
|
|
3
3
|
`,s};function ie(t,s){let i="";return Object.values(s.sortCodes).sort((n,a)=>n.key-a.key).map(n=>{const a=le(n);i+=a}),i+=`${t.replaceAll("0","*")},Group Total:,${s.totalDebit??""},${s.totalCredit??""},${s.sum}\r
|
|
4
4
|
`,i}function le(t){let s="";s+=`${t.name}\r
|
|
@@ -6,4 +6,4 @@ import{r as h,bp as S,j as e,bq as N,B as y,G as $,br as k,ae as R,W as O,bs as
|
|
|
6
6
|
`;s+=c});const i=`${t.key},Group total:,${t.totalDebit??""},${t.totalCredit??""},${t.sum}\r
|
|
7
7
|
`;s+=i;const n=t.debit?`,,,Total Debit Balances:,${t.debit}\r
|
|
8
8
|
`:"";s+=n;const a=t.credit?`,,,Total Credit Balances:,${t.credit}\r
|
|
9
|
-
`:"";return s+=a,s}function ce(t){let s="";return s=t.replace(/"/g,'""'),s}const de=({record:t,sortCodeKey:s,filter:i,isAllOpened:n})=>{const[a,o]=h.useState(n),r=t?.total?.raw??0,u=t?.debit?.raw??0,m=t?.credit?.raw??0;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{children:s}),e.jsx("td",{children:t.business.id}),e.jsx("td",{children:t.business.name??void 0}),e.jsx("td",{children:u?t?.debit?.formatted:void 0}),e.jsx("td",{children:m?t?.credit?.formatted:void 0}),e.jsx("td",{children:(r>.001||r<-.001)&&e.jsx(w,{color:r>0?"green":"red",children:t?.total?.formatted})}),e.jsx("td",{children:e.jsx(B,{label:"Detailed records",children:e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(c=>!c),children:a||n?e.jsx(ee,{className:"size-5"}):e.jsx(te,{className:"size-5"})})})})]},t.business.id),(a||n)&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,children:e.jsx(Y,{businessID:t.business?.id,filter:i})})})]})},ue=({sortCode:t,filter:s,isAllOpened:i})=>t.records.length>0?e.jsxs(e.Fragment,{children:[e.jsx("tr",{children:e.jsx("td",{colSpan:7,children:e.jsx("span",{className:"font-bold",children:t.name})})}),t.records.sort((n,a)=>n.business.name.localeCompare(a.business.name)).map(n=>e.jsx(de,{record:n,sortCodeKey:t.key,filter:s,isAllOpened:i},n.business.id)),e.jsx("tr",{className:"bg-gray-100",children:t.records.length>1?e.jsxs(e.Fragment,{children:[e.jsx("td",{colSpan:2,children:"Group total:"}),e.jsx("td",{colSpan:1,children:t.key}),e.jsx("td",{colSpan:1,children:!!t.totalDebit&&j(t.totalDebit,p.Ils)}),e.jsx("td",{colSpan:1,children:!!t.totalCredit&&j(t.totalCredit,p.Ils)}),e.jsxs("td",{colSpan:1,children:[e.jsx(w,{c:t.sum>0?"green":t.sum<0?"red":void 0,children:j(t.sum,p.Ils)}),!!t.debit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),"Total Debit Balances: ",j(t.debit,p.Ils)]}),!!t.credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),"Total Credit Balances: ",j(t.credit,p.Ils)]})]})]}):void 0})]}):null,me=({group:t,data:s,filter:i,isAllOpened:n})=>e.jsxs(e.Fragment,{children:[Object.values(s.sortCodes).sort((a,o)=>a.key-o.key).map((a,o)=>e.jsx(ue,{sortCode:a,filter:i,isAllOpened:n},`${a.key} ${o}`)),e.jsxs("tr",{className:"bg-gray-100",children:[e.jsx("td",{colSpan:2,children:"Group total:"}),e.jsx("td",{colSpan:1,children:t.replaceAll("0","*")}),e.jsx("td",{colSpan:1,children:!!s.totalDebit&&j(s.totalDebit,p.Ils)}),e.jsx("td",{colSpan:1,children:!!s.totalCredit&&j(s.totalCredit,p.Ils)}),e.jsx("td",{colSpan:1,children:e.jsx(w,{fw:700,c:s.sum>0?"green":s.sum<0?"red":void 0,children:j(s.sum,p.Ils)})})]},"group"+t)]});function xe(t){return Math.floor(t/100)*100}const he=({data:t,filter:s,isAllOpened:i})=>{const{businessTransactionsSum:n}=_
|
|
9
|
+
`:"";return s+=a,s}function ce(t){let s="";return s=t.replace(/"/g,'""'),s}const de=({record:t,sortCodeKey:s,filter:i,isAllOpened:n})=>{const[a,o]=h.useState(n),r=t?.total?.raw??0,u=t?.debit?.raw??0,m=t?.credit?.raw??0;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{children:s}),e.jsx("td",{children:t.business.id}),e.jsx("td",{children:t.business.name??void 0}),e.jsx("td",{children:u?t?.debit?.formatted:void 0}),e.jsx("td",{children:m?t?.credit?.formatted:void 0}),e.jsx("td",{children:(r>.001||r<-.001)&&e.jsx(w,{color:r>0?"green":"red",children:t?.total?.formatted})}),e.jsx("td",{children:e.jsx(B,{label:"Detailed records",children:e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(c=>!c),children:a||n?e.jsx(ee,{className:"size-5"}):e.jsx(te,{className:"size-5"})})})})]},t.business.id),(a||n)&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,children:e.jsx(Y,{businessID:t.business?.id,filter:i})})})]})},ue=({sortCode:t,filter:s,isAllOpened:i})=>t.records.length>0?e.jsxs(e.Fragment,{children:[e.jsx("tr",{children:e.jsx("td",{colSpan:7,children:e.jsx("span",{className:"font-bold",children:t.name})})}),t.records.sort((n,a)=>n.business.name.localeCompare(a.business.name)).map(n=>e.jsx(de,{record:n,sortCodeKey:t.key,filter:s,isAllOpened:i},n.business.id)),e.jsx("tr",{className:"bg-gray-100",children:t.records.length>1?e.jsxs(e.Fragment,{children:[e.jsx("td",{colSpan:2,children:"Group total:"}),e.jsx("td",{colSpan:1,children:t.key}),e.jsx("td",{colSpan:1,children:!!t.totalDebit&&j(t.totalDebit,p.Ils)}),e.jsx("td",{colSpan:1,children:!!t.totalCredit&&j(t.totalCredit,p.Ils)}),e.jsxs("td",{colSpan:1,children:[e.jsx(w,{c:t.sum>0?"green":t.sum<0?"red":void 0,children:j(t.sum,p.Ils)}),!!t.debit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),"Total Debit Balances: ",j(t.debit,p.Ils)]}),!!t.credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),"Total Credit Balances: ",j(t.credit,p.Ils)]})]})]}):void 0})]}):null,me=({group:t,data:s,filter:i,isAllOpened:n})=>e.jsxs(e.Fragment,{children:[Object.values(s.sortCodes).sort((a,o)=>a.key-o.key).map((a,o)=>e.jsx(ue,{sortCode:a,filter:i,isAllOpened:n},`${a.key} ${o}`)),e.jsxs("tr",{className:"bg-gray-100",children:[e.jsx("td",{colSpan:2,children:"Group total:"}),e.jsx("td",{colSpan:1,children:t.replaceAll("0","*")}),e.jsx("td",{colSpan:1,children:!!s.totalDebit&&j(s.totalDebit,p.Ils)}),e.jsx("td",{colSpan:1,children:!!s.totalCredit&&j(s.totalCredit,p.Ils)}),e.jsx("td",{colSpan:1,children:e.jsx(w,{fw:700,c:s.sum>0?"green":s.sum<0?"red":void 0,children:j(s.sum,p.Ils)})})]},"group"+t)]});function xe(t){return Math.floor(t/100)*100}const he=({data:t,filter:s,isAllOpened:i})=>{const{businessTransactionsSum:n}=V(_,t),a=h.useMemo(()=>{const o={};for(const r of n){r.business.sortCode??={id:"-999",key:-999,name:"Misc"};const u=!r.total.raw||r.total.raw<.001&&r.total.raw>-.001;if(!s.isShowZeroedAccounts&&u)continue;const m=xe(r.business.sortCode.key);o[m]??={sortCodes:{},totalCredit:0,totalDebit:0,credit:0,debit:0,sum:0};const c=o[m];c.sortCodes[r.business.sortCode.key]??={...r.business.sortCode,totalCredit:0,totalDebit:0,records:[],credit:0,debit:0,sum:0};const d=c.sortCodes[r.business.sortCode.key];d.totalCredit+=r.credit.raw,d.totalDebit+=r.debit.raw,d.sum+=r.total.raw,c.totalCredit+=r.credit.raw,c.totalDebit+=r.debit.raw,c.sum+=r.total.raw,r.total.raw>0?(d.credit+=r.total.raw,c.credit+=r.total.raw):(d.debit+=r.total.raw,c.debit+=r.total.raw),d.records.push(r)}return o},[n,s.isShowZeroedAccounts]);return e.jsxs(se,{highlightOnHover:!0,children:[e.jsx("thead",{style:{position:"sticky",top:0,zIndex:20},children:e.jsxs("tr",{className:"bg-gray-300",children:[e.jsx("th",{children:"Sort Code"}),e.jsx("th",{children:"Account"}),e.jsx("th",{children:"Account Name"}),e.jsx("th",{children:"Total Debit"}),e.jsx("th",{children:"Total Credit"}),e.jsx("th",{children:"Balance"}),e.jsx("th",{children:e.jsx(ne,{data:a,fromDate:s.fromDate??void 0,toDate:s.toDate??void 0})})]})}),e.jsxs("tbody",{children:[Object.entries(a).map(([o,r])=>e.jsx(me,{data:r,group:o,filter:s,isAllOpened:i},o)),e.jsxs("tr",{className:"bg-gray-100",children:[e.jsx("td",{colSpan:2,children:"Report total:"}),e.jsx("td",{}),e.jsxs("td",{children:["(",v(Object.values(a).reduce((o,r)=>o+r.totalDebit,0)),")"]}),e.jsxs("td",{children:["(",v(Object.values(a).reduce((o,r)=>o+r.totalCredit,0)),")"]}),e.jsx("td",{colSpan:1,children:v(Object.values(a).reduce((o,r)=>o+r.sum,0))})]})]})]})},Ce=()=>{const[t,s]=h.useState(!1),{get:i}=I(),{setFiltersContext:n}=h.useContext(G),[a,o]=h.useState(i("trialBalanceReportFilters")?JSON.parse(decodeURIComponent(i("trialBalanceReportFilters"))):{}),[{data:r,fetching:u}]=q({query:J,variables:{filters:{fromDate:a?.fromDate,toDate:a?.toDate,ownerIds:a?.ownerIds,businessIDs:a?.businessIDs}}});h.useEffect(()=>{n(e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx(B,{label:"Expand all accounts",children:e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>s(c=>!c),children:t?e.jsx(U,{className:"size-5"}):e.jsx(Z,{className:"size-5"})})}),e.jsx(ae,{filter:a,setFilter:o})]}))},[a,t,n]);const m=h.useMemo(()=>r?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?void 0:r?.businessTransactionsSumFromLedgerRecords,[r?.businessTransactionsSumFromLedgerRecords]);return e.jsx(Q,{title:"Trial Balance Report",description:"Trial balance report for all businesses",children:u||!m?e.jsx(H,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx(he,{data:m,filter:a,isAllOpened:t})})};export{Ce as TrialBalanceReport};
|