@accounter/client 0.0.8-alpha-20251029234818-bb69914cb7aaa4859296baa4a256c251158fd15b → 0.0.8-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c
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 +2 -2
- package/dist/assets/{Checkbox-ChZFYaBU.js → Checkbox-qEdmT4HE.js} +2 -2
- package/dist/assets/{MultiSelect-h-orVW8D.js → MultiSelect-Dm9mO7pJ.js} +1 -1
- package/dist/assets/{Progress-DVn-HXq3.js → Progress-kr0gnfBa.js} +1 -1
- package/dist/assets/{Table-B88LD0fO.js → Table-DnHfGe-y.js} +1 -1
- package/dist/assets/{Typography-DSr2wXoh.js → Typography-Cu3puAUK.js} +1 -1
- package/dist/assets/{YearPickerInput-DQjO6Nmm.js → YearPickerInput-oa86GF4P.js} +1 -1
- package/dist/assets/{accordion-vlJV5349.js → accordion-DLtMSqIv.js} +1 -1
- package/dist/assets/accountant-approvals-DsL0uiBa.js +1 -0
- package/dist/assets/accounter-table-BL_yrGIl.js +1 -0
- package/dist/assets/{addDays-CiW9nfcU.js → addDays-DqZEDZy3.js} +1 -1
- package/dist/assets/all-charges-D3Xf-pEY.js +1 -0
- package/dist/assets/{arrow-up-down-DCZ98zEE.js → arrow-up-down-DchtBEG4.js} +1 -1
- package/dist/assets/{building-2-MkMlc3HY.js → building-2-ZTKteVvf.js} +1 -1
- package/dist/assets/{business-BIPODXgU.js → business-CAcKSrnu.js} +3 -3
- package/dist/assets/{business-extended-info-CFdeLUKP.js → business-extended-info-1mzdXJbs.js} +4 -4
- package/dist/assets/{business-header-pPq6w0Xw.js → business-header-CJqfKV4d.js} +1 -1
- package/dist/assets/{business-ledger-filters-ClJxXoLC.js → business-ledger-filters-BRB1r_DP.js} +1 -1
- package/dist/assets/business-ledger-single-C8FIQJ8V.js +1 -0
- package/dist/assets/business-trip-DkTEY8b1.js +1 -0
- package/dist/assets/charge-Df3lWZH-.js +1 -0
- package/dist/assets/charges-filters-DUuY-N0H.js +1 -0
- package/dist/assets/charges-ledger-validation-CtCBR3C-.js +1 -0
- package/dist/assets/{charges-table-eZes2r5b.js → charges-table-CWbe3t13.js} +7 -7
- package/dist/assets/{chart-BiPB-6_s.js → chart-Cmm-jp0c.js} +1 -1
- package/dist/assets/{data-table-pagination-D9orF6C5.js → data-table-pagination-fdOZTf64.js} +1 -1
- package/dist/assets/{download-csv-button-DUWRJL2T.js → download-csv-button-CwK31swX.js} +1 -1
- package/dist/assets/{editable-business-trip-BhXW_0XH.js → editable-business-trip-Bjxkm9xV.js} +2 -2
- package/dist/assets/{funnel-DrJtNpvJ.js → funnel-CMG4QvaK.js} +1 -1
- package/dist/assets/index-6G62OvEh.js +1 -0
- package/dist/assets/{index-CsYsahJ3.js → index-B9CbQIGq.js} +1 -1
- package/dist/assets/index-BD4s2ucv.css +1 -0
- package/dist/assets/{index-BG_PTq9Q.js → index-BEahR51x.js} +2 -2
- package/dist/assets/index-BFwWHKS1.js +1 -0
- package/dist/assets/index-BI0XToIk.js +1 -0
- package/dist/assets/index-BQb_C-JL.js +1 -0
- package/dist/assets/{index-BsEpUd8e.js → index-BZVrGMgV.js} +2 -2
- package/dist/assets/{index-CQwkSv45.js → index-C7oYbGGm.js} +1 -1
- package/dist/assets/index-CJQlHnFs.js +1 -0
- package/dist/assets/{index-DCJnXE5L.js → index-CTatkdRy.js} +1 -1
- package/dist/assets/{index-ZqxiihxR.js → index-C_ZNQ0Zr.js} +1 -1
- package/dist/assets/{index-Dl0o8K5Z.js → index-CgokSIpu.js} +7 -7
- package/dist/assets/{index-B0hUbUBg.js → index-CjC_SXIA.js} +1 -1
- package/dist/assets/index-Cm6Blkgf.js +1 -0
- package/dist/assets/{index-CKSGCsKO.js → index-CriBDqbK.js} +1 -1
- package/dist/assets/{index-CuoWV8xf.js → index-Cw_aKL-8.js} +173 -173
- package/dist/assets/{index-BNmy1oek.js → index-DFW4nqx8.js} +7 -7
- package/dist/assets/{index-HAjwT8i6.js → index-DInU4RP4.js} +2 -2
- package/dist/assets/{index-BidQYESH.js → index-DJLQkpmI.js} +2 -2
- package/dist/assets/index-DLwMwjDQ.js +1 -0
- package/dist/assets/{index-1EyW0AOu.js → index-DcwGbXWr.js} +1 -1
- package/dist/assets/index-Dlj3jpuW.js +1 -0
- package/dist/assets/index-iya2tfvn.js +1 -0
- package/dist/assets/{index-BHVgafF5.js → index-jCPWIpdP.js} +1 -1
- package/dist/assets/index-xxe8M91O.js +6 -0
- package/dist/assets/{index.es-BiiexU-G.js → index.es-B_Bf6nNm.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-CkXaCqH7.js → insert-business-trip-modal-Ds3RIlmF.js} +2 -2
- package/dist/assets/issue-document-_iHCFO9h.js +1 -0
- package/dist/assets/{list-plus-BPyHtPSB.js → list-plus-B3EB-dKe.js} +1 -1
- package/dist/assets/login-page-BtT_TCEJ.js +1 -0
- package/dist/assets/{match-document-modal-BZOEBBCt.js → match-document-modal-Bo9pBr8W.js} +4 -4
- package/dist/assets/missing-info-charges-BQYXI7bj.js +1 -0
- package/dist/assets/{modal-CguzFJgR.js → modal-Pj_6bAFk.js} +1 -1
- package/dist/assets/{page-layout-jOFfeRt_.js → page-layout-CVTeUSZp.js} +1 -1
- package/dist/assets/{page-not-found-ghVdWRX4.js → page-not-found-TvTAiAs4.js} +1 -1
- package/dist/assets/{panel-top-open-BLNJL6FI.js → panel-top-open-DzBY_TuM.js} +1 -1
- package/dist/assets/{pencil-DePZCoA1.js → pencil-BBmFhuZN.js} +1 -1
- package/dist/assets/{report-commentary-row-bJgTfAoe.js → report-commentary-row-Dqw62LLo.js} +1 -1
- package/dist/assets/{save-DDATKcb8.js → save-BW18gNVs.js} +1 -1
- package/dist/assets/similar-transactions-modal-B39q1NLa.js +1 -0
- package/dist/assets/{sub-CUQX8erq.js → sub-DOjETdwl.js} +1 -1
- package/dist/assets/subMonths-DqeFZ4O6.js +1 -0
- package/dist/assets/summary-Bbsq64IN.js +1 -0
- package/dist/assets/{toggle-expansion-button-BarJY9rA.js → toggle-expansion-button-BrKkZtGj.js} +1 -1
- package/dist/assets/tooltip-CbnJYNc4.js +1 -0
- package/dist/assets/{use-url-query-CMqziw3P.js → use-url-query-C0mVgO2i.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/components/business/charges-section.tsx +5 -5
- package/src/components/businesses/businesses-filters.tsx +7 -2
- package/src/components/charges/charges-filters.tsx +8 -3
- package/src/components/common/accounter-table.tsx +1 -3
- package/src/components/common/index.ts +1 -0
- package/src/components/common/pagination.tsx +84 -0
- package/src/components/ledger-table/index.tsx +15 -8
- package/src/components/transactions-table/index.tsx +11 -5
- package/src/components/ui/pagination.tsx +3 -99
- package/dist/assets/Pagination-CraTfR0n.js +0 -1
- package/dist/assets/accountant-approvals-DOxFOZAO.js +0 -1
- package/dist/assets/accounter-table-D9Vunjfy.js +0 -1
- package/dist/assets/all-charges-bPDT5kwM.js +0 -1
- package/dist/assets/business-ledger-single-BOtdOkme.js +0 -1
- package/dist/assets/business-trip-6WyqArkv.js +0 -1
- package/dist/assets/charge-BbtacTJ9.js +0 -1
- package/dist/assets/charges-filters-Ir-7TzSP.js +0 -1
- package/dist/assets/charges-ledger-validation-6prUhTM_.js +0 -1
- package/dist/assets/create-event-handler-BiA-1lGu.js +0 -1
- package/dist/assets/index--ZcPa6E_.js +0 -1
- package/dist/assets/index-2OCszu-l.js +0 -1
- package/dist/assets/index-BKcxKTE4.js +0 -1
- package/dist/assets/index-BUJm5I0K.css +0 -1
- package/dist/assets/index-Crk-yNk8.js +0 -1
- package/dist/assets/index-DVm5mt8x.js +0 -6
- package/dist/assets/index-DmOniXdt.js +0 -1
- package/dist/assets/index-SAaZFNWd.js +0 -1
- package/dist/assets/index-XNTNgbUr.js +0 -1
- package/dist/assets/index-jf6jgMhL.js +0 -1
- package/dist/assets/index-z10NcX_S.js +0 -1
- package/dist/assets/issue-document-IUlUh6n7.js +0 -1
- package/dist/assets/login-page-CGLD1xCA.js +0 -1
- package/dist/assets/missing-info-charges-C1QWCAWR.js +0 -1
- package/dist/assets/similar-transactions-modal-BxhD4UyN.js +0 -1
- package/dist/assets/subMonths-QOcbO9QP.js +0 -1
- package/dist/assets/summary-CBR-TMN0.js +0 -1
- package/dist/assets/tooltip-BFYX9MeB.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as P,j as r,e as
|
|
2
|
-
`);i.length===1?n.push(r.jsx(s,{children:t},`unchanged-${n.length}`)):i.map((l,o)=>{n.push(r.jsx(s,{children:l},o)),p.push(r.jsx("div",{children:n},p.length-1)),n=[]})}return n.length>0&&p.push(r.jsx("div",{children:n},p.length-1)),p},[c,m]);return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"text-sm text-gray-500 flex flex-row gap-2",children:[r.jsx("span",{className:"font-bold",children:"Month:"}),r.jsx("span",{children:D.slice(0,7)}),!d.length&&r.jsx(
|
|
1
|
+
import{r as P,j as r,e as J,u as Q,gV as H,L as E,af as $,bq as K,B as U,G as X,bs as ee,bt as te,bw as ne,cL as O,x as S,gW as T,bx as se,F as oe,N as re,V as ie,Y as le}from"./index-Cw_aKL-8.js";import{u as Y}from"./use-url-query-C0mVgO2i.js";import{P as ae}from"./page-layout-CVTeUSZp.js";import{A as ce,a as fe,c as ue,b as he}from"./accordion-DLtMSqIv.js";import{P as de}from"./modal-Pj_6bAFk.js";import{F as pe}from"./funnel-CMG4QvaK.js";var v={},z;function ye(){if(z)return v;z=1,Object.defineProperty(v,"__esModule",{value:!0}),v.calcSlices=v.applyPatch=v.calcPatch=v.lcs=v.diff=v.diff_core=void 0;function c(e,n){const{b:t,eq:s,stack_base:i}=e;let{i:l,N:o,j:h,M:a,Z:f,stack_top:x}=e;for(;;)switch(n){case 0:{e:for(;o>0&&a>0;){t.fill(0,0,2*f);const R=o-a,_=o+a,B=_&1,W=l+o-1,Z=h+a-1,q=(_+B)/2;let F;t:for(let M=0;M<=q;M++){const L=2*Math.max(0,M-a)-M,I=M-2*Math.max(0,M-o);for(let u=L;u<=I;u+=2){const V=t[u-1-f*Math.floor((u-1)/f)],A=t[u+1-f*Math.floor((u+1)/f)],w=u===-M||u!==M&&V<A?A:V+1,k=w-u;let b=w,C=k;for(;b<o&&C<a&&s(l+b,h+C);)b++,C++;if(t[u-f*Math.floor(u/f)]=b,B===1&&(F=R-u)>=1-M&&F<M&&b+t[f+F-f*Math.floor(F/f)]>=o)if(M>1||b!==w){i[x++]=l+b,i[x++]=o-b,i[x++]=h+C,i[x++]=a-C,o=w,a=k,f=2*(Math.min(o,a)+1);continue e}else break t}for(let u=L;u<=I;u+=2){const V=t[f+u-1-f*Math.floor((u-1)/f)],A=t[f+u+1-f*Math.floor((u+1)/f)],w=u===-M||u!==M&&V<A?A:V+1,k=w-u;let b=w,C=k;for(;b<o&&C<a&&s(W-b,Z-C);)b++,C++;if(t[f+u-f*Math.floor(u/f)]=b,B===0&&(F=R-u)>=-M&&F<=M&&b+t[F-f*Math.floor(F/f)]>=o)if(M>0||b!==w){i[x++]=l+o-w,i[x++]=w,i[x++]=h+a-k,i[x++]=k,o=o-b,a=a-C,f=2*(Math.min(o,a)+1);continue e}else break t}}if(o!==a){a>o?(l+=o,h+=o,a-=o,o=0):(l+=a,h+=a,o-=a,a=0);break}}if(o+a!==0)if(e.pxe===l||e.pye===h)e.pxe=l+o,e.pye=h+a;else{const R=e.pxs;if(e.oxs=e.pxs,e.oxe=e.pxe,e.oys=e.pys,e.oye=e.pye,e.pxs=l,e.pxe=l+o,e.pys=h,e.pye=h+a,R>=0)return e.i=l,e.N=o,e.j=h,e.M=a,e.Z=f,e.stack_top=x,1}}case 1:{if(x===0)return 2;a=i[--x],h=i[--x],o=i[--x],l=i[--x],f=2*(Math.min(o,a)+1),n=0}}}class m{constructor(n){this.state=n,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){const{state:n,result:t}=this;if(this.c>1)return t.done=!0,t.value=void 0,t;const s=c(n,this.c);return this.c=s,s===1?(t.value=[n.oxs,n.oxe,n.oys,n.oye],t):n.pxs>=0?(t.value=[n.pxs,n.pxe,n.pys,n.pye],t):(t.done=!0,t.value=void 0,t)}}function D(e,n,t,s,i){const l=(Math.min(n,s)+1)*2,o=n+s,h=new(o<256?Uint8Array:o<65536?Uint16Array:Uint32Array)(2*l);return new m({i:e,N:n,j:t,M:s,Z:l,b:h,eq:i,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}v.diff_core=D;function d(e,n,t){let[s,i,l]=[0,e.length,n.length];if(typeof t=="function"){for(;s<i&&s<l&&t(s,s);)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;t(--i,--l)&&i>s&&l>s;);}else{for(;s<i&&s<l&&e[s]===n[s];)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;e[--i]===n[--l]&&i>s&&l>s;);t=(o,h)=>e[o]===n[h]}return D(s,i+1-s,s,l+1-s,t)}v.diff=d;class p{constructor(n,t){this.diff=n,this.N=t,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){const n=this.diff.next();if(n.done){const{i:a,j:f,N:x}=this;return a<x&&(n.done=!1,n.value=[a,f,x-a],this.i=x),n}const t=n.value,s=t[0],i=t[1],l=t[3],{i:o,j:h}=this;return o!==s&&(t.length--,t[0]=o,t[1]=h,t[2]=s-o),this.i=i,this.j=l,n}}function y(e,n,t){return new p(d(e,n,t),e.length)}v.lcs=y;function*g(e,n,t){const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const i of d(e,n,t))i[2]=s.call(n,i[2],i[3]),yield i}v.calcPatch=g;function*N(e,n){let t=0;const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[i,l,o]of n)t<i&&(yield s.call(e,t,i)),o.length>0&&(yield o),t=l;t<e.length&&(yield s.call(e,t))}v.applyPatch=N;function*j(e,n,t){let s=0;const i=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[l,o,h,a]of d(e,n,t))s<l&&(yield[0,i.call(e,s,l)]),l<o&&(yield[-1,i.call(e,l,o)]),h<a&&(yield[1,i.call(n,h,a)]),s=o;s<e.length&&(yield[0,e.slice(s)])}return v.calcSlices=j,v}var xe=ye();const me=({children:c})=>r.jsx("span",{className:"bg-green-100",children:c}),je=({children:c})=>r.jsx("span",{className:"bg-red-100 line-through",children:c}),G=({children:c})=>r.jsx("span",{children:c}),ge=({content:c,contentOrigin:m,monthDate:D})=>{const d=P.useMemo(()=>{const p=[];if(!m)return p;const y=c.split(""),g=m.split(""),N=Array.from(xe.calcPatch(g,y)),j=[];let e=0;for(const[t,s,i]of N)if(j.length===0&&t>=17&&s<=25&&i.length===s-t){if(N.length===1)return p;continue}else e<t&&j.push([g.slice(e,t).join(""),G]),s>t&&j.push([g.slice(t,s).join(""),je]),i.length>0&&j.push([i.join(""),me]),e=s;e<g.length&&j.push([g.slice(e).join(""),G]);let n=[];for(const[t,s]of j){const i=t.split(`
|
|
2
|
+
`);i.length===1?n.push(r.jsx(s,{children:t},`unchanged-${n.length}`)):i.map((l,o)=>{n.push(r.jsx(s,{children:l},o)),p.push(r.jsx("div",{children:n},p.length-1)),n=[]})}return n.length>0&&p.push(r.jsx("div",{children:n},p.length-1)),p},[c,m]);return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"text-sm text-gray-500 flex flex-row gap-2",children:[r.jsx("span",{className:"font-bold",children:"Month:"}),r.jsx("span",{children:D.slice(0,7)}),!d.length&&r.jsx(J,{className:"text-green-500"})]}),!!d.length&&d]})},Me=({filter:c})=>{const[{data:m,fetching:D,hasNext:d}]=Q({query:H,variables:c}),p=P.useMemo(()=>m?.pcnByDate?m.pcnByDate.sort((y,g)=>g.date>y.date?1:g.date<y.date?-1:0):[],[m?.pcnByDate]);return D?r.jsx("div",{className:"w-full h-full flex justify-center",children:r.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"})}):r.jsxs("div",{className:"flex flex-col gap-4",children:[!!m&&d&&r.jsx("div",{className:"w-full h-full flex justify-center",children:r.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"})}),p.map((y,g)=>r.jsx(ge,{content:y.content,contentOrigin:y.diffContent,monthDate:y.date},g))]})};function be({filter:c,setFilter:m,closeModal:D}){const{control:d,handleSubmit:p,setValue:y}=X({defaultValues:{...c}}),{selectableBusinesses:g,fetching:N}=ee(),j=e=>{m(e),D()};return r.jsxs(r.Fragment,{children:[N?r.jsx("div",{children:"Loading..."}):r.jsx("div",{}),r.jsxs("form",{onSubmit:p(j),children:[r.jsx(te,{name:"businessId",control:d,defaultValue:void 0,render:({field:e,fieldState:n})=>r.jsx(ne,{...e,data:g,value:e.value,disabled:N,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message})}),r.jsx(O,{label:"From date",defaultValue:c?.fromMonthDate?new Date(c.fromMonthDate):new Date,defaultDate:c?.fromMonthDate?new Date(c.fromMonthDate):new Date,onChange:e=>{const n=new Date(e.getFullYear(),e.getMonth(),15);y("fromMonthDate",S(n,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}}),r.jsx(O,{label:"To date",defaultValue:c?.toMonthDate?new Date(c.toMonthDate):new Date,defaultDate:c?.toMonthDate?new Date(c.toMonthDate):new Date,onChange:e=>{const n=new Date(e.getFullYear(),e.getMonth(),15);y("toMonthDate",S(n,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}}),r.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[r.jsx(U,{type:"submit",children:"Filter"}),r.jsx(U,{type:"button",onClick:D,children:"Cancel"})]})]})]})}function ve({filter:c,setFilter:m}){const[D,d]=P.useState(!1),{get:p,set:y}=Y(),{userContext:g}=P.useContext($);function N(j){j||={businessId:g?.context.adminBusinessId??c.businessId,fromMonthDate:S(T(new Date),"yyyy-MM-15"),toMonthDate:S(new Date,"yyyy-MM-15")},se(j,c)||m(j)}return P.useEffect(()=>{const j=K(c??{})?null:encodeURIComponent(JSON.stringify(c)),e=p("validateReportsFilters");j!==e&&y("validateReportsFilters",j)},[c,p,y]),r.jsxs(r.Fragment,{children:[r.jsx(de,{opened:D,onClose:()=>d(!1),content:r.jsx(be,{filter:c,setFilter:N,closeModal:()=>d(!1)})}),r.jsx(U,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>d(!0),children:r.jsx(pe,{className:"size-5"})})]})}const ke=()=>{const{get:c}=Y(),{setFiltersContext:m}=P.useContext(oe),D=P.useMemo(()=>{try{if(c("validateReportsFilters"))return JSON.parse(decodeURIComponent(c("validateReportsFilters")))}catch(y){console.error("Error parsing filter from URL",y)}return{fromMonthDate:S(T(new Date),"yyyy-MM-15"),toMonthDate:S(new Date,"yyyy-MM-15")}},[c]),[d,p]=P.useState(D);return P.useEffect(()=>{m(r.jsx("div",{className:"flex flex-row gap-2",children:r.jsx(ve,{filter:{...d},setFilter:p})}))},[d,m]),r.jsx(ae,{title:"Report Validations",children:r.jsx(ce,{type:"single",collapsible:!0,children:r.jsx(fe,{value:"pcn874",children:r.jsxs(re,{className:"p-4",children:[r.jsx(ue,{children:r.jsx(ie,{children:"Monthly VAT (PCN874)"})}),r.jsx(he,{children:r.jsx(le,{children:r.jsx(Me,{filter:d})})})]})})})})};export{ke as ValidateReportsScreen};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{v as
|
|
1
|
+
import{v as U,r as b,bs as z,j as e,D as G,aS as Q,B as g,z as W,aT as J,aU as K,a3 as T,as as X,b1 as R,at as A,au as O,av as k,aw as E,ay as D,cx as Z,J as j,bj as w,g1 as M,g2 as ee,g3 as S,g4 as se,g5 as I,g6 as L,g7 as B,g8 as N,g9 as p,ga as P,gb as Y,dk as re,gc as te,be as ae,bf as le,bg as v,gd as V,F as de,u as ne,N as oe,O as ce,Y as ie,ge as me}from"./index-Cw_aKL-8.js";import{F as $}from"./funnel-CMG4QvaK.js";import{B as ue}from"./building-2-ZTKteVvf.js";import{S as xe}from"./save-BW18gNVs.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=U("eye-off",he),y=["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}=z(),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(K,{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(X,{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:y.map(x=>e.jsx(D,{value:x,children:x},x))})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",y.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"),y.map(x=>e.jsx(D,{value:x,children:x},x))]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",y.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 ye({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 Ce=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""}},C=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:Ce(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:C(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:C(!!s.softwareRegistrationNumber),showEmptyFields:!0}),s.softwareRegistrationNumber&&e.jsx(m,{label:"מספר תעודת רישום",value:s.softwareRegistrationNumber,showEmptyFields:!0}),e.jsx(m,{label:"דוח בגין שותפות",value:C(!!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:C(!!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(Y,t),o=j(Y,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(V,t),n=j(V,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(ye,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,F as C,u as S,j as e,T as h,B as g,bn as u,aR as a,L as y,bo as R,bp as N}from"./index-Cw_aKL-8.js";import{u as T}from"./use-url-query-C0mVgO2i.js";import{A as v}from"./accounter-table-BL_yrGIl.js";import{P as E}from"./page-layout-CVTeUSZp.js";import{C as L,a as F,B,M as z}from"./business-extended-info-1mzdXJbs.js";import{B as I}from"./business-ledger-filters-BRB1r_DP.js";import{P as A,a as k}from"./panel-top-open-DzBY_TuM.js";import{T as O}from"./Table-DnHfGe-y.js";import"./download-csv-button-CwK31swX.js";import"./modal-Pj_6bAFk.js";import"./funnel-CMG4QvaK.js";import"./MultiSelect-Dm9mO7pJ.js";const W=()=>{const{get:t}=T(),{setFiltersContext:i}=l.useContext(C),[r,o]=l.useState(!1),[p,j]=l.useState(!1),[m,x]=l.useState(t("ledgerRecordsFilters")?JSON.parse(decodeURIComponent(t("ledgerRecordsFilters"))):{}),[{data:c,fetching:w}]=S({query:R,variables:{filters:m}});l.useEffect(()=>{i(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(I,{filter:m,setFilter:x}),e.jsx(h,{label:"Expand all accounts",children:e.jsx(g,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(s=>!s),children:r?e.jsx(A,{className:"size-5"}):e.jsx(k,{className:"size-5"})})}),e.jsx(h,{label:"Expand all currencies",children:e.jsx(g,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>j(s=>!s),children:p?e.jsx(L,{className:"size-5"}):e.jsx(F,{className:"size-5"})})})]}))},[c,m,i,x,r,o,p]);const b=l.useMemo(()=>c?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:c?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?c.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((s,d)=>s.business.name.localeCompare(d.business.name)):[],[c?.businessTransactionsSumFromLedgerRecords]),f=[{title:"Business Name",value:s=>s.business.name},{title:"Debit / Credit",value:s=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("p",{className:"flex flex-row gap-2 whitespace-nowrap",children:e.jsx(u,{c:"red",children:s.debit.formatted})}),e.jsx("p",{className:"flex flex-row gap-2 whitespace-nowrap",children:e.jsx(u,{c:"green",children:s.credit.formatted})})]}),style:{whiteSpace:"nowrap"}},{title:"Total",value:s=>e.jsx(u,{c:s.total.raw<-1e-4?"red":s.total.raw>1e-4?"green":void 0,fw:700,children:s.total.formatted}),style:{whiteSpace:"nowrap"}},...n(a.Eur),...n(a.Usd),...n(a.Gbp),...n(a.Cad),...n(a.Jpy),...n(a.Aud),...n(a.Sek),...P(p)];return e.jsx(E,{title:"Business Ledger Records",description:"Business Ledger Records Summary",children:w?e.jsx(y,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(O,{striped:!0,highlightOnHover:!0,children:[e.jsx("thead",{className:"sticky top-0 z-20",children:e.jsxs("tr",{className:"tracking-wider font-medium text-gray-900 text-sm bg-gray-100",children:[f.map((s,d)=>s.disabled?null:e.jsx("th",{children:s.title},String(d))),e.jsx("th",{children:"More Info"})]})}),e.jsx("tbody",{children:b.map((s,d)=>e.jsx(v,{columns:f,item:s,moreInfo:()=>e.jsx(B,{businessID:s.business.id,filter:m}),isShowAll:r},d))})]})})};function n(t){return[{title:`${t} Debit / Credit`,value:i=>{const r=i.foreignCurrenciesSum.find(o=>o.currency===t);return r?e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("p",{className:"flex flex-row gap-2 whitespace-nowrap",children:e.jsx(u,{c:"red",children:r.debit.formatted})}),e.jsx("p",{className:"flex flex-row gap-2 whitespace-nowrap",children:e.jsx(u,{c:"green",children:r.credit.formatted})})]}):null},style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:i=>{const r=i.foreignCurrenciesSum.find(o=>o.currency===t);return r?.total?.raw&&(r.total.raw<-1e-4||r.total.raw>1e-4)?e.jsx(z,{color:r.total.raw>0?"green":"red",children:r.total.formatted}):r?.total?.formatted},style:{whiteSpace:"nowrap"}}]}function P(t){return t?Object.values(a).filter(r=>!N.includes(r)).map(n).flat():[]}export{W as BusinessLedgerRecordsSummery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as M,
|
|
1
|
+
import{u as M,da as X,t as C,r as s,g as Y,i as U,db as J,dc as K,J as F,dd as E,j as e,D as R,aS as G,B as v,a4 as Q,z as q,aT as W,aU as Z,at as _,au as ee,av as se,aw as te,ay as ne,de as ae,df as re,dg as z,dh as V,bX as ce,di as $,dj as ie,N as P,Y as B,L as A,dk as le,e as oe,O as de,V as ue,dl as me,bi as he,b4 as xe,dm as je,x as k,dn as H,G as pe,K as fe,w as ge,X as ye,a3 as ve,cL as De,cW as be,cX as Ce,cY as O,cZ as g,c$ as Ne,d0 as y,a5 as we,bT as Ie,F as Me,c as Te}from"./index-Cw_aKL-8.js";import{s as L}from"./subMonths-DqeFZ4O6.js";const Se=()=>{const[{data:u,fetching:o,error:c},x]=M({query:X});c&&(console.error(`Error fetching contracts: ${c}`),C.error("Error",{description:"Unable to fetch contracts"}));const a=s.useMemo(()=>u?.allOpenContracts?.slice().sort((t,d)=>t.client.originalBusiness.name>d.client.originalBusiness.name?1:-1)??[],[u]),i=s.useMemo(()=>a.map(t=>({value:t.id,label:t.client.originalBusiness.name})),[a]);return{fetching:o,refresh:()=>x(),openContracts:a,selectableOpenContracts:i}},Fe="IssueMonthlyDocuments",Ee=()=>{const[{fetching:u},o]=Y(J),c=s.useCallback(async x=>{const a="Error issuing monthly documents",i=Fe;C.loading("Issuing documents",{id:i});try{const t=await o(x),d=U(t,a,i);if(d?.issueGreenInvoiceDocuments?.success){C.success("Success",{id:i,description:"Documents issued successfully"});return}d?.issueGreenInvoiceDocuments?.errors&&console.error(d.issueGreenInvoiceDocuments.errors),C.error("Error",{id:i,description:a,duration:1e5,closeButton:!0})}catch(t){console.error(`${a}: ${t}`),C.error("Error",{id:i,description:a,duration:1e5,closeButton:!0})}},[o]);return{fetching:u,issueDocuments:c}};function ke({issueMonth:u,contracts:o,onAdd:c}){const[x,a]=s.useState(!1),[i,t]=s.useState(""),[{data:d},h]=M({query:K,variables:{issueMonth:u,clientId:i}}),j=s.useCallback(n=>{t(n),h()},[h,t]);return s.useEffect(()=>{i!==""&&d&&(c(F(E,d.clientMonthlyChargeDraft)),a(!1))},[i,d,c]),e.jsxs(R,{open:x,onOpenChange:a,children:[e.jsx(G,{asChild:!0,children:e.jsx(v,{variant:"outline",size:"icon",children:e.jsx(Q,{})})}),e.jsxs(q,{className:"w-[400px] max-w-screen-md",children:[e.jsx(W,{children:e.jsx(Z,{children:"Select document recipient"})}),e.jsxs(_,{onValueChange:j,children:[e.jsx(ee,{children:e.jsx(se,{placeholder:"Recipient"})}),e.jsx(te,{children:o.map(n=>e.jsx(ne,{value:n.client.originalBusiness.id,children:n.client.originalBusiness.name},n.client.originalBusiness.id))})]})]})]})}function Pe({onApprove:u,draft:o}){const[c,x]=s.useState(!1),[a,i]=s.useState(!1),[t,d]=s.useState(null),{previewDocument:h,fetching:j}=ae(),[n,N]=s.useState(re(o)),T=s.useCallback((l,p)=>{N(f=>({...f,[l]:p}))},[]);s.useEffect(()=>{i(!1)},[n]);const D=s.useCallback(async()=>{try{const l=await h({input:n});if(!l)throw new Error("No preview data returned");d(l),i(!0)}catch(l){console.error("Failed to generate preview:",l)}},[n,h]);s.useEffect(()=>{c&&!t&&D()},[c,t,D]);const w=n.income?.reduce((l,p)=>{const f=p.price*p.quantity,r=f*((p.vatRate||0)/100);return l+f+r},0)||0,I=()=>{u(n),x(!1)};return e.jsxs(R,{open:c,onOpenChange:x,children:[e.jsx(G,{asChild:!0,type:"button",children:e.jsxs(z,{children:[e.jsx(V,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>x(l=>!l),type:"button",children:e.jsx(ce,{className:"size-5"})})}),e.jsx($,{children:e.jsx("p",{children:"Edit document"})})]})}),e.jsx(q,{className:"w-7xl sm:max-w-[95%] max-h-[90vh] overflow-y-auto",children:e.jsx("div",{className:"min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Edit Document"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Modify and preview your accounting document before issuing"})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(ie,{formData:n,updateFormData:T}),e.jsx(P,{children:e.jsxs(B,{className:"pt-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(v,{onClick:D,disabled:j||a,variant:"outline",className:"flex-1 bg-transparent",children:j?e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-2"}),"Preview"]})}),e.jsxs(v,{onClick:I,className:"flex-1",children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Accept Changes"]})]}),w>0&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"flex justify-between items-center font-medium text-blue-900",children:[e.jsx("span",{children:"Total Document Amount:"}),e.jsxs("span",{children:[w.toFixed(2)," ",n.currency]})]})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(P,{className:"h-fit",children:[e.jsx(de,{children:e.jsx(ue,{children:"Document Preview"})}),e.jsx(B,{children:e.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50",children:j?e.jsxs("div",{className:"text-center",children:[e.jsx(A,{className:"w-8 h-8 animate-spin mx-auto mb-4 text-gray-400"}),e.jsx("p",{className:"text-gray-500",children:"Generating document preview..."})]}):t?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"bg-white shadow-lg rounded-lg overflow-hidden",children:e.jsx("div",{className:"aspect-[8.5/11] bg-white border",children:e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(me,{src:t}),!a&&e.jsx("p",{className:"text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded",children:"Preview may be outdated"})]})})})})}):e.jsxs("div",{className:"text-center",children:[e.jsx(he,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-gray-500 mb-2",children:"No preview available"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Click Preview to generate document"})]})})})]}),n.client?.id&&e.jsx(xe,{businessId:n.client?.id,linkedDocumentIds:n.linkedDocumentIds??[]}),e.jsx(je,{documentType:n.type})]})]})]})})})]})}const Be=({drafts:u})=>{const[o,c]=s.useState(u.map(r=>F(E,r))),x=k(L(new Date,1),"yyyy-MM-dd"),[a,i]=s.useState(x),[{data:t},d]=M({query:H,variables:{issueMonth:a},pause:!0});s.useEffect(()=>{t?.clientMonthlyChargesDrafts&&c(t.clientMonthlyChargesDrafts.map(r=>F(E,r)))},[t,c]),s.useEffect(()=>{d()},[a,d]);const h=pe({values:{generateDocumentsInfo:o}}),{issueDocuments:j}=Ee(),{openContracts:n}=Se(),{fields:N,append:T,remove:D,update:w}=fe({control:h.control,name:"generateDocumentsInfo"}),I=h.watch("generateDocumentsInfo"),l=s.useMemo(()=>N.map((r,m)=>({...r,...I[m],id:r.client?.id})),[N,I]),p=s.useCallback(r=>{j(r)},[j]),f=s.useMemo(()=>n.filter(r=>r.billingCycle===ge.Monthly&&!l.some(m=>m.client?.id===r.client.originalBusiness.id)),[l,n]);return e.jsx("div",{className:"p-2",children:e.jsx(ye,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(p),children:[e.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[e.jsx(ve,{children:"Issue Month:"}),e.jsx(De,{value:new Date(a),onChange:r=>{const m=new Date(r.getFullYear(),r.getMonth(),15);i(k(m,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}})]}),e.jsxs(be,{children:[e.jsx(Ce,{children:e.jsxs(O,{children:[e.jsx(g,{children:"Name"}),e.jsx(g,{children:"Document"}),e.jsx(g,{children:"Amount"}),e.jsx(g,{children:"Remark"}),e.jsx(g,{children:"Recipients"}),e.jsx(g,{})]})}),e.jsx(Ne,{children:l.map(({id:r,...m},S)=>e.jsxs(O,{children:[e.jsx(y,{children:m.client?.name}),e.jsx(y,{children:m.type}),e.jsxs(y,{children:[m.income?.[0]?.price," ",m.income?.[0]?.currency]}),e.jsx(y,{children:e.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:m.remarks})}),e.jsx(y,{children:e.jsx("div",{className:"flex flex-col",children:m.client?.emails?.map(b=>e.jsx("span",{className:"text-sm text-gray-500",children:b},b))})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(z,{children:[e.jsx(V,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>D(S),children:e.jsx(we,{size:16})})}),e.jsx($,{children:e.jsx("p",{children:"Remove document"})})]}),e.jsx(Pe,{draft:m,onApprove:b=>{h.setValue(`generateDocumentsInfo.${S}`,b,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),w(S,{...b})}})]})})]},r))})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsx(ke,{contracts:f,onAdd:T,issueMonth:a}),e.jsx(Ie,{onConfirm:h.handleSubmit(p),title:`Are you sure you want to issue ${l.length} documents?`,children:e.jsx(v,{children:"Issue"})})]})]})})})},Re=()=>{const{setFiltersContext:u}=s.useContext(Me),[{data:o,fetching:c}]=M({query:H,variables:{issueMonth:k(L(new Date,1),"yyyy-MM-dd")}});return s.useEffect(()=>{o?.clientMonthlyChargesDrafts||u(null)},[o,u]),c?e.jsx(Te,{}):e.jsx(Be,{drafts:o?.clientMonthlyChargesDrafts??[]})};export{Re as IssueDocuments};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as x,by as h,J as T,r,j as s,br as g,bz as j,F as B,T as w,ao as C,L as b,a4 as v,bA as y}from"./index-Cw_aKL-8.js";import{E,P,C as L}from"./editable-business-trip-Bjxkm9xV.js";import{I as F}from"./insert-business-trip-modal-Ds3RIlmF.js";import{P as I}from"./page-layout-CVTeUSZp.js";import{A as m}from"./summary-Bbsq64IN.js";import"./list-plus-B3EB-dKe.js";import"./Table-DnHfGe-y.js";import"./toggle-expansion-button-BrKkZtGj.js";import"./panel-top-open-DzBY_TuM.js";import"./MultiSelect-Dm9mO7pJ.js";import"./similar-transactions-modal-B39q1NLa.js";import"./tooltip-CbnJYNc4.js";const S=({data:c,isOpened:o,shouldValidate:l})=>{const e=T(j,c),[{data:i,fetching:a}]=x({pause:!l,query:h,variables:{id:e.id}}),d=r.useMemo(()=>l?i?.businessTrip&&(i.businessTrip.uncategorizedTransactions?.length||i?.businessTrip.summary?.errors?.length):!1,[i]),u=d||e?.accountantApproval!=="APPROVED";return s.jsxs(m.Item,{value:e.id,children:[s.jsx(m.Control,{children:s.jsx(g,{inline:!0,size:12,processing:a,disabled:!u,color:d?"red":"yellow",zIndex:"auto",children:e.name})}),s.jsx(m.Panel,{children:o&&s.jsx(E,{tripId:e.id,isExtended:!0},e.id)})]})},U=()=>{const{setFiltersContext:c}=r.useContext(B),[o,l]=r.useState([]),[e,i]=r.useState(!1),[{data:a,fetching:d}]=x({query:y});r.useEffect(()=>{if(!a?.allBusinessTrips?.length){l([]);return}const t=a.allBusinessTrips.sort((n,p)=>n.dates?.start&&p.dates?.start?n.dates.start<p.dates.start?1:-1:n.dates?.start?-1:p.dates?.start?1:n.name.toLocaleLowerCase()<p.name.toLocaleLowerCase()?-1:1);l(t)},[a?.allBusinessTrips]);const[u,f]=r.useState([]);return r.useEffect(()=>{c(s.jsxs("div",{className:"flex flex-row gap-x-5",children:[s.jsx(F,{}),s.jsx(w,{label:"Toggle business trips validation",children:s.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[s.jsx(C,{checked:e??!1,onCheckedChange:t=>i(t)}),s.jsx("span",{className:"text-sm text-gray-500",children:"Validate"})]})}),s.jsx(P,{filename:"business_trips"})]}))},[a,d,c,e]),s.jsx(I,{title:"Business Trips",description:"Manage business trips",children:o.length===0&&d?s.jsx(b,{className:"h-10 w-10 animate-spin mr-2 self-center"}):s.jsx(L,{children:s.jsx(m,{className:"w-full",multiple:!0,value:u,onChange:f,chevron:s.jsx(v,{size:"1rem"}),styles:{chevron:{"&[data-rotate]":{transform:"rotate(45deg)"}}},children:o?.map(t=>s.jsx(S,{data:o.find(n=>n.id===t.id),shouldValidate:e,isOpened:u.includes(t.id)},t.id))})})})};export{U as BusinessTrips};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as v,hF as H,r as u,t as m,i as F,aq as B,j as e,Z as C,_ as j,$ as f,a0 as p,I as L,a1 as y,a2 as S,bt as z,bw as _,az as G,ao as V,D,aS as E,B as h,z as M,aT as R,aU as A,G as $,X as k,hG as X,bX as K,u as O,hH as Z,L as P,F as Q,cT as W,cW as Y,cX as J,cY as T,cZ as ee,c_ as b,c$ as se,d0 as w,hI as te,d6 as ae,d7 as re,d8 as oe}from"./index-Cw_aKL-8.js";import{D as ne}from"./data-table-pagination-fdOZTf64.js";import{P as ie}from"./page-layout-CVTeUSZp.js";import{A as I}from"./arrow-up-down-DchtBEG4.js";const de="insertTaxCategory",ce=()=>{const[{fetching:s},n]=v(H),t=u.useCallback(async a=>{const d="Error creating tax category",r=de;m.loading("Adding Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r);if(l)return m.success("Success",{id:r,description:`${l.insertTaxCategory.name} was created`}),l.insertTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertTaxCategory:t}};function q({formManager:s,setFetching:n,isInsert:t}){const{control:a,watch:d,setValue:r}=s,{selectableSortCodes:i,fetching:l,sortCodes:x}=B();u.useEffect(()=>{n(l)},[n,l]);const c=d("sortCode");return u.useEffect(()=>{if(c){const o=x.find(g=>g.key===c);o?.defaultIrsCode&&r("irsCode",o.defaultIrsCode,{shouldDirty:!0})}},[c,x,r]),e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"name",control:a,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"Name"}),e.jsx(p,{children:e.jsx(L,{...o,value:o.value??void 0,required:!0,className:t?"":y(g)})}),e.jsx(S,{})]})}),e.jsx(z,{name:"sortCode",control:a,render:({field:o,fieldState:g})=>e.jsx(_,{...o,onChange:U=>{o.onChange(Number(U))},data:i,value:o.value?.toString(),disabled:l,label:"Sort Code",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,className:t?"":y(g)})}),e.jsx(C,{name:"irsCode",control:a,render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(p,{children:e.jsx(G,{...o,className:t?"":y(g),value:o.value??void 0,hideControls:!0,decimalScale:0})}),e.jsx(S,{})]})}),e.jsx(C,{control:a,name:"taxExcluded",render:({field:o})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(f,{children:"Tax excluded category"})}),e.jsx(p,{children:e.jsx(V,{onCheckedChange:o.onChange,checked:o.value??void 0})})]})})]})}function le({onAdd:s}){const[n,t]=u.useState(!1);return e.jsxs(D,{open:n,onOpenChange:t,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{children:"Add Tax Category"})}),e.jsxs(M,{className:"w-[90vw] max-w-screen-md",children:[e.jsx(R,{children:e.jsx(A,{children:"Add New Tax Category"})}),e.jsx(xe,{close:()=>t(!1),onAdd:s})]})]})}function xe({close:s,onAdd:n}){const t=$({}),{handleSubmit:a}=t,[d,r]=u.useState(!1),{insertTaxCategory:i,fetching:l}=ce(),x=c=>{c.sortCode&&=parseInt(c.sortCode.toString()),i({fields:c}).then(o=>{o?.id&&(n?.(o.id),s())})};return e.jsx(k,{...t,children:e.jsxs("form",{onSubmit:a(x),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!0,formManager:t,setFetching:r})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:l||d,children:"Add Tax Category"})})]})})}const ue="updateTaxCategory",ge=()=>{const[{fetching:s},n]=v(X),t=u.useCallback(async a=>{const d="Error updating tax category",r=`${ue}-${a.taxCategoryId}`;m.loading("Uploading Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r,"updateTaxCategory");if(l)return m.success("Success",{id:r,description:`${l.updateTaxCategory.name} was updated`}),l.updateTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateTaxCategory:t}};function me({taxCategoryId:s,onAdd:n}){const[t,a]=u.useState(!1);return e.jsxs(D,{open:t,onOpenChange:a,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{variant:"outline",size:"icon",children:e.jsx(K,{})})}),e.jsxs(M,{className:"w-[400px] max-w-screen-md",children:[e.jsx(R,{children:e.jsx(A,{children:"Edit Tax Category"})}),e.jsx(he,{taxCategoryId:s,close:()=>a(!1),onAdd:n})]})]})}function he({taxCategoryId:s,close:n,onAdd:t}){const[{data:a,fetching:d}]=O({query:Z,variables:{id:s}}),r=a?.taxCategory;return!r&&!d&&m.error("Error",{description:"Couldn'nt find tax category"}),d?e.jsx(P,{className:"h-10 w-10 animate-spin"}):e.jsx(Ce,{taxCategory:r,close:n,onAdd:t})}function Ce({taxCategory:s,close:n,onAdd:t}){const a=$({defaultValues:{sortCode:s.sortCode?.key,name:s.name,irsCode:s.irsCode}}),{handleSubmit:d}=a,[r,i]=u.useState(!1),{updateTaxCategory:l,fetching:x}=ge(),c=o=>{o.sortCode&&=parseInt(o.sortCode.toString()),l({fields:o,taxCategoryId:s.id}).then(g=>{g?.id&&(t?.(g.id),n())})};return e.jsx(k,{...a,children:e.jsxs("form",{onSubmit:d(c),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!1,formManager:a,setFetching:i})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:x||r,children:"Update"})})]})})}const je=({data:s})=>e.jsx("td",{children:s.name}),fe=({data:s})=>e.jsx("td",{children:s.sortCode?e.jsxs("span",{children:[s.sortCode?.name," (",s.sortCode?.id,")"]}):"N/A"}),N=[{id:"name",accessorKey:"name",cell:({row:s})=>e.jsx(je,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Name",e.jsx(I,{})]})},{id:"sortCode",accessorKey:"sortCode.key",cell:({row:s})=>e.jsx(fe,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Sort Code",e.jsx(I,{})]})},{id:"edit",cell:({row:s})=>e.jsx(me,{taxCategoryId:s.original.id})}],be=()=>{const[{data:s,fetching:n,error:t},a]=O({query:te}),{setFiltersContext:d}=u.useContext(Q),r=s?.taxCategories??[],i=W({data:r,columns:N,getCoreRowModel:oe(),getPaginationRowModel:re(),getSortedRowModel:ae(),initialState:{pagination:{pageSize:30}}}),l=i.getPageOptions();return u.useEffect(()=>{d(e.jsx("div",{className:"flex items-center justify-end gap-10 space-x-2 py-4",children:e.jsx("div",{className:"flex items-center justify-between px-2",children:e.jsx(ne,{table:i})})}))},[d,i,l]),u.useEffect(()=>{t&&m.error("Error",{description:"Error fetching tax categories"})},[t]),e.jsx(ie,{title:`Tax Categories (${r.length})`,description:"All tax categories",headerActions:e.jsx(le,{onAdd:()=>a()}),children:n?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(P,{className:"h-10 w-10 animate-spin mr-2"})}):e.jsx("div",{className:"flex flex-col gap-4 rounded-md border",children:e.jsxs(Y,{children:[e.jsx(J,{children:i.getHeaderGroups().map(x=>e.jsx(T,{children:x.headers.map(c=>e.jsx(ee,{children:c.isPlaceholder?null:b(c.column.columnDef.header,c.getContext())},c.id))},x.id))}),e.jsx(se,{children:i.getRowModel().rows.length===0?e.jsx(T,{children:e.jsx(w,{colSpan:N.length,className:"text-center py-8",children:"No tax categories found"})}):i.getRowModel().rows.map(x=>e.jsx(T,{children:x.getVisibleCells().map(c=>e.jsx(w,{children:b(c.column.columnDef.cell,c.getContext())},c.id))},x.id))})]})})})};export{be as TaxCategories};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,B as u,a as y,F as g,u as P,L as D,
|
|
1
|
+
import{r as c,j as e,B as u,a as y,F as g,u as P,L as D,fX as w}from"./index-Cw_aKL-8.js";import{d as R}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{P as E}from"./page-layout-CVTeUSZp.js";import{R as d}from"./report-commentary-row-Dqw62LLo.js";import{P as v}from"./modal-Pj_6bAFk.js";import{Y as p}from"./YearPickerInput-oa86GF4P.js";import{F}from"./funnel-CMG4QvaK.js";import{T as C}from"./Table-DnHfGe-y.js";import"./toggle-expansion-button-BrKkZtGj.js";import"./panel-top-open-DzBY_TuM.js";function A({year:l,setYear:h,referenceYears:o,setReferenceYears:j}){const[m,x]=c.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(v,{opened:m,onClose:()=>x(!1),withCloseButton:!0,content:e.jsxs(e.Fragment,{children:[e.jsx(p,{label:"Change report year",value:new Date(l,0,1),onChange:n=>n&&h(n?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),e.jsx(p,{type:"multiple",label:"Pick reference years",value:o?.map(n=>new Date(n,0,1)),onChange:n=>j(n.map(i=>i.getFullYear()).filter(i=>l!==i)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),e.jsx(u,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>x(!0),children:e.jsx(F,{className:"size-5"})})]})}const I=()=>{const{year:l}=y(),{setFiltersContext:h}=c.useContext(g),[o,j]=c.useState(l?Number(l):new Date().getFullYear()),[m,x]=c.useState([]),[{data:n,fetching:i}]=P({query:R(w),variables:{reportYear:o,referenceYears:m}});c.useEffect(()=>{h(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(A,{year:o,setYear:j,referenceYears:m,setReferenceYears:x})}))},[o,i,h,m,x]);const f=n?.profitAndLossReport,r=f?.report,s=f?.reference??[];return e.jsx(E,{title:"Profit and Loss Report",children:i?e.jsx(D,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:r&&e.jsxs(C,{highlightOnHover:!0,fontSize:"md",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{children:o},o),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.year},t.year))]})}),e.jsxs("tbody",{children:[e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("th",{children:"Revenue"}),e.jsx("th",{children:r.revenue.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("th",{children:a.revenue.amount.formatted},a.year))]}),commentaryData:r.revenue}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Cost of Sales"}),e.jsx("td",{children:r.costOfSales.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.costOfSales.amount.formatted},a.year))]}),commentaryData:r.costOfSales}),e.jsxs("tr",{children:[e.jsx("th",{children:"Gross Profit"}),e.jsx("th",{children:r.grossProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.grossProfit.formatted},t.year))]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses"}),e.jsx("td",{children:r.researchAndDevelopmentExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.researchAndDevelopmentExpenses.amount.formatted},a.year))]}),commentaryData:r.researchAndDevelopmentExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Marketing Expenses"}),e.jsx("td",{children:r.marketingExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.marketingExpenses.amount.formatted},a.year))]}),commentaryData:r.marketingExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Management and General Expenses"}),e.jsx("td",{children:r.managementAndGeneralExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.managementAndGeneralExpenses.amount.formatted},a.year))]}),commentaryData:r.managementAndGeneralExpenses}),e.jsxs("tr",{children:[e.jsx("th",{children:"Operating Profit"}),e.jsx("th",{children:r.operatingProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.operatingProfit.formatted},t.year))]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Financial Expenses"}),e.jsx("td",{children:r.financialExpenses.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.financialExpenses.amount.formatted},a.year))]}),commentaryData:r.financialExpenses}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Other Income"}),e.jsx("td",{children:r.otherIncome.amount.formatted}),e.jsx("th",{children:t}),s.map(a=>e.jsx("td",{children:a.otherIncome.amount.formatted},a.year))]}),commentaryData:r.otherIncome}),e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:r.profitBeforeTax.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.profitBeforeTax.formatted},t.year))]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Tax"}),e.jsx("td",{children:r.tax.formatted}),e.jsx("td",{}),s.map(t=>e.jsx("td",{children:t.tax.formatted},t.year))]})]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Net Profit"}),e.jsx("th",{children:r.netProfit.formatted}),e.jsx("th",{}),s.map(t=>e.jsx("th",{children:t.netProfit.formatted},t.year))]})})]})})})};export{I as ProfitAndLossReport};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{v as fn,gt as te,fK as A,fI as ge,gu as Ae,gv as hn,j as i,T as ut,bV as ft,R as ht,B as H,m as E,bT as mn,gw as gn,e9 as yn,u as mt,gx as pn,G as gt,r as C,cR as yt,d as xn,X as pt,ea as vn,Z as se,_ as re,$ as oe,at as bn,a0 as he,au as Dn,av as kn,aw as Mn,ay as wn,a2 as ie,bu as xt,x as le,ao as Sn,aa as Cn,g as On,gy as Nn,t as Te,i as jn,L as Tn,as as Je,bt as Xe,bN as Wn,bv as En,gz as _n,I as vt,gA as In,gB as Fn,fJ as Yn,gC as Bn,gD as Pn,gE as Rn,gF as An,gG as zn,gH as qn,gI as Hn,gJ as bt,ai as m,gK as $n,gL as Zn,dr as ne,gM as Qe,gN as Un,gO as Kn,b1 as Ln,gP as Gn,dy as Vn,ef as Jn,eg as Xn,gQ as Qn,D as es,aS as ts,z as ns,aT as ss,aU as rs,cx as os,bs as as,cs as is,q as cs,e as ls,dq as ae,fF as ds,J as us,fr as fs,cT as hs,d7 as ms,d6 as gs,d8 as ys,cW as ps,cX as xs,cY as We,cZ as vs,c_ as et,c$ as bs,d0 as tt,P as Ds}from"./index-Cw_aKL-8.js";import{u as qe,S as ks}from"./similar-transactions-modal-B39q1NLa.js";import{a as Dt}from"./addDays-DqZEDZy3.js";import{L as Ms}from"./list-plus-B3EB-dKe.js";import{T as ws}from"./tooltip-CbnJYNc4.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 Ss=[["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"}]],Cs=fn("external-link",Ss);function Os(e,t,s){return Dt(e,t*7,s)}function Ns(e,t){let s,n=t?.in;return e.forEach(r=>{!n&&typeof r=="object"&&(n=te.bind(null,r));const a=A(r,n);(!s||s<a||isNaN(+a))&&(s=a)}),te(n,s||NaN)}function js(e,t){let s,n=t?.in;return e.forEach(r=>{!n&&typeof r=="object"&&(n=te.bind(null,r));const a=A(r,n);(!s||s>a||isNaN(+a))&&(s=a)}),te(n,s||NaN)}function Ts(e,t,s){const[n,r]=ge(s?.in,e,t);return+Ae(n)==+Ae(r)}function Ws(e,t,s){const[n,r]=ge(s?.in,e,t),a=n.getFullYear()-r.getFullYear(),c=n.getMonth()-r.getMonth();return a*12+c}function Es(e,t){const s=A(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]=ge(e,t.start,t.end);return{start:s,end:n}}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.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 Is(e,t){const s=A(e,t?.in);return s.setDate(1),s.setHours(0,0,0,0),s}function Fs(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=A(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 Ys(e,t){return Mt(e,{...t,weekStartsOn:1})}function Bs(e,t){const s=A(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 Ps(e,t){return A(e,t?.in).getMonth()}function Rs(e,t){return A(e,t?.in).getFullYear()}function As(e,t){return+A(e)>+A(t)}function zs(e,t){return+A(e)<+A(t)}function qs(e,t,s){const[n,r]=ge(s?.in,e,t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Hs(e,t,s){const[n,r]=ge(s?.in,e,t);return n.getFullYear()===r.getFullYear()}function $s(e,t,s){const n=A(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=Bs(c);return n.setMonth(t,Math.min(a,o)),n}function Zs(e,t,s){const n=A(e,s?.in);return isNaN(+n)?te(e,NaN):(n.setFullYear(t),n)}function Us(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(Cs,{className:"size-5"})})})})}function Ks({transactionId:e}){const{updateTransaction:t}=qe();function s(){t({transactionId:e,fields:{chargeId:yn}})}return i.jsx(mn,{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 Ls=({transactionID:e,onDone:t,onChange:s})=>{const[{data:n,fetching:r}]=mt({query:pn,variables:{transactionIDs:[e]}}),a=n?.transactionsByIDs?.[0],c=gt({defaultValues:a??{}});C.useEffect(()=>{a&&c.reset(a)},[a,c]);const{control:o,handleSubmit:l,formState:{dirtyFields:d}}=c,{updateTransaction:f,fetching:u}=qe(),h=v=>{if(!a)return;const y=Cn(v,d);t?.(),y&&Object.keys(y).length>0&&f({transactionId:a.id,fields:y}).then(s)},{selectableFinancialEntities:g,fetching:S}=yt();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(vn,{cols:3,children:[i.jsx(se,{name:"counterpartyId",control:o,defaultValue:a.counterparty?.id,rules:{minLength:{value:2,message:"Minimum 2 characters"}},render:({field:v})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Counterparty"}),i.jsxs(bn,{onValueChange:v.onChange,value:v.value??void 0,disabled:S,children:[i.jsx(he,{children:i.jsx(Dn,{className:"w-full truncate",children:i.jsx(kn,{placeholder:"Scroll to see all options"})})}),i.jsx(Mn,{onClick:y=>y.stopPropagation(),children:g.map(({value:y,label:k})=>i.jsx(wn,{value:y,children:k},y))})]}),i.jsx(ie,{})]})}),a?.account.__typename==="CardFinancialAccount"?i.jsx(se,{name:"effectiveDate",control:o,rules:{pattern:{value:xt,message:"Date must be im format yyyy-mm-dd"}},render:({field:v})=>i.jsxs(re,{children:[i.jsx(oe,{children:"Effective Date"}),i.jsx(he,{children:i.jsx(Ro,{...v,onChange:y=>{const k=y?le(y,"yyyy-MM-dd"):void 0;k!==v.value&&v.onChange(k)},value:v.value?new Date(v.value):void 0})}),i.jsx(ie,{})]})}):i.jsx(i.Fragment,{}),i.jsx(se,{name:"isFee",control:o,defaultValue:a.isFee,render:({field:v})=>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:v.value===!0,onCheckedChange:v.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"})]})]})})]})},Gs="insertMiscExpense",Vs=()=>{const[{fetching:e},t]=On(Nn),s=C.useCallback(async n=>{const r="Error creating misc expense",a=`${Gs}-${n.chargeId}`;Te.loading("Creating misc expense",{id:a});try{const c=await t(n),o=jn(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}},Js=({onDone:e,defaultValues:t={},chargeId:s})=>{const{insertMiscExpense:n,fetching:r}=Vs(),a=C.useCallback(async c=>{await n({chargeId:s,fields:c}),e()},[n,s,e]);return i.jsx(Xs,{defaultValues:t,onInsertDone:a,fetching:r})},Xs=({onInsertDone:e,defaultValues:t,fetching:s})=>{const n=o=>{o&&Object.keys(o).length>0&&e(o)},r=gt({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(Tn,{className:"h-10 w-10 animate-spin mr-2 self-center"})})})}),i.jsx(Qs,{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"})})]})})})},Qs=({formManager:e,isInsert:t})=>{const{control:s,setValue:n}=e,{selectableFinancialEntities:r,fetching:a}=yt();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(Je,{...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(Je,{...c,data:r,value:c.value??void 0,disabled:a,placeholder:"Select debtor",formPart:!0}),i.jsx(ie,{})]})}),i.jsx(Xe,{name:"amount",control:s,rules:{required:t?"Required":void 0},render:({field:c,fieldState:o})=>i.jsx(Xe,{name:"currency",control:s,rules:{required:t?"Required":void 0},render:({field:l,fieldState:d})=>i.jsx(Wn,{...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:xt,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(En,{...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(_n,{...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(vt,{...c,required:t,value:c.value??void 0})}),i.jsx(ie,{})]})})]})};function er(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 tr={},me={};function ce(e,t){try{const n=(tr[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return n in me?me[n]:nt(n,n.split(":"))}catch{if(e in me)return me[e];const s=e?.match(nr);return s?nt(e,s.slice(1)):NaN}}const nr=/([+-]\d\d):?(\d\d)?/;function nt(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 st=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!st.test(e))return;const t=e.replace(st,"$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),sr(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 sr(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),g=h>0?Math.floor(h):Math.ceil(h),v=-new Date(+e).getTimezoneOffset()-g,y=g!==s,k=v-l;if(y&&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=g-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} (${er(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 rt=5,rr=4;function or(e,t){const s=t.startOfMonth(e),n=s.getDay()>0?s.getDay():7,r=t.addDays(e,-n+1),a=t.addDays(r,rt*7-1);return t.getMonth(e)===t.getMonth(a)?rt:rr}function St(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 ar(e,t){const s=St(e,t),n=or(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):In(n,r),this.addWeeks=(n,r)=>this.overrides?.addWeeks?this.overrides.addWeeks(n,r):Os(n,r),this.addYears=(n,r)=>this.overrides?.addYears?this.overrides.addYears(n,r):Fn(n,r),this.differenceInCalendarDays=(n,r)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,r):Yn(n,r),this.differenceInCalendarMonths=(n,r)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,r):Ws(n,r),this.eachMonthOfInterval=n=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):_s(n),this.eachYearOfInterval=n=>{const r=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(n):Fs(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):ar(n,this),this.endOfISOWeek=n=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(n):Ys(n),this.endOfMonth=n=>this.overrides?.endOfMonth?this.overrides.endOfMonth(n):Es(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):Bn(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):Pn(n),this.getMonth=(n,r)=>this.overrides?.getMonth?this.overrides.getMonth(n,this.options):Ps(n,this.options),this.getYear=(n,r)=>this.overrides?.getYear?this.overrides.getYear(n,this.options):Rs(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):As(n,r),this.isBefore=(n,r)=>this.overrides?.isBefore?this.overrides.isBefore(n,r):zs(n,r),this.isDate=n=>this.overrides?.isDate?this.overrides.isDate(n):An(n),this.isSameDay=(n,r)=>this.overrides?.isSameDay?this.overrides.isSameDay(n,r):Ts(n,r),this.isSameMonth=(n,r)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(n,r):qs(n,r),this.isSameYear=(n,r)=>this.overrides?.isSameYear?this.overrides.isSameYear(n,r):Hs(n,r),this.max=n=>this.overrides?.max?this.overrides.max(n):Ns(n),this.min=n=>this.overrides?.min?this.overrides.min(n):js(n),this.setMonth=(n,r)=>this.overrides?.setMonth?this.overrides.setMonth(n,r):$s(n,r),this.setYear=(n,r)=>this.overrides?.setYear?this.overrides.setYear(n,r):Zs(n,r),this.startOfBroadcastWeek=(n,r)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):St(n,this),this.startOfDay=n=>this.overrides?.startOfDay?this.overrides.startOfDay(n):Ae(n),this.startOfISOWeek=n=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(n):zn(n),this.startOfMonth=n=>this.overrides?.startOfMonth?this.overrides.startOfMonth(n):Is(n),this.startOfWeek=(n,r)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(n,this.options):qn(n,this.options),this.startOfYear=n=>this.overrides?.startOfYear?this.overrides.startOfYear(n):Hn(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 J=new $;class Ct{constructor(t,s,n=J){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 ir{constructor(t,s){this.date=t,this.weeks=s}}class cr{constructor(t,s){this.days=s,this.weekNumber=t}}function lr(e){return m.createElement("button",{...e})}function dr(e){return m.createElement("span",{...e})}function ur(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 fr(e){const{day:t,modifiers:s,...n}=e;return m.createElement("td",{...n})}function hr(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 mr(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 gr(e){return m.createElement("div",{...e})}function yr(e){return m.createElement("div",{...e})}function pr(e){const{calendarMonth:t,displayIndex:s,...n}=e;return m.createElement("div",{...n},e.children)}function xr(e){const{calendarMonth:t,displayIndex:s,...n}=e;return m.createElement("div",{...n})}function vr(e){return m.createElement("table",{...e})}function br(e){return m.createElement("div",{...e})}const Ot=C.createContext(void 0);function ye(){const e=C.useContext(Ot);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Dr(e){const{components:t}=ye();return m.createElement(t.Dropdown,{...e})}function kr(e){const{onPreviousClick:t,onNextClick:s,previousMonth:n,nextMonth:r,...a}=e,{components:c,classNames:o,labels:{labelPrevious:l,labelNext:d}}=ye(),f=C.useCallback(h=>{r&&s?.(h)},[r,s]),u=C.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 Mr(e){const{components:t}=ye();return m.createElement(t.Button,{...e})}function wr(e){return m.createElement("option",{...e})}function Sr(e){const{components:t}=ye();return m.createElement(t.Button,{...e})}function Cr(e){const{rootRef:t,...s}=e;return m.createElement("div",{...s,ref:t})}function Or(e){return m.createElement("select",{...e})}function Nr(e){const{week:t,...s}=e;return m.createElement("tr",{...s})}function jr(e){return m.createElement("th",{...e})}function Tr(e){return m.createElement("thead",{"aria-hidden":!0},m.createElement("tr",{...e}))}function Wr(e){const{week:t,...s}=e;return m.createElement("th",{...s})}function Er(e){return m.createElement("th",{...e})}function _r(e){return m.createElement("tbody",{...e})}function Ir(e){const{components:t}=ye();return m.createElement(t.Dropdown,{...e})}const Fr=Object.freeze(Object.defineProperty({__proto__:null,Button:lr,CaptionLabel:dr,Chevron:ur,Day:fr,DayButton:hr,Dropdown:mr,DropdownNav:gr,Footer:yr,Month:pr,MonthCaption:xr,MonthGrid:vr,Months:br,MonthsDropdown:Dr,Nav:kr,NextMonthButton:Mr,Option:wr,PreviousMonthButton:Sr,Root:Cr,Select:Or,Week:Nr,WeekNumber:Wr,WeekNumberHeader:Er,Weekday:jr,Weekdays:Tr,Weeks:_r,YearsDropdown:Ir},Symbol.toStringTag,{value:"Module"}));function Q(e,t,s=!1,n=J){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=J){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 Q(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 Yr(e,t,s,n,r){const{disabled:a,hidden:c,modifiers:o,showOutsideDays:l,broadcastCalendar:d,today:f}=t,{isSameDay:u,isSameMonth:h,startOfMonth:g,isBefore:S,endOfMonth:v,isAfter:y}=r,k=s&&g(s),T=n&&v(n),b={[F.focused]:[],[F.outside]:[],[F.disabled]:[],[F.hidden]:[],[F.today]:[]},j={};for(const x of e){const{date:D,displayMonth:M}=x,N=!!(M&&!h(D,M)),Y=!!(k&&S(D,k)),P=!!(T&&y(D,T)),R=!!(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(x),R&&b.disabled.push(x),Z&&b.hidden.push(x),de&&b.today.push(x),o&&Object.keys(o).forEach(ue=>{const fe=o?.[ue];fe&&ee(D,fe,r)&&(j[ue]?j[ue].push(x):j[ue]=[x])})}return x=>{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===x)}for(const N in j)M[N]=j[N].some(Y=>Y===x);return{...D,...M}}}function Br(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 Pr(e){return{...Fr,...e}}function Rr(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 Ar=_t;function zr(e,t,s){return(s??new $(t)).format(e,"d")}function qr(e,t=J){return t.format(e,"LLLL")}function Hr(e,t,s){return(s??new $(t)).format(e,"cccccc")}function $r(e,t=J){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function Zr(){return""}function It(e,t=J){return t.format(e,"yyyy")}const Ur=It,Kr=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:_t,formatDay:zr,formatMonthCaption:Ar,formatMonthDropdown:qr,formatWeekNumber:$r,formatWeekNumberHeader:Zr,formatWeekdayName:Hr,formatYearCaption:Ur,formatYearDropdown:It},Symbol.toStringTag,{value:"Module"}));function Lr(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...Kr,...e}}function Gr(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 g=n.formatMonthDropdown(h,r),S=d(h),v=t&&h<a(t)||s&&h>a(s)||!1;return{value:S,label:g,disabled:v}})}function Vr(e,t={},s={}){let n={...t?.[p.Day]};return Object.entries(e).filter(([,r])=>r===!0).forEach(([r])=>{n={...n,...s?.[r]}}),n}function Jr(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 Xr(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 g=s.formatYearDropdown(h,n);return{value:l(h),label:g,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 Qr=Ft;function Yt(e,t,s){return(s??new $(t)).formatMonthYear(e)}const eo=Yt;function to(e,t,s,n){let r=(n??new $(s)).format(e,"PPPP");return t?.today&&(r=`Today, ${r}`),r}function no(e){return"Choose the Month"}function so(){return""}function ro(e){return"Go to the Next Month"}function oo(e){return"Go to the Previous Month"}function ao(e,t,s){return(s??new $(t)).format(e,"cccc")}function io(e,t){return`Week ${e}`}function co(e){return"Week Number"}function lo(e){return"Choose the Year"}const uo=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:eo,labelDay:Qr,labelDayButton:Ft,labelGrid:Yt,labelGridcell:to,labelMonthDropdown:no,labelNav:so,labelNext:ro,labelPrevious:oo,labelWeekNumber:io,labelWeekNumberHeader:co,labelWeekday:ao,labelYearDropdown:lo},Symbol.toStringTag,{value:"Module"})),pe=e=>e instanceof HTMLElement?e:null,Ee=e=>[...e.querySelectorAll("[data-animated-month]")??[]],fo=e=>pe(e.querySelector("[data-animated-month]")),_e=e=>pe(e.querySelector("[data-animated-caption]")),Ie=e=>pe(e.querySelector("[data-animated-weeks]")),ho=e=>pe(e.querySelector("[data-animated-nav]")),mo=e=>pe(e.querySelector("[data-animated-weekdays]"));function go(e,t,{classNames:s,months:n,focused:r,dateLib:a}){const c=C.useRef(null),o=C.useRef(n),l=C.useRef(!1);C.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],g=u?s[q.weeks_after_enter]:s[q.weeks_before_enter],S=c.current,v=e.current.cloneNode(!0);if(v instanceof HTMLElement?(Ee(v).forEach(b=>{if(!(b instanceof HTMLElement))return;const j=fo(b);j&&b.contains(j)&&b.removeChild(j);const x=_e(b);x&&x.classList.remove(h);const D=Ie(b);D&&D.classList.remove(g)}),c.current=v):c.current=null,l.current||f||r)return;const y=S instanceof HTMLElement?Ee(S):[],k=Ee(e.current);if(k?.every(T=>T instanceof HTMLElement)&&y&&y.every(T=>T instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const T=ho(e.current);T&&(T.style.zIndex="1"),k.forEach((b,j)=>{const x=y[j];if(!x)return;b.style.position="relative",b.style.overflow="hidden";const D=_e(b);D&&D.classList.add(h);const M=Ie(b);M&&M.classList.add(g);const N=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),T&&(T.style.zIndex=""),D&&D.classList.remove(h),M&&M.classList.remove(g),b.style.position="",b.style.overflow="",b.contains(x)&&b.removeChild(x)};x.style.pointerEvents="none",x.style.position="absolute",x.style.overflow="hidden",x.setAttribute("aria-hidden","true");const Y=mo(x);Y&&(Y.style.opacity="0");const P=_e(x);P&&(P.classList.add(u?s[q.caption_before_exit]:s[q.caption_after_exit]),P.addEventListener("animationend",N));const R=Ie(x);R&&R.classList.add(u?s[q.weeks_before_exit]:s[q.weeks_after_exit]),b.insertBefore(x,b.firstChild)})}})}function yo(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:g,endOfMonth:S,endOfWeek:v,isAfter:y,startOfBroadcastWeek:k,startOfISOWeek:T,startOfWeek:b}=n,j=l?k(r,n):c?T(r):b(r),x=l?h(a):c?g(S(a)):v(S(a)),D=f(x,j),M=u(a,r)+1,N=[];for(let R=0;R<=D;R++){const Z=d(j,R);if(t&&y(Z,t))break;N.push(Z)}const P=(l?35:42)*M;if(o&&N.length<P){const R=P-N.length;for(let Z=0;Z<R;Z++){const de=d(N[N.length-1],1);N.push(de)}}return N}function po(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 xo(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 ot(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 vo(e,t,s,n){const{addDays:r,endOfBroadcastWeek:a,endOfISOWeek:c,endOfMonth:o,endOfWeek:l,getISOWeek:d,getWeek:f,startOfBroadcastWeek:u,startOfISOWeek:h,startOfWeek:g}=n,S=e.reduce((v,y)=>{const k=s.broadcastCalendar?u(y,n):s.ISOWeek?h(y):g(y),T=s.broadcastCalendar?a(y):s.ISOWeek?c(o(y)):l(o(y)),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 x=b.reduce((M,N)=>{const Y=s.ISOWeek?d(N):f(N),P=M.find(Z=>Z.weekNumber===Y),R=new Ct(N,y,n);return P?P.days.push(R):M.push(new cr(Y,[R])),M},[]),D=new ir(y,x);return v.push(D),v},[]);return s.reverseMonths?S.reverse():S}function bo(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:g,fromMonth:S,toMonth:v}=e;!s&&S&&(s=S),!s&&h&&(s=t.newDate(h,0,1)),!n&&v&&(n=v),!n&&g&&(n=f(g,11,31));const y=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return s?s=c(s):h?s=f(h,0,1):!s&&y&&(s=r(l(e.today??u(),-100))),n?n=o(n):g?n=f(g,11,31):!n&&y&&(n=d(e.today??u())),[s&&a(s),n&&a(n)]}function Do(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 ko(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 Mo(e){const t=[];return e.reduce((s,n)=>s.concat(n.weeks.slice()),t.slice())}function De(e,t){const[s,n]=C.useState(e);return[t===void 0?s:t,n]}function wo(e,t){const[s,n]=bo(e,t),{startOfMonth:r,endOfMonth:a}=t,c=ot(e,s,n,t),[o,l]=De(c,e.month?c:void 0);C.useEffect(()=>{const D=ot(e,s,n,t);l(D)},[e.timeZone]);const d=xo(o,n,e,t),f=yo(d,e.endMonth?a(e.endMonth):void 0,e,t),u=vo(d,f,e,t),h=Mo(u),g=po(u),S=ko(o,s,e,t),v=Do(o,n,e,t),{disableNavigation:y,onMonthChange:k}=e,T=D=>h.some(M=>M.days.some(N=>N.isEqualTo(D))),b=D=>{if(y)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:g,navStart:s,navEnd:n,previousMonth:S,nextMonth:v,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 at(e){return!e[F.disabled]&&!e[F.hidden]&&!e[F.outside]}function So(e,t,s,n){let r,a=-1;for(const c of e){const o=t(c);at(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=>at(t(c)))),r}function Co(e,t,s,n,r,a,c){const{ISOWeek:o,broadcastCalendar:l}=a,{addDays:d,addMonths:f,addWeeks:u,addYears:h,endOfBroadcastWeek:g,endOfISOWeek:S,endOfWeek:v,max:y,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?g(M):o?S(M):v(M)}[e](s,t==="after"?1:-1);return t==="before"&&n?D=y([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=Co(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 Ct(l,u,c);return!d&&!f?h:Bt(e,t,h,n,r,a,c,o+1)}function Oo(e,t,s,n,r){const{autoFocus:a}=e,[c,o]=C.useState(),l=So(t.days,s,n||(()=>!1),c),[d,f]=C.useState(a?l:void 0);return{isFocusTarget:v=>!!l?.isEqualTo(v),setFocused:f,focused:d,blur:()=>{o(d),f(void 0)},moveFocus:(v,y)=>{if(!d)return;const k=Bt(v,y,d,t.navStart,t.navEnd,e,r);k&&(e.disableNavigation&&!t.days.some(b=>b.isEqualTo(k))||(t.goToDay(k),f(k)))}}}function No(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=g=>o?.some(S=>l(S,g))??!1,{min:f,max:u}=e;return{selected:o,select:(g,S,v)=>{let y=[...o??[]];if(d(g)){if(o?.length===f||n&&o?.length===1)return;y=o?.filter(k=>!l(k,g))}else o?.length===u?y=[g]:y=[...y,g];return r||c(y),r?.(y,g,S,v),y},isSelected:d}}function jo(e,t,s=0,n=0,r=!1,a=J){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 To(e,t,s=J){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 it(e,t,s=J){return Q(e,t.from,!1,s)||Q(e,t.to,!1,s)||Q(t,e.from,!1,s)||Q(t,e.to,!1,s)}function Wo(e,t,s=J){const n=Array.isArray(t)?t:[t];if(n.filter(o=>typeof o!="function").some(o=>typeof o=="boolean"?o:s.isDate(o)?Q(e,o,!1,s):Et(o,s)?o.some(l=>Q(e,l,!1,s)):He(o)?o.from&&o.to?it(e,{from:o.from,to:o.to},s):!1:Wt(o)?To(e,o.dayOfWeek,s):Nt(o)?s.isAfter(o.before,o.after)?it(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 Eo(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,g,S)=>{const{min:v,max:y}=e,k=h?jo(h,d,v,y,a,t):void 0;return n&&s&&k?.from&&k.to&&Wo({from:k.from,to:k.to},s,t)&&(k.from=h,k.to=void 0),c||l(k),c?.(k,h,g,S),k},isSelected:h=>d&&Q(d,h,!1,t)}}function _o(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,g)=>{let S=u;return!n&&o&&o&&l(u,o)&&(S=void 0),r||c(S),r?.(S,u,h,g),S},isSelected:u=>o?l(o,u):!1}}function Io(e,t){const s=_o(e,t),n=No(e,t),r=Eo(e,t);switch(e.mode){case"single":return s;case"multiple":return n;case"range":return r;default:return}}function Fo(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}=C.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:Pr(t.components),formatters:Lr(t.formatters),labels:{...uo,...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:g,onDayFocus:S,onDayKeyDown:v,onDayMouseEnter:y,onDayMouseLeave:k,onNextClick:T,onPrevClick:b,showWeekNumber:j,styles:x}=t,{formatCaption:D,formatDay:M,formatMonthDropdown:N,formatWeekNumber:Y,formatWeekNumberHeader:P,formatWeekdayName:R,formatYearDropdown:Z}=n,de=wo(t,a),{days:ue,months:fe,navStart:xe,navEnd:ke,previousMonth:U,nextMonth:K,goToMonth:X}=de,Me=Yr(ue,t,xe,ke,a),{isSelected:we,select:Se,selected:ve}=Io(t,a)??{},{blur:Ze,focused:Ue,isFocusTarget:Pt,moveFocus:Ke,setFocused:be}=Oo(t,de,Me,we??(()=>!1),a),{labelDayButton:Rt,labelGridcell:At,labelGrid:zt,labelMonthDropdown:qt,labelNav:Le,labelPrevious:Ht,labelNext:$t,labelWeekday:Zt,labelWeekNumber:Ut,labelWeekNumberHeader:Kt,labelYearDropdown:Lt}=r,Gt=C.useMemo(()=>Jr(a,t.ISOWeek),[a,t.ISOWeek]),Ge=d!==void 0||g!==void 0,Ce=C.useCallback(()=>{U&&(X(U),b?.(U))},[U,X,b]),Oe=C.useCallback(()=>{K&&(X(K),T?.(K))},[X,K,T]),Vt=C.useCallback((O,I)=>w=>{w.preventDefault(),w.stopPropagation(),be(O),Se?.(O.date,I,w),g?.(O.date,I,w)},[Se,g,be]),Jt=C.useCallback((O,I)=>w=>{be(O),S?.(O.date,I,w)},[S,be]),Xt=C.useCallback((O,I)=>w=>{Ze(),h?.(O.date,I,w)},[Ze,h]),Qt=C.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)}v?.(O.date,I,w)},[Ke,v,t.dir]),en=C.useCallback((O,I)=>w=>{y?.(O.date,I,w)},[y]),tn=C.useCallback((O,I)=>w=>{k?.(O.date,I,w)},[k]),nn=C.useCallback(O=>I=>{const w=Number(I.target.value),_=a.setMonth(a.startOfMonth(O),w);X(_)},[a,X]),sn=C.useCallback(O=>I=>{const w=Number(I.target.value),_=a.setYear(a.startOfMonth(O),w);X(_)},[a,X]),{className:rn,style:on}=C.useMemo(()=>({className:[o[p.Root],t.className].filter(Boolean).join(" "),style:{...x?.[p.Root],...t.style}}),[o,t.className,t.style,x]),an=Rr(t),Ve=C.useRef(null);go(Ve,!!t.animate,{classNames:o,months:fe,focused:Ue,dateLib:a});const cn={dayPickerProps:t,selected:ve,select:Se,isSelected:we,months:fe,nextMonth:K,previousMonth:U,goToMonth:X,getModifiers:Me,components:s,classNames:o,styles:x,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:x?.[p.Months]},!t.hideNavigation&&!f&&m.createElement(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:o[p.Nav],style:x?.[p.Nav],"aria-label":Le(),onPreviousClick:Ce,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:x?.[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:Ce,"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:x?.[p.MonthCaption],calendarMonth:O,displayIndex:I},l?.startsWith("dropdown")?m.createElement(s.DropdownNav,{className:o[p.Dropdowns],style:x?.[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:Gr(O.date,xe,ke,n,a),style:x?.[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:Xr(xe,ke,n,a,!!t.reverseYears),style:x?.[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:x?.[p.Nav],"aria-label":Le(),onPreviousClick:Ce,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:x?.[p.MonthGrid]},!t.hideWeekdays&&m.createElement(s.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:o[p.Weekdays],style:x?.[p.Weekdays]},j&&m.createElement(s.WeekNumberHeader,{"aria-label":Kt(a.options),className:o[p.WeekNumberHeader],style:x?.[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:x?.[p.Weekday],scope:"col"},R(w,a.options,a)))),m.createElement(s.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:o[p.Weeks],style:x?.[p.Weeks]},O.weeks.map(w=>m.createElement(s.Week,{className:o[p.Week],key:w.weekNumber,style:x?.[p.Week],week:w},j&&m.createElement(s.WeekNumber,{week:w,style:x?.[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(ve)){const{from:Ne,to:je}=ve;W[L.range_start]=!!(Ne&&je&&a.isSameDay(z,Ne)),W[L.range_end]=!!(Ne&&je&&a.isSameDay(z,je)),W[L.range_middle]=Q(ve,z,!0,a)}const ln=Vr(W,x,t.modifiersStyles),dn=Br(W,o,t.modifiersClassNames),un=!Ge&&!W.hidden?At(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:x?.[p.DayButton],type:"button",day:_,modifiers:W,disabled:W.disabled||void 0,tabIndex:Pt(_)?0:-1,"aria-label":Rt(z,W,a.options,a),onClick:Vt(_,W),onBlur:Xt(_,W),onFocus:Jt(_,W),onKeyDown:Qt(_,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:x?.[p.Footer],role:"status","aria-live":"polite"},t.footer)))}function Yo({className:e,classNames:t,showOutsideDays:s=!0,captionLayout:n="label",buttonVariant:r="ghost",formatters:a,components:c,...o}){const l=$e();return i.jsx(Fo,{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(Qe({variant:r}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",l.button_previous),button_next:E(Qe({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($n,{className:E("size-4",d),...u}):f==="right"?i.jsx(Zn,{className:E("size-4",d),...u}):i.jsx(ne,{className:E("size-4",d),...u}),DayButton:Bo,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 Bo({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 Fe(e){return e?le(e,"yyyy-MM-dd"):""}function Po(e){return e?!Number.isNaN(e.getTime()):!1}function Ro({value:e,onChange:t,disabled:s,...n}){const[r,a]=m.useState(!1),[c,o]=m.useState(e),[l,d]=m.useState(Fe(e));return C.useEffect(()=>{e&&d(Fe(e))},[e]),i.jsxs("div",{className:"relative flex gap-2",children:[i.jsx(vt,{...n,disabled:s,value:l,onChange:f=>{d(f.target.value);const u=f.target.value?new Date(f.target.value):void 0;Po(u)&&(t?.(u),o(u))},onKeyDown:f=>{f.key==="ArrowDown"&&(f.preventDefault(),a(!0))}}),i.jsxs(Un,{open:r,onOpenChange:a,children:[i.jsx(Kn,{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(Ln,{className:"size-3.5"}),i.jsx("span",{className:"sr-only",children:"Select date"})]})}),i.jsx(Gn,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:i.jsx(Yo,{mode:"single",selected:e,captionLayout:"dropdown",month:c,onMonthChange:o,onSelect:f=>{t?.(f),d(Fe(f??void 0)),a(!1)}})})]})]})}var Ye={exports:{}},Be,ct;function Ao(){if(ct)return Be;ct=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Be=e,Be}var Pe,lt;function zo(){if(lt)return Pe;lt=1;var e=Ao();function t(){}function s(){}return s.resetWarningCache=t,Pe=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},Pe}var dt;function qo(){return dt||(dt=1,Ye.exports=zo()()),Ye.exports}var Ho=qo();const oa=Vn(Ho),$o=({close:e,transactionID:t,onChange:s})=>t?i.jsx(Jn,{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(Xn,{content:t}),i.jsx(Ks,{transactionId:t})]})]}),opened:!!t,onClose:e,children:i.jsx(Ls,{transactionID:t,onDone:e,onChange:s})}):null,Zo=({onDone:e,transactionId:t,chargeId:s})=>{const[n,r]=C.useState(!1),[{data:a,fetching:c}]=mt({query:Qn,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(Ms,{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(Js,{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}})]})]})},Uo=({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"),")"]})]})},Ko=({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")})},Lo=({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]})]})},Go=({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})]})},Vo=({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})})},Jo=({transaction:e})=>i.jsx("div",{className:"flex flex-wrap",children:i.jsx("div",{className:"flex flex-col justify-center",children:e.referenceKey})});function Xo({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,g]=C.useState(!1),{updateTransaction:S,fetching:v}=qe(),y=C.useCallback(async N=>{await S({transactionId:a,fields:{counterpartyId:N}}),g(!0)},[a,S]),k=C.useCallback(async N=>{await y(N),t?.()},[y,t]),{selectableBusinesses:T,fetching:b}=as(),[j,x]=C.useState(f??null),[D,M]=C.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:x,search:D,onSearchChange:M,placeholder:"Choose or create a business",empty:D?i.jsx(cs,{description:D,onAdd:k}):null}),i.jsx(ws,{content:"Approve",children:i.jsx(H,{variant:"outline",size:"icon",onClick:()=>j&&y(j),disabled:v||b||!j,children:i.jsx(ls,{className:"size-4"})})})]})}),i.jsx(ks,{transactionId:s,counterpartyId:n?.id??j,open:h,onOpenChange:g,onClose:t})]})}const Re=[{accessorKey:"counterparty.name",header:({column:e})=>i.jsxs(H,{variant:"ghost",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Xo,{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",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Ko,{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",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Uo,{transaction:e.original})},{accessorKey:"amount.raw",header:({column:e})=>i.jsxs(H,{variant:"ghost",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Lo,{transaction:e.original})},{accessorKey:"account.name",header:({column:e})=>i.jsxs(H,{variant:"ghost",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Go,{transaction:e.original})},{accessorKey:"sourceDescription",header:({column:e})=>i.jsxs(H,{variant:"ghost",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Vo,{transaction:e.original})},{accessorKey:"referenceKey",header:({column:e})=>i.jsxs(H,{variant:"ghost",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),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(Jo,{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(e.original.id)}),i.jsx(Zo,{chargeId:e.original.chargeId,transactionId:e.original.id,onDone:e.original.onUpdate})]}):e.original.enableChargeLink?i.jsx(Us,{chargeId:e.original.chargeId}):null},aa=({transactionsProps:e,onChange:t,enableEdit:s,enableChargeLink:n})=>{const[r,a]=C.useState(void 0),[c,o]=C.useState([]),l=C.useMemo(()=>(console.log("rendering Transactions"),e.map(h=>us(fs,h))),[e]),d=C.useMemo(()=>l.map(h=>({...h,editTransaction:a,onUpdate:t||(()=>{}),enableEdit:s,enableChargeLink:n})),[l,s,n,t]),f=C.useMemo(()=>s||n?[...Re,Qo]:Re,[s,n]),u=hs({data:d,columns:f,getCoreRowModel:ys(),onSortingChange:o,getSortedRowModel:gs(),getPaginationRowModel:ms(),state:{sorting:c},initialState:{pagination:{pageIndex:0,pageSize:100},sorting:[{id:"eventDate",desc:!0}]}});return i.jsxs(i.Fragment,{children:[i.jsxs(ps,{children:[i.jsx(xs,{children:u.getHeaderGroups().map(h=>i.jsx(We,{children:h.headers.map(g=>i.jsx(vs,{colSpan:g.colSpan,children:g.isPlaceholder?null:et(g.column.columnDef.header,g.getContext())},g.id))},h.id))}),i.jsx(bs,{children:u.getRowModel().rows?.length?u.getRowModel().rows.map(h=>i.jsx(We,{children:h.getVisibleCells().map(g=>i.jsx(tt,{children:et(g.column.columnDef.cell,g.getContext())},g.id))},h.id)):i.jsx(We,{children:i.jsx(tt,{colSpan:Re.length,className:"h-24 text-center",children:"No results."})})})]}),u.getPageCount()>1&&i.jsx("div",{className:"flex items-center justify-end space-x-2 py-4",children:i.jsx(Ds,{value:u.getState().pagination.pageIndex,total:u.getPageCount(),onChange:h=>u.setPageIndex(h)})}),i.jsx($o,{transactionID:r,close:()=>a(void 0),onChange:t??(()=>{})})]})};export{Lo as A,Xo as C,Uo as D,Cs as E,Js as I,Qs as M,oa as P,Jo as S,aa as T,Ko as a,Go as b,Vo as c,Us as d};
|