@feedmepos/mf-menu 0.31.58 → 0.31.59-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 (99) hide show
  1. package/dist/{App-4OJNK33x.js → App-BOPLjp2t.js} +9 -9
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-z1Zz5Sp5.js → ApplyProduct.vue_vue_type_script_setup_true_lang-B0w-0323.js} +3 -3
  3. package/dist/{Catalog-ChQ6kyxu.js → Catalog-gBWbOsnM.js} +6 -6
  4. package/dist/{Category-DneMgC68.js → Category-CeF88DtX.js} +4 -4
  5. package/dist/{Category-BUWAbpnF.js → Category-D5ppD_g8.js} +6 -6
  6. package/dist/{CookingGuide-SMIrGRhO.js → CookingGuide-CJukilxD.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-CO5hvXyK.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-BMP7V0dP.js} +1 -1
  8. package/dist/{Group-C_-gHlF6.js → Group-C-zR2RKW.js} +3 -3
  9. package/dist/{Group-Bwa18nwy.js → Group-CEQbAUmY.js} +1 -1
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-3CfTDFvi.js → Group.vue_vue_type_script_setup_true_lang-h5FbAvbs.js} +7 -7
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D2YjWZFt.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Cy2NGGs0.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-n49ilrgv.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Gtkau8ku.js} +1617 -1616
  13. package/dist/{Ingredient-tjdvEfBz.js → Ingredient-B0Ms0Ol5.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-D_1BK_Nv.js → InventoryBinding.vue_vue_type_script_setup_true_lang-B4BxYfdg.js} +2 -2
  15. package/dist/{LinkProductSideSheet-DZKUJVBg.js → LinkProductSideSheet-B1y2Ayvj.js} +3 -3
  16. package/dist/{MenuSetting-DBxurtBc.js → MenuSetting-DclPszys.js} +5 -5
  17. package/dist/{PrintRoute-BYcX0ngY.js → PrintRoute-BnzR0uWT.js} +4 -4
  18. package/dist/{Product-aYPPIX5w.js → Product-BoSo8lss.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-1EbJ3SkW.js → Product.vue_vue_type_script_setup_true_lang-DIjDOk5_.js} +13 -13
  20. package/dist/{ProductInternalTools-0WfRyVYc.js → ProductInternalTools-Bdte6TiU.js} +6 -6
  21. package/dist/{Products-RFrNHHZ3.js → Products-nv1C711P.js} +12 -12
  22. package/dist/Publish-C780zto1.js +582 -0
  23. package/dist/{Recipe-eQU0cvIu.js → Recipe-mjjd4B1O.js} +4 -4
  24. package/dist/{Scheduler-BEcYM9Iw.js → Scheduler-mfPG6062.js} +3 -3
  25. package/dist/{ServingSequence-PJip9tl8.js → ServingSequence-CRs6qSMs.js} +3 -3
  26. package/dist/{Setting-DiJc2cl5.js → Setting-DZ2GbgN6.js} +5 -5
  27. package/dist/{Subcategory-BCxf7Gns.js → Subcategory-Cgd9qnoN.js} +4 -4
  28. package/dist/{Takeaway-C8MqmlYi.js → Takeaway-B8m-KeUW.js} +4 -4
  29. package/dist/{Takeaway-BxcdiIlz.js → Takeaway-BiDzpaT9.js} +1 -1
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-bAgTm0N3.js → Takeaway.vue_vue_type_script_setup_true_lang-vYeVX-ZM.js} +5 -5
  31. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-DEwikUuP.js → Thumbnail.vue_vue_type_script_setup_true_lang-DeeXDIAS.js} +4 -4
  32. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-cgKST8tG.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-hHOmCp8A.js} +15 -15
  33. package/dist/{Unit-DcJmP_Ps.js → Unit-CALtexAk.js} +2 -2
  34. package/dist/{Variant-Do_WyYNh.js → Variant-DzkUpsBK.js} +3 -3
  35. package/dist/{_id_-BceqPzR5.js → _id_-B3dZqQFx.js} +10 -10
  36. package/dist/{app-CAXZLHIp.js → app-CcaKJaQg.js} +1 -1
  37. package/dist/{app-DXgWN7R_.js → app-L6-9-FPx.js} +30 -30
  38. package/dist/app.js +1 -1
  39. package/dist/apps/mf-menu/src/app.d.ts +4 -0
  40. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/ApplyProduct.vue.d.ts +12 -0
  41. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/ApplyProductDialog.vue.d.ts +6 -0
  42. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/index.d.ts +32 -0
  43. package/dist/apps/mf-menu/src/components/feature/GroupManager/OptionTable.vue.d.ts +10 -0
  44. package/dist/apps/mf-menu/src/components/feature/GroupManager/UpdateForm.vue.d.ts +6 -0
  45. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierButton.vue.d.ts +14 -0
  46. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierForm.vue.d.ts +14 -0
  47. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/item.d.ts +14 -0
  48. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/scheduler.d.ts +12 -0
  49. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/useItemFormManagement.d.ts +7 -0
  50. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/OptionTable.vue.d.ts +10 -0
  51. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/UpdateForm.vue.d.ts +6 -0
  52. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/index.d.ts +24 -0
  53. package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ItemForm.vue.d.ts +21 -0
  54. package/dist/apps/mf-menu/src/components/feature/TreeEditor/menuUtils.d.ts +7 -0
  55. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +73 -0
  56. package/dist/apps/mf-menu/src/components/import/PreviewAddonContent.vue.d.ts +14 -0
  57. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +12 -0
  58. package/dist/apps/mf-menu/src/helper/import-export-utils.d.ts +0 -1
  59. package/dist/apps/mf-menu/src/helper/itemCategories.d.ts +7 -0
  60. package/dist/apps/mf-menu/src/helper/menu.d.ts +80 -0
  61. package/dist/apps/mf-menu/src/helper/menuImport.d.ts +73 -0
  62. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +73 -0
  63. package/dist/apps/mf-menu/src/stores/manager/item.d.ts +21 -0
  64. package/dist/apps/mf-menu/src/stores/manager/scheduler.d.ts +12 -0
  65. package/dist/apps/mf-menu/src/stores/menu.d.ts +73 -0
  66. package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/Form.vue.d.ts +14 -0
  67. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +46 -0
  68. package/dist/apps/mf-menu/src/views/Scheduler/FilterForm.vue.d.ts +10 -0
  69. package/dist/apps/mf-menu/src/views/Scheduler/SchedulerDialog.vue.d.ts +10 -0
  70. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  71. package/dist/assets/linked-status-focDgSo7.js +13 -0
  72. package/dist/assets/override-menu-B4q9lesJ.js +13 -0
  73. package/dist/assets/validate-menu-De0Bu4qH.js +13 -0
  74. package/dist/{catalog-BuS51no9.js → catalog-DC9IVpL1.js} +1 -1
  75. package/dist/{catalogSetting-Bbls_J1a.js → catalogSetting-Crbl9TFz.js} +1 -1
  76. package/dist/{category-BUmk-ooT.js → category-C8Q_lN6Q.js} +1 -1
  77. package/dist/{currency-Ch7w-XAU.js → currency-vandbXgQ.js} +1 -1
  78. package/dist/{customAttributes-DXI1EmC-.js → customAttributes-Cj0PdMZu.js} +1 -1
  79. package/dist/{dayjs.min-CErGuRpO.js → dayjs.min-B4sm2fZr.js} +1 -1
  80. package/dist/{index-mdjKX0Ji.js → index-COwTqSNG.js} +4 -4
  81. package/dist/{index-ekKM58m3.js → index-DRl2ccS-.js} +1 -1
  82. package/dist/{index-CO0l1aSP.js → index-DvKBm3gm.js} +3 -3
  83. package/dist/{index-D3n5el48.js → index-NPN9_5oT.js} +1 -1
  84. package/dist/{item-BlpLdm39.js → item-mzvS_pFv.js} +375 -375
  85. package/dist/{jszip.min-C89zynEq.js → jszip.min-UpFUrh5P.js} +2 -2
  86. package/dist/menu-CDIfnu9y.js +132665 -0
  87. package/dist/{menu-DsUyJSm2.js → menu-CebF4MOX.js} +1 -1
  88. package/dist/{menuV2-ZcV0fJla.js → menuV2-C0BdBTv7.js} +30 -30
  89. package/dist/{priceTier-tSzlPPnO.js → priceTier-BEA_b-IX.js} +1 -1
  90. package/dist/{scheduler-CMxzeUSM.js → scheduler-oUiE2ldE.js} +4 -4
  91. package/dist/{subcategory-BdAgTTXj.js → subcategory-2hHCLbWG.js} +2 -2
  92. package/dist/{toExcel-BC7oAHOo.js → toExcel-zRg8UHeP.js} +2 -2
  93. package/dist/{unit-90XRSsu5.js → unit-CYPHVVUz.js} +2 -2
  94. package/package.json +2 -2
  95. package/dist/Publish-CPm55mPz.js +0 -567
  96. package/dist/assets/linked-status-SkhWmTpd.js +0 -13
  97. package/dist/assets/override-menu-DnMJwh8J.js +0 -13
  98. package/dist/assets/validate-menu-C40JtIjv.js +0 -13
  99. package/dist/menu-B6iWDS6T.js +0 -108625
