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