@accounter/client 0.0.8-alpha-20251027003629-e64c01111f4a4cec34d5ca9a84e02646b69f80b1 → 0.0.8-alpha-20251027135337-f79bd33d242a52dedb78869440eb1332cecb516f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-DjollWGm.js → Checkbox-DpgoGNEh.js} +2 -2
  3. package/dist/assets/{Progress-AG7ZMAJu.js → Progress-CYZqv7SW.js} +1 -1
  4. package/dist/assets/{Typography-Cd0kk1vc.js → Typography-CkIoreka.js} +1 -1
  5. package/dist/assets/{accordion-s9Ku08QQ.js → accordion-CaHOdrRP.js} +1 -1
  6. package/dist/assets/accountant-approvals-DSj77RHk.js +1 -0
  7. package/dist/assets/{all-charges-BQcsaMon.js → all-charges-7emf__4c.js} +1 -1
  8. package/dist/assets/{arrow-up-down-J-i_WnHP.js → arrow-up-down-B0c1T401.js} +1 -1
  9. package/dist/assets/{building-2-B92gXbOj.js → building-2-Cgw5U9px.js} +1 -1
  10. package/dist/assets/business-gIm-2ScS.js +37 -0
  11. package/dist/assets/{business-header-Cr5S_Mz7.js → business-header-Dr-cPjxi.js} +1 -1
  12. package/dist/assets/{business-transactions-single-BD4bLNv2.js → business-transactions-single-CyFYlmJ1.js} +1 -1
  13. package/dist/assets/{business-trip-DYkKK6Gk.js → business-trip-gN2mmMZs.js} +1 -1
  14. package/dist/assets/{charges-filters-CoFkjW00.js → charges-filters-BFXTNJlR.js} +1 -1
  15. package/dist/assets/{charges-ledger-validation-D_cg1bn-.js → charges-ledger-validation-PLL72LF_.js} +1 -1
  16. package/dist/assets/{chart-CQ9Opsuw.js → chart-CW1hdLVW.js} +1 -1
  17. package/dist/assets/{data-table-pagination-CN5CnGZV.js → data-table-pagination-DGMzd5Ur.js} +1 -1
  18. package/dist/assets/{editable-business-trip--kNXo9tv.js → editable-business-trip-DO2VVnpQ.js} +2 -2
  19. package/dist/assets/{index-fwXllLnH.js → index-1WpeqtCj.js} +1 -1
  20. package/dist/assets/{index-DepseT6D.js → index-B9J1vUWt.js} +1 -1
  21. package/dist/assets/{index-CC_fLCrA.js → index-BKOjJ4S2.js} +1 -1
  22. package/dist/assets/{index-CS40C1qp.js → index-BNVZgIhA.js} +1 -1
  23. package/dist/assets/{index-DDGgWxhe.js → index-BgaZ9SWH.js} +2 -2
  24. package/dist/assets/{index-Cc4HfGhd.js → index-C1Lhx64B.js} +1 -1
  25. package/dist/assets/{index-C66UYUUf.js → index-C3mMRi14.js} +1 -1
  26. package/dist/assets/{index-BSmbKLQe.js → index-CNYfsMvN.js} +2 -2
  27. package/dist/assets/{index-BNtiIPMq.js → index-CWKSy3gx.js} +1 -1
  28. package/dist/assets/{index-Cw9zbBbJ.js → index-ClQMK6pH.js} +7 -7
  29. package/dist/assets/{index-Au8Djmrz.js → index-CwSHI3TR.js} +1 -1
  30. package/dist/assets/{index-hr9hQe_a.js → index-DIilK_xX.js} +1 -1
  31. package/dist/assets/{index-DVbMTBK4.js → index-DLcR6D3A.js} +1 -1
  32. package/dist/assets/{index-DzNfXERJ.js → index-DVls0wZI.js} +1 -1
  33. package/dist/assets/{index-n3bzj3IE.js → index-DkoK59wU.js} +2 -2
  34. package/dist/assets/{index-C3pV-XkD.js → index-DmeswmlH.js} +2 -2
  35. package/dist/assets/{index-DNTlYcfH.js → index-DnJZ0kU3.js} +2 -2
  36. package/dist/assets/{index-DS_RReq_.js → index-DpWWjU9o.js} +1 -1
  37. package/dist/assets/{index--XWh2RKR.js → index-DuovWEWg.js} +1 -1
  38. package/dist/assets/{index-BWpLPx22.js → index-DxWD905F.js} +1 -1
  39. package/dist/assets/{index-BGHdyfCs.js → index-DzpHfxyz.js} +1 -1
  40. package/dist/assets/{index-DfI9E1Fb.js → index-Mle6gZrH.js} +3 -3
  41. package/dist/assets/{index-C7al3ztL.js → index-df1n76_f.js} +2 -2
  42. package/dist/assets/index-wCrXjHTc.css +1 -0
  43. package/dist/assets/{index.es-CKlpQqlO.js → index.es-CItPkO4N.js} +1 -1
  44. package/dist/assets/{issue-document-B4kkfOo0.js → issue-document-OO4Zci4E.js} +1 -1
  45. package/dist/assets/{login-page-NvQKYh34.js → login-page-BSQTX6W0.js} +1 -1
  46. package/dist/assets/{missing-info-charges-DrF2b0mO.js → missing-info-charges-opuTpAg9.js} +1 -1
  47. package/dist/assets/{page-not-found-7AAOkZhu.js → page-not-found-CajD8Y-I.js} +1 -1
  48. package/dist/assets/{pencil-DNPAJOPL.js → pencil-30Ac_SOe.js} +1 -1
  49. package/dist/assets/{report-commentary-row-CF-l1YIC.js → report-commentary-row-CMQfSAqR.js} +1 -1
  50. package/dist/assets/{save-D84vX5ea.js → save-CepuoEj-.js} +1 -1
  51. package/dist/assets/sub-CHPOWTq8.js +1 -0
  52. package/dist/assets/subMonths-CnpmFwyh.js +1 -0
  53. package/dist/index.html +2 -2
  54. package/package.json +1 -1
  55. package/src/components/business/financial-account-section.tsx +658 -0
  56. package/src/components/business/index.tsx +26 -10
  57. package/dist/assets/accountant-approvals-Bqrsn1y5.js +0 -1
  58. package/dist/assets/business-CfqFJUkR.js +0 -32
  59. package/dist/assets/index-DtE5Y1ZB.css +0 -1
  60. package/dist/assets/sub-BbpGm1pj.js +0 -1
  61. package/dist/assets/subMonths-0tIJizDp.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @accounter/client
2
2
 
