@wisemen/wise-crm-web 2.0.0-alpha.43 → 2.0.0-alpha.45

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.
@@ -0,0 +1,898 @@
1
+ import { openBlock as i, createElementBlock as _, renderSlot as C, defineComponent as g, computed as w, unref as t, createBlock as p, withCtx as d, createVNode as r, createCommentVNode as N, useModel as Z, Fragment as A, renderList as T, createElementVNode as a, mergeModels as Y, createStaticVNode as J, resolveDynamicComponent as I, toDisplayString as v, mergeProps as j, normalizeClass as $, ref as W, toValue as F } from "vue";
2
+ import { _ as V, ao as X, ap as ee, aq as te, ar as ne, as as oe, at as se, au as le, av as ae, e as ie, aw as re, am as ce, $ as ue, Y as de, ax as me, al as S, t as pe, u as fe, ay as _e, a4 as ye, az as xe, U as he, y as ge, aA as be, aB as ve, D as we, aC as Ce } from "./index-DSFHgVvi.js";
3
+ import { useQuery as ke, ApiUtil as b, useMutation as E } from "@wisemen/vue-core-api-utils";
4
+ import { UISkeletonItem as Ue, UIBadge as $e, UITabs as Ie, UITabsList as De, UITabsItem as Se, UITextareaField as R, toFormField as q, UIIconButton as D, UIDropdownMenu as Be, UIDropdownMenuGroup as Ne, UIDropdownMenuItem as z, UILoader as Ae, useToast as Te, UIFormDialog as Ve, UIDialogHeader as Ee, UIDialogBody as Pe, UIDialogFooter as Le, UIDialogFooterCancel as Fe, UIDialogFooterSubmit as ze, UILink as Me, UITabsRouterLink as je, UITabsRouterLinkItem as Re } from "@wisemen/vue-core-design-system";
5
+ import { Motion as H, AnimatePresence as qe } from "motion-v";
6
+ import { useI18n as k } from "vue-i18n";
7
+ import { useForm as K } from "formango";
8
+ import { Temporal as He } from "temporal-polyfill";
9
+ import { z as M } from "zod";
10
+ import { AccordionRoot as Ke, AccordionItem as Ge, AccordionHeader as Oe, AccordionTrigger as Qe, AccordionContent as Ze } from "reka-ui";
11
+ import { onKeyStroke as Ye } from "@vueuse/core";
12
+ import { useRoute as Je, RouterView as We } from "vue-router";
13
+ const Xe = {}, et = { class: "flex h-full w-100 flex-col overflow-hidden border-r border-secondary bg-primary px-md py-md" };
14
+ function tt(s, e) {
15
+ return i(), _("div", et, [
16
+ C(s.$slots, "default")
17
+ ]);
18
+ }
19
+ const an = /* @__PURE__ */ V(Xe, [["render", tt]]), rn = /* @__PURE__ */ g({
20
+ __name: "CrmDetailHeaderBadge",
21
+ props: {
22
+ uuid: {},
23
+ badge: {},
24
+ entity: {}
25
+ },
26
+ setup(s) {
27
+ const e = s, n = k(), l = ke("wiseCrmHeaderBadge", {
28
+ params: {
29
+ uuid: w(() => e.uuid),
30
+ badgeKey: w(() => e.badge.key),
31
+ entity: w(() => e.entity),
32
+ // Labels are translated by the host app, so refetch them in the new locale
33
+ locale: w(() => n.locale.value)
34
+ },
35
+ queryFn: () => b.fromPromise(u())
36
+ }), o = w(() => {
37
+ if (!l.result.value.isOk())
38
+ return null;
39
+ const m = l.result.value.getValue();
40
+ if (m === null)
41
+ return null;
42
+ const c = typeof m == "string" ? {
43
+ label: m
44
+ } : m, h = c.label.trim();
45
+ return h === "" ? null : {
46
+ ...c,
47
+ label: h
48
+ };
49
+ });
50
+ async function u() {
51
+ try {
52
+ return await e.badge.getData({
53
+ uuid: e.uuid
54
+ });
55
+ } catch (m) {
56
+ return X.error(new Error(`[wise-crm] Header badge "${e.badge.key}" failed to load`, {
57
+ cause: m
58
+ })), null;
59
+ }
60
+ }
61
+ return (m, c) => t(l).isLoading.value ? (i(), p(t(Ue), {
62
+ key: 0,
63
+ "is-animated": !0,
64
+ class: "h-6 w-16"
65
+ })) : o.value !== null ? (i(), p(t(H), {
66
+ key: 1,
67
+ initial: { opacity: 0 },
68
+ animate: { opacity: 1 },
69
+ transition: { duration: 0.15 },
70
+ class: "flex max-w-full min-w-0"
71
+ }, {
72
+ default: d(() => [
73
+ r(t($e), {
74
+ label: o.value.label,
75
+ icon: o.value.icon ?? e.badge.icon,
76
+ color: o.value.color ?? e.badge.color,
77
+ dot: o.value.dot ?? e.badge.dot,
78
+ variant: o.value.variant ?? e.badge.variant,
79
+ class: "max-w-full"
80
+ }, null, 8, ["label", "icon", "color", "dot", "variant"])
81
+ ]),
82
+ _: 1
83
+ })) : N("", !0);
84
+ }
85
+ }), nt = { class: "mt-lg flex h-full flex-1 flex-col overflow-hidden" }, ot = { class: "min-h-0 flex-1 overflow-y-auto px-lg py-lg" }, cn = /* @__PURE__ */ g({
86
+ __name: "CrmDetailSidebarTabs",
87
+ props: /* @__PURE__ */ Y({
88
+ tabs: {}
89
+ }, {
90
+ modelValue: {
91
+ required: !0
92
+ },
93
+ modelModifiers: {}
94
+ }),
95
+ emits: ["update:modelValue"],
96
+ setup(s) {
97
+ const e = s, n = Z(s, "modelValue");
98
+ return (l, o) => (i(), _("div", nt, [
99
+ r(t(Ie), {
100
+ modelValue: n.value,
101
+ "onUpdate:modelValue": o[0] || (o[0] = (u) => n.value = u),
102
+ "is-full-width": !0,
103
+ "underline-tabs-horizontal-list-padding": "lg",
104
+ class: "flex h-full flex-1 flex-col"
105
+ }, {
106
+ default: d(() => [
107
+ r(t(De), { class: "py-xxs" }, {
108
+ default: d(() => [
109
+ (i(!0), _(A, null, T(e.tabs, (u) => (i(), p(t(Se), {
110
+ key: u.value,
111
+ value: u.value,
112
+ icon: u.icon,
113
+ label: u.label
114
+ }, null, 8, ["value", "icon", "label"]))), 128))
115
+ ]),
116
+ _: 1
117
+ }),
118
+ a("div", ot, [
119
+ C(l.$slots, "default")
120
+ ])
121
+ ]),
122
+ _: 3
123
+ }, 8, ["modelValue"])
124
+ ]));
125
+ }
126
+ }), st = {}, lt = {
127
+ fill: "none",
128
+ height: "100%",
129
+ viewBox: "0 0 756 560",
130
+ width: "100%",
131
+ xmlns: "http://www.w3.org/2000/svg"
132
+ };
133
+ function at(s, e) {
134
+ return i(), _("svg", lt, [...e[0] || (e[0] = [
135
+ J('<mask id="mask0_2103_18170" height="768" maskUnits="userSpaceOnUse" style="mask-type:alpha;" width="768" x="-6" y="-208"><rect fill="url(#paint0_radial_2103_18170)" height="768" transform="translate(-6 -208)" width="768"></rect></mask><g mask="url(#mask0_2103_18170)"><g clip-path="url(#clip0_2103_18170)"><g clip-path="url(#clip1_2103_18170)"><line stroke="currentColor" x1="42.5" x2="42.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="90.5" x2="90.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="138.5" x2="138.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="186.5" x2="186.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="234.5" x2="234.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="282.5" x2="282.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="330.5" x2="330.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="378.5" x2="378.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="426.5" x2="426.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="474.5" x2="474.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="522.5" x2="522.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="570.5" x2="570.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="618.5" x2="618.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="666.5" x2="666.5" y1="-208" y2="560"></line><line stroke="currentColor" x1="714.5" x2="714.5" y1="-208" y2="560"></line></g><rect height="767" stroke="currentColor" width="767" x="-5.5" y="-207.5"></rect><g clip-path="url(#clip2_2103_18170)"><line stroke="currentColor" x1="-6" x2="762" y1="31.5" y2="31.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="79.5" y2="79.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="127.5" y2="127.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="175.5" y2="175.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="223.5" y2="223.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="271.5" y2="271.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="319.5" y2="319.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="367.5" y2="367.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="415.5" y2="415.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="463.5" y2="463.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="511.5" y2="511.5"></line><line stroke="currentColor" x1="-6" x2="762" y1="559.5" y2="559.5"></line></g><rect height="767" stroke="currentColor" width="767" x="-5.5" y="-207.5"></rect></g></g><defs><radialGradient id="paint0_radial_2103_18170" cx="0" cy="0" gradientTransform="translate(384 384) rotate(90) scale(384 384)" gradientUnits="userSpaceOnUse" r="1"><stop></stop><stop offset="1" stop-opacity="0"></stop></radialGradient><clipPath id="clip0_2103_18170"><rect fill="white" height="768" transform="translate(-6 -208)" width="768"></rect></clipPath><clipPath id="clip1_2103_18170"><rect fill="white" height="768" width="768" x="-6" y="-208"></rect></clipPath><clipPath id="clip2_2103_18170"><rect fill="white" height="768" width="768" x="-6" y="-208"></rect></clipPath></defs>', 3)
136
+ ])]);
137
+ }
138
+ const it = /* @__PURE__ */ V(st, [["render", at]]), rt = { class: "relative flex h-full flex-col items-center justify-center text-center" }, ct = { class: "relative z-1 flex flex-col items-center gap-lg" }, ut = { class: "flex size-12 items-center justify-center rounded-full border-3 border-solid border-white bg-brand-200 p-md shadow-md" }, dt = { class: "flex flex-col gap-sm" }, mt = { class: "text-md font-semibold" }, pt = { class: "text-sm text-tertiary" }, ft = { class: "absolute inset-x-0 scale-140 opacity-10" }, _t = /* @__PURE__ */ g({
139
+ __name: "AppEmptyState",
140
+ props: {
141
+ title: {},
142
+ description: {},
143
+ icon: {}
144
+ },
145
+ setup(s) {
146
+ const e = s;
147
+ return (n, l) => (i(), _("div", rt, [
148
+ a("div", ct, [
149
+ a("div", ut, [
150
+ (i(), p(I(e.icon), { class: "size-full text-brand-600" }))
151
+ ]),
152
+ a("div", dt, [
153
+ a("h3", mt, v(e.title), 1),
154
+ a("p", pt, v(e.description), 1)
155
+ ])
156
+ ]),
157
+ a("div", ft, [
158
+ r(it)
159
+ ])
160
+ ]));
161
+ }
162
+ });
163
+ class B {
164
+ static fromDto(e) {
165
+ return {
166
+ uuid: e.uuid,
167
+ lastUpdatedByUserUuid: e.lastUpdatedByUserUuid,
168
+ updatedAt: ee.fromDto(e.updatedAt),
169
+ content: e.content,
170
+ lastUpdatedByUser: e.lastUpdatedByUser
171
+ };
172
+ }
173
+ }
174
+ class yt {
175
+ static toDto(e, n, l, o) {
176
+ return {
177
+ businessUuid: n ?? null,
178
+ dealUuid: o ?? null,
179
+ individualUuid: l ?? null,
180
+ content: e.note ?? ""
181
+ };
182
+ }
183
+ }
184
+ class G {
185
+ static async create(e, n) {
186
+ const l = await b.fromPromise(te({
187
+ body: yt.toDto(
188
+ e,
189
+ n.businessUuid,
190
+ n.individualUuid,
191
+ n.dealUuid
192
+ )
193
+ }));
194
+ return b.void(l);
195
+ }
196
+ static async delete(e) {
197
+ const n = await b.fromPromise(ne({
198
+ path: {
199
+ uuid: e
200
+ }
201
+ }));
202
+ return b.void(n);
203
+ }
204
+ static async getBusinessNotes(e, n) {
205
+ return (await b.fromPromise(oe({
206
+ query: e,
207
+ path: {
208
+ businessUuid: n
209
+ }
210
+ }))).map((o) => ({
211
+ data: o.data.items.map(B.fromDto),
212
+ meta: {
213
+ next: o.data.meta.next
214
+ }
215
+ }));
216
+ }
217
+ static async getDealNotes(e, n) {
218
+ return (await b.fromPromise(se({
219
+ query: e,
220
+ path: {
221
+ dealUuid: n
222
+ }
223
+ }))).map((o) => ({
224
+ data: o.data.items.map(B.fromDto),
225
+ meta: {
226
+ next: o.data.meta.next
227
+ }
228
+ }));
229
+ }
230
+ static async getIndividualNotes(e, n) {
231
+ return (await b.fromPromise(le({
232
+ query: e,
233
+ path: {
234
+ individualUuid: n
235
+ }
236
+ }))).map((o) => ({
237
+ data: o.data.items.map(B.fromDto),
238
+ meta: {
239
+ next: o.data.meta.next
240
+ }
241
+ }));
242
+ }
243
+ static async update(e, n) {
244
+ const l = await b.fromPromise(ae({
245
+ body: {
246
+ content: n
247
+ },
248
+ path: {
249
+ uuid: e
250
+ }
251
+ }));
252
+ return b.void(l);
253
+ }
254
+ }
255
+ function un() {
256
+ return E({
257
+ queryFn: async ({
258
+ params: s
259
+ }) => await G.delete(s.noteUuid),
260
+ queryKeysToInvalidate: {
261
+ noteBusinessIndex: {},
262
+ noteDealIndex: {},
263
+ noteIndividualIndex: {}
264
+ }
265
+ });
266
+ }
267
+ const O = M.object({
268
+ note: M.string().trim().min(1)
269
+ }), xt = { class: "flex justify-end p-md" }, ht = /* @__PURE__ */ g({
270
+ __name: "NoteForm",
271
+ props: {
272
+ content: {},
273
+ onSubmit: { type: Function }
274
+ },
275
+ setup(s) {
276
+ const e = s, n = k(), l = K({
277
+ initialState: {
278
+ note: e.content ?? null
279
+ },
280
+ schema: O,
281
+ onSubmit: async (c) => {
282
+ await e.onSubmit(c), l.reset();
283
+ }
284
+ }), o = l.register("note"), u = w(() => o.modelValue.value === null || o.modelValue.value.trim().length === 0);
285
+ async function m(c) {
286
+ !l.isValid.value || l.isSubmitting.value || c.key === "Enter" && !c.shiftKey && (c.preventDefault(), await l.submit(), o.setValue(null));
287
+ }
288
+ return (c, h) => (i(), _("div", null, [
289
+ r(ie, {
290
+ "can-exit-when-dirty": !0,
291
+ form: t(l),
292
+ class: "w-full"
293
+ }, {
294
+ default: d(() => [
295
+ r(t(R), j(t(q)(t(o)), {
296
+ errors: [],
297
+ "error-message": null,
298
+ placeholder: t(n).t("wise_crm.note.create_placeholder"),
299
+ "class-config": {
300
+ input: "h-20"
301
+ },
302
+ onKeydown: m
303
+ }), {
304
+ bottom: d(() => [
305
+ a("div", xt, [
306
+ r(t(D), {
307
+ "is-loading": t(l).isSubmitting.value,
308
+ "is-disabled": u.value,
309
+ label: t(n).t("wise_crm.info_dialog.notes.submit_note_label"),
310
+ icon: t(re),
311
+ class: "rounded-full shadow-none",
312
+ type: "submit",
313
+ size: "sm"
314
+ }, null, 8, ["is-loading", "is-disabled", "label", "icon"])
315
+ ])
316
+ ]),
317
+ _: 1
318
+ }, 16, ["placeholder"])
319
+ ]),
320
+ _: 1
321
+ }, 8, ["form"])
322
+ ]));
323
+ }
324
+ }), gt = { class: "flex flex-col gap-md" }, bt = { class: "relative flex flex-1 flex-col gap-sm overflow-hidden rounded-lg border border-primary p-lg" }, vt = { class: "mr-3xl max-w-full text-sm text-wrap wrap-break-word whitespace-pre-wrap" }, wt = { class: "flex items-center gap-sm text-xs text-placeholder" }, Ct = { class: "absolute top-1 right-1" }, kt = /* @__PURE__ */ g({
325
+ __name: "NoteList",
326
+ props: {
327
+ notes: {}
328
+ },
329
+ emits: ["delete", "next", "update"],
330
+ setup(s, { emit: e }) {
331
+ const n = s, l = e, o = k();
332
+ function u(y) {
333
+ const x = y.updatedAt, f = x.toInstant(), U = He.Now.instant(), Q = S.diffInSeconds(f, U), P = S.diffInMinutes(f, U), L = S.diffInHours(f, U);
334
+ return Q < 60 ? o.t("wise_crm.note.just_now") : P < 60 ? o.t("wise_crm.note.minutes_ago", {
335
+ count: Math.round(P)
336
+ }) : L < 24 ? o.t("wise_crm.note.hours_ago", {
337
+ count: Math.round(L)
338
+ }) : pe().toDateTime(x);
339
+ }
340
+ function m() {
341
+ l("next");
342
+ }
343
+ function c(y) {
344
+ l("delete", y);
345
+ }
346
+ function h(y) {
347
+ l("update", y);
348
+ }
349
+ return (y, x) => (i(), p(ce, { "on-next": m }, {
350
+ default: d(() => [
351
+ a("div", gt, [
352
+ (i(!0), _(A, null, T(n.notes, (f) => (i(), _("div", {
353
+ key: f.content,
354
+ class: "flex gap-sm"
355
+ }, [
356
+ a("div", bt, [
357
+ a("p", vt, v(f.content), 1),
358
+ a("div", wt, [
359
+ a("span", null, v(u(f)), 1),
360
+ x[0] || (x[0] = a("div", { class: "size-1 rounded-full bg-gray-400" }, null, -1)),
361
+ a("span", null, v(f.lastUpdatedByUser), 1)
362
+ ]),
363
+ a("div", Ct, [
364
+ r(t(Be), { "popover-align": "end" }, {
365
+ trigger: d(() => [
366
+ r(t(D), {
367
+ label: t(o).t("wise_crm.info_dialog.notes.action_button_label"),
368
+ icon: t(me),
369
+ variant: "tertiary",
370
+ size: "sm"
371
+ }, null, 8, ["label", "icon"])
372
+ ]),
373
+ content: d(() => [
374
+ r(t(Ne), null, {
375
+ default: d(() => [
376
+ r(t(z), {
377
+ label: t(o).t("wise_crm.info_dialog.notes.update_note"),
378
+ config: {
379
+ left: {
380
+ type: "icon",
381
+ icon: t(ue)
382
+ }
383
+ },
384
+ onSelect: (U) => h(f)
385
+ }, null, 8, ["label", "config", "onSelect"]),
386
+ r(t(z), {
387
+ "is-destructive": !0,
388
+ label: t(o).t("wise_crm.shared.delete"),
389
+ config: {
390
+ left: {
391
+ type: "icon",
392
+ icon: t(de)
393
+ }
394
+ },
395
+ onSelect: (U) => c(f.uuid)
396
+ }, null, 8, ["label", "config", "onSelect"])
397
+ ]),
398
+ _: 2
399
+ }, 1024)
400
+ ]),
401
+ _: 2
402
+ }, 1024)
403
+ ])
404
+ ])
405
+ ]))), 128))
406
+ ])
407
+ ]),
408
+ _: 1
409
+ }));
410
+ }
411
+ }), Ut = { class: "flex h-full flex-col justify-between gap-lg" }, $t = {
412
+ key: 0,
413
+ class: "flex h-70 flex-col items-center justify-center gap-md text-quaternary"
414
+ }, It = { class: "text-xs" }, dn = /* @__PURE__ */ g({
415
+ __name: "CrmDetailSidebarNotesView",
416
+ props: {
417
+ hasNextPage: { type: Boolean },
418
+ isLoading: { type: Boolean },
419
+ notes: {},
420
+ onSubmit: { type: Function }
421
+ },
422
+ emits: ["delete", "next", "update"],
423
+ setup(s, { emit: e }) {
424
+ const n = s, l = e, o = k(), u = fe();
425
+ async function m(x) {
426
+ try {
427
+ await n.onSubmit(x);
428
+ } catch (f) {
429
+ u.show(f);
430
+ }
431
+ }
432
+ function c() {
433
+ l("next");
434
+ }
435
+ function h(x) {
436
+ l("delete", x);
437
+ }
438
+ function y(x) {
439
+ l("update", x);
440
+ }
441
+ return (x, f) => (i(), _("div", Ut, [
442
+ n.isLoading ? (i(), _("div", $t, [
443
+ r(t(Ae), { class: "size-4" }),
444
+ a("p", It, v(t(o).t("wise_crm.shared.loading")), 1)
445
+ ])) : n.notes.length === 0 ? (i(), p(_t, {
446
+ key: 1,
447
+ title: t(o).t("wise_crm.info_dialog.notes.empty_state.title"),
448
+ description: t(o).t("wise_crm.info_dialog.notes.empty_state.description"),
449
+ icon: t(_e)
450
+ }, null, 8, ["title", "description", "icon"])) : (i(), p(kt, {
451
+ key: 2,
452
+ notes: n.notes,
453
+ onDelete: h,
454
+ onUpdate: y,
455
+ onNext: c
456
+ }, null, 8, ["notes"])),
457
+ r(ht, { "on-submit": m })
458
+ ]));
459
+ }
460
+ });
461
+ function Dt() {
462
+ return E({
463
+ queryFn: async ({
464
+ body: s,
465
+ params: e
466
+ }) => await G.update(e.noteUuid, s.note),
467
+ queryKeysToInvalidate: {
468
+ noteBusinessIndex: {},
469
+ noteDealIndex: {},
470
+ noteIndividualIndex: {}
471
+ }
472
+ });
473
+ }
474
+ const mn = /* @__PURE__ */ g({
475
+ __name: "NoteUpdateDialog",
476
+ props: {
477
+ businessUuid: {},
478
+ individualUuid: {},
479
+ note: {}
480
+ },
481
+ emits: ["close"],
482
+ setup(s, { emit: e }) {
483
+ const n = s, l = e, o = k(), u = Te(), m = Dt(), c = K({
484
+ initialState: {
485
+ note: n.note.content ?? null
486
+ },
487
+ schema: O,
488
+ onSubmit: async (x) => {
489
+ const f = await m.execute({
490
+ body: {
491
+ note: x.note
492
+ },
493
+ params: {
494
+ businessUuid: n.businessUuid,
495
+ individualUuid: n.individualUuid,
496
+ noteUuid: n.note.uuid
497
+ }
498
+ });
499
+ if (f.isErr()) {
500
+ u.apiError(f.error);
501
+ return;
502
+ }
503
+ l("close");
504
+ },
505
+ onSubmitError: () => {
506
+ u.unableToSave();
507
+ }
508
+ }), h = c.register("note");
509
+ function y() {
510
+ l("close");
511
+ }
512
+ return (x, f) => (i(), p(t(Ve), {
513
+ form: t(c),
514
+ size: "sm",
515
+ onClose: y
516
+ }, {
517
+ default: d(() => [
518
+ r(t(Ee), {
519
+ title: t(o).t("wise_crm.note.update_dialog.title"),
520
+ description: t(o).t("wise_crm.note.update_dialog.description")
521
+ }, null, 8, ["title", "description"]),
522
+ r(t(Pe), null, {
523
+ default: d(() => [
524
+ r(t(R), j(t(q)(t(h)), {
525
+ label: t(o).t("wise_crm.note.form.note.label"),
526
+ "class-config": { input: "h-32" }
527
+ }), null, 16, ["label"])
528
+ ]),
529
+ _: 1
530
+ }),
531
+ r(t(Le), null, {
532
+ default: d(() => [
533
+ r(t(Fe)),
534
+ r(t(ze), {
535
+ label: t(o).t("shared.update")
536
+ }, null, 8, ["label"])
537
+ ]),
538
+ _: 1
539
+ })
540
+ ]),
541
+ _: 1
542
+ }, 8, ["form"]));
543
+ }
544
+ });
545
+ function pn() {
546
+ return E({
547
+ queryFn: async ({
548
+ body: s
549
+ }) => await ye.create({
550
+ address: null,
551
+ customFields: null,
552
+ email: s.email,
553
+ firstName: s.firstName,
554
+ lastName: s.lastName,
555
+ mobilePhone: s.mobilePhone,
556
+ phone: s.phone
557
+ }),
558
+ queryKeysToInvalidate: {}
559
+ });
560
+ }
561
+ const fn = /* @__PURE__ */ g({
562
+ __name: "CrmDetailAccordionRoot",
563
+ props: {
564
+ defaultValues: {},
565
+ type: { default: "multiple" }
566
+ },
567
+ setup(s) {
568
+ const e = s;
569
+ return (n, l) => (i(), p(t(Ke), {
570
+ collapsible: !0,
571
+ "default-value": e.defaultValues,
572
+ type: e.type,
573
+ class: "flex flex-col gap-md"
574
+ }, {
575
+ default: d(() => [
576
+ C(n.$slots, "default")
577
+ ]),
578
+ _: 3
579
+ }, 8, ["default-value", "type"]));
580
+ }
581
+ }), _n = /* @__PURE__ */ g({
582
+ __name: "AppIconLabelPair",
583
+ props: {
584
+ icon: {},
585
+ label: {},
586
+ placeholder: {},
587
+ textColor: {}
588
+ },
589
+ setup(s) {
590
+ const e = s;
591
+ return (n, l) => (i(), _("div", {
592
+ class: $([{
593
+ "text-placeholder/50": e.label === null,
594
+ "text-secondary": e.label !== null && !e.textColor,
595
+ [e.textColor]: e.label !== null && !!e.textColor
596
+ }, "flex items-center gap-md"])
597
+ }, [
598
+ (i(), p(I(e.icon), { class: "size-4 shrink-0" })),
599
+ a("p", null, v(e.label === null ? e.placeholder : e.label), 1)
600
+ ], 2));
601
+ }
602
+ }), St = {}, Bt = { class: "rounded-xl border border-secondary/50 bg-primary p-lg text-sm dark:border-secondary" };
603
+ function Nt(s, e) {
604
+ return i(), _("div", Bt, [
605
+ C(s.$slots, "default")
606
+ ]);
607
+ }
608
+ const yn = /* @__PURE__ */ V(St, [["render", Nt]]), xn = /* @__PURE__ */ g({
609
+ __name: "AppOpenEntityButton",
610
+ props: {
611
+ uuid: {},
612
+ entityType: {},
613
+ label: {}
614
+ },
615
+ setup(s) {
616
+ const e = s, n = w(() => xe(e.entityType, e.uuid));
617
+ return (l, o) => (i(), p(t(Me), {
618
+ to: n.value,
619
+ label: e.label,
620
+ variant: "secondary"
621
+ }, null, 8, ["to", "label"]));
622
+ }
623
+ }), At = ["aria-label", "disabled"], Tt = {
624
+ class: "size-4",
625
+ viewBox: "0 0 24 24",
626
+ xmlns: "http://www.w3.org/2000/svg"
627
+ }, Vt = ["fill", "stroke"], hn = /* @__PURE__ */ g({
628
+ __name: "CrmDetailSidebarStarButton",
629
+ props: {
630
+ isActive: { type: Boolean }
631
+ },
632
+ emits: ["click"],
633
+ setup(s, { emit: e }) {
634
+ const n = s, l = e, o = k();
635
+ function u() {
636
+ l("click");
637
+ }
638
+ return (m, c) => (i(), _("button", {
639
+ "aria-label": t(o).t("wise_crm.info_dialog.sidebar.overview.contact_person_primary"),
640
+ disabled: n.isActive,
641
+ class: "flex size-8 items-center justify-center rounded-md not-disabled:hover:bg-tertiary",
642
+ type: "button",
643
+ onClick: u
644
+ }, [
645
+ (i(), _("svg", Tt, [
646
+ a("path", {
647
+ fill: n.isActive ? "var(--warning-400)" : "none",
648
+ stroke: n.isActive ? "var(--warning-400)" : "var(--fg-primary)",
649
+ d: "M11.2827 3.45332C11.5131 2.98638 11.6284 2.75291 11.7848 2.67831C11.9209 2.61341 12.0791 2.61341 12.2152 2.67831C12.3717 2.75291 12.4869 2.98638 12.7174 3.45332L14.9041 7.88328C14.9721 8.02113 15.0061 8.09006 15.0558 8.14358C15.0999 8.19096 15.1527 8.22935 15.2113 8.25662C15.2776 8.28742 15.3536 8.29854 15.5057 8.32077L20.397 9.03571C20.9121 9.11099 21.1696 9.14863 21.2888 9.27444C21.3925 9.38389 21.4412 9.5343 21.4215 9.68377C21.3988 9.85558 21.2124 10.0372 20.8395 10.4004L17.3014 13.8464C17.1912 13.9538 17.136 14.0076 17.1004 14.0715C17.0689 14.128 17.0487 14.1902 17.0409 14.2545C17.0321 14.3271 17.0451 14.403 17.0711 14.5547L17.906 19.4221C17.994 19.9355 18.038 20.1922 17.9553 20.3445C17.8833 20.477 17.7554 20.57 17.6071 20.5975C17.4366 20.6291 17.2061 20.5078 16.7451 20.2654L12.3724 17.9658C12.2361 17.8942 12.168 17.8584 12.0962 17.8443C12.0327 17.8318 11.9673 17.8318 11.9038 17.8443C11.832 17.8584 11.7639 17.8942 11.6277 17.9658L7.25492 20.2654C6.79392 20.5078 6.56341 20.6291 6.39297 20.5975C6.24468 20.57 6.11672 20.477 6.04474 20.3445C5.962 20.1922 6.00603 19.9355 6.09407 19.4221L6.92889 14.5547C6.95491 14.403 6.96793 14.3271 6.95912 14.2545C6.95132 14.1902 6.93111 14.128 6.89961 14.0715C6.86402 14.0076 6.80888 13.9538 6.69859 13.8464L3.16056 10.4004C2.78766 10.0372 2.60121 9.85558 2.57853 9.68377C2.55879 9.5343 2.60755 9.38389 2.71125 9.27444C2.83044 9.14863 3.08797 9.11099 3.60304 9.03571L8.49431 8.32077C8.64642 8.29854 8.72248 8.28742 8.78872 8.25662C8.84736 8.22935 8.90016 8.19096 8.94419 8.14358C8.99391 8.09006 9.02793 8.02113 9.09597 7.88328L11.2827 3.45332Z",
650
+ "stroke-linecap": "round",
651
+ "stroke-linejoin": "round",
652
+ "stroke-width": "2"
653
+ }, null, 8, Vt)
654
+ ]))
655
+ ], 8, At));
656
+ }
657
+ }), gn = /* @__PURE__ */ g({
658
+ __name: "CrmDetailSidebarAccordionHeaderIconButton",
659
+ props: {
660
+ icon: {},
661
+ label: {}
662
+ },
663
+ emits: ["click"],
664
+ setup(s, { emit: e }) {
665
+ const n = s, l = e;
666
+ function o() {
667
+ l("click");
668
+ }
669
+ return (u, m) => (i(), p(t(D), {
670
+ icon: n.icon,
671
+ label: n.label,
672
+ variant: "tertiary",
673
+ size: "sm",
674
+ onClick: o
675
+ }, null, 8, ["icon", "label"]));
676
+ }
677
+ }), Et = { class: "group/item group/accordion-header relative isolate flex h-8 w-full items-center justify-between gap-sm rounded-xl bg-secondary pr-sm pl-lg outline-brand-600 focus:outline-2" }, Pt = { class: "sr-only" }, Lt = { class: "flex items-center gap-sm" }, Ft = {
678
+ key: 0,
679
+ class: "pointer-events-none flex items-center gap-sm px-md"
680
+ }, bn = /* @__PURE__ */ g({
681
+ __name: "CrmDetailSidebarAccordionItem",
682
+ props: {
683
+ isEmpty: { type: Boolean, default: !1 },
684
+ icon: {},
685
+ label: {},
686
+ value: {}
687
+ },
688
+ setup(s) {
689
+ const e = s;
690
+ return (n, l) => (i(), p(t(Ge), {
691
+ value: e.value,
692
+ disabled: e.isEmpty
693
+ }, {
694
+ default: d(({ open: o }) => [
695
+ r(t(Oe), null, {
696
+ default: d(() => [
697
+ a("div", Et, [
698
+ r(t(Qe), { class: "absolute inset-0 rounded-xl ring-brand-500 ring-offset-1 duration-200 outline-none focus-visible:ring-2" }, {
699
+ default: d(() => [
700
+ a("span", Pt, v(s.label), 1)
701
+ ]),
702
+ _: 1
703
+ }),
704
+ a("span", Lt, [
705
+ (i(), p(I(e.icon), { class: "size-4 text-secondary" })),
706
+ a("span", {
707
+ class: $([{
708
+ "text-primary": o && !e.isEmpty,
709
+ "text-secondary": !o
710
+ }, "text-sm font-medium text-primary"])
711
+ }, v(s.label), 3)
712
+ ]),
713
+ a("div", {
714
+ class: $([{
715
+ "pr-xs": e.isEmpty
716
+ }, "flex items-center justify-between gap-xs"])
717
+ }, [
718
+ C(n.$slots, "actions"),
719
+ e.isEmpty ? N("", !0) : (i(), _("div", Ft, [
720
+ (i(), p(I(t(he)), {
721
+ class: $([{
722
+ "-rotate-180": o
723
+ }, "size-4 text-secondary duration-300"])
724
+ }, null, 8, ["class"]))
725
+ ]))
726
+ ], 2)
727
+ ])
728
+ ]),
729
+ _: 2
730
+ }, 1024),
731
+ r(t(qe), { initial: !1 }, {
732
+ default: d(() => [
733
+ o ? (i(), p(t(Ze), {
734
+ key: 0,
735
+ class: "overflow-clip"
736
+ }, {
737
+ default: d(() => [
738
+ r(t(H), {
739
+ initial: {
740
+ opacity: 0,
741
+ height: 0,
742
+ y: -10
743
+ },
744
+ animate: {
745
+ opacity: 1,
746
+ height: "auto",
747
+ filter: "blur(0px)",
748
+ y: 0
749
+ },
750
+ exit: {
751
+ opacity: 0,
752
+ height: 0,
753
+ filter: "blur(5px)",
754
+ y: -10
755
+ },
756
+ transition: {
757
+ bounce: 0,
758
+ duration: 0.4,
759
+ type: "spring"
760
+ }
761
+ }, {
762
+ default: d(() => [
763
+ a("div", {
764
+ class: $([{
765
+ "py-md": !e.isEmpty,
766
+ "py-0": e.isEmpty
767
+ }, "flex flex-col gap-md"])
768
+ }, [
769
+ C(n.$slots, "default")
770
+ ], 2)
771
+ ]),
772
+ _: 3
773
+ })
774
+ ]),
775
+ _: 3
776
+ })) : N("", !0)
777
+ ]),
778
+ _: 2
779
+ }, 1024)
780
+ ]),
781
+ _: 3
782
+ }, 8, ["value", "disabled"]));
783
+ }
784
+ });
785
+ class zt {
786
+ /**
787
+ * Checks if any parent element has `aria-hidden="true"` set. use this to check if a dialog or a popover is open.
788
+ * @param element The element to start checking from.
789
+ * @returns True if any parent has `aria-hidden="true"`, false otherwise.
790
+ */
791
+ static parentHasAriaHidden(e) {
792
+ let n = e.parentElement;
793
+ for (; n; ) {
794
+ if (n.hasAttribute("aria-hidden"))
795
+ return n.getAttribute("aria-hidden") === "true";
796
+ n = n.parentElement;
797
+ }
798
+ return !1;
799
+ }
800
+ }
801
+ const Mt = { class: "flex h-dvh w-dvw flex-1 overflow-hidden" }, jt = { class: "flex h-full min-w-100 flex-col" }, Rt = { class: "flex size-full flex-1 justify-center overflow-hidden bg-secondary" }, qt = { class: "flex w-full flex-col" }, Ht = { class: "grid w-full grid-cols-[1fr_auto_1fr] p-lg" }, Kt = { class: "flex min-w-0 items-center justify-center" }, Gt = { class: "flex items-center justify-end" }, Ot = { class: "size-full overflow-y-auto" }, vn = /* @__PURE__ */ g({
802
+ __name: "CrmDetailView",
803
+ props: {
804
+ entityType: {},
805
+ tabs: {}
806
+ },
807
+ setup(s) {
808
+ const e = s, n = W(null), l = k(), o = ge(), u = Je(), m = {
809
+ icon: ve,
810
+ label: l.t("wise_crm.shared.back"),
811
+ onClick: o.goToReturnRoute
812
+ };
813
+ return Ye("Escape", () => {
814
+ const c = n.value?.$el;
815
+ c && zt.parentHasAriaHidden(c) || o.goToReturnRoute();
816
+ }), (c, h) => (i(), p(be, {
817
+ "primary-action": m,
818
+ class: "h-dvh w-dvw"
819
+ }, {
820
+ default: d(() => [
821
+ a("div", Mt, [
822
+ a("div", jt, [
823
+ C(c.$slots, "sidebar")
824
+ ]),
825
+ r(we, {
826
+ color: t(o).getEntityConfig(s.entityType)?.color ?? null,
827
+ class: "relative flex flex-1 flex-col overflow-hidden"
828
+ }, {
829
+ default: d(() => [
830
+ a("div", Rt, [
831
+ a("div", qt, [
832
+ a("div", Ht, [
833
+ h[1] || (h[1] = a("div", null, null, -1)),
834
+ a("div", Kt, [
835
+ r(t(je), {
836
+ variant: "button-border",
837
+ class: "min-w-0"
838
+ }, {
839
+ default: d(() => [
840
+ (i(!0), _(A, null, T(e.tabs, (y) => (i(), p(t(Re), {
841
+ key: F(y.label),
842
+ label: F(y.label),
843
+ to: {
844
+ name: y.to,
845
+ params: t(u).params
846
+ }
847
+ }, null, 8, ["label", "to"]))), 128))
848
+ ]),
849
+ _: 1
850
+ })
851
+ ]),
852
+ a("div", Gt, [
853
+ r(t(D), {
854
+ ref_key: "closeButtonRef",
855
+ ref: n,
856
+ "class-config": {
857
+ root: "rounded-md shadow-lg"
858
+ },
859
+ icon: t(Ce),
860
+ label: "Close",
861
+ variant: "secondary",
862
+ onClick: h[0] || (h[0] = (y) => t(o).goToReturnRoute())
863
+ }, null, 8, ["icon"])
864
+ ])
865
+ ]),
866
+ a("div", Ot, [
867
+ r(t(We))
868
+ ])
869
+ ])
870
+ ])
871
+ ]),
872
+ _: 1
873
+ }, 8, ["color"])
874
+ ])
875
+ ]),
876
+ _: 3
877
+ }));
878
+ }
879
+ });
880
+ export {
881
+ yn as C,
882
+ G as N,
883
+ mn as _,
884
+ dn as a,
885
+ pn as b,
886
+ xn as c,
887
+ fn as d,
888
+ bn as e,
889
+ _n as f,
890
+ gn as g,
891
+ rn as h,
892
+ cn as i,
893
+ an as j,
894
+ vn as k,
895
+ hn as l,
896
+ _t as m,
897
+ un as u
898
+ };