@feedmepos/mf-menu 0.18.17 → 0.19.0-beta.2
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.
- package/dist/ApplyProduct.vue_vue_type_script_setup_true_lang-DFJJHptK.js +158 -0
- package/dist/{ApplyProducts.vue_vue_type_script_setup_true_lang-BJ0b_uKf.js → ApplyProducts.vue_vue_type_script_setup_true_lang-CXoRwrTi.js} +2 -2
- package/dist/Catalog-CXzqtCF8.js +551 -0
- package/dist/Category-DKbtLbq8.js +387 -0
- package/dist/CookingGuide-BKon8TdH.js +862 -0
- package/dist/Group-D1UDksBG.js +46 -0
- package/dist/{Group-jEtbECLb.js → Group-izOWb_Bh.js} +1 -1
- package/dist/Group.vue_vue_type_script_setup_true_lang-DAlQcgYp.js +558 -0
- package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Q7es2wmt.js +237 -0
- package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Bw4uxqAp.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Db0uYw5O.js} +11723 -11723
- package/dist/Ingredient-BIJu9P_9.js +484 -0
- package/dist/LinkProductSideSheet-BNdFZThd.js +104 -0
- package/dist/PrintRoute--fYPFcy7.js +417 -0
- package/dist/{Product-Bnr9oFr2.js → Product-vLtISbkD.js} +1 -1
- package/dist/Product.vue_vue_type_script_setup_true_lang-BHCihe6o.js +826 -0
- package/dist/Products-JaCNtcHS.js +236 -0
- package/dist/Publish-jpmiyB-b.js +525 -0
- package/dist/Recipe-B6y-oLPG.js +320 -0
- package/dist/Scheduler-Dj1rlr-U.js +222 -0
- package/dist/SchedulerSelector.vue_vue_type_script_setup_true_lang-BVAkohGJ.js +48 -0
- package/dist/ServingSequence-BhIfCyXl.js +4 -0
- package/dist/{Setting-DN8TQdIR.js → Setting-B5R1JfaL.js} +1 -1
- package/dist/Setting.vue_vue_type_script_setup_true_lang-xXtg0JOn.js +253 -0
- package/dist/Takeaway-BSFSz_JL.js +63 -0
- package/dist/{Takeaway-y0Nk0JAb.js → Takeaway-DjFTtbw6.js} +1 -1
- package/dist/Takeaway.vue_vue_type_script_setup_true_lang-BUGL0wfZ.js +302 -0
- package/dist/TaxSetting-D9Q8XNgJ.js +25 -0
- package/dist/Unit-Cr_8O3zB.js +142 -0
- package/dist/Variant-loUMfNRB.js +222 -0
- package/dist/_id_-0w7KjYyQ.js +189 -0
- package/dist/{app-D7e31gIv.js → app-t9ONnc0s.js} +31701 -26207
- package/dist/app.js +7 -6
- package/dist/apps/mf-menu/src/app.d.ts +2784 -0
- package/dist/apps/mf-menu/src/components/feature/Fields/OrderFrom.vue.d.ts +2 -2
- package/dist/apps/mf-menu/src/components/feature/LinkProduct/LinkProductSideSheet.vue.d.ts +2 -2
- package/dist/apps/mf-menu/src/manager/menu/catalog.d.ts +1 -0
- package/dist/apps/mf-menu/src/stores/manager/item.d.ts +1 -1
- package/dist/apps/mf-menu/src/stores/menu.d.ts +16 -16
- package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +12 -12
- package/dist/apps/mf-menu/src/views/Scheduler/FilterForm.vue.d.ts +4 -4
- package/dist/apps/mf-menu/src/views/Scheduler/SchedulerDialog.vue.d.ts +4 -4
- package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
- package/dist/assets/{linked-status-D5tq3eE2.js → linked-status-DLL4aRiX.js} +8 -8
- package/dist/assets/{validate-menu-AcCpPyQZ.js → validate-menu-CoXc16jh.js} +8 -8
- package/dist/{catalog-Ck7lLTN2.js → catalog-4OmC0JA3.js} +66 -62
- package/dist/category-BE33DRqp.js +155 -0
- package/dist/{currency-CclA5a-2.js → currency-JHgYNbTQ.js} +1 -1
- package/dist/{index-DDd9B_ur.js → index-CE3zjhyh.js} +732 -740
- package/dist/index-pSg9p-28.js +238 -0
- package/dist/item-CEPx51U1.js +6371 -0
- package/dist/{lodash-BIQx_fko.js → lodash-VivR_BQ2.js} +1 -1
- package/dist/{menu-CYzbNubv.js → menu-ETQrtbbU.js} +1 -1
- package/dist/{object-DUtbNpoS.js → object-DEM5FMTB.js} +4 -4
- package/dist/scheduler-SRT_5Nio.js +491 -0
- package/dist/string-DpfFixWH.js +4 -0
- package/dist/style.css +1 -1
- package/dist/takeaway-RcvqKigG.js +267 -0
- package/dist/{toExcel-BXPcj8Gp.js → toExcel-BcgskY3F.js} +2 -2
- package/dist/unit-DLL7xIF1.js +350 -0
- package/package.json +4 -2
- package/dist/ApplyProduct.vue_vue_type_script_setup_true_lang-D9QsJ4vO.js +0 -155
- package/dist/Catalog-CZW54QJU.js +0 -570
- package/dist/Category-DvsP_L7d.js +0 -405
- package/dist/CookingGuide-DC3uXetk.js +0 -848
- package/dist/Group-DK5xqeYX.js +0 -44
- package/dist/Group.vue_vue_type_script_setup_true_lang-DGZ9hnPg.js +0 -538
- package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BQXqlXw4.js +0 -234
- package/dist/Ingredient-354LLwdX.js +0 -498
- package/dist/LinkProductSideSheet-anxSsu0z.js +0 -102
- package/dist/PrintRoute-DrSvtNLX.js +0 -425
- package/dist/Product.vue_vue_type_script_setup_true_lang-bBY54Q_1.js +0 -815
- package/dist/Products-CZyueqSO.js +0 -234
- package/dist/Publish-kRM1UuPk.js +0 -518
- package/dist/Recipe-nKpLIJs8.js +0 -345
- package/dist/Scheduler-DmZ8atXG.js +0 -233
- package/dist/SchedulerSelector.vue_vue_type_script_setup_true_lang-CdsxA-p0.js +0 -48
- package/dist/ServingSequence-j00_ko5R.js +0 -4
- package/dist/Setting.vue_vue_type_script_setup_true_lang-Cx06MCJs.js +0 -247
- package/dist/Takeaway-BXZXCAaM.js +0 -61
- package/dist/Takeaway.vue_vue_type_script_setup_true_lang-9WVkdLZF.js +0 -316
- package/dist/TaxSetting-DdHx7ACN.js +0 -21
- package/dist/Unit-biPvleyL.js +0 -161
- package/dist/Variant-BP1IRNQx.js +0 -231
- package/dist/_id_-BiaNDI2N.js +0 -188
- package/dist/category-KiA5-36F.js +0 -154
- package/dist/index-BFeZlU8X.js +0 -232
- package/dist/item-Bcg7SiYv.js +0 -6325
- package/dist/scheduler-D1tgE0_9.js +0 -480
- package/dist/takeaway-BKsoD4EL.js +0 -264
- package/dist/unit-CswFvAyc.js +0 -346
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
import { ref as A, computed as b, defineComponent as ce, resolveComponent as Y, openBlock as v, createBlock as G, withCtx as M, createVNode as i, createElementVNode as g, toDisplayString as se, unref as l, createElementBlock as z, Fragment as he, renderList as ze, createTextVNode as Ze, mergeModels as Je, useModel as Qe, renderSlot as _e, watch as pe, h as U, withModifiers as we, createCommentVNode as ue, resolveDynamicComponent as Xe, normalizeStyle as et, normalizeClass as ne, nextTick as tt, watchEffect as lt } from "vue";
|
|
2
|
+
import { u as ye, n as xe, a as Ne, c as ve, z as fe, F as at, A as ot, k as ie, g as nt, B as Ve, i as De } from "./app-t9ONnc0s.js";
|
|
3
|
+
import { _ as Fe } from "./SchedulerSelector.vue_vue_type_script_setup_true_lang-BVAkohGJ.js";
|
|
4
|
+
import { useCoreStore as rt } from "@feedmepos/mf-common";
|
|
5
|
+
import { useSnackbar as je, useDialog as Be, components as oe, FmButtonVariant as W, FmButtonColorThemeVariant as L, useBreakpoints as Ue } from "@feedmepos/ui-library";
|
|
6
|
+
import "vue-router";
|
|
7
|
+
import { u as ge } from "./menu-ETQrtbbU.js";
|
|
8
|
+
import { u as Ae } from "./category-BE33DRqp.js";
|
|
9
|
+
import "./vuedraggable-WU01qJgi.js";
|
|
10
|
+
import { _ as st, a as Ee, u as Ke, c as $e } from "./ImportProductDialog.vue_vue_type_script_setup_true_lang-Db0uYw5O.js";
|
|
11
|
+
import { _ as ut } from "./takeaway-RcvqKigG.js";
|
|
12
|
+
import { f as it } from "./currency-JHgYNbTQ.js";
|
|
13
|
+
import { l as be } from "./lodash-VivR_BQ2.js";
|
|
14
|
+
import { u as Re, m as ct } from "./item-CEPx51U1.js";
|
|
15
|
+
import { w as dt } from "./InfoBasic.vue_vue_type_script_setup_true_lang-DxQBDu16.js";
|
|
16
|
+
import { F as mt } from "./object-DEM5FMTB.js";
|
|
17
|
+
import { _ as Te } from "./TextChip.vue_vue_type_script_setup_true_lang-CNp85hoQ.js";
|
|
18
|
+
import { L as Ie } from "./LinkProductSideSheet-BNdFZThd.js";
|
|
19
|
+
function pt(O, c) {
|
|
20
|
+
const d = A(!0), r = b(() => {
|
|
21
|
+
var f, y;
|
|
22
|
+
return !d.value && (!c.value || ((f = c.value) == null ? void 0 : f.length) === ((y = O.value) == null ? void 0 : y.length));
|
|
23
|
+
}), V = b(() => {
|
|
24
|
+
var f, y, N, _;
|
|
25
|
+
return !!((f = c.value) != null && f.length && ((y = c.value) == null ? void 0 : y.length) > 0 && ((N = c.value) == null ? void 0 : N.length) < ((_ = O.value) == null ? void 0 : _.length));
|
|
26
|
+
});
|
|
27
|
+
return { allCleared: d, allSelected: r, indeterminate: V, toggleAll: () => {
|
|
28
|
+
c.value = void 0, d.value = !d.value;
|
|
29
|
+
}, toggleOption: (f) => {
|
|
30
|
+
var N, _, E;
|
|
31
|
+
let y;
|
|
32
|
+
c.value === void 0 && d.value ? y = [f] : c.value === void 0 && !d.value ? y = (N = O.value.map((T) => T.value)) == null ? void 0 : N.filter((T) => T !== f) : (_ = c.value) != null && _.includes(f) ? y = (E = c.value) == null ? void 0 : E.filter((T) => T !== f) : y = [...c.value || [], f], y.length === 0 ? (c.value = void 0, d.value = !0) : y.length === O.value.length ? (c.value = void 0, d.value = !1) : c.value = y;
|
|
33
|
+
} };
|
|
34
|
+
}
|
|
35
|
+
const Me = /* @__PURE__ */ ce({
|
|
36
|
+
__name: "CategorySelector",
|
|
37
|
+
setup(O) {
|
|
38
|
+
const c = ye(), { categories: d, selectedCategories: r } = ge(), V = b(() => c.state.currentCategoryIds), n = b(
|
|
39
|
+
() => d.value.map((w) => ({ label: w.name, value: w.id }))
|
|
40
|
+
), { t: H } = xe(), f = b(() => {
|
|
41
|
+
var w, F, D;
|
|
42
|
+
return d.value.length === ((w = r.value) == null ? void 0 : w.length) ? H("menu.category.selector.all") : ((F = r.value) == null ? void 0 : F.length) === 1 ? r.value[0].name : `${(D = r.value) == null ? void 0 : D.length}`;
|
|
43
|
+
}), y = b({
|
|
44
|
+
get: () => V.value,
|
|
45
|
+
set: (w) => {
|
|
46
|
+
c.selectCategory(w);
|
|
47
|
+
}
|
|
48
|
+
}), { allCleared: N, allSelected: _, toggleAll: E, toggleOption: T, indeterminate: Z } = pt(n, y);
|
|
49
|
+
return (w, F) => {
|
|
50
|
+
const D = Y("FmIcon"), m = Y("FmChip"), q = Y("FmMenuItem"), K = Y("FmMenu");
|
|
51
|
+
return v(), G(K, { "close-on-click": !1 }, {
|
|
52
|
+
"menu-button": M(() => [
|
|
53
|
+
i(m, {
|
|
54
|
+
label: f.value,
|
|
55
|
+
class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400"
|
|
56
|
+
}, {
|
|
57
|
+
default: M(() => [
|
|
58
|
+
g("p", null, se(l(H)("menu.category.selector.title", { label: f.value })), 1),
|
|
59
|
+
i(D, { name: "expand_more" })
|
|
60
|
+
]),
|
|
61
|
+
_: 1
|
|
62
|
+
}, 8, ["label"])
|
|
63
|
+
]),
|
|
64
|
+
default: M(() => [
|
|
65
|
+
i(q, {
|
|
66
|
+
label: "All",
|
|
67
|
+
"has-checkbox": "",
|
|
68
|
+
"model-value": l(_),
|
|
69
|
+
indeterminate: l(Z),
|
|
70
|
+
onClick: l(E)
|
|
71
|
+
}, null, 8, ["model-value", "indeterminate", "onClick"]),
|
|
72
|
+
(v(!0), z(he, null, ze(n.value, (j) => {
|
|
73
|
+
var ee;
|
|
74
|
+
return v(), G(q, {
|
|
75
|
+
key: j.value || "",
|
|
76
|
+
label: j.label,
|
|
77
|
+
"has-checkbox": "",
|
|
78
|
+
"model-value": l(_) || ((ee = y.value) == null ? void 0 : ee.includes(j.value)),
|
|
79
|
+
onClick: (te) => l(T)(j.value)
|
|
80
|
+
}, null, 8, ["label", "model-value", "onClick"]);
|
|
81
|
+
}), 128))
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}), Oe = (O) => i("div", {
|
|
88
|
+
class: "flex flex-1 justify-end"
|
|
89
|
+
}, [i("span", null, [O, Ze(" ")])]), vt = /* @__PURE__ */ ce({
|
|
90
|
+
__name: "CategorySelectorSingle",
|
|
91
|
+
props: /* @__PURE__ */ Je({
|
|
92
|
+
disabled: { type: Boolean, default: !1 }
|
|
93
|
+
}, {
|
|
94
|
+
modelValue: {},
|
|
95
|
+
modelModifiers: {}
|
|
96
|
+
}),
|
|
97
|
+
emits: ["update:modelValue"],
|
|
98
|
+
setup(O) {
|
|
99
|
+
const c = ye(), d = Qe(O, "modelValue"), r = b(() => c.categories.map((V) => ({
|
|
100
|
+
label: V.name,
|
|
101
|
+
value: V._id || null
|
|
102
|
+
})));
|
|
103
|
+
return (V, n) => {
|
|
104
|
+
const H = Y("FmSelect");
|
|
105
|
+
return v(), G(H, {
|
|
106
|
+
items: r.value,
|
|
107
|
+
modelValue: d.value,
|
|
108
|
+
"onUpdate:modelValue": n[0] || (n[0] = (f) => d.value = f),
|
|
109
|
+
disabled: V.disabled
|
|
110
|
+
}, null, 8, ["items", "modelValue", "disabled"]);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}), Pe = /* @__PURE__ */ ce({
|
|
114
|
+
__name: "ImportButton",
|
|
115
|
+
setup(O) {
|
|
116
|
+
const c = A(!1);
|
|
117
|
+
function d() {
|
|
118
|
+
c.value = !c.value;
|
|
119
|
+
}
|
|
120
|
+
return (r, V) => (v(), z(he, null, [
|
|
121
|
+
i(st, {
|
|
122
|
+
modelValue: c.value,
|
|
123
|
+
"onUpdate:modelValue": V[0] || (V[0] = (n) => c.value = n)
|
|
124
|
+
}, null, 8, ["modelValue"]),
|
|
125
|
+
_e(r.$slots, "default", { trigger: d })
|
|
126
|
+
], 64));
|
|
127
|
+
}
|
|
128
|
+
}), ft = {
|
|
129
|
+
class: "flex justify-between items-center space-x-8"
|
|
130
|
+
}, bt = {
|
|
131
|
+
class: "flex space-x-8"
|
|
132
|
+
}, gt = {
|
|
133
|
+
class: "w-[320px]"
|
|
134
|
+
}, yt = {
|
|
135
|
+
key: 0,
|
|
136
|
+
class: /* @__PURE__ */ ne(["flex-1 flex flex-col", "divide-y divide-fm-color-neutral-gray-100", "overflow-hidden"])
|
|
137
|
+
}, _t = {
|
|
138
|
+
key: 0,
|
|
139
|
+
class: "flex items-center p-4"
|
|
140
|
+
}, ht = {
|
|
141
|
+
class: /* @__PURE__ */ ne(["mr-8", "fm-typo-en-body-md-400"])
|
|
142
|
+
}, xt = {
|
|
143
|
+
key: 1,
|
|
144
|
+
class: "px-16 py-4 space-x-8 flex justify-end"
|
|
145
|
+
}, Ct = {
|
|
146
|
+
key: 1
|
|
147
|
+
}, kt = {
|
|
148
|
+
class: "flex space-x-8"
|
|
149
|
+
}, St = {
|
|
150
|
+
key: 1,
|
|
151
|
+
class: "pt-8 flex flex-col flex-1 overflow-hidden"
|
|
152
|
+
}, wt = {
|
|
153
|
+
class: "space-y-8 pb-8"
|
|
154
|
+
}, Vt = {
|
|
155
|
+
class: "w-full px-8"
|
|
156
|
+
}, Ft = {
|
|
157
|
+
class: "flex space-x-8 px-8"
|
|
158
|
+
}, $t = {
|
|
159
|
+
key: 0,
|
|
160
|
+
class: /* @__PURE__ */ ne(["flex flex-col flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100", "pb-64"])
|
|
161
|
+
}, Tt = ["onClick"], It = {
|
|
162
|
+
class: "min-w-0 flex flex-1 items-start justify-start space-x-16"
|
|
163
|
+
}, Mt = {
|
|
164
|
+
class: "flex-1 min-w-0"
|
|
165
|
+
}, Ot = {
|
|
166
|
+
class: "flex justify-between items-center gap-8 pb-4"
|
|
167
|
+
}, Pt = {
|
|
168
|
+
class: "flex-1 min-w-0 fm-typo-en-body-lg-600 line-clamp-2"
|
|
169
|
+
}, zt = {
|
|
170
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
171
|
+
}, Nt = {
|
|
172
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
173
|
+
}, Dt = {
|
|
174
|
+
key: 1
|
|
175
|
+
}, jt = {
|
|
176
|
+
class: "flex space-x-8"
|
|
177
|
+
}, Bt = /* @__PURE__ */ ce({
|
|
178
|
+
__name: "ProductTable",
|
|
179
|
+
props: {
|
|
180
|
+
modelValue: {},
|
|
181
|
+
originalValue: {},
|
|
182
|
+
isCalculating: {
|
|
183
|
+
type: Boolean
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
emits: ["update:model-value", "reset:model-value", "update:editing", "update:search-key"],
|
|
187
|
+
setup(O, {
|
|
188
|
+
emit: c
|
|
189
|
+
}) {
|
|
190
|
+
const d = O, {
|
|
191
|
+
t: r
|
|
192
|
+
} = xe(), V = rt(), n = ye();
|
|
193
|
+
Ee(), Ke();
|
|
194
|
+
const H = je(), f = Be(), y = Ne(H), N = De(y);
|
|
195
|
+
Ae({
|
|
196
|
+
dialog: f,
|
|
197
|
+
menuLoader: N
|
|
198
|
+
});
|
|
199
|
+
const _ = Re();
|
|
200
|
+
b(() => !n.state.currentSchedulerId);
|
|
201
|
+
const E = V.currentCountry, T = b(() => E.value ? ve.Country.getCountry(E.value) : null), Z = b(() => n.rules.item);
|
|
202
|
+
b(() => w.value.length === 1 && w.value[0].id === null);
|
|
203
|
+
const {
|
|
204
|
+
selectedCategories: w
|
|
205
|
+
} = ge(), F = b(() => be.flatten(w.value.map((e) => e.items))), D = c, m = A(!1);
|
|
206
|
+
pe(() => m.value, (e) => {
|
|
207
|
+
D("update:editing", e);
|
|
208
|
+
});
|
|
209
|
+
const q = (e) => {
|
|
210
|
+
nt.isBoolean(e) ? m.value = e : m.value = !m.value;
|
|
211
|
+
}, K = A(""), j = b(() => F.value.filter((e) => {
|
|
212
|
+
var o;
|
|
213
|
+
return !K.value || !K.value.trim() ? !0 : `${e.code} ${e.name} ${Ce(e)} ${te(e.category || null)} ${(o = fe()[e.orderFrom]) == null ? void 0 : o.label}`.toLowerCase().includes(K.value.toLowerCase());
|
|
214
|
+
})), {
|
|
215
|
+
categories: ee
|
|
216
|
+
} = ge(), te = (e) => {
|
|
217
|
+
const t = ee.value.find((o) => o.id === e || e === null && o.id === "");
|
|
218
|
+
return t == null ? void 0 : t.name;
|
|
219
|
+
}, re = (e, t, o) => {
|
|
220
|
+
let a = be.clone(d.modelValue);
|
|
221
|
+
const u = a[e];
|
|
222
|
+
u && (a[e] = {
|
|
223
|
+
...u,
|
|
224
|
+
[t]: o
|
|
225
|
+
}, D("update:model-value", a));
|
|
226
|
+
}, I = be.debounce(re, 300), R = (e) => (t) => !!t || r("menu.product.table.validation.name_required", {
|
|
227
|
+
field: e
|
|
228
|
+
}), k = (e) => e >= 0 || r("menu.product.table.validation.price_min"), S = [R("Name")], h = () => [(e) => k(typeof e == "number" ? e : Number(e) ?? 0)], P = fe(), B = A([{
|
|
229
|
+
accessorKey: "thumbnail",
|
|
230
|
+
header: "",
|
|
231
|
+
size: 64,
|
|
232
|
+
meta: {
|
|
233
|
+
cellClass: "px-0",
|
|
234
|
+
headerContentClass: "px-0"
|
|
235
|
+
},
|
|
236
|
+
cell: (e) => {
|
|
237
|
+
var t, o;
|
|
238
|
+
return U($e, {
|
|
239
|
+
src: e.getValue(),
|
|
240
|
+
alt: (o = (t = e == null ? void 0 : e.row) == null ? void 0 : t.original) == null ? void 0 : o.name,
|
|
241
|
+
className: "my-8 mx-12",
|
|
242
|
+
size: 72
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
enableSorting: !1
|
|
246
|
+
}, {
|
|
247
|
+
accessorKey: "code",
|
|
248
|
+
header: () => r("menu.product.table.columns.code"),
|
|
249
|
+
enableSorting: !1,
|
|
250
|
+
size: 100,
|
|
251
|
+
cell: (e) => {
|
|
252
|
+
const t = e.row.original, o = e.getValue() || "--";
|
|
253
|
+
if (!m.value) return o;
|
|
254
|
+
const a = ke(t._id);
|
|
255
|
+
return U(oe.FmTextField, {
|
|
256
|
+
disabled: !Z.value.code,
|
|
257
|
+
modelValue: a == null ? void 0 : a.code,
|
|
258
|
+
placeholder: d.modelValue[t._id].fallbackCode,
|
|
259
|
+
"onUpdate:modelValue": (u) => {
|
|
260
|
+
I(t._id, "code", u);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}, {
|
|
265
|
+
accessorKey: "name",
|
|
266
|
+
header: () => r("menu.product.table.columns.name"),
|
|
267
|
+
enableSorting: !1,
|
|
268
|
+
size: 240,
|
|
269
|
+
cell: (e) => {
|
|
270
|
+
const t = e.row.original, o = e.getValue();
|
|
271
|
+
return m.value ? U(oe.FmTextField, {
|
|
272
|
+
disabled: !Z.value.name,
|
|
273
|
+
modelValue: t.name,
|
|
274
|
+
"onUpdate:modelValue": (a) => {
|
|
275
|
+
I(t._id, "name", a);
|
|
276
|
+
},
|
|
277
|
+
rules: S,
|
|
278
|
+
placeholder: t.fallbackName
|
|
279
|
+
}) : o;
|
|
280
|
+
}
|
|
281
|
+
}, {
|
|
282
|
+
accessorKey: "price",
|
|
283
|
+
header: () => {
|
|
284
|
+
var e;
|
|
285
|
+
return Oe(r("menu.product.table.columns.price", {
|
|
286
|
+
currency: (e = T.value) == null ? void 0 : e.currency.symbol
|
|
287
|
+
}));
|
|
288
|
+
},
|
|
289
|
+
enableSorting: !1,
|
|
290
|
+
size: 140,
|
|
291
|
+
meta: {
|
|
292
|
+
textAlign: "right"
|
|
293
|
+
},
|
|
294
|
+
cell: (e) => {
|
|
295
|
+
var u;
|
|
296
|
+
const t = e.getValue();
|
|
297
|
+
if (!m.value) return ve.Dinero.fromFdoDinero(t).toFormat();
|
|
298
|
+
const o = d.modelValue[e.row.original._id], a = o.fallbackPrice;
|
|
299
|
+
return U(ut, {
|
|
300
|
+
min: 0,
|
|
301
|
+
disabled: !o.editPrice,
|
|
302
|
+
// @ts-ignore
|
|
303
|
+
placeholder: a ? it(a, !1) : void 0,
|
|
304
|
+
modelValue: (u = ke(o._id)) == null ? void 0 : u.price,
|
|
305
|
+
// @ts-ignore
|
|
306
|
+
"onUpdate:modelValue": (C) => {
|
|
307
|
+
re(o._id, "price", C);
|
|
308
|
+
},
|
|
309
|
+
rules: h()
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}, {
|
|
313
|
+
accessorKey: "taxes",
|
|
314
|
+
header: () => Oe("SST"),
|
|
315
|
+
size: 62,
|
|
316
|
+
enableSorting: !1,
|
|
317
|
+
meta: {
|
|
318
|
+
textAlign: "right"
|
|
319
|
+
},
|
|
320
|
+
cell: (e) => {
|
|
321
|
+
const t = e.getValue(), o = e.row.original, a = n.taxSetting.countryTaxOptions, u = n.getSelectedTax(t, o.fallbackTaxes, n.taxSetting.countryTaxOptions), C = a.find((X) => X.value === u);
|
|
322
|
+
if (!m.value)
|
|
323
|
+
return `${C != null && C.meta.rate ? at(C.meta.rate) : 0}%`;
|
|
324
|
+
const s = n.getSelectedTax(t, o.fallbackTaxes, n.taxSetting.countryTaxOptions);
|
|
325
|
+
return U(oe.FmSelect, {
|
|
326
|
+
disabled: !Z.value.tax,
|
|
327
|
+
items: n.taxSetting.countryTaxOptions,
|
|
328
|
+
modelValue: s,
|
|
329
|
+
"onUpdate:modelValue": async (X) => {
|
|
330
|
+
const me = n.decodeTax(X);
|
|
331
|
+
I(o._id, "taxes", [me]);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}, {
|
|
336
|
+
accessorKey: "category",
|
|
337
|
+
header: () => r("menu.product.table.columns.category"),
|
|
338
|
+
enableSorting: !1,
|
|
339
|
+
size: 140,
|
|
340
|
+
cell: (e) => {
|
|
341
|
+
const t = e.row.original;
|
|
342
|
+
return m.value ? U(vt, {
|
|
343
|
+
"model-value": d.modelValue[t._id].category,
|
|
344
|
+
disabled: !!(n.state.currentCatalogId || n.state.currentSchedulerId),
|
|
345
|
+
"onUpdate:modelValue": async (o) => {
|
|
346
|
+
I(t._id, "category", o);
|
|
347
|
+
}
|
|
348
|
+
}) : te(t.category || null);
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
accessorKey: "orderFrom",
|
|
352
|
+
header: r("menu.product.table.columns.order_from"),
|
|
353
|
+
enableSorting: !0,
|
|
354
|
+
sortingFn: (e, t) => {
|
|
355
|
+
const [o, a] = [e, t].map((u) => P[u.original.orderFrom].sortingIndex);
|
|
356
|
+
return o - a;
|
|
357
|
+
},
|
|
358
|
+
size: 100,
|
|
359
|
+
cell: (e) => {
|
|
360
|
+
var u, C;
|
|
361
|
+
const t = e.getValue(), o = e.row.original, a = fe();
|
|
362
|
+
return m.value ? U(oe.FmSelect, {
|
|
363
|
+
disabled: !Z.value.orderFrom,
|
|
364
|
+
items: Object.values(fe()),
|
|
365
|
+
modelValue: t,
|
|
366
|
+
"onUpdate:modelValue": async (s) => {
|
|
367
|
+
re(o._id, "orderFrom", s);
|
|
368
|
+
}
|
|
369
|
+
}) : U(Te, {
|
|
370
|
+
label: (u = a[t]) == null ? void 0 : u.label,
|
|
371
|
+
variant: (C = a[t]) == null ? void 0 : C.variant
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}, {
|
|
375
|
+
id: "actions",
|
|
376
|
+
size: 52,
|
|
377
|
+
meta: {
|
|
378
|
+
cellClass: "pl-16",
|
|
379
|
+
headerClass: "py-4",
|
|
380
|
+
textAlign: "right"
|
|
381
|
+
},
|
|
382
|
+
header: () => U("div", {
|
|
383
|
+
class: "w-full px-4 flex justify-end"
|
|
384
|
+
}, [dt(U(oe.FmButton, {
|
|
385
|
+
variant: W.Tertiary,
|
|
386
|
+
textColor: L.NeutralGray400,
|
|
387
|
+
prependIcon: "edit",
|
|
388
|
+
class: "flex justify-end",
|
|
389
|
+
onClick: q,
|
|
390
|
+
type: "button"
|
|
391
|
+
}), "Bulk edit")]),
|
|
392
|
+
cell: (e) => {
|
|
393
|
+
const t = e.row.original;
|
|
394
|
+
return U("div", {
|
|
395
|
+
class: "px-4 flex justify-end"
|
|
396
|
+
}, [U(oe.FmButton, {
|
|
397
|
+
icon: "delete",
|
|
398
|
+
variant: "tertiary",
|
|
399
|
+
textColor: L.NeutralGray400,
|
|
400
|
+
onClick: we(async () => {
|
|
401
|
+
await _.deleteItem([{
|
|
402
|
+
_id: t._id,
|
|
403
|
+
name: t.name,
|
|
404
|
+
thumbnail: t.thumbnail
|
|
405
|
+
}]);
|
|
406
|
+
}, ["stop", "prevent"])
|
|
407
|
+
})]);
|
|
408
|
+
}
|
|
409
|
+
}]);
|
|
410
|
+
n.taxSetting.systemCode || B.value.splice(4, 1);
|
|
411
|
+
const x = A({}), p = A([]);
|
|
412
|
+
pe(() => x.value, (e) => {
|
|
413
|
+
let t = [];
|
|
414
|
+
Object.keys(e).forEach((o) => {
|
|
415
|
+
e[o] ? t.push(F.value[parseInt(o)]) : p.value = t.filter((u) => u !== F.value[parseInt(o)]);
|
|
416
|
+
}), p.value = t;
|
|
417
|
+
}), pe(() => F.value, () => {
|
|
418
|
+
x.value = {}, p.value = [];
|
|
419
|
+
}), pe(() => m.value, () => {
|
|
420
|
+
x.value = {}, p.value = [];
|
|
421
|
+
});
|
|
422
|
+
const J = () => {
|
|
423
|
+
x.value = {};
|
|
424
|
+
};
|
|
425
|
+
async function $() {
|
|
426
|
+
await tt();
|
|
427
|
+
const e = () => !!n.currentCatalog || !!n.state.currentSchedulerId, t = (a) => a === "" || a === null ? e() ? "" : null : a, o = Object.values(d.modelValue).filter((a) => {
|
|
428
|
+
const u = Object.values(d.originalValue).find((C) => C._id === a._id);
|
|
429
|
+
return Ve(u, a);
|
|
430
|
+
}).map((a) => ({
|
|
431
|
+
_id: a._id,
|
|
432
|
+
name: a.name,
|
|
433
|
+
code: a.code,
|
|
434
|
+
price: a.price,
|
|
435
|
+
orderFrom: a.orderFrom ?? null,
|
|
436
|
+
taxes: a.taxes,
|
|
437
|
+
category: t(a.category || null)
|
|
438
|
+
}));
|
|
439
|
+
await _.updateMany(o), q(!1);
|
|
440
|
+
}
|
|
441
|
+
const le = async () => {
|
|
442
|
+
await _.deleteItem(p.value.map((e) => ({
|
|
443
|
+
_id: e._id,
|
|
444
|
+
name: e.name,
|
|
445
|
+
thumbnail: e.thumbnail
|
|
446
|
+
})));
|
|
447
|
+
}, Q = () => {
|
|
448
|
+
D("reset:model-value");
|
|
449
|
+
}, ae = () => {
|
|
450
|
+
Object.entries(d.modelValue).some(([t, o]) => Ve(o, d.originalValue[t])) ? f.open({
|
|
451
|
+
title: "You have unsaved changes!",
|
|
452
|
+
message: "Are you sure you want to discard? You will lose all the changes if discard edit.",
|
|
453
|
+
primaryActions: {
|
|
454
|
+
text: "Discard",
|
|
455
|
+
close: !0,
|
|
456
|
+
variant: W.Destructive
|
|
457
|
+
},
|
|
458
|
+
secondaryActions: {
|
|
459
|
+
text: "Cancel",
|
|
460
|
+
close: !0
|
|
461
|
+
}
|
|
462
|
+
}).onPrimary(() => {
|
|
463
|
+
Q(), q(!1);
|
|
464
|
+
}) : (q(!1), Q());
|
|
465
|
+
}, de = b(() => ({
|
|
466
|
+
thumbnail: !m.value,
|
|
467
|
+
actions: !m.value
|
|
468
|
+
})), Le = (e) => {
|
|
469
|
+
_.update(e._id);
|
|
470
|
+
};
|
|
471
|
+
async function Ge(e) {
|
|
472
|
+
await _.update(e.original._id);
|
|
473
|
+
}
|
|
474
|
+
function Ce(e) {
|
|
475
|
+
var C;
|
|
476
|
+
const t = e.price ?? // TODO: fix type error
|
|
477
|
+
// @ts-ignore
|
|
478
|
+
e.fallbackPrice ?? ve.Dinero.fromNumber({
|
|
479
|
+
number: 0
|
|
480
|
+
}).toObject(), o = e.taxes;
|
|
481
|
+
n.taxSetting.countryTaxOptions;
|
|
482
|
+
const a = ve.Dinero.fromFdoDinero(t).toFormat(), u = (C = T.value) == null ? void 0 : C.currency.symbol;
|
|
483
|
+
return n.getSelectedTax(
|
|
484
|
+
o,
|
|
485
|
+
// TODO: fix type error
|
|
486
|
+
// @ts-ignore
|
|
487
|
+
e.fallbackTaxes,
|
|
488
|
+
n.taxSetting.countryTaxOptions
|
|
489
|
+
), `${u == null ? void 0 : u.toUpperCase()}${a}`;
|
|
490
|
+
}
|
|
491
|
+
function ke(e) {
|
|
492
|
+
var a;
|
|
493
|
+
const t = n.currentCatalog, o = n.state.currentSchedulerId;
|
|
494
|
+
if (t && o) {
|
|
495
|
+
const u = t.override.scheduler[o] ?? {
|
|
496
|
+
_id: o
|
|
497
|
+
};
|
|
498
|
+
return ((a = u == null ? void 0 : u.items) == null ? void 0 : a.filter((s) => s._id === e))[0];
|
|
499
|
+
} else return t ? t.override.items[e][0] : o ? n.schedulers.find((s) => s._id === o).items.filter((s) => s._id === e)[0] : F.value.find((u) => u._id === e);
|
|
500
|
+
}
|
|
501
|
+
const qe = Ue(), We = b(() => qe.breakpoints.value.xs), Se = A(null), Ye = ot(Se), He = b(() => {
|
|
502
|
+
var t;
|
|
503
|
+
return {
|
|
504
|
+
height: `calc(100vh - ${((t = Ye.value) == null ? void 0 : t.top) + 24}px)`
|
|
505
|
+
};
|
|
506
|
+
});
|
|
507
|
+
return (e, t) => {
|
|
508
|
+
const o = Y("fm-search"), a = Y("fm-button"), u = Y("fm-table"), C = Y("fm-form");
|
|
509
|
+
return We.value ? (v(), z("div", St, [g("div", wt, [g("div", Vt, [i(o, {
|
|
510
|
+
"model-value": K.value,
|
|
511
|
+
"onUpdate:modelValue": t[4] || (t[4] = (s) => K.value = s),
|
|
512
|
+
autofocus: "",
|
|
513
|
+
placeholder: l(r)("menu.product.table.search.placeholder")
|
|
514
|
+
}, null, 8, ["model-value", "placeholder"])]), t[6] || (t[6] = g("div", {
|
|
515
|
+
class: "w-full h-[1px] bg-fm-color-neutral-gray-100"
|
|
516
|
+
}, null, -1)), g("div", Ft, [_e(e.$slots, "filter")])]), F.value.length ? (v(), z("div", $t, [(v(!0), z(he, null, ze(j.value, (s) => {
|
|
517
|
+
var X, me;
|
|
518
|
+
return v(), z("div", {
|
|
519
|
+
key: s._id,
|
|
520
|
+
class: "max-w-full py-12 px-16 space-x-16 flex items-center",
|
|
521
|
+
onClick: () => Le(s)
|
|
522
|
+
}, [g("div", It, [i($e, {
|
|
523
|
+
alt: s.name,
|
|
524
|
+
size: 72,
|
|
525
|
+
src: s.thumbnail
|
|
526
|
+
}, null, 8, ["alt", "src"]), g("div", Mt, [g("div", Ot, [g("p", Pt, se(s.name), 1), i(Te, {
|
|
527
|
+
label: (X = l(P)[s.orderFrom || ""]) == null ? void 0 : X.label,
|
|
528
|
+
variant: (me = l(P)[s.orderFrom || ""]) == null ? void 0 : me.variant
|
|
529
|
+
}, null, 8, ["label", "variant"])]), g("p", zt, se(Ce(s)), 1), g("p", Nt, " Category: " + se(te(s.category || null)), 1)])]), i(a, {
|
|
530
|
+
"text-color": l(L).NeutralGray400,
|
|
531
|
+
variant: l(W).Tertiary,
|
|
532
|
+
"prepend-icon": "delete",
|
|
533
|
+
onClick: we(() => l(_).deleteItem([{
|
|
534
|
+
_id: s._id,
|
|
535
|
+
name: s.name,
|
|
536
|
+
thumbnail: s.thumbnail
|
|
537
|
+
}]), ["stop"])
|
|
538
|
+
}, null, 8, ["text-color", "variant", "onClick"])], 8, Tt);
|
|
539
|
+
}), 128))])) : (v(), z("div", Dt, [i(ie, {
|
|
540
|
+
subtitle: l(r)("menu.product.table.empty.subtitle"),
|
|
541
|
+
title: l(r)("menu.product.table.empty.title")
|
|
542
|
+
}, {
|
|
543
|
+
action: M(() => [g("div", jt, [i(a, {
|
|
544
|
+
variant: l(W).Primary,
|
|
545
|
+
label: l(r)("menu.product.table.empty.actions.add"),
|
|
546
|
+
"prepend-icon": "add",
|
|
547
|
+
onClick: t[5] || (t[5] = (s) => l(_).create(null))
|
|
548
|
+
}, null, 8, ["variant", "label"]), i(Pe, null, {
|
|
549
|
+
default: M(({
|
|
550
|
+
trigger: s
|
|
551
|
+
}) => [i(a, {
|
|
552
|
+
"bg-color": l(L).NeutralGray100,
|
|
553
|
+
"text-color": l(L).NeutralGray400,
|
|
554
|
+
variant: l(W).Primary,
|
|
555
|
+
label: l(r)("menu.product.table.empty.actions.import"),
|
|
556
|
+
"prepend-icon": "download",
|
|
557
|
+
onClick: s
|
|
558
|
+
}, null, 8, ["bg-color", "text-color", "variant", "label", "onClick"])]),
|
|
559
|
+
_: 1
|
|
560
|
+
})])]),
|
|
561
|
+
_: 1
|
|
562
|
+
}, 8, ["subtitle", "title"])]))])) : (v(), G(C, {
|
|
563
|
+
key: 0,
|
|
564
|
+
"blame-form-child-on-validation-failed": "",
|
|
565
|
+
class: "flex flex-col flex-1 space-y-8 overflow-hidden",
|
|
566
|
+
onValidationSuccess: $
|
|
567
|
+
}, {
|
|
568
|
+
default: M(() => [g("div", ft, [g("div", bt, [_e(e.$slots, "filter")]), g("div", gt, [i(o, {
|
|
569
|
+
"model-value": K.value,
|
|
570
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => K.value = s),
|
|
571
|
+
autofocus: "",
|
|
572
|
+
placeholder: l(r)("menu.product.table.search.placeholder")
|
|
573
|
+
}, null, 8, ["model-value", "placeholder"])])]), F.value.length ? (v(), z("div", yt, [p.value.length && !m.value ? (v(), z("div", _t, [g("p", ht, se(l(r)("menu.product.table.selection.count", {
|
|
574
|
+
count: p.value.length
|
|
575
|
+
})), 1), i(a, {
|
|
576
|
+
label: l(r)("menu.product.table.selection.actions.deselect_all"),
|
|
577
|
+
type: "button",
|
|
578
|
+
variant: "plain",
|
|
579
|
+
onClick: J
|
|
580
|
+
}, null, 8, ["label"]), i(a, {
|
|
581
|
+
"border-color": l(L).SystemError300,
|
|
582
|
+
"text-color": l(L).SystemError300,
|
|
583
|
+
class: "ml-auto",
|
|
584
|
+
label: l(r)("menu.product.table.selection.actions.remove"),
|
|
585
|
+
"prepend-icon": "delete",
|
|
586
|
+
variant: "secondary",
|
|
587
|
+
onClick: le
|
|
588
|
+
}, null, 8, ["border-color", "text-color", "label"])])) : ue("", !0), m.value ? (v(), z("div", xt, [i(a, {
|
|
589
|
+
variant: l(W).Tertiary,
|
|
590
|
+
label: l(r)("menu.product.table.bulk_edit.actions.reset_all"),
|
|
591
|
+
onClick: Q
|
|
592
|
+
}, null, 8, ["variant", "label"]), i(a, {
|
|
593
|
+
variant: l(W).Tertiary,
|
|
594
|
+
label: l(r)("menu.common.actions.cancel"),
|
|
595
|
+
onClick: ae
|
|
596
|
+
}, null, 8, ["variant", "label"]), i(a, {
|
|
597
|
+
borderColor: l(L).ColorPrimary,
|
|
598
|
+
textColor: l(L).ColorPrimary,
|
|
599
|
+
variant: l(W).Secondary,
|
|
600
|
+
label: l(r)("menu.product.table.bulk_edit.actions.save"),
|
|
601
|
+
type: "submit"
|
|
602
|
+
}, null, 8, ["borderColor", "textColor", "variant", "label"])])) : ue("", !0), g("div", {
|
|
603
|
+
ref_key: "tableWrapper",
|
|
604
|
+
ref: Se
|
|
605
|
+
}, [(v(), G(Xe(m.value ? mt : "div"), {
|
|
606
|
+
title: l(r)("menu.product.table.bulk_edit.title"),
|
|
607
|
+
show: m.value,
|
|
608
|
+
"primary-action": {
|
|
609
|
+
label: l(r)("menu.product.table.bulk_edit.actions.save")
|
|
610
|
+
},
|
|
611
|
+
"secondary-actions": [{
|
|
612
|
+
label: l(r)("menu.product.table.bulk_edit.actions.reset_all"),
|
|
613
|
+
click: Q
|
|
614
|
+
}, {
|
|
615
|
+
label: l(r)("menu.common.actions.cancel"),
|
|
616
|
+
click: ae
|
|
617
|
+
}],
|
|
618
|
+
class: "overflow-hidden",
|
|
619
|
+
style: et(He.value),
|
|
620
|
+
onOnPrimary: $,
|
|
621
|
+
onOnCancel: ae
|
|
622
|
+
}, {
|
|
623
|
+
default: M(() => [i(u, {
|
|
624
|
+
class: ne({
|
|
625
|
+
"mt-24": m.value
|
|
626
|
+
}),
|
|
627
|
+
modelValue: x.value,
|
|
628
|
+
"onUpdate:modelValue": t[1] || (t[1] = (s) => x.value = s),
|
|
629
|
+
"column-defs": B.value,
|
|
630
|
+
"column-visibility": de.value,
|
|
631
|
+
loading: e.isCalculating,
|
|
632
|
+
"page-size": F.value.length,
|
|
633
|
+
"row-data": j.value,
|
|
634
|
+
selection: m.value ? void 0 : "multiple",
|
|
635
|
+
"shrink-at": !1,
|
|
636
|
+
"hide-footer": "",
|
|
637
|
+
"pin-header-row": "",
|
|
638
|
+
onRowClick: t[2] || (t[2] = (s) => m.value ? void 0 : Ge(s))
|
|
639
|
+
}, null, 8, ["class", "modelValue", "column-defs", "column-visibility", "loading", "page-size", "row-data", "selection"])]),
|
|
640
|
+
_: 1
|
|
641
|
+
}, 40, ["title", "show", "primary-action", "secondary-actions", "style"]))], 512)])) : (v(), z("div", Ct, [i(ie, {
|
|
642
|
+
subtitle: l(r)("menu.product.table.empty.subtitle"),
|
|
643
|
+
title: l(r)("menu.product.table.empty.title")
|
|
644
|
+
}, {
|
|
645
|
+
action: M(() => [g("div", kt, [i(a, {
|
|
646
|
+
variant: l(W).Primary,
|
|
647
|
+
label: l(r)("menu.product.table.empty.actions.add"),
|
|
648
|
+
"prepend-icon": "add",
|
|
649
|
+
onClick: t[3] || (t[3] = (s) => l(_).create(null))
|
|
650
|
+
}, null, 8, ["variant", "label"]), i(Pe, null, {
|
|
651
|
+
default: M(({
|
|
652
|
+
trigger: s
|
|
653
|
+
}) => [i(a, {
|
|
654
|
+
"bg-color": l(L).NeutralGray100,
|
|
655
|
+
"text-color": l(L).NeutralGray400,
|
|
656
|
+
variant: l(W).Primary,
|
|
657
|
+
label: l(r)("menu.product.table.empty.actions.import"),
|
|
658
|
+
"prepend-icon": "download",
|
|
659
|
+
onClick: s
|
|
660
|
+
}, null, 8, ["bg-color", "text-color", "variant", "label", "onClick"])]),
|
|
661
|
+
_: 1
|
|
662
|
+
})])]),
|
|
663
|
+
_: 1
|
|
664
|
+
}, 8, ["subtitle", "title"])]))]),
|
|
665
|
+
_: 3
|
|
666
|
+
}));
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
}), Ut = {
|
|
670
|
+
key: 0,
|
|
671
|
+
class: /* @__PURE__ */ ne(["flex flex-col", "flex-1", "overflow-hidden"])
|
|
672
|
+
}, At = {
|
|
673
|
+
class: /* @__PURE__ */ ne(["pt-16 xs:pt-0", "flex xs:flex-col", "flex-1", "w-full", "overflow-hidden"])
|
|
674
|
+
}, Et = { class: "flex flex-col flex-1 overflow-hidden" }, Kt = {
|
|
675
|
+
key: 1,
|
|
676
|
+
class: "pt-16 xs:pt-8 space-y-24"
|
|
677
|
+
}, Rt = { class: "flex items-center gap-8 px-16" }, ul = /* @__PURE__ */ ce({
|
|
678
|
+
__name: "Product",
|
|
679
|
+
setup(O) {
|
|
680
|
+
const c = Be(), d = je(), r = Ne(d), V = De(r);
|
|
681
|
+
Ae({
|
|
682
|
+
dialog: c,
|
|
683
|
+
menuLoader: V
|
|
684
|
+
});
|
|
685
|
+
const n = ye(), H = b(() => n.rules.item), f = Ee(), y = Re(), N = Ke(), _ = b(() => !n.state.currentCatalogId), E = b(() => n.rules.item), T = b(() => !n.state.currentSchedulerId), Z = A(!1), w = A(!1), F = b(() => {
|
|
686
|
+
var k, S, h, P;
|
|
687
|
+
if (_.value && T.value) return;
|
|
688
|
+
if (T.value) {
|
|
689
|
+
const B = (k = n.currentCatalog) == null ? void 0 : k.override.items;
|
|
690
|
+
return B ? Object.entries(B).reduce((x, [p, J]) => {
|
|
691
|
+
const $ = J.find((le) => !le.combinationKey);
|
|
692
|
+
return $ && (x[p] = $), x;
|
|
693
|
+
}, {}) : {};
|
|
694
|
+
}
|
|
695
|
+
return ((_.value ? (S = n.currentScheduler) == null ? void 0 : S.items : (P = (h = n.currentCatalog) == null ? void 0 : h.override.scheduler[n.state.currentSchedulerId]) == null ? void 0 : P.items) ?? []).reduce((B, x) => (x.combinationKey || (B[x._id] = x), B), {});
|
|
696
|
+
}), D = A({}), m = A({}), q = async () => {
|
|
697
|
+
var P, B;
|
|
698
|
+
w.value = !0;
|
|
699
|
+
const R = !!F.value, k = be.flatten(j.value.map((x) => x.items)), S = R && Z.value ? await ct(
|
|
700
|
+
n.mergedMenu,
|
|
701
|
+
k,
|
|
702
|
+
n.state.menu,
|
|
703
|
+
(P = n.currentCatalog) == null ? void 0 : P._id,
|
|
704
|
+
(B = n.currentScheduler) == null ? void 0 : B._id,
|
|
705
|
+
!1
|
|
706
|
+
) : void 0, h = k.reduce((x, p, J) => {
|
|
707
|
+
var le, Q, ae, de;
|
|
708
|
+
const $ = (le = F.value) == null ? void 0 : le[p._id];
|
|
709
|
+
return x[p._id] = {
|
|
710
|
+
_id: p._id,
|
|
711
|
+
name: p.name,
|
|
712
|
+
code: R ? $ == null ? void 0 : $.code : p == null ? void 0 : p.code,
|
|
713
|
+
category: p.category,
|
|
714
|
+
price: R && E.value.editPrice ? $ == null ? void 0 : $.price : p.price,
|
|
715
|
+
orderFrom: R ? $ == null ? void 0 : $.orderFrom : p.orderFrom,
|
|
716
|
+
taxes: R ? null : p.taxes,
|
|
717
|
+
thumbnail: p.thumbnail,
|
|
718
|
+
fallbackPrice: (Q = S == null ? void 0 : S[J]) == null ? void 0 : Q.price,
|
|
719
|
+
fallbackName: R ? p.name : void 0,
|
|
720
|
+
fallbackCode: (ae = S == null ? void 0 : S[J]) == null ? void 0 : ae.code,
|
|
721
|
+
fallbackOrder: (de = S == null ? void 0 : S[J]) == null ? void 0 : de.orderFrom,
|
|
722
|
+
fallbackTaxes: R ? p.taxes : null
|
|
723
|
+
}, x;
|
|
724
|
+
}, {});
|
|
725
|
+
D.value = h, m.value = { ...h }, w.value = !1;
|
|
726
|
+
}, { categories: K, selectedCategories: j } = ge();
|
|
727
|
+
lt(async () => {
|
|
728
|
+
j.value && await q();
|
|
729
|
+
});
|
|
730
|
+
function ee() {
|
|
731
|
+
y.create(null);
|
|
732
|
+
}
|
|
733
|
+
const te = () => {
|
|
734
|
+
j.value && q();
|
|
735
|
+
}, re = Ue();
|
|
736
|
+
b(() => re.breakpoints.value.xs);
|
|
737
|
+
const { t: I } = xe();
|
|
738
|
+
return (R, k) => {
|
|
739
|
+
const S = Y("fm-button");
|
|
740
|
+
return l(K).length ? (v(), z("div", Ut, [
|
|
741
|
+
g("div", At, [
|
|
742
|
+
g("div", Et, [
|
|
743
|
+
l(j) ? (v(), G(Bt, {
|
|
744
|
+
key: 0,
|
|
745
|
+
"is-calculating": w.value,
|
|
746
|
+
"model-value": D.value,
|
|
747
|
+
"original-value": m.value,
|
|
748
|
+
"onUpdate:modelValue": k[0] || (k[0] = (h) => D.value = h),
|
|
749
|
+
"onReset:modelValue": te,
|
|
750
|
+
"onUpdate:editing": k[1] || (k[1] = (h) => Z.value = h)
|
|
751
|
+
}, {
|
|
752
|
+
filter: M(() => [
|
|
753
|
+
i(Me),
|
|
754
|
+
E.value.multiScheduler ? (v(), G(Fe, { key: 0 })) : ue("", !0)
|
|
755
|
+
]),
|
|
756
|
+
_: 1
|
|
757
|
+
}, 8, ["is-calculating", "model-value", "original-value"])) : ue("", !0)
|
|
758
|
+
])
|
|
759
|
+
])
|
|
760
|
+
])) : (v(), z("div", Kt, [
|
|
761
|
+
g("div", Rt, [
|
|
762
|
+
i(Me),
|
|
763
|
+
E.value.multiScheduler ? (v(), G(Fe, { key: 0 })) : ue("", !0)
|
|
764
|
+
]),
|
|
765
|
+
H.value.create ? (v(), G(ie, {
|
|
766
|
+
key: 0,
|
|
767
|
+
action: {
|
|
768
|
+
text: l(I)("menu.product.empty.with_create.action"),
|
|
769
|
+
callback: ee
|
|
770
|
+
},
|
|
771
|
+
subtitle: l(I)("menu.product.empty.with_create.subtitle"),
|
|
772
|
+
title: l(I)("menu.product.empty.with_create.title")
|
|
773
|
+
}, null, 8, ["action", "subtitle", "title"])) : T.value ? (v(), G(ie, {
|
|
774
|
+
key: 1,
|
|
775
|
+
subtitle: l(I)("menu.product.empty.no_scheduler.subtitle"),
|
|
776
|
+
title: l(I)("menu.product.empty.no_scheduler.title")
|
|
777
|
+
}, {
|
|
778
|
+
action: M(() => [
|
|
779
|
+
i(Ie, {
|
|
780
|
+
"categorized-items": l(N).linkableItems,
|
|
781
|
+
"initial-value": l(N).currentItems,
|
|
782
|
+
"show-variant": !1,
|
|
783
|
+
onSubmit: k[2] || (k[2] = (h) => l(N).applyProduct(h.map((P) => P._id)))
|
|
784
|
+
}, {
|
|
785
|
+
default: M(({ trigger: h }) => [
|
|
786
|
+
i(S, {
|
|
787
|
+
label: l(I)("menu.common.actions.link_product"),
|
|
788
|
+
"prepend-icon": "link",
|
|
789
|
+
onClick: h
|
|
790
|
+
}, null, 8, ["label", "onClick"])
|
|
791
|
+
]),
|
|
792
|
+
_: 1
|
|
793
|
+
}, 8, ["categorized-items", "initial-value"])
|
|
794
|
+
]),
|
|
795
|
+
_: 1
|
|
796
|
+
}, 8, ["subtitle", "title"])) : (v(), G(ie, {
|
|
797
|
+
key: 2,
|
|
798
|
+
subtitle: l(I)("menu.product.empty.with_scheduler.subtitle"),
|
|
799
|
+
title: l(I)("menu.product.empty.with_scheduler.title")
|
|
800
|
+
}, {
|
|
801
|
+
action: M(() => [
|
|
802
|
+
i(Ie, {
|
|
803
|
+
"categorized-items": l(f).linkableItems,
|
|
804
|
+
"initial-value": l(f).currentItems,
|
|
805
|
+
"show-variant": !1,
|
|
806
|
+
onSubmit: k[3] || (k[3] = (h) => l(f).applyProduct(h.map((P) => P._id)))
|
|
807
|
+
}, {
|
|
808
|
+
default: M(({ trigger: h }) => [
|
|
809
|
+
i(S, {
|
|
810
|
+
label: l(I)("menu.common.actions.apply_product"),
|
|
811
|
+
onClick: h
|
|
812
|
+
}, null, 8, ["label", "onClick"])
|
|
813
|
+
]),
|
|
814
|
+
_: 1
|
|
815
|
+
}, 8, ["categorized-items", "initial-value"])
|
|
816
|
+
]),
|
|
817
|
+
_: 1
|
|
818
|
+
}, 8, ["subtitle", "title"]))
|
|
819
|
+
]));
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
export {
|
|
824
|
+
ul as _,
|
|
825
|
+
Pe as a
|
|
826
|
+
};
|