@feedmepos/mf-report 5.28.4-beta.6 → 5.28.5-beta.1

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 (30) hide show
  1. package/dist/{App-c2BxKgqk.js → App-LMp_R0AO.js} +4 -4
  2. package/dist/{DateRangeSelect-BpBpNlAF.js → DateRangeSelect-D5MNS3ED.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-D-Se8EHw.js → Default.vue_vue_type_script_setup_true_lang-_x6I1SLK.js} +1 -1
  4. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-CUomxbbm.js → DynamicWidget.vue_vue_type_script_setup_true_lang-Ku809m7n.js} +5 -5
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-D43rK-ar.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CVLMDqVo.js} +10 -11
  6. package/dist/{InsightView-DPRA524-.js → InsightView-CexBuASX.js} +5 -5
  7. package/dist/{Integration-BayS_wae.js → Integration-BhBjJvFA.js} +3 -3
  8. package/dist/{Integrations-6UBvLfz6.js → Integrations-DoxPOtlP.js} +2 -2
  9. package/dist/{Layout-CvY-cS3c.js → Layout-CpYaEKec.js} +1 -1
  10. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-CGAnWHiG.js → LocationSelect.vue_vue_type_script_setup_true_lang-aoeHLEri.js} +2 -2
  11. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-DeQo93qA.js → MenuTab.vue_vue_type_script_setup_true_lang-cUeHgTVh.js} +5 -5
  12. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-Dl2ZSI8f.js → NavigationTab.vue_vue_type_script_setup_true_lang-9Sy-TfmP.js} +5 -5
  13. package/dist/{OverviewView-SxYadRgK.js → OverviewView-xarLDhQH.js} +4 -4
  14. package/dist/{Report-OGP3775t.js → Report-BWtieZVP.js} +234 -209
  15. package/dist/{ReportCanvasView-5pLCE58u.js → ReportCanvasView-BcLMK1ue.js} +3 -3
  16. package/dist/{ReportEditor-C3r_5wKe.js → ReportEditor-BVIeNH2F.js} +7 -7
  17. package/dist/{ReportView-BeNILR1t.js → ReportView-DpB3EUA3.js} +6 -6
  18. package/dist/{ReportViewRoute-Cw8EbetI.js → ReportViewRoute-0a1EIWRY.js} +2 -2
  19. package/dist/{Setting-_scvQJEC.js → Setting-CyUrAoSC.js} +3 -3
  20. package/dist/{Template-CnDYWRaV.js → Template-BePcvtQA.js} +3 -3
  21. package/dist/{TileEditor-Caal9QVe.js → TileEditor-DmoImVlY.js} +6 -6
  22. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-4IWIJo_S.js → TilePageStack.vue_vue_type_script_setup_true_lang-DaGNH_wS.js} +2 -2
  23. package/dist/{TransitionFade-DSsnM6J9.js → TransitionFade-Da4NqyJj.js} +5 -5
  24. package/dist/{app-e8Pud10z.js → app-B2X5ei7_.js} +16 -12
  25. package/dist/app.js +1 -1
  26. package/dist/assets/{formatChartData.worker-DYtOUTAT.js → formatChartData.worker-CWr4Nz92.js} +39 -39
  27. package/dist/assets/{processTableData.worker-XtLK-E3T.js → processTableData.worker-Dw1MMRvI.js} +39 -39
  28. package/dist/{report-AhRrPMU6.js → report-BLy0LUpn.js} +1 -1
  29. package/dist/{useRestaurantPermission-D2RhNs5d.js → useRestaurantPermission-DRCSAxjE.js} +1 -1
  30. package/package.json +1 -1
