@feedmepos/mf-report 5.4.15-beta.1 → 5.4.15-beta.3

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 (45) hide show
  1. package/dist/App-DufL3Y8h.js +152 -0
  2. package/dist/DateRangeSelect.vue_vue_type_script_setup_true_lang-DLDk5l4R.js +162 -0
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-Bxuyjrkr.js → Default.vue_vue_type_script_setup_true_lang-DVLxkOOQ.js} +2 -2
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-C29g9w6o.js +999 -0
  5. package/dist/{InsightView-D78TK2E8.js → InsightView-tyeJBlRm.js} +1051 -1049
  6. package/dist/Integration-ILSIf-OL.js +3695 -0
  7. package/dist/Integrations-DwgNrM3U.js +334 -0
  8. package/dist/{Layout-DERpCrQk.js → Layout-Bw1oh6Q-.js} +1 -1
  9. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-DurYBXa5.js → LocationSelect.vue_vue_type_script_setup_true_lang-BFj4d-UF.js} +1861 -1859
  10. package/dist/MenuTab.vue_vue_type_script_setup_true_lang-DzZeasAK.js +277 -0
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-C8yzWDXs.js → NavigationTab.vue_vue_type_script_setup_true_lang-_eC_tMk_.js} +5526 -5482
  12. package/dist/NoData.vue_vue_type_script_setup_true_lang-BtQobm-7.js +31 -0
  13. package/dist/OverviewView-Dl8oOobn.js +61 -0
  14. package/dist/Report-BqD8KVZ8.js +424 -0
  15. package/dist/ReportEditor-DkzFUgbO.js +532 -0
  16. package/dist/ReportView-DpWZHV0o.js +169 -0
  17. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-C3VG1mi_.js +104 -0
  18. package/dist/Setting-CYrg_50p.js +320 -0
  19. package/dist/TileEditor-CDrzLbqc.js +2320 -0
  20. package/dist/{TransitionFade-BLDfpF7R.js → TransitionFade-D19wC3tb.js} +225 -220
  21. package/dist/app.js +915 -27
  22. package/dist/{global-loader-CMC9fgBi.js → global-loader-C3JC7z-H.js} +4966 -2240
  23. package/dist/index-9IDzTnHw.js +147 -0
  24. package/dist/{report-schema-G0x3CoJb.js → report-schema-1zQJbLyB.js} +4 -4
  25. package/dist/style.css +1 -1
  26. package/dist/timeFormat-CjNvJMgk.js +9 -0
  27. package/dist/{v4-DF7wffYN.js → v4-D29FkHfi.js} +2666 -1927
  28. package/package.json +1 -1
  29. package/dist/App-mcSgbcVY.js +0 -133
  30. package/dist/DateRangeSelect.vue_vue_type_script_setup_true_lang-DPuhMR6i.js +0 -160
  31. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-B6IzlHmr.js +0 -996
  32. package/dist/HeaderTab.vue_vue_type_script_setup_true_lang-B5VBDNwX.js +0 -19
  33. package/dist/Integration-Cm6_YEEE.js +0 -3554
  34. package/dist/Integrations-WWnSho0Q.js +0 -334
  35. package/dist/MenuTab.vue_vue_type_script_setup_true_lang-h87kWy1E.js +0 -261
  36. package/dist/NoData.vue_vue_type_script_setup_true_lang-DlBNFLa3.js +0 -30
  37. package/dist/OverviewView-D7zAR7_7.js +0 -60
  38. package/dist/Report-BnX5amn0.js +0 -409
  39. package/dist/ReportEditor-DW7uWg_a.js +0 -530
  40. package/dist/ReportView-xSaJA5F6.js +0 -166
  41. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-DBI9op0g.js +0 -103
  42. package/dist/Setting-D8JspXTN.js +0 -326
  43. package/dist/TileEditor-DQ8C5I_M.js +0 -2301
  44. package/dist/index-SmIkb24L.js +0 -143
  45. package/dist/timeFormat-BF-F4Rnt.js +0 -9
