@wisemen/wise-crm-web 0.2.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/BusinessDetailSidebarProvider-Dm6Dd7Nq.js +2899 -0
  2. package/dist/{BusinessDetailView-BZpocob4.js → BusinessDetailView-BHVUfCpV.js} +5 -5
  3. package/dist/{CrmDetailHeaderCard-Jo2OteBb.js → CrmDetailHeaderCard-CiVLyIuw.js} +39 -39
  4. package/dist/{CrmDetailView-DKHX-JEl.js → CrmDetailView-DaAuWeiB.js} +14 -14
  5. package/dist/{DealCommunicationTabView-ClflVxHJ.js → DealCommunicationTabView-xq_zOAsr.js} +2 -2
  6. package/dist/{DealDetailView-ChAFvBBK.js → DealDetailView-C54XpYN1.js} +124 -124
  7. package/dist/{DealExternalAttachment-ClwtFzpQ.js → DealExternalAttachment-Dp44vkgt.js} +1 -1
  8. package/dist/{DealSendMailDialog-SWWyaxq8.js → DealSendMailDialog-D11Tgd_A.js} +50 -50
  9. package/dist/{Error-CX6APxDX.js → Error-X0deDY-N.js} +510 -8
  10. package/dist/{IndividualDetailSidebarProvider-BJgxw1Jd.js → IndividualDetailSidebarProvider-BvjhFng9.js} +218 -218
  11. package/dist/{IndividualDetailView-CvGUCWPY.js → IndividualDetailView-Cq8iAwQv.js} +5 -5
  12. package/dist/{client-CpsHjr8V.js → client-S6BLV3Ct.js} +7 -12
  13. package/dist/composables/crmConfig.composable.d.ts +1 -0
  14. package/dist/index.js +375 -375
  15. package/dist/kbo-client/client/client.gen.d.ts +2 -0
  16. package/dist/kbo-client/client/index.d.ts +8 -0
  17. package/dist/kbo-client/client/types.gen.d.ts +117 -0
  18. package/dist/kbo-client/client/utils.gen.d.ts +33 -0
  19. package/dist/kbo-client/client.gen.d.ts +12 -0
  20. package/dist/kbo-client/core/auth.gen.d.ts +18 -0
  21. package/dist/kbo-client/core/bodySerializer.gen.d.ts +25 -0
  22. package/dist/kbo-client/core/params.gen.d.ts +43 -0
  23. package/dist/kbo-client/core/pathSerializer.gen.d.ts +33 -0
  24. package/dist/kbo-client/core/queryKeySerializer.gen.d.ts +18 -0
  25. package/dist/kbo-client/core/serverSentEvents.gen.d.ts +71 -0
  26. package/dist/kbo-client/core/types.gen.d.ts +78 -0
  27. package/dist/kbo-client/core/utils.gen.d.ts +19 -0
  28. package/dist/kbo-client/index.d.ts +2 -0
  29. package/dist/kbo-client/sdk.gen.d.ts +72 -0
  30. package/dist/kbo-client/types.gen.d.ts +2089 -0
  31. package/dist/kbo-client/zod.gen.d.ts +5943 -0
  32. package/dist/libs/http.lib.d.ts +3 -1
  33. package/dist/libs/kboBaseUrl.lib.d.ts +1 -0
  34. package/dist/models/cbe/search/cbeEnterpriseSearchDto.model.d.ts +1 -1
  35. package/dist/style.css +1 -1
  36. package/dist/testing/factories/index.d.ts +1 -0
  37. package/dist/testing/factories/tenantConfig.factory.d.ts +5 -0
  38. package/dist/testing.js +80 -33
  39. package/package.json +2 -1
  40. package/dist/BusinessDetailSidebarProvider-CXG99iHk.js +0 -2077
