@feedmepos/mf-menu 0.31.40-prod → 0.31.41-prod

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 (90) hide show
  1. package/dist/{App-aWEH-ZEk.js → App-5Lzy8zHZ.js} +8 -8
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-jJyinQZl.js → ApplyProduct.vue_vue_type_script_setup_true_lang-BnKXsQH-.js} +3 -3
  3. package/dist/{Catalog-BoFfFdn8.js → Catalog-s5b8V8nw.js} +8 -9
  4. package/dist/{Category-CWYbb3Jn.js → Category-BJzScJEY.js} +4 -4
  5. package/dist/{Category-DZ45uikR.js → Category-DZ-xqIMI.js} +6 -6
  6. package/dist/{CookingGuide-BU0PRWIQ.js → CookingGuide-Bkd6GPww.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-Z5xsKDIE.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-B8tIjKOW.js} +1 -1
  8. package/dist/{Group-BMQDeqiS.js → Group-0b2Qiov3.js} +1 -1
  9. package/dist/{Group-C0T_uknK.js → Group-BOaCcKiI.js} +3 -3
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-DyfmY6F1.js → Group.vue_vue_type_script_setup_true_lang-DUlUfMAs.js} +8 -8
  11. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CouimeC4.js +399 -0
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Dl-Wvt3D.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DOvQmbrZ.js} +13 -14
  13. package/dist/{Ingredient-3lwDUQx_.js → Ingredient-ChcYUvOg.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-VLrrTkSC.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DE1HkipX.js} +2 -2
  15. package/dist/LinkProductSideSheet-BdzBGYxG.js +361 -0
  16. package/dist/MenuSetting-zAAttaoA.js +618 -0
  17. package/dist/{PrintRoute-DfJ-vUAb.js → PrintRoute-T-vuO5N8.js} +4 -4
  18. package/dist/{Product-F4PoLm9v.js → Product-B5q291VF.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-DT5gffpA.js → Product.vue_vue_type_script_setup_true_lang-DLRlT10W.js} +468 -465
  20. package/dist/{ProductInternalTools-DSGU-OqU.js → ProductInternalTools-BOlc0VUR.js} +5 -5
  21. package/dist/{Products-COzW2Z4g.js → Products-Cd4Mqhm3.js} +88 -85
  22. package/dist/{Publish-CDXVWCk2.js → Publish-SuRzt-_D.js} +3 -3
  23. package/dist/{Recipe-BZx4wrcP.js → Recipe-BKrjNs5g.js} +4 -4
  24. package/dist/{Scheduler-wHCWSeU2.js → Scheduler-DnDgImLC.js} +3 -3
  25. package/dist/{ServingSequence-BbYEhDYh.js → ServingSequence-D602bVnm.js} +3 -3
  26. package/dist/{Setting-C9Tlw1Iy.js → Setting-FMT4oBYH.js} +44 -45
  27. package/dist/{Subcategory-C8AwfrKb.js → Subcategory-CpYmjAvA.js} +4 -4
  28. package/dist/{Takeaway-t1053wg2.js → Takeaway-BXh3iuME.js} +1 -1
  29. package/dist/{Takeaway-DaEUn-yM.js → Takeaway-D4hjN5z5.js} +4 -4
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-7XycP5fU.js → Takeaway.vue_vue_type_script_setup_true_lang-By1f-FCO.js} +5 -5
  31. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-CZUwa5C_.js +440 -0
  32. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Ci6iqOry.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DfjtfcCh.js} +604 -600
  33. package/dist/{Unit-CnqptGCz.js → Unit-CsjHkV-h.js} +2 -2
  34. package/dist/{Variant-DiOYOwJs.js → Variant-Djra14ZX.js} +3 -3
  35. package/dist/{_id_-BSfU16VO.js → _id_-BXkqoCzB.js} +78 -75
  36. package/dist/{app-Ddb81PNo.js → app-CVqWWV4x.js} +278 -278
  37. package/dist/{LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js → app-CiBqmBzO.js} +2120 -2084
  38. package/dist/{app-Cou6qPF2.js → app-PhBJNss_.js} +1 -1
  39. package/dist/app.js +1 -1
  40. package/dist/apps/mf-menu/src/api/menu.d.ts +2 -1
  41. package/dist/apps/mf-menu/src/app.d.ts +144 -0
  42. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +36 -0
  43. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +9 -3
  44. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +294 -4
  45. package/dist/apps/mf-menu/src/composable/attributes.d.ts +26 -0
  46. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +40 -0
  47. package/dist/apps/mf-menu/src/helper/import-export.d.ts +285 -0
  48. package/dist/apps/mf-menu/src/helper/menu.d.ts +285 -0
  49. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +285 -0
  50. package/dist/apps/mf-menu/src/stores/menu.d.ts +293 -3
  51. package/dist/apps/mf-menu/src/utils/array.d.ts +1 -0
  52. package/dist/apps/mf-menu/src/utils/customAttributes.d.ts +12 -0
  53. package/dist/apps/mf-menu/src/views/MenuSetting/LinkProductRuleGroups.vue.d.ts +2 -0
  54. package/dist/apps/mf-menu/src/views/MenuSetting/RuleGroupSideSheet.vue.d.ts +176 -0
  55. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +166 -0
  56. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/assets/linked-status-WlVAcpRn.js +13 -0
  58. package/dist/assets/override-menu-__h4D7ac.js +13 -0
  59. package/dist/assets/validate-menu-DyPuzLRg.js +13 -0
  60. package/dist/{catalog-DSuJhsUb.js → catalog-C_TuQLxq.js} +1 -1
  61. package/dist/{catalogSetting-C3gEw9ov.js → catalogSetting-BUlJu6hG.js} +1 -1
  62. package/dist/{category-CwWq3KCE.js → category-CmVw1Kj-.js} +1 -1
  63. package/dist/{currency-g45Sh-t6.js → currency-OhOTnAqk.js} +1 -1
  64. package/dist/customAttributes-fpOfmGnw.js +180 -0
  65. package/dist/{dayjs.min-g3eN5z-V.js → dayjs.min-CDhP-7L5.js} +1 -1
  66. package/dist/{index-QsLFbxyG.js → index-BJZEWB5C.js} +4 -4
  67. package/dist/{index-BLQCYEc6.js → index-DHAYGEPp.js} +7 -8
  68. package/dist/{index-0yRUi7LL.js → index-DtwHmS38.js} +1 -1
  69. package/dist/index-N3cGc8ex.js +245 -0
  70. package/dist/{item-BvvQ9urP.js → item-BELLphR0.js} +16 -16
  71. package/dist/{jszip.min-DzdUiaR4.js → jszip.min-CZtcGb7A.js} +353 -353
  72. package/dist/{menu-QrVg2Ph7.js → menu-Csyr6W9A.js} +7 -7
  73. package/dist/{menu-DFNvhoNQ.js → menu-DS_ERmBf.js} +23355 -23206
  74. package/dist/{menuV2-Ezf_jW40.js → menuV2-DKzAZ4Ss.js} +151 -146
  75. package/dist/mf-menu.css +1 -1
  76. package/dist/{priceTier-zENsn3P_.js → priceTier-CYWS5lDS.js} +1 -1
  77. package/dist/{scheduler-BuwGSv6A.js → scheduler-DI5dXC7Y.js} +8 -8
  78. package/dist/{subcategory-O3L_zCJA.js → subcategory-D_ao-IV9.js} +2 -2
  79. package/dist/{toExcel-CpRy_4nG.js → toExcel-Cml-rkJQ.js} +2 -2
  80. package/dist/{unit-Ct_7Hfa2.js → unit-BWDp2LkV.js} +42 -41
  81. package/package.json +3 -3
  82. package/dist/FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js +0 -50
  83. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D6qro5w_.js +0 -367
  84. package/dist/LinkProductSideSheet-LDZjKX95.js +0 -297
  85. package/dist/MenuSetting-AhutsCVy.js +0 -185
  86. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-B7oLH9cP.js +0 -431
  87. package/dist/assets/linked-status-B_crHhZH.js +0 -24
  88. package/dist/assets/override-menu-BmlCEpHH.js +0 -24
  89. package/dist/assets/validate-menu-CF-psoB-.js +0 -24
  90. package/dist/index-0Q5T9VZV.js +0 -214