@@ -1,530 +0,0 @@
1
- import { defineComponent as $, mergeModels as w, useModel as R, ref as N, computed as U, resolveComponent as m, createBlock as y, openBlock as r, withCtx as u, createElementVNode as _, createVNode as t, normalizeClass as D, unref as l, createTextVNode as pe, createElementBlock as F, Fragment as B, renderSlot as A, createCommentVNode as O, watch as ce, resolveDynamicComponent as G, isRef as Y, toDisplayString as L, renderList as z, onMounted as fe, normalizeStyle as ve } from "vue";
2
- import { W as ge, i as _e, S as ye, d as Ce, T as be, _ as Ve } from "./TransitionFade-BLDfpF7R.js";
3
- import { a as j, v as K } from "./v4-DF7wffYN.js";
4
- import { _ as ke } from "./HeaderTab.vue_vue_type_script_setup_true_lang-B5VBDNwX.js";
5
- import { storeToRefs as Q } from "pinia";
6
- import { useRouter as X, useRoute as Z } from "vue-router";
7
- import { useBreakpoints as I, FmButtonColorThemeVariant as q, useSnackbar as Fe } from "@feedmepos/ui-library";
8
- import { u as ee } from "./message-dialog-UoMWOnil.js";
9
- import { _ as oe } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-B6IzlHmr.js";
10
- import { _ as te } from "./NoData.vue_vue_type_script_setup_true_lang-DlBNFLa3.js";
11
- import { d as xe } from "./global-loader-CMC9fgBi.js";
12
- const we = /* @__PURE__ */ $({
13
- __name: "WidgetDialog",
14
- props: /* @__PURE__ */ w({
15
- isOpen: { type: Boolean }
16
- }, {
17
- modelValue: {},
18
- modelModifiers: {}
19
- }),
20
- emits: /* @__PURE__ */ w(["isOpen"], ["update:modelValue"]),
21
- setup(c, { emit: n }) {
22
- const { breakpoints: o } = I(), a = R(c, "modelValue"), s = c, C = n;
23
- function e() {
24
- C("isOpen", !1);
25
- }
26
- function f() {
27
- v.value && (a.value = v.value, v.value = void 0, C("isOpen", !1));
28
- }
29
- const v = N(), i = U(() => !v.value);
30
- return (k, b) => {
31
- const h = m("FmButton"), M = m("FmDialog");
32
- return r(), y(M, {
33
- "model-value": s.isOpen
34
- }, {
35
- "dialog-header": u(() => b[1] || (b[1] = [
36
- pe("Widget Type")
37
- ])),
38
- default: u(() => [
39
- t(ge, {
40
- modelValue: v.value,
41
- "onUpdate:modelValue": b[0] || (b[0] = (S) => v.value = S),
42
- class: D(`grid ${l(o).lg || l(o).md ? "grid-cols-3 gap-3" : "grid-cols-2 gap-3"}`),
43
- "child-class": "p-[8px] flex flex-col"
44
- }, null, 8, ["modelValue", "class"])
45
- ]),
46
- "dialog-footer": u(() => [
47
- b[2] || (b[2] = _("div", { class: "grow" }, null, -1)),
48
- t(h, {
49
- label: "Cancel",
50
- variant: "tertiary",
51
- onClick: e
52
- }),
53
- t(h, {
54
- label: "Confirm",
55
- disabled: i.value,
56
- onClick: f
57
- }, null, 8, ["disabled"])
58
- ]),
59
- _: 1
60
- }, 8, ["model-value"]);
61
- };
62
- }
63
- }), P = /* @__PURE__ */ $({
64
- __name: "ReportEditorTabHeader",
65
- props: /* @__PURE__ */ w({
66
- icon: {
67
- type: String,
68
- required: !0
69
- }
70
- }, {
71
- modelValue: { type: Boolean, required: !0, default: !1 },
72
- modelModifiers: {}
73
- }),
74
- emits: ["update:modelValue"],
75
- setup(c) {
76
- const n = R(c, "modelValue"), o = c;
77
- return (a, s) => {
78
- const C = m("FmIcon");
79
- return r(), F("div", {
80
- class: "px-6 py-16 flex items-center gap-2 bg-fm-color-neutral-white border cursor-pointer",
81
- onClick: s[0] || (s[0] = (e) => n.value = !n.value)
82
- }, [
83
- s[1] || (s[1] = _("p", { class: "fm-typo-en-body-lg-600" }, "Customize report", -1)),
84
- s[2] || (s[2] = _("div", { class: "grow" }, null, -1)),
85
- t(C, {
86
- name: o.icon
87
- }, null, 8, ["name"])
88
- ]);
89
- };
90
- }
91
- }), he = /* @__PURE__ */ $({
92
- __name: "ReportEditorTabDesktop",
93
- props: {
94
- modelValue: { required: !0, default: !1 },
95
- modelModifiers: {}
96
- },
97
- emits: ["update:modelValue"],
98
- setup(c) {
99
- const n = R(c, "modelValue");
100
- return (o, a) => (r(), F(B, null, [
101
- t(P, {
102
- modelValue: n.value,
103
- "onUpdate:modelValue": a[0] || (a[0] = (s) => n.value = s),
104
- icon: "keyboard_double_arrow_left"
105
- }, null, 8, ["modelValue"]),
106
- A(o.$slots, "default")
107
- ], 64));
108
- }
109
- }), $e = /* @__PURE__ */ $({
110
- __name: "ReportEditorTabMobile",
111
- props: {
112
- modelValue: { required: !0, default: !1 },
113
- modelModifiers: {}
114
- },
115
- emits: ["update:modelValue"],
116
- setup(c) {
117
- const n = R(c, "modelValue");
118
- return (o, a) => {
119
- const s = m("FmTopSheet"), C = m("FmCard");
120
- return r(), y(C, { class: "fixed bottom-0 w-full" }, {
121
- default: u(() => [
122
- t(P, {
123
- modelValue: n.value,
124
- "onUpdate:modelValue": a[0] || (a[0] = (e) => n.value = e),
125
- icon: "keyboard_double_arrow_up"
126
- }, null, 8, ["modelValue"]),
127
- t(s, {
128
- modelValue: n.value,
129
- "onUpdate:modelValue": a[2] || (a[2] = (e) => n.value = e),
130
- "fullscreen-size": "sm"
131
- }, {
132
- default: u(() => [
133
- t(P, {
134
- modelValue: n.value,
135
- "onUpdate:modelValue": a[1] || (a[1] = (e) => n.value = e),
136
- icon: "keyboard_double_arrow_down"
137
- }, null, 8, ["modelValue"]),
138
- n.value ? A(o.$slots, "default", { key: 0 }) : O("", !0)
139
- ]),
140
- _: 3
141
- }, 8, ["modelValue"])
142
- ]),
143
- _: 3
144
- });
145
- };
146
- }
147
- }), Se = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Re = { class: "flex flex-col gap-24" }, Te = { class: "line-clamp-2 overflow-hidden" }, le = /* @__PURE__ */ $({
148
- __name: "ReportEditorTab",
149
- props: /* @__PURE__ */ w({
150
- hideConfiguration: {
151
- type: Boolean,
152
- default: !1
153
- }
154
- }, {
155
- modelValue: { required: !0 },
156
- modelModifiers: {}
157
- }),
158
- emits: /* @__PURE__ */ w(["hideConfiguration"], ["update:modelValue"]),
159
- setup(c, { emit: n }) {
160
- const o = R(c, "modelValue"), { breakpoints: a } = I(), s = c, C = n, e = X(), f = Z(), v = N(), { currentSelectWidgetType: i, categories: k, editingTile: b, editingIndex: h } = Q(j()), { promptMessage: M } = ee(), S = N(!1);
161
- ce(
162
- () => i.value,
163
- () => {
164
- i.value !== void 0 && (o.value.tiles.push(_e(i.value)), h.value = o.value.tiles.length - 1, b.value = o.value.tiles[o.value.tiles.length - 1], e.push({
165
- name: "tileEditor",
166
- query: f.query
167
- }));
168
- },
169
- { immediate: !0 }
170
- );
171
- const V = [
172
- {
173
- label: "Edit",
174
- selected: !1,
175
- variant: "tertiary",
176
- onClick: (d) => {
177
- h.value = d, b.value = JSON.parse(JSON.stringify(o.value.tiles[d])), e.push({
178
- name: "tileEditor",
179
- query: f.query
180
- });
181
- }
182
- },
183
- {
184
- label: "Duplicate",
185
- selected: !1,
186
- variant: "tertiary",
187
- onClick: (d) => {
188
- o.value.tiles.push(JSON.parse(JSON.stringify(o.value.tiles[d])));
189
- }
190
- },
191
- {
192
- label: "Remove",
193
- selected: !1,
194
- variant: "destructive",
195
- onClick: async (d) => {
196
- await M({
197
- title: "Delete widget",
198
- message: `Are You sure you want to delete ${o.value.tiles[d].widget.title}?`
199
- }) && (o.value.tiles = o.value.tiles.filter((T, E) => E !== d));
200
- }
201
- }
202
- ], x = U(() => k.value.map((d) => ({ label: d.name, value: d.id })));
203
- return (d, p) => {
204
- const T = m("FmTextField"), E = m("FmSelect"), H = m("FmButton"), ne = m("FmIcon"), ae = m("FmTooltip"), re = m("FmMenuItem"), ie = m("FmMenu"), ue = m("FmListItem"), se = m("FmList"), de = m("FmForm");
205
- return r(), y(G(l(a).lg || l(a).md ? he : $e), {
206
- "model-value": s.hideConfiguration,
207
- "onUpdate:modelValue": p[5] || (p[5] = (g) => C("hideConfiguration", g))
208
- }, {
209
- default: u(() => [
210
- t(we, {
211
- modelValue: l(i),
212
- "onUpdate:modelValue": p[0] || (p[0] = (g) => Y(i) ? i.value = g : null),
213
- "is-open": S.value,
214
- onIsOpen: p[1] || (p[1] = (g) => S.value = g)
215
- }, null, 8, ["modelValue", "is-open"]),
216
- t(de, {
217
- ref_key: "form",
218
- ref: v,
219
- class: "px-6 py-16 flex flex-col gap-24 overflow-y-auto overflow-x-hidden"
220
- }, {
221
- default: u(() => [
222
- t(ye, { class: "border-solid" }, {
223
- header: u(() => p[6] || (p[6] = [
224
- _("p", null, "Report infomation", -1),
225
- _("div", { class: "grow" }, null, -1)
226
- ])),
227
- content: u(() => [
228
- _("div", Se, [
229
- t(T, {
230
- modelValue: o.value.name,
231
- "onUpdate:modelValue": p[2] || (p[2] = (g) => o.value.name = g),
232
- label: "Report title",
233
- placeholder: "placeholder"
234
- }, null, 8, ["modelValue"]),
235
- t(E, {
236
- modelValue: o.value.category,
237
- "onUpdate:modelValue": p[3] || (p[3] = (g) => o.value.category = g),
238
- label: "Category",
239
- items: x.value
240
- }, null, 8, ["modelValue", "items"])
241
- ])
242
- ]),
243
- _: 1
244
- }),
245
- _("div", Re, [
246
- t(H, {
247
- label: "Add widget",
248
- variant: "secondary",
249
- icon: "add",
250
- "icon-position": "prepend",
251
- "border-color": l(q).ColorPrimary,
252
- "text-color": l(q).ColorPrimary,
253
- onClick: p[4] || (p[4] = (g) => S.value = !0)
254
- }, null, 8, ["border-color", "text-color"]),
255
- t(se, null, {
256
- default: u(() => [
257
- t(l(Ce), {
258
- list: o.value.tiles,
259
- "item-key": "id",
260
- class: "flex flex-col gap-2 cursor-grab",
261
- handle: ".handle"
262
- }, {
263
- item: u(({ element: g, index: W }) => [
264
- t(ue, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
265
- default: u(() => [
266
- t(ne, {
267
- name: "drag_handle",
268
- class: "handle"
269
- }),
270
- t(ae, {
271
- content: g.widget.title.length <= 0 ? `Widget ${W}` : g.widget.title,
272
- class: "handle"
273
- }, {
274
- default: u(() => [
275
- _("p", Te, L(g.widget.title.length <= 0 ? `Widget ${W}` : g.widget.title), 1)
276
- ]),
277
- _: 2
278
- }, 1032, ["content"]),
279
- p[7] || (p[7] = _("div", { class: "grow" }, null, -1)),
280
- t(ie, {
281
- trigger: "click",
282
- shift: !0,
283
- "stop-click-propagation": !0
284
- }, {
285
- "menu-button": u(() => [
286
- t(H, {
287
- "append-icon": "more_vert",
288
- variant: "tertiary"
289
- })
290
- ]),
291
- default: u(() => [
292
- (r(), F(B, null, z(V, (J, me) => t(re, {
293
- key: me,
294
- onClick: (Ee) => J.onClick(W)
295
- }, {
296
- label: u(() => [
297
- _("p", {
298
- class: D(
299
- J.variant === "destructive" ? " text-fm-color-system-error-300" : ""
300
- )
301
- }, L(J.label), 3)
302
- ]),
303
- _: 2
304
- }, 1032, ["onClick"])), 64))
305
- ]),
306
- _: 2
307
- }, 1024)
308
- ]),
309
- _: 2
310
- }, 1024)
311
- ]),
312
- _: 1
313
- }, 8, ["list"])
314
- ]),
315
- _: 1
316
- })
317
- ])
318
- ]),
319
- _: 1
320
- }, 512)
321
- ]),
322
- _: 1
323
- }, 8, ["model-value"]);
324
- };
325
- }
326
- }), Be = { class: "flex flex-col bg-fm-color-neutral-white w-[400px]" }, Me = { class: "flex bg-fm-color-neutral-white w-[88px]" }, Oe = { class: "w-full overflow-y-auto" }, qe = {
327
- key: 0,
328
- class: "w-full grid grid-cols-12 gap-[24px] p-24",
329
- style: { backgroundColor: "#F6F8FC" }
330
- }, Ne = /* @__PURE__ */ $({
331
- __name: "ReportEditorDesktop",
332
- props: /* @__PURE__ */ w({
333
- hideConfiguration: { type: Boolean, required: !0, default: !1 }
334
- }, {
335
- modelValue: { required: !0, default: () => {
336
- } },
337
- modelModifiers: {}
338
- }),
339
- emits: /* @__PURE__ */ w(["hideConfiguration"], ["update:modelValue"]),
340
- setup(c, { emit: n }) {
341
- const o = R(c, "modelValue"), a = c, s = n;
342
- return (C, e) => {
343
- const f = m("FmCircularProgress"), v = m("FmButton");
344
- return r(), F("div", null, [
345
- o.value ? (r(), F(B, { key: 1 }, [
346
- t(be, {
347
- "model-value": !a.hideConfiguration
348
- }, {
349
- right: u(() => [
350
- _("div", Be, [
351
- o.value ? (r(), y(le, {
352
- key: 0,
353
- modelValue: o.value,
354
- "onUpdate:modelValue": e[0] || (e[0] = (i) => o.value = i),
355
- "hide-configuration": a.hideConfiguration,
356
- onHideConfiguration: e[1] || (e[1] = (i) => {
357
- s("hideConfiguration", i);
358
- })
359
- }, null, 8, ["modelValue", "hide-configuration"])) : O("", !0)
360
- ])
361
- ]),
362
- left: u(() => [
363
- _("div", Me, [
364
- t(v, {
365
- variant: "secondary",
366
- icon: "keyboard_double_arrow_right",
367
- "border-color": l(q).ColorPrimary,
368
- "text-color": l(q).ColorPrimary,
369
- class: "m-24 my-16",
370
- size: "md",
371
- onClick: e[2] || (e[2] = (i) => s("hideConfiguration", !a.hideConfiguration))
372
- }, null, 8, ["border-color", "text-color"])
373
- ])
374
- ]),
375
- _: 1
376
- }, 8, ["model-value"]),
377
- _("div", Oe, [
378
- o.value.tiles.length > 0 ? (r(), F("div", qe, [
379
- (r(!0), F(B, null, z(o.value.tiles, (i, k) => (r(), y(oe, {
380
- key: `${l(K)()}_${k}`,
381
- "model-value": i,
382
- index: k,
383
- "hide-export": !0
384
- }, null, 8, ["model-value", "index"]))), 128))
385
- ])) : (r(), y(te, { key: 1 }))
386
- ])
387
- ], 64)) : (r(), y(f, { key: 0 }))
388
- ]);
389
- };
390
- }
391
- }), Ue = {
392
- key: 0,
393
- class: "grid grid-cols-12 gap-[16px]"
394
- }, De = /* @__PURE__ */ $({
395
- __name: "ReportEditorMobile",
396
- props: /* @__PURE__ */ w({
397
- hideConfiguration: { type: Boolean, required: !0, default: !1 }
398
- }, {
399
- modelValue: { required: !0, default: () => {
400
- } },
401
- modelModifiers: {}
402
- }),
403
- emits: /* @__PURE__ */ w(["hideConfiguration"], ["update:modelValue"]),
404
- setup(c, { emit: n }) {
405
- const o = R(c, "modelValue"), a = c, s = n;
406
- return (C, e) => {
407
- const f = m("FmCircularProgress"), v = m("FmCard");
408
- return r(), F("div", null, [
409
- o.value ? (r(), F(B, { key: 1 }, [
410
- t(v, { class: "px-5 pb-28" }, {
411
- default: u(() => [
412
- o.value.tiles.length > 0 ? (r(), F("div", Ue, [
413
- (r(!0), F(B, null, z(o.value.tiles, (i, k) => (r(), y(oe, {
414
- key: `${l(K)()}_${k}`,
415
- "model-value": i,
416
- index: k,
417
- "hide-export": !0
418
- }, null, 8, ["model-value", "index"]))), 128))
419
- ])) : (r(), y(te, { key: 1 }))
420
- ]),
421
- _: 1
422
- }),
423
- o.value ? (r(), y(le, {
424
- key: 0,
425
- modelValue: o.value,
426
- "onUpdate:modelValue": e[0] || (e[0] = (i) => o.value = i),
427
- "hide-configuration": a.hideConfiguration,
428
- onHideConfiguration: e[1] || (e[1] = (i) => {
429
- s("hideConfiguration", i);
430
- })
431
- }, null, 8, ["modelValue", "hide-configuration"])) : O("", !0)
432
- ], 64)) : (r(), y(f, { key: 0 }))
433
- ]);
434
- };
435
- }
436
- }), Ke = /* @__PURE__ */ $({
437
- __name: "ReportEditor",
438
- setup(c) {
439
- const n = X(), o = Z(), a = j(), { promptLoader: s } = xe(), { currentReport: C, editingReport: e } = Q(a), { breakpoints: f } = I(), v = U(() => {
440
- var V;
441
- return !((V = e.value) != null && V.editable);
442
- }), i = U(() => {
443
- var V;
444
- return ((V = e.value) == null ? void 0 : V.name) ?? "New Report";
445
- }), k = Fe(), { promptMessage: b } = ee(), h = N(!1);
446
- async function M() {
447
- if (!e.value || e.value.tiles.length === 0) {
448
- k.open({ message: "No Widget", type: "error" });
449
- return;
450
- }
451
- const V = v.value ? "clone" : "save";
452
- if (await b({
453
- title: "Save report",
454
- message: `Do you really want to ${V} ${i.value} ?`
455
- }))
456
- try {
457
- await s(async () => {
458
- if (v.value) {
459
- const d = JSON.parse(JSON.stringify(e.value));
460
- d.editable = !0, d.id = "", d.name = `${d.name} duplicate`, await a.createOrUpdateReport(d);
461
- } else
462
- e.value && await a.createOrUpdateReport(e.value);
463
- n.push({
464
- name: "reportView",
465
- query: o.query
466
- });
467
- });
468
- } catch (d) {
469
- console.log(d), k.open({ message: `Failed to ${V} report`, type: "error" });
470
- }
471
- }
472
- async function S() {
473
- var x;
474
- if (!e.value) return;
475
- await b({
476
- title: "Report",
477
- message: `Report ${(x = e.value) == null ? void 0 : x.name} is not saved, are you sure you want to quit?`
478
- }) && (e.value = JSON.parse(JSON.stringify(C.value)), n.back());
479
- }
480
- return fe(() => {
481
- e.value || n.push({ name: "reports" });
482
- }), (V, x) => {
483
- const d = m("FmChip"), p = m("FmButton");
484
- return r(), y(Ve, null, {
485
- default: u(() => [
486
- t(ke, null, {
487
- title: u(() => [
488
- _("p", {
489
- class: D(`${l(f).sm || l(f).xs ? "hidden" : ""}`)
490
- }, L(i.value), 3),
491
- !l(e) || l(e).tiles.length <= 0 ? (r(), y(d, {
492
- key: 0,
493
- label: "Draft",
494
- icon: "hexagon",
495
- selectable: !1
496
- })) : O("", !0)
497
- ]),
498
- button: u(() => [
499
- t(p, {
500
- label: "Cancel",
501
- variant: "tertiary",
502
- "text-color": l(q).TypoSecondary,
503
- onClick: S
504
- }, null, 8, ["text-color"]),
505
- t(p, {
506
- label: `${l(C) ? "Save" : "Add"} report`,
507
- "prepend-icon": "download",
508
- onClick: M
509
- }, null, 8, ["label"])
510
- ]),
511
- _: 1
512
- }),
513
- l(e) ? (r(), y(G(l(f).lg || l(f).md ? Ne : De), {
514
- key: 0,
515
- modelValue: l(e),
516
- "onUpdate:modelValue": x[0] || (x[0] = (T) => Y(e) ? e.value = T : null),
517
- class: D(`${l(f).lg || l(f).md ? "flex" : ""} w-full`),
518
- style: ve({ height: `calc( 100% - ${l(f).lg || l(f).md ? 72 : 64}px)` }),
519
- "hide-configuration": h.value,
520
- onHideConfiguration: x[1] || (x[1] = (T) => h.value = T)
521
- }, null, 40, ["modelValue", "class", "style", "hide-configuration"])) : O("", !0)
522
- ]),
523
- _: 1
524
- });
525
- };
526
- }
527
- });
528
- export {
529
- Ke as default
530
- };
@@ -1,166 +0,0 @@
1
- import { defineComponent as J, computed as f, resolveComponent as L, createBlock as v, openBlock as s, withCtx as T, createVNode as x, createElementVNode as V, unref as o, normalizeStyle as z, normalizeClass as S, createElementBlock as w, Fragment as H, renderList as M } from "vue";
2
- import { useSnackbar as Y, useBreakpoints as G } from "@feedmepos/ui-library";
3
- import { _ as Q } from "./MenuTab.vue_vue_type_script_setup_true_lang-h87kWy1E.js";
4
- import { _ as U } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-B6IzlHmr.js";
5
- import { useRouter as W, useRoute as j } from "vue-router";
6
- import { _ as K } from "./Default.vue_vue_type_script_setup_true_lang-Bxuyjrkr.js";
7
- import { a as X } from "./v4-DF7wffYN.js";
8
- import { storeToRefs as c } from "pinia";
9
- import { a as Z, u as ee } from "./NavigationTab.vue_vue_type_script_setup_true_lang-C8yzWDXs.js";
10
- import { _ as te } from "./NoData.vue_vue_type_script_setup_true_lang-DlBNFLa3.js";
11
- import { d as oe, c as ae } from "./global-loader-CMC9fgBi.js";
12
- import { u as re } from "./message-dialog-UoMWOnil.js";
13
- const be = /* @__PURE__ */ J({
14
- __name: "ReportView",
15
- setup(le) {
16
- const p = W(), m = j(), i = Y(), { promptMessage: D } = re(), d = X(), { promptLoader: $ } = oe(), { breakpoints: l } = G(), {
17
- currentReport: t,
18
- currentReportId: u,
19
- isOpenDownloadDialog: h,
20
- isOpenEmailDialog: E,
21
- editingReport: R,
22
- canCreateCustomReport: P,
23
- customReportQuota: y
24
- } = c(d), { isOpenAccountingDialog: O } = c(Z()), { isOpenScheduleDialog: g } = c(ee()), { disabled: I } = c(ae()), N = f(() => {
25
- const a = [
26
- {
27
- icon: "mail",
28
- label: "Email schedule",
29
- onClick: () => {
30
- g.value = !0;
31
- }
32
- },
33
- // {
34
- // icon: "article",
35
- // label: "Set as Default",
36
- // onClick: async () => {
37
- // await promptLoader(async () => {
38
- // if (currentReport.value) {
39
- // try {
40
- // await reportStore.updateDefaultReport(currentReport.value.id)
41
- // snackbar.open({
42
- // message: `Set ${currentReport.value.name} as default successful`,
43
- // type: "success"
44
- // })
45
- // } catch (err) {
46
- // snackbar.open({ message: JSON.stringify(err), type: "error" })
47
- // }
48
- // }
49
- // })
50
- // }
51
- // },
52
- {
53
- icon: "content_copy",
54
- label: "Copy ID",
55
- onClick: () => {
56
- t.value && (navigator.clipboard.writeText(u.value), i.open({ message: "Copied report ID to clipboard", type: "success" }));
57
- }
58
- }
59
- ];
60
- return I.value || a.splice(1, 0, {
61
- icon: "download",
62
- label: "Accounting export",
63
- onClick: b
64
- }), a;
65
- });
66
- function q() {
67
- R.value = JSON.parse(JSON.stringify(t.value)), p.push({
68
- name: "reportEditor",
69
- query: m.query
70
- });
71
- }
72
- async function A() {
73
- if (!P.value) {
74
- let e = `Your current plan only support up to ${y.value} custom reports.`;
75
- y.value === 0 && (e = "Your current plan does not support custom report."), i.open({
76
- message: e,
77
- type: "error"
78
- });
79
- return;
80
- }
81
- if (!t.value) {
82
- i.open({ message: "No Widget", type: "error" });
83
- return;
84
- }
85
- if (await D({
86
- title: "Save report",
87
- message: `Do you really want to duplicate ${t.value.name} ?`
88
- }) && t.value) {
89
- const e = JSON.parse(JSON.stringify(t.value));
90
- e.editable = !0, e.id = "", e.name = `${e.name} duplicate`;
91
- try {
92
- await $(async () => {
93
- await d.createOrUpdateReport(e), d.updateCurrentReportId(u.value), p.push({
94
- name: "reportView",
95
- query: m.query
96
- });
97
- });
98
- } catch (n) {
99
- console.log(n), i.open({ message: "Failed to clone report", type: "error" });
100
- }
101
- }
102
- }
103
- function b() {
104
- O.value = !0;
105
- }
106
- function B() {
107
- t.value && (navigator.clipboard.writeText(u.value), i.open({ message: "Copied report ID to clipboard", type: "success" }));
108
- }
109
- const _ = f(() => t.value ? t.value.tiles : []), F = f(() => {
110
- var e;
111
- let a = [
112
- (e = t == null ? void 0 : t.value) != null && e.editable ? { label: "Edit", value: "edit", isPrimary: !1 } : { label: "Duplicate", value: "duplicate", isPrimary: !1 },
113
- { label: "Download", value: "download", isPrimary: !0, prependIcon: "download" },
114
- { label: "Send Email", value: "email", isPrimary: !0 }
115
- ];
116
- return l.value.xs && (a = [
117
- ...a,
118
- { label: "Email schedule", value: "schedule_email", isPrimary: !1 },
119
- { label: "Copy ID", value: "content_copy", isPrimary: !1 },
120
- { label: "Accounting export", value: "export", isPrimary: !1 },
121
- { label: "Send Email", value: "email", isPrimary: !1 }
122
- ], a = a.filter((n) => n.value !== "edit")), a;
123
- });
124
- return (a, e) => {
125
- const n = L("FmPageHead");
126
- return s(), v(K, null, {
127
- default: T(() => {
128
- var C;
129
- return [
130
- x(n, {
131
- title: (C = o(t)) == null ? void 0 : C.name,
132
- "back-button": !0,
133
- actions: F.value,
134
- "onClick:back": e[0] || (e[0] = (r) => o(p).push({ name: "reports", query: o(m).query })),
135
- "onClick:action": e[1] || (e[1] = (r) => {
136
- r === "duplicate" && A(), r === "download" && (h.value = !0), r === "email" && (E.value = !0), r === "edit" && q(), r === "schedule_email" && (g.value = !0), r === "content_copy" && B(), r === "export" && b();
137
- })
138
- }, null, 8, ["title", "actions"]),
139
- V("div", {
140
- class: S(`flex flex-col overflow-y-auto ${o(l).xs || o(l).sm ? "pb-20" : ""}`),
141
- style: z({ height: `calc(100% - ${o(l).lg || o(l).md ? 72 : 64}px)` })
142
- }, [
143
- x(Q, {
144
- "model-value": o(l).lg || o(l).md ? N.value : []
145
- }, null, 8, ["model-value"]),
146
- o(t) && _.value.length > 0 ? (s(), w("div", {
147
- key: 0,
148
- class: S(["grid grid-cols-12", o(l).sm || o(l).xs ? "px-3 gap-[16px]" : "px-24 gap-[24px]"])
149
- }, [
150
- (s(!0), w(H, null, M(_.value, (r, k) => (s(), v(U, {
151
- key: `widget_${o(u)}_${k}`,
152
- "model-value": r,
153
- index: k
154
- }, null, 8, ["model-value", "index"]))), 128))
155
- ], 2)) : (s(), v(te, { key: 1 }))
156
- ], 6)
157
- ];
158
- }),
159
- _: 1
160
- });
161
- };
162
- }
163
- });
164
- export {
165
- be as default
166
- };