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