@feedmepos/mf-menu 0.18.17 → 0.19.0-beta.2

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 (90) hide show
  1. package/dist/ApplyProduct.vue_vue_type_script_setup_true_lang-DFJJHptK.js +158 -0
  2. package/dist/{ApplyProducts.vue_vue_type_script_setup_true_lang-BJ0b_uKf.js → ApplyProducts.vue_vue_type_script_setup_true_lang-CXoRwrTi.js} +2 -2
  3. package/dist/Catalog-CXzqtCF8.js +551 -0
  4. package/dist/Category-DKbtLbq8.js +387 -0
  5. package/dist/CookingGuide-BKon8TdH.js +862 -0
  6. package/dist/Group-D1UDksBG.js +46 -0
  7. package/dist/{Group-jEtbECLb.js → Group-izOWb_Bh.js} +1 -1
  8. package/dist/Group.vue_vue_type_script_setup_true_lang-DAlQcgYp.js +558 -0
  9. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Q7es2wmt.js +237 -0
  10. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Bw4uxqAp.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Db0uYw5O.js} +11723 -11723
  11. package/dist/Ingredient-BIJu9P_9.js +484 -0
  12. package/dist/LinkProductSideSheet-BNdFZThd.js +104 -0
  13. package/dist/PrintRoute--fYPFcy7.js +417 -0
  14. package/dist/{Product-Bnr9oFr2.js → Product-vLtISbkD.js} +1 -1
  15. package/dist/Product.vue_vue_type_script_setup_true_lang-BHCihe6o.js +826 -0
  16. package/dist/Products-JaCNtcHS.js +236 -0
  17. package/dist/Publish-jpmiyB-b.js +525 -0
  18. package/dist/Recipe-B6y-oLPG.js +320 -0
  19. package/dist/Scheduler-Dj1rlr-U.js +222 -0
  20. package/dist/SchedulerSelector.vue_vue_type_script_setup_true_lang-BVAkohGJ.js +48 -0
  21. package/dist/ServingSequence-BhIfCyXl.js +4 -0
  22. package/dist/{Setting-DN8TQdIR.js → Setting-B5R1JfaL.js} +1 -1
  23. package/dist/Setting.vue_vue_type_script_setup_true_lang-xXtg0JOn.js +253 -0
  24. package/dist/Takeaway-BSFSz_JL.js +63 -0
  25. package/dist/{Takeaway-y0Nk0JAb.js → Takeaway-DjFTtbw6.js} +1 -1
  26. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-BUGL0wfZ.js +302 -0
  27. package/dist/TaxSetting-D9Q8XNgJ.js +25 -0
  28. package/dist/Unit-Cr_8O3zB.js +142 -0
  29. package/dist/Variant-loUMfNRB.js +222 -0
  30. package/dist/_id_-0w7KjYyQ.js +189 -0
  31. package/dist/{app-D7e31gIv.js → app-t9ONnc0s.js} +31701 -26207
  32. package/dist/app.js +7 -6
  33. package/dist/apps/mf-menu/src/app.d.ts +2784 -0
  34. package/dist/apps/mf-menu/src/components/feature/Fields/OrderFrom.vue.d.ts +2 -2
  35. package/dist/apps/mf-menu/src/components/feature/LinkProduct/LinkProductSideSheet.vue.d.ts +2 -2
  36. package/dist/apps/mf-menu/src/manager/menu/catalog.d.ts +1 -0
  37. package/dist/apps/mf-menu/src/stores/manager/item.d.ts +1 -1
  38. package/dist/apps/mf-menu/src/stores/menu.d.ts +16 -16
  39. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +12 -12
  40. package/dist/apps/mf-menu/src/views/Scheduler/FilterForm.vue.d.ts +4 -4
  41. package/dist/apps/mf-menu/src/views/Scheduler/SchedulerDialog.vue.d.ts +4 -4
  42. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  43. package/dist/assets/{linked-status-D5tq3eE2.js → linked-status-DLL4aRiX.js} +8 -8
  44. package/dist/assets/{validate-menu-AcCpPyQZ.js → validate-menu-CoXc16jh.js} +8 -8
  45. package/dist/{catalog-Ck7lLTN2.js → catalog-4OmC0JA3.js} +66 -62
  46. package/dist/category-BE33DRqp.js +155 -0
  47. package/dist/{currency-CclA5a-2.js → currency-JHgYNbTQ.js} +1 -1
  48. package/dist/{index-DDd9B_ur.js → index-CE3zjhyh.js} +732 -740
  49. package/dist/index-pSg9p-28.js +238 -0
  50. package/dist/item-CEPx51U1.js +6371 -0
  51. package/dist/{lodash-BIQx_fko.js → lodash-VivR_BQ2.js} +1 -1
  52. package/dist/{menu-CYzbNubv.js → menu-ETQrtbbU.js} +1 -1
  53. package/dist/{object-DUtbNpoS.js → object-DEM5FMTB.js} +4 -4
  54. package/dist/scheduler-SRT_5Nio.js +491 -0
  55. package/dist/string-DpfFixWH.js +4 -0
  56. package/dist/style.css +1 -1
  57. package/dist/takeaway-RcvqKigG.js +267 -0
  58. package/dist/{toExcel-BXPcj8Gp.js → toExcel-BcgskY3F.js} +2 -2
  59. package/dist/unit-DLL7xIF1.js +350 -0
  60. package/package.json +4 -2
  61. package/dist/ApplyProduct.vue_vue_type_script_setup_true_lang-D9QsJ4vO.js +0 -155
  62. package/dist/Catalog-CZW54QJU.js +0 -570
  63. package/dist/Category-DvsP_L7d.js +0 -405
  64. package/dist/CookingGuide-DC3uXetk.js +0 -848
  65. package/dist/Group-DK5xqeYX.js +0 -44
  66. package/dist/Group.vue_vue_type_script_setup_true_lang-DGZ9hnPg.js +0 -538
  67. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BQXqlXw4.js +0 -234
  68. package/dist/Ingredient-354LLwdX.js +0 -498
  69. package/dist/LinkProductSideSheet-anxSsu0z.js +0 -102
  70. package/dist/PrintRoute-DrSvtNLX.js +0 -425
  71. package/dist/Product.vue_vue_type_script_setup_true_lang-bBY54Q_1.js +0 -815
  72. package/dist/Products-CZyueqSO.js +0 -234
  73. package/dist/Publish-kRM1UuPk.js +0 -518
  74. package/dist/Recipe-nKpLIJs8.js +0 -345
  75. package/dist/Scheduler-DmZ8atXG.js +0 -233
  76. package/dist/SchedulerSelector.vue_vue_type_script_setup_true_lang-CdsxA-p0.js +0 -48
  77. package/dist/ServingSequence-j00_ko5R.js +0 -4
  78. package/dist/Setting.vue_vue_type_script_setup_true_lang-Cx06MCJs.js +0 -247
  79. package/dist/Takeaway-BXZXCAaM.js +0 -61
  80. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-9WVkdLZF.js +0 -316
  81. package/dist/TaxSetting-DdHx7ACN.js +0 -21
  82. package/dist/Unit-biPvleyL.js +0 -161
  83. package/dist/Variant-BP1IRNQx.js +0 -231
  84. package/dist/_id_-BiaNDI2N.js +0 -188
  85. package/dist/category-KiA5-36F.js +0 -154
  86. package/dist/index-BFeZlU8X.js +0 -232
  87. package/dist/item-Bcg7SiYv.js +0 -6325
  88. package/dist/scheduler-D1tgE0_9.js +0 -480
  89. package/dist/takeaway-BKsoD4EL.js +0 -264
  90. package/dist/unit-CswFvAyc.js +0 -346
