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