@feedmepos/mf-menu 0.32.53 → 0.32.54-dev

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 (74) hide show
  1. package/dist/{App-opl8VW_R.js → App-_uZ_L5Bj.js} +7 -7
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-CI685o_y.js → ApplyProduct.vue_vue_type_script_setup_true_lang-Dli8SXgX.js} +3 -3
  3. package/dist/{ApplyProductDialog.vue_vue_type_script_setup_true_lang-BE37wS9F.js → ApplyProductDialog.vue_vue_type_script_setup_true_lang-U6Aa4RBu.js} +2 -2
  4. package/dist/{Catalog-CFgFi7F4.js → Catalog-rve2AyBy.js} +6 -6
  5. package/dist/{Category-C-QIBnv4.js → Category-Di_80MXe.js} +4 -4
  6. package/dist/{Category-C9D0g8il.js → Category-Dx6Iv5dA.js} +4 -4
  7. package/dist/{CookingGuide-miSijISx.js → CookingGuide-03JjR4b3.js} +4 -4
  8. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-CNXLlPC4.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-BkpSzeX7.js} +1 -1
  9. package/dist/{Group-DetasO-_.js → Group-Bf0jRPu1.js} +1 -1
  10. package/dist/{Group-C1sw05Nm.js → Group-DOYvyvNP.js} +3 -3
  11. package/dist/{Group.vue_vue_type_script_setup_true_lang-DiKZMMau.js → Group.vue_vue_type_script_setup_true_lang-D13BHYJ8.js} +7 -7
  12. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BY1jcgZ2.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BHbSityl.js} +5 -5
  13. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Bjk8zzYz.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-CfWxf1OZ.js} +7 -7
  14. package/dist/{Ingredient-CyZHvNUy.js → Ingredient-woydsWk1.js} +3 -3
  15. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-5YtnqTmW.js → InventoryBinding.vue_vue_type_script_setup_true_lang-Bzgn6e5M.js} +2 -2
  16. package/dist/{LinkProductSideSheet-CwW76B20.js → LinkProductSideSheet-BtBCL69w.js} +3 -3
  17. package/dist/{MenuSetting-DAchuXJ6.js → MenuSetting-CbQ91-NJ.js} +6 -6
  18. package/dist/{OrderPacing-BVIQnDTl.js → OrderPacing-CLzZpgsR.js} +5 -5
  19. package/dist/{PrintRoute-70IyWjgJ.js → PrintRoute-KRiyp9Kl.js} +4 -4
  20. package/dist/{Product-DctvRQlQ.js → Product-D3UzjY9t.js} +1 -1
  21. package/dist/Product.vue_vue_type_script_setup_true_lang-DqCAzLTO.js +1640 -0
  22. package/dist/{ProductInternalTools-D_iKLDbw.js → ProductInternalTools-Q_KUcji3.js} +6 -6
  23. package/dist/{Products-B0DlF5sy.js → Products-DEb5wblc.js} +28 -28
  24. package/dist/{Publish-DGsHCtxz.js → Publish-CknToYHP.js} +263 -265
  25. package/dist/{Recipe-Cu8NbZR7.js → Recipe-C_b8VZgp.js} +4 -4
  26. package/dist/{RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-DO8Z3QJ3.js → RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-_aZHbTtg.js} +1 -1
  27. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-avzZyXl2.js → RuleView.vue_vue_type_script_setup_true_lang-CyTH_at9.js} +302 -302
  28. package/dist/{Scheduler-CY8eSvsu.js → Scheduler-PzqfgLBJ.js} +3 -3
  29. package/dist/{ServingSequence-C4gh5jvR.js → ServingSequence-Bxk1S39y.js} +3 -3
  30. package/dist/{Setting-CwCP1uIf.js → Setting-CO2sP1z2.js} +5 -5
  31. package/dist/{Subcategory-Chcr9PWi.js → Subcategory-5MLdVGr-.js} +5 -5
  32. package/dist/{Takeaway-C6vyEwBR.js → Takeaway-CflkNfbT.js} +4 -4
  33. package/dist/{Takeaway-C8ohkkYR.js → Takeaway-Ctbpomn2.js} +1 -1
  34. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-BqKRwZNT.js → Takeaway.vue_vue_type_script_setup_true_lang-BH-1yxKn.js} +5 -5
  35. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-_dnxm97U.js → Thumbnail.vue_vue_type_script_setup_true_lang-B7Nq3IJ1.js} +4 -4
  36. package/dist/{TranslationFieldSection.vue_vue_type_script_setup_true_lang-Bm4W6NHD.js → TranslationFieldSection.vue_vue_type_script_setup_true_lang-C_xhyVnX.js} +1 -1
  37. package/dist/{TranslationSideSheet.vue_vue_type_script_setup_true_lang-DD-vqSBo.js → TranslationSideSheet.vue_vue_type_script_setup_true_lang-B5-Ab7yn.js} +2 -2
  38. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DXhITV7s.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Dm_wi_uJ.js} +14 -14
  39. package/dist/{Unit-BJOTS840.js → Unit-BO-xI_h8.js} +2 -2
  40. package/dist/{Variant-1yx-tba5.js → Variant-D8CO6krd.js} +3 -3
  41. package/dist/{_id_-Bli_eaaw.js → _id_-C6UOR3cy.js} +9 -9
  42. package/dist/{app-Df2OaMeW.js → app-BNSww5M4.js} +37 -37
  43. package/dist/{app-CEjAGMYK.js → app-CfxU4t_L.js} +1 -1
  44. package/dist/app.js +1 -1
  45. package/dist/apps/mf-menu/src/app.d.ts +9 -0
  46. package/dist/apps/mf-menu/src/components/feature/SubcategoryManager/SubcategorySelector.vue.d.ts +5 -0
  47. package/dist/apps/mf-menu/src/helper/item.d.ts +1 -0
  48. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +1 -0
  49. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/assets/{linked-status-gnRlCKBX.js → linked-status-CddGEfc5.js} +12 -12
  51. package/dist/assets/{menu-export-DVgG2q3T.js → menu-export-DN0u3z_7.js} +2 -2
  52. package/dist/assets/{override-menu-B5Xlrlwf.js → override-menu-DG2Z1XPH.js} +2 -2
  53. package/dist/assets/{validate-menu-Ce8h_1g0.js → validate-menu-DDEraWh4.js} +2 -2
  54. package/dist/{catalog-CKUQEphe.js → catalog-B8cFusU-.js} +1 -1
  55. package/dist/{catalogSetting-D1cRj-bD.js → catalogSetting-hSXLLFjE.js} +1 -1
  56. package/dist/{currency-BVe0-Ftm.js → currency-evm4Kufz.js} +1 -1
  57. package/dist/{dayjs.min-Cky8XfOQ.js → dayjs.min-DKkIcWKQ.js} +2 -2
  58. package/dist/{index-DLC-j2RG.js → index-DF-RLnW4.js} +5 -5
  59. package/dist/{index-CGHFswp3.js → index-r-T_x-og.js} +4 -4
  60. package/dist/{index.vue_vue_type_script_setup_true_lang-D8icZ01s.js → index.vue_vue_type_script_setup_true_lang-H0pKxrKD.js} +397 -390
  61. package/dist/{item-C2zRGcji.js → item-CiGZwVCJ.js} +221 -219
  62. package/dist/{jszip.min-Cw0XEEly.js → jszip.min-CTld7lET.js} +175 -175
  63. package/dist/{memberPricing-vGotpgxh.js → memberPricing-Bh1SOfnP.js} +1 -1
  64. package/dist/{menu-33fQZyJt.js → menu-l0HseABF.js} +1 -1
  65. package/dist/{menuV2-BolaQLav.js → menuV2-CmL0MaZU.js} +85 -85
  66. package/dist/mf-menu.css +1 -1
  67. package/dist/{order_pacing-By6jv8HG.js → order_pacing-BP0_MGpd.js} +5 -5
  68. package/dist/{priceTier-DhA6Ve0R.js → priceTier-W5k8zWVc.js} +1 -1
  69. package/dist/{rules-glZCxFHS.js → rules-D2vbYzGl.js} +3 -3
  70. package/dist/{scheduler-Cnzgnk6d.js → scheduler-6526OHxm.js} +4 -4
  71. package/dist/{toExcel-Bym1fMDm.js → toExcel-DCUF2hIQ.js} +2 -2
  72. package/dist/{unit-BWwoKT39.js → unit-CA0Ctbtn.js} +2 -2
  73. package/package.json +1 -1
  74. package/dist/Product.vue_vue_type_script_setup_true_lang-mJYcstbm.js +0 -1606
