@feedmepos/mf-menu 0.32.3-beta.1 → 0.32.4-dev

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 (84) hide show
  1. package/dist/{App-DJBZBaaC.js → App-5YVGeojR.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-c9SlmPp2.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DhoHYIHW.js} +20 -20
  3. package/dist/{Catalog-Ct9jk3A_.js → Catalog-BTNv5n_D.js} +18 -18
  4. package/dist/{Category-Cf5KfKdv.js → Category-BE-kkKcL.js} +22 -23
  5. package/dist/{Category-CTTAtG31.js → Category-DuLhbRxE.js} +21 -22
  6. package/dist/{CookingGuide-BaNzajgf.js → CookingGuide-JtE8QMC6.js} +92 -93
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-CRodr6tr.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-DdJ-o_PW.js} +1 -1
  8. package/dist/FormItem.vue_vue_type_script_setup_true_lang-B3Ixruh-.js +26 -0
  9. package/dist/{Group-BfRPCCbK.js → Group-BP-j3K6J.js} +1 -1
  10. package/dist/{Group-BJep-xq-.js → Group-DhS9e2E3.js} +3 -3
  11. package/dist/{Group.vue_vue_type_script_setup_true_lang-CoCq0edM.js → Group.vue_vue_type_script_setup_true_lang-DXUQrXXI.js} +33 -34
  12. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-DviXfima.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CXzz4ClS.js} +24 -23
  13. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-DSrxcKIK.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Bpt-8tbe.js} +11525 -11504
  14. package/dist/{Ingredient-BnzW69zW.js → Ingredient-NSl0x-0T.js} +5 -6
  15. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-D8m1pyLp.js → InventoryBinding.vue_vue_type_script_setup_true_lang-ByrNVvzs.js} +2 -2
  16. package/dist/LinkProductSideSheet-B_R_2iH6.js +692 -0
  17. package/dist/MenuSetting-C7cpv4S3.js +580 -0
  18. package/dist/{PrintRoute-CLsiDIkn.js → PrintRoute-DmP7KH58.js} +10 -11
  19. package/dist/{Product-DHE0XtX1.js → Product-B6gwN4g0.js} +1 -1
  20. package/dist/{Product.vue_vue_type_script_setup_true_lang-CVR8j-XT.js → Product.vue_vue_type_script_setup_true_lang-BKhn8Txf.js} +15 -16
  21. package/dist/{ProductInternalTools-BQOXHzYp.js → ProductInternalTools-D5xIh2j2.js} +5 -5
  22. package/dist/Products-Cxx8pJGK.js +692 -0
  23. package/dist/{Publish-BlEcoJaI.js → Publish-ZCzRBB5V.js} +21 -22
  24. package/dist/{Recipe-CkcNxf7p.js → Recipe-DcHdr_5J.js} +9 -10
  25. package/dist/RuleView.vue_vue_type_script_setup_true_lang-edNbsZTq.js +3282 -0
  26. package/dist/{Scheduler-DV0s_qkV.js → Scheduler-ZhDXk5gQ.js} +18 -19
  27. package/dist/{ServingSequence-CFd8Nwws.js → ServingSequence-DcfMbHjn.js} +15 -16
  28. package/dist/{Setting-B55IsZCX.js → Setting-fqf_sOIc.js} +45 -44
  29. package/dist/{Subcategory-BXCcVdR3.js → Subcategory-BidmfEOK.js} +18 -19
  30. package/dist/{Takeaway-BDvcwBHP.js → Takeaway-C83SKEvl.js} +1 -1
  31. package/dist/{Takeaway--U_lsgYi.js → Takeaway-p6thRg74.js} +4 -4
  32. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-DaYk2xdF.js → Takeaway.vue_vue_type_script_setup_true_lang-Dq6CjXCv.js} +48 -49
  33. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-VBpTghy9.js → Thumbnail.vue_vue_type_script_setup_true_lang-CjLOy2k9.js} +10 -10
  34. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-IBM6rC5M.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CWdsp9eo.js} +17 -16
  35. package/dist/{Unit-DkvTsQWA.js → Unit-CKIaBxVE.js} +7 -8
  36. package/dist/{Variant-tte76SbR.js → Variant-CE21vKC4.js} +38 -39
  37. package/dist/{_id_-AVMi3j91.js → _id_-BhWpg9Kj.js} +10 -10
  38. package/dist/{app-0s3jY-aE.js → app-BkcVM9nE.js} +1 -1
  39. package/dist/app-CEIhTuYG.js +363 -0
  40. package/dist/app.js +1 -1
  41. package/dist/apps/mf-menu/src/app.d.ts +250 -0
  42. package/dist/apps/mf-menu/src/components/rule_group/CatalogLinkItemRuleForm.vue.d.ts +146 -0
  43. package/dist/apps/mf-menu/src/components/rule_group/CatalogLinkItemRuleView.vue.d.ts +158 -0
  44. package/dist/apps/mf-menu/src/components/rule_group/RuleCondition.vue.d.ts +103 -0
  45. package/dist/apps/mf-menu/src/components/rule_group/RuleConditionListView.vue.d.ts +54 -0
  46. package/dist/apps/mf-menu/src/components/rule_group/RuleConditionSelector.vue.d.ts +50 -0
  47. package/dist/apps/mf-menu/src/components/rule_group/RuleForm.vue.d.ts +117 -0
  48. package/dist/apps/mf-menu/src/components/rule_group/RuleView.vue.d.ts +141 -0
  49. package/dist/apps/mf-menu/src/composable/attributes.d.ts +10 -0
  50. package/dist/apps/mf-menu/src/helper/import-export-utils.d.ts +2 -3
  51. package/dist/apps/mf-menu/src/helper/menuExport.d.ts +3 -1
  52. package/dist/apps/mf-menu/src/helper/menuImport.d.ts +3 -2
  53. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  54. package/dist/assets/{linked-status-DEGoFflv.js → linked-status-CStQ46Ze.js} +2 -2
  55. package/dist/assets/{override-menu-CZe07SCm.js → override-menu-DHTQAnIJ.js} +2 -2
  56. package/dist/assets/{validate-menu-BnHfAUEN.js → validate-menu-C_kUDOhd.js} +2 -2
  57. package/dist/{catalog-YE_knev1.js → catalog-WBrPmQwl.js} +1 -1
  58. package/dist/{catalogSetting-CeVHRHOo.js → catalogSetting-BAry7I_V.js} +1 -1
  59. package/dist/{category-Dph1iWr8.js → category-bW36h16p.js} +1 -1
  60. package/dist/{currency-Byslycrk.js → currency-vVxHIVBs.js} +1 -1
  61. package/dist/{index-C0T32LLy.js → index-Ba5-dCQA.js} +1 -1
  62. package/dist/{index-CUTY6cCm.js → index-C0EV3eSc.js} +20 -20
  63. package/dist/{index-DycbrG1l.js → index-XZlEgR2k.js} +8 -7
  64. package/dist/{index-Ddt_Nw9F.js → index-pxnQHVnU.js} +4 -4
  65. package/dist/{menu-tHhzkxDL.js → index.vue_vue_type_script_setup_true_lang-CFPMPQFg.js} +18612 -18558
  66. package/dist/item-mFv0bFSn.js +7648 -0
  67. package/dist/{iteration-CcobmcUk.js → iteration-CaFp1Rtz.js} +3 -3
  68. package/dist/{jszip.min-DQrtMdm5.js → jszip.min-BkSmQKmf.js} +353 -353
  69. package/dist/{menu-DkRrqTVY.js → menu-ud-tWfIM.js} +1 -1
  70. package/dist/{menuV2-DJevKCqE.js → menuV2-xUMdUls0.js} +65 -65
  71. package/dist/mf-menu.css +1 -1
  72. package/dist/{priceTier-Bkogs1qc.js → priceTier-BVTab4k1.js} +1 -1
  73. package/dist/{scheduler-BGQ_lxUL.js → scheduler-CAt7sELO.js} +13 -12
  74. package/dist/{subcategory-DvxvLe8X.js → subcategory-DMZuedoM.js} +2 -2
  75. package/dist/{toExcel-DQ4jlZPI.js → toExcel-CczXOnKy.js} +2 -2
  76. package/dist/{unit-DoxpI5dG.js → unit-CbD3sYqC.js} +2 -2
  77. package/package.json +4 -3
  78. package/dist/LinkProductSideSheet-C4yBnJSM.js +0 -361
  79. package/dist/MenuSetting-Fxl8F6N5.js +0 -618
  80. package/dist/Products-BLvwrz9P.js +0 -689
  81. package/dist/app-CjfWVFOg.js +0 -363
  82. package/dist/customAttributes-DvbvCfOd.js +0 -180
  83. package/dist/index.vue_vue_type_script_setup_true_lang-B1_JqsYF.js +0 -57
  84. package/dist/item-x1WWjISR.js +0 -9175
