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