@feedmepos/mf-menu 0.31.10-prod → 0.31.11-beta.1

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