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