@feedmepos/mf-menu 0.31.40-beta.2 → 0.31.40-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 (91) hide show
  1. package/dist/{App-CoKv0BFp.js → App-aWEH-ZEk.js} +9 -9
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-B14Q0hS_.js → ApplyProduct.vue_vue_type_script_setup_true_lang-jJyinQZl.js} +3 -3
  3. package/dist/{Catalog-BRovMtuI.js → Catalog-BoFfFdn8.js} +9 -8
  4. package/dist/{Category-DytZqgIt.js → Category-CWYbb3Jn.js} +4 -4
  5. package/dist/{Category-CT8-B4zh.js → Category-DZ45uikR.js} +6 -6
  6. package/dist/{CookingGuide-Ct5qRLG0.js → CookingGuide-BU0PRWIQ.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-D3R3TCba.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-Z5xsKDIE.js} +1 -1
  8. package/dist/FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js +50 -0
  9. package/dist/{Group-Dk1yQTTt.js → Group-BMQDeqiS.js} +1 -1
  10. package/dist/{Group-G_H8i5_8.js → Group-C0T_uknK.js} +3 -3
  11. package/dist/{Group.vue_vue_type_script_setup_true_lang-CoTdB2d5.js → Group.vue_vue_type_script_setup_true_lang-DyfmY6F1.js} +8 -8
  12. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D6qro5w_.js +367 -0
  13. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-BKx7uQtR.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Dl-Wvt3D.js} +14 -13
  14. package/dist/{Ingredient-ChynYQq6.js → Ingredient-3lwDUQx_.js} +3 -3
  15. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-DyaUxnMx.js → InventoryBinding.vue_vue_type_script_setup_true_lang-VLrrTkSC.js} +2 -2
  16. package/dist/LinkProductSideSheet-LDZjKX95.js +297 -0
  17. package/dist/{app-CiBqmBzO.js → LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js} +2084 -2120
  18. package/dist/MenuSetting-AhutsCVy.js +185 -0
  19. package/dist/{PrintRoute-DwAZHUrQ.js → PrintRoute-DfJ-vUAb.js} +4 -4
  20. package/dist/{Product-Bx2NPQvC.js → Product-F4PoLm9v.js} +1 -1
  21. package/dist/{Product.vue_vue_type_script_setup_true_lang-od_O6x7E.js → Product.vue_vue_type_script_setup_true_lang-DT5gffpA.js} +465 -468
  22. package/dist/{ProductInternalTools-BOguHh06.js → ProductInternalTools-DSGU-OqU.js} +6 -6
  23. package/dist/{Products-DA2hOsxr.js → Products-COzW2Z4g.js} +85 -88
  24. package/dist/{Publish-WATQWkjh.js → Publish-CDXVWCk2.js} +3 -3
  25. package/dist/{Recipe-WPwGgur3.js → Recipe-BZx4wrcP.js} +4 -4
  26. package/dist/{Scheduler-Djjggrh2.js → Scheduler-wHCWSeU2.js} +3 -3
  27. package/dist/{ServingSequence-CryZJTWA.js → ServingSequence-BbYEhDYh.js} +3 -3
  28. package/dist/{Setting-BtLsmoqY.js → Setting-C9Tlw1Iy.js} +45 -44
  29. package/dist/{Subcategory-BvlYDquD.js → Subcategory-C8AwfrKb.js} +4 -4
  30. package/dist/{Takeaway-8khxlcKQ.js → Takeaway-DaEUn-yM.js} +4 -4
  31. package/dist/{Takeaway-BBvFxAlx.js → Takeaway-t1053wg2.js} +1 -1
  32. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-B8blN-yJ.js → Takeaway.vue_vue_type_script_setup_true_lang-7XycP5fU.js} +5 -5
  33. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-CA9RlNkt.js → Thumbnail.vue_vue_type_script_setup_true_lang-B7oLH9cP.js} +95 -97
  34. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Ci6iqOry.js +5998 -0
  35. package/dist/{Unit-Diu00sM2.js → Unit-CnqptGCz.js} +2 -2
  36. package/dist/{Variant-CO15W0wb.js → Variant-DiOYOwJs.js} +3 -3
  37. package/dist/{_id_-CxA_FzSG.js → _id_-BSfU16VO.js} +75 -78
  38. package/dist/{app-Blbof2Ga.js → app-Cou6qPF2.js} +1 -1
  39. package/dist/{app-5ESai6-B.js → app-Ddb81PNo.js} +278 -278
  40. package/dist/app.js +1 -1
  41. package/dist/apps/mf-menu/src/api/menu.d.ts +1 -2
  42. package/dist/apps/mf-menu/src/app.d.ts +0 -144
  43. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +0 -36
  44. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +3 -9
  45. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/useItemFormManagement.d.ts +9 -2
  46. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +4 -294
  47. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +0 -40
  48. package/dist/apps/mf-menu/src/helper/import-export.d.ts +0 -285
  49. package/dist/apps/mf-menu/src/helper/menu.d.ts +0 -285
  50. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +0 -285
  51. package/dist/apps/mf-menu/src/stores/menu.d.ts +3 -293
  52. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +0 -166
  53. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  54. package/dist/assets/linked-status-B_crHhZH.js +24 -0
  55. package/dist/assets/override-menu-BmlCEpHH.js +24 -0
  56. package/dist/assets/validate-menu-CF-psoB-.js +24 -0
  57. package/dist/{catalog-CXjEQ80k.js → catalog-DSuJhsUb.js} +1 -1
  58. package/dist/{catalogSetting-aJSUDY_z.js → catalogSetting-C3gEw9ov.js} +1 -1
  59. package/dist/{category-TqQULuHq.js → category-CwWq3KCE.js} +1 -1
  60. package/dist/{currency-CRjh8ne7.js → currency-g45Sh-t6.js} +1 -1
  61. package/dist/{dayjs.min-MBmYgyRY.js → dayjs.min-g3eN5z-V.js} +1 -1
  62. package/dist/index-0Q5T9VZV.js +214 -0
  63. package/dist/{index-dkHuztwB.js → index-0yRUi7LL.js} +1 -1
  64. package/dist/{index-CzjFGFvP.js → index-BLQCYEc6.js} +8 -7
  65. package/dist/{index-B1NS2hBa.js → index-QsLFbxyG.js} +4 -4
  66. package/dist/{item-Dj14On9a.js → item-BvvQ9urP.js} +386 -386
  67. package/dist/{jszip.min-Be1afVon.js → jszip.min-DzdUiaR4.js} +353 -353
  68. package/dist/{menu-C0Xu-iTb.js → menu-DFNvhoNQ.js} +31149 -31298
  69. package/dist/{menu-kRDoPBjm.js → menu-QrVg2Ph7.js} +7 -7
  70. package/dist/{menuV2-D6Gmxd9X.js → menuV2-Ezf_jW40.js} +137 -142
  71. package/dist/mf-menu.css +1 -1
  72. package/dist/{priceTier-CJlFGOpm.js → priceTier-zENsn3P_.js} +1 -1
  73. package/dist/{scheduler-B11d6fJr.js → scheduler-BuwGSv6A.js} +8 -8
  74. package/dist/{subcategory-D6hTbHP-.js → subcategory-O3L_zCJA.js} +2 -2
  75. package/dist/{toExcel-BedErXvS.js → toExcel-CpRy_4nG.js} +2 -2
  76. package/dist/{unit-D5jDzsM2.js → unit-Ct_7Hfa2.js} +41 -42
  77. package/package.json +3 -3
  78. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-B_Yv8Thl.js +0 -399
  79. package/dist/LinkProductSideSheet-DsoPo7Q_.js +0 -361
  80. package/dist/MenuSetting-CDSc-56P.js +0 -618
  81. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-LVWB5CIa.js +0 -5994
  82. package/dist/apps/mf-menu/src/composable/attributes.d.ts +0 -26
  83. package/dist/apps/mf-menu/src/utils/array.d.ts +0 -1
  84. package/dist/apps/mf-menu/src/utils/customAttributes.d.ts +0 -12
  85. package/dist/apps/mf-menu/src/views/MenuSetting/LinkProductRuleGroups.vue.d.ts +0 -2
  86. package/dist/apps/mf-menu/src/views/MenuSetting/RuleGroupSideSheet.vue.d.ts +0 -176
  87. package/dist/assets/linked-status-x1efKEih.js +0 -13
  88. package/dist/assets/override-menu-D8d9BWzy.js +0 -13
  89. package/dist/assets/validate-menu-DUJ20GHx.js +0 -13
  90. package/dist/customAttributes-32VmzFKZ.js +0 -177
  91. package/dist/index-FzHOAFSW.js +0 -246
