@feedmepos/mf-menu 0.32.55 → 0.32.56

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-BUePFRjb.js} +7 -7
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BxhzKypm.js → ApplyProduct.vue_vue_type_script_setup_true_lang-oPq3AcV2.js} +3 -3
  3. package/dist/{ApplyProductDialog.vue_vue_type_script_setup_true_lang-kPOpOatz.js → ApplyProductDialog.vue_vue_type_script_setup_true_lang-r2W9cuVe.js} +2 -2
  4. package/dist/{Catalog-DFJXgNsO.js → Catalog-uo0vO8uy.js} +6 -6
  5. package/dist/{Category-FaheENIM.js → Category-BvetZzck.js} +4 -4
  6. package/dist/{Category-DcN5huA8.js → Category-CHN6aSPS.js} +4 -4
  7. package/dist/{CookingGuide-w9A6JMSR.js → CookingGuide-DU8D0T0w.js} +5 -5
  8. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-BGCVlZ7J.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-DIxKLpe8.js} +1 -1
  9. package/dist/{Group-Dy8HcG_Y.js → Group-BFGFyGhC.js} +3 -3
  10. package/dist/{Group-DdqHR86E.js → Group-Cd1OoALN.js} +1 -1
  11. package/dist/{Group.vue_vue_type_script_setup_true_lang-Dvq7j79a.js → Group.vue_vue_type_script_setup_true_lang-Dyb9On55.js} +8 -8
  12. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BBcE09pP.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-XcNt0ZBv.js} +5 -5
  13. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-DbIKyjW3.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Dw3IXPUL.js} +7 -7
  14. package/dist/{Ingredient-gj1v3spC.js → Ingredient-CXU04qIu.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-q9DVgfMD.js} +2 -2
  16. package/dist/LinkProductSideSheet-CaFKMMSd.js +721 -0
  17. package/dist/MenuSetting-EeJdFNfx.js +685 -0
  18. package/dist/{OrderPacing-D0FFFm3T.js → OrderPacing-Db4P-2ea.js} +6 -6
  19. package/dist/{PrintRoute-Cgcxblv_.js → PrintRoute-CSScKjFa.js} +4 -4
  20. package/dist/{Product-Nti0T9iE.js → Product-tvbYvK5u.js} +1 -1
  21. package/dist/{Product.vue_vue_type_script_setup_true_lang-DyWLMrUC.js → Product.vue_vue_type_script_setup_true_lang-BQ_PgMDP.js} +12 -12
  22. package/dist/{ProductInternalTools-oOMZV7kK.js → ProductInternalTools-D2rmgEby.js} +6 -6
  23. package/dist/{Products-9elHDYp6.js → Products-WPvLY_wr.js} +43 -43
  24. package/dist/{Publish-Bi33tD6L.js → Publish-BJ9rz75C.js} +3 -3
  25. package/dist/{Recipe-BSysXC_H.js → Recipe-BMRTd58L.js} +4 -4
  26. package/dist/{RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-BqsEM8Kj.js → RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-BefgcG34.js} +1 -1
  27. package/dist/RuleView.vue_vue_type_script_setup_true_lang-DlzIboPc.js +3305 -0
  28. package/dist/{Scheduler-CmXIA0tH.js → Scheduler-CHQ5YcBq.js} +3 -3
  29. package/dist/{ServingSequence-CPVOcSSM.js → ServingSequence-BtXSEzfn.js} +3 -3
  30. package/dist/{Setting-BQPHY7B-.js → Setting-BnXj1uTa.js} +5 -5
  31. package/dist/{Subcategory-DQAT58lU.js → Subcategory-miGPIoku.js} +5 -5
  32. package/dist/{Takeaway-DOi4Xogf.js → Takeaway-DtVvfRQy.js} +1 -1
  33. package/dist/{Takeaway-DtyEbDDB.js → Takeaway-zaChLDgt.js} +4 -4
  34. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-CNccXS8u.js → Takeaway.vue_vue_type_script_setup_true_lang-BFnbiGsG.js} +5 -5
  35. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-D9VV1s1E.js → Thumbnail.vue_vue_type_script_setup_true_lang-CNYxe969.js} +4 -4
  36. package/dist/{TranslationFieldSection.vue_vue_type_script_setup_true_lang-Cpg0cCuJ.js → TranslationFieldSection.vue_vue_type_script_setup_true_lang-D4fWF46n.js} +1 -1
  37. package/dist/{TranslationSideSheet.vue_vue_type_script_setup_true_lang-CGXXpcYQ.js → TranslationSideSheet.vue_vue_type_script_setup_true_lang-DLqeQRkH.js} +2 -2
  38. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DUxEgL0r.js +5974 -0
  39. package/dist/{Unit-BVGd9vOo.js → Unit-BaLVANd9.js} +2 -2
  40. package/dist/{Variant-wgsEnYNH.js → Variant-Bnb4SllS.js} +3 -3
  41. package/dist/{_id_-XLbzesLX.js → _id_-btH88hnV.js} +9 -9
  42. package/dist/{app-DBDi3v7O.js → app-BO16t-ps.js} +32 -32
  43. package/dist/{app-DXZuPEOd.js → app-D1a9CqKF.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/{override-menu-BiwqdooM.js → linked-status-zxrRiX3x.js} +3 -3
  52. package/dist/assets/{menu-export-BemM1bWH.js → menu-export-DXB8Py6r.js} +2 -2
  53. package/dist/assets/{linked-status-BELOy4Ju.js → override-menu-CEIJGR_x.js} +3 -3
  54. package/dist/assets/{validate-menu-mNalZZpy.js → validate-menu-DN3P-OR7.js} +2 -2
  55. package/dist/{catalog-Beh91hfF.js → catalog-COu1SO_p.js} +1 -1
  56. package/dist/{catalogSetting-CvotY0sm.js → catalogSetting-D34fLwdB.js} +1 -1
  57. package/dist/{currency-DWU0Lz6M.js → currency-DlfcFoj5.js} +1 -1
  58. package/dist/{dayjs.min-b9_NYDqQ.js → dayjs.min-xM9KAjrx.js} +2 -2
  59. package/dist/{index-ZpjMtEkL.js → index-B5d_uvVc.js} +5 -5
  60. package/dist/{index-B2zWt4Ih.js → index-ByEp1JD0.js} +5 -5
  61. package/dist/{index.vue_vue_type_script_setup_true_lang-CSSSNBt8.js → index.vue_vue_type_script_setup_true_lang-DAJSG8i1.js} +6 -6
  62. package/dist/{item-DtR73Afo.js → item-CtfWra_w.js} +19 -19
  63. package/dist/{jszip.min-DgMmizjt.js → jszip.min-CNLaYb3p.js} +175 -175
  64. package/dist/{memberPricing-RVw5I6LL.js → memberPricing-DSqwOAgM.js} +1 -1
  65. package/dist/{menu-CaFnkDPh.js → menu-DUsES-YM.js} +1 -1
  66. package/dist/{menuV2-CphaxHaj.js → menuV2-BaY8Z_1c.js} +39 -39
  67. package/dist/mf-menu.css +1 -1
  68. package/dist/{order_pacing-CUyiMmGB.js → order_pacing-B5a8Fch-.js} +5 -5
  69. package/dist/{priceTier-CGLpjMw4.js → priceTier-bxvu4c84.js} +1 -1
  70. package/dist/{rules-3d19nDAK.js → rules-CTd3QZhN.js} +3 -3
  71. package/dist/{scheduler-CyPQu2Jd.js → scheduler-DIl9SPsA.js} +4 -4
  72. package/dist/{toExcel-Dbqi_aWn.js → toExcel-CUAEPhEv.js} +2 -2
  73. package/dist/{unit-CidyefuC.js → unit-DThoovpF.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,721 @@
1
+ import { createElementBlock as k, openBlock as d, createElementVNode as C, defineComponent as ie, ref as A, computed as z, resolveComponent as x, createBlock as T, unref as t, withCtx as G, createVNode as f, toDisplayString as M, Fragment as X, renderList as ue, createCommentVNode as Q, withModifiers as ae, watch as se, renderSlot as fe } from "vue";
2
+ import { u as re, U as oe, H as ne, G as ee, a5 as _e } from "./index.vue_vue_type_script_setup_true_lang-DAJSG8i1.js";
3
+ import { d as ye } from "./RuleConditionSelector.vue_vue_type_style_index_0_lang-CK8z7qA8.js";
4
+ import { useI18n as me, ItemSelector as Re } from "@feedmepos/mf-common";
5
+ import { components as ce, FmButtonVariant as Z } from "@feedmepos/ui-library";
6
+ import { u as be } from "./discardConfirm-BHni0LNu.js";
7
+ import { u as ge } from "./menuV2-BaY8Z_1c.js";
8
+ import { _ as pe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
9
+ import { m as B, g as Ce, h as he, c as ke, b as Ae, f as le } from "./RuleView.vue_vue_type_script_setup_true_lang-DlzIboPc.js";
10
+ import { c as Fe } from "./check-C9mY6LiX.js";
11
+ /* empty css */
12
+ const Ve = {};
13
+ function we(h, U) {
14
+ return d(), k("div", null, U[0] || (U[0] = [
15
+ C("div", { class: "h-px w-full bg-fm-color-neutral-gray-100" }, null, -1)
16
+ ]));
17
+ }
18
+ const xe = /* @__PURE__ */ pe(Ve, [["render", we]]), Ie = { class: "flex items-center gap-24" }, $e = { key: 0 }, Se = { key: 1 }, Ne = { class: "flex flex-col gap-24 h-full" }, Ge = { class: "flex flex-col gap-24 overflow-y-auto flex-1" }, Be = { class: "flex flex-col gap-16" }, De = { class: "text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Oe = { class: "flex justify-between" }, Le = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-lg-600" }, Me = { key: 0 }, Te = {
19
+ key: 0,
20
+ class: "text-fm-color-neutral-gray-300 p-16 ml-16"
21
+ }, Ue = { class: "flex justify-end gap-16" }, Ee = /* @__PURE__ */ ie({
22
+ __name: "CatalogLinkItemRuleForm",
23
+ props: {
24
+ isEditMode: {
25
+ type: Boolean,
26
+ default: !0
27
+ },
28
+ orderFrom: {
29
+ type: String,
30
+ required: !0
31
+ },
32
+ existingRuleGroups: {
33
+ type: Array,
34
+ required: !0
35
+ },
36
+ groupCustomRule: {
37
+ type: Object,
38
+ required: !0
39
+ },
40
+ convertCategoryIdToName: {
41
+ type: Function,
42
+ required: !0
43
+ }
44
+ },
45
+ emits: ["update:modelValue", "close-form"],
46
+ setup(h, { emit: U }) {
47
+ const { t: s } = me(), O = h, c = A(!0), I = U, E = A(O.orderFrom), b = A(""), g = A(
48
+ O.existingRuleGroups.reduce(
49
+ (r, n) => (r[n.id] = !0, r),
50
+ {}
51
+ )
52
+ ), F = A({}), q = z(
53
+ () => {
54
+ var r;
55
+ return (((r = re().state.menu.ruleGroupSettings) == null ? void 0 : r.groups) || []).map((n) => ({
56
+ label: n.name,
57
+ value: n._id
58
+ }));
59
+ }
60
+ ), $ = z(() => {
61
+ const r = q.value;
62
+ if (b.value) {
63
+ const n = b.value.toLowerCase(), y = r.filter((a) => g.value[a.value]), o = r.filter(
64
+ (a) => !g.value[a.value] && a.label.toLowerCase().includes(n)
65
+ );
66
+ return [...y, ...o];
67
+ }
68
+ return r.sort((n, y) => {
69
+ const o = g.value[n.value] || !1, a = g.value[y.value] || !1;
70
+ return o && !a ? -1 : !o && a ? 1 : 0;
71
+ });
72
+ }), Y = z(() => {
73
+ var y;
74
+ const r = Object.entries(g.value).filter(([o, a]) => a).map(([o]) => o), n = ((y = re().state.menu.ruleGroupSettings) == null ? void 0 : y.groups) || [];
75
+ return r.map((o) => {
76
+ const a = n.find((m) => m._id === o);
77
+ return {
78
+ ...a,
79
+ rules: (a == null ? void 0 : a.rules.map((m) => {
80
+ var V, w, N, R;
81
+ return {
82
+ ...m,
83
+ _id: m._id,
84
+ restaurantRule: {
85
+ restaurantAttributes: B(
86
+ (V = m.restaurantRule) == null ? void 0 : V.restaurantAttributes
87
+ ),
88
+ restaurantCustomAttributes: B(
89
+ (w = m.restaurantRule) == null ? void 0 : w.restaurantCustomAttributes
90
+ )
91
+ },
92
+ itemRule: {
93
+ itemAttributes: O.convertCategoryIdToName(
94
+ B((N = m.itemRule) == null ? void 0 : N.itemAttributes)
95
+ ),
96
+ itemCustomAttributes: B((R = m.itemRule) == null ? void 0 : R.itemCustomAttributes)
97
+ }
98
+ };
99
+ })) || []
100
+ };
101
+ }).filter((o) => o !== null);
102
+ }), L = A([]);
103
+ function p(r) {
104
+ var m, V, w, N;
105
+ const n = ((m = r.restaurantRule) == null ? void 0 : m.restaurantAttributes.rules) ?? [], y = ((V = r.restaurantRule) == null ? void 0 : V.restaurantCustomAttributes.rules) ?? [], o = ((w = r.itemRule) == null ? void 0 : w.itemAttributes.rules) ?? [], a = ((N = r.itemRule) == null ? void 0 : N.itemCustomAttributes.rules) ?? [];
106
+ return [
107
+ ...n.map((R) => ({
108
+ ...R,
109
+ property: `${s("menu.catalog.usage.restaurant")} ${R.property}`
110
+ })),
111
+ ...y.map((R) => ({
112
+ ...R,
113
+ property: `${s("menu.catalog.usage.restaurant")} ${R.property}`
114
+ })),
115
+ ...o.map((R) => ({
116
+ ...R,
117
+ property: `${s("menu.product.title")} ${R.property}`
118
+ })),
119
+ ...a.map((R) => ({
120
+ ...R,
121
+ property: `${s("menu.product.title")} ${R.property}`
122
+ }))
123
+ ];
124
+ }
125
+ function v() {
126
+ var V, w, N, R, J, i, j, u;
127
+ const r = O.groupCustomRule, n = Object.entries(g.value).filter(([e, _]) => _).map(([e]) => e), y = [], o = [], a = [], m = [];
128
+ L.value.length > 0 && (L.value.forEach((e) => {
129
+ e.property.startsWith("restaurant_attr") ? y.push({
130
+ property: e.property.replace("restaurant_attr_", ""),
131
+ operator: e.operator,
132
+ value: e.value,
133
+ type: e.type
134
+ }) : e.property.startsWith("restaurant_custom") ? o.push({
135
+ property: e.property.replace("restaurant_custom_", ""),
136
+ operator: e.operator,
137
+ value: e.value,
138
+ type: e.type
139
+ }) : e.property.startsWith("item_attr") ? a.push({
140
+ property: e.property.replace("item_attr_", ""),
141
+ operator: e.operator,
142
+ value: e.value,
143
+ type: e.type
144
+ }) : e.property.startsWith("item_custom") && m.push({
145
+ property: e.property.replace("item_custom_", ""),
146
+ operator: e.operator,
147
+ value: e.value,
148
+ type: e.type
149
+ });
150
+ }), r.restaurantRule = {
151
+ restaurantAttributes: {
152
+ logic: ((w = (V = r.restaurantRule) == null ? void 0 : V.restaurantAttributes) == null ? void 0 : w.logic) ?? "AND",
153
+ rules: y
154
+ },
155
+ restaurantCustomAttributes: {
156
+ logic: ((R = (N = r.restaurantRule) == null ? void 0 : N.restaurantCustomAttributes) == null ? void 0 : R.logic) ?? "AND",
157
+ rules: o
158
+ }
159
+ }, r.itemRule = {
160
+ itemAttributes: {
161
+ logic: ((i = (J = r.itemRule) == null ? void 0 : J.itemAttributes) == null ? void 0 : i.logic) ?? "AND",
162
+ rules: a
163
+ },
164
+ itemCustomAttributes: {
165
+ logic: ((u = (j = r.itemRule) == null ? void 0 : j.itemCustomAttributes) == null ? void 0 : u.logic) ?? "AND",
166
+ rules: m
167
+ }
168
+ }), I("update:modelValue", {
169
+ orderFrom: E.value,
170
+ ruleGroupIds: n,
171
+ restaurantRule: r.restaurantRule,
172
+ itemRule: r.itemRule
173
+ }), l();
174
+ }
175
+ function l() {
176
+ c.value = !1, I("close-form");
177
+ }
178
+ return (r, n) => {
179
+ const y = x("FmButton"), o = x("FmRadio"), a = x("FmRadioGroup"), m = x("FmIcon"), V = x("FmCard"), w = x("FmSearch"), N = x("FmMenuItem"), R = x("FmMenu"), J = x("FmSideSheet");
180
+ return d(), T(J, {
181
+ modelValue: c.value,
182
+ "onUpdate:modelValue": n[3] || (n[3] = (i) => c.value = i),
183
+ "max-width": 760,
184
+ "close-button": !1,
185
+ "is-container": t(ce).FmForm,
186
+ "is-container-props": {
187
+ onValidationSuccess: v,
188
+ blameFormChildOnValidationFailed: !0
189
+ }
190
+ }, {
191
+ "side-sheet-header": G(() => [
192
+ C("div", Ie, [
193
+ f(y, {
194
+ variant: t(Z).Tertiary,
195
+ "prepend-icon": "arrow_back",
196
+ onClick: ae(l, ["stop"])
197
+ }, null, 8, ["variant"]),
198
+ h.isEditMode ? (d(), k("p", $e, M(t(s)("menu.link_product.rules.edit_rule")), 1)) : (d(), k("p", Se, M(t(s)("menu.link_product.rules.add_rule")), 1))
199
+ ])
200
+ ]),
201
+ "side-sheet-footer": G(() => [
202
+ C("div", Ue, [
203
+ f(y, {
204
+ variant: t(Z).Secondary,
205
+ label: t(s)("common.cancel"),
206
+ onClick: ae(l, ["stop"])
207
+ }, null, 8, ["variant", "label"]),
208
+ f(y, {
209
+ variant: t(Z).Primary,
210
+ label: t(s)("common.save"),
211
+ type: "submit"
212
+ }, null, 8, ["variant", "label"])
213
+ ])
214
+ ]),
215
+ default: G(() => [
216
+ C("div", Ne, [
217
+ f(a, {
218
+ modelValue: E.value,
219
+ "onUpdate:modelValue": n[0] || (n[0] = (i) => E.value = i),
220
+ label: t(s)("menu.link_product.rules.availability")
221
+ }, {
222
+ default: G(() => [
223
+ f(o, {
224
+ label: "All",
225
+ value: t(oe).enum.ALL
226
+ }, null, 8, ["value"]),
227
+ f(o, {
228
+ label: "POS Only",
229
+ value: t(oe).enum.POS_ONLY
230
+ }, null, 8, ["value"]),
231
+ f(o, {
232
+ label: "None",
233
+ value: t(oe).enum.NONE
234
+ }, null, 8, ["value"])
235
+ ]),
236
+ _: 1
237
+ }, 8, ["modelValue", "label"]),
238
+ f(xe),
239
+ C("div", Ge, [
240
+ C("div", Be, [
241
+ C("p", De, M(t(s)("menu.link_product.rules.use_rule_group")), 1),
242
+ (d(!0), k(X, null, ue(Y.value, (i) => (d(), k("div", {
243
+ key: i._id
244
+ }, [
245
+ f(V, {
246
+ variant: "outlined",
247
+ class: "p-24 gap-24 space-y-16"
248
+ }, {
249
+ default: G(() => [
250
+ C("div", Oe, [
251
+ C("p", Le, M(i.name), 1),
252
+ f(m, {
253
+ name: F.value[i._id] ? "expand_less" : "expand_more",
254
+ onClick: ae((j) => F.value[i._id] = !F.value[i._id], ["stop", "prevent"])
255
+ }, null, 8, ["name", "onClick"])
256
+ ]),
257
+ F.value[i._id] ? (d(), k("div", Me, [
258
+ (d(!0), k(X, null, ue(i.rules, (j, u) => (d(), k("div", {
259
+ key: j._id
260
+ }, [
261
+ (d(!0), k(X, null, ue(p(j), (e, _) => (d(), T(Ce, {
262
+ key: _,
263
+ number: _ + 1,
264
+ property: e.property,
265
+ operator: e.operator,
266
+ value: e.value
267
+ }, null, 8, ["number", "property", "operator", "value"]))), 128)),
268
+ u < i.rules.length - 1 ? (d(), k("p", Te, M(t(s)("menu.link_product.rules.or")), 1)) : Q("", !0)
269
+ ]))), 128))
270
+ ])) : Q("", !0)
271
+ ]),
272
+ _: 2
273
+ }, 1024)
274
+ ]))), 128)),
275
+ f(R, { "close-on-click": !1 }, {
276
+ "menu-button": G(() => [
277
+ f(y, {
278
+ variant: t(Z).Plain,
279
+ "prepend-icon": "add",
280
+ label: t(s)("menu.link_product.rules.add_rule_group")
281
+ }, null, 8, ["variant", "label"])
282
+ ]),
283
+ default: G(() => [
284
+ f(w, {
285
+ "model-value": b.value,
286
+ "onUpdate:modelValue": n[1] || (n[1] = (i) => b.value = i),
287
+ class: "w-[200px]",
288
+ placeholder: t(s)("menu.link_product.rules.filter_result")
289
+ }, null, 8, ["model-value", "placeholder"]),
290
+ (d(!0), k(X, null, ue($.value, (i) => (d(), T(N, {
291
+ key: i.value,
292
+ label: i.label,
293
+ "has-checkbox": "",
294
+ "model-value": g.value[i.value],
295
+ onClick: () => {
296
+ g.value[i.value] = !g.value[i.value];
297
+ }
298
+ }, null, 8, ["label", "model-value", "onClick"]))), 128))
299
+ ]),
300
+ _: 1
301
+ })
302
+ ]),
303
+ f(he, {
304
+ "model-value": h.groupCustomRule,
305
+ "onUpdate:modelValue": n[2] || (n[2] = (i) => {
306
+ L.value = i;
307
+ })
308
+ }, null, 8, ["model-value"])
309
+ ])
310
+ ])
311
+ ]),
312
+ _: 1
313
+ }, 8, ["modelValue", "is-container", "is-container-props"]);
314
+ };
315
+ }
316
+ }), de = /* @__PURE__ */ ie({
317
+ __name: "CatalogLinkItemRuleView",
318
+ props: {
319
+ modelValue: {
320
+ type: Object,
321
+ required: !0
322
+ },
323
+ index: {
324
+ type: Number,
325
+ required: !0
326
+ },
327
+ convertCategoryIdToName: {
328
+ type: Function,
329
+ required: !0
330
+ },
331
+ showForm: {
332
+ type: Boolean,
333
+ default: !1
334
+ },
335
+ isDraft: {
336
+ type: Boolean,
337
+ default: !1
338
+ }
339
+ },
340
+ emits: ["update:model-value", "delete-rule", "copy-rule"],
341
+ setup(h, {
342
+ expose: U,
343
+ emit: s
344
+ }) {
345
+ const {
346
+ t: O
347
+ } = me(), c = h, I = s, E = z(() => {
348
+ var p;
349
+ return ((p = re().state.menu.ruleGroupSettings) == null ? void 0 : p.groups) || [];
350
+ });
351
+ function b(p) {
352
+ return p.flatMap((v) => {
353
+ var n, y;
354
+ const l = ((n = E.value.find((o) => o._id === v)) == null ? void 0 : n.rules) || [], r = ((y = E.value.find((o) => o._id === v)) == null ? void 0 : y.name) || "";
355
+ return {
356
+ id: v,
357
+ name: r,
358
+ rules: l.map((o) => {
359
+ var a, m, V, w;
360
+ return {
361
+ ...o,
362
+ restaurantRule: {
363
+ restaurantAttributes: B((a = o.restaurantRule) == null ? void 0 : a.restaurantAttributes),
364
+ restaurantCustomAttributes: B((m = o.restaurantRule) == null ? void 0 : m.restaurantCustomAttributes)
365
+ },
366
+ itemRule: {
367
+ itemAttributes: c.convertCategoryIdToName(B((V = o.itemRule) == null ? void 0 : V.itemAttributes)),
368
+ itemCustomAttributes: B((w = o.itemRule) == null ? void 0 : w.itemCustomAttributes)
369
+ }
370
+ };
371
+ })
372
+ };
373
+ });
374
+ }
375
+ const g = A(b(c.modelValue.ruleGroupIds ?? [])), F = A({
376
+ _id: "customRule",
377
+ restaurantRule: c.modelValue.restaurantRule,
378
+ itemRule: c.modelValue.itemRule
379
+ }), q = A(c.modelValue.orderFrom);
380
+ se(() => c.modelValue, (p) => {
381
+ g.value = b(p.ruleGroupIds ?? []), F.value = {
382
+ _id: "customRule",
383
+ restaurantRule: p.restaurantRule,
384
+ itemRule: p.itemRule
385
+ };
386
+ }, {
387
+ deep: !0
388
+ });
389
+ const $ = A(c.showForm);
390
+ U({
391
+ showForm: $
392
+ }), se(() => $.value, (p, v) => {
393
+ c.isDraft && v === !0 && p === !1 && I("delete-rule");
394
+ });
395
+ function Y(p) {
396
+ q.value = p.orderFrom, F.value.restaurantRule = p.restaurantRule, F.value.itemRule = p.itemRule, g.value = b(p.ruleGroupIds ?? []), I("update:model-value", p);
397
+ }
398
+ function L() {
399
+ const p = ne.cloneDeep({
400
+ orderFrom: q.value,
401
+ ruleGroupIds: g.value.map((v) => v.id),
402
+ restaurantRule: F.value.restaurantRule,
403
+ itemRule: F.value.itemRule
404
+ });
405
+ I("copy-rule", p);
406
+ }
407
+ return (p, v) => $.value ? (d(), T(Ee, {
408
+ key: 1,
409
+ "is-edit-mode": !h.isDraft,
410
+ "order-from": q.value,
411
+ "existing-rule-groups": g.value,
412
+ "group-custom-rule": F.value,
413
+ "convert-category-id-to-name": h.convertCategoryIdToName,
414
+ onCloseForm: v[3] || (v[3] = (l) => $.value = !1),
415
+ "onUpdate:modelValue": v[4] || (v[4] = (l) => Y(l))
416
+ }, null, 8, ["is-edit-mode", "order-from", "existing-rule-groups", "group-custom-rule", "convert-category-id-to-name"])) : (d(), T(ke, {
417
+ key: 0,
418
+ "model-value": F.value,
419
+ title: `${t(O)("menu.rule_groups.condition_view.rule")} ${h.index + 1}`,
420
+ "is-catalog-link-item-rule-view": !0,
421
+ "rule-group-names": g.value.map((l) => l.name).filter((l) => l !== ""),
422
+ "order-from": q.value,
423
+ onOpenCatalogLinkItemRuleForm: v[0] || (v[0] = (l) => $.value = !0),
424
+ onDeleteRule: v[1] || (v[1] = (l) => p.$emit("delete-rule")),
425
+ onCopyRule: v[2] || (v[2] = (l) => L())
426
+ }, null, 8, ["model-value", "title", "rule-group-names", "order-from"]));
427
+ }
428
+ });
429
+ var D = /* @__PURE__ */ ((h) => (h[h.Normal = 0] = "Normal", h[h.Rules = 1] = "Rules", h))(D || {});
430
+ const qe = { class: "fm-typo-en-title-md-600 mr-auto" }, je = {
431
+ key: 1,
432
+ class: "flex items-center gap-12"
433
+ }, ze = { class: "flex items-center gap-8" }, Pe = { class: "text-neutral-600 fm-typo-body-sm" }, We = {
434
+ key: 1,
435
+ class: "space-y-16"
436
+ }, He = { class: "flex items-center space-x-16" }, Qe = { class: "flex-1 min-w-0 relative border border-fm-color-neutral-gray-200 rounded-md p-16" }, Ye = { class: "absolute -top-[10px] left-[50px] bg-white px-2 fm-typo-en-body-lg-400 text-fm-color-typo-secondary select-none z-10" }, Je = {
437
+ key: 0,
438
+ class: "flex items-center select-none"
439
+ }, Ke = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xe = { class: "flex gap-8 items-center justify-start" }, Ze = /* @__PURE__ */ ie({
440
+ __name: "LinkProductSideSheet",
441
+ props: {
442
+ initialValue: { default: () => [] },
443
+ linkItemRules: {},
444
+ menuItems: {},
445
+ categories: {},
446
+ noScheduler: { type: Boolean },
447
+ isLocalOnly: { type: Boolean, default: !1 },
448
+ categorizedItems: { default: () => [] },
449
+ selectVariant: { type: Boolean, default: !1 },
450
+ showVariant: { type: Boolean, default: !1 },
451
+ showAddon: { type: Boolean, default: !0 },
452
+ title: { default: void 0 },
453
+ useCloseBtn: { type: Boolean }
454
+ },
455
+ emits: ["submit"],
456
+ setup(h, { emit: U }) {
457
+ const s = h, O = U, { t: c } = me(), I = A(D.Normal);
458
+ function E(u) {
459
+ I.value = u;
460
+ }
461
+ const b = A(!1), g = (u) => {
462
+ Fe.isBoolean(u) ? b.value = u : b.value = !b.value;
463
+ };
464
+ function F(u) {
465
+ return u.reduce((e, _) => (e[_._id] = [...e[_._id] ?? [], _], e), {});
466
+ }
467
+ const q = s.initialValue, $ = A(F(ee(q))), Y = z(() => Object.values($.value).flatMap((u) => u)), { convertCategoryIdToName: L, convertCategoryNameToId: p } = Ae({
468
+ menuItems: z(() => s.menuItems || []),
469
+ categories: z(() => s.categories || [])
470
+ }), v = A(
471
+ ee(s.linkItemRules)
472
+ ), l = A();
473
+ function r() {
474
+ var u;
475
+ return (u = v.value) == null ? void 0 : u.map((e) => {
476
+ var _, P, W, H;
477
+ return {
478
+ ...e,
479
+ restaurantRule: {
480
+ restaurantAttributes: B((_ = e.restaurantRule) == null ? void 0 : _.restaurantAttributes),
481
+ restaurantCustomAttributes: B((P = e.restaurantRule) == null ? void 0 : P.restaurantCustomAttributes)
482
+ },
483
+ itemRule: {
484
+ itemAttributes: L(B((W = e.itemRule) == null ? void 0 : W.itemAttributes)),
485
+ itemCustomAttributes: B((H = e.itemRule) == null ? void 0 : H.itemCustomAttributes)
486
+ }
487
+ };
488
+ });
489
+ }
490
+ l.value = r();
491
+ function n() {
492
+ var u;
493
+ return (u = l.value) == null ? void 0 : u.map((e) => {
494
+ var _, P, W, H;
495
+ return {
496
+ ...e,
497
+ restaurantRule: {
498
+ restaurantAttributes: le((_ = e.restaurantRule) == null ? void 0 : _.restaurantAttributes),
499
+ restaurantCustomAttributes: le((P = e.restaurantRule) == null ? void 0 : P.restaurantCustomAttributes)
500
+ },
501
+ itemRule: {
502
+ itemAttributes: le(p((W = e.itemRule) == null ? void 0 : W.itemAttributes)),
503
+ itemCustomAttributes: le((H = e.itemRule) == null ? void 0 : H.itemCustomAttributes)
504
+ }
505
+ };
506
+ });
507
+ }
508
+ const y = be(
509
+ () => {
510
+ const u = n() ?? null;
511
+ return !ne.isEqual(F(s.initialValue), $.value) || !ne.isEqual(s.linkItemRules, u);
512
+ },
513
+ () => {
514
+ b.value = !1;
515
+ }
516
+ );
517
+ function o() {
518
+ I.value === D.Rules ? O("submit", {
519
+ mode: D.Rules,
520
+ linkItemRules: n() ?? []
521
+ }) : O("submit", {
522
+ mode: D.Normal,
523
+ items: Y.value
524
+ }), b.value = !1;
525
+ }
526
+ se(
527
+ () => b.value,
528
+ () => {
529
+ $.value = F(ee(s.initialValue)), v.value = ee(s.linkItemRules), l.value = r(), a.value = null, m.value = !1, I.value = s.noScheduler && s.linkItemRules && s.linkItemRules.length > 0 ? D.Rules : D.Normal;
530
+ }
531
+ );
532
+ const a = A(null), m = A(!1), V = () => {
533
+ a.value = {
534
+ orderFrom: oe.enum.ALL,
535
+ restaurantRule: {
536
+ restaurantAttributes: null,
537
+ restaurantCustomAttributes: null
538
+ },
539
+ itemRule: {
540
+ itemAttributes: null,
541
+ itemCustomAttributes: null
542
+ }
543
+ }, m.value = !0;
544
+ };
545
+ function w(u) {
546
+ l.value = [...l.value || [], u], a.value = null, m.value = !1;
547
+ }
548
+ function N() {
549
+ a.value = null, m.value = !1;
550
+ }
551
+ function R(u) {
552
+ if (!l.value) return;
553
+ const e = [...l.value];
554
+ e.splice(u, 1), l.value = e.length ? e : [];
555
+ }
556
+ function J(u) {
557
+ if (!l.value) return;
558
+ const e = [...l.value, ee(u)];
559
+ l.value = e;
560
+ }
561
+ const i = z(() => {
562
+ const u = s.isLocalOnly ? ge() : re();
563
+ return s.noScheduler && u.currentCatalog;
564
+ });
565
+ function j(u, e) {
566
+ if (!l.value) return;
567
+ const _ = [...l.value];
568
+ _[u] = e, l.value = _;
569
+ }
570
+ return (u, e) => {
571
+ const _ = x("fm-button"), P = x("fm-switch"), W = x("FmCard"), H = x("FmButton"), ve = x("fm-side-sheet");
572
+ return d(), k(X, null, [
573
+ fe(u.$slots, "default", { trigger: g }, void 0, !0),
574
+ f(ve, {
575
+ id: "group-form",
576
+ modelValue: b.value,
577
+ "onUpdate:modelValue": e[5] || (e[5] = (S) => b.value = S),
578
+ "close-button": u.useCloseBtn,
579
+ "is-container": t(ce).FmForm,
580
+ "is-container-props": {
581
+ onValidationSuccess: o,
582
+ blameFormChildOnValidationFailed: !0
583
+ },
584
+ "max-width": 760,
585
+ "onOn:clickedAway": t(y)
586
+ }, {
587
+ "side-sheet-header": G(() => [
588
+ u.useCloseBtn ? Q("", !0) : (d(), T(_, {
589
+ key: 0,
590
+ variant: t(Z).Tertiary,
591
+ class: "cursor-pointer mr-4",
592
+ "prepend-icon": "arrow_back",
593
+ onClick: g
594
+ }, null, 8, ["variant"])),
595
+ C("p", qe, M(u.title || t(c)("menu.link_product.title")), 1),
596
+ i.value ? (d(), k("div", je, [
597
+ C("div", ze, [
598
+ f(P, {
599
+ label: t(c)("menu.link_product.rules.section_title"),
600
+ "model-value": I.value === t(D).Rules,
601
+ "onUpdate:modelValue": e[0] || (e[0] = (S) => E(S ? t(D).Rules : t(D).Normal))
602
+ }, null, 8, ["label", "model-value"])
603
+ ])
604
+ ])) : Q("", !0)
605
+ ]),
606
+ "side-sheet-footer": G(() => [
607
+ C("div", Xe, [
608
+ f(_, {
609
+ label: t(c)("menu.common.actions.confirm"),
610
+ size: "lg",
611
+ type: "submit",
612
+ variant: "primary"
613
+ }, null, 8, ["label"]),
614
+ f(_, {
615
+ label: t(c)("menu.common.actions.cancel"),
616
+ size: "lg",
617
+ variant: "tertiary",
618
+ onClick: e[4] || (e[4] = () => b.value = !1)
619
+ }, null, 8, ["label"])
620
+ ])
621
+ ]),
622
+ default: G(() => [
623
+ (d(), k("div", {
624
+ class: "py-8 px-8 overflow-y-auto space-y-24",
625
+ key: I.value
626
+ }, [
627
+ I.value === t(D).Normal ? (d(), T(t(Re), {
628
+ key: 0,
629
+ "auto-focus-search": !0,
630
+ "categorized-items": u.categorizedItems,
631
+ data: $.value,
632
+ "select-variant": u.selectVariant,
633
+ "selected-items": Y.value,
634
+ "show-variant": u.showVariant,
635
+ "show-addon": u.showAddon,
636
+ "onUpdate:data": e[1] || (e[1] = (S) => $.value = S)
637
+ }, null, 8, ["categorized-items", "data", "select-variant", "selected-items", "show-variant", "show-addon"])) : i.value ? (d(), k(X, { key: 1 }, [
638
+ C("p", Pe, M(t(c)("menu.link_product.rules.hint")), 1),
639
+ (!l.value || l.value.length <= 0) && !m.value ? (d(), T(t(_e), {
640
+ key: 0,
641
+ title: t(c)("menu.rule_groups.condition_view.empty_data.no_rules_added"),
642
+ subtitle: t(c)("menu.rule_groups.condition_view.empty_data.subtitle"),
643
+ action: {
644
+ text: t(c)("menu.link_product.rules.add_rule"),
645
+ icon: "add",
646
+ callback: V
647
+ }
648
+ }, null, 8, ["title", "subtitle", "action"])) : (d(), k("div", We, [
649
+ m.value && a.value ? (d(), T(W, {
650
+ key: 0,
651
+ class: "p-16 space-y-16",
652
+ variant: "outlined"
653
+ }, {
654
+ default: G(() => {
655
+ var S;
656
+ return [
657
+ f(de, {
658
+ "model-value": a.value,
659
+ index: ((S = l.value) == null ? void 0 : S.length) ?? 0,
660
+ convertCategoryIdToName: t(L),
661
+ "show-form": !0,
662
+ "is-draft": !0,
663
+ onDeleteRule: N,
664
+ "onUpdate:modelValue": w
665
+ }, null, 8, ["model-value", "index", "convertCategoryIdToName"])
666
+ ];
667
+ }),
668
+ _: 1
669
+ })) : Q("", !0),
670
+ f(t(ye), {
671
+ modelValue: l.value,
672
+ "onUpdate:modelValue": e[3] || (e[3] = (S) => l.value = S),
673
+ handle: ".rule-drag-handle",
674
+ "item-key": (S, K) => K
675
+ }, {
676
+ item: G(({ element: S, index: K }) => [
677
+ C("div", null, [
678
+ C("div", He, [
679
+ f(H, {
680
+ variant: t(Z).Tertiary,
681
+ "prepend-icon": "drag_indicator",
682
+ class: "rule-drag-handle cursor-grab shrink-0"
683
+ }, null, 8, ["variant"]),
684
+ C("div", Qe, [
685
+ C("span", Ye, M(t(c)("menu.rule_groups.condition_view.and")), 1),
686
+ f(de, {
687
+ "model-value": S,
688
+ index: K,
689
+ convertCategoryIdToName: t(L),
690
+ onDeleteRule: (te) => R(K),
691
+ "onUpdate:modelValue": (te) => j(K, te),
692
+ onCopyRule: e[2] || (e[2] = (te) => J(te))
693
+ }, null, 8, ["model-value", "index", "convertCategoryIdToName", "onDeleteRule", "onUpdate:modelValue"])
694
+ ])
695
+ ]),
696
+ l.value && l.value.length > 1 && K < l.value.length - 1 ? (d(), k("div", Je, [
697
+ C("span", Ke, M(t(c)("menu.rule_groups.condition_view.or")), 1)
698
+ ])) : Q("", !0)
699
+ ])
700
+ ]),
701
+ _: 1
702
+ }, 8, ["modelValue", "item-key"]),
703
+ f(_, {
704
+ label: t(c)("menu.link_product.rules.add_rule"),
705
+ onClick: V
706
+ }, null, 8, ["label"])
707
+ ]))
708
+ ], 64)) : Q("", !0)
709
+ ]))
710
+ ]),
711
+ _: 1
712
+ }, 8, ["modelValue", "close-button", "is-container", "is-container-props", "onOn:clickedAway"])
713
+ ], 64);
714
+ };
715
+ }
716
+ }), dt = /* @__PURE__ */ pe(Ze, [["__scopeId", "data-v-89db9528"]]);
717
+ export {
718
+ xe as H,
719
+ dt as L,
720
+ D as a
721
+ };