@accounter/client 0.0.8-alpha-20251023070808-bdd9d09db3d693f2c0061a2bbd66a4bfe5224012 → 0.0.8-alpha-20251023071041-df324f1dc0984ca95d91caeebfa99c5dfea3ce0c

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 (58) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-Bm30-WRa.js → Checkbox-iZ--iyJF.js} +1 -1
  3. package/dist/assets/{Progress-DxcT-wYo.js → Progress-CSjfE5bV.js} +1 -1
  4. package/dist/assets/{Typography-CZLHs9y2.js → Typography-D14P1nN1.js} +1 -1
  5. package/dist/assets/{accordion-_VaDHoQb.js → accordion-CcwG2M8I.js} +1 -1
  6. package/dist/assets/{accountant-approvals-C7GnMLyl.js → accountant-approvals-3mWk2IJb.js} +1 -1
  7. package/dist/assets/{all-charges-DS-mdep6.js → all-charges-kAC8rw9C.js} +1 -1
  8. package/dist/assets/{arrow-up-down-Bt3_puEZ.js → arrow-up-down-BS_znu7y.js} +1 -1
  9. package/dist/assets/{business-Db4PzgLz.js → business-Cv0e_Q3p.js} +1 -1
  10. package/dist/assets/{business-transactions-single-Canul8rR.js → business-transactions-single-B23INPyA.js} +1 -1
  11. package/dist/assets/{business-trip-x8lljSMP.js → business-trip-c4pY18e_.js} +1 -1
  12. package/dist/assets/{charges-filters-DkO9FBdC.js → charges-filters-DaVBQ_jS.js} +1 -1
  13. package/dist/assets/{charges-ledger-validation-wla_aWIc.js → charges-ledger-validation-DZtDlOTx.js} +1 -1
  14. package/dist/assets/{chart-2uS7cQLX.js → chart-BgPuhGqj.js} +1 -1
  15. package/dist/assets/{data-table-pagination-CQQBbtVE.js → data-table-pagination-P75qqcV4.js} +1 -1
  16. package/dist/assets/{editable-business-trip-D50scoPo.js → editable-business-trip-80Bf0nf4.js} +1 -1
  17. package/dist/assets/{index-B20Tn_iF.js → index-1yUzw9-e.js} +1 -1
  18. package/dist/assets/{index-D2w9iaKk.js → index-ASrM5c3z.js} +1 -1
  19. package/dist/assets/{index-BNPAKzBY.js → index-BIiK-vW-.js} +1 -1
  20. package/dist/assets/{index-BP2Hv2J-.js → index-BUJZ6CG6.js} +1 -1
  21. package/dist/assets/{index-D_PykgGt.js → index-BopVOgtm.js} +1 -1
  22. package/dist/assets/{index-Dk4NeG4m.js → index-Bt1Iynf-.js} +1 -1
  23. package/dist/assets/{index-C4JVZBO-.js → index-BtF8NkXw.js} +1 -1
  24. package/dist/assets/{index-DJ33tRZ1.js → index-Buu6jU2e.js} +1 -1
  25. package/dist/assets/{index-BJ63UrPP.js → index-BwJkbwi9.js} +1 -1
  26. package/dist/assets/{index-D5CFY1GF.js → index-CNBPVFd1.js} +1 -1
  27. package/dist/assets/{index-BaDl3RPI.js → index-Cca4zCek.js} +1 -1
  28. package/dist/assets/{index-BmSAw35b.js → index-CgVLV78R.js} +1 -1
  29. package/dist/assets/{index-Bskia9ol.js → index-CmRugx3-.js} +1 -1
  30. package/dist/assets/{index-OqG78rNq.js → index-D-K_l8g8.js} +1 -1
  31. package/dist/assets/{index-CDHKPA0l.js → index-D0eVaZI5.js} +1 -1
  32. package/dist/assets/{index-IN8Kpfsx.js → index-D3y74IdY.js} +1 -1
  33. package/dist/assets/{index-CqZy7PVr.js → index-D7rFUnXc.js} +1 -1
  34. package/dist/assets/{index-Dkqd5T8J.js → index-DUDlwA28.js} +1 -1
  35. package/dist/assets/{index-DOKYSdGb.js → index-DWdQvLZN.js} +1 -1
  36. package/dist/assets/{index-BTiGhl3N.js → index-DfYVR_1G.js} +1 -1
  37. package/dist/assets/{index-DBjj2AmF.js → index-DmBjrSud.js} +1 -1
  38. package/dist/assets/{index-DKS2QKOQ.js → index-Ucx6U5YY.js} +1 -1
  39. package/dist/assets/{index-BsGG-RLV.js → index-iLt1WIM9.js} +63 -63
  40. package/dist/assets/{index.es-DKjfxgqg.js → index.es-VMf2fRct.js} +1 -1
  41. package/dist/assets/{issue-document-BFOjGS-U.js → issue-document-BustWthK.js} +1 -1
  42. package/dist/assets/{login-page-CpRailN7.js → login-page-DbBOFdaj.js} +1 -1
  43. package/dist/assets/{missing-info-charges-BnYMeatL.js → missing-info-charges-sf4ZGQoC.js} +1 -1
  44. package/dist/assets/page-not-found-CzE13z4R.js +1 -0
  45. package/dist/assets/{pencil-DC6M9VTY.js → pencil-1-tPx_Bq.js} +1 -1
  46. package/dist/assets/{report-commentary-row-DJPRyQur.js → report-commentary-row-BqTwvfOv.js} +1 -1
  47. package/dist/assets/{save-Dr3CNkcl.js → save-CMGkGXCM.js} +1 -1
  48. package/dist/assets/{similar-charges-by-business-modal-CCw5opHn.js → similar-charges-by-business-modal-Dj7iCQhJ.js} +1 -1
  49. package/dist/assets/{sub-DKnwnbwx.js → sub-3l-gAINS.js} +1 -1
  50. package/dist/assets/subMonths-LVothVpu.js +1 -0
  51. package/dist/index.html +1 -1
  52. package/package.json +2 -2
  53. package/src/providers/urql-client.ts +26 -0
  54. package/src/providers/urql.tsx +32 -0
  55. package/src/router/loaders/business-loader.ts +2 -4
  56. package/src/router/loaders/charge-loader.ts +2 -4
  57. package/dist/assets/page-not-found-BLrYvmf4.js +0 -1
  58. package/dist/assets/subMonths-B44KizJf.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @accounter/client
2
2
 