@@ -1,49 +1,49 @@
1
- import { defineComponent as Te, ref as $, watch as Se, computed as R, h as d, withModifiers as we, resolveComponent as I, createBlock as ee, openBlock as z, withCtx as m, createVNode as c, createElementVNode as v, unref as t, normalizeStyle as Ae, normalizeClass as g, withDirectives as he, createElementBlock as ze, Fragment as Je, renderList as Be, toDisplayString as k, createTextVNode as Ke, vShow as Re } from "vue";
2
- import { storeToRefs as xe } from "pinia";
3
- import { u as Ee, s as je } from "./report-AhRrPMU6.js";
4
- import { _ as Ye } from "./Default.vue_vue_type_script_setup_true_lang-D-Se8EHw.js";
5
- import { u as qe } from "./message-dialog-UoMWOnil.js";
6
- import { u as He } from "./global-loader-BuxFfehu.js";
7
- import { useSnackbar as Ge, useBreakpoints as Qe, components as We, FmButtonColorThemeVariant as Xe } from "@feedmepos/ui-library";
8
- import { _ as Ze } from "./SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js";
9
- import { c as et, a as Pe, h as tt } from "./app-e8Pud10z.js";
10
- import { useRouter as ot, useRoute as at, onBeforeRouteLeave as st } from "vue-router";
11
- import { useI18n as rt } from "@feedmepos/mf-common";
12
- import { r as te } from "./i18n-DbyciK4x.js";
13
- const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt = { class: "w-[343px]" }, ct = { class: "fm-typo-en-body-md-600" }, it = ["tabindex", "aria-disabled", "onClick"], pt = { class: "fm-typo-en-body-md-400 max-w-[240px]" }, Pt = /* @__PURE__ */ Te({
1
+ import { defineComponent as Ae, ref as $, watch as we, computed as h, h as d, withModifiers as ze, resolveComponent as I, createBlock as se, openBlock as B, withCtx as m, createVNode as c, createElementVNode as v, unref as t, normalizeStyle as Je, normalizeClass as g, withDirectives as Re, createElementBlock as Be, Fragment as Ke, renderList as Ee, toDisplayString as k, createTextVNode as je, vShow as he } from "vue";
2
+ import { storeToRefs as Pe } from "pinia";
3
+ import { u as He, s as Ye } from "./report-BLy0LUpn.js";
4
+ import { _ as qe } from "./Default.vue_vue_type_script_setup_true_lang-_x6I1SLK.js";
5
+ import { u as Ge } from "./message-dialog-UoMWOnil.js";
6
+ import { u as Qe } from "./global-loader-BuxFfehu.js";
7
+ import { useSnackbar as We, useBreakpoints as Xe, components as Ze, FmButtonColorThemeVariant as et } from "@feedmepos/ui-library";
8
+ import { _ as tt } from "./SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js";
9
+ import { c as ot, a as xe, h as at } from "./app-B2X5ei7_.js";
10
+ import { useRouter as st, useRoute as rt, onBeforeRouteLeave as nt } from "vue-router";
11
+ import { useI18n as lt } from "@feedmepos/mf-common";
12
+ import { r as re } from "./i18n-DbyciK4x.js";
13
+ const ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, it = { class: "w-[343px]" }, pt = { class: "fm-typo-en-body-md-600" }, dt = ["tabindex", "aria-disabled", "onClick"], ut = { class: "fm-typo-en-body-md-400 max-w-[240px]" }, It = /* @__PURE__ */ Ae({
14
14
  __name: "Report",
15
- setup(dt) {
16
- const { t: a, te: J } = rt(), oe = ot(), ae = at(), S = Ee(), Ce = et(), { business: Ie } = xe(Pe()), {
15
+ setup(mt) {
16
+ const { t: a, te: K } = lt(), ne = st(), le = rt(), S = He(), Ce = ot(), { business: Ie } = Pe(xe()), {
17
17
  reports: f,
18
- overviewReport: B,
18
+ overviewReport: E,
19
19
  categories: O,
20
20
  pinReport: F,
21
21
  isOpenAddReportDialog: ke,
22
- scrollPositionY: se,
23
- customReportQuota: L,
24
- canCreateCustomReport: re
25
- } = xe(S), { promptMessage: ne } = qe(), { promptLoader: K } = He(), l = Ge(), { breakpoints: p } = Qe(), { canRead: le, canUpdate: ce, canDuplicate: ie, canDelete: E, canCreateReport: _e } = tt(), h = $();
26
- st(() => {
27
- h.value && (se.value = h.value.$el.children[0].scrollTop);
28
- }), Se(h, () => {
29
- h.value && setTimeout(() => {
30
- h.value && (h.value.$el.children[0].scrollTop = se.value);
22
+ scrollPositionY: ce,
23
+ customReportQuota: T,
24
+ canCreateCustomReport: ie
25
+ } = Pe(S), { promptMessage: pe } = Ge(), { promptLoader: j } = Qe(), l = We(), { breakpoints: p } = Xe(), { canRead: de, canUpdate: H, canDuplicate: ue, canDelete: Y, canCreateReport: _e } = at(), R = $();
26
+ nt(() => {
27
+ R.value && (ce.value = R.value.$el.children[0].scrollTop);
28
+ }), we(R, () => {
29
+ R.value && setTimeout(() => {
30
+ R.value && (R.value.$el.children[0].scrollTop = ce.value);
31
31
  }, 200);
32
32
  });
33
- const j = R(() => F.value && f.value ? f.value.filter((o) => {
33
+ const q = h(() => F.value && f.value ? f.value.filter((o) => {
34
34
  var e;
35
35
  return (e = F.value) == null ? void 0 : e.includes(o.id);
36
36
  }) : []);
37
- Se(
37
+ we(
38
38
  [() => Ie.value],
39
39
  () => {
40
40
  S.refreshPinReport();
41
41
  },
42
42
  { immediate: !0 }
43
43
  );
44
- const pe = R(() => j.value.length > 0 ? f.value.filter(
45
- (o) => j.value.findIndex((e) => e.id === o.id) === -1
46
- ) : f.value), { FmButton: De, FmMenu: Y, FmMenuItem: x, FmIcon: q, FmChip: H, FmTooltip: $e, FmSwitch: de } = We, b = $(/* @__PURE__ */ new Set()), G = $(/* @__PURE__ */ new Map()), ue = /* @__PURE__ */ new Set([
44
+ const me = h(() => q.value.length > 0 ? f.value.filter(
45
+ (o) => q.value.findIndex((e) => e.id === o.id) === -1
46
+ ) : f.value), { FmButton: De, FmMenu: G, FmMenuItem: P, FmIcon: Q, FmChip: W, FmTooltip: $e, FmSwitch: fe } = Ze, b = $(/* @__PURE__ */ new Set()), X = $(/* @__PURE__ */ new Map()), Oe = /* @__PURE__ */ new Set([
47
47
  "closeup",
48
48
  "dailySales",
49
49
  "hourlySales",
@@ -59,50 +59,54 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
59
59
  "timesheet",
60
60
  "void_",
61
61
  "refund"
62
- ]), me = R(() => [
62
+ ]), ye = h(() => [
63
63
  { value: void 0, label: "All" },
64
64
  ...O.value.map((o) => ({
65
65
  value: o.id,
66
66
  label: o.name
67
67
  }))
68
- ]), V = $(me.value[0]), Q = $(""), P = R(() => pe.value.length === 0 || O.value.length === 0 ? [] : [
69
- ...j.value.map((e) => {
68
+ ]), L = $(ye.value[0]), Z = $("");
69
+ function ee(o) {
70
+ return o.isDefault && Oe.has(o.permissionKey ?? "");
71
+ }
72
+ const x = h(() => me.value.length === 0 || O.value.length === 0 ? [] : [
73
+ ...q.value.map((e) => {
70
74
  const r = O.value.find((n) => n.id === e.category);
71
75
  return {
72
- name: te(a, J, e.name, "other"),
76
+ name: re(a, K, e.name, "other"),
73
77
  categoryId: (r == null ? void 0 : r.id) ?? "",
74
78
  category: r != null && r.name ? a(`report.category.${r.name}`) : a("report.common.uncategorized"),
75
79
  reportId: e.id,
76
80
  editable: e.editable,
77
81
  description: e.description || "",
78
82
  pin: !0,
79
- canUpdate: ce(e),
80
- canRead: le(e),
81
- isSupportPos: !!e.isSupportPos,
82
- isMandatoryPosReport: e.isDefault && ue.has(e.permissionKey ?? ""),
83
+ canUpdate: H(e),
84
+ canRead: de(e),
85
+ isSupportPos: e.reportType === "canvas" ? !1 : !!e.isSupportPos,
86
+ isMandatoryPosReport: ee(e),
83
87
  reportType: e.reportType
84
88
  };
85
89
  }),
86
- ...pe.value.map((e) => {
90
+ ...me.value.map((e) => {
87
91
  const r = O.value.find((n) => n.id === e.category);
88
92
  return {
89
- name: te(a, J, e.name, "other"),
93
+ name: re(a, K, e.name, "other"),
90
94
  categoryId: (r == null ? void 0 : r.id) ?? "",
91
95
  category: r != null && r.name ? a(`report.category.${r.name}`) : a("report.common.uncategorized"),
92
96
  reportId: e.id,
93
97
  editable: e.editable,
94
98
  description: e.description || "",
95
99
  pin: !1,
96
- canUpdate: ce(e),
97
- canRead: le(e),
98
- isSupportPos: !!e.isSupportPos,
99
- isMandatoryPosReport: e.isDefault && ue.has(e.permissionKey ?? ""),
100
+ canUpdate: H(e),
101
+ canRead: de(e),
102
+ isSupportPos: e.reportType === "canvas" ? !1 : !!e.isSupportPos,
103
+ isMandatoryPosReport: ee(e),
100
104
  reportType: e.reportType
101
105
  };
102
106
  })
103
- ].filter((e) => V.value.value && e.categoryId !== V.value.value ? !1 : `${(e == null ? void 0 : e.name) || ""}${(e == null ? void 0 : e.description) || ""}`.toLowerCase().indexOf(Q.value.toLowerCase()) !== -1)), Oe = R(
104
- () => P.value.map((o) => `${o.name}${o.category}`).toString()
105
- ), Fe = R(() => [
107
+ ].filter((e) => L.value.value && e.categoryId !== L.value.value ? !1 : `${(e == null ? void 0 : e.name) || ""}${(e == null ? void 0 : e.description) || ""}`.toLowerCase().indexOf(Z.value.toLowerCase()) !== -1)), Fe = h(
108
+ () => x.value.map((o) => `${o.name}${o.category}`).toString()
109
+ ), Te = h(() => [
106
110
  {
107
111
  accessorKey: "name",
108
112
  header: a("report.common.name"),
@@ -124,7 +128,7 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
124
128
  width: "100px"
125
129
  },
126
130
  cell: (o) => d(
127
- H,
131
+ W,
128
132
  {
129
133
  // grey out chip text when user cannot read report
130
134
  class: `${o.getValue() !== a("report.common.uncategorized") ? "bg-fm-color-system-info-100 text-fm-color-typo-info" : "text-fm-color-typo-secondary"} ${o.row.original.canRead ? "" : "opacity-40 cursor-not-allowed"} fm-typo-en-body-sm-600`,
@@ -154,12 +158,12 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
154
158
  width: "130px"
155
159
  },
156
160
  cell: (o) => {
157
- var u;
158
- const e = o.row.original, r = e.reportId, n = f.value.find((y) => y.id === r), Z = r === ((u = B.value) == null ? void 0 : u.id), T = !e.canRead, D = n ? ie(n) : !1, A = n ? E(n) : !1, s = !e.canUpdate || e.isMandatoryPosReport || b.value.has(r), C = e.isMandatoryPosReport ? a("reportV5.reportList.mandatoryPosReportHint") : a("reportV5.reportList.posV8Hint"), i = [
161
+ var J;
162
+ const e = o.row.original, r = e.reportId, n = f.value.find((u) => u.id === r), ae = r === ((J = E.value) == null ? void 0 : J.id), A = !e.canRead, D = n ? ue(n) : !1, z = n ? Y(n) : !1, s = e.reportType === "canvas", C = !e.canUpdate || e.isMandatoryPosReport || s || b.value.has(r), i = s ? a("reportV5.reportList.canvasPosReportHint") : e.isMandatoryPosReport ? a("reportV5.reportList.mandatoryPosReportHint") : a("reportV5.reportList.posV8Hint"), y = [
159
163
  {
160
164
  label: a("report.common.duplicate"),
161
165
  onClick: () => {
162
- n && D ? be(n) : D || l.open({
166
+ n && D ? ge(n) : D || l.open({
163
167
  message: a("report.messages.noPermissionDuplicateReport"),
164
168
  type: "error"
165
169
  });
@@ -168,9 +172,9 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
168
172
  disabled: !D
169
173
  },
170
174
  {
171
- label: a(Z ? "report.common.unsetAsOverview" : "report.common.setAsOverview"),
175
+ label: a(ae ? "report.common.unsetAsOverview" : "report.common.setAsOverview"),
172
176
  onClick: async () => {
173
- n && fe(n);
177
+ n && ve(n);
174
178
  },
175
179
  variant: "",
176
180
  disabled: !1
@@ -178,13 +182,13 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
178
182
  {
179
183
  label: a("report.common.remove"),
180
184
  onClick: () => {
181
- n && (A ? ve(n) : l.open({
185
+ n && (z ? be(n) : l.open({
182
186
  message: a("report.messages.noPermissionDeleteReport"),
183
187
  type: "error"
184
188
  }));
185
189
  },
186
190
  variant: "destructive",
187
- disabled: !e.editable || !A
191
+ disabled: !e.editable || !z
188
192
  }
189
193
  ];
190
194
  return d(
@@ -196,39 +200,50 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
196
200
  default: () => [
197
201
  d(
198
202
  $e,
199
- { content: C, placement: "bottom", zIndex: 2e3 },
203
+ { content: i, placement: "bottom", zIndex: 2e3 },
200
204
  {
201
- default: () => d("div", { class: "mr-2 flex items-center" }, [
202
- d("span", { class: "fm-typo-en-body-sm-400 whitespace-nowrap" }, "POS v8"),
203
- d(de, {
204
- modelValue: e.isSupportPos,
205
- disabled: s,
206
- "aria-label": a("report.common.showInPOS"),
207
- class: "pos-v8-switch",
208
- "onUpdate:modelValue": () => {
209
- n && ye(n);
210
- },
211
- onClick: we(() => {
212
- }, ["stop"])
213
- })
214
- ])
205
+ default: () => d(
206
+ "div",
207
+ {
208
+ class: "pos-v8-control mr-2 flex items-center",
209
+ "data-testid": "desktop-pos-v8-toggle",
210
+ onClick: (u) => {
211
+ e.isMandatoryPosReport && (u.stopPropagation(), n && V(n));
212
+ }
213
+ },
214
+ [
215
+ d("span", { class: "fm-typo-en-body-sm-400 whitespace-nowrap" }, "POS v8"),
216
+ d(fe, {
217
+ modelValue: e.isSupportPos,
218
+ disabled: C,
219
+ "aria-label": a("report.common.showInPOS"),
220
+ class: "pos-v8-switch",
221
+ "onUpdate:modelValue": () => {
222
+ n && V(n);
223
+ },
224
+ onClick: (u) => {
225
+ u.stopPropagation(), e.isMandatoryPosReport && n && V(n);
226
+ }
227
+ })
228
+ ]
229
+ )
215
230
  }
216
231
  ),
217
232
  d(
218
233
  "button",
219
234
  {
220
- disabled: T,
221
- title: T ? a("report.messages.noPermission") : void 0,
235
+ disabled: A,
236
+ title: A ? a("report.messages.noPermission") : void 0,
222
237
  "aria-label": e.pin ? "Unpin" : "Pin",
223
- onClick: we(() => {
224
- n && ge(n);
238
+ onClick: ze(() => {
239
+ n && Se(n);
225
240
  }, ["stop"]),
226
241
  class: "text-fm-color-neutral-gray-400 hover:bg-fm-color-opacity-sm rounded-lg flex items-center justify-center"
227
242
  },
228
243
  {
229
244
  default: () => [
230
245
  d(
231
- q,
246
+ Q,
232
247
  {
233
248
  name: "keep",
234
249
  class: "px-12 p-8",
@@ -241,24 +256,24 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
241
256
  }
242
257
  ),
243
258
  d(
244
- Y,
259
+ G,
245
260
  {
246
261
  stopClickPropagation: !0,
247
262
  shift: !0,
248
263
  disabled: !1
249
264
  },
250
265
  {
251
- default: () => i.map(
252
- (y) => d(
253
- x,
266
+ default: () => y.map(
267
+ (u) => d(
268
+ P,
254
269
  {
255
- onClick: y.disabled ? {} : y.onClick,
256
- label: y.label,
257
- class: y.disabled ? "text-fm-color-typo-disabled" : y.variant === "destructive" ? "text-fm-color-typo-error" : "",
258
- disabled: y.disabled
270
+ onClick: u.disabled ? {} : u.onClick,
271
+ label: u.label,
272
+ class: u.disabled ? "text-fm-color-typo-disabled" : u.variant === "destructive" ? "text-fm-color-typo-error" : "",
273
+ disabled: u.disabled
259
274
  },
260
275
  {
261
- label: () => d("p", y.label)
276
+ label: () => d("p", u.label)
262
277
  }
263
278
  )
264
279
  ),
@@ -268,7 +283,7 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
268
283
  variant: "tertiary",
269
284
  size: "md",
270
285
  icon: "more_vert",
271
- iconColor: Xe.NeutralGray400,
286
+ iconColor: et.NeutralGray400,
272
287
  disabled: !1
273
288
  },
274
289
  {}
@@ -281,11 +296,11 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
281
296
  }
282
297
  }
283
298
  ]);
284
- async function fe(o) {
285
- await K(async () => {
299
+ async function ve(o) {
300
+ await j(async () => {
286
301
  var e;
287
302
  try {
288
- const r = o.id === ((e = B.value) == null ? void 0 : e.id);
303
+ const r = o.id === ((e = E.value) == null ? void 0 : e.id);
289
304
  await S.updateDefaultReport(r ? null : o.id), l.open({
290
305
  message: `Successfully ${r ? "unset" : "set"} ${o.name} as Overview`,
291
306
  type: "success"
@@ -295,31 +310,47 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
295
310
  }
296
311
  });
297
312
  }
298
- async function ye(o) {
299
- if (!b.value.has(o.id)) {
300
- b.value = new Set(b.value).add(o.id);
301
- try {
302
- const e = !o.isSupportPos;
303
- await je(o.id, e), o.isSupportPos = e, G.value = new Map(G.value).set(
304
- o.id,
305
- e
306
- );
307
- } catch (e) {
308
- console.log(e), l.open({
309
- message: a("report.messages.failedToAction", { action: a("report.common.update") }),
313
+ async function V(o) {
314
+ if (o.reportType !== "canvas") {
315
+ if (ee(o)) {
316
+ l.open({
317
+ message: a("reportV5.reportList.cannotConfigureMandatoryReport"),
318
+ type: "error"
319
+ });
320
+ return;
321
+ }
322
+ if (!H(o)) {
323
+ l.open({
324
+ message: a("report.messages.noPermissionUpdateReport"),
310
325
  type: "error"
311
326
  });
312
- } finally {
313
- const e = new Set(b.value);
314
- e.delete(o.id), b.value = e;
327
+ return;
328
+ }
329
+ if (!b.value.has(o.id)) {
330
+ b.value = new Set(b.value).add(o.id);
331
+ try {
332
+ const e = !o.isSupportPos;
333
+ await Ye(o.id, e), o.isSupportPos = e, X.value = new Map(X.value).set(
334
+ o.id,
335
+ e
336
+ );
337
+ } catch (e) {
338
+ console.log(e), l.open({
339
+ message: a("report.messages.failedToAction", { action: a("report.common.update") }),
340
+ type: "error"
341
+ });
342
+ } finally {
343
+ const e = new Set(b.value);
344
+ e.delete(o.id), b.value = e;
345
+ }
315
346
  }
316
347
  }
317
348
  }
318
349
  function Le(o, e) {
319
- return G.value.get(o) ?? e;
350
+ return X.value.get(o) ?? e;
320
351
  }
321
352
  async function Ve(o) {
322
- if (await ne({
353
+ if (await pe({
323
354
  title: a("report.common.duplicate"),
324
355
  message: a("report.messages.confirmAction", {
325
356
  action: a("report.common.duplicate"),
@@ -327,7 +358,7 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
327
358
  })
328
359
  })) {
329
360
  const r = JSON.parse(JSON.stringify(o));
330
- r.editable = !0, r.id = "", r.name = `${r.name} ${a("report.common.duplicate")}`, r.isDefault = !1, K(async () => {
361
+ r.editable = !0, r.id = "", r.name = `${r.name} ${a("report.common.duplicate")}`, r.isDefault = !1, j(async () => {
331
362
  try {
332
363
  await S.createOrUpdateReport(r), l.open({
333
364
  message: `${a("report.messages.duplicateSuccess", { name: r.name })}`,
@@ -339,26 +370,26 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
339
370
  });
340
371
  }
341
372
  }
342
- function W(o) {
373
+ function te(o) {
343
374
  const e = f.value.find((r) => r.id === o.reportId);
344
- return !e || !ie(e);
375
+ return !e || !ue(e);
345
376
  }
346
- function X(o) {
377
+ function oe(o) {
347
378
  const e = f.value.find((r) => r.id === o.reportId);
348
- return !o.editable || !e || !E(e);
379
+ return !o.editable || !e || !Y(e);
349
380
  }
350
- async function ve(o) {
351
- if (!E(o)) {
381
+ async function be(o) {
382
+ if (!Y(o)) {
352
383
  l.open({
353
384
  message: a("report.messages.noPermissionDeleteReport"),
354
385
  type: "error"
355
386
  });
356
387
  return;
357
388
  }
358
- await ne({
389
+ await pe({
359
390
  title: a("report.messages.deleteReport"),
360
391
  message: a("report.messages.confirmDelete", { name: o.name })
361
- }) && K(async () => {
392
+ }) && j(async () => {
362
393
  try {
363
394
  await S.removeReport(o), l.open({
364
395
  message: a("report.messages.deleteSuccess", { name: o.name }),
@@ -369,18 +400,18 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
369
400
  }
370
401
  });
371
402
  }
372
- async function be(o) {
373
- if (re.value)
403
+ async function ge(o) {
404
+ if (ie.value)
374
405
  await Ve(o);
375
406
  else {
376
- let e = `Your current plan only support up to ${L.value} custom reports.`;
377
- L.value === 0 && (e = "Your current plan does not support custom report."), l.open({
407
+ let e = `Your current plan only support up to ${T.value} custom reports.`;
408
+ T.value === 0 && (e = "Your current plan does not support custom report."), l.open({
378
409
  message: e,
379
410
  type: "error"
380
411
  });
381
412
  }
382
413
  }
383
- function Ne() {
414
+ function Me() {
384
415
  if (!_e.value) {
385
416
  l.open({
386
417
  message: a("report.messages.noPermission"),
@@ -388,18 +419,18 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
388
419
  });
389
420
  return;
390
421
  }
391
- if (re.value)
422
+ if (ie.value)
392
423
  ke.value = !0;
393
424
  else {
394
- let o = `Your current plan only support up to ${L.value} custom reports.`;
395
- L.value === 0 && (o = "Your current plan does not support custom report."), l.open({
425
+ let o = `Your current plan only support up to ${T.value} custom reports.`;
426
+ T.value === 0 && (o = "Your current plan does not support custom report."), l.open({
396
427
  message: o,
397
428
  type: "error"
398
429
  });
399
430
  }
400
431
  }
401
- function ge(o) {
402
- const e = te(a, J, o.name, "other") ?? "";
432
+ function Se(o) {
433
+ const e = re(a, K, o.name, "other") ?? "";
403
434
  F.value && F.value.includes(o.id) ? (l.open({
404
435
  message: `${a("report.common.unpin")} ${e} ${a("report.common.successful")}`,
405
436
  type: "success"
@@ -408,13 +439,13 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
408
439
  type: "success"
409
440
  }), S.cachePinReport(o));
410
441
  }
411
- function Ue(o) {
412
- V.value = o;
442
+ function Ne(o) {
443
+ L.value = o;
413
444
  }
414
- const { selectedLocationIds: _, dateRange: N, compareDateRange: U, timeRange: w, locations: Me } = Pe(), M = R(() => _.length === Me.length);
445
+ const { selectedLocationIds: _, dateRange: M, compareDateRange: N, timeRange: w, locations: Ue } = xe(), U = h(() => _.length === Ue.length);
415
446
  return (o, e) => {
416
- const r = I("FmPageHead"), n = I("FmSearch"), Z = I("FmForm"), T = I("FmListItem"), D = I("FmList"), A = I("FmTable");
417
- return z(), ee(Ye, null, {
447
+ const r = I("FmPageHead"), n = I("FmSearch"), ae = I("FmForm"), A = I("FmListItem"), D = I("FmList"), z = I("FmTable");
448
+ return B(), se(qe, null, {
418
449
  default: m(() => [
419
450
  c(r, {
420
451
  title: t(a)("report.common.report", 1),
@@ -427,31 +458,31 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
427
458
  prependIcon: "add"
428
459
  }
429
460
  ],
430
- "onClick:action": e[0] || (e[0] = (s) => Ne())
461
+ "onClick:action": e[0] || (e[0] = (s) => Me())
431
462
  }, null, 8, ["title", "actions"]),
432
463
  v("div", {
433
464
  class: g(`overflow-y-hidden flex flex-col gap-8 ${t(p).sm || t(p).xs ? "mb-20" : ""}`),
434
- style: Ae({ height: `calc(100% - ${t(p).lg || t(p).md ? 72 : 64}px)` })
465
+ style: Je({ height: `calc(100% - ${t(p).lg || t(p).md ? 72 : 64}px)` })
435
466
  }, [
436
- c(Z, {
467
+ c(ae, {
437
468
  class: g(`flex items-center gap-2 ${t(p).sm || t(p).xs ? "px-3" : "px-24"}`)
438
469
  }, {
439
470
  default: m(() => [
440
- c(t(Y), null, {
471
+ c(t(G), null, {
441
472
  "menu-button": m(() => [
442
- c(t(H), { class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400" }, {
473
+ c(t(W), { class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400" }, {
443
474
  default: m(() => [
444
- v("p", null, k(t(a)(`report.category.${V.value.label}`)), 1),
445
- c(t(q), { name: "expand_more" })
475
+ v("p", null, k(t(a)(`report.category.${L.value.label}`)), 1),
476
+ c(t(Q), { name: "expand_more" })
446
477
  ]),
447
478
  _: 1
448
479
  })
449
480
  ]),
450
481
  default: m(() => [
451
- (z(!0), ze(Je, null, Be(me.value, (s, C) => (z(), ee(t(x), {
482
+ (B(!0), Be(Ke, null, Ee(ye.value, (s, C) => (B(), se(t(P), {
452
483
  key: C,
453
484
  label: t(a)(`report.category.${s.label}`),
454
- onClick: () => Ue(s)
485
+ onClick: () => Ne(s)
455
486
  }, null, 8, ["label", "onClick"]))), 128))
456
487
  ]),
457
488
  _: 1
@@ -459,28 +490,28 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
459
490
  v("div", {
460
491
  class: g(`flex ${t(p).sm || t(p).xs ? "justify-center items-center" : ""}`)
461
492
  }, [
462
- v("p", nt, k(t(a)("report.common.results", { count: P.value.length })), 1)
493
+ v("p", ct, k(t(a)("report.common.results", { count: x.value.length })), 1)
463
494
  ], 2),
464
495
  e[3] || (e[3] = v("div", { class: "grow" }, null, -1)),
465
- v("div", lt, [
496
+ v("div", it, [
466
497
  c(n, {
467
- modelValue: Q.value,
468
- "onUpdate:modelValue": e[1] || (e[1] = (s) => Q.value = s),
498
+ modelValue: Z.value,
499
+ "onUpdate:modelValue": e[1] || (e[1] = (s) => Z.value = s),
469
500
  class: g(`${t(p).lg || t(p).md ? "grow" : ""}`)
470
501
  }, null, 8, ["modelValue", "class"])
471
502
  ])
472
503
  ]),
473
504
  _: 1
474
505
  }, 8, ["class"]),
475
- he((z(), ee(A, {
476
- key: Oe.value,
506
+ Re((B(), se(z, {
507
+ key: Fe.value,
477
508
  ref_key: "table",
478
- ref: h,
509
+ ref: R,
479
510
  class: g([t(p).sm || t(p).xs ? "px-0" : "px-24", "report-table"]),
480
511
  style: { height: "calc(100% - 40px)" },
481
- "column-defs": Fe.value,
482
- "row-data": P.value,
483
- "page-size": P.value.length,
512
+ "column-defs": Te.value,
513
+ "row-data": x.value,
514
+ "page-size": x.value.length,
484
515
  "hide-footer": !0,
485
516
  "row-class-name": "row",
486
517
  onRowClick: e[2] || (e[2] = (s) => {
@@ -491,19 +522,19 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
491
522
  });
492
523
  return;
493
524
  }
494
- t(Ce).suppressReportRouteSync = !0, t(S).updateCurrentReportId(s.original.reportId), t(oe).push({
525
+ t(Ce).suppressReportRouteSync = !0, t(S).updateCurrentReportId(s.original.reportId), t(ne).push({
495
526
  name: "reportView",
496
527
  query: {
497
- ...t(ae).query,
528
+ ...t(le).query,
498
529
  reportId: s.original.reportId,
499
- startDate: t(N).startDate,
500
- endDate: t(N).endDate,
501
- compareStartDate: t(U).startDate,
502
- compareEndDate: t(U).endDate,
530
+ startDate: t(M).startDate,
531
+ endDate: t(M).endDate,
532
+ compareStartDate: t(N).startDate,
533
+ compareEndDate: t(N).endDate,
503
534
  timeStart: t(w).start ? JSON.stringify(t(w).start) : null,
504
535
  timeEnd: t(w).end ? JSON.stringify(t(w).end) : null,
505
- isAllLocation: M.value.toString(),
506
- locationIds: M.value ? void 0 : t(_) ? JSON.stringify(t(_)) : void 0
536
+ isAllLocation: U.value.toString(),
537
+ locationIds: U.value ? void 0 : t(_) ? JSON.stringify(t(_)) : void 0
507
538
  }
508
539
  });
509
540
  })
@@ -518,44 +549,44 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
518
549
  });
519
550
  return;
520
551
  }
521
- s.reportId && (t(S).updateCurrentReportId(s.reportId), t(oe).push({
552
+ s.reportId && (t(S).updateCurrentReportId(s.reportId), t(ne).push({
522
553
  name: "reportView",
523
554
  query: {
524
- ...t(ae).query,
555
+ ...t(le).query,
525
556
  reportId: s.reportId,
526
- startDate: t(N).startDate,
527
- endDate: t(N).endDate,
528
- compareStartDate: t(U).startDate,
529
- compareEndDate: t(U).endDate,
557
+ startDate: t(M).startDate,
558
+ endDate: t(M).endDate,
559
+ compareStartDate: t(N).startDate,
560
+ compareEndDate: t(N).endDate,
530
561
  timeStart: t(w).start ? JSON.stringify(t(w).start) : null,
531
562
  timeEnd: t(w).end ? JSON.stringify(t(w).end) : null,
532
- isAllLocation: M.value.toString(),
533
- locationIds: M.value ? void 0 : t(_) ? JSON.stringify(t(_)) : void 0
563
+ isAllLocation: U.value.toString(),
564
+ locationIds: U.value ? void 0 : t(_) ? JSON.stringify(t(_)) : void 0
534
565
  }
535
566
  }));
536
567
  }
537
568
  }, {
538
569
  default: m(() => [
539
- c(T, {
570
+ c(A, {
540
571
  tag: "label",
541
572
  clickable: ""
542
573
  }, {
543
574
  append: m(() => [
544
- c(t(H), {
575
+ c(t(W), {
545
576
  class: g(`${s.category !== "Uncategorized" ? "bg-fm-color-system-info-100 text-fm-color-typo-info" : "text-fm-color-typo-secondary"} ${s.canRead ? "" : "opacity-40 cursor-not-allowed"}`),
546
577
  compact: !0
547
578
  }, {
548
579
  default: m(() => [
549
- v("p", ct, k(s.category), 1)
580
+ v("p", pt, k(s.category), 1)
550
581
  ]),
551
582
  _: 2
552
583
  }, 1032, ["class"]),
553
- c(t(Y), {
584
+ c(t(G), {
554
585
  placement: "left",
555
586
  "stop-click-propagation": !0
556
587
  }, {
557
588
  "menu-button": m(() => [
558
- c(t(q), {
589
+ c(t(Q), {
559
590
  name: "more_vert",
560
591
  class: "btn-color"
561
592
  })
@@ -563,92 +594,86 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
563
594
  default: m(() => {
564
595
  var C;
565
596
  return [
566
- c(t(x), {
597
+ c(t(P), {
567
598
  label: s.pin ? "Unpin" : "Pin",
568
599
  onClick: () => {
569
600
  const i = t(f).find(
570
- (u) => u.id === s.reportId
601
+ (y) => y.id === s.reportId
571
602
  );
572
- i && ge(i);
603
+ i && Se(i);
573
604
  }
574
605
  }, null, 8, ["label", "onClick"]),
575
606
  v("div", {
576
607
  role: "menuitem",
577
608
  "data-testid": "mobile-pos-v8-toggle",
578
- tabindex: !s.canUpdate || s.isMandatoryPosReport || b.value.has(s.reportId) ? void 0 : -1,
579
- "aria-disabled": !s.canUpdate || s.isMandatoryPosReport || b.value.has(s.reportId),
609
+ tabindex: !s.canUpdate || s.isMandatoryPosReport || s.reportType === "canvas" || b.value.has(s.reportId) ? void 0 : -1,
610
+ "aria-disabled": !s.canUpdate || s.isMandatoryPosReport || s.reportType === "canvas" || b.value.has(s.reportId),
580
611
  class: g(
581
- !s.canUpdate || s.isMandatoryPosReport || b.value.has(s.reportId) ? "flex max-h-[78px] w-full cursor-not-allowed items-center justify-between gap-2 rounded px-3 py-2 pl-12 text-fm-color-typo-disabled" : "flex max-h-[78px] w-full cursor-pointer items-center justify-between gap-2 rounded px-3 py-2 pl-12 hover:bg-fm-color-opacity-sm"
612
+ !s.canUpdate || s.isMandatoryPosReport || s.reportType === "canvas" || b.value.has(s.reportId) ? "flex max-h-[78px] w-full cursor-not-allowed items-center justify-between gap-2 rounded px-3 py-2 pl-12 text-fm-color-typo-disabled" : "flex max-h-[78px] w-full cursor-pointer items-center justify-between gap-2 rounded px-3 py-2 pl-12 hover:bg-fm-color-opacity-sm"
582
613
  ),
583
614
  onClick: (i) => {
584
- if (i.stopPropagation(), !s.canUpdate) {
585
- t(l).open({
586
- message: t(a)("report.messages.noPermissionUpdateReport"),
587
- type: "error"
588
- });
589
- return;
590
- }
591
- const u = t(f).find(
592
- (y) => y.id === s.reportId
615
+ i.stopPropagation();
616
+ const y = t(f).find(
617
+ (J) => J.id === s.reportId
593
618
  );
594
- u && ye(u);
619
+ y && V(y);
595
620
  }
596
621
  }, [
597
- v("span", pt, k(t(a)("report.common.showInPOS")), 1),
622
+ v("span", ut, k(t(a)("report.common.showInPOS")), 1),
598
623
  v("span", null, [
599
- c(t(de), {
600
- "model-value": Le(
624
+ c(t(fe), {
625
+ "model-value": s.reportType === "canvas" ? !1 : Le(
601
626
  s.reportId,
602
627
  s.isSupportPos
603
628
  ),
604
- disabled: !s.canUpdate || s.isMandatoryPosReport || b.value.has(s.reportId),
629
+ disabled: !s.canUpdate || s.isMandatoryPosReport || s.reportType === "canvas" || b.value.has(s.reportId),
605
630
  "aria-label": "Show in POS v8",
606
631
  class: "pointer-events-none"
607
632
  }, null, 8, ["model-value", "disabled"])
608
633
  ])
609
- ], 10, it),
610
- c(t(x), {
634
+ ], 10, dt),
635
+ c(t(P), {
611
636
  label: t(a)("report.common.duplicate"),
612
- disabled: W(s),
637
+ disabled: te(s),
613
638
  class: g(
614
- W(s) ? "text-fm-color-typo-disabled" : ""
639
+ te(s) ? "text-fm-color-typo-disabled" : ""
615
640
  ),
616
641
  onClick: () => {
617
642
  const i = t(f).find(
618
- (u) => u.id === s.reportId
643
+ (y) => y.id === s.reportId
619
644
  );
620
- i && !W(s) ? be(i) : t(l).open({
645
+ i && !te(s) ? ge(i) : t(l).open({
621
646
  message: t(a)("report.messages.noPermissionDuplicateReport"),
622
647
  type: "error"
623
648
  });
624
649
  }
625
650
  }, null, 8, ["label", "disabled", "class", "onClick"]),
626
- c(t(x), {
651
+ c(t(P), {
627
652
  label: t(a)(
628
- s.reportId === ((C = t(B)) == null ? void 0 : C.id) ? "report.common.unsetAsOverview" : "report.common.setAsOverview"
653
+ s.reportId === ((C = t(E)) == null ? void 0 : C.id) ? "report.common.unsetAsOverview" : "report.common.setAsOverview"
629
654
  ),
630
655
  onClick: () => {
631
656
  const i = t(f).find(
632
- (u) => u.id === s.reportId
657
+ (y) => y.id === s.reportId
633
658
  );
634
- i && fe(i);
659
+ i && ve(i);
635
660
  }
636
661
  }, null, 8, ["label", "onClick"]),
637
- c(t(x), {
662
+ c(t(P), {
638
663
  label: t(a)("report.common.delete"),
639
- disabled: X(s),
664
+ disabled: oe(s),
640
665
  class: g(
641
- X(s) ? "text-fm-color-typo-disabled" : "text-fm-color-typo-error"
666
+ oe(s) ? "text-fm-color-typo-disabled" : "text-fm-color-typo-error"
642
667
  ),
643
668
  onClick: () => {
644
669
  const i = t(f).find(
645
- (u) => u.id === s.reportId
670
+ (y) => y.id === s.reportId
646
671
  );
647
- i && !X(s) && ve(i);
672
+ i && !oe(s) && be(i);
648
673
  }
649
674
  }, {
650
675
  label: m(() => [
651
- Ke(k(t(a)("report.common.delete")), 1)
676
+ je(k(t(a)("report.common.delete")), 1)
652
677
  ]),
653
678
  _: 2
654
679
  }, 1032, ["label", "disabled", "class", "onClick"])
@@ -670,10 +695,10 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
670
695
  ]),
671
696
  _: 1
672
697
  }, 8, ["class", "column-defs", "row-data", "page-size"])), [
673
- [Re, P.value.length > 0]
698
+ [he, x.value.length > 0]
674
699
  ]),
675
- he(c(Ze, null, null, 512), [
676
- [Re, P.value.length === 0]
700
+ Re(c(tt, null, null, 512), [
701
+ [he, x.value.length === 0]
677
702
  ])
678
703
  ], 6)
679
704
  ]),
@@ -683,5 +708,5 @@ const nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt
683
708
  }
684
709
  });
685
710
  export {
686
- Pt as default
711
+ It as default
687
712
  };