@feedmepos/mf-menu 0.31.33-beta.1 → 0.31.33-beta.6

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