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