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