@accounter/client 0.0.8-alpha-20251023071611-4357687c6963ad74c80f62140eb0de9252d7bca7 → 0.0.8-alpha-20251023122652-765c7f951395441461726b3b4345eebd020632d7

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 (57) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-iZ--iyJF.js → Checkbox-CpANMiXr.js} +1 -1
  3. package/dist/assets/{Progress-CSjfE5bV.js → Progress-BEKiyNRK.js} +1 -1
  4. package/dist/assets/{Typography-D14P1nN1.js → Typography-C0c5augK.js} +1 -1
  5. package/dist/assets/{accordion-CcwG2M8I.js → accordion-ZFVTCyDy.js} +1 -1
  6. package/dist/assets/{accountant-approvals-3mWk2IJb.js → accountant-approvals-CpzuSBgK.js} +1 -1
  7. package/dist/assets/{all-charges-kAC8rw9C.js → all-charges-BTyaAlp7.js} +1 -1
  8. package/dist/assets/{arrow-up-down-BS_znu7y.js → arrow-up-down-PQdrJdei.js} +1 -1
  9. package/dist/assets/{business-Cv0e_Q3p.js → business-DiQFqEHI.js} +1 -1
  10. package/dist/assets/{business-transactions-single-B23INPyA.js → business-transactions-single-DJqvqlMO.js} +1 -1
  11. package/dist/assets/{business-trip-c4pY18e_.js → business-trip-BXAjI1mO.js} +1 -1
  12. package/dist/assets/{charges-filters-DaVBQ_jS.js → charges-filters-r7FjeZLc.js} +1 -1
  13. package/dist/assets/{charges-ledger-validation-DZtDlOTx.js → charges-ledger-validation-CFc_zJFO.js} +1 -1
  14. package/dist/assets/{chart-BgPuhGqj.js → chart-C5LuxRSv.js} +1 -1
  15. package/dist/assets/{data-table-pagination-P75qqcV4.js → data-table-pagination-g2cF8_uB.js} +1 -1
  16. package/dist/assets/{editable-business-trip-80Bf0nf4.js → editable-business-trip-DyQsUJjl.js} +1 -1
  17. package/dist/assets/{index-ASrM5c3z.js → index-2g0J28D2.js} +1 -1
  18. package/dist/assets/{index-BIiK-vW-.js → index-6-J73JPC.js} +1 -1
  19. package/dist/assets/{index-CmRugx3-.js → index-B5j8Fmt8.js} +1 -1
  20. package/dist/assets/{index-D-K_l8g8.js → index-BSBV6pv2.js} +1 -1
  21. package/dist/assets/{index-1yUzw9-e.js → index-BSg8ocop.js} +1 -1
  22. package/dist/assets/{index-BopVOgtm.js → index-Bpef3vuz.js} +1 -1
  23. package/dist/assets/{index-CNBPVFd1.js → index-BziuNiXZ.js} +1 -1
  24. package/dist/assets/{index-DfYVR_1G.js → index-C0OGGVXE.js} +1 -1
  25. package/dist/assets/{index-Cca4zCek.js → index-C7KKktQ5.js} +1 -1
  26. package/dist/assets/{index-Ucx6U5YY.js → index-C99l-a0m.js} +1 -1
  27. package/dist/assets/{index-DmBjrSud.js → index-CE3kLG2a.js} +1 -1
  28. package/dist/assets/{index-D3y74IdY.js → index-CJdrnxxy.js} +1 -1
  29. package/dist/assets/{index-iLt1WIM9.js → index-CN2818Wt.js} +167 -167
  30. package/dist/assets/{index-Bt1Iynf-.js → index-CjDRKTTf.js} +1 -1
  31. package/dist/assets/{index-Buu6jU2e.js → index-D2xdQJAx.js} +1 -1
  32. package/dist/assets/{index-BtF8NkXw.js → index-DGvh10a7.js} +1 -1
  33. package/dist/assets/{index-BUJZ6CG6.js → index-DLI6Z9VU.js} +1 -1
  34. package/dist/assets/{index-DWdQvLZN.js → index-DXL1qPt9.js} +1 -1
  35. package/dist/assets/{index-DUDlwA28.js → index-Is4LJW4y.js} +1 -1
  36. package/dist/assets/{index-D7rFUnXc.js → index-S6eSocQH.js} +1 -1
  37. package/dist/assets/{index-CgVLV78R.js → index-T-JiUNDA.js} +1 -1
  38. package/dist/assets/{index-D0eVaZI5.js → index-gBZ-7Z07.js} +1 -1
  39. package/dist/assets/{index-BwJkbwi9.js → index-o_W5PWRq.js} +1 -1
  40. package/dist/assets/{index.es-VMf2fRct.js → index.es-DZgQ4YcV.js} +1 -1
  41. package/dist/assets/{issue-document-BustWthK.js → issue-document-D-JoFiMZ.js} +1 -1
  42. package/dist/assets/{login-page-DbBOFdaj.js → login-page-DsHy5amR.js} +1 -1
  43. package/dist/assets/{missing-info-charges-sf4ZGQoC.js → missing-info-charges-CPnjfjfW.js} +1 -1
  44. package/dist/assets/page-not-found-CYmXF0n2.js +1 -0
  45. package/dist/assets/{pencil-1-tPx_Bq.js → pencil-BUwX_eHK.js} +1 -1
  46. package/dist/assets/{report-commentary-row-BqTwvfOv.js → report-commentary-row-Bpvvtwpd.js} +1 -1
  47. package/dist/assets/{save-CMGkGXCM.js → save-Ck68rh6u.js} +1 -1
  48. package/dist/assets/{similar-charges-by-business-modal-Dj7iCQhJ.js → similar-charges-by-business-modal-bUtiFfAw.js} +1 -1
  49. package/dist/assets/{sub-3l-gAINS.js → sub-C2zifPY5.js} +1 -1
  50. package/dist/assets/subMonths-uUfFviD2.js +1 -0
  51. package/dist/index.html +1 -1
  52. package/package.json +1 -1
  53. package/src/providers/urql-client.ts +2 -29
  54. package/src/providers/urql-error-handler.ts +27 -0
  55. package/src/providers/urql.tsx +2 -29
  56. package/dist/assets/page-not-found-CzE13z4R.js +0 -1
  57. package/dist/assets/subMonths-LVothVpu.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @accounter/client
2
2
 
