@feedmepos/mf-menu 0.32.68 → 0.32.70

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