@accounter/client 0.0.7-alpha-20250821153812-03cbf41f6d049dc4fec6c6e7c47a0f17144b7d6a → 0.0.7-alpha-20250821154917-56a2f7e8af3ffb2e1a9a98c07778af240de41d98
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 +7 -1
- package/dist/assets/{index-C3Jzs8px.js → index-B06NFENr.js} +370 -330
- package/dist/assets/index-DBmbnNAy.css +1 -0
- package/dist/assets/{index.es-CP2tkYw-.js → index.es-DtQCKFFT.js} +6 -6
- package/dist/index.html +2 -2
- package/package.json +2 -1
- package/src/app.tsx +4 -0
- package/src/components/layout/sidelinks.tsx +15 -0
- package/src/components/screens/operations/annual-audit/annual-audit-filters.tsx +158 -0
- package/src/components/screens/operations/annual-audit/index.tsx +370 -0
- package/src/components/screens/operations/annual-audit/step-01-validate-charges/index.tsx +266 -0
- package/src/components/screens/operations/annual-audit/step-02-ledger-changes/index.tsx +121 -0
- package/src/components/screens/operations/annual-audit/step-03-opening-balance/index.tsx +171 -0
- package/src/components/screens/operations/annual-audit/step-base.tsx +149 -0
- package/src/components/screens/operations/annual-audit/step-simple.tsx +43 -0
- package/src/components/ui/progress.tsx +28 -0
- package/src/gql/gql.ts +18 -0
- package/src/gql/graphql.ts +61 -0
- package/src/hooks/use-get-admin-businesses.ts +57 -0
- package/dist/assets/index-BERPxH5K.css +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { AlertCircle, CheckCircle2, ChevronDown, ChevronRight, Clock, Loader2 } from 'lucide-react';
|
|
5
|
+
import { Badge } from '../../../ui/badge.jsx';
|
|
6
|
+
import { Button } from '../../../ui/button.jsx';
|
|
7
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../../../ui/card.jsx';
|
|
8
|
+
|
|
9
|
+
export type StepStatus = 'completed' | 'in-progress' | 'pending' | 'blocked' | 'loading';
|
|
10
|
+
|
|
11
|
+
export interface BaseStepProps {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
level?: number;
|
|
17
|
+
onStatusChange?: (stepId: string, status: StepStatus) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface StepAction {
|
|
21
|
+
label: string;
|
|
22
|
+
href?: string;
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const getStatusIcon = (status: StepStatus) => {
|
|
27
|
+
switch (status) {
|
|
28
|
+
case 'completed':
|
|
29
|
+
return <CheckCircle2 className="h-5 w-5 text-green-600" />;
|
|
30
|
+
case 'in-progress':
|
|
31
|
+
return <Clock className="h-5 w-5 text-blue-600" />;
|
|
32
|
+
case 'pending':
|
|
33
|
+
return <Clock className="h-5 w-5 text-gray-400" />;
|
|
34
|
+
case 'blocked':
|
|
35
|
+
return <AlertCircle className="h-5 w-5 text-red-600" />;
|
|
36
|
+
case 'loading':
|
|
37
|
+
return <Loader2 className="h-5 w-5 text-gray-400 animate-spin" />;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const getStatusBadge = (status: StepStatus) => {
|
|
42
|
+
const variants = {
|
|
43
|
+
completed: 'default',
|
|
44
|
+
'in-progress': 'secondary',
|
|
45
|
+
pending: 'outline',
|
|
46
|
+
blocked: 'destructive',
|
|
47
|
+
loading: 'outline',
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
50
|
+
const labels = {
|
|
51
|
+
completed: 'Completed',
|
|
52
|
+
'in-progress': 'In Progress',
|
|
53
|
+
pending: 'Pending',
|
|
54
|
+
blocked: 'Blocked',
|
|
55
|
+
loading: 'Loading...',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return <Badge variant={variants[status]}>{labels[status]}</Badge>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
interface BaseStepCardProps extends BaseStepProps {
|
|
62
|
+
status: StepStatus;
|
|
63
|
+
actions?: StepAction[];
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
hasSubsteps?: boolean;
|
|
66
|
+
isExpanded?: boolean;
|
|
67
|
+
onToggleExpanded?: () => void;
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function BaseStepCard({
|
|
72
|
+
id,
|
|
73
|
+
title,
|
|
74
|
+
description,
|
|
75
|
+
icon,
|
|
76
|
+
status,
|
|
77
|
+
actions,
|
|
78
|
+
children,
|
|
79
|
+
hasSubsteps = false,
|
|
80
|
+
isExpanded = false,
|
|
81
|
+
onToggleExpanded,
|
|
82
|
+
level = 0,
|
|
83
|
+
disabled = false,
|
|
84
|
+
}: BaseStepCardProps) {
|
|
85
|
+
return (
|
|
86
|
+
<div className={`${level > 0 ? 'ml-6 border-l-2 border-gray-200 pl-4' : ''} relative`}>
|
|
87
|
+
<Card className="mb-4">
|
|
88
|
+
<CardHeader className="pb-3">
|
|
89
|
+
<div className="flex items-center justify-between">
|
|
90
|
+
<div className="flex items-center gap-3">
|
|
91
|
+
{hasSubsteps ? (
|
|
92
|
+
<Button
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
variant="ghost"
|
|
95
|
+
size="sm"
|
|
96
|
+
onClick={onToggleExpanded}
|
|
97
|
+
className="p-0 h-auto"
|
|
98
|
+
>
|
|
99
|
+
{isExpanded ? (
|
|
100
|
+
<ChevronDown className="h-4 w-4" />
|
|
101
|
+
) : (
|
|
102
|
+
<ChevronRight className="h-4 w-4" />
|
|
103
|
+
)}
|
|
104
|
+
</Button>
|
|
105
|
+
) : (
|
|
106
|
+
<div className="w-4" />
|
|
107
|
+
)}
|
|
108
|
+
{getStatusIcon(status)}
|
|
109
|
+
{icon}
|
|
110
|
+
<div>
|
|
111
|
+
<CardTitle className="text-lg">
|
|
112
|
+
{id}. {title}
|
|
113
|
+
</CardTitle>
|
|
114
|
+
{description && <CardDescription className="mt-1">{description}</CardDescription>}
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
{getStatusBadge(status)}
|
|
118
|
+
</div>
|
|
119
|
+
</CardHeader>
|
|
120
|
+
{actions && actions.length > 0 && (
|
|
121
|
+
<CardContent className="pt-0">
|
|
122
|
+
<div className="flex flex-wrap gap-2">
|
|
123
|
+
{actions.map((action, index) => (
|
|
124
|
+
<Button
|
|
125
|
+
key={index}
|
|
126
|
+
variant="outline"
|
|
127
|
+
size="sm"
|
|
128
|
+
disabled={disabled}
|
|
129
|
+
onClick={action.onClick}
|
|
130
|
+
asChild={!!action.href && !disabled}
|
|
131
|
+
>
|
|
132
|
+
{action.href ? <a href={action.href}>{action.label}</a> : action.label}
|
|
133
|
+
</Button>
|
|
134
|
+
))}
|
|
135
|
+
</div>
|
|
136
|
+
</CardContent>
|
|
137
|
+
)}
|
|
138
|
+
{children}
|
|
139
|
+
</Card>
|
|
140
|
+
|
|
141
|
+
{/* disabled overlay */}
|
|
142
|
+
{disabled && (
|
|
143
|
+
<Card
|
|
144
|
+
className={`absolute inset-0 bg-gray-500 opacity-50 pointer-events-auto z-10 ${level > 0 ? 'ml-4' : ''}`}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
BaseStepCard,
|
|
4
|
+
type BaseStepProps,
|
|
5
|
+
type StepAction,
|
|
6
|
+
type StepStatus,
|
|
7
|
+
} from './step-base.jsx';
|
|
8
|
+
|
|
9
|
+
interface SimpleStepProps extends BaseStepProps {
|
|
10
|
+
defaultStatus?: StepStatus;
|
|
11
|
+
actions?: StepAction[];
|
|
12
|
+
fetchStatus?: () => Promise<StepStatus>;
|
|
13
|
+
onStatusChange?: (id: string, status: StepStatus) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function SimpleStep({
|
|
17
|
+
defaultStatus = 'pending',
|
|
18
|
+
actions = [],
|
|
19
|
+
fetchStatus,
|
|
20
|
+
onStatusChange,
|
|
21
|
+
...props
|
|
22
|
+
}: SimpleStepProps) {
|
|
23
|
+
const [status, setStatus] = useState<StepStatus>(fetchStatus ? 'loading' : defaultStatus);
|
|
24
|
+
|
|
25
|
+
// Report status changes to parent
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (onStatusChange) {
|
|
28
|
+
onStatusChange(props.id, status);
|
|
29
|
+
}
|
|
30
|
+
}, [status, onStatusChange, props.id]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (fetchStatus) {
|
|
34
|
+
fetchStatus()
|
|
35
|
+
.then(setStatus)
|
|
36
|
+
.catch(() => setStatus('blocked'));
|
|
37
|
+
}
|
|
38
|
+
}, [fetchStatus]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<BaseStepCard {...props} status={status} actions={actions} onStatusChange={onStatusChange} />
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cn } from '@/lib/utils.js';
|
|
3
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
4
|
+
|
|
5
|
+
function Progress({
|
|
6
|
+
className,
|
|
7
|
+
value,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
|
10
|
+
return (
|
|
11
|
+
<ProgressPrimitive.Root
|
|
12
|
+
data-slot="progress"
|
|
13
|
+
className={cn(
|
|
14
|
+
'bg-gray-900/20 relative h-2 w-full overflow-hidden rounded-full dark:bg-gray-50/20',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<ProgressPrimitive.Indicator
|
|
20
|
+
data-slot="progress-indicator"
|
|
21
|
+
className="bg-gray-900 h-full w-full flex-1 transition-all dark:bg-gray-50"
|
|
22
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
23
|
+
/>
|
|
24
|
+
</ProgressPrimitive.Root>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Progress };
|
package/src/gql/gql.ts
CHANGED
|
@@ -155,6 +155,8 @@ type Documents = {
|
|
|
155
155
|
"\n query DocumentsScreen($filters: DocumentsFilters!) {\n documentsByFilters(filters: $filters) {\n id\n image\n file\n charge {\n id\n userDescription\n __typename\n vat {\n formatted\n __typename\n }\n transactions {\n id\n eventDate\n sourceDescription\n effectiveDate\n amount {\n formatted\n __typename\n }\n }\n }\n __typename\n ... on FinancialDocument {\n creditor {\n id\n name\n }\n debtor {\n id\n name\n }\n vat {\n raw\n formatted\n currency\n }\n serialNumber\n date\n amount {\n raw\n formatted\n currency\n }\n }\n }\n }\n": typeof types.DocumentsScreenDocument,
|
|
156
156
|
"\n query MonthlyDocumentDraftByClient($clientId: UUID!, $issueMonth: TimelessDate!) {\n clientMonthlyChargeDraft(clientId: $clientId, issueMonth: $issueMonth) {\n ...NewDocumentInfo\n }\n }\n": typeof types.MonthlyDocumentDraftByClientDocument,
|
|
157
157
|
"\n query MonthlyDocumentsDrafts($issueMonth: TimelessDate!) {\n clientMonthlyChargesDrafts(issueMonth: $issueMonth) {\n ...NewDocumentInfo\n }\n }\n": typeof types.MonthlyDocumentsDraftsDocument,
|
|
158
|
+
"\n query AccountantApprovalStatus($fromDate: TimelessDate!, $toDate: TimelessDate!) {\n accountantApprovalStatus(from: $fromDate, to: $toDate) {\n totalCharges\n approvedCount\n pendingCount\n unapprovedCount\n }\n }\n": typeof types.AccountantApprovalStatusDocument,
|
|
159
|
+
"\n query LedgerValidationStatus($limit: Int, $filters: ChargeFilter) {\n chargesWithLedgerChanges(limit: $limit, filters: $filters) {\n charge {\n id\n }\n }\n }\n": typeof types.LedgerValidationStatusDocument,
|
|
158
160
|
"\n query BalanceReportExtendedTransactions($transactionIDs: [UUID!]!) {\n transactionsByIDs(transactionIDs: $transactionIDs) {\n id\n ...TransactionForTransactionsTableFields\n }\n }\n": typeof types.BalanceReportExtendedTransactionsDocument,
|
|
159
161
|
"\n query BalanceReportScreen($fromDate: TimelessDate!, $toDate: TimelessDate!, $ownerId: UUID) {\n transactionsForBalanceReport(fromDate: $fromDate, toDate: $toDate, ownerId: $ownerId) {\n id\n amountUsd {\n formatted\n raw\n }\n date\n month\n year\n counterparty {\n id\n }\n isFee\n description\n charge {\n id\n tags {\n id\n name\n }\n }\n }\n }\n": typeof types.BalanceReportScreenDocument,
|
|
160
162
|
"\n fragment DepreciationReportRecordCore on DepreciationCoreRecord {\n id\n originalCost\n reportYearDelta\n totalDepreciableCosts\n reportYearClaimedDepreciation\n pastYearsAccumulatedDepreciation\n totalDepreciation\n netValue\n }\n": typeof types.DepreciationReportRecordCoreFragmentDoc,
|
|
@@ -202,6 +204,7 @@ type Documents = {
|
|
|
202
204
|
"\n mutation DeleteMiscExpense($id: UUID!) {\n deleteMiscExpense(id: $id)\n }\n": typeof types.DeleteMiscExpenseDocument,
|
|
203
205
|
"\n mutation DeleteTag($tagId: UUID!) {\n deleteTag(id: $tagId)\n }\n": typeof types.DeleteTagDocument,
|
|
204
206
|
"\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n": typeof types.FetchIncomeDocumentsDocument,
|
|
207
|
+
"\n query AdminBusinesses {\n allAdminBusinesses {\n id\n name\n governmentId\n }\n }\n": typeof types.AdminBusinessesDocument,
|
|
205
208
|
"\n query AllClients {\n allClients {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n }\n": typeof types.AllClientsDocument,
|
|
206
209
|
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrder\n startDate\n endDate\n remarks\n amount {\n raw\n currency\n formatted\n }\n documentType\n billingCycle\n isActive\n product\n plan\n signedAgreement\n msCloud\n }\n }\n": typeof types.AllOpenContractsDocument,
|
|
207
210
|
"\n query AllBusinesses {\n allBusinesses {\n nodes {\n id\n name\n }\n }\n }\n": typeof types.AllBusinessesDocument,
|
|
@@ -394,6 +397,8 @@ const documents: Documents = {
|
|
|
394
397
|
"\n query DocumentsScreen($filters: DocumentsFilters!) {\n documentsByFilters(filters: $filters) {\n id\n image\n file\n charge {\n id\n userDescription\n __typename\n vat {\n formatted\n __typename\n }\n transactions {\n id\n eventDate\n sourceDescription\n effectiveDate\n amount {\n formatted\n __typename\n }\n }\n }\n __typename\n ... on FinancialDocument {\n creditor {\n id\n name\n }\n debtor {\n id\n name\n }\n vat {\n raw\n formatted\n currency\n }\n serialNumber\n date\n amount {\n raw\n formatted\n currency\n }\n }\n }\n }\n": types.DocumentsScreenDocument,
|
|
395
398
|
"\n query MonthlyDocumentDraftByClient($clientId: UUID!, $issueMonth: TimelessDate!) {\n clientMonthlyChargeDraft(clientId: $clientId, issueMonth: $issueMonth) {\n ...NewDocumentInfo\n }\n }\n": types.MonthlyDocumentDraftByClientDocument,
|
|
396
399
|
"\n query MonthlyDocumentsDrafts($issueMonth: TimelessDate!) {\n clientMonthlyChargesDrafts(issueMonth: $issueMonth) {\n ...NewDocumentInfo\n }\n }\n": types.MonthlyDocumentsDraftsDocument,
|
|
400
|
+
"\n query AccountantApprovalStatus($fromDate: TimelessDate!, $toDate: TimelessDate!) {\n accountantApprovalStatus(from: $fromDate, to: $toDate) {\n totalCharges\n approvedCount\n pendingCount\n unapprovedCount\n }\n }\n": types.AccountantApprovalStatusDocument,
|
|
401
|
+
"\n query LedgerValidationStatus($limit: Int, $filters: ChargeFilter) {\n chargesWithLedgerChanges(limit: $limit, filters: $filters) {\n charge {\n id\n }\n }\n }\n": types.LedgerValidationStatusDocument,
|
|
397
402
|
"\n query BalanceReportExtendedTransactions($transactionIDs: [UUID!]!) {\n transactionsByIDs(transactionIDs: $transactionIDs) {\n id\n ...TransactionForTransactionsTableFields\n }\n }\n": types.BalanceReportExtendedTransactionsDocument,
|
|
398
403
|
"\n query BalanceReportScreen($fromDate: TimelessDate!, $toDate: TimelessDate!, $ownerId: UUID) {\n transactionsForBalanceReport(fromDate: $fromDate, toDate: $toDate, ownerId: $ownerId) {\n id\n amountUsd {\n formatted\n raw\n }\n date\n month\n year\n counterparty {\n id\n }\n isFee\n description\n charge {\n id\n tags {\n id\n name\n }\n }\n }\n }\n": types.BalanceReportScreenDocument,
|
|
399
404
|
"\n fragment DepreciationReportRecordCore on DepreciationCoreRecord {\n id\n originalCost\n reportYearDelta\n totalDepreciableCosts\n reportYearClaimedDepreciation\n pastYearsAccumulatedDepreciation\n totalDepreciation\n netValue\n }\n": types.DepreciationReportRecordCoreFragmentDoc,
|
|
@@ -441,6 +446,7 @@ const documents: Documents = {
|
|
|
441
446
|
"\n mutation DeleteMiscExpense($id: UUID!) {\n deleteMiscExpense(id: $id)\n }\n": types.DeleteMiscExpenseDocument,
|
|
442
447
|
"\n mutation DeleteTag($tagId: UUID!) {\n deleteTag(id: $tagId)\n }\n": types.DeleteTagDocument,
|
|
443
448
|
"\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n": types.FetchIncomeDocumentsDocument,
|
|
449
|
+
"\n query AdminBusinesses {\n allAdminBusinesses {\n id\n name\n governmentId\n }\n }\n": types.AdminBusinessesDocument,
|
|
444
450
|
"\n query AllClients {\n allClients {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n }\n": types.AllClientsDocument,
|
|
445
451
|
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrder\n startDate\n endDate\n remarks\n amount {\n raw\n currency\n formatted\n }\n documentType\n billingCycle\n isActive\n product\n plan\n signedAgreement\n msCloud\n }\n }\n": types.AllOpenContractsDocument,
|
|
446
452
|
"\n query AllBusinesses {\n allBusinesses {\n nodes {\n id\n name\n }\n }\n }\n": types.AllBusinessesDocument,
|
|
@@ -1070,6 +1076,14 @@ export function graphql(source: "\n query MonthlyDocumentDraftByClient($clientI
|
|
|
1070
1076
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1071
1077
|
*/
|
|
1072
1078
|
export function graphql(source: "\n query MonthlyDocumentsDrafts($issueMonth: TimelessDate!) {\n clientMonthlyChargesDrafts(issueMonth: $issueMonth) {\n ...NewDocumentInfo\n }\n }\n"): (typeof documents)["\n query MonthlyDocumentsDrafts($issueMonth: TimelessDate!) {\n clientMonthlyChargesDrafts(issueMonth: $issueMonth) {\n ...NewDocumentInfo\n }\n }\n"];
|
|
1079
|
+
/**
|
|
1080
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1081
|
+
*/
|
|
1082
|
+
export function graphql(source: "\n query AccountantApprovalStatus($fromDate: TimelessDate!, $toDate: TimelessDate!) {\n accountantApprovalStatus(from: $fromDate, to: $toDate) {\n totalCharges\n approvedCount\n pendingCount\n unapprovedCount\n }\n }\n"): (typeof documents)["\n query AccountantApprovalStatus($fromDate: TimelessDate!, $toDate: TimelessDate!) {\n accountantApprovalStatus(from: $fromDate, to: $toDate) {\n totalCharges\n approvedCount\n pendingCount\n unapprovedCount\n }\n }\n"];
|
|
1083
|
+
/**
|
|
1084
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1085
|
+
*/
|
|
1086
|
+
export function graphql(source: "\n query LedgerValidationStatus($limit: Int, $filters: ChargeFilter) {\n chargesWithLedgerChanges(limit: $limit, filters: $filters) {\n charge {\n id\n }\n }\n }\n"): (typeof documents)["\n query LedgerValidationStatus($limit: Int, $filters: ChargeFilter) {\n chargesWithLedgerChanges(limit: $limit, filters: $filters) {\n charge {\n id\n }\n }\n }\n"];
|
|
1073
1087
|
/**
|
|
1074
1088
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1075
1089
|
*/
|
|
@@ -1258,6 +1272,10 @@ export function graphql(source: "\n mutation DeleteTag($tagId: UUID!) {\n de
|
|
|
1258
1272
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1259
1273
|
*/
|
|
1260
1274
|
export function graphql(source: "\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n"): (typeof documents)["\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n"];
|
|
1275
|
+
/**
|
|
1276
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1277
|
+
*/
|
|
1278
|
+
export function graphql(source: "\n query AdminBusinesses {\n allAdminBusinesses {\n id\n name\n governmentId\n }\n }\n"): (typeof documents)["\n query AdminBusinesses {\n allAdminBusinesses {\n id\n name\n governmentId\n }\n }\n"];
|
|
1261
1279
|
/**
|
|
1262
1280
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1263
1281
|
*/
|
package/src/gql/graphql.ts
CHANGED
|
@@ -33,6 +33,15 @@ export type Scalars = {
|
|
|
33
33
|
VatMock: { input: any; output: any; }
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
/** represents accountant approval status for a charge */
|
|
37
|
+
export type AccountantApprovalStatus = {
|
|
38
|
+
__typename?: 'AccountantApprovalStatus';
|
|
39
|
+
approvedCount: Scalars['Int']['output'];
|
|
40
|
+
pendingCount: Scalars['Int']['output'];
|
|
41
|
+
totalCharges: Scalars['Int']['output'];
|
|
42
|
+
unapprovedCount: Scalars['Int']['output'];
|
|
43
|
+
};
|
|
44
|
+
|
|
36
45
|
/** represents accountant approval status */
|
|
37
46
|
export const AccountantStatus = {
|
|
38
47
|
Approved: 'APPROVED',
|
|
@@ -1412,6 +1421,18 @@ export type FinancialCharge = Charge & {
|
|
|
1412
1421
|
yearsOfRelevance?: Maybe<Array<YearOfRelevance>>;
|
|
1413
1422
|
};
|
|
1414
1423
|
|
|
1424
|
+
/** result type for generateFinancialCharges */
|
|
1425
|
+
export type FinancialChargesGenerationResult = {
|
|
1426
|
+
__typename?: 'FinancialChargesGenerationResult';
|
|
1427
|
+
bankDepositsRevaluationCharge: Charge;
|
|
1428
|
+
depreciationCharge: Charge;
|
|
1429
|
+
id: Scalars['ID']['output'];
|
|
1430
|
+
recoveryReserveCharge: Charge;
|
|
1431
|
+
revaluationCharge: Charge;
|
|
1432
|
+
taxExpensesCharge: Charge;
|
|
1433
|
+
vacationReserveCharge: Charge;
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1415
1436
|
/** represent a financial document */
|
|
1416
1437
|
export type FinancialDocument = {
|
|
1417
1438
|
allocationNumber?: Maybe<Scalars['String']['output']>;
|
|
@@ -2478,6 +2499,7 @@ export type Mutation = {
|
|
|
2478
2499
|
generateBalanceCharge: FinancialCharge;
|
|
2479
2500
|
generateBankDepositsRevaluationCharge: FinancialCharge;
|
|
2480
2501
|
generateDepreciationCharge: FinancialCharge;
|
|
2502
|
+
generateFinancialCharges: FinancialChargesGenerationResult;
|
|
2481
2503
|
generateRecoveryReserveCharge: FinancialCharge;
|
|
2482
2504
|
generateRevaluationCharge: FinancialCharge;
|
|
2483
2505
|
generateTaxExpensesCharge: FinancialCharge;
|
|
@@ -2720,6 +2742,13 @@ export type MutationGenerateDepreciationChargeArgs = {
|
|
|
2720
2742
|
};
|
|
2721
2743
|
|
|
2722
2744
|
|
|
2745
|
+
/** mutation root */
|
|
2746
|
+
export type MutationGenerateFinancialChargesArgs = {
|
|
2747
|
+
date: Scalars['TimelessDate']['input'];
|
|
2748
|
+
ownerId: Scalars['UUID']['input'];
|
|
2749
|
+
};
|
|
2750
|
+
|
|
2751
|
+
|
|
2723
2752
|
/** mutation root */
|
|
2724
2753
|
export type MutationGenerateRecoveryReserveChargeArgs = {
|
|
2725
2754
|
ownerId: Scalars['UUID']['input'];
|
|
@@ -3290,6 +3319,7 @@ export type Proforma = Document & FinancialDocument & Linkable & {
|
|
|
3290
3319
|
/** query root */
|
|
3291
3320
|
export type Query = {
|
|
3292
3321
|
__typename?: 'Query';
|
|
3322
|
+
accountantApprovalStatus: AccountantApprovalStatus;
|
|
3293
3323
|
adminBusiness: AdminBusiness;
|
|
3294
3324
|
allAdminBusinesses: Array<AdminBusiness>;
|
|
3295
3325
|
allBusinessTrips: Array<BusinessTrip>;
|
|
@@ -3367,6 +3397,13 @@ export type Query = {
|
|
|
3367
3397
|
};
|
|
3368
3398
|
|
|
3369
3399
|
|
|
3400
|
+
/** query root */
|
|
3401
|
+
export type QueryAccountantApprovalStatusArgs = {
|
|
3402
|
+
from: Scalars['TimelessDate']['input'];
|
|
3403
|
+
to: Scalars['TimelessDate']['input'];
|
|
3404
|
+
};
|
|
3405
|
+
|
|
3406
|
+
|
|
3370
3407
|
/** query root */
|
|
3371
3408
|
export type QueryAdminBusinessArgs = {
|
|
3372
3409
|
id: Scalars['UUID']['input'];
|
|
@@ -7255,6 +7292,22 @@ export type MonthlyDocumentsDraftsQuery = { __typename?: 'Query', clientMonthlyC
|
|
|
7255
7292
|
& { ' $fragmentRefs'?: { 'NewDocumentInfoFragment': NewDocumentInfoFragment } }
|
|
7256
7293
|
)> };
|
|
7257
7294
|
|
|
7295
|
+
export type AccountantApprovalStatusQueryVariables = Exact<{
|
|
7296
|
+
fromDate: Scalars['TimelessDate']['input'];
|
|
7297
|
+
toDate: Scalars['TimelessDate']['input'];
|
|
7298
|
+
}>;
|
|
7299
|
+
|
|
7300
|
+
|
|
7301
|
+
export type AccountantApprovalStatusQuery = { __typename?: 'Query', accountantApprovalStatus: { __typename?: 'AccountantApprovalStatus', totalCharges: number, approvedCount: number, pendingCount: number, unapprovedCount: number } };
|
|
7302
|
+
|
|
7303
|
+
export type LedgerValidationStatusQueryVariables = Exact<{
|
|
7304
|
+
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
7305
|
+
filters?: InputMaybe<ChargeFilter>;
|
|
7306
|
+
}>;
|
|
7307
|
+
|
|
7308
|
+
|
|
7309
|
+
export type LedgerValidationStatusQuery = { __typename?: 'Query', chargesWithLedgerChanges: Array<{ __typename?: 'ChargesWithLedgerChangesResult', charge?: { __typename?: 'BankDepositCharge', id: string } | { __typename?: 'BusinessTripCharge', id: string } | { __typename?: 'CommonCharge', id: string } | { __typename?: 'ConversionCharge', id: string } | { __typename?: 'CreditcardBankCharge', id: string } | { __typename?: 'DividendCharge', id: string } | { __typename?: 'FinancialCharge', id: string } | { __typename?: 'ForeignSecuritiesCharge', id: string } | { __typename?: 'InternalTransferCharge', id: string } | { __typename?: 'MonthlyVatCharge', id: string } | { __typename?: 'SalaryCharge', id: string } | null }> };
|
|
7310
|
+
|
|
7258
7311
|
export type BalanceReportExtendedTransactionsQueryVariables = Exact<{
|
|
7259
7312
|
transactionIDs: Array<Scalars['UUID']['input']> | Scalars['UUID']['input'];
|
|
7260
7313
|
}>;
|
|
@@ -7596,6 +7649,11 @@ export type FetchIncomeDocumentsMutation = { __typename?: 'Mutation', fetchIncom
|
|
|
7596
7649
|
& { ' $fragmentRefs'?: { 'NewFetchedDocumentFields_Unprocessed_Fragment': NewFetchedDocumentFields_Unprocessed_Fragment } }
|
|
7597
7650
|
)> };
|
|
7598
7651
|
|
|
7652
|
+
export type AdminBusinessesQueryVariables = Exact<{ [key: string]: never; }>;
|
|
7653
|
+
|
|
7654
|
+
|
|
7655
|
+
export type AdminBusinessesQuery = { __typename?: 'Query', allAdminBusinesses: Array<{ __typename?: 'AdminBusiness', id: string, name: string, governmentId: string }> };
|
|
7656
|
+
|
|
7599
7657
|
export type AllClientsQueryVariables = Exact<{ [key: string]: never; }>;
|
|
7600
7658
|
|
|
7601
7659
|
|
|
@@ -8146,6 +8204,8 @@ export const MissingInfoChargesDocument = {"kind":"Document","definitions":[{"ki
|
|
|
8146
8204
|
export const DocumentsScreenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DocumentsScreen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DocumentsFilters"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentsByFilters"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"image"}},{"kind":"Field","name":{"kind":"Name","value":"file"}},{"kind":"Field","name":{"kind":"Name","value":"charge"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"userDescription"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"vat"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"formatted"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"transactions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventDate"}},{"kind":"Field","name":{"kind":"Name","value":"sourceDescription"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"formatted"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FinancialDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"creditor"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"debtor"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"vat"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"raw"}},{"kind":"Field","name":{"kind":"Name","value":"formatted"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}}]}},{"kind":"Field","name":{"kind":"Name","value":"serialNumber"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"amount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"raw"}},{"kind":"Field","name":{"kind":"Name","value":"formatted"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}}]}}]}}]}}]}}]} as unknown as DocumentNode<DocumentsScreenQuery, DocumentsScreenQueryVariables>;
|
|
8147
8205
|
export const MonthlyDocumentDraftByClientDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MonthlyDocumentDraftByClient"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"clientId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"issueMonth"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TimelessDate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"clientMonthlyChargeDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"clientId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"clientId"}}},{"kind":"Argument","name":{"kind":"Name","value":"issueMonth"},"value":{"kind":"Variable","name":{"kind":"Name","value":"issueMonth"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NewDocumentInfo"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"IssueDocumentClientFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GreenInvoiceClient"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"emails"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"taxId"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"zip"}},{"kind":"Field","name":{"kind":"Name","value":"fax"}},{"kind":"Field","name":{"kind":"Name","value":"mobile"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NewDocumentInfo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"NewDocumentInfo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"remarks"}},{"kind":"Field","name":{"kind":"Name","value":"footer"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"dueDate"}},{"kind":"Field","name":{"kind":"Name","value":"lang"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"vatType"}},{"kind":"Field","name":{"kind":"Name","value":"discount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rounding"}},{"kind":"Field","name":{"kind":"Name","value":"signed"}},{"kind":"Field","name":{"kind":"Name","value":"maxPayments"}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"IssueDocumentClientFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"income"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"currencyRate"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"itemId"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"vatRate"}},{"kind":"Field","name":{"kind":"Name","value":"vatType"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"currencyRate"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"subType"}},{"kind":"Field","name":{"kind":"Name","value":"bankName"}},{"kind":"Field","name":{"kind":"Name","value":"bankBranch"}},{"kind":"Field","name":{"kind":"Name","value":"bankAccount"}},{"kind":"Field","name":{"kind":"Name","value":"chequeNum"}},{"kind":"Field","name":{"kind":"Name","value":"accountId"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"appType"}},{"kind":"Field","name":{"kind":"Name","value":"cardType"}},{"kind":"Field","name":{"kind":"Name","value":"cardNum"}},{"kind":"Field","name":{"kind":"Name","value":"dealType"}},{"kind":"Field","name":{"kind":"Name","value":"numPayments"}},{"kind":"Field","name":{"kind":"Name","value":"firstPayment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"linkedDocumentIds"}},{"kind":"Field","name":{"kind":"Name","value":"linkedPaymentId"}}]}}]} as unknown as DocumentNode<MonthlyDocumentDraftByClientQuery, MonthlyDocumentDraftByClientQueryVariables>;
|
|
8148
8206
|
export const MonthlyDocumentsDraftsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MonthlyDocumentsDrafts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"issueMonth"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TimelessDate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"clientMonthlyChargesDrafts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"issueMonth"},"value":{"kind":"Variable","name":{"kind":"Name","value":"issueMonth"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NewDocumentInfo"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"IssueDocumentClientFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GreenInvoiceClient"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"emails"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"taxId"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"zip"}},{"kind":"Field","name":{"kind":"Name","value":"fax"}},{"kind":"Field","name":{"kind":"Name","value":"mobile"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NewDocumentInfo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"NewDocumentInfo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"remarks"}},{"kind":"Field","name":{"kind":"Name","value":"footer"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"dueDate"}},{"kind":"Field","name":{"kind":"Name","value":"lang"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"vatType"}},{"kind":"Field","name":{"kind":"Name","value":"discount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rounding"}},{"kind":"Field","name":{"kind":"Name","value":"signed"}},{"kind":"Field","name":{"kind":"Name","value":"maxPayments"}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"IssueDocumentClientFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"income"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"currencyRate"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"itemId"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"vatRate"}},{"kind":"Field","name":{"kind":"Name","value":"vatType"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"currencyRate"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"subType"}},{"kind":"Field","name":{"kind":"Name","value":"bankName"}},{"kind":"Field","name":{"kind":"Name","value":"bankBranch"}},{"kind":"Field","name":{"kind":"Name","value":"bankAccount"}},{"kind":"Field","name":{"kind":"Name","value":"chequeNum"}},{"kind":"Field","name":{"kind":"Name","value":"accountId"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"appType"}},{"kind":"Field","name":{"kind":"Name","value":"cardType"}},{"kind":"Field","name":{"kind":"Name","value":"cardNum"}},{"kind":"Field","name":{"kind":"Name","value":"dealType"}},{"kind":"Field","name":{"kind":"Name","value":"numPayments"}},{"kind":"Field","name":{"kind":"Name","value":"firstPayment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"linkedDocumentIds"}},{"kind":"Field","name":{"kind":"Name","value":"linkedPaymentId"}}]}}]} as unknown as DocumentNode<MonthlyDocumentsDraftsQuery, MonthlyDocumentsDraftsQueryVariables>;
|
|
8207
|
+
export const AccountantApprovalStatusDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AccountantApprovalStatus"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TimelessDate"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"toDate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TimelessDate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountantApprovalStatus"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"from"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"to"},"value":{"kind":"Variable","name":{"kind":"Name","value":"toDate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCharges"}},{"kind":"Field","name":{"kind":"Name","value":"approvedCount"}},{"kind":"Field","name":{"kind":"Name","value":"pendingCount"}},{"kind":"Field","name":{"kind":"Name","value":"unapprovedCount"}}]}}]}}]} as unknown as DocumentNode<AccountantApprovalStatusQuery, AccountantApprovalStatusQueryVariables>;
|
|
8208
|
+
export const LedgerValidationStatusDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"LedgerValidationStatus"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ChargeFilter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"chargesWithLedgerChanges"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"charge"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<LedgerValidationStatusQuery, LedgerValidationStatusQueryVariables>;
|
|
8149
8209
|
export const BalanceReportExtendedTransactionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"BalanceReportExtendedTransactions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"transactionIDs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactionsByIDs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"transactionIDs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"transactionIDs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"TransactionForTransactionsTableFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TransactionForTransactionsTableFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Transaction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"chargeId"}},{"kind":"Field","name":{"kind":"Name","value":"eventDate"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveDate"}},{"kind":"Field","name":{"kind":"Name","value":"sourceEffectiveDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"raw"}},{"kind":"Field","name":{"kind":"Name","value":"formatted"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cryptoExchangeRate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"account"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceDescription"}},{"kind":"Field","name":{"kind":"Name","value":"referenceKey"}},{"kind":"Field","name":{"kind":"Name","value":"counterparty"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"missingInfoSuggestions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"business"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<BalanceReportExtendedTransactionsQuery, BalanceReportExtendedTransactionsQueryVariables>;
|
|
8150
8210
|
export const BalanceReportScreenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"BalanceReportScreen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TimelessDate"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"toDate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TimelessDate"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ownerId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactionsForBalanceReport"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"fromDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"toDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"toDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"ownerId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ownerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"amountUsd"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"formatted"}},{"kind":"Field","name":{"kind":"Name","value":"raw"}}]}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"month"}},{"kind":"Field","name":{"kind":"Name","value":"year"}},{"kind":"Field","name":{"kind":"Name","value":"counterparty"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isFee"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"charge"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<BalanceReportScreenQuery, BalanceReportScreenQueryVariables>;
|
|
8151
8211
|
export const DepreciationReportScreenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DepreciationReportScreen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DepreciationReportFilter"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"depreciationReport"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"year"}},{"kind":"Field","name":{"kind":"Name","value":"categories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"percentage"}}]}},{"kind":"Field","name":{"kind":"Name","value":"records"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"chargeId"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"purchaseDate"}},{"kind":"Field","name":{"kind":"Name","value":"activationDate"}},{"kind":"Field","name":{"kind":"Name","value":"statutoryDepreciationRate"}},{"kind":"Field","name":{"kind":"Name","value":"claimedDepreciationRate"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"DepreciationReportRecordCore"}}]}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"DepreciationReportRecordCore"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"DepreciationReportRecordCore"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DepreciationReportRecordCore"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DepreciationCoreRecord"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"originalCost"}},{"kind":"Field","name":{"kind":"Name","value":"reportYearDelta"}},{"kind":"Field","name":{"kind":"Name","value":"totalDepreciableCosts"}},{"kind":"Field","name":{"kind":"Name","value":"reportYearClaimedDepreciation"}},{"kind":"Field","name":{"kind":"Name","value":"pastYearsAccumulatedDepreciation"}},{"kind":"Field","name":{"kind":"Name","value":"totalDepreciation"}},{"kind":"Field","name":{"kind":"Name","value":"netValue"}}]}}]} as unknown as DocumentNode<DepreciationReportScreenQuery, DepreciationReportScreenQueryVariables>;
|
|
@@ -8179,6 +8239,7 @@ export const DeleteDynamicReportTemplateDocument = {"kind":"Document","definitio
|
|
|
8179
8239
|
export const DeleteMiscExpenseDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteMiscExpense"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteMiscExpense"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]} as unknown as DocumentNode<DeleteMiscExpenseMutation, DeleteMiscExpenseMutationVariables>;
|
|
8180
8240
|
export const DeleteTagDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteTag"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tagId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteTag"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tagId"}}}]}]}}]} as unknown as DocumentNode<DeleteTagMutation, DeleteTagMutationVariables>;
|
|
8181
8241
|
export const FetchIncomeDocumentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"FetchIncomeDocuments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ownerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fetchIncomeDocuments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ownerId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ownerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"NewFetchedDocumentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NewFetchedDocumentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Document"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"documentType"}},{"kind":"Field","name":{"kind":"Name","value":"charge"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"userDescription"}},{"kind":"Field","name":{"kind":"Name","value":"counterparty"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<FetchIncomeDocumentsMutation, FetchIncomeDocumentsMutationVariables>;
|
|
8242
|
+
export const AdminBusinessesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AdminBusinesses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allAdminBusinesses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"governmentId"}}]}}]}}]} as unknown as DocumentNode<AdminBusinessesQuery, AdminBusinessesQueryVariables>;
|
|
8182
8243
|
export const AllClientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AllClients"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allClients"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"greenInvoiceId"}},{"kind":"Field","name":{"kind":"Name","value":"emails"}},{"kind":"Field","name":{"kind":"Name","value":"originalBusiness"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<AllClientsQuery, AllClientsQueryVariables>;
|
|
8183
8244
|
export const AllOpenContractsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AllOpenContracts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allOpenContracts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"greenInvoiceId"}},{"kind":"Field","name":{"kind":"Name","value":"emails"}},{"kind":"Field","name":{"kind":"Name","value":"originalBusiness"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"purchaseOrder"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"remarks"}},{"kind":"Field","name":{"kind":"Name","value":"amount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"raw"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"formatted"}}]}},{"kind":"Field","name":{"kind":"Name","value":"documentType"}},{"kind":"Field","name":{"kind":"Name","value":"billingCycle"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"product"}},{"kind":"Field","name":{"kind":"Name","value":"plan"}},{"kind":"Field","name":{"kind":"Name","value":"signedAgreement"}},{"kind":"Field","name":{"kind":"Name","value":"msCloud"}}]}}]}}]} as unknown as DocumentNode<AllOpenContractsQuery, AllOpenContractsQueryVariables>;
|
|
8184
8245
|
export const AllBusinessesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AllBusinesses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allBusinesses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<AllBusinessesQuery, AllBusinessesQueryVariables>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { toast } from 'sonner';
|
|
3
|
+
import { useQuery } from 'urql';
|
|
4
|
+
import { AdminBusinessesDocument, type AdminBusinessesQuery } from '../gql/graphql.js';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
7
|
+
/* GraphQL */ `
|
|
8
|
+
query AdminBusinesses {
|
|
9
|
+
allAdminBusinesses {
|
|
10
|
+
id
|
|
11
|
+
name
|
|
12
|
+
governmentId
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export type AdminBusinesses = Array<
|
|
18
|
+
NonNullable<AdminBusinessesQuery['allAdminBusinesses']>[number]
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
type UseGetAdminBusinesses = {
|
|
22
|
+
fetching: boolean;
|
|
23
|
+
refresh: () => void;
|
|
24
|
+
adminBusinesses: AdminBusinesses;
|
|
25
|
+
selectableAdminBusinesses: Array<{ value: string; label: string }>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const useGetAdminBusinesses = (): UseGetAdminBusinesses => {
|
|
29
|
+
const [{ data, fetching, error }, fetch] = useQuery({
|
|
30
|
+
query: AdminBusinessesDocument,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (error) {
|
|
34
|
+
console.error(`Error fetching admin businesses: ${error}`);
|
|
35
|
+
toast.error('Error', {
|
|
36
|
+
description: 'Unable to fetch admin businesses',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const adminBusinesses = useMemo(() => {
|
|
41
|
+
return data?.allAdminBusinesses?.slice().sort((a, b) => (a.name > b.name ? 1 : -1)) ?? [];
|
|
42
|
+
}, [data]);
|
|
43
|
+
|
|
44
|
+
const selectableAdminBusinesses = useMemo(() => {
|
|
45
|
+
return adminBusinesses.map(entity => ({
|
|
46
|
+
value: entity.id,
|
|
47
|
+
label: entity.name,
|
|
48
|
+
}));
|
|
49
|
+
}, [adminBusinesses]);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
fetching,
|
|
53
|
+
refresh: () => fetch(),
|
|
54
|
+
adminBusinesses,
|
|
55
|
+
selectableAdminBusinesses,
|
|
56
|
+
};
|
|
57
|
+
};
|