@feedmepos/mf-menu 0.31.51-prod → 0.31.52-beta.1
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.
- package/dist/{App-C68d-eta.js → App-MaktN0h5.js} +9 -9
- package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-xvgIqXKV.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DZnCqrjJ.js} +3 -3
- package/dist/{Catalog-jLDUoWhC.js → Catalog-cEpnDQ84.js} +6 -6
- package/dist/{Category-BJqMsx47.js → Category-C3Ypu2VQ.js} +4 -4
- package/dist/{Category-Bj5vG5BH.js → Category-ZiBoYQQN.js} +6 -6
- package/dist/{CookingGuide-BVFIw-HU.js → CookingGuide-DH0pYHsm.js} +4 -4
- package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-D4DtjtYG.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-C4e7SpGo.js} +1 -1
- package/dist/{Group-CBK-GGHf.js → Group-WRlOExBi.js} +1 -1
- package/dist/{Group-DYVoz8gS.js → Group-j5TSPPHj.js} +3 -3
- package/dist/{Group.vue_vue_type_script_setup_true_lang-Dyk9yKiZ.js → Group.vue_vue_type_script_setup_true_lang-CpOAdyWu.js} +8 -7
- package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CVC0loV_.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Da4d_t4d.js} +5 -5
- package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-yG08n5hc.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DJ7_iBd1.js} +7 -7
- package/dist/{Ingredient-CqHoOPQn.js → Ingredient-7o_2tWwH.js} +3 -3
- package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-9LWSZid8.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DVBc2xYW.js} +2 -2
- package/dist/{LinkProductSideSheet-zwWnyibG.js → LinkProductSideSheet-BBLfSM53.js} +3 -3
- package/dist/{MenuSetting-Bu6EU16f.js → MenuSetting-d9jbk0M4.js} +5 -5
- package/dist/{PrintRoute-pmRg4C4l.js → PrintRoute-BQCMHXJ9.js} +4 -4
- package/dist/{Product-d5rkdZFG.js → Product-CXt3FaBK.js} +1 -1
- package/dist/{Product.vue_vue_type_script_setup_true_lang-zU4ga8V2.js → Product.vue_vue_type_script_setup_true_lang-C9SXeiW2.js} +13 -13
- package/dist/{ProductInternalTools-CC3obJlW.js → ProductInternalTools-BBNHbRCz.js} +6 -6
- package/dist/{Products-NnHsb6AR.js → Products-CXRSPmS2.js} +11 -11
- package/dist/{Publish-CqypD54y.js → Publish-BOaAkCRE.js} +3 -3
- package/dist/{Recipe-CK0X3dd7.js → Recipe-DUY4qTTX.js} +4 -4
- package/dist/{Scheduler-D38x6oA_.js → Scheduler-BPEWew1d.js} +3 -3
- package/dist/{ServingSequence-D0bTffsw.js → ServingSequence-9JE73A2n.js} +3 -3
- package/dist/{Setting-DC46Uqik.js → Setting-DdL7wa-o.js} +5 -5
- package/dist/{Subcategory-BH4kjlNQ.js → Subcategory-znLDoHOm.js} +4 -4
- package/dist/{Takeaway-cA_6Xpmx.js → Takeaway-CanMCNoK.js} +4 -4
- package/dist/{Takeaway-C_wX_aMw.js → Takeaway-DLc6Pu42.js} +1 -1
- package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-DBSpVaY9.js → Takeaway.vue_vue_type_script_setup_true_lang-DNQTblGJ.js} +5 -5
- package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-Wf2062J_.js → Thumbnail.vue_vue_type_script_setup_true_lang-DqzK9R-0.js} +4 -4
- package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BGk3ao7L.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-734F0DDo.js} +157 -157
- package/dist/{Unit-BpcIb7Fs.js → Unit-DYPVcncJ.js} +2 -2
- package/dist/{Variant-DT6sfZ-F.js → Variant-CPNPsxlY.js} +3 -3
- package/dist/{_id_-DcY9kltL.js → _id_-BtEgjazW.js} +10 -10
- package/dist/{app-Bbw5qDik.js → app-edIuGM5n.js} +1 -1
- package/dist/{app-BeGADnuI.js → app-m5E6HHmB.js} +26 -26
- package/dist/app.js +1 -1
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/history/jsonDiffPatch.d.ts +130 -0
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +3 -3
- package/dist/apps/mf-menu/src/stores/menu.d.ts +0 -1
- package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
- package/dist/assets/{linked-status-j41VBPOC.js → linked-status-CvGzvMr1.js} +2 -2
- package/dist/assets/{override-menu-BntGqRU_.js → override-menu-143sdmgy.js} +2 -2
- package/dist/assets/{validate-menu-CxVhrJ86.js → validate-menu-GPsZur6N.js} +2 -2
- package/dist/{catalog-D6-ZZrEk.js → catalog-DbBOv8uZ.js} +1 -1
- package/dist/{catalogSetting-Bw6hrDjd.js → catalogSetting-OMF_13MG.js} +1 -1
- package/dist/{category-Be4KQ0Dc.js → category-CkHad8Qe.js} +1 -1
- package/dist/{currency-CvbaKcEI.js → currency-DF2AE_Ev.js} +1 -1
- package/dist/{customAttributes-W2k3ZTP0.js → customAttributes-BBq_Rv5r.js} +1 -1
- package/dist/{dayjs.min-B0H2lZEq.js → dayjs.min-Baxvt3jl.js} +1 -1
- package/dist/{index-ChTXF5Wf.js → index-9LDXtBYA.js} +3 -3
- package/dist/{index-Dx2uQ0oK.js → index-BCaofwYh.js} +1 -1
- package/dist/{index-p-a3dKlm.js → index-BgQC1nrS.js} +4 -4
- package/dist/{index-Clor2yi1.js → index-OrBLJRSr.js} +1 -1
- package/dist/{item-DLXfMovw.js → item-BLAE_RCk.js} +386 -386
- package/dist/{jszip.min-CWdZDwkx.js → jszip.min-BMisfLkQ.js} +245 -245
- package/dist/{menu-CpEtH29G.js → menu-3zZmORBk.js} +1 -1
- package/dist/{menu-CToRFpJn.js → menu-k8bqSg47.js} +7 -7
- package/dist/menuV2-BYX-027p.js +1042 -0
- package/dist/{priceTier-DztgXBu3.js → priceTier-znTjAPPz.js} +1 -1
- package/dist/{scheduler-DlH8J5Hn.js → scheduler-DJbCs-IR.js} +4 -4
- package/dist/{subcategory-5gTdlPYc.js → subcategory-CHBqzP1A.js} +2 -2
- package/dist/{toExcel-CXzIh7Dz.js → toExcel-ZjuZ9iuw.js} +2 -2
- package/dist/{unit-I1STL5Hd.js → unit-BYsP3DYD.js} +2 -2
- package/package.json +7 -2
- package/dist/menuV2-BeGyJxY5.js +0 -712
package/dist/menuV2-BeGyJxY5.js
DELETED
|
@@ -1,712 +0,0 @@
|
|
|
1
|
-
import { an as L, H as R, D as k, A as J, ao as W, J as U, I as Y, a8 as w, c as N, X as E, ai as j, ap as Me, aq as Ee, B as Re, aa as ke, ar as Ie, as as Te, a7 as Fe } from "./menu-CToRFpJn.js";
|
|
2
|
-
import { defineStore as Pe } from "pinia";
|
|
3
|
-
import { shallowRef as X, ref as D, computed as h, shallowReactive as Ae, effectScope as Oe, watch as Ve } from "vue";
|
|
4
|
-
import { useCoreStore as z } from "@feedmepos/mf-common";
|
|
5
|
-
import { useSnackbar as Ke } from "@feedmepos/ui-library";
|
|
6
|
-
const Ne = "/assets/linked-status-j41VBPOC.js", xe = "/assets/override-menu-BntGqRU_.js";
|
|
7
|
-
function $e(e) {
|
|
8
|
-
var a;
|
|
9
|
-
const n = R(e), o = (a = n.variant) == null ? void 0 : a.variantCombinations;
|
|
10
|
-
return delete n.variant, delete n.thumbnail, [n, ...o || []];
|
|
11
|
-
}
|
|
12
|
-
function Ue(e, n, o, a) {
|
|
13
|
-
const r = R(n), l = o ? r.modules.catalog.find((_) => _._id === o) : null, d = a ? r.modules.scheduler.find((_) => _._id === a) : null, i = l ? R(l) : void 0, c = o ? r.modules.catalog.filter((_) => _._id !== o) : [], m = d ? R(d) : void 0, f = e.reduce((_, y) => (_[y._id] = $e(y), _), {});
|
|
14
|
-
function v(_ = []) {
|
|
15
|
-
const y = e.map((C) => C._id);
|
|
16
|
-
return [
|
|
17
|
-
..._.filter((C) => !y.includes(C._id)),
|
|
18
|
-
...Object.values(f).flatMap((C) => C)
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
return i && a ? (i.override.scheduler = {
|
|
22
|
-
...i.override.scheduler,
|
|
23
|
-
[a]: {
|
|
24
|
-
...i.override.scheduler[a],
|
|
25
|
-
_id: a,
|
|
26
|
-
items: v(m == null ? void 0 : m.items).map((_) => ({
|
|
27
|
-
..._,
|
|
28
|
-
orderFrom: J.F_ORDER_FROM.enum.ALL
|
|
29
|
-
}))
|
|
30
|
-
}
|
|
31
|
-
}, r.modules.catalog = [...c, i], r) : i ? (i.override.items = {
|
|
32
|
-
...i.override.items,
|
|
33
|
-
...f
|
|
34
|
-
}, r.modules.catalog = [...c, i], r) : m ? (m.items = v(m.items), r.modules.scheduler = [
|
|
35
|
-
...r.modules.scheduler.filter((_) => _._id !== a),
|
|
36
|
-
m
|
|
37
|
-
], r) : {
|
|
38
|
-
...W(),
|
|
39
|
-
modules: {
|
|
40
|
-
...W().modules,
|
|
41
|
-
catalog: r.modules.catalog,
|
|
42
|
-
item: r.modules.item,
|
|
43
|
-
group: r.modules.group,
|
|
44
|
-
scheduler: r.modules.scheduler
|
|
45
|
-
},
|
|
46
|
-
_id: r._id
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function T(e, n, o) {
|
|
50
|
-
var l;
|
|
51
|
-
if (o >= 3) return e;
|
|
52
|
-
const a = n.modules.item.find((d) => d._id === e._id);
|
|
53
|
-
if (!a)
|
|
54
|
-
throw new Error(`_insertItemOverriders - Item not found - ${e._id}`);
|
|
55
|
-
const r = (l = a.groups) == null ? void 0 : l.map((d) => {
|
|
56
|
-
var m, f, v;
|
|
57
|
-
const i = (m = e == null ? void 0 : e.groups) == null ? void 0 : m.find((_) => _._id === d._id);
|
|
58
|
-
let c;
|
|
59
|
-
return i ? c = ((f = d.items) == null ? void 0 : f.map((_) => {
|
|
60
|
-
var C;
|
|
61
|
-
const y = (C = i.items) == null ? void 0 : C.find(
|
|
62
|
-
(I) => I._id === _._id && I.combinationKey === _.combinationKey
|
|
63
|
-
);
|
|
64
|
-
return T(y || _, n, o + 1);
|
|
65
|
-
})) ?? [] : c = ((v = d.items) == null ? void 0 : v.map((_) => T(_, n, o + 1))) ?? [], {
|
|
66
|
-
...d,
|
|
67
|
-
items: c
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
_id: a._id,
|
|
72
|
-
name: e.name || a.name,
|
|
73
|
-
code: e.code || a.code,
|
|
74
|
-
combinationKey: e.combinationKey,
|
|
75
|
-
groups: r
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function De(e, n) {
|
|
79
|
-
const o = e.groups.map((l) => {
|
|
80
|
-
const d = n.modules.group.find((c) => c._id === l._id), i = ((d == null ? void 0 : d.items) || []).map((c) => {
|
|
81
|
-
var v;
|
|
82
|
-
const m = (v = l.items) == null ? void 0 : v.find(
|
|
83
|
-
(_) => _._id === c._id && _.combinationKey === c.combinationKey
|
|
84
|
-
);
|
|
85
|
-
if (m)
|
|
86
|
-
return T(m, n, 1);
|
|
87
|
-
const f = {
|
|
88
|
-
...k.generator.initMenuV4ItemOverrider(),
|
|
89
|
-
_id: c._id,
|
|
90
|
-
combinationKey: c.combinationKey
|
|
91
|
-
};
|
|
92
|
-
return T(f, n, 1);
|
|
93
|
-
});
|
|
94
|
-
return { ...l, items: i };
|
|
95
|
-
}), a = e.variant ? e.variant.variantCombinations.map((l) => T(l, n, 1)) : [], r = {
|
|
96
|
-
...k.generator.initMenuV4ItemOverrider(),
|
|
97
|
-
_id: e._id,
|
|
98
|
-
name: e.name,
|
|
99
|
-
code: e.code,
|
|
100
|
-
groups: o
|
|
101
|
-
};
|
|
102
|
-
return [...a, r];
|
|
103
|
-
}
|
|
104
|
-
function H(e, n) {
|
|
105
|
-
var a;
|
|
106
|
-
if (!n)
|
|
107
|
-
return e;
|
|
108
|
-
const o = { ...e, code: n.code };
|
|
109
|
-
return o.groups = (a = o.groups) == null ? void 0 : a.map((r) => {
|
|
110
|
-
var d, i;
|
|
111
|
-
const l = (d = n.groups) == null ? void 0 : d.find((c) => c._id === r._id);
|
|
112
|
-
return r.items = (i = r.items) == null ? void 0 : i.map((c) => {
|
|
113
|
-
var f;
|
|
114
|
-
const m = (f = l == null ? void 0 : l.items) == null ? void 0 : f.find(
|
|
115
|
-
(v) => v._id === c._id && v.combinationKey === c.combinationKey
|
|
116
|
-
);
|
|
117
|
-
return H(c, m);
|
|
118
|
-
}), r;
|
|
119
|
-
}), o;
|
|
120
|
-
}
|
|
121
|
-
function He(e, n) {
|
|
122
|
-
const o = e.items[n._id];
|
|
123
|
-
n.variant && (n.variant = {
|
|
124
|
-
...n.variant,
|
|
125
|
-
variantCombinations: n.variant.variantCombinations.map((r) => {
|
|
126
|
-
const l = o.find(
|
|
127
|
-
(d) => d._id === r._id && d.combinationKey === r.combinationKey
|
|
128
|
-
);
|
|
129
|
-
if (!l)
|
|
130
|
-
throw new Error(`Item overrider not found - ${r._id} - ${r.combinationKey}`);
|
|
131
|
-
return H(l, r);
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
const a = o.find((r) => !r.combinationKey);
|
|
135
|
-
if (!a)
|
|
136
|
-
throw new Error(`Base item overrider not found - ${n._id}`);
|
|
137
|
-
return n.groups = (a.groups || []).map((r) => {
|
|
138
|
-
var d;
|
|
139
|
-
const l = n.groups.find((i) => i._id === r._id);
|
|
140
|
-
return r.items = (d = r.items) == null ? void 0 : d.map((i) => {
|
|
141
|
-
var m;
|
|
142
|
-
const c = (m = l == null ? void 0 : l.items) == null ? void 0 : m.find(
|
|
143
|
-
(f) => f._id === i._id && f.combinationKey === i.combinationKey
|
|
144
|
-
);
|
|
145
|
-
return H(i, c);
|
|
146
|
-
}), r;
|
|
147
|
-
}), {
|
|
148
|
-
...n,
|
|
149
|
-
price: (a == null ? void 0 : a.price) || n.price
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
async function et(e, n, o, a, r, l = !0) {
|
|
153
|
-
const d = R(o), i = l ? Ue(n, d, a, r) : d, c = n.reduce((v, _) => (v[_._id] = i.modules.item.find((y) => y._id === _._id), v), {}), m = n.reduce((v, _) => {
|
|
154
|
-
const y = _._id;
|
|
155
|
-
return v[y] = De(c[y], e), v;
|
|
156
|
-
}, {}), f = k.getFallbackPrices({
|
|
157
|
-
rawMenu: i,
|
|
158
|
-
items: m,
|
|
159
|
-
catalogId: a || void 0,
|
|
160
|
-
schedulerId: r
|
|
161
|
-
});
|
|
162
|
-
return n.map((v) => {
|
|
163
|
-
const _ = v._id, y = c[_];
|
|
164
|
-
return {
|
|
165
|
-
...He(f, y),
|
|
166
|
-
category: a || r ? y == null ? void 0 : y.category : null
|
|
167
|
-
};
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function tt(e, n) {
|
|
171
|
-
if (e.length === 0) return "";
|
|
172
|
-
const o = e == null ? void 0 : e.split("variant");
|
|
173
|
-
return ((o == null ? void 0 : o.reduce((r, l) => {
|
|
174
|
-
if (l && l.length > 0) {
|
|
175
|
-
const d = `variant${l.split("/")[0]}`, i = l.split("/")[1], m = n.find(
|
|
176
|
-
({ _id: f }) => f === d
|
|
177
|
-
).options.find(({ _id: f }) => f === i);
|
|
178
|
-
r.push(((m == null ? void 0 : m.name) || "").trim());
|
|
179
|
-
}
|
|
180
|
-
return r;
|
|
181
|
-
}, [])) || []).join(" / ");
|
|
182
|
-
}
|
|
183
|
-
const x = /* @__PURE__ */ new Map();
|
|
184
|
-
async function nt(e, n) {
|
|
185
|
-
const o = `${e._id}-${e.updatedAt}-${n}`;
|
|
186
|
-
if (x.has(o))
|
|
187
|
-
return x.get(o);
|
|
188
|
-
const a = await L(
|
|
189
|
-
Ne,
|
|
190
|
-
JSON.stringify({
|
|
191
|
-
menu: e,
|
|
192
|
-
itemId: n
|
|
193
|
-
})
|
|
194
|
-
);
|
|
195
|
-
return x.set(o, a), a;
|
|
196
|
-
}
|
|
197
|
-
async function Q(e, n, o) {
|
|
198
|
-
return await L(xe, {
|
|
199
|
-
menu: e,
|
|
200
|
-
catalogId: n,
|
|
201
|
-
schedulerId: o
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function rt(e, n, o) {
|
|
205
|
-
const a = /* @__PURE__ */ new Set();
|
|
206
|
-
function r(l, d) {
|
|
207
|
-
if (!e || !l || !d || a.has(d)) return !1;
|
|
208
|
-
a.add(d);
|
|
209
|
-
const i = e.modules.item.find((c) => c._id === d);
|
|
210
|
-
return !i || !i.groups ? !1 : i.groups.some((c) => c._id === l) ? !0 : i.groups.some((c) => {
|
|
211
|
-
const m = e.modules.group.find((f) => f._id === c._id);
|
|
212
|
-
for (const f of (m == null ? void 0 : m.items) || [])
|
|
213
|
-
if (r(l, f._id)) return !0;
|
|
214
|
-
return !1;
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return r(n, o);
|
|
218
|
-
}
|
|
219
|
-
function ot(e, n, o) {
|
|
220
|
-
const a = /* @__PURE__ */ new Set();
|
|
221
|
-
function r(l, d) {
|
|
222
|
-
if (!e || !l || !d || a.has(l)) return !1;
|
|
223
|
-
a.add(l);
|
|
224
|
-
const i = e.modules.group.find((c) => c._id === l);
|
|
225
|
-
return !i || !i.items ? !1 : i.items.some((c) => c._id === d) ? !0 : i.items.some((c) => {
|
|
226
|
-
const m = e.modules.item.find((f) => f._id === c._id);
|
|
227
|
-
for (const f of (m == null ? void 0 : m.groups) || [])
|
|
228
|
-
if (r(f._id, d)) return !0;
|
|
229
|
-
return !1;
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return r(n, o);
|
|
233
|
-
}
|
|
234
|
-
const $ = /* @__PURE__ */ new Map();
|
|
235
|
-
async function Be(e, n, o) {
|
|
236
|
-
const a = `${e._id}-${e.updatedAt}-${n || "null"}-${o || "null"}`;
|
|
237
|
-
if ($.has(a))
|
|
238
|
-
return $.get(a);
|
|
239
|
-
const r = await Q(e, n, o);
|
|
240
|
-
return $.set(a, r), r;
|
|
241
|
-
}
|
|
242
|
-
async function st(e, n, o) {
|
|
243
|
-
var d, i;
|
|
244
|
-
const a = await Be(e, n, null), r = [], l = (c, m) => {
|
|
245
|
-
const f = R(c);
|
|
246
|
-
for (const v in m)
|
|
247
|
-
m[v] && (f[v] = m[v]);
|
|
248
|
-
return f;
|
|
249
|
-
};
|
|
250
|
-
for (const c of a.modules.group) {
|
|
251
|
-
const m = (d = c.items) == null ? void 0 : d.find((v) => v._id === o && !v.combinationKey), f = e.modules.item.find((v) => v._id === o);
|
|
252
|
-
if (m) {
|
|
253
|
-
const v = (i = c.items) == null ? void 0 : i.filter((y) => y._id === o && y.combinationKey), _ = [m, ...v].map((y) => {
|
|
254
|
-
var F, P;
|
|
255
|
-
const C = y.combinationKey ? (P = (F = f == null ? void 0 : f.variant) == null ? void 0 : F.variantCombinations) == null ? void 0 : P.find(
|
|
256
|
-
(A) => A.combinationKey === y.combinationKey
|
|
257
|
-
) : f, I = C && f ? l(f, C) : y;
|
|
258
|
-
return l(I, y);
|
|
259
|
-
});
|
|
260
|
-
r.push({
|
|
261
|
-
group: c,
|
|
262
|
-
items: _
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return r;
|
|
267
|
-
}
|
|
268
|
-
function Ge({
|
|
269
|
-
maxHistorySize: e = 50
|
|
270
|
-
}) {
|
|
271
|
-
const n = X([]), o = D(-1), a = h(() => o.value > 0), r = h(() => o.value < n.value.length - 1);
|
|
272
|
-
function l(m) {
|
|
273
|
-
n.value.push(m), o.value++, n.value.length > e && (n.value.shift(), o.value--);
|
|
274
|
-
}
|
|
275
|
-
function d() {
|
|
276
|
-
if (a.value)
|
|
277
|
-
return o.value--, n.value[o.value];
|
|
278
|
-
}
|
|
279
|
-
function i() {
|
|
280
|
-
if (r.value)
|
|
281
|
-
return o.value++, n.value[o.value];
|
|
282
|
-
}
|
|
283
|
-
function c() {
|
|
284
|
-
n.value = [], o.value = -1;
|
|
285
|
-
}
|
|
286
|
-
return {
|
|
287
|
-
push: l,
|
|
288
|
-
canUndo: a,
|
|
289
|
-
canRedo: r,
|
|
290
|
-
undo: d,
|
|
291
|
-
redo: i,
|
|
292
|
-
clear: c
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
const qe = {
|
|
296
|
-
async updateMenuModule(e, n) {
|
|
297
|
-
const o = U.RequestRunner.operation(n, e.modules);
|
|
298
|
-
if (o.validateError.length > 0)
|
|
299
|
-
throw new Error(o.validateError.join(`
|
|
300
|
-
`));
|
|
301
|
-
const a = {
|
|
302
|
-
...e,
|
|
303
|
-
modules: o.result || e.modules,
|
|
304
|
-
_rev: o.id ?? ""
|
|
305
|
-
};
|
|
306
|
-
return Y.cloneDeep({ menu: a, updateId: o.id ?? null });
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
function Z() {
|
|
310
|
-
return {
|
|
311
|
-
_id: "",
|
|
312
|
-
masterCatalogSetting: { inclusiveTaxes: [] },
|
|
313
|
-
modules: {
|
|
314
|
-
catalog: [],
|
|
315
|
-
category: [],
|
|
316
|
-
group: [],
|
|
317
|
-
item: [],
|
|
318
|
-
printDepartment: [],
|
|
319
|
-
scheduler: [],
|
|
320
|
-
takeaway: [],
|
|
321
|
-
variant: [],
|
|
322
|
-
sku: [],
|
|
323
|
-
recipe: [],
|
|
324
|
-
unit: [],
|
|
325
|
-
cookingGuide: [],
|
|
326
|
-
serveSequence: [],
|
|
327
|
-
subCategory: []
|
|
328
|
-
},
|
|
329
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
function We() {
|
|
333
|
-
return {
|
|
334
|
-
restaurants: [],
|
|
335
|
-
menu: { ...Z(), _rev: "" },
|
|
336
|
-
currentCatalogId: null,
|
|
337
|
-
currentCategoryIds: null,
|
|
338
|
-
currentSchedulerId: "",
|
|
339
|
-
currentRestaurantAttrParams: {
|
|
340
|
-
restaurantCustomAttributes: null,
|
|
341
|
-
restaurantAttributes: null
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
const at = Pe(
|
|
346
|
-
"mf-menu-store-v2",
|
|
347
|
-
() => {
|
|
348
|
-
const e = Ae(We()), n = z(), o = Ke(), a = h(() => e.menu.modules.serveSequence ? w(e.menu.modules.serveSequence, {
|
|
349
|
-
selector: "position"
|
|
350
|
-
}) : []), r = h(() => {
|
|
351
|
-
var t;
|
|
352
|
-
return ((t = n.currentBusiness.value) == null ? void 0 : t.menuVersion) || N.F_MENU_VERSION.v3;
|
|
353
|
-
}), l = h(() => r.value === N.F_MENU_VERSION.v4), d = h(() => {
|
|
354
|
-
const t = e.menu.modules.catalog;
|
|
355
|
-
return w(t, { selector: "name" });
|
|
356
|
-
}), i = h(() => {
|
|
357
|
-
var s;
|
|
358
|
-
let t = e.menu.modules.catalog.find(
|
|
359
|
-
(u) => u._id === e.currentCatalogId
|
|
360
|
-
);
|
|
361
|
-
return t && ((s = t.linkItemRules) != null && s.length) && (t = k.populateCatalog({
|
|
362
|
-
catalog: t,
|
|
363
|
-
ruleGroupSettings: e.menu.ruleGroupSettings,
|
|
364
|
-
items: e.menu.modules.item,
|
|
365
|
-
...e.currentRestaurantAttrParams ?? {}
|
|
366
|
-
})), t;
|
|
367
|
-
}), c = h(() => w(v.value.modules.scheduler, { selector: "name" })), m = h(() => e.menu.modules.scheduler.find(
|
|
368
|
-
(t) => t._id === e.currentSchedulerId
|
|
369
|
-
));
|
|
370
|
-
function f(t, s = !0) {
|
|
371
|
-
e.menu = { ...t, _rev: e.menu._rev }, s && M.push(e.menu);
|
|
372
|
-
}
|
|
373
|
-
const v = X(Z()), _ = D(!1), y = D(1);
|
|
374
|
-
async function C() {
|
|
375
|
-
var u;
|
|
376
|
-
_.value = !0;
|
|
377
|
-
let t = e.menu.modules.catalog;
|
|
378
|
-
if (i.value && ((u = i.value.linkItemRules) != null && u.length)) {
|
|
379
|
-
const p = k.populateCatalog({
|
|
380
|
-
catalog: i.value,
|
|
381
|
-
ruleGroupSettings: e.menu.ruleGroupSettings,
|
|
382
|
-
items: e.menu.modules.item,
|
|
383
|
-
...e.currentRestaurantAttrParams ?? {}
|
|
384
|
-
});
|
|
385
|
-
t = e.menu.modules.catalog.map((g) => g._id === (p == null ? void 0 : p._id) ? p : g);
|
|
386
|
-
}
|
|
387
|
-
const s = await Q(
|
|
388
|
-
{
|
|
389
|
-
...e.menu,
|
|
390
|
-
modules: {
|
|
391
|
-
...e.menu.modules,
|
|
392
|
-
catalog: t
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
e.currentCatalogId,
|
|
396
|
-
e.currentSchedulerId
|
|
397
|
-
);
|
|
398
|
-
if (e.currentSchedulerId != null) {
|
|
399
|
-
const p = e.menu.modules.catalog.find(
|
|
400
|
-
(b) => b._id === e.currentCatalogId
|
|
401
|
-
), g = p ? p.override.scheduler[e.currentSchedulerId] : e.menu.modules.scheduler.find(
|
|
402
|
-
(b) => b._id === e.currentSchedulerId
|
|
403
|
-
), S = new Set(((g == null ? void 0 : g.items) || []).map((b) => b._id));
|
|
404
|
-
s.modules.item = s.modules.item.filter((b) => S.has(b._id));
|
|
405
|
-
}
|
|
406
|
-
return v.value = s, _.value = !1, y.value = y.value + 1, s;
|
|
407
|
-
}
|
|
408
|
-
const F = Y.debounce(C, 200);
|
|
409
|
-
Oe(!0).run(() => {
|
|
410
|
-
Ve(
|
|
411
|
-
() => [e.menu, e.currentCatalogId, e.currentSchedulerId],
|
|
412
|
-
() => {
|
|
413
|
-
_.value || F();
|
|
414
|
-
}
|
|
415
|
-
);
|
|
416
|
-
});
|
|
417
|
-
const A = h(() => [
|
|
418
|
-
{
|
|
419
|
-
label: "Main",
|
|
420
|
-
value: null
|
|
421
|
-
},
|
|
422
|
-
...d.value.map((t) => ({
|
|
423
|
-
label: t.name,
|
|
424
|
-
value: t._id
|
|
425
|
-
}))
|
|
426
|
-
]), B = h(() => {
|
|
427
|
-
const t = v.value.modules.category;
|
|
428
|
-
return [
|
|
429
|
-
...V.value.item.addon ? [
|
|
430
|
-
{
|
|
431
|
-
_id: e.currentCatalogId ? "" : null,
|
|
432
|
-
name: "Addon",
|
|
433
|
-
position: 0
|
|
434
|
-
}
|
|
435
|
-
] : [],
|
|
436
|
-
...E(t, (s) => s.name)
|
|
437
|
-
];
|
|
438
|
-
}), ee = h(() => {
|
|
439
|
-
const t = v.value.modules.subCategory || [];
|
|
440
|
-
return E(t, (s) => s.name);
|
|
441
|
-
}), G = h(() => {
|
|
442
|
-
var s;
|
|
443
|
-
let t = v.value.modules.item;
|
|
444
|
-
if (i.value) {
|
|
445
|
-
const u = (s = i.value) == null ? void 0 : s.override.items;
|
|
446
|
-
t = t.filter((p) => {
|
|
447
|
-
var S;
|
|
448
|
-
const g = (S = u == null ? void 0 : u[p._id]) == null ? void 0 : S.find(
|
|
449
|
-
(b) => !b.combinationKey
|
|
450
|
-
);
|
|
451
|
-
return (g == null ? void 0 : g.orderFrom) !== J.F_ORDER_FROM.enum.NONE;
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
return E(t, (u) => u.code || u.name);
|
|
455
|
-
}), te = h(() => {
|
|
456
|
-
const t = e.menu.modules.category, s = E(t, (p) => p.name).reduce(
|
|
457
|
-
(p, g, S) => (p[g._id] = S, p),
|
|
458
|
-
{ "": 0 }
|
|
459
|
-
), u = e.menu.modules.item;
|
|
460
|
-
return E(
|
|
461
|
-
u,
|
|
462
|
-
(p) => p.code || p.name
|
|
463
|
-
).reduce((p, g, S) => (p[g._id] = S + s[g.category || ""], p), {});
|
|
464
|
-
}), ne = h(() => j(O.value, B.value, G.value)), re = h(() => {
|
|
465
|
-
const t = V.value.item.addon ? [
|
|
466
|
-
{
|
|
467
|
-
_id: e.currentCatalogId ? "" : null,
|
|
468
|
-
name: "Addon",
|
|
469
|
-
position: 0
|
|
470
|
-
},
|
|
471
|
-
...e.menu.modules.category
|
|
472
|
-
] : e.menu.modules.category;
|
|
473
|
-
return j(
|
|
474
|
-
e.menu.modules.variant,
|
|
475
|
-
t,
|
|
476
|
-
e.menu.modules.item
|
|
477
|
-
);
|
|
478
|
-
}), O = h(() => {
|
|
479
|
-
const t = v.value.modules.variant;
|
|
480
|
-
return w(t, { selector: "name" });
|
|
481
|
-
});
|
|
482
|
-
function oe(t = []) {
|
|
483
|
-
const s = t.map((p) => O.value.find((g) => g._id === p)).filter((p) => !!p);
|
|
484
|
-
return k.fullVariantCombination(s).reduce((p, g) => (p[g.combinationKey] = g.selectionName.join(" / "), p), {});
|
|
485
|
-
}
|
|
486
|
-
const se = h(() => E(v.value.modules.group, (t) => t.name)), ae = h(() => w(v.value.modules.takeaway, { selector: "name" })), ue = h(() => w(e.menu.modules.printDepartment || [], {
|
|
487
|
-
selector: "name"
|
|
488
|
-
})), ie = h(() => w(e.menu.modules.unit, { selector: "name" })), ce = h(() => w(Me(e.menu.modules.recipe, e.menu.modules.sku), {
|
|
489
|
-
selector: "name"
|
|
490
|
-
})), le = h(() => e.menu.modules.cookingGuide), de = h(() => {
|
|
491
|
-
const t = Ee(e.menu.modules.sku);
|
|
492
|
-
return w(t, { selector: "code" });
|
|
493
|
-
}), V = h(() => {
|
|
494
|
-
const t = !e.currentCatalogId, s = r.value === N.F_MENU_VERSION.v4, u = !e.currentSchedulerId, p = {
|
|
495
|
-
create: t && u,
|
|
496
|
-
edit: t && u,
|
|
497
|
-
delete: t && u
|
|
498
|
-
};
|
|
499
|
-
return {
|
|
500
|
-
item: {
|
|
501
|
-
...p,
|
|
502
|
-
edit: s || u,
|
|
503
|
-
sort: s && t && u,
|
|
504
|
-
addon: s,
|
|
505
|
-
code: u,
|
|
506
|
-
name: t && u,
|
|
507
|
-
description: t && u,
|
|
508
|
-
category: u,
|
|
509
|
-
thumbnail: t && u,
|
|
510
|
-
orderFrom: (s || t) && u,
|
|
511
|
-
orderFromNone: t,
|
|
512
|
-
orderFromActiveOnly: !s,
|
|
513
|
-
openPrice: t && u,
|
|
514
|
-
unit: t && u,
|
|
515
|
-
price: t,
|
|
516
|
-
editPrice: t,
|
|
517
|
-
minPrice: s && u,
|
|
518
|
-
costing: s && t && u,
|
|
519
|
-
tax: t && u,
|
|
520
|
-
variant: t && u,
|
|
521
|
-
maxVariant: s ? 4 : 2,
|
|
522
|
-
group: t && u,
|
|
523
|
-
overrideProductGroup: s && u,
|
|
524
|
-
inventory: (s || t) && u,
|
|
525
|
-
bindToVariant: s,
|
|
526
|
-
print: t && u,
|
|
527
|
-
toRoot: s && u,
|
|
528
|
-
takeaway: (g) => !!g && (s || t) && u,
|
|
529
|
-
multiScheduler: s,
|
|
530
|
-
canRearrange: s,
|
|
531
|
-
printConfig: s
|
|
532
|
-
},
|
|
533
|
-
category: {
|
|
534
|
-
...p,
|
|
535
|
-
sort: t
|
|
536
|
-
},
|
|
537
|
-
group: {
|
|
538
|
-
...p,
|
|
539
|
-
edit: s || u,
|
|
540
|
-
sort: t,
|
|
541
|
-
applyProduct: t,
|
|
542
|
-
showAppliedProduct: u,
|
|
543
|
-
type: !s,
|
|
544
|
-
insertRawItems: !s,
|
|
545
|
-
multiScheduler: s
|
|
546
|
-
},
|
|
547
|
-
scheduler: {
|
|
548
|
-
override: s
|
|
549
|
-
},
|
|
550
|
-
takeaway: {
|
|
551
|
-
...p,
|
|
552
|
-
edit: (s || t) && u,
|
|
553
|
-
name: t
|
|
554
|
-
},
|
|
555
|
-
catalog: {
|
|
556
|
-
name: !t,
|
|
557
|
-
defaultOrderFrom: s,
|
|
558
|
-
markup: s
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
});
|
|
562
|
-
function K(t) {
|
|
563
|
-
return `${t.systemCode}/${t.taxCode}`;
|
|
564
|
-
}
|
|
565
|
-
function me(t) {
|
|
566
|
-
const [s, u] = t.split("/");
|
|
567
|
-
return { systemCode: s, taxCode: u };
|
|
568
|
-
}
|
|
569
|
-
function fe(t, s, u) {
|
|
570
|
-
return (t ?? s ?? []).map((p) => K(p)).find((p) => u.some((g) => g.value === p));
|
|
571
|
-
}
|
|
572
|
-
const pe = h(() => {
|
|
573
|
-
var p;
|
|
574
|
-
const t = ["SV5", "SV10"], s = Re.Country.getCountryFlattenTaxes(
|
|
575
|
-
z().currentCountry.value
|
|
576
|
-
), u = s.filter((g) => l.value || !t.includes(g.taxCode)).map((g) => ({
|
|
577
|
-
label: `${g.name} (${ke(g.rate)}%)`,
|
|
578
|
-
value: K(g),
|
|
579
|
-
meta: {
|
|
580
|
-
rate: g.rate
|
|
581
|
-
}
|
|
582
|
-
}));
|
|
583
|
-
return u.sort((g, S) => g.label.localeCompare(S.label, void 0, { numeric: !0 })), {
|
|
584
|
-
systemCode: (p = s[0]) == null ? void 0 : p.systemCode,
|
|
585
|
-
countryTaxOptions: u
|
|
586
|
-
};
|
|
587
|
-
}), ve = async () => {
|
|
588
|
-
const t = await Fe.readMenu();
|
|
589
|
-
e.menu = t ?? e.menu, q(null);
|
|
590
|
-
}, ge = async () => {
|
|
591
|
-
const { fetchAllRestaurants: t } = Te();
|
|
592
|
-
await t({
|
|
593
|
-
onBatchEnd: (s) => {
|
|
594
|
-
e.restaurants = s;
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
}, q = (t) => {
|
|
598
|
-
e.currentCatalogId = t;
|
|
599
|
-
}, _e = (t) => {
|
|
600
|
-
e.currentSchedulerId = t;
|
|
601
|
-
}, ye = (t) => {
|
|
602
|
-
e.currentCategoryIds = t;
|
|
603
|
-
}, he = (t) => {
|
|
604
|
-
e.currentRestaurantAttrParams = t;
|
|
605
|
-
}, Se = async (t, s) => {
|
|
606
|
-
const u = Array.isArray(t) ? t : [t];
|
|
607
|
-
if (!u.length) return;
|
|
608
|
-
const p = u.map((g) => ({
|
|
609
|
-
...g,
|
|
610
|
-
_id: e.menu._id,
|
|
611
|
-
_rev: e.menu._rev
|
|
612
|
-
}));
|
|
613
|
-
try {
|
|
614
|
-
if (s || p.some(
|
|
615
|
-
(S) => [U.F_OPERATION_TYPE.delete, U.F_OPERATION_TYPE.deleteMany].includes(S.operation)
|
|
616
|
-
)) {
|
|
617
|
-
const S = await Ie(p, e.menu.modules);
|
|
618
|
-
if (S !== !0) throw new Error(S);
|
|
619
|
-
}
|
|
620
|
-
const g = await qe.updateMenuModule(e.menu, p);
|
|
621
|
-
return f(g.menu), g;
|
|
622
|
-
} catch (g) {
|
|
623
|
-
o.open({
|
|
624
|
-
type: "error",
|
|
625
|
-
title: "Failed to update menu",
|
|
626
|
-
message: g
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
}, Ce = async (t) => {
|
|
630
|
-
const s = {
|
|
631
|
-
...e.menu,
|
|
632
|
-
masterCatalogSetting: t.masterCatalogSetting,
|
|
633
|
-
lowStockThreshold: t.lowStockThreshold,
|
|
634
|
-
priceTierSettings: t.priceTierSettings
|
|
635
|
-
};
|
|
636
|
-
return f(s), s;
|
|
637
|
-
}, M = Ge({ maxHistorySize: 50 }), be = h(() => M.canUndo.value), we = h(() => M.canRedo.value);
|
|
638
|
-
return {
|
|
639
|
-
state: e,
|
|
640
|
-
// loading state
|
|
641
|
-
workerIsComputing: _,
|
|
642
|
-
mergedMenuChangeId: y,
|
|
643
|
-
// async computed state
|
|
644
|
-
mergedMenu: v,
|
|
645
|
-
// Computed
|
|
646
|
-
version: r,
|
|
647
|
-
isV4: l,
|
|
648
|
-
serveSequence: a,
|
|
649
|
-
catalogs: d,
|
|
650
|
-
currentCatalog: i,
|
|
651
|
-
schedulers: c,
|
|
652
|
-
currentScheduler: m,
|
|
653
|
-
catalogOptions: A,
|
|
654
|
-
categories: B,
|
|
655
|
-
subcategories: ee,
|
|
656
|
-
items: G,
|
|
657
|
-
sortedItems: te,
|
|
658
|
-
categorizedItems: ne,
|
|
659
|
-
categorizedRawMenuItems: re,
|
|
660
|
-
variants: O,
|
|
661
|
-
groups: se,
|
|
662
|
-
takeaways: ae,
|
|
663
|
-
printDepartments: ue,
|
|
664
|
-
units: ie,
|
|
665
|
-
recipes: ce,
|
|
666
|
-
cookingGuide: le,
|
|
667
|
-
skus: de,
|
|
668
|
-
rules: V,
|
|
669
|
-
taxSetting: pe,
|
|
670
|
-
// Action
|
|
671
|
-
setMenu: f,
|
|
672
|
-
readMenu: ve,
|
|
673
|
-
readRestaurants: ge,
|
|
674
|
-
selectCatalog: q,
|
|
675
|
-
selectScheduler: _e,
|
|
676
|
-
selectCategory: ye,
|
|
677
|
-
setRestaurantAttrParams: he,
|
|
678
|
-
updateMenu: Se,
|
|
679
|
-
updateMenuSetting: Ce,
|
|
680
|
-
computeMergedMenu: C,
|
|
681
|
-
// helper
|
|
682
|
-
encodeTax: K,
|
|
683
|
-
decodeTax: me,
|
|
684
|
-
getSelectedTax: fe,
|
|
685
|
-
mapVariant: oe,
|
|
686
|
-
// history
|
|
687
|
-
canUndoHistory: be,
|
|
688
|
-
canRedoHistory: we,
|
|
689
|
-
undoHistory: () => {
|
|
690
|
-
const t = M.undo();
|
|
691
|
-
t && f(t, !1);
|
|
692
|
-
},
|
|
693
|
-
redoHistory: () => {
|
|
694
|
-
const t = M.redo();
|
|
695
|
-
t && f(t, !1);
|
|
696
|
-
},
|
|
697
|
-
clearHistory: () => {
|
|
698
|
-
M.clear();
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
);
|
|
703
|
-
export {
|
|
704
|
-
nt as a,
|
|
705
|
-
rt as b,
|
|
706
|
-
ot as c,
|
|
707
|
-
st as f,
|
|
708
|
-
tt as g,
|
|
709
|
-
et as m,
|
|
710
|
-
Be as o,
|
|
711
|
-
at as u
|
|
712
|
-
};
|