@feedmepos/mf-menu 0.23.10-prod.2 → 0.23.10-prod.3

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 (60) hide show
  1. package/dist/{App-C8YvLeTF.js → App-CUdOF1lD.js} +3 -3
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-CTFJvWM4.js → ApplyProduct.vue_vue_type_script_setup_true_lang-C0EsSY5o.js} +2 -2
  3. package/dist/{Catalog-ClzUdFxt.js → Catalog-DQ3qzamR.js} +20 -20
  4. package/dist/{Category-Cmfpovi8.js → Category-BEfmTsto.js} +5 -5
  5. package/dist/{CookingGuide-iOt0swkn.js → CookingGuide-BlGNp0gD.js} +4 -4
  6. package/dist/{Group-DAvakz4L.js → Group-B_TWCv5p.js} +3 -3
  7. package/dist/{Group-DYmn8IOl.js → Group-msc3rkCR.js} +1 -1
  8. package/dist/Group.vue_vue_type_script_setup_true_lang-BZongvdE.js +589 -0
  9. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BUxXXG6k.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-DZ7YvsYT.js} +2 -2
  10. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-BZrQQSZJ.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-B4HjTI4n.js} +29495 -26316
  11. package/dist/{Ingredient-C1f4ZN7_.js → Ingredient-D6c6GtL9.js} +15 -15
  12. package/dist/InventoryBinding.vue_vue_type_script_setup_true_lang-D07Mn484.js +21909 -0
  13. package/dist/{LinkProductSideSheet-DtdP_0BL.js → LinkProductSideSheet-FGQN0RjX.js} +2 -2
  14. package/dist/{MenuSetting-DI38_4FS.js → MenuSetting-CROJoPLL.js} +2 -2
  15. package/dist/{PrintRoute-GTCRYqGb.js → PrintRoute-BQkAmutA.js} +4 -4
  16. package/dist/{Product-Dkasmjmt.js → Product-BCOosmBf.js} +1 -1
  17. package/dist/{Product.vue_vue_type_script_setup_true_lang-mGnQ2LUs.js → Product.vue_vue_type_script_setup_true_lang-wBpGPDSk.js} +10 -10
  18. package/dist/Products-DeT0VXY4.js +327 -0
  19. package/dist/{Publish-H42TQv2L.js → Publish-DqiH_qtX.js} +30 -30
  20. package/dist/{Recipe-DUoZ7TTF.js → Recipe-DoH-Zx-x.js} +14 -14
  21. package/dist/{Scheduler-CdO9E38B.js → Scheduler-BXnsSB0J.js} +3 -3
  22. package/dist/{SchedulerSelector.vue_vue_type_script_setup_true_lang-CJPgvvv7.js → SchedulerSelector.vue_vue_type_script_setup_true_lang-Dodk0Sro.js} +1 -1
  23. package/dist/{ServingSequence-9PQmhk2e.js → ServingSequence-CTl_2Eav.js} +3 -3
  24. package/dist/{Setting-nYK5jgil.js → Setting-Da-WTI2Q.js} +4 -4
  25. package/dist/{Takeaway-QpAn57vg.js → Takeaway-C0gEPnF9.js} +1 -1
  26. package/dist/{Takeaway-CFVXJXbf.js → Takeaway-DkB3Fedy.js} +4 -4
  27. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-BMJwiQr6.js → Takeaway.vue_vue_type_script_setup_true_lang-DA-1Dbck.js} +5 -5
  28. package/dist/{Unit-CYIhqZeX.js → Unit-DHYLncIX.js} +2 -2
  29. package/dist/{Variant-D4yWn2iM.js → Variant-CBO_rkOu.js} +3 -3
  30. package/dist/{_id_-DCKaeAgj.js → _id_-0m5rPhWo.js} +7 -7
  31. package/dist/{app-BUcYRyrl.js → app-B8Q4Y-Fy.js} +1 -1
  32. package/dist/{app-DQYJxThv.js → app-CzifZMeS.js} +515 -679
  33. package/dist/app.js +1 -1
  34. package/dist/apps/mf-menu/src/app.d.ts +2 -0
  35. package/dist/apps/mf-menu/src/components/import/PreviewAddonContent.vue.d.ts +71 -0
  36. package/dist/apps/mf-menu/src/components/import/PreviewContent2.vue.d.ts +7 -3
  37. package/dist/apps/mf-menu/src/helper/import-export.d.ts +176 -116
  38. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +2 -0
  39. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/assets/{linked-status-BVq3G91g.js → linked-status-DYP1aR1Y.js} +3 -3
  41. package/dist/assets/{override-menu-BSF4at2W.js → override-menu-kB69jb7a.js} +3 -3
  42. package/dist/assets/{validate-menu-CecOIaf7.js → validate-menu-BfPd18qC.js} +3 -3
  43. package/dist/{catalog-D7Ldv7BK.js → catalog-BceRoIR7.js} +1 -1
  44. package/dist/{catalogSetting-BYgjjocH.js → catalogSetting-C4uMnH59.js} +1 -1
  45. package/dist/{currency-CN3EG_m3.js → currency-DE-aZP97.js} +1 -1
  46. package/dist/{discardConfirm-BQpwWpH7.js → discardConfirm-BBQeyzO_.js} +1 -1
  47. package/dist/{index-BZ4Y7cEu.js → index-DIUiBgC4.js} +3 -3
  48. package/dist/{index-BhU6NNaY.js → index-DkT8pmkQ.js} +4 -4
  49. package/dist/{item-C2drLoa9.js → item-BDe4ci28.js} +2445 -2389
  50. package/dist/{menu-BeISDKAr.js → menu-Cm-vmC2P.js} +1 -1
  51. package/dist/{menu-Cij6u5dZ.js → menu-q1fS_eLt.js} +19 -19
  52. package/dist/{remy-BGM4_GGa.js → remy-jsi7Gg_X.js} +2 -2
  53. package/dist/{scheduler-1DH1E_Uz.js → scheduler-CiZNsD7o.js} +4 -4
  54. package/dist/style.css +1 -1
  55. package/dist/{toExcel-C1OFwAWV.js → toExcel-CxZ1LIqR.js} +2 -2
  56. package/dist/{unit-TjPR0QL1.js → unit-BxL1Pe1l.js} +5 -5
  57. package/package.json +7 -6
  58. package/dist/Group.vue_vue_type_script_setup_true_lang-eHQf10NK.js +0 -576
  59. package/dist/InventoryBinding.vue_vue_type_script_setup_true_lang-5-qX5lbB.js +0 -7393
  60. package/dist/Products-WjNex4as.js +0 -244
