@feedmepos/mf-menu 0.32.25-dev → 0.32.26-dev

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 (64) hide show
  1. package/dist/{App-oBJtlZZ-.js → App-C-68S5Js.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-CFRqNwMm.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DMwcLrWU.js} +3 -3
  3. package/dist/{Catalog-X6QeStHF.js → Catalog-CJNoCcJq.js} +6 -6
  4. package/dist/{Category-CQ_F51om.js → Category-BgQDNQaR.js} +6 -6
  5. package/dist/{Category-BHCqHC6_.js → Category-DnqxVJn8.js} +4 -4
  6. package/dist/CookingGuide-B5pjN87U.js +897 -0
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-27kAtFHA.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-BooPj25p.js} +1 -1
  8. package/dist/{Group-C17RhtoU.js → Group-BO1A67ji.js} +3 -3
  9. package/dist/{Group-CWqVRWu_.js → Group-DUivSad8.js} +1 -1
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-KgrTRiaw.js → Group.vue_vue_type_script_setup_true_lang-B6xJGpxN.js} +8 -8
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Bw9a1p80.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CFYWGtSE.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-C8T16h_U.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-BlQWRtnv.js} +6 -6
  13. package/dist/{Ingredient-BqFjj0Xf.js → Ingredient-trCkZCeu.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-CW301d2i.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DS3zWi74.js} +2 -2
  15. package/dist/{LinkProductSideSheet-BMSjNF-X.js → LinkProductSideSheet-Cv2q4tn-.js} +3 -3
  16. package/dist/{MenuSetting-BP_PDUER.js → MenuSetting-BQ8jYr9A.js} +5 -5
  17. package/dist/PrintRoute-DYzgLPeM.js +421 -0
  18. package/dist/{Product-puUjkbSq.js → Product-YBV2jbhH.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-Dp7a5bRf.js → Product.vue_vue_type_script_setup_true_lang-D0ckjZbT.js} +12 -12
  20. package/dist/{ProductInternalTools-VKGI7Fzy.js → ProductInternalTools-V-mxz1J7.js} +5 -5
  21. package/dist/{Products-BP6XXI57.js → Products-B7JQD1yy.js} +31 -31
  22. package/dist/{Publish-BDEbXjcu.js → Publish-DDWi1SeO.js} +3 -3
  23. package/dist/{Recipe-IvNkA5o_.js → Recipe-DM7HKIjo.js} +4 -4
  24. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-D24M0F3F.js → RuleView.vue_vue_type_script_setup_true_lang-DyVE6RAn.js} +2 -2
  25. package/dist/{Scheduler-BV-sG3U0.js → Scheduler-BaYFidwx.js} +46 -48
  26. package/dist/{ServingSequence-Dy32GBOv.js → ServingSequence-CL93hjdN.js} +3 -3
  27. package/dist/{Setting-2hEKNRPz.js → Setting-krD-ZEzt.js} +5 -5
  28. package/dist/{Subcategory-CA11HBJX.js → Subcategory-Cf1QJNLz.js} +4 -4
  29. package/dist/{Takeaway-ds24Rc3p.js → Takeaway-4RIqxERJ.js} +1 -1
  30. package/dist/{Takeaway-8W2PJMhc.js → Takeaway-CPT2x245.js} +4 -4
  31. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-BSyiOhP3.js → Takeaway.vue_vue_type_script_setup_true_lang-CZsGRbj4.js} +5 -5
  32. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-CXQa2QSR.js → Thumbnail.vue_vue_type_script_setup_true_lang-De5ZxLui.js} +4 -4
  33. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-rI6agknT.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BM8B116x.js} +13 -13
  34. package/dist/{Unit-CFs9Bypt.js → Unit-CBU2yeBv.js} +2 -2
  35. package/dist/{Variant-BeBI3fwC.js → Variant-CaiofLVX.js} +3 -3
  36. package/dist/{_id_-DEN0fizp.js → _id_-C9cH5P4C.js} +9 -9
  37. package/dist/{app-BkrpZ1F6.js → app-C6OAbEST.js} +1 -1
  38. package/dist/{app-DXTOSCE8.js → app-dr4L7s0e.js} +26 -26
  39. package/dist/app.js +1 -1
  40. package/dist/assets/{linked-status-DT4GsKB9.js → linked-status-kqf9YF01.js} +2 -2
  41. package/dist/assets/{menu-export-DFMvZ9lh.js → menu-export-DaWjS0T5.js} +2 -2
  42. package/dist/assets/{override-menu-C-1OWgCr.js → override-menu-C3QQvMx-.js} +2 -2
  43. package/dist/assets/{validate-menu-C5aog612.js → validate-menu-DPyw2109.js} +2 -2
  44. package/dist/{catalog-ClDJiP0g.js → catalog-Cuz7ZRmB.js} +1 -1
  45. package/dist/{catalogSetting-DFOIszZw.js → catalogSetting-DJFNv3uY.js} +1 -1
  46. package/dist/{category-iVQCtSHT.js → category-Bam0rQG0.js} +1 -1
  47. package/dist/{currency-BK-5iUrj.js → currency-BlnPQEjW.js} +1 -1
  48. package/dist/{dayjs.min-BRGHPywQ.js → dayjs.min-DJ9q1L6q.js} +1 -1
  49. package/dist/{index-CIrQEHaA.js → index-BRj2qZrI.js} +1 -1
  50. package/dist/{index-D3j5gcJd.js → index-DTYy_WLk.js} +4 -4
  51. package/dist/{index-Bgxpsz4y.js → index-gGr9vxGG.js} +3 -3
  52. package/dist/{index.vue_vue_type_script_setup_true_lang-Bl5gVHZN.js → index.vue_vue_type_script_setup_true_lang-CN4VSfTe.js} +4 -4
  53. package/dist/{item-qo4jr-BY.js → item-DCswFfZ7.js} +1524 -1529
  54. package/dist/{jszip.min-CE-l7St7.js → jszip.min-CDVcb3V1.js} +2 -2
  55. package/dist/{menu-Chjaib3T.js → menu-OwE_CglC.js} +1 -1
  56. package/dist/{menuV2-D5wN00Wx.js → menuV2-DNKAeMnl.js} +90 -90
  57. package/dist/{priceTier-B-jiVm5I.js → priceTier-BFqnCFgL.js} +1 -1
  58. package/dist/{scheduler-aFOgeFS0.js → scheduler-BvI0Ikm5.js} +4 -4
  59. package/dist/{subcategory-UKvVvM-z.js → subcategory-BVFmNnWI.js} +2 -2
  60. package/dist/{toExcel-BPzszwzN.js → toExcel-BHGmkWkY.js} +2 -2
  61. package/dist/{unit-DIRVLvnx.js → unit-Ft62NFNs.js} +2 -2
  62. package/package.json +1 -1
  63. package/dist/CookingGuide-DnSW4CJb.js +0 -896
  64. package/dist/PrintRoute-l4v-zJrc.js +0 -420
