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