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