@feedmepos/mf-menu 0.31.33 → 0.31.34-alpha

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 (101) hide show
  1. package/dist/{App-DNDOc3bV.js → App-CaKDbV0S.js} +6 -6
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BvrfcWHU.js → ApplyProduct.vue_vue_type_script_setup_true_lang-gY18sRMg.js} +20 -20
  3. package/dist/{Catalog-Zhi-3W6T.js → Catalog-B0zMoi7e.js} +80 -80
  4. package/dist/{Category-BU0bkAGd.js → Category-Dyou6Q17.js} +31 -27
  5. package/dist/{Category-CE9ixFkD.js → Category-rMN8037Q.js} +19 -19
  6. package/dist/{CookingGuide-eghVaeEY.js → CookingGuide-DT2XxaWa.js} +4 -4
  7. package/dist/CustomAttributeChip.vue_vue_type_script_setup_true_lang-Cv9LNAfi.js +113 -0
  8. package/dist/{Group-DWrtP9Au.js → Group-CYSIOe3D.js} +1 -1
  9. package/dist/{Group-DDZPf6LY.js → Group-M4WPAAYz.js} +3 -3
  10. package/dist/Group.vue_vue_type_script_setup_true_lang-B-BH-2WN.js +686 -0
  11. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-TQWka93A.js +367 -0
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Cus0YKUt.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DgSO7SQW.js} +4982 -5081
  13. package/dist/{Ingredient-BJgvOyV9.js → Ingredient-DNvr30pW.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-CF99abLi.js → InventoryBinding.vue_vue_type_script_setup_true_lang-G44luws0.js} +1052 -1052
  15. package/dist/LinkProductSideSheet-Cp0HFoP2.js +297 -0
  16. package/dist/LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js +8024 -0
  17. package/dist/{MenuSetting-gkwORUX0.js → MenuSetting-UeQ2NyVm.js} +4 -4
  18. package/dist/{PrintRoute-Cda6sFlL.js → PrintRoute-5uX9ymJY.js} +89 -88
  19. package/dist/{Product-61AAh5L-.js → Product-Dxqf8_iq.js} +1 -1
  20. package/dist/Product.vue_vue_type_script_setup_true_lang-DUtGVRCH.js +1578 -0
  21. package/dist/{ProductInternalTools-o8cVZXCT.js → ProductInternalTools-BCF9q0i_.js} +5 -5
  22. package/dist/Products--adhOQ8n.js +283 -0
  23. package/dist/{Publish-BRgJUzoA.js → Publish-CRaoaFxc.js} +3 -3
  24. package/dist/{Recipe-CV8lvryp.js → Recipe-DPkzZMJi.js} +4 -4
  25. package/dist/{Scheduler-B_ptvb82.js → Scheduler-BuwjNHHj.js} +3 -3
  26. package/dist/{ServingSequence-DABGnLbT.js → ServingSequence-Cdf_Zmat.js} +3 -3
  27. package/dist/Setting-Vr3Thttm.js +259 -0
  28. package/dist/{Subcategory-BiqlAvMs.js → Subcategory-DoXmjcg1.js} +4 -4
  29. package/dist/{Takeaway-BBdkzEiP.js → Takeaway-BRTQu8VT.js} +1 -1
  30. package/dist/{Takeaway-nIjrDu5C.js → Takeaway-t3il54Bd.js} +4 -4
  31. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-D_M2PFO-.js → Takeaway.vue_vue_type_script_setup_true_lang-DtHABSgp.js} +6 -6
  32. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-D_ACNj_Z.js +431 -0
  33. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DAoGiRV-.js +5990 -0
  34. package/dist/{Unit-Di5sUbhV.js → Unit-C_QY3IX_.js} +2 -2
  35. package/dist/{Variant-CiZCtZk9.js → Variant-CR4IEm-Q.js} +3 -3
  36. package/dist/_id_-DOU7ieGB.js +202 -0
  37. package/dist/{app-B63V5b4I.js → app--fRC3N4C.js} +1 -1
  38. package/dist/{app-DuD_IPou.js → app-CrXLAKdw.js} +95 -97
  39. package/dist/app.js +6 -7
  40. package/dist/apps/mf-menu/src/app.d.ts +62 -3
  41. package/dist/apps/mf-menu/src/components/feature/PriceTier/LinkPriceTierSection.vue.d.ts +24 -0
  42. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +30 -0
  43. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +33 -0
  44. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/catalog.d.ts +2 -0
  45. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +80 -1
  46. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +1276 -0
  47. package/dist/apps/mf-menu/src/helper/import-export.d.ts +77 -0
  48. package/dist/apps/mf-menu/src/helper/menu.d.ts +77 -0
  49. package/dist/apps/mf-menu/src/helper/setting/catalogSetting.d.ts +11 -2
  50. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +77 -0
  51. package/dist/apps/mf-menu/src/router/shared.d.ts +0 -1
  52. package/dist/apps/mf-menu/src/stores/manager/catalog.d.ts +2 -0
  53. package/dist/apps/mf-menu/src/stores/menu.d.ts +79 -0
  54. package/dist/apps/mf-menu/src/types/linkProducts.d.ts +21 -0
  55. package/dist/apps/mf-menu/src/views/PrintRoute/PrintDepartmentDialog.vue.d.ts +5 -3
  56. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +82 -0
  57. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/assets/linked-status-BTF_dm9R.js +24 -0
  59. package/dist/assets/override-menu-BPu7TVCy.js +24 -0
  60. package/dist/assets/validate-menu-BQpDfHbr.js +24 -0
  61. package/dist/{catalog-DfYSMjLc.js → catalog-BGiDWODL.js} +1 -1
  62. package/dist/catalogSetting-C34kIcYn.js +71 -0
  63. package/dist/{category-mmjX_QdF.js → category-CayMSpUc.js} +1 -1
  64. package/dist/{currency-3ugQtBPt.js → currency-BggoZpJv.js} +1 -1
  65. package/dist/{dayjs.min-CkV4mNm8.js → dayjs.min-BKDTLohL.js} +1 -1
  66. package/dist/{index-Cztb2LVZ.js → index-BPcRbiW0.js} +3 -3
  67. package/dist/{index-BboaHtmY.js → index-CLFhXi0y.js} +3 -3
  68. package/dist/index-D7yR1j9C.js +215 -0
  69. package/dist/{index-BZaKuDcN.js → index-f9kzXNPD.js} +28 -28
  70. package/dist/{item-CVnDeXhJ.js → item-C51o9ejv.js} +547 -545
  71. package/dist/{jszip.min-GxfcHBC5.js → jszip.min-m57vowh9.js} +353 -353
  72. package/dist/{menu-sGVv4bhQ.js → menu-DHfLxvzU.js} +4 -4
  73. package/dist/menu-DK7wG3S5.js +133287 -0
  74. package/dist/menuV2-B-0V65cx.js +707 -0
  75. package/dist/mf-menu.css +1 -1
  76. package/dist/{priceTier-CHTA0ZEb.js → priceTier-DD-24pkj.js} +1 -1
  77. package/dist/{scheduler-CaMxCHZ0.js → scheduler-NjDv_P4c.js} +16 -17
  78. package/dist/subcategory-DLdBwjHV.js +148 -0
  79. package/dist/{toExcel-WorodvP1.js → toExcel-coJ5igRV.js} +15 -15
  80. package/dist/{unit-DtKZZYL6.js → unit-C7XUV0EW.js} +5 -4
  81. package/package.json +5 -5
  82. package/dist/CustomAttributeChip.vue_vue_type_script_setup_true_lang-BiF8rW4M.js +0 -7949
  83. package/dist/FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js +0 -26
  84. package/dist/Group.vue_vue_type_script_setup_true_lang-DyqGsRAW.js +0 -698
  85. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BmRUg94d.js +0 -206
  86. package/dist/LinkProductSideSheet-CTT4oGUY.js +0 -112
  87. package/dist/Product.vue_vue_type_script_setup_true_lang-Cy4uok1E.js +0 -1560
  88. package/dist/Products-D0rrANT6.js +0 -270
  89. package/dist/Setting-3ISlMXOA.js +0 -258
  90. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-DzQ8_6Bi.js +0 -71
  91. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-y0n5hTLk.js +0 -6149
  92. package/dist/_id_-DY8himeL.js +0 -200
  93. package/dist/apps/mf-menu/src/components/feature/LinkProduct/LinkProductSideSheet.vue.d.ts +0 -70
  94. package/dist/assets/linked-status-CkBKnMXs.js +0 -24
  95. package/dist/assets/override-menu-XZ7XfcfS.js +0 -24
  96. package/dist/assets/validate-menu-Bomogq01.js +0 -24
  97. package/dist/catalogSetting-_4Z0s3_Q.js +0 -65
  98. package/dist/index-Ce4v8o7D.js +0 -106
  99. package/dist/menu-IGORh0Ik.js +0 -108039
  100. package/dist/subcategory-CmVttqlG.js +0 -817
  101. /package/dist/{apps/mf-menu/src/components → packages/shared/src/components/info}/CustomAttributeChip.vue.d.ts +0 -0
