@accounter/client 0.0.8-alpha-20251027152122-3a28383f5256a0af85ebc9a1667c671cd03d1217 → 0.0.8-alpha-20251027160059-e9b68d02d14d04ec8244b80972712f758c9e8db7

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 (67) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-BO9Xpz8t.js → Checkbox-BPO8_jMH.js} +2 -2
  3. package/dist/assets/{Progress-D2_rEDMg.js → Progress-NZzZXmow.js} +1 -1
  4. package/dist/assets/{Typography-D5R2ABRc.js → Typography-IaNz_UpB.js} +1 -1
  5. package/dist/assets/{accordion-BdInypOR.js → accordion-DLhPc0rw.js} +1 -1
  6. package/dist/assets/{accountant-approvals-Dxukyb2L.js → accountant-approvals--bHmgziw.js} +1 -1
  7. package/dist/assets/{all-charges-CKoiOatE.js → all-charges-n5LCQpkn.js} +1 -1
  8. package/dist/assets/{arrow-up-down-CkKoHOZz.js → arrow-up-down-CM9bwo8G.js} +1 -1
  9. package/dist/assets/{building-2-DqnthsV_.js → building-2-HRA8xsoA.js} +1 -1
  10. package/dist/assets/business-Cc9BXzpb.js +32 -0
  11. package/dist/assets/{business-header-BoDcKSl2.js → business-header-D0Pi0ox5.js} +1 -1
  12. package/dist/assets/{business-transactions-single-sJPwKffn.js → business-transactions-single-CEYMQLQD.js} +1 -1
  13. package/dist/assets/{business-trip-ak7ozCMK.js → business-trip-CJO6fi9D.js} +1 -1
  14. package/dist/assets/{charges-filters-BZS9K5l_.js → charges-filters-hjHQC8jb.js} +1 -1
  15. package/dist/assets/{charges-ledger-validation-Dn1tKuHo.js → charges-ledger-validation-B-CsyNZK.js} +1 -1
  16. package/dist/assets/{chart-D5qMOolQ.js → chart-Dt1GKbU0.js} +1 -1
  17. package/dist/assets/{data-table-pagination-DNmtrpVu.js → data-table-pagination-YsvftRMU.js} +1 -1
  18. package/dist/assets/{editable-business-trip-tuSBklIH.js → editable-business-trip-DVC29gsX.js} +2 -2
  19. package/dist/assets/{index-cI8Jsxnd.js → index-9gE-VJnf.js} +1 -1
  20. package/dist/assets/{index-B8uhIk_K.js → index-B6wS4Wxh.js} +1 -1
  21. package/dist/assets/{index-1y5LxkZU.js → index-BC8lCcej.js} +1 -1
  22. package/dist/assets/{index-BUrkGANf.js → index-BEDk77TL.js} +1 -1
  23. package/dist/assets/{index-BEycb-eF.js → index-BgzvCxY1.js} +1 -1
  24. package/dist/assets/{index-mPs7_Pzt.js → index-BmHIdR_i.js} +1 -1
  25. package/dist/assets/{index-Dbs_Faiq.js → index-BoRdLlCV.js} +1 -1
  26. package/dist/assets/index-BowN47so.js +1 -0
  27. package/dist/assets/{index-zNOIAEsv.js → index-ByZ_pm4F.js} +1 -1
  28. package/dist/assets/{index-BUOmPZZE.js → index-BykvJIPg.js} +1 -1
  29. package/dist/assets/{index-rzb-Wfyn.js → index-C1QP_1hi.js} +2 -2
  30. package/dist/assets/{index-DO9LsGUk.js → index-C5THrBcZ.js} +2 -2
  31. package/dist/assets/{index-Cq_8eDaQ.js → index-CAz755Vg.js} +1 -1
  32. package/dist/assets/index-CBPTpZHL.css +1 -0
  33. package/dist/assets/{index-Bm0ybubD.js → index-CRMsr3ea.js} +1 -1
  34. package/dist/assets/{index-CoP8rTKg.js → index-CRpqdixQ.js} +1 -1
  35. package/dist/assets/{index-8n4-QaWx.js → index-CebS9Rr6.js} +2 -2
  36. package/dist/assets/{index-CPDxJ2sU.js → index-CpAsLkZ-.js} +2 -2
  37. package/dist/assets/{index-B-M613Ei.js → index-D4QXCBac.js} +2 -2
  38. package/dist/assets/{index-DUfo3Krp.js → index-DFDi4HIa.js} +1 -1
  39. package/dist/assets/{index-Bv4hj0Jy.js → index-DYbojoX7.js} +2 -2
  40. package/dist/assets/{index-CwWYxYTu.js → index-O4Zp6w2B.js} +1 -1
  41. package/dist/assets/{index-CQrnA6kA.js → index-nOsVSS34.js} +7 -7
  42. package/dist/assets/{index-C1vFqfE7.js → index-xIO0bA36.js} +258 -263
  43. package/dist/assets/{index.es-CaCwgSGE.js → index.es-B9NUKbEG.js} +1 -1
  44. package/dist/assets/{issue-document-CiJeX3C9.js → issue-document-CUSNTaeZ.js} +1 -1
  45. package/dist/assets/{login-page-YiLbVzv0.js → login-page-DmLdOH1y.js} +1 -1
  46. package/dist/assets/{missing-info-charges-Dz2clKfl.js → missing-info-charges-DsgMcotI.js} +1 -1
  47. package/dist/assets/{page-not-found-4Tf0NkPJ.js → page-not-found-B8fy5aDg.js} +1 -1
  48. package/dist/assets/{pencil-DgX1JiCS.js → pencil-Dmfzg-6O.js} +1 -1
  49. package/dist/assets/{report-commentary-row-CiD9pNPE.js → report-commentary-row-BPh5_3g6.js} +1 -1
  50. package/dist/assets/{save-DQHS5I6h.js → save-BPUtJeTy.js} +1 -1
  51. package/dist/assets/{sub-DVpRQI4L.js → sub-CqZ9jxmt.js} +1 -1
  52. package/dist/assets/subMonths-CwZPyK0k.js +1 -0
  53. package/dist/index.html +2 -2
  54. package/package.json +1 -1
  55. package/src/components/business/admin-business-section.tsx +36 -74
  56. package/src/components/business/contracts-section.tsx +18 -4
  57. package/src/components/clients/contracts/modify-contract-dialog.tsx +65 -11
  58. package/src/components/clients/modify-client-dialog.tsx +9 -27
  59. package/src/components/common/modals/insert-business.tsx +36 -87
  60. package/src/components/layout/user-nav.tsx +3 -25
  61. package/src/gql/gql.ts +9 -9
  62. package/src/gql/graphql.ts +23 -26
  63. package/src/hooks/use-get-all-contracts.ts +1 -1
  64. package/dist/assets/business-BtfvlRp_.js +0 -27
  65. package/dist/assets/index-B5E9Adf1.js +0 -1
  66. package/dist/assets/index-DtE5Y1ZB.css +0 -1
  67. package/dist/assets/subMonths-CFZKY9ia.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @accounter/client
2
2
 
