@feedmepos/mf-menu 0.31.33-beta.7 → 0.31.33-beta.9

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