@feedmepos/mf-menu 0.32.25 → 0.32.26

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-BhInUoKN.js → App-Dp-8zehp.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-xgohdhi_.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DI0VxiW7.js} +3 -3
  3. package/dist/{Catalog-BMuCjiGt.js → Catalog-Cw_Xojik.js} +6 -6
  4. package/dist/{Category-DIy0UEip.js → Category-BJYthYB7.js} +4 -4
  5. package/dist/{Category-CyEmotFt.js → Category-BxB0eGxV.js} +6 -6
  6. package/dist/CookingGuide-1neng9qE.js +897 -0
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-CZGtvZOY.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-Q8oLyKmJ.js} +1 -1
  8. package/dist/{Group-DAxmY3Ck.js → Group-CkPe5Fqu.js} +3 -3
  9. package/dist/{Group-zLEjb0xH.js → Group-DAiBEinY.js} +1 -1
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-un8R3wn5.js → Group.vue_vue_type_script_setup_true_lang-BVFm-JBn.js} +8 -8
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-DnQrVAcp.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-C-DaPzxN.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-V9S39Mvy.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DkePKepB.js} +6 -6
  13. package/dist/{Ingredient-IHyWyllE.js → Ingredient-x5wwjW2A.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-CUOspYLG.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DVjswfLr.js} +2 -2
  15. package/dist/{LinkProductSideSheet-Ly9aSaWk.js → LinkProductSideSheet-BN4HFmpb.js} +3 -3
  16. package/dist/{MenuSetting-DiNAKj-a.js → MenuSetting-DpbWOZlY.js} +5 -5
  17. package/dist/PrintRoute-CYdsK7wJ.js +421 -0
  18. package/dist/{Product-BDyKBbJY.js → Product-DDFtWG20.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-B11gackF.js → Product.vue_vue_type_script_setup_true_lang-DJoH3J_y.js} +12 -12
  20. package/dist/{ProductInternalTools-BtOQNqCq.js → ProductInternalTools-zW68cRSr.js} +5 -5
  21. package/dist/{Products-CwuSlhEt.js → Products-BNgojmA7.js} +34 -34
  22. package/dist/{Publish-B7ckvgqb.js → Publish-CDJzoFZz.js} +3 -3
  23. package/dist/{Recipe-KY-xA5wY.js → Recipe-DsCPORMf.js} +4 -4
  24. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-CJpwxk9I.js → RuleView.vue_vue_type_script_setup_true_lang-CV-v29gB.js} +2 -2
  25. package/dist/{Scheduler-RZWHKI0g.js → Scheduler-BYqDX5Af.js} +46 -48
  26. package/dist/{ServingSequence-CmsfRT5D.js → ServingSequence-CjZ_HTfv.js} +3 -3
  27. package/dist/{Setting-OYGSEZus.js → Setting-GCi9K1A8.js} +5 -5
  28. package/dist/{Subcategory-NU9fdC5-.js → Subcategory-BjYJ5Ggj.js} +4 -4
  29. package/dist/{Takeaway-ZNuKwOhN.js → Takeaway-C3yVXeEm.js} +1 -1
  30. package/dist/{Takeaway-DjM7dKfV.js → Takeaway-D7V_Jk2R.js} +4 -4
  31. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-BkcD-Lqc.js → Takeaway.vue_vue_type_script_setup_true_lang-zsbmGuVF.js} +5 -5
  32. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-CyJo71sr.js → Thumbnail.vue_vue_type_script_setup_true_lang-6LsEBodQ.js} +4 -4
  33. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Dlr4gHn1.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DrT6Soxk.js} +13 -13
  34. package/dist/{Unit-EdC4of9q.js → Unit-CFEgG5RM.js} +2 -2
  35. package/dist/{Variant-CrNRExr4.js → Variant-dC0Xe5--.js} +3 -3
  36. package/dist/{_id_-CnjXjfz8.js → _id_-BLMYDJ2q.js} +9 -9
  37. package/dist/{app-CJA-WhTq.js → app-8ulgmMLm.js} +26 -26
  38. package/dist/{app-B_8wJ4F4.js → app-DTHraR-9.js} +1 -1
  39. package/dist/app.js +1 -1
  40. package/dist/assets/{linked-status-Bvjq9sDQ.js → linked-status-DCO0b5HQ.js} +2 -2
  41. package/dist/assets/{menu-export-Cbu0nG8q.js → menu-export-Dca8D-Rk.js} +2 -2
  42. package/dist/assets/{override-menu-_SPLovuD.js → override-menu-Ci5ChFwD.js} +2 -2
  43. package/dist/assets/{validate-menu-SV3sMfRO.js → validate-menu-BrdFNNbG.js} +2 -2
  44. package/dist/{catalog-BSNJ6mIG.js → catalog-Bz0Yw2UN.js} +1 -1
  45. package/dist/{catalogSetting-Fp6VJZUZ.js → catalogSetting-CMYZsOkN.js} +1 -1
  46. package/dist/{category-Sp4vX_o9.js → category-DpomNpHr.js} +1 -1
  47. package/dist/{currency-B6210cWU.js → currency-dW-R1lVE.js} +1 -1
  48. package/dist/{dayjs.min-BNIAth1A.js → dayjs.min-BQOJHjW7.js} +1 -1
  49. package/dist/{index-BYqjVZOi.js → index-B2dTgoh-.js} +4 -4
  50. package/dist/{index-Lcrmd6Rk.js → index-BrzlRzBD.js} +3 -3
  51. package/dist/{index-CfiFRWSa.js → index-CMJpjaRo.js} +1 -1
  52. package/dist/{index.vue_vue_type_script_setup_true_lang-CwDbpnGk.js → index.vue_vue_type_script_setup_true_lang-yUQNrgQE.js} +4 -4
  53. package/dist/{item-BvsFVAAk.js → item-DKfwJc8E.js} +1524 -1529
  54. package/dist/{jszip.min-DVk3siNX.js → jszip.min-7_y6qXto.js} +2 -2
  55. package/dist/{menu-d0PO1aSx.js → menu-l9zOehNJ.js} +1 -1
  56. package/dist/{menuV2-BCg91Z2l.js → menuV2-B_iK6FFa.js} +66 -66
  57. package/dist/{priceTier-D8XJ-CyI.js → priceTier-BoLGapBH.js} +1 -1
  58. package/dist/{scheduler-BdlqfPaI.js → scheduler-CGrUFMkn.js} +4 -4
  59. package/dist/{subcategory-Ll36bics.js → subcategory-DMkQoAh6.js} +2 -2
  60. package/dist/{toExcel-DuTdzRLV.js → toExcel-DFwdsude.js} +2 -2
  61. package/dist/{unit-BBGppOP0.js → unit-CYOSuXzI.js} +2 -2
  62. package/package.json +1 -1
  63. package/dist/CookingGuide-DWgpLwLV.js +0 -896
  64. package/dist/PrintRoute-wiFmi52b.js +0 -420
