@wisemen/wise-crm-web 0.2.0 → 0.2.2

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