@feedmepos/mf-menu 0.31.65-prod → 0.31.66-prod

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 (65) hide show
  1. package/dist/{App-NxvfKBS5.js → App-_hhF2vEm.js} +8 -8
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-dbW4tYqo.js → ApplyProduct.vue_vue_type_script_setup_true_lang-CklNnQOQ.js} +3 -3
  3. package/dist/{Catalog-56QNhwzQ.js → Catalog-a7OJl76V.js} +6 -6
  4. package/dist/{Category-CFEwgSeh.js → Category-BAgeeHZ6.js} +4 -4
  5. package/dist/{Category-BhcNTzuG.js → Category-DKFOm00_.js} +6 -6
  6. package/dist/{CookingGuide-DRS2iYQE.js → CookingGuide-GG_xpPxA.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-BBmdf1Ox.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-DF3qFAAY.js} +1 -1
  8. package/dist/{Group-DUidJF0Q.js → Group-A14aBWXV.js} +3 -3
  9. package/dist/{Group-dA82MfMe.js → Group-B-B6Jd4O.js} +1 -1
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-C0uyinHG.js → Group.vue_vue_type_script_setup_true_lang-Bo5aYMxd.js} +8 -8
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-C-xO929R.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-C-ZkWtEg.js} +6 -6
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Bfl43N4s.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DDRPLd2p.js} +7 -7
  13. package/dist/{Ingredient-IuEBFfAV.js → Ingredient-BIpvrB2N.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-cgwQnZwI.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DilJrYvT.js} +1052 -1052
  15. package/dist/{LinkProductSideSheet-bTFrtmEF.js → LinkProductSideSheet-30MhDAHW.js} +4 -4
  16. package/dist/{MenuSetting-DDNA5cSo.js → MenuSetting-BPJSvs_F.js} +6 -6
  17. package/dist/{PrintRoute-CLrP6oFz.js → PrintRoute-CEPvNwF5.js} +4 -4
  18. package/dist/{Product-BUBC1der.js → Product-_bW36Ykl.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-Dxngjgbw.js → Product.vue_vue_type_script_setup_true_lang-8AU_Whl5.js} +14 -14
  20. package/dist/{ProductInternalTools-BEExOwjE.js → ProductInternalTools-BxKNE_3-.js} +5 -5
  21. package/dist/{Products-mcxzdyvV.js → Products-B90T96zV.js} +11 -11
  22. package/dist/Publish-DGnnsb-y.js +587 -0
  23. package/dist/{Recipe-CvooOkEm.js → Recipe-CgX2BPTq.js} +4 -4
  24. package/dist/{Scheduler-DNW1s2cX.js → Scheduler-C3nDtZZ8.js} +3 -3
  25. package/dist/{ServingSequence-Di1HFZzi.js → ServingSequence-cQsCat2N.js} +3 -3
  26. package/dist/{Setting-BjUcj2eS.js → Setting-CaVVM7vJ.js} +5 -5
  27. package/dist/{Subcategory-A3V_5EwR.js → Subcategory-D6ebsCyz.js} +4 -4
  28. package/dist/{Takeaway-SS0ZZuff.js → Takeaway-BzJEWe1f.js} +1 -1
  29. package/dist/{Takeaway-Dl60BZ-I.js → Takeaway-Dl0mDmGj.js} +4 -4
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-CoPtEtBl.js → Takeaway.vue_vue_type_script_setup_true_lang-DMgGcRGX.js} +5 -5
  31. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-DLCEwTR1.js → Thumbnail.vue_vue_type_script_setup_true_lang-3VDWuhZU.js} +4 -4
  32. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BKx1towF.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BWlhpHF0.js} +15 -15
  33. package/dist/{Unit-DFQVca7g.js → Unit-DOLHXdK6.js} +2 -2
  34. package/dist/{Variant-D2ad7-aY.js → Variant-BUvj1bus.js} +3 -3
  35. package/dist/{_id_-Dhn2K-WO.js → _id_-RO4KdC1n.js} +10 -10
  36. package/dist/{app-CiBqmBzO.js → app-5fxKLAzS.js} +2667 -2564
  37. package/dist/{app-CHrfSnH-.js → app-CzbgqOf0.js} +26 -26
  38. package/dist/{app-BST1Ws0Q.js → app-DQQJ_9iV.js} +1 -1
  39. package/dist/app.js +1 -1
  40. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  41. package/dist/assets/{linked-status-C88hxUQa.js → linked-status-Dt3Uze-A.js} +2 -2
  42. package/dist/assets/{override-menu-DKuz_186.js → override-menu-BQEFLWz8.js} +2 -2
  43. package/dist/assets/{validate-menu-DBd0Wz1c.js → validate-menu-BnfLMKMw.js} +2 -2
  44. package/dist/{catalog-BRfrkxXk.js → catalog-BUXOgvi0.js} +1 -1
  45. package/dist/{catalogSetting-82LtM5qr.js → catalogSetting-Cr--_S9s.js} +1 -1
  46. package/dist/{category-CJYDELtR.js → category-foWTUFXU.js} +1 -1
  47. package/dist/{currency-DL7o403k.js → currency-B6rUrrkO.js} +1 -1
  48. package/dist/{customAttributes-laCstc_D.js → customAttributes-nIVPnbIm.js} +2 -2
  49. package/dist/{dayjs.min-CqGLmCBm.js → dayjs.min---cWh2WB.js} +1 -1
  50. package/dist/{index-CyKl4kdN.js → index-DOvqkmcU.js} +4 -4
  51. package/dist/{index-DIuW1yrT.js → index-DfwxGeiO.js} +1 -1
  52. package/dist/{index-Cg1QT--E.js → index-FhzMSZhS.js} +3 -3
  53. package/dist/{index-XoZlSvmA.js → index-sv_MoGNZ.js} +1 -1
  54. package/dist/{item-Cex_kX2Y.js → item-hCbfNYuw.js} +16 -16
  55. package/dist/{jszip.min-Cyt3sNxf.js → jszip.min-DIGWbVTA.js} +245 -245
  56. package/dist/{menu-DZ0SKMgS.js → menu-CGpVK1Kw.js} +1 -1
  57. package/dist/{menu-RUcYPH-Z.js → menu-CgDLwNcD.js} +4 -4
  58. package/dist/{menuV2-DCKpicf5.js → menuV2-CuNqLLAt.js} +73 -73
  59. package/dist/{priceTier-9huRkA05.js → priceTier-BhpczzJB.js} +1 -1
  60. package/dist/{scheduler-ouP5_AvY.js → scheduler-BkV-4RPJ.js} +4 -4
  61. package/dist/{subcategory-CFJE8poU.js → subcategory-Dni2F8ro.js} +2 -2
  62. package/dist/{toExcel-BUfI8qSm.js → toExcel-BS-4qoqI.js} +2 -2
  63. package/dist/{unit-wnLzGtSP.js → unit-Ylo0Rojv.js} +3 -3
  64. package/package.json +1 -1
  65. package/dist/Publish-BYQLBhts.js +0 -581
