@feedmepos/mf-menu 0.32.67 → 0.32.69

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