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