@@ -1,618 +0,0 @@
1
- import { defineComponent as le, ref as $, computed as V, watch as P, resolveComponent as b, createBlock as W, openBlock as g, unref as e, withCtx as p, createElementVNode as r, createVNode as l, createElementBlock as x, Fragment as ue, renderList as oe, toDisplayString as E, createCommentVNode as z, withModifiers as ge } from "vue";
2
- import { u as ae, I as X, G as ce, B as ye, H as re } from "./menu-C0Xu-iTb.js";
3
- import { useI18n as se, useCustomAttributes as ie, useCoreStore as de, EMPTY_RULE as Q, isEmptyRule as me } from "@feedmepos/mf-common";
4
- import { components as ne, FmButtonVariant as L, useDialog as he, useSnackbar as pe, useBreakpoints as ke, FmButtonColorThemeVariant as te } from "@feedmepos/ui-library";
5
- import { u as Ce, c as Se, m as K, _ as Z, a as H, f as Y } from "./customAttributes-32VmzFKZ.js";
6
- import { _ as _e } from "./app-5ESai6-B.js";
7
- import { b as J } from "./app-CiBqmBzO.js";
8
- import { u as xe } from "./discardConfirm-BHni0LNu.js";
9
- import { _ as we } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
10
- import { C as j, a as D } from "./catalogSetting-aJSUDY_z.js";
11
- import { u as Re } from "./priceTier-CJlFGOpm.js";
12
- const Ve = {
13
- class: "fm-typo-en-title-md-600 mr-auto"
14
- }, Ae = {
15
- class: "py-8 px-8 overflow-y-auto space-y-24"
16
- }, Te = {
17
- class: "space-y-16"
18
- }, Fe = {
19
- class: "grid md:grid-cols-3 gap-16"
20
- }, Ue = {
21
- class: "md:col-span-2 space-y-16"
22
- }, Ge = {
23
- class: "flex justify-end"
24
- }, $e = {
25
- class: "flex gap-8 items-center justify-start"
26
- }, Me = /* @__PURE__ */ le({
27
- __name: "RuleGroupSideSheet",
28
- props: {
29
- modelValue: {
30
- type: Boolean
31
- },
32
- editingGroup: {}
33
- },
34
- emits: ["update:modelValue", "submit"],
35
- setup(ee, {
36
- emit: o
37
- }) {
38
- const k = ee, M = o, {
39
- t: i
40
- } = se(), A = ae(), t = $({
41
- name: "",
42
- description: "",
43
- rules: []
44
- }), {
45
- attributes: h
46
- } = ie({
47
- valueSource: de().restaurants,
48
- entity: "restaurant"
49
- }), {
50
- attributes: U
51
- } = ie({
52
- valueSource: V(() => A.state.menu.modules.item || []),
53
- entity: "item"
54
- }), {
55
- restaurantAttributes: y
56
- } = Ce(), {
57
- itemAttributes: I,
58
- convertCategoryIdToName: T,
59
- convertCategoryNameToId: B
60
- } = Se({
61
- menuItems: V(() => A.state.menu.modules.item || []),
62
- categories: V(() => A.categories || [])
63
- }), R = V(() => t.value.rules.length > 0 ? !0 : i("menu.rule_groups.validation.at_least_one_rule_required")), F = V({
64
- get: () => k.modelValue,
65
- set: (s) => M("update:modelValue", s)
66
- }), G = $(null);
67
- P(() => k.editingGroup, (s) => {
68
- s ? t.value = {
69
- name: s.name,
70
- description: s.description,
71
- rules: s.rules.map((u) => ({
72
- ...u,
73
- restaurantRule: u.restaurantRule ? {
74
- restaurantAttributes: K(u.restaurantRule.restaurantAttributes),
75
- restaurantCustomAttributes: K(u.restaurantRule.restaurantCustomAttributes)
76
- } : void 0,
77
- itemRule: u.itemRule ? {
78
- itemAttributes: T(K(u.itemRule.itemAttributes)),
79
- itemCustomAttributes: K(u.itemRule.itemCustomAttributes)
80
- } : void 0
81
- }))
82
- } : t.value = {
83
- name: "",
84
- description: "",
85
- rules: []
86
- }, G.value = X.cloneDeep(t.value);
87
- }, {
88
- immediate: !0
89
- }), P(() => k.modelValue, (s) => {
90
- s || (t.value = {
91
- name: "",
92
- description: "",
93
- rules: []
94
- });
95
- });
96
- function d(s) {
97
- return `${s}_${(/* @__PURE__ */ new Date()).toISOString()}`;
98
- }
99
- async function m() {
100
- var u;
101
- const s = {
102
- _id: ((u = k.editingGroup) == null ? void 0 : u._id) ?? d("group"),
103
- name: t.value.name,
104
- description: t.value.description,
105
- rules: t.value.rules.map((a) => ({
106
- _id: a._id,
107
- restaurantRule: a.restaurantRule ? {
108
- restaurantAttributes: Y(a.restaurantRule.restaurantAttributes),
109
- restaurantCustomAttributes: Y(a.restaurantRule.restaurantCustomAttributes)
110
- } : void 0,
111
- itemRule: a.itemRule ? {
112
- itemAttributes: Y(B(a.itemRule.itemAttributes)),
113
- itemCustomAttributes: Y(a.itemRule.itemCustomAttributes)
114
- } : void 0
115
- }))
116
- };
117
- M("submit", s);
118
- }
119
- function _() {
120
- t.value.rules.push({
121
- _id: d("rule"),
122
- restaurantRule: {
123
- restaurantAttributes: null,
124
- restaurantCustomAttributes: null
125
- },
126
- itemRule: {
127
- itemAttributes: null,
128
- itemCustomAttributes: null
129
- }
130
- });
131
- }
132
- function C(s) {
133
- t.value.rules.splice(s, 1);
134
- }
135
- function n(s, u, a) {
136
- t.value.rules[s].restaurantRule || (t.value.rules[s].restaurantRule = {}), me(u) ? t.value.rules[s].restaurantRule[a] = null : t.value.rules[s].restaurantRule[a] = u;
137
- }
138
- function c(s, u, a) {
139
- t.value.rules[s].itemRule || (t.value.rules[s].itemRule = {}), me(u) ? t.value.rules[s].itemRule[a] = null : t.value.rules[s].itemRule[a] = u;
140
- }
141
- function v() {
142
- F.value = !1;
143
- }
144
- const w = xe(() => !X.isEqual(G.value, t.value), () => {
145
- F.value = !1;
146
- });
147
- return (s, u) => {
148
- const a = b("fm-button"), q = b("FmTextField"), ve = b("FmCard"), fe = b("FmFormGroup"), be = b("fm-side-sheet");
149
- return g(), W(be, {
150
- modelValue: F.value,
151
- "onUpdate:modelValue": u[4] || (u[4] = (f) => F.value = f),
152
- "is-container": e(ne).FmForm,
153
- "is-container-props": {
154
- onValidationSuccess: m,
155
- blameFormChildOnValidationFailed: !0
156
- },
157
- "max-width": 760,
158
- "onOn:clickedAway": e(w)
159
- }, {
160
- "side-sheet-header": p(() => [l(a, {
161
- variant: e(L).Tertiary,
162
- class: "cursor-pointer mr-4",
163
- "prepend-icon": "arrow_back",
164
- onClick: u[0] || (u[0] = () => F.value = !1)
165
- }, null, 8, ["variant"]), r("p", Ve, E(s.editingGroup ? e(i)("menu.rule_groups.edit_group") : e(i)("menu.rule_groups.create_group")), 1)]),
166
- "side-sheet-footer": p(() => [r("div", $e, [l(a, {
167
- label: e(i)("common.save"),
168
- size: "lg",
169
- type: "submit",
170
- variant: "primary"
171
- }, null, 8, ["label"]), l(a, {
172
- label: e(i)("common.cancel"),
173
- size: "lg",
174
- variant: "tertiary",
175
- onClick: v
176
- }, null, 8, ["label"])])]),
177
- default: p(() => [r("div", Ae, [l(Z, {
178
- title: e(i)("menu.rule_groups.form.basic_info")
179
- }, {
180
- default: p(() => [r("div", Te, [l(q, {
181
- label: e(i)("menu.rule_groups.form.name"),
182
- "label-mark": "required",
183
- modelValue: t.value.name,
184
- "onUpdate:modelValue": u[1] || (u[1] = (f) => t.value.name = f),
185
- placeholder: e(i)("menu.rule_groups.form.name_placeholder"),
186
- required: "",
187
- rules: [(f) => !!(f != null && f.trim()) || e(i)("menu.rule_groups.validation.name_required")]
188
- }, null, 8, ["label", "modelValue", "placeholder", "rules"]), l(q, {
189
- label: e(i)("menu.rule_groups.form.description"),
190
- "label-mark": "optional",
191
- modelValue: t.value.description,
192
- "onUpdate:modelValue": u[2] || (u[2] = (f) => t.value.description = f),
193
- placeholder: e(i)("menu.rule_groups.form.description_placeholder"),
194
- multiline: "",
195
- rows: 3
196
- }, null, 8, ["label", "modelValue", "placeholder"])])]),
197
- _: 1
198
- }, 8, ["title"]), l(fe, {
199
- modelValue: R.value,
200
- "onUpdate:modelValue": u[3] || (u[3] = (f) => R.value = f),
201
- rules: [() => t.value.rules.length > 0 || e(i)("menu.rule_groups.validation.at_least_one_rule_required")]
202
- }, {
203
- default: p(() => [l(Z, {
204
- title: e(i)("menu.rule_groups.form.rules"),
205
- "sub-title": e(i)("menu.rule_groups.form.rules_description")
206
- }, {
207
- default: p(() => [(g(!0), x(ue, null, oe(t.value.rules, (f, O) => (g(), W(ve, {
208
- key: O,
209
- class: "p-16 space-y-16",
210
- variant: "outlined"
211
- }, {
212
- default: p(() => [r("div", Fe, [r("div", Ue, [l(H, {
213
- label: e(i)("menu.link_product.rules.restaurant_filter")
214
- }, {
215
- default: p(() => {
216
- var S;
217
- return [l(e(J), {
218
- attributes: e(y),
219
- "model-value": ((S = f.restaurantRule) == null ? void 0 : S.restaurantAttributes) || e(Q),
220
- "onUpdate:modelValue": (N) => n(O, N, "restaurantAttributes")
221
- }, null, 8, ["attributes", "model-value", "onUpdate:modelValue"])];
222
- }),
223
- _: 2
224
- }, 1032, ["label"]), l(H, {
225
- label: e(i)("menu.link_product.rules.restaurant_custom_attributes_filter")
226
- }, {
227
- default: p(() => {
228
- var S;
229
- return [l(e(J), {
230
- attributes: e(h),
231
- "model-value": ((S = f.restaurantRule) == null ? void 0 : S.restaurantCustomAttributes) || e(Q),
232
- "onUpdate:modelValue": (N) => n(O, N, "restaurantCustomAttributes")
233
- }, null, 8, ["attributes", "model-value", "onUpdate:modelValue"])];
234
- }),
235
- _: 2
236
- }, 1032, ["label"]), l(H, {
237
- label: e(i)("menu.link_product.rules.item_filter")
238
- }, {
239
- default: p(() => {
240
- var S;
241
- return [l(e(J), {
242
- attributes: e(I),
243
- "model-value": ((S = f.itemRule) == null ? void 0 : S.itemAttributes) || e(Q),
244
- "onUpdate:modelValue": (N) => c(O, N, "itemAttributes")
245
- }, null, 8, ["attributes", "model-value", "onUpdate:modelValue"])];
246
- }),
247
- _: 2
248
- }, 1032, ["label"]), l(H, {
249
- label: e(i)("menu.link_product.rules.item_custom_attributes_filter")
250
- }, {
251
- default: p(() => {
252
- var S;
253
- return [l(e(J), {
254
- attributes: e(U),
255
- "model-value": ((S = f.itemRule) == null ? void 0 : S.itemCustomAttributes) || e(Q),
256
- "onUpdate:modelValue": (N) => c(O, N, "itemCustomAttributes")
257
- }, null, 8, ["attributes", "model-value", "onUpdate:modelValue"])];
258
- }),
259
- _: 2
260
- }, 1032, ["label"])])]), r("div", Ge, [l(a, {
261
- variant: e(L).Tertiary,
262
- "prepend-icon": "delete",
263
- onClick: (S) => C(O)
264
- }, null, 8, ["variant", "onClick"])])]),
265
- _: 2
266
- }, 1024))), 128)), r("div", null, [l(a, {
267
- label: e(i)("menu.link_product.rules.add_rule"),
268
- onClick: _
269
- }, null, 8, ["label"])])]),
270
- _: 1
271
- }, 8, ["title", "sub-title"])]),
272
- _: 1
273
- }, 8, ["modelValue", "rules"])])]),
274
- _: 1
275
- }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
276
- };
277
- }
278
- }), Ie = {
279
- key: 0,
280
- class: "space-y-8"
281
- }, Be = {
282
- class: "flex items-center justify-between"
283
- }, Ne = {
284
- class: "fm-typo-en-title-md-600"
285
- }, De = {
286
- class: "text-fm-color-typo-secondary"
287
- }, Ee = {
288
- class: "flex justify-end items-center"
289
- }, Le = {
290
- class: "w-[320px]"
291
- }, Oe = {
292
- key: 1,
293
- class: "flex-1 flex flex-col min-h-0"
294
- }, je = {
295
- class: "flex items-center justify-between p-8"
296
- }, ze = {
297
- class: "flex-1 mr-8"
298
- }, Pe = {
299
- class: "flex flex-1 flex-col min-h-0 overflow-scroll divide-y divide-fm-color-neutral-gray-100 pb-64"
300
- }, qe = ["onClick"], Qe = {
301
- class: "flex-1 space-y-4"
302
- }, Ke = {
303
- class: "fm-typo-en-body-lg-600"
304
- }, He = {
305
- key: 0,
306
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
307
- }, Ye = /* @__PURE__ */ le({
308
- __name: "LinkProductRuleGroups",
309
- setup(ee) {
310
- const {
311
- t: o
312
- } = se(), k = he(), M = pe(), i = ce(M), A = ae(), t = $(A.state.menu.ruleGroupSettings || {
313
- groups: []
314
- });
315
- P(() => A.state.menu.ruleGroupSettings, (n) => {
316
- t.value = n || {
317
- groups: []
318
- };
319
- }, {
320
- deep: !0
321
- });
322
- const h = $(!1), U = $(null), y = ke(), I = V(() => y.breakpoints.value.xs), T = $(""), B = V(() => t.value.groups.filter((n) => n.name.toLowerCase().includes(T.value.toLowerCase()))), R = [{
323
- header: o("menu.rule_groups.table.columns.name"),
324
- accessorKey: "name",
325
- enableSorting: !0
326
- }, {
327
- header: o("menu.rule_groups.table.columns.description"),
328
- accessorKey: "description",
329
- enableSorting: !1
330
- }, {
331
- id: "actions",
332
- size: 100,
333
- cell: (n) => l("div", {
334
- class: "px-4 flex justify-end"
335
- }, [l(ne.FmButton, {
336
- icon: "delete",
337
- "text-color": te.NeutralGray400,
338
- variant: L.Tertiary,
339
- onClick: (c) => {
340
- c.stopPropagation(), m(n.row.original._id);
341
- }
342
- }, null)])
343
- }];
344
- function F(n) {
345
- d(n.original);
346
- }
347
- function G() {
348
- U.value = null, h.value = !0;
349
- }
350
- function d(n) {
351
- U.value = n, h.value = !0;
352
- }
353
- function m(n) {
354
- const c = t.value.groups.find((v) => v._id === n);
355
- c && k.open({
356
- title: o("menu.rule_groups.delete_dialog.title"),
357
- message: o("menu.rule_groups.delete_dialog.message", {
358
- name: c.name
359
- }),
360
- primaryActions: {
361
- text: o("menu.common.actions.remove"),
362
- close: !1,
363
- variant: L.Destructive
364
- },
365
- secondaryActions: {
366
- text: o("menu.common.actions.cancel"),
367
- close: !0
368
- }
369
- }).onPrimary(async () => {
370
- const v = X.cloneDeep(t.value);
371
- v.groups = v.groups.filter((w) => w._id !== n), await _(v), k.close();
372
- });
373
- }
374
- async function _(n) {
375
- await i.minor(async () => {
376
- await A.updateMenuSetting({
377
- ruleGroupSettings: n
378
- });
379
- }, {
380
- successMessage: o("menu.rule_groups.saved_successfully")
381
- });
382
- }
383
- async function C(n) {
384
- var w;
385
- const c = (w = t.value.groups) == null ? void 0 : w.findIndex((s) => s._id === n._id), v = X.cloneDeep(t.value);
386
- c >= 0 ? v.groups[c] = n : v.groups.push(n), await _(v), h.value = !1;
387
- }
388
- return P(() => h.value, (n) => {
389
- n || (U.value = null);
390
- }), (n, c) => {
391
- const v = b("FmButton"), w = b("FmSearch"), s = b("FmTable");
392
- return g(), x("div", null, [I.value ? (g(), x("div", Oe, [r("div", je, [r("div", ze, [l(w, {
393
- modelValue: T.value,
394
- "onUpdate:modelValue": c[1] || (c[1] = (u) => T.value = u),
395
- autofocus: "",
396
- class: "w-full",
397
- placeholder: e(o)("menu.rule_groups.search_placeholder")
398
- }, null, 8, ["modelValue", "placeholder"])]), l(v, {
399
- icon: "add",
400
- variant: e(L).Secondary,
401
- onClick: G
402
- }, null, 8, ["variant"])]), r("div", Pe, [(g(!0), x(ue, null, oe(B.value, (u) => (g(), x("div", {
403
- key: u._id,
404
- class: "flex flex-row py-12 px-16 cursor-pointer",
405
- onClick: (a) => d(u)
406
- }, [r("div", Qe, [r("p", Ke, E(u.name), 1), u.description ? (g(), x("p", He, E(u.description), 1)) : z("", !0)]), l(v, {
407
- "text-color": e(te).NeutralGray400,
408
- variant: e(L).Tertiary,
409
- icon: "delete",
410
- onClick: ge((a) => m(u._id), ["stop"])
411
- }, null, 8, ["text-color", "variant", "onClick"])], 8, qe))), 128))])])) : (g(), x("div", Ie, [r("div", Be, [r("div", null, [r("h1", Ne, E(e(o)("menu.rule_groups.title")), 1), r("p", De, E(e(o)("menu.rule_groups.description")), 1)]), l(v, {
412
- label: e(o)("menu.rule_groups.create_group"),
413
- icon: "add",
414
- onClick: G
415
- }, null, 8, ["label"])]), r("div", Ee, [r("div", Le, [l(w, {
416
- modelValue: T.value,
417
- "onUpdate:modelValue": c[0] || (c[0] = (u) => T.value = u),
418
- autofocus: "",
419
- class: "mb-8",
420
- placeholder: e(o)("menu.rule_groups.search_placeholder")
421
- }, null, 8, ["modelValue", "placeholder"])])]), l(_e, null, {
422
- default: p(() => [l(s, {
423
- "column-defs": R,
424
- "row-data": B.value,
425
- "page-size": B.value.length,
426
- "hide-footer": !0,
427
- onRowClick: F
428
- }, null, 8, ["row-data", "page-size"])]),
429
- _: 1
430
- })])), l(Me, {
431
- modelValue: h.value,
432
- "onUpdate:modelValue": c[2] || (c[2] = (u) => h.value = u),
433
- "editing-group": U.value,
434
- onSubmit: C
435
- }, null, 8, ["modelValue", "editing-group"])]);
436
- };
437
- }
438
- }), Je = {
439
- class: "py-16"
440
- }, We = {
441
- key: 0,
442
- class: "space-y-32 max-w-[750px] xs:p-16"
443
- }, Xe = {
444
- key: 0,
445
- class: "pl-32 space-x-8"
446
- }, Ze = {
447
- key: 1
448
- }, et = {
449
- class: "space-y-8"
450
- }, tt = {
451
- class: "flex items-center justify-between"
452
- }, lt = {
453
- class: "fm-typo-en-title-md-600"
454
- }, ut = {
455
- class: "text-fm-color-typo-secondary"
456
- }, ot = {
457
- key: 2
458
- }, ft = /* @__PURE__ */ le({
459
- __name: "MenuSetting",
460
- setup(ee) {
461
- var G;
462
- const {
463
- t: o
464
- } = se(), k = ae(), M = de(), i = pe(), A = ce(i), t = V(() => ({
465
- lowStock: k.state.menu.lowStockThreshold,
466
- taxSetting: k.state.menu.masterCatalogSetting,
467
- priceTierSettings: k.state.menu.priceTierSettings
468
- })), h = $("conf"), U = V(() => [{
469
- label: o("menu.menu_setting.tabs.menu_configuration"),
470
- value: "conf"
471
- }, ...k.isV4 ? [{
472
- label: o("menu.menu_setting.tabs.price_group"),
473
- value: "price-group"
474
- }, {
475
- label: o("menu.menu_setting.tabs.link_product_rule_groups"),
476
- value: "link-product-rule-groups"
477
- }] : []]), y = $(j.transformTax((G = t.value.taxSetting) == null ? void 0 : G.inclusiveTaxes));
478
- P(() => t.value, (d) => {
479
- var m;
480
- y.value = j.transformTax((m = d.taxSetting) == null ? void 0 : m.inclusiveTaxes);
481
- });
482
- const I = V(() => {
483
- if (!M.currentCountry.value) return [];
484
- const d = y.value.mode === D.MANUAL ? y.value.inclusive ?? [] : [];
485
- return ye.Country.getCountry(M.currentCountry.value).taxSystems.map((_) => {
486
- const C = d.find((n) => n.systemCode === _.code);
487
- return {
488
- inclusive: (C == null ? void 0 : C.inclusive) || !1,
489
- systemCode: _.code
490
- };
491
- });
492
- });
493
- function T(d) {
494
- const m = y.value, _ = m.mode === D.AUTO ? j.manualTax(I.value) : re(m);
495
- _.inclusive ?? (_.inclusive = []);
496
- const C = _.inclusive.findIndex((n) => n.systemCode === d.systemCode);
497
- C < 0 ? _.inclusive.push(d) : _.inclusive.splice(C, 1, d), y.value = _;
498
- }
499
- async function B() {
500
- if (t.value.lowStock !== null && t.value.lowStock !== void 0 && !Number.isInteger(t.value.lowStock))
501
- return;
502
- const d = y.value.mode === D.AUTO ? null : re(y.value.inclusive);
503
- await A.minor(async () => {
504
- const m = t.value.lowStock === null || t.value.lowStock === void 0 || t.value.lowStock === 0;
505
- await k.updateMenuSetting({
506
- masterCatalogSetting: {
507
- inclusiveTaxes: d
508
- },
509
- lowStockThreshold: m ? null : t.value.lowStock,
510
- priceTierSettings: R.priceTiers.value
511
- });
512
- }, {
513
- successMessage: o("menu.menu_setting.fields.low_stock.updated")
514
- });
515
- }
516
- const R = Re(), F = [{
517
- header: o("menu.price_tier.settings_table.columns.name"),
518
- accessorKey: "key",
519
- enableSorting: !1
520
- }, {
521
- id: "actions",
522
- size: 50,
523
- cell: (d) => l("div", {
524
- class: "px-4 flex justify-end"
525
- }, [l(ne.FmButton, {
526
- icon: "delete",
527
- "text-color": te.NeutralGray400,
528
- variant: L.Tertiary,
529
- onClick: () => R.deletePriceTier(d.row.original.key)
530
- }, null)])
531
- }];
532
- return (d, m) => {
533
- const _ = b("FmTabs"), C = b("fm-radio"), n = b("fm-radio-group"), c = b("fm-checkbox"), v = b("FormItem"), w = b("FmStepperField"), s = b("FmButton"), u = b("FmTable");
534
- return g(), W(we, {
535
- heading: e(o)("menu.menu_setting.title")
536
- }, {
537
- default: p(() => [l(_, {
538
- items: U.value,
539
- modelValue: h.value,
540
- "onUpdate:modelValue": m[0] || (m[0] = (a) => h.value = a)
541
- }, null, 8, ["items", "modelValue"]), r("div", Je, [h.value === "conf" ? (g(), x("div", We, [l(Z, {
542
- title: "Tax setting"
543
- }, {
544
- default: p(() => [l(v, {
545
- label: e(o)("menu.setting.tax.title")
546
- }, {
547
- default: p(() => [l(n, {
548
- "model-value": y.value.mode,
549
- "onUpdate:modelValue": m[1] || (m[1] = (a) => {
550
- a === e(D).AUTO ? y.value = e(j).autoTax() : y.value = e(j).manualTax(I.value);
551
- })
552
- }, {
553
- default: p(() => [l(C, {
554
- value: e(D).AUTO,
555
- label: e(o)("menu.setting.tax.modes.auto.label"),
556
- sublabel: e(o)("menu.setting.tax.modes.auto.sublabel")
557
- }, null, 8, ["value", "label", "sublabel"]), l(C, {
558
- value: e(D).MANUAL,
559
- label: e(o)("menu.setting.tax.modes.manual.label"),
560
- sublabel: e(o)("menu.setting.tax.modes.manual.sublabel")
561
- }, null, 8, ["value", "label", "sublabel"])]),
562
- _: 1
563
- }, 8, ["model-value"]), y.value.mode === e(D).MANUAL ? (g(), x("div", Xe, [(g(!0), x(ue, null, oe(I.value, (a) => (g(), W(c, {
564
- key: a.systemCode,
565
- "model-value": a.inclusive,
566
- value: !0,
567
- label: a.systemCode + " inclusive",
568
- "onUpdate:modelValue": (q) => {
569
- T({
570
- ...a,
571
- inclusive: q
572
- });
573
- }
574
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))])) : z("", !0)]),
575
- _: 1
576
- }, 8, ["label"])]),
577
- _: 1
578
- }), l(Z, {
579
- title: e(o)("menu.menu_setting.fields.low_stock.title"),
580
- "sub-title": e(o)("menu.menu_setting.fields.low_stock.subtitle")
581
- }, {
582
- default: p(() => [l(w, {
583
- "model-value": t.value.lowStock || null,
584
- min: 0,
585
- max: 1e3,
586
- step: 1,
587
- placeholder: e(o)("menu.menu_setting.fields.low_stock.not_set"),
588
- "onUpdate:modelValue": m[2] || (m[2] = (a) => {
589
- t.value.lowStock = a;
590
- }),
591
- rules: [(a) => a === null || Number.isInteger(a) || e(o)("menu.menu_setting.fields.low_stock.must_be_integer")],
592
- "helper-text": e(o)("menu.menu_setting.fields.low_stock.helper_text")
593
- }, null, 8, ["model-value", "placeholder", "rules", "helper-text"])]),
594
- _: 1
595
- }, 8, ["title", "sub-title"]), l(s, {
596
- onClick: B,
597
- label: e(o)("common.save")
598
- }, null, 8, ["label"])])) : z("", !0), h.value === "price-group" ? (g(), x("div", Ze, [r("div", et, [r("div", tt, [r("div", null, [r("h1", lt, E(e(o)("menu.price_tier.price_group")), 1), r("p", ut, E(e(o)("menu.price_tier.description")), 1)]), l(s, {
599
- label: e(o)("menu.price_tier.add_price_group"),
600
- icon: "add",
601
- onClick: e(R).create
602
- }, null, 8, ["label", "onClick"])]), l(_e, null, {
603
- default: p(() => [l(u, {
604
- "column-defs": F,
605
- "row-data": e(R).priceTiers.value,
606
- "page-size": e(R).priceTiers.value.length,
607
- "hide-footer": !0
608
- }, null, 8, ["row-data", "page-size"])]),
609
- _: 1
610
- })])])) : z("", !0), h.value === "link-product-rule-groups" ? (g(), x("div", ot, [l(Ye)])) : z("", !0)])]),
611
- _: 1
612
- }, 8, ["heading"]);
613
- };
614
- }
615
- });
616
- export {
617
- ft as default
618
- };