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