@@ -0,0 +1,1640 @@
1
+ import { ref as F, computed as h, defineComponent as G, resolveComponent as K, createBlock as I, openBlock as m, withCtx as $, createElementVNode as b, createVNode as d, unref as r, createElementBlock as w, Fragment as de, renderList as Se, createCommentVNode as R, normalizeClass as me, toDisplayString as E, withModifiers as fe, mergeModels as lt, useModel as at, renderSlot as ye, watch as ie, createTextVNode as ot, watchEffect as rt, nextTick as Me, resolveDynamicComponent as nt, onMounted as st, h as U, isRef as Le, normalizeStyle as ht } from "vue";
2
+ import { u as Ie, T as we, z as ce, G as Ue, H as be, W as xt, al as Ct, am as wt, an as Re, ao as kt, Q as St, a5 as _e, ap as We } from "./index.vue_vue_type_script_setup_true_lang-H0pKxrKD.js";
3
+ import { useI18n as $e, useCoreStore as Ne, useCustomAttributes as Vt } from "@feedmepos/mf-common";
4
+ import { u as Ve } from "./menu-l0HseABF.js";
5
+ import { L as qe } from "./LinkProductSideSheet-BtBCL69w.js";
6
+ import { _ as He } from "./RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-_aZHbTtg.js";
7
+ import { _ as ze, a as Qe } from "./CustomAttributeChip.vue_vue_type_script_setup_true_lang-BkpSzeX7.js";
8
+ import { _ as Oe, u as Ft } from "./Thumbnail.vue_vue_type_script_setup_true_lang-B7Nq3IJ1.js";
9
+ import { f as It, o as $t, a as Tt, m as Pt } from "./menuV2-CmL0MaZU.js";
10
+ import { u as ut, C as At, S as Rt } from "./item-CiGZwVCJ.js";
11
+ import { b as Ye, H as Mt } from "./app-5fxKLAzS.js";
12
+ import { useBreakpoints as it, components as ee, useDialog as Ut, FmButtonColorThemeVariant as q, FmButtonVariant as X } from "@feedmepos/ui-library";
13
+ import { F as zt } from "./index-CisutoS9.js";
14
+ import { _ as De, d as Ot, e as Nt } from "./app-BNSww5M4.js";
15
+ import { _ as ke } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
16
+ import { _ as Dt } from "./index-DF-RLnW4.js";
17
+ import { r as Kt, _ as Bt } from "./ImportProductDialog.vue_vue_type_script_setup_true_lang-CfWxf1OZ.js";
18
+ import { _ as Ze } from "./TranslationViewChip.vue_vue_type_script_setup_true_lang-DiK3fi9J.js";
19
+ import { c as jt } from "./check-C9mY6LiX.js";
20
+ import { f as Et } from "./currency-evm4Kufz.js";
21
+ import { w as Gt } from "./tooltip-B5BiPMx9.js";
22
+ function Lt(C, l, c = C) {
23
+ const n = F(!0), o = h(() => {
24
+ if (!n.value && !l.value)
25
+ return !0;
26
+ if (l.value && l.value.length > 0) {
27
+ const f = c.value.map((s) => s.value);
28
+ return l.value.length === f.length && l.value.every((s) => f.includes(s));
29
+ }
30
+ return !1;
31
+ }), u = h(() => {
32
+ var f, s, _, y;
33
+ return !!((f = l.value) != null && f.length && ((s = l.value) == null ? void 0 : s.length) > 0 && ((_ = l.value) == null ? void 0 : _.length) < ((y = C.value) == null ? void 0 : y.length));
34
+ });
35
+ return { allCleared: n, allSelected: o, indeterminate: u, toggleAll: () => {
36
+ if (o.value) {
37
+ l.value = void 0, n.value = !0;
38
+ return;
39
+ }
40
+ const f = c.value.map((s) => s.value);
41
+ f.length === C.value.length ? (l.value = void 0, n.value = !1) : (l.value = f, n.value = !1);
42
+ }, toggleOption: (f) => {
43
+ var _, y, k;
44
+ let s;
45
+ l.value === void 0 && n.value ? s = [f] : l.value === void 0 && !n.value ? s = (_ = C.value.map((N) => N.value)) == null ? void 0 : _.filter((N) => N !== f) : (y = l.value) != null && y.includes(f) ? s = (k = l.value) == null ? void 0 : k.filter((N) => N !== f) : s = [...l.value || [], f], s.length === 0 ? (l.value = void 0, n.value = !0) : s.length === C.value.length ? (l.value = void 0, n.value = !1) : l.value = s;
46
+ } };
47
+ }
48
+ const Wt = { class: "inline-flex items-center" }, qt = {
49
+ key: 0,
50
+ class: /* @__PURE__ */ me([
51
+ "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
52
+ "text-fm-color-neutral-gray-400"
53
+ ])
54
+ }, Ht = { class: "p-4" }, Qt = { class: "flex-1 overflow-y-auto min-h-0" }, Je = /* @__PURE__ */ G({
55
+ __name: "CategorySelector",
56
+ emits: ["toggleAttributeFilter"],
57
+ setup(C, { emit: l }) {
58
+ const c = l, n = Ie(), { categories: o, selectedCategories: u } = Ve(), a = h(() => n.state.currentCategoryIds), v = h(
59
+ () => o.value.map((B) => ({ label: B.name, value: B.id }))
60
+ ), f = h(() => v.value.filter(
61
+ (B) => B.label.toLowerCase().includes(y.value.toLowerCase())
62
+ )), { t: s } = $e(), _ = h(() => {
63
+ var B, D, H;
64
+ return o.value.length === ((B = u.value) == null ? void 0 : B.length) ? s("menu.category.selector.all") : ((D = u.value) == null ? void 0 : D.length) === 1 ? u.value[0].name : `${(H = u.value) == null ? void 0 : H.length}`;
65
+ }), y = F(""), k = h({
66
+ get: () => a.value,
67
+ set: (B) => {
68
+ n.selectCategory(B);
69
+ }
70
+ }), { allSelected: N, toggleAll: Y, toggleOption: S, indeterminate: ae } = Lt(
71
+ v,
72
+ k,
73
+ f
74
+ ), Z = Ne(), oe = h(() => Z.itemAttributeSettings.value.length > 0);
75
+ function W() {
76
+ c("toggleAttributeFilter");
77
+ }
78
+ return (B, D) => {
79
+ const H = K("FmIcon"), J = K("FmChip"), re = K("FmSearch"), Q = K("FmMenuItem"), ne = K("FmMenu");
80
+ return m(), I(ne, {
81
+ "close-on-click": !1,
82
+ width: 220
83
+ }, {
84
+ "menu-button": $(() => [
85
+ b("div", Wt, [
86
+ d(J, null, {
87
+ default: $(() => [
88
+ _.value ? (m(), w("div", qt, E(r(s)("menu.category.selector.title", { label: _.value })), 1)) : R("", !0),
89
+ d(H, {
90
+ color: "neutral-gray-400",
91
+ name: "expand_more",
92
+ size: "sm"
93
+ }),
94
+ oe.value ? (m(), w("div", {
95
+ key: 1,
96
+ class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
97
+ onClick: fe(W, ["stop"])
98
+ }, [
99
+ d(H, {
100
+ name: "filter_alt",
101
+ outline: "",
102
+ color: "neutral-gray-400",
103
+ size: "sm",
104
+ onClick: D[0] || (D[0] = fe(() => {
105
+ }, ["prevent"]))
106
+ })
107
+ ])) : R("", !0)
108
+ ]),
109
+ _: 1
110
+ })
111
+ ])
112
+ ]),
113
+ default: $(() => [
114
+ b("div", Ht, [
115
+ d(re, {
116
+ autofocus: "",
117
+ modelValue: y.value,
118
+ "onUpdate:modelValue": D[1] || (D[1] = (P) => y.value = P),
119
+ placeholder: r(s)("menu.common.actions.search")
120
+ }, null, 8, ["modelValue", "placeholder"])
121
+ ]),
122
+ b("div", Qt, [
123
+ d(Q, {
124
+ label: "All",
125
+ "has-checkbox": "",
126
+ "model-value": r(N),
127
+ indeterminate: r(ae),
128
+ onClick: r(Y)
129
+ }, null, 8, ["model-value", "indeterminate", "onClick"]),
130
+ (m(!0), w(de, null, Se(f.value, (P) => {
131
+ var T;
132
+ return m(), I(Q, {
133
+ key: P.value || "",
134
+ label: P.label,
135
+ "has-checkbox": "",
136
+ "model-value": r(N) || ((T = k.value) == null ? void 0 : T.includes(P.value)),
137
+ onClick: (z) => r(S)(P.value)
138
+ }, null, 8, ["label", "model-value", "onClick"]);
139
+ }), 128))
140
+ ])
141
+ ]),
142
+ _: 1
143
+ });
144
+ };
145
+ }
146
+ }), Yt = { class: "flex flex-wrap gap-8" }, Zt = { class: "py-12 px-16 space-y-12" }, Jt = { class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-600" }, Xt = { class: "flex flex-wrap gap-8" }, el = {
147
+ key: 0,
148
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
149
+ }, tl = { key: 0 }, ll = {
150
+ key: 1,
151
+ class: "inline-block w-8"
152
+ }, al = { key: 0 }, ol = { key: 1 }, Xe = /* @__PURE__ */ G({
153
+ __name: "CategoriesChip",
154
+ props: {
155
+ categories: { default: () => [] },
156
+ ellipsis: { type: Boolean, default: !0 }
157
+ },
158
+ setup(C) {
159
+ const l = C, { t: c } = $e(), n = it(), o = h(() => n.breakpoints.value.xs), u = h(() => l.ellipsis ? o.value ? 1 : 2 : 1 / 0), a = h(() => l.categories.length <= u.value ? l.categories : l.categories.slice(0, u.value)), v = F(!0), f = h(() => {
160
+ if (v.value) {
161
+ const _ = a.value.join(", ");
162
+ return _.length > 20 ? _.slice(0, 20) + "..." : _;
163
+ }
164
+ return l.categories.join(", ");
165
+ });
166
+ return (s, _) => {
167
+ const y = K("FmTooltip");
168
+ return o.value ? (m(), w(de, { key: 1 }, [
169
+ s.categories.length > 0 ? (m(), w("p", el, [
170
+ b("span", null, E(r(c)("menu.product.table.columns.category")) + ": ", 1),
171
+ b("span", null, E(f.value), 1),
172
+ v.value ? (m(), w("span", ll)) : (m(), w("br", tl)),
173
+ s.categories.length > u.value ? (m(), w("span", {
174
+ key: 2,
175
+ class: "fm-typo-en-body-md-400 text-fm-color-primary cursor-pointer",
176
+ onClick: _[0] || (_[0] = fe((k) => v.value = !v.value, ["stop", "prevent"]))
177
+ }, [
178
+ v.value ? (m(), w("span", al, E(r(c)("menu.product.table.category.expand", { count: s.categories.length - u.value })), 1)) : (m(), w("span", ol, E(r(c)("menu.product.table.category.collapse")), 1))
179
+ ])) : R("", !0)
180
+ ])) : R("", !0)
181
+ ], 64)) : (m(), I(y, {
182
+ key: 0,
183
+ class: "flex",
184
+ variant: "rich",
185
+ placement: "top",
186
+ "z-index": 50
187
+ }, {
188
+ content: $(() => [
189
+ b("div", Zt, [
190
+ b("p", Jt, E(r(c)("menu.product.table.category.all")), 1),
191
+ b("div", Xt, [
192
+ (m(!0), w(de, null, Se(l.categories, (k) => (m(), I(ke, {
193
+ key: k,
194
+ label: k,
195
+ variant: "neutral"
196
+ }, null, 8, ["label"]))), 128))
197
+ ])
198
+ ])
199
+ ]),
200
+ default: $(() => [
201
+ b("div", Yt, [
202
+ (m(!0), w(de, null, Se(a.value, (k) => (m(), I(ke, {
203
+ key: k,
204
+ label: k,
205
+ variant: "neutral"
206
+ }, null, 8, ["label"]))), 128)),
207
+ s.categories.length > u.value ? (m(), I(ke, {
208
+ key: 0,
209
+ label: "...",
210
+ variant: "neutral"
211
+ })) : R("", !0)
212
+ ])
213
+ ]),
214
+ _: 1
215
+ }));
216
+ };
217
+ }
218
+ }), rl = /* @__PURE__ */ G({
219
+ __name: "ProductSearcher",
220
+ props: /* @__PURE__ */ lt({
221
+ label: {},
222
+ helperText: {},
223
+ menu: {}
224
+ }, {
225
+ modelValue: { required: !0 },
226
+ modelModifiers: {}
227
+ }),
228
+ emits: ["update:modelValue"],
229
+ setup(C) {
230
+ const l = C, c = at(C, "modelValue"), n = h(() => l.menu.modules.item.map((o) => ({
231
+ label: o.code ? `${o.code} ${o.name}` : o.name,
232
+ value: o._id
233
+ })));
234
+ return (o, u) => {
235
+ const a = K("FmSelect");
236
+ return m(), I(a, {
237
+ modelValue: c.value,
238
+ "onUpdate:modelValue": u[0] || (u[0] = (v) => c.value = v),
239
+ items: n.value,
240
+ searchable: !0,
241
+ "search-target": "label",
242
+ placeholder: "Search by product name or code",
243
+ label: o.label,
244
+ "helper-text": o.helperText
245
+ }, null, 8, ["modelValue", "items", "label", "helper-text"]);
246
+ };
247
+ }
248
+ }), nl = { class: "flex" }, sl = { class: "w-[260px] space-y-16 h-full" }, ul = { class: "flex items-center gap-4 px-8" }, il = { class: "fm-typo-en-title-sm-600" }, cl = {
249
+ key: 0,
250
+ class: "bg-fm-color-neutral-gray-100 rounded-md px-8 py-4"
251
+ }, dl = { class: "fm-typo-en-body-md-600" }, ml = { class: "flex-1" }, ct = /* @__PURE__ */ G({
252
+ __name: "ViewLayout",
253
+ props: /* @__PURE__ */ lt({
254
+ title: {},
255
+ titleBadge: {},
256
+ items: {}
257
+ }, {
258
+ modelValue: { required: !0 },
259
+ modelModifiers: {}
260
+ }),
261
+ emits: ["update:modelValue"],
262
+ setup(C) {
263
+ const l = at(C, "modelValue");
264
+ return (c, n) => {
265
+ const o = K("FmCollapsibleTabs");
266
+ return m(), w("div", nl, [
267
+ b("div", sl, [
268
+ b("div", ul, [
269
+ b("p", il, E(c.title), 1),
270
+ c.titleBadge !== void 0 ? (m(), w("div", cl, [
271
+ b("p", dl, E(c.titleBadge), 1)
272
+ ])) : R("", !0)
273
+ ]),
274
+ d(De, null, {
275
+ default: $(() => [
276
+ d(o, {
277
+ modelValue: l.value,
278
+ "onUpdate:modelValue": n[0] || (n[0] = (u) => l.value = u),
279
+ items: c.items
280
+ }, null, 8, ["modelValue", "items"])
281
+ ]),
282
+ _: 1
283
+ })
284
+ ]),
285
+ n[1] || (n[1] = b("div", { class: "w-[1px] min-h-full ml-4 mr-12 bg-fm-color-neutral-gray-100 self-stretch" }, null, -1)),
286
+ b("div", ml, [
287
+ ye(c.$slots, "default")
288
+ ])
289
+ ]);
290
+ };
291
+ }
292
+ }), Fe = /* @__PURE__ */ G({
293
+ __name: "OrderFromChip",
294
+ props: {
295
+ orderFrom: {}
296
+ },
297
+ setup(C) {
298
+ const l = C, c = we();
299
+ return (n, o) => {
300
+ var u, a;
301
+ return m(), I(ke, {
302
+ label: ((u = r(c)[l.orderFrom]) == null ? void 0 : u.label) || l.orderFrom,
303
+ variant: (a = r(c)[l.orderFrom]) == null ? void 0 : a.variant
304
+ }, null, 8, ["label", "variant"]);
305
+ };
306
+ }
307
+ }), pl = /* @__PURE__ */ G({
308
+ __name: "GroupViewTable",
309
+ props: {
310
+ data: {}
311
+ },
312
+ setup(C) {
313
+ const l = C, c = [{
314
+ accessorKey: "code",
315
+ header: () => "Code",
316
+ enableSorting: !1,
317
+ cell: ({
318
+ row: a
319
+ }) => {
320
+ const v = a.original;
321
+ return v.subRows ? d("div", {
322
+ class: "flex items-center gap-2 fm-typo-en-body-md-600 text-fm-color-typo-secondary"
323
+ }, [d(ee.FmButton, {
324
+ icon: "keyboard_arrow_up",
325
+ variant: "tertiary",
326
+ class: ["cursor-pointer", "transition-transform", a.getIsExpanded() ? "transform rotate-180" : ""],
327
+ onClick: a.getToggleExpandedHandler()
328
+ }, null), ot("Found in group: "), v.groupName]) : v.code;
329
+ },
330
+ meta: {
331
+ colspan: (a) => a.original.subRows ? 5 : 1
332
+ }
333
+ }, {
334
+ accessorKey: "productName",
335
+ header: () => "Product name",
336
+ enableSorting: !1,
337
+ meta: {
338
+ colspan: (a) => a.original.subRows ? 0 : 1
339
+ }
340
+ }, {
341
+ accessorKey: "variant",
342
+ header: () => "Variant",
343
+ enableSorting: !1,
344
+ meta: {
345
+ colspan: (a) => a.original.subRows ? 0 : 1
346
+ }
347
+ }, {
348
+ accessorKey: "price",
349
+ header: () => "Price",
350
+ enableSorting: !1,
351
+ meta: {
352
+ colspan: (a) => a.original.subRows ? 0 : 1
353
+ }
354
+ }, {
355
+ accessorKey: "orderFrom",
356
+ header: () => "Order from",
357
+ enableSorting: !1,
358
+ cell: (a) => {
359
+ const v = a.row.original;
360
+ return d(Fe, {
361
+ orderFrom: v.orderFrom ?? ""
362
+ }, null);
363
+ },
364
+ meta: {
365
+ colspan: (a) => a.original.subRows ? 0 : 1
366
+ }
367
+ }], n = F({}), o = (a) => a.subRows;
368
+ function u() {
369
+ n.value = Object.fromEntries(l.data.map((a, v) => [v, !0]));
370
+ }
371
+ return ie(() => l.data, () => {
372
+ u();
373
+ }), (a, v) => {
374
+ const f = K("FmTable");
375
+ return m(), I(De, null, {
376
+ default: $(() => [d(f, {
377
+ "column-defs": c,
378
+ "row-data": a.data,
379
+ "hide-footer": !0,
380
+ "page-size": 1e6,
381
+ "get-sub-row": o,
382
+ "expanded-state": n.value,
383
+ "shrink-at": !1,
384
+ "onUpdate:expandedState": v[0] || (v[0] = (s) => n.value = s)
385
+ }, null, 8, ["row-data", "expanded-state"])]),
386
+ _: 1
387
+ });
388
+ };
389
+ }
390
+ }), vl = /* @__PURE__ */ G({
391
+ __name: "GroupView",
392
+ props: {
393
+ itemId: {},
394
+ menu: {}
395
+ },
396
+ setup(C) {
397
+ const l = C, c = F(""), n = h(() => o.value.reduce((s, _) => s + (typeof _.badge == "number" ? _.badge ?? 1 : 0), 0)), o = F([]), u = h(() => {
398
+ const s = o.value.find((y) => y.value === c.value);
399
+ return ((s == null ? void 0 : s.itemInGroup) || []).map((y) => ({
400
+ groupName: y.group.name,
401
+ subRows: y.items.map((k) => ({
402
+ // @ts-ignore
403
+ code: k.code || k.fallbackCode,
404
+ productName: k.combinationKey ? "" : k.name ?? "",
405
+ price: k.price ? ce.Dinero.fromFdoDinero(k.price).toFormat() : "--",
406
+ orderFrom: k.orderFrom ?? void 0,
407
+ variant: k.combinationKey ? k.name ?? "" : void 0
408
+ }))
409
+ }));
410
+ });
411
+ function a() {
412
+ return [{
413
+ label: "Master product",
414
+ value: "",
415
+ catalogId: null,
416
+ data: [],
417
+ disabled: !1,
418
+ badge: void 0,
419
+ itemInGroup: []
420
+ }, ...l.menu.modules.catalog.map((_) => ({
421
+ label: _.name,
422
+ value: _._id,
423
+ catalogId: _._id,
424
+ data: [],
425
+ disabled: !1,
426
+ badge: void 0,
427
+ itemInGroup: []
428
+ }))];
429
+ }
430
+ h(() => o.value.find((s) => s.value === c.value));
431
+ async function v(s) {
432
+ const _ = o.value.find((y) => y.catalogId === s);
433
+ if (_) {
434
+ _.badge = () => d(ee.FmCircularProgress, {
435
+ size: "md"
436
+ }, null);
437
+ const y = await It(Ue(l.menu), s, l.itemId);
438
+ _.badge = y.length, _.disabled = y.length <= 0, _.itemInGroup = y;
439
+ }
440
+ }
441
+ function f() {
442
+ o.value = a(), o.value.forEach((s) => {
443
+ v(s.catalogId);
444
+ });
445
+ }
446
+ return ie([() => l.menu, () => l.itemId], () => {
447
+ l.menu && l.itemId && f();
448
+ }, {
449
+ immediate: !0
450
+ }), (s, _) => (m(), I(ct, {
451
+ modelValue: c.value,
452
+ "onUpdate:modelValue": _[0] || (_[0] = (y) => c.value = y),
453
+ items: o.value,
454
+ title: "Catalog",
455
+ "title-badge": n.value
456
+ }, {
457
+ default: $(() => [d(pl, {
458
+ data: u.value
459
+ }, null, 8, ["data"])]),
460
+ _: 1
461
+ }, 8, ["modelValue", "items", "title-badge"]));
462
+ }
463
+ }), fl = {
464
+ class: "scroll-x-auto"
465
+ }, gl = /* @__PURE__ */ G({
466
+ __name: "ProductViewTable",
467
+ props: {
468
+ itemId: {},
469
+ menu: {},
470
+ catalogId: {},
471
+ schedulerIds: {}
472
+ },
473
+ setup(C) {
474
+ const l = C, c = [{
475
+ accessorKey: "scheduler",
476
+ header: () => "Scheduler",
477
+ enableSorting: !1,
478
+ cell: (u) => {
479
+ const a = u.row.original, v = a.loading ? d(ee.FmCircularProgress, {
480
+ size: "md"
481
+ }, null) : null;
482
+ return d("div", {
483
+ class: "flex items-center gap-2"
484
+ }, [a.scheduler, v]);
485
+ }
486
+ }, {
487
+ accessorKey: "code",
488
+ header: () => "Code",
489
+ enableSorting: !1
490
+ }, {
491
+ accessorKey: "productName",
492
+ header: () => "Product name",
493
+ enableSorting: !1
494
+ }, {
495
+ accessorKey: "price",
496
+ header: () => "Price",
497
+ enableSorting: !1
498
+ }, {
499
+ accessorKey: "orderFrom",
500
+ header: () => "Order from",
501
+ cell: (u) => {
502
+ const a = u.row.original;
503
+ return d(Fe, {
504
+ orderFrom: a.orderFrom
505
+ }, null);
506
+ },
507
+ enableSorting: !1
508
+ }], n = F([]);
509
+ function o(u, a) {
510
+ return {
511
+ loading: !0,
512
+ schedulerId: u,
513
+ scheduler: a,
514
+ code: "--",
515
+ productName: "--",
516
+ price: "--",
517
+ orderFrom: "--"
518
+ };
519
+ }
520
+ return ie([() => l.menu, () => l.catalogId, () => l.schedulerIds], async () => {
521
+ n.value = [o(null, "All day"), ...l.schedulerIds.map((u) => {
522
+ var a;
523
+ return o(u, ((a = l.menu.modules.scheduler.find((v) => v._id === u)) == null ? void 0 : a.name) || "Unknown");
524
+ })], n.value.forEach(async (u) => {
525
+ const v = (await $t(Ue(l.menu), l.catalogId, u.schedulerId)).modules.item.find((s) => s._id === l.itemId), f = n.value.findIndex((s) => s.schedulerId === u.schedulerId);
526
+ if (v) {
527
+ const s = Ue(n.value);
528
+ s[f].loading = !1, s[f].code = v.code || "--", s[f].productName = v.name || "--", s[f].price = ce.Dinero.fromFdoDinero(v.price).toFormat(), s[f].orderFrom = v.orderFrom || "--", n.value = s;
529
+ }
530
+ });
531
+ }), (u, a) => {
532
+ const v = K("FmTable");
533
+ return m(), I(De, null, {
534
+ default: $(() => [b("div", fl, [d(v, {
535
+ class: "min-w-[800px]",
536
+ "column-defs": c,
537
+ "row-data": n.value,
538
+ "hide-footer": !0,
539
+ "page-size": n.value.length,
540
+ "shrink-at": !1
541
+ }, null, 8, ["row-data", "page-size"])])]),
542
+ _: 1
543
+ });
544
+ };
545
+ }
546
+ }), bl = /* @__PURE__ */ G({
547
+ __name: "ProductView",
548
+ props: {
549
+ itemId: {},
550
+ menu: {}
551
+ },
552
+ setup(C) {
553
+ const l = C, c = F(null);
554
+ rt(async () => {
555
+ c.value = await Tt(l.menu, l.itemId), await Me(), n.value = o.value[0].value;
556
+ });
557
+ const n = F(""), o = h(() => {
558
+ var f, s;
559
+ const a = {
560
+ label: "Master product",
561
+ value: "",
562
+ catalogId: null,
563
+ badge: (((f = c.value) == null ? void 0 : f.schedulers.length) || 0) + 1,
564
+ schedulerIds: (s = c.value) == null ? void 0 : s.schedulers,
565
+ disabled: !1
566
+ };
567
+ if (!c.value)
568
+ return [a];
569
+ const v = l.menu.modules.catalog.map((_) => {
570
+ var k;
571
+ const y = (k = c.value) == null ? void 0 : k.catalogs[_._id];
572
+ return {
573
+ label: _.name,
574
+ value: _._id,
575
+ disabled: !y,
576
+ catalogId: _._id,
577
+ badge: y ? ((y == null ? void 0 : y.schedulers.length) || 0) + 1 : 0,
578
+ schedulerIds: y == null ? void 0 : y.schedulers
579
+ };
580
+ });
581
+ return [a, ...v];
582
+ }), u = h(() => o.value.find((a) => a.value === n.value));
583
+ return (a, v) => (m(), I(ct, {
584
+ modelValue: n.value,
585
+ "onUpdate:modelValue": v[0] || (v[0] = (f) => n.value = f),
586
+ items: o.value,
587
+ title: "Catalog",
588
+ "title-badge": o.value.filter((f) => !f.disabled).length
589
+ }, {
590
+ default: $(() => {
591
+ var f, s;
592
+ return [
593
+ d(gl, {
594
+ menu: a.menu,
595
+ "item-id": a.itemId,
596
+ "catalog-id": ((f = u.value) == null ? void 0 : f.catalogId) || null,
597
+ "scheduler-ids": ((s = u.value) == null ? void 0 : s.schedulerIds) || []
598
+ }, null, 8, ["menu", "item-id", "catalog-id", "scheduler-ids"])
599
+ ];
600
+ }),
601
+ _: 1
602
+ }, 8, ["modelValue", "items", "title-badge"]));
603
+ }
604
+ }), _l = { class: "flex items-center gap-8" }, yl = { class: "space-y-4" }, hl = { class: "fm-typo-en-title-md-600" }, xl = { key: 0 }, Cl = { class: "text-fm-color-typo-secondary" }, wl = {
605
+ key: 0,
606
+ class: "text-fm-color-typo-secondary"
607
+ }, kl = { class: "flex items-center gap-4" }, Sl = /* @__PURE__ */ G({
608
+ __name: "ProductBaseInfo",
609
+ props: {
610
+ itemId: {},
611
+ menu: {}
612
+ },
613
+ setup(C) {
614
+ const l = C, c = h(() => l.menu.modules.item.find((o) => o._id === l.itemId)), n = h(() => {
615
+ var o;
616
+ return ce.Dinero.fromFdoDinero((o = c.value) == null ? void 0 : o.price).toFormat(!0);
617
+ });
618
+ return (o, u) => {
619
+ var a, v, f, s, _, y, k;
620
+ return m(), w("div", _l, [
621
+ d(Oe, {
622
+ alt: ((a = c.value) == null ? void 0 : a.name) ?? null,
623
+ size: 72,
624
+ src: (v = c.value) == null ? void 0 : v.thumbnail,
625
+ crossorigin: !1
626
+ }, null, 8, ["alt", "src"]),
627
+ b("div", yl, [
628
+ b("p", hl, [
629
+ (f = c.value) != null && f.code ? (m(), w("span", xl, E((s = c.value) == null ? void 0 : s.code) + ", ", 1)) : R("", !0),
630
+ b("span", null, E((_ = c.value) == null ? void 0 : _.name), 1)
631
+ ]),
632
+ b("p", Cl, "Base price: " + E(n.value), 1),
633
+ (y = c.value) != null && y.customAttributes ? (m(), w("div", wl, [
634
+ b("div", kl, [
635
+ u[0] || (u[0] = b("span", null, "Tagging:", -1)),
636
+ d(ze, {
637
+ ellipsis: !1,
638
+ "custom-attributes": (k = c.value) == null ? void 0 : k.customAttributes
639
+ }, null, 8, ["custom-attributes"])
640
+ ])
641
+ ])) : R("", !0)
642
+ ])
643
+ ]);
644
+ };
645
+ }
646
+ }), Vl = { class: "space-y-16" }, Fl = /* @__PURE__ */ G({
647
+ __name: "ProductViewer",
648
+ props: {
649
+ itemId: {},
650
+ menu: {}
651
+ },
652
+ setup(C) {
653
+ const l = F("product"), c = h(() => [
654
+ {
655
+ value: "product",
656
+ label: "Product",
657
+ component: bl
658
+ },
659
+ {
660
+ value: "group",
661
+ label: "Group",
662
+ component: vl
663
+ }
664
+ ]);
665
+ return (n, o) => {
666
+ var a;
667
+ const u = K("FmTabs");
668
+ return m(), w("div", Vl, [
669
+ d(Sl, {
670
+ "item-id": n.itemId,
671
+ menu: n.menu
672
+ }, null, 8, ["item-id", "menu"]),
673
+ b("div", null, [
674
+ d(u, {
675
+ modelValue: l.value,
676
+ "onUpdate:modelValue": o[0] || (o[0] = (v) => l.value = v),
677
+ items: c.value
678
+ }, null, 8, ["modelValue", "items"])
679
+ ]),
680
+ b("div", null, [
681
+ (m(), I(nt((a = c.value.find((v) => v.value === l.value)) == null ? void 0 : a.component), {
682
+ "item-id": n.itemId,
683
+ menu: n.menu
684
+ }, null, 8, ["item-id", "menu"]))
685
+ ])
686
+ ]);
687
+ };
688
+ }
689
+ }), Il = { class: "space-y-24" }, $l = { key: 0 }, Tl = /* @__PURE__ */ G({
690
+ __name: "ProductOverview",
691
+ props: {
692
+ itemId: {},
693
+ showSearch: { type: Boolean, default: !1 }
694
+ },
695
+ setup(C) {
696
+ const l = C, c = Ie(), n = F(null);
697
+ return st(() => {
698
+ n.value = l.itemId;
699
+ }), (o, u) => (m(), w("div", Il, [
700
+ o.showSearch ? (m(), w("div", $l, [
701
+ d(rl, {
702
+ modelValue: n.value,
703
+ "onUpdate:modelValue": u[0] || (u[0] = (a) => n.value = a),
704
+ class: "w-1/2",
705
+ label: "Search and compare prices",
706
+ "helper-text": "Quickly find products and view their prices across different catalogs and schedules.",
707
+ menu: r(c).state.menu
708
+ }, null, 8, ["modelValue", "menu"])
709
+ ])) : R("", !0),
710
+ b("div", null, [
711
+ n.value ? (m(), I(Fl, {
712
+ key: 0,
713
+ "item-id": n.value,
714
+ menu: r(c).state.menu
715
+ }, null, 8, ["item-id", "menu"])) : R("", !0)
716
+ ])
717
+ ]));
718
+ }
719
+ }), Pl = /* @__PURE__ */ G({
720
+ __name: "OverviewSheet",
721
+ setup(C) {
722
+ const l = F(null), c = F(!1);
723
+ function n(o) {
724
+ c.value = !c.value, o && (l.value = o);
725
+ }
726
+ return (o, u) => {
727
+ const a = K("FmSideSheet");
728
+ return m(), w(de, null, [
729
+ ye(o.$slots, "default", { trigger: n }),
730
+ d(a, {
731
+ id: "product-overview",
732
+ modelValue: c.value,
733
+ "onUpdate:modelValue": u[0] || (u[0] = (v) => c.value = v),
734
+ "max-width": 1200,
735
+ "dismiss-away": ""
736
+ }, {
737
+ "side-sheet-header": $(() => u[1] || (u[1] = [
738
+ b("p", { class: "fm-typo-en-title-md-600" }, "Product Overview", -1)
739
+ ])),
740
+ default: $(() => [
741
+ b("div", null, [
742
+ c.value && l.value ? (m(), I(Tl, {
743
+ key: 0,
744
+ "item-id": l.value
745
+ }, null, 8, ["item-id"])) : R("", !0)
746
+ ])
747
+ ]),
748
+ _: 1
749
+ }, 8, ["modelValue"])
750
+ ], 64);
751
+ };
752
+ }
753
+ });
754
+ var Al = Kt();
755
+ const et = /* @__PURE__ */ G({
756
+ __name: "ImportButton",
757
+ setup(C) {
758
+ const l = F(!1);
759
+ function c() {
760
+ l.value = !l.value;
761
+ }
762
+ const n = Ne();
763
+ return st(() => {
764
+ const o = n.currentCountry.value;
765
+ if (o)
766
+ try {
767
+ Al.setCountryConfig(o);
768
+ } catch (u) {
769
+ console.log("Unable to set country config", u);
770
+ }
771
+ }), (o, u) => (m(), w(de, null, [
772
+ d(Bt, {
773
+ modelValue: l.value,
774
+ "onUpdate:modelValue": u[0] || (u[0] = (a) => l.value = a)
775
+ }, null, 8, ["modelValue"]),
776
+ ye(o.$slots, "default", { trigger: c })
777
+ ], 64));
778
+ }
779
+ }), tt = (C) => d("div", {
780
+ class: "flex flex-1 justify-end"
781
+ }, [d("span", null, [C, ot(" ")])]), Rl = {
782
+ class: "flex justify-between items-center space-x-8"
783
+ }, Ml = {
784
+ class: "flex space-x-8 items-center"
785
+ }, Ul = {
786
+ class: "w-[320px]"
787
+ }, zl = {
788
+ key: 0
789
+ }, Ol = {
790
+ key: 1,
791
+ class: /* @__PURE__ */ me(["flex-1 flex flex-col", "divide-y divide-fm-color-neutral-gray-100", "overflow-hidden"])
792
+ }, Nl = {
793
+ key: 0,
794
+ class: "flex items-center p-4"
795
+ }, Dl = {
796
+ class: /* @__PURE__ */ me(["mr-8", "fm-typo-en-body-md-400"])
797
+ }, Kl = {
798
+ key: 1,
799
+ class: "px-16 py-4 space-x-8 flex justify-end"
800
+ }, Bl = {
801
+ key: 2
802
+ }, jl = {
803
+ class: "flex space-x-8"
804
+ }, El = {
805
+ key: 1,
806
+ class: "pt-8 flex flex-col flex-1 overflow-hidden"
807
+ }, Gl = {
808
+ class: "space-y-8 pb-8"
809
+ }, Ll = {
810
+ class: "w-full px-8"
811
+ }, Wl = {
812
+ class: "flex space-x-8 px-8"
813
+ }, ql = {
814
+ key: 0,
815
+ class: "px-8"
816
+ }, Hl = {
817
+ key: 0,
818
+ class: /* @__PURE__ */ me(["flex flex-col flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100", "pb-64"])
819
+ }, Ql = ["onClick"], Yl = {
820
+ class: "min-w-0 flex flex-1 items-center justify-start space-x-16"
821
+ }, Zl = {
822
+ class: "flex-1 min-w-0"
823
+ }, Jl = {
824
+ class: "flex justify-between items-center gap-8 pb-4"
825
+ }, Xl = {
826
+ class: "flex-1 min-w-0 fm-typo-en-body-lg-600 line-clamp-2"
827
+ }, ea = {
828
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
829
+ }, ta = {
830
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
831
+ }, la = {
832
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
833
+ }, aa = {
834
+ key: 1
835
+ }, oa = {
836
+ class: "flex space-x-8"
837
+ }, ra = /* @__PURE__ */ G({
838
+ __name: "ProductTable",
839
+ props: {
840
+ modelValue: {},
841
+ originalValue: {},
842
+ isCalculating: {
843
+ type: Boolean
844
+ }
845
+ },
846
+ emits: ["update:model-value", "reset:model-value", "update:editing", "update:search-key"],
847
+ setup(C, {
848
+ expose: l,
849
+ emit: c
850
+ }) {
851
+ const n = C, {
852
+ t: o
853
+ } = $e(), u = Ne(), a = Ie(), v = Ut(), f = ut(), s = u.currentCountry, _ = h(() => s.value ? ce.Country.getCountry(s.value) : null), y = h(() => a.rules.item), {
854
+ selectedCategories: k
855
+ } = Ve(), N = h(() => {
856
+ const t = be.flatten(k.value.map((e) => e.items));
857
+ return be.uniqBy(t, (e) => e._id);
858
+ }), Y = c, S = F(!1);
859
+ ie(() => S.value, (t) => {
860
+ Y("update:editing", t);
861
+ });
862
+ const ae = (t) => {
863
+ jt.isBoolean(t) ? S.value = t : S.value = !S.value;
864
+ }, Z = F(!1), oe = F(null);
865
+ async function W() {
866
+ Z.value = !Z.value, Z.value && (await Me(), oe.value && oe.value.toggleProperty(!0));
867
+ }
868
+ l({
869
+ toggleAttributeFilter: W
870
+ });
871
+ const {
872
+ attributes: B,
873
+ filterRule: D,
874
+ mongoQuery: H
875
+ } = Vt({
876
+ valueSource: N,
877
+ entity: "item"
878
+ }), J = F(""), re = Ot(J, 300), Q = h(() => {
879
+ const t = (i) => {
880
+ var x;
881
+ return !re.value || !re.value.trim() ? !0 : [i.code, i.name, Be(i), ...Re(ne.value, i), (x = we()[i.orderFrom]) == null ? void 0 : x.label, Object.values(i.customAttributes ?? {}).join(" ")].join(" ").toLowerCase().includes(re.value.toLowerCase());
882
+ }, e = (i) => H.value ? Mt(i.customAttributes, H.value) : !0;
883
+ return N.value.filter((i) => t(i) && e(i));
884
+ }), {
885
+ categories: ne
886
+ } = Ve(), P = h(() => a.categories.map((t) => ({
887
+ label: t.name,
888
+ value: t._id || null
889
+ }))), T = h(() => a.subcategories.map((t) => ({
890
+ label: t.name,
891
+ value: t._id
892
+ }))), z = h(() => a.subcategories.reduce((t, e) => (t[e._id] = e.name, t), {}));
893
+ function M(t) {
894
+ return (t == null ? void 0 : t.map((e) => z.value[e]).filter(Boolean).join("/")) || "--";
895
+ }
896
+ const te = (t, e, i) => {
897
+ let p = be.clone(n.modelValue);
898
+ const x = p[t];
899
+ x && (typeof e == "object" && e !== null ? p[t] = {
900
+ ...x,
901
+ ...e
902
+ } : p[t] = {
903
+ ...x,
904
+ [e]: i
905
+ }, Y("update:model-value", p));
906
+ }, j = Ct(() => n.originalValue, () => n.modelValue), O = be.debounce(te, 300), A = (t) => (e) => !!e || o("menu.product.table.validation.name_required", {
907
+ field: t
908
+ }), se = (t) => t >= 0 || o("menu.product.table.validation.price_min"), L = [A("Name")], pe = () => [(t) => se(typeof t == "number" ? t : Number(t) ?? 0)], he = we(), xe = h(() => {
909
+ const t = a.isV4;
910
+ return xt.setCoreStore(u).taxSetting(t);
911
+ }), ge = h(() => [{
912
+ accessorKey: "thumbnail",
913
+ header: "",
914
+ size: 110,
915
+ meta: {
916
+ cellClass: "px-0",
917
+ headerContentClass: "px-0"
918
+ },
919
+ cell: (t) => {
920
+ var e, i;
921
+ return U(Oe, {
922
+ src: t.getValue(),
923
+ alt: (i = (e = t == null ? void 0 : t.row) == null ? void 0 : e.original) == null ? void 0 : i.name,
924
+ className: "my-8 mx-12",
925
+ size: 72,
926
+ crossorigin: !1
927
+ });
928
+ },
929
+ enableSorting: !1
930
+ }, {
931
+ accessorKey: "code",
932
+ header: () => o("menu.product.table.columns.code"),
933
+ enableSorting: !1,
934
+ size: 100,
935
+ cell: (t) => {
936
+ const e = t.row.original, i = t.getValue() || "--";
937
+ if (!S.value) return d("span", {
938
+ class: "break-all"
939
+ }, [i]);
940
+ const p = Pe(e._id);
941
+ return U(ee.FmTextField, {
942
+ disabled: !y.value.code,
943
+ modelValue: j(e._id, "code") ?? (p == null ? void 0 : p.code),
944
+ placeholder: n.modelValue[e._id].fallbackCode,
945
+ "onUpdate:modelValue": (x) => {
946
+ O(e._id, "code", x);
947
+ }
948
+ });
949
+ }
950
+ }, {
951
+ accessorKey: "name",
952
+ header: () => o("menu.product.table.columns.name"),
953
+ enableSorting: !1,
954
+ size: 250,
955
+ cell: (t) => {
956
+ const e = t.row.original, i = t.getValue();
957
+ return S.value ? U("div", {
958
+ class: "flex items-center gap-8"
959
+ }, [U(ee.FmTextField, {
960
+ disabled: !y.value.name,
961
+ modelValue: j(e._id, "name") ?? e.name,
962
+ "onUpdate:modelValue": (p) => {
963
+ O(e._id, "name", p);
964
+ },
965
+ rules: L,
966
+ placeholder: e.fallbackName
967
+ }), e.name_locale ? U(Ze, {
968
+ nameLocale: e.name_locale ?? {},
969
+ showNumber: 1
970
+ }) : null]) : U("div", {
971
+ class: "flex items-center gap-8"
972
+ }, [U("span", {
973
+ class: "text-wrap"
974
+ }, i), e.name_locale ? U(Ze, {
975
+ nameLocale: e.name_locale ?? {},
976
+ showNumber: 1
977
+ }) : null]);
978
+ }
979
+ }, {
980
+ accessorKey: "price",
981
+ header: () => {
982
+ var t;
983
+ return tt(o("menu.product.table.columns.price", {
984
+ currency: (t = _.value) == null ? void 0 : t.currency.symbol
985
+ }));
986
+ },
987
+ enableSorting: !1,
988
+ size: 140,
989
+ meta: {
990
+ textAlign: "right"
991
+ },
992
+ cell: (t) => {
993
+ var x;
994
+ const e = t.getValue();
995
+ if (!S.value) return ce.Dinero.fromFdoDinero(e).toFormat();
996
+ const i = n.modelValue[t.row.original._id], p = i.fallbackPrice;
997
+ return U(Dt, {
998
+ min: 0,
999
+ disabled: !i.editPrice,
1000
+ // @ts-ignore
1001
+ placeholder: p ? Et(p, !1) : void 0,
1002
+ modelValue: j(i._id, "price") ?? ((x = Pe(i._id)) == null ? void 0 : x.price),
1003
+ // @ts-ignore
1004
+ "onUpdate:modelValue": (V) => {
1005
+ te(i._id, "price", V);
1006
+ },
1007
+ rules: pe()
1008
+ });
1009
+ }
1010
+ }, {
1011
+ accessorKey: "taxes",
1012
+ header: () => tt(xe.value.systemCode),
1013
+ size: S.value ? 120 : 80,
1014
+ enableSorting: !1,
1015
+ meta: {
1016
+ textAlign: "right"
1017
+ },
1018
+ cell: (t) => {
1019
+ const e = t.getValue(), i = t.row.original, p = a.taxSetting.countryTaxOptions, x = a.getSelectedTax(e, i.fallbackTaxes, a.taxSetting.countryTaxOptions), V = p.find((le) => le.value === x);
1020
+ if (!S.value)
1021
+ return `${V != null && V.meta.rate ? wt(V.meta.rate) : 0}%`;
1022
+ const g = a.getSelectedTax(j(i._id, "taxes") ?? e, i.fallbackTaxes, a.taxSetting.countryTaxOptions);
1023
+ return U(ee.FmSelect, {
1024
+ disabled: !y.value.tax,
1025
+ items: a.taxSetting.countryTaxOptions,
1026
+ modelValue: g,
1027
+ "onUpdate:modelValue": async (le) => {
1028
+ const Ae = a.decodeTax(le);
1029
+ O(i._id, "taxes", [Ae]);
1030
+ }
1031
+ });
1032
+ }
1033
+ }, {
1034
+ accessorKey: "category",
1035
+ header: () => o("menu.product.table.columns.category"),
1036
+ enableSorting: !1,
1037
+ size: 140,
1038
+ cell: (t) => {
1039
+ const e = t.row.original;
1040
+ if (!S.value)
1041
+ return U(Xe, {
1042
+ categories: Re(ne.value, e)
1043
+ });
1044
+ const i = kt(n.originalValue, n.modelValue, e._id) ?? St(e), p = (i == null ? void 0 : i.map((V) => V._id)) ?? [], x = i == null ? void 0 : i.reduce((V, g) => (V[g._id] = g, V), {});
1045
+ return U(At, {
1046
+ shouldShowChips: !1,
1047
+ shouldShowSelectedItemsWithinPlaceholder: !0,
1048
+ modelValue: p.length > 0 ? p : [null],
1049
+ items: P.value,
1050
+ disabled: !!(a.state.currentCatalogId || a.state.currentSchedulerId),
1051
+ "onUpdate:modelValue": async (V) => {
1052
+ const [g, ...le] = V, Ae = g === "" || g === null;
1053
+ O(e._id, {
1054
+ category: g,
1055
+ additionalCategories: le.map((Ee) => {
1056
+ const Ge = x == null ? void 0 : x[Ee];
1057
+ return Ge || {
1058
+ _id: Ee,
1059
+ position: null
1060
+ };
1061
+ }),
1062
+ ...Ae ? {
1063
+ subCategories: []
1064
+ } : {}
1065
+ });
1066
+ }
1067
+ });
1068
+ }
1069
+ }, ...a.isV4 ? [{
1070
+ accessorKey: "subCategories",
1071
+ header: () => o("menu.product.table.columns.subcategory"),
1072
+ enableSorting: !1,
1073
+ size: 180,
1074
+ cell: (t) => {
1075
+ const e = t.row.original;
1076
+ return S.value ? U(Rt, {
1077
+ // Keep virtual table row height stable while editing.
1078
+ shouldShowChips: !1,
1079
+ modelValue: j(e._id, "subCategories") ?? e.subCategories ?? [],
1080
+ items: T.value,
1081
+ placeholder: o("menu.product.form.detail.path.placeholder"),
1082
+ disabled: !!(a.state.currentCatalogId || a.state.currentSchedulerId),
1083
+ isLocalOnly: !1,
1084
+ "onUpdate:modelValue": async (i) => {
1085
+ O(e._id, "subCategories", i);
1086
+ }
1087
+ }) : U("span", {
1088
+ class: "break-all"
1089
+ }, M(e.subCategories));
1090
+ }
1091
+ }] : [], {
1092
+ id: "tagging",
1093
+ accessorKey: "tagging",
1094
+ header: () => o("menu.product.table.columns.tagging"),
1095
+ enableSorting: !1,
1096
+ size: 140,
1097
+ cell: (t) => {
1098
+ const e = t.row.original;
1099
+ return U(ze, {
1100
+ customAttributes: e.customAttributes
1101
+ });
1102
+ }
1103
+ }, {
1104
+ accessorKey: "orderFrom",
1105
+ header: () => o("menu.product.table.columns.order_from"),
1106
+ enableSorting: !0,
1107
+ sortingFn: (t, e) => {
1108
+ const [i, p] = [t, e].map((x) => he[x.original.orderFrom].sortingIndex);
1109
+ return i - p;
1110
+ },
1111
+ size: 140,
1112
+ cell: (t) => {
1113
+ const e = t.getValue(), i = t.row.original;
1114
+ return S.value ? U(ee.FmSelect, {
1115
+ disabled: !y.value.orderFrom,
1116
+ items: Object.values(we()),
1117
+ modelValue: j(i._id, "orderFrom") ?? e,
1118
+ "onUpdate:modelValue": async (p) => {
1119
+ te(i._id, "orderFrom", p);
1120
+ }
1121
+ }) : U(Fe, {
1122
+ orderFrom: e
1123
+ });
1124
+ }
1125
+ }, {
1126
+ id: "actions",
1127
+ size: 100,
1128
+ meta: {
1129
+ cellClass: "pl-16",
1130
+ headerClass: "py-4",
1131
+ textAlign: "right"
1132
+ },
1133
+ header: () => U("div", {
1134
+ class: "w-full px-4 flex justify-end"
1135
+ }, [Gt(U(ee.FmButton, {
1136
+ variant: X.Tertiary,
1137
+ textColor: q.NeutralGray400,
1138
+ prependIcon: "edit",
1139
+ class: "flex justify-end",
1140
+ onClick: ae,
1141
+ type: "button"
1142
+ }), "Bulk edit")]),
1143
+ cell: (t) => {
1144
+ const e = t.row.original;
1145
+ return d("div", {
1146
+ class: "px-4 flex justify-end"
1147
+ }, [d(Pl, null, {
1148
+ default: ({
1149
+ trigger: i
1150
+ }) => d(ee.FmButton, {
1151
+ icon: "overview",
1152
+ variant: "tertiary",
1153
+ textColor: q.NeutralGray400,
1154
+ onClick: fe(() => {
1155
+ i(e._id);
1156
+ }, ["stop", "prevent"])
1157
+ }, null)
1158
+ }), d(ee.FmButton, {
1159
+ icon: "delete",
1160
+ variant: "tertiary",
1161
+ textColor: q.NeutralGray400,
1162
+ onClick: fe(async () => {
1163
+ await f.deleteItem([{
1164
+ _id: e._id,
1165
+ name: e.name,
1166
+ thumbnail: e.thumbnail
1167
+ }]);
1168
+ }, ["stop", "prevent"])
1169
+ }, null)]);
1170
+ }
1171
+ }]);
1172
+ a.taxSetting.systemCode || ge.value.splice(4, 1);
1173
+ const ve = F({}), ue = F([]);
1174
+ ie([() => ve.value, () => Q.value], (t) => {
1175
+ let e = [];
1176
+ Object.keys(t[0]).forEach((i) => {
1177
+ const p = t[0][i], x = Q.value[parseInt(i)];
1178
+ x && (p ? e.push(x) : ue.value = e.filter((V) => V !== x));
1179
+ }), ue.value = e;
1180
+ }), ie(() => N.value, () => {
1181
+ ve.value = {}, ue.value = [];
1182
+ }), ie(() => S.value, () => {
1183
+ ve.value = {}, ue.value = [];
1184
+ });
1185
+ const dt = () => {
1186
+ ve.value = {};
1187
+ };
1188
+ async function Ke() {
1189
+ await Me();
1190
+ const t = () => !!a.currentCatalog || !!a.state.currentSchedulerId, e = (p) => p === "" || p === null ? t() ? "" : null : p, i = Object.values(n.modelValue).filter((p) => {
1191
+ const x = Object.values(n.originalValue).find((V) => V._id === p._id);
1192
+ return We(x, p);
1193
+ }).map((p) => ({
1194
+ _id: p._id,
1195
+ name: p.name,
1196
+ code: p.code,
1197
+ price: p.price,
1198
+ orderFrom: p.orderFrom ?? null,
1199
+ taxes: p.taxes,
1200
+ category: e(p.category || null),
1201
+ additionalCategories: p.additionalCategories,
1202
+ subCategories: p.subCategories
1203
+ }));
1204
+ await f.updateMany(i), ae(!1);
1205
+ }
1206
+ const mt = async () => {
1207
+ await f.deleteItem(ue.value.map((t) => ({
1208
+ _id: t._id,
1209
+ name: t.name,
1210
+ thumbnail: t.thumbnail
1211
+ })));
1212
+ }, Ce = () => {
1213
+ Y("reset:model-value");
1214
+ }, Te = () => {
1215
+ Object.entries(n.modelValue).some(([e, i]) => We(i, n.originalValue[e])) ? v.open({
1216
+ title: "You have unsaved changes!",
1217
+ message: "Are you sure you want to discard? You will lose all the changes if discard edit.",
1218
+ primaryActions: {
1219
+ text: "Discard",
1220
+ close: !0,
1221
+ variant: X.Destructive
1222
+ },
1223
+ secondaryActions: {
1224
+ text: "Cancel",
1225
+ close: !0
1226
+ }
1227
+ }).onPrimary(() => {
1228
+ Ce(), ae(!1);
1229
+ }) : (ae(!1), Ce());
1230
+ }, pt = h(() => {
1231
+ var t, e;
1232
+ return {
1233
+ thumbnail: !S.value,
1234
+ actions: !S.value,
1235
+ tagging: !S.value && ((e = (t = u.itemAttributeSettings) == null ? void 0 : t.value) == null ? void 0 : e.length) > 0
1236
+ };
1237
+ }), vt = (t) => {
1238
+ f.update(t._id);
1239
+ };
1240
+ async function ft(t) {
1241
+ await f.update(t.original._id);
1242
+ }
1243
+ function Be(t) {
1244
+ var g;
1245
+ const e = t.price ?? // TODO: fix type error
1246
+ // @ts-ignore
1247
+ t.fallbackPrice ?? ce.Dinero.fromNumber({
1248
+ number: 0
1249
+ }).toObject(), i = t.taxes, p = a.taxSetting.countryTaxOptions, x = ce.Dinero.fromFdoDinero(e).toFormat(), V = (g = _.value) == null ? void 0 : g.currency.symbol;
1250
+ return a.getSelectedTax(
1251
+ i,
1252
+ // TODO: fix type error
1253
+ // @ts-ignore
1254
+ t.fallbackTaxes,
1255
+ p
1256
+ ), `${V == null ? void 0 : V.toUpperCase()}${x}`;
1257
+ }
1258
+ function Pe(t) {
1259
+ var p;
1260
+ const e = a.currentCatalog, i = a.state.currentSchedulerId;
1261
+ if (e && i) {
1262
+ const x = e.override.scheduler[i] ?? {}, V = (p = x == null ? void 0 : x.items) == null ? void 0 : p.filter((g) => g._id === t);
1263
+ return V == null ? void 0 : V[0];
1264
+ } else return e ? e.override.items[t][0] : i ? a.schedulers.find((g) => g._id === i).items.filter((g) => g._id === t)[0] : N.value.find((x) => x._id === t);
1265
+ }
1266
+ const gt = it(), bt = h(() => gt.breakpoints.value.xs), je = F(null), _t = Nt(je, Z), yt = h(() => {
1267
+ var e;
1268
+ return {
1269
+ height: `calc(100vh - ${((e = _t.value) == null ? void 0 : e.top) + 24}px)`
1270
+ };
1271
+ });
1272
+ return (t, e) => {
1273
+ const i = K("fm-search"), p = K("fm-button"), x = K("fm-table"), V = K("fm-form");
1274
+ return bt.value ? (m(), w("div", El, [b("div", Gl, [b("div", Ll, [d(i, {
1275
+ "model-value": J.value,
1276
+ "onUpdate:modelValue": e[5] || (e[5] = (g) => J.value = g),
1277
+ autofocus: "",
1278
+ placeholder: r(o)("menu.product.table.search.placeholder")
1279
+ }, null, 8, ["model-value", "placeholder"])]), e[8] || (e[8] = b("div", {
1280
+ class: "w-full h-[1px] bg-fm-color-neutral-gray-100"
1281
+ }, null, -1)), b("div", Wl, [ye(t.$slots, "filter")]), Z.value ? (m(), w("div", ql, [d(r(Ye), {
1282
+ ref_key: "attributeFilterRef",
1283
+ ref: oe,
1284
+ attributes: r(B),
1285
+ modelValue: r(D),
1286
+ "onUpdate:modelValue": e[6] || (e[6] = (g) => Le(D) ? D.value = g : null)
1287
+ }, null, 8, ["attributes", "modelValue"])])) : R("", !0)]), N.value.length ? (m(), w("div", Hl, [(m(!0), w(de, null, Se(Q.value, (g) => {
1288
+ var le;
1289
+ return m(), w("div", {
1290
+ key: g._id,
1291
+ class: "max-w-full py-12 px-16 space-x-16 flex items-center",
1292
+ onClick: () => vt(g)
1293
+ }, [b("div", Yl, [d(Oe, {
1294
+ alt: g.name,
1295
+ size: 72,
1296
+ src: g.thumbnail
1297
+ }, null, 8, ["alt", "src"]), b("div", Zl, [b("div", Jl, [b("p", Xl, E(g.name), 1), d(Fe, {
1298
+ "order-from": g.orderFrom
1299
+ }, null, 8, ["order-from"])]), b("p", ea, E(Be(g)), 1), b("p", ta, E(r(o)("menu.product.table.columns.code")) + ": " + E(((le = Pe(g._id)) == null ? void 0 : le.code) || "--"), 1), b("p", la, [d(Xe, {
1300
+ categories: r(Re)(r(ne), g)
1301
+ }, null, 8, ["categories"])]), d(ze, {
1302
+ "custom-attributes": g.customAttributes
1303
+ }, null, 8, ["custom-attributes"])])]), d(p, {
1304
+ "text-color": r(q).NeutralGray400,
1305
+ variant: r(X).Tertiary,
1306
+ "prepend-icon": "delete",
1307
+ onClick: fe(() => r(f).deleteItem([{
1308
+ _id: g._id,
1309
+ name: g.name,
1310
+ thumbnail: g.thumbnail
1311
+ }]), ["stop"])
1312
+ }, null, 8, ["text-color", "variant", "onClick"])], 8, Ql);
1313
+ }), 128))])) : (m(), w("div", aa, [d(_e, {
1314
+ subtitle: r(o)("menu.product.table.empty.subtitle"),
1315
+ title: r(o)("menu.product.table.empty.title")
1316
+ }, {
1317
+ action: $(() => [b("div", oa, [d(p, {
1318
+ variant: r(X).Primary,
1319
+ label: r(o)("menu.product.table.empty.actions.add"),
1320
+ "prepend-icon": "add",
1321
+ onClick: e[7] || (e[7] = (g) => r(f).create(null))
1322
+ }, null, 8, ["variant", "label"]), d(et, null, {
1323
+ default: $(({
1324
+ trigger: g
1325
+ }) => [d(p, {
1326
+ "bg-color": r(q).NeutralGray100,
1327
+ "text-color": r(q).NeutralGray400,
1328
+ variant: r(X).Primary,
1329
+ label: r(o)("menu.product.table.empty.actions.import"),
1330
+ "prepend-icon": "download",
1331
+ onClick: g
1332
+ }, null, 8, ["bg-color", "text-color", "variant", "label", "onClick"])]),
1333
+ _: 1
1334
+ })])]),
1335
+ _: 1
1336
+ }, 8, ["subtitle", "title"])]))])) : (m(), I(V, {
1337
+ key: 0,
1338
+ "blame-form-child-on-validation-failed": "",
1339
+ class: "flex flex-col flex-1 space-y-8 overflow-hidden",
1340
+ onValidationSuccess: Ke
1341
+ }, {
1342
+ default: $(() => [b("div", Rl, [b("div", Ml, [ye(t.$slots, "filter")]), b("div", Ul, [d(i, {
1343
+ "model-value": J.value,
1344
+ "onUpdate:modelValue": e[0] || (e[0] = (g) => J.value = g),
1345
+ autofocus: "",
1346
+ placeholder: r(o)("menu.product.table.search.placeholder")
1347
+ }, null, 8, ["model-value", "placeholder"])])]), Z.value ? (m(), w("div", zl, [d(r(Ye), {
1348
+ ref_key: "attributeFilterRef",
1349
+ ref: oe,
1350
+ attributes: r(B),
1351
+ modelValue: r(D),
1352
+ "onUpdate:modelValue": e[1] || (e[1] = (g) => Le(D) ? D.value = g : null)
1353
+ }, null, 8, ["attributes", "modelValue"])])) : R("", !0), N.value.length ? (m(), w("div", Ol, [ue.value.length && !S.value ? (m(), w("div", Nl, [b("p", Dl, E(r(o)("menu.product.table.selection.count", {
1354
+ count: ue.value.length
1355
+ })), 1), d(p, {
1356
+ label: r(o)("menu.product.table.selection.actions.deselect_all"),
1357
+ type: "button",
1358
+ variant: "plain",
1359
+ onClick: dt
1360
+ }, null, 8, ["label"]), d(p, {
1361
+ "border-color": r(q).SystemError300,
1362
+ "text-color": r(q).SystemError300,
1363
+ class: "ml-auto",
1364
+ label: r(o)("menu.product.table.selection.actions.remove"),
1365
+ "prepend-icon": "delete",
1366
+ variant: "secondary",
1367
+ onClick: mt
1368
+ }, null, 8, ["border-color", "text-color", "label"])])) : R("", !0), S.value ? (m(), w("div", Kl, [d(p, {
1369
+ variant: r(X).Tertiary,
1370
+ label: r(o)("menu.product.table.bulk_edit.actions.reset_all"),
1371
+ onClick: Ce
1372
+ }, null, 8, ["variant", "label"]), d(p, {
1373
+ variant: r(X).Tertiary,
1374
+ label: r(o)("menu.common.actions.cancel"),
1375
+ onClick: Te
1376
+ }, null, 8, ["variant", "label"]), d(p, {
1377
+ borderColor: r(q).ColorPrimary,
1378
+ textColor: r(q).ColorPrimary,
1379
+ variant: r(X).Secondary,
1380
+ label: r(o)("menu.product.table.bulk_edit.actions.save"),
1381
+ type: "submit"
1382
+ }, null, 8, ["borderColor", "textColor", "variant", "label"])])) : R("", !0), b("div", {
1383
+ ref_key: "tableWrapper",
1384
+ ref: je
1385
+ }, [(m(), I(nt(S.value ? zt : "div"), {
1386
+ ref: "fullWrapper",
1387
+ title: S.value ? r(o)("menu.product.table.bulk_edit.title") : "",
1388
+ show: S.value,
1389
+ "primary-action": {
1390
+ label: r(o)("menu.product.table.bulk_edit.actions.save")
1391
+ },
1392
+ "secondary-actions": [{
1393
+ label: r(o)("menu.product.table.bulk_edit.actions.reset_all"),
1394
+ click: Ce
1395
+ }, {
1396
+ label: r(o)("menu.common.actions.cancel"),
1397
+ click: Te
1398
+ }],
1399
+ class: "overflow-x-scroll",
1400
+ style: ht(yt.value),
1401
+ onOnPrimary: Ke,
1402
+ onOnCancel: Te
1403
+ }, {
1404
+ default: $(() => [d(x, {
1405
+ class: me({
1406
+ "min-w-[1280px]": !0,
1407
+ "mt-24": S.value
1408
+ }),
1409
+ modelValue: ve.value,
1410
+ "onUpdate:modelValue": e[2] || (e[2] = (g) => ve.value = g),
1411
+ "column-defs": ge.value,
1412
+ "column-visibility": pt.value,
1413
+ loading: t.isCalculating,
1414
+ "page-size": Q.value.length,
1415
+ "row-data": Q.value,
1416
+ "shrink-at": !1,
1417
+ selection: S.value ? void 0 : "multiple",
1418
+ virtual: !0,
1419
+ "virtual-row-height": S.value ? 48 : 91,
1420
+ "hide-footer": "",
1421
+ "pin-header-row": "",
1422
+ onRowClick: e[3] || (e[3] = (g) => S.value ? void 0 : ft(g))
1423
+ }, null, 8, ["class", "modelValue", "column-defs", "column-visibility", "loading", "page-size", "row-data", "selection", "virtual-row-height"])]),
1424
+ _: 1
1425
+ }, 40, ["title", "show", "primary-action", "secondary-actions", "style"]))], 512)])) : (m(), w("div", Bl, [d(_e, {
1426
+ subtitle: r(o)("menu.product.table.empty.subtitle"),
1427
+ title: r(o)("menu.product.table.empty.title")
1428
+ }, {
1429
+ action: $(() => [b("div", jl, [d(p, {
1430
+ variant: r(X).Primary,
1431
+ label: r(o)("menu.product.table.empty.actions.add"),
1432
+ "prepend-icon": "add",
1433
+ onClick: e[4] || (e[4] = (g) => r(f).create(null))
1434
+ }, null, 8, ["variant", "label"]), d(et, null, {
1435
+ default: $(({
1436
+ trigger: g
1437
+ }) => [d(p, {
1438
+ "bg-color": r(q).NeutralGray100,
1439
+ "text-color": r(q).NeutralGray400,
1440
+ variant: r(X).Primary,
1441
+ label: r(o)("menu.product.table.empty.actions.import"),
1442
+ "prepend-icon": "download",
1443
+ onClick: g
1444
+ }, null, 8, ["bg-color", "text-color", "variant", "label", "onClick"])]),
1445
+ _: 1
1446
+ })])]),
1447
+ _: 1
1448
+ }, 8, ["subtitle", "title"])]))]),
1449
+ _: 3
1450
+ }));
1451
+ };
1452
+ }
1453
+ }), na = {
1454
+ key: 0,
1455
+ class: /* @__PURE__ */ me(["flex flex-col", "flex-1", "overflow-hidden"])
1456
+ }, sa = {
1457
+ class: /* @__PURE__ */ me(["pt-16 xs:pt-0", "flex xs:flex-col", "flex-1", "w-full", "overflow-hidden"])
1458
+ }, ua = { class: "flex flex-col flex-1 overflow-hidden" }, ia = {
1459
+ key: 1,
1460
+ class: "pt-16 xs:pt-8 space-y-24"
1461
+ }, ca = { class: "flex items-center gap-8 px-16" }, Aa = /* @__PURE__ */ G({
1462
+ __name: "Product",
1463
+ setup(C) {
1464
+ const l = Ie(), c = h(() => l.rules.item), n = ut(), o = h(() => !l.state.currentCatalogId), u = h(() => l.rules.item), a = h(() => !l.state.currentSchedulerId), v = F(!1), f = F(!1), s = h(() => {
1465
+ var T, z, M, te;
1466
+ if (o.value && a.value) return;
1467
+ if (a.value) {
1468
+ const j = (T = l.currentCatalog) == null ? void 0 : T.override.items;
1469
+ return j ? Object.entries(j).reduce((O, [A, se]) => {
1470
+ const L = se.find((pe) => !pe.combinationKey);
1471
+ return L && (O[A] = L), O;
1472
+ }, {}) : {};
1473
+ }
1474
+ return ((o.value ? (z = l.currentScheduler) == null ? void 0 : z.items : (te = (M = l.currentCatalog) == null ? void 0 : M.override.scheduler[l.state.currentSchedulerId]) == null ? void 0 : te.items) ?? []).reduce((j, O) => (O.combinationKey || (j[O._id] = O), j), {});
1475
+ }), _ = F({}), y = F({}), k = async () => {
1476
+ var te, j;
1477
+ f.value = !0;
1478
+ const P = !!s.value, T = be.flatten(Y.value.map((O) => O.items)), z = P && v.value ? await Pt(
1479
+ l.mergedMenu,
1480
+ T,
1481
+ l.state.menu,
1482
+ (te = l.currentCatalog) == null ? void 0 : te._id,
1483
+ (j = l.currentScheduler) == null ? void 0 : j._id,
1484
+ !1
1485
+ ) : void 0, M = T.reduce((O, A, se) => {
1486
+ var pe, he, xe, ge;
1487
+ const L = (pe = s.value) == null ? void 0 : pe[A._id];
1488
+ return O[A._id] = {
1489
+ _id: A._id,
1490
+ name: A.name,
1491
+ code: P ? L == null ? void 0 : L.code : A == null ? void 0 : A.code,
1492
+ category: A.category,
1493
+ additionalCategories: A.additionalCategories,
1494
+ subCategories: A.subCategories,
1495
+ price: P && u.value.editPrice ? L == null ? void 0 : L.price : A.price,
1496
+ orderFrom: P ? L == null ? void 0 : L.orderFrom : A.orderFrom,
1497
+ taxes: P ? null : A.taxes,
1498
+ thumbnail: A.thumbnail,
1499
+ fallbackPrice: (he = z == null ? void 0 : z[se]) == null ? void 0 : he.price,
1500
+ fallbackName: P ? A.name : void 0,
1501
+ fallbackCode: (xe = z == null ? void 0 : z[se]) == null ? void 0 : xe.code,
1502
+ fallbackOrder: (ge = z == null ? void 0 : z[se]) == null ? void 0 : ge.orderFrom,
1503
+ fallbackTaxes: P ? A.taxes : null
1504
+ }, O;
1505
+ }, {});
1506
+ _.value = M, y.value = { ...M }, f.value = !1;
1507
+ }, { categories: N, selectedCategories: Y } = Ve(), S = F(null);
1508
+ function ae() {
1509
+ S.value && S.value.toggleAttributeFilter();
1510
+ }
1511
+ rt(async () => {
1512
+ Y.value && await k();
1513
+ });
1514
+ function Z() {
1515
+ n.create(null);
1516
+ }
1517
+ const oe = () => {
1518
+ Y.value && k();
1519
+ }, { t: W } = $e(), B = h(() => {
1520
+ var P, T;
1521
+ return (T = (P = l.currentCatalog) == null ? void 0 : P.linkItemRules) == null ? void 0 : T.length;
1522
+ }), {
1523
+ menuItems: D,
1524
+ categories: H,
1525
+ linkItemRules: J,
1526
+ handleSubmit: re,
1527
+ catalogManager: Q,
1528
+ schedulerManager: ne
1529
+ } = Ft(!1);
1530
+ return (P, T) => {
1531
+ const z = K("fm-button");
1532
+ return r(N).length ? (m(), w("div", na, [
1533
+ b("div", sa, [
1534
+ b("div", ua, [
1535
+ r(Y) ? (m(), I(ra, {
1536
+ key: 0,
1537
+ ref_key: "productTableRef",
1538
+ ref: S,
1539
+ "is-calculating": f.value,
1540
+ "model-value": _.value,
1541
+ "original-value": y.value,
1542
+ "onUpdate:modelValue": T[1] || (T[1] = (M) => _.value = M),
1543
+ "onReset:modelValue": oe,
1544
+ "onUpdate:editing": T[2] || (T[2] = (M) => v.value = M)
1545
+ }, {
1546
+ filter: $(() => [
1547
+ d(Je, { onToggleAttributeFilter: ae }),
1548
+ u.value.multiScheduler ? (m(), I(Qe, { key: 0 })) : R("", !0),
1549
+ B.value ? (m(), I(He, {
1550
+ key: 1,
1551
+ "current-restaurant-attr-params": r(l).state.currentRestaurantAttrParams,
1552
+ onConfirm: T[0] || (T[0] = (M) => r(l).setRestaurantAttrParams(M))
1553
+ }, null, 8, ["current-restaurant-attr-params"])) : R("", !0)
1554
+ ]),
1555
+ _: 1
1556
+ }, 8, ["is-calculating", "model-value", "original-value"])) : R("", !0)
1557
+ ])
1558
+ ])
1559
+ ])) : (m(), w("div", ia, [
1560
+ b("div", ca, [
1561
+ d(Je),
1562
+ u.value.multiScheduler ? (m(), I(Qe, { key: 0 })) : R("", !0),
1563
+ B.value ? (m(), I(He, {
1564
+ key: 1,
1565
+ "current-restaurant-attr-params": r(l).state.currentRestaurantAttrParams,
1566
+ onConfirm: T[3] || (T[3] = (M) => r(l).setRestaurantAttrParams(M))
1567
+ }, null, 8, ["current-restaurant-attr-params"])) : R("", !0)
1568
+ ]),
1569
+ c.value.create ? (m(), I(_e, {
1570
+ key: 0,
1571
+ action: {
1572
+ text: r(W)("menu.product.empty.with_create.action"),
1573
+ callback: Z
1574
+ },
1575
+ subtitle: r(W)("menu.product.empty.with_create.subtitle"),
1576
+ title: r(W)("menu.product.empty.with_create.title")
1577
+ }, null, 8, ["action", "subtitle", "title"])) : a.value ? (m(), I(_e, {
1578
+ key: 1,
1579
+ subtitle: r(W)("menu.product.empty.no_scheduler.subtitle"),
1580
+ title: r(W)("menu.product.empty.no_scheduler.title")
1581
+ }, {
1582
+ action: $(() => [
1583
+ d(qe, {
1584
+ "categorized-items": r(Q).linkableItems.value,
1585
+ "initial-value": r(Q).currentItems.value,
1586
+ "show-variant": !1,
1587
+ "menu-items": r(D),
1588
+ categories: r(H),
1589
+ "link-item-rules": r(J),
1590
+ "no-scheduler": a.value,
1591
+ "is-local-only": !0,
1592
+ onSubmit: r(re)
1593
+ }, {
1594
+ default: $(({ trigger: M }) => [
1595
+ d(z, {
1596
+ label: r(W)("menu.common.actions.link_product"),
1597
+ "prepend-icon": "link",
1598
+ onClick: M
1599
+ }, null, 8, ["label", "onClick"])
1600
+ ]),
1601
+ _: 1
1602
+ }, 8, ["categorized-items", "initial-value", "menu-items", "categories", "link-item-rules", "no-scheduler", "onSubmit"])
1603
+ ]),
1604
+ _: 1
1605
+ }, 8, ["subtitle", "title"])) : (m(), I(_e, {
1606
+ key: 2,
1607
+ subtitle: r(W)("menu.product.empty.with_scheduler.subtitle"),
1608
+ title: r(W)("menu.product.empty.with_scheduler.title")
1609
+ }, {
1610
+ action: $(() => [
1611
+ d(qe, {
1612
+ "categorized-items": r(ne).linkableItems.value,
1613
+ "initial-value": r(ne).currentItems.value,
1614
+ "show-variant": !1,
1615
+ "menu-items": r(D),
1616
+ categories: r(H),
1617
+ "link-item-rules": r(J),
1618
+ "no-scheduler": a.value,
1619
+ "is-local-only": !0,
1620
+ onSubmit: r(re)
1621
+ }, {
1622
+ default: $(({ trigger: M }) => [
1623
+ d(z, {
1624
+ label: r(W)("menu.common.actions.apply_product"),
1625
+ onClick: M
1626
+ }, null, 8, ["label", "onClick"])
1627
+ ]),
1628
+ _: 1
1629
+ }, 8, ["categorized-items", "initial-value", "menu-items", "categories", "link-item-rules", "no-scheduler", "onSubmit"])
1630
+ ]),
1631
+ _: 1
1632
+ }, 8, ["subtitle", "title"]))
1633
+ ]));
1634
+ };
1635
+ }
1636
+ });
1637
+ export {
1638
+ et as _,
1639
+ Aa as a
1640
+ };