@@ -1,618 +0,0 @@
1
- import { defineComponent as le, ref as $, computed as V, watch as P, resolveComponent as g, createBlock as W, openBlock as y, unref as e, withCtx as p, createElementVNode as r, createVNode as l, createElementBlock as R, Fragment as ue, renderList as oe, toDisplayString as D, createCommentVNode as z, withModifiers as be } from "vue";
2
- import { u as ae, I as X, D as ce, A as ge, H as re } from "./menu-tHhzkxDL.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 E, useDialog as ye, useSnackbar as pe, useBreakpoints as he, FmButtonColorThemeVariant as te } from "@feedmepos/ui-library";
5
- import { u as ke, c as Ce, m as K, _ as Z, a as H, f as Y } from "./customAttributes-DvbvCfOd.js";
6
- import { _ as _e } from "./app-CjfWVFOg.js";
7
- import { b as J } from "./app-CzXxFrl1.js";
8
- import { u as Se } from "./discardConfirm-BHni0LNu.js";
9
- import { _ as xe } from "./PageLayout.vue_vue_type_script_setup_true_lang-vFqWGM6P.js";
10
- import { C as j, a as N } from "./catalogSetting-CeVHRHOo.js";
11
- import { u as we } from "./priceTier-Bkogs1qc.js";
12
- const Re = {
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
- }, Ve = {
19
- class: "grid md:grid-cols-3 gap-16"
20
- }, Fe = {
21
- class: "md:col-span-2 space-y-16"
22
- }, Ue = {
23
- class: "flex justify-end"
24
- }, $e = {
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(Q, {
36
- emit: u
37
- }) {
38
- const S = Q, G = u, {
39
- t: i
40
- } = se(), A = ae(), t = $({
41
- name: "",
42
- description: "",
43
- rules: []
44
- }), {
45
- attributes: k
46
- } = ie({
47
- valueSource: de().restaurants,
48
- entity: "restaurant"
49
- }), {
50
- attributes: F
51
- } = ie({
52
- valueSource: V(() => A.state.menu.modules.item || []),
53
- entity: "item"
54
- }), {
55
- restaurantAttributes: h
56
- } = ke(), {
57
- itemAttributes: M,
58
- convertCategoryIdToName: T,
59
- convertCategoryNameToId: I
60
- } = Ce({
61
- menuItems: V(() => A.state.menu.modules.item || []),
62
- categories: V(() => A.categories || [])
63
- }), x = V({
64
- get: () => S.modelValue,
65
- set: (o) => G("update:modelValue", o)
66
- }), L = $(null);
67
- P(() => S.editingGroup, (o) => {
68
- o ? t.value = {
69
- name: o.name,
70
- description: o.description,
71
- rules: o.rules.map((s) => ({
72
- ...s,
73
- restaurantRule: s.restaurantRule ? {
74
- restaurantAttributes: K(s.restaurantRule.restaurantAttributes),
75
- restaurantCustomAttributes: K(s.restaurantRule.restaurantCustomAttributes)
76
- } : void 0,
77
- itemRule: s.itemRule ? {
78
- itemAttributes: T(K(s.itemRule.itemAttributes)),
79
- itemCustomAttributes: K(s.itemRule.itemCustomAttributes)
80
- } : void 0
81
- }))
82
- } : t.value = {
83
- name: "",
84
- description: "",
85
- rules: []
86
- }, L.value = X.cloneDeep(t.value);
87
- }, {
88
- immediate: !0
89
- }), P(() => S.modelValue, (o) => {
90
- o || (t.value = {
91
- name: "",
92
- description: "",
93
- rules: []
94
- });
95
- });
96
- function U(o) {
97
- return `${o}_${(/* @__PURE__ */ new Date()).toISOString()}`;
98
- }
99
- async function _() {
100
- var s;
101
- const o = {
102
- _id: ((s = S.editingGroup) == null ? void 0 : s._id) ?? U("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(I(a.itemRule.itemAttributes)),
113
- itemCustomAttributes: Y(a.itemRule.itemCustomAttributes)
114
- } : void 0
115
- }))
116
- };
117
- G("submit", o);
118
- }
119
- function m() {
120
- t.value.rules.push({
121
- _id: U("rule"),
122
- restaurantRule: {
123
- restaurantAttributes: null,
124
- restaurantCustomAttributes: null
125
- },
126
- itemRule: {
127
- itemAttributes: null,
128
- itemCustomAttributes: null
129
- }
130
- });
131
- }
132
- function v(o) {
133
- t.value.rules.splice(o, 1);
134
- }
135
- function C(o, s, a) {
136
- t.value.rules[o].restaurantRule || (t.value.rules[o].restaurantRule = {}), me(s) ? t.value.rules[o].restaurantRule[a] = null : t.value.rules[o].restaurantRule[a] = s;
137
- }
138
- function n(o, s, a) {
139
- t.value.rules[o].itemRule || (t.value.rules[o].itemRule = {}), me(s) ? t.value.rules[o].itemRule[a] = null : t.value.rules[o].itemRule[a] = s;
140
- }
141
- function c() {
142
- x.value = !1;
143
- }
144
- const f = Se(() => !X.isEqual(L.value, t.value), () => {
145
- x.value = !1;
146
- });
147
- return (o, s) => {
148
- const a = g("fm-button"), d = g("FmTextField"), ee = g("FmCard"), ve = g("FmFormGroup"), fe = g("fm-side-sheet");
149
- return y(), W(fe, {
150
- modelValue: x.value,
151
- "onUpdate:modelValue": s[3] || (s[3] = (b) => x.value = b),
152
- "is-container": e(ne).FmForm,
153
- "is-container-props": {
154
- onValidationSuccess: _,
155
- blameFormChildOnValidationFailed: !0
156
- },
157
- "max-width": 760,
158
- "onOn:clickedAway": e(f)
159
- }, {
160
- "side-sheet-header": p(() => [l(a, {
161
- variant: e(E).Tertiary,
162
- class: "cursor-pointer mr-4",
163
- "prepend-icon": "arrow_back",
164
- onClick: s[0] || (s[0] = () => x.value = !1)
165
- }, null, 8, ["variant"]), r("p", Re, D(Q.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: c
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(d, {
181
- label: e(i)("menu.rule_groups.form.name"),
182
- "label-mark": "required",
183
- modelValue: t.value.name,
184
- "onUpdate:modelValue": s[1] || (s[1] = (b) => t.value.name = b),
185
- placeholder: e(i)("menu.rule_groups.form.name_placeholder"),
186
- required: "",
187
- rules: [(b) => !!(b != null && b.trim()) || e(i)("menu.rule_groups.validation.name_required")]
188
- }, null, 8, ["label", "modelValue", "placeholder", "rules"]), l(d, {
189
- label: e(i)("menu.rule_groups.form.description"),
190
- "label-mark": "optional",
191
- modelValue: t.value.description,
192
- "onUpdate:modelValue": s[2] || (s[2] = (b) => t.value.description = b),
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(ve, {
199
- tag: "div",
200
- "model-value": t.value.rules,
201
- rules: [(b) => b.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(() => [(y(!0), R(ue, null, oe(t.value.rules, (b, O) => (y(), W(ee, {
208
- key: O,
209
- class: "p-16 space-y-16",
210
- variant: "outlined"
211
- }, {
212
- default: p(() => [r("div", Ve, [r("div", Fe, [l(H, {
213
- label: e(i)("menu.link_product.rules.restaurant_filter")
214
- }, {
215
- default: p(() => {
216
- var w;
217
- return [l(e(J), {
218
- attributes: e(h),
219
- "model-value": ((w = b.restaurantRule) == null ? void 0 : w.restaurantAttributes) || e(q),
220
- "onUpdate:modelValue": (B) => C(O, B, "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 w;
229
- return [l(e(J), {
230
- attributes: e(k),
231
- "model-value": ((w = b.restaurantRule) == null ? void 0 : w.restaurantCustomAttributes) || e(q),
232
- "onUpdate:modelValue": (B) => C(O, B, "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 w;
241
- return [l(e(J), {
242
- attributes: e(M),
243
- "model-value": ((w = b.itemRule) == null ? void 0 : w.itemAttributes) || e(q),
244
- "onUpdate:modelValue": (B) => n(O, B, "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 w;
253
- return [l(e(J), {
254
- attributes: e(F),
255
- "model-value": ((w = b.itemRule) == null ? void 0 : w.itemCustomAttributes) || e(q),
256
- "onUpdate:modelValue": (B) => n(O, B, "itemCustomAttributes")
257
- }, null, 8, ["attributes", "model-value", "onUpdate:modelValue"])];
258
- }),
259
- _: 2
260
- }, 1032, ["label"])])]), r("div", Ue, [l(a, {
261
- variant: e(E).Tertiary,
262
- "prepend-icon": "delete",
263
- onClick: (w) => v(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: m
269
- }, null, 8, ["label"])])]),
270
- _: 1
271
- }, 8, ["title", "sub-title"])]),
272
- _: 1
273
- }, 8, ["model-value", "rules"])])]),
274
- _: 1
275
- }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
276
- };
277
- }
278
- }), Me = {
279
- key: 0,
280
- class: "space-y-8"
281
- }, Ie = {
282
- class: "flex items-center justify-between"
283
- }, Be = {
284
- class: "fm-typo-en-title-md-600"
285
- }, Ne = {
286
- class: "text-fm-color-typo-secondary"
287
- }, De = {
288
- class: "flex justify-end items-center"
289
- }, Ee = {
290
- class: "w-[320px]"
291
- }, Le = {
292
- key: 1,
293
- class: "flex-1 flex flex-col min-h-0"
294
- }, Oe = {
295
- class: "flex items-center justify-between p-8"
296
- }, je = {
297
- class: "flex-1 mr-8"
298
- }, ze = {
299
- class: "flex flex-1 flex-col min-h-0 overflow-scroll divide-y divide-fm-color-neutral-gray-100 pb-64"
300
- }, Pe = ["onClick"], Qe = {
301
- class: "flex-1 space-y-4"
302
- }, qe = {
303
- class: "fm-typo-en-body-lg-600"
304
- }, Ke = {
305
- key: 0,
306
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
307
- }, He = /* @__PURE__ */ le({
308
- __name: "LinkProductRuleGroups",
309
- setup(Q) {
310
- const {
311
- t: u
312
- } = se(), S = ye(), G = pe(), i = ce(G), 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 k = $(!1), F = $(null), h = he(), M = V(() => h.breakpoints.value.xs), T = $(""), I = V(() => t.value.groups.filter((n) => n.name.toLowerCase().includes(T.value.toLowerCase()))), x = [{
323
- header: u("menu.rule_groups.table.columns.name"),
324
- accessorKey: "name",
325
- enableSorting: !0
326
- }, {
327
- header: u("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: E.Tertiary,
339
- onClick: (c) => {
340
- c.stopPropagation(), m(n.row.original._id);
341
- }
342
- }, null)])
343
- }];
344
- function L(n) {
345
- _(n.original);
346
- }
347
- function U() {
348
- F.value = null, k.value = !0;
349
- }
350
- function _(n) {
351
- F.value = n, k.value = !0;
352
- }
353
- function m(n) {
354
- const c = t.value.groups.find((f) => f._id === n);
355
- c && S.open({
356
- title: u("menu.rule_groups.delete_dialog.title"),
357
- message: u("menu.rule_groups.delete_dialog.message", {
358
- name: c.name
359
- }),
360
- primaryActions: {
361
- text: u("menu.common.actions.remove"),
362
- close: !1,
363
- variant: E.Destructive
364
- },
365
- secondaryActions: {
366
- text: u("menu.common.actions.cancel"),
367
- close: !0
368
- }
369
- }).onPrimary(async () => {
370
- const f = X.cloneDeep(t.value);
371
- f.groups = f.groups.filter((o) => o._id !== n), await v(f), S.close();
372
- });
373
- }
374
- async function v(n) {
375
- await i.minor(async () => {
376
- await A.updateMenuSetting({
377
- ruleGroupSettings: n
378
- });
379
- }, {
380
- successMessage: u("menu.rule_groups.saved_successfully")
381
- });
382
- }
383
- async function C(n) {
384
- var o;
385
- const c = (o = t.value.groups) == null ? void 0 : o.findIndex((s) => s._id === n._id), f = X.cloneDeep(t.value);
386
- c >= 0 ? f.groups[c] = n : f.groups.push(n), await v(f), k.value = !1;
387
- }
388
- return P(() => k.value, (n) => {
389
- n || (F.value = null);
390
- }), (n, c) => {
391
- const f = g("FmButton"), o = g("FmSearch"), s = g("FmTable");
392
- return y(), R("div", null, [M.value ? (y(), R("div", Le, [r("div", Oe, [r("div", je, [l(o, {
393
- modelValue: T.value,
394
- "onUpdate:modelValue": c[1] || (c[1] = (a) => T.value = a),
395
- autofocus: "",
396
- class: "w-full",
397
- placeholder: e(u)("menu.rule_groups.search_placeholder")
398
- }, null, 8, ["modelValue", "placeholder"])]), l(f, {
399
- icon: "add",
400
- variant: e(E).Secondary,
401
- onClick: U
402
- }, null, 8, ["variant"])]), r("div", ze, [(y(!0), R(ue, null, oe(I.value, (a) => (y(), R("div", {
403
- key: a._id,
404
- class: "flex flex-row py-12 px-16 cursor-pointer",
405
- onClick: (d) => _(a)
406
- }, [r("div", Qe, [r("p", qe, D(a.name), 1), a.description ? (y(), R("p", Ke, D(a.description), 1)) : z("", !0)]), l(f, {
407
- "text-color": e(te).NeutralGray400,
408
- variant: e(E).Tertiary,
409
- icon: "delete",
410
- onClick: be((d) => m(a._id), ["stop"])
411
- }, null, 8, ["text-color", "variant", "onClick"])], 8, Pe))), 128))])])) : (y(), R("div", Me, [r("div", Ie, [r("div", null, [r("h1", Be, D(e(u)("menu.rule_groups.title")), 1), r("p", Ne, D(e(u)("menu.rule_groups.description")), 1)]), l(f, {
412
- label: e(u)("menu.rule_groups.create_group"),
413
- icon: "add",
414
- onClick: U
415
- }, null, 8, ["label"])]), r("div", De, [r("div", Ee, [l(o, {
416
- modelValue: T.value,
417
- "onUpdate:modelValue": c[0] || (c[0] = (a) => T.value = a),
418
- autofocus: "",
419
- class: "mb-8",
420
- placeholder: e(u)("menu.rule_groups.search_placeholder")
421
- }, null, 8, ["modelValue", "placeholder"])])]), l(_e, null, {
422
- default: p(() => [l(s, {
423
- "column-defs": x,
424
- "row-data": I.value,
425
- "page-size": I.value.length,
426
- "hide-footer": !0,
427
- onRowClick: L
428
- }, null, 8, ["row-data", "page-size"])]),
429
- _: 1
430
- })])), l(Ge, {
431
- modelValue: k.value,
432
- "onUpdate:modelValue": c[2] || (c[2] = (a) => k.value = a),
433
- "editing-group": F.value,
434
- onSubmit: C
435
- }, null, 8, ["modelValue", "editing-group"])]);
436
- };
437
- }
438
- }), Ye = {
439
- class: "py-16"
440
- }, Je = {
441
- key: 0,
442
- class: "space-y-32 max-w-[750px] xs:p-16"
443
- }, We = {
444
- key: 0,
445
- class: "pl-32 space-x-8"
446
- }, Xe = {
447
- key: 1
448
- }, Ze = {
449
- class: "space-y-8"
450
- }, et = {
451
- class: "flex items-center justify-between"
452
- }, tt = {
453
- class: "fm-typo-en-title-md-600"
454
- }, lt = {
455
- class: "text-fm-color-typo-secondary"
456
- }, ut = {
457
- key: 2
458
- }, vt = /* @__PURE__ */ le({
459
- __name: "MenuSetting",
460
- setup(Q) {
461
- var U;
462
- const {
463
- t: u
464
- } = se(), S = ae(), G = de(), i = pe(), A = ce(i), t = V(() => ({
465
- lowStock: S.state.menu.lowStockThreshold,
466
- taxSetting: S.state.menu.masterCatalogSetting,
467
- priceTierSettings: S.state.menu.priceTierSettings
468
- })), k = $("conf"), F = V(() => [{
469
- label: u("menu.menu_setting.tabs.menu_configuration"),
470
- value: "conf"
471
- }, ...S.isV4 ? [{
472
- label: u("menu.menu_setting.tabs.price_group"),
473
- value: "price-group"
474
- }, {
475
- label: u("menu.menu_setting.tabs.link_product_rule_groups"),
476
- value: "link-product-rule-groups"
477
- }] : []]), h = $(j.transformTax((U = t.value.taxSetting) == null ? void 0 : U.inclusiveTaxes));
478
- P(() => t.value, (_) => {
479
- var m;
480
- h.value = j.transformTax((m = _.taxSetting) == null ? void 0 : m.inclusiveTaxes);
481
- });
482
- const M = V(() => {
483
- if (!G.currentCountry.value) return [];
484
- const _ = h.value.mode === N.MANUAL ? h.value.inclusive ?? [] : [];
485
- return ge.Country.getCountry(G.currentCountry.value).taxSystems.map((v) => {
486
- const C = _.find((n) => n.systemCode === v.code);
487
- return {
488
- inclusive: (C == null ? void 0 : C.inclusive) || !1,
489
- systemCode: v.code
490
- };
491
- });
492
- });
493
- function T(_) {
494
- const m = h.value, v = m.mode === N.AUTO ? j.manualTax(M.value) : re(m);
495
- v.inclusive ?? (v.inclusive = []);
496
- const C = v.inclusive.findIndex((n) => n.systemCode === _.systemCode);
497
- C < 0 ? v.inclusive.push(_) : v.inclusive.splice(C, 1, _), h.value = v;
498
- }
499
- async function I() {
500
- if (t.value.lowStock !== null && t.value.lowStock !== void 0 && !Number.isInteger(t.value.lowStock))
501
- return;
502
- const _ = h.value.mode === N.AUTO ? null : re(h.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 S.updateMenuSetting({
506
- masterCatalogSetting: {
507
- inclusiveTaxes: _
508
- },
509
- lowStockThreshold: m ? null : t.value.lowStock,
510
- priceTierSettings: x.priceTiers.value
511
- });
512
- }, {
513
- successMessage: u("menu.menu_setting.fields.low_stock.updated")
514
- });
515
- }
516
- const x = we(), L = [{
517
- header: u("menu.price_tier.settings_table.columns.name"),
518
- accessorKey: "key",
519
- enableSorting: !1
520
- }, {
521
- id: "actions",
522
- size: 50,
523
- cell: (_) => l("div", {
524
- class: "px-4 flex justify-end"
525
- }, [l(ne.FmButton, {
526
- icon: "delete",
527
- "text-color": te.NeutralGray400,
528
- variant: E.Tertiary,
529
- onClick: () => x.deletePriceTier(_.row.original.key)
530
- }, null)])
531
- }];
532
- return (_, m) => {
533
- const v = g("FmTabs"), C = g("fm-radio"), n = g("fm-radio-group"), c = g("fm-checkbox"), f = g("FormItem"), o = g("FmStepperField"), s = g("FmButton"), a = g("FmTable");
534
- return y(), W(xe, {
535
- heading: e(u)("menu.menu_setting.title")
536
- }, {
537
- default: p(() => [l(v, {
538
- items: F.value,
539
- modelValue: k.value,
540
- "onUpdate:modelValue": m[0] || (m[0] = (d) => k.value = d)
541
- }, null, 8, ["items", "modelValue"]), r("div", Ye, [k.value === "conf" ? (y(), R("div", Je, [l(Z, {
542
- title: "Tax setting"
543
- }, {
544
- default: p(() => [l(f, {
545
- label: e(u)("menu.setting.tax.title")
546
- }, {
547
- default: p(() => [l(n, {
548
- "model-value": h.value.mode,
549
- "onUpdate:modelValue": m[1] || (m[1] = (d) => {
550
- d === e(N).AUTO ? h.value = e(j).autoTax() : h.value = e(j).manualTax(M.value);
551
- })
552
- }, {
553
- default: p(() => [l(C, {
554
- value: e(N).AUTO,
555
- label: e(u)("menu.setting.tax.modes.auto.label"),
556
- sublabel: e(u)("menu.setting.tax.modes.auto.sublabel")
557
- }, null, 8, ["value", "label", "sublabel"]), l(C, {
558
- value: e(N).MANUAL,
559
- label: e(u)("menu.setting.tax.modes.manual.label"),
560
- sublabel: e(u)("menu.setting.tax.modes.manual.sublabel")
561
- }, null, 8, ["value", "label", "sublabel"])]),
562
- _: 1
563
- }, 8, ["model-value"]), h.value.mode === e(N).MANUAL ? (y(), R("div", We, [(y(!0), R(ue, null, oe(M.value, (d) => (y(), W(c, {
564
- key: d.systemCode,
565
- "model-value": d.inclusive,
566
- value: !0,
567
- label: d.systemCode + " inclusive",
568
- "onUpdate:modelValue": (ee) => {
569
- T({
570
- ...d,
571
- inclusive: ee
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(u)("menu.menu_setting.fields.low_stock.title"),
580
- "sub-title": e(u)("menu.menu_setting.fields.low_stock.subtitle")
581
- }, {
582
- default: p(() => [l(o, {
583
- "model-value": t.value.lowStock || null,
584
- min: 0,
585
- max: 1e3,
586
- step: 1,
587
- placeholder: e(u)("menu.menu_setting.fields.low_stock.not_set"),
588
- "onUpdate:modelValue": m[2] || (m[2] = (d) => {
589
- t.value.lowStock = d;
590
- }),
591
- rules: [(d) => d === null || Number.isInteger(d) || e(u)("menu.menu_setting.fields.low_stock.must_be_integer")],
592
- "helper-text": e(u)("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: I,
597
- label: e(u)("common.save")
598
- }, null, 8, ["label"])])) : z("", !0), k.value === "price-group" ? (y(), R("div", Xe, [r("div", Ze, [r("div", et, [r("div", null, [r("h1", tt, D(e(u)("menu.price_tier.price_group")), 1), r("p", lt, D(e(u)("menu.price_tier.description")), 1)]), l(s, {
599
- label: e(u)("menu.price_tier.add_price_group"),
600
- icon: "add",
601
- onClick: e(x).create
602
- }, null, 8, ["label", "onClick"])]), l(_e, null, {
603
- default: p(() => [l(a, {
604
- "column-defs": L,
605
- "row-data": e(x).priceTiers.value,
606
- "page-size": e(x).priceTiers.value.length,
607
- "hide-footer": !0
608
- }, null, 8, ["row-data", "page-size"])]),
609
- _: 1
610
- })])])) : z("", !0), k.value === "link-product-rule-groups" ? (y(), R("div", ut, [l(He)])) : z("", !0)])]),
611
- _: 1
612
- }, 8, ["heading"]);
613
- };
614
- }
615
- });
616
- export {
617
- vt as default
618
- };