3
- ## 0.0.8-alpha-20251023070808-bdd9d09db3d693f2c0061a2bbd66a4bfe5224012
3
+ ## 0.0.8-alpha-20251023071041-df324f1dc0984ca95d91caeebfa99c5dfea3ce0c
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -1,4 +1,4 @@
1
- import{V as fr,r as w,bJ as Q,eF as ur,aj as t,eG as R,bH as X,bI as V,bK as n,eH as I,bL as z,eI as _r,eJ as vr,eK as br}from"./index-BsGG-RLV.js";/**
1
+ import{V as fr,r as w,bJ as Q,eF as ur,aj as t,eG as R,bH as X,bI as V,bK as n,eH as I,bL as z,eI as _r,eJ as vr,eK as br}from"./index-iLt1WIM9.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{bH as K,bI as _,bK as o,dZ as M,r as W,bJ as Z,aj as s,T as q,bL as w,c2 as O}from"./index-BsGG-RLV.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},G=M({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var Q=K((a,{color:r,radius:e},{size:t})=>({root:{position:"relative",height:_({size:t,sizes:k}),backgroundColor:a.colorScheme==="dark"?a.colors.dark[4]:a.colors.gray[2],borderRadius:a.fn.radius(e),overflow:"hidden"},bar:{position:"absolute",top:0,bottom:0,left:0,height:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background,transition:"width 100ms linear","&[data-animate]":{animation:`${G} 1000ms linear infinite`},"&[data-striped]":{backgroundSize:`${o(20)} ${o(20)}`,backgroundImage:"linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"},"&:last-of-type":{borderTopRightRadius:a.fn.radius(e),borderBottomRightRadius:a.fn.radius(e)},"&:first-of-type":{borderTopLeftRadius:a.fn.radius(e),borderBottomLeftRadius:a.fn.radius(e)},"@media (prefers-reduced-motion)":{transitionDuration:a.respectReducedMotion?"0ms":void 0}},label:{color:a.white,fontSize:`calc(${_({size:t,sizes:k})} * 0.65)`,fontWeight:700,userSelect:"none",overflow:"hidden",whiteSpace:"nowrap"}})),U=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?U(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e,c=(a,r)=>{for(var e in r||(r={}))R.call(r,e)&&N(a,e,r[e]);if(n)for(var e of n(r))S.call(r,e)&&N(a,e,r[e]);return a},h=(a,r)=>X(a,Y(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=Z("Progress",ea,a),{className:t,value:d,color:C,size:E,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:I,sections:p,unstyled:L,variant:T}=e,D=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=Q({color:C,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:L,variant:T,size:E}),A=Array.isArray(p)?aa(p).map((B,F)=>{var v=B,{tooltip:g,accumulated:V,value:H,label:y,color:J}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(q.Floating,{label:g,disabled:!g,key:F},s.createElement(w,h(c({},P),{className:f(l.bar,P.className),"data-striped":u||i||void 0,"data-animate":i||void 0,sx:{width:`${H}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:J||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},D),A||s.createElement("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":d,"aria-label":j,className:l.bar,style:{width:`${d}%`},"data-striped":u||i||void 0,"data-animate":i||void 0},m?s.createElement(O,{className:l.label},m):""))});ra.displayName="@mantine/core/Progress";export{ra as P};
1
+ import{bH as K,bI as _,bK as o,dZ as M,r as W,bJ as Z,aj as s,T as q,bL as w,c2 as O}from"./index-iLt1WIM9.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},G=M({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var Q=K((a,{color:r,radius:e},{size:t})=>({root:{position:"relative",height:_({size:t,sizes:k}),backgroundColor:a.colorScheme==="dark"?a.colors.dark[4]:a.colors.gray[2],borderRadius:a.fn.radius(e),overflow:"hidden"},bar:{position:"absolute",top:0,bottom:0,left:0,height:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background,transition:"width 100ms linear","&[data-animate]":{animation:`${G} 1000ms linear infinite`},"&[data-striped]":{backgroundSize:`${o(20)} ${o(20)}`,backgroundImage:"linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"},"&:last-of-type":{borderTopRightRadius:a.fn.radius(e),borderBottomRightRadius:a.fn.radius(e)},"&:first-of-type":{borderTopLeftRadius:a.fn.radius(e),borderBottomLeftRadius:a.fn.radius(e)},"@media (prefers-reduced-motion)":{transitionDuration:a.respectReducedMotion?"0ms":void 0}},label:{color:a.white,fontSize:`calc(${_({size:t,sizes:k})} * 0.65)`,fontWeight:700,userSelect:"none",overflow:"hidden",whiteSpace:"nowrap"}})),U=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?U(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e,c=(a,r)=>{for(var e in r||(r={}))R.call(r,e)&&N(a,e,r[e]);if(n)for(var e of n(r))S.call(r,e)&&N(a,e,r[e]);return a},h=(a,r)=>X(a,Y(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=Z("Progress",ea,a),{className:t,value:d,color:C,size:E,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:I,sections:p,unstyled:L,variant:T}=e,D=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=Q({color:C,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:L,variant:T,size:E}),A=Array.isArray(p)?aa(p).map((B,F)=>{var v=B,{tooltip:g,accumulated:V,value:H,label:y,color:J}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(q.Floating,{label:g,disabled:!g,key:F},s.createElement(w,h(c({},P),{className:f(l.bar,P.className),"data-striped":u||i||void 0,"data-animate":i||void 0,sx:{width:`${H}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:J||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},D),A||s.createElement("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":d,"aria-label":j,className:l.bar,style:{width:`${d}%`},"data-striped":u||i||void 0,"data-animate":i||void 0},m?s.createElement(O,{className:l.label},m):""))});ra.displayName="@mantine/core/Progress";export{ra as P};
@@ -1 +1 @@
1
- import{eg as S,eh as K,ei as Q,ej as X,ek as W,el as Y,d9 as Z,d8 as z,r as k,dd as N,em as ee,j as te,ak as re,d_ as V}from"./index-BsGG-RLV.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 F(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=F,slotShouldForwardProp:o=F}=e;function s(a){ue(a,t,r)}return(a,d={})=>{Q(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let x=F;h==="Root"||h==="root"?x=n:h?x=o:pe(a)&&(x=void 0);const _=X(a,{shouldForwardProp:x,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return A(m,u,m.theme.modularCssLayers?w:void 0)};if(Y(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=_(...J);return a.muiName&&(L.muiName=a.muiName),L};return _.withConfig&&(j.withConfig=_.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 _e(...e){const t=k.useRef(void 0),r=k.useCallback(n=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},e);return k.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function xe(e){return typeof e.main=="string"}function be(e,t=[]){if(!xe(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&be(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${V(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${V(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${V(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"},Fe=k.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",x=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(x.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Fe as T,Me as _,ie as a,F as b,me as c,Ce as d,U as g,we as m,ve as s,_e as u};
1
+ import{eg as S,eh as K,ei as Q,ej as X,ek as W,el as Y,d9 as Z,d8 as z,r as k,dd as N,em as ee,j as te,ak as re,d_ as V}from"./index-iLt1WIM9.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 F(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=F,slotShouldForwardProp:o=F}=e;function s(a){ue(a,t,r)}return(a,d={})=>{Q(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let x=F;h==="Root"||h==="root"?x=n:h?x=o:pe(a)&&(x=void 0);const _=X(a,{shouldForwardProp:x,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return A(m,u,m.theme.modularCssLayers?w:void 0)};if(Y(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=_(...J);return a.muiName&&(L.muiName=a.muiName),L};return _.withConfig&&(j.withConfig=_.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 _e(...e){const t=k.useRef(void 0),r=k.useCallback(n=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},e);return k.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function xe(e){return typeof e.main=="string"}function be(e,t=[]){if(!xe(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&be(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${V(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${V(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${V(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"},Fe=k.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",x=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(x.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Fe as T,Me as _,ie as a,F as b,me as c,Ce as d,U as g,we as m,ve as s,_e as u};
@@ -1 +1 @@
1
- import{aj as l,j as t,ff as J,fg as Q,fh as O,fi as W,fj as Z,fk as T,fl as ee,fm as oe,fn as M,fo as re,fp as te,fq as ne,y as P,dX as ae}from"./index-BsGG-RLV.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=J(d),[b]=Q(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(pe,{...r,ref:n}):t.jsx(fe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[K,de]=b(d,{collapsible:!1}),fe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},collapsible:r=!1,...s}=e,[i,f]=M({prop:o,defaultProp:a??"",onChange:c,caller:d});return t.jsx(H,{scope:e.__scopeAccordion,value:l.useMemo(()=>i?[i]:[],[i]),onItemOpen:f,onItemClose:l.useCallback(()=>r&&f(""),[r,f]),children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx($,{...s,ref:n})})})}),pe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},...r}=e,[s,i]=M({prop:o,defaultProp:a??[],onChange:c,caller:d}),f=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:f,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),f=re(i,n),v=ie(o),u=te(c)==="ltr",h=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const B=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===B),D=I.length;if(g===-1)return;m.preventDefault();let p=g;const j=0,w=D-1,_=()=>{p=g+1,p>w&&(p=j)},y=()=>{p=g-1,p<j&&(p=w)};switch(m.key){case"Home":p=j;break;case"End":p=w;break;case"ArrowRight":r==="horizontal"&&(u?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(u?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const F=p%D;I[F].ref.current?.focus()});return t.jsx(ue,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref:f,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),f=W(),v=a&&s.value.includes(a)||!1,x=r.disabled||e.disabled;return t.jsx(ve,{scope:o,open:v,disabled:x,triggerId:f,children:t.jsx(Z,{"data-orientation":r.orientation,"data-state":Y(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":Y(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=L;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});U.displayName=N;var q="AccordionContent",X=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}})});X.displayName=q;function Y(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=X;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{aj as l,j as t,ff as J,fg as Q,fh as O,fi as W,fj as Z,fk as T,fl as ee,fm as oe,fn as M,fo as re,fp as te,fq as ne,y as P,dX as ae}from"./index-iLt1WIM9.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=J(d),[b]=Q(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(pe,{...r,ref:n}):t.jsx(fe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[K,de]=b(d,{collapsible:!1}),fe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},collapsible:r=!1,...s}=e,[i,f]=M({prop:o,defaultProp:a??"",onChange:c,caller:d});return t.jsx(H,{scope:e.__scopeAccordion,value:l.useMemo(()=>i?[i]:[],[i]),onItemOpen:f,onItemClose:l.useCallback(()=>r&&f(""),[r,f]),children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx($,{...s,ref:n})})})}),pe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},...r}=e,[s,i]=M({prop:o,defaultProp:a??[],onChange:c,caller:d}),f=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:f,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),f=re(i,n),v=ie(o),u=te(c)==="ltr",h=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const B=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===B),D=I.length;if(g===-1)return;m.preventDefault();let p=g;const j=0,w=D-1,_=()=>{p=g+1,p>w&&(p=j)},y=()=>{p=g-1,p<j&&(p=w)};switch(m.key){case"Home":p=j;break;case"End":p=w;break;case"ArrowRight":r==="horizontal"&&(u?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(u?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const F=p%D;I[F].ref.current?.focus()});return t.jsx(ue,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref:f,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),f=W(),v=a&&s.value.includes(a)||!1,x=r.disabled||e.disabled;return t.jsx(ve,{scope:o,open:v,disabled:x,triggerId:f,children:t.jsx(Z,{"data-orientation":r.orientation,"data-state":Y(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":Y(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=L;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});U.displayName=N;var q="AccordionContent",X=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}})});X.displayName=q;function Y(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=X;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 s,F as h,u as v,U as C,ai as A,a as F,j as e,c as P,L as b,fr as y}from"./index-BsGG-RLV.js";import{C as j}from"./charges-filters-DkO9FBdC.js";import{P as D}from"./Progress-DxcT-wYo.js";import"./sub-DKnwnbwx.js";import"./subMonths-B44KizJf.js";const w=()=>{const{setFiltersContext:c}=s.useContext(h),{get:i}=v(),{userContext:p}=s.useContext(C),[a,x]=s.useState(i("chargesFilters")?JSON.parse(decodeURIComponent(i("chargesFilters"))):{byOwners:p?.context.adminBusinessId?[p?.context.adminBusinessId]:[],sortBy:{field:A.Date,asc:!1},toAnyDate:null,fromAnyDate:null}),[{data:r,fetching:u}]=F({query:y,variables:{filters:a,page:1,limit:999999}}),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 s.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:a,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,a,c,x]),e.jsx(P,{title:"Accountant Approvals Status",children:u?e.jsx(b,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"mx-10 mt-5 flex flex-col gap-5",children:[`Total charges: ${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 s,F as h,u as v,U as C,ai as A,a as F,j as e,c as P,L as b,fr as y}from"./index-iLt1WIM9.js";import{C as j}from"./charges-filters-DaVBQ_jS.js";import{P as D}from"./Progress-CSjfE5bV.js";import"./sub-3l-gAINS.js";import"./subMonths-LVothVpu.js";const w=()=>{const{setFiltersContext:c}=s.useContext(h),{get:i}=v(),{userContext:p}=s.useContext(C),[a,x]=s.useState(i("chargesFilters")?JSON.parse(decodeURIComponent(i("chargesFilters"))):{byOwners:p?.context.adminBusinessId?[p?.context.adminBusinessId]:[],sortBy:{field:A.Date,asc:!1},toAnyDate:null,fromAnyDate:null}),[{data:r,fetching:u}]=F({query:y,variables:{filters:a,page:1,limit:999999}}),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 s.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:a,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,a,c,x]),e.jsx(P,{title:"Accountant Approvals Status",children:u?e.jsx(b,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"mx-10 mt-5 flex flex-col gap-5",children:[`Total charges: ${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-BsGG-RLV.js";import{e as Q,C as $}from"./charges-filters-DkO9FBdC.js";import{M as H}from"./index-BTiGhl3N.js";import"./sub-DKnwnbwx.js";import"./subMonths-B44KizJf.js";import"./Checkbox-Bm30-WRa.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-iLt1WIM9.js";import{e as Q,C as $}from"./charges-filters-DaVBQ_jS.js";import{M as H}from"./index-DfYVR_1G.js";import"./sub-3l-gAINS.js";import"./subMonths-LVothVpu.js";import"./Checkbox-iZ--iyJF.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{V as o}from"./index-BsGG-RLV.js";/**
1
+ import{V as o}from"./index-iLt1WIM9.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{V as ee,W as Ce,X as Se,Y as ie,p as be,r as N,t as B,s as we,Z as Ms,k as Ie,_ as Ee,D as je,j as e,$ as W,a0 as K,a1 as H,a2 as X,l as De,a3 as Q,a4 as j,a5 as g,a6 as f,a7 as y,Q as T,a8 as I,a9 as C,aa as Qe,B as E,ab as Us,ac as Pe,o as Ye,ad as V,ae as Cs,af as q,ag as zs,U as Ze,a as Oe,ah as qs,O as Gs,C as Ws,ai as Ks,aj as L,ak as ds,al as Hs,am as Xs,an as ue,ao as Je,ap as es,aq as G,ar as ss,as as ns,at as ts,au as as,av as he,aw as le,ax as ce,ay as oe,az as de,aA as me,aB as rs,aC as is,aD as Re,aE as re,aF as Me,aG as Ue,aH as Le,aI as Qs,aJ as se,aK as J,aL as Ys,aM as Zs,aN as Js,aO as ze,aP as en,aQ as sn,aR as nn,aS as tn,aT as an,aU as qe,aV as rn,aW as Ge,aX as ln,aY as bs,aZ as ws,a_ as cn,a$ as on,b0 as Is,b1 as ls,b2 as dn,b3 as ms,b4 as mn,b5 as un,b6 as hn,b7 as xn,b8 as pn,b9 as jn,ba as gn,bb as D,bc as fn,bd as cs,be as vn,bf as yn,bg as Nn,bh as Cn,bi as bn,bj as wn,bk as Z,bl as In,bm as Dn,bn as z,bo as An,bp as kn,bq as Sn,w as Tn,br as En}from"./index-BsGG-RLV.js";import{S as os,B as Ds}from"./save-Dr3CNkcl.js";import{i as Pn,D as On,f as Bn,E as Ln,L as Ve,a as Ae,C as Vn,A as _n,b as ve,c as Fn,d as We,h as $n,e as Rn,g as As,u as Mn,G as Un,j as us,k as zn,X as ks,Y as Ss,l as qn,m as Gn,R as Wn,n as Kn,o as Hn,p as Xn}from"./chart-2uS7cQLX.js";import{u as Ts,S as Qn}from"./similar-charges-by-business-modal-CCw5opHn.js";import{P as Yn}from"./pencil-DC6M9VTY.js";import{A as Zn,a as _e,b as Fe,c as hs}from"./accordion-_VaDHoQb.js";import"./sequential-CAnleQny.js";/**
1
+ import{V as ee,W as Ce,X as Se,Y as ie,p as be,r as N,t as B,s as we,Z as Ms,k as Ie,_ as Ee,D as je,j as e,$ as W,a0 as K,a1 as H,a2 as X,l as De,a3 as Q,a4 as j,a5 as g,a6 as f,a7 as y,Q as T,a8 as I,a9 as C,aa as Qe,B as E,ab as Us,ac as Pe,o as Ye,ad as V,ae as Cs,af as q,ag as zs,U as Ze,a as Oe,ah as qs,O as Gs,C as Ws,ai as Ks,aj as L,ak as ds,al as Hs,am as Xs,an as ue,ao as Je,ap as es,aq as G,ar as ss,as as ns,at as ts,au as as,av as he,aw as le,ax as ce,ay as oe,az as de,aA as me,aB as rs,aC as is,aD as Re,aE as re,aF as Me,aG as Ue,aH as Le,aI as Qs,aJ as se,aK as J,aL as Ys,aM as Zs,aN as Js,aO as ze,aP as en,aQ as sn,aR as nn,aS as tn,aT as an,aU as qe,aV as rn,aW as Ge,aX as ln,aY as bs,aZ as ws,a_ as cn,a$ as on,b0 as Is,b1 as ls,b2 as dn,b3 as ms,b4 as mn,b5 as un,b6 as hn,b7 as xn,b8 as pn,b9 as jn,ba as gn,bb as D,bc as fn,bd as cs,be as vn,bf as yn,bg as Nn,bh as Cn,bi as bn,bj as wn,bk as Z,bl as In,bm as Dn,bn as z,bo as An,bp as kn,bq as Sn,w as Tn,br as En}from"./index-iLt1WIM9.js";import{S as os,B as Ds}from"./save-CMGkGXCM.js";import{i as Pn,D as On,f as Bn,E as Ln,L as Ve,a as Ae,C as Vn,A as _n,b as ve,c as Fn,d as We,h as $n,e as Rn,g as As,u as Mn,G as Un,j as us,k as zn,X as ks,Y as Ss,l as qn,m as Gn,R as Wn,n as Kn,o as Hn,p as Xn}from"./chart-BgPuhGqj.js";import{u as Ts,S as Qn}from"./similar-charges-by-business-modal-Dj7iCQhJ.js";import{P as Yn}from"./pencil-1-tPx_Bq.js";import{A as Zn,a as _e,b as Fe,c as hs}from"./accordion-CcwG2M8I.js";import"./sequential-CAnleQny.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{bp as S,u as g,r as m,F as x,a as y,j as o,bw as C,w as T,bx as h,by as b,b1 as n,bg as F,bz as v}from"./index-BsGG-RLV.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(x),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=y({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(C,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(T,{}):o.jsx(h,{moreInfo:e=>o.jsx(F,{businessID:e.business.id,filter:c}),striped:!0,highlightOnHover:!0,stickyHeader:!0,items:p,columns:[{title:"Business Name",value:e=>e.business.name},{title:"Debit",value:e=>e.debit.formatted,style:{whiteSpace:"nowrap"}},{title:"Credit",value:e=>e.credit.formatted,style:{whiteSpace:"nowrap"}},{title:"Total",value:e=>e.total.raw&&(e.total.raw<-1e-4||e.total.raw>1e-4)?o.jsx(b,{color:e.total.raw>0?"green":"red",children:e.total.formatted}):e.total.formatted,style:{whiteSpace:"nowrap"}},...a(n.Eur),...a(n.Usd),...a(n.Gbp),...a(n.Cad),...a(n.Jpy),...a(n.Aud),...a(n.Sek)]})};function a(t){return[{title:`${t} Debit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.debit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Credit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.credit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:r=>{const s=r.foreignCurrenciesSum.find(u=>u.currency===t);return s?.total?.raw&&(s.total.raw<-1e-4||s.total.raw>1e-4)?o.jsx(b,{color:s.total.raw>0?"green":"red",children:s.total.formatted}):s?.total?.formatted},style:{whiteSpace:"nowrap"}}]}export{I as BusinessTransactionsSingle};
1
+ import{bp as S,u as g,r as m,F as x,a as y,j as o,bw as C,w as T,bx as h,by as b,b1 as n,bg as F,bz as v}from"./index-iLt1WIM9.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(x),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=y({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(C,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(T,{}):o.jsx(h,{moreInfo:e=>o.jsx(F,{businessID:e.business.id,filter:c}),striped:!0,highlightOnHover:!0,stickyHeader:!0,items:p,columns:[{title:"Business Name",value:e=>e.business.name},{title:"Debit",value:e=>e.debit.formatted,style:{whiteSpace:"nowrap"}},{title:"Credit",value:e=>e.credit.formatted,style:{whiteSpace:"nowrap"}},{title:"Total",value:e=>e.total.raw&&(e.total.raw<-1e-4||e.total.raw>1e-4)?o.jsx(b,{color:e.total.raw>0?"green":"red",children:e.total.formatted}):e.total.formatted,style:{whiteSpace:"nowrap"}},...a(n.Eur),...a(n.Usd),...a(n.Gbp),...a(n.Cad),...a(n.Jpy),...a(n.Aud),...a(n.Sek)]})};function a(t){return[{title:`${t} Debit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.debit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Credit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.credit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:r=>{const s=r.foreignCurrenciesSum.find(u=>u.currency===t);return s?.total?.raw&&(s.total.raw<-1e-4||s.total.raw>1e-4)?o.jsx(b,{color:s.total.raw>0?"green":"red",children:s.total.formatted}):s?.total?.formatted},style:{whiteSpace:"nowrap"}}]}export{I as BusinessTransactionsSingle};
@@ -1 +1 @@
1
- import{bp as u,r as n,F as p,a as c,j as s,w as x,c as d,bG as l}from"./index-BsGG-RLV.js";import{P as m,C as b,E as T}from"./editable-business-trip-D50scoPo.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,w as x,c as d,bG as l}from"./index-iLt1WIM9.js";import{P as m,C as b,E as T}from"./editable-business-trip-80Bf0nf4.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{d0 as B,r as i,u as W,d3 as H,j as e,d1 as U,O as z,bC as G,B as _,d2 as X,U as q,k as J,Y as N,ai as D,dk as K,aN as Q,l as Y,dl as Z,bR as h,cj as k,fs as $,bW as M,bX as L,bS as P,eA as A,aK as x,ft as ee,bf as se,a4 as m,a5 as j,a6 as g,a7 as p,dM as ae,dN as te,dO as ne}from"./index-BsGG-RLV.js";import{s as oe}from"./sub-DKnwnbwx.js";function le(a){return!a||B(a)?null:encodeURIComponent(JSON.stringify(a))}const re=[{value:D.AbsAmount,label:"Abs Amount"},{value:D.Amount,label:"Amount"},{value:D.Date,label:"Date"}],ce=[{label:"All",value:A.All},{label:"Income",value:A.Income},{label:"Expense",value:A.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext: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}=Q(),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 R(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(Y,{...o,children:e.jsxs("form",{onSubmit:T(V),children:[e.jsxs(Z,{cols:2,children:[e.jsx(h,{name:"byOwners",control:r,defaultValue:a.byOwners,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byBusinesses",control:r,defaultValue:a.byBusinesses,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byTags",control:r,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:v,itemComponent:$,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,O)=>O.label?.toLowerCase().includes(l.toLowerCase().trim())||O.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(L,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"toAnyDate",control:r,defaultValue:a.toAnyDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(L,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"chargesType",control:r,defaultValue:a.chargesType,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:ce,value:s.value??A.All,disabled:t,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"sortBy.field",control:r,defaultValue:a.sortBy?.field??D.Date,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:re,label:"Field to sort by",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,rightSectionProps:{style:{width:"5rem"}},withinPortal:!0,rightSection:e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(x,{defaultChecked:a.sortBy?.asc??!1,checked: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(k,{...s,value:s.value??[],data:ee,disabled:t,label:"Accountant Status",placeholder:"All",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsxs("div",{className:"flex flex-col gap-2 mt-4 rounded-lg border p-3 shadow-sm space-y-2",children:[e.jsx(se,{children:"Missing Information:"}),e.jsx(m,{control:o.control,name:"withoutInvoice",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Invoice"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutInvoice??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutReceipt",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Receipts"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutReceipt??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Documents"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutDocuments??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withOpenDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"With Open Documents"})}),e.jsx(p,{children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(x,{defaultChecked:a.withOpenDocuments??!1,onCheckedChange:s.onChange})}),e.jsx(ne,{children:e.jsx("p",{children:"Show only charges with documents that are currently open"})})]})})]})}),e.jsx(m,{control:o.control,name:"withoutTransactions",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Transactions"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutTransactions??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"unbalanced",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Unbalanced businesses"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.unbalanced??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutLedger",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without ledger"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutLedger??!1,onCheckedChange:s.onChange})})]})})]})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:t||I,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:R,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}=W();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=>{H(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: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(X,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
1
+ import{d0 as B,r as i,u as W,d3 as H,j as e,d1 as U,O as z,bC as G,B as _,d2 as X,U as q,k as J,Y as N,ai as D,dk as K,aN as Q,l as Y,dl as Z,bR as h,cj as k,fs as $,bW as M,bX as L,bS as P,eA as A,aK as x,ft as ee,bf as se,a4 as m,a5 as j,a6 as g,a7 as p,dM as ae,dN as te,dO as ne}from"./index-iLt1WIM9.js";import{s as oe}from"./sub-3l-gAINS.js";function le(a){return!a||B(a)?null:encodeURIComponent(JSON.stringify(a))}const re=[{value:D.AbsAmount,label:"Abs Amount"},{value:D.Amount,label:"Amount"},{value:D.Date,label:"Date"}],ce=[{label:"All",value:A.All},{label:"Income",value:A.Income},{label:"Expense",value:A.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext: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}=Q(),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 R(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(Y,{...o,children:e.jsxs("form",{onSubmit:T(V),children:[e.jsxs(Z,{cols:2,children:[e.jsx(h,{name:"byOwners",control:r,defaultValue:a.byOwners,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byBusinesses",control:r,defaultValue:a.byBusinesses,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byTags",control:r,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:v,itemComponent:$,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,O)=>O.label?.toLowerCase().includes(l.toLowerCase().trim())||O.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(L,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"toAnyDate",control:r,defaultValue:a.toAnyDate,rules:{pattern:{value:M,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(L,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"chargesType",control:r,defaultValue:a.chargesType,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:ce,value:s.value??A.All,disabled:t,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"sortBy.field",control:r,defaultValue:a.sortBy?.field??D.Date,render:({field:s,fieldState:n})=>e.jsx(P,{...s,data:re,label:"Field to sort by",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,rightSectionProps:{style:{width:"5rem"}},withinPortal:!0,rightSection:e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(x,{defaultChecked:a.sortBy?.asc??!1,checked: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(k,{...s,value:s.value??[],data:ee,disabled:t,label:"Accountant Status",placeholder:"All",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsxs("div",{className:"flex flex-col gap-2 mt-4 rounded-lg border p-3 shadow-sm space-y-2",children:[e.jsx(se,{children:"Missing Information:"}),e.jsx(m,{control:o.control,name:"withoutInvoice",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Invoice"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutInvoice??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutReceipt",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Receipts"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutReceipt??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Documents"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutDocuments??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withOpenDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"With Open Documents"})}),e.jsx(p,{children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(x,{defaultChecked:a.withOpenDocuments??!1,onCheckedChange:s.onChange})}),e.jsx(ne,{children:e.jsx("p",{children:"Show only charges with documents that are currently open"})})]})})]})}),e.jsx(m,{control:o.control,name:"withoutTransactions",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Transactions"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutTransactions??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"unbalanced",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Unbalanced businesses"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.unbalanced??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutLedger",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without ledger"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutLedger??!1,onCheckedChange:s.onChange})})]})})]})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:t||I,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:R,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}=W();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=>{H(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: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(X,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
@@ -1 +1 @@
1
- import{r as t,F as E,u as N,a as P,j as e,T as b,B as w,P as z,b as T,c as W,L as O,C as k,e as B,f as R,g as V,E as A,I as Q,M as U,h as q}from"./index-BsGG-RLV.js";import{C as J}from"./charges-filters-DkO9FBdC.js";import{M as $}from"./index-BTiGhl3N.js";import{P as G}from"./Progress-DxcT-wYo.js";import"./sub-DKnwnbwx.js";import"./subMonths-B44KizJf.js";import"./Checkbox-Bm30-WRa.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-iLt1WIM9.js";import{C as J}from"./charges-filters-DaVBQ_jS.js";import{M as $}from"./index-DfYVR_1G.js";import{P as G}from"./Progress-CSjfE5bV.js";import"./sub-3l-gAINS.js";import"./subMonths-LVothVpu.js";import"./Checkbox-iZ--iyJF.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,4 +1,4 @@
1
- import{fb as on,e2 as te,r as N,ak as V,aj as A,fc as Y,j as ie,y as We}from"./index-BsGG-RLV.js";import{c as ae,a as _y,x as Ne,t as ri,y as _s,z as mn,A as wy,B as gn,C as lb,D as fb,E as Sy,F as ws,G as ni,H as pb,I as Rc,J as qc,K as Nc,L as Zr,M as ii,N as db,O as hb,P as vb,Q as yb,n as Ss,R as mb,l as Ps,m as gb,o as bb,q as mr,p as Ob,s as xb,S as _b,T as wb,U as Sb,V as Pb,k as Ab,W as Eb,i as jb,j as Tb,u as Cb,X as $b,h as Ib,d as Mb,e as Rb,f as qb,b as Nb,g as kb}from"./sequential-CAnleQny.js";var Ii,xl;function Oe(){if(xl)return Ii;xl=1;var t=Array.isArray;return Ii=t,Ii}var Mi,_l;function Py(){if(_l)return Mi;_l=1;var t=typeof on=="object"&&on&&on.Object===Object&&on;return Mi=t,Mi}var Ri,wl;function Fe(){if(wl)return Ri;wl=1;var t=Py(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Ri=r,Ri}var qi,Sl;function Jr(){if(Sl)return qi;Sl=1;var t=Fe(),e=t.Symbol;return qi=e,qi}var Ni,Pl;function Db(){if(Pl)return Ni;Pl=1;var t=Jr(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var l=n.call(o);return c&&(u?o[i]=s:delete o[i]),l}return Ni=a,Ni}var ki,Al;function Bb(){if(Al)return ki;Al=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return ki=r,ki}var Di,El;function Xe(){if(El)return Di;El=1;var t=Jr(),e=Db(),r=Bb(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?e(u):r(u)}return Di=o,Di}var Bi,jl;function Ve(){if(jl)return Bi;jl=1;function t(e){return e!=null&&typeof e=="object"}return Bi=t,Bi}var Li,Tl;function Zt(){if(Tl)return Li;Tl=1;var t=Xe(),e=Ve(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Li=n,Li}var Fi,Cl;function kc(){if(Cl)return Fi;Cl=1;var t=Oe(),e=Zt(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(t(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Fi=i,Fi}var zi,$l;function et(){if($l)return zi;$l=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return zi=t,zi}var Wi,Il;function Dc(){if(Il)return Wi;Il=1;var t=Xe(),e=et(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!e(u))return!1;var s=t(u);return s==n||s==i||s==r||s==a}return Wi=o,Wi}var Gi,Ml;function Lb(){if(Ml)return Gi;Ml=1;var t=Fe(),e=t["__core-js_shared__"];return Gi=e,Gi}var Ki,Rl;function Fb(){if(Rl)return Ki;Rl=1;var t=Lb(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return Ki=r,Ki}var Hi,ql;function Ay(){if(ql)return Hi;ql=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Hi=r,Hi}var Ui,Nl;function zb(){if(Nl)return Ui;Nl=1;var t=Dc(),e=Fb(),r=et(),n=Ay(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,l=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(p){if(!r(p)||e(p))return!1;var h=t(p)?l:a;return h.test(n(p))}return Ui=f,Ui}var Xi,kl;function Wb(){if(kl)return Xi;kl=1;function t(e,r){return e?.[r]}return Xi=t,Xi}var Vi,Dl;function Ot(){if(Dl)return Vi;Dl=1;var t=zb(),e=Wb();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return Vi=r,Vi}var Yi,Bl;function ai(){if(Bl)return Yi;Bl=1;var t=Ot(),e=t(Object,"create");return Yi=e,Yi}var Zi,Ll;function Gb(){if(Ll)return Zi;Ll=1;var t=ai();function e(){this.__data__=t?t(null):{},this.size=0}return Zi=e,Zi}var Ji,Fl;function Kb(){if(Fl)return Ji;Fl=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Ji=t,Ji}var Qi,zl;function Hb(){if(zl)return Qi;zl=1;var t=ai(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(t){var u=o[a];return u===e?void 0:u}return n.call(o,a)?o[a]:void 0}return Qi=i,Qi}var ea,Wl;function Ub(){if(Wl)return ea;Wl=1;var t=ai(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return ea=n,ea}var ta,Gl;function Xb(){if(Gl)return ta;Gl=1;var t=ai(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return ta=r,ta}var ra,Kl;function Vb(){if(Kl)return ra;Kl=1;var t=Gb(),e=Kb(),r=Hb(),n=Ub(),i=Xb();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ra=a,ra}var na,Hl;function Yb(){if(Hl)return na;Hl=1;function t(){this.__data__=[],this.size=0}return na=t,na}var ia,Ul;function Bc(){if(Ul)return ia;Ul=1;function t(e,r){return e===r||e!==e&&r!==r}return ia=t,ia}var aa,Xl;function oi(){if(Xl)return aa;Xl=1;var t=Bc();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return aa=e,aa}var oa,Vl;function Zb(){if(Vl)return oa;Vl=1;var t=oi(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,o=t(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return oa=n,oa}var ua,Yl;function Jb(){if(Yl)return ua;Yl=1;var t=oi();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return ua=e,ua}var sa,Zl;function Qb(){if(Zl)return sa;Zl=1;var t=oi();function e(r){return t(this.__data__,r)>-1}return sa=e,sa}var ca,Jl;function e0(){if(Jl)return ca;Jl=1;var t=oi();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return ca=e,ca}var la,Ql;function ui(){if(Ql)return la;Ql=1;var t=Yb(),e=Zb(),r=Jb(),n=Qb(),i=e0();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,la=a,la}var fa,ef;function Lc(){if(ef)return fa;ef=1;var t=Ot(),e=Fe(),r=t(e,"Map");return fa=r,fa}var pa,tf;function t0(){if(tf)return pa;tf=1;var t=Vb(),e=ui(),r=Lc();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return pa=n,pa}var da,rf;function r0(){if(rf)return da;rf=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return da=t,da}var ha,nf;function si(){if(nf)return ha;nf=1;var t=r0();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return ha=e,ha}var va,af;function n0(){if(af)return va;af=1;var t=si();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return va=e,va}var ya,of;function i0(){if(of)return ya;of=1;var t=si();function e(r){return t(this,r).get(r)}return ya=e,ya}var ma,uf;function a0(){if(uf)return ma;uf=1;var t=si();function e(r){return t(this,r).has(r)}return ma=e,ma}var ga,sf;function o0(){if(sf)return ga;sf=1;var t=si();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return ga=e,ga}var ba,cf;function Fc(){if(cf)return ba;cf=1;var t=t0(),e=n0(),r=i0(),n=a0(),i=o0();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ba=a,ba}var Oa,lf;function Ey(){if(lf)return Oa;lf=1;var t=Fc(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||t),a}return r.Cache=t,Oa=r,Oa}var xa,ff;function u0(){if(ff)return xa;ff=1;var t=Ey(),e=500;function r(n){var i=t(n,function(o){return a.size===e&&a.clear(),o}),a=i.cache;return i}return xa=r,xa}var _a,pf;function s0(){if(pf)return _a;pf=1;var t=u0(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return _a=n,_a}var wa,df;function zc(){if(df)return wa;df=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return wa=t,wa}var Sa,hf;function c0(){if(hf)return Sa;hf=1;var t=Jr(),e=zc(),r=Oe(),n=Zt(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return e(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return Sa=o,Sa}var Pa,vf;function jy(){if(vf)return Pa;vf=1;var t=c0();function e(r){return r==null?"":t(r)}return Pa=e,Pa}var Aa,yf;function Ty(){if(yf)return Aa;yf=1;var t=Oe(),e=kc(),r=s0(),n=jy();function i(a,o){return t(a)?a:e(a,o)?[a]:r(n(a))}return Aa=i,Aa}var Ea,mf;function ci(){if(mf)return Ea;mf=1;var t=Zt();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Ea=e,Ea}var ja,gf;function Wc(){if(gf)return ja;gf=1;var t=Ty(),e=ci();function r(n,i){i=t(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[e(i[a++])];return a&&a==o?n:void 0}return ja=r,ja}var Ta,bf;function Cy(){if(bf)return Ta;bf=1;var t=Wc();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return Ta=e,Ta}var l0=Cy();const je=te(l0);var Ca,Of;function f0(){if(Of)return Ca;Of=1;function t(e){return e==null}return Ca=t,Ca}var p0=f0();const U=te(p0);var $a,xf;function d0(){if(xf)return $a;xf=1;var t=Xe(),e=Oe(),r=Ve(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return $a=i,$a}var h0=d0();const vt=te(h0);var v0=Dc();const H=te(v0);var y0=et();const Jt=te(y0);var Ia={exports:{}},Z={};/**
1
+ import{fb as on,e2 as te,r as N,ak as V,aj as A,fc as Y,j as ie,y as We}from"./index-iLt1WIM9.js";import{c as ae,a as _y,x as Ne,t as ri,y as _s,z as mn,A as wy,B as gn,C as lb,D as fb,E as Sy,F as ws,G as ni,H as pb,I as Rc,J as qc,K as Nc,L as Zr,M as ii,N as db,O as hb,P as vb,Q as yb,n as Ss,R as mb,l as Ps,m as gb,o as bb,q as mr,p as Ob,s as xb,S as _b,T as wb,U as Sb,V as Pb,k as Ab,W as Eb,i as jb,j as Tb,u as Cb,X as $b,h as Ib,d as Mb,e as Rb,f as qb,b as Nb,g as kb}from"./sequential-CAnleQny.js";var Ii,xl;function Oe(){if(xl)return Ii;xl=1;var t=Array.isArray;return Ii=t,Ii}var Mi,_l;function Py(){if(_l)return Mi;_l=1;var t=typeof on=="object"&&on&&on.Object===Object&&on;return Mi=t,Mi}var Ri,wl;function Fe(){if(wl)return Ri;wl=1;var t=Py(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Ri=r,Ri}var qi,Sl;function Jr(){if(Sl)return qi;Sl=1;var t=Fe(),e=t.Symbol;return qi=e,qi}var Ni,Pl;function Db(){if(Pl)return Ni;Pl=1;var t=Jr(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(o){var u=r.call(o,i),s=o[i];try{o[i]=void 0;var c=!0}catch{}var l=n.call(o);return c&&(u?o[i]=s:delete o[i]),l}return Ni=a,Ni}var ki,Al;function Bb(){if(Al)return ki;Al=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return ki=r,ki}var Di,El;function Xe(){if(El)return Di;El=1;var t=Jr(),e=Db(),r=Bb(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?e(u):r(u)}return Di=o,Di}var Bi,jl;function Ve(){if(jl)return Bi;jl=1;function t(e){return e!=null&&typeof e=="object"}return Bi=t,Bi}var Li,Tl;function Zt(){if(Tl)return Li;Tl=1;var t=Xe(),e=Ve(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Li=n,Li}var Fi,Cl;function kc(){if(Cl)return Fi;Cl=1;var t=Oe(),e=Zt(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(t(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Fi=i,Fi}var zi,$l;function et(){if($l)return zi;$l=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return zi=t,zi}var Wi,Il;function Dc(){if(Il)return Wi;Il=1;var t=Xe(),e=et(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!e(u))return!1;var s=t(u);return s==n||s==i||s==r||s==a}return Wi=o,Wi}var Gi,Ml;function Lb(){if(Ml)return Gi;Ml=1;var t=Fe(),e=t["__core-js_shared__"];return Gi=e,Gi}var Ki,Rl;function Fb(){if(Rl)return Ki;Rl=1;var t=Lb(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return Ki=r,Ki}var Hi,ql;function Ay(){if(ql)return Hi;ql=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Hi=r,Hi}var Ui,Nl;function zb(){if(Nl)return Ui;Nl=1;var t=Dc(),e=Fb(),r=et(),n=Ay(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,s=o.toString,c=u.hasOwnProperty,l=RegExp("^"+s.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(p){if(!r(p)||e(p))return!1;var h=t(p)?l:a;return h.test(n(p))}return Ui=f,Ui}var Xi,kl;function Wb(){if(kl)return Xi;kl=1;function t(e,r){return e?.[r]}return Xi=t,Xi}var Vi,Dl;function Ot(){if(Dl)return Vi;Dl=1;var t=zb(),e=Wb();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return Vi=r,Vi}var Yi,Bl;function ai(){if(Bl)return Yi;Bl=1;var t=Ot(),e=t(Object,"create");return Yi=e,Yi}var Zi,Ll;function Gb(){if(Ll)return Zi;Ll=1;var t=ai();function e(){this.__data__=t?t(null):{},this.size=0}return Zi=e,Zi}var Ji,Fl;function Kb(){if(Fl)return Ji;Fl=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Ji=t,Ji}var Qi,zl;function Hb(){if(zl)return Qi;zl=1;var t=ai(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(t){var u=o[a];return u===e?void 0:u}return n.call(o,a)?o[a]:void 0}return Qi=i,Qi}var ea,Wl;function Ub(){if(Wl)return ea;Wl=1;var t=ai(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return ea=n,ea}var ta,Gl;function Xb(){if(Gl)return ta;Gl=1;var t=ai(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return ta=r,ta}var ra,Kl;function Vb(){if(Kl)return ra;Kl=1;var t=Gb(),e=Kb(),r=Hb(),n=Ub(),i=Xb();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ra=a,ra}var na,Hl;function Yb(){if(Hl)return na;Hl=1;function t(){this.__data__=[],this.size=0}return na=t,na}var ia,Ul;function Bc(){if(Ul)return ia;Ul=1;function t(e,r){return e===r||e!==e&&r!==r}return ia=t,ia}var aa,Xl;function oi(){if(Xl)return aa;Xl=1;var t=Bc();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return aa=e,aa}var oa,Vl;function Zb(){if(Vl)return oa;Vl=1;var t=oi(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,o=t(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return oa=n,oa}var ua,Yl;function Jb(){if(Yl)return ua;Yl=1;var t=oi();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return ua=e,ua}var sa,Zl;function Qb(){if(Zl)return sa;Zl=1;var t=oi();function e(r){return t(this.__data__,r)>-1}return sa=e,sa}var ca,Jl;function e0(){if(Jl)return ca;Jl=1;var t=oi();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return ca=e,ca}var la,Ql;function ui(){if(Ql)return la;Ql=1;var t=Yb(),e=Zb(),r=Jb(),n=Qb(),i=e0();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,la=a,la}var fa,ef;function Lc(){if(ef)return fa;ef=1;var t=Ot(),e=Fe(),r=t(e,"Map");return fa=r,fa}var pa,tf;function t0(){if(tf)return pa;tf=1;var t=Vb(),e=ui(),r=Lc();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return pa=n,pa}var da,rf;function r0(){if(rf)return da;rf=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return da=t,da}var ha,nf;function si(){if(nf)return ha;nf=1;var t=r0();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return ha=e,ha}var va,af;function n0(){if(af)return va;af=1;var t=si();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return va=e,va}var ya,of;function i0(){if(of)return ya;of=1;var t=si();function e(r){return t(this,r).get(r)}return ya=e,ya}var ma,uf;function a0(){if(uf)return ma;uf=1;var t=si();function e(r){return t(this,r).has(r)}return ma=e,ma}var ga,sf;function o0(){if(sf)return ga;sf=1;var t=si();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return ga=e,ga}var ba,cf;function Fc(){if(cf)return ba;cf=1;var t=t0(),e=n0(),r=i0(),n=a0(),i=o0();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u<s;){var c=o[u];this.set(c[0],c[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ba=a,ba}var Oa,lf;function Ey(){if(lf)return Oa;lf=1;var t=Fc(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],s=a.cache;if(s.has(u))return s.get(u);var c=n.apply(this,o);return a.cache=s.set(u,c)||s,c};return a.cache=new(r.Cache||t),a}return r.Cache=t,Oa=r,Oa}var xa,ff;function u0(){if(ff)return xa;ff=1;var t=Ey(),e=500;function r(n){var i=t(n,function(o){return a.size===e&&a.clear(),o}),a=i.cache;return i}return xa=r,xa}var _a,pf;function s0(){if(pf)return _a;pf=1;var t=u0(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(o,u,s,c){a.push(s?c.replace(r,"$1"):u||o)}),a});return _a=n,_a}var wa,df;function zc(){if(df)return wa;df=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return wa=t,wa}var Sa,hf;function c0(){if(hf)return Sa;hf=1;var t=Jr(),e=zc(),r=Oe(),n=Zt(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return e(u,o)+"";if(n(u))return a?a.call(u):"";var s=u+"";return s=="0"&&1/u==-1/0?"-0":s}return Sa=o,Sa}var Pa,vf;function jy(){if(vf)return Pa;vf=1;var t=c0();function e(r){return r==null?"":t(r)}return Pa=e,Pa}var Aa,yf;function Ty(){if(yf)return Aa;yf=1;var t=Oe(),e=kc(),r=s0(),n=jy();function i(a,o){return t(a)?a:e(a,o)?[a]:r(n(a))}return Aa=i,Aa}var Ea,mf;function ci(){if(mf)return Ea;mf=1;var t=Zt();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Ea=e,Ea}var ja,gf;function Wc(){if(gf)return ja;gf=1;var t=Ty(),e=ci();function r(n,i){i=t(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[e(i[a++])];return a&&a==o?n:void 0}return ja=r,ja}var Ta,bf;function Cy(){if(bf)return Ta;bf=1;var t=Wc();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return Ta=e,Ta}var l0=Cy();const je=te(l0);var Ca,Of;function f0(){if(Of)return Ca;Of=1;function t(e){return e==null}return Ca=t,Ca}var p0=f0();const U=te(p0);var $a,xf;function d0(){if(xf)return $a;xf=1;var t=Xe(),e=Oe(),r=Ve(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return $a=i,$a}var h0=d0();const vt=te(h0);var v0=Dc();const H=te(v0);var y0=et();const Jt=te(y0);var Ia={exports:{}},Z={};/**
2
2
  * @license React
3
3
  * react-is.production.min.js
4
4
  *
@@ -1,4 +1,4 @@
1
- import{V as t,j as e,aw as i,ax as c,ay as o,az as l,aA as r,B as n,g4 as x,g5 as d}from"./index-BsGG-RLV.js";/**
1
+ import{V as t,j as e,aw as i,ax as c,ay as o,az as l,aA as r,B as n,g4 as x,g5 as d}from"./index-iLt1WIM9.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{V as Te,bH as Xe,bI as Je,r as x,bJ as es,bK as ae,aj as ss,bL as ts,bM as ns,bN as rs,j as e,B as b,L as Se,p as B,bO as is,t as j,s as N,bP as Fe,a as re,bQ as je,bR as y,bS as Y,bT as oe,bU as Me,bV as ze,U as as,bW as W,bX as q,Y as F,b1 as Pe,bY as $e,x as U,T as w,aq as K,k as S,z as C,l as I,a4 as M,a5 as z,a6 as X,a7 as P,Q as J,a9 as R,aQ as Oe,bZ as Q,e as Z,b_ as os,b$ as cs,c0 as ds,c1 as ne,c2 as D,c3 as ls,c4 as ke,c5 as Re,D as A,c6 as Ce,c7 as He,c8 as us,c9 as me,ca as ee,g as se,cb as hs,cc as xs,R as te,cd as ps,ce as ms,cf as _e,cg as gs,ch as js,ci as fs,cj as Ve,ck as Ue,cl as vs,cm as bs,cn as ys,co as Ts,cp as Le,cq as Cs,cr as Es,cs as As,aK as fe,ct as ws,cu as Ds,cv as Bs,cw as Ns,cx as Is,cy as Ss,cz as Fs,cA as Ms,cB as zs,cC as Ps,cD as $s,cE as Os,cF as ks,cG as Rs,cH as Hs,cI as _s,cJ as Vs,u as Us,cK as Ls,cL as Ws,cM as qs,cN as Ys,cO as Ks,cP as Qs,cQ as Zs,cR as Gs,cS as Xs,cT as Js,cU as et,cV as st,cW as ye,cX as tt,cY as nt,cZ as rt,bB as T,c_ as it}from"./index-BsGG-RLV.js";/**
1
+ import{V as Te,bH as Xe,bI as Je,r as x,bJ as es,bK as ae,aj as ss,bL as ts,bM as ns,bN as rs,j as e,B as b,L as Se,p as B,bO as is,t as j,s as N,bP as Fe,a as re,bQ as je,bR as y,bS as Y,bT as oe,bU as Me,bV as ze,U as as,bW as W,bX as q,Y as F,b1 as Pe,bY as $e,x as U,T as w,aq as K,k as S,z as C,l as I,a4 as M,a5 as z,a6 as X,a7 as P,Q as J,a9 as R,aQ as Oe,bZ as Q,e as Z,b_ as os,b$ as cs,c0 as ds,c1 as ne,c2 as D,c3 as ls,c4 as ke,c5 as Re,D as A,c6 as Ce,c7 as He,c8 as us,c9 as me,ca as ee,g as se,cb as hs,cc as xs,R as te,cd as ps,ce as ms,cf as _e,cg as gs,ch as js,ci as fs,cj as Ve,ck as Ue,cl as vs,cm as bs,cn as ys,co as Ts,cp as Le,cq as Cs,cr as Es,cs as As,aK as fe,ct as ws,cu as Ds,cv as Bs,cw as Ns,cx as Is,cy as Ss,cz as Fs,cA as Ms,cB as zs,cC as Ps,cD as $s,cE as Os,cF as ks,cG as Rs,cH as Hs,cI as _s,cJ as Vs,u as Us,cK as Ls,cL as Ws,cM as qs,cN as Ys,cO as Ks,cP as Qs,cQ as Zs,cR as Gs,cS as Xs,cT as Js,cU as et,cV as st,cW as ye,cX as tt,cY as nt,cZ as rt,bB as T,c_ as it}from"./index-iLt1WIM9.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{V as U,r as b,cf as z,j as e,ao as Q,ap as W,B as g,d2 as R,ar as G,as as X,at as Z,bf as T,aO as J,b5 as A,aw as O,ax as k,ay as E,az as M,aA as D,cV as K,D as j,bn as w,eS as I,eT as ee,eU as S,eV as se,eW as L,eX as B,eY as P,eZ as N,e_ as p,e$ as V,f0 as $,dQ as re,f1 as te,bi as ae,bj as le,bk as v,f2 as Y,F as de,a as ne,$ as oe,a0 as ce,a3 as ie,f3 as ue}from"./index-BsGG-RLV.js";import{B as me,S as xe}from"./save-Dr3CNkcl.js";/**
1
+ import{V as U,r as b,cf as z,j as e,ao as Q,ap as W,B as g,d2 as R,ar as G,as as X,at as Z,bf as T,aO as J,b5 as A,aw as O,ax as k,ay as E,az as M,aA as D,cV as K,D as j,bn as w,eS as I,eT as ee,eU as S,eV as se,eW as L,eX as B,eY as P,eZ as N,e_ as p,e$ as V,f0 as $,dQ as re,f1 as te,bi as ae,bj as le,bk as v,f2 as Y,F as de,a as ne,$ as oe,a0 as ce,a3 as ie,f3 as ue}from"./index-iLt1WIM9.js";import{B as me,S as xe}from"./save-CMGkGXCM.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{p as f,fR as I,r as u,t as l,s as p,k as b,D as y,j as e,l as C,fA as D,a4 as $,a5 as F,a6 as w,a7 as k,Q as j,a9 as v,fS as E,fT as A,o as S,x as z,T as M,B as T,ca as O,z as L,fU as P,fV as B,F as U,a as q,fW as V,c as _,L as R,bU as Q,bV as G,fX as W}from"./index-BsGG-RLV.js";const X="updateTag",H=()=>{const[{fetching:d},r]=f(I),c=u.useCallback(async a=>{const t=`Error updating tag ID [${a.tagId}]`,s=`${X}-${a.tagId}`;l.loading("Updating Tag...",{id:s});try{const n=await r(a),i=p(n,t,s,"updateTag");if(i)return l.success("Success",{id:s,description:"Tag updated"}),i.updateTag}catch(n){console.error(`${t}: ${n}`),l.error("Error",{id:s,description:t,duration:1e5,closeButton:!0})}return!1},[r]);return{fetching:d,updateTag:c}},J=({onDone:d,data:r,close:c})=>{const{updateTag:a,fetching:t}=H(),s=y(A,r),n=b({defaultValues:{name:s.name,parentId:s.parent?.id}}),{control:i,handleSubmit:m,formState:{dirtyFields:h}}=n,x=o=>{const g=S(o,h);c(),g&&Object.keys(g).length>0&&a({tagId:s.id,fields:g}).then(()=>d?.())};return e.jsx(C,{...n,children:e.jsxs("form",{onSubmit:m(x),children:[e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsxs(D,{cols:3,children:[e.jsx($,{name:"name",control:i,defaultValue:s.name,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o})=>e.jsxs(F,{children:[e.jsx(w,{children:"Name"}),e.jsx(k,{children:e.jsx(j,{...o,value:o.value??void 0})}),e.jsx(v,{})]})}),e.jsx(E,{formManager:n,tagsPath:"parentId",label:"Parent Tag"})]})}),e.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[e.jsx("button",{type:"submit",onClick:()=>m(x),className:"mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",disabled:t||Object.keys(h).length===0,children:"Accept"}),e.jsx("button",{type:"button",className:"mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:c,children:"Cancel"})]})]})})},K=({onDone:d,data:r})=>{const[c,{open:a,close:t}]=z(!1);function s(){t(),d?.()}return e.jsxs(e.Fragment,{children:[e.jsx(M,{label:"Edit Tag",children:e.jsx(T,{variant:"ghost",size:"icon",className:"size-7.5",onClick:a,children:e.jsx(O,{className:"size-5"})})}),e.jsx(L,{centered:!0,opened:c,onClose:t,title:"Insert Business Trip",children:e.jsx(J,{close:t,onDone:s,data:r})})]})},Y="addTag",Z=()=>{const[{fetching:d},r]=f(P),c=u.useCallback(async a=>{const t=`Error adding new tag [${a.tagName}]`,s=`${Y}-${a.tagName}`;l.loading("Adding tag",{id:s});try{const n=await r(a);p(n,t,s)&&l.success("Success",{id:s,description:`"${a.tagName}" tag was successfully added`})}catch(n){console.error(`${t}: ${n}`),l.error("Error",{id:s,description:t,duration:1e5,closeButton:!0})}},[r]);return{fetching:d,addTag:c}},ee="deleteTag",se=()=>{const[{fetching:d},r]=f(B),c=u.useCallback(async a=>{const t=`Error deleting new tag [${a.name}]`,s=`${ee}-${a.tagId}`;l.loading(`Deleting tag [${a.name}]`,{id:s});try{const n=await r(a);p(n,t,s)&&l.success("Tag Deleted",{id:s,description:`[${a.name}] tag was successfully removed`})}catch(n){console.error(`${t}: ${n}`),l.error("Error",{id:s,description:t,duration:1e5,closeButton:!0})}},[r]);return{fetching:d,deleteTag:c}},te=()=>{const{setFiltersContext:d}=u.useContext(U),[r,c]=u.useState(""),[{data:a,fetching:t},s]=q({query:W}),{addTag:n}=Z(),{deleteTag:i}=se();d(null);const m=V(a?.allTags??[]),h=u.useCallback(o=>{o.length>2&&n({tagName:o}).then(()=>{s()})},[n,s]),x=u.useCallback((o,g)=>{i({tagId:o,name:g}).then(()=>{s()})},[i,s]);return e.jsx(_,{title:"Tags",description:"Manage tags for your bookmarks.",children:t?e.jsx(R,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[m?.map(o=>e.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-2",children:[e.jsxs("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:[o.namePath?.map((g,N)=>e.jsx("span",{className:"ms-2"},N)),o.name]}),e.jsx(K,{data:o}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>x(o.id,o.name),children:e.jsx(Q,{className:"size-5"})})]},o.id)),e.jsxs("div",{className:"flex justify-start items-center gap-2 text-gray-600 mb-2",children:[e.jsx(j,{className:"w-80",value:r,onChange:o=>c(o.currentTarget.value),placeholder:"Add new tag",required:!0}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-7.5",disabled:r.length<2,onClick:()=>h(r),children:e.jsx(G,{className:"size-5"})})]})]})})};export{te as TagsManager};
1
+ import{p as f,fR as I,r as u,t as l,s as p,k as b,D as y,j as e,l as C,fA as D,a4 as $,a5 as F,a6 as w,a7 as k,Q as j,a9 as v,fS as E,fT as A,o as S,x as z,T as M,B as T,ca as O,z as L,fU as P,fV as B,F as U,a as q,fW as V,c as _,L as R,bU as Q,bV as G,fX as W}from"./index-iLt1WIM9.js";const X="updateTag",H=()=>{const[{fetching:d},r]=f(I),c=u.useCallback(async a=>{const t=`Error updating tag ID [${a.tagId}]`,s=`${X}-${a.tagId}`;l.loading("Updating Tag...",{id:s});try{const n=await r(a),i=p(n,t,s,"updateTag");if(i)return l.success("Success",{id:s,description:"Tag updated"}),i.updateTag}catch(n){console.error(`${t}: ${n}`),l.error("Error",{id:s,description:t,duration:1e5,closeButton:!0})}return!1},[r]);return{fetching:d,updateTag:c}},J=({onDone:d,data:r,close:c})=>{const{updateTag:a,fetching:t}=H(),s=y(A,r),n=b({defaultValues:{name:s.name,parentId:s.parent?.id}}),{control:i,handleSubmit:m,formState:{dirtyFields:h}}=n,x=o=>{const g=S(o,h);c(),g&&Object.keys(g).length>0&&a({tagId:s.id,fields:g}).then(()=>d?.())};return e.jsx(C,{...n,children:e.jsxs("form",{onSubmit:m(x),children:[e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsxs(D,{cols:3,children:[e.jsx($,{name:"name",control:i,defaultValue:s.name,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o})=>e.jsxs(F,{children:[e.jsx(w,{children:"Name"}),e.jsx(k,{children:e.jsx(j,{...o,value:o.value??void 0})}),e.jsx(v,{})]})}),e.jsx(E,{formManager:n,tagsPath:"parentId",label:"Parent Tag"})]})}),e.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[e.jsx("button",{type:"submit",onClick:()=>m(x),className:"mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",disabled:t||Object.keys(h).length===0,children:"Accept"}),e.jsx("button",{type:"button",className:"mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:c,children:"Cancel"})]})]})})},K=({onDone:d,data:r})=>{const[c,{open:a,close:t}]=z(!1);function s(){t(),d?.()}return e.jsxs(e.Fragment,{children:[e.jsx(M,{label:"Edit Tag",children:e.jsx(T,{variant:"ghost",size:"icon",className:"size-7.5",onClick:a,children:e.jsx(O,{className:"size-5"})})}),e.jsx(L,{centered:!0,opened:c,onClose:t,title:"Insert Business Trip",children:e.jsx(J,{close:t,onDone:s,data:r})})]})},Y="addTag",Z=()=>{const[{fetching:d},r]=f(P),c=u.useCallback(async a=>{const t=`Error adding new tag [${a.tagName}]`,s=`${Y}-${a.tagName}`;l.loading("Adding tag",{id:s});try{const n=await r(a);p(n,t,s)&&l.success("Success",{id:s,description:`"${a.tagName}" tag was successfully added`})}catch(n){console.error(`${t}: ${n}`),l.error("Error",{id:s,description:t,duration:1e5,closeButton:!0})}},[r]);return{fetching:d,addTag:c}},ee="deleteTag",se=()=>{const[{fetching:d},r]=f(B),c=u.useCallback(async a=>{const t=`Error deleting new tag [${a.name}]`,s=`${ee}-${a.tagId}`;l.loading(`Deleting tag [${a.name}]`,{id:s});try{const n=await r(a);p(n,t,s)&&l.success("Tag Deleted",{id:s,description:`[${a.name}] tag was successfully removed`})}catch(n){console.error(`${t}: ${n}`),l.error("Error",{id:s,description:t,duration:1e5,closeButton:!0})}},[r]);return{fetching:d,deleteTag:c}},te=()=>{const{setFiltersContext:d}=u.useContext(U),[r,c]=u.useState(""),[{data:a,fetching:t},s]=q({query:W}),{addTag:n}=Z(),{deleteTag:i}=se();d(null);const m=V(a?.allTags??[]),h=u.useCallback(o=>{o.length>2&&n({tagName:o}).then(()=>{s()})},[n,s]),x=u.useCallback((o,g)=>{i({tagId:o,name:g}).then(()=>{s()})},[i,s]);return e.jsx(_,{title:"Tags",description:"Manage tags for your bookmarks.",children:t?e.jsx(R,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[m?.map(o=>e.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-2",children:[e.jsxs("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:[o.namePath?.map((g,N)=>e.jsx("span",{className:"ms-2"},N)),o.name]}),e.jsx(K,{data:o}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>x(o.id,o.name),children:e.jsx(Q,{className:"size-5"})})]},o.id)),e.jsxs("div",{className:"flex justify-start items-center gap-2 text-gray-600 mb-2",children:[e.jsx(j,{className:"w-80",value:r,onChange:o=>c(o.currentTarget.value),placeholder:"Add new tag",required:!0}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-7.5",disabled:r.length<2,onClick:()=>h(r),children:e.jsx(G,{className:"size-5"})})]})]})})};export{te as TagsManager};
@@ -1,4 +1,4 @@
1
- import{V as it,r as m,da as Nc,aj as V,df as kc,ak as ae,j as v,dd as vn,dZ as It,d_ as ge,d$ as Ho,dg as Lc,e0 as Vc,e1 as rn,e2 as jc,d0 as rr,u as Wo,ao as zr,ap as $r,bC as Fc,B as ee,d2 as Bc,ar as Ur,as as Hr,at as Wr,k as Go,cf as _c,U as zc,bR as An,cj as $c,bW as Bi,bX as _i,Y as sn,aK as Ko,bf as qo,d3 as Uc,p as Xo,e3 as Hc,t as Pe,s as Yo,cP as yn,a as ir,e4 as Wc,dm as Gc,e5 as Kc,dC as qc,dD as Xc,dE as Yc,L as Zo,Q as Gr,dq as Zc,dr as Jc,ds as Nn,dt as Qc,du as zi,dv as eu,dw as $i,dx as Jo,dy as Qo,dz as ea,e6 as tu,e7 as nu,e8 as on,e9 as ru,_ as iu,ac as su,l as ou,a4 as au,a5 as lu,a6 as cu,a7 as uu,a9 as du,aC as hu,ad as Ui,dU as fu,ea as pu,g as gu,av as mu,af as Hi,eb as vu,ec as yu,ed as Wi,c5 as bu,P as Tu,b as xu,bg as Su,b1 as wu,F as Du,aM as Cu,ee as Eu,ef as Ou}from"./index-BsGG-RLV.js";import{A as Gi}from"./arrow-up-down-Bt3_puEZ.js";import{_ as Pu,a as bn,s as we,g as Kr,u as Ki,c as qr,m as wt,d as sr,T as or}from"./Typography-CZLHs9y2.js";import{P as Mu}from"./pencil-DC6M9VTY.js";/**
1
+ import{V as it,r as m,da as Nc,aj as V,df as kc,ak as ae,j as v,dd as vn,dZ as It,d_ as ge,d$ as Ho,dg as Lc,e0 as Vc,e1 as rn,e2 as jc,d0 as rr,u as Wo,ao as zr,ap as $r,bC as Fc,B as ee,d2 as Bc,ar as Ur,as as Hr,at as Wr,k as Go,cf as _c,U as zc,bR as An,cj as $c,bW as Bi,bX as _i,Y as sn,aK as Ko,bf as qo,d3 as Uc,p as Xo,e3 as Hc,t as Pe,s as Yo,cP as yn,a as ir,e4 as Wc,dm as Gc,e5 as Kc,dC as qc,dD as Xc,dE as Yc,L as Zo,Q as Gr,dq as Zc,dr as Jc,ds as Nn,dt as Qc,du as zi,dv as eu,dw as $i,dx as Jo,dy as Qo,dz as ea,e6 as tu,e7 as nu,e8 as on,e9 as ru,_ as iu,ac as su,l as ou,a4 as au,a5 as lu,a6 as cu,a7 as uu,a9 as du,aC as hu,ad as Ui,dU as fu,ea as pu,g as gu,av as mu,af as Hi,eb as vu,ec as yu,ed as Wi,c5 as bu,P as Tu,b as xu,bg as Su,b1 as wu,F as Du,aM as Cu,ee as Eu,ef as Ou}from"./index-iLt1WIM9.js";import{A as Gi}from"./arrow-up-down-BS_znu7y.js";import{_ as Pu,a as bn,s as we,g as Kr,u as Ki,c as qr,m as wt,d as sr,T as or}from"./Typography-D14P1nN1.js";import{P as Mu}from"./pencil-1-tPx_Bq.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{p as v,fY as B,r as u,t as m,s as F,aM as H,j as e,a4 as C,a5 as j,a6 as f,a7 as p,Q as L,a8 as y,a9 as S,bR as K,bS as Q,aQ as V,aK as _,ao as D,ap as E,B as h,ar as M,as as R,at as A,k,l as $,fZ as z,ca as G,a as O,f_ as Y,L as P,F as Z,dm as J,c as W,dq as X,dr as ee,ds as T,dt as se,du as b,dv as te,dw as w,f$ as ae,dC as re,dD as oe,dE as ne}from"./index-BsGG-RLV.js";import{D as ie}from"./data-table-pagination-CQQBbtVE.js";import{A as N}from"./arrow-up-down-Bt3_puEZ.js";const de="insertTaxCategory",ce=()=>{const[{fetching:s},n]=v(B),t=u.useCallback(async a=>{const d="Error creating tax category",r=de;m.loading("Adding Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r);if(l)return m.success("Success",{id:r,description:`${l.insertTaxCategory.name} was created`}),l.insertTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertTaxCategory:t}};function q({formManager:s,setFetching:n,isInsert:t}){const{control:a,watch:d,setValue:r}=s,{selectableSortCodes:i,fetching:l,sortCodes:x}=H();u.useEffect(()=>{n(l)},[n,l]);const c=d("sortCode");return u.useEffect(()=>{if(c){const o=x.find(g=>g.key===c);o?.defaultIrsCode&&r("irsCode",o.defaultIrsCode,{shouldDirty:!0})}},[c,x,r]),e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"name",control:a,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"Name"}),e.jsx(p,{children:e.jsx(L,{...o,value:o.value??void 0,required:!0,className:t?"":y(g)})}),e.jsx(S,{})]})}),e.jsx(K,{name:"sortCode",control:a,render:({field:o,fieldState:g})=>e.jsx(Q,{...o,onChange:U=>{o.onChange(Number(U))},data:i,value:o.value?.toString(),disabled:l,label:"Sort Code",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,className:t?"":y(g)})}),e.jsx(C,{name:"irsCode",control:a,render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(p,{children:e.jsx(V,{...o,className:t?"":y(g),value:o.value??void 0,hideControls:!0,decimalScale:0})}),e.jsx(S,{})]})}),e.jsx(C,{control:a,name:"taxExcluded",render:({field:o})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(f,{children:"Tax excluded category"})}),e.jsx(p,{children:e.jsx(_,{onCheckedChange:o.onChange,checked:o.value??void 0})})]})})]})}function le({onAdd:s}){const[n,t]=u.useState(!1);return e.jsxs(D,{open:n,onOpenChange:t,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{children:"Add Tax Category"})}),e.jsxs(M,{className:"w-[90vw] max-w-screen-md",children:[e.jsx(R,{children:e.jsx(A,{children:"Add New Tax Category"})}),e.jsx(xe,{close:()=>t(!1),onAdd:s})]})]})}function xe({close:s,onAdd:n}){const t=k({}),{handleSubmit:a}=t,[d,r]=u.useState(!1),{insertTaxCategory:i,fetching:l}=ce(),x=c=>{c.sortCode&&=parseInt(c.sortCode.toString()),i({fields:c}).then(o=>{o?.id&&(n?.(o.id),s())})};return e.jsx($,{...t,children:e.jsxs("form",{onSubmit:a(x),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!0,formManager:t,setFetching:r})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:l||d,children:"Add Tax Category"})})]})})}const ue="updateTaxCategory",ge=()=>{const[{fetching:s},n]=v(z),t=u.useCallback(async a=>{const d="Error updating tax category",r=`${ue}-${a.taxCategoryId}`;m.loading("Uploading Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r,"updateTaxCategory");if(l)return m.success("Success",{id:r,description:`${l.updateTaxCategory.name} was updated`}),l.updateTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateTaxCategory:t}};function me({taxCategoryId:s,onAdd:n}){const[t,a]=u.useState(!1);return e.jsxs(D,{open:t,onOpenChange:a,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{variant:"outline",size:"icon",children:e.jsx(G,{})})}),e.jsxs(M,{className:"w-[400px] max-w-screen-md",children:[e.jsx(R,{children:e.jsx(A,{children:"Edit Tax Category"})}),e.jsx(he,{taxCategoryId:s,close:()=>a(!1),onAdd:n})]})]})}function he({taxCategoryId:s,close:n,onAdd:t}){const[{data:a,fetching:d}]=O({query:Y,variables:{id:s}}),r=a?.taxCategory;return!r&&!d&&m.error("Error",{description:"Couldn'nt find tax category"}),d?e.jsx(P,{className:"h-10 w-10 animate-spin"}):e.jsx(Ce,{taxCategory:r,close:n,onAdd:t})}function Ce({taxCategory:s,close:n,onAdd:t}){const a=k({defaultValues:{sortCode:s.sortCode?.key,name:s.name,irsCode:s.irsCode}}),{handleSubmit:d}=a,[r,i]=u.useState(!1),{updateTaxCategory:l,fetching:x}=ge(),c=o=>{o.sortCode&&=parseInt(o.sortCode.toString()),l({fields:o,taxCategoryId:s.id}).then(g=>{g?.id&&(t?.(g.id),n())})};return e.jsx($,{...a,children:e.jsxs("form",{onSubmit:d(c),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!1,formManager:a,setFetching:i})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:x||r,children:"Update"})})]})})}const je=({data:s})=>e.jsx("td",{children:s.name}),fe=({data:s})=>e.jsx("td",{children:s.sortCode?e.jsxs("span",{children:[s.sortCode?.name," (",s.sortCode?.id,")"]}):"N/A"}),I=[{id:"name",accessorKey:"name",cell:({row:s})=>e.jsx(je,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Name",e.jsx(N,{})]})},{id:"sortCode",accessorKey:"sortCode.key",cell:({row:s})=>e.jsx(fe,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Sort Code",e.jsx(N,{})]})},{id:"edit",cell:({row:s})=>e.jsx(me,{taxCategoryId:s.original.id})}],Se=()=>{const[{data:s,fetching:n,error:t},a]=O({query:ae}),{setFiltersContext:d}=u.useContext(Z),r=s?.taxCategories??[],i=J({data:r,columns:I,getCoreRowModel:ne(),getPaginationRowModel:oe(),getSortedRowModel:re(),initialState:{pagination:{pageSize:30}}}),l=i.getPageOptions();return u.useEffect(()=>{d(e.jsx("div",{className:"flex items-center justify-end gap-10 space-x-2 py-4",children:e.jsx("div",{className:"flex items-center justify-between px-2",children:e.jsx(ie,{table:i})})}))},[d,i,l]),u.useEffect(()=>{t&&m.error("Error",{description:"Error fetching tax categories"})},[t]),e.jsx(W,{title:`Tax Categories (${r.length})`,description:"All tax categories",headerActions:e.jsx(le,{onAdd:()=>a()}),children:n?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(P,{className:"h-10 w-10 animate-spin mr-2"})}):e.jsx("div",{className:"flex flex-col gap-4 rounded-md border",children:e.jsxs(X,{children:[e.jsx(ee,{children:i.getHeaderGroups().map(x=>e.jsx(T,{children:x.headers.map(c=>e.jsx(se,{children:c.isPlaceholder?null:b(c.column.columnDef.header,c.getContext())},c.id))},x.id))}),e.jsx(te,{children:i.getRowModel().rows.length===0?e.jsx(T,{children:e.jsx(w,{colSpan:I.length,className:"text-center py-8",children:"No tax categories found"})}):i.getRowModel().rows.map(x=>e.jsx(T,{children:x.getVisibleCells().map(c=>e.jsx(w,{children:b(c.column.columnDef.cell,c.getContext())},c.id))},x.id))})]})})})};export{Se as TaxCategories};
1
+ import{p as v,fY as B,r as u,t as m,s as F,aM as H,j as e,a4 as C,a5 as j,a6 as f,a7 as p,Q as L,a8 as y,a9 as S,bR as K,bS as Q,aQ as V,aK as _,ao as D,ap as E,B as h,ar as M,as as R,at as A,k,l as $,fZ as z,ca as G,a as O,f_ as Y,L as P,F as Z,dm as J,c as W,dq as X,dr as ee,ds as T,dt as se,du as b,dv as te,dw as w,f$ as ae,dC as re,dD as oe,dE as ne}from"./index-iLt1WIM9.js";import{D as ie}from"./data-table-pagination-P75qqcV4.js";import{A as N}from"./arrow-up-down-BS_znu7y.js";const de="insertTaxCategory",ce=()=>{const[{fetching:s},n]=v(B),t=u.useCallback(async a=>{const d="Error creating tax category",r=de;m.loading("Adding Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r);if(l)return m.success("Success",{id:r,description:`${l.insertTaxCategory.name} was created`}),l.insertTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertTaxCategory:t}};function q({formManager:s,setFetching:n,isInsert:t}){const{control:a,watch:d,setValue:r}=s,{selectableSortCodes:i,fetching:l,sortCodes:x}=H();u.useEffect(()=>{n(l)},[n,l]);const c=d("sortCode");return u.useEffect(()=>{if(c){const o=x.find(g=>g.key===c);o?.defaultIrsCode&&r("irsCode",o.defaultIrsCode,{shouldDirty:!0})}},[c,x,r]),e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"name",control:a,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"Name"}),e.jsx(p,{children:e.jsx(L,{...o,value:o.value??void 0,required:!0,className:t?"":y(g)})}),e.jsx(S,{})]})}),e.jsx(K,{name:"sortCode",control:a,render:({field:o,fieldState:g})=>e.jsx(Q,{...o,onChange:U=>{o.onChange(Number(U))},data:i,value:o.value?.toString(),disabled:l,label:"Sort Code",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,className:t?"":y(g)})}),e.jsx(C,{name:"irsCode",control:a,render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(p,{children:e.jsx(V,{...o,className:t?"":y(g),value:o.value??void 0,hideControls:!0,decimalScale:0})}),e.jsx(S,{})]})}),e.jsx(C,{control:a,name:"taxExcluded",render:({field:o})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(f,{children:"Tax excluded category"})}),e.jsx(p,{children:e.jsx(_,{onCheckedChange:o.onChange,checked:o.value??void 0})})]})})]})}function le({onAdd:s}){const[n,t]=u.useState(!1);return e.jsxs(D,{open:n,onOpenChange:t,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{children:"Add Tax Category"})}),e.jsxs(M,{className:"w-[90vw] max-w-screen-md",children:[e.jsx(R,{children:e.jsx(A,{children:"Add New Tax Category"})}),e.jsx(xe,{close:()=>t(!1),onAdd:s})]})]})}function xe({close:s,onAdd:n}){const t=k({}),{handleSubmit:a}=t,[d,r]=u.useState(!1),{insertTaxCategory:i,fetching:l}=ce(),x=c=>{c.sortCode&&=parseInt(c.sortCode.toString()),i({fields:c}).then(o=>{o?.id&&(n?.(o.id),s())})};return e.jsx($,{...t,children:e.jsxs("form",{onSubmit:a(x),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!0,formManager:t,setFetching:r})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:l||d,children:"Add Tax Category"})})]})})}const ue="updateTaxCategory",ge=()=>{const[{fetching:s},n]=v(z),t=u.useCallback(async a=>{const d="Error updating tax category",r=`${ue}-${a.taxCategoryId}`;m.loading("Uploading Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r,"updateTaxCategory");if(l)return m.success("Success",{id:r,description:`${l.updateTaxCategory.name} was updated`}),l.updateTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateTaxCategory:t}};function me({taxCategoryId:s,onAdd:n}){const[t,a]=u.useState(!1);return e.jsxs(D,{open:t,onOpenChange:a,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{variant:"outline",size:"icon",children:e.jsx(G,{})})}),e.jsxs(M,{className:"w-[400px] max-w-screen-md",children:[e.jsx(R,{children:e.jsx(A,{children:"Edit Tax Category"})}),e.jsx(he,{taxCategoryId:s,close:()=>a(!1),onAdd:n})]})]})}function he({taxCategoryId:s,close:n,onAdd:t}){const[{data:a,fetching:d}]=O({query:Y,variables:{id:s}}),r=a?.taxCategory;return!r&&!d&&m.error("Error",{description:"Couldn'nt find tax category"}),d?e.jsx(P,{className:"h-10 w-10 animate-spin"}):e.jsx(Ce,{taxCategory:r,close:n,onAdd:t})}function Ce({taxCategory:s,close:n,onAdd:t}){const a=k({defaultValues:{sortCode:s.sortCode?.key,name:s.name,irsCode:s.irsCode}}),{handleSubmit:d}=a,[r,i]=u.useState(!1),{updateTaxCategory:l,fetching:x}=ge(),c=o=>{o.sortCode&&=parseInt(o.sortCode.toString()),l({fields:o,taxCategoryId:s.id}).then(g=>{g?.id&&(t?.(g.id),n())})};return e.jsx($,{...a,children:e.jsxs("form",{onSubmit:d(c),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!1,formManager:a,setFetching:i})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:x||r,children:"Update"})})]})})}const je=({data:s})=>e.jsx("td",{children:s.name}),fe=({data:s})=>e.jsx("td",{children:s.sortCode?e.jsxs("span",{children:[s.sortCode?.name," (",s.sortCode?.id,")"]}):"N/A"}),I=[{id:"name",accessorKey:"name",cell:({row:s})=>e.jsx(je,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Name",e.jsx(N,{})]})},{id:"sortCode",accessorKey:"sortCode.key",cell:({row:s})=>e.jsx(fe,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Sort Code",e.jsx(N,{})]})},{id:"edit",cell:({row:s})=>e.jsx(me,{taxCategoryId:s.original.id})}],Se=()=>{const[{data:s,fetching:n,error:t},a]=O({query:ae}),{setFiltersContext:d}=u.useContext(Z),r=s?.taxCategories??[],i=J({data:r,columns:I,getCoreRowModel:ne(),getPaginationRowModel:oe(),getSortedRowModel:re(),initialState:{pagination:{pageSize:30}}}),l=i.getPageOptions();return u.useEffect(()=>{d(e.jsx("div",{className:"flex items-center justify-end gap-10 space-x-2 py-4",children:e.jsx("div",{className:"flex items-center justify-between px-2",children:e.jsx(ie,{table:i})})}))},[d,i,l]),u.useEffect(()=>{t&&m.error("Error",{description:"Error fetching tax categories"})},[t]),e.jsx(W,{title:`Tax Categories (${r.length})`,description:"All tax categories",headerActions:e.jsx(le,{onAdd:()=>a()}),children:n?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(P,{className:"h-10 w-10 animate-spin mr-2"})}):e.jsx("div",{className:"flex flex-col gap-4 rounded-md border",children:e.jsxs(X,{children:[e.jsx(ee,{children:i.getHeaderGroups().map(x=>e.jsx(T,{children:x.headers.map(c=>e.jsx(se,{children:c.isPlaceholder?null:b(c.column.columnDef.header,c.getContext())},c.id))},x.id))}),e.jsx(te,{children:i.getRowModel().rows.length===0?e.jsx(T,{children:e.jsx(w,{colSpan:I.length,className:"text-center py-8",children:"No tax categories found"})}):i.getRowModel().rows.map(x=>e.jsx(T,{children:x.getVisibleCells().map(c=>e.jsx(w,{children:b(c.column.columnDef.cell,c.getContext())},c.id))},x.id))})]})})})};export{Se as TaxCategories};
@@ -1,2 +1,2 @@
1
- import{r as F,j as r,g as W,a as $,fd as q,L as E,u as Y,U as H,d0 as K,d1 as X,B as U,d2 as ee,k as te,cf as ne,bR as se,bS as oe,de as O,Y as S,fe as G,d3 as re,F as ie,c as le,$ as ae,a1 as ce,a3 as fe}from"./index-BsGG-RLV.js";import{A as ue,a as he,c as de,b as pe}from"./accordion-_VaDHoQb.js";var v={},z;function ye(){if(z)return v;z=1,Object.defineProperty(v,"__esModule",{value:!0}),v.calcSlices=v.applyPatch=v.calcPatch=v.lcs=v.diff=v.diff_core=void 0;function c(e,n){const{b:t,eq:s,stack_base:i}=e;let{i:l,N:o,j:h,M:a,Z:f,stack_top:x}=e;for(;;)switch(n){case 0:{e:for(;o>0&&a>0;){t.fill(0,0,2*f);const V=o-a,_=o+a,B=_&1,Z=l+o-1,J=h+a-1,Q=(_+B)/2;let P;t:for(let M=0;M<=Q;M++){const I=2*Math.max(0,M-a)-M,L=M-2*Math.max(0,M-o);for(let u=I;u<=L;u+=2){const A=t[u-1-f*Math.floor((u-1)/f)],R=t[u+1-f*Math.floor((u+1)/f)],w=u===-M||u!==M&&A<R?R:A+1,k=w-u;let b=w,C=k;for(;b<o&&C<a&&s(l+b,h+C);)b++,C++;if(t[u-f*Math.floor(u/f)]=b,B===1&&(P=V-u)>=1-M&&P<M&&b+t[f+P-f*Math.floor(P/f)]>=o)if(M>1||b!==w){i[x++]=l+b,i[x++]=o-b,i[x++]=h+C,i[x++]=a-C,o=w,a=k,f=2*(Math.min(o,a)+1);continue e}else break t}for(let u=I;u<=L;u+=2){const A=t[f+u-1-f*Math.floor((u-1)/f)],R=t[f+u+1-f*Math.floor((u+1)/f)],w=u===-M||u!==M&&A<R?R:A+1,k=w-u;let b=w,C=k;for(;b<o&&C<a&&s(Z-b,J-C);)b++,C++;if(t[f+u-f*Math.floor(u/f)]=b,B===0&&(P=V-u)>=-M&&P<=M&&b+t[P-f*Math.floor(P/f)]>=o)if(M>0||b!==w){i[x++]=l+o-w,i[x++]=w,i[x++]=h+a-k,i[x++]=k,o=o-b,a=a-C,f=2*(Math.min(o,a)+1);continue e}else break t}}if(o!==a){a>o?(l+=o,h+=o,a-=o,o=0):(l+=a,h+=a,o-=a,a=0);break}}if(o+a!==0)if(e.pxe===l||e.pye===h)e.pxe=l+o,e.pye=h+a;else{const V=e.pxs;if(e.oxs=e.pxs,e.oxe=e.pxe,e.oys=e.pys,e.oye=e.pye,e.pxs=l,e.pxe=l+o,e.pys=h,e.pye=h+a,V>=0)return e.i=l,e.N=o,e.j=h,e.M=a,e.Z=f,e.stack_top=x,1}}case 1:{if(x===0)return 2;a=i[--x],h=i[--x],o=i[--x],l=i[--x],f=2*(Math.min(o,a)+1),n=0}}}class m{constructor(n){this.state=n,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){const{state:n,result:t}=this;if(this.c>1)return t.done=!0,t.value=void 0,t;const s=c(n,this.c);return this.c=s,s===1?(t.value=[n.oxs,n.oxe,n.oys,n.oye],t):n.pxs>=0?(t.value=[n.pxs,n.pxe,n.pys,n.pye],t):(t.done=!0,t.value=void 0,t)}}function D(e,n,t,s,i){const l=(Math.min(n,s)+1)*2,o=n+s,h=new(o<256?Uint8Array:o<65536?Uint16Array:Uint32Array)(2*l);return new m({i:e,N:n,j:t,M:s,Z:l,b:h,eq:i,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}v.diff_core=D;function d(e,n,t){let[s,i,l]=[0,e.length,n.length];if(typeof t=="function"){for(;s<i&&s<l&&t(s,s);)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;t(--i,--l)&&i>s&&l>s;);}else{for(;s<i&&s<l&&e[s]===n[s];)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;e[--i]===n[--l]&&i>s&&l>s;);t=(o,h)=>e[o]===n[h]}return D(s,i+1-s,s,l+1-s,t)}v.diff=d;class p{constructor(n,t){this.diff=n,this.N=t,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){const n=this.diff.next();if(n.done){const{i:a,j:f,N:x}=this;return a<x&&(n.done=!1,n.value=[a,f,x-a],this.i=x),n}const t=n.value,s=t[0],i=t[1],l=t[3],{i:o,j:h}=this;return o!==s&&(t.length--,t[0]=o,t[1]=h,t[2]=s-o),this.i=i,this.j=l,n}}function y(e,n,t){return new p(d(e,n,t),e.length)}v.lcs=y;function*g(e,n,t){const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const i of d(e,n,t))i[2]=s.call(n,i[2],i[3]),yield i}v.calcPatch=g;function*N(e,n){let t=0;const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[i,l,o]of n)t<i&&(yield s.call(e,t,i)),o.length>0&&(yield o),t=l;t<e.length&&(yield s.call(e,t))}v.applyPatch=N;function*j(e,n,t){let s=0;const i=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[l,o,h,a]of d(e,n,t))s<l&&(yield[0,i.call(e,s,l)]),l<o&&(yield[-1,i.call(e,l,o)]),h<a&&(yield[1,i.call(n,h,a)]),s=o;s<e.length&&(yield[0,e.slice(s)])}return v.calcSlices=j,v}var xe=ye();const me=({children:c})=>r.jsx("span",{className:"bg-green-100",children:c}),je=({children:c})=>r.jsx("span",{className:"bg-red-100 line-through",children:c}),T=({children:c})=>r.jsx("span",{children:c}),ge=({content:c,contentOrigin:m,monthDate:D})=>{const d=F.useMemo(()=>{const p=[];if(!m)return p;const y=c.split(""),g=m.split(""),N=Array.from(xe.calcPatch(g,y)),j=[];let e=0;for(const[t,s,i]of N)if(j.length===0&&t>=17&&s<=25&&i.length===s-t){if(N.length===1)return p;continue}else e<t&&j.push([g.slice(e,t).join(""),T]),s>t&&j.push([g.slice(t,s).join(""),je]),i.length>0&&j.push([i.join(""),me]),e=s;e<g.length&&j.push([g.slice(e).join(""),T]);let n=[];for(const[t,s]of j){const i=t.split(`
1
+ import{r as F,j as r,g as W,a as $,fd as q,L as E,u as Y,U as H,d0 as K,d1 as X,B as U,d2 as ee,k as te,cf as ne,bR as se,bS as oe,de as O,Y as S,fe as G,d3 as re,F as ie,c as le,$ as ae,a1 as ce,a3 as fe}from"./index-iLt1WIM9.js";import{A as ue,a as he,c as de,b as pe}from"./accordion-CcwG2M8I.js";var v={},z;function ye(){if(z)return v;z=1,Object.defineProperty(v,"__esModule",{value:!0}),v.calcSlices=v.applyPatch=v.calcPatch=v.lcs=v.diff=v.diff_core=void 0;function c(e,n){const{b:t,eq:s,stack_base:i}=e;let{i:l,N:o,j:h,M:a,Z:f,stack_top:x}=e;for(;;)switch(n){case 0:{e:for(;o>0&&a>0;){t.fill(0,0,2*f);const V=o-a,_=o+a,B=_&1,Z=l+o-1,J=h+a-1,Q=(_+B)/2;let P;t:for(let M=0;M<=Q;M++){const I=2*Math.max(0,M-a)-M,L=M-2*Math.max(0,M-o);for(let u=I;u<=L;u+=2){const A=t[u-1-f*Math.floor((u-1)/f)],R=t[u+1-f*Math.floor((u+1)/f)],w=u===-M||u!==M&&A<R?R:A+1,k=w-u;let b=w,C=k;for(;b<o&&C<a&&s(l+b,h+C);)b++,C++;if(t[u-f*Math.floor(u/f)]=b,B===1&&(P=V-u)>=1-M&&P<M&&b+t[f+P-f*Math.floor(P/f)]>=o)if(M>1||b!==w){i[x++]=l+b,i[x++]=o-b,i[x++]=h+C,i[x++]=a-C,o=w,a=k,f=2*(Math.min(o,a)+1);continue e}else break t}for(let u=I;u<=L;u+=2){const A=t[f+u-1-f*Math.floor((u-1)/f)],R=t[f+u+1-f*Math.floor((u+1)/f)],w=u===-M||u!==M&&A<R?R:A+1,k=w-u;let b=w,C=k;for(;b<o&&C<a&&s(Z-b,J-C);)b++,C++;if(t[f+u-f*Math.floor(u/f)]=b,B===0&&(P=V-u)>=-M&&P<=M&&b+t[P-f*Math.floor(P/f)]>=o)if(M>0||b!==w){i[x++]=l+o-w,i[x++]=w,i[x++]=h+a-k,i[x++]=k,o=o-b,a=a-C,f=2*(Math.min(o,a)+1);continue e}else break t}}if(o!==a){a>o?(l+=o,h+=o,a-=o,o=0):(l+=a,h+=a,o-=a,a=0);break}}if(o+a!==0)if(e.pxe===l||e.pye===h)e.pxe=l+o,e.pye=h+a;else{const V=e.pxs;if(e.oxs=e.pxs,e.oxe=e.pxe,e.oys=e.pys,e.oye=e.pye,e.pxs=l,e.pxe=l+o,e.pys=h,e.pye=h+a,V>=0)return e.i=l,e.N=o,e.j=h,e.M=a,e.Z=f,e.stack_top=x,1}}case 1:{if(x===0)return 2;a=i[--x],h=i[--x],o=i[--x],l=i[--x],f=2*(Math.min(o,a)+1),n=0}}}class m{constructor(n){this.state=n,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){const{state:n,result:t}=this;if(this.c>1)return t.done=!0,t.value=void 0,t;const s=c(n,this.c);return this.c=s,s===1?(t.value=[n.oxs,n.oxe,n.oys,n.oye],t):n.pxs>=0?(t.value=[n.pxs,n.pxe,n.pys,n.pye],t):(t.done=!0,t.value=void 0,t)}}function D(e,n,t,s,i){const l=(Math.min(n,s)+1)*2,o=n+s,h=new(o<256?Uint8Array:o<65536?Uint16Array:Uint32Array)(2*l);return new m({i:e,N:n,j:t,M:s,Z:l,b:h,eq:i,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}v.diff_core=D;function d(e,n,t){let[s,i,l]=[0,e.length,n.length];if(typeof t=="function"){for(;s<i&&s<l&&t(s,s);)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;t(--i,--l)&&i>s&&l>s;);}else{for(;s<i&&s<l&&e[s]===n[s];)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;e[--i]===n[--l]&&i>s&&l>s;);t=(o,h)=>e[o]===n[h]}return D(s,i+1-s,s,l+1-s,t)}v.diff=d;class p{constructor(n,t){this.diff=n,this.N=t,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){const n=this.diff.next();if(n.done){const{i:a,j:f,N:x}=this;return a<x&&(n.done=!1,n.value=[a,f,x-a],this.i=x),n}const t=n.value,s=t[0],i=t[1],l=t[3],{i:o,j:h}=this;return o!==s&&(t.length--,t[0]=o,t[1]=h,t[2]=s-o),this.i=i,this.j=l,n}}function y(e,n,t){return new p(d(e,n,t),e.length)}v.lcs=y;function*g(e,n,t){const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const i of d(e,n,t))i[2]=s.call(n,i[2],i[3]),yield i}v.calcPatch=g;function*N(e,n){let t=0;const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[i,l,o]of n)t<i&&(yield s.call(e,t,i)),o.length>0&&(yield o),t=l;t<e.length&&(yield s.call(e,t))}v.applyPatch=N;function*j(e,n,t){let s=0;const i=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[l,o,h,a]of d(e,n,t))s<l&&(yield[0,i.call(e,s,l)]),l<o&&(yield[-1,i.call(e,l,o)]),h<a&&(yield[1,i.call(n,h,a)]),s=o;s<e.length&&(yield[0,e.slice(s)])}return v.calcSlices=j,v}var xe=ye();const me=({children:c})=>r.jsx("span",{className:"bg-green-100",children:c}),je=({children:c})=>r.jsx("span",{className:"bg-red-100 line-through",children:c}),T=({children:c})=>r.jsx("span",{children:c}),ge=({content:c,contentOrigin:m,monthDate:D})=>{const d=F.useMemo(()=>{const p=[];if(!m)return p;const y=c.split(""),g=m.split(""),N=Array.from(xe.calcPatch(g,y)),j=[];let e=0;for(const[t,s,i]of N)if(j.length===0&&t>=17&&s<=25&&i.length===s-t){if(N.length===1)return p;continue}else e<t&&j.push([g.slice(e,t).join(""),T]),s>t&&j.push([g.slice(t,s).join(""),je]),i.length>0&&j.push([i.join(""),me]),e=s;e<g.length&&j.push([g.slice(e).join(""),T]);let n=[];for(const[t,s]of j){const i=t.split(`
2
2
  `);i.length===1?n.push(r.jsx(s,{children:t},`unchanged-${n.length}`)):i.map((l,o)=>{n.push(r.jsx(s,{children:l},o)),p.push(r.jsx("div",{children:n},p.length-1)),n=[]})}return n.length>0&&p.push(r.jsx("div",{children:n},p.length-1)),p},[c,m]);return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"text-sm text-gray-500 flex flex-row gap-2",children:[r.jsx("span",{className:"font-bold",children:"Month:"}),r.jsx("span",{children:D.slice(0,7)}),!d.length&&r.jsx(W,{className:"text-green-500"})]}),!!d.length&&d]})},Me=({filter:c})=>{const[{data:m,fetching:D,hasNext:d}]=$({query:q,variables:c}),p=F.useMemo(()=>m?.pcnByDate?m.pcnByDate.sort((y,g)=>g.date>y.date?1:g.date<y.date?-1:0):[],[m?.pcnByDate]);return D?r.jsx("div",{className:"w-full h-full flex justify-center",children:r.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"})}):r.jsxs("div",{className:"flex flex-col gap-4",children:[!!m&&d&&r.jsx("div",{className:"w-full h-full flex justify-center",children:r.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"})}),p.map((y,g)=>r.jsx(ge,{content:y.content,contentOrigin:y.diffContent,monthDate:y.date},g))]})};function be({filter:c,setFilter:m,closeModal:D}){const{control:d,handleSubmit:p,setValue:y}=te({defaultValues:{...c}}),{selectableBusinesses:g,fetching:N}=ne(),j=e=>{m(e),D()};return r.jsxs(r.Fragment,{children:[N?r.jsx("div",{children:"Loading..."}):r.jsx("div",{}),r.jsxs("form",{onSubmit:p(j),children:[r.jsx(se,{name:"businessId",control:d,defaultValue:void 0,render:({field:e,fieldState:n})=>r.jsx(oe,{...e,data:g,value:e.value,disabled:N,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message})}),r.jsx(O,{label:"From date",defaultValue:c?.fromMonthDate?new Date(c.fromMonthDate):new Date,defaultDate:c?.fromMonthDate?new Date(c.fromMonthDate):new Date,onChange:e=>{const n=new Date(e.getFullYear(),e.getMonth(),15);y("fromMonthDate",S(n,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}}),r.jsx(O,{label:"To date",defaultValue:c?.toMonthDate?new Date(c.toMonthDate):new Date,defaultDate:c?.toMonthDate?new Date(c.toMonthDate):new Date,onChange:e=>{const n=new Date(e.getFullYear(),e.getMonth(),15);y("toMonthDate",S(n,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}}),r.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[r.jsx(U,{type:"submit",children:"Filter"}),r.jsx(U,{type:"button",onClick:D,children:"Cancel"})]})]})]})}function ve({filter:c,setFilter:m}){const[D,d]=F.useState(!1),{get:p,set:y}=Y(),{userContext:g}=F.useContext(H);function N(j){j||={businessId:g?.context.adminBusinessId??c.businessId,fromMonthDate:S(G(new Date),"yyyy-MM-15"),toMonthDate:S(new Date,"yyyy-MM-15")},re(j,c)||m(j)}return F.useEffect(()=>{const j=K(c??{})?null:encodeURIComponent(JSON.stringify(c)),e=p("validateReportsFilters");j!==e&&y("validateReportsFilters",j)},[c,p,y]),r.jsxs(r.Fragment,{children:[r.jsx(X,{opened:D,onClose:()=>d(!1),content:r.jsx(be,{filter:c,setFilter:N,closeModal:()=>d(!1)})}),r.jsx(U,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>d(!0),children:r.jsx(ee,{className:"size-5"})})]})}const Ce=()=>{const{get:c}=Y(),{setFiltersContext:m}=F.useContext(ie),D=F.useMemo(()=>{try{if(c("validateReportsFilters"))return JSON.parse(decodeURIComponent(c("validateReportsFilters")))}catch(y){console.error("Error parsing filter from URL",y)}return{fromMonthDate:S(G(new Date),"yyyy-MM-15"),toMonthDate:S(new Date,"yyyy-MM-15")}},[c]),[d,p]=F.useState(D);return F.useEffect(()=>{m(r.jsx("div",{className:"flex flex-row gap-2",children:r.jsx(ve,{filter:{...d},setFilter:p})}))},[d,m]),r.jsx(le,{title:"Report Validations",children:r.jsx(ue,{type:"single",collapsible:!0,children:r.jsx(he,{value:"pcn874",children:r.jsxs(ae,{className:"p-4",children:[r.jsx(de,{children:r.jsx(ce,{children:"Monthly VAT (PCN874)"})}),r.jsx(pe,{children:r.jsx(fe,{children:r.jsx(Me,{filter:d})})})]})})})})};export{Ce as ValidateReportsScreen};
@@ -1 +1 @@
1
- import{d0 as _,r as m,u as R,d3 as V,j as e,d1 as q,bC as Q,B as I,d2 as G,k as z,cf as K,dk as X,aN as J,dl as W,bR as y,bS as A,bW as F,bX as B,Y as M,cj as E,a as U,f8 as Z,$ as P,w as $,a0 as Y,a1 as ee,av as ae,a3 as O,f9 as se,F as te,U as re,aR as ne,c as oe,a2 as le,eb as ie,fa as ce,b1 as de}from"./index-BsGG-RLV.js";import{k as ue,B as N,X as H,Y as me,l as pe,m as xe,n as ge,o as he,p as fe,q as be,r as je}from"./chart-2uS7cQLX.js";import{s as ye}from"./sub-DKnwnbwx.js";import"./sequential-CAnleQny.js";import"./subMonths-B44KizJf.js";var ve=ue({chartName:"BarChart",GraphicalChild:N,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:H},{axisType:"yAxis",AxisComp:me}],formatAxisMap:pe});function k(s){return!s||_(s)?null:encodeURIComponent(JSON.stringify(s))}const L="balanceReportFilters",x={MONTHLY:"Monthly",BI_MONTHLY:"Bi-monthly",QUARTERLY:"Quarterly",SEMI_ANNUALLY:"Semi-Annually",ANNUALLY:"Annually"};function Ce({filter:s,setFilter:n,closeModal:c}){const{control:t,handleSubmit:r,watch:g}=z({defaultValues:{...s}}),{selectableBusinesses:b,fetching:h}=K(),{selectableFinancialEntities:f,fetching:v}=X(),{selectableTags:p,fetching:j}=J(),S=a=>{n(a),c()},C=g("excludedTags"),l=m.useMemo(()=>p.filter(a=>!C.includes(a.value)),[C,p]),d=g("includedTags"),o=m.useMemo(()=>p.filter(a=>!d.includes(a.value)),[d,p]);return e.jsxs("form",{onSubmit:r(S),children:[e.jsxs(W,{cols:2,children:[e.jsx(y,{name:"ownerId",control:t,defaultValue:s?.ownerId,render:({field:a,fieldState:i})=>e.jsx(A,{...a,data:b,value:a.value,disabled:h,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"fromDate",control:t,defaultValue:s?.fromDate,rules:{pattern:{value:F,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:i})=>e.jsx(B,{...a,onChange:u=>{const T=u?typeof u=="string"?u:M(u,"yyyy-MM-dd"):void 0;T!==a.value&&a.onChange(T)},value:a.value?new Date(a.value):void 0,error:i.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(y,{name:"toDate",control:t,defaultValue:s?.toDate,rules:{pattern:{value:F,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:i})=>e.jsx(B,{...a,onChange:u=>{const T=u?typeof u=="string"?u:M(u,"yyyy-MM-dd"):void 0;T!==a.value&&a.onChange(T)},value:a.value?new Date(a.value):void 0,error:i.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(y,{name:"period",control:t,defaultValue:x.MONTHLY,render:({field:a,fieldState:i})=>e.jsx(A,{...a,data:Object.values(x).map(u=>({value:u,label:u})),value:a.value,label:"Period",maxDropdownHeight:160,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"excludedCounterparties",control:t,defaultValue:s.excludedCounterparties,render:({field:a,fieldState:i})=>e.jsx(E,{...a,data:f,value:a.value??[],disabled:v,label:"Excluded Counterparties",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"includedTags",control:t,defaultValue:s.includedTags,render:({field:a,fieldState:i})=>e.jsx(E,{...a,data:l,value:a.value??[],disabled:j,label:"Included Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"excludedTags",control:t,defaultValue:s.excludedTags,render:({field:a,fieldState:i})=>e.jsx(E,{...a,data:o,value:a.value??[],disabled:j,label:"Excluded Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:h,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-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:c,children:"Cancel"})]})]})}function Te({filter:s,setFilter:n,initiallyOpened:c=!1}){const[t,r]=m.useState(c),[g,b]=m.useState(!!s),{get:h,set:f}=R();m.useEffect(()=>{const p=k(s),j=h(L);p!==j&&f(L,p)},[s,h,f]);const v=m.useCallback(p=>{V(p,s)||(n(p),b(!!p))},[s,n]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(q,{opened:t,onClose:()=>r(!1),content:e.jsx(Ce,{filter:s,setFilter:v,closeModal:()=>r(!1)}),modalSize:"xl"}),e.jsx(Q,{inline:!0,size:16,disabled:!g,children:e.jsx(I,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(!0),children:e.jsx(G,{className:"size-5"})})})]})}const we=({period:s,transactionIDs:n,onCloseExtendedTransactions:c})=>{const[{data:t,fetching:r}]=U({query:Z,variables:{transactionIDs:n}}),g=m.useMemo(()=>t?.transactionsByIDs?n.map(b=>t?.transactionsByIDs.find(h=>h.id===b)).filter(Boolean):[],[t,n]);return e.jsx(P,{className:"mt-5 w-full",children:r?e.jsx($,{}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{children:e.jsxs(ee,{className:"flex justify-between",children:[e.jsxs("span",{children:[s," Transactions"]}),e.jsx(I,{variant:"link",onClick:c,children:e.jsx(ae,{className:"h-4 w-4"})})]})}),e.jsx(O,{children:e.jsx(se,{transactionsProps:g})})]})})};function Be(s){const n=new URLSearchParams,c=k(s);return c&&n.append(L,c),`/reports/balance${n.size>0?`?${n}`:""}`}const w={income:{label:"Income",color:"rgba(0, 255, 50, 0.5)"},expense:{label:"Expense",color:"rgba(255, 0, 0, 0.5)"},delta:{label:"Delta",color:"rgba(0, 30, 255, 0.5)"},cumulative:{label:"Cumulative Balance",color:"rgba(100, 0, 255, 0.5)"}};function Ne(s,n,c){switch(c){case x.MONTHLY:{const t=String(n).padStart(2,"0");return`${s}-${t}`}case x.BI_MONTHLY:{const t=n%2===0?n-1:n,r=String(t).padStart(2,"0");return`${s}-${r}`}case x.QUARTERLY:{const t=Math.ceil(n/3);return`${s}-Q${t}`}case x.SEMI_ANNUALLY:{const t=n>6?2:1;return`${s}-H${t}`}case x.ANNUALLY:return String(s)}}function Se(s,n){switch(n){case x.MONTHLY:{const[c,t]=s.split("-");return`${t}/${c}`}case x.BI_MONTHLY:{const[c,t]=s.split("-"),r=Number(t)+1,g=String(r).padStart(2,"0");return`${t}-${g}/${c}`}case x.QUARTERLY:{const[c,t]=s.split("-");return`${t}, ${c}`}case x.SEMI_ANNUALLY:{const[c,t]=s.split("-");return`${t}, ${c}`}case x.ANNUALLY:return s}}const D=ie(de.Usd),De=()=>{const{setFiltersContext:s}=m.useContext(te),{userContext:n}=m.useContext(re),{get:c}=R(),t=m.useMemo(()=>{const l={ownerId:n?.context.adminBusinessId,toDate:M(new Date,"yyyy-MM-dd"),period:x.MONTHLY,fromDate:M(ye(new Date,{years:1}),"yyyy-MM-dd"),excludedCounterparties:[],includedTags:[],excludedTags:[]},d=c(L);if(d)try{return JSON.parse(decodeURIComponent(d))}catch(o){console.log("Error parsing balance report filters from URL:",o)}return l},[n?.context.adminBusinessId,c]),[r,g]=m.useState(t),[b,h]=m.useState(void 0),[f,v]=m.useState(Object.keys(w)),p=m.useMemo(()=>{const{ownerId:l,fromDate:d,toDate:o}=r;return{ownerId:l,fromDate:d,toDate:o}},[r]),[{data:j,fetching:S}]=U({query:ce,variables:p,pause:!r});m.useEffect(()=>{s(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(Te,{filter:r,setFilter:g,initiallyOpened:!r}),e.jsx(ne,{options:Object.entries(w).map(([l,d])=>({label:d.label,value:l})),onValueChange:v,defaultValue:f,placeholder:"Select Data Sets",variant:"default",maxCount:1})]})),h(void 0)},[j,S,r,s,g,f]),m.useEffect(()=>{g(l=>({...l,ownerId:n?.context.adminBusinessId}))},[n]);const C=m.useMemo(()=>{if(!j?.transactionsForBalanceReport)return[];const l=new Map;j.transactionsForBalanceReport.map(o=>{if(o.counterparty?.id&&(!o.isFee&&n?.context.financialAccountsBusinessesIds?.includes(o.counterparty.id)||r.excludedCounterparties?.includes(o.counterparty.id))||r.includedTags.length>0&&(!o.charge?.tags||o.charge.tags.length===0||!o.charge.tags.some(u=>r.includedTags.includes(u.id)))||r.excludedTags.length>0&&o.charge?.tags.length&&o.charge.tags.some(u=>r.excludedTags.includes(u.id)))return;const a=Ne(o.year,o.month,r.period);l.has(a)||l.set(a,{income:0,expense:0,delta:0,transactions:[]});const i=l.get(a);o.amountUsd.raw>0?i.income+=o.amountUsd.raw:i.expense+=o.amountUsd.raw,i.delta+=o.amountUsd.raw,i.transactions.push(o)});let d=0;return Array.from(l.entries()).sort((o,a)=>o[0].localeCompare(a[0])).map(([o,a])=>(d+=a.delta,{period:o,income:a.income,expense:a.expense,delta:a.delta,cumulative:d,transactions:a.transactions.sort((i,u)=>Math.abs(u.amountUsd.raw)-Math.abs(i.amountUsd.raw))}))},[j,r.period,r.excludedCounterparties,n?.context.financialAccountsBusinessesIds,r.includedTags,r.excludedTags]);return e.jsx(oe,{title:"Balance Report",description:"Accounts periodical balance",children:S?e.jsx($,{}):e.jsxs(e.Fragment,{children:[e.jsxs(P,{className:"w-full",children:[e.jsx(Y,{children:e.jsx(le,{children:"Click specific period to expand it's transactions data"})}),e.jsx(O,{children:e.jsx(xe,{config:w,className:"h-150 w-full",children:e.jsxs(ve,{accessibilityLayer:!0,data:C,onClick:l=>h(l.activeLabel),children:[e.jsx(ge,{vertical:!1}),e.jsx(H,{dataKey:"period",tickLine:!1,tickMargin:10,axisLine:!1,tickFormatter:l=>Se(l,r.period)}),e.jsx(he,{content:e.jsx(fe,{formatter:(l,d,o,a)=>{const i=`bg-[var(--color-${d})]`;return a<2?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${i} h-2.5 w-2.5 shrink-0 rounded-[2px]`}),w[d]?.label||d,e.jsx("div",{className:"ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground",children:D.format(Number(l))})]}):e.jsxs("div",{className:"mt-1.5 flex basis-full items-center border-t pt-1.5 text-xs font-medium text-foreground",children:[e.jsx("div",{className:`h-2.5 w-2.5 shrink-0 rounded-[2px] mr-2 ${i}`}),w[d]?.label||d,e.jsx("div",{className:"ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground",children:D.format(Number(l))})]})}})}),e.jsx(be,{content:e.jsx(je,{})}),f.includes("income")&&e.jsx(N,{dataKey:"income",fill:"var(--color-income)",radius:4}),f.includes("expense")&&e.jsx(N,{dataKey:"expense",fill:"var(--color-expense)",radius:4}),f.includes("delta")&&e.jsx(N,{dataKey:"delta",fill:"var(--color-delta)",radius:4}),f.includes("cumulative")&&e.jsx(N,{dataKey:"cumulative",fill:"var(--color-cumulative)",radius:4})]})})})]}),b&&e.jsx(we,{period:b,onCloseExtendedTransactions:()=>h(void 0),transactionIDs:C.find(l=>l.period===b)?.transactions.map(l=>l.id)??[]})]})})};export{De as BalanceReport,Be as getBalanceReportHref};
1
+ import{d0 as _,r as m,u as R,d3 as V,j as e,d1 as q,bC as Q,B as I,d2 as G,k as z,cf as K,dk as X,aN as J,dl as W,bR as y,bS as A,bW as F,bX as B,Y as M,cj as E,a as U,f8 as Z,$ as P,w as $,a0 as Y,a1 as ee,av as ae,a3 as O,f9 as se,F as te,U as re,aR as ne,c as oe,a2 as le,eb as ie,fa as ce,b1 as de}from"./index-iLt1WIM9.js";import{k as ue,B as N,X as H,Y as me,l as pe,m as xe,n as ge,o as he,p as fe,q as be,r as je}from"./chart-BgPuhGqj.js";import{s as ye}from"./sub-3l-gAINS.js";import"./sequential-CAnleQny.js";import"./subMonths-LVothVpu.js";var ve=ue({chartName:"BarChart",GraphicalChild:N,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:H},{axisType:"yAxis",AxisComp:me}],formatAxisMap:pe});function k(s){return!s||_(s)?null:encodeURIComponent(JSON.stringify(s))}const L="balanceReportFilters",x={MONTHLY:"Monthly",BI_MONTHLY:"Bi-monthly",QUARTERLY:"Quarterly",SEMI_ANNUALLY:"Semi-Annually",ANNUALLY:"Annually"};function Ce({filter:s,setFilter:n,closeModal:c}){const{control:t,handleSubmit:r,watch:g}=z({defaultValues:{...s}}),{selectableBusinesses:b,fetching:h}=K(),{selectableFinancialEntities:f,fetching:v}=X(),{selectableTags:p,fetching:j}=J(),S=a=>{n(a),c()},C=g("excludedTags"),l=m.useMemo(()=>p.filter(a=>!C.includes(a.value)),[C,p]),d=g("includedTags"),o=m.useMemo(()=>p.filter(a=>!d.includes(a.value)),[d,p]);return e.jsxs("form",{onSubmit:r(S),children:[e.jsxs(W,{cols:2,children:[e.jsx(y,{name:"ownerId",control:t,defaultValue:s?.ownerId,render:({field:a,fieldState:i})=>e.jsx(A,{...a,data:b,value:a.value,disabled:h,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"fromDate",control:t,defaultValue:s?.fromDate,rules:{pattern:{value:F,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:i})=>e.jsx(B,{...a,onChange:u=>{const T=u?typeof u=="string"?u:M(u,"yyyy-MM-dd"):void 0;T!==a.value&&a.onChange(T)},value:a.value?new Date(a.value):void 0,error:i.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(y,{name:"toDate",control:t,defaultValue:s?.toDate,rules:{pattern:{value:F,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:i})=>e.jsx(B,{...a,onChange:u=>{const T=u?typeof u=="string"?u:M(u,"yyyy-MM-dd"):void 0;T!==a.value&&a.onChange(T)},value:a.value?new Date(a.value):void 0,error:i.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(y,{name:"period",control:t,defaultValue:x.MONTHLY,render:({field:a,fieldState:i})=>e.jsx(A,{...a,data:Object.values(x).map(u=>({value:u,label:u})),value:a.value,label:"Period",maxDropdownHeight:160,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"excludedCounterparties",control:t,defaultValue:s.excludedCounterparties,render:({field:a,fieldState:i})=>e.jsx(E,{...a,data:f,value:a.value??[],disabled:v,label:"Excluded Counterparties",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"includedTags",control:t,defaultValue:s.includedTags,render:({field:a,fieldState:i})=>e.jsx(E,{...a,data:l,value:a.value??[],disabled:j,label:"Included Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})}),e.jsx(y,{name:"excludedTags",control:t,defaultValue:s.excludedTags,render:({field:a,fieldState:i})=>e.jsx(E,{...a,data:o,value:a.value??[],disabled:j,label:"Excluded Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:i.error?.message,withinPortal:!0})})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:h,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-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:c,children:"Cancel"})]})]})}function Te({filter:s,setFilter:n,initiallyOpened:c=!1}){const[t,r]=m.useState(c),[g,b]=m.useState(!!s),{get:h,set:f}=R();m.useEffect(()=>{const p=k(s),j=h(L);p!==j&&f(L,p)},[s,h,f]);const v=m.useCallback(p=>{V(p,s)||(n(p),b(!!p))},[s,n]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(q,{opened:t,onClose:()=>r(!1),content:e.jsx(Ce,{filter:s,setFilter:v,closeModal:()=>r(!1)}),modalSize:"xl"}),e.jsx(Q,{inline:!0,size:16,disabled:!g,children:e.jsx(I,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(!0),children:e.jsx(G,{className:"size-5"})})})]})}const we=({period:s,transactionIDs:n,onCloseExtendedTransactions:c})=>{const[{data:t,fetching:r}]=U({query:Z,variables:{transactionIDs:n}}),g=m.useMemo(()=>t?.transactionsByIDs?n.map(b=>t?.transactionsByIDs.find(h=>h.id===b)).filter(Boolean):[],[t,n]);return e.jsx(P,{className:"mt-5 w-full",children:r?e.jsx($,{}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{children:e.jsxs(ee,{className:"flex justify-between",children:[e.jsxs("span",{children:[s," Transactions"]}),e.jsx(I,{variant:"link",onClick:c,children:e.jsx(ae,{className:"h-4 w-4"})})]})}),e.jsx(O,{children:e.jsx(se,{transactionsProps:g})})]})})};function Be(s){const n=new URLSearchParams,c=k(s);return c&&n.append(L,c),`/reports/balance${n.size>0?`?${n}`:""}`}const w={income:{label:"Income",color:"rgba(0, 255, 50, 0.5)"},expense:{label:"Expense",color:"rgba(255, 0, 0, 0.5)"},delta:{label:"Delta",color:"rgba(0, 30, 255, 0.5)"},cumulative:{label:"Cumulative Balance",color:"rgba(100, 0, 255, 0.5)"}};function Ne(s,n,c){switch(c){case x.MONTHLY:{const t=String(n).padStart(2,"0");return`${s}-${t}`}case x.BI_MONTHLY:{const t=n%2===0?n-1:n,r=String(t).padStart(2,"0");return`${s}-${r}`}case x.QUARTERLY:{const t=Math.ceil(n/3);return`${s}-Q${t}`}case x.SEMI_ANNUALLY:{const t=n>6?2:1;return`${s}-H${t}`}case x.ANNUALLY:return String(s)}}function Se(s,n){switch(n){case x.MONTHLY:{const[c,t]=s.split("-");return`${t}/${c}`}case x.BI_MONTHLY:{const[c,t]=s.split("-"),r=Number(t)+1,g=String(r).padStart(2,"0");return`${t}-${g}/${c}`}case x.QUARTERLY:{const[c,t]=s.split("-");return`${t}, ${c}`}case x.SEMI_ANNUALLY:{const[c,t]=s.split("-");return`${t}, ${c}`}case x.ANNUALLY:return s}}const D=ie(de.Usd),De=()=>{const{setFiltersContext:s}=m.useContext(te),{userContext:n}=m.useContext(re),{get:c}=R(),t=m.useMemo(()=>{const l={ownerId:n?.context.adminBusinessId,toDate:M(new Date,"yyyy-MM-dd"),period:x.MONTHLY,fromDate:M(ye(new Date,{years:1}),"yyyy-MM-dd"),excludedCounterparties:[],includedTags:[],excludedTags:[]},d=c(L);if(d)try{return JSON.parse(decodeURIComponent(d))}catch(o){console.log("Error parsing balance report filters from URL:",o)}return l},[n?.context.adminBusinessId,c]),[r,g]=m.useState(t),[b,h]=m.useState(void 0),[f,v]=m.useState(Object.keys(w)),p=m.useMemo(()=>{const{ownerId:l,fromDate:d,toDate:o}=r;return{ownerId:l,fromDate:d,toDate:o}},[r]),[{data:j,fetching:S}]=U({query:ce,variables:p,pause:!r});m.useEffect(()=>{s(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(Te,{filter:r,setFilter:g,initiallyOpened:!r}),e.jsx(ne,{options:Object.entries(w).map(([l,d])=>({label:d.label,value:l})),onValueChange:v,defaultValue:f,placeholder:"Select Data Sets",variant:"default",maxCount:1})]})),h(void 0)},[j,S,r,s,g,f]),m.useEffect(()=>{g(l=>({...l,ownerId:n?.context.adminBusinessId}))},[n]);const C=m.useMemo(()=>{if(!j?.transactionsForBalanceReport)return[];const l=new Map;j.transactionsForBalanceReport.map(o=>{if(o.counterparty?.id&&(!o.isFee&&n?.context.financialAccountsBusinessesIds?.includes(o.counterparty.id)||r.excludedCounterparties?.includes(o.counterparty.id))||r.includedTags.length>0&&(!o.charge?.tags||o.charge.tags.length===0||!o.charge.tags.some(u=>r.includedTags.includes(u.id)))||r.excludedTags.length>0&&o.charge?.tags.length&&o.charge.tags.some(u=>r.excludedTags.includes(u.id)))return;const a=Ne(o.year,o.month,r.period);l.has(a)||l.set(a,{income:0,expense:0,delta:0,transactions:[]});const i=l.get(a);o.amountUsd.raw>0?i.income+=o.amountUsd.raw:i.expense+=o.amountUsd.raw,i.delta+=o.amountUsd.raw,i.transactions.push(o)});let d=0;return Array.from(l.entries()).sort((o,a)=>o[0].localeCompare(a[0])).map(([o,a])=>(d+=a.delta,{period:o,income:a.income,expense:a.expense,delta:a.delta,cumulative:d,transactions:a.transactions.sort((i,u)=>Math.abs(u.amountUsd.raw)-Math.abs(i.amountUsd.raw))}))},[j,r.period,r.excludedCounterparties,n?.context.financialAccountsBusinessesIds,r.includedTags,r.excludedTags]);return e.jsx(oe,{title:"Balance Report",description:"Accounts periodical balance",children:S?e.jsx($,{}):e.jsxs(e.Fragment,{children:[e.jsxs(P,{className:"w-full",children:[e.jsx(Y,{children:e.jsx(le,{children:"Click specific period to expand it's transactions data"})}),e.jsx(O,{children:e.jsx(xe,{config:w,className:"h-150 w-full",children:e.jsxs(ve,{accessibilityLayer:!0,data:C,onClick:l=>h(l.activeLabel),children:[e.jsx(ge,{vertical:!1}),e.jsx(H,{dataKey:"period",tickLine:!1,tickMargin:10,axisLine:!1,tickFormatter:l=>Se(l,r.period)}),e.jsx(he,{content:e.jsx(fe,{formatter:(l,d,o,a)=>{const i=`bg-[var(--color-${d})]`;return a<2?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${i} h-2.5 w-2.5 shrink-0 rounded-[2px]`}),w[d]?.label||d,e.jsx("div",{className:"ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground",children:D.format(Number(l))})]}):e.jsxs("div",{className:"mt-1.5 flex basis-full items-center border-t pt-1.5 text-xs font-medium text-foreground",children:[e.jsx("div",{className:`h-2.5 w-2.5 shrink-0 rounded-[2px] mr-2 ${i}`}),w[d]?.label||d,e.jsx("div",{className:"ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground",children:D.format(Number(l))})]})}})}),e.jsx(be,{content:e.jsx(je,{})}),f.includes("income")&&e.jsx(N,{dataKey:"income",fill:"var(--color-income)",radius:4}),f.includes("expense")&&e.jsx(N,{dataKey:"expense",fill:"var(--color-expense)",radius:4}),f.includes("delta")&&e.jsx(N,{dataKey:"delta",fill:"var(--color-delta)",radius:4}),f.includes("cumulative")&&e.jsx(N,{dataKey:"cumulative",fill:"var(--color-cumulative)",radius:4})]})})})]}),b&&e.jsx(we,{period:b,onCloseExtendedTransactions:()=>h(void 0),transactionIDs:C.find(l=>l.period===b)?.transactions.map(l=>l.id)??[]})]})})};export{De as BalanceReport,Be as getBalanceReportHref};
@@ -1 +1 @@
1
- import{a as M,dG as Q,t as C,r as s,p as Y,s as J,dH as K,dI as U,D as F,dJ as E,j as e,ao as R,ap as q,B as v,aq as W,ar as G,as as X,at as _,aw as Z,ax as ee,ay as se,az as te,aA as ne,dK as ae,dL as re,dM as z,dN as H,ca as ce,dO as $,dP as ie,$ as k,a3 as A,L as B,dQ as le,g as oe,a0 as de,a1 as ue,dR as me,bm as he,b9 as xe,dS as je,Y as P,dT as L,k as pe,bP as fe,W as ge,l as ye,bf as ve,de as De,dq as be,dr as Ce,ds as O,dt as g,dv as Ne,dw as y,av as we,c4 as Ie,F as Me,w as Te}from"./index-BsGG-RLV.js";import{s as V}from"./subMonths-B44KizJf.js";const Se=()=>{const[{data:u,fetching:o,error:c},x]=M({query:Q});c&&(console.error(`Error fetching contracts: ${c}`),C.error("Error",{description:"Unable to fetch contracts"}));const a=s.useMemo(()=>u?.allOpenContracts?.slice().sort((t,d)=>t.client.originalBusiness.name>d.client.originalBusiness.name?1:-1)??[],[u]),i=s.useMemo(()=>a.map(t=>({value:t.id,label:t.client.originalBusiness.name})),[a]);return{fetching:o,refresh:()=>x(),openContracts:a,selectableOpenContracts:i}},Fe="IssueMonthlyDocuments",Ee=()=>{const[{fetching:u},o]=Y(K),c=s.useCallback(async x=>{const a="Error issuing monthly documents",i=Fe;C.loading("Issuing documents",{id:i});try{const t=await o(x),d=J(t,a,i);if(d?.issueGreenInvoiceDocuments?.success){C.success("Success",{id:i,description:"Documents issued successfully"});return}d?.issueGreenInvoiceDocuments?.errors&&console.error(d.issueGreenInvoiceDocuments.errors),C.error("Error",{id:i,description:a,duration:1e5,closeButton:!0})}catch(t){console.error(`${a}: ${t}`),C.error("Error",{id:i,description:a,duration:1e5,closeButton:!0})}},[o]);return{fetching:u,issueDocuments:c}};function Pe({issueMonth:u,contracts:o,onAdd:c}){const[x,a]=s.useState(!1),[i,t]=s.useState(""),[{data:d},h]=M({query:U,variables:{issueMonth:u,clientId:i}}),j=s.useCallback(n=>{t(n),h()},[h,t]);return s.useEffect(()=>{i!==""&&d&&(c(F(E,d.clientMonthlyChargeDraft)),a(!1))},[i,d,c]),e.jsxs(R,{open:x,onOpenChange:a,children:[e.jsx(q,{asChild:!0,children:e.jsx(v,{variant:"outline",size:"icon",children:e.jsx(W,{})})}),e.jsxs(G,{className:"w-[400px] max-w-screen-md",children:[e.jsx(X,{children:e.jsx(_,{children:"Select document recipient"})}),e.jsxs(Z,{onValueChange:j,children:[e.jsx(ee,{children:e.jsx(se,{placeholder:"Recipient"})}),e.jsx(te,{children:o.map(n=>e.jsx(ne,{value:n.client.originalBusiness.id,children:n.client.originalBusiness.name},n.client.originalBusiness.id))})]})]})]})}function ke({onApprove:u,draft:o}){const[c,x]=s.useState(!1),[a,i]=s.useState(!1),[t,d]=s.useState(null),{previewDocument:h,fetching:j}=ae(),[n,N]=s.useState(re(o)),T=s.useCallback((l,p)=>{N(f=>({...f,[l]:p}))},[]);s.useEffect(()=>{i(!1)},[n]);const D=s.useCallback(async()=>{try{const l=await h({input:n});if(!l)throw new Error("No preview data returned");d(l),i(!0)}catch(l){console.error("Failed to generate preview:",l)}},[n,h]);s.useEffect(()=>{c&&!t&&D()},[c,t,D]);const w=n.income?.reduce((l,p)=>{const f=p.price*p.quantity,r=f*((p.vatRate||0)/100);return l+f+r},0)||0,I=()=>{u(n),x(!1)};return e.jsxs(R,{open:c,onOpenChange:x,children:[e.jsx(q,{asChild:!0,type:"button",children:e.jsxs(z,{children:[e.jsx(H,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>x(l=>!l),type:"button",children:e.jsx(ce,{className:"size-5"})})}),e.jsx($,{children:e.jsx("p",{children:"Edit document"})})]})}),e.jsx(G,{className:"w-7xl sm:max-w-[95%] max-h-[90vh] overflow-y-auto",children:e.jsx("div",{className:"min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Edit Document"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Modify and preview your accounting document before issuing"})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(ie,{formData:n,updateFormData:T}),e.jsx(k,{children:e.jsxs(A,{className:"pt-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(v,{onClick:D,disabled:j||a,variant:"outline",className:"flex-1 bg-transparent",children:j?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-2"}),"Preview"]})}),e.jsxs(v,{onClick:I,className:"flex-1",children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Accept Changes"]})]}),w>0&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"flex justify-between items-center font-medium text-blue-900",children:[e.jsx("span",{children:"Total Document Amount:"}),e.jsxs("span",{children:[w.toFixed(2)," ",n.currency]})]})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(k,{className:"h-fit",children:[e.jsx(de,{children:e.jsx(ue,{children:"Document Preview"})}),e.jsx(A,{children:e.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50",children:j?e.jsxs("div",{className:"text-center",children:[e.jsx(B,{className:"w-8 h-8 animate-spin mx-auto mb-4 text-gray-400"}),e.jsx("p",{className:"text-gray-500",children:"Generating document preview..."})]}):t?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"bg-white shadow-lg rounded-lg overflow-hidden",children:e.jsx("div",{className:"aspect-[8.5/11] bg-white border",children:e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(me,{src:t}),!a&&e.jsx("p",{className:"text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded",children:"Preview may be outdated"})]})})})})}):e.jsxs("div",{className:"text-center",children:[e.jsx(he,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-gray-500 mb-2",children:"No preview available"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Click Preview to generate document"})]})})})]}),n.client?.id&&e.jsx(xe,{businessId:n.client?.id,linkedDocumentIds:n.linkedDocumentIds??[]}),e.jsx(je,{documentType:n.type})]})]})]})})})]})}const Ae=({drafts:u})=>{const[o,c]=s.useState(u.map(r=>F(E,r))),x=P(V(new Date,1),"yyyy-MM-dd"),[a,i]=s.useState(x),[{data:t},d]=M({query:L,variables:{issueMonth:a},pause:!0});s.useEffect(()=>{t?.clientMonthlyChargesDrafts&&c(t.clientMonthlyChargesDrafts.map(r=>F(E,r)))},[t,c]),s.useEffect(()=>{d()},[a,d]);const h=pe({values:{generateDocumentsInfo:o}}),{issueDocuments:j}=Ee(),{openContracts:n}=Se(),{fields:N,append:T,remove:D,update:w}=fe({control:h.control,name:"generateDocumentsInfo"}),I=h.watch("generateDocumentsInfo"),l=s.useMemo(()=>N.map((r,m)=>({...r,...I[m],id:r.client?.id})),[N,I]),p=s.useCallback(r=>{j(r)},[j]),f=s.useMemo(()=>n.filter(r=>r.billingCycle===ge.Monthly&&!l.some(m=>m.client?.id===r.client.originalBusiness.id)),[l,n]);return e.jsx("div",{className:"p-2",children:e.jsx(ye,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(p),children:[e.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[e.jsx(ve,{children:"Issue Month:"}),e.jsx(De,{value:new Date(a),onChange:r=>{const m=new Date(r.getFullYear(),r.getMonth(),15);i(P(m,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}})]}),e.jsxs(be,{children:[e.jsx(Ce,{children:e.jsxs(O,{children:[e.jsx(g,{children:"Name"}),e.jsx(g,{children:"Document"}),e.jsx(g,{children:"Amount"}),e.jsx(g,{children:"Remark"}),e.jsx(g,{children:"Recipients"}),e.jsx(g,{})]})}),e.jsx(Ne,{children:l.map(({id:r,...m},S)=>e.jsxs(O,{children:[e.jsx(y,{children:m.client?.name}),e.jsx(y,{children:m.type}),e.jsxs(y,{children:[m.income?.[0]?.price," ",m.income?.[0]?.currency]}),e.jsx(y,{children:e.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:m.remarks})}),e.jsx(y,{children:e.jsx("div",{className:"flex flex-col",children:m.client?.emails?.map(b=>e.jsx("span",{className:"text-sm text-gray-500",children:b},b))})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(z,{children:[e.jsx(H,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>D(S),children:e.jsx(we,{size:16})})}),e.jsx($,{children:e.jsx("p",{children:"Remove document"})})]}),e.jsx(ke,{draft:m,onApprove:b=>{h.setValue(`generateDocumentsInfo.${S}`,b,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),w(S,{...b})}})]})})]},r))})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsx(Pe,{contracts:f,onAdd:T,issueMonth:a}),e.jsx(Ie,{onConfirm:h.handleSubmit(p),title:`Are you sure you want to issue ${l.length} documents?`,children:e.jsx(v,{children:"Issue"})})]})]})})})},Re=()=>{const{setFiltersContext:u}=s.useContext(Me),[{data:o,fetching:c}]=M({query:L,variables:{issueMonth:P(V(new Date,1),"yyyy-MM-dd")}});return s.useEffect(()=>{o?.clientMonthlyChargesDrafts||u(null)},[o,u]),c?e.jsx(Te,{}):e.jsx(Ae,{drafts:o?.clientMonthlyChargesDrafts??[]})};export{Re as IssueDocuments};
1
+ import{a as M,dG as Q,t as C,r as s,p as Y,s as J,dH as K,dI as U,D as F,dJ as E,j as e,ao as R,ap as q,B as v,aq as W,ar as G,as as X,at as _,aw as Z,ax as ee,ay as se,az as te,aA as ne,dK as ae,dL as re,dM as z,dN as H,ca as ce,dO as $,dP as ie,$ as k,a3 as A,L as B,dQ as le,g as oe,a0 as de,a1 as ue,dR as me,bm as he,b9 as xe,dS as je,Y as P,dT as L,k as pe,bP as fe,W as ge,l as ye,bf as ve,de as De,dq as be,dr as Ce,ds as O,dt as g,dv as Ne,dw as y,av as we,c4 as Ie,F as Me,w as Te}from"./index-iLt1WIM9.js";import{s as V}from"./subMonths-LVothVpu.js";const Se=()=>{const[{data:u,fetching:o,error:c},x]=M({query:Q});c&&(console.error(`Error fetching contracts: ${c}`),C.error("Error",{description:"Unable to fetch contracts"}));const a=s.useMemo(()=>u?.allOpenContracts?.slice().sort((t,d)=>t.client.originalBusiness.name>d.client.originalBusiness.name?1:-1)??[],[u]),i=s.useMemo(()=>a.map(t=>({value:t.id,label:t.client.originalBusiness.name})),[a]);return{fetching:o,refresh:()=>x(),openContracts:a,selectableOpenContracts:i}},Fe="IssueMonthlyDocuments",Ee=()=>{const[{fetching:u},o]=Y(K),c=s.useCallback(async x=>{const a="Error issuing monthly documents",i=Fe;C.loading("Issuing documents",{id:i});try{const t=await o(x),d=J(t,a,i);if(d?.issueGreenInvoiceDocuments?.success){C.success("Success",{id:i,description:"Documents issued successfully"});return}d?.issueGreenInvoiceDocuments?.errors&&console.error(d.issueGreenInvoiceDocuments.errors),C.error("Error",{id:i,description:a,duration:1e5,closeButton:!0})}catch(t){console.error(`${a}: ${t}`),C.error("Error",{id:i,description:a,duration:1e5,closeButton:!0})}},[o]);return{fetching:u,issueDocuments:c}};function Pe({issueMonth:u,contracts:o,onAdd:c}){const[x,a]=s.useState(!1),[i,t]=s.useState(""),[{data:d},h]=M({query:U,variables:{issueMonth:u,clientId:i}}),j=s.useCallback(n=>{t(n),h()},[h,t]);return s.useEffect(()=>{i!==""&&d&&(c(F(E,d.clientMonthlyChargeDraft)),a(!1))},[i,d,c]),e.jsxs(R,{open:x,onOpenChange:a,children:[e.jsx(q,{asChild:!0,children:e.jsx(v,{variant:"outline",size:"icon",children:e.jsx(W,{})})}),e.jsxs(G,{className:"w-[400px] max-w-screen-md",children:[e.jsx(X,{children:e.jsx(_,{children:"Select document recipient"})}),e.jsxs(Z,{onValueChange:j,children:[e.jsx(ee,{children:e.jsx(se,{placeholder:"Recipient"})}),e.jsx(te,{children:o.map(n=>e.jsx(ne,{value:n.client.originalBusiness.id,children:n.client.originalBusiness.name},n.client.originalBusiness.id))})]})]})]})}function ke({onApprove:u,draft:o}){const[c,x]=s.useState(!1),[a,i]=s.useState(!1),[t,d]=s.useState(null),{previewDocument:h,fetching:j}=ae(),[n,N]=s.useState(re(o)),T=s.useCallback((l,p)=>{N(f=>({...f,[l]:p}))},[]);s.useEffect(()=>{i(!1)},[n]);const D=s.useCallback(async()=>{try{const l=await h({input:n});if(!l)throw new Error("No preview data returned");d(l),i(!0)}catch(l){console.error("Failed to generate preview:",l)}},[n,h]);s.useEffect(()=>{c&&!t&&D()},[c,t,D]);const w=n.income?.reduce((l,p)=>{const f=p.price*p.quantity,r=f*((p.vatRate||0)/100);return l+f+r},0)||0,I=()=>{u(n),x(!1)};return e.jsxs(R,{open:c,onOpenChange:x,children:[e.jsx(q,{asChild:!0,type:"button",children:e.jsxs(z,{children:[e.jsx(H,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>x(l=>!l),type:"button",children:e.jsx(ce,{className:"size-5"})})}),e.jsx($,{children:e.jsx("p",{children:"Edit document"})})]})}),e.jsx(G,{className:"w-7xl sm:max-w-[95%] max-h-[90vh] overflow-y-auto",children:e.jsx("div",{className:"min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Edit Document"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Modify and preview your accounting document before issuing"})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(ie,{formData:n,updateFormData:T}),e.jsx(k,{children:e.jsxs(A,{className:"pt-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(v,{onClick:D,disabled:j||a,variant:"outline",className:"flex-1 bg-transparent",children:j?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-2"}),"Preview"]})}),e.jsxs(v,{onClick:I,className:"flex-1",children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Accept Changes"]})]}),w>0&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"flex justify-between items-center font-medium text-blue-900",children:[e.jsx("span",{children:"Total Document Amount:"}),e.jsxs("span",{children:[w.toFixed(2)," ",n.currency]})]})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(k,{className:"h-fit",children:[e.jsx(de,{children:e.jsx(ue,{children:"Document Preview"})}),e.jsx(A,{children:e.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50",children:j?e.jsxs("div",{className:"text-center",children:[e.jsx(B,{className:"w-8 h-8 animate-spin mx-auto mb-4 text-gray-400"}),e.jsx("p",{className:"text-gray-500",children:"Generating document preview..."})]}):t?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"bg-white shadow-lg rounded-lg overflow-hidden",children:e.jsx("div",{className:"aspect-[8.5/11] bg-white border",children:e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(me,{src:t}),!a&&e.jsx("p",{className:"text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded",children:"Preview may be outdated"})]})})})})}):e.jsxs("div",{className:"text-center",children:[e.jsx(he,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-gray-500 mb-2",children:"No preview available"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Click Preview to generate document"})]})})})]}),n.client?.id&&e.jsx(xe,{businessId:n.client?.id,linkedDocumentIds:n.linkedDocumentIds??[]}),e.jsx(je,{documentType:n.type})]})]})]})})})]})}const Ae=({drafts:u})=>{const[o,c]=s.useState(u.map(r=>F(E,r))),x=P(V(new Date,1),"yyyy-MM-dd"),[a,i]=s.useState(x),[{data:t},d]=M({query:L,variables:{issueMonth:a},pause:!0});s.useEffect(()=>{t?.clientMonthlyChargesDrafts&&c(t.clientMonthlyChargesDrafts.map(r=>F(E,r)))},[t,c]),s.useEffect(()=>{d()},[a,d]);const h=pe({values:{generateDocumentsInfo:o}}),{issueDocuments:j}=Ee(),{openContracts:n}=Se(),{fields:N,append:T,remove:D,update:w}=fe({control:h.control,name:"generateDocumentsInfo"}),I=h.watch("generateDocumentsInfo"),l=s.useMemo(()=>N.map((r,m)=>({...r,...I[m],id:r.client?.id})),[N,I]),p=s.useCallback(r=>{j(r)},[j]),f=s.useMemo(()=>n.filter(r=>r.billingCycle===ge.Monthly&&!l.some(m=>m.client?.id===r.client.originalBusiness.id)),[l,n]);return e.jsx("div",{className:"p-2",children:e.jsx(ye,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(p),children:[e.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[e.jsx(ve,{children:"Issue Month:"}),e.jsx(De,{value:new Date(a),onChange:r=>{const m=new Date(r.getFullYear(),r.getMonth(),15);i(P(m,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}})]}),e.jsxs(be,{children:[e.jsx(Ce,{children:e.jsxs(O,{children:[e.jsx(g,{children:"Name"}),e.jsx(g,{children:"Document"}),e.jsx(g,{children:"Amount"}),e.jsx(g,{children:"Remark"}),e.jsx(g,{children:"Recipients"}),e.jsx(g,{})]})}),e.jsx(Ne,{children:l.map(({id:r,...m},S)=>e.jsxs(O,{children:[e.jsx(y,{children:m.client?.name}),e.jsx(y,{children:m.type}),e.jsxs(y,{children:[m.income?.[0]?.price," ",m.income?.[0]?.currency]}),e.jsx(y,{children:e.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:m.remarks})}),e.jsx(y,{children:e.jsx("div",{className:"flex flex-col",children:m.client?.emails?.map(b=>e.jsx("span",{className:"text-sm text-gray-500",children:b},b))})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(z,{children:[e.jsx(H,{asChild:!0,type:"button",children:e.jsx(v,{className:"size-7.5",variant:"secondary",onClick:()=>D(S),children:e.jsx(we,{size:16})})}),e.jsx($,{children:e.jsx("p",{children:"Remove document"})})]}),e.jsx(ke,{draft:m,onApprove:b=>{h.setValue(`generateDocumentsInfo.${S}`,b,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),w(S,{...b})}})]})})]},r))})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsx(Pe,{contracts:f,onAdd:T,issueMonth:a}),e.jsx(Ie,{onConfirm:h.handleSubmit(p),title:`Are you sure you want to issue ${l.length} documents?`,children:e.jsx(v,{children:"Issue"})})]})]})})})},Re=()=>{const{setFiltersContext:u}=s.useContext(Me),[{data:o,fetching:c}]=M({query:L,variables:{issueMonth:P(V(new Date,1),"yyyy-MM-dd")}});return s.useEffect(()=>{o?.clientMonthlyChargesDrafts||u(null)},[o,u]),c?e.jsx(Te,{}):e.jsx(Ae,{drafts:o?.clientMonthlyChargesDrafts??[]})};export{Re as IssueDocuments};