@@ -1,896 +0,0 @@
1
- import { defineComponent as le, ref as w, computed as V, resolveComponent as x, createBlock as Y, openBlock as k, unref as i, withCtx as p, createElementVNode as l, createVNode as a, createElementBlock as I, toDisplayString as S, Fragment as z, renderList as J, withModifiers as ae, createCommentVNode as ce, createTextVNode as fe, h as A } from "vue";
2
- import { useI18n as se } from "@feedmepos/mf-common";
3
- import { components as ue, useSnackbar as be, useDialog as ye } from "@feedmepos/ui-library";
4
- import { _ as ke } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
5
- import { _ as he } from "./app-CJA-WhTq.js";
6
- import { I as ee, J as me, M as re, A as oe, u as xe, Q as Ce, G as we, a5 as Fe } from "./index.vue_vue_type_script_setup_true_lang-CwDbpnGk.js";
7
- import { d as Ve } from "./vuedraggable-CK8z7qA8.js";
8
- import { _ as Z } from "./RuleView.vue_vue_type_script_setup_true_lang-CJpwxk9I.js";
9
- import { u as pe } from "./discardConfirm-BHni0LNu.js";
10
- import { L as Se } from "./LinkProductSideSheet-Ly9aSaWk.js";
11
- import { _ as Ie } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
12
- const $e = { class: "flex items-center gap-8" }, Oe = { class: "grow" }, Ee = { class: "space-y-32" }, Ke = { class: "flex bg-fm-color-neutral-gray-100 border-b border-b-fm-color-neutral-gray-200" }, Le = { class: "px-16 py-8 w-[40%]" }, Ne = { class: "px-16 py-8 grow" }, De = { class: "px-16 py-8 w-[40%]" }, Ge = { class: "px-16 py-8 grow" }, Ue = { class: "space-y-16" }, Me = { class: "flex flex-wrap gap-8 overflow-hidden mb-8" }, Te = { class: "flex gap-8 items-center justify-start" }, Be = /* @__PURE__ */ le({
13
- __name: "CookingGuideStepDialog",
14
- emits: ["onComplete"],
15
- setup(N, { expose: g, emit: Q }) {
16
- const { t: u } = se();
17
- g({
18
- show: d,
19
- hide: $
20
- });
21
- const D = Q;
22
- function L() {
23
- return {
24
- id: "",
25
- variables: {},
26
- instruction: ""
27
- };
28
- }
29
- const C = w(!1), U = w(!1), E = w(void 0);
30
- function d(v) {
31
- U.value = !!v, E.value = v ? ee(v) : L(), m.value = ee(E.value), F.value = Object.entries(m.value.variables).map(
32
- ([t, f]) => ({ key: t, value: f })
33
- ), C.value = !0;
34
- }
35
- function $() {
36
- C.value = !1;
37
- }
38
- const m = w(L()), F = w([]);
39
- function X() {
40
- F.value.push({ key: "", value: "" });
41
- }
42
- function R(v) {
43
- F.value.splice(v, 1);
44
- }
45
- function G(v) {
46
- const t = document.activeElement;
47
- if (t && t.tagName === "TEXTAREA") {
48
- const f = t.selectionStart, _ = t.selectionEnd, P = m.value.instruction, W = P.substring(0, f) + `{{${v}}}` + P.substring(_);
49
- m.value = {
50
- ...m.value,
51
- instruction: W
52
- }, setTimeout(() => {
53
- t.focus();
54
- const q = f + `{{${v}}}`.length;
55
- t.setSelectionRange(q, q);
56
- }, 0);
57
- } else
58
- m.value = {
59
- ...m.value,
60
- instruction: `${m.value.instruction}{{${v}}}`
61
- };
62
- }
63
- const h = V(() => F.value.reduce(
64
- (v, { key: t }) => (t && v.every((f) => f.label !== t) && v.push({
65
- label: t
66
- }), v),
67
- []
68
- )), n = V(() => U.value ? u("menu.cooking_guide.step_dialog.update.title") : u("menu.cooking_guide.step_dialog.add.title")), s = V(() => U.value ? u("menu.cooking_guide.step_dialog.update.action") : u("menu.cooking_guide.step_dialog.add.action"));
69
- w();
70
- const K = pe(
71
- () => !me.isEqual(
72
- {
73
- ...m.value,
74
- variables: F.value.reduce((v, { key: t, value: f }) => ({ ...v, [t]: f }), {})
75
- },
76
- E.value
77
- ),
78
- () => {
79
- C.value = !1;
80
- }
81
- );
82
- function M() {
83
- $(), D("onComplete", {
84
- ...m.value,
85
- variables: F.value.reduce((v, { key: t, value: f }) => ({ ...v, [t]: f }), {})
86
- });
87
- }
88
- return (v, t) => {
89
- const f = x("FmButton"), _ = x("FmTextField"), P = x("FmChip"), W = x("FmTextarea"), q = x("FmSideSheet");
90
- return k(), Y(q, {
91
- modelValue: C.value,
92
- "onUpdate:modelValue": t[1] || (t[1] = (T) => C.value = T),
93
- closeButton: !1,
94
- header: n.value,
95
- "max-width": 560,
96
- "is-container": i(ue).FmForm,
97
- "is-container-props": {
98
- onValidationSuccess: M,
99
- blameFormChildOnValidationFailed: !0,
100
- class: "flex flex-col h-full"
101
- },
102
- "onOn:clickedAway": i(K)
103
- }, {
104
- "side-sheet-header": p(() => [
105
- l("div", $e, [
106
- a(f, {
107
- icon: "arrow_back",
108
- variant: "tertiary",
109
- label: i(u)("menu.cooking_guide.step_dialog.actions.back"),
110
- onClick: $
111
- }, null, 8, ["label"]),
112
- l("div", Oe, S(n.value), 1)
113
- ])
114
- ]),
115
- "side-sheet-footer": p(() => [
116
- l("div", Te, [
117
- a(f, {
118
- label: s.value,
119
- size: "lg",
120
- variant: "primary",
121
- type: "submit"
122
- }, null, 8, ["label"]),
123
- a(f, {
124
- label: i(u)("menu.cooking_guide.step_dialog.actions.cancel"),
125
- size: "lg",
126
- variant: "tertiary",
127
- onClick: $
128
- }, null, 8, ["label"])
129
- ])
130
- ]),
131
- default: p(() => [
132
- l("div", Ee, [
133
- a(Z, {
134
- title: i(u)("menu.cooking_guide.step_dialog.sections.variables.title")
135
- }, {
136
- "append-title": p(() => [
137
- a(f, {
138
- icon: "add",
139
- label: i(u)("menu.cooking_guide.step_dialog.sections.variables.add"),
140
- variant: "secondary",
141
- "text-color": "primary",
142
- "border-color": "primary",
143
- onClick: X
144
- }, null, 8, ["label"])
145
- ]),
146
- default: p(() => [
147
- l("div", null, [
148
- l("div", Ke, [
149
- l("div", Le, S(i(u)("menu.cooking_guide.step_dialog.sections.variables.columns.key")), 1),
150
- l("div", Ne, S(i(u)("menu.cooking_guide.step_dialog.sections.variables.columns.value")), 1)
151
- ]),
152
- (k(!0), I(z, null, J(F.value, (T, B) => (k(), I("div", {
153
- key: B,
154
- class: "flex items-center border-b border-b-fm-color-neutral-gray-100"
155
- }, [
156
- l("div", De, [
157
- a(_, {
158
- modelValue: F.value[B].key,
159
- "onUpdate:modelValue": (O) => F.value[B].key = O,
160
- rules: [
161
- (O) => !!O || i(u)("menu.cooking_guide.step_dialog.sections.variables.validation.required"),
162
- (O) => !O || /^[a-z]+$/.test(O) || i(u)("menu.cooking_guide.step_dialog.sections.variables.validation.lowercase"),
163
- (O) => !O || F.value.findIndex((de) => de.key === O) === B || i(u)("menu.cooking_guide.step_dialog.sections.variables.validation.duplicate")
164
- ],
165
- placeholder: i(u)("menu.cooking_guide.step_dialog.sections.variables.placeholders.key")
166
- }, null, 8, ["modelValue", "onUpdate:modelValue", "rules", "placeholder"])
167
- ]),
168
- l("div", Ge, [
169
- a(_, {
170
- modelValue: F.value[B].value,
171
- "onUpdate:modelValue": (O) => F.value[B].value = O,
172
- rules: [
173
- (O) => !!O || i(u)("menu.cooking_guide.step_dialog.sections.variables.validation.required")
174
- ],
175
- placeholder: i(u)("menu.cooking_guide.step_dialog.sections.variables.placeholders.value")
176
- }, null, 8, ["modelValue", "onUpdate:modelValue", "rules", "placeholder"])
177
- ]),
178
- a(f, {
179
- icon: "delete",
180
- variant: "tertiary",
181
- "text-color": "neutral-gray-400",
182
- onClick: () => R(B)
183
- }, null, 8, ["onClick"])
184
- ]))), 128))
185
- ])
186
- ]),
187
- _: 1
188
- }, 8, ["title"]),
189
- a(Z, {
190
- title: i(u)("menu.cooking_guide.step_dialog.sections.instruction.title")
191
- }, {
192
- default: p(() => [
193
- l("div", Ue, [
194
- l("div", Me, [
195
- (k(!0), I(z, null, J(h.value, (T) => (k(), Y(P, {
196
- key: T.label,
197
- label: T.label,
198
- class: "text-fm-color-primary bg-fm-color-system-warning-100",
199
- onMousedown: ae(() => G(T.label), ["prevent"])
200
- }, null, 8, ["label", "onMousedown"]))), 128))
201
- ]),
202
- a(W, {
203
- modelValue: m.value.instruction,
204
- "onUpdate:modelValue": t[0] || (t[0] = (T) => m.value.instruction = T),
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
- }), ze = { class: "w-[700px]" }, Ae = { class: "flex bg-fm-color-neutral-gray-100" }, Re = { class: "px-16 py-8 grow" }, Pe = { class: "px-16 py-8 w-[200px]" }, qe = { class: "px-16 py-8 w-[200px]" }, je = { class: "px-16 py-8 grow" }, Ye = { class: "px-16 py-8 w-[200px] flex flex-col gap-8" }, Je = { class: "px-16 py-8 w-[200px] flex flex-col gap-8" }, Qe = /* @__PURE__ */ le({
218
- __name: "CookingGuideStepOverrideDialog",
219
- emits: ["onComplete"],
220
- setup(N, { expose: g, emit: Q }) {
221
- const { t: u } = se();
222
- g({
223
- show: d,
224
- hide: $
225
- });
226
- const D = Q;
227
- function L() {
228
- return {
229
- productId: "",
230
- overrides: []
231
- };
232
- }
233
- const C = w(!1), U = w(""), E = w([]);
234
- function d(h) {
235
- U.value = h.itemName, E.value = h.steps, m.value = h.bindings ? ee(h.bindings) : L(), C.value = !0;
236
- }
237
- function $() {
238
- C.value = !1;
239
- }
240
- const m = w(L()), F = V(() => m.value.overrides.reduce((h, n) => (h[n.id] = n, h), {}));
241
- function X(h, n) {
242
- var s;
243
- return ((s = F.value[h]) == null ? void 0 : s.variables[n]) ?? "";
244
- }
245
- function R(h, n, s) {
246
- const K = m.value.overrides.findIndex((M) => M.id === h);
247
- s ? K < 0 ? m.value.overrides.push({
248
- id: h,
249
- variables: { [n]: s }
250
- }) : m.value.overrides[K].variables[n] = s : K >= 0 && (delete m.value.overrides[K].variables[n], Object.keys(m.value.overrides[K].variables).length || m.value.overrides.splice(K, 1));
251
- }
252
- function G() {
253
- $(), D("onComplete", m.value);
254
- }
255
- return (h, n) => {
256
- const s = x("FmTextField"), K = x("FmSpacer"), M = x("FmButton"), v = x("FmDialog");
257
- return k(), Y(v, {
258
- modelValue: C.value,
259
- "onUpdate:modelValue": n[0] || (n[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
- l("div", null, S(i(u)("menu.cooking_guide.step_override_dialog.title")), 1)
266
- ]),
267
- "dialog-footer": p(() => [
268
- a(K),
269
- a(M, {
270
- class: "sm:w-full xs:w-full",
271
- label: i(u)("menu.cooking_guide.step_override_dialog.actions.cancel"),
272
- size: "md",
273
- variant: "tertiary",
274
- onClick: $
275
- }, null, 8, ["label"]),
276
- a(M, {
277
- class: "sm:w-full xs:w-full",
278
- label: i(u)("menu.cooking_guide.step_override_dialog.actions.save"),
279
- size: "md",
280
- variant: "primary",
281
- onClick: G
282
- }, null, 8, ["label"])
283
- ]),
284
- default: p(() => [
285
- l("div", ze, [
286
- l("div", Ae, [
287
- l("div", Re, S(i(u)("menu.cooking_guide.step_override_dialog.columns.instructions")), 1),
288
- l("div", Pe, S(i(u)("menu.cooking_guide.step_override_dialog.columns.variables")), 1),
289
- l("div", qe, S(i(u)("menu.cooking_guide.step_override_dialog.columns.value")), 1)
290
- ]),
291
- (k(!0), I(z, null, J(E.value, (t) => (k(), I("div", {
292
- key: t.id,
293
- class: "flex border-t-2"
294
- }, [
295
- l("div", je, S(t.instruction), 1),
296
- l("div", Ye, [
297
- (k(!0), I(z, null, J(t.variables, (f, _) => (k(), I("div", {
298
- key: _,
299
- class: "py-8 w-full text-ellipsis overflow-hidden whitespace-nowrap"
300
- }, S(_), 1))), 128))
301
- ]),
302
- l("div", Je, [
303
- (k(!0), I(z, null, J(t.variables, (f, _) => (k(), I("div", { key: _ }, [
304
- a(s, {
305
- "model-value": X(t.id, _.toString()),
306
- placeholder: f,
307
- "onUpdate:modelValue": (P) => R(t.id, _.toString(), P)
308
- }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
309
- ]))), 128))
310
- ])
311
- ]))), 128))
312
- ])
313
- ]),
314
- _: 1
315
- }, 8, ["modelValue"]);
316
- };
317
- }
318
- }), Xe = { class: "fm-typo-en-title-md-600" }, He = { class: "space-y-24" }, We = { class: "flex items-center" }, Ze = { class: "flex-1" }, eo = { class: "flex items-center gap-8" }, oo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, to = { class: "flex-1" }, no = { class: "bg-fm-color-neutral-gray-100 px-16 py-8" }, io = { class: "px-16 py-8 flex-1 flex gap-4 overflow-auto min-w-0" }, ao = { class: "fm-typo-en-body-md-500" }, lo = { class: "px-16 py-8 flex gap-8" }, so = { class: "flex gap-8 items-center justify-start" }, uo = /* @__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(N, { expose: g, emit: Q }) {
332
- const u = N;
333
- g({
334
- showModal: U,
335
- hideModal: E
336
- });
337
- function D() {
338
- return {
339
- _id: "",
340
- name: "",
341
- bindings: [],
342
- steps: []
343
- };
344
- }
345
- const L = w(!1), C = w(void 0);
346
- function U(e) {
347
- C.value = e ? ee(e) : D(), d.value = ee(C.value), L.value = !0;
348
- }
349
- function E() {
350
- L.value = !1;
351
- }
352
- const d = w(D()), $ = w();
353
- function m() {
354
- var e;
355
- (e = $.value) == null || e.show();
356
- }
357
- function F(e) {
358
- var o;
359
- (o = $.value) == null || o.show(e);
360
- }
361
- function X(e) {
362
- d.value.steps.splice(e, 1);
363
- }
364
- function R(e) {
365
- if (!e.id)
366
- d.value.steps.push({ ...e, id: (/* @__PURE__ */ new Date()).toISOString() });
367
- else {
368
- const o = d.value.steps.findIndex(({ id: b }) => e.id === b);
369
- o >= 0 && d.value.steps.splice(o, 1, e);
370
- }
371
- }
372
- function G(e) {
373
- d.value = {
374
- ...d.value,
375
- bindings: e
376
- };
377
- }
378
- function h(e, o) {
379
- return d.value.bindings.find(
380
- (r) => r.productId === e && r.combinationKey == o
381
- );
382
- }
383
- function n({ items: e }) {
384
- const o = e.reduce((r, c) => (r[c._id] = r[c._id] ?? [], c.combinationKey && (r[c._id] = [...r[c._id], c.combinationKey]), r), {}), b = Object.entries(o).reduce(
385
- (r, [c, H]) => {
386
- var te;
387
- return r = H.length > 0 ? [
388
- ...r,
389
- ...H.map((ne) => {
390
- var ie;
391
- return {
392
- productId: c,
393
- combinationKey: ne,
394
- overrides: ((ie = h(c, ne)) == null ? void 0 : ie.overrides) ?? []
395
- };
396
- })
397
- ] : [
398
- ...r,
399
- {
400
- productId: c,
401
- overrides: ((te = h(c)) == null ? void 0 : te.overrides) ?? []
402
- }
403
- ], r;
404
- },
405
- []
406
- );
407
- G(b);
408
- }
409
- const s = w();
410
- function K(e) {
411
- var o;
412
- (o = s.value) == null || o.show({
413
- itemName: e.itemName,
414
- steps: d.value.steps,
415
- bindings: h(e.itemId, e.combinationKey)
416
- });
417
- }
418
- function M({ productId: e, combinationKey: o, overrides: b }) {
419
- const r = d.value.bindings.map((c) => ({
420
- ...c,
421
- overrides: c.productId === e && c.combinationKey == o ? b : c.overrides
422
- }));
423
- G(r);
424
- }
425
- function v(e) {
426
- const o = d.value.bindings.findIndex(
427
- (b) => b.productId === e.itemId && e.combinationKey == b.combinationKey
428
- );
429
- o >= 0 && d.value.bindings.splice(o, 1);
430
- }
431
- const { t } = se(), f = V(() => d.value._id ? t("menu.cooking_guide.dialog.update.title") : t("menu.cooking_guide.dialog.add.title")), _ = V(() => d.value._id ? t("menu.cooking_guide.dialog.update.action") : t("menu.cooking_guide.dialog.add.action")), P = V(() => d.value.bindings.length), W = V(
432
- () => d.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
- ), q = w(""), T = V(() => u.categorizedItems.reduce((e, o) => {
437
- var b, r;
438
- for (const c of o.items)
439
- (b = c.variant) != null && b.variantGroupIds.length && ((r = c.variant) == null ? void 0 : r.variantGroupIds.length) > 0 ? e = [
440
- ...e,
441
- ...c.variant.variantCombinations.map((H) => ({
442
- categoryId: o.id,
443
- categoryName: o.name,
444
- itemId: c._id,
445
- itemCode: c.code,
446
- itemName: `${c.name} - ${H.codeName}`,
447
- combinationKey: H.combinationKey
448
- }))
449
- ] : e.push({
450
- categoryId: o.id,
451
- categoryName: o.name,
452
- itemId: c._id,
453
- itemCode: c.code,
454
- itemName: c.name
455
- });
456
- return e;
457
- }, [])), B = V(() => T.value.filter((e) => {
458
- const o = W.value[e.itemId];
459
- return !!o && (!e.combinationKey || o.includes(e.combinationKey));
460
- })), O = V(() => {
461
- const e = q.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
- }), de = V(() => O.value.reduce(
469
- (e, o) => {
470
- const b = e.findIndex((r) => r.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 = Q;
482
- w();
483
- const _e = pe(
484
- () => !me.isEqual(C.value, d.value),
485
- () => {
486
- L.value = !1;
487
- }
488
- );
489
- function ve() {
490
- E(), ge("onSave", d.value);
491
- }
492
- return (e, o) => {
493
- const b = x("FmTextField"), r = x("FmButton"), c = x("FmCardSection"), H = x("FmCard"), te = x("FmSpacer"), ne = x("FmSearch"), ie = x("FmSideSheet");
494
- return k(), I(z, null, [
495
- a(ie, {
496
- modelValue: L.value,
497
- "onUpdate:modelValue": o[4] || (o[4] = (y) => L.value = y),
498
- header: f.value,
499
- "max-width": 560,
500
- "is-container": i(ue).FmForm,
501
- "is-container-props": {
502
- onValidationSuccess: ve,
503
- blameFormChildOnValidationFailed: !0,
504
- class: "flex flex-col h-full py-16"
505
- },
506
- "onOn:clickedAway": i(_e)
507
- }, {
508
- "side-sheet-header": p(() => [
509
- l("span", Xe, S(f.value), 1)
510
- ]),
511
- "side-sheet-footer": p(() => [
512
- l("div", so, [
513
- a(r, {
514
- variant: "primary",
515
- label: _.value,
516
- size: "lg",
517
- type: "submit"
518
- }, null, 8, ["label"]),
519
- a(r, {
520
- variant: "tertiary",
521
- label: i(t)("menu.cooking_guide.dialog.actions.cancel"),
522
- size: "lg",
523
- onClick: E
524
- }, null, 8, ["label"])
525
- ])
526
- ]),
527
- default: p(() => [
528
- l("div", He, [
529
- a(Z, {
530
- title: i(t)("menu.cooking_guide.dialog.sections.guide_detail.title")
531
- }, {
532
- default: p(() => [
533
- a(b, {
534
- autofocus: "",
535
- modelValue: d.value.name,
536
- "onUpdate:modelValue": o[0] || (o[0] = (y) => d.value.name = y),
537
- label: i(t)("menu.cooking_guide.dialog.sections.guide_detail.name.label"),
538
- placeholder: i(t)("menu.cooking_guide.dialog.sections.guide_detail.name.placeholder"),
539
- rules: [
540
- (y) => !!y || i(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
- a(Z, {
547
- title: i(t)("menu.cooking_guide.dialog.sections.steps.title")
548
- }, {
549
- "append-title": p(() => [
550
- a(r, {
551
- label: i(t)("menu.cooking_guide.dialog.sections.steps.add"),
552
- variant: "secondary",
553
- "text-color": "primary",
554
- "border-color": "primary",
555
- icon: "add",
556
- onClick: m
557
- }, null, 8, ["label"])
558
- ]),
559
- default: p(() => [
560
- a(i(Ve), {
561
- modelValue: d.value.steps,
562
- "onUpdate:modelValue": o[1] || (o[1] = (y) => d.value.steps = y),
563
- handle: ".handle",
564
- "item-key": "id"
565
- }, {
566
- item: p(({ element: y, index: j }) => [
567
- a(H, {
568
- variant: "outlined",
569
- class: "rounded-md mb-16 items-center",
570
- horizontal: "",
571
- onClick: () => F(y)
572
- }, {
573
- default: p(() => [
574
- l("div", We, [
575
- a(r, {
576
- class: "handle",
577
- icon: "drag_handle",
578
- variant: "tertiary"
579
- }),
580
- l("p", Ze, S(y.name), 1)
581
- ]),
582
- a(c, { class: "grow" }, {
583
- default: p(() => [
584
- fe(S(y.instruction), 1)
585
- ]),
586
- _: 2
587
- }, 1024),
588
- a(r, {
589
- icon: "delete",
590
- variant: "tertiary",
591
- onClick: ae(() => X(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
- N.canApplyItems ? (k(), Y(Z, {
603
- key: 0,
604
- title: i(t)("menu.cooking_guide.dialog.sections.apply_product.title")
605
- }, {
606
- "append-title": p(() => [
607
- a(te),
608
- a(Se, {
609
- "categorized-items": N.categorizedItems,
610
- "initial-value": d.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) => n(y))
618
- }, {
619
- default: p(({ trigger: y }) => [
620
- a(r, {
621
- icon: "link",
622
- label: i(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
- l("div", eo, [
634
- l("div", oo, S(i(t)("menu.cooking_guide.dialog.sections.apply_product.products_linked", {
635
- count: P.value
636
- })), 1),
637
- l("div", to, [
638
- a(ne, {
639
- modelValue: q.value,
640
- "onUpdate:modelValue": o[3] || (o[3] = (y) => q.value = y),
641
- placeholder: i(t)("menu.cooking_guide.dialog.sections.apply_product.search")
642
- }, null, 8, ["modelValue", "placeholder"])
643
- ])
644
- ]),
645
- (k(!0), I(z, null, J(de.value, (y) => (k(), I("div", {
646
- key: y.id || ""
647
- }, [
648
- l("div", no, S(y.name), 1),
649
- (k(!0), I(z, null, J(y.items, (j) => (k(), I("div", {
650
- key: j.itemId,
651
- class: "flex items-center"
652
- }, [
653
- l("div", io, [
654
- l("span", ao, S((j.itemCode ? `${j.itemCode} ` : "") + j.itemName), 1)
655
- ]),
656
- l("div", lo, [
657
- a(r, {
658
- icon: "edit",
659
- variant: "tertiary",
660
- onClick: () => K(j)
661
- }, null, 8, ["onClick"]),
662
- a(r, {
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
- a(Be, {
678
- ref_key: "cookingGuideStepDialogRef",
679
- ref: $,
680
- onOnComplete: R
681
- }, null, 512),
682
- a(Qe, {
683
- ref_key: "cookingGuideStepOverrideDialogRef",
684
- ref: s,
685
- onOnComplete: M
686
- }, null, 512)
687
- ], 64);
688
- };
689
- }
690
- });
691
- function ro(N) {
692
- return {
693
- module: oe.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
694
- operation: re.F_OPERATION_TYPE.create,
695
- data: oe.FdoMenuCookingGuide.parse(N)
696
- };
697
- }
698
- function co(N) {
699
- return {
700
- module: oe.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
701
- operation: re.F_OPERATION_TYPE.update,
702
- data: oe.FdoMenuCookingGuide.parse(N)
703
- };
704
- }
705
- function mo(N) {
706
- return {
707
- module: oe.F_MENU_MODULE_V4_KEY.enum.cookingGuide,
708
- operation: re.F_OPERATION_TYPE.delete,
709
- data: N._id
710
- };
711
- }
712
- const po = {
713
- class: "flex flex-1 justify-end"
714
- }, go = {
715
- class: "flex justify-end items-center"
716
- }, _o = {
717
- class: "grow space-y-4"
718
- }, vo = {
719
- class: "fm-typo-en-body-lg-600"
720
- }, fo = {
721
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
722
- }, bo = {
723
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
724
- }, Oo = /* @__PURE__ */ le({
725
- __name: "CookingGuide",
726
- setup(N) {
727
- const {
728
- t: g
729
- } = se(), Q = V(() => [{
730
- accessorKey: "name",
731
- header: () => g("menu.cooking_guide.table.columns.name"),
732
- cell: (n) => n.getValue(),
733
- enableSorting: !1
734
- }, {
735
- accessorKey: "bindings",
736
- header: () => g("menu.cooking_guide.table.columns.products"),
737
- cell: (n) => {
738
- const s = n.getValue();
739
- return g("menu.cooking_guide.table.columns.products", {
740
- count: s.length
741
- });
742
- },
743
- enableSorting: !1
744
- }, {
745
- accessorKey: "steps",
746
- header: () => g("menu.cooking_guide.table.columns.steps"),
747
- cell: (n) => {
748
- const s = n.getValue();
749
- return g("menu.cooking_guide.table.columns.steps", {
750
- count: s.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: (n) => A("div", {
764
- class: "flex justify-end"
765
- }, [A(ue.FmButton, {
766
- icon: "delete",
767
- textColor: "neutral-gray-400",
768
- variant: "tertiary",
769
- onClick: ae(() => {
770
- R(n.row.original);
771
- }, ["stop", "prevent"])
772
- })])
773
- }]), u = xe(), D = V(() => E.checkMenuIsLoading()), L = V(() => u.categorizedItems), C = V(() => u.state.menu.modules.cookingGuide), U = V(() => C.value.length > 0), E = Ce(we(be())), d = w();
774
- function $() {
775
- var n;
776
- D.value || (n = d.value) == null || n.showModal();
777
- }
778
- function m(n) {
779
- var s;
780
- D.value || (s = d.value) == null || s.showModal(n);
781
- }
782
- async function F(n) {
783
- const s = n._id ? co(n) : ro(n);
784
- await E.updateMenu(s, n.name);
785
- }
786
- const X = ye();
787
- async function R(n) {
788
- let s = [A("span", g("menu.cooking_guide.dialogs.remove.message.prefix")), A("span", {
789
- class: "fm-typo-en-body-lg-600"
790
- }, n.name), A("span", "?")];
791
- n.bindings.length && (s = [A("span", g("menu.cooking_guide.dialogs.remove.message.products_using")), A("span", {
792
- class: "fm-typo-en-body-lg-600"
793
- }, n.bindings.length), A("span", g("menu.cooking_guide.dialogs.remove.message.products_count")), ...s]), X.open({
794
- title: g("menu.cooking_guide.dialogs.remove.title"),
795
- contentComponent: A("div", s),
796
- primaryActions: {
797
- text: g("menu.cooking_guide.actions.remove"),
798
- close: !0,
799
- variant: "destructive"
800
- },
801
- secondaryActions: {
802
- text: g("menu.cooking_guide.actions.cancel"),
803
- close: !0
804
- }
805
- }).onPrimary(async () => {
806
- await E.updateMenu(mo(n), n.name, !0);
807
- });
808
- }
809
- const G = w(""), h = V(() => {
810
- const n = G.value.toLowerCase();
811
- return n ? C.value.filter((s) => s.name.toLowerCase().includes(n)) : C.value;
812
- });
813
- return (n, s) => {
814
- const K = x("FmSearch"), M = x("FmTable"), v = x("FmButton"), t = x("FmListItem"), f = x("FmList");
815
- return k(), Y(Ie, {
816
- heading: i(g)("menu.cooking_guide.title")
817
- }, {
818
- "append-heading": p(() => [l("div", po, [U.value ? (k(), Y(ke, {
819
- key: 0,
820
- disabled: D.value,
821
- icon: "add",
822
- label: i(g)("menu.cooking_guide.actions.add"),
823
- variant: "primary",
824
- onClick: s[0] || (s[0] = () => $())
825
- }, null, 8, ["disabled", "label"])) : ce("", !0)])]),
826
- default: p(() => [U.value ? (k(), I(z, {
827
- key: 1
828
- }, [l("div", go, [a(K, {
829
- modelValue: G.value,
830
- "onUpdate:modelValue": s[1] || (s[1] = (_) => G.value = _),
831
- autofocus: "",
832
- class: "my-8 w-[320px] xs:w-full xs:px-16",
833
- placeholder: i(g)("menu.cooking_guide.table.search.placeholder")
834
- }, null, 8, ["modelValue", "placeholder"])]), a(he, {
835
- class: "xs:hidden block"
836
- }, {
837
- default: p(() => [a(M, {
838
- "column-defs": Q.value,
839
- loading: D.value,
840
- "page-size": C.value.length,
841
- "row-data": C.value,
842
- "search-value": G.value,
843
- shrinkAt: !1,
844
- "hide-footer": "",
845
- "pin-header-row": "",
846
- onRowClick: s[2] || (s[2] = (_) => m(_.original))
847
- }, null, 8, ["column-defs", "loading", "page-size", "row-data", "search-value"])]),
848
- _: 1
849
- }), a(f, {
850
- class: "w-full px-16 xs:block sm:hidden flex-1 min-h-0 overflow-scroll pb-64",
851
- separator: ""
852
- }, {
853
- default: p(() => [(k(!0), I(z, null, J(h.value, (_) => (k(), Y(t, {
854
- key: _._id,
855
- label: _.name,
856
- style: {
857
- padding: "12px 0 !important"
858
- },
859
- onClick: () => m(_)
860
- }, {
861
- default: p(() => [l("div", _o, [l("div", vo, S(_.name), 1), l("div", null, [l("div", fo, S(i(g)("menu.cooking_guide.table.mobile.products_linked", {
862
- count: _.bindings.length
863
- })), 1), l("div", bo, S(i(g)("menu.cooking_guide.table.columns.steps", {
864
- count: _.steps.length
865
- })), 1)])]), a(v, {
866
- disabled: D.value,
867
- icon: "delete",
868
- variant: "tertiary",
869
- "text-color": "neutral-gray-400",
870
- onClick: ae(() => R(_), ["stop"])
871
- }, null, 8, ["disabled", "onClick"])]),
872
- _: 2
873
- }, 1032, ["label", "onClick"]))), 128))]),
874
- _: 1
875
- })], 64)) : (k(), Y(i(Fe), {
876
- key: 0,
877
- action: {
878
- text: i(g)("menu.cooking_guide.empty.action"),
879
- callback: () => $()
880
- },
881
- subtitle: i(g)("menu.cooking_guide.empty.subtitle"),
882
- title: i(g)("menu.cooking_guide.empty.title")
883
- }, null, 8, ["action", "subtitle", "title"])), a(uo, {
884
- ref_key: "cookingGuideDialogRef",
885
- ref: d,
886
- "categorized-items": L.value,
887
- onOnSave: F
888
- }, null, 8, ["categorized-items"])]),
889
- _: 1
890
- }, 8, ["heading"]);
891
- };
892
- }
893
- });
894
- export {
895
- Oo as default
896
- };