@feedmepos/mf-menu 0.32.42-dev.3 → 0.32.43-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 (67) hide show
  1. package/dist/{App-1oMjfIcc.js → App-CiqMdAvF.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-AIw0Zgzf.js → ApplyProduct.vue_vue_type_script_setup_true_lang-CVs7MfmX.js} +3 -3
  3. package/dist/{Catalog-CvQo24ck.js → Catalog-KzftKfOt.js} +6 -6
  4. package/dist/{Category-DmIaxrrK.js → Category-em6K5yk3.js} +5 -5
  5. package/dist/{Category-C8bM8EwO.js → Category-pNQdkIvn.js} +4 -4
  6. package/dist/{CookingGuide-CKEbyk4o.js → CookingGuide-Bp9CvTAi.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-Ci4gwgnH.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-BbsxEs6O.js} +1 -1
  8. package/dist/{Group-CoYyRvcx.js → Group-eE_snSRq.js} +1 -1
  9. package/dist/{Group-EnJDk54z.js → Group-mIwdwq58.js} +3 -3
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-tH2U82rV.js → Group.vue_vue_type_script_setup_true_lang-C5l4ycJB.js} +8 -8
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BDxjuWcY.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-B4PznWDZ.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-gVXNoAaN.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-eS8pMvVG.js} +210 -210
  13. package/dist/{Ingredient-7PPPp7Yf.js → Ingredient-BNvYYdb5.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-DQPjpqtv.js → InventoryBinding.vue_vue_type_script_setup_true_lang-CzQIddna.js} +2 -2
  15. package/dist/{LinkProductSideSheet-BS-MEIOG.js → LinkProductSideSheet-BQQtUuCr.js} +3 -3
  16. package/dist/{MenuSetting-BNVyT0oG.js → MenuSetting-s9syqMsT.js} +5 -5
  17. package/dist/{PrintRoute-BMdk0zDv.js → PrintRoute-BqMxtnus.js} +4 -4
  18. package/dist/{Product-DbIK7Eog.js → Product-CHhpb-2E.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-FnX_M8lJ.js → Product.vue_vue_type_script_setup_true_lang-DHny0uGc.js} +13 -13
  20. package/dist/{ProductInternalTools-BC8jWpQd.js → ProductInternalTools-DEB8Xhnv.js} +5 -5
  21. package/dist/{Products-CPi2vuUO.js → Products-C7UtJMGZ.js} +34 -34
  22. package/dist/{Publish-BcxHXZ1J.js → Publish-tnJY6n8r.js} +3 -3
  23. package/dist/{Recipe-egyxyFfA.js → Recipe-DDPXv3AU.js} +4 -4
  24. package/dist/{RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-CP1NjxzF.js → RestaurantAttributesSelector.vue_vue_type_script_setup_true_lang-PFRwBb1c.js} +1 -1
  25. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-CPMCeAK9.js → RuleView.vue_vue_type_script_setup_true_lang-roEHTZnU.js} +2 -2
  26. package/dist/{Scheduler-Cb-IJtj8.js → Scheduler-CMKwUkNN.js} +3 -3
  27. package/dist/{ServingSequence-B46n34xA.js → ServingSequence-NA0yeDMF.js} +3 -3
  28. package/dist/{Setting-B_dZG5ZC.js → Setting-BRfi_hxY.js} +5 -5
  29. package/dist/{Subcategory-DbjLfXvf.js → Subcategory-W9faZY7n.js} +6 -6
  30. package/dist/{Takeaway-DNu6jYFC.js → Takeaway-5DKxdpZ3.js} +1 -1
  31. package/dist/{Takeaway-D4axornr.js → Takeaway-fijUedLA.js} +4 -4
  32. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-BhiFnON_.js +324 -0
  33. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-BjPOOURv.js → Thumbnail.vue_vue_type_script_setup_true_lang-BUNPf1OD.js} +4 -4
  34. package/dist/{TranslationSideSheet.vue_vue_type_script_setup_true_lang-CXGsdChM.js → TranslationSideSheet.vue_vue_type_script_setup_true_lang-DZp38dX4.js} +68 -66
  35. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-C9eskCL4.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DC4naR16.js} +13 -13
  36. package/dist/{Unit-jV5Bee8E.js → Unit-582FVjPq.js} +2 -2
  37. package/dist/{Variant-jGcgA-W8.js → Variant-Cb02SmoL.js} +4 -4
  38. package/dist/{_id_-CtvQ64EN.js → _id_-BYU1xwzB.js} +9 -9
  39. package/dist/{app-B6laFmet.js → app-0m01R0SM.js} +31 -31
  40. package/dist/{app-eq7TaFfk.js → app-CcPyLfvj.js} +1 -1
  41. package/dist/app.js +1 -1
  42. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  43. package/dist/assets/{linked-status-Db18QnYH.js → linked-status-C1DHqpkR.js} +2 -2
  44. package/dist/assets/{menu-export-24uzPEwW.js → menu-export-Ci-MXpn1.js} +2 -2
  45. package/dist/assets/{override-menu-DreGPEa-.js → override-menu-CajXgOdO.js} +2 -2
  46. package/dist/assets/{validate-menu-BSFHH8O3.js → validate-menu-DDPswAia.js} +2 -2
  47. package/dist/{catalog-CXcQ-QmP.js → catalog-Bs3SNL7n.js} +1 -1
  48. package/dist/{catalogSetting-DnUHD0I1.js → catalogSetting-BN4d_FvT.js} +1 -1
  49. package/dist/{currency-CwtLEvAZ.js → currency-Cma3AX0v.js} +1 -1
  50. package/dist/{dayjs.min-BgQgGKeN.js → dayjs.min-D-HR3H5W.js} +2 -2
  51. package/dist/{index-Cx1Nqii7.js → index-3wsuY29D.js} +6 -6
  52. package/dist/index-DXY5zcNA.js +545 -0
  53. package/dist/{index.vue_vue_type_script_setup_true_lang-CA1qH7Vf.js → index.vue_vue_type_script_setup_true_lang-DotsunNI.js} +5 -5
  54. package/dist/{item-CKRLnCIs.js → item-DOcT7NVT.js} +2587 -2587
  55. package/dist/{jszip.min-DOHC0a7i.js → jszip.min-h2cXUF_-.js} +3 -3
  56. package/dist/{menu-BduvULfe.js → menu-CAmS3pcT.js} +1 -1
  57. package/dist/{menuV2-Da1zBhkS.js → menuV2-COwLB3e1.js} +79 -79
  58. package/dist/packages/shared/src/helpers/actionButton.d.ts +2 -2
  59. package/dist/{priceTier-tObdSj6z.js → priceTier-DrrQcFCh.js} +1 -1
  60. package/dist/{rules-DD816lrT.js → rules-DGRdKiV6.js} +4 -4
  61. package/dist/{scheduler-CDhxmmVX.js → scheduler-BpEV0N8K.js} +4 -4
  62. package/dist/{toExcel-tz6MIiQY.js → toExcel-eN1zgiqN.js} +2 -2
  63. package/dist/{translation-Cdap0IVg.js → translation-BCZ1Ruvv.js} +35 -21
  64. package/dist/{unit-NGl3h7Qh.js → unit-BAcozp9s.js} +2 -2
  65. package/package.json +2 -2
  66. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-Dvm8Lfp3.js +0 -316
  67. package/dist/index-D-Saeea8.js +0 -545