@@ -0,0 +1,862 @@
1
+ import { defineComponent as le, ref as h, computed as w, resolveComponent as x, openBlock as g, createBlock as P, unref as t, withCtx as c, createElementVNode as a, createVNode as i, toDisplayString as V, createElementBlock as $, Fragment as z, renderList as q, createTextVNode as be, withModifiers as se, createCommentVNode as ce, h as R } from "vue";
2
+ import { n as ie, d as Z, b as ee, h as ue, u as ye, i as ke, a as he, _ as xe, f as Ce, k as we, j as Ve } from "./app-t9ONnc0s.js";
3
+ import { components as de, useSnackbar as Fe, useDialog as Se } from "@feedmepos/ui-library";
4
+ import { V as $e } from "./vuedraggable-WU01qJgi.js";
5
+ import { _ as Ie } from "./ApplyProducts.vue_vue_type_script_setup_true_lang-CXoRwrTi.js";
6
+ import "@feedmepos/mf-common";
7
+ import { _ as X } from "./FormSection.vue_vue_type_script_setup_true_lang-BWJUD8NZ.js";
8
+ import { u as me, l as pe } from "./lodash-VivR_BQ2.js";
9
+ const Oe = { class: "flex items-center gap-8" }, De = { class: "grow" }, Ne = { class: "space-y-32" }, Le = { class: "flex bg-fm-color-neutral-gray-100 border-b border-b-fm-color-neutral-gray-200" }, Ue = { class: "px-16 py-8 w-[40%]" }, Ge = { class: "px-16 py-8 grow" }, Ke = { class: "flex items-center border-b border-b-fm-color-neutral-gray-100" }, Be = { class: "px-16 py-8 w-[40%]" }, Ee = { class: "px-16 py-8 grow" }, Me = { class: "space-y-16" }, ze = { class: "flex flex-wrap gap-8 overflow-hidden mb-8" }, Te = { class: "flex gap-8 items-center justify-start" }, Re = /* @__PURE__ */ le({
10
+ __name: "CookingGuideStepDialog",
11
+ emits: ["onComplete"],
12
+ setup(U, { expose: r, emit: j }) {
13
+ const { t: d } = ie();
14
+ r({
15
+ show: u,
16
+ hide: I
17
+ });
18
+ const G = j;
19
+ function L() {
20
+ return {
21
+ id: "",
22
+ variables: {},
23
+ instruction: ""
24
+ };
25
+ }
26
+ const k = h(!1), B = h(!1), D = h(void 0);
27
+ function u(f) {
28
+ B.value = !!f, D.value = f ? Z(f) : L(), m.value = Z(D.value), C.value = Object.entries(m.value.variables).map(
29
+ ([l, y]) => ({ key: l, value: y })
30
+ ), k.value = !0;
31
+ }
32
+ function I() {
33
+ k.value = !1;
34
+ }
35
+ const m = h(L()), C = h([]);
36
+ function Y() {
37
+ C.value.push({ key: "", value: "" });
38
+ }
39
+ function A(f) {
40
+ C.value.splice(f, 1);
41
+ }
42
+ function K(f) {
43
+ m.value = {
44
+ ...m.value,
45
+ instruction: `${m.value.instruction}{{${f}}}`
46
+ };
47
+ }
48
+ const b = w(() => C.value.reduce(
49
+ (f, { key: l }) => (l && f.every((y) => y.label !== l) && f.push({
50
+ label: l
51
+ }), f),
52
+ []
53
+ )), n = w(() => B.value ? d("menu.cooking_guide.step_dialog.update.title") : d("menu.cooking_guide.step_dialog.add.title")), s = w(() => B.value ? d("menu.cooking_guide.step_dialog.update.action") : d("menu.cooking_guide.step_dialog.add.action"));
54
+ h();
55
+ const N = me(
56
+ () => !pe.isEqual(
57
+ {
58
+ ...m.value,
59
+ variables: C.value.reduce((f, { key: l, value: y }) => ({ ...f, [l]: y }), {})
60
+ },
61
+ D.value
62
+ ),
63
+ () => {
64
+ k.value = !1;
65
+ }
66
+ );
67
+ function E() {
68
+ I(), G("onComplete", {
69
+ ...m.value,
70
+ variables: C.value.reduce((f, { key: l, value: y }) => ({ ...f, [l]: y }), {})
71
+ });
72
+ }
73
+ return (f, l) => {
74
+ const y = x("FmButton"), _ = x("FmTextField"), J = x("FmChip"), oe = x("FmTextarea"), Q = x("FmSideSheet");
75
+ return g(), P(Q, {
76
+ modelValue: k.value,
77
+ "onUpdate:modelValue": l[1] || (l[1] = (M) => k.value = M),
78
+ closeButton: !1,
79
+ header: n.value,
80
+ "max-width": 560,
81
+ "is-container": t(de).FmForm,
82
+ "is-container-props": {
83
+ onValidationSuccess: E,
84
+ blameFormChildOnValidationFailed: !0,
85
+ class: "flex flex-col h-full"
86
+ },
87
+ "onOn:clickedAway": t(N)
88
+ }, {
89
+ "side-sheet-header": c(() => [
90
+ a("div", Oe, [
91
+ i(y, {
92
+ icon: "arrow_back",
93
+ variant: "tertiary",
94
+ label: t(d)("menu.cooking_guide.step_dialog.actions.back"),
95
+ onClick: I
96
+ }, null, 8, ["label"]),
97
+ a("div", De, V(n.value), 1)
98
+ ])
99
+ ]),
100
+ "side-sheet-footer": c(() => [
101
+ a("div", Te, [
102
+ i(y, {
103
+ label: s.value,
104
+ size: "lg",
105
+ variant: "primary",
106
+ type: "submit"
107
+ }, null, 8, ["label"]),
108
+ i(y, {
109
+ label: t(d)("menu.cooking_guide.step_dialog.actions.cancel"),
110
+ size: "lg",
111
+ variant: "tertiary",
112
+ onClick: I
113
+ }, null, 8, ["label"])
114
+ ])
115
+ ]),
116
+ default: c(() => [
117
+ a("div", Ne, [
118
+ i(X, {
119
+ title: t(d)("menu.cooking_guide.step_dialog.sections.variables.title")
120
+ }, {
121
+ "append-title": c(() => [
122
+ i(y, {
123
+ icon: "add",
124
+ label: t(d)("menu.cooking_guide.step_dialog.sections.variables.add"),
125
+ variant: "secondary",
126
+ "text-color": "primary",
127
+ "border-color": "primary",
128
+ onClick: Y
129
+ }, null, 8, ["label"])
130
+ ]),
131
+ default: c(() => [
132
+ a("div", null, [
133
+ a("div", Le, [
134
+ a("div", Ue, V(t(d)("menu.cooking_guide.step_dialog.sections.variables.columns.key")), 1),
135
+ a("div", Ge, V(t(d)("menu.cooking_guide.step_dialog.sections.variables.columns.value")), 1)
136
+ ]),
137
+ (g(!0), $(z, null, q(C.value, (M, T) => (g(), $("div", Ke, [
138
+ a("div", Be, [
139
+ i(_, {
140
+ modelValue: C.value[T].key,
141
+ "onUpdate:modelValue": (O) => C.value[T].key = O,
142
+ rules: [
143
+ (O) => !!O || t(d)("menu.cooking_guide.step_dialog.sections.variables.validation.required"),
144
+ (O) => !O || /^[a-z]+$/.test(O) || t(d)("menu.cooking_guide.step_dialog.sections.variables.validation.lowercase"),
145
+ (O) => !O || C.value.findIndex((ae) => ae.key === O) === T || t(d)("menu.cooking_guide.step_dialog.sections.variables.validation.duplicate")
146
+ ],
147
+ placeholder: t(d)("menu.cooking_guide.step_dialog.sections.variables.placeholders.key")
148
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "rules", "placeholder"])
149
+ ]),
150
+ a("div", Ee, [
151
+ i(_, {
152
+ modelValue: C.value[T].value,
153
+ "onUpdate:modelValue": (O) => C.value[T].value = O,
154
+ rules: [
155
+ (O) => !!O || t(d)("menu.cooking_guide.step_dialog.sections.variables.validation.required")
156
+ ],
157
+ placeholder: t(d)("menu.cooking_guide.step_dialog.sections.variables.placeholders.value")
158
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "rules", "placeholder"])
159
+ ]),
160
+ i(y, {
161
+ icon: "delete",
162
+ variant: "tertiary",
163
+ "text-color": "neutral-gray-400",
164
+ onClick: () => A(T)
165
+ }, null, 8, ["onClick"])
166
+ ]))), 256))
167
+ ])
168
+ ]),
169
+ _: 1
170
+ }, 8, ["title"]),
171
+ i(X, {
172
+ title: t(d)("menu.cooking_guide.step_dialog.sections.instruction.title")
173
+ }, {
174
+ default: c(() => [
175
+ a("div", Me, [
176
+ a("div", ze, [
177
+ (g(!0), $(z, null, q(b.value, (M) => (g(), P(J, {
178
+ key: M.label,
179
+ label: M.label,
180
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
181
+ onClick: () => K(M.label)
182
+ }, null, 8, ["label", "onClick"]))), 128))
183
+ ]),
184
+ i(oe, {
185
+ modelValue: m.value.instruction,
186
+ "onUpdate:modelValue": l[0] || (l[0] = (M) => m.value.instruction = M)
187
+ }, null, 8, ["modelValue"])
188
+ ])
189
+ ]),
190
+ _: 1
191
+ }, 8, ["title"])
192
+ ])
193
+ ]),
194
+ _: 1
195
+ }, 8, ["modelValue", "header", "is-container", "is-container-props", "onOn:clickedAway"]);
196
+ };
197
+ }
198
+ }), Ae = { class: "w-[700px]" }, Pe = { class: "flex bg-fm-color-neutral-gray-100" }, qe = { class: "px-16 py-8 grow" }, je = { class: "px-16 py-8 w-[200px]" }, Ye = { class: "px-16 py-8 w-[200px]" }, He = { class: "px-16 py-8 grow" }, Je = { class: "px-16 py-8 w-[200px] flex flex-col gap-8" }, Qe = { class: "px-16 py-8 w-[200px] flex flex-col gap-8" }, We = /* @__PURE__ */ le({
199
+ __name: "CookingGuideStepOverrideDialog",
200
+ emits: ["onComplete"],
201
+ setup(U, { expose: r, emit: j }) {
202
+ const { t: d } = ie();
203
+ r({
204
+ show: u,
205
+ hide: I
206
+ });
207
+ const G = j;
208
+ function L() {
209
+ return {
210
+ productId: "",
211
+ overrides: []
212
+ };
213
+ }
214
+ const k = h(!1), B = h(""), D = h([]);
215
+ function u(b) {
216
+ B.value = b.itemName, D.value = b.steps, m.value = b.bindings ? Z(b.bindings) : L(), k.value = !0;
217
+ }
218
+ function I() {
219
+ k.value = !1;
220
+ }
221
+ const m = h(L()), C = w(() => m.value.overrides.reduce((b, n) => (b[n.id] = n, b), {}));
222
+ function Y(b, n) {
223
+ var s;
224
+ return ((s = C.value[b]) == null ? void 0 : s.variables[n]) ?? "";
225
+ }
226
+ function A(b, n, s) {
227
+ const N = m.value.overrides.findIndex((E) => E.id === b);
228
+ s ? N < 0 ? m.value.overrides.push({
229
+ id: b,
230
+ variables: { [n]: s }
231
+ }) : m.value.overrides[N].variables[n] = s : N >= 0 && (delete m.value.overrides[N].variables[n], Object.keys(m.value.overrides[N].variables).length || m.value.overrides.splice(N, 1));
232
+ }
233
+ function K() {
234
+ I(), G("onComplete", m.value);
235
+ }
236
+ return (b, n) => {
237
+ const s = x("FmTextField"), N = x("FmSpacer"), E = x("FmButton"), f = x("FmDialog");
238
+ return g(), P(f, {
239
+ modelValue: k.value,
240
+ "onUpdate:modelValue": n[0] || (n[0] = (l) => k.value = l),
241
+ overlay: !0,
242
+ contentClass: "test",
243
+ "min-width": "min(calc(100% - 48px), 748px)"
244
+ }, {
245
+ "dialog-header": c(() => [
246
+ a("div", null, V(t(d)("menu.cooking_guide.step_override_dialog.title")), 1)
247
+ ]),
248
+ "dialog-footer": c(() => [
249
+ i(N),
250
+ i(E, {
251
+ class: "sm:w-full xs:w-full",
252
+ label: t(d)("menu.cooking_guide.step_override_dialog.actions.cancel"),
253
+ size: "md",
254
+ variant: "tertiary",
255
+ onClick: I
256
+ }, null, 8, ["label"]),
257
+ i(E, {
258
+ class: "sm:w-full xs:w-full",
259
+ label: t(d)("menu.cooking_guide.step_override_dialog.actions.save"),
260
+ size: "md",
261
+ variant: "primary",
262
+ onClick: K
263
+ }, null, 8, ["label"])
264
+ ]),
265
+ default: c(() => [
266
+ a("div", Ae, [
267
+ a("div", Pe, [
268
+ a("div", qe, V(t(d)("menu.cooking_guide.step_override_dialog.columns.instructions")), 1),
269
+ a("div", je, V(t(d)("menu.cooking_guide.step_override_dialog.columns.variables")), 1),
270
+ a("div", Ye, V(t(d)("menu.cooking_guide.step_override_dialog.columns.value")), 1)
271
+ ]),
272
+ (g(!0), $(z, null, q(D.value, (l) => (g(), $("div", {
273
+ key: l.id,
274
+ class: "flex border-t-2"
275
+ }, [
276
+ a("div", He, V(l.instruction), 1),
277
+ a("div", Je, [
278
+ (g(!0), $(z, null, q(l.variables, (y, _) => (g(), $("div", {
279
+ key: _,
280
+ class: "py-8 w-full text-ellipsis overflow-hidden whitespace-nowrap"
281
+ }, V(_), 1))), 128))
282
+ ]),
283
+ a("div", Qe, [
284
+ (g(!0), $(z, null, q(l.variables, (y, _) => (g(), $("div", { key: _ }, [
285
+ i(s, {
286
+ "model-value": Y(l.id, _.toString()),
287
+ placeholder: y,
288
+ "onUpdate:modelValue": (J) => A(l.id, _.toString(), J)
289
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
290
+ ]))), 128))
291
+ ])
292
+ ]))), 128))
293
+ ])
294
+ ]),
295
+ _: 1
296
+ }, 8, ["modelValue"]);
297
+ };
298
+ }
299
+ }), Xe = { class: "fm-typo-en-title-md-600" }, Ze = { class: "space-y-24" }, eo = { class: "flex items-center" }, oo = { class: "flex-1" }, no = { class: "flex items-center gap-8" }, to = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, lo = { class: "flex-1" }, io = { class: "bg-fm-color-neutral-gray-100 px-16 py-8" }, ao = { class: "flex" }, so = { class: "px-16 py-8 flex-1" }, uo = { class: "px-16 py-8 flex gap-8" }, ro = { class: "flex gap-8 items-center justify-start" }, co = /* @__PURE__ */ le({
300
+ __name: "CookingGuideDialog",
301
+ props: {
302
+ categorizedItems: {
303
+ type: Array,
304
+ required: !0
305
+ },
306
+ canApplyItems: {
307
+ type: Boolean,
308
+ default: !0
309
+ }
310
+ },
311
+ emits: ["onSave"],
312
+ setup(U, { expose: r, emit: j }) {
313
+ const d = U;
314
+ r({
315
+ showModal: B,
316
+ hideModal: D
317
+ });
318
+ function G() {
319
+ return {
320
+ _id: "",
321
+ name: "",
322
+ bindings: [],
323
+ steps: []
324
+ };
325
+ }
326
+ const L = h(!1), k = h(void 0);
327
+ function B(e) {
328
+ k.value = e ? Z(e) : G(), u.value = Z(k.value), L.value = !0;
329
+ }
330
+ function D() {
331
+ L.value = !1;
332
+ }
333
+ const u = h(G()), I = h();
334
+ function m() {
335
+ var e;
336
+ (e = I.value) == null || e.show();
337
+ }
338
+ function C(e) {
339
+ var o;
340
+ (o = I.value) == null || o.show(e);
341
+ }
342
+ function Y(e) {
343
+ u.value.steps.splice(e, 1);
344
+ }
345
+ function A(e) {
346
+ if (!e.id)
347
+ u.value.steps.push({ ...e, id: (/* @__PURE__ */ new Date()).toISOString() });
348
+ else {
349
+ const o = u.value.steps.findIndex(({ id: p }) => e.id === p);
350
+ o >= 0 && u.value.steps.splice(o, 1, e);
351
+ }
352
+ }
353
+ function K(e) {
354
+ u.value = {
355
+ ...u.value,
356
+ bindings: e
357
+ };
358
+ }
359
+ function b(e, o) {
360
+ return u.value.bindings.find(
361
+ (v) => v.productId === e && v.combinationKey == o
362
+ );
363
+ }
364
+ function n(e) {
365
+ const o = Object.entries(e).reduce(
366
+ (p, [v, F]) => {
367
+ var H;
368
+ return p = F.length > 0 ? [
369
+ ...p,
370
+ ...F.map((ne) => {
371
+ var te;
372
+ return {
373
+ productId: v,
374
+ combinationKey: ne,
375
+ overrides: ((te = b(v, ne)) == null ? void 0 : te.overrides) ?? []
376
+ };
377
+ })
378
+ ] : [
379
+ ...p,
380
+ {
381
+ productId: v,
382
+ overrides: ((H = b(v)) == null ? void 0 : H.overrides) ?? []
383
+ }
384
+ ], p;
385
+ },
386
+ []
387
+ );
388
+ K(o);
389
+ }
390
+ const s = h();
391
+ function N(e) {
392
+ var o;
393
+ (o = s.value) == null || o.show({
394
+ itemName: e.itemName,
395
+ steps: u.value.steps,
396
+ bindings: b(e.itemId, e.combinationKey)
397
+ });
398
+ }
399
+ function E({ productId: e, combinationKey: o, overrides: p }) {
400
+ const v = u.value.bindings.map((F) => ({
401
+ ...F,
402
+ overrides: F.productId === e && F.combinationKey == o ? p : F.overrides
403
+ }));
404
+ K(v);
405
+ }
406
+ function f(e) {
407
+ const o = u.value.bindings.findIndex(
408
+ (p) => p.productId === e.itemId && e.combinationKey == p.combinationKey
409
+ );
410
+ o >= 0 && u.value.bindings.splice(o, 1);
411
+ }
412
+ const { t: l } = ie(), y = w(() => u.value._id ? l("menu.cooking_guide.dialog.update.title") : l("menu.cooking_guide.dialog.add.title")), _ = w(() => u.value._id ? l("menu.cooking_guide.dialog.update.action") : l("menu.cooking_guide.dialog.add.action")), J = w(() => u.value.bindings.length), oe = w(
413
+ () => u.value.bindings.reduce((e, o) => {
414
+ const p = e[o.productId] ?? [];
415
+ return o.combinationKey ? e[o.productId] = [...p, o.combinationKey] : e[o.productId] = [], e;
416
+ }, {})
417
+ ), Q = h(""), M = w(() => d.categorizedItems.reduce((e, o) => {
418
+ var p, v;
419
+ for (const F of o.items)
420
+ (p = F.variant) != null && p.variantGroupIds.length && ((v = F.variant) == null ? void 0 : v.variantGroupIds.length) > 0 ? e = [
421
+ ...e,
422
+ ...F.variant.variantCombinations.map((H) => ({
423
+ categoryId: o.id,
424
+ categoryName: o.name,
425
+ itemId: F._id,
426
+ itemName: `${F.name} - ${H.codeName}`,
427
+ combinationKey: H.combinationKey
428
+ }))
429
+ ] : e.push({
430
+ categoryId: o.id,
431
+ categoryName: o.name,
432
+ itemId: F._id,
433
+ itemName: F.name
434
+ });
435
+ return e;
436
+ }, [])), T = w(() => M.value.filter((e) => {
437
+ const o = oe.value[e.itemId];
438
+ return !!o && (!e.combinationKey || o.includes(e.combinationKey));
439
+ })), O = w(() => {
440
+ const e = Q.value.toLowerCase();
441
+ return e ? T.value.filter(
442
+ (o) => o.itemName.toLowerCase().includes(e) || o.categoryName.toLowerCase().includes(e)
443
+ ) : T.value;
444
+ }), ae = w(() => O.value.reduce(
445
+ (e, o) => {
446
+ const p = e.findIndex((v) => v.id === o.categoryId);
447
+ return p < 0 ? e.push({
448
+ id: o.categoryId,
449
+ name: o.categoryName,
450
+ items: [o]
451
+ }) : e[p] = {
452
+ ...e[p],
453
+ items: [...e[p].items, o]
454
+ }, e;
455
+ },
456
+ []
457
+ )), re = h();
458
+ function ge() {
459
+ var e;
460
+ (e = re.value) == null || e.show(oe.value);
461
+ }
462
+ const _e = j;
463
+ h();
464
+ const ve = me(
465
+ () => !pe.isEqual(k.value, u.value),
466
+ () => {
467
+ L.value = !1;
468
+ }
469
+ );
470
+ function fe() {
471
+ D(), _e("onSave", u.value);
472
+ }
473
+ return (e, o) => {
474
+ const p = x("FmTextField"), v = x("FmButton"), F = x("FmCardSection"), H = x("FmCard"), ne = x("FmSearch"), te = x("FmSideSheet");
475
+ return g(), $(z, null, [
476
+ i(te, {
477
+ modelValue: L.value,
478
+ "onUpdate:modelValue": o[3] || (o[3] = (S) => L.value = S),
479
+ header: y.value,
480
+ "max-width": 560,
481
+ "is-container": t(de).FmForm,
482
+ "is-container-props": {
483
+ onValidationSuccess: fe,
484
+ blameFormChildOnValidationFailed: !0,
485
+ class: "flex flex-col h-full py-16"
486
+ },
487
+ "onOn:clickedAway": t(ve)
488
+ }, {
489
+ "side-sheet-header": c(() => [
490
+ a("span", Xe, V(y.value), 1)
491
+ ]),
492
+ "side-sheet-footer": c(() => [
493
+ a("div", ro, [
494
+ i(v, {
495
+ variant: "primary",
496
+ label: _.value,
497
+ size: "lg",
498
+ type: "submit"
499
+ }, null, 8, ["label"]),
500
+ i(v, {
501
+ variant: "tertiary",
502
+ label: t(l)("menu.cooking_guide.dialog.actions.cancel"),
503
+ size: "lg",
504
+ onClick: D
505
+ }, null, 8, ["label"])
506
+ ])
507
+ ]),
508
+ default: c(() => [
509
+ a("div", Ze, [
510
+ i(X, {
511
+ title: t(l)("menu.cooking_guide.dialog.sections.guide_detail.title")
512
+ }, {
513
+ default: c(() => [
514
+ i(p, {
515
+ autofocus: "",
516
+ modelValue: u.value.name,
517
+ "onUpdate:modelValue": o[0] || (o[0] = (S) => u.value.name = S),
518
+ label: t(l)("menu.cooking_guide.dialog.sections.guide_detail.name.label"),
519
+ placeholder: t(l)("menu.cooking_guide.dialog.sections.guide_detail.name.placeholder"),
520
+ rules: [
521
+ (S) => !!S || t(l)("menu.cooking_guide.dialog.sections.guide_detail.name.required")
522
+ ]
523
+ }, null, 8, ["modelValue", "label", "placeholder", "rules"])
524
+ ]),
525
+ _: 1
526
+ }, 8, ["title"]),
527
+ i(X, {
528
+ title: t(l)("menu.cooking_guide.dialog.sections.steps.title")
529
+ }, {
530
+ "append-title": c(() => [
531
+ i(v, {
532
+ label: t(l)("menu.cooking_guide.dialog.sections.steps.add"),
533
+ variant: "secondary",
534
+ "text-color": "primary",
535
+ "border-color": "primary",
536
+ icon: "add",
537
+ onClick: m
538
+ }, null, 8, ["label"])
539
+ ]),
540
+ default: c(() => [
541
+ i(t($e), {
542
+ modelValue: u.value.steps,
543
+ "onUpdate:modelValue": o[1] || (o[1] = (S) => u.value.steps = S),
544
+ handle: ".handle",
545
+ "item-key": "id"
546
+ }, {
547
+ item: c(({ element: S, index: W }) => [
548
+ i(H, {
549
+ variant: "outlined",
550
+ class: "rounded-md mb-16 items-center",
551
+ horizontal: "",
552
+ onClick: () => C(S)
553
+ }, {
554
+ default: c(() => [
555
+ a("div", eo, [
556
+ i(v, {
557
+ class: "handle",
558
+ icon: "drag_handle",
559
+ variant: "tertiary"
560
+ }),
561
+ a("p", oo, V(S.name), 1)
562
+ ]),
563
+ i(F, { class: "grow" }, {
564
+ default: c(() => [
565
+ be(V(S.instruction), 1)
566
+ ]),
567
+ _: 2
568
+ }, 1024),
569
+ i(v, {
570
+ icon: "delete",
571
+ variant: "tertiary",
572
+ onClick: se(() => Y(W), ["stop"])
573
+ }, null, 8, ["onClick"])
574
+ ]),
575
+ _: 2
576
+ }, 1032, ["onClick"])
577
+ ]),
578
+ _: 1
579
+ }, 8, ["modelValue"])
580
+ ]),
581
+ _: 1
582
+ }, 8, ["title"]),
583
+ U.canApplyItems ? (g(), P(X, {
584
+ key: 0,
585
+ title: t(l)("menu.cooking_guide.dialog.sections.apply_product.title")
586
+ }, {
587
+ "append-title": c(() => [
588
+ i(v, {
589
+ variant: "secondary",
590
+ icon: "link",
591
+ label: t(l)("menu.cooking_guide.dialog.sections.apply_product.link"),
592
+ "text-color": "primary",
593
+ "border-color": "primary",
594
+ onClick: ge
595
+ }, null, 8, ["label"])
596
+ ]),
597
+ default: c(() => [
598
+ a("div", no, [
599
+ a("div", to, V(t(l)("menu.cooking_guide.dialog.sections.apply_product.products_linked", {
600
+ count: J.value
601
+ })), 1),
602
+ a("div", lo, [
603
+ i(ne, {
604
+ modelValue: Q.value,
605
+ "onUpdate:modelValue": o[2] || (o[2] = (S) => Q.value = S),
606
+ placeholder: t(l)("menu.cooking_guide.dialog.sections.apply_product.search")
607
+ }, null, 8, ["modelValue", "placeholder"])
608
+ ])
609
+ ]),
610
+ (g(!0), $(z, null, q(ae.value, (S) => (g(), $("div", null, [
611
+ a("div", io, V(S.name), 1),
612
+ (g(!0), $(z, null, q(S.items, (W) => (g(), $("div", ao, [
613
+ a("div", so, V(W.itemName), 1),
614
+ a("div", uo, [
615
+ i(v, {
616
+ icon: "edit",
617
+ variant: "tertiary",
618
+ onClick: () => N(W)
619
+ }, null, 8, ["onClick"]),
620
+ i(v, {
621
+ icon: "delete",
622
+ variant: "tertiary",
623
+ onClick: () => f(W)
624
+ }, null, 8, ["onClick"])
625
+ ])
626
+ ]))), 256))
627
+ ]))), 256))
628
+ ]),
629
+ _: 1
630
+ }, 8, ["title"])) : ce("", !0)
631
+ ])
632
+ ]),
633
+ _: 1
634
+ }, 8, ["modelValue", "header", "is-container", "is-container-props", "onOn:clickedAway"]),
635
+ i(Ie, {
636
+ ref_key: "applyProductRef",
637
+ ref: re,
638
+ title: "Link product",
639
+ options: U.categorizedItems,
640
+ "can-select-variant": !0,
641
+ onOnComplete: n
642
+ }, null, 8, ["options"]),
643
+ i(Re, {
644
+ ref_key: "cookingGuideStepDialogRef",
645
+ ref: I,
646
+ onOnComplete: A
647
+ }, null, 512),
648
+ i(We, {
649
+ ref_key: "cookingGuideStepOverrideDialogRef",
650
+ ref: s,
651
+ onOnComplete: E
652
+ }, null, 512)
653
+ ], 64);
654
+ };
655
+ }
656
+ });
657
+ function mo(U) {
658
+ return {
659
+ module: ee.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
660
+ operation: ue.F_OPERATION_TYPE.create,
661
+ data: ee.FdoMenuCookingGuide.parse(U)
662
+ };
663
+ }
664
+ function po(U) {
665
+ return {
666
+ module: ee.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
667
+ operation: ue.F_OPERATION_TYPE.update,
668
+ data: ee.FdoMenuCookingGuide.parse(U)
669
+ };
670
+ }
671
+ function go(U) {
672
+ return {
673
+ module: ee.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
674
+ operation: ue.F_OPERATION_TYPE.delete,
675
+ data: U._id
676
+ };
677
+ }
678
+ const _o = {
679
+ class: "flex flex-1 justify-end"
680
+ }, vo = {
681
+ class: "flex justify-end items-center"
682
+ }, fo = {
683
+ class: "grow space-y-4"
684
+ }, bo = {
685
+ class: "fm-typo-en-body-lg-600"
686
+ }, yo = {
687
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
688
+ }, ko = {
689
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
690
+ }, Io = /* @__PURE__ */ le({
691
+ __name: "CookingGuide",
692
+ setup(U) {
693
+ const {
694
+ t: r
695
+ } = ie(), j = w(() => [{
696
+ accessorKey: "name",
697
+ header: () => r("menu.cooking_guide.table.columns.name"),
698
+ cell: (n) => n.getValue(),
699
+ enableSorting: !1
700
+ }, {
701
+ accessorKey: "bindings",
702
+ header: () => r("menu.cooking_guide.table.columns.products"),
703
+ cell: (n) => {
704
+ const s = n.getValue();
705
+ return r("menu.cooking_guide.table.columns.products", {
706
+ count: s.length
707
+ });
708
+ },
709
+ enableSorting: !1
710
+ }, {
711
+ accessorKey: "steps",
712
+ header: () => r("menu.cooking_guide.table.columns.steps"),
713
+ cell: (n) => {
714
+ const s = n.getValue();
715
+ return r("menu.cooking_guide.table.columns.steps", {
716
+ count: s.length
717
+ });
718
+ },
719
+ enableSorting: !1
720
+ }, {
721
+ accessorKey: "_id",
722
+ header: "",
723
+ size: 52,
724
+ meta: {
725
+ cellClass: "pl-16",
726
+ headerContentClass: "-mx-16"
727
+ },
728
+ enableSorting: !1,
729
+ cell: (n) => R("div", {
730
+ class: "flex justify-end"
731
+ }, [R(de.FmButton, {
732
+ icon: "delete",
733
+ textColor: "neutral-gray-400",
734
+ variant: "tertiary",
735
+ onClick: se(() => {
736
+ A(n.row.original);
737
+ }, ["stop", "prevent"])
738
+ })])
739
+ }]), d = ye(), G = w(() => D.checkMenuIsLoading()), L = w(() => d.categorizedRawMenuItems), k = w(() => d.state.menu.modules.cookingGuide), B = w(() => k.value.length > 0), D = ke(he(Fe())), u = h();
740
+ function I() {
741
+ var n;
742
+ G.value || (n = u.value) == null || n.showModal();
743
+ }
744
+ function m(n) {
745
+ var s;
746
+ G.value || (s = u.value) == null || s.showModal(n);
747
+ }
748
+ async function C(n) {
749
+ const s = n._id ? po(n) : mo(n);
750
+ await D.updateMenu(s, n.name);
751
+ }
752
+ const Y = Se();
753
+ async function A(n) {
754
+ let s = [R("span", r("menu.cooking_guide.dialogs.remove.message.prefix")), R("span", {
755
+ class: "fm-typo-en-body-lg-600"
756
+ }, n.name), R("span", "?")];
757
+ n.bindings.length && (s = [R("span", r("menu.cooking_guide.dialogs.remove.message.products_using")), R("span", {
758
+ class: "fm-typo-en-body-lg-600"
759
+ }, n.bindings.length), R("span", r("menu.cooking_guide.dialogs.remove.message.products_count")), ...s]), Y.open({
760
+ title: r("menu.cooking_guide.dialogs.remove.title"),
761
+ contentComponent: R("div", s),
762
+ primaryActions: {
763
+ text: r("menu.cooking_guide.actions.remove"),
764
+ close: !0,
765
+ variant: "destructive"
766
+ },
767
+ secondaryActions: {
768
+ text: r("menu.cooking_guide.actions.cancel"),
769
+ close: !0
770
+ }
771
+ }).onPrimary(async () => {
772
+ await D.updateMenu(go(n), n.name, !0);
773
+ });
774
+ }
775
+ const K = h(""), b = w(() => {
776
+ const n = K.value.toLowerCase();
777
+ return n ? k.value.filter((s) => s.name.toLowerCase().includes(n)) : k.value;
778
+ });
779
+ return (n, s) => {
780
+ const N = x("FmSearch"), E = x("FmTable"), f = x("FmButton"), l = x("FmListItem"), y = x("FmList");
781
+ return g(), P(xe, {
782
+ heading: t(r)("menu.cooking_guide.title")
783
+ }, {
784
+ "append-heading": c(() => [a("div", _o, [B.value ? (g(), P(Ce, {
785
+ key: 0,
786
+ disabled: G.value,
787
+ icon: "add",
788
+ label: t(r)("menu.cooking_guide.actions.add"),
789
+ variant: "primary",
790
+ onClick: s[0] || (s[0] = () => I())
791
+ }, null, 8, ["disabled", "label"])) : ce("", !0)])]),
792
+ default: c(() => [B.value ? (g(), $(z, {
793
+ key: 1
794
+ }, [a("div", vo, [i(N, {
795
+ modelValue: K.value,
796
+ "onUpdate:modelValue": s[1] || (s[1] = (_) => K.value = _),
797
+ autofocus: "",
798
+ class: "my-8 w-[320px] xs:w-full xs:px-16",
799
+ placeholder: t(r)("menu.cooking_guide.table.search.placeholder")
800
+ }, null, 8, ["modelValue", "placeholder"])]), i(Ve, {
801
+ class: "xs:hidden block"
802
+ }, {
803
+ default: c(() => [i(E, {
804
+ "column-defs": j.value,
805
+ loading: G.value,
806
+ "page-size": k.value.length,
807
+ "row-data": k.value,
808
+ "search-value": K.value,
809
+ shrinkAt: !1,
810
+ "hide-footer": "",
811
+ "pin-header-row": "",
812
+ onRowClick: s[2] || (s[2] = (_) => m(_.original))
813
+ }, null, 8, ["column-defs", "loading", "page-size", "row-data", "search-value"])]),
814
+ _: 1
815
+ }), i(y, {
816
+ class: "w-full px-16 xs:block hidden flex-1 min-h-0 overflow-scroll pb-64",
817
+ separator: ""
818
+ }, {
819
+ default: c(() => [(g(!0), $(z, null, q(b.value, (_) => (g(), P(l, {
820
+ key: _._id,
821
+ label: _.name,
822
+ style: {
823
+ padding: "12px 0 !important"
824
+ },
825
+ onClick: () => m(_)
826
+ }, {
827
+ default: c(() => [a("div", fo, [a("div", bo, V(_.name), 1), a("div", null, [a("div", yo, V(t(r)("menu.cooking_guide.table.mobile.products_linked", {
828
+ count: _.bindings.length
829
+ })), 1), a("div", ko, V(t(r)("menu.cooking_guide.table.columns.steps", {
830
+ count: _.steps.length
831
+ })), 1)])]), i(f, {
832
+ disabled: G.value,
833
+ icon: "delete",
834
+ variant: "tertiary",
835
+ "text-color": "neutral-gray-400",
836
+ onClick: se(() => A(_), ["stop"])
837
+ }, null, 8, ["disabled", "onClick"])]),
838
+ _: 2
839
+ }, 1032, ["label", "onClick"]))), 128))]),
840
+ _: 1
841
+ })], 64)) : (g(), P(t(we), {
842
+ key: 0,
843
+ action: {
844
+ text: t(r)("menu.cooking_guide.empty.action"),
845
+ callback: () => I()
846
+ },
847
+ subtitle: t(r)("menu.cooking_guide.empty.subtitle"),
848
+ title: t(r)("menu.cooking_guide.empty.title")
849
+ }, null, 8, ["action", "subtitle", "title"])), i(co, {
850
+ ref_key: "cookingGuideDialogRef",
851
+ ref: u,
852
+ "categorized-items": L.value,
853
+ onOnSave: C
854
+ }, null, 8, ["categorized-items"])]),
855
+ _: 1
856
+ }, 8, ["heading"]);
857
+ };
858
+ }
859
+ });
860
+ export {
861
+ Io as default
862
+ };