@feedmepos/mf-report 5.18.2-beta.2 → 5.18.2-beta.4
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-BRjX1jFN.js +221 -0
- package/dist/{ReportEditor-Db1Ll1hk.js → ReportEditor-C6TXPHhT.js} +180 -181
- package/dist/ReportView-CUEWuq1w.js +194 -0
- package/dist/app.js +3 -3
- package/package.json +1 -1
- package/dist/App-2aEdytBx.js +0 -157
- package/dist/ReportView-BQb_myNM.js +0 -246
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { defineComponent as z, computed as v, resolveComponent as H, createBlock as g, openBlock as u, withCtx as M, createVNode as h, createElementVNode as R, unref as o, normalizeStyle as Y, normalizeClass as D, createElementBlock as $, Fragment as G, renderList as Q } from "vue";
|
|
2
|
+
import { _ as U } from "./MenuTab.vue_vue_type_script_setup_true_lang-C8oiHuOX.js";
|
|
3
|
+
import { _ as W } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-DKA5lLXB.js";
|
|
4
|
+
import { useRouter as K, useRoute as X } from "vue-router";
|
|
5
|
+
import { _ as Z } from "./Default.vue_vue_type_script_setup_true_lang-DpSgAipe.js";
|
|
6
|
+
import { a as ee } from "./BaseDialog.vue_vue_type_script_setup_true_lang-djyc20Cp.js";
|
|
7
|
+
import { storeToRefs as p } from "pinia";
|
|
8
|
+
import { b as oe, c as te, u as re } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CDxb2Mjg.js";
|
|
9
|
+
import { _ as ae } from "./NoData.vue_vue_type_script_setup_true_lang-Divo8W18.js";
|
|
10
|
+
import { useSnackbar as le, useBreakpoints as ne } from "@feedmepos/ui-library";
|
|
11
|
+
import { u as ie, f as se, e as ue } from "./vue-i18n-CTLGxUiF.js";
|
|
12
|
+
import { u as ce } from "./message-dialog-UoMWOnil.js";
|
|
13
|
+
import { r as pe } from "./i18n-Cif1I9J2.js";
|
|
14
|
+
const me = { class: "sticky top-0 z-10 bg-white" }, De = /* @__PURE__ */ z({
|
|
15
|
+
__name: "ReportView",
|
|
16
|
+
setup(de) {
|
|
17
|
+
const { t: r, te: P } = ie(), m = K(), c = X(), s = le(), { promptMessage: E } = ce(), d = ee(), b = oe(), { promptLoader: I } = se(), { breakpoints: n } = ne(), {
|
|
18
|
+
currentReport: t,
|
|
19
|
+
currentReportId: f,
|
|
20
|
+
isOpenDownloadDialog: O,
|
|
21
|
+
isOpenEmailDialog: J,
|
|
22
|
+
editingReport: N,
|
|
23
|
+
canCreateCustomReport: q,
|
|
24
|
+
customReportQuota: y
|
|
25
|
+
} = p(d), { isOpenAccountingDialog: A } = p(te()), { isOpenScheduleDialog: _ } = p(re()), { disabled: B } = p(ue()), L = v(() => {
|
|
26
|
+
const l = [
|
|
27
|
+
{
|
|
28
|
+
icon: "mail",
|
|
29
|
+
label: r("report.common.emailSchedule"),
|
|
30
|
+
onClick: () => {
|
|
31
|
+
_.value = !0;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
// {
|
|
35
|
+
// icon: "article",
|
|
36
|
+
// label: "Set as Default",
|
|
37
|
+
// onClick: async () => {
|
|
38
|
+
// await promptLoader(async () => {
|
|
39
|
+
// if (currentReport.value) {
|
|
40
|
+
// try {
|
|
41
|
+
// await reportStore.updateDefaultReport(currentReport.value.id)
|
|
42
|
+
// snackbar.open({
|
|
43
|
+
// message: `Set ${currentReport.value.name} as default successful`,
|
|
44
|
+
// type: "success"
|
|
45
|
+
// })
|
|
46
|
+
// } catch (err) {
|
|
47
|
+
// snackbar.open({ message: JSON.stringify(err), type: "error" })
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// })
|
|
51
|
+
// }
|
|
52
|
+
// },
|
|
53
|
+
{
|
|
54
|
+
icon: "content_copy",
|
|
55
|
+
label: r("report.common.copyID"),
|
|
56
|
+
onClick: () => {
|
|
57
|
+
t.value && (navigator.clipboard.writeText(f.value), s.open({ message: r("report.messages.copiedReportIdToClipboard"), type: "success" }));
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
icon: "report_jobs",
|
|
62
|
+
label: r("report.common.reportStatus"),
|
|
63
|
+
onClick: () => {
|
|
64
|
+
k();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
return B.value || l.splice(1, 0, {
|
|
69
|
+
icon: "download",
|
|
70
|
+
label: r("report.common.accountingExport"),
|
|
71
|
+
onClick: C
|
|
72
|
+
}), l;
|
|
73
|
+
});
|
|
74
|
+
async function k() {
|
|
75
|
+
b.isOpenJobDialog = !0, await b.getJobs();
|
|
76
|
+
}
|
|
77
|
+
function T() {
|
|
78
|
+
N.value = JSON.parse(JSON.stringify(t.value)), m.push({
|
|
79
|
+
name: "reportEditor",
|
|
80
|
+
query: c.query
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async function j() {
|
|
84
|
+
if (!q.value) {
|
|
85
|
+
let e = `Your current plan only support up to ${y.value} custom reports.`;
|
|
86
|
+
y.value === 0 && (e = "Your current plan does not support custom report."), s.open({
|
|
87
|
+
message: e,
|
|
88
|
+
type: "error"
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (!t.value) {
|
|
93
|
+
s.open({ message: "No Widget", type: "error" });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (await E({
|
|
97
|
+
title: `${r("report.messages.saveReport")}`,
|
|
98
|
+
message: r("report.messages.confirmAction", {
|
|
99
|
+
action: r("report.common.duplicate"),
|
|
100
|
+
name: t.value.name
|
|
101
|
+
})
|
|
102
|
+
}) && t.value) {
|
|
103
|
+
const e = JSON.parse(JSON.stringify(t.value));
|
|
104
|
+
e.editable = !0, e.id = "", e.name = `${e.name} duplicate`;
|
|
105
|
+
try {
|
|
106
|
+
await I(async () => {
|
|
107
|
+
const i = await d.createOrUpdateReport(e);
|
|
108
|
+
d.updateCurrentReportId(i.id), m.push({
|
|
109
|
+
name: "reportView",
|
|
110
|
+
params: c.params,
|
|
111
|
+
query: c.query
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
} catch (i) {
|
|
115
|
+
console.log(i), s.open({ message: "Failed to clone report", type: "error" });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function C() {
|
|
120
|
+
A.value = !0;
|
|
121
|
+
}
|
|
122
|
+
function F() {
|
|
123
|
+
t.value && (navigator.clipboard.writeText(f.value), s.open({ message: "Copied report ID to clipboard", type: "success" }));
|
|
124
|
+
}
|
|
125
|
+
const x = v(() => t.value ? t.value.tiles : []), V = v(() => {
|
|
126
|
+
var e;
|
|
127
|
+
let l = [
|
|
128
|
+
(e = t == null ? void 0 : t.value) != null && e.editable ? { label: r("report.common.edit"), value: "edit", isPrimary: !1 } : {
|
|
129
|
+
label: r("report.common.duplicate"),
|
|
130
|
+
value: "duplicate",
|
|
131
|
+
isPrimary: !1
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
label: r("report.common.download"),
|
|
135
|
+
value: "download",
|
|
136
|
+
isPrimary: !0,
|
|
137
|
+
prependIcon: "download"
|
|
138
|
+
},
|
|
139
|
+
{ label: r("report.schedule.sendEmail"), value: "email", isPrimary: !0 }
|
|
140
|
+
];
|
|
141
|
+
return n.value.xs && (l = [
|
|
142
|
+
...l,
|
|
143
|
+
{ label: "Send Email", value: "email", isPrimary: !1 },
|
|
144
|
+
{ label: "Job Delivery Status", value: "report_jobs", isPrimary: !1 },
|
|
145
|
+
{ label: "Email schedule", value: "schedule_email", isPrimary: !1 },
|
|
146
|
+
{ label: "Accounting export", value: "export", isPrimary: !1 },
|
|
147
|
+
{ label: "Copy ID", value: "content_copy", isPrimary: !1 }
|
|
148
|
+
], l = l.filter((i) => i.value !== "edit")), l;
|
|
149
|
+
});
|
|
150
|
+
return (l, e) => {
|
|
151
|
+
const i = H("FmPageHead");
|
|
152
|
+
return u(), g(Z, null, {
|
|
153
|
+
default: M(() => {
|
|
154
|
+
var S;
|
|
155
|
+
return [
|
|
156
|
+
h(i, {
|
|
157
|
+
title: o(pe)(o(r), o(P), (S = o(t)) == null ? void 0 : S.name, "other"),
|
|
158
|
+
"back-button": !0,
|
|
159
|
+
actions: V.value,
|
|
160
|
+
"onClick:back": e[0] || (e[0] = (a) => o(m).push({ name: "reports", query: o(c).query })),
|
|
161
|
+
"onClick:action": e[1] || (e[1] = (a) => {
|
|
162
|
+
a === "duplicate" && j(), a === "download" && (O.value = !0), a === "email" && (J.value = !0), a === "edit" && T(), a === "schedule_email" && (_.value = !0), a === "content_copy" && F(), a === "export" && C(), a === "report_jobs" && k();
|
|
163
|
+
})
|
|
164
|
+
}, null, 8, ["title", "actions"]),
|
|
165
|
+
R("div", {
|
|
166
|
+
class: D(`flex flex-col overflow-y-auto ${o(n).xs || o(n).sm ? "pb-20" : ""}`),
|
|
167
|
+
style: Y({ height: `calc(100% - ${o(n).lg || o(n).md ? 72 : 64}px)` })
|
|
168
|
+
}, [
|
|
169
|
+
R("div", me, [
|
|
170
|
+
h(U, {
|
|
171
|
+
"model-value": o(n).lg || o(n).md ? L.value : []
|
|
172
|
+
}, null, 8, ["model-value"])
|
|
173
|
+
]),
|
|
174
|
+
o(t) && x.value.length > 0 ? (u(), $("div", {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: D(["grid grid-cols-12", o(n).sm || o(n).xs ? "px-3 gap-[16px]" : "px-24 gap-[24px]"])
|
|
177
|
+
}, [
|
|
178
|
+
(u(!0), $(G, null, Q(x.value, (a, w) => (u(), g(W, {
|
|
179
|
+
key: `widget_${o(f)}_${w}`,
|
|
180
|
+
"model-value": a,
|
|
181
|
+
index: w
|
|
182
|
+
}, null, 8, ["model-value", "index"]))), 128))
|
|
183
|
+
], 2)) : (u(), g(ae, { key: 1 }))
|
|
184
|
+
], 6)
|
|
185
|
+
];
|
|
186
|
+
}),
|
|
187
|
+
_: 1
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
export {
|
|
193
|
+
De as default
|
|
194
|
+
};
|
package/dist/app.js
CHANGED
|
@@ -4975,12 +4975,12 @@ const a = {
|
|
|
4975
4975
|
{
|
|
4976
4976
|
path: "/report-view",
|
|
4977
4977
|
name: "reportView",
|
|
4978
|
-
component: () => import("./ReportView-
|
|
4978
|
+
component: () => import("./ReportView-CUEWuq1w.js")
|
|
4979
4979
|
},
|
|
4980
4980
|
{
|
|
4981
4981
|
path: "/report-editor",
|
|
4982
4982
|
name: "reportEditor",
|
|
4983
|
-
component: () => import("./ReportEditor-
|
|
4983
|
+
component: () => import("./ReportEditor-C6TXPHhT.js")
|
|
4984
4984
|
},
|
|
4985
4985
|
{
|
|
4986
4986
|
path: "/report-editor/tile-editor",
|
|
@@ -5028,7 +5028,7 @@ const u = {
|
|
|
5028
5028
|
"zh-CN": m,
|
|
5029
5029
|
"th-TH": c,
|
|
5030
5030
|
"zh-Hant": p
|
|
5031
|
-
}, h = e(() => import("./App-
|
|
5031
|
+
}, h = e(() => import("./App-BRjX1jFN.js"));
|
|
5032
5032
|
export {
|
|
5033
5033
|
h as FmApp,
|
|
5034
5034
|
u as i18nMessages,
|
package/package.json
CHANGED
package/dist/App-2aEdytBx.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { defineComponent as x, resolveComponent as C, createBlock as T, openBlock as m, unref as r, isRef as Z, withCtx as b, createElementVNode as V, createVNode as $, toDisplayString as D, createTextVNode as M, onMounted as z, watch as g, ref as J, computed as O, onBeforeMount as ee, onBeforeUnmount as te, createElementBlock as w, Fragment as oe } from "vue";
|
|
2
|
-
import { detectLocale as h, useCoreStore as k } from "@feedmepos/mf-common";
|
|
3
|
-
import { u as re, d as F, a as ae, b as se, c as ne, e as le, f as ue, s as ie, g as ce } from "./vue-i18n-CTLGxUiF.js";
|
|
4
|
-
import { storeToRefs as B } from "pinia";
|
|
5
|
-
import { u as me, a as de, b as ve } from "./BaseDialog.vue_vue_type_script_setup_true_lang-djyc20Cp.js";
|
|
6
|
-
import { _ as pe, u as fe } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CDxb2Mjg.js";
|
|
7
|
-
import { u as U } from "./message-dialog-UoMWOnil.js";
|
|
8
|
-
import { useRoute as ge, useRouter as he } from "vue-router";
|
|
9
|
-
const _e = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, ye = /* @__PURE__ */ x({
|
|
10
|
-
__name: "Dialog",
|
|
11
|
-
setup(d) {
|
|
12
|
-
const { t } = re(), s = U(), { isOpened: a, message: i, title: c } = B(U());
|
|
13
|
-
return (v, l) => {
|
|
14
|
-
const p = C("FmButton"), _ = C("FmDialog");
|
|
15
|
-
return m(), T(_, {
|
|
16
|
-
modelValue: r(a),
|
|
17
|
-
"onUpdate:modelValue": l[0] || (l[0] = (y) => Z(a) ? a.value = y : null),
|
|
18
|
-
overlay: "",
|
|
19
|
-
"close-button": !1
|
|
20
|
-
}, {
|
|
21
|
-
"dialog-header": b(() => [
|
|
22
|
-
M(D(r(c)), 1)
|
|
23
|
-
]),
|
|
24
|
-
default: b(() => [
|
|
25
|
-
V("p", _e, D(r(i)), 1)
|
|
26
|
-
]),
|
|
27
|
-
"dialog-footer": b(() => [
|
|
28
|
-
l[1] || (l[1] = V("div", { class: "grow" }, null, -1)),
|
|
29
|
-
$(p, {
|
|
30
|
-
label: r(t)("report.common.cancel"),
|
|
31
|
-
variant: "tertiary",
|
|
32
|
-
onClick: r(s).dismiss
|
|
33
|
-
}, null, 8, ["label", "onClick"]),
|
|
34
|
-
$(p, {
|
|
35
|
-
label: r(t)("report.common.confirm"),
|
|
36
|
-
onClick: r(s).confirm
|
|
37
|
-
}, null, 8, ["label", "onClick"])
|
|
38
|
-
]),
|
|
39
|
-
_: 1
|
|
40
|
-
}, 8, ["modelValue"]);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}), q = J(h());
|
|
44
|
-
function Se() {
|
|
45
|
-
const d = (t) => {
|
|
46
|
-
switch (q.value = t, t) {
|
|
47
|
-
case "zh-CN":
|
|
48
|
-
F.locale("zh-cn");
|
|
49
|
-
break;
|
|
50
|
-
default:
|
|
51
|
-
F.locale("en");
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return z(() => {
|
|
56
|
-
d(h());
|
|
57
|
-
}), g(() => h(), d, { deep: !0, immediate: !0 }), {
|
|
58
|
-
currentLocale: q
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
F.locale(h() === "zh-CN" ? "zh-cn" : "en");
|
|
62
|
-
const be = ["src"], we = ["src"], Le = /* @__PURE__ */ x({
|
|
63
|
-
__name: "App",
|
|
64
|
-
setup(d) {
|
|
65
|
-
const { businessId: t, token: s, country: a } = B(ae()), { sessionUser: i, currentBusiness: c, currentCountry: v, registerSidebarComponent: l } = k(), { getRestaurantAndWarehouse: p, getBusinessSetting: _ } = se(), { getFeatureFlags: y } = ne(), { version: n } = B(me()), { getSettings: j } = le(), { promptLoader: A } = ue(), u = ge(), W = he(), G = O(() => `https://portal-v1.feedmedev.cc/b/${t.value}/report/CLOSE_UP?showHeader=false&country=${a.value.toUpperCase()}&menuOption=business-report&token=${s.value}&v2=true&reportV5Button=true`), K = O(() => `https://report-v4.feedmedev.cc?businessId=${t.value}&country=${a.value}&token=${s.value}&reportV3Button=true`);
|
|
66
|
-
g(
|
|
67
|
-
[() => c.value, () => i.value, () => v.value],
|
|
68
|
-
() => {
|
|
69
|
-
var e, f;
|
|
70
|
-
const o = ((e = c.value) == null ? void 0 : e.id) ?? "";
|
|
71
|
-
c.value && i.value && v.value && (ie(a.value), t.value !== o && (t.value = o), s.value = ((f = i.value) == null ? void 0 : f.token) ?? "", a.value = v.value ?? "", u.query.businessId !== t.value && W.replace({
|
|
72
|
-
name: u.name,
|
|
73
|
-
params: u.params,
|
|
74
|
-
query: { ...u.query, businessId: t.value }
|
|
75
|
-
}));
|
|
76
|
-
},
|
|
77
|
-
{ immediate: !0 }
|
|
78
|
-
);
|
|
79
|
-
function R(o) {
|
|
80
|
-
if (typeof o.data == "string")
|
|
81
|
-
try {
|
|
82
|
-
const e = JSON.parse(o.data);
|
|
83
|
-
(e == null ? void 0 : e.token) !== "" && (e == null ? void 0 : e.token) !== void 0 && (s.value = e.token);
|
|
84
|
-
} catch (e) {
|
|
85
|
-
console.error(e);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function E(o) {
|
|
89
|
-
if (typeof o.data == "string")
|
|
90
|
-
try {
|
|
91
|
-
const e = JSON.parse(o.data);
|
|
92
|
-
(e == null ? void 0 : e.v5) === !0 ? n.value = S.value : (e == null ? void 0 : e.v3) === !0 && (n.value = "v3");
|
|
93
|
-
} catch (e) {
|
|
94
|
-
console.error(e);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
g(n, () => {
|
|
98
|
-
["v3", "v4"].includes(n.value) ? k().hideSidebarToggle(!0) : k().hideSidebarToggle(!1);
|
|
99
|
-
}), ee(() => {
|
|
100
|
-
l(pe);
|
|
101
|
-
}), z(() => {
|
|
102
|
-
console.log("5.18.2-beta.2", !0), window.addEventListener("message", R), window.addEventListener("message", E);
|
|
103
|
-
});
|
|
104
|
-
const I = de(), L = fe();
|
|
105
|
-
te(() => {
|
|
106
|
-
window.removeEventListener("message", R), window.removeEventListener("message", E), I.$dispose(), L.$dispose();
|
|
107
|
-
});
|
|
108
|
-
const { getReports: P, getOverviewReport: H, getReportConfig: N } = I, { getSchema: Q } = ve(), { fetchSchedules: X } = L, { init: Y } = ce(), S = J("v5");
|
|
109
|
-
return g(
|
|
110
|
-
() => t.value,
|
|
111
|
-
() => {
|
|
112
|
-
t.value !== "" && A(async () => {
|
|
113
|
-
await Y({
|
|
114
|
-
apiKey: "MaGoXrEWuEJNpWgKTqseee",
|
|
115
|
-
url: "https://flag.feedme.farm/api/v1/",
|
|
116
|
-
enableAnalytics: !1,
|
|
117
|
-
cacheFlags: !1
|
|
118
|
-
});
|
|
119
|
-
const o = await N();
|
|
120
|
-
S.value = o.version, n.value = S.value, await Promise.all([
|
|
121
|
-
y(),
|
|
122
|
-
N(),
|
|
123
|
-
H(),
|
|
124
|
-
P(),
|
|
125
|
-
Q(),
|
|
126
|
-
X(),
|
|
127
|
-
_(),
|
|
128
|
-
p(
|
|
129
|
-
u.query.locationIds ? JSON.parse(u.query.locationIds) : null
|
|
130
|
-
),
|
|
131
|
-
j()
|
|
132
|
-
]);
|
|
133
|
-
});
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
immediate: !0
|
|
137
|
-
}
|
|
138
|
-
), Se(), (o, e) => {
|
|
139
|
-
const f = C("router-view");
|
|
140
|
-
return m(), w(oe, null, [
|
|
141
|
-
$(ye),
|
|
142
|
-
r(n) === "v3" ? (m(), w("iframe", {
|
|
143
|
-
key: 0,
|
|
144
|
-
class: "bg-white h-full w-full",
|
|
145
|
-
src: G.value
|
|
146
|
-
}, null, 8, be)) : r(n) === "v4" ? (m(), w("iframe", {
|
|
147
|
-
key: 1,
|
|
148
|
-
class: "bg-white h-full w-full",
|
|
149
|
-
src: K.value
|
|
150
|
-
}, null, 8, we)) : (m(), T(f, { key: 2 }))
|
|
151
|
-
], 64);
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
export {
|
|
156
|
-
Le as default
|
|
157
|
-
};
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { defineComponent as K, computed as c, onMounted as X, watch as Z, resolveComponent as ee, createBlock as I, openBlock as f, withCtx as te, createVNode as E, createElementVNode as J, unref as n, normalizeStyle as ae, normalizeClass as L, createElementBlock as N, Fragment as re, renderList as oe } from "vue";
|
|
2
|
-
import { _ as ne } from "./MenuTab.vue_vue_type_script_setup_true_lang-C8oiHuOX.js";
|
|
3
|
-
import { _ as se } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-DKA5lLXB.js";
|
|
4
|
-
import { useRouter as ie, useRoute as le } from "vue-router";
|
|
5
|
-
import { _ as ue } from "./Default.vue_vue_type_script_setup_true_lang-DpSgAipe.js";
|
|
6
|
-
import { a as ce } from "./BaseDialog.vue_vue_type_script_setup_true_lang-djyc20Cp.js";
|
|
7
|
-
import { storeToRefs as _ } from "pinia";
|
|
8
|
-
import { b as de, c as pe, u as me } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CDxb2Mjg.js";
|
|
9
|
-
import { _ as fe } from "./NoData.vue_vue_type_script_setup_true_lang-Divo8W18.js";
|
|
10
|
-
import { useSnackbar as ge, useBreakpoints as ve } from "@feedmepos/ui-library";
|
|
11
|
-
import { u as ye, b as De, f as Se, d, e as be } from "./vue-i18n-CTLGxUiF.js";
|
|
12
|
-
import { u as Re } from "./message-dialog-UoMWOnil.js";
|
|
13
|
-
import { r as _e } from "./i18n-Cif1I9J2.js";
|
|
14
|
-
const Ie = { class: "sticky top-0 z-10 bg-white" }, Pe = /* @__PURE__ */ K({
|
|
15
|
-
__name: "ReportView",
|
|
16
|
-
setup(Ce) {
|
|
17
|
-
const { t: s, te: $ } = ye(), g = ie(), e = le(), m = ge(), { promptMessage: M } = Re(), v = ce(), C = de(), l = De(), { promptLoader: P } = Se(), { breakpoints: u } = ve(), {
|
|
18
|
-
currentReport: r,
|
|
19
|
-
currentReportId: k,
|
|
20
|
-
isOpenDownloadDialog: A,
|
|
21
|
-
isOpenEmailDialog: T,
|
|
22
|
-
editingReport: F,
|
|
23
|
-
canCreateCustomReport: j,
|
|
24
|
-
customReportQuota: q
|
|
25
|
-
} = _(v), y = c(() => e.query.reportId || k.value), D = c(() => ({
|
|
26
|
-
startDate: e.query.startDate ? d(e.query.startDate).startOf("day").toISOString() : void 0,
|
|
27
|
-
endDate: e.query.endDate ? d(e.query.endDate).endOf("day").toISOString() : void 0
|
|
28
|
-
})), S = c(() => ({
|
|
29
|
-
startDate: e.query.compareStartDate ? d(e.query.compareStartDate).startOf("day").toISOString() : void 0,
|
|
30
|
-
endDate: e.query.compareEndDate ? d(e.query.compareEndDate).endOf("day").toISOString() : void 0
|
|
31
|
-
})), b = c(() => ({
|
|
32
|
-
start: e.query.timeStart ? JSON.parse(e.query.timeStart) : void 0,
|
|
33
|
-
end: e.query.timeEnd ? JSON.parse(e.query.timeEnd) : void 0
|
|
34
|
-
})), O = c(() => e.query.isAllLocation === "true"), B = c(() => O.value ? l.selectedLocationIds : e.query.locationIds ? JSON.parse(e.query.locationIds) : void 0);
|
|
35
|
-
X(() => {
|
|
36
|
-
const a = y.value;
|
|
37
|
-
a && a !== k.value && (v.updateCurrentReportId(a), (D.value.startDate || D.value.endDate) && l.setDateRange({
|
|
38
|
-
startDate: D.value.startDate,
|
|
39
|
-
endDate: D.value.endDate
|
|
40
|
-
}), (S.value.startDate || S.value.endDate) && l.setCompareDateRange({
|
|
41
|
-
startDate: S.value.startDate,
|
|
42
|
-
endDate: S.value.endDate
|
|
43
|
-
}), (b.value.start || b.value.end) && l.setTimeRange({
|
|
44
|
-
start: b.value.start,
|
|
45
|
-
end: b.value.end
|
|
46
|
-
}), O.value || l.setSelectedLocationIds(B.value));
|
|
47
|
-
}), Z(
|
|
48
|
-
() => ({
|
|
49
|
-
selectedLocationIds: l.selectedLocationIds,
|
|
50
|
-
dateRange: l.dateRange,
|
|
51
|
-
timeRange: l.timeRange,
|
|
52
|
-
compareDateRange: l.compareDateRange
|
|
53
|
-
}),
|
|
54
|
-
(a) => {
|
|
55
|
-
const t = a.selectedLocationIds, i = a.dateRange, p = a.timeRange, o = a.compareDateRange;
|
|
56
|
-
if (!r.value) return;
|
|
57
|
-
const R = {
|
|
58
|
-
...e.query,
|
|
59
|
-
reportId: r.value.id,
|
|
60
|
-
startDate: i.startDate ? d(i.startDate).format("YYYY-MM-DD") : void 0,
|
|
61
|
-
endDate: i.endDate ? d(i.endDate).format("YYYY-MM-DD") : void 0,
|
|
62
|
-
compareStartDate: o.startDate ? d(o.startDate).format("YYYY-MM-DD") : void 0,
|
|
63
|
-
compareEndDate: o.endDate ? d(o.endDate).format("YYYY-MM-DD") : void 0,
|
|
64
|
-
timeStart: p.start ? JSON.stringify(p.start) : void 0,
|
|
65
|
-
timeEnd: p.end ? JSON.stringify(p.end) : void 0,
|
|
66
|
-
locationIds: t.length === l.locations.length ? null : t.length > 0 ? JSON.stringify(t) : void 0,
|
|
67
|
-
isAllLocation: String(t.length === l.locations.length)
|
|
68
|
-
};
|
|
69
|
-
g.replace({
|
|
70
|
-
name: e.name,
|
|
71
|
-
params: e.params,
|
|
72
|
-
query: R
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
{ deep: !0 }
|
|
76
|
-
);
|
|
77
|
-
const { isOpenAccountingDialog: z } = _(pe()), { isOpenScheduleDialog: w } = _(me()), { disabled: H } = _(be()), Q = c(() => {
|
|
78
|
-
const a = [
|
|
79
|
-
{
|
|
80
|
-
icon: "mail",
|
|
81
|
-
label: s("report.common.emailSchedule"),
|
|
82
|
-
onClick: () => {
|
|
83
|
-
w.value = !0;
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
// {
|
|
87
|
-
// icon: "article",
|
|
88
|
-
// label: "Set as Default",
|
|
89
|
-
// onClick: async () => {
|
|
90
|
-
// await promptLoader(async () => {
|
|
91
|
-
// if (currentReport.value) {
|
|
92
|
-
// try {
|
|
93
|
-
// await reportStore.updateDefaultReport(currentReport.value.id)
|
|
94
|
-
// snackbar.open({
|
|
95
|
-
// message: `Set ${currentReport.value.name} as default successful`,
|
|
96
|
-
// type: "success"
|
|
97
|
-
// })
|
|
98
|
-
// } catch (err) {
|
|
99
|
-
// snackbar.open({ message: JSON.stringify(err), type: "error" })
|
|
100
|
-
// }
|
|
101
|
-
// }
|
|
102
|
-
// })
|
|
103
|
-
// }
|
|
104
|
-
// },
|
|
105
|
-
{
|
|
106
|
-
icon: "content_copy",
|
|
107
|
-
label: s("report.common.copyID"),
|
|
108
|
-
onClick: () => {
|
|
109
|
-
r.value && (navigator.clipboard.writeText(y.value), m.open({ message: s("report.messages.copiedReportIdToClipboard"), type: "success" }));
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
icon: "report_jobs",
|
|
114
|
-
label: s("report.common.reportStatus"),
|
|
115
|
-
onClick: () => {
|
|
116
|
-
h();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
];
|
|
120
|
-
return H.value || a.splice(1, 0, {
|
|
121
|
-
icon: "download",
|
|
122
|
-
label: s("report.common.accountingExport"),
|
|
123
|
-
onClick: x
|
|
124
|
-
}), a;
|
|
125
|
-
});
|
|
126
|
-
async function h() {
|
|
127
|
-
C.isOpenJobDialog = !0, await C.getJobs();
|
|
128
|
-
}
|
|
129
|
-
function G() {
|
|
130
|
-
F.value = JSON.parse(JSON.stringify(r.value)), g.push({
|
|
131
|
-
name: "reportEditor",
|
|
132
|
-
query: e.query
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
async function U() {
|
|
136
|
-
if (!j.value) {
|
|
137
|
-
let t = `Your current plan only support up to ${q.value} custom reports.`;
|
|
138
|
-
q.value === 0 && (t = "Your current plan does not support custom report."), m.open({
|
|
139
|
-
message: t,
|
|
140
|
-
type: "error"
|
|
141
|
-
});
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (!r.value) {
|
|
145
|
-
m.open({ message: "No Widget", type: "error" });
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (await M({
|
|
149
|
-
title: `${s("report.messages.saveReport")}`,
|
|
150
|
-
message: s("report.messages.confirmAction", {
|
|
151
|
-
action: s("report.common.duplicate"),
|
|
152
|
-
name: r.value.name
|
|
153
|
-
})
|
|
154
|
-
}) && r.value) {
|
|
155
|
-
const t = JSON.parse(JSON.stringify(r.value));
|
|
156
|
-
t.editable = !0, t.id = "", t.name = `${t.name} duplicate`;
|
|
157
|
-
try {
|
|
158
|
-
await P(async () => {
|
|
159
|
-
const i = await v.createOrUpdateReport(t);
|
|
160
|
-
v.updateCurrentReportId(i.id), g.push({
|
|
161
|
-
name: "reportView",
|
|
162
|
-
params: { reportId: i.id, ...e.params },
|
|
163
|
-
query: e.query
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
} catch (i) {
|
|
167
|
-
console.log(i), m.open({ message: "Failed to clone report", type: "error" });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function x() {
|
|
172
|
-
z.value = !0;
|
|
173
|
-
}
|
|
174
|
-
function V() {
|
|
175
|
-
r.value && (navigator.clipboard.writeText(y.value), m.open({ message: "Copied report ID to clipboard", type: "success" }));
|
|
176
|
-
}
|
|
177
|
-
const Y = c(() => r.value ? r.value.tiles : []), W = c(() => {
|
|
178
|
-
var t;
|
|
179
|
-
let a = [
|
|
180
|
-
(t = r == null ? void 0 : r.value) != null && t.editable ? { label: s("report.common.edit"), value: "edit", isPrimary: !1 } : {
|
|
181
|
-
label: s("report.common.duplicate"),
|
|
182
|
-
value: "duplicate",
|
|
183
|
-
isPrimary: !1
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
label: s("report.common.download"),
|
|
187
|
-
value: "download",
|
|
188
|
-
isPrimary: !0,
|
|
189
|
-
prependIcon: "download"
|
|
190
|
-
},
|
|
191
|
-
{ label: s("report.schedule.sendEmail"), value: "email", isPrimary: !0 }
|
|
192
|
-
];
|
|
193
|
-
return u.value.xs && (a = [
|
|
194
|
-
...a,
|
|
195
|
-
{ label: "Send Email", value: "email", isPrimary: !1 },
|
|
196
|
-
{ label: "Job Delivery Status", value: "report_jobs", isPrimary: !1 },
|
|
197
|
-
{ label: "Email schedule", value: "schedule_email", isPrimary: !1 },
|
|
198
|
-
{ label: "Accounting export", value: "export", isPrimary: !1 },
|
|
199
|
-
{ label: "Copy ID", value: "content_copy", isPrimary: !1 }
|
|
200
|
-
], a = a.filter((i) => i.value !== "edit")), a;
|
|
201
|
-
});
|
|
202
|
-
return (a, t) => {
|
|
203
|
-
const i = ee("FmPageHead");
|
|
204
|
-
return f(), I(ue, null, {
|
|
205
|
-
default: te(() => {
|
|
206
|
-
var p;
|
|
207
|
-
return [
|
|
208
|
-
E(i, {
|
|
209
|
-
title: n(_e)(n(s), n($), (p = n(r)) == null ? void 0 : p.name, "other"),
|
|
210
|
-
"back-button": !0,
|
|
211
|
-
actions: W.value,
|
|
212
|
-
"onClick:back": t[0] || (t[0] = (o) => n(g).push({ name: "reports", query: n(e).query })),
|
|
213
|
-
"onClick:action": t[1] || (t[1] = (o) => {
|
|
214
|
-
o === "duplicate" && U(), o === "download" && (A.value = !0), o === "email" && (T.value = !0), o === "edit" && G(), o === "schedule_email" && (w.value = !0), o === "content_copy" && V(), o === "export" && x(), o === "report_jobs" && h();
|
|
215
|
-
})
|
|
216
|
-
}, null, 8, ["title", "actions"]),
|
|
217
|
-
J("div", {
|
|
218
|
-
class: L(`flex flex-col overflow-y-auto ${n(u).xs || n(u).sm ? "pb-20" : ""}`),
|
|
219
|
-
style: ae({ height: `calc(100% - ${n(u).lg || n(u).md ? 72 : 64}px)` })
|
|
220
|
-
}, [
|
|
221
|
-
J("div", Ie, [
|
|
222
|
-
E(ne, {
|
|
223
|
-
"model-value": n(u).lg || n(u).md ? Q.value : []
|
|
224
|
-
}, null, 8, ["model-value"])
|
|
225
|
-
]),
|
|
226
|
-
n(r) && Y.value.length > 0 ? (f(), N("div", {
|
|
227
|
-
key: 0,
|
|
228
|
-
class: L(["grid grid-cols-12", n(u).sm || n(u).xs ? "px-3 gap-[16px]" : "px-24 gap-[24px]"])
|
|
229
|
-
}, [
|
|
230
|
-
(f(!0), N(re, null, oe(Y.value, (o, R) => (f(), I(se, {
|
|
231
|
-
key: `widget_${y.value}_${R}`,
|
|
232
|
-
"model-value": o,
|
|
233
|
-
index: R
|
|
234
|
-
}, null, 8, ["model-value", "index"]))), 128))
|
|
235
|
-
], 2)) : (f(), I(fe, { key: 1 }))
|
|
236
|
-
], 6)
|
|
237
|
-
];
|
|
238
|
-
}),
|
|
239
|
-
_: 1
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
export {
|
|
245
|
-
Pe as default
|
|
246
|
-
};
|