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