3
- ## 0.0.8-alpha-20251027152122-3a28383f5256a0af85ebc9a1667c671cd03d1217
3
+ ## 0.0.8-alpha-20251027160059-e9b68d02d14d04ec8244b80972712f758c9e8db7
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -1,6 +1,6 @@
1
- import{D as fr,r as w,bH as Q,eF as ur,aj as t,eG as R,bF as X,bG as D,bI as n,eH as I,bJ as z,eI as _r,eJ as vr,eK as br}from"./index-C1vFqfE7.js";/**
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-xIO0bA36.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"}]],Yr=fr("merge",yr),Z=w.createContext(null),mr=Z.Provider,gr=()=>w.useContext(Z);var Pr=Object.defineProperty,h=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(h)for(var a of h(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&&h)for(var o of h(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,xr=Object.defineProperties,hr=Object.getOwnPropertyDescriptors,W=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,Y=(r,e)=>{for(var a in e||(e={}))kr.call(e,a)&&J(r,a,e[a]);if(W)for(var a of W(e))Sr.call(e,a)&&J(r,a,e[a]);return r},B=(r,e)=>xr(r,hr(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:B(Y({},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:B(Y({},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,K=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(K)for(var a of K(e))Rr.call(e,a)&&U(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,q=(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)&&q(r,a,e[a]);if(k)for(var a of k(e))tr.call(e,a)&&q(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:C}=a,E=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:C,size:v});return t.createElement(z,Fr({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 Hr=Object.defineProperty,S=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,A=(r,e,a)=>e in r?Hr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,x=(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},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:C,icon:E,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}=Er({radius:_,color:s,transitionDuration:C,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,x(x({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",x(x({id:T,ref:e,type:"checkbox",className:N.input,checked:i,disabled:c},F),L)),t.createElement(E,{indeterminate:l,className:N.icon})))});ir.displayName="@mantine/core/Checkbox";ir.Group=ar;export{ir as C,Yr 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"}]],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};
@@ -1 +1 @@
1
- import{bF as J,bG as _,bI as o,dX as M,r as W,bH as X,aj as s,T as q,bJ as w,c0 as O}from"./index-C1vFqfE7.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},K=M({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var Q=J((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:`${K} 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,Y=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)=>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(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=X("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: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}=Q({color:C,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:T,variant:D,size:E}),L=Array.isArray(p)?aa(p).map((A,B)=>{var v=A,{tooltip:g,accumulated:V,value:G,label:y,color:H}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(q.Floating,{label:g,disabled:!g,key:B},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:`${G}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:H||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},F),L||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
+ 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-xIO0bA36.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 +1 @@
1
- import{ee as S,ef as K,eg as Y,eh as Q,ei as W,ej as X,d7 as Z,d6 as z,r as k,db as N,ek as ee,j as te,ak as re,dY as _}from"./index-C1vFqfE7.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={})=>{Y(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:x,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=x!==void 0?x:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let b=V;h==="Root"||h==="root"?b=n:h?b=o:pe(a)&&(b=void 0);const F=Q(a,{shouldForwardProp:b,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:Z,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 be(e){return typeof e.main=="string"}function xe(e,t=[]){if(!be(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&&xe(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:x=!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:x,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",b=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(b.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
+ 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-xIO0bA36.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 +1 @@
1
- import{aj as l,j as t,ff as Q,fg as W,fh as O,fi as X,fj as Z,fk as T,fl as ee,fm as oe,fn as M,fo as re,fp as te,fq as ne,p as P,dV as ae}from"./index-C1vFqfE7.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",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":B(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",Y=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}})});Y.displayName=q;function B(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=Y;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,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-xIO0bA36.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 +1 @@
1
- import{r as a,F as h,u as v,ag as C,ai as A,a as F,j as e,c as P,L as b,fr as y}from"./index-C1vFqfE7.js";import{C as j}from"./charges-filters-BZS9K5l_.js";import{P as D}from"./Progress-D2_rEDMg.js";import"./sub-DVpRQI4L.js";import"./subMonths-CFZKY9ia.js";const w=()=>{const{setFiltersContext:c}=a.useContext(h),{get:i}=v(),{userContext:p}=a.useContext(C),[s,x]=a.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:s,page:1,limit:999999}}),t=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/t,g=100*l/t,m=100*n/t;return a.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:s,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,s,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: ${t}`,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
+ import{r as a,F as h,u as v,ae as C,ag as A,a as F,j as e,c as P,L as b,fq as y}from"./index-xIO0bA36.js";import{C as j}from"./charges-filters-hjHQC8jb.js";import{P as D}from"./Progress-NZzZXmow.js";import"./sub-CqZ9jxmt.js";import"./subMonths-CwZPyK0k.js";const w=()=>{const{setFiltersContext:c}=a.useContext(h),{get:i}=v(),{userContext:p}=a.useContext(C),[s,x]=a.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:s,page:1,limit:999999}}),t=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/t,g=100*l/t,m=100*n/t;return a.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:s,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,s,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: ${t}`,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-C1vFqfE7.js";import{e as Q,C as $}from"./charges-filters-BZS9K5l_.js";import{M as H}from"./index-rzb-Wfyn.js";import"./sub-DVpRQI4L.js";import"./subMonths-CFZKY9ia.js";import"./Checkbox-BO9Xpz8t.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-xIO0bA36.js";import{e as Q,C as $}from"./charges-filters-hjHQC8jb.js";import{M as H}from"./index-C1QP_1hi.js";import"./sub-CqZ9jxmt.js";import"./subMonths-CwZPyK0k.js";import"./Checkbox-BPO8_jMH.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-C1vFqfE7.js";/**
1
+ import{D as o}from"./index-xIO0bA36.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-C1vFqfE7.js";/**
1
+ import{D as a}from"./index-xIO0bA36.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,32 @@
1
+ import{D as xe,G as be,S as Ee,H as Ne,a as we,J as Ms,r as v,j as e,K as Be,N as Oe,O as Us,n as Cs,Q as zs,i as pe,t as V,l as je,U as qs,V as Ie,W as Le,X as De,Y as W,Z as K,_ as H,$ as X,a0 as Ae,a1 as J,a2 as j,a3 as g,a4 as f,a5 as C,v as P,a6 as A,a7 as b,a8 as Ye,B as E,a9 as Gs,aa as Ve,ab as Ze,ac as $,ad as bs,ae as es,af as Ws,s as Ks,C as Hs,ag as Xs,ah as _,ai as ds,aj as Js,ak as Qs,al as Ys,am as ue,an as ss,ao as U,ap as ns,aq as ts,ar as as,as as G,at as se,au as ie,av as le,aw as ce,ax as oe,ay as de,az as rs,aA as is,aB as ze,aC as re,aD as Te,aE as qe,aF as _e,aG as Zs,aH as ee,aI as Z,aJ as en,aK as sn,aL as nn,aM as Ge,aN as tn,aO as an,aP as rn,aQ as ln,aR as cn,aS as We,aT as Ke,aU as ws,aV as on,aW as He,aX as dn,aY as Is,aZ as Ds,a_ as un,a$ as mn,b0 as As,b1 as ls,b2 as hn,b3 as us,b4 as xn,b5 as pn,b6 as jn,b7 as gn,b8 as fn,b9 as vn,ba as yn,bb as k,bc as Nn,bd as cs,be as Cn,bf as bn,bg as wn,bh as In,bi as Dn,bj as An,bk as Y,bl as kn,bm as Sn,bn as q,bo as En,bp as Tn,bq as Pn,br as Bn}from"./index-xIO0bA36.js";import{S as os}from"./save-BPUtJeTy.js";import{B as On}from"./business-header-D0Pi0ox5.js";import{i as Ln,D as Vn,f as Fn,E as _n,L as $e,a as ke,C as $n,A as Rn,b as ve,c as Mn,d as Xe,h as Un,e as zn,g as ks,u as qn,G as Gn,j as ms,k as Wn,X as Ss,Y as Es,l as Kn,m as Hn,R as Xn,n as Jn,o as Qn,p as Yn}from"./chart-Dt1GKbU0.js";import{P as Zn}from"./pencil-Dmfzg-6O.js";import{A as et,a as Re,b as Me,c as hs}from"./accordion-DLhPc0rw.js";import{B as st}from"./building-2-HRA8xsoA.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 nt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xs=xe("circle-check",nt);/**
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 tt=[["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"}]],Se=xe("dollar-sign",tt);/**
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 at=[["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"}]],rt=xe("file-check",at);/**
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 it=[["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"}]],lt=xe("plug",it);/**
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 ct=[["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"}]],Ts=xe("shield",ct);/**
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 ot=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Ue=xe("trending-up",ot);function Ps(s){switch(s){case be.Annual:return"Annual";case be.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${s}`)}}function Bs(s){switch(s){case Ee.Enterprise:return"Enterprise";case Ee.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${s}`)}}function dt(s){return Ne(s,"yyyy-MM-dd")}function ut({businessId:s,tagIds:n,description:t,open:a,onOpenChange:l,onClose:i}){const[{data:c,fetching:r},o]=we({pause:!0,query:Ms,variables:{businessId:s,tagsDifferentThan:n?n.map(h=>h.id):void 0,descriptionDifferentThan:t}});v.useEffect(()=>{a&&(n||t)&&!c&&o()},[a,n,t,o,c]);const d=v.useCallback(h=>{l(h),a&&!h&&i?.()},[l,i,a]),m=v.useMemo(()=>a&&(!!n||!!t)&&c&&c?.similarChargesByBusiness.length>0,[a,n,t,c]);return e.jsx(Be,{open:m,onOpenChange:d,children:e.jsx(Oe,{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(Us,{fallback:e.jsx("div",{children:"Error fetching similar charges"}),children:r?e.jsx(Cs,{}):n||t?e.jsx(zs,{data:c?.similarChargesByBusiness??[],tagIds:n,description:t,onOpenChange:d,title:"Similar Charges by Business"}):null})})})}const mt="updateAdminBusiness",ht=()=>{const[{fetching:s},n]=pe(qs),t=v.useCallback(async a=>{const l=`Error updating admin business ID [${a.adminBusinessId}]`,i=`${mt}-${a.adminBusinessId}`;V.loading("Updating admin business",{id:i});try{const c=await n(a),r=je(c,l,i,"updateAdminBusiness");if(r)return V.success("Success",{id:i,description:"Admin Business Updated"}),r.updateAdminBusiness}catch(c){console.error(`${l}: ${c}`),V.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateAdminBusiness:t}},xt=Ve({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:bs().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 ps(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 pt(s){return{employerWithholdingTaxAccountNumber:s.employerWithholdingTaxAccountNumber,taxPrepaymentId:s.taxPrepaymentId,nationalInsuranceEmployerId:s.nationalInsuranceEmployerId,advanceTaxRate:s.advanceTaxRate,registrationDate:s.registrationDate?dt(new Date(s.registrationDate)):void 0}}function jt({data:s,refetchBusiness:n}){const t=De(Gs,s),[a,l]=v.useState(ps(t)),{updateAdminBusiness:i,fetching:c}=ht(),r=Ie({resolver:Le(xt),defaultValues:a}),o=async d=>{if(!t)return;const m=Ze(d,r.formState.dirtyFields);if(!m)return;const h=pt(m);await i({adminBusinessId:t.id,fields:h}),n?.()};return v.useEffect(()=>{if(t){const d=ps(t);l(d),r.reset(d)}},[t,r]),e.jsxs(W,{children:[e.jsxs(K,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ts,{className:"h-5 w-5 text-primary"}),e.jsx(H,{children:"Admin Business Configuration"})]}),e.jsx(X,{children:"Tax and registration information for the business operating this application"})]}),e.jsx(Ae,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(o),className:"space-y-6",children:[e.jsx(J,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(j,{control:r.control,name:"employerWithholdingTaxAccountNumber",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Employer Withholding Tax Account Number"}),e.jsx(C,{children:e.jsx(P,{placeholder:"Enter account number",...d,className:A(m)})}),e.jsx(b,{})]})}),e.jsx(j,{control:r.control,name:"taxPrepaymentId",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tax Prepayment ID"}),e.jsx(C,{children:e.jsx(P,{placeholder:"Enter prepayment ID",...d,className:A(m)})}),e.jsx(b,{})]})}),e.jsx(j,{control:r.control,name:"nationalInsuranceEmployerId",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"National Insurance Employer ID"}),e.jsx(C,{children:e.jsx(P,{placeholder:"Enter employer ID",...d,className:A(m)})}),e.jsx(b,{})]})}),e.jsx(j,{control:r.control,name:"advanceTaxRate",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Advance Tax Rate (%)"}),e.jsx(C,{children:e.jsx(P,{type:"number",step:"0.01",min:"0",max:"100",placeholder:"Enter tax rate",...d,className:A(m)})}),e.jsx(b,{})]})}),e.jsx(j,{control:r.control,name:"registrationDate",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Registration Date"}),e.jsx(C,{children:e.jsx(P,{type:"date",...d,className:A(m)})}),e.jsx(b,{})]})})]})}),e.jsx(Ye,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(E,{type:"submit",disabled:c||Object.keys(r.formState.dirtyFields).length===0||!r.formState.isValid,children:[e.jsx(os,{className:"h-4 w-4"}),"Save Changes"]})})]})})]})}function gt({businessId:s}){const{userContext:n}=v.useContext(es),[t,a]=v.useState(1),[{data:l,fetching:i}]=we({query:Ws,variables:{filters:{byOwners:n?.context.adminBusinessId?[n.context.adminBusinessId]:void 0,sortBy:{field:Xs.Date,asc:!1},byBusinesses:[s]},page:t,limit:100}}),c=l?.allCharges?.pageInfo.totalPages??1,r=l?.allCharges?.nodes??[];return i?e.jsx("div",{children:"Loading charges..."}):e.jsxs(W,{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(X,{children:"Recurring and one-time charges for this business"})]})}),c>1&&e.jsx(Ks,{className:"flex-fit",value:t,onChange:a,total:c})]}),e.jsx(J,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Hs,{data:r,isAllOpened:!1})})})]})}var ft=["type","layout","connectNulls","ref"],vt=["key"];function me(s){"@babel/helpers - typeof";return me=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},me(s)}function js(s,n){if(s==null)return{};var t=yt(s,n),a,l;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);for(l=0;l<i.length;l++)a=i[l],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(s,a)&&(t[a]=s[a])}return t}function yt(s,n){if(s==null)return{};var t={};for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)){if(n.indexOf(a)>=0)continue;t[a]=s[a]}return t}function Ce(){return Ce=Object.assign?Object.assign.bind():function(s){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=t[a])}return s},Ce.apply(this,arguments)}function gs(s,n){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);n&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(s,l).enumerable})),t.push.apply(t,a)}return t}function R(s){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?gs(Object(t),!0).forEach(function(a){M(s,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):gs(Object(t)).forEach(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(t,a))})}return s}function ae(s){return wt(s)||bt(s)||Ct(s)||Nt()}function Nt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
32
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ct(s,n){if(s){if(typeof s=="string")return Je(s,n);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Je(s,n)}}function bt(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function wt(s){if(Array.isArray(s))return Je(s)}function Je(s,n){(n==null||n>s.length)&&(n=s.length);for(var t=0,a=new Array(n);t<n;t++)a[t]=s[t];return a}function It(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")}function fs(s,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,Ls(a.key),a)}}function Dt(s,n,t){return n&&fs(s.prototype,n),t&&fs(s,t),Object.defineProperty(s,"prototype",{writable:!1}),s}function At(s,n,t){return n=Pe(n),kt(s,Os()?Reflect.construct(n,t||[],Pe(s).constructor):n.apply(s,t))}function kt(s,n){if(n&&(me(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return St(s)}function St(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Os(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Os=function(){return!!s})()}function Pe(s){return Pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pe(s)}function Et(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&&Qe(s,n)}function Qe(s,n){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,l){return a.__proto__=l,a},Qe(s,n)}function M(s,n,t){return n=Ls(n),n in s?Object.defineProperty(s,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[n]=t,s}function Ls(s){var n=Tt(s,"string");return me(n)=="symbol"?n:n+""}function Tt(s,n){if(me(s)!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var a=t.call(s,n);if(me(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var he=(function(s){function n(){var t;It(this,n);for(var a=arguments.length,l=new Array(a),i=0;i<a;i++)l[i]=arguments[i];return t=At(this,n,[].concat(l)),M(t,"state",{isAnimationFinished:!0,totalLength:0}),M(t,"generateSimpleStrokeDasharray",function(c,r){return"".concat(r,"px ").concat(c-r,"px")}),M(t,"getStrokeDasharray",function(c,r,o){var d=o.reduce(function(I,u){return I+u});if(!d)return t.generateSimpleStrokeDasharray(r,c);for(var m=Math.floor(c/d),h=c%d,x=r-c,p=[],w=0,S=0;w<o.length;S+=o[w],++w)if(S+o[w]>h){p=[].concat(ae(o.slice(0,w)),[h-S]);break}var T=p.length%2===0?[0,x]:[x];return[].concat(ae(n.repeat(o,m)),ae(p),T).map(function(I){return"".concat(I,"px")}).join(", ")}),M(t,"id",qn("recharts-line-")),M(t,"pathRef",function(c){t.mainCurve=c}),M(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),M(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return Et(n,s),Dt(n,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();this.setState({totalLength:a})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();a!==this.state.totalLength&&this.setState({totalLength:a})}}},{key:"getTotalLength",value:function(){var a=this.mainCurve;try{return a&&a.getTotalLength&&a.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(a,l){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,c=i.points,r=i.xAxis,o=i.yAxis,d=i.layout,m=i.children,h=Fn(m,_n);if(!h)return null;var x=function(S,T){return{x:S.x,y:S.y,value:S.value,errorVal:ks(S.payload,T)}},p={clipPath:a?"url(#clipPath-".concat(l,")"):null};return _.createElement($e,p,h.map(function(w){return _.cloneElement(w,{key:"bar-".concat(w.props.dataKey),data:c,xAxis:r,yAxis:o,layout:d,dataPointFormatter:x})}))}},{key:"renderDots",value:function(a,l,i){var c=this.props.isAnimationActive;if(c&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.dot,d=r.points,m=r.dataKey,h=ke(this.props,!1),x=ke(o,!0),p=d.map(function(S,T){var I=R(R(R({key:"dot-".concat(T),r:3},h),x),{},{index:T,cx:S.x,cy:S.y,value:S.value,dataKey:m,payload:S.payload,points:d});return n.renderDotItem(o,I)}),w={clipPath:a?"url(#clipPath-".concat(l?"":"dots-").concat(i,")"):null};return _.createElement($e,Ce({className:"recharts-line-dots",key:"dots"},w),p)}},{key:"renderCurveStatically",value:function(a,l,i,c){var r=this.props,o=r.type,d=r.layout,m=r.connectNulls;r.ref;var h=js(r,ft),x=R(R(R({},ke(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:l?"url(#clipPath-".concat(i,")"):null,points:a},c),{},{type:o,layout:d,connectNulls:m});return _.createElement($n,Ce({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(a,l){var i=this,c=this.props,r=c.points,o=c.strokeDasharray,d=c.isAnimationActive,m=c.animationBegin,h=c.animationDuration,x=c.animationEasing,p=c.animationId,w=c.animateNewValues,S=c.width,T=c.height,I=this.state,u=I.prevPoints,y=I.totalLength;return _.createElement(Rn,{begin:m,duration:h,isActive:d,easing:x,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(L){var F=L.t;if(u){var Q=u.length/r.length,z=r.map(function(O,Fe){var ge=Math.floor(Fe*Q);if(u[ge]){var fe=u[ge],te=ve(fe.x,O.x),_s=ve(fe.y,O.y);return R(R({},O),{},{x:te(F),y:_s(F)})}if(w){var $s=ve(S*2,O.x),Rs=ve(T/2,O.y);return R(R({},O),{},{x:$s(F),y:Rs(F)})}return R(R({},O),{},{x:O.x,y:O.y})});return i.renderCurveStatically(z,a,l)}var ne=ve(0,y),N=ne(F),D;if(o){var B="".concat(o).split(/[,\s]+/gim).map(function(O){return parseFloat(O)});D=i.getStrokeDasharray(N,y,B)}else D=i.generateSimpleStrokeDasharray(y,N);return i.renderCurveStatically(r,a,l,{strokeDasharray:D})})}},{key:"renderCurve",value:function(a,l){var i=this.props,c=i.points,r=i.isAnimationActive,o=this.state,d=o.prevPoints,m=o.totalLength;return r&&c&&c.length&&(!d&&m>0||!Mn(d,c))?this.renderCurveWithAnimation(a,l):this.renderCurveStatically(c,a,l)}},{key:"render",value:function(){var a,l=this.props,i=l.hide,c=l.dot,r=l.points,o=l.className,d=l.xAxis,m=l.yAxis,h=l.top,x=l.left,p=l.width,w=l.height,S=l.isAnimationActive,T=l.id;if(i||!r||!r.length)return null;var I=this.state.isAnimationFinished,u=r.length===1,y=ds("recharts-line",o),L=d&&d.allowDataOverflow,F=m&&m.allowDataOverflow,Q=L||F,z=Xe(T)?this.id:T,ne=(a=ke(c,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},N=ne.r,D=N===void 0?3:N,B=ne.strokeWidth,O=B===void 0?2:B,Fe=Un(c)?c:{},ge=Fe.clipDot,fe=ge===void 0?!0:ge,te=D*2+O;return _.createElement($e,{className:y},L||F?_.createElement("defs",null,_.createElement("clipPath",{id:"clipPath-".concat(z)},_.createElement("rect",{x:L?x:x-p/2,y:F?h:h-w/2,width:L?p:p*2,height:F?w:w*2})),!fe&&_.createElement("clipPath",{id:"clipPath-dots-".concat(z)},_.createElement("rect",{x:x-te/2,y:h-te/2,width:p+te,height:w+te}))):null,!u&&this.renderCurve(Q,z),this.renderErrorBar(Q,z),(u||c)&&this.renderDots(Q,fe,z),(!S||I)&&zn.renderCallByParent(this.props,r))}}],[{key:"getDerivedStateFromProps",value:function(a,l){return a.animationId!==l.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,prevPoints:l.curPoints}:a.points!==l.curPoints?{curPoints:a.points}:null}},{key:"repeat",value:function(a,l){for(var i=a.length%2!==0?[].concat(ae(a),[0]):a,c=[],r=0;r<l;++r)c=[].concat(ae(c),ae(i));return c}},{key:"renderDotItem",value:function(a,l){var i;if(_.isValidElement(a))i=_.cloneElement(a,l);else if(Ln(a))i=a(l);else{var c=l.key,r=js(l,vt),o=ds("recharts-line-dot",typeof a!="boolean"?a.className:"");i=_.createElement(Vn,Ce({key:c},r,{className:o}))}return i}}])})(v.PureComponent);M(he,"displayName","Line");M(he,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Gn.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});M(he,"getComposedData",function(s){var n=s.props,t=s.xAxis,a=s.yAxis,l=s.xAxisTicks,i=s.yAxisTicks,c=s.dataKey,r=s.bandSize,o=s.displayedData,d=s.offset,m=n.layout,h=o.map(function(x,p){var w=ks(x,c);return m==="horizontal"?{x:ms({axis:t,ticks:l,bandSize:r,entry:x,index:p}),y:Xe(w)?null:a.scale(w),value:w,payload:x}:{x:Xe(w)?null:t.scale(w),y:ms({axis:a,ticks:i,bandSize:r,entry:x,index:p}),value:w,payload:x}});return R({points:h,layout:m},d)});var Pt=Wn({chartName:"LineChart",GraphicalChild:he,axisComponents:[{axisType:"xAxis",AxisComp:Ss},{axisType:"yAxis",AxisComp:Es}],formatAxisMap:Kn});const ye=[{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 Bt(){const s=ye.reduce((t,a)=>t+a.revenue,0),n=s/ye.length;return e.jsxs(W,{children:[e.jsxs(K,{children:[e.jsx(H,{children:"Revenue Analytics"}),e.jsx(X,{children:"Revenue and expenses over time"})]}),e.jsxs(J,{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(Se,{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(Ue,{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(Se,{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(Ue,{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(Se,{className:"h-4 w-4"}),"Current Month"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",ye[ye.length-1].revenue.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Ue,{className:"h-3 w-3"}),e.jsx("span",{children:"+8.0% from last month"})]})]})]}),e.jsx(Hn,{config:{revenue:{label:"Revenue",color:"hsl(var(--chart-1))"},expenses:{label:"Expenses",color:"hsl(var(--chart-2))"}},className:"h-[400px]",children:e.jsx(Xn,{width:"100%",height:"100%",children:e.jsxs(Pt,{data:ye,margin:{top:5,right:10,left:10,bottom:5},children:[e.jsx(Jn,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Ss,{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(Qn,{content:e.jsx(Yn,{})}),e.jsx(he,{type:"monotone",dataKey:"revenue",stroke:"var(--color-revenue)",strokeWidth:2,dot:{fill:"var(--color-revenue)",r:4}}),e.jsx(he,{type:"monotone",dataKey:"expenses",stroke:"var(--color-expenses)",strokeWidth:2,dot:{fill:"var(--color-expenses)",r:4}})]})})})]})]})}const Ot="updateBusiness",Vs=()=>{const[{fetching:s},n]=pe(Js),t=v.useCallback(async a=>{const l=`Error updating business ID [${a.businessId}]`,i=`${Ot}-${a.businessId}`;V.loading("Updating business",{id:i});try{const c=await n(a),r=je(c,l,i,"updateBusiness");if(r)return V.success("Success",{id:i,description:"Business updated"}),r.updateBusiness}catch(c){console.error(`${l}: ${c}`),V.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateBusiness:t}},Lt="insertClient",Vt=()=>{const[{fetching:s},n]=pe(Qs),t=v.useCallback(async a=>{const l=`Error creating client [${a.fields.businessId}]`,i=`${Lt}-${a.fields.businessId}`;V.loading("Creating Client...",{id:i});try{const c=await n(a),r=je(c,l,i,"insertClient");if(r)return V.success("Success",{id:i,description:`Client [${a.fields.businessId}] was created`}),r.insertClient}catch(c){console.error(`${l}: ${c}`),V.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertClient:t}},Ft="updateClient",Fs=()=>{const[{fetching:s},n]=pe(Ys),t=v.useCallback(async a=>{const l=`Error updating client ID [${a.businessId}]`,i=`${Ft}-${a.businessId}`;V.loading("Updating client",{id:i});try{const c=await n(a),r=je(c,l,i,"updateClient");if(r)return V.success("Success",{id:i,description:"Client updated"}),r.updateClient}catch(c){console.error(`${l}: ${c}`),V.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateClient:t}},_t=Ve({businessId:ze().optional(),emails:Te(qe()).optional(),generatedDocumentType:re(Object.values(ue)),greenInvoiceId:ze().optional(),hiveId:$().optional()});function $t({client:s,businessId:n,onDone:t}){const[a,l]=v.useState(!1),[i,c]=v.useState(null),{updateClient:r}=Fs(),{insertClient:o}=Vt(),[d,m]=v.useState(""),h={businessId:n,generatedDocumentType:ue.Proforma,emails:[]},x=Ie({resolver:Le(_t),defaultValues:s||h});v.useEffect(()=>{s&&(c(s),x.reset({emails:s.emails,greenInvoiceId:s.greenInvoiceId,hiveId:s.hiveId,generatedDocumentType:s.generatedDocumentType,businessId:s.businessId}),l(!0))},[s,x]);const p=()=>{c(null),x.reset(h),l(!0)},w=()=>{if(d.trim()){const I=x.getValues("emails");x.setValue("emails",[...I??[],d.trim()],{shouldDirty:!0}),m("")}},S=I=>{const u=x.getValues("emails");x.setValue("emails",(u??[]).filter((y,L)=>L!==I),{shouldDirty:!0})},T=v.useCallback(async I=>{if(i)r({businessId:n,fields:I});else{if(!I.greenInvoiceId){x.setError("greenInvoiceId",{message:"Green Invoice ID is required"});return}o({fields:{...I,greenInvoiceId:I.greenInvoiceId,businessId:n}})}l(!1),c(null),t?.()},[i,t,r,n,o,x]);return e.jsxs(Be,{open:a,onOpenChange:l,children:[e.jsx(ss,{asChild:!0,children:e.jsxs(E,{size:"sm",onClick:p,children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"New Client"]})}),e.jsxs(Oe,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ns,{children:[e.jsx(ts,{children:i?"Edit Client":"Create New Client"}),e.jsx(as,{children:i?"Update client details":"Add a new client with all required details"})]}),e.jsx(Ae,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(T),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(j,{control:x.control,name:"emails",render:({field:I})=>e.jsxs(g,{children:[e.jsx(f,{children:"Emails"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{placeholder:"Add email...",value:d,onChange:u=>m(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),w())}}),e.jsx(E,{type:"button",size:"sm",onClick:w,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:I.value?.map((u,y)=>e.jsxs(G,{variant:"secondary",className:"gap-1",children:[u,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>S(y),children:e.jsx(se,{className:"size-3 cursor-pointer"})})]},y))}),e.jsx(b,{})]})}),e.jsx(j,{control:x.control,name:"generatedDocumentType",render:({field:I})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Document Type"}),e.jsxs(ie,{onValueChange:I.onChange,defaultValue:I.value,children:[e.jsx(C,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(ue).map(u=>e.jsx(de,{value:u,children:rs(u)},u))})]}),e.jsx(b,{})]})}),e.jsx(j,{control:x.control,name:"greenInvoiceId",render:({field:I})=>e.jsxs(g,{children:[e.jsx(f,{children:"Green Invoice ID"}),e.jsx(C,{children:e.jsx(P,{type:"text",placeholder:"Enter Green Invoice ID",...I,required:!i})}),e.jsx(b,{})]})}),e.jsx(j,{control:x.control,name:"hiveId",render:({field:I})=>e.jsxs(g,{children:[e.jsx(f,{children:"Hive ID"}),e.jsx(C,{children:e.jsx(P,{type:"text",placeholder:"Enter Hive ID",...I,required:!i})}),e.jsx(b,{})]})})]})}),e.jsxs(is,{children:[e.jsx(E,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(E,{type:"submit",children:i?"Update Client":"Create Client"})]})]})})]})]})}const Rt=Object.values(ln);function vs(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 Mt(s){const t=s.internalLinks||s.useMessageBody||s.attachmentTypes?{internalEmailLinks:s.internalLinks,emailBody:s.useMessageBody,attachments:s.attachmentTypes}:void 0,l=s.description||s.tags||s.phrases||s.emails||t?{description:s.description,tags:s.tags?.map(i=>({id:i})),phrases:s.phrases,emails:s.emails,emailListener:t}: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:l}}function Ut({data:s,refetchBusiness:n}){const t=De(Zs,s),[a,l]=v.useState(vs(t)),{userContext:i}=v.useContext(es),{updateBusiness:c,fetching:r}=Vs(),[o,d]=v.useState(!1),[m,h]=v.useState(void 0),x=Ie({defaultValues:a}),p=async S=>{if(!t||!i?.context.adminBusinessId)return;const T=Ze(S,x.formState.dirtyFields);if(!T)return;const I=Mt(T);await c({businessId:t.id,ownerId:i.context.adminBusinessId,fields:I}),T.tags?.length||T.description?(h({tagIds:T.tags?.map(u=>({id:u})),description:T.description}),d(!0)):n?.()};if(v.useEffect(()=>{if(t){const S=vs(t);l(S),x.reset(S)}},[t,x]),!t)return e.jsx("div",{});const w=x.watch("isClient");return e.jsxs(W,{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(X,{children:"Business status, tax settings, automation rules, and integration preferences"})]}),!w&&e.jsx($t,{businessId:t.id,onDone:n})]})}),e.jsx(Ae,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(p),children:[e.jsxs(J,{className:"space-y-6",children:[e.jsx(zt,{form:x}),e.jsx(_e,{}),e.jsx(qt,{form:x}),e.jsx(_e,{}),e.jsx(Gt,{form:x}),e.jsx(_e,{}),e.jsx(Wt,{form:x})]}),e.jsx(Ye,{className:"flex justify-end border-t pt-6",children:e.jsxs(E,{type:"submit",disabled:r||Object.keys(x.formState.dirtyFields).length===0,children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(ut,{businessId:t.id,tagIds:m?.tagIds,description:m?.description,open:o,onOpenChange:d,onClose:n})]})}function zt({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(j,{control:s.control,name:"isClient",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Client"}),e.jsx(ee,{children:"Mark this business as a client"})]}),e.jsx(C,{children:e.jsx(Z,{disabled:!0,checked:n.value,onCheckedChange:n.onChange,className:A(t)})})]})}),e.jsx(j,{control:s.control,name:"isActive",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Active"}),e.jsx(ee,{children:"Business is currently active"})]}),e.jsx(C,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:A(t)})})]})}),e.jsx(j,{control:s.control,name:"isReceiptEnough",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Receipt Enough"}),e.jsx(ee,{children:"Generate ledger for receipt documents if no invoice available"})]}),e.jsx(C,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:A(t)})})]})}),e.jsx(j,{control:s.control,name:"isDocumentsOptional",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"No Docs Required"}),e.jsx(ee,{children:"Skip document validation for common charges"})]}),e.jsx(C,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:A(t)})})]})}),e.jsx(j,{control:s.control,name:"isVatOptional",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is VAT Optional"}),e.jsx(ee,{children:"Mute missing VAT indicator"})]}),e.jsx(C,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:A(t)})})]})}),e.jsx(j,{control:s.control,name:"isExemptDealer",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Exempt Dealer"}),e.jsx(ee,{children:"Business is exempt from VAT requirements"})]}),e.jsx(C,{children:e.jsx(Z,{checked:n.value,onCheckedChange:n.onChange,className:A(t)})})]})})]})]})}function qt({form:s}){const{selectableTaxCategories:n,fetching:t}=en(),{selectableSortCodes:a,fetching:l,sortCodes:i}=sn(),{selectableTags:c,fetching:r}=nn(),o=v.useCallback(d=>{if(d){const m=i.find(h=>Number(h.key)===Number(d));m&&(m.defaultIrsCode?s.setValue("irsCode",m.defaultIrsCode,{shouldDirty:!0}):s.setValue("irsCode",null,{shouldDirty:!0}))}},[s,i]);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(j,{control:s.control,name:"sortCode",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Sort Code"}),e.jsx(C,{children:e.jsx(Ge,{onChange:h=>{o(h),d.onChange(h)},data:a,value:d.value,disabled:l,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:A(m)}})}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"taxCategory",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tax Category"}),e.jsx(C,{children:e.jsx(Ge,{data:n,disabled:t,value:d.value,onChange:d.onChange,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:A(m)}})}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"pcn874RecordType",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"PCN874 Record Type"}),e.jsxs(ie,{onValueChange:d.onChange,value:d.value,children:[e.jsx(C,{children:e.jsx(le,{className:A(m),children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.entries(tn).map(([h,x])=>e.jsx(de,{value:h,children:`${x} (${h})`},h))})]}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"irsCode",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(C,{children:e.jsx(an,{value:d.value??void 0,onValueChange:h=>d.onChange(h??null),hideControls:!0,decimalScale:0,className:A(m)})}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"description",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Charge Description"}),e.jsx(C,{children:e.jsx(P,{placeholder:"Enter default charge description",...d,className:A(m)})}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"tags",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tags"}),e.jsx(C,{children:e.jsx(rn,{options:Object.values(c).map(({value:h,label:x})=>({label:x,value:h})),onValueChange:d.onChange,defaultValue:d.value,value:d.value,placeholder:"Select Default Tags",variant:"default",disabled:r,className:A(m)})}),e.jsx(b,{})]})})]})]})}function Gt({form:s}){const[n,t]=v.useState(""),[a,l]=v.useState(""),i=()=>{if(n.trim()){const d=s.getValues("phrases");s.setValue("phrases",[...d,n.trim()],{shouldDirty:!0}),t("")}},c=()=>{if(a.trim()){const d=s.getValues("emails");s.setValue("emails",[...d,a.trim()],{shouldDirty:!0}),l("")}},r=d=>{const m=s.getValues("phrases");s.setValue("phrases",m.filter((h,x)=>x!==d),{shouldDirty:!0})},o=d=>{const m=s.getValues("emails");s.setValue("emails",m.filter((h,x)=>x!==d),{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(j,{control:s.control,name:"phrases",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Phrases"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{placeholder:"Add phrase...",value:n,onChange:h=>t(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),i())},className:A(m)}),e.jsx(E,{type:"button",size:"sm",onClick:i,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((h,x)=>e.jsxs(G,{variant:"secondary",className:"gap-1",children:[h,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>r(x),children:e.jsx(se,{className:"size-3 cursor-pointer",onClick:()=>r(x)})})]},x))}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"emails",render:({field:d,fieldState:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Email Addresses"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{type:"email",placeholder:"Add email...",value:a,onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),c())},className:A(m)}),e.jsx(E,{type:"button",size:"sm",onClick:c,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((h,x)=>e.jsxs(G,{variant:"secondary",className:"gap-1",children:[h,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>o(x),children:e.jsx(se,{className:"size-3 cursor-pointer"})})]},x))}),e.jsx(b,{})]})})]})}function Wt({form:s}){const[n,t]=v.useState(""),a=()=>{if(n.trim()){const c=s.getValues("internalLinks");s.setValue("internalLinks",[...c,n.trim()],{shouldDirty:!0}),t("")}},l=c=>{const r=s.getValues("attachmentTypes");s.setValue("attachmentTypes",r?.includes(c)?r.filter(o=>o!==c):[...r,c],{shouldDirty:!0})},i=c=>{const r=s.getValues("internalLinks");s.setValue("internalLinks",r.filter((o,d)=>d!==c),{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(j,{control:s.control,name:"attachmentTypes",render:({field:c,fieldState:r})=>e.jsxs(g,{children:[e.jsx(f,{children:"Attachment Types"}),e.jsx("div",{className:A(r)+" rounded-md flex flex-wrap gap-2",children:Rt.map(o=>e.jsx(G,{variant:c.value?.includes(o)?"default":"outline",className:"cursor-pointer",onClick:()=>l(o),children:o},o))}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"internalLinks",render:({field:c,fieldState:r})=>e.jsxs(g,{children:[e.jsx(f,{children:"Internal Links"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{type:"url",placeholder:"Add internal link...",value:n,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),a())}}),e.jsx(E,{type:"button",size:"sm",onClick:a,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:A(r)+" flex flex-wrap gap-2 rounded-md",children:c.value?.map((o,d)=>e.jsxs(G,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[o,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>i(d),children:e.jsx(se,{className:"size-3 cursor-pointer flex-shrink-0"})})]},d))}),e.jsx(b,{})]})}),e.jsx(j,{control:s.control,name:"useMessageBody",render:({field:c,fieldState:r})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Should Use Message Body"}),e.jsx(ee,{children:"Extract information from email message body"})]}),e.jsx(C,{children:e.jsx(Z,{checked:c.value,onCheckedChange:c.onChange,className:A(r)})})]})})]})}const Kt=Ve({businessName:$().min(1,"Business name is required"),locality:$().min(1,"Locality is required"),localName:$().optional(),govId:$().optional(),address:$().optional(),localAddress:$().optional(),phone:$().optional(),website:Is("Invalid URL").optional().or(Ds("")),generalContacts:Te(qe()).optional(),billingEmails:Te(qe()).optional()});function ys(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 Ht(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 Xt({data:s,refetchBusiness:n}){const t=De(dn,s),[a,l]=v.useState(ys(t)),{userContext:i}=v.useContext(es),{updateBusiness:c,fetching:r}=Vs(),o=Ie({resolver:Le(Kt),defaultValues:a}),{countries:d,fetching:m}=cn(),[h,x]=v.useState(""),[p,w]=v.useState(""),S=o.watch("locality"),T=o.watch("address"),I=o.watch("localAddress");v.useEffect(()=>{T!==a.address&&o.setValue("address",T,{shouldDirty:!0})},[T,a.address,o]),v.useEffect(()=>{I!==a.localAddress&&o.setValue("localAddress",I,{shouldDirty:!0})},[I,a.localAddress,o]);const u=t&&"clientInfo"in t&&!!t.clientInfo,y=S===i?.context.locality,L=N=>{h.trim()&&(o.setValue("generalContacts",[...N,h.trim()],{shouldDirty:!0}),x(""))},F=(N,D)=>{o.setValue("generalContacts",N.filter((B,O)=>O!==D),{shouldDirty:!0})},Q=N=>{p.trim()&&(o.setValue("billingEmails",[...N,p.trim()],{shouldDirty:!0}),w(""))},z=(N,D)=>{o.setValue("billingEmails",N.filter((B,O)=>O!==D),{shouldDirty:!0})},ne=async N=>{if(!t||!i?.context.adminBusinessId)return;const D=Ze(N,o.formState.dirtyFields);if(!D)return;const B=Ht(D);await c({businessId:t.id,ownerId:i.context.adminBusinessId,fields:B}),n?.()};return v.useEffect(()=>{if(t){const N=ys(t);l(N),o.reset(N)}},[t,o]),e.jsxs(W,{children:[e.jsxs(K,{children:[e.jsx(H,{children:"Contact Information"}),e.jsx(X,{children:"Business contact details and address information"})]}),e.jsx(Ae,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(ne),children:[e.jsx(J,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(j,{control:o.control,name:"businessName",render:({field:N,fieldState:D})=>e.jsxs(g,{children:[e.jsx(f,{children:"Business Name"}),e.jsx(C,{children:e.jsx(P,{...N,className:A(D)})}),e.jsx(b,{})]})}),e.jsx(j,{control:o.control,name:"locality",render:({field:N,fieldState:D})=>e.jsxs(g,{children:[e.jsx(f,{children:"Locality / Country"}),e.jsx(Ge,{onChange:N.onChange,data:d.map(B=>({value:B.code,label:B.name})),value:N.value,disabled:m,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:A(D)}}),e.jsx(b,{})]})}),y&&e.jsx(j,{control:o.control,name:"localName",render:({field:N,fieldState:D})=>e.jsxs(g,{children:[e.jsx(f,{children:"Local Name"}),e.jsx(C,{children:e.jsx(P,{...N,placeholder:"Business name in local language",className:A(D)})}),e.jsx(b,{})]})}),y&&e.jsx(j,{control:o.control,name:"govId",render:({field:N,fieldState:D})=>e.jsxs(g,{children:[e.jsx(f,{children:"Government ID"}),e.jsx(C,{children:e.jsx(P,{...N,placeholder:"Enter Government ID",className:A(D)})}),e.jsx(b,{})]})}),e.jsx(j,{control:o.control,name:"address",render:({field:N,fieldState:D})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"Address"]}),e.jsx(C,{children:e.jsx(Ke,{...N,rows:3,placeholder:"Enter business address",className:A(D)})}),e.jsx(b,{})]})}),y&&e.jsx(j,{control:o.control,name:"localAddress",render:({field:N,fieldState:D})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"Local Address"]}),e.jsx(C,{children:e.jsx(Ke,{...N,rows:3,placeholder:"Enter address in local language",className:A(D)})}),e.jsx(b,{})]})}),e.jsx(j,{control:o.control,name:"phone",render:({field:N,fieldState:D})=>e.jsxs(g,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),"Phone"]}),e.jsx(C,{children:e.jsx(P,{...N,type:"tel",placeholder:"+1 (555) 123-4567",className:A(D)})}),e.jsx(b,{})]})}),e.jsx(j,{control:o.control,name:"website",render:({field:N,fieldState:D})=>e.jsxs(g,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(on,{className:"h-4 w-4"}),"Website"]}),e.jsx(C,{children:e.jsx(P,{...N,type:"url",placeholder:"https://example.com",className:A(D)})}),e.jsx(b,{})]})}),e.jsx(j,{control:o.control,name:"generalContacts",render:({field:N,fieldState:D})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"General Contacts"]}),e.jsx(C,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:A(D)+" flex flex-wrap gap-2 mb-2 rounded-md",children:N.value?.map((B,O)=>e.jsxs(G,{variant:"secondary",className:"gap-1 pr-1",children:[B,e.jsx("button",{type:"button",onClick:()=>F(N.value??[],O),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(se,{className:"h-3 w-3"})})]},O))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{value:h,onChange:B=>x(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),L(N.value??[]))},placeholder:"Add contact email",type:"email"}),e.jsx(E,{type:"button",variant:"outline",size:"icon",disabled:!h.trim(),onClick:()=>L(N.value??[]),children:e.jsx(U,{className:"h-4 w-4"})})]})]})}),e.jsx(b,{})]})}),u&&e.jsx(j,{control:o.control,name:"billingEmails",render:({field:N,fieldState:D})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"Billing Emails"]}),e.jsx(C,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:A(D)+" flex flex-wrap gap-2 mb-2 rounded-md",children:N.value?.map((B,O)=>e.jsxs(G,{variant:"secondary",className:"gap-1 pr-1",children:[B,e.jsx("button",{type:"button",onClick:()=>z(N.value??[],O),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(se,{className:"h-3 w-3"})})]},O))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{value:p,onChange:B=>w(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),Q(N.value??[]))},placeholder:"Add billing email",type:"email"}),e.jsx(E,{type:"button",variant:"outline",size:"icon",disabled:!p.trim(),onClick:()=>Q(N.value??[]),children:e.jsx(U,{className:"h-4 w-4"})})]})]})}),e.jsx(b,{})]})})]})}),e.jsx(Ye,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(E,{type:"submit",disabled:r||Object.keys(o.formState.dirtyFields).length===0,children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})})]})}const Jt="createContract",Qt=()=>{const[{fetching:s},n]=pe(un),t=v.useCallback(async a=>{const l=`Error creating new contract for client[${a.input.clientId}]`,i=`${Jt}-${a.input.clientId}`;V.loading("Creating contract",{id:i});try{const c=await n(a);je(c,l,i)&&V.success("Success",{id:i,description:`Contract for client ${a.input.clientId} was successfully created`})}catch(c){console.error(`${l}: ${c}`),V.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{creating:s,createContract:t}},Yt="updateContract",Zt=()=>{const[{fetching:s},n]=pe(mn),t=v.useCallback(async a=>{const l=`Error updating contract ID [${a.contractId}]`,i=`${Yt}-${a.contractId}`;V.loading("Updating contract",{id:i});try{const c=await n(a),r=je(c,l,i,"updateContract");if(r)return V.success("Success",{id:i,description:"Contract updated"}),r.updateContract}catch(c){console.error(`${l}: ${c}`),V.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{updating:s,updateContract:t}},ea=Ve({id:ze().optional(),startDate:us("Start date is required"),endDate:us("End date is required"),pos:Te($()),paymentAmount:bs().min(0,"Payment amount must be non-negative"),paymentCurrency:re(Object.values(ls),"Currency is required"),productType:re(Object.values(As)).optional(),msCloudLink:Is().optional().or(Ds("")),billingCycle:re(Object.values(be)).optional(),subscriptionPlan:re(Object.values(Ee)).optional(),isActive:hn(),defaultRemark:$().optional(),defaultDocumentType:re(Object.values(ue))}),Ns={startDate:"",endDate:"",pos:[],paymentAmount:0,paymentCurrency:ls.Usd,productType:As.Hive,msCloudLink:void 0,billingCycle:be.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:ue.Proforma};function sa({clientId:s,contract:n,onDone:t}){const[a,l]=v.useState(!1),[i,c]=v.useState(null),[r,o]=v.useState(""),{updateContract:d,updating:m}=Zt(),{createContract:h,creating:x}=Qt(),p=Ie({resolver:Le(ea),defaultValues:n||Ns}),w=()=>{if(r.trim()){const u=p.getValues("pos");p.setValue("pos",[...u,r.trim()],{shouldDirty:!0}),o("")}},S=u=>{const y=p.getValues("pos");p.setValue("pos",y.filter((L,F)=>F!==u),{shouldDirty:!0})};v.useEffect(()=>{n&&(c(n),p.reset({startDate:n.startDate,endDate:n.endDate,pos:n.pos,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}),l(!0))},[n,p]);const T=()=>{c(null),p.reset(Ns),l(!0)},I=v.useCallback(async u=>{if(i)await d({contractId:i.id,input:{amount:{raw:u.paymentAmount,currency:u.paymentCurrency},billingCycle:u.billingCycle,documentType:u.defaultDocumentType,endDate:Ne(new Date(u.endDate),"yyyy-MM-dd"),isActive:u.isActive,msCloud:u.msCloudLink,plan:u.subscriptionPlan,product:u.productType,purchaseOrders:u.pos,remarks:u.defaultRemark,startDate:Ne(new Date(u.startDate),"yyyy-MM-dd")}});else{if(!u.billingCycle){p.setError("billingCycle",{message:"Billing cycle is required"});return}await h({input:{clientId:s,amount:{raw:u.paymentAmount,currency:u.paymentCurrency},billingCycle:u.billingCycle,documentType:u.defaultDocumentType,endDate:Ne(new Date(u.endDate),"yyyy-MM-dd"),isActive:u.isActive,msCloud:u.msCloudLink,plan:u.subscriptionPlan,product:u.productType,purchaseOrders:u.pos,remarks:u.defaultRemark,startDate:Ne(new Date(u.startDate),"yyyy-MM-dd")}})}l(!1),c(null),t?.()},[i,t,h,d,s,p]);return e.jsxs(Be,{open:a,onOpenChange:l,children:[e.jsx(ss,{asChild:!0,children:e.jsxs(E,{size:"sm",onClick:T,children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"New Contract"]})}),e.jsxs(Oe,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ns,{children:[e.jsx(ts,{children:i?"Edit Contract":"Create New Contract"}),e.jsx(as,{children:i?"Update contract details":"Add a new contract with all required details"})]}),e.jsx(Ae,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(I),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(j,{control:p.control,name:"pos",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Purchase Orders"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{placeholder:"Add PO...",value:r,onChange:y=>o(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),w())}}),e.jsx(E,{type:"button",size:"sm",onClick:w,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{children:u.value?.map((y,L)=>e.jsxs(G,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[y,L===u.value.length-1&&e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>S(L),children:e.jsx(se,{className:"size-3 cursor-pointer flex-shrink-0"})})]},L))}),e.jsx(b,{})]})})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"startDate",render:({field:{onChange:u,...y}})=>e.jsxs(g,{children:[e.jsx(f,{children:"Start Date"}),e.jsx(C,{children:e.jsx(P,{type:"date",...y,onInput:L=>u(L)})}),e.jsx(b,{})]})}),e.jsx(j,{control:p.control,name:"endDate",render:({field:{onChange:u,...y}})=>e.jsxs(g,{children:[e.jsx(f,{children:"End Date"}),e.jsx(C,{children:e.jsx(P,{type:"date",...y,onInput:L=>u(L)})}),e.jsx(b,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(j,{control:p.control,name:"paymentAmount",render:({field:u})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsx(f,{children:"Payment Amount"}),e.jsx(C,{children:e.jsx(P,{type:"number",placeholder:"24000",...u,onChange:y=>{u.onChange(y?.target.value?Number(y?.target.value):void 0)}})}),e.jsx(b,{})]})}),e.jsx(j,{control:p.control,name:"paymentCurrency",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Currency"}),e.jsxs(ie,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(C,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(ls).map(y=>e.jsx(de,{value:y,children:y},y))})]}),e.jsx(b,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"productType",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Product Type"}),e.jsx(C,{children:e.jsx(P,{placeholder:"Cloud Services",...u})}),e.jsx(b,{})]})}),e.jsx(j,{control:p.control,name:"billingCycle",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Billing Cycle"}),e.jsxs(ie,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(C,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(be).map(y=>e.jsx(de,{value:y,children:Ps(y)},y))})]}),e.jsx(b,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"subscriptionPlan",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Subscription Plan"}),e.jsx(C,{children:e.jsxs(ie,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(C,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(Ee).map(y=>e.jsx(de,{value:y,children:Bs(y)},y))})]})}),e.jsx(b,{})]})}),e.jsx(j,{control:p.control,name:"isActive",render:({field:u})=>e.jsxs(g,{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(f,{className:"text-base",children:"Active Status"})}),e.jsx(C,{children:e.jsx(Z,{checked:u.value,onCheckedChange:u.onChange})})]})})]}),e.jsx(j,{control:p.control,name:"msCloudLink",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"MS Cloud Link"}),e.jsx(C,{children:e.jsx(P,{type:"url",placeholder:"https://portal.azure.com/contract-id",...u})}),e.jsx(b,{})]})}),e.jsx(j,{control:p.control,name:"defaultDocumentType",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Document Type"}),e.jsxs(ie,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(C,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(ue).map(y=>e.jsx(de,{value:y,children:rs(y)},y))})]}),e.jsx(b,{})]})}),e.jsx(j,{control:p.control,name:"defaultRemark",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Remark"}),e.jsx(C,{children:e.jsx(Ke,{placeholder:"Enter default remark for this contract...",rows:3,...u})}),e.jsx(b,{})]})})]}),e.jsxs(is,{children:[e.jsx(E,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(E,{type:"submit",disabled:x||m,children:i?"Update Contract":"Create Contract"})]})]})})]})]})}function na(s){return{id:s.id,pos:s.purchaseOrders??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 ta({clientId:s}){const[n,t]=v.useState(null),[{data:a,fetching:l},i]=we({query:xn,variables:{clientId:s}}),c=a?.contractsByClient??[];return l?e.jsx("div",{children:"Loading contracts..."}):e.jsxs(W,{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(X,{children:"Current and past contracts sorted by start date"})]}),e.jsx(sa,{clientId:s,contract:n,onDone:i})]})}),e.jsx(J,{className:"space-y-4",children:c.map(r=>{const o=!!r.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:r.product}),e.jsx(G,{variant:o?"default":"secondary",children:r.isActive?"Active":"Inactive"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:r.id})]}),e.jsx(E,{variant:"ghost",size:"sm",onClick:()=>t(na(r)),children:e.jsx(Zn,{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(pn,{className:"h-3 w-3"}),"Contract Period"]}),e.jsxs("p",{className:"text-sm font-medium",children:[new Date(r.startDate).toLocaleDateString()," →"," ",new Date(r.endDate).toLocaleDateString()]})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"PO Numbers"}),e.jsx("p",{className:"text-sm font-medium font-mono",children:r.purchaseOrders.toReversed()[0]??""}),r.purchaseOrders.length>1&&e.jsx("div",{className:"space-x-1",children:r.purchaseOrders.toReversed().slice(1).map(d=>e.jsx("span",{className:"text-xs font-thin font-mono",children:d},d))})]}),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:jn(r.amount.raw,r.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:Ps(r.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:r.plan?Bs(r.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:rs(r.documentType)})]})]}),r.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:r.remarks})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.msCloud&&e.jsx(E,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:r.msCloud.toString(),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(gn,{className:"h-4 w-4 mr-2"}),"MS Cloud",e.jsx(fn,{className:"h-3 w-3 ml-1"})]})})})]},r.id)})})]})}function aa({businessId:s}){return e.jsxs(W,{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(X,{children:"Invoices, proformas, receipts, and other accounting documents"})]})})}),e.jsx(J,{children:e.jsx(vn,{businessId:s,linkedDocumentIds:[],limit:1e3})})]})}const ra=[{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 ia({data:s}){const n=De(Cn,s),[{data:t,fetching:a},l]=we({query:yn,variables:{clientId:n?.id??""},pause:!n?.clientInfo?.greenInvoiceId||!n?.id}),{updateClient:i}=Fs(),c=v.useCallback((o,d)=>{if(!n?.id)return;const m={};m[d]=o,i({businessId:n?.id,fields:m})},[n?.id,i]);v.useEffect(()=>{n?.clientInfo?.greenInvoiceId&&n?.id&&l()},[n?.clientInfo?.greenInvoiceId,n?.id,l]);const r=t?.greenInvoiceClient;return e.jsxs(W,{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(X,{children:"Connected external services and providers"})]}),e.jsxs(E,{size:"sm",children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"Add Integration"]})]})}),e.jsx(J,{className:"space-y-6",children:e.jsxs(et,{type:"multiple",defaultValue:["green-invoice"],className:"space-y-4",children:[a?e.jsxs(Re,{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(k,{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(k,{className:"h-6 w-32"}),e.jsx(k,{className:"h-5 w-5 rounded-full"})]}),e.jsx(k,{className:"h-4 w-64"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-8 w-24"}),e.jsx(k,{className:"h-8 w-8"})]})]})}),e.jsx(Me,{children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{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(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{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(k,{className:"h-3 w-32"}),e.jsx(k,{className:"h-6 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{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(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]})]})]})]})})]}):e.jsxs(Re,{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(xs,{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(la,{id:n?.clientInfo?.greenInvoiceId,provider:"Green Invoice",updateClient:async o=>c(o,"greenInvoiceId")}),e.jsx(hs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Me,{children:r&&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:r.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:r.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:r.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(He,{className:"h-3.5 w-3.5"}),"Email Addresses"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.emails?.map((o,d)=>e.jsx("span",{className:"text-sm px-2 py-1 bg-muted rounded",children:o},d))})]}),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(ws,{className:"h-3.5 w-3.5"}),"Phone"]}),e.jsx("p",{className:"text-sm font-mono",children:r.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:r.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:r.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(We,{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:r.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:r.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:r.zip})]})]})]})]})})]}),ra.map(o=>e.jsxs(Re,{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(xs,{className:"h-4 w-4 text-green-600"}):e.jsx(Nn,{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(E,{variant:"ghost",size:"sm",onClick:d=>d.stopPropagation(),children:e.jsx(cs,{className:"h-4 w-4"})}),e.jsx(hs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Me,{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 la({id:s,provider:n,updateClient:t}){const[a,l]=v.useState(!1),[i,c]=v.useState(s),r=v.useCallback(async()=>{await t(i),l(!1)},[i,t]);return e.jsxs(Be,{open:a,onOpenChange:l,children:[e.jsx(ss,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",onClick:o=>o.stopPropagation(),children:[e.jsx(cs,{className:"h-4 w-4 mr-2"}),"Configure"]})}),e.jsxs(Oe,{onClick:o=>o.stopPropagation(),children:[e.jsxs(ns,{children:[e.jsxs(ts,{children:["Configure ",n]}),e.jsxs(as,{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(bn,{htmlFor:"id",children:[n," ID"]}),e.jsx(P,{id:"id",value:i,onChange:o=>c(o.target.value),placeholder:`Enter ${n} ID`})]})}),e.jsxs(is,{children:[e.jsx(E,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(E,{onClick:r,disabled:!i,children:"Save Changes"})]})]})]})}function ca({businessId:s}){return e.jsxs(W,{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(X,{children:"Complete transaction history for this business"})]})})}),e.jsx(J,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(wn,{businessID:s,filter:{}})})})]})}function oa({data:s,refetchBusiness:n}){const t=De(En,s),[a,l]=In(),i=a.get("tab")||"contact",c=d=>{l({tab:d})};if(!t)return e.jsx("div",{children:"Business not found"});const r="clientInfo"in t&&!!t.clientInfo,o="adminInfo"in t&&!!t.adminInfo;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(On,{data:t}),e.jsx("main",{className:"container mx-auto px-4 py-6 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs(Dn,{value:i,onValueChange:c,className:"w-full",children:[e.jsxs(An,{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(Y,{value:"contact",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(st,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contact"})]}),e.jsxs(Y,{value:"config",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(cs,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Config"})]}),e.jsxs(Y,{value:"charges",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Se,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Charges"})]}),e.jsxs(Y,{value:"transactions",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(kn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Transactions"})]}),e.jsxs(Y,{value:"documents",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Sn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documents"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs(Y,{value:"contracts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(rt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contracts"})]}),e.jsxs(Y,{value:"integrations",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(lt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Integrations"})]})]}),o&&e.jsxs(Y,{value:"admin",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Ts,{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(Xt,{data:t,refetchBusiness:n})}),e.jsx(q,{value:"config",className:"mt-0",children:e.jsx(Ut,{data:t,refetchBusiness:n})}),e.jsx(q,{value:"charges",className:"mt-0",children:e.jsx(gt,{businessId:t.id})}),e.jsx(q,{value:"transactions",className:"mt-0",children:e.jsx(ca,{businessId:t.id})}),e.jsx(q,{value:"documents",className:"mt-0",children:e.jsx(aa,{businessId:t.id})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(q,{value:"contracts",className:"mt-0",children:e.jsx(ta,{clientId:t.id})}),e.jsx(q,{value:"integrations",className:"mt-0",children:e.jsx(ia,{data:t})}),e.jsx(q,{value:"charts",className:"mt-0",children:e.jsx(Bt,{})})]}),o&&e.jsx(q,{value:"admin",className:"mt-0",children:e.jsx(jt,{data:t})})]})})]})}function fa(s){return`/businesses/${s}`}const va=()=>{const{businessId:s}=Tn();let n;try{n=Pn()}catch{}const[{data:t,fetching:a},l]=we({query:Bn,pause:!s||!!n,variables:{businessId:s??""}}),i=n||t;return!n&&a&&!i?.business?e.jsx(Cs,{}):!s||!i?.business?e.jsx("div",{children:"Business not found"}):e.jsx(oa,{data:i.business,refetchBusiness:async()=>l()})};export{va as BusinessScreen,fa as getBusinessHref};
@@ -1 +1 @@
1
- import{X as l,j as e,aD as t,H as m,bt as x}from"./index-C1vFqfE7.js";import{B as o}from"./building-2-DqnthsV_.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,bs as x}from"./index-xIO0bA36.js";import{B as o}from"./building-2-HRA8xsoA.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{bq as S,u as g,r as m,F as x,a as C,j as o,bu as y,n as h,bv as T,bw as b,aV as n,bh as F,bx as v}from"./index-C1vFqfE7.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}]=C({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(h,{}):o.jsx(T,{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{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-xIO0bA36.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 +1 @@
1
- import{bq as u,r as n,F as p,a as c,j as s,n as x,c as d,bE as l}from"./index-C1vFqfE7.js";import{P as m,C as b,E as T}from"./editable-business-trip-tuSBklIH.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{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-xIO0bA36.js";import{P as m,C as b,E as T}from"./editable-business-trip-DVC29gsX.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{c_ as B,r as i,u as R,d1 as U,j as e,c$ as W,s as z,bA as G,B as _,d0 as Q,ag as q,V as J,H as N,ai as D,di as K,as as X,a1 as $,dj as Y,bP as h,ci as A,fs as Z,bU as L,bV as O,bQ as P,eA as k,ap as x,ft as ee,bg as se,a3 as m,a4 as j,a5 as g,a6 as p,dK as ae,dL as te,dM as ne}from"./index-C1vFqfE7.js";import{s as oe}from"./sub-DVpRQI4L.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:k.All},{label:"Income",value:k.Income},{label:"Expense",value:k.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext:y}=i.useContext(q),o=J({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:r,handleSubmit:T,watch:C}=o,[b,F]=i.useState(a.sortBy?.asc??!1),[c,u]=i.useState(!!a.sortBy?.field),{selectableFinancialEntities:S,fetching:t}=K(),{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 H(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx($,{...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(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:r,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:r,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(A,{...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,M)=>M.label?.toLowerCase().includes(l.toLowerCase().trim())||M.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:L,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:L,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??k.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:b??!1,disabled:!c,onCheckedChange:F}),e.jsx("span",{className:"text-xs",children:b?"ASC":"DESC"})]})})}),e.jsx(h,{name:"accountantStatus",control:r,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: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:y,totalPages:o=1,initiallyOpened:r=!1}){const[T,C]=i.useState(r),[b,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"),y(1))},[a,c,u,y]);const S=i.useCallback(t=>{U(t,a)||(w(t),F(!B(t)))},[a,w]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(W,{opened:T,onClose:()=>C(!1),content:e.jsx(ie,{filter:a,setFilter:S,closeModal:()=>C(!1)}),modalSize:"xl"}),o>1&&e.jsx(z,{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(Q,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
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-xIO0bA36.js";import{s as oe}from"./sub-CqZ9jxmt.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 +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-C1vFqfE7.js";import{C as J}from"./charges-filters-BZS9K5l_.js";import{M as $}from"./index-rzb-Wfyn.js";import{P as G}from"./Progress-D2_rEDMg.js";import"./sub-DVpRQI4L.js";import"./subMonths-CFZKY9ia.js";import"./Checkbox-BO9Xpz8t.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-xIO0bA36.js";import{C as J}from"./charges-filters-hjHQC8jb.js";import{M as $}from"./index-C1QP_1hi.js";import{P as G}from"./Progress-NZzZXmow.js";import"./sub-CqZ9jxmt.js";import"./subMonths-CwZPyK0k.js";import"./Checkbox-BPO8_jMH.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};