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