@@ -0,0 +1,2899 @@
1
+ import { $ as useNoteDeleteMutation, A as AppColorProvider_default, B as CrmDetailSidebarNotesView_default, D as useCrmConfig, E as useEntityDetail, F as AppSidebarFormFooter_default, G as AppDialogContainer_default, H as AppForm_default, I as AppAndOrSeparator_default, K as AppDialogActions_default, L as useOffsetInfiniteQuery, M as useSearch, O as client, P as AppSidebarFormSubmitButton_default, Q as useKeysetInfiniteQuery, R as NoteUpdateDialog_default, S as EntityAutocomplete_default, T as useCrm, U as i18nPlugin, V as toFormField, W as AppConfirmDialog_default, Y as useApiErrorToast, _ as IndividualAutocomplete_default, a as AppOpenEntityButton_default, at as StringUtil, c as CrmDetailAccordionRoot_default, ct as ActivityIndexTransformer, et as NoteService, g as phoneNumberFormSchema, h as useContactPersonCreateMutation, i as CrmDetailSidebarAccordionHeaderIconButton_default, it as ContactPersonUpdateTransformer, k as useGoogleMapsApiKey, l as AppIconLabelPair_default, lt as individualUuidSchema, m as AppDialog_default, n as CrmDetailContainer_default, o as CrmDetailSidebarCard_default, ot as AddressTransformer, r as CrmDetailSidebarTabs_default, rt as AppGrid_default, s as CrmDetailSidebarAccordionItem_default, st as ActivityIndexPaginationTransformer, t as Error_default, x as AppGlobalFormError_default, y as IndividualService, z as AppDialogHeader_default } from "./Error-X0deDY-N.js";
2
+ import { a as contactPersonUpdateFormSchema, c as AddressUtil, i as CrmDetailSidebarMapCard_default, l as ActivityList_default, n as CrmDetailSidebarAccordionContactPersonInfo_default, o as ContactPersonCreateForm_default, r as CrmDetailSidebarAccordionBillingInformation_default, s as ContactPersonCreateNewForm_default, t as CrmDetailHeaderCard_default, u as assert } from "./CrmDetailHeaderCard-CiVLyIuw.js";
3
+ import { c as Be, i as plainDateSchema, l as He, n as useDateTimeFormat, s as ZonedDateTimeTransformer, t as AppSkeletonLoader_default, u as ze } from "./AppSkeletonLoader-BAhoOmFD.js";
4
+ import { B as viewBusinessStatisticsV1, F as viewBusinessBillingInformationDetailV1, I as viewBusinessContactPersonDetailV1, L as viewBusinessDetailV1, M as upsertBusinessBillingInformationV1, P as viewBusinessActivityLogIndexV1, R as viewBusinessIndexV1, T as updateBusinessV1, d as linkContactPersonToBusinessV1, dt as CountryCode, g as makeBusinessContactPersonPrimaryV1, mt as EntityType, n as createBusinessV1, u as linkBusinessAsChildV1, w as updateBusinessContactPersonV1, x as unlinkContactPersonFromBusinessV1 } from "./client-S6BLV3Ct.js";
5
+ import * as z$2 from "zod";
6
+ import z$1, { z } from "zod";
7
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, normalizeClass, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useId, useModel, withCtx, withModifiers } from "vue";
8
+ import { useI18n } from "vue-i18n";
9
+ import { PaginationParamsBuilder, VcAddressAutocomplete, VcAutocomplete, VcButton, VcCheckbox, VcDateField, VcDialog, VcDialogCloseButton, VcIcon, VcIconButton, VcNumberField, VcPhoneNumberField, VcPopover, VcRadioGroup, VcRadioGroupItem, VcSelect, VcSelectItem, VcTextField, useDialog, usePagination } from "@wisemen/vue-core-components";
10
+ import { useDebounceFn } from "@vueuse/core";
11
+ import { useMutation, useQueryClient } from "@tanstack/vue-query";
12
+ import { useForm } from "formango";
13
+ import { Motion } from "motion-v";
14
+ import { VisuallyHidden } from "reka-ui";
15
+ const businessUuidSchema = z.string().uuid().brand("BusinessUuid");
16
+ var BusinessBillingInformationTransformer = class {
17
+ static fromDto(e) {
18
+ return {
19
+ uuid: e.uuid,
20
+ billingLocation: e.billingLocation ? {
21
+ uuid: e.billingLocation.uuid,
22
+ createdAt: ZonedDateTimeTransformer.fromDto(e.billingLocation.createdAt),
23
+ updatedAt: ZonedDateTimeTransformer.fromDto(e.billingLocation.updatedAt),
24
+ address: AddressTransformer.fromDto(e.billingLocation.address)
25
+ } : null,
26
+ invoiceCcEmails: e.invoiceCcEmails,
27
+ invoiceEmail: e.invoiceEmail,
28
+ purchaseNoteCcEmails: e.purchaseNoteCcEmails,
29
+ purchaseNoteEmail: e.purchaseNoteEmail,
30
+ reminderCcEmails: e.reminderCcEmails,
31
+ reminderEmail: e.reminderEmail
32
+ };
33
+ }
34
+ static fromNullableDto(e) {
35
+ return e === null ? null : this.fromDto(e);
36
+ }
37
+ }, BusinessBillingInformationUpdateTransformer = class {
38
+ static toDto(e) {
39
+ return {
40
+ billingAddress: e.billingAddress ? AddressTransformer.toDto(e.billingAddress) : null,
41
+ invoiceCcEmails: e.invoiceCcEmails ?? [],
42
+ invoiceEmail: e.invoiceEmail,
43
+ purchaseNoteCcEmails: e.purchaseNoteCcEmails ?? e.invoiceCcEmails ?? [],
44
+ purchaseNoteEmail: e.purchaseNoteEmail ?? e.invoiceEmail,
45
+ reminderCcEmails: e.reminderCcEmails ?? e.invoiceCcEmails ?? [],
46
+ reminderEmail: e.reminderEmail ?? e.invoiceEmail
47
+ };
48
+ }
49
+ }, BusinessContactPersonTransformer = class {
50
+ static fromDto(e) {
51
+ return {
52
+ businessUuid: e.businessUuid,
53
+ contactPersonUuid: e.contactPersonUuid,
54
+ isPrimary: e.isPrimary,
55
+ email: e.email,
56
+ firstName: e.firstName,
57
+ lastName: e.lastName,
58
+ mobilePhone: e.mobilePhone,
59
+ phone: e.phone,
60
+ position: e.position
61
+ };
62
+ }
63
+ }, VatNumberTransformer = class {
64
+ static fromDto(e) {
65
+ return {
66
+ countryCode: e.countryCode,
67
+ number: e.number
68
+ };
69
+ }
70
+ static fromNullableDto(e) {
71
+ return e === null ? null : this.fromDto(e);
72
+ }
73
+ static toDto(e) {
74
+ return e === null ? null : {
75
+ countryCode: e.countryCode,
76
+ number: e.number
77
+ };
78
+ }
79
+ static toNullableDto(e) {
80
+ return e === null ? null : this.toDto(e);
81
+ }
82
+ }, BusinessCreateTransformer = class {
83
+ static toDto(e) {
84
+ return {
85
+ childUuid: e.childUuid,
86
+ individualUuid: e.individualUuid,
87
+ parentUuid: e.parentUuid,
88
+ name: e.name,
89
+ address: AddressTransformer.toDto(e.address),
90
+ companyNumber: e.companyNumber,
91
+ customFields: e.customFields,
92
+ individual: e.individual ? {
93
+ email: e.individual.email,
94
+ firstName: e.individual.firstName,
95
+ lastName: e.individual.lastName,
96
+ mobilePhone: e.individual.mobilePhone,
97
+ phone: e.individual.phone
98
+ } : null,
99
+ individualPosition: null,
100
+ vatNumber: VatNumberTransformer.toNullableDto(e.vatNumber)
101
+ };
102
+ }
103
+ }, BusinessNodeTransformer = class {
104
+ static fromDto(e) {
105
+ return {
106
+ uuid: e.uuid,
107
+ createdAt: ZonedDateTimeTransformer.fromDto(e.createdAt),
108
+ name: e.name,
109
+ address: AddressTransformer.fromNullableDto(e.location?.address ?? null),
110
+ companyNumber: e.companyNumber,
111
+ email: e.email,
112
+ mobilePhone: e.mobilePhone,
113
+ phone: e.phone,
114
+ vatNumber: e.vatNumber?.number ?? null
115
+ };
116
+ }
117
+ }, BusinessDetailTransformer = class {
118
+ static fromDto(e) {
119
+ return {
120
+ uuid: e.uuid,
121
+ createdAt: ZonedDateTimeTransformer.fromDto(e.createdAt),
122
+ updatedAt: ZonedDateTimeTransformer.fromDto(e.updatedAt),
123
+ name: e.name,
124
+ address: AddressTransformer.fromNullableDto(e.location?.address ?? null),
125
+ billingInformation: e.billingInformation === null ? null : {
126
+ uuid: e.billingInformation.uuid,
127
+ invoiceCcEmails: e.billingInformation.invoiceCcEmails ?? [],
128
+ invoiceEmail: e.billingInformation.invoiceEmail ?? "",
129
+ location: e.billingInformation.location ? {
130
+ uuid: e.billingInformation.location.uuid,
131
+ createdAt: ZonedDateTimeTransformer.fromDto(e.billingInformation.location.createdAt),
132
+ updatedAt: ZonedDateTimeTransformer.fromDto(e.billingInformation.location.updatedAt),
133
+ address: AddressTransformer.fromDto(e.billingInformation.location.address)
134
+ } : null,
135
+ purchaseNoteCcEmails: e.billingInformation.purchaseNoteCcEmails ?? [],
136
+ purchaseNoteEmail: e.billingInformation.purchaseNoteEmail ?? "",
137
+ reminderCcEmails: e.billingInformation.reminderCcEmails ?? [],
138
+ reminderEmail: e.billingInformation.reminderEmail ?? ""
139
+ },
140
+ companyNumber: e.companyNumber,
141
+ contactPersons: e.contactPersons.map((e) => ({
142
+ uuid: e.uuid,
143
+ isPrimary: e.isPrimary,
144
+ email: e.email,
145
+ firstName: e.firstName,
146
+ lastName: e.lastName,
147
+ mobilePhone: e.mobilePhone,
148
+ phone: e.phone,
149
+ position: e.position
150
+ })),
151
+ customFields: e.customFields,
152
+ email: e.email,
153
+ language: e.language,
154
+ location: e.location === null ? null : {
155
+ uuid: e.location.uuid,
156
+ createdAt: ZonedDateTimeTransformer.fromDto(e.location.createdAt),
157
+ updatedAt: ZonedDateTimeTransformer.fromDto(e.location.updatedAt),
158
+ address: AddressTransformer.fromDto(e.location.address)
159
+ },
160
+ mobilePhone: e.mobilePhone,
161
+ parent: e.parent ? BusinessNodeTransformer.fromDto(e.parent) : null,
162
+ phone: e.phone,
163
+ vatNumber: VatNumberTransformer.fromNullableDto(e.vatNumber),
164
+ children: e.children.map(BusinessNodeTransformer.fromDto)
165
+ };
166
+ }
167
+ }, BusinessIndexTransformer = class {
168
+ static fromDto(e) {
169
+ return {
170
+ uuid: e.uuid,
171
+ name: e.name,
172
+ companyNumber: e.companyNumber,
173
+ email: e.email,
174
+ mobilePhone: e.mobilePhone,
175
+ phone: e.phone,
176
+ vatNumber: VatNumberTransformer.fromNullableDto(e.vatNumber)
177
+ };
178
+ }
179
+ }, businessIndexQueryParamsTransformer = class {
180
+ static toDto(e) {
181
+ return {
182
+ pagination: e.pagination,
183
+ search: e.search?.trim() || void 0
184
+ };
185
+ }
186
+ }, BusinessStatisticsTransformer = class {
187
+ static fromDto(e) {
188
+ return {
189
+ monthlyAdded: e.monthlyAdded,
190
+ monthlyPercentageGrowth: e.monthlyPercentageGrowth,
191
+ total: e.total
192
+ };
193
+ }
194
+ }, BusinessUpdateTransformer = class {
195
+ static toDto(e) {
196
+ return {
197
+ name: e.name,
198
+ address: AddressTransformer.toDto(e.address),
199
+ companyNumber: e.companyNumber,
200
+ customFields: e.customFields,
201
+ email: e.email,
202
+ language: e.language,
203
+ mobilePhone: e.mobilePhone,
204
+ phone: e.phone,
205
+ vatNumber: VatNumberTransformer.toNullableDto(e.vatNumber)
206
+ };
207
+ }
208
+ }, BusinessService = class {
209
+ static async addChildBusiness(e, k) {
210
+ await linkBusinessAsChildV1({ path: {
211
+ businessUuid: e,
212
+ childUuid: k
213
+ } });
214
+ }
215
+ static async create(e) {
216
+ return (await createBusinessV1({ body: BusinessCreateTransformer.toDto(e) })).data.uuid;
217
+ }
218
+ static async findByName(e) {
219
+ let k = await viewBusinessIndexV1({ query: new PaginationParamsBuilder().withSearch(e).build() });
220
+ return {
221
+ data: k.data.items.map(BusinessIndexTransformer.fromDto),
222
+ meta: k.data.meta
223
+ };
224
+ }
225
+ static async getActivity(e, k) {
226
+ let A = await viewBusinessActivityLogIndexV1({
227
+ query: new PaginationParamsBuilder(k).buildKeyset(ActivityIndexPaginationTransformer.toDto),
228
+ responseValidator: void 0,
229
+ path: { businessUuid: e }
230
+ });
231
+ return {
232
+ data: A.data.items.map(ActivityIndexTransformer.fromDto),
233
+ meta: {
234
+ next: A.data.meta.next,
235
+ total: A.data.items.length
236
+ }
237
+ };
238
+ }
239
+ static async getAll(e) {
240
+ let k = await viewBusinessIndexV1({ query: businessIndexQueryParamsTransformer.toDto(e) });
241
+ return {
242
+ data: k.data.items.map(BusinessIndexTransformer.fromDto),
243
+ meta: k.data.meta
244
+ };
245
+ }
246
+ static async getBillingInformation(e) {
247
+ let k = await viewBusinessBillingInformationDetailV1({ path: { businessUuid: e } });
248
+ return BusinessBillingInformationTransformer.fromDto(k.data);
249
+ }
250
+ static async getByUuid(e) {
251
+ let k = await viewBusinessDetailV1({ path: { businessUuid: e } });
252
+ return BusinessDetailTransformer.fromDto(k.data);
253
+ }
254
+ static async getContactPerson(e, k) {
255
+ let A = await viewBusinessContactPersonDetailV1({ path: {
256
+ businessUuid: e,
257
+ contactPersonUuid: k
258
+ } });
259
+ return BusinessContactPersonTransformer.fromDto(A.data);
260
+ }
261
+ static async getStatistics() {
262
+ let e = await viewBusinessStatisticsV1();
263
+ return BusinessStatisticsTransformer.fromDto(e.data);
264
+ }
265
+ static async linkContactPerson(e, k, A, j) {
266
+ await linkContactPersonToBusinessV1({
267
+ body: {
268
+ contactPersonUuid: k,
269
+ email: StringUtil.trimOrNull(j.email),
270
+ mobilePhone: j.mobilePhone,
271
+ phone: j.phone,
272
+ position: A
273
+ },
274
+ responseValidator: void 0,
275
+ path: { businessUuid: e }
276
+ });
277
+ }
278
+ static async setPrimaryContactPersonForBusiness(e, k) {
279
+ await makeBusinessContactPersonPrimaryV1({ path: {
280
+ businessUuid: e,
281
+ contactPersonUuid: k
282
+ } });
283
+ }
284
+ static async unlinkContactPerson(e, k) {
285
+ await unlinkContactPersonFromBusinessV1({
286
+ body: { contactPersonUuid: k },
287
+ responseValidator: void 0,
288
+ path: { businessUuid: e }
289
+ });
290
+ }
291
+ static async update(e, k) {
292
+ await updateBusinessV1({
293
+ body: BusinessUpdateTransformer.toDto(k),
294
+ path: { businessUuid: e }
295
+ });
296
+ }
297
+ static async updateContactPerson(e, k, A) {
298
+ await updateBusinessContactPersonV1({
299
+ body: ContactPersonUpdateTransformer.toDto(A),
300
+ path: {
301
+ businessUuid: e,
302
+ contactPersonUuid: k
303
+ }
304
+ });
305
+ }
306
+ static async upsertBillingInformation(e, k) {
307
+ await upsertBusinessBillingInformationV1({
308
+ body: BusinessBillingInformationUpdateTransformer.toDto(k),
309
+ path: { businessUuid: e }
310
+ });
311
+ }
312
+ };
313
+ function useBusinessDetailQuery(e) {
314
+ return He({
315
+ isEnabled: computed(() => e.value !== null),
316
+ queryFn: async () => (assert(e.value !== null, "businessUuid is null"), await BusinessService.getByUuid(e.value)),
317
+ queryKey: { wiseCrmBusinessDetail: { businessUuid: e } }
318
+ });
319
+ }
320
+ function useBusinessActivityIndexQuery(e, k) {
321
+ return Be({
322
+ paginationOptions: k,
323
+ queryFn: async (k) => await BusinessService.getActivity(e.value, k),
324
+ queryKey: { businessActivityIndex: { paginationOptions: k } }
325
+ });
326
+ }
327
+ var BusinessDetailSidebarActivityContent_default = /* @__PURE__ */ defineComponent({
328
+ __name: "BusinessDetailSidebarActivityContent",
329
+ props: { business: {} },
330
+ setup(e) {
331
+ let k = e, A = usePagination({
332
+ isRouteQueryEnabled: !1,
333
+ type: "keyset"
334
+ }), j = useBusinessActivityIndexQuery(computed(() => k.business.uuid), A.paginationOptions), M = computed(() => j.data.value.data ?? []);
335
+ async function N() {
336
+ await j.getNextPage();
337
+ }
338
+ return (e, k) => (openBlock(), createBlock(ActivityList_default, {
339
+ "on-next": N,
340
+ "is-loading": unref(j).isLoading.value,
341
+ activities: M.value
342
+ }, null, 8, ["is-loading", "activities"]));
343
+ }
344
+ });
345
+ function useNoteBusinessCreateMutation() {
346
+ return ze({
347
+ queryFn: async ({ body: e, params: k }) => await NoteService.create(e, { businessUuid: k.businessUuid }),
348
+ queryKeysToInvalidate: { noteBusinessIndex: {} }
349
+ });
350
+ }
351
+ function useNoteBusinessIndexQuery(e, k) {
352
+ return useKeysetInfiniteQuery({
353
+ queryFn: (k) => NoteService.getBusinessNotes({ pagination: k }, e.value),
354
+ queryKey: { noteBusinessIndex: { params: k?.params } }
355
+ });
356
+ }
357
+ var BusinessDetailSidebarNotesContent_default = /* @__PURE__ */ defineComponent({
358
+ __name: "BusinessDetailSidebarNotesContent",
359
+ props: { business: {} },
360
+ setup(k) {
361
+ let j = k, M = useDialog(NoteUpdateDialog_default), N = useApiErrorToast(), P = useNoteBusinessCreateMutation(), F = useNoteDeleteMutation(), I = useNoteBusinessIndexQuery(computed(() => j.business.uuid)), L = computed(() => I.data?.value?.data ?? []);
362
+ async function R(e) {
363
+ await P.execute({
364
+ body: e,
365
+ params: { businessUuid: j.business.uuid }
366
+ });
367
+ }
368
+ async function B(e) {
369
+ try {
370
+ await F.execute({ params: { noteUuid: e } });
371
+ } catch (e) {
372
+ N.show(e);
373
+ }
374
+ }
375
+ function V(e) {
376
+ M.open({ note: e });
377
+ }
378
+ return (e, k) => (openBlock(), createBlock(CrmDetailSidebarNotesView_default, {
379
+ "is-loading": unref(I).isLoading.value,
380
+ notes: L.value,
381
+ "on-submit": R,
382
+ "has-next-page": unref(I).hasNextPage.value,
383
+ onNext: k[0] ||= (e) => unref(I).fetchNextPage(),
384
+ onDelete: B,
385
+ onUpdate: V
386
+ }, null, 8, [
387
+ "is-loading",
388
+ "notes",
389
+ "has-next-page"
390
+ ]));
391
+ }
392
+ });
393
+ function useBusinessPrimaryContactPersonUpdateMutation() {
394
+ let e = useQueryClient(), k = "wiseCrmBusinessDetail", A = useMutation({
395
+ mutationFn: async (e) => {
396
+ await BusinessService.setPrimaryContactPersonForBusiness(e.businessUuid, e.contactPersonUuid);
397
+ },
398
+ onError: (A, j, M) => {
399
+ e.setQueryData([k, { businessUuid: j.businessUuid }], M?.previousData);
400
+ },
401
+ onMutate: async (A) => {
402
+ await e.cancelQueries({ queryKey: [k] });
403
+ let j = e.getQueryData([k, { businessUuid: A.businessUuid }]);
404
+ return j === void 0 ? {} : (e.setQueryData([k, { businessUuid: A.businessUuid }], {
405
+ ...j,
406
+ contactPersons: j.contactPersons.map((e) => e.uuid === A.contactPersonUuid ? {
407
+ ...e,
408
+ isPrimary: !e.isPrimary
409
+ } : {
410
+ ...e,
411
+ isPrimary: !1
412
+ })
413
+ }), { previousData: j });
414
+ },
415
+ onSettled: (A, j, M) => {
416
+ e.invalidateQueries({ queryKey: [k, { businessUuid: M.businessUuid }] });
417
+ }
418
+ });
419
+ return {
420
+ isLoading: computed(() => A.isPending.value),
421
+ data: computed(() => A.data.value),
422
+ execute: async (e) => await A.mutateAsync(e.params)
423
+ };
424
+ }
425
+ function useBusinessUnlinkContactPersonMutation() {
426
+ return ze({
427
+ queryFn: async ({ body: e, params: k }) => await BusinessService.unlinkContactPerson(k.businessUuid, e.contactPersonUuid),
428
+ queryKeysToInvalidate: {
429
+ businessIndex: {},
430
+ wiseCrmBusinessDetail: { businessUuid: (e) => e.businessUuid }
431
+ }
432
+ });
433
+ }
434
+ function useBusinessAddChildBusinessMutation() {
435
+ return ze({
436
+ queryFn: async ({ params: e }) => await BusinessService.addChildBusiness(e.parentUuid, e.childUuid),
437
+ queryKeysToInvalidate: {
438
+ businessIndex: {},
439
+ wiseCrmBusinessDetail: { businessUuid: (e) => e.parentUuid }
440
+ }
441
+ });
442
+ }
443
+ function useBusinessCreateMutation() {
444
+ return ze({
445
+ queryFn: async ({ body: e }) => await BusinessService.create(e),
446
+ queryKeysToInvalidate: { businessIndex: {} }
447
+ });
448
+ }
449
+ function useBusinessIndexQuery(e, k) {
450
+ return useOffsetInfiniteQuery({
451
+ isEnabled: computed(() => k?.value ?? !0),
452
+ queryFn: (k) => BusinessService.getAll({
453
+ pagination: k,
454
+ search: e?.params?.search?.value
455
+ }),
456
+ queryKey: { businessIndex: { queryParams: e?.params } }
457
+ });
458
+ }
459
+ var BusinessAddExistingChildForm_default = /* @__PURE__ */ defineComponent({
460
+ __name: "BusinessAddExistingChildForm",
461
+ props: {
462
+ parentBusinessUuid: {},
463
+ onSubmit: { type: Function }
464
+ },
465
+ emits: ["createNew"],
466
+ setup(e, { emit: k }) {
467
+ let A = e, j = k, M = useI18n(), P = useSearch({ persistInUrl: !1 }), L = useBusinessIndexQuery({ params: { search: P.debouncedSearch } }), R = useForm({
468
+ initialState: { business: null },
469
+ schema: z.object({ business: z.object({
470
+ uuid: businessUuidSchema,
471
+ name: z.string()
472
+ }) }),
473
+ onSubmit: async (e) => {
474
+ await A.onSubmit(e.business.uuid);
475
+ }
476
+ }), V = R.register("business"), U = computed(() => (L.data.value?.data.filter((e) => e.uuid !== A.parentBusinessUuid) ?? []).map((e) => ({
477
+ uuid: e.uuid,
478
+ name: e.name
479
+ })));
480
+ function W(e) {
481
+ P.updateSearch(e);
482
+ }
483
+ function G() {
484
+ j("createNew");
485
+ }
486
+ return (e, k) => (openBlock(), createBlock(AppForm_default, { form: unref(R) }, {
487
+ default: withCtx(() => [createVNode(AppGrid_default, { cols: 1 }, {
488
+ default: withCtx(() => [
489
+ createVNode(unref(VcAutocomplete), mergeProps(unref(toFormField)(unref(V)), {
490
+ items: U.value,
491
+ "display-fn": (e) => e.name,
492
+ "is-loading": unref(L).isFetching.value,
493
+ label: unref(M).t("wise_crm.info_dialog.search_an_existing_one"),
494
+ "icon-left": "search",
495
+ onSearch: W
496
+ }), null, 16, [
497
+ "items",
498
+ "display-fn",
499
+ "is-loading",
500
+ "label"
501
+ ]),
502
+ createVNode(AppAndOrSeparator_default, null, {
503
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.shared.or")), 1)]),
504
+ _: 1
505
+ }),
506
+ createVNode(unref(VcButton), {
507
+ class: "w-full",
508
+ size: "lg",
509
+ variant: "secondary",
510
+ onClick: G
511
+ }, {
512
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.info_dialog.add_business_child_dialog.create_a_new_one")), 1)]),
513
+ _: 1
514
+ }),
515
+ createVNode(AppSidebarFormFooter_default, null, {
516
+ default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
517
+ "is-loading": unref(R).isSubmitting.value,
518
+ label: unref(M).t("wise_crm.shared.add")
519
+ }, null, 8, ["is-loading", "label"])]),
520
+ _: 1
521
+ })
522
+ ]),
523
+ _: 1
524
+ })]),
525
+ _: 1
526
+ }, 8, ["form"]));
527
+ }
528
+ });
529
+ function setScriptSrc(e, k) {
530
+ e.src = k;
531
+ }
532
+ var bootstrap = (e) => {
533
+ var k, A, j, M = "The Google Maps JavaScript API", N = "google", P = "importLibrary", F = "__ib__", I = document, L = window, R = L[N] || (L[N] = {}), B = R.maps ||= {}, V = /* @__PURE__ */ new Set(), H = new URLSearchParams(), U = () => k ||= new Promise(async (P, L) => {
534
+ for (j in await (A = I.createElement("script")), H.set("libraries", [...V] + ""), e) H.set(j.replace(/[A-Z]/g, (e) => "_" + e[0].toLowerCase()), e[j]);
535
+ H.set("callback", N + ".maps." + F), setScriptSrc(A, "https://maps.googleapis.com/maps/api/js?" + H), B[F] = P, A.onerror = () => k = L(Error(M + " could not load.")), A.nonce = I.querySelector("script[nonce]")?.nonce || "", I.head.append(A);
536
+ });
537
+ B[P] ? console.warn(M + " only loads once. Ignoring:", e) : B[P] = (e, ...k) => V.add(e) && U().then(() => B[P](e, ...k));
538
+ }, MSG_REPEATED_SET_OPTIONS = (e) => `The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(e)}) will be ignored.`, MSG_IMPORT_LIBRARY_EXISTS = (e) => `The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(e)}) will be ignored.`, MSG_SET_OPTIONS_NOT_CALLED = "No options were set before calling importLibrary. Make sure to configure the loader using setOptions().", MSG_SCRIPT_ELEMENT_EXISTS = "There already is a script loading the Google Maps JavaScript API, and no google.maps.importLibrary function is defined. @googlemaps/js-api-loader will proceed to bootstrap the API with the specified options, but the existing script might cause problems using the API. Make sure to remove the script loading the API.", __DEV__$1 = process.env.NODE_ENV !== "production", logDevWarning = __DEV__$1 ? (e) => {
539
+ console.warn(`[@googlemaps/js-api-loader] ${e}`);
540
+ } : () => {}, logDevNotice = __DEV__$1 ? (e) => {
541
+ console.info(`[@googlemaps/js-api-loader] ${e}`);
542
+ } : () => {}, __DEV__ = process.env.NODE_ENV !== "production", setOptionsWasCalled_ = !1;
543
+ function setOptions(e) {
544
+ if (setOptionsWasCalled_) {
545
+ logDevWarning(MSG_REPEATED_SET_OPTIONS(e));
546
+ return;
547
+ }
548
+ installImportLibrary_(e), setOptionsWasCalled_ = !0;
549
+ }
550
+ async function importLibrary(e) {
551
+ if (setOptionsWasCalled_ || logDevWarning(MSG_SET_OPTIONS_NOT_CALLED), !window?.google?.maps?.importLibrary) throw Error("google.maps.importLibrary is not installed.");
552
+ return await google.maps.importLibrary(e);
553
+ }
554
+ function installImportLibrary_(e) {
555
+ let k = !!window.google?.maps?.importLibrary;
556
+ k ? logDevNotice(MSG_IMPORT_LIBRARY_EXISTS(e)) : __DEV__ && document.querySelector("script[src*=\"maps.googleapis.com/maps/api/js\"]") && logDevWarning(MSG_SCRIPT_ELEMENT_EXISTS), k || bootstrap(e);
557
+ }
558
+ function useGeocode() {
559
+ let { getGoogleMapsApiKey: e } = useGoogleMapsApiKey();
560
+ async function k(k) {
561
+ let A = e();
562
+ if (A === null) return null;
563
+ let j = [
564
+ k.street,
565
+ k.streetNumber,
566
+ k.postalCode,
567
+ k.city,
568
+ k.country
569
+ ].filter(Boolean).join(", ");
570
+ if (j === "") return null;
571
+ try {
572
+ setOptions({
573
+ key: A,
574
+ libraries: ["places"]
575
+ });
576
+ let { Place: e } = await importLibrary("places"), k = {
577
+ fields: ["location"],
578
+ textQuery: j
579
+ }, { places: M } = await e.searchByText(k);
580
+ if (M.length > 0 && M[0].location !== null) {
581
+ let e = M[0].location;
582
+ return {
583
+ lat: e.lat(),
584
+ lng: e.lng()
585
+ };
586
+ }
587
+ return null;
588
+ } catch {
589
+ return null;
590
+ }
591
+ }
592
+ return { geocodeAddress: k };
593
+ }
594
+ const zPermission = z$2.enum(/* @__PURE__ */ "all_permissions,contact.create,contact.read,contact.update,contact.delete,event-log.read,file.read,file.create,file.delete,jobs.read.index,jobs.read.detail,notification.read.own,notification.read.config,notification.update.read,notification.update.unread,notification.preferences.update.channel,notification.preferences.update.preset,notification.preferences.update.types,notification.preferences.read.own,notification.migrate-type,notification.send-test,role.read,role.create,role.update,role.delete,role.cache.clear,send_push_notification,typesense,user.read,user.create,user.update,user.delete,tenant.create,tenant.read_index,tenant.read_detail,tenant.update,cbe.search".split(",")), zViewPermissionIndexPermissionResponse = z$2.object({
595
+ name: z$2.string(),
596
+ key: zPermission,
597
+ description: z$2.string()
598
+ }), zViewPermissionIndexGroupResponse = z$2.object({
599
+ name: z$2.string(),
600
+ permissions: z$2.array(zViewPermissionIndexPermissionResponse)
601
+ });
602
+ z$2.object({ groups: z$2.array(zViewPermissionIndexGroupResponse) });
603
+ const zCreateTenantCommand = z$2.object({
604
+ name: z$2.string(),
605
+ slug: z$2.string(),
606
+ domain: z$2.string(),
607
+ oidcIssuer: z$2.string(),
608
+ oidcClientId: z$2.string()
609
+ });
610
+ z$2.object({
611
+ uuid: z$2.uuid(),
612
+ name: z$2.string(),
613
+ slug: z$2.string(),
614
+ oidcIssuer: z$2.string(),
615
+ oidcClientId: z$2.string()
616
+ });
617
+ const zUpdateTenantCommand = z$2.object({
618
+ name: z$2.string(),
619
+ slug: z$2.string(),
620
+ domain: z$2.union([z$2.string(), z$2.null()]),
621
+ oidcIssuer: z$2.optional(z$2.string()),
622
+ oidcClientId: z$2.optional(z$2.string())
623
+ });
624
+ z$2.object({
625
+ uuid: z$2.uuid(),
626
+ createdAt: z$2.iso.datetime(),
627
+ updatedAt: z$2.iso.datetime(),
628
+ name: z$2.string(),
629
+ slug: z$2.string(),
630
+ domain: z$2.union([z$2.string(), z$2.null()])
631
+ });
632
+ const zPaginatedOffsetQuery = z$2.object({
633
+ limit: z$2.number().gte(1).lte(100),
634
+ offset: z$2.number().gte(0)
635
+ }), zTenantResponse = z$2.object({
636
+ uuid: z$2.uuid(),
637
+ createdAt: z$2.iso.datetime(),
638
+ updatedAt: z$2.iso.datetime(),
639
+ name: z$2.string(),
640
+ slug: z$2.string(),
641
+ domain: z$2.union([z$2.string(), z$2.null()])
642
+ }), zPaginatedOffsetResponseMeta = z$2.object({
643
+ total: z$2.number(),
644
+ offset: z$2.number(),
645
+ limit: z$2.number()
646
+ });
647
+ z$2.object({
648
+ items: z$2.array(zTenantResponse),
649
+ meta: zPaginatedOffsetResponseMeta
650
+ }), z$2.object({
651
+ environment: z$2.string(),
652
+ commit: z$2.string(),
653
+ version: z$2.string(),
654
+ timestamp: z$2.iso.datetime()
655
+ });
656
+ const zTypesenseCollectionName = z$2.enum([
657
+ "user",
658
+ "contact",
659
+ "cbe_enterprise",
660
+ "cbe_establishment"
661
+ ]);
662
+ z$2.object({ collections: z$2.array(z$2.enum([
663
+ "user",
664
+ "contact",
665
+ "cbe_enterprise",
666
+ "cbe_establishment"
667
+ ])) }), z$2.object({
668
+ detail: z$2.optional(z$2.string()),
669
+ status: z$2.enum(["404"]),
670
+ code: z$2.enum(["user_not_found"])
671
+ });
672
+ const zSetUserRolesCommand = z$2.object({ roleUuids: z$2.array(z$2.uuid()) }), zViewRoleDetailResponse = z$2.object({
673
+ uuid: z$2.uuid(),
674
+ createdAt: z$2.iso.datetime(),
675
+ updatedAt: z$2.iso.datetime(),
676
+ name: z$2.string(),
677
+ permissions: z$2.array(zPermission),
678
+ isDefault: z$2.boolean(),
679
+ isSystemAdmin: z$2.boolean()
680
+ });
681
+ z$2.object({
682
+ uuid: z$2.uuid(),
683
+ email: z$2.union([z$2.email(), z$2.null()]),
684
+ firstName: z$2.union([z$2.string(), z$2.null()]),
685
+ lastName: z$2.union([z$2.string(), z$2.null()]),
686
+ tenantUuid: z$2.union([z$2.uuid(), z$2.null()]),
687
+ roles: z$2.array(zViewRoleDetailResponse)
688
+ }), z$2.object({
689
+ uuid: z$2.uuid(),
690
+ email: z$2.union([z$2.email(), z$2.null()]),
691
+ firstName: z$2.union([z$2.string(), z$2.null()]),
692
+ lastName: z$2.union([z$2.string(), z$2.null()]),
693
+ tenantUuid: z$2.union([z$2.uuid(), z$2.null()]),
694
+ roles: z$2.array(zViewRoleDetailResponse)
695
+ });
696
+ const zUserIndexRoleView = z$2.object({
697
+ uuid: z$2.uuid(),
698
+ name: z$2.string()
699
+ }), zUserIndexView = z$2.object({
700
+ uuid: z$2.uuid(),
701
+ email: z$2.union([z$2.email(), z$2.null()]),
702
+ firstName: z$2.union([z$2.string(), z$2.null()]),
703
+ lastName: z$2.union([z$2.string(), z$2.null()]),
704
+ roles: z$2.array(zUserIndexRoleView)
705
+ });
706
+ z$2.object({
707
+ items: z$2.array(zUserIndexView),
708
+ meta: zPaginatedOffsetResponseMeta
709
+ });
710
+ const zCreateRoleCommand = z$2.object({ name: z$2.string() });
711
+ z$2.object({ uuid: z$2.uuid() });
712
+ const zClearRolePermissionsCacheCommand = z$2.object({ roleUuids: z$2.optional(z$2.union([z$2.array(z$2.uuid()), z$2.null()])) });
713
+ z$2.object({
714
+ detail: z$2.optional(z$2.string()),
715
+ status: z$2.enum(["404"]),
716
+ code: z$2.enum(["role_not_found"])
717
+ });
718
+ const zUpdateRoleCommand = z$2.object({ name: z$2.string() }), zRoleResponse = z$2.object({
719
+ uuid: z$2.uuid(),
720
+ createdAt: z$2.iso.datetime(),
721
+ updatedAt: z$2.iso.datetime(),
722
+ name: z$2.string(),
723
+ permissions: z$2.array(zPermission),
724
+ isDefault: z$2.boolean(),
725
+ isSystemAdmin: z$2.boolean()
726
+ });
727
+ z$2.object({ items: z$2.array(zRoleResponse) });
728
+ const zUpdateRolesPermissionsCommandItem = z$2.object({
729
+ roleUuid: z$2.uuid(),
730
+ permissions: z$2.array(zPermission)
731
+ }), zUpdateRolesPermissionsCommand = z$2.object({ roles: z$2.array(zUpdateRolesPermissionsCommandItem) }), zMimeType = z$2.enum([
732
+ "application/pdf",
733
+ "application/msword",
734
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
735
+ "application/vnd.ms-powerpoint",
736
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
737
+ "text/plain",
738
+ "text/html",
739
+ "text/csv",
740
+ "image/jpeg",
741
+ "image/png",
742
+ "image/tiff",
743
+ "image/bmp",
744
+ "image/heic",
745
+ "image/webp",
746
+ "image/gif",
747
+ "application/octet-stream"
748
+ ]), zCreateFileCommand = z$2.object({
749
+ name: z$2.string(),
750
+ mimeType: zMimeType,
751
+ isPublic: z$2.optional(z$2.boolean()).default(!1)
752
+ });
753
+ z$2.object({
754
+ uuid: z$2.uuid(),
755
+ name: z$2.string(),
756
+ mimeType: z$2.union([zMimeType, z$2.null()]),
757
+ uploadUrl: z$2.string()
758
+ }), z$2.object({
759
+ detail: z$2.optional(z$2.string()),
760
+ status: z$2.enum(["404"]),
761
+ code: z$2.enum(["file_not_found"])
762
+ });
763
+ const zConfirmFileUploadCommand = z$2.object({ blurHash: z$2.union([z$2.string().max(100), z$2.null()]) }), zCoordinatesCommand = z$2.object({
764
+ longitude: z$2.number(),
765
+ latitude: z$2.number()
766
+ }), zAddressCommand = z$2.object({
767
+ placeName: z$2.union([z$2.string(), z$2.null()]),
768
+ placeId: z$2.union([z$2.string(), z$2.null()]),
769
+ country: z$2.union([z$2.string(), z$2.null()]),
770
+ city: z$2.union([z$2.string(), z$2.null()]),
771
+ postalCode: z$2.union([z$2.string(), z$2.null()]),
772
+ streetName: z$2.union([z$2.string(), z$2.null()]),
773
+ streetNumber: z$2.union([z$2.string(), z$2.null()]),
774
+ unit: z$2.union([z$2.string(), z$2.null()]),
775
+ coordinates: z$2.union([zCoordinatesCommand, z$2.null()])
776
+ }), zCurrency = z$2.enum(/* @__PURE__ */ "AFN.EUR.ALL.DZD.USD.AOA.XCD.ARS.AMD.AWG.AUD.AZN.BSD.BHD.BDT.BBD.BYN.BZD.XOF.BMD.INR.BTN.BOB.BOV.BAM.BWP.NOK.BRL.BND.BGN.BIF.CVE.KHR.XAF.CAD.KYD.CLP.CLF.CNY.COP.COU.KMF.CDF.NZD.CRC.CUP.ANG.CZK.DKK.DJF.DOP.EGP.SVC.ERN.SZL.ETB.FKP.FJD.XPF.GMD.GEL.GHS.GIP.GTQ.GBP.GNF.GYD.HTG.HNL.HKD.HUF.ISK.IDR.XDR.IRR.IQD.ILS.JMD.JPY.JOD.KZT.KES.KPW.KRW.KWD.KGS.LAK.LBP.LSL.ZAR.LRD.LYD.CHF.MOP.MKD.MGA.MWK.MYR.MVR.MRU.MUR.XUA.MXN.MXV.MDL.MNT.MAD.MZN.MMK.NAD.NPR.NIO.NGN.OMR.PKR.PAB.PGK.PYG.PEN.PHP.PLN.QAR.RON.RUB.RWF.SHP.WST.STN.SAR.RSD.SCR.SLE.SGD.XSU.SBD.SOS.SSP.LKR.SDG.SRD.SEK.CHE.CHW.SYP.TWD.TJS.TZS.THB.TOP.TTD.TND.TRY.TMT.UGX.UAH.AED.USN.UYU.UYI.UYW.UZS.VUV.VES.VED.VND.YER.ZMW.ZWG.XBA.XBB.XBC.XBD.XTS.XXX.XAU.XPD.XPT.XAG".split(".")), zMonetaryDto = z$2.object({
777
+ amount: z$2.int(),
778
+ currency: zCurrency,
779
+ precision: z$2.int()
780
+ }), zCreateContactCommand = z$2.object({
781
+ firstName: z$2.union([z$2.string(), z$2.null()]),
782
+ lastName: z$2.union([z$2.string(), z$2.null()]),
783
+ email: z$2.union([z$2.email(), z$2.null()]),
784
+ phone: z$2.union([z$2.string(), z$2.null()]),
785
+ address: z$2.union([zAddressCommand, z$2.null()]),
786
+ fileUuid: z$2.union([z$2.uuid(), z$2.null()]),
787
+ avatarUuid: z$2.union([z$2.uuid(), z$2.null()]),
788
+ discount: z$2.union([zMonetaryDto, z$2.null()]),
789
+ balance: z$2.union([zMonetaryDto, z$2.null()]),
790
+ birthDate: z$2.union([z$2.iso.date(), z$2.null()])
791
+ });
792
+ z$2.object({ uuid: z$2.uuid() }), z$2.object({
793
+ detail: z$2.optional(z$2.string()),
794
+ status: z$2.enum(["404"]),
795
+ code: z$2.enum(["contact_not_found"])
796
+ });
797
+ const zUpdateContactCommand = z$2.object({
798
+ firstName: z$2.union([z$2.string(), z$2.null()]),
799
+ lastName: z$2.union([z$2.string(), z$2.null()]),
800
+ email: z$2.union([z$2.email(), z$2.null()]),
801
+ phone: z$2.union([z$2.string(), z$2.null()]),
802
+ isActive: z$2.boolean(),
803
+ address: z$2.union([zAddressCommand, z$2.null()]),
804
+ fileUuid: z$2.union([z$2.uuid(), z$2.null()]),
805
+ avatarUuid: z$2.union([z$2.uuid(), z$2.null()]),
806
+ discount: z$2.union([zMonetaryDto, z$2.null()]),
807
+ balance: z$2.union([zMonetaryDto, z$2.null()]),
808
+ birthDate: z$2.union([z$2.iso.date(), z$2.null()])
809
+ }), zCoordinatesResponse = z$2.object({
810
+ longitude: z$2.number(),
811
+ latitude: z$2.number()
812
+ }), zAddressResponse = z$2.object({
813
+ placeName: z$2.union([z$2.string(), z$2.null()]),
814
+ placeId: z$2.union([z$2.string(), z$2.null()]),
815
+ country: z$2.union([z$2.string(), z$2.null()]),
816
+ city: z$2.union([z$2.string(), z$2.null()]),
817
+ postalCode: z$2.union([z$2.string(), z$2.null()]),
818
+ streetName: z$2.union([z$2.string(), z$2.null()]),
819
+ streetNumber: z$2.union([z$2.string(), z$2.null()]),
820
+ unit: z$2.union([z$2.string(), z$2.null()]),
821
+ coordinates: z$2.union([zCoordinatesResponse, z$2.null()])
822
+ }), zFileResponse = z$2.object({
823
+ uuid: z$2.uuid(),
824
+ name: z$2.string(),
825
+ mimeType: zMimeType,
826
+ blurHash: z$2.union([z$2.string(), z$2.null()])
827
+ }), zPresignedFileVariantResponse = z$2.object({
828
+ label: z$2.string(),
829
+ url: z$2.string()
830
+ }), zPresignedFileResponse = z$2.object({
831
+ uuid: z$2.uuid(),
832
+ name: z$2.string(),
833
+ mimeType: z$2.union([zMimeType, z$2.null()]),
834
+ url: z$2.string(),
835
+ blurHash: z$2.union([z$2.string(), z$2.null()]),
836
+ variants: z$2.array(zPresignedFileVariantResponse)
837
+ });
838
+ z$2.object({
839
+ uuid: z$2.uuid(),
840
+ createdAt: z$2.iso.datetime(),
841
+ updatedAt: z$2.iso.datetime(),
842
+ isActive: z$2.boolean(),
843
+ firstName: z$2.union([z$2.string(), z$2.null()]),
844
+ lastName: z$2.union([z$2.string(), z$2.null()]),
845
+ email: z$2.union([z$2.email(), z$2.null()]),
846
+ phone: z$2.union([z$2.string(), z$2.null()]),
847
+ address: z$2.union([zAddressResponse, z$2.null()]),
848
+ file: z$2.union([zFileResponse, z$2.null()]),
849
+ avatar: z$2.union([zPresignedFileResponse, z$2.null()]),
850
+ discount: z$2.union([zMonetaryDto, z$2.null()]),
851
+ balance: z$2.union([zMonetaryDto, z$2.null()]),
852
+ birthDate: z$2.union([z$2.iso.date(), z$2.null()])
853
+ });
854
+ const zViewContactIndexSortQueryKey = z$2.enum(["name"]), zSortDirection = z$2.enum(["asc", "desc"]), zViewContactIndexSortQuery = z$2.object({
855
+ key: zViewContactIndexSortQueryKey,
856
+ order: zSortDirection
857
+ }), zViewContactIndexFilterQuery = z$2.object({ isActive: z$2.optional(z$2.string()) }), zContactResponse = z$2.object({
858
+ uuid: z$2.uuid(),
859
+ isActive: z$2.boolean(),
860
+ name: z$2.string(),
861
+ email: z$2.union([z$2.email(), z$2.null()]),
862
+ phone: z$2.union([z$2.string(), z$2.null()]),
863
+ address: z$2.union([zAddressResponse, z$2.null()])
864
+ });
865
+ z$2.object({
866
+ items: z$2.array(zContactResponse),
867
+ meta: zPaginatedOffsetResponseMeta
868
+ });
869
+ const zUiTheme = z$2.enum([
870
+ "light",
871
+ "dark",
872
+ "system"
873
+ ]), zLocale = z$2.enum([
874
+ "en-US",
875
+ "nl-BE",
876
+ "fr-BE"
877
+ ]), zFontSize = z$2.enum([
878
+ "smaller",
879
+ "small",
880
+ "default",
881
+ "large",
882
+ "larger"
883
+ ]), zUpdateUiPreferencesCommand = z$2.object({
884
+ theme: z$2.optional(zUiTheme),
885
+ language: z$2.optional(zLocale),
886
+ fontSize: z$2.optional(zFontSize),
887
+ showShortcuts: z$2.optional(z$2.boolean()),
888
+ reduceMotion: z$2.optional(z$2.boolean()),
889
+ highContrast: z$2.optional(z$2.boolean())
890
+ });
891
+ z$2.object({
892
+ theme: zUiTheme,
893
+ language: zLocale,
894
+ fontSize: zFontSize,
895
+ showShortcuts: z$2.boolean(),
896
+ reduceMotion: z$2.boolean(),
897
+ highContrast: z$2.boolean()
898
+ }), z$2.object({
899
+ token: z$2.string(),
900
+ userUuid: z$2.uuid()
901
+ });
902
+ const zTranslations = z$2.object({
903
+ nl: z$2.optional(z$2.string()),
904
+ en: z$2.optional(z$2.string())
905
+ }), zSendPushNotificationCommand = z$2.object({
906
+ name: z$2.string(),
907
+ title: zTranslations,
908
+ description: zTranslations,
909
+ userUuids: z$2.array(z$2.uuid())
910
+ }), zSubjectType = z$2.enum([
911
+ "contact",
912
+ "file",
913
+ "role",
914
+ "user",
915
+ "tenant"
916
+ ]), zViewDomainEventLogIndexFilterQuery = z$2.object({
917
+ subjectType: z$2.optional(zSubjectType),
918
+ subjectId: z$2.optional(z$2.uuid()),
919
+ userUuid: z$2.optional(z$2.uuid())
920
+ }), zViewDomainEventLogIndexQueryKey = z$2.object({
921
+ createdAt: z$2.string(),
922
+ uuid: z$2.uuid()
923
+ }), zViewDomainEventLogIndexPaginationQuery = z$2.object({
924
+ limit: z$2.number().gte(0).lte(100),
925
+ key: z$2.optional(z$2.union([zViewDomainEventLogIndexQueryKey, z$2.null()]))
926
+ }), zDomainEventType = z$2.enum([
927
+ "contact.created",
928
+ "contact.updated",
929
+ "contact.deleted",
930
+ "file.created",
931
+ "file.uploaded",
932
+ "notification.created",
933
+ "notification.read",
934
+ "notification.read.all",
935
+ "notification.unread",
936
+ "notification.types.migrated",
937
+ "notification.preference.preset.updated",
938
+ "role.created",
939
+ "role.deleted",
940
+ "role.renamed",
941
+ "role.permissions.updated",
942
+ "role.permissions.cache.cleared",
943
+ "test-notification.sent",
944
+ "user.created",
945
+ "user.updated",
946
+ "user.role-assigned",
947
+ "user.roles-set",
948
+ "user.notification.created",
949
+ "user.default-notification-preferences.assigned",
950
+ "tenant.created",
951
+ "tenant.updated"
952
+ ]), zViewDomainEventLogIndexItemResponse = z$2.object({
953
+ uuid: z$2.uuid(),
954
+ createdAt: z$2.iso.datetime(),
955
+ version: z$2.int().gte(0),
956
+ source: z$2.string(),
957
+ userUuid: z$2.union([z$2.uuid(), z$2.null()]),
958
+ message: z$2.string(),
959
+ type: zDomainEventType,
960
+ subjectType: z$2.union([zSubjectType, z$2.null()]),
961
+ subjectId: z$2.union([z$2.uuid(), z$2.null()]),
962
+ content: z$2.record(z$2.string(), z$2.unknown())
963
+ }), zViewDomainEventLogIndexResponseMeta = z$2.object({ next: z$2.union([zViewDomainEventLogIndexQueryKey, z$2.null()]) });
964
+ z$2.object({
965
+ items: z$2.array(zViewDomainEventLogIndexItemResponse),
966
+ meta: zViewDomainEventLogIndexResponseMeta
967
+ });
968
+ const zGlobalSearchCollectionName = z$2.enum(["user", "contact"]), zSearchCollectionsFilterContactQuery = z$2.object({ isActive: z$2.optional(z$2.boolean()) }), zSearchCollectionsFilterQuery = z$2.object({
969
+ collections: z$2.optional(z$2.array(zGlobalSearchCollectionName)),
970
+ contact: z$2.optional(zSearchCollectionsFilterContactQuery)
971
+ }), zSearchCollectionsQueryKey = z$2.object({ offset: z$2.int() }), zSearchCollectionPaginationQuery = z$2.object({ key: z$2.optional(zSearchCollectionsQueryKey) }), zSearchCollectionUserResponse = z$2.object({
972
+ uuid: z$2.uuid(),
973
+ name: z$2.string(),
974
+ email: z$2.union([z$2.record(z$2.string(), z$2.unknown()), z$2.null()])
975
+ }), zSearchCollectionContactResponse = z$2.object({
976
+ uuid: z$2.uuid(),
977
+ isActive: z$2.boolean(),
978
+ name: z$2.string(),
979
+ email: z$2.union([z$2.email(), z$2.null()]),
980
+ phone: z$2.union([z$2.string(), z$2.null()]),
981
+ address: z$2.union([zAddressResponse, z$2.null()])
982
+ }), zSearchCollectionsResponseItem = z$2.object({
983
+ collection: zGlobalSearchCollectionName,
984
+ entity: z$2.union([zSearchCollectionUserResponse, zSearchCollectionContactResponse]),
985
+ text_match: z$2.number()
986
+ }), zSearchCollectionsMetaResponse = z$2.object({ next: z$2.union([zSearchCollectionsQueryKey, z$2.null()]) });
987
+ z$2.object({
988
+ items: z$2.array(zSearchCollectionsResponseItem),
989
+ meta: zSearchCollectionsMetaResponse
990
+ });
991
+ const zNotificationPreset = z$2.enum([
992
+ "all",
993
+ "default",
994
+ "custom",
995
+ "none"
996
+ ]), zNotificationType = z$2.enum(["user.created", "system.test-notification"]), zPreferenceTypes = z$2.object({
997
+ email: z$2.array(zNotificationType),
998
+ sms: z$2.array(zNotificationType),
999
+ app: z$2.array(zNotificationType),
1000
+ push: z$2.array(zNotificationType)
1001
+ });
1002
+ z$2.object({
1003
+ preset: zNotificationPreset,
1004
+ emailEnabled: z$2.boolean(),
1005
+ smsEnabled: z$2.boolean(),
1006
+ appEnabled: z$2.boolean(),
1007
+ pushEnabled: z$2.boolean(),
1008
+ preferences: zPreferenceTypes
1009
+ });
1010
+ const zNotificationChannel = z$2.enum([
1011
+ "email",
1012
+ "sms",
1013
+ "app",
1014
+ "push"
1015
+ ]), zNotificationTypeChannelConfig = z$2.object({
1016
+ channel: zNotificationChannel,
1017
+ defaultValue: z$2.boolean(),
1018
+ isSupported: z$2.boolean()
1019
+ }), zViewNotificationTypeConfigTypeResponse = z$2.object({
1020
+ key: zNotificationType,
1021
+ description: z$2.string(),
1022
+ channelConfigs: z$2.array(zNotificationTypeChannelConfig)
1023
+ }), zViewNotificationTypesConfigGroupResponse = z$2.object({
1024
+ name: z$2.string(),
1025
+ description: z$2.string(),
1026
+ types: z$2.array(zViewNotificationTypeConfigTypeResponse)
1027
+ });
1028
+ z$2.object({ groups: z$2.array(zViewNotificationTypesConfigGroupResponse) });
1029
+ const zUpdateMyChannelNotificationPreferenceCommand = z$2.object({
1030
+ channel: zNotificationChannel,
1031
+ isEnabled: z$2.boolean()
1032
+ }), zSendTestNotificationCommand = z$2.object({ message: z$2.string() }), zGetMyNotificationsFilterQuery = z$2.object({ onlyUnread: z$2.optional(z$2.string()) }), zGetMyNotificationsQueryKey = z$2.object({
1033
+ createdAt: z$2.string(),
1034
+ notificationUuid: z$2.uuid()
1035
+ }), zGetMyNotificationsPaginationQuery = z$2.object({
1036
+ limit: z$2.number().gte(0).lte(100),
1037
+ key: z$2.optional(z$2.union([zGetMyNotificationsQueryKey, z$2.null()]))
1038
+ }), zCreatedByUserResponse = z$2.object({
1039
+ uuid: z$2.uuid(),
1040
+ name: z$2.string()
1041
+ }), zTestNotificationContent = z$2.object({ message: z$2.string() }), zSystemTestNotificationNotification = z$2.object({
1042
+ createdAt: z$2.iso.datetime(),
1043
+ readAt: z$2.union([z$2.iso.datetime(), z$2.null()]),
1044
+ notificationUuid: z$2.uuid(),
1045
+ createdByUser: z$2.union([zCreatedByUserResponse, z$2.null()]),
1046
+ message: z$2.string(),
1047
+ type: z$2.enum(["system.test-notification"]),
1048
+ meta: zTestNotificationContent
1049
+ }), zGetMyNotificationsResponseMeta = z$2.object({ next: z$2.union([zGetMyNotificationsQueryKey, z$2.null()]) });
1050
+ z$2.object({
1051
+ items: z$2.array(zSystemTestNotificationNotification),
1052
+ meta: zGetMyNotificationsResponseMeta
1053
+ }), z$2.object({
1054
+ amount: z$2.number().gte(0),
1055
+ exceedsLimit: z$2.boolean()
1056
+ }), z$2.object({
1057
+ detail: z$2.optional(z$2.string()),
1058
+ status: z$2.enum(["404"]),
1059
+ code: z$2.enum(["user_notification_not_found"])
1060
+ });
1061
+ const zUpdateMyNotificationTypePreferenceCommand = z$2.object({
1062
+ channel: zNotificationChannel,
1063
+ isEnabled: z$2.boolean(),
1064
+ types: z$2.array(zNotificationType)
1065
+ }), zUpdateMyNotificationPreferencePresetCommand = z$2.object({ preset: zNotificationPreset }), zMigrationAlreadyPerformedErrorMeta = z$2.object({ type: z$2.array(zNotificationType) });
1066
+ z$2.object({
1067
+ detail: z$2.optional(z$2.string()),
1068
+ status: z$2.enum(["400"]),
1069
+ code: z$2.enum(["migration_already_performed"]),
1070
+ meta: zMigrationAlreadyPerformedErrorMeta
1071
+ });
1072
+ const zMigrateNotificationTypesCommand = z$2.object({ types: z$2.array(zNotificationType) }), zViewJobsIndexSortQueryKey = z$2.enum(["createdAt"]), zViewJobsIndexSortQuery = z$2.object({
1073
+ key: zViewJobsIndexSortQueryKey,
1074
+ order: zSortDirection
1075
+ }), zQueueName = z$2.enum(["system"]), zViewJobsIndexFilterQuery = z$2.object({ queueNames: z$2.optional(z$2.array(zQueueName)) }), zViewJobsIndexQueryKey = z$2.object({
1076
+ createdAt: z$2.optional(z$2.iso.datetime()),
1077
+ id: z$2.string()
1078
+ }), zViewJobsIndexPaginationQuery = z$2.object({
1079
+ limit: z$2.number().gte(0).lte(100),
1080
+ key: z$2.optional(z$2.union([zViewJobsIndexQueryKey, z$2.null()]))
1081
+ }), zJobStatus = z$2.enum([
1082
+ "created",
1083
+ "active",
1084
+ "completed",
1085
+ "retry",
1086
+ "failed",
1087
+ "cancelled"
1088
+ ]), zViewJobsIndexItemResponse = z$2.object({
1089
+ queueName: zQueueName,
1090
+ id: z$2.uuid(),
1091
+ name: z$2.string(),
1092
+ status: zJobStatus,
1093
+ createdAt: z$2.iso.datetime(),
1094
+ completedAt: z$2.union([z$2.iso.datetime(), z$2.null()])
1095
+ }), zViewJobsIndexResponseMeta = z$2.object({ next: z$2.union([zViewJobsIndexQueryKey, z$2.null()]) });
1096
+ z$2.object({
1097
+ items: z$2.array(zViewJobsIndexItemResponse),
1098
+ meta: zViewJobsIndexResponseMeta
1099
+ }), z$2.object({
1100
+ detail: z$2.optional(z$2.string()),
1101
+ status: z$2.enum(["404"]),
1102
+ code: z$2.enum(["job_not_found"])
1103
+ }), z$2.object({
1104
+ id: z$2.uuid(),
1105
+ queueName: zQueueName,
1106
+ priority: z$2.number(),
1107
+ name: z$2.string(),
1108
+ data: z$2.record(z$2.string(), z$2.unknown()),
1109
+ status: zJobStatus,
1110
+ retryLimit: z$2.number(),
1111
+ retryCount: z$2.number(),
1112
+ retryDelay: z$2.number(),
1113
+ retryBackoff: z$2.boolean(),
1114
+ startAfter: z$2.iso.datetime(),
1115
+ startedAt: z$2.union([z$2.iso.datetime(), z$2.null()]),
1116
+ singletonKey: z$2.union([z$2.string(), z$2.null()]),
1117
+ singletonOn: z$2.union([z$2.iso.datetime(), z$2.null()]),
1118
+ expireIn: z$2.record(z$2.string(), z$2.unknown()),
1119
+ createdAt: z$2.iso.datetime(),
1120
+ completedAt: z$2.union([z$2.iso.datetime(), z$2.null()]),
1121
+ keepUntil: z$2.iso.datetime(),
1122
+ output: z$2.union([z$2.record(z$2.string(), z$2.unknown()), z$2.null()]),
1123
+ deadLetter: z$2.union([z$2.string(), z$2.null()]),
1124
+ policy: z$2.union([z$2.string(), z$2.null()])
1125
+ });
1126
+ const zCbeEnterpriseStatus = z$2.enum(["active", "inactive"]), zSearchCbeEnterprisesView = z$2.object({
1127
+ enterpriseNumber: z$2.string(),
1128
+ status: zCbeEnterpriseStatus,
1129
+ startDate: z$2.union([z$2.string(), z$2.null()]),
1130
+ name: z$2.union([z$2.string(), z$2.null()]),
1131
+ abbreviation: z$2.union([z$2.string(), z$2.null()]),
1132
+ phone: z$2.union([z$2.string(), z$2.null()]),
1133
+ fax: z$2.union([z$2.string(), z$2.null()]),
1134
+ email: z$2.union([z$2.string(), z$2.null()]),
1135
+ website: z$2.union([z$2.string(), z$2.null()]),
1136
+ address: z$2.union([zAddressResponse, z$2.null()])
1137
+ }), zSearchCbeEnterprisesResponse = z$2.object({
1138
+ items: z$2.array(zSearchCbeEnterprisesView),
1139
+ meta: zPaginatedOffsetResponseMeta
1140
+ }), zSearchCbeEstablishmentsFilterQuery = z$2.object({ enterpriseNumber: z$2.optional(z$2.string()) }), zSearchCbeEstablishmentsView = z$2.object({
1141
+ establishmentNumber: z$2.string(),
1142
+ enterpriseNumber: z$2.string(),
1143
+ startDate: z$2.union([z$2.string(), z$2.null()]),
1144
+ commercialName: z$2.union([z$2.string(), z$2.null()]),
1145
+ address: z$2.union([zAddressResponse, z$2.null()])
1146
+ });
1147
+ z$2.object({
1148
+ items: z$2.array(z$2.array(z$2.unknown())),
1149
+ meta: zPaginatedOffsetResponseMeta,
1150
+ results: z$2.array(zSearchCbeEstablishmentsView)
1151
+ }), z$2.object({
1152
+ detail: z$2.optional(z$2.string()),
1153
+ status: z$2.enum(["500"]),
1154
+ code: z$2.enum(["internal_server_error"])
1155
+ }), z$2.object({
1156
+ body: z$2.optional(z$2.never()),
1157
+ path: z$2.optional(z$2.never()),
1158
+ query: z$2.optional(z$2.never())
1159
+ }), z$2.object({
1160
+ body: z$2.optional(z$2.never()),
1161
+ path: z$2.optional(z$2.never()),
1162
+ query: z$2.optional(z$2.object({
1163
+ pagination: z$2.optional(zPaginatedOffsetQuery),
1164
+ search: z$2.optional(z$2.string())
1165
+ }))
1166
+ }), z$2.object({
1167
+ body: zCreateTenantCommand,
1168
+ path: z$2.optional(z$2.never()),
1169
+ query: z$2.optional(z$2.never())
1170
+ }), z$2.object({
1171
+ body: z$2.optional(z$2.never()),
1172
+ path: z$2.object({ uuid: z$2.string() }),
1173
+ query: z$2.optional(z$2.never())
1174
+ }), z$2.object({
1175
+ body: zUpdateTenantCommand,
1176
+ path: z$2.object({ uuid: z$2.string() }),
1177
+ query: z$2.optional(z$2.never())
1178
+ }), z$2.void(), z$2.object({
1179
+ body: z$2.optional(z$2.never()),
1180
+ path: z$2.optional(z$2.never()),
1181
+ query: z$2.optional(z$2.never())
1182
+ }), z$2.object({
1183
+ body: z$2.optional(z$2.never()),
1184
+ path: z$2.optional(z$2.never()),
1185
+ query: z$2.object({
1186
+ fresh: z$2.boolean(),
1187
+ collections: z$2.optional(z$2.array(zTypesenseCollectionName))
1188
+ })
1189
+ }), z$2.object({
1190
+ body: z$2.optional(z$2.never()),
1191
+ path: z$2.optional(z$2.never()),
1192
+ query: z$2.optional(z$2.object({ collections: z$2.optional(z$2.array(zTypesenseCollectionName)) }))
1193
+ }), z$2.object({
1194
+ body: z$2.optional(z$2.never()),
1195
+ path: z$2.optional(z$2.never()),
1196
+ query: z$2.optional(z$2.never())
1197
+ }), z$2.object({
1198
+ body: z$2.optional(z$2.never()),
1199
+ path: z$2.optional(z$2.never()),
1200
+ query: z$2.optional(z$2.never())
1201
+ }), z$2.object({
1202
+ body: zSetUserRolesCommand,
1203
+ path: z$2.object({ user: z$2.string() }),
1204
+ query: z$2.optional(z$2.never())
1205
+ }), z$2.object({
1206
+ body: z$2.optional(z$2.never()),
1207
+ path: z$2.optional(z$2.never()),
1208
+ query: z$2.optional(z$2.never())
1209
+ }), z$2.object({
1210
+ body: z$2.optional(z$2.never()),
1211
+ path: z$2.object({ uuid: z$2.string() }),
1212
+ query: z$2.optional(z$2.never())
1213
+ }), z$2.object({
1214
+ body: z$2.optional(z$2.never()),
1215
+ path: z$2.optional(z$2.never()),
1216
+ query: z$2.optional(z$2.object({
1217
+ pagination: z$2.optional(zPaginatedOffsetQuery),
1218
+ search: z$2.optional(z$2.string())
1219
+ }))
1220
+ }), z$2.object({
1221
+ body: z$2.optional(z$2.never()),
1222
+ path: z$2.optional(z$2.never()),
1223
+ query: z$2.optional(z$2.never())
1224
+ }), z$2.object({
1225
+ body: zUpdateRolesPermissionsCommand,
1226
+ path: z$2.optional(z$2.never()),
1227
+ query: z$2.optional(z$2.never())
1228
+ }), z$2.void(), z$2.object({
1229
+ body: zCreateRoleCommand,
1230
+ path: z$2.optional(z$2.never()),
1231
+ query: z$2.optional(z$2.never())
1232
+ }), z$2.object({
1233
+ body: zClearRolePermissionsCacheCommand,
1234
+ path: z$2.optional(z$2.never()),
1235
+ query: z$2.optional(z$2.never())
1236
+ }), z$2.void(), z$2.object({
1237
+ body: z$2.optional(z$2.never()),
1238
+ path: z$2.object({ role: z$2.string() }),
1239
+ query: z$2.optional(z$2.never())
1240
+ }), z$2.void(), z$2.object({
1241
+ body: z$2.optional(z$2.never()),
1242
+ path: z$2.object({ role: z$2.string() }),
1243
+ query: z$2.optional(z$2.never())
1244
+ }), z$2.object({
1245
+ body: zUpdateRoleCommand,
1246
+ path: z$2.object({ role: z$2.string() }),
1247
+ query: z$2.optional(z$2.never())
1248
+ }), z$2.void(), z$2.object({
1249
+ body: zCreateFileCommand,
1250
+ path: z$2.optional(z$2.never()),
1251
+ query: z$2.optional(z$2.never())
1252
+ }), z$2.object({
1253
+ body: z$2.optional(z$2.never()),
1254
+ path: z$2.object({ file: z$2.string() }),
1255
+ query: z$2.optional(z$2.never())
1256
+ }), z$2.void(), z$2.object({
1257
+ body: zConfirmFileUploadCommand,
1258
+ path: z$2.object({ file: z$2.string() }),
1259
+ query: z$2.optional(z$2.never())
1260
+ }), z$2.void(), z$2.object({
1261
+ body: z$2.optional(z$2.never()),
1262
+ path: z$2.object({ file: z$2.string() }),
1263
+ query: z$2.optional(z$2.never())
1264
+ }), z$2.object({
1265
+ body: z$2.optional(z$2.never()),
1266
+ path: z$2.object({ file: z$2.string() }),
1267
+ query: z$2.object({ token: z$2.string() })
1268
+ }), z$2.object({
1269
+ body: z$2.optional(z$2.never()),
1270
+ path: z$2.optional(z$2.never()),
1271
+ query: z$2.optional(z$2.object({
1272
+ pagination: z$2.optional(zPaginatedOffsetQuery),
1273
+ sort: z$2.optional(z$2.array(zViewContactIndexSortQuery)),
1274
+ filter: z$2.optional(zViewContactIndexFilterQuery),
1275
+ search: z$2.optional(z$2.string())
1276
+ }))
1277
+ }), z$2.object({
1278
+ body: zCreateContactCommand,
1279
+ path: z$2.optional(z$2.never()),
1280
+ query: z$2.optional(z$2.never())
1281
+ }), z$2.object({
1282
+ body: z$2.optional(z$2.never()),
1283
+ path: z$2.object({ uuid: z$2.string() }),
1284
+ query: z$2.optional(z$2.never())
1285
+ }), z$2.void(), z$2.object({
1286
+ body: z$2.optional(z$2.never()),
1287
+ path: z$2.object({ uuid: z$2.string() }),
1288
+ query: z$2.optional(z$2.never())
1289
+ }), z$2.object({
1290
+ body: zUpdateContactCommand,
1291
+ path: z$2.object({ uuid: z$2.string() }),
1292
+ query: z$2.optional(z$2.never())
1293
+ }), z$2.void(), z$2.object({
1294
+ body: z$2.optional(z$2.never()),
1295
+ path: z$2.optional(z$2.never()),
1296
+ query: z$2.optional(z$2.never())
1297
+ }), z$2.object({
1298
+ body: zUpdateUiPreferencesCommand,
1299
+ path: z$2.optional(z$2.never()),
1300
+ query: z$2.optional(z$2.never())
1301
+ }), z$2.object({
1302
+ body: z$2.optional(z$2.never()),
1303
+ path: z$2.optional(z$2.never()),
1304
+ query: z$2.optional(z$2.never())
1305
+ }), z$2.object({
1306
+ body: zSendPushNotificationCommand,
1307
+ path: z$2.optional(z$2.never()),
1308
+ query: z$2.optional(z$2.never())
1309
+ }), z$2.object({
1310
+ body: z$2.optional(z$2.never()),
1311
+ path: z$2.optional(z$2.never()),
1312
+ query: z$2.optional(z$2.object({
1313
+ filter: z$2.optional(zViewDomainEventLogIndexFilterQuery),
1314
+ pagination: z$2.optional(zViewDomainEventLogIndexPaginationQuery)
1315
+ }))
1316
+ }), z$2.object({
1317
+ body: z$2.optional(z$2.never()),
1318
+ path: z$2.optional(z$2.never()),
1319
+ query: z$2.object({
1320
+ filter: z$2.optional(zSearchCollectionsFilterQuery),
1321
+ search: z$2.string(),
1322
+ pagination: z$2.optional(zSearchCollectionPaginationQuery)
1323
+ })
1324
+ }), z$2.object({
1325
+ body: z$2.optional(z$2.never()),
1326
+ path: z$2.optional(z$2.never()),
1327
+ query: z$2.optional(z$2.never())
1328
+ }), z$2.object({
1329
+ body: z$2.optional(z$2.never()),
1330
+ path: z$2.optional(z$2.never()),
1331
+ query: z$2.optional(z$2.never())
1332
+ }), z$2.object({
1333
+ body: zUpdateMyChannelNotificationPreferenceCommand,
1334
+ path: z$2.optional(z$2.never()),
1335
+ query: z$2.optional(z$2.never())
1336
+ }), z$2.void(), z$2.object({
1337
+ body: zSendTestNotificationCommand,
1338
+ path: z$2.optional(z$2.never()),
1339
+ query: z$2.optional(z$2.never())
1340
+ }), z$2.void(), z$2.object({
1341
+ body: z$2.optional(z$2.never()),
1342
+ path: z$2.optional(z$2.never()),
1343
+ query: z$2.optional(z$2.object({
1344
+ filter: z$2.optional(zGetMyNotificationsFilterQuery),
1345
+ pagination: z$2.optional(zGetMyNotificationsPaginationQuery)
1346
+ }))
1347
+ }), z$2.object({
1348
+ body: z$2.optional(z$2.never()),
1349
+ path: z$2.optional(z$2.never()),
1350
+ query: z$2.optional(z$2.never())
1351
+ }), z$2.object({
1352
+ body: z$2.optional(z$2.never()),
1353
+ path: z$2.object({ notificationUuid: z$2.string() }),
1354
+ query: z$2.optional(z$2.never())
1355
+ }), z$2.object({
1356
+ body: z$2.optional(z$2.never()),
1357
+ path: z$2.optional(z$2.never()),
1358
+ query: z$2.optional(z$2.never())
1359
+ }), z$2.void(), z$2.object({
1360
+ body: zUpdateMyNotificationTypePreferenceCommand,
1361
+ path: z$2.optional(z$2.never()),
1362
+ query: z$2.optional(z$2.never())
1363
+ }), z$2.void(), z$2.object({
1364
+ body: z$2.optional(z$2.never()),
1365
+ path: z$2.object({ notificationUuid: z$2.string() }),
1366
+ query: z$2.optional(z$2.never())
1367
+ }), z$2.void(), z$2.object({
1368
+ body: z$2.optional(z$2.never()),
1369
+ path: z$2.object({ notificationUuid: z$2.string() }),
1370
+ query: z$2.optional(z$2.never())
1371
+ }), z$2.void(), z$2.object({
1372
+ body: zUpdateMyNotificationPreferencePresetCommand,
1373
+ path: z$2.optional(z$2.never()),
1374
+ query: z$2.optional(z$2.never())
1375
+ }), z$2.void(), z$2.object({
1376
+ body: zMigrateNotificationTypesCommand,
1377
+ path: z$2.optional(z$2.never()),
1378
+ query: z$2.optional(z$2.never())
1379
+ }), z$2.void(), z$2.object({
1380
+ body: z$2.optional(z$2.never()),
1381
+ path: z$2.optional(z$2.never()),
1382
+ query: z$2.optional(z$2.object({
1383
+ sort: z$2.optional(z$2.array(zViewJobsIndexSortQuery)),
1384
+ filter: z$2.optional(zViewJobsIndexFilterQuery),
1385
+ pagination: z$2.optional(zViewJobsIndexPaginationQuery)
1386
+ }))
1387
+ }), z$2.object({
1388
+ body: z$2.optional(z$2.never()),
1389
+ path: z$2.object({ jobId: z$2.string() }),
1390
+ query: z$2.optional(z$2.never())
1391
+ });
1392
+ const zSearchCbeEnterprisesV1Data = z$2.object({
1393
+ body: z$2.optional(z$2.never()),
1394
+ path: z$2.optional(z$2.never()),
1395
+ query: z$2.object({
1396
+ pagination: z$2.optional(zPaginatedOffsetQuery),
1397
+ search: z$2.string()
1398
+ })
1399
+ }), zSearchCbeEnterprisesV1Response = zSearchCbeEnterprisesResponse;
1400
+ z$2.object({
1401
+ body: z$2.optional(z$2.never()),
1402
+ path: z$2.optional(z$2.never()),
1403
+ query: z$2.object({
1404
+ pagination: z$2.optional(zPaginatedOffsetQuery),
1405
+ filter: z$2.optional(zSearchCbeEstablishmentsFilterQuery),
1406
+ search: z$2.string()
1407
+ })
1408
+ });
1409
+ const searchCbeEnterprisesV1 = (e) => (e.client ?? client).get({
1410
+ requestValidator: async (e) => await zSearchCbeEnterprisesV1Data.parseAsync(e),
1411
+ responseValidator: async (e) => await zSearchCbeEnterprisesV1Response.parseAsync(e),
1412
+ url: "/api/v1/cbe/enterprises",
1413
+ ...e
1414
+ });
1415
+ var CbeEnterpriseSearchTransformer = class {
1416
+ static fromDto(e) {
1417
+ return {
1418
+ uuid: e.enterpriseNumber,
1419
+ startDate: e.startDate,
1420
+ name: e.name,
1421
+ abbreviation: e.abbreviation,
1422
+ address: AddressTransformer.fromNullableDto(e.address),
1423
+ email: e.email,
1424
+ fax: e.fax,
1425
+ phone: e.phone,
1426
+ status: e.status,
1427
+ website: e.website
1428
+ };
1429
+ }
1430
+ }, CbeService = class {
1431
+ static async searchEnterprisesByTerm(e) {
1432
+ let k = await searchCbeEnterprisesV1({ query: {
1433
+ pagination: {
1434
+ limit: 10,
1435
+ offset: 0
1436
+ },
1437
+ search: e
1438
+ } });
1439
+ return {
1440
+ data: k.data.items.map(CbeEnterpriseSearchTransformer.fromDto),
1441
+ meta: k.data.meta
1442
+ };
1443
+ }
1444
+ };
1445
+ function useCbeEnterpriseSearchByTermQuery(e) {
1446
+ return He({
1447
+ isEnabled: computed(() => e.value.length > 0),
1448
+ queryFn: async () => (await CbeService.searchEnterprisesByTerm(e.value)).data,
1449
+ queryKey: { cbeEnterpriseSearchByTerm: { searchTerm: e } }
1450
+ });
1451
+ }
1452
+ var _hoisted_1$4 = { class: "text-sm" }, _hoisted_2$3 = {
1453
+ key: 0,
1454
+ class: "text-secondary text-xs"
1455
+ }, CbeAutocomplete_default = /* @__PURE__ */ defineComponent({
1456
+ __name: "CbeAutocomplete",
1457
+ props: /* @__PURE__ */ mergeModels({
1458
+ isRequired: { type: Boolean },
1459
+ label: {}
1460
+ }, {
1461
+ modelValue: { required: !0 },
1462
+ modelModifiers: {}
1463
+ }),
1464
+ emits: /* @__PURE__ */ mergeModels(["createNew"], ["update:modelValue"]),
1465
+ setup(e, { emit: k }) {
1466
+ let A = e, j = k, M = useModel(e, "modelValue"), N = ref(null), P = ref(null), F = useI18n(), I = ref(!0), L = useCbeEnterpriseSearchByTermQuery(computed(() => P.value ?? "")), R = useDebounceFn((e) => {
1467
+ e !== null && (I.value = e.length === 0 || e.trim().length === 0, P.value = e);
1468
+ }, 300), B = computed(() => L.data.value ?? []);
1469
+ async function V(e) {
1470
+ await R(e);
1471
+ }
1472
+ function H() {
1473
+ j("createNew");
1474
+ }
1475
+ function U(e) {
1476
+ return B.value.find((k) => k.uuid === e)?.name ?? "-";
1477
+ }
1478
+ function W(e) {
1479
+ if (e === null) {
1480
+ N.value = null;
1481
+ return;
1482
+ }
1483
+ M.value = B.value.find((k) => k.uuid === e.value) ?? null, N.value = e;
1484
+ }
1485
+ return (e, k) => (openBlock(), createBlock(EntityAutocomplete_default, {
1486
+ modelValue: N.value,
1487
+ "onUpdate:modelValue": [k[0] ||= (e) => N.value = e, W],
1488
+ "is-required": A.isRequired,
1489
+ "display-fn": U,
1490
+ label: A.label,
1491
+ options: B.value,
1492
+ "is-loading": unref(L).isFetching.value,
1493
+ placeholder: unref(F).t("component.select.search_placeholder"),
1494
+ onCreateNew: H,
1495
+ onSearch: V
1496
+ }, {
1497
+ option: withCtx(({ option: e, isHighlighted: k }) => [createElementVNode("div", { class: normalizeClass([{ "bg-brand-50": k }, "p-md px-lg flex flex-col rounded-md"]) }, [createElementVNode("span", _hoisted_1$4, toDisplayString(e.name), 1), e.address ? (openBlock(), createElementBlock("span", _hoisted_2$3, toDisplayString(unref(AddressUtil).format(e.address)), 1)) : createCommentVNode("", !0)], 2)]),
1498
+ _: 1
1499
+ }, 8, [
1500
+ "modelValue",
1501
+ "is-required",
1502
+ "label",
1503
+ "options",
1504
+ "is-loading",
1505
+ "placeholder"
1506
+ ]));
1507
+ }
1508
+ }), ContactCreateDialogBusinessCbeSearch_default = /* @__PURE__ */ defineComponent({
1509
+ __name: "ContactCreateDialogBusinessCbeSearch",
1510
+ emits: [
1511
+ "back",
1512
+ "createNew",
1513
+ "updateCbeSearchItem"
1514
+ ],
1515
+ setup(e, { emit: k }) {
1516
+ let A = k, j = useI18n(), M = ref(null);
1517
+ function N() {
1518
+ A("createNew");
1519
+ }
1520
+ function P(e) {
1521
+ M.value = e, A("updateCbeSearchItem", e);
1522
+ }
1523
+ function F() {
1524
+ A("back");
1525
+ }
1526
+ return (e, k) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
1527
+ default: withCtx(() => [createVNode(CbeAutocomplete_default, {
1528
+ modelValue: M.value,
1529
+ "onUpdate:modelValue": [k[0] ||= (e) => M.value = e, P],
1530
+ label: unref(j).t("wise_crm.contact.create_dialog.form.fields.cbe_search"),
1531
+ onCreateNew: N
1532
+ }, null, 8, ["modelValue", "label"]), createVNode(AppDialogActions_default, null, {
1533
+ default: withCtx(() => [createVNode(unref(VcButton), {
1534
+ variant: "secondary",
1535
+ size: "lg",
1536
+ onClick: F
1537
+ }, {
1538
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(j).t("wise_crm.shared.back")), 1)]),
1539
+ _: 1
1540
+ })]),
1541
+ _: 1
1542
+ })]),
1543
+ _: 1
1544
+ }));
1545
+ }
1546
+ }), baseFieldsetContextKey = Symbol("baseFieldsetContext");
1547
+ function useInjectBaseFieldsetContext() {
1548
+ let e = inject(baseFieldsetContextKey) ?? null;
1549
+ return assert(e !== null, "`useBaseFieldsetContext` must be used within a component that provides the context"), e;
1550
+ }
1551
+ function useProvideBaseFieldsetContext(e) {
1552
+ provide(baseFieldsetContextKey, e);
1553
+ }
1554
+ var _hoisted_1$3 = ["aria-describedby"], BaseFieldset_default = /* @__PURE__ */ defineComponent({
1555
+ __name: "BaseFieldset",
1556
+ setup(e) {
1557
+ let k = useId();
1558
+ return useProvideBaseFieldsetContext({ id: k }), (e, A) => (openBlock(), createElementBlock("fieldset", { "aria-describedby": unref(k) }, [renderSlot(e.$slots, "default")], 8, _hoisted_1$3));
1559
+ }
1560
+ }), BaseFieldsetLegend_default = /* @__PURE__ */ defineComponent({
1561
+ __name: "BaseFieldsetLegend",
1562
+ props: { as: {} },
1563
+ setup(e) {
1564
+ let k = e, A = useInjectBaseFieldsetContext();
1565
+ return (e, j) => (openBlock(), createBlock(resolveDynamicComponent(k.as), { id: unref(A).id }, {
1566
+ default: withCtx(() => [renderSlot(e.$slots, "default")]),
1567
+ _: 3
1568
+ }, 8, ["id"]));
1569
+ }
1570
+ }), _hoisted_1$2 = { class: "mb-lg" }, _hoisted_2$2 = {
1571
+ key: 0,
1572
+ class: "mt-sm text-secondary text-sm"
1573
+ }, _hoisted_3$2 = { class: "col-span-2" }, FormFieldset_default = /* @__PURE__ */ defineComponent({
1574
+ __name: "FormFieldset",
1575
+ props: {
1576
+ title: {},
1577
+ isTitleHidden: {
1578
+ type: Boolean,
1579
+ default: !1
1580
+ },
1581
+ description: { default: null }
1582
+ },
1583
+ setup(e) {
1584
+ let k = e;
1585
+ return (e, A) => (openBlock(), createBlock(BaseFieldset_default, null, {
1586
+ default: withCtx(() => [createElementVNode("div", _hoisted_1$2, [(openBlock(), createBlock(resolveDynamicComponent(k.isTitleHidden ? unref(VisuallyHidden) : "div"), null, {
1587
+ default: withCtx(() => [createVNode(BaseFieldsetLegend_default, {
1588
+ as: "h2",
1589
+ class: "text-primary text-sm font-medium"
1590
+ }, {
1591
+ default: withCtx(() => [createTextVNode(toDisplayString(k.title), 1)]),
1592
+ _: 1
1593
+ })]),
1594
+ _: 1
1595
+ })), k.description === null ? createCommentVNode("", !0) : (openBlock(), createElementBlock("p", _hoisted_2$2, toDisplayString(k.description), 1))]), createElementVNode("div", _hoisted_3$2, [renderSlot(e.$slots, "default")])]),
1596
+ _: 3
1597
+ }));
1598
+ }
1599
+ }), ContactCreateDialogBusinessContactPerson_default = /* @__PURE__ */ defineComponent({
1600
+ __name: "ContactCreateDialogBusinessContactPerson",
1601
+ props: { form: {} },
1602
+ emits: ["back"],
1603
+ setup(e, { emit: k }) {
1604
+ let A = e, j = k, M = useI18n(), N = A.form.register("individual.firstName"), P = A.form.register("individual.lastName"), F = A.form.register("individualPosition"), I = A.form.register("individual.email"), R = A.form.register("individual.mobilePhone"), B = A.form.register("individual.phone");
1605
+ function V() {
1606
+ j("back");
1607
+ }
1608
+ return (k, A) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
1609
+ default: withCtx(() => [createVNode(AppGrid_default, { cols: 1 }, {
1610
+ default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
1611
+ default: withCtx(() => [
1612
+ createVNode(unref(VcTextField), mergeProps({
1613
+ label: unref(M).t("wise_crm.contact.create_dialog.form.fields.first_name"),
1614
+ placeholder: unref(M).t("wise_crm.contact.create_dialog.form.fields.first_name")
1615
+ }, unref(toFormField)(unref(N))), null, 16, ["label", "placeholder"]),
1616
+ createVNode(unref(VcTextField), mergeProps({
1617
+ label: unref(M).t("wise_crm.contact.create_dialog.form.fields.last_name"),
1618
+ placeholder: unref(M).t("wise_crm.contact.create_dialog.form.fields.last_name")
1619
+ }, unref(toFormField)(unref(P))), null, 16, ["label", "placeholder"]),
1620
+ createVNode(unref(VcTextField), mergeProps({
1621
+ label: unref(M).t("wise_crm.contact.create_dialog.form.fields.position"),
1622
+ placeholder: unref(M).t("wise_crm.contact.create_dialog.form.fields.position")
1623
+ }, unref(toFormField)(unref(F))), null, 16, ["label", "placeholder"])
1624
+ ]),
1625
+ _: 1
1626
+ }), createVNode(FormFieldset_default, {
1627
+ title: unref(M).t("wise_crm.shared.contact_info"),
1628
+ class: "col-span-2"
1629
+ }, {
1630
+ default: withCtx(() => [createVNode(AppGrid_default, {
1631
+ cols: 1,
1632
+ class: "mt-sm bg-secondary p-lg rounded-xl"
1633
+ }, {
1634
+ default: withCtx(() => [
1635
+ createVNode(unref(VcTextField), mergeProps(unref(toFormField)(unref(I)), {
1636
+ label: unref(M).t("wise_crm.contact.create_dialog.form.fields.email"),
1637
+ placeholder: unref(M).t("wise_crm.contact.create_dialog.form.fields.email")
1638
+ }), null, 16, ["label", "placeholder"]),
1639
+ createVNode(unref(VcPhoneNumberField), mergeProps(unref(toFormField)(unref(R)), {
1640
+ label: unref(M).t("wise_crm.contact.create_dialog.form.fields.mobile_phone"),
1641
+ placeholder: unref(M).t("wise_crm.contact.create_dialog.form.fields.mobile_phone")
1642
+ }), null, 16, ["label", "placeholder"]),
1643
+ createVNode(unref(VcPhoneNumberField), mergeProps(unref(toFormField)(unref(B)), {
1644
+ label: unref(M).t("wise_crm.contact.create_dialog.form.fields.phone"),
1645
+ placeholder: unref(M).t("wise_crm.contact.create_dialog.form.fields.phone")
1646
+ }), null, 16, ["label", "placeholder"])
1647
+ ]),
1648
+ _: 1
1649
+ }), createVNode(AppGlobalFormError_default, { form: e.form }, null, 8, ["form"])]),
1650
+ _: 1
1651
+ }, 8, ["title"])]),
1652
+ _: 1
1653
+ }), createVNode(AppDialogActions_default, null, {
1654
+ default: withCtx(() => [createVNode(unref(VcButton), {
1655
+ size: "lg",
1656
+ variant: "secondary",
1657
+ onClick: V
1658
+ }, {
1659
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.shared.back")), 1)]),
1660
+ _: 1
1661
+ }), createVNode(unref(VcButton), {
1662
+ "is-loading": e.form.isSubmitting.value,
1663
+ size: "lg",
1664
+ type: "submit"
1665
+ }, {
1666
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.shared.create")), 1)]),
1667
+ _: 1
1668
+ }, 8, ["is-loading"])]),
1669
+ _: 1
1670
+ })]),
1671
+ _: 1
1672
+ }));
1673
+ }
1674
+ }), ContactCreateDialogBusinessContactPersonSearch_default = /* @__PURE__ */ defineComponent({
1675
+ __name: "ContactCreateDialogBusinessContactPersonSearch",
1676
+ props: {
1677
+ isSubmitting: { type: Boolean },
1678
+ form: {},
1679
+ requireIndividualOnCreate: { type: Boolean }
1680
+ },
1681
+ emits: [
1682
+ "back",
1683
+ "createNew",
1684
+ "next"
1685
+ ],
1686
+ setup(e, { emit: k }) {
1687
+ let A = e, j = k, M = useI18n(), N = useApiErrorToast(), P = ref(null), F = A.form.register("individualUuid"), I = A.form.register("individual");
1688
+ async function R(e) {
1689
+ if (P.value = e, e !== null) {
1690
+ F.setValue(e ? e.value : null);
1691
+ try {
1692
+ let k = await IndividualService.getByUuid(e.value);
1693
+ I.setValue({
1694
+ email: k.email,
1695
+ firstName: k.firstName,
1696
+ lastName: k.lastName,
1697
+ mobilePhone: k.mobilePhone,
1698
+ phone: k.phone
1699
+ }), j("next");
1700
+ } catch (e) {
1701
+ N.show(e);
1702
+ }
1703
+ }
1704
+ }
1705
+ function B() {
1706
+ j("back");
1707
+ }
1708
+ function V() {
1709
+ F.setValue(null), I.setValue(null), j("next");
1710
+ }
1711
+ return (e, k) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
1712
+ default: withCtx(() => [createVNode(IndividualAutocomplete_default, {
1713
+ "model-value": P.value,
1714
+ label: unref(M).t("wise_crm.contact.create_dialog.form.contact_person"),
1715
+ "onUpdate:modelValue": R,
1716
+ onCreateNew: V
1717
+ }, null, 8, ["model-value", "label"]), createVNode(AppDialogActions_default, null, {
1718
+ default: withCtx(() => [createVNode(unref(VcButton), {
1719
+ variant: "secondary",
1720
+ size: "lg",
1721
+ onClick: B
1722
+ }, {
1723
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.shared.back")), 1)]),
1724
+ _: 1
1725
+ }), A.requireIndividualOnCreate ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(VcButton), {
1726
+ key: 0,
1727
+ "is-loading": A.isSubmitting,
1728
+ size: "lg",
1729
+ type: "submit"
1730
+ }, {
1731
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.shared.skip")), 1)]),
1732
+ _: 1
1733
+ }, 8, ["is-loading"]))]),
1734
+ _: 1
1735
+ })]),
1736
+ _: 1
1737
+ }));
1738
+ }
1739
+ }), AppVatNumberField_default = /* @__PURE__ */ defineComponent({
1740
+ __name: "AppVatNumberField",
1741
+ props: /* @__PURE__ */ mergeModels({
1742
+ isLoading: { type: Boolean },
1743
+ isSpellCheckEnabled: { type: Boolean },
1744
+ autocomplete: {},
1745
+ iconLeft: {},
1746
+ iconRight: {},
1747
+ placeholder: {},
1748
+ type: {},
1749
+ variant: {},
1750
+ testId: {},
1751
+ isDisabled: { type: Boolean },
1752
+ id: {},
1753
+ isRequired: { type: Boolean },
1754
+ isTouched: { type: Boolean },
1755
+ errorMessage: {},
1756
+ hint: {},
1757
+ label: {},
1758
+ classConfig: {}
1759
+ }, {
1760
+ modelValue: { required: !0 },
1761
+ modelModifiers: {}
1762
+ }),
1763
+ emits: ["update:modelValue"],
1764
+ setup(e) {
1765
+ let k = e, A = useModel(e, "modelValue"), j = computed({
1766
+ get: () => A.value ? `${A.value.countryCode}${A.value.number}` : null,
1767
+ set: (e) => {
1768
+ if (e === null) {
1769
+ A.value = null;
1770
+ return;
1771
+ }
1772
+ A.value = {
1773
+ countryCode: e.slice(0, 2).toUpperCase(),
1774
+ number: e.slice(2)
1775
+ };
1776
+ }
1777
+ });
1778
+ function M(e) {
1779
+ e.key.length === 1 && /[a-z0-9]/i.test(e.key) || e.key === "Backspace" || e.key === "Delete" || e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Tab" || e.preventDefault();
1780
+ }
1781
+ function N(e) {
1782
+ let k = (e.clipboardData?.getData("text"))?.replace(/[^a-z0-9]/gi, "");
1783
+ k && (j.value = k);
1784
+ }
1785
+ return (e, A) => (openBlock(), createBlock(unref(VcTextField), mergeProps(k, {
1786
+ modelValue: j.value,
1787
+ "onUpdate:modelValue": A[0] ||= (e) => j.value = e,
1788
+ onKeydown: M,
1789
+ onPaste: withModifiers(N, ["prevent"])
1790
+ }), null, 16, ["modelValue"]));
1791
+ }
1792
+ }), CustomFieldCheckbox_default = /* @__PURE__ */ defineComponent({
1793
+ __name: "CustomFieldCheckbox",
1794
+ props: {
1795
+ definition: {},
1796
+ form: {}
1797
+ },
1798
+ setup(e) {
1799
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`, k.definition.defaultValue);
1800
+ return (e, j) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcCheckbox), mergeProps({ label: k.definition.displayName }, unref(toFormField)(unref(A))), null, 16, ["label"])]));
1801
+ }
1802
+ }), CustomFieldDate_default = /* @__PURE__ */ defineComponent({
1803
+ __name: "CustomFieldDate",
1804
+ props: {
1805
+ definition: {},
1806
+ form: {}
1807
+ },
1808
+ setup(e) {
1809
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`);
1810
+ return (e, j) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcDateField), mergeProps({
1811
+ "min-date": k.definition.minDate,
1812
+ "max-date": k.definition.maxDate,
1813
+ label: k.definition.displayName
1814
+ }, unref(toFormField)(unref(A))), null, 16, [
1815
+ "min-date",
1816
+ "max-date",
1817
+ "label"
1818
+ ])]));
1819
+ }
1820
+ }), CustomFieldMultiSelect_default = /* @__PURE__ */ defineComponent({
1821
+ __name: "CustomFieldMultiSelect",
1822
+ props: {
1823
+ definition: {},
1824
+ form: {}
1825
+ },
1826
+ setup(e) {
1827
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`, []);
1828
+ function j(e) {
1829
+ return k.definition.options.find((k) => k.key === e)?.value ?? e;
1830
+ }
1831
+ return (e, M) => (openBlock(), createBlock(unref(VcSelect), mergeProps(unref(toFormField)(unref(A)), {
1832
+ "display-fn": j,
1833
+ label: k.definition.displayName,
1834
+ placeholder: k.definition.displayName
1835
+ }), {
1836
+ default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(k.definition.options, (e) => (openBlock(), createBlock(unref(VcSelectItem), {
1837
+ key: e.key,
1838
+ value: e.key
1839
+ }, {
1840
+ default: withCtx(() => [createTextVNode(toDisplayString(e.value), 1)]),
1841
+ _: 2
1842
+ }, 1032, ["value"]))), 128))]),
1843
+ _: 1
1844
+ }, 16, ["label", "placeholder"]));
1845
+ }
1846
+ }), CustomFieldNumberField_default = /* @__PURE__ */ defineComponent({
1847
+ __name: "CustomFieldNumberField",
1848
+ props: {
1849
+ definition: {},
1850
+ form: {}
1851
+ },
1852
+ setup(e) {
1853
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`);
1854
+ return (e, j) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcNumberField), mergeProps({
1855
+ min: k.definition.minValue,
1856
+ max: k.definition.maxValue,
1857
+ label: k.definition.displayName,
1858
+ placeholder: k.definition.displayName,
1859
+ "hide-controls": !0
1860
+ }, unref(toFormField)(unref(A))), null, 16, [
1861
+ "min",
1862
+ "max",
1863
+ "label",
1864
+ "placeholder"
1865
+ ])]));
1866
+ }
1867
+ }), CustomFieldRadio_default = /* @__PURE__ */ defineComponent({
1868
+ __name: "CustomFieldRadio",
1869
+ props: {
1870
+ definition: {},
1871
+ form: {}
1872
+ },
1873
+ setup(e) {
1874
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`);
1875
+ return (e, j) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcRadioGroup), mergeProps({ label: k.definition.displayName }, unref(toFormField)(unref(A))), {
1876
+ default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(k.definition.options, (e) => (openBlock(), createBlock(unref(VcRadioGroupItem), {
1877
+ key: e.key,
1878
+ label: e.value,
1879
+ value: e.key
1880
+ }, null, 8, ["label", "value"]))), 128))]),
1881
+ _: 1
1882
+ }, 16, ["label"])]));
1883
+ }
1884
+ }), CustomFieldSelect_default = /* @__PURE__ */ defineComponent({
1885
+ __name: "CustomFieldSelect",
1886
+ props: {
1887
+ definition: {},
1888
+ form: {}
1889
+ },
1890
+ setup(e) {
1891
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`);
1892
+ function j(e) {
1893
+ let A = k.definition.options.find((k) => k.key === e);
1894
+ return A ? A.value : e;
1895
+ }
1896
+ return (e, M) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcSelect), mergeProps({
1897
+ "display-fn": j,
1898
+ label: k.definition.displayName,
1899
+ placeholder: k.definition.displayName
1900
+ }, unref(toFormField)(unref(A))), {
1901
+ default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(k.definition.options, (e) => (openBlock(), createBlock(unref(VcSelectItem), {
1902
+ key: e.key,
1903
+ value: e.key
1904
+ }, {
1905
+ default: withCtx(() => [createTextVNode(toDisplayString(e.value), 1)]),
1906
+ _: 2
1907
+ }, 1032, ["value"]))), 128))]),
1908
+ _: 1
1909
+ }, 16, ["label", "placeholder"])]));
1910
+ }
1911
+ }), CustomFieldString_default = /* @__PURE__ */ defineComponent({
1912
+ __name: "CustomFieldString",
1913
+ props: {
1914
+ definition: {},
1915
+ form: {}
1916
+ },
1917
+ setup(e) {
1918
+ let k = e, A = k.form.register(`customFields.${k.definition.key}`);
1919
+ return (e, j) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcTextField), mergeProps({
1920
+ label: k.definition.displayName,
1921
+ placeholder: k.definition.displayName
1922
+ }, unref(toFormField)(unref(A))), null, 16, ["label", "placeholder"])]));
1923
+ }
1924
+ }), CustomFieldDefinitionForm_default = /* @__PURE__ */ defineComponent({
1925
+ __name: "CustomFieldDefinitionForm",
1926
+ props: {
1927
+ customFieldDefinitions: {},
1928
+ form: {}
1929
+ },
1930
+ setup(e) {
1931
+ let k = e;
1932
+ function A(e) {
1933
+ return e === "full" ? "col-span-2" : "col-span-1";
1934
+ }
1935
+ return (j, M) => (openBlock(), createBlock(AppGrid_default, { cols: 2 }, {
1936
+ default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(k.customFieldDefinitions, (j) => (openBlock(), createElementBlock(Fragment, { key: j.uuid }, [
1937
+ j.type === "string" ? (openBlock(), createBlock(CustomFieldString_default, {
1938
+ key: 0,
1939
+ class: normalizeClass(A(j.width)),
1940
+ form: e.form,
1941
+ definition: j
1942
+ }, null, 8, [
1943
+ "class",
1944
+ "form",
1945
+ "definition"
1946
+ ])) : createCommentVNode("", !0),
1947
+ j.type === "select" ? (openBlock(), createBlock(CustomFieldSelect_default, {
1948
+ key: 1,
1949
+ class: normalizeClass(A(j.width)),
1950
+ form: e.form,
1951
+ definition: j
1952
+ }, null, 8, [
1953
+ "class",
1954
+ "form",
1955
+ "definition"
1956
+ ])) : createCommentVNode("", !0),
1957
+ j.type === "radio" ? (openBlock(), createBlock(CustomFieldRadio_default, {
1958
+ key: 2,
1959
+ class: normalizeClass(A(j.width)),
1960
+ form: e.form,
1961
+ definition: j
1962
+ }, null, 8, [
1963
+ "class",
1964
+ "form",
1965
+ "definition"
1966
+ ])) : createCommentVNode("", !0),
1967
+ j.type === "date" ? (openBlock(), createBlock(CustomFieldDate_default, {
1968
+ key: 3,
1969
+ class: normalizeClass(A(j.width)),
1970
+ form: e.form,
1971
+ definition: j
1972
+ }, null, 8, [
1973
+ "class",
1974
+ "form",
1975
+ "definition"
1976
+ ])) : createCommentVNode("", !0),
1977
+ j.type === "number" ? (openBlock(), createBlock(CustomFieldNumberField_default, {
1978
+ key: 4,
1979
+ definition: j,
1980
+ class: normalizeClass(A(j.width)),
1981
+ form: k.form
1982
+ }, null, 8, [
1983
+ "definition",
1984
+ "class",
1985
+ "form"
1986
+ ])) : createCommentVNode("", !0),
1987
+ j.type === "checkbox" ? (openBlock(), createBlock(CustomFieldCheckbox_default, {
1988
+ key: 5,
1989
+ definition: j,
1990
+ form: k.form,
1991
+ class: normalizeClass(A(j.width))
1992
+ }, null, 8, [
1993
+ "definition",
1994
+ "form",
1995
+ "class"
1996
+ ])) : createCommentVNode("", !0),
1997
+ j.type === "multiselect" ? (openBlock(), createBlock(CustomFieldMultiSelect_default, {
1998
+ key: 6,
1999
+ form: k.form,
2000
+ class: normalizeClass(A(j.width)),
2001
+ definition: j
2002
+ }, null, 8, [
2003
+ "form",
2004
+ "class",
2005
+ "definition"
2006
+ ])) : createCommentVNode("", !0)
2007
+ ], 64))), 128))]),
2008
+ _: 1
2009
+ }));
2010
+ }
2011
+ }), ContactCreateDialogBusinessGeneralInfo_default = /* @__PURE__ */ defineComponent({
2012
+ __name: "ContactCreateDialogBusinessGeneralInfo",
2013
+ props: {
2014
+ isDataFromCbe: { type: Boolean },
2015
+ form: {}
2016
+ },
2017
+ emits: ["back", "next"],
2018
+ setup(e, { emit: k }) {
2019
+ let A = e, M = k, N = useI18n(), P = useCrmConfig(), F = computed(() => P.getCustomFieldDefinitionForEntity(EntityType.BUSINESS).filter((e) => e.isDisplayedOnCreate)), I = A.form.register("name"), R = A.form.register("address"), B = A.form.register("companyNumber"), V = A.form.register("vatNumber");
2020
+ function H() {
2021
+ M("back");
2022
+ }
2023
+ function U() {
2024
+ A.form.blurAll(), I.isValid.value && R.isValid.value && V.isValid.value && B.isValid.value && M("next");
2025
+ }
2026
+ return (k, j) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
2027
+ default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
2028
+ default: withCtx(() => [
2029
+ createVNode(unref(VcTextField), mergeProps({
2030
+ "is-disabled": A.isDataFromCbe,
2031
+ "is-required": !0
2032
+ }, unref(toFormField)(unref(I)), {
2033
+ label: unref(N).t("wise_crm.contact.create_dialog.form.name"),
2034
+ placeholder: unref(N).t("wise_crm.contact.create_dialog.form.name")
2035
+ }), null, 16, [
2036
+ "is-disabled",
2037
+ "label",
2038
+ "placeholder"
2039
+ ]),
2040
+ createVNode(AppVatNumberField_default, mergeProps({ "is-disabled": A.isDataFromCbe }, unref(toFormField)(unref(V)), {
2041
+ label: unref(N).t("wise_crm.contact.create_dialog.form.vat_number"),
2042
+ placeholder: unref(N).t("wise_crm.contact.create_dialog.form.vat_number")
2043
+ }), null, 16, [
2044
+ "is-disabled",
2045
+ "label",
2046
+ "placeholder"
2047
+ ]),
2048
+ createVNode(unref(VcAddressAutocomplete), mergeProps({
2049
+ "is-disabled": A.isDataFromCbe,
2050
+ "is-required": !0,
2051
+ label: unref(N).t("wise_crm.contact.create_dialog.form.fields.address"),
2052
+ placeholder: unref(N).t("wise_crm.contact.create_dialog.form.fields.address")
2053
+ }, unref(toFormField)(unref(R))), null, 16, [
2054
+ "is-disabled",
2055
+ "label",
2056
+ "placeholder"
2057
+ ]),
2058
+ createVNode(unref(VcTextField), mergeProps({
2059
+ label: unref(N).t("wise_crm.contact.create_dialog.form.company_number"),
2060
+ placeholder: unref(N).t("wise_crm.contact.create_dialog.form.company_number")
2061
+ }, unref(toFormField)(unref(B))), null, 16, ["label", "placeholder"]),
2062
+ createVNode(CustomFieldDefinitionForm_default, {
2063
+ "custom-field-definitions": F.value,
2064
+ form: e.form
2065
+ }, null, 8, ["custom-field-definitions", "form"])
2066
+ ]),
2067
+ _: 1
2068
+ }), createVNode(AppDialogActions_default, null, {
2069
+ default: withCtx(() => [createVNode(unref(VcButton), {
2070
+ variant: "secondary",
2071
+ size: "lg",
2072
+ onClick: H
2073
+ }, {
2074
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(N).t("wise_crm.shared.back")), 1)]),
2075
+ _: 1
2076
+ }), createVNode(unref(VcButton), {
2077
+ size: "lg",
2078
+ onClick: U
2079
+ }, {
2080
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(N).t("wise_crm.shared.next")), 1)]),
2081
+ _: 1
2082
+ })]),
2083
+ _: 1
2084
+ })]),
2085
+ _: 1
2086
+ }));
2087
+ }
2088
+ });
2089
+ const addressFormSchema = z.object({
2090
+ placeId: z.string().nullable().optional(),
2091
+ bus: z.string(),
2092
+ city: z.string().min(1),
2093
+ coordinates: z.object({
2094
+ lat: z.number().nullable(),
2095
+ lng: z.number().nullable()
2096
+ }),
2097
+ country: z.string().min(1),
2098
+ postalCode: z.string().min(1),
2099
+ street: z.string().min(1),
2100
+ streetNumber: z.string()
2101
+ }), vatNumberSchema = z$1.object({
2102
+ countryCode: z$1.enum(CountryCode, { error: i18nPlugin.global.t("validation.vat_number.invalid_country_code") }),
2103
+ number: z$1.string().min(1).regex(/^\d+$/, i18nPlugin.global.t("validation.vat_number.numbers_only"))
2104
+ });
2105
+ var CustomFieldDefinitionUtil = class {
2106
+ static getZodType(e) {
2107
+ return e.reduce((e, k) => {
2108
+ switch (k.type) {
2109
+ case "multiselect":
2110
+ e[k.key] = z.string().array().default([]).superRefine((e, A) => {
2111
+ k.minSelections !== void 0 && e.length < k.minSelections && A.addIssue({
2112
+ code: z.ZodIssueCode.custom,
2113
+ message: `At least ${k.minSelections} selections are required`
2114
+ }), k.maxSelections !== void 0 && e.length > k.maxSelections && A.addIssue({
2115
+ code: z.ZodIssueCode.custom,
2116
+ message: `At most ${k.maxSelections} selections are allowed`
2117
+ });
2118
+ });
2119
+ break;
2120
+ case "checkbox":
2121
+ e[k.key] = z.boolean();
2122
+ break;
2123
+ case "radio":
2124
+ e[k.key] = z.string().nullable();
2125
+ break;
2126
+ case "select":
2127
+ e[k.key] = z.string().nullable().superRefine((e, k) => {
2128
+ e === "" && k.addIssue({
2129
+ code: z.ZodIssueCode.custom,
2130
+ message: "Selection is required"
2131
+ });
2132
+ });
2133
+ break;
2134
+ case "number":
2135
+ e[k.key] = z.number().nullable().superRefine((e, A) => {
2136
+ e !== null && k.minValue !== void 0 && e < k.minValue && A.addIssue({
2137
+ code: z.ZodIssueCode.custom,
2138
+ message: `Minimum value is ${k.minValue}`
2139
+ }), e !== null && k.maxValue !== void 0 && e > k.maxValue && A.addIssue({
2140
+ code: z.ZodIssueCode.custom,
2141
+ message: `Maximum value is ${k.maxValue}`
2142
+ });
2143
+ });
2144
+ break;
2145
+ case "date":
2146
+ e[k.key] = plainDateSchema.nullable().superRefine((e, A) => {
2147
+ e !== null && k.minDate !== void 0 && e < k.minDate && A.addIssue({
2148
+ code: z.ZodIssueCode.custom,
2149
+ message: `Minimum date is ${k.minDate}`
2150
+ }), e !== null && k.maxDate !== void 0 && e > k.maxDate && A.addIssue({
2151
+ code: z.ZodIssueCode.custom,
2152
+ message: `Maximum date is ${k.maxDate}`
2153
+ });
2154
+ });
2155
+ break;
2156
+ default: e[k.key] = z.string().nullable();
2157
+ }
2158
+ return e;
2159
+ }, {});
2160
+ }
2161
+ };
2162
+ const businessIndividualCreateFormSchema = z.object({
2163
+ email: z.email().nullable(),
2164
+ firstName: z.string().min(1),
2165
+ lastName: z.string().min(1),
2166
+ mobilePhone: phoneNumberFormSchema.nullable(),
2167
+ phone: phoneNumberFormSchema.nullable()
2168
+ });
2169
+ z.object({
2170
+ childUuid: businessUuidSchema.nullable(),
2171
+ individualUuid: individualUuidSchema.nullable(),
2172
+ parentUuid: businessUuidSchema.nullable(),
2173
+ name: z.string().min(1),
2174
+ address: addressFormSchema,
2175
+ companyNumber: z.string().nullable(),
2176
+ customFields: z.object(CustomFieldDefinitionUtil.getZodType([])).nullable(),
2177
+ individual: businessIndividualCreateFormSchema.nullable(),
2178
+ individualPosition: z.string().nullable(),
2179
+ vatNumber: vatNumberSchema.nullable()
2180
+ });
2181
+ function getBusinessCreateFormSchema(e) {
2182
+ return z.object({
2183
+ childUuid: businessUuidSchema.nullable(),
2184
+ individualUuid: individualUuidSchema.nullable(),
2185
+ parentUuid: businessUuidSchema.nullable(),
2186
+ name: z.string().min(1),
2187
+ address: addressFormSchema,
2188
+ companyNumber: z.string().nullable(),
2189
+ customFields: z.object(CustomFieldDefinitionUtil.getZodType(e)).nullable(),
2190
+ individual: businessIndividualCreateFormSchema.nullable(),
2191
+ individualPosition: z.string().nullable(),
2192
+ vatNumber: vatNumberSchema.nullable()
2193
+ });
2194
+ }
2195
+ var Step = /* @__PURE__ */ function(e) {
2196
+ return e.MANUAL_BUSINESS = "manual_business", e.MANUAL_CONTACT_PERSON = "manual_contact_person", e.SEARCH_BUSINESS = "search_business", e.SEARCH_CONTACT_PERSON = "search_contact_person", e;
2197
+ }(Step || {}), ContactCreateDialogBusinessForm_default = /* @__PURE__ */ defineComponent({
2198
+ __name: "ContactCreateDialogBusinessForm",
2199
+ props: { onSubmit: { type: Function } },
2200
+ emits: ["back"],
2201
+ setup(e, { emit: A }) {
2202
+ let M = e, N = A, I = useI18n(), L = useCrm(), R = useCrmConfig(), { geocodeAddress: B } = useGeocode(), V = computed(() => L.getEntityConfig(EntityType.BUSINESS)), H = ref(!1), U = ref(Step.SEARCH_BUSINESS), W = computed(() => U.value === Step.MANUAL_CONTACT_PERSON || U.value === Step.SEARCH_CONTACT_PERSON ? I.t("wise_crm.contact.create_dialog.form.contact_person_title") : I.t("wise_crm.contact.create_dialog.form.title", { value: V.value?.name ?? "-" })), G = computed(() => U.value === Step.MANUAL_CONTACT_PERSON || U.value === Step.SEARCH_CONTACT_PERSON ? I.t("wise_crm.contact.create_dialog.form.contact_person_description") : I.t("wise_crm.contact.create_dialog.form.description")), K = useForm({
2203
+ initialState: {
2204
+ childUuid: null,
2205
+ individualUuid: null,
2206
+ parentUuid: null,
2207
+ name: null,
2208
+ address: null,
2209
+ companyNumber: null,
2210
+ customFields: null,
2211
+ individual: null,
2212
+ individualPosition: null,
2213
+ vatNumber: null
2214
+ },
2215
+ schema: getBusinessCreateFormSchema(computed(() => R.getCustomFieldDefinitionForEntity(EntityType.BUSINESS).filter((e) => e.isDisplayedOnCreate)).value),
2216
+ onSubmit: async (e) => {
2217
+ await M.onSubmit(e);
2218
+ }
2219
+ }), q = K.register("name"), J = K.register("address"), Y = K.register("companyNumber"), X = K.register("vatNumber");
2220
+ function Z(e) {
2221
+ if (e === Step.SEARCH_BUSINESS) {
2222
+ N("back");
2223
+ return;
2224
+ }
2225
+ if (e === Step.MANUAL_BUSINESS) {
2226
+ U.value = Step.SEARCH_BUSINESS;
2227
+ return;
2228
+ }
2229
+ if (e === Step.SEARCH_CONTACT_PERSON) {
2230
+ U.value = Step.MANUAL_BUSINESS;
2231
+ return;
2232
+ }
2233
+ e === Step.MANUAL_CONTACT_PERSON && (U.value = Step.SEARCH_CONTACT_PERSON);
2234
+ }
2235
+ function Q() {
2236
+ q.setValue(null), J.setValue(null), Y.setValue(null), X.setValue(null), H.value = !1, U.value = Step.MANUAL_BUSINESS;
2237
+ }
2238
+ async function $(e) {
2239
+ if (e === null) return;
2240
+ U.value = Step.MANUAL_BUSINESS, H.value = !0;
2241
+ let k = e.uuid.replace(/\./g, "");
2242
+ if (q.setValue(e.name), e.address !== null) {
2243
+ let k = await B(e.address);
2244
+ J.setValue({
2245
+ ...e.address,
2246
+ coordinates: k ?? {
2247
+ lat: null,
2248
+ lng: null
2249
+ },
2250
+ country: CountryCode.BE
2251
+ });
2252
+ } else J.setValue(null);
2253
+ X.setValue({
2254
+ countryCode: CountryCode.BE,
2255
+ number: k
2256
+ }), Y.setValue(k);
2257
+ }
2258
+ return (e, A) => (openBlock(), createBlock(AppDialogContainer_default, { class: "gap-xl flex flex-1 flex-col overflow-hidden" }, {
2259
+ default: withCtx(() => [createVNode(AppColorProvider_default, { color: unref(L).getEntityConfig(unref(EntityType).BUSINESS)?.color ?? null }, {
2260
+ default: withCtx(() => [createVNode(AppDialogHeader_default, {
2261
+ title: W.value,
2262
+ description: G.value,
2263
+ icon: "user"
2264
+ }, {
2265
+ "closse-button": withCtx(() => [createVNode(unref(VcDialogCloseButton))]),
2266
+ _: 1
2267
+ }, 8, ["title", "description"])]),
2268
+ _: 1
2269
+ }, 8, ["color"]), createVNode(AppForm_default, {
2270
+ "can-exit-when-dirty": !0,
2271
+ form: unref(K),
2272
+ class: "flex flex-1 flex-col"
2273
+ }, {
2274
+ default: withCtx(() => [
2275
+ U.value === Step.SEARCH_BUSINESS ? (openBlock(), createBlock(ContactCreateDialogBusinessCbeSearch_default, {
2276
+ key: 0,
2277
+ onCreateNew: Q,
2278
+ onUpdateCbeSearchItem: $,
2279
+ onBack: A[0] ||= (e) => Z(Step.SEARCH_BUSINESS)
2280
+ })) : createCommentVNode("", !0),
2281
+ U.value === Step.MANUAL_BUSINESS ? (openBlock(), createBlock(ContactCreateDialogBusinessGeneralInfo_default, {
2282
+ key: 1,
2283
+ form: unref(K),
2284
+ "is-data-from-cbe": H.value,
2285
+ onBack: A[1] ||= (e) => Z(Step.MANUAL_BUSINESS),
2286
+ onNext: A[2] ||= (e) => U.value = Step.SEARCH_CONTACT_PERSON
2287
+ }, null, 8, ["form", "is-data-from-cbe"])) : createCommentVNode("", !0),
2288
+ U.value === Step.SEARCH_CONTACT_PERSON ? (openBlock(), createBlock(ContactCreateDialogBusinessContactPersonSearch_default, {
2289
+ key: 2,
2290
+ "is-submitting": unref(K).isSubmitting.value,
2291
+ "require-individual-on-create": unref(R).getConfig().businessConfig.requireIndividualOnCreate ?? !1,
2292
+ form: unref(K),
2293
+ onBack: A[3] ||= (e) => Z(Step.SEARCH_CONTACT_PERSON),
2294
+ onNext: A[4] ||= (e) => U.value = Step.MANUAL_CONTACT_PERSON
2295
+ }, null, 8, [
2296
+ "is-submitting",
2297
+ "require-individual-on-create",
2298
+ "form"
2299
+ ])) : createCommentVNode("", !0),
2300
+ U.value === Step.MANUAL_CONTACT_PERSON ? (openBlock(), createBlock(ContactCreateDialogBusinessContactPerson_default, {
2301
+ key: 3,
2302
+ form: unref(K),
2303
+ onBack: A[5] ||= (e) => Z(Step.MANUAL_CONTACT_PERSON)
2304
+ }, null, 8, ["form"])) : createCommentVNode("", !0)
2305
+ ]),
2306
+ _: 1
2307
+ }, 8, ["form"])]),
2308
+ _: 1
2309
+ }));
2310
+ }
2311
+ }), BusinessAddChildBusinessDialog_default = /* @__PURE__ */ defineComponent({
2312
+ __name: "BusinessAddChildBusinessDialog",
2313
+ props: { businessUuid: {} },
2314
+ emits: ["close"],
2315
+ setup(e, { emit: k }) {
2316
+ let A = e, j = k, M = useI18n(), N = useApiErrorToast(), F = ref(!1), I = ref(null), L = useBusinessCreateMutation(), R = useBusinessAddChildBusinessMutation();
2317
+ function B() {
2318
+ j("close");
2319
+ }
2320
+ async function V(e) {
2321
+ try {
2322
+ let k = await L.execute({ body: e });
2323
+ await R.execute({ params: {
2324
+ childUuid: k,
2325
+ parentUuid: A.businessUuid
2326
+ } }), j("close");
2327
+ } catch (e) {
2328
+ N.show(e);
2329
+ }
2330
+ }
2331
+ async function H(e) {
2332
+ try {
2333
+ await R.execute({ params: {
2334
+ childUuid: e,
2335
+ parentUuid: A.businessUuid
2336
+ } }), j("close");
2337
+ } catch (e) {
2338
+ N.show(e);
2339
+ }
2340
+ }
2341
+ function U() {
2342
+ F.value = !1;
2343
+ }
2344
+ function W() {
2345
+ F.value = !0;
2346
+ }
2347
+ return (e, k) => (openBlock(), createBlock(unref(VcDialog), {
2348
+ "class-config": { content: "max-w-xl w-full" },
2349
+ onClose: B
2350
+ }, {
2351
+ default: withCtx(() => [F.value ? (openBlock(), createBlock(ContactCreateDialogBusinessForm_default, {
2352
+ key: 0,
2353
+ "on-submit": V,
2354
+ onBack: U
2355
+ })) : (openBlock(), createBlock(AppDialogContainer_default, {
2356
+ key: 1,
2357
+ class: "gap-xl flex flex-1 flex-col"
2358
+ }, {
2359
+ default: withCtx(() => [createVNode(AppDialogHeader_default, {
2360
+ title: unref(M).t("wise_crm.info_dialog.add_business_child_dialog.title"),
2361
+ description: unref(M).t("wise_crm.info_dialog.add_business_child_dialog.description"),
2362
+ icon: "building"
2363
+ }, {
2364
+ "closse-button": withCtx(() => [createVNode(unref(VcDialogCloseButton))]),
2365
+ _: 1
2366
+ }, 8, ["title", "description"]), createVNode(BusinessAddExistingChildForm_default, {
2367
+ modelValue: I.value,
2368
+ "onUpdate:modelValue": k[0] ||= (e) => I.value = e,
2369
+ "parent-business-uuid": A.businessUuid,
2370
+ "on-submit": H,
2371
+ onCreateNew: W
2372
+ }, null, 8, ["modelValue", "parent-business-uuid"])]),
2373
+ _: 1
2374
+ }))]),
2375
+ _: 1
2376
+ }));
2377
+ }
2378
+ });
2379
+ function useBusinessLinkContactPersonMutation() {
2380
+ return ze({
2381
+ queryFn: async ({ body: e, params: k }) => await BusinessService.linkContactPerson(k.businessUuid, e.contactPersonUuid, e.position, e.contactInfo),
2382
+ queryKeysToInvalidate: {
2383
+ businessIndex: {},
2384
+ wiseCrmBusinessDetail: { businessUuid: (e) => e.businessUuid }
2385
+ }
2386
+ });
2387
+ }
2388
+ var BusinessContactPersonCreateDialog_default = /* @__PURE__ */ defineComponent({
2389
+ __name: "BusinessContactPersonCreateDialog",
2390
+ props: {
2391
+ businessUuid: {},
2392
+ isCreatingNewContactPerson: {
2393
+ type: Boolean,
2394
+ default: !1
2395
+ }
2396
+ },
2397
+ emits: ["close", "createNewContactPerson"],
2398
+ setup(e, { emit: k }) {
2399
+ let A = e, j = k, M = useI18n(), N = useApiErrorToast(), P = useBusinessLinkContactPersonMutation(), F = useContactPersonCreateMutation();
2400
+ async function I(e) {
2401
+ try {
2402
+ let k = await F.execute({ body: {
2403
+ email: e.email,
2404
+ firstName: e.firstName,
2405
+ lastName: e.lastName,
2406
+ mobilePhone: e.mobilePhone,
2407
+ phone: e.phone
2408
+ } });
2409
+ A.isCreatingNewContactPerson || await P.execute({
2410
+ body: {
2411
+ contactPersonUuid: k,
2412
+ contactInfo: {
2413
+ email: e.email,
2414
+ mobilePhone: e.mobilePhone,
2415
+ phone: e.phone
2416
+ },
2417
+ position: e.position
2418
+ },
2419
+ params: { businessUuid: A.businessUuid }
2420
+ }), R({
2421
+ label: `${e.firstName} ${e.lastName}`,
2422
+ value: k
2423
+ });
2424
+ } catch (e) {
2425
+ N.show(e);
2426
+ }
2427
+ }
2428
+ async function L(e, k, j) {
2429
+ if (e !== null) try {
2430
+ await P.execute({
2431
+ body: {
2432
+ contactPersonUuid: e,
2433
+ contactInfo: k,
2434
+ position: j
2435
+ },
2436
+ params: { businessUuid: A.businessUuid }
2437
+ }), R();
2438
+ } catch (e) {
2439
+ N.show(e);
2440
+ }
2441
+ }
2442
+ function R(e) {
2443
+ if (e === void 0) {
2444
+ j("close");
2445
+ return;
2446
+ }
2447
+ j("createNewContactPerson", e), j("close");
2448
+ }
2449
+ return (e, k) => (openBlock(), createBlock(AppDialog_default, {
2450
+ title: unref(M).t("wise_crm.info_dialog.contact_person_create.title"),
2451
+ description: unref(M).t("wise_crm.info_dialog.contact_person_create.description"),
2452
+ onClose: R
2453
+ }, {
2454
+ default: withCtx(() => [createVNode(ContactPersonCreateForm_default, {
2455
+ "on-submit": I,
2456
+ "on-link-contact-person": L,
2457
+ onClose: R
2458
+ })]),
2459
+ _: 1
2460
+ }, 8, ["title", "description"]));
2461
+ }
2462
+ });
2463
+ function useBusinessContactPersonUpdateMutation() {
2464
+ return ze({
2465
+ queryFn: async ({ body: e, params: k }) => await BusinessService.updateContactPerson(k.businessUuid, k.contactPersonUuid, e),
2466
+ queryKeysToInvalidate: {
2467
+ businessIndex: {},
2468
+ contactPersonDetail: { contactPersonUuid: (e) => e.contactPersonUuid },
2469
+ wiseCrmBusinessDetail: { businessUuid: (e) => e.businessUuid }
2470
+ }
2471
+ });
2472
+ }
2473
+ function useBusinessContactPersonDetailQuery(e, k) {
2474
+ return He({
2475
+ isEnabled: computed(() => e.value !== null && k.value !== null),
2476
+ queryFn: () => {
2477
+ if (e.value === null) throw Error("Individual UUID is null");
2478
+ if (k.value === null) throw Error("Contact Person UUID is null");
2479
+ return BusinessService.getContactPerson(e.value, k.value);
2480
+ },
2481
+ queryKey: { contactPersonDetail: { contactPersonUuid: k } }
2482
+ });
2483
+ }
2484
+ var BusinessContactPersonUpdateForm_default = /* @__PURE__ */ defineComponent({
2485
+ __name: "BusinessContactPersonUpdateForm",
2486
+ props: {
2487
+ contactPerson: {},
2488
+ onSubmit: { type: Function }
2489
+ },
2490
+ setup(e) {
2491
+ let k = e, A = useI18n(), j = useForm({
2492
+ initialState: {
2493
+ email: k.contactPerson.email,
2494
+ firstName: k.contactPerson.firstName,
2495
+ lastName: k.contactPerson.lastName,
2496
+ mobilePhone: k.contactPerson.mobilePhone,
2497
+ phone: k.contactPerson.phone,
2498
+ position: k.contactPerson.position
2499
+ },
2500
+ schema: contactPersonUpdateFormSchema,
2501
+ onSubmit: async (e) => {
2502
+ await k.onSubmit(e);
2503
+ }
2504
+ });
2505
+ return (e, k) => (openBlock(), createBlock(ContactPersonCreateNewForm_default, { form: unref(j) }, {
2506
+ actions: withCtx(() => [createVNode(AppSidebarFormFooter_default, null, {
2507
+ default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
2508
+ "is-loading": unref(j).isSubmitting.value,
2509
+ label: unref(A).t("wise_crm.shared.save_changes")
2510
+ }, null, 8, ["is-loading", "label"])]),
2511
+ _: 1
2512
+ })]),
2513
+ _: 1
2514
+ }, 8, ["form"]));
2515
+ }
2516
+ }), BusinessContactPersonUpdateDialog_default = /* @__PURE__ */ defineComponent({
2517
+ __name: "BusinessContactPersonUpdateDialog",
2518
+ props: {
2519
+ businessUuid: {},
2520
+ contactPersonUuid: {}
2521
+ },
2522
+ emits: ["close"],
2523
+ setup(e, { emit: k }) {
2524
+ let A = e, j = k, M = useI18n(), N = useApiErrorToast(), P = useBusinessContactPersonUpdateMutation(), F = useBusinessContactPersonDetailQuery(computed(() => A.businessUuid), computed(() => A.contactPersonUuid));
2525
+ async function I(e) {
2526
+ try {
2527
+ await P.execute({
2528
+ body: e,
2529
+ params: {
2530
+ businessUuid: A.businessUuid,
2531
+ contactPersonUuid: A.contactPersonUuid
2532
+ }
2533
+ }), j("close");
2534
+ } catch (e) {
2535
+ N.show(e);
2536
+ }
2537
+ }
2538
+ function L() {
2539
+ j("close");
2540
+ }
2541
+ return (e, k) => (openBlock(), createBlock(AppDialog_default, {
2542
+ title: unref(M).t("wise_crm.info_dialog.contact_person_update.title"),
2543
+ description: unref(M).t("wise_crm.info_dialog.contact_person_create.description"),
2544
+ onClose: L
2545
+ }, {
2546
+ default: withCtx(() => [unref(F).data.value ? (openBlock(), createBlock(BusinessContactPersonUpdateForm_default, {
2547
+ key: 0,
2548
+ "business-uuid": A.businessUuid,
2549
+ "on-submit": I,
2550
+ "contact-person": unref(F).data.value,
2551
+ onClose: L
2552
+ }, null, 8, ["business-uuid", "contact-person"])) : createCommentVNode("", !0)]),
2553
+ _: 1
2554
+ }, 8, ["title", "description"]));
2555
+ }
2556
+ }), _hoisted_1$1 = { class: "gap-md flex items-start" }, _hoisted_2$1 = { class: "flex-1" }, _hoisted_3$1 = {
2557
+ key: 0,
2558
+ class: "mt-xxs"
2559
+ }, _hoisted_4 = { class: "text-secondary flex flex-1 items-center justify-between" }, _hoisted_5 = { class: "gap-sm flex items-center" }, _hoisted_6 = { class: "font-semibold" }, _hoisted_7 = { class: "gap-md p-md flex w-full flex-col" }, BusinessDetailSidebarAccordionBusinessInfoChildren_default = /* @__PURE__ */ defineComponent({
2560
+ __name: "BusinessDetailSidebarAccordionBusinessInfoChildren",
2561
+ props: { business: {} },
2562
+ emits: ["addChild"],
2563
+ setup(e, { emit: k }) {
2564
+ let A = e, j = k, N = useI18n(), P = useEntityDetail(), F = computed(() => A.business.children), I = computed(() => F.value.length > 1 ? N.t("wise_crm.shared.departments_amount", { value: F.value.length }) : F.value[0]?.name ?? "");
2565
+ function L() {
2566
+ j("addChild");
2567
+ }
2568
+ function R(e) {
2569
+ P.open(EntityType.BUSINESS, e);
2570
+ }
2571
+ return (e, k) => (openBlock(), createElementBlock("div", _hoisted_1$1, [createVNode(unref(VcIcon), {
2572
+ icon: "layersTree",
2573
+ class: "mt-xs size-4 shrink-0"
2574
+ }), createElementVNode("div", _hoisted_2$1, [
2575
+ A.business.parent === null ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_3$1, [createVNode(AppOpenEntityButton_default, {
2576
+ "class-config": { root: "bg-transparent w-min border-none text-primary shadow-none h-auto hover:underline p-0 font-regular" },
2577
+ "entity-type": unref(EntityType).BUSINESS,
2578
+ uuid: A.business.parent.uuid
2579
+ }, {
2580
+ default: withCtx(() => [createTextVNode(toDisplayString(A.business.parent.name), 1)]),
2581
+ _: 1
2582
+ }, 8, ["entity-type", "uuid"])])),
2583
+ createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [A.business.parent === null ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(VcIcon), {
2584
+ key: 0,
2585
+ icon: "timeLineMarker",
2586
+ class: "text-brand-500 size-4"
2587
+ })), createElementVNode("p", _hoisted_6, toDisplayString(A.business.name), 1)]), createVNode(unref(VcIconButton), {
2588
+ "class-config": {
2589
+ root: "bg-transparent border-none h-auto w-auto p-xs shadow-none rounded-sm data-[loading=false]:not-disabled:hover:bg-secondary/50 duration-300",
2590
+ icon: "text-quaternary size-4"
2591
+ },
2592
+ label: unref(N).t("wise_crm.info_dialog.sidebar.business.add_icon"),
2593
+ icon: "plus",
2594
+ onClick: L
2595
+ }, null, 8, ["label"])]),
2596
+ F.value.length > 0 ? (openBlock(), createElementBlock("div", {
2597
+ key: 1,
2598
+ class: normalizeClass([{ "ml-2xl": A.business.parent !== null }, "gap-sm flex items-center"])
2599
+ }, [createVNode(unref(VcIcon), {
2600
+ icon: "timeLineMarker",
2601
+ class: "text-brand-500 size-4"
2602
+ }), createVNode(unref(VcPopover), {
2603
+ "is-popover-arrow-hidden": !0,
2604
+ "class-config": { content: "w-100" },
2605
+ "popover-align": "start",
2606
+ "popover-side": "right"
2607
+ }, {
2608
+ trigger: withCtx(() => [createVNode(unref(VcButton), {
2609
+ "class-config": { root: "bg-transparent text-primary text-sm border-none p-0 h-auto rounded-none shadow-none font-normal" },
2610
+ variant: "secondary",
2611
+ class: "underline"
2612
+ }, {
2613
+ default: withCtx(() => [createTextVNode(toDisplayString(I.value), 1)]),
2614
+ _: 1
2615
+ })]),
2616
+ content: withCtx(() => [createElementVNode("div", _hoisted_7, [createVNode(CrmDetailAccordionRoot_default, {
2617
+ "default-values": F.value[0]?.uuid ?? "",
2618
+ type: "single"
2619
+ }, {
2620
+ default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(F.value, (e) => (openBlock(), createBlock(CrmDetailSidebarAccordionItem_default, {
2621
+ key: e.uuid,
2622
+ label: e.name,
2623
+ value: e.uuid,
2624
+ icon: "building"
2625
+ }, {
2626
+ actions: withCtx(() => [createVNode(unref(VcIconButton), {
2627
+ "class-config": {
2628
+ root: "bg-transparent border-none h-auto w-auto p-xs shadow-none rounded-sm data-[loading=false]:not-disabled:hover:bg-secondary/50 duration-300",
2629
+ icon: "text-quaternary size-4"
2630
+ },
2631
+ label: unref(N).t("wise_crm.info_dialog.sidebar.business.add_icon"),
2632
+ icon: "linkExternal",
2633
+ onClick: (k) => R(e.uuid)
2634
+ }, null, 8, ["label", "onClick"])]),
2635
+ default: withCtx(() => [createVNode(CrmDetailSidebarCard_default, { class: "gap-md flex flex-col" }, {
2636
+ default: withCtx(() => [
2637
+ createVNode(AppIconLabelPair_default, {
2638
+ label: e.vatNumber ?? "-",
2639
+ icon: "buildings"
2640
+ }, null, 8, ["label"]),
2641
+ createVNode(AppIconLabelPair_default, {
2642
+ label: e.email ?? "-",
2643
+ icon: "mail"
2644
+ }, null, 8, ["label"]),
2645
+ createVNode(AppIconLabelPair_default, {
2646
+ label: e.mobilePhone ?? e.phone ?? "-",
2647
+ icon: "phone"
2648
+ }, null, 8, ["label"]),
2649
+ createVNode(AppIconLabelPair_default, {
2650
+ label: e.address ? unref(AddressUtil).formatShort(e.address) : "-",
2651
+ icon: "locationPin"
2652
+ }, null, 8, ["label"])
2653
+ ]),
2654
+ _: 2
2655
+ }, 1024)]),
2656
+ _: 2
2657
+ }, 1032, ["label", "value"]))), 128))]),
2658
+ _: 1
2659
+ }, 8, ["default-values"])])]),
2660
+ _: 1
2661
+ })], 2)) : createCommentVNode("", !0)
2662
+ ])]));
2663
+ }
2664
+ }), VatNumberUtil = class {
2665
+ static format(e) {
2666
+ return e === null ? "" : `${e.countryCode}${e.number}`;
2667
+ }
2668
+ }, _hoisted_1 = { class: "gap-md flex flex-col" }, _hoisted_2 = { class: "gap-sm border-secondary pb-sm flex flex-col border-b" }, _hoisted_3 = { class: "pt-lg" }, BusinessDetailSidebarAccordionBusinessInfo_default = /* @__PURE__ */ defineComponent({
2669
+ __name: "BusinessDetailSidebarAccordionBusinessInfo",
2670
+ props: { business: {} },
2671
+ emits: ["addChild"],
2672
+ setup(e, { emit: k }) {
2673
+ let A = e, j = k, M = useI18n();
2674
+ function N() {
2675
+ j("addChild");
2676
+ }
2677
+ return (k, j) => (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(CrmDetailSidebarCard_default, null, {
2678
+ default: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(AppIconLabelPair_default, {
2679
+ label: A.business.vatNumber ? unref(VatNumberUtil).format(A.business.vatNumber) : "-",
2680
+ icon: "buildings"
2681
+ }, null, 8, ["label"]), createVNode(BusinessDetailSidebarAccordionBusinessInfoChildren_default, {
2682
+ business: e.business,
2683
+ onAddChild: N
2684
+ }, null, 8, ["business"])]), createElementVNode("div", _hoisted_3, [createVNode(AppIconLabelPair_default, {
2685
+ label: unref(M).t("wise_crm.info_dialog.sidebar.overview.created_at_label", { value: A.business.createdAt ? unref(useDateTimeFormat)().toDateTime(A.business.createdAt) : "-" }),
2686
+ icon: "clockPlus"
2687
+ }, null, 8, ["label"])])]),
2688
+ _: 1
2689
+ }), createVNode(CrmDetailSidebarMapCard_default, { address: A.business.address }, null, 8, ["address"])]));
2690
+ }
2691
+ }), BusinessDetailSidebarOverviewContent_default = /* @__PURE__ */ defineComponent({
2692
+ __name: "BusinessDetailSidebarOverviewContent",
2693
+ props: { business: {} },
2694
+ setup(e) {
2695
+ let k = e, A = useI18n(), j = useApiErrorToast(), M = useDialog(AppConfirmDialog_default), N = useBusinessPrimaryContactPersonUpdateMutation(), P = useBusinessUnlinkContactPersonMutation(), F = useDialog(BusinessContactPersonCreateDialog_default), I = useDialog(BusinessContactPersonUpdateDialog_default), L = useDialog(BusinessAddChildBusinessDialog_default), R = computed(() => k.business.contactPersons.length > 0);
2696
+ function B() {
2697
+ F.open({ businessUuid: k.business.uuid });
2698
+ }
2699
+ function V(e) {
2700
+ I.open({
2701
+ businessUuid: k.business.uuid,
2702
+ contactPersonUuid: e
2703
+ });
2704
+ }
2705
+ function H(e) {
2706
+ M.open({
2707
+ title: A.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_title"),
2708
+ isDestructive: !0,
2709
+ isLoading: P.isLoading.value,
2710
+ confirmText: A.t("shared.delete"),
2711
+ description: A.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_description"),
2712
+ onConfirm: async () => {
2713
+ try {
2714
+ await P.execute({
2715
+ body: { contactPersonUuid: e },
2716
+ params: { businessUuid: k.business.uuid }
2717
+ });
2718
+ } catch (e) {
2719
+ j.show(e);
2720
+ } finally {
2721
+ M.close();
2722
+ }
2723
+ }
2724
+ });
2725
+ }
2726
+ function U(e) {
2727
+ N.execute({ params: {
2728
+ businessUuid: k.business.uuid,
2729
+ contactPersonUuid: e
2730
+ } });
2731
+ }
2732
+ function W() {
2733
+ L.open({ businessUuid: k.business.uuid });
2734
+ }
2735
+ return (j, M) => (openBlock(), createBlock(CrmDetailAccordionRoot_default, { "default-values": [
2736
+ "business",
2737
+ "invoice",
2738
+ "contact-persons"
2739
+ ] }, {
2740
+ default: withCtx(() => [
2741
+ createVNode(CrmDetailSidebarAccordionItem_default, {
2742
+ label: unref(A).t("wise_crm.info_dialog.sidebar.overview.business_info"),
2743
+ value: "business",
2744
+ icon: "infoCircle"
2745
+ }, {
2746
+ default: withCtx(() => [createVNode(BusinessDetailSidebarAccordionBusinessInfo_default, {
2747
+ business: e.business,
2748
+ onAddChild: W
2749
+ }, null, 8, ["business"])]),
2750
+ _: 1
2751
+ }, 8, ["label"]),
2752
+ createVNode(CrmDetailSidebarAccordionItem_default, {
2753
+ "is-empty": k.business.billingInformation === null,
2754
+ label: unref(A).t("wise_crm.info_dialog.sidebar.overview.invoice_label"),
2755
+ value: "invoice",
2756
+ icon: "wallet"
2757
+ }, {
2758
+ default: withCtx(() => [k.business.billingInformation ? (openBlock(), createBlock(CrmDetailSidebarAccordionBillingInformation_default, {
2759
+ key: 0,
2760
+ "invoice-address": k.business.billingInformation?.location?.address ?? null,
2761
+ "invoice-email": k.business.billingInformation?.invoiceEmail
2762
+ }, null, 8, ["invoice-address", "invoice-email"])) : createCommentVNode("", !0)]),
2763
+ _: 1
2764
+ }, 8, ["is-empty", "label"]),
2765
+ createVNode(CrmDetailSidebarAccordionItem_default, {
2766
+ "is-empty": !R.value,
2767
+ label: unref(A).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
2768
+ value: "contact-persons",
2769
+ icon: "userCircle",
2770
+ onAdd: B
2771
+ }, {
2772
+ actions: withCtx(() => [R.value ? createCommentVNode("", !0) : (openBlock(), createBlock(CrmDetailSidebarAccordionHeaderIconButton_default, {
2773
+ key: 0,
2774
+ label: unref(A).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
2775
+ class: "z-1",
2776
+ icon: "plus",
2777
+ onClick: B
2778
+ }, null, 8, ["label"]))]),
2779
+ default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(k.business.contactPersons, (e) => (openBlock(), createBlock(unref(Motion), {
2780
+ key: e.uuid,
2781
+ "layout-id": e.uuid
2782
+ }, {
2783
+ default: withCtx(() => [createVNode(CrmDetailSidebarAccordionContactPersonInfo_default, {
2784
+ "contact-person": e,
2785
+ "on-toggle-is-primary": () => U(e.uuid),
2786
+ onUpdate: (k) => V(e.uuid),
2787
+ onDelete: (k) => H(e.uuid)
2788
+ }, null, 8, [
2789
+ "contact-person",
2790
+ "on-toggle-is-primary",
2791
+ "onUpdate",
2792
+ "onDelete"
2793
+ ])]),
2794
+ _: 2
2795
+ }, 1032, ["layout-id"]))), 128)), R.value ? (openBlock(), createBlock(unref(VcButton), {
2796
+ key: 0,
2797
+ variant: "tertiary",
2798
+ size: "sm",
2799
+ "icon-left": "plus",
2800
+ onClick: B
2801
+ }, {
2802
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(A).t("wise_crm.shared.add")), 1)]),
2803
+ _: 1
2804
+ })) : createCommentVNode("", !0)]),
2805
+ _: 1
2806
+ }, 8, ["is-empty", "label"])
2807
+ ]),
2808
+ _: 1
2809
+ }));
2810
+ }
2811
+ }), InfoTab = /* @__PURE__ */ function(e) {
2812
+ return e.ACTIVITY = "activity", e.NOTES = "notes", e.OVERVIEW = "overview", e;
2813
+ }(InfoTab || {}), BusinessDetailSidebar_default = /* @__PURE__ */ defineComponent({
2814
+ __name: "BusinessDetailSidebar",
2815
+ props: { business: {} },
2816
+ setup(e) {
2817
+ let A = e, j = useI18n(), M = useCrm(), N = computed(() => M.getEntityConfig(EntityType.BUSINESS)), P = ref(InfoTab.OVERVIEW), F = computed(() => [
2818
+ {
2819
+ icon: "infoCircle",
2820
+ label: j.t("wise_crm.shared.overview"),
2821
+ value: InfoTab.OVERVIEW
2822
+ },
2823
+ {
2824
+ icon: "activity",
2825
+ label: j.t("wise_crm.shared.activity"),
2826
+ value: InfoTab.ACTIVITY
2827
+ },
2828
+ {
2829
+ icon: "book",
2830
+ label: j.t("wise_crm.shared.notes"),
2831
+ value: InfoTab.NOTES
2832
+ }
2833
+ ]);
2834
+ return (e, j) => (openBlock(), createBlock(AppColorProvider_default, {
2835
+ color: unref(M).getEntityConfig(unref(EntityType).BUSINESS)?.color ?? null,
2836
+ class: "flex h-full flex-col"
2837
+ }, {
2838
+ default: withCtx(() => [createVNode(CrmDetailHeaderCard_default, {
2839
+ "entity-type": unref(EntityType).BUSINESS,
2840
+ name: A.business.name,
2841
+ address: A.business.address,
2842
+ email: A.business.email,
2843
+ "mobile-phone": A.business.mobilePhone,
2844
+ "entity-name": N.value?.name ?? null,
2845
+ phone: A.business.phone
2846
+ }, null, 8, [
2847
+ "entity-type",
2848
+ "name",
2849
+ "address",
2850
+ "email",
2851
+ "mobile-phone",
2852
+ "entity-name",
2853
+ "phone"
2854
+ ]), createVNode(CrmDetailSidebarTabs_default, {
2855
+ modelValue: P.value,
2856
+ "onUpdate:modelValue": j[0] ||= (e) => P.value = e,
2857
+ tabs: F.value
2858
+ }, {
2859
+ default: withCtx(() => [
2860
+ P.value === InfoTab.OVERVIEW ? (openBlock(), createBlock(BusinessDetailSidebarOverviewContent_default, {
2861
+ key: 0,
2862
+ business: A.business
2863
+ }, null, 8, ["business"])) : createCommentVNode("", !0),
2864
+ P.value === InfoTab.ACTIVITY ? (openBlock(), createBlock(BusinessDetailSidebarActivityContent_default, {
2865
+ key: 1,
2866
+ business: A.business
2867
+ }, null, 8, ["business"])) : createCommentVNode("", !0),
2868
+ P.value === InfoTab.NOTES ? (openBlock(), createBlock(BusinessDetailSidebarNotesContent_default, {
2869
+ key: 2,
2870
+ business: A.business
2871
+ }, null, 8, ["business"])) : createCommentVNode("", !0)
2872
+ ]),
2873
+ _: 1
2874
+ }, 8, ["modelValue", "tabs"])]),
2875
+ _: 1
2876
+ }, 8, ["color"]));
2877
+ }
2878
+ }), BusinessDetailSidebarProvider_default = /* @__PURE__ */ defineComponent({
2879
+ __name: "BusinessDetailSidebarProvider",
2880
+ props: { businessUuid: {} },
2881
+ setup(e) {
2882
+ let k = e, A = useI18n(), j = useBusinessDetailQuery(computed(() => k.businessUuid)), M = computed(() => j.data.value ?? null);
2883
+ return (e, k) => (openBlock(), createBlock(CrmDetailContainer_default, null, {
2884
+ default: withCtx(() => [unref(j).isError.value ? (openBlock(), createBlock(Error_default, {
2885
+ key: 0,
2886
+ message: unref(A).t("error.business_details.description"),
2887
+ title: unref(A).t("error.business_details.title")
2888
+ }, null, 8, ["message", "title"])) : unref(j).isLoading.value ? (openBlock(), createBlock(AppSkeletonLoader_default, {
2889
+ key: 1,
2890
+ class: "h-full"
2891
+ })) : M.value ? (openBlock(), createBlock(BusinessDetailSidebar_default, {
2892
+ key: 2,
2893
+ business: M.value
2894
+ }, null, 8, ["business"])) : createCommentVNode("", !0)]),
2895
+ _: 1
2896
+ }));
2897
+ }
2898
+ });
2899
+ export { vatNumberSchema as a, AppVatNumberField_default as c, useBusinessCreateMutation as d, useBusinessDetailQuery as f, CustomFieldDefinitionUtil as i, FormFieldset_default as l, businessUuidSchema as m, VatNumberUtil as n, addressFormSchema as o, BusinessService as p, ContactCreateDialogBusinessForm_default as r, CustomFieldDefinitionForm_default as s, BusinessDetailSidebarProvider_default as t, useBusinessIndexQuery as u };