@@ -0,0 +1,589 @@
1
+ import { defineComponent as W, computed as b, resolveComponent as D, openBlock as p, createBlock as P, withCtx as h, createElementBlock as A, Fragment as T, renderList as ne, createVNode as c, createElementVNode as d, normalizeClass as K, toDisplayString as N, ref as S, renderSlot as we, unref as a, watch as De, mergeProps as Ce, createCommentVNode as I, createSlots as Me, withModifiers as xe, isRef as le, h as Ge, nextTick as Ae } from "vue";
2
+ import { l as z, u as Fe } from "./discardConfirm-BBQeyzO_.js";
3
+ import { V as Ne } from "./vuedraggable-WU01qJgi.js";
4
+ import { u as ue, K as Pe, B as Ve, z as Re, G as v, A as Ee, J as Ue } from "./menu-q1fS_eLt.js";
5
+ import { useI18n as se } from "@feedmepos/mf-common";
6
+ import { useBreakpoints as ie, components as Ie, useSnackbar as Se, useDialog as Te, FmButtonVariant as $e } from "@feedmepos/ui-library";
7
+ import { _ as Ye } from "./app-CzifZMeS.js";
8
+ import { _ as Le, a as ze } from "./BottomSheetMenuItem.vue_vue_type_script_setup_true_lang-DPis3HVx.js";
9
+ import { c as Ke } from "./object-DNBFWMt7.js";
10
+ import { _ as je } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-C0EsSY5o.js";
11
+ import { c as Be } from "./check-C9mY6LiX.js";
12
+ import { _ as qe } from "./index.vue_vue_type_script_setup_true_lang-CGPDazqs.js";
13
+ import { M as ae, S as He, _ as Je, A as Qe, e as We, c as Xe, b as Ze } from "./item-BDe4ci28.js";
14
+ import { _ as re } from "./SchedulerSelector.vue_vue_type_script_setup_true_lang-Dodk0Sro.js";
15
+ import { u as et } from "./search-7ZYHUW7s.js";
16
+ import { C as tt } from "./catalog-BceRoIR7.js";
17
+ const ot = /* @__PURE__ */ W({
18
+ __name: "ResponsiveContextMenu",
19
+ props: {
20
+ items: {}
21
+ },
22
+ setup(j) {
23
+ const $ = ie(), n = b(() => $.breakpoints.value.xs);
24
+ return (E, x) => {
25
+ const C = D("FmButton"), _ = D("FmMenuItem"), F = D("FmMenu");
26
+ return n.value ? (p(), P(Le, { key: 0 }, {
27
+ default: h(() => [
28
+ (p(!0), A(T, null, ne(E.items, ({ icon: w, label: y, disabled: G, itemClass: k, onClick: s }) => (p(), P(ze, {
29
+ key: y,
30
+ icon: w,
31
+ label: y,
32
+ disabled: G,
33
+ itemClass: k,
34
+ onClick: () => {
35
+ !G && (s == null || s());
36
+ }
37
+ }, null, 8, ["icon", "label", "disabled", "itemClass", "onClick"]))), 128))
38
+ ]),
39
+ _: 1
40
+ })) : (p(), P(F, {
41
+ key: 1,
42
+ "stop-click-propagation": "",
43
+ shift: !0
44
+ }, {
45
+ "menu-button": h(() => [
46
+ c(C, {
47
+ type: "button",
48
+ variant: "tertiary",
49
+ icon: "more_vert",
50
+ "text-color": "neutral-gray-400",
51
+ size: "md"
52
+ })
53
+ ]),
54
+ default: h(() => [
55
+ (p(!0), A(T, null, ne(E.items, ({ icon: w, label: y, disabled: G, itemClass: k, onClick: s }) => (p(), P(_, {
56
+ key: y,
57
+ disabled: G,
58
+ onClick: () => {
59
+ !G && (s == null || s());
60
+ },
61
+ label: y
62
+ }, {
63
+ label: h(() => [
64
+ d("span", {
65
+ class: K(G ? "text-fm-color-typo-disabled" : k)
66
+ }, N(y), 3)
67
+ ]),
68
+ _: 2
69
+ }, 1032, ["disabled", "onClick", "label"]))), 128))
70
+ ]),
71
+ _: 1
72
+ }));
73
+ };
74
+ }
75
+ }), nt = { class: "fm-typo-en-title-md-600" }, lt = { class: "flex gap-8 items-center justify-start" }, at = /* @__PURE__ */ W({
76
+ __name: "ApplyProductDialog",
77
+ props: {
78
+ title: {},
79
+ initialValue: {},
80
+ group: {},
81
+ editable: { type: Boolean }
82
+ },
83
+ emits: ["apply:product"],
84
+ setup(j, { emit: $ }) {
85
+ const n = j, E = $, { t: x } = se(), C = n.initialValue.map((k) => ({ _id: k })), _ = S(z.clone(C)), F = Fe(
86
+ () => !z.isEqual(_.value, C),
87
+ () => {
88
+ w.value = !1;
89
+ }
90
+ ), w = S(!1), y = (k) => {
91
+ Be.isBoolean(k) ? w.value = k : w.value = !w.value, w.value && (_.value = n.initialValue.map((s) => ({ _id: s })));
92
+ }, G = ue();
93
+ return (k, s) => {
94
+ const V = D("fm-button"), B = D("fm-side-sheet");
95
+ return p(), A(T, null, [
96
+ we(k.$slots, "default", { trigger: y }),
97
+ c(B, {
98
+ id: "group-form",
99
+ modelValue: w.value,
100
+ "onUpdate:modelValue": s[1] || (s[1] = (r) => w.value = r),
101
+ "is-container": a(Ie).FmForm,
102
+ "is-container-props": {
103
+ onValidationSuccess: () => {
104
+ E("apply:product", _.value), y(!1);
105
+ },
106
+ blameFormChildOnValidationFailed: !0
107
+ },
108
+ "max-width": 560,
109
+ "onOn:clickedAway": a(F)
110
+ }, {
111
+ "side-sheet-header": h(() => [
112
+ d("p", nt, N(k.title), 1)
113
+ ]),
114
+ "side-sheet-footer": h(() => [
115
+ d("div", lt, [
116
+ c(V, {
117
+ label: a(x)("common.save"),
118
+ size: "lg",
119
+ type: "submit",
120
+ variant: "primary"
121
+ }, null, 8, ["label"]),
122
+ c(V, {
123
+ label: "Cancel",
124
+ size: "lg",
125
+ variant: "tertiary",
126
+ onClick: y
127
+ })
128
+ ])
129
+ ]),
130
+ default: h(() => [
131
+ c(je, {
132
+ overrides: _.value,
133
+ "onUpdate:overrides": s[0] || (s[0] = (r) => _.value = r),
134
+ "categorized-items": a(G).categorizedItems,
135
+ editable: k.editable,
136
+ "select-variant": !1,
137
+ "show-variant": !1,
138
+ "link-button-label": a(x)("menu.group.actions.apply_product"),
139
+ title: "Product"
140
+ }, null, 8, ["overrides", "categorized-items", "editable", "link-button-label"])
141
+ ]),
142
+ _: 1
143
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"])
144
+ ], 64);
145
+ };
146
+ }
147
+ }), rt = {
148
+ key: 1,
149
+ class: "xs:pt-24"
150
+ }, ut = {
151
+ key: 0,
152
+ class: /* @__PURE__ */ K(["flex-1 overflow-hidden", "space-y-8", "flex flex-col", "overflow-hidden"])
153
+ }, st = {
154
+ class: "flex justify-between items-center space-x-8"
155
+ }, it = {
156
+ class: "w-[320px]"
157
+ }, mt = {
158
+ class: "px-16 py-8"
159
+ }, ct = {
160
+ class: "py-8 px-16"
161
+ }, dt = {
162
+ class: "flex items-center flex-1"
163
+ }, pt = {
164
+ class: "flex-1 space-y-4"
165
+ }, ft = {
166
+ class: "fm-typo-en-body-lg-600"
167
+ }, vt = {
168
+ key: 0,
169
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
170
+ }, _t = {
171
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
172
+ }, Vt = /* @__PURE__ */ W({
173
+ __name: "Group",
174
+ emits: ["update:count"],
175
+ setup(j, {
176
+ emit: $
177
+ }) {
178
+ const n = ue(), E = Se(), x = Pe(Ve(E)), C = Te(), _ = b(() => n.rules.group), F = b(() => new ae(n, x.updateMenu, C)), w = b(() => F.value.mapGroups(n.groups, !1)), {
179
+ searchKey: y,
180
+ filter: G
181
+ } = et(), k = S(!1), s = S(null), V = b(() => w.value.filter((t) => G([t.name, ...Object.values(t.items).flatMap((e) => `${e.code} ${e.name} ${Re.Dinero.fromFdoDinero(e.price).toFormat()}`), t.type])).filter((t) => !s.value || t.type === s.value)), B = $;
182
+ De(() => V.value.length, () => {
183
+ B("update:count", V.value.length);
184
+ }, {
185
+ immediate: !0
186
+ });
187
+ const r = b(() => !!n.state.currentCatalogId || !!n.state.currentSchedulerId);
188
+ function me(t) {
189
+ const e = !n.state.currentSchedulerId, l = n.rules.item.bindToVariant, m = n.rules.group.type, i = n.version === v.F_MENU_VERSION.enum.v3, O = n.rules.item.orderFromActiveOnly;
190
+ return {
191
+ link: (f) => !r.value && (!f || l),
192
+ name: (f) => !r.value && !f,
193
+ isDefault: (f) => !r.value,
194
+ type: m && !t._id && !r.value,
195
+ price: t.type !== v.F_ADDON_GROUP_TYPE.enum.DYNAMIC,
196
+ inventory: e ? i ? !r.value && t.type === v.F_ADDON_GROUP_TYPE.enum.NORMAL : !r.value : !1,
197
+ orderFrom: (f) => e ? i ? t.type === v.F_ADDON_GROUP_TYPE.enum.DYNAMIC ? r.value : !!r.value == !f : r.value : !1,
198
+ orderFromActiveOnly: O,
199
+ showOrderFrom: e ? i ? r.value ? !0 : t.type === v.F_ADDON_GROUP_TYPE.enum.PRODUCT : r.value : !1,
200
+ bindToVariant: l,
201
+ isOverride: r.value,
202
+ isItemGroup: !1,
203
+ isV4: !i
204
+ };
205
+ }
206
+ const ce = b(() => {
207
+ const t = !n.state.currentSchedulerId, e = n.rules.group.type, l = n.version === v.F_MENU_VERSION.enum.v3, m = n.rules.item.orderFromActiveOnly, i = n.rules.item.bindToVariant;
208
+ return function(f) {
209
+ return {
210
+ link: (M) => !r.value && (!M || i),
211
+ name: (M) => !r.value && !M,
212
+ isDefault: (M) => !r.value,
213
+ type: e && !f._id && !r.value,
214
+ price: f.type !== v.F_ADDON_GROUP_TYPE.enum.DYNAMIC,
215
+ inventory: t ? l ? !r.value && f.type === v.F_ADDON_GROUP_TYPE.enum.NORMAL : !r.value : !1,
216
+ orderFrom: (M) => t ? l ? f.type === v.F_ADDON_GROUP_TYPE.enum.DYNAMIC ? r.value : !!r.value == !M : r.value : !1,
217
+ orderFromActiveOnly: m,
218
+ showOrderFrom: t ? l ? r.value ? !0 : f.type === v.F_ADDON_GROUP_TYPE.enum.PRODUCT : r.value : !1,
219
+ bindToVariant: i,
220
+ isOverride: r.value,
221
+ isItemGroup: !1,
222
+ isV4: !l
223
+ };
224
+ };
225
+ }), de = b(() => ({
226
+ ...Ee.generator.initMenuV4Group(),
227
+ type: n.version === v.F_MENU_VERSION.enum.v4 ? v.F_ADDON_GROUP_TYPE.enum.PRODUCT : v.F_ADDON_GROUP_TYPE.enum.NORMAL,
228
+ items: {},
229
+ position: n.groups.length - 1,
230
+ itemsLinked: []
231
+ })), q = b(() => ce.value(de.value).type);
232
+ function X(t) {
233
+ F.value.sortGroups(t);
234
+ }
235
+ function pe(t) {
236
+ C.open({
237
+ title: o("menu.group.actions.duplicate.title"),
238
+ message: o("menu.group.actions.duplicate.message", {
239
+ name: t.name
240
+ }),
241
+ primaryActions: {
242
+ text: o("menu.common.actions.yes"),
243
+ close: !0
244
+ },
245
+ secondaryActions: {
246
+ text: o("menu.common.actions.cancel"),
247
+ close: !0
248
+ }
249
+ }).onPrimary(() => F.value.duplicateGroup(t));
250
+ }
251
+ const H = b(() => n.currentCatalog), Y = b(() => n.currentScheduler), L = b(() => new tt(H.value, n, x.updateMenu, C)), J = b(() => new He(Y.value, n, x.updateMenu, C)), fe = (t) => {
252
+ let e = t;
253
+ if (r.value) {
254
+ let m = function(O) {
255
+ const M = n.state.menu.modules.group.find((g) => g._id === O._id), Q = (O.items ?? []).reduce((g, R) => (g[R._id] = [...g[R._id] || [], R.combinationKey || ""], g), {}), Oe = (M.items ?? []).filter((g) => {
256
+ var R;
257
+ return !((R = Q[g._id]) != null && R.includes(g.combinationKey || ""));
258
+ }).map((g) => ({
259
+ _id: g._id,
260
+ combinationKey: g.combinationKey,
261
+ selection: g.selection
262
+ })).filter((g) => !!n.mergedMenu.modules.item.find((R) => R._id === g._id));
263
+ return {
264
+ ...M,
265
+ ...Object.fromEntries(Object.entries(O).filter(([, g]) => !!g)),
266
+ items: [...O.items ?? [], ...Oe]
267
+ };
268
+ }, l;
269
+ H.value ? Y.value ? l = L.value.getCatalogSchedulerGroup(t._id, Y.value._id) : l = L.value.getCatalogGroup(t._id) : l = J.value.getSchedulerGroup(t._id);
270
+ const i = m(l);
271
+ e = new ae(n, x.updateMenu, C).mapGroups([i], !0)[0];
272
+ }
273
+ return {
274
+ group: e,
275
+ config: me,
276
+ categorizedItems: n.categorizedItems
277
+ };
278
+ };
279
+ function ve(t) {
280
+ C.open({
281
+ title: o("menu.group.dialogs.delete.title"),
282
+ message: o("menu.group.dialogs.delete.message", {
283
+ name: t.name
284
+ }),
285
+ primaryActions: {
286
+ text: o("menu.common.actions.delete"),
287
+ close: !0,
288
+ variant: $e.Destructive
289
+ },
290
+ secondaryActions: {
291
+ text: o("menu.common.actions.cancel"),
292
+ close: !0
293
+ }
294
+ }).onPrimary(async () => F.value.deleteGroup(t));
295
+ }
296
+ function Z(t, e) {
297
+ return Ge(at, {
298
+ key: t._id,
299
+ initialValue: t.itemsLinked,
300
+ group: We(t),
301
+ editable: _.value.applyProduct,
302
+ "onApply:product": async (l) => {
303
+ var m;
304
+ for (const i of l)
305
+ if (Xe(n.state.menu, t._id, i._id)) {
306
+ const O = (m = n.state.menu.modules.item.find((f) => f._id === i._id)) == null ? void 0 : m.name;
307
+ E.open({
308
+ type: "error",
309
+ message: o("menu.product.form.group.circularError", {
310
+ groupName: t.name,
311
+ productName: O
312
+ })
313
+ });
314
+ return;
315
+ }
316
+ await F.value.applyItems(t, l.map((i) => i._id));
317
+ }
318
+ }, {
319
+ default: e
320
+ });
321
+ }
322
+ const ee = (t) => {
323
+ const e = t.group;
324
+ return Z(e, ({
325
+ trigger: m
326
+ }) => {
327
+ const i = [{
328
+ label: o("menu.common.actions.edit"),
329
+ onClick: () => oe(e)
330
+ }, {
331
+ label: o("menu.group.actions.apply_product"),
332
+ disable: !_.value.applyProduct,
333
+ onClick: m
334
+ }, {
335
+ label: o("menu.group.actions.duplicate_action"),
336
+ disabled: !_.value.create,
337
+ onClick: () => pe(e)
338
+ }, {
339
+ label: o("menu.common.actions.delete"),
340
+ itemClass: "text-fm-color-typo-error",
341
+ disabled: !_.value.delete,
342
+ onClick: () => ve(e)
343
+ }];
344
+ return c(ot, {
345
+ class: t.className,
346
+ items: i
347
+ }, null);
348
+ });
349
+ }, _e = b(() => [{
350
+ accessorKey: "name",
351
+ header: () => o("menu.group.list.columns.name"),
352
+ enableSorting: !1
353
+ }, {
354
+ accessorKey: "items",
355
+ header: () => o("menu.group.list.columns.products"),
356
+ enableSorting: !1,
357
+ cell: (t) => {
358
+ const e = t.getValue(), l = Object.values(e).map((m) => {
359
+ var O;
360
+ const i = [(m == null ? void 0 : m.code) || "", m.name ?? m.fallbackName].join(" ").trim();
361
+ return (m.items || []).length > 1 ? `${i} (${o("menu.group.list.variants", {
362
+ count: (O = m.items) == null ? void 0 : O.length
363
+ })})` : i;
364
+ });
365
+ return l.length > 5 ? `${l.slice(0, 5).join(", ")} ${o("menu.group.list.more_items", {
366
+ count: l.length - 5
367
+ })}` : l.join(", ");
368
+ }
369
+ }, {
370
+ accessorKey: "type",
371
+ header: () => o("menu.group.list.columns.type"),
372
+ enableSorting: !1,
373
+ cell: (t) => {
374
+ const e = t.row.original;
375
+ return {
376
+ [v.F_ADDON_GROUP_TYPE.enum.NORMAL]: o("menu.group.list.types.normal"),
377
+ [v.F_ADDON_GROUP_TYPE.enum.PRODUCT]: o("menu.group.list.types.product"),
378
+ [v.F_ADDON_GROUP_TYPE.enum.DYNAMIC]: o("menu.group.list.types.dynamic")
379
+ }[e.type] || "-";
380
+ },
381
+ meta: {
382
+ width: "80px"
383
+ }
384
+ }, {
385
+ accessorKey: "itemsLinked",
386
+ header: () => o("menu.group.list.columns.applied_products"),
387
+ enableSorting: !1,
388
+ cell: (t) => {
389
+ const e = t.getValue(), l = o("menu.group.list.items_linked", {
390
+ count: e.length
391
+ });
392
+ return Z(t.row.original, ({
393
+ trigger: m
394
+ }) => c("div", {
395
+ class: "w-fit cursor-pointer border-b border-dashed border-fm-color-neutral-gray-300 hover:border-fm-color-neutral-gray-400",
396
+ onClick: (i) => {
397
+ i.stopPropagation(), m(i);
398
+ }
399
+ }, [l]));
400
+ }
401
+ }, {
402
+ id: "action",
403
+ meta: {
404
+ cellClass: "pl-16",
405
+ headerContentClass: "-mx-16"
406
+ },
407
+ cell: (t) => {
408
+ const e = t.row.original;
409
+ return ee({
410
+ group: e,
411
+ className: "flex justify-end w-full"
412
+ });
413
+ }
414
+ }]), ye = b(() => ({
415
+ itemsLinked: _.value.showAppliedProduct,
416
+ type: _.value.type
417
+ })), ge = async (t) => {
418
+ const e = Ze(t), l = e.group;
419
+ if (r.value)
420
+ H.value ? (Y.value ? L.value.overrideCatalogSchedulerGroups([l], Y.value._id) : L.value.overrideCatalogGroups([l]), await L.value.update()) : (J.value.overrideSchedulerGroups([l]), await J.value.update());
421
+ else {
422
+ const m = {
423
+ module: v.F_MENU_MODULE_V4_KEY.enum.group,
424
+ operation: Ue.F_OPERATION_TYPE.update,
425
+ data: l,
426
+ link: [{
427
+ module: v.F_MENU_MODULE_V4_KEY.enum.item,
428
+ id: "",
429
+ data: e.linkItems
430
+ }]
431
+ };
432
+ await x.updateMenu(m, l.name);
433
+ }
434
+ }, U = S(null), te = S(null), oe = async (t) => {
435
+ var e;
436
+ U.value = Ke(t), await Ae(), (e = te.value) == null || e.trigger(!0);
437
+ };
438
+ function be(t) {
439
+ oe(t.original);
440
+ }
441
+ const ke = ie(), he = b(() => ke.breakpoints.value.xs), {
442
+ t: o
443
+ } = se();
444
+ return (t, e) => {
445
+ const l = D("fm-button"), m = D("fm-chip"), i = D("fm-menu-item"), O = D("fm-menu"), f = D("fm-search"), M = D("fm-table"), Q = D("fm-bottom-sheet");
446
+ return p(), A(T, null, [U.value ? (p(), P(Je, Ce({
447
+ ref_key: "groupManagerFormRef",
448
+ ref: te,
449
+ key: U.value._id
450
+ }, fe(U.value), {
451
+ action: "update",
452
+ title: a(o)("menu.group.dialogs.update.title"),
453
+ group: U.value,
454
+ "onUpdate:group": e[0] || (e[0] = (u) => U.value = u),
455
+ "onSubmit:group": e[1] || (e[1] = (u) => ge(u))
456
+ }), null, 16, ["title", "group"])) : I("", !0), w.value.length === 0 ? (p(), A("div", rt, [c(qe, {
457
+ subtitle: a(o)("menu.group.empty.subtitle"),
458
+ title: a(o)("menu.group.empty.title")
459
+ }, Me({
460
+ _: 2
461
+ }, [_.value.create ? {
462
+ name: "action",
463
+ fn: h(() => [c(a(Qe), null, {
464
+ default: h(({
465
+ trigger: u
466
+ }) => [c(l, {
467
+ "prepend-icon": "add",
468
+ label: a(o)("menu.group.actions.add"),
469
+ onClick: xe(u, ["stop"])
470
+ }, null, 8, ["label", "onClick"])]),
471
+ _: 1
472
+ })]),
473
+ key: "0"
474
+ } : void 0]), 1032, ["subtitle", "title"])])) : (p(), A(T, {
475
+ key: 2
476
+ }, [he.value ? (p(), A(T, {
477
+ key: 1
478
+ }, [d("div", mt, [c(f, {
479
+ autofocus: "",
480
+ modelValue: a(y),
481
+ "onUpdate:modelValue": e[8] || (e[8] = (u) => le(y) ? y.value = u : null),
482
+ placeholder: a(o)("menu.group.search.placeholder")
483
+ }, null, 8, ["modelValue", "placeholder"])]), e[15] || (e[15] = d("div", {
484
+ class: "bg-fm-color-neutral-gray-100 w-full h-px rounded-md"
485
+ }, null, -1)), d("div", ct, [_.value.multiScheduler ? (p(), P(re, {
486
+ key: 0
487
+ })) : I("", !0), q.value ? (p(), P(Q, {
488
+ key: 1,
489
+ modelValue: k.value,
490
+ "onUpdate:modelValue": e[13] || (e[13] = (u) => k.value = u)
491
+ }, {
492
+ "bottom-sheet-button": h(() => [c(m, {
493
+ label: a(o)("menu.group.type.title", {
494
+ type: s.value ? a(z.capitalize)(s.value) : a(o)("menu.common.labels.all")
495
+ }),
496
+ class: "text-fm-color-typo-secondary",
497
+ "right-icon": "keyboard_arrow_down"
498
+ }, null, 8, ["label"])]),
499
+ default: h(() => [d("div", null, [d("div", {
500
+ class: "px-16 py-8",
501
+ onClick: e[9] || (e[9] = (u) => s.value = null)
502
+ }, N(a(o)("menu.group.type.all")), 1), d("div", {
503
+ class: "px-16 py-8",
504
+ onClick: e[10] || (e[10] = (u) => s.value = "NORMAL")
505
+ }, N(a(o)("menu.group.type.normal")), 1), d("div", {
506
+ class: "px-16 py-8",
507
+ onClick: e[11] || (e[11] = (u) => s.value = "PRODUCT")
508
+ }, N(a(o)("menu.group.type.product")), 1), d("div", {
509
+ class: "px-16 py-8",
510
+ onClick: e[12] || (e[12] = (u) => s.value = "DYNAMIC")
511
+ }, N(a(o)("menu.group.type.dynamic")), 1)])]),
512
+ _: 1
513
+ }, 8, ["modelValue"])) : I("", !0)]), c(a(Ne), {
514
+ class: K(["flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100", "pb-64"]),
515
+ "model-value": V.value,
516
+ group: "categories",
517
+ handle: ".handle",
518
+ "item-key": "_id",
519
+ "onUpdate:modelValue": e[14] || (e[14] = (u) => X(u))
520
+ }, {
521
+ item: h(({
522
+ element: u
523
+ }) => [(p(), A("div", {
524
+ key: u._id,
525
+ class: K(["py-12 px-16", "flex space-x-16", "items-center"])
526
+ }, [d("div", dt, [d("div", pt, [d("p", ft, N(u.name), 1), d("div", null, [q.value ? (p(), A("p", vt, N(a(z.capitalize)(u.type)) + " type ", 1)) : I("", !0), d("p", _t, N(a(o)("menu.group.list.products_linked", {
527
+ count: u.itemsLinked.length
528
+ })), 1)])]), c(ee, {
529
+ group: u
530
+ }, null, 8, ["group"])])]))]),
531
+ _: 1
532
+ }, 8, ["model-value"])], 64)) : (p(), A("div", ut, [d("div", st, [_.value.multiScheduler ? (p(), P(re, {
533
+ key: 0
534
+ })) : I("", !0), q.value ? (p(), P(O, {
535
+ key: 1
536
+ }, {
537
+ "menu-button": h(() => [c(m, {
538
+ label: a(o)("menu.group.type.title", {
539
+ type: s.value ? a(z.capitalize)(s.value) : a(o)("menu.common.labels.all")
540
+ }),
541
+ class: "text-fm-color-typo-secondary",
542
+ "right-icon": "keyboard_arrow_down"
543
+ }, null, 8, ["label"])]),
544
+ default: h(() => [d("div", null, [c(i, {
545
+ class: "px-16 py-8",
546
+ label: a(o)("menu.group.type.all"),
547
+ onClick: e[2] || (e[2] = (u) => s.value = null)
548
+ }, null, 8, ["label"]), c(i, {
549
+ class: "px-16 py-8",
550
+ label: a(o)("menu.group.type.normal"),
551
+ onClick: e[3] || (e[3] = (u) => s.value = "NORMAL")
552
+ }, null, 8, ["label"]), c(i, {
553
+ class: "px-16 py-8",
554
+ label: a(o)("menu.group.type.product"),
555
+ onClick: e[4] || (e[4] = (u) => s.value = "PRODUCT")
556
+ }, null, 8, ["label"]), c(i, {
557
+ class: "px-16 py-8",
558
+ label: a(o)("menu.group.type.dynamic"),
559
+ onClick: e[5] || (e[5] = (u) => s.value = "DYNAMIC")
560
+ }, null, 8, ["label"])])]),
561
+ _: 1
562
+ })) : I("", !0), d("div", it, [c(f, {
563
+ autofocus: "",
564
+ modelValue: a(y),
565
+ "onUpdate:modelValue": e[6] || (e[6] = (u) => le(y) ? y.value = u : null),
566
+ placeholder: a(o)("menu.group.search.placeholder")
567
+ }, null, 8, ["modelValue", "placeholder"])])]), c(Ye, null, {
568
+ default: h(() => [c(M, {
569
+ "column-defs": _e.value,
570
+ "column-visibility": ye.value,
571
+ loading: a(x).checkMenuIsLoading(),
572
+ "page-size": V.value.length,
573
+ "row-data": V.value,
574
+ "shrink-at": !1,
575
+ class: "flex-1 overflow-hidden",
576
+ draggable: "",
577
+ "hide-footer": "",
578
+ "pin-header-row": "",
579
+ onRowClick: be,
580
+ onDndChanged: e[7] || (e[7] = (u) => X(u))
581
+ }, null, 8, ["column-defs", "column-visibility", "loading", "page-size", "row-data"])]),
582
+ _: 1
583
+ })]))], 64))], 64);
584
+ };
585
+ }
586
+ });
587
+ export {
588
+ Vt as _
589
+ };
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as A, computed as g, ref as _, watch as G, onMounted as H, resolveComponent as m, openBlock as p, createElementBlock as k, Fragment as y, renderSlot as j, createVNode as r, unref as a, withCtx as s, createTextVNode as J, toDisplayString as I, createElementVNode as V, renderList as K, createBlock as C, createCommentVNode as S } from "vue";
2
2
  import { useI18n as O } from "@feedmepos/mf-common";
3
3
  import { useDialog as Q, components as R, FmButtonColorThemeVariant as h, FmButtonVariant as W } from "@feedmepos/ui-library";
4
- import { L as X } from "./LinkProductSideSheet-DtdP_0BL.js";
4
+ import { L as X } from "./LinkProductSideSheet-FGQN0RjX.js";
5
5
  import { c as w } from "./check-C9mY6LiX.js";
6
- import { u as Y, H as x, a0 as Z } from "./menu-Cij6u5dZ.js";
6
+ import { u as Y, H as x, a0 as Z } from "./menu-q1fS_eLt.js";
7
7
  import { c as ee } from "./string-DpfFixWH.js";
8
8
  const le = { class: "space-y-16" }, oe = { class: "ml-32 mt-16 space-y-8" }, ae = {
9
9
  key: 0,