3
- ## 0.0.8-alpha-20251023071611-4357687c6963ad74c80f62140eb0de9252d7bca7
3
+ ## 0.0.8-alpha-20251023122652-765c7f951395441461726b3b4345eebd020632d7
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-iLt1WIM9.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-CN2818Wt.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-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
+ 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-CN2818Wt.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-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
+ 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-CN2818Wt.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-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
+ 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-CN2818Wt.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-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
+ 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-CN2818Wt.js";import{C as j}from"./charges-filters-r7FjeZLc.js";import{P as D}from"./Progress-BEKiyNRK.js";import"./sub-C2zifPY5.js";import"./subMonths-uUfFviD2.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-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
+ 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-CN2818Wt.js";import{e as Q,C as $}from"./charges-filters-r7FjeZLc.js";import{M as H}from"./index-C0OGGVXE.js";import"./sub-C2zifPY5.js";import"./subMonths-uUfFviD2.js";import"./Checkbox-CpANMiXr.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-iLt1WIM9.js";/**
1
+ import{V as o}from"./index-CN2818Wt.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-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";/**
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-CN2818Wt.js";import{S as os,B as Ds}from"./save-Ck68rh6u.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-C5LuxRSv.js";import{u as Ts,S as Qn}from"./similar-charges-by-business-modal-bUtiFfAw.js";import{P as Yn}from"./pencil-BUwX_eHK.js";import{A as Zn,a as _e,b as Fe,c as hs}from"./accordion-ZFVTCyDy.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-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
+ 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-CN2818Wt.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-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
+ 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-CN2818Wt.js";import{P as m,C as b,E as T}from"./editable-business-trip-DyQsUJjl.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-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
+ 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-CN2818Wt.js";import{s as oe}from"./sub-C2zifPY5.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-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
+ 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-CN2818Wt.js";import{C as J}from"./charges-filters-r7FjeZLc.js";import{M as $}from"./index-C0OGGVXE.js";import{P as G}from"./Progress-BEKiyNRK.js";import"./sub-C2zifPY5.js";import"./subMonths-uUfFviD2.js";import"./Checkbox-CpANMiXr.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-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={};/**
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-CN2818Wt.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-iLt1WIM9.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-CN2818Wt.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-iLt1WIM9.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-CN2818Wt.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-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
+ 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-CN2818Wt.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-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";/**
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-CN2818Wt.js";import{A as Gi}from"./arrow-up-down-PQdrJdei.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-C0c5augK.js";import{P as Mu}from"./pencil-BUwX_eHK.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{r as h,j as e,d1 as u,eL as f,B as y,d2 as R,bp as D,F as T,a as E,c as b,L as w,R as F,eN as g}from"./index-iLt1WIM9.js";import{d as v}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{R as d}from"./report-commentary-row-BqTwvfOv.js";function B({year:i,setYear:m,referenceYears:x,setReferenceYears:j}){const[c,o]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(u,{opened:c,onClose:()=>o(!1),withCloseButton:!0,content:e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"Change report year",value:new Date(i,0,1),onChange:n=>n&&m(n?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),e.jsx(f,{type:"multiple",label:"Pick reference years",value:x?.map(n=>new Date(n,0,1)),onChange:n=>j(n.map(l=>l.getFullYear()).filter(l=>i!==l)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(!0),children:e.jsx(R,{className:"size-5"})})]})}const Y=()=>{const{year:i}=D(),{setFiltersContext:m}=h.useContext(T),[x,j]=h.useState(i?Number(i):new Date().getFullYear()),[c,o]=h.useState([]),[{data:n,fetching:l}]=E({query:v(g),variables:{reportYear:x,referenceYears:c}});h.useEffect(()=>{m(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(B,{year:x,setYear:j,referenceYears:c,setReferenceYears:o})}))},[x,l,m,c,o]);const p=n?.taxReport,s=p?.report,r=p?.reference??[];return e.jsx(b,{title:"Tax Report",children:l?e.jsx(w,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:s&&e.jsxs(F,{highlightOnHover:!0,fontSize:"md",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{children:x},x),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.year},t.year))]})}),e.jsxs("tbody",{children:[e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:s.profitBeforeTax.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("th",{children:a.profitBeforeTax.amount.formatted},a.year))]}),commentaryData:s.profitBeforeTax}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses By Records"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesByRecords.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.researchAndDevelopmentExpensesByRecords.amount.formatted},a.year))]}),commentaryData:s.researchAndDevelopmentExpensesByRecords}),e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses For Tax"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesForTax.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.researchAndDevelopmentExpensesForTax.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Fines"}),e.jsx("td",{children:s.fines.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.fines.amount.formatted},a.year))]}),commentaryData:s.fines}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Untaxable Gifts"}),e.jsx("td",{children:s.untaxableGifts.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.untaxableGifts.amount.formatted},a.year))]}),commentaryData:s.untaxableGifts}),e.jsxs("tr",{children:[e.jsx("td",{children:"Business Trips Excess Expenses"}),e.jsx("td",{children:s.businessTripsExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.businessTripsExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Salary Excess Expenses"}),e.jsx("td",{children:s.salaryExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.salaryExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Reserves"}),e.jsx("td",{children:s.reserves.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.reserves.amount.formatted},a.year))]}),commentaryData:s.reserves}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Nontaxable Linkage"}),e.jsx("td",{children:s.nontaxableLinkage.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.nontaxableLinkage.amount.formatted},a.year))]}),commentaryData:s.nontaxableLinkage}),e.jsxs("tr",{children:[e.jsx("th",{children:"Taxable Income"}),e.jsx("th",{children:s.taxableIncome.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.taxableIncome.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Tax Rate"}),e.jsxs("td",{children:[(s.taxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.taxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Income with Special Tax Rate"}),e.jsx("td",{children:s.specialTaxableIncome.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.specialTaxableIncome.amount.formatted},a.year))]}),commentaryData:s.specialTaxableIncome}),e.jsxs("tr",{children:[e.jsx("td",{children:"Special Tax Rate"}),e.jsxs("td",{children:[(s.specialTaxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.specialTaxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]})]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Annual Tax Expense"}),e.jsx("th",{children:s.annualTaxExpense.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.annualTaxExpense.formatted},t.year)),e.jsx("td",{})]})})]})})})};export{Y as TaxReport};
1
+ import{r as h,j as e,d1 as u,eL as f,B as y,d2 as R,bp as D,F as T,a as E,c as b,L as w,R as F,eN as g}from"./index-CN2818Wt.js";import{d as v}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{R as d}from"./report-commentary-row-Bpvvtwpd.js";function B({year:i,setYear:m,referenceYears:x,setReferenceYears:j}){const[c,o]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(u,{opened:c,onClose:()=>o(!1),withCloseButton:!0,content:e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"Change report year",value:new Date(i,0,1),onChange:n=>n&&m(n?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),e.jsx(f,{type:"multiple",label:"Pick reference years",value:x?.map(n=>new Date(n,0,1)),onChange:n=>j(n.map(l=>l.getFullYear()).filter(l=>i!==l)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(!0),children:e.jsx(R,{className:"size-5"})})]})}const Y=()=>{const{year:i}=D(),{setFiltersContext:m}=h.useContext(T),[x,j]=h.useState(i?Number(i):new Date().getFullYear()),[c,o]=h.useState([]),[{data:n,fetching:l}]=E({query:v(g),variables:{reportYear:x,referenceYears:c}});h.useEffect(()=>{m(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(B,{year:x,setYear:j,referenceYears:c,setReferenceYears:o})}))},[x,l,m,c,o]);const p=n?.taxReport,s=p?.report,r=p?.reference??[];return e.jsx(b,{title:"Tax Report",children:l?e.jsx(w,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:s&&e.jsxs(F,{highlightOnHover:!0,fontSize:"md",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{children:x},x),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.year},t.year))]})}),e.jsxs("tbody",{children:[e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:s.profitBeforeTax.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("th",{children:a.profitBeforeTax.amount.formatted},a.year))]}),commentaryData:s.profitBeforeTax}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses By Records"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesByRecords.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.researchAndDevelopmentExpensesByRecords.amount.formatted},a.year))]}),commentaryData:s.researchAndDevelopmentExpensesByRecords}),e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses For Tax"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesForTax.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.researchAndDevelopmentExpensesForTax.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Fines"}),e.jsx("td",{children:s.fines.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.fines.amount.formatted},a.year))]}),commentaryData:s.fines}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Untaxable Gifts"}),e.jsx("td",{children:s.untaxableGifts.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.untaxableGifts.amount.formatted},a.year))]}),commentaryData:s.untaxableGifts}),e.jsxs("tr",{children:[e.jsx("td",{children:"Business Trips Excess Expenses"}),e.jsx("td",{children:s.businessTripsExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.businessTripsExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Salary Excess Expenses"}),e.jsx("td",{children:s.salaryExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.salaryExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Reserves"}),e.jsx("td",{children:s.reserves.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.reserves.amount.formatted},a.year))]}),commentaryData:s.reserves}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Nontaxable Linkage"}),e.jsx("td",{children:s.nontaxableLinkage.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.nontaxableLinkage.amount.formatted},a.year))]}),commentaryData:s.nontaxableLinkage}),e.jsxs("tr",{children:[e.jsx("th",{children:"Taxable Income"}),e.jsx("th",{children:s.taxableIncome.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.taxableIncome.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Tax Rate"}),e.jsxs("td",{children:[(s.taxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.taxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Income with Special Tax Rate"}),e.jsx("td",{children:s.specialTaxableIncome.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.specialTaxableIncome.amount.formatted},a.year))]}),commentaryData:s.specialTaxableIncome}),e.jsxs("tr",{children:[e.jsx("td",{children:"Special Tax Rate"}),e.jsxs("td",{children:[(s.specialTaxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.specialTaxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]})]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Annual Tax Expense"}),e.jsx("th",{children:s.annualTaxExpense.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.annualTaxExpense.formatted},t.year)),e.jsx("td",{})]})})]})})})};export{Y as TaxReport};
@@ -1,4 +1,4 @@
1
- import{d0 as f,r as h,u as B,j as e,d1 as R,bC as N,B as w,d2 as $,k,cf as O,U as A,l as E,bR as v,cj as D,bW as C,bX as F,Y as T,a4 as z,a5 as P,a6 as L,a7 as V,aK as M,d3 as U,dU as _,c2 as S,T as I,P as q,b as G,bg as Z,b6 as j,b1 as p,D as H,dV as J,R as W,cV as y,F as X,a as K,dW as Q,dX as Y,c as ee,L as te,dY as se}from"./index-iLt1WIM9.js";function re(t){return!t||f(t)?null:encodeURIComponent(JSON.stringify(t))}function ae({filter:t,setFilter:s,closeModal:o}){const n=k({defaultValues:{...t}}),{control:a,handleSubmit:l}=n,{selectableBusinesses:r,fetching:u}=O(),{userContext:m}=h.useContext(A),c=i=>{i.fromDate?.trim()===""&&(i.fromDate=void 0),i.toDate?.trim()===""&&(i.toDate=void 0),s(i),o()};function d(){s({}),o()}return e.jsxs(e.Fragment,{children:[u?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(E,{...n,children:e.jsxs("form",{onSubmit:l(c),className:"space-y-2",children:[e.jsx(v,{name:"ownerIds",control:a,defaultValue:void 0,render:({field:i,fieldState:b})=>e.jsx(D,{...i,data:r,value:i.value??(m?.context.adminBusinessId?[m?.context.adminBusinessId]:void 0),disabled:u,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(v,{name:"businessIDs",control:a,defaultValue:void 0,render:({field:i,fieldState:b})=>e.jsx(D,{...i,data:r,value:i.value??void 0,disabled:u,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(v,{name:"fromDate",control:a,defaultValue:t.fromDate,rules:{required:"Required",pattern:{value:C,message:"Date must be im format yyyy-mm-dd"}},render:({field:i,fieldState:b})=>e.jsx(F,{...i,onChange:x=>{const g=x?typeof x=="string"?x:T(x,"yyyy-MM-dd"):void 0;g!==i.value&&i.onChange(g)},value:i.value?new Date(i.value):void 0,label:"From Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(v,{name:"toDate",control:a,defaultValue:t.toDate,rules:{pattern:{value:C,message:"Date must be im format yyyy-mm-dd"}},render:({field:i,fieldState:b})=>e.jsx(F,{...i,onChange:x=>{const g=x?typeof x=="string"?x:T(x,"yyyy-MM-dd"):void 0;g!==i.value&&i.onChange(g)},value:i.value?new Date(i.value):void 0,label:"To Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(z,{name:"isShowZeroedAccounts",control:a,render:({field:i})=>e.jsxs(P,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(L,{children:"Show zeroed accounts"})}),e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(V,{children:e.jsx(M,{defaultChecked:t.isShowZeroedAccounts??!1,onCheckedChange:i.onChange,checked:i.value===!0})}),e.jsx("span",{children:i.value?"show":"remove"})]})]})}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),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:d,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:o,children:"Cancel"})]})]})})]})}function ne({filter:t,setFilter:s}){const[o,n]=h.useState(!1),[a,l]=h.useState(!f(t)),{get:r,set:u}=B();function m(d){return Object.entries(d??{}).filter(([b,x])=>x!==void 0&&Array.isArray(x)&&x.length>0).length>0}function c(d){U(d,t)||(s(d),l(m(d)))}return h.useEffect(()=>{const d=f(t)?null:encodeURIComponent(JSON.stringify(t)),i=r("trialBalanceReportFilters");d!==i&&u("trialBalanceReportFilters",d)},[t,r,u]),e.jsxs(e.Fragment,{children:[e.jsx(R,{opened:o,onClose:()=>n(!1),content:e.jsx(ae,{filter:t,setFilter:c,closeModal:()=>n(!1)})}),e.jsx(N,{inline:!0,size:16,disabled:!a,children:e.jsx(w,{variant:"outline",onClick:()=>n(!0),className:"p-2",children:e.jsx($,{size:20})})})]})}const oe=({data:t,fromDate:s,toDate:o})=>{const n=h.useCallback(async()=>{const a=le(t),l=`trial_balance_report${s?`_${s}`:""}${o?`_${o}`:""}`;return{fileContent:a,fileName:l}},[t,s,o]);return e.jsx(_,{createFileVariables:n})},le=t=>{let s="";s+=`Sort Code,Account Name,Debit,Credit,Balance\r
1
+ import{d0 as f,r as h,u as B,j as e,d1 as R,bC as N,B as w,d2 as $,k,cf as O,U as A,l as E,bR as v,cj as D,bW as C,bX as F,Y as T,a4 as z,a5 as P,a6 as L,a7 as V,aK as M,d3 as U,dU as _,c2 as S,T as I,P as q,b as G,bg as Z,b6 as j,b1 as p,D as H,dV as J,R as W,cV as y,F as X,a as K,dW as Q,dX as Y,c as ee,L as te,dY as se}from"./index-CN2818Wt.js";function re(t){return!t||f(t)?null:encodeURIComponent(JSON.stringify(t))}function ae({filter:t,setFilter:s,closeModal:o}){const n=k({defaultValues:{...t}}),{control:a,handleSubmit:l}=n,{selectableBusinesses:r,fetching:u}=O(),{userContext:m}=h.useContext(A),c=i=>{i.fromDate?.trim()===""&&(i.fromDate=void 0),i.toDate?.trim()===""&&(i.toDate=void 0),s(i),o()};function d(){s({}),o()}return e.jsxs(e.Fragment,{children:[u?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(E,{...n,children:e.jsxs("form",{onSubmit:l(c),className:"space-y-2",children:[e.jsx(v,{name:"ownerIds",control:a,defaultValue:void 0,render:({field:i,fieldState:b})=>e.jsx(D,{...i,data:r,value:i.value??(m?.context.adminBusinessId?[m?.context.adminBusinessId]:void 0),disabled:u,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(v,{name:"businessIDs",control:a,defaultValue:void 0,render:({field:i,fieldState:b})=>e.jsx(D,{...i,data:r,value:i.value??void 0,disabled:u,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(v,{name:"fromDate",control:a,defaultValue:t.fromDate,rules:{required:"Required",pattern:{value:C,message:"Date must be im format yyyy-mm-dd"}},render:({field:i,fieldState:b})=>e.jsx(F,{...i,onChange:x=>{const g=x?typeof x=="string"?x:T(x,"yyyy-MM-dd"):void 0;g!==i.value&&i.onChange(g)},value:i.value?new Date(i.value):void 0,label:"From Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(v,{name:"toDate",control:a,defaultValue:t.toDate,rules:{pattern:{value:C,message:"Date must be im format yyyy-mm-dd"}},render:({field:i,fieldState:b})=>e.jsx(F,{...i,onChange:x=>{const g=x?typeof x=="string"?x:T(x,"yyyy-MM-dd"):void 0;g!==i.value&&i.onChange(g)},value:i.value?new Date(i.value):void 0,label:"To Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(z,{name:"isShowZeroedAccounts",control:a,render:({field:i})=>e.jsxs(P,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(L,{children:"Show zeroed accounts"})}),e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(V,{children:e.jsx(M,{defaultChecked:t.isShowZeroedAccounts??!1,onCheckedChange:i.onChange,checked:i.value===!0})}),e.jsx("span",{children:i.value?"show":"remove"})]})]})}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),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:d,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:o,children:"Cancel"})]})]})})]})}function ne({filter:t,setFilter:s}){const[o,n]=h.useState(!1),[a,l]=h.useState(!f(t)),{get:r,set:u}=B();function m(d){return Object.entries(d??{}).filter(([b,x])=>x!==void 0&&Array.isArray(x)&&x.length>0).length>0}function c(d){U(d,t)||(s(d),l(m(d)))}return h.useEffect(()=>{const d=f(t)?null:encodeURIComponent(JSON.stringify(t)),i=r("trialBalanceReportFilters");d!==i&&u("trialBalanceReportFilters",d)},[t,r,u]),e.jsxs(e.Fragment,{children:[e.jsx(R,{opened:o,onClose:()=>n(!1),content:e.jsx(ae,{filter:t,setFilter:c,closeModal:()=>n(!1)})}),e.jsx(N,{inline:!0,size:16,disabled:!a,children:e.jsx(w,{variant:"outline",onClick:()=>n(!0),className:"p-2",children:e.jsx($,{size:20})})})]})}const oe=({data:t,fromDate:s,toDate:o})=>{const n=h.useCallback(async()=>{const a=le(t),l=`trial_balance_report${s?`_${s}`:""}${o?`_${o}`:""}`;return{fileContent:a,fileName:l}},[t,s,o]);return e.jsx(_,{createFileVariables:n})},le=t=>{let s="";s+=`Sort Code,Account Name,Debit,Credit,Balance\r
2
2
  `;for(const[o,n]of Object.entries(t)){const a=ie(o,n);s+=a}return s+=`Report total:,,${Object.values(t).reduce((o,n)=>o+n.totalDebit,0)},${Object.values(t).reduce((o,n)=>o+n.totalCredit,0)},${Object.values(t).reduce((o,n)=>o+n.sum,0)}\r
3
3
  `,s};function ie(t,s){let o="";return Object.values(s.sortCodes).sort((n,a)=>n.key-a.key).map(n=>{const a=ce(n);o+=a}),o+=`${t.replaceAll("0","*")},Group Total:,${s.totalDebit??""},${s.totalCredit??""},${s.sum}\r
4
4
  `,o}function ce(t){let s="";s+=`${t.name}\r
@@ -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-iLt1WIM9.js";import{B as me,S as xe}from"./save-CMGkGXCM.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-CN2818Wt.js";import{B as me,S as xe}from"./save-Ck68rh6u.js";/**
2
2
  * @license lucide-react v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -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-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(`
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-CN2818Wt.js";import{A as ue,a as he,c as de,b as pe}from"./accordion-ZFVTCyDy.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{j as n,r as x,d1 as v,eL as g,B as D,d2 as R,D as h,f6 as j,bp as E,F as y,a as C,c as w,L as T,R as b,bC as A,eb as F,T as u,f7 as I}from"./index-iLt1WIM9.js";import{d as N}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";const o=({originalAmount:a,diffAmount:t})=>!t||a===t?n.jsx("td",{children:a}):n.jsx("td",{children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:t?"line-through":"",children:a}),t&&n.jsx("div",{className:"border-2 border-yellow-500 rounded-md",children:t})]})});function P({years:a,setYears:t}){const[r,l]=x.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(v,{opened:r,onClose:()=>l(!1),withCloseButton:!0,content:n.jsx(g,{type:"multiple",label:"Pick years",value:a?.map(d=>new Date(d,0,1)),onChange:d=>t(d.map(p=>p.getFullYear())),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})}),n.jsx(D,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(!0),children:n.jsx(R,{className:"size-5"})})]})}const f=({originalRuleData:a,diffRuleData:t})=>{const r=h(j,a),l=h(j,t),d=l?.isCompliant!==r.isCompliant||l?.percentage.formatted!==r.percentage.formatted;return!l||!d?n.jsx("td",{className:r.isCompliant?"text-green-500":"text-red-500",children:r.percentage.formatted}):n.jsx("td",{className:r.isCompliant?"text-green-500":"text-red-500",children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"line-through ".concat(r.isCompliant?"text-green-500":"text-red-500"),children:r.percentage.formatted}),l&&n.jsx("div",{className:"border-2 border-yellow-500 rounded-md ".concat(l.isCompliant?"text-green-500":"text-red-500"),children:l.percentage.formatted})]})})},c=(a,t)=>F(t).format(a);function m(a,t){if(a.length!==0)return c(a.reduce((r,l)=>r+l,0),t)}const B=()=>{const{year:a}=E(),{setFiltersContext:t}=x.useContext(y),[r,l]=x.useState(a?[Number(a)]:[new Date().getFullYear()]),[{data:d,fetching:p}]=C({query:N(I),variables:{years:r}});x.useEffect(()=>{t(n.jsx("div",{className:"flex flex-row gap-2",children:n.jsx(P,{years:r,setYears:l})}))},[r,p,t]);const s=d?.corporateTaxRulingComplianceReport??[];return n.jsx(w,{title:"Corporate Tax Ruling Compliance Report",children:p?n.jsx(T,{className:"h-10 w-10 animate-spin mr-2 self-center"}):n.jsx("div",{className:"flex flex-col gap-4",children:s&&n.jsxs(b,{highlightOnHover:!0,fontSize:"md",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{}),r.map(e=>n.jsx("th",{children:n.jsx(A,{inline:!0,size:12,processing:!s.find(i=>i.year===e)?.differences,disabled:!!s.find(i=>i.year===e)?.differences,color:"orange",zIndex:"auto",children:e})},e)),n.jsx("th",{children:"Summary"},"sum")]})}),n.jsxs("tbody",{children:[n.jsxs("tr",{children:[n.jsx("td",{children:"Total Income"}),s.map(e=>n.jsx(o,{originalAmount:e.totalIncome.formatted,diffAmount:e.differences?.totalIncome?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.totalIncome.raw).reduce((e,i)=>e+i,0),s[0].totalIncome.currency),diffAmount:m(s.map(e=>e.differences?.totalIncome?.raw??e.totalIncome.raw).filter(e=>!!e),s[0].totalIncome.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("td",{children:"Total R&D Expensess"}),s.map(e=>n.jsx(o,{originalAmount:e.researchAndDevelopmentExpenses.formatted,diffAmount:e.differences?.researchAndDevelopmentExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.researchAndDevelopmentExpenses.raw).reduce((e,i)=>e+i,0),s[0].researchAndDevelopmentExpenses.currency),diffAmount:m(s.map(e=>e.differences?.researchAndDevelopmentExpenses?.raw??e.researchAndDevelopmentExpenses.raw).filter(e=>!!e),s[0].researchAndDevelopmentExpenses.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("th",{children:n.jsx(u,{multiline:!0,width:220,transitionProps:{duration:200},label:s[0]?.rndRelativeToIncome.rule,children:n.jsx("p",{children:"R&D Expenses out of Income"})})}),s.map(e=>n.jsx(f,{originalRuleData:e.rndRelativeToIncome,diffRuleData:e.differences?.rndRelativeToIncome??void 0},e.year)),n.jsx("td",{})]}),n.jsxs("tr",{children:[n.jsx("td",{children:"Local Development Expenses"}),s.map(e=>n.jsx(o,{originalAmount:e.localDevelopmentExpenses.formatted,diffAmount:e.differences?.localDevelopmentExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.localDevelopmentExpenses.raw).reduce((e,i)=>e+i,0),s[0].localDevelopmentExpenses.currency),diffAmount:m(s.map(e=>e.differences?.localDevelopmentExpenses?.raw??e.localDevelopmentExpenses.raw).filter(e=>!!e),s[0].localDevelopmentExpenses.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("th",{children:n.jsx(u,{multiline:!0,width:220,transitionProps:{duration:200},label:s[0]?.localDevelopmentRelativeToRnd.rule,children:n.jsx("p",{children:"Local Development out of R&D"})})}),s.map(e=>n.jsx(f,{originalRuleData:e.localDevelopmentRelativeToRnd,diffRuleData:e.differences?.localDevelopmentRelativeToRnd??void 0},e.year)),n.jsx("td",{})]}),n.jsxs("tr",{children:[n.jsx("td",{children:"Foreign Development Expenses"}),s.map(e=>n.jsx(o,{originalAmount:e.foreignDevelopmentExpenses.formatted,diffAmount:e.differences?.foreignDevelopmentExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.foreignDevelopmentExpenses.raw).reduce((e,i)=>e+i,0),s[0].foreignDevelopmentExpenses.currency),diffAmount:m(s.map(e=>e.differences?.foreignDevelopmentExpenses?.raw??e.foreignDevelopmentExpenses.raw).filter(e=>!!e),s[0].foreignDevelopmentExpenses.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("th",{children:n.jsx(u,{multiline:!0,width:220,transitionProps:{duration:200},label:s[0]?.foreignDevelopmentRelativeToRnd.rule,children:n.jsx("p",{children:"Foreign Development out of R&D"})})}),s.map(e=>n.jsx(f,{originalRuleData:e.foreignDevelopmentRelativeToRnd,diffRuleData:e.differences?.foreignDevelopmentRelativeToRnd??void 0},e.year)),n.jsx("td",{})]}),n.jsxs("tr",{children:[n.jsx("td",{children:"R&D Business Trips Expenses"}),s.map(e=>n.jsx(o,{originalAmount:e.businessTripRndExpenses.formatted,diffAmount:e.differences?.businessTripRndExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.businessTripRndExpenses.raw).reduce((e,i)=>e+i,0),s[0].businessTripRndExpenses.currency),diffAmount:m(s.map(e=>e.differences?.businessTripRndExpenses?.raw??e.businessTripRndExpenses.raw).filter(e=>!!e),s[0].businessTripRndExpenses.currency)},"sum")]})]})]})})})};export{B as CorporateTaxRulingComplianceReport};
1
+ import{j as n,r as x,d1 as v,eL as g,B as D,d2 as R,D as h,f6 as j,bp as E,F as y,a as C,c as w,L as T,R as b,bC as A,eb as F,T as u,f7 as I}from"./index-CN2818Wt.js";import{d as N}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";const o=({originalAmount:a,diffAmount:t})=>!t||a===t?n.jsx("td",{children:a}):n.jsx("td",{children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:t?"line-through":"",children:a}),t&&n.jsx("div",{className:"border-2 border-yellow-500 rounded-md",children:t})]})});function P({years:a,setYears:t}){const[r,l]=x.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(v,{opened:r,onClose:()=>l(!1),withCloseButton:!0,content:n.jsx(g,{type:"multiple",label:"Pick years",value:a?.map(d=>new Date(d,0,1)),onChange:d=>t(d.map(p=>p.getFullYear())),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})}),n.jsx(D,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(!0),children:n.jsx(R,{className:"size-5"})})]})}const f=({originalRuleData:a,diffRuleData:t})=>{const r=h(j,a),l=h(j,t),d=l?.isCompliant!==r.isCompliant||l?.percentage.formatted!==r.percentage.formatted;return!l||!d?n.jsx("td",{className:r.isCompliant?"text-green-500":"text-red-500",children:r.percentage.formatted}):n.jsx("td",{className:r.isCompliant?"text-green-500":"text-red-500",children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"line-through ".concat(r.isCompliant?"text-green-500":"text-red-500"),children:r.percentage.formatted}),l&&n.jsx("div",{className:"border-2 border-yellow-500 rounded-md ".concat(l.isCompliant?"text-green-500":"text-red-500"),children:l.percentage.formatted})]})})},c=(a,t)=>F(t).format(a);function m(a,t){if(a.length!==0)return c(a.reduce((r,l)=>r+l,0),t)}const B=()=>{const{year:a}=E(),{setFiltersContext:t}=x.useContext(y),[r,l]=x.useState(a?[Number(a)]:[new Date().getFullYear()]),[{data:d,fetching:p}]=C({query:N(I),variables:{years:r}});x.useEffect(()=>{t(n.jsx("div",{className:"flex flex-row gap-2",children:n.jsx(P,{years:r,setYears:l})}))},[r,p,t]);const s=d?.corporateTaxRulingComplianceReport??[];return n.jsx(w,{title:"Corporate Tax Ruling Compliance Report",children:p?n.jsx(T,{className:"h-10 w-10 animate-spin mr-2 self-center"}):n.jsx("div",{className:"flex flex-col gap-4",children:s&&n.jsxs(b,{highlightOnHover:!0,fontSize:"md",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{}),r.map(e=>n.jsx("th",{children:n.jsx(A,{inline:!0,size:12,processing:!s.find(i=>i.year===e)?.differences,disabled:!!s.find(i=>i.year===e)?.differences,color:"orange",zIndex:"auto",children:e})},e)),n.jsx("th",{children:"Summary"},"sum")]})}),n.jsxs("tbody",{children:[n.jsxs("tr",{children:[n.jsx("td",{children:"Total Income"}),s.map(e=>n.jsx(o,{originalAmount:e.totalIncome.formatted,diffAmount:e.differences?.totalIncome?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.totalIncome.raw).reduce((e,i)=>e+i,0),s[0].totalIncome.currency),diffAmount:m(s.map(e=>e.differences?.totalIncome?.raw??e.totalIncome.raw).filter(e=>!!e),s[0].totalIncome.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("td",{children:"Total R&D Expensess"}),s.map(e=>n.jsx(o,{originalAmount:e.researchAndDevelopmentExpenses.formatted,diffAmount:e.differences?.researchAndDevelopmentExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.researchAndDevelopmentExpenses.raw).reduce((e,i)=>e+i,0),s[0].researchAndDevelopmentExpenses.currency),diffAmount:m(s.map(e=>e.differences?.researchAndDevelopmentExpenses?.raw??e.researchAndDevelopmentExpenses.raw).filter(e=>!!e),s[0].researchAndDevelopmentExpenses.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("th",{children:n.jsx(u,{multiline:!0,width:220,transitionProps:{duration:200},label:s[0]?.rndRelativeToIncome.rule,children:n.jsx("p",{children:"R&D Expenses out of Income"})})}),s.map(e=>n.jsx(f,{originalRuleData:e.rndRelativeToIncome,diffRuleData:e.differences?.rndRelativeToIncome??void 0},e.year)),n.jsx("td",{})]}),n.jsxs("tr",{children:[n.jsx("td",{children:"Local Development Expenses"}),s.map(e=>n.jsx(o,{originalAmount:e.localDevelopmentExpenses.formatted,diffAmount:e.differences?.localDevelopmentExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.localDevelopmentExpenses.raw).reduce((e,i)=>e+i,0),s[0].localDevelopmentExpenses.currency),diffAmount:m(s.map(e=>e.differences?.localDevelopmentExpenses?.raw??e.localDevelopmentExpenses.raw).filter(e=>!!e),s[0].localDevelopmentExpenses.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("th",{children:n.jsx(u,{multiline:!0,width:220,transitionProps:{duration:200},label:s[0]?.localDevelopmentRelativeToRnd.rule,children:n.jsx("p",{children:"Local Development out of R&D"})})}),s.map(e=>n.jsx(f,{originalRuleData:e.localDevelopmentRelativeToRnd,diffRuleData:e.differences?.localDevelopmentRelativeToRnd??void 0},e.year)),n.jsx("td",{})]}),n.jsxs("tr",{children:[n.jsx("td",{children:"Foreign Development Expenses"}),s.map(e=>n.jsx(o,{originalAmount:e.foreignDevelopmentExpenses.formatted,diffAmount:e.differences?.foreignDevelopmentExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.foreignDevelopmentExpenses.raw).reduce((e,i)=>e+i,0),s[0].foreignDevelopmentExpenses.currency),diffAmount:m(s.map(e=>e.differences?.foreignDevelopmentExpenses?.raw??e.foreignDevelopmentExpenses.raw).filter(e=>!!e),s[0].foreignDevelopmentExpenses.currency)},"sum")]}),n.jsxs("tr",{children:[n.jsx("th",{children:n.jsx(u,{multiline:!0,width:220,transitionProps:{duration:200},label:s[0]?.foreignDevelopmentRelativeToRnd.rule,children:n.jsx("p",{children:"Foreign Development out of R&D"})})}),s.map(e=>n.jsx(f,{originalRuleData:e.foreignDevelopmentRelativeToRnd,diffRuleData:e.differences?.foreignDevelopmentRelativeToRnd??void 0},e.year)),n.jsx("td",{})]}),n.jsxs("tr",{children:[n.jsx("td",{children:"R&D Business Trips Expenses"}),s.map(e=>n.jsx(o,{originalAmount:e.businessTripRndExpenses.formatted,diffAmount:e.differences?.businessTripRndExpenses?.formatted??void 0},e.year)),n.jsx(o,{originalAmount:c(s.map(e=>e.businessTripRndExpenses.raw).reduce((e,i)=>e+i,0),s[0].businessTripRndExpenses.currency),diffAmount:m(s.map(e=>e.differences?.businessTripRndExpenses?.raw??e.businessTripRndExpenses.raw).filter(e=>!!e),s[0].businessTripRndExpenses.currency)},"sum")]})]})]})})})};export{B as CorporateTaxRulingComplianceReport};
@@ -1,4 +1,4 @@
1
- import{V,p as B,eC as q,r,t as k,s as F,a as $,eD as _,j as s,w as L,eE as R,x as H,B as Q,y as X,z as G}from"./index-iLt1WIM9.js";import{C as J,M as K}from"./Checkbox-iZ--iyJF.js";/**
1
+ import{V,p as B,eC as q,r,t as k,s as F,a as $,eD as _,j as s,w as L,eE as R,x as H,B as Q,y as X,z as G}from"./index-CN2818Wt.js";import{C as J,M as K}from"./Checkbox-CpANMiXr.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{r as c,a as N,i as k,j as e,e as w,U as E,k as z,l as D,m as L,n as A,o as T,p as O,q as P,t as B,s as R,v as U,w as $,x as q,B as C,y as S,z as H,D as v,G as _,H as Q,P as F,b as I,J as V,K as G,N as J,u as M,O as K,Q as W,F as X,T as Y,c as Z,L as ee,R as se,S as te}from"./index-iLt1WIM9.js";import{C as ne,M as ie}from"./Checkbox-iZ--iyJF.js";import{u as ae,S as re}from"./similar-charges-by-business-modal-Dj7iCQhJ.js";function oe({businessID:t,updateBusiness:n}){const[r,u]=c.useState(void 0),[{data:o,fetching:i},l]=N({query:k,variables:{id:t}});return c.useEffect(()=>{i?u(void 0):o&&o.business.__typename==="LtdFinancialEntity"&&u(o.business)},[o,i]),c.useEffect(()=>{r&&n(r)},[r,n]),e.jsx("div",{className:"flex flex-col gap-5",children:r?e.jsx(le,{business:r,refetchBusiness:l}):i?e.jsx(w,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}):e.jsx("p",{children:"Error fetching extended information for this business"})})}function le({business:t,refetchBusiness:n}){const[r,u]=c.useState(!1),[o,i]=c.useState(!1),[l,d]=c.useState(void 0),{userContext:g}=c.useContext(E),{updateBusiness:f,fetching:a}=ae(),x=z({defaultValues:{...t,taxCategory:t.taxCategory?.id,sortCode:t?.sortCode?.key,irsCode:t?.irsCode}}),{handleSubmit:p,formState:{dirtyFields:h}}=x,b=async j=>{if(!t||!g?.context.adminBusinessId)return;const s=T(j,h);s&&Object.keys(s).length>0&&(s.sortCode&&=parseInt(s.sortCode.toString()),s.suggestions?.tags&&(s.suggestions.tags=s.suggestions.tags.map(m=>({id:m.id}))),s.suggestions?.phrases&&(s.suggestions.phrases=j.suggestions.phrases.map(m=>m)),s.suggestions?.emails&&(s.suggestions.emails=j.suggestions.emails.map(m=>m)),s.suggestions?.emailListener&&(s.suggestions.emailListener.attachments&&=j.suggestions.emailListener.attachments.map(m=>m),s.suggestions.emailListener.internalEmailLinks&&=j.suggestions.emailListener.internalEmailLinks.map(m=>m)),await f({businessId:t.id,ownerId:g.context.adminBusinessId,fields:s}),s.suggestions?.tags?.length||s.suggestions?.description?(d({tagIds:s.suggestions?.tags?.map(m=>({id:m.id})),description:s.suggestions?.description??void 0}),i(!0)):n())};return e.jsxs(e.Fragment,{children:[r&&e.jsx(w,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}),e.jsx("div",{className:"flex flex-row gap-5",children:e.jsx(D,{...x,children:e.jsxs("form",{onSubmit:p(b),children:[e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Edit Business:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["ID: ",t.id,e.jsx(L,{content:t.id})]})]}),e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsx(A,{isInsert:!1,formManager:x,setFetching:u})}),e.jsx("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:e.jsx("button",{type:"submit",onClick:()=>p(b),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:a||Object.keys(h).length===0,children:"Update"})})]})})}),e.jsx(re,{businessId:t.id,tagIds:l?.tagIds,description:l?.description,open:o,onOpenChange:i,onClose:n})]})}const ce="mergeBusinesses",de=()=>{const[{fetching:t},n]=O(P),r=c.useCallback(async u=>{const o=`Error merging into business ID [${u.targetBusinessId}]`,i=`${ce}-${u.targetBusinessId}`;B.loading("Merging Businesses",{id:i});try{const l=await n(u),d=R(l,o,i);if(d)return B.success("Success",{id:i,description:"Businesses merged"}),d.mergeBusinesses.id}catch(l){console.error(`${o}: ${l}`),B.error("Error",{id:i,description:o,duration:1e5,closeButton:!0})}},[n]);return{fetching:t,mergeBusinesses:r}};function ue({businessIds:t,onDone:n,resetMerge:r}){const{mergeBusinesses:u,fetching:o}=de(),i=Array.from(new Set(t)),[{data:l,fetching:d}]=N({query:U,variables:{businessIds:i}}),[g,f]=c.useState(l?.businesses[0]),a=l?.businesses.length!==i.length&&"Some businesses were not Found"||void 0,x=l?.businesses||[],p=c.useCallback(async()=>{if(!g){B.error("Error",{description:"No main business selected"});return}if(i.length<2){B.error("Error",{description:"At least 2 businesses are required to execute a merge"});return}return await u({targetBusinessId:g.id,businessIdsToMerge:i.filter(h=>h!==g.id)}),r(),n()},[g,i,u,n,r]);return e.jsxs(e.Fragment,{children:[d&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx($,{})}),!d&&a&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx("h3",{className:"sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900",children:a})}),!d&&!a&&e.jsxs(e.Fragment,{children:[e.jsxs("table",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:"Main"}),x.map(h=>e.jsx("td",{children:e.jsx("div",{className:"flex items-center justify-center mx-2 px-2 py-2 border-2 border-b-0 rounded-t-xl",children:e.jsx(ne,{checked:h.id===g?.id,size:"xl",onClick:()=>{f(h)}})})},h.id))]}),e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),x.map(h=>e.jsx("td",{children:h.name},h.id))]})]}),e.jsxs("div",{className:"flex justify-center gap-5 mt-5",children:[e.jsx("button",{type:"button",className:" text-white bg-blue-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-blue-600 rounded-sm text-lg",disabled:d||o,onClick:p,children:"Accept"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:n,children:"Cancel"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:()=>{r(),n()},children:"Reset Merge"})]})]})]})}function ge(t){const[n,{close:r,open:u}]=q(!1),{selected:o,resetMerge:i}=t,l=new Set(o.map(({id:x})=>x)),d=l.size>=1,[g,f]=c.useState(d?"default":"outline");c.useEffect(()=>{f(d?"default":"outline")},[d]);const a=c.useCallback(()=>{r(),o.map(({onChange:x})=>x())},[o,r]);return e.jsxs(e.Fragment,{children:[e.jsx(C,{onClick:()=>{d&&u()},disabled:!d,variant:g,className:S("size-7.5",d?" bg-blue-500 hover:bg-blue-500/90":""),size:"icon",children:e.jsx(ie,{className:"size-5"})}),e.jsx(H,{opened:n,onClose:r,size:"auto",centered:!0,children:e.jsx(ue,{businessIds:Array.from(l),onDone:a,resetMerge:i})})]})}const me=({data:t})=>{const n=v(_,t);return e.jsx("td",{children:e.jsx("div",{style:{whiteSpace:"nowrap"},children:n.hebrewName})})},xe=({data:t})=>{const n=v(Q,t);return e.jsx("td",{children:e.jsx("div",{style:{whiteSpace:"nowrap"},children:n.name})})},he=({data:t,isAllOpened:n,toggleMergeBusiness:r,isSelectedForMerge:u})=>{const[o,i]=c.useState(!1),[l,d]=c.useState(v(J,t));return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx(xe,{data:l}),e.jsx(me,{data:l}),e.jsx("td",{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(C,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>{i(g=>!g)},children:n||o?e.jsx(F,{className:"size-5"}):e.jsx(I,{className:"size-5"})}),r&&e.jsx(V,{toggleMergeSelected:()=>r(()=>{}),mergeSelected:u})]})})]}),(n||o)&&e.jsx("tr",{children:e.jsx("td",{colSpan:12,children:e.jsx(G,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:e.jsx(oe,{businessID:l.id,updateBusiness:d})})})})]})};function fe({activePage:t,setPage:n,totalPages:r=1,businessName:u,setBusinessName:o}){const{get:i,set:l}=M(),[d,g]=c.useState(u);c.useEffect(()=>{const a=t>1?t.toFixed(0):void 0,x=i("page");a!==x&&a!=="1"&&l("page",a)},[t,i,l]),c.useEffect(()=>{const a=setTimeout(()=>{o(d)},600);return()=>{clearTimeout(a)}},[d,o]);const f=a=>{g(a)};return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(K,{className:"flex-auto",value:t,onChange:n,total:r}),e.jsx(W,{className:"w-72",placeholder:"Business Name",defaultValue:u??void 0,onChange:a=>f(a.target.value===""?void 0:a.target.value)})]})}const Be=()=>{const{get:t}=M(),[n,r]=c.useState(!1),[u,o]=c.useState(t("page")?Number(t("page")):1),[i,l]=c.useState(t("name")?t("page"):void 0),{setFiltersContext:d}=c.useContext(X),[{data:g,fetching:f}]=N({query:te,variables:{page:u,limit:100,name:i}}),[a,x]=c.useState([]),p=c.useCallback((s,m)=>{a.map(y=>y.id).includes(s)?x(a.filter(y=>y.id!==s)):x([...a,{id:s,onChange:m}])},[a]);function h(){x([])}c.useEffect(()=>{d(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(fe,{activePage:u,setPage:o,businessName:i,setBusinessName:l,totalPages:g?.allBusinesses?.pageInfo.totalPages}),e.jsx(Y,{label:"Expand all businesses",children:e.jsx(C,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(s=>!s),children:n?e.jsx(F,{className:"size-5"}):e.jsx(I,{className:"size-5"})})}),e.jsx(ge,{selected:a,resetMerge:h})]}))},[g,u,i,n,d,o,l,r,a]);const b=g?.allBusinesses?.nodes.filter(s=>s.__typename==="LtdFinancialEntity").sort((s,m)=>s.name.toLowerCase()>m.name.toLowerCase()?1:-1)??[],j=new Set(a.map(s=>s.id));return e.jsx(Z,{title:`Businesses (${b.length})`,description:"All businesses",children:f?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(ee,{className:S("h-10 w-10 animate-spin mr-2")})}):e.jsxs(se,{striped:!0,highlightOnHover:!0,children:[e.jsx("thead",{className:"sticky top-0 z-20",children:e.jsxs("tr",{className:"px-10 py-10 title-font tracking-wider font-medium text-gray-900 text-sm bg-gray-100 rounded-tl rounded-bl",children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Hebrew Name"}),e.jsx("th",{children:"More Info"})]})}),e.jsx("tbody",{children:b.map(s=>e.jsx(he,{data:s,isAllOpened:n,toggleMergeBusiness:p?m=>p(s.id,m):void 0,isSelectedForMerge:j.has(s.id)??!1},s.id))})]})})};export{Be as Businesses};
1
+ import{r as c,a as N,i as k,j as e,e as w,U as E,k as z,l as D,m as L,n as A,o as T,p as O,q as P,t as B,s as R,v as U,w as $,x as q,B as C,y as S,z as H,D as v,G as _,H as Q,P as F,b as I,J as V,K as G,N as J,u as M,O as K,Q as W,F as X,T as Y,c as Z,L as ee,R as se,S as te}from"./index-CN2818Wt.js";import{C as ne,M as ie}from"./Checkbox-CpANMiXr.js";import{u as ae,S as re}from"./similar-charges-by-business-modal-bUtiFfAw.js";function oe({businessID:t,updateBusiness:n}){const[r,u]=c.useState(void 0),[{data:o,fetching:i},l]=N({query:k,variables:{id:t}});return c.useEffect(()=>{i?u(void 0):o&&o.business.__typename==="LtdFinancialEntity"&&u(o.business)},[o,i]),c.useEffect(()=>{r&&n(r)},[r,n]),e.jsx("div",{className:"flex flex-col gap-5",children:r?e.jsx(le,{business:r,refetchBusiness:l}):i?e.jsx(w,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}):e.jsx("p",{children:"Error fetching extended information for this business"})})}function le({business:t,refetchBusiness:n}){const[r,u]=c.useState(!1),[o,i]=c.useState(!1),[l,d]=c.useState(void 0),{userContext:g}=c.useContext(E),{updateBusiness:f,fetching:a}=ae(),x=z({defaultValues:{...t,taxCategory:t.taxCategory?.id,sortCode:t?.sortCode?.key,irsCode:t?.irsCode}}),{handleSubmit:p,formState:{dirtyFields:h}}=x,b=async j=>{if(!t||!g?.context.adminBusinessId)return;const s=T(j,h);s&&Object.keys(s).length>0&&(s.sortCode&&=parseInt(s.sortCode.toString()),s.suggestions?.tags&&(s.suggestions.tags=s.suggestions.tags.map(m=>({id:m.id}))),s.suggestions?.phrases&&(s.suggestions.phrases=j.suggestions.phrases.map(m=>m)),s.suggestions?.emails&&(s.suggestions.emails=j.suggestions.emails.map(m=>m)),s.suggestions?.emailListener&&(s.suggestions.emailListener.attachments&&=j.suggestions.emailListener.attachments.map(m=>m),s.suggestions.emailListener.internalEmailLinks&&=j.suggestions.emailListener.internalEmailLinks.map(m=>m)),await f({businessId:t.id,ownerId:g.context.adminBusinessId,fields:s}),s.suggestions?.tags?.length||s.suggestions?.description?(d({tagIds:s.suggestions?.tags?.map(m=>({id:m.id})),description:s.suggestions?.description??void 0}),i(!0)):n())};return e.jsxs(e.Fragment,{children:[r&&e.jsx(w,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}),e.jsx("div",{className:"flex flex-row gap-5",children:e.jsx(D,{...x,children:e.jsxs("form",{onSubmit:p(b),children:[e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Edit Business:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["ID: ",t.id,e.jsx(L,{content:t.id})]})]}),e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsx(A,{isInsert:!1,formManager:x,setFetching:u})}),e.jsx("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:e.jsx("button",{type:"submit",onClick:()=>p(b),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:a||Object.keys(h).length===0,children:"Update"})})]})})}),e.jsx(re,{businessId:t.id,tagIds:l?.tagIds,description:l?.description,open:o,onOpenChange:i,onClose:n})]})}const ce="mergeBusinesses",de=()=>{const[{fetching:t},n]=O(P),r=c.useCallback(async u=>{const o=`Error merging into business ID [${u.targetBusinessId}]`,i=`${ce}-${u.targetBusinessId}`;B.loading("Merging Businesses",{id:i});try{const l=await n(u),d=R(l,o,i);if(d)return B.success("Success",{id:i,description:"Businesses merged"}),d.mergeBusinesses.id}catch(l){console.error(`${o}: ${l}`),B.error("Error",{id:i,description:o,duration:1e5,closeButton:!0})}},[n]);return{fetching:t,mergeBusinesses:r}};function ue({businessIds:t,onDone:n,resetMerge:r}){const{mergeBusinesses:u,fetching:o}=de(),i=Array.from(new Set(t)),[{data:l,fetching:d}]=N({query:U,variables:{businessIds:i}}),[g,f]=c.useState(l?.businesses[0]),a=l?.businesses.length!==i.length&&"Some businesses were not Found"||void 0,x=l?.businesses||[],p=c.useCallback(async()=>{if(!g){B.error("Error",{description:"No main business selected"});return}if(i.length<2){B.error("Error",{description:"At least 2 businesses are required to execute a merge"});return}return await u({targetBusinessId:g.id,businessIdsToMerge:i.filter(h=>h!==g.id)}),r(),n()},[g,i,u,n,r]);return e.jsxs(e.Fragment,{children:[d&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx($,{})}),!d&&a&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx("h3",{className:"sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900",children:a})}),!d&&!a&&e.jsxs(e.Fragment,{children:[e.jsxs("table",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:"Main"}),x.map(h=>e.jsx("td",{children:e.jsx("div",{className:"flex items-center justify-center mx-2 px-2 py-2 border-2 border-b-0 rounded-t-xl",children:e.jsx(ne,{checked:h.id===g?.id,size:"xl",onClick:()=>{f(h)}})})},h.id))]}),e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),x.map(h=>e.jsx("td",{children:h.name},h.id))]})]}),e.jsxs("div",{className:"flex justify-center gap-5 mt-5",children:[e.jsx("button",{type:"button",className:" text-white bg-blue-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-blue-600 rounded-sm text-lg",disabled:d||o,onClick:p,children:"Accept"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:n,children:"Cancel"}),e.jsx("button",{type:"button",className:" text-white bg-red-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-red-600 rounded-sm text-lg",onClick:()=>{r(),n()},children:"Reset Merge"})]})]})]})}function ge(t){const[n,{close:r,open:u}]=q(!1),{selected:o,resetMerge:i}=t,l=new Set(o.map(({id:x})=>x)),d=l.size>=1,[g,f]=c.useState(d?"default":"outline");c.useEffect(()=>{f(d?"default":"outline")},[d]);const a=c.useCallback(()=>{r(),o.map(({onChange:x})=>x())},[o,r]);return e.jsxs(e.Fragment,{children:[e.jsx(C,{onClick:()=>{d&&u()},disabled:!d,variant:g,className:S("size-7.5",d?" bg-blue-500 hover:bg-blue-500/90":""),size:"icon",children:e.jsx(ie,{className:"size-5"})}),e.jsx(H,{opened:n,onClose:r,size:"auto",centered:!0,children:e.jsx(ue,{businessIds:Array.from(l),onDone:a,resetMerge:i})})]})}const me=({data:t})=>{const n=v(_,t);return e.jsx("td",{children:e.jsx("div",{style:{whiteSpace:"nowrap"},children:n.hebrewName})})},xe=({data:t})=>{const n=v(Q,t);return e.jsx("td",{children:e.jsx("div",{style:{whiteSpace:"nowrap"},children:n.name})})},he=({data:t,isAllOpened:n,toggleMergeBusiness:r,isSelectedForMerge:u})=>{const[o,i]=c.useState(!1),[l,d]=c.useState(v(J,t));return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx(xe,{data:l}),e.jsx(me,{data:l}),e.jsx("td",{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(C,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>{i(g=>!g)},children:n||o?e.jsx(F,{className:"size-5"}):e.jsx(I,{className:"size-5"})}),r&&e.jsx(V,{toggleMergeSelected:()=>r(()=>{}),mergeSelected:u})]})})]}),(n||o)&&e.jsx("tr",{children:e.jsx("td",{colSpan:12,children:e.jsx(G,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:e.jsx(oe,{businessID:l.id,updateBusiness:d})})})})]})};function fe({activePage:t,setPage:n,totalPages:r=1,businessName:u,setBusinessName:o}){const{get:i,set:l}=M(),[d,g]=c.useState(u);c.useEffect(()=>{const a=t>1?t.toFixed(0):void 0,x=i("page");a!==x&&a!=="1"&&l("page",a)},[t,i,l]),c.useEffect(()=>{const a=setTimeout(()=>{o(d)},600);return()=>{clearTimeout(a)}},[d,o]);const f=a=>{g(a)};return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(K,{className:"flex-auto",value:t,onChange:n,total:r}),e.jsx(W,{className:"w-72",placeholder:"Business Name",defaultValue:u??void 0,onChange:a=>f(a.target.value===""?void 0:a.target.value)})]})}const Be=()=>{const{get:t}=M(),[n,r]=c.useState(!1),[u,o]=c.useState(t("page")?Number(t("page")):1),[i,l]=c.useState(t("name")?t("page"):void 0),{setFiltersContext:d}=c.useContext(X),[{data:g,fetching:f}]=N({query:te,variables:{page:u,limit:100,name:i}}),[a,x]=c.useState([]),p=c.useCallback((s,m)=>{a.map(y=>y.id).includes(s)?x(a.filter(y=>y.id!==s)):x([...a,{id:s,onChange:m}])},[a]);function h(){x([])}c.useEffect(()=>{d(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(fe,{activePage:u,setPage:o,businessName:i,setBusinessName:l,totalPages:g?.allBusinesses?.pageInfo.totalPages}),e.jsx(Y,{label:"Expand all businesses",children:e.jsx(C,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(s=>!s),children:n?e.jsx(F,{className:"size-5"}):e.jsx(I,{className:"size-5"})})}),e.jsx(ge,{selected:a,resetMerge:h})]}))},[g,u,i,n,d,o,l,r,a]);const b=g?.allBusinesses?.nodes.filter(s=>s.__typename==="LtdFinancialEntity").sort((s,m)=>s.name.toLowerCase()>m.name.toLowerCase()?1:-1)??[],j=new Set(a.map(s=>s.id));return e.jsx(Z,{title:`Businesses (${b.length})`,description:"All businesses",children:f?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx(ee,{className:S("h-10 w-10 animate-spin mr-2")})}):e.jsxs(se,{striped:!0,highlightOnHover:!0,children:[e.jsx("thead",{className:"sticky top-0 z-20",children:e.jsxs("tr",{className:"px-10 py-10 title-font tracking-wider font-medium text-gray-900 text-sm bg-gray-100 rounded-tl rounded-bl",children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Hebrew Name"}),e.jsx("th",{children:"More Info"})]})}),e.jsx("tbody",{children:b.map(s=>e.jsx(he,{data:s,isAllOpened:n,toggleMergeBusiness:p?m=>p(s.id,m):void 0,isSelectedForMerge:j.has(s.id)??!1},s.id))})]})})};export{Be as Businesses};