@@ -1,185 +0,0 @@
1
- import { defineComponent as P, computed as T, ref as F, watch as H, createVNode as n, resolveComponent as c, createBlock as V, openBlock as d, unref as e, withCtx as p, createElementVNode as _, createElementBlock as k, createCommentVNode as y, Fragment as K, renderList as q, toDisplayString as U } from "vue";
2
- import { u as J, G as Q, B as R, H as M } from "./menu-DFNvhoNQ.js";
3
- import { useI18n as W, useCoreStore as X } from "@feedmepos/mf-common";
4
- import { useSnackbar as Y, components as Z, FmButtonVariant as ee, FmButtonColorThemeVariant as te } from "@feedmepos/ui-library";
5
- import { _ as A } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
6
- import { _ as le } from "./app-Ddb81PNo.js";
7
- import { _ as ne } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
8
- import { C as b, a as m } from "./catalogSetting-C3gEw9ov.js";
9
- import { u as oe } from "./priceTier-zENsn3P_.js";
10
- const ae = {
11
- class: "py-16"
12
- }, se = {
13
- key: 0,
14
- class: "space-y-32 max-w-[750px] xs:p-16"
15
- }, ue = {
16
- key: 0,
17
- class: "pl-32 space-x-8"
18
- }, ie = {
19
- key: 1
20
- }, re = {
21
- class: "space-y-8"
22
- }, ce = {
23
- class: "flex items-center justify-between"
24
- }, me = {
25
- class: "fm-typo-en-title-md-600"
26
- }, de = {
27
- class: "text-fm-color-typo-secondary"
28
- }, ye = /* @__PURE__ */ P({
29
- __name: "MenuSetting",
30
- setup(pe) {
31
- var h;
32
- const {
33
- t
34
- } = W(), v = J(), w = X(), B = Y(), N = Q(B), u = T(() => ({
35
- lowStock: v.state.menu.lowStockThreshold,
36
- taxSetting: v.state.menu.masterCatalogSetting,
37
- priceTierSettings: v.state.menu.priceTierSettings
38
- })), x = F("conf"), I = T(() => [{
39
- label: t("menu.menu_setting.tabs.menu_configuration"),
40
- value: "conf"
41
- }, ...v.isV4 ? [{
42
- label: t("menu.menu_setting.tabs.price_group"),
43
- value: "price-group"
44
- }] : []]), i = F(b.transformTax((h = u.value.taxSetting) == null ? void 0 : h.inclusiveTaxes));
45
- H(() => u.value, (a) => {
46
- var l;
47
- i.value = b.transformTax((l = a.taxSetting) == null ? void 0 : l.inclusiveTaxes);
48
- });
49
- const S = T(() => {
50
- if (!w.currentCountry.value) return [];
51
- const a = i.value.mode === m.MANUAL ? i.value.inclusive ?? [] : [];
52
- return R.Country.getCountry(w.currentCountry.value).taxSystems.map((s) => {
53
- const r = a.find((g) => g.systemCode === s.code);
54
- return {
55
- inclusive: (r == null ? void 0 : r.inclusive) || !1,
56
- systemCode: s.code
57
- };
58
- });
59
- });
60
- function L(a) {
61
- const l = i.value, s = l.mode === m.AUTO ? b.manualTax(S.value) : M(l);
62
- s.inclusive ?? (s.inclusive = []);
63
- const r = s.inclusive.findIndex((g) => g.systemCode === a.systemCode);
64
- r < 0 ? s.inclusive.push(a) : s.inclusive.splice(r, 1, a), i.value = s;
65
- }
66
- async function O() {
67
- if (u.value.lowStock !== null && u.value.lowStock !== void 0 && !Number.isInteger(u.value.lowStock))
68
- return;
69
- const a = i.value.mode === m.AUTO ? null : M(i.value.inclusive);
70
- await N.minor(async () => {
71
- const l = u.value.lowStock === null || u.value.lowStock === void 0 || u.value.lowStock === 0;
72
- await v.updateMenuSetting({
73
- masterCatalogSetting: {
74
- inclusiveTaxes: a
75
- },
76
- lowStockThreshold: l ? null : u.value.lowStock,
77
- priceTierSettings: f.priceTiers.value
78
- });
79
- }, {
80
- successMessage: t("menu.menu_setting.fields.low_stock.updated")
81
- });
82
- }
83
- const f = oe(), z = [{
84
- header: t("menu.price_tier.settings_table.columns.name"),
85
- accessorKey: "key",
86
- enableSorting: !1
87
- }, {
88
- id: "actions",
89
- size: 50,
90
- cell: (a) => n("div", {
91
- class: "px-4 flex justify-end"
92
- }, [n(Z.FmButton, {
93
- icon: "delete",
94
- "text-color": te.NeutralGray400,
95
- variant: ee.Tertiary,
96
- onClick: () => f.deletePriceTier(a.row.original.key)
97
- }, null)])
98
- }];
99
- return (a, l) => {
100
- const s = c("FmTabs"), r = c("fm-radio"), g = c("fm-radio-group"), E = c("fm-checkbox"), $ = c("FormItem"), j = c("FmStepperField"), C = c("FmButton"), D = c("FmTable");
101
- return d(), V(ne, {
102
- heading: e(t)("menu.menu_setting.title")
103
- }, {
104
- default: p(() => [n(s, {
105
- items: I.value,
106
- modelValue: x.value,
107
- "onUpdate:modelValue": l[0] || (l[0] = (o) => x.value = o)
108
- }, null, 8, ["items", "modelValue"]), _("div", ae, [x.value === "conf" ? (d(), k("div", se, [n(A, {
109
- title: "Tax setting"
110
- }, {
111
- default: p(() => [n($, {
112
- label: e(t)("menu.setting.tax.title")
113
- }, {
114
- default: p(() => [n(g, {
115
- "model-value": i.value.mode,
116
- "onUpdate:modelValue": l[1] || (l[1] = (o) => {
117
- o === e(m).AUTO ? i.value = e(b).autoTax() : i.value = e(b).manualTax(S.value);
118
- })
119
- }, {
120
- default: p(() => [n(r, {
121
- value: e(m).AUTO,
122
- label: e(t)("menu.setting.tax.modes.auto.label"),
123
- sublabel: e(t)("menu.setting.tax.modes.auto.sublabel")
124
- }, null, 8, ["value", "label", "sublabel"]), n(r, {
125
- value: e(m).MANUAL,
126
- label: e(t)("menu.setting.tax.modes.manual.label"),
127
- sublabel: e(t)("menu.setting.tax.modes.manual.sublabel")
128
- }, null, 8, ["value", "label", "sublabel"])]),
129
- _: 1
130
- }, 8, ["model-value"]), i.value.mode === e(m).MANUAL ? (d(), k("div", ue, [(d(!0), k(K, null, q(S.value, (o) => (d(), V(E, {
131
- key: o.systemCode,
132
- "model-value": o.inclusive,
133
- value: !0,
134
- label: o.systemCode + " inclusive",
135
- "onUpdate:modelValue": (G) => {
136
- L({
137
- ...o,
138
- inclusive: G
139
- });
140
- }
141
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))])) : y("", !0)]),
142
- _: 1
143
- }, 8, ["label"])]),
144
- _: 1
145
- }), n(A, {
146
- title: e(t)("menu.menu_setting.fields.low_stock.title"),
147
- "sub-title": e(t)("menu.menu_setting.fields.low_stock.subtitle")
148
- }, {
149
- default: p(() => [n(j, {
150
- "model-value": u.value.lowStock || null,
151
- min: 0,
152
- max: 1e3,
153
- step: 1,
154
- placeholder: e(t)("menu.menu_setting.fields.low_stock.not_set"),
155
- "onUpdate:modelValue": l[2] || (l[2] = (o) => {
156
- u.value.lowStock = o;
157
- }),
158
- rules: [(o) => o === null || Number.isInteger(o) || e(t)("menu.menu_setting.fields.low_stock.must_be_integer")],
159
- "helper-text": e(t)("menu.menu_setting.fields.low_stock.helper_text")
160
- }, null, 8, ["model-value", "placeholder", "rules", "helper-text"])]),
161
- _: 1
162
- }, 8, ["title", "sub-title"]), n(C, {
163
- onClick: O,
164
- label: e(t)("common.save")
165
- }, null, 8, ["label"])])) : y("", !0), x.value === "price-group" ? (d(), k("div", ie, [_("div", re, [_("div", ce, [_("div", null, [_("h1", me, U(e(t)("menu.price_tier.price_group")), 1), _("p", de, U(e(t)("menu.price_tier.description")), 1)]), n(C, {
166
- label: e(t)("menu.price_tier.add_price_group"),
167
- icon: "add",
168
- onClick: e(f).create
169
- }, null, 8, ["label", "onClick"])]), n(le, null, {
170
- default: p(() => [n(D, {
171
- "column-defs": z,
172
- "row-data": e(f).priceTiers.value,
173
- "page-size": e(f).priceTiers.value.length,
174
- "hide-footer": !0
175
- }, null, 8, ["row-data", "page-size"])]),
176
- _: 1
177
- })])])) : y("", !0)])]),
178
- _: 1
179
- }, 8, ["heading"]);
180
- };
181
- }
182
- });
183
- export {
184
- ye as default
185
- };
@@ -1,431 +0,0 @@
1
- import { computed as i, defineComponent as A, ref as y, resolveComponent as P, createElementBlock as k, openBlock as v, normalizeClass as w, createVNode as z, normalizeStyle as D, withCtx as V, createBlock as b, createCommentVNode as K } from "vue";
2
- import { A as p, J as M, G as R, O as S, ah as U, u as N, c as x } from "./menu-DFNvhoNQ.js";
3
- import { u as C } from "./menuV2-Ezf_jW40.js";
4
- import { C as I, h as $ } from "./catalog-DSuJhsUb.js";
5
- import { useSnackbar as F, useDialog as T } from "@feedmepos/ui-library";
6
- import { b as L } from "./LinkProductSideSheet-LDZjKX95.js";
7
- import { useI18n as B } from "@feedmepos/mf-common";
8
- function j() {
9
- const t = C(), s = i(() => t.categorizedRawMenuItems.filter((u) => u.items.length > 0)), d = i(() => {
10
- const u = t.currentCatalog;
11
- return u ? I.getItemAvailable(u).map((e) => ({ _id: e })) : [];
12
- });
13
- async function m(u) {
14
- const e = t.currentCatalog;
15
- if (!e) return;
16
- const n = u.reduce(
17
- (o, r) => (o[r] = O(
18
- r,
19
- e.override.items[r],
20
- u.includes(r),
21
- t.version === p.F_MENU_VERSION.enum.v3
22
- ), o),
23
- {}
24
- ), a = {
25
- ...e,
26
- override: {
27
- ...e.override,
28
- items: {
29
- ...n
30
- }
31
- }
32
- };
33
- await t.updateMenu({
34
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
35
- operation: M.F_OPERATION_TYPE.update,
36
- data: a
37
- });
38
- }
39
- async function l(u) {
40
- var o;
41
- const e = t.currentCatalog;
42
- if (!e) return;
43
- const n = u.reduce(
44
- (r, c) => {
45
- const _ = e.override.items[c];
46
- return r[c] = O(
47
- c,
48
- _,
49
- !0,
50
- t.version === p.F_MENU_VERSION.enum.v3
51
- ), r;
52
- },
53
- {}
54
- ), a = {
55
- ...e,
56
- override: {
57
- ...e.override,
58
- items: {
59
- ...((o = e.override) == null ? void 0 : o.items) || {},
60
- ...n
61
- }
62
- },
63
- /**
64
- * linkItemRules and items under override are two ways to manage linked items under catalog,
65
- * if we changed items under override, we should clear linkItemRules to avoid conflict.
66
- */
67
- linkItemRules: null
68
- };
69
- await t.updateMenu({
70
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
71
- operation: M.F_OPERATION_TYPE.update,
72
- data: a
73
- });
74
- }
75
- async function g(u) {
76
- var o;
77
- const e = t.currentCatalog;
78
- if (!e) return;
79
- const n = u.reduce(
80
- (r, c) => {
81
- const _ = e.override.items[c];
82
- return r[c] = O(
83
- c,
84
- _,
85
- !1,
86
- t.version === p.F_MENU_VERSION.enum.v3
87
- ), r;
88
- },
89
- {}
90
- ), a = {
91
- ...e,
92
- override: {
93
- ...e.override,
94
- items: {
95
- ...((o = e.override) == null ? void 0 : o.items) || {},
96
- ...n
97
- }
98
- }
99
- };
100
- await t.updateMenu({
101
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
102
- operation: M.F_OPERATION_TYPE.update,
103
- data: a
104
- });
105
- }
106
- async function f(u) {
107
- const e = t.currentCatalog;
108
- if (!e) return;
109
- const n = {
110
- ...e,
111
- linkItemRules: u
112
- };
113
- await t.updateMenu({
114
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
115
- operation: M.F_OPERATION_TYPE.update,
116
- data: n
117
- });
118
- }
119
- return {
120
- linkableItems: s,
121
- currentItems: d,
122
- setProduct: m,
123
- applyProduct: l,
124
- removeProduct: g,
125
- saveLinkItemRules: f
126
- };
127
- }
128
- function O(t, s, d, m) {
129
- const l = s == null ? void 0 : s.find((u) => !u.combinationKey), g = d ? null : p.F_ORDER_FROM.enum.NONE, f = m ? d ? null : "" : l == null ? void 0 : l.category;
130
- return [
131
- {
132
- ...l ?? {},
133
- orderFrom: g,
134
- category: f,
135
- _id: t
136
- },
137
- ...(s == null ? void 0 : s.filter((u) => !!u.combinationKey)) ?? []
138
- ];
139
- }
140
- function G() {
141
- const t = C(), s = F(), d = T(), m = R(s), l = S(m), g = i(() => {
142
- const e = t.categorizedRawMenuItems, n = new Set(
143
- t.currentCatalog ? I.getItemAvailable(t.currentCatalog) : t.state.menu.modules.item.map((a) => a._id)
144
- );
145
- return e.map((a) => ({
146
- ...a,
147
- items: a.items.filter((o) => n.has(o._id))
148
- })).filter((a) => a.items.length > 0);
149
- }), f = i(() => {
150
- var o;
151
- const e = t.currentScheduler;
152
- if (!e) return [];
153
- const n = t.currentCatalog, a = n ? ((o = n.override.scheduler[e._id]) == null ? void 0 : o.items) ?? [] : e.items;
154
- return [
155
- ...new Set(a.filter((r) => r.orderFrom != p.F_ORDER_FROM.enum.NONE).map((r) => r._id))
156
- ].map((r) => ({ _id: r }));
157
- });
158
- async function u(e) {
159
- const n = t.currentScheduler;
160
- if (!n) return;
161
- const a = t.currentCatalog;
162
- if (a && t.rules.scheduler.override) {
163
- const o = new I(
164
- a,
165
- t,
166
- l.updateMenu,
167
- d
168
- );
169
- o.overrideCatalogSchedulerItems(e, n._id), await t.updateMenu({
170
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
171
- operation: M.F_OPERATION_TYPE.update,
172
- data: o.getCatalog()
173
- });
174
- } else {
175
- const o = e.reduce(
176
- (c, _) => {
177
- const h = n.items.filter((E) => E._id == _) ?? [];
178
- return c = c.concat(
179
- U(_, h, (E) => ({
180
- ...E,
181
- orderFrom: null
182
- }))
183
- ), c;
184
- },
185
- []
186
- ), r = {
187
- ...n,
188
- items: o
189
- };
190
- await t.updateMenu({
191
- module: p.F_MENU_MODULE_V4_KEY.enum.scheduler,
192
- operation: M.F_OPERATION_TYPE.update,
193
- data: r
194
- });
195
- }
196
- }
197
- return {
198
- linkableItems: g,
199
- currentItems: f,
200
- applyProduct: u
201
- };
202
- }
203
- const J = () => {
204
- const t = N(), s = F(), d = R(s), m = S(d), l = i(() => t.categorizedRawMenuItems.filter((e) => e.items.length > 0)), g = i(() => {
205
- const e = t.currentCatalog;
206
- return e ? I.getItemAvailable(e).map((n) => ({ _id: n })) : [];
207
- });
208
- async function f(e) {
209
- const n = t.currentCatalog;
210
- if (!n) return;
211
- const o = t.state.menu.modules.item.map((c) => c._id).reduce(
212
- (c, _) => {
213
- const h = n.override.items[_];
214
- return c[_] = $(
215
- _,
216
- h,
217
- e.includes(_),
218
- t.version === x.F_MENU_VERSION.v3
219
- ), c;
220
- },
221
- {}
222
- ), r = {
223
- ...n,
224
- override: { ...n.override, items: o },
225
- /**
226
- * linkItemRules and items under override are two ways to manage linked items under catalog,
227
- * if we changed items under override, we should clear linkItemRules to avoid conflict.
228
- */
229
- linkItemRules: null
230
- };
231
- await m.updateMenu(
232
- {
233
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
234
- operation: M.F_OPERATION_TYPE.update,
235
- data: r
236
- },
237
- r.name
238
- );
239
- }
240
- async function u(e) {
241
- const n = t.currentCatalog;
242
- if (!n) return;
243
- const a = {
244
- ...n,
245
- linkItemRules: e
246
- };
247
- await m.updateMenu(
248
- {
249
- module: p.F_MENU_MODULE_V4_KEY.enum.catalog,
250
- operation: M.F_OPERATION_TYPE.update,
251
- data: a
252
- },
253
- a.name
254
- );
255
- }
256
- return {
257
- linkableItems: l,
258
- currentItems: g,
259
- applyProduct: f,
260
- saveLinkItemRules: u
261
- };
262
- }, q = () => {
263
- const t = N(), s = F(), d = T(), m = R(s), l = S(m), g = i(() => {
264
- const e = t.categorizedRawMenuItems, n = new Set(
265
- t.currentCatalog ? I.getItemAvailable(t.currentCatalog) : t.state.menu.modules.item.map((a) => a._id)
266
- );
267
- return e.map((a) => ({
268
- ...a,
269
- items: a.items.filter((o) => n.has(o._id))
270
- })).filter((a) => a.items.length > 0);
271
- }), f = i(() => {
272
- var o;
273
- const e = t.currentScheduler;
274
- if (!e) return [];
275
- const n = t.currentCatalog, a = n ? ((o = n.override.scheduler[e._id]) == null ? void 0 : o.items) ?? [] : e.items;
276
- return [
277
- ...new Set(a.filter((r) => r.orderFrom != p.F_ORDER_FROM.enum.NONE).map((r) => r._id))
278
- ].map((r) => ({ _id: r }));
279
- });
280
- async function u(e) {
281
- const n = t.currentScheduler;
282
- if (!n) return;
283
- const a = t.currentCatalog;
284
- if (a && t.rules.scheduler.override) {
285
- const o = new I(a, t, l.updateMenu, d);
286
- o.overrideCatalogSchedulerItems(e, n._id), await o.update();
287
- } else {
288
- const o = e.reduce(
289
- (c, _) => {
290
- const h = n.items.filter((E) => E._id == _) ?? [];
291
- return c = c.concat(
292
- U(_, h, (E) => ({
293
- ...E,
294
- orderFrom: null
295
- }))
296
- ), c;
297
- },
298
- []
299
- ), r = {
300
- ...n,
301
- items: o
302
- };
303
- await l.updateMenu(
304
- {
305
- module: p.F_MENU_MODULE_V4_KEY.enum.scheduler,
306
- operation: M.F_OPERATION_TYPE.update,
307
- data: r
308
- },
309
- r.name
310
- );
311
- }
312
- }
313
- return {
314
- linkableItems: g,
315
- currentItems: f,
316
- applyProduct: u
317
- };
318
- };
319
- function ae(t) {
320
- if (!t) {
321
- const e = N(), n = i(() => e.state.menu.modules.item ?? []), a = i(() => {
322
- var h;
323
- return ((h = e.currentCatalog) == null ? void 0 : h.linkItemRules) ?? null;
324
- }), o = q(), r = J(), c = i(() => !e.state.currentSchedulerId);
325
- return {
326
- menuItems: n,
327
- linkItemRules: a,
328
- catalogManager: r,
329
- schedulerManager: o,
330
- noScheduler: c,
331
- handleSubmit: (h) => {
332
- if (h.mode === L.Rules)
333
- r.saveLinkItemRules(h.linkItemRules);
334
- else {
335
- const E = h.items.map((Y) => Y._id);
336
- c.value ? r.applyProduct(E) : o.applyProduct(E);
337
- }
338
- }
339
- };
340
- }
341
- const s = C(), d = i(() => s.state.menu.modules.item ?? []), m = i(() => {
342
- var e;
343
- return ((e = s.currentCatalog) == null ? void 0 : e.linkItemRules) ?? null;
344
- }), l = G(), g = j(), f = i(() => !s.state.currentSchedulerId);
345
- return {
346
- menuItems: d,
347
- linkItemRules: m,
348
- catalogManager: g,
349
- schedulerManager: l,
350
- noScheduler: f,
351
- handleSubmit: (e) => {
352
- if (e.mode === L.Rules)
353
- g.saveLinkItemRules(e.linkItemRules);
354
- else {
355
- const n = e.items.map((a) => a._id);
356
- f.value ? g.applyProduct(n) : l.applyProduct(n);
357
- }
358
- }
359
- };
360
- }
361
- const H = ["alt", "src", "crossorigin"], re = /* @__PURE__ */ A({
362
- __name: "Thumbnail",
363
- props: {
364
- src: {},
365
- alt: {},
366
- className: {},
367
- size: {},
368
- crossorigin: { type: Boolean, default: !0 }
369
- },
370
- setup(t) {
371
- const s = t, { t: d } = B(), m = y(!1), l = y(!s.src), g = () => {
372
- m.value = !1, l.value = !0;
373
- }, f = () => {
374
- m.value = !0, l.value = !0;
375
- }, u = i(() => s.alt ? d("menu.thumbnail.alt.with_name", { name: s.alt }) : d("menu.thumbnail.alt.default")), e = i(() => typeof s.size == "number" ? {
376
- width: s.size,
377
- height: s.size
378
- } : {
379
- width: s.size.width,
380
- height: s.size.height
381
- }), n = i(() => {
382
- if (!s.src) return null;
383
- if (s.crossorigin) {
384
- const a = s.src.includes("?") ? "&" : "?";
385
- return `${s.src}${a}_cors=${Date.now()}`;
386
- }
387
- return s.src;
388
- });
389
- return (a, o) => {
390
- const r = P("fm-icon"), c = P("fm-card");
391
- return v(), k("div", {
392
- class: w([a.className, "flex items-center justify-center"])
393
- }, [
394
- z(c, {
395
- class: w(["flex items-center justify-center", "rounded-md"]),
396
- style: D({ width: `${e.value.width}px`, height: `${e.value.height}px` }),
397
- variant: "outlined"
398
- }, {
399
- default: V(() => [
400
- n.value && !m.value ? (v(), k("img", {
401
- key: 0,
402
- alt: u.value,
403
- class: w(["w-full h-full", "object-cover", l.value ? "" : "hidden"]),
404
- src: n.value,
405
- crossorigin: s.crossorigin ? "anonymous" : void 0,
406
- onError: f,
407
- onLoad: g
408
- }, null, 42, H)) : (v(), b(r, {
409
- key: 1,
410
- color: "neutral-gray-300",
411
- name: "image",
412
- outline: ""
413
- })),
414
- l.value ? K("", !0) : (v(), b(r, {
415
- key: 2,
416
- class: "animate-spin",
417
- name: "progress_activity",
418
- spin: ""
419
- }))
420
- ]),
421
- _: 1
422
- }, 8, ["style"])
423
- ], 2);
424
- };
425
- }
426
- });
427
- export {
428
- re as _,
429
- j as a,
430
- ae as u
431
- };