@feedmepos/mf-menu 0.32.55 → 0.32.57-dev.1

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 (79) hide show
  1. package/dist/{App-D9i97kPC.js → App-C7XMC5tu.js} +7 -7
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BxhzKypm.js → ApplyProduct.vue_vue_type_script_setup_true_lang-E3y0Yzvz.js} +3 -3
  3. package/dist/{ApplyProductDialog.vue_vue_type_script_setup_true_lang-kPOpOatz.js → ApplyProductDialog.vue_vue_type_script_setup_true_lang-BzxL3LIz.js} +2 -2
  4. package/dist/{Catalog-DFJXgNsO.js → Catalog-wjLJ0FKr.js} +6 -6
  5. package/dist/{Category-DcN5huA8.js → Category-BVAF5jZq.js} +4 -4
  6. package/dist/{Category-FaheENIM.js → Category-C8NEdw1f.js} +4 -4
  7. package/dist/{CookingGuide-w9A6JMSR.js → CookingGuide-DkVCd-Tc.js} +5 -5
  8. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-BGCVlZ7J.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-Csn3gjAQ.js} +1 -1
  9. package/dist/{Group-DdqHR86E.js → Group-CFeW2ARj.js} +1 -1
  10. package/dist/{Group-Dy8HcG_Y.js → Group-DsuU26jf.js} +3 -3
  11. package/dist/{Group.vue_vue_type_script_setup_true_lang-Dvq7j79a.js → Group.vue_vue_type_script_setup_true_lang-BPgT_ckT.js} +8 -8
  12. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BBcE09pP.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Cl6AEPoD.js} +5 -5
  13. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-DbIKyjW3.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-BLK8bASJ.js} +7 -7
  14. package/dist/{Ingredient-gj1v3spC.js → Ingredient-CASi0MP2.js} +3 -3
  15. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-DV-RjIZv.js → InventoryBinding.vue_vue_type_script_setup_true_lang-a4r-l-jt.js} +2 -2
  16. package/dist/LinkProductSideSheet-Ci1_qEKm.js +721 -0
  17. package/dist/MenuSetting-CQxD3M9k.js +685 -0
  18. package/dist/{OrderPacing-D0FFFm3T.js → OrderPacing-CKpx1zWN.js} +6 -6
  19. package/dist/{PrintRoute-Cgcxblv_.js → PrintRoute-BDkeKHLa.js} +4 -4
  20. package/dist/{Product-Nti0T9iE.js → Product-DxkexFiq.js} +1 -1
  21. package/dist/{Product.vue_vue_type_script_setup_true_lang-DyWLMrUC.js → Product.vue_vue_type_script_setup_true_lang-DxkTpeIp.js} +66 -66
  22. package/dist/{ProductInternalTools-oOMZV7kK.js → ProductInternalTools-DMh7P9N6.js} +6 -6
  23. package/dist/{Products-9elHDYp6.js → Products-BaTN9Vrv.js} +31 -31
  24. package/dist/{Publish-Bi33tD6L.js → Publish-B-0kzb8B.js} +3 -3
  25. package/dist/{Recipe-BSysXC_H.js → Recipe-DiFdfvoL.js} +4 -4
  26. package/dist/{RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-BqsEM8Kj.js → RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-BZ6-uHC1.js} +1 -1
  27. package/dist/RuleView.vue_vue_type_script_setup_true_lang-C3d41j99.js +3305 -0
  28. package/dist/{Scheduler-CmXIA0tH.js → Scheduler-Y-r-uhl2.js} +3 -3
  29. package/dist/{ServingSequence-CPVOcSSM.js → ServingSequence-B2gZumZ5.js} +3 -3
  30. package/dist/{Setting-BQPHY7B-.js → Setting-CVIGpw-x.js} +5 -5
  31. package/dist/{Subcategory-DQAT58lU.js → Subcategory-CGBVYZ7Z.js} +5 -5
  32. package/dist/{Takeaway-DtyEbDDB.js → Takeaway-D4mIHqv6.js} +4 -4
  33. package/dist/{Takeaway-DOi4Xogf.js → Takeaway-DDTTQZak.js} +1 -1
  34. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-CNccXS8u.js → Takeaway.vue_vue_type_script_setup_true_lang-CJuJedKh.js} +5 -5
  35. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-D9VV1s1E.js → Thumbnail.vue_vue_type_script_setup_true_lang-AHNsIox6.js} +4 -4
  36. package/dist/{TranslationFieldSection.vue_vue_type_script_setup_true_lang-Cpg0cCuJ.js → TranslationFieldSection.vue_vue_type_script_setup_true_lang-CpEWc_Ff.js} +1 -1
  37. package/dist/{TranslationSideSheet.vue_vue_type_script_setup_true_lang-CGXXpcYQ.js → TranslationSideSheet.vue_vue_type_script_setup_true_lang-BPkpxT1s.js} +2 -2
  38. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Ddstxum-.js +5974 -0
  39. package/dist/{Unit-BVGd9vOo.js → Unit-DAHT36Af.js} +2 -2
  40. package/dist/{Variant-wgsEnYNH.js → Variant-0UJVh4AG.js} +3 -3
  41. package/dist/{_id_-XLbzesLX.js → _id_-BSzV5VHq.js} +9 -9
  42. package/dist/{app-DBDi3v7O.js → app-BpxsJTLh.js} +32 -32
  43. package/dist/{app-DXZuPEOd.js → app-RorQyO5L.js} +1 -1
  44. package/dist/app.js +1 -1
  45. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/thumbnailUpload.d.ts +6 -0
  46. package/dist/apps/mf-menu/src/components/feature/TreeEditor/image/ImageUploadForm.vue.d.ts +35 -29
  47. package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ProductDetail.vue.d.ts +3 -0
  48. package/dist/apps/mf-menu/src/components/rule_group/CatalogLinkItemRuleView.vue.d.ts +2 -0
  49. package/dist/apps/mf-menu/src/components/rule_group/RuleView.vue.d.ts +2 -0
  50. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  51. package/dist/assets/{linked-status-BELOy4Ju.js → linked-status-BUeQipEA.js} +2 -2
  52. package/dist/assets/{menu-export-BemM1bWH.js → menu-export-Vn3MYK3_.js} +2 -2
  53. package/dist/assets/{override-menu-BiwqdooM.js → override-menu-BpEh_6g3.js} +2 -2
  54. package/dist/assets/{validate-menu-mNalZZpy.js → validate-menu-De9rzE7_.js} +2 -2
  55. package/dist/{catalog-Beh91hfF.js → catalog-BBaS6Pnd.js} +1 -1
  56. package/dist/{catalogSetting-CvotY0sm.js → catalogSetting-BDnNmlnm.js} +1 -1
  57. package/dist/{currency-DWU0Lz6M.js → currency-BrkU2Vde.js} +1 -1
  58. package/dist/{dayjs.min-b9_NYDqQ.js → dayjs.min-DgpA8hFi.js} +2 -2
  59. package/dist/{index-B2zWt4Ih.js → index-DBAlmXib.js} +5 -5
  60. package/dist/{index-ZpjMtEkL.js → index-Dy5TC0x7.js} +5 -5
  61. package/dist/{index.vue_vue_type_script_setup_true_lang-CSSSNBt8.js → index.vue_vue_type_script_setup_true_lang-Bx__FUMc.js} +6 -6
  62. package/dist/{item-DtR73Afo.js → item-oY2LwWGC.js} +19 -19
  63. package/dist/{jszip.min-DgMmizjt.js → jszip.min-BbhegiH-.js} +175 -175
  64. package/dist/{memberPricing-RVw5I6LL.js → memberPricing-nYksLKBc.js} +1 -1
  65. package/dist/{menu-CaFnkDPh.js → menu-CJl8kr2v.js} +1 -1
  66. package/dist/{menuV2-CphaxHaj.js → menuV2-Cfjb_IgJ.js} +24 -24
  67. package/dist/mf-menu.css +1 -1
  68. package/dist/{order_pacing-CUyiMmGB.js → order_pacing-BPt_fRk7.js} +5 -5
  69. package/dist/{priceTier-CGLpjMw4.js → priceTier-BlOBX3x3.js} +1 -1
  70. package/dist/{rules-3d19nDAK.js → rules-BkSEsnpL.js} +3 -3
  71. package/dist/{scheduler-CyPQu2Jd.js → scheduler-Cl70ZIns.js} +4 -4
  72. package/dist/{toExcel-Dbqi_aWn.js → toExcel-BAeoALKB.js} +2 -2
  73. package/dist/{unit-CidyefuC.js → unit-BH96dkTh.js} +3 -3
  74. package/package.json +1 -1
  75. package/dist/LinkProductSideSheet-Bwt2W9XG.js +0 -687
  76. package/dist/MenuSetting-CRCDO92S.js +0 -648
  77. package/dist/RuleView.vue_vue_type_script_setup_true_lang-Cxl5Mvc1.js +0 -3285
  78. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Dl-6UT3T.js +0 -5940
  79. /package/dist/{vuedraggable-CK8z7qA8.js → RuleConditionSelector.vue_vue_type_style_index_0_lang-CK8z7qA8.js} +0 -0
