@feedmepos/mf-menu 0.31.32-prod → 0.31.33-beta.10

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 (101) hide show
  1. package/dist/{App-NHdXEdrJ.js → App-DLoBsgTh.js} +79 -33
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-DoTx23iL.js → ApplyProduct.vue_vue_type_script_setup_true_lang-AdxIn_cb.js} +20 -20
  3. package/dist/{Catalog-B0fV6Yje.js → Catalog-CEvqDKD0.js} +80 -80
  4. package/dist/{Category-CJZs9I7F.js → Category-CPrXxkVI.js} +41 -41
  5. package/dist/{Category-CUKZ10xq.js → Category-CnsBFgvu.js} +37 -33
  6. package/dist/{CookingGuide-kVclP--T.js → CookingGuide-Day6eG7h.js} +66 -66
  7. package/dist/CustomAttributeChip.vue_vue_type_script_setup_true_lang-CzrjTv0X.js +113 -0
  8. package/dist/{Group-Bgkye2LL.js → Group-HAAm8its.js} +1 -1
  9. package/dist/{Group-CAS6o4Fo.js → Group-_G2GnGz-.js} +3 -3
  10. package/dist/Group.vue_vue_type_script_setup_true_lang-CTDR_kMg.js +686 -0
  11. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-KuT-w6bF.js +367 -0
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-RsDAGQ3o.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DwXWiz77.js} +4982 -5081
  13. package/dist/{Ingredient-DpAPMsPZ.js → Ingredient-BerGQ0W3.js} +23 -23
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-MoApzjt6.js → InventoryBinding.vue_vue_type_script_setup_true_lang-Bf9GYRjF.js} +2 -2
  15. package/dist/LinkProductSideSheet-32r2l60j.js +297 -0
  16. package/dist/LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js +8024 -0
  17. package/dist/{MenuSetting-CoqMT8Vh.js → MenuSetting-DmyEGemp.js} +20 -20
  18. package/dist/{PrintRoute-DyJil1Hl.js → PrintRoute-8gipiFdT.js} +99 -98
  19. package/dist/{Product-BPIUTn0_.js → Product-Cqvq9DAA.js} +1 -1
  20. package/dist/Product.vue_vue_type_script_setup_true_lang-DcMr8wkh.js +1578 -0
  21. package/dist/{ProductInternalTools-DXgWE6JU.js → ProductInternalTools--w7YOgx2.js} +17 -17
  22. package/dist/Products-BIRGYu47.js +283 -0
  23. package/dist/{Publish-DDzpmm72.js → Publish-BcbzhAa5.js} +3 -3
  24. package/dist/{Recipe-DHYzO0IS.js → Recipe-z1zhmblA.js} +13 -13
  25. package/dist/{Scheduler-DBad2mO3.js → Scheduler-Cv9Y5M6i.js} +7 -7
  26. package/dist/{ServingSequence-DC7raAtF.js → ServingSequence-DWFJD-1y.js} +24 -24
  27. package/dist/Setting-BgCssMcE.js +259 -0
  28. package/dist/{Subcategory-DHjc7WeF.js → Subcategory-D4BYtWMN.js} +10 -10
  29. package/dist/{Takeaway-CJRTaygj.js → Takeaway-126rJXs4.js} +9 -9
  30. package/dist/{Takeaway-CAIAHpA-.js → Takeaway-D-UZAzfn.js} +1 -1
  31. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-BNu9JjwH.js → Takeaway.vue_vue_type_script_setup_true_lang-CVsyWrTL.js} +12 -12
  32. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-szHjE_UD.js +431 -0
  33. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CLNlU4BJ.js +5990 -0
  34. package/dist/{Unit-DSMSKE6_.js → Unit-7APP9HLD.js} +13 -13
  35. package/dist/{Variant-DMXxUWnj.js → Variant-lJW6pFqT.js} +14 -14
  36. package/dist/_id_-R-pHc7HA.js +202 -0
  37. package/dist/{app-D23N7tJ0.js → app-CAhJXoa3.js} +390 -377
  38. package/dist/{app-BTgdGTYz.js → app-DoJgznLl.js} +1 -1
  39. package/dist/app.js +1 -1
  40. package/dist/apps/mf-menu/src/app.d.ts +60 -1
  41. package/dist/apps/mf-menu/src/components/feature/PriceTier/LinkPriceTierSection.vue.d.ts +24 -0
  42. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +30 -0
  43. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +33 -0
  44. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/catalog.d.ts +2 -0
  45. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +80 -1
  46. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +1276 -0
  47. package/dist/apps/mf-menu/src/helper/import-export.d.ts +77 -0
  48. package/dist/apps/mf-menu/src/helper/menu.d.ts +77 -0
  49. package/dist/apps/mf-menu/src/helper/setting/catalogSetting.d.ts +11 -2
  50. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +77 -0
  51. package/dist/apps/mf-menu/src/router/shared.d.ts +2 -1
  52. package/dist/apps/mf-menu/src/stores/manager/catalog.d.ts +2 -0
  53. package/dist/apps/mf-menu/src/stores/menu.d.ts +79 -0
  54. package/dist/apps/mf-menu/src/types/linkProducts.d.ts +21 -0
  55. package/dist/apps/mf-menu/src/views/PrintRoute/PrintDepartmentDialog.vue.d.ts +5 -3
  56. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +82 -0
  57. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/assets/linked-status-BbJj0WW0.js +24 -0
  59. package/dist/assets/override-menu-CRaqJDr8.js +24 -0
  60. package/dist/assets/validate-menu-BQ2BFUmD.js +24 -0
  61. package/dist/{catalog-DcciqmWK.js → catalog-C1fna-Yk.js} +1 -1
  62. package/dist/catalogSetting-BKP36lej.js +71 -0
  63. package/dist/{category-bhqVqDzJ.js → category-DK_MXlvY.js} +5 -5
  64. package/dist/{currency-Clgvy00I.js → currency-D2fl1Bk0.js} +1 -1
  65. package/dist/{dayjs.min-DeSv8lfJ.js → dayjs.min-Bk9ZYtg9.js} +1 -1
  66. package/dist/{index-BHbYu_OM.js → index-BJ3_8aUL.js} +14 -14
  67. package/dist/{index-CTUaJyIh.js → index-CSuF-4Sa.js} +14 -14
  68. package/dist/{index-DZZJjEOs.js → index-Cc2J6T0N.js} +28 -28
  69. package/dist/index-D7yR1j9C.js +215 -0
  70. package/dist/{item-DH1xf2Sa.js → item-DX44khy2.js} +201 -199
  71. package/dist/{jszip.min-CMM2HN8J.js → jszip.min-Dbu7MIcI.js} +427 -427
  72. package/dist/{menu-Dx39P1vR.js → menu-DT5c-FqY.js} +4 -4
  73. package/dist/menu-D_Cckz_p.js +133287 -0
  74. package/dist/menuV2-DTBH_-tm.js +707 -0
  75. package/dist/mf-menu.css +1 -1
  76. package/dist/{priceTier-3M5cxSYX.js → priceTier-wLQ8p4bJ.js} +1 -1
  77. package/dist/{scheduler-BT3EJBK6.js → scheduler-D6UbXLXR.js} +36 -37
  78. package/dist/subcategory-DjN3X1BI.js +148 -0
  79. package/dist/{toExcel-BLoj4Wqb.js → toExcel-CWyoDcRd.js} +15 -15
  80. package/dist/{unit-BsNOQHvZ.js → unit-CLa8caCJ.js} +11 -10
  81. package/package.json +5 -5
  82. package/dist/CustomAttributeChip.vue_vue_type_script_setup_true_lang-RI_d10bz.js +0 -7949
  83. package/dist/FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js +0 -26
  84. package/dist/Group.vue_vue_type_script_setup_true_lang-Bij0tGMP.js +0 -698
  85. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CUa_0qzX.js +0 -206
  86. package/dist/LinkProductSideSheet-CEClo07H.js +0 -112
  87. package/dist/Product.vue_vue_type_script_setup_true_lang-fjFGg49e.js +0 -1560
  88. package/dist/Products-dWmgQ_di.js +0 -270
  89. package/dist/Setting-CPjvUYU9.js +0 -258
  90. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-DzQ8_6Bi.js +0 -71
  91. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-ZRv8Dg6x.js +0 -6149
  92. package/dist/_id_-CTq4qK7z.js +0 -200
  93. package/dist/apps/mf-menu/src/components/feature/LinkProduct/LinkProductSideSheet.vue.d.ts +0 -70
  94. package/dist/assets/linked-status-Cfc9wZst.js +0 -24
  95. package/dist/assets/override-menu-BNZggtO_.js +0 -24
  96. package/dist/assets/validate-menu-CPwUvy9F.js +0 -24
  97. package/dist/catalogSetting-D4iwoJLb.js +0 -65
  98. package/dist/index-Ce4v8o7D.js +0 -106
  99. package/dist/menu-DcGo3sn5.js +0 -108039
  100. package/dist/subcategory-B5atmACN.js +0 -817
  101. /package/dist/{apps/mf-menu/src/components → packages/shared/src/components/info}/CustomAttributeChip.vue.d.ts +0 -0