@@ -1,567 +0,0 @@
1
- import { defineComponent as q, ref as I, computed as S, onMounted as ue, resolveComponent as C, createElementBlock as D, openBlock as h, createVNode as s, createElementVNode as o, toDisplayString as F, unref as i, Fragment as E, renderList as G, createBlock as O, withCtx as P, createCommentVNode as ie, withModifiers as H, h as j } from "vue";
2
- import { D as ae } from "./dayjs.min-CErGuRpO.js";
3
- import { useRouter as re } from "vue-router";
4
- import { B as ce, e as de, G as te, a7 as me, H as Z, I as pe, u as ge, A as ve } from "./menu-B6iWDS6T.js";
5
- import { useI18n as W, useCoreStore as be, RestaurantSelector as fe } from "@feedmepos/mf-common";
6
- import { useSnackbar as le, useDialogChild as _e, useDialog as he, components as ee } from "@feedmepos/ui-library";
7
- import { _ as ye } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
8
- import { _ as Ce } from "./app-DXgWN7R_.js";
9
- import { c as ke } from "./iteration-BoeoXAHD.js";
10
- import { a as we, w as xe, p as Ve } from "./tooltip-CQW9YRO5.js";
11
- import { u as Se } from "./discardConfirm-BHni0LNu.js";
12
- import { _ as Fe } from "./index.vue_vue_type_script_setup_true_lang-BgqsTzLI.js";
13
- function oe(x) {
14
- return x ? ae(x).format("DD/MM/YY HH:mm") : "-";
15
- }
16
- function Ie(x, V, l) {
17
- const c = (r, m = !1) => {
18
- var y;
19
- return r === void 0 && !m ? "-" : ((y = l.find((f) => f.value === (r || null))) == null ? void 0 : y.label) || "-";
20
- };
21
- return x.map((r) => {
22
- var p;
23
- const m = (p = V.find(({ _id: t }) => t === r._id)) == null ? void 0 : p.posVersion, y = !!m && !!ce.Pos.canUse({ feature: de.F_FEATURE.enum.taxAndServiceChargeV4, posVersion: m }), 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: oe(r.updatedAt),
30
- _pickup: y ? c(r.pickupCatalog, !0) : "-",
31
- _canUsePickup: y,
32
- _posVersion: m || "-"
33
- };
34
- });
35
- }
36
- const $e = {
37
- key: 0,
38
- class: "flex items-center justify-center"
39
- }, Ae = {
40
- key: 1,
41
- class: "space-y-16"
42
- }, Me = { class: "text-fm-color-typo-secondary" }, De = { class: "space-y-4" }, Re = /* @__PURE__ */ q({
43
- __name: "RevertDialog",
44
- props: {
45
- restaurant: {}
46
- },
47
- setup(x) {
48
- const V = x, l = le(), { custom: c } = te(l), r = I(!1), m = I(null);
49
- async function y() {
50
- await c(
51
- async () => {
52
- var d;
53
- m.value = await me.readMenuById(((d = V.restaurant.revertConfig) == null ? void 0 : d._id) || "");
54
- },
55
- { isLoading: r }
56
- );
57
- }
58
- const f = S(() => {
59
- var d;
60
- return [
61
- { label: "Main", value: null },
62
- ...(((d = m.value) == null ? void 0 : d.modules.catalog) || []).map((_) => ({
63
- label: _.name,
64
- value: _._id
65
- }))
66
- ];
67
- }), { t: p } = W(), t = S(() => {
68
- var k;
69
- const d = V.restaurant.revertConfig;
70
- if (!d) return [];
71
- const _ = Ie(
72
- [
73
- {
74
- ...d,
75
- catalogId: d.catalogId || null
76
- }
77
- ],
78
- be().restaurants.value,
79
- f.value
80
- )[0];
81
- return [
82
- { label: p("menu.revert.labels.restaurant"), value: V.restaurant.name },
83
- {
84
- label: p("menu.revert.labels.revert_to"),
85
- value: oe((k = m.value) == null ? void 0 : k.updatedAt)
86
- },
87
- { label: p("menu.revert.labels.default"), value: _._default },
88
- { label: p("menu.revert.labels.pos_takeaway"), value: _._posTakeaway },
89
- { label: p("menu.revert.labels.pickup"), value: _._pickup },
90
- {
91
- label: p("menu.revert.labels.additional_catalogs"),
92
- value: _._additionalCatalogs.join(", ")
93
- }
94
- ];
95
- });
96
- ue(async () => y());
97
- const { emitData: R } = _e();
98
- return (d, _) => {
99
- const k = C("FmCircularProgress");
100
- return r.value ? (h(), D("div", $e, [
101
- s(k, { size: "lg" })
102
- ])) : (h(), D("div", Ae, [
103
- o("div", Me, F(i(p)("menu.revert.description", { name: V.restaurant.name })), 1),
104
- o("div", De, [
105
- (h(!0), D(E, null, G(t.value, ($) => (h(), O(we, {
106
- key: $.label,
107
- name: $.label,
108
- value: $.value || "--"
109
- }, null, 8, ["name", "value"]))), 128))
110
- ])
111
- ]));
112
- };
113
- }
114
- }), Ue = { class: "fm-typo-en-title-md-600" }, Le = { class: "mt-40" }, Pe = { class: "fm-typo-en-title-sm-600" }, Be = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mt-4 mb-8" }, Ee = { class: "flex gap-8 items-center justify-start" }, Oe = /* @__PURE__ */ q({
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 } = W(), r = x;
125
- V({
126
- show: _,
127
- hide: k
128
- });
129
- const m = 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 = S(() => [
140
- {
141
- label: c("menu.publish.update_catalog_dialog.sections.default.use_default"),
142
- value: null
143
- },
144
- ...r.catalogs.map((g) => ({
145
- label: g.name,
146
- value: g._id
147
- }))
148
- ]), p = S(() => [
149
- {
150
- label: c("menu.publish.update_catalog_dialog.sections.default.use_default"),
151
- value: null
152
- },
153
- ...r.catalogs.map((g) => ({
154
- label: g.name,
155
- value: g._id
156
- }))
157
- ]), t = I(y()), R = I(!1), d = I(void 0);
158
- function _(g) {
159
- d.value = g ? Z(g) : y(), t.value = Z(d.value), R.value = !0;
160
- }
161
- function k() {
162
- R.value = !1;
163
- }
164
- const $ = Se(
165
- () => !pe.isEqual(d.value, t.value),
166
- () => {
167
- k();
168
- }
169
- );
170
- function T() {
171
- k(), m("onComplete", t.value);
172
- }
173
- return (g, v) => {
174
- const U = C("FmSelect"), N = C("FmCheckbox"), M = C("FmButton"), B = C("FmSideSheet");
175
- return h(), O(B, {
176
- modelValue: R.value,
177
- "onUpdate:modelValue": v[5] || (v[5] = (b) => R.value = b),
178
- "max-width": 560,
179
- "onOn:clickedAway": i($)
180
- }, {
181
- "side-sheet-header": P(() => [
182
- o("span", Ue, F(i(c)("menu.publish.update_catalog_dialog.title")), 1)
183
- ]),
184
- "side-sheet-footer": P(() => [
185
- o("div", Ee, [
186
- s(M, {
187
- label: i(c)("menu.publish.update_catalog_dialog.actions.update"),
188
- size: "lg",
189
- variant: "primary",
190
- onClick: v[4] || (v[4] = () => T())
191
- }, null, 8, ["label"]),
192
- s(M, {
193
- label: i(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: P(() => [
201
- s(U, {
202
- modelValue: t.value.catalogId,
203
- "onUpdate:modelValue": v[0] || (v[0] = (b) => t.value.catalogId = b),
204
- items: f.value,
205
- class: "mb-24",
206
- label: i(c)("menu.publish.update_catalog_dialog.sections.default.label")
207
- }, null, 8, ["modelValue", "items", "label"]),
208
- s(U, {
209
- modelValue: t.value.takeawayCatalog,
210
- "onUpdate:modelValue": v[1] || (v[1] = (b) => t.value.takeawayCatalog = b),
211
- items: p.value,
212
- class: "mb-24",
213
- label: i(c)("menu.publish.update_catalog_dialog.sections.pos_takeaway.label")
214
- }, null, 8, ["modelValue", "items", "label"]),
215
- s(U, {
216
- modelValue: t.value.pickupCatalog,
217
- "onUpdate:modelValue": v[2] || (v[2] = (b) => t.value.pickupCatalog = b),
218
- items: p.value,
219
- label: i(c)("menu.publish.update_catalog_dialog.sections.pickup.label")
220
- }, null, 8, ["modelValue", "items", "label"]),
221
- o("div", Le, [
222
- o("div", Pe, F(i(c)("menu.publish.update_catalog_dialog.sections.additional.title")), 1),
223
- o("div", Be, F(i(c)("menu.publish.update_catalog_dialog.sections.additional.subtitle")), 1),
224
- (h(!0), D(E, null, G(x.catalogs, (b) => (h(), D("div", {
225
- key: b._id
226
- }, [
227
- s(N, {
228
- modelValue: t.value.additionalCatalogs,
229
- "onUpdate:modelValue": v[3] || (v[3] = (w) => t.value.additionalCatalogs = w),
230
- label: b.name,
231
- value: b._id
232
- }, null, 8, ["modelValue", "label", "value"])
233
- ]))), 128))
234
- ])
235
- ]),
236
- _: 1
237
- }, 8, ["modelValue", "onOn:clickedAway"]);
238
- };
239
- }
240
- }), Te = {
241
- class: "flex flex-col p-24 bg-fm-color-neutral-white min-h-[calc(100dvh-56px)] xs:max-h-[calc(100dvh-56px)]"
242
- }, Ne = {
243
- class: "flex items-center xs:mb-8 mb-24"
244
- }, ze = {
245
- class: "mr-8"
246
- }, He = {
247
- class: "fm-typo-en-title-md-600"
248
- }, Ke = {
249
- class: "xs:hidden"
250
- }, je = {
251
- class: "pb-8 flex justify-between xs:flex-col gap-8"
252
- }, Ye = {
253
- class: "grow flex flex-col gap-4"
254
- }, qe = {
255
- class: "flex gap-8 items-center"
256
- }, Ge = {
257
- class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary"
258
- }, We = {
259
- class: "space-y-4"
260
- }, Je = {
261
- class: "fm-typo-en-body-lg-600"
262
- }, Qe = {
263
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
264
- }, Xe = {
265
- class: "flex gap-8"
266
- }, Ze = {
267
- class: "xs:block hidden fixed bottom-72 right-16"
268
- }, Y = 40, ma = /* @__PURE__ */ q({
269
- __name: "Publish",
270
- setup(x) {
271
- const V = re(), {
272
- t: l
273
- } = W(), c = (e) => t.state.menu.updatedAt === e.updatedAt, r = ({
274
- row: e
275
- }) => {
276
- const a = c(e);
277
- return s(ye, {
278
- label: l(a ? "menu.publish.table.status.latest" : "menu.publish.table.status.outdated"),
279
- variant: a ? "success" : "warning"
280
- }, null);
281
- }, m = I({}), y = [{
282
- accessorKey: "name",
283
- header: () => l("menu.publish.table.columns.restaurant"),
284
- cell: (e) => e.getValue(),
285
- enableSorting: !0
286
- }, {
287
- accessorKey: "catalog",
288
- header: () => l("menu.publish.table.columns.default"),
289
- enableSorting: !1,
290
- cell: (e) => e.getValue().default
291
- }, {
292
- accessorKey: "catalog",
293
- header: () => l("menu.publish.table.columns.pos_takeaway"),
294
- enableSorting: !1,
295
- cell: (e) => e.getValue().takeaway
296
- }, {
297
- accessorKey: "catalog",
298
- header: () => l("menu.publish.table.columns.pickup"),
299
- enableSorting: !1,
300
- cell: (e) => e.getValue().pickup
301
- }, {
302
- accessorKey: "updatedAt",
303
- header: () => l("menu.publish.table.columns.version"),
304
- enableSorting: !1,
305
- cell: (e) => {
306
- const a = e.getValue();
307
- return $(a);
308
- }
309
- }, {
310
- accessorKey: "status",
311
- header: () => l("menu.common.labels.status"),
312
- enableSorting: !1,
313
- cell: (e) => s(r, {
314
- row: e.row.original
315
- }, null)
316
- }, {
317
- accessorKey: "_id",
318
- header: "",
319
- size: 52,
320
- enableSorting: !1,
321
- cell: (e) => {
322
- const a = e.row.original;
323
- return t.state.menu.updatedAt, a.updatedAt, j("div", {
324
- class: "flex justify-end gap-8"
325
- }, [d.value && a.revertConfig ? xe(j(ee.FmButton, {
326
- prependIcon: "undo",
327
- variant: "secondary",
328
- onClick: H(async () => {
329
- await _(e.row.original);
330
- }, ["stop", "prevent"])
331
- }), l("menu.publish.actions.revert")) : null, j(ee.FmButton, {
332
- label: l("menu.publish.actions.publish"),
333
- icon: "ios_share",
334
- variant: "secondary",
335
- onClick: H(async () => {
336
- const u = U(e.row.original);
337
- await B(u);
338
- }, ["stop", "prevent"])
339
- })]);
340
- },
341
- meta: {
342
- width: "150px"
343
- }
344
- }], f = I(""), p = I(), t = ge(), R = he(), d = S(() => t.version !== ve.F_MENU_VERSION.enum.v3);
345
- async function _(e) {
346
- e.revertConfig && R.open({
347
- title: "Revert menu",
348
- contentComponent: Re,
349
- contentComponentProps: {
350
- restaurant: e
351
- },
352
- primaryActions: {
353
- text: "Revert",
354
- close: !0
355
- },
356
- secondaryActions: {
357
- text: "Cancel",
358
- close: !0
359
- }
360
- }).onPrimary(async () => {
361
- await M.minor(async () => {
362
- await t.revertRestaurantMenu(e._id);
363
- }, {
364
- customId: e._id,
365
- message: `Revert menu of ${e.name}`
366
- });
367
- });
368
- }
369
- const k = S(() => l("menu.publish.labels.main_version", {
370
- version: $(t.state.menu.updatedAt)
371
- }));
372
- function $(e) {
373
- return e ? ae(e).format("DD/MM/YYYY hh:mmA") : "";
374
- }
375
- const T = S(() => t.state.menu.modules.catalog), g = S(() => M.queue.value.some((e) => e.id === t.state.menu._id));
376
- function v(e) {
377
- var a;
378
- return e ? ((a = T.value.find((u) => u._id === e)) == null ? void 0 : a.name) ?? l("menu.publish.labels.catalog.invalid") : l("menu.publish.labels.catalog.main");
379
- }
380
- function U(e) {
381
- return {
382
- restaurantId: e._id,
383
- catalogId: e.catalogId,
384
- takeawayCatalog: e.takeawayCatalog,
385
- pickupCatalog: e.pickupCatalog || null,
386
- additionalCatalogs: e.additionalCatalogs
387
- };
388
- }
389
- function N(e) {
390
- var u;
391
- const a = U(e);
392
- (u = p.value) == null || u.show(a);
393
- }
394
- const M = te(le());
395
- async function B(e) {
396
- var u;
397
- const a = (u = w.value.find((L) => L._id === e.restaurantId)) == null ? void 0 : u.name;
398
- await M.minor(async () => await t.publishMenu(e), {
399
- customId: t.state.menu._id,
400
- message: `Publishing menu for ${a}`,
401
- successMessage: `Published to ${a}`
402
- });
403
- }
404
- const b = I(null), w = S(() => t.state.restaurants.filter((e) => {
405
- var a;
406
- return !b.value || ((a = b.value) == null ? void 0 : a.includes(e._id));
407
- }).map((e) => ({
408
- ...e,
409
- catalog: {
410
- default: v(e.catalogId),
411
- takeaway: v(e.takeawayCatalog),
412
- pickup: v(e.pickupCatalog)
413
- }
414
- }))), se = S(() => {
415
- const e = f.value.toLowerCase();
416
- return w.value.filter(({
417
- name: a,
418
- catalog: u
419
- }) => a.toLowerCase().includes(e) || u.default.toLowerCase().includes(e) || u.takeaway.toLowerCase().includes(e) || u.pickup.toLowerCase().includes(e));
420
- });
421
- async function J(e) {
422
- const a = e.map((A) => A._id), u = ke(a, Y), L = I("");
423
- await M.minor(async () => {
424
- await Ve({
425
- items: u,
426
- processor: async (A) => await t.publishMultipleMenu(A, !1),
427
- batchSize: 1,
428
- batchDelay: 50,
429
- // 50ms delay to reduce server load
430
- onProgress({
431
- total: A,
432
- batchStart: z,
433
- batchEnd: X
434
- }) {
435
- const K = (z - 1) * Y;
436
- L.value = `Processed ${K} of ${e.length} restaurants`;
437
- }
438
- }), await t.readRestaurants(), await t.readMenu();
439
- }, {
440
- customId: t.state.menu._id,
441
- message: "Publishing menu",
442
- caption: L,
443
- successMessage: `Published to ${e.length} restaurant${e.length > 1 ? "s" : ""}`
444
- });
445
- }
446
- async function Q() {
447
- if (g.value) return;
448
- const e = Object.keys(m.value).map(Number).filter((u) => m.value[u]), a = e.length === 0 || e.length === w.value.length ? w.value : e.map((u) => w.value[u]);
449
- a.length > Y ? await J(a) : e.length === 0 || e.length === w.value.length ? await M.minor(async () => await t.publishAllMenu(), {
450
- customId: t.state.menu._id
451
- }) : await J(a);
452
- }
453
- return (e, a) => {
454
- const u = C("FmChip"), L = C("FmSpacer"), A = C("FmButton"), z = C("FmSearch"), X = C("FmTable"), K = C("FmListItem"), ne = C("FmList");
455
- return h(), D(E, null, [o("div", Te, [o("div", Ne, [o("div", ze, [o("div", He, F(i(l)("menu.publish.title")), 1), a[7] || (a[7] = o("div", {
456
- class: "hidden xs:block fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
457
- }, null, -1))]), s(u, {
458
- label: k.value,
459
- class: "xs:hidden text-fm-color-primary bg-fm-color-system-warning-100"
460
- }, null, 8, ["label"]), s(L), o("div", Ke, [s(A, {
461
- disabled: g.value,
462
- icon: "ios_share",
463
- label: i(l)("menu.publish.actions.publish_all"),
464
- variant: "primary",
465
- onClick: a[0] || (a[0] = () => Q())
466
- }, null, 8, ["disabled", "label"])])]), o("div", je, [s(i(fe), {
467
- multiple: "",
468
- modelValue: b.value,
469
- "onUpdate:modelValue": a[2] || (a[2] = (n) => b.value = n)
470
- }, {
471
- "append-right": P(() => [s(L, {
472
- class: "xs:hidden"
473
- }), s(z, {
474
- modelValue: f.value,
475
- "onUpdate:modelValue": a[1] || (a[1] = (n) => f.value = n),
476
- autofocus: "",
477
- class: "w-[320px] xs:hidden",
478
- placeholder: i(l)("menu.publish.table.search.placeholder")
479
- }, null, 8, ["modelValue", "placeholder"])]),
480
- _: 1
481
- }, 8, ["modelValue"]), s(z, {
482
- modelValue: f.value,
483
- "onUpdate:modelValue": a[3] || (a[3] = (n) => f.value = n),
484
- autofocus: "",
485
- class: "w-full xs:block hidden",
486
- placeholder: i(l)("menu.publish.table.search.placeholder")
487
- }, null, 8, ["modelValue", "placeholder"])]), w.value.length > 0 ? (h(), D(E, {
488
- key: 0
489
- }, [s(Ce, {
490
- class: "xs:hidden block"
491
- }, {
492
- default: P(() => [s(X, {
493
- modelValue: m.value,
494
- "onUpdate:modelValue": a[4] || (a[4] = (n) => m.value = n),
495
- "column-defs": y,
496
- loading: g.value,
497
- "page-size": w.value.length,
498
- "row-data": w.value,
499
- "search-value": f.value,
500
- shrinkAt: !1,
501
- virtual: !0,
502
- selection: "multiple",
503
- "hide-footer": "",
504
- "pin-header-row": "",
505
- onRowClick: a[5] || (a[5] = (n) => N(n.original))
506
- }, null, 8, ["modelValue", "loading", "page-size", "row-data", "search-value"])]),
507
- _: 1
508
- }), s(ne, {
509
- class: "flex-col flex-1 min-h-0 overflow-auto xs:flex hidden w-full pb-64",
510
- separator: ""
511
- }, {
512
- default: P(() => [(h(!0), D(E, null, G(se.value, (n) => (h(), O(K, {
513
- key: n._id,
514
- label: n.name,
515
- style: {
516
- padding: "12px 0 !important"
517
- },
518
- onClick: () => N(n)
519
- }, {
520
- default: P(() => [o("div", Ye, [o("div", qe, [o("div", Ge, F($(n.updatedAt)), 1), s(r, {
521
- row: n
522
- }, null, 8, ["row"])]), o("div", We, [o("div", Je, F(n.name), 1), o("div", Qe, [o("div", null, "Default: " + F(n.catalog.default), 1), o("div", null, "POS takeaway: " + F(n.catalog.takeaway), 1), o("div", null, "Pickup: " + F(n.catalog.pickup), 1)])])]), o("div", Xe, [d.value && n.revertConfig ? (h(), O(A, {
523
- key: 0,
524
- disabled: g.value,
525
- icon: "undo",
526
- variant: "tertiary",
527
- onClick: H(() => _(n), ["stop"])
528
- }, null, 8, ["disabled", "onClick"])) : ie("", !0), s(A, {
529
- disabled: g.value,
530
- icon: "ios_share",
531
- variant: "tertiary",
532
- onClick: H(() => B(U(n)), ["stop"])
533
- }, null, 8, ["disabled", "onClick"])])]),
534
- _: 2
535
- }, 1032, ["label", "onClick"]))), 128))]),
536
- _: 1
537
- })], 64)) : (h(), O(i(Fe), {
538
- key: 1,
539
- title: i(l)("menu.publish.empty.title"),
540
- subtitle: i(l)("menu.publish.empty.subtitle"),
541
- action: {
542
- text: i(l)("menu.publish.empty.action"),
543
- icon: "add",
544
- callback: () => {
545
- i(V).push({
546
- name: "$settings-my-business"
547
- });
548
- }
549
- }
550
- }, null, 8, ["title", "subtitle", "action"]))]), o("div", Ze, [s(A, {
551
- disabled: g.value,
552
- icon: "ios_share",
553
- label: i(l)("menu.publish.actions.publish_all"),
554
- variant: "fab",
555
- onClick: a[6] || (a[6] = () => Q())
556
- }, null, 8, ["disabled", "label"])]), s(Oe, {
557
- ref_key: "updateCatalogDialogRef",
558
- ref: p,
559
- catalogs: T.value,
560
- onOnComplete: B
561
- }, null, 8, ["catalogs"])], 64);
562
- };
563
- }
564
- });
565
- export {
566
- ma as default
567
- };