@wisemen/wise-crm-web 2.0.0-alpha.8 → 3.0.0-alpha.0

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,205 @@
1
+ import { defineComponent as _, computed as c, openBlock as n, createBlock as s, unref as l, ref as D, withCtx as y, createCommentVNode as f, createElementBlock as A, Fragment as U, renderList as $ } from "vue";
2
+ import { useRouteParams as w } from "@vueuse/router";
3
+ import { I as C, u as V, a as L, y as Q, b as P, c as S, x as E, A as x } from "./index-BddOTAwb.js";
4
+ import { bs as I } from "./uuid.util-DUuuAgdg.js";
5
+ import { N as h, u as M, _ as O, a as T, b as q, c as B, d as F, e as K } from "./CrmDetailHeaderBadge.vue_vue_type_script_setup_true_lang-kIUc1Vkb.js";
6
+ import { useI18n as R } from "vue-i18n";
7
+ import { useKeysetInfiniteQuery as N, useMutation as j } from "@wisemen/vue-core-api-utils";
8
+ import { _ as z } from "./ActivityList.vue_vue_type_script_setup_true_lang-CropNbOA.js";
9
+ import { useOverlay as G } from "@wisemen/vue-core-design-system";
10
+ function H(a) {
11
+ return N("individualActivityIndex", {
12
+ queryFn: (t) => C.getActivity(a.value, t.key)
13
+ });
14
+ }
15
+ const J = /* @__PURE__ */ _({
16
+ __name: "IndividualDetailSidebarActivityContent",
17
+ props: {
18
+ individual: {}
19
+ },
20
+ setup(a) {
21
+ const t = a, u = c(() => t.individual.uuid), i = H(u), d = c(() => i.result.value.isOk() ? i.result.value.getValue().data : []);
22
+ async function r() {
23
+ await i.fetchNextPage();
24
+ }
25
+ return (e, o) => (n(), s(z, {
26
+ "on-next": r,
27
+ "is-loading": l(i).isLoading.value,
28
+ activities: d.value
29
+ }, null, 8, ["is-loading", "activities"]));
30
+ }
31
+ });
32
+ function W() {
33
+ return j({
34
+ queryFn: async ({
35
+ body: a,
36
+ params: t
37
+ }) => await h.create(a, {
38
+ individualUuid: t.individualUuid
39
+ }),
40
+ queryKeysToInvalidate: {
41
+ noteIndividualIndex: {}
42
+ }
43
+ });
44
+ }
45
+ function X(a, t) {
46
+ return N("noteIndividualIndex", {
47
+ params: {
48
+ params: t?.params
49
+ },
50
+ queryFn: (u) => h.getIndividualNotes({
51
+ pagination: u
52
+ }, a.value)
53
+ });
54
+ }
55
+ const Y = /* @__PURE__ */ _({
56
+ __name: "IndividualDetailSidebarNotesContent",
57
+ props: {
58
+ individual: {}
59
+ },
60
+ setup(a) {
61
+ const t = a, u = V(), i = W(), d = M(), e = G().create(O), o = X(
62
+ c(() => t.individual.uuid)
63
+ ), g = c(() => o.result.value.isOk() ? o.result.value.getValue().data : []);
64
+ async function b(v) {
65
+ try {
66
+ await i.execute({
67
+ body: v,
68
+ params: {
69
+ individualUuid: t.individual.uuid
70
+ }
71
+ });
72
+ } catch (m) {
73
+ u.show(m);
74
+ }
75
+ }
76
+ async function p(v) {
77
+ try {
78
+ await d.execute({
79
+ params: {
80
+ noteUuid: v
81
+ }
82
+ });
83
+ } catch (m) {
84
+ u.show(m);
85
+ }
86
+ }
87
+ function k(v) {
88
+ e.open({
89
+ note: v
90
+ });
91
+ }
92
+ return (v, m) => (n(), s(T, {
93
+ "is-loading": l(o).isLoading.value,
94
+ notes: g.value,
95
+ "on-submit": b,
96
+ "has-next-page": l(o).hasNextPage.value,
97
+ onNext: m[0] || (m[0] = (ee) => l(o).fetchNextPage()),
98
+ onDelete: p,
99
+ onUpdate: k
100
+ }, null, 8, ["is-loading", "notes", "has-next-page"]));
101
+ }
102
+ }), Z = /* @__PURE__ */ _({
103
+ __name: "IndividualActivityNotesPane",
104
+ props: {
105
+ individual: {}
106
+ },
107
+ setup(a) {
108
+ const t = a, u = R(), i = D(
109
+ "activity"
110
+ /* ACTIVITY */
111
+ ), d = c(() => [
112
+ {
113
+ icon: L,
114
+ label: u.t("wise_crm.shared.activity"),
115
+ value: "activity"
116
+ /* ACTIVITY */
117
+ },
118
+ {
119
+ icon: Q,
120
+ label: u.t("wise_crm.shared.notes"),
121
+ value: "notes"
122
+ /* NOTES */
123
+ }
124
+ ]);
125
+ return (r, e) => (n(), s(q, {
126
+ modelValue: i.value,
127
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => i.value = o),
128
+ tabs: d.value
129
+ }, {
130
+ default: y(() => [
131
+ i.value === "activity" ? (n(), s(J, {
132
+ key: 0,
133
+ individual: t.individual
134
+ }, null, 8, ["individual"])) : f("", !0),
135
+ i.value === "notes" ? (n(), s(Y, {
136
+ key: 1,
137
+ individual: t.individual
138
+ }, null, 8, ["individual"])) : f("", !0)
139
+ ]),
140
+ _: 1
141
+ }, 8, ["modelValue", "tabs"]));
142
+ }
143
+ }), re = /* @__PURE__ */ _({
144
+ __name: "IndividualDetailView",
145
+ props: {
146
+ tabs: {}
147
+ },
148
+ setup(a) {
149
+ const t = a, u = P(), i = S(), d = w("individualUuid"), r = E(
150
+ c(() => d.value)
151
+ ), e = c(() => r.result.value.isOk() ? r.result.value.getValue() : null), o = c(
152
+ () => i.getOptions().individual?.headerBadges ?? []
153
+ );
154
+ return (g, b) => (n(), s(B, {
155
+ key: l(d),
156
+ tabs: t.tabs,
157
+ "entity-type": l(I).INDIVIDUAL,
158
+ "created-at": e.value?.createdAt ?? null,
159
+ "last-activity-at": e.value?.updatedAt ?? null
160
+ }, {
161
+ header: y(() => [
162
+ l(r).isLoading.value ? (n(), s(x, {
163
+ key: 0,
164
+ class: "h-24 w-full"
165
+ })) : e.value ? (n(), s(F, {
166
+ key: 1,
167
+ "entity-type": l(I).INDIVIDUAL,
168
+ "entity-label": l(u).getEntityConfig(l(I).INDIVIDUAL)?.name ?? null,
169
+ name: `${e.value.firstName} ${e.value.lastName}`,
170
+ identifier: null,
171
+ status: null,
172
+ owner: null,
173
+ "created-at": e.value.createdAt,
174
+ address: e.value.address,
175
+ email: e.value.email,
176
+ "mobile-phone": e.value.mobilePhone,
177
+ phone: e.value.phone
178
+ }, {
179
+ badges: y(() => [
180
+ (n(!0), A(U, null, $(o.value, (p) => (n(), s(K, {
181
+ key: p.key,
182
+ badge: p,
183
+ uuid: e.value.uuid,
184
+ entity: "individual"
185
+ }, null, 8, ["badge", "uuid"]))), 128))
186
+ ]),
187
+ _: 1
188
+ }, 8, ["entity-type", "entity-label", "name", "created-at", "address", "email", "mobile-phone", "phone"])) : f("", !0)
189
+ ]),
190
+ sidebar: y(() => [
191
+ l(r).isLoading.value ? (n(), s(x, {
192
+ key: 0,
193
+ class: "h-full"
194
+ })) : e.value ? (n(), s(Z, {
195
+ key: 1,
196
+ individual: e.value
197
+ }, null, 8, ["individual"])) : f("", !0)
198
+ ]),
199
+ _: 1
200
+ }, 8, ["tabs", "entity-type", "created-at", "last-activity-at"]));
201
+ }
202
+ });
203
+ export {
204
+ re as default
205
+ };