@@ -0,0 +1,685 @@
1
+ import { defineComponent as X, ref as A, computed as M, watch as q, resolveComponent as y, createBlock as G, openBlock as d, unref as e, withCtx as g, createElementVNode as r, createVNode as o, createElementBlock as k, createCommentVNode as $, toDisplayString as B, withModifiers as ne, Fragment as oe, renderList as ue } from "vue";
2
+ import { u as Z, H as z, a5 as ae, B as se, z as me, G as le } from "./index.vue_vue_type_script_setup_true_lang-Bx__FUMc.js";
3
+ import { useI18n as Y, useCoreStore as ce } from "@feedmepos/mf-common";
4
+ import { components as K, FmButtonVariant as F, useDialog as de, useSnackbar as re, useBreakpoints as pe, FmButtonColorThemeVariant as E } from "@feedmepos/ui-library";
5
+ import { b as _e, m as H, _ as W, c as ve, d as ge, f as J } from "./RuleView.vue_vue_type_script_setup_true_lang-C3d41j99.js";
6
+ import { _ as ee } from "./app-BpxsJTLh.js";
7
+ import { d as fe } from "./RuleConditionSelector.vue_vue_type_style_index_0_lang-CK8z7qA8.js";
8
+ import { u as be } from "./discardConfirm-BHni0LNu.js";
9
+ import { _ as ye } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
10
+ import { _ as ie } from "./PageLayout.vue_vue_type_script_setup_true_lang-BVmHMvKD.js";
11
+ import { u as he } from "./memberPricing-nYksLKBc.js";
12
+ import { C as L, a as N } from "./catalogSetting-BDnNmlnm.js";
13
+ import { u as xe } from "./priceTier-BlOBX3x3.js";
14
+ const ke = {
15
+ class: "fm-typo-en-title-md-600 mr-auto"
16
+ }, we = {
17
+ class: "py-8 px-8 overflow-y-auto space-y-24"
18
+ }, Se = {
19
+ class: "space-y-16"
20
+ }, Ce = {
21
+ class: "flex items-center space-x-16"
22
+ }, Te = {
23
+ class: "flex flex-col min-w-0 w-full"
24
+ }, Re = {
25
+ class: "flex-1 relative border border-fm-color-neutral-gray-200 rounded-md p-16"
26
+ }, Fe = {
27
+ key: 0,
28
+ class: "flex items-center select-none ml-16"
29
+ }, Ve = {
30
+ class: "fm-typo-en-body-lg-400 text-fm-color-neutral-gray-300"
31
+ }, $e = {
32
+ class: "flex gap-8 items-center justify-start"
33
+ }, Ae = /* @__PURE__ */ X({
34
+ __name: "RuleGroupSideSheet",
35
+ props: {
36
+ modelValue: {
37
+ type: Boolean
38
+ },
39
+ editingGroup: {}
40
+ },
41
+ emits: ["update:modelValue", "submit"],
42
+ setup(Q, {
43
+ emit: n
44
+ }) {
45
+ const p = Q, T = n, {
46
+ t: m
47
+ } = Y(), S = Z(), l = A({
48
+ name: "",
49
+ description: "",
50
+ rules: []
51
+ }), {
52
+ convertCategoryIdToName: h,
53
+ convertCategoryNameToId: R
54
+ } = _e({
55
+ menuItems: M(() => S.state.menu.modules.item || []),
56
+ categories: M(() => S.categories || [])
57
+ }), v = M({
58
+ get: () => p.modelValue,
59
+ set: (a) => T("update:modelValue", a)
60
+ }), U = A(null);
61
+ q(() => p.editingGroup, (a) => {
62
+ a ? l.value = {
63
+ name: a.name,
64
+ description: a.description,
65
+ rules: a.rules.map((t) => ({
66
+ ...t,
67
+ restaurantRule: t.restaurantRule ? {
68
+ restaurantAttributes: H(t.restaurantRule.restaurantAttributes),
69
+ restaurantCustomAttributes: H(t.restaurantRule.restaurantCustomAttributes)
70
+ } : void 0,
71
+ itemRule: t.itemRule ? {
72
+ itemAttributes: h(H(t.itemRule.itemAttributes)),
73
+ itemCustomAttributes: H(t.itemRule.itemCustomAttributes)
74
+ } : void 0
75
+ }))
76
+ } : l.value = {
77
+ name: "",
78
+ description: "",
79
+ rules: []
80
+ }, U.value = z.cloneDeep(l.value);
81
+ }, {
82
+ immediate: !0
83
+ }), q(() => p.modelValue, (a) => {
84
+ a || (l.value = {
85
+ name: "",
86
+ description: "",
87
+ rules: []
88
+ });
89
+ });
90
+ function C(a) {
91
+ return `${a}_${(/* @__PURE__ */ new Date()).toISOString()}`;
92
+ }
93
+ async function I() {
94
+ var t;
95
+ const a = {
96
+ _id: ((t = p.editingGroup) == null ? void 0 : t._id) ?? C("group"),
97
+ name: l.value.name,
98
+ description: l.value.description,
99
+ rules: l.value.rules.map((u) => ({
100
+ _id: u._id,
101
+ restaurantRule: u.restaurantRule ? {
102
+ restaurantAttributes: J(u.restaurantRule.restaurantAttributes),
103
+ restaurantCustomAttributes: J(u.restaurantRule.restaurantCustomAttributes)
104
+ } : void 0,
105
+ itemRule: u.itemRule ? {
106
+ itemAttributes: J(R(u.itemRule.itemAttributes)),
107
+ itemCustomAttributes: J(u.itemRule.itemCustomAttributes)
108
+ } : void 0
109
+ }))
110
+ };
111
+ T("submit", a);
112
+ }
113
+ const V = () => ({
114
+ _id: C("rule"),
115
+ restaurantRule: {
116
+ restaurantAttributes: null,
117
+ restaurantCustomAttributes: null
118
+ },
119
+ itemRule: {
120
+ itemAttributes: null,
121
+ itemCustomAttributes: null
122
+ }
123
+ });
124
+ function O(a) {
125
+ l.value.rules = l.value.rules.filter((t) => t._id !== a);
126
+ }
127
+ function P(a) {
128
+ const t = l.value.rules.find((c) => c._id === a);
129
+ if (!t) return;
130
+ const u = z.cloneDeep(t);
131
+ u._id = C("rule"), l.value.rules.push(u);
132
+ }
133
+ function f() {
134
+ v.value = !1;
135
+ }
136
+ const _ = be(() => !z.isEqual(U.value, l.value), () => {
137
+ v.value = !1;
138
+ });
139
+ function b(a) {
140
+ l.value.rules.map((u) => u._id).includes(a.menuRule._id) ? l.value.rules = l.value.rules.map((u) => u._id === a.menuRule._id ? a.menuRule : u) : l.value.rules.push({
141
+ ...a.menuRule
142
+ });
143
+ }
144
+ const x = A();
145
+ return (a, t) => {
146
+ const u = y("fm-button"), c = y("FmTextField"), w = y("FmButton"), D = y("FmFormGroup"), s = y("fm-side-sheet");
147
+ return d(), G(s, {
148
+ modelValue: v.value,
149
+ "onUpdate:modelValue": t[8] || (t[8] = (i) => v.value = i),
150
+ "is-container": e(K).FmForm,
151
+ "is-container-props": {
152
+ onValidationSuccess: I,
153
+ blameFormChildOnValidationFailed: !0
154
+ },
155
+ "max-width": 760,
156
+ "onOn:clickedAway": e(_)
157
+ }, {
158
+ "side-sheet-header": g(() => [o(u, {
159
+ variant: e(F).Tertiary,
160
+ class: "cursor-pointer mr-4",
161
+ "prepend-icon": "arrow_back",
162
+ onClick: t[0] || (t[0] = () => v.value = !1)
163
+ }, null, 8, ["variant"]), r("p", ke, B(a.editingGroup ? e(m)("menu.rule_groups.edit_group") : e(m)("menu.rule_groups.create_group")), 1)]),
164
+ "side-sheet-footer": g(() => [r("div", $e, [o(u, {
165
+ label: e(m)("common.save"),
166
+ size: "lg",
167
+ type: "submit",
168
+ variant: "primary"
169
+ }, null, 8, ["label"]), o(u, {
170
+ label: e(m)("common.cancel"),
171
+ size: "lg",
172
+ variant: "tertiary",
173
+ onClick: f
174
+ }, null, 8, ["label"])])]),
175
+ default: g(() => [r("div", we, [o(W, {
176
+ title: e(m)("menu.rule_groups.form.basic_info")
177
+ }, {
178
+ default: g(() => [r("div", Se, [o(c, {
179
+ label: e(m)("menu.rule_groups.form.name"),
180
+ "label-mark": "required",
181
+ modelValue: l.value.name,
182
+ "onUpdate:modelValue": t[1] || (t[1] = (i) => l.value.name = i),
183
+ placeholder: e(m)("menu.rule_groups.form.name_placeholder"),
184
+ required: "",
185
+ rules: [(i) => !!(i != null && i.trim()) || e(m)("menu.rule_groups.validation.name_required")]
186
+ }, null, 8, ["label", "modelValue", "placeholder", "rules"]), o(c, {
187
+ label: e(m)("menu.rule_groups.form.description"),
188
+ "label-mark": "optional",
189
+ modelValue: l.value.description,
190
+ "onUpdate:modelValue": t[2] || (t[2] = (i) => l.value.description = i),
191
+ placeholder: e(m)("menu.rule_groups.form.description_placeholder"),
192
+ multiline: "",
193
+ rows: 3
194
+ }, null, 8, ["label", "modelValue", "placeholder"])])]),
195
+ _: 1
196
+ }, 8, ["title"]), o(D, {
197
+ tag: "div",
198
+ "model-value": l.value.rules,
199
+ rules: [(i) => i.length > 0 || e(m)("menu.rule_groups.validation.at_least_one_rule_required")]
200
+ }, {
201
+ default: g(() => [o(W, {
202
+ title: e(m)("menu.rule_groups.form.rules"),
203
+ "sub-title": e(m)("menu.rule_groups.form.rules_description")
204
+ }, {
205
+ default: g(() => [l.value.rules.length > 0 ? (d(), G(e(fe), {
206
+ key: 0,
207
+ modelValue: l.value.rules,
208
+ "onUpdate:modelValue": t[6] || (t[6] = (i) => l.value.rules = i),
209
+ handle: ".rule-drag-handle",
210
+ "item-key": "_id"
211
+ }, {
212
+ item: g(({
213
+ element: i,
214
+ index: te
215
+ }) => [r("div", null, [r("div", Ce, [o(w, {
216
+ class: "rule-drag-handle cursor-grab",
217
+ variant: e(F).Tertiary,
218
+ "prepend-icon": "drag_indicator"
219
+ }, null, 8, ["variant"]), r("div", Te, [r("div", Re, [o(ve, {
220
+ "model-value": i,
221
+ title: `${e(m)("menu.rule_groups.condition_view.rule")} ${te + 1}`,
222
+ "onUpdate:modelValue": t[3] || (t[3] = (j) => b(j)),
223
+ onDeleteRule: t[4] || (t[4] = (j) => O(j)),
224
+ onCopyRule: t[5] || (t[5] = (j) => P(j))
225
+ }, null, 8, ["model-value", "title"])])])]), l.value.rules.length > 1 && te < l.value.rules.length - 1 ? (d(), k("div", Fe, [r("span", Ve, B(e(m)("menu.rule_groups.condition_view.or")), 1)])) : $("", !0)])]),
226
+ _: 1
227
+ }, 8, ["modelValue"])) : (d(), G(ae, {
228
+ key: 1,
229
+ title: "",
230
+ subtitle: e(m)("menu.rule_groups.condition_view.empty_data.no_rule_available"),
231
+ action: {
232
+ text: e(m)("menu.link_product.rules.add_rule"),
233
+ callback: () => {
234
+ var i;
235
+ (i = x.value) == null || i.trigger();
236
+ }
237
+ }
238
+ }, null, 8, ["subtitle", "action"])), r("div", null, [o(ge, {
239
+ ref_key: "ruleFormRef",
240
+ ref: x,
241
+ "is-edit-mode": !0,
242
+ "model-value": V(),
243
+ "onUpdate:modelValue": t[7] || (t[7] = (i) => b(i))
244
+ }, {
245
+ default: g(({
246
+ trigger: i
247
+ }) => [l.value.rules.length > 0 ? (d(), G(w, {
248
+ key: 0,
249
+ variant: e(F).Primary,
250
+ label: e(m)("menu.link_product.rules.add_rule"),
251
+ "prepend-icon": "add",
252
+ onClick: ne(i, ["stop"])
253
+ }, null, 8, ["variant", "label", "onClick"])) : $("", !0)]),
254
+ _: 1
255
+ }, 8, ["model-value"])])]),
256
+ _: 1
257
+ }, 8, ["title", "sub-title"])]),
258
+ _: 1
259
+ }, 8, ["model-value", "rules"])])]),
260
+ _: 1
261
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
262
+ };
263
+ }
264
+ }), Ge = {
265
+ key: 0,
266
+ class: "space-y-8"
267
+ }, Me = {
268
+ class: "flex items-center justify-between"
269
+ }, Ue = {
270
+ class: "fm-typo-en-title-md-600"
271
+ }, Be = {
272
+ class: "text-fm-color-typo-secondary"
273
+ }, Ie = {
274
+ class: "flex justify-end items-center"
275
+ }, Pe = {
276
+ class: "w-[320px]"
277
+ }, De = {
278
+ key: 1,
279
+ class: "flex-1 flex flex-col min-h-0"
280
+ }, Ne = {
281
+ class: "flex items-center justify-between p-8"
282
+ }, ze = {
283
+ class: "flex-1 mr-8"
284
+ }, Oe = {
285
+ class: "flex flex-1 flex-col min-h-0 overflow-scroll divide-y divide-fm-color-neutral-gray-100 pb-64"
286
+ }, je = ["onClick"], Le = {
287
+ class: "flex-1 space-y-4"
288
+ }, Ee = {
289
+ class: "fm-typo-en-body-lg-600"
290
+ }, qe = {
291
+ key: 0,
292
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
293
+ }, Ke = /* @__PURE__ */ X({
294
+ __name: "LinkProductRuleGroups",
295
+ setup(Q) {
296
+ const {
297
+ t: n
298
+ } = Y(), p = de(), T = re(), m = se(T), S = Z(), l = A(S.state.menu.ruleGroupSettings || {
299
+ groups: []
300
+ });
301
+ q(() => S.state.menu.ruleGroupSettings, (t) => {
302
+ l.value = t || {
303
+ groups: []
304
+ };
305
+ }, {
306
+ deep: !0
307
+ });
308
+ const h = A(!1), R = A(null), v = pe(), U = M(() => v.breakpoints.value.xs), C = A(""), I = M(() => l.value.groups.filter((t) => t.name.toLowerCase().includes(C.value.toLowerCase()))), V = [{
309
+ header: n("menu.rule_groups.table.columns.name"),
310
+ accessorKey: "name",
311
+ enableSorting: !0
312
+ }, {
313
+ header: n("menu.rule_groups.table.columns.description"),
314
+ accessorKey: "description",
315
+ enableSorting: !1
316
+ }, {
317
+ id: "actions",
318
+ size: 100,
319
+ cell: (t) => o("div", {
320
+ class: "px-4 flex justify-end"
321
+ }, [o(K.FmButton, {
322
+ icon: "file_copy",
323
+ "text-color": E.NeutralGray400,
324
+ variant: F.Tertiary,
325
+ onClick: (u) => {
326
+ u.stopPropagation(), b(t.row.original);
327
+ }
328
+ }, null), o(K.FmButton, {
329
+ icon: "delete",
330
+ "text-color": E.NeutralGray400,
331
+ variant: F.Tertiary,
332
+ onClick: (u) => {
333
+ u.stopPropagation(), _(t.row.original._id);
334
+ }
335
+ }, null)])
336
+ }];
337
+ function O(t) {
338
+ f(t.original);
339
+ }
340
+ function P() {
341
+ R.value = null, h.value = !0;
342
+ }
343
+ function f(t) {
344
+ R.value = t, h.value = !0;
345
+ }
346
+ function _(t) {
347
+ const u = l.value.groups.find((c) => c._id === t);
348
+ u && p.open({
349
+ title: n("menu.rule_groups.delete_dialog.title"),
350
+ message: n("menu.rule_groups.delete_dialog.message", {
351
+ name: u.name
352
+ }),
353
+ primaryActions: {
354
+ text: n("menu.common.actions.remove"),
355
+ close: !1,
356
+ variant: F.Destructive
357
+ },
358
+ secondaryActions: {
359
+ text: n("menu.common.actions.cancel"),
360
+ close: !0
361
+ }
362
+ }).onPrimary(async () => {
363
+ const c = z.cloneDeep(l.value);
364
+ c.groups = c.groups.filter((w) => w._id !== t), await x(c), p.close();
365
+ });
366
+ }
367
+ async function b(t) {
368
+ const u = {
369
+ ...t,
370
+ _id: `group_${(/* @__PURE__ */ new Date()).toISOString()}`,
371
+ name: `${t.name}_copy`
372
+ }, c = z.cloneDeep(l.value);
373
+ c.groups.push(u), await x(c);
374
+ }
375
+ async function x(t) {
376
+ await m.minor(async () => {
377
+ await S.updateMenuSetting({
378
+ ruleGroupSettings: t
379
+ });
380
+ }, {
381
+ successMessage: n("menu.rule_groups.saved_successfully")
382
+ });
383
+ }
384
+ async function a(t) {
385
+ var w;
386
+ const u = (w = l.value.groups) == null ? void 0 : w.findIndex((D) => D._id === t._id), c = z.cloneDeep(l.value);
387
+ u >= 0 ? c.groups[u] = t : c.groups.push(t), await x(c), h.value = !1;
388
+ }
389
+ return q(() => h.value, (t) => {
390
+ t || (R.value = null);
391
+ }), (t, u) => {
392
+ const c = y("FmButton"), w = y("FmSearch"), D = y("FmTable");
393
+ return d(), k("div", null, [U.value ? (d(), k("div", De, [r("div", Ne, [r("div", ze, [o(w, {
394
+ modelValue: C.value,
395
+ "onUpdate:modelValue": u[1] || (u[1] = (s) => C.value = s),
396
+ autofocus: "",
397
+ class: "w-full",
398
+ placeholder: e(n)("menu.rule_groups.search_placeholder")
399
+ }, null, 8, ["modelValue", "placeholder"])]), o(c, {
400
+ icon: "add",
401
+ variant: e(F).Secondary,
402
+ onClick: P
403
+ }, null, 8, ["variant"])]), r("div", Oe, [(d(!0), k(oe, null, ue(I.value, (s) => (d(), k("div", {
404
+ key: s._id,
405
+ class: "flex flex-row py-12 px-16 cursor-pointer",
406
+ onClick: (i) => f(s)
407
+ }, [r("div", Le, [r("p", Ee, B(s.name), 1), s.description ? (d(), k("p", qe, B(s.description), 1)) : $("", !0)]), o(c, {
408
+ "text-color": e(E).NeutralGray400,
409
+ variant: e(F).Tertiary,
410
+ icon: "delete",
411
+ onClick: ne((i) => _(s._id), ["stop"])
412
+ }, null, 8, ["text-color", "variant", "onClick"])], 8, je))), 128))])])) : (d(), k("div", Ge, [r("div", Me, [r("div", null, [r("h1", Ue, B(e(n)("menu.rule_groups.title")), 1), r("p", Be, B(e(n)("menu.rule_groups.description")), 1)]), o(c, {
413
+ label: e(n)("menu.rule_groups.create_group"),
414
+ icon: "add",
415
+ onClick: P
416
+ }, null, 8, ["label"])]), r("div", Ie, [r("div", Pe, [o(w, {
417
+ modelValue: C.value,
418
+ "onUpdate:modelValue": u[0] || (u[0] = (s) => C.value = s),
419
+ autofocus: "",
420
+ class: "mb-8",
421
+ placeholder: e(n)("menu.rule_groups.search_placeholder")
422
+ }, null, 8, ["modelValue", "placeholder"])])]), o(ee, null, {
423
+ default: g(() => [o(D, {
424
+ "column-defs": V,
425
+ "row-data": I.value,
426
+ "page-size": I.value.length,
427
+ "hide-footer": !0,
428
+ onRowClick: O
429
+ }, null, 8, ["row-data", "page-size"])]),
430
+ _: 1
431
+ })])), o(Ae, {
432
+ modelValue: h.value,
433
+ "onUpdate:modelValue": u[2] || (u[2] = (s) => h.value = s),
434
+ "editing-group": R.value,
435
+ onSubmit: a
436
+ }, null, 8, ["modelValue", "editing-group"])]);
437
+ };
438
+ }
439
+ }), Qe = {
440
+ key: 0
441
+ }, He = /* @__PURE__ */ X({
442
+ __name: "MemberPricing",
443
+ setup(Q) {
444
+ const {
445
+ t: n
446
+ } = Y(), p = he(), T = M(() => p.memberPricings.value.length), m = [{
447
+ header: n("menu.member_pricing.table.columns.name"),
448
+ accessorKey: "key",
449
+ enableSorting: !1
450
+ }, {
451
+ id: "actions",
452
+ size: 50,
453
+ cell: (l) => o("div", {
454
+ class: "px-4 flex justify-end"
455
+ }, [o(K.FmButton, {
456
+ icon: "delete",
457
+ "text-color": E.NeutralGray400,
458
+ variant: F.Tertiary,
459
+ onClick: () => p.deleteMemberPricings(l.row.original.key)
460
+ }, null)])
461
+ }];
462
+ function S() {
463
+ p.create();
464
+ }
465
+ return (l, h) => {
466
+ const R = y("FmTable");
467
+ return d(), G(ie, {
468
+ heading: e(n)("menu.member_pricing.title"),
469
+ subheading: e(n)("menu.member_pricing.description")
470
+ }, {
471
+ default: g(() => [T.value > 0 ? (d(), k("div", Qe, [o(ee, null, {
472
+ default: g(() => [o(R, {
473
+ "column-defs": m,
474
+ "row-data": e(p).memberPricings.value,
475
+ "page-size": e(p).memberPricings.value.length,
476
+ "hide-footer": !0
477
+ }, null, 8, ["row-data", "page-size"])]),
478
+ _: 1
479
+ })])) : (d(), G(e(ae), {
480
+ key: 1,
481
+ action: {
482
+ text: e(n)("menu.member_pricing.add_member_tier"),
483
+ callback: S
484
+ },
485
+ subtitle: e(n)("menu.member_pricing.empty.subtitle"),
486
+ title: e(n)("menu.member_pricing.empty.title")
487
+ }, null, 8, ["action", "subtitle", "title"]))]),
488
+ "append-heading": g(() => [T.value > 0 ? (d(), G(ye, {
489
+ key: 0,
490
+ label: e(n)("menu.member_pricing.add_member_tier"),
491
+ "prepend-icon": "add",
492
+ onClick: S
493
+ }, null, 8, ["label"])) : $("", !0)]),
494
+ _: 1
495
+ }, 8, ["heading", "subheading"]);
496
+ };
497
+ }
498
+ }), Je = {
499
+ class: "py-16"
500
+ }, We = {
501
+ key: 0,
502
+ class: "space-y-32 max-w-[750px] xs:p-16"
503
+ }, Xe = {
504
+ key: 0,
505
+ class: "pl-32 space-x-8"
506
+ }, Ye = {
507
+ key: 1
508
+ }, Ze = {
509
+ class: "space-y-8"
510
+ }, et = {
511
+ class: "flex items-center justify-between"
512
+ }, tt = {
513
+ class: "fm-typo-en-title-md-600"
514
+ }, lt = {
515
+ class: "text-fm-color-typo-secondary"
516
+ }, nt = {
517
+ key: 2
518
+ }, ot = {
519
+ key: 3
520
+ }, bt = /* @__PURE__ */ X({
521
+ __name: "MenuSetting",
522
+ setup(Q) {
523
+ var P;
524
+ const {
525
+ t: n
526
+ } = Y(), p = Z(), T = ce(), m = re(), S = se(m), l = M(() => ({
527
+ lowStock: p.state.menu.lowStockThreshold,
528
+ taxSetting: p.state.menu.masterCatalogSetting,
529
+ priceTierSettings: p.state.menu.priceTierSettings
530
+ })), h = A("conf"), R = M(() => [{
531
+ label: n("menu.menu_setting.tabs.menu_configuration"),
532
+ value: "conf"
533
+ }, ...p.isV4 ? [{
534
+ label: n("menu.menu_setting.tabs.price_group"),
535
+ value: "price-group"
536
+ }, ...p.state.featureFlags.showMemberPriceSettings ? [{
537
+ label: n("menu.menu_setting.tabs.member_pricing"),
538
+ value: "member-pricing"
539
+ }] : [], {
540
+ label: n("menu.menu_setting.tabs.link_product_rule_groups"),
541
+ value: "link-product-rule-groups"
542
+ }] : []]), v = A(L.transformTax((P = l.value.taxSetting) == null ? void 0 : P.inclusiveTaxes));
543
+ q(() => l.value, (f) => {
544
+ var _;
545
+ v.value = L.transformTax((_ = f.taxSetting) == null ? void 0 : _.inclusiveTaxes);
546
+ });
547
+ const U = M(() => {
548
+ if (!T.currentCountry.value) return [];
549
+ const f = v.value.mode === N.MANUAL ? v.value.inclusive ?? [] : [];
550
+ return me.Country.getCountry(T.currentCountry.value).taxSystems.map((b) => {
551
+ const x = f.find((a) => a.systemCode === b.code);
552
+ return {
553
+ inclusive: (x == null ? void 0 : x.inclusive) || !1,
554
+ systemCode: b.code
555
+ };
556
+ });
557
+ });
558
+ function C(f) {
559
+ const _ = v.value, b = _.mode === N.AUTO ? L.manualTax(U.value) : le(_);
560
+ b.inclusive ?? (b.inclusive = []);
561
+ const x = b.inclusive.findIndex((a) => a.systemCode === f.systemCode);
562
+ x < 0 ? b.inclusive.push(f) : b.inclusive.splice(x, 1, f), v.value = b;
563
+ }
564
+ async function I() {
565
+ if (l.value.lowStock !== null && l.value.lowStock !== void 0 && !Number.isInteger(l.value.lowStock))
566
+ return;
567
+ const f = v.value.mode === N.AUTO ? null : le(v.value.inclusive);
568
+ await S.minor(async () => {
569
+ const _ = l.value.lowStock === null || l.value.lowStock === void 0 || l.value.lowStock === 0;
570
+ await p.updateMenuSetting({
571
+ masterCatalogSetting: {
572
+ inclusiveTaxes: f
573
+ },
574
+ lowStockThreshold: _ ? null : l.value.lowStock,
575
+ priceTierSettings: V.priceTiers.value
576
+ });
577
+ }, {
578
+ successMessage: n("menu.menu_setting.fields.low_stock.updated")
579
+ });
580
+ }
581
+ const V = xe(), O = [{
582
+ header: n("menu.price_tier.settings_table.columns.name"),
583
+ accessorKey: "key",
584
+ enableSorting: !1
585
+ }, {
586
+ id: "actions",
587
+ size: 50,
588
+ cell: (f) => o("div", {
589
+ class: "px-4 flex justify-end"
590
+ }, [o(K.FmButton, {
591
+ icon: "delete",
592
+ "text-color": E.NeutralGray400,
593
+ variant: F.Tertiary,
594
+ onClick: () => V.deletePriceTier(f.row.original.key)
595
+ }, null)])
596
+ }];
597
+ return (f, _) => {
598
+ const b = y("FmTabs"), x = y("fm-radio"), a = y("fm-radio-group"), t = y("fm-checkbox"), u = y("FormItem"), c = y("FmStepperField"), w = y("FmButton"), D = y("FmTable");
599
+ return d(), G(ie, {
600
+ heading: e(n)("menu.menu_setting.title")
601
+ }, {
602
+ default: g(() => [o(b, {
603
+ items: R.value,
604
+ modelValue: h.value,
605
+ "onUpdate:modelValue": _[0] || (_[0] = (s) => h.value = s)
606
+ }, null, 8, ["items", "modelValue"]), r("div", Je, [h.value === "conf" ? (d(), k("div", We, [o(W, {
607
+ title: e(n)("menu.tax_setting.title")
608
+ }, {
609
+ default: g(() => [o(u, {
610
+ label: e(n)("menu.setting.tax.title")
611
+ }, {
612
+ default: g(() => [o(a, {
613
+ "model-value": v.value.mode,
614
+ "onUpdate:modelValue": _[1] || (_[1] = (s) => {
615
+ s === e(N).AUTO ? v.value = e(L).autoTax() : v.value = e(L).manualTax(U.value);
616
+ })
617
+ }, {
618
+ default: g(() => [o(x, {
619
+ value: e(N).AUTO,
620
+ label: e(n)("menu.setting.tax.modes.auto.label"),
621
+ sublabel: e(n)("menu.setting.tax.modes.auto.sublabel")
622
+ }, null, 8, ["value", "label", "sublabel"]), o(x, {
623
+ value: e(N).MANUAL,
624
+ label: e(n)("menu.setting.tax.modes.manual.label"),
625
+ sublabel: e(n)("menu.setting.tax.modes.manual.sublabel")
626
+ }, null, 8, ["value", "label", "sublabel"])]),
627
+ _: 1
628
+ }, 8, ["model-value"]), v.value.mode === e(N).MANUAL ? (d(), k("div", Xe, [(d(!0), k(oe, null, ue(U.value, (s) => (d(), G(t, {
629
+ key: s.systemCode,
630
+ "model-value": s.inclusive,
631
+ value: !0,
632
+ label: e(n)("menu.catalog.form.tax.inclusive", {
633
+ code: s.systemCode
634
+ }),
635
+ "onUpdate:modelValue": (i) => {
636
+ C({
637
+ ...s,
638
+ inclusive: i
639
+ });
640
+ }
641
+ }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))])) : $("", !0)]),
642
+ _: 1
643
+ }, 8, ["label"])]),
644
+ _: 1
645
+ }, 8, ["title"]), o(W, {
646
+ title: e(n)("menu.menu_setting.fields.low_stock.title"),
647
+ "sub-title": e(n)("menu.menu_setting.fields.low_stock.subtitle")
648
+ }, {
649
+ default: g(() => [o(c, {
650
+ "model-value": l.value.lowStock || null,
651
+ min: 0,
652
+ max: 1e3,
653
+ step: 1,
654
+ placeholder: e(n)("menu.menu_setting.fields.low_stock.not_set"),
655
+ "onUpdate:modelValue": _[2] || (_[2] = (s) => {
656
+ l.value.lowStock = s;
657
+ }),
658
+ rules: [(s) => s === null || Number.isInteger(s) || e(n)("menu.menu_setting.fields.low_stock.must_be_integer")],
659
+ "helper-text": e(n)("menu.menu_setting.fields.low_stock.helper_text")
660
+ }, null, 8, ["model-value", "placeholder", "rules", "helper-text"])]),
661
+ _: 1
662
+ }, 8, ["title", "sub-title"]), o(w, {
663
+ onClick: I,
664
+ label: e(n)("common.save")
665
+ }, null, 8, ["label"])])) : $("", !0), h.value === "price-group" ? (d(), k("div", Ye, [r("div", Ze, [r("div", et, [r("div", null, [r("h1", tt, B(e(n)("menu.price_tier.price_group")), 1), r("p", lt, B(e(n)("menu.price_tier.description")), 1)]), o(w, {
666
+ label: e(n)("menu.price_tier.add_price_group"),
667
+ icon: "add",
668
+ onClick: e(V).create
669
+ }, null, 8, ["label", "onClick"])]), o(ee, null, {
670
+ default: g(() => [o(D, {
671
+ "column-defs": O,
672
+ "row-data": e(V).priceTiers.value,
673
+ "page-size": e(V).priceTiers.value.length,
674
+ "hide-footer": !0
675
+ }, null, 8, ["row-data", "page-size"])]),
676
+ _: 1
677
+ })])])) : $("", !0), h.value === "member-pricing" ? (d(), k("div", nt, [o(He)])) : $("", !0), h.value === "link-product-rule-groups" ? (d(), k("div", ot, [o(Ke)])) : $("", !0)])]),
678
+ _: 1
679
+ }, 8, ["heading"]);
680
+ };
681
+ }
682
+ });
683
+ export {
684
+ bt as default
685
+ };