@accounter/client 0.0.8-alpha-20251022132023-9f41aae2ce16f8761101edc548f486cc6ce80333 → 0.0.8-alpha-20251022132444-51d3ebadb2849ea323e03b88c735cdca4f91db7d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -25
- package/dist/assets/index-B2UYAO1O.css +1 -0
- package/dist/assets/index-BexxGuN6.js +1224 -0
- package/dist/assets/{index.es-CL8po8bM.js → index.es-CWwhWGxX.js} +5 -5
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/components/business-transactions/business-extended-info.tsx +15 -13
- package/src/components/business-transactions/business-transactions-single.tsx +3 -3
- package/src/components/business-transactions/index.tsx +1 -12
- package/src/components/business-trips/business-trip.tsx +3 -3
- package/src/components/charges/cells/business-trip.tsx +8 -6
- package/src/components/charges/cells/counterparty.tsx +5 -7
- package/src/components/common/accounter-table.tsx +5 -6
- package/src/components/common/business-trip-report/parts/core-expense-row.tsx +9 -11
- package/src/components/common/business-trip-report/parts/uncategorized-transactions.tsx +13 -11
- package/src/components/common/buttons/button-with-label.tsx +41 -0
- package/src/components/common/buttons/button.tsx +44 -0
- package/src/components/common/buttons/index.ts +2 -0
- package/src/components/common/buttons/logout-button.tsx +6 -7
- package/src/components/common/documents-to-charge-matcher/selection-handler/index.tsx +2 -4
- package/src/components/common/documents-to-charge-matcher/selection-handler/wide-filtered-selection.tsx +7 -5
- package/src/components/common/forms/edit-document.tsx +10 -21
- package/src/components/common/new-documents-list.tsx +8 -10
- package/src/components/documents-table/cells/creditor.tsx +4 -11
- package/src/components/documents-table/cells/debtor.tsx +4 -11
- package/src/components/layout/dashboard-layout.tsx +0 -4
- package/src/components/layout/sidelinks.tsx +27 -28
- package/src/components/ledger-table/counterparty-cell.tsx +13 -19
- package/src/components/login-page.tsx +1 -2
- package/src/components/reports/corporate-tax-ruling-compliance-report/index.tsx +3 -3
- package/src/components/reports/profit-and-loss-report/index.tsx +3 -3
- package/src/components/reports/tax-report/index.tsx +3 -3
- package/src/components/screens/businesses/business.tsx +9 -21
- package/src/components/screens/charges/charge.tsx +9 -22
- package/src/components/transactions-table/cells/counterparty.tsx +2 -9
- package/src/components/transactions-table/cells-legacy/counterparty.tsx +2 -9
- package/src/gql/graphql.ts +4842 -1554
- package/src/index.tsx +22 -4
- package/src/providers/auth-guard.tsx +23 -14
- package/src/providers/index.tsx +2 -7
- package/src/providers/urql.tsx +12 -7
- package/src/providers/user-provider.tsx +2 -3
- package/dist/assets/Checkbox-DBF5r7jA.js +0 -6
- package/dist/assets/Progress-Cjv9yrat.js +0 -1
- package/dist/assets/Typography-DdVppmQe.js +0 -1
- package/dist/assets/accordion-DcMd-Til.js +0 -1
- package/dist/assets/accountant-approvals-CU_EA64d.js +0 -1
- package/dist/assets/all-charges-DKGmrDeD.js +0 -1
- package/dist/assets/arrow-up-down-BeIaAKWn.js +0 -6
- package/dist/assets/business-EtSaFzKh.js +0 -37
- package/dist/assets/business-transactions-single-B0Up2Bs4.js +0 -1
- package/dist/assets/business-trip-CmMmdjCh.js +0 -1
- package/dist/assets/charges-filters-CqWjSIKI.js +0 -1
- package/dist/assets/charges-ledger-validation-DHfLjNlq.js +0 -1
- package/dist/assets/chart-D1Y6fN3z.js +0 -74
- package/dist/assets/data-table-pagination-BCciANKD.js +0 -11
- package/dist/assets/editable-business-trip-VNJjiYOp.js +0 -16
- package/dist/assets/graphql-document-dedupe-fragments-ByT8-wlV.js +0 -1
- package/dist/assets/index-1L3dEkVN.js +0 -1
- package/dist/assets/index-4ZIYAzBJ.js +0 -1
- package/dist/assets/index-4r9JDo8p.js +0 -1
- package/dist/assets/index-BFHiMLVc.js +0 -1
- package/dist/assets/index-BGmhxff9.js +0 -1
- package/dist/assets/index-BMcyYDGt.js +0 -11
- package/dist/assets/index-BVQkLk5i.js +0 -1
- package/dist/assets/index-Bj3HckU6.js +0 -876
- package/dist/assets/index-BnQW4CTb.js +0 -1
- package/dist/assets/index-C0FVazZA.js +0 -24
- package/dist/assets/index-CUDeasQ_.js +0 -1
- package/dist/assets/index-Cfm6e2hX.js +0 -1
- package/dist/assets/index-Cqz-mRoO.js +0 -17
- package/dist/assets/index-Cs7MeC4J.js +0 -137
- package/dist/assets/index-CzzfC-dD.css +0 -1
- package/dist/assets/index-DABsOOfA.js +0 -1
- package/dist/assets/index-DB4BgQdp.js +0 -2
- package/dist/assets/index-DV-Q6DUw.js +0 -1
- package/dist/assets/index-Dd5ylSyH.js +0 -9
- package/dist/assets/index-Dn7p3J8Q.js +0 -1
- package/dist/assets/index-Dpk6i3ex.js +0 -6
- package/dist/assets/index-EiT4SOpW.js +0 -2
- package/dist/assets/index-rcKvu7eR.js +0 -6
- package/dist/assets/index-sDbz8nnb.js +0 -1
- package/dist/assets/issue-document-CYdlZijI.js +0 -1
- package/dist/assets/login-page-CnMdssTN.js +0 -1
- package/dist/assets/missing-info-charges-CzeKbCyG.js +0 -1
- package/dist/assets/page-not-found-Bsa0DCM4.js +0 -1
- package/dist/assets/pencil-BMWYIsZB.js +0 -6
- package/dist/assets/report-commentary-row-D9AtKtZx.js +0 -1
- package/dist/assets/save-DC_eQcBj.js +0 -11
- package/dist/assets/sequential-CAnleQny.js +0 -1
- package/dist/assets/similar-charges-by-business-modal-Dmb2ZymF.js +0 -1
- package/dist/assets/sub-BIMwxqar.js +0 -1
- package/dist/assets/subMonths-B7SR4Lli.js +0 -1
- package/src/components/error-boundary.tsx +0 -189
- package/src/components/layout/breadcrumbs.tsx +0 -72
- package/src/components/layout/document-title.tsx +0 -26
- package/src/components/layout/navigation-progress.tsx +0 -52
- package/src/components/layout/page-skeleton.tsx +0 -49
- package/src/providers/urql-client.ts +0 -86
- package/src/router/config.tsx +0 -534
- package/src/router/layouts/dashboard-layout.tsx +0 -20
- package/src/router/layouts/root-layout.tsx +0 -69
- package/src/router/loaders/auth-loader.ts +0 -32
- package/src/router/loaders/business-loader.ts +0 -25
- package/src/router/loaders/charge-loader.ts +0 -25
- package/src/router/loaders/index.ts +0 -17
- package/src/router/routes.ts +0 -88
- package/src/router/types.ts +0 -68
package/src/index.tsx
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import { StrictMode } from 'react';
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
createBrowserRouter,
|
|
5
|
+
createRoutesFromElements,
|
|
6
|
+
Route,
|
|
7
|
+
RouterProvider,
|
|
8
|
+
} from 'react-router-dom';
|
|
9
|
+
import { App } from './app.js';
|
|
10
|
+
import { Providers } from './providers/index.js';
|
|
5
11
|
import './index.css';
|
|
6
12
|
|
|
7
13
|
const rootElement = document.getElementById('root');
|
|
14
|
+
|
|
8
15
|
const root = createRoot(rootElement!);
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
const router = createBrowserRouter(
|
|
18
|
+
createRoutesFromElements(
|
|
19
|
+
<Route
|
|
20
|
+
path="*"
|
|
21
|
+
element={
|
|
22
|
+
<Providers>
|
|
23
|
+
<App />
|
|
24
|
+
</Providers>
|
|
25
|
+
}
|
|
26
|
+
errorElement={<p>error</p>} // TODO: implement
|
|
27
|
+
/>,
|
|
28
|
+
),
|
|
29
|
+
);
|
|
12
30
|
|
|
13
31
|
root.render(
|
|
14
32
|
<StrictMode>
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { createContext,
|
|
1
|
+
import { createContext, useEffect, useState, type ReactNode } from 'react';
|
|
2
|
+
import { Route, Routes, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { NetworkError } from '@/components/screens/network-error.js';
|
|
4
|
+
import { LoginPage } from '../components/login-page.js';
|
|
2
5
|
import { UserService } from '../services/user-service.js';
|
|
3
6
|
|
|
4
7
|
type ContextType = {
|
|
@@ -11,19 +14,25 @@ export const AuthContext = createContext<ContextType>({
|
|
|
11
14
|
setAuthService: () => void 0,
|
|
12
15
|
});
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
export const AuthProvider = ({ children }: { children?: ReactNode }): ReactNode => {
|
|
19
|
-
// Use lazy initialization to prevent creating new UserService on every render
|
|
20
|
-
const [authService, setAuthService] = useState<UserService>(() => new UserService());
|
|
17
|
+
export const AuthGuard = ({ children }: { children?: ReactNode }): ReactNode => {
|
|
18
|
+
const [authService, setAuthService] = useState<UserService>(new UserService());
|
|
19
|
+
const navigate = useNavigate();
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
const contextValue = useMemo(() => ({ authService, setAuthService }), [authService]);
|
|
21
|
+
const loggedIn = authService.isLoggedIn();
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!loggedIn) {
|
|
25
|
+
navigate('/login');
|
|
26
|
+
}
|
|
27
|
+
}, [loggedIn, navigate]);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
return (
|
|
30
|
+
<AuthContext.Provider value={{ authService, setAuthService }}>
|
|
31
|
+
<Routes>
|
|
32
|
+
<Route path="/login" element={<LoginPage />} />
|
|
33
|
+
<Route path="/network-error" element={<NetworkError />} />
|
|
34
|
+
<Route path="*" element={children} />
|
|
35
|
+
</Routes>
|
|
36
|
+
</AuthContext.Provider>
|
|
37
|
+
);
|
|
38
|
+
};
|
package/src/providers/index.tsx
CHANGED
|
@@ -5,14 +5,9 @@ import { red } from '@mui/material/colors';
|
|
|
5
5
|
import { createTheme } from '@mui/material/styles';
|
|
6
6
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
7
7
|
import { Toaster } from '../components/ui/sonner.js';
|
|
8
|
-
import {
|
|
8
|
+
import { AuthGuard } from './auth-guard.js';
|
|
9
9
|
import { UrqlProvider } from './urql.js';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
export { AuthGuard, AuthProvider, AuthContext };
|
|
13
|
-
export { FiltersContext } from './filters-context.js';
|
|
14
|
-
export { UrqlProvider };
|
|
15
|
-
export { UserProvider, UserContext, type UserInfo };
|
|
10
|
+
import { UserProvider } from './user-provider.js';
|
|
16
11
|
|
|
17
12
|
const queryClient = new QueryClient();
|
|
18
13
|
|
package/src/providers/urql.tsx
CHANGED
|
@@ -9,23 +9,23 @@ import {
|
|
|
9
9
|
type Operation,
|
|
10
10
|
} from 'urql';
|
|
11
11
|
import { authExchange } from '@urql/exchange-auth';
|
|
12
|
-
import { ROUTES } from '../router/routes.js';
|
|
13
12
|
import { AuthContext } from './auth-guard.js';
|
|
14
13
|
|
|
15
14
|
export function UrqlProvider({ children }: { children?: ReactNode }): ReactNode {
|
|
16
15
|
const { authService } = useContext(AuthContext);
|
|
17
16
|
const navigate = useNavigate();
|
|
18
|
-
|
|
19
|
-
// Track login state to trigger token updates
|
|
20
17
|
const loggedIn = authService.isLoggedIn();
|
|
21
18
|
|
|
22
19
|
const token = useMemo(() => {
|
|
23
20
|
const token = authService.authToken();
|
|
24
21
|
return token;
|
|
25
|
-
|
|
26
|
-
}, [authService, loggedIn]);
|
|
22
|
+
}, [authService]);
|
|
27
23
|
|
|
28
24
|
const client = useMemo(() => {
|
|
25
|
+
if (!loggedIn) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
29
|
let url: string;
|
|
30
30
|
switch (import.meta.env.MODE) {
|
|
31
31
|
case 'production': {
|
|
@@ -47,11 +47,16 @@ export function UrqlProvider({ children }: { children?: ReactNode }): ReactNode
|
|
|
47
47
|
exchanges: [
|
|
48
48
|
mapExchange({
|
|
49
49
|
onResult(result) {
|
|
50
|
+
if (result.error?.networkError) {
|
|
51
|
+
console.error('Network Error:', result.error.networkError);
|
|
52
|
+
navigate('/network-error');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
50
55
|
const isAuthError =
|
|
51
56
|
result?.error?.graphQLErrors.some(e => e.extensions?.code === 'FORBIDDEN') ||
|
|
52
57
|
result?.error?.response?.status === 401;
|
|
53
58
|
if (isAuthError) {
|
|
54
|
-
navigate(
|
|
59
|
+
navigate('/login', {
|
|
55
60
|
state: { message: 'You are not authorized to access this page' },
|
|
56
61
|
});
|
|
57
62
|
}
|
|
@@ -81,7 +86,7 @@ export function UrqlProvider({ children }: { children?: ReactNode }): ReactNode
|
|
|
81
86
|
fetchExchange,
|
|
82
87
|
],
|
|
83
88
|
});
|
|
84
|
-
}, [navigate, token, authService]);
|
|
89
|
+
}, [loggedIn, navigate, token, authService]);
|
|
85
90
|
|
|
86
91
|
useEffect(() => {
|
|
87
92
|
if (!client) {
|
|
@@ -54,14 +54,13 @@ export function UserProvider({ children }: { children?: ReactNode }): ReactNode
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
// update active user
|
|
57
|
+
const currentUser = authService.currentUser();
|
|
57
58
|
useEffect(() => {
|
|
58
|
-
const currentUser = authService.currentUser();
|
|
59
59
|
if (!equal(currentUser, user)) {
|
|
60
60
|
setUser(currentUser);
|
|
61
61
|
fetchUserContext();
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
}, [user]);
|
|
63
|
+
}, [currentUser, user, fetchUserContext]);
|
|
65
64
|
|
|
66
65
|
// on user defaults fetched, update user defaults
|
|
67
66
|
useEffect(() => {
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{V as fr,r as w,bH as Q,eD as ur,a6 as t,eE as R,bF as X,bG as D,bI as n,eF as I,bJ as z,eG as _r,eH as vr,eI as br}from"./index-Bj3HckU6.js";/**
|
|
2
|
-
* @license lucide-react v0.546.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const yr=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],Br=fr("merge",yr),Z=w.createContext(null),mr=Z.Provider,gr=()=>w.useContext(Z);var Pr=Object.defineProperty,h=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,H=(r,e,a)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,M=(r,e)=>{for(var a in e||(e={}))rr.call(e,a)&&H(r,a,e[a]);if(h)for(var a of h(e))er.call(e,a)&&H(r,a,e[a]);return r},Or=(r,e)=>{var a={};for(var o in r)rr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&h)for(var o of h(r))e.indexOf(o)<0&&er.call(r,o)&&(a[o]=r[o]);return a};const wr={size:"sm"},ar=w.forwardRef((r,e)=>{const a=Q("CheckboxGroup",wr,r),{children:o,value:f,defaultValue:u,onChange:i,size:c,wrapperProps:s}=a,d=Or(a,["children","value","defaultValue","onChange","size","wrapperProps"]),[l,y]=ur({value:f,defaultValue:u,finalValue:[],onChange:i}),m=_=>{const v=_.currentTarget.value;y(l.includes(v)?l.filter($=>$!==v):[...l,v])};return t.createElement(mr,{value:{value:l,onChange:m,size:c}},t.createElement(R.Wrapper,M(M({labelElement:"div",size:c,__staticSelector:"CheckboxGroup",ref:e},s),d),o))});ar.displayName="@mantine/core/CheckboxGroup";var $r=Object.defineProperty,xr=Object.defineProperties,hr=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Y=(r,e,a)=>e in r?$r(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,B=(r,e)=>{for(var a in e||(e={}))kr.call(e,a)&&Y(r,a,e[a]);if(W)for(var a of W(e))Sr.call(e,a)&&Y(r,a,e[a]);return r},J=(r,e)=>xr(r,hr(e));const Er={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Cr=X((r,{radius:e,color:a,transitionDuration:o,labelPosition:f,error:u,indeterminate:i},{size:c})=>{const s=D({size:c,sizes:Er}),d=r.fn.variant({variant:"filled",color:a});return{icon:J(B({},r.fn.cover()),{ref:I("icon"),color:i?"inherit":r.white,transform:i?"none":`translateY(${n(5)}) scale(0.5)`,opacity:i?1:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${o}ms`,pointerEvents:"none",width:"60%",position:"absolute",zIndex:1,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:r.respectReducedMotion?"0ms":void 0}}),inner:{position:"relative",width:s,height:s,order:f==="left"?2:1},input:J(B({},r.fn.focusStyles()),{appearance:"none",backgroundColor:r.colorScheme==="dark"?r.colors.dark[6]:r.white,border:`${n(1)} solid ${u?r.fn.variant({variant:"filled",color:"red"}).background:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4]}`,width:s,height:s,borderRadius:r.fn.radius(e),padding:0,display:"block",margin:0,transition:`border-color ${o}ms ease, background-color ${o}ms ease`,cursor:r.cursorType,"&:checked":{backgroundColor:d.background,borderColor:d.background,[`& + .${I("icon")}`]:{opacity:1,color:r.white,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[2],borderColor:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[3],cursor:"not-allowed",pointerEvents:"none",[`& + .${I("icon")}`]:{color:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[5]}}})}}),Nr=Object.defineProperty,Ir=Object.defineProperties,zr=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,q=(r,e,a)=>e in r?Nr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Dr=(r,e)=>{for(var a in e||(e={}))jr.call(e,a)&&q(r,a,e[a]);if(U)for(var a of U(e))Rr.call(e,a)&&q(r,a,e[a]);return r},Vr=(r,e)=>Ir(r,zr(e));const j={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Gr=X((r,{labelPosition:e},{size:a})=>({root:{},body:{display:"flex","&:has(input:disabled) label":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}},labelWrapper:Vr(Dr({},r.fn.fontStyles()),{display:"inline-flex",flexDirection:"column",WebkitTapHighlightColor:"transparent",fontSize:a in j?D({size:a,sizes:r.fontSizes}):void 0,lineHeight:a in j?D({size:a,sizes:j}):void 0,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,cursor:r.cursorType,order:e==="left"?1:2}),description:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},error:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},label:{cursor:r.cursorType,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm,"&:disabled, &[data-disabled]":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}}})),Tr=Object.defineProperty,k=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable,A=(r,e,a)=>e in r?Tr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Fr=(r,e)=>{for(var a in e||(e={}))or.call(e,a)&&A(r,a,e[a]);if(k)for(var a of k(e))tr.call(e,a)&&A(r,a,e[a]);return r},Lr=(r,e)=>{var a={};for(var o in r)or.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&k)for(var o of k(r))e.indexOf(o)<0&&tr.call(r,o)&&(a[o]=r[o]);return a};const nr=w.forwardRef((r,e)=>{var a=r,{__staticSelector:o,className:f,classNames:u,styles:i,unstyled:c,children:s,label:d,description:l,id:y,disabled:m,error:_,size:v,labelPosition:$,bodyElement:g="div",labelElement:P="label",variant:E}=a,C=Lr(a,["__staticSelector","className","classNames","styles","unstyled","children","label","description","id","disabled","error","size","labelPosition","bodyElement","labelElement","variant"]);const{classes:p,cx:O}=Gr({labelPosition:$},{name:o,styles:i,classNames:u,unstyled:c,variant:E,size:v});return t.createElement(z,Fr({className:O(p.root,f),ref:e},C),t.createElement(z,{component:g,htmlFor:g==="label"?y:void 0,className:O(p.body)},s,t.createElement("div",{className:p.labelWrapper},d!=null&&t.createElement(z,{component:P,htmlFor:P==="label"?y:void 0,className:p.label,"data-disabled":m||void 0},d),l&&t.createElement(R.Description,{className:p.description},l),_&&_!=="boolean"&&t.createElement(R.Error,{className:p.error},_))))});nr.displayName="@mantine/core/InlineInput";var Hr=Object.defineProperty,S=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,K=(r,e,a)=>e in r?Hr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,x=(r,e)=>{for(var a in e||(e={}))sr.call(e,a)&&K(r,a,e[a]);if(S)for(var a of S(e))lr.call(e,a)&&K(r,a,e[a]);return r},Mr=(r,e)=>{var a={};for(var o in r)sr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&S)for(var o of S(r))e.indexOf(o)<0&&lr.call(r,o)&&(a[o]=r[o]);return a};const Wr={size:"sm",transitionDuration:100,icon:_r,labelPosition:"right"},ir=w.forwardRef((r,e)=>{const a=Q("Checkbox",Wr,r),{className:o,style:f,sx:u,checked:i,disabled:c,color:s,label:d,indeterminate:l,id:y,size:m,radius:_,wrapperProps:v,children:$,classNames:g,styles:P,transitionDuration:E,icon:C,unstyled:p,labelPosition:O,description:cr,error:V,variant:G}=a,dr=Mr(a,["className","style","sx","checked","disabled","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","unstyled","labelPosition","description","error","variant"]),b=gr(),T=vr(y),{systemStyles:pr,rest:F}=br(dr),{classes:N}=Cr({radius:_,color:s,transitionDuration:E,labelPosition:O,error:!!V,indeterminate:l},{name:"Checkbox",classNames:g,styles:P,unstyled:p,variant:G,size:b?.size||m}),L=b?{checked:b.value.includes(F.value),onChange:b.onChange}:{};return t.createElement(nr,x(x({className:o,sx:u,style:f,id:T,size:b?.size||m,labelPosition:O,label:d,description:cr,error:V,disabled:c,__staticSelector:"Checkbox",classNames:g,styles:P,unstyled:p,"data-checked":L.checked||void 0,variant:G},pr),v),t.createElement("div",{className:N.inner},t.createElement("input",x(x({id:T,ref:e,type:"checkbox",className:N.input,checked:i,disabled:c},F),L)),t.createElement(C,{indeterminate:l,className:N.icon})))});ir.displayName="@mantine/core/Checkbox";ir.Group=ar;export{ir as C,Br as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bF as J,bG as _,bI as o,dX as M,r as W,bH as X,a6 as s,T as q,bJ as w,c0 as O}from"./index-Bj3HckU6.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},K=M({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var Q=J((a,{color:r,radius:e},{size:t})=>({root:{position:"relative",height:_({size:t,sizes:k}),backgroundColor:a.colorScheme==="dark"?a.colors.dark[4]:a.colors.gray[2],borderRadius:a.fn.radius(e),overflow:"hidden"},bar:{position:"absolute",top:0,bottom:0,left:0,height:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background,transition:"width 100ms linear","&[data-animate]":{animation:`${K} 1000ms linear infinite`},"&[data-striped]":{backgroundSize:`${o(20)} ${o(20)}`,backgroundImage:"linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"},"&:last-of-type":{borderTopRightRadius:a.fn.radius(e),borderBottomRightRadius:a.fn.radius(e)},"&:first-of-type":{borderTopLeftRadius:a.fn.radius(e),borderBottomLeftRadius:a.fn.radius(e)},"@media (prefers-reduced-motion)":{transitionDuration:a.respectReducedMotion?"0ms":void 0}},label:{color:a.white,fontSize:`calc(${_({size:t,sizes:k})} * 0.65)`,fontWeight:700,userSelect:"none",overflow:"hidden",whiteSpace:"nowrap"}})),U=Object.defineProperty,Y=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?U(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e,c=(a,r)=>{for(var e in r||(r={}))R.call(r,e)&&N(a,e,r[e]);if(n)for(var e of n(r))S.call(r,e)&&N(a,e,r[e]);return a},h=(a,r)=>Y(a,Z(r)),x=(a,r)=>{var e={};for(var t in a)R.call(a,t)&&r.indexOf(t)<0&&(e[t]=a[t]);if(a!=null&&n)for(var t of n(a))r.indexOf(t)<0&&S.call(a,t)&&(e[t]=a[t]);return e};function aa(a){return a.reduce((r,e)=>(r.sections.push(h(c({},e),{accumulated:r.accumulated})),r.accumulated+=e.value,r),{accumulated:0,sections:[]}).sections}const ea={size:"md",radius:"sm",striped:!1,animate:!1,label:""},ra=W.forwardRef((a,r)=>{const e=X("Progress",ea,a),{className:t,value:d,color:C,size:E,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:I,sections:p,unstyled:T,variant:D}=e,F=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=Q({color:C,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:T,variant:D,size:E}),L=Array.isArray(p)?aa(p).map((A,B)=>{var v=A,{tooltip:g,accumulated:V,value:G,label:y,color:H}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(q.Floating,{label:g,disabled:!g,key:B},s.createElement(w,h(c({},P),{className:f(l.bar,P.className),"data-striped":u||i||void 0,"data-animate":i||void 0,sx:{width:`${G}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:H||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},F),L||s.createElement("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":d,"aria-label":j,className:l.bar,style:{width:`${d}%`},"data-striped":u||i||void 0,"data-animate":i||void 0},m?s.createElement(O,{className:l.label},m):""))});ra.displayName="@mantine/core/Progress";export{ra as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ee as S,ef as K,eg as Y,eh as Q,ei as W,ej as X,d7 as Z,d6 as z,r as k,db as N,ek as ee,j as te,a7 as re,dY as _}from"./index-Bj3HckU6.js";function Me(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const $=e=>e,ne=()=>{let e=$;return{configure(t){e=t},generate(t){return e(t)},reset(){e=$}}},oe=ne(),se={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function U(e,t,r="Mui"){const n=se[t];return n?`${r}-${n}`:`${oe.generate(e)}-${t}`}function ie(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=U(e,o,r)}),n}function G(e){const{variants:t,...r}=e,n={variants:t,style:S(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=S(o.style))}),n}const ae=K();function V(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function g(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function le(e){return e?(t,r)=>r[e]:null}function ue(e,t,r){e.theme=he(e.theme)?r:e.theme[t]||e.theme}function A(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>A(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?g(n.style,r):n.style;else{const{variants:s,...i}=n;o=r?g(S(i),r):i}return I(e,n.variants,[o],r)}return n?.isProcessed?r?g(S(n.style),r):n.style:r?g(S(n),r):n}function I(e,t,r=[],n=void 0){let o;e:for(let s=0;s<t.length;s+=1){const i=t[s];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const a in i.props)if(e[a]!==i.props[a]&&e.ownerState?.[a]!==i.props[a])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?g(S(i.style(o)),n):i.style(o))):r.push(n?g(S(i.style),n):i.style)}return r}function ce(e={}){const{themeId:t,defaultTheme:r=ae,rootShouldForwardProp:n=V,slotShouldForwardProp:o=V}=e;function s(a){ue(a,t,r)}return(a,d={})=>{Y(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:x,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=x!==void 0?x:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let b=V;h==="Root"||h==="root"?b=n:h?b=o:pe(a)&&(b=void 0);const F=Q(a,{shouldForwardProp:b,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return A(m,u,m.theme.modularCssLayers?w:void 0)};if(X(u)){const c=G(u);return function(y){return c.variants?A(y,c,y.theme.modularCssLayers?w:void 0):y.theme.modularCssLayers?g(c.style,w):c.style}}return u},j=(...u)=>{const c=[],m=u.map(q),y=[];if(c.push(s),l&&v&&y.push(function(f){const p=f.theme.components?.[l]?.styleOverrides;if(!p)return null;const B={};for(const E in p)B[E]=A(f,p[E],f.theme.modularCssLayers?"theme":void 0);return v(f,B)}),l&&!P&&y.push(function(f){const p=f.theme?.components?.[l]?.variants;return p?I(f,p,[],f.theme.modularCssLayers?"theme":void 0):null}),M||y.push(W),Array.isArray(m[0])){const O=m.shift(),f=new Array(c.length).fill(""),R=new Array(y.length).fill("");let p;p=[...f,...O,...R],p.raw=[...f,...O.raw,...R],c.unshift(p)}const J=[...c,...m,...y],L=F(...J);return a.muiName&&(L.muiName=a.muiName),L};return F.withConfig&&(j.withConfig=F.withConfig),j}}function fe(e,t){return void 0}function he(e){for(const t in e)return!1;return!0}function pe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function ye(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const D={theme:void 0};function de(e){let t,r;return function(o){let s=t;return(s===void 0||o.theme!==r)&&(D.theme=o.theme,s=G(e(D)),t=s,r=o.theme),s}}function me(e,t,r=void 0){const n={};for(const o in e){const s=e[o];let i="",a=!0;for(let d=0;d<s.length;d+=1){const l=s[d];l&&(i+=(a===!0?"":" ")+t(l),a=!1,r&&r[l]&&(i+=" "+r[l]))}n[o]=i}return n}function ge(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Se=e=>ge(e)&&e!=="classes",ve=ce({themeId:Z,defaultTheme:z,rootShouldForwardProp:Se}),we=de;function Fe(...e){const t=k.useRef(void 0),r=k.useCallback(n=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},e);return k.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function be(e){return typeof e.main=="string"}function xe(e,t=[]){if(!be(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&xe(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${_(t)}`,r&&"gutterBottom",n&&"noWrap",o&&"paragraph"]};return me(a,Te,i)},ke=ve("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],r.align!=="inherit"&&t[`align${_(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(we(({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter(([t,r])=>t!=="inherit"&&r&&typeof r=="object").map(([t,r])=>({props:{variant:t},style:r})),...Object.entries(e.palette).filter(Ce()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,t])=>typeof t=="string").map(([t])=>({props:{color:`text${_(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:t})=>t.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:t})=>t.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:t})=>t.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:t})=>t.paragraph,style:{marginBottom:16}}]}))),H={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Ve=k.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:x=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:x,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",b=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(b.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Ve as T,Me as _,ie as a,V as b,me as c,Ce as d,U as g,we as m,ve as s,Fe as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a6 as l,j as t,fd as Q,fe as W,ff as O,fg as X,fh as Z,fi as T,fj as ee,fk as oe,fl as M,fm as re,fn as te,fo as ne,y as P,dV as ae}from"./index-Bj3HckU6.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=Q(d),[b]=W(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(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 F=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===F),D=I.length;if(g===-1)return;m.preventDefault();let 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 J=p%D;I[J].ref.current?.focus()});return t.jsx(ue,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref: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=X(),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":B(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":B(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=L;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});U.displayName=N;var Y="AccordionContent",q=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(Y,o),s=E(o);return t.jsx(oe,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...s,...a,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});q.displayName=Y;function B(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=q;function he({...e}){return t.jsx(xe,{"data-slot":"accordion",...e})}function Ie({className:e,...n}){return t.jsx(me,{"data-slot":"accordion-item",className:P("border-b last:border-b-0",e),...n})}function je({className:e,children:n,...o}){return t.jsx(ge,{className:"flex",children:t.jsxs(Ae,{"data-slot":"accordion-trigger",className:P("focus-visible:border-gray-950 focus-visible:ring-gray-950/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50",e),...o,children:[n,t.jsx(ae,{className:"text-gray-500 pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 dark:text-gray-400"})]})})}function we({className:e,children:n,...o}){return t.jsx(be,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...o,children:t.jsx("div",{className:P("pt-0 pb-4",e),children:n})})}export{he as A,Ie as a,we as b,je as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,F as h,u as v,U as C,a5 as A,a as F,j as e,c as P,L as b,fp as y}from"./index-Bj3HckU6.js";import{C as j}from"./charges-filters-CqWjSIKI.js";import{P as D}from"./Progress-Cjv9yrat.js";import"./sub-BIMwxqar.js";import"./subMonths-B7SR4Lli.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 +0,0 @@
|
|
|
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-Bj3HckU6.js";import{e as Q,C as $}from"./charges-filters-CqWjSIKI.js";import{M as H}from"./index-BMcyYDGt.js";import"./sub-BIMwxqar.js";import"./subMonths-B7SR4Lli.js";import"./Checkbox-DBF5r7jA.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,6 +0,0 @@
|
|
|
1
|
-
import{V as o}from"./index-Bj3HckU6.js";/**
|
|
2
|
-
* @license lucide-react v0.546.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const e=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],a=o("arrow-up-down",e);export{a as A};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import{V as se,W as Ne,X as Ie,D as Ce,j as e,Y as U,Z as ve,_ as Fs,r as N,U as He,a as De,$ as Ms,a0 as H,a1 as X,a2 as Q,a3 as Y,O as $s,a4 as Z,C as Rs,a5 as zs,a6 as L,a7 as ls,p as Se,a8 as Us,t as F,s as Ae,a9 as Gs,k as Ee,aa as me,ab as Xe,ac as Qe,ad as Ye,ae as Ze,B as T,af as G,ag as Je,ah as es,ai as ss,aj as ts,l as Te,ak as g,al as f,am as v,Q as O,an as ue,ao as C,ap as ie,aq as y,ar as le,as as ce,at as oe,au as de,av as ns,aw as as,ax as R,ay as Fe,az as re,aA as Me,aB as $e,aC as Oe,aD as fs,aE as qs,aF as ee,aG as W,aH as S,aI as Ks,aJ as Ws,aK as Hs,aL as Re,aM as Xs,aN as Qs,aO as Ys,o as vs,aP as Zs,aQ as Js,aR as ze,aS as et,aT as Ue,aU as st,aV as ys,aW as Ns,aX as tt,aY as nt,aZ as Cs,a_ as rs,a$ as at,b0 as rt,b1 as cs,b2 as it,b3 as lt,b4 as ct,b5 as ot,b6 as dt,b7 as mt,b8 as ut,b9 as I,ba as ht,bb as is,bc as xt,bd as pt,be as jt,bf as gt,bg as ft,bh as vt,bi as J,bj as yt,bk as Nt,bl as K,bm as Ct,bn as bt,bo as wt,w as It,bp as kt}from"./index-Bj3HckU6.js";import{B as bs,S as ws}from"./save-DC_eQcBj.js";import{i as Dt,D as St,f as At,E as Et,L as Le,a as be,C as Tt,A as Pt,b as ge,c as Ot,d as Ge,h as Lt,e as Bt,g as Is,u as Vt,G as _t,j as os,k as Ft,X as ks,Y as Ds,l as Mt,m as $t,R as Rt,n as zt,o as Ut,p as Gt}from"./chart-D1Y6fN3z.js";import{u as Ss,S as qt}from"./similar-charges-by-business-modal-Dmb2ZymF.js";import{P as Kt}from"./pencil-BMWYIsZB.js";import{A as Wt,a as Be,b as Ve,c as ds}from"./accordion-DcMd-Til.js";import"./sequential-CAnleQny.js";/**
|
|
2
|
-
* @license lucide-react v0.546.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ht=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ms=se("circle-check",Ht);/**
|
|
7
|
-
* @license lucide-react v0.546.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Xt=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],we=se("dollar-sign",Xt);/**
|
|
12
|
-
* @license lucide-react v0.546.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Qt=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],Yt=se("file-check",Qt);/**
|
|
17
|
-
* @license lucide-react v0.546.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Zt=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],qe=se("map-pin",Zt);/**
|
|
22
|
-
* @license lucide-react v0.546.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Jt=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],As=se("phone",Jt);/**
|
|
27
|
-
* @license lucide-react v0.546.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const en=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],sn=se("plug",en);/**
|
|
32
|
-
* @license lucide-react v0.546.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const tn=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],_e=se("trending-up",tn);function Es(s){switch(s){case Ne.Annual:return"Annual";case Ne.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${s}`)}}function Ts(s){switch(s){case Ie.Enterprise:return"Enterprise";case Ie.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${s}`)}}function nn({data:s}){const t=Ce(Fs,s);return!t||t.__typename!=="LtdFinancialEntity"?e.jsx("div",{}):e.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/60",children:e.jsx("div",{className:"container mx-auto px-4 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs("div",{className:"flex h-16 items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-accent",children:e.jsx(bs,{className:"h-5 w-5 text-accent-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:t.name}),e.jsx(U,{variant:"secondary",children:"Active"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground truncate",children:["Business ID: ",t.id]})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-6 text-sm",children:[t.governmentId&&e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"font-medium text-foreground",children:t.governmentId})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Since"}),e.jsx("p",{className:"font-medium text-foreground",children:ve(t.createdAt,"MMM yyyy")})]})]})]})})})}function an({businessId:s}){const{userContext:t}=N.useContext(He),[n,a]=N.useState(1),[{data:i,fetching:l}]=De({query:Ms,variables:{filters:{byOwners:t?.context.adminBusinessId?[t.context.adminBusinessId]:void 0,sortBy:{field:zs.Date,asc:!1},byBusinesses:[s]},page:n,limit:100}}),c=i?.allCharges?.pageInfo.totalPages??1,r=i?.allCharges?.nodes??[];return l?e.jsx("div",{children:"Loading charges..."}):e.jsxs(H,{children:[e.jsxs(X,{className:"flex w-full justify-between items-center",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(Q,{children:"Charges"}),e.jsx(Y,{children:"Recurring and one-time charges for this business"})]})}),c>1&&e.jsx($s,{className:"flex-fit",value:n,onChange:a,total:c})]}),e.jsx(Z,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Rs,{data:r,isAllOpened:!1})})})]})}var rn=["type","layout","connectNulls","ref"],ln=["key"];function he(s){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(s)}function us(s,t){if(s==null)return{};var n=cn(s,t),a,i;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);for(i=0;i<l.length;i++)a=l[i],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(s,a)&&(n[a]=s[a])}return n}function cn(s,t){if(s==null)return{};var n={};for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)){if(t.indexOf(a)>=0)continue;n[a]=s[a]}return n}function ye(){return ye=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s[a]=n[a])}return s},ye.apply(this,arguments)}function hs(s,t){var n=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),n.push.apply(n,a)}return n}function V(s){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hs(Object(n),!0).forEach(function(a){$(s,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(n)):hs(Object(n)).forEach(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(n,a))})}return s}function ae(s){return un(s)||mn(s)||dn(s)||on()}function on(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
37
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dn(s,t){if(s){if(typeof s=="string")return Ke(s,t);var n=Object.prototype.toString.call(s).slice(8,-1);if(n==="Object"&&s.constructor&&(n=s.constructor.name),n==="Map"||n==="Set")return Array.from(s);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ke(s,t)}}function mn(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function un(s){if(Array.isArray(s))return Ke(s)}function Ke(s,t){(t==null||t>s.length)&&(t=s.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=s[n];return a}function hn(s,t){if(!(s instanceof t))throw new TypeError("Cannot call a class as a function")}function xs(s,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,Os(a.key),a)}}function xn(s,t,n){return t&&xs(s.prototype,t),n&&xs(s,n),Object.defineProperty(s,"prototype",{writable:!1}),s}function pn(s,t,n){return t=ke(t),jn(s,Ps()?Reflect.construct(t,n||[],ke(s).constructor):t.apply(s,n))}function jn(s,t){if(t&&(he(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gn(s)}function gn(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Ps(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ps=function(){return!!s})()}function ke(s){return ke=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ke(s)}function fn(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(t&&t.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),t&&We(s,t)}function We(s,t){return We=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,i){return a.__proto__=i,a},We(s,t)}function $(s,t,n){return t=Os(t),t in s?Object.defineProperty(s,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[t]=n,s}function Os(s){var t=vn(s,"string");return he(t)=="symbol"?t:t+""}function vn(s,t){if(he(s)!="object"||!s)return s;var n=s[Symbol.toPrimitive];if(n!==void 0){var a=n.call(s,t);if(he(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var xe=(function(s){function t(){var n;hn(this,t);for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return n=pn(this,t,[].concat(i)),$(n,"state",{isAnimationFinished:!0,totalLength:0}),$(n,"generateSimpleStrokeDasharray",function(c,r){return"".concat(r,"px ").concat(c-r,"px")}),$(n,"getStrokeDasharray",function(c,r,o){var m=o.reduce(function(b,A){return b+A});if(!m)return n.generateSimpleStrokeDasharray(r,c);for(var x=Math.floor(c/m),u=c%m,h=r-c,k=[],d=0,p=0;d<o.length;p+=o[d],++d)if(p+o[d]>u){k=[].concat(ae(o.slice(0,d)),[u-p]);break}var D=k.length%2===0?[0,h]:[h];return[].concat(ae(t.repeat(o,x)),ae(k),D).map(function(b){return"".concat(b,"px")}).join(", ")}),$(n,"id",Vt("recharts-line-")),$(n,"pathRef",function(c){n.mainCurve=c}),$(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),$(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return fn(t,s),xn(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();this.setState({totalLength:a})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();a!==this.state.totalLength&&this.setState({totalLength:a})}}},{key:"getTotalLength",value:function(){var a=this.mainCurve;try{return a&&a.getTotalLength&&a.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(a,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.points,r=l.xAxis,o=l.yAxis,m=l.layout,x=l.children,u=At(x,Et);if(!u)return null;var h=function(p,D){return{x:p.x,y:p.y,value:p.value,errorVal:Is(p.payload,D)}},k={clipPath:a?"url(#clipPath-".concat(i,")"):null};return L.createElement(Le,k,u.map(function(d){return L.cloneElement(d,{key:"bar-".concat(d.props.dataKey),data:c,xAxis:r,yAxis:o,layout:m,dataPointFormatter:h})}))}},{key:"renderDots",value:function(a,i,l){var c=this.props.isAnimationActive;if(c&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.dot,m=r.points,x=r.dataKey,u=be(this.props,!1),h=be(o,!0),k=m.map(function(p,D){var b=V(V(V({key:"dot-".concat(D),r:3},u),h),{},{index:D,cx:p.x,cy:p.y,value:p.value,dataKey:x,payload:p.payload,points:m});return t.renderDotItem(o,b)}),d={clipPath:a?"url(#clipPath-".concat(i?"":"dots-").concat(l,")"):null};return L.createElement(Le,ye({className:"recharts-line-dots",key:"dots"},d),k)}},{key:"renderCurveStatically",value:function(a,i,l,c){var r=this.props,o=r.type,m=r.layout,x=r.connectNulls;r.ref;var u=us(r,rn),h=V(V(V({},be(u,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(l,")"):null,points:a},c),{},{type:o,layout:m,connectNulls:x});return L.createElement(Tt,ye({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(a,i){var l=this,c=this.props,r=c.points,o=c.strokeDasharray,m=c.isAnimationActive,x=c.animationBegin,u=c.animationDuration,h=c.animationEasing,k=c.animationId,d=c.animateNewValues,p=c.width,D=c.height,b=this.state,A=b.prevPoints,B=b.totalLength;return L.createElement(Pt,{begin:x,duration:u,isActive:m,easing:h,from:{t:0},to:{t:1},key:"line-".concat(k),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(M){var _=M.t;if(A){var q=A.length/r.length,z=r.map(function(P,Pe){var pe=Math.floor(Pe*q);if(A[pe]){var je=A[pe],ne=ge(je.x,P.x),Bs=ge(je.y,P.y);return V(V({},P),{},{x:ne(_),y:Bs(_)})}if(d){var Vs=ge(p*2,P.x),_s=ge(D/2,P.y);return V(V({},P),{},{x:Vs(_),y:_s(_)})}return V(V({},P),{},{x:P.x,y:P.y})});return l.renderCurveStatically(z,a,i)}var te=ge(0,B),j=te(_),w;if(o){var E="".concat(o).split(/[,\s]+/gim).map(function(P){return parseFloat(P)});w=l.getStrokeDasharray(j,B,E)}else w=l.generateSimpleStrokeDasharray(B,j);return l.renderCurveStatically(r,a,i,{strokeDasharray:w})})}},{key:"renderCurve",value:function(a,i){var l=this.props,c=l.points,r=l.isAnimationActive,o=this.state,m=o.prevPoints,x=o.totalLength;return r&&c&&c.length&&(!m&&x>0||!Ot(m,c))?this.renderCurveWithAnimation(a,i):this.renderCurveStatically(c,a,i)}},{key:"render",value:function(){var a,i=this.props,l=i.hide,c=i.dot,r=i.points,o=i.className,m=i.xAxis,x=i.yAxis,u=i.top,h=i.left,k=i.width,d=i.height,p=i.isAnimationActive,D=i.id;if(l||!r||!r.length)return null;var b=this.state.isAnimationFinished,A=r.length===1,B=ls("recharts-line",o),M=m&&m.allowDataOverflow,_=x&&x.allowDataOverflow,q=M||_,z=Ge(D)?this.id:D,te=(a=be(c,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},j=te.r,w=j===void 0?3:j,E=te.strokeWidth,P=E===void 0?2:E,Pe=Lt(c)?c:{},pe=Pe.clipDot,je=pe===void 0?!0:pe,ne=w*2+P;return L.createElement(Le,{className:B},M||_?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(z)},L.createElement("rect",{x:M?h:h-k/2,y:_?u:u-d/2,width:M?k:k*2,height:_?d:d*2})),!je&&L.createElement("clipPath",{id:"clipPath-dots-".concat(z)},L.createElement("rect",{x:h-ne/2,y:u-ne/2,width:k+ne,height:d+ne}))):null,!A&&this.renderCurve(q,z),this.renderErrorBar(q,z),(A||c)&&this.renderDots(q,je,z),(!p||b)&&Bt.renderCallByParent(this.props,r))}}],[{key:"getDerivedStateFromProps",value:function(a,i){return a.animationId!==i.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,prevPoints:i.curPoints}:a.points!==i.curPoints?{curPoints:a.points}:null}},{key:"repeat",value:function(a,i){for(var l=a.length%2!==0?[].concat(ae(a),[0]):a,c=[],r=0;r<i;++r)c=[].concat(ae(c),ae(l));return c}},{key:"renderDotItem",value:function(a,i){var l;if(L.isValidElement(a))l=L.cloneElement(a,i);else if(Dt(a))l=a(i);else{var c=i.key,r=us(i,ln),o=ls("recharts-line-dot",typeof a!="boolean"?a.className:"");l=L.createElement(St,ye({key:c},r,{className:o}))}return l}}])})(N.PureComponent);$(xe,"displayName","Line");$(xe,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!_t.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});$(xe,"getComposedData",function(s){var t=s.props,n=s.xAxis,a=s.yAxis,i=s.xAxisTicks,l=s.yAxisTicks,c=s.dataKey,r=s.bandSize,o=s.displayedData,m=s.offset,x=t.layout,u=o.map(function(h,k){var d=Is(h,c);return x==="horizontal"?{x:os({axis:n,ticks:i,bandSize:r,entry:h,index:k}),y:Ge(d)?null:a.scale(d),value:d,payload:h}:{x:Ge(d)?null:n.scale(d),y:os({axis:a,ticks:l,bandSize:r,entry:h,index:k}),value:d,payload:h}});return V({points:u,layout:x},m)});var yn=Ft({chartName:"LineChart",GraphicalChild:xe,axisComponents:[{axisType:"xAxis",AxisComp:ks},{axisType:"yAxis",AxisComp:Ds}],formatAxisMap:Mt});const fe=[{month:"Jan",revenue:12500,expenses:8200},{month:"Feb",revenue:15800,expenses:9100},{month:"Mar",revenue:18200,expenses:10500},{month:"Apr",revenue:16900,expenses:9800},{month:"May",revenue:21300,expenses:11200},{month:"Jun",revenue:24500,expenses:12800},{month:"Jul",revenue:22800,expenses:11900},{month:"Aug",revenue:26100,expenses:13500},{month:"Sep",revenue:28900,expenses:14200},{month:"Oct",revenue:31200,expenses:15100}];function Nn(){const s=fe.reduce((n,a)=>n+a.revenue,0),t=s/fe.length;return e.jsxs(H,{children:[e.jsxs(X,{children:[e.jsx(Q,{children:"Revenue Analytics"}),e.jsx(Y,{children:"Revenue and expenses over time"})]}),e.jsxs(Z,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3 mb-6",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(we,{className:"h-4 w-4"}),"Total Revenue"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",s.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(_e,{className:"h-3 w-3"}),e.jsx("span",{children:"+24.5% from last period"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(we,{className:"h-4 w-4"}),"Average Monthly"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",t.toLocaleString(void 0,{maximumFractionDigits:0})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(_e,{className:"h-3 w-3"}),e.jsx("span",{children:"+18.2% growth rate"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(we,{className:"h-4 w-4"}),"Current Month"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",fe[fe.length-1].revenue.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(_e,{className:"h-3 w-3"}),e.jsx("span",{children:"+8.0% from last month"})]})]})]}),e.jsx($t,{config:{revenue:{label:"Revenue",color:"hsl(var(--chart-1))"},expenses:{label:"Expenses",color:"hsl(var(--chart-2))"}},className:"h-[400px]",children:e.jsx(Rt,{width:"100%",height:"100%",children:e.jsxs(yn,{data:fe,margin:{top:5,right:10,left:10,bottom:5},children:[e.jsx(zt,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(ks,{dataKey:"month",className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ds,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ut,{content:e.jsx(Gt,{})}),e.jsx(xe,{type:"monotone",dataKey:"revenue",stroke:"var(--color-revenue)",strokeWidth:2,dot:{fill:"var(--color-revenue)",r:4}}),e.jsx(xe,{type:"monotone",dataKey:"expenses",stroke:"var(--color-expenses)",strokeWidth:2,dot:{fill:"var(--color-expenses)",r:4}})]})})})]})]})}const Cn="insertClient",bn=()=>{const[{fetching:s},t]=Se(Us),n=N.useCallback(async a=>{const i=`Error creating client [${a.fields.businessId}]`,l=`${Cn}-${a.fields.businessId}`;F.loading("Creating Client...",{id:l});try{const c=await t(a),r=Ae(c,i,l,"insertClient");if(r)return F.success("Success",{id:l,description:`Client [${a.fields.businessId}] was created`}),r.insertClient}catch(c){console.error(`${i}: ${c}`),F.error("Error",{id:l,description:i,duration:1e5,closeButton:!0})}},[t]);return{fetching:s,insertClient:n}},wn="updateClient",Ls=()=>{const[{fetching:s},t]=Se(Gs),n=N.useCallback(async a=>{const i=`Error updating client ID [${a.businessId}]`,l=`${wn}-${a.businessId}`;F.loading("Updating client",{id:l});try{const c=await t(a),r=Ae(c,i,l,"updateClient");if(r)return F.success("Success",{id:l,description:"Client updated"}),r.updateClient}catch(c){console.error(`${i}: ${c}`),F.error("Error",{id:l,description:i,duration:1e5,closeButton:!0})}},[t]);return{fetching:s,updateClient:n}},In=Qe({id:Fe().optional(),emails:Me($e()).optional(),generatedDocumentType:re(Object.values(me)),greenInvoiceId:Fe().optional(),hiveId:R().optional()});function kn({client:s,businessId:t,onDone:n}){const[a,i]=N.useState(!1),[l,c]=N.useState(null),{updateClient:r}=Ls(),{insertClient:o}=bn(),[m,x]=N.useState(""),u={id:t,generatedDocumentType:me.Proforma,emails:[]},h=Ee({resolver:Xe(In),defaultValues:s||u});N.useEffect(()=>{s&&(c(s),h.reset({emails:s.emails,greenInvoiceId:s.greenInvoiceId,hiveId:s.hiveId,generatedDocumentType:s.generatedDocumentType,id:s.id}),i(!0))},[s,h]);const k=()=>{c(null),h.reset(u),i(!0)},d=()=>{if(m.trim()){const b=h.getValues("emails");h.setValue("emails",[...b??[],m.trim()],{shouldDirty:!0}),x("")}},p=b=>{const A=h.getValues("emails");h.setValue("emails",(A??[]).filter((B,M)=>M!==b),{shouldDirty:!0})},D=N.useCallback(async b=>{if(l)r({businessId:t,fields:b});else{if(!b.greenInvoiceId){h.setError("greenInvoiceId",{message:"Green Invoice ID is required"});return}o({fields:{...b,greenInvoiceId:b.greenInvoiceId,businessId:t}})}i(!1),c(null),n?.()},[l,n,r,t,o,h]);return e.jsxs(Ye,{open:a,onOpenChange:i,children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{size:"sm",onClick:k,children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),"New Client"]})}),e.jsxs(Je,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(es,{children:[e.jsx(ss,{children:l?"Edit Client":"Create New Client"}),e.jsx(ts,{children:l?"Update client details":"Add a new client with all required details"})]}),e.jsx(Te,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(D),children:[e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{control:h.control,name:"emails",render:({field:b})=>e.jsxs(f,{children:[e.jsx(v,{children:"Emails"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{placeholder:"Add email...",value:m,onChange:A=>x(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),d())}}),e.jsx(T,{type:"button",size:"sm",onClick:d,children:e.jsx(G,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.value?.map((A,B)=>e.jsxs(U,{variant:"secondary",className:"gap-1",children:[A,e.jsx(T,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>p(B),children:e.jsx(ue,{className:"size-3 cursor-pointer"})})]},B))}),e.jsx(C,{})]})}),e.jsx(g,{control:h.control,name:"generatedDocumentType",render:({field:b})=>e.jsxs(f,{children:[e.jsx(v,{children:"Default Document Type"}),e.jsxs(ie,{onValueChange:b.onChange,defaultValue:b.value,children:[e.jsx(y,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(me).map(A=>e.jsx(de,{value:A,children:ns(A)},A))})]}),e.jsx(C,{})]})}),e.jsx(g,{control:h.control,name:"greenInvoiceId",render:({field:b})=>e.jsxs(f,{children:[e.jsx(v,{children:"Green Invoice ID"}),e.jsx(y,{children:e.jsx(O,{type:"text",placeholder:"Enter Green Invoice ID",...b,required:!l})}),e.jsx(C,{})]})}),e.jsx(g,{control:h.control,name:"hiveId",render:({field:b})=>e.jsxs(f,{children:[e.jsx(v,{children:"Hive ID"}),e.jsx(y,{children:e.jsx(O,{type:"text",placeholder:"Enter Hive ID",...b,required:!l})}),e.jsx(C,{})]})})]})}),e.jsxs(as,{children:[e.jsx(T,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(T,{type:"submit",children:l?"Update Client":"Create Client"})]})]})})]})]})}const Dn=Object.values(Zs);function ps(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{isClient:!!s.clientInfo?.id,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough??void 0,isDocumentsOptional:s.isDocumentsOptional??void 0,isVatOptional:s.optionalVAT??void 0,isExemptDealer:s.exemptDealer??void 0,sortCode:s.sortCode?.key?.toString()??void 0,taxCategory:s.taxCategory?.id??void 0,pcn874RecordType:s?.pcn874RecordType??void 0,irsCode:s?.irsCode??void 0,description:s.suggestions?.description??void 0,tags:s.suggestions?.tags?.map(t=>t.id)??[],phrases:s.suggestions?.phrases??[],emails:s.suggestions?.emails??[],internalLinks:s.suggestions?.emailListener?.internalEmailLinks??[],attachmentTypes:s.suggestions?.emailListener?.attachments??[],useMessageBody:s.suggestions?.emailListener?.emailBody??void 0}}function Sn(s){const n=s.internalLinks||s.useMessageBody||s.attachmentTypes?{internalEmailLinks:s.internalLinks,emailBody:s.useMessageBody,attachments:s.attachmentTypes}:void 0,i=s.description||s.tags||s.phrases||s.emails||n?{description:s.description,tags:s.tags?.map(l=>({id:l})),phrases:s.phrases,emails:s.emails,emailListener:n}:void 0;return{optionalVAT:s.isVatOptional,exemptDealer:s.isExemptDealer,sortCode:s.sortCode?parseInt(s.sortCode):void 0,taxCategory:s.taxCategory,pcn874RecordType:s.pcn874RecordType,irsCode:s.irsCode,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough,isDocumentsOptional:s.isDocumentsOptional,suggestions:i}}function An({data:s,refetchBusiness:t}){const n=Ce(qs,s),[a,i]=N.useState(ps(n)),{userContext:l}=N.useContext(He),{updateBusiness:c,fetching:r}=Ss(),[o,m]=N.useState(!1),[x,u]=N.useState(void 0),h=Ee({defaultValues:a}),k=async p=>{if(!n||!l?.context.adminBusinessId)return;const D=vs(p,h.formState.dirtyFields);if(!D)return;const b=Sn(D);await c({businessId:n.id,ownerId:l.context.adminBusinessId,fields:b}),D.tags?.length||D.description?(u({tagIds:D.tags?.map(A=>({id:A})),description:D.description}),m(!0)):t?.()};if(N.useEffect(()=>{if(n){const p=ps(n);i(p),h.reset(p)}},[n,h]),!n)return e.jsx("div",{});const d=h.watch("isClient");return e.jsxs(H,{children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Configurations"}),e.jsx(Y,{children:"Business status, tax settings, automation rules, and integration preferences"})]}),!d&&e.jsx(kn,{businessId:n.id,onDone:t})]})}),e.jsx(Te,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(k),children:[e.jsxs(Z,{className:"space-y-6",children:[e.jsx(En,{form:h}),e.jsx(Oe,{}),e.jsx(Tn,{form:h}),e.jsx(Oe,{}),e.jsx(Pn,{form:h}),e.jsx(Oe,{}),e.jsx(On,{form:h})]}),e.jsx(fs,{className:"flex justify-end border-t pt-6",children:e.jsxs(T,{type:"submit",disabled:r||Object.keys(h.formState.dirtyFields).length===0,children:[e.jsx(ws,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(qt,{businessId:n.id,tagIds:x?.tagIds,description:x?.description,open:o,onOpenChange:m,onClose:t})]})}function En({form:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Business Status & Behavior"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:s.control,name:"isClient",render:({field:t,fieldState:n})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"Is Client"}),e.jsx(ee,{children:"Mark this business as a client"})]}),e.jsx(y,{children:e.jsx(W,{disabled:!0,checked:t.value,onCheckedChange:t.onChange,className:S(n)})})]})}),e.jsx(g,{control:s.control,name:"isActive",render:({field:t,fieldState:n})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"Is Active"}),e.jsx(ee,{children:"Business is currently active"})]}),e.jsx(y,{children:e.jsx(W,{checked:t.value,onCheckedChange:t.onChange,className:S(n)})})]})}),e.jsx(g,{control:s.control,name:"isReceiptEnough",render:({field:t,fieldState:n})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"Is Receipt Enough"}),e.jsx(ee,{children:"Generate ledger for receipt documents if no invoice available"})]}),e.jsx(y,{children:e.jsx(W,{checked:t.value,onCheckedChange:t.onChange,className:S(n)})})]})}),e.jsx(g,{control:s.control,name:"isDocumentsOptional",render:({field:t,fieldState:n})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"No Docs Required"}),e.jsx(ee,{children:"Skip document validation for common charges"})]}),e.jsx(y,{children:e.jsx(W,{checked:t.value,onCheckedChange:t.onChange,className:S(n)})})]})}),e.jsx(g,{control:s.control,name:"isVatOptional",render:({field:t,fieldState:n})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"Is VAT Optional"}),e.jsx(ee,{children:"Mute missing VAT indicator"})]}),e.jsx(y,{children:e.jsx(W,{checked:t.value,onCheckedChange:t.onChange,className:S(n)})})]})}),e.jsx(g,{control:s.control,name:"isExemptDealer",render:({field:t,fieldState:n})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"Is Exempt Dealer"}),e.jsx(ee,{children:"Business is exempt from VAT requirements"})]}),e.jsx(y,{children:e.jsx(W,{checked:t.value,onCheckedChange:t.onChange,className:S(n)})})]})})]})]})}function Tn({form:s}){const{selectableTaxCategories:t,fetching:n}=Ks(),{selectableSortCodes:a,fetching:i,sortCodes:l}=Ws(),{selectableTags:c,fetching:r}=Hs(),o=N.useCallback(m=>{if(m){const x=l.find(u=>Number(u.key)===Number(m));x&&(x.defaultIrsCode?s.setValue("irsCode",x.defaultIrsCode,{shouldDirty:!0}):s.setValue("irsCode",null,{shouldDirty:!0}))}},[s,l]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Default Settings"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{control:s.control,name:"sortCode",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"Sort Code"}),e.jsx(y,{children:e.jsx(Re,{onChange:u=>{o(u),m.onChange(u)},data:a,value:m.value,disabled:i,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:S(x)}})}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"taxCategory",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"Tax Category"}),e.jsx(y,{children:e.jsx(Re,{data:t,disabled:n,value:m.value,onChange:m.onChange,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:S(x)}})}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"pcn874RecordType",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"PCN874 Record Type"}),e.jsxs(ie,{onValueChange:m.onChange,value:m.value,children:[e.jsx(y,{children:e.jsx(le,{className:S(x),children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.entries(Xs).map(([u,h])=>e.jsx(de,{value:u,children:`${h} (${u})`},u))})]}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"irsCode",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"IRS Code"}),e.jsx(y,{children:e.jsx(Qs,{value:m.value??void 0,onValueChange:u=>m.onChange(u??null),hideControls:!0,decimalScale:0,className:S(x)})}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"description",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"Charge Description"}),e.jsx(y,{children:e.jsx(O,{placeholder:"Enter default charge description",...m,className:S(x)})}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"tags",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"Tags"}),e.jsx(y,{children:e.jsx(Ys,{options:Object.values(c).map(({value:u,label:h})=>({label:h,value:u})),onValueChange:m.onChange,defaultValue:m.value,value:m.value,placeholder:"Select Default Tags",variant:"default",disabled:r,className:S(x)})}),e.jsx(C,{})]})})]})]})}function Pn({form:s}){const[t,n]=N.useState(""),[a,i]=N.useState(""),l=()=>{if(t.trim()){const m=s.getValues("phrases");s.setValue("phrases",[...m,t.trim()],{shouldDirty:!0}),n("")}},c=()=>{if(a.trim()){const m=s.getValues("emails");s.setValue("emails",[...m,a.trim()],{shouldDirty:!0}),i("")}},r=m=>{const x=s.getValues("phrases");s.setValue("phrases",x.filter((u,h)=>h!==m),{shouldDirty:!0})},o=m=>{const x=s.getValues("emails");s.setValue("emails",x.filter((u,h)=>h!==m),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Auto-matching Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure patterns for automatic matching of bank transactions and documents"}),e.jsx(g,{control:s.control,name:"phrases",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"Phrases"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{placeholder:"Add phrase...",value:t,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),l())},className:S(x)}),e.jsx(T,{type:"button",size:"sm",onClick:l,children:e.jsx(G,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:m.value?.map((u,h)=>e.jsxs(U,{variant:"secondary",className:"gap-1",children:[u,e.jsx(T,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>r(h),children:e.jsx(ue,{className:"size-3 cursor-pointer",onClick:()=>r(h)})})]},h))}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"emails",render:({field:m,fieldState:x})=>e.jsxs(f,{children:[e.jsx(v,{children:"Email Addresses"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{type:"email",placeholder:"Add email...",value:a,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())},className:S(x)}),e.jsx(T,{type:"button",size:"sm",onClick:c,children:e.jsx(G,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:m.value?.map((u,h)=>e.jsxs(U,{variant:"secondary",className:"gap-1",children:[u,e.jsx(T,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>o(h),children:e.jsx(ue,{className:"size-3 cursor-pointer"})})]},h))}),e.jsx(C,{})]})})]})}function On({form:s}){const[t,n]=N.useState(""),a=()=>{if(t.trim()){const c=s.getValues("internalLinks");s.setValue("internalLinks",[...c,t.trim()],{shouldDirty:!0}),n("")}},i=c=>{const r=s.getValues("attachmentTypes");s.setValue("attachmentTypes",r?.includes(c)?r.filter(o=>o!==c):[...r,c],{shouldDirty:!0})},l=c=>{const r=s.getValues("internalLinks");s.setValue("internalLinks",r.filter((o,m)=>m!==c),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Gmail Feature Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Gmail integration settings for document processing"}),e.jsx(g,{control:s.control,name:"attachmentTypes",render:({field:c,fieldState:r})=>e.jsxs(f,{children:[e.jsx(v,{children:"Attachment Types"}),e.jsx("div",{className:S(r)+" rounded-md flex flex-wrap gap-2",children:Dn.map(o=>e.jsx(U,{variant:c.value?.includes(o)?"default":"outline",className:"cursor-pointer",onClick:()=>i(o),children:o},o))}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"internalLinks",render:({field:c,fieldState:r})=>e.jsxs(f,{children:[e.jsx(v,{children:"Internal Links"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{type:"url",placeholder:"Add internal link...",value:t,onChange:o=>n(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),a())}}),e.jsx(T,{type:"button",size:"sm",onClick:a,children:e.jsx(G,{className:"h-4 w-4"})})]}),e.jsx("div",{className:S(r)+" flex flex-wrap gap-2 rounded-md",children:c.value?.map((o,m)=>e.jsxs(U,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[o,e.jsx(T,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>l(m),children:e.jsx(ue,{className:"size-3 cursor-pointer flex-shrink-0"})})]},m))}),e.jsx(C,{})]})}),e.jsx(g,{control:s.control,name:"useMessageBody",render:({field:c,fieldState:r})=>e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:"Should Use Message Body"}),e.jsx(ee,{children:"Extract information from email message body"})]}),e.jsx(y,{children:e.jsx(W,{checked:c.value,onCheckedChange:c.onChange,className:S(r)})})]})})]})}const Ln=Qe({businessName:R().min(1,"Business name is required"),locality:R().min(1,"Locality is required"),localName:R().optional(),govId:R().optional(),address:R().optional(),localAddress:R().optional(),phone:R().optional(),website:ys("Invalid URL").optional().or(Ns("")),generalContacts:Me($e()).optional(),billingEmails:Me($e()).optional()});function js(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{businessName:s.name,locality:s.country,localName:s.hebrewName??void 0,govId:s.governmentId??void 0,address:s.address??void 0,phone:s.phoneNumber??void 0,website:s.website??void 0,generalContacts:s.email?.split(",").map(t=>t.trim()),billingEmails:s.clientInfo?.emails}}function Bn(s){return{name:s.businessName,country:s.locality,hebrewName:s.localName,governmentId:s.govId,address:s.address,phoneNumber:s.phone,website:s.website,email:s.generalContacts?.join(", ")}}function Vn({data:s,refetchBusiness:t}){const n=Ce(st,s),[a,i]=N.useState(js(n)),{userContext:l}=N.useContext(He),{updateBusiness:c,fetching:r}=Ss(),o=Ee({resolver:Xe(Ln),defaultValues:a}),{countries:m,fetching:x}=Js(),[u,h]=N.useState(""),[k,d]=N.useState(""),p=o.watch("locality"),D=o.watch("address"),b=o.watch("localAddress");N.useEffect(()=>{D!==a.address&&o.setValue("address",D,{shouldDirty:!0})},[D,a.address,o]),N.useEffect(()=>{b!==a.localAddress&&o.setValue("localAddress",b,{shouldDirty:!0})},[b,a.localAddress,o]);const A=n&&"clientInfo"in n&&!!n.clientInfo,B=p===l?.context.locality,M=j=>{u.trim()&&(o.setValue("generalContacts",[...j,u.trim()],{shouldDirty:!0}),h(""))},_=(j,w)=>{o.setValue("generalContacts",j.filter((E,P)=>P!==w),{shouldDirty:!0})},q=j=>{k.trim()&&(o.setValue("billingEmails",[...j,k.trim()],{shouldDirty:!0}),d(""))},z=(j,w)=>{o.setValue("billingEmails",j.filter((E,P)=>P!==w),{shouldDirty:!0})},te=async j=>{if(!n||!l?.context.adminBusinessId)return;const w=vs(j,o.formState.dirtyFields);if(!w)return;const E=Bn(w);await c({businessId:n.id,ownerId:l.context.adminBusinessId,fields:E}),t?.()};return N.useEffect(()=>{if(n){const j=js(n);i(j),o.reset(j)}},[n,o]),e.jsxs(H,{children:[e.jsxs(X,{children:[e.jsx(Q,{children:"Contact Information"}),e.jsx(Y,{children:"Business contact details and address information"})]}),e.jsx(Te,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(te),children:[e.jsx(Z,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(g,{control:o.control,name:"businessName",render:({field:j,fieldState:w})=>e.jsxs(f,{children:[e.jsx(v,{children:"Business Name"}),e.jsx(y,{children:e.jsx(O,{...j,className:S(w)})}),e.jsx(C,{})]})}),e.jsx(g,{control:o.control,name:"locality",render:({field:j,fieldState:w})=>e.jsxs(f,{children:[e.jsx(v,{children:"Locality / Country"}),e.jsx(Re,{onChange:j.onChange,data:m.map(E=>({value:E.code,label:E.name})),value:j.value,disabled:x,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:S(w)}}),e.jsx(C,{})]})}),B&&e.jsx(g,{control:o.control,name:"localName",render:({field:j,fieldState:w})=>e.jsxs(f,{children:[e.jsx(v,{children:"Local Name"}),e.jsx(y,{children:e.jsx(O,{...j,placeholder:"Business name in local language",className:S(w)})}),e.jsx(C,{})]})}),B&&e.jsx(g,{control:o.control,name:"govId",render:({field:j,fieldState:w})=>e.jsxs(f,{children:[e.jsx(v,{children:"Government ID"}),e.jsx(y,{children:e.jsx(O,{...j,placeholder:"Enter Government ID",className:S(w)})}),e.jsx(C,{})]})}),e.jsx(g,{control:o.control,name:"address",render:({field:j,fieldState:w})=>e.jsxs(f,{className:"md:col-span-2",children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4"}),"Address"]}),e.jsx(y,{children:e.jsx(ze,{...j,rows:3,placeholder:"Enter business address",className:S(w)})}),e.jsx(C,{})]})}),B&&e.jsx(g,{control:o.control,name:"localAddress",render:({field:j,fieldState:w})=>e.jsxs(f,{className:"md:col-span-2",children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4"}),"Local Address"]}),e.jsx(y,{children:e.jsx(ze,{...j,rows:3,placeholder:"Enter address in local language",className:S(w)})}),e.jsx(C,{})]})}),e.jsx(g,{control:o.control,name:"phone",render:({field:j,fieldState:w})=>e.jsxs(f,{children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(As,{className:"h-4 w-4"}),"Phone"]}),e.jsx(y,{children:e.jsx(O,{...j,type:"tel",placeholder:"+1 (555) 123-4567",className:S(w)})}),e.jsx(C,{})]})}),e.jsx(g,{control:o.control,name:"website",render:({field:j,fieldState:w})=>e.jsxs(f,{children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(et,{className:"h-4 w-4"}),"Website"]}),e.jsx(y,{children:e.jsx(O,{...j,type:"url",placeholder:"https://example.com",className:S(w)})}),e.jsx(C,{})]})}),e.jsx(g,{control:o.control,name:"generalContacts",render:({field:j,fieldState:w})=>e.jsxs(f,{className:"md:col-span-2",children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(Ue,{className:"h-4 w-4"}),"General Contacts"]}),e.jsx(y,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:S(w)+" flex flex-wrap gap-2 mb-2 rounded-md",children:j.value?.map((E,P)=>e.jsxs(U,{variant:"secondary",className:"gap-1 pr-1",children:[E,e.jsx("button",{type:"button",onClick:()=>_(j.value??[],P),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ue,{className:"h-3 w-3"})})]},P))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{value:u,onChange:E=>h(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),M(j.value??[]))},placeholder:"Add contact email",type:"email"}),e.jsx(T,{type:"button",variant:"outline",size:"icon",disabled:!u.trim(),onClick:()=>M(j.value??[]),children:e.jsx(G,{className:"h-4 w-4"})})]})]})}),e.jsx(C,{})]})}),A&&e.jsx(g,{control:o.control,name:"billingEmails",render:({field:j,fieldState:w})=>e.jsxs(f,{className:"md:col-span-2",children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(Ue,{className:"h-4 w-4"}),"Billing Emails"]}),e.jsx(y,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:S(w)+" flex flex-wrap gap-2 mb-2 rounded-md",children:j.value?.map((E,P)=>e.jsxs(U,{variant:"secondary",className:"gap-1 pr-1",children:[E,e.jsx("button",{type:"button",onClick:()=>z(j.value??[],P),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ue,{className:"h-3 w-3"})})]},P))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{value:k,onChange:E=>d(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),q(j.value??[]))},placeholder:"Add billing email",type:"email"}),e.jsx(T,{type:"button",variant:"outline",size:"icon",disabled:!k.trim(),onClick:()=>q(j.value??[]),children:e.jsx(G,{className:"h-4 w-4"})})]})]})}),e.jsx(C,{})]})})]})}),e.jsx(fs,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(T,{type:"submit",disabled:r||Object.keys(o.formState.dirtyFields).length===0,children:[e.jsx(ws,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})})]})}const _n="createContract",Fn=()=>{const[{fetching:s},t]=Se(tt),n=N.useCallback(async a=>{const i=`Error creating new contract for client[${a.input.clientId}]`,l=`${_n}-${a.input.clientId}`;F.loading("Creating contract",{id:l});try{const c=await t(a);Ae(c,i,l)&&F.success("Success",{id:l,description:`Contract for client ${a.input.clientId} was successfully created`})}catch(c){console.error(`${i}: ${c}`),F.error("Error",{id:l,description:i,duration:1e5,closeButton:!0})}},[t]);return{creating:s,createContract:n}},Mn="updateContract",$n=()=>{const[{fetching:s},t]=Se(nt),n=N.useCallback(async a=>{const i=`Error updating contract ID [${a.contractId}]`,l=`${Mn}-${a.contractId}`;F.loading("Updating contract",{id:l});try{const c=await t(a),r=Ae(c,i,l,"updateContract");if(r)return F.success("Success",{id:l,description:"Contract updated"}),r.updateContract}catch(c){console.error(`${i}: ${c}`),F.error("Error",{id:l,description:i,duration:1e5,closeButton:!0})}},[t]);return{updating:s,updateContract:n}},Rn=Qe({id:Fe().optional(),startDate:cs("Start date is required"),endDate:cs("End date is required"),po:R().optional(),paymentAmount:rt().min(0,"Payment amount must be non-negative"),paymentCurrency:re(Object.values(rs),"Currency is required"),productType:re(Object.values(Cs)).optional(),msCloudLink:ys().optional().or(Ns("")),billingCycle:re(Object.values(Ne)).optional(),subscriptionPlan:re(Object.values(Ie)).optional(),isActive:at(),defaultRemark:R().optional(),defaultDocumentType:re(Object.values(me))}),gs={startDate:"",endDate:"",po:void 0,paymentAmount:0,paymentCurrency:rs.Usd,productType:Cs.Hive,msCloudLink:void 0,billingCycle:Ne.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:me.Proforma};function zn({clientId:s,contract:t,onDone:n}){const[a,i]=N.useState(!1),[l,c]=N.useState(null),{updateContract:r,updating:o}=$n(),{createContract:m,creating:x}=Fn(),u=Ee({resolver:Xe(Rn),defaultValues:t||gs});N.useEffect(()=>{t&&(c(t),u.reset({startDate:t.startDate,endDate:t.endDate,po:t.po,paymentAmount:t.paymentAmount,paymentCurrency:t.paymentCurrency,productType:t.productType,msCloudLink:t.msCloudLink,billingCycle:t.billingCycle,subscriptionPlan:t.subscriptionPlan,isActive:t.isActive,defaultRemark:t.defaultRemark,defaultDocumentType:t.defaultDocumentType}),i(!0))},[t,u]);const h=()=>{c(null),u.reset(gs),i(!0)},k=N.useCallback(async d=>{if(l)await r({contractId:l.id,input:{amount:{raw:d.paymentAmount,currency:d.paymentCurrency},billingCycle:d.billingCycle,documentType:d.defaultDocumentType,endDate:ve(new Date(d.endDate),"yyyy-MM-dd"),isActive:d.isActive,msCloud:d.msCloudLink,plan:d.subscriptionPlan,product:d.productType,purchaseOrder:d.po,remarks:d.defaultRemark,startDate:ve(new Date(d.startDate),"yyyy-MM-dd")}});else{if(!d.billingCycle){u.setError("billingCycle",{message:"Billing cycle is required"});return}await m({input:{clientId:s,amount:{raw:d.paymentAmount,currency:d.paymentCurrency},billingCycle:d.billingCycle,documentType:d.defaultDocumentType,endDate:ve(new Date(d.endDate),"yyyy-MM-dd"),isActive:d.isActive,msCloud:d.msCloudLink,plan:d.subscriptionPlan,product:d.productType,purchaseOrder:d.po,remarks:d.defaultRemark,startDate:ve(new Date(d.startDate),"yyyy-MM-dd")}})}i(!1),c(null),n?.()},[l,n,m,r,s,u]);return e.jsxs(Ye,{open:a,onOpenChange:i,children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{size:"sm",onClick:h,children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),"New Contract"]})}),e.jsxs(Je,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(es,{children:[e.jsx(ss,{children:l?"Edit Contract":"Create New Contract"}),e.jsx(ts,{children:l?"Update contract details":"Add a new contract with all required details"})]}),e.jsx(Te,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(k),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.jsx(g,{control:u.control,name:"po",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"PO Number"}),e.jsx(y,{children:e.jsx(O,{placeholder:"PO-2024-001",...d})}),e.jsx(C,{})]})})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{control:u.control,name:"startDate",render:({field:{onChange:d,...p}})=>e.jsxs(f,{children:[e.jsx(v,{children:"Start Date"}),e.jsx(y,{children:e.jsx(O,{type:"date",...p,onInput:D=>d(D)})}),e.jsx(C,{})]})}),e.jsx(g,{control:u.control,name:"endDate",render:({field:{onChange:d,...p}})=>e.jsxs(f,{children:[e.jsx(v,{children:"End Date"}),e.jsx(y,{children:e.jsx(O,{type:"date",...p,onInput:D=>d(D)})}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(g,{control:u.control,name:"paymentAmount",render:({field:d})=>e.jsxs(f,{className:"md:col-span-2",children:[e.jsx(v,{children:"Payment Amount"}),e.jsx(y,{children:e.jsx(O,{type:"number",placeholder:"24000",...d,onChange:p=>{d.onChange(p?.target.value?Number(p?.target.value):void 0)}})}),e.jsx(C,{})]})}),e.jsx(g,{control:u.control,name:"paymentCurrency",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"Currency"}),e.jsxs(ie,{onValueChange:d.onChange,defaultValue:d.value,children:[e.jsx(y,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(rs).map(p=>e.jsx(de,{value:p,children:p},p))})]}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{control:u.control,name:"productType",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"Product Type"}),e.jsx(y,{children:e.jsx(O,{placeholder:"Cloud Services",...d})}),e.jsx(C,{})]})}),e.jsx(g,{control:u.control,name:"billingCycle",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"Billing Cycle"}),e.jsxs(ie,{onValueChange:d.onChange,defaultValue:d.value,children:[e.jsx(y,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(Ne).map(p=>e.jsx(de,{value:p,children:Es(p)},p))})]}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{control:u.control,name:"subscriptionPlan",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"Subscription Plan"}),e.jsx(y,{children:e.jsxs(ie,{onValueChange:d.onChange,defaultValue:d.value,children:[e.jsx(y,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(Ie).map(p=>e.jsx(de,{value:p,children:Ts(p)},p))})]})}),e.jsx(C,{})]})}),e.jsx(g,{control:u.control,name:"isActive",render:({field:d})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(v,{className:"text-base",children:"Active Status"})}),e.jsx(y,{children:e.jsx(W,{checked:d.value,onCheckedChange:d.onChange})})]})})]}),e.jsx(g,{control:u.control,name:"msCloudLink",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"MS Cloud Link"}),e.jsx(y,{children:e.jsx(O,{type:"url",placeholder:"https://portal.azure.com/contract-id",...d})}),e.jsx(C,{})]})}),e.jsx(g,{control:u.control,name:"defaultDocumentType",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"Default Document Type"}),e.jsxs(ie,{onValueChange:d.onChange,defaultValue:d.value,children:[e.jsx(y,{children:e.jsx(le,{children:e.jsx(ce,{})})}),e.jsx(oe,{children:Object.values(me).map(p=>e.jsx(de,{value:p,children:ns(p)},p))})]}),e.jsx(C,{})]})}),e.jsx(g,{control:u.control,name:"defaultRemark",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:"Default Remark"}),e.jsx(y,{children:e.jsx(ze,{placeholder:"Enter default remark for this contract...",rows:3,...d})}),e.jsx(C,{})]})})]}),e.jsxs(as,{children:[e.jsx(T,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(T,{type:"submit",disabled:x||o,children:l?"Update Contract":"Create Contract"})]})]})})]})]})}function Un(s){return{id:s.id,po:s.purchaseOrder??void 0,startDate:s.startDate,endDate:s.endDate,paymentAmount:s.amount.raw,paymentCurrency:s.amount.currency,productType:s.product??void 0,billingCycle:s.billingCycle,msCloudLink:s.msCloud?.toString(),isActive:s.isActive,subscriptionPlan:s.plan??void 0,defaultRemark:s.remarks??void 0,defaultDocumentType:s.documentType??void 0}}function Gn({clientId:s}){const[t,n]=N.useState(null),[{data:a,fetching:i},l]=De({query:it,variables:{clientId:s}}),c=a?.contractsByClient??[];return i?e.jsx("div",{children:"Loading contracts..."}):e.jsxs(H,{children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Contracts"}),e.jsx(Y,{children:"Current and past contracts sorted by start date"})]}),e.jsx(zn,{clientId:s,contract:t,onDone:l})]})}),e.jsx(Z,{className:"space-y-4",children:c.map(r=>{const o=!!r.isActive;return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:r.product}),e.jsx(U,{variant:o?"default":"secondary",children:r.isActive?"Active":"Inactive"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:r.id})]}),e.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(Un(r)),children:e.jsx(Kt,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(lt,{className:"h-3 w-3"}),"Contract Period"]}),e.jsxs("p",{className:"text-sm font-medium",children:[new Date(r.startDate).toLocaleDateString()," →"," ",new Date(r.endDate).toLocaleDateString()]})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"PO Number"}),e.jsx("p",{className:"text-sm font-medium font-mono",children:r.purchaseOrder})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Payment"}),e.jsx("p",{className:"text-sm font-medium",children:ct(r.amount.raw,r.amount.currency)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing Cycle"}),e.jsx("p",{className:"text-sm font-medium",children:Es(r.billingCycle)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscription Plan"}),e.jsx("p",{className:"text-sm font-medium",children:r.plan?Ts(r.plan):"N/A"})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Document Type"}),e.jsx("p",{className:"text-sm font-medium",children:ns(r.documentType)})]})]}),r.remarks&&e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remark"}),e.jsx("p",{className:"text-sm",children:r.remarks})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.msCloud&&e.jsx(T,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:r.msCloud.toString(),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ot,{className:"h-4 w-4 mr-2"}),"MS Cloud",e.jsx(dt,{className:"h-3 w-3 ml-1"})]})})})]},r.id)})})]})}function qn({businessId:s}){return e.jsxs(H,{children:[e.jsx(X,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(Q,{children:"Documents"}),e.jsx(Y,{children:"Invoices, proformas, receipts, and other accounting documents"})]})})}),e.jsx(Z,{children:e.jsx(mt,{businessId:s,linkedDocumentIds:[],limit:1e3})})]})}const Kn=[{id:"hive",name:"Hive",description:"Schema registry, analytics, metrics and gateway for GraphQL federation and other GraphQL APIs",status:"disconnected",lastSync:"Never"},{id:"slack",name:"Slack",description:"Team communication and notifications",status:"disconnected",lastSync:"Never"},{id:"retool",name:"Retool",description:"Internal tools and dashboards",status:"disconnected",lastSync:"Never"},{id:"linear",name:"Linear",description:"Issue tracking and project management",status:"disconnected",lastSync:"Never"},{id:"workflowy",name:"Workflowy",description:"Task management and note taking",status:"disconnected",lastSync:"Never"}];function Wn({data:s}){const t=Ce(xt,s),[{data:n,fetching:a},i]=De({query:ut,variables:{clientId:t?.id??""},pause:!t?.clientInfo?.greenInvoiceId||!t?.id}),{updateClient:l}=Ls(),c=N.useCallback((o,m)=>{if(!t?.id)return;const x={};x[m]=o,l({businessId:t?.id,fields:x})},[t?.id,l]);N.useEffect(()=>{t?.clientInfo?.greenInvoiceId&&t?.id&&i()},[t?.clientInfo?.greenInvoiceId,t?.id,i]);const r=n?.greenInvoiceClient;return e.jsxs(H,{children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Integrations"}),e.jsx(Y,{children:"Connected external services and providers"})]}),e.jsxs(T,{size:"sm",children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),"Add Integration"]})]})}),e.jsx(Z,{className:"space-y-6",children:e.jsxs(Wt,{type:"multiple",defaultValue:["green-invoice"],className:"space-y-4",children:[a?e.jsxs(Be,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(I,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-6 w-32"}),e.jsx(I,{className:"h-5 w-5 rounded-full"})]}),e.jsx(I,{className:"h-4 w-64"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-8 w-24"}),e.jsx(I,{className:"h-8 w-8"})]})]})}),e.jsx(Ve,{children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-32"}),e.jsx(I,{className:"h-6 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{className:"h-3 w-24"}),e.jsx(I,{className:"h-4 w-full"})]})]})]})]})})]}):e.jsxs(Be,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-green-600 flex items-center justify-center text-white font-bold",children:"GI"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Green Invoice"}),e.jsx(ms,{className:"h-5 w-5 text-green-600"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Israeli invoicing system integration"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Hn,{id:t?.clientInfo?.greenInvoiceId,provider:"Green Invoice",updateClient:async o=>c(o,"greenInvoiceId")}),e.jsx(ds,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Ve,{children:r&&e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Business Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Integration ID"}),e.jsx("p",{className:"text-sm font-mono",children:t?.clientInfo?.greenInvoiceId})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Business Name"}),e.jsx("p",{className:"text-sm",children:r.name})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Country"}),e.jsx("p",{className:"text-sm",children:r.country})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"text-sm font-mono",children:r.taxId})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Contact Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(Ue,{className:"h-3.5 w-3.5"}),"Email Addresses"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.emails?.map((o,m)=>e.jsx("span",{className:"text-sm px-2 py-1 bg-muted rounded",children:o},m))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(As,{className:"h-3.5 w-3.5"}),"Phone"]}),e.jsx("p",{className:"text-sm font-mono",children:r.phone})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Mobile"}),e.jsx("p",{className:"text-sm font-mono",children:r.mobile})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Fax"}),e.jsx("p",{className:"text-sm font-mono",children:r.fax})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),"Address"]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Street Address"}),e.jsx("p",{className:"text-sm",children:r.address})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"City"}),e.jsx("p",{className:"text-sm",children:r.city})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Zip Code"}),e.jsx("p",{className:"text-sm font-mono",children:r.zip})]})]})]})]})})]}),Kn.map(o=>e.jsxs(Be,{value:o.id,className:"rounded-lg border",children:[e.jsx("div",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-3 flex-1",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:o.name}),o.status==="connected"?e.jsx(ms,{className:"h-4 w-4 text-green-600"}):e.jsx(ht,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{variant:"ghost",size:"sm",onClick:m=>m.stopPropagation(),children:e.jsx(is,{className:"h-4 w-4"})}),e.jsx(ds,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Ve,{children:e.jsx("div",{className:"px-4 pb-4 pt-2 border-t",children:e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last sync: "}),e.jsx("span",{className:"font-medium",children:o.lastSync})]})})})]},o.id))]})})]})}function Hn({id:s,provider:t,updateClient:n}){const[a,i]=N.useState(!1),[l,c]=N.useState(s),r=N.useCallback(async()=>{await n(l),i(!1)},[l,n]);return e.jsxs(Ye,{open:a,onOpenChange:i,children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",onClick:o=>o.stopPropagation(),children:[e.jsx(is,{className:"h-4 w-4 mr-2"}),"Configure"]})}),e.jsxs(Je,{onClick:o=>o.stopPropagation(),children:[e.jsxs(es,{children:[e.jsxs(ss,{children:["Configure ",t]}),e.jsxs(ts,{children:["Update your ",t," integration settings"]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(pt,{htmlFor:"id",children:[t," ID"]}),e.jsx(O,{id:"id",value:l,onChange:o=>c(o.target.value),placeholder:`Enter ${t} ID`})]})}),e.jsxs(as,{children:[e.jsx(T,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(T,{onClick:r,disabled:!l,children:"Save Changes"})]})]})]})}function Xn({businessId:s}){return e.jsxs(H,{children:[e.jsx(X,{className:"flex w-full justify-between items-center",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(Q,{children:"Transactions"}),e.jsx(Y,{children:"Complete transaction history for this business"})]})})}),e.jsx(Z,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(jt,{businessID:s,filter:{}})})})]})}function Qn({data:s,refetchBusiness:t}){const n=Ce(Ct,s),[a,i]=gt(),l=a.get("tab")||"contact",c=o=>{i({tab:o})};if(!n)return e.jsx("div",{children:"Business not found"});const r="clientInfo"in n&&!!n.clientInfo;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(nn,{data:n}),e.jsx("main",{className:"container mx-auto px-4 py-6 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs(ft,{value:l,onValueChange:c,className:"w-full",children:[e.jsxs(vt,{className:"grid w-full lg:grid-cols-8 sm:grid-cols-4 grid-cols-8 mb-6 h-auto gap-1 bg-muted/50 p-1",children:[e.jsxs(J,{value:"contact",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(bs,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contact"})]}),e.jsxs(J,{value:"config",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(is,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Config"})]}),e.jsxs(J,{value:"charges",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(we,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Charges"})]}),e.jsxs(J,{value:"transactions",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(yt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Transactions"})]}),e.jsxs(J,{value:"documents",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Nt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documents"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{value:"contracts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contracts"})]}),e.jsxs(J,{value:"integrations",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(sn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Integrations"})]})]})]}),e.jsx(K,{value:"contact",className:"mt-0",children:e.jsx(Vn,{data:n,refetchBusiness:t})}),e.jsx(K,{value:"config",className:"mt-0",children:e.jsx(An,{data:n,refetchBusiness:t})}),e.jsx(K,{value:"charges",className:"mt-0",children:e.jsx(an,{businessId:n.id})}),e.jsx(K,{value:"transactions",className:"mt-0",children:e.jsx(Xn,{businessId:n.id})}),e.jsx(K,{value:"documents",className:"mt-0",children:e.jsx(qn,{businessId:n.id})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(K,{value:"contracts",className:"mt-0",children:e.jsx(Gn,{clientId:n.id})}),e.jsx(K,{value:"integrations",className:"mt-0",children:e.jsx(Wn,{data:n})}),e.jsx(K,{value:"charts",className:"mt-0",children:e.jsx(Nn,{})})]})]})})]})}function aa(s){return`/businesses/${s}`}const ra=()=>{const{businessId:s}=bt();let t;try{t=wt()}catch{}const[{data:n,fetching:a},i]=De({query:kt,pause:!s||!!t,variables:{businessId:s??""}}),l=t||n;return!t&&a&&!l?.business?e.jsx(It,{}):!s||!l?.business?e.jsx("div",{children:"Business not found"}):e.jsx(Qn,{data:l.business,refetchBusiness:async()=>i()})};export{ra as BusinessScreen,aa as getBusinessHref};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bn as S,u as g,r as m,F as x,a as C,j as o,bu as y,w as T,bv as h,bw as b,a_ as n,be as F,bx as v}from"./index-Bj3HckU6.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(x),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=C({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(y,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(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 +0,0 @@
|
|
|
1
|
-
import{bn as u,r as n,F as p,a as c,j as s,w as x,c as d,bE as l}from"./index-Bj3HckU6.js";import{P as m,C as b,E as T}from"./editable-business-trip-VNJjiYOp.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 +0,0 @@
|
|
|
1
|
-
import{c_ as B,r as i,u as H,d1 as R,j as e,c$ as W,O as z,bA as G,B as _,d0 as q,U as K,k as Q,Z as N,a5 as D,di as J,aK as X,l as Z,dj as $,bP as h,ch as k,fq as Y,bU as O,bV as L,bQ as P,ey as A,aG as x,fr as ee,bd as se,ak as m,al as j,am as g,aq as p,dK as ae,dL as te,dM as ne}from"./index-Bj3HckU6.js";import{s as oe}from"./sub-BIMwxqar.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(K),o=Q({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}=J(),{selectableTags:v,fetching:I}=X(),E=C("sortBy.field");i.useEffect(()=>{E&&!c?u(!0):!E&&c&&u(!1)},[E,c]);const V=s=>{b!=null&&s.sortBy?.field&&(s.sortBy.asc=b),w(s),d()};function U(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(Z,{...o,children:e.jsxs("form",{onSubmit:T(V),children:[e.jsxs($,{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:Y,value:s.value??[],disabled:I,label:"Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0,filter:(l,f,M)=>M.label?.toLowerCase().includes(l.toLowerCase().trim())||M.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:O,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:O,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:U,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}=H();i.useEffect(()=>{const t=d>1?d.toFixed(0):null,v=c("page");t!==v&&u("page",t)},[d,c,u]),i.useEffect(()=>{const t=le(a),v=c("chargesFilters");t!==v&&(u("chargesFilters",t),u("page"),y(1))},[a,c,u,y]);const S=i.useCallback(t=>{R(t,a)||(w(t),F(!B(t)))},[a,w]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(W,{opened:T,onClose:()=>C(!1),content:e.jsx(ie,{filter:a,setFilter:S,closeModal:()=>C(!1)}),modalSize:"xl"}),o>1&&e.jsx(z,{className:"flex-auto",value:d,onChange:y,total:o}),e.jsx(G,{inline:!0,size:16,disabled:!b,children:e.jsx(_,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>C(!0),children:e.jsx(q,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
|
|
@@ -1 +0,0 @@
|
|
|
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-Bj3HckU6.js";import{C as J}from"./charges-filters-CqWjSIKI.js";import{M as $}from"./index-BMcyYDGt.js";import{P as G}from"./Progress-Cjv9yrat.js";import"./sub-BIMwxqar.js";import"./subMonths-B7SR4Lli.js";import"./Checkbox-DBF5r7jA.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};
|