@@ -0,0 +1,897 @@
1
+ import { defineComponent as le, ref as V, computed as F, resolveComponent as x, createBlock as T, openBlock as g, unref as n, withCtx as p, createElementVNode as a, createVNode as l, createElementBlock as E, toDisplayString as S, Fragment as z, renderList as Q, withModifiers as ae, createCommentVNode as ce, createTextVNode as fe, h as R } from "vue";
2
+ import { useI18n as se } from "@feedmepos/mf-common";
3
+ import { components as de, useBreakpoints as be, useSnackbar as ye, useDialog as ke } from "@feedmepos/ui-library";
4
+ import { _ as he } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
5
+ import { _ as xe } from "./app-dr4L7s0e.js";
6
+ import { I as ee, J as me, M as re, A as oe, u as Ce, Q as we, G as Fe, a5 as Ve } from "./index.vue_vue_type_script_setup_true_lang-CN4VSfTe.js";
7
+ import { d as Se } from "./vuedraggable-CK8z7qA8.js";
8
+ import { _ as Z } from "./RuleView.vue_vue_type_script_setup_true_lang-DyVE6RAn.js";
9
+ import { u as pe } from "./discardConfirm-BHni0LNu.js";
10
+ import { L as Ie } from "./LinkProductSideSheet-Cv2q4tn-.js";
11
+ import { _ as $e } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
12
+ const Oe = { class: "flex items-center gap-8" }, Ee = { class: "grow" }, Ke = { class: "space-y-32" }, Le = { class: "flex bg-fm-color-neutral-gray-100 border-b border-b-fm-color-neutral-gray-200" }, Ne = { class: "px-16 py-8 w-[40%]" }, De = { class: "px-16 py-8 grow" }, Ge = { class: "px-16 py-8 w-[40%]" }, Me = { class: "px-16 py-8 grow" }, Ue = { class: "space-y-16" }, Be = { class: "flex flex-wrap gap-8 overflow-hidden mb-8" }, Te = { class: "flex gap-8 items-center justify-start" }, ze = /* @__PURE__ */ le({
13
+ __name: "CookingGuideStepDialog",
14
+ emits: ["onComplete"],
15
+ setup(G, { expose: _, emit: X }) {
16
+ const { t: r } = se();
17
+ _({
18
+ show: s,
19
+ hide: O
20
+ });
21
+ const P = X;
22
+ function D() {
23
+ return {
24
+ id: "",
25
+ variables: {},
26
+ instruction: ""
27
+ };
28
+ }
29
+ const C = V(!1), A = V(!1), $ = V(void 0);
30
+ function s(v) {
31
+ A.value = !!v, $.value = v ? ee(v) : D(), c.value = ee($.value), w.value = Object.entries(c.value.variables).map(
32
+ ([t, f]) => ({ key: t, value: f })
33
+ ), C.value = !0;
34
+ }
35
+ function O() {
36
+ C.value = !1;
37
+ }
38
+ const c = V(D()), w = V([]);
39
+ function q() {
40
+ w.value.push({ key: "", value: "" });
41
+ }
42
+ function H(v) {
43
+ w.value.splice(v, 1);
44
+ }
45
+ function j(v) {
46
+ const t = document.activeElement;
47
+ if (t && t.tagName === "TEXTAREA") {
48
+ const f = t.selectionStart, L = t.selectionEnd, M = c.value.instruction, I = M.substring(0, f) + `{{${v}}}` + M.substring(L);
49
+ c.value = {
50
+ ...c.value,
51
+ instruction: I
52
+ }, setTimeout(() => {
53
+ t.focus();
54
+ const Y = f + `{{${v}}}`.length;
55
+ t.setSelectionRange(Y, Y);
56
+ }, 0);
57
+ } else
58
+ c.value = {
59
+ ...c.value,
60
+ instruction: `${c.value.instruction}{{${v}}}`
61
+ };
62
+ }
63
+ const k = F(() => w.value.reduce(
64
+ (v, { key: t }) => (t && v.every((f) => f.label !== t) && v.push({
65
+ label: t
66
+ }), v),
67
+ []
68
+ )), h = F(() => A.value ? r("menu.cooking_guide.step_dialog.update.title") : r("menu.cooking_guide.step_dialog.add.title")), K = F(() => A.value ? r("menu.cooking_guide.step_dialog.update.action") : r("menu.cooking_guide.step_dialog.add.action"));
69
+ V();
70
+ const i = pe(
71
+ () => !me.isEqual(
72
+ {
73
+ ...c.value,
74
+ variables: w.value.reduce((v, { key: t, value: f }) => ({ ...v, [t]: f }), {})
75
+ },
76
+ $.value
77
+ ),
78
+ () => {
79
+ C.value = !1;
80
+ }
81
+ );
82
+ function u() {
83
+ O(), P("onComplete", {
84
+ ...c.value,
85
+ variables: w.value.reduce((v, { key: t, value: f }) => ({ ...v, [t]: f }), {})
86
+ });
87
+ }
88
+ return (v, t) => {
89
+ const f = x("FmButton"), L = x("FmTextField"), M = x("FmChip"), I = x("FmTextarea"), Y = x("FmSideSheet");
90
+ return g(), T(Y, {
91
+ modelValue: C.value,
92
+ "onUpdate:modelValue": t[1] || (t[1] = (U) => C.value = U),
93
+ closeButton: !1,
94
+ header: h.value,
95
+ "max-width": 560,
96
+ "is-container": n(de).FmForm,
97
+ "is-container-props": {
98
+ onValidationSuccess: u,
99
+ blameFormChildOnValidationFailed: !0,
100
+ class: "flex flex-col h-full"
101
+ },
102
+ "onOn:clickedAway": n(i)
103
+ }, {
104
+ "side-sheet-header": p(() => [
105
+ a("div", Oe, [
106
+ l(f, {
107
+ icon: "arrow_back",
108
+ variant: "tertiary",
109
+ label: n(r)("menu.cooking_guide.step_dialog.actions.back"),
110
+ onClick: O
111
+ }, null, 8, ["label"]),
112
+ a("div", Ee, S(h.value), 1)
113
+ ])
114
+ ]),
115
+ "side-sheet-footer": p(() => [
116
+ a("div", Te, [
117
+ l(f, {
118
+ label: K.value,
119
+ size: "lg",
120
+ variant: "primary",
121
+ type: "submit"
122
+ }, null, 8, ["label"]),
123
+ l(f, {
124
+ label: n(r)("menu.cooking_guide.step_dialog.actions.cancel"),
125
+ size: "lg",
126
+ variant: "tertiary",
127
+ onClick: O
128
+ }, null, 8, ["label"])
129
+ ])
130
+ ]),
131
+ default: p(() => [
132
+ a("div", Ke, [
133
+ l(Z, {
134
+ title: n(r)("menu.cooking_guide.step_dialog.sections.variables.title")
135
+ }, {
136
+ "append-title": p(() => [
137
+ l(f, {
138
+ icon: "add",
139
+ label: n(r)("menu.cooking_guide.step_dialog.sections.variables.add"),
140
+ variant: "secondary",
141
+ "text-color": "primary",
142
+ "border-color": "primary",
143
+ onClick: q
144
+ }, null, 8, ["label"])
145
+ ]),
146
+ default: p(() => [
147
+ a("div", null, [
148
+ a("div", Le, [
149
+ a("div", Ne, S(n(r)("menu.cooking_guide.step_dialog.sections.variables.columns.key")), 1),
150
+ a("div", De, S(n(r)("menu.cooking_guide.step_dialog.sections.variables.columns.value")), 1)
151
+ ]),
152
+ (g(!0), E(z, null, Q(w.value, (U, B) => (g(), E("div", {
153
+ key: B,
154
+ class: "flex items-center border-b border-b-fm-color-neutral-gray-100"
155
+ }, [
156
+ a("div", Ge, [
157
+ l(L, {
158
+ modelValue: w.value[B].key,
159
+ "onUpdate:modelValue": (N) => w.value[B].key = N,
160
+ rules: [
161
+ (N) => !!N || n(r)("menu.cooking_guide.step_dialog.sections.variables.validation.required"),
162
+ (N) => !N || /^[a-z]+$/.test(N) || n(r)("menu.cooking_guide.step_dialog.sections.variables.validation.lowercase"),
163
+ (N) => !N || w.value.findIndex((ue) => ue.key === N) === B || n(r)("menu.cooking_guide.step_dialog.sections.variables.validation.duplicate")
164
+ ],
165
+ placeholder: n(r)("menu.cooking_guide.step_dialog.sections.variables.placeholders.key")
166
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "rules", "placeholder"])
167
+ ]),
168
+ a("div", Me, [
169
+ l(L, {
170
+ modelValue: w.value[B].value,
171
+ "onUpdate:modelValue": (N) => w.value[B].value = N,
172
+ rules: [
173
+ (N) => !!N || n(r)("menu.cooking_guide.step_dialog.sections.variables.validation.required")
174
+ ],
175
+ placeholder: n(r)("menu.cooking_guide.step_dialog.sections.variables.placeholders.value")
176
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "rules", "placeholder"])
177
+ ]),
178
+ l(f, {
179
+ icon: "delete",
180
+ variant: "tertiary",
181
+ "text-color": "neutral-gray-400",
182
+ onClick: () => H(B)
183
+ }, null, 8, ["onClick"])
184
+ ]))), 128))
185
+ ])
186
+ ]),
187
+ _: 1
188
+ }, 8, ["title"]),
189
+ l(Z, {
190
+ title: n(r)("menu.cooking_guide.step_dialog.sections.instruction.title")
191
+ }, {
192
+ default: p(() => [
193
+ a("div", Ue, [
194
+ a("div", Be, [
195
+ (g(!0), E(z, null, Q(k.value, (U) => (g(), T(M, {
196
+ key: U.label,
197
+ label: U.label,
198
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
199
+ onMousedown: ae(() => j(U.label), ["prevent"])
200
+ }, null, 8, ["label", "onMousedown"]))), 128))
201
+ ]),
202
+ l(I, {
203
+ modelValue: c.value.instruction,
204
+ "onUpdate:modelValue": t[0] || (t[0] = (U) => c.value.instruction = U),
205
+ ref: "textareaRef"
206
+ }, null, 8, ["modelValue"])
207
+ ])
208
+ ]),
209
+ _: 1
210
+ }, 8, ["title"])
211
+ ])
212
+ ]),
213
+ _: 1
214
+ }, 8, ["modelValue", "header", "is-container", "is-container-props", "onOn:clickedAway"]);
215
+ };
216
+ }
217
+ }), Ae = { class: "w-[700px]" }, Re = { class: "flex bg-fm-color-neutral-gray-100" }, Pe = { class: "px-16 py-8 grow" }, qe = { class: "px-16 py-8 w-[200px]" }, je = { class: "px-16 py-8 w-[200px]" }, Ye = { 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" }, Xe = /* @__PURE__ */ le({
218
+ __name: "CookingGuideStepOverrideDialog",
219
+ emits: ["onComplete"],
220
+ setup(G, { expose: _, emit: X }) {
221
+ const { t: r } = se();
222
+ _({
223
+ show: s,
224
+ hide: O
225
+ });
226
+ const P = X;
227
+ function D() {
228
+ return {
229
+ productId: "",
230
+ overrides: []
231
+ };
232
+ }
233
+ const C = V(!1), A = V(""), $ = V([]);
234
+ function s(k) {
235
+ A.value = k.itemName, $.value = k.steps, c.value = k.bindings ? ee(k.bindings) : D(), C.value = !0;
236
+ }
237
+ function O() {
238
+ C.value = !1;
239
+ }
240
+ const c = V(D()), w = F(() => c.value.overrides.reduce((k, h) => (k[h.id] = h, k), {}));
241
+ function q(k, h) {
242
+ var K;
243
+ return ((K = w.value[k]) == null ? void 0 : K.variables[h]) ?? "";
244
+ }
245
+ function H(k, h, K) {
246
+ const i = c.value.overrides.findIndex((u) => u.id === k);
247
+ K ? i < 0 ? c.value.overrides.push({
248
+ id: k,
249
+ variables: { [h]: K }
250
+ }) : c.value.overrides[i].variables[h] = K : i >= 0 && (delete c.value.overrides[i].variables[h], Object.keys(c.value.overrides[i].variables).length || c.value.overrides.splice(i, 1));
251
+ }
252
+ function j() {
253
+ O(), P("onComplete", c.value);
254
+ }
255
+ return (k, h) => {
256
+ const K = x("FmTextField"), i = x("FmSpacer"), u = x("FmButton"), v = x("FmDialog");
257
+ return g(), T(v, {
258
+ modelValue: C.value,
259
+ "onUpdate:modelValue": h[0] || (h[0] = (t) => C.value = t),
260
+ overlay: !0,
261
+ contentClass: "test",
262
+ "min-width": "min(calc(100% - 48px), 748px)"
263
+ }, {
264
+ "dialog-header": p(() => [
265
+ a("div", null, S(n(r)("menu.cooking_guide.step_override_dialog.title")), 1)
266
+ ]),
267
+ "dialog-footer": p(() => [
268
+ l(i),
269
+ l(u, {
270
+ class: "sm:w-full xs:w-full",
271
+ label: n(r)("menu.cooking_guide.step_override_dialog.actions.cancel"),
272
+ size: "md",
273
+ variant: "tertiary",
274
+ onClick: O
275
+ }, null, 8, ["label"]),
276
+ l(u, {
277
+ class: "sm:w-full xs:w-full",
278
+ label: n(r)("menu.cooking_guide.step_override_dialog.actions.save"),
279
+ size: "md",
280
+ variant: "primary",
281
+ onClick: j
282
+ }, null, 8, ["label"])
283
+ ]),
284
+ default: p(() => [
285
+ a("div", Ae, [
286
+ a("div", Re, [
287
+ a("div", Pe, S(n(r)("menu.cooking_guide.step_override_dialog.columns.instructions")), 1),
288
+ a("div", qe, S(n(r)("menu.cooking_guide.step_override_dialog.columns.variables")), 1),
289
+ a("div", je, S(n(r)("menu.cooking_guide.step_override_dialog.columns.value")), 1)
290
+ ]),
291
+ (g(!0), E(z, null, Q($.value, (t) => (g(), E("div", {
292
+ key: t.id,
293
+ class: "flex border-t-2"
294
+ }, [
295
+ a("div", Ye, S(t.instruction), 1),
296
+ a("div", Je, [
297
+ (g(!0), E(z, null, Q(t.variables, (f, L) => (g(), E("div", {
298
+ key: L,
299
+ class: "py-8 w-full text-ellipsis overflow-hidden whitespace-nowrap"
300
+ }, S(L), 1))), 128))
301
+ ]),
302
+ a("div", Qe, [
303
+ (g(!0), E(z, null, Q(t.variables, (f, L) => (g(), E("div", { key: L }, [
304
+ l(K, {
305
+ "model-value": q(t.id, L.toString()),
306
+ placeholder: f,
307
+ "onUpdate:modelValue": (M) => H(t.id, L.toString(), M)
308
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
309
+ ]))), 128))
310
+ ])
311
+ ]))), 128))
312
+ ])
313
+ ]),
314
+ _: 1
315
+ }, 8, ["modelValue"]);
316
+ };
317
+ }
318
+ }), He = { class: "fm-typo-en-title-md-600" }, We = { class: "space-y-24" }, Ze = { class: "flex items-center" }, eo = { class: "flex-1" }, oo = { class: "flex items-center gap-8" }, to = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, no = { class: "flex-1" }, io = { class: "bg-fm-color-neutral-gray-100 px-16 py-8" }, ao = { class: "px-16 py-8 flex-1 flex gap-4 overflow-auto min-w-0" }, lo = { class: "fm-typo-en-body-md-500" }, so = { class: "px-16 py-8 flex gap-8" }, uo = { class: "flex gap-8 items-center justify-start" }, ro = /* @__PURE__ */ le({
319
+ __name: "CookingGuideDialog",
320
+ props: {
321
+ categorizedItems: {
322
+ type: Array,
323
+ required: !0
324
+ },
325
+ canApplyItems: {
326
+ type: Boolean,
327
+ default: !0
328
+ }
329
+ },
330
+ emits: ["onSave"],
331
+ setup(G, { expose: _, emit: X }) {
332
+ const r = G;
333
+ _({
334
+ showModal: A,
335
+ hideModal: $
336
+ });
337
+ function P() {
338
+ return {
339
+ _id: "",
340
+ name: "",
341
+ bindings: [],
342
+ steps: []
343
+ };
344
+ }
345
+ const D = V(!1), C = V(void 0);
346
+ function A(e) {
347
+ C.value = e ? ee(e) : P(), s.value = ee(C.value), D.value = !0;
348
+ }
349
+ function $() {
350
+ D.value = !1;
351
+ }
352
+ const s = V(P()), O = V();
353
+ function c() {
354
+ var e;
355
+ (e = O.value) == null || e.show();
356
+ }
357
+ function w(e) {
358
+ var o;
359
+ (o = O.value) == null || o.show(e);
360
+ }
361
+ function q(e) {
362
+ s.value.steps.splice(e, 1);
363
+ }
364
+ function H(e) {
365
+ if (!e.id)
366
+ s.value.steps.push({ ...e, id: (/* @__PURE__ */ new Date()).toISOString() });
367
+ else {
368
+ const o = s.value.steps.findIndex(({ id: b }) => e.id === b);
369
+ o >= 0 && s.value.steps.splice(o, 1, e);
370
+ }
371
+ }
372
+ function j(e) {
373
+ s.value = {
374
+ ...s.value,
375
+ bindings: e
376
+ };
377
+ }
378
+ function k(e, o) {
379
+ return s.value.bindings.find(
380
+ (d) => d.productId === e && d.combinationKey == o
381
+ );
382
+ }
383
+ function h({ items: e }) {
384
+ const o = e.reduce((d, m) => (d[m._id] = d[m._id] ?? [], m.combinationKey && (d[m._id] = [...d[m._id], m.combinationKey]), d), {}), b = Object.entries(o).reduce(
385
+ (d, [m, W]) => {
386
+ var te;
387
+ return d = W.length > 0 ? [
388
+ ...d,
389
+ ...W.map((ne) => {
390
+ var ie;
391
+ return {
392
+ productId: m,
393
+ combinationKey: ne,
394
+ overrides: ((ie = k(m, ne)) == null ? void 0 : ie.overrides) ?? []
395
+ };
396
+ })
397
+ ] : [
398
+ ...d,
399
+ {
400
+ productId: m,
401
+ overrides: ((te = k(m)) == null ? void 0 : te.overrides) ?? []
402
+ }
403
+ ], d;
404
+ },
405
+ []
406
+ );
407
+ j(b);
408
+ }
409
+ const K = V();
410
+ function i(e) {
411
+ var o;
412
+ (o = K.value) == null || o.show({
413
+ itemName: e.itemName,
414
+ steps: s.value.steps,
415
+ bindings: k(e.itemId, e.combinationKey)
416
+ });
417
+ }
418
+ function u({ productId: e, combinationKey: o, overrides: b }) {
419
+ const d = s.value.bindings.map((m) => ({
420
+ ...m,
421
+ overrides: m.productId === e && m.combinationKey == o ? b : m.overrides
422
+ }));
423
+ j(d);
424
+ }
425
+ function v(e) {
426
+ const o = s.value.bindings.findIndex(
427
+ (b) => b.productId === e.itemId && e.combinationKey == b.combinationKey
428
+ );
429
+ o >= 0 && s.value.bindings.splice(o, 1);
430
+ }
431
+ const { t } = se(), f = F(() => s.value._id ? t("menu.cooking_guide.dialog.update.title") : t("menu.cooking_guide.dialog.add.title")), L = F(() => s.value._id ? t("menu.cooking_guide.dialog.update.action") : t("menu.cooking_guide.dialog.add.action")), M = F(() => s.value.bindings.length), I = F(
432
+ () => s.value.bindings.reduce((e, o) => {
433
+ const b = e[o.productId] ?? [];
434
+ return o.combinationKey ? e[o.productId] = [...b, o.combinationKey] : e[o.productId] = [], e;
435
+ }, {})
436
+ ), Y = V(""), U = F(() => r.categorizedItems.reduce((e, o) => {
437
+ var b, d;
438
+ for (const m of o.items)
439
+ (b = m.variant) != null && b.variantGroupIds.length && ((d = m.variant) == null ? void 0 : d.variantGroupIds.length) > 0 ? e = [
440
+ ...e,
441
+ ...m.variant.variantCombinations.map((W) => ({
442
+ categoryId: o.id,
443
+ categoryName: o.name,
444
+ itemId: m._id,
445
+ itemCode: m.code,
446
+ itemName: `${m.name} - ${W.codeName}`,
447
+ combinationKey: W.combinationKey
448
+ }))
449
+ ] : e.push({
450
+ categoryId: o.id,
451
+ categoryName: o.name,
452
+ itemId: m._id,
453
+ itemCode: m.code,
454
+ itemName: m.name
455
+ });
456
+ return e;
457
+ }, [])), B = F(() => U.value.filter((e) => {
458
+ const o = I.value[e.itemId];
459
+ return !!o && (!e.combinationKey || o.includes(e.combinationKey));
460
+ })), N = F(() => {
461
+ const e = Y.value.toLowerCase();
462
+ return e ? B.value.filter(
463
+ (o) => {
464
+ var b;
465
+ return ((b = o.itemCode) == null ? void 0 : b.toLowerCase().includes(e)) || o.itemName.toLowerCase().includes(e) || o.categoryName.toLowerCase().includes(e);
466
+ }
467
+ ) : B.value;
468
+ }), ue = F(() => N.value.reduce(
469
+ (e, o) => {
470
+ const b = e.findIndex((d) => d.id === o.categoryId);
471
+ return b < 0 ? e.push({
472
+ id: o.categoryId,
473
+ name: o.categoryName,
474
+ items: [o]
475
+ }) : e[b] = {
476
+ ...e[b],
477
+ items: [...e[b].items, o]
478
+ }, e;
479
+ },
480
+ []
481
+ )), ge = X;
482
+ V();
483
+ const _e = pe(
484
+ () => !me.isEqual(C.value, s.value),
485
+ () => {
486
+ D.value = !1;
487
+ }
488
+ );
489
+ function ve() {
490
+ $(), ge("onSave", s.value);
491
+ }
492
+ return (e, o) => {
493
+ const b = x("FmTextField"), d = x("FmButton"), m = x("FmCardSection"), W = x("FmCard"), te = x("FmSpacer"), ne = x("FmSearch"), ie = x("FmSideSheet");
494
+ return g(), E(z, null, [
495
+ l(ie, {
496
+ modelValue: D.value,
497
+ "onUpdate:modelValue": o[4] || (o[4] = (y) => D.value = y),
498
+ header: f.value,
499
+ "max-width": 560,
500
+ "is-container": n(de).FmForm,
501
+ "is-container-props": {
502
+ onValidationSuccess: ve,
503
+ blameFormChildOnValidationFailed: !0,
504
+ class: "flex flex-col h-full py-16"
505
+ },
506
+ "onOn:clickedAway": n(_e)
507
+ }, {
508
+ "side-sheet-header": p(() => [
509
+ a("span", He, S(f.value), 1)
510
+ ]),
511
+ "side-sheet-footer": p(() => [
512
+ a("div", uo, [
513
+ l(d, {
514
+ variant: "primary",
515
+ label: L.value,
516
+ size: "lg",
517
+ type: "submit"
518
+ }, null, 8, ["label"]),
519
+ l(d, {
520
+ variant: "tertiary",
521
+ label: n(t)("menu.cooking_guide.dialog.actions.cancel"),
522
+ size: "lg",
523
+ onClick: $
524
+ }, null, 8, ["label"])
525
+ ])
526
+ ]),
527
+ default: p(() => [
528
+ a("div", We, [
529
+ l(Z, {
530
+ title: n(t)("menu.cooking_guide.dialog.sections.guide_detail.title")
531
+ }, {
532
+ default: p(() => [
533
+ l(b, {
534
+ autofocus: "",
535
+ modelValue: s.value.name,
536
+ "onUpdate:modelValue": o[0] || (o[0] = (y) => s.value.name = y),
537
+ label: n(t)("menu.cooking_guide.dialog.sections.guide_detail.name.label"),
538
+ placeholder: n(t)("menu.cooking_guide.dialog.sections.guide_detail.name.placeholder"),
539
+ rules: [
540
+ (y) => !!y || n(t)("menu.cooking_guide.dialog.sections.guide_detail.name.required")
541
+ ]
542
+ }, null, 8, ["modelValue", "label", "placeholder", "rules"])
543
+ ]),
544
+ _: 1
545
+ }, 8, ["title"]),
546
+ l(Z, {
547
+ title: n(t)("menu.cooking_guide.dialog.sections.steps.title")
548
+ }, {
549
+ "append-title": p(() => [
550
+ l(d, {
551
+ label: n(t)("menu.cooking_guide.dialog.sections.steps.add"),
552
+ variant: "secondary",
553
+ "text-color": "primary",
554
+ "border-color": "primary",
555
+ icon: "add",
556
+ onClick: c
557
+ }, null, 8, ["label"])
558
+ ]),
559
+ default: p(() => [
560
+ l(n(Se), {
561
+ modelValue: s.value.steps,
562
+ "onUpdate:modelValue": o[1] || (o[1] = (y) => s.value.steps = y),
563
+ handle: ".handle",
564
+ "item-key": "id"
565
+ }, {
566
+ item: p(({ element: y, index: J }) => [
567
+ l(W, {
568
+ variant: "outlined",
569
+ class: "rounded-md mb-16 items-center",
570
+ horizontal: "",
571
+ onClick: () => w(y)
572
+ }, {
573
+ default: p(() => [
574
+ a("div", Ze, [
575
+ l(d, {
576
+ class: "handle",
577
+ icon: "drag_handle",
578
+ variant: "tertiary"
579
+ }),
580
+ a("p", eo, S(y.name), 1)
581
+ ]),
582
+ l(m, { class: "grow" }, {
583
+ default: p(() => [
584
+ fe(S(y.instruction), 1)
585
+ ]),
586
+ _: 2
587
+ }, 1024),
588
+ l(d, {
589
+ icon: "delete",
590
+ variant: "tertiary",
591
+ onClick: ae(() => q(J), ["stop"])
592
+ }, null, 8, ["onClick"])
593
+ ]),
594
+ _: 2
595
+ }, 1032, ["onClick"])
596
+ ]),
597
+ _: 1
598
+ }, 8, ["modelValue"])
599
+ ]),
600
+ _: 1
601
+ }, 8, ["title"]),
602
+ G.canApplyItems ? (g(), T(Z, {
603
+ key: 0,
604
+ title: n(t)("menu.cooking_guide.dialog.sections.apply_product.title")
605
+ }, {
606
+ "append-title": p(() => [
607
+ l(te),
608
+ l(Ie, {
609
+ "categorized-items": G.categorizedItems,
610
+ "initial-value": s.value.bindings.map((y) => ({
611
+ _id: y.productId,
612
+ combinationKey: y.combinationKey
613
+ })),
614
+ "select-variant": !0,
615
+ "show-variant": !0,
616
+ "show-addon": !1,
617
+ onSubmit: o[2] || (o[2] = (y) => h(y))
618
+ }, {
619
+ default: p(({ trigger: y }) => [
620
+ l(d, {
621
+ icon: "link",
622
+ label: n(t)("menu.scheduler.dialog.sections.products.link"),
623
+ variant: "secondary",
624
+ "text-color": "primary",
625
+ "border-color": "primary",
626
+ onClick: y
627
+ }, null, 8, ["label", "onClick"])
628
+ ]),
629
+ _: 1
630
+ }, 8, ["categorized-items", "initial-value"])
631
+ ]),
632
+ default: p(() => [
633
+ a("div", oo, [
634
+ a("div", to, S(n(t)("menu.cooking_guide.dialog.sections.apply_product.products_linked", {
635
+ count: M.value
636
+ })), 1),
637
+ a("div", no, [
638
+ l(ne, {
639
+ modelValue: Y.value,
640
+ "onUpdate:modelValue": o[3] || (o[3] = (y) => Y.value = y),
641
+ placeholder: n(t)("menu.cooking_guide.dialog.sections.apply_product.search")
642
+ }, null, 8, ["modelValue", "placeholder"])
643
+ ])
644
+ ]),
645
+ (g(!0), E(z, null, Q(ue.value, (y) => (g(), E("div", {
646
+ key: y.id || ""
647
+ }, [
648
+ a("div", io, S(y.name), 1),
649
+ (g(!0), E(z, null, Q(y.items, (J) => (g(), E("div", {
650
+ key: J.itemId,
651
+ class: "flex items-center"
652
+ }, [
653
+ a("div", ao, [
654
+ a("span", lo, S((J.itemCode ? `${J.itemCode} ` : "") + J.itemName), 1)
655
+ ]),
656
+ a("div", so, [
657
+ l(d, {
658
+ icon: "edit",
659
+ variant: "tertiary",
660
+ onClick: () => i(J)
661
+ }, null, 8, ["onClick"]),
662
+ l(d, {
663
+ icon: "delete",
664
+ variant: "tertiary",
665
+ onClick: () => v(J)
666
+ }, null, 8, ["onClick"])
667
+ ])
668
+ ]))), 128))
669
+ ]))), 128))
670
+ ]),
671
+ _: 1
672
+ }, 8, ["title"])) : ce("", !0)
673
+ ])
674
+ ]),
675
+ _: 1
676
+ }, 8, ["modelValue", "header", "is-container", "is-container-props", "onOn:clickedAway"]),
677
+ l(ze, {
678
+ ref_key: "cookingGuideStepDialogRef",
679
+ ref: O,
680
+ onOnComplete: H
681
+ }, null, 512),
682
+ l(Xe, {
683
+ ref_key: "cookingGuideStepOverrideDialogRef",
684
+ ref: K,
685
+ onOnComplete: u
686
+ }, null, 512)
687
+ ], 64);
688
+ };
689
+ }
690
+ });
691
+ function co(G) {
692
+ return {
693
+ module: oe.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
694
+ operation: re.F_OPERATION_TYPE.create,
695
+ data: oe.FdoMenuCookingGuide.parse(G)
696
+ };
697
+ }
698
+ function mo(G) {
699
+ return {
700
+ module: oe.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
701
+ operation: re.F_OPERATION_TYPE.update,
702
+ data: oe.FdoMenuCookingGuide.parse(G)
703
+ };
704
+ }
705
+ function po(G) {
706
+ return {
707
+ module: oe.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
708
+ operation: re.F_OPERATION_TYPE.delete,
709
+ data: G._id
710
+ };
711
+ }
712
+ const go = {
713
+ class: "flex flex-1 justify-end"
714
+ }, _o = {
715
+ class: "flex justify-end items-center"
716
+ }, vo = {
717
+ class: "grow space-y-4"
718
+ }, fo = {
719
+ class: "fm-typo-en-body-lg-600"
720
+ }, bo = {
721
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
722
+ }, yo = {
723
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
724
+ }, Eo = /* @__PURE__ */ le({
725
+ __name: "CookingGuide",
726
+ setup(G) {
727
+ const {
728
+ t: _
729
+ } = se(), X = be(), r = F(() => X.breakpoints.value.xs), P = F(() => [{
730
+ accessorKey: "name",
731
+ header: () => _("menu.cooking_guide.table.columns.name"),
732
+ cell: (i) => i.getValue(),
733
+ enableSorting: !1
734
+ }, {
735
+ accessorKey: "bindings",
736
+ header: () => _("menu.cooking_guide.table.columns.products"),
737
+ cell: (i) => {
738
+ const u = i.getValue();
739
+ return _("menu.cooking_guide.table.columns.products", {
740
+ count: u.length
741
+ });
742
+ },
743
+ enableSorting: !1
744
+ }, {
745
+ accessorKey: "steps",
746
+ header: () => _("menu.cooking_guide.table.columns.steps"),
747
+ cell: (i) => {
748
+ const u = i.getValue();
749
+ return _("menu.cooking_guide.table.columns.steps", {
750
+ count: u.length
751
+ });
752
+ },
753
+ enableSorting: !1
754
+ }, {
755
+ accessorKey: "_id",
756
+ header: "",
757
+ size: 52,
758
+ meta: {
759
+ cellClass: "pl-16",
760
+ headerContentClass: "-mx-16"
761
+ },
762
+ enableSorting: !1,
763
+ cell: (i) => R("div", {
764
+ class: "flex justify-end"
765
+ }, [R(de.FmButton, {
766
+ icon: "delete",
767
+ textColor: "neutral-gray-400",
768
+ variant: "tertiary",
769
+ onClick: ae(() => {
770
+ k(i.row.original);
771
+ }, ["stop", "prevent"])
772
+ })])
773
+ }]), D = Ce(), C = F(() => O.checkMenuIsLoading()), A = F(() => D.categorizedItems), $ = F(() => D.state.menu.modules.cookingGuide), s = F(() => $.value.length > 0), O = we(Fe(ye())), c = V();
774
+ function w() {
775
+ var i;
776
+ C.value || (i = c.value) == null || i.showModal();
777
+ }
778
+ function q(i) {
779
+ var u;
780
+ C.value || (u = c.value) == null || u.showModal(i);
781
+ }
782
+ async function H(i) {
783
+ const u = i._id ? mo(i) : co(i);
784
+ await O.updateMenu(u, i.name);
785
+ }
786
+ const j = ke();
787
+ async function k(i) {
788
+ let u = [R("span", _("menu.cooking_guide.dialogs.remove.message.prefix")), R("span", {
789
+ class: "fm-typo-en-body-lg-600"
790
+ }, i.name), R("span", "?")];
791
+ i.bindings.length && (u = [R("span", _("menu.cooking_guide.dialogs.remove.message.products_using")), R("span", {
792
+ class: "fm-typo-en-body-lg-600"
793
+ }, i.bindings.length), R("span", _("menu.cooking_guide.dialogs.remove.message.products_count")), ...u]), j.open({
794
+ title: _("menu.cooking_guide.dialogs.remove.title"),
795
+ contentComponent: R("div", u),
796
+ primaryActions: {
797
+ text: _("menu.cooking_guide.actions.remove"),
798
+ close: !0,
799
+ variant: "destructive"
800
+ },
801
+ secondaryActions: {
802
+ text: _("menu.cooking_guide.actions.cancel"),
803
+ close: !0
804
+ }
805
+ }).onPrimary(async () => {
806
+ await O.updateMenu(po(i), i.name, !0);
807
+ });
808
+ }
809
+ const h = V(""), K = F(() => {
810
+ const i = h.value.toLowerCase();
811
+ return i ? $.value.filter((u) => u.name.toLowerCase().includes(i)) : $.value;
812
+ });
813
+ return (i, u) => {
814
+ const v = x("FmSearch"), t = x("FmTable"), f = x("FmButton"), L = x("FmListItem"), M = x("FmList");
815
+ return g(), T($e, {
816
+ heading: n(_)("menu.cooking_guide.title")
817
+ }, {
818
+ "append-heading": p(() => [a("div", go, [s.value ? (g(), T(he, {
819
+ key: 0,
820
+ disabled: C.value,
821
+ icon: "add",
822
+ label: n(_)("menu.cooking_guide.actions.add"),
823
+ variant: "primary",
824
+ onClick: u[0] || (u[0] = () => w())
825
+ }, null, 8, ["disabled", "label"])) : ce("", !0)])]),
826
+ default: p(() => [s.value ? (g(), E(z, {
827
+ key: 1
828
+ }, [a("div", _o, [l(v, {
829
+ modelValue: h.value,
830
+ "onUpdate:modelValue": u[1] || (u[1] = (I) => h.value = I),
831
+ autofocus: "",
832
+ class: "my-8 w-[320px] xs:w-full xs:px-16",
833
+ placeholder: n(_)("menu.cooking_guide.table.search.placeholder")
834
+ }, null, 8, ["modelValue", "placeholder"])]), r.value ? (g(), T(M, {
835
+ key: 1,
836
+ class: "w-full px-16 flex-1 min-h-0 overflow-scroll pb-64",
837
+ separator: ""
838
+ }, {
839
+ default: p(() => [(g(!0), E(z, null, Q(K.value, (I) => (g(), T(L, {
840
+ key: I._id,
841
+ label: I.name,
842
+ style: {
843
+ padding: "12px 0 !important"
844
+ },
845
+ onClick: () => q(I)
846
+ }, {
847
+ default: p(() => [a("div", vo, [a("div", fo, S(I.name), 1), a("div", null, [a("div", bo, S(n(_)("menu.cooking_guide.table.mobile.products_linked", {
848
+ count: I.bindings.length
849
+ })), 1), a("div", yo, S(n(_)("menu.cooking_guide.table.columns.steps", {
850
+ count: I.steps.length
851
+ })), 1)])]), l(f, {
852
+ disabled: C.value,
853
+ icon: "delete",
854
+ variant: "tertiary",
855
+ "text-color": "neutral-gray-400",
856
+ onClick: ae(() => k(I), ["stop"])
857
+ }, null, 8, ["disabled", "onClick"])]),
858
+ _: 2
859
+ }, 1032, ["label", "onClick"]))), 128))]),
860
+ _: 1
861
+ })) : (g(), T(xe, {
862
+ key: 0
863
+ }, {
864
+ default: p(() => [l(t, {
865
+ "column-defs": P.value,
866
+ loading: C.value,
867
+ "page-size": $.value.length,
868
+ "row-data": $.value,
869
+ "search-value": h.value,
870
+ shrinkAt: !1,
871
+ "hide-footer": "",
872
+ "pin-header-row": "",
873
+ onRowClick: u[2] || (u[2] = (I) => q(I.original))
874
+ }, null, 8, ["column-defs", "loading", "page-size", "row-data", "search-value"])]),
875
+ _: 1
876
+ }))], 64)) : (g(), T(n(Ve), {
877
+ key: 0,
878
+ action: {
879
+ text: n(_)("menu.cooking_guide.empty.action"),
880
+ callback: () => w()
881
+ },
882
+ subtitle: n(_)("menu.cooking_guide.empty.subtitle"),
883
+ title: n(_)("menu.cooking_guide.empty.title")
884
+ }, null, 8, ["action", "subtitle", "title"])), l(ro, {
885
+ ref_key: "cookingGuideDialogRef",
886
+ ref: c,
887
+ "categorized-items": A.value,
888
+ onOnSave: H
889
+ }, null, 8, ["categorized-items"])]),
890
+ _: 1
891
+ }, 8, ["heading"]);
892
+ };
893
+ }
894
+ });
895
+ export {
896
+ Eo as default
897
+ };