@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,551 @@
|
|
|
1
|
+
import { defineComponent as ue, ref as P, computed as R, watch as ve, resolveComponent as p, openBlock as c, createElementBlock as g, Fragment as V, renderSlot as ye, createVNode as r, unref as e, withCtx as m, createElementVNode as d, renderList as $, createBlock as C, createCommentVNode as I, createTextVNode as be, toDisplayString as b, h as ee, withModifiers as ae, normalizeClass as J } from "vue";
|
|
2
|
+
import { useCoreStore as ie } from "@feedmepos/mf-common";
|
|
3
|
+
import { b as x, u as re, i as ce, a as me, m as te, c as ke, n as de, g as xe, d as Q, h as pe, y as le, _ as Ce, k as he, j as Oe, R as oe } from "./app-t9ONnc0s.js";
|
|
4
|
+
import { C as Fe } from "./catalog-4OmC0JA3.js";
|
|
5
|
+
import { useRouter as Me } from "vue-router";
|
|
6
|
+
import { useSnackbar as fe, components as _e, FmButtonColorThemeVariant as X, FmButtonVariant as j, useDialog as De, useBreakpoints as Ve } from "@feedmepos/ui-library";
|
|
7
|
+
import { C as E, a as L, _ as ne } from "./GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Q7es2wmt.js";
|
|
8
|
+
import { _ as Se } from "./FormSection.vue_vue_type_script_setup_true_lang-BWJUD8NZ.js";
|
|
9
|
+
import { _ as W } from "./FormItem.vue_vue_type_script_setup_true_lang-DKsxEK-8.js";
|
|
10
|
+
const Ae = { class: "space-y-32" }, Ue = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "pl-32 space-x-8"
|
|
13
|
+
}, Ne = { class: "pl-[60px] space-y-16" }, Te = { class: "space-x-16 flex items-center" }, Ee = { class: "flex-1 space-y-4" }, Le = { class: "fm-typo-en-body-lg-400" }, Re = { class: "fm-typo-en-body-md-400" }, $e = { class: "flex gap-8 items-center justify-start" }, we = /* @__PURE__ */ ue({
|
|
14
|
+
__name: "Form",
|
|
15
|
+
setup(ge) {
|
|
16
|
+
const k = P(!1), v = P(!1), B = (i) => {
|
|
17
|
+
xe.isBoolean(i) ? k.value = i : k.value = !k.value;
|
|
18
|
+
}, A = R(() => M.version === x.F_MENU_VERSION.enum.v4), M = re(), z = ie(), G = ce(me(fe())), t = P(
|
|
19
|
+
E.fromCatalog(te.generator.initMenuV4Catalog(), A.value)
|
|
20
|
+
), H = R(() => M.catalogs.map((i) => i.name));
|
|
21
|
+
ve(
|
|
22
|
+
() => k.value,
|
|
23
|
+
(i) => {
|
|
24
|
+
i && (t.value = E.fromCatalog(te.generator.initMenuV4Catalog(), A.value));
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
const w = R({
|
|
28
|
+
get: () => t.value.taxSetting,
|
|
29
|
+
set: (i) => {
|
|
30
|
+
t.value.taxSetting = i;
|
|
31
|
+
}
|
|
32
|
+
}), S = R(() => {
|
|
33
|
+
var a, o;
|
|
34
|
+
if (!z.currentCountry.value) return [];
|
|
35
|
+
const i = ((a = t.value.taxSetting) == null ? void 0 : a.mode) === L.MANUAL ? ((o = t.value.taxSetting) == null ? void 0 : o.inclusive) ?? [] : [];
|
|
36
|
+
return ke.Country.getCountry(z.currentCountry.value).taxSystems.map((f) => {
|
|
37
|
+
const y = i.find((h) => h.systemCode === f.code);
|
|
38
|
+
return {
|
|
39
|
+
inclusive: (y == null ? void 0 : y.inclusive) || !1,
|
|
40
|
+
systemCode: f.code
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
function D(i) {
|
|
45
|
+
const l = t.value.taxSetting, a = l.mode === L.AUTO ? E.manualTax(S.value) : Q(l);
|
|
46
|
+
a.inclusive ?? (a.inclusive = []);
|
|
47
|
+
const o = a.inclusive.findIndex((f) => f.systemCode === i.systemCode);
|
|
48
|
+
o < 0 ? a.inclusive.push(i) : a.inclusive.splice(o, 1, i), w.value = a;
|
|
49
|
+
}
|
|
50
|
+
function K(i, l) {
|
|
51
|
+
const a = Q(t.value);
|
|
52
|
+
a.markupOptions && (a.markupOptions[i] = l, t.value = a);
|
|
53
|
+
}
|
|
54
|
+
function Y(i) {
|
|
55
|
+
const l = Q(t.value);
|
|
56
|
+
l.markupOptions && (l.markupOptions.splice(i, 1), t.value = l);
|
|
57
|
+
}
|
|
58
|
+
async function q() {
|
|
59
|
+
v.value = !0;
|
|
60
|
+
const i = {
|
|
61
|
+
...t.value,
|
|
62
|
+
...E.toCatalog(t.value)
|
|
63
|
+
};
|
|
64
|
+
try {
|
|
65
|
+
await G.updateMenu(
|
|
66
|
+
{
|
|
67
|
+
module: x.F_MENU_MODULE_V4_KEY.enum.catalog,
|
|
68
|
+
operation: pe.F_OPERATION_TYPE.create,
|
|
69
|
+
data: i
|
|
70
|
+
},
|
|
71
|
+
i.name
|
|
72
|
+
), k.value = !1;
|
|
73
|
+
} finally {
|
|
74
|
+
v.value = !1;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const { t: u } = de();
|
|
78
|
+
return (i, l) => {
|
|
79
|
+
const a = p("fm-text-field"), o = p("fm-radio"), f = p("fm-radio-group"), y = p("fm-checkbox"), h = p("fm-switch"), U = p("fm-select"), O = p("fm-button"), N = p("fm-chip"), n = p("fm-card"), T = p("fm-side-sheet");
|
|
80
|
+
return c(), g(V, null, [
|
|
81
|
+
ye(i.$slots, "default", { trigger: B }),
|
|
82
|
+
r(T, {
|
|
83
|
+
modelValue: k.value,
|
|
84
|
+
"onUpdate:modelValue": l[7] || (l[7] = (s) => k.value = s),
|
|
85
|
+
"is-container": e(_e).FmForm,
|
|
86
|
+
"is-container-props": {
|
|
87
|
+
onValidationSuccess: q,
|
|
88
|
+
blameFormChildOnValidationFailed: !0
|
|
89
|
+
},
|
|
90
|
+
"max-width": 560,
|
|
91
|
+
"z-index": 80
|
|
92
|
+
}, {
|
|
93
|
+
"side-sheet-footer": m(() => [
|
|
94
|
+
d("div", $e, [
|
|
95
|
+
r(O, {
|
|
96
|
+
loading: v.value,
|
|
97
|
+
label: e(u)("menu.common.actions.add"),
|
|
98
|
+
size: "lg",
|
|
99
|
+
type: "submit",
|
|
100
|
+
variant: "primary"
|
|
101
|
+
}, null, 8, ["loading", "label"]),
|
|
102
|
+
r(O, {
|
|
103
|
+
label: e(u)("menu.common.actions.cancel"),
|
|
104
|
+
size: "lg",
|
|
105
|
+
variant: "tertiary",
|
|
106
|
+
onClick: l[6] || (l[6] = () => k.value = !1)
|
|
107
|
+
}, null, 8, ["label"])
|
|
108
|
+
])
|
|
109
|
+
]),
|
|
110
|
+
default: m(() => [
|
|
111
|
+
d("div", Ae, [
|
|
112
|
+
r(Se, {
|
|
113
|
+
title: e(u)("menu.catalog.detail")
|
|
114
|
+
}, {
|
|
115
|
+
default: m(() => [
|
|
116
|
+
r(a, {
|
|
117
|
+
modelValue: t.value.name,
|
|
118
|
+
"onUpdate:modelValue": l[0] || (l[0] = (s) => t.value.name = s),
|
|
119
|
+
rules: [
|
|
120
|
+
(s) => !H.value.includes(s.trim()) || e(u)("menu.catalog.validation.name_used"),
|
|
121
|
+
(s) => !!s || e(u)("menu.catalog.validation.name_required")
|
|
122
|
+
],
|
|
123
|
+
autofocus: "",
|
|
124
|
+
label: e(u)("menu.catalog.form.name")
|
|
125
|
+
}, null, 8, ["modelValue", "rules", "label"]),
|
|
126
|
+
r(W, {
|
|
127
|
+
label: e(u)("menu.catalog.form.tax.title")
|
|
128
|
+
}, {
|
|
129
|
+
default: m(() => {
|
|
130
|
+
var s, F;
|
|
131
|
+
return [
|
|
132
|
+
r(f, {
|
|
133
|
+
"model-value": (s = t.value.taxSetting) == null ? void 0 : s.mode,
|
|
134
|
+
"onUpdate:modelValue": l[1] || (l[1] = (_) => {
|
|
135
|
+
_ === e(L).AUTO ? w.value = e(E).autoTax() : w.value = e(E).manualTax(S.value);
|
|
136
|
+
})
|
|
137
|
+
}, {
|
|
138
|
+
default: m(() => [
|
|
139
|
+
r(o, {
|
|
140
|
+
value: e(L).AUTO,
|
|
141
|
+
label: e(u)("menu.catalog.form.tax.auto.label"),
|
|
142
|
+
sublabel: e(u)("menu.catalog.form.tax.auto.sublabel"),
|
|
143
|
+
class: "pl-4"
|
|
144
|
+
}, null, 8, ["value", "label", "sublabel"]),
|
|
145
|
+
r(o, {
|
|
146
|
+
value: e(L).MANUAL,
|
|
147
|
+
label: e(u)("menu.catalog.form.tax.manual.label"),
|
|
148
|
+
sublabel: e(u)("menu.catalog.form.tax.manual.sublabel")
|
|
149
|
+
}, null, 8, ["value", "label", "sublabel"])
|
|
150
|
+
]),
|
|
151
|
+
_: 1
|
|
152
|
+
}, 8, ["model-value"]),
|
|
153
|
+
((F = t.value.taxSetting) == null ? void 0 : F.mode) === e(L).MANUAL ? (c(), g("div", Ue, [
|
|
154
|
+
(c(!0), g(V, null, $(S.value, (_) => (c(), C(y, {
|
|
155
|
+
key: _.systemCode,
|
|
156
|
+
"model-value": _.inclusive,
|
|
157
|
+
value: !0,
|
|
158
|
+
label: e(u)("menu.catalog.form.tax.inclusive", { code: _.systemCode }),
|
|
159
|
+
"onUpdate:modelValue": (Z) => {
|
|
160
|
+
D({
|
|
161
|
+
..._,
|
|
162
|
+
inclusive: Z
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))
|
|
166
|
+
])) : I("", !0)
|
|
167
|
+
];
|
|
168
|
+
}),
|
|
169
|
+
_: 1
|
|
170
|
+
}, 8, ["label"])
|
|
171
|
+
]),
|
|
172
|
+
_: 1
|
|
173
|
+
}, 8, ["title"]),
|
|
174
|
+
A.value ? (c(), C(W, {
|
|
175
|
+
key: 0,
|
|
176
|
+
label: e(u)("menu.catalog.form.link.title")
|
|
177
|
+
}, {
|
|
178
|
+
default: m(() => [
|
|
179
|
+
r(h, {
|
|
180
|
+
"model-value": t.value.orderFrom && t.value.orderFrom !== e(x.F_ORDER_FROM).enum.NONE,
|
|
181
|
+
label: e(u)("menu.catalog.form.link.auto_link.label"),
|
|
182
|
+
"label-placement": "right",
|
|
183
|
+
sublabel: e(u)("menu.catalog.form.link.auto_link.sublabel"),
|
|
184
|
+
"onUpdate:modelValue": l[2] || (l[2] = (s) => t.value.orderFrom = s ? e(x.F_ORDER_FROM).enum.ALL : e(x.F_ORDER_FROM).enum.NONE)
|
|
185
|
+
}, null, 8, ["model-value", "label", "sublabel"]),
|
|
186
|
+
t.value.orderFrom !== e(x.F_ORDER_FROM).enum.NONE ? (c(), C(U, {
|
|
187
|
+
key: 0,
|
|
188
|
+
class: "ml-[60px]",
|
|
189
|
+
items: [
|
|
190
|
+
{
|
|
191
|
+
label: e(u)("menu.catalog.form.link.options.all"),
|
|
192
|
+
value: e(x.F_ORDER_FROM).enum.ALL
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: e(u)("menu.catalog.form.link.options.pos_only"),
|
|
196
|
+
value: e(x.F_ORDER_FROM).enum.POS_ONLY
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"model-value": t.value.orderFrom,
|
|
200
|
+
"onUpdate:modelValue": l[3] || (l[3] = (s) => t.value.orderFrom = s)
|
|
201
|
+
}, null, 8, ["items", "model-value"])) : I("", !0)
|
|
202
|
+
]),
|
|
203
|
+
_: 1
|
|
204
|
+
}, 8, ["label"])) : I("", !0),
|
|
205
|
+
A.value ? (c(), C(W, {
|
|
206
|
+
key: 1,
|
|
207
|
+
label: e(u)("menu.catalog.form.markup.title")
|
|
208
|
+
}, {
|
|
209
|
+
default: m(() => [
|
|
210
|
+
r(h, {
|
|
211
|
+
"model-value": !!t.value.markupOptions,
|
|
212
|
+
label: e(u)("menu.catalog.form.markup.auto.label"),
|
|
213
|
+
"label-placement": "right",
|
|
214
|
+
sublabel: e(u)("menu.catalog.form.markup.auto.sublabel"),
|
|
215
|
+
"onUpdate:modelValue": l[4] || (l[4] = (s) => t.value.markupOptions = s ? [] : null)
|
|
216
|
+
}, null, 8, ["model-value", "label", "sublabel"]),
|
|
217
|
+
d("div", Ne, [
|
|
218
|
+
r(ne, {
|
|
219
|
+
categories: e(M).categories,
|
|
220
|
+
items: e(M).items,
|
|
221
|
+
action: "add",
|
|
222
|
+
"onUpdate:modelValue": l[5] || (l[5] = (s) => s && (t.value.markupOptions = [...t.value.markupOptions ?? [], s]))
|
|
223
|
+
}, {
|
|
224
|
+
default: m(({ trigger: s }) => [
|
|
225
|
+
r(O, {
|
|
226
|
+
"text-color": e(X).ColorPrimary,
|
|
227
|
+
"border-color": e(X).ColorPrimary,
|
|
228
|
+
variant: e(j).Secondary,
|
|
229
|
+
label: e(u)("menu.catalog.form.markup.add"),
|
|
230
|
+
"prepend-icon": "add",
|
|
231
|
+
onClick: s
|
|
232
|
+
}, null, 8, ["text-color", "border-color", "variant", "label", "onClick"])
|
|
233
|
+
]),
|
|
234
|
+
_: 1
|
|
235
|
+
}, 8, ["categories", "items"]),
|
|
236
|
+
(c(!0), g(V, null, $(t.value.markupOptions, (s, F) => (c(), C(ne, {
|
|
237
|
+
key: F,
|
|
238
|
+
categories: e(M).categories,
|
|
239
|
+
items: e(M).items,
|
|
240
|
+
"model-value": s,
|
|
241
|
+
action: "update",
|
|
242
|
+
"onUpdate:modelValue": (_) => _ && K(F, _)
|
|
243
|
+
}, {
|
|
244
|
+
default: m(({ trigger: _ }) => [
|
|
245
|
+
r(n, {
|
|
246
|
+
id: JSON.stringify(s),
|
|
247
|
+
class: "py-12 px-16 cursor-pointer",
|
|
248
|
+
variant: "outlined",
|
|
249
|
+
onClick: _
|
|
250
|
+
}, {
|
|
251
|
+
default: m(() => [
|
|
252
|
+
d("div", Te, [
|
|
253
|
+
d("div", Ee, [
|
|
254
|
+
r(N, { class: "text-fm-color-typo-info bg-fm-color-system-info-100 font-semibold" }, {
|
|
255
|
+
default: m(() => [
|
|
256
|
+
be(b(e(u)("menu.catalog.form.markup.percentage", { value: s.percentage })), 1)
|
|
257
|
+
]),
|
|
258
|
+
_: 2
|
|
259
|
+
}, 1024),
|
|
260
|
+
d("p", Le, b(e(u)("menu.catalog.form.markup.config", { number: F + 1 })), 1),
|
|
261
|
+
d("p", Re, b(s.includeItems ? e(u)("menu.catalog.form.markup.products", {
|
|
262
|
+
count: s.includeItems.length
|
|
263
|
+
}) : e(u)("menu.catalog.form.markup.all_items")), 1)
|
|
264
|
+
]),
|
|
265
|
+
r(O, {
|
|
266
|
+
variant: e(j).Tertiary,
|
|
267
|
+
"prepend-icon": "delete",
|
|
268
|
+
onClick: (Z) => Y(F)
|
|
269
|
+
}, null, 8, ["variant", "onClick"])
|
|
270
|
+
])
|
|
271
|
+
]),
|
|
272
|
+
_: 2
|
|
273
|
+
}, 1032, ["id", "onClick"])
|
|
274
|
+
]),
|
|
275
|
+
_: 2
|
|
276
|
+
}, 1032, ["categories", "items", "model-value", "onUpdate:modelValue"]))), 128))
|
|
277
|
+
])
|
|
278
|
+
]),
|
|
279
|
+
_: 1
|
|
280
|
+
}, 8, ["label"])) : I("", !0)
|
|
281
|
+
])
|
|
282
|
+
]),
|
|
283
|
+
_: 1
|
|
284
|
+
}, 8, ["modelValue", "is-container", "is-container-props"])
|
|
285
|
+
], 64);
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}), se = we, Ie = {
|
|
289
|
+
key: 1,
|
|
290
|
+
class: "flex flex-col overflow-scroll divide-y divide-fm-color-neutral-gray-100"
|
|
291
|
+
}, Pe = ["onClick"], Be = {
|
|
292
|
+
class: "flex-1 space-y-4"
|
|
293
|
+
}, ze = {
|
|
294
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
295
|
+
}, Ge = {
|
|
296
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
297
|
+
}, Ke = {
|
|
298
|
+
class: "fm-typo-en-body-lg-600"
|
|
299
|
+
}, Ye = {
|
|
300
|
+
class: "fm-typo-en-title-md-600"
|
|
301
|
+
}, je = {
|
|
302
|
+
class: "space-y-24"
|
|
303
|
+
}, He = {
|
|
304
|
+
class: "space-y-8 flex-1"
|
|
305
|
+
}, qe = {
|
|
306
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
307
|
+
}, Je = {
|
|
308
|
+
class: "fm-typo-cn-body-lg-600"
|
|
309
|
+
}, Qe = {
|
|
310
|
+
class: "space-y-8 flex-1"
|
|
311
|
+
}, We = {
|
|
312
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
313
|
+
}, Xe = "main", ia = /* @__PURE__ */ ue({
|
|
314
|
+
__name: "Catalog",
|
|
315
|
+
setup(ge) {
|
|
316
|
+
const k = ie(), v = re(), B = fe(), A = me(B), M = De(), z = ce(A), G = Me(), {
|
|
317
|
+
t
|
|
318
|
+
} = de();
|
|
319
|
+
function H(l, a) {
|
|
320
|
+
var h, U, O, N;
|
|
321
|
+
const o = k.restaurants.value.find(({
|
|
322
|
+
_id: n
|
|
323
|
+
}) => n === a._id), f = [...a.linkedDeliveryCatalogs.map((n) => ({
|
|
324
|
+
label: `Delivery (${n.name})`,
|
|
325
|
+
selector: n.catalog
|
|
326
|
+
})), {
|
|
327
|
+
label: "Delivery (FoodPanda integration)",
|
|
328
|
+
selector: (h = o == null ? void 0 : o.foodpandaDelivery) == null ? void 0 : h.catalogId
|
|
329
|
+
}, {
|
|
330
|
+
label: "Delivery (GrabFood integration)",
|
|
331
|
+
selector: (U = o == null ? void 0 : o.grabfoodDelivery) == null ? void 0 : U.catalogId
|
|
332
|
+
}, {
|
|
333
|
+
label: "Delivery (ShopeeFood integration)",
|
|
334
|
+
selector: (O = o == null ? void 0 : o.shopeefoodDelivery) == null ? void 0 : O.catalogId
|
|
335
|
+
}];
|
|
336
|
+
return [{
|
|
337
|
+
label: "Dine-in",
|
|
338
|
+
selector: a.catalogId
|
|
339
|
+
}, {
|
|
340
|
+
label: "Takeaway",
|
|
341
|
+
selector: a.takeawayCatalog || a.catalogId
|
|
342
|
+
}, {
|
|
343
|
+
label: "Pickup",
|
|
344
|
+
selector: a.pickupCatalog || null
|
|
345
|
+
}, {
|
|
346
|
+
label: "Additional",
|
|
347
|
+
selector: a.additionalCatalogs
|
|
348
|
+
}, {
|
|
349
|
+
label: "Delivery (In house)",
|
|
350
|
+
selector: a.inHouseDelivery
|
|
351
|
+
}, {
|
|
352
|
+
label: "Delivery (Feedme express)",
|
|
353
|
+
selector: (N = o == null ? void 0 : o.feedmeDelivery) == null ? void 0 : N.catalogId
|
|
354
|
+
}, ...le(f, {
|
|
355
|
+
selector: "label"
|
|
356
|
+
})].filter((n) => l ? Array.isArray(n.selector) ? n.selector.includes(l) : n.selector === l : n.selector === null).map((n) => n.label);
|
|
357
|
+
}
|
|
358
|
+
function w(l) {
|
|
359
|
+
return v.state.restaurants.map((a) => ({
|
|
360
|
+
name: a.name,
|
|
361
|
+
usage: H(l, a)
|
|
362
|
+
})).filter((a) => a.usage.length > 0);
|
|
363
|
+
}
|
|
364
|
+
const S = P(!1), D = R(() => [...v.catalogs.map((a) => ({
|
|
365
|
+
id: a._id,
|
|
366
|
+
name: a.name,
|
|
367
|
+
taxes: a.inclusiveTaxes || null,
|
|
368
|
+
doc: a,
|
|
369
|
+
disableDelete: !1,
|
|
370
|
+
defaultOrderFrom: a.defaultOrderFrom
|
|
371
|
+
}))].map((a) => {
|
|
372
|
+
var y;
|
|
373
|
+
const o = w(((y = a.doc) == null ? void 0 : y._id) || null), f = a.doc ? Fe.getSellingItem(a.doc, v.state.menu) : v.state.menu.modules.item;
|
|
374
|
+
return {
|
|
375
|
+
...a,
|
|
376
|
+
taxMode: a.taxes ? "Manual" : "Automatic",
|
|
377
|
+
autoLink: a.defaultOrderFrom !== x.F_ORDER_FROM.enum.NONE ? "Activated" : "Deactivated",
|
|
378
|
+
restaurants: le(o, {
|
|
379
|
+
selector: "name"
|
|
380
|
+
}),
|
|
381
|
+
totalProducts: f.length,
|
|
382
|
+
disableDelete: a.disableDelete
|
|
383
|
+
};
|
|
384
|
+
})), K = (l) => {
|
|
385
|
+
v.selectCatalog(l === Xe ? null : l), G.push({
|
|
386
|
+
name: oe.EDIT_CATALOG_PRODUCT,
|
|
387
|
+
params: {
|
|
388
|
+
id: l
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
async function Y(l) {
|
|
393
|
+
const a = v.state.restaurants.filter((o) => [...o.additionalCatalogs, o.inHouseDelivery, ...o.linkedDeliveryCatalogs.map((f) => f.catalog), o.pickupCatalog, o.takeawayCatalog, o.catalogId].includes(l.id)).map((o) => o.name);
|
|
394
|
+
a.length > 0 ? B.open({
|
|
395
|
+
type: "error",
|
|
396
|
+
message: t("menu.catalog.dialogs.remove.error", {
|
|
397
|
+
restaurants: a
|
|
398
|
+
})
|
|
399
|
+
}) : M.open({
|
|
400
|
+
title: t("menu.catalog.dialogs.remove.title"),
|
|
401
|
+
message: t("menu.catalog.dialogs.remove.message", {
|
|
402
|
+
name: l.name
|
|
403
|
+
}),
|
|
404
|
+
primaryActions: {
|
|
405
|
+
text: t("menu.common.actions.remove"),
|
|
406
|
+
close: !0,
|
|
407
|
+
variant: j.Destructive
|
|
408
|
+
},
|
|
409
|
+
secondaryActions: {
|
|
410
|
+
text: t("menu.common.actions.cancel"),
|
|
411
|
+
close: !0
|
|
412
|
+
}
|
|
413
|
+
}).onPrimary(async () => {
|
|
414
|
+
await z.updateMenu({
|
|
415
|
+
module: x.F_MENU_MODULE_V4_KEY.enum.catalog,
|
|
416
|
+
operation: pe.F_OPERATION_TYPE.delete,
|
|
417
|
+
data: l.id
|
|
418
|
+
}, l.name, !0), v.selectCatalog(null), await G.push({
|
|
419
|
+
name: oe.CATALOG
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
const q = P([{
|
|
424
|
+
accessorKey: "name",
|
|
425
|
+
header: () => t("menu.catalog.table.columns.title"),
|
|
426
|
+
enableSorting: !1
|
|
427
|
+
}, {
|
|
428
|
+
accessorKey: "taxMode",
|
|
429
|
+
header: () => t("menu.catalog.table.columns.tax_calculation"),
|
|
430
|
+
enableSorting: !1
|
|
431
|
+
}, {
|
|
432
|
+
accessorKey: "autoLink",
|
|
433
|
+
header: () => t("menu.catalog.table.columns.auto_link"),
|
|
434
|
+
enableSorting: !1,
|
|
435
|
+
cell: (l) => {
|
|
436
|
+
const a = l.row.original;
|
|
437
|
+
return ee("div", {
|
|
438
|
+
class: "flex justify-between"
|
|
439
|
+
}, [a.autoLink, ee(_e.FmIcon, {
|
|
440
|
+
name: "delete",
|
|
441
|
+
outline: !0,
|
|
442
|
+
color: "neutral-gray-400",
|
|
443
|
+
onClick: ae(async () => {
|
|
444
|
+
await Y(a);
|
|
445
|
+
}, ["stop", "prevent"])
|
|
446
|
+
})]);
|
|
447
|
+
}
|
|
448
|
+
}]), u = Ve(), i = R(() => u.breakpoints.value.xs);
|
|
449
|
+
return (l, a) => {
|
|
450
|
+
const o = p("fm-button"), f = p("FmTable"), y = p("FmButton"), h = p("fm-card-header"), U = p("fm-card-section"), O = p("fm-card"), N = p("fm-side-sheet");
|
|
451
|
+
return c(), C(Ce, {
|
|
452
|
+
heading: "Catalog"
|
|
453
|
+
}, {
|
|
454
|
+
"append-heading": m(() => [D.value.length > 0 ? (c(), C(e(se), {
|
|
455
|
+
key: 0
|
|
456
|
+
}, {
|
|
457
|
+
default: m(({
|
|
458
|
+
trigger: n
|
|
459
|
+
}) => [d("div", {
|
|
460
|
+
class: J([["xs:fixed xs:z-10 xs:bottom-[68px] xs:right-16"], "ml-auto xs:ml-0 flex flex-row gap-8"])
|
|
461
|
+
}, [r(o, {
|
|
462
|
+
label: e(t)("menu.catalog.actions.view_usage"),
|
|
463
|
+
onClick: a[0] || (a[0] = (T) => S.value = !0),
|
|
464
|
+
variant: "secondary"
|
|
465
|
+
}, null, 8, ["label"]), r(o, {
|
|
466
|
+
label: e(t)("menu.catalog.actions.add"),
|
|
467
|
+
"prepend-icon": "add",
|
|
468
|
+
onClick: n
|
|
469
|
+
}, null, 8, ["label", "onClick"])])]),
|
|
470
|
+
_: 1
|
|
471
|
+
})) : I("", !0)]),
|
|
472
|
+
default: m(() => [D.value.length === 0 ? (c(), C(e(he), {
|
|
473
|
+
key: 0,
|
|
474
|
+
subtitle: e(t)("menu.catalog.empty.subtitle"),
|
|
475
|
+
title: e(t)("menu.catalog.empty.title")
|
|
476
|
+
}, {
|
|
477
|
+
action: m(() => [r(e(se), null, {
|
|
478
|
+
default: m(({
|
|
479
|
+
trigger: n
|
|
480
|
+
}) => [r(o, {
|
|
481
|
+
label: e(t)("menu.catalog.actions.add"),
|
|
482
|
+
"prepend-icon": "add",
|
|
483
|
+
onClick: n
|
|
484
|
+
}, null, 8, ["label", "onClick"])]),
|
|
485
|
+
_: 1
|
|
486
|
+
})]),
|
|
487
|
+
_: 1
|
|
488
|
+
}, 8, ["subtitle", "title"])) : (c(), g(V, {
|
|
489
|
+
key: 1
|
|
490
|
+
}, [i.value ? (c(), g("div", Ie, [(c(!0), g(V, null, $(D.value, (n) => (c(), g("div", {
|
|
491
|
+
key: n.id,
|
|
492
|
+
class: "flex flex-row py-12 px-16",
|
|
493
|
+
onClick: (T) => K(n.id)
|
|
494
|
+
}, [d("div", Be, [d("p", ze, " Tax calculation: " + b(n.taxMode), 1), d("p", Ge, " Auto link product: " + b(n.autoLink), 1), d("p", Ke, b(n.name), 1)]), r(y, {
|
|
495
|
+
"text-color": e(X).NeutralGray400,
|
|
496
|
+
variant: e(j).Tertiary,
|
|
497
|
+
"prepend-icon": "delete",
|
|
498
|
+
onClick: ae((T) => Y(n), ["stop"])
|
|
499
|
+
}, null, 8, ["text-color", "variant", "onClick"])], 8, Pe))), 128))])) : (c(), C(Oe, {
|
|
500
|
+
key: 0
|
|
501
|
+
}, {
|
|
502
|
+
default: m(() => [r(f, {
|
|
503
|
+
"column-defs": q.value,
|
|
504
|
+
"row-data": D.value,
|
|
505
|
+
"page-size": D.value.length,
|
|
506
|
+
"hide-footer": !0,
|
|
507
|
+
"shrink-at": !1,
|
|
508
|
+
onRowClick: a[1] || (a[1] = (n) => K(n.original.id))
|
|
509
|
+
}, null, 8, ["column-defs", "row-data", "page-size"])]),
|
|
510
|
+
_: 1
|
|
511
|
+
})), r(N, {
|
|
512
|
+
modelValue: S.value,
|
|
513
|
+
"onUpdate:modelValue": a[2] || (a[2] = (n) => S.value = n),
|
|
514
|
+
"max-width": 560,
|
|
515
|
+
"z-index": 80
|
|
516
|
+
}, {
|
|
517
|
+
"side-sheet-header": m(() => [d("p", Ye, b(e(t)("menu.catalog.usage.title")), 1)]),
|
|
518
|
+
default: m(() => [d("div", je, [(c(!0), g(V, null, $(D.value, (n, T) => (c(), C(O, {
|
|
519
|
+
key: T,
|
|
520
|
+
class: "relative",
|
|
521
|
+
variant: "outlined"
|
|
522
|
+
}, {
|
|
523
|
+
default: m(() => [r(h, {
|
|
524
|
+
subtitle: e(t)("menu.catalog.usage.tax_calculation") + `: ${n.taxMode} (${n.totalProducts} ${e(t)("menu.catalog.usage.products", {
|
|
525
|
+
count: n.totalProducts
|
|
526
|
+
})})`,
|
|
527
|
+
title: n.name
|
|
528
|
+
}, null, 8, ["subtitle", "title"]), r(U, {
|
|
529
|
+
class: J(["pt-8 space-y-12", "divide-y divide-fm-color-neutral-gray-100"])
|
|
530
|
+
}, {
|
|
531
|
+
default: m(() => [(c(!0), g(V, null, $(n.restaurants, (s, F) => (c(), g("div", {
|
|
532
|
+
key: F,
|
|
533
|
+
class: J(["flex xs:flex-col", "space-x-24 xs:space-x-0", "xs:space-y-24", "pt-12 first:pt-0"])
|
|
534
|
+
}, [d("div", He, [d("p", qe, b(e(t)("menu.catalog.usage.restaurant")), 1), d("p", Je, b(s.name), 1)]), d("div", Qe, [d("p", We, b(e(t)("menu.catalog.usage.usage")), 1), (c(!0), g(V, null, $(s.usage, (_) => (c(), g("p", {
|
|
535
|
+
key: _,
|
|
536
|
+
class: "fm-typo-cn-body-lg-600"
|
|
537
|
+
}, b(_), 1))), 128))])]))), 128))]),
|
|
538
|
+
_: 2
|
|
539
|
+
}, 1024)]),
|
|
540
|
+
_: 2
|
|
541
|
+
}, 1024))), 128))])]),
|
|
542
|
+
_: 1
|
|
543
|
+
}, 8, ["modelValue"])], 64))]),
|
|
544
|
+
_: 1
|
|
545
|
+
});
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
export {
|
|
550
|
+
ia as default
|
|
551
|
+
};
|