@@ -0,0 +1,686 @@
1
+ import { defineComponent as X, computed as g, resolveComponent as M, createBlock as U, openBlock as m, withCtx as x, createElementBlock as C, Fragment as T, renderList as oe, createElementVNode as p, normalizeClass as W, toDisplayString as G, createVNode as s, ref as E, renderSlot as Ne, unref as r, createCommentVNode as I, watch as Re, h as de, mergeProps as Ee, createSlots as Se, withModifiers as Ie, isRef as Q, nextTick as fe } from "vue";
2
+ import { I as H, u as ne, O as Ue, G as Te, A as v, D as $e, B as Ye, J as Le } from "./menu-D_Cckz_p.js";
3
+ import { d as ze } from "./vuedraggable-CK8z7qA8.js";
4
+ import { b as ve, H as je } from "./LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js";
5
+ import { useI18n as le, useCoreStore as Be, useCustomAttributes as Ke } from "@feedmepos/mf-common";
6
+ import { useBreakpoints as ye, components as _e, useSnackbar as He, useDialog as qe, FmButtonVariant as Je } from "@feedmepos/ui-library";
7
+ import { _ as Qe, a as We } from "./CustomAttributeChip.vue_vue_type_script_setup_true_lang-CzrjTv0X.js";
8
+ import { _ as Xe } from "./app-CAhJXoa3.js";
9
+ import { _ as Ze, a as et } from "./BottomSheetMenuItem.vue_vue_type_script_setup_true_lang-DhrXKy3b.js";
10
+ import { c as tt } from "./object-DVUNCr7w.js";
11
+ import { u as ot } from "./discardConfirm-BHni0LNu.js";
12
+ import { _ as nt } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-AdxIn_cb.js";
13
+ import { c as lt } from "./check-C9mY6LiX.js";
14
+ import { _ as at } from "./index.vue_vue_type_script_setup_true_lang-BgqsTzLI.js";
15
+ import { M as ge, x as rt, y as ut, A as st, e as it, j as ct, r as mt } from "./item-DX44khy2.js";
16
+ import { u as pt } from "./search-BAPEUu1R.js";
17
+ import { C as dt } from "./catalog-C1fna-Yk.js";
18
+ import { c as ft } from "./menuV2-DTBH_-tm.js";
19
+ const vt = /* @__PURE__ */ X({
20
+ __name: "ResponsiveContextMenu",
21
+ props: {
22
+ items: {}
23
+ },
24
+ setup(L) {
25
+ const S = ye(), u = g(() => S.breakpoints.value.xs);
26
+ return (R, V) => {
27
+ const h = M("FmButton"), f = M("FmMenuItem"), y = M("FmMenu");
28
+ return u.value ? (m(), U(Ze, { key: 0 }, {
29
+ default: x(() => [
30
+ (m(!0), C(T, null, oe(R.items, ({ icon: k, label: D, disabled: w, itemClass: A, onClick: _ }) => (m(), U(et, {
31
+ key: D,
32
+ icon: k,
33
+ label: D,
34
+ disabled: w,
35
+ itemClass: A,
36
+ onClick: () => {
37
+ !w && (_ == null || _());
38
+ }
39
+ }, null, 8, ["icon", "label", "disabled", "itemClass", "onClick"]))), 128))
40
+ ]),
41
+ _: 1
42
+ })) : (m(), U(y, {
43
+ key: 1,
44
+ "stop-click-propagation": "",
45
+ shift: !0
46
+ }, {
47
+ "menu-button": x(() => [
48
+ s(h, {
49
+ type: "button",
50
+ variant: "tertiary",
51
+ icon: "more_vert",
52
+ "text-color": "neutral-gray-400",
53
+ size: "md"
54
+ })
55
+ ]),
56
+ default: x(() => [
57
+ (m(!0), C(T, null, oe(R.items, ({ icon: k, label: D, disabled: w, itemClass: A, onClick: _ }) => (m(), U(f, {
58
+ key: D,
59
+ disabled: w,
60
+ onClick: () => {
61
+ !w && (_ == null || _());
62
+ },
63
+ label: D
64
+ }, {
65
+ label: x(() => [
66
+ p("span", {
67
+ class: W(w ? "text-fm-color-typo-disabled" : A)
68
+ }, G(D), 3)
69
+ ]),
70
+ _: 2
71
+ }, 1032, ["disabled", "onClick", "label"]))), 128))
72
+ ]),
73
+ _: 1
74
+ }));
75
+ };
76
+ }
77
+ }), gt = { class: "fm-typo-en-title-md-600" }, yt = { class: "flex gap-8 items-center justify-start" }, _t = /* @__PURE__ */ X({
78
+ __name: "ApplyProductDialog",
79
+ props: {
80
+ title: {},
81
+ initialValue: {},
82
+ group: {},
83
+ editable: { type: Boolean }
84
+ },
85
+ emits: ["apply:product"],
86
+ setup(L, { emit: S }) {
87
+ const u = L, R = S, { t: V } = le(), h = u.initialValue.map((A) => ({ _id: A })), f = E(H.clone(h)), y = ot(
88
+ () => !H.isEqual(f.value, h),
89
+ () => {
90
+ k.value = !1;
91
+ }
92
+ ), k = E(!1), D = (A) => {
93
+ lt.isBoolean(A) ? k.value = A : k.value = !k.value, k.value && (f.value = u.initialValue.map((_) => ({ _id: _ })));
94
+ }, w = ne();
95
+ return (A, _) => {
96
+ const b = M("fm-button"), q = M("fm-side-sheet");
97
+ return m(), C(T, null, [
98
+ Ne(A.$slots, "default", { trigger: D }),
99
+ s(q, {
100
+ id: "group-form",
101
+ modelValue: k.value,
102
+ "onUpdate:modelValue": _[1] || (_[1] = (N) => k.value = N),
103
+ "is-container": r(_e).FmForm,
104
+ "is-container-props": {
105
+ onValidationSuccess: () => {
106
+ R("apply:product", f.value), D(!1);
107
+ },
108
+ blameFormChildOnValidationFailed: !0
109
+ },
110
+ "max-width": 560,
111
+ "onOn:clickedAway": r(y)
112
+ }, {
113
+ "side-sheet-header": x(() => [
114
+ p("p", gt, G(A.title), 1)
115
+ ]),
116
+ "side-sheet-footer": x(() => [
117
+ p("div", yt, [
118
+ s(b, {
119
+ label: r(V)("common.save"),
120
+ size: "lg",
121
+ type: "submit",
122
+ variant: "primary"
123
+ }, null, 8, ["label"]),
124
+ s(b, {
125
+ label: "Cancel",
126
+ size: "lg",
127
+ variant: "tertiary",
128
+ onClick: D
129
+ })
130
+ ])
131
+ ]),
132
+ default: x(() => [
133
+ s(nt, {
134
+ overrides: f.value,
135
+ "onUpdate:overrides": _[0] || (_[0] = (N) => f.value = N),
136
+ "categorized-items": r(w).categorizedItems,
137
+ editable: A.editable,
138
+ "select-variant": !1,
139
+ "show-variant": !1,
140
+ "link-button-label": r(V)("menu.group.actions.apply_product"),
141
+ title: "Product"
142
+ }, null, 8, ["overrides", "categorized-items", "editable", "link-button-label"])
143
+ ]),
144
+ _: 1
145
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"])
146
+ ], 64);
147
+ };
148
+ }
149
+ }), bt = {
150
+ key: 0,
151
+ class: "mt-4"
152
+ }, ht = { class: "text-fm-color-typo-secondary mb-2" }, kt = { class: "list-disc list-inside text-fm-color-typo-secondary ml-4 space-y-1" }, Ct = /* @__PURE__ */ X({
153
+ __name: "DeleteGroupDialog",
154
+ props: {
155
+ group: {}
156
+ },
157
+ setup(L) {
158
+ const S = L, { t: u } = le(), R = ne(), V = g(() => S.group.itemsLinked.map((h) => {
159
+ const f = R.state.menu.modules.item.find((y) => y._id === h);
160
+ return (f == null ? void 0 : f.name) || h;
161
+ }).filter(Boolean));
162
+ return (h, f) => (m(), C("div", null, [
163
+ p("div", null, G(r(u)("menu.group.dialogs.delete.message", { name: h.group.name })), 1),
164
+ V.value.length > 0 ? (m(), C("div", bt, [
165
+ p("div", ht, G(r(u)("menu.group.dialogs.delete.unlink_warning", { count: V.value.length })), 1),
166
+ p("ul", kt, [
167
+ (m(!0), C(T, null, oe(V.value, (y) => (m(), C("li", {
168
+ key: y,
169
+ class: "text-sm"
170
+ }, G(y), 1))), 128))
171
+ ])
172
+ ])) : I("", !0)
173
+ ]));
174
+ }
175
+ }), wt = {
176
+ key: 1,
177
+ class: "xs:pt-24"
178
+ }, Ot = {
179
+ key: 0,
180
+ class: /* @__PURE__ */ W(["flex-1 overflow-hidden", "space-y-8", "flex flex-col", "overflow-hidden", "pt-16"])
181
+ }, xt = {
182
+ class: "flex justify-between items-center space-x-8"
183
+ }, Dt = {
184
+ class: "w-[320px]"
185
+ }, At = {
186
+ key: 0
187
+ }, Ft = {
188
+ class: "px-16 py-8"
189
+ }, Mt = {
190
+ class: "py-8 px-16"
191
+ }, Gt = {
192
+ key: 0,
193
+ class: "px-16 py-8"
194
+ }, Pt = {
195
+ class: "flex items-center flex-1"
196
+ }, Vt = {
197
+ class: "flex-1 space-y-4"
198
+ }, Nt = {
199
+ class: "fm-typo-en-body-lg-600"
200
+ }, Rt = {
201
+ key: 0,
202
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
203
+ }, Et = {
204
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
205
+ }, eo = /* @__PURE__ */ X({
206
+ __name: "Group",
207
+ emits: ["update:count"],
208
+ setup(L, {
209
+ emit: S
210
+ }) {
211
+ const u = ne(), R = Be(), V = He(), h = Ue(Te(V)), f = qe(), y = g(() => u.rules.group), k = g(() => new ge(u, h.updateMenu, f)), D = g(() => k.value.mapGroups(u.groups, !1)), {
212
+ searchKey: w,
213
+ filter: A
214
+ } = pt(), _ = E(!1), b = E(null), {
215
+ attributes: q,
216
+ filterRule: N,
217
+ mongoQuery: ae
218
+ } = Ke({
219
+ valueSource: D,
220
+ entity: "group"
221
+ }), z = g(() => {
222
+ const t = (a) => A([a.name, ...Object.values(a.items).flatMap((l) => `${l.code} ${l.name} ${Ye.Dinero.fromFdoDinero(l.price).toFormat()}`), a.type]), e = (a) => !a.customAttributes && !ae.value ? !0 : je(a.customAttributes ?? {}, ae.value);
223
+ return D.value.filter((a) => t(a) && e(a)).filter((a) => !b.value || a.type === b.value);
224
+ }), be = S;
225
+ Re(() => z.value.length, () => {
226
+ be("update:count", z.value.length);
227
+ }, {
228
+ immediate: !0
229
+ });
230
+ const c = g(() => !!u.state.currentCatalogId || !!u.state.currentSchedulerId);
231
+ function re(t) {
232
+ var Y, o;
233
+ const e = !u.state.currentCatalogId, a = !u.state.currentSchedulerId, l = ((Y = u.currentCatalog) == null ? void 0 : Y.priceTierRules) ?? ((o = u.currentCatalog) == null ? void 0 : o.usePriceTiers), i = u.rules.item.bindToVariant, F = u.rules.group.type, d = u.version === v.F_MENU_VERSION.enum.v3, P = u.rules.item.orderFromActiveOnly;
234
+ return {
235
+ link: (O) => !c.value && (!O || i),
236
+ name: (O) => !c.value && !O,
237
+ isDefault: (O) => !c.value,
238
+ type: F && !t._id && !c.value,
239
+ price: !d || t.type !== v.F_ADDON_GROUP_TYPE.enum.DYNAMIC,
240
+ priceEdit: !(l && l.length > 0 && !d && a),
241
+ priceTier: !d && a && e,
242
+ inventory: a ? d ? !c.value && t.type === v.F_ADDON_GROUP_TYPE.enum.NORMAL : !c.value : !1,
243
+ orderFrom: (O) => a ? d ? t.type === v.F_ADDON_GROUP_TYPE.enum.DYNAMIC ? c.value : !!c.value == !O : c.value : !1,
244
+ orderFromActiveOnly: P,
245
+ showOrderFrom: a ? d ? c.value ? !0 : t.type === v.F_ADDON_GROUP_TYPE.enum.PRODUCT : !0 : !1,
246
+ bindToVariant: i,
247
+ isOverride: c.value,
248
+ isItemGroup: !1,
249
+ isV4: !d
250
+ };
251
+ }
252
+ const he = g(() => {
253
+ const t = !u.state.currentSchedulerId, e = u.rules.group.type, a = u.version === v.F_MENU_VERSION.enum.v3, l = u.rules.item.orderFromActiveOnly, i = u.rules.item.bindToVariant;
254
+ return function(d) {
255
+ return {
256
+ link: (P) => !c.value && (!P || i),
257
+ name: (P) => !c.value && !P,
258
+ isDefault: (P) => !c.value,
259
+ type: e && !d._id && !c.value,
260
+ price: d.type !== v.F_ADDON_GROUP_TYPE.enum.DYNAMIC,
261
+ priceEdit: !0,
262
+ priceTier: u.isV4,
263
+ inventory: t ? a ? !c.value && d.type === v.F_ADDON_GROUP_TYPE.enum.NORMAL : !c.value : !1,
264
+ orderFrom: (P) => t ? a ? d.type === v.F_ADDON_GROUP_TYPE.enum.DYNAMIC ? c.value : !!c.value == !P : c.value : !1,
265
+ orderFromActiveOnly: l,
266
+ showOrderFrom: t ? a ? c.value ? !0 : d.type === v.F_ADDON_GROUP_TYPE.enum.PRODUCT : c.value : !1,
267
+ bindToVariant: i,
268
+ isOverride: c.value,
269
+ isItemGroup: !1,
270
+ isV4: !a
271
+ };
272
+ };
273
+ }), ke = g(() => ({
274
+ ...$e.generator.initMenuV4Group(),
275
+ type: u.version === v.F_MENU_VERSION.enum.v4 ? v.F_ADDON_GROUP_TYPE.enum.PRODUCT : v.F_ADDON_GROUP_TYPE.enum.NORMAL,
276
+ items: {},
277
+ position: u.groups.length - 1,
278
+ itemsLinked: []
279
+ })), Z = g(() => he.value(ke.value).type);
280
+ function ue(t) {
281
+ k.value.sortGroups(t);
282
+ }
283
+ function Ce(t) {
284
+ f.open({
285
+ title: n("menu.group.actions.duplicate.title"),
286
+ message: n("menu.group.actions.duplicate.message", {
287
+ name: t.name
288
+ }),
289
+ primaryActions: {
290
+ text: n("menu.common.actions.yes"),
291
+ close: !0
292
+ },
293
+ secondaryActions: {
294
+ text: n("menu.common.actions.cancel"),
295
+ close: !0
296
+ }
297
+ }).onPrimary(() => k.value.duplicateGroup(t));
298
+ }
299
+ const ee = g(() => u.currentCatalog), j = g(() => u.currentScheduler), B = g(() => new dt(ee.value, u, h.updateMenu, f)), te = g(() => new rt(j.value, u, h.updateMenu, f)), we = (t) => {
300
+ let e = t;
301
+ function a(l) {
302
+ const F = u.state.menu.modules.group.find((o) => o._id === l._id), d = (l.items ?? []).reduce((o, O) => (o[O._id] = [...o[O._id] || [], O.combinationKey || ""], o), {}), Y = (F.items ?? []).filter((o) => {
303
+ var O;
304
+ return !((O = d[o._id]) != null && O.includes(o.combinationKey || ""));
305
+ }).map((o) => ({
306
+ _id: o._id,
307
+ combinationKey: o.combinationKey,
308
+ selection: o.selection
309
+ })).filter((o) => !!u.mergedMenu.modules.item.find((O) => O._id === o._id));
310
+ return {
311
+ ...F,
312
+ ...Object.fromEntries(Object.entries(l).filter(([, o]) => !!o)),
313
+ items: [...l.items ?? [], ...Y]
314
+ };
315
+ }
316
+ if (c.value) {
317
+ let l;
318
+ ee.value ? j.value ? l = B.value.getCatalogSchedulerGroup(t._id, j.value._id) : l = B.value.getCatalogGroup(t._id) : l = te.value.getSchedulerGroup(t._id);
319
+ const i = a(l);
320
+ e = new ge(u, h.updateMenu, f).mapGroups([i], !0)[0];
321
+ }
322
+ return {
323
+ group: e,
324
+ config: re,
325
+ categorizedItems: u.categorizedItems
326
+ };
327
+ };
328
+ function Oe(t) {
329
+ f.open({
330
+ title: n("menu.group.dialogs.delete.title"),
331
+ contentComponent: Ct,
332
+ contentComponentProps: {
333
+ group: t
334
+ },
335
+ primaryActions: {
336
+ text: n("menu.common.actions.delete"),
337
+ close: !0,
338
+ variant: Je.Destructive
339
+ },
340
+ secondaryActions: {
341
+ text: n("menu.common.actions.cancel"),
342
+ close: !0
343
+ }
344
+ }).onPrimary(async () => {
345
+ await k.value.deleteGroup(t);
346
+ });
347
+ }
348
+ function se(t, e) {
349
+ return de(_t, {
350
+ key: t._id,
351
+ initialValue: t.itemsLinked,
352
+ group: it(t),
353
+ editable: y.value.applyProduct,
354
+ "onApply:product": async (a) => {
355
+ var l;
356
+ for (const i of a)
357
+ if (ft(u.state.menu, t._id, i._id)) {
358
+ const F = (l = u.state.menu.modules.item.find((d) => d._id === i._id)) == null ? void 0 : l.name;
359
+ V.open({
360
+ type: "error",
361
+ message: n("menu.product.form.group.circularError", {
362
+ groupName: t.name,
363
+ productName: F
364
+ })
365
+ });
366
+ return;
367
+ }
368
+ await k.value.applyItems(t, a.map((i) => i._id));
369
+ }
370
+ }, {
371
+ default: e
372
+ });
373
+ }
374
+ const ie = (t) => {
375
+ const e = t.group;
376
+ return se(e, ({
377
+ trigger: l
378
+ }) => {
379
+ const i = [{
380
+ label: n("menu.common.actions.edit"),
381
+ onClick: () => me(e)
382
+ }, {
383
+ label: n("menu.group.actions.apply_product"),
384
+ disable: !y.value.applyProduct,
385
+ onClick: l
386
+ }, {
387
+ label: n("menu.group.actions.duplicate_action"),
388
+ disabled: !y.value.create,
389
+ onClick: () => Ce(e)
390
+ }, {
391
+ label: n("menu.common.actions.delete"),
392
+ itemClass: "text-fm-color-typo-error",
393
+ disabled: !y.value.delete,
394
+ onClick: () => Oe(e)
395
+ }];
396
+ return s(vt, {
397
+ class: t.className,
398
+ items: i
399
+ }, null);
400
+ });
401
+ }, xe = g(() => [{
402
+ accessorKey: "name",
403
+ header: () => n("menu.group.list.columns.name"),
404
+ enableSorting: !1
405
+ }, {
406
+ accessorKey: "items",
407
+ header: () => n("menu.group.list.columns.products"),
408
+ enableSorting: !1,
409
+ cell: (t) => {
410
+ const e = t.getValue(), a = Object.values(e).map((l) => {
411
+ var F;
412
+ const i = [(l == null ? void 0 : l.code) || "", l.name ?? l.fallbackName].join(" ").trim();
413
+ return (l.items || []).length > 1 ? `${i} (${n("menu.group.list.variants", {
414
+ count: (F = l.items) == null ? void 0 : F.length
415
+ })})` : i;
416
+ });
417
+ return a.length > 5 ? `${a.slice(0, 5).join(", ")} ${n("menu.group.list.more_items", {
418
+ count: a.length - 5
419
+ })}` : a.join(", ");
420
+ }
421
+ }, {
422
+ accessorKey: "type",
423
+ header: () => n("menu.group.list.columns.type"),
424
+ enableSorting: !1,
425
+ cell: (t) => {
426
+ const e = t.row.original;
427
+ return {
428
+ [v.F_ADDON_GROUP_TYPE.enum.NORMAL]: n("menu.group.list.types.normal"),
429
+ [v.F_ADDON_GROUP_TYPE.enum.PRODUCT]: n("menu.group.list.types.product"),
430
+ [v.F_ADDON_GROUP_TYPE.enum.DYNAMIC]: n("menu.group.list.types.dynamic")
431
+ }[e.type] || "-";
432
+ },
433
+ meta: {
434
+ width: "80px"
435
+ }
436
+ }, {
437
+ id: "tagging",
438
+ accessorKey: "tagging",
439
+ header: () => n("menu.product.table.columns.tagging"),
440
+ enableSorting: !1,
441
+ size: 140,
442
+ cell: (t) => {
443
+ const e = t.row.original;
444
+ return de(Qe, {
445
+ // FIXME:FdoCustomAttribute under "@feedmepos/custom-attributes" is not compatible
446
+ // with FdoCustomAttribute from "@feedmepos/core", ! mark should be removed when fixed
447
+ customAttributes: e.customAttributes
448
+ });
449
+ }
450
+ }, {
451
+ accessorKey: "itemsLinked",
452
+ header: () => n("menu.group.list.columns.applied_products"),
453
+ enableSorting: !1,
454
+ cell: (t) => {
455
+ const e = t.getValue(), a = n("menu.group.list.items_linked", {
456
+ count: e.length
457
+ });
458
+ return se(t.row.original, ({
459
+ trigger: l
460
+ }) => s("div", {
461
+ class: "w-fit cursor-pointer border-b border-dashed border-fm-color-neutral-gray-300 hover:border-fm-color-neutral-gray-400",
462
+ onClick: (i) => {
463
+ i.stopPropagation(), l(i);
464
+ }
465
+ }, [a]));
466
+ }
467
+ }, {
468
+ id: "action",
469
+ meta: {
470
+ cellClass: "pl-16",
471
+ headerContentClass: "-mx-16"
472
+ },
473
+ cell: (t) => {
474
+ const e = t.row.original;
475
+ return ie({
476
+ group: e,
477
+ className: "flex justify-end w-full"
478
+ });
479
+ }
480
+ }]), De = g(() => {
481
+ var t;
482
+ return {
483
+ itemsLinked: y.value.showAppliedProduct,
484
+ type: y.value.type,
485
+ tagging: ((t = R.groupAttributeSettings) == null ? void 0 : t.value.length) > 0
486
+ };
487
+ }), Ae = async (t) => {
488
+ const e = ct(t), a = e.group, l = mt(a, re(t));
489
+ if (c.value)
490
+ ee.value ? (j.value ? B.value.overrideCatalogSchedulerGroups([l], j.value._id) : B.value.overrideCatalogGroups([l]), await B.value.update()) : (te.value.overrideSchedulerGroups([l]), await te.value.update());
491
+ else {
492
+ const i = {
493
+ module: v.F_MENU_MODULE_V4_KEY.enum.group,
494
+ operation: Le.F_OPERATION_TYPE.update,
495
+ data: l,
496
+ link: [{
497
+ module: v.F_MENU_MODULE_V4_KEY.enum.item,
498
+ id: "",
499
+ data: e.linkItems
500
+ }]
501
+ };
502
+ await h.updateMenu(i, l.name);
503
+ }
504
+ }, $ = E(null), ce = E(null), me = async (t) => {
505
+ var e;
506
+ $.value = tt(t), await fe(), (e = ce.value) == null || e.trigger(!0);
507
+ };
508
+ function Fe(t) {
509
+ me(t.original);
510
+ }
511
+ const Me = ye(), Ge = g(() => Me.breakpoints.value.xs), {
512
+ t: n
513
+ } = le(), Pe = g(() => {
514
+ var t;
515
+ return ((t = R.groupAttributeSettings) == null ? void 0 : t.value.length) > 0;
516
+ }), K = E(!1), J = E(null);
517
+ async function Ve() {
518
+ K.value = !K.value, K.value && (await fe(), J.value && J.value.toggleProperty(!0));
519
+ }
520
+ const pe = () => y.value.multiScheduler ? s(We, null, {
521
+ append: () => Pe.value ? s("div", {
522
+ class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
523
+ onClick: (t) => {
524
+ t.stopPropagation(), Ve();
525
+ }
526
+ }, [s(_e.FmIcon, {
527
+ name: "filter_alt",
528
+ outline: !0,
529
+ color: "neutral-gray-400",
530
+ size: "sm"
531
+ }, null)]) : null
532
+ }) : null;
533
+ return (t, e) => {
534
+ const a = M("fm-button"), l = M("fm-chip"), i = M("fm-menu-item"), F = M("fm-menu"), d = M("fm-search"), P = M("fm-table"), Y = M("fm-bottom-sheet");
535
+ return m(), C(T, null, [$.value ? (m(), U(ut, Ee({
536
+ ref_key: "groupManagerFormRef",
537
+ ref: ce,
538
+ key: $.value._id
539
+ }, we($.value), {
540
+ action: "update",
541
+ title: r(n)("menu.group.dialogs.update.title"),
542
+ group: $.value,
543
+ "onUpdate:group": e[0] || (e[0] = (o) => $.value = o),
544
+ "onSubmit:group": e[1] || (e[1] = (o) => Ae(o))
545
+ }), null, 16, ["title", "group"])) : I("", !0), D.value.length === 0 ? (m(), C("div", wt, [s(at, {
546
+ subtitle: r(n)("menu.group.empty.subtitle"),
547
+ title: r(n)("menu.group.empty.title")
548
+ }, Se({
549
+ _: 2
550
+ }, [y.value.create ? {
551
+ name: "action",
552
+ fn: x(() => [s(r(st), null, {
553
+ default: x(({
554
+ trigger: o
555
+ }) => [s(a, {
556
+ "prepend-icon": "add",
557
+ label: r(n)("menu.group.actions.add"),
558
+ onClick: Ie(o, ["stop"])
559
+ }, null, 8, ["label", "onClick"])]),
560
+ _: 1
561
+ })]),
562
+ key: "0"
563
+ } : void 0]), 1032, ["subtitle", "title"])])) : (m(), C(T, {
564
+ key: 2
565
+ }, [Ge.value ? (m(), C(T, {
566
+ key: 1
567
+ }, [p("div", Ft, [s(d, {
568
+ autofocus: "",
569
+ modelValue: r(w),
570
+ "onUpdate:modelValue": e[9] || (e[9] = (o) => Q(w) ? w.value = o : null),
571
+ placeholder: r(n)("menu.group.search.placeholder")
572
+ }, null, 8, ["modelValue", "placeholder"])]), e[17] || (e[17] = p("div", {
573
+ class: "bg-fm-color-neutral-gray-100 w-full h-px rounded-md"
574
+ }, null, -1)), p("div", Mt, [s(pe), Z.value ? (m(), U(Y, {
575
+ key: 0,
576
+ modelValue: _.value,
577
+ "onUpdate:modelValue": e[14] || (e[14] = (o) => _.value = o)
578
+ }, {
579
+ "bottom-sheet-button": x(() => [s(l, {
580
+ label: r(n)("menu.group.type.title", {
581
+ type: b.value ? r(H.capitalize)(b.value) : r(n)("menu.common.labels.all")
582
+ }),
583
+ class: "text-fm-color-typo-secondary",
584
+ "right-icon": "keyboard_arrow_down"
585
+ }, null, 8, ["label"])]),
586
+ default: x(() => [p("div", null, [p("div", {
587
+ class: "px-16 py-8",
588
+ onClick: e[10] || (e[10] = (o) => b.value = null)
589
+ }, G(r(n)("menu.group.type.all")), 1), p("div", {
590
+ class: "px-16 py-8",
591
+ onClick: e[11] || (e[11] = (o) => b.value = "NORMAL")
592
+ }, G(r(n)("menu.group.type.normal")), 1), p("div", {
593
+ class: "px-16 py-8",
594
+ onClick: e[12] || (e[12] = (o) => b.value = "PRODUCT")
595
+ }, G(r(n)("menu.group.type.product")), 1), p("div", {
596
+ class: "px-16 py-8",
597
+ onClick: e[13] || (e[13] = (o) => b.value = "DYNAMIC")
598
+ }, G(r(n)("menu.group.type.dynamic")), 1)])]),
599
+ _: 1
600
+ }, 8, ["modelValue"])) : I("", !0)]), K.value ? (m(), C("div", Gt, [s(r(ve), {
601
+ ref_key: "attributeFilterRef",
602
+ ref: J,
603
+ attributes: r(q),
604
+ modelValue: r(N),
605
+ "onUpdate:modelValue": e[15] || (e[15] = (o) => Q(N) ? N.value = o : null)
606
+ }, null, 8, ["attributes", "modelValue"])])) : I("", !0), s(r(ze), {
607
+ class: W(["flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100", "pb-64"]),
608
+ "model-value": z.value,
609
+ group: "categories",
610
+ handle: ".handle",
611
+ "item-key": "_id",
612
+ "onUpdate:modelValue": e[16] || (e[16] = (o) => ue(o))
613
+ }, {
614
+ item: x(({
615
+ element: o
616
+ }) => [(m(), C("div", {
617
+ key: o._id,
618
+ class: W(["py-12 px-16", "flex space-x-16", "items-center"])
619
+ }, [p("div", Pt, [p("div", Vt, [p("p", Nt, G(o.name), 1), p("div", null, [Z.value ? (m(), C("p", Rt, G(r(H.capitalize)(o.type)) + " type ", 1)) : I("", !0), p("p", Et, G(r(n)("menu.group.list.products_linked", {
620
+ count: o.itemsLinked.length
621
+ })), 1)])]), s(ie, {
622
+ group: o
623
+ }, null, 8, ["group"])])]))]),
624
+ _: 1
625
+ }, 8, ["model-value"])], 64)) : (m(), C("div", Ot, [p("div", xt, [s(pe), Z.value ? (m(), U(F, {
626
+ key: 0
627
+ }, {
628
+ "menu-button": x(() => [s(l, {
629
+ label: r(n)("menu.group.type.title", {
630
+ type: b.value ? r(H.capitalize)(b.value) : r(n)("menu.common.labels.all")
631
+ }),
632
+ class: "text-fm-color-typo-secondary",
633
+ "right-icon": "keyboard_arrow_down"
634
+ }, null, 8, ["label"])]),
635
+ default: x(() => [p("div", null, [s(i, {
636
+ class: "px-16 py-8",
637
+ label: r(n)("menu.group.type.all"),
638
+ onClick: e[2] || (e[2] = (o) => b.value = null)
639
+ }, null, 8, ["label"]), s(i, {
640
+ class: "px-16 py-8",
641
+ label: r(n)("menu.group.type.normal"),
642
+ onClick: e[3] || (e[3] = (o) => b.value = "NORMAL")
643
+ }, null, 8, ["label"]), s(i, {
644
+ class: "px-16 py-8",
645
+ label: r(n)("menu.group.type.product"),
646
+ onClick: e[4] || (e[4] = (o) => b.value = "PRODUCT")
647
+ }, null, 8, ["label"]), s(i, {
648
+ class: "px-16 py-8",
649
+ label: r(n)("menu.group.type.dynamic"),
650
+ onClick: e[5] || (e[5] = (o) => b.value = "DYNAMIC")
651
+ }, null, 8, ["label"])])]),
652
+ _: 1
653
+ })) : I("", !0), p("div", Dt, [s(d, {
654
+ autofocus: "",
655
+ modelValue: r(w),
656
+ "onUpdate:modelValue": e[6] || (e[6] = (o) => Q(w) ? w.value = o : null),
657
+ placeholder: r(n)("menu.group.search.placeholder")
658
+ }, null, 8, ["modelValue", "placeholder"])])]), K.value ? (m(), C("div", At, [s(r(ve), {
659
+ ref_key: "attributeFilterRef",
660
+ ref: J,
661
+ attributes: r(q),
662
+ modelValue: r(N),
663
+ "onUpdate:modelValue": e[7] || (e[7] = (o) => Q(N) ? N.value = o : null)
664
+ }, null, 8, ["attributes", "modelValue"])])) : I("", !0), s(Xe, null, {
665
+ default: x(() => [s(P, {
666
+ "column-defs": xe.value,
667
+ "column-visibility": De.value,
668
+ loading: r(h).checkMenuIsLoading(),
669
+ "page-size": z.value.length,
670
+ "row-data": z.value,
671
+ "shrink-at": !1,
672
+ class: "flex-1 overflow-hidden",
673
+ draggable: "",
674
+ "hide-footer": "",
675
+ "pin-header-row": "",
676
+ onRowClick: Fe,
677
+ onDndChanged: e[8] || (e[8] = (o) => ue(o))
678
+ }, null, 8, ["column-defs", "column-visibility", "loading", "page-size", "row-data"])]),
679
+ _: 1
680
+ })]))], 64))], 64);
681
+ };
682
+ }
683
+ });
684
+ export {
685
+ eo as _
686
+ };