3
- ## 0.0.8-alpha-20251027003629-e64c01111f4a4cec34d5ca9a84e02646b69f80b1
3
+ ## 0.0.8-alpha-20251027135337-f79bd33d242a52dedb78869440eb1332cecb516f
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -1,6 +1,6 @@
1
- import{D as fr,r as w,bG as Q,eE as ur,ah as t,eF as R,bE as X,bF as D,bH as n,eG as I,bI as z,eH as _r,eI as vr,eJ as br}from"./index-DfI9E1Fb.js";/**
1
+ import{D as fr,r as w,bJ as Q,eG as ur,ah as t,eH as R,bH as X,bI as D,bK as n,eI as I,bL as z,eJ as _r,eK as vr,eL as br}from"./index-Mle6gZrH.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 yr=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],Br=fr("merge",yr),Z=w.createContext(null),mr=Z.Provider,gr=()=>w.useContext(Z);var Pr=Object.defineProperty,x=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,H=(r,e,a)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,M=(r,e)=>{for(var a in e||(e={}))rr.call(e,a)&&H(r,a,e[a]);if(x)for(var a of x(e))er.call(e,a)&&H(r,a,e[a]);return r},Or=(r,e)=>{var a={};for(var o in r)rr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&x)for(var o of x(r))e.indexOf(o)<0&&er.call(r,o)&&(a[o]=r[o]);return a};const wr={size:"sm"},ar=w.forwardRef((r,e)=>{const a=Q("CheckboxGroup",wr,r),{children:o,value:f,defaultValue:u,onChange:i,size:c,wrapperProps:s}=a,d=Or(a,["children","value","defaultValue","onChange","size","wrapperProps"]),[l,y]=ur({value:f,defaultValue:u,finalValue:[],onChange:i}),m=_=>{const v=_.currentTarget.value;y(l.includes(v)?l.filter($=>$!==v):[...l,v])};return t.createElement(mr,{value:{value:l,onChange:m,size:c}},t.createElement(R.Wrapper,M(M({labelElement:"div",size:c,__staticSelector:"CheckboxGroup",ref:e},s),d),o))});ar.displayName="@mantine/core/CheckboxGroup";var $r=Object.defineProperty,hr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Y=(r,e,a)=>e in r?$r(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,B=(r,e)=>{for(var a in e||(e={}))kr.call(e,a)&&Y(r,a,e[a]);if(W)for(var a of W(e))Sr.call(e,a)&&Y(r,a,e[a]);return r},J=(r,e)=>hr(r,xr(e));const Er={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Cr=X((r,{radius:e,color:a,transitionDuration:o,labelPosition:f,error:u,indeterminate:i},{size:c})=>{const s=D({size:c,sizes:Er}),d=r.fn.variant({variant:"filled",color:a});return{icon:J(B({},r.fn.cover()),{ref:I("icon"),color:i?"inherit":r.white,transform:i?"none":`translateY(${n(5)}) scale(0.5)`,opacity:i?1:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${o}ms`,pointerEvents:"none",width:"60%",position:"absolute",zIndex:1,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:r.respectReducedMotion?"0ms":void 0}}),inner:{position:"relative",width:s,height:s,order:f==="left"?2:1},input:J(B({},r.fn.focusStyles()),{appearance:"none",backgroundColor:r.colorScheme==="dark"?r.colors.dark[6]:r.white,border:`${n(1)} solid ${u?r.fn.variant({variant:"filled",color:"red"}).background:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4]}`,width:s,height:s,borderRadius:r.fn.radius(e),padding:0,display:"block",margin:0,transition:`border-color ${o}ms ease, background-color ${o}ms ease`,cursor:r.cursorType,"&:checked":{backgroundColor:d.background,borderColor:d.background,[`& + .${I("icon")}`]:{opacity:1,color:r.white,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[2],borderColor:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[3],cursor:"not-allowed",pointerEvents:"none",[`& + .${I("icon")}`]:{color:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[5]}}})}}),Nr=Object.defineProperty,Ir=Object.defineProperties,zr=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,q=(r,e,a)=>e in r?Nr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Dr=(r,e)=>{for(var a in e||(e={}))jr.call(e,a)&&q(r,a,e[a]);if(U)for(var a of U(e))Rr.call(e,a)&&q(r,a,e[a]);return r},Gr=(r,e)=>Ir(r,zr(e));const j={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Vr=X((r,{labelPosition:e},{size:a})=>({root:{},body:{display:"flex","&:has(input:disabled) label":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}},labelWrapper:Gr(Dr({},r.fn.fontStyles()),{display:"inline-flex",flexDirection:"column",WebkitTapHighlightColor:"transparent",fontSize:a in j?D({size:a,sizes:r.fontSizes}):void 0,lineHeight:a in j?D({size:a,sizes:j}):void 0,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,cursor:r.cursorType,order:e==="left"?1:2}),description:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},error:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},label:{cursor:r.cursorType,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm,"&:disabled, &[data-disabled]":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}}})),Tr=Object.defineProperty,k=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable,A=(r,e,a)=>e in r?Tr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Fr=(r,e)=>{for(var a in e||(e={}))or.call(e,a)&&A(r,a,e[a]);if(k)for(var a of k(e))tr.call(e,a)&&A(r,a,e[a]);return r},Lr=(r,e)=>{var a={};for(var o in r)or.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&k)for(var o of k(r))e.indexOf(o)<0&&tr.call(r,o)&&(a[o]=r[o]);return a};const nr=w.forwardRef((r,e)=>{var a=r,{__staticSelector:o,className:f,classNames:u,styles:i,unstyled:c,children:s,label:d,description:l,id:y,disabled:m,error:_,size:v,labelPosition:$,bodyElement:g="div",labelElement:P="label",variant:E}=a,C=Lr(a,["__staticSelector","className","classNames","styles","unstyled","children","label","description","id","disabled","error","size","labelPosition","bodyElement","labelElement","variant"]);const{classes:p,cx:O}=Vr({labelPosition:$},{name:o,styles:i,classNames:u,unstyled:c,variant:E,size:v});return t.createElement(z,Fr({className:O(p.root,f),ref:e},C),t.createElement(z,{component:g,htmlFor:g==="label"?y:void 0,className:O(p.body)},s,t.createElement("div",{className:p.labelWrapper},d!=null&&t.createElement(z,{component:P,htmlFor:P==="label"?y:void 0,className:p.label,"data-disabled":m||void 0},d),l&&t.createElement(R.Description,{className:p.description},l),_&&_!=="boolean"&&t.createElement(R.Error,{className:p.error},_))))});nr.displayName="@mantine/core/InlineInput";var Hr=Object.defineProperty,S=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,K=(r,e,a)=>e in r?Hr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,h=(r,e)=>{for(var a in e||(e={}))sr.call(e,a)&&K(r,a,e[a]);if(S)for(var a of S(e))lr.call(e,a)&&K(r,a,e[a]);return r},Mr=(r,e)=>{var a={};for(var o in r)sr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&S)for(var o of S(r))e.indexOf(o)<0&&lr.call(r,o)&&(a[o]=r[o]);return a};const Wr={size:"sm",transitionDuration:100,icon:_r,labelPosition:"right"},ir=w.forwardRef((r,e)=>{const a=Q("Checkbox",Wr,r),{className:o,style:f,sx:u,checked:i,disabled:c,color:s,label:d,indeterminate:l,id:y,size:m,radius:_,wrapperProps:v,children:$,classNames:g,styles:P,transitionDuration:E,icon:C,unstyled:p,labelPosition:O,description:cr,error:G,variant:V}=a,dr=Mr(a,["className","style","sx","checked","disabled","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","unstyled","labelPosition","description","error","variant"]),b=gr(),T=vr(y),{systemStyles:pr,rest:F}=br(dr),{classes:N}=Cr({radius:_,color:s,transitionDuration:E,labelPosition:O,error:!!G,indeterminate:l},{name:"Checkbox",classNames:g,styles:P,unstyled:p,variant:V,size:b?.size||m}),L=b?{checked:b.value.includes(F.value),onChange:b.onChange}:{};return t.createElement(nr,h(h({className:o,sx:u,style:f,id:T,size:b?.size||m,labelPosition:O,label:d,description:cr,error:G,disabled:c,__staticSelector:"Checkbox",classNames:g,styles:P,unstyled:p,"data-checked":L.checked||void 0,variant:V},pr),v),t.createElement("div",{className:N.inner},t.createElement("input",h(h({id:T,ref:e,type:"checkbox",className:N.input,checked:i,disabled:c},F),L)),t.createElement(C,{indeterminate:l,className:N.icon})))});ir.displayName="@mantine/core/Checkbox";ir.Group=ar;export{ir as C,Br as M};
6
+ */const yr=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],Kr=fr("merge",yr),Z=w.createContext(null),mr=Z.Provider,gr=()=>w.useContext(Z);var Pr=Object.defineProperty,x=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,M=(r,e,a)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,W=(r,e)=>{for(var a in e||(e={}))rr.call(e,a)&&M(r,a,e[a]);if(x)for(var a of x(e))er.call(e,a)&&M(r,a,e[a]);return r},Or=(r,e)=>{var a={};for(var o in r)rr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&x)for(var o of x(r))e.indexOf(o)<0&&er.call(r,o)&&(a[o]=r[o]);return a};const wr={size:"sm"},ar=w.forwardRef((r,e)=>{const a=Q("CheckboxGroup",wr,r),{children:o,value:f,defaultValue:u,onChange:i,size:c,wrapperProps:s}=a,d=Or(a,["children","value","defaultValue","onChange","size","wrapperProps"]),[l,y]=ur({value:f,defaultValue:u,finalValue:[],onChange:i}),m=_=>{const v=_.currentTarget.value;y(l.includes(v)?l.filter($=>$!==v):[...l,v])};return t.createElement(mr,{value:{value:l,onChange:m,size:c}},t.createElement(R.Wrapper,W(W({labelElement:"div",size:c,__staticSelector:"CheckboxGroup",ref:e},s),d),o))});ar.displayName="@mantine/core/CheckboxGroup";var $r=Object.defineProperty,hr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,J=(r,e,a)=>e in r?$r(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,K=(r,e)=>{for(var a in e||(e={}))kr.call(e,a)&&J(r,a,e[a]);if(F)for(var a of F(e))Sr.call(e,a)&&J(r,a,e[a]);return r},Y=(r,e)=>hr(r,xr(e));const Cr={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Er=X((r,{radius:e,color:a,transitionDuration:o,labelPosition:f,error:u,indeterminate:i},{size:c})=>{const s=D({size:c,sizes:Cr}),d=r.fn.variant({variant:"filled",color:a});return{icon:Y(K({},r.fn.cover()),{ref:I("icon"),color:i?"inherit":r.white,transform:i?"none":`translateY(${n(5)}) scale(0.5)`,opacity:i?1:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${o}ms`,pointerEvents:"none",width:"60%",position:"absolute",zIndex:1,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:r.respectReducedMotion?"0ms":void 0}}),inner:{position:"relative",width:s,height:s,order:f==="left"?2:1},input:Y(K({},r.fn.focusStyles()),{appearance:"none",backgroundColor:r.colorScheme==="dark"?r.colors.dark[6]:r.white,border:`${n(1)} solid ${u?r.fn.variant({variant:"filled",color:"red"}).background:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4]}`,width:s,height:s,borderRadius:r.fn.radius(e),padding:0,display:"block",margin:0,transition:`border-color ${o}ms ease, background-color ${o}ms ease`,cursor:r.cursorType,"&:checked":{backgroundColor:d.background,borderColor:d.background,[`& + .${I("icon")}`]:{opacity:1,color:r.white,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[2],borderColor:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[3],cursor:"not-allowed",pointerEvents:"none",[`& + .${I("icon")}`]:{color:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[5]}}})}}),Nr=Object.defineProperty,Ir=Object.defineProperties,zr=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,U=(r,e,a)=>e in r?Nr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Dr=(r,e)=>{for(var a in e||(e={}))jr.call(e,a)&&U(r,a,e[a]);if(B)for(var a of B(e))Rr.call(e,a)&&U(r,a,e[a]);return r},Vr=(r,e)=>Ir(r,zr(e));const j={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Gr=X((r,{labelPosition:e},{size:a})=>({root:{},body:{display:"flex","&:has(input:disabled) label":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}},labelWrapper:Vr(Dr({},r.fn.fontStyles()),{display:"inline-flex",flexDirection:"column",WebkitTapHighlightColor:"transparent",fontSize:a in j?D({size:a,sizes:r.fontSizes}):void 0,lineHeight:a in j?D({size:a,sizes:j}):void 0,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,cursor:r.cursorType,order:e==="left"?1:2}),description:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},error:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},label:{cursor:r.cursorType,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm,"&:disabled, &[data-disabled]":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}}})),Tr=Object.defineProperty,k=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable,q=(r,e,a)=>e in r?Tr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Lr=(r,e)=>{for(var a in e||(e={}))or.call(e,a)&&q(r,a,e[a]);if(k)for(var a of k(e))tr.call(e,a)&&q(r,a,e[a]);return r},Hr=(r,e)=>{var a={};for(var o in r)or.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&k)for(var o of k(r))e.indexOf(o)<0&&tr.call(r,o)&&(a[o]=r[o]);return a};const nr=w.forwardRef((r,e)=>{var a=r,{__staticSelector:o,className:f,classNames:u,styles:i,unstyled:c,children:s,label:d,description:l,id:y,disabled:m,error:_,size:v,labelPosition:$,bodyElement:g="div",labelElement:P="label",variant:C}=a,E=Hr(a,["__staticSelector","className","classNames","styles","unstyled","children","label","description","id","disabled","error","size","labelPosition","bodyElement","labelElement","variant"]);const{classes:p,cx:O}=Gr({labelPosition:$},{name:o,styles:i,classNames:u,unstyled:c,variant:C,size:v});return t.createElement(z,Lr({className:O(p.root,f),ref:e},E),t.createElement(z,{component:g,htmlFor:g==="label"?y:void 0,className:O(p.body)},s,t.createElement("div",{className:p.labelWrapper},d!=null&&t.createElement(z,{component:P,htmlFor:P==="label"?y:void 0,className:p.label,"data-disabled":m||void 0},d),l&&t.createElement(R.Description,{className:p.description},l),_&&_!=="boolean"&&t.createElement(R.Error,{className:p.error},_))))});nr.displayName="@mantine/core/InlineInput";var Mr=Object.defineProperty,S=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,A=(r,e,a)=>e in r?Mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,h=(r,e)=>{for(var a in e||(e={}))sr.call(e,a)&&A(r,a,e[a]);if(S)for(var a of S(e))lr.call(e,a)&&A(r,a,e[a]);return r},Wr=(r,e)=>{var a={};for(var o in r)sr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&S)for(var o of S(r))e.indexOf(o)<0&&lr.call(r,o)&&(a[o]=r[o]);return a};const Fr={size:"sm",transitionDuration:100,icon:_r,labelPosition:"right"},ir=w.forwardRef((r,e)=>{const a=Q("Checkbox",Fr,r),{className:o,style:f,sx:u,checked:i,disabled:c,color:s,label:d,indeterminate:l,id:y,size:m,radius:_,wrapperProps:v,children:$,classNames:g,styles:P,transitionDuration:C,icon:E,unstyled:p,labelPosition:O,description:cr,error:V,variant:G}=a,dr=Wr(a,["className","style","sx","checked","disabled","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","unstyled","labelPosition","description","error","variant"]),b=gr(),T=vr(y),{systemStyles:pr,rest:L}=br(dr),{classes:N}=Er({radius:_,color:s,transitionDuration:C,labelPosition:O,error:!!V,indeterminate:l},{name:"Checkbox",classNames:g,styles:P,unstyled:p,variant:G,size:b?.size||m}),H=b?{checked:b.value.includes(L.value),onChange:b.onChange}:{};return t.createElement(nr,h(h({className:o,sx:u,style:f,id:T,size:b?.size||m,labelPosition:O,label:d,description:cr,error:V,disabled:c,__staticSelector:"Checkbox",classNames:g,styles:P,unstyled:p,"data-checked":H.checked||void 0,variant:G},pr),v),t.createElement("div",{className:N.inner},t.createElement("input",h(h({id:T,ref:e,type:"checkbox",className:N.input,checked:i,disabled:c},L),H)),t.createElement(E,{indeterminate:l,className:N.icon})))});ir.displayName="@mantine/core/Checkbox";ir.Group=ar;export{ir as C,Kr as M};
@@ -1 +1 @@
1
- import{bE as H,bF as _,bH as o,dW as M,r as q,bG as J,ah as s,T as K,bI as w,b$ as O}from"./index-DfI9E1Fb.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},Q=M({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var U=H((a,{color:r,radius:e},{size:t})=>({root:{position:"relative",height:_({size:t,sizes:k}),backgroundColor:a.colorScheme==="dark"?a.colors.dark[4]:a.colors.gray[2],borderRadius:a.fn.radius(e),overflow:"hidden"},bar:{position:"absolute",top:0,bottom:0,left:0,height:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background,transition:"width 100ms linear","&[data-animate]":{animation:`${Q} 1000ms linear infinite`},"&[data-striped]":{backgroundSize:`${o(20)} ${o(20)}`,backgroundImage:"linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"},"&:last-of-type":{borderTopRightRadius:a.fn.radius(e),borderBottomRightRadius:a.fn.radius(e)},"&:first-of-type":{borderTopLeftRadius:a.fn.radius(e),borderBottomLeftRadius:a.fn.radius(e)},"@media (prefers-reduced-motion)":{transitionDuration:a.respectReducedMotion?"0ms":void 0}},label:{color:a.white,fontSize:`calc(${_({size:t,sizes:k})} * 0.65)`,fontWeight:700,userSelect:"none",overflow:"hidden",whiteSpace:"nowrap"}})),X=Object.defineProperty,Y=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?X(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e,d=(a,r)=>{for(var e in r||(r={}))R.call(r,e)&&N(a,e,r[e]);if(n)for(var e of n(r))S.call(r,e)&&N(a,e,r[e]);return a},h=(a,r)=>Y(a,Z(r)),x=(a,r)=>{var e={};for(var t in a)R.call(a,t)&&r.indexOf(t)<0&&(e[t]=a[t]);if(a!=null&&n)for(var t of n(a))r.indexOf(t)<0&&S.call(a,t)&&(e[t]=a[t]);return e};function aa(a){return a.reduce((r,e)=>(r.sections.push(h(d({},e),{accumulated:r.accumulated})),r.accumulated+=e.value,r),{accumulated:0,sections:[]}).sections}const ea={size:"md",radius:"sm",striped:!1,animate:!1,label:""},ra=q.forwardRef((a,r)=>{const e=J("Progress",ea,a),{className:t,value:c,color:E,size:C,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:I,sections:p,unstyled:T,variant:D}=e,F=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=U({color:E,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:T,variant:D,size:C}),L=Array.isArray(p)?aa(p).map((A,B)=>{var v=A,{tooltip:g,accumulated:V,value:W,label:y,color:G}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(K.Floating,{label:g,disabled:!g,key:B},s.createElement(w,h(d({},P),{className:f(l.bar,P.className),"data-striped":u||i||void 0,"data-animate":i||void 0,sx:{width:`${W}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:G||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,d({className:f(l.root,t),ref:r},F),L||s.createElement("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,"aria-label":j,className:l.bar,style:{width:`${c}%`},"data-striped":u||i||void 0,"data-animate":i||void 0},m?s.createElement(O,{className:l.label},m):""))});ra.displayName="@mantine/core/Progress";export{ra as P};
1
+ import{bH as K,bI as _,bK as o,dY as M,r as W,bJ as Y,ah as s,T as q,bL as w,c2 as O}from"./index-Mle6gZrH.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},G=M({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var Q=K((a,{color:r,radius:e},{size:t})=>({root:{position:"relative",height:_({size:t,sizes:k}),backgroundColor:a.colorScheme==="dark"?a.colors.dark[4]:a.colors.gray[2],borderRadius:a.fn.radius(e),overflow:"hidden"},bar:{position:"absolute",top:0,bottom:0,left:0,height:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background,transition:"width 100ms linear","&[data-animate]":{animation:`${G} 1000ms linear infinite`},"&[data-striped]":{backgroundSize:`${o(20)} ${o(20)}`,backgroundImage:"linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"},"&:last-of-type":{borderTopRightRadius:a.fn.radius(e),borderBottomRightRadius:a.fn.radius(e)},"&:first-of-type":{borderTopLeftRadius:a.fn.radius(e),borderBottomLeftRadius:a.fn.radius(e)},"@media (prefers-reduced-motion)":{transitionDuration:a.respectReducedMotion?"0ms":void 0}},label:{color:a.white,fontSize:`calc(${_({size:t,sizes:k})} * 0.65)`,fontWeight:700,userSelect:"none",overflow:"hidden",whiteSpace:"nowrap"}})),U=Object.defineProperty,X=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?U(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e,c=(a,r)=>{for(var e in r||(r={}))R.call(r,e)&&N(a,e,r[e]);if(n)for(var e of n(r))S.call(r,e)&&N(a,e,r[e]);return a},h=(a,r)=>X(a,Z(r)),x=(a,r)=>{var e={};for(var t in a)R.call(a,t)&&r.indexOf(t)<0&&(e[t]=a[t]);if(a!=null&&n)for(var t of n(a))r.indexOf(t)<0&&S.call(a,t)&&(e[t]=a[t]);return e};function aa(a){return a.reduce((r,e)=>(r.sections.push(h(c({},e),{accumulated:r.accumulated})),r.accumulated+=e.value,r),{accumulated:0,sections:[]}).sections}const ea={size:"md",radius:"sm",striped:!1,animate:!1,label:""},ra=W.forwardRef((a,r)=>{const e=Y("Progress",ea,a),{className:t,value:d,color:C,size:E,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:I,sections:p,unstyled:L,variant:T}=e,D=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=Q({color:C,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:L,variant:T,size:E}),A=Array.isArray(p)?aa(p).map((B,F)=>{var v=B,{tooltip:g,accumulated:V,value:H,label:y,color:J}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(q.Floating,{label:g,disabled:!g,key:F},s.createElement(w,h(c({},P),{className:f(l.bar,P.className),"data-striped":u||i||void 0,"data-animate":i||void 0,sx:{width:`${H}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:J||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},D),A||s.createElement("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":d,"aria-label":j,className:l.bar,style:{width:`${d}%`},"data-striped":u||i||void 0,"data-animate":i||void 0},m?s.createElement(O,{className:l.label},m):""))});ra.displayName="@mantine/core/Progress";export{ra as P};
@@ -1 +1 @@
1
- import{ed as S,ee as K,ef as X,eg as Q,eh as W,ei as Y,d6 as Z,d5 as z,r as A,da as N,ej as ee,j as te,ai as re,dX as _}from"./index-DfI9E1Fb.js";function ke(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const $=e=>e,ne=()=>{let e=$;return{configure(t){e=t},generate(t){return e(t)},reset(){e=$}}},oe=ne(),se={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function U(e,t,r="Mui"){const n=se[t];return n?`${r}-${n}`:`${oe.generate(e)}-${t}`}function ie(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=U(e,o,r)}),n}function G(e){const{variants:t,...r}=e,n={variants:t,style:S(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=S(o.style))}),n}const ae=K();function V(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function g(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function le(e){return e?(t,r)=>r[e]:null}function ue(e,t,r){e.theme=he(e.theme)?r:e.theme[t]||e.theme}function M(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>M(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?g(n.style,r):n.style;else{const{variants:s,...i}=n;o=r?g(S(i),r):i}return I(e,n.variants,[o],r)}return n?.isProcessed?r?g(S(n.style),r):n.style:r?g(S(n),r):n}function I(e,t,r=[],n=void 0){let o;e:for(let s=0;s<t.length;s+=1){const i=t[s];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const a in i.props)if(e[a]!==i.props[a]&&e.ownerState?.[a]!==i.props[a])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?g(S(i.style(o)),n):i.style(o))):r.push(n?g(S(i.style),n):i.style)}return r}function ce(e={}){const{themeId:t,defaultTheme:r=ae,rootShouldForwardProp:n=V,slotShouldForwardProp:o=V}=e;function s(a){ue(a,t,r)}return(a,d={})=>{X(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,k=C||!1;let x=V;h==="Root"||h==="root"?x=n:h?x=o:pe(a)&&(x=void 0);const F=Q(a,{shouldForwardProp:x,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return M(m,u,m.theme.modularCssLayers?w:void 0)};if(Y(u)){const c=G(u);return function(y){return c.variants?M(y,c,y.theme.modularCssLayers?w:void 0):y.theme.modularCssLayers?g(c.style,w):c.style}}return u},j=(...u)=>{const c=[],m=u.map(q),y=[];if(c.push(s),l&&v&&y.push(function(f){const p=f.theme.components?.[l]?.styleOverrides;if(!p)return null;const B={};for(const E in p)B[E]=M(f,p[E],f.theme.modularCssLayers?"theme":void 0);return v(f,B)}),l&&!P&&y.push(function(f){const p=f.theme?.components?.[l]?.variants;return p?I(f,p,[],f.theme.modularCssLayers?"theme":void 0):null}),k||y.push(W),Array.isArray(m[0])){const O=m.shift(),f=new Array(c.length).fill(""),R=new Array(y.length).fill("");let p;p=[...f,...O,...R],p.raw=[...f,...O.raw,...R],c.unshift(p)}const J=[...c,...m,...y],L=F(...J);return a.muiName&&(L.muiName=a.muiName),L};return F.withConfig&&(j.withConfig=F.withConfig),j}}function fe(e,t){return void 0}function he(e){for(const t in e)return!1;return!0}function pe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function ye(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const D={theme:void 0};function de(e){let t,r;return function(o){let s=t;return(s===void 0||o.theme!==r)&&(D.theme=o.theme,s=G(e(D)),t=s,r=o.theme),s}}function me(e,t,r=void 0){const n={};for(const o in e){const s=e[o];let i="",a=!0;for(let d=0;d<s.length;d+=1){const l=s[d];l&&(i+=(a===!0?"":" ")+t(l),a=!1,r&&r[l]&&(i+=" "+r[l]))}n[o]=i}return n}function ge(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Se=e=>ge(e)&&e!=="classes",ve=ce({themeId:Z,defaultTheme:z,rootShouldForwardProp:Se}),we=de;function Fe(...e){const t=A.useRef(void 0),r=A.useCallback(n=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},e);return A.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function xe(e){return typeof e.main=="string"}function be(e,t=[]){if(!xe(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&be(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${_(t)}`,r&&"gutterBottom",n&&"noWrap",o&&"paragraph"]};return me(a,Te,i)},Ae=ve("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],r.align!=="inherit"&&t[`align${_(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(we(({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter(([t,r])=>t!=="inherit"&&r&&typeof r=="object").map(([t,r])=>({props:{variant:t},style:r})),...Object.entries(e.palette).filter(Ce()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,t])=>typeof t=="string").map(([t])=>({props:{color:`text${_(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:t})=>t.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:t})=>t.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:t})=>t.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:t})=>t.paragraph,style:{marginBottom:16}}]}))),H={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Ve=A.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},k=l||(C?"p":T[v]||H[v])||"span",x=Re(P);return te.jsx(Ae,{as:k,ref:r,className:re(x.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Ve as T,ke as _,ie as a,V as b,me as c,Ce as d,U as g,we as m,ve as s,Fe as u};
1
+ import{ef as S,eg as K,eh as Z,ei as Q,ej as W,ek as X,d8 as Y,d7 as z,r as k,dc as N,el as ee,j as te,ai as re,dZ as _}from"./index-Mle6gZrH.js";function Me(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const $=e=>e,ne=()=>{let e=$;return{configure(t){e=t},generate(t){return e(t)},reset(){e=$}}},oe=ne(),se={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function U(e,t,r="Mui"){const n=se[t];return n?`${r}-${n}`:`${oe.generate(e)}-${t}`}function ie(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=U(e,o,r)}),n}function G(e){const{variants:t,...r}=e,n={variants:t,style:S(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=S(o.style))}),n}const ae=K();function V(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function g(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function le(e){return e?(t,r)=>r[e]:null}function ue(e,t,r){e.theme=he(e.theme)?r:e.theme[t]||e.theme}function A(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>A(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?g(n.style,r):n.style;else{const{variants:s,...i}=n;o=r?g(S(i),r):i}return I(e,n.variants,[o],r)}return n?.isProcessed?r?g(S(n.style),r):n.style:r?g(S(n),r):n}function I(e,t,r=[],n=void 0){let o;e:for(let s=0;s<t.length;s+=1){const i=t[s];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const a in i.props)if(e[a]!==i.props[a]&&e.ownerState?.[a]!==i.props[a])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?g(S(i.style(o)),n):i.style(o))):r.push(n?g(S(i.style),n):i.style)}return r}function ce(e={}){const{themeId:t,defaultTheme:r=ae,rootShouldForwardProp:n=V,slotShouldForwardProp:o=V}=e;function s(a){ue(a,t,r)}return(a,d={})=>{Z(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let x=V;h==="Root"||h==="root"?x=n:h?x=o:pe(a)&&(x=void 0);const F=Q(a,{shouldForwardProp:x,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return A(m,u,m.theme.modularCssLayers?w:void 0)};if(X(u)){const c=G(u);return function(y){return c.variants?A(y,c,y.theme.modularCssLayers?w:void 0):y.theme.modularCssLayers?g(c.style,w):c.style}}return u},j=(...u)=>{const c=[],m=u.map(q),y=[];if(c.push(s),l&&v&&y.push(function(f){const p=f.theme.components?.[l]?.styleOverrides;if(!p)return null;const B={};for(const E in p)B[E]=A(f,p[E],f.theme.modularCssLayers?"theme":void 0);return v(f,B)}),l&&!P&&y.push(function(f){const p=f.theme?.components?.[l]?.variants;return p?I(f,p,[],f.theme.modularCssLayers?"theme":void 0):null}),M||y.push(W),Array.isArray(m[0])){const O=m.shift(),f=new Array(c.length).fill(""),R=new Array(y.length).fill("");let p;p=[...f,...O,...R],p.raw=[...f,...O.raw,...R],c.unshift(p)}const J=[...c,...m,...y],L=F(...J);return a.muiName&&(L.muiName=a.muiName),L};return F.withConfig&&(j.withConfig=F.withConfig),j}}function fe(e,t){return void 0}function he(e){for(const t in e)return!1;return!0}function pe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function ye(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const D={theme:void 0};function de(e){let t,r;return function(o){let s=t;return(s===void 0||o.theme!==r)&&(D.theme=o.theme,s=G(e(D)),t=s,r=o.theme),s}}function me(e,t,r=void 0){const n={};for(const o in e){const s=e[o];let i="",a=!0;for(let d=0;d<s.length;d+=1){const l=s[d];l&&(i+=(a===!0?"":" ")+t(l),a=!1,r&&r[l]&&(i+=" "+r[l]))}n[o]=i}return n}function ge(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Se=e=>ge(e)&&e!=="classes",ve=ce({themeId:Y,defaultTheme:z,rootShouldForwardProp:Se}),we=de;function Fe(...e){const t=k.useRef(void 0),r=k.useCallback(n=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},e);return k.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function xe(e){return typeof e.main=="string"}function be(e,t=[]){if(!xe(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&be(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${_(t)}`,r&&"gutterBottom",n&&"noWrap",o&&"paragraph"]};return me(a,Te,i)},ke=ve("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],r.align!=="inherit"&&t[`align${_(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(we(({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter(([t,r])=>t!=="inherit"&&r&&typeof r=="object").map(([t,r])=>({props:{variant:t},style:r})),...Object.entries(e.palette).filter(Ce()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,t])=>typeof t=="string").map(([t])=>({props:{color:`text${_(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:t})=>t.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:t})=>t.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:t})=>t.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:t})=>t.paragraph,style:{marginBottom:16}}]}))),H={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Ve=k.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",x=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(x.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Ve as T,Me as _,ie as a,V as b,me as c,Ce as d,U as g,we as m,ve as s,Fe as u};
@@ -1 +1 @@
1
- import{ah as l,j as t,fe as Q,ff as W,fg as O,fh as X,fi as Z,fj as T,fk as ee,fl as oe,fm as M,fn as re,fo as te,fp as ne,p as P,dU as ae}from"./index-DfI9E1Fb.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=Q(d),[b]=W(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(fe,{...r,ref:n}):t.jsx(pe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[K,de]=b(d,{collapsible:!1}),pe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},collapsible:r=!1,...s}=e,[i,p]=M({prop:o,defaultProp:a??"",onChange:c,caller:d});return t.jsx(H,{scope:e.__scopeAccordion,value:l.useMemo(()=>i?[i]:[],[i]),onItemOpen:p,onItemClose:l.useCallback(()=>r&&p(""),[r,p]),children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx($,{...s,ref:n})})})}),fe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},...r}=e,[s,i]=M({prop:o,defaultProp:a??[],onChange:c,caller:d}),p=l.useCallback(x=>i((u=[])=>[...u,x]),[i]),v=l.useCallback(x=>i((u=[])=>u.filter(h=>h!==x)),[i]);return t.jsx(H,{scope:e.__scopeAccordion,value:s,onItemOpen:p,onItemClose:v,children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:!0,children:t.jsx($,{...r,ref:n})})})}),[ue,C]=b(d),$=l.forwardRef((e,n)=>{const{__scopeAccordion:o,disabled:a,dir:c,orientation:r="vertical",...s}=e,i=l.useRef(null),p=re(i,n),v=ie(o),u=te(c)==="ltr",h=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const F=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===F),D=I.length;if(g===-1)return;m.preventDefault();let f=g;const j=0,w=D-1,_=()=>{f=g+1,f>w&&(f=j)},y=()=>{f=g-1,f<j&&(f=w)};switch(m.key){case"Home":f=j;break;case"End":f=w;break;case"ArrowRight":r==="horizontal"&&(u?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(u?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const J=f%D;I[J].ref.current?.focus()});return t.jsx(ue,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref:p,onKeyDown:a?void 0:h})})})}),A="AccordionItem",[ve,S]=b(A),z=l.forwardRef((e,n)=>{const{__scopeAccordion:o,value:a,...c}=e,r=C(A,o),s=le(A,o),i=E(o),p=X(),v=a&&s.value.includes(a)||!1,x=r.disabled||e.disabled;return t.jsx(ve,{scope:o,open:v,disabled:x,triggerId:p,children:t.jsx(Z,{"data-orientation":r.orientation,"data-state":B(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":B(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});U.displayName=L;var N="AccordionTrigger",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});G.displayName=N;var Y="AccordionContent",q=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(Y,o),s=E(o);return t.jsx(oe,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...s,...a,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});q.displayName=Y;function B(e){return e?"open":"closed"}var xe=V,me=z,ge=U,Ae=G,be=q;function he({...e}){return t.jsx(xe,{"data-slot":"accordion",...e})}function Ie({className:e,...n}){return t.jsx(me,{"data-slot":"accordion-item",className:P("border-b last:border-b-0",e),...n})}function je({className:e,children:n,...o}){return t.jsx(ge,{className:"flex",children:t.jsxs(Ae,{"data-slot":"accordion-trigger",className:P("focus-visible:border-gray-950 focus-visible:ring-gray-950/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50",e),...o,children:[n,t.jsx(ae,{className:"text-gray-500 pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 dark:text-gray-400"})]})})}function we({className:e,children:n,...o}){return t.jsx(be,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...o,children:t.jsx("div",{className:P("pt-0 pb-4",e),children:n})})}export{he as A,Ie as a,we as b,je as c};
1
+ import{ah as l,j as t,fg as J,fh as Q,fi as O,fj as X,fk as Z,fl as T,fm as ee,fn as oe,fo as M,fp as re,fq as te,fr as ne,p as P,dW as ae}from"./index-Mle6gZrH.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=J(d),[b]=Q(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(fe,{...r,ref:n}):t.jsx(pe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[K,de]=b(d,{collapsible:!1}),pe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},collapsible:r=!1,...s}=e,[i,p]=M({prop:o,defaultProp:a??"",onChange:c,caller:d});return t.jsx(H,{scope:e.__scopeAccordion,value:l.useMemo(()=>i?[i]:[],[i]),onItemOpen:p,onItemClose:l.useCallback(()=>r&&p(""),[r,p]),children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx($,{...s,ref:n})})})}),fe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},...r}=e,[s,i]=M({prop:o,defaultProp:a??[],onChange:c,caller:d}),p=l.useCallback(x=>i((u=[])=>[...u,x]),[i]),v=l.useCallback(x=>i((u=[])=>u.filter(h=>h!==x)),[i]);return t.jsx(H,{scope:e.__scopeAccordion,value:s,onItemOpen:p,onItemClose:v,children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:!0,children:t.jsx($,{...r,ref:n})})})}),[ue,C]=b(d),$=l.forwardRef((e,n)=>{const{__scopeAccordion:o,disabled:a,dir:c,orientation:r="vertical",...s}=e,i=l.useRef(null),p=re(i,n),v=ie(o),u=te(c)==="ltr",h=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const B=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===B),D=I.length;if(g===-1)return;m.preventDefault();let f=g;const j=0,w=D-1,_=()=>{f=g+1,f>w&&(f=j)},y=()=>{f=g-1,f<j&&(f=w)};switch(m.key){case"Home":f=j;break;case"End":f=w;break;case"ArrowRight":r==="horizontal"&&(u?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(u?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const F=f%D;I[F].ref.current?.focus()});return t.jsx(ue,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref:p,onKeyDown:a?void 0:h})})})}),A="AccordionItem",[ve,S]=b(A),z=l.forwardRef((e,n)=>{const{__scopeAccordion:o,value:a,...c}=e,r=C(A,o),s=le(A,o),i=E(o),p=X(),v=a&&s.value.includes(a)||!1,x=r.disabled||e.disabled;return t.jsx(ve,{scope:o,open:v,disabled:x,triggerId:p,children:t.jsx(Z,{"data-orientation":r.orientation,"data-state":Y(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":Y(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=L;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});U.displayName=N;var q="AccordionContent",W=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(q,o),s=E(o);return t.jsx(oe,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...s,...a,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});W.displayName=q;function Y(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=W;function he({...e}){return t.jsx(xe,{"data-slot":"accordion",...e})}function Ie({className:e,...n}){return t.jsx(me,{"data-slot":"accordion-item",className:P("border-b last:border-b-0",e),...n})}function je({className:e,children:n,...o}){return t.jsx(ge,{className:"flex",children:t.jsxs(Ae,{"data-slot":"accordion-trigger",className:P("focus-visible:border-gray-950 focus-visible:ring-gray-950/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50",e),...o,children:[n,t.jsx(ae,{className:"text-gray-500 pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 dark:text-gray-400"})]})})}function we({className:e,children:n,...o}){return t.jsx(be,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...o,children:t.jsx("div",{className:P("pt-0 pb-4",e),children:n})})}export{he as A,Ie as a,we as b,je as c};
@@ -0,0 +1 @@
1
+ import{r as t,F as h,u as v,ae as C,ag as A,a as F,j as e,c as P,L as b,fs as y}from"./index-Mle6gZrH.js";import{C as j}from"./charges-filters-BFXTNJlR.js";import{P as D}from"./Progress-CYZqv7SW.js";import"./sub-CHPOWTq8.js";import"./subMonths-CnpmFwyh.js";const w=()=>{const{setFiltersContext:c}=t.useContext(h),{get:i}=v(),{userContext:p}=t.useContext(C),[a,x]=t.useState(i("chargesFilters")?JSON.parse(decodeURIComponent(i("chargesFilters"))):{byOwners:p?.context.adminBusinessId?[p?.context.adminBusinessId]:[],sortBy:{field:A.Date,asc:!1},toAnyDate:null,fromAnyDate:null}),[{data:r,fetching:u}]=F({query:y,variables:{filters:a,page:1,limit:999999}}),s=r?.allCharges?.nodes.length??0;let o=0,l=0,n=0;r?.allCharges?.nodes.map(f=>{switch(f.accountantApproval){case"APPROVED":o+=1;break;case"PENDING":l+=1;break;case"UNAPPROVED":n+=1;break}});const d=100*o/s,g=100*l/s,m=100*n/s;return t.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:a,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,a,c,x]),e.jsx(P,{title:"Accountant Approvals Status",children:u?e.jsx(b,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"mx-10 mt-5 flex flex-col gap-5",children:[`Total charges: ${s}`,e.jsx(D,{color:"green",radius:"xl",size:"xl",sections:[{value:d,color:"green",label:`${d.toFixed(1)}% (${o})`},{value:g,color:"orange",label:`${g.toFixed(1)}% (${l})`},{value:m,color:"red",label:`${m.toFixed(1)}% (${n})`}]})]})})};export{w as AccountantApprovals};
@@ -1 +1 @@
1
- import{r as s,F as D,u as E,a as N,j as e,T as b,B as w,P as z,b as O,c as T,L,C as R,E as q,I as B,M as U,A as k}from"./index-DfI9E1Fb.js";import{e as Q,C as $}from"./charges-filters-CoFkjW00.js";import{M as H}from"./index-DDGgWxhe.js";import"./sub-BbpGm1pj.js";import"./subMonths-0tIJizDp.js";import"./Checkbox-DjollWGm.js";function Y(l,n){const a=new URLSearchParams;n&&a.append("page",String(n));const o=Q(l);return o&&a.append("chargesFilters",o),`/charges${a.size>0?`?${a}`:""}`}const Z=()=>{const{setFiltersContext:l}=s.useContext(D),[n,a]=s.useState(void 0),[o,g]=s.useState(void 0),[d,x]=s.useState(void 0),[u,j]=s.useState(!1),[r,h]=s.useState([]),{get:m}=E(),[p,M]=s.useState(m("page")?Number(m("page")):1),C=m("chargesFilters"),S=s.useMemo(()=>{if(C)try{return JSON.parse(decodeURIComponent(C))}catch{return}},[C]),[i,v]=s.useState(S),I=s.useCallback((t,A)=>{r.map(f=>f.id).includes(t)?h(r.filter(f=>f.id!==t)):h([...r,{id:t,onChange:A}])},[r]),[{data:c,fetching:P},F]=N({query:k,variables:{filters:i,page:p,limit:100},pause:!0});s.useEffect(()=>{i&&F()},[i,F]);function y(){h([])}return s.useEffect(()=>{l(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx($,{filter:i,setFilter:v,activePage:p,setPage:M,totalPages:c?.allCharges?.pageInfo.totalPages,initiallyOpened:!i}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>j(t=>!t),children:u?e.jsx(z,{className:"size-5"}):e.jsx(O,{className:"size-5"})})}),e.jsx(H,{selected:r,resetMerge:y})]}))},[c,P,i,p,u,l,M,v,j,r,S]),e.jsxs(T,{title:"All Charges",description:"Manage charges",children:[P?e.jsx(L,{className:"h-10 w-10 animate-spin mr-2 self-center"}):c?.allCharges.nodes?e.jsx(R,{setEditChargeId:a,setInsertDocument:g,setMatchDocuments:x,toggleMergeCharge:I,mergeSelectedCharges:new Set(r.map(t=>t.id)),data:c?.allCharges?.nodes,isAllOpened:u}):e.jsx("span",{children:"Please apply filters"}),n&&e.jsx(q,{chargeId:n?.id,close:()=>a(void 0),onChange:n.onChange}),o&&e.jsx(B,{chargeId:o.id,onChange:o.onChange,close:()=>g(void 0)}),d&&e.jsx(U,{chargeId:d.id,ownerId:d.ownerId,setMatchDocuments:()=>x(void 0)})]})};export{Z as AllCharges,Y as getAllChargesHref};
1
+ import{r as s,F as D,u as E,a as N,j as e,T as b,B as w,P as z,b as O,c as T,L,C as R,E as q,I as B,M as U,A as k}from"./index-Mle6gZrH.js";import{e as Q,C as $}from"./charges-filters-BFXTNJlR.js";import{M as H}from"./index-BgaZ9SWH.js";import"./sub-CHPOWTq8.js";import"./subMonths-CnpmFwyh.js";import"./Checkbox-DpgoGNEh.js";function Y(l,n){const a=new URLSearchParams;n&&a.append("page",String(n));const o=Q(l);return o&&a.append("chargesFilters",o),`/charges${a.size>0?`?${a}`:""}`}const Z=()=>{const{setFiltersContext:l}=s.useContext(D),[n,a]=s.useState(void 0),[o,g]=s.useState(void 0),[d,x]=s.useState(void 0),[u,j]=s.useState(!1),[r,h]=s.useState([]),{get:m}=E(),[p,M]=s.useState(m("page")?Number(m("page")):1),C=m("chargesFilters"),S=s.useMemo(()=>{if(C)try{return JSON.parse(decodeURIComponent(C))}catch{return}},[C]),[i,v]=s.useState(S),I=s.useCallback((t,A)=>{r.map(f=>f.id).includes(t)?h(r.filter(f=>f.id!==t)):h([...r,{id:t,onChange:A}])},[r]),[{data:c,fetching:P},F]=N({query:k,variables:{filters:i,page:p,limit:100},pause:!0});s.useEffect(()=>{i&&F()},[i,F]);function y(){h([])}return s.useEffect(()=>{l(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx($,{filter:i,setFilter:v,activePage:p,setPage:M,totalPages:c?.allCharges?.pageInfo.totalPages,initiallyOpened:!i}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>j(t=>!t),children:u?e.jsx(z,{className:"size-5"}):e.jsx(O,{className:"size-5"})})}),e.jsx(H,{selected:r,resetMerge:y})]}))},[c,P,i,p,u,l,M,v,j,r,S]),e.jsxs(T,{title:"All Charges",description:"Manage charges",children:[P?e.jsx(L,{className:"h-10 w-10 animate-spin mr-2 self-center"}):c?.allCharges.nodes?e.jsx(R,{setEditChargeId:a,setInsertDocument:g,setMatchDocuments:x,toggleMergeCharge:I,mergeSelectedCharges:new Set(r.map(t=>t.id)),data:c?.allCharges?.nodes,isAllOpened:u}):e.jsx("span",{children:"Please apply filters"}),n&&e.jsx(q,{chargeId:n?.id,close:()=>a(void 0),onChange:n.onChange}),o&&e.jsx(B,{chargeId:o.id,onChange:o.onChange,close:()=>g(void 0)}),d&&e.jsx(U,{chargeId:d.id,ownerId:d.ownerId,setMatchDocuments:()=>x(void 0)})]})};export{Z as AllCharges,Y as getAllChargesHref};
@@ -1,4 +1,4 @@
1
- import{D as o}from"./index-DfI9E1Fb.js";/**
1
+ import{D as o}from"./index-Mle6gZrH.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{D as a}from"./index-DfI9E1Fb.js";/**
1
+ import{D as a}from"./index-Mle6gZrH.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,37 @@
1
+ import{D as le,G as Ie,S as Pe,H as Ce,a as De,J as zs,r as f,j as e,K as we,N as Ae,O as Ws,n as bs,Q as qs,i as je,t as L,l as ge,U as Gs,V as ke,W as Le,X as Se,Y as G,Z as K,_ as H,$ as Y,a0 as Te,a1 as X,a2 as v,a3 as y,a4 as N,a5 as I,v as b,a6 as k,a7 as D,a8 as as,B as S,a9 as Ks,aa as Fe,ab as ts,ac as _,ad as Is,ae as rs,af as Hs,s as Ys,C as Xs,ag as Js,ah as V,ai as us,aj as Qs,ak as Zs,al as en,am as he,an as is,ao as W,ap as Ve,aq as _e,ar as Re,as as z,at as ce,au as ae,av as te,aw as re,ax as ie,ay as ee,az as cs,aA as Me,aB as Ke,aC as me,aD as He,aE as Ye,aF as Ue,aG as sn,aH as ne,aI as Z,aJ as nn,aK as an,aL as tn,aM as Xe,aN as rn,aO as cn,aP as ln,aQ as on,aR as dn,aS as Je,aT as Qe,aU as Ds,aV as un,aW as Ze,aX as mn,aY as ws,aZ as As,a_ as hn,a$ as xn,b0 as ks,b1 as ls,b2 as pn,b3 as ms,b4 as jn,b5 as gn,b6 as fn,b7 as vn,b8 as yn,b9 as Nn,ba as Cn,bb as O,bc as bn,bd as In,be as E,bf as Dn,bg as os,bh as wn,bi as An,bj as kn,bk as Sn,bl as Tn,bm as Q,bn as En,bo as Bn,bp as Pn,bq as q,br as On,bs as Ln,bt as Fn,bu as Vn}from"./index-Mle6gZrH.js";import{S as ds}from"./save-CepuoEj-.js";import{B as _n}from"./business-header-Dr-cPjxi.js";import{i as Rn,D as Mn,f as $n,E as Un,L as ze,a as Ee,C as zn,A as Wn,b as ye,c as qn,d as es,h as Gn,e as Kn,g as Ss,u as Hn,G as Yn,j as hs,k as Xn,X as Ts,Y as Es,l as Jn,m as Qn,R as Zn,n as ea,o as sa,p as na}from"./chart-CW1hdLVW.js";import{P as aa}from"./pencil-30Ac_SOe.js";import{B as Bs}from"./building-2-Cgw5U9px.js";import{A as ta,a as We,b as qe,c as xs}from"./accordion-CaHOdrRP.js";import"./sequential-CAnleQny.js";/**
2
+ * @license lucide-react v0.546.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ra=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],ia=le("bitcoin",ra);/**
7
+ * @license lucide-react v0.546.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ca=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ps=le("circle-check",ca);/**
12
+ * @license lucide-react v0.546.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const la=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Be=le("dollar-sign",la);/**
17
+ * @license lucide-react v0.546.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const oa=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],da=le("file-check",oa);/**
22
+ * @license lucide-react v0.546.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const ua=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],ma=le("plug",ua);/**
27
+ * @license lucide-react v0.546.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const ha=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Ps=le("shield",ha);/**
32
+ * @license lucide-react v0.546.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const xa=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Ge=le("trending-up",xa);function Os(s){switch(s){case Ie.Annual:return"Annual";case Ie.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${s}`)}}function Ls(s){switch(s){case Pe.Enterprise:return"Enterprise";case Pe.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${s}`)}}function pa(s){return Ce(s,"yyyy-MM-dd")}function ja({businessId:s,tagIds:n,description:a,open:r,onOpenChange:c,onClose:l}){const[{data:t,fetching:i},o]=De({pause:!0,query:zs,variables:{businessId:s,tagsDifferentThan:n?n.map(h=>h.id):void 0,descriptionDifferentThan:a}});f.useEffect(()=>{r&&(n||a)&&!t&&o()},[r,n,a,o,t]);const u=f.useCallback(h=>{c(h),r&&!h&&l?.()},[c,l,r]),x=f.useMemo(()=>r&&(!!n||!!a)&&t&&t?.similarChargesByBusiness.length>0,[r,n,a,t]);return e.jsx(we,{open:x,onOpenChange:u,children:e.jsx(Ae,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",onClick:h=>h.stopPropagation(),children:e.jsx(Ws,{fallback:e.jsx("div",{children:"Error fetching similar charges"}),children:i?e.jsx(bs,{}):n||a?e.jsx(qs,{data:t?.similarChargesByBusiness??[],tagIds:n,description:a,onOpenChange:u,title:"Similar Charges by Business"}):null})})})}const ga="updateAdminBusiness",fa=()=>{const[{fetching:s},n]=je(Gs),a=f.useCallback(async r=>{const c=`Error updating admin business ID [${r.adminBusinessId}]`,l=`${ga}-${r.adminBusinessId}`;L.loading("Updating admin business",{id:l});try{const t=await n(r),i=ge(t,c,l,"updateAdminBusiness");if(i)return L.success("Success",{id:l,description:"Admin Business Updated"}),i.updateAdminBusiness}catch(t){console.error(`${c}: ${t}`),L.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateAdminBusiness:a}},va=Fe({employerWithholdingTaxAccountNumber:_().min(1,{message:"Employer Withholding Tax Account Number is required"}),taxPrepaymentId:_().min(1,{message:"Tax Prepayment ID is required"}),nationalInsuranceEmployerId:_().min(1,{message:"National Insurance Employer ID is required"}),advanceTaxRate:Is().min(0,{message:"Advance Tax Rate must be at least 0"}).max(100,{message:"Advance Tax Rate must be at most 100"}),registrationDate:_().min(1,{message:"Registration Date is required"})});function js(s){return!s||s.__typename!=="LtdFinancialEntity"||!s.adminInfo?{}:{employerWithholdingTaxAccountNumber:s.adminInfo.employerWithholdingTaxAccountNumber??"",taxPrepaymentId:s.adminInfo.taxPrepaymentId??"",nationalInsuranceEmployerId:s.adminInfo.nationalInsuranceEmployerId??"",advanceTaxRate:s.adminInfo.advanceTaxRate??0,registrationDate:s.adminInfo.registrationDate??""}}function ya(s){return{employerWithholdingTaxAccountNumber:s.employerWithholdingTaxAccountNumber,taxPrepaymentId:s.taxPrepaymentId,nationalInsuranceEmployerId:s.nationalInsuranceEmployerId,advanceTaxRate:s.advanceTaxRate,registrationDate:s.registrationDate?pa(new Date(s.registrationDate)):void 0}}function Na({data:s,refetchBusiness:n}){const a=Se(Ks,s),[r,c]=f.useState(js(a)),{updateAdminBusiness:l,fetching:t}=fa(),i=ke({resolver:Le(va),defaultValues:r}),o=async u=>{if(!a)return;const x=ts(u,i.formState.dirtyFields);if(!x)return;const h=ya(x);await l({adminBusinessId:a.id,fields:h}),n?.()};return f.useEffect(()=>{if(a){const u=js(a);c(u),i.reset(u)}},[a,i]),e.jsxs(G,{children:[e.jsxs(K,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ps,{className:"h-5 w-5 text-primary"}),e.jsx(H,{children:"Admin Business Configuration"})]}),e.jsx(Y,{children:"Tax and registration information for the business operating this application"})]}),e.jsx(Te,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[e.jsx(X,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(v,{control:i.control,name:"employerWithholdingTaxAccountNumber",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Employer Withholding Tax Account Number"}),e.jsx(I,{children:e.jsx(b,{placeholder:"Enter account number",...u,className:k(x)})}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"taxPrepaymentId",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Tax Prepayment ID"}),e.jsx(I,{children:e.jsx(b,{placeholder:"Enter prepayment ID",...u,className:k(x)})}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"nationalInsuranceEmployerId",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"National Insurance Employer ID"}),e.jsx(I,{children:e.jsx(b,{placeholder:"Enter employer ID",...u,className:k(x)})}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"advanceTaxRate",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Advance Tax Rate (%)"}),e.jsx(I,{children:e.jsx(b,{type:"number",step:"0.01",min:"0",max:"100",placeholder:"Enter tax rate",...u,className:k(x)})}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"registrationDate",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Registration Date"}),e.jsx(I,{children:e.jsx(b,{type:"date",...u,className:k(x)})}),e.jsx(D,{})]})})]})}),e.jsx(as,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(S,{type:"submit",disabled:t||Object.keys(i.formState.dirtyFields).length===0||!i.formState.isValid,children:[e.jsx(ds,{className:"h-4 w-4"}),"Save Changes"]})})]})})]})}function Ca({businessId:s}){const{userContext:n}=f.useContext(rs),[a,r]=f.useState(1),[{data:c,fetching:l}]=De({query:Hs,variables:{filters:{byOwners:n?.context.adminBusinessId?[n.context.adminBusinessId]:void 0,sortBy:{field:Js.Date,asc:!1},byBusinesses:[s]},page:a,limit:100}}),t=c?.allCharges?.pageInfo.totalPages??1,i=c?.allCharges?.nodes??[];return l?e.jsx("div",{children:"Loading charges..."}):e.jsxs(G,{children:[e.jsxs(K,{className:"flex w-full justify-between items-center",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(H,{children:"Charges"}),e.jsx(Y,{children:"Recurring and one-time charges for this business"})]})}),t>1&&e.jsx(Ys,{className:"flex-fit",value:a,onChange:r,total:t})]}),e.jsx(X,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Xs,{data:i,isAllOpened:!1})})})]})}var ba=["type","layout","connectNulls","ref"],Ia=["key"];function xe(s){"@babel/helpers - typeof";return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},xe(s)}function gs(s,n){if(s==null)return{};var a=Da(s,n),r,c;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);for(c=0;c<l.length;c++)r=l[c],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(s,r)&&(a[r]=s[r])}return a}function Da(s,n){if(s==null)return{};var a={};for(var r in s)if(Object.prototype.hasOwnProperty.call(s,r)){if(n.indexOf(r)>=0)continue;a[r]=s[r]}return a}function be(){return be=Object.assign?Object.assign.bind():function(s){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},be.apply(this,arguments)}function fs(s,n){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);n&&(r=r.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),a.push.apply(a,r)}return a}function R(s){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?fs(Object(a),!0).forEach(function(r){U(s,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):fs(Object(a)).forEach(function(r){Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(a,r))})}return s}function ue(s){return Sa(s)||ka(s)||Aa(s)||wa()}function wa(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
37
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Aa(s,n){if(s){if(typeof s=="string")return ss(s,n);var a=Object.prototype.toString.call(s).slice(8,-1);if(a==="Object"&&s.constructor&&(a=s.constructor.name),a==="Map"||a==="Set")return Array.from(s);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return ss(s,n)}}function ka(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function Sa(s){if(Array.isArray(s))return ss(s)}function ss(s,n){(n==null||n>s.length)&&(n=s.length);for(var a=0,r=new Array(n);a<n;a++)r[a]=s[a];return r}function Ta(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")}function vs(s,n){for(var a=0;a<n.length;a++){var r=n[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(s,Vs(r.key),r)}}function Ea(s,n,a){return n&&vs(s.prototype,n),a&&vs(s,a),Object.defineProperty(s,"prototype",{writable:!1}),s}function Ba(s,n,a){return n=Oe(n),Pa(s,Fs()?Reflect.construct(n,a||[],Oe(s).constructor):n.apply(s,a))}function Pa(s,n){if(n&&(xe(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oa(s)}function Oa(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Fs(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Fs=function(){return!!s})()}function Oe(s){return Oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},Oe(s)}function La(s,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(n&&n.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),n&&ns(s,n)}function ns(s,n){return ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,c){return r.__proto__=c,r},ns(s,n)}function U(s,n,a){return n=Vs(n),n in s?Object.defineProperty(s,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[n]=a,s}function Vs(s){var n=Fa(s,"string");return xe(n)=="symbol"?n:n+""}function Fa(s,n){if(xe(s)!="object"||!s)return s;var a=s[Symbol.toPrimitive];if(a!==void 0){var r=a.call(s,n);if(xe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var pe=(function(s){function n(){var a;Ta(this,n);for(var r=arguments.length,c=new Array(r),l=0;l<r;l++)c[l]=arguments[l];return a=Ba(this,n,[].concat(c)),U(a,"state",{isAnimationFinished:!0,totalLength:0}),U(a,"generateSimpleStrokeDasharray",function(t,i){return"".concat(i,"px ").concat(t-i,"px")}),U(a,"getStrokeDasharray",function(t,i,o){var u=o.reduce(function(g,w){return g+w});if(!u)return a.generateSimpleStrokeDasharray(i,t);for(var x=Math.floor(t/u),h=t%u,p=i-t,T=[],m=0,j=0;m<o.length;j+=o[m],++m)if(j+o[m]>h){T=[].concat(ue(o.slice(0,m)),[h-j]);break}var d=T.length%2===0?[0,p]:[p];return[].concat(ue(n.repeat(o,x)),ue(T),d).map(function(g){return"".concat(g,"px")}).join(", ")}),U(a,"id",Hn("recharts-line-")),U(a,"pathRef",function(t){a.mainCurve=t}),U(a,"handleAnimationEnd",function(){a.setState({isAnimationFinished:!0}),a.props.onAnimationEnd&&a.props.onAnimationEnd()}),U(a,"handleAnimationStart",function(){a.setState({isAnimationFinished:!1}),a.props.onAnimationStart&&a.props.onAnimationStart()}),a}return La(n,s),Ea(n,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,c){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var l=this.props,t=l.points,i=l.xAxis,o=l.yAxis,u=l.layout,x=l.children,h=$n(x,Un);if(!h)return null;var p=function(j,d){return{x:j.x,y:j.y,value:j.value,errorVal:Ss(j.payload,d)}},T={clipPath:r?"url(#clipPath-".concat(c,")"):null};return V.createElement(ze,T,h.map(function(m){return V.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:t,xAxis:i,yAxis:o,layout:u,dataPointFormatter:p})}))}},{key:"renderDots",value:function(r,c,l){var t=this.props.isAnimationActive;if(t&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.dot,u=i.points,x=i.dataKey,h=Ee(this.props,!1),p=Ee(o,!0),T=u.map(function(j,d){var g=R(R(R({key:"dot-".concat(d),r:3},h),p),{},{index:d,cx:j.x,cy:j.y,value:j.value,dataKey:x,payload:j.payload,points:u});return n.renderDotItem(o,g)}),m={clipPath:r?"url(#clipPath-".concat(c?"":"dots-").concat(l,")"):null};return V.createElement(ze,be({className:"recharts-line-dots",key:"dots"},m),T)}},{key:"renderCurveStatically",value:function(r,c,l,t){var i=this.props,o=i.type,u=i.layout,x=i.connectNulls;i.ref;var h=gs(i,ba),p=R(R(R({},Ee(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(l,")"):null,points:r},t),{},{type:o,layout:u,connectNulls:x});return V.createElement(zn,be({},p,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,c){var l=this,t=this.props,i=t.points,o=t.strokeDasharray,u=t.isAnimationActive,x=t.animationBegin,h=t.animationDuration,p=t.animationEasing,T=t.animationId,m=t.animateNewValues,j=t.width,d=t.height,g=this.state,w=g.prevPoints,F=g.totalLength;return V.createElement(Wn,{begin:x,duration:h,isActive:u,easing:p,from:{t:0},to:{t:1},key:"line-".concat(T),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function($){var M=$.t;if(w){var se=w.length/i.length,J=i.map(function(P,$e){var fe=Math.floor($e*se);if(w[fe]){var ve=w[fe],de=ye(ve.x,P.x),Ms=ye(ve.y,P.y);return R(R({},P),{},{x:de(M),y:Ms(M)})}if(m){var $s=ye(j*2,P.x),Us=ye(d/2,P.y);return R(R({},P),{},{x:$s(M),y:Us(M)})}return R(R({},P),{},{x:P.x,y:P.y})});return l.renderCurveStatically(J,r,c)}var oe=ye(0,F),C=oe(M),A;if(o){var B="".concat(o).split(/[,\s]+/gim).map(function(P){return parseFloat(P)});A=l.getStrokeDasharray(C,F,B)}else A=l.generateSimpleStrokeDasharray(F,C);return l.renderCurveStatically(i,r,c,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,c){var l=this.props,t=l.points,i=l.isAnimationActive,o=this.state,u=o.prevPoints,x=o.totalLength;return i&&t&&t.length&&(!u&&x>0||!qn(u,t))?this.renderCurveWithAnimation(r,c):this.renderCurveStatically(t,r,c)}},{key:"render",value:function(){var r,c=this.props,l=c.hide,t=c.dot,i=c.points,o=c.className,u=c.xAxis,x=c.yAxis,h=c.top,p=c.left,T=c.width,m=c.height,j=c.isAnimationActive,d=c.id;if(l||!i||!i.length)return null;var g=this.state.isAnimationFinished,w=i.length===1,F=us("recharts-line",o),$=u&&u.allowDataOverflow,M=x&&x.allowDataOverflow,se=$||M,J=es(d)?this.id:d,oe=(r=Ee(t,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},C=oe.r,A=C===void 0?3:C,B=oe.strokeWidth,P=B===void 0?2:B,$e=Gn(t)?t:{},fe=$e.clipDot,ve=fe===void 0?!0:fe,de=A*2+P;return V.createElement(ze,{className:F},$||M?V.createElement("defs",null,V.createElement("clipPath",{id:"clipPath-".concat(J)},V.createElement("rect",{x:$?p:p-T/2,y:M?h:h-m/2,width:$?T:T*2,height:M?m:m*2})),!ve&&V.createElement("clipPath",{id:"clipPath-dots-".concat(J)},V.createElement("rect",{x:p-de/2,y:h-de/2,width:T+de,height:m+de}))):null,!w&&this.renderCurve(se,J),this.renderErrorBar(se,J),(w||t)&&this.renderDots(se,ve,J),(!j||g)&&Kn.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,c){return r.animationId!==c.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:c.curPoints}:r.points!==c.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,c){for(var l=r.length%2!==0?[].concat(ue(r),[0]):r,t=[],i=0;i<c;++i)t=[].concat(ue(t),ue(l));return t}},{key:"renderDotItem",value:function(r,c){var l;if(V.isValidElement(r))l=V.cloneElement(r,c);else if(Rn(r))l=r(c);else{var t=c.key,i=gs(c,Ia),o=us("recharts-line-dot",typeof r!="boolean"?r.className:"");l=V.createElement(Mn,be({key:t},i,{className:o}))}return l}}])})(f.PureComponent);U(pe,"displayName","Line");U(pe,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Yn.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});U(pe,"getComposedData",function(s){var n=s.props,a=s.xAxis,r=s.yAxis,c=s.xAxisTicks,l=s.yAxisTicks,t=s.dataKey,i=s.bandSize,o=s.displayedData,u=s.offset,x=n.layout,h=o.map(function(p,T){var m=Ss(p,t);return x==="horizontal"?{x:hs({axis:a,ticks:c,bandSize:i,entry:p,index:T}),y:es(m)?null:r.scale(m),value:m,payload:p}:{x:es(m)?null:a.scale(m),y:hs({axis:r,ticks:l,bandSize:i,entry:p,index:T}),value:m,payload:p}});return R({points:h,layout:x},u)});var Va=Xn({chartName:"LineChart",GraphicalChild:pe,axisComponents:[{axisType:"xAxis",AxisComp:Ts},{axisType:"yAxis",AxisComp:Es}],formatAxisMap:Jn});const Ne=[{month:"Jan",revenue:12500,expenses:8200},{month:"Feb",revenue:15800,expenses:9100},{month:"Mar",revenue:18200,expenses:10500},{month:"Apr",revenue:16900,expenses:9800},{month:"May",revenue:21300,expenses:11200},{month:"Jun",revenue:24500,expenses:12800},{month:"Jul",revenue:22800,expenses:11900},{month:"Aug",revenue:26100,expenses:13500},{month:"Sep",revenue:28900,expenses:14200},{month:"Oct",revenue:31200,expenses:15100}];function _a(){const s=Ne.reduce((a,r)=>a+r.revenue,0),n=s/Ne.length;return e.jsxs(G,{children:[e.jsxs(K,{children:[e.jsx(H,{children:"Revenue Analytics"}),e.jsx(Y,{children:"Revenue and expenses over time"})]}),e.jsxs(X,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3 mb-6",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Be,{className:"h-4 w-4"}),"Total Revenue"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",s.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Ge,{className:"h-3 w-3"}),e.jsx("span",{children:"+24.5% from last period"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Be,{className:"h-4 w-4"}),"Average Monthly"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",n.toLocaleString(void 0,{maximumFractionDigits:0})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Ge,{className:"h-3 w-3"}),e.jsx("span",{children:"+18.2% growth rate"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Be,{className:"h-4 w-4"}),"Current Month"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",Ne[Ne.length-1].revenue.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Ge,{className:"h-3 w-3"}),e.jsx("span",{children:"+8.0% from last month"})]})]})]}),e.jsx(Qn,{config:{revenue:{label:"Revenue",color:"hsl(var(--chart-1))"},expenses:{label:"Expenses",color:"hsl(var(--chart-2))"}},className:"h-[400px]",children:e.jsx(Zn,{width:"100%",height:"100%",children:e.jsxs(Va,{data:Ne,margin:{top:5,right:10,left:10,bottom:5},children:[e.jsx(ea,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Ts,{dataKey:"month",className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Es,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(sa,{content:e.jsx(na,{})}),e.jsx(pe,{type:"monotone",dataKey:"revenue",stroke:"var(--color-revenue)",strokeWidth:2,dot:{fill:"var(--color-revenue)",r:4}}),e.jsx(pe,{type:"monotone",dataKey:"expenses",stroke:"var(--color-expenses)",strokeWidth:2,dot:{fill:"var(--color-expenses)",r:4}})]})})})]})]})}const Ra="updateBusiness",_s=()=>{const[{fetching:s},n]=je(Qs),a=f.useCallback(async r=>{const c=`Error updating business ID [${r.businessId}]`,l=`${Ra}-${r.businessId}`;L.loading("Updating business",{id:l});try{const t=await n(r),i=ge(t,c,l,"updateBusiness");if(i)return L.success("Success",{id:l,description:"Business updated"}),i.updateBusiness}catch(t){console.error(`${c}: ${t}`),L.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateBusiness:a}},Ma="insertClient",$a=()=>{const[{fetching:s},n]=je(Zs),a=f.useCallback(async r=>{const c=`Error creating client [${r.fields.businessId}]`,l=`${Ma}-${r.fields.businessId}`;L.loading("Creating Client...",{id:l});try{const t=await n(r),i=ge(t,c,l,"insertClient");if(i)return L.success("Success",{id:l,description:`Client [${r.fields.businessId}] was created`}),i.insertClient}catch(t){console.error(`${c}: ${t}`),L.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertClient:a}},Ua="updateClient",Rs=()=>{const[{fetching:s},n]=je(en),a=f.useCallback(async r=>{const c=`Error updating client ID [${r.businessId}]`,l=`${Ua}-${r.businessId}`;L.loading("Updating client",{id:l});try{const t=await n(r),i=ge(t,c,l,"updateClient");if(i)return L.success("Success",{id:l,description:"Client updated"}),i.updateClient}catch(t){console.error(`${c}: ${t}`),L.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateClient:a}},za=Fe({businessId:Ke().optional(),emails:He(Ye()).optional(),generatedDocumentType:me(Object.values(he)),greenInvoiceId:Ke().optional(),hiveId:_().optional()});function Wa({client:s,businessId:n,onDone:a}){const[r,c]=f.useState(!1),[l,t]=f.useState(null),{updateClient:i}=Rs(),{insertClient:o}=$a(),[u,x]=f.useState(""),h={businessId:n,generatedDocumentType:he.Proforma,emails:[]},p=ke({resolver:Le(za),defaultValues:s||h});f.useEffect(()=>{s&&(t(s),p.reset({emails:s.emails,greenInvoiceId:s.greenInvoiceId,hiveId:s.hiveId,generatedDocumentType:s.generatedDocumentType,businessId:s.businessId}),c(!0))},[s,p]);const T=()=>{t(null),p.reset(h),c(!0)},m=()=>{if(u.trim()){const g=p.getValues("emails");p.setValue("emails",[...g??[],u.trim()],{shouldDirty:!0}),x("")}},j=g=>{const w=p.getValues("emails");p.setValue("emails",(w??[]).filter((F,$)=>$!==g),{shouldDirty:!0})},d=f.useCallback(async g=>{if(l)i({businessId:n,fields:g});else{if(!g.greenInvoiceId){p.setError("greenInvoiceId",{message:"Green Invoice ID is required"});return}o({fields:{...g,greenInvoiceId:g.greenInvoiceId,businessId:n}})}c(!1),t(null),a?.()},[l,a,i,n,o,p]);return e.jsxs(we,{open:r,onOpenChange:c,children:[e.jsx(is,{asChild:!0,children:e.jsxs(S,{size:"sm",onClick:T,children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"New Client"]})}),e.jsxs(Ae,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ve,{children:[e.jsx(_e,{children:l?"Edit Client":"Create New Client"}),e.jsx(Re,{children:l?"Update client details":"Add a new client with all required details"})]}),e.jsx(Te,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(d),children:[e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(v,{control:p.control,name:"emails",render:({field:g})=>e.jsxs(y,{children:[e.jsx(N,{children:"Emails"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{placeholder:"Add email...",value:u,onChange:w=>x(w.target.value),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),m())}}),e.jsx(S,{type:"button",size:"sm",onClick:m,children:e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:g.value?.map((w,F)=>e.jsxs(z,{variant:"secondary",className:"gap-1",children:[w,e.jsx(S,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>j(F),children:e.jsx(ce,{className:"size-3 cursor-pointer"})})]},F))}),e.jsx(D,{})]})}),e.jsx(v,{control:p.control,name:"generatedDocumentType",render:({field:g})=>e.jsxs(y,{children:[e.jsx(N,{children:"Default Document Type"}),e.jsxs(ae,{onValueChange:g.onChange,defaultValue:g.value,children:[e.jsx(I,{children:e.jsx(te,{children:e.jsx(re,{})})}),e.jsx(ie,{children:Object.values(he).map(w=>e.jsx(ee,{value:w,children:cs(w)},w))})]}),e.jsx(D,{})]})}),e.jsx(v,{control:p.control,name:"greenInvoiceId",render:({field:g})=>e.jsxs(y,{children:[e.jsx(N,{children:"Green Invoice ID"}),e.jsx(I,{children:e.jsx(b,{type:"text",placeholder:"Enter Green Invoice ID",...g,required:!l})}),e.jsx(D,{})]})}),e.jsx(v,{control:p.control,name:"hiveId",render:({field:g})=>e.jsxs(y,{children:[e.jsx(N,{children:"Hive ID"}),e.jsx(I,{children:e.jsx(b,{type:"text",placeholder:"Enter Hive ID",...g,required:!l})}),e.jsx(D,{})]})})]})}),e.jsxs(Me,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(S,{type:"submit",children:l?"Update Client":"Create Client"})]})]})})]})]})}const qa=Object.values(on);function ys(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{isClient:!!s.clientInfo?.id,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough??void 0,isDocumentsOptional:s.isDocumentsOptional??void 0,isVatOptional:s.optionalVAT??void 0,isExemptDealer:s.exemptDealer??void 0,sortCode:s.sortCode?.key?.toString()??void 0,taxCategory:s.taxCategory?.id??void 0,pcn874RecordType:s?.pcn874RecordType??void 0,irsCode:s?.irsCode??void 0,description:s.suggestions?.description??void 0,tags:s.suggestions?.tags?.map(n=>n.id)??[],phrases:s.suggestions?.phrases??[],emails:s.suggestions?.emails??[],internalLinks:s.suggestions?.emailListener?.internalEmailLinks??[],attachmentTypes:s.suggestions?.emailListener?.attachments??[],useMessageBody:s.suggestions?.emailListener?.emailBody??void 0}}function Ga(s){const a=s.internalLinks||s.useMessageBody||s.attachmentTypes?{internalEmailLinks:s.internalLinks,emailBody:s.useMessageBody,attachments:s.attachmentTypes}:void 0,c=s.description||s.tags||s.phrases||s.emails||a?{description:s.description,tags:s.tags?.map(l=>({id:l})),phrases:s.phrases,emails:s.emails,emailListener:a}:void 0;return{optionalVAT:s.isVatOptional,exemptDealer:s.isExemptDealer,sortCode:s.sortCode?parseInt(s.sortCode):void 0,taxCategory:s.taxCategory,pcn874RecordType:s.pcn874RecordType,irsCode:s.irsCode,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough,isDocumentsOptional:s.isDocumentsOptional,suggestions:c}}function Ka({data:s,refetchBusiness:n}){const a=Se(sn,s),[r,c]=f.useState(ys(a)),{userContext:l}=f.useContext(rs),{updateBusiness:t,fetching:i}=_s(),[o,u]=f.useState(!1),[x,h]=f.useState(void 0),p=ke({defaultValues:r}),T=async j=>{if(!a||!l?.context.adminBusinessId)return;const d=ts(j,p.formState.dirtyFields);if(!d)return;const g=Ga(d);await t({businessId:a.id,ownerId:l.context.adminBusinessId,fields:g}),d.tags?.length||d.description?(h({tagIds:d.tags?.map(w=>({id:w})),description:d.description}),u(!0)):n?.()};if(f.useEffect(()=>{if(a){const j=ys(a);c(j),p.reset(j)}},[a,p]),!a)return e.jsx("div",{});const m=p.watch("isClient");return e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Configurations"}),e.jsx(Y,{children:"Business status, tax settings, automation rules, and integration preferences"})]}),!m&&e.jsx(Wa,{businessId:a.id,onDone:n})]})}),e.jsx(Te,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(T),children:[e.jsxs(X,{className:"space-y-6",children:[e.jsx(Ha,{form:p}),e.jsx(Ue,{}),e.jsx(Ya,{form:p}),e.jsx(Ue,{}),e.jsx(Xa,{form:p}),e.jsx(Ue,{}),e.jsx(Ja,{form:p})]}),e.jsx(as,{className:"flex justify-end border-t pt-6",children:e.jsxs(S,{type:"submit",disabled:i||Object.keys(p.formState.dirtyFields).length===0,children:[e.jsx(ds,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(ja,{businessId:a.id,tagIds:x?.tagIds,description:x?.description,open:o,onOpenChange:u,onClose:n})]})}function Ha({form:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Business Status & Behavior"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:s.control,name:"isClient",render:({field:n,fieldState:a})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"Is Client"}),e.jsx(ne,{children:"Mark this business as a client"})]}),e.jsx(I,{children:e.jsx(Z,{disabled:!0,checked:n.value,onCheckedChange:n.onChange,className:k(a)})})]})}),e.jsx(v,{control:s.control,name:"isActive",render:({field:n,fieldState:a})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"Is Active"}),e.jsx(ne,{children:"Business is currently active"})]}),e.jsx(I,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:k(a)})})]})}),e.jsx(v,{control:s.control,name:"isReceiptEnough",render:({field:n,fieldState:a})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"Is Receipt Enough"}),e.jsx(ne,{children:"Generate ledger for receipt documents if no invoice available"})]}),e.jsx(I,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:k(a)})})]})}),e.jsx(v,{control:s.control,name:"isDocumentsOptional",render:({field:n,fieldState:a})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"No Docs Required"}),e.jsx(ne,{children:"Skip document validation for common charges"})]}),e.jsx(I,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:k(a)})})]})}),e.jsx(v,{control:s.control,name:"isVatOptional",render:({field:n,fieldState:a})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"Is VAT Optional"}),e.jsx(ne,{children:"Mute missing VAT indicator"})]}),e.jsx(I,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:k(a)})})]})}),e.jsx(v,{control:s.control,name:"isExemptDealer",render:({field:n,fieldState:a})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"Is Exempt Dealer"}),e.jsx(ne,{children:"Business is exempt from VAT requirements"})]}),e.jsx(I,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:k(a)})})]})})]})]})}function Ya({form:s}){const{selectableTaxCategories:n,fetching:a}=nn(),{selectableSortCodes:r,fetching:c,sortCodes:l}=an(),{selectableTags:t,fetching:i}=tn(),o=f.useCallback(u=>{if(u){const x=l.find(h=>Number(h.key)===Number(u));x&&(x.defaultIrsCode?s.setValue("irsCode",x.defaultIrsCode,{shouldDirty:!0}):s.setValue("irsCode",null,{shouldDirty:!0}))}},[s,l]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Default Settings"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(v,{control:s.control,name:"sortCode",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Sort Code"}),e.jsx(I,{children:e.jsx(Xe,{onChange:h=>{o(h),u.onChange(h)},data:r,value:u.value,disabled:c,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:k(x)}})}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"taxCategory",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Tax Category"}),e.jsx(I,{children:e.jsx(Xe,{data:n,disabled:a,value:u.value,onChange:u.onChange,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:k(x)}})}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"pcn874RecordType",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"PCN874 Record Type"}),e.jsxs(ae,{onValueChange:u.onChange,value:u.value,children:[e.jsx(I,{children:e.jsx(te,{className:k(x),children:e.jsx(re,{})})}),e.jsx(ie,{children:Object.entries(rn).map(([h,p])=>e.jsx(ee,{value:h,children:`${p} (${h})`},h))})]}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"irsCode",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"IRS Code"}),e.jsx(I,{children:e.jsx(cn,{value:u.value??void 0,onValueChange:h=>u.onChange(h??null),hideControls:!0,decimalScale:0,className:k(x)})}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"description",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Charge Description"}),e.jsx(I,{children:e.jsx(b,{placeholder:"Enter default charge description",...u,className:k(x)})}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"tags",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Tags"}),e.jsx(I,{children:e.jsx(ln,{options:Object.values(t).map(({value:h,label:p})=>({label:p,value:h})),onValueChange:u.onChange,defaultValue:u.value,value:u.value,placeholder:"Select Default Tags",variant:"default",disabled:i,className:k(x)})}),e.jsx(D,{})]})})]})]})}function Xa({form:s}){const[n,a]=f.useState(""),[r,c]=f.useState(""),l=()=>{if(n.trim()){const u=s.getValues("phrases");s.setValue("phrases",[...u,n.trim()],{shouldDirty:!0}),a("")}},t=()=>{if(r.trim()){const u=s.getValues("emails");s.setValue("emails",[...u,r.trim()],{shouldDirty:!0}),c("")}},i=u=>{const x=s.getValues("phrases");s.setValue("phrases",x.filter((h,p)=>p!==u),{shouldDirty:!0})},o=u=>{const x=s.getValues("emails");s.setValue("emails",x.filter((h,p)=>p!==u),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Auto-matching Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure patterns for automatic matching of bank transactions and documents"}),e.jsx(v,{control:s.control,name:"phrases",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Phrases"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{placeholder:"Add phrase...",value:n,onChange:h=>a(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),l())},className:k(x)}),e.jsx(S,{type:"button",size:"sm",onClick:l,children:e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:u.value?.map((h,p)=>e.jsxs(z,{variant:"secondary",className:"gap-1",children:[h,e.jsx(S,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>i(p),children:e.jsx(ce,{className:"size-3 cursor-pointer",onClick:()=>i(p)})})]},p))}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"emails",render:({field:u,fieldState:x})=>e.jsxs(y,{children:[e.jsx(N,{children:"Email Addresses"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{type:"email",placeholder:"Add email...",value:r,onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),t())},className:k(x)}),e.jsx(S,{type:"button",size:"sm",onClick:t,children:e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:u.value?.map((h,p)=>e.jsxs(z,{variant:"secondary",className:"gap-1",children:[h,e.jsx(S,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>o(p),children:e.jsx(ce,{className:"size-3 cursor-pointer"})})]},p))}),e.jsx(D,{})]})})]})}function Ja({form:s}){const[n,a]=f.useState(""),r=()=>{if(n.trim()){const t=s.getValues("internalLinks");s.setValue("internalLinks",[...t,n.trim()],{shouldDirty:!0}),a("")}},c=t=>{const i=s.getValues("attachmentTypes");s.setValue("attachmentTypes",i?.includes(t)?i.filter(o=>o!==t):[...i,t],{shouldDirty:!0})},l=t=>{const i=s.getValues("internalLinks");s.setValue("internalLinks",i.filter((o,u)=>u!==t),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Gmail Feature Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Gmail integration settings for document processing"}),e.jsx(v,{control:s.control,name:"attachmentTypes",render:({field:t,fieldState:i})=>e.jsxs(y,{children:[e.jsx(N,{children:"Attachment Types"}),e.jsx("div",{className:k(i)+" rounded-md flex flex-wrap gap-2",children:qa.map(o=>e.jsx(z,{variant:t.value?.includes(o)?"default":"outline",className:"cursor-pointer",onClick:()=>c(o),children:o},o))}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"internalLinks",render:({field:t,fieldState:i})=>e.jsxs(y,{children:[e.jsx(N,{children:"Internal Links"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{type:"url",placeholder:"Add internal link...",value:n,onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),r())}}),e.jsx(S,{type:"button",size:"sm",onClick:r,children:e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("div",{className:k(i)+" flex flex-wrap gap-2 rounded-md",children:t.value?.map((o,u)=>e.jsxs(z,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[o,e.jsx(S,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>l(u),children:e.jsx(ce,{className:"size-3 cursor-pointer flex-shrink-0"})})]},u))}),e.jsx(D,{})]})}),e.jsx(v,{control:s.control,name:"useMessageBody",render:({field:t,fieldState:i})=>e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{children:"Should Use Message Body"}),e.jsx(ne,{children:"Extract information from email message body"})]}),e.jsx(I,{children:e.jsx(Z,{checked:t.value,onCheckedChange:t.onChange,className:k(i)})})]})})]})}const Qa=Fe({businessName:_().min(1,"Business name is required"),locality:_().min(1,"Locality is required"),localName:_().optional(),govId:_().optional(),address:_().optional(),localAddress:_().optional(),phone:_().optional(),website:ws("Invalid URL").optional().or(As("")),generalContacts:He(Ye()).optional(),billingEmails:He(Ye()).optional()});function Ns(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{businessName:s.name,locality:s.country,localName:s.hebrewName??void 0,govId:s.governmentId??void 0,address:s.address??void 0,phone:s.phoneNumber??void 0,website:s.website??void 0,generalContacts:s.email?.split(",").map(n=>n.trim()),billingEmails:s.clientInfo?.emails}}function Za(s){return{name:s.businessName,country:s.locality,hebrewName:s.localName,governmentId:s.govId,address:s.address,phoneNumber:s.phone,website:s.website,email:s.generalContacts?.join(", ")}}function et({data:s,refetchBusiness:n}){const a=Se(mn,s),[r,c]=f.useState(Ns(a)),{userContext:l}=f.useContext(rs),{updateBusiness:t,fetching:i}=_s(),o=ke({resolver:Le(Qa),defaultValues:r}),{countries:u,fetching:x}=dn(),[h,p]=f.useState(""),[T,m]=f.useState(""),j=o.watch("locality"),d=o.watch("address"),g=o.watch("localAddress");f.useEffect(()=>{d!==r.address&&o.setValue("address",d,{shouldDirty:!0})},[d,r.address,o]),f.useEffect(()=>{g!==r.localAddress&&o.setValue("localAddress",g,{shouldDirty:!0})},[g,r.localAddress,o]);const w=a&&"clientInfo"in a&&!!a.clientInfo,F=j===l?.context.locality,$=C=>{h.trim()&&(o.setValue("generalContacts",[...C,h.trim()],{shouldDirty:!0}),p(""))},M=(C,A)=>{o.setValue("generalContacts",C.filter((B,P)=>P!==A),{shouldDirty:!0})},se=C=>{T.trim()&&(o.setValue("billingEmails",[...C,T.trim()],{shouldDirty:!0}),m(""))},J=(C,A)=>{o.setValue("billingEmails",C.filter((B,P)=>P!==A),{shouldDirty:!0})},oe=async C=>{if(!a||!l?.context.adminBusinessId)return;const A=ts(C,o.formState.dirtyFields);if(!A)return;const B=Za(A);await t({businessId:a.id,ownerId:l.context.adminBusinessId,fields:B}),n?.()};return f.useEffect(()=>{if(a){const C=Ns(a);c(C),o.reset(C)}},[a,o]),e.jsxs(G,{children:[e.jsxs(K,{children:[e.jsx(H,{children:"Contact Information"}),e.jsx(Y,{children:"Business contact details and address information"})]}),e.jsx(Te,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(oe),children:[e.jsx(X,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(v,{control:o.control,name:"businessName",render:({field:C,fieldState:A})=>e.jsxs(y,{children:[e.jsx(N,{children:"Business Name"}),e.jsx(I,{children:e.jsx(b,{...C,className:k(A)})}),e.jsx(D,{})]})}),e.jsx(v,{control:o.control,name:"locality",render:({field:C,fieldState:A})=>e.jsxs(y,{children:[e.jsx(N,{children:"Locality / Country"}),e.jsx(Xe,{onChange:C.onChange,data:u.map(B=>({value:B.code,label:B.name})),value:C.value,disabled:x,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:k(A)}}),e.jsx(D,{})]})}),F&&e.jsx(v,{control:o.control,name:"localName",render:({field:C,fieldState:A})=>e.jsxs(y,{children:[e.jsx(N,{children:"Local Name"}),e.jsx(I,{children:e.jsx(b,{...C,placeholder:"Business name in local language",className:k(A)})}),e.jsx(D,{})]})}),F&&e.jsx(v,{control:o.control,name:"govId",render:({field:C,fieldState:A})=>e.jsxs(y,{children:[e.jsx(N,{children:"Government ID"}),e.jsx(I,{children:e.jsx(b,{...C,placeholder:"Enter Government ID",className:k(A)})}),e.jsx(D,{})]})}),e.jsx(v,{control:o.control,name:"address",render:({field:C,fieldState:A})=>e.jsxs(y,{className:"md:col-span-2",children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"Address"]}),e.jsx(I,{children:e.jsx(Qe,{...C,rows:3,placeholder:"Enter business address",className:k(A)})}),e.jsx(D,{})]})}),F&&e.jsx(v,{control:o.control,name:"localAddress",render:({field:C,fieldState:A})=>e.jsxs(y,{className:"md:col-span-2",children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"Local Address"]}),e.jsx(I,{children:e.jsx(Qe,{...C,rows:3,placeholder:"Enter address in local language",className:k(A)})}),e.jsx(D,{})]})}),e.jsx(v,{control:o.control,name:"phone",render:({field:C,fieldState:A})=>e.jsxs(y,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Ds,{className:"h-4 w-4"}),"Phone"]}),e.jsx(I,{children:e.jsx(b,{...C,type:"tel",placeholder:"+1 (555) 123-4567",className:k(A)})}),e.jsx(D,{})]})}),e.jsx(v,{control:o.control,name:"website",render:({field:C,fieldState:A})=>e.jsxs(y,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(un,{className:"h-4 w-4"}),"Website"]}),e.jsx(I,{children:e.jsx(b,{...C,type:"url",placeholder:"https://example.com",className:k(A)})}),e.jsx(D,{})]})}),e.jsx(v,{control:o.control,name:"generalContacts",render:({field:C,fieldState:A})=>e.jsxs(y,{className:"md:col-span-2",children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Ze,{className:"h-4 w-4"}),"General Contacts"]}),e.jsx(I,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:k(A)+" flex flex-wrap gap-2 mb-2 rounded-md",children:C.value?.map((B,P)=>e.jsxs(z,{variant:"secondary",className:"gap-1 pr-1",children:[B,e.jsx("button",{type:"button",onClick:()=>M(C.value??[],P),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ce,{className:"h-3 w-3"})})]},P))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{value:h,onChange:B=>p(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),$(C.value??[]))},placeholder:"Add contact email",type:"email"}),e.jsx(S,{type:"button",variant:"outline",size:"icon",disabled:!h.trim(),onClick:()=>$(C.value??[]),children:e.jsx(W,{className:"h-4 w-4"})})]})]})}),e.jsx(D,{})]})}),w&&e.jsx(v,{control:o.control,name:"billingEmails",render:({field:C,fieldState:A})=>e.jsxs(y,{className:"md:col-span-2",children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Ze,{className:"h-4 w-4"}),"Billing Emails"]}),e.jsx(I,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:k(A)+" flex flex-wrap gap-2 mb-2 rounded-md",children:C.value?.map((B,P)=>e.jsxs(z,{variant:"secondary",className:"gap-1 pr-1",children:[B,e.jsx("button",{type:"button",onClick:()=>J(C.value??[],P),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ce,{className:"h-3 w-3"})})]},P))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{value:T,onChange:B=>m(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),se(C.value??[]))},placeholder:"Add billing email",type:"email"}),e.jsx(S,{type:"button",variant:"outline",size:"icon",disabled:!T.trim(),onClick:()=>se(C.value??[]),children:e.jsx(W,{className:"h-4 w-4"})})]})]})}),e.jsx(D,{})]})})]})}),e.jsx(as,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(S,{type:"submit",disabled:i||Object.keys(o.formState.dirtyFields).length===0,children:[e.jsx(ds,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})})]})}const st="createContract",nt=()=>{const[{fetching:s},n]=je(hn),a=f.useCallback(async r=>{const c=`Error creating new contract for client[${r.input.clientId}]`,l=`${st}-${r.input.clientId}`;L.loading("Creating contract",{id:l});try{const t=await n(r);ge(t,c,l)&&L.success("Success",{id:l,description:`Contract for client ${r.input.clientId} was successfully created`})}catch(t){console.error(`${c}: ${t}`),L.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[n]);return{creating:s,createContract:a}},at="updateContract",tt=()=>{const[{fetching:s},n]=je(xn),a=f.useCallback(async r=>{const c=`Error updating contract ID [${r.contractId}]`,l=`${at}-${r.contractId}`;L.loading("Updating contract",{id:l});try{const t=await n(r),i=ge(t,c,l,"updateContract");if(i)return L.success("Success",{id:l,description:"Contract updated"}),i.updateContract}catch(t){console.error(`${c}: ${t}`),L.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[n]);return{updating:s,updateContract:a}},rt=Fe({id:Ke().optional(),startDate:ms("Start date is required"),endDate:ms("End date is required"),po:_().optional(),paymentAmount:Is().min(0,"Payment amount must be non-negative"),paymentCurrency:me(Object.values(ls),"Currency is required"),productType:me(Object.values(ks)).optional(),msCloudLink:ws().optional().or(As("")),billingCycle:me(Object.values(Ie)).optional(),subscriptionPlan:me(Object.values(Pe)).optional(),isActive:pn(),defaultRemark:_().optional(),defaultDocumentType:me(Object.values(he))}),Cs={startDate:"",endDate:"",po:void 0,paymentAmount:0,paymentCurrency:ls.Usd,productType:ks.Hive,msCloudLink:void 0,billingCycle:Ie.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:he.Proforma};function it({clientId:s,contract:n,onDone:a}){const[r,c]=f.useState(!1),[l,t]=f.useState(null),{updateContract:i,updating:o}=tt(),{createContract:u,creating:x}=nt(),h=ke({resolver:Le(rt),defaultValues:n||Cs});f.useEffect(()=>{n&&(t(n),h.reset({startDate:n.startDate,endDate:n.endDate,po:n.po,paymentAmount:n.paymentAmount,paymentCurrency:n.paymentCurrency,productType:n.productType,msCloudLink:n.msCloudLink,billingCycle:n.billingCycle,subscriptionPlan:n.subscriptionPlan,isActive:n.isActive,defaultRemark:n.defaultRemark,defaultDocumentType:n.defaultDocumentType}),c(!0))},[n,h]);const p=()=>{t(null),h.reset(Cs),c(!0)},T=f.useCallback(async m=>{if(l)await i({contractId:l.id,input:{amount:{raw:m.paymentAmount,currency:m.paymentCurrency},billingCycle:m.billingCycle,documentType:m.defaultDocumentType,endDate:Ce(new Date(m.endDate),"yyyy-MM-dd"),isActive:m.isActive,msCloud:m.msCloudLink,plan:m.subscriptionPlan,product:m.productType,purchaseOrder:m.po,remarks:m.defaultRemark,startDate:Ce(new Date(m.startDate),"yyyy-MM-dd")}});else{if(!m.billingCycle){h.setError("billingCycle",{message:"Billing cycle is required"});return}await u({input:{clientId:s,amount:{raw:m.paymentAmount,currency:m.paymentCurrency},billingCycle:m.billingCycle,documentType:m.defaultDocumentType,endDate:Ce(new Date(m.endDate),"yyyy-MM-dd"),isActive:m.isActive,msCloud:m.msCloudLink,plan:m.subscriptionPlan,product:m.productType,purchaseOrder:m.po,remarks:m.defaultRemark,startDate:Ce(new Date(m.startDate),"yyyy-MM-dd")}})}c(!1),t(null),a?.()},[l,a,u,i,s,h]);return e.jsxs(we,{open:r,onOpenChange:c,children:[e.jsx(is,{asChild:!0,children:e.jsxs(S,{size:"sm",onClick:p,children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"New Contract"]})}),e.jsxs(Ae,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ve,{children:[e.jsx(_e,{children:l?"Edit Contract":"Create New Contract"}),e.jsx(Re,{children:l?"Update contract details":"Add a new contract with all required details"})]}),e.jsx(Te,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(T),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.jsx(v,{control:h.control,name:"po",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"PO Number"}),e.jsx(I,{children:e.jsx(b,{placeholder:"PO-2024-001",...m})}),e.jsx(D,{})]})})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(v,{control:h.control,name:"startDate",render:({field:{onChange:m,...j}})=>e.jsxs(y,{children:[e.jsx(N,{children:"Start Date"}),e.jsx(I,{children:e.jsx(b,{type:"date",...j,onInput:d=>m(d)})}),e.jsx(D,{})]})}),e.jsx(v,{control:h.control,name:"endDate",render:({field:{onChange:m,...j}})=>e.jsxs(y,{children:[e.jsx(N,{children:"End Date"}),e.jsx(I,{children:e.jsx(b,{type:"date",...j,onInput:d=>m(d)})}),e.jsx(D,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(v,{control:h.control,name:"paymentAmount",render:({field:m})=>e.jsxs(y,{className:"md:col-span-2",children:[e.jsx(N,{children:"Payment Amount"}),e.jsx(I,{children:e.jsx(b,{type:"number",placeholder:"24000",...m,onChange:j=>{m.onChange(j?.target.value?Number(j?.target.value):void 0)}})}),e.jsx(D,{})]})}),e.jsx(v,{control:h.control,name:"paymentCurrency",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"Currency"}),e.jsxs(ae,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(I,{children:e.jsx(te,{children:e.jsx(re,{})})}),e.jsx(ie,{children:Object.values(ls).map(j=>e.jsx(ee,{value:j,children:j},j))})]}),e.jsx(D,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(v,{control:h.control,name:"productType",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"Product Type"}),e.jsx(I,{children:e.jsx(b,{placeholder:"Cloud Services",...m})}),e.jsx(D,{})]})}),e.jsx(v,{control:h.control,name:"billingCycle",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"Billing Cycle"}),e.jsxs(ae,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(I,{children:e.jsx(te,{children:e.jsx(re,{})})}),e.jsx(ie,{children:Object.values(Ie).map(j=>e.jsx(ee,{value:j,children:Os(j)},j))})]}),e.jsx(D,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(v,{control:h.control,name:"subscriptionPlan",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"Subscription Plan"}),e.jsx(I,{children:e.jsxs(ae,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(I,{children:e.jsx(te,{children:e.jsx(re,{})})}),e.jsx(ie,{children:Object.values(Pe).map(j=>e.jsx(ee,{value:j,children:Ls(j)},j))})]})}),e.jsx(D,{})]})}),e.jsx(v,{control:h.control,name:"isActive",render:({field:m})=>e.jsxs(y,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(N,{className:"text-base",children:"Active Status"})}),e.jsx(I,{children:e.jsx(Z,{checked:m.value,onCheckedChange:m.onChange})})]})})]}),e.jsx(v,{control:h.control,name:"msCloudLink",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"MS Cloud Link"}),e.jsx(I,{children:e.jsx(b,{type:"url",placeholder:"https://portal.azure.com/contract-id",...m})}),e.jsx(D,{})]})}),e.jsx(v,{control:h.control,name:"defaultDocumentType",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"Default Document Type"}),e.jsxs(ae,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(I,{children:e.jsx(te,{children:e.jsx(re,{})})}),e.jsx(ie,{children:Object.values(he).map(j=>e.jsx(ee,{value:j,children:cs(j)},j))})]}),e.jsx(D,{})]})}),e.jsx(v,{control:h.control,name:"defaultRemark",render:({field:m})=>e.jsxs(y,{children:[e.jsx(N,{children:"Default Remark"}),e.jsx(I,{children:e.jsx(Qe,{placeholder:"Enter default remark for this contract...",rows:3,...m})}),e.jsx(D,{})]})})]}),e.jsxs(Me,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(S,{type:"submit",disabled:x||o,children:l?"Update Contract":"Create Contract"})]})]})})]})]})}function ct(s){return{id:s.id,po:s.purchaseOrder??void 0,startDate:s.startDate,endDate:s.endDate,paymentAmount:s.amount.raw,paymentCurrency:s.amount.currency,productType:s.product??void 0,billingCycle:s.billingCycle,msCloudLink:s.msCloud?.toString(),isActive:s.isActive,subscriptionPlan:s.plan??void 0,defaultRemark:s.remarks??void 0,defaultDocumentType:s.documentType??void 0}}function lt({clientId:s}){const[n,a]=f.useState(null),[{data:r,fetching:c},l]=De({query:jn,variables:{clientId:s}}),t=r?.contractsByClient??[];return c?e.jsx("div",{children:"Loading contracts..."}):e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Contracts"}),e.jsx(Y,{children:"Current and past contracts sorted by start date"})]}),e.jsx(it,{clientId:s,contract:n,onDone:l})]})}),e.jsx(X,{className:"space-y-4",children:t.map(i=>{const o=!!i.isActive;return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:i.product}),e.jsx(z,{variant:o?"default":"secondary",children:i.isActive?"Active":"Inactive"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:i.id})]}),e.jsx(S,{variant:"ghost",size:"sm",onClick:()=>a(ct(i)),children:e.jsx(aa,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(gn,{className:"h-3 w-3"}),"Contract Period"]}),e.jsxs("p",{className:"text-sm font-medium",children:[new Date(i.startDate).toLocaleDateString()," →"," ",new Date(i.endDate).toLocaleDateString()]})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"PO Number"}),e.jsx("p",{className:"text-sm font-medium font-mono",children:i.purchaseOrder})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Payment"}),e.jsx("p",{className:"text-sm font-medium",children:fn(i.amount.raw,i.amount.currency)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing Cycle"}),e.jsx("p",{className:"text-sm font-medium",children:Os(i.billingCycle)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscription Plan"}),e.jsx("p",{className:"text-sm font-medium",children:i.plan?Ls(i.plan):"N/A"})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Document Type"}),e.jsx("p",{className:"text-sm font-medium",children:cs(i.documentType)})]})]}),i.remarks&&e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remark"}),e.jsx("p",{className:"text-sm",children:i.remarks})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.msCloud&&e.jsx(S,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:i.msCloud.toString(),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(vn,{className:"h-4 w-4 mr-2"}),"MS Cloud",e.jsx(yn,{className:"h-3 w-3 ml-1"})]})})})]},i.id)})})]})}function ot({businessId:s}){return e.jsxs(G,{children:[e.jsx(K,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(H,{children:"Documents"}),e.jsx(Y,{children:"Invoices, proformas, receipts, and other accounting documents"})]})})}),e.jsx(X,{children:e.jsx(Nn,{businessId:s,linkedDocumentIds:[],limit:1e3})})]})}function dt(){const[s,n]=f.useState([{id:"1",accountNumber:"123456789",isBusiness:!0,type:"BANK",currencies:[{currency:"ILS",taxCategory:"Standard ILS"},{currency:"USD",taxCategory:"Foreign Currency"}],bankNumber:12,branchNumber:345,extendedBankNumber:123456789,partyPreferredIndication:1,partyAccountInvolvementCode:2,accountDealDate:20200101,accountUpdateDate:20240101,metegDoraNet:1,kodHarshaatPeilut:100,accountClosingReasonCode:0,accountAgreementOpeningDate:20200101,serviceAuthorizationDesc:"Full access",branchTypeCode:1,mymailEntitlementSwitch:1,productLabel:"Business Checking Account"},{id:"2",accountNumber:"9876543210",isBusiness:!1,type:"CREDIT_CARD",currencies:[{currency:"ILS",taxCategory:"A-ILS category"},{currency:"USD",taxCategory:"SOME CATEGORY"}]},{id:"3",accountNumber:"0xABC123DEF456",isBusiness:!1,type:"CRYPTO_WALLET",currencies:[{currency:"ETH",taxCategory:"Crypto Assets"}]}]),[a,r]=f.useState(!1),[c,l]=f.useState(null),[t,i]=f.useState({accountNumber:"",isBusiness:!1,type:"BANK",currencies:[]}),o=d=>{d?(l(d),i(d)):(l(null),i({accountNumber:"",isBusiness:!1,type:"BANK",currencies:[]})),r(!0)},u=()=>{r(!1),l(null),i({accountNumber:"",isBusiness:!1,type:"BANK",currencies:[]})},x=d=>{d.preventDefault(),n(c?s.map(g=>g.id===c.id?{...t,id:g.id}:g):[...s,{...t,id:Date.now().toString()}]),u()},h=()=>{i({...t,currencies:[...t.currencies||[],{currency:"USD",taxCategory:""}]})},p=d=>{i({...t,currencies:t.currencies?.filter((g,w)=>w!==d)||[]})},T=(d,g,w)=>{const F=[...t.currencies||[]];F[d]={...F[d],[g]:w},i({...t,currencies:F})},m=d=>{switch(d){case"BANK":return e.jsx(Bs,{className:"h-5 w-5"});case"CREDIT_CARD":return e.jsx(bn,{className:"h-5 w-5"});case"CRYPTO_WALLET":return e.jsx(ia,{className:"h-5 w-5"})}},j=d=>{switch(d){case"BANK":return"Bank Account";case"CREDIT_CARD":return"Credit Card";case"CRYPTO_WALLET":return"Crypto Wallet"}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Financial Accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage bank accounts, credit cards, and crypto wallets"})]}),e.jsxs(S,{onClick:()=>o(),children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"New Account"]})]}),e.jsx("div",{className:"grid gap-4",children:s.map(d=>e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:m(d.type)}),e.jsxs("div",{children:[e.jsx(H,{className:"text-lg",children:d.accountNumber}),e.jsxs(Y,{className:"flex items-center gap-2 mt-1",children:[e.jsx(z,{variant:"outline",children:j(d.type)}),d.isBusiness&&e.jsx(z,{variant:"secondary",children:"Business"})]})]})]}),e.jsx(S,{variant:"ghost",size:"sm",onClick:()=>o(d),children:e.jsx(Cn,{className:"h-4 w-4"})})]})}),e.jsxs(X,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currencies & Tax Categories"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.currencies.map((g,w)=>e.jsxs(z,{variant:"secondary",className:"text-xs",children:[g.currency," → ",g.taxCategory]},w))})]}),d.type==="BANK"&&e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Bank Details"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Bank Number:"}),e.jsx("p",{className:"font-medium",children:d.bankNumber})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Branch Number:"}),e.jsx("p",{className:"font-medium",children:d.branchNumber})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Extended Bank Number:"}),e.jsx("p",{className:"font-medium",children:d.extendedBankNumber})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Party Preferred Indication:"}),e.jsx("p",{className:"font-medium",children:d.partyPreferredIndication})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Party Account Involvement:"}),e.jsx("p",{className:"font-medium",children:d.partyAccountInvolvementCode})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Account Deal Date:"}),e.jsx("p",{className:"font-medium",children:d.accountDealDate})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Account Update Date:"}),e.jsx("p",{className:"font-medium",children:d.accountUpdateDate})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Meteg Dora Net:"}),e.jsx("p",{className:"font-medium",children:d.metegDoraNet})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Kod Harshaot Peilut:"}),e.jsx("p",{className:"font-medium",children:d.kodHarshaatPeilut})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Closing Reason Code:"}),e.jsx("p",{className:"font-medium",children:d.accountClosingReasonCode})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Agreement Opening Date:"}),e.jsx("p",{className:"font-medium",children:d.accountAgreementOpeningDate})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Branch Type Code:"}),e.jsx("p",{className:"font-medium",children:d.branchTypeCode})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Mymail Entitlement:"}),e.jsx("p",{className:"font-medium",children:d.mymailEntitlementSwitch})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Service Authorization:"}),e.jsx("p",{className:"font-medium",children:d.serviceAuthorizationDesc})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Product Label:"}),e.jsx("p",{className:"font-medium",children:d.productLabel})]})]})]})]})]},d.id))}),e.jsx(we,{open:a,onOpenChange:r,children:e.jsxs(Ae,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ve,{children:[e.jsx(_e,{children:c?"Edit Account":"New Account"}),e.jsx(Re,{children:c?"Update account details and settings":"Add a new financial account"})]}),e.jsxs("form",{onSubmit:x,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"accountNumber",children:"Account Number *"}),e.jsx(b,{id:"accountNumber",value:t.accountNumber,onChange:d=>i({...t,accountNumber:d.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"type",children:"Account Type *"}),e.jsxs(ae,{value:t.type,onValueChange:d=>i({...t,type:d}),children:[e.jsx(te,{id:"type",children:e.jsx(re,{})}),e.jsxs(ie,{children:[e.jsx(ee,{value:"BANK",children:"Bank Account"}),e.jsx(ee,{value:"CREDIT_CARD",children:"Credit Card"}),e.jsx(ee,{value:"CRYPTO_WALLET",children:"Crypto Wallet"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Z,{id:"isBusiness",checked:t.isBusiness,onCheckedChange:d=>i({...t,isBusiness:d})}),e.jsx(O,{htmlFor:"isBusiness",children:"Business Account"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Currencies & Tax Categories"}),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:h,children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Add Currency"]})]}),e.jsx("div",{className:"space-y-3",children:t.currencies?.map((d,g)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[e.jsx(b,{placeholder:"Currency (e.g., ILS, USD)",value:d.currency,onChange:w=>T(g,"currency",w.target.value)}),e.jsx(b,{placeholder:"Tax Category",value:d.taxCategory,onChange:w=>T(g,"taxCategory",w.target.value)})]}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",onClick:()=>p(g),children:e.jsx(ce,{className:"h-4 w-4"})})]},g))})]}),t.type==="BANK"&&e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Bank-Specific Details"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"bankNumber",children:"Bank Number"}),e.jsx(b,{id:"bankNumber",type:"number",value:t.bankNumber||"",onChange:d=>i({...t,bankNumber:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"branchNumber",children:"Branch Number"}),e.jsx(b,{id:"branchNumber",type:"number",value:t.branchNumber||"",onChange:d=>i({...t,branchNumber:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"extendedBankNumber",children:"Extended Bank Number"}),e.jsx(b,{id:"extendedBankNumber",type:"number",value:t.extendedBankNumber||"",onChange:d=>i({...t,extendedBankNumber:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"partyPreferredIndication",children:"Party Preferred Indication"}),e.jsx(b,{id:"partyPreferredIndication",type:"number",value:t.partyPreferredIndication||"",onChange:d=>i({...t,partyPreferredIndication:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"partyAccountInvolvementCode",children:"Party Account Involvement Code"}),e.jsx(b,{id:"partyAccountInvolvementCode",type:"number",value:t.partyAccountInvolvementCode||"",onChange:d=>i({...t,partyAccountInvolvementCode:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"accountDealDate",children:"Account Deal Date"}),e.jsx(b,{id:"accountDealDate",type:"number",placeholder:"YYYYMMDD",value:t.accountDealDate||"",onChange:d=>i({...t,accountDealDate:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"accountUpdateDate",children:"Account Update Date"}),e.jsx(b,{id:"accountUpdateDate",type:"number",placeholder:"YYYYMMDD",value:t.accountUpdateDate||"",onChange:d=>i({...t,accountUpdateDate:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"metegDoraNet",children:"Meteg Dora Net"}),e.jsx(b,{id:"metegDoraNet",type:"number",value:t.metegDoraNet||"",onChange:d=>i({...t,metegDoraNet:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"kodHarshaatPeilut",children:"Kod Harshaot Peilut"}),e.jsx(b,{id:"kodHarshaatPeilut",type:"number",value:t.kodHarshaatPeilut||"",onChange:d=>i({...t,kodHarshaatPeilut:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"accountClosingReasonCode",children:"Account Closing Reason Code"}),e.jsx(b,{id:"accountClosingReasonCode",type:"number",value:t.accountClosingReasonCode||"",onChange:d=>i({...t,accountClosingReasonCode:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"accountAgreementOpeningDate",children:"Account Agreement Opening Date"}),e.jsx(b,{id:"accountAgreementOpeningDate",type:"number",placeholder:"YYYYMMDD",value:t.accountAgreementOpeningDate||"",onChange:d=>i({...t,accountAgreementOpeningDate:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"branchTypeCode",children:"Branch Type Code"}),e.jsx(b,{id:"branchTypeCode",type:"number",value:t.branchTypeCode||"",onChange:d=>i({...t,branchTypeCode:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"mymailEntitlementSwitch",children:"Mymail Entitlement Switch"}),e.jsx(b,{id:"mymailEntitlementSwitch",type:"number",value:t.mymailEntitlementSwitch||"",onChange:d=>i({...t,mymailEntitlementSwitch:Number.parseInt(d.target.value)||void 0})})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(O,{htmlFor:"serviceAuthorizationDesc",children:"Service Authorization Description"}),e.jsx(b,{id:"serviceAuthorizationDesc",value:t.serviceAuthorizationDesc||"",onChange:d=>i({...t,serviceAuthorizationDesc:d.target.value})})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2 lg:col-span-3",children:[e.jsx(O,{htmlFor:"productLabel",children:"Product Label"}),e.jsx(b,{id:"productLabel",value:t.productLabel||"",onChange:d=>i({...t,productLabel:d.target.value})})]})]})]}),e.jsxs(Me,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:u,children:"Cancel"}),e.jsx(S,{type:"submit",children:c?"Update Account":"Create Account"})]})]})]})})]})}const ut=[{id:"hive",name:"Hive",description:"Schema registry, analytics, metrics and gateway for GraphQL federation and other GraphQL APIs",status:"disconnected",lastSync:"Never"},{id:"slack",name:"Slack",description:"Team communication and notifications",status:"disconnected",lastSync:"Never"},{id:"retool",name:"Retool",description:"Internal tools and dashboards",status:"disconnected",lastSync:"Never"},{id:"linear",name:"Linear",description:"Issue tracking and project management",status:"disconnected",lastSync:"Never"},{id:"workflowy",name:"Workflowy",description:"Task management and note taking",status:"disconnected",lastSync:"Never"}];function mt({data:s}){const n=Se(wn,s),[{data:a,fetching:r},c]=De({query:In,variables:{clientId:n?.id??""},pause:!n?.clientInfo?.greenInvoiceId||!n?.id}),{updateClient:l}=Rs(),t=f.useCallback((o,u)=>{if(!n?.id)return;const x={};x[u]=o,l({businessId:n?.id,fields:x})},[n?.id,l]);f.useEffect(()=>{n?.clientInfo?.greenInvoiceId&&n?.id&&c()},[n?.clientInfo?.greenInvoiceId,n?.id,c]);const i=a?.greenInvoiceClient;return e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Integrations"}),e.jsx(Y,{children:"Connected external services and providers"})]}),e.jsxs(S,{size:"sm",children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Add Integration"]})]})}),e.jsx(X,{className:"space-y-6",children:e.jsxs(ta,{type:"multiple",defaultValue:["green-invoice"],className:"space-y-4",children:[r?e.jsxs(We,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(E,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-6 w-32"}),e.jsx(E,{className:"h-5 w-5 rounded-full"})]}),e.jsx(E,{className:"h-4 w-64"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-8 w-24"}),e.jsx(E,{className:"h-8 w-8"})]})]})}),e.jsx(qe,{children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(E,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(E,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-32"}),e.jsx(E,{className:"h-6 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(E,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"h-3 w-24"}),e.jsx(E,{className:"h-4 w-full"})]})]})]})]})})]}):e.jsxs(We,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-green-600 flex items-center justify-center text-white font-bold",children:"GI"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Green Invoice"}),e.jsx(ps,{className:"h-5 w-5 text-green-600"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Israeli invoicing system integration"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ht,{id:n?.clientInfo?.greenInvoiceId,provider:"Green Invoice",updateClient:async o=>t(o,"greenInvoiceId")}),e.jsx(xs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(qe,{children:i&&e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Business Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Integration ID"}),e.jsx("p",{className:"text-sm font-mono",children:n?.clientInfo?.greenInvoiceId})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Business Name"}),e.jsx("p",{className:"text-sm",children:i.name})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Country"}),e.jsx("p",{className:"text-sm",children:i.country})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"text-sm font-mono",children:i.taxId})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Contact Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(Ze,{className:"h-3.5 w-3.5"}),"Email Addresses"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.emails?.map((o,u)=>e.jsx("span",{className:"text-sm px-2 py-1 bg-muted rounded",children:o},u))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(Ds,{className:"h-3.5 w-3.5"}),"Phone"]}),e.jsx("p",{className:"text-sm font-mono",children:i.phone})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Mobile"}),e.jsx("p",{className:"text-sm font-mono",children:i.mobile})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Fax"}),e.jsx("p",{className:"text-sm font-mono",children:i.fax})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[e.jsx(Je,{className:"h-3.5 w-3.5"}),"Address"]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Street Address"}),e.jsx("p",{className:"text-sm",children:i.address})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"City"}),e.jsx("p",{className:"text-sm",children:i.city})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Zip Code"}),e.jsx("p",{className:"text-sm font-mono",children:i.zip})]})]})]})]})})]}),ut.map(o=>e.jsxs(We,{value:o.id,className:"rounded-lg border",children:[e.jsx("div",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-3 flex-1",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:o.name}),o.status==="connected"?e.jsx(ps,{className:"h-4 w-4 text-green-600"}):e.jsx(Dn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"ghost",size:"sm",onClick:u=>u.stopPropagation(),children:e.jsx(os,{className:"h-4 w-4"})}),e.jsx(xs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(qe,{children:e.jsx("div",{className:"px-4 pb-4 pt-2 border-t",children:e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last sync: "}),e.jsx("span",{className:"font-medium",children:o.lastSync})]})})})]},o.id))]})})]})}function ht({id:s,provider:n,updateClient:a}){const[r,c]=f.useState(!1),[l,t]=f.useState(s),i=f.useCallback(async()=>{await a(l),c(!1)},[l,a]);return e.jsxs(we,{open:r,onOpenChange:c,children:[e.jsx(is,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",onClick:o=>o.stopPropagation(),children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"Configure"]})}),e.jsxs(Ae,{onClick:o=>o.stopPropagation(),children:[e.jsxs(Ve,{children:[e.jsxs(_e,{children:["Configure ",n]}),e.jsxs(Re,{children:["Update your ",n," integration settings"]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(O,{htmlFor:"id",children:[n," ID"]}),e.jsx(b,{id:"id",value:l,onChange:o=>t(o.target.value),placeholder:`Enter ${n} ID`})]})}),e.jsxs(Me,{children:[e.jsx(S,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(S,{onClick:i,disabled:!l,children:"Save Changes"})]})]})]})}function xt({businessId:s}){return e.jsxs(G,{children:[e.jsx(K,{className:"flex w-full justify-between items-center",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(H,{children:"Transactions"}),e.jsx(Y,{children:"Complete transaction history for this business"})]})})}),e.jsx(X,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(An,{businessID:s,filter:{}})})})]})}function pt({data:s,refetchBusiness:n}){const a=Se(On,s),[r,c]=kn(),l=r.get("tab")||"contact",t=u=>{c({tab:u})};if(!a)return e.jsx("div",{children:"Business not found"});const i="clientInfo"in a&&!!a.clientInfo,o="adminInfo"in a&&!!a.adminInfo;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(_n,{data:a}),e.jsx("main",{className:"container mx-auto px-4 py-6 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs(Sn,{value:l,onValueChange:t,className:"w-full",children:[e.jsxs(Tn,{className:"grid w-full lg:grid-cols-8 sm:grid-cols-4 grid-cols-8 mb-6 h-auto gap-1 bg-muted/50 p-1",children:[e.jsxs(Q,{value:"contact",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Bs,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contact"})]}),e.jsxs(Q,{value:"config",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Config"})]}),e.jsxs(Q,{value:"charges",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Be,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Charges"})]}),e.jsxs(Q,{value:"transactions",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(En,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Transactions"})]}),e.jsxs(Q,{value:"documents",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Bn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documents"})]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs(Q,{value:"contracts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(da,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contracts"})]}),e.jsxs(Q,{value:"integrations",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(ma,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Integrations"})]})]}),o&&e.jsxs(e.Fragment,{children:[e.jsxs(Q,{value:"accounts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Pn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Accounts"})]}),e.jsxs(Q,{value:"admin",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Ps,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Admin"})]})]})]}),e.jsx(q,{value:"contact",className:"mt-0",children:e.jsx(et,{data:a,refetchBusiness:n})}),e.jsx(q,{value:"config",className:"mt-0",children:e.jsx(Ka,{data:a,refetchBusiness:n})}),e.jsx(q,{value:"charges",className:"mt-0",children:e.jsx(Ca,{businessId:a.id})}),e.jsx(q,{value:"transactions",className:"mt-0",children:e.jsx(xt,{businessId:a.id})}),e.jsx(q,{value:"documents",className:"mt-0",children:e.jsx(ot,{businessId:a.id})}),i&&e.jsxs(e.Fragment,{children:[e.jsx(q,{value:"contracts",className:"mt-0",children:e.jsx(lt,{clientId:a.id})}),e.jsx(q,{value:"integrations",className:"mt-0",children:e.jsx(mt,{data:a})}),e.jsx(q,{value:"charts",className:"mt-0",children:e.jsx(_a,{})})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(q,{value:"accounts",className:"mt-0",children:e.jsx(dt,{})}),e.jsx(q,{value:"admin",className:"mt-0",children:e.jsx(Na,{data:a})})]})]})})]})}function It(s){return`/businesses/${s}`}const Dt=()=>{const{businessId:s}=Ln();let n;try{n=Fn()}catch{}const[{data:a,fetching:r},c]=De({query:Vn,pause:!s||!!n,variables:{businessId:s??""}}),l=n||a;return!n&&r&&!l?.business?e.jsx(bs,{}):!s||!l?.business?e.jsx("div",{children:"Business not found"}):e.jsx(pt,{data:l.business,refetchBusiness:async()=>c()})};export{Dt as BusinessScreen,It as getBusinessHref};
@@ -1 +1 @@
1
- import{X as l,j as e,as as t,H as m,bs as x}from"./index-DfI9E1Fb.js";import{B as o}from"./building-2-B92gXbOj.js";function h({data:n}){const s=l(x,n);if(!s||s.__typename!=="LtdFinancialEntity")return e.jsx("div",{});const{isActive:i,adminInfo:r,clientInfo:a}=s,d=!!r?.id,c=!!a?.id;return e.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/60",children:e.jsx("div",{className:"container mx-auto px-4 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs("div",{className:"flex h-16 items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-accent",children:e.jsx(o,{className:"h-5 w-5 text-accent-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:s.name}),i?e.jsx(t,{variant:"secondary",children:"Active"}):e.jsx(t,{variant:"destructive",children:"Inactive"}),d&&e.jsx(t,{variant:"outline",children:"Admin"}),c&&e.jsx(t,{variant:"outline",children:"Client"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground truncate",children:["Business ID: ",s.id]})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-6 text-sm",children:[s.governmentId&&e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"font-medium text-foreground",children:s.governmentId})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Since"}),e.jsx("p",{className:"font-medium text-foreground",children:m(s.createdAt,"MMM yyyy")})]})]})]})})})}export{h as B};
1
+ import{X as l,j as e,as as t,H as m,bv as x}from"./index-Mle6gZrH.js";import{B as o}from"./building-2-Cgw5U9px.js";function h({data:n}){const s=l(x,n);if(!s||s.__typename!=="LtdFinancialEntity")return e.jsx("div",{});const{isActive:i,adminInfo:r,clientInfo:a}=s,d=!!r?.id,c=!!a?.id;return e.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/60",children:e.jsx("div",{className:"container mx-auto px-4 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs("div",{className:"flex h-16 items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-accent",children:e.jsx(o,{className:"h-5 w-5 text-accent-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:s.name}),i?e.jsx(t,{variant:"secondary",children:"Active"}):e.jsx(t,{variant:"destructive",children:"Inactive"}),d&&e.jsx(t,{variant:"outline",children:"Admin"}),c&&e.jsx(t,{variant:"outline",children:"Client"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground truncate",children:["Business ID: ",s.id]})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-6 text-sm",children:[s.governmentId&&e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"font-medium text-foreground",children:s.governmentId})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Since"}),e.jsx("p",{className:"font-medium text-foreground",children:m(s.createdAt,"MMM yyyy")})]})]})]})})})}export{h as B};
@@ -1 +1 @@
1
- import{bp as S,u as g,r as m,F as C,a as x,j as o,bt as y,n as T,bu as h,bv as b,b1 as n,bg as F,bw as v}from"./index-DfI9E1Fb.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(C),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=x({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(y,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(T,{}):o.jsx(h,{moreInfo:e=>o.jsx(F,{businessID:e.business.id,filter:c}),striped:!0,highlightOnHover:!0,stickyHeader:!0,items:p,columns:[{title:"Business Name",value:e=>e.business.name},{title:"Debit",value:e=>e.debit.formatted,style:{whiteSpace:"nowrap"}},{title:"Credit",value:e=>e.credit.formatted,style:{whiteSpace:"nowrap"}},{title:"Total",value:e=>e.total.raw&&(e.total.raw<-1e-4||e.total.raw>1e-4)?o.jsx(b,{color:e.total.raw>0?"green":"red",children:e.total.formatted}):e.total.formatted,style:{whiteSpace:"nowrap"}},...a(n.Eur),...a(n.Usd),...a(n.Gbp),...a(n.Cad),...a(n.Jpy),...a(n.Aud),...a(n.Sek)]})};function a(t){return[{title:`${t} Debit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.debit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Credit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.credit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:r=>{const s=r.foreignCurrenciesSum.find(u=>u.currency===t);return s?.total?.raw&&(s.total.raw<-1e-4||s.total.raw>1e-4)?o.jsx(b,{color:s.total.raw>0?"green":"red",children:s.total.formatted}):s?.total?.formatted},style:{whiteSpace:"nowrap"}}]}export{I as BusinessTransactionsSingle};
1
+ import{bs as S,u as g,r as m,F as x,a as y,j as o,bw as C,n as T,bx as h,by as b,b1 as n,bi as F,bz as v}from"./index-Mle6gZrH.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(x),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=y({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(C,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(T,{}):o.jsx(h,{moreInfo:e=>o.jsx(F,{businessID:e.business.id,filter:c}),striped:!0,highlightOnHover:!0,stickyHeader:!0,items:p,columns:[{title:"Business Name",value:e=>e.business.name},{title:"Debit",value:e=>e.debit.formatted,style:{whiteSpace:"nowrap"}},{title:"Credit",value:e=>e.credit.formatted,style:{whiteSpace:"nowrap"}},{title:"Total",value:e=>e.total.raw&&(e.total.raw<-1e-4||e.total.raw>1e-4)?o.jsx(b,{color:e.total.raw>0?"green":"red",children:e.total.formatted}):e.total.formatted,style:{whiteSpace:"nowrap"}},...a(n.Eur),...a(n.Usd),...a(n.Gbp),...a(n.Cad),...a(n.Jpy),...a(n.Aud),...a(n.Sek)]})};function a(t){return[{title:`${t} Debit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.debit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Credit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.credit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:r=>{const s=r.foreignCurrenciesSum.find(u=>u.currency===t);return s?.total?.raw&&(s.total.raw<-1e-4||s.total.raw>1e-4)?o.jsx(b,{color:s.total.raw>0?"green":"red",children:s.total.formatted}):s?.total?.formatted},style:{whiteSpace:"nowrap"}}]}export{I as BusinessTransactionsSingle};
@@ -1 +1 @@
1
- import{bp as u,r as n,F as p,a as c,j as s,n as x,c as d,bD as l}from"./index-DfI9E1Fb.js";import{P as m,C as b,E as T}from"./editable-business-trip--kNXo9tv.js";const E=({businessTripId:a})=>{const{businessTripId:o}=u(),{setFiltersContext:i}=n.useContext(p),e=a??o??"",[{data:r,fetching:t}]=c({query:l,variables:{businessTripId:e}});return n.useEffect(()=>{i(s.jsx("div",{className:"flex flex-row gap-x-5",children:s.jsx(m,{filename:"business_trip_report"})}))},[r,t,i]),t||!r?.businessTrip?s.jsx(x,{}):s.jsx(d,{title:`Business Trip: ${r.businessTrip.name}`,description:"Manage business trip",children:s.jsx(b,{className:"mt-5",children:e&&s.jsx(T,{tripId:e,isExtended:!0})})})};export{E as BusinessTrip};
1
+ import{bs as u,r as n,F as p,a as c,j as s,n as x,c as d,bG as l}from"./index-Mle6gZrH.js";import{P as m,C as b,E as T}from"./editable-business-trip-DO2VVnpQ.js";const E=({businessTripId:a})=>{const{businessTripId:o}=u(),{setFiltersContext:i}=n.useContext(p),e=a??o??"",[{data:r,fetching:t}]=c({query:l,variables:{businessTripId:e}});return n.useEffect(()=>{i(s.jsx("div",{className:"flex flex-row gap-x-5",children:s.jsx(m,{filename:"business_trip_report"})}))},[r,t,i]),t||!r?.businessTrip?s.jsx(x,{}):s.jsx(d,{title:`Business Trip: ${r.businessTrip.name}`,description:"Manage business trip",children:s.jsx(b,{className:"mt-5",children:e&&s.jsx(T,{tripId:e,isExtended:!0})})})};export{E as BusinessTrip};
@@ -1 +1 @@
1
- import{cZ as B,r as i,u as H,d0 as R,j as e,c_ as U,s as W,bz as G,B as _,c$ as J,ae as q,V as K,H as N,ag as D,dh as Q,aL as X,a0 as Z,di as $,bO as h,ch as A,fr as Y,bT as O,bU as M,bP as P,ez as T,aI as x,fs as ee,bf as se,a2 as m,a3 as j,a4 as g,a5 as p,dJ as ae,dK as te,dL as ne}from"./index-DfI9E1Fb.js";import{s as oe}from"./sub-BbpGm1pj.js";function re(a){return!a||B(a)?null:encodeURIComponent(JSON.stringify(a))}const le=[{value:D.AbsAmount,label:"Abs Amount"},{value:D.Amount,label:"Amount"},{value:D.Date,label:"Date"}],ce=[{label:"All",value:T.All},{label:"Income",value:T.Income},{label:"Expense",value:T.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext:y}=i.useContext(q),o=K({defaultValues:{byOwners:y?.context.adminBusinessId?[y.context.adminBusinessId]:void 0,sortBy:{field:D.Date,asc:!1},toAnyDate:N(new Date,"yyyy-MM-dd"),fromAnyDate:N(oe(new Date,{years:1}),"yyyy-MM-dd"),...a}}),{control:l,handleSubmit:k,watch:C}=o,[b,F]=i.useState(a.sortBy?.asc??!1),[c,u]=i.useState(!!a.sortBy?.field),{selectableFinancialEntities:S,fetching:t}=Q(),{selectableTags:v,fetching:I}=X(),E=C("sortBy.field");i.useEffect(()=>{E&&!c?u(!0):!E&&c&&u(!1)},[E,c]);const V=s=>{b!=null&&s.sortBy?.field&&(s.sortBy.asc=b),w(s),d()};function z(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(Z,{...o,children:e.jsxs("form",{onSubmit:k(V),children:[e.jsxs($,{cols:2,children:[e.jsx(h,{name:"byOwners",control:l,defaultValue:a.byOwners,render:({field:s,fieldState:n})=>e.jsx(A,{...s,data:S,value:s.value??[],disabled:t,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byBusinesses",control:l,defaultValue:a.byBusinesses,render:({field:s,fieldState:n})=>e.jsx(A,{...s,data:S,value:s.value??[],disabled:t,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byTags",control:l,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(A,{...s,data:v,itemComponent:Y,value:s.value??[],disabled:I,label:"Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0,filter:(r,f,L)=>L.label?.toLowerCase().includes(r.toLowerCase().trim())||L.description?.toLowerCase().includes(r.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:l,defaultValue:a.fromAnyDate,rules:{pattern:{value:O,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(M,{...s,onChange:r=>{const f=r?typeof r=="string"?r:N(r,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"toAnyDate",control:l,defaultValue:a.toAnyDate,rules:{pattern:{value:O,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(M,{...s,onChange:r=>{const f=r?typeof r=="string"?r:N(r,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"chargesType",control:l,defaultValue:a.chargesType,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:ce,value:s.value??T.All,disabled:t,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"sortBy.field",control:l,defaultValue:a.sortBy?.field??D.Date,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:le,label:"Field to sort by",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,rightSectionProps:{style:{width:"5rem"}},withinPortal:!0,rightSection:e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(x,{defaultChecked:a.sortBy?.asc??!1,checked:b??!1,disabled:!c,onCheckedChange:F}),e.jsx("span",{className:"text-xs",children:b?"ASC":"DESC"})]})})}),e.jsx(h,{name:"accountantStatus",control:l,defaultValue:a.accountantStatus,render:({field:s,fieldState:n})=>e.jsx(A,{...s,value:s.value??[],data:ee,disabled:t,label:"Accountant Status",placeholder:"All",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsxs("div",{className:"flex flex-col gap-2 mt-4 rounded-lg border p-3 shadow-sm space-y-2",children:[e.jsx(se,{children:"Missing Information:"}),e.jsx(m,{control:o.control,name:"withoutInvoice",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Invoice"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutInvoice??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutReceipt",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Receipts"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutReceipt??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Documents"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutDocuments??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withOpenDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"With Open Documents"})}),e.jsx(p,{children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(x,{defaultChecked:a.withOpenDocuments??!1,onCheckedChange:s.onChange})}),e.jsx(ne,{children:e.jsx("p",{children:"Show only charges with documents that are currently open"})})]})})]})}),e.jsx(m,{control:o.control,name:"withoutTransactions",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Transactions"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutTransactions??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"unbalanced",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Unbalanced businesses"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.unbalanced??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutLedger",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without ledger"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutLedger??!1,onCheckedChange:s.onChange})})]})})]})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:t||I,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:z,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:d,children:"Cancel"})]})]})})]})}function he({filter:a={},setFilter:w,activePage:d,setPage:y,totalPages:o=1,initiallyOpened:l=!1}){const[k,C]=i.useState(l),[b,F]=i.useState(!B(a)),{get:c,set:u}=H();i.useEffect(()=>{const t=d>1?d.toFixed(0):null,v=c("page");t!==v&&u("page",t)},[d,c,u]),i.useEffect(()=>{const t=re(a),v=c("chargesFilters");t!==v&&(u("chargesFilters",t),u("page"),y(1))},[a,c,u,y]);const S=i.useCallback(t=>{R(t,a)||(w(t),F(!B(t)))},[a,w]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(U,{opened:k,onClose:()=>C(!1),content:e.jsx(ie,{filter:a,setFilter:S,closeModal:()=>C(!1)}),modalSize:"xl"}),o>1&&e.jsx(W,{className:"flex-auto",value:d,onChange:y,total:o}),e.jsx(G,{inline:!0,size:16,disabled:!b,children:e.jsx(_,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>C(!0),children:e.jsx(J,{className:"size-5"})})})]})}export{he as C,ce as c,re as e};
1
+ import{c$ as B,r as i,u as R,d2 as W,j as e,d0 as z,s as U,bC as G,B as _,d1 as X,ae as q,V as J,H as N,ag as D,dj as Q,aL as $,a0 as K,dk as Y,bR as h,cj as k,ft as Z,bW as M,bX as O,bS as P,eB as A,aI as x,fu as ee,bb as se,a2 as m,a3 as j,a4 as g,a5 as p,dL as ae,dM as te,dN as ne}from"./index-Mle6gZrH.js";import{s as oe}from"./sub-CHPOWTq8.js";function le(a){return!a||B(a)?null:encodeURIComponent(JSON.stringify(a))}const re=[{value:D.AbsAmount,label:"Abs Amount"},{value:D.Amount,label:"Amount"},{value:D.Date,label:"Date"}],ce=[{label:"All",value:A.All},{label:"Income",value:A.Income},{label:"Expense",value:A.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext:b}=i.useContext(q),o=J({defaultValues:{byOwners:b?.context.adminBusinessId?[b.context.adminBusinessId]:void 0,sortBy:{field:D.Date,asc:!1},toAnyDate:N(new Date,"yyyy-MM-dd"),fromAnyDate:N(oe(new Date,{years:1}),"yyyy-MM-dd"),...a}}),{control:r,handleSubmit:T,watch:C}=o,[y,F]=i.useState(a.sortBy?.asc??!1),[c,u]=i.useState(!!a.sortBy?.field),{selectableFinancialEntities:S,fetching:t}=Q(),{selectableTags:v,fetching:I}=$(),E=C("sortBy.field");i.useEffect(()=>{E&&!c?u(!0):!E&&c&&u(!1)},[E,c]);const V=s=>{y!=null&&s.sortBy?.field&&(s.sortBy.asc=y),w(s),d()};function H(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(K,{...o,children:e.jsxs("form",{onSubmit:T(V),children:[e.jsxs(Y,{cols:2,children:[e.jsx(h,{name:"byOwners",control:r,defaultValue:a.byOwners,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byBusinesses",control:r,defaultValue:a.byBusinesses,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byTags",control:r,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:v,itemComponent:Z,value:s.value??[],disabled:I,label:"Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0,filter:(l,f,L)=>L.label?.toLowerCase().includes(l.toLowerCase().trim())||L.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(O,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"toAnyDate",control:r,defaultValue:a.toAnyDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(O,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"chargesType",control:r,defaultValue:a.chargesType,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:ce,value:s.value??A.All,disabled:t,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"sortBy.field",control:r,defaultValue:a.sortBy?.field??D.Date,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:re,label:"Field to sort by",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,rightSectionProps:{style:{width:"5rem"}},withinPortal:!0,rightSection:e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(x,{defaultChecked:a.sortBy?.asc??!1,checked:y??!1,disabled:!c,onCheckedChange:F}),e.jsx("span",{className:"text-xs",children:y?"ASC":"DESC"})]})})}),e.jsx(h,{name:"accountantStatus",control:r,defaultValue:a.accountantStatus,render:({field:s,fieldState:n})=>e.jsx(k,{...s,value:s.value??[],data:ee,disabled:t,label:"Accountant Status",placeholder:"All",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsxs("div",{className:"flex flex-col gap-2 mt-4 rounded-lg border p-3 shadow-sm space-y-2",children:[e.jsx(se,{children:"Missing Information:"}),e.jsx(m,{control:o.control,name:"withoutInvoice",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Invoice"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutInvoice??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutReceipt",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Receipts"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutReceipt??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Documents"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutDocuments??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withOpenDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"With Open Documents"})}),e.jsx(p,{children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(x,{defaultChecked:a.withOpenDocuments??!1,onCheckedChange:s.onChange})}),e.jsx(ne,{children:e.jsx("p",{children:"Show only charges with documents that are currently open"})})]})})]})}),e.jsx(m,{control:o.control,name:"withoutTransactions",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Transactions"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutTransactions??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"unbalanced",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Unbalanced businesses"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.unbalanced??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutLedger",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without ledger"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutLedger??!1,onCheckedChange:s.onChange})})]})})]})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:t||I,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:H,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:d,children:"Cancel"})]})]})})]})}function he({filter:a={},setFilter:w,activePage:d,setPage:b,totalPages:o=1,initiallyOpened:r=!1}){const[T,C]=i.useState(r),[y,F]=i.useState(!B(a)),{get:c,set:u}=R();i.useEffect(()=>{const t=d>1?d.toFixed(0):null,v=c("page");t!==v&&u("page",t)},[d,c,u]),i.useEffect(()=>{const t=le(a),v=c("chargesFilters");t!==v&&(u("chargesFilters",t),u("page"),b(1))},[a,c,u,b]);const S=i.useCallback(t=>{W(t,a)||(w(t),F(!B(t)))},[a,w]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(z,{opened:T,onClose:()=>C(!1),content:e.jsx(ie,{filter:a,setFilter:S,closeModal:()=>C(!1)}),modalSize:"xl"}),o>1&&e.jsx(U,{className:"flex-auto",value:d,onChange:b,total:o}),e.jsx(G,{inline:!0,size:16,disabled:!y,children:e.jsx(_,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>C(!0),children:e.jsx(X,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
@@ -1 +1 @@
1
- import{r as t,F as E,u as N,a as P,j as e,T as b,B as w,P as z,b as T,c as W,L as O,C as k,e as B,f as R,g as V,E as A,I as Q,M as U,h as q}from"./index-DfI9E1Fb.js";import{C as J}from"./charges-filters-CoFkjW00.js";import{M as $}from"./index-DDGgWxhe.js";import{P as G}from"./Progress-AG7ZMAJu.js";import"./sub-BbpGm1pj.js";import"./subMonths-0tIJizDp.js";import"./Checkbox-DjollWGm.js";const se=()=>{const{setFiltersContext:m}=t.useContext(E),[o,x]=t.useState(void 0),[l,C]=t.useState(void 0),[c,p]=t.useState(void 0),[g,f]=t.useState(!1),[a,d]=t.useState([]),{get:F}=N(),h=F("chargesFilters"),I=t.useMemo(()=>{if(h)try{return JSON.parse(decodeURIComponent(h))}catch{return}},[h]),[n,j]=t.useState(I),S=t.useCallback((s,D)=>{a.map(u=>u.id).includes(s)?d(a.filter(u=>u.id!==s)):d([...a,{id:s,onChange:D}])},[a]),[{data:r,fetching:M},v]=P({query:q,variables:{filters:n},pause:!0});function y(){d([])}const i=t.useMemo(()=>r?.chargesWithLedgerChanges?.length?r.chargesWithLedgerChanges[r.chargesWithLedgerChanges.length-1].progress:0,[r?.chargesWithLedgerChanges]),L=t.useCallback(s=>{j(s)},[j]);return t.useEffect(()=>{n&&v()},[n,v]),t.useEffect(()=>{m(e.jsxs("div",{className:"flex flex-row gap-x-5 items-center",children:[e.jsx(G,{value:i,label:`${i?.toFixed(2)}%`,size:"xl",animate:i<100,className:"min-w-52"}),e.jsx(J,{filter:n,setFilter:L,activePage:1,setPage:()=>{},initiallyOpened:!0}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>f(s=>!s),children:g?e.jsx(z,{className:"size-5"}):e.jsx(T,{className:"size-5"})})}),e.jsx($,{selected:a,resetMerge:y})]}))},[r,M,n,g,m,f,a,i,L]),e.jsxs(W,{title:"Charges Ledger Validation",description:"Manage charges",children:[M?e.jsx(O,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx(k,{setEditChargeId:x,setInsertDocument:C,setMatchDocuments:p,toggleMergeCharge:S,mergeSelectedCharges:new Set(a.map(s=>s.id)),data:r?.chargesWithLedgerChanges.filter(s=>!!s.charge).map(s=>s.charge)??[],isAllOpened:g}),e.jsxs("div",{className:"flex flex-row justify-center my-2",children:[i>0&&i<100&&e.jsx(B,{}),i===100&&!r?.chargesWithLedgerChanges.filter(s=>!!s.charge).length&&e.jsx(R,{radius:"xl",size:"xl",color:"green",children:e.jsx(V,{})})]})]}),o&&e.jsx(A,{chargeId:o?.id,close:()=>x(void 0),onChange:o.onChange}),l&&e.jsx(Q,{chargeId:l.id,onChange:l.onChange,close:()=>C(void 0)}),c&&e.jsx(U,{chargeId:c.id,ownerId:c.ownerId,setMatchDocuments:()=>p(void 0)})]})};export{se as ChargesLedgerValidation};
1
+ import{r as t,F as E,u as N,a as P,j as e,T as b,B as w,P as z,b as T,c as W,L as O,C as k,e as B,f as R,g as V,E as A,I as Q,M as U,h as q}from"./index-Mle6gZrH.js";import{C as J}from"./charges-filters-BFXTNJlR.js";import{M as $}from"./index-BgaZ9SWH.js";import{P as G}from"./Progress-CYZqv7SW.js";import"./sub-CHPOWTq8.js";import"./subMonths-CnpmFwyh.js";import"./Checkbox-DpgoGNEh.js";const se=()=>{const{setFiltersContext:m}=t.useContext(E),[o,x]=t.useState(void 0),[l,C]=t.useState(void 0),[c,p]=t.useState(void 0),[g,f]=t.useState(!1),[a,d]=t.useState([]),{get:F}=N(),h=F("chargesFilters"),I=t.useMemo(()=>{if(h)try{return JSON.parse(decodeURIComponent(h))}catch{return}},[h]),[n,j]=t.useState(I),S=t.useCallback((s,D)=>{a.map(u=>u.id).includes(s)?d(a.filter(u=>u.id!==s)):d([...a,{id:s,onChange:D}])},[a]),[{data:r,fetching:M},v]=P({query:q,variables:{filters:n},pause:!0});function y(){d([])}const i=t.useMemo(()=>r?.chargesWithLedgerChanges?.length?r.chargesWithLedgerChanges[r.chargesWithLedgerChanges.length-1].progress:0,[r?.chargesWithLedgerChanges]),L=t.useCallback(s=>{j(s)},[j]);return t.useEffect(()=>{n&&v()},[n,v]),t.useEffect(()=>{m(e.jsxs("div",{className:"flex flex-row gap-x-5 items-center",children:[e.jsx(G,{value:i,label:`${i?.toFixed(2)}%`,size:"xl",animate:i<100,className:"min-w-52"}),e.jsx(J,{filter:n,setFilter:L,activePage:1,setPage:()=>{},initiallyOpened:!0}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>f(s=>!s),children:g?e.jsx(z,{className:"size-5"}):e.jsx(T,{className:"size-5"})})}),e.jsx($,{selected:a,resetMerge:y})]}))},[r,M,n,g,m,f,a,i,L]),e.jsxs(W,{title:"Charges Ledger Validation",description:"Manage charges",children:[M?e.jsx(O,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx(k,{setEditChargeId:x,setInsertDocument:C,setMatchDocuments:p,toggleMergeCharge:S,mergeSelectedCharges:new Set(a.map(s=>s.id)),data:r?.chargesWithLedgerChanges.filter(s=>!!s.charge).map(s=>s.charge)??[],isAllOpened:g}),e.jsxs("div",{className:"flex flex-row justify-center my-2",children:[i>0&&i<100&&e.jsx(B,{}),i===100&&!r?.chargesWithLedgerChanges.filter(s=>!!s.charge).length&&e.jsx(R,{radius:"xl",size:"xl",color:"green",children:e.jsx(V,{})})]})]}),o&&e.jsx(A,{chargeId:o?.id,close:()=>x(void 0),onChange:o.onChange}),l&&e.jsx(Q,{chargeId:l.id,onChange:l.onChange,close:()=>C(void 0)}),c&&e.jsx(U,{chargeId:c.id,ownerId:c.ownerId,setMatchDocuments:()=>p(void 0)})]})};export{se as ChargesLedgerValidation};