@accounter/client 0.0.8-alpha-20251027152122-3a28383f5256a0af85ebc9a1667c671cd03d1217 → 0.0.8-alpha-20251027160059-e9b68d02d14d04ec8244b80972712f758c9e8db7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/assets/{Checkbox-BO9Xpz8t.js → Checkbox-BPO8_jMH.js} +2 -2
- package/dist/assets/{Progress-D2_rEDMg.js → Progress-NZzZXmow.js} +1 -1
- package/dist/assets/{Typography-D5R2ABRc.js → Typography-IaNz_UpB.js} +1 -1
- package/dist/assets/{accordion-BdInypOR.js → accordion-DLhPc0rw.js} +1 -1
- package/dist/assets/{accountant-approvals-Dxukyb2L.js → accountant-approvals--bHmgziw.js} +1 -1
- package/dist/assets/{all-charges-CKoiOatE.js → all-charges-n5LCQpkn.js} +1 -1
- package/dist/assets/{arrow-up-down-CkKoHOZz.js → arrow-up-down-CM9bwo8G.js} +1 -1
- package/dist/assets/{building-2-DqnthsV_.js → building-2-HRA8xsoA.js} +1 -1
- package/dist/assets/business-Cc9BXzpb.js +32 -0
- package/dist/assets/{business-header-BoDcKSl2.js → business-header-D0Pi0ox5.js} +1 -1
- package/dist/assets/{business-transactions-single-sJPwKffn.js → business-transactions-single-CEYMQLQD.js} +1 -1
- package/dist/assets/{business-trip-ak7ozCMK.js → business-trip-CJO6fi9D.js} +1 -1
- package/dist/assets/{charges-filters-BZS9K5l_.js → charges-filters-hjHQC8jb.js} +1 -1
- package/dist/assets/{charges-ledger-validation-Dn1tKuHo.js → charges-ledger-validation-B-CsyNZK.js} +1 -1
- package/dist/assets/{chart-D5qMOolQ.js → chart-Dt1GKbU0.js} +1 -1
- package/dist/assets/{data-table-pagination-DNmtrpVu.js → data-table-pagination-YsvftRMU.js} +1 -1
- package/dist/assets/{editable-business-trip-tuSBklIH.js → editable-business-trip-DVC29gsX.js} +2 -2
- package/dist/assets/{index-cI8Jsxnd.js → index-9gE-VJnf.js} +1 -1
- package/dist/assets/{index-B8uhIk_K.js → index-B6wS4Wxh.js} +1 -1
- package/dist/assets/{index-1y5LxkZU.js → index-BC8lCcej.js} +1 -1
- package/dist/assets/{index-BUrkGANf.js → index-BEDk77TL.js} +1 -1
- package/dist/assets/{index-BEycb-eF.js → index-BgzvCxY1.js} +1 -1
- package/dist/assets/{index-mPs7_Pzt.js → index-BmHIdR_i.js} +1 -1
- package/dist/assets/{index-Dbs_Faiq.js → index-BoRdLlCV.js} +1 -1
- package/dist/assets/index-BowN47so.js +1 -0
- package/dist/assets/{index-zNOIAEsv.js → index-ByZ_pm4F.js} +1 -1
- package/dist/assets/{index-BUOmPZZE.js → index-BykvJIPg.js} +1 -1
- package/dist/assets/{index-rzb-Wfyn.js → index-C1QP_1hi.js} +2 -2
- package/dist/assets/{index-DO9LsGUk.js → index-C5THrBcZ.js} +2 -2
- package/dist/assets/{index-Cq_8eDaQ.js → index-CAz755Vg.js} +1 -1
- package/dist/assets/index-CBPTpZHL.css +1 -0
- package/dist/assets/{index-Bm0ybubD.js → index-CRMsr3ea.js} +1 -1
- package/dist/assets/{index-CoP8rTKg.js → index-CRpqdixQ.js} +1 -1
- package/dist/assets/{index-8n4-QaWx.js → index-CebS9Rr6.js} +2 -2
- package/dist/assets/{index-CPDxJ2sU.js → index-CpAsLkZ-.js} +2 -2
- package/dist/assets/{index-B-M613Ei.js → index-D4QXCBac.js} +2 -2
- package/dist/assets/{index-DUfo3Krp.js → index-DFDi4HIa.js} +1 -1
- package/dist/assets/{index-Bv4hj0Jy.js → index-DYbojoX7.js} +2 -2
- package/dist/assets/{index-CwWYxYTu.js → index-O4Zp6w2B.js} +1 -1
- package/dist/assets/{index-CQrnA6kA.js → index-nOsVSS34.js} +7 -7
- package/dist/assets/{index-C1vFqfE7.js → index-xIO0bA36.js} +258 -263
- package/dist/assets/{index.es-CaCwgSGE.js → index.es-B9NUKbEG.js} +1 -1
- package/dist/assets/{issue-document-CiJeX3C9.js → issue-document-CUSNTaeZ.js} +1 -1
- package/dist/assets/{login-page-YiLbVzv0.js → login-page-DmLdOH1y.js} +1 -1
- package/dist/assets/{missing-info-charges-Dz2clKfl.js → missing-info-charges-DsgMcotI.js} +1 -1
- package/dist/assets/{page-not-found-4Tf0NkPJ.js → page-not-found-B8fy5aDg.js} +1 -1
- package/dist/assets/{pencil-DgX1JiCS.js → pencil-Dmfzg-6O.js} +1 -1
- package/dist/assets/{report-commentary-row-CiD9pNPE.js → report-commentary-row-BPh5_3g6.js} +1 -1
- package/dist/assets/{save-DQHS5I6h.js → save-BPUtJeTy.js} +1 -1
- package/dist/assets/{sub-DVpRQI4L.js → sub-CqZ9jxmt.js} +1 -1
- package/dist/assets/subMonths-CwZPyK0k.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/components/business/admin-business-section.tsx +36 -74
- package/src/components/business/contracts-section.tsx +18 -4
- package/src/components/clients/contracts/modify-contract-dialog.tsx +65 -11
- package/src/components/clients/modify-client-dialog.tsx +9 -27
- package/src/components/common/modals/insert-business.tsx +36 -87
- package/src/components/layout/user-nav.tsx +3 -25
- package/src/gql/gql.ts +9 -9
- package/src/gql/graphql.ts +23 -26
- package/src/hooks/use-get-all-contracts.ts +1 -1
- package/dist/assets/business-BtfvlRp_.js +0 -27
- package/dist/assets/index-B5E9Adf1.js +0 -1
- package/dist/assets/index-DtE5Y1ZB.css +0 -1
- package/dist/assets/subMonths-CFZKY9ia.js +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
|
-
import { Plus } from 'lucide-react';
|
|
3
|
+
import { Plus, X } from 'lucide-react';
|
|
4
4
|
import { useForm } from 'react-hook-form';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { Badge } from '@/components/ui/badge.js';
|
|
6
7
|
import { Button } from '@/components/ui/button.js';
|
|
7
8
|
import {
|
|
8
9
|
Dialog,
|
|
@@ -48,7 +49,7 @@ const contractFormSchema = z.object({
|
|
|
48
49
|
// operationsLimit: z.number().optional(),
|
|
49
50
|
startDate: z.iso.date('Start date is required'),
|
|
50
51
|
endDate: z.iso.date('End date is required'),
|
|
51
|
-
|
|
52
|
+
pos: z.array(z.string()),
|
|
52
53
|
paymentAmount: z.number().min(0, 'Payment amount must be non-negative'),
|
|
53
54
|
paymentCurrency: z.enum(Object.values(Currency), 'Currency is required'),
|
|
54
55
|
productType: z.enum(Object.values(Product)).optional(),
|
|
@@ -67,7 +68,7 @@ const newContractDefaultValues: ContractFormValues = {
|
|
|
67
68
|
// operationsLimit: 0,
|
|
68
69
|
startDate: '',
|
|
69
70
|
endDate: '',
|
|
70
|
-
|
|
71
|
+
pos: [],
|
|
71
72
|
paymentAmount: 0,
|
|
72
73
|
paymentCurrency: Currency.Usd,
|
|
73
74
|
productType: Product.Hive,
|
|
@@ -88,6 +89,7 @@ interface Props {
|
|
|
88
89
|
export function ModifyContractDialog({ clientId, contract, onDone }: Props) {
|
|
89
90
|
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
90
91
|
const [editingContract, setEditingContract] = useState<ContractFormValues | null>(null);
|
|
92
|
+
const [newPO, setNewPO] = useState('');
|
|
91
93
|
|
|
92
94
|
const { updateContract, updating } = useUpdateContract();
|
|
93
95
|
const { createContract, creating } = useCreateContract();
|
|
@@ -97,6 +99,23 @@ export function ModifyContractDialog({ clientId, contract, onDone }: Props) {
|
|
|
97
99
|
defaultValues: contract || newContractDefaultValues,
|
|
98
100
|
});
|
|
99
101
|
|
|
102
|
+
const addPO = () => {
|
|
103
|
+
if (newPO.trim()) {
|
|
104
|
+
const currentLinks = form.getValues('pos');
|
|
105
|
+
form.setValue('pos', [...currentLinks, newPO.trim()], { shouldDirty: true });
|
|
106
|
+
setNewPO('');
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const removePO = (index: number) => {
|
|
111
|
+
const currentLinks = form.getValues('pos');
|
|
112
|
+
form.setValue(
|
|
113
|
+
'pos',
|
|
114
|
+
currentLinks.filter((_, i) => i !== index),
|
|
115
|
+
{ shouldDirty: true },
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
100
119
|
useEffect(() => {
|
|
101
120
|
if (contract) {
|
|
102
121
|
setEditingContract(contract);
|
|
@@ -105,7 +124,7 @@ export function ModifyContractDialog({ clientId, contract, onDone }: Props) {
|
|
|
105
124
|
// operationsLimit: contract.operationsLimit,
|
|
106
125
|
startDate: contract.startDate,
|
|
107
126
|
endDate: contract.endDate,
|
|
108
|
-
|
|
127
|
+
pos: contract.pos,
|
|
109
128
|
paymentAmount: contract.paymentAmount,
|
|
110
129
|
paymentCurrency: contract.paymentCurrency,
|
|
111
130
|
productType: contract.productType,
|
|
@@ -141,7 +160,7 @@ export function ModifyContractDialog({ clientId, contract, onDone }: Props) {
|
|
|
141
160
|
msCloud: values.msCloudLink,
|
|
142
161
|
plan: values.subscriptionPlan,
|
|
143
162
|
product: values.productType,
|
|
144
|
-
|
|
163
|
+
purchaseOrders: values.pos,
|
|
145
164
|
remarks: values.defaultRemark,
|
|
146
165
|
startDate: format(new Date(values.startDate), 'yyyy-MM-dd') as TimelessDateString,
|
|
147
166
|
},
|
|
@@ -163,7 +182,7 @@ export function ModifyContractDialog({ clientId, contract, onDone }: Props) {
|
|
|
163
182
|
msCloud: values.msCloudLink,
|
|
164
183
|
plan: values.subscriptionPlan,
|
|
165
184
|
product: values.productType,
|
|
166
|
-
|
|
185
|
+
purchaseOrders: values.pos,
|
|
167
186
|
remarks: values.defaultRemark,
|
|
168
187
|
startDate: format(new Date(values.startDate), 'yyyy-MM-dd') as TimelessDateString,
|
|
169
188
|
},
|
|
@@ -211,15 +230,50 @@ export function ModifyContractDialog({ clientId, contract, onDone }: Props) {
|
|
|
211
230
|
</FormItem>
|
|
212
231
|
)}
|
|
213
232
|
/> */}
|
|
233
|
+
|
|
214
234
|
<FormField
|
|
215
235
|
control={form.control}
|
|
216
|
-
name="
|
|
236
|
+
name="pos"
|
|
217
237
|
render={({ field }) => (
|
|
218
238
|
<FormItem>
|
|
219
|
-
<FormLabel>
|
|
220
|
-
<
|
|
221
|
-
<Input
|
|
222
|
-
|
|
239
|
+
<FormLabel>Purchase Orders</FormLabel>
|
|
240
|
+
<div className="flex gap-2">
|
|
241
|
+
<Input
|
|
242
|
+
placeholder="Add PO..."
|
|
243
|
+
value={newPO}
|
|
244
|
+
onChange={e => setNewPO(e.target.value)}
|
|
245
|
+
onKeyDown={e => {
|
|
246
|
+
if (e.key === 'Enter') {
|
|
247
|
+
e.preventDefault();
|
|
248
|
+
addPO();
|
|
249
|
+
}
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
<Button type="button" size="sm" onClick={addPO}>
|
|
253
|
+
<Plus className="h-4 w-4" />
|
|
254
|
+
</Button>
|
|
255
|
+
</div>
|
|
256
|
+
<div>
|
|
257
|
+
{field.value?.map((link, index) => (
|
|
258
|
+
<Badge
|
|
259
|
+
key={index}
|
|
260
|
+
variant="secondary"
|
|
261
|
+
className="gap-1 max-w-xs truncate"
|
|
262
|
+
>
|
|
263
|
+
{link}
|
|
264
|
+
{index === field.value.length - 1 && (
|
|
265
|
+
<Button
|
|
266
|
+
variant="ghost"
|
|
267
|
+
size="icon"
|
|
268
|
+
className="p-0 size-3"
|
|
269
|
+
onClick={() => removePO(index)}
|
|
270
|
+
>
|
|
271
|
+
<X className="size-3 cursor-pointer flex-shrink-0" />
|
|
272
|
+
</Button>
|
|
273
|
+
)}
|
|
274
|
+
</Badge>
|
|
275
|
+
))}
|
|
276
|
+
</div>
|
|
223
277
|
<FormMessage />
|
|
224
278
|
</FormItem>
|
|
225
279
|
)}
|
|
@@ -49,10 +49,9 @@ interface Props {
|
|
|
49
49
|
businessId: string;
|
|
50
50
|
client?: ClientFormValues | null;
|
|
51
51
|
onDone?: () => void;
|
|
52
|
-
showTrigger?: boolean;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export function ModifyClientDialog({ client, businessId, onDone
|
|
54
|
+
export function ModifyClientDialog({ client, businessId, onDone }: Props) {
|
|
56
55
|
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
57
56
|
const [editingClient, setEditingClient] = useState<ClientFormValues | null>(null);
|
|
58
57
|
|
|
@@ -139,23 +138,13 @@ export function ModifyClientDialog({ client, businessId, onDone, showTrigger = t
|
|
|
139
138
|
);
|
|
140
139
|
|
|
141
140
|
return (
|
|
142
|
-
<Dialog
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
{showTrigger && (
|
|
152
|
-
<DialogTrigger asChild>
|
|
153
|
-
<Button size="sm" onClick={handleNew}>
|
|
154
|
-
<Plus className="h-4 w-4 mr-2" />
|
|
155
|
-
New Client
|
|
156
|
-
</Button>
|
|
157
|
-
</DialogTrigger>
|
|
158
|
-
)}
|
|
141
|
+
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
|
|
142
|
+
<DialogTrigger asChild>
|
|
143
|
+
<Button size="sm" onClick={handleNew}>
|
|
144
|
+
<Plus className="h-4 w-4 mr-2" />
|
|
145
|
+
New Client
|
|
146
|
+
</Button>
|
|
147
|
+
</DialogTrigger>
|
|
159
148
|
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
|
|
160
149
|
<DialogHeader>
|
|
161
150
|
<DialogTitle>{editingClient ? 'Edit Client' : 'Create New Client'}</DialogTitle>
|
|
@@ -274,14 +263,7 @@ export function ModifyClientDialog({ client, businessId, onDone, showTrigger = t
|
|
|
274
263
|
</div>
|
|
275
264
|
</div>
|
|
276
265
|
<DialogFooter>
|
|
277
|
-
<Button
|
|
278
|
-
type="button"
|
|
279
|
-
variant="outline"
|
|
280
|
-
onClick={() => {
|
|
281
|
-
setIsDialogOpen(false);
|
|
282
|
-
onDone?.();
|
|
283
|
-
}}
|
|
284
|
-
>
|
|
266
|
+
<Button type="button" variant="outline" onClick={() => setIsDialogOpen(false)}>
|
|
285
267
|
Cancel
|
|
286
268
|
</Button>
|
|
287
269
|
<Button type="submit">{editingClient ? 'Update Client' : 'Create Client'}</Button>
|
|
@@ -2,10 +2,6 @@ import { useCallback, useContext, useState } from 'react';
|
|
|
2
2
|
import { Globe, Mail, MapPin, Phone, Plus, X } from 'lucide-react';
|
|
3
3
|
import { useForm } from 'react-hook-form';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import {
|
|
6
|
-
ModifyClientDialog,
|
|
7
|
-
type ClientFormValues,
|
|
8
|
-
} from '@/components/clients/modify-client-dialog.js';
|
|
9
5
|
import { Badge } from '@/components/ui/badge.js';
|
|
10
6
|
import { Button } from '@/components/ui/button.js';
|
|
11
7
|
import {
|
|
@@ -19,7 +15,6 @@ import {
|
|
|
19
15
|
import {
|
|
20
16
|
Form,
|
|
21
17
|
FormControl,
|
|
22
|
-
FormDescription,
|
|
23
18
|
FormField,
|
|
24
19
|
FormItem,
|
|
25
20
|
FormLabel,
|
|
@@ -33,9 +28,7 @@ import {
|
|
|
33
28
|
SelectTrigger,
|
|
34
29
|
SelectValue,
|
|
35
30
|
} from '@/components/ui/select.js';
|
|
36
|
-
import { Switch } from '@/components/ui/switch.js';
|
|
37
31
|
import { Textarea } from '@/components/ui/textarea.js';
|
|
38
|
-
import { DocumentType } from '@/gql/graphql.js';
|
|
39
32
|
import { pcn874RecordEnum } from '@/helpers/index.js';
|
|
40
33
|
import { useAllCountries } from '@/hooks/use-get-countries.js';
|
|
41
34
|
import { useGetSortCodes } from '@/hooks/use-get-sort-codes.js';
|
|
@@ -55,8 +48,8 @@ const businessFormSchema = z
|
|
|
55
48
|
localName: z.string().optional(),
|
|
56
49
|
govId: z.string().optional(),
|
|
57
50
|
address: z.string().optional(),
|
|
58
|
-
generalContacts: z.array(z.email()),
|
|
59
|
-
website: z.url().optional().or(z.literal('')),
|
|
51
|
+
generalContacts: z.array(z.string().email()),
|
|
52
|
+
website: z.string().url().optional().or(z.literal('')),
|
|
60
53
|
phone: z.string().optional(),
|
|
61
54
|
taxCategory: z.string().optional(),
|
|
62
55
|
sortCode: z.string().optional(),
|
|
@@ -64,9 +57,8 @@ const businessFormSchema = z
|
|
|
64
57
|
irsCode: z.int().optional(),
|
|
65
58
|
defaultDescription: z.string().optional(),
|
|
66
59
|
defaultTags: z.array(z.string()),
|
|
67
|
-
isClient: z.boolean().default(false).optional(),
|
|
68
60
|
transactionPhrases: z.array(z.string()),
|
|
69
|
-
emailAddresses: z.array(z.email()),
|
|
61
|
+
emailAddresses: z.array(z.string().email()),
|
|
70
62
|
})
|
|
71
63
|
.refine(
|
|
72
64
|
data => {
|
|
@@ -125,7 +117,6 @@ export function InsertBusiness({
|
|
|
125
117
|
onAdd?: (businessId: string) => void;
|
|
126
118
|
}) {
|
|
127
119
|
const [isNewBusinessOpen, setIsNewBusinessOpen] = useState(false);
|
|
128
|
-
const [client, setClient] = useState<ClientFormValues | null>(null);
|
|
129
120
|
|
|
130
121
|
const { insertBusiness, fetching: addingInProcess } = useInsertBusiness();
|
|
131
122
|
|
|
@@ -137,7 +128,6 @@ export function InsertBusiness({
|
|
|
137
128
|
defaultTags: [],
|
|
138
129
|
transactionPhrases: description ? [description] : [],
|
|
139
130
|
emailAddresses: [],
|
|
140
|
-
locality: 'GAB',
|
|
141
131
|
},
|
|
142
132
|
});
|
|
143
133
|
|
|
@@ -145,68 +135,44 @@ export function InsertBusiness({
|
|
|
145
135
|
const newBusiness = await insertBusiness({
|
|
146
136
|
fields: convertFormDataToInsertNewBusinessInput(data),
|
|
147
137
|
});
|
|
148
|
-
if (data.isClient && newBusiness?.id) {
|
|
149
|
-
setClient({
|
|
150
|
-
businessId: newBusiness.id,
|
|
151
|
-
generatedDocumentType: DocumentType.Proforma,
|
|
152
|
-
emails: [],
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
onComplete(newBusiness?.id);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const onComplete = (businessId: string = '') => {
|
|
160
|
-
setClient(null);
|
|
161
138
|
setIsNewBusinessOpen(false);
|
|
162
139
|
form.reset();
|
|
163
|
-
onAdd?.(
|
|
140
|
+
onAdd?.(newBusiness?.id ?? '');
|
|
164
141
|
};
|
|
165
142
|
|
|
166
143
|
return (
|
|
167
|
-
|
|
168
|
-
<
|
|
169
|
-
<
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
<
|
|
181
|
-
<form
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
</Dialog>
|
|
200
|
-
{client?.businessId && (
|
|
201
|
-
<ModifyClientDialog
|
|
202
|
-
businessId={client.businessId}
|
|
203
|
-
client={client}
|
|
204
|
-
onDone={() => {
|
|
205
|
-
onComplete(client.businessId);
|
|
206
|
-
}}
|
|
207
|
-
/>
|
|
208
|
-
)}
|
|
209
|
-
</>
|
|
144
|
+
<Dialog open={isNewBusinessOpen} onOpenChange={setIsNewBusinessOpen}>
|
|
145
|
+
<DialogTrigger asChild>
|
|
146
|
+
<Button>
|
|
147
|
+
<Plus className="size-4 mr-2" />
|
|
148
|
+
New Business
|
|
149
|
+
</Button>
|
|
150
|
+
</DialogTrigger>
|
|
151
|
+
<DialogContent className="max-w-3xl max-h-[90vh] overflow-y-auto">
|
|
152
|
+
<DialogHeader>
|
|
153
|
+
<DialogTitle>Create New Business</DialogTitle>
|
|
154
|
+
<DialogDescription>Add a new business to Accounter.</DialogDescription>
|
|
155
|
+
</DialogHeader>
|
|
156
|
+
<Form {...form}>
|
|
157
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
|
158
|
+
<ContactInformationSection form={form} />
|
|
159
|
+
|
|
160
|
+
<DefaultsSection form={form} />
|
|
161
|
+
|
|
162
|
+
<AutoMatchingSection form={form} />
|
|
163
|
+
|
|
164
|
+
<div className="flex justify-end gap-3 pt-4 border-t">
|
|
165
|
+
<Button type="button" variant="outline" onClick={() => setIsNewBusinessOpen(false)}>
|
|
166
|
+
Cancel
|
|
167
|
+
</Button>
|
|
168
|
+
<Button type="submit" disabled={addingInProcess}>
|
|
169
|
+
Create Business
|
|
170
|
+
</Button>
|
|
171
|
+
</div>
|
|
172
|
+
</form>
|
|
173
|
+
</Form>
|
|
174
|
+
</DialogContent>
|
|
175
|
+
</Dialog>
|
|
210
176
|
);
|
|
211
177
|
}
|
|
212
178
|
|
|
@@ -572,29 +538,12 @@ function DefaultsSection({ form }: SectionProps) {
|
|
|
572
538
|
placeholder="Select Default Tags"
|
|
573
539
|
variant="default"
|
|
574
540
|
disabled={fetchingTags}
|
|
575
|
-
asChild
|
|
576
541
|
/>
|
|
577
542
|
</FormControl>
|
|
578
543
|
<FormMessage />
|
|
579
544
|
</FormItem>
|
|
580
545
|
)}
|
|
581
546
|
/>
|
|
582
|
-
|
|
583
|
-
<FormField
|
|
584
|
-
control={form.control}
|
|
585
|
-
name="isClient"
|
|
586
|
-
render={({ field }) => (
|
|
587
|
-
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm">
|
|
588
|
-
<div className="space-y-0.5">
|
|
589
|
-
<FormLabel>Client</FormLabel>
|
|
590
|
-
<FormDescription>Business is a client</FormDescription>
|
|
591
|
-
</div>
|
|
592
|
-
<FormControl>
|
|
593
|
-
<Switch checked={field.value} onCheckedChange={field.onChange} />
|
|
594
|
-
</FormControl>
|
|
595
|
-
</FormItem>
|
|
596
|
-
)}
|
|
597
|
-
/>
|
|
598
547
|
</div>
|
|
599
548
|
</div>
|
|
600
549
|
);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CircleCheckBig, FileDown,
|
|
3
|
-
import { Link } from 'react-router-dom';
|
|
4
|
-
import { UserContext } from '@/providers/index.js';
|
|
5
|
-
import { ROUTES } from '@/router/routes.js';
|
|
1
|
+
import { useState, type JSX } from 'react';
|
|
2
|
+
import { CircleCheckBig, FileDown, User2Icon } from 'lucide-react';
|
|
6
3
|
import { Tooltip } from '@mantine/core';
|
|
7
4
|
import { useDisclosure } from '@mantine/hooks';
|
|
8
5
|
import { useCornJobs } from '../../hooks/use-corn-jobs.js';
|
|
@@ -20,14 +17,11 @@ import {
|
|
|
20
17
|
} from '../ui/dropdown-menu.js';
|
|
21
18
|
|
|
22
19
|
export function UserNav(): JSX.Element {
|
|
23
|
-
const { userContext } = useContext(UserContext);
|
|
24
20
|
const [pullDocumentsOpened, { close: closePullDocuments, open: openPullDocuments }] =
|
|
25
21
|
useDisclosure(false);
|
|
26
22
|
const [balanceChargeModalOpen, setBalanceChargeModalOpen] = useState(false);
|
|
27
23
|
const { executeJobs } = useCornJobs();
|
|
28
24
|
|
|
29
|
-
const userName = userContext?.username || 'User Name';
|
|
30
|
-
|
|
31
25
|
return (
|
|
32
26
|
<>
|
|
33
27
|
<DropdownMenu>
|
|
@@ -41,27 +35,11 @@ export function UserNav(): JSX.Element {
|
|
|
41
35
|
<DropdownMenuContent className="w-56" align="end" forceMount>
|
|
42
36
|
<DropdownMenuLabel className="font-normal">
|
|
43
37
|
<div className="flex flex-col space-y-1">
|
|
44
|
-
<p className="text-sm font-medium leading-none">
|
|
38
|
+
<p className="text-sm font-medium leading-none">User Name</p>
|
|
45
39
|
<p className="text-xs leading-none text-muted-foreground">Email</p>
|
|
46
40
|
</div>
|
|
47
41
|
</DropdownMenuLabel>
|
|
48
42
|
<DropdownMenuSeparator />
|
|
49
|
-
<DropdownMenuItem>
|
|
50
|
-
<Link
|
|
51
|
-
to={{
|
|
52
|
-
pathname: ROUTES.BUSINESSES.DETAIL(userContext?.context.adminBusinessId || ''),
|
|
53
|
-
search: '?tab=admin',
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
<Button
|
|
57
|
-
variant="ghost"
|
|
58
|
-
className="flex items-center gap-1 data-[state=active]:bg-background"
|
|
59
|
-
>
|
|
60
|
-
<Shield className="size-4" />
|
|
61
|
-
<span className="hidden sm:inline">Admin Configurations</span>
|
|
62
|
-
</Button>
|
|
63
|
-
</Link>
|
|
64
|
-
</DropdownMenuItem>
|
|
65
43
|
<DropdownMenuItem>
|
|
66
44
|
<Button variant="ghost" onClick={() => setBalanceChargeModalOpen(true)}>
|
|
67
45
|
Add Balance Charge
|
package/src/gql/gql.ts
CHANGED
|
@@ -21,12 +21,12 @@ type Documents = {
|
|
|
21
21
|
"\n query BusinessTripsRowValidation($id: UUID!) {\n businessTrip(id: $id) {\n id\n uncategorizedTransactions {\n transaction {\n ... on Transaction @defer {\n id\n }\n }\n }\n summary {\n ... on BusinessTripSummary @defer {\n errors\n }\n }\n }\n }\n": typeof types.BusinessTripsRowValidationDocument,
|
|
22
22
|
"\n query EditableBusinessTrip($businessTripId: UUID!) {\n businessTrip(id: $businessTripId) {\n id\n ...BusinessTripReportHeaderFields\n ...BusinessTripReportAttendeesFields\n ...BusinessTripUncategorizedTransactionsFields\n ...BusinessTripReportFlightsFields\n ...BusinessTripReportAccommodationsFields\n ...BusinessTripReportTravelAndSubsistenceFields\n ...BusinessTripReportCarRentalFields\n ...BusinessTripReportOtherFields\n ...BusinessTripReportSummaryFields\n ... on BusinessTrip {\n uncategorizedTransactions {\n transaction {\n id\n }\n }\n }\n }\n }\n": typeof types.EditableBusinessTripDocument,
|
|
23
23
|
"\n query BusinessTripsScreen {\n allBusinessTrips {\n id\n name\n dates {\n start\n }\n ...BusinessTripsRowFields\n }\n }\n": typeof types.BusinessTripsScreenDocument,
|
|
24
|
-
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
24
|
+
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n employerWithholdingTaxAccountNumber\n taxPrepaymentId\n nationalInsuranceEmployerId\n advanceTaxRate\n registrationDate\n }\n }\n }\n": typeof types.BusinessAdminSectionFragmentDoc,
|
|
25
25
|
"\n fragment BusinessHeader on Business {\n __typename\n id\n name\n createdAt\n isActive\n ... on LtdFinancialEntity {\n governmentId\n adminInfo {\n id\n }\n clientInfo {\n id\n }\n }\n }\n": typeof types.BusinessHeaderFragmentDoc,
|
|
26
26
|
"\n query BusinessChargesSection($page: Int, $limit: Int, $filters: ChargeFilter) {\n allCharges(page: $page, limit: $limit, filters: $filters) {\n nodes {\n id\n ...ChargesTableFields\n }\n pageInfo {\n totalPages\n }\n }\n }\n": typeof types.BusinessChargesSectionDocument,
|
|
27
27
|
"\n fragment BusinessConfigurationSection on Business {\n __typename\n id\n pcn874RecordType\n irsCode\n isActive\n ... on LtdFinancialEntity {\n optionalVAT\n exemptDealer\n isReceiptEnough\n isDocumentsOptional\n sortCode {\n id\n key\n defaultIrsCode\n }\n taxCategory {\n id\n }\n suggestions {\n phrases\n emails\n tags {\n id\n }\n description\n emailListener {\n internalEmailLinks\n emailBody\n attachments\n }\n }\n clientInfo {\n id\n }\n }\n }\n": typeof types.BusinessConfigurationSectionFragmentDoc,
|
|
28
28
|
"\n fragment BusinessContactSection on Business {\n __typename\n id\n ... on LtdFinancialEntity {\n name\n hebrewName\n country\n governmentId\n address\n email\n # localAddress\n phoneNumber\n website\n clientInfo {\n id\n emails\n }\n }\n }\n": typeof types.BusinessContactSectionFragmentDoc,
|
|
29
|
-
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n
|
|
29
|
+
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n }\n }\n": typeof types.ClientContractsSectionDocument,
|
|
30
30
|
"\n fragment BusinessPage on Business {\n id\n ... on LtdFinancialEntity {\n clientInfo {\n id\n }\n adminInfo {\n id\n }\n }\n ...ClientIntegrationsSection\n ...BusinessHeader\n ...BusinessContactSection\n ...BusinessConfigurationSection\n ...BusinessAdminSection\n }\n": typeof types.BusinessPageFragmentDoc,
|
|
31
31
|
"\n fragment ClientIntegrationsSection on LtdFinancialEntity {\n id\n clientInfo {\n id\n greenInvoiceId\n hiveId\n }\n }\n": typeof types.ClientIntegrationsSectionFragmentDoc,
|
|
32
32
|
"\n query ClientIntegrationsSectionGreenInvoice($clientId: UUID!) {\n greenInvoiceClient(clientId: $clientId) {\n id\n country\n emails\n name\n phone\n taxId\n address\n city\n zip\n fax\n mobile\n }\n }\n": typeof types.ClientIntegrationsSectionGreenInvoiceDocument,
|
|
@@ -211,7 +211,7 @@ type Documents = {
|
|
|
211
211
|
"\n mutation DeleteTag($tagId: UUID!) {\n deleteTag(id: $tagId)\n }\n": typeof types.DeleteTagDocument,
|
|
212
212
|
"\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n": typeof types.FetchIncomeDocumentsDocument,
|
|
213
213
|
"\n query AllClients {\n allClients {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n }\n": typeof types.AllClientsDocument,
|
|
214
|
-
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n
|
|
214
|
+
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\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 msCloud\n }\n }\n": typeof types.AllOpenContractsDocument,
|
|
215
215
|
"\n query AllBusinesses {\n allBusinesses {\n nodes {\n id\n name\n }\n }\n }\n": typeof types.AllBusinessesDocument,
|
|
216
216
|
"\n query AllCountries {\n allCountries {\n id\n name\n code\n }\n }\n": typeof types.AllCountriesDocument,
|
|
217
217
|
"\n query AllFinancialEntities {\n allFinancialEntities {\n nodes {\n id\n name\n }\n }\n }\n": typeof types.AllFinancialEntitiesDocument,
|
|
@@ -273,12 +273,12 @@ const documents: Documents = {
|
|
|
273
273
|
"\n query BusinessTripsRowValidation($id: UUID!) {\n businessTrip(id: $id) {\n id\n uncategorizedTransactions {\n transaction {\n ... on Transaction @defer {\n id\n }\n }\n }\n summary {\n ... on BusinessTripSummary @defer {\n errors\n }\n }\n }\n }\n": types.BusinessTripsRowValidationDocument,
|
|
274
274
|
"\n query EditableBusinessTrip($businessTripId: UUID!) {\n businessTrip(id: $businessTripId) {\n id\n ...BusinessTripReportHeaderFields\n ...BusinessTripReportAttendeesFields\n ...BusinessTripUncategorizedTransactionsFields\n ...BusinessTripReportFlightsFields\n ...BusinessTripReportAccommodationsFields\n ...BusinessTripReportTravelAndSubsistenceFields\n ...BusinessTripReportCarRentalFields\n ...BusinessTripReportOtherFields\n ...BusinessTripReportSummaryFields\n ... on BusinessTrip {\n uncategorizedTransactions {\n transaction {\n id\n }\n }\n }\n }\n }\n": types.EditableBusinessTripDocument,
|
|
275
275
|
"\n query BusinessTripsScreen {\n allBusinessTrips {\n id\n name\n dates {\n start\n }\n ...BusinessTripsRowFields\n }\n }\n": types.BusinessTripsScreenDocument,
|
|
276
|
-
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
276
|
+
"\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n employerWithholdingTaxAccountNumber\n taxPrepaymentId\n nationalInsuranceEmployerId\n advanceTaxRate\n registrationDate\n }\n }\n }\n": types.BusinessAdminSectionFragmentDoc,
|
|
277
277
|
"\n fragment BusinessHeader on Business {\n __typename\n id\n name\n createdAt\n isActive\n ... on LtdFinancialEntity {\n governmentId\n adminInfo {\n id\n }\n clientInfo {\n id\n }\n }\n }\n": types.BusinessHeaderFragmentDoc,
|
|
278
278
|
"\n query BusinessChargesSection($page: Int, $limit: Int, $filters: ChargeFilter) {\n allCharges(page: $page, limit: $limit, filters: $filters) {\n nodes {\n id\n ...ChargesTableFields\n }\n pageInfo {\n totalPages\n }\n }\n }\n": types.BusinessChargesSectionDocument,
|
|
279
279
|
"\n fragment BusinessConfigurationSection on Business {\n __typename\n id\n pcn874RecordType\n irsCode\n isActive\n ... on LtdFinancialEntity {\n optionalVAT\n exemptDealer\n isReceiptEnough\n isDocumentsOptional\n sortCode {\n id\n key\n defaultIrsCode\n }\n taxCategory {\n id\n }\n suggestions {\n phrases\n emails\n tags {\n id\n }\n description\n emailListener {\n internalEmailLinks\n emailBody\n attachments\n }\n }\n clientInfo {\n id\n }\n }\n }\n": types.BusinessConfigurationSectionFragmentDoc,
|
|
280
280
|
"\n fragment BusinessContactSection on Business {\n __typename\n id\n ... on LtdFinancialEntity {\n name\n hebrewName\n country\n governmentId\n address\n email\n # localAddress\n phoneNumber\n website\n clientInfo {\n id\n emails\n }\n }\n }\n": types.BusinessContactSectionFragmentDoc,
|
|
281
|
-
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n
|
|
281
|
+
"\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n }\n }\n": types.ClientContractsSectionDocument,
|
|
282
282
|
"\n fragment BusinessPage on Business {\n id\n ... on LtdFinancialEntity {\n clientInfo {\n id\n }\n adminInfo {\n id\n }\n }\n ...ClientIntegrationsSection\n ...BusinessHeader\n ...BusinessContactSection\n ...BusinessConfigurationSection\n ...BusinessAdminSection\n }\n": types.BusinessPageFragmentDoc,
|
|
283
283
|
"\n fragment ClientIntegrationsSection on LtdFinancialEntity {\n id\n clientInfo {\n id\n greenInvoiceId\n hiveId\n }\n }\n": types.ClientIntegrationsSectionFragmentDoc,
|
|
284
284
|
"\n query ClientIntegrationsSectionGreenInvoice($clientId: UUID!) {\n greenInvoiceClient(clientId: $clientId) {\n id\n country\n emails\n name\n phone\n taxId\n address\n city\n zip\n fax\n mobile\n }\n }\n": types.ClientIntegrationsSectionGreenInvoiceDocument,
|
|
@@ -463,7 +463,7 @@ const documents: Documents = {
|
|
|
463
463
|
"\n mutation DeleteTag($tagId: UUID!) {\n deleteTag(id: $tagId)\n }\n": types.DeleteTagDocument,
|
|
464
464
|
"\n mutation FetchIncomeDocuments($ownerId: UUID!) {\n fetchIncomeDocuments(ownerId: $ownerId) {\n id\n ...NewFetchedDocumentFields\n }\n }\n": types.FetchIncomeDocumentsDocument,
|
|
465
465
|
"\n query AllClients {\n allClients {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n }\n": types.AllClientsDocument,
|
|
466
|
-
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n
|
|
466
|
+
"\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\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 msCloud\n }\n }\n": types.AllOpenContractsDocument,
|
|
467
467
|
"\n query AllBusinesses {\n allBusinesses {\n nodes {\n id\n name\n }\n }\n }\n": types.AllBusinessesDocument,
|
|
468
468
|
"\n query AllCountries {\n allCountries {\n id\n name\n code\n }\n }\n": types.AllCountriesDocument,
|
|
469
469
|
"\n query AllFinancialEntities {\n allFinancialEntities {\n nodes {\n id\n name\n }\n }\n }\n": types.AllFinancialEntitiesDocument,
|
|
@@ -563,7 +563,7 @@ export function graphql(source: "\n query BusinessTripsScreen {\n allBusines
|
|
|
563
563
|
/**
|
|
564
564
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
565
565
|
*/
|
|
566
|
-
export function graphql(source: "\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n
|
|
566
|
+
export function graphql(source: "\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n employerWithholdingTaxAccountNumber\n taxPrepaymentId\n nationalInsuranceEmployerId\n advanceTaxRate\n registrationDate\n }\n }\n }\n"): (typeof documents)["\n fragment BusinessAdminSection on Business {\n id\n ... on LtdFinancialEntity {\n adminInfo {\n id\n employerWithholdingTaxAccountNumber\n taxPrepaymentId\n nationalInsuranceEmployerId\n advanceTaxRate\n registrationDate\n }\n }\n }\n"];
|
|
567
567
|
/**
|
|
568
568
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
569
569
|
*/
|
|
@@ -583,7 +583,7 @@ export function graphql(source: "\n fragment BusinessContactSection on Business
|
|
|
583
583
|
/**
|
|
584
584
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
585
585
|
*/
|
|
586
|
-
export function graphql(source: "\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n
|
|
586
|
+
export function graphql(source: "\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n }\n }\n"): (typeof documents)["\n query ClientContractsSection($clientId: UUID!) {\n contractsByClient(clientId: $clientId) {\n id\n purchaseOrders\n startDate\n endDate\n amount {\n raw\n currency\n }\n billingCycle\n isActive\n product\n documentType\n remarks\n plan\n msCloud\n }\n }\n"];
|
|
587
587
|
/**
|
|
588
588
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
589
589
|
*/
|
|
@@ -1323,7 +1323,7 @@ export function graphql(source: "\n query AllClients {\n allClients {\n
|
|
|
1323
1323
|
/**
|
|
1324
1324
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1325
1325
|
*/
|
|
1326
|
-
export function graphql(source: "\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n
|
|
1326
|
+
export function graphql(source: "\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\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 msCloud\n }\n }\n"): (typeof documents)["\n query AllOpenContracts {\n allOpenContracts {\n id\n client {\n id\n greenInvoiceId\n emails\n originalBusiness {\n id\n name\n }\n }\n purchaseOrders\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 msCloud\n }\n }\n"];
|
|
1327
1327
|
/**
|
|
1328
1328
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
1329
1329
|
*/
|