@wisemen/wise-crm-web 0.2.5 → 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 (37) 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/testing.js +1 -1
  36. package/package.json +2 -1
  37. package/dist/BusinessDetailSidebarProvider-CXG99iHk.js +0 -2077
@@ -1,2077 +0,0 @@
1
- import { $ as NoteService, B as toFormField, D as useCrmConfig, E as useEntityDetail, F as AppAndOrSeparator_default, G as AppDialogActions_default, H as i18nPlugin, I as useOffsetInfiniteQuery, J as useApiErrorToast, L as NoteUpdateDialog_default, N as AppSidebarFormSubmitButton_default, O as useGoogleMapsApiKey, P as AppSidebarFormFooter_default, Q as useNoteDeleteMutation, R as AppDialogHeader_default, S as EntityAutocomplete_default, T as useCrm, U as AppConfirmDialog_default, V as AppForm_default, W as AppDialogContainer_default, Z as useKeysetInfiniteQuery, _ as IndividualAutocomplete_default, a as AppOpenEntityButton_default, at as AddressTransformer, c as CrmDetailAccordionRoot_default, ct as individualUuidSchema, g as phoneNumberFormSchema, h as useContactPersonCreateMutation, i as CrmDetailSidebarAccordionHeaderIconButton_default, it as StringUtil, j as useSearch, k as AppColorProvider_default, l as AppIconLabelPair_default, m as AppDialog_default, n as CrmDetailContainer_default, nt as AppGrid_default, o as CrmDetailSidebarCard_default, ot as ActivityIndexPaginationTransformer, r as CrmDetailSidebarTabs_default, rt as ContactPersonUpdateTransformer, s as CrmDetailSidebarAccordionItem_default, st as ActivityIndexTransformer, t as Error_default, x as AppGlobalFormError_default, y as IndividualService, z as CrmDetailSidebarNotesView_default } from "./Error-CX6APxDX.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-Jo2OteBb.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 { E as updateBusinessV1, F as viewBusinessActivityLogIndexV1, I as viewBusinessBillingInformationDetailV1, L as viewBusinessContactPersonDetailV1, N as upsertBusinessBillingInformationV1, R as viewBusinessDetailV1, S as unlinkContactPersonFromBusinessV1, T as updateBusinessContactPersonV1, V as viewBusinessStatisticsV1, d as linkContactPersonToBusinessV1, ft as CountryCode, g as makeBusinessContactPersonPrimaryV1, ht as EntityType, n as createBusinessV1, u as linkBusinessAsChildV1, y as searchCbeEnterprisesV1, z as viewBusinessIndexV1 } from "./client-CpsHjr8V.js";
5
- import z$1, { z } from "zod";
6
- 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";
7
- import { useI18n } from "vue-i18n";
8
- 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";
9
- import { useDebounceFn } from "@vueuse/core";
10
- import { useMutation, useQueryClient } from "@tanstack/vue-query";
11
- import { useForm } from "formango";
12
- import { Motion } from "motion-v";
13
- import { VisuallyHidden } from "reka-ui";
14
- const businessUuidSchema = z.string().uuid().brand("BusinessUuid");
15
- var BusinessBillingInformationTransformer = class {
16
- static fromDto(n) {
17
- return {
18
- uuid: n.uuid,
19
- billingLocation: n.billingLocation ? {
20
- uuid: n.billingLocation.uuid,
21
- createdAt: ZonedDateTimeTransformer.fromDto(n.billingLocation.createdAt),
22
- updatedAt: ZonedDateTimeTransformer.fromDto(n.billingLocation.updatedAt),
23
- address: AddressTransformer.fromDto(n.billingLocation.address)
24
- } : null,
25
- invoiceCcEmails: n.invoiceCcEmails,
26
- invoiceEmail: n.invoiceEmail,
27
- purchaseNoteCcEmails: n.purchaseNoteCcEmails,
28
- purchaseNoteEmail: n.purchaseNoteEmail,
29
- reminderCcEmails: n.reminderCcEmails,
30
- reminderEmail: n.reminderEmail
31
- };
32
- }
33
- static fromNullableDto(n) {
34
- return n === null ? null : this.fromDto(n);
35
- }
36
- }, BusinessBillingInformationUpdateTransformer = class {
37
- static toDto(n) {
38
- return {
39
- billingAddress: n.billingAddress ? AddressTransformer.toDto(n.billingAddress) : null,
40
- invoiceCcEmails: n.invoiceCcEmails ?? [],
41
- invoiceEmail: n.invoiceEmail,
42
- purchaseNoteCcEmails: n.purchaseNoteCcEmails ?? n.invoiceCcEmails ?? [],
43
- purchaseNoteEmail: n.purchaseNoteEmail ?? n.invoiceEmail,
44
- reminderCcEmails: n.reminderCcEmails ?? n.invoiceCcEmails ?? [],
45
- reminderEmail: n.reminderEmail ?? n.invoiceEmail
46
- };
47
- }
48
- }, BusinessContactPersonTransformer = class {
49
- static fromDto(n) {
50
- return {
51
- businessUuid: n.businessUuid,
52
- contactPersonUuid: n.contactPersonUuid,
53
- isPrimary: n.isPrimary,
54
- email: n.email,
55
- firstName: n.firstName,
56
- lastName: n.lastName,
57
- mobilePhone: n.mobilePhone,
58
- phone: n.phone,
59
- position: n.position
60
- };
61
- }
62
- }, VatNumberTransformer = class {
63
- static fromDto(n) {
64
- return {
65
- countryCode: n.countryCode,
66
- number: n.number
67
- };
68
- }
69
- static fromNullableDto(n) {
70
- return n === null ? null : this.fromDto(n);
71
- }
72
- static toDto(n) {
73
- return n === null ? null : {
74
- countryCode: n.countryCode,
75
- number: n.number
76
- };
77
- }
78
- static toNullableDto(n) {
79
- return n === null ? null : this.toDto(n);
80
- }
81
- }, BusinessCreateTransformer = class {
82
- static toDto(n) {
83
- return {
84
- childUuid: n.childUuid,
85
- individualUuid: n.individualUuid,
86
- parentUuid: n.parentUuid,
87
- name: n.name,
88
- address: AddressTransformer.toDto(n.address),
89
- companyNumber: n.companyNumber,
90
- customFields: n.customFields,
91
- individual: n.individual ? {
92
- email: n.individual.email,
93
- firstName: n.individual.firstName,
94
- lastName: n.individual.lastName,
95
- mobilePhone: n.individual.mobilePhone,
96
- phone: n.individual.phone
97
- } : null,
98
- individualPosition: null,
99
- vatNumber: VatNumberTransformer.toNullableDto(n.vatNumber)
100
- };
101
- }
102
- }, BusinessNodeTransformer = class {
103
- static fromDto(n) {
104
- return {
105
- uuid: n.uuid,
106
- createdAt: ZonedDateTimeTransformer.fromDto(n.createdAt),
107
- name: n.name,
108
- address: AddressTransformer.fromNullableDto(n.location?.address ?? null),
109
- companyNumber: n.companyNumber,
110
- email: n.email,
111
- mobilePhone: n.mobilePhone,
112
- phone: n.phone,
113
- vatNumber: n.vatNumber?.number ?? null
114
- };
115
- }
116
- }, BusinessDetailTransformer = class {
117
- static fromDto(n) {
118
- return {
119
- uuid: n.uuid,
120
- createdAt: ZonedDateTimeTransformer.fromDto(n.createdAt),
121
- updatedAt: ZonedDateTimeTransformer.fromDto(n.updatedAt),
122
- name: n.name,
123
- address: AddressTransformer.fromNullableDto(n.location?.address ?? null),
124
- billingInformation: n.billingInformation === null ? null : {
125
- uuid: n.billingInformation.uuid,
126
- invoiceCcEmails: n.billingInformation.invoiceCcEmails ?? [],
127
- invoiceEmail: n.billingInformation.invoiceEmail ?? "",
128
- location: n.billingInformation.location ? {
129
- uuid: n.billingInformation.location.uuid,
130
- createdAt: ZonedDateTimeTransformer.fromDto(n.billingInformation.location.createdAt),
131
- updatedAt: ZonedDateTimeTransformer.fromDto(n.billingInformation.location.updatedAt),
132
- address: AddressTransformer.fromDto(n.billingInformation.location.address)
133
- } : null,
134
- purchaseNoteCcEmails: n.billingInformation.purchaseNoteCcEmails ?? [],
135
- purchaseNoteEmail: n.billingInformation.purchaseNoteEmail ?? "",
136
- reminderCcEmails: n.billingInformation.reminderCcEmails ?? [],
137
- reminderEmail: n.billingInformation.reminderEmail ?? ""
138
- },
139
- companyNumber: n.companyNumber,
140
- contactPersons: n.contactPersons.map((n) => ({
141
- uuid: n.uuid,
142
- isPrimary: n.isPrimary,
143
- email: n.email,
144
- firstName: n.firstName,
145
- lastName: n.lastName,
146
- mobilePhone: n.mobilePhone,
147
- phone: n.phone,
148
- position: n.position
149
- })),
150
- customFields: n.customFields,
151
- email: n.email,
152
- language: n.language,
153
- location: n.location === null ? null : {
154
- uuid: n.location.uuid,
155
- createdAt: ZonedDateTimeTransformer.fromDto(n.location.createdAt),
156
- updatedAt: ZonedDateTimeTransformer.fromDto(n.location.updatedAt),
157
- address: AddressTransformer.fromDto(n.location.address)
158
- },
159
- mobilePhone: n.mobilePhone,
160
- parent: n.parent ? BusinessNodeTransformer.fromDto(n.parent) : null,
161
- phone: n.phone,
162
- vatNumber: VatNumberTransformer.fromNullableDto(n.vatNumber),
163
- children: n.children.map(BusinessNodeTransformer.fromDto)
164
- };
165
- }
166
- }, BusinessIndexTransformer = class {
167
- static fromDto(n) {
168
- return {
169
- uuid: n.uuid,
170
- name: n.name,
171
- companyNumber: n.companyNumber,
172
- email: n.email,
173
- mobilePhone: n.mobilePhone,
174
- phone: n.phone,
175
- vatNumber: VatNumberTransformer.fromNullableDto(n.vatNumber)
176
- };
177
- }
178
- }, businessIndexQueryParamsTransformer = class {
179
- static toDto(n) {
180
- return {
181
- pagination: n.pagination,
182
- search: n.search?.trim() || void 0
183
- };
184
- }
185
- }, BusinessStatisticsTransformer = class {
186
- static fromDto(n) {
187
- return {
188
- monthlyAdded: n.monthlyAdded,
189
- monthlyPercentageGrowth: n.monthlyPercentageGrowth,
190
- total: n.total
191
- };
192
- }
193
- }, BusinessUpdateTransformer = class {
194
- static toDto(n) {
195
- return {
196
- name: n.name,
197
- address: AddressTransformer.toDto(n.address),
198
- companyNumber: n.companyNumber,
199
- customFields: n.customFields,
200
- email: n.email,
201
- language: n.language,
202
- mobilePhone: n.mobilePhone,
203
- phone: n.phone,
204
- vatNumber: VatNumberTransformer.toNullableDto(n.vatNumber)
205
- };
206
- }
207
- }, BusinessService = class {
208
- static async addChildBusiness(n, A) {
209
- await linkBusinessAsChildV1({ path: {
210
- businessUuid: n,
211
- childUuid: A
212
- } });
213
- }
214
- static async create(n) {
215
- return (await createBusinessV1({ body: BusinessCreateTransformer.toDto(n) })).data.uuid;
216
- }
217
- static async findByName(n) {
218
- let A = await viewBusinessIndexV1({ query: new PaginationParamsBuilder().withSearch(n).build() });
219
- return {
220
- data: A.data.items.map(BusinessIndexTransformer.fromDto),
221
- meta: A.data.meta
222
- };
223
- }
224
- static async getActivity(n, A) {
225
- let j = await viewBusinessActivityLogIndexV1({
226
- query: new PaginationParamsBuilder(A).buildKeyset(ActivityIndexPaginationTransformer.toDto),
227
- responseValidator: void 0,
228
- path: { businessUuid: n }
229
- });
230
- return {
231
- data: j.data.items.map(ActivityIndexTransformer.fromDto),
232
- meta: {
233
- next: j.data.meta.next,
234
- total: j.data.items.length
235
- }
236
- };
237
- }
238
- static async getAll(n) {
239
- let A = await viewBusinessIndexV1({ query: businessIndexQueryParamsTransformer.toDto(n) });
240
- return {
241
- data: A.data.items.map(BusinessIndexTransformer.fromDto),
242
- meta: A.data.meta
243
- };
244
- }
245
- static async getBillingInformation(n) {
246
- let A = await viewBusinessBillingInformationDetailV1({ path: { businessUuid: n } });
247
- return BusinessBillingInformationTransformer.fromDto(A.data);
248
- }
249
- static async getByUuid(n) {
250
- let A = await viewBusinessDetailV1({ path: { businessUuid: n } });
251
- return BusinessDetailTransformer.fromDto(A.data);
252
- }
253
- static async getContactPerson(n, A) {
254
- let j = await viewBusinessContactPersonDetailV1({ path: {
255
- businessUuid: n,
256
- contactPersonUuid: A
257
- } });
258
- return BusinessContactPersonTransformer.fromDto(j.data);
259
- }
260
- static async getStatistics() {
261
- let n = await viewBusinessStatisticsV1();
262
- return BusinessStatisticsTransformer.fromDto(n.data);
263
- }
264
- static async linkContactPerson(n, A, j, M) {
265
- await linkContactPersonToBusinessV1({
266
- body: {
267
- contactPersonUuid: A,
268
- email: StringUtil.trimOrNull(M.email),
269
- mobilePhone: M.mobilePhone,
270
- phone: M.phone,
271
- position: j
272
- },
273
- responseValidator: void 0,
274
- path: { businessUuid: n }
275
- });
276
- }
277
- static async setPrimaryContactPersonForBusiness(n, A) {
278
- await makeBusinessContactPersonPrimaryV1({ path: {
279
- businessUuid: n,
280
- contactPersonUuid: A
281
- } });
282
- }
283
- static async unlinkContactPerson(n, A) {
284
- await unlinkContactPersonFromBusinessV1({
285
- body: { contactPersonUuid: A },
286
- responseValidator: void 0,
287
- path: { businessUuid: n }
288
- });
289
- }
290
- static async update(n, A) {
291
- await updateBusinessV1({
292
- body: BusinessUpdateTransformer.toDto(A),
293
- path: { businessUuid: n }
294
- });
295
- }
296
- static async updateContactPerson(n, A, j) {
297
- await updateBusinessContactPersonV1({
298
- body: ContactPersonUpdateTransformer.toDto(j),
299
- path: {
300
- businessUuid: n,
301
- contactPersonUuid: A
302
- }
303
- });
304
- }
305
- static async upsertBillingInformation(n, A) {
306
- await upsertBusinessBillingInformationV1({
307
- body: BusinessBillingInformationUpdateTransformer.toDto(A),
308
- path: { businessUuid: n }
309
- });
310
- }
311
- };
312
- function useBusinessDetailQuery(n) {
313
- return He({
314
- isEnabled: computed(() => n.value !== null),
315
- queryFn: async () => (assert(n.value !== null, "businessUuid is null"), await BusinessService.getByUuid(n.value)),
316
- queryKey: { wiseCrmBusinessDetail: { businessUuid: n } }
317
- });
318
- }
319
- function useBusinessActivityIndexQuery(n, A) {
320
- return Be({
321
- paginationOptions: A,
322
- queryFn: async (A) => await BusinessService.getActivity(n.value, A),
323
- queryKey: { businessActivityIndex: { paginationOptions: A } }
324
- });
325
- }
326
- var BusinessDetailSidebarActivityContent_default = /* @__PURE__ */ defineComponent({
327
- __name: "BusinessDetailSidebarActivityContent",
328
- props: { business: {} },
329
- setup(n) {
330
- let A = n, j = usePagination({
331
- isRouteQueryEnabled: !1,
332
- type: "keyset"
333
- }), M = useBusinessActivityIndexQuery(computed(() => A.business.uuid), j.paginationOptions), N = computed(() => M.data.value.data ?? []);
334
- async function P() {
335
- await M.getNextPage();
336
- }
337
- return (n, A) => (openBlock(), createBlock(ActivityList_default, {
338
- "on-next": P,
339
- "is-loading": unref(M).isLoading.value,
340
- activities: N.value
341
- }, null, 8, ["is-loading", "activities"]));
342
- }
343
- });
344
- function useNoteBusinessCreateMutation() {
345
- return ze({
346
- queryFn: async ({ body: A, params: j }) => await NoteService.create(A, { businessUuid: j.businessUuid }),
347
- queryKeysToInvalidate: { noteBusinessIndex: {} }
348
- });
349
- }
350
- function useNoteBusinessIndexQuery(A, j) {
351
- return useKeysetInfiniteQuery({
352
- queryFn: (j) => NoteService.getBusinessNotes({ pagination: j }, A.value),
353
- queryKey: { noteBusinessIndex: { params: j?.params } }
354
- });
355
- }
356
- var BusinessDetailSidebarNotesContent_default = /* @__PURE__ */ defineComponent({
357
- __name: "BusinessDetailSidebarNotesContent",
358
- props: { business: {} },
359
- setup(n) {
360
- let A = n, j = useDialog(NoteUpdateDialog_default), M = useApiErrorToast(), N = useNoteBusinessCreateMutation(), P = useNoteDeleteMutation(), F = useNoteBusinessIndexQuery(computed(() => A.business.uuid)), I = computed(() => F.data?.value?.data ?? []);
361
- async function B(n) {
362
- await N.execute({
363
- body: n,
364
- params: { businessUuid: A.business.uuid }
365
- });
366
- }
367
- async function V(n) {
368
- try {
369
- await P.execute({ params: { noteUuid: n } });
370
- } catch (n) {
371
- M.show(n);
372
- }
373
- }
374
- function H(n) {
375
- j.open({ note: n });
376
- }
377
- return (n, A) => (openBlock(), createBlock(CrmDetailSidebarNotesView_default, {
378
- "is-loading": unref(F).isLoading.value,
379
- notes: I.value,
380
- "on-submit": B,
381
- "has-next-page": unref(F).hasNextPage.value,
382
- onNext: A[0] ||= (n) => unref(F).fetchNextPage(),
383
- onDelete: V,
384
- onUpdate: H
385
- }, null, 8, [
386
- "is-loading",
387
- "notes",
388
- "has-next-page"
389
- ]));
390
- }
391
- });
392
- function useBusinessPrimaryContactPersonUpdateMutation() {
393
- let n = useQueryClient(), A = "wiseCrmBusinessDetail", j = useMutation({
394
- mutationFn: async (n) => {
395
- await BusinessService.setPrimaryContactPersonForBusiness(n.businessUuid, n.contactPersonUuid);
396
- },
397
- onError: (j, M, N) => {
398
- n.setQueryData([A, { businessUuid: M.businessUuid }], N?.previousData);
399
- },
400
- onMutate: async (j) => {
401
- await n.cancelQueries({ queryKey: [A] });
402
- let M = n.getQueryData([A, { businessUuid: j.businessUuid }]);
403
- return M === void 0 ? {} : (n.setQueryData([A, { businessUuid: j.businessUuid }], {
404
- ...M,
405
- contactPersons: M.contactPersons.map((n) => n.uuid === j.contactPersonUuid ? {
406
- ...n,
407
- isPrimary: !n.isPrimary
408
- } : {
409
- ...n,
410
- isPrimary: !1
411
- })
412
- }), { previousData: M });
413
- },
414
- onSettled: (j, M, N) => {
415
- n.invalidateQueries({ queryKey: [A, { businessUuid: N.businessUuid }] });
416
- }
417
- });
418
- return {
419
- isLoading: computed(() => j.isPending.value),
420
- data: computed(() => j.data.value),
421
- execute: async (n) => await j.mutateAsync(n.params)
422
- };
423
- }
424
- function useBusinessUnlinkContactPersonMutation() {
425
- return ze({
426
- queryFn: async ({ body: n, params: A }) => await BusinessService.unlinkContactPerson(A.businessUuid, n.contactPersonUuid),
427
- queryKeysToInvalidate: {
428
- businessIndex: {},
429
- wiseCrmBusinessDetail: { businessUuid: (n) => n.businessUuid }
430
- }
431
- });
432
- }
433
- function useBusinessAddChildBusinessMutation() {
434
- return ze({
435
- queryFn: async ({ params: n }) => await BusinessService.addChildBusiness(n.parentUuid, n.childUuid),
436
- queryKeysToInvalidate: {
437
- businessIndex: {},
438
- wiseCrmBusinessDetail: { businessUuid: (n) => n.parentUuid }
439
- }
440
- });
441
- }
442
- function useBusinessCreateMutation() {
443
- return ze({
444
- queryFn: async ({ body: n }) => await BusinessService.create(n),
445
- queryKeysToInvalidate: { businessIndex: {} }
446
- });
447
- }
448
- function useBusinessIndexQuery(n, A) {
449
- return useOffsetInfiniteQuery({
450
- isEnabled: computed(() => A?.value ?? !0),
451
- queryFn: (A) => BusinessService.getAll({
452
- pagination: A,
453
- search: n?.params?.search?.value
454
- }),
455
- queryKey: { businessIndex: { queryParams: n?.params } }
456
- });
457
- }
458
- var BusinessAddExistingChildForm_default = /* @__PURE__ */ defineComponent({
459
- __name: "BusinessAddExistingChildForm",
460
- props: {
461
- parentBusinessUuid: {},
462
- onSubmit: { type: Function }
463
- },
464
- emits: ["createNew"],
465
- setup(n, { emit: j }) {
466
- let M = n, P = j, F = useI18n(), I = useSearch({ persistInUrl: !1 }), L = useBusinessIndexQuery({ params: { search: I.debouncedSearch } }), R = useForm({
467
- initialState: { business: null },
468
- schema: z.object({ business: z.object({
469
- uuid: businessUuidSchema,
470
- name: z.string()
471
- }) }),
472
- onSubmit: async (n) => {
473
- await M.onSubmit(n.business.uuid);
474
- }
475
- }), V = R.register("business"), U = computed(() => (L.data.value?.data.filter((n) => n.uuid !== M.parentBusinessUuid) ?? []).map((n) => ({
476
- uuid: n.uuid,
477
- name: n.name
478
- })));
479
- function W(n) {
480
- I.updateSearch(n);
481
- }
482
- function G() {
483
- P("createNew");
484
- }
485
- return (n, j) => (openBlock(), createBlock(AppForm_default, { form: unref(R) }, {
486
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 1 }, {
487
- default: withCtx(() => [
488
- createVNode(unref(VcAutocomplete), mergeProps(unref(toFormField)(unref(V)), {
489
- items: U.value,
490
- "display-fn": (n) => n.name,
491
- "is-loading": unref(L).isFetching.value,
492
- label: unref(F).t("wise_crm.info_dialog.search_an_existing_one"),
493
- "icon-left": "search",
494
- onSearch: W
495
- }), null, 16, [
496
- "items",
497
- "display-fn",
498
- "is-loading",
499
- "label"
500
- ]),
501
- createVNode(AppAndOrSeparator_default, null, {
502
- default: withCtx(() => [createTextVNode(toDisplayString(unref(F).t("wise_crm.shared.or")), 1)]),
503
- _: 1
504
- }),
505
- createVNode(unref(VcButton), {
506
- class: "w-full",
507
- size: "lg",
508
- variant: "secondary",
509
- onClick: G
510
- }, {
511
- default: withCtx(() => [createTextVNode(toDisplayString(unref(F).t("wise_crm.info_dialog.add_business_child_dialog.create_a_new_one")), 1)]),
512
- _: 1
513
- }),
514
- createVNode(AppSidebarFormFooter_default, null, {
515
- default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
516
- "is-loading": unref(R).isSubmitting.value,
517
- label: unref(F).t("wise_crm.shared.add")
518
- }, null, 8, ["is-loading", "label"])]),
519
- _: 1
520
- })
521
- ]),
522
- _: 1
523
- })]),
524
- _: 1
525
- }, 8, ["form"]));
526
- }
527
- });
528
- function setScriptSrc(n, A) {
529
- n.src = A;
530
- }
531
- var bootstrap = (n) => {
532
- var A, j, M, N = "The Google Maps JavaScript API", P = "google", F = "importLibrary", I = "__ib__", L = document, R = window, B = R[P] || (R[P] = {}), V = B.maps ||= {}, H = /* @__PURE__ */ new Set(), U = new URLSearchParams(), W = () => A ||= new Promise(async (F, R) => {
533
- for (M in await (j = L.createElement("script")), U.set("libraries", [...H] + ""), n) U.set(M.replace(/[A-Z]/g, (n) => "_" + n[0].toLowerCase()), n[M]);
534
- U.set("callback", P + ".maps." + I), setScriptSrc(j, "https://maps.googleapis.com/maps/api/js?" + U), V[I] = F, j.onerror = () => A = R(Error(N + " could not load.")), j.nonce = L.querySelector("script[nonce]")?.nonce || "", L.head.append(j);
535
- });
536
- V[F] ? console.warn(N + " only loads once. Ignoring:", n) : V[F] = (n, ...A) => H.add(n) && W().then(() => V[F](n, ...A));
537
- }, MSG_REPEATED_SET_OPTIONS = (n) => `The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(n)}) will be ignored.`, MSG_IMPORT_LIBRARY_EXISTS = (n) => `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(n)}) 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 ? (n) => {
538
- console.warn(`[@googlemaps/js-api-loader] ${n}`);
539
- } : () => {}, logDevNotice = __DEV__$1 ? (n) => {
540
- console.info(`[@googlemaps/js-api-loader] ${n}`);
541
- } : () => {}, __DEV__ = process.env.NODE_ENV !== "production", setOptionsWasCalled_ = !1;
542
- function setOptions(n) {
543
- if (setOptionsWasCalled_) {
544
- logDevWarning(MSG_REPEATED_SET_OPTIONS(n));
545
- return;
546
- }
547
- installImportLibrary_(n), setOptionsWasCalled_ = !0;
548
- }
549
- async function importLibrary(n) {
550
- if (setOptionsWasCalled_ || logDevWarning(MSG_SET_OPTIONS_NOT_CALLED), !window?.google?.maps?.importLibrary) throw Error("google.maps.importLibrary is not installed.");
551
- return await google.maps.importLibrary(n);
552
- }
553
- function installImportLibrary_(n) {
554
- let A = !!window.google?.maps?.importLibrary;
555
- A ? logDevNotice(MSG_IMPORT_LIBRARY_EXISTS(n)) : __DEV__ && document.querySelector("script[src*=\"maps.googleapis.com/maps/api/js\"]") && logDevWarning(MSG_SCRIPT_ELEMENT_EXISTS), A || bootstrap(n);
556
- }
557
- function useGeocode() {
558
- let { getGoogleMapsApiKey: n } = useGoogleMapsApiKey();
559
- async function A(A) {
560
- let j = n();
561
- if (j === null) return null;
562
- let M = [
563
- A.street,
564
- A.streetNumber,
565
- A.postalCode,
566
- A.city,
567
- A.country
568
- ].filter(Boolean).join(", ");
569
- if (M === "") return null;
570
- try {
571
- setOptions({
572
- key: j,
573
- libraries: ["places"]
574
- });
575
- let { Place: n } = await importLibrary("places"), A = {
576
- fields: ["location"],
577
- textQuery: M
578
- }, { places: N } = await n.searchByText(A);
579
- if (N.length > 0 && N[0].location !== null) {
580
- let n = N[0].location;
581
- return {
582
- lat: n.lat(),
583
- lng: n.lng()
584
- };
585
- }
586
- return null;
587
- } catch {
588
- return null;
589
- }
590
- }
591
- return { geocodeAddress: A };
592
- }
593
- var CbeEnterpriseSearchTransformer = class {
594
- static fromDto(n) {
595
- return {
596
- uuid: n.enterpriseNumber,
597
- startDate: n.startDate,
598
- name: n.name,
599
- abbreviation: n.abbreviation,
600
- address: AddressTransformer.fromNullableDto(n.address),
601
- email: n.email,
602
- fax: n.fax,
603
- phone: n.phone,
604
- status: n.status,
605
- website: n.website
606
- };
607
- }
608
- }, CbeService = class {
609
- static async searchEnterprisesByTerm(n) {
610
- let A = await searchCbeEnterprisesV1({ query: {
611
- pagination: {
612
- limit: 10,
613
- offset: 0
614
- },
615
- search: n
616
- } });
617
- return {
618
- data: A.data.items.map(CbeEnterpriseSearchTransformer.fromDto),
619
- meta: A.data.meta
620
- };
621
- }
622
- };
623
- function useCbeEnterpriseSearchByTermQuery(n) {
624
- return He({
625
- isEnabled: computed(() => n.value.length > 0),
626
- queryFn: async () => (await CbeService.searchEnterprisesByTerm(n.value)).data,
627
- queryKey: { cbeEnterpriseSearchByTerm: { searchTerm: n } }
628
- });
629
- }
630
- var _hoisted_1$4 = { class: "text-sm" }, _hoisted_2$3 = {
631
- key: 0,
632
- class: "text-secondary text-xs"
633
- }, CbeAutocomplete_default = /* @__PURE__ */ defineComponent({
634
- __name: "CbeAutocomplete",
635
- props: /* @__PURE__ */ mergeModels({
636
- isRequired: { type: Boolean },
637
- label: {}
638
- }, {
639
- modelValue: { required: !0 },
640
- modelModifiers: {}
641
- }),
642
- emits: /* @__PURE__ */ mergeModels(["createNew"], ["update:modelValue"]),
643
- setup(n, { emit: A }) {
644
- let j = n, M = A, N = useModel(n, "modelValue"), P = ref(null), F = ref(null), I = useI18n(), L = ref(!0), R = useCbeEnterpriseSearchByTermQuery(computed(() => F.value ?? "")), B = useDebounceFn((n) => {
645
- n !== null && (L.value = n.length === 0 || n.trim().length === 0, F.value = n);
646
- }, 300), V = computed(() => R.data.value ?? []);
647
- async function H(n) {
648
- await B(n);
649
- }
650
- function U() {
651
- M("createNew");
652
- }
653
- function W(n) {
654
- return V.value.find((A) => A.uuid === n)?.name ?? "-";
655
- }
656
- function K(n) {
657
- if (n === null) {
658
- P.value = null;
659
- return;
660
- }
661
- N.value = V.value.find((A) => A.uuid === n.value) ?? null, P.value = n;
662
- }
663
- return (n, A) => (openBlock(), createBlock(EntityAutocomplete_default, {
664
- modelValue: P.value,
665
- "onUpdate:modelValue": [A[0] ||= (n) => P.value = n, K],
666
- "is-required": j.isRequired,
667
- "display-fn": W,
668
- label: j.label,
669
- options: V.value,
670
- "is-loading": unref(R).isFetching.value,
671
- placeholder: unref(I).t("component.select.search_placeholder"),
672
- onCreateNew: U,
673
- onSearch: H
674
- }, {
675
- option: withCtx(({ option: n, isHighlighted: A }) => [createElementVNode("div", { class: normalizeClass([{ "bg-brand-50": A }, "p-md px-lg flex flex-col rounded-md"]) }, [createElementVNode("span", _hoisted_1$4, toDisplayString(n.name), 1), n.address ? (openBlock(), createElementBlock("span", _hoisted_2$3, toDisplayString(unref(AddressUtil).format(n.address)), 1)) : createCommentVNode("", !0)], 2)]),
676
- _: 1
677
- }, 8, [
678
- "modelValue",
679
- "is-required",
680
- "label",
681
- "options",
682
- "is-loading",
683
- "placeholder"
684
- ]));
685
- }
686
- }), ContactCreateDialogBusinessCbeSearch_default = /* @__PURE__ */ defineComponent({
687
- __name: "ContactCreateDialogBusinessCbeSearch",
688
- emits: [
689
- "back",
690
- "createNew",
691
- "updateCbeSearchItem"
692
- ],
693
- setup(n, { emit: A }) {
694
- let j = A, M = useI18n(), N = ref(null);
695
- function F() {
696
- j("createNew");
697
- }
698
- function I(n) {
699
- N.value = n, j("updateCbeSearchItem", n);
700
- }
701
- function L() {
702
- j("back");
703
- }
704
- return (n, A) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
705
- default: withCtx(() => [createVNode(CbeAutocomplete_default, {
706
- modelValue: N.value,
707
- "onUpdate:modelValue": [A[0] ||= (n) => N.value = n, I],
708
- label: unref(M).t("wise_crm.contact.create_dialog.form.fields.cbe_search"),
709
- onCreateNew: F
710
- }, null, 8, ["modelValue", "label"]), createVNode(AppDialogActions_default, null, {
711
- default: withCtx(() => [createVNode(unref(VcButton), {
712
- variant: "secondary",
713
- size: "lg",
714
- onClick: L
715
- }, {
716
- default: withCtx(() => [createTextVNode(toDisplayString(unref(M).t("wise_crm.shared.back")), 1)]),
717
- _: 1
718
- })]),
719
- _: 1
720
- })]),
721
- _: 1
722
- }));
723
- }
724
- }), baseFieldsetContextKey = Symbol("baseFieldsetContext");
725
- function useInjectBaseFieldsetContext() {
726
- let n = inject(baseFieldsetContextKey) ?? null;
727
- return assert(n !== null, "`useBaseFieldsetContext` must be used within a component that provides the context"), n;
728
- }
729
- function useProvideBaseFieldsetContext(n) {
730
- provide(baseFieldsetContextKey, n);
731
- }
732
- var _hoisted_1$3 = ["aria-describedby"], BaseFieldset_default = /* @__PURE__ */ defineComponent({
733
- __name: "BaseFieldset",
734
- setup(n) {
735
- let A = useId();
736
- return useProvideBaseFieldsetContext({ id: A }), (n, j) => (openBlock(), createElementBlock("fieldset", { "aria-describedby": unref(A) }, [renderSlot(n.$slots, "default")], 8, _hoisted_1$3));
737
- }
738
- }), BaseFieldsetLegend_default = /* @__PURE__ */ defineComponent({
739
- __name: "BaseFieldsetLegend",
740
- props: { as: {} },
741
- setup(n) {
742
- let A = n, j = useInjectBaseFieldsetContext();
743
- return (n, M) => (openBlock(), createBlock(resolveDynamicComponent(A.as), { id: unref(j).id }, {
744
- default: withCtx(() => [renderSlot(n.$slots, "default")]),
745
- _: 3
746
- }, 8, ["id"]));
747
- }
748
- }), _hoisted_1$2 = { class: "mb-lg" }, _hoisted_2$2 = {
749
- key: 0,
750
- class: "mt-sm text-secondary text-sm"
751
- }, _hoisted_3$2 = { class: "col-span-2" }, FormFieldset_default = /* @__PURE__ */ defineComponent({
752
- __name: "FormFieldset",
753
- props: {
754
- title: {},
755
- isTitleHidden: {
756
- type: Boolean,
757
- default: !1
758
- },
759
- description: { default: null }
760
- },
761
- setup(n) {
762
- let A = n;
763
- return (n, j) => (openBlock(), createBlock(BaseFieldset_default, null, {
764
- default: withCtx(() => [createElementVNode("div", _hoisted_1$2, [(openBlock(), createBlock(resolveDynamicComponent(A.isTitleHidden ? unref(VisuallyHidden) : "div"), null, {
765
- default: withCtx(() => [createVNode(BaseFieldsetLegend_default, {
766
- as: "h2",
767
- class: "text-primary text-sm font-medium"
768
- }, {
769
- default: withCtx(() => [createTextVNode(toDisplayString(A.title), 1)]),
770
- _: 1
771
- })]),
772
- _: 1
773
- })), A.description === null ? createCommentVNode("", !0) : (openBlock(), createElementBlock("p", _hoisted_2$2, toDisplayString(A.description), 1))]), createElementVNode("div", _hoisted_3$2, [renderSlot(n.$slots, "default")])]),
774
- _: 3
775
- }));
776
- }
777
- }), ContactCreateDialogBusinessContactPerson_default = /* @__PURE__ */ defineComponent({
778
- __name: "ContactCreateDialogBusinessContactPerson",
779
- props: { form: {} },
780
- emits: ["back"],
781
- setup(n, { emit: j }) {
782
- let M = n, N = j, F = useI18n(), I = M.form.register("individual.firstName"), L = M.form.register("individual.lastName"), R = M.form.register("individualPosition"), B = M.form.register("individual.email"), V = M.form.register("individual.mobilePhone"), H = M.form.register("individual.phone");
783
- function U() {
784
- N("back");
785
- }
786
- return (j, M) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
787
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 1 }, {
788
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
789
- default: withCtx(() => [
790
- createVNode(unref(VcTextField), mergeProps({
791
- label: unref(F).t("wise_crm.contact.create_dialog.form.fields.first_name"),
792
- placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.first_name")
793
- }, unref(toFormField)(unref(I))), null, 16, ["label", "placeholder"]),
794
- createVNode(unref(VcTextField), mergeProps({
795
- label: unref(F).t("wise_crm.contact.create_dialog.form.fields.last_name"),
796
- placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.last_name")
797
- }, unref(toFormField)(unref(L))), null, 16, ["label", "placeholder"]),
798
- createVNode(unref(VcTextField), mergeProps({
799
- label: unref(F).t("wise_crm.contact.create_dialog.form.fields.position"),
800
- placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.position")
801
- }, unref(toFormField)(unref(R))), null, 16, ["label", "placeholder"])
802
- ]),
803
- _: 1
804
- }), createVNode(FormFieldset_default, {
805
- title: unref(F).t("wise_crm.shared.contact_info"),
806
- class: "col-span-2"
807
- }, {
808
- default: withCtx(() => [createVNode(AppGrid_default, {
809
- cols: 1,
810
- class: "mt-sm bg-secondary p-lg rounded-xl"
811
- }, {
812
- default: withCtx(() => [
813
- createVNode(unref(VcTextField), mergeProps(unref(toFormField)(unref(B)), {
814
- label: unref(F).t("wise_crm.contact.create_dialog.form.fields.email"),
815
- placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.email")
816
- }), null, 16, ["label", "placeholder"]),
817
- createVNode(unref(VcPhoneNumberField), mergeProps(unref(toFormField)(unref(V)), {
818
- label: unref(F).t("wise_crm.contact.create_dialog.form.fields.mobile_phone"),
819
- placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.mobile_phone")
820
- }), null, 16, ["label", "placeholder"]),
821
- createVNode(unref(VcPhoneNumberField), mergeProps(unref(toFormField)(unref(H)), {
822
- label: unref(F).t("wise_crm.contact.create_dialog.form.fields.phone"),
823
- placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.phone")
824
- }), null, 16, ["label", "placeholder"])
825
- ]),
826
- _: 1
827
- }), createVNode(AppGlobalFormError_default, { form: n.form }, null, 8, ["form"])]),
828
- _: 1
829
- }, 8, ["title"])]),
830
- _: 1
831
- }), createVNode(AppDialogActions_default, null, {
832
- default: withCtx(() => [createVNode(unref(VcButton), {
833
- size: "lg",
834
- variant: "secondary",
835
- onClick: U
836
- }, {
837
- default: withCtx(() => [createTextVNode(toDisplayString(unref(F).t("wise_crm.shared.back")), 1)]),
838
- _: 1
839
- }), createVNode(unref(VcButton), {
840
- "is-loading": n.form.isSubmitting.value,
841
- size: "lg",
842
- type: "submit"
843
- }, {
844
- default: withCtx(() => [createTextVNode(toDisplayString(unref(F).t("wise_crm.shared.create")), 1)]),
845
- _: 1
846
- }, 8, ["is-loading"])]),
847
- _: 1
848
- })]),
849
- _: 1
850
- }));
851
- }
852
- }), ContactCreateDialogBusinessContactPersonSearch_default = /* @__PURE__ */ defineComponent({
853
- __name: "ContactCreateDialogBusinessContactPersonSearch",
854
- props: {
855
- isSubmitting: { type: Boolean },
856
- form: {},
857
- requireIndividualOnCreate: { type: Boolean }
858
- },
859
- emits: [
860
- "back",
861
- "createNew",
862
- "next"
863
- ],
864
- setup(n, { emit: A }) {
865
- let j = n, M = A, N = useI18n(), F = useApiErrorToast(), I = ref(null), R = j.form.register("individualUuid"), B = j.form.register("individual");
866
- async function V(n) {
867
- if (I.value = n, n !== null) {
868
- R.setValue(n ? n.value : null);
869
- try {
870
- let A = await IndividualService.getByUuid(n.value);
871
- B.setValue({
872
- email: A.email,
873
- firstName: A.firstName,
874
- lastName: A.lastName,
875
- mobilePhone: A.mobilePhone,
876
- phone: A.phone
877
- }), M("next");
878
- } catch (n) {
879
- F.show(n);
880
- }
881
- }
882
- }
883
- function H() {
884
- M("back");
885
- }
886
- function U() {
887
- R.setValue(null), B.setValue(null), M("next");
888
- }
889
- return (n, A) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
890
- default: withCtx(() => [createVNode(IndividualAutocomplete_default, {
891
- "model-value": I.value,
892
- label: unref(N).t("wise_crm.contact.create_dialog.form.contact_person"),
893
- "onUpdate:modelValue": V,
894
- onCreateNew: U
895
- }, null, 8, ["model-value", "label"]), createVNode(AppDialogActions_default, null, {
896
- default: withCtx(() => [createVNode(unref(VcButton), {
897
- variant: "secondary",
898
- size: "lg",
899
- onClick: H
900
- }, {
901
- default: withCtx(() => [createTextVNode(toDisplayString(unref(N).t("wise_crm.shared.back")), 1)]),
902
- _: 1
903
- }), j.requireIndividualOnCreate ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(VcButton), {
904
- key: 0,
905
- "is-loading": j.isSubmitting,
906
- size: "lg",
907
- type: "submit"
908
- }, {
909
- default: withCtx(() => [createTextVNode(toDisplayString(unref(N).t("wise_crm.shared.skip")), 1)]),
910
- _: 1
911
- }, 8, ["is-loading"]))]),
912
- _: 1
913
- })]),
914
- _: 1
915
- }));
916
- }
917
- }), AppVatNumberField_default = /* @__PURE__ */ defineComponent({
918
- __name: "AppVatNumberField",
919
- props: /* @__PURE__ */ mergeModels({
920
- isLoading: { type: Boolean },
921
- isSpellCheckEnabled: { type: Boolean },
922
- autocomplete: {},
923
- iconLeft: {},
924
- iconRight: {},
925
- placeholder: {},
926
- type: {},
927
- variant: {},
928
- testId: {},
929
- isDisabled: { type: Boolean },
930
- id: {},
931
- isRequired: { type: Boolean },
932
- isTouched: { type: Boolean },
933
- errorMessage: {},
934
- hint: {},
935
- label: {},
936
- classConfig: {}
937
- }, {
938
- modelValue: { required: !0 },
939
- modelModifiers: {}
940
- }),
941
- emits: ["update:modelValue"],
942
- setup(n) {
943
- let A = n, j = useModel(n, "modelValue"), M = computed({
944
- get: () => j.value ? `${j.value.countryCode}${j.value.number}` : null,
945
- set: (n) => {
946
- if (n === null) {
947
- j.value = null;
948
- return;
949
- }
950
- j.value = {
951
- countryCode: n.slice(0, 2).toUpperCase(),
952
- number: n.slice(2)
953
- };
954
- }
955
- });
956
- function N(n) {
957
- n.key.length === 1 && /[a-z0-9]/i.test(n.key) || n.key === "Backspace" || n.key === "Delete" || n.key === "ArrowLeft" || n.key === "ArrowRight" || n.key === "Tab" || n.preventDefault();
958
- }
959
- function P(n) {
960
- let A = (n.clipboardData?.getData("text"))?.replace(/[^a-z0-9]/gi, "");
961
- A && (M.value = A);
962
- }
963
- return (n, j) => (openBlock(), createBlock(unref(VcTextField), mergeProps(A, {
964
- modelValue: M.value,
965
- "onUpdate:modelValue": j[0] ||= (n) => M.value = n,
966
- onKeydown: N,
967
- onPaste: withModifiers(P, ["prevent"])
968
- }), null, 16, ["modelValue"]));
969
- }
970
- }), CustomFieldCheckbox_default = /* @__PURE__ */ defineComponent({
971
- __name: "CustomFieldCheckbox",
972
- props: {
973
- definition: {},
974
- form: {}
975
- },
976
- setup(n) {
977
- let j = n, M = j.form.register(`customFields.${j.definition.key}`, j.definition.defaultValue);
978
- return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcCheckbox), mergeProps({ label: j.definition.displayName }, unref(toFormField)(unref(M))), null, 16, ["label"])]));
979
- }
980
- }), CustomFieldDate_default = /* @__PURE__ */ defineComponent({
981
- __name: "CustomFieldDate",
982
- props: {
983
- definition: {},
984
- form: {}
985
- },
986
- setup(n) {
987
- let j = n, M = j.form.register(`customFields.${j.definition.key}`);
988
- return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcDateField), mergeProps({
989
- "min-date": j.definition.minDate,
990
- "max-date": j.definition.maxDate,
991
- label: j.definition.displayName
992
- }, unref(toFormField)(unref(M))), null, 16, [
993
- "min-date",
994
- "max-date",
995
- "label"
996
- ])]));
997
- }
998
- }), CustomFieldMultiSelect_default = /* @__PURE__ */ defineComponent({
999
- __name: "CustomFieldMultiSelect",
1000
- props: {
1001
- definition: {},
1002
- form: {}
1003
- },
1004
- setup(n) {
1005
- let j = n, M = j.form.register(`customFields.${j.definition.key}`, []);
1006
- function N(n) {
1007
- return j.definition.options.find((A) => A.key === n)?.value ?? n;
1008
- }
1009
- return (n, P) => (openBlock(), createBlock(unref(VcSelect), mergeProps(unref(toFormField)(unref(M)), {
1010
- "display-fn": N,
1011
- label: j.definition.displayName,
1012
- placeholder: j.definition.displayName
1013
- }), {
1014
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(j.definition.options, (n) => (openBlock(), createBlock(unref(VcSelectItem), {
1015
- key: n.key,
1016
- value: n.key
1017
- }, {
1018
- default: withCtx(() => [createTextVNode(toDisplayString(n.value), 1)]),
1019
- _: 2
1020
- }, 1032, ["value"]))), 128))]),
1021
- _: 1
1022
- }, 16, ["label", "placeholder"]));
1023
- }
1024
- }), CustomFieldNumberField_default = /* @__PURE__ */ defineComponent({
1025
- __name: "CustomFieldNumberField",
1026
- props: {
1027
- definition: {},
1028
- form: {}
1029
- },
1030
- setup(n) {
1031
- let j = n, M = j.form.register(`customFields.${j.definition.key}`);
1032
- return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcNumberField), mergeProps({
1033
- min: j.definition.minValue,
1034
- max: j.definition.maxValue,
1035
- label: j.definition.displayName,
1036
- placeholder: j.definition.displayName,
1037
- "hide-controls": !0
1038
- }, unref(toFormField)(unref(M))), null, 16, [
1039
- "min",
1040
- "max",
1041
- "label",
1042
- "placeholder"
1043
- ])]));
1044
- }
1045
- }), CustomFieldRadio_default = /* @__PURE__ */ defineComponent({
1046
- __name: "CustomFieldRadio",
1047
- props: {
1048
- definition: {},
1049
- form: {}
1050
- },
1051
- setup(n) {
1052
- let j = n, M = j.form.register(`customFields.${j.definition.key}`);
1053
- return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcRadioGroup), mergeProps({ label: j.definition.displayName }, unref(toFormField)(unref(M))), {
1054
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(j.definition.options, (n) => (openBlock(), createBlock(unref(VcRadioGroupItem), {
1055
- key: n.key,
1056
- label: n.value,
1057
- value: n.key
1058
- }, null, 8, ["label", "value"]))), 128))]),
1059
- _: 1
1060
- }, 16, ["label"])]));
1061
- }
1062
- }), CustomFieldSelect_default = /* @__PURE__ */ defineComponent({
1063
- __name: "CustomFieldSelect",
1064
- props: {
1065
- definition: {},
1066
- form: {}
1067
- },
1068
- setup(n) {
1069
- let j = n, M = j.form.register(`customFields.${j.definition.key}`);
1070
- function N(n) {
1071
- let A = j.definition.options.find((A) => A.key === n);
1072
- return A ? A.value : n;
1073
- }
1074
- return (n, P) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcSelect), mergeProps({
1075
- "display-fn": N,
1076
- label: j.definition.displayName,
1077
- placeholder: j.definition.displayName
1078
- }, unref(toFormField)(unref(M))), {
1079
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(j.definition.options, (n) => (openBlock(), createBlock(unref(VcSelectItem), {
1080
- key: n.key,
1081
- value: n.key
1082
- }, {
1083
- default: withCtx(() => [createTextVNode(toDisplayString(n.value), 1)]),
1084
- _: 2
1085
- }, 1032, ["value"]))), 128))]),
1086
- _: 1
1087
- }, 16, ["label", "placeholder"])]));
1088
- }
1089
- }), CustomFieldString_default = /* @__PURE__ */ defineComponent({
1090
- __name: "CustomFieldString",
1091
- props: {
1092
- definition: {},
1093
- form: {}
1094
- },
1095
- setup(n) {
1096
- let j = n, M = j.form.register(`customFields.${j.definition.key}`);
1097
- return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcTextField), mergeProps({
1098
- label: j.definition.displayName,
1099
- placeholder: j.definition.displayName
1100
- }, unref(toFormField)(unref(M))), null, 16, ["label", "placeholder"])]));
1101
- }
1102
- }), CustomFieldDefinitionForm_default = /* @__PURE__ */ defineComponent({
1103
- __name: "CustomFieldDefinitionForm",
1104
- props: {
1105
- customFieldDefinitions: {},
1106
- form: {}
1107
- },
1108
- setup(n) {
1109
- let A = n;
1110
- function j(n) {
1111
- return n === "full" ? "col-span-2" : "col-span-1";
1112
- }
1113
- return (M, N) => (openBlock(), createBlock(AppGrid_default, { cols: 2 }, {
1114
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(A.customFieldDefinitions, (M) => (openBlock(), createElementBlock(Fragment, { key: M.uuid }, [
1115
- M.type === "string" ? (openBlock(), createBlock(CustomFieldString_default, {
1116
- key: 0,
1117
- class: normalizeClass(j(M.width)),
1118
- form: n.form,
1119
- definition: M
1120
- }, null, 8, [
1121
- "class",
1122
- "form",
1123
- "definition"
1124
- ])) : createCommentVNode("", !0),
1125
- M.type === "select" ? (openBlock(), createBlock(CustomFieldSelect_default, {
1126
- key: 1,
1127
- class: normalizeClass(j(M.width)),
1128
- form: n.form,
1129
- definition: M
1130
- }, null, 8, [
1131
- "class",
1132
- "form",
1133
- "definition"
1134
- ])) : createCommentVNode("", !0),
1135
- M.type === "radio" ? (openBlock(), createBlock(CustomFieldRadio_default, {
1136
- key: 2,
1137
- class: normalizeClass(j(M.width)),
1138
- form: n.form,
1139
- definition: M
1140
- }, null, 8, [
1141
- "class",
1142
- "form",
1143
- "definition"
1144
- ])) : createCommentVNode("", !0),
1145
- M.type === "date" ? (openBlock(), createBlock(CustomFieldDate_default, {
1146
- key: 3,
1147
- class: normalizeClass(j(M.width)),
1148
- form: n.form,
1149
- definition: M
1150
- }, null, 8, [
1151
- "class",
1152
- "form",
1153
- "definition"
1154
- ])) : createCommentVNode("", !0),
1155
- M.type === "number" ? (openBlock(), createBlock(CustomFieldNumberField_default, {
1156
- key: 4,
1157
- definition: M,
1158
- class: normalizeClass(j(M.width)),
1159
- form: A.form
1160
- }, null, 8, [
1161
- "definition",
1162
- "class",
1163
- "form"
1164
- ])) : createCommentVNode("", !0),
1165
- M.type === "checkbox" ? (openBlock(), createBlock(CustomFieldCheckbox_default, {
1166
- key: 5,
1167
- definition: M,
1168
- form: A.form,
1169
- class: normalizeClass(j(M.width))
1170
- }, null, 8, [
1171
- "definition",
1172
- "form",
1173
- "class"
1174
- ])) : createCommentVNode("", !0),
1175
- M.type === "multiselect" ? (openBlock(), createBlock(CustomFieldMultiSelect_default, {
1176
- key: 6,
1177
- form: A.form,
1178
- class: normalizeClass(j(M.width)),
1179
- definition: M
1180
- }, null, 8, [
1181
- "form",
1182
- "class",
1183
- "definition"
1184
- ])) : createCommentVNode("", !0)
1185
- ], 64))), 128))]),
1186
- _: 1
1187
- }));
1188
- }
1189
- }), ContactCreateDialogBusinessGeneralInfo_default = /* @__PURE__ */ defineComponent({
1190
- __name: "ContactCreateDialogBusinessGeneralInfo",
1191
- props: {
1192
- isDataFromCbe: { type: Boolean },
1193
- form: {}
1194
- },
1195
- emits: ["back", "next"],
1196
- setup(n, { emit: M }) {
1197
- let N = n, F = M, I = useI18n(), L = useCrmConfig(), R = computed(() => L.getCustomFieldDefinitionForEntity(EntityType.BUSINESS).filter((n) => n.isDisplayedOnCreate)), B = N.form.register("name"), V = N.form.register("address"), H = N.form.register("companyNumber"), U = N.form.register("vatNumber");
1198
- function W() {
1199
- F("back");
1200
- }
1201
- function G() {
1202
- N.form.blurAll(), B.isValid.value && V.isValid.value && U.isValid.value && H.isValid.value && F("next");
1203
- }
1204
- return (j, M) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
1205
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
1206
- default: withCtx(() => [
1207
- createVNode(unref(VcTextField), mergeProps({
1208
- "is-disabled": N.isDataFromCbe,
1209
- "is-required": !0
1210
- }, unref(toFormField)(unref(B)), {
1211
- label: unref(I).t("wise_crm.contact.create_dialog.form.name"),
1212
- placeholder: unref(I).t("wise_crm.contact.create_dialog.form.name")
1213
- }), null, 16, [
1214
- "is-disabled",
1215
- "label",
1216
- "placeholder"
1217
- ]),
1218
- createVNode(AppVatNumberField_default, mergeProps({ "is-disabled": N.isDataFromCbe }, unref(toFormField)(unref(U)), {
1219
- label: unref(I).t("wise_crm.contact.create_dialog.form.vat_number"),
1220
- placeholder: unref(I).t("wise_crm.contact.create_dialog.form.vat_number")
1221
- }), null, 16, [
1222
- "is-disabled",
1223
- "label",
1224
- "placeholder"
1225
- ]),
1226
- createVNode(unref(VcAddressAutocomplete), mergeProps({
1227
- "is-disabled": N.isDataFromCbe,
1228
- "is-required": !0,
1229
- label: unref(I).t("wise_crm.contact.create_dialog.form.fields.address"),
1230
- placeholder: unref(I).t("wise_crm.contact.create_dialog.form.fields.address")
1231
- }, unref(toFormField)(unref(V))), null, 16, [
1232
- "is-disabled",
1233
- "label",
1234
- "placeholder"
1235
- ]),
1236
- createVNode(unref(VcTextField), mergeProps({
1237
- label: unref(I).t("wise_crm.contact.create_dialog.form.company_number"),
1238
- placeholder: unref(I).t("wise_crm.contact.create_dialog.form.company_number")
1239
- }, unref(toFormField)(unref(H))), null, 16, ["label", "placeholder"]),
1240
- createVNode(CustomFieldDefinitionForm_default, {
1241
- "custom-field-definitions": R.value,
1242
- form: n.form
1243
- }, null, 8, ["custom-field-definitions", "form"])
1244
- ]),
1245
- _: 1
1246
- }), createVNode(AppDialogActions_default, null, {
1247
- default: withCtx(() => [createVNode(unref(VcButton), {
1248
- variant: "secondary",
1249
- size: "lg",
1250
- onClick: W
1251
- }, {
1252
- default: withCtx(() => [createTextVNode(toDisplayString(unref(I).t("wise_crm.shared.back")), 1)]),
1253
- _: 1
1254
- }), createVNode(unref(VcButton), {
1255
- size: "lg",
1256
- onClick: G
1257
- }, {
1258
- default: withCtx(() => [createTextVNode(toDisplayString(unref(I).t("wise_crm.shared.next")), 1)]),
1259
- _: 1
1260
- })]),
1261
- _: 1
1262
- })]),
1263
- _: 1
1264
- }));
1265
- }
1266
- });
1267
- const addressFormSchema = z.object({
1268
- placeId: z.string().nullable().optional(),
1269
- bus: z.string(),
1270
- city: z.string().min(1),
1271
- coordinates: z.object({
1272
- lat: z.number().nullable(),
1273
- lng: z.number().nullable()
1274
- }),
1275
- country: z.string().min(1),
1276
- postalCode: z.string().min(1),
1277
- street: z.string().min(1),
1278
- streetNumber: z.string()
1279
- }), vatNumberSchema = z$1.object({
1280
- countryCode: z$1.enum(CountryCode, { error: i18nPlugin.global.t("validation.vat_number.invalid_country_code") }),
1281
- number: z$1.string().min(1).regex(/^\d+$/, i18nPlugin.global.t("validation.vat_number.numbers_only"))
1282
- });
1283
- var CustomFieldDefinitionUtil = class {
1284
- static getZodType(n) {
1285
- return n.reduce((n, A) => {
1286
- switch (A.type) {
1287
- case "multiselect":
1288
- n[A.key] = z.string().array().default([]).superRefine((n, j) => {
1289
- A.minSelections !== void 0 && n.length < A.minSelections && j.addIssue({
1290
- code: z.ZodIssueCode.custom,
1291
- message: `At least ${A.minSelections} selections are required`
1292
- }), A.maxSelections !== void 0 && n.length > A.maxSelections && j.addIssue({
1293
- code: z.ZodIssueCode.custom,
1294
- message: `At most ${A.maxSelections} selections are allowed`
1295
- });
1296
- });
1297
- break;
1298
- case "checkbox":
1299
- n[A.key] = z.boolean();
1300
- break;
1301
- case "radio":
1302
- n[A.key] = z.string().nullable();
1303
- break;
1304
- case "select":
1305
- n[A.key] = z.string().nullable().superRefine((n, A) => {
1306
- n === "" && A.addIssue({
1307
- code: z.ZodIssueCode.custom,
1308
- message: "Selection is required"
1309
- });
1310
- });
1311
- break;
1312
- case "number":
1313
- n[A.key] = z.number().nullable().superRefine((n, j) => {
1314
- n !== null && A.minValue !== void 0 && n < A.minValue && j.addIssue({
1315
- code: z.ZodIssueCode.custom,
1316
- message: `Minimum value is ${A.minValue}`
1317
- }), n !== null && A.maxValue !== void 0 && n > A.maxValue && j.addIssue({
1318
- code: z.ZodIssueCode.custom,
1319
- message: `Maximum value is ${A.maxValue}`
1320
- });
1321
- });
1322
- break;
1323
- case "date":
1324
- n[A.key] = plainDateSchema.nullable().superRefine((n, j) => {
1325
- n !== null && A.minDate !== void 0 && n < A.minDate && j.addIssue({
1326
- code: z.ZodIssueCode.custom,
1327
- message: `Minimum date is ${A.minDate}`
1328
- }), n !== null && A.maxDate !== void 0 && n > A.maxDate && j.addIssue({
1329
- code: z.ZodIssueCode.custom,
1330
- message: `Maximum date is ${A.maxDate}`
1331
- });
1332
- });
1333
- break;
1334
- default: n[A.key] = z.string().nullable();
1335
- }
1336
- return n;
1337
- }, {});
1338
- }
1339
- };
1340
- const businessIndividualCreateFormSchema = z.object({
1341
- email: z.email().nullable(),
1342
- firstName: z.string().min(1),
1343
- lastName: z.string().min(1),
1344
- mobilePhone: phoneNumberFormSchema.nullable(),
1345
- phone: phoneNumberFormSchema.nullable()
1346
- });
1347
- z.object({
1348
- childUuid: businessUuidSchema.nullable(),
1349
- individualUuid: individualUuidSchema.nullable(),
1350
- parentUuid: businessUuidSchema.nullable(),
1351
- name: z.string().min(1),
1352
- address: addressFormSchema,
1353
- companyNumber: z.string().nullable(),
1354
- customFields: z.object(CustomFieldDefinitionUtil.getZodType([])).nullable(),
1355
- individual: businessIndividualCreateFormSchema.nullable(),
1356
- individualPosition: z.string().nullable(),
1357
- vatNumber: vatNumberSchema.nullable()
1358
- });
1359
- function getBusinessCreateFormSchema(n) {
1360
- return z.object({
1361
- childUuid: businessUuidSchema.nullable(),
1362
- individualUuid: individualUuidSchema.nullable(),
1363
- parentUuid: businessUuidSchema.nullable(),
1364
- name: z.string().min(1),
1365
- address: addressFormSchema,
1366
- companyNumber: z.string().nullable(),
1367
- customFields: z.object(CustomFieldDefinitionUtil.getZodType(n)).nullable(),
1368
- individual: businessIndividualCreateFormSchema.nullable(),
1369
- individualPosition: z.string().nullable(),
1370
- vatNumber: vatNumberSchema.nullable()
1371
- });
1372
- }
1373
- var Step = /* @__PURE__ */ function(n) {
1374
- return n.MANUAL_BUSINESS = "manual_business", n.MANUAL_CONTACT_PERSON = "manual_contact_person", n.SEARCH_BUSINESS = "search_business", n.SEARCH_CONTACT_PERSON = "search_contact_person", n;
1375
- }(Step || {}), ContactCreateDialogBusinessForm_default = /* @__PURE__ */ defineComponent({
1376
- __name: "ContactCreateDialogBusinessForm",
1377
- props: { onSubmit: { type: Function } },
1378
- emits: ["back"],
1379
- setup(n, { emit: A }) {
1380
- let M = n, N = A, P = useI18n(), F = useCrm(), I = useCrmConfig(), { geocodeAddress: L } = useGeocode(), R = computed(() => F.getEntityConfig(EntityType.BUSINESS)), B = ref(!1), V = ref(Step.SEARCH_BUSINESS), H = computed(() => V.value === Step.MANUAL_CONTACT_PERSON || V.value === Step.SEARCH_CONTACT_PERSON ? P.t("wise_crm.contact.create_dialog.form.contact_person_title") : P.t("wise_crm.contact.create_dialog.form.title", { value: R.value?.name ?? "-" })), U = computed(() => V.value === Step.MANUAL_CONTACT_PERSON || V.value === Step.SEARCH_CONTACT_PERSON ? P.t("wise_crm.contact.create_dialog.form.contact_person_description") : P.t("wise_crm.contact.create_dialog.form.description")), G = useForm({
1381
- initialState: {
1382
- childUuid: null,
1383
- individualUuid: null,
1384
- parentUuid: null,
1385
- name: null,
1386
- address: null,
1387
- companyNumber: null,
1388
- customFields: null,
1389
- individual: null,
1390
- individualPosition: null,
1391
- vatNumber: null
1392
- },
1393
- schema: getBusinessCreateFormSchema(computed(() => I.getCustomFieldDefinitionForEntity(EntityType.BUSINESS).filter((n) => n.isDisplayedOnCreate)).value),
1394
- onSubmit: async (n) => {
1395
- await M.onSubmit(n);
1396
- }
1397
- }), q = G.register("name"), J = G.register("address"), Y = G.register("companyNumber"), X = G.register("vatNumber");
1398
- function Z(n) {
1399
- if (n === Step.SEARCH_BUSINESS) {
1400
- N("back");
1401
- return;
1402
- }
1403
- if (n === Step.MANUAL_BUSINESS) {
1404
- V.value = Step.SEARCH_BUSINESS;
1405
- return;
1406
- }
1407
- if (n === Step.SEARCH_CONTACT_PERSON) {
1408
- V.value = Step.MANUAL_BUSINESS;
1409
- return;
1410
- }
1411
- n === Step.MANUAL_CONTACT_PERSON && (V.value = Step.SEARCH_CONTACT_PERSON);
1412
- }
1413
- function Q() {
1414
- q.setValue(null), J.setValue(null), Y.setValue(null), X.setValue(null), B.value = !1, V.value = Step.MANUAL_BUSINESS;
1415
- }
1416
- async function $(n) {
1417
- if (n === null) return;
1418
- V.value = Step.MANUAL_BUSINESS, B.value = !0;
1419
- let A = n.uuid.replace(/\./g, "");
1420
- if (q.setValue(n.name), n.address !== null) {
1421
- let A = await L(n.address);
1422
- J.setValue({
1423
- ...n.address,
1424
- coordinates: A ?? {
1425
- lat: null,
1426
- lng: null
1427
- },
1428
- country: CountryCode.BE
1429
- });
1430
- } else J.setValue(null);
1431
- X.setValue({
1432
- countryCode: CountryCode.BE,
1433
- number: A
1434
- }), Y.setValue(A);
1435
- }
1436
- return (n, A) => (openBlock(), createBlock(AppDialogContainer_default, { class: "gap-xl flex flex-1 flex-col overflow-hidden" }, {
1437
- default: withCtx(() => [createVNode(AppColorProvider_default, { color: unref(F).getEntityConfig(unref(EntityType).BUSINESS)?.color ?? null }, {
1438
- default: withCtx(() => [createVNode(AppDialogHeader_default, {
1439
- title: H.value,
1440
- description: U.value,
1441
- icon: "user"
1442
- }, {
1443
- "closse-button": withCtx(() => [createVNode(unref(VcDialogCloseButton))]),
1444
- _: 1
1445
- }, 8, ["title", "description"])]),
1446
- _: 1
1447
- }, 8, ["color"]), createVNode(AppForm_default, {
1448
- "can-exit-when-dirty": !0,
1449
- form: unref(G),
1450
- class: "flex flex-1 flex-col"
1451
- }, {
1452
- default: withCtx(() => [
1453
- V.value === Step.SEARCH_BUSINESS ? (openBlock(), createBlock(ContactCreateDialogBusinessCbeSearch_default, {
1454
- key: 0,
1455
- onCreateNew: Q,
1456
- onUpdateCbeSearchItem: $,
1457
- onBack: A[0] ||= (n) => Z(Step.SEARCH_BUSINESS)
1458
- })) : createCommentVNode("", !0),
1459
- V.value === Step.MANUAL_BUSINESS ? (openBlock(), createBlock(ContactCreateDialogBusinessGeneralInfo_default, {
1460
- key: 1,
1461
- form: unref(G),
1462
- "is-data-from-cbe": B.value,
1463
- onBack: A[1] ||= (n) => Z(Step.MANUAL_BUSINESS),
1464
- onNext: A[2] ||= (n) => V.value = Step.SEARCH_CONTACT_PERSON
1465
- }, null, 8, ["form", "is-data-from-cbe"])) : createCommentVNode("", !0),
1466
- V.value === Step.SEARCH_CONTACT_PERSON ? (openBlock(), createBlock(ContactCreateDialogBusinessContactPersonSearch_default, {
1467
- key: 2,
1468
- "is-submitting": unref(G).isSubmitting.value,
1469
- "require-individual-on-create": unref(I).getConfig().businessConfig.requireIndividualOnCreate ?? !1,
1470
- form: unref(G),
1471
- onBack: A[3] ||= (n) => Z(Step.SEARCH_CONTACT_PERSON),
1472
- onNext: A[4] ||= (n) => V.value = Step.MANUAL_CONTACT_PERSON
1473
- }, null, 8, [
1474
- "is-submitting",
1475
- "require-individual-on-create",
1476
- "form"
1477
- ])) : createCommentVNode("", !0),
1478
- V.value === Step.MANUAL_CONTACT_PERSON ? (openBlock(), createBlock(ContactCreateDialogBusinessContactPerson_default, {
1479
- key: 3,
1480
- form: unref(G),
1481
- onBack: A[5] ||= (n) => Z(Step.MANUAL_CONTACT_PERSON)
1482
- }, null, 8, ["form"])) : createCommentVNode("", !0)
1483
- ]),
1484
- _: 1
1485
- }, 8, ["form"])]),
1486
- _: 1
1487
- }));
1488
- }
1489
- }), BusinessAddChildBusinessDialog_default = /* @__PURE__ */ defineComponent({
1490
- __name: "BusinessAddChildBusinessDialog",
1491
- props: { businessUuid: {} },
1492
- emits: ["close"],
1493
- setup(n, { emit: A }) {
1494
- let j = n, M = A, N = useI18n(), P = useApiErrorToast(), F = ref(!1), I = ref(null), R = useBusinessCreateMutation(), B = useBusinessAddChildBusinessMutation();
1495
- function V() {
1496
- M("close");
1497
- }
1498
- async function H(n) {
1499
- try {
1500
- let A = await R.execute({ body: n });
1501
- await B.execute({ params: {
1502
- childUuid: A,
1503
- parentUuid: j.businessUuid
1504
- } }), M("close");
1505
- } catch (n) {
1506
- P.show(n);
1507
- }
1508
- }
1509
- async function U(n) {
1510
- try {
1511
- await B.execute({ params: {
1512
- childUuid: n,
1513
- parentUuid: j.businessUuid
1514
- } }), M("close");
1515
- } catch (n) {
1516
- P.show(n);
1517
- }
1518
- }
1519
- function G() {
1520
- F.value = !1;
1521
- }
1522
- function K() {
1523
- F.value = !0;
1524
- }
1525
- return (n, A) => (openBlock(), createBlock(unref(VcDialog), {
1526
- "class-config": { content: "max-w-xl w-full" },
1527
- onClose: V
1528
- }, {
1529
- default: withCtx(() => [F.value ? (openBlock(), createBlock(ContactCreateDialogBusinessForm_default, {
1530
- key: 0,
1531
- "on-submit": H,
1532
- onBack: G
1533
- })) : (openBlock(), createBlock(AppDialogContainer_default, {
1534
- key: 1,
1535
- class: "gap-xl flex flex-1 flex-col"
1536
- }, {
1537
- default: withCtx(() => [createVNode(AppDialogHeader_default, {
1538
- title: unref(N).t("wise_crm.info_dialog.add_business_child_dialog.title"),
1539
- description: unref(N).t("wise_crm.info_dialog.add_business_child_dialog.description"),
1540
- icon: "building"
1541
- }, {
1542
- "closse-button": withCtx(() => [createVNode(unref(VcDialogCloseButton))]),
1543
- _: 1
1544
- }, 8, ["title", "description"]), createVNode(BusinessAddExistingChildForm_default, {
1545
- modelValue: I.value,
1546
- "onUpdate:modelValue": A[0] ||= (n) => I.value = n,
1547
- "parent-business-uuid": j.businessUuid,
1548
- "on-submit": U,
1549
- onCreateNew: K
1550
- }, null, 8, ["modelValue", "parent-business-uuid"])]),
1551
- _: 1
1552
- }))]),
1553
- _: 1
1554
- }));
1555
- }
1556
- });
1557
- function useBusinessLinkContactPersonMutation() {
1558
- return ze({
1559
- queryFn: async ({ body: n, params: A }) => await BusinessService.linkContactPerson(A.businessUuid, n.contactPersonUuid, n.position, n.contactInfo),
1560
- queryKeysToInvalidate: {
1561
- businessIndex: {},
1562
- wiseCrmBusinessDetail: { businessUuid: (n) => n.businessUuid }
1563
- }
1564
- });
1565
- }
1566
- var BusinessContactPersonCreateDialog_default = /* @__PURE__ */ defineComponent({
1567
- __name: "BusinessContactPersonCreateDialog",
1568
- props: {
1569
- businessUuid: {},
1570
- isCreatingNewContactPerson: {
1571
- type: Boolean,
1572
- default: !1
1573
- }
1574
- },
1575
- emits: ["close", "createNewContactPerson"],
1576
- setup(n, { emit: A }) {
1577
- let j = n, M = A, N = useI18n(), P = useApiErrorToast(), F = useBusinessLinkContactPersonMutation(), I = useContactPersonCreateMutation();
1578
- async function R(n) {
1579
- try {
1580
- let A = await I.execute({ body: {
1581
- email: n.email,
1582
- firstName: n.firstName,
1583
- lastName: n.lastName,
1584
- mobilePhone: n.mobilePhone,
1585
- phone: n.phone
1586
- } });
1587
- j.isCreatingNewContactPerson || await F.execute({
1588
- body: {
1589
- contactPersonUuid: A,
1590
- contactInfo: {
1591
- email: n.email,
1592
- mobilePhone: n.mobilePhone,
1593
- phone: n.phone
1594
- },
1595
- position: n.position
1596
- },
1597
- params: { businessUuid: j.businessUuid }
1598
- }), V({
1599
- label: `${n.firstName} ${n.lastName}`,
1600
- value: A
1601
- });
1602
- } catch (n) {
1603
- P.show(n);
1604
- }
1605
- }
1606
- async function B(n, A, M) {
1607
- if (n !== null) try {
1608
- await F.execute({
1609
- body: {
1610
- contactPersonUuid: n,
1611
- contactInfo: A,
1612
- position: M
1613
- },
1614
- params: { businessUuid: j.businessUuid }
1615
- }), V();
1616
- } catch (n) {
1617
- P.show(n);
1618
- }
1619
- }
1620
- function V(n) {
1621
- if (n === void 0) {
1622
- M("close");
1623
- return;
1624
- }
1625
- M("createNewContactPerson", n), M("close");
1626
- }
1627
- return (n, A) => (openBlock(), createBlock(AppDialog_default, {
1628
- title: unref(N).t("wise_crm.info_dialog.contact_person_create.title"),
1629
- description: unref(N).t("wise_crm.info_dialog.contact_person_create.description"),
1630
- onClose: V
1631
- }, {
1632
- default: withCtx(() => [createVNode(ContactPersonCreateForm_default, {
1633
- "on-submit": R,
1634
- "on-link-contact-person": B,
1635
- onClose: V
1636
- })]),
1637
- _: 1
1638
- }, 8, ["title", "description"]));
1639
- }
1640
- });
1641
- function useBusinessContactPersonUpdateMutation() {
1642
- return ze({
1643
- queryFn: async ({ body: n, params: A }) => await BusinessService.updateContactPerson(A.businessUuid, A.contactPersonUuid, n),
1644
- queryKeysToInvalidate: {
1645
- businessIndex: {},
1646
- contactPersonDetail: { contactPersonUuid: (n) => n.contactPersonUuid },
1647
- wiseCrmBusinessDetail: { businessUuid: (n) => n.businessUuid }
1648
- }
1649
- });
1650
- }
1651
- function useBusinessContactPersonDetailQuery(n, A) {
1652
- return He({
1653
- isEnabled: computed(() => n.value !== null && A.value !== null),
1654
- queryFn: () => {
1655
- if (n.value === null) throw Error("Individual UUID is null");
1656
- if (A.value === null) throw Error("Contact Person UUID is null");
1657
- return BusinessService.getContactPerson(n.value, A.value);
1658
- },
1659
- queryKey: { contactPersonDetail: { contactPersonUuid: A } }
1660
- });
1661
- }
1662
- var BusinessContactPersonUpdateForm_default = /* @__PURE__ */ defineComponent({
1663
- __name: "BusinessContactPersonUpdateForm",
1664
- props: {
1665
- contactPerson: {},
1666
- onSubmit: { type: Function }
1667
- },
1668
- setup(n) {
1669
- let A = n, j = useI18n(), M = useForm({
1670
- initialState: {
1671
- email: A.contactPerson.email,
1672
- firstName: A.contactPerson.firstName,
1673
- lastName: A.contactPerson.lastName,
1674
- mobilePhone: A.contactPerson.mobilePhone,
1675
- phone: A.contactPerson.phone,
1676
- position: A.contactPerson.position
1677
- },
1678
- schema: contactPersonUpdateFormSchema,
1679
- onSubmit: async (n) => {
1680
- await A.onSubmit(n);
1681
- }
1682
- });
1683
- return (n, A) => (openBlock(), createBlock(ContactPersonCreateNewForm_default, { form: unref(M) }, {
1684
- actions: withCtx(() => [createVNode(AppSidebarFormFooter_default, null, {
1685
- default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
1686
- "is-loading": unref(M).isSubmitting.value,
1687
- label: unref(j).t("wise_crm.shared.save_changes")
1688
- }, null, 8, ["is-loading", "label"])]),
1689
- _: 1
1690
- })]),
1691
- _: 1
1692
- }, 8, ["form"]));
1693
- }
1694
- }), BusinessContactPersonUpdateDialog_default = /* @__PURE__ */ defineComponent({
1695
- __name: "BusinessContactPersonUpdateDialog",
1696
- props: {
1697
- businessUuid: {},
1698
- contactPersonUuid: {}
1699
- },
1700
- emits: ["close"],
1701
- setup(n, { emit: A }) {
1702
- let j = n, M = A, N = useI18n(), P = useApiErrorToast(), F = useBusinessContactPersonUpdateMutation(), I = useBusinessContactPersonDetailQuery(computed(() => j.businessUuid), computed(() => j.contactPersonUuid));
1703
- async function R(n) {
1704
- try {
1705
- await F.execute({
1706
- body: n,
1707
- params: {
1708
- businessUuid: j.businessUuid,
1709
- contactPersonUuid: j.contactPersonUuid
1710
- }
1711
- }), M("close");
1712
- } catch (n) {
1713
- P.show(n);
1714
- }
1715
- }
1716
- function B() {
1717
- M("close");
1718
- }
1719
- return (n, A) => (openBlock(), createBlock(AppDialog_default, {
1720
- title: unref(N).t("wise_crm.info_dialog.contact_person_update.title"),
1721
- description: unref(N).t("wise_crm.info_dialog.contact_person_create.description"),
1722
- onClose: B
1723
- }, {
1724
- default: withCtx(() => [unref(I).data.value ? (openBlock(), createBlock(BusinessContactPersonUpdateForm_default, {
1725
- key: 0,
1726
- "business-uuid": j.businessUuid,
1727
- "on-submit": R,
1728
- "contact-person": unref(I).data.value,
1729
- onClose: B
1730
- }, null, 8, ["business-uuid", "contact-person"])) : createCommentVNode("", !0)]),
1731
- _: 1
1732
- }, 8, ["title", "description"]));
1733
- }
1734
- }), _hoisted_1$1 = { class: "gap-md flex items-start" }, _hoisted_2$1 = { class: "flex-1" }, _hoisted_3$1 = {
1735
- key: 0,
1736
- class: "mt-xxs"
1737
- }, _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({
1738
- __name: "BusinessDetailSidebarAccordionBusinessInfoChildren",
1739
- props: { business: {} },
1740
- emits: ["addChild"],
1741
- setup(n, { emit: A }) {
1742
- let j = n, N = A, P = useI18n(), F = useEntityDetail(), I = computed(() => j.business.children), L = computed(() => I.value.length > 1 ? P.t("wise_crm.shared.departments_amount", { value: I.value.length }) : I.value[0]?.name ?? "");
1743
- function R() {
1744
- N("addChild");
1745
- }
1746
- function B(n) {
1747
- F.open(EntityType.BUSINESS, n);
1748
- }
1749
- return (n, A) => (openBlock(), createElementBlock("div", _hoisted_1$1, [createVNode(unref(VcIcon), {
1750
- icon: "layersTree",
1751
- class: "mt-xs size-4 shrink-0"
1752
- }), createElementVNode("div", _hoisted_2$1, [
1753
- j.business.parent === null ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_3$1, [createVNode(AppOpenEntityButton_default, {
1754
- "class-config": { root: "bg-transparent w-min border-none text-primary shadow-none h-auto hover:underline p-0 font-regular" },
1755
- "entity-type": unref(EntityType).BUSINESS,
1756
- uuid: j.business.parent.uuid
1757
- }, {
1758
- default: withCtx(() => [createTextVNode(toDisplayString(j.business.parent.name), 1)]),
1759
- _: 1
1760
- }, 8, ["entity-type", "uuid"])])),
1761
- createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [j.business.parent === null ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(VcIcon), {
1762
- key: 0,
1763
- icon: "timeLineMarker",
1764
- class: "text-brand-500 size-4"
1765
- })), createElementVNode("p", _hoisted_6, toDisplayString(j.business.name), 1)]), createVNode(unref(VcIconButton), {
1766
- "class-config": {
1767
- 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",
1768
- icon: "text-quaternary size-4"
1769
- },
1770
- label: unref(P).t("wise_crm.info_dialog.sidebar.business.add_icon"),
1771
- icon: "plus",
1772
- onClick: R
1773
- }, null, 8, ["label"])]),
1774
- I.value.length > 0 ? (openBlock(), createElementBlock("div", {
1775
- key: 1,
1776
- class: normalizeClass([{ "ml-2xl": j.business.parent !== null }, "gap-sm flex items-center"])
1777
- }, [createVNode(unref(VcIcon), {
1778
- icon: "timeLineMarker",
1779
- class: "text-brand-500 size-4"
1780
- }), createVNode(unref(VcPopover), {
1781
- "is-popover-arrow-hidden": !0,
1782
- "class-config": { content: "w-100" },
1783
- "popover-align": "start",
1784
- "popover-side": "right"
1785
- }, {
1786
- trigger: withCtx(() => [createVNode(unref(VcButton), {
1787
- "class-config": { root: "bg-transparent text-primary text-sm border-none p-0 h-auto rounded-none shadow-none font-normal" },
1788
- variant: "secondary",
1789
- class: "underline"
1790
- }, {
1791
- default: withCtx(() => [createTextVNode(toDisplayString(L.value), 1)]),
1792
- _: 1
1793
- })]),
1794
- content: withCtx(() => [createElementVNode("div", _hoisted_7, [createVNode(CrmDetailAccordionRoot_default, {
1795
- "default-values": I.value[0]?.uuid ?? "",
1796
- type: "single"
1797
- }, {
1798
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(I.value, (n) => (openBlock(), createBlock(CrmDetailSidebarAccordionItem_default, {
1799
- key: n.uuid,
1800
- label: n.name,
1801
- value: n.uuid,
1802
- icon: "building"
1803
- }, {
1804
- actions: withCtx(() => [createVNode(unref(VcIconButton), {
1805
- "class-config": {
1806
- 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",
1807
- icon: "text-quaternary size-4"
1808
- },
1809
- label: unref(P).t("wise_crm.info_dialog.sidebar.business.add_icon"),
1810
- icon: "linkExternal",
1811
- onClick: (A) => B(n.uuid)
1812
- }, null, 8, ["label", "onClick"])]),
1813
- default: withCtx(() => [createVNode(CrmDetailSidebarCard_default, { class: "gap-md flex flex-col" }, {
1814
- default: withCtx(() => [
1815
- createVNode(AppIconLabelPair_default, {
1816
- label: n.vatNumber ?? "-",
1817
- icon: "buildings"
1818
- }, null, 8, ["label"]),
1819
- createVNode(AppIconLabelPair_default, {
1820
- label: n.email ?? "-",
1821
- icon: "mail"
1822
- }, null, 8, ["label"]),
1823
- createVNode(AppIconLabelPair_default, {
1824
- label: n.mobilePhone ?? n.phone ?? "-",
1825
- icon: "phone"
1826
- }, null, 8, ["label"]),
1827
- createVNode(AppIconLabelPair_default, {
1828
- label: n.address ? unref(AddressUtil).formatShort(n.address) : "-",
1829
- icon: "locationPin"
1830
- }, null, 8, ["label"])
1831
- ]),
1832
- _: 2
1833
- }, 1024)]),
1834
- _: 2
1835
- }, 1032, ["label", "value"]))), 128))]),
1836
- _: 1
1837
- }, 8, ["default-values"])])]),
1838
- _: 1
1839
- })], 2)) : createCommentVNode("", !0)
1840
- ])]));
1841
- }
1842
- }), VatNumberUtil = class {
1843
- static format(n) {
1844
- return n === null ? "" : `${n.countryCode}${n.number}`;
1845
- }
1846
- }, _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({
1847
- __name: "BusinessDetailSidebarAccordionBusinessInfo",
1848
- props: { business: {} },
1849
- emits: ["addChild"],
1850
- setup(n, { emit: A }) {
1851
- let j = n, M = A, N = useI18n();
1852
- function P() {
1853
- M("addChild");
1854
- }
1855
- return (A, M) => (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(CrmDetailSidebarCard_default, null, {
1856
- default: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(AppIconLabelPair_default, {
1857
- label: j.business.vatNumber ? unref(VatNumberUtil).format(j.business.vatNumber) : "-",
1858
- icon: "buildings"
1859
- }, null, 8, ["label"]), createVNode(BusinessDetailSidebarAccordionBusinessInfoChildren_default, {
1860
- business: n.business,
1861
- onAddChild: P
1862
- }, null, 8, ["business"])]), createElementVNode("div", _hoisted_3, [createVNode(AppIconLabelPair_default, {
1863
- label: unref(N).t("wise_crm.info_dialog.sidebar.overview.created_at_label", { value: j.business.createdAt ? unref(useDateTimeFormat)().toDateTime(j.business.createdAt) : "-" }),
1864
- icon: "clockPlus"
1865
- }, null, 8, ["label"])])]),
1866
- _: 1
1867
- }), createVNode(CrmDetailSidebarMapCard_default, { address: j.business.address }, null, 8, ["address"])]));
1868
- }
1869
- }), BusinessDetailSidebarOverviewContent_default = /* @__PURE__ */ defineComponent({
1870
- __name: "BusinessDetailSidebarOverviewContent",
1871
- props: { business: {} },
1872
- setup(n) {
1873
- let A = n, j = useI18n(), M = useApiErrorToast(), N = useDialog(AppConfirmDialog_default), P = useBusinessPrimaryContactPersonUpdateMutation(), F = useBusinessUnlinkContactPersonMutation(), I = useDialog(BusinessContactPersonCreateDialog_default), R = useDialog(BusinessContactPersonUpdateDialog_default), B = useDialog(BusinessAddChildBusinessDialog_default), V = computed(() => A.business.contactPersons.length > 0);
1874
- function H() {
1875
- I.open({ businessUuid: A.business.uuid });
1876
- }
1877
- function U(n) {
1878
- R.open({
1879
- businessUuid: A.business.uuid,
1880
- contactPersonUuid: n
1881
- });
1882
- }
1883
- function W(n) {
1884
- N.open({
1885
- title: j.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_title"),
1886
- isDestructive: !0,
1887
- isLoading: F.isLoading.value,
1888
- confirmText: j.t("shared.delete"),
1889
- description: j.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_description"),
1890
- onConfirm: async () => {
1891
- try {
1892
- await F.execute({
1893
- body: { contactPersonUuid: n },
1894
- params: { businessUuid: A.business.uuid }
1895
- });
1896
- } catch (n) {
1897
- M.show(n);
1898
- } finally {
1899
- N.close();
1900
- }
1901
- }
1902
- });
1903
- }
1904
- function G(n) {
1905
- P.execute({ params: {
1906
- businessUuid: A.business.uuid,
1907
- contactPersonUuid: n
1908
- } });
1909
- }
1910
- function K() {
1911
- B.open({ businessUuid: A.business.uuid });
1912
- }
1913
- return (M, N) => (openBlock(), createBlock(CrmDetailAccordionRoot_default, { "default-values": [
1914
- "business",
1915
- "invoice",
1916
- "contact-persons"
1917
- ] }, {
1918
- default: withCtx(() => [
1919
- createVNode(CrmDetailSidebarAccordionItem_default, {
1920
- label: unref(j).t("wise_crm.info_dialog.sidebar.overview.business_info"),
1921
- value: "business",
1922
- icon: "infoCircle"
1923
- }, {
1924
- default: withCtx(() => [createVNode(BusinessDetailSidebarAccordionBusinessInfo_default, {
1925
- business: n.business,
1926
- onAddChild: K
1927
- }, null, 8, ["business"])]),
1928
- _: 1
1929
- }, 8, ["label"]),
1930
- createVNode(CrmDetailSidebarAccordionItem_default, {
1931
- "is-empty": A.business.billingInformation === null,
1932
- label: unref(j).t("wise_crm.info_dialog.sidebar.overview.invoice_label"),
1933
- value: "invoice",
1934
- icon: "wallet"
1935
- }, {
1936
- default: withCtx(() => [A.business.billingInformation ? (openBlock(), createBlock(CrmDetailSidebarAccordionBillingInformation_default, {
1937
- key: 0,
1938
- "invoice-address": A.business.billingInformation?.location?.address ?? null,
1939
- "invoice-email": A.business.billingInformation?.invoiceEmail
1940
- }, null, 8, ["invoice-address", "invoice-email"])) : createCommentVNode("", !0)]),
1941
- _: 1
1942
- }, 8, ["is-empty", "label"]),
1943
- createVNode(CrmDetailSidebarAccordionItem_default, {
1944
- "is-empty": !V.value,
1945
- label: unref(j).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
1946
- value: "contact-persons",
1947
- icon: "userCircle",
1948
- onAdd: H
1949
- }, {
1950
- actions: withCtx(() => [V.value ? createCommentVNode("", !0) : (openBlock(), createBlock(CrmDetailSidebarAccordionHeaderIconButton_default, {
1951
- key: 0,
1952
- label: unref(j).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
1953
- class: "z-1",
1954
- icon: "plus",
1955
- onClick: H
1956
- }, null, 8, ["label"]))]),
1957
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(A.business.contactPersons, (n) => (openBlock(), createBlock(unref(Motion), {
1958
- key: n.uuid,
1959
- "layout-id": n.uuid
1960
- }, {
1961
- default: withCtx(() => [createVNode(CrmDetailSidebarAccordionContactPersonInfo_default, {
1962
- "contact-person": n,
1963
- "on-toggle-is-primary": () => G(n.uuid),
1964
- onUpdate: (A) => U(n.uuid),
1965
- onDelete: (A) => W(n.uuid)
1966
- }, null, 8, [
1967
- "contact-person",
1968
- "on-toggle-is-primary",
1969
- "onUpdate",
1970
- "onDelete"
1971
- ])]),
1972
- _: 2
1973
- }, 1032, ["layout-id"]))), 128)), V.value ? (openBlock(), createBlock(unref(VcButton), {
1974
- key: 0,
1975
- variant: "tertiary",
1976
- size: "sm",
1977
- "icon-left": "plus",
1978
- onClick: H
1979
- }, {
1980
- default: withCtx(() => [createTextVNode(toDisplayString(unref(j).t("wise_crm.shared.add")), 1)]),
1981
- _: 1
1982
- })) : createCommentVNode("", !0)]),
1983
- _: 1
1984
- }, 8, ["is-empty", "label"])
1985
- ]),
1986
- _: 1
1987
- }));
1988
- }
1989
- }), InfoTab = /* @__PURE__ */ function(n) {
1990
- return n.ACTIVITY = "activity", n.NOTES = "notes", n.OVERVIEW = "overview", n;
1991
- }(InfoTab || {}), BusinessDetailSidebar_default = /* @__PURE__ */ defineComponent({
1992
- __name: "BusinessDetailSidebar",
1993
- props: { business: {} },
1994
- setup(n) {
1995
- let A = n, j = useI18n(), M = useCrm(), N = computed(() => M.getEntityConfig(EntityType.BUSINESS)), P = ref(InfoTab.OVERVIEW), F = computed(() => [
1996
- {
1997
- icon: "infoCircle",
1998
- label: j.t("wise_crm.shared.overview"),
1999
- value: InfoTab.OVERVIEW
2000
- },
2001
- {
2002
- icon: "activity",
2003
- label: j.t("wise_crm.shared.activity"),
2004
- value: InfoTab.ACTIVITY
2005
- },
2006
- {
2007
- icon: "book",
2008
- label: j.t("wise_crm.shared.notes"),
2009
- value: InfoTab.NOTES
2010
- }
2011
- ]);
2012
- return (n, j) => (openBlock(), createBlock(AppColorProvider_default, {
2013
- color: unref(M).getEntityConfig(unref(EntityType).BUSINESS)?.color ?? null,
2014
- class: "flex h-full flex-col"
2015
- }, {
2016
- default: withCtx(() => [createVNode(CrmDetailHeaderCard_default, {
2017
- "entity-type": unref(EntityType).BUSINESS,
2018
- name: A.business.name,
2019
- address: A.business.address,
2020
- email: A.business.email,
2021
- "mobile-phone": A.business.mobilePhone,
2022
- "entity-name": N.value?.name ?? null,
2023
- phone: A.business.phone
2024
- }, null, 8, [
2025
- "entity-type",
2026
- "name",
2027
- "address",
2028
- "email",
2029
- "mobile-phone",
2030
- "entity-name",
2031
- "phone"
2032
- ]), createVNode(CrmDetailSidebarTabs_default, {
2033
- modelValue: P.value,
2034
- "onUpdate:modelValue": j[0] ||= (n) => P.value = n,
2035
- tabs: F.value
2036
- }, {
2037
- default: withCtx(() => [
2038
- P.value === InfoTab.OVERVIEW ? (openBlock(), createBlock(BusinessDetailSidebarOverviewContent_default, {
2039
- key: 0,
2040
- business: A.business
2041
- }, null, 8, ["business"])) : createCommentVNode("", !0),
2042
- P.value === InfoTab.ACTIVITY ? (openBlock(), createBlock(BusinessDetailSidebarActivityContent_default, {
2043
- key: 1,
2044
- business: A.business
2045
- }, null, 8, ["business"])) : createCommentVNode("", !0),
2046
- P.value === InfoTab.NOTES ? (openBlock(), createBlock(BusinessDetailSidebarNotesContent_default, {
2047
- key: 2,
2048
- business: A.business
2049
- }, null, 8, ["business"])) : createCommentVNode("", !0)
2050
- ]),
2051
- _: 1
2052
- }, 8, ["modelValue", "tabs"])]),
2053
- _: 1
2054
- }, 8, ["color"]));
2055
- }
2056
- }), BusinessDetailSidebarProvider_default = /* @__PURE__ */ defineComponent({
2057
- __name: "BusinessDetailSidebarProvider",
2058
- props: { businessUuid: {} },
2059
- setup(n) {
2060
- let A = n, j = useI18n(), M = useBusinessDetailQuery(computed(() => A.businessUuid)), N = computed(() => M.data.value ?? null);
2061
- return (n, A) => (openBlock(), createBlock(CrmDetailContainer_default, null, {
2062
- default: withCtx(() => [unref(M).isError.value ? (openBlock(), createBlock(Error_default, {
2063
- key: 0,
2064
- message: unref(j).t("error.business_details.description"),
2065
- title: unref(j).t("error.business_details.title")
2066
- }, null, 8, ["message", "title"])) : unref(M).isLoading.value ? (openBlock(), createBlock(AppSkeletonLoader_default, {
2067
- key: 1,
2068
- class: "h-full"
2069
- })) : N.value ? (openBlock(), createBlock(BusinessDetailSidebar_default, {
2070
- key: 2,
2071
- business: N.value
2072
- }, null, 8, ["business"])) : createCommentVNode("", !0)]),
2073
- _: 1
2074
- }));
2075
- }
2076
- });
2077
- 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 };