@@ -1,581 +0,0 @@
1
- import { defineComponent as G, ref as A, computed as $, onMounted as ie, resolveComponent as C, createElementBlock as D, openBlock as h, createVNode as o, createElementVNode as s, toDisplayString as I, unref as u, Fragment as O, renderList as W, createBlock as T, withCtx as L, createCommentVNode as re, withModifiers as K, h as Y } from "vue";
2
- import { D as ae } from "./dayjs.min-CqGLmCBm.js";
3
- import { useRouter as ce } from "vue-router";
4
- import { B as de, e as me, G as te, a7 as pe, H as Z, I as ge, u as be, A as ve } from "./menu-RUcYPH-Z.js";
5
- import { useI18n as J, useCoreStore as fe, RestaurantSelector as _e } from "@feedmepos/mf-common";
6
- import { useSnackbar as le, useDialogChild as he, useDialog as ye, components as ee } from "@feedmepos/ui-library";
7
- import { _ as Ce } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
8
- import { _ as ke } from "./app-CHrfSnH-.js";
9
- import { c as we } from "./iteration-BoeoXAHD.js";
10
- import { a as xe, w as Ve, p as Se } from "./tooltip-CQW9YRO5.js";
11
- import { u as Fe } from "./discardConfirm-BHni0LNu.js";
12
- import { _ as Ie } from "./index.vue_vue_type_script_setup_true_lang-BgqsTzLI.js";
13
- function se(x) {
14
- return x ? ae(x).format("DD/MM/YY HH:mm") : "-";
15
- }
16
- function Ae(x, V, l) {
17
- const c = (r, p = !1) => {
18
- var y;
19
- return r === void 0 && !p ? "-" : ((y = l.find((f) => f.value === (r || null))) == null ? void 0 : y.label) || "-";
20
- };
21
- return x.map((r) => {
22
- var g;
23
- const p = (g = V.find(({ _id: t }) => t === r._id)) == null ? void 0 : g.posVersion, y = !!p && !!de.Pos.canUse({ feature: me.F_FEATURE.enum.taxAndServiceChargeV4, posVersion: p }), f = c(r.catalogId);
24
- return {
25
- ...r,
26
- _default: f,
27
- _posTakeaway: r.takeawayCatalog ? c(r.takeawayCatalog) : f,
28
- _additionalCatalogs: (r.additionalCatalogs || []).map((t) => c(t)),
29
- _lastUpdate: se(r.updatedAt),
30
- _pickup: y ? c(r.pickupCatalog, !0) : "-",
31
- _canUsePickup: y,
32
- _posVersion: p || "-"
33
- };
34
- });
35
- }
36
- const Me = {
37
- key: 0,
38
- class: "flex items-center justify-center"
39
- }, $e = {
40
- key: 1,
41
- class: "space-y-16"
42
- }, Re = { class: "text-fm-color-typo-secondary" }, De = { class: "space-y-4" }, Pe = /* @__PURE__ */ G({
43
- __name: "RevertDialog",
44
- props: {
45
- restaurant: {}
46
- },
47
- setup(x) {
48
- const V = x, l = le(), { custom: c } = te(l), r = A(!1), p = A(null);
49
- async function y() {
50
- await c(
51
- async () => {
52
- var d;
53
- p.value = await pe.readMenuById(((d = V.restaurant.revertConfig) == null ? void 0 : d._id) || "");
54
- },
55
- { isLoading: r }
56
- );
57
- }
58
- const f = $(() => {
59
- var d;
60
- return [
61
- { label: "Main", value: null },
62
- ...(((d = p.value) == null ? void 0 : d.modules.catalog) || []).map((_) => ({
63
- label: _.name,
64
- value: _._id
65
- }))
66
- ];
67
- }), { t: g } = J(), t = $(() => {
68
- var k;
69
- const d = V.restaurant.revertConfig;
70
- if (!d) return [];
71
- const _ = Ae(
72
- [
73
- {
74
- ...d,
75
- catalogId: d.catalogId || null
76
- }
77
- ],
78
- fe().restaurants.value,
79
- f.value
80
- )[0];
81
- return [
82
- { label: g("menu.revert.labels.restaurant"), value: V.restaurant.name },
83
- {
84
- label: g("menu.revert.labels.revert_to"),
85
- value: se((k = p.value) == null ? void 0 : k.updatedAt)
86
- },
87
- { label: g("menu.revert.labels.default"), value: _._default },
88
- { label: g("menu.revert.labels.pos_takeaway"), value: _._posTakeaway },
89
- { label: g("menu.revert.labels.pickup"), value: _._pickup },
90
- {
91
- label: g("menu.revert.labels.additional_catalogs"),
92
- value: _._additionalCatalogs.join(", ")
93
- }
94
- ];
95
- });
96
- ie(async () => y());
97
- const { emitData: P } = he();
98
- return (d, _) => {
99
- const k = C("FmCircularProgress");
100
- return r.value ? (h(), D("div", Me, [
101
- o(k, { size: "lg" })
102
- ])) : (h(), D("div", $e, [
103
- s("div", Re, I(u(g)("menu.revert.description", { name: V.restaurant.name })), 1),
104
- s("div", De, [
105
- (h(!0), D(O, null, W(t.value, (M) => (h(), T(xe, {
106
- key: M.label,
107
- name: M.label,
108
- value: M.value || "--"
109
- }, null, 8, ["name", "value"]))), 128))
110
- ])
111
- ]));
112
- };
113
- }
114
- }), Ue = { class: "fm-typo-en-title-md-600" }, Le = { class: "mt-40" }, Be = { class: "fm-typo-en-title-sm-600" }, Ee = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mt-4 mb-8" }, Oe = { class: "flex gap-8 items-center justify-start" }, Te = /* @__PURE__ */ G({
115
- __name: "UpdateCatalogDialog",
116
- props: {
117
- catalogs: {
118
- type: Array,
119
- required: !0
120
- }
121
- },
122
- emits: ["onComplete"],
123
- setup(x, { expose: V, emit: l }) {
124
- const { t: c } = J(), r = x;
125
- V({
126
- show: _,
127
- hide: k
128
- });
129
- const p = l;
130
- function y() {
131
- return {
132
- restaurantId: "",
133
- catalogId: void 0,
134
- takeawayCatalog: void 0,
135
- pickupCatalog: null,
136
- additionalCatalogs: []
137
- };
138
- }
139
- const f = $(() => [
140
- {
141
- label: c("menu.publish.update_catalog_dialog.sections.default.use_default"),
142
- value: null
143
- },
144
- ...r.catalogs.map((m) => ({
145
- label: m.name,
146
- value: m._id
147
- }))
148
- ]), g = $(() => [
149
- {
150
- label: c("menu.publish.update_catalog_dialog.sections.default.use_default"),
151
- value: null
152
- },
153
- ...r.catalogs.map((m) => ({
154
- label: m.name,
155
- value: m._id
156
- }))
157
- ]), t = A(y()), P = A(!1), d = A(void 0);
158
- function _(m) {
159
- d.value = m ? Z(m) : y(), t.value = Z(d.value), P.value = !0;
160
- }
161
- function k() {
162
- P.value = !1;
163
- }
164
- const M = Fe(
165
- () => !ge.isEqual(d.value, t.value),
166
- () => {
167
- k();
168
- }
169
- );
170
- function N() {
171
- k(), p("onComplete", t.value);
172
- }
173
- return (m, b) => {
174
- const U = C("FmSelect"), z = C("FmCheckbox"), E = C("FmButton"), R = C("FmSideSheet");
175
- return h(), T(R, {
176
- modelValue: P.value,
177
- "onUpdate:modelValue": b[5] || (b[5] = (v) => P.value = v),
178
- "max-width": 560,
179
- "onOn:clickedAway": u(M)
180
- }, {
181
- "side-sheet-header": L(() => [
182
- s("span", Ue, I(u(c)("menu.publish.update_catalog_dialog.title")), 1)
183
- ]),
184
- "side-sheet-footer": L(() => [
185
- s("div", Oe, [
186
- o(E, {
187
- label: u(c)("menu.publish.update_catalog_dialog.actions.update"),
188
- size: "lg",
189
- variant: "primary",
190
- onClick: b[4] || (b[4] = () => N())
191
- }, null, 8, ["label"]),
192
- o(E, {
193
- label: u(c)("menu.publish.update_catalog_dialog.actions.cancel"),
194
- size: "lg",
195
- variant: "tertiary",
196
- onClick: k
197
- }, null, 8, ["label"])
198
- ])
199
- ]),
200
- default: L(() => [
201
- o(U, {
202
- modelValue: t.value.catalogId,
203
- "onUpdate:modelValue": b[0] || (b[0] = (v) => t.value.catalogId = v),
204
- items: f.value,
205
- class: "mb-24",
206
- label: u(c)("menu.publish.update_catalog_dialog.sections.default.label")
207
- }, null, 8, ["modelValue", "items", "label"]),
208
- o(U, {
209
- modelValue: t.value.takeawayCatalog,
210
- "onUpdate:modelValue": b[1] || (b[1] = (v) => t.value.takeawayCatalog = v),
211
- items: g.value,
212
- class: "mb-24",
213
- label: u(c)("menu.publish.update_catalog_dialog.sections.pos_takeaway.label")
214
- }, null, 8, ["modelValue", "items", "label"]),
215
- o(U, {
216
- modelValue: t.value.pickupCatalog,
217
- "onUpdate:modelValue": b[2] || (b[2] = (v) => t.value.pickupCatalog = v),
218
- items: g.value,
219
- label: u(c)("menu.publish.update_catalog_dialog.sections.pickup.label")
220
- }, null, 8, ["modelValue", "items", "label"]),
221
- s("div", Le, [
222
- s("div", Be, I(u(c)("menu.publish.update_catalog_dialog.sections.additional.title")), 1),
223
- s("div", Ee, I(u(c)("menu.publish.update_catalog_dialog.sections.additional.subtitle")), 1),
224
- (h(!0), D(O, null, W(x.catalogs, (v) => (h(), D("div", {
225
- key: v._id
226
- }, [
227
- o(z, {
228
- modelValue: t.value.additionalCatalogs,
229
- "onUpdate:modelValue": b[3] || (b[3] = (B) => t.value.additionalCatalogs = B),
230
- label: v.name,
231
- value: v._id
232
- }, null, 8, ["modelValue", "label", "value"])
233
- ]))), 128))
234
- ])
235
- ]),
236
- _: 1
237
- }, 8, ["modelValue", "onOn:clickedAway"]);
238
- };
239
- }
240
- }), Ne = {
241
- class: "flex flex-col p-24 bg-fm-color-neutral-white min-h-[calc(100dvh-56px)] xs:max-h-[calc(100dvh-56px)]"
242
- }, ze = {
243
- class: "flex items-center xs:mb-8 mb-24"
244
- }, He = {
245
- class: "mr-8"
246
- }, Ke = {
247
- class: "fm-typo-en-title-md-600"
248
- }, je = {
249
- class: "xs:hidden mr-16"
250
- }, Ye = {
251
- class: "xs:hidden"
252
- }, qe = {
253
- class: "pb-8 flex justify-between xs:flex-col gap-8"
254
- }, Ge = {
255
- class: "grow flex flex-col gap-4"
256
- }, We = {
257
- class: "flex gap-8 items-center"
258
- }, Je = {
259
- class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary"
260
- }, Qe = {
261
- class: "space-y-4"
262
- }, Xe = {
263
- class: "fm-typo-en-body-lg-600"
264
- }, Ze = {
265
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
266
- }, ea = {
267
- class: "flex gap-8"
268
- }, aa = {
269
- class: "xs:block hidden fixed bottom-72 right-16"
270
- }, q = 40, ga = /* @__PURE__ */ G({
271
- __name: "Publish",
272
- setup(x) {
273
- const V = ce(), {
274
- t: l
275
- } = J(), c = (e) => t.state.menu.updatedAt === e.updatedAt, r = ({
276
- row: e
277
- }) => {
278
- const a = c(e);
279
- return o(Ce, {
280
- label: l(a ? "menu.publish.table.status.latest" : "menu.publish.table.status.outdated"),
281
- variant: a ? "success" : "warning"
282
- }, null);
283
- }, p = A({}), y = [{
284
- accessorKey: "name",
285
- header: () => l("menu.publish.table.columns.restaurant"),
286
- cell: (e) => e.getValue(),
287
- enableSorting: !0
288
- }, {
289
- accessorKey: "catalog",
290
- header: () => l("menu.publish.table.columns.default"),
291
- enableSorting: !1,
292
- cell: (e) => e.getValue().default
293
- }, {
294
- accessorKey: "catalog",
295
- header: () => l("menu.publish.table.columns.pos_takeaway"),
296
- enableSorting: !1,
297
- cell: (e) => e.getValue().takeaway
298
- }, {
299
- accessorKey: "catalog",
300
- header: () => l("menu.publish.table.columns.pickup"),
301
- enableSorting: !1,
302
- cell: (e) => e.getValue().pickup
303
- }, {
304
- accessorKey: "updatedAt",
305
- header: () => l("menu.publish.table.columns.version"),
306
- enableSorting: !1,
307
- cell: (e) => {
308
- const a = e.getValue();
309
- return M(a);
310
- }
311
- }, {
312
- accessorKey: "status",
313
- header: () => l("menu.common.labels.status"),
314
- enableSorting: !1,
315
- cell: (e) => o(r, {
316
- row: e.row.original
317
- }, null)
318
- }, {
319
- accessorKey: "_id",
320
- header: "",
321
- size: 52,
322
- enableSorting: !1,
323
- cell: (e) => {
324
- const a = e.row.original;
325
- return t.state.menu.updatedAt, a.updatedAt, Y("div", {
326
- class: "flex justify-end gap-8"
327
- }, [d.value && a.revertConfig ? Ve(Y(ee.FmButton, {
328
- prependIcon: "undo",
329
- variant: "secondary",
330
- onClick: K(async () => {
331
- await _(e.row.original);
332
- }, ["stop", "prevent"])
333
- }), l("menu.publish.actions.revert")) : null, Y(ee.FmButton, {
334
- label: l("menu.publish.actions.publish"),
335
- icon: "ios_share",
336
- variant: "secondary",
337
- onClick: K(async () => {
338
- const i = U(e.row.original);
339
- await v(i);
340
- }, ["stop", "prevent"])
341
- })]);
342
- },
343
- meta: {
344
- width: "150px"
345
- }
346
- }], f = A(""), g = A(), t = be(), P = ye(), d = $(() => t.version !== ve.F_MENU_VERSION.enum.v3);
347
- async function _(e) {
348
- e.revertConfig && P.open({
349
- title: "Revert menu",
350
- contentComponent: Pe,
351
- contentComponentProps: {
352
- restaurant: e
353
- },
354
- primaryActions: {
355
- text: "Revert",
356
- close: !0
357
- },
358
- secondaryActions: {
359
- text: "Cancel",
360
- close: !0
361
- }
362
- }).onPrimary(async () => {
363
- await R.minor(async () => {
364
- await t.revertRestaurantMenu(e._id);
365
- }, {
366
- customId: e._id,
367
- message: `Revert menu of ${e.name}`
368
- });
369
- });
370
- }
371
- const k = $(() => l("menu.publish.labels.main_version", {
372
- version: M(t.state.menu.updatedAt)
373
- }));
374
- function M(e) {
375
- return e ? ae(e).format("DD/MM/YYYY hh:mmA") : "";
376
- }
377
- const N = $(() => t.state.menu.modules.catalog), m = $(() => R.queue.value.some((e) => e.id === t.state.menu._id));
378
- function b(e) {
379
- var a;
380
- return e ? ((a = N.value.find((i) => i._id === e)) == null ? void 0 : a.name) ?? l("menu.publish.labels.catalog.invalid") : l("menu.publish.labels.catalog.main");
381
- }
382
- function U(e) {
383
- return {
384
- restaurantId: e._id,
385
- catalogId: e.catalogId,
386
- takeawayCatalog: e.takeawayCatalog,
387
- pickupCatalog: e.pickupCatalog || null,
388
- additionalCatalogs: e.additionalCatalogs
389
- };
390
- }
391
- function z(e) {
392
- var i;
393
- const a = U(e);
394
- (i = g.value) == null || i.show(a);
395
- }
396
- const E = le(), R = te(E);
397
- async function v(e) {
398
- var i;
399
- const a = (i = S.value.find((w) => w._id === e.restaurantId)) == null ? void 0 : i.name;
400
- await R.minor(async () => await t.publishMenu(e), {
401
- customId: t.state.menu._id,
402
- message: `Publishing menu for ${a}`,
403
- successMessage: `Published to ${a}`
404
- });
405
- }
406
- const B = A(null), S = $(() => {
407
- const e = f.value.toLowerCase();
408
- return t.state.restaurants.filter((a) => {
409
- var i;
410
- return !B.value || ((i = B.value) == null ? void 0 : i.includes(a._id));
411
- }).map((a) => ({
412
- ...a,
413
- catalog: {
414
- default: b(a.catalogId),
415
- takeaway: b(a.takeawayCatalog),
416
- pickup: b(a.pickupCatalog)
417
- }
418
- })).filter(({
419
- name: a,
420
- catalog: i
421
- }) => e ? a.toLowerCase().includes(e) || i.default.toLowerCase().includes(e) || i.takeaway.toLowerCase().includes(e) || i.pickup.toLowerCase().includes(e) : !0);
422
- });
423
- async function oe(e) {
424
- const a = e.map((F) => F._id), i = we(a, q), w = A("");
425
- await R.minor(async () => {
426
- await Se({
427
- items: i,
428
- processor: async (F) => await t.publishMultipleMenu(F, !1),
429
- batchSize: 1,
430
- batchDelay: 50,
431
- // 50ms delay to reduce server load
432
- onProgress({
433
- total: F,
434
- batchStart: H,
435
- batchEnd: X
436
- }) {
437
- const j = (H - 1) * q;
438
- w.value = `Processed ${j} of ${e.length} restaurants`;
439
- }
440
- }), await t.readRestaurants(), await t.readMenu();
441
- }, {
442
- customId: t.state.menu._id,
443
- message: "Publishing menu",
444
- caption: w,
445
- successMessage: `Published to ${e.length} restaurant${e.length > 1 ? "s" : ""}`
446
- });
447
- }
448
- async function ne() {
449
- await R.minor(async () => await t.readRestaurants(), {
450
- customId: t.state.menu._id
451
- });
452
- }
453
- async function Q() {
454
- if (m.value) return;
455
- const e = Object.keys(p.value).map(Number).filter((w) => p.value[w]), a = e.length === 0 || e.length === S.value.length ? S.value : e.map((w) => S.value[w]);
456
- S.value.length === t.state.restaurants.length && (e.length === 0 || e.length === S.value.length) ? t.state.restaurants.length > q ? (t.publishAllMenu(), E.open({
457
- type: "info",
458
- title: "Publish menu request sent"
459
- })) : await R.minor(async () => await t.publishAllMenu(), {
460
- customId: t.state.menu._id
461
- }) : await oe(a);
462
- }
463
- return (e, a) => {
464
- const i = C("FmChip"), w = C("FmSpacer"), F = C("FmButton"), H = C("FmSearch"), X = C("FmTable"), j = C("FmListItem"), ue = C("FmList");
465
- return h(), D(O, null, [s("div", Ne, [s("div", ze, [s("div", He, [s("div", Ke, I(u(l)("menu.publish.title")), 1), a[8] || (a[8] = s("div", {
466
- class: "hidden xs:block fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
467
- }, null, -1))]), o(i, {
468
- label: k.value,
469
- class: "xs:hidden text-fm-color-primary bg-fm-color-system-warning-100"
470
- }, null, 8, ["label"]), o(w), s("div", je, [o(F, {
471
- disabled: m.value,
472
- label: u(l)("menu.publish.actions.refresh"),
473
- variant: "secondary",
474
- onClick: a[0] || (a[0] = () => ne())
475
- }, null, 8, ["disabled", "label"])]), s("div", Ye, [o(F, {
476
- disabled: m.value,
477
- icon: "ios_share",
478
- label: u(l)("menu.publish.actions.publish_all"),
479
- variant: "primary",
480
- onClick: a[1] || (a[1] = () => Q())
481
- }, null, 8, ["disabled", "label"])])]), s("div", qe, [o(u(_e), {
482
- multiple: "",
483
- modelValue: B.value,
484
- "onUpdate:modelValue": a[3] || (a[3] = (n) => B.value = n)
485
- }, {
486
- "append-right": L(() => [o(w, {
487
- class: "xs:hidden"
488
- }), o(H, {
489
- modelValue: f.value,
490
- "onUpdate:modelValue": a[2] || (a[2] = (n) => f.value = n),
491
- autofocus: "",
492
- class: "w-[320px] xs:hidden",
493
- placeholder: u(l)("menu.publish.table.search.placeholder")
494
- }, null, 8, ["modelValue", "placeholder"])]),
495
- _: 1
496
- }, 8, ["modelValue"]), o(H, {
497
- modelValue: f.value,
498
- "onUpdate:modelValue": a[4] || (a[4] = (n) => f.value = n),
499
- autofocus: "",
500
- class: "w-full xs:block hidden",
501
- placeholder: u(l)("menu.publish.table.search.placeholder")
502
- }, null, 8, ["modelValue", "placeholder"])]), S.value.length > 0 ? (h(), D(O, {
503
- key: 0
504
- }, [o(ke, {
505
- class: "xs:hidden block"
506
- }, {
507
- default: L(() => [o(X, {
508
- modelValue: p.value,
509
- "onUpdate:modelValue": a[5] || (a[5] = (n) => p.value = n),
510
- "column-defs": y,
511
- loading: m.value,
512
- "page-size": S.value.length,
513
- "row-data": S.value,
514
- shrinkAt: !1,
515
- virtual: !0,
516
- selection: "multiple",
517
- "hide-footer": "",
518
- "pin-header-row": "",
519
- onRowClick: a[6] || (a[6] = (n) => z(n.original))
520
- }, null, 8, ["modelValue", "loading", "page-size", "row-data"])]),
521
- _: 1
522
- }), o(ue, {
523
- class: "flex-col flex-1 min-h-0 overflow-auto xs:flex hidden w-full pb-64",
524
- separator: ""
525
- }, {
526
- default: L(() => [(h(!0), D(O, null, W(S.value, (n) => (h(), T(j, {
527
- key: n._id,
528
- label: n.name,
529
- style: {
530
- padding: "12px 0 !important"
531
- },
532
- onClick: () => z(n)
533
- }, {
534
- default: L(() => [s("div", Ge, [s("div", We, [s("div", Je, I(M(n.updatedAt)), 1), o(r, {
535
- row: n
536
- }, null, 8, ["row"])]), s("div", Qe, [s("div", Xe, I(n.name), 1), s("div", Ze, [s("div", null, "Default: " + I(n.catalog.default), 1), s("div", null, "POS takeaway: " + I(n.catalog.takeaway), 1), s("div", null, "Pickup: " + I(n.catalog.pickup), 1)])])]), s("div", ea, [d.value && n.revertConfig ? (h(), T(F, {
537
- key: 0,
538
- disabled: m.value,
539
- icon: "undo",
540
- variant: "tertiary",
541
- onClick: K(() => _(n), ["stop"])
542
- }, null, 8, ["disabled", "onClick"])) : re("", !0), o(F, {
543
- disabled: m.value,
544
- icon: "ios_share",
545
- variant: "tertiary",
546
- onClick: K(() => v(U(n)), ["stop"])
547
- }, null, 8, ["disabled", "onClick"])])]),
548
- _: 2
549
- }, 1032, ["label", "onClick"]))), 128))]),
550
- _: 1
551
- })], 64)) : (h(), T(u(Ie), {
552
- key: 1,
553
- title: u(l)("menu.publish.empty.title"),
554
- subtitle: u(l)("menu.publish.empty.subtitle"),
555
- action: {
556
- text: u(l)("menu.publish.empty.action"),
557
- icon: "add",
558
- callback: () => {
559
- u(V).push({
560
- name: "$settings-my-business"
561
- });
562
- }
563
- }
564
- }, null, 8, ["title", "subtitle", "action"]))]), s("div", aa, [o(F, {
565
- disabled: m.value,
566
- icon: "ios_share",
567
- label: u(l)("menu.publish.actions.publish_all"),
568
- variant: "fab",
569
- onClick: a[7] || (a[7] = () => Q())
570
- }, null, 8, ["disabled", "label"])]), o(Te, {
571
- ref_key: "updateCatalogDialogRef",
572
- ref: g,
573
- catalogs: N.value,
574
- onOnComplete: v
575
- }, null, 8, ["catalogs"])], 64);
576
- };
577
- }
578
- });
579
- export {
580
- ga as default
581
- };