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