@feedmepos/mf-menu 0.32.37 → 0.32.38-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 (129) hide show
  1. package/dist/{App-Dl-BiHwh.js → App-DGdS9nht.js} +7 -7
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-Z4PgBxr3.js → ApplyProduct.vue_vue_type_script_setup_true_lang-CBy3XScH.js} +3 -3
  3. package/dist/{Catalog-BSZ8BAbX.js → Catalog-BuI0IVpf.js} +6 -6
  4. package/dist/{Category-bGvXpr0F.js → Category-DSTt-Sl6.js} +9 -9
  5. package/dist/Category-DbL3CS-5.js +224 -0
  6. package/dist/{CookingGuide-DijUR2JM.js → CookingGuide-Baw7iMDl.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-B30t_PW1.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-BDZDojOt.js} +1 -1
  8. package/dist/{Group-O4L3iHx0.js → Group-BnzmEllK.js} +1 -1
  9. package/dist/{Group-CrqE40ia.js → Group-D158_Fr0.js} +7 -7
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-CsM72Jnq.js → Group.vue_vue_type_script_setup_true_lang-C3H6xvlY.js} +227 -216
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BGR4kFzj.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D2G40Yc6.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-wf0Wm51b.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-D-JOSWUn.js} +1743 -1743
  13. package/dist/{Ingredient-DvvuwOdH.js → Ingredient-C-gP75uQ.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-anFCPZZD.js → InventoryBinding.vue_vue_type_script_setup_true_lang-BpuYVaKl.js} +2 -2
  15. package/dist/{LinkProductSideSheet-ImK8azTA.js → LinkProductSideSheet-DN5fbJVw.js} +3 -3
  16. package/dist/{MenuSetting-BX0ohmwF.js → MenuSetting-CjQ6_Ti_.js} +5 -5
  17. package/dist/{PrintRoute-CXYZHJsf.js → PrintRoute-DK25vS8X.js} +4 -4
  18. package/dist/{Product-BnnwL5DZ.js → Product-DCEMAuw3.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-DUBnQJZ1.js → Product.vue_vue_type_script_setup_true_lang-DCutU0Ny.js} +348 -337
  20. package/dist/{ProductInternalTools-DzRnmE1r.js → ProductInternalTools-CiDa1V3D.js} +23 -23
  21. package/dist/{Products-CtzHONQZ.js → Products-DUxtMLiy.js} +32 -32
  22. package/dist/{Publish-DmIbDy8-.js → Publish-Bs5zVwDw.js} +3 -3
  23. package/dist/{Recipe-D_0Ezt1C.js → Recipe-_WCpFOU6.js} +4 -4
  24. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-DdeQnyfQ.js → RuleView.vue_vue_type_script_setup_true_lang-3AVOVYpW.js} +366 -366
  25. package/dist/{Scheduler-BgQsbdVM.js → Scheduler-BqFwfRlm.js} +3 -3
  26. package/dist/{ServingSequence-DCRzJsrs.js → ServingSequence-ByNsE8ha.js} +3 -3
  27. package/dist/{Setting-CgtttPN_.js → Setting-widqJGfT.js} +5 -5
  28. package/dist/Subcategory-DXaz2g4-.js +345 -0
  29. package/dist/{Takeaway-BfcHs1we.js → Takeaway-Ce_y1_UW.js} +1 -1
  30. package/dist/{Takeaway-CExKsbN5.js → Takeaway-DVBJn6re.js} +4 -4
  31. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-DK2Cp2Dg.js +316 -0
  32. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-Br279NC_.js → Thumbnail.vue_vue_type_script_setup_true_lang-CAiNaQMP.js} +4 -4
  33. package/dist/TranslationSideSheet.vue_vue_type_script_setup_true_lang-BPs9D7Pq.js +185 -0
  34. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-nFLEeipN.js +6120 -0
  35. package/dist/{Unit-B6P_ykM-.js → Unit-XJLHLSYf.js} +2 -2
  36. package/dist/Variant-BA1AQl9-.js +247 -0
  37. package/dist/{_id_-D2ozS9Ck.js → _id_-CA2rV7Eb.js} +9 -9
  38. package/dist/app-C9zsFCoJ.js +363 -0
  39. package/dist/{app-DqyNXgYz.js → app-D2Sxejos.js} +1 -1
  40. package/dist/app.js +1 -1
  41. package/dist/apps/mf-menu/src/app.d.ts +264 -0
  42. package/dist/apps/mf-menu/src/components/ProductTranslationDialog.vue.d.ts +41 -0
  43. package/dist/apps/mf-menu/src/components/TranslationBadge.vue.d.ts +29 -0
  44. package/dist/apps/mf-menu/src/components/TranslationFieldSection.vue.d.ts +39 -0
  45. package/dist/apps/mf-menu/src/components/TranslationSideSheet.vue.d.ts +23 -0
  46. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/ApplyProduct.vue.d.ts +12 -0
  47. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/ApplyProductDialog.vue.d.ts +6 -0
  48. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/index.d.ts +54 -0
  49. package/dist/apps/mf-menu/src/components/feature/CategoryManager/Form.vue.d.ts +1 -0
  50. package/dist/apps/mf-menu/src/components/feature/Fields/ImageDropField.vue.d.ts +1 -0
  51. package/dist/apps/mf-menu/src/components/feature/GroupManager/OptionTable.vue.d.ts +16 -0
  52. package/dist/apps/mf-menu/src/components/feature/GroupManager/ProductOverrideTranslation.vue.d.ts +22 -0
  53. package/dist/apps/mf-menu/src/components/feature/GroupManager/UpdateForm.vue.d.ts +6 -0
  54. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierButton.vue.d.ts +20 -0
  55. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierForm.vue.d.ts +20 -0
  56. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/category.d.ts +8 -2
  57. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/item.d.ts +24 -1
  58. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/scheduler.d.ts +16 -0
  59. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/useItemFormManagement.d.ts +10 -0
  60. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/OptionTable.vue.d.ts +16 -0
  61. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/UpdateForm.vue.d.ts +6 -0
  62. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/index.d.ts +24 -0
  63. package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ItemForm.vue.d.ts +30 -0
  64. package/dist/apps/mf-menu/src/components/feature/TreeEditor/menuUtils.d.ts +10 -0
  65. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +125 -1
  66. package/dist/apps/mf-menu/src/components/feature/VariantManager/ProductVariantTranslation.vue.d.ts +37 -0
  67. package/dist/apps/mf-menu/src/components/import/PreviewAddonContent.vue.d.ts +20 -0
  68. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +16 -0
  69. package/dist/apps/mf-menu/src/helper/item.d.ts +1 -0
  70. package/dist/apps/mf-menu/src/helper/itemCategories.d.ts +10 -0
  71. package/dist/apps/mf-menu/src/helper/menu.d.ts +11 -0
  72. package/dist/apps/mf-menu/src/helper/menuImport.d.ts +125 -1
  73. package/dist/apps/mf-menu/src/helper/menuSanitizer.d.ts +125 -1
  74. package/dist/apps/mf-menu/src/manager/menu/category.d.ts +8 -2
  75. package/dist/apps/mf-menu/src/manager/menu/group.d.ts +1 -0
  76. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +125 -1
  77. package/dist/apps/mf-menu/src/manager/menu/subcategory.d.ts +6 -0
  78. package/dist/apps/mf-menu/src/stores/manager/item.d.ts +31 -1
  79. package/dist/apps/mf-menu/src/stores/manager/scheduler.d.ts +16 -0
  80. package/dist/apps/mf-menu/src/stores/manager/takeaway.d.ts +9 -0
  81. package/dist/apps/mf-menu/src/stores/menu.d.ts +125 -1
  82. package/dist/apps/mf-menu/src/utils/translation.d.ts +2 -0
  83. package/dist/apps/mf-menu/src/views/Catalog/Edit/AddCategoryDialogContentComponent.vue.d.ts +1 -0
  84. package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/Form.vue.d.ts +20 -0
  85. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +46 -0
  86. package/dist/apps/mf-menu/src/views/Scheduler/FilterForm.vue.d.ts +10 -0
  87. package/dist/apps/mf-menu/src/views/Scheduler/SchedulerDialog.vue.d.ts +10 -0
  88. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  89. package/dist/assets/linked-status-BrleJSCp.js +13 -0
  90. package/dist/assets/menu-export-Da3-wtnw.js +107 -0
  91. package/dist/assets/override-menu-ChjeVe4O.js +13 -0
  92. package/dist/assets/validate-menu-YVTxOfeq.js +13 -0
  93. package/dist/{catalog-CFKVaXk7.js → catalog-YvUT-JIh.js} +1 -1
  94. package/dist/{catalogSetting-N4nT-nGm.js → catalogSetting-CXOYJZO3.js} +1 -1
  95. package/dist/{currency-Bi_GukGE.js → currency-np4zdWW1.js} +1 -1
  96. package/dist/dayjs.min-CSuLNurY.js +6 -0
  97. package/dist/{index-uiJS0BKT.js → index-3wQe-6lg.js} +1 -1
  98. package/dist/index-CFbB7bM3.js +335 -0
  99. package/dist/index-Cek4Z9eM.js +539 -0
  100. package/dist/{index.vue_vue_type_script_setup_true_lang-CL6a622s.js → index.vue_vue_type_script_setup_true_lang-HZXySVXs.js} +18858 -18656
  101. package/dist/item-DR9qrNf6.js +8117 -0
  102. package/dist/{jszip.min-v__o3BM4.js → jszip.min-Bz8ZTO2s.js} +2 -2
  103. package/dist/{menu-LtIuM7Qj.js → menu-BWsDRctK.js} +1 -1
  104. package/dist/{menuV2-N0hB53Gw.js → menuV2-CfsbyMis.js} +39 -39
  105. package/dist/mf-menu.css +1 -1
  106. package/dist/{priceTier-DZeAvlXs.js → priceTier-BNCJtFVM.js} +1 -1
  107. package/dist/rules-DU-MRKWH.js +212 -0
  108. package/dist/{scheduler-FVlscyjB.js → scheduler-BizSj8q8.js} +4 -4
  109. package/dist/{toExcel-DBCbupeI.js → toExcel-DhRigI9c.js} +2 -2
  110. package/dist/translation-BeqjfyEb.js +75 -0
  111. package/dist/{unit-DNphv-4C.js → unit-CaOym7HP.js} +2 -2
  112. package/package.json +3 -3
  113. package/dist/Category-DMgNea31.js +0 -392
  114. package/dist/Subcategory-6SgvwWpX.js +0 -280
  115. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-GAZ3S2_n.js +0 -305
  116. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BFwMfAlB.js +0 -6024
  117. package/dist/Variant-DmNuLi96.js +0 -230
  118. package/dist/app-CE0yoao0.js +0 -363
  119. package/dist/assets/linked-status-BB6BrSUB.js +0 -13
  120. package/dist/assets/menu-export-C1TBcoi-.js +0 -107
  121. package/dist/assets/override-menu-C0RijOOI.js +0 -13
  122. package/dist/assets/validate-menu-9VpR7oZY.js +0 -13
  123. package/dist/category-BSGaVgyv.js +0 -156
  124. package/dist/dayjs.min-DgXlcVSD.js +0 -6
  125. package/dist/index-BaxQ5Nq0.js +0 -273
  126. package/dist/index-Bun2EboK.js +0 -239
  127. package/dist/item-DPivBmJh.js +0 -6950
  128. package/dist/rules-CIWTZQfh.js +0 -6
  129. package/dist/subcategory-CIctYwBF.js +0 -148