@@ -1,1560 +0,0 @@
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 D, 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 Ze, nextTick as $e, resolveDynamicComponent as Je, onMounted as Xe, h as q, normalizeStyle as vt } from "vue";
2
- import { u as ke, Q as ye, A as oe, H as Te, I as me, U as ft, ab as gt, ac as bt, ad as Ie, ae as _t, P as yt, af as Re } from "./menu-IGORh0Ik.js";
3
- import { useI18n as Se, useCoreStore as Oe } from "@feedmepos/mf-common";
4
- import { u as Ce } from "./menu-sGVv4bhQ.js";
5
- import { _ as pe } from "./index.vue_vue_type_script_setup_true_lang-BgqsTzLI.js";
6
- import { L as Be } from "./LinkProductSideSheet-CTT4oGUY.js";
7
- import { _ as Pe, h as je, a as ht, b as Ee } from "./CustomAttributeChip.vue_vue_type_script_setup_true_lang-BiF8rW4M.js";
8
- import { f as xt, o as Ct, b as wt, m as kt } from "./subcategory-CmVttqlG.js";
9
- import { r as St, _ as Ft, a as Vt, u as It } from "./ImportProductDialog.vue_vue_type_script_setup_true_lang-Cus0YKUt.js";
10
- import { u as et, C as $t } from "./item-CVnDeXhJ.js";
11
- import { useBreakpoints as tt, components as J, useDialog as Tt, FmButtonColorThemeVariant as Q, FmButtonVariant as Z } from "@feedmepos/ui-library";
12
- import { F as Pt } from "./index-BZaKuDcN.js";
13
- import { _ as Ue, u as At } from "./app-DuD_IPou.js";
14
- import { _ as he } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
15
- import { _ as Ot } from "./index-Cztb2LVZ.js";
16
- import { _ as Ae } from "./Thumbnail.vue_vue_type_script_setup_true_lang-DzQ8_6Bi.js";
17
- import { c as Ut } from "./check-C9mY6LiX.js";
18
- import { f as Mt } from "./currency-3ugQtBPt.js";
19
- import { w as Dt } from "./tooltip-B5BiPMx9.js";
20
- import { r as zt } from "./index-Ce4v8o7D.js";
21
- function Nt(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 Kt = { 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, z;
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 : `${(z = i.value) == null ? void 0 : z.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 } = Nt(
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 z = B("FmIcon"), M = B("FmChip"), T = B("FmSearch"), $ = B("FmMenuItem"), N = B("FmMenu");
68
- return v(), P(N, {
69
- "close-on-click": !1,
70
- width: 220
71
- }, {
72
- "menu-button": A(() => [
73
- g("div", Kt, [
74
- m(M, null, {
75
- default: A(() => [
76
- b.value ? (v(), C("div", Rt, j(n(p)("menu.category.selector.title", { label: b.value })), 1)) : D("", !0),
77
- m(z, {
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(z, {
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
- ])) : D("", !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] = (U) => y.value = U),
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, (U) => {
119
- var K;
120
- return v(), P($, {
121
- key: U.value || "",
122
- label: U.label,
123
- "has-checkbox": "",
124
- "model-value": n(L) || ((K = k.value) == null ? void 0 : K.includes(U.value)),
125
- onClick: (O) => n(S)(U.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 }, Zt = { 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", Zt, j(n(r)("menu.product.table.category.collapse")), 1))
167
- ])) : D("", !0)
168
- ])) : D("", !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
- })) : D("", !0)
200
- ])
201
- ]),
202
- _: 1
203
- }));
204
- };
205
- }
206
- }), Jt = /* @__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
- ])) : D("", !0)
261
- ]),
262
- m(Ue, 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(J.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(Ue, 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(J.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(J.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(Ue, 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
- Ze(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)) : D("", !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
- ])) : D("", !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(Je((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(Jt, {
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
- ])) : D("", !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"])) : D("", !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"])) : D("", !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
- }, Ul = {
787
- key: 2
788
- }, Ml = {
789
- class: "flex space-x-8"
790
- }, Dl = {
791
- key: 1,
792
- class: "pt-8 flex flex-col flex-1 overflow-hidden"
793
- }, zl = {
794
- class: "space-y-8 pb-8"
795
- }, Nl = {
796
- class: "w-full px-8"
797
- }, Kl = {
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
- }, Zl = {
822
- class: "flex space-x-8"
823
- }, Jl = /* @__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
- Ut.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 z(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 M = x(() => i.itemAttributeSettings.value.map((e) => {
869
- const t = z(e.key);
870
- return {
871
- ...e,
872
- values: t
873
- };
874
- })), T = V(""), $ = zt(T, 300), N = x(() => {
875
- const e = (c) => {
876
- var h;
877
- return !$.value || !$.value.trim() ? !0 : [c.code, c.name, ze(c), ...Ie(U.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: U
882
- } = Ce(), K = 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(() => {
898
- const e = o.isV4;
899
- return ft.setCoreStore(i).taxSetting(e);
900
- }), Me = x(() => [{
901
- accessorKey: "thumbnail",
902
- header: "",
903
- size: 110,
904
- meta: {
905
- cellClass: "px-0",
906
- headerContentClass: "px-0"
907
- },
908
- cell: (e) => {
909
- var t, c;
910
- return q(Ae, {
911
- src: e.getValue(),
912
- alt: (c = (t = e == null ? void 0 : e.row) == null ? void 0 : t.original) == null ? void 0 : c.name,
913
- className: "my-8 mx-12",
914
- size: 72,
915
- crossorigin: !1
916
- });
917
- },
918
- enableSorting: !1
919
- }, {
920
- accessorKey: "code",
921
- header: () => l("menu.product.table.columns.code"),
922
- enableSorting: !1,
923
- size: 100,
924
- cell: (e) => {
925
- const t = e.row.original, c = e.getValue() || "--";
926
- if (!S.value) return m("span", {
927
- class: "break-all"
928
- }, [c]);
929
- const d = Ve(t._id);
930
- return q(J.FmTextField, {
931
- disabled: !y.value.code,
932
- modelValue: Y(t._id, "code") ?? (d == null ? void 0 : d.code),
933
- placeholder: u.modelValue[t._id].fallbackCode,
934
- "onUpdate:modelValue": (h) => {
935
- R(t._id, "code", h);
936
- }
937
- });
938
- }
939
- }, {
940
- accessorKey: "name",
941
- header: () => l("menu.product.table.columns.name"),
942
- enableSorting: !1,
943
- size: 200,
944
- cell: (e) => {
945
- const t = e.row.original, c = e.getValue();
946
- return S.value ? q(J.FmTextField, {
947
- disabled: !y.value.name,
948
- modelValue: Y(t._id, "name") ?? t.name,
949
- "onUpdate:modelValue": (d) => {
950
- R(t._id, "name", d);
951
- },
952
- rules: fe,
953
- placeholder: t.fallbackName
954
- }) : c;
955
- }
956
- }, {
957
- accessorKey: "price",
958
- header: () => {
959
- var e;
960
- return qe(l("menu.product.table.columns.price", {
961
- currency: (e = b.value) == null ? void 0 : e.currency.symbol
962
- }));
963
- },
964
- enableSorting: !1,
965
- size: 140,
966
- meta: {
967
- textAlign: "right"
968
- },
969
- cell: (e) => {
970
- var h;
971
- const t = e.getValue();
972
- if (!S.value) return oe.Dinero.fromFdoDinero(t).toFormat();
973
- const c = u.modelValue[e.row.original._id], d = c.fallbackPrice;
974
- return q(Ot, {
975
- min: 0,
976
- disabled: !c.editPrice,
977
- // @ts-ignore
978
- placeholder: d ? Mt(d, !1) : void 0,
979
- modelValue: Y(c._id, "price") ?? ((h = Ve(c._id)) == null ? void 0 : h.price),
980
- // @ts-ignore
981
- "onUpdate:modelValue": (F) => {
982
- O(c._id, "price", F);
983
- },
984
- rules: ge()
985
- });
986
- }
987
- }, {
988
- accessorKey: "taxes",
989
- header: () => qe(ot.value.systemCode),
990
- size: S.value ? 120 : 80,
991
- enableSorting: !1,
992
- meta: {
993
- textAlign: "right"
994
- },
995
- cell: (e) => {
996
- 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);
997
- if (!S.value)
998
- return `${F != null && F.meta.rate ? bt(F.meta.rate) : 0}%`;
999
- const _ = o.getSelectedTax(Y(c._id, "taxes") ?? t, c.fallbackTaxes, o.taxSetting.countryTaxOptions);
1000
- return q(J.FmSelect, {
1001
- disabled: !y.value.tax,
1002
- items: o.taxSetting.countryTaxOptions,
1003
- modelValue: _,
1004
- "onUpdate:modelValue": async (X) => {
1005
- const _e = o.decodeTax(X);
1006
- R(c._id, "taxes", [_e]);
1007
- }
1008
- });
1009
- }
1010
- }, {
1011
- accessorKey: "category",
1012
- header: () => l("menu.product.table.columns.category"),
1013
- enableSorting: !1,
1014
- size: 140,
1015
- cell: (e) => {
1016
- const t = e.row.original;
1017
- if (!S.value)
1018
- return q(Le, {
1019
- categories: Ie(U.value, t)
1020
- });
1021
- 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), {});
1022
- return q($t, {
1023
- shouldShowChips: !1,
1024
- shouldShowSelectedItemsWithinPlaceholder: !0,
1025
- modelValue: d.length > 0 ? d : [null],
1026
- items: K.value,
1027
- disabled: !!(o.state.currentCatalogId || o.state.currentSchedulerId),
1028
- "onUpdate:modelValue": async (F) => {
1029
- const [_, ...X] = F;
1030
- R(t._id, {
1031
- category: _,
1032
- additionalCategories: X.map((_e) => {
1033
- const Ke = h == null ? void 0 : h[_e];
1034
- return Ke || {
1035
- _id: _e,
1036
- position: null
1037
- };
1038
- })
1039
- });
1040
- }
1041
- });
1042
- }
1043
- }, {
1044
- id: "tagging",
1045
- accessorKey: "tagging",
1046
- header: () => l("menu.product.table.columns.tagging"),
1047
- enableSorting: !1,
1048
- size: 140,
1049
- cell: (e) => {
1050
- const t = e.row.original;
1051
- return q(Pe, {
1052
- customAttributes: t.customAttributes
1053
- });
1054
- }
1055
- }, {
1056
- accessorKey: "orderFrom",
1057
- header: () => l("menu.product.table.columns.order_from"),
1058
- enableSorting: !0,
1059
- sortingFn: (e, t) => {
1060
- const [c, d] = [e, t].map((h) => at[h.original.orderFrom].sortingIndex);
1061
- return c - d;
1062
- },
1063
- size: 140,
1064
- cell: (e) => {
1065
- const t = e.getValue(), c = e.row.original;
1066
- return S.value ? q(J.FmSelect, {
1067
- disabled: !y.value.orderFrom,
1068
- items: Object.values(ye()),
1069
- modelValue: Y(c._id, "orderFrom") ?? t,
1070
- "onUpdate:modelValue": async (d) => {
1071
- O(c._id, "orderFrom", d);
1072
- }
1073
- }) : q(we, {
1074
- orderFrom: t
1075
- });
1076
- }
1077
- }, {
1078
- id: "actions",
1079
- size: 100,
1080
- meta: {
1081
- cellClass: "pl-16",
1082
- headerClass: "py-4",
1083
- textAlign: "right"
1084
- },
1085
- header: () => q("div", {
1086
- class: "w-full px-4 flex justify-end"
1087
- }, [Dt(q(J.FmButton, {
1088
- variant: Z.Tertiary,
1089
- textColor: Q.NeutralGray400,
1090
- prependIcon: "edit",
1091
- class: "flex justify-end",
1092
- onClick: H,
1093
- type: "button"
1094
- }), "Bulk edit")]),
1095
- cell: (e) => {
1096
- const t = e.row.original;
1097
- return m("div", {
1098
- class: "px-4 flex justify-end"
1099
- }, [m(kl, null, {
1100
- default: ({
1101
- trigger: c
1102
- }) => m(J.FmButton, {
1103
- icon: "overview",
1104
- variant: "tertiary",
1105
- textColor: Q.NeutralGray400,
1106
- onClick: ie(() => {
1107
- c(t._id);
1108
- }, ["stop", "prevent"])
1109
- }, null)
1110
- }), m(J.FmButton, {
1111
- icon: "delete",
1112
- variant: "tertiary",
1113
- textColor: Q.NeutralGray400,
1114
- onClick: ie(async () => {
1115
- await f.deleteItem([{
1116
- _id: t._id,
1117
- name: t.name,
1118
- thumbnail: t.thumbnail
1119
- }]);
1120
- }, ["stop", "prevent"])
1121
- }, null)]);
1122
- }
1123
- }]);
1124
- o.taxSetting.systemCode || Me.value.splice(4, 1);
1125
- const ue = V({}), le = V([]);
1126
- ae([() => ue.value, () => N.value], (e) => {
1127
- let t = [];
1128
- Object.keys(e[0]).forEach((c) => {
1129
- const d = e[0][c], h = N.value[parseInt(c)];
1130
- h && (d ? t.push(h) : le.value = t.filter((F) => F !== h));
1131
- }), le.value = t;
1132
- }), ae(() => L.value, () => {
1133
- ue.value = {}, le.value = [];
1134
- }), ae(() => S.value, () => {
1135
- ue.value = {}, le.value = [];
1136
- });
1137
- const nt = () => {
1138
- ue.value = {};
1139
- };
1140
- async function De() {
1141
- await $e();
1142
- const e = () => !!o.currentCatalog || !!o.state.currentSchedulerId, t = (d) => d === "" || d === null ? e() ? "" : null : d, c = Object.values(u.modelValue).filter((d) => {
1143
- const h = Object.values(u.originalValue).find((F) => F._id === d._id);
1144
- return Re(h, d);
1145
- }).map((d) => ({
1146
- _id: d._id,
1147
- name: d.name,
1148
- code: d.code,
1149
- price: d.price,
1150
- orderFrom: d.orderFrom ?? null,
1151
- taxes: d.taxes,
1152
- category: t(d.category || null),
1153
- additionalCategories: d.additionalCategories
1154
- }));
1155
- await f.updateMany(c), H(!1);
1156
- }
1157
- const rt = async () => {
1158
- await f.deleteItem(le.value.map((e) => ({
1159
- _id: e._id,
1160
- name: e.name,
1161
- thumbnail: e.thumbnail
1162
- })));
1163
- }, be = () => {
1164
- ee("reset:model-value");
1165
- }, Fe = () => {
1166
- Object.entries(u.modelValue).some(([t, c]) => Re(c, u.originalValue[t])) ? s.open({
1167
- title: "You have unsaved changes!",
1168
- message: "Are you sure you want to discard? You will lose all the changes if discard edit.",
1169
- primaryActions: {
1170
- text: "Discard",
1171
- close: !0,
1172
- variant: Z.Destructive
1173
- },
1174
- secondaryActions: {
1175
- text: "Cancel",
1176
- close: !0
1177
- }
1178
- }).onPrimary(() => {
1179
- be(), H(!1);
1180
- }) : (H(!1), be());
1181
- }, st = x(() => {
1182
- var e, t;
1183
- return {
1184
- thumbnail: !S.value,
1185
- actions: !S.value,
1186
- tagging: !S.value && ((t = (e = i.itemAttributeSettings) == null ? void 0 : e.value) == null ? void 0 : t.length) > 0
1187
- };
1188
- }), ut = (e) => {
1189
- f.update(e._id);
1190
- };
1191
- async function it(e) {
1192
- await f.update(e.original._id);
1193
- }
1194
- function ze(e) {
1195
- var _;
1196
- const t = e.price ?? // TODO: fix type error
1197
- // @ts-ignore
1198
- e.fallbackPrice ?? oe.Dinero.fromNumber({
1199
- number: 0
1200
- }).toObject(), c = e.taxes, d = o.taxSetting.countryTaxOptions, h = oe.Dinero.fromFdoDinero(t).toFormat(), F = (_ = b.value) == null ? void 0 : _.currency.symbol;
1201
- return o.getSelectedTax(
1202
- c,
1203
- // TODO: fix type error
1204
- // @ts-ignore
1205
- e.fallbackTaxes,
1206
- d
1207
- ), `${F == null ? void 0 : F.toUpperCase()}${h}`;
1208
- }
1209
- function Ve(e) {
1210
- var d;
1211
- const t = o.currentCatalog, c = o.state.currentSchedulerId;
1212
- if (t && c) {
1213
- const h = t.override.scheduler[c] ?? {}, F = (d = h == null ? void 0 : h.items) == null ? void 0 : d.filter((_) => _._id === e);
1214
- return F == null ? void 0 : F[0];
1215
- } 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);
1216
- }
1217
- const ct = tt(), dt = x(() => ct.breakpoints.value.xs), Ne = V(null), mt = At(Ne, W), pt = x(() => {
1218
- var t;
1219
- return {
1220
- height: `calc(100vh - ${((t = mt.value) == null ? void 0 : t.top) + 24}px)`
1221
- };
1222
- });
1223
- return (e, t) => {
1224
- const c = B("fm-search"), d = B("fm-button"), h = B("fm-table"), F = B("fm-form");
1225
- return dt.value ? (v(), C("div", Dl, [g("div", zl, [g("div", Nl, [m(c, {
1226
- "model-value": T.value,
1227
- "onUpdate:modelValue": t[5] || (t[5] = (_) => T.value = _),
1228
- autofocus: "",
1229
- placeholder: n(l)("menu.product.table.search.placeholder")
1230
- }, null, 8, ["model-value", "placeholder"])]), t[8] || (t[8] = g("div", {
1231
- class: "w-full h-[1px] bg-fm-color-neutral-gray-100"
1232
- }, null, -1)), g("div", Kl, [ve(e.$slots, "filter")]), W.value ? (v(), C("div", Rl, [m(n(je), {
1233
- ref_key: "attributeFilterRef",
1234
- ref: te,
1235
- attributes: M.value,
1236
- modelValue: I.value,
1237
- "onUpdate:modelValue": t[6] || (t[6] = (_) => I.value = _)
1238
- }, null, 8, ["attributes", "modelValue"])])) : D("", !0)]), L.value.length ? (v(), C("div", Bl, [(v(!0), C(ne, null, xe(N.value, (_) => {
1239
- var X;
1240
- return v(), C("div", {
1241
- key: _._id,
1242
- class: "max-w-full py-12 px-16 space-x-16 flex items-center",
1243
- onClick: () => ut(_)
1244
- }, [g("div", El, [m(Ae, {
1245
- alt: _.name,
1246
- size: 72,
1247
- src: _.thumbnail
1248
- }, null, 8, ["alt", "src"]), g("div", Gl, [g("div", Ll, [g("p", Wl, j(_.name), 1), m(we, {
1249
- "order-from": _.orderFrom
1250
- }, null, 8, ["order-from"])]), g("p", ql, j(ze(_)), 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, {
1251
- categories: n(Ie)(n(U), _)
1252
- }, null, 8, ["categories"])]), m(Pe, {
1253
- "custom-attributes": _.customAttributes
1254
- }, null, 8, ["custom-attributes"])])]), m(d, {
1255
- "text-color": n(Q).NeutralGray400,
1256
- variant: n(Z).Tertiary,
1257
- "prepend-icon": "delete",
1258
- onClick: ie(() => n(f).deleteItem([{
1259
- _id: _._id,
1260
- name: _.name,
1261
- thumbnail: _.thumbnail
1262
- }]), ["stop"])
1263
- }, null, 8, ["text-color", "variant", "onClick"])], 8, jl);
1264
- }), 128))])) : (v(), C("div", Yl, [m(pe, {
1265
- subtitle: n(l)("menu.product.table.empty.subtitle"),
1266
- title: n(l)("menu.product.table.empty.title")
1267
- }, {
1268
- action: A(() => [g("div", Zl, [m(d, {
1269
- variant: n(Z).Primary,
1270
- label: n(l)("menu.product.table.empty.actions.add"),
1271
- "prepend-icon": "add",
1272
- onClick: t[7] || (t[7] = (_) => n(f).create(null))
1273
- }, null, 8, ["variant", "label"]), m(We, null, {
1274
- default: A(({
1275
- trigger: _
1276
- }) => [m(d, {
1277
- "bg-color": n(Q).NeutralGray100,
1278
- "text-color": n(Q).NeutralGray400,
1279
- variant: n(Z).Primary,
1280
- label: n(l)("menu.product.table.empty.actions.import"),
1281
- "prepend-icon": "download",
1282
- onClick: _
1283
- }, null, 8, ["bg-color", "text-color", "variant", "label", "onClick"])]),
1284
- _: 1
1285
- })])]),
1286
- _: 1
1287
- }, 8, ["subtitle", "title"])]))])) : (v(), P(F, {
1288
- key: 0,
1289
- "blame-form-child-on-validation-failed": "",
1290
- class: "flex flex-col flex-1 space-y-8 overflow-hidden",
1291
- onValidationSuccess: De
1292
- }, {
1293
- default: A(() => [g("div", Fl, [g("div", Vl, [ve(e.$slots, "filter")]), g("div", Il, [m(c, {
1294
- "model-value": T.value,
1295
- "onUpdate:modelValue": t[0] || (t[0] = (_) => T.value = _),
1296
- autofocus: "",
1297
- placeholder: n(l)("menu.product.table.search.placeholder")
1298
- }, null, 8, ["model-value", "placeholder"])])]), W.value ? (v(), C("div", $l, [m(n(je), {
1299
- ref_key: "attributeFilterRef",
1300
- ref: te,
1301
- attributes: M.value,
1302
- modelValue: I.value,
1303
- "onUpdate:modelValue": t[1] || (t[1] = (_) => I.value = _)
1304
- }, null, 8, ["attributes", "modelValue"])])) : D("", !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", {
1305
- count: le.value.length
1306
- })), 1), m(d, {
1307
- label: n(l)("menu.product.table.selection.actions.deselect_all"),
1308
- type: "button",
1309
- variant: "plain",
1310
- onClick: nt
1311
- }, null, 8, ["label"]), m(d, {
1312
- "border-color": n(Q).SystemError300,
1313
- "text-color": n(Q).SystemError300,
1314
- class: "ml-auto",
1315
- label: n(l)("menu.product.table.selection.actions.remove"),
1316
- "prepend-icon": "delete",
1317
- variant: "secondary",
1318
- onClick: rt
1319
- }, null, 8, ["border-color", "text-color", "label"])])) : D("", !0), S.value ? (v(), C("div", Ol, [m(d, {
1320
- variant: n(Z).Tertiary,
1321
- label: n(l)("menu.product.table.bulk_edit.actions.reset_all"),
1322
- onClick: be
1323
- }, null, 8, ["variant", "label"]), m(d, {
1324
- variant: n(Z).Tertiary,
1325
- label: n(l)("menu.common.actions.cancel"),
1326
- onClick: Fe
1327
- }, null, 8, ["variant", "label"]), m(d, {
1328
- borderColor: n(Q).ColorPrimary,
1329
- textColor: n(Q).ColorPrimary,
1330
- variant: n(Z).Secondary,
1331
- label: n(l)("menu.product.table.bulk_edit.actions.save"),
1332
- type: "submit"
1333
- }, null, 8, ["borderColor", "textColor", "variant", "label"])])) : D("", !0), g("div", {
1334
- ref_key: "tableWrapper",
1335
- ref: Ne
1336
- }, [(v(), P(Je(S.value ? Pt : "div"), {
1337
- ref: "fullWrapper",
1338
- title: S.value ? n(l)("menu.product.table.bulk_edit.title") : "",
1339
- show: S.value,
1340
- "primary-action": {
1341
- label: n(l)("menu.product.table.bulk_edit.actions.save")
1342
- },
1343
- "secondary-actions": [{
1344
- label: n(l)("menu.product.table.bulk_edit.actions.reset_all"),
1345
- click: be
1346
- }, {
1347
- label: n(l)("menu.common.actions.cancel"),
1348
- click: Fe
1349
- }],
1350
- class: "overflow-x-scroll",
1351
- style: vt(pt.value),
1352
- onOnPrimary: De,
1353
- onOnCancel: Fe
1354
- }, {
1355
- default: A(() => [m(h, {
1356
- class: re({
1357
- "min-w-[1100px]": !0,
1358
- "mt-24": S.value
1359
- }),
1360
- modelValue: ue.value,
1361
- "onUpdate:modelValue": t[2] || (t[2] = (_) => ue.value = _),
1362
- "column-defs": Me.value,
1363
- "column-visibility": st.value,
1364
- loading: e.isCalculating,
1365
- "page-size": N.value.length,
1366
- "row-data": N.value,
1367
- "shrink-at": !1,
1368
- selection: S.value ? void 0 : "multiple",
1369
- virtual: !0,
1370
- "virtual-row-height": S.value ? 48 : 91,
1371
- "hide-footer": "",
1372
- "pin-header-row": "",
1373
- onRowClick: t[3] || (t[3] = (_) => S.value ? void 0 : it(_))
1374
- }, null, 8, ["class", "modelValue", "column-defs", "column-visibility", "loading", "page-size", "row-data", "selection", "virtual-row-height"])]),
1375
- _: 1
1376
- }, 40, ["title", "show", "primary-action", "secondary-actions", "style"]))], 512)])) : (v(), C("div", Ul, [m(pe, {
1377
- subtitle: n(l)("menu.product.table.empty.subtitle"),
1378
- title: n(l)("menu.product.table.empty.title")
1379
- }, {
1380
- action: A(() => [g("div", Ml, [m(d, {
1381
- variant: n(Z).Primary,
1382
- label: n(l)("menu.product.table.empty.actions.add"),
1383
- "prepend-icon": "add",
1384
- onClick: t[4] || (t[4] = (_) => n(f).create(null))
1385
- }, null, 8, ["variant", "label"]), m(We, null, {
1386
- default: A(({
1387
- trigger: _
1388
- }) => [m(d, {
1389
- "bg-color": n(Q).NeutralGray100,
1390
- "text-color": n(Q).NeutralGray400,
1391
- variant: n(Z).Primary,
1392
- label: n(l)("menu.product.table.empty.actions.import"),
1393
- "prepend-icon": "download",
1394
- onClick: _
1395
- }, null, 8, ["bg-color", "text-color", "variant", "label", "onClick"])]),
1396
- _: 1
1397
- })])]),
1398
- _: 1
1399
- }, 8, ["subtitle", "title"])]))]),
1400
- _: 3
1401
- }));
1402
- };
1403
- }
1404
- }), Xl = {
1405
- key: 0,
1406
- class: /* @__PURE__ */ re(["flex flex-col", "flex-1", "overflow-hidden"])
1407
- }, ea = {
1408
- class: /* @__PURE__ */ re(["pt-16 xs:pt-0", "flex xs:flex-col", "flex-1", "w-full", "overflow-hidden"])
1409
- }, ta = { class: "flex flex-col flex-1 overflow-hidden" }, la = {
1410
- key: 1,
1411
- class: "pt-16 xs:pt-8 space-y-24"
1412
- }, aa = { class: "flex items-center gap-8 px-16" }, ka = /* @__PURE__ */ E({
1413
- __name: "Product",
1414
- setup(w) {
1415
- 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(() => {
1416
- var M, T, $, N;
1417
- if (o.value && f.value) return;
1418
- if (f.value) {
1419
- const U = (M = a.currentCatalog) == null ? void 0 : M.override.items;
1420
- return U ? Object.entries(U).reduce((K, [O, Y]) => {
1421
- const R = Y.find((se) => !se.combinationKey);
1422
- return R && (K[O] = R), K;
1423
- }, {}) : {};
1424
- }
1425
- return ((o.value ? (T = a.currentScheduler) == null ? void 0 : T.items : (N = ($ = a.currentCatalog) == null ? void 0 : $.override.scheduler[a.state.currentSchedulerId]) == null ? void 0 : N.items) ?? []).reduce((U, K) => (K.combinationKey || (U[K._id] = K), U), {});
1426
- }), k = V({}), L = V({}), ee = async () => {
1427
- var N, U;
1428
- b.value = !0;
1429
- const z = !!y.value, M = me.flatten(H.value.map((K) => K.items)), T = z && p.value ? await kt(
1430
- a.mergedMenu,
1431
- M,
1432
- a.state.menu,
1433
- (N = a.currentCatalog) == null ? void 0 : N._id,
1434
- (U = a.currentScheduler) == null ? void 0 : U._id,
1435
- !1
1436
- ) : void 0, $ = M.reduce((K, O, Y) => {
1437
- var se, de, fe, ge;
1438
- const R = (se = y.value) == null ? void 0 : se[O._id];
1439
- return K[O._id] = {
1440
- _id: O._id,
1441
- name: O.name,
1442
- code: z ? R == null ? void 0 : R.code : O == null ? void 0 : O.code,
1443
- category: O.category,
1444
- additionalCategories: O.additionalCategories,
1445
- price: z && s.value.editPrice ? R == null ? void 0 : R.price : O.price,
1446
- orderFrom: z ? R == null ? void 0 : R.orderFrom : O.orderFrom,
1447
- taxes: z ? null : O.taxes,
1448
- thumbnail: O.thumbnail,
1449
- fallbackPrice: (de = T == null ? void 0 : T[Y]) == null ? void 0 : de.price,
1450
- fallbackName: z ? O.name : void 0,
1451
- fallbackCode: (fe = T == null ? void 0 : T[Y]) == null ? void 0 : fe.code,
1452
- fallbackOrder: (ge = T == null ? void 0 : T[Y]) == null ? void 0 : ge.orderFrom,
1453
- fallbackTaxes: z ? O.taxes : null
1454
- }, K;
1455
- }, {});
1456
- k.value = $, L.value = { ...$ }, b.value = !1;
1457
- }, { categories: S, selectedCategories: H } = Ce(), W = V(null);
1458
- function te() {
1459
- W.value && W.value.toggleAttributeFilter();
1460
- }
1461
- Ze(async () => {
1462
- H.value && await ee();
1463
- });
1464
- function ce() {
1465
- l.create(null);
1466
- }
1467
- const G = () => {
1468
- H.value && ee();
1469
- }, { t: I } = Se();
1470
- return (z, M) => {
1471
- const T = B("fm-button");
1472
- return n(S).length ? (v(), C("div", Xl, [
1473
- g("div", ea, [
1474
- g("div", ta, [
1475
- n(H) ? (v(), P(Jl, {
1476
- key: 0,
1477
- ref_key: "productTableRef",
1478
- ref: W,
1479
- "is-calculating": b.value,
1480
- "model-value": k.value,
1481
- "original-value": L.value,
1482
- "onUpdate:modelValue": M[0] || (M[0] = ($) => k.value = $),
1483
- "onReset:modelValue": G,
1484
- "onUpdate:editing": M[1] || (M[1] = ($) => p.value = $)
1485
- }, {
1486
- filter: A(() => [
1487
- m(Ge, { onToggleAttributeFilter: te }),
1488
- s.value.multiScheduler ? (v(), P(Ee, { key: 0 })) : D("", !0)
1489
- ]),
1490
- _: 1
1491
- }, 8, ["is-calculating", "model-value", "original-value"])) : D("", !0)
1492
- ])
1493
- ])
1494
- ])) : (v(), C("div", la, [
1495
- g("div", aa, [
1496
- m(Ge),
1497
- s.value.multiScheduler ? (v(), P(Ee, { key: 0 })) : D("", !0)
1498
- ]),
1499
- r.value.create ? (v(), P(pe, {
1500
- key: 0,
1501
- action: {
1502
- text: n(I)("menu.product.empty.with_create.action"),
1503
- callback: ce
1504
- },
1505
- subtitle: n(I)("menu.product.empty.with_create.subtitle"),
1506
- title: n(I)("menu.product.empty.with_create.title")
1507
- }, null, 8, ["action", "subtitle", "title"])) : f.value ? (v(), P(pe, {
1508
- key: 1,
1509
- subtitle: n(I)("menu.product.empty.no_scheduler.subtitle"),
1510
- title: n(I)("menu.product.empty.no_scheduler.title")
1511
- }, {
1512
- action: A(() => [
1513
- m(Be, {
1514
- "categorized-items": n(i).linkableItems.value,
1515
- "initial-value": n(i).currentItems.value,
1516
- "show-variant": !1,
1517
- onSubmit: M[2] || (M[2] = ($) => n(i).applyProduct($.map((N) => N._id)))
1518
- }, {
1519
- default: A(({ trigger: $ }) => [
1520
- m(T, {
1521
- label: n(I)("menu.common.actions.link_product"),
1522
- "prepend-icon": "link",
1523
- onClick: $
1524
- }, null, 8, ["label", "onClick"])
1525
- ]),
1526
- _: 1
1527
- }, 8, ["categorized-items", "initial-value"])
1528
- ]),
1529
- _: 1
1530
- }, 8, ["subtitle", "title"])) : (v(), P(pe, {
1531
- key: 2,
1532
- subtitle: n(I)("menu.product.empty.with_scheduler.subtitle"),
1533
- title: n(I)("menu.product.empty.with_scheduler.title")
1534
- }, {
1535
- action: A(() => [
1536
- m(Be, {
1537
- "categorized-items": n(u).linkableItems.value,
1538
- "initial-value": n(u).currentItems.value,
1539
- "show-variant": !1,
1540
- onSubmit: M[3] || (M[3] = ($) => n(u).applyProduct($.map((N) => N._id)))
1541
- }, {
1542
- default: A(({ trigger: $ }) => [
1543
- m(T, {
1544
- label: n(I)("menu.common.actions.apply_product"),
1545
- onClick: $
1546
- }, null, 8, ["label", "onClick"])
1547
- ]),
1548
- _: 1
1549
- }, 8, ["categorized-items", "initial-value"])
1550
- ]),
1551
- _: 1
1552
- }, 8, ["subtitle", "title"]))
1553
- ]));
1554
- };
1555
- }
1556
- });
1557
- export {
1558
- We as _,
1559
- ka as a
1560
- };