@accounter/client 0.0.8-alpha-20251023070808-bdd9d09db3d693f2c0061a2bbd66a4bfe5224012 → 0.0.8-alpha-20251023071148-6bed0891f04559f888e1e0d8bb275809dc36bf3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/assets/{Checkbox-Bm30-WRa.js → Checkbox-lfqFDKZM.js} +2 -2
- package/dist/assets/{Progress-DxcT-wYo.js → Progress-DvGsu87E.js} +1 -1
- package/dist/assets/{Typography-CZLHs9y2.js → Typography-BX4mj53o.js} +1 -1
- package/dist/assets/{accordion-_VaDHoQb.js → accordion-lOk81yKP.js} +1 -1
- package/dist/assets/accountant-approvals-DWLEu1Um.js +1 -0
- package/dist/assets/{all-charges-DS-mdep6.js → all-charges-DhPxcK73.js} +1 -1
- package/dist/assets/{arrow-up-down-Bt3_puEZ.js → arrow-up-down-CFrneqND.js} +1 -1
- package/dist/assets/building-2-Bqvbwz7Q.js +6 -0
- package/dist/assets/business--eNnF4xF.js +42 -0
- package/dist/assets/business-header-DjutqTRC.js +1 -0
- package/dist/assets/{business-transactions-single-Canul8rR.js → business-transactions-single-CJ5pLN-D.js} +1 -1
- package/dist/assets/{business-trip-x8lljSMP.js → business-trip-Jlc0bfXC.js} +1 -1
- package/dist/assets/charges-filters-C-H07qp1.js +1 -0
- package/dist/assets/{charges-ledger-validation-wla_aWIc.js → charges-ledger-validation-Bln73m_U.js} +1 -1
- package/dist/assets/{chart-2uS7cQLX.js → chart-Wut6cPCx.js} +1 -1
- package/dist/assets/{data-table-pagination-CQQBbtVE.js → data-table-pagination-BnQGVnmE.js} +1 -1
- package/dist/assets/{editable-business-trip-D50scoPo.js → editable-business-trip-CjJg13b0.js} +2 -2
- package/dist/assets/index-BE5nnZYY.js +9 -0
- package/dist/assets/index-BQrSA2Kk.js +1 -0
- package/dist/assets/{index-CDHKPA0l.js → index-BX3VSsge.js} +1 -1
- package/dist/assets/{index-D_PykgGt.js → index-BagyRbeI.js} +2 -2
- package/dist/assets/index-BkeJsHyM.js +1 -0
- package/dist/assets/{index-BJ63UrPP.js → index-BoSqeUi7.js} +6 -6
- package/dist/assets/index-BtAgm6J8.js +1 -0
- package/dist/assets/index-BwIQ8ifH.js +1 -0
- package/dist/assets/index-Bxlzprxi.js +1 -0
- package/dist/assets/index-C--YkrHw.js +1 -0
- package/dist/assets/{index-BNPAKzBY.js → index-C2INIVq3.js} +1 -1
- package/dist/assets/{index-BsGG-RLV.js → index-CN7VPpiB.js} +13 -13
- package/dist/assets/index-CQXFj3Uj.css +1 -0
- package/dist/assets/{index-IN8Kpfsx.js → index-CVz9TqoS.js} +2 -2
- package/dist/assets/index-CalcGztb.js +1 -0
- package/dist/assets/{index-BTiGhl3N.js → index-Csqyxwgx.js} +2 -2
- package/dist/assets/{index-Dkqd5T8J.js → index-DjSJrgv5.js} +2 -2
- package/dist/assets/{index-CqZy7PVr.js → index-DquDHLbE.js} +1 -1
- package/dist/assets/index-Dr2UkUOm.js +1 -0
- package/dist/assets/index-E2rO9Bsf.js +1 -0
- package/dist/assets/index-Ggixi4PP.js +1 -0
- package/dist/assets/index-WCosiqtQ.js +1 -0
- package/dist/assets/index-vsZbkVMv.js +1 -0
- package/dist/assets/{index-B20Tn_iF.js → index-y8Z-aJKc.js} +2 -2
- package/dist/assets/{index.es-DKjfxgqg.js → index.es-D8leRAY2.js} +1 -1
- package/dist/assets/{issue-document-BFOjGS-U.js → issue-document-DKE0dzdE.js} +1 -1
- package/dist/assets/login-page-BYwtRBMd.js +1 -0
- package/dist/assets/{missing-info-charges-BnYMeatL.js → missing-info-charges-CgMJ4Bu3.js} +1 -1
- package/dist/assets/page-not-found-Cfte6bjZ.js +1 -0
- package/dist/assets/{pencil-DC6M9VTY.js → pencil-CUSCcyVn.js} +1 -1
- package/dist/assets/report-commentary-row-B-uxVnyO.js +1 -0
- package/dist/assets/save-qyt28nOG.js +6 -0
- package/dist/assets/sub-LLu8afpC.js +1 -0
- package/dist/assets/subMonths-C1UIPrOU.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/src/components/business/business-header.tsx +21 -2
- package/src/components/businesses/index.tsx +45 -36
- package/src/components/common/forms/index.ts +0 -1
- package/src/gql/gql.ts +6 -30
- package/src/gql/graphql.ts +7 -30
- package/dist/assets/accountant-approvals-C7GnMLyl.js +0 -1
- package/dist/assets/business-Db4PzgLz.js +0 -42
- package/dist/assets/charges-filters-DkO9FBdC.js +0 -1
- package/dist/assets/index-BP2Hv2J-.js +0 -1
- package/dist/assets/index-BaDl3RPI.js +0 -1
- package/dist/assets/index-BmSAw35b.js +0 -1
- package/dist/assets/index-Bskia9ol.js +0 -1
- package/dist/assets/index-C4JVZBO-.js +0 -1
- package/dist/assets/index-CzzfC-dD.css +0 -1
- package/dist/assets/index-D2w9iaKk.js +0 -1
- package/dist/assets/index-D5CFY1GF.js +0 -1
- package/dist/assets/index-DBjj2AmF.js +0 -1
- package/dist/assets/index-DJ33tRZ1.js +0 -1
- package/dist/assets/index-DKS2QKOQ.js +0 -1
- package/dist/assets/index-DOKYSdGb.js +0 -1
- package/dist/assets/index-Dk4NeG4m.js +0 -1
- package/dist/assets/index-OqG78rNq.js +0 -9
- package/dist/assets/login-page-CpRailN7.js +0 -1
- package/dist/assets/page-not-found-BLrYvmf4.js +0 -1
- package/dist/assets/report-commentary-row-DJPRyQur.js +0 -1
- package/dist/assets/save-Dr3CNkcl.js +0 -11
- package/dist/assets/similar-charges-by-business-modal-CCw5opHn.js +0 -1
- package/dist/assets/sub-DKnwnbwx.js +0 -1
- package/dist/assets/subMonths-B44KizJf.js +0 -1
- package/src/components/businesses/all-businesses-row.tsx +0 -87
- package/src/components/businesses/cells/hebrew-name.tsx +0 -31
- package/src/components/businesses/cells/index.ts +0 -2
- package/src/components/businesses/cells/name.tsx +0 -31
- package/src/components/common/forms/business-card.tsx +0 -234
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d6 as so,d7 as Ds,d8 as Fs,d9 as zs,r as v,ak as Ie,da as $e,db as Ns,j as x,dc as or,dd as io,u as Bs,d0 as oo,d1 as ao,B as lo,d2 as co,k as uo,bR as In,bW as Br,de as Vr,Y as Le,bS as fo,b1 as En,d3 as ho,df as b,dg as Vs,D as po,dh as mo,F as go,a as xo,di as yo,c as vo,L as bo,dj as wo}from"./index-BsGG-RLV.js";import{u as Pt,g as De,a as Fe,c as je,s as W,_ as X,b as Ao,T as Mn}from"./Typography-CZLHs9y2.js";import{c as Ue,t as jn,a as Co,d as hn,b as Po,e as ko,f as So,g as Io,h as Hs,o as Hr,i as Eo,s as Mo,l as jo,u as Ro,j as Us,k as Oo,p as To,m as _o,n as $o,q as Lo,r as Do,v as Fo,w as zo}from"./sequential-CAnleQny.js";import{s as Gs}from"./sub-DKnwnbwx.js";import"./subMonths-B44KizJf.js";function No(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:so(t.components[n].defaultProps,r)}function Bo({props:e,name:t,defaultTheme:n,themeId:r}){let s=Ds(n);return s=s[r]||s,No({theme:s,name:t,props:e})}function Lt(){const e=Ds(Fs);return e[zs]||e}function ze({props:e,name:t}){return Bo({props:e,name:t,defaultTheme:Fs,themeId:zs})}function Un(e){return e&&e.ownerDocument||document}function Vo(e){return Un(e).defaultView||window}function Ur(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ho(e){const{controlled:t,default:n}=e,{current:r}=v.useRef(t!==void 0),[s,i]=v.useState(n),o=r?t:s,a=v.useCallback(c=>{r||i(c)},[]);return[o,a]}function Uo(e){return typeof e=="string"}function Go(e,t,n){return e===void 0||Uo(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Xo(e,t,n){return typeof e=="function"?e(t,n):e}function Wo(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function Gr(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function Yo(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:s,className:i}=e;if(!t){const h=Ie(n?.className,i,s?.className,r?.className),m={...n?.style,...s?.style,...r?.style},p={...n,...s,...r};return h.length>0&&(p.className=h),Object.keys(m).length>0&&(p.style=m),{props:p,internalRef:void 0}}const o=Wo({...s,...r}),a=Gr(r),c=Gr(s),l=t(o),u=Ie(l?.className,n?.className,i,s?.className,r?.className),d={...l?.style,...n?.style,...s?.style,...r?.style},f={...l,...n,...c,...a};return u.length>0&&(f.className=u),Object.keys(d).length>0&&(f.style=d),{props:f,internalRef:l.ref}}var re="top",fe="bottom",he="right",se="left",ar="auto",Dt=[re,fe,he,se],nt="start",kt="end",Ko="clippingParents",Xs="viewport",ht="popper",qo="reference",Xr=Dt.reduce(function(e,t){return e.concat([t+"-"+nt,t+"-"+kt])},[]),Ws=[].concat(Dt,[ar]).reduce(function(e,t){return e.concat([t,t+"-"+nt,t+"-"+kt])},[]),Qo="beforeRead",Zo="read",Jo="afterRead",ea="beforeMain",ta="main",na="afterMain",ra="beforeWrite",sa="write",ia="afterWrite",oa=[Qo,Zo,Jo,ea,ta,na,ra,sa,ia];function Ae(e){return e?(e.nodeName||"").toLowerCase():null}function ae(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ke(e){var t=ae(e).Element;return e instanceof t||e instanceof Element}function ue(e){var t=ae(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lr(e){if(typeof ShadowRoot>"u")return!1;var t=ae(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function aa(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},s=t.attributes[n]||{},i=t.elements[n];!ue(i)||!Ae(i)||(Object.assign(i.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?i.removeAttribute(o):i.setAttribute(o,a===!0?"":a)}))})}function la(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var s=t.elements[r],i=t.attributes[r]||{},o=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=o.reduce(function(c,l){return c[l]="",c},{});!ue(s)||!Ae(s)||(Object.assign(s.style,a),Object.keys(i).forEach(function(c){s.removeAttribute(c)}))})}}const ca={name:"applyStyles",enabled:!0,phase:"write",fn:aa,effect:la,requires:["computeStyles"]};function we(e){return e.split("-")[0]}var Ye=Math.max,sn=Math.min,rt=Math.round;function Gn(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ys(){return!/^((?!chrome|android).)*safari/i.test(Gn())}function st(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),s=1,i=1;t&&ue(e)&&(s=e.offsetWidth>0&&rt(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&rt(r.height)/e.offsetHeight||1);var o=Ke(e)?ae(e):window,a=o.visualViewport,c=!Ys()&&n,l=(r.left+(c&&a?a.offsetLeft:0))/s,u=(r.top+(c&&a?a.offsetTop:0))/i,d=r.width/s,f=r.height/i;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l,x:l,y:u}}function cr(e){var t=st(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Ks(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lr(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Me(e){return ae(e).getComputedStyle(e)}function ua(e){return["table","td","th"].indexOf(Ae(e))>=0}function Ne(e){return((Ke(e)?e.ownerDocument:e.document)||window.document).documentElement}function pn(e){return Ae(e)==="html"?e:e.assignedSlot||e.parentNode||(lr(e)?e.host:null)||Ne(e)}function Wr(e){return!ue(e)||Me(e).position==="fixed"?null:e.offsetParent}function da(e){var t=/firefox/i.test(Gn()),n=/Trident/i.test(Gn());if(n&&ue(e)){var r=Me(e);if(r.position==="fixed")return null}var s=pn(e);for(lr(s)&&(s=s.host);ue(s)&&["html","body"].indexOf(Ae(s))<0;){var i=Me(s);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return s;s=s.parentNode}return null}function Ft(e){for(var t=ae(e),n=Wr(e);n&&ua(n)&&Me(n).position==="static";)n=Wr(n);return n&&(Ae(n)==="html"||Ae(n)==="body"&&Me(n).position==="static")?t:n||da(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function yt(e,t,n){return Ye(e,sn(t,n))}function fa(e,t,n){var r=yt(e,t,n);return r>n?n:r}function qs(){return{top:0,right:0,bottom:0,left:0}}function Qs(e){return Object.assign({},qs(),e)}function Zs(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var ha=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Qs(typeof t!="number"?t:Zs(t,Dt))};function pa(e){var t,n=e.state,r=e.name,s=e.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,a=we(n.placement),c=ur(a),l=[se,he].indexOf(a)>=0,u=l?"height":"width";if(!(!i||!o)){var d=ha(s.padding,n),f=cr(i),h=c==="y"?re:se,m=c==="y"?fe:he,p=n.rects.reference[u]+n.rects.reference[c]-o[c]-n.rects.popper[u],g=o[c]-n.rects.reference[c],y=Ft(i),w=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,A=p/2-g/2,C=d[h],P=w-f[u]-d[m],k=w/2-f[u]/2+A,E=yt(C,k,P),O=c;n.modifiersData[r]=(t={},t[O]=E,t.centerOffset=E-k,t)}}function ma(e){var t=e.state,n=e.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||Ks(t.elements.popper,s)&&(t.elements.arrow=s))}const ga={name:"arrow",enabled:!0,phase:"main",fn:pa,effect:ma,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function it(e){return e.split("-")[1]}var xa={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ya(e,t){var n=e.x,r=e.y,s=t.devicePixelRatio||1;return{x:rt(n*s)/s||0,y:rt(r*s)/s||0}}function Yr(e){var t,n=e.popper,r=e.popperRect,s=e.placement,i=e.variation,o=e.offsets,a=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,h=f===void 0?0:f,m=o.y,p=m===void 0?0:m,g=typeof u=="function"?u({x:h,y:p}):{x:h,y:p};h=g.x,p=g.y;var y=o.hasOwnProperty("x"),w=o.hasOwnProperty("y"),A=se,C=re,P=window;if(l){var k=Ft(n),E="clientHeight",O="clientWidth";if(k===ae(n)&&(k=Ne(n),Me(k).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),k=k,s===re||(s===se||s===he)&&i===kt){C=fe;var R=d&&k===P&&P.visualViewport?P.visualViewport.height:k[E];p-=R-r.height,p*=c?1:-1}if(s===se||(s===re||s===fe)&&i===kt){A=he;var j=d&&k===P&&P.visualViewport?P.visualViewport.width:k[O];h-=j-r.width,h*=c?1:-1}}var T=Object.assign({position:a},l&&xa),L=u===!0?ya({x:h,y:p},ae(n)):{x:h,y:p};if(h=L.x,p=L.y,c){var $;return Object.assign({},T,($={},$[C]=w?"0":"",$[A]=y?"0":"",$.transform=(P.devicePixelRatio||1)<=1?"translate("+h+"px, "+p+"px)":"translate3d("+h+"px, "+p+"px, 0)",$))}return Object.assign({},T,(t={},t[C]=w?p+"px":"",t[A]=y?h+"px":"",t.transform="",t))}function va(e){var t=e.state,n=e.options,r=n.gpuAcceleration,s=r===void 0?!0:r,i=n.adaptive,o=i===void 0?!0:i,a=n.roundOffsets,c=a===void 0?!0:a,l={placement:we(t.placement),variation:it(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Yr(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Yr(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const ba={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:va,data:{}};var Ut={passive:!0};function wa(e){var t=e.state,n=e.instance,r=e.options,s=r.scroll,i=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,c=ae(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&l.forEach(function(u){u.addEventListener("scroll",n.update,Ut)}),a&&c.addEventListener("resize",n.update,Ut),function(){i&&l.forEach(function(u){u.removeEventListener("scroll",n.update,Ut)}),a&&c.removeEventListener("resize",n.update,Ut)}}const Aa={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wa,data:{}};var Ca={left:"right",right:"left",bottom:"top",top:"bottom"};function en(e){return e.replace(/left|right|bottom|top/g,function(t){return Ca[t]})}var Pa={start:"end",end:"start"};function Kr(e){return e.replace(/start|end/g,function(t){return Pa[t]})}function dr(e){var t=ae(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fr(e){return st(Ne(e)).left+dr(e).scrollLeft}function ka(e,t){var n=ae(e),r=Ne(e),s=n.visualViewport,i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;var l=Ys();(l||!l&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a+fr(e),y:c}}function Sa(e){var t,n=Ne(e),r=dr(e),s=(t=e.ownerDocument)==null?void 0:t.body,i=Ye(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ye(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+fr(e),c=-r.scrollTop;return Me(s||n).direction==="rtl"&&(a+=Ye(n.clientWidth,s?s.clientWidth:0)-i),{width:i,height:o,x:a,y:c}}function hr(e){var t=Me(e),n=t.overflow,r=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function Js(e){return["html","body","#document"].indexOf(Ae(e))>=0?e.ownerDocument.body:ue(e)&&hr(e)?e:Js(pn(e))}function vt(e,t){var n;t===void 0&&(t=[]);var r=Js(e),s=r===((n=e.ownerDocument)==null?void 0:n.body),i=ae(r),o=s?[i].concat(i.visualViewport||[],hr(r)?r:[]):r,a=t.concat(o);return s?a:a.concat(vt(pn(o)))}function Xn(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ia(e,t){var n=st(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function qr(e,t,n){return t===Xs?Xn(ka(e,n)):Ke(t)?Ia(t,n):Xn(Sa(Ne(e)))}function Ea(e){var t=vt(pn(e)),n=["absolute","fixed"].indexOf(Me(e).position)>=0,r=n&&ue(e)?Ft(e):e;return Ke(r)?t.filter(function(s){return Ke(s)&&Ks(s,r)&&Ae(s)!=="body"}):[]}function Ma(e,t,n,r){var s=t==="clippingParents"?Ea(e):[].concat(t),i=[].concat(s,[n]),o=i[0],a=i.reduce(function(c,l){var u=qr(e,l,r);return c.top=Ye(u.top,c.top),c.right=sn(u.right,c.right),c.bottom=sn(u.bottom,c.bottom),c.left=Ye(u.left,c.left),c},qr(e,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ei(e){var t=e.reference,n=e.element,r=e.placement,s=r?we(r):null,i=r?it(r):null,o=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,c;switch(s){case re:c={x:o,y:t.y-n.height};break;case fe:c={x:o,y:t.y+t.height};break;case he:c={x:t.x+t.width,y:a};break;case se:c={x:t.x-n.width,y:a};break;default:c={x:t.x,y:t.y}}var l=s?ur(s):null;if(l!=null){var u=l==="y"?"height":"width";switch(i){case nt:c[l]=c[l]-(t[u]/2-n[u]/2);break;case kt:c[l]=c[l]+(t[u]/2-n[u]/2);break}}return c}function St(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=r===void 0?e.placement:r,i=n.strategy,o=i===void 0?e.strategy:i,a=n.boundary,c=a===void 0?Ko:a,l=n.rootBoundary,u=l===void 0?Xs:l,d=n.elementContext,f=d===void 0?ht:d,h=n.altBoundary,m=h===void 0?!1:h,p=n.padding,g=p===void 0?0:p,y=Qs(typeof g!="number"?g:Zs(g,Dt)),w=f===ht?qo:ht,A=e.rects.popper,C=e.elements[m?w:f],P=Ma(Ke(C)?C:C.contextElement||Ne(e.elements.popper),c,u,o),k=st(e.elements.reference),E=ei({reference:k,element:A,placement:s}),O=Xn(Object.assign({},A,E)),R=f===ht?O:k,j={top:P.top-R.top+y.top,bottom:R.bottom-P.bottom+y.bottom,left:P.left-R.left+y.left,right:R.right-P.right+y.right},T=e.modifiersData.offset;if(f===ht&&T){var L=T[s];Object.keys(j).forEach(function($){var I=[he,fe].indexOf($)>=0?1:-1,M=[re,fe].indexOf($)>=0?"y":"x";j[$]+=L[M]*I})}return j}function ja(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=n.boundary,i=n.rootBoundary,o=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?Ws:c,u=it(r),d=u?a?Xr:Xr.filter(function(m){return it(m)===u}):Dt,f=d.filter(function(m){return l.indexOf(m)>=0});f.length===0&&(f=d);var h=f.reduce(function(m,p){return m[p]=St(e,{placement:p,boundary:s,rootBoundary:i,padding:o})[we(p)],m},{});return Object.keys(h).sort(function(m,p){return h[m]-h[p]})}function Ra(e){if(we(e)===ar)return[];var t=en(e);return[Kr(e),t,Kr(t)]}function Oa(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!0:o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,p=n.allowedAutoPlacements,g=t.options.placement,y=we(g),w=y===g,A=c||(w||!m?[en(g)]:Ra(g)),C=[g].concat(A).reduce(function(q,H){return q.concat(we(H)===ar?ja(t,{placement:H,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:p}):H)},[]),P=t.rects.reference,k=t.rects.popper,E=new Map,O=!0,R=C[0],j=0;j<C.length;j++){var T=C[j],L=we(T),$=it(T)===nt,I=[re,fe].indexOf(L)>=0,M=I?"width":"height",_=St(t,{placement:T,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),D=I?$?he:se:$?fe:re;P[M]>k[M]&&(D=en(D));var F=en(D),V=[];if(i&&V.push(_[L]<=0),a&&V.push(_[D]<=0,_[F]<=0),V.every(function(q){return q})){R=T,O=!1;break}E.set(T,V)}if(O)for(var N=m?3:1,U=function(H){var Q=C.find(function(Y){var K=E.get(Y);if(K)return K.slice(0,H).every(function(Z){return Z})});if(Q)return R=Q,"break"},G=N;G>0;G--){var ie=U(G);if(ie==="break")break}t.placement!==R&&(t.modifiersData[r]._skip=!0,t.placement=R,t.reset=!0)}}const Ta={name:"flip",enabled:!0,phase:"main",fn:Oa,requiresIfExists:["offset"],data:{_skip:!1}};function Qr(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Zr(e){return[re,he,fe,se].some(function(t){return e[t]>=0})}function _a(e){var t=e.state,n=e.name,r=t.rects.reference,s=t.rects.popper,i=t.modifiersData.preventOverflow,o=St(t,{elementContext:"reference"}),a=St(t,{altBoundary:!0}),c=Qr(o,r),l=Qr(a,s,i),u=Zr(c),d=Zr(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const $a={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_a};function La(e,t,n){var r=we(e),s=[se,re].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,o=i[0],a=i[1];return o=o||0,a=(a||0)*s,[se,he].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Da(e){var t=e.state,n=e.options,r=e.name,s=n.offset,i=s===void 0?[0,0]:s,o=Ws.reduce(function(u,d){return u[d]=La(d,t.rects,i),u},{}),a=o[t.placement],c=a.x,l=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}const Fa={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Da};function za(e){var t=e.state,n=e.name;t.modifiersData[n]=ei({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Na={name:"popperOffsets",enabled:!0,phase:"read",fn:za,data:{}};function Ba(e){return e==="x"?"y":"x"}function Va(e){var t=e.state,n=e.options,r=e.name,s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!1:o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,p=m===void 0?0:m,g=St(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),y=we(t.placement),w=it(t.placement),A=!w,C=ur(y),P=Ba(C),k=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,R=typeof p=="function"?p(Object.assign({},t.rects,{placement:t.placement})):p,j=typeof R=="number"?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(k){if(i){var $,I=C==="y"?re:se,M=C==="y"?fe:he,_=C==="y"?"height":"width",D=k[C],F=D+g[I],V=D-g[M],N=h?-O[_]/2:0,U=w===nt?E[_]:O[_],G=w===nt?-O[_]:-E[_],ie=t.elements.arrow,q=h&&ie?cr(ie):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:qs(),Q=H[I],Y=H[M],K=yt(0,E[_],q[_]),Z=A?E[_]/2-N-K-Q-j.mainAxis:U-K-Q-j.mainAxis,oe=A?-E[_]/2+N+K+Y+j.mainAxis:G+K+Y+j.mainAxis,J=t.elements.arrow&&Ft(t.elements.arrow),Pe=J?C==="y"?J.clientTop||0:J.clientLeft||0:0,ke=($=T?.[C])!=null?$:0,ct=D+Z-ke-Pe,ut=D+oe-ke,Ve=yt(h?sn(F,ct):F,D,h?Ye(V,ut):V);k[C]=Ve,L[C]=Ve-D}if(a){var He,dt=C==="x"?re:se,ft=C==="x"?fe:he,ve=k[P],Ht=P==="y"?"height":"width",$r=ve+g[dt],Lr=ve-g[ft],Sn=[re,se].indexOf(y)!==-1,Dr=(He=T?.[P])!=null?He:0,Fr=Sn?$r:ve-E[Ht]-O[Ht]-Dr+j.altAxis,zr=Sn?ve+E[Ht]+O[Ht]-Dr-j.altAxis:Lr,Nr=h&&Sn?fa(Fr,ve,zr):yt(h?Fr:$r,ve,h?zr:Lr);k[P]=Nr,L[P]=Nr-ve}t.modifiersData[r]=L}}const Ha={name:"preventOverflow",enabled:!0,phase:"main",fn:Va,requiresIfExists:["offset"]};function Ua(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Ga(e){return e===ae(e)||!ue(e)?dr(e):Ua(e)}function Xa(e){var t=e.getBoundingClientRect(),n=rt(t.width)/e.offsetWidth||1,r=rt(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Wa(e,t,n){n===void 0&&(n=!1);var r=ue(t),s=ue(t)&&Xa(t),i=Ne(t),o=st(e,s,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Ae(t)!=="body"||hr(i))&&(a=Ga(t)),ue(t)?(c=st(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=fr(i))),{x:o.left+a.scrollLeft-c.x,y:o.top+a.scrollTop-c.y,width:o.width,height:o.height}}function Ya(e){var t=new Map,n=new Set,r=[];e.forEach(function(i){t.set(i.name,i)});function s(i){n.add(i.name);var o=[].concat(i.requires||[],i.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var c=t.get(a);c&&s(c)}}),r.push(i)}return e.forEach(function(i){n.has(i.name)||s(i)}),r}function Ka(e){var t=Ya(e);return oa.reduce(function(n,r){return n.concat(t.filter(function(s){return s.phase===r}))},[])}function qa(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Qa(e){var t=e.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Jr={placement:"bottom",modifiers:[],strategy:"absolute"};function es(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Za(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,s=t.defaultOptions,i=s===void 0?Jr:s;return function(a,c,l){l===void 0&&(l=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Jr,i),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;p(),u.options=Object.assign({},i,u.options,w),u.scrollParents={reference:Ke(a)?vt(a):a.contextElement?vt(a.contextElement):[],popper:vt(c)};var A=Ka(Qa([].concat(r,u.options.modifiers)));return u.orderedModifiers=A.filter(function(C){return C.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,A=y.popper;if(es(w,A)){u.rects={reference:Wa(w,Ft(A),u.options.strategy==="fixed"),popper:cr(A)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(j){return u.modifiersData[j.name]=Object.assign({},j.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var P=u.orderedModifiers[C],k=P.fn,E=P.options,O=E===void 0?{}:E,R=P.name;typeof k=="function"&&(u=k({state:u,options:O,name:R,instance:h})||u)}}}},update:qa(function(){return new Promise(function(g){h.forceUpdate(),g(u)})}),destroy:function(){p(),f=!0}};if(!es(a,c))return h;h.setOptions(l).then(function(g){!f&&l.onFirstUpdate&&l.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,A=w===void 0?{}:w,C=g.effect;if(typeof C=="function"){var P=C({state:u,name:y,instance:h,options:A}),k=function(){};d.push(P||k)}})}function p(){d.forEach(function(g){return g()}),d=[]}return h}}var Ja=[Aa,Na,ba,ca,Fa,Ta,Ha,ga,$a],el=Za({defaultModifiers:Ja});function de(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:s=!1,...i}=e,o=s?{}:Xo(n,r),{props:a,internalRef:c}=Yo({...i,externalSlotProps:o}),l=Pt(c,o?.ref,e.additionalProps?.ref);return Go(t,{...a,ref:l},r)}function tl(e){return parseInt(v.version,10)>=19?e?.props?.ref||null:e?.ref||null}function nl(e){return typeof e=="function"?e():e}const rl=v.forwardRef(function(t,n){const{children:r,container:s,disablePortal:i=!1}=t,[o,a]=v.useState(null),c=Pt(v.isValidElement(r)?tl(r):null,n);if($e(()=>{i||a(nl(s)||document.body)},[s,i]),$e(()=>{if(o&&!i)return Ur(n,o),()=>{Ur(n,null)}},[n,o,i]),i){if(v.isValidElement(r)){const l={ref:c};return v.cloneElement(r,l)}return r}return o&&Ns.createPortal(r,o)});function sl(e){return De("MuiPopper",e)}Fe("MuiPopper",["root"]);function il(e,t){if(t==="ltr")return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function Wn(e){return typeof e=="function"?e():e}function ol(e){return e.nodeType!==void 0}const al=e=>{const{classes:t}=e;return je({root:["root"]},sl,t)},ll={},cl=v.forwardRef(function(t,n){const{anchorEl:r,children:s,direction:i,disablePortal:o,modifiers:a,open:c,placement:l,popperOptions:u,popperRef:d,slotProps:f={},slots:h={},TransitionProps:m,ownerState:p,...g}=t,y=v.useRef(null),w=Pt(y,n),A=v.useRef(null),C=Pt(A,d),P=v.useRef(C);$e(()=>{P.current=C},[C]),v.useImperativeHandle(d,()=>A.current,[]);const k=il(l,i),[E,O]=v.useState(k),[R,j]=v.useState(Wn(r));v.useEffect(()=>{A.current&&A.current.forceUpdate()}),v.useEffect(()=>{r&&j(Wn(r))},[r]),$e(()=>{if(!R||!c)return;const M=F=>{O(F.placement)};let _=[{name:"preventOverflow",options:{altBoundary:o}},{name:"flip",options:{altBoundary:o}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:F})=>{M(F)}}];a!=null&&(_=_.concat(a)),u&&u.modifiers!=null&&(_=_.concat(u.modifiers));const D=el(R,y.current,{placement:k,...u,modifiers:_});return P.current(D),()=>{D.destroy(),P.current(null)}},[R,o,a,c,u,k]);const T={placement:E};m!==null&&(T.TransitionProps=m);const L=al(t),$=h.root??"div",I=de({elementType:$,externalSlotProps:f.root,externalForwardedProps:g,additionalProps:{role:"tooltip",ref:w},ownerState:t,className:L.root});return x.jsx($,{...I,children:typeof s=="function"?s(T):s})}),ul=v.forwardRef(function(t,n){const{anchorEl:r,children:s,container:i,direction:o="ltr",disablePortal:a=!1,keepMounted:c=!1,modifiers:l,open:u,placement:d="bottom",popperOptions:f=ll,popperRef:h,style:m,transition:p=!1,slotProps:g={},slots:y={},...w}=t,[A,C]=v.useState(!0),P=()=>{C(!1)},k=()=>{C(!0)};if(!c&&!u&&(!p||A))return null;let E;if(i)E=i;else if(r){const j=Wn(r);E=j&&ol(j)?Un(j).body:Un(null).body}const O=!u&&c&&(!p||A)?"none":void 0,R=p?{in:u,onEnter:P,onExited:k}:void 0;return x.jsx(rl,{disablePortal:a,container:E,children:x.jsx(cl,{anchorEl:r,direction:o,disablePortal:a,modifiers:l,ref:n,open:p?!A:u,placement:d,popperOptions:f,popperRef:h,slotProps:g,slots:y,...w,style:{position:"fixed",top:0,left:0,display:O,...m},TransitionProps:R,children:s})})}),dl=W(ul,{name:"MuiPopper",slot:"Root"})({}),fl=v.forwardRef(function(t,n){const r=or(),s=io({props:t,name:"MuiPopper"}),{anchorEl:i,component:o,components:a,componentsProps:c,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,slots:w,slotProps:A,...C}=s,P=w?.root??a?.Root,k={anchorEl:i,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,...C};return x.jsx(dl,{as:o,direction:r?"rtl":"ltr",slots:{root:P},slotProps:A??c,...k,ref:n})});function ti(e){const{children:t,defer:n=!1,fallback:r=null}=e,[s,i]=v.useState(!1);return $e(()=>{n||i(!0)},[n]),v.useEffect(()=>{n&&i(!0)},[n]),s?t:r}function hl(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function pl(e){return e}function ml(){var e=pl,t=hl,n=null,r=Ue(0),s=Ue(jn),i=Ue(0);function o(a){var c,l=(a=Co(a)).length,u,d,f=0,h=new Array(l),m=new Array(l),p=+r.apply(this,arguments),g=Math.min(jn,Math.max(-jn,s.apply(this,arguments)-p)),y,w=Math.min(Math.abs(g)/l,i.apply(this,arguments)),A=w*(g<0?-1:1),C;for(c=0;c<l;++c)(C=m[h[c]=c]=+e(a[c],c,a))>0&&(f+=C);for(t!=null?h.sort(function(P,k){return t(m[P],m[k])}):n!=null&&h.sort(function(P,k){return n(a[P],a[k])}),c=0,d=f?(g-l*A)/f:0;c<l;++c,p=y)u=h[c],C=m[u],y=p+(C>0?C*d:0)+A,m[u]={data:a[u],index:c,value:C,startAngle:p,endAngle:y,padAngle:w};return m}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:Ue(+a),o):e},o.sortValues=function(a){return arguments.length?(t=a,n=null,o):t},o.sort=function(a){return arguments.length?(n=a,t=null,o):n},o.startAngle=function(a){return arguments.length?(r=typeof a=="function"?a:Ue(+a),o):r},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:Ue(+a),o):s},o.padAngle=function(a){return arguments.length?(i=typeof a=="function"?a:Ue(+a),o):i},o}function gl(e,t){if((c=e.length)>0)for(var n,r=0,s,i,o,a,c,l=e[t[0]].length;r<l;++r)for(o=a=0,n=0;n<c;++n)(i=(s=e[t[n]][r])[1]-s[0])>0?(s[0]=o,s[1]=o+=i):i<0?(s[1]=a,s[0]=a+=i):(s[0]=0,s[1]=i)}function ni(e){var t=e.map(xl);return hn(e).sort(function(n,r){return t[n]-t[r]})}function xl(e){for(var t=-1,n=0,r=e.length,s,i=-1/0;++t<r;)(s=+e[t][1])>i&&(i=s,n=t);return n}function ri(e){var t=e.map(si);return hn(e).sort(function(n,r){return t[n]-t[r]})}function si(e){for(var t=0,n=-1,r=e.length,s;++n<r;)(s=+e[n][1])&&(t+=s);return t}function yl(e){return ri(e).reverse()}function vl(e){var t=e.length,n,r,s=e.map(si),i=ni(e),o=0,a=0,c=[],l=[];for(n=0;n<t;++n)r=i[n],o<a?(o+=s[r],c.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(c)}function bl(e){return hn(e).reverse()}function wl({filter:e,setFilter:t,closeModal:n}){const{handleSubmit:r,control:s,trigger:i}=uo({defaultValues:{...e}}),o=a=>{t(a),n()};return x.jsxs("form",{onSubmit:r(o),children:[x.jsx(In,{name:"fromDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"From Date",value:new Date(a.value),onChange:l=>{i("fromDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"toDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"To Date",value:new Date(a.value),onChange:l=>{i("toDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"currency",control:s,render:({field:a,fieldState:c})=>x.jsx(fo,{...a,label:"Currency",defaultValue:En.Usd,error:c.error?.message,data:Object.keys(En).map(l=>En[l])})}),x.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[x.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),x.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:n,children:"Cancel"})]})]})}function Al({filter:e,setFilter:t}){const[n,r]=v.useState(!1),{get:s,set:i}=Bs();function o(a){a||={fromDate:Le(new Date,"yyyy-MM-DD"),toDate:Le(new Date,"yyyy-MM-DD")},ho(a,e)||t(a)}return v.useEffect(()=>{const a=oo(e??{})?null:encodeURIComponent(JSON.stringify(e)),c=s("MonthlyIncomeExpenseChartFilters");a!==c&&i("MonthlyIncomeExpenseChartFilters",a)},[e,s,i]),x.jsxs(x.Fragment,{children:[x.jsx(ao,{opened:n,onClose:()=>r(!1),content:x.jsx(wl,{filter:e,setFilter:o,closeModal:()=>r(!1)})}),x.jsx(lo,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(!0),children:x.jsx(co,{className:"size-5"})})]})}const pr="DEFAULT_X_AXIS_KEY",mr="DEFAULT_Y_AXIS_KEY",Cl={top:50,bottom:50,left:50,right:50},ii=v.createContext({isInitialized:!1,data:{highlightedItem:null,setHighlighted:()=>{},clearHighlighted:()=>{},isHighlighted:()=>!1,isFaded:()=>!1}}),Pl=(e,t)=>n=>e?e.fade==="series"?n.seriesId===t?.seriesId&&n.dataIndex!==t?.dataIndex:e.fade==="global"?n.seriesId!==t?.seriesId||n.dataIndex!==t?.dataIndex:!1:!1,kl=(e,t)=>n=>e?e.highlight==="series"?n.seriesId===t?.seriesId:e.highlight==="item"?n.dataIndex===t?.dataIndex&&n.seriesId===t?.seriesId:!1:!1,Sl=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];function Il(e,t,n=Sl){return e.type==="pie"?b({},e,{data:e.data.map((r,s)=>b({color:n[s%n.length]},r))}):b({color:n[t%n.length]},e)}const El=({series:e,colors:t,seriesFormatters:n,dataset:r})=>{const s={};e.forEach((o,a)=>{const{id:c=`auto-generated-id-${a}`,type:l}=o;if(s[l]===void 0&&(s[l]={series:{},seriesOrder:[]}),s[l]?.series[c]!==void 0)throw new Error(`MUI X: series' id "${c}" is not unique.`);s[l].series[c]=b({id:c},Il(o,a,t)),s[l].seriesOrder.push(c)});const i={};return Object.keys(n).forEach(o=>{const a=s[o];a!==void 0&&(i[o]=n[o]?.(a,r)??s[o])}),i},Ml=["#02B2AF","#2E96FF","#B800D8","#60009B","#2731C8","#03008D"],jl=["#02B2AF","#72CCFF","#DA00FF","#9001CB","#2E96FF","#3B48E0"],Rl=e=>e==="dark"?jl:Ml,oi=v.createContext({isInitialized:!1,data:{}}),zt=v.createContext({isInitialized:!1,data:{colorProcessors:{},seriesFormatters:{},xExtremumGetters:{},yExtremumGetters:{},rotationExtremumGetters:{},radiusExtremumGetters:{}}}),ts=(e,t)=>t==="x"?{x:e,y:null}:{x:null,y:e},ai=e=>{const{axis:t,getFilters:n,isDefaultAxis:r}=e,s=n?.({currentAxisId:t.id,isDefaultAxis:r}),i=s?t.data?.filter((c,l)=>s({x:null,y:null},l)):t.data,o=Math.min(...i??[]),a=Math.max(...i??[]);return[o,a]},li=e=>t=>{const{series:n,axis:r,getFilters:s,isDefaultAxis:i}=t;return Object.keys(n).filter(o=>{const a=n[o].yAxisId??n[o].yAxisKey;return a===r.id||i&&a===void 0}).reduce((o,a)=>{const{stackedData:c}=n[a],l=s?.({currentAxisId:r.id,isDefaultAxis:i,seriesXAxisId:n[a].xAxisId??n[a].xAxisKey,seriesYAxisId:n[a].yAxisId??n[a].yAxisKey}),[u,d]=c?.reduce((f,h,m)=>l&&(!l(ts(h[0],e),m)||!l(ts(h[1],e),m))?f:[Math.min(...h,f[0]),Math.max(...h,f[1])],[1/0,-1/0])??[1/0,-1/0];return[Math.min(u,o[0]),Math.max(d,o[1])]},[1/0,-1/0])},Ol=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?li("x")(e):ai(e),Tl=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?ai(e):li("y")(e),Rn={appearance:ni,ascending:ri,descending:yl,insideOut:vl,none:hn,reverse:bl},On={expand:Io,diverging:gl,none:Po,silhouette:So,wiggle:ko},ci=e=>{const{series:t,seriesOrder:n,defaultStrategy:r}=e,s=[],i={};return n.forEach(o=>{const{stack:a,stackOrder:c,stackOffset:l}=t[o];a===void 0?s.push({ids:[o],stackingOrder:Rn.none,stackingOffset:On.none}):i[a]===void 0?(i[a]=s.length,s.push({ids:[o],stackingOrder:Rn[c??r?.stackOrder??"none"],stackingOffset:On[l??r?.stackOffset??"diverging"]})):(s[i[a]].ids.push(o),c!==void 0&&(s[i[a]].stackingOrder=Rn[c]),l!==void 0&&(s[i[a]].stackingOffset=On[l]))}),s};function ui(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=b({},e[r],{valueFormatter:e[r].valueFormatter??t})}),n}const _l=(e,t)=>{const{seriesOrder:n,series:r}=e,s=ci(e),i=t??[];n.forEach(a=>{const c=r[a].data;if(c!==void 0)c.forEach((l,u)=>{i.length<=u?i.push({[a]:l}):i[u][a]=l});else if(t===void 0)throw new Error([`MUI X: bar series with id='${a}' has no data.`,"Either provide a data property to the series or use the dataset prop."].join(`
|
|
1
|
+
import{d1 as so,d2 as Ds,d3 as Fs,d4 as zs,r as v,ah as Ie,d5 as $e,d6 as Ns,j as x,d7 as or,d8 as io,u as Bs,cX as oo,cY as ao,B as lo,cZ as co,Q as uo,bL as In,bQ as Br,d9 as Vr,G as Le,bM as fo,a_ as En,c_ as ho,da as b,db as Vs,W as po,dc as mo,F as go,a as xo,dd as yo,c as vo,L as bo,de as wo}from"./index-CN7VPpiB.js";import{u as Pt,g as De,a as Fe,c as je,s as W,_ as X,b as Ao,T as Mn}from"./Typography-BX4mj53o.js";import{c as Ue,t as jn,a as Co,d as hn,b as Po,e as ko,f as So,g as Io,h as Hs,o as Hr,i as Eo,s as Mo,l as jo,u as Ro,j as Us,k as Oo,p as To,m as _o,n as $o,q as Lo,r as Do,v as Fo,w as zo}from"./sequential-CAnleQny.js";import{s as Gs}from"./sub-LLu8afpC.js";import"./subMonths-C1UIPrOU.js";function No(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:so(t.components[n].defaultProps,r)}function Bo({props:e,name:t,defaultTheme:n,themeId:r}){let s=Ds(n);return s=s[r]||s,No({theme:s,name:t,props:e})}function Lt(){const e=Ds(Fs);return e[zs]||e}function ze({props:e,name:t}){return Bo({props:e,name:t,defaultTheme:Fs,themeId:zs})}function Un(e){return e&&e.ownerDocument||document}function Vo(e){return Un(e).defaultView||window}function Ur(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ho(e){const{controlled:t,default:n}=e,{current:r}=v.useRef(t!==void 0),[s,i]=v.useState(n),o=r?t:s,a=v.useCallback(c=>{r||i(c)},[]);return[o,a]}function Uo(e){return typeof e=="string"}function Go(e,t,n){return e===void 0||Uo(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Xo(e,t,n){return typeof e=="function"?e(t,n):e}function Wo(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function Gr(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function Yo(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:s,className:i}=e;if(!t){const h=Ie(n?.className,i,s?.className,r?.className),m={...n?.style,...s?.style,...r?.style},p={...n,...s,...r};return h.length>0&&(p.className=h),Object.keys(m).length>0&&(p.style=m),{props:p,internalRef:void 0}}const o=Wo({...s,...r}),a=Gr(r),c=Gr(s),l=t(o),u=Ie(l?.className,n?.className,i,s?.className,r?.className),d={...l?.style,...n?.style,...s?.style,...r?.style},f={...l,...n,...c,...a};return u.length>0&&(f.className=u),Object.keys(d).length>0&&(f.style=d),{props:f,internalRef:l.ref}}var re="top",fe="bottom",he="right",se="left",ar="auto",Dt=[re,fe,he,se],nt="start",kt="end",Ko="clippingParents",Xs="viewport",ht="popper",qo="reference",Xr=Dt.reduce(function(e,t){return e.concat([t+"-"+nt,t+"-"+kt])},[]),Ws=[].concat(Dt,[ar]).reduce(function(e,t){return e.concat([t,t+"-"+nt,t+"-"+kt])},[]),Qo="beforeRead",Zo="read",Jo="afterRead",ea="beforeMain",ta="main",na="afterMain",ra="beforeWrite",sa="write",ia="afterWrite",oa=[Qo,Zo,Jo,ea,ta,na,ra,sa,ia];function Ae(e){return e?(e.nodeName||"").toLowerCase():null}function ae(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ke(e){var t=ae(e).Element;return e instanceof t||e instanceof Element}function ue(e){var t=ae(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lr(e){if(typeof ShadowRoot>"u")return!1;var t=ae(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function aa(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},s=t.attributes[n]||{},i=t.elements[n];!ue(i)||!Ae(i)||(Object.assign(i.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?i.removeAttribute(o):i.setAttribute(o,a===!0?"":a)}))})}function la(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var s=t.elements[r],i=t.attributes[r]||{},o=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=o.reduce(function(c,l){return c[l]="",c},{});!ue(s)||!Ae(s)||(Object.assign(s.style,a),Object.keys(i).forEach(function(c){s.removeAttribute(c)}))})}}const ca={name:"applyStyles",enabled:!0,phase:"write",fn:aa,effect:la,requires:["computeStyles"]};function we(e){return e.split("-")[0]}var Ye=Math.max,sn=Math.min,rt=Math.round;function Gn(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ys(){return!/^((?!chrome|android).)*safari/i.test(Gn())}function st(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),s=1,i=1;t&&ue(e)&&(s=e.offsetWidth>0&&rt(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&rt(r.height)/e.offsetHeight||1);var o=Ke(e)?ae(e):window,a=o.visualViewport,c=!Ys()&&n,l=(r.left+(c&&a?a.offsetLeft:0))/s,u=(r.top+(c&&a?a.offsetTop:0))/i,d=r.width/s,f=r.height/i;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l,x:l,y:u}}function cr(e){var t=st(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Ks(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lr(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Me(e){return ae(e).getComputedStyle(e)}function ua(e){return["table","td","th"].indexOf(Ae(e))>=0}function Ne(e){return((Ke(e)?e.ownerDocument:e.document)||window.document).documentElement}function pn(e){return Ae(e)==="html"?e:e.assignedSlot||e.parentNode||(lr(e)?e.host:null)||Ne(e)}function Wr(e){return!ue(e)||Me(e).position==="fixed"?null:e.offsetParent}function da(e){var t=/firefox/i.test(Gn()),n=/Trident/i.test(Gn());if(n&&ue(e)){var r=Me(e);if(r.position==="fixed")return null}var s=pn(e);for(lr(s)&&(s=s.host);ue(s)&&["html","body"].indexOf(Ae(s))<0;){var i=Me(s);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return s;s=s.parentNode}return null}function Ft(e){for(var t=ae(e),n=Wr(e);n&&ua(n)&&Me(n).position==="static";)n=Wr(n);return n&&(Ae(n)==="html"||Ae(n)==="body"&&Me(n).position==="static")?t:n||da(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function yt(e,t,n){return Ye(e,sn(t,n))}function fa(e,t,n){var r=yt(e,t,n);return r>n?n:r}function qs(){return{top:0,right:0,bottom:0,left:0}}function Qs(e){return Object.assign({},qs(),e)}function Zs(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var ha=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Qs(typeof t!="number"?t:Zs(t,Dt))};function pa(e){var t,n=e.state,r=e.name,s=e.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,a=we(n.placement),c=ur(a),l=[se,he].indexOf(a)>=0,u=l?"height":"width";if(!(!i||!o)){var d=ha(s.padding,n),f=cr(i),h=c==="y"?re:se,m=c==="y"?fe:he,p=n.rects.reference[u]+n.rects.reference[c]-o[c]-n.rects.popper[u],g=o[c]-n.rects.reference[c],y=Ft(i),w=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,A=p/2-g/2,C=d[h],P=w-f[u]-d[m],k=w/2-f[u]/2+A,E=yt(C,k,P),O=c;n.modifiersData[r]=(t={},t[O]=E,t.centerOffset=E-k,t)}}function ma(e){var t=e.state,n=e.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||Ks(t.elements.popper,s)&&(t.elements.arrow=s))}const ga={name:"arrow",enabled:!0,phase:"main",fn:pa,effect:ma,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function it(e){return e.split("-")[1]}var xa={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ya(e,t){var n=e.x,r=e.y,s=t.devicePixelRatio||1;return{x:rt(n*s)/s||0,y:rt(r*s)/s||0}}function Yr(e){var t,n=e.popper,r=e.popperRect,s=e.placement,i=e.variation,o=e.offsets,a=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,h=f===void 0?0:f,m=o.y,p=m===void 0?0:m,g=typeof u=="function"?u({x:h,y:p}):{x:h,y:p};h=g.x,p=g.y;var y=o.hasOwnProperty("x"),w=o.hasOwnProperty("y"),A=se,C=re,P=window;if(l){var k=Ft(n),E="clientHeight",O="clientWidth";if(k===ae(n)&&(k=Ne(n),Me(k).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),k=k,s===re||(s===se||s===he)&&i===kt){C=fe;var R=d&&k===P&&P.visualViewport?P.visualViewport.height:k[E];p-=R-r.height,p*=c?1:-1}if(s===se||(s===re||s===fe)&&i===kt){A=he;var j=d&&k===P&&P.visualViewport?P.visualViewport.width:k[O];h-=j-r.width,h*=c?1:-1}}var T=Object.assign({position:a},l&&xa),L=u===!0?ya({x:h,y:p},ae(n)):{x:h,y:p};if(h=L.x,p=L.y,c){var $;return Object.assign({},T,($={},$[C]=w?"0":"",$[A]=y?"0":"",$.transform=(P.devicePixelRatio||1)<=1?"translate("+h+"px, "+p+"px)":"translate3d("+h+"px, "+p+"px, 0)",$))}return Object.assign({},T,(t={},t[C]=w?p+"px":"",t[A]=y?h+"px":"",t.transform="",t))}function va(e){var t=e.state,n=e.options,r=n.gpuAcceleration,s=r===void 0?!0:r,i=n.adaptive,o=i===void 0?!0:i,a=n.roundOffsets,c=a===void 0?!0:a,l={placement:we(t.placement),variation:it(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Yr(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Yr(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const ba={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:va,data:{}};var Ut={passive:!0};function wa(e){var t=e.state,n=e.instance,r=e.options,s=r.scroll,i=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,c=ae(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&l.forEach(function(u){u.addEventListener("scroll",n.update,Ut)}),a&&c.addEventListener("resize",n.update,Ut),function(){i&&l.forEach(function(u){u.removeEventListener("scroll",n.update,Ut)}),a&&c.removeEventListener("resize",n.update,Ut)}}const Aa={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wa,data:{}};var Ca={left:"right",right:"left",bottom:"top",top:"bottom"};function en(e){return e.replace(/left|right|bottom|top/g,function(t){return Ca[t]})}var Pa={start:"end",end:"start"};function Kr(e){return e.replace(/start|end/g,function(t){return Pa[t]})}function dr(e){var t=ae(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fr(e){return st(Ne(e)).left+dr(e).scrollLeft}function ka(e,t){var n=ae(e),r=Ne(e),s=n.visualViewport,i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;var l=Ys();(l||!l&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a+fr(e),y:c}}function Sa(e){var t,n=Ne(e),r=dr(e),s=(t=e.ownerDocument)==null?void 0:t.body,i=Ye(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ye(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+fr(e),c=-r.scrollTop;return Me(s||n).direction==="rtl"&&(a+=Ye(n.clientWidth,s?s.clientWidth:0)-i),{width:i,height:o,x:a,y:c}}function hr(e){var t=Me(e),n=t.overflow,r=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function Js(e){return["html","body","#document"].indexOf(Ae(e))>=0?e.ownerDocument.body:ue(e)&&hr(e)?e:Js(pn(e))}function vt(e,t){var n;t===void 0&&(t=[]);var r=Js(e),s=r===((n=e.ownerDocument)==null?void 0:n.body),i=ae(r),o=s?[i].concat(i.visualViewport||[],hr(r)?r:[]):r,a=t.concat(o);return s?a:a.concat(vt(pn(o)))}function Xn(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ia(e,t){var n=st(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function qr(e,t,n){return t===Xs?Xn(ka(e,n)):Ke(t)?Ia(t,n):Xn(Sa(Ne(e)))}function Ea(e){var t=vt(pn(e)),n=["absolute","fixed"].indexOf(Me(e).position)>=0,r=n&&ue(e)?Ft(e):e;return Ke(r)?t.filter(function(s){return Ke(s)&&Ks(s,r)&&Ae(s)!=="body"}):[]}function Ma(e,t,n,r){var s=t==="clippingParents"?Ea(e):[].concat(t),i=[].concat(s,[n]),o=i[0],a=i.reduce(function(c,l){var u=qr(e,l,r);return c.top=Ye(u.top,c.top),c.right=sn(u.right,c.right),c.bottom=sn(u.bottom,c.bottom),c.left=Ye(u.left,c.left),c},qr(e,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ei(e){var t=e.reference,n=e.element,r=e.placement,s=r?we(r):null,i=r?it(r):null,o=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,c;switch(s){case re:c={x:o,y:t.y-n.height};break;case fe:c={x:o,y:t.y+t.height};break;case he:c={x:t.x+t.width,y:a};break;case se:c={x:t.x-n.width,y:a};break;default:c={x:t.x,y:t.y}}var l=s?ur(s):null;if(l!=null){var u=l==="y"?"height":"width";switch(i){case nt:c[l]=c[l]-(t[u]/2-n[u]/2);break;case kt:c[l]=c[l]+(t[u]/2-n[u]/2);break}}return c}function St(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=r===void 0?e.placement:r,i=n.strategy,o=i===void 0?e.strategy:i,a=n.boundary,c=a===void 0?Ko:a,l=n.rootBoundary,u=l===void 0?Xs:l,d=n.elementContext,f=d===void 0?ht:d,h=n.altBoundary,m=h===void 0?!1:h,p=n.padding,g=p===void 0?0:p,y=Qs(typeof g!="number"?g:Zs(g,Dt)),w=f===ht?qo:ht,A=e.rects.popper,C=e.elements[m?w:f],P=Ma(Ke(C)?C:C.contextElement||Ne(e.elements.popper),c,u,o),k=st(e.elements.reference),E=ei({reference:k,element:A,placement:s}),O=Xn(Object.assign({},A,E)),R=f===ht?O:k,j={top:P.top-R.top+y.top,bottom:R.bottom-P.bottom+y.bottom,left:P.left-R.left+y.left,right:R.right-P.right+y.right},T=e.modifiersData.offset;if(f===ht&&T){var L=T[s];Object.keys(j).forEach(function($){var I=[he,fe].indexOf($)>=0?1:-1,M=[re,fe].indexOf($)>=0?"y":"x";j[$]+=L[M]*I})}return j}function ja(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=n.boundary,i=n.rootBoundary,o=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?Ws:c,u=it(r),d=u?a?Xr:Xr.filter(function(m){return it(m)===u}):Dt,f=d.filter(function(m){return l.indexOf(m)>=0});f.length===0&&(f=d);var h=f.reduce(function(m,p){return m[p]=St(e,{placement:p,boundary:s,rootBoundary:i,padding:o})[we(p)],m},{});return Object.keys(h).sort(function(m,p){return h[m]-h[p]})}function Ra(e){if(we(e)===ar)return[];var t=en(e);return[Kr(e),t,Kr(t)]}function Oa(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!0:o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,p=n.allowedAutoPlacements,g=t.options.placement,y=we(g),w=y===g,A=c||(w||!m?[en(g)]:Ra(g)),C=[g].concat(A).reduce(function(q,H){return q.concat(we(H)===ar?ja(t,{placement:H,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:p}):H)},[]),P=t.rects.reference,k=t.rects.popper,E=new Map,O=!0,R=C[0],j=0;j<C.length;j++){var T=C[j],L=we(T),$=it(T)===nt,I=[re,fe].indexOf(L)>=0,M=I?"width":"height",_=St(t,{placement:T,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),D=I?$?he:se:$?fe:re;P[M]>k[M]&&(D=en(D));var F=en(D),V=[];if(i&&V.push(_[L]<=0),a&&V.push(_[D]<=0,_[F]<=0),V.every(function(q){return q})){R=T,O=!1;break}E.set(T,V)}if(O)for(var N=m?3:1,U=function(H){var Q=C.find(function(Y){var K=E.get(Y);if(K)return K.slice(0,H).every(function(Z){return Z})});if(Q)return R=Q,"break"},G=N;G>0;G--){var ie=U(G);if(ie==="break")break}t.placement!==R&&(t.modifiersData[r]._skip=!0,t.placement=R,t.reset=!0)}}const Ta={name:"flip",enabled:!0,phase:"main",fn:Oa,requiresIfExists:["offset"],data:{_skip:!1}};function Qr(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Zr(e){return[re,he,fe,se].some(function(t){return e[t]>=0})}function _a(e){var t=e.state,n=e.name,r=t.rects.reference,s=t.rects.popper,i=t.modifiersData.preventOverflow,o=St(t,{elementContext:"reference"}),a=St(t,{altBoundary:!0}),c=Qr(o,r),l=Qr(a,s,i),u=Zr(c),d=Zr(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const $a={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_a};function La(e,t,n){var r=we(e),s=[se,re].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,o=i[0],a=i[1];return o=o||0,a=(a||0)*s,[se,he].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Da(e){var t=e.state,n=e.options,r=e.name,s=n.offset,i=s===void 0?[0,0]:s,o=Ws.reduce(function(u,d){return u[d]=La(d,t.rects,i),u},{}),a=o[t.placement],c=a.x,l=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}const Fa={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Da};function za(e){var t=e.state,n=e.name;t.modifiersData[n]=ei({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Na={name:"popperOffsets",enabled:!0,phase:"read",fn:za,data:{}};function Ba(e){return e==="x"?"y":"x"}function Va(e){var t=e.state,n=e.options,r=e.name,s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!1:o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,p=m===void 0?0:m,g=St(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),y=we(t.placement),w=it(t.placement),A=!w,C=ur(y),P=Ba(C),k=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,R=typeof p=="function"?p(Object.assign({},t.rects,{placement:t.placement})):p,j=typeof R=="number"?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(k){if(i){var $,I=C==="y"?re:se,M=C==="y"?fe:he,_=C==="y"?"height":"width",D=k[C],F=D+g[I],V=D-g[M],N=h?-O[_]/2:0,U=w===nt?E[_]:O[_],G=w===nt?-O[_]:-E[_],ie=t.elements.arrow,q=h&&ie?cr(ie):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:qs(),Q=H[I],Y=H[M],K=yt(0,E[_],q[_]),Z=A?E[_]/2-N-K-Q-j.mainAxis:U-K-Q-j.mainAxis,oe=A?-E[_]/2+N+K+Y+j.mainAxis:G+K+Y+j.mainAxis,J=t.elements.arrow&&Ft(t.elements.arrow),Pe=J?C==="y"?J.clientTop||0:J.clientLeft||0:0,ke=($=T?.[C])!=null?$:0,ct=D+Z-ke-Pe,ut=D+oe-ke,Ve=yt(h?sn(F,ct):F,D,h?Ye(V,ut):V);k[C]=Ve,L[C]=Ve-D}if(a){var He,dt=C==="x"?re:se,ft=C==="x"?fe:he,ve=k[P],Ht=P==="y"?"height":"width",$r=ve+g[dt],Lr=ve-g[ft],Sn=[re,se].indexOf(y)!==-1,Dr=(He=T?.[P])!=null?He:0,Fr=Sn?$r:ve-E[Ht]-O[Ht]-Dr+j.altAxis,zr=Sn?ve+E[Ht]+O[Ht]-Dr-j.altAxis:Lr,Nr=h&&Sn?fa(Fr,ve,zr):yt(h?Fr:$r,ve,h?zr:Lr);k[P]=Nr,L[P]=Nr-ve}t.modifiersData[r]=L}}const Ha={name:"preventOverflow",enabled:!0,phase:"main",fn:Va,requiresIfExists:["offset"]};function Ua(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Ga(e){return e===ae(e)||!ue(e)?dr(e):Ua(e)}function Xa(e){var t=e.getBoundingClientRect(),n=rt(t.width)/e.offsetWidth||1,r=rt(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Wa(e,t,n){n===void 0&&(n=!1);var r=ue(t),s=ue(t)&&Xa(t),i=Ne(t),o=st(e,s,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Ae(t)!=="body"||hr(i))&&(a=Ga(t)),ue(t)?(c=st(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=fr(i))),{x:o.left+a.scrollLeft-c.x,y:o.top+a.scrollTop-c.y,width:o.width,height:o.height}}function Ya(e){var t=new Map,n=new Set,r=[];e.forEach(function(i){t.set(i.name,i)});function s(i){n.add(i.name);var o=[].concat(i.requires||[],i.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var c=t.get(a);c&&s(c)}}),r.push(i)}return e.forEach(function(i){n.has(i.name)||s(i)}),r}function Ka(e){var t=Ya(e);return oa.reduce(function(n,r){return n.concat(t.filter(function(s){return s.phase===r}))},[])}function qa(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Qa(e){var t=e.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Jr={placement:"bottom",modifiers:[],strategy:"absolute"};function es(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Za(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,s=t.defaultOptions,i=s===void 0?Jr:s;return function(a,c,l){l===void 0&&(l=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Jr,i),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;p(),u.options=Object.assign({},i,u.options,w),u.scrollParents={reference:Ke(a)?vt(a):a.contextElement?vt(a.contextElement):[],popper:vt(c)};var A=Ka(Qa([].concat(r,u.options.modifiers)));return u.orderedModifiers=A.filter(function(C){return C.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,A=y.popper;if(es(w,A)){u.rects={reference:Wa(w,Ft(A),u.options.strategy==="fixed"),popper:cr(A)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(j){return u.modifiersData[j.name]=Object.assign({},j.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var P=u.orderedModifiers[C],k=P.fn,E=P.options,O=E===void 0?{}:E,R=P.name;typeof k=="function"&&(u=k({state:u,options:O,name:R,instance:h})||u)}}}},update:qa(function(){return new Promise(function(g){h.forceUpdate(),g(u)})}),destroy:function(){p(),f=!0}};if(!es(a,c))return h;h.setOptions(l).then(function(g){!f&&l.onFirstUpdate&&l.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,A=w===void 0?{}:w,C=g.effect;if(typeof C=="function"){var P=C({state:u,name:y,instance:h,options:A}),k=function(){};d.push(P||k)}})}function p(){d.forEach(function(g){return g()}),d=[]}return h}}var Ja=[Aa,Na,ba,ca,Fa,Ta,Ha,ga,$a],el=Za({defaultModifiers:Ja});function de(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:s=!1,...i}=e,o=s?{}:Xo(n,r),{props:a,internalRef:c}=Yo({...i,externalSlotProps:o}),l=Pt(c,o?.ref,e.additionalProps?.ref);return Go(t,{...a,ref:l},r)}function tl(e){return parseInt(v.version,10)>=19?e?.props?.ref||null:e?.ref||null}function nl(e){return typeof e=="function"?e():e}const rl=v.forwardRef(function(t,n){const{children:r,container:s,disablePortal:i=!1}=t,[o,a]=v.useState(null),c=Pt(v.isValidElement(r)?tl(r):null,n);if($e(()=>{i||a(nl(s)||document.body)},[s,i]),$e(()=>{if(o&&!i)return Ur(n,o),()=>{Ur(n,null)}},[n,o,i]),i){if(v.isValidElement(r)){const l={ref:c};return v.cloneElement(r,l)}return r}return o&&Ns.createPortal(r,o)});function sl(e){return De("MuiPopper",e)}Fe("MuiPopper",["root"]);function il(e,t){if(t==="ltr")return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function Wn(e){return typeof e=="function"?e():e}function ol(e){return e.nodeType!==void 0}const al=e=>{const{classes:t}=e;return je({root:["root"]},sl,t)},ll={},cl=v.forwardRef(function(t,n){const{anchorEl:r,children:s,direction:i,disablePortal:o,modifiers:a,open:c,placement:l,popperOptions:u,popperRef:d,slotProps:f={},slots:h={},TransitionProps:m,ownerState:p,...g}=t,y=v.useRef(null),w=Pt(y,n),A=v.useRef(null),C=Pt(A,d),P=v.useRef(C);$e(()=>{P.current=C},[C]),v.useImperativeHandle(d,()=>A.current,[]);const k=il(l,i),[E,O]=v.useState(k),[R,j]=v.useState(Wn(r));v.useEffect(()=>{A.current&&A.current.forceUpdate()}),v.useEffect(()=>{r&&j(Wn(r))},[r]),$e(()=>{if(!R||!c)return;const M=F=>{O(F.placement)};let _=[{name:"preventOverflow",options:{altBoundary:o}},{name:"flip",options:{altBoundary:o}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:F})=>{M(F)}}];a!=null&&(_=_.concat(a)),u&&u.modifiers!=null&&(_=_.concat(u.modifiers));const D=el(R,y.current,{placement:k,...u,modifiers:_});return P.current(D),()=>{D.destroy(),P.current(null)}},[R,o,a,c,u,k]);const T={placement:E};m!==null&&(T.TransitionProps=m);const L=al(t),$=h.root??"div",I=de({elementType:$,externalSlotProps:f.root,externalForwardedProps:g,additionalProps:{role:"tooltip",ref:w},ownerState:t,className:L.root});return x.jsx($,{...I,children:typeof s=="function"?s(T):s})}),ul=v.forwardRef(function(t,n){const{anchorEl:r,children:s,container:i,direction:o="ltr",disablePortal:a=!1,keepMounted:c=!1,modifiers:l,open:u,placement:d="bottom",popperOptions:f=ll,popperRef:h,style:m,transition:p=!1,slotProps:g={},slots:y={},...w}=t,[A,C]=v.useState(!0),P=()=>{C(!1)},k=()=>{C(!0)};if(!c&&!u&&(!p||A))return null;let E;if(i)E=i;else if(r){const j=Wn(r);E=j&&ol(j)?Un(j).body:Un(null).body}const O=!u&&c&&(!p||A)?"none":void 0,R=p?{in:u,onEnter:P,onExited:k}:void 0;return x.jsx(rl,{disablePortal:a,container:E,children:x.jsx(cl,{anchorEl:r,direction:o,disablePortal:a,modifiers:l,ref:n,open:p?!A:u,placement:d,popperOptions:f,popperRef:h,slotProps:g,slots:y,...w,style:{position:"fixed",top:0,left:0,display:O,...m},TransitionProps:R,children:s})})}),dl=W(ul,{name:"MuiPopper",slot:"Root"})({}),fl=v.forwardRef(function(t,n){const r=or(),s=io({props:t,name:"MuiPopper"}),{anchorEl:i,component:o,components:a,componentsProps:c,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,slots:w,slotProps:A,...C}=s,P=w?.root??a?.Root,k={anchorEl:i,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,...C};return x.jsx(dl,{as:o,direction:r?"rtl":"ltr",slots:{root:P},slotProps:A??c,...k,ref:n})});function ti(e){const{children:t,defer:n=!1,fallback:r=null}=e,[s,i]=v.useState(!1);return $e(()=>{n||i(!0)},[n]),v.useEffect(()=>{n&&i(!0)},[n]),s?t:r}function hl(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function pl(e){return e}function ml(){var e=pl,t=hl,n=null,r=Ue(0),s=Ue(jn),i=Ue(0);function o(a){var c,l=(a=Co(a)).length,u,d,f=0,h=new Array(l),m=new Array(l),p=+r.apply(this,arguments),g=Math.min(jn,Math.max(-jn,s.apply(this,arguments)-p)),y,w=Math.min(Math.abs(g)/l,i.apply(this,arguments)),A=w*(g<0?-1:1),C;for(c=0;c<l;++c)(C=m[h[c]=c]=+e(a[c],c,a))>0&&(f+=C);for(t!=null?h.sort(function(P,k){return t(m[P],m[k])}):n!=null&&h.sort(function(P,k){return n(a[P],a[k])}),c=0,d=f?(g-l*A)/f:0;c<l;++c,p=y)u=h[c],C=m[u],y=p+(C>0?C*d:0)+A,m[u]={data:a[u],index:c,value:C,startAngle:p,endAngle:y,padAngle:w};return m}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:Ue(+a),o):e},o.sortValues=function(a){return arguments.length?(t=a,n=null,o):t},o.sort=function(a){return arguments.length?(n=a,t=null,o):n},o.startAngle=function(a){return arguments.length?(r=typeof a=="function"?a:Ue(+a),o):r},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:Ue(+a),o):s},o.padAngle=function(a){return arguments.length?(i=typeof a=="function"?a:Ue(+a),o):i},o}function gl(e,t){if((c=e.length)>0)for(var n,r=0,s,i,o,a,c,l=e[t[0]].length;r<l;++r)for(o=a=0,n=0;n<c;++n)(i=(s=e[t[n]][r])[1]-s[0])>0?(s[0]=o,s[1]=o+=i):i<0?(s[1]=a,s[0]=a+=i):(s[0]=0,s[1]=i)}function ni(e){var t=e.map(xl);return hn(e).sort(function(n,r){return t[n]-t[r]})}function xl(e){for(var t=-1,n=0,r=e.length,s,i=-1/0;++t<r;)(s=+e[t][1])>i&&(i=s,n=t);return n}function ri(e){var t=e.map(si);return hn(e).sort(function(n,r){return t[n]-t[r]})}function si(e){for(var t=0,n=-1,r=e.length,s;++n<r;)(s=+e[n][1])&&(t+=s);return t}function yl(e){return ri(e).reverse()}function vl(e){var t=e.length,n,r,s=e.map(si),i=ni(e),o=0,a=0,c=[],l=[];for(n=0;n<t;++n)r=i[n],o<a?(o+=s[r],c.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(c)}function bl(e){return hn(e).reverse()}function wl({filter:e,setFilter:t,closeModal:n}){const{handleSubmit:r,control:s,trigger:i}=uo({defaultValues:{...e}}),o=a=>{t(a),n()};return x.jsxs("form",{onSubmit:r(o),children:[x.jsx(In,{name:"fromDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"From Date",value:new Date(a.value),onChange:l=>{i("fromDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"toDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"To Date",value:new Date(a.value),onChange:l=>{i("toDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"currency",control:s,render:({field:a,fieldState:c})=>x.jsx(fo,{...a,label:"Currency",defaultValue:En.Usd,error:c.error?.message,data:Object.keys(En).map(l=>En[l])})}),x.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[x.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),x.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:n,children:"Cancel"})]})]})}function Al({filter:e,setFilter:t}){const[n,r]=v.useState(!1),{get:s,set:i}=Bs();function o(a){a||={fromDate:Le(new Date,"yyyy-MM-DD"),toDate:Le(new Date,"yyyy-MM-DD")},ho(a,e)||t(a)}return v.useEffect(()=>{const a=oo(e??{})?null:encodeURIComponent(JSON.stringify(e)),c=s("MonthlyIncomeExpenseChartFilters");a!==c&&i("MonthlyIncomeExpenseChartFilters",a)},[e,s,i]),x.jsxs(x.Fragment,{children:[x.jsx(ao,{opened:n,onClose:()=>r(!1),content:x.jsx(wl,{filter:e,setFilter:o,closeModal:()=>r(!1)})}),x.jsx(lo,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(!0),children:x.jsx(co,{className:"size-5"})})]})}const pr="DEFAULT_X_AXIS_KEY",mr="DEFAULT_Y_AXIS_KEY",Cl={top:50,bottom:50,left:50,right:50},ii=v.createContext({isInitialized:!1,data:{highlightedItem:null,setHighlighted:()=>{},clearHighlighted:()=>{},isHighlighted:()=>!1,isFaded:()=>!1}}),Pl=(e,t)=>n=>e?e.fade==="series"?n.seriesId===t?.seriesId&&n.dataIndex!==t?.dataIndex:e.fade==="global"?n.seriesId!==t?.seriesId||n.dataIndex!==t?.dataIndex:!1:!1,kl=(e,t)=>n=>e?e.highlight==="series"?n.seriesId===t?.seriesId:e.highlight==="item"?n.dataIndex===t?.dataIndex&&n.seriesId===t?.seriesId:!1:!1,Sl=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];function Il(e,t,n=Sl){return e.type==="pie"?b({},e,{data:e.data.map((r,s)=>b({color:n[s%n.length]},r))}):b({color:n[t%n.length]},e)}const El=({series:e,colors:t,seriesFormatters:n,dataset:r})=>{const s={};e.forEach((o,a)=>{const{id:c=`auto-generated-id-${a}`,type:l}=o;if(s[l]===void 0&&(s[l]={series:{},seriesOrder:[]}),s[l]?.series[c]!==void 0)throw new Error(`MUI X: series' id "${c}" is not unique.`);s[l].series[c]=b({id:c},Il(o,a,t)),s[l].seriesOrder.push(c)});const i={};return Object.keys(n).forEach(o=>{const a=s[o];a!==void 0&&(i[o]=n[o]?.(a,r)??s[o])}),i},Ml=["#02B2AF","#2E96FF","#B800D8","#60009B","#2731C8","#03008D"],jl=["#02B2AF","#72CCFF","#DA00FF","#9001CB","#2E96FF","#3B48E0"],Rl=e=>e==="dark"?jl:Ml,oi=v.createContext({isInitialized:!1,data:{}}),zt=v.createContext({isInitialized:!1,data:{colorProcessors:{},seriesFormatters:{},xExtremumGetters:{},yExtremumGetters:{},rotationExtremumGetters:{},radiusExtremumGetters:{}}}),ts=(e,t)=>t==="x"?{x:e,y:null}:{x:null,y:e},ai=e=>{const{axis:t,getFilters:n,isDefaultAxis:r}=e,s=n?.({currentAxisId:t.id,isDefaultAxis:r}),i=s?t.data?.filter((c,l)=>s({x:null,y:null},l)):t.data,o=Math.min(...i??[]),a=Math.max(...i??[]);return[o,a]},li=e=>t=>{const{series:n,axis:r,getFilters:s,isDefaultAxis:i}=t;return Object.keys(n).filter(o=>{const a=n[o].yAxisId??n[o].yAxisKey;return a===r.id||i&&a===void 0}).reduce((o,a)=>{const{stackedData:c}=n[a],l=s?.({currentAxisId:r.id,isDefaultAxis:i,seriesXAxisId:n[a].xAxisId??n[a].xAxisKey,seriesYAxisId:n[a].yAxisId??n[a].yAxisKey}),[u,d]=c?.reduce((f,h,m)=>l&&(!l(ts(h[0],e),m)||!l(ts(h[1],e),m))?f:[Math.min(...h,f[0]),Math.max(...h,f[1])],[1/0,-1/0])??[1/0,-1/0];return[Math.min(u,o[0]),Math.max(d,o[1])]},[1/0,-1/0])},Ol=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?li("x")(e):ai(e),Tl=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?ai(e):li("y")(e),Rn={appearance:ni,ascending:ri,descending:yl,insideOut:vl,none:hn,reverse:bl},On={expand:Io,diverging:gl,none:Po,silhouette:So,wiggle:ko},ci=e=>{const{series:t,seriesOrder:n,defaultStrategy:r}=e,s=[],i={};return n.forEach(o=>{const{stack:a,stackOrder:c,stackOffset:l}=t[o];a===void 0?s.push({ids:[o],stackingOrder:Rn.none,stackingOffset:On.none}):i[a]===void 0?(i[a]=s.length,s.push({ids:[o],stackingOrder:Rn[c??r?.stackOrder??"none"],stackingOffset:On[l??r?.stackOffset??"diverging"]})):(s[i[a]].ids.push(o),c!==void 0&&(s[i[a]].stackingOrder=Rn[c]),l!==void 0&&(s[i[a]].stackingOffset=On[l]))}),s};function ui(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=b({},e[r],{valueFormatter:e[r].valueFormatter??t})}),n}const _l=(e,t)=>{const{seriesOrder:n,series:r}=e,s=ci(e),i=t??[];n.forEach(a=>{const c=r[a].data;if(c!==void 0)c.forEach((l,u)=>{i.length<=u?i.push({[a]:l}):i[u][a]=l});else if(t===void 0)throw new Error([`MUI X: bar series with id='${a}' has no data.`,"Either provide a data property to the series or use the dataset prop."].join(`
|
|
2
2
|
`))});const o={};return s.forEach(a=>{const{ids:c,stackingOffset:l,stackingOrder:u}=a,d=Hs().keys(c.map(f=>{const h=r[f].dataKey;return r[f].data===void 0&&h!==void 0?h:f})).value((f,h)=>f[h]??0).order(u).offset(l)(i);c.forEach((f,h)=>{const m=r[f].dataKey;o[f]=b({layout:"vertical"},r[f],{data:m?t.map(p=>{const g=p[m];return typeof g!="number"?0:g}):r[f].data,stackedData:d[h].map(([p,g])=>[p,g])})})}),{seriesOrder:n,stackingGroups:s,series:ui(o,a=>a==null?"":a.toLocaleString())}},di=(e,t,n)=>{const r=e.layout==="vertical",s=r?t?.colorScale:n?.colorScale,i=r?n?.colorScale:t?.colorScale,o=r?t?.data:n?.data;return i?a=>{const c=e.data[a],l=c===null?e.color:i(c);return l===null?e.color:l}:s&&o?a=>{const c=o[a],l=c===null?e.color:s(c);return l===null?e.color:l}:()=>e.color},$l={seriesType:"bar",seriesFormatter:_l,colorProcessor:di,xExtremumGetter:Ol,yExtremumGetter:Tl},on=(e,t)=>[t[0]===null?e[0]:Math.min(e[0],t[0]),t[1]===null?e[1]:Math.max(e[1],t[1])],Ll=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:s}=e;return Object.keys(t).filter(i=>{const o=t[i].xAxisId??t[i].xAxisKey;return o===n.id||o===void 0&&r}).reduce((i,o)=>{const a=s?.({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[o].xAxisId??t[o].xAxisKey,seriesYAxisId:t[o].yAxisId??t[o].yAxisKey}),c=t[o].data?.reduce((l,u,d)=>a&&!a(u,d)?l:on(l,[u.x,u.x]),[1/0,-1/0]);return on(i,c??[1/0,-1/0])},[1/0,-1/0])},Dl=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:s}=e;return Object.keys(t).filter(i=>{const o=t[i].yAxisId??t[i].yAxisKey;return o===n.id||o===void 0&&r}).reduce((i,o)=>{const a=s?.({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[o].xAxisId??t[o].xAxisKey,seriesYAxisId:t[o].yAxisId??t[o].yAxisKey}),c=t[o].data?.reduce((l,u,d)=>a&&!a(u,d)?l:on(l,[u.y,u.y]),[1/0,-1/0]);return on(i,c??[1/0,-1/0])},[1/0,-1/0])},Fl=({series:e,seriesOrder:t},n)=>({series:Object.fromEntries(Object.entries(e).map(([s,i])=>{const o=i?.datasetKeys,a=["x","y","id"].filter(l=>typeof o?.[l]!="string");if(i?.datasetKeys&&a.length>0)throw new Error([`MUI X: scatter series with id='${s}' has incomplete datasetKeys.`,`Properties ${a.map(l=>`"${l}"`).join(", ")} are missing.`].join(`
|
|
3
3
|
`));const c=o?n?.map(l=>({x:l[o.x]??null,y:l[o.y]??null,z:o.z&&l[o.z],id:l[o.id]}))??[]:i.data??[];return[s,b({},i,{data:c,valueFormatter:i.valueFormatter??(l=>`(${l.x}, ${l.y})`)})]})),seriesOrder:t}),zl=(e,t,n,r)=>{const s=r?.colorScale,i=n?.colorScale,o=t?.colorScale;return s?a=>{if(r?.data?.[a]!==void 0){const u=s(r?.data?.[a]);if(u!==null)return u}const c=e.data[a],l=c===null?e.color:s(c.z);return l===null?e.color:l}:i?a=>{const c=e.data[a],l=c===null?e.color:i(c.y);return l===null?e.color:l}:o?a=>{const c=e.data[a],l=c===null?e.color:o(c.x);return l===null?e.color:l}:()=>e.color},Nl={seriesType:"scatter",seriesFormatter:Fl,colorProcessor:zl,xExtremumGetter:Ll,yExtremumGetter:Dl},Bl=e=>{const{axis:t}=e,n=Math.min(...t.data??[]),r=Math.max(...t.data??[]);return[n,r]};function Vl(e,t,n){return t.reduce((r,s,i)=>{const[o,a]=e(s);return n&&(!n({y:o,x:null},i)||!n({y:a,x:null},i))?r:[Math.min(o,a,r[0]),Math.max(o,a,r[1])]},[1/0,-1/0])}const Hl=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:s}=e;return Object.keys(t).filter(i=>{const o=t[i].yAxisId??t[i].yAxisKey;return o===n.id||r&&o===void 0}).reduce((i,o)=>{const{area:a,stackedData:c}=t[o],l=a!==void 0,u=s?.({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[o].xAxisId??t[o].xAxisKey,seriesYAxisId:t[o].yAxisId??t[o].yAxisKey}),d=l&&n.scaleType!=="log"&&typeof t[o].baseline!="string"?p=>p:p=>[p[1],p[1]],f=Vl(d,c,u),[h,m]=f;return[Math.min(h,i[0]),Math.max(m,i[1])]},[1/0,-1/0])},Ul=(e,t)=>{const{seriesOrder:n,series:r}=e,s=ci(b({},e,{defaultStrategy:{stackOffset:"none"}})),i=t??[];n.forEach(a=>{const c=r[a].data;c!==void 0&&c.forEach((l,u)=>{i.length<=u?i.push({[a]:l}):i[u][a]=l})});const o={};return s.forEach(a=>{const{ids:c,stackingOrder:l,stackingOffset:u}=a,d=Hs().keys(c.map(f=>{const h=r[f].dataKey;return r[f].data===void 0&&h!==void 0?h:f})).value((f,h)=>f[h]??0).order(l).offset(u)(i);c.forEach((f,h)=>{const m=r[f].dataKey;o[f]=b({},r[f],{data:m?t.map(p=>{const g=p[m];return typeof g!="number"?null:g}):r[f].data,stackedData:d[h].map(([p,g])=>[p,g])})})}),{seriesOrder:n,stackingGroups:s,series:ui(o,a=>a==null?"":a.toLocaleString())}},Gl=(e,t,n)=>{const r=n?.colorScale,s=t?.colorScale;return r?i=>{const o=e.data[i],a=o===null?e.color:r(o);return a===null?e.color:a}:s?i=>{const o=t.data?.[i],a=o===null?e.color:s(o);return a===null?e.color:a}:()=>e.color},Xl={seriesType:"line",colorProcessor:Gl,seriesFormatter:Ul,xExtremumGetter:Bl,yExtremumGetter:Hl};function Ee(e,t){return typeof e=="function"?e(t):e}const Wl=(e="none")=>{if(typeof e=="function")return e;switch(e){case"none":return null;case"desc":return(t,n)=>n-t;case"asc":return(t,n)=>t-n;default:return null}},Yl=e=>{const{seriesOrder:t,series:n}=e,r={};return t.forEach(s=>{const i=ml().startAngle(2*Math.PI*(n[s].startAngle??0)/360).endAngle(2*Math.PI*(n[s].endAngle??360)/360).padAngle(2*Math.PI*(n[s].paddingAngle??0)/360).sortValues(Wl(n[s].sortingValues??"none"))(n[s].data.map(o=>o.value));r[s]=b({valueFormatter:o=>o.value.toLocaleString()},n[s],{data:n[s].data.map((o,a)=>b({},o,{id:o.id??`auto-generated-pie-id-${s}-${a}`},i[a])).map((o,a)=>b({},o,{formattedValue:n[s].valueFormatter?.(b({},o,{label:Ee(o.label,"arc")}),{dataIndex:a})??o.value.toLocaleString()}))})}),{seriesOrder:t,series:r}},Kl=e=>t=>e.data[t].color,ql={seriesType:"pie",colorProcessor:Kl,seriesFormatter:Yl},Ql=[$l,Nl,Xl,ql];function Zl(e){const t=e??Ql,n={},r={},s={},i={},o={},a={};for(let c=0;c<t.length;c+=1){const l=t[c],u=l.seriesType;n[u]=l.seriesFormatter,r[u]=l.colorProcessor,l.xExtremumGetter&&(s[u]=l.xExtremumGetter),l.yExtremumGetter&&(i[u]=l.yExtremumGetter),l.rotationExtremumGetter&&(o[u]=l.rotationExtremumGetter),l.radiusExtremumGetter&&(a[u]=l.radiusExtremumGetter)}return{seriesFormatters:n,colorProcessors:r,xExtremumGetters:s,yExtremumGetters:i,rotationExtremumGetters:o,radiusExtremumGetters:a}}function Jl(e){const{children:t,plugins:n}=e,r=v.useMemo(()=>({isInitialized:!0,data:Zl(n)}),[n]);return x.jsx(zt.Provider,{value:r,children:t})}function fi(e){const{isInitialized:t,data:n}=v.useContext(zt);if(!t)throw new Error(["MUI X: Could not find the plugin context.","It looks like you rendered your component outside of a ChartsContainer parent component."].join(`
|
|
4
4
|
`));return n.colorProcessors}function ec(e){const{isInitialized:t,data:n}=v.useContext(zt);if(!t)throw new Error(["MUI X: Could not find the plugin context.","It looks like you rendered your component outside of a ChartsContainer parent component."].join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as v,fV as L,r as u,t as m,l as F,aJ as U,j as e,a1 as C,a2 as j,a3 as f,a4 as p,v as B,a5 as y,a6 as S,bL as V,bM as z,aN as K,aH as J,J as D,am as E,B as h,K as M,ao as R,ap as A,Q as k,$,fW as Q,c4 as _,a as O,fX as G,L as P,F as W,dh as X,c as Y,dk as Z,dl as ee,dm as T,dn as se,dp as b,dq as te,dr as w,fY as ae,dx as re,dy as oe,dz as ne}from"./index-CN7VPpiB.js";import{D as ie}from"./data-table-pagination-BnQGVnmE.js";import{A as N}from"./arrow-up-down-CFrneqND.js";const de="insertTaxCategory",ce=()=>{const[{fetching:s},n]=v(L),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}=U();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(B,{...o,value:o.value??void 0,required:!0,className:t?"":y(g)})}),e.jsx(S,{})]})}),e.jsx(V,{name:"sortCode",control:a,render:({field:o,fieldState:g})=>e.jsx(z,{...o,onChange:H=>{o.onChange(Number(H))},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(K,{...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(J,{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=k({}),{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($,{...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(Q),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(_,{})})}),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:G,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=k({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($,{...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"}),I=[{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(N,{})]})},{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(N,{})]})},{id:"edit",cell:({row:s})=>e.jsx(me,{taxCategoryId:s.original.id})}],Se=()=>{const[{data:s,fetching:n,error:t},a]=O({query:ae}),{setFiltersContext:d}=u.useContext(W),r=s?.taxCategories??[],i=X({data:r,columns:I,getCoreRowModel:ne(),getPaginationRowModel:oe(),getSortedRowModel:re(),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(ie,{table:i})})}))},[d,i,l]),u.useEffect(()=>{t&&m.error("Error",{description:"Error fetching tax categories"})},[t]),e.jsx(Y,{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(Z,{children:[e.jsx(ee,{children:i.getHeaderGroups().map(x=>e.jsx(T,{children:x.headers.map(c=>e.jsx(se,{children:c.isPlaceholder?null:b(c.column.columnDef.header,c.getContext())},c.id))},x.id))}),e.jsx(te,{children:i.getRowModel().rows.length===0?e.jsx(T,{children:e.jsx(w,{colSpan:I.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{Se as TaxCategories};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as h,j as e,cY as u,eI as f,B as y,cZ as R,bm as D,F as T,a as E,c as b,L as w,c7 as F,eK as g}from"./index-CN7VPpiB.js";import{d as v}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{R as d}from"./report-commentary-row-B-uxVnyO.js";function B({year:c,setYear:m,referenceYears:x,setReferenceYears:j}){const[i,o]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(u,{opened:i,onClose:()=>o(!1),withCloseButton:!0,content:e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"Change report year",value:new Date(c,0,1),onChange:n=>n&&m(n?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),e.jsx(f,{type:"multiple",label:"Pick reference years",value:x?.map(n=>new Date(n,0,1)),onChange:n=>j(n.map(l=>l.getFullYear()).filter(l=>c!==l)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(!0),children:e.jsx(R,{className:"size-5"})})]})}const Y=()=>{const{year:c}=D(),{setFiltersContext:m}=h.useContext(T),[x,j]=h.useState(c?Number(c):new Date().getFullYear()),[i,o]=h.useState([]),[{data:n,fetching:l}]=E({query:v(g),variables:{reportYear:x,referenceYears:i}});h.useEffect(()=>{m(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(B,{year:x,setYear:j,referenceYears:i,setReferenceYears:o})}))},[x,l,m,i,o]);const p=n?.taxReport,s=p?.report,r=p?.reference??[];return e.jsx(b,{title:"Tax Report",children:l?e.jsx(w,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:s&&e.jsxs(F,{highlightOnHover:!0,fontSize:"md",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{children:x},x),e.jsx("th",{}),r.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:"Profit Before Tax"}),e.jsx("th",{children:s.profitBeforeTax.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("th",{children:a.profitBeforeTax.amount.formatted},a.year))]}),commentaryData:s.profitBeforeTax}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses By Records"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesByRecords.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.researchAndDevelopmentExpensesByRecords.amount.formatted},a.year))]}),commentaryData:s.researchAndDevelopmentExpensesByRecords}),e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses For Tax"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesForTax.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.researchAndDevelopmentExpensesForTax.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Fines"}),e.jsx("td",{children:s.fines.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.fines.amount.formatted},a.year))]}),commentaryData:s.fines}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Untaxable Gifts"}),e.jsx("td",{children:s.untaxableGifts.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.untaxableGifts.amount.formatted},a.year))]}),commentaryData:s.untaxableGifts}),e.jsxs("tr",{children:[e.jsx("td",{children:"Business Trips Excess Expenses"}),e.jsx("td",{children:s.businessTripsExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.businessTripsExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Salary Excess Expenses"}),e.jsx("td",{children:s.salaryExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.salaryExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Reserves"}),e.jsx("td",{children:s.reserves.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.reserves.amount.formatted},a.year))]}),commentaryData:s.reserves}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Nontaxable Linkage"}),e.jsx("td",{children:s.nontaxableLinkage.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.nontaxableLinkage.amount.formatted},a.year))]}),commentaryData:s.nontaxableLinkage}),e.jsxs("tr",{children:[e.jsx("th",{children:"Taxable Income"}),e.jsx("th",{children:s.taxableIncome.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.taxableIncome.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Tax Rate"}),e.jsxs("td",{children:[(s.taxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.taxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Income with Special Tax Rate"}),e.jsx("td",{children:s.specialTaxableIncome.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.specialTaxableIncome.amount.formatted},a.year))]}),commentaryData:s.specialTaxableIncome}),e.jsxs("tr",{children:[e.jsx("td",{children:"Special Tax Rate"}),e.jsxs("td",{children:[(s.specialTaxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.specialTaxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]})]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Annual Tax Expense"}),e.jsx("th",{children:s.annualTaxExpense.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.annualTaxExpense.formatted},t.year)),e.jsx("td",{})]})})]})})})};export{Y as TaxReport};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as M,dB as J,t as C,r as s,i as K,l as Q,dC as X,dD as Y,W as S,dE as E,j as e,J as R,am as G,B as v,an as _,K as q,ao as U,ap as W,at as Z,au as ee,av as se,aw as te,ax as ne,dF as ae,dG as re,dH as H,dI as $,c4 as ce,dJ as z,dK as ie,X as B,a0 as P,L as A,dL as le,g as oe,Y as de,Z as ue,dM as me,bj as he,b6 as xe,dN as je,G as k,dO as L,Q as pe,bJ as fe,D as ge,$ as ye,bc as ve,d9 as De,dk as be,dl as Ce,dm as O,dn as g,dq as Ne,dr as y,as as we,b_ as Ie,F as Me,n as Te}from"./index-CN7VPpiB.js";import{s as V}from"./subMonths-C1UIPrOU.js";const Fe=()=>{const[{data:u,fetching:o,error:c},x]=M({query:J});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}},Se="IssueMonthlyDocuments",Ee=()=>{const[{fetching:u},o]=K(X),c=s.useCallback(async x=>{const a="Error issuing monthly documents",i=Se;C.loading("Issuing documents",{id:i});try{const t=await o(x),d=Q(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:Y,variables:{issueMonth:u,clientId:i}}),j=s.useCallback(n=>{t(n),h()},[h,t]);return s.useEffect(()=>{i!==""&&d&&(c(S(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(_,{})})}),e.jsxs(q,{className:"w-[400px] max-w-screen-md",children:[e.jsx(U,{children:e.jsx(W,{children:"Select document recipient"})}),e.jsxs(Z,{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 Be({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(H,{children:[e.jsx($,{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(z,{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(B,{children:e.jsxs(P,{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(B,{className:"h-fit",children:[e.jsx(de,{children:e.jsx(ue,{children:"Document Preview"})}),e.jsx(P,{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 Pe=({drafts:u})=>{const[o,c]=s.useState(u.map(r=>S(E,r))),x=k(V(new Date,1),"yyyy-MM-dd"),[a,i]=s.useState(x),[{data:t},d]=M({query:L,variables:{issueMonth:a},pause:!0});s.useEffect(()=>{t?.clientMonthlyChargesDrafts&&c(t.clientMonthlyChargesDrafts.map(r=>S(E,r)))},[t,c]),s.useEffect(()=>{d()},[a,d]);const h=pe({values:{generateDocumentsInfo:o}}),{issueDocuments:j}=Ee(),{openContracts:n}=Fe(),{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},F)=>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(H,{children:[e.jsx($,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>D(F),children:e.jsx(we,{size:16})})}),e.jsx(z,{children:e.jsx("p",{children:"Remove document"})})]}),e.jsx(Be,{draft:m,onApprove:b=>{h.setValue(`generateDocumentsInfo.${F}`,b,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),w(F,{...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:L,variables:{issueMonth:k(V(new Date,1),"yyyy-MM-dd")}});return s.useEffect(()=>{o?.clientMonthlyChargesDrafts||u(null)},[o,u]),c?e.jsx(Te,{}):e.jsx(Pe,{drafts:o?.clientMonthlyChargesDrafts??[]})};export{Re as IssueDocuments};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,a1 as C,a2 as p,a3 as S,a4 as y,aN as v,a6 as I,v as L,i as D,fZ as H,r as u,t as m,l as E,J as M,am as R,B as x,c4 as _,K as T,ao as $,ap as A,a as q,f_ as z,L as O,Q as P,$ as K,aa as Q,f$ as V,F as J,dh as Z,c as G,dk as W,dl as X,dm as b,dn as Y,dp as w,dq as ee,dr as g,g0 as se,dx as te,dy as oe,dz as re}from"./index-CN7VPpiB.js";import{D as ne}from"./data-table-pagination-BnQGVnmE.js";import{A as k}from"./arrow-up-down-CFrneqND.js";function U({isInsert:s,formManager:n}){const{control:o}=n;return e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"key",control:o,disabled:!s,rules:{required:"Required",validate:{positive:t=>Number(t)>0||"Key must be a positive number",integer:t=>Number.isInteger(Number(t))||"Key must be an integer"}},render:({field:t})=>e.jsxs(p,{children:[e.jsx(S,{children:"Key"}),e.jsx(y,{children:e.jsx(v,{...t,value:t.value??void 0,hideControls:!0,decimalScale:0,thousandSeparator:"",required:!0})}),e.jsx(I,{})]})}),e.jsx(C,{name:"name",control:o,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:t})=>e.jsxs(p,{children:[e.jsx(S,{children:"Name"}),e.jsx(y,{children:e.jsx(L,{...t,value:t.value??void 0,required:!0})}),e.jsx(I,{})]})}),e.jsx(C,{name:"defaultIrsCode",control:o,render:({field:t})=>e.jsxs(p,{children:[e.jsx(S,{children:"Default IRS Code"}),e.jsx(y,{children:e.jsx(v,{...t,value:t.value??void 0,hideControls:!0,decimalScale:0})}),e.jsx(I,{})]})})]})}const ae="updateSortCode",de=()=>{const[{fetching:s},n]=D(H),o=u.useCallback(async t=>{const d=`Error updating sort code ID [${t.key}]`,r=`${ae}-${t.key}`;m.loading("Updating Sort Code...",{id:r});try{const a=await n(t),i=E(a,d,r,"updateSortCode");if(i)return m.success("Success",{id:r,description:"SortCode updated"}),i.updateSortCode}catch(a){console.error(`${d}: ${a}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}return!1},[n]);return{fetching:s,updateSortCode:o}};function ie({sortCodeKey:s,onAdd:n}){const[o,t]=u.useState(!1);return e.jsxs(M,{open:o,onOpenChange:t,children:[e.jsx(R,{asChild:!0,children:e.jsx(x,{variant:"outline",size:"icon",children:e.jsx(_,{})})}),e.jsxs(T,{className:"w-[400px] max-w-screen-md",children:[e.jsx($,{children:e.jsx(A,{children:"Edit Sort Code"})}),e.jsx(le,{sortCodeKey:s,close:()=>t(!1),onAdd:n})]})]})}function le({sortCodeKey:s,close:n,onAdd:o}){const[{data:t,fetching:d}]=q({query:z,variables:{key:s}}),r=t?.sortCode;return!r&&!d&&m.error("Error",{description:"Couldn't find sort code"}),d?e.jsx(O,{className:"h-10 w-10 animate-spin"}):r?e.jsx(ce,{sortCode:r,close:n,onAdd:o}):e.jsx("div",{children:"Sort code not found"})}function ce({sortCode:s,close:n,onAdd:o}){const t=P({defaultValues:s}),{handleSubmit:d,formState:{dirtyFields:r}}=t,{updateSortCode:a,fetching:i}=de(),l=({key:c,...B})=>{const h=Q(B,r);if(h&&Object.keys(h).length>0){let N;if(h.defaultIrsCode){const f=h.defaultIrsCode,j=Number(f);if(!Number.isInteger(j)||j<2||j>9999)throw new Error(`Invalid IRS code: ${f}`);N=j}a({fields:{...h,defaultIrsCode:N},key:s.key}).then(f=>{f&&(o?.(s.key),n())})}};return e.jsx(K,{...t,children:e.jsxs("form",{onSubmit:d(l),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(U,{isInsert:!1,formManager:t})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(x,{type:"submit",disabled:i,children:"Update"})})]})})}const ue="addSortCode",me=()=>{const[{fetching:s},n]=D(V),o=u.useCallback(async t=>{const d=`Error adding new sort code [${t.name}]`,r=`${ue}-${t.name}`;m.loading("Adding sort code",{id:r});try{const a=await n(t);E(a,d,r)&&m.success("Success",{id:r,description:`"${t.name}" sort code was successfully added`})}catch(a){console.error(`${d}: ${a}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,addSortCode:o}};function xe({onAdd:s}){const[n,o]=u.useState(!1);return e.jsxs(M,{open:n,onOpenChange:o,children:[e.jsx(R,{asChild:!0,children:e.jsx(x,{children:"Add Sort Code"})}),e.jsxs(T,{className:"w-[90vw] max-w-screen-md",children:[e.jsx($,{children:e.jsx(A,{children:"Add New Sort Code"})}),e.jsx(he,{close:()=>o(!1),onAdd:s})]})]})}function he({close:s,onAdd:n}){const o=P({}),{handleSubmit:t}=o,{addSortCode:d,fetching:r}=me(),a=i=>{i.key&&=parseInt(i.key.toString()),i.defaultIrsCode&&=parseInt(i.defaultIrsCode.toString()),d(i).then(()=>{s(),n?.()})};return e.jsx(K,{...o,children:e.jsxs("form",{onSubmit:t(a),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(U,{isInsert:!0,formManager:o})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(x,{type:"submit",disabled:r,children:"Add Sort Code"})})]})})}const F=[{id:"key",accessorKey:"key",cell:({row:s})=>e.jsx(g,{children:s.original.key}),header:({column:s})=>e.jsxs(x,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Key",e.jsx(k,{})]})},{id:"name",accessorKey:"name",cell:({row:s})=>e.jsx(g,{children:s.original.name}),header:({column:s})=>e.jsxs(x,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Name",e.jsx(k,{})]})},{id:"defaultIrsCode",accessorKey:"defaultIrsCode",cell:({row:s})=>e.jsx(g,{className:"flex flex-wrap gap-1 p-1",children:s.original.defaultIrsCode&&e.jsx(x,{variant:"outline",disabled:!0,className:"p-1 w-15",children:s.original.defaultIrsCode})}),header:"Default IRS Code"},{id:"edit",cell:({row:s})=>e.jsx(ie,{sortCodeKey:s.original.key,onAdd:s.original.refetchSortCodes})}],Ce=()=>{const[{data:s,fetching:n,error:o},t]=q({query:se}),{setFiltersContext:d}=u.useContext(J),r=u.useMemo(()=>s?.allSortCodes?.map(l=>({...l,refetchSortCodes:t}))??[],[s?.allSortCodes,t]),a=Z({data:r,columns:F,getCoreRowModel:re(),getPaginationRowModel:oe(),getSortedRowModel:te(),initialState:{pagination:{pageSize:100}}}),i=a.getPageOptions();return u.useEffect(()=>{d(e.jsx("div",{className:"flex items-center justify-end gap-10 space-x-2 py-4",children:e.jsx(ne,{table:a})}))},[d,a,i]),u.useEffect(()=>{o&&(console.error("Error fetching sort codes",o),m.error("Error",{description:"Error fetching sort codes"}))},[o]),e.jsx(G,{title:`Sort Codes (${r.length})`,description:"All sort codes",headerActions:e.jsx(xe,{onAdd:()=>t()}),children:n?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(O,{className:"h-10 w-10 animate-spin mr-2"})}):e.jsx("div",{className:"flex flex-col gap-4 rounded-md border",children:e.jsxs(W,{children:[e.jsx(X,{children:a.getHeaderGroups().map(l=>e.jsx(b,{children:l.headers.map(c=>e.jsx(Y,{children:c.isPlaceholder?null:w(c.column.columnDef.header,c.getContext())},c.id))},l.id))}),e.jsx(ee,{children:a.getRowModel().rows.length===0?e.jsx(b,{children:e.jsx(g,{colSpan:F.length,className:"text-center py-8",children:"No sort codes found"})}):a.getRowModel().rows.map(l=>e.jsx(b,{children:l.getVisibleCells().map(c=>e.jsx(g,{children:w(c.column.columnDef.cell,c.getContext())},c.id))},l.id))})]})})})};export{Ce as SortCodes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as E,k,r as o,t as j,l as M,a as v,m as F,j as e,n as A,o as T,B as C,p as y,q as z,u as S,s as D,v as P,F as L,w as $,T as O,P as R,b as q,c as U,L as _,x as Q,R as N,y as V}from"./index-CN7VPpiB.js";import{B as H}from"./business-header-DjutqTRC.js";import{C as K,M as G}from"./Checkbox-lfqFDKZM.js";import"./building-2-Bqvbwz7Q.js";const J="mergeBusinesses",W=()=>{const[{fetching:l},u]=E(k),m=o.useCallback(async c=>{const d=`Error merging into business ID [${c.targetBusinessId}]`,t=`${J}-${c.targetBusinessId}`;j.loading("Merging Businesses",{id:t});try{const a=await u(c),s=M(a,d,t);if(s)return j.success("Success",{id:t,description:"Businesses merged"}),s.mergeBusinesses.id}catch(a){console.error(`${d}: ${a}`),j.error("Error",{id:t,description:d,duration:1e5,closeButton:!0})}},[u]);return{fetching:l,mergeBusinesses:m}};function X({businessIds:l,onDone:u,resetMerge:m}){const{mergeBusinesses:c,fetching:d}=W(),t=Array.from(new Set(l)),[{data:a,fetching:s}]=v({query:F,variables:{businessIds:t}}),[x,p]=o.useState(a?.businesses[0]),n=a?.businesses.length!==t.length&&"Some businesses were not Found"||void 0,r=a?.businesses||[],f=o.useCallback(async()=>{if(!x){j.error("Error",{description:"No main business selected"});return}if(t.length<2){j.error("Error",{description:"At least 2 businesses are required to execute a merge"});return}return await c({targetBusinessId:x.id,businessIdsToMerge:t.filter(g=>g!==x.id)}),m(),u()},[x,t,c,u,m]);return e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx(A,{})}),!s&&n&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx("h3",{className:"sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900",children:n})}),!s&&!n&&e.jsxs(e.Fragment,{children:[e.jsxs("table",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:"Main"}),r.map(g=>e.jsx("td",{children:e.jsx("div",{className:"flex items-center justify-center mx-2 px-2 py-2 border-2 border-b-0 rounded-t-xl",children:e.jsx(K,{checked:g.id===x?.id,size:"xl",onClick:()=>{p(g)}})})},g.id))]}),e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),r.map(g=>e.jsx("td",{children:g.name},g.id))]})]}),e.jsxs("div",{className:"flex justify-center gap-5 mt-5",children:[e.jsx("button",{type:"button",className:" text-white bg-blue-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-blue-600 rounded-sm text-lg",disabled:s||d,onClick:f,children:"Accept"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:u,children:"Cancel"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:()=>{m(),u()},children:"Reset Merge"})]})]})]})}function Y(l){const[u,{close:m,open:c}]=T(!1),{selected:d,resetMerge:t}=l,a=new Set(d.map(({id:r})=>r)),s=a.size>=1,[x,p]=o.useState(s?"default":"outline");o.useEffect(()=>{p(s?"default":"outline")},[s]);const n=o.useCallback(()=>{m(),d.map(({onChange:r})=>r())},[d,m]);return e.jsxs(e.Fragment,{children:[e.jsx(C,{onClick:()=>{s&&c()},disabled:!s,variant:x,className:y("size-7.5",s?" bg-blue-500 hover:bg-blue-500/90":""),size:"icon",children:e.jsx(G,{className:"size-5"})}),e.jsx(z,{opened:u,onClose:m,size:"auto",centered:!0,children:e.jsx(X,{businessIds:Array.from(a),onDone:n,resetMerge:t})})]})}function Z({activePage:l,setPage:u,totalPages:m=1,businessName:c,setBusinessName:d}){const{get:t,set:a}=S(),[s,x]=o.useState(c);o.useEffect(()=>{const n=l>1?l.toFixed(0):void 0,r=t("page");n!==r&&n!=="1"&&a("page",n)},[l,t,a]),o.useEffect(()=>{const n=setTimeout(()=>{d(s)},600);return()=>{clearTimeout(n)}},[s,d]);const p=n=>{x(n)};return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(D,{className:"flex-auto",value:l,onChange:u,total:m}),e.jsx(P,{className:"w-72",placeholder:"Business Name",defaultValue:c??void 0,onChange:n=>p(n.target.value===""?void 0:n.target.value)})]})}const ie=()=>{const{get:l}=S(),[u,m]=o.useState(!1),[c,d]=o.useState(l("page")?Number(l("page")):1),[t,a]=o.useState(l("name")?l("page"):void 0),{setFiltersContext:s}=o.useContext(L),[{data:x,fetching:p}]=v({query:V,variables:{page:c,limit:100,name:t}}),n=$(),[r,f]=o.useState([]),g=o.useCallback((i,h)=>{r.map(b=>b.id).includes(i)?f(r.filter(b=>b.id!==i)):f([...r,{id:i,onChange:h}])},[r]);function w(){f([])}o.useEffect(()=>{s(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(Z,{activePage:c,setPage:d,businessName:t,setBusinessName:a,totalPages:x?.allBusinesses?.pageInfo.totalPages}),e.jsx(O,{label:"Expand all businesses",children:e.jsx(C,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>m(i=>!i),children:u?e.jsx(R,{className:"size-5"}):e.jsx(q,{className:"size-5"})})}),e.jsx(Y,{selected:r,resetMerge:w})]}))},[x,c,t,u,s,d,a,m,r]);const B=x?.allBusinesses?.nodes.filter(i=>i.__typename==="LtdFinancialEntity").sort((i,h)=>i.name.toLowerCase()>h.name.toLowerCase()?1:-1)??[],I=new Set(r.map(i=>i.id));return e.jsx(U,{title:`Businesses (${B.length})`,description:"All businesses",children:p?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(_,{className:y("h-10 w-10 animate-spin mr-2")})}):e.jsx("div",{className:"space-y-2",children:B.map(i=>e.jsx("div",{className:"group relative border rounded-lg hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"pl-4 flex items-center",children:e.jsx(Q,{checked:I.has(i.id),onCheckedChange:()=>{g(i.id,()=>{})},className:"h-4 w-4 rounded border-gray-300 cursor-pointer",onClick:h=>h.stopPropagation()})}),e.jsx("div",{role:"button",tabIndex:0,className:"flex-1 cursor-pointer",onClick:()=>{n(N.BUSINESSES.DETAIL(i.id))},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n(N.BUSINESSES.DETAIL(i.id)))},children:e.jsx(H,{data:i})})]})},i.id))})})};export{ie as Businesses};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{z as Q,r as b,ca as U,j as e,J as W,am as z,B as g,cZ as R,K as G,ao as X,ap as Z,bc as T,aL as J,b2 as A,at as k,au as O,av as E,aw as M,ax as D,cQ as K,W as j,bk as w,eP as I,eQ as ee,eR as S,eS as se,eT as L,eU as P,eV as B,eW as N,eX as p,eY as Y,eZ as V,dL as re,e_ as te,bf as ae,bg as le,bh as v,e$ as $,F as de,a as ne,X as oe,Y as ce,a0 as ie,f0 as me}from"./index-CN7VPpiB.js";import{B as ue}from"./building-2-Bqvbwz7Q.js";import{S as xe}from"./save-qyt28nOG.js";/**
|
|
2
2
|
* @license lucide-react v0.546.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=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(Q,{open:n,onOpenChange:r,children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),"מסננים",e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full",children:[h," • ",s]})]})}),e.jsxs(G,{className:"sm:max-w-md",dir:"rtl",children:[e.jsx(X,{children:e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(R,{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(me,{className:"h-4 w-4"}),"בחירת עסק"]}),e.jsx(J,{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(A,{className:"h-4 w-4"}),"שנת דיווח"]}),e.jsxs(O,{value:s,onValueChange:c,children:[e.jsx(k,{id:"year-select",children:e.jsx(E,{})}),e.jsx(M,{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(A,{className:"h-4 w-4"}),"שנת השוואה"]}),e.jsxs(O,{value:l,onValueChange:x=>o(x==="none"?void 0:x),children:[e.jsx(k,{id:"reference-year-select",children:e.jsx(E,{})}),e.jsxs(M,{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 u=({label:t,value:d,code:s,referenceValue:c,showEmptyFields:l,showChange:o=!1})=>{const n=h=>l?!0:!r(h),r=h=>!h||h.trim()===""||h==="0"||h==="0.00",a=(h,x)=>{if(!x)return null;const f=q=>Number.parseFloat(q.replace(/[,\s₪]/g,""))||0,H=f(h),F=f(x);return F===0?null:(H-F)/F*100};if(!n(d))return null;const i=o?a(d,c):null;return e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-200",dir:"rtl",children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[t," ",s&&`(${s})`]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium ${r(d)?"text-gray-400":""}`,children:r(d)?"0":d}),i!==null&&e.jsxs("span",{className:`text-xs px-1 py-0.5 rounded ${i>0?"text-green-700 bg-green-100":i<0?"text-red-700 bg-red-100":"text-gray-700 bg-gray-100"}`,children:[i>0?"+":"",i.toFixed(1),"%"]})]})]})},m=({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(u,{label:o,value:K(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(I,t).balanceSheet||[],n=j(I,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(m,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(m,{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(m,{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(m,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(m,{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(m,{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(m,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(m,{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(m,{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(m,{codes:l,referenceCodes:n,code:a,showEmptyFields:s},a)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(m,{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(m,{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(m,{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 L.Shekels:return"שקלים";case L.Dollars:return"דולרים";default:return""}},Fe=t=>{switch(t){case B.DoubleEntry:return"כפולה";case B.SingleEntry:return"חד-צידית";default:return""}},Te=t=>{switch(t){case P.Computerized:return"ממוחשב";case P.Manual:return"ידני";default:return""}},De=t=>{switch(t){case N.Option_1:return"חלופה 1";case N.Option_2Adjustments:return"התאמות חשבונאיות למי שיישם את חלופה 2 בהוראת ביצוע 7/2010";case N.Option_3Adjustments:return"התאמות חשבונאיות למי שיישם את חלופה 3 בהוראת ביצוע 7/2010";case N.None:return"ללא חלופה";default:return""}},Re=t=>{switch(t){case p.Unqualified:return"נוסח אחיד (בלתי מסוייג)";case p.UnqualifiedWithGoingConcern:return"בנוסח אחיד עם הפניית תשומת לב להערת עסק חי";case p.UnqualifiedWithOtherEmphases:return"בנוסח אחיד עם הפניות תשומת לב אחרת";case p.Qualified:return"הסתייגות";case p.Adverse:return"שלילית";case p.Disclaimer:return"המנעות";case p.None:return"אין חוות דעת";default:return""}},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(u,{label:"השם הרשום",value:c.name,showEmptyFields:!0}),e.jsx(u,{label:"תיאור העיסוק המדווח",value:s.businessDescription??"",showEmptyFields:!0}),e.jsx(u,{label:"מספר זהות",value:s.idNumber,showEmptyFields:!0}),e.jsx(u,{label:"מספר תיק",value:s.taxFileNumber,showEmptyFields:!0}),e.jsx(u,{label:'תיק מדווח למע"מ',value:s.vatFileNumber??"",showEmptyFields:!0}),e.jsx(u,{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(u,{value:Ce(s.businessType),label:"סוג העסק המדווח",showEmptyFields:!0}),e.jsx(u,{label:"שיטת דיווח",value:Se(s.reportingMethod),showEmptyFields:!0}),s.reportingMethod===S.DollarRegulations&&e.jsx(u,{label:"מטבע הסכומים",value:we(s.currencyType),showEmptyFields:!0}),e.jsx(u,{label:"הסכום באלפים",value:C(s.amountsInThousands),showEmptyFields:!0}),e.jsx(u,{label:"שיטת חשבונאות",value:Fe(s.accountingMethod),showEmptyFields:!0}),e.jsx(u,{label:"הנהלת חשבונות",value:Te(s.accountingSystem),showEmptyFields:!0}),e.jsx(u,{label:"חייב ברישום תוכנה",value:C(!!s.softwareRegistrationNumber),showEmptyFields:!0}),s.softwareRegistrationNumber&&e.jsx(u,{label:"מספר תעודת רישום",value:s.softwareRegistrationNumber,showEmptyFields:!0}),e.jsx(u,{label:"דוח בגין שותפות",value:C(!!s.isPartnership),showEmptyFields:!0}),s.isPartnership&&e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"מספר שותפים",value:s.partnershipCount?.toString()??"",showEmptyFields:!0}),e.jsx(u,{label:"חלקי ברווחי השותפות",value:`${s.partnershipProfitShare}%`,showEmptyFields:!0})]}),e.jsx(u,{label:"יישום תקני חשבונאות (IFRS)",value:C(!!s.ifrsImplementationYear||!!s.ifrsReportingOption),showEmptyFields:!0}),(!!s.ifrsImplementationYear||!!s.ifrsReportingOption)&&e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"החל משנת המס",value:s.ifrsImplementationYear??"",showEmptyFields:!0}),e.jsx(u,{label:"דווח בחלופה",value:De(s.ifrsReportingOption),showEmptyFields:!0})]}),e.jsx(u,{label:"מספר ענף כלכלי של המדווח",value:s.industryCode,showEmptyFields:!0}),e.jsx(u,{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(V,s),r=j(V,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(m,{codes:o,referenceCodes:r,code:i,showEmptyFields:l},i)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(m,{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(m,{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(m,{codes:o,referenceCodes:r,code:i,showEmptyFields:l},i)),e.jsx("div",{className:"border-2 rounded-md border-gray-300",children:e.jsx(m,{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]}],_={red:{header:"text-red-700",sum:"bg-red-50 border-red-200"},yellow:{header:"text-yellow-700",sum:"bg-yellow-50 border-yellow-200"},emerald:{header:"text-emerald-700",sum:"bg-emerald-50 border-emerald-200"},sky:{header:"text-sky-700",sum:"bg-sky-50 border-sky-200"},violet:{header:"text-violet-700",sum:"bg-violet-50 border-violet-200"},pink:{header:"text-pink-700",sum:"bg-pink-50 border-pink-200"}};function Ie({data:t,referenceData:d,showEmptyFields:s=!1}){const{taxAdjustment:c}=j($,t),o=j($,d)?.taxAdjustment||[];return e.jsx(w,{value:"taxAdjustment",className:"border rounded-md p-4",children:e.jsxs("div",{className:"space-y-6",dir:"rtl",children:[e.jsx("h3",{className:"text-lg font-bold border-b pb-2",children:'נתוני דו"ח התאמה למס'}),e.jsx("div",{className:"bg-emerald-50 p-4 rounded-md border-2 border-emerald-200",children:e.jsx(m,{codes:c,referenceCodes:o,code:100,showEmptyFields:s})}),Me.map(n=>{const{header:r,sum:a}=_[n.color]||_.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(m,{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(m,{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(ye,{data:o,referenceData:n,showEmptyFields:i})]})]})}function Ye(){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:ue,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{Ye 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=Q("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(W,{open:n,onOpenChange:r,children:[e.jsx(z,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),"מסננים",e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full",children:[h," • ",s]})]})}),e.jsxs(G,{className:"sm:max-w-md",dir:"rtl",children:[e.jsx(X,{children:e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(R,{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(J,{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(A,{className:"h-4 w-4"}),"שנת דיווח"]}),e.jsxs(k,{value:s,onValueChange:c,children:[e.jsx(O,{id:"year-select",children:e.jsx(E,{})}),e.jsx(M,{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(A,{className:"h-4 w-4"}),"שנת השוואה"]}),e.jsxs(k,{value:l,onValueChange:x=>o(x==="none"?void 0:x),children:[e.jsx(O,{id:"reference-year-select",children:e.jsx(E,{})}),e.jsxs(M,{children:[e.jsx(D,{value:"none",children:"ללא"},"none"),C.map(x=>e.jsx(D,{value:x,children:x},x))]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["זמינות נתונים: ",C.join(", ")]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(g,{variant:"outline",onClick:()=>r(!1),children:"ביטול"}),e.jsx(g,{onClick:()=>r(!1),children:"אישור"})]})]})]})]})}const m=({label:t,value:d,code:s,referenceValue:c,showEmptyFields:l,showChange:o=!1})=>{const n=h=>l?!0:!r(h),r=h=>!h||h.trim()===""||h==="0"||h==="0.00",a=(h,x)=>{if(!x)return null;const f=q=>Number.parseFloat(q.replace(/[,\s₪]/g,""))||0,H=f(h),F=f(x);return F===0?null:(H-F)/F*100};if(!n(d))return null;const i=o?a(d,c):null;return e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-200",dir:"rtl",children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[t," ",s&&`(${s})`]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium ${r(d)?"text-gray-400":""}`,children:r(d)?"0":d}),i!==null&&e.jsxs("span",{className:`text-xs px-1 py-0.5 rounded ${i>0?"text-green-700 bg-green-100":i<0?"text-red-700 bg-red-100":"text-gray-700 bg-gray-100"}`,children:[i>0?"+":"",i.toFixed(1),"%"]})]})]})},u=({codes:t,referenceCodes:d,code:s,showEmptyFields:c})=>{const{value:l,label:o}=b.useMemo(()=>{const r=t.find(a=>a.code===s);return{value:r?.amount||0,label:r?.label||"לא זוהה קוד"}},[t,s]),n=b.useMemo(()=>d?.find(r=>r.code===s)?.amount.toString()||"",[d,s]);return e.jsx(m,{label:o,value:K(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(I,t).balanceSheet||[],n=j(I,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 L.Shekels:return"שקלים";case L.Dollars:return"דולרים";default:return""}},Fe=t=>{switch(t){case P.DoubleEntry:return"כפולה";case P.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 ke=[{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}],Oe=[{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(Y,s),r=j(Y,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]})]}),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)),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})}),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))]})})}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]}],_={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}=_[n.color]||_.red;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[e.jsx("h4",{className:"font-bold mb-4 "+r,children:n.title}),e.jsx("div",{className:"space-y-2",children:n.codes.map(i=>e.jsx(u,{codes:c,referenceCodes:o,code:i,showEmptyFields:s},i))})]}),n.sumCode&&e.jsx("div",{className:"p-4 rounded-md border-2 "+a,children:e.jsx(u,{codes:c,referenceCodes:o,code:n.sumCode,showEmptyFields:s})})]},n.title)})]})})}function Le({data:t,referenceData:d,businessInfo:s,selectedYear:c,referenceYear:l}){const o=j($,t),n=j($,d),[r,a]=b.useState("header"),[i,h]=b.useState(!0);return e.jsxs("div",{className:"p-4 border-gray-300",dir:"rtl",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g,{variant:i?"outline":"default",size:"sm",onClick:()=>h(!i),className:"flex items-center gap-2",children:[i?e.jsx(be,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"}),i?"הסתר שדות ריקים":"הצג שדות ריקים"]}),e.jsx("span",{className:"text-sm text-gray-500",children:i?"מציג את כל השדות":"מציג רק שדות עם נתונים"})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(te,{className:"h-4 w-4"}),"הורד"]}),e.jsxs(g,{variant:"outline",className:"flex items-center gap-2",children:[e.jsx(xe,{className:"h-4 w-4"}),"שמור"]})]})]}),e.jsxs(ae,{value:r,onValueChange:a,className:"w-full",children:[e.jsxs(le,{className:"grid grid-cols-4 w-full",dir:"rtl",children:[e.jsx(v,{value:"header",children:"פרטים מזהים"}),e.jsx(v,{value:"profitLoss",children:"רווח והפסד"}),e.jsx(v,{value:"taxAdjustment",children:"התאמה למס"}),e.jsx(v,{value:"balanceSheet",children:"מאזן"})]}),e.jsx(Ae,{data:o,businessInfo:s}),e.jsx(Ee,{selectedYear:c,referenceYear:l,data:o,referenceData:n,showEmptyFields:i}),e.jsx(Ie,{data:o,referenceData:n,showEmptyFields:i}),e.jsx(Ce,{data:o,referenceData:n,showEmptyFields:i})]})]})}function _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(Pe,{fetching:a,data:r,selectedBusiness:d,selectedYear:c,referenceYear:o})})]})})}function Pe({fetching:t,data:d,selectedBusiness:s,selectedYear:c,referenceYear:l}){if(t)return e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"טוען נתונים..."})});if(!c||!s)return e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"יש לבחור עסק ושנת דיווח"})});const o=d?.shaam6111.data;return o?e.jsx(Le,{data:o,businessInfo:d.shaam6111.business,selectedBusiness:s,selectedYear:c,referenceYear:l}):e.jsx("div",{className:"container mx-auto p-8 text-center",dir:"rtl",children:e.jsx("p",{className:"text-lg text-gray-600",children:"אין נתונים זמינים עבור העסק והשנה שנבחרו"})})}export{_e as Shaam6111Report};
|