@feedmepos/mf-report 5.5.10-beta.0 → 5.5.11-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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as g, computed as w, resolveComponent as k, createBlock as a, openBlock as t, withCtx as $, createVNode as d, createElementVNode as y, unref as e, normalizeStyle as C, normalizeClass as u, createElementBlock as _, Fragment as h, renderList as B } from "vue";
2
- import { _ as b } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-ByYEvziC.js";
2
+ import { _ as b } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-Blu98Lu7.js";
3
3
  import { _ as F } from "./Default.vue_vue_type_script_setup_true_lang-D7TqpbQ9.js";
4
4
  import { a as P } from "./v4-HCTsB306.js";
5
5
  import { storeToRefs as R } from "pinia";
@@ -1,56 +1,57 @@
1
- import { defineComponent as ce, ref as O, watch as Q, computed as w, h as f, withModifiers as ie, resolveComponent as C, createBlock as T, openBlock as F, withCtx as i, createVNode as n, createElementVNode as y, unref as e, normalizeStyle as me, normalizeClass as _, withDirectives as B, createElementBlock as ue, Fragment as pe, renderList as de, toDisplayString as R, createTextVNode as fe, vShow as D } from "vue";
2
- import { storeToRefs as W } from "pinia";
3
- import { a as ve } from "./v4-HCTsB306.js";
4
- import { _ as ye } from "./Default.vue_vue_type_script_setup_true_lang-D7TqpbQ9.js";
5
- import { u as ge } from "./message-dialog-UoMWOnil.js";
6
- import { b as be, f as xe } from "./global-loader-BqFQzk46.js";
7
- import { useSnackbar as Ce, useBreakpoints as _e, components as he, FmButtonColorThemeVariant as ke } from "@feedmepos/ui-library";
8
- import { _ as we } from "./NoData.vue_vue_type_script_setup_true_lang-DI4X_DSc.js";
9
- import { useRouter as $e, useRoute as Ie, onBeforeRouteLeave as Se } from "vue-router";
10
- import { useI18n as Fe } from "@feedmepos/mf-common";
11
- const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le = { class: "w-[343px]" }, Ve = { class: "fm-typo-en-body-md-600" }, Ke = /* @__PURE__ */ ce({
1
+ import { defineComponent as me, ref as O, watch as W, computed as w, h as f, withModifiers as ue, resolveComponent as x, createBlock as T, openBlock as F, withCtx as i, createVNode as n, createElementVNode as y, unref as e, normalizeStyle as pe, normalizeClass as C, withDirectives as B, createElementBlock as de, Fragment as fe, renderList as ve, toDisplayString as R, createTextVNode as ye, vShow as D } from "vue";
2
+ import { storeToRefs as X } from "pinia";
3
+ import { a as ge } from "./v4-HCTsB306.js";
4
+ import { _ as be } from "./Default.vue_vue_type_script_setup_true_lang-D7TqpbQ9.js";
5
+ import { u as he } from "./message-dialog-UoMWOnil.js";
6
+ import { b as xe, f as Ce } from "./global-loader-BqFQzk46.js";
7
+ import { useSnackbar as _e, useBreakpoints as ke, components as we, FmButtonColorThemeVariant as $e } from "@feedmepos/ui-library";
8
+ import { _ as Ie } from "./NoData.vue_vue_type_script_setup_true_lang-DI4X_DSc.js";
9
+ import { useRouter as Se, useRoute as Fe, onBeforeRouteLeave as Re } from "vue-router";
10
+ import { useI18n as Le } from "@feedmepos/mf-common";
11
+ import { r as Z } from "./i18n-Cif1I9J2.js";
12
+ const Ve = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ze = { class: "w-[343px]" }, Pe = { class: "fm-typo-en-body-md-600" }, Ye = /* @__PURE__ */ me({
12
13
  __name: "Report",
13
- setup(ze) {
14
- const { t: r } = Fe(), A = $e(), M = Ie(), p = ve(), { business: X } = W(be()), {
14
+ setup(Ne) {
15
+ const { t: r, te: A } = Le(), M = Se(), q = Fe(), p = ge(), { business: ee } = X(xe()), {
15
16
  reports: d,
16
17
  categories: $,
17
18
  pinReport: I,
18
- isOpenAddReportDialog: Z,
19
- scrollPositionY: q,
20
- customReportQuota: J,
21
- canCreateCustomReport: ee
22
- } = W(p), { promptMessage: K } = ge(), { promptLoader: U } = xe(), v = Ce(), { breakpoints: s } = _e(), g = O();
23
- Se(() => {
24
- g.value && (q.value = g.value.$el.children[0].scrollTop);
25
- }), Q(g, () => {
19
+ isOpenAddReportDialog: te,
20
+ scrollPositionY: J,
21
+ customReportQuota: K,
22
+ canCreateCustomReport: oe
23
+ } = X(p), { promptMessage: U } = he(), { promptLoader: j } = Ce(), v = _e(), { breakpoints: s } = ke(), g = O();
24
+ Re(() => {
25
+ g.value && (J.value = g.value.$el.children[0].scrollTop);
26
+ }), W(g, () => {
26
27
  g.value && setTimeout(() => {
27
- g.value.$el.children[0].scrollTop = q.value;
28
+ g.value.$el.children[0].scrollTop = J.value;
28
29
  }, 200);
29
30
  });
30
31
  const L = w(() => I.value && d.value ? d.value.filter((t) => {
31
32
  var o;
32
33
  return (o = I.value) == null ? void 0 : o.includes(t.id);
33
34
  }) : []);
34
- Q(
35
- [() => X.value],
35
+ W(
36
+ [() => ee.value],
36
37
  () => {
37
38
  p.refreshPinReport();
38
39
  },
39
40
  { immediate: !0 }
40
41
  );
41
- const j = w(() => L.value.length > 0 ? d.value.filter(
42
+ const Y = w(() => L.value.length > 0 ? d.value.filter(
42
43
  (t) => L.value.findIndex((o) => o.id === t.id) === -1
43
- ) : d.value), { FmButton: te, FmMenu: V, FmMenuItem: h, FmIcon: z, FmChip: P } = he, Y = w(() => [
44
+ ) : d.value), { FmButton: re, FmMenu: V, FmMenuItem: _, FmIcon: z, FmChip: P } = we, E = w(() => [
44
45
  { value: void 0, label: "All" },
45
46
  ...$.value.map((t) => ({
46
47
  value: t.id,
47
48
  label: t.name
48
49
  }))
49
- ]), b = O(Y.value[0]), S = O(""), x = w(() => j.value.length === 0 || $.value.length === 0 ? [] : [
50
+ ]), b = O(E.value[0]), S = O(""), h = w(() => Y.value.length === 0 || $.value.length === 0 ? [] : [
50
51
  ...L.value.map((o) => {
51
52
  const a = $.value.find((c) => c.id === o.category);
52
53
  return {
53
- name: o.name,
54
+ name: Z(r, A, o.name, "other"),
54
55
  categoryId: (a == null ? void 0 : a.id) ?? "",
55
56
  category: a != null && a.name ? r(`report.category.${a.name}`) : r("report.common.uncategorized"),
56
57
  reportId: o.id,
@@ -58,10 +59,10 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
58
59
  pin: !0
59
60
  };
60
61
  }).filter((o) => b.value.value && o.categoryId !== b.value.value ? !1 : o.name.toLowerCase().indexOf(S.value.toLowerCase()) !== -1),
61
- ...j.value.map((o) => {
62
+ ...Y.value.map((o) => {
62
63
  const a = $.value.find((c) => c.id === o.category);
63
64
  return {
64
- name: o.name,
65
+ name: Z(r, A, o.name, "other"),
65
66
  categoryId: (a == null ? void 0 : a.id) ?? "",
66
67
  category: a != null && a.name ? r(`report.category.${a.name}`) : r("report.common.uncategorized"),
67
68
  reportId: o.id,
@@ -69,9 +70,9 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
69
70
  pin: !1
70
71
  };
71
72
  }).filter((o) => b.value.value && o.categoryId !== b.value.value ? !1 : o.name.toLowerCase().indexOf(S.value.toLowerCase()) !== -1)
72
- ]), oe = w(
73
- () => x.value.map((t) => `${t.name}${t.category}`).toString()
74
- ), re = [
73
+ ]), ae = w(
74
+ () => h.value.map((t) => `${t.name}${t.category}`).toString()
75
+ ), le = [
75
76
  {
76
77
  accessorKey: "name",
77
78
  header: r("report.common.name"),
@@ -106,7 +107,7 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
106
107
  {
107
108
  label: r("report.common.duplicate"),
108
109
  onClick: () => {
109
- c && E(c);
110
+ c && G(c);
110
111
  },
111
112
  variant: "",
112
113
  disabled: !1
@@ -114,7 +115,7 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
114
115
  {
115
116
  label: r("report.common.remove"),
116
117
  onClick: () => {
117
- c && G(c);
118
+ c && H(c);
118
119
  },
119
120
  variant: "destructive",
120
121
  disabled: !o.editable
@@ -130,8 +131,8 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
130
131
  f(
131
132
  "button",
132
133
  {
133
- onClick: ie(() => {
134
- c && H(c);
134
+ onClick: ue(() => {
135
+ c && Q(c);
135
136
  }, ["stop"]),
136
137
  class: `text-fm-color-neutral-gray-400 ${o.pin ? "" : "show-pin"} hover:bg-fm-color-opacity-sm rounded-lg flex items-center justify-center`
137
138
  },
@@ -156,7 +157,7 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
156
157
  {
157
158
  default: () => N.map(
158
159
  (m) => f(
159
- h,
160
+ _,
160
161
  {
161
162
  onClick: m.disabled ? {} : m.onClick,
162
163
  label: m.label,
@@ -169,12 +170,12 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
169
170
  )
170
171
  ),
171
172
  "menu-button": () => f(
172
- te,
173
+ re,
173
174
  {
174
175
  variant: "tertiary",
175
176
  size: "md",
176
177
  icon: "more_vert",
177
- iconColor: ke.NeutralGray400
178
+ iconColor: $e.NeutralGray400
178
179
  },
179
180
  {}
180
181
  )
@@ -186,8 +187,8 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
186
187
  }
187
188
  }
188
189
  ];
189
- async function E(t) {
190
- if (await K({
190
+ async function G(t) {
191
+ if (await U({
191
192
  title: r("report.common.duplicate"),
192
193
  message: r("report.messages.confirmAction", {
193
194
  action: r("report.common.duplicate"),
@@ -195,7 +196,7 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
195
196
  })
196
197
  })) {
197
198
  const a = JSON.parse(JSON.stringify(t));
198
- a.editable = !0, a.id = "", a.name = `${a.name} ${r("report.common.duplicate")}`, U(async () => {
199
+ a.editable = !0, a.id = "", a.name = `${a.name} ${r("report.common.duplicate")}`, j(async () => {
199
200
  try {
200
201
  await p.createOrUpdateReport(a), v.open({
201
202
  message: `${r("report.messages.duplicateSuccess", { name: a.name })}`,
@@ -207,11 +208,11 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
207
208
  });
208
209
  }
209
210
  }
210
- async function G(t) {
211
- await K({
211
+ async function H(t) {
212
+ await U({
212
213
  title: r("report.messages.deleteReport"),
213
214
  message: r("report.messages.confirmDelete", { name: t.name })
214
- }) && U(async () => {
215
+ }) && j(async () => {
215
216
  try {
216
217
  await p.removeReport(t), v.open({
217
218
  message: r("report.messages.deleteSuccess", { name: t.name }),
@@ -222,18 +223,18 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
222
223
  }
223
224
  });
224
225
  }
225
- function ae() {
226
- if (ee.value)
227
- Z.value = !0;
226
+ function ne() {
227
+ if (oe.value)
228
+ te.value = !0;
228
229
  else {
229
- let t = `Your current plan only support up to ${J.value} custom reports.`;
230
- J.value === 0 && (t = "Your current plan does not support custom report."), v.open({
230
+ let t = `Your current plan only support up to ${K.value} custom reports.`;
231
+ K.value === 0 && (t = "Your current plan does not support custom report."), v.open({
231
232
  message: t,
232
233
  type: "error"
233
234
  });
234
235
  }
235
236
  }
236
- function H(t) {
237
+ function Q(t) {
237
238
  I.value && I.value.includes(t.id) ? (v.open({
238
239
  message: `${r("report.common.unpin")} ${t.name} ${r("report.common.successful")}`,
239
240
  type: "success"
@@ -242,12 +243,12 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
242
243
  type: "success"
243
244
  }), p.cachePinReport(t));
244
245
  }
245
- function le(t) {
246
+ function se(t) {
246
247
  b.value = t;
247
248
  }
248
249
  return (t, o) => {
249
- const a = C("FmPageHead"), c = C("FmSearch"), N = C("FmForm"), m = C("FmListItem"), ne = C("FmList"), se = C("FmTable");
250
- return F(), T(ye, null, {
250
+ const a = x("FmPageHead"), c = x("FmSearch"), N = x("FmForm"), m = x("FmListItem"), ce = x("FmList"), ie = x("FmTable");
251
+ return F(), T(be, null, {
251
252
  default: i(() => [
252
253
  n(a, {
253
254
  title: e(r)("report.common.report", 1),
@@ -260,14 +261,14 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
260
261
  prependIcon: "add"
261
262
  }
262
263
  ],
263
- "onClick:action": o[0] || (o[0] = (l) => ae())
264
+ "onClick:action": o[0] || (o[0] = (l) => ne())
264
265
  }, null, 8, ["title", "actions"]),
265
266
  y("div", {
266
- class: _(`overflow-y-hidden flex flex-col gap-8 ${e(s).sm || e(s).xs ? "mb-20" : ""}`),
267
- style: me({ height: `calc(100% - ${e(s).lg || e(s).md ? 72 : 64}px)` })
267
+ class: C(`overflow-y-hidden flex flex-col gap-8 ${e(s).sm || e(s).xs ? "mb-20" : ""}`),
268
+ style: pe({ height: `calc(100% - ${e(s).lg || e(s).md ? 72 : 64}px)` })
268
269
  }, [
269
270
  n(N, {
270
- class: _(`flex items-center gap-2 ${e(s).sm || e(s).xs ? "px-3" : "px-24"}`)
271
+ class: C(`flex items-center gap-2 ${e(s).sm || e(s).xs ? "px-3" : "px-24"}`)
271
272
  }, {
272
273
  default: i(() => [
273
274
  n(e(V), null, {
@@ -281,54 +282,54 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
281
282
  })
282
283
  ]),
283
284
  default: i(() => [
284
- (F(!0), ue(pe, null, de(Y.value, (l, u) => (F(), T(e(h), {
285
+ (F(!0), de(fe, null, ve(E.value, (l, u) => (F(), T(e(_), {
285
286
  key: u,
286
287
  label: e(r)(`report.category.${l.label}`),
287
- onClick: () => le(l)
288
+ onClick: () => se(l)
288
289
  }, null, 8, ["label", "onClick"]))), 128))
289
290
  ]),
290
291
  _: 1
291
292
  }),
292
293
  y("div", {
293
- class: _(`flex ${e(s).sm || e(s).xs ? "justify-center items-center" : ""}`)
294
+ class: C(`flex ${e(s).sm || e(s).xs ? "justify-center items-center" : ""}`)
294
295
  }, [
295
- y("p", Re, R(e(r)("report.common.results", { count: x.value.length })), 1)
296
+ y("p", Ve, R(e(r)("report.common.results", { count: h.value.length })), 1)
296
297
  ], 2),
297
298
  o[3] || (o[3] = y("div", { class: "grow" }, null, -1)),
298
- y("div", Le, [
299
+ y("div", ze, [
299
300
  n(c, {
300
301
  modelValue: S.value,
301
302
  "onUpdate:modelValue": o[1] || (o[1] = (l) => S.value = l),
302
- class: _(`${e(s).lg || e(s).md ? "grow" : ""}`)
303
+ class: C(`${e(s).lg || e(s).md ? "grow" : ""}`)
303
304
  }, null, 8, ["modelValue", "class"])
304
305
  ])
305
306
  ]),
306
307
  _: 1
307
308
  }, 8, ["class"]),
308
- B((F(), T(se, {
309
- key: oe.value,
309
+ B((F(), T(ie, {
310
+ key: ae.value,
310
311
  ref_key: "table",
311
312
  ref: g,
312
- class: _([e(s).sm || e(s).xs ? "px-0" : "px-24", "report-table"]),
313
+ class: C([e(s).sm || e(s).xs ? "px-0" : "px-24", "report-table"]),
313
314
  style: { height: "calc(100% - 40px)" },
314
- "column-defs": re,
315
- "row-data": x.value,
316
- "page-size": x.value.length,
315
+ "column-defs": le,
316
+ "row-data": h.value,
317
+ "page-size": h.value.length,
317
318
  "hide-footer": !0,
318
319
  "row-class-name": "row",
319
320
  onRowClick: o[2] || (o[2] = (l) => {
320
- e(p).updateCurrentReportId(l.original.reportId), e(A).push({
321
+ e(p).updateCurrentReportId(l.original.reportId), e(M).push({
321
322
  name: "reportView",
322
- query: e(M).query
323
+ query: e(q).query
323
324
  });
324
325
  })
325
326
  }, {
326
327
  "list-row": i(({ original: l }) => [
327
- n(ne, {
328
+ n(ce, {
328
329
  onClick: () => {
329
- l.reportId && (e(p).updateCurrentReportId(l.reportId), e(A).push({
330
+ l.reportId && (e(p).updateCurrentReportId(l.reportId), e(M).push({
330
331
  name: "reportView",
331
- query: e(M).query
332
+ query: e(q).query
332
333
  }));
333
334
  }
334
335
  }, {
@@ -340,13 +341,13 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
340
341
  }, {
341
342
  append: i(() => [
342
343
  n(e(P), {
343
- class: _(
344
+ class: C(
344
345
  l.category !== "Uncategorized" ? "bg-fm-color-system-info-100 text-fm-color-typo-info" : "text-fm-color-typo-secondary"
345
346
  ),
346
347
  compact: !0
347
348
  }, {
348
349
  default: i(() => [
349
- y("p", Ve, R(l.category), 1)
350
+ y("p", Pe, R(l.category), 1)
350
351
  ]),
351
352
  _: 2
352
353
  }, 1032, ["class"]),
@@ -361,36 +362,36 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
361
362
  })
362
363
  ]),
363
364
  default: i(() => [
364
- n(e(h), {
365
+ n(e(_), {
365
366
  label: l.pin ? "Unpin" : "Pin",
366
367
  onClick: () => {
367
368
  const u = e(d).find(
368
369
  (k) => k.id === l.reportId
369
370
  );
370
- u && H(u);
371
+ u && Q(u);
371
372
  }
372
373
  }, null, 8, ["label", "onClick"]),
373
- n(e(h), {
374
+ n(e(_), {
374
375
  label: e(r)("report.common.duplicate"),
375
376
  onClick: () => {
376
377
  const u = e(d).find(
377
378
  (k) => k.id === l.reportId
378
379
  );
379
- u && E(u);
380
+ u && G(u);
380
381
  }
381
382
  }, null, 8, ["label", "onClick"]),
382
- B(n(e(h), {
383
+ B(n(e(_), {
383
384
  label: e(r)("report.common.delete"),
384
385
  class: "text-fm-color-typo-error",
385
386
  onClick: () => {
386
387
  const u = e(d).find(
387
388
  (k) => k.id === l.reportId
388
389
  );
389
- u && G(u);
390
+ u && H(u);
390
391
  }
391
392
  }, {
392
393
  label: i(() => [
393
- fe(R(e(r)("report.common.delete")), 1)
394
+ ye(R(e(r)("report.common.delete")), 1)
394
395
  ]),
395
396
  _: 2
396
397
  }, 1032, ["label", "onClick"]), [
@@ -408,10 +409,10 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
408
409
  ]),
409
410
  _: 1
410
411
  }, 8, ["class", "row-data", "page-size"])), [
411
- [D, x.value.length > 0]
412
+ [D, h.value.length > 0]
412
413
  ]),
413
- B(n(we, null, null, 512), [
414
- [D, x.value.length === 0]
414
+ B(n(Ie, null, null, 512), [
415
+ [D, h.value.length === 0]
415
416
  ])
416
417
  ], 6)
417
418
  ]),
@@ -421,5 +422,5 @@ const Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le
421
422
  }
422
423
  });
423
424
  export {
424
- Ke as default
425
+ Ye as default
425
426
  };