@feedmepos/mf-menu 0.32.13 → 0.32.15
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-D70-FH5L.js → App-BFUyUrdi.js} +16 -9
- package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BJdja2N0.js → ApplyProduct.vue_vue_type_script_setup_true_lang-BbjRIN7Z.js} +20 -20
- package/dist/{Catalog-WMpN3a0p.js → Catalog-B6VFmr6e.js} +20 -20
- package/dist/{Category-C_VsQIHU.js → Category-B-bTjNFI.js} +24 -24
- package/dist/{Category-BwHhFTZ-.js → Category-C8uGxpST.js} +84 -84
- package/dist/{CookingGuide-D9RNkYDL.js → CookingGuide-BL3uetlO.js} +65 -65
- package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-DtmrxDZm.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-8yIVwc8E.js} +1 -1
- package/dist/{Group-DexONgr2.js → Group-BvO-gQZe.js} +1 -1
- package/dist/{Group-qRZlg5ST.js → Group-DT9UkkOx.js} +3 -3
- package/dist/{Group.vue_vue_type_script_setup_true_lang-DtPY9uUt.js → Group.vue_vue_type_script_setup_true_lang-DZhM1Tpb.js} +56 -56
- package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-B5Qpmj2f.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D48u_DHq.js} +5 -5
- package/dist/ImportProductDialog.vue_vue_type_script_setup_true_lang-C_X-lTnN.js +72979 -0
- package/dist/{Ingredient-BuOS_Wvm.js → Ingredient-7qWDD9e6.js} +26 -26
- package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-DFvXklj9.js → InventoryBinding.vue_vue_type_script_setup_true_lang-CwjW0wfz.js} +2 -2
- package/dist/{LinkProductSideSheet-DJj8Nn4X.js → LinkProductSideSheet-BXW6eNgZ.js} +3 -3
- package/dist/{MenuSetting-D6B0gCGV.js → MenuSetting-BSF7O2NL.js} +5 -5
- package/dist/{PrintRoute-B7G8f1iC.js → PrintRoute-b1ii5Uz9.js} +20 -20
- package/dist/{Product-DpS5EepJ.js → Product-Ce0GJb3c.js} +1 -1
- package/dist/{Product.vue_vue_type_script_setup_true_lang-CdIukLqA.js → Product.vue_vue_type_script_setup_true_lang-BZVvTAOX.js} +49 -49
- package/dist/{ProductInternalTools-CBCyWHOS.js → ProductInternalTools-igbOLRap.js} +20 -20
- package/dist/Products-GAyUdhnN.js +292 -0
- package/dist/Publish-g60odzhM.js +1300 -0
- package/dist/{Recipe-D14rkATU.js → Recipe-B6aye_iC.js} +9 -9
- package/dist/{RuleView.vue_vue_type_script_setup_true_lang-CdH2ius3.js → RuleView.vue_vue_type_script_setup_true_lang-By8kwuMB.js} +134 -134
- package/dist/{Scheduler-DWZqa-jf.js → Scheduler-CyaG6Y5v.js} +7 -7
- package/dist/{ServingSequence-Mx7ovvJ1.js → ServingSequence-BXeypgrN.js} +27 -27
- package/dist/{Setting-DmHuVXVn.js → Setting-D7GcaNTk.js} +17 -17
- package/dist/{Subcategory-DixZPdnT.js → Subcategory-DNUp9ojI.js} +37 -37
- package/dist/{Takeaway-BVIymFV_.js → Takeaway-Baqvq5nP.js} +9 -9
- package/dist/{Takeaway-DDKeDEbV.js → Takeaway-BjXPeYRv.js} +1 -1
- package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-CTaCQgRv.js → Takeaway.vue_vue_type_script_setup_true_lang-CgXT2UVL.js} +54 -54
- package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-DveI9xvU.js → Thumbnail.vue_vue_type_script_setup_true_lang-CX8cSbDe.js} +12 -12
- package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-2nBbq_Yk.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DcjGVQEO.js} +756 -763
- package/dist/{Unit-utuaNZBw.js → Unit-mI7lLzCf.js} +2 -2
- package/dist/{Variant-CzuJNwen.js → Variant-CVwnODRz.js} +14 -14
- package/dist/{_id_-DMDhPQCr.js → _id_-fpn0nBru.js} +14 -14
- package/dist/{app-BQUkvrAS.js → app-CCKI85Te.js} +26 -26
- package/dist/{app-Bqj3cAPJ.js → app-U5MEN4U1.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/apps/mf-menu/src/Entry.vue.d.ts +1 -0
- package/dist/apps/mf-menu/src/components/feature/Fields/ImageDropField.vue.d.ts +0 -2
- package/dist/apps/mf-menu/src/composable/useClientEvent.d.ts +14 -0
- package/dist/apps/mf-menu/src/helper/import-export-utils.d.ts +22 -22
- package/dist/apps/mf-menu/src/helper/menuExport.d.ts +59 -33
- package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
- package/dist/assets/{linked-status-ILQVL8r9.js → linked-status-6Jt70XBp.js} +2 -2
- package/dist/assets/menu-export-CR0a98CA.js +107 -0
- package/dist/assets/{override-menu-DVkGhbA9.js → override-menu-Chsc0CSI.js} +2 -2
- package/dist/assets/{validate-menu-y_NQUL02.js → validate-menu-pb0aN4gj.js} +2 -2
- package/dist/{catalog-BYzITAmC.js → catalog-BgQmytEA.js} +1 -1
- package/dist/{catalogSetting-DAo5tN3P.js → catalogSetting-BS5IaQKq.js} +1 -1
- package/dist/{category-D4x8r_lY.js → category-DJMVbmzx.js} +1 -1
- package/dist/{currency-CvoBdMM2.js → currency-FHrLDvzy.js} +1 -1
- package/dist/dayjs.min-DJGdQr-B.js +6 -0
- package/dist/{index-LuH6PJzW.js → index-BywPDIFW.js} +4 -4
- package/dist/{index-BLUIaanj.js → index-DYxLHjeC.js} +1 -1
- package/dist/{index-6lju0f3r.js → index-XVWDnyu-.js} +17 -17
- package/dist/{index.vue_vue_type_script_setup_true_lang-DxF14kn9.js → index.vue_vue_type_script_setup_true_lang-kj6HkxwD.js} +2306 -2306
- package/dist/{item-lXMLaKOb.js → item-cmnP2N-a.js} +1089 -1091
- package/dist/{jszip.min-CdZ-wY5m.js → jszip.min-psVCZNVl.js} +545 -545
- package/dist/{menu-PJc2dQHQ.js → menu-CgQPOu3W.js} +1 -1
- package/dist/{menuV2-DinFmdTL.js → menuV2-DHO9OmzU.js} +159 -159
- package/dist/mf-menu.css +1 -1
- package/dist/{priceTier-CzKIo11g.js → priceTier-CLm9vzaK.js} +1 -1
- package/dist/{scheduler-DQjxnoCk.js → scheduler-BMdZdtpj.js} +4 -4
- package/dist/{subcategory-CLkDImEU.js → subcategory-Dj_DOvFt.js} +2 -2
- package/dist/{toExcel-DPh8DaM0.js → toExcel-XwFFiTiA.js} +2 -2
- package/dist/{unit-QYkVoC6_.js → unit-CsuAQsy7.js} +12 -12
- package/package.json +3 -3
- package/dist/ImportProductDialog.vue_vue_type_script_setup_true_lang-BqhNkaw_.js +0 -96043
- package/dist/Products-CcyGNlUl.js +0 -794
- package/dist/Publish-rZLHFaJ5.js +0 -1264
- package/dist/dayjs.min-C6xioui7.js +0 -6
|
@@ -0,0 +1,1300 @@
|
|
|
1
|
+
import { defineComponent as W, ref as P, computed as N, onMounted as ie, resolveComponent as U, createElementBlock as M, openBlock as C, createVNode as p, createElementVNode as i, toDisplayString as z, unref as d, Fragment as H, renderList as q, createBlock as j, watch as de, withCtx as E, normalizeClass as re, createCommentVNode as X, createTextVNode as me, mergeProps as Ve, normalizeStyle as Ie, renderSlot as Pe, withModifiers as te, h as R, onUnmounted as Me } from "vue";
|
|
2
|
+
import { D as L } from "./dayjs.min-DJGdQr-B.js";
|
|
3
|
+
import { useRouter as $e } from "vue-router";
|
|
4
|
+
import { O as Ue, b as Ae } from "./app-5fxKLAzS.js";
|
|
5
|
+
import { B as Be, H as De, G as he, ac as Te, A as G, u as be, I as pe, J as Re, a4 as Oe } from "./index.vue_vue_type_script_setup_true_lang-kj6HkxwD.js";
|
|
6
|
+
import { useI18n as Z, useCoreStore as Ne, RestaurantSelector as Ee } from "@feedmepos/mf-common";
|
|
7
|
+
import { useSnackbar as ce, useDialogChild as Le, useProxiedModel as ze, useDialog as _e, FmButtonVariant as fe, components as Q } from "@feedmepos/ui-library";
|
|
8
|
+
import { _ as He } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
|
|
9
|
+
import { _ as Je } from "./app-CCKI85Te.js";
|
|
10
|
+
import { a as Ye, w as Ke } from "./tooltip-B5BiPMx9.js";
|
|
11
|
+
import { u as ge } from "./discardConfirm-BHni0LNu.js";
|
|
12
|
+
import { _ as ye } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
13
|
+
function ke(T) {
|
|
14
|
+
return T ? L(T).format("DD/MM/YY HH:mm") : "-";
|
|
15
|
+
}
|
|
16
|
+
function je(T, F, l) {
|
|
17
|
+
const g = (n, x = !1) => {
|
|
18
|
+
var u;
|
|
19
|
+
return n === void 0 && !x ? "-" : ((u = l.find((_) => _.value === (n || null))) == null ? void 0 : u.label) || "-";
|
|
20
|
+
};
|
|
21
|
+
return T.map((n) => {
|
|
22
|
+
var e;
|
|
23
|
+
const x = (e = F.find(({ _id: b }) => b === n._id)) == null ? void 0 : e.posVersion, u = !!x && !!Be.Pos.canUse({ feature: De.F_FEATURE.enum.taxAndServiceChargeV4, posVersion: x }), _ = g(n.catalogId);
|
|
24
|
+
return {
|
|
25
|
+
...n,
|
|
26
|
+
_default: _,
|
|
27
|
+
_posTakeaway: n.takeawayCatalog ? g(n.takeawayCatalog) : _,
|
|
28
|
+
_additionalCatalogs: (n.additionalCatalogs || []).map((b) => g(b)),
|
|
29
|
+
_lastUpdate: ke(n.updatedAt),
|
|
30
|
+
_pickup: u ? g(n.pickupCatalog, !0) : "-",
|
|
31
|
+
_canUsePickup: u,
|
|
32
|
+
_posVersion: x || "-"
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const Ge = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "flex items-center justify-center"
|
|
39
|
+
}, qe = {
|
|
40
|
+
key: 1,
|
|
41
|
+
class: "space-y-16"
|
|
42
|
+
}, We = { class: "text-fm-color-typo-secondary" }, Qe = { class: "space-y-4" }, Xe = /* @__PURE__ */ W({
|
|
43
|
+
__name: "RevertDialog",
|
|
44
|
+
props: {
|
|
45
|
+
restaurant: {}
|
|
46
|
+
},
|
|
47
|
+
setup(T) {
|
|
48
|
+
const F = T, l = ce(), { custom: g } = he(l), n = P(!1), x = P(null);
|
|
49
|
+
async function u() {
|
|
50
|
+
await g(
|
|
51
|
+
async () => {
|
|
52
|
+
var c;
|
|
53
|
+
x.value = await Te.readMenuById(((c = F.restaurant.revertConfig) == null ? void 0 : c._id) || "");
|
|
54
|
+
},
|
|
55
|
+
{ isLoading: n }
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const _ = N(() => {
|
|
59
|
+
var c;
|
|
60
|
+
return [
|
|
61
|
+
{ label: "Main", value: null },
|
|
62
|
+
...(((c = x.value) == null ? void 0 : c.modules.catalog) || []).map((y) => ({
|
|
63
|
+
label: y.name,
|
|
64
|
+
value: y._id
|
|
65
|
+
}))
|
|
66
|
+
];
|
|
67
|
+
}), { t: e } = Z(), b = N(() => {
|
|
68
|
+
var s;
|
|
69
|
+
const c = F.restaurant.revertConfig;
|
|
70
|
+
if (!c) return [];
|
|
71
|
+
const y = je(
|
|
72
|
+
[
|
|
73
|
+
{
|
|
74
|
+
...c,
|
|
75
|
+
catalogId: c.catalogId || null
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
Ne().restaurants.value,
|
|
79
|
+
_.value
|
|
80
|
+
)[0];
|
|
81
|
+
return [
|
|
82
|
+
{ label: e("menu.revert.labels.restaurant"), value: F.restaurant.name },
|
|
83
|
+
{
|
|
84
|
+
label: e("menu.revert.labels.revert_to"),
|
|
85
|
+
value: ke((s = x.value) == null ? void 0 : s.updatedAt)
|
|
86
|
+
},
|
|
87
|
+
{ label: e("menu.revert.labels.default"), value: y._default },
|
|
88
|
+
{ label: e("menu.revert.labels.pos_takeaway"), value: y._posTakeaway },
|
|
89
|
+
{ label: e("menu.revert.labels.pickup"), value: y._pickup },
|
|
90
|
+
{
|
|
91
|
+
label: e("menu.revert.labels.additional_catalogs"),
|
|
92
|
+
value: y._additionalCatalogs.join(", ")
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
});
|
|
96
|
+
ie(async () => u());
|
|
97
|
+
const { emitData: a } = Le();
|
|
98
|
+
return (c, y) => {
|
|
99
|
+
const s = U("FmCircularProgress");
|
|
100
|
+
return n.value ? (C(), M("div", Ge, [
|
|
101
|
+
p(s, { size: "lg" })
|
|
102
|
+
])) : (C(), M("div", qe, [
|
|
103
|
+
i("div", We, z(d(e)("menu.revert.description", { name: F.restaurant.name })), 1),
|
|
104
|
+
i("div", Qe, [
|
|
105
|
+
(C(!0), M(H, null, q(b.value, (f) => (C(), j(Ye, {
|
|
106
|
+
key: f.label,
|
|
107
|
+
name: f.label,
|
|
108
|
+
value: f.value || "--"
|
|
109
|
+
}, null, 8, ["name", "value"]))), 128))
|
|
110
|
+
])
|
|
111
|
+
]));
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}), Ze = {
|
|
115
|
+
class: "break-all fm-typo-en-body-lg-400 line-clamp-1"
|
|
116
|
+
}, et = {
|
|
117
|
+
class: "flex flex-col"
|
|
118
|
+
}, tt = /* @__PURE__ */ W({
|
|
119
|
+
__name: "PublishRestaurantSelector",
|
|
120
|
+
props: {
|
|
121
|
+
restaurants: {
|
|
122
|
+
type: Array,
|
|
123
|
+
required: !0
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
emits: ["update:modelValue"],
|
|
127
|
+
setup(T, {
|
|
128
|
+
emit: F
|
|
129
|
+
}) {
|
|
130
|
+
const l = T, g = F, n = P([]), x = N(() => l.restaurants.map((s) => ({
|
|
131
|
+
label: s.name,
|
|
132
|
+
value: s._id
|
|
133
|
+
}))), u = P(""), _ = N(() => {
|
|
134
|
+
const s = Array.isArray(n.value) ? n.value : [], f = s.map((m) => x.value.find((A) => A.value === m)).filter((m) => m !== void 0);
|
|
135
|
+
let o = [];
|
|
136
|
+
return u.value ? (o = x.value.filter((m) => m.label.toLowerCase().includes(u.value.toLowerCase()) && !s.includes(m.value)), [...f, ...o]) : (o = x.value.filter((m) => !s.includes(m.value)), [...f, ...o]);
|
|
137
|
+
}), e = N(() => n.value.length > 0 && n.value.length === _.value.length), b = N(() => n.value.filter((s) => _.value.some((f) => f.value === s))), a = () => {
|
|
138
|
+
const s = n.value.filter((f) => !b.value.includes(f));
|
|
139
|
+
e.value === !0 ? c(s) : c(_.value.map((f) => f.value));
|
|
140
|
+
}, c = (s) => {
|
|
141
|
+
n.value = s;
|
|
142
|
+
};
|
|
143
|
+
de(n, (s) => {
|
|
144
|
+
g("update:modelValue", s);
|
|
145
|
+
});
|
|
146
|
+
function y(s) {
|
|
147
|
+
return l.restaurants.filter((f) => s.includes(f._id)).map((f) => f.name);
|
|
148
|
+
}
|
|
149
|
+
return (s, f) => {
|
|
150
|
+
const o = U("FmSearch"), m = U("FmCheckbox"), A = U("FmSelect");
|
|
151
|
+
return C(), j(A, {
|
|
152
|
+
modelValue: n.value,
|
|
153
|
+
"onUpdate:modelValue": f[1] || (f[1] = (B) => n.value = B),
|
|
154
|
+
placeholder: "Select Restaurant",
|
|
155
|
+
items: _.value,
|
|
156
|
+
multiselect: !0,
|
|
157
|
+
"hide-chips": !0
|
|
158
|
+
}, {
|
|
159
|
+
default: E(() => [i("p", Ze, z(n.value.length === l.restaurants.length ? "All restaurants" : y(n.value).join(", ")), 1)]),
|
|
160
|
+
"menu-wrapper": E(() => [i("div", et, [p(o, {
|
|
161
|
+
class: "py-8",
|
|
162
|
+
modelValue: u.value,
|
|
163
|
+
"onUpdate:modelValue": f[0] || (f[0] = (B) => u.value = B),
|
|
164
|
+
placeholder: "Search Restaurant"
|
|
165
|
+
}, null, 8, ["modelValue"]), p(m, {
|
|
166
|
+
class: "py-8",
|
|
167
|
+
"model-value": e.value,
|
|
168
|
+
label: "All restaurants",
|
|
169
|
+
value: "1",
|
|
170
|
+
indeterminate: n.value.length > 0,
|
|
171
|
+
"onUpdate:modelValue": a
|
|
172
|
+
}, null, 8, ["model-value", "indeterminate"]), (C(!0), M(H, null, q(_.value, (B, Y) => (C(), M("div", {
|
|
173
|
+
key: Y
|
|
174
|
+
}, [p(m, {
|
|
175
|
+
"model-value": n.value,
|
|
176
|
+
label: B.label,
|
|
177
|
+
value: B.value,
|
|
178
|
+
"onUpdate:modelValue": c
|
|
179
|
+
}, null, 8, ["model-value", "label", "value"])]))), 128))])]),
|
|
180
|
+
_: 1
|
|
181
|
+
}, 8, ["modelValue", "items"]);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}), at = { class: "fm-calendar__name-row fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, lt = ["id"], nt = {
|
|
185
|
+
key: 0,
|
|
186
|
+
class: "fm-calendar__cell__button--today"
|
|
187
|
+
}, st = ["onClick", "onMouseover"], ot = /* @__PURE__ */ W({
|
|
188
|
+
__name: "FmCalendar",
|
|
189
|
+
props: {
|
|
190
|
+
days: {},
|
|
191
|
+
dayCellClass: { type: [Object, Function], default: void 0 },
|
|
192
|
+
onDayClick: {},
|
|
193
|
+
onCellMouseOver: { type: Function, default: void 0 },
|
|
194
|
+
cellSize: { default: "md" }
|
|
195
|
+
},
|
|
196
|
+
setup(T) {
|
|
197
|
+
const { t: F } = Z(), l = () => [
|
|
198
|
+
F("menu.publish.scheduler.calender.day.sun"),
|
|
199
|
+
F("menu.publish.scheduler.calender.day.mon"),
|
|
200
|
+
F("menu.publish.scheduler.calender.day.tue"),
|
|
201
|
+
F("menu.publish.scheduler.calender.day.wed"),
|
|
202
|
+
F("menu.publish.scheduler.calender.day.thu"),
|
|
203
|
+
F("menu.publish.scheduler.calender.day.fri"),
|
|
204
|
+
F("menu.publish.scheduler.calender.day.sat")
|
|
205
|
+
], g = L(), n = (u, _) => typeof u == "function" ? u(..._) : u, x = (u, _) => {
|
|
206
|
+
if (!_) return;
|
|
207
|
+
const e = {
|
|
208
|
+
"fm-calendar__cell--selected": !1,
|
|
209
|
+
"fm-calendar__cell--selected-start": !1,
|
|
210
|
+
"fm-calendar__cell--selected-end": !1,
|
|
211
|
+
"fm-calendar__cell--selected-between": !1
|
|
212
|
+
};
|
|
213
|
+
let b;
|
|
214
|
+
if (typeof _ == "function") {
|
|
215
|
+
const { status: a, className: c } = _(u);
|
|
216
|
+
a && (e["fm-calendar__cell--selected"] = a.isSelected ?? !1, e["fm-calendar__cell--selected-start"] = a.isStart ?? !1, e["fm-calendar__cell--selected-end"] = a.isEnd ?? !1, e["fm-calendar__cell--selected-between"] = a.isBetween ?? !1), b = c ?? "";
|
|
217
|
+
} else {
|
|
218
|
+
const { status: a, className: c } = _;
|
|
219
|
+
a && (e["fm-calendar__cell--selected"] = n(a.isSelected, [u]) ?? !1, e["fm-calendar__cell--selected-start"] = n(a.isStart, [u]) ?? !1, e["fm-calendar__cell--selected-end"] = n(a.isEnd, [u]) ?? !1, e["fm-calendar__cell--selected-between"] = n(a.isBetween, [u]) ?? !1), b = n(c, [u]) ?? "";
|
|
220
|
+
}
|
|
221
|
+
return [e, b];
|
|
222
|
+
};
|
|
223
|
+
return (u, _) => (C(), M("div", null, [
|
|
224
|
+
i("div", at, [
|
|
225
|
+
(C(!0), M(H, null, q(l(), (e) => (C(), M("div", {
|
|
226
|
+
key: e,
|
|
227
|
+
class: re(["fm-calendar__cell", `fm-calendar__cell__${u.cellSize}`])
|
|
228
|
+
}, z(e), 3))), 128))
|
|
229
|
+
]),
|
|
230
|
+
i("div", null, [
|
|
231
|
+
(C(!0), M(H, null, q(u.days, (e, b) => (C(), M("div", {
|
|
232
|
+
key: b,
|
|
233
|
+
class: "fm-calendar__row fm-typo-en-body-md-400"
|
|
234
|
+
}, [
|
|
235
|
+
(C(!0), M(H, null, q(e, (a) => (C(), M("div", {
|
|
236
|
+
id: `${a.date.toISOString()}`,
|
|
237
|
+
key: a.date.date(),
|
|
238
|
+
class: re(["fm-calendar__cell", [
|
|
239
|
+
`fm-calendar__cell__${u.cellSize}`,
|
|
240
|
+
x(a.date, u.dayCellClass),
|
|
241
|
+
!a.isCurrentMonth && "fm-calendar__cell--not-current-month"
|
|
242
|
+
]])
|
|
243
|
+
}, [
|
|
244
|
+
a.date.isSame(d(g), "day") && a.isCurrentMonth ? (C(), M("div", nt)) : X("", !0),
|
|
245
|
+
a.isCurrentMonth ? (C(), M("button", {
|
|
246
|
+
key: 1,
|
|
247
|
+
class: "fm-calendar__cell__button",
|
|
248
|
+
type: "button",
|
|
249
|
+
onClick: (c) => u.onDayClick(a),
|
|
250
|
+
onMouseover: (c) => {
|
|
251
|
+
var y;
|
|
252
|
+
return (y = u.onCellMouseOver) == null ? void 0 : y.call(u, a.date);
|
|
253
|
+
}
|
|
254
|
+
}, z(a.date.date()), 41, st)) : X("", !0)
|
|
255
|
+
], 10, lt))), 128))
|
|
256
|
+
]))), 128))
|
|
257
|
+
])
|
|
258
|
+
]));
|
|
259
|
+
}
|
|
260
|
+
}), ve = /* @__PURE__ */ ye(ot, [["__scopeId", "data-v-47484312"]]), ut = { class: "fm-typo-en-body-md-600" }, rt = {
|
|
261
|
+
id: "in-calendar-app",
|
|
262
|
+
class: "h-[264px] overflow-y-auto w-[160px]"
|
|
263
|
+
}, it = ["onVnodeMounted"], dt = ["onVnodeMounted"], ae = /* @__PURE__ */ W({
|
|
264
|
+
__name: "FmDateRangeYearMonthPicker",
|
|
265
|
+
props: {
|
|
266
|
+
modelValue: {},
|
|
267
|
+
picker: {},
|
|
268
|
+
min: {},
|
|
269
|
+
max: {}
|
|
270
|
+
},
|
|
271
|
+
emits: ["update:modelValue"],
|
|
272
|
+
setup(T, { emit: F }) {
|
|
273
|
+
const { t: l } = Z(), g = T, n = F, x = P(!1), u = N(() => {
|
|
274
|
+
const a = L(g.min).startOf("year"), c = L(g.max).startOf("year"), y = c.diff(a, "year"), s = [];
|
|
275
|
+
for (let f = 0; f <= y; f++)
|
|
276
|
+
s.push(c.subtract(f, "year"));
|
|
277
|
+
return s;
|
|
278
|
+
}), _ = (a) => {
|
|
279
|
+
const c = L(g.min).startOf("month"), y = L(g.max).startOf("month");
|
|
280
|
+
return a.get("year") === c.get("year") ? a.startOf("month").isAfter(c) || a.get("month") === c.get("month") : a.get("year") === y.get("year") ? a.startOf("month").isBefore(y) || a.get("month") === y.get("month") : !0;
|
|
281
|
+
}, e = (a) => {
|
|
282
|
+
const c = L(g.min).startOf("month"), y = L(g.max).startOf("month");
|
|
283
|
+
if (c.get("year") === a.get("year")) {
|
|
284
|
+
n("update:modelValue", c);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (y.get("year") === a.get("year")) {
|
|
288
|
+
n("update:modelValue", y);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
n("update:modelValue", a);
|
|
292
|
+
};
|
|
293
|
+
function b(a, c) {
|
|
294
|
+
if (!c)
|
|
295
|
+
return !1;
|
|
296
|
+
const y = a.el, s = y == null ? void 0 : y.parentElement;
|
|
297
|
+
!y || !s || s.scrollTo({
|
|
298
|
+
top: y.offsetTop - 50
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return (a, c) => {
|
|
302
|
+
const y = U("FmIcon"), s = U("FmMenuItem"), f = U("FmMenu");
|
|
303
|
+
return C(), j(f, {
|
|
304
|
+
trigger: "click",
|
|
305
|
+
onMenuChanged: c[0] || (c[0] = (o) => x.value = o)
|
|
306
|
+
}, {
|
|
307
|
+
"menu-button": E(() => [
|
|
308
|
+
i("div", {
|
|
309
|
+
class: re(["flex gap-4 h-24 items-center px-4 rounded-sm", x.value ? "text-fm-color-primary" : "hover:bg-fm-color-neutral-gray-100"])
|
|
310
|
+
}, [
|
|
311
|
+
i("div", ut, [
|
|
312
|
+
a.picker === "month" ? (C(), M(H, { key: 0 }, [
|
|
313
|
+
me(z(a.modelValue.format(d(l)("menu.publish.scheduler.date.monthFormat"))), 1)
|
|
314
|
+
], 64)) : X("", !0),
|
|
315
|
+
a.picker === "year" ? (C(), M(H, { key: 1 }, [
|
|
316
|
+
me(z(a.modelValue.format(d(l)("menu.publish.scheduler.date.yearFormat"))), 1)
|
|
317
|
+
], 64)) : X("", !0)
|
|
318
|
+
]),
|
|
319
|
+
p(y, {
|
|
320
|
+
name: x.value ? "expand_less" : "expand_more",
|
|
321
|
+
size: "md",
|
|
322
|
+
color: "black"
|
|
323
|
+
}, null, 8, ["name"])
|
|
324
|
+
], 2)
|
|
325
|
+
]),
|
|
326
|
+
default: E(() => [
|
|
327
|
+
i("ul", rt, [
|
|
328
|
+
a.picker === "month" ? (C(!0), M(H, { key: 0 }, q(Array.from(Array(12), (o, m) => a.modelValue.month(m)), (o) => (C(), M("li", {
|
|
329
|
+
key: o.format(d(l)("menu.publish.scheduler.date.monthFormat")),
|
|
330
|
+
onVnodeMounted: (m) => b(
|
|
331
|
+
m,
|
|
332
|
+
a.modelValue.format(d(l)("menu.publish.scheduler.date.monthFormat")) === o.format(d(l)("menu.publish.scheduler.date.monthFormat"))
|
|
333
|
+
)
|
|
334
|
+
}, [
|
|
335
|
+
p(s, {
|
|
336
|
+
disabled: !_(o),
|
|
337
|
+
"model-value": a.modelValue.format(d(l)("menu.publish.scheduler.date.monthFormat")) === o.format(d(l)("menu.publish.scheduler.date.monthFormat")),
|
|
338
|
+
label: o.format(d(l)("menu.publish.scheduler.date.monthFormat")),
|
|
339
|
+
"onUpdate:modelValue": (m) => n("update:modelValue", o)
|
|
340
|
+
}, null, 8, ["disabled", "model-value", "label", "onUpdate:modelValue"])
|
|
341
|
+
], 8, it))), 128)) : X("", !0),
|
|
342
|
+
a.picker === "year" ? (C(!0), M(H, { key: 1 }, q(u.value, (o) => (C(), M("li", {
|
|
343
|
+
key: o.format(d(l)("menu.publish.scheduler.date.yearFormat")),
|
|
344
|
+
onVnodeMounted: (m) => b(
|
|
345
|
+
m,
|
|
346
|
+
a.modelValue.format(d(l)("menu.publish.scheduler.date.yearFormat")) === o.format(d(l)("menu.publish.scheduler.date.yearFormat"))
|
|
347
|
+
)
|
|
348
|
+
}, [
|
|
349
|
+
p(s, {
|
|
350
|
+
"model-value": a.modelValue.format(d(l)("menu.publish.scheduler.date.yearFormat")) === o.format(d(l)("menu.publish.scheduler.date.yearFormat")),
|
|
351
|
+
label: o.format(d(l)("menu.publish.scheduler.date.yearFormat")),
|
|
352
|
+
"onUpdate:modelValue": (m) => e(o)
|
|
353
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])
|
|
354
|
+
], 8, dt))), 128)) : X("", !0)
|
|
355
|
+
])
|
|
356
|
+
]),
|
|
357
|
+
_: 1
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}), ct = { class: "p-12 space-y-4 w-[552px]" }, mt = { class: "w-max" }, pt = { class: "flex space-x-24" }, ft = { class: "flex items-center py-8 space-x-16" }, vt = { class: "flex space-x-4" }, ht = { class: "flex items-center justify-end py-8 space-x-16" }, bt = { class: "flex space-x-4" }, _t = { class: "flex gap-8 items-center justify-end w-full" }, le = "YYYY-MM-DD", gt = /* @__PURE__ */ W({
|
|
362
|
+
__name: "DateTimePicker",
|
|
363
|
+
props: {
|
|
364
|
+
modelValue: {},
|
|
365
|
+
showValidBorder: { type: Boolean, default: !1 },
|
|
366
|
+
min: { default: () => L().subtract(50, "year").format(le) },
|
|
367
|
+
max: { default: () => L().add(25, "year").format(le) },
|
|
368
|
+
zIndex: { default: void 0 },
|
|
369
|
+
label: { default: "" },
|
|
370
|
+
labelMark: { default: "none" },
|
|
371
|
+
labelInfo: { default: "" },
|
|
372
|
+
disabled: { type: Boolean, default: void 0 },
|
|
373
|
+
focused: { type: Boolean, default: !1 },
|
|
374
|
+
rules: { default: () => [] },
|
|
375
|
+
helperText: { default: "" },
|
|
376
|
+
helperState: { default: "none" }
|
|
377
|
+
},
|
|
378
|
+
emits: ["update:schedulerTime"],
|
|
379
|
+
setup(T, { emit: F }) {
|
|
380
|
+
const { t: l } = Z(), g = T, n = F, x = ze(g, "modelValue"), u = P({
|
|
381
|
+
hours: new Date(x.value).getHours() % 12 || 12,
|
|
382
|
+
minutes: new Date(x.value).getMinutes(),
|
|
383
|
+
period: new Date(x.value).getHours() >= 12 ? "PM" : "AM"
|
|
384
|
+
/* AM */
|
|
385
|
+
}), _ = P(L(x.value, le)), e = P(!1);
|
|
386
|
+
function b(k, w) {
|
|
387
|
+
const [r, v, S] = k.split("-").map(Number), D = new Date(r, v - 1, S);
|
|
388
|
+
let V = w.hours % 12;
|
|
389
|
+
return w.period === "PM" && (V += 12), D.setHours(V), D.setMinutes(w.minutes), D.setSeconds(0), D.setMilliseconds(0), D;
|
|
390
|
+
}
|
|
391
|
+
const a = () => {
|
|
392
|
+
x.value = _.value.format(le);
|
|
393
|
+
const k = b(x.value, u.value);
|
|
394
|
+
n("update:schedulerTime", k.toISOString()), setTimeout(() => {
|
|
395
|
+
e.value = !1;
|
|
396
|
+
}, 0);
|
|
397
|
+
}, c = () => {
|
|
398
|
+
_.value = x.value ? L(x.value) : null, e.value = !1;
|
|
399
|
+
}, y = (k) => {
|
|
400
|
+
e.value = k, k || c();
|
|
401
|
+
}, s = P(L().startOf("month")), f = P(L().startOf("month").add(1, "month")), o = (k, w) => {
|
|
402
|
+
k === "left" ? (s.value = w, f.value = w.add(1, "month")) : k === "right" && (f.value = w, s.value = w.subtract(1, "month"));
|
|
403
|
+
}, m = N(() => B(s.value)), A = N(() => B(s.value.add(1, "month"))), B = (k) => {
|
|
404
|
+
const w = [], r = k.endOf("month"), v = k.month();
|
|
405
|
+
let S = k.startOf("week"), D = [];
|
|
406
|
+
for (; S.isBefore(r.endOf("week")); )
|
|
407
|
+
S.day() === 0 && D.length > 0 && (w.push(D), D = []), D.push({
|
|
408
|
+
date: S,
|
|
409
|
+
isCurrentMonth: S.month() === v
|
|
410
|
+
}), S = S.add(1, "day");
|
|
411
|
+
return D.length > 0 && w.push(D), w.length < 6 && w.push([]), w;
|
|
412
|
+
}, Y = (k) => {
|
|
413
|
+
_.value = k;
|
|
414
|
+
};
|
|
415
|
+
return (k, w) => {
|
|
416
|
+
const r = U("FmIcon"), v = U("FmTimeInput"), S = U("FmButton"), D = U("FmPopover");
|
|
417
|
+
return C(), j(D, {
|
|
418
|
+
"show-popover": e.value,
|
|
419
|
+
"z-index": g.zIndex,
|
|
420
|
+
"exclude-el-from-click-outside": ["in-calendar-app"],
|
|
421
|
+
onPopoverChanged: y
|
|
422
|
+
}, {
|
|
423
|
+
"popover-button": E(() => [
|
|
424
|
+
i("div", Ve({
|
|
425
|
+
opened: e.value,
|
|
426
|
+
showValidBorder: k.showValidBorder
|
|
427
|
+
}, { class: "text-fm-color-primary" }), " Select Date & Time ", 16)
|
|
428
|
+
]),
|
|
429
|
+
default: E(() => [
|
|
430
|
+
i("div", ct, [
|
|
431
|
+
i("div", mt, [
|
|
432
|
+
i("div", pt, [
|
|
433
|
+
i("div", null, [
|
|
434
|
+
i("div", ft, [
|
|
435
|
+
p(r, {
|
|
436
|
+
outline: !1,
|
|
437
|
+
class: "cursor-pointer select-none",
|
|
438
|
+
color: "#1C1C1E",
|
|
439
|
+
name: "chevron_left",
|
|
440
|
+
size: "md",
|
|
441
|
+
onClick: w[0] || (w[0] = () => o("left", s.value.subtract(1, "month")))
|
|
442
|
+
}),
|
|
443
|
+
i("div", vt, [
|
|
444
|
+
p(ae, {
|
|
445
|
+
max: k.max,
|
|
446
|
+
min: k.min,
|
|
447
|
+
"model-value": s.value,
|
|
448
|
+
picker: "month",
|
|
449
|
+
"onUpdate:modelValue": w[1] || (w[1] = (V) => o("left", V))
|
|
450
|
+
}, null, 8, ["max", "min", "model-value"]),
|
|
451
|
+
p(ae, {
|
|
452
|
+
max: k.max,
|
|
453
|
+
min: k.min,
|
|
454
|
+
"model-value": s.value,
|
|
455
|
+
picker: "year",
|
|
456
|
+
"onUpdate:modelValue": w[2] || (w[2] = (V) => o("left", V))
|
|
457
|
+
}, null, 8, ["max", "min", "model-value"])
|
|
458
|
+
])
|
|
459
|
+
]),
|
|
460
|
+
p(ve, {
|
|
461
|
+
"day-cell-class": {
|
|
462
|
+
status: {
|
|
463
|
+
isSelected: (V) => V.isSame(_.value, "date")
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
days: m.value,
|
|
467
|
+
"on-day-click": (V) => Y(V.date)
|
|
468
|
+
}, null, 8, ["day-cell-class", "days", "on-day-click"])
|
|
469
|
+
]),
|
|
470
|
+
i("div", null, [
|
|
471
|
+
i("div", ht, [
|
|
472
|
+
i("div", bt, [
|
|
473
|
+
p(ae, {
|
|
474
|
+
max: k.max,
|
|
475
|
+
min: k.min,
|
|
476
|
+
"model-value": f.value,
|
|
477
|
+
picker: "month",
|
|
478
|
+
"onUpdate:modelValue": w[3] || (w[3] = (V) => o("right", V))
|
|
479
|
+
}, null, 8, ["max", "min", "model-value"]),
|
|
480
|
+
p(ae, {
|
|
481
|
+
max: k.max,
|
|
482
|
+
min: k.min,
|
|
483
|
+
"model-value": f.value,
|
|
484
|
+
picker: "year",
|
|
485
|
+
"onUpdate:modelValue": w[4] || (w[4] = (V) => o("right", V))
|
|
486
|
+
}, null, 8, ["max", "min", "model-value"])
|
|
487
|
+
]),
|
|
488
|
+
p(r, {
|
|
489
|
+
outline: !1,
|
|
490
|
+
class: "cursor-pointer select-none",
|
|
491
|
+
color: "#1C1C1E",
|
|
492
|
+
name: "chevron_right",
|
|
493
|
+
size: "md",
|
|
494
|
+
onClick: w[5] || (w[5] = () => o("left", s.value.add(1, "month")))
|
|
495
|
+
})
|
|
496
|
+
]),
|
|
497
|
+
p(ve, {
|
|
498
|
+
"day-cell-class": {
|
|
499
|
+
status: {
|
|
500
|
+
isSelected: (V) => V.isSame(_.value, "date")
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
days: A.value,
|
|
504
|
+
"on-day-click": (V) => Y(V.date)
|
|
505
|
+
}, null, 8, ["day-cell-class", "days", "on-day-click"])
|
|
506
|
+
])
|
|
507
|
+
])
|
|
508
|
+
]),
|
|
509
|
+
p(v, {
|
|
510
|
+
"model-value": u.value ?? {
|
|
511
|
+
hours: 0,
|
|
512
|
+
minutes: 0,
|
|
513
|
+
period: "AM"
|
|
514
|
+
/* AM */
|
|
515
|
+
},
|
|
516
|
+
"onUpdate:modelValue": w[6] || (w[6] = (V) => u.value = V)
|
|
517
|
+
}, null, 8, ["model-value"]),
|
|
518
|
+
i("div", _t, [
|
|
519
|
+
p(S, {
|
|
520
|
+
label: d(l)("common.cancel"),
|
|
521
|
+
size: "md",
|
|
522
|
+
variant: "tertiary",
|
|
523
|
+
onClick: c
|
|
524
|
+
}, null, 8, ["label"]),
|
|
525
|
+
p(S, {
|
|
526
|
+
disabled: !_.value,
|
|
527
|
+
label: d(l)("common.confirm"),
|
|
528
|
+
size: "md",
|
|
529
|
+
variant: "primary",
|
|
530
|
+
onClick: a
|
|
531
|
+
}, null, 8, ["disabled", "label"])
|
|
532
|
+
])
|
|
533
|
+
])
|
|
534
|
+
]),
|
|
535
|
+
_: 1
|
|
536
|
+
}, 8, ["show-popover", "z-index"]);
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
}), yt = { class: "container" }, kt = /* @__PURE__ */ W({
|
|
540
|
+
__name: "ProgressBar",
|
|
541
|
+
props: {
|
|
542
|
+
bgcolor: {},
|
|
543
|
+
completed: {}
|
|
544
|
+
},
|
|
545
|
+
setup(T) {
|
|
546
|
+
const F = T, l = N(() => ({
|
|
547
|
+
height: "100%",
|
|
548
|
+
width: `${F.completed ?? 0}%`,
|
|
549
|
+
backgroundColor: F.bgcolor,
|
|
550
|
+
transition: "width 1s ease-in-out",
|
|
551
|
+
borderRadius: "inherit",
|
|
552
|
+
textAlign: "right"
|
|
553
|
+
}));
|
|
554
|
+
return (g, n) => (C(), M("div", yt, [
|
|
555
|
+
i("div", {
|
|
556
|
+
style: Ie(l.value)
|
|
557
|
+
}, null, 4)
|
|
558
|
+
]));
|
|
559
|
+
}
|
|
560
|
+
}), Ct = /* @__PURE__ */ ye(kt, [["__scopeId", "data-v-709d7500"]]), wt = {
|
|
561
|
+
class: "flex items-center gap-24"
|
|
562
|
+
}, xt = {
|
|
563
|
+
class: "fm-typo-en-title-md-600"
|
|
564
|
+
}, St = /* @__PURE__ */ W({
|
|
565
|
+
__name: "PublishProgressView",
|
|
566
|
+
props: {
|
|
567
|
+
progress: {
|
|
568
|
+
type: Number,
|
|
569
|
+
required: !1
|
|
570
|
+
},
|
|
571
|
+
restaurants: {
|
|
572
|
+
type: Array,
|
|
573
|
+
required: !0
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
emits: ["publishMenu"],
|
|
577
|
+
setup(T, {
|
|
578
|
+
expose: F,
|
|
579
|
+
emit: l
|
|
580
|
+
}) {
|
|
581
|
+
const {
|
|
582
|
+
t: g
|
|
583
|
+
} = Z(), n = ce(), x = _e(), u = T, _ = {
|
|
584
|
+
[G.F_PUBLISH_JOB_STATUS.Enum.PENDING]: {
|
|
585
|
+
label: "Pending",
|
|
586
|
+
textColor: "text-fm-color-neutral-gray-300",
|
|
587
|
+
backgroundColor: "#E0E0DE"
|
|
588
|
+
},
|
|
589
|
+
[G.F_PUBLISH_JOB_STATUS.Enum.RUNNING]: {
|
|
590
|
+
label: "Running",
|
|
591
|
+
textColor: "text-fm-color-system-warning-300",
|
|
592
|
+
backgroundColor: "#FFB800"
|
|
593
|
+
},
|
|
594
|
+
[G.F_PUBLISH_JOB_STATUS.Enum.COMPLETED]: {
|
|
595
|
+
label: "Completed",
|
|
596
|
+
textColor: "text-fm-color-system-success-300",
|
|
597
|
+
backgroundColor: "#34C759"
|
|
598
|
+
},
|
|
599
|
+
[G.F_PUBLISH_JOB_STATUS.Enum.FAILED]: {
|
|
600
|
+
label: "Failed",
|
|
601
|
+
textColor: "text-fm-color-system-error-300",
|
|
602
|
+
backgroundColor: "#FF3B30"
|
|
603
|
+
}
|
|
604
|
+
}, e = be(), b = P(!1), a = (r) => {
|
|
605
|
+
typeof r == "boolean" ? b.value = r : b.value = !b.value;
|
|
606
|
+
};
|
|
607
|
+
F({
|
|
608
|
+
show: b,
|
|
609
|
+
trigger: a
|
|
610
|
+
});
|
|
611
|
+
const c = l, y = N(() => e.state.nextSchedulerPublish ?? {}), s = N(() => Object.entries(y.value).map(([v, S]) => {
|
|
612
|
+
const D = e.runningPublishJob, V = S.restaurants ? S.restaurants.length : 0;
|
|
613
|
+
return {
|
|
614
|
+
date: v,
|
|
615
|
+
total_restaurants: `${V} restaurants`,
|
|
616
|
+
selectedRestaurantIds: S.restaurants || [],
|
|
617
|
+
status: S.status,
|
|
618
|
+
progress: D === v ? u.progress ?? 0 : 0
|
|
619
|
+
// Only apply progress to the running job's row
|
|
620
|
+
};
|
|
621
|
+
})), f = P([]), o = P(null), m = P(null), A = [{
|
|
622
|
+
accessorKey: "date",
|
|
623
|
+
header: "Date",
|
|
624
|
+
cell: ({
|
|
625
|
+
row: r
|
|
626
|
+
}) => {
|
|
627
|
+
if (r.original.date === "new") {
|
|
628
|
+
if (o.value !== null)
|
|
629
|
+
return new Date(o.value).toLocaleString();
|
|
630
|
+
const S = L(Date.now()).toISOString();
|
|
631
|
+
return R(gt, {
|
|
632
|
+
class: "flex h-full items-center",
|
|
633
|
+
modelValue: S,
|
|
634
|
+
"onUpdate:schedulerTime": (D) => {
|
|
635
|
+
o.value = D;
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
return new Date(r.original.date).toLocaleString();
|
|
640
|
+
}
|
|
641
|
+
}, {
|
|
642
|
+
accessorKey: "total_restaurants",
|
|
643
|
+
header: "Total restaurants",
|
|
644
|
+
cell: ({
|
|
645
|
+
row: r
|
|
646
|
+
}) => r.original.date === "new" ? R(tt, {
|
|
647
|
+
restaurants: u.restaurants,
|
|
648
|
+
"onUpdate:modelValue": (S) => {
|
|
649
|
+
f.value = S;
|
|
650
|
+
}
|
|
651
|
+
}) : R("div", {
|
|
652
|
+
class: "flex items-center justify-between"
|
|
653
|
+
}, [R("p", {}, r.original.total_restaurants), R(Q.FmMenu, {}, {
|
|
654
|
+
"menu-button": () => R(Q.FmIcon, {
|
|
655
|
+
name: "info",
|
|
656
|
+
class: "text-fm-color-neutral-gray-300 cursor-pointer"
|
|
657
|
+
}),
|
|
658
|
+
default: () => w(r.original.selectedRestaurantIds).map((S) => R(Q.FmMenuItem, {
|
|
659
|
+
key: S,
|
|
660
|
+
label: S
|
|
661
|
+
}))
|
|
662
|
+
})])
|
|
663
|
+
}, {
|
|
664
|
+
accessorKey: "progress",
|
|
665
|
+
header: "Progress",
|
|
666
|
+
cell: ({
|
|
667
|
+
row: r
|
|
668
|
+
}) => {
|
|
669
|
+
const v = r.original.status;
|
|
670
|
+
return r.original.date === "new" ? R("div", {
|
|
671
|
+
class: "flex justify-end items-center gap-8"
|
|
672
|
+
}, [R(Q.FmButton, {
|
|
673
|
+
variant: "tertiary",
|
|
674
|
+
prependIcon: "close",
|
|
675
|
+
textColor: "system-error-300",
|
|
676
|
+
onClick: () => {
|
|
677
|
+
o.value = null, B.value = null, m.value = null;
|
|
678
|
+
}
|
|
679
|
+
}), R(Q.FmButton, {
|
|
680
|
+
variant: "tertiary",
|
|
681
|
+
prependIcon: "check",
|
|
682
|
+
textColor: "system-success-300",
|
|
683
|
+
onClick: async () => {
|
|
684
|
+
if (!o.value || f.value.length === 0) {
|
|
685
|
+
m.value = !1, n.open({
|
|
686
|
+
type: "error",
|
|
687
|
+
message: "Please select date and restaurants to schedule publish."
|
|
688
|
+
});
|
|
689
|
+
return;
|
|
690
|
+
} else
|
|
691
|
+
m.value = !0;
|
|
692
|
+
}
|
|
693
|
+
})]) : R("div", {
|
|
694
|
+
class: "flex justify-between items-center gap-32"
|
|
695
|
+
}, [R("div", {
|
|
696
|
+
class: "flex flex-col w-full gap-4"
|
|
697
|
+
}, [R("div", {
|
|
698
|
+
class: "flex items-center gap-8"
|
|
699
|
+
}, [R("p", {
|
|
700
|
+
class: `fm-typo-en-body-md-400 ${_[v].textColor}`
|
|
701
|
+
}, _[v].label), ...v === G.F_PUBLISH_JOB_STATUS.Enum.RUNNING ? [R("p", {
|
|
702
|
+
class: `fm-typo-en-body-md-400 ${_[v].textColor}`
|
|
703
|
+
}, `(${r.original.progress}/${r.original.total_restaurants})`)] : []]), R(Ct, {
|
|
704
|
+
bgcolor: _[v].backgroundColor,
|
|
705
|
+
completed: v === G.F_PUBLISH_JOB_STATUS.Enum.PENDING ? 0 : v === G.F_PUBLISH_JOB_STATUS.Enum.RUNNING ? Math.floor((r.original.progress ?? 0) / parseInt(r.original.total_restaurants) * 100) : (v === G.F_PUBLISH_JOB_STATUS.Enum.COMPLETED, 100)
|
|
706
|
+
})]), R(Q.FmButton, {
|
|
707
|
+
variant: "tertiary",
|
|
708
|
+
prependIcon: "delete",
|
|
709
|
+
disabled: v !== G.F_PUBLISH_JOB_STATUS.Enum.PENDING,
|
|
710
|
+
textColor: "system-error-300",
|
|
711
|
+
onClick: () => {
|
|
712
|
+
const D = L(r.original.date).toISOString();
|
|
713
|
+
x.open({
|
|
714
|
+
title: "Confirm Remove",
|
|
715
|
+
message: "Are you sure you want to remove this scheduled publish? This action cannot be undone.",
|
|
716
|
+
primaryActions: {
|
|
717
|
+
text: "Remove",
|
|
718
|
+
close: !1
|
|
719
|
+
},
|
|
720
|
+
secondaryActions: {
|
|
721
|
+
text: "Cancel",
|
|
722
|
+
close: !0
|
|
723
|
+
}
|
|
724
|
+
}).onPrimary(() => {
|
|
725
|
+
e.deleteSchedulerPublish(D).then(() => {
|
|
726
|
+
n.open({
|
|
727
|
+
type: "success",
|
|
728
|
+
message: "Scheduled publish deleted successfully."
|
|
729
|
+
});
|
|
730
|
+
}).catch(() => {
|
|
731
|
+
n.open({
|
|
732
|
+
type: "error",
|
|
733
|
+
message: "Failed to delete scheduled publish. Please try again."
|
|
734
|
+
});
|
|
735
|
+
}).finally(() => {
|
|
736
|
+
x.close();
|
|
737
|
+
});
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
})]);
|
|
741
|
+
}
|
|
742
|
+
}];
|
|
743
|
+
ie(async () => {
|
|
744
|
+
await e.getNextSchedulerPublish();
|
|
745
|
+
});
|
|
746
|
+
const B = P(null);
|
|
747
|
+
function Y() {
|
|
748
|
+
m.value = !1, B.value = {
|
|
749
|
+
date: "new",
|
|
750
|
+
restaurantsIds: []
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
de(m, async (r) => {
|
|
754
|
+
r && (c("publishMenu", {
|
|
755
|
+
schedulerTime: o.value,
|
|
756
|
+
restaurantIds: f.value
|
|
757
|
+
}), await e.getNextSchedulerPublish(), o.value = null, f.value = [], m.value = !1, B.value = null, m.value = null);
|
|
758
|
+
});
|
|
759
|
+
const k = ge(() => m.value !== null && m.value === !1, () => {
|
|
760
|
+
b.value = !1, B.value = null, o.value = null, f.value = [], m.value = null;
|
|
761
|
+
});
|
|
762
|
+
function w(r) {
|
|
763
|
+
return u.restaurants.filter((v) => r.includes(v._id)).map((v) => v.name);
|
|
764
|
+
}
|
|
765
|
+
return (r, v) => {
|
|
766
|
+
const S = U("FmButton"), D = U("FmTable"), V = U("FmSideSheet");
|
|
767
|
+
return C(), M(H, null, [Pe(r.$slots, "default", {
|
|
768
|
+
trigger: a
|
|
769
|
+
}), p(V, {
|
|
770
|
+
modelValue: b.value,
|
|
771
|
+
"onUpdate:modelValue": v[1] || (v[1] = (O) => b.value = O),
|
|
772
|
+
"close-button": !1,
|
|
773
|
+
"max-width": 800,
|
|
774
|
+
"onOn:clickedAway": d(k)
|
|
775
|
+
}, {
|
|
776
|
+
"side-sheet-header": E(() => [i("div", wt, [p(S, {
|
|
777
|
+
variant: d(fe).Tertiary,
|
|
778
|
+
"prepend-icon": "arrow_back",
|
|
779
|
+
onClick: te(d(k), ["stop"])
|
|
780
|
+
}, null, 8, ["variant", "onClick"]), i("p", xt, z(d(g)("menu.publish.actions.publish_progress")), 1)])]),
|
|
781
|
+
default: E(() => [i("div", null, [p(D, {
|
|
782
|
+
class: "pb-8",
|
|
783
|
+
"row-data": [...s.value, B.value].filter(Boolean),
|
|
784
|
+
"column-defs": A,
|
|
785
|
+
"shrink-at": !1,
|
|
786
|
+
pageSize: s.value.length + (B.value ? 1 : 0),
|
|
787
|
+
"hide-footer": ""
|
|
788
|
+
}, null, 8, ["row-data", "pageSize"]), d(e).state.featureFlags.schedulerPublish && !B.value ? (C(), j(S, {
|
|
789
|
+
key: 0,
|
|
790
|
+
variant: d(fe).Plain,
|
|
791
|
+
"prepend-icon": "add",
|
|
792
|
+
label: d(g)("menu.publish.actions.add_scheduler_publish"),
|
|
793
|
+
onClick: v[0] || (v[0] = () => Y())
|
|
794
|
+
}, null, 8, ["variant", "label"])) : X("", !0)])]),
|
|
795
|
+
_: 1
|
|
796
|
+
}, 8, ["modelValue", "onOn:clickedAway"])], 64);
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
}), Ft = { class: "fm-typo-en-title-md-600" }, Vt = { class: "mt-40" }, It = { class: "fm-typo-en-title-sm-600" }, Pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mt-4 mb-8" }, Mt = { class: "flex gap-8 items-center justify-start" }, $t = /* @__PURE__ */ W({
|
|
800
|
+
__name: "UpdateCatalogDialog",
|
|
801
|
+
props: {
|
|
802
|
+
catalogs: {
|
|
803
|
+
type: Array,
|
|
804
|
+
required: !0
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
emits: ["onComplete"],
|
|
808
|
+
setup(T, { expose: F, emit: l }) {
|
|
809
|
+
const { t: g } = Z(), n = T;
|
|
810
|
+
F({
|
|
811
|
+
show: y,
|
|
812
|
+
hide: s
|
|
813
|
+
});
|
|
814
|
+
const x = l;
|
|
815
|
+
function u() {
|
|
816
|
+
return {
|
|
817
|
+
restaurantId: "",
|
|
818
|
+
catalogId: void 0,
|
|
819
|
+
takeawayCatalog: void 0,
|
|
820
|
+
pickupCatalog: null,
|
|
821
|
+
additionalCatalogs: []
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
const _ = N(() => [
|
|
825
|
+
{
|
|
826
|
+
label: g("menu.publish.update_catalog_dialog.sections.default.use_default"),
|
|
827
|
+
value: null
|
|
828
|
+
},
|
|
829
|
+
...n.catalogs.map((m) => ({
|
|
830
|
+
label: m.name,
|
|
831
|
+
value: m._id
|
|
832
|
+
}))
|
|
833
|
+
]), e = N(() => [
|
|
834
|
+
{
|
|
835
|
+
label: g("menu.publish.update_catalog_dialog.sections.default.use_default"),
|
|
836
|
+
value: null
|
|
837
|
+
},
|
|
838
|
+
...n.catalogs.map((m) => ({
|
|
839
|
+
label: m.name,
|
|
840
|
+
value: m._id
|
|
841
|
+
}))
|
|
842
|
+
]), b = P(u()), a = P(!1), c = P(void 0);
|
|
843
|
+
function y(m) {
|
|
844
|
+
c.value = m ? pe(m) : u(), b.value = pe(c.value), a.value = !0;
|
|
845
|
+
}
|
|
846
|
+
function s() {
|
|
847
|
+
a.value = !1;
|
|
848
|
+
}
|
|
849
|
+
const f = ge(
|
|
850
|
+
() => !Re.isEqual(c.value, b.value),
|
|
851
|
+
() => {
|
|
852
|
+
s();
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
function o() {
|
|
856
|
+
s(), x("onComplete", b.value);
|
|
857
|
+
}
|
|
858
|
+
return (m, A) => {
|
|
859
|
+
const B = U("FmSelect"), Y = U("FmCheckbox"), k = U("FmButton"), w = U("FmSideSheet");
|
|
860
|
+
return C(), j(w, {
|
|
861
|
+
modelValue: a.value,
|
|
862
|
+
"onUpdate:modelValue": A[5] || (A[5] = (r) => a.value = r),
|
|
863
|
+
"max-width": 560,
|
|
864
|
+
"onOn:clickedAway": d(f)
|
|
865
|
+
}, {
|
|
866
|
+
"side-sheet-header": E(() => [
|
|
867
|
+
i("span", Ft, z(d(g)("menu.publish.update_catalog_dialog.title")), 1)
|
|
868
|
+
]),
|
|
869
|
+
"side-sheet-footer": E(() => [
|
|
870
|
+
i("div", Mt, [
|
|
871
|
+
p(k, {
|
|
872
|
+
label: d(g)("menu.publish.update_catalog_dialog.actions.update"),
|
|
873
|
+
size: "lg",
|
|
874
|
+
variant: "primary",
|
|
875
|
+
onClick: A[4] || (A[4] = () => o())
|
|
876
|
+
}, null, 8, ["label"]),
|
|
877
|
+
p(k, {
|
|
878
|
+
label: d(g)("menu.publish.update_catalog_dialog.actions.cancel"),
|
|
879
|
+
size: "lg",
|
|
880
|
+
variant: "tertiary",
|
|
881
|
+
onClick: s
|
|
882
|
+
}, null, 8, ["label"])
|
|
883
|
+
])
|
|
884
|
+
]),
|
|
885
|
+
default: E(() => [
|
|
886
|
+
p(B, {
|
|
887
|
+
modelValue: b.value.catalogId,
|
|
888
|
+
"onUpdate:modelValue": A[0] || (A[0] = (r) => b.value.catalogId = r),
|
|
889
|
+
items: _.value,
|
|
890
|
+
class: "mb-24",
|
|
891
|
+
label: d(g)("menu.publish.update_catalog_dialog.sections.default.label")
|
|
892
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
893
|
+
p(B, {
|
|
894
|
+
modelValue: b.value.takeawayCatalog,
|
|
895
|
+
"onUpdate:modelValue": A[1] || (A[1] = (r) => b.value.takeawayCatalog = r),
|
|
896
|
+
items: e.value,
|
|
897
|
+
class: "mb-24",
|
|
898
|
+
label: d(g)("menu.publish.update_catalog_dialog.sections.pos_takeaway.label")
|
|
899
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
900
|
+
p(B, {
|
|
901
|
+
modelValue: b.value.pickupCatalog,
|
|
902
|
+
"onUpdate:modelValue": A[2] || (A[2] = (r) => b.value.pickupCatalog = r),
|
|
903
|
+
items: e.value,
|
|
904
|
+
label: d(g)("menu.publish.update_catalog_dialog.sections.pickup.label")
|
|
905
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
906
|
+
i("div", Vt, [
|
|
907
|
+
i("div", It, z(d(g)("menu.publish.update_catalog_dialog.sections.additional.title")), 1),
|
|
908
|
+
i("div", Pt, z(d(g)("menu.publish.update_catalog_dialog.sections.additional.subtitle")), 1),
|
|
909
|
+
(C(!0), M(H, null, q(T.catalogs, (r) => (C(), M("div", {
|
|
910
|
+
key: r._id
|
|
911
|
+
}, [
|
|
912
|
+
p(Y, {
|
|
913
|
+
modelValue: b.value.additionalCatalogs,
|
|
914
|
+
"onUpdate:modelValue": A[3] || (A[3] = (v) => b.value.additionalCatalogs = v),
|
|
915
|
+
label: r.name,
|
|
916
|
+
value: r._id
|
|
917
|
+
}, null, 8, ["modelValue", "label", "value"])
|
|
918
|
+
]))), 128))
|
|
919
|
+
])
|
|
920
|
+
]),
|
|
921
|
+
_: 1
|
|
922
|
+
}, 8, ["modelValue", "onOn:clickedAway"]);
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
}), Ut = {
|
|
926
|
+
class: "flex flex-col p-24 bg-fm-color-neutral-white min-h-[calc(100dvh-56px)] xs:max-h-[calc(100dvh-56px)]"
|
|
927
|
+
}, At = {
|
|
928
|
+
class: "flex items-center xs:mb-8 mb-24"
|
|
929
|
+
}, Bt = {
|
|
930
|
+
class: "mr-8"
|
|
931
|
+
}, Dt = {
|
|
932
|
+
class: "fm-typo-en-title-md-600"
|
|
933
|
+
}, Tt = {
|
|
934
|
+
class: "xs:hidden mr-16"
|
|
935
|
+
}, Rt = {
|
|
936
|
+
class: "xs:hidden mr-16"
|
|
937
|
+
}, Ot = {
|
|
938
|
+
class: "xs:hidden"
|
|
939
|
+
}, Nt = {
|
|
940
|
+
class: "pb-8 flex justify-between items-start xs:flex-col xs:items-stretch gap-8"
|
|
941
|
+
}, Et = {
|
|
942
|
+
class: "grow flex flex-col gap-4"
|
|
943
|
+
}, Lt = {
|
|
944
|
+
class: "flex gap-8 items-center"
|
|
945
|
+
}, zt = {
|
|
946
|
+
class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary"
|
|
947
|
+
}, Ht = {
|
|
948
|
+
class: "space-y-4"
|
|
949
|
+
}, Jt = {
|
|
950
|
+
class: "fm-typo-en-body-lg-600"
|
|
951
|
+
}, Yt = {
|
|
952
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
953
|
+
}, Kt = {
|
|
954
|
+
class: "flex gap-8"
|
|
955
|
+
}, jt = {
|
|
956
|
+
class: "xs:block hidden fixed bottom-72 right-16"
|
|
957
|
+
}, oa = /* @__PURE__ */ W({
|
|
958
|
+
__name: "Publish",
|
|
959
|
+
setup(T) {
|
|
960
|
+
const F = $e(), {
|
|
961
|
+
t: l
|
|
962
|
+
} = Z(), g = ({
|
|
963
|
+
row: t
|
|
964
|
+
}) => {
|
|
965
|
+
const h = t.status === "latest";
|
|
966
|
+
return p(He, {
|
|
967
|
+
label: l(h ? "menu.publish.table.status.latest" : "menu.publish.table.status.outdated"),
|
|
968
|
+
variant: h ? "success" : "warning"
|
|
969
|
+
}, null);
|
|
970
|
+
}, n = P({}), x = [{
|
|
971
|
+
accessorKey: "name",
|
|
972
|
+
header: () => l("menu.publish.table.columns.restaurant"),
|
|
973
|
+
cell: (t) => t.getValue(),
|
|
974
|
+
enableSorting: !0
|
|
975
|
+
}, {
|
|
976
|
+
accessorKey: "catalog",
|
|
977
|
+
header: () => l("menu.publish.table.columns.default"),
|
|
978
|
+
enableSorting: !1,
|
|
979
|
+
cell: (t) => t.getValue().default
|
|
980
|
+
}, {
|
|
981
|
+
accessorKey: "catalog",
|
|
982
|
+
header: () => l("menu.publish.table.columns.pos_takeaway"),
|
|
983
|
+
enableSorting: !1,
|
|
984
|
+
cell: (t) => t.getValue().takeaway
|
|
985
|
+
}, {
|
|
986
|
+
accessorKey: "catalog",
|
|
987
|
+
header: () => l("menu.publish.table.columns.pickup"),
|
|
988
|
+
enableSorting: !1,
|
|
989
|
+
cell: (t) => t.getValue().pickup
|
|
990
|
+
}, {
|
|
991
|
+
accessorKey: "updatedAt",
|
|
992
|
+
header: () => l("menu.publish.table.columns.version"),
|
|
993
|
+
enableSorting: !1,
|
|
994
|
+
cell: (t) => {
|
|
995
|
+
const h = t.getValue();
|
|
996
|
+
return s(h);
|
|
997
|
+
}
|
|
998
|
+
}, {
|
|
999
|
+
accessorKey: "status",
|
|
1000
|
+
header: () => l("menu.common.labels.status"),
|
|
1001
|
+
enableSorting: !1,
|
|
1002
|
+
cell: (t) => p(g, {
|
|
1003
|
+
row: t.row.original
|
|
1004
|
+
}, null)
|
|
1005
|
+
}, {
|
|
1006
|
+
accessorKey: "_id",
|
|
1007
|
+
header: "",
|
|
1008
|
+
size: 52,
|
|
1009
|
+
enableSorting: !1,
|
|
1010
|
+
cell: (t) => {
|
|
1011
|
+
const h = t.row.original;
|
|
1012
|
+
return R("div", {
|
|
1013
|
+
class: "flex justify-end gap-8"
|
|
1014
|
+
}, [a.value && h.revertConfig ? Ke(R(Q.FmButton, {
|
|
1015
|
+
prependIcon: "undo",
|
|
1016
|
+
variant: "secondary",
|
|
1017
|
+
onClick: te(async () => {
|
|
1018
|
+
await c(t.row.original);
|
|
1019
|
+
}, ["stop", "prevent"])
|
|
1020
|
+
}), l("menu.publish.actions.revert")) : null, R(Q.FmButton, {
|
|
1021
|
+
label: l("menu.publish.actions.publish"),
|
|
1022
|
+
icon: "ios_share",
|
|
1023
|
+
variant: "secondary",
|
|
1024
|
+
onClick: te(async () => {
|
|
1025
|
+
const $ = A(t.row.original);
|
|
1026
|
+
await w($);
|
|
1027
|
+
}, ["stop", "prevent"])
|
|
1028
|
+
})]);
|
|
1029
|
+
},
|
|
1030
|
+
meta: {
|
|
1031
|
+
width: "150px"
|
|
1032
|
+
}
|
|
1033
|
+
}], u = P(""), _ = P(), e = be(), b = _e(), a = N(() => e.version !== G.F_MENU_VERSION.enum.v3);
|
|
1034
|
+
async function c(t) {
|
|
1035
|
+
t.revertConfig && b.open({
|
|
1036
|
+
title: "Revert menu",
|
|
1037
|
+
contentComponent: Xe,
|
|
1038
|
+
contentComponentProps: {
|
|
1039
|
+
restaurant: t
|
|
1040
|
+
},
|
|
1041
|
+
primaryActions: {
|
|
1042
|
+
text: "Revert",
|
|
1043
|
+
close: !0
|
|
1044
|
+
},
|
|
1045
|
+
secondaryActions: {
|
|
1046
|
+
text: "Cancel",
|
|
1047
|
+
close: !0
|
|
1048
|
+
}
|
|
1049
|
+
}).onPrimary(async () => {
|
|
1050
|
+
await k.minor(async () => {
|
|
1051
|
+
await e.revertRestaurantMenu(t._id);
|
|
1052
|
+
}, {
|
|
1053
|
+
customId: t._id,
|
|
1054
|
+
message: `Revert menu of ${t.name}`
|
|
1055
|
+
});
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
const y = N(() => l("menu.publish.labels.main_version", {
|
|
1059
|
+
version: s(e.state.menu.updatedAt)
|
|
1060
|
+
}));
|
|
1061
|
+
function s(t) {
|
|
1062
|
+
return t ? L(t).format("DD/MM/YYYY hh:mmA") : "";
|
|
1063
|
+
}
|
|
1064
|
+
const f = N(() => e.state.menu.modules.catalog), o = N(() => k.queue.value.some((t) => t.id === e.state.menu._id));
|
|
1065
|
+
function m(t) {
|
|
1066
|
+
var h;
|
|
1067
|
+
return t ? ((h = f.value.find(($) => $._id === t)) == null ? void 0 : h.name) ?? l("menu.publish.labels.catalog.invalid") : l("menu.publish.labels.catalog.main");
|
|
1068
|
+
}
|
|
1069
|
+
function A(t) {
|
|
1070
|
+
return {
|
|
1071
|
+
restaurantId: t._id,
|
|
1072
|
+
catalogId: t.catalogId,
|
|
1073
|
+
takeawayCatalog: t.takeawayCatalog,
|
|
1074
|
+
pickupCatalog: t.pickupCatalog || null,
|
|
1075
|
+
additionalCatalogs: t.additionalCatalogs
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
function B(t) {
|
|
1079
|
+
var $;
|
|
1080
|
+
const h = A(t);
|
|
1081
|
+
($ = _.value) == null || $.show(h);
|
|
1082
|
+
}
|
|
1083
|
+
const Y = ce(), k = he(Y);
|
|
1084
|
+
async function w(t) {
|
|
1085
|
+
var $;
|
|
1086
|
+
const h = ($ = v.value.find((K) => K._id === t.restaurantId)) == null ? void 0 : $.name;
|
|
1087
|
+
await k.minor(async () => await e.publishMenu(t), {
|
|
1088
|
+
customId: e.state.menu._id,
|
|
1089
|
+
message: `Publishing menu for ${h}`,
|
|
1090
|
+
successMessage: `Published to ${h}`
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
const r = P(null), v = N(() => {
|
|
1094
|
+
const t = u.value.toLowerCase(), h = e.state.menu.updatedAt;
|
|
1095
|
+
return e.state.restaurants.filter(($) => {
|
|
1096
|
+
var K;
|
|
1097
|
+
return !r.value || ((K = r.value) == null ? void 0 : K.includes($._id));
|
|
1098
|
+
}).map(($) => ({
|
|
1099
|
+
...$,
|
|
1100
|
+
catalog: {
|
|
1101
|
+
default: m($.catalogId),
|
|
1102
|
+
takeaway: m($.takeawayCatalog),
|
|
1103
|
+
pickup: m($.pickupCatalog)
|
|
1104
|
+
},
|
|
1105
|
+
status: h === $.updatedAt ? "latest" : "outdated"
|
|
1106
|
+
})).filter(($) => Ue($, S.value)).filter(({
|
|
1107
|
+
name: $,
|
|
1108
|
+
catalog: K
|
|
1109
|
+
}) => t ? $.toLowerCase().includes(t) || K.default.toLowerCase().includes(t) || K.takeaway.toLowerCase().includes(t) || K.pickup.toLowerCase().includes(t) : !0);
|
|
1110
|
+
}), S = P({
|
|
1111
|
+
logic: "AND",
|
|
1112
|
+
rules: []
|
|
1113
|
+
}), D = [{
|
|
1114
|
+
type: "string",
|
|
1115
|
+
key: "status",
|
|
1116
|
+
entity: "menu",
|
|
1117
|
+
values: ["latest", "outdated"]
|
|
1118
|
+
}], V = P(0), O = P(null), ee = P(null), ne = P(null);
|
|
1119
|
+
async function Ce() {
|
|
1120
|
+
await k.minor(async () => await e.readRestaurants(), {
|
|
1121
|
+
customId: e.state.menu._id
|
|
1122
|
+
}), await e.getNextSchedulerPublish(), e.runningPublishJob !== null ? O.value === null && (O.value = setInterval(async () => {
|
|
1123
|
+
await oe();
|
|
1124
|
+
}, 3e4)) : (ne.value && (Y.close(ne.value), ne.value = null), O.value !== null && (clearInterval(O.value), O.value = null), ee.value = null);
|
|
1125
|
+
}
|
|
1126
|
+
async function se(t) {
|
|
1127
|
+
if (o.value) return;
|
|
1128
|
+
const h = Object.keys(n.value).filter((J) => n.value[J]), $ = h.length === 0 || h.length === v.value.length ? v.value : v.value.filter((J) => h.includes(J._id));
|
|
1129
|
+
if (t ? t.restaurantIds.length === e.state.restaurants.length : v.value.length === e.state.restaurants.length && (h.length === 0 || h.length === v.value.length))
|
|
1130
|
+
await k.minor(async () => {
|
|
1131
|
+
await e.publishAllMenu(t == null ? void 0 : t.schedulerTime);
|
|
1132
|
+
}, {
|
|
1133
|
+
successMessage: "Menu publish registered for all restaurants."
|
|
1134
|
+
}), ee.value = !1;
|
|
1135
|
+
else {
|
|
1136
|
+
const J = (t == null ? void 0 : t.restaurantIds) || $.map((ue) => ue._id);
|
|
1137
|
+
await k.minor(async () => {
|
|
1138
|
+
await e.publishMultipleMenu(J, t == null ? void 0 : t.schedulerTime, !1);
|
|
1139
|
+
}, {
|
|
1140
|
+
successMessage: `Menu publish registered for ${t != null && t.restaurantIds ? t.restaurantIds.length : $.length} restaurant(s).`
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
ee.value = !1, V.value = await e.getPublishRestaurantsProgress(), O.value !== null && (clearInterval(O.value), O.value = null), O.value = setInterval(async () => {
|
|
1144
|
+
await oe();
|
|
1145
|
+
}, 3e4);
|
|
1146
|
+
}
|
|
1147
|
+
async function oe() {
|
|
1148
|
+
await e.getNextSchedulerPublish(), e.runningPublishJob !== null ? (ee.value = !1, V.value = await e.getPublishRestaurantsProgress()) : (ee.value = !0, O.value !== null && (clearInterval(O.value), O.value = null));
|
|
1149
|
+
}
|
|
1150
|
+
return de(() => V.value, async (t) => {
|
|
1151
|
+
await e.readRestaurants();
|
|
1152
|
+
}), ie(async () => {
|
|
1153
|
+
await e.getNextSchedulerPublish(), O.value === null && (O.value = setInterval(async () => {
|
|
1154
|
+
await oe();
|
|
1155
|
+
}, 3e4));
|
|
1156
|
+
}), Me(() => {
|
|
1157
|
+
O.value != null && (clearInterval(O.value), O.value = null);
|
|
1158
|
+
}), (t, h) => {
|
|
1159
|
+
const $ = U("FmChip"), K = U("FmSpacer"), J = U("FmButton"), ue = U("FmBadge"), we = U("FmSearch"), xe = U("FmTable"), Se = U("FmListItem"), Fe = U("FmList");
|
|
1160
|
+
return C(), M(H, null, [i("div", Ut, [i("div", At, [i("div", Bt, [i("div", Dt, z(d(l)("menu.publish.title")), 1), h[9] || (h[9] = i("div", {
|
|
1161
|
+
class: "hidden xs:block fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1162
|
+
}, null, -1))]), p($, {
|
|
1163
|
+
label: y.value,
|
|
1164
|
+
class: "xs:hidden text-fm-color-primary bg-fm-color-system-warning-100"
|
|
1165
|
+
}, null, 8, ["label"]), p(K), i("div", Tt, [p(J, {
|
|
1166
|
+
disabled: o.value,
|
|
1167
|
+
label: d(l)("menu.publish.actions.refresh"),
|
|
1168
|
+
variant: "secondary",
|
|
1169
|
+
onClick: h[0] || (h[0] = () => Ce())
|
|
1170
|
+
}, null, 8, ["disabled", "label"])]), i("div", Rt, [p(St, {
|
|
1171
|
+
progress: V.value,
|
|
1172
|
+
restaurants: v.value,
|
|
1173
|
+
onPublishMenu: h[1] || (h[1] = (I) => se(I))
|
|
1174
|
+
}, {
|
|
1175
|
+
default: E(({
|
|
1176
|
+
trigger: I
|
|
1177
|
+
}) => [d(e).runningPublishJob !== null ? (C(), j(ue, {
|
|
1178
|
+
key: 0,
|
|
1179
|
+
variant: "critical",
|
|
1180
|
+
value: 1
|
|
1181
|
+
}, {
|
|
1182
|
+
default: E(() => [p(J, {
|
|
1183
|
+
variant: "secondary",
|
|
1184
|
+
disabled: o.value,
|
|
1185
|
+
label: d(l)("menu.publish.actions.publish_progress"),
|
|
1186
|
+
onClick: I
|
|
1187
|
+
}, null, 8, ["disabled", "label", "onClick"])]),
|
|
1188
|
+
_: 2
|
|
1189
|
+
}, 1024)) : (C(), j(J, {
|
|
1190
|
+
key: 1,
|
|
1191
|
+
variant: "secondary",
|
|
1192
|
+
disabled: o.value,
|
|
1193
|
+
label: d(l)("menu.publish.actions.publish_progress"),
|
|
1194
|
+
onClick: I
|
|
1195
|
+
}, null, 8, ["disabled", "label", "onClick"]))]),
|
|
1196
|
+
_: 1
|
|
1197
|
+
}, 8, ["progress", "restaurants"])]), i("div", Ot, [p(J, {
|
|
1198
|
+
disabled: o.value,
|
|
1199
|
+
icon: "ios_share",
|
|
1200
|
+
label: d(l)("menu.publish.actions.publish_all"),
|
|
1201
|
+
variant: "primary",
|
|
1202
|
+
onClick: h[2] || (h[2] = () => se())
|
|
1203
|
+
}, null, 8, ["disabled", "label"])])]), i("div", Nt, [p(d(Ee), {
|
|
1204
|
+
multiple: "",
|
|
1205
|
+
modelValue: r.value,
|
|
1206
|
+
"onUpdate:modelValue": h[4] || (h[4] = (I) => r.value = I)
|
|
1207
|
+
}, {
|
|
1208
|
+
"append-right": E(() => [p(d(Ae), {
|
|
1209
|
+
modelValue: S.value,
|
|
1210
|
+
"onUpdate:modelValue": h[3] || (h[3] = (I) => S.value = I),
|
|
1211
|
+
attributes: D
|
|
1212
|
+
}, null, 8, ["modelValue"])]),
|
|
1213
|
+
_: 1
|
|
1214
|
+
}, 8, ["modelValue"]), p(we, {
|
|
1215
|
+
modelValue: u.value,
|
|
1216
|
+
"onUpdate:modelValue": h[5] || (h[5] = (I) => u.value = I),
|
|
1217
|
+
autofocus: "",
|
|
1218
|
+
class: "w-[320px] xs:w-full",
|
|
1219
|
+
placeholder: d(l)("menu.publish.table.search.placeholder")
|
|
1220
|
+
}, null, 8, ["modelValue", "placeholder"])]), v.value.length > 0 ? (C(), M(H, {
|
|
1221
|
+
key: 0
|
|
1222
|
+
}, [p(Je, {
|
|
1223
|
+
class: "xs:hidden block"
|
|
1224
|
+
}, {
|
|
1225
|
+
default: E(() => [p(xe, {
|
|
1226
|
+
modelValue: n.value,
|
|
1227
|
+
"onUpdate:modelValue": h[6] || (h[6] = (I) => n.value = I),
|
|
1228
|
+
"get-row-id": (I) => I._id,
|
|
1229
|
+
"column-defs": x,
|
|
1230
|
+
loading: o.value,
|
|
1231
|
+
"page-size": v.value.length,
|
|
1232
|
+
"row-data": v.value,
|
|
1233
|
+
shrinkAt: !1,
|
|
1234
|
+
virtual: !0,
|
|
1235
|
+
selection: "multiple",
|
|
1236
|
+
"hide-footer": "",
|
|
1237
|
+
"pin-header-row": "",
|
|
1238
|
+
onRowClick: h[7] || (h[7] = (I) => B(I.original))
|
|
1239
|
+
}, null, 8, ["modelValue", "get-row-id", "loading", "page-size", "row-data"])]),
|
|
1240
|
+
_: 1
|
|
1241
|
+
}), p(Fe, {
|
|
1242
|
+
class: "flex-col flex-1 min-h-0 overflow-auto xs:flex hidden w-full pb-64",
|
|
1243
|
+
separator: ""
|
|
1244
|
+
}, {
|
|
1245
|
+
default: E(() => [(C(!0), M(H, null, q(v.value, (I) => (C(), j(Se, {
|
|
1246
|
+
key: I._id,
|
|
1247
|
+
label: I.name,
|
|
1248
|
+
style: {
|
|
1249
|
+
padding: "12px 0 !important"
|
|
1250
|
+
},
|
|
1251
|
+
onClick: () => B(I)
|
|
1252
|
+
}, {
|
|
1253
|
+
default: E(() => [i("div", Et, [i("div", Lt, [i("div", zt, z(s(I.updatedAt)), 1), p(g, {
|
|
1254
|
+
row: I
|
|
1255
|
+
}, null, 8, ["row"])]), i("div", Ht, [i("div", Jt, z(I.name), 1), i("div", Yt, [i("div", null, "Default: " + z(I.catalog.default), 1), i("div", null, "POS takeaway: " + z(I.catalog.takeaway), 1), i("div", null, "Pickup: " + z(I.catalog.pickup), 1)])])]), i("div", Kt, [a.value && I.revertConfig ? (C(), j(J, {
|
|
1256
|
+
key: 0,
|
|
1257
|
+
disabled: o.value,
|
|
1258
|
+
icon: "undo",
|
|
1259
|
+
variant: "tertiary",
|
|
1260
|
+
onClick: te(() => c(I), ["stop"])
|
|
1261
|
+
}, null, 8, ["disabled", "onClick"])) : X("", !0), p(J, {
|
|
1262
|
+
disabled: o.value,
|
|
1263
|
+
icon: "ios_share",
|
|
1264
|
+
variant: "tertiary",
|
|
1265
|
+
onClick: te(() => w(A(I)), ["stop"])
|
|
1266
|
+
}, null, 8, ["disabled", "onClick"])])]),
|
|
1267
|
+
_: 2
|
|
1268
|
+
}, 1032, ["label", "onClick"]))), 128))]),
|
|
1269
|
+
_: 1
|
|
1270
|
+
})], 64)) : (C(), j(d(Oe), {
|
|
1271
|
+
key: 1,
|
|
1272
|
+
title: d(l)("menu.publish.empty.title"),
|
|
1273
|
+
subtitle: d(l)("menu.publish.empty.subtitle"),
|
|
1274
|
+
action: {
|
|
1275
|
+
text: d(l)("menu.publish.empty.action"),
|
|
1276
|
+
icon: "add",
|
|
1277
|
+
callback: () => {
|
|
1278
|
+
d(F).push({
|
|
1279
|
+
name: "$settings-my-business"
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}, null, 8, ["title", "subtitle", "action"]))]), i("div", jt, [p(J, {
|
|
1284
|
+
disabled: o.value,
|
|
1285
|
+
icon: "ios_share",
|
|
1286
|
+
label: d(l)("menu.publish.actions.publish_all"),
|
|
1287
|
+
variant: "fab",
|
|
1288
|
+
onClick: h[8] || (h[8] = () => se())
|
|
1289
|
+
}, null, 8, ["disabled", "label"])]), p($t, {
|
|
1290
|
+
ref_key: "updateCatalogDialogRef",
|
|
1291
|
+
ref: _,
|
|
1292
|
+
catalogs: f.value,
|
|
1293
|
+
onOnComplete: w
|
|
1294
|
+
}, null, 8, ["catalogs"])], 64);
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
export {
|
|
1299
|
+
oa as default
|
|
1300
|
+
};
|