@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,1021 +0,0 @@
1
- import { A as useSearch, B as AppForm_default, E as useCrmConfig, I as NoteUpdateDialog_default, M as AppSidebarFormSubmitButton_default, N as AppSidebarFormFooter_default, O as AppColorProvider_default, Q as NoteService, R as CrmDetailSidebarNotesView_default, V as i18nPlugin, X as useKeysetInfiniteQuery, Z as useNoteDeleteMutation, a as AppOpenEntityButton_default, b as AppGlobalFormError_default, c as CrmDetailAccordionRoot_default, d as ContactPersonFormNameField_default, f as ContactPersonFormContactField_default, g as IndividualAutocomplete_default, h as useContactPersonCreateMutation, i as CrmDetailSidebarAccordionHeaderIconButton_default, l as AppIconLabelPair_default, m as AppDialog_default, n as CrmDetailContainer_default, o as CrmDetailSidebarCard_default, p as AppUnstyledButton_default, q as useApiErrorToast, r as CrmDetailSidebarTabs_default, s as CrmDetailSidebarAccordionItem_default, t as Error_default, tt as AppGrid_default, u as individualItemSchema, w as useCrm, z as toFormField } from "./Error-B4TwHEhb.js";
2
- import { a as AppGroup_default, l as He, n as useDateTimeFormat, t as AppSkeletonLoader_default, u as ze } from "./AppSkeletonLoader-BAhoOmFD.js";
3
- import { ft as ContentLocale, gt as EntityType, lt as BoardColumnTransitionTriggerType, mt as DealSource } from "./client-BP13IBbl.js";
4
- import { d as ContentLocaleUtil, f as DealService, g as BoardService, h as useUserIndexQuery, n as useDealDetailQuery, t as DealSendMailDialog_default, u as DealSourceUtil } from "./DealSendMailDialog-D5Voyhhc.js";
5
- import "./DealExternalAttachment-D1PznE3V.js";
6
- import { t as CrmDetailView_default } from "./CrmDetailView-DQehs8Fb.js";
7
- import z$1, { z } from "zod";
8
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useModel, useTemplateRef, withCtx } from "vue";
9
- import { useI18n } from "vue-i18n";
10
- import { VcAutocomplete, VcBadge, VcButton, VcDropdownMenu, VcDropdownMenuItem, VcFormFieldLabel, VcIconButton, VcSelect, VcSelectItem, VcTextField, useDialog } from "@wisemen/vue-core-components";
11
- import { useMutation, useQueryClient } from "@tanstack/vue-query";
12
- import { useForm } from "formango";
13
- import { Motion } from "motion-v";
14
- import { useRouteParams } from "@vueuse/router";
15
- function useDealUpdateLanguageMutation() {
16
- return ze({
17
- queryFn: async ({ body: a, params: N }) => await DealService.update(N.dealUuid, { dealLanguage: a.dealLanguage }),
18
- queryKeysToInvalidate: {
19
- dealDetail: { dealUuid: (a) => a.dealUuid },
20
- dealIndex: {}
21
- }
22
- });
23
- }
24
- function useDealUpdateSourceMutation() {
25
- return ze({
26
- queryFn: async ({ body: a, params: N }) => await DealService.update(N.dealUuid, { dealSource: a.dealSource }),
27
- queryKeysToInvalidate: {
28
- dealDetail: { dealUuid: (a) => a.dealUuid },
29
- dealIndex: {}
30
- }
31
- });
32
- }
33
- function useDealUpdateOwnerMutation() {
34
- return ze({
35
- queryFn: async ({ body: a, params: N }) => await DealService.update(N.dealUuid, { dealOwner: a.dealOwner }),
36
- queryKeysToInvalidate: {
37
- dealDetail: { dealUuid: (a) => a.dealUuid },
38
- dealIndex: {}
39
- }
40
- });
41
- }
42
- function useDealUpdateNameMutation() {
43
- return ze({
44
- queryFn: async ({ body: a, params: N }) => await DealService.update(N.dealUuid, { name: a.name }),
45
- queryKeysToInvalidate: {
46
- dealDetail: { dealUuid: (a) => a.dealUuid },
47
- dealIndex: {}
48
- }
49
- });
50
- }
51
- var _hoisted_1$3 = {
52
- key: 1,
53
- class: "flex justify-between"
54
- }, _hoisted_2$2 = { class: "text-primary text-xl font-bold" }, DealDetailSidebarNameField_default = /* @__PURE__ */ defineComponent({
55
- __name: "DealDetailSidebarNameField",
56
- props: { deal: {} },
57
- setup(a) {
58
- let P = a, F = useI18n(), I = useApiErrorToast(), L = ref(!1), R = useTemplateRef("nameFieldContainerRef"), B = useDealUpdateNameMutation(), V = useForm({
59
- schema: z$1.object({ name: z$1.string().min(1) }),
60
- onSubmit: async (a) => {
61
- try {
62
- await B.execute({
63
- body: { name: a.name },
64
- params: { dealUuid: P.deal.uuid }
65
- });
66
- } catch (a) {
67
- I.show(a);
68
- } finally {
69
- L.value = !1;
70
- }
71
- }
72
- }), H = V.register("name", P.deal.name);
73
- async function U() {
74
- L.value = !0, await nextTick(), W();
75
- }
76
- function W() {
77
- (R.value?.querySelector("input"))?.focus();
78
- }
79
- function G() {
80
- if (!V.isDirty.value) {
81
- L.value = !1;
82
- return;
83
- }
84
- V.submit();
85
- }
86
- return (a, I) => (openBlock(), createElementBlock("div", {
87
- ref_key: "nameFieldContainerRef",
88
- ref: R
89
- }, [L.value ? (openBlock(), createBlock(AppForm_default, {
90
- key: 0,
91
- form: unref(V)
92
- }, {
93
- default: withCtx(() => [createVNode(unref(VcTextField), mergeProps(unref(toFormField)(unref(H)), {
94
- "class-config": { input: "text-xl font-bold" },
95
- "is-loading": unref(V).isSubmitting.value,
96
- label: unref(F).t("wise_crm.deal.detail.sidebar.name_field.label"),
97
- onBlur: G
98
- }), {
99
- label: withCtx(() => [createVNode(unref(VcFormFieldLabel), { class: "sr-only" })]),
100
- _: 1
101
- }, 16, ["is-loading", "label"]), I[0] ||= createElementVNode("button", {
102
- type: "submit",
103
- class: "sr-only"
104
- }, null, -1)]),
105
- _: 1
106
- }, 8, ["form"])) : (openBlock(), createElementBlock("div", _hoisted_1$3, [createElementVNode("h2", _hoisted_2$2, toDisplayString(P.deal.name), 1), createVNode(unref(VcIconButton), {
107
- label: unref(F).t("wise_crm.deal.detail.sidebar.name_field.edit_label"),
108
- icon: "editWithLine",
109
- variant: "tertiary",
110
- class: "shrink-0",
111
- onClick: U
112
- }, null, 8, ["label"])]))], 512));
113
- }
114
- });
115
- function useDealSetPrimaryContactPersonMutation() {
116
- let a = useQueryClient(), N = "dealDetail", P = useMutation({
117
- mutationFn: async (a) => await DealService.setPrimaryContactPerson(a.dealUuid, a.contactPersonUuid),
118
- onError: (P, F, I) => {
119
- a.setQueryData([N, { dealUuid: F.dealUuid }], I?.previousData);
120
- },
121
- onMutate: async (P) => {
122
- await a.cancelQueries({ queryKey: [N] });
123
- let F = a.getQueryData([N, { dealUuid: P.dealUuid }]);
124
- return F === void 0 ? {} : (a.setQueryData([N, { dealUuid: P.dealUuid }], {
125
- ...F,
126
- contactPersons: F.contactPersons.map((a) => ({
127
- ...a,
128
- isPrimary: a.uuid === P.contactPersonUuid
129
- }))
130
- }), { previousData: F });
131
- }
132
- });
133
- return {
134
- isLoading: computed(() => P.isPending.value),
135
- data: computed(() => P.data.value),
136
- execute: async (a) => await P.mutateAsync(a.params)
137
- };
138
- }
139
- function useDealUnlinkContactPersonMutation() {
140
- return ze({
141
- queryFn: async ({ body: a, params: N }) => await DealService.unlinkContactPerson(N.dealUuid, a.contactPersonUuid),
142
- queryKeysToInvalidate: {
143
- dealDetail: { dealUuid: (a) => a.dealUuid },
144
- dealIndex: {}
145
- }
146
- });
147
- }
148
- var _hoisted_1$2 = { class: "flex items-start justify-between" }, _hoisted_2$1 = { class: "flex flex-col items-start" }, _hoisted_3$1 = {
149
- key: 1,
150
- class: "text-brand-700"
151
- }, _hoisted_4$1 = { class: "-mt-2 -mr-2 flex items-center justify-end" }, _hoisted_5 = { class: "gap-lg grid" }, CrmDetailSidebarAccordionGenericContactPersonInfo_default = /* @__PURE__ */ defineComponent({
152
- __name: "CrmDetailSidebarAccordionGenericContactPersonInfo",
153
- props: {
154
- contactPerson: {},
155
- description: { default: null },
156
- onToggleIsPrimary: {}
157
- },
158
- emits: ["delete", "update"],
159
- setup(a, { emit: N }) {
160
- let P = a, F = N, I = useI18n(), L = P.contactPerson.uuid ?? P.contactPerson.contactPersonUuid;
161
- function R() {
162
- F("update");
163
- }
164
- function B() {
165
- F("delete");
166
- }
167
- function V() {
168
- P.onToggleIsPrimary();
169
- }
170
- return (a, N) => (openBlock(), createBlock(CrmDetailSidebarCard_default, { class: "gap-lg flex flex-col" }, {
171
- default: withCtx(() => [createElementVNode("div", _hoisted_1$2, [createElementVNode("div", _hoisted_2$1, [unref(L) ? (openBlock(), createBlock(AppOpenEntityButton_default, {
172
- key: 0,
173
- "class-config": { root: "bg-transparent border-none text-primary shadow-none h-auto w-auto hover:underline p-0 font-semibold" },
174
- "entity-type": unref(EntityType).INDIVIDUAL,
175
- uuid: unref(L)
176
- }, {
177
- default: withCtx(() => [createTextVNode(toDisplayString(P.contactPerson.firstName) + " " + toDisplayString(P.contactPerson.lastName), 1)]),
178
- _: 1
179
- }, 8, ["entity-type", "uuid"])) : createCommentVNode("", !0), P.description ? (openBlock(), createElementBlock("p", _hoisted_3$1, toDisplayString(P.description), 1)) : createCommentVNode("", !0)]), createElementVNode("div", _hoisted_4$1, [createVNode(CrmDetailSidebarAccordionHeaderIconButton_default, {
180
- icon: P.contactPerson.isPrimary ? "starYellow" : "starOutline",
181
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.contact_person_primary"),
182
- onClick: V
183
- }, null, 8, ["icon", "label"]), createVNode(unref(VcDropdownMenu), {
184
- "class-config": { content: "min-w-fit p-sm" },
185
- "popover-align": "end"
186
- }, {
187
- trigger: withCtx(() => [createVNode(unref(VcIconButton), {
188
- variant: "tertiary",
189
- size: "sm",
190
- label: "actionMenu",
191
- icon: "threeDots"
192
- })]),
193
- content: withCtx(() => [createVNode(unref(VcDropdownMenuItem), {
194
- label: unref(I).t("wise_crm.info_dialog.sidebar.overview.update_contact_person"),
195
- icon: "editWithLine",
196
- onSelect: R
197
- }, null, 8, ["label"]), createVNode(unref(VcDropdownMenuItem), {
198
- "is-destructive": !0,
199
- "is-disabled": P.contactPerson.isPrimary,
200
- label: unref(I).t("wise_crm.shared.delete"),
201
- icon: "trash",
202
- onSelect: B
203
- }, null, 8, ["is-disabled", "label"])]),
204
- _: 1
205
- })])]), createElementVNode("div", _hoisted_5, [
206
- P.contactPerson.email === null ? createCommentVNode("", !0) : (openBlock(), createBlock(AppIconLabelPair_default, {
207
- key: 0,
208
- label: P.contactPerson.email,
209
- icon: "mail"
210
- }, null, 8, ["label"])),
211
- P.contactPerson.mobilePhone === null ? createCommentVNode("", !0) : (openBlock(), createBlock(AppIconLabelPair_default, {
212
- key: 1,
213
- label: P.contactPerson.mobilePhone,
214
- icon: "mobilePhone"
215
- }, null, 8, ["label"])),
216
- P.contactPerson.phone === null ? createCommentVNode("", !0) : (openBlock(), createBlock(AppIconLabelPair_default, {
217
- key: 2,
218
- label: P.contactPerson.phone,
219
- icon: "phone"
220
- }, null, 8, ["label"]))
221
- ])]),
222
- _: 1
223
- }));
224
- }
225
- }), _hoisted_1$1 = { class: "p-lg" }, DealDetailSidebarGeneralInfo_default = /* @__PURE__ */ defineComponent({
226
- __name: "DealDetailSidebarGeneralInfo",
227
- props: { deal: {} },
228
- setup(N) {
229
- let P = N, F = useI18n(), I = useApiErrorToast(), L = useDealUpdateLanguageMutation(), R = useDealUpdateSourceMutation(), B = useDealUpdateOwnerMutation(), V = useSearch({ persistInUrl: !1 }), H = useUserIndexQuery({ params: { search: V.debouncedSearch } }), U = ref(P.deal.dealLanguage), W = ref(P.deal.dealSource), G = ref(P.deal.owner ? {
230
- uuid: P.deal.owner.uuid,
231
- name: P.deal.owner.name
232
- } : null), K = computed(() => H.data.value?.data.map((a) => ({
233
- uuid: a.uuid,
234
- name: `${a.firstName} ${a.lastName}`
235
- })) ?? []);
236
- function q(a) {
237
- return F.t(ContentLocaleUtil.getI18nKey(a));
238
- }
239
- function J(a) {
240
- return F.t(DealSourceUtil.getI18nKey(a));
241
- }
242
- let Y = useDateTimeFormat();
243
- function X(a) {
244
- V.updateSearch(a);
245
- }
246
- async function Z(a) {
247
- if (U.value = a, a !== null) try {
248
- await L.execute({
249
- body: { dealLanguage: a },
250
- params: { dealUuid: P.deal.uuid }
251
- });
252
- } catch (a) {
253
- I.show(a);
254
- }
255
- }
256
- async function Q(a) {
257
- if (W.value = a, a !== null) try {
258
- await R.execute({
259
- body: { dealSource: a },
260
- params: { dealUuid: P.deal.uuid }
261
- });
262
- } catch (a) {
263
- I.show(a);
264
- }
265
- }
266
- async function $(a) {
267
- if (G.value = a, a !== null) try {
268
- await B.execute({
269
- body: { dealOwner: a },
270
- params: { dealUuid: P.deal.uuid }
271
- });
272
- } catch (a) {
273
- I.show(a);
274
- }
275
- }
276
- return (a, N) => (openBlock(), createElementBlock("div", null, [createVNode(CrmDetailSidebarCard_default, null, {
277
- default: withCtx(() => [createElementVNode("form", null, [createVNode(AppGrid_default, { cols: 1 }, {
278
- default: withCtx(() => [
279
- createVNode(unref(VcAutocomplete), {
280
- modelValue: G.value,
281
- "onUpdate:modelValue": [N[0] ||= (a) => G.value = a, $],
282
- items: K.value,
283
- "display-fn": (a) => a.name,
284
- "is-loading": unref(H).isLoading.value || unref(B).isLoading.value,
285
- placeholder: "Select deal owner",
286
- label: "Deal owner",
287
- onSearch: X
288
- }, null, 8, [
289
- "modelValue",
290
- "items",
291
- "display-fn",
292
- "is-loading"
293
- ]),
294
- createVNode(unref(VcSelect), {
295
- modelValue: U.value,
296
- "onUpdate:modelValue": [N[1] ||= (a) => U.value = a, Z],
297
- label: unref(F).t("wise_crm.deal.form.fields.language"),
298
- placeholder: unref(F).t("wise_crm.deal.form.fields.language_placeholder"),
299
- "display-fn": q,
300
- "is-loading": unref(L).isLoading.value
301
- }, {
302
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(Object.values(unref(ContentLocale)), (a) => (openBlock(), createBlock(unref(VcSelectItem), {
303
- key: a,
304
- value: a
305
- }, {
306
- default: withCtx(() => [createTextVNode(toDisplayString(q(a)), 1)]),
307
- _: 2
308
- }, 1032, ["value"]))), 128))]),
309
- _: 1
310
- }, 8, [
311
- "modelValue",
312
- "label",
313
- "placeholder",
314
- "is-loading"
315
- ]),
316
- createVNode(unref(VcSelect), {
317
- modelValue: W.value,
318
- "onUpdate:modelValue": [N[2] ||= (a) => W.value = a, Q],
319
- "display-fn": J,
320
- label: unref(F).t("wise_crm.deal.form.fields.source"),
321
- placeholder: unref(F).t("wise_crm.deal.form.fields.source_placeholder"),
322
- "is-loading": unref(R).isLoading.value
323
- }, {
324
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(Object.values(unref(DealSource)), (a) => (openBlock(), createBlock(unref(VcSelectItem), {
325
- key: a,
326
- value: a
327
- }, {
328
- default: withCtx(() => [createTextVNode(toDisplayString(J(a)), 1)]),
329
- _: 2
330
- }, 1032, ["value"]))), 128))]),
331
- _: 1
332
- }, 8, [
333
- "modelValue",
334
- "label",
335
- "placeholder",
336
- "is-loading"
337
- ])
338
- ]),
339
- _: 1
340
- })])]),
341
- _: 1
342
- }), createElementVNode("div", _hoisted_1$1, [createVNode(AppIconLabelPair_default, {
343
- label: unref(F).t("wise_crm.deal.sidebar.created_at", { date: unref(Y).toDate(P.deal.createdAt.toPlainDate()) }),
344
- icon: "clockPlus",
345
- "text-color": "text-quaternary",
346
- class: "text-sm"
347
- }, null, 8, ["label"])])]));
348
- }
349
- });
350
- function useDealLinkContactPersonMutation() {
351
- return ze({
352
- queryFn: async ({ body: a, params: N }) => await DealService.linkContactPerson(N.dealUuid, a.contactPersonUuid, a.contactInfo),
353
- queryKeysToInvalidate: {
354
- dealDetail: { dealUuid: (a) => a.dealUuid },
355
- dealIndex: {}
356
- }
357
- });
358
- }
359
- var DealContactPersonCreateExistingForm_default = /* @__PURE__ */ defineComponent({
360
- __name: "DealContactPersonCreateExistingForm",
361
- props: { form: {} },
362
- emits: ["createNewContactPerson"],
363
- setup(a, { emit: P }) {
364
- let F = a, R = P, B = useI18n(), V = F.form.register("email"), H = F.form.register("phone"), U = F.form.register("mobile"), W = F.form.register("existingContactPerson");
365
- function G() {
366
- R("createNewContactPerson");
367
- }
368
- return (a, P) => (openBlock(), createBlock(AppForm_default, {
369
- form: F.form,
370
- class: "pb-xl flex h-full flex-1 flex-col justify-between"
371
- }, {
372
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
373
- default: withCtx(() => [createVNode(IndividualAutocomplete_default, {
374
- label: unref(B).t("wise_crm.contact.create_dialog.form.fields.contact_person"),
375
- "model-value": unref(W).modelValue.value,
376
- class: "col-span-2",
377
- "onUpdate:modelValue": unref(W).setValue,
378
- onCreateNew: G
379
- }, null, 8, [
380
- "label",
381
- "model-value",
382
- "onUpdate:modelValue"
383
- ]), createVNode(ContactPersonFormContactField_default, {
384
- email: unref(V),
385
- "mobile-phone": unref(U),
386
- phone: unref(H)
387
- }, null, 8, [
388
- "email",
389
- "mobile-phone",
390
- "phone"
391
- ])]),
392
- _: 1
393
- }), createVNode(AppSidebarFormFooter_default, null, {
394
- default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
395
- "is-loading": F.form.isSubmitting.value,
396
- label: unref(B).t("wise_crm.shared.add"),
397
- class: "col-span-2"
398
- }, null, 8, ["is-loading", "label"])]),
399
- _: 1
400
- })]),
401
- _: 1
402
- }, 8, ["form"]));
403
- }
404
- }), DealContactPersonCreateNewForm_default = /* @__PURE__ */ defineComponent({
405
- __name: "DealContactPersonCreateNewForm",
406
- props: { form: {} },
407
- setup(a) {
408
- let P = a, F = P.form.register("firstName"), I = P.form.register("lastName"), L = P.form.register("email"), R = P.form.register("mobilePhone"), B = P.form.register("phone");
409
- return (a, V) => (openBlock(), createBlock(AppForm_default, {
410
- form: P.form,
411
- class: "pb-xl flex h-full flex-col justify-between"
412
- }, {
413
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
414
- default: withCtx(() => [
415
- createVNode(ContactPersonFormNameField_default, {
416
- "first-name": unref(F),
417
- "last-name": unref(I)
418
- }, null, 8, ["first-name", "last-name"]),
419
- createVNode(ContactPersonFormContactField_default, {
420
- email: unref(L),
421
- "mobile-phone": unref(R),
422
- phone: unref(B)
423
- }, null, 8, [
424
- "email",
425
- "mobile-phone",
426
- "phone"
427
- ]),
428
- createVNode(AppGlobalFormError_default, { form: P.form }, null, 8, ["form"])
429
- ]),
430
- _: 1
431
- }), renderSlot(a.$slots, "actions")]),
432
- _: 3
433
- }, 8, ["form"]));
434
- }
435
- });
436
- const dealContactPersonCreateExistingFormSchema = z$1.object({
437
- email: z$1.email().nullable(),
438
- existingContactPerson: individualItemSchema,
439
- mobile: z$1.string().nullable(),
440
- phone: z$1.string().nullable()
441
- }), dealContactPersonCreateFormSchema = z.object({
442
- email: z.email().min(1).nullable(),
443
- firstName: z.string().min(1),
444
- lastName: z.string().min(1),
445
- mobilePhone: z.string().min(1).nullable(),
446
- phone: z.string().min(1).nullable()
447
- }).superRefine((a, N) => {
448
- a.email !== null && a.email !== "" || a.mobilePhone !== null && a.mobilePhone !== "" || a.phone !== null && a.phone !== "" || N.addIssue({
449
- code: z.ZodIssueCode.custom,
450
- message: i18nPlugin.global.t("wise_crm.form.errors.at_least_one")
451
- });
452
- });
453
- var DealContactPersonCreateDialog_default = /* @__PURE__ */ defineComponent({
454
- __name: "DealContactPersonCreateDialog",
455
- props: {
456
- dealUuid: {},
457
- isCreatingNewContactPerson: {
458
- type: Boolean,
459
- default: !1
460
- }
461
- },
462
- emits: ["close", "createNewContactPerson"],
463
- setup(a, { emit: N }) {
464
- let P = a, F = N, R = useI18n(), B = useApiErrorToast(), V = useDealLinkContactPersonMutation(), H = useContactPersonCreateMutation(), U = ref(P.isCreatingNewContactPerson), W = useForm({
465
- schema: dealContactPersonCreateFormSchema,
466
- onSubmit: async (a) => {
467
- try {
468
- let N = await H.execute({ body: {
469
- email: a.email,
470
- firstName: a.firstName,
471
- lastName: a.lastName,
472
- mobilePhone: a.mobilePhone,
473
- phone: a.phone
474
- } });
475
- P.isCreatingNewContactPerson || await V.execute({
476
- body: {
477
- contactPersonUuid: N,
478
- contactInfo: {
479
- email: a.email,
480
- mobilePhone: a.mobilePhone,
481
- phone: a.phone
482
- }
483
- },
484
- params: { dealUuid: P.dealUuid }
485
- }), J({
486
- label: `${a.firstName} ${a.lastName}`,
487
- value: N
488
- });
489
- } catch (a) {
490
- B.show(a);
491
- }
492
- }
493
- }), G = useForm({
494
- schema: dealContactPersonCreateExistingFormSchema,
495
- onSubmit: async (a) => {
496
- await q(a.existingContactPerson.value, {
497
- email: a.email,
498
- mobilePhone: a.mobile,
499
- phone: a.phone
500
- });
501
- }
502
- });
503
- function K() {
504
- U.value = !0;
505
- }
506
- async function q(a, N) {
507
- if (a !== null) try {
508
- await V.execute({
509
- body: {
510
- contactPersonUuid: a,
511
- contactInfo: N
512
- },
513
- params: { dealUuid: P.dealUuid }
514
- }), J();
515
- } catch (a) {
516
- B.show(a);
517
- }
518
- }
519
- function J(a) {
520
- if (a === void 0) {
521
- F("close");
522
- return;
523
- }
524
- F("createNewContactPerson", a), F("close");
525
- }
526
- return (a, N) => (openBlock(), createBlock(AppDialog_default, {
527
- title: unref(R).t("wise_crm.info_dialog.contact_person_create.title"),
528
- description: unref(R).t("wise_crm.info_dialog.contact_person_create.description"),
529
- onClose: J
530
- }, {
531
- default: withCtx(() => [U.value ? (openBlock(), createBlock(DealContactPersonCreateNewForm_default, {
532
- key: 0,
533
- form: unref(W)
534
- }, {
535
- actions: withCtx(() => [createVNode(AppSidebarFormFooter_default, null, {
536
- default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
537
- "is-loading": unref(W).isSubmitting.value,
538
- label: unref(R).t("wise_crm.shared.create")
539
- }, null, 8, ["is-loading", "label"])]),
540
- _: 1
541
- })]),
542
- _: 1
543
- }, 8, ["form"])) : (openBlock(), createBlock(DealContactPersonCreateExistingForm_default, {
544
- key: 1,
545
- form: unref(G),
546
- onCreateNewContactPerson: K
547
- }, null, 8, ["form"]))]),
548
- _: 1
549
- }, 8, ["title", "description"]));
550
- }
551
- });
552
- function useDealContactPersonUpdateMutation() {
553
- return ze({
554
- queryFn: async ({ body: a, params: N }) => await DealService.updateContactPerson(N.dealUuid, N.contactPersonUuid, a.form),
555
- queryKeysToInvalidate: {
556
- dealContactPersonDetail: {
557
- contactPersonUuid: (a) => a.contactPersonUuid,
558
- dealUuid: (a) => a.dealUuid
559
- },
560
- dealDetail: { dealUuid: (a) => a.dealUuid },
561
- dealIndex: {}
562
- }
563
- });
564
- }
565
- function useDealContactPersonDetailQuery(a, N) {
566
- return He({
567
- queryFn: () => DealService.getContactPerson(a.value, N.value),
568
- queryKey: { dealContactPersonDetail: {
569
- contactPersonUuid: N,
570
- dealUuid: a
571
- } }
572
- });
573
- }
574
- const dealContactPersonUpdateFormSchema = z.object({
575
- email: z.email().min(1).nullable(),
576
- firstName: z.string().min(1),
577
- lastName: z.string().min(1),
578
- mobilePhone: z.string().min(1).nullable(),
579
- phone: z.string().min(1).nullable()
580
- }).superRefine((a, N) => {
581
- a.email !== null && a.email !== "" || a.mobilePhone !== null && a.mobilePhone !== "" || a.phone !== null && a.phone !== "" || N.addIssue({
582
- code: z.ZodIssueCode.custom,
583
- message: i18nPlugin.global.t("wise_crm.form.errors.at_least_one")
584
- });
585
- });
586
- var DealContactPersonUpdateForm_default = /* @__PURE__ */ defineComponent({
587
- __name: "DealContactPersonUpdateForm",
588
- props: {
589
- contactPerson: {},
590
- onSubmit: { type: Function }
591
- },
592
- setup(a) {
593
- let P = a, F = useI18n(), R = useForm({
594
- initialState: {
595
- email: P.contactPerson.email,
596
- firstName: P.contactPerson.firstName,
597
- lastName: P.contactPerson.lastName,
598
- mobilePhone: P.contactPerson.mobilePhone,
599
- phone: P.contactPerson.phone
600
- },
601
- schema: dealContactPersonUpdateFormSchema,
602
- onSubmit: async (a) => {
603
- await P.onSubmit(a);
604
- }
605
- }), B = R.register("firstName"), V = R.register("lastName"), H = R.register("email"), U = R.register("mobilePhone"), W = R.register("phone");
606
- return (a, P) => (openBlock(), createBlock(AppForm_default, {
607
- form: unref(R),
608
- class: "flex h-full flex-col justify-between"
609
- }, {
610
- default: withCtx(() => [createVNode(AppGrid_default, { cols: 2 }, {
611
- default: withCtx(() => [
612
- createVNode(ContactPersonFormNameField_default, {
613
- "first-name": unref(B),
614
- "last-name": unref(V)
615
- }, null, 8, ["first-name", "last-name"]),
616
- createVNode(ContactPersonFormContactField_default, {
617
- email: unref(H),
618
- "mobile-phone": unref(U),
619
- phone: unref(W)
620
- }, null, 8, [
621
- "email",
622
- "mobile-phone",
623
- "phone"
624
- ]),
625
- createVNode(AppGlobalFormError_default, { form: unref(R) }, null, 8, ["form"])
626
- ]),
627
- _: 1
628
- }), createVNode(AppSidebarFormFooter_default, null, {
629
- default: withCtx(() => [createVNode(AppSidebarFormSubmitButton_default, {
630
- "is-loading": unref(R).isSubmitting.value,
631
- label: unref(F).t("wise_crm.shared.save_changes")
632
- }, null, 8, ["is-loading", "label"])]),
633
- _: 1
634
- })]),
635
- _: 1
636
- }, 8, ["form"]));
637
- }
638
- }), DealContactPersonUpdateDialog_default = /* @__PURE__ */ defineComponent({
639
- __name: "DealContactPersonUpdateDialog",
640
- props: {
641
- contactPersonUuid: {},
642
- dealUuid: {}
643
- },
644
- emits: ["close"],
645
- setup(a, { emit: N }) {
646
- let P = a, F = N, I = useI18n(), L = useApiErrorToast(), R = useDealContactPersonUpdateMutation(), B = useDealContactPersonDetailQuery(computed(() => P.dealUuid), computed(() => P.contactPersonUuid));
647
- async function V(a) {
648
- try {
649
- await R.execute({
650
- body: { form: a },
651
- params: {
652
- contactPersonUuid: P.contactPersonUuid,
653
- dealUuid: P.dealUuid
654
- }
655
- }), F("close");
656
- } catch (a) {
657
- L.show(a);
658
- }
659
- }
660
- function H() {
661
- F("close");
662
- }
663
- return (a, N) => (openBlock(), createBlock(AppDialog_default, {
664
- title: unref(I).t("wise_crm.info_dialog.contact_person_update.title"),
665
- description: unref(I).t("wise_crm.info_dialog.contact_person_create.description"),
666
- onClose: H
667
- }, {
668
- default: withCtx(() => [unref(B).data.value ? (openBlock(), createBlock(DealContactPersonUpdateForm_default, {
669
- key: 0,
670
- "on-submit": V,
671
- "contact-person": unref(B).data.value,
672
- onClose: H
673
- }, null, 8, ["contact-person"])) : createCommentVNode("", !0)]),
674
- _: 1
675
- }, 8, ["title", "description"]));
676
- }
677
- }), DealDetailSidebarOverviewContent_default = /* @__PURE__ */ defineComponent({
678
- __name: "DealDetailSidebarOverviewContent",
679
- props: { deal: {} },
680
- setup(a) {
681
- let N = a, P = useI18n(), F = useApiErrorToast(), I = useDealSetPrimaryContactPersonMutation(), L = useDealUnlinkContactPersonMutation(), R = useDialog(DealContactPersonCreateDialog_default), B = useDialog(DealContactPersonUpdateDialog_default), V = computed(() => N.deal.contactPersons.length > 0);
682
- function H() {
683
- R.open({ dealUuid: N.deal.uuid });
684
- }
685
- function U(a) {
686
- B.open({
687
- contactPersonUuid: a,
688
- dealUuid: N.deal.uuid
689
- });
690
- }
691
- async function W(a) {
692
- try {
693
- await L.execute({
694
- body: { contactPersonUuid: a },
695
- params: { dealUuid: N.deal.uuid }
696
- });
697
- } catch (a) {
698
- F.show(a);
699
- }
700
- }
701
- function G(a) {
702
- I.execute({ params: {
703
- contactPersonUuid: a,
704
- dealUuid: N.deal.uuid
705
- } });
706
- }
707
- return (a, F) => (openBlock(), createBlock(CrmDetailAccordionRoot_default, { "default-values": ["general-info", "contact-persons"] }, {
708
- default: withCtx(() => [createVNode(CrmDetailSidebarAccordionItem_default, {
709
- label: unref(P).t("wise_crm.deal.detail.sidebar.accordion.general_info"),
710
- value: "general-info",
711
- icon: "infoCircle"
712
- }, {
713
- default: withCtx(() => [createVNode(DealDetailSidebarGeneralInfo_default, { deal: N.deal }, null, 8, ["deal"])]),
714
- _: 1
715
- }, 8, ["label"]), createVNode(CrmDetailSidebarAccordionItem_default, {
716
- "is-empty": !V.value,
717
- label: unref(P).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
718
- value: "contact-persons",
719
- icon: "userCircle",
720
- onAdd: H
721
- }, {
722
- actions: withCtx(() => [V.value ? createCommentVNode("", !0) : (openBlock(), createBlock(CrmDetailSidebarAccordionHeaderIconButton_default, {
723
- key: 0,
724
- label: unref(P).t("wise_crm.info_dialog.sidebar.overview.contact_persons_label"),
725
- class: "z-1",
726
- icon: "plus",
727
- onClick: H
728
- }, null, 8, ["label"]))]),
729
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(N.deal.contactPersons, (a) => (openBlock(), createBlock(unref(Motion), {
730
- key: a.uuid,
731
- "layout-id": a.uuid
732
- }, {
733
- default: withCtx(() => [createVNode(CrmDetailSidebarAccordionGenericContactPersonInfo_default, {
734
- "contact-person": a,
735
- "on-toggle-is-primary": () => G(a.uuid),
736
- description: a.phone,
737
- onUpdate: (N) => U(a.uuid),
738
- onDelete: (N) => W(a.uuid)
739
- }, null, 8, [
740
- "contact-person",
741
- "on-toggle-is-primary",
742
- "description",
743
- "onUpdate",
744
- "onDelete"
745
- ])]),
746
- _: 2
747
- }, 1032, ["layout-id"]))), 128)), V.value ? (openBlock(), createBlock(unref(VcButton), {
748
- key: 0,
749
- variant: "tertiary",
750
- size: "sm",
751
- "icon-left": "plus",
752
- onClick: H
753
- }, {
754
- default: withCtx(() => [createTextVNode(toDisplayString(unref(P).t("wise_crm.shared.add")), 1)]),
755
- _: 1
756
- })) : createCommentVNode("", !0)]),
757
- _: 1
758
- }, 8, ["is-empty", "label"])]),
759
- _: 1
760
- }));
761
- }
762
- });
763
- function useDealTransitionMutation() {
764
- return ze({
765
- queryFn: async ({ body: a, params: N }) => await DealService.transition(N.dealUuid, a.toBoardColumnUuid),
766
- queryKeysToInvalidate: {
767
- dealDetail: { dealUuid: (a) => a.dealUuid },
768
- dealIndex: {}
769
- }
770
- });
771
- }
772
- function useBoardColumnsTransitionQuery(a, N) {
773
- return He({
774
- queryFn: () => BoardService.getTransitions(a.value, N.value),
775
- queryKey: { boardColumnsTransition: { boardColumnUuid: a } }
776
- });
777
- }
778
- var DealDetailSidebarTransitionSelect_default = /* @__PURE__ */ defineComponent({
779
- __name: "DealDetailSidebarTransitionSelect",
780
- props: /* @__PURE__ */ mergeModels({ deal: {} }, {
781
- modelValue: { required: !0 },
782
- modelModifiers: {}
783
- }),
784
- emits: ["update:modelValue"],
785
- setup(a) {
786
- let N = a, F = useI18n(), I = useCrmConfig(), L = useDialog(DealSendMailDialog_default), B = useModel(a, "modelValue"), V = useApiErrorToast(), H = useDealTransitionMutation(), U = useBoardColumnsTransitionQuery(computed(() => B.value.toColumnUuid), computed(() => I.getOptions().deals?.allowedTransitionTriggerTypes ?? [])), W = computed(() => (U.data.value ?? []).flatMap((a) => a.triggers.length === 0 ? [a] : a.triggers.map((N) => ({
787
- ...a,
788
- toColumnDisplayName: a.toColumnDisplayName,
789
- triggers: [N]
790
- }))));
791
- function G(a) {
792
- return a?.toColumnDisplayName ?? "-";
793
- }
794
- async function K(a) {
795
- if (a.triggers.length !== 0) {
796
- if (a.triggers[0]?.triggerType === BoardColumnTransitionTriggerType.EMAIL) {
797
- L.open({
798
- dealUuid: N.deal.uuid,
799
- client: {
800
- uuid: N.deal.client.uuid,
801
- type: N.deal.client.type
802
- },
803
- templateKey: a.triggers[0].config.mailTemplateKey
804
- });
805
- return;
806
- }
807
- try {
808
- B.value = a, await H.execute({
809
- body: { toBoardColumnUuid: a.toColumnUuid },
810
- params: { dealUuid: N.deal.uuid }
811
- });
812
- } catch (a) {
813
- V.show(a);
814
- }
815
- }
816
- }
817
- return (a, N) => (openBlock(), createBlock(AppColorProvider_default, { color: B.value?.toColumnColor ?? null }, {
818
- default: withCtx(() => [W.value.length === 0 ? (openBlock(), createBlock(unref(VcBadge), {
819
- key: 0,
820
- "class-config": { root: "text-nowrap" },
821
- variant: "translucent",
822
- color: "brand"
823
- }, {
824
- default: withCtx(() => [createTextVNode(toDisplayString(B.value.toColumnDisplayName), 1)]),
825
- _: 1
826
- })) : (openBlock(), createBlock(unref(VcSelect), {
827
- key: 1,
828
- "model-value": B.value,
829
- "is-loading": unref(H).isLoading.value,
830
- "display-fn": G,
831
- "class-config": {
832
- item: "text-sm",
833
- baseSingle: "text-brand-700",
834
- root: "border-brand-200 bg-brand-25 w-fit h-7 py-xxs",
835
- iconRight: "size-3 text-brand-700",
836
- loader: "text-brand-700 size-3"
837
- },
838
- placeholder: unref(F).t("wise_crm.deal.transition.placeholder"),
839
- label: unref(F).t("wise_crm.deal.transition.label"),
840
- "onUpdate:modelValue": K
841
- }, {
842
- label: withCtx(() => [createVNode(unref(VcFormFieldLabel), { class: "sr-only" })]),
843
- default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(W.value, (a) => (openBlock(), createBlock(unref(VcSelectItem), {
844
- key: a.uuid,
845
- value: {
846
- uuid: a.uuid,
847
- toColumnUuid: a.toColumnUuid,
848
- toColumnColor: a.toColumnColor,
849
- toColumnDisplayName: a.toColumnDisplayName,
850
- triggers: a.triggers
851
- }
852
- }, {
853
- default: withCtx(() => [createVNode(AppGroup_default, null, {
854
- default: withCtx(() => [createVNode(AppColorProvider_default, { color: a.toColumnColor }, {
855
- default: withCtx(() => [...N[0] ||= [createElementVNode("div", { class: "bg-brand-100 border-brand-400 size-3 rounded-full border" }, null, -1)]]),
856
- _: 1
857
- }, 8, ["color"]), createElementVNode("span", null, toDisplayString(a.toColumnDisplayName), 1)]),
858
- _: 2
859
- }, 1024)]),
860
- _: 2
861
- }, 1032, ["value"]))), 128))]),
862
- _: 1
863
- }, 8, [
864
- "model-value",
865
- "is-loading",
866
- "placeholder",
867
- "label"
868
- ]))]),
869
- _: 1
870
- }, 8, ["color"]));
871
- }
872
- });
873
- function useNoteDealCreateMutation() {
874
- return ze({
875
- queryFn: async ({ body: a, params: N }) => await NoteService.create(a, { dealUuid: N.dealUuid }),
876
- queryKeysToInvalidate: { noteDealIndex: {} }
877
- });
878
- }
879
- function useNoteDealIndexQuery(a, N) {
880
- return useKeysetInfiniteQuery({
881
- queryFn: (N) => NoteService.getDealNotes({ pagination: N }, a.value),
882
- queryKey: { noteDealIndex: { params: N?.params } }
883
- });
884
- }
885
- var DealDialogSidebarNotesContent_default = /* @__PURE__ */ defineComponent({
886
- __name: "DealDialogSidebarNotesContent",
887
- props: { deal: {} },
888
- setup(a) {
889
- let N = a, P = useDialog(NoteUpdateDialog_default), I = useApiErrorToast(), L = useNoteDealCreateMutation(), R = useNoteDeleteMutation(), B = useNoteDealIndexQuery(computed(() => N.deal.uuid)), H = computed(() => B.data?.value?.data ?? []);
890
- async function U(a) {
891
- await L.execute({
892
- body: a,
893
- params: { dealUuid: N.deal.uuid }
894
- });
895
- }
896
- async function G(a) {
897
- try {
898
- await R.execute({ params: { noteUuid: a } });
899
- } catch (a) {
900
- I.show(a);
901
- }
902
- }
903
- function K(a) {
904
- P.open({ note: a });
905
- }
906
- return (a, N) => (openBlock(), createBlock(CrmDetailSidebarNotesView_default, {
907
- "is-loading": unref(B).isLoading.value,
908
- notes: H.value,
909
- "on-submit": U,
910
- "has-next-page": unref(B).hasNextPage.value,
911
- onNext: N[0] ||= (a) => unref(B).fetchNextPage(),
912
- onDelete: G,
913
- onUpdate: K
914
- }, null, 8, [
915
- "is-loading",
916
- "notes",
917
- "has-next-page"
918
- ]));
919
- }
920
- }), _hoisted_1 = { class: "flex h-full flex-1 flex-col" }, _hoisted_2 = { class: "gap-xl border-primary p-xl flex flex-col rounded-2xl border" }, _hoisted_3 = { class: "gap-sm flex w-full flex-wrap items-center" }, _hoisted_4 = { class: "max-w-50 truncate" }, InfoTab = /* @__PURE__ */ function(a) {
921
- return a.ACTIVITY = "activity", a.NOTES = "notes", a.OVERVIEW = "overview", a;
922
- }(InfoTab || {}), DealDetailSidebar_default = /* @__PURE__ */ defineComponent({
923
- __name: "DealDetailSidebar",
924
- props: { deal: {} },
925
- setup(a) {
926
- let N = a, P = useI18n(), F = useCrm(), I = ref(InfoTab.OVERVIEW), L = ref({
927
- uuid: "",
928
- toColumnUuid: N.deal.boardColumn.uuid,
929
- toColumnColor: N.deal.boardColumn.color,
930
- toColumnDisplayName: N.deal.boardColumn.displayName,
931
- toColumnKey: "",
932
- triggers: []
933
- }), R = computed(() => [
934
- {
935
- icon: "infoCircle",
936
- label: P.t("wise_crm.shared.overview"),
937
- value: InfoTab.OVERVIEW
938
- },
939
- {
940
- icon: "activity",
941
- label: P.t("wise_crm.shared.activity"),
942
- value: InfoTab.ACTIVITY
943
- },
944
- {
945
- icon: "book",
946
- label: P.t("wise_crm.shared.notes"),
947
- value: InfoTab.NOTES
948
- }
949
- ]);
950
- return (a, P) => (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createVNode(DealDetailSidebarNameField_default, { deal: N.deal }, null, 8, ["deal"]), createElementVNode("div", _hoisted_3, [createVNode(AppUnstyledButton_default, { onClick: P[0] ||= (a) => unref(F).openBusinessDetail(N.deal.client.uuid) }, {
951
- default: withCtx(() => [createVNode(unref(VcBadge), {
952
- "class-config": {
953
- icon: "shrink-0 size-4",
954
- root: "text-nowrap"
955
- },
956
- variant: "translucent",
957
- color: "brand",
958
- icon: "building"
959
- }, {
960
- default: withCtx(() => [createElementVNode("span", _hoisted_4, toDisplayString(N.deal.client.name ?? "-"), 1)]),
961
- _: 1
962
- })]),
963
- _: 1
964
- }), createVNode(DealDetailSidebarTransitionSelect_default, {
965
- modelValue: L.value,
966
- "onUpdate:modelValue": P[1] ||= (a) => L.value = a,
967
- deal: N.deal
968
- }, null, 8, ["modelValue", "deal"])])]), createVNode(CrmDetailSidebarTabs_default, {
969
- modelValue: I.value,
970
- "onUpdate:modelValue": P[2] ||= (a) => I.value = a,
971
- tabs: R.value
972
- }, {
973
- default: withCtx(() => [I.value === InfoTab.OVERVIEW ? (openBlock(), createBlock(DealDetailSidebarOverviewContent_default, {
974
- key: 0,
975
- deal: N.deal
976
- }, null, 8, ["deal"])) : I.value === InfoTab.NOTES ? (openBlock(), createBlock(DealDialogSidebarNotesContent_default, {
977
- key: 1,
978
- deal: N.deal
979
- }, null, 8, ["deal"])) : createCommentVNode("", !0)]),
980
- _: 1
981
- }, 8, ["modelValue", "tabs"])]));
982
- }
983
- }), DealDetailSidebarProvider_default = /* @__PURE__ */ defineComponent({
984
- __name: "DealDetailSidebarProvider",
985
- props: { dealUuid: {} },
986
- setup(a) {
987
- let N = a, P = useDealDetailQuery(computed(() => N.dealUuid)), F = useI18n();
988
- return (a, N) => (openBlock(), createBlock(CrmDetailContainer_default, null, {
989
- default: withCtx(() => [unref(P).error.value ? (openBlock(), createBlock(Error_default, {
990
- key: 0,
991
- message: unref(F).t("error.deal_details.description"),
992
- title: unref(F).t("error.deal_details.title")
993
- }, null, 8, ["message", "title"])) : unref(P).isLoading.value ? (openBlock(), createBlock(AppSkeletonLoader_default, {
994
- key: 1,
995
- class: "h-full"
996
- })) : unref(P).data.value ? (openBlock(), createBlock(DealDetailSidebar_default, {
997
- key: unref(P).data.value.boardColumn.uuid,
998
- deal: unref(P).data.value
999
- }, null, 8, ["deal"])) : createCommentVNode("", !0)]),
1000
- _: 1
1001
- }));
1002
- }
1003
- }), DealDetailView_default = /* @__PURE__ */ defineComponent({
1004
- __name: "DealDetailView",
1005
- props: { tabs: {} },
1006
- setup(a) {
1007
- let N = a, P = useI18n(), F = useRouteParams("dealUuid"), I = computed(() => [...N.tabs, {
1008
- label: computed(() => P.t("wise_crm.deal.detail_view.communication_tab_label")),
1009
- to: "deal-communication"
1010
- }]);
1011
- return (a, N) => (openBlock(), createBlock(CrmDetailView_default, {
1012
- key: unref(F),
1013
- "entity-type": unref(EntityType).BUSINESS,
1014
- tabs: I.value
1015
- }, {
1016
- sidebar: withCtx(() => [createVNode(DealDetailSidebarProvider_default, { "deal-uuid": unref(F) }, null, 8, ["deal-uuid"])]),
1017
- _: 1
1018
- }, 8, ["entity-type", "tabs"]));
1019
- }
1020
- });
1021
- export { DealDetailView_default as default };