@wisemen/wise-crm-web 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +1037 -0
  2. package/dist/BusinessDetailSidebarProvider-BQMRbGHQ.js +2083 -0
  3. package/dist/{BusinessDetailView-DvhFfuGg.js → BusinessDetailView-BxGxWOme.js} +5 -5
  4. package/dist/{CrmDetailHeaderCard-e5332OkQ.js → CrmDetailHeaderCard-CCNJpMAK.js} +68 -67
  5. package/dist/{CrmDetailView-C-lsAhtD.js → CrmDetailView-ozCpuaX2.js} +14 -14
  6. package/dist/{DealCommunicationTabView-e7NkRy9r.js → DealCommunicationTabView-Df5EeolN.js} +2 -2
  7. package/dist/{DealDetailView-BDCbOBoo.js → DealDetailView-DdWHqaBr.js} +163 -163
  8. package/dist/{DealExternalAttachment-D1PznE3V.js → DealExternalAttachment-qHdh4yMI.js} +1 -1
  9. package/dist/{DealSendMailDialog-DVE2iYQC.js → DealSendMailDialog-BaYcWZP-.js} +65 -69
  10. package/dist/Error-BArv9rNb.js +12650 -0
  11. package/dist/IndividualDetailSidebarProvider-BXZH951l.js +608 -0
  12. package/dist/{IndividualDetailView-B7dX3hZ8.js → IndividualDetailView-DfYS31-e.js} +5 -5
  13. package/dist/LinkBrokenIcon-CTlqmapl.js +17 -0
  14. package/dist/api/mutations/deal/dealCreate.mutation.d.ts +1 -1
  15. package/dist/api/mutations/deal/dealUpdate.mutation.d.ts +3 -3
  16. package/dist/api/mutations/mail-template/mailTemplateUpdate.mutation.d.ts +1 -1
  17. package/dist/client/apiErrorCode.gen.d.ts +2 -2
  18. package/dist/client/sdk.gen.d.ts +20 -17
  19. package/dist/client/types.gen.d.ts +1057 -1376
  20. package/dist/client/zod.gen.d.ts +15453 -17750
  21. package/dist/{client-BP13IBbl.js → client-pCaNxE3C.js} +748 -1047
  22. package/dist/components/app/dialog/AppConfirmDialog.vue.d.ts +2 -2
  23. package/dist/components/crm-detail/CrmDetailHeaderCard.vue.d.ts +2 -0
  24. package/dist/components/crm-detail/CrmDetailSidebarAccordionContactPersonInfo.vue.d.ts +2 -2
  25. package/dist/components/crm-detail/CrmDetailSidebarAccordionGenericContactPersonInfo.vue.d.ts +2 -2
  26. package/dist/components/notes/NoteList.vue.d.ts +2 -2
  27. package/dist/deal/components/DealSendMailForm.vue.d.ts +2 -2
  28. package/dist/deal/components/DealSendMailFormFooter.vue.d.ts +1 -1
  29. package/dist/deal/components/DealSettingsDialogMailTemplateForm.vue.d.ts +2 -2
  30. package/dist/deal/components/DealSettingsDialogMailTemplateFormFields.vue.d.ts +2 -2
  31. package/dist/dialogs/contact-create/ContactCreateDialog.vue.d.ts +1 -1
  32. package/dist/dialogs/contact-create/components/ContactCreateDialogBusinessContactPersonSearch.vue.d.ts +2 -2
  33. package/dist/dialogs/contact-create/components/ContactCreateDialogBusinessGeneralInfo.vue.d.ts +2 -2
  34. package/dist/dialogs/contact-create/components/ContactCreateDialogFooter.vue.d.ts +2 -2
  35. package/dist/dialogs/contact-create/components/ContactCreateDialogFormSection.vue.d.ts +2 -2
  36. package/dist/dialogs/note/CrmDetailSidebarNotesView.vue.d.ts +2 -2
  37. package/dist/icons/LinkBrokenIcon.vue.d.ts +3 -0
  38. package/dist/icons/icon.d.ts +1 -0
  39. package/dist/index.d.ts +4 -0
  40. package/dist/index.js +448 -453
  41. package/dist/models/brand-colors/brandColor.model.d.ts +14 -0
  42. package/dist/models/brand-colors/brandColor.transformer.d.ts +5 -0
  43. package/dist/models/conent-locale/contentLocaleEnum.model.d.ts +3 -3
  44. package/dist/models/deal/create/dealCreateForm.model.d.ts +2 -2
  45. package/dist/models/deal/detail/dealDetail.model.d.ts +2 -2
  46. package/dist/models/deal/index/dealIndex.model.d.ts +2 -2
  47. package/dist/models/deal/update/dealUpdateForm.model.d.ts +2 -2
  48. package/dist/models/mail-template/detail/mailTemplateDetail.model.d.ts +2 -2
  49. package/dist/models/mail-template/update/mailTemplateUpdateForm.model.d.ts +3 -3
  50. package/dist/models/phone-number/phoneNumberForm.model.d.ts +3 -0
  51. package/dist/models/tenant-config/tenantConfig.model.d.ts +3 -0
  52. package/dist/plugins/i18n.plugin.d.ts +4 -0
  53. package/dist/style.css +1 -1
  54. package/dist/testing/factories/business.factory.d.ts +2 -1
  55. package/dist/testing.js +23 -2
  56. package/package.json +2 -1
  57. package/dist/BusinessDetailSidebarProvider-D11bjWFa.js +0 -2081
  58. package/dist/BusinessDetailSidebarProvider-DYY-Uzvx.js +0 -2081
  59. package/dist/BusinessDetailSidebarProvider-ZYGQoNHh.js +0 -2081
  60. package/dist/BusinessDetailView-BOCy7G-w.js +0 -24
  61. package/dist/BusinessDetailView-WaATSNQS.js +0 -24
  62. package/dist/CrmDetailHeaderCard-C-JNdi7s.js +0 -2515
  63. package/dist/CrmDetailHeaderCard-qkNK-2wR.js +0 -2515
  64. package/dist/CrmDetailView-C6Xm1Lp6.js +0 -65
  65. package/dist/CrmDetailView-DQehs8Fb.js +0 -65
  66. package/dist/DealDetailView-BfkDNvK4.js +0 -1021
  67. package/dist/DealDetailView-Cs5TDhih.js +0 -1021
  68. package/dist/DealSendMailDialog-D5Voyhhc.js +0 -1556
  69. package/dist/DealSendMailDialog-OAn6xjLq.js +0 -1556
  70. package/dist/Error-5vt6UD4m.js +0 -3708
  71. package/dist/Error-B4TwHEhb.js +0 -3706
  72. package/dist/Error-BPxDpKcI.js +0 -3706
  73. package/dist/IndividualDetailSidebarProvider-CvZQdjzp.js +0 -606
  74. package/dist/IndividualDetailSidebarProvider-DBITt-9W.js +0 -606
  75. package/dist/IndividualDetailSidebarProvider-vIu7Hv8O.js +0 -606
  76. package/dist/IndividualDetailView-B1vbJXGc.js +0 -24
  77. package/dist/IndividualDetailView-BKEs0XS5.js +0 -24
  78. /package/dist/{LinkExternalIcon-B9Qg55Oa.js → LinkExternalIcon-LOVtSqBT.js} +0 -0
  79. /package/dist/{LinkIcon-DCW5zjbQ.js → LinkIcon-DqBbVrvs.js} +0 -0
  80. /package/dist/{LocationPinIcon-DBc-wt2e.js → LocationPinIcon-Cp-wRgk2.js} +0 -0
  81. /package/dist/{MailIcon-Do4a7S2W.js → MailIcon-CnTrB1k3.js} +0 -0
  82. /package/dist/{MobilePhoneIcon-DSXyKwjd.js → MobilePhoneIcon-B747hmpS.js} +0 -0
  83. /package/dist/{NumberedListIcon-DUaSJSYu.js → NumberedListIcon-amJxDaaD.js} +0 -0
  84. /package/dist/{PhoneIcon-C8Cv1IiW.js → PhoneIcon-94MYVL85.js} +0 -0
  85. /package/dist/{RefreshIcon-CKZgHIZU.js → RefreshIcon-DRe3coBc.js} +0 -0
  86. /package/dist/{SendIcon-B-sQkQ3W.js → SendIcon-MYItp1xI.js} +0 -0
  87. /package/dist/{SettingsIcon-DzP-IQS5.js → SettingsIcon-C0qTAv0w.js} +0 -0
  88. /package/dist/{StarOutlineIcon-c0VfXRdQ.js → StarOutlineIcon-CiFLgepk.js} +0 -0
  89. /package/dist/{StarYellowIcon-CH0CnlSU.js → StarYellowIcon-C0v_XGwI.js} +0 -0
  90. /package/dist/{ThreeDotsIcon-C6PCFq5J.js → ThreeDotsIcon-lujOTU3G.js} +0 -0
  91. /package/dist/{TimeLineMarkerIcon-6B6SbwTN.js → TimeLineMarkerIcon-C4LfErbc.js} +0 -0
  92. /package/dist/{TrashIcon-BTPSVviz.js → TrashIcon-v4L9SEK_.js} +0 -0
  93. /package/dist/{UploadCloudIcon-1aMW5OJq.js → UploadCloudIcon-j1-1Rvqb.js} +0 -0
  94. /package/dist/{UserCircleIcon-D-19dc-2.js → UserCircleIcon-BjUt_2C4.js} +0 -0
  95. /package/dist/{UserIcon-D1H8TGlg.js → UserIcon-Cb2jFKLr.js} +0 -0
  96. /package/dist/{VerticalDotsIcon-DmPza4Jd.js → VerticalDotsIcon-Y3m6tlQ2.js} +0 -0
  97. /package/dist/{WalletIcon-BlI3D3v-.js → WalletIcon-pPsKbzmh.js} +0 -0
@@ -1,606 +0,0 @@
1
- import { H as AppConfirmDialog_default, I as NoteUpdateDialog_default, M as AppSidebarFormSubmitButton_default, N as AppSidebarFormFooter_default, O as AppColorProvider_default, Q as NoteService, R as CrmDetailSidebarNotesView_default, X as useKeysetInfiniteQuery, Z as useNoteDeleteMutation, c as CrmDetailAccordionRoot_default, h as useContactPersonCreateMutation, i as CrmDetailSidebarAccordionHeaderIconButton_default, l as AppIconLabelPair_default, m as AppDialog_default, n as CrmDetailContainer_default, o as CrmDetailSidebarCard_default, q as useApiErrorToast, r as CrmDetailSidebarTabs_default, s as CrmDetailSidebarAccordionItem_default, t as Error_default, v as IndividualService, w as useCrm } from "./Error-BPxDpKcI.js";
2
- import { a as contactPersonUpdateFormSchema, 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-e5332OkQ.js";
3
- import { c as Be, l as He, n as useDateTimeFormat, t as AppSkeletonLoader_default, u as ze } from "./AppSkeletonLoader-BAhoOmFD.js";
4
- import { gt as EntityType } from "./client-BP13IBbl.js";
5
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, renderList, toDisplayString, unref, withCtx } from "vue";
6
- import { useI18n } from "vue-i18n";
7
- import { VcButton, VcIconButton, VcRouterLinkButton, useDialog, usePagination, useToast } from "@wisemen/vue-core-components";
8
- import { useMutation, useQueryClient } from "@tanstack/vue-query";
9
- import { useForm } from "formango";
10
- import { Motion } from "motion-v";
11
- function useIndividualDetailQuery(a) {
12
- return He({
13
- isEnabled: computed(() => a.value !== null),
14
- queryFn: () => (assert(a.value !== null, "individualUuid is null"), IndividualService.getByUuid(a.value)),
15
- queryKey: { wiseCrmIndividualDetail: { individualUuid: a } }
16
- });
17
- }
18
- function useIndividualGrantMutation() {
19
- return ze({
20
- queryFn: async ({ body: a, params: P }) => await IndividualService.grantUser(P.individualUuid, a),
21
- queryKeysToInvalidate: { wiseCrmIndividualDetail: { individualUuid: (a) => a.individualUuid } }
22
- });
23
- }
24
- function useActivityIndividualIndexQuery(a, P) {
25
- return Be({
26
- paginationOptions: P,
27
- queryFn: async (P) => await IndividualService.getActivity(a.value, P),
28
- queryKey: { individualActivityIndex: { paginationOptions: P } }
29
- });
30
- }
31
- var IndividualDetailSidebarActivityContent_default = /* @__PURE__ */ defineComponent({
32
- __name: "IndividualDetailSidebarActivityContent",
33
- props: { individual: {} },
34
- setup(a) {
35
- let P = a, F = usePagination({
36
- isRouteQueryEnabled: !1,
37
- type: "keyset"
38
- }), I = useActivityIndividualIndexQuery(computed(() => P.individual.uuid), F.paginationOptions), L = computed(() => I.data.value.data ?? []);
39
- async function R() {
40
- await I.getNextPage();
41
- }
42
- return (a, P) => (openBlock(), createBlock(ActivityList_default, {
43
- "on-next": R,
44
- "is-loading": unref(I).isLoading.value,
45
- activities: L.value
46
- }, null, 8, ["is-loading", "activities"]));
47
- }
48
- });
49
- function useNoteIndividualCreateMutation() {
50
- return ze({
51
- queryFn: async ({ body: a, params: P }) => await NoteService.create(a, { individualUuid: P.individualUuid }),
52
- queryKeysToInvalidate: { noteIndividualIndex: {} }
53
- });
54
- }
55
- function useNoteIndividualIndexQuery(a, P) {
56
- return useKeysetInfiniteQuery({
57
- queryFn: (P) => NoteService.getIndividualNotes({ pagination: P }, a.value),
58
- queryKey: { noteIndividualIndex: { params: P?.params } }
59
- });
60
- }
61
- var IndividualDetailSidebarNotesContent_default = /* @__PURE__ */ defineComponent({
62
- __name: "IndividualDetailSidebarNotesContent",
63
- props: { individual: {} },
64
- setup(a) {
65
- let F = a, I = useApiErrorToast(), L = useNoteIndividualCreateMutation(), R = useNoteDeleteMutation(), B = useDialog(NoteUpdateDialog_default), H = useNoteIndividualIndexQuery(computed(() => F.individual.uuid)), U = computed(() => H.data?.value?.data ?? []);
66
- async function W(a) {
67
- try {
68
- await L.execute({
69
- body: a,
70
- params: { individualUuid: F.individual.uuid }
71
- });
72
- } catch (a) {
73
- I.show(a);
74
- }
75
- }
76
- async function G(a) {
77
- try {
78
- await R.execute({ params: { noteUuid: a } });
79
- } catch (a) {
80
- I.show(a);
81
- }
82
- }
83
- function K(a) {
84
- B.open({ note: a });
85
- }
86
- return (a, P) => (openBlock(), createBlock(CrmDetailSidebarNotesView_default, {
87
- "is-loading": unref(H).isLoading.value,
88
- notes: U.value,
89
- "on-submit": W,
90
- "has-next-page": unref(H).hasNextPage.value,
91
- onNext: P[0] ||= (a) => unref(H).fetchNextPage(),
92
- onDelete: G,
93
- onUpdate: K
94
- }, null, 8, [
95
- "is-loading",
96
- "notes",
97
- "has-next-page"
98
- ]));
99
- }
100
- });
101
- function useIndividualSetPrimaryContactPersonMutation() {
102
- let a = useQueryClient(), P = "wiseCrmIndividualDetail", F = useMutation({
103
- mutationFn: async (a) => {
104
- await IndividualService.setPrimaryContactPerson(a.individualUuid, a.contactPersonUuid);
105
- },
106
- onError: (F, I, L) => {
107
- a.setQueryData([P, { individualUuid: I.individualUuid }], L?.previousData);
108
- },
109
- onMutate: async (F) => {
110
- await a.cancelQueries({ queryKey: [P] });
111
- let I = a.getQueryData([P, { individualUuid: F.individualUuid }]);
112
- return I === void 0 ? {} : (a.setQueryData([P, { individualUuid: F.individualUuid }], {
113
- ...I,
114
- contactPersons: I.contactPersons.map((a) => a.uuid === F.contactPersonUuid ? {
115
- ...a,
116
- isPrimary: !a.isPrimary
117
- } : {
118
- ...a,
119
- isPrimary: !1
120
- })
121
- }), { previousData: I });
122
- },
123
- onSettled: (F, I, L, R) => {
124
- L !== void 0 && a.invalidateQueries({ queryKey: [P, { individualUuid: L.individualUuid }] });
125
- }
126
- });
127
- return {
128
- isLoading: computed(() => F.isPending.value),
129
- data: computed(() => F.data.value),
130
- execute: async (a) => {
131
- await F.mutateAsync(a.params);
132
- }
133
- };
134
- }
135
- function useIndividualUnlinkContactPersonMutation() {
136
- return ze({
137
- queryFn: async ({ body: a, params: P }) => await IndividualService.unlinkContactPerson(P.individualUuid, a.contactPersonUuid),
138
- queryKeysToInvalidate: {
139
- individualIndex: {},
140
- wiseCrmIndividualDetail: { individualUuid: (a) => a.individualUuid }
141
- }
142
- });
143
- }
144
- var _hoisted_1$1 = { class: "gap-md flex flex-col" }, CrmDetailSidebarAccordionCustomerInfo_default = /* @__PURE__ */ defineComponent({
145
- __name: "CrmDetailSidebarAccordionCustomerInfo",
146
- props: { individual: {} },
147
- setup(a) {
148
- let P = a, F = useI18n();
149
- return (a, I) => (openBlock(), createElementBlock("div", _hoisted_1$1, [createVNode(CrmDetailSidebarCard_default, null, {
150
- default: withCtx(() => [createVNode(AppIconLabelPair_default, {
151
- label: unref(F).t("wise_crm.info_dialog.sidebar.overview.created_at_label", { value: P.individual.createdAt ? unref(useDateTimeFormat)().toDateTime(P.individual.createdAt) : "-" }),
152
- icon: "clockPlus"
153
- }, null, 8, ["label"])]),
154
- _: 1
155
- }), createVNode(CrmDetailSidebarMapCard_default, { address: P.individual.address }, null, 8, ["address"])]));
156
- }
157
- });
158
- function useIndividualLinkContactPersonMutation() {
159
- return ze({
160
- queryFn: async ({ body: a, params: P }) => await IndividualService.linkContactPerson(P.individualUuid, a.contactPersonUuid, a.position, a.contactInfo),
161
- queryKeysToInvalidate: {
162
- individualIndex: {},
163
- wiseCrmIndividualDetail: { individualUuid: (a) => a.individualUuid }
164
- }
165
- });
166
- }
167
- var IndividualContactPersonCreateDialog_default = /* @__PURE__ */ defineComponent({
168
- __name: "IndividualContactPersonCreateDialog",
169
- props: {
170
- individualUuid: {},
171
- isCreatingNewContactPerson: {
172
- type: Boolean,
173
- default: !1
174
- }
175
- },
176
- emits: ["close", "createNewContactPerson"],
177
- setup(a, { emit: P }) {
178
- let F = a, I = P, L = useI18n(), R = useApiErrorToast(), z = useIndividualLinkContactPersonMutation(), B = useContactPersonCreateMutation();
179
- async function V(a) {
180
- try {
181
- let P = await B.execute({ body: {
182
- email: a.email,
183
- firstName: a.firstName,
184
- lastName: a.lastName,
185
- mobilePhone: a.mobilePhone,
186
- phone: a.phone
187
- } });
188
- F.isCreatingNewContactPerson || await z.execute({
189
- body: {
190
- contactPersonUuid: P,
191
- contactInfo: {
192
- email: a.email,
193
- mobilePhone: a.mobilePhone,
194
- phone: a.phone
195
- },
196
- position: a.position
197
- },
198
- params: { individualUuid: F.individualUuid }
199
- }), W({
200
- label: `${a.firstName} ${a.lastName}`,
201
- value: P
202
- });
203
- } catch (a) {
204
- R.show(a);
205
- }
206
- }
207
- async function H(a, P, I) {
208
- if (a !== null) try {
209
- await z.execute({
210
- body: {
211
- contactPersonUuid: a,
212
- contactInfo: P,
213
- position: I
214
- },
215
- params: { individualUuid: F.individualUuid }
216
- }), W();
217
- } catch (a) {
218
- R.show(a);
219
- }
220
- }
221
- function W(a) {
222
- if (a === void 0) {
223
- I("close");
224
- return;
225
- }
226
- I("createNewContactPerson", a), I("close");
227
- }
228
- return (a, P) => (openBlock(), createBlock(AppDialog_default, {
229
- title: unref(L).t("wise_crm.info_dialog.contact_person_create.title"),
230
- description: unref(L).t("wise_crm.info_dialog.contact_person_create.description"),
231
- onClose: W
232
- }, {
233
- default: withCtx(() => [createVNode(ContactPersonCreateForm_default, {
234
- "on-submit": V,
235
- "on-link-contact-person": H,
236
- "is-creating-new-contact-person": F.isCreatingNewContactPerson,
237
- onClose: W
238
- }, null, 8, ["is-creating-new-contact-person"])]),
239
- _: 1
240
- }, 8, ["title", "description"]));
241
- }
242
- });
243
- function useIndividualContactPersonUpdateMutation() {
244
- return ze({
245
- queryFn: async ({ body: a, params: P }) => await IndividualService.updateContactPerson(P.individualUuid, P.contactPersonUuid, a),
246
- queryKeysToInvalidate: {
247
- contactPersonDetail: { contactPersonUuid: (a) => a.contactPersonUuid },
248
- individualIndex: {},
249
- wiseCrmIndividualDetail: { individualUuid: (a) => a.individualUuid }
250
- }
251
- });
252
- }
253
- function useIndividualContactPersonDetailQuery(a, P) {
254
- return He({
255
- isEnabled: computed(() => a.value !== null && P.value !== null),
256
- queryFn: () => {
257
- if (a.value === null) throw Error("Individual UUID is null");
258
- if (P.value === null) throw Error("Contact Person UUID is null");
259
- return IndividualService.getContactPerson(a.value, P.value);
260
- },
261
- queryKey: { contactPersonDetail: { contactPersonUuid: P } }
262
- });
263
- }
264
- var IndividualContactPersonUpdateForm_default = /* @__PURE__ */ defineComponent({
265
- __name: "IndividualContactPersonUpdateForm",
266
- props: {
267
- individualUuid: {},
268
- contactPerson: {},
269
- onSubmit: { type: Function }
270
- },
271
- setup(a) {
272
- let P = a, L = useI18n(), R = useForm({
273
- initialState: {
274
- email: P.contactPerson.email,
275
- firstName: P.contactPerson.firstName,
276
- lastName: P.contactPerson.lastName,
277
- mobilePhone: P.contactPerson.mobilePhone,
278
- phone: P.contactPerson.phone,
279
- position: P.contactPerson.position
280
- },
281
- schema: contactPersonUpdateFormSchema,
282
- onSubmit: async (a) => {
283
- await P.onSubmit(a);
284
- }
285
- });
286
- return (a, P) => (openBlock(), createBlock(ContactPersonCreateNewForm_default, { form: unref(R) }, {
287
- actions: withCtx(() => [createVNode(AppSidebarFormFooter_default, null, {
288
- default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
289
- "is-loading": unref(R).isSubmitting.value,
290
- label: unref(L).t("wise_crm.shared.save_changes")
291
- }, null, 8, ["is-loading", "label"])]),
292
- _: 1
293
- })]),
294
- _: 1
295
- }, 8, ["form"]));
296
- }
297
- }), IndividualContactPersonUpdateDialog_default = /* @__PURE__ */ defineComponent({
298
- __name: "IndividualContactPersonUpdateDialog",
299
- props: {
300
- contactPersonUuid: {},
301
- individualUuid: {}
302
- },
303
- emits: ["close"],
304
- setup(a, { emit: P }) {
305
- let F = a, I = P, L = useI18n(), R = useApiErrorToast(), z = useIndividualContactPersonDetailQuery(computed(() => F.individualUuid), computed(() => F.contactPersonUuid)), B = useIndividualContactPersonUpdateMutation();
306
- async function V(a) {
307
- try {
308
- await B.execute({
309
- body: a,
310
- params: {
311
- contactPersonUuid: F.contactPersonUuid,
312
- individualUuid: F.individualUuid
313
- }
314
- }), I("close");
315
- } catch (a) {
316
- R.show(a);
317
- }
318
- }
319
- function H() {
320
- I("close");
321
- }
322
- return (a, P) => (openBlock(), createBlock(AppDialog_default, {
323
- title: unref(L).t("wise_crm.info_dialog.contact_person_update.title"),
324
- description: unref(L).t("wise_crm.info_dialog.contact_person_create.description"),
325
- onClose: H
326
- }, {
327
- default: withCtx(() => [unref(z).data.value ? (openBlock(), createBlock(IndividualContactPersonUpdateForm_default, {
328
- key: 0,
329
- "individual-uuid": F.individualUuid,
330
- "on-submit": V,
331
- "contact-person": unref(z).data.value,
332
- onClose: H
333
- }, null, 8, ["individual-uuid", "contact-person"])) : createCommentVNode("", !0)]),
334
- _: 1
335
- }, 8, ["title", "description"]));
336
- }
337
- }), _hoisted_1 = { class: "gap-sm flex" }, _hoisted_2 = { class: "font-regular flex flex-col items-start" }, _hoisted_3 = { class: "font-semibold" }, _hoisted_4 = { class: "font-regular text-brand-500 text-xs" }, IndividualDetailSidebarOverviewContent_default = /* @__PURE__ */ defineComponent({
338
- __name: "IndividualDetailSidebarOverviewContent",
339
- props: { individual: {} },
340
- setup(P) {
341
- let F = P, I = useI18n(), L = useApiErrorToast(), R = useCrm(), z = useDialog(IndividualContactPersonCreateDialog_default), B = useDialog(IndividualContactPersonUpdateDialog_default), V = useDialog(AppConfirmDialog_default), U = useIndividualSetPrimaryContactPersonMutation(), K = useIndividualUnlinkContactPersonMutation(), q = computed(() => F.individual.contactPersons.length > 0), J = computed(() => F.individual.billingInformationDetail !== null), Y = computed(() => R.getEntityConfig(EntityType.BUSINESS)?.name.toLowerCase() ?? "");
342
- function X() {
343
- z.open({ individualUuid: F.individual.uuid });
344
- }
345
- function Z(a) {
346
- B.open({
347
- contactPersonUuid: a,
348
- individualUuid: F.individual.uuid
349
- });
350
- }
351
- function Q(a) {
352
- V.open({
353
- title: I.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_title"),
354
- isDestructive: !0,
355
- isLoading: K.isLoading.value,
356
- confirmText: I.t("shared.delete"),
357
- description: I.t("wise_crm.info_dialog.sidebar.overview.delete_contact_person_description"),
358
- onConfirm: async () => {
359
- try {
360
- await K.execute({
361
- body: { contactPersonUuid: a },
362
- params: { individualUuid: F.individual.uuid }
363
- });
364
- } catch (a) {
365
- L.show(a);
366
- } finally {
367
- V.close();
368
- }
369
- }
370
- });
371
- }
372
- function $(a) {
373
- U.execute({ params: {
374
- contactPersonUuid: a,
375
- individualUuid: F.individual.uuid
376
- } });
377
- }
378
- return (a, L) => (openBlock(), createBlock(CrmDetailAccordionRoot_default, { "default-values": [
379
- "customer",
380
- "invoice",
381
- "contact-persons",
382
- "linked-businesses"
383
- ] }, {
384
- default: withCtx(() => [
385
- createVNode(CrmDetailSidebarAccordionItem_default, {
386
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.customer_info_label"),
387
- value: "customer",
388
- icon: "infoCircle"
389
- }, {
390
- default: withCtx(() => [createVNode(CrmDetailSidebarAccordionCustomerInfo_default, { individual: P.individual }, null, 8, ["individual"])]),
391
- _: 1
392
- }, 8, ["label"]),
393
- createVNode(CrmDetailSidebarAccordionItem_default, {
394
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.invoice_label"),
395
- "is-empty": !J.value,
396
- value: "invoice",
397
- icon: "wallet"
398
- }, {
399
- default: withCtx(() => [F.individual.billingInformationDetail ? (openBlock(), createBlock(CrmDetailSidebarAccordionBillingInformation_default, {
400
- key: 0,
401
- "invoice-address": F.individual.billingInformationDetail.location?.address ?? null,
402
- "invoice-email": F.individual.billingInformationDetail.invoiceEmail
403
- }, null, 8, ["invoice-address", "invoice-email"])) : createCommentVNode("", !0)]),
404
- _: 1
405
- }, 8, ["label", "is-empty"]),
406
- createVNode(CrmDetailSidebarAccordionItem_default, {
407
- "is-empty": !q.value,
408
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
409
- value: "contact-persons",
410
- icon: "userCircle",
411
- onAdd: X
412
- }, {
413
- actions: withCtx(() => [q.value ? createCommentVNode("", !0) : (openBlock(), createBlock(CrmDetailSidebarAccordionHeaderIconButton_default, {
414
- key: 0,
415
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
416
- class: "z-1",
417
- icon: "plus",
418
- onClick: X
419
- }, null, 8, ["label"]))]),
420
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(F.individual.contactPersons, (a) => (openBlock(), createBlock(unref(Motion), {
421
- key: a.uuid,
422
- "layout-id": a.uuid
423
- }, {
424
- default: withCtx(() => [createVNode(CrmDetailSidebarAccordionContactPersonInfo_default, {
425
- "contact-person": a,
426
- "on-toggle-is-primary": () => $(a.uuid),
427
- onUpdate: (P) => Z(a.uuid),
428
- onDelete: (P) => Q(a.uuid)
429
- }, null, 8, [
430
- "contact-person",
431
- "on-toggle-is-primary",
432
- "onUpdate",
433
- "onDelete"
434
- ])]),
435
- _: 2
436
- }, 1032, ["layout-id"]))), 128)), q.value ? (openBlock(), createBlock(unref(VcButton), {
437
- key: 0,
438
- size: "sm",
439
- variant: "tertiary",
440
- "icon-left": "plus",
441
- onClick: X
442
- }, {
443
- default: withCtx(() => [createTextVNode(toDisplayString(unref(I).t("wise_crm.shared.add")), 1)]),
444
- _: 1
445
- })) : createCommentVNode("", !0)]),
446
- _: 1
447
- }, 8, ["is-empty", "label"]),
448
- F.individual.linkedBusinesses.length > 0 ? (openBlock(), createBlock(CrmDetailSidebarAccordionItem_default, {
449
- key: 0,
450
- "is-edit-button-hidden": !0,
451
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.linked_business_label", { label: Y.value }),
452
- value: "linked-businesses",
453
- icon: "building"
454
- }, {
455
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(F.individual.linkedBusinesses, (a) => (openBlock(), createBlock(CrmDetailSidebarCard_default, {
456
- key: a.uuid,
457
- class: "gap-lg flex flex-col"
458
- }, {
459
- default: withCtx(() => [
460
- createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createVNode(unref(VcRouterLinkButton), {
461
- to: {
462
- name: "business-detail",
463
- params: { businessUuid: a.uuid }
464
- },
465
- "class-config": { root: "p-0 bg-transparent! h-min hover:underline" },
466
- variant: "tertiary"
467
- }, {
468
- default: withCtx(() => [createElementVNode("span", _hoisted_3, toDisplayString(a.name), 1)]),
469
- _: 2
470
- }, 1032, ["to"]), createElementVNode("p", _hoisted_4, toDisplayString(a.position), 1)])]),
471
- createVNode(AppIconLabelPair_default, {
472
- label: a.email ?? "-",
473
- icon: "mail"
474
- }, null, 8, ["label"]),
475
- createVNode(AppIconLabelPair_default, {
476
- label: a.mobilePhone ?? a.phone ?? "-",
477
- icon: "phone"
478
- }, null, 8, ["label"])
479
- ]),
480
- _: 2
481
- }, 1024))), 128))]),
482
- _: 1
483
- }, 8, ["label"])) : createCommentVNode("", !0)
484
- ]),
485
- _: 1
486
- }));
487
- }
488
- }), InfoTab = /* @__PURE__ */ function(a) {
489
- return a.ACTIVITY = "activity", a.NOTES = "notes", a.OVERVIEW = "overview", a;
490
- }(InfoTab || {}), IndividualDetailSidebar_default = /* @__PURE__ */ defineComponent({
491
- __name: "IndividualDetailSidebar",
492
- props: { individual: {} },
493
- setup(a) {
494
- let P = a, F = useI18n(), I = useToast(), R = useCrm(), z = useApiErrorToast(), B = useIndividualGrantMutation(), V = ref(InfoTab.OVERVIEW), H = computed(() => [
495
- {
496
- icon: "infoCircle",
497
- label: F.t("wise_crm.shared.overview"),
498
- value: InfoTab.OVERVIEW
499
- },
500
- {
501
- icon: "activity",
502
- label: F.t("wise_crm.shared.activity"),
503
- value: InfoTab.ACTIVITY
504
- },
505
- {
506
- icon: "book",
507
- label: F.t("wise_crm.shared.notes"),
508
- value: InfoTab.NOTES
509
- }
510
- ]), U = computed(() => R.getEntityConfig(EntityType.INDIVIDUAL));
511
- async function W() {
512
- if (P.individual.email !== null) try {
513
- await B.execute({
514
- body: {
515
- email: P.individual.email,
516
- firstName: P.individual.firstName,
517
- lastName: P.individual.lastName
518
- },
519
- params: { individualUuid: P.individual.uuid }
520
- }), I.success({
521
- title: F.t("toast.success.general_title"),
522
- description: F.t("wise_crm.info_dialog.sidebar.grant_customer_zone_access_success")
523
- });
524
- } catch (a) {
525
- z.show(a);
526
- }
527
- }
528
- return (I, z) => (openBlock(), createBlock(AppColorProvider_default, {
529
- color: unref(R).getEntityConfig(unref(EntityType).INDIVIDUAL)?.color ?? null,
530
- class: "flex h-full flex-col"
531
- }, {
532
- default: withCtx(() => [createVNode(CrmDetailHeaderCard_default, {
533
- name: `${P.individual.firstName} ${P.individual.lastName}`,
534
- address: P.individual.address,
535
- email: P.individual.email,
536
- "mobile-phone": P.individual.mobilePhone,
537
- "entity-name": U.value?.name ?? null,
538
- phone: P.individual.phone
539
- }, {
540
- actions: withCtx(() => [createVNode(unref(VcIconButton), {
541
- disabled: P.individual.email === null || unref(B).isLoading.value,
542
- "is-loading": unref(B).isLoading.value,
543
- label: unref(F).t("wise_crm.info_dialog.sidebar.grant_customer_zone_access"),
544
- "class-config": {
545
- root: "bg-gray-50/50 dark:bg-brand-950 border-none shadow-none w-auto h-auto p-xs data-[loading=false]:not-disabled:hover:bg-gray-50/30 rounded-full size-8 duration-300",
546
- icon: "text-brand-700 size-4 dark:text-brand-200"
547
- },
548
- size: "sm",
549
- icon: "user",
550
- variant: "secondary",
551
- onClick: W
552
- }, null, 8, [
553
- "disabled",
554
- "is-loading",
555
- "label"
556
- ])]),
557
- _: 1
558
- }, 8, [
559
- "name",
560
- "address",
561
- "email",
562
- "mobile-phone",
563
- "entity-name",
564
- "phone"
565
- ]), createVNode(CrmDetailSidebarTabs_default, {
566
- modelValue: V.value,
567
- "onUpdate:modelValue": z[0] ||= (a) => V.value = a,
568
- tabs: H.value
569
- }, {
570
- default: withCtx(() => [V.value === InfoTab.OVERVIEW ? (openBlock(), createBlock(IndividualDetailSidebarOverviewContent_default, {
571
- key: 0,
572
- individual: a.individual
573
- }, null, 8, ["individual"])) : V.value === InfoTab.ACTIVITY ? (openBlock(), createBlock(IndividualDetailSidebarActivityContent_default, {
574
- key: 1,
575
- individual: a.individual
576
- }, null, 8, ["individual"])) : createCommentVNode("", !0), V.value === InfoTab.NOTES ? (openBlock(), createBlock(IndividualDetailSidebarNotesContent_default, {
577
- key: 2,
578
- individual: P.individual
579
- }, null, 8, ["individual"])) : createCommentVNode("", !0)]),
580
- _: 1
581
- }, 8, ["modelValue", "tabs"])]),
582
- _: 1
583
- }, 8, ["color"]));
584
- }
585
- }), IndividualDetailSidebarProvider_default = /* @__PURE__ */ defineComponent({
586
- __name: "IndividualDetailSidebarProvider",
587
- props: { individualUuid: {} },
588
- setup(a) {
589
- let P = a, F = useI18n(), I = useIndividualDetailQuery(computed(() => P.individualUuid)), L = computed(() => I.data.value ?? null);
590
- return (a, P) => (openBlock(), createBlock(CrmDetailContainer_default, null, {
591
- default: withCtx(() => [unref(I).isError.value ? (openBlock(), createBlock(Error_default, {
592
- key: 0,
593
- message: unref(F).t("error.business_details.description"),
594
- title: unref(F).t("error.business_details.title")
595
- }, null, 8, ["message", "title"])) : unref(I).isLoading.value ? (openBlock(), createBlock(AppSkeletonLoader_default, {
596
- key: 1,
597
- class: "h-full"
598
- })) : L.value ? (openBlock(), createBlock(IndividualDetailSidebar_default, {
599
- key: 2,
600
- individual: L.value
601
- }, null, 8, ["individual"])) : createCommentVNode("", !0)]),
602
- _: 1
603
- }));
604
- }
605
- });
606
- export { useIndividualDetailQuery as n, IndividualDetailSidebarProvider_default as t };