@feedmepos/mf-menu 0.32.11-dev → 0.32.12-dev
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-BMQJXzfs.js → App-D0JZMDPU.js} +14 -10
- package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BwPzEkZi.js → ApplyProduct.vue_vue_type_script_setup_true_lang-C5fI7pDt.js} +3 -3
- package/dist/{Catalog-DD9pz5om.js → Catalog-BIVVmu4F.js} +6 -6
- package/dist/{Category-Dbxxz-jo.js → Category-Cmf6dD5G.js} +6 -6
- package/dist/{Category-B_PZ_G_u.js → Category-DoEzIDPA.js} +4 -4
- package/dist/{CookingGuide-DHnJp0ti.js → CookingGuide-DxQ5vDF5.js} +4 -4
- package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-DwLbvoN2.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-BQscJC6_.js} +1 -1
- package/dist/{Group-D5DNbNUE.js → Group-EAACXFDr.js} +1 -1
- package/dist/{Group-TogIQUnh.js → Group-l59a7MQy.js} +3 -3
- package/dist/{Group.vue_vue_type_script_setup_true_lang-BtiHaKaM.js → Group.vue_vue_type_script_setup_true_lang-CdIKM2jO.js} +7 -7
- package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-DRYeG7wX.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CendqbFI.js} +5 -5
- package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-CX-Q1qT4.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-B3I3jPxC.js} +3891 -3871
- package/dist/{Ingredient-B_Cu5XUX.js → Ingredient-B7kPk3oV.js} +3 -3
- package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-JMpeJ55c.js → InventoryBinding.vue_vue_type_script_setup_true_lang-CzpY9mWg.js} +2 -2
- package/dist/{LinkProductSideSheet-qp0TBdii.js → LinkProductSideSheet-CeXhbGnn.js} +208 -213
- package/dist/{MenuSetting-CuMpJ9E0.js → MenuSetting-CCtL2qui.js} +5 -5
- package/dist/{PrintRoute-DQVaF9Jy.js → PrintRoute-DMLRAZJg.js} +4 -4
- package/dist/{Product-DZkUA6iZ.js → Product-BAcGhIEf.js} +1 -1
- package/dist/{Product.vue_vue_type_script_setup_true_lang-BJfoQDpz.js → Product.vue_vue_type_script_setup_true_lang-V8-_F7WQ.js} +14 -14
- package/dist/{ProductInternalTools-KzWVZEWb.js → ProductInternalTools-BrQwrwyG.js} +28 -29
- package/dist/{Products-Bo7V88vF.js → Products-O5YVYdlT.js} +11 -11
- package/dist/Publish-CtKo19_y.js +1262 -0
- package/dist/{Recipe-DDIYbpDs.js → Recipe-ORx3rnvx.js} +4 -4
- package/dist/{RuleView.vue_vue_type_script_setup_true_lang-CEtK-cui.js → RuleView.vue_vue_type_script_setup_true_lang-biTDrokQ.js} +2 -2
- package/dist/{Scheduler-CnRzjrae.js → Scheduler-B7v3W8eG.js} +3 -3
- package/dist/{ServingSequence-BI-_zfXH.js → ServingSequence-DczYH8BU.js} +3 -3
- package/dist/{Setting-CObzXORw.js → Setting-fNLED9R0.js} +5 -5
- package/dist/{Subcategory-SwoAI9Ll.js → Subcategory-DjK1PTao.js} +4 -4
- package/dist/{Takeaway-CoRzd77l.js → Takeaway-ChMYycO_.js} +1 -1
- package/dist/{Takeaway-DtwZd8AR.js → Takeaway-LjEJbd4e.js} +4 -4
- package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-Dug9sZJl.js → Takeaway.vue_vue_type_script_setup_true_lang-CMdZM60P.js} +5 -5
- package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-1lzIehRE.js → Thumbnail.vue_vue_type_script_setup_true_lang-Yh_aUxqS.js} +4 -4
- package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-NjBNW9ch.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CEmOkHc5.js} +21 -20
- package/dist/{Unit-BkIkJdrO.js → Unit-DGZ9xVpM.js} +2 -2
- package/dist/{Variant-DNqk4G2y.js → Variant-CUasE1B5.js} +3 -3
- package/dist/{_id_-uch349de.js → _id_-CXV1a1UW.js} +10 -10
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/{app-C5IMDITK.js → app--9ZjQ_dH.js} +35 -35
- package/dist/{app-0e_XOvyp.js → app-E7mszfIB.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/apps/mf-menu/src/api/menu.d.ts +9 -3
- package/dist/apps/mf-menu/src/app.d.ts +47 -0
- package/dist/apps/mf-menu/src/components/ProgressBar.vue.d.ts +17 -0
- package/dist/apps/mf-menu/src/components/calender/DateTimePicker.vue.d.ts +73 -0
- package/dist/apps/mf-menu/src/components/calender/FmCalendar.vue.d.ts +80 -0
- package/dist/apps/mf-menu/src/components/calender/FmDateRangeYearMonthPicker.vue.d.ts +22 -0
- package/dist/apps/mf-menu/src/components/calender/FmTimeInput.vue.d.ts +26 -0
- package/dist/apps/mf-menu/src/components/calender/TimeInput.vue.d.ts +32 -0
- package/dist/apps/mf-menu/src/components/feature/Fields/ImageDropField.vue.d.ts +3 -0
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/fmtree/FmTreeNode.vue.d.ts +1 -1
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ItemForm.vue.d.ts +5 -0
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ProductDetail.vue.d.ts +5 -1
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ProductPrice.vue.d.ts +5 -1
- package/dist/apps/mf-menu/src/stores/menu.d.ts +9 -2
- package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/ProductDetail.vue.d.ts +9 -1
- package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/ProductPrice.vue.d.ts +5 -1
- package/dist/apps/mf-menu/src/views/Publish/PublishProgressView.vue.d.ts +198 -0
- package/dist/apps/mf-menu/src/views/Publish/PublishRestaurantSelector.vue.d.ts +17 -0
- package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
- package/dist/assets/{linked-status-BLErS-90.js → linked-status-Doclb1U6.js} +2 -2
- package/dist/assets/{override-menu-Bns6Vkk-.js → override-menu-BWkFILg4.js} +2 -2
- package/dist/assets/{validate-menu-v_LSEIFo.js → validate-menu-BS4T4zZm.js} +2 -2
- package/dist/{catalog-BuRtQI40.js → catalog-PkvD9BV_.js} +1 -1
- package/dist/{catalogSetting-B6GcQUXu.js → catalogSetting-Cd9aIJs2.js} +1 -1
- package/dist/{category-CztP5_ri.js → category-1NLh1OVo.js} +1 -1
- package/dist/{currency-qSlZ481F.js → currency-J1RZcMOx.js} +1 -1
- package/dist/dayjs.min-CXjOYO85.js +6 -0
- package/dist/{index-BbIeWj3n.js → index-BPpNi-Hh.js} +3 -3
- package/dist/{index-DMdZCp2g.js → index-BiCSP8Fy.js} +1 -1
- package/dist/{index-9XceRQZF.js → index-CisutoS9.js} +1 -1
- package/dist/{index-CJg7adB_.js → index-D9h3wl03.js} +4 -4
- package/dist/{index.vue_vue_type_script_setup_true_lang-CgDE93jl.js → index.vue_vue_type_script_setup_true_lang-B3Eku0Ig.js} +4479 -4432
- package/dist/{item-ByIhAQnU.js → item-Ctnd-m_D.js} +956 -925
- package/dist/{jszip.min-C4evSkfb.js → jszip.min-Bwz_vC7R.js} +353 -353
- package/dist/{menu-VanBYNI5.js → menu-DpTANxng.js} +1 -1
- package/dist/{menuV2-Pl32HC6Y.js → menuV2-BBMwj4p0.js} +61 -61
- package/dist/mf-menu.css +1 -1
- package/dist/{priceTier-COST6Ohr.js → priceTier-DAG2W_y3.js} +1 -1
- package/dist/{scheduler-DIFsyx8F.js → scheduler-DYuLkKsc.js} +4 -4
- package/dist/{subcategory-D_YPCzZt.js → subcategory-BJ0oG92x.js} +2 -2
- package/dist/{toExcel-BTHGNmrM.js → toExcel-C5_3G21q.js} +2 -2
- package/dist/tooltip-B5BiPMx9.js +32 -0
- package/dist/{unit-scfKpGAE.js → unit-CNwmGzjU.js} +2 -2
- package/package.json +2 -3
- package/dist/Publish-B1cSJdud.js +0 -586
- package/dist/iteration-Brm6sHmJ.js +0 -27
- package/dist/tooltip-CQW9YRO5.js +0 -60
|
@@ -0,0 +1,1262 @@
|
|
|
1
|
+
import { defineComponent as W, ref as P, computed as R, onMounted as ie, resolveComponent as U, createElementBlock as M, openBlock as g, createVNode as f, createElementVNode as i, toDisplayString as E, unref as d, Fragment as H, renderList as G, createBlock as j, watch as de, withCtx as N, normalizeClass as re, createCommentVNode as Q, createTextVNode as me, mergeProps as Fe, normalizeStyle as Ve, renderSlot as Ie, withModifiers as te, h as T, onUnmounted as Pe } from "vue";
|
|
2
|
+
import { D as L } from "./dayjs.min-CXjOYO85.js";
|
|
3
|
+
import { useRouter as Me } from "vue-router";
|
|
4
|
+
import { O as $e, b as Ue } from "./app-5fxKLAzS.js";
|
|
5
|
+
import { B as Be, H as Ae, G as he, ab as De, A as q, u as _e, I as pe, J as Te, a3 as Re } from "./index.vue_vue_type_script_setup_true_lang-B3Eku0Ig.js";
|
|
6
|
+
import { useI18n as Z, useCoreStore as Oe, RestaurantSelector as Ne } from "@feedmepos/mf-common";
|
|
7
|
+
import { useSnackbar as ce, useDialogChild as Ee, useProxiedModel as Le, FmButtonVariant as fe, components as X, useDialog as ze } 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--9ZjQ_dH.js";
|
|
10
|
+
import { a as Ye, w as Ke } from "./tooltip-B5BiPMx9.js";
|
|
11
|
+
import { u as be } from "./discardConfirm-BHni0LNu.js";
|
|
12
|
+
import { _ as ge } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
13
|
+
function ye(B) {
|
|
14
|
+
return B ? L(B).format("DD/MM/YY HH:mm") : "-";
|
|
15
|
+
}
|
|
16
|
+
function je(B, F, n) {
|
|
17
|
+
const b = (o, k = !1) => {
|
|
18
|
+
var r;
|
|
19
|
+
return o === void 0 && !k ? "-" : ((r = n.find((h) => h.value === (o || null))) == null ? void 0 : r.label) || "-";
|
|
20
|
+
};
|
|
21
|
+
return B.map((o) => {
|
|
22
|
+
var e;
|
|
23
|
+
const k = (e = F.find(({ _id: C }) => C === o._id)) == null ? void 0 : e.posVersion, r = !!k && !!Be.Pos.canUse({ feature: Ae.F_FEATURE.enum.taxAndServiceChargeV4, posVersion: k }), h = b(o.catalogId);
|
|
24
|
+
return {
|
|
25
|
+
...o,
|
|
26
|
+
_default: h,
|
|
27
|
+
_posTakeaway: o.takeawayCatalog ? b(o.takeawayCatalog) : h,
|
|
28
|
+
_additionalCatalogs: (o.additionalCatalogs || []).map((C) => b(C)),
|
|
29
|
+
_lastUpdate: ye(o.updatedAt),
|
|
30
|
+
_pickup: r ? b(o.pickupCatalog, !0) : "-",
|
|
31
|
+
_canUsePickup: r,
|
|
32
|
+
_posVersion: k || "-"
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const qe = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "flex items-center justify-center"
|
|
39
|
+
}, Ge = {
|
|
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(B) {
|
|
48
|
+
const F = B, n = ce(), { custom: b } = he(n), o = P(!1), k = P(null);
|
|
49
|
+
async function r() {
|
|
50
|
+
await b(
|
|
51
|
+
async () => {
|
|
52
|
+
var c;
|
|
53
|
+
k.value = await De.readMenuById(((c = F.restaurant.revertConfig) == null ? void 0 : c._id) || "");
|
|
54
|
+
},
|
|
55
|
+
{ isLoading: o }
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const h = R(() => {
|
|
59
|
+
var c;
|
|
60
|
+
return [
|
|
61
|
+
{ label: "Main", value: null },
|
|
62
|
+
...(((c = k.value) == null ? void 0 : c.modules.catalog) || []).map((_) => ({
|
|
63
|
+
label: _.name,
|
|
64
|
+
value: _._id
|
|
65
|
+
}))
|
|
66
|
+
];
|
|
67
|
+
}), { t: e } = Z(), C = R(() => {
|
|
68
|
+
var s;
|
|
69
|
+
const c = F.restaurant.revertConfig;
|
|
70
|
+
if (!c) return [];
|
|
71
|
+
const _ = je(
|
|
72
|
+
[
|
|
73
|
+
{
|
|
74
|
+
...c,
|
|
75
|
+
catalogId: c.catalogId || null
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
Oe().restaurants.value,
|
|
79
|
+
h.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: ye((s = k.value) == null ? void 0 : s.updatedAt)
|
|
86
|
+
},
|
|
87
|
+
{ label: e("menu.revert.labels.default"), value: _._default },
|
|
88
|
+
{ label: e("menu.revert.labels.pos_takeaway"), value: _._posTakeaway },
|
|
89
|
+
{ label: e("menu.revert.labels.pickup"), value: _._pickup },
|
|
90
|
+
{
|
|
91
|
+
label: e("menu.revert.labels.additional_catalogs"),
|
|
92
|
+
value: _._additionalCatalogs.join(", ")
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
});
|
|
96
|
+
ie(async () => r());
|
|
97
|
+
const { emitData: a } = Ee();
|
|
98
|
+
return (c, _) => {
|
|
99
|
+
const s = U("FmCircularProgress");
|
|
100
|
+
return o.value ? (g(), M("div", qe, [
|
|
101
|
+
f(s, { size: "lg" })
|
|
102
|
+
])) : (g(), M("div", Ge, [
|
|
103
|
+
i("div", We, E(d(e)("menu.revert.description", { name: F.restaurant.name })), 1),
|
|
104
|
+
i("div", Qe, [
|
|
105
|
+
(g(!0), M(H, null, G(C.value, (m) => (g(), j(Ye, {
|
|
106
|
+
key: m.label,
|
|
107
|
+
name: m.label,
|
|
108
|
+
value: m.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(B, {
|
|
128
|
+
emit: F
|
|
129
|
+
}) {
|
|
130
|
+
const n = B, b = F, o = P([]), k = R(() => n.restaurants.map((s) => ({
|
|
131
|
+
label: s.name,
|
|
132
|
+
value: s._id
|
|
133
|
+
}))), r = P(""), h = R(() => {
|
|
134
|
+
const s = Array.isArray(o.value) ? o.value : [], m = s.map((y) => k.value.find((S) => S.value === y)).filter((y) => y !== void 0);
|
|
135
|
+
let u = [];
|
|
136
|
+
return r.value ? (u = k.value.filter((y) => y.label.toLowerCase().includes(r.value.toLowerCase()) && !s.includes(y.value)), [...m, ...u]) : (u = k.value.filter((y) => !s.includes(y.value)), [...m, ...u]);
|
|
137
|
+
}), e = R(() => o.value.length > 0 && o.value.length === h.value.length), C = R(() => o.value.filter((s) => h.value.some((m) => m.value === s))), a = () => {
|
|
138
|
+
const s = o.value.filter((m) => !C.value.includes(m));
|
|
139
|
+
e.value === !0 ? c(s) : c(h.value.map((m) => m.value));
|
|
140
|
+
}, c = (s) => {
|
|
141
|
+
o.value = s;
|
|
142
|
+
};
|
|
143
|
+
de(o, (s) => {
|
|
144
|
+
b("update:modelValue", s);
|
|
145
|
+
});
|
|
146
|
+
function _(s) {
|
|
147
|
+
return n.restaurants.filter((m) => s.includes(m._id)).map((m) => m.name);
|
|
148
|
+
}
|
|
149
|
+
return (s, m) => {
|
|
150
|
+
const u = U("FmSearch"), y = U("FmCheckbox"), S = U("FmSelect");
|
|
151
|
+
return g(), j(S, {
|
|
152
|
+
modelValue: o.value,
|
|
153
|
+
"onUpdate:modelValue": m[1] || (m[1] = (O) => o.value = O),
|
|
154
|
+
placeholder: "Select Restaurant",
|
|
155
|
+
items: h.value,
|
|
156
|
+
multiselect: !0,
|
|
157
|
+
"hide-chips": !0
|
|
158
|
+
}, {
|
|
159
|
+
default: N(() => [i("p", Ze, E(o.value.length === n.restaurants.length ? "All restaurants" : _(o.value).join(", ")), 1)]),
|
|
160
|
+
"menu-wrapper": N(() => [i("div", et, [f(u, {
|
|
161
|
+
class: "py-8",
|
|
162
|
+
modelValue: r.value,
|
|
163
|
+
"onUpdate:modelValue": m[0] || (m[0] = (O) => r.value = O),
|
|
164
|
+
placeholder: "Search Restaurant"
|
|
165
|
+
}, null, 8, ["modelValue"]), f(y, {
|
|
166
|
+
class: "py-8",
|
|
167
|
+
"model-value": e.value,
|
|
168
|
+
label: "All restaurants",
|
|
169
|
+
value: "1",
|
|
170
|
+
indeterminate: o.value.length > 0,
|
|
171
|
+
"onUpdate:modelValue": a
|
|
172
|
+
}, null, 8, ["model-value", "indeterminate"]), (g(!0), M(H, null, G(h.value, (O, J) => (g(), M("div", {
|
|
173
|
+
key: J
|
|
174
|
+
}, [f(y, {
|
|
175
|
+
"model-value": o.value,
|
|
176
|
+
label: O.label,
|
|
177
|
+
value: O.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(B) {
|
|
197
|
+
const { t: F } = Z(), n = () => [
|
|
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
|
+
], b = L(), o = (r, h) => typeof r == "function" ? r(...h) : r, k = (r, h) => {
|
|
206
|
+
if (!h) 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 C;
|
|
214
|
+
if (typeof h == "function") {
|
|
215
|
+
const { status: a, className: c } = h(r);
|
|
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), C = c ?? "";
|
|
217
|
+
} else {
|
|
218
|
+
const { status: a, className: c } = h;
|
|
219
|
+
a && (e["fm-calendar__cell--selected"] = o(a.isSelected, [r]) ?? !1, e["fm-calendar__cell--selected-start"] = o(a.isStart, [r]) ?? !1, e["fm-calendar__cell--selected-end"] = o(a.isEnd, [r]) ?? !1, e["fm-calendar__cell--selected-between"] = o(a.isBetween, [r]) ?? !1), C = o(c, [r]) ?? "";
|
|
220
|
+
}
|
|
221
|
+
return [e, C];
|
|
222
|
+
};
|
|
223
|
+
return (r, h) => (g(), M("div", null, [
|
|
224
|
+
i("div", at, [
|
|
225
|
+
(g(!0), M(H, null, G(n(), (e) => (g(), M("div", {
|
|
226
|
+
key: e,
|
|
227
|
+
class: re(["fm-calendar__cell", `fm-calendar__cell__${r.cellSize}`])
|
|
228
|
+
}, E(e), 3))), 128))
|
|
229
|
+
]),
|
|
230
|
+
i("div", null, [
|
|
231
|
+
(g(!0), M(H, null, G(r.days, (e, C) => (g(), M("div", {
|
|
232
|
+
key: C,
|
|
233
|
+
class: "fm-calendar__row fm-typo-en-body-md-400"
|
|
234
|
+
}, [
|
|
235
|
+
(g(!0), M(H, null, G(e, (a) => (g(), M("div", {
|
|
236
|
+
id: `${a.date.toISOString()}`,
|
|
237
|
+
key: a.date.date(),
|
|
238
|
+
class: re(["fm-calendar__cell", [
|
|
239
|
+
`fm-calendar__cell__${r.cellSize}`,
|
|
240
|
+
k(a.date, r.dayCellClass),
|
|
241
|
+
!a.isCurrentMonth && "fm-calendar__cell--not-current-month"
|
|
242
|
+
]])
|
|
243
|
+
}, [
|
|
244
|
+
a.date.isSame(d(b), "day") && a.isCurrentMonth ? (g(), M("div", nt)) : Q("", !0),
|
|
245
|
+
a.isCurrentMonth ? (g(), M("button", {
|
|
246
|
+
key: 1,
|
|
247
|
+
class: "fm-calendar__cell__button",
|
|
248
|
+
type: "button",
|
|
249
|
+
onClick: (c) => r.onDayClick(a),
|
|
250
|
+
onMouseover: (c) => {
|
|
251
|
+
var _;
|
|
252
|
+
return (_ = r.onCellMouseOver) == null ? void 0 : _.call(r, a.date);
|
|
253
|
+
}
|
|
254
|
+
}, E(a.date.date()), 41, st)) : Q("", !0)
|
|
255
|
+
], 10, lt))), 128))
|
|
256
|
+
]))), 128))
|
|
257
|
+
])
|
|
258
|
+
]));
|
|
259
|
+
}
|
|
260
|
+
}), ve = /* @__PURE__ */ ge(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(B, { emit: F }) {
|
|
273
|
+
const { t: n } = Z(), b = B, o = F, k = P(!1), r = R(() => {
|
|
274
|
+
const a = L(b.min).startOf("year"), c = L(b.max).startOf("year"), _ = c.diff(a, "year"), s = [];
|
|
275
|
+
for (let m = 0; m <= _; m++)
|
|
276
|
+
s.push(c.subtract(m, "year"));
|
|
277
|
+
return s;
|
|
278
|
+
}), h = (a) => {
|
|
279
|
+
const c = L(b.min).startOf("month"), _ = L(b.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") === _.get("year") ? a.startOf("month").isBefore(_) || a.get("month") === _.get("month") : !0;
|
|
281
|
+
}, e = (a) => {
|
|
282
|
+
const c = L(b.min).startOf("month"), _ = L(b.max).startOf("month");
|
|
283
|
+
if (c.get("year") === a.get("year")) {
|
|
284
|
+
o("update:modelValue", c);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (_.get("year") === a.get("year")) {
|
|
288
|
+
o("update:modelValue", _);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
o("update:modelValue", a);
|
|
292
|
+
};
|
|
293
|
+
function C(a, c) {
|
|
294
|
+
if (!c)
|
|
295
|
+
return !1;
|
|
296
|
+
const _ = a.el, s = _ == null ? void 0 : _.parentElement;
|
|
297
|
+
!_ || !s || s.scrollTo({
|
|
298
|
+
top: _.offsetTop - 50
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return (a, c) => {
|
|
302
|
+
const _ = U("FmIcon"), s = U("FmMenuItem"), m = U("FmMenu");
|
|
303
|
+
return g(), j(m, {
|
|
304
|
+
trigger: "click",
|
|
305
|
+
onMenuChanged: c[0] || (c[0] = (u) => k.value = u)
|
|
306
|
+
}, {
|
|
307
|
+
"menu-button": N(() => [
|
|
308
|
+
i("div", {
|
|
309
|
+
class: re(["flex gap-4 h-24 items-center px-4 rounded-sm", k.value ? "text-fm-color-primary" : "hover:bg-fm-color-neutral-gray-100"])
|
|
310
|
+
}, [
|
|
311
|
+
i("div", ut, [
|
|
312
|
+
a.picker === "month" ? (g(), M(H, { key: 0 }, [
|
|
313
|
+
me(E(a.modelValue.format(d(n)("menu.publish.scheduler.date.monthFormat"))), 1)
|
|
314
|
+
], 64)) : Q("", !0),
|
|
315
|
+
a.picker === "year" ? (g(), M(H, { key: 1 }, [
|
|
316
|
+
me(E(a.modelValue.format(d(n)("menu.publish.scheduler.date.yearFormat"))), 1)
|
|
317
|
+
], 64)) : Q("", !0)
|
|
318
|
+
]),
|
|
319
|
+
f(_, {
|
|
320
|
+
name: k.value ? "expand_less" : "expand_more",
|
|
321
|
+
size: "md",
|
|
322
|
+
color: "black"
|
|
323
|
+
}, null, 8, ["name"])
|
|
324
|
+
], 2)
|
|
325
|
+
]),
|
|
326
|
+
default: N(() => [
|
|
327
|
+
i("ul", rt, [
|
|
328
|
+
a.picker === "month" ? (g(!0), M(H, { key: 0 }, G(Array.from(Array(12), (u, y) => a.modelValue.month(y)), (u) => (g(), M("li", {
|
|
329
|
+
key: u.format(d(n)("menu.publish.scheduler.date.monthFormat")),
|
|
330
|
+
onVnodeMounted: (y) => C(
|
|
331
|
+
y,
|
|
332
|
+
a.modelValue.format(d(n)("menu.publish.scheduler.date.monthFormat")) === u.format(d(n)("menu.publish.scheduler.date.monthFormat"))
|
|
333
|
+
)
|
|
334
|
+
}, [
|
|
335
|
+
f(s, {
|
|
336
|
+
disabled: !h(u),
|
|
337
|
+
"model-value": a.modelValue.format(d(n)("menu.publish.scheduler.date.monthFormat")) === u.format(d(n)("menu.publish.scheduler.date.monthFormat")),
|
|
338
|
+
label: u.format(d(n)("menu.publish.scheduler.date.monthFormat")),
|
|
339
|
+
"onUpdate:modelValue": (y) => o("update:modelValue", u)
|
|
340
|
+
}, null, 8, ["disabled", "model-value", "label", "onUpdate:modelValue"])
|
|
341
|
+
], 8, it))), 128)) : Q("", !0),
|
|
342
|
+
a.picker === "year" ? (g(!0), M(H, { key: 1 }, G(r.value, (u) => (g(), M("li", {
|
|
343
|
+
key: u.format(d(n)("menu.publish.scheduler.date.yearFormat")),
|
|
344
|
+
onVnodeMounted: (y) => C(
|
|
345
|
+
y,
|
|
346
|
+
a.modelValue.format(d(n)("menu.publish.scheduler.date.yearFormat")) === u.format(d(n)("menu.publish.scheduler.date.yearFormat"))
|
|
347
|
+
)
|
|
348
|
+
}, [
|
|
349
|
+
f(s, {
|
|
350
|
+
"model-value": a.modelValue.format(d(n)("menu.publish.scheduler.date.yearFormat")) === u.format(d(n)("menu.publish.scheduler.date.yearFormat")),
|
|
351
|
+
label: u.format(d(n)("menu.publish.scheduler.date.yearFormat")),
|
|
352
|
+
"onUpdate:modelValue": (y) => e(u)
|
|
353
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])
|
|
354
|
+
], 8, dt))), 128)) : Q("", !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" }, _t = { class: "flex space-x-4" }, bt = { 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(B, { emit: F }) {
|
|
380
|
+
const { t: n } = Z(), b = B, o = F, k = Le(b, "modelValue"), r = P({
|
|
381
|
+
hours: new Date(k.value).getHours() % 12 || 12,
|
|
382
|
+
minutes: new Date(k.value).getMinutes(),
|
|
383
|
+
period: new Date(k.value).getHours() >= 12 ? "PM" : "AM"
|
|
384
|
+
/* AM */
|
|
385
|
+
}), h = P(L(k.value, le)), e = P(!1);
|
|
386
|
+
function C(w, l) {
|
|
387
|
+
const [p, x, A] = w.split("-").map(Number), D = new Date(p, x - 1, A);
|
|
388
|
+
let I = l.hours % 12;
|
|
389
|
+
return l.period === "PM" && (I += 12), D.setHours(I), D.setMinutes(l.minutes), D.setSeconds(0), D.setMilliseconds(0), D;
|
|
390
|
+
}
|
|
391
|
+
const a = () => {
|
|
392
|
+
k.value = h.value.format(le);
|
|
393
|
+
const w = C(k.value, r.value);
|
|
394
|
+
o("update:schedulerTime", w.toISOString()), setTimeout(() => {
|
|
395
|
+
e.value = !1;
|
|
396
|
+
}, 0);
|
|
397
|
+
}, c = () => {
|
|
398
|
+
h.value = k.value ? L(k.value) : null, e.value = !1;
|
|
399
|
+
}, _ = (w) => {
|
|
400
|
+
e.value = w, w || c();
|
|
401
|
+
}, s = P(L().startOf("month")), m = P(L().startOf("month").add(1, "month")), u = (w, l) => {
|
|
402
|
+
w === "left" ? (s.value = l, m.value = l.add(1, "month")) : w === "right" && (m.value = l, s.value = l.subtract(1, "month"));
|
|
403
|
+
}, y = R(() => O(s.value)), S = R(() => O(s.value.add(1, "month"))), O = (w) => {
|
|
404
|
+
const l = [], p = w.endOf("month"), x = w.month();
|
|
405
|
+
let A = w.startOf("week"), D = [];
|
|
406
|
+
for (; A.isBefore(p.endOf("week")); )
|
|
407
|
+
A.day() === 0 && D.length > 0 && (l.push(D), D = []), D.push({
|
|
408
|
+
date: A,
|
|
409
|
+
isCurrentMonth: A.month() === x
|
|
410
|
+
}), A = A.add(1, "day");
|
|
411
|
+
return D.length > 0 && l.push(D), l.length < 6 && l.push([]), l;
|
|
412
|
+
}, J = (w) => {
|
|
413
|
+
h.value = w;
|
|
414
|
+
};
|
|
415
|
+
return (w, l) => {
|
|
416
|
+
const p = U("FmIcon"), x = U("FmTimeInput"), A = U("FmButton"), D = U("FmPopover");
|
|
417
|
+
return g(), j(D, {
|
|
418
|
+
"show-popover": e.value,
|
|
419
|
+
"z-index": b.zIndex,
|
|
420
|
+
"exclude-el-from-click-outside": ["in-calendar-app"],
|
|
421
|
+
onPopoverChanged: _
|
|
422
|
+
}, {
|
|
423
|
+
"popover-button": N(() => [
|
|
424
|
+
i("div", Fe({
|
|
425
|
+
opened: e.value,
|
|
426
|
+
showValidBorder: w.showValidBorder
|
|
427
|
+
}, { class: "text-fm-color-primary" }), " Select Date & Time ", 16)
|
|
428
|
+
]),
|
|
429
|
+
default: N(() => [
|
|
430
|
+
i("div", ct, [
|
|
431
|
+
i("div", mt, [
|
|
432
|
+
i("div", pt, [
|
|
433
|
+
i("div", null, [
|
|
434
|
+
i("div", ft, [
|
|
435
|
+
f(p, {
|
|
436
|
+
outline: !1,
|
|
437
|
+
class: "cursor-pointer select-none",
|
|
438
|
+
color: "#1C1C1E",
|
|
439
|
+
name: "chevron_left",
|
|
440
|
+
size: "md",
|
|
441
|
+
onClick: l[0] || (l[0] = () => u("left", s.value.subtract(1, "month")))
|
|
442
|
+
}),
|
|
443
|
+
i("div", vt, [
|
|
444
|
+
f(ae, {
|
|
445
|
+
max: w.max,
|
|
446
|
+
min: w.min,
|
|
447
|
+
"model-value": s.value,
|
|
448
|
+
picker: "month",
|
|
449
|
+
"onUpdate:modelValue": l[1] || (l[1] = (I) => u("left", I))
|
|
450
|
+
}, null, 8, ["max", "min", "model-value"]),
|
|
451
|
+
f(ae, {
|
|
452
|
+
max: w.max,
|
|
453
|
+
min: w.min,
|
|
454
|
+
"model-value": s.value,
|
|
455
|
+
picker: "year",
|
|
456
|
+
"onUpdate:modelValue": l[2] || (l[2] = (I) => u("left", I))
|
|
457
|
+
}, null, 8, ["max", "min", "model-value"])
|
|
458
|
+
])
|
|
459
|
+
]),
|
|
460
|
+
f(ve, {
|
|
461
|
+
"day-cell-class": {
|
|
462
|
+
status: {
|
|
463
|
+
isSelected: (I) => I.isSame(h.value, "date")
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
days: y.value,
|
|
467
|
+
"on-day-click": (I) => J(I.date)
|
|
468
|
+
}, null, 8, ["day-cell-class", "days", "on-day-click"])
|
|
469
|
+
]),
|
|
470
|
+
i("div", null, [
|
|
471
|
+
i("div", ht, [
|
|
472
|
+
i("div", _t, [
|
|
473
|
+
f(ae, {
|
|
474
|
+
max: w.max,
|
|
475
|
+
min: w.min,
|
|
476
|
+
"model-value": m.value,
|
|
477
|
+
picker: "month",
|
|
478
|
+
"onUpdate:modelValue": l[3] || (l[3] = (I) => u("right", I))
|
|
479
|
+
}, null, 8, ["max", "min", "model-value"]),
|
|
480
|
+
f(ae, {
|
|
481
|
+
max: w.max,
|
|
482
|
+
min: w.min,
|
|
483
|
+
"model-value": m.value,
|
|
484
|
+
picker: "year",
|
|
485
|
+
"onUpdate:modelValue": l[4] || (l[4] = (I) => u("right", I))
|
|
486
|
+
}, null, 8, ["max", "min", "model-value"])
|
|
487
|
+
]),
|
|
488
|
+
f(p, {
|
|
489
|
+
outline: !1,
|
|
490
|
+
class: "cursor-pointer select-none",
|
|
491
|
+
color: "#1C1C1E",
|
|
492
|
+
name: "chevron_right",
|
|
493
|
+
size: "md",
|
|
494
|
+
onClick: l[5] || (l[5] = () => u("left", s.value.add(1, "month")))
|
|
495
|
+
})
|
|
496
|
+
]),
|
|
497
|
+
f(ve, {
|
|
498
|
+
"day-cell-class": {
|
|
499
|
+
status: {
|
|
500
|
+
isSelected: (I) => I.isSame(h.value, "date")
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
days: S.value,
|
|
504
|
+
"on-day-click": (I) => J(I.date)
|
|
505
|
+
}, null, 8, ["day-cell-class", "days", "on-day-click"])
|
|
506
|
+
])
|
|
507
|
+
])
|
|
508
|
+
]),
|
|
509
|
+
f(x, {
|
|
510
|
+
"model-value": r.value ?? {
|
|
511
|
+
hours: 0,
|
|
512
|
+
minutes: 0,
|
|
513
|
+
period: "AM"
|
|
514
|
+
/* AM */
|
|
515
|
+
},
|
|
516
|
+
"onUpdate:modelValue": l[6] || (l[6] = (I) => r.value = I)
|
|
517
|
+
}, null, 8, ["model-value"]),
|
|
518
|
+
i("div", bt, [
|
|
519
|
+
f(A, {
|
|
520
|
+
label: d(n)("common.cancel"),
|
|
521
|
+
size: "md",
|
|
522
|
+
variant: "tertiary",
|
|
523
|
+
onClick: c
|
|
524
|
+
}, null, 8, ["label"]),
|
|
525
|
+
f(A, {
|
|
526
|
+
disabled: !h.value,
|
|
527
|
+
label: d(n)("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(B) {
|
|
546
|
+
const F = B, n = R(() => ({
|
|
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 (b, o) => (g(), M("div", yt, [
|
|
555
|
+
i("div", {
|
|
556
|
+
style: Ve(n.value)
|
|
557
|
+
}, null, 4)
|
|
558
|
+
]));
|
|
559
|
+
}
|
|
560
|
+
}), Ct = /* @__PURE__ */ ge(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(B, {
|
|
578
|
+
expose: F,
|
|
579
|
+
emit: n
|
|
580
|
+
}) {
|
|
581
|
+
const {
|
|
582
|
+
t: b
|
|
583
|
+
} = Z(), o = ce(), k = B, r = {
|
|
584
|
+
[q.F_PUBLISH_JOB_STATUS.Enum.PENDING]: {
|
|
585
|
+
label: "Pending",
|
|
586
|
+
textColor: "text-fm-color-neutral-gray-300",
|
|
587
|
+
backgroundColor: "#E0E0DE"
|
|
588
|
+
},
|
|
589
|
+
[q.F_PUBLISH_JOB_STATUS.Enum.RUNNING]: {
|
|
590
|
+
label: "Running",
|
|
591
|
+
textColor: "text-fm-color-system-warning-300",
|
|
592
|
+
backgroundColor: "#FFB800"
|
|
593
|
+
},
|
|
594
|
+
[q.F_PUBLISH_JOB_STATUS.Enum.COMPLETED]: {
|
|
595
|
+
label: "Completed",
|
|
596
|
+
textColor: "text-fm-color-system-success-300",
|
|
597
|
+
backgroundColor: "#34C759"
|
|
598
|
+
},
|
|
599
|
+
[q.F_PUBLISH_JOB_STATUS.Enum.FAILED]: {
|
|
600
|
+
label: "Failed",
|
|
601
|
+
textColor: "text-fm-color-system-error-300",
|
|
602
|
+
backgroundColor: "#FF3B30"
|
|
603
|
+
}
|
|
604
|
+
}, h = _e(), e = P(!1), C = (l) => {
|
|
605
|
+
typeof l == "boolean" ? e.value = l : e.value = !e.value;
|
|
606
|
+
};
|
|
607
|
+
F({
|
|
608
|
+
show: e,
|
|
609
|
+
trigger: C
|
|
610
|
+
});
|
|
611
|
+
const a = n, c = R(() => h.state.nextSchedulerPublish ?? {}), _ = R(() => Object.entries(c.value).map(([p, x]) => {
|
|
612
|
+
const A = h.runningPublishJob, D = x.restaurants ? x.restaurants.length : 0;
|
|
613
|
+
return {
|
|
614
|
+
date: new Date(p).toLocaleString(),
|
|
615
|
+
total_restaurants: `${D} restaurants`,
|
|
616
|
+
selectedRestaurantIds: x.restaurants || [],
|
|
617
|
+
status: x.status,
|
|
618
|
+
progress: A === p ? k.progress ?? 0 : 0
|
|
619
|
+
// Only apply progress to the running job's row
|
|
620
|
+
};
|
|
621
|
+
})), s = P([]), m = P(null), u = P(null), y = [{
|
|
622
|
+
accessorKey: "date",
|
|
623
|
+
header: "Date",
|
|
624
|
+
cell: ({
|
|
625
|
+
row: l
|
|
626
|
+
}) => {
|
|
627
|
+
if (l.original.date === "new") {
|
|
628
|
+
if (m.value !== null)
|
|
629
|
+
return new Date(m.value).toLocaleString();
|
|
630
|
+
const x = L(Date.now()).toISOString();
|
|
631
|
+
return T(gt, {
|
|
632
|
+
class: "flex h-full items-center",
|
|
633
|
+
modelValue: x,
|
|
634
|
+
"onUpdate:schedulerTime": (A) => {
|
|
635
|
+
m.value = A;
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
return l.original.date;
|
|
640
|
+
}
|
|
641
|
+
}, {
|
|
642
|
+
accessorKey: "total_restaurants",
|
|
643
|
+
header: "Total restaurants",
|
|
644
|
+
cell: ({
|
|
645
|
+
row: l
|
|
646
|
+
}) => l.original.date === "new" ? T(tt, {
|
|
647
|
+
restaurants: k.restaurants,
|
|
648
|
+
"onUpdate:modelValue": (x) => {
|
|
649
|
+
s.value = x;
|
|
650
|
+
}
|
|
651
|
+
}) : T("div", {
|
|
652
|
+
class: "flex items-center justify-between"
|
|
653
|
+
}, [T("p", {}, l.original.total_restaurants), T(X.FmMenu, {}, {
|
|
654
|
+
"menu-button": () => T(X.FmIcon, {
|
|
655
|
+
name: "info",
|
|
656
|
+
class: "text-fm-color-neutral-gray-300 cursor-pointer"
|
|
657
|
+
}),
|
|
658
|
+
default: () => w(l.original.selectedRestaurantIds).map((x) => T(X.FmMenuItem, {
|
|
659
|
+
key: x,
|
|
660
|
+
label: x
|
|
661
|
+
}))
|
|
662
|
+
})])
|
|
663
|
+
}, {
|
|
664
|
+
accessorKey: "progress",
|
|
665
|
+
header: "Progress",
|
|
666
|
+
cell: ({
|
|
667
|
+
row: l
|
|
668
|
+
}) => {
|
|
669
|
+
const p = l.original.status;
|
|
670
|
+
return l.original.date === "new" ? T("div", {
|
|
671
|
+
class: "flex justify-end items-center gap-8"
|
|
672
|
+
}, [T(X.FmButton, {
|
|
673
|
+
variant: "tertiary",
|
|
674
|
+
prependIcon: "close",
|
|
675
|
+
textColor: "system-error-300",
|
|
676
|
+
onClick: () => {
|
|
677
|
+
m.value = null, S.value = null, u.value = null;
|
|
678
|
+
}
|
|
679
|
+
}), T(X.FmButton, {
|
|
680
|
+
variant: "tertiary",
|
|
681
|
+
prependIcon: "check",
|
|
682
|
+
textColor: "system-success-300",
|
|
683
|
+
onClick: async () => {
|
|
684
|
+
if (!m.value || s.value.length === 0) {
|
|
685
|
+
u.value = !1, o.open({
|
|
686
|
+
type: "error",
|
|
687
|
+
message: "Please select date and restaurants to schedule publish."
|
|
688
|
+
});
|
|
689
|
+
return;
|
|
690
|
+
} else
|
|
691
|
+
u.value = !0, o.open({
|
|
692
|
+
type: "success",
|
|
693
|
+
message: "Schedule publish added successfully."
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
})]) : T("div", {
|
|
697
|
+
class: "flex justify-between items-center gap-32"
|
|
698
|
+
}, [T("div", {
|
|
699
|
+
class: "flex flex-col w-full gap-4"
|
|
700
|
+
}, [T("div", {
|
|
701
|
+
class: "flex items-center gap-8"
|
|
702
|
+
}, [T("p", {
|
|
703
|
+
class: `fm-typo-en-body-md-400 ${r[p].textColor}`
|
|
704
|
+
}, r[p].label), ...p === q.F_PUBLISH_JOB_STATUS.Enum.RUNNING ? [T("p", {
|
|
705
|
+
class: `fm-typo-en-body-md-400 ${r[p].textColor}`
|
|
706
|
+
}, `(${l.original.progress}/${l.original.total_restaurants})`)] : []]), T(Ct, {
|
|
707
|
+
bgcolor: r[p].backgroundColor,
|
|
708
|
+
completed: p === q.F_PUBLISH_JOB_STATUS.Enum.PENDING ? 0 : p === q.F_PUBLISH_JOB_STATUS.Enum.RUNNING ? Math.floor((l.original.progress ?? 0) / parseInt(l.original.total_restaurants) * 100) : (p === q.F_PUBLISH_JOB_STATUS.Enum.COMPLETED, 100)
|
|
709
|
+
})])]);
|
|
710
|
+
}
|
|
711
|
+
}];
|
|
712
|
+
ie(async () => {
|
|
713
|
+
await h.getNextSchedulerPublish();
|
|
714
|
+
});
|
|
715
|
+
const S = P(null);
|
|
716
|
+
function O() {
|
|
717
|
+
u.value = !1, S.value = {
|
|
718
|
+
date: "new",
|
|
719
|
+
restaurantsIds: []
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
de(u, async (l) => {
|
|
723
|
+
l && (a("publishMenu", {
|
|
724
|
+
schedulerTime: m.value,
|
|
725
|
+
restaurantIds: s.value
|
|
726
|
+
}), await h.getNextSchedulerPublish(), m.value = null, s.value = [], u.value = !1, S.value = null, u.value = null);
|
|
727
|
+
});
|
|
728
|
+
const J = be(() => u.value !== null && u.value === !1, () => {
|
|
729
|
+
e.value = !1, S.value = null, m.value = null, s.value = [], u.value = null;
|
|
730
|
+
});
|
|
731
|
+
function w(l) {
|
|
732
|
+
return k.restaurants.filter((p) => l.includes(p._id)).map((p) => p.name);
|
|
733
|
+
}
|
|
734
|
+
return (l, p) => {
|
|
735
|
+
const x = U("FmButton"), A = U("FmTable"), D = U("FmSideSheet");
|
|
736
|
+
return g(), M(H, null, [Ie(l.$slots, "default", {
|
|
737
|
+
trigger: C
|
|
738
|
+
}), f(D, {
|
|
739
|
+
modelValue: e.value,
|
|
740
|
+
"onUpdate:modelValue": p[1] || (p[1] = (I) => e.value = I),
|
|
741
|
+
"close-button": !1,
|
|
742
|
+
"max-width": 800,
|
|
743
|
+
"onOn:clickedAway": d(J)
|
|
744
|
+
}, {
|
|
745
|
+
"side-sheet-header": N(() => [i("div", wt, [f(x, {
|
|
746
|
+
variant: d(fe).Tertiary,
|
|
747
|
+
"prepend-icon": "arrow_back",
|
|
748
|
+
onClick: te(d(J), ["stop"])
|
|
749
|
+
}, null, 8, ["variant", "onClick"]), i("p", xt, E(d(b)("menu.publish.actions.publish_progress")), 1)])]),
|
|
750
|
+
default: N(() => [i("div", null, [f(A, {
|
|
751
|
+
class: "pb-8",
|
|
752
|
+
"row-data": [..._.value, S.value].filter(Boolean),
|
|
753
|
+
"column-defs": y,
|
|
754
|
+
"shrink-at": !1,
|
|
755
|
+
pageSize: _.value.length + (S.value ? 1 : 0),
|
|
756
|
+
"hide-footer": ""
|
|
757
|
+
}, null, 8, ["row-data", "pageSize"]), d(h).state.featureFlags.schedulerPublish && !S.value ? (g(), j(x, {
|
|
758
|
+
key: 0,
|
|
759
|
+
variant: d(fe).Plain,
|
|
760
|
+
"prepend-icon": "add",
|
|
761
|
+
label: d(b)("menu.publish.actions.add_scheduler_publish"),
|
|
762
|
+
onClick: p[0] || (p[0] = () => O())
|
|
763
|
+
}, null, 8, ["variant", "label"])) : Q("", !0)])]),
|
|
764
|
+
_: 1
|
|
765
|
+
}, 8, ["modelValue", "onOn:clickedAway"])], 64);
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
}), 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({
|
|
769
|
+
__name: "UpdateCatalogDialog",
|
|
770
|
+
props: {
|
|
771
|
+
catalogs: {
|
|
772
|
+
type: Array,
|
|
773
|
+
required: !0
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
emits: ["onComplete"],
|
|
777
|
+
setup(B, { expose: F, emit: n }) {
|
|
778
|
+
const { t: b } = Z(), o = B;
|
|
779
|
+
F({
|
|
780
|
+
show: _,
|
|
781
|
+
hide: s
|
|
782
|
+
});
|
|
783
|
+
const k = n;
|
|
784
|
+
function r() {
|
|
785
|
+
return {
|
|
786
|
+
restaurantId: "",
|
|
787
|
+
catalogId: void 0,
|
|
788
|
+
takeawayCatalog: void 0,
|
|
789
|
+
pickupCatalog: null,
|
|
790
|
+
additionalCatalogs: []
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
const h = R(() => [
|
|
794
|
+
{
|
|
795
|
+
label: b("menu.publish.update_catalog_dialog.sections.default.use_default"),
|
|
796
|
+
value: null
|
|
797
|
+
},
|
|
798
|
+
...o.catalogs.map((y) => ({
|
|
799
|
+
label: y.name,
|
|
800
|
+
value: y._id
|
|
801
|
+
}))
|
|
802
|
+
]), e = R(() => [
|
|
803
|
+
{
|
|
804
|
+
label: b("menu.publish.update_catalog_dialog.sections.default.use_default"),
|
|
805
|
+
value: null
|
|
806
|
+
},
|
|
807
|
+
...o.catalogs.map((y) => ({
|
|
808
|
+
label: y.name,
|
|
809
|
+
value: y._id
|
|
810
|
+
}))
|
|
811
|
+
]), C = P(r()), a = P(!1), c = P(void 0);
|
|
812
|
+
function _(y) {
|
|
813
|
+
c.value = y ? pe(y) : r(), C.value = pe(c.value), a.value = !0;
|
|
814
|
+
}
|
|
815
|
+
function s() {
|
|
816
|
+
a.value = !1;
|
|
817
|
+
}
|
|
818
|
+
const m = be(
|
|
819
|
+
() => !Te.isEqual(c.value, C.value),
|
|
820
|
+
() => {
|
|
821
|
+
s();
|
|
822
|
+
}
|
|
823
|
+
);
|
|
824
|
+
function u() {
|
|
825
|
+
s(), k("onComplete", C.value);
|
|
826
|
+
}
|
|
827
|
+
return (y, S) => {
|
|
828
|
+
const O = U("FmSelect"), J = U("FmCheckbox"), w = U("FmButton"), l = U("FmSideSheet");
|
|
829
|
+
return g(), j(l, {
|
|
830
|
+
modelValue: a.value,
|
|
831
|
+
"onUpdate:modelValue": S[5] || (S[5] = (p) => a.value = p),
|
|
832
|
+
"max-width": 560,
|
|
833
|
+
"onOn:clickedAway": d(m)
|
|
834
|
+
}, {
|
|
835
|
+
"side-sheet-header": N(() => [
|
|
836
|
+
i("span", Ft, E(d(b)("menu.publish.update_catalog_dialog.title")), 1)
|
|
837
|
+
]),
|
|
838
|
+
"side-sheet-footer": N(() => [
|
|
839
|
+
i("div", Mt, [
|
|
840
|
+
f(w, {
|
|
841
|
+
label: d(b)("menu.publish.update_catalog_dialog.actions.update"),
|
|
842
|
+
size: "lg",
|
|
843
|
+
variant: "primary",
|
|
844
|
+
onClick: S[4] || (S[4] = () => u())
|
|
845
|
+
}, null, 8, ["label"]),
|
|
846
|
+
f(w, {
|
|
847
|
+
label: d(b)("menu.publish.update_catalog_dialog.actions.cancel"),
|
|
848
|
+
size: "lg",
|
|
849
|
+
variant: "tertiary",
|
|
850
|
+
onClick: s
|
|
851
|
+
}, null, 8, ["label"])
|
|
852
|
+
])
|
|
853
|
+
]),
|
|
854
|
+
default: N(() => [
|
|
855
|
+
f(O, {
|
|
856
|
+
modelValue: C.value.catalogId,
|
|
857
|
+
"onUpdate:modelValue": S[0] || (S[0] = (p) => C.value.catalogId = p),
|
|
858
|
+
items: h.value,
|
|
859
|
+
class: "mb-24",
|
|
860
|
+
label: d(b)("menu.publish.update_catalog_dialog.sections.default.label")
|
|
861
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
862
|
+
f(O, {
|
|
863
|
+
modelValue: C.value.takeawayCatalog,
|
|
864
|
+
"onUpdate:modelValue": S[1] || (S[1] = (p) => C.value.takeawayCatalog = p),
|
|
865
|
+
items: e.value,
|
|
866
|
+
class: "mb-24",
|
|
867
|
+
label: d(b)("menu.publish.update_catalog_dialog.sections.pos_takeaway.label")
|
|
868
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
869
|
+
f(O, {
|
|
870
|
+
modelValue: C.value.pickupCatalog,
|
|
871
|
+
"onUpdate:modelValue": S[2] || (S[2] = (p) => C.value.pickupCatalog = p),
|
|
872
|
+
items: e.value,
|
|
873
|
+
label: d(b)("menu.publish.update_catalog_dialog.sections.pickup.label")
|
|
874
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
875
|
+
i("div", Vt, [
|
|
876
|
+
i("div", It, E(d(b)("menu.publish.update_catalog_dialog.sections.additional.title")), 1),
|
|
877
|
+
i("div", Pt, E(d(b)("menu.publish.update_catalog_dialog.sections.additional.subtitle")), 1),
|
|
878
|
+
(g(!0), M(H, null, G(B.catalogs, (p) => (g(), M("div", {
|
|
879
|
+
key: p._id
|
|
880
|
+
}, [
|
|
881
|
+
f(J, {
|
|
882
|
+
modelValue: C.value.additionalCatalogs,
|
|
883
|
+
"onUpdate:modelValue": S[3] || (S[3] = (x) => C.value.additionalCatalogs = x),
|
|
884
|
+
label: p.name,
|
|
885
|
+
value: p._id
|
|
886
|
+
}, null, 8, ["modelValue", "label", "value"])
|
|
887
|
+
]))), 128))
|
|
888
|
+
])
|
|
889
|
+
]),
|
|
890
|
+
_: 1
|
|
891
|
+
}, 8, ["modelValue", "onOn:clickedAway"]);
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
}), Ut = {
|
|
895
|
+
class: "flex flex-col p-24 bg-fm-color-neutral-white min-h-[calc(100dvh-56px)] xs:max-h-[calc(100dvh-56px)]"
|
|
896
|
+
}, Bt = {
|
|
897
|
+
class: "flex items-center xs:mb-8 mb-24"
|
|
898
|
+
}, At = {
|
|
899
|
+
class: "mr-8"
|
|
900
|
+
}, Dt = {
|
|
901
|
+
class: "fm-typo-en-title-md-600"
|
|
902
|
+
}, Tt = {
|
|
903
|
+
class: "xs:hidden mr-16"
|
|
904
|
+
}, Rt = {
|
|
905
|
+
class: "xs:hidden mr-16"
|
|
906
|
+
}, Ot = {
|
|
907
|
+
class: "xs:hidden"
|
|
908
|
+
}, Nt = {
|
|
909
|
+
class: "pb-8 flex justify-between items-start xs:flex-col xs:items-stretch gap-8"
|
|
910
|
+
}, Et = {
|
|
911
|
+
class: "grow flex flex-col gap-4"
|
|
912
|
+
}, Lt = {
|
|
913
|
+
class: "flex gap-8 items-center"
|
|
914
|
+
}, zt = {
|
|
915
|
+
class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary"
|
|
916
|
+
}, Ht = {
|
|
917
|
+
class: "space-y-4"
|
|
918
|
+
}, Jt = {
|
|
919
|
+
class: "fm-typo-en-body-lg-600"
|
|
920
|
+
}, Yt = {
|
|
921
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
922
|
+
}, Kt = {
|
|
923
|
+
class: "flex gap-8"
|
|
924
|
+
}, jt = {
|
|
925
|
+
class: "xs:block hidden fixed bottom-72 right-16"
|
|
926
|
+
}, oa = /* @__PURE__ */ W({
|
|
927
|
+
__name: "Publish",
|
|
928
|
+
setup(B) {
|
|
929
|
+
const F = Me(), {
|
|
930
|
+
t: n
|
|
931
|
+
} = Z(), b = ({
|
|
932
|
+
row: t
|
|
933
|
+
}) => {
|
|
934
|
+
const v = t.status === "latest";
|
|
935
|
+
return f(He, {
|
|
936
|
+
label: n(v ? "menu.publish.table.status.latest" : "menu.publish.table.status.outdated"),
|
|
937
|
+
variant: v ? "success" : "warning"
|
|
938
|
+
}, null);
|
|
939
|
+
}, o = P({}), k = [{
|
|
940
|
+
accessorKey: "name",
|
|
941
|
+
header: () => n("menu.publish.table.columns.restaurant"),
|
|
942
|
+
cell: (t) => t.getValue(),
|
|
943
|
+
enableSorting: !0
|
|
944
|
+
}, {
|
|
945
|
+
accessorKey: "catalog",
|
|
946
|
+
header: () => n("menu.publish.table.columns.default"),
|
|
947
|
+
enableSorting: !1,
|
|
948
|
+
cell: (t) => t.getValue().default
|
|
949
|
+
}, {
|
|
950
|
+
accessorKey: "catalog",
|
|
951
|
+
header: () => n("menu.publish.table.columns.pos_takeaway"),
|
|
952
|
+
enableSorting: !1,
|
|
953
|
+
cell: (t) => t.getValue().takeaway
|
|
954
|
+
}, {
|
|
955
|
+
accessorKey: "catalog",
|
|
956
|
+
header: () => n("menu.publish.table.columns.pickup"),
|
|
957
|
+
enableSorting: !1,
|
|
958
|
+
cell: (t) => t.getValue().pickup
|
|
959
|
+
}, {
|
|
960
|
+
accessorKey: "updatedAt",
|
|
961
|
+
header: () => n("menu.publish.table.columns.version"),
|
|
962
|
+
enableSorting: !1,
|
|
963
|
+
cell: (t) => {
|
|
964
|
+
const v = t.getValue();
|
|
965
|
+
return s(v);
|
|
966
|
+
}
|
|
967
|
+
}, {
|
|
968
|
+
accessorKey: "status",
|
|
969
|
+
header: () => n("menu.common.labels.status"),
|
|
970
|
+
enableSorting: !1,
|
|
971
|
+
cell: (t) => f(b, {
|
|
972
|
+
row: t.row.original
|
|
973
|
+
}, null)
|
|
974
|
+
}, {
|
|
975
|
+
accessorKey: "_id",
|
|
976
|
+
header: "",
|
|
977
|
+
size: 52,
|
|
978
|
+
enableSorting: !1,
|
|
979
|
+
cell: (t) => {
|
|
980
|
+
const v = t.row.original;
|
|
981
|
+
return T("div", {
|
|
982
|
+
class: "flex justify-end gap-8"
|
|
983
|
+
}, [a.value && v.revertConfig ? Ke(T(X.FmButton, {
|
|
984
|
+
prependIcon: "undo",
|
|
985
|
+
variant: "secondary",
|
|
986
|
+
onClick: te(async () => {
|
|
987
|
+
await c(t.row.original);
|
|
988
|
+
}, ["stop", "prevent"])
|
|
989
|
+
}), n("menu.publish.actions.revert")) : null, T(X.FmButton, {
|
|
990
|
+
label: n("menu.publish.actions.publish"),
|
|
991
|
+
icon: "ios_share",
|
|
992
|
+
variant: "secondary",
|
|
993
|
+
onClick: te(async () => {
|
|
994
|
+
const $ = S(t.row.original);
|
|
995
|
+
await l($);
|
|
996
|
+
}, ["stop", "prevent"])
|
|
997
|
+
})]);
|
|
998
|
+
},
|
|
999
|
+
meta: {
|
|
1000
|
+
width: "150px"
|
|
1001
|
+
}
|
|
1002
|
+
}], r = P(""), h = P(), e = _e(), C = ze(), a = R(() => e.version !== q.F_MENU_VERSION.enum.v3);
|
|
1003
|
+
async function c(t) {
|
|
1004
|
+
t.revertConfig && C.open({
|
|
1005
|
+
title: "Revert menu",
|
|
1006
|
+
contentComponent: Xe,
|
|
1007
|
+
contentComponentProps: {
|
|
1008
|
+
restaurant: t
|
|
1009
|
+
},
|
|
1010
|
+
primaryActions: {
|
|
1011
|
+
text: "Revert",
|
|
1012
|
+
close: !0
|
|
1013
|
+
},
|
|
1014
|
+
secondaryActions: {
|
|
1015
|
+
text: "Cancel",
|
|
1016
|
+
close: !0
|
|
1017
|
+
}
|
|
1018
|
+
}).onPrimary(async () => {
|
|
1019
|
+
await w.minor(async () => {
|
|
1020
|
+
await e.revertRestaurantMenu(t._id);
|
|
1021
|
+
}, {
|
|
1022
|
+
customId: t._id,
|
|
1023
|
+
message: `Revert menu of ${t.name}`
|
|
1024
|
+
});
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
const _ = R(() => n("menu.publish.labels.main_version", {
|
|
1028
|
+
version: s(e.state.menu.updatedAt)
|
|
1029
|
+
}));
|
|
1030
|
+
function s(t) {
|
|
1031
|
+
return t ? L(t).format("DD/MM/YYYY hh:mmA") : "";
|
|
1032
|
+
}
|
|
1033
|
+
const m = R(() => e.state.menu.modules.catalog), u = R(() => w.queue.value.some((t) => t.id === e.state.menu._id));
|
|
1034
|
+
function y(t) {
|
|
1035
|
+
var v;
|
|
1036
|
+
return t ? ((v = m.value.find(($) => $._id === t)) == null ? void 0 : v.name) ?? n("menu.publish.labels.catalog.invalid") : n("menu.publish.labels.catalog.main");
|
|
1037
|
+
}
|
|
1038
|
+
function S(t) {
|
|
1039
|
+
return {
|
|
1040
|
+
restaurantId: t._id,
|
|
1041
|
+
catalogId: t.catalogId,
|
|
1042
|
+
takeawayCatalog: t.takeawayCatalog,
|
|
1043
|
+
pickupCatalog: t.pickupCatalog || null,
|
|
1044
|
+
additionalCatalogs: t.additionalCatalogs
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
function O(t) {
|
|
1048
|
+
var $;
|
|
1049
|
+
const v = S(t);
|
|
1050
|
+
($ = h.value) == null || $.show(v);
|
|
1051
|
+
}
|
|
1052
|
+
const J = ce(), w = he(J);
|
|
1053
|
+
async function l(t) {
|
|
1054
|
+
var $;
|
|
1055
|
+
const v = ($ = x.value.find((Y) => Y._id === t.restaurantId)) == null ? void 0 : $.name;
|
|
1056
|
+
await w.minor(async () => await e.publishMenu(t), {
|
|
1057
|
+
customId: e.state.menu._id,
|
|
1058
|
+
message: `Publishing menu for ${v}`,
|
|
1059
|
+
successMessage: `Published to ${v}`
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
const p = P(null), x = R(() => {
|
|
1063
|
+
const t = r.value.toLowerCase(), v = e.state.menu.updatedAt;
|
|
1064
|
+
return e.state.restaurants.filter(($) => {
|
|
1065
|
+
var Y;
|
|
1066
|
+
return !p.value || ((Y = p.value) == null ? void 0 : Y.includes($._id));
|
|
1067
|
+
}).map(($) => ({
|
|
1068
|
+
...$,
|
|
1069
|
+
catalog: {
|
|
1070
|
+
default: y($.catalogId),
|
|
1071
|
+
takeaway: y($.takeawayCatalog),
|
|
1072
|
+
pickup: y($.pickupCatalog)
|
|
1073
|
+
},
|
|
1074
|
+
status: v === $.updatedAt ? "latest" : "outdated"
|
|
1075
|
+
})).filter(($) => $e($, A.value)).filter(({
|
|
1076
|
+
name: $,
|
|
1077
|
+
catalog: Y
|
|
1078
|
+
}) => t ? $.toLowerCase().includes(t) || Y.default.toLowerCase().includes(t) || Y.takeaway.toLowerCase().includes(t) || Y.pickup.toLowerCase().includes(t) : !0);
|
|
1079
|
+
}), A = P({
|
|
1080
|
+
logic: "AND",
|
|
1081
|
+
rules: []
|
|
1082
|
+
}), D = [{
|
|
1083
|
+
type: "string",
|
|
1084
|
+
key: "status",
|
|
1085
|
+
entity: "menu",
|
|
1086
|
+
values: ["latest", "outdated"]
|
|
1087
|
+
}], I = P(0), z = P(null), ee = P(null), ne = P(null);
|
|
1088
|
+
async function ke() {
|
|
1089
|
+
await w.minor(async () => await e.readRestaurants(), {
|
|
1090
|
+
customId: e.state.menu._id
|
|
1091
|
+
}), await e.getNextSchedulerPublish(), e.runningPublishJob !== null ? z.value === null && (z.value = setInterval(async () => {
|
|
1092
|
+
await oe();
|
|
1093
|
+
}, 3e3)) : (ne.value && (J.close(ne.value), ne.value = null), z.value !== null && (clearInterval(z.value), z.value = null), ee.value = null);
|
|
1094
|
+
}
|
|
1095
|
+
async function se(t) {
|
|
1096
|
+
if (u.value) return;
|
|
1097
|
+
const v = Object.keys(o.value).filter((K) => o.value[K]), $ = v.length === 0 || v.length === x.value.length ? x.value : x.value.filter((K) => v.includes(K._id)), Y = t ? t.restaurantIds.length === e.state.restaurants.length : x.value.length === e.state.restaurants.length && (v.length === 0 || v.length === x.value.length);
|
|
1098
|
+
if (J.open({
|
|
1099
|
+
message: Y ? "Menu publish registered for all restaurants." : `Menu publish registered for ${t != null && t.restaurantIds ? t.restaurantIds.length : $.length} restaurant(s).`,
|
|
1100
|
+
type: "info"
|
|
1101
|
+
}), Y)
|
|
1102
|
+
await e.publishAllMenu(t == null ? void 0 : t.schedulerTime), ee.value = !1;
|
|
1103
|
+
else {
|
|
1104
|
+
const K = (t == null ? void 0 : t.restaurantIds) || $.map((ue) => ue._id);
|
|
1105
|
+
await e.publishMultipleMenu(K, t == null ? void 0 : t.schedulerTime, !1);
|
|
1106
|
+
}
|
|
1107
|
+
ee.value = !1, I.value = await e.getPublishRestaurantsProgress(), z.value !== null && (clearInterval(z.value), z.value = null), z.value = setInterval(async () => {
|
|
1108
|
+
await oe();
|
|
1109
|
+
}, 3e3);
|
|
1110
|
+
}
|
|
1111
|
+
async function oe() {
|
|
1112
|
+
await e.getNextSchedulerPublish(), e.runningPublishJob !== null ? (ee.value = !1, I.value = await e.getPublishRestaurantsProgress()) : (ee.value = !0, z.value !== null && (clearInterval(z.value), z.value = null));
|
|
1113
|
+
}
|
|
1114
|
+
return de(() => I.value, async (t) => {
|
|
1115
|
+
await e.readRestaurants();
|
|
1116
|
+
}), ie(async () => {
|
|
1117
|
+
await e.getNextSchedulerPublish(), await oe();
|
|
1118
|
+
}), Pe(() => {
|
|
1119
|
+
z.value != null && (clearInterval(z.value), z.value = null);
|
|
1120
|
+
}), (t, v) => {
|
|
1121
|
+
const $ = U("FmChip"), Y = U("FmSpacer"), K = U("FmButton"), ue = U("FmBadge"), Ce = U("FmSearch"), we = U("FmTable"), xe = U("FmListItem"), Se = U("FmList");
|
|
1122
|
+
return g(), M(H, null, [i("div", Ut, [i("div", Bt, [i("div", At, [i("div", Dt, E(d(n)("menu.publish.title")), 1), v[9] || (v[9] = i("div", {
|
|
1123
|
+
class: "hidden xs:block fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1124
|
+
}, null, -1))]), f($, {
|
|
1125
|
+
label: _.value,
|
|
1126
|
+
class: "xs:hidden text-fm-color-primary bg-fm-color-system-warning-100"
|
|
1127
|
+
}, null, 8, ["label"]), f(Y), i("div", Tt, [f(K, {
|
|
1128
|
+
disabled: u.value,
|
|
1129
|
+
label: d(n)("menu.publish.actions.refresh"),
|
|
1130
|
+
variant: "secondary",
|
|
1131
|
+
onClick: v[0] || (v[0] = () => ke())
|
|
1132
|
+
}, null, 8, ["disabled", "label"])]), i("div", Rt, [f(St, {
|
|
1133
|
+
progress: I.value,
|
|
1134
|
+
restaurants: x.value,
|
|
1135
|
+
onPublishMenu: v[1] || (v[1] = (V) => se(V))
|
|
1136
|
+
}, {
|
|
1137
|
+
default: N(({
|
|
1138
|
+
trigger: V
|
|
1139
|
+
}) => [d(e).runningPublishJob !== null ? (g(), j(ue, {
|
|
1140
|
+
key: 0,
|
|
1141
|
+
variant: "critical",
|
|
1142
|
+
value: 1
|
|
1143
|
+
}, {
|
|
1144
|
+
default: N(() => [f(K, {
|
|
1145
|
+
variant: "secondary",
|
|
1146
|
+
disabled: u.value,
|
|
1147
|
+
label: d(n)("menu.publish.actions.publish_progress"),
|
|
1148
|
+
onClick: V
|
|
1149
|
+
}, null, 8, ["disabled", "label", "onClick"])]),
|
|
1150
|
+
_: 2
|
|
1151
|
+
}, 1024)) : (g(), j(K, {
|
|
1152
|
+
key: 1,
|
|
1153
|
+
variant: "secondary",
|
|
1154
|
+
disabled: u.value,
|
|
1155
|
+
label: d(n)("menu.publish.actions.publish_progress"),
|
|
1156
|
+
onClick: V
|
|
1157
|
+
}, null, 8, ["disabled", "label", "onClick"]))]),
|
|
1158
|
+
_: 1
|
|
1159
|
+
}, 8, ["progress", "restaurants"])]), i("div", Ot, [f(K, {
|
|
1160
|
+
disabled: u.value,
|
|
1161
|
+
icon: "ios_share",
|
|
1162
|
+
label: d(n)("menu.publish.actions.publish_all"),
|
|
1163
|
+
variant: "primary",
|
|
1164
|
+
onClick: v[2] || (v[2] = () => se())
|
|
1165
|
+
}, null, 8, ["disabled", "label"])])]), i("div", Nt, [f(d(Ne), {
|
|
1166
|
+
multiple: "",
|
|
1167
|
+
modelValue: p.value,
|
|
1168
|
+
"onUpdate:modelValue": v[4] || (v[4] = (V) => p.value = V)
|
|
1169
|
+
}, {
|
|
1170
|
+
"append-right": N(() => [f(d(Ue), {
|
|
1171
|
+
modelValue: A.value,
|
|
1172
|
+
"onUpdate:modelValue": v[3] || (v[3] = (V) => A.value = V),
|
|
1173
|
+
attributes: D
|
|
1174
|
+
}, null, 8, ["modelValue"])]),
|
|
1175
|
+
_: 1
|
|
1176
|
+
}, 8, ["modelValue"]), f(Ce, {
|
|
1177
|
+
modelValue: r.value,
|
|
1178
|
+
"onUpdate:modelValue": v[5] || (v[5] = (V) => r.value = V),
|
|
1179
|
+
autofocus: "",
|
|
1180
|
+
class: "w-[320px] xs:w-full",
|
|
1181
|
+
placeholder: d(n)("menu.publish.table.search.placeholder")
|
|
1182
|
+
}, null, 8, ["modelValue", "placeholder"])]), x.value.length > 0 ? (g(), M(H, {
|
|
1183
|
+
key: 0
|
|
1184
|
+
}, [f(Je, {
|
|
1185
|
+
class: "xs:hidden block"
|
|
1186
|
+
}, {
|
|
1187
|
+
default: N(() => [f(we, {
|
|
1188
|
+
modelValue: o.value,
|
|
1189
|
+
"onUpdate:modelValue": v[6] || (v[6] = (V) => o.value = V),
|
|
1190
|
+
"get-row-id": (V) => V._id,
|
|
1191
|
+
"column-defs": k,
|
|
1192
|
+
loading: u.value,
|
|
1193
|
+
"page-size": x.value.length,
|
|
1194
|
+
"row-data": x.value,
|
|
1195
|
+
shrinkAt: !1,
|
|
1196
|
+
virtual: !0,
|
|
1197
|
+
selection: "multiple",
|
|
1198
|
+
"hide-footer": "",
|
|
1199
|
+
"pin-header-row": "",
|
|
1200
|
+
onRowClick: v[7] || (v[7] = (V) => O(V.original))
|
|
1201
|
+
}, null, 8, ["modelValue", "get-row-id", "loading", "page-size", "row-data"])]),
|
|
1202
|
+
_: 1
|
|
1203
|
+
}), f(Se, {
|
|
1204
|
+
class: "flex-col flex-1 min-h-0 overflow-auto xs:flex hidden w-full pb-64",
|
|
1205
|
+
separator: ""
|
|
1206
|
+
}, {
|
|
1207
|
+
default: N(() => [(g(!0), M(H, null, G(x.value, (V) => (g(), j(xe, {
|
|
1208
|
+
key: V._id,
|
|
1209
|
+
label: V.name,
|
|
1210
|
+
style: {
|
|
1211
|
+
padding: "12px 0 !important"
|
|
1212
|
+
},
|
|
1213
|
+
onClick: () => O(V)
|
|
1214
|
+
}, {
|
|
1215
|
+
default: N(() => [i("div", Et, [i("div", Lt, [i("div", zt, E(s(V.updatedAt)), 1), f(b, {
|
|
1216
|
+
row: V
|
|
1217
|
+
}, null, 8, ["row"])]), i("div", Ht, [i("div", Jt, E(V.name), 1), i("div", Yt, [i("div", null, "Default: " + E(V.catalog.default), 1), i("div", null, "POS takeaway: " + E(V.catalog.takeaway), 1), i("div", null, "Pickup: " + E(V.catalog.pickup), 1)])])]), i("div", Kt, [a.value && V.revertConfig ? (g(), j(K, {
|
|
1218
|
+
key: 0,
|
|
1219
|
+
disabled: u.value,
|
|
1220
|
+
icon: "undo",
|
|
1221
|
+
variant: "tertiary",
|
|
1222
|
+
onClick: te(() => c(V), ["stop"])
|
|
1223
|
+
}, null, 8, ["disabled", "onClick"])) : Q("", !0), f(K, {
|
|
1224
|
+
disabled: u.value,
|
|
1225
|
+
icon: "ios_share",
|
|
1226
|
+
variant: "tertiary",
|
|
1227
|
+
onClick: te(() => l(S(V)), ["stop"])
|
|
1228
|
+
}, null, 8, ["disabled", "onClick"])])]),
|
|
1229
|
+
_: 2
|
|
1230
|
+
}, 1032, ["label", "onClick"]))), 128))]),
|
|
1231
|
+
_: 1
|
|
1232
|
+
})], 64)) : (g(), j(d(Re), {
|
|
1233
|
+
key: 1,
|
|
1234
|
+
title: d(n)("menu.publish.empty.title"),
|
|
1235
|
+
subtitle: d(n)("menu.publish.empty.subtitle"),
|
|
1236
|
+
action: {
|
|
1237
|
+
text: d(n)("menu.publish.empty.action"),
|
|
1238
|
+
icon: "add",
|
|
1239
|
+
callback: () => {
|
|
1240
|
+
d(F).push({
|
|
1241
|
+
name: "$settings-my-business"
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}, null, 8, ["title", "subtitle", "action"]))]), i("div", jt, [f(K, {
|
|
1246
|
+
disabled: u.value,
|
|
1247
|
+
icon: "ios_share",
|
|
1248
|
+
label: d(n)("menu.publish.actions.publish_all"),
|
|
1249
|
+
variant: "fab",
|
|
1250
|
+
onClick: v[8] || (v[8] = () => se())
|
|
1251
|
+
}, null, 8, ["disabled", "label"])]), f($t, {
|
|
1252
|
+
ref_key: "updateCatalogDialogRef",
|
|
1253
|
+
ref: h,
|
|
1254
|
+
catalogs: m.value,
|
|
1255
|
+
onOnComplete: l
|
|
1256
|
+
}, null, 8, ["catalogs"])], 64);
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
export {
|
|
1261
|
+
oa as default
|
|
1262
|
+
};
|