@@ -0,0 +1,539 @@
1
+ import { defineComponent as oe, ref as x, computed as I, watch as W, unref as n, resolveComponent as C, createBlock as z, openBlock as f, withCtx as V, createElementVNode as l, toDisplayString as g, createElementBlock as y, createCommentVNode as U, Fragment as T, renderList as F, createVNode as c, normalizeClass as X, renderSlot as re, createSlots as ce } from "vue";
2
+ import { J as O, Q as de, G as ue, I as M, D as Z, M as ee, A as ae } from "./index.vue_vue_type_script_setup_true_lang-HZXySVXs.js";
3
+ import { d as me } from "./vuedraggable-CK8z7qA8.js";
4
+ import { useI18n as le, useLocale as pe } from "@feedmepos/mf-common";
5
+ import { useSnackbar as fe, components as ve } from "@feedmepos/ui-library";
6
+ import { _ as _e } from "./FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js";
7
+ import { _ as ye } from "./RuleView.vue_vue_type_script_setup_true_lang-3AVOVYpW.js";
8
+ import { u as se } from "./discardConfirm-BHni0LNu.js";
9
+ import { _ as he } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-CBy3XScH.js";
10
+ import { g as q, a as H, _ as te, b as ne } from "./translation-BeqjfyEb.js";
11
+ import { c as be } from "./check-C9mY6LiX.js";
12
+ const ge = { class: "fm-typo-en-title-md-600" }, xe = { class: "pt-8 space-y-24" }, Ve = { class: "flex flex-col gap-8" }, ke = { class: "text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Ce = { class: "flex items-center gap-8 flex-wrap" }, Ee = { class: "w-24 h-24 rounded-full bg-fm-color-primary-oats text-fm-color-primary flex items-center justify-center fm-typo-en-body-sm-600" }, we = { class: "fm-typo-en-body-md-600" }, Oe = ["onClick"], $e = { class: "flex items-center gap-8" }, Ue = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, je = { class: "fm-typo-en-body-md-400" }, Le = { class: "flex flex-col gap-16 border p-16 rounded-lg" }, Se = { class: "fm-typo-en-body-lg-600" }, Te = {
13
+ key: 0,
14
+ class: "flex flex-col gap-32 pl-32"
15
+ }, Fe = {
16
+ key: 0,
17
+ class: "space-y-8"
18
+ }, Me = { class: "flex w-[100px] items-center gap-8" }, Ie = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Ne = { class: "fm-typo-en-body-md-400" }, De = { class: "flex-1" }, Ae = { class: "flex flex-col gap-16 border p-16 rounded-lg" }, Be = { class: "fm-typo-en-body-lg-600" }, qe = {
19
+ key: 0,
20
+ class: "flex flex-col gap-32 pl-32"
21
+ }, ze = { class: "fm-typo-en-body-md-600 text-fm-color-primary border border-fm-color-primary inline-block rounded-md px-8 py-4" }, Pe = { class: "space-y-32" }, Ye = {
22
+ key: 0,
23
+ class: "space-y-8"
24
+ }, Ge = { class: "flex w-[100px] items-center gap-8" }, Re = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Ke = { class: "fm-typo-en-body-md-400" }, Je = { class: "flex-1" }, Qe = { class: "flex gap-8 items-center justify-start" }, He = /* @__PURE__ */ oe({
25
+ __name: "ProductVariantTranslation",
26
+ props: {
27
+ modelValue: { type: Boolean },
28
+ variant: {},
29
+ expandSection: { default: "variant" }
30
+ },
31
+ emits: ["update:modelValue", "update:variant"],
32
+ setup(P, { emit: Y }) {
33
+ const m = P, $ = Y, { t: i } = le(), { localeList: E } = pe(), w = x(!1), k = x(!1), t = x([]), j = x([]), v = x({}), L = x({}), b = x({}), S = x({}), N = I(() => m.variant.options.map((e, a) => ({
34
+ ...e,
35
+ optionIndex: a + 1
36
+ })).filter((e) => e.name.trim() !== ""));
37
+ function G() {
38
+ const e = /* @__PURE__ */ new Set();
39
+ m.variant.name_locale && Object.keys(m.variant.name_locale).forEach((d) => e.add(d)), m.variant.options.forEach((d) => {
40
+ d.name_locale && Object.keys(d.name_locale).forEach((u) => e.add(u));
41
+ });
42
+ const a = Array.from(e).map((d) => {
43
+ const u = n(E).find((_) => _.code === d);
44
+ return {
45
+ localeCode: d,
46
+ localeName: (u == null ? void 0 : u.name) || d,
47
+ value: ""
48
+ // Not used for language selection
49
+ };
50
+ });
51
+ t.value = a;
52
+ const r = {};
53
+ m.variant.name_locale && Object.entries(m.variant.name_locale).forEach(([d, u]) => {
54
+ r[d] = u;
55
+ }), v.value = r;
56
+ const p = {};
57
+ m.variant.options.forEach((d) => {
58
+ p[d._id] = {}, d.name_locale && Object.entries(d.name_locale).forEach(([u, _]) => {
59
+ p[d._id][u] = _;
60
+ });
61
+ }), b.value = p;
62
+ }
63
+ W(
64
+ () => [m.modelValue, m.variant, m.expandSection],
65
+ ([e, , a]) => {
66
+ e && (G(), j.value = O.clone(t.value), L.value = O.clone(v.value), S.value = O.clone(b.value), a === "variant" ? (w.value = !0, k.value = !1) : (w.value = !1, k.value = !0));
67
+ },
68
+ { immediate: !0, deep: !0 }
69
+ );
70
+ const D = I(() => {
71
+ const e = new Set(t.value.map((a) => a.localeCode));
72
+ return n(E).filter((a) => !e.has(a.code)).map((a) => ({
73
+ code: a.code,
74
+ name: a.name,
75
+ icon: q(a.code)
76
+ }));
77
+ });
78
+ function R(e) {
79
+ const a = n(E).find((r) => r.code === e);
80
+ a && (t.value.push({
81
+ localeCode: a.code,
82
+ localeName: a.name,
83
+ value: ""
84
+ }), v.value[a.code] || (v.value[a.code] = ""), Object.keys(b.value).forEach((r) => {
85
+ b.value[r][a.code] || (b.value[r][a.code] = "");
86
+ }));
87
+ }
88
+ function A(e) {
89
+ t.value = t.value.filter((a) => a.localeCode !== e), delete v.value[e], Object.keys(b.value).forEach((a) => {
90
+ delete b.value[a][e];
91
+ });
92
+ }
93
+ function K() {
94
+ return !O.isEqual(t.value, j.value) || !O.isEqual(v.value, L.value) || !O.isEqual(b.value, S.value);
95
+ }
96
+ function J() {
97
+ const e = O.clone(m.variant), a = {};
98
+ Object.entries(v.value).forEach(([r, p]) => {
99
+ p && p.trim() && (a[r] = p.trim());
100
+ }), Object.keys(a).length > 0 ? e.name_locale = a : delete e.name_locale, e.options.forEach((r) => {
101
+ const p = b.value[r._id];
102
+ if (p && Object.keys(p).length > 0) {
103
+ const d = {};
104
+ Object.entries(p).forEach(([u, _]) => {
105
+ _ && _.trim() && (d[u] = _.trim());
106
+ }), Object.keys(d).length > 0 ? r.name_locale = d : delete r.name_locale;
107
+ } else
108
+ delete r.name_locale;
109
+ }), $("update:variant", e), $("update:modelValue", !1);
110
+ }
111
+ function Q() {
112
+ $("update:modelValue", !1);
113
+ }
114
+ const B = se(K, Q), o = I({
115
+ get: () => m.modelValue,
116
+ set: (e) => $("update:modelValue", e)
117
+ });
118
+ return (e, a) => {
119
+ const r = C("FmIcon"), p = C("fm-button"), d = C("FmMenu"), u = C("fm-text-field"), _ = C("fm-side-sheet");
120
+ return f(), z(_, {
121
+ modelValue: o.value,
122
+ "onUpdate:modelValue": a[2] || (a[2] = (s) => o.value = s),
123
+ "max-width": 720,
124
+ "onOn:clickedAway": n(B)
125
+ }, {
126
+ "side-sheet-header": V(() => [
127
+ l("p", ge, g(n(i)("menu.variant.form.translation.title")), 1)
128
+ ]),
129
+ "side-sheet-footer": V(() => [
130
+ l("div", Qe, [
131
+ c(p, {
132
+ label: n(i)("common.save"),
133
+ size: "lg",
134
+ variant: "primary",
135
+ onClick: J
136
+ }, null, 8, ["label"]),
137
+ c(p, {
138
+ label: n(i)("common.cancel"),
139
+ size: "lg",
140
+ variant: "tertiary",
141
+ onClick: n(B)
142
+ }, null, 8, ["label", "onClick"])
143
+ ])
144
+ ]),
145
+ default: V(() => [
146
+ l("div", xe, [
147
+ l("div", Ve, [
148
+ l("p", ke, g(n(i)("menu.variant.form.translation.language")), 1),
149
+ l("div", Ce, [
150
+ (f(!0), y(T, null, F(t.value, (s) => (f(), y("div", {
151
+ key: s.localeCode,
152
+ class: "flex items-center gap-8 p-8 border border-fm-color-primary text-fm-color-primary rounded-full"
153
+ }, [
154
+ l("div", Ee, g(n(q)(s.localeCode)), 1),
155
+ l("span", we, g(n(H)(s.localeCode, n(E))), 1),
156
+ c(r, {
157
+ name: "close",
158
+ class: "cursor-pointer",
159
+ variant: "secondary",
160
+ onClick: (h) => A(s.localeCode)
161
+ }, null, 8, ["onClick"])
162
+ ]))), 128)),
163
+ D.value.length > 0 ? (f(), z(d, { key: 0 }, {
164
+ "menu-button": V(() => [
165
+ c(p, {
166
+ variant: "secondary",
167
+ "border-color": "neutral-gray-300",
168
+ "text-color": "neutral-gray-400",
169
+ icon: "add"
170
+ })
171
+ ]),
172
+ default: V(() => [
173
+ (f(!0), y(T, null, F(D.value, (s) => (f(), y("div", {
174
+ key: s.code,
175
+ class: "p-12 cursor-pointer hover:bg-fm-color-opacity-md rounded-sm",
176
+ onClick: (h) => R(s.code)
177
+ }, [
178
+ l("div", $e, [
179
+ l("div", Ue, g(s.icon), 1),
180
+ l("span", je, g(s.name), 1)
181
+ ])
182
+ ], 8, Oe))), 128))
183
+ ]),
184
+ _: 1
185
+ })) : U("", !0)
186
+ ])
187
+ ]),
188
+ l("div", Le, [
189
+ l("div", {
190
+ class: "flex items-center gap-16 cursor-pointer",
191
+ onClick: a[0] || (a[0] = (s) => w.value = !w.value)
192
+ }, [
193
+ c(r, {
194
+ name: "keyboard_arrow_down",
195
+ class: X(["transition-transform", w.value ? "transform rotate-180" : ""])
196
+ }, null, 8, ["class"]),
197
+ l("p", Se, g(n(i)("menu.variant.form.translation.variant_name")), 1)
198
+ ]),
199
+ w.value ? (f(), y("div", Te, [
200
+ c(te, {
201
+ label: n(i)("menu.variant.form.translation.default"),
202
+ "model-value": e.variant.name
203
+ }, null, 8, ["label", "model-value"]),
204
+ t.value.length > 0 ? (f(), y("div", Fe, [
205
+ c(ne, {
206
+ label: n(i)("menu.variant.form.translation.translation")
207
+ }, null, 8, ["label"]),
208
+ (f(!0), y(T, null, F(t.value, (s) => (f(), y("div", {
209
+ key: s.localeCode,
210
+ class: "flex items-center gap-16"
211
+ }, [
212
+ l("div", Me, [
213
+ l("div", Ie, g(n(q)(s.localeCode)), 1),
214
+ l("span", Ne, g(n(H)(s.localeCode, n(E))), 1)
215
+ ]),
216
+ l("div", De, [
217
+ c(u, {
218
+ modelValue: v.value[s.localeCode],
219
+ "onUpdate:modelValue": (h) => v.value[s.localeCode] = h,
220
+ placeholder: e.variant.name
221
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
222
+ ])
223
+ ]))), 128))
224
+ ])) : U("", !0)
225
+ ])) : U("", !0)
226
+ ]),
227
+ l("div", Ae, [
228
+ l("div", {
229
+ class: "flex items-center gap-16 cursor-pointer",
230
+ onClick: a[1] || (a[1] = (s) => k.value = !k.value)
231
+ }, [
232
+ c(r, {
233
+ name: "keyboard_arrow_down",
234
+ class: X(["transition-transform", k.value ? "transform rotate-180" : ""])
235
+ }, null, 8, ["class"]),
236
+ l("p", Be, g(n(i)("menu.variant.form.translation.option_value")), 1)
237
+ ]),
238
+ k.value ? (f(), y("div", qe, [
239
+ (f(!0), y(T, null, F(N.value, (s) => (f(), y("div", {
240
+ key: s._id,
241
+ class: "space-y-8"
242
+ }, [
243
+ l("p", ze, g(n(i)("menu.variant.form.translation.option", { number: s.optionIndex })), 1),
244
+ l("div", Pe, [
245
+ c(te, {
246
+ label: n(i)("menu.variant.form.translation.default"),
247
+ "model-value": s.name,
248
+ spacing: "sm"
249
+ }, null, 8, ["label", "model-value"]),
250
+ t.value.length > 0 ? (f(), y("div", Ye, [
251
+ c(ne, {
252
+ label: n(i)("menu.variant.form.translation.translation"),
253
+ spacing: "sm"
254
+ }, null, 8, ["label"]),
255
+ (f(!0), y(T, null, F(t.value, (h) => (f(), y("div", {
256
+ key: h.localeCode,
257
+ class: "flex items-center gap-16"
258
+ }, [
259
+ l("div", Ge, [
260
+ l("div", Re, g(n(q)(h.localeCode)), 1),
261
+ l("span", Ke, g(n(H)(h.localeCode, n(E))), 1)
262
+ ]),
263
+ l("div", Je, [
264
+ c(u, {
265
+ modelValue: b.value[s._id][h.localeCode],
266
+ "onUpdate:modelValue": (ie) => b.value[s._id][h.localeCode] = ie,
267
+ placeholder: s.name
268
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
269
+ ])
270
+ ]))), 128))
271
+ ])) : U("", !0)
272
+ ])
273
+ ]))), 128))
274
+ ])) : U("", !0)
275
+ ])
276
+ ])
277
+ ]),
278
+ _: 1
279
+ }, 8, ["modelValue", "onOn:clickedAway"]);
280
+ };
281
+ }
282
+ }), We = { class: "fm-typo-en-title-md-600" }, Xe = { class: "py-16 space-y-32" }, Ze = ["data-not-allow-sort"], ea = {
283
+ key: 1,
284
+ class: "w-24"
285
+ }, aa = { class: "flex-1" }, ta = { class: "flex items-center gap-8" }, na = { class: "flex gap-8 items-center justify-start" }, oa = /* @__PURE__ */ oe({
286
+ __name: "Form",
287
+ props: {
288
+ initialValue: {}
289
+ },
290
+ setup(P, { expose: Y }) {
291
+ const m = P, $ = de(ue(fe())), { t: i } = le(), E = I(
292
+ () => m.initialValue ? i("menu.variant.form.title.edit") : i("menu.variant.form.title.add")
293
+ ), w = I(() => m.initialValue ? "Update" : "Add"), k = () => {
294
+ if (m.initialValue) {
295
+ const o = M(m.initialValue);
296
+ return o.options.push({
297
+ _id: (/* @__PURE__ */ new Date()).toISOString(),
298
+ name: ""
299
+ }), o;
300
+ } else
301
+ return { ...Z.generator.initMenuV4VariantGroup(), usedBy: [] };
302
+ }, t = x(k()), j = x(!1), v = x(!1), L = x(!1), b = x("variant"), S = (o) => {
303
+ be.isBoolean(o) ? v.value = o : v.value = !v.value;
304
+ };
305
+ function N(o) {
306
+ b.value = o, L.value = !0;
307
+ }
308
+ function G(o) {
309
+ t.value = o;
310
+ }
311
+ function D(o) {
312
+ t.value.options = o;
313
+ }
314
+ function R(o, e) {
315
+ const a = M(t.value.options), r = a.findIndex((p) => p._id == o);
316
+ a[r].name = e, t.value.options = a, r === t.value.options.length - 1 && A();
317
+ }
318
+ function A() {
319
+ const o = M(t.value.options);
320
+ t.value.options = [
321
+ ...o,
322
+ {
323
+ _id: (/* @__PURE__ */ new Date()).toISOString(),
324
+ name: ""
325
+ }
326
+ ];
327
+ }
328
+ function K(o) {
329
+ const e = M(t.value.options);
330
+ t.value.options = e.filter((a) => a._id !== o);
331
+ }
332
+ W(
333
+ () => t.value.options,
334
+ (o) => {
335
+ o.length <= 0 && A();
336
+ },
337
+ {
338
+ immediate: !0
339
+ }
340
+ );
341
+ function J(o) {
342
+ const e = o.draggedContext.futureIndex, a = o.relatedContext.list;
343
+ return e !== a.length - 1;
344
+ }
345
+ const Q = se(
346
+ () => {
347
+ if (m.initialValue) {
348
+ const o = t.value.options.filter((e) => !!e.name.trim());
349
+ return !O.isEqual({ ...t.value, options: o }, m.initialValue);
350
+ } else
351
+ return !!(t.value.options.length > 1 || t.value.name.trim());
352
+ },
353
+ () => {
354
+ v.value = !1;
355
+ }
356
+ ), B = async () => {
357
+ try {
358
+ j.value = !0;
359
+ const o = M(t.value);
360
+ o.options = o.options.filter((e) => !!e.name.trim()), m.initialValue ? await $.updateMenu(
361
+ {
362
+ module: ae.F_MENU_MODULE_V4_KEY.enum.variant,
363
+ operation: ee.F_OPERATION_TYPE.update,
364
+ data: o
365
+ },
366
+ o.name
367
+ ) : await $.updateMenu(
368
+ {
369
+ module: ae.F_MENU_MODULE_V4_KEY.enum.variant,
370
+ operation: ee.F_OPERATION_TYPE.create,
371
+ data: o
372
+ },
373
+ o.name
374
+ ), S(!1), t.value = { ...Z.generator.initMenuV4VariantGroup(), usedBy: [] };
375
+ } finally {
376
+ j.value = !1;
377
+ }
378
+ };
379
+ return W(
380
+ () => v.value,
381
+ (o) => {
382
+ o && (t.value = k());
383
+ }
384
+ ), Y({
385
+ show: v,
386
+ trigger: S
387
+ }), (o, e) => {
388
+ const a = C("fm-icon"), r = C("fm-text-field"), p = C("fm-button"), d = C("fm-side-sheet");
389
+ return f(), y(T, null, [
390
+ re(o.$slots, "default", { trigger: S }),
391
+ c(d, {
392
+ id: "variant-form",
393
+ modelValue: v.value,
394
+ "onUpdate:modelValue": e[4] || (e[4] = (u) => v.value = u),
395
+ "is-container": n(ve).FmForm,
396
+ "is-container-props": {
397
+ onValidationSuccess: B,
398
+ blameFormChildOnValidationFailed: !0
399
+ },
400
+ "max-width": 560,
401
+ "onOn:clickedAway": n(Q)
402
+ }, {
403
+ "side-sheet-header": V(() => [
404
+ l("p", We, g(E.value), 1)
405
+ ]),
406
+ "side-sheet-footer": V(() => [
407
+ l("div", na, [
408
+ c(p, {
409
+ label: w.value,
410
+ loading: j.value,
411
+ size: "lg",
412
+ type: "submit",
413
+ variant: "primary"
414
+ }, null, 8, ["label", "loading"]),
415
+ c(p, {
416
+ label: n(i)("menu.common.actions.cancel"),
417
+ size: "lg",
418
+ variant: "tertiary",
419
+ onClick: e[3] || (e[3] = () => v.value = !1)
420
+ }, null, 8, ["label"])
421
+ ])
422
+ ]),
423
+ default: V(() => {
424
+ var u;
425
+ return [
426
+ l("div", Xe, [
427
+ c(ye, {
428
+ title: n(i)("menu.variant.form.detail")
429
+ }, {
430
+ default: V(() => [
431
+ c(r, {
432
+ autofocus: "",
433
+ label: n(i)("menu.variant.form.name.label"),
434
+ "helper-text": n(i)("menu.variant.form.name.helper"),
435
+ modelValue: t.value.name,
436
+ "onUpdate:modelValue": e[1] || (e[1] = (_) => t.value.name = _),
437
+ rules: [(_) => !!_ || n(i)("menu.variant.form.name.required")],
438
+ placeholder: n(i)("menu.variant.form.name.placeholder")
439
+ }, {
440
+ append: V(() => [
441
+ c(a, {
442
+ name: "g_translate",
443
+ class: "cursor-pointer",
444
+ onClick: e[0] || (e[0] = (_) => N("variant"))
445
+ })
446
+ ]),
447
+ _: 1
448
+ }, 8, ["label", "helper-text", "modelValue", "rules", "placeholder"]),
449
+ c(_e, {
450
+ label: n(i)("menu.variant.form.options.title")
451
+ }, {
452
+ default: V(() => [
453
+ l("div", null, [
454
+ c(n(me), {
455
+ "model-value": t.value.options,
456
+ move: J,
457
+ class: "space-y-16",
458
+ group: "categories",
459
+ handle: ".handle",
460
+ "item-key": "_id",
461
+ "onUpdate:modelValue": D
462
+ }, {
463
+ item: V(({ element: _, index: s }) => [
464
+ l("div", {
465
+ class: X(["flex items-center", "space-x-8"]),
466
+ "data-not-allow-sort": s === t.value.options.length - 1
467
+ }, [
468
+ s !== t.value.options.length - 1 ? (f(), z(a, {
469
+ key: 0,
470
+ class: "handle",
471
+ name: "drag_handle"
472
+ })) : s > 0 ? (f(), y("div", ea)) : U("", !0),
473
+ l("div", aa, [
474
+ c(r, {
475
+ "model-value": _.name,
476
+ rules: [
477
+ () => !!t.value.options.length || n(i)("menu.variant.form.options.min_required"),
478
+ (h) => s === t.value.options.length - 1 || h ? !0 : n(i)("menu.variant.form.options.name_required")
479
+ ],
480
+ class: "flex-1",
481
+ placeholder: n(i)("menu.variant.form.options.placeholder"),
482
+ "onUpdate:modelValue": (h) => R(_._id, h)
483
+ }, ce({ _: 2 }, [
484
+ s !== t.value.options.length - 1 ? {
485
+ name: "append",
486
+ fn: V(() => [
487
+ l("div", ta, [
488
+ c(a, {
489
+ name: "g_translate",
490
+ class: "cursor-pointer",
491
+ onClick: e[2] || (e[2] = (h) => N("options"))
492
+ }),
493
+ c(a, {
494
+ name: "close",
495
+ onClick: (h) => K(_._id)
496
+ }, null, 8, ["onClick"])
497
+ ])
498
+ ]),
499
+ key: "0"
500
+ } : void 0
501
+ ]), 1032, ["model-value", "rules", "placeholder", "onUpdate:modelValue"])
502
+ ])
503
+ ], 8, Ze)
504
+ ]),
505
+ _: 1
506
+ }, 8, ["model-value"])
507
+ ])
508
+ ]),
509
+ _: 1
510
+ }, 8, ["label"])
511
+ ]),
512
+ _: 1
513
+ }, 8, ["title"]),
514
+ (u = t.value.usedBy) != null && u.length ? (f(), z(he, {
515
+ key: 0,
516
+ editable: !1,
517
+ overrides: t.value.usedBy || [],
518
+ "select-variant": !1,
519
+ title: n(i)("menu.variant.form.applied_product")
520
+ }, null, 8, ["overrides", "title"])) : U("", !0)
521
+ ])
522
+ ];
523
+ }),
524
+ _: 1
525
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]),
526
+ c(He, {
527
+ modelValue: L.value,
528
+ "onUpdate:modelValue": e[5] || (e[5] = (u) => L.value = u),
529
+ variant: t.value,
530
+ "expand-section": b.value,
531
+ "onUpdate:variant": G
532
+ }, null, 8, ["modelValue", "variant", "expand-section"])
533
+ ], 64);
534
+ };
535
+ }
536
+ }), _a = oa;
537
+ export {
538
+ _a as V
539
+ };