@wisemen/wise-crm-web 0.2.1 → 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.
- package/README.md +1037 -0
- package/dist/BusinessDetailSidebarProvider-BQMRbGHQ.js +2083 -0
- package/dist/{BusinessDetailView-BbfUJk4T.js → BusinessDetailView-BxGxWOme.js} +5 -5
- package/dist/{CrmDetailHeaderCard-oRgvRuFD.js → CrmDetailHeaderCard-CCNJpMAK.js} +68 -67
- package/dist/{CrmDetailView-B0ZN_Fnu.js → CrmDetailView-ozCpuaX2.js} +14 -14
- package/dist/{DealCommunicationTabView-e7NkRy9r.js → DealCommunicationTabView-Df5EeolN.js} +2 -2
- package/dist/{DealDetailView-BPIatW_2.js → DealDetailView-DdWHqaBr.js} +163 -163
- package/dist/{DealExternalAttachment-D1PznE3V.js → DealExternalAttachment-qHdh4yMI.js} +1 -1
- package/dist/{DealSendMailDialog-BK_lUIx6.js → DealSendMailDialog-BaYcWZP-.js} +65 -69
- package/dist/Error-BArv9rNb.js +12650 -0
- package/dist/IndividualDetailSidebarProvider-BXZH951l.js +608 -0
- package/dist/{IndividualDetailView-Cdodb8Ii.js → IndividualDetailView-DfYS31-e.js} +5 -5
- package/dist/LinkBrokenIcon-CTlqmapl.js +17 -0
- package/dist/api/mutations/deal/dealCreate.mutation.d.ts +1 -1
- package/dist/api/mutations/deal/dealUpdate.mutation.d.ts +3 -3
- package/dist/api/mutations/mail-template/mailTemplateUpdate.mutation.d.ts +1 -1
- package/dist/client/apiErrorCode.gen.d.ts +2 -2
- package/dist/client/sdk.gen.d.ts +20 -17
- package/dist/client/types.gen.d.ts +1057 -1376
- package/dist/client/zod.gen.d.ts +15453 -17750
- package/dist/{client-BP13IBbl.js → client-pCaNxE3C.js} +748 -1047
- package/dist/components/crm-detail/CrmDetailHeaderCard.vue.d.ts +2 -0
- package/dist/deal/components/DealSendMailForm.vue.d.ts +2 -2
- package/dist/icons/LinkBrokenIcon.vue.d.ts +3 -0
- package/dist/icons/icon.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +448 -453
- package/dist/models/brand-colors/brandColor.model.d.ts +14 -0
- package/dist/models/brand-colors/brandColor.transformer.d.ts +5 -0
- package/dist/models/conent-locale/contentLocaleEnum.model.d.ts +3 -3
- package/dist/models/deal/create/dealCreateForm.model.d.ts +2 -2
- package/dist/models/deal/detail/dealDetail.model.d.ts +2 -2
- package/dist/models/deal/index/dealIndex.model.d.ts +2 -2
- package/dist/models/deal/update/dealUpdateForm.model.d.ts +2 -2
- package/dist/models/mail-template/detail/mailTemplateDetail.model.d.ts +2 -2
- package/dist/models/mail-template/update/mailTemplateUpdateForm.model.d.ts +3 -3
- package/dist/models/phone-number/phoneNumberForm.model.d.ts +3 -0
- package/dist/models/tenant-config/tenantConfig.model.d.ts +3 -0
- package/dist/plugins/i18n.plugin.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/testing/factories/business.factory.d.ts +2 -1
- package/dist/testing.js +23 -2
- package/package.json +2 -1
- package/dist/BusinessDetailSidebarProvider-BrpWqjRs.js +0 -2081
- package/dist/Error-iBGGWZtH.js +0 -3695
- package/dist/IndividualDetailSidebarProvider-DUVi7XF0.js +0 -606
- /package/dist/{LinkExternalIcon-B9Qg55Oa.js → LinkExternalIcon-LOVtSqBT.js} +0 -0
- /package/dist/{LinkIcon-DCW5zjbQ.js → LinkIcon-DqBbVrvs.js} +0 -0
- /package/dist/{LocationPinIcon-DBc-wt2e.js → LocationPinIcon-Cp-wRgk2.js} +0 -0
- /package/dist/{MailIcon-Do4a7S2W.js → MailIcon-CnTrB1k3.js} +0 -0
- /package/dist/{MobilePhoneIcon-DSXyKwjd.js → MobilePhoneIcon-B747hmpS.js} +0 -0
- /package/dist/{NumberedListIcon-DUaSJSYu.js → NumberedListIcon-amJxDaaD.js} +0 -0
- /package/dist/{PhoneIcon-C8Cv1IiW.js → PhoneIcon-94MYVL85.js} +0 -0
- /package/dist/{RefreshIcon-CKZgHIZU.js → RefreshIcon-DRe3coBc.js} +0 -0
- /package/dist/{SendIcon-B-sQkQ3W.js → SendIcon-MYItp1xI.js} +0 -0
- /package/dist/{SettingsIcon-DzP-IQS5.js → SettingsIcon-C0qTAv0w.js} +0 -0
- /package/dist/{StarOutlineIcon-c0VfXRdQ.js → StarOutlineIcon-CiFLgepk.js} +0 -0
- /package/dist/{StarYellowIcon-CH0CnlSU.js → StarYellowIcon-C0v_XGwI.js} +0 -0
- /package/dist/{ThreeDotsIcon-C6PCFq5J.js → ThreeDotsIcon-lujOTU3G.js} +0 -0
- /package/dist/{TimeLineMarkerIcon-6B6SbwTN.js → TimeLineMarkerIcon-C4LfErbc.js} +0 -0
- /package/dist/{TrashIcon-BTPSVviz.js → TrashIcon-v4L9SEK_.js} +0 -0
- /package/dist/{UploadCloudIcon-1aMW5OJq.js → UploadCloudIcon-j1-1Rvqb.js} +0 -0
- /package/dist/{UserCircleIcon-D-19dc-2.js → UserCircleIcon-BjUt_2C4.js} +0 -0
- /package/dist/{UserIcon-D1H8TGlg.js → UserIcon-Cb2jFKLr.js} +0 -0
- /package/dist/{VerticalDotsIcon-DmPza4Jd.js → VerticalDotsIcon-Y3m6tlQ2.js} +0 -0
- /package/dist/{WalletIcon-BlI3D3v-.js → WalletIcon-pPsKbzmh.js} +0 -0
|
@@ -0,0 +1,2083 @@
|
|
|
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-BArv9rNb.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-CCNJpMAK.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-pCaNxE3C.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
|
+
}, BusinessCreateTransformer = class {
|
|
63
|
+
static toDto(n) {
|
|
64
|
+
return {
|
|
65
|
+
childUuid: n.childUuid,
|
|
66
|
+
individualUuid: n.individualUuid,
|
|
67
|
+
parentUuid: n.parentUuid,
|
|
68
|
+
name: n.name,
|
|
69
|
+
address: AddressTransformer.toDto(n.address),
|
|
70
|
+
companyNumber: n.companyNumber,
|
|
71
|
+
customFields: n.customFields,
|
|
72
|
+
individual: n.individual ? {
|
|
73
|
+
email: n.individual.email,
|
|
74
|
+
firstName: n.individual.firstName,
|
|
75
|
+
lastName: n.individual.lastName,
|
|
76
|
+
mobilePhone: n.individual.mobilePhone,
|
|
77
|
+
phone: n.individual.phone
|
|
78
|
+
} : null,
|
|
79
|
+
individualPosition: null,
|
|
80
|
+
vatNumber: n.vatNumber ? {
|
|
81
|
+
countryCode: CountryCode.BE,
|
|
82
|
+
number: n.vatNumber.number ?? ""
|
|
83
|
+
} : null
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}, BusinessNodeTransformer = class {
|
|
87
|
+
static fromDto(n) {
|
|
88
|
+
return {
|
|
89
|
+
uuid: n.uuid,
|
|
90
|
+
createdAt: ZonedDateTimeTransformer.fromDto(n.createdAt),
|
|
91
|
+
name: n.name,
|
|
92
|
+
address: AddressTransformer.fromNullableDto(n.location?.address ?? null),
|
|
93
|
+
companyNumber: n.companyNumber,
|
|
94
|
+
email: n.email,
|
|
95
|
+
mobilePhone: n.mobilePhone,
|
|
96
|
+
phone: n.phone,
|
|
97
|
+
vatNumber: n.vatNumber?.number ?? null
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}, VatNumberTransformer = class {
|
|
101
|
+
static fromDto(n) {
|
|
102
|
+
return {
|
|
103
|
+
countryCode: n.countryCode,
|
|
104
|
+
number: n.number
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
static fromNullableDto(n) {
|
|
108
|
+
return n === null ? null : this.fromDto(n);
|
|
109
|
+
}
|
|
110
|
+
toDto(n) {
|
|
111
|
+
return {
|
|
112
|
+
countryCode: n.countryCode,
|
|
113
|
+
number: n.number
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
toNullableDto(n) {
|
|
117
|
+
return n === null ? null : this.toDto(n);
|
|
118
|
+
}
|
|
119
|
+
}, BusinessDetailTransformer = class {
|
|
120
|
+
static fromDto(n) {
|
|
121
|
+
return {
|
|
122
|
+
uuid: n.uuid,
|
|
123
|
+
createdAt: ZonedDateTimeTransformer.fromDto(n.createdAt),
|
|
124
|
+
updatedAt: ZonedDateTimeTransformer.fromDto(n.updatedAt),
|
|
125
|
+
name: n.name,
|
|
126
|
+
address: AddressTransformer.fromNullableDto(n.location?.address ?? null),
|
|
127
|
+
billingInformation: n.billingInformation === null ? null : {
|
|
128
|
+
uuid: n.billingInformation.uuid,
|
|
129
|
+
invoiceCcEmails: n.billingInformation.invoiceCcEmails ?? [],
|
|
130
|
+
invoiceEmail: n.billingInformation.invoiceEmail ?? "",
|
|
131
|
+
location: n.billingInformation.location ? {
|
|
132
|
+
uuid: n.billingInformation.location.uuid,
|
|
133
|
+
createdAt: ZonedDateTimeTransformer.fromDto(n.billingInformation.location.createdAt),
|
|
134
|
+
updatedAt: ZonedDateTimeTransformer.fromDto(n.billingInformation.location.updatedAt),
|
|
135
|
+
address: AddressTransformer.fromDto(n.billingInformation.location.address)
|
|
136
|
+
} : null,
|
|
137
|
+
purchaseNoteCcEmails: n.billingInformation.purchaseNoteCcEmails ?? [],
|
|
138
|
+
purchaseNoteEmail: n.billingInformation.purchaseNoteEmail ?? "",
|
|
139
|
+
reminderCcEmails: n.billingInformation.reminderCcEmails ?? [],
|
|
140
|
+
reminderEmail: n.billingInformation.reminderEmail ?? ""
|
|
141
|
+
},
|
|
142
|
+
companyNumber: n.companyNumber,
|
|
143
|
+
contactPersons: n.contactPersons.map((n) => ({
|
|
144
|
+
uuid: n.uuid,
|
|
145
|
+
isPrimary: n.isPrimary,
|
|
146
|
+
email: n.email,
|
|
147
|
+
firstName: n.firstName,
|
|
148
|
+
lastName: n.lastName,
|
|
149
|
+
mobilePhone: n.mobilePhone,
|
|
150
|
+
phone: n.phone,
|
|
151
|
+
position: n.position
|
|
152
|
+
})),
|
|
153
|
+
customFields: n.customFields,
|
|
154
|
+
email: n.email,
|
|
155
|
+
language: n.language,
|
|
156
|
+
location: n.location === null ? null : {
|
|
157
|
+
uuid: n.location.uuid,
|
|
158
|
+
createdAt: ZonedDateTimeTransformer.fromDto(n.location.createdAt),
|
|
159
|
+
updatedAt: ZonedDateTimeTransformer.fromDto(n.location.updatedAt),
|
|
160
|
+
address: AddressTransformer.fromDto(n.location.address)
|
|
161
|
+
},
|
|
162
|
+
mobilePhone: n.mobilePhone,
|
|
163
|
+
parent: n.parent ? BusinessNodeTransformer.fromDto(n.parent) : null,
|
|
164
|
+
phone: n.phone,
|
|
165
|
+
vatNumber: VatNumberTransformer.fromNullableDto(n.vatNumber),
|
|
166
|
+
children: n.children.map(BusinessNodeTransformer.fromDto)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}, BusinessIndexTransformer = class {
|
|
170
|
+
static fromDto(n) {
|
|
171
|
+
return {
|
|
172
|
+
uuid: n.uuid,
|
|
173
|
+
name: n.name,
|
|
174
|
+
companyNumber: n.companyNumber,
|
|
175
|
+
email: n.email,
|
|
176
|
+
mobilePhone: n.mobilePhone,
|
|
177
|
+
phone: n.phone,
|
|
178
|
+
vatNumber: VatNumberTransformer.fromNullableDto(n.vatNumber)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}, businessIndexQueryParamsTransformer = class {
|
|
182
|
+
static toDto(n) {
|
|
183
|
+
return {
|
|
184
|
+
pagination: n.pagination,
|
|
185
|
+
search: n.search?.trim() || void 0
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}, BusinessStatisticsTransformer = class {
|
|
189
|
+
static fromDto(n) {
|
|
190
|
+
return {
|
|
191
|
+
monthlyAdded: n.monthlyAdded,
|
|
192
|
+
monthlyPercentageGrowth: n.monthlyPercentageGrowth,
|
|
193
|
+
total: n.total
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}, BusinessUpdateTransformer = class {
|
|
197
|
+
static toDto(n) {
|
|
198
|
+
return {
|
|
199
|
+
name: n.name,
|
|
200
|
+
address: AddressTransformer.toDto(n.address),
|
|
201
|
+
companyNumber: n.companyNumber,
|
|
202
|
+
customFields: n.customFields,
|
|
203
|
+
email: n.email,
|
|
204
|
+
language: n.language,
|
|
205
|
+
mobilePhone: n.mobilePhone,
|
|
206
|
+
phone: n.phone,
|
|
207
|
+
vatNumber: {
|
|
208
|
+
countryCode: CountryCode.BE,
|
|
209
|
+
number: n.vatNumber?.number ?? ""
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}, BusinessService = class {
|
|
214
|
+
static async addChildBusiness(n, A) {
|
|
215
|
+
await linkBusinessAsChildV1({ path: {
|
|
216
|
+
businessUuid: n,
|
|
217
|
+
childUuid: A
|
|
218
|
+
} });
|
|
219
|
+
}
|
|
220
|
+
static async create(n) {
|
|
221
|
+
return (await createBusinessV1({ body: BusinessCreateTransformer.toDto(n) })).data.uuid;
|
|
222
|
+
}
|
|
223
|
+
static async findByName(n) {
|
|
224
|
+
let A = await viewBusinessIndexV1({ query: new PaginationParamsBuilder().withSearch(n).build() });
|
|
225
|
+
return {
|
|
226
|
+
data: A.data.items.map(BusinessIndexTransformer.fromDto),
|
|
227
|
+
meta: A.data.meta
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
static async getActivity(n, A) {
|
|
231
|
+
let j = await viewBusinessActivityLogIndexV1({
|
|
232
|
+
query: new PaginationParamsBuilder(A).buildKeyset(ActivityIndexPaginationTransformer.toDto),
|
|
233
|
+
responseValidator: void 0,
|
|
234
|
+
path: { businessUuid: n }
|
|
235
|
+
});
|
|
236
|
+
return {
|
|
237
|
+
data: j.data.items.map(ActivityIndexTransformer.fromDto),
|
|
238
|
+
meta: {
|
|
239
|
+
next: j.data.meta.next,
|
|
240
|
+
total: j.data.items.length
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
static async getAll(n) {
|
|
245
|
+
let A = await viewBusinessIndexV1({ query: businessIndexQueryParamsTransformer.toDto(n) });
|
|
246
|
+
return {
|
|
247
|
+
data: A.data.items.map(BusinessIndexTransformer.fromDto),
|
|
248
|
+
meta: A.data.meta
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
static async getBillingInformation(n) {
|
|
252
|
+
let A = await viewBusinessBillingInformationDetailV1({ path: { businessUuid: n } });
|
|
253
|
+
return BusinessBillingInformationTransformer.fromDto(A.data);
|
|
254
|
+
}
|
|
255
|
+
static async getByUuid(n) {
|
|
256
|
+
let A = await viewBusinessDetailV1({ path: { businessUuid: n } });
|
|
257
|
+
return BusinessDetailTransformer.fromDto(A.data);
|
|
258
|
+
}
|
|
259
|
+
static async getContactPerson(n, A) {
|
|
260
|
+
let j = await viewBusinessContactPersonDetailV1({ path: {
|
|
261
|
+
businessUuid: n,
|
|
262
|
+
contactPersonUuid: A
|
|
263
|
+
} });
|
|
264
|
+
return BusinessContactPersonTransformer.fromDto(j.data);
|
|
265
|
+
}
|
|
266
|
+
static async getStatistics() {
|
|
267
|
+
let n = await viewBusinessStatisticsV1();
|
|
268
|
+
return BusinessStatisticsTransformer.fromDto(n.data);
|
|
269
|
+
}
|
|
270
|
+
static async linkContactPerson(n, A, j, M) {
|
|
271
|
+
await linkContactPersonToBusinessV1({
|
|
272
|
+
body: {
|
|
273
|
+
contactPersonUuid: A,
|
|
274
|
+
email: StringUtil.trimOrNull(M.email),
|
|
275
|
+
mobilePhone: M.mobilePhone,
|
|
276
|
+
phone: M.phone,
|
|
277
|
+
position: j
|
|
278
|
+
},
|
|
279
|
+
responseValidator: void 0,
|
|
280
|
+
path: { businessUuid: n }
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
static async setPrimaryContactPersonForBusiness(n, A) {
|
|
284
|
+
await makeBusinessContactPersonPrimaryV1({ path: {
|
|
285
|
+
businessUuid: n,
|
|
286
|
+
contactPersonUuid: A
|
|
287
|
+
} });
|
|
288
|
+
}
|
|
289
|
+
static async unlinkContactPerson(n, A) {
|
|
290
|
+
await unlinkContactPersonFromBusinessV1({
|
|
291
|
+
body: { contactPersonUuid: A },
|
|
292
|
+
responseValidator: void 0,
|
|
293
|
+
path: { businessUuid: n }
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
static async update(n, A) {
|
|
297
|
+
await updateBusinessV1({
|
|
298
|
+
body: BusinessUpdateTransformer.toDto(A),
|
|
299
|
+
path: { businessUuid: n }
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
static async updateContactPerson(n, A, j) {
|
|
303
|
+
await updateBusinessContactPersonV1({
|
|
304
|
+
body: ContactPersonUpdateTransformer.toDto(j),
|
|
305
|
+
path: {
|
|
306
|
+
businessUuid: n,
|
|
307
|
+
contactPersonUuid: A
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
static async upsertBillingInformation(n, A) {
|
|
312
|
+
await upsertBusinessBillingInformationV1({
|
|
313
|
+
body: BusinessBillingInformationUpdateTransformer.toDto(A),
|
|
314
|
+
path: { businessUuid: n }
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
function useBusinessDetailQuery(n) {
|
|
319
|
+
return He({
|
|
320
|
+
isEnabled: computed(() => n.value !== null),
|
|
321
|
+
queryFn: async () => (assert(n.value !== null, "businessUuid is null"), await BusinessService.getByUuid(n.value)),
|
|
322
|
+
queryKey: { wiseCrmBusinessDetail: { businessUuid: n } }
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function useBusinessActivityIndexQuery(n, A) {
|
|
326
|
+
return Be({
|
|
327
|
+
paginationOptions: A,
|
|
328
|
+
queryFn: async (A) => await BusinessService.getActivity(n.value, A),
|
|
329
|
+
queryKey: { businessActivityIndex: { paginationOptions: A } }
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
var BusinessDetailSidebarActivityContent_default = /* @__PURE__ */ defineComponent({
|
|
333
|
+
__name: "BusinessDetailSidebarActivityContent",
|
|
334
|
+
props: { business: {} },
|
|
335
|
+
setup(n) {
|
|
336
|
+
let A = n, j = usePagination({
|
|
337
|
+
isRouteQueryEnabled: !1,
|
|
338
|
+
type: "keyset"
|
|
339
|
+
}), M = useBusinessActivityIndexQuery(computed(() => A.business.uuid), j.paginationOptions), N = computed(() => M.data.value.data ?? []);
|
|
340
|
+
async function P() {
|
|
341
|
+
await M.getNextPage();
|
|
342
|
+
}
|
|
343
|
+
return (n, A) => (openBlock(), createBlock(ActivityList_default, {
|
|
344
|
+
"on-next": P,
|
|
345
|
+
"is-loading": unref(M).isLoading.value,
|
|
346
|
+
activities: N.value
|
|
347
|
+
}, null, 8, ["is-loading", "activities"]));
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
function useNoteBusinessCreateMutation() {
|
|
351
|
+
return ze({
|
|
352
|
+
queryFn: async ({ body: A, params: j }) => await NoteService.create(A, { businessUuid: j.businessUuid }),
|
|
353
|
+
queryKeysToInvalidate: { noteBusinessIndex: {} }
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function useNoteBusinessIndexQuery(A, j) {
|
|
357
|
+
return useKeysetInfiniteQuery({
|
|
358
|
+
queryFn: (j) => NoteService.getBusinessNotes({ pagination: j }, A.value),
|
|
359
|
+
queryKey: { noteBusinessIndex: { params: j?.params } }
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
var BusinessDetailSidebarNotesContent_default = /* @__PURE__ */ defineComponent({
|
|
363
|
+
__name: "BusinessDetailSidebarNotesContent",
|
|
364
|
+
props: { business: {} },
|
|
365
|
+
setup(n) {
|
|
366
|
+
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 ?? []);
|
|
367
|
+
async function B(n) {
|
|
368
|
+
await N.execute({
|
|
369
|
+
body: n,
|
|
370
|
+
params: { businessUuid: A.business.uuid }
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
async function V(n) {
|
|
374
|
+
try {
|
|
375
|
+
await P.execute({ params: { noteUuid: n } });
|
|
376
|
+
} catch (n) {
|
|
377
|
+
M.show(n);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function H(n) {
|
|
381
|
+
j.open({ note: n });
|
|
382
|
+
}
|
|
383
|
+
return (n, A) => (openBlock(), createBlock(CrmDetailSidebarNotesView_default, {
|
|
384
|
+
"is-loading": unref(F).isLoading.value,
|
|
385
|
+
notes: I.value,
|
|
386
|
+
"on-submit": B,
|
|
387
|
+
"has-next-page": unref(F).hasNextPage.value,
|
|
388
|
+
onNext: A[0] ||= (n) => unref(F).fetchNextPage(),
|
|
389
|
+
onDelete: V,
|
|
390
|
+
onUpdate: H
|
|
391
|
+
}, null, 8, [
|
|
392
|
+
"is-loading",
|
|
393
|
+
"notes",
|
|
394
|
+
"has-next-page"
|
|
395
|
+
]));
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
function useBusinessPrimaryContactPersonUpdateMutation() {
|
|
399
|
+
let n = useQueryClient(), A = "wiseCrmBusinessDetail", j = useMutation({
|
|
400
|
+
mutationFn: async (n) => {
|
|
401
|
+
await BusinessService.setPrimaryContactPersonForBusiness(n.businessUuid, n.contactPersonUuid);
|
|
402
|
+
},
|
|
403
|
+
onError: (j, M, N) => {
|
|
404
|
+
n.setQueryData([A, { businessUuid: M.businessUuid }], N?.previousData);
|
|
405
|
+
},
|
|
406
|
+
onMutate: async (j) => {
|
|
407
|
+
await n.cancelQueries({ queryKey: [A] });
|
|
408
|
+
let M = n.getQueryData([A, { businessUuid: j.businessUuid }]);
|
|
409
|
+
return M === void 0 ? {} : (n.setQueryData([A, { businessUuid: j.businessUuid }], {
|
|
410
|
+
...M,
|
|
411
|
+
contactPersons: M.contactPersons.map((n) => n.uuid === j.contactPersonUuid ? {
|
|
412
|
+
...n,
|
|
413
|
+
isPrimary: !n.isPrimary
|
|
414
|
+
} : {
|
|
415
|
+
...n,
|
|
416
|
+
isPrimary: !1
|
|
417
|
+
})
|
|
418
|
+
}), { previousData: M });
|
|
419
|
+
},
|
|
420
|
+
onSettled: (j, M, N) => {
|
|
421
|
+
n.invalidateQueries({ queryKey: [A, { businessUuid: N.businessUuid }] });
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
return {
|
|
425
|
+
isLoading: computed(() => j.isPending.value),
|
|
426
|
+
data: computed(() => j.data.value),
|
|
427
|
+
execute: async (n) => await j.mutateAsync(n.params)
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function useBusinessUnlinkContactPersonMutation() {
|
|
431
|
+
return ze({
|
|
432
|
+
queryFn: async ({ body: n, params: A }) => await BusinessService.unlinkContactPerson(A.businessUuid, n.contactPersonUuid),
|
|
433
|
+
queryKeysToInvalidate: {
|
|
434
|
+
businessIndex: {},
|
|
435
|
+
wiseCrmBusinessDetail: { businessUuid: (n) => n.businessUuid }
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function useBusinessAddChildBusinessMutation() {
|
|
440
|
+
return ze({
|
|
441
|
+
queryFn: async ({ params: n }) => await BusinessService.addChildBusiness(n.parentUuid, n.childUuid),
|
|
442
|
+
queryKeysToInvalidate: {
|
|
443
|
+
businessIndex: {},
|
|
444
|
+
wiseCrmBusinessDetail: { businessUuid: (n) => n.parentUuid }
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
function useBusinessCreateMutation() {
|
|
449
|
+
return ze({
|
|
450
|
+
queryFn: async ({ body: n }) => await BusinessService.create(n),
|
|
451
|
+
queryKeysToInvalidate: { businessIndex: {} }
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
function useBusinessIndexQuery(n, A) {
|
|
455
|
+
return useOffsetInfiniteQuery({
|
|
456
|
+
isEnabled: computed(() => A?.value ?? !0),
|
|
457
|
+
queryFn: (A) => BusinessService.getAll({
|
|
458
|
+
pagination: A,
|
|
459
|
+
search: n?.params?.search?.value
|
|
460
|
+
}),
|
|
461
|
+
queryKey: { businessIndex: { queryParams: n?.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(n, { emit: j }) {
|
|
472
|
+
let M = n, P = j, F = useI18n(), I = useSearch({ persistInUrl: !1 }), L = useBusinessIndexQuery({ params: { search: I.debouncedSearch } }), R = useForm({
|
|
473
|
+
initialState: { business: null },
|
|
474
|
+
schema: z.object({ business: z.object({
|
|
475
|
+
uuid: businessUuidSchema,
|
|
476
|
+
name: z.string()
|
|
477
|
+
}) }),
|
|
478
|
+
onSubmit: async (n) => {
|
|
479
|
+
await M.onSubmit(n.business.uuid);
|
|
480
|
+
}
|
|
481
|
+
}), V = R.register("business"), U = computed(() => (L.data.value?.data.filter((n) => n.uuid !== M.parentBusinessUuid) ?? []).map((n) => ({
|
|
482
|
+
uuid: n.uuid,
|
|
483
|
+
name: n.name
|
|
484
|
+
})));
|
|
485
|
+
function W(n) {
|
|
486
|
+
I.updateSearch(n);
|
|
487
|
+
}
|
|
488
|
+
function G() {
|
|
489
|
+
P("createNew");
|
|
490
|
+
}
|
|
491
|
+
return (n, j) => (openBlock(), createBlock(AppForm_default, { form: unref(R) }, {
|
|
492
|
+
default: withCtx(() => [createVNode(AppGrid_default, { cols: 1 }, {
|
|
493
|
+
default: withCtx(() => [
|
|
494
|
+
createVNode(unref(VcAutocomplete), mergeProps(unref(toFormField)(unref(V)), {
|
|
495
|
+
items: U.value,
|
|
496
|
+
"display-fn": (n) => n.name,
|
|
497
|
+
"is-loading": unref(L).isFetching.value,
|
|
498
|
+
label: unref(F).t("wise_crm.info_dialog.search_an_existing_one"),
|
|
499
|
+
"icon-left": "search",
|
|
500
|
+
onSearch: W
|
|
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(F).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: G
|
|
516
|
+
}, {
|
|
517
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(F).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(R).isSubmitting.value,
|
|
523
|
+
label: unref(F).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(n, A) {
|
|
535
|
+
n.src = A;
|
|
536
|
+
}
|
|
537
|
+
var bootstrap = (n) => {
|
|
538
|
+
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) => {
|
|
539
|
+
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]);
|
|
540
|
+
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);
|
|
541
|
+
});
|
|
542
|
+
V[F] ? console.warn(N + " only loads once. Ignoring:", n) : V[F] = (n, ...A) => H.add(n) && W().then(() => V[F](n, ...A));
|
|
543
|
+
}, 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) => {
|
|
544
|
+
console.warn(`[@googlemaps/js-api-loader] ${n}`);
|
|
545
|
+
} : () => {}, logDevNotice = __DEV__$1 ? (n) => {
|
|
546
|
+
console.info(`[@googlemaps/js-api-loader] ${n}`);
|
|
547
|
+
} : () => {}, __DEV__ = process.env.NODE_ENV !== "production", setOptionsWasCalled_ = !1;
|
|
548
|
+
function setOptions(n) {
|
|
549
|
+
if (setOptionsWasCalled_) {
|
|
550
|
+
logDevWarning(MSG_REPEATED_SET_OPTIONS(n));
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
installImportLibrary_(n), setOptionsWasCalled_ = !0;
|
|
554
|
+
}
|
|
555
|
+
async function importLibrary(n) {
|
|
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(n);
|
|
558
|
+
}
|
|
559
|
+
function installImportLibrary_(n) {
|
|
560
|
+
let A = !!window.google?.maps?.importLibrary;
|
|
561
|
+
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);
|
|
562
|
+
}
|
|
563
|
+
function useGeocode() {
|
|
564
|
+
let { getGoogleMapsApiKey: n } = useGoogleMapsApiKey();
|
|
565
|
+
async function A(A) {
|
|
566
|
+
let j = n();
|
|
567
|
+
if (j === null) return null;
|
|
568
|
+
let M = [
|
|
569
|
+
A.street,
|
|
570
|
+
A.streetNumber,
|
|
571
|
+
A.postalCode,
|
|
572
|
+
A.city,
|
|
573
|
+
A.country
|
|
574
|
+
].filter(Boolean).join(", ");
|
|
575
|
+
if (M === "") return null;
|
|
576
|
+
try {
|
|
577
|
+
setOptions({
|
|
578
|
+
key: j,
|
|
579
|
+
libraries: ["places"]
|
|
580
|
+
});
|
|
581
|
+
let { Place: n } = await importLibrary("places"), A = {
|
|
582
|
+
fields: ["location"],
|
|
583
|
+
textQuery: M
|
|
584
|
+
}, { places: N } = await n.searchByText(A);
|
|
585
|
+
if (N.length > 0 && N[0].location !== null) {
|
|
586
|
+
let n = N[0].location;
|
|
587
|
+
return {
|
|
588
|
+
lat: n.lat(),
|
|
589
|
+
lng: n.lng()
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
return null;
|
|
593
|
+
} catch {
|
|
594
|
+
return null;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return { geocodeAddress: A };
|
|
598
|
+
}
|
|
599
|
+
var CbeEnterpriseSearchTransformer = class {
|
|
600
|
+
static fromDto(n) {
|
|
601
|
+
return {
|
|
602
|
+
uuid: n.enterpriseNumber,
|
|
603
|
+
startDate: n.startDate,
|
|
604
|
+
name: n.name,
|
|
605
|
+
abbreviation: n.abbreviation,
|
|
606
|
+
address: AddressTransformer.fromNullableDto(n.address),
|
|
607
|
+
email: n.email,
|
|
608
|
+
fax: n.fax,
|
|
609
|
+
phone: n.phone,
|
|
610
|
+
status: n.status,
|
|
611
|
+
website: n.website
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
}, CbeService = class {
|
|
615
|
+
static async searchEnterprisesByTerm(n) {
|
|
616
|
+
let A = await searchCbeEnterprisesV1({ query: {
|
|
617
|
+
pagination: {
|
|
618
|
+
limit: 10,
|
|
619
|
+
offset: 0
|
|
620
|
+
},
|
|
621
|
+
search: n
|
|
622
|
+
} });
|
|
623
|
+
return {
|
|
624
|
+
data: A.data.items.map(CbeEnterpriseSearchTransformer.fromDto),
|
|
625
|
+
meta: A.data.meta
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
function useCbeEnterpriseSearchByTermQuery(n) {
|
|
630
|
+
return He({
|
|
631
|
+
isEnabled: computed(() => n.value.length > 0),
|
|
632
|
+
queryFn: async () => (await CbeService.searchEnterprisesByTerm(n.value)).data,
|
|
633
|
+
queryKey: { cbeEnterpriseSearchByTerm: { searchTerm: n } }
|
|
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(n, { emit: A }) {
|
|
650
|
+
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) => {
|
|
651
|
+
n !== null && (L.value = n.length === 0 || n.trim().length === 0, F.value = n);
|
|
652
|
+
}, 300), V = computed(() => R.data.value ?? []);
|
|
653
|
+
async function H(n) {
|
|
654
|
+
await B(n);
|
|
655
|
+
}
|
|
656
|
+
function U() {
|
|
657
|
+
M("createNew");
|
|
658
|
+
}
|
|
659
|
+
function W(n) {
|
|
660
|
+
return V.value.find((A) => A.uuid === n)?.name ?? "-";
|
|
661
|
+
}
|
|
662
|
+
function K(n) {
|
|
663
|
+
if (n === null) {
|
|
664
|
+
P.value = null;
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
N.value = V.value.find((A) => A.uuid === n.value) ?? null, P.value = n;
|
|
668
|
+
}
|
|
669
|
+
return (n, A) => (openBlock(), createBlock(EntityAutocomplete_default, {
|
|
670
|
+
modelValue: P.value,
|
|
671
|
+
"onUpdate:modelValue": [A[0] ||= (n) => P.value = n, K],
|
|
672
|
+
"is-required": j.isRequired,
|
|
673
|
+
"display-fn": W,
|
|
674
|
+
label: j.label,
|
|
675
|
+
options: V.value,
|
|
676
|
+
"is-loading": unref(R).isFetching.value,
|
|
677
|
+
placeholder: unref(I).t("component.select.search_placeholder"),
|
|
678
|
+
onCreateNew: U,
|
|
679
|
+
onSearch: H
|
|
680
|
+
}, {
|
|
681
|
+
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)]),
|
|
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(n, { emit: A }) {
|
|
700
|
+
let j = A, M = useI18n(), N = ref(null);
|
|
701
|
+
function F() {
|
|
702
|
+
j("createNew");
|
|
703
|
+
}
|
|
704
|
+
function I(n) {
|
|
705
|
+
N.value = n, j("updateCbeSearchItem", n);
|
|
706
|
+
}
|
|
707
|
+
function L() {
|
|
708
|
+
j("back");
|
|
709
|
+
}
|
|
710
|
+
return (n, A) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
|
|
711
|
+
default: withCtx(() => [createVNode(CbeAutocomplete_default, {
|
|
712
|
+
modelValue: N.value,
|
|
713
|
+
"onUpdate:modelValue": [A[0] ||= (n) => N.value = n, I],
|
|
714
|
+
label: unref(M).t("wise_crm.contact.create_dialog.form.fields.cbe_search"),
|
|
715
|
+
onCreateNew: F
|
|
716
|
+
}, null, 8, ["modelValue", "label"]), createVNode(AppDialogActions_default, null, {
|
|
717
|
+
default: withCtx(() => [createVNode(unref(VcButton), {
|
|
718
|
+
variant: "secondary",
|
|
719
|
+
size: "lg",
|
|
720
|
+
onClick: L
|
|
721
|
+
}, {
|
|
722
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(M).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 n = inject(baseFieldsetContextKey) ?? null;
|
|
733
|
+
return assert(n !== null, "`useBaseFieldsetContext` must be used within a component that provides the context"), n;
|
|
734
|
+
}
|
|
735
|
+
function useProvideBaseFieldsetContext(n) {
|
|
736
|
+
provide(baseFieldsetContextKey, n);
|
|
737
|
+
}
|
|
738
|
+
var _hoisted_1$3 = ["aria-describedby"], BaseFieldset_default = /* @__PURE__ */ defineComponent({
|
|
739
|
+
__name: "BaseFieldset",
|
|
740
|
+
setup(n) {
|
|
741
|
+
let A = useId();
|
|
742
|
+
return useProvideBaseFieldsetContext({ id: A }), (n, j) => (openBlock(), createElementBlock("fieldset", { "aria-describedby": unref(A) }, [renderSlot(n.$slots, "default")], 8, _hoisted_1$3));
|
|
743
|
+
}
|
|
744
|
+
}), BaseFieldsetLegend_default = /* @__PURE__ */ defineComponent({
|
|
745
|
+
__name: "BaseFieldsetLegend",
|
|
746
|
+
props: { as: {} },
|
|
747
|
+
setup(n) {
|
|
748
|
+
let A = n, j = useInjectBaseFieldsetContext();
|
|
749
|
+
return (n, M) => (openBlock(), createBlock(resolveDynamicComponent(A.as), { id: unref(j).id }, {
|
|
750
|
+
default: withCtx(() => [renderSlot(n.$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(n) {
|
|
768
|
+
let A = n;
|
|
769
|
+
return (n, j) => (openBlock(), createBlock(BaseFieldset_default, null, {
|
|
770
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1$2, [(openBlock(), createBlock(resolveDynamicComponent(A.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(A.title), 1)]),
|
|
776
|
+
_: 1
|
|
777
|
+
})]),
|
|
778
|
+
_: 1
|
|
779
|
+
})), A.description === null ? createCommentVNode("", !0) : (openBlock(), createElementBlock("p", _hoisted_2$2, toDisplayString(A.description), 1))]), createElementVNode("div", _hoisted_3$2, [renderSlot(n.$slots, "default")])]),
|
|
780
|
+
_: 3
|
|
781
|
+
}));
|
|
782
|
+
}
|
|
783
|
+
}), ContactCreateDialogBusinessContactPerson_default = /* @__PURE__ */ defineComponent({
|
|
784
|
+
__name: "ContactCreateDialogBusinessContactPerson",
|
|
785
|
+
props: { form: {} },
|
|
786
|
+
emits: ["back"],
|
|
787
|
+
setup(n, { emit: j }) {
|
|
788
|
+
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");
|
|
789
|
+
function U() {
|
|
790
|
+
N("back");
|
|
791
|
+
}
|
|
792
|
+
return (j, M) => (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(F).t("wise_crm.contact.create_dialog.form.fields.first_name"),
|
|
798
|
+
placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.first_name")
|
|
799
|
+
}, unref(toFormField)(unref(I))), null, 16, ["label", "placeholder"]),
|
|
800
|
+
createVNode(unref(VcTextField), mergeProps({
|
|
801
|
+
label: unref(F).t("wise_crm.contact.create_dialog.form.fields.last_name"),
|
|
802
|
+
placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.last_name")
|
|
803
|
+
}, unref(toFormField)(unref(L))), null, 16, ["label", "placeholder"]),
|
|
804
|
+
createVNode(unref(VcTextField), mergeProps({
|
|
805
|
+
label: unref(F).t("wise_crm.contact.create_dialog.form.fields.position"),
|
|
806
|
+
placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.position")
|
|
807
|
+
}, unref(toFormField)(unref(R))), null, 16, ["label", "placeholder"])
|
|
808
|
+
]),
|
|
809
|
+
_: 1
|
|
810
|
+
}), createVNode(FormFieldset_default, {
|
|
811
|
+
title: unref(F).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(B)), {
|
|
820
|
+
label: unref(F).t("wise_crm.contact.create_dialog.form.fields.email"),
|
|
821
|
+
placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.email")
|
|
822
|
+
}), null, 16, ["label", "placeholder"]),
|
|
823
|
+
createVNode(unref(VcPhoneNumberField), mergeProps(unref(toFormField)(unref(V)), {
|
|
824
|
+
label: unref(F).t("wise_crm.contact.create_dialog.form.fields.mobile_phone"),
|
|
825
|
+
placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.mobile_phone")
|
|
826
|
+
}), null, 16, ["label", "placeholder"]),
|
|
827
|
+
createVNode(unref(VcPhoneNumberField), mergeProps(unref(toFormField)(unref(H)), {
|
|
828
|
+
label: unref(F).t("wise_crm.contact.create_dialog.form.fields.phone"),
|
|
829
|
+
placeholder: unref(F).t("wise_crm.contact.create_dialog.form.fields.phone")
|
|
830
|
+
}), null, 16, ["label", "placeholder"])
|
|
831
|
+
]),
|
|
832
|
+
_: 1
|
|
833
|
+
}), createVNode(AppGlobalFormError_default, { form: n.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: U
|
|
842
|
+
}, {
|
|
843
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(F).t("wise_crm.shared.back")), 1)]),
|
|
844
|
+
_: 1
|
|
845
|
+
}), createVNode(unref(VcButton), {
|
|
846
|
+
"is-loading": n.form.isSubmitting.value,
|
|
847
|
+
size: "lg",
|
|
848
|
+
type: "submit"
|
|
849
|
+
}, {
|
|
850
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(F).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(n, { emit: A }) {
|
|
871
|
+
let j = n, M = A, N = useI18n(), F = useApiErrorToast(), I = ref(null), R = j.form.register("individualUuid"), B = j.form.register("individual");
|
|
872
|
+
async function V(n) {
|
|
873
|
+
if (I.value = n, n !== null) {
|
|
874
|
+
R.setValue(n ? n.value : null);
|
|
875
|
+
try {
|
|
876
|
+
let A = await IndividualService.getByUuid(n.value);
|
|
877
|
+
B.setValue({
|
|
878
|
+
email: A.email,
|
|
879
|
+
firstName: A.firstName,
|
|
880
|
+
lastName: A.lastName,
|
|
881
|
+
mobilePhone: A.mobilePhone,
|
|
882
|
+
phone: A.phone
|
|
883
|
+
}), M("next");
|
|
884
|
+
} catch (n) {
|
|
885
|
+
F.show(n);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function H() {
|
|
890
|
+
M("back");
|
|
891
|
+
}
|
|
892
|
+
function U() {
|
|
893
|
+
R.setValue(null), B.setValue(null), M("next");
|
|
894
|
+
}
|
|
895
|
+
return (n, A) => (openBlock(), createBlock(AppGrid_default, { cols: 1 }, {
|
|
896
|
+
default: withCtx(() => [createVNode(IndividualAutocomplete_default, {
|
|
897
|
+
"model-value": I.value,
|
|
898
|
+
label: unref(N).t("wise_crm.contact.create_dialog.form.contact_person"),
|
|
899
|
+
"onUpdate:modelValue": V,
|
|
900
|
+
onCreateNew: U
|
|
901
|
+
}, null, 8, ["model-value", "label"]), createVNode(AppDialogActions_default, null, {
|
|
902
|
+
default: withCtx(() => [createVNode(unref(VcButton), {
|
|
903
|
+
variant: "secondary",
|
|
904
|
+
size: "lg",
|
|
905
|
+
onClick: H
|
|
906
|
+
}, {
|
|
907
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(N).t("wise_crm.shared.back")), 1)]),
|
|
908
|
+
_: 1
|
|
909
|
+
}), j.requireIndividualOnCreate ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(VcButton), {
|
|
910
|
+
key: 0,
|
|
911
|
+
"is-loading": j.isSubmitting,
|
|
912
|
+
size: "lg",
|
|
913
|
+
type: "submit"
|
|
914
|
+
}, {
|
|
915
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(N).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(n) {
|
|
949
|
+
let A = n, j = useModel(n, "modelValue"), M = computed({
|
|
950
|
+
get: () => j.value ? `${j.value.countryCode}${j.value.number}` : null,
|
|
951
|
+
set: (n) => {
|
|
952
|
+
if (n === null) {
|
|
953
|
+
j.value = null;
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
j.value = {
|
|
957
|
+
countryCode: n.slice(0, 2).toUpperCase(),
|
|
958
|
+
number: n.slice(2)
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
function N(n) {
|
|
963
|
+
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();
|
|
964
|
+
}
|
|
965
|
+
function P(n) {
|
|
966
|
+
let A = (n.clipboardData?.getData("text"))?.replace(/[^a-z0-9]/gi, "");
|
|
967
|
+
A && (M.value = A);
|
|
968
|
+
}
|
|
969
|
+
return (n, j) => (openBlock(), createBlock(unref(VcTextField), mergeProps(A, {
|
|
970
|
+
modelValue: M.value,
|
|
971
|
+
"onUpdate:modelValue": j[0] ||= (n) => M.value = n,
|
|
972
|
+
onKeydown: N,
|
|
973
|
+
onPaste: withModifiers(P, ["prevent"])
|
|
974
|
+
}), null, 16, ["modelValue"]));
|
|
975
|
+
}
|
|
976
|
+
}), CustomFieldCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
977
|
+
__name: "CustomFieldCheckbox",
|
|
978
|
+
props: {
|
|
979
|
+
definition: {},
|
|
980
|
+
form: {}
|
|
981
|
+
},
|
|
982
|
+
setup(n) {
|
|
983
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`, j.definition.defaultValue);
|
|
984
|
+
return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcCheckbox), mergeProps({ label: j.definition.displayName }, unref(toFormField)(unref(M))), null, 16, ["label"])]));
|
|
985
|
+
}
|
|
986
|
+
}), CustomFieldDate_default = /* @__PURE__ */ defineComponent({
|
|
987
|
+
__name: "CustomFieldDate",
|
|
988
|
+
props: {
|
|
989
|
+
definition: {},
|
|
990
|
+
form: {}
|
|
991
|
+
},
|
|
992
|
+
setup(n) {
|
|
993
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`);
|
|
994
|
+
return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcDateField), mergeProps({
|
|
995
|
+
"min-date": j.definition.minDate,
|
|
996
|
+
"max-date": j.definition.maxDate,
|
|
997
|
+
label: j.definition.displayName
|
|
998
|
+
}, unref(toFormField)(unref(M))), 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(n) {
|
|
1011
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`, []);
|
|
1012
|
+
function N(n) {
|
|
1013
|
+
return j.definition.options.find((A) => A.key === n)?.value ?? n;
|
|
1014
|
+
}
|
|
1015
|
+
return (n, P) => (openBlock(), createBlock(unref(VcSelect), mergeProps(unref(toFormField)(unref(M)), {
|
|
1016
|
+
"display-fn": N,
|
|
1017
|
+
label: j.definition.displayName,
|
|
1018
|
+
placeholder: j.definition.displayName
|
|
1019
|
+
}), {
|
|
1020
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(j.definition.options, (n) => (openBlock(), createBlock(unref(VcSelectItem), {
|
|
1021
|
+
key: n.key,
|
|
1022
|
+
value: n.key
|
|
1023
|
+
}, {
|
|
1024
|
+
default: withCtx(() => [createTextVNode(toDisplayString(n.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(n) {
|
|
1037
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`);
|
|
1038
|
+
return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcNumberField), mergeProps({
|
|
1039
|
+
min: j.definition.minValue,
|
|
1040
|
+
max: j.definition.maxValue,
|
|
1041
|
+
label: j.definition.displayName,
|
|
1042
|
+
placeholder: j.definition.displayName,
|
|
1043
|
+
"hide-controls": !0
|
|
1044
|
+
}, unref(toFormField)(unref(M))), 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(n) {
|
|
1058
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`);
|
|
1059
|
+
return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcRadioGroup), mergeProps({ label: j.definition.displayName }, unref(toFormField)(unref(M))), {
|
|
1060
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(j.definition.options, (n) => (openBlock(), createBlock(unref(VcRadioGroupItem), {
|
|
1061
|
+
key: n.key,
|
|
1062
|
+
label: n.value,
|
|
1063
|
+
value: n.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(n) {
|
|
1075
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`);
|
|
1076
|
+
function N(n) {
|
|
1077
|
+
let A = j.definition.options.find((A) => A.key === n);
|
|
1078
|
+
return A ? A.value : n;
|
|
1079
|
+
}
|
|
1080
|
+
return (n, P) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcSelect), mergeProps({
|
|
1081
|
+
"display-fn": N,
|
|
1082
|
+
label: j.definition.displayName,
|
|
1083
|
+
placeholder: j.definition.displayName
|
|
1084
|
+
}, unref(toFormField)(unref(M))), {
|
|
1085
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(j.definition.options, (n) => (openBlock(), createBlock(unref(VcSelectItem), {
|
|
1086
|
+
key: n.key,
|
|
1087
|
+
value: n.key
|
|
1088
|
+
}, {
|
|
1089
|
+
default: withCtx(() => [createTextVNode(toDisplayString(n.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(n) {
|
|
1102
|
+
let j = n, M = j.form.register(`customFields.${j.definition.key}`);
|
|
1103
|
+
return (n, N) => (openBlock(), createElementBlock("div", null, [createVNode(unref(VcTextField), mergeProps({
|
|
1104
|
+
label: j.definition.displayName,
|
|
1105
|
+
placeholder: j.definition.displayName
|
|
1106
|
+
}, unref(toFormField)(unref(M))), null, 16, ["label", "placeholder"])]));
|
|
1107
|
+
}
|
|
1108
|
+
}), CustomFieldDefinitionForm_default = /* @__PURE__ */ defineComponent({
|
|
1109
|
+
__name: "CustomFieldDefinitionForm",
|
|
1110
|
+
props: {
|
|
1111
|
+
customFieldDefinitions: {},
|
|
1112
|
+
form: {}
|
|
1113
|
+
},
|
|
1114
|
+
setup(n) {
|
|
1115
|
+
let A = n;
|
|
1116
|
+
function j(n) {
|
|
1117
|
+
return n === "full" ? "col-span-2" : "col-span-1";
|
|
1118
|
+
}
|
|
1119
|
+
return (M, N) => (openBlock(), createBlock(AppGrid_default, { cols: 2 }, {
|
|
1120
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(A.customFieldDefinitions, (M) => (openBlock(), createElementBlock(Fragment, { key: M.uuid }, [
|
|
1121
|
+
M.type === "string" ? (openBlock(), createBlock(CustomFieldString_default, {
|
|
1122
|
+
key: 0,
|
|
1123
|
+
class: normalizeClass(j(M.width)),
|
|
1124
|
+
form: n.form,
|
|
1125
|
+
definition: M
|
|
1126
|
+
}, null, 8, [
|
|
1127
|
+
"class",
|
|
1128
|
+
"form",
|
|
1129
|
+
"definition"
|
|
1130
|
+
])) : createCommentVNode("", !0),
|
|
1131
|
+
M.type === "select" ? (openBlock(), createBlock(CustomFieldSelect_default, {
|
|
1132
|
+
key: 1,
|
|
1133
|
+
class: normalizeClass(j(M.width)),
|
|
1134
|
+
form: n.form,
|
|
1135
|
+
definition: M
|
|
1136
|
+
}, null, 8, [
|
|
1137
|
+
"class",
|
|
1138
|
+
"form",
|
|
1139
|
+
"definition"
|
|
1140
|
+
])) : createCommentVNode("", !0),
|
|
1141
|
+
M.type === "radio" ? (openBlock(), createBlock(CustomFieldRadio_default, {
|
|
1142
|
+
key: 2,
|
|
1143
|
+
class: normalizeClass(j(M.width)),
|
|
1144
|
+
form: n.form,
|
|
1145
|
+
definition: M
|
|
1146
|
+
}, null, 8, [
|
|
1147
|
+
"class",
|
|
1148
|
+
"form",
|
|
1149
|
+
"definition"
|
|
1150
|
+
])) : createCommentVNode("", !0),
|
|
1151
|
+
M.type === "date" ? (openBlock(), createBlock(CustomFieldDate_default, {
|
|
1152
|
+
key: 3,
|
|
1153
|
+
class: normalizeClass(j(M.width)),
|
|
1154
|
+
form: n.form,
|
|
1155
|
+
definition: M
|
|
1156
|
+
}, null, 8, [
|
|
1157
|
+
"class",
|
|
1158
|
+
"form",
|
|
1159
|
+
"definition"
|
|
1160
|
+
])) : createCommentVNode("", !0),
|
|
1161
|
+
M.type === "number" ? (openBlock(), createBlock(CustomFieldNumberField_default, {
|
|
1162
|
+
key: 4,
|
|
1163
|
+
definition: M,
|
|
1164
|
+
class: normalizeClass(j(M.width)),
|
|
1165
|
+
form: A.form
|
|
1166
|
+
}, null, 8, [
|
|
1167
|
+
"definition",
|
|
1168
|
+
"class",
|
|
1169
|
+
"form"
|
|
1170
|
+
])) : createCommentVNode("", !0),
|
|
1171
|
+
M.type === "checkbox" ? (openBlock(), createBlock(CustomFieldCheckbox_default, {
|
|
1172
|
+
key: 5,
|
|
1173
|
+
definition: M,
|
|
1174
|
+
form: A.form,
|
|
1175
|
+
class: normalizeClass(j(M.width))
|
|
1176
|
+
}, null, 8, [
|
|
1177
|
+
"definition",
|
|
1178
|
+
"form",
|
|
1179
|
+
"class"
|
|
1180
|
+
])) : createCommentVNode("", !0),
|
|
1181
|
+
M.type === "multiselect" ? (openBlock(), createBlock(CustomFieldMultiSelect_default, {
|
|
1182
|
+
key: 6,
|
|
1183
|
+
form: A.form,
|
|
1184
|
+
class: normalizeClass(j(M.width)),
|
|
1185
|
+
definition: M
|
|
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(n, { emit: M }) {
|
|
1203
|
+
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");
|
|
1204
|
+
function W() {
|
|
1205
|
+
F("back");
|
|
1206
|
+
}
|
|
1207
|
+
function G() {
|
|
1208
|
+
N.form.blurAll(), B.isValid.value && V.isValid.value && U.isValid.value && H.isValid.value && F("next");
|
|
1209
|
+
}
|
|
1210
|
+
return (j, M) => (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": N.isDataFromCbe,
|
|
1215
|
+
"is-required": !0
|
|
1216
|
+
}, unref(toFormField)(unref(B)), {
|
|
1217
|
+
label: unref(I).t("wise_crm.contact.create_dialog.form.name"),
|
|
1218
|
+
placeholder: unref(I).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": N.isDataFromCbe }, unref(toFormField)(unref(U)), {
|
|
1225
|
+
label: unref(I).t("wise_crm.contact.create_dialog.form.vat_number"),
|
|
1226
|
+
placeholder: unref(I).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": N.isDataFromCbe,
|
|
1234
|
+
"is-required": !0,
|
|
1235
|
+
label: unref(I).t("wise_crm.contact.create_dialog.form.fields.address"),
|
|
1236
|
+
placeholder: unref(I).t("wise_crm.contact.create_dialog.form.fields.address")
|
|
1237
|
+
}, unref(toFormField)(unref(V))), null, 16, [
|
|
1238
|
+
"is-disabled",
|
|
1239
|
+
"label",
|
|
1240
|
+
"placeholder"
|
|
1241
|
+
]),
|
|
1242
|
+
createVNode(unref(VcTextField), mergeProps({
|
|
1243
|
+
label: unref(I).t("wise_crm.contact.create_dialog.form.company_number"),
|
|
1244
|
+
placeholder: unref(I).t("wise_crm.contact.create_dialog.form.company_number")
|
|
1245
|
+
}, unref(toFormField)(unref(H))), null, 16, ["label", "placeholder"]),
|
|
1246
|
+
createVNode(CustomFieldDefinitionForm_default, {
|
|
1247
|
+
"custom-field-definitions": R.value,
|
|
1248
|
+
form: n.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: W
|
|
1257
|
+
}, {
|
|
1258
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(I).t("wise_crm.shared.back")), 1)]),
|
|
1259
|
+
_: 1
|
|
1260
|
+
}), createVNode(unref(VcButton), {
|
|
1261
|
+
size: "lg",
|
|
1262
|
+
onClick: G
|
|
1263
|
+
}, {
|
|
1264
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(I).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(n) {
|
|
1291
|
+
return n.reduce((n, A) => {
|
|
1292
|
+
switch (A.type) {
|
|
1293
|
+
case "multiselect":
|
|
1294
|
+
n[A.key] = z.string().array().default([]).superRefine((n, j) => {
|
|
1295
|
+
A.minSelections !== void 0 && n.length < A.minSelections && j.addIssue({
|
|
1296
|
+
code: z.ZodIssueCode.custom,
|
|
1297
|
+
message: `At least ${A.minSelections} selections are required`
|
|
1298
|
+
}), A.maxSelections !== void 0 && n.length > A.maxSelections && j.addIssue({
|
|
1299
|
+
code: z.ZodIssueCode.custom,
|
|
1300
|
+
message: `At most ${A.maxSelections} selections are allowed`
|
|
1301
|
+
});
|
|
1302
|
+
});
|
|
1303
|
+
break;
|
|
1304
|
+
case "checkbox":
|
|
1305
|
+
n[A.key] = z.boolean();
|
|
1306
|
+
break;
|
|
1307
|
+
case "radio":
|
|
1308
|
+
n[A.key] = z.string().nullable();
|
|
1309
|
+
break;
|
|
1310
|
+
case "select":
|
|
1311
|
+
n[A.key] = z.string().nullable().superRefine((n, A) => {
|
|
1312
|
+
n === "" && A.addIssue({
|
|
1313
|
+
code: z.ZodIssueCode.custom,
|
|
1314
|
+
message: "Selection is required"
|
|
1315
|
+
});
|
|
1316
|
+
});
|
|
1317
|
+
break;
|
|
1318
|
+
case "number":
|
|
1319
|
+
n[A.key] = z.number().nullable().superRefine((n, j) => {
|
|
1320
|
+
n !== null && A.minValue !== void 0 && n < A.minValue && j.addIssue({
|
|
1321
|
+
code: z.ZodIssueCode.custom,
|
|
1322
|
+
message: `Minimum value is ${A.minValue}`
|
|
1323
|
+
}), n !== null && A.maxValue !== void 0 && n > A.maxValue && j.addIssue({
|
|
1324
|
+
code: z.ZodIssueCode.custom,
|
|
1325
|
+
message: `Maximum value is ${A.maxValue}`
|
|
1326
|
+
});
|
|
1327
|
+
});
|
|
1328
|
+
break;
|
|
1329
|
+
case "date":
|
|
1330
|
+
n[A.key] = plainDateSchema.nullable().superRefine((n, j) => {
|
|
1331
|
+
n !== null && A.minDate !== void 0 && n < A.minDate && j.addIssue({
|
|
1332
|
+
code: z.ZodIssueCode.custom,
|
|
1333
|
+
message: `Minimum date is ${A.minDate}`
|
|
1334
|
+
}), n !== null && A.maxDate !== void 0 && n > A.maxDate && j.addIssue({
|
|
1335
|
+
code: z.ZodIssueCode.custom,
|
|
1336
|
+
message: `Maximum date is ${A.maxDate}`
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
break;
|
|
1340
|
+
default: n[A.key] = z.string().nullable();
|
|
1341
|
+
}
|
|
1342
|
+
return n;
|
|
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: phoneNumberFormSchema.nullable(),
|
|
1351
|
+
phone: phoneNumberFormSchema.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(n) {
|
|
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(n)).nullable(),
|
|
1374
|
+
individual: businessIndividualCreateFormSchema.nullable(),
|
|
1375
|
+
individualPosition: z.string().nullable(),
|
|
1376
|
+
vatNumber: vatNumberSchema.nullable()
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
var Step = /* @__PURE__ */ function(n) {
|
|
1380
|
+
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;
|
|
1381
|
+
}(Step || {}), ContactCreateDialogBusinessForm_default = /* @__PURE__ */ defineComponent({
|
|
1382
|
+
__name: "ContactCreateDialogBusinessForm",
|
|
1383
|
+
props: { onSubmit: { type: Function } },
|
|
1384
|
+
emits: ["back"],
|
|
1385
|
+
setup(n, { emit: A }) {
|
|
1386
|
+
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({
|
|
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((n) => n.isDisplayedOnCreate)).value),
|
|
1400
|
+
onSubmit: async (n) => {
|
|
1401
|
+
await M.onSubmit(n);
|
|
1402
|
+
}
|
|
1403
|
+
}), q = G.register("name"), J = G.register("address"), Y = G.register("companyNumber"), X = G.register("vatNumber");
|
|
1404
|
+
function Z(n) {
|
|
1405
|
+
if (n === Step.SEARCH_BUSINESS) {
|
|
1406
|
+
N("back");
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
if (n === Step.MANUAL_BUSINESS) {
|
|
1410
|
+
V.value = Step.SEARCH_BUSINESS;
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
if (n === Step.SEARCH_CONTACT_PERSON) {
|
|
1414
|
+
V.value = Step.MANUAL_BUSINESS;
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
n === Step.MANUAL_CONTACT_PERSON && (V.value = Step.SEARCH_CONTACT_PERSON);
|
|
1418
|
+
}
|
|
1419
|
+
function Q() {
|
|
1420
|
+
q.setValue(null), J.setValue(null), Y.setValue(null), X.setValue(null), B.value = !1, V.value = Step.MANUAL_BUSINESS;
|
|
1421
|
+
}
|
|
1422
|
+
async function $(n) {
|
|
1423
|
+
if (n === null) return;
|
|
1424
|
+
V.value = Step.MANUAL_BUSINESS, B.value = !0;
|
|
1425
|
+
let A = n.uuid.replace(/\./g, "");
|
|
1426
|
+
if (q.setValue(n.name), n.address !== null) {
|
|
1427
|
+
let A = await L(n.address);
|
|
1428
|
+
J.setValue({
|
|
1429
|
+
...n.address,
|
|
1430
|
+
coordinates: A ?? {
|
|
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: A
|
|
1440
|
+
}), Y.setValue(A);
|
|
1441
|
+
}
|
|
1442
|
+
return (n, A) => (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: H.value,
|
|
1446
|
+
description: U.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(G),
|
|
1456
|
+
class: "flex flex-1 flex-col"
|
|
1457
|
+
}, {
|
|
1458
|
+
default: withCtx(() => [
|
|
1459
|
+
V.value === Step.SEARCH_BUSINESS ? (openBlock(), createBlock(ContactCreateDialogBusinessCbeSearch_default, {
|
|
1460
|
+
key: 0,
|
|
1461
|
+
onCreateNew: Q,
|
|
1462
|
+
onUpdateCbeSearchItem: $,
|
|
1463
|
+
onBack: A[0] ||= (n) => Z(Step.SEARCH_BUSINESS)
|
|
1464
|
+
})) : createCommentVNode("", !0),
|
|
1465
|
+
V.value === Step.MANUAL_BUSINESS ? (openBlock(), createBlock(ContactCreateDialogBusinessGeneralInfo_default, {
|
|
1466
|
+
key: 1,
|
|
1467
|
+
form: unref(G),
|
|
1468
|
+
"is-data-from-cbe": B.value,
|
|
1469
|
+
onBack: A[1] ||= (n) => Z(Step.MANUAL_BUSINESS),
|
|
1470
|
+
onNext: A[2] ||= (n) => V.value = Step.SEARCH_CONTACT_PERSON
|
|
1471
|
+
}, null, 8, ["form", "is-data-from-cbe"])) : createCommentVNode("", !0),
|
|
1472
|
+
V.value === Step.SEARCH_CONTACT_PERSON ? (openBlock(), createBlock(ContactCreateDialogBusinessContactPersonSearch_default, {
|
|
1473
|
+
key: 2,
|
|
1474
|
+
"is-submitting": unref(G).isSubmitting.value,
|
|
1475
|
+
"require-individual-on-create": unref(I).getConfig().businessConfig.requireIndividualOnCreate ?? !1,
|
|
1476
|
+
form: unref(G),
|
|
1477
|
+
onBack: A[3] ||= (n) => Z(Step.SEARCH_CONTACT_PERSON),
|
|
1478
|
+
onNext: A[4] ||= (n) => V.value = Step.MANUAL_CONTACT_PERSON
|
|
1479
|
+
}, null, 8, [
|
|
1480
|
+
"is-submitting",
|
|
1481
|
+
"require-individual-on-create",
|
|
1482
|
+
"form"
|
|
1483
|
+
])) : createCommentVNode("", !0),
|
|
1484
|
+
V.value === Step.MANUAL_CONTACT_PERSON ? (openBlock(), createBlock(ContactCreateDialogBusinessContactPerson_default, {
|
|
1485
|
+
key: 3,
|
|
1486
|
+
form: unref(G),
|
|
1487
|
+
onBack: A[5] ||= (n) => 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(n, { emit: A }) {
|
|
1500
|
+
let j = n, M = A, N = useI18n(), P = useApiErrorToast(), F = ref(!1), I = ref(null), R = useBusinessCreateMutation(), B = useBusinessAddChildBusinessMutation();
|
|
1501
|
+
function V() {
|
|
1502
|
+
M("close");
|
|
1503
|
+
}
|
|
1504
|
+
async function H(n) {
|
|
1505
|
+
try {
|
|
1506
|
+
let A = await R.execute({ body: n });
|
|
1507
|
+
await B.execute({ params: {
|
|
1508
|
+
childUuid: A,
|
|
1509
|
+
parentUuid: j.businessUuid
|
|
1510
|
+
} }), M("close");
|
|
1511
|
+
} catch (n) {
|
|
1512
|
+
P.show(n);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
async function U(n) {
|
|
1516
|
+
try {
|
|
1517
|
+
await B.execute({ params: {
|
|
1518
|
+
childUuid: n,
|
|
1519
|
+
parentUuid: j.businessUuid
|
|
1520
|
+
} }), M("close");
|
|
1521
|
+
} catch (n) {
|
|
1522
|
+
P.show(n);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
function G() {
|
|
1526
|
+
F.value = !1;
|
|
1527
|
+
}
|
|
1528
|
+
function K() {
|
|
1529
|
+
F.value = !0;
|
|
1530
|
+
}
|
|
1531
|
+
return (n, A) => (openBlock(), createBlock(unref(VcDialog), {
|
|
1532
|
+
"class-config": { content: "max-w-xl w-full" },
|
|
1533
|
+
onClose: V
|
|
1534
|
+
}, {
|
|
1535
|
+
default: withCtx(() => [F.value ? (openBlock(), createBlock(ContactCreateDialogBusinessForm_default, {
|
|
1536
|
+
key: 0,
|
|
1537
|
+
"on-submit": H,
|
|
1538
|
+
onBack: G
|
|
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(N).t("wise_crm.info_dialog.add_business_child_dialog.title"),
|
|
1545
|
+
description: unref(N).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: I.value,
|
|
1552
|
+
"onUpdate:modelValue": A[0] ||= (n) => I.value = n,
|
|
1553
|
+
"parent-business-uuid": j.businessUuid,
|
|
1554
|
+
"on-submit": U,
|
|
1555
|
+
onCreateNew: K
|
|
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: n, params: A }) => await BusinessService.linkContactPerson(A.businessUuid, n.contactPersonUuid, n.position, n.contactInfo),
|
|
1566
|
+
queryKeysToInvalidate: {
|
|
1567
|
+
businessIndex: {},
|
|
1568
|
+
wiseCrmBusinessDetail: { businessUuid: (n) => n.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(n, { emit: A }) {
|
|
1583
|
+
let j = n, M = A, N = useI18n(), P = useApiErrorToast(), F = useBusinessLinkContactPersonMutation(), I = useContactPersonCreateMutation();
|
|
1584
|
+
async function R(n) {
|
|
1585
|
+
try {
|
|
1586
|
+
let A = await I.execute({ body: {
|
|
1587
|
+
email: n.email,
|
|
1588
|
+
firstName: n.firstName,
|
|
1589
|
+
lastName: n.lastName,
|
|
1590
|
+
mobilePhone: n.mobilePhone,
|
|
1591
|
+
phone: n.phone
|
|
1592
|
+
} });
|
|
1593
|
+
j.isCreatingNewContactPerson || await F.execute({
|
|
1594
|
+
body: {
|
|
1595
|
+
contactPersonUuid: A,
|
|
1596
|
+
contactInfo: {
|
|
1597
|
+
email: n.email,
|
|
1598
|
+
mobilePhone: n.mobilePhone,
|
|
1599
|
+
phone: n.phone
|
|
1600
|
+
},
|
|
1601
|
+
position: n.position
|
|
1602
|
+
},
|
|
1603
|
+
params: { businessUuid: j.businessUuid }
|
|
1604
|
+
}), V({
|
|
1605
|
+
label: `${n.firstName} ${n.lastName}`,
|
|
1606
|
+
value: A
|
|
1607
|
+
});
|
|
1608
|
+
} catch (n) {
|
|
1609
|
+
P.show(n);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
async function B(n, A, M) {
|
|
1613
|
+
if (n !== null) try {
|
|
1614
|
+
await F.execute({
|
|
1615
|
+
body: {
|
|
1616
|
+
contactPersonUuid: n,
|
|
1617
|
+
contactInfo: A,
|
|
1618
|
+
position: M
|
|
1619
|
+
},
|
|
1620
|
+
params: { businessUuid: j.businessUuid }
|
|
1621
|
+
}), V();
|
|
1622
|
+
} catch (n) {
|
|
1623
|
+
P.show(n);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
function V(n) {
|
|
1627
|
+
if (n === void 0) {
|
|
1628
|
+
M("close");
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
M("createNewContactPerson", n), M("close");
|
|
1632
|
+
}
|
|
1633
|
+
return (n, A) => (openBlock(), createBlock(AppDialog_default, {
|
|
1634
|
+
title: unref(N).t("wise_crm.info_dialog.contact_person_create.title"),
|
|
1635
|
+
description: unref(N).t("wise_crm.info_dialog.contact_person_create.description"),
|
|
1636
|
+
onClose: V
|
|
1637
|
+
}, {
|
|
1638
|
+
default: withCtx(() => [createVNode(ContactPersonCreateForm_default, {
|
|
1639
|
+
"on-submit": R,
|
|
1640
|
+
"on-link-contact-person": B,
|
|
1641
|
+
onClose: V
|
|
1642
|
+
})]),
|
|
1643
|
+
_: 1
|
|
1644
|
+
}, 8, ["title", "description"]));
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
function useBusinessContactPersonUpdateMutation() {
|
|
1648
|
+
return ze({
|
|
1649
|
+
queryFn: async ({ body: n, params: A }) => await BusinessService.updateContactPerson(A.businessUuid, A.contactPersonUuid, n),
|
|
1650
|
+
queryKeysToInvalidate: {
|
|
1651
|
+
businessIndex: {},
|
|
1652
|
+
contactPersonDetail: { contactPersonUuid: (n) => n.contactPersonUuid },
|
|
1653
|
+
wiseCrmBusinessDetail: { businessUuid: (n) => n.businessUuid }
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
function useBusinessContactPersonDetailQuery(n, A) {
|
|
1658
|
+
return He({
|
|
1659
|
+
isEnabled: computed(() => n.value !== null && A.value !== null),
|
|
1660
|
+
queryFn: () => {
|
|
1661
|
+
if (n.value === null) throw Error("Individual UUID is null");
|
|
1662
|
+
if (A.value === null) throw Error("Contact Person UUID is null");
|
|
1663
|
+
return BusinessService.getContactPerson(n.value, A.value);
|
|
1664
|
+
},
|
|
1665
|
+
queryKey: { contactPersonDetail: { contactPersonUuid: A } }
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
var BusinessContactPersonUpdateForm_default = /* @__PURE__ */ defineComponent({
|
|
1669
|
+
__name: "BusinessContactPersonUpdateForm",
|
|
1670
|
+
props: {
|
|
1671
|
+
contactPerson: {},
|
|
1672
|
+
onSubmit: { type: Function }
|
|
1673
|
+
},
|
|
1674
|
+
setup(n) {
|
|
1675
|
+
let A = n, j = useI18n(), M = useForm({
|
|
1676
|
+
initialState: {
|
|
1677
|
+
email: A.contactPerson.email,
|
|
1678
|
+
firstName: A.contactPerson.firstName,
|
|
1679
|
+
lastName: A.contactPerson.lastName,
|
|
1680
|
+
mobilePhone: A.contactPerson.mobilePhone,
|
|
1681
|
+
phone: A.contactPerson.phone,
|
|
1682
|
+
position: A.contactPerson.position
|
|
1683
|
+
},
|
|
1684
|
+
schema: contactPersonUpdateFormSchema,
|
|
1685
|
+
onSubmit: async (n) => {
|
|
1686
|
+
await A.onSubmit(n);
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
return (n, A) => (openBlock(), createBlock(ContactPersonCreateNewForm_default, { form: unref(M) }, {
|
|
1690
|
+
actions: withCtx(() => [createVNode(AppSidebarFormFooter_default, null, {
|
|
1691
|
+
default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
|
|
1692
|
+
"is-loading": unref(M).isSubmitting.value,
|
|
1693
|
+
label: unref(j).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(n, { emit: A }) {
|
|
1708
|
+
let j = n, M = A, N = useI18n(), P = useApiErrorToast(), F = useBusinessContactPersonUpdateMutation(), I = useBusinessContactPersonDetailQuery(computed(() => j.businessUuid), computed(() => j.contactPersonUuid));
|
|
1709
|
+
async function R(n) {
|
|
1710
|
+
try {
|
|
1711
|
+
await F.execute({
|
|
1712
|
+
body: n,
|
|
1713
|
+
params: {
|
|
1714
|
+
businessUuid: j.businessUuid,
|
|
1715
|
+
contactPersonUuid: j.contactPersonUuid
|
|
1716
|
+
}
|
|
1717
|
+
}), M("close");
|
|
1718
|
+
} catch (n) {
|
|
1719
|
+
P.show(n);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
function B() {
|
|
1723
|
+
M("close");
|
|
1724
|
+
}
|
|
1725
|
+
return (n, A) => (openBlock(), createBlock(AppDialog_default, {
|
|
1726
|
+
title: unref(N).t("wise_crm.info_dialog.contact_person_update.title"),
|
|
1727
|
+
description: unref(N).t("wise_crm.info_dialog.contact_person_create.description"),
|
|
1728
|
+
onClose: B
|
|
1729
|
+
}, {
|
|
1730
|
+
default: withCtx(() => [unref(I).data.value ? (openBlock(), createBlock(BusinessContactPersonUpdateForm_default, {
|
|
1731
|
+
key: 0,
|
|
1732
|
+
"business-uuid": j.businessUuid,
|
|
1733
|
+
"on-submit": R,
|
|
1734
|
+
"contact-person": unref(I).data.value,
|
|
1735
|
+
onClose: B
|
|
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(n, { emit: A }) {
|
|
1748
|
+
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 ?? "");
|
|
1749
|
+
function R() {
|
|
1750
|
+
N("addChild");
|
|
1751
|
+
}
|
|
1752
|
+
function B(n) {
|
|
1753
|
+
F.open(EntityType.BUSINESS, n);
|
|
1754
|
+
}
|
|
1755
|
+
return (n, A) => (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
|
+
j.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: j.business.parent.uuid
|
|
1763
|
+
}, {
|
|
1764
|
+
default: withCtx(() => [createTextVNode(toDisplayString(j.business.parent.name), 1)]),
|
|
1765
|
+
_: 1
|
|
1766
|
+
}, 8, ["entity-type", "uuid"])])),
|
|
1767
|
+
createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [j.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(j.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(P).t("wise_crm.info_dialog.sidebar.business.add_icon"),
|
|
1777
|
+
icon: "plus",
|
|
1778
|
+
onClick: R
|
|
1779
|
+
}, null, 8, ["label"])]),
|
|
1780
|
+
I.value.length > 0 ? (openBlock(), createElementBlock("div", {
|
|
1781
|
+
key: 1,
|
|
1782
|
+
class: normalizeClass([{ "ml-2xl": j.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(L.value), 1)]),
|
|
1798
|
+
_: 1
|
|
1799
|
+
})]),
|
|
1800
|
+
content: withCtx(() => [createElementVNode("div", _hoisted_7, [createVNode(CrmDetailAccordionRoot_default, {
|
|
1801
|
+
"default-values": I.value[0]?.uuid ?? "",
|
|
1802
|
+
type: "single"
|
|
1803
|
+
}, {
|
|
1804
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(I.value, (n) => (openBlock(), createBlock(CrmDetailSidebarAccordionItem_default, {
|
|
1805
|
+
key: n.uuid,
|
|
1806
|
+
label: n.name,
|
|
1807
|
+
value: n.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(P).t("wise_crm.info_dialog.sidebar.business.add_icon"),
|
|
1816
|
+
icon: "linkExternal",
|
|
1817
|
+
onClick: (A) => B(n.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: n.vatNumber ?? "-",
|
|
1823
|
+
icon: "buildings"
|
|
1824
|
+
}, null, 8, ["label"]),
|
|
1825
|
+
createVNode(AppIconLabelPair_default, {
|
|
1826
|
+
label: n.email ?? "-",
|
|
1827
|
+
icon: "mail"
|
|
1828
|
+
}, null, 8, ["label"]),
|
|
1829
|
+
createVNode(AppIconLabelPair_default, {
|
|
1830
|
+
label: n.mobilePhone ?? n.phone ?? "-",
|
|
1831
|
+
icon: "phone"
|
|
1832
|
+
}, null, 8, ["label"]),
|
|
1833
|
+
createVNode(AppIconLabelPair_default, {
|
|
1834
|
+
label: n.address ? unref(AddressUtil).formatShort(n.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(n) {
|
|
1850
|
+
return n === null ? "" : `${n.countryCode}${n.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(n, { emit: A }) {
|
|
1857
|
+
let j = n, M = A, N = useI18n();
|
|
1858
|
+
function P() {
|
|
1859
|
+
M("addChild");
|
|
1860
|
+
}
|
|
1861
|
+
return (A, M) => (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(CrmDetailSidebarCard_default, null, {
|
|
1862
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(AppIconLabelPair_default, {
|
|
1863
|
+
label: j.business.vatNumber ? unref(VatNumberUtil).format(j.business.vatNumber) : "-",
|
|
1864
|
+
icon: "buildings"
|
|
1865
|
+
}, null, 8, ["label"]), createVNode(BusinessDetailSidebarAccordionBusinessInfoChildren_default, {
|
|
1866
|
+
business: n.business,
|
|
1867
|
+
onAddChild: P
|
|
1868
|
+
}, null, 8, ["business"])]), createElementVNode("div", _hoisted_3, [createVNode(AppIconLabelPair_default, {
|
|
1869
|
+
label: unref(N).t("wise_crm.info_dialog.sidebar.overview.created_at_label", { value: j.business.createdAt ? unref(useDateTimeFormat)().toDateTime(j.business.createdAt) : "-" }),
|
|
1870
|
+
icon: "clockPlus"
|
|
1871
|
+
}, null, 8, ["label"])])]),
|
|
1872
|
+
_: 1
|
|
1873
|
+
}), createVNode(CrmDetailSidebarMapCard_default, { address: j.business.address }, null, 8, ["address"])]));
|
|
1874
|
+
}
|
|
1875
|
+
}), BusinessDetailSidebarOverviewContent_default = /* @__PURE__ */ defineComponent({
|
|
1876
|
+
__name: "BusinessDetailSidebarOverviewContent",
|
|
1877
|
+
props: { business: {} },
|
|
1878
|
+
setup(n) {
|
|
1879
|
+
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);
|
|
1880
|
+
function H() {
|
|
1881
|
+
I.open({ businessUuid: A.business.uuid });
|
|
1882
|
+
}
|
|
1883
|
+
function U(n) {
|
|
1884
|
+
R.open({
|
|
1885
|
+
businessUuid: A.business.uuid,
|
|
1886
|
+
contactPersonUuid: n
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
function W(n) {
|
|
1890
|
+
N.open({
|
|
1891
|
+
title: j.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_title"),
|
|
1892
|
+
isDestructive: !0,
|
|
1893
|
+
isLoading: F.isLoading.value,
|
|
1894
|
+
confirmText: j.t("shared.delete"),
|
|
1895
|
+
description: j.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_description"),
|
|
1896
|
+
onConfirm: async () => {
|
|
1897
|
+
try {
|
|
1898
|
+
await F.execute({
|
|
1899
|
+
body: { contactPersonUuid: n },
|
|
1900
|
+
params: { businessUuid: A.business.uuid }
|
|
1901
|
+
});
|
|
1902
|
+
} catch (n) {
|
|
1903
|
+
M.show(n);
|
|
1904
|
+
} finally {
|
|
1905
|
+
N.close();
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
function G(n) {
|
|
1911
|
+
P.execute({ params: {
|
|
1912
|
+
businessUuid: A.business.uuid,
|
|
1913
|
+
contactPersonUuid: n
|
|
1914
|
+
} });
|
|
1915
|
+
}
|
|
1916
|
+
function K() {
|
|
1917
|
+
B.open({ businessUuid: A.business.uuid });
|
|
1918
|
+
}
|
|
1919
|
+
return (M, N) => (openBlock(), createBlock(CrmDetailAccordionRoot_default, { "default-values": [
|
|
1920
|
+
"business",
|
|
1921
|
+
"invoice",
|
|
1922
|
+
"contact-persons"
|
|
1923
|
+
] }, {
|
|
1924
|
+
default: withCtx(() => [
|
|
1925
|
+
createVNode(CrmDetailSidebarAccordionItem_default, {
|
|
1926
|
+
label: unref(j).t("wise_crm.info_dialog.sidebar.overview.business_info"),
|
|
1927
|
+
value: "business",
|
|
1928
|
+
icon: "infoCircle"
|
|
1929
|
+
}, {
|
|
1930
|
+
default: withCtx(() => [createVNode(BusinessDetailSidebarAccordionBusinessInfo_default, {
|
|
1931
|
+
business: n.business,
|
|
1932
|
+
onAddChild: K
|
|
1933
|
+
}, null, 8, ["business"])]),
|
|
1934
|
+
_: 1
|
|
1935
|
+
}, 8, ["label"]),
|
|
1936
|
+
createVNode(CrmDetailSidebarAccordionItem_default, {
|
|
1937
|
+
"is-empty": A.business.billingInformation === null,
|
|
1938
|
+
label: unref(j).t("wise_crm.info_dialog.sidebar.overview.invoice_label"),
|
|
1939
|
+
value: "invoice",
|
|
1940
|
+
icon: "wallet"
|
|
1941
|
+
}, {
|
|
1942
|
+
default: withCtx(() => [A.business.billingInformation ? (openBlock(), createBlock(CrmDetailSidebarAccordionBillingInformation_default, {
|
|
1943
|
+
key: 0,
|
|
1944
|
+
"invoice-address": A.business.billingInformation?.location?.address ?? null,
|
|
1945
|
+
"invoice-email": A.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": !V.value,
|
|
1951
|
+
label: unref(j).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
|
|
1952
|
+
value: "contact-persons",
|
|
1953
|
+
icon: "userCircle",
|
|
1954
|
+
onAdd: H
|
|
1955
|
+
}, {
|
|
1956
|
+
actions: withCtx(() => [V.value ? createCommentVNode("", !0) : (openBlock(), createBlock(CrmDetailSidebarAccordionHeaderIconButton_default, {
|
|
1957
|
+
key: 0,
|
|
1958
|
+
label: unref(j).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
|
|
1959
|
+
class: "z-1",
|
|
1960
|
+
icon: "plus",
|
|
1961
|
+
onClick: H
|
|
1962
|
+
}, null, 8, ["label"]))]),
|
|
1963
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(A.business.contactPersons, (n) => (openBlock(), createBlock(unref(Motion), {
|
|
1964
|
+
key: n.uuid,
|
|
1965
|
+
"layout-id": n.uuid
|
|
1966
|
+
}, {
|
|
1967
|
+
default: withCtx(() => [createVNode(CrmDetailSidebarAccordionContactPersonInfo_default, {
|
|
1968
|
+
"contact-person": n,
|
|
1969
|
+
"on-toggle-is-primary": () => G(n.uuid),
|
|
1970
|
+
onUpdate: (A) => U(n.uuid),
|
|
1971
|
+
onDelete: (A) => W(n.uuid)
|
|
1972
|
+
}, null, 8, [
|
|
1973
|
+
"contact-person",
|
|
1974
|
+
"on-toggle-is-primary",
|
|
1975
|
+
"onUpdate",
|
|
1976
|
+
"onDelete"
|
|
1977
|
+
])]),
|
|
1978
|
+
_: 2
|
|
1979
|
+
}, 1032, ["layout-id"]))), 128)), V.value ? (openBlock(), createBlock(unref(VcButton), {
|
|
1980
|
+
key: 0,
|
|
1981
|
+
variant: "tertiary",
|
|
1982
|
+
size: "sm",
|
|
1983
|
+
"icon-left": "plus",
|
|
1984
|
+
onClick: H
|
|
1985
|
+
}, {
|
|
1986
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(j).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(n) {
|
|
1996
|
+
return n.ACTIVITY = "activity", n.NOTES = "notes", n.OVERVIEW = "overview", n;
|
|
1997
|
+
}(InfoTab || {}), BusinessDetailSidebar_default = /* @__PURE__ */ defineComponent({
|
|
1998
|
+
__name: "BusinessDetailSidebar",
|
|
1999
|
+
props: { business: {} },
|
|
2000
|
+
setup(n) {
|
|
2001
|
+
let A = n, j = useI18n(), M = useCrm(), N = computed(() => M.getEntityConfig(EntityType.BUSINESS)), P = ref(InfoTab.OVERVIEW), F = computed(() => [
|
|
2002
|
+
{
|
|
2003
|
+
icon: "infoCircle",
|
|
2004
|
+
label: j.t("wise_crm.shared.overview"),
|
|
2005
|
+
value: InfoTab.OVERVIEW
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
icon: "activity",
|
|
2009
|
+
label: j.t("wise_crm.shared.activity"),
|
|
2010
|
+
value: InfoTab.ACTIVITY
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
icon: "book",
|
|
2014
|
+
label: j.t("wise_crm.shared.notes"),
|
|
2015
|
+
value: InfoTab.NOTES
|
|
2016
|
+
}
|
|
2017
|
+
]);
|
|
2018
|
+
return (n, j) => (openBlock(), createBlock(AppColorProvider_default, {
|
|
2019
|
+
color: unref(M).getEntityConfig(unref(EntityType).BUSINESS)?.color ?? null,
|
|
2020
|
+
class: "flex h-full flex-col"
|
|
2021
|
+
}, {
|
|
2022
|
+
default: withCtx(() => [createVNode(CrmDetailHeaderCard_default, {
|
|
2023
|
+
"entity-type": unref(EntityType).BUSINESS,
|
|
2024
|
+
name: A.business.name,
|
|
2025
|
+
address: A.business.address,
|
|
2026
|
+
email: A.business.email,
|
|
2027
|
+
"mobile-phone": A.business.mobilePhone,
|
|
2028
|
+
"entity-name": N.value?.name ?? null,
|
|
2029
|
+
phone: A.business.phone
|
|
2030
|
+
}, null, 8, [
|
|
2031
|
+
"entity-type",
|
|
2032
|
+
"name",
|
|
2033
|
+
"address",
|
|
2034
|
+
"email",
|
|
2035
|
+
"mobile-phone",
|
|
2036
|
+
"entity-name",
|
|
2037
|
+
"phone"
|
|
2038
|
+
]), createVNode(CrmDetailSidebarTabs_default, {
|
|
2039
|
+
modelValue: P.value,
|
|
2040
|
+
"onUpdate:modelValue": j[0] ||= (n) => P.value = n,
|
|
2041
|
+
tabs: F.value
|
|
2042
|
+
}, {
|
|
2043
|
+
default: withCtx(() => [
|
|
2044
|
+
P.value === InfoTab.OVERVIEW ? (openBlock(), createBlock(BusinessDetailSidebarOverviewContent_default, {
|
|
2045
|
+
key: 0,
|
|
2046
|
+
business: A.business
|
|
2047
|
+
}, null, 8, ["business"])) : createCommentVNode("", !0),
|
|
2048
|
+
P.value === InfoTab.ACTIVITY ? (openBlock(), createBlock(BusinessDetailSidebarActivityContent_default, {
|
|
2049
|
+
key: 1,
|
|
2050
|
+
business: A.business
|
|
2051
|
+
}, null, 8, ["business"])) : createCommentVNode("", !0),
|
|
2052
|
+
P.value === InfoTab.NOTES ? (openBlock(), createBlock(BusinessDetailSidebarNotesContent_default, {
|
|
2053
|
+
key: 2,
|
|
2054
|
+
business: A.business
|
|
2055
|
+
}, null, 8, ["business"])) : createCommentVNode("", !0)
|
|
2056
|
+
]),
|
|
2057
|
+
_: 1
|
|
2058
|
+
}, 8, ["modelValue", "tabs"])]),
|
|
2059
|
+
_: 1
|
|
2060
|
+
}, 8, ["color"]));
|
|
2061
|
+
}
|
|
2062
|
+
}), BusinessDetailSidebarProvider_default = /* @__PURE__ */ defineComponent({
|
|
2063
|
+
__name: "BusinessDetailSidebarProvider",
|
|
2064
|
+
props: { businessUuid: {} },
|
|
2065
|
+
setup(n) {
|
|
2066
|
+
let A = n, j = useI18n(), M = useBusinessDetailQuery(computed(() => A.businessUuid)), N = computed(() => M.data.value ?? null);
|
|
2067
|
+
return (n, A) => (openBlock(), createBlock(CrmDetailContainer_default, null, {
|
|
2068
|
+
default: withCtx(() => [unref(M).isError.value ? (openBlock(), createBlock(Error_default, {
|
|
2069
|
+
key: 0,
|
|
2070
|
+
message: unref(j).t("error.business_details.description"),
|
|
2071
|
+
title: unref(j).t("error.business_details.title")
|
|
2072
|
+
}, null, 8, ["message", "title"])) : unref(M).isLoading.value ? (openBlock(), createBlock(AppSkeletonLoader_default, {
|
|
2073
|
+
key: 1,
|
|
2074
|
+
class: "h-full"
|
|
2075
|
+
})) : N.value ? (openBlock(), createBlock(BusinessDetailSidebar_default, {
|
|
2076
|
+
key: 2,
|
|
2077
|
+
business: N.value
|
|
2078
|
+
}, null, 8, ["business"])) : createCommentVNode("", !0)]),
|
|
2079
|
+
_: 1
|
|
2080
|
+
}));
|
|
2081
|
+
}
|
|
2082
|
+
});
|
|
2083
|
+
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 };
|