@feedmepos/mf-menu 0.31.33 → 0.31.34-alpha
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-DNDOc3bV.js → App-CaKDbV0S.js} +6 -6
- package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BvrfcWHU.js → ApplyProduct.vue_vue_type_script_setup_true_lang-gY18sRMg.js} +20 -20
- package/dist/{Catalog-Zhi-3W6T.js → Catalog-B0zMoi7e.js} +80 -80
- package/dist/{Category-BU0bkAGd.js → Category-Dyou6Q17.js} +31 -27
- package/dist/{Category-CE9ixFkD.js → Category-rMN8037Q.js} +19 -19
- package/dist/{CookingGuide-eghVaeEY.js → CookingGuide-DT2XxaWa.js} +4 -4
- package/dist/CustomAttributeChip.vue_vue_type_script_setup_true_lang-Cv9LNAfi.js +113 -0
- package/dist/{Group-DWrtP9Au.js → Group-CYSIOe3D.js} +1 -1
- package/dist/{Group-DDZPf6LY.js → Group-M4WPAAYz.js} +3 -3
- package/dist/Group.vue_vue_type_script_setup_true_lang-B-BH-2WN.js +686 -0
- package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-TQWka93A.js +367 -0
- package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Cus0YKUt.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DgSO7SQW.js} +4982 -5081
- package/dist/{Ingredient-BJgvOyV9.js → Ingredient-DNvr30pW.js} +3 -3
- package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-CF99abLi.js → InventoryBinding.vue_vue_type_script_setup_true_lang-G44luws0.js} +1052 -1052
- package/dist/LinkProductSideSheet-Cp0HFoP2.js +297 -0
- package/dist/LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js +8024 -0
- package/dist/{MenuSetting-gkwORUX0.js → MenuSetting-UeQ2NyVm.js} +4 -4
- package/dist/{PrintRoute-Cda6sFlL.js → PrintRoute-5uX9ymJY.js} +89 -88
- package/dist/{Product-61AAh5L-.js → Product-Dxqf8_iq.js} +1 -1
- package/dist/Product.vue_vue_type_script_setup_true_lang-DUtGVRCH.js +1578 -0
- package/dist/{ProductInternalTools-o8cVZXCT.js → ProductInternalTools-BCF9q0i_.js} +5 -5
- package/dist/Products--adhOQ8n.js +283 -0
- package/dist/{Publish-BRgJUzoA.js → Publish-CRaoaFxc.js} +3 -3
- package/dist/{Recipe-CV8lvryp.js → Recipe-DPkzZMJi.js} +4 -4
- package/dist/{Scheduler-B_ptvb82.js → Scheduler-BuwjNHHj.js} +3 -3
- package/dist/{ServingSequence-DABGnLbT.js → ServingSequence-Cdf_Zmat.js} +3 -3
- package/dist/Setting-Vr3Thttm.js +259 -0
- package/dist/{Subcategory-BiqlAvMs.js → Subcategory-DoXmjcg1.js} +4 -4
- package/dist/{Takeaway-BBdkzEiP.js → Takeaway-BRTQu8VT.js} +1 -1
- package/dist/{Takeaway-nIjrDu5C.js → Takeaway-t3il54Bd.js} +4 -4
- package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-D_M2PFO-.js → Takeaway.vue_vue_type_script_setup_true_lang-DtHABSgp.js} +6 -6
- package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-D_ACNj_Z.js +431 -0
- package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DAoGiRV-.js +5990 -0
- package/dist/{Unit-Di5sUbhV.js → Unit-C_QY3IX_.js} +2 -2
- package/dist/{Variant-CiZCtZk9.js → Variant-CR4IEm-Q.js} +3 -3
- package/dist/_id_-DOU7ieGB.js +202 -0
- package/dist/{app-B63V5b4I.js → app--fRC3N4C.js} +1 -1
- package/dist/{app-DuD_IPou.js → app-CrXLAKdw.js} +95 -97
- package/dist/app.js +6 -7
- package/dist/apps/mf-menu/src/app.d.ts +62 -3
- package/dist/apps/mf-menu/src/components/feature/PriceTier/LinkPriceTierSection.vue.d.ts +24 -0
- package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +30 -0
- package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +33 -0
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/catalog.d.ts +2 -0
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +80 -1
- package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +1276 -0
- package/dist/apps/mf-menu/src/helper/import-export.d.ts +77 -0
- package/dist/apps/mf-menu/src/helper/menu.d.ts +77 -0
- package/dist/apps/mf-menu/src/helper/setting/catalogSetting.d.ts +11 -2
- package/dist/apps/mf-menu/src/manager/menu/item.d.ts +77 -0
- package/dist/apps/mf-menu/src/router/shared.d.ts +0 -1
- package/dist/apps/mf-menu/src/stores/manager/catalog.d.ts +2 -0
- package/dist/apps/mf-menu/src/stores/menu.d.ts +79 -0
- package/dist/apps/mf-menu/src/types/linkProducts.d.ts +21 -0
- package/dist/apps/mf-menu/src/views/PrintRoute/PrintDepartmentDialog.vue.d.ts +5 -3
- package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +82 -0
- package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
- package/dist/assets/linked-status-BTF_dm9R.js +24 -0
- package/dist/assets/override-menu-BPu7TVCy.js +24 -0
- package/dist/assets/validate-menu-BQpDfHbr.js +24 -0
- package/dist/{catalog-DfYSMjLc.js → catalog-BGiDWODL.js} +1 -1
- package/dist/catalogSetting-C34kIcYn.js +71 -0
- package/dist/{category-mmjX_QdF.js → category-CayMSpUc.js} +1 -1
- package/dist/{currency-3ugQtBPt.js → currency-BggoZpJv.js} +1 -1
- package/dist/{dayjs.min-CkV4mNm8.js → dayjs.min-BKDTLohL.js} +1 -1
- package/dist/{index-Cztb2LVZ.js → index-BPcRbiW0.js} +3 -3
- package/dist/{index-BboaHtmY.js → index-CLFhXi0y.js} +3 -3
- package/dist/index-D7yR1j9C.js +215 -0
- package/dist/{index-BZaKuDcN.js → index-f9kzXNPD.js} +28 -28
- package/dist/{item-CVnDeXhJ.js → item-C51o9ejv.js} +547 -545
- package/dist/{jszip.min-GxfcHBC5.js → jszip.min-m57vowh9.js} +353 -353
- package/dist/{menu-sGVv4bhQ.js → menu-DHfLxvzU.js} +4 -4
- package/dist/menu-DK7wG3S5.js +133287 -0
- package/dist/menuV2-B-0V65cx.js +707 -0
- package/dist/mf-menu.css +1 -1
- package/dist/{priceTier-CHTA0ZEb.js → priceTier-DD-24pkj.js} +1 -1
- package/dist/{scheduler-CaMxCHZ0.js → scheduler-NjDv_P4c.js} +16 -17
- package/dist/subcategory-DLdBwjHV.js +148 -0
- package/dist/{toExcel-WorodvP1.js → toExcel-coJ5igRV.js} +15 -15
- package/dist/{unit-DtKZZYL6.js → unit-C7XUV0EW.js} +5 -4
- package/package.json +5 -5
- package/dist/CustomAttributeChip.vue_vue_type_script_setup_true_lang-BiF8rW4M.js +0 -7949
- package/dist/FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js +0 -26
- package/dist/Group.vue_vue_type_script_setup_true_lang-DyqGsRAW.js +0 -698
- package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BmRUg94d.js +0 -206
- package/dist/LinkProductSideSheet-CTT4oGUY.js +0 -112
- package/dist/Product.vue_vue_type_script_setup_true_lang-Cy4uok1E.js +0 -1560
- package/dist/Products-D0rrANT6.js +0 -270
- package/dist/Setting-3ISlMXOA.js +0 -258
- package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-DzQ8_6Bi.js +0 -71
- package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-y0n5hTLk.js +0 -6149
- package/dist/_id_-DY8himeL.js +0 -200
- package/dist/apps/mf-menu/src/components/feature/LinkProduct/LinkProductSideSheet.vue.d.ts +0 -70
- package/dist/assets/linked-status-CkBKnMXs.js +0 -24
- package/dist/assets/override-menu-XZ7XfcfS.js +0 -24
- package/dist/assets/validate-menu-Bomogq01.js +0 -24
- package/dist/catalogSetting-_4Z0s3_Q.js +0 -65
- package/dist/index-Ce4v8o7D.js +0 -106
- package/dist/menu-IGORh0Ik.js +0 -108039
- package/dist/subcategory-CmVttqlG.js +0 -817
- /package/dist/{apps/mf-menu/src/components → packages/shared/src/components/info}/CustomAttributeChip.vue.d.ts +0 -0
|
@@ -1,817 +0,0 @@
|
|
|
1
|
-
import { shallowRef as Z, ref as T, computed as h, shallowReactive as Fe, effectScope as Re, watch as H, defineComponent as Te, resolveComponent as z, createBlock as Ve, openBlock as Ne, unref as N, withCtx as Oe, createVNode as xe } from "vue";
|
|
2
|
-
import { H as k, B as O, ak as Q, G as I, al as G, J as S, I as ee, aa as M, c as D, Y as w, aj as L, am as Pe, an as Ae, A as Ke, ac as Ue, ao as De, ap as $e, a9 as qe, u as He } from "./menu-IGORh0Ik.js";
|
|
3
|
-
import { useCoreStore as X, useI18n as te } from "@feedmepos/mf-common";
|
|
4
|
-
import { useSnackbar as Ye, useDialogChild as Be } from "@feedmepos/ui-library";
|
|
5
|
-
import { defineStore as We } from "pinia";
|
|
6
|
-
const je = "/assets/linked-status-CkBKnMXs.js", ze = "/assets/override-menu-XZ7XfcfS.js";
|
|
7
|
-
function Ge(e) {
|
|
8
|
-
var o;
|
|
9
|
-
const n = k(e), a = (o = n.variant) == null ? void 0 : o.variantCombinations;
|
|
10
|
-
return delete n.variant, delete n.thumbnail, [n, ...a || []];
|
|
11
|
-
}
|
|
12
|
-
function Le(e, n, a, o) {
|
|
13
|
-
const r = k(n), m = a ? r.modules.catalog.find((g) => g._id === a) : null, l = o ? r.modules.scheduler.find((g) => g._id === o) : null, i = m ? k(m) : void 0, d = a ? r.modules.catalog.filter((g) => g._id !== a) : [], u = l ? k(l) : void 0, s = e.reduce((g, y) => (g[y._id] = Ge(y), g), {});
|
|
14
|
-
function p(g = []) {
|
|
15
|
-
const y = e.map((b) => b._id);
|
|
16
|
-
return [
|
|
17
|
-
...g.filter((b) => !y.includes(b._id)),
|
|
18
|
-
...Object.values(s).flatMap((b) => b)
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
return i && o ? (i.override.scheduler = {
|
|
22
|
-
...i.override.scheduler,
|
|
23
|
-
[o]: {
|
|
24
|
-
...i.override.scheduler[o],
|
|
25
|
-
_id: o,
|
|
26
|
-
items: p(u == null ? void 0 : u.items).map((g) => ({
|
|
27
|
-
...g,
|
|
28
|
-
orderFrom: I.F_ORDER_FROM.enum.ALL
|
|
29
|
-
}))
|
|
30
|
-
}
|
|
31
|
-
}, r.modules.catalog = [...d, i], r) : i ? (i.override.items = {
|
|
32
|
-
...i.override.items,
|
|
33
|
-
...s
|
|
34
|
-
}, r.modules.catalog = [...d, i], r) : u ? (u.items = p(u.items), r.modules.scheduler = [
|
|
35
|
-
...r.modules.scheduler.filter((g) => g._id !== o),
|
|
36
|
-
u
|
|
37
|
-
], r) : {
|
|
38
|
-
...G(),
|
|
39
|
-
modules: {
|
|
40
|
-
...G().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 R(e, n, a) {
|
|
50
|
-
var m;
|
|
51
|
-
if (a >= 3) return e;
|
|
52
|
-
const o = n.modules.item.find((l) => l._id === e._id);
|
|
53
|
-
if (!o)
|
|
54
|
-
throw new Error(`_insertItemOverriders - Item not found - ${e._id}`);
|
|
55
|
-
const r = (m = o.groups) == null ? void 0 : m.map((l) => {
|
|
56
|
-
var u, s, p;
|
|
57
|
-
const i = (u = e == null ? void 0 : e.groups) == null ? void 0 : u.find((g) => g._id === l._id);
|
|
58
|
-
let d;
|
|
59
|
-
return i ? d = ((s = l.items) == null ? void 0 : s.map((g) => {
|
|
60
|
-
var b;
|
|
61
|
-
const y = (b = i.items) == null ? void 0 : b.find(
|
|
62
|
-
(F) => F._id === g._id && F.combinationKey === g.combinationKey
|
|
63
|
-
);
|
|
64
|
-
return R(y || g, n, a + 1);
|
|
65
|
-
})) ?? [] : d = ((p = l.items) == null ? void 0 : p.map((g) => R(g, n, a + 1))) ?? [], {
|
|
66
|
-
...l,
|
|
67
|
-
items: d
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
_id: o._id,
|
|
72
|
-
name: e.name || o.name,
|
|
73
|
-
code: e.code || o.code,
|
|
74
|
-
combinationKey: e.combinationKey,
|
|
75
|
-
groups: r
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function Xe(e, n) {
|
|
79
|
-
const a = e.groups.map((m) => {
|
|
80
|
-
const l = n.modules.group.find((d) => d._id === m._id), i = ((l == null ? void 0 : l.items) || []).map((d) => {
|
|
81
|
-
var p;
|
|
82
|
-
const u = (p = m.items) == null ? void 0 : p.find(
|
|
83
|
-
(g) => g._id === d._id && g.combinationKey === d.combinationKey
|
|
84
|
-
);
|
|
85
|
-
if (u)
|
|
86
|
-
return R(u, n, 1);
|
|
87
|
-
const s = {
|
|
88
|
-
...O.generator.initMenuV4ItemOverrider(),
|
|
89
|
-
_id: d._id,
|
|
90
|
-
combinationKey: d.combinationKey
|
|
91
|
-
};
|
|
92
|
-
return R(s, n, 1);
|
|
93
|
-
});
|
|
94
|
-
return { ...m, items: i };
|
|
95
|
-
}), o = e.variant ? e.variant.variantCombinations.map((m) => R(m, n, 1)) : [], r = {
|
|
96
|
-
...O.generator.initMenuV4ItemOverrider(),
|
|
97
|
-
_id: e._id,
|
|
98
|
-
name: e.name,
|
|
99
|
-
code: e.code,
|
|
100
|
-
groups: a
|
|
101
|
-
};
|
|
102
|
-
return [...o, r];
|
|
103
|
-
}
|
|
104
|
-
function Y(e, n) {
|
|
105
|
-
var o;
|
|
106
|
-
if (!n)
|
|
107
|
-
return e;
|
|
108
|
-
const a = { ...e, code: n.code };
|
|
109
|
-
return a.groups = (o = a.groups) == null ? void 0 : o.map((r) => {
|
|
110
|
-
var l, i;
|
|
111
|
-
const m = (l = n.groups) == null ? void 0 : l.find((d) => d._id === r._id);
|
|
112
|
-
return r.items = (i = r.items) == null ? void 0 : i.map((d) => {
|
|
113
|
-
var s;
|
|
114
|
-
const u = (s = m == null ? void 0 : m.items) == null ? void 0 : s.find(
|
|
115
|
-
(p) => p._id === d._id && p.combinationKey === d.combinationKey
|
|
116
|
-
);
|
|
117
|
-
return Y(d, u);
|
|
118
|
-
}), r;
|
|
119
|
-
}), a;
|
|
120
|
-
}
|
|
121
|
-
function Je(e, n) {
|
|
122
|
-
const a = e.items[n._id];
|
|
123
|
-
n.variant && (n.variant = {
|
|
124
|
-
...n.variant,
|
|
125
|
-
variantCombinations: n.variant.variantCombinations.map((r) => {
|
|
126
|
-
const m = a.find(
|
|
127
|
-
(l) => l._id === r._id && l.combinationKey === r.combinationKey
|
|
128
|
-
);
|
|
129
|
-
if (!m)
|
|
130
|
-
throw new Error(`Item overrider not found - ${r._id} - ${r.combinationKey}`);
|
|
131
|
-
return Y(m, r);
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
const o = a.find((r) => !r.combinationKey);
|
|
135
|
-
if (!o)
|
|
136
|
-
throw new Error(`Base item overrider not found - ${n._id}`);
|
|
137
|
-
return n.groups = (o.groups || []).map((r) => {
|
|
138
|
-
var l;
|
|
139
|
-
const m = n.groups.find((i) => i._id === r._id);
|
|
140
|
-
return r.items = (l = r.items) == null ? void 0 : l.map((i) => {
|
|
141
|
-
var u;
|
|
142
|
-
const d = (u = m == null ? void 0 : m.items) == null ? void 0 : u.find(
|
|
143
|
-
(s) => s._id === i._id && s.combinationKey === i.combinationKey
|
|
144
|
-
);
|
|
145
|
-
return Y(i, d);
|
|
146
|
-
}), r;
|
|
147
|
-
}), {
|
|
148
|
-
...n,
|
|
149
|
-
price: (o == null ? void 0 : o.price) || n.price
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
async function dt(e, n, a, o, r, m = !0) {
|
|
153
|
-
const l = k(a), i = m ? Le(n, l, o, r) : l, d = n.reduce((p, g) => (p[g._id] = i.modules.item.find((y) => y._id === g._id), p), {}), u = n.reduce((p, g) => {
|
|
154
|
-
const y = g._id;
|
|
155
|
-
return p[y] = Xe(d[y], e), p;
|
|
156
|
-
}, {}), s = O.getFallbackPrices({
|
|
157
|
-
rawMenu: i,
|
|
158
|
-
items: u,
|
|
159
|
-
catalogId: o || void 0,
|
|
160
|
-
schedulerId: r
|
|
161
|
-
});
|
|
162
|
-
return n.map((p) => {
|
|
163
|
-
const g = p._id, y = d[g];
|
|
164
|
-
return {
|
|
165
|
-
...Je(s, y),
|
|
166
|
-
category: o || r ? y == null ? void 0 : y.category : null
|
|
167
|
-
};
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function mt(e, n) {
|
|
171
|
-
if (e.length === 0) return "";
|
|
172
|
-
const a = e == null ? void 0 : e.split("variant");
|
|
173
|
-
return ((a == null ? void 0 : a.reduce((r, m) => {
|
|
174
|
-
if (m && m.length > 0) {
|
|
175
|
-
const l = `variant${m.split("/")[0]}`, i = m.split("/")[1], u = n.find(
|
|
176
|
-
({ _id: s }) => s === l
|
|
177
|
-
).options.find(({ _id: s }) => s === i);
|
|
178
|
-
r.push(((u == null ? void 0 : u.name) || "").trim());
|
|
179
|
-
}
|
|
180
|
-
return r;
|
|
181
|
-
}, [])) || []).join(" / ");
|
|
182
|
-
}
|
|
183
|
-
const $ = /* @__PURE__ */ new Map();
|
|
184
|
-
async function ft(e, n) {
|
|
185
|
-
const a = `${e._id}-${e.updatedAt}-${n}`;
|
|
186
|
-
if ($.has(a))
|
|
187
|
-
return $.get(a);
|
|
188
|
-
const o = await Q(
|
|
189
|
-
je,
|
|
190
|
-
JSON.stringify({
|
|
191
|
-
menu: e,
|
|
192
|
-
itemId: n
|
|
193
|
-
})
|
|
194
|
-
);
|
|
195
|
-
return $.set(a, o), o;
|
|
196
|
-
}
|
|
197
|
-
async function ne(e, n, a) {
|
|
198
|
-
return await Q(ze, {
|
|
199
|
-
menu: e,
|
|
200
|
-
catalogId: n,
|
|
201
|
-
schedulerId: a
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function pt(e, n, a) {
|
|
205
|
-
const o = /* @__PURE__ */ new Set();
|
|
206
|
-
function r(m, l) {
|
|
207
|
-
if (!e || !m || !l || o.has(l)) return !1;
|
|
208
|
-
o.add(l);
|
|
209
|
-
const i = e.modules.item.find((d) => d._id === l);
|
|
210
|
-
return !i || !i.groups ? !1 : i.groups.some((d) => d._id === m) ? !0 : i.groups.some((d) => {
|
|
211
|
-
const u = e.modules.group.find((s) => s._id === d._id);
|
|
212
|
-
for (const s of (u == null ? void 0 : u.items) || [])
|
|
213
|
-
if (r(m, s._id)) return !0;
|
|
214
|
-
return !1;
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return r(n, a);
|
|
218
|
-
}
|
|
219
|
-
function _t(e, n, a) {
|
|
220
|
-
const o = /* @__PURE__ */ new Set();
|
|
221
|
-
function r(m, l) {
|
|
222
|
-
if (!e || !m || !l || o.has(m)) return !1;
|
|
223
|
-
o.add(m);
|
|
224
|
-
const i = e.modules.group.find((d) => d._id === m);
|
|
225
|
-
return !i || !i.items ? !1 : i.items.some((d) => d._id === l) ? !0 : i.items.some((d) => {
|
|
226
|
-
const u = e.modules.item.find((s) => s._id === d._id);
|
|
227
|
-
for (const s of (u == null ? void 0 : u.groups) || [])
|
|
228
|
-
if (r(s._id, l)) return !0;
|
|
229
|
-
return !1;
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return r(n, a);
|
|
233
|
-
}
|
|
234
|
-
const q = /* @__PURE__ */ new Map();
|
|
235
|
-
async function Ze(e, n, a) {
|
|
236
|
-
const o = `${e._id}-${e.updatedAt}-${n || "null"}-${a || "null"}`;
|
|
237
|
-
if (q.has(o))
|
|
238
|
-
return q.get(o);
|
|
239
|
-
const r = await ne(e, n, a);
|
|
240
|
-
return q.set(o, r), r;
|
|
241
|
-
}
|
|
242
|
-
async function gt(e, n, a) {
|
|
243
|
-
var l, i;
|
|
244
|
-
const o = await Ze(e, n, null), r = [], m = (d, u) => {
|
|
245
|
-
const s = k(d);
|
|
246
|
-
for (const p in u)
|
|
247
|
-
u[p] && (s[p] = u[p]);
|
|
248
|
-
return s;
|
|
249
|
-
};
|
|
250
|
-
for (const d of o.modules.group) {
|
|
251
|
-
const u = (l = d.items) == null ? void 0 : l.find((p) => p._id === a && !p.combinationKey), s = e.modules.item.find((p) => p._id === a);
|
|
252
|
-
if (u) {
|
|
253
|
-
const p = (i = d.items) == null ? void 0 : i.filter((y) => y._id === a && y.combinationKey), g = [u, ...p].map((y) => {
|
|
254
|
-
var V, x;
|
|
255
|
-
const b = y.combinationKey ? (x = (V = s == null ? void 0 : s.variant) == null ? void 0 : V.variantCombinations) == null ? void 0 : x.find(
|
|
256
|
-
(P) => P.combinationKey === y.combinationKey
|
|
257
|
-
) : s, F = b && s ? m(s, b) : y;
|
|
258
|
-
return m(F, y);
|
|
259
|
-
});
|
|
260
|
-
r.push({
|
|
261
|
-
group: d,
|
|
262
|
-
items: g
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return r;
|
|
267
|
-
}
|
|
268
|
-
function Qe({
|
|
269
|
-
maxHistorySize: e = 50
|
|
270
|
-
}) {
|
|
271
|
-
const n = Z([]), a = T(-1), o = h(() => a.value > 0), r = h(() => a.value < n.value.length - 1);
|
|
272
|
-
function m(u) {
|
|
273
|
-
n.value.push(u), a.value++, n.value.length > e && (n.value.shift(), a.value--);
|
|
274
|
-
}
|
|
275
|
-
function l() {
|
|
276
|
-
if (o.value)
|
|
277
|
-
return a.value--, n.value[a.value];
|
|
278
|
-
}
|
|
279
|
-
function i() {
|
|
280
|
-
if (r.value)
|
|
281
|
-
return a.value++, n.value[a.value];
|
|
282
|
-
}
|
|
283
|
-
function d() {
|
|
284
|
-
n.value = [], a.value = -1;
|
|
285
|
-
}
|
|
286
|
-
return {
|
|
287
|
-
push: m,
|
|
288
|
-
canUndo: o,
|
|
289
|
-
canRedo: r,
|
|
290
|
-
undo: l,
|
|
291
|
-
redo: i,
|
|
292
|
-
clear: d
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
const et = {
|
|
296
|
-
async updateMenuModule(e, n) {
|
|
297
|
-
const a = S.RequestRunner.operation(n, e.modules);
|
|
298
|
-
if (a.validateError.length > 0)
|
|
299
|
-
throw new Error(a.validateError.join(`
|
|
300
|
-
`));
|
|
301
|
-
const o = {
|
|
302
|
-
...e,
|
|
303
|
-
modules: a.result || e.modules,
|
|
304
|
-
_rev: a.id ?? ""
|
|
305
|
-
};
|
|
306
|
-
return ee.cloneDeep({ menu: o, updateId: a.id ?? null });
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
function oe() {
|
|
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 tt() {
|
|
333
|
-
return {
|
|
334
|
-
restaurants: [],
|
|
335
|
-
menu: { ...oe(), _rev: "" },
|
|
336
|
-
currentCatalogId: null,
|
|
337
|
-
currentCategoryIds: null,
|
|
338
|
-
currentSchedulerId: ""
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
const nt = We(
|
|
342
|
-
"mf-menu-store-v2",
|
|
343
|
-
() => {
|
|
344
|
-
const e = Fe(tt()), n = X(), a = Ye(), o = h(() => e.menu.modules.serveSequence ? M(e.menu.modules.serveSequence, {
|
|
345
|
-
selector: "position"
|
|
346
|
-
}) : []), r = h(() => {
|
|
347
|
-
var t;
|
|
348
|
-
return ((t = n.currentBusiness.value) == null ? void 0 : t.menuVersion) || D.F_MENU_VERSION.v3;
|
|
349
|
-
}), m = h(() => r.value === D.F_MENU_VERSION.v4), l = h(() => {
|
|
350
|
-
const t = e.menu.modules.catalog;
|
|
351
|
-
return M(t, { selector: "name" });
|
|
352
|
-
}), i = h(() => e.menu.modules.catalog.find((t) => t._id === e.currentCatalogId)), d = h(() => M(p.value.modules.scheduler, { selector: "name" })), u = h(() => e.menu.modules.scheduler.find(
|
|
353
|
-
(t) => t._id === e.currentSchedulerId
|
|
354
|
-
));
|
|
355
|
-
function s(t, c = !0) {
|
|
356
|
-
e.menu = { ...t, _rev: e.menu._rev }, c && E.push(e.menu);
|
|
357
|
-
}
|
|
358
|
-
const p = Z(oe()), g = T(!1), y = T(1);
|
|
359
|
-
async function b() {
|
|
360
|
-
g.value = !0;
|
|
361
|
-
const t = await ne(
|
|
362
|
-
e.menu,
|
|
363
|
-
e.currentCatalogId,
|
|
364
|
-
e.currentSchedulerId
|
|
365
|
-
);
|
|
366
|
-
if (e.currentSchedulerId != null) {
|
|
367
|
-
const c = e.menu.modules.catalog.find(
|
|
368
|
-
(_) => _._id === e.currentCatalogId
|
|
369
|
-
), f = c ? c.override.scheduler[e.currentSchedulerId] : e.menu.modules.scheduler.find(
|
|
370
|
-
(_) => _._id === e.currentSchedulerId
|
|
371
|
-
), v = new Set(((f == null ? void 0 : f.items) || []).map((_) => _._id));
|
|
372
|
-
t.modules.item = t.modules.item.filter((_) => v.has(_._id));
|
|
373
|
-
}
|
|
374
|
-
return p.value = t, g.value = !1, y.value = y.value + 1, t;
|
|
375
|
-
}
|
|
376
|
-
const V = ee.debounce(b, 200);
|
|
377
|
-
Re(!0).run(() => {
|
|
378
|
-
H(
|
|
379
|
-
() => [e.menu, e.currentCatalogId, e.currentSchedulerId],
|
|
380
|
-
() => {
|
|
381
|
-
g.value || V();
|
|
382
|
-
}
|
|
383
|
-
);
|
|
384
|
-
});
|
|
385
|
-
const P = h(() => [
|
|
386
|
-
{
|
|
387
|
-
label: "Main",
|
|
388
|
-
value: null
|
|
389
|
-
},
|
|
390
|
-
...l.value.map((t) => ({
|
|
391
|
-
label: t.name,
|
|
392
|
-
value: t._id
|
|
393
|
-
}))
|
|
394
|
-
]), B = h(() => {
|
|
395
|
-
const t = p.value.modules.category;
|
|
396
|
-
return [
|
|
397
|
-
...K.value.item.addon ? [
|
|
398
|
-
{
|
|
399
|
-
_id: e.currentCatalogId ? "" : null,
|
|
400
|
-
name: "Addon",
|
|
401
|
-
position: 0
|
|
402
|
-
}
|
|
403
|
-
] : [],
|
|
404
|
-
...w(t, (c) => c.name)
|
|
405
|
-
];
|
|
406
|
-
}), re = h(() => {
|
|
407
|
-
const t = p.value.modules.subCategory || [];
|
|
408
|
-
return w(t, (c) => c.name);
|
|
409
|
-
}), W = h(() => {
|
|
410
|
-
var c;
|
|
411
|
-
let t = p.value.modules.item;
|
|
412
|
-
if (i.value) {
|
|
413
|
-
const f = (c = i.value) == null ? void 0 : c.override.items;
|
|
414
|
-
t = t.filter((v) => {
|
|
415
|
-
var C;
|
|
416
|
-
const _ = (C = f == null ? void 0 : f[v._id]) == null ? void 0 : C.find(
|
|
417
|
-
(ke) => !ke.combinationKey
|
|
418
|
-
);
|
|
419
|
-
return (_ == null ? void 0 : _.orderFrom) !== I.F_ORDER_FROM.enum.NONE;
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
return w(t, (f) => f.code || f.name);
|
|
423
|
-
}), ae = h(() => {
|
|
424
|
-
const t = e.menu.modules.category, c = w(t, (v) => v.name).reduce(
|
|
425
|
-
(v, _, C) => (v[_._id] = C, v),
|
|
426
|
-
{ "": 0 }
|
|
427
|
-
), f = e.menu.modules.item;
|
|
428
|
-
return w(
|
|
429
|
-
f,
|
|
430
|
-
(v) => v.code || v.name
|
|
431
|
-
).reduce((v, _, C) => (v[_._id] = C + c[_.category || ""], v), {});
|
|
432
|
-
}), se = h(() => L(A.value, B.value, W.value)), ue = h(() => {
|
|
433
|
-
const t = K.value.item.addon ? [
|
|
434
|
-
{
|
|
435
|
-
_id: e.currentCatalogId ? "" : null,
|
|
436
|
-
name: "Addon",
|
|
437
|
-
position: 0
|
|
438
|
-
},
|
|
439
|
-
...e.menu.modules.category
|
|
440
|
-
] : e.menu.modules.category;
|
|
441
|
-
return L(
|
|
442
|
-
e.menu.modules.variant,
|
|
443
|
-
t,
|
|
444
|
-
e.menu.modules.item
|
|
445
|
-
);
|
|
446
|
-
}), A = h(() => {
|
|
447
|
-
const t = p.value.modules.variant;
|
|
448
|
-
return M(t, { selector: "name" });
|
|
449
|
-
});
|
|
450
|
-
function ie(t = []) {
|
|
451
|
-
const c = t.map((v) => A.value.find((_) => _._id === v)).filter((v) => !!v);
|
|
452
|
-
return O.fullVariantCombination(c).reduce((v, _) => (v[_.combinationKey] = _.selectionName.join(" / "), v), {});
|
|
453
|
-
}
|
|
454
|
-
const ce = h(() => w(p.value.modules.group, (t) => t.name)), le = h(() => M(p.value.modules.takeaway, { selector: "name" })), de = h(() => M(e.menu.modules.printDepartment || [], {
|
|
455
|
-
selector: "name"
|
|
456
|
-
})), me = h(() => M(e.menu.modules.unit, { selector: "name" })), fe = h(() => M(Pe(e.menu.modules.recipe, e.menu.modules.sku), {
|
|
457
|
-
selector: "name"
|
|
458
|
-
})), pe = h(() => e.menu.modules.cookingGuide), _e = h(() => {
|
|
459
|
-
const t = Ae(e.menu.modules.sku);
|
|
460
|
-
return M(t, { selector: "code" });
|
|
461
|
-
}), K = h(() => {
|
|
462
|
-
const t = !e.currentCatalogId, c = r.value === D.F_MENU_VERSION.v4, f = !e.currentSchedulerId, v = {
|
|
463
|
-
create: t && f,
|
|
464
|
-
edit: t && f,
|
|
465
|
-
delete: t && f
|
|
466
|
-
};
|
|
467
|
-
return {
|
|
468
|
-
item: {
|
|
469
|
-
...v,
|
|
470
|
-
edit: c || f,
|
|
471
|
-
sort: c && t && f,
|
|
472
|
-
addon: c,
|
|
473
|
-
code: f,
|
|
474
|
-
name: t && f,
|
|
475
|
-
description: t && f,
|
|
476
|
-
category: f,
|
|
477
|
-
thumbnail: t && f,
|
|
478
|
-
orderFrom: (c || t) && f,
|
|
479
|
-
orderFromNone: t,
|
|
480
|
-
orderFromActiveOnly: !c,
|
|
481
|
-
openPrice: t && f,
|
|
482
|
-
unit: t && f,
|
|
483
|
-
price: t,
|
|
484
|
-
editPrice: t,
|
|
485
|
-
minPrice: c && f,
|
|
486
|
-
costing: c && t && f,
|
|
487
|
-
tax: t && f,
|
|
488
|
-
variant: t && f,
|
|
489
|
-
maxVariant: c ? 4 : 2,
|
|
490
|
-
group: t && f,
|
|
491
|
-
overrideProductGroup: c && f,
|
|
492
|
-
inventory: (c || t) && f,
|
|
493
|
-
bindToVariant: c,
|
|
494
|
-
print: t && f,
|
|
495
|
-
toRoot: c && f,
|
|
496
|
-
takeaway: (_) => !!_ && (c || t) && f,
|
|
497
|
-
multiScheduler: c,
|
|
498
|
-
canRearrange: c,
|
|
499
|
-
printConfig: c
|
|
500
|
-
},
|
|
501
|
-
category: {
|
|
502
|
-
...v,
|
|
503
|
-
sort: t
|
|
504
|
-
},
|
|
505
|
-
group: {
|
|
506
|
-
...v,
|
|
507
|
-
edit: c || f,
|
|
508
|
-
sort: t,
|
|
509
|
-
applyProduct: t,
|
|
510
|
-
showAppliedProduct: f,
|
|
511
|
-
type: !c,
|
|
512
|
-
insertRawItems: !c,
|
|
513
|
-
multiScheduler: c
|
|
514
|
-
},
|
|
515
|
-
scheduler: {
|
|
516
|
-
override: c
|
|
517
|
-
},
|
|
518
|
-
takeaway: {
|
|
519
|
-
...v,
|
|
520
|
-
edit: (c || t) && f,
|
|
521
|
-
name: t
|
|
522
|
-
},
|
|
523
|
-
catalog: {
|
|
524
|
-
name: !t,
|
|
525
|
-
defaultOrderFrom: c,
|
|
526
|
-
markup: c
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
});
|
|
530
|
-
function U(t) {
|
|
531
|
-
return `${t.systemCode}/${t.taxCode}`;
|
|
532
|
-
}
|
|
533
|
-
function ge(t) {
|
|
534
|
-
const [c, f] = t.split("/");
|
|
535
|
-
return { systemCode: c, taxCode: f };
|
|
536
|
-
}
|
|
537
|
-
function ve(t, c, f) {
|
|
538
|
-
return (t ?? c ?? []).map((v) => U(v)).find((v) => f.some((_) => _.value === v));
|
|
539
|
-
}
|
|
540
|
-
const ye = h(() => {
|
|
541
|
-
var v;
|
|
542
|
-
const t = ["SV5", "SV10"], c = Ke.Country.getCountryFlattenTaxes(
|
|
543
|
-
X().currentCountry.value
|
|
544
|
-
), f = c.filter((_) => m.value || !t.includes(_.taxCode)).map((_) => ({
|
|
545
|
-
label: `${_.name} (${Ue(_.rate)}%)`,
|
|
546
|
-
value: U(_),
|
|
547
|
-
meta: {
|
|
548
|
-
rate: _.rate
|
|
549
|
-
}
|
|
550
|
-
}));
|
|
551
|
-
return f.sort((_, C) => _.label.localeCompare(C.label, void 0, { numeric: !0 })), {
|
|
552
|
-
systemCode: (v = c[0]) == null ? void 0 : v.systemCode,
|
|
553
|
-
countryTaxOptions: f
|
|
554
|
-
};
|
|
555
|
-
}), he = async () => {
|
|
556
|
-
const t = await qe.readMenu();
|
|
557
|
-
e.menu = t ?? e.menu, j(null);
|
|
558
|
-
}, be = async () => {
|
|
559
|
-
const { fetchAllRestaurants: t } = $e();
|
|
560
|
-
await t({
|
|
561
|
-
onBatchEnd: (c) => {
|
|
562
|
-
e.restaurants = c;
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
}, j = (t) => {
|
|
566
|
-
e.currentCatalogId = t;
|
|
567
|
-
}, Ce = (t) => {
|
|
568
|
-
e.currentSchedulerId = t;
|
|
569
|
-
}, Me = (t) => {
|
|
570
|
-
e.currentCategoryIds = t;
|
|
571
|
-
}, Se = async (t, c) => {
|
|
572
|
-
const f = Array.isArray(t) ? t : [t];
|
|
573
|
-
if (!f.length) return;
|
|
574
|
-
const v = f.map((_) => ({
|
|
575
|
-
..._,
|
|
576
|
-
_id: e.menu._id,
|
|
577
|
-
_rev: e.menu._rev
|
|
578
|
-
}));
|
|
579
|
-
try {
|
|
580
|
-
if (c || v.some(
|
|
581
|
-
(C) => [S.F_OPERATION_TYPE.delete, S.F_OPERATION_TYPE.deleteMany].includes(C.operation)
|
|
582
|
-
)) {
|
|
583
|
-
const C = await De(v, e.menu.modules);
|
|
584
|
-
if (C !== !0) throw new Error(C);
|
|
585
|
-
}
|
|
586
|
-
const _ = await et.updateMenuModule(e.menu, v);
|
|
587
|
-
return s(_.menu), _;
|
|
588
|
-
} catch (_) {
|
|
589
|
-
a.open({
|
|
590
|
-
type: "error",
|
|
591
|
-
title: "Failed to update menu",
|
|
592
|
-
message: _
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
}, Ee = async (t) => {
|
|
596
|
-
const c = {
|
|
597
|
-
...e.menu,
|
|
598
|
-
masterCatalogSetting: t.masterCatalogSetting,
|
|
599
|
-
lowStockThreshold: t.lowStockThreshold,
|
|
600
|
-
priceTierSettings: t.priceTierSettings
|
|
601
|
-
};
|
|
602
|
-
return s(c), c;
|
|
603
|
-
}, E = Qe({ maxHistorySize: 50 }), we = h(() => E.canUndo.value), Ie = h(() => E.canRedo.value);
|
|
604
|
-
return {
|
|
605
|
-
state: e,
|
|
606
|
-
// loading state
|
|
607
|
-
workerIsComputing: g,
|
|
608
|
-
mergedMenuChangeId: y,
|
|
609
|
-
// async computed state
|
|
610
|
-
mergedMenu: p,
|
|
611
|
-
// Computed
|
|
612
|
-
version: r,
|
|
613
|
-
isV4: m,
|
|
614
|
-
serveSequence: o,
|
|
615
|
-
catalogs: l,
|
|
616
|
-
currentCatalog: i,
|
|
617
|
-
schedulers: d,
|
|
618
|
-
currentScheduler: u,
|
|
619
|
-
catalogOptions: P,
|
|
620
|
-
categories: B,
|
|
621
|
-
subcategories: re,
|
|
622
|
-
items: W,
|
|
623
|
-
sortedItems: ae,
|
|
624
|
-
categorizedItems: se,
|
|
625
|
-
categorizedRawMenuItems: ue,
|
|
626
|
-
variants: A,
|
|
627
|
-
groups: ce,
|
|
628
|
-
takeaways: le,
|
|
629
|
-
printDepartments: de,
|
|
630
|
-
units: me,
|
|
631
|
-
recipes: fe,
|
|
632
|
-
cookingGuide: pe,
|
|
633
|
-
skus: _e,
|
|
634
|
-
rules: K,
|
|
635
|
-
taxSetting: ye,
|
|
636
|
-
// Action
|
|
637
|
-
setMenu: s,
|
|
638
|
-
readMenu: he,
|
|
639
|
-
readRestaurants: be,
|
|
640
|
-
selectCatalog: j,
|
|
641
|
-
selectScheduler: Ce,
|
|
642
|
-
selectCategory: Me,
|
|
643
|
-
updateMenu: Se,
|
|
644
|
-
updateMenuSetting: Ee,
|
|
645
|
-
computeMergedMenu: b,
|
|
646
|
-
// helper
|
|
647
|
-
encodeTax: U,
|
|
648
|
-
decodeTax: ge,
|
|
649
|
-
getSelectedTax: ve,
|
|
650
|
-
mapVariant: ie,
|
|
651
|
-
// history
|
|
652
|
-
canUndoHistory: we,
|
|
653
|
-
canRedoHistory: Ie,
|
|
654
|
-
undoHistory: () => {
|
|
655
|
-
const t = E.undo();
|
|
656
|
-
t && s(t, !1);
|
|
657
|
-
},
|
|
658
|
-
redoHistory: () => {
|
|
659
|
-
const t = E.redo();
|
|
660
|
-
t && s(t, !1);
|
|
661
|
-
},
|
|
662
|
-
clearHistory: () => {
|
|
663
|
-
E.clear();
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
), J = /* @__PURE__ */ Te({
|
|
668
|
-
__name: "AddSubcategoryDialogContentComponent",
|
|
669
|
-
props: {
|
|
670
|
-
initialValue: {}
|
|
671
|
-
},
|
|
672
|
-
setup(e) {
|
|
673
|
-
const n = e, { t: a } = te();
|
|
674
|
-
H(
|
|
675
|
-
() => n.initialValue,
|
|
676
|
-
(l) => {
|
|
677
|
-
o.value = l ?? "";
|
|
678
|
-
}
|
|
679
|
-
);
|
|
680
|
-
const o = T(n.initialValue), { emitData: r, emitAction: m } = Be();
|
|
681
|
-
return H(
|
|
682
|
-
o,
|
|
683
|
-
(l) => {
|
|
684
|
-
r(l);
|
|
685
|
-
},
|
|
686
|
-
{
|
|
687
|
-
immediate: !0
|
|
688
|
-
}
|
|
689
|
-
), (l, i) => {
|
|
690
|
-
const d = z("fm-text-field"), u = z("FmForm");
|
|
691
|
-
return Ne(), Ve(u, {
|
|
692
|
-
onValidationSuccess: i[1] || (i[1] = (s) => N(m)("primary"))
|
|
693
|
-
}, {
|
|
694
|
-
default: Oe(() => [
|
|
695
|
-
xe(d, {
|
|
696
|
-
modelValue: o.value,
|
|
697
|
-
"onUpdate:modelValue": i[0] || (i[0] = (s) => o.value = s),
|
|
698
|
-
rules: [(s) => !!s || N(a)("menu.subcategory.dialog.add.name.required")],
|
|
699
|
-
autofocus: "",
|
|
700
|
-
label: N(a)("menu.subcategory.dialog.add.name.label"),
|
|
701
|
-
placeholder: N(a)("menu.subcategory.dialog.add.name.placeholder")
|
|
702
|
-
}, null, 8, ["modelValue", "rules", "label", "placeholder"])
|
|
703
|
-
]),
|
|
704
|
-
_: 1
|
|
705
|
-
});
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
}), vt = ({
|
|
709
|
-
dialog: e,
|
|
710
|
-
menuLoader: n,
|
|
711
|
-
isLocalOnly: a = !1
|
|
712
|
-
}) => {
|
|
713
|
-
const { t: o } = te(), r = nt().updateMenu;
|
|
714
|
-
function m() {
|
|
715
|
-
const u = T(!1);
|
|
716
|
-
e.open({
|
|
717
|
-
title: o("menu.subcategory.manager.dialog.add.title"),
|
|
718
|
-
contentComponent: J,
|
|
719
|
-
primaryActions: {
|
|
720
|
-
text: o("menu.subcategory.manager.dialog.add.action"),
|
|
721
|
-
close: !1,
|
|
722
|
-
isLoading: u
|
|
723
|
-
},
|
|
724
|
-
secondaryActions: {
|
|
725
|
-
text: o("menu.common.actions.cancel"),
|
|
726
|
-
close: !0
|
|
727
|
-
}
|
|
728
|
-
}).onPrimary(async (s) => {
|
|
729
|
-
if (s)
|
|
730
|
-
try {
|
|
731
|
-
u.value = !0;
|
|
732
|
-
const p = {
|
|
733
|
-
module: I.F_MENU_MODULE_V4_KEY.enum.subCategory,
|
|
734
|
-
operation: S.F_OPERATION_TYPE.create,
|
|
735
|
-
data: {
|
|
736
|
-
name: s,
|
|
737
|
-
position: He().subcategories.length
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
a ? await r(p) : await n.updateMenu(p, s), e.close();
|
|
741
|
-
} finally {
|
|
742
|
-
u.value = !1;
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
function l(u) {
|
|
747
|
-
e.open({
|
|
748
|
-
title: o("menu.subcategory.manager.dialog.update.title"),
|
|
749
|
-
contentComponent: J,
|
|
750
|
-
contentComponentProps: {
|
|
751
|
-
initialValue: u.name
|
|
752
|
-
},
|
|
753
|
-
primaryActions: {
|
|
754
|
-
text: o("menu.subcategory.manager.dialog.update.action"),
|
|
755
|
-
close: !1
|
|
756
|
-
},
|
|
757
|
-
secondaryActions: {
|
|
758
|
-
text: o("menu.common.actions.cancel"),
|
|
759
|
-
close: !0
|
|
760
|
-
}
|
|
761
|
-
}).onPrimary(async (s) => {
|
|
762
|
-
if (!s) return;
|
|
763
|
-
const p = {
|
|
764
|
-
module: I.F_MENU_MODULE_V4_KEY.enum.subCategory,
|
|
765
|
-
operation: S.F_OPERATION_TYPE.update,
|
|
766
|
-
data: { ...u, name: s ?? u.name }
|
|
767
|
-
};
|
|
768
|
-
a ? await r(p) : await n.updateMenu(p, s), e.close();
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
function i(u) {
|
|
772
|
-
e.open({
|
|
773
|
-
title: o("menu.common.dialog.remove.subcategory.title"),
|
|
774
|
-
message: o("menu.common.dialog.remove.subcategory.message", { name: u.name }),
|
|
775
|
-
primaryActions: {
|
|
776
|
-
text: o("menu.common.actions.remove"),
|
|
777
|
-
close: !1
|
|
778
|
-
},
|
|
779
|
-
secondaryActions: {
|
|
780
|
-
text: o("menu.common.actions.cancel"),
|
|
781
|
-
close: !0
|
|
782
|
-
}
|
|
783
|
-
}).onPrimary(async () => {
|
|
784
|
-
const s = {
|
|
785
|
-
module: I.F_MENU_MODULE_V4_KEY.enum.subCategory,
|
|
786
|
-
operation: S.F_OPERATION_TYPE.delete,
|
|
787
|
-
data: u._id
|
|
788
|
-
};
|
|
789
|
-
a ? await r(s) : await n.updateMenu(s, u.name, !0), e.close();
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
async function d(u) {
|
|
793
|
-
const s = {
|
|
794
|
-
module: I.F_MENU_MODULE_V4_KEY.enum.subCategory,
|
|
795
|
-
operation: S.F_OPERATION_TYPE.rearrange,
|
|
796
|
-
data: u
|
|
797
|
-
};
|
|
798
|
-
a ? await r(s) : await n.updateMenu(s, "Subcategories");
|
|
799
|
-
}
|
|
800
|
-
return {
|
|
801
|
-
create: m,
|
|
802
|
-
update: l,
|
|
803
|
-
deleteSubcategory: i,
|
|
804
|
-
rearrange: d
|
|
805
|
-
};
|
|
806
|
-
};
|
|
807
|
-
export {
|
|
808
|
-
vt as a,
|
|
809
|
-
ft as b,
|
|
810
|
-
_t as c,
|
|
811
|
-
pt as d,
|
|
812
|
-
gt as f,
|
|
813
|
-
mt as g,
|
|
814
|
-
dt as m,
|
|
815
|
-
Ze as o,
|
|
816
|
-
nt as u
|
|
817
|
-
};
|