@feedmepos/mf-report 5.3.15-rc.9 → 5.4.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.
@@ -0,0 +1,183 @@
1
+ import { defineComponent as A, computed as J, resolveComponent as p, openBlock as a, createBlock as m, withCtx as u, createElementVNode as d, createVNode as i, unref as e, toDisplayString as L, createElementBlock as f, Fragment as S, renderList as $, normalizeClass as h, normalizeStyle as z, withDirectives as j, vShow as G } from "vue";
2
+ import { _ as U } from "./HeaderTab.vue_vue_type_script_setup_true_lang-pwHzeuLE.js";
3
+ import { _ as W } from "./MenuTab.vue_vue_type_script_setup_true_lang-GRUzIsKG.js";
4
+ import { _ as H } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-WNX1hHIm.js";
5
+ import { useRouter as K, useRoute as P } from "vue-router";
6
+ import { _ as Q } from "./Default.vue_vue_type_script_setup_true_lang-U8MvQ-Uz.js";
7
+ import { b as X, u as Y, c as Z, h as ee, i as oe } from "./app-eKZV2PPB.js";
8
+ import { storeToRefs as b } from "pinia";
9
+ import { _ as te } from "./NoData.vue_vue_type_script_setup_true_lang-FeKqFs4A.js";
10
+ import { useSnackbar as ne, useBreakpoints as re, FmButtonColorThemeVariant as le } from "@feedmepos/ui-library";
11
+ const ae = { class: "h-full w-full overflow-x-auto relative" }, ie = { class: "fm-typo-en-title-md-600" }, se = {
12
+ key: 0,
13
+ class: "flex gap-2"
14
+ }, ue = { class: "flex w-full justify-end px-2" }, Ce = /* @__PURE__ */ A({
15
+ __name: "ReportView",
16
+ setup(ce) {
17
+ const v = K(), _ = P(), y = ne(), { promptMessage: D } = X(), g = Y(), { promptLoader: F } = Z(), { breakpoints: t } = re(), { currentReport: n, currentReportId: k, isOpenDownloadDialog: C, editingReport: R } = b(g), { isOpenAccountingDialog: B } = b(ee()), { isOpenScheduleDialog: O } = b(oe()), w = [
18
+ {
19
+ icon: "mail",
20
+ label: "Email schedule",
21
+ onClick: () => {
22
+ O.value = !0;
23
+ }
24
+ },
25
+ {
26
+ icon: "download",
27
+ label: "Accounting export",
28
+ onClick: N
29
+ },
30
+ // {
31
+ // icon: "article",
32
+ // label: "Set as Default",
33
+ // onClick: async () => {
34
+ // await promptLoader(async () => {
35
+ // if (currentReport.value) {
36
+ // try {
37
+ // await reportStore.updateDefaultReport(currentReport.value.id)
38
+ // snackbar.open({
39
+ // message: `Set ${currentReport.value.name} as default successful`,
40
+ // type: "success"
41
+ // })
42
+ // } catch (err) {
43
+ // snackbar.open({ message: JSON.stringify(err), type: "error" })
44
+ // }
45
+ // }
46
+ // })
47
+ // }
48
+ // },
49
+ {
50
+ icon: "content_copy",
51
+ label: "Copy ID",
52
+ onClick: () => {
53
+ n.value && (navigator.clipboard.writeText(k.value), y.open({ message: "Copied report ID to clipboard", type: "success" }));
54
+ }
55
+ }
56
+ ];
57
+ function E() {
58
+ R.value = JSON.parse(JSON.stringify(n.value)), v.push({
59
+ name: "reportEditor",
60
+ query: _.query
61
+ });
62
+ }
63
+ async function I() {
64
+ if (!n.value) {
65
+ y.open({ message: "No Widget", type: "error" });
66
+ return;
67
+ }
68
+ if (await D({
69
+ title: "Save report",
70
+ message: `Do you really want to duplicate ${n.value.name} ?`
71
+ }) && n.value) {
72
+ const o = JSON.parse(JSON.stringify(n.value));
73
+ o.editable = !0, o.id = "", o.name = `${o.name} duplicate`;
74
+ try {
75
+ await F(async () => {
76
+ await g.createOrUpdateReport(o), g.updateCurrentReportId(k.value), v.push({
77
+ name: "reportView",
78
+ query: _.query
79
+ });
80
+ });
81
+ } catch (s) {
82
+ console.log(s), y.open({ message: "Failed to clone report", type: "error" });
83
+ }
84
+ }
85
+ }
86
+ function N() {
87
+ B.value = !0;
88
+ }
89
+ const x = J(() => n.value ? n.value.tiles : []);
90
+ return (q, o) => {
91
+ const s = p("FmButton"), M = p("FmIcon"), T = p("FmMenuItem"), V = p("FmMenu");
92
+ return a(), m(Q, null, {
93
+ default: u(() => [
94
+ d("div", ae, [
95
+ i(U, null, {
96
+ title: u(() => {
97
+ var l;
98
+ return [
99
+ i(s, {
100
+ icon: "arrow_back",
101
+ variant: "tertiary",
102
+ onClick: o[0] || (o[0] = (r) => e(v).push({ name: "reports", query: e(_).query }))
103
+ }),
104
+ d("p", ie, L((l = e(n)) == null ? void 0 : l.name), 1)
105
+ ];
106
+ }),
107
+ button: u(() => {
108
+ var l;
109
+ return [
110
+ e(t).lg || e(t).md ? (a(), f("div", se, [
111
+ i(s, {
112
+ label: (l = e(n)) != null && l.editable ? "Edit" : "Duplicate",
113
+ variant: "tertiary",
114
+ "text-color": e(le).TypoSecondary,
115
+ onClick: o[1] || (o[1] = (r) => {
116
+ var c;
117
+ return (c = e(n)) != null && c.editable ? E() : I();
118
+ })
119
+ }, null, 8, ["label", "text-color"]),
120
+ i(s, {
121
+ label: "Download",
122
+ "prepend-icon": "download",
123
+ onClick: o[2] || (o[2] = (r) => C.value = !0)
124
+ })
125
+ ])) : (a(), m(V, {
126
+ key: 1,
127
+ placement: "left"
128
+ }, {
129
+ "menu-button": u(() => [
130
+ i(M, { name: "more_vert" })
131
+ ]),
132
+ default: u(() => [
133
+ (a(), f(S, null, $(w, (r, c) => i(T, {
134
+ key: c,
135
+ label: r.label,
136
+ onClick: () => {
137
+ r.onClick && r.onClick();
138
+ }
139
+ }, null, 8, ["label", "onClick"])), 64))
140
+ ]),
141
+ _: 1
142
+ }))
143
+ ];
144
+ }),
145
+ _: 1
146
+ }),
147
+ d("div", {
148
+ class: h(`overflow-y-auto ${e(t).sm || e(t).xs ? "pb-2" : ""}`),
149
+ style: z({ height: `calc(100% - ${e(t).lg || e(t).md ? 72 : 64}px)` })
150
+ }, [
151
+ i(W, {
152
+ "model-value": e(t).lg || e(t).md ? w : []
153
+ }, null, 8, ["model-value"]),
154
+ e(n) && x.value.length > 0 ? (a(), f("div", {
155
+ key: 0,
156
+ class: h(["grid grid-cols-12", e(t).sm || e(t).xs ? "px-3 gap-[16px]" : "px-24 gap-[24px]"])
157
+ }, [
158
+ (a(!0), f(S, null, $(x.value, (l, r) => (a(), m(H, {
159
+ key: `widget_${e(k)}_${r}`,
160
+ "model-value": l,
161
+ index: r
162
+ }, null, 8, ["model-value", "index"]))), 128))
163
+ ], 2)) : (a(), m(te, { key: 1 }))
164
+ ], 6),
165
+ j(d("div", ue, [
166
+ i(s, {
167
+ label: "Download",
168
+ "prepend-icon": "download",
169
+ onClick: o[3] || (o[3] = (l) => C.value = !0)
170
+ })
171
+ ], 512), [
172
+ [G, e(t).sm || e(t).xs]
173
+ ])
174
+ ])
175
+ ]),
176
+ _: 1
177
+ });
178
+ };
179
+ }
180
+ });
181
+ export {
182
+ Ce as default
183
+ };
@@ -0,0 +1,103 @@
1
+ import { defineComponent as I, mergeModels as B, useModel as D, ref as _, computed as i, resolveComponent as a, openBlock as p, createBlock as b, withCtx as s, createElementVNode as u, toDisplayString as h, createVNode as r, normalizeClass as z, normalizeStyle as H, withDirectives as L, vShow as U, createElementBlock as $, Fragment as E, renderList as N } from "vue";
2
+ const q = { class: "fm-typo-en-body-lg-400 flex gap-4 text-fm-color-typo-primary" }, A = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, O = { class: "sticky top-0" }, j = /* @__PURE__ */ I({
3
+ __name: "SelectComponent",
4
+ props: /* @__PURE__ */ B({
5
+ items: {
6
+ type: Array,
7
+ default: () => []
8
+ },
9
+ placeHolder: {
10
+ type: String,
11
+ default: "Select item"
12
+ },
13
+ label: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ disableSearch: {
18
+ type: Boolean,
19
+ default: !1
20
+ }
21
+ }, {
22
+ modelValue: { required: !0 },
23
+ modelModifiers: {}
24
+ }),
25
+ emits: ["update:modelValue"],
26
+ setup(v) {
27
+ const m = D(v, "modelValue"), o = v, y = (e) => {
28
+ m.value = e.value, setTimeout(() => {
29
+ n.value = !1;
30
+ }, 0);
31
+ }, n = _(!1), d = _(""), g = i(
32
+ () => o.items.filter(
33
+ (e) => e.label.toLowerCase().indexOf(d.value.toLowerCase()) !== -1
34
+ )
35
+ ), F = i(
36
+ () => {
37
+ var e;
38
+ return ((e = o.items.find((t) => t.value === m.value)) == null ? void 0 : e.label) ?? o.placeHolder;
39
+ }
40
+ ), w = i(() => o.items.filter((e) => e.value === m.value));
41
+ return (e, t) => {
42
+ const x = a("FmIcon"), M = a("FmField"), S = a("FmSearch"), V = a("FmMenuDivider"), C = a("FmMenuItem"), k = a("FmMenu");
43
+ return p(), b(k, {
44
+ trigger: "click",
45
+ shift: !0,
46
+ "max-height": 300,
47
+ width: 200,
48
+ onMenuChanged: t[1] || (t[1] = (c) => {
49
+ n.value = c;
50
+ })
51
+ }, {
52
+ "menu-button": s(() => [
53
+ u("p", q, h(o.label), 1),
54
+ r(M, {
55
+ class: z(["cursor-pointer", `${n.value ? "border-fm-color-primary" : ""}`]),
56
+ focused: n.value
57
+ }, {
58
+ append: s(() => [
59
+ r(x, {
60
+ color: "black",
61
+ name: n.value ? "expand_less" : "expand_more",
62
+ size: "md"
63
+ }, null, 8, ["name"])
64
+ ]),
65
+ default: s(() => [
66
+ u("div", A, h(F.value), 1)
67
+ ]),
68
+ _: 1
69
+ }, 8, ["class", "focused"])
70
+ ]),
71
+ "menu-wrapper": s(({ maxHeight: c }) => [
72
+ u("div", {
73
+ style: H({ maxHeight: `${c}px` }),
74
+ class: "bg-fm-color-neutral-white overflow-y-auto overflow-x-hidden rounded-md shadow-light-300 w-[250px]"
75
+ }, [
76
+ L(u("div", O, [
77
+ r(S, {
78
+ modelValue: d.value,
79
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => d.value = l),
80
+ placeholder: "Filter result"
81
+ }, null, 8, ["modelValue"]),
82
+ r(V)
83
+ ], 512), [
84
+ [U, !o.disableSearch]
85
+ ]),
86
+ (p(!0), $(E, null, N(g.value, (l) => (p(), b(C, {
87
+ key: l.value,
88
+ label: l.label,
89
+ sublabel: l.sublabel,
90
+ "model-value": w.value.some((f) => f.value === l.value),
91
+ value: l.value,
92
+ "onUpdate:modelValue": (f) => y(l)
93
+ }, null, 8, ["label", "sublabel", "model-value", "value", "onUpdate:modelValue"]))), 128))
94
+ ], 4)
95
+ ]),
96
+ _: 1
97
+ });
98
+ };
99
+ }
100
+ });
101
+ export {
102
+ j as _
103
+ };
@@ -0,0 +1,326 @@
1
+ import { defineComponent as $, ref as h, useModel as P, resolveComponent as C, openBlock as y, createElementBlock as S, createBlock as U, resolveDynamicComponent as ne, unref as e, withCtx as v, createElementVNode as l, createVNode as n, normalizeClass as w, Fragment as L, renderList as Y, createTextVNode as G, toDisplayString as g, withDirectives as B, vShow as M, watch as ie, normalizeStyle as re } from "vue";
2
+ import { _ as ue } from "./HeaderTab.vue_vue_type_script_setup_true_lang-pwHzeuLE.js";
3
+ import { _ as me } from "./Default.vue_vue_type_script_setup_true_lang-U8MvQ-Uz.js";
4
+ import { b as de, d as H, C as J, g as I, D as pe, a as fe } from "./app-eKZV2PPB.js";
5
+ import { useSnackbar as K, useBreakpoints as Q, FmButtonColorThemeVariant as q, components as z } from "@feedmepos/ui-library";
6
+ import { t as F, s as ce } from "./timeFormat-chUhgTmK.js";
7
+ import { _ as W } from "./SelectComponent.vue_vue_type_script_setup_true_lang-6i3u0Axg.js";
8
+ import { storeToRefs as ve } from "pinia";
9
+ const ge = { class: "flex" }, ye = { class: "flex px-5 gap-2" }, _e = { class: "w-full gap-[24px] flex flex-col pt-2" }, xe = { class: "flex items-center w-full gap-3" }, Ce = { class: "text-fm-color-typo-primary" }, Ve = { class: "text-fm-color-typo-secondary" }, be = { class: "flex items-center gap-2" }, De = /* @__PURE__ */ $({
10
+ __name: "ReportHour",
11
+ props: {
12
+ modelValue: {
13
+ required: !0,
14
+ default: () => []
15
+ },
16
+ modelModifiers: {}
17
+ },
18
+ emits: ["update:modelValue"],
19
+ setup(b) {
20
+ const a = h(!1), d = h(), t = {
21
+ name: "",
22
+ isDefault: !1,
23
+ startTime: { hour: 0, minute: 0 },
24
+ endTime: { hour: 0, minute: 0 }
25
+ }, { FmForm: u } = z, V = h(), { promptMessage: r } = de(), R = K(), i = h(JSON.parse(JSON.stringify(t))), o = P(b, "modelValue"), O = () => {
26
+ a.value = !1, i.value && d.value === void 0 ? o.value.push(i.value) : o.value[d.value] = i.value;
27
+ }, A = () => {
28
+ var p;
29
+ (p = V.value) == null || p.validateInputs();
30
+ }, j = () => {
31
+ a.value = !1, i.value = t;
32
+ }, X = (p) => {
33
+ d.value = p, i.value = JSON.parse(JSON.stringify(o.value[d.value])), a.value = !0;
34
+ }, Z = () => {
35
+ i.value = t, a.value = !0;
36
+ }, ee = async (p) => {
37
+ const s = o.value.find((_, m) => m === p);
38
+ if (!s) {
39
+ R.open({ message: `index ${p} cannot be found`, type: "error" });
40
+ return;
41
+ }
42
+ await r({
43
+ title: "Delete time setting",
44
+ message: `Are You sure you want to delete ${s.name}?`
45
+ }) && (o.value = o.value.filter((m, N) => N !== p), o.value.find((m) => m.isDefault) || (o.value[0].isDefault = !0), i.value = t);
46
+ }, te = (p, s) => {
47
+ p ? o.value = o.value.map((D, _) => ({
48
+ ...D,
49
+ isDefault: s === _
50
+ })) : o.value = o.value.map((D, _) => ({
51
+ ...D,
52
+ isDefault: _ === 0
53
+ }));
54
+ }, { breakpoints: k } = Q(), { FmSideSheet: le, FmTopSheet: oe } = z;
55
+ return (p, s) => {
56
+ const D = C("FmTextField"), _ = C("FmTimePicker"), m = C("FmButton"), N = C("FmSwitch"), ae = C("FmChip"), se = C("FmCard");
57
+ return y(), S("div", null, [
58
+ (y(), U(ne(e(k).lg || e(k).md ? e(le) : e(oe)), {
59
+ modelValue: a.value,
60
+ "onUpdate:modelValue": s[3] || (s[3] = (c) => a.value = c),
61
+ "fullscreen-size": "sm",
62
+ "dismiss-away": !0
63
+ }, {
64
+ "side-sheet-header": v(() => s[4] || (s[4] = [
65
+ l("p", null, "Add reporting hour", -1)
66
+ ])),
67
+ "top-sheet-header": v(() => s[5] || (s[5] = [
68
+ l("div", { class: "px-5 py-2" }, [
69
+ l("p", null, "Add reporting hour")
70
+ ], -1)
71
+ ])),
72
+ "side-sheet-footer": v(() => [
73
+ l("div", ge, [
74
+ n(m, {
75
+ label: "Save",
76
+ variant: "primary",
77
+ onClick: A
78
+ }),
79
+ n(m, {
80
+ label: "Cancel",
81
+ variant: "tertiary",
82
+ onClick: j
83
+ })
84
+ ])
85
+ ]),
86
+ "top-sheet-footer": v(() => [
87
+ l("div", ye, [
88
+ n(m, {
89
+ label: "Save",
90
+ variant: "primary",
91
+ onClick: A
92
+ }),
93
+ n(m, {
94
+ label: "Cancel",
95
+ variant: "tertiary",
96
+ onClick: j
97
+ })
98
+ ])
99
+ ]),
100
+ default: v(() => [
101
+ n(e(u), {
102
+ ref_key: "form",
103
+ ref: V,
104
+ class: w(["flex flex-col gap-2", `${e(k).sm || e(k).xs ? "px-24" : ""}`]),
105
+ onValidationSuccess: O
106
+ }, {
107
+ default: v(() => {
108
+ var c, x, T, E;
109
+ return [
110
+ n(D, {
111
+ modelValue: i.value.name,
112
+ "onUpdate:modelValue": s[0] || (s[0] = (f) => i.value.name = f),
113
+ label: "Hour set name",
114
+ placeholder: "Enter name here",
115
+ rules: [(f) => f !== "" || "Cannot be empty"]
116
+ }, null, 8, ["modelValue", "rules"]),
117
+ n(_, {
118
+ "model-value": e(H)().hour(((c = i.value.startTime) == null ? void 0 : c.hour) ?? 0).minute(((x = i.value.startTime) == null ? void 0 : x.minute) ?? 0).format("HH:mm"),
119
+ class: "grow",
120
+ label: "Start time",
121
+ "onUpdate:modelValue": s[1] || (s[1] = (f) => {
122
+ f && (i.value.startTime.hour = Number(f.split(":")[0]), i.value.startTime.minute = Number(f.split(":")[1]));
123
+ })
124
+ }, null, 8, ["model-value"]),
125
+ n(_, {
126
+ "model-value": e(H)().hour(((T = i.value.endTime) == null ? void 0 : T.hour) ?? 0).minute(((E = i.value.endTime) == null ? void 0 : E.minute) ?? 0).format("HH:mm"),
127
+ class: "grow",
128
+ label: "Close time",
129
+ "onUpdate:modelValue": s[2] || (s[2] = (f) => {
130
+ f && (i.value.endTime.hour = Number(f.split(":")[0]), i.value.endTime.minute = Number(f.split(":")[1]));
131
+ })
132
+ }, null, 8, ["model-value"])
133
+ ];
134
+ }),
135
+ _: 1
136
+ }, 8, ["class"])
137
+ ]),
138
+ _: 1
139
+ }, 8, ["modelValue"])),
140
+ s[7] || (s[7] = l("div", { class: "flex flex-col gap-2" }, [
141
+ l("p", { class: "fm-typo-en-title-sm-600" }, "Reporting hour"),
142
+ l("p", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Configure reporting hours for more accurate sales reporting. These reporting hours will create new filters for time of day filtering. ")
143
+ ], -1)),
144
+ l("div", _e, [
145
+ (y(!0), S(L, null, Y(o.value, (c, x) => (y(), U(se, {
146
+ key: `report_${x}`,
147
+ class: "flex p-4",
148
+ variant: "outlined"
149
+ }, {
150
+ default: v(() => [
151
+ l("div", xe, [
152
+ n(N, {
153
+ "model-value": c.isDefault,
154
+ "onUpdate:modelValue": (T) => te(T, x)
155
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
156
+ l("div", null, [
157
+ l("p", Ce, [
158
+ G(g(c.name) + " ", 1),
159
+ B(n(ae, {
160
+ label: "Default",
161
+ class: "bg-fm-color-system-info-100 border-fm-color-typo-info text-fm-color-typo-info",
162
+ compact: ""
163
+ }, null, 512), [
164
+ [M, c.isDefault]
165
+ ])
166
+ ]),
167
+ l("p", Ve, g(e(F)(c.startTime)) + " - " + g(e(F)(c.endTime)), 1)
168
+ ]),
169
+ s[6] || (s[6] = l("div", { class: "grow" }, null, -1)),
170
+ B(l("div", be, [
171
+ n(m, {
172
+ icon: "edit",
173
+ variant: "tertiary",
174
+ onClick: (T) => X(x)
175
+ }, null, 8, ["onClick"]),
176
+ n(m, {
177
+ icon: "delete",
178
+ variant: "tertiary",
179
+ onClick: (T) => ee(x)
180
+ }, null, 8, ["onClick"])
181
+ ], 512), [
182
+ [M, x !== 0]
183
+ ])
184
+ ])
185
+ ]),
186
+ _: 2
187
+ }, 1024))), 128)),
188
+ l("div", null, [
189
+ n(m, {
190
+ label: "Add reporting hour",
191
+ variant: "secondary",
192
+ icon: "add",
193
+ "icon-position": "prepend",
194
+ "border-color": e(q).ColorPrimary,
195
+ "text-color": e(q).ColorPrimary,
196
+ onClick: Z
197
+ }, null, 8, ["border-color", "text-color"])
198
+ ])
199
+ ])
200
+ ]);
201
+ };
202
+ }
203
+ }), Te = { class: "py-2 w-full gap-2 flex flex-col" }, Se = /* @__PURE__ */ $({
204
+ __name: "CompareRangeSetting",
205
+ props: {
206
+ modelValue: { required: !0, default: J.PrecedingPeriod },
207
+ modelModifiers: {}
208
+ },
209
+ emits: ["update:modelValue"],
210
+ setup(b) {
211
+ const a = P(b, "modelValue"), d = Object.values(J).map((t) => ({
212
+ label: I(t),
213
+ value: t
214
+ })).slice(0, -1);
215
+ return (t, u) => (y(), S("div", Te, [
216
+ u[1] || (u[1] = l("p", { class: "fm-typo-en-title-sm-600" }, "Date Range Comparison", -1)),
217
+ n(W, {
218
+ modelValue: a.value,
219
+ "onUpdate:modelValue": u[0] || (u[0] = (V) => a.value = V),
220
+ label: "Default comparison date range",
221
+ items: e(d),
222
+ "disable-search": !0
223
+ }, null, 8, ["modelValue", "items"])
224
+ ]));
225
+ }
226
+ }), ke = { class: "py-2 w-full gap-2 flex flex-col" }, he = /* @__PURE__ */ $({
227
+ __name: "DateRangeSetting",
228
+ props: {
229
+ modelValue: { required: !0 },
230
+ modelModifiers: {}
231
+ },
232
+ emits: ["update:modelValue"],
233
+ setup(b) {
234
+ const a = P(b, "modelValue"), d = Object.values(pe).filter((t) => !["This month", "Last month"].includes(t)).map((t) => ({
235
+ label: t,
236
+ value: t
237
+ }));
238
+ return (t, u) => (y(), S("div", ke, [
239
+ u[1] || (u[1] = l("p", { class: "fm-typo-en-title-sm-600" }, "Date range", -1)),
240
+ n(W, {
241
+ modelValue: a.value,
242
+ "onUpdate:modelValue": u[0] || (u[0] = (V) => a.value = V),
243
+ label: "Default date range",
244
+ items: e(d),
245
+ "disable-search": !0
246
+ }, null, 8, ["modelValue", "items"])
247
+ ]));
248
+ }
249
+ }), we = { class: "h-full w-full overflow-x-auto" }, Fe = { class: "w-2/4" }, $e = { class: "fm-typo-en-body-lg-600" }, Re = { class: "fm-typo-en-body-lg-600" }, Oe = { class: "fm-typo-en-body-lg-600" }, He = /* @__PURE__ */ $({
250
+ __name: "Setting",
251
+ setup(b) {
252
+ const { breakpoints: a } = Q(), d = fe(), { defaultDateSetting: t } = ve(d), u = K();
253
+ return ie(
254
+ [
255
+ () => t.value.defaultCompareType,
256
+ () => t.value.defaultDateRange,
257
+ () => t.value.timeOptions
258
+ ],
259
+ () => {
260
+ t.value.timeOptions.length === 0 ? u.open({ message: "Report hour cannot be empty", type: "error" }) : d.createOrUpdateBusinessSetting(t.value);
261
+ },
262
+ { deep: !0 }
263
+ ), (V, r) => {
264
+ const R = C("FmMenuDivider"), i = C("FmCard");
265
+ return y(), U(me, null, {
266
+ default: v(() => [
267
+ l("div", we, [
268
+ n(ue, null, {
269
+ title: v(() => r[3] || (r[3] = [
270
+ G(" Settings ")
271
+ ])),
272
+ _: 1
273
+ }),
274
+ l("div", {
275
+ class: w(`${e(a).sm || e(a).xs ? "pb-20" : ""} overflow-y-auto flex`),
276
+ style: re({ height: `calc(100% - ${e(a).sm || e(a).xs ? 60 : 72}px)` })
277
+ }, [
278
+ l("div", {
279
+ class: w(`${e(a).lg || e(a).md ? "px-24" : "px-3"} w-full flex flex-col gap-[40px]`)
280
+ }, [
281
+ n(De, {
282
+ modelValue: e(t).timeOptions,
283
+ "onUpdate:modelValue": r[0] || (r[0] = (o) => e(t).timeOptions = o)
284
+ }, null, 8, ["modelValue"]),
285
+ n(he, {
286
+ modelValue: e(t).defaultDateRange,
287
+ "onUpdate:modelValue": r[1] || (r[1] = (o) => e(t).defaultDateRange = o)
288
+ }, null, 8, ["modelValue"]),
289
+ n(Se, {
290
+ modelValue: e(t).defaultCompareType,
291
+ "onUpdate:modelValue": r[2] || (r[2] = (o) => e(t).defaultCompareType = o)
292
+ }, null, 8, ["modelValue"])
293
+ ], 2),
294
+ B(l("div", Fe, [
295
+ n(i, {
296
+ variant: "outlined",
297
+ class: w(["flex flex-col gap-3", `${e(a).lg || e(a).md ? "mr-5 p-6" : ""}`])
298
+ }, {
299
+ default: v(() => [
300
+ r[4] || (r[4] = l("p", { class: "fm-typo-en-title-sm-600" }, "Report setting summary", -1)),
301
+ n(R),
302
+ r[5] || (r[5] = l("p", { class: "text-fm-color-typo-secondary" }, "Reporting hour", -1)),
303
+ (y(!0), S(L, null, Y(e(t).timeOptions, (o, O) => (y(), S("div", { key: O }, [
304
+ l("p", $e, g(o.name) + " " + g(o.isDefault ? "(default)" : "") + " " + g(e(F)(o.startTime)) + " " + g(e(F)(o.endTime)) + " " + g(e(ce)(o.startTime, o.endTime)), 1)
305
+ ]))), 128)),
306
+ r[6] || (r[6] = l("p", { class: "text-fm-color-typo-secondary" }, "Default date range", -1)),
307
+ l("p", Re, g(e(t).defaultDateRange), 1),
308
+ r[7] || (r[7] = l("p", { class: "text-fm-color-typo-secondary" }, "Comparison date range", -1)),
309
+ l("p", Oe, g(e(I)(e(t).defaultCompareType ?? "")), 1)
310
+ ]),
311
+ _: 1
312
+ }, 8, ["class"])
313
+ ], 512), [
314
+ [M, e(a).lg || e(a).md]
315
+ ])
316
+ ], 6)
317
+ ])
318
+ ]),
319
+ _: 1
320
+ });
321
+ };
322
+ }
323
+ });
324
+ export {
325
+ He as default
326
+ };