@feedmepos/mf-report 5.3.15-rc.9 → 5.4.0-beta.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,30 @@
1
+ import { defineComponent as n, resolveComponent as r, openBlock as c, createElementBlock as i, renderSlot as p, createVNode as f, withCtx as m, createElementVNode as t, toDisplayString as o } from "vue";
2
+ const d = { class: "flex flex-col h-full" }, _ = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, u = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary text-center" }, h = /* @__PURE__ */ n({
3
+ __name: "NoData",
4
+ props: {
5
+ title: { default: "No data available" },
6
+ subTitle: { default: "Adjust filters or select a different time range." }
7
+ },
8
+ setup(l) {
9
+ const e = l;
10
+ return (s, y) => {
11
+ const a = r("FmCard");
12
+ return c(), i("div", d, [
13
+ p(s.$slots, "menu"),
14
+ f(a, {
15
+ class: "p-24 h-full flex flex-col gap-2 p-16 items-center justify-center",
16
+ variant: "flat"
17
+ }, {
18
+ default: m(() => [
19
+ t("p", _, o(e.title), 1),
20
+ t("p", u, o(e.subTitle), 1)
21
+ ]),
22
+ _: 1
23
+ })
24
+ ]);
25
+ };
26
+ }
27
+ });
28
+ export {
29
+ h as _
30
+ };
@@ -0,0 +1,78 @@
1
+ import { defineComponent as k, computed as y, resolveComponent as v, openBlock as t, createBlock as r, withCtx as p, createElementVNode as u, createVNode as i, toDisplayString as $, unref as e, createElementBlock as a, normalizeClass as x, normalizeStyle as C, Fragment as h, renderList as B, createCommentVNode as b } from "vue";
2
+ import { _ as D } from "./HeaderTab.vue_vue_type_script_setup_true_lang-pwHzeuLE.js";
3
+ import { _ as F } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-WNX1hHIm.js";
4
+ import { _ as S } from "./Default.vue_vue_type_script_setup_true_lang-U8MvQ-Uz.js";
5
+ import { u as V } from "./app-eKZV2PPB.js";
6
+ import { storeToRefs as N } from "pinia";
7
+ import { _ as R } from "./NoData.vue_vue_type_script_setup_true_lang-FeKqFs4A.js";
8
+ import { useBreakpoints as z } from "@feedmepos/ui-library";
9
+ import { _ as E } from "./MenuTab.vue_vue_type_script_setup_true_lang-GRUzIsKG.js";
10
+ const L = { class: "h-full w-full overflow-x-auto relative" }, M = { class: "fm-typo-en-title-md-600" }, O = {
11
+ key: 0,
12
+ class: "flex gap-2"
13
+ }, j = {
14
+ key: 0,
15
+ class: "flex w-full justify-end px-2"
16
+ }, W = /* @__PURE__ */ k({
17
+ __name: "OverviewView",
18
+ setup(T) {
19
+ const w = V(), { breakpoints: o } = z(), { isOpenDownloadDialog: d, overviewReport: l } = N(w), c = y(() => {
20
+ var m;
21
+ return ((m = l.value) == null ? void 0 : m.tiles) || [];
22
+ });
23
+ return (m, s) => {
24
+ const _ = v("FmButton"), g = v("FmMenu");
25
+ return t(), r(S, null, {
26
+ default: p(() => [
27
+ u("div", L, [
28
+ i(D, null, {
29
+ title: p(() => {
30
+ var n;
31
+ return [
32
+ u("p", M, $((n = e(l)) == null ? void 0 : n.name), 1)
33
+ ];
34
+ }),
35
+ button: p(() => [
36
+ e(o).lg || e(o).md ? (t(), a("div", O, [
37
+ i(_, {
38
+ label: "Download",
39
+ "prepend-icon": "download",
40
+ onClick: s[0] || (s[0] = (n) => d.value = !0)
41
+ })
42
+ ])) : (t(), r(g, { key: 1 }))
43
+ ]),
44
+ _: 1
45
+ }),
46
+ u("div", {
47
+ class: x(`overflow-y-auto ${e(o).sm || e(o).xs ? "pb-2" : ""}`),
48
+ style: C({ height: `calc(100% - ${e(o).lg || e(o).md ? 72 : 64}px)` })
49
+ }, [
50
+ i(E),
51
+ c.value.length > 0 && e(l) ? (t(), a("div", {
52
+ key: 0,
53
+ class: x(["grid grid-cols-12", e(o).sm || e(o).xs ? "px-3 gap-[16px]" : "px-24 gap-[24px]"])
54
+ }, [
55
+ (t(!0), a(h, null, B(c.value, (n, f) => (t(), r(F, {
56
+ key: `widget_${e(l).id}_${f}`,
57
+ "model-value": n,
58
+ index: f
59
+ }, null, 8, ["model-value", "index"]))), 128))
60
+ ], 2)) : (t(), r(R, { key: 1 }))
61
+ ], 6),
62
+ e(o).sm || e(o).xs ? (t(), a("div", j, [
63
+ i(_, {
64
+ label: "Download",
65
+ "prepend-icon": "download",
66
+ onClick: s[1] || (s[1] = (n) => d.value = !0)
67
+ })
68
+ ])) : b("", !0)
69
+ ])
70
+ ]),
71
+ _: 1
72
+ });
73
+ };
74
+ }
75
+ });
76
+ export {
77
+ W as default
78
+ };
@@ -0,0 +1,402 @@
1
+ import { defineComponent as oe, ref as P, watch as W, computed as k, resolveComponent as h, openBlock as S, createBlock as T, withCtx as i, createElementVNode as d, createVNode as n, withDirectives as w, unref as t, withModifiers as U, vShow as $, normalizeClass as C, normalizeStyle as ae, toDisplayString as B, createElementBlock as se, Fragment as ne, renderList as re, createTextVNode as ie, h as f } from "vue";
2
+ import { storeToRefs as X } from "pinia";
3
+ import { u as ce, a as ue, b as de, c as me } from "./app-eKZV2PPB.js";
4
+ import { _ as pe } from "./Default.vue_vue_type_script_setup_true_lang-U8MvQ-Uz.js";
5
+ import { _ as fe } from "./HeaderTab.vue_vue_type_script_setup_true_lang-pwHzeuLE.js";
6
+ import { useSnackbar as ve, useBreakpoints as be, components as ye, FmButtonColorThemeVariant as ge } from "@feedmepos/ui-library";
7
+ import { _ as xe } from "./NoData.vue_vue_type_script_setup_true_lang-FeKqFs4A.js";
8
+ import { useRouter as Ce, useRoute as _e, onBeforeRouteLeave as ke } from "vue-router";
9
+ const he = { class: "h-full w-full overflow-x-auto relative" }, we = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $e = { class: "w-[343px]" }, Ie = { class: "fm-typo-en-body-md-600" }, Re = { class: "flex w-full justify-end px-2" }, Te = /* @__PURE__ */ oe({
10
+ __name: "Report",
11
+ setup(Fe) {
12
+ const A = Ce(), M = _e(), m = ce(), { business: Z } = X(ue()), { reports: p, categories: I, pinReport: R, isOpenAddReportDialog: j, scrollPositionY: q } = X(m), { promptMessage: J } = de(), { promptLoader: K } = me(), b = ve(), { breakpoints: s } = be(), y = P();
13
+ ke(() => {
14
+ y.value && (q.value = y.value.$el.children[0].scrollTop);
15
+ }), W(y, () => {
16
+ y.value && setTimeout(() => {
17
+ y.value.$el.children[0].scrollTop = q.value;
18
+ }, 100);
19
+ });
20
+ const L = k(() => R.value && p.value ? p.value.filter((l) => {
21
+ var e;
22
+ return (e = R.value) == null ? void 0 : e.includes(l.id);
23
+ }) : []);
24
+ W(
25
+ [() => Z.value],
26
+ () => {
27
+ m.refreshPinReport();
28
+ },
29
+ { immediate: !0 }
30
+ );
31
+ const E = k(() => L.value.length > 0 ? p.value.filter(
32
+ (l) => L.value.findIndex((e) => e.id === l.id) === -1
33
+ ) : p.value), { FmButton: D, FmMenu: V, FmMenuItem: _, FmIcon: N, FmChip: z } = ye, G = k(() => [
34
+ { value: void 0, label: "All" },
35
+ ...I.value.map((l) => ({ value: l.id, label: l.name }))
36
+ ]), v = P(G.value[0]), F = P(""), g = k(() => E.value.length === 0 || I.value.length === 0 ? [] : [
37
+ ...L.value.map((e) => {
38
+ const o = I.value.find((r) => r.id === e.category);
39
+ return {
40
+ name: e.name,
41
+ categoryId: (o == null ? void 0 : o.id) ?? "",
42
+ category: (o == null ? void 0 : o.name) || "Uncategorized",
43
+ reportId: e.id,
44
+ editable: e.editable,
45
+ pin: !0
46
+ };
47
+ }).filter((e) => v.value.value && e.categoryId !== v.value.value ? !1 : e.name.toLowerCase().indexOf(F.value.toLowerCase()) !== -1),
48
+ ...E.value.map((e) => {
49
+ const o = I.value.find((r) => r.id === e.category);
50
+ return {
51
+ name: e.name,
52
+ categoryId: (o == null ? void 0 : o.id) ?? "",
53
+ category: (o == null ? void 0 : o.name) || "Uncategorized",
54
+ reportId: e.id,
55
+ editable: e.editable,
56
+ pin: !1
57
+ };
58
+ }).filter((e) => v.value.value && e.categoryId !== v.value.value ? !1 : e.name.toLowerCase().indexOf(F.value.toLowerCase()) !== -1)
59
+ ]), ee = k(
60
+ () => g.value.map((l) => `${l.name}${l.category}`).toString()
61
+ ), te = [
62
+ {
63
+ accessorKey: "name",
64
+ header: "Name",
65
+ enableSorting: !1,
66
+ cell: (l) => l.getValue()
67
+ },
68
+ {
69
+ accessorKey: "category",
70
+ header: "Category",
71
+ enableSorting: !1,
72
+ meta: {
73
+ width: "200px"
74
+ },
75
+ cell: (l) => f(
76
+ z,
77
+ {
78
+ class: `${l.getValue() !== "Uncategorized" ? "bg-fm-color-system-info-100 text-fm-color-typo-info" : "text-fm-color-typo-secondary"} fm-typo-en-body-sm-600`,
79
+ compact: !0
80
+ },
81
+ { default: () => l.getValue() }
82
+ )
83
+ },
84
+ {
85
+ accessorKey: "",
86
+ id: "Action",
87
+ header: "",
88
+ meta: {
89
+ width: "100px"
90
+ },
91
+ cell: (l) => {
92
+ const e = l.row.original, o = e.reportId, r = p.value.find((c) => c.id === o), O = [
93
+ {
94
+ label: "Duplicate",
95
+ onClick: () => {
96
+ r && Y(r);
97
+ },
98
+ variant: "",
99
+ disabled: !1
100
+ },
101
+ {
102
+ label: "Remove",
103
+ onClick: () => {
104
+ r && H(r);
105
+ },
106
+ variant: "destructive",
107
+ disabled: !e.editable
108
+ }
109
+ ];
110
+ return f(
111
+ "div",
112
+ {
113
+ class: `flex ${s.value.lg || s.value.md ? "justify-end" : ""} items-center`
114
+ },
115
+ {
116
+ default: () => [
117
+ f(
118
+ "button",
119
+ {
120
+ onClick: U(() => {
121
+ r && Q(r);
122
+ }, ["stop"]),
123
+ class: `text-fm-color-neutral-gray-400 ${e.pin ? "" : "show-pin"} hover:bg-fm-color-opacity-sm rounded-lg flex items-center justify-center`
124
+ },
125
+ {
126
+ default: () => [
127
+ f(
128
+ N,
129
+ {
130
+ name: "keep",
131
+ class: "px-12 p-8",
132
+ outline: !e.pin,
133
+ size: "md"
134
+ },
135
+ {}
136
+ )
137
+ ]
138
+ }
139
+ ),
140
+ f(
141
+ V,
142
+ { stopClickPropagation: !0 },
143
+ {
144
+ default: () => O.map(
145
+ (c) => f(
146
+ _,
147
+ {
148
+ onClick: c.disabled ? {} : c.onClick,
149
+ label: c.label,
150
+ class: c.disabled ? "text-fm-color-typo-disabled" : c.variant === "destructive" ? "text-fm-color-typo-error" : "",
151
+ disabled: c.disabled
152
+ },
153
+ {
154
+ label: () => f("p", c.label)
155
+ }
156
+ )
157
+ ),
158
+ "menu-button": () => f(
159
+ D,
160
+ {
161
+ variant: "tertiary",
162
+ size: "md",
163
+ icon: "more_vert",
164
+ iconColor: ge.NeutralGray400
165
+ },
166
+ {}
167
+ )
168
+ }
169
+ )
170
+ ]
171
+ }
172
+ );
173
+ }
174
+ }
175
+ ];
176
+ async function Y(l) {
177
+ if (await J({
178
+ title: "Duplicate report",
179
+ message: `Confirm duplicate ${l.name} ?`
180
+ })) {
181
+ const o = JSON.parse(JSON.stringify(l));
182
+ o.editable = !0, o.id = "", o.name = `${o.name} duplicate`, K(async () => {
183
+ try {
184
+ await m.createOrUpdateReport(o), b.open({ message: `Duplicate ${o.name} successful`, type: "success" });
185
+ } catch (r) {
186
+ b.open({ message: JSON.stringify(r), type: "error" });
187
+ }
188
+ });
189
+ }
190
+ }
191
+ async function H(l) {
192
+ await J({
193
+ title: "Delete report",
194
+ message: `Confirm delete ${l.name} ?`
195
+ }) && K(async () => {
196
+ try {
197
+ await m.removeReport(l), b.open({ message: `Delete ${l.name} successful`, type: "success" });
198
+ } catch (o) {
199
+ b.open({ message: JSON.stringify(o), type: "error" });
200
+ }
201
+ });
202
+ }
203
+ function Q(l) {
204
+ R.value && R.value.includes(l.id) ? (b.open({ message: `Unpin ${l.name} successful`, type: "success" }), m.clearPinReport(l.id)) : (b.open({ message: `Pin ${l.name} successful`, type: "success" }), m.cachePinReport(l));
205
+ }
206
+ return (l, e) => {
207
+ const o = h("FmSearch"), r = h("FmForm"), O = h("FmListItem"), c = h("FmList"), le = h("FmTable");
208
+ return S(), T(pe, null, {
209
+ default: i(() => [
210
+ d("div", he, [
211
+ n(fe, null, {
212
+ title: i(() => e[4] || (e[4] = [
213
+ d("p", { class: "fm-typo-en-title-md-600" }, "Reports", -1)
214
+ ])),
215
+ button: i(() => [
216
+ w(n(t(D), {
217
+ label: "Add report",
218
+ icon: "add",
219
+ onClick: e[0] || (e[0] = U((a) => j.value = !0, ["stop"]))
220
+ }, null, 512), [
221
+ [$, t(s).lg || t(s).md]
222
+ ])
223
+ ]),
224
+ _: 1
225
+ }),
226
+ d("div", {
227
+ class: C(`overflow-y-hidden flex flex-col gap-8 ${t(s).sm || t(s).xs ? "pb-2" : ""}`),
228
+ style: ae({ height: `calc(100% - ${t(s).lg || t(s).md ? 72 : 64}px)` })
229
+ }, [
230
+ n(r, {
231
+ class: C(`flex items-center gap-2 ${t(s).sm || t(s).xs ? "px-3" : "px-24"}`)
232
+ }, {
233
+ default: i(() => [
234
+ n(t(V), null, {
235
+ "menu-button": i(() => [
236
+ n(t(z), {
237
+ label: v.value.label,
238
+ class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400"
239
+ }, {
240
+ default: i(() => [
241
+ d("p", null, B(v.value.label), 1),
242
+ n(t(N), { name: "expand_more" })
243
+ ]),
244
+ _: 1
245
+ }, 8, ["label"])
246
+ ]),
247
+ default: i(() => [
248
+ (S(!0), se(ne, null, re(G.value, (a, u) => (S(), T(t(_), {
249
+ key: u,
250
+ label: a.label,
251
+ onClick: (x) => v.value = a
252
+ }, null, 8, ["label", "onClick"]))), 128))
253
+ ]),
254
+ _: 1
255
+ }),
256
+ d("div", {
257
+ class: C(`flex ${t(s).sm || t(s).xs ? "justify-center items-center" : ""}`)
258
+ }, [
259
+ d("p", we, B(g.value.length) + " results ", 1)
260
+ ], 2),
261
+ e[5] || (e[5] = d("div", { class: "grow" }, null, -1)),
262
+ d("div", $e, [
263
+ n(o, {
264
+ modelValue: F.value,
265
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => F.value = a),
266
+ class: C(`${t(s).lg || t(s).md ? "grow" : ""}`)
267
+ }, null, 8, ["modelValue", "class"])
268
+ ])
269
+ ]),
270
+ _: 1
271
+ }, 8, ["class"]),
272
+ w((S(), T(le, {
273
+ key: ee.value,
274
+ ref_key: "table",
275
+ ref: y,
276
+ class: C([t(s).sm || t(s).xs ? "px-0" : "px-24", "report-table"]),
277
+ style: { height: "calc(100% - 40px)" },
278
+ "column-defs": te,
279
+ "row-data": g.value,
280
+ "page-size": g.value.length,
281
+ "hide-footer": !0,
282
+ "row-class-name": "row",
283
+ onRowClick: e[2] || (e[2] = (a) => {
284
+ t(m).updateCurrentReportId(a.original.reportId), t(A).push({
285
+ name: "reportView",
286
+ query: t(M).query
287
+ });
288
+ })
289
+ }, {
290
+ "list-row": i(({ original: a }) => [
291
+ n(c, {
292
+ onClick: () => {
293
+ a.reportId && (t(m).updateCurrentReportId(a.reportId), t(A).push({
294
+ name: "reportView",
295
+ query: t(M).query
296
+ }));
297
+ }
298
+ }, {
299
+ default: i(() => [
300
+ n(O, {
301
+ tag: "label",
302
+ label: a.name,
303
+ clickable: ""
304
+ }, {
305
+ append: i(() => [
306
+ n(t(z), {
307
+ class: C(
308
+ a.category !== "Uncategorized" ? "bg-fm-color-system-info-100 text-fm-color-typo-info" : "text-fm-color-typo-secondary"
309
+ ),
310
+ compact: !0
311
+ }, {
312
+ default: i(() => [
313
+ d("p", Ie, B(a.category), 1)
314
+ ]),
315
+ _: 2
316
+ }, 1032, ["class"]),
317
+ n(t(V), {
318
+ placement: "left",
319
+ "stop-click-propagation": !0
320
+ }, {
321
+ "menu-button": i(() => [
322
+ n(t(N), {
323
+ name: "more_vert",
324
+ class: "btn-color"
325
+ })
326
+ ]),
327
+ default: i(() => [
328
+ n(t(_), {
329
+ label: a.pin ? "Unpin" : "Pin",
330
+ onClick: () => {
331
+ const u = t(p).find(
332
+ (x) => x.id === a.reportId
333
+ );
334
+ u && Q(u);
335
+ }
336
+ }, null, 8, ["label", "onClick"]),
337
+ n(t(_), {
338
+ label: "Duplicate",
339
+ onClick: () => {
340
+ const u = t(p).find(
341
+ (x) => x.id === a.reportId
342
+ );
343
+ u && Y(u);
344
+ }
345
+ }, null, 8, ["onClick"]),
346
+ w(n(t(_), {
347
+ label: "Delete",
348
+ class: "text-fm-color-typo-error",
349
+ onClick: () => {
350
+ const u = t(p).find(
351
+ (x) => x.id === a.reportId
352
+ );
353
+ u && H(u);
354
+ }
355
+ }, {
356
+ label: i(() => e[6] || (e[6] = [
357
+ ie(" Delete ")
358
+ ])),
359
+ _: 2
360
+ }, 1032, ["onClick"]), [
361
+ [$, a.editable]
362
+ ])
363
+ ]),
364
+ _: 2
365
+ }, 1024)
366
+ ]),
367
+ _: 2
368
+ }, 1032, ["label"])
369
+ ]),
370
+ _: 2
371
+ }, 1032, ["onClick"])
372
+ ]),
373
+ _: 1
374
+ }, 8, ["class", "row-data", "page-size"])), [
375
+ [$, g.value.length > 0]
376
+ ]),
377
+ w(n(xe, {
378
+ title: "No report",
379
+ "sub-title": "No report can be found"
380
+ }, null, 512), [
381
+ [$, g.value.length === 0]
382
+ ])
383
+ ], 6),
384
+ w(d("div", Re, [
385
+ n(t(D), {
386
+ label: "Add report",
387
+ icon: "add",
388
+ onClick: e[3] || (e[3] = U((a) => j.value = !0, ["stop"]))
389
+ })
390
+ ], 512), [
391
+ [$, t(s).sm || t(s).xs]
392
+ ])
393
+ ])
394
+ ]),
395
+ _: 1
396
+ });
397
+ };
398
+ }
399
+ });
400
+ export {
401
+ Te as default
402
+ };