@@ -1,4 +1,4 @@
1
- import { u as h, y as n, J as d, ai as _ } from "./index.vue_vue_type_script_setup_true_lang-CA1qH7Vf.js";
1
+ import { u as h, y as n, J as d, ai as _ } from "./index.vue_vue_type_script_setup_true_lang-DotsunNI.js";
2
2
  import "@feedmepos/ui-library";
3
3
  class u {
4
4
  constructor(t, e, r, a) {
@@ -1,4 +1,4 @@
1
- import { y as u, G as i } from "./index.vue_vue_type_script_setup_true_lang-CA1qH7Vf.js";
1
+ import { y as u, G as i } from "./index.vue_vue_type_script_setup_true_lang-DotsunNI.js";
2
2
  var a = /* @__PURE__ */ ((e) => (e.AUTO = "auto", e.MANUAL = "manual", e))(a || {}), m = /* @__PURE__ */ ((e) => (e[e.Normal = 0] = "Normal", e[e.Rules = 1] = "Rules", e))(m || {});
3
3
  class s {
4
4
  static fromCatalog(r, n) {
@@ -1,4 +1,4 @@
1
- import { z as e } from "./index.vue_vue_type_script_setup_true_lang-CA1qH7Vf.js";
1
+ import { z as e } from "./index.vue_vue_type_script_setup_true_lang-DotsunNI.js";
2
2
  function n(r, o = !0) {
3
3
  return e.Dinero.fromFdoDinero(r).toFormat(o).replaceAll(" ", "");
4
4
  }
@@ -1,5 +1,5 @@
1
- import { g as r } from "./app-B6laFmet.js";
2
- import { aj as a } from "./index.vue_vue_type_script_setup_true_lang-CA1qH7Vf.js";
1
+ import { g as r } from "./app-0m01R0SM.js";
2
+ import { aj as a } from "./index.vue_vue_type_script_setup_true_lang-DotsunNI.js";
3
3
  var o = a();
4
4
  const m = /* @__PURE__ */ r(o);
5
5
  export {
@@ -1,15 +1,15 @@
1
- import { z as $, y as Y, u as Z, G as Q, A as z, H as X } from "./index.vue_vue_type_script_setup_true_lang-CA1qH7Vf.js";
1
+ import { z as $, y as Y, u as Z, G as Q, A as z, H as X } from "./index.vue_vue_type_script_setup_true_lang-DotsunNI.js";
2
2
  import { defineComponent as R, ref as h, computed as _, watch as j, onMounted as ee, onBeforeUnmount as ae, resolveComponent as x, createBlock as H, openBlock as L, withModifiers as q, withCtx as k, renderSlot as P, createElementBlock as I, Fragment as A, createVNode as v, unref as i, createElementVNode as U, createCommentVNode as te, renderList as le, toDisplayString as O } from "vue";
3
3
  import { useI18n as W } from "@feedmepos/mf-common";
4
4
  import { components as ne } from "@feedmepos/ui-library";
5
- import { _ as oe } from "./RuleView.vue_vue_type_script_setup_true_lang-CPMCeAK9.js";
5
+ import { _ as oe } from "./RuleView.vue_vue_type_script_setup_true_lang-roEHTZnU.js";
6
6
  import { u as ie } from "./discardConfirm-BHni0LNu.js";
7
- import { _ as re } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-AIw0Zgzf.js";
8
- import { _ as ue } from "./TranslationSideSheet.vue_vue_type_script_setup_true_lang-CXGsdChM.js";
7
+ import { _ as re } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-CVs7MfmX.js";
8
+ import { _ as ue } from "./TranslationSideSheet.vue_vue_type_script_setup_true_lang-DZp38dX4.js";
9
9
  import { c as se } from "./check-C9mY6LiX.js";
10
- import { f as me } from "./currency-CwtLEvAZ.js";
10
+ import { f as me } from "./currency-Cma3AX0v.js";
11
11
  import { c as de } from "./string-DpfFixWH.js";
12
- import { g as K } from "./translation-Cdap0IVg.js";
12
+ import { g as K } from "./translation-BCZ1Ruvv.js";
13
13
  const pe = /* @__PURE__ */ R({
14
14
  __name: "CurrencyInput",
15
15
  props: {
@@ -0,0 +1,545 @@
1
+ import { defineComponent as re, ref as p, computed as z, watch as ae, resolveComponent as $, createBlock as K, openBlock as f, unref as l, withCtx as C, createElementVNode as n, toDisplayString as x, createElementBlock as _, createCommentVNode as F, Fragment as I, renderList as B, createVNode as u, normalizeClass as te, renderSlot as me, createSlots as ve } from "vue";
2
+ import { H as U, O as fe, B as pe, G as q, A as le, J as ne, y as oe } from "./index.vue_vue_type_script_setup_true_lang-DotsunNI.js";
3
+ import { d as _e } from "./vuedraggable-CK8z7qA8.js";
4
+ import { useI18n as de, ALL_LOCALE_OPTIONS as D } from "@feedmepos/mf-common";
5
+ import { useSnackbar as ye, components as he } from "@feedmepos/ui-library";
6
+ import { _ as be } from "./FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js";
7
+ import { _ as ge } from "./RuleView.vue_vue_type_script_setup_true_lang-roEHTZnU.js";
8
+ import { u as ce } from "./discardConfirm-BHni0LNu.js";
9
+ import { _ as xe } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-CVs7MfmX.js";
10
+ import { g as R, a as ee, _ as se, b as ie } from "./translation-BCZ1Ruvv.js";
11
+ import { c as Ve } from "./check-C9mY6LiX.js";
12
+ const ke = { class: "fm-typo-en-title-md-600" }, Ce = { class: "pt-8 space-y-24" }, Ee = { class: "flex flex-col gap-8" }, Oe = { class: "text-fm-color-typo-primary fm-typo-en-body-lg-600" }, we = { class: "flex items-center gap-8 flex-wrap" }, Ue = { 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" }, $e = { class: "fm-typo-en-body-md-600" }, Ne = ["onClick"], Le = { class: "flex items-center gap-8" }, je = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Se = { class: "fm-typo-en-body-md-400" }, Te = { class: "flex flex-col gap-16 border p-16 rounded-lg" }, Fe = { class: "fm-typo-en-body-lg-600" }, De = {
13
+ key: 0,
14
+ class: "flex flex-col gap-32 pl-32"
15
+ }, Ie = {
16
+ key: 0,
17
+ class: "space-y-8"
18
+ }, Me = { class: "flex w-[100px] items-center gap-8" }, Ae = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Be = { class: "fm-typo-en-body-md-400" }, qe = { class: "flex-1" }, ze = { class: "flex flex-col gap-16 border p-16 rounded-lg" }, Pe = { class: "fm-typo-en-body-lg-600" }, Ye = {
19
+ key: 0,
20
+ class: "flex flex-col gap-32 pl-32"
21
+ }, Ge = { class: "fm-typo-en-body-md-600 text-fm-color-primary border border-fm-color-primary inline-block rounded-md px-8 py-4" }, Re = { class: "space-y-32" }, Ke = {
22
+ key: 0,
23
+ class: "space-y-8"
24
+ }, He = { class: "flex w-[100px] items-center gap-8" }, Je = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Qe = { class: "fm-typo-en-body-md-400" }, We = { class: "flex-1" }, Xe = { class: "flex gap-8 items-center justify-start" }, Ze = /* @__PURE__ */ re({
25
+ __name: "ProductVariantTranslation",
26
+ props: {
27
+ modelValue: { type: Boolean },
28
+ variant: {},
29
+ expandSection: { default: "variant" }
30
+ },
31
+ emits: ["update:modelValue", "update:variant"],
32
+ setup(H, { emit: J }) {
33
+ const v = H, T = J, { t: d } = de(), N = p(!1), L = p(!1), y = p([]), s = p([]), V = p({}), E = p({}), O = p(""), M = p(""), h = p({}), A = p({}), j = p({}), P = p({}), Q = z(() => v.variant.options.map((o, e) => ({
34
+ ...o,
35
+ optionIndex: e + 1
36
+ })).filter((o) => o.name.trim() !== ""));
37
+ function Y() {
38
+ const o = /* @__PURE__ */ new Set();
39
+ v.variant.name_locale && Object.keys(v.variant.name_locale).forEach((i) => o.add(i)), v.variant.options.forEach((i) => {
40
+ i.name_locale && Object.keys(i.name_locale).forEach((k) => o.add(k));
41
+ });
42
+ const e = Array.from(o).map((i) => {
43
+ const k = D.find((t) => t.code === i);
44
+ return {
45
+ localeCode: i,
46
+ localeName: (k == null ? void 0 : k.name) || i,
47
+ value: ""
48
+ // Not used for language selection
49
+ };
50
+ });
51
+ y.value = e;
52
+ const r = {};
53
+ v.variant.name_locale && Object.entries(v.variant.name_locale).forEach(([i, k]) => {
54
+ r[i] = k;
55
+ }), V.value = r, O.value = v.variant.name;
56
+ const m = {}, g = {};
57
+ v.variant.options.forEach((i) => {
58
+ m[i._id] = {}, i.name_locale && Object.entries(i.name_locale).forEach(([k, t]) => {
59
+ m[i._id][k] = t;
60
+ }), g[i._id] = i.name;
61
+ }), h.value = m, j.value = g;
62
+ }
63
+ ae(
64
+ () => [v.modelValue, v.variant, v.expandSection],
65
+ ([o, , e]) => {
66
+ o && (Y(), s.value = U.clone(y.value), E.value = U.clone(V.value), M.value = O.value, A.value = U.clone(h.value), P.value = U.clone(j.value), e === "variant" ? (N.value = !0, L.value = !1) : (N.value = !1, L.value = !0));
67
+ },
68
+ { immediate: !0, deep: !0 }
69
+ );
70
+ const G = z(() => {
71
+ const o = new Set(y.value.map((e) => e.localeCode));
72
+ return D.filter((e) => !o.has(e.code)).map((e) => ({
73
+ code: e.code,
74
+ name: e.name,
75
+ icon: R(e.code)
76
+ }));
77
+ });
78
+ function W(o) {
79
+ const e = D.find((r) => r.code === o);
80
+ e && (y.value.push({
81
+ localeCode: e.code,
82
+ localeName: e.name,
83
+ value: ""
84
+ }), V.value[e.code] || (V.value[e.code] = ""), Object.keys(h.value).forEach((r) => {
85
+ h.value[r][e.code] || (h.value[r][e.code] = "");
86
+ }));
87
+ }
88
+ function X(o) {
89
+ y.value = y.value.filter((e) => e.localeCode !== o), delete V.value[o], Object.keys(h.value).forEach((e) => {
90
+ delete h.value[e][o];
91
+ });
92
+ }
93
+ function Z() {
94
+ return !U.isEqual(y.value, s.value) || !U.isEqual(V.value, E.value) || O.value !== M.value || !U.isEqual(h.value, A.value) || !U.isEqual(j.value, P.value);
95
+ }
96
+ function a() {
97
+ const o = U.clone(v.variant);
98
+ O.value !== void 0 && (o.name = O.value);
99
+ const e = {};
100
+ Object.entries(V.value).forEach(([r, m]) => {
101
+ m && m.trim() && (e[r] = m.trim());
102
+ }), Object.keys(e).length > 0 ? o.name_locale = e : delete o.name_locale, o.options.forEach((r) => {
103
+ const m = j.value[r._id];
104
+ m !== void 0 && (r.name = m);
105
+ const g = h.value[r._id];
106
+ if (g && Object.keys(g).length > 0) {
107
+ const i = {};
108
+ Object.entries(g).forEach(([k, t]) => {
109
+ t && t.trim() && (i[k] = t.trim());
110
+ }), Object.keys(i).length > 0 ? r.name_locale = i : delete r.name_locale;
111
+ } else
112
+ delete r.name_locale;
113
+ }), T("update:variant", o), T("update:modelValue", !1);
114
+ }
115
+ function c() {
116
+ T("update:modelValue", !1);
117
+ }
118
+ const b = ce(Z, c), S = z({
119
+ get: () => v.modelValue,
120
+ set: (o) => T("update:modelValue", o)
121
+ });
122
+ return (o, e) => {
123
+ const r = $("FmIcon"), m = $("fm-button"), g = $("FmMenu"), i = $("fm-text-field"), k = $("fm-side-sheet");
124
+ return f(), K(k, {
125
+ modelValue: S.value,
126
+ "onUpdate:modelValue": e[3] || (e[3] = (t) => S.value = t),
127
+ "max-width": 720,
128
+ "onOn:clickedAway": l(b)
129
+ }, {
130
+ "side-sheet-header": C(() => [
131
+ n("p", ke, x(l(d)("menu.variant.form.translation.title")), 1)
132
+ ]),
133
+ "side-sheet-footer": C(() => [
134
+ n("div", Xe, [
135
+ u(m, {
136
+ label: l(d)("common.save"),
137
+ size: "lg",
138
+ variant: "primary",
139
+ onClick: a
140
+ }, null, 8, ["label"]),
141
+ u(m, {
142
+ label: l(d)("common.cancel"),
143
+ size: "lg",
144
+ variant: "tertiary",
145
+ onClick: l(b)
146
+ }, null, 8, ["label", "onClick"])
147
+ ])
148
+ ]),
149
+ default: C(() => [
150
+ n("div", Ce, [
151
+ n("div", Ee, [
152
+ n("p", Oe, x(l(d)("menu.variant.form.translation.language")), 1),
153
+ n("div", we, [
154
+ (f(!0), _(I, null, B(y.value, (t) => (f(), _("div", {
155
+ key: t.localeCode,
156
+ class: "flex items-center gap-8 p-8 border border-fm-color-primary text-fm-color-primary rounded-full"
157
+ }, [
158
+ n("div", Ue, x(l(R)(t.localeCode)), 1),
159
+ n("span", $e, x(l(ee)(t.localeCode, l(D))), 1),
160
+ u(r, {
161
+ name: "close",
162
+ class: "cursor-pointer",
163
+ variant: "secondary",
164
+ onClick: (w) => X(t.localeCode)
165
+ }, null, 8, ["onClick"])
166
+ ]))), 128)),
167
+ G.value.length > 0 ? (f(), K(g, { key: 0 }, {
168
+ "menu-button": C(() => [
169
+ u(m, {
170
+ variant: "secondary",
171
+ "border-color": "neutral-gray-300",
172
+ "text-color": "neutral-gray-400",
173
+ icon: "add"
174
+ })
175
+ ]),
176
+ default: C(() => [
177
+ (f(!0), _(I, null, B(G.value, (t) => (f(), _("div", {
178
+ key: t.code,
179
+ class: "p-12 cursor-pointer hover:bg-fm-color-opacity-md rounded-sm",
180
+ onClick: (w) => W(t.code)
181
+ }, [
182
+ n("div", Le, [
183
+ n("div", je, x(t.icon), 1),
184
+ n("span", Se, x(t.name), 1)
185
+ ])
186
+ ], 8, Ne))), 128))
187
+ ]),
188
+ _: 1
189
+ })) : F("", !0)
190
+ ])
191
+ ]),
192
+ n("div", Te, [
193
+ n("div", {
194
+ class: "flex items-center gap-16 cursor-pointer",
195
+ onClick: e[0] || (e[0] = (t) => N.value = !N.value)
196
+ }, [
197
+ u(r, {
198
+ name: "keyboard_arrow_down",
199
+ class: te(["transition-transform", N.value ? "transform rotate-180" : ""])
200
+ }, null, 8, ["class"]),
201
+ n("p", Fe, x(l(d)("menu.variant.form.translation.variant_name")), 1)
202
+ ]),
203
+ N.value ? (f(), _("div", De, [
204
+ u(se, {
205
+ label: l(d)("menu.variant.form.translation.default"),
206
+ modelValue: O.value,
207
+ "onUpdate:modelValue": e[1] || (e[1] = (t) => O.value = t)
208
+ }, null, 8, ["label", "modelValue"]),
209
+ y.value.length > 0 ? (f(), _("div", Ie, [
210
+ u(ie, {
211
+ label: l(d)("menu.variant.form.translation.translation")
212
+ }, null, 8, ["label"]),
213
+ (f(!0), _(I, null, B(y.value, (t) => (f(), _("div", {
214
+ key: t.localeCode,
215
+ class: "flex items-center gap-16"
216
+ }, [
217
+ n("div", Me, [
218
+ n("div", Ae, x(l(R)(t.localeCode)), 1),
219
+ n("span", Be, x(l(ee)(t.localeCode, l(D))), 1)
220
+ ]),
221
+ n("div", qe, [
222
+ u(i, {
223
+ modelValue: V.value[t.localeCode],
224
+ "onUpdate:modelValue": (w) => V.value[t.localeCode] = w,
225
+ placeholder: o.variant.name
226
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
227
+ ])
228
+ ]))), 128))
229
+ ])) : F("", !0)
230
+ ])) : F("", !0)
231
+ ]),
232
+ n("div", ze, [
233
+ n("div", {
234
+ class: "flex items-center gap-16 cursor-pointer",
235
+ onClick: e[2] || (e[2] = (t) => L.value = !L.value)
236
+ }, [
237
+ u(r, {
238
+ name: "keyboard_arrow_down",
239
+ class: te(["transition-transform", L.value ? "transform rotate-180" : ""])
240
+ }, null, 8, ["class"]),
241
+ n("p", Pe, x(l(d)("menu.variant.form.translation.option_value")), 1)
242
+ ]),
243
+ L.value ? (f(), _("div", Ye, [
244
+ (f(!0), _(I, null, B(Q.value, (t) => (f(), _("div", {
245
+ key: t._id,
246
+ class: "space-y-8"
247
+ }, [
248
+ n("p", Ge, x(l(d)("menu.variant.form.translation.option", { number: t.optionIndex })), 1),
249
+ n("div", Re, [
250
+ u(se, {
251
+ label: l(d)("menu.variant.form.translation.default"),
252
+ modelValue: j.value[t._id],
253
+ "onUpdate:modelValue": (w) => j.value[t._id] = w,
254
+ spacing: "sm"
255
+ }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]),
256
+ y.value.length > 0 ? (f(), _("div", Ke, [
257
+ u(ie, {
258
+ label: l(d)("menu.variant.form.translation.translation"),
259
+ spacing: "sm"
260
+ }, null, 8, ["label"]),
261
+ (f(!0), _(I, null, B(y.value, (w) => (f(), _("div", {
262
+ key: w.localeCode,
263
+ class: "flex items-center gap-16"
264
+ }, [
265
+ n("div", He, [
266
+ n("div", Je, x(l(R)(w.localeCode)), 1),
267
+ n("span", Qe, x(l(ee)(w.localeCode, l(D))), 1)
268
+ ]),
269
+ n("div", We, [
270
+ u(i, {
271
+ modelValue: h.value[t._id][w.localeCode],
272
+ "onUpdate:modelValue": (ue) => h.value[t._id][w.localeCode] = ue,
273
+ placeholder: t.name
274
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
275
+ ])
276
+ ]))), 128))
277
+ ])) : F("", !0)
278
+ ])
279
+ ]))), 128))
280
+ ])) : F("", !0)
281
+ ])
282
+ ])
283
+ ]),
284
+ _: 1
285
+ }, 8, ["modelValue", "onOn:clickedAway"]);
286
+ };
287
+ }
288
+ }), ea = { class: "fm-typo-en-title-md-600" }, aa = { class: "py-16 space-y-32" }, ta = ["data-not-allow-sort"], la = {
289
+ key: 1,
290
+ class: "w-24"
291
+ }, na = { class: "flex-1" }, oa = { class: "flex items-center gap-8" }, sa = { class: "flex gap-8 items-center justify-start" }, ia = /* @__PURE__ */ re({
292
+ __name: "Form",
293
+ props: {
294
+ initialValue: {}
295
+ },
296
+ setup(H, { expose: J }) {
297
+ const v = H, T = fe(pe(ye())), { t: d } = de(), N = z(
298
+ () => v.initialValue ? d("menu.variant.form.title.edit") : d("menu.variant.form.title.add")
299
+ ), L = z(() => v.initialValue ? "Update" : "Add"), y = () => {
300
+ if (v.initialValue) {
301
+ const a = q(v.initialValue);
302
+ return a.options.push({
303
+ _id: (/* @__PURE__ */ new Date()).toISOString(),
304
+ name: ""
305
+ }), a;
306
+ } else
307
+ return { ...le.generator.initMenuV4VariantGroup(), usedBy: [] };
308
+ }, s = p(y()), V = p(!1), E = p(!1), O = p(!1), M = p("variant"), h = (a) => {
309
+ Ve.isBoolean(a) ? E.value = a : E.value = !E.value;
310
+ };
311
+ function A(a) {
312
+ M.value = a, O.value = !0;
313
+ }
314
+ function j(a) {
315
+ s.value = a;
316
+ }
317
+ function P(a) {
318
+ s.value.options = a;
319
+ }
320
+ function Q(a, c) {
321
+ const b = q(s.value.options), S = b.findIndex((o) => o._id == a);
322
+ b[S].name = c, s.value.options = b, S === s.value.options.length - 1 && Y();
323
+ }
324
+ function Y() {
325
+ const a = q(s.value.options);
326
+ s.value.options = [
327
+ ...a,
328
+ {
329
+ _id: (/* @__PURE__ */ new Date()).toISOString(),
330
+ name: ""
331
+ }
332
+ ];
333
+ }
334
+ function G(a) {
335
+ const c = q(s.value.options);
336
+ s.value.options = c.filter((b) => b._id !== a);
337
+ }
338
+ ae(
339
+ () => s.value.options,
340
+ (a) => {
341
+ a.length <= 0 && Y();
342
+ },
343
+ {
344
+ immediate: !0
345
+ }
346
+ );
347
+ function W(a) {
348
+ const c = a.draggedContext.futureIndex, b = a.relatedContext.list;
349
+ return c !== b.length - 1;
350
+ }
351
+ const X = ce(
352
+ () => {
353
+ if (v.initialValue) {
354
+ const a = s.value.options.filter((c) => !!c.name.trim());
355
+ return !U.isEqual({ ...s.value, options: a }, v.initialValue);
356
+ } else
357
+ return !!(s.value.options.length > 1 || s.value.name.trim());
358
+ },
359
+ () => {
360
+ E.value = !1;
361
+ }
362
+ ), Z = async () => {
363
+ try {
364
+ V.value = !0;
365
+ const a = q(s.value);
366
+ a.options = a.options.filter((c) => !!c.name.trim()), v.initialValue ? await T.updateMenu(
367
+ {
368
+ module: oe.F_MENU_MODULE_V4_KEY.enum.variant,
369
+ operation: ne.F_OPERATION_TYPE.update,
370
+ data: a
371
+ },
372
+ a.name
373
+ ) : await T.updateMenu(
374
+ {
375
+ module: oe.F_MENU_MODULE_V4_KEY.enum.variant,
376
+ operation: ne.F_OPERATION_TYPE.create,
377
+ data: a
378
+ },
379
+ a.name
380
+ ), h(!1), s.value = { ...le.generator.initMenuV4VariantGroup(), usedBy: [] };
381
+ } finally {
382
+ V.value = !1;
383
+ }
384
+ };
385
+ return ae(
386
+ () => E.value,
387
+ (a) => {
388
+ a && (s.value = y());
389
+ }
390
+ ), J({
391
+ show: E,
392
+ trigger: h
393
+ }), (a, c) => {
394
+ const b = $("fm-icon"), S = $("fm-text-field"), o = $("fm-button"), e = $("fm-side-sheet");
395
+ return f(), _(I, null, [
396
+ me(a.$slots, "default", { trigger: h }),
397
+ u(e, {
398
+ id: "variant-form",
399
+ modelValue: E.value,
400
+ "onUpdate:modelValue": c[4] || (c[4] = (r) => E.value = r),
401
+ "is-container": l(he).FmForm,
402
+ "is-container-props": {
403
+ onValidationSuccess: Z,
404
+ blameFormChildOnValidationFailed: !0
405
+ },
406
+ "max-width": 560,
407
+ "onOn:clickedAway": l(X)
408
+ }, {
409
+ "side-sheet-header": C(() => [
410
+ n("p", ea, x(N.value), 1)
411
+ ]),
412
+ "side-sheet-footer": C(() => [
413
+ n("div", sa, [
414
+ u(o, {
415
+ label: L.value,
416
+ loading: V.value,
417
+ size: "lg",
418
+ type: "submit",
419
+ variant: "primary"
420
+ }, null, 8, ["label", "loading"]),
421
+ u(o, {
422
+ label: l(d)("menu.common.actions.cancel"),
423
+ size: "lg",
424
+ variant: "tertiary",
425
+ onClick: c[3] || (c[3] = () => E.value = !1)
426
+ }, null, 8, ["label"])
427
+ ])
428
+ ]),
429
+ default: C(() => {
430
+ var r;
431
+ return [
432
+ n("div", aa, [
433
+ u(ge, {
434
+ title: l(d)("menu.variant.form.detail")
435
+ }, {
436
+ default: C(() => [
437
+ u(S, {
438
+ autofocus: "",
439
+ label: l(d)("menu.variant.form.name.label"),
440
+ "helper-text": l(d)("menu.variant.form.name.helper"),
441
+ modelValue: s.value.name,
442
+ "onUpdate:modelValue": c[1] || (c[1] = (m) => s.value.name = m),
443
+ rules: [(m) => !!m || l(d)("menu.variant.form.name.required")],
444
+ placeholder: l(d)("menu.variant.form.name.placeholder")
445
+ }, {
446
+ append: C(() => [
447
+ u(b, {
448
+ name: "g_translate",
449
+ class: "cursor-pointer",
450
+ onClick: c[0] || (c[0] = (m) => A("variant"))
451
+ })
452
+ ]),
453
+ _: 1
454
+ }, 8, ["label", "helper-text", "modelValue", "rules", "placeholder"]),
455
+ u(be, {
456
+ label: l(d)("menu.variant.form.options.title")
457
+ }, {
458
+ default: C(() => [
459
+ n("div", null, [
460
+ u(l(_e), {
461
+ "model-value": s.value.options,
462
+ move: W,
463
+ class: "space-y-16",
464
+ group: "categories",
465
+ handle: ".handle",
466
+ "item-key": "_id",
467
+ "onUpdate:modelValue": P
468
+ }, {
469
+ item: C(({ element: m, index: g }) => [
470
+ n("div", {
471
+ class: te(["flex items-center", "space-x-8"]),
472
+ "data-not-allow-sort": g === s.value.options.length - 1
473
+ }, [
474
+ g !== s.value.options.length - 1 ? (f(), K(b, {
475
+ key: 0,
476
+ class: "handle",
477
+ name: "drag_handle"
478
+ })) : g > 0 ? (f(), _("div", la)) : F("", !0),
479
+ n("div", na, [
480
+ u(S, {
481
+ "model-value": m.name,
482
+ rules: [
483
+ () => !!s.value.options.length || l(d)("menu.variant.form.options.min_required"),
484
+ (i) => g === s.value.options.length - 1 || i ? !0 : l(d)("menu.variant.form.options.name_required")
485
+ ],
486
+ class: "flex-1",
487
+ placeholder: l(d)("menu.variant.form.options.placeholder"),
488
+ "onUpdate:modelValue": (i) => Q(m._id, i)
489
+ }, ve({ _: 2 }, [
490
+ g !== s.value.options.length - 1 ? {
491
+ name: "append",
492
+ fn: C(() => [
493
+ n("div", oa, [
494
+ u(b, {
495
+ name: "g_translate",
496
+ class: "cursor-pointer",
497
+ onClick: c[2] || (c[2] = (i) => A("options"))
498
+ }),
499
+ u(b, {
500
+ name: "close",
501
+ onClick: (i) => G(m._id)
502
+ }, null, 8, ["onClick"])
503
+ ])
504
+ ]),
505
+ key: "0"
506
+ } : void 0
507
+ ]), 1032, ["model-value", "rules", "placeholder", "onUpdate:modelValue"])
508
+ ])
509
+ ], 8, ta)
510
+ ]),
511
+ _: 1
512
+ }, 8, ["model-value"])
513
+ ])
514
+ ]),
515
+ _: 1
516
+ }, 8, ["label"])
517
+ ]),
518
+ _: 1
519
+ }, 8, ["title"]),
520
+ (r = s.value.usedBy) != null && r.length ? (f(), K(xe, {
521
+ key: 0,
522
+ editable: !1,
523
+ overrides: s.value.usedBy || [],
524
+ "select-variant": !1,
525
+ title: l(d)("menu.variant.form.applied_product")
526
+ }, null, 8, ["overrides", "title"])) : F("", !0)
527
+ ])
528
+ ];
529
+ }),
530
+ _: 1
531
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]),
532
+ u(Ze, {
533
+ modelValue: O.value,
534
+ "onUpdate:modelValue": c[5] || (c[5] = (r) => O.value = r),
535
+ variant: s.value,
536
+ "expand-section": M.value,
537
+ "onUpdate:variant": j
538
+ }, null, 8, ["modelValue", "variant", "expand-section"])
539
+ ], 64);
540
+ };
541
+ }
542
+ }), ba = ia;
543
+ export {
544
+ ba as V
545
+ };