@feedmepos/mf-menu 0.23.2 → 0.23.3-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.
Files changed (52) hide show
  1. package/dist/{App-CtLAt0Pj.js → App-CnjUI7fG.js} +4 -4
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-Dt6JdqAP.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DhOeWCP-.js} +2 -2
  3. package/dist/Catalog-D1AFR9Mj.js +635 -0
  4. package/dist/{Category-Cy1pAZi5.js → Category-RvOrSG6Q.js} +7 -7
  5. package/dist/{CookingGuide-D6CjH2B9.js → CookingGuide-BerhgXBx.js} +4 -4
  6. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-DI5Ff58u.js → FormSection.vue_vue_type_script_setup_true_lang-BOZOuk1m.js} +2 -2
  7. package/dist/{Group-DI-sJopf.js → Group-CWevukSr.js} +3 -3
  8. package/dist/{Group-BcD81S_b.js → Group-vzgQF-0Z.js} +1 -1
  9. package/dist/{Group.vue_vue_type_script_setup_true_lang-Bdbz3lVM.js → Group.vue_vue_type_script_setup_true_lang-CJuMeiCX.js} +7 -7
  10. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CccX042y.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Blv5bvM0.js} +2 -2
  11. package/dist/{Ingredient-Dd6CgY7R.js → Ingredient-78hpHg-b.js} +4 -4
  12. package/dist/{PrintRoute-Gu9ggGJl.js → PrintRoute-Dzt9vZvp.js} +4 -4
  13. package/dist/{Product-DwlqQqij.js → Product-C2FnSehT.js} +1 -1
  14. package/dist/{Product.vue_vue_type_script_setup_true_lang-qOPnfNju.js → Product.vue_vue_type_script_setup_true_lang-guqMOkiD.js} +11 -11
  15. package/dist/{Products-Ch7QPzim.js → Products-DpgKp97W.js} +8 -8
  16. package/dist/{Publish-DGkKxaGP.js → Publish-fnMMpQ7H.js} +3 -3
  17. package/dist/{Recipe-Dv1VBgCw.js → Recipe-B-j7-QnD.js} +5 -5
  18. package/dist/{Scheduler-DAQ6tM7V.js → Scheduler-BW-2lfgU.js} +3 -3
  19. package/dist/{SchedulerSelector.vue_vue_type_script_setup_true_lang-C6RS7nRM.js → SchedulerSelector.vue_vue_type_script_setup_true_lang-BQHWiwDS.js} +1 -1
  20. package/dist/{ServingSequence-DskZmjqq.js → ServingSequence-D8eZpPLg.js} +3 -3
  21. package/dist/{Setting-DY1YyBnT.js → Setting-BOt4__e1.js} +1 -1
  22. package/dist/{Setting.vue_vue_type_script_setup_true_lang-CbRS2tQy.js → Setting.vue_vue_type_script_setup_true_lang-CWA2rt6o.js} +4 -4
  23. package/dist/{Takeaway-B8_YdS_k.js → Takeaway-CIjMjgKx.js} +4 -4
  24. package/dist/{Takeaway-C6PK2aIw.js → Takeaway-SYsm7Cp_.js} +1 -1
  25. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-CB5jd8Ql.js → Takeaway.vue_vue_type_script_setup_true_lang-CoApNKg-.js} +5 -5
  26. package/dist/{TaxSetting-BmfoFZQw.js → TaxSetting-XnHpzkTI.js} +4 -4
  27. package/dist/{Unit-C-q56JN4.js → Unit-DH3pzNZH.js} +2 -2
  28. package/dist/{Variant-Be56RPbB.js → Variant-BhwGnbQE.js} +3 -3
  29. package/dist/{_id_-CkN0c8bi.js → _id_-DGhgPHqr.js} +7 -7
  30. package/dist/{app-C0Qjz2mB.js → app-Dq995l4S.js} +24 -22
  31. package/dist/{app-ClCHxUkg.js → app-DuYUgN5u.js} +1 -1
  32. package/dist/app.js +1 -1
  33. package/dist/assets/{linked-status-BOPtM1OH.js → linked-status-rkOvIS_h.js} +11 -11
  34. package/dist/assets/{validate-menu-BVwFA5hB.js → validate-menu-ByNFmW1w.js} +11 -11
  35. package/dist/{catalog-28fm4sSB.js → catalog-D_2n7SMn.js} +1 -1
  36. package/dist/{catalog-D9_qrmoa.js → catalog-NWEx_wEw.js} +7884 -7884
  37. package/dist/{category-Yo2fjEvd.js → category-CaTqoYcx.js} +1 -1
  38. package/dist/{currency-P9kA-zjm.js → currency-DZc9dV9Y.js} +1 -1
  39. package/dist/{index-CikbYB8y.js → index-BR7fDeTR.js} +4 -4
  40. package/dist/{index-C349SO0P.js → index-DXcMe0cE.js} +472 -472
  41. package/dist/{item-DanW75sm.js → item-DjcB8bx8.js} +1813 -1777
  42. package/dist/{lodash-Cjmzbb5Y.js → lodash-CLTRdhVr.js} +1 -1
  43. package/dist/{menu-Conzaa85.js → menu-Bn7QQV9T.js} +1 -1
  44. package/dist/{menu-CihLJQ-f.js → menu-DS9YkIAw.js} +6519 -6519
  45. package/dist/remy-Brqygf9M.js +37 -0
  46. package/dist/{scheduler-icgLBelj.js → scheduler-DRjFaArt.js} +4 -4
  47. package/dist/{takeaway-QhZKXBsd.js → takeaway-no516z37.js} +5 -5
  48. package/dist/{toExcel-CVBJFP8C.js → toExcel-DAYabTNa.js} +2 -2
  49. package/dist/{unit-wWFfmJwk.js → unit-U3sWE8pt.js} +2 -2
  50. package/package.json +3 -3
  51. package/dist/Catalog-B2maPhri.js +0 -589
  52. package/dist/remy-DVV8JZCf.js +0 -37
@@ -1,10 +1,10 @@
1
1
  import { defineComponent, ref, watchEffect, computed, watch, openBlock, createElementBlock, normalizeStyle, onBeforeUnmount, createBlock, unref, onMounted, resolveComponent, withDirectives, createElementVNode, createVNode, vShow, Fragment, createCommentVNode, normalizeClass } from "vue";
2
2
  import { FeedMeAuth, useCoreStore } from "@feedmepos/mf-common";
3
- import { c as commonjsGlobal, g as getDefaultExportFromCjs, r as registerVersion, L as Logger, a as getExperimentalSetting, i as isMobileCordova, b as isReactNative, _ as _isFirebaseServerApp, d as _registerComponent, C as Component, e as _getProvider, f as getDefaultEmulatorHost, h as getApp, j as isBrowserExtension, S as SDK_VERSION, k as getModularInstance, E as ErrorFactory, l as createSubscribe, m as deepEqual, n as LogLevel, o as getUA, F as FirebaseError, p as base64Decode, q as isIE, s as querystring, t as isEmpty, u as getApps, v as initializeApp, w as getStorage, x as useMenuStore, y as coreDart, z as menu } from "./menu-CihLJQ-f.js";
4
- import { R as Remy, i as init } from "./remy-DVV8JZCf.js";
3
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs, r as registerVersion, L as Logger, a as getExperimentalSetting, i as isMobileCordova, b as isReactNative, _ as _isFirebaseServerApp, d as _registerComponent, C as Component, e as _getProvider, f as getDefaultEmulatorHost, h as getApp, j as isBrowserExtension, S as SDK_VERSION, k as getModularInstance, E as ErrorFactory, l as createSubscribe, m as deepEqual, n as LogLevel, o as getUA, F as FirebaseError, p as base64Decode, q as isIE, s as querystring, t as isEmpty, u as getApps, v as initializeApp, w as getStorage, x as useMenuStore, y as coreDart, z as menu } from "./menu-DS9YkIAw.js";
4
+ import { R as Remy, i as init } from "./remy-Brqygf9M.js";
5
5
  import { FmButtonColorThemeVariant, FmButtonVariant } from "@feedmepos/ui-library";
6
6
  import { _ as _export_sfc$1 } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- import { u as useAppStore } from "./app-ClCHxUkg.js";
7
+ import { u as useAppStore } from "./app-DuYUgN5u.js";
8
8
  const v = "4.8.0", meta = {
9
9
  g: "LottieFiles AE ",
10
10
  a: "",
@@ -23208,7 +23208,7 @@ registerAuth(
23208
23208
  "Browser"
23209
23209
  /* ClientPlatform.BROWSER */
23210
23210
  );
23211
- var define_appEndpoint_default = { mainBackend: "https://portal-v2.feedmeapi.com", menuBackend: "https://menu-v4.feedmeapi.com", remy: "https://remy.feedmeapi.com/v1", firebase: { apiKey: "AIzaSyA_isPR1-9bX7UmRiJIhsIRNNwdn6DdmW4", authDomain: "feedme-253402.firebaseapp.com", databaseURL: "https://feedme-253402.firebaseio.com", projectId: "feedme-253402", storageBucket: "image.feedme.cc", messagingSenderId: "128512026847", appId: "1:128512026847:web:7c5c8ab7e8b90502dc616a", measurementId: "G-LTKS7N2HQS" }, gtm: { id: "GTM-WR8XHXLH", serverUrl: "https://server-side-tagging-zzez732dna-as.a.run.app", env: "production", serverMeasurementId: "G-2MP52PC24R", debug: !1 } };
23211
+ var define_appEndpoint_default = { mainBackend: "https://portal-v2-dev.feedmeapi.com", menuBackend: "https://menu-v4-dev.feedmeapi.com", remy: "https://remy-dev.feedmeapi.com/v1", firebase: { apiKey: "AIzaSyAj8JdCHtP0Vc5vZobCfgoLzWxPIn0WUG4", authDomain: "feedme-dev-4c3ef.firebaseapp.com", databaseURL: "https://feedme-dev-4c3ef.firebaseio.com", projectId: "feedme-dev-4c3ef", storageBucket: "image.feedmedev.cc", messagingSenderId: "458797803788", appId: "1:458797803788:web:37f2af2926a84288f0c129", measurementId: "G-J2QG09D2Q7" }, gtm: { id: "GTM-P7Z9FMS6", serverUrl: "https://server-side-tagging-rsrq3ogsuq-as.a.run.app", env: "development", serverMeasurementId: "G-759WBZPF06", debug: !0 } };
23212
23212
  async function initFirebase() {
23213
23213
  if (getApps().length) {
23214
23214
  console.warn("mf-menu:firebase already initialized by another app");
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as K, computed as i, h as u, ref as U, resolveComponent as b, openBlock as d, createElementBlock as p, createVNode as v, withCtx as g, createElementVNode as V, createBlock as j, unref as n, createCommentVNode as C, toDisplayString as A, isRef as D, Fragment as G, renderList as H } from "vue";
2
- import { x as M, ab as O } from "./menu-CihLJQ-f.js";
2
+ import { x as M, ab as O } from "./menu-DS9YkIAw.js";
3
3
  import { u as $ } from "./createComponentProgrammatically-Npr1U60e.js";
4
4
  import { components as I, FmButtonVariant as B, FmButtonColorThemeVariant as h } from "@feedmepos/ui-library";
5
- import { _ as q, L as J } from "./FormSection.vue_vue_type_script_setup_true_lang-DI5Ff58u.js";
5
+ import { _ as q, L as J } from "./FormSection.vue_vue_type_script_setup_true_lang-BOZOuk1m.js";
6
6
  import { useI18n as Q } from "@feedmepos/mf-common";
7
7
  const W = { class: "space-y-16" }, X = { class: "flex items-center space-x-24" }, Y = {
8
8
  key: 0,
@@ -0,0 +1,635 @@
1
+ import { defineComponent as oe, ref as B, computed as T, resolveComponent as v, openBlock as d, createElementBlock as S, Fragment as P, renderSlot as ye, createVNode as n, unref as e, withCtx as p, createElementVNode as _, renderList as W, createBlock as h, createCommentVNode as z, createTextVNode as be, toDisplayString as R, h as J, withModifiers as q, normalizeClass as xe } from "vue";
2
+ import { useCoreStore as de, useI18n as ne } from "@feedmepos/mf-common";
3
+ import { G as F, x as pe, K as ge, A as fe, z as re, B as ke, H as ee, J as ve, T as ue } from "./menu-DS9YkIAw.js";
4
+ import { C as Ce } from "./catalog-D_2n7SMn.js";
5
+ import { useRouter as he } from "vue-router";
6
+ import { _ as Oe, R as ie } from "./app-Dq995l4S.js";
7
+ import { _ as Fe } from "./PageLayout.vue_vue_type_script_setup_true_lang-BJCuL4EK.js";
8
+ import { useSnackbar as _e, components as te, FmButtonColorThemeVariant as Q, FmButtonVariant as K, useDialog as Me, useBreakpoints as De } from "@feedmepos/ui-library";
9
+ import { c as Se } from "./check-C9mY6LiX.js";
10
+ import { C as L, a as I, _ as ce } from "./GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Blv5bvM0.js";
11
+ import { _ as Te } from "./FormSection.vue_vue_type_script_setup_true_lang-BOZOuk1m.js";
12
+ import { _ as ae } from "./FormItem.vue_vue_type_script_setup_true_lang-DKsxEK-8.js";
13
+ import { _ as Ve } from "./index.vue_vue_type_script_setup_true_lang-CGPDazqs.js";
14
+ import { _ as Ae } from "./TextChip.vue_vue_type_script_setup_true_lang-DoCbhCON.js";
15
+ const Ue = { class: "space-y-32" }, Ne = {
16
+ key: 0,
17
+ class: "pl-32 space-x-8"
18
+ }, Ee = { class: "pl-[60px] space-y-16" }, Re = { class: "space-x-16 flex items-center" }, $e = { class: "flex-1 space-y-4" }, we = { class: "fm-typo-en-body-lg-400" }, Le = { class: "fm-typo-en-body-md-400" }, Ie = { class: "flex gap-8 items-center justify-start" }, Be = /* @__PURE__ */ oe({
19
+ __name: "Form",
20
+ setup(X, { expose: M }) {
21
+ const m = B(!1), D = B(!1), $ = (i, s) => {
22
+ Se.isBoolean(i) ? m.value = i : m.value = !m.value, m.value && (r.value = L.fromCatalog(
23
+ s ?? re.generator.initMenuV4Catalog(),
24
+ y.value
25
+ ));
26
+ }, y = T(() => k.version === F.F_MENU_VERSION.enum.v4), k = pe(), V = de(), g = ge(fe(_e())), r = B(
27
+ L.fromCatalog(re.generator.initMenuV4Catalog(), y.value)
28
+ ), Z = T(() => k.catalogs.map((i) => i.name)), A = T({
29
+ get: () => r.value.taxSetting,
30
+ set: (i) => {
31
+ r.value.taxSetting = i;
32
+ }
33
+ }), U = T(() => {
34
+ var f, o;
35
+ if (!V.currentCountry.value) return [];
36
+ const i = ((f = r.value.taxSetting) == null ? void 0 : f.mode) === I.MANUAL ? ((o = r.value.taxSetting) == null ? void 0 : o.inclusive) ?? [] : [];
37
+ return ke.Country.getCountry(V.currentCountry.value).taxSystems.map((l) => {
38
+ const a = i.find((b) => b.systemCode === l.code);
39
+ return {
40
+ inclusive: (a == null ? void 0 : a.inclusive) || !1,
41
+ systemCode: l.code
42
+ };
43
+ });
44
+ });
45
+ function w(i) {
46
+ const s = r.value.taxSetting, f = s.mode === I.AUTO ? L.manualTax(U.value) : ee(s);
47
+ f.inclusive ?? (f.inclusive = []);
48
+ const o = f.inclusive.findIndex((l) => l.systemCode === i.systemCode);
49
+ o < 0 ? f.inclusive.push(i) : f.inclusive.splice(o, 1, i), A.value = f;
50
+ }
51
+ function G(i, s) {
52
+ const f = ee(r.value);
53
+ f.markupOptions && (f.markupOptions[i] = s, r.value = f);
54
+ }
55
+ function j(i) {
56
+ const s = ee(r.value);
57
+ s.markupOptions && (s.markupOptions.splice(i, 1), r.value = s);
58
+ }
59
+ async function Y() {
60
+ D.value = !0;
61
+ const i = {
62
+ ...r.value,
63
+ ...L.toCatalog(r.value)
64
+ };
65
+ try {
66
+ await g.updateMenu(
67
+ {
68
+ module: F.F_MENU_MODULE_V4_KEY.enum.catalog,
69
+ operation: ve.F_OPERATION_TYPE.create,
70
+ data: i
71
+ },
72
+ i.name
73
+ ), m.value = !1;
74
+ } finally {
75
+ D.value = !1;
76
+ }
77
+ }
78
+ const { t: u } = ne();
79
+ return M({ trigger: $ }), (i, s) => {
80
+ const f = v("fm-text-field"), o = v("fm-radio"), l = v("fm-radio-group"), a = v("fm-checkbox"), b = v("fm-switch"), N = v("fm-select"), x = v("fm-button"), c = v("fm-chip"), O = v("fm-card"), H = v("fm-side-sheet");
81
+ return d(), S(P, null, [
82
+ ye(i.$slots, "default", { trigger: $ }),
83
+ n(H, {
84
+ modelValue: m.value,
85
+ "onUpdate:modelValue": s[7] || (s[7] = (t) => m.value = t),
86
+ "is-container": e(te).FmForm,
87
+ "is-container-props": {
88
+ onValidationSuccess: Y,
89
+ blameFormChildOnValidationFailed: !0
90
+ },
91
+ "max-width": 560
92
+ }, {
93
+ "side-sheet-footer": p(() => [
94
+ _("div", Ie, [
95
+ n(x, {
96
+ loading: D.value,
97
+ label: e(u)("menu.common.actions.add"),
98
+ size: "lg",
99
+ type: "submit",
100
+ variant: "primary"
101
+ }, null, 8, ["loading", "label"]),
102
+ n(x, {
103
+ label: e(u)("menu.common.actions.cancel"),
104
+ size: "lg",
105
+ variant: "tertiary",
106
+ onClick: s[6] || (s[6] = () => m.value = !1)
107
+ }, null, 8, ["label"])
108
+ ])
109
+ ]),
110
+ default: p(() => [
111
+ _("div", Ue, [
112
+ n(Te, {
113
+ title: e(u)("menu.catalog.detail")
114
+ }, {
115
+ default: p(() => [
116
+ n(f, {
117
+ modelValue: r.value.name,
118
+ "onUpdate:modelValue": s[0] || (s[0] = (t) => r.value.name = t),
119
+ rules: [
120
+ (t) => !Z.value.includes(t.trim()) || e(u)("menu.catalog.validation.name_used"),
121
+ (t) => !!t || 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
+ n(ae, {
127
+ label: e(u)("menu.catalog.form.tax.title")
128
+ }, {
129
+ default: p(() => {
130
+ var t, E;
131
+ return [
132
+ n(l, {
133
+ "model-value": (t = r.value.taxSetting) == null ? void 0 : t.mode,
134
+ "onUpdate:modelValue": s[1] || (s[1] = (C) => {
135
+ C === e(I).AUTO ? A.value = e(L).autoTax() : A.value = e(L).manualTax(U.value);
136
+ })
137
+ }, {
138
+ default: p(() => [
139
+ n(o, {
140
+ value: e(I).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
+ n(o, {
146
+ value: e(I).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
+ ((E = r.value.taxSetting) == null ? void 0 : E.mode) === e(I).MANUAL ? (d(), S("div", Ne, [
154
+ (d(!0), S(P, null, W(U.value, (C) => (d(), h(a, {
155
+ key: C.systemCode,
156
+ "model-value": C.inclusive,
157
+ value: !0,
158
+ label: e(u)("menu.catalog.form.tax.inclusive", { code: C.systemCode }),
159
+ "onUpdate:modelValue": (se) => {
160
+ w({
161
+ ...C,
162
+ inclusive: se
163
+ });
164
+ }
165
+ }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))
166
+ ])) : z("", !0)
167
+ ];
168
+ }),
169
+ _: 1
170
+ }, 8, ["label"])
171
+ ]),
172
+ _: 1
173
+ }, 8, ["title"]),
174
+ y.value ? (d(), h(ae, {
175
+ key: 0,
176
+ label: e(u)("menu.catalog.form.link.title")
177
+ }, {
178
+ default: p(() => [
179
+ n(b, {
180
+ "model-value": r.value.orderFrom && r.value.orderFrom !== e(F.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": s[2] || (s[2] = (t) => r.value.orderFrom = t ? e(F.F_ORDER_FROM).enum.ALL : e(F.F_ORDER_FROM).enum.NONE)
185
+ }, null, 8, ["model-value", "label", "sublabel"]),
186
+ r.value.orderFrom !== e(F.F_ORDER_FROM).enum.NONE ? (d(), h(N, {
187
+ key: 0,
188
+ class: "ml-[60px]",
189
+ items: [
190
+ {
191
+ label: e(u)("menu.catalog.form.link.options.all"),
192
+ value: e(F.F_ORDER_FROM).enum.ALL
193
+ },
194
+ {
195
+ label: e(u)("menu.catalog.form.link.options.pos_only"),
196
+ value: e(F.F_ORDER_FROM).enum.POS_ONLY
197
+ }
198
+ ],
199
+ "model-value": r.value.orderFrom,
200
+ "onUpdate:modelValue": s[3] || (s[3] = (t) => r.value.orderFrom = t)
201
+ }, null, 8, ["items", "model-value"])) : z("", !0)
202
+ ]),
203
+ _: 1
204
+ }, 8, ["label"])) : z("", !0),
205
+ y.value ? (d(), h(ae, {
206
+ key: 1,
207
+ label: e(u)("menu.catalog.form.markup.title")
208
+ }, {
209
+ default: p(() => [
210
+ n(b, {
211
+ "model-value": !!r.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": s[4] || (s[4] = (t) => r.value.markupOptions = t ? [] : null)
216
+ }, null, 8, ["model-value", "label", "sublabel"]),
217
+ _("div", Ee, [
218
+ n(ce, {
219
+ categories: e(k).categories,
220
+ items: e(k).items,
221
+ action: "add",
222
+ "onUpdate:modelValue": s[5] || (s[5] = (t) => t && (r.value.markupOptions = [...r.value.markupOptions ?? [], t]))
223
+ }, {
224
+ default: p(({ trigger: t }) => [
225
+ n(x, {
226
+ "text-color": e(Q).ColorPrimary,
227
+ "border-color": e(Q).ColorPrimary,
228
+ variant: e(K).Secondary,
229
+ label: e(u)("menu.catalog.form.markup.add"),
230
+ "prepend-icon": "add",
231
+ onClick: t
232
+ }, null, 8, ["text-color", "border-color", "variant", "label", "onClick"])
233
+ ]),
234
+ _: 1
235
+ }, 8, ["categories", "items"]),
236
+ (d(!0), S(P, null, W(r.value.markupOptions, (t, E) => (d(), h(ce, {
237
+ key: E,
238
+ categories: e(k).categories,
239
+ items: e(k).items,
240
+ "model-value": t,
241
+ action: "update",
242
+ "onUpdate:modelValue": (C) => C && G(E, C)
243
+ }, {
244
+ default: p(({ trigger: C }) => [
245
+ n(O, {
246
+ id: JSON.stringify(t),
247
+ class: "py-12 px-16 cursor-pointer",
248
+ variant: "outlined",
249
+ onClick: C
250
+ }, {
251
+ default: p(() => [
252
+ _("div", Re, [
253
+ _("div", $e, [
254
+ n(c, { class: "text-fm-color-typo-info bg-fm-color-system-info-100 font-semibold" }, {
255
+ default: p(() => [
256
+ be(R(e(u)("menu.catalog.form.markup.percentage", { value: t.percentage })), 1)
257
+ ]),
258
+ _: 2
259
+ }, 1024),
260
+ _("p", we, R(e(u)("menu.catalog.form.markup.config", { number: E + 1 })), 1),
261
+ _("p", Le, R(t.includeItems ? e(u)("menu.catalog.form.markup.products", {
262
+ count: t.includeItems.length
263
+ }) : e(u)("menu.catalog.form.markup.all_items")), 1)
264
+ ]),
265
+ n(x, {
266
+ variant: e(K).Tertiary,
267
+ "prepend-icon": "delete",
268
+ onClick: (se) => j(E)
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"])) : z("", !0)
281
+ ])
282
+ ]),
283
+ _: 1
284
+ }, 8, ["modelValue", "is-container", "is-container-props"])
285
+ ], 64);
286
+ };
287
+ }
288
+ }), me = Be, Pe = /* @__PURE__ */ oe({
289
+ __name: "CatalogUsageTable",
290
+ props: {
291
+ catalog: {}
292
+ },
293
+ setup(X) {
294
+ const M = X, {
295
+ t: m
296
+ } = ne(), D = T(() => M.catalog.restaurants.length === 0 ? [{
297
+ name: "--",
298
+ usage: []
299
+ }] : M.catalog.restaurants), $ = [{
300
+ accessorKey: "name",
301
+ header: () => n("div", {
302
+ class: "flex flex-col"
303
+ }, [n("p", null, [M.catalog.name]), n("p", {
304
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400"
305
+ }, [m("menu.catalog.usage.tax_calculation") + `: ${M.catalog.taxMode}`])]),
306
+ cell: ({
307
+ row: y
308
+ }) => n("div", {
309
+ class: "space-y-4"
310
+ }, [n("p", null, [y.original.name]), n("p", {
311
+ class: "text-fm-color-typo-secondary"
312
+ }, [y.original.id])]),
313
+ enableSorting: !1,
314
+ meta: {
315
+ headerClass: "px-16 py-4"
316
+ }
317
+ }, {
318
+ header: () => n("div", {
319
+ class: "w-full flex justify-between"
320
+ }, [n("p", null, [m("menu.catalog.usage.usage")]), n(Ae, {
321
+ label: `${m("menu.catalog.usage.products", {
322
+ count: M.catalog.totalProducts
323
+ })}`,
324
+ variant: "info",
325
+ class: "px-8 py-4"
326
+ }, null)]),
327
+ accessorKey: "usage",
328
+ cell: ({
329
+ row: y
330
+ }) => {
331
+ const k = y.original.usage.join(", ") || "--";
332
+ return n("p", {
333
+ class: "flex py-8"
334
+ }, [k]);
335
+ },
336
+ enableSorting: !1,
337
+ meta: {
338
+ headerClass: "px-16 py-4"
339
+ }
340
+ }];
341
+ return (y, k) => {
342
+ const V = v("FmTable");
343
+ return d(), h(V, {
344
+ "column-defs": $,
345
+ "row-data": D.value,
346
+ "page-size": D.value.length,
347
+ "hide-footer": !0,
348
+ "shrink-at": !1
349
+ }, null, 8, ["row-data", "page-size"]);
350
+ };
351
+ }
352
+ }), ze = {
353
+ key: 1,
354
+ class: "flex flex-col overflow-scroll divide-y divide-fm-color-neutral-gray-100"
355
+ }, Ke = ["onClick"], Ge = {
356
+ class: "flex-1 space-y-4"
357
+ }, je = {
358
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
359
+ }, Ye = {
360
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
361
+ }, He = {
362
+ class: "fm-typo-en-body-lg-600"
363
+ }, Je = {
364
+ class: "flex flex-row"
365
+ }, qe = {
366
+ class: "fm-typo-en-title-md-600"
367
+ }, We = {
368
+ class: "space-y-24"
369
+ }, le = "main", ma = /* @__PURE__ */ oe({
370
+ __name: "Catalog",
371
+ setup(X) {
372
+ const M = de(), m = pe(), D = _e(), $ = fe(D), y = Me(), k = ge($), V = he(), {
373
+ t: g
374
+ } = ne();
375
+ function r(o, l) {
376
+ var x, c, O, H;
377
+ const a = M.restaurants.value.find(({
378
+ _id: t
379
+ }) => t === l._id), b = [...l.linkedDeliveryCatalogs.map((t) => ({
380
+ label: `Delivery (${t.name})`,
381
+ selector: t.catalog
382
+ })), {
383
+ label: "Delivery (FoodPanda integration)",
384
+ selector: (x = a == null ? void 0 : a.foodpandaDelivery) == null ? void 0 : x.catalogId
385
+ }, {
386
+ label: "Delivery (GrabFood integration)",
387
+ selector: (c = a == null ? void 0 : a.grabfoodDelivery) == null ? void 0 : c.catalogId
388
+ }, {
389
+ label: "Delivery (ShopeeFood integration)",
390
+ selector: (O = a == null ? void 0 : a.shopeefoodDelivery) == null ? void 0 : O.catalogId
391
+ }];
392
+ return [{
393
+ label: "Dine-in",
394
+ selector: l.catalogId
395
+ }, {
396
+ label: "Takeaway",
397
+ selector: l.takeawayCatalog || l.catalogId
398
+ }, {
399
+ label: "Pickup",
400
+ selector: l.pickupCatalog || null
401
+ }, {
402
+ label: "Additional",
403
+ selector: l.additionalCatalogs
404
+ }, {
405
+ label: "Delivery (In house)",
406
+ selector: l.inHouseDelivery
407
+ }, {
408
+ label: "Delivery (Feedme express)",
409
+ selector: (H = a == null ? void 0 : a.feedmeDelivery) == null ? void 0 : H.catalogId
410
+ }, ...ue(b, {
411
+ selector: "label"
412
+ })].filter((t) => o ? Array.isArray(t.selector) ? t.selector.includes(o) : t.selector === o : t.selector === null).map((t) => t.label);
413
+ }
414
+ function Z(o) {
415
+ return m.state.restaurants.map((l) => ({
416
+ id: l._id,
417
+ name: l.name,
418
+ usage: r(o, l)
419
+ })).filter((l) => l.usage.length > 0);
420
+ }
421
+ const A = B(!1), U = T(() => {
422
+ var l;
423
+ return [{
424
+ id: le,
425
+ name: g("menu.catalog.main"),
426
+ taxes: ((l = m.state.menu.masterCatalogSetting) == null ? void 0 : l.inclusiveTaxes) || null,
427
+ doc: null,
428
+ disableDelete: !0,
429
+ defaultOrderFrom: null
430
+ }, ...m.catalogs.map((a) => ({
431
+ id: a._id,
432
+ name: a.name,
433
+ taxes: a.inclusiveTaxes || null,
434
+ doc: a,
435
+ disableDelete: !1,
436
+ defaultOrderFrom: a.defaultOrderFrom
437
+ }))].map((a) => {
438
+ var x;
439
+ const b = Z(((x = a.doc) == null ? void 0 : x._id) || null), N = a.doc ? Ce.getSellingItem(a.doc, m.state.menu) : m.state.menu.modules.item;
440
+ return {
441
+ ...a,
442
+ taxMode: a.taxes ? "Manual" : "Automatic",
443
+ autoLink: a.defaultOrderFrom !== F.F_ORDER_FROM.enum.NONE ? "Activated" : "Deactivated",
444
+ restaurants: ue(b, {
445
+ selector: "name"
446
+ }),
447
+ totalProducts: N.length,
448
+ disableDelete: a.disableDelete
449
+ };
450
+ });
451
+ }), w = T(() => U.value.filter((o) => o.id !== le)), G = (o) => {
452
+ m.selectCatalog(o === le ? null : o), V.push({
453
+ name: ie.EDIT_CATALOG_PRODUCT,
454
+ params: {
455
+ id: o
456
+ }
457
+ });
458
+ }, j = B(null);
459
+ function Y(o) {
460
+ var l;
461
+ (l = j.value) == null || l.trigger(null, {
462
+ ...o.doc,
463
+ name: `${o.name} copy`
464
+ });
465
+ }
466
+ async function u(o) {
467
+ const l = m.state.restaurants.filter((a) => [...a.additionalCatalogs, a.inHouseDelivery, ...a.linkedDeliveryCatalogs.map((b) => b.catalog), a.pickupCatalog, a.takeawayCatalog, a.catalogId].includes(o.id)).map((a) => a.name);
468
+ l.length > 0 ? D.open({
469
+ type: "error",
470
+ message: g("menu.catalog.dialogs.remove.error", {
471
+ restaurants: l
472
+ })
473
+ }) : y.open({
474
+ title: g("menu.catalog.dialogs.remove.title"),
475
+ message: g("menu.catalog.dialogs.remove.message", {
476
+ name: o.name
477
+ }),
478
+ primaryActions: {
479
+ text: g("menu.common.actions.remove"),
480
+ close: !0,
481
+ variant: K.Destructive
482
+ },
483
+ secondaryActions: {
484
+ text: g("menu.common.actions.cancel"),
485
+ close: !0
486
+ }
487
+ }).onPrimary(async () => {
488
+ await k.updateMenu({
489
+ module: F.F_MENU_MODULE_V4_KEY.enum.catalog,
490
+ operation: ve.F_OPERATION_TYPE.delete,
491
+ data: o.id
492
+ }, o.name, !0), m.selectCatalog(null), await V.push({
493
+ name: ie.CATALOG
494
+ });
495
+ });
496
+ }
497
+ const i = B([{
498
+ accessorKey: "name",
499
+ header: () => g("menu.catalog.table.columns.title"),
500
+ enableSorting: !1
501
+ }, {
502
+ accessorKey: "taxMode",
503
+ header: () => g("menu.catalog.table.columns.tax_calculation"),
504
+ enableSorting: !1
505
+ }, {
506
+ accessorKey: "autoLink",
507
+ header: () => g("menu.catalog.table.columns.auto_link"),
508
+ enableSorting: !1,
509
+ cell: (o) => {
510
+ const l = o.row.original;
511
+ return J("div", {
512
+ class: "flex justify-between"
513
+ }, [l.autoLink]);
514
+ }
515
+ }, {
516
+ id: "actions",
517
+ size: 52,
518
+ meta: {
519
+ cellClass: "pl-16",
520
+ headerContentClass: "-mx-16"
521
+ },
522
+ header: "",
523
+ cell: (o) => {
524
+ const l = o.row.original;
525
+ return J("div", {
526
+ class: "flex justify-end"
527
+ }, [J(te.FmButton, {
528
+ icon: "file_copy",
529
+ disabled: !l.id,
530
+ variant: "tertiary",
531
+ textColor: "neutral-gray-400",
532
+ onClick: q(async () => {
533
+ await Y(l);
534
+ }, ["stop", "prevent"])
535
+ }), J(te.FmButton, {
536
+ icon: "delete",
537
+ disabled: !l.id,
538
+ variant: "tertiary",
539
+ textColor: "neutral-gray-400",
540
+ onClick: q(async () => {
541
+ await u(l);
542
+ }, ["stop", "prevent"])
543
+ })]);
544
+ }
545
+ }]), s = De(), f = T(() => s.breakpoints.value.xs);
546
+ return (o, l) => {
547
+ const a = v("fm-button"), b = v("FmTable"), N = v("FmButton"), x = v("fm-side-sheet");
548
+ return d(), h(Fe, {
549
+ heading: e(g)("menu.catalog.title")
550
+ }, {
551
+ "append-heading": p(() => [w.value.length > 0 ? (d(), h(e(me), {
552
+ key: 0,
553
+ ref_key: "createCatalogManagerFormRef",
554
+ ref: j
555
+ }, {
556
+ default: p(({
557
+ trigger: c
558
+ }) => [_("div", {
559
+ class: xe([["xs:fixed xs:z-10 xs:bottom-[68px] xs:right-16"], "ml-auto xs:ml-0 flex flex-row gap-8"])
560
+ }, [n(a, {
561
+ label: e(g)("menu.catalog.actions.view_usage"),
562
+ onClick: l[0] || (l[0] = (O) => A.value = !0),
563
+ variant: "secondary"
564
+ }, null, 8, ["label"]), n(a, {
565
+ label: e(g)("menu.catalog.actions.add"),
566
+ "prepend-icon": "add",
567
+ onClick: c
568
+ }, null, 8, ["label", "onClick"])])]),
569
+ _: 1
570
+ }, 512)) : z("", !0)]),
571
+ default: p(() => [U.value.length === 0 ? (d(), h(e(Ve), {
572
+ key: 0,
573
+ subtitle: e(g)("menu.catalog.empty.subtitle"),
574
+ title: e(g)("menu.catalog.empty.title")
575
+ }, {
576
+ action: p(() => [n(e(me), null, {
577
+ default: p(({
578
+ trigger: c
579
+ }) => [n(a, {
580
+ label: e(g)("menu.catalog.actions.add"),
581
+ "prepend-icon": "add",
582
+ onClick: c
583
+ }, null, 8, ["label", "onClick"])]),
584
+ _: 1
585
+ })]),
586
+ _: 1
587
+ }, 8, ["subtitle", "title"])) : (d(), S(P, {
588
+ key: 1
589
+ }, [f.value ? (d(), S("div", ze, [(d(!0), S(P, null, W(w.value, (c) => (d(), S("div", {
590
+ key: c.id,
591
+ class: "flex flex-row py-12 px-16 items-center",
592
+ onClick: (O) => G(c.id)
593
+ }, [_("div", Ge, [_("p", je, " Tax calculation: " + R(c.taxMode), 1), _("p", Ye, " Auto link product: " + R(c.autoLink), 1), _("p", He, R(c.name), 1)]), _("div", Je, [n(N, {
594
+ "text-color": e(Q).NeutralGray400,
595
+ variant: e(K).Tertiary,
596
+ "prepend-icon": "file_copy",
597
+ onClick: q((O) => Y(c), ["stop"])
598
+ }, null, 8, ["text-color", "variant", "onClick"]), n(N, {
599
+ "text-color": e(Q).NeutralGray400,
600
+ variant: e(K).Tertiary,
601
+ "prepend-icon": "delete",
602
+ onClick: q((O) => u(c), ["stop"])
603
+ }, null, 8, ["text-color", "variant", "onClick"])])], 8, Ke))), 128))])) : (d(), h(Oe, {
604
+ key: 0
605
+ }, {
606
+ default: p(() => [n(b, {
607
+ "column-defs": i.value,
608
+ "row-data": w.value,
609
+ "page-size": w.value.length,
610
+ "hide-footer": !0,
611
+ "shrink-at": !1,
612
+ onRowClick: l[1] || (l[1] = (c) => G(c.original.id))
613
+ }, null, 8, ["column-defs", "row-data", "page-size"])]),
614
+ _: 1
615
+ })), n(x, {
616
+ modelValue: A.value,
617
+ "onUpdate:modelValue": l[2] || (l[2] = (c) => A.value = c),
618
+ "max-width": 1e3,
619
+ "dismiss-away": ""
620
+ }, {
621
+ "side-sheet-header": p(() => [_("p", qe, R(e(g)("menu.catalog.usage.title")), 1)]),
622
+ default: p(() => [_("div", We, [(d(!0), S(P, null, W(U.value, (c, O) => (d(), h(Pe, {
623
+ key: O,
624
+ catalog: c
625
+ }, null, 8, ["catalog"]))), 128))])]),
626
+ _: 1
627
+ }, 8, ["modelValue"])], 64))]),
628
+ _: 1
629
+ }, 8, ["heading"]);
630
+ };
631
+ }
632
+ });
633
+ export {
634
+ ma as default
635
+ };