@feedmepos/mf-menu 0.32.37 → 0.32.38

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-CONXGagS.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-Z4PgBxr3.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DS_gQ7_2.js} +3 -3
  3. package/dist/{Catalog-BSZ8BAbX.js → Catalog-DqGqLNN2.js} +6 -6
  4. package/dist/Category-Brn_eOxZ.js +224 -0
  5. package/dist/{Category-bGvXpr0F.js → Category-DlvKgR7e.js} +9 -9
  6. package/dist/{CookingGuide-DijUR2JM.js → CookingGuide-DvsYJxXb.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-CoAJkdZX.js} +1 -1
  8. package/dist/{Group-O4L3iHx0.js → Group-BTdbQ303.js} +1 -1
  9. package/dist/{Group-CrqE40ia.js → Group-CeOonB-B.js} +7 -7
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-CsM72Jnq.js → Group.vue_vue_type_script_setup_true_lang-WW3jF2A7.js} +227 -216
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BGR4kFzj.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Btb2BTqb.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-wf0Wm51b.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DLswQZTA.js} +315 -315
  13. package/dist/{Ingredient-DvvuwOdH.js → Ingredient-DNVMZVrz.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-anFCPZZD.js → InventoryBinding.vue_vue_type_script_setup_true_lang-BBjjgCDV.js} +2 -2
  15. package/dist/{LinkProductSideSheet-ImK8azTA.js → LinkProductSideSheet-1ZQVQTG_.js} +3 -3
  16. package/dist/{MenuSetting-BX0ohmwF.js → MenuSetting-CTCx0oeP.js} +5 -5
  17. package/dist/{PrintRoute-CXYZHJsf.js → PrintRoute-CZcDiXfi.js} +4 -4
  18. package/dist/{Product-BnnwL5DZ.js → Product-XtB1aNsr.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-DUBnQJZ1.js → Product.vue_vue_type_script_setup_true_lang-vf14Uzzm.js} +348 -337
  20. package/dist/{ProductInternalTools-DzRnmE1r.js → ProductInternalTools-DY1Np_PQ.js} +22 -22
  21. package/dist/{Products-CtzHONQZ.js → Products-DQorirQ3.js} +30 -30
  22. package/dist/{Publish-DmIbDy8-.js → Publish-Bv6Yiafq.js} +3 -3
  23. package/dist/{Recipe-D_0Ezt1C.js → Recipe-BDjd8TQg.js} +4 -4
  24. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-DdeQnyfQ.js → RuleView.vue_vue_type_script_setup_true_lang-DLMPV1-F.js} +2 -2
  25. package/dist/{Scheduler-BgQsbdVM.js → Scheduler-XTwUJH8U.js} +3 -3
  26. package/dist/{ServingSequence-DCRzJsrs.js → ServingSequence-BujAc7xS.js} +3 -3
  27. package/dist/{Setting-CgtttPN_.js → Setting-BUovlSPt.js} +5 -5
  28. package/dist/Subcategory-BWZdguIR.js +345 -0
  29. package/dist/{Takeaway-CExKsbN5.js → Takeaway-CGGaO_dh.js} +4 -4
  30. package/dist/{Takeaway-BfcHs1we.js → Takeaway-Doy30uHo.js} +1 -1
  31. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-Iy2ZwQf_.js +316 -0
  32. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-Br279NC_.js → Thumbnail.vue_vue_type_script_setup_true_lang-CY9TyaLG.js} +4 -4
  33. package/dist/TranslationSideSheet.vue_vue_type_script_setup_true_lang-DiGAs3Gd.js +185 -0
  34. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CZq5WTEG.js +6120 -0
  35. package/dist/{Unit-B6P_ykM-.js → Unit-Bl0DBmQ3.js} +2 -2
  36. package/dist/Variant-DgUxTOkz.js +247 -0
  37. package/dist/{_id_-D2ozS9Ck.js → _id_-BqediDNk.js} +9 -9
  38. package/dist/app-BVB_5Ks2.js +363 -0
  39. package/dist/{app-DqyNXgYz.js → app-DAPQhgfg.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-CupfG8qX.js +13 -0
  90. package/dist/assets/menu-export-CL6U9A01.js +107 -0
  91. package/dist/assets/override-menu-K_rFGpIx.js +13 -0
  92. package/dist/assets/validate-menu-Dr7DxB6L.js +13 -0
  93. package/dist/{catalog-CFKVaXk7.js → catalog-8-hugI0j.js} +1 -1
  94. package/dist/{catalogSetting-N4nT-nGm.js → catalogSetting-BWa1ZTnY.js} +1 -1
  95. package/dist/{currency-Bi_GukGE.js → currency-B59CBSWJ.js} +1 -1
  96. package/dist/dayjs.min-D1xLv5bP.js +6 -0
  97. package/dist/index-ChzxrjXq.js +539 -0
  98. package/dist/index-DIXBx1sl.js +335 -0
  99. package/dist/{index-uiJS0BKT.js → index-wA29dyse.js} +1 -1
  100. package/dist/{index.vue_vue_type_script_setup_true_lang-CL6a622s.js → index.vue_vue_type_script_setup_true_lang-CZJpW7cW.js} +18104 -17902
  101. package/dist/item-Fu9YmyOy.js +8117 -0
  102. package/dist/{jszip.min-v__o3BM4.js → jszip.min-qs5Z6KRL.js} +383 -383
  103. package/dist/{menu-LtIuM7Qj.js → menu-CoqhBDql.js} +1 -1
  104. package/dist/{menuV2-N0hB53Gw.js → menuV2-CnCDR__p.js} +125 -125
  105. package/dist/mf-menu.css +1 -1
  106. package/dist/{priceTier-DZeAvlXs.js → priceTier-BvG_RNTn.js} +1 -1
  107. package/dist/rules-Av0lxCL-.js +212 -0
  108. package/dist/{scheduler-FVlscyjB.js → scheduler-CrvDOlmc.js} +4 -4
  109. package/dist/{toExcel-DBCbupeI.js → toExcel-CnzBt_4W.js} +2 -2
  110. package/dist/translation-BeqjfyEb.js +75 -0
  111. package/dist/{unit-DNphv-4C.js → unit-h28_cadr.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,345 @@
1
+ import { defineComponent as I, ref as h, computed as k, watch as ae, resolveComponent as x, createElementBlock as C, openBlock as f, Fragment as j, renderSlot as oe, createVNode as d, unref as n, withCtx as y, createElementVNode as c, renderList as Q, toDisplayString as T, h as M, withModifiers as G, getCurrentInstance as te, createBlock as O, createCommentVNode as ne } from "vue";
2
+ import { useI18n as z } from "@feedmepos/mf-common";
3
+ import { useSnackbar as R, components as H, useDialog as W, FmButtonVariant as J, useBreakpoints as le, FmButtonColorThemeVariant as se } from "@feedmepos/ui-library";
4
+ import { _ as ie } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
5
+ import { G as P, u as Y, Q as K, M as X, A as Z, a4 as re } from "./index.vue_vue_type_script_setup_true_lang-CZJpW7cW.js";
6
+ import { _ as ce } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
7
+ import { _ as ue } from "./app-BVB_5Ks2.js";
8
+ import { c as me } from "./createForm-BoUQeZTd.js";
9
+ import { u as de } from "./discardConfirm-BHni0LNu.js";
10
+ import { c as q } from "./object-DVUNCr7w.js";
11
+ import { r as pe, u as ee } from "./rules-Av0lxCL-.js";
12
+ import { _ as _e } from "./TranslationSideSheet.vue_vue_type_script_setup_true_lang-DiGAs3Gd.js";
13
+ import { c as fe } from "./check-C9mY6LiX.js";
14
+ import { g as A } from "./translation-BeqjfyEb.js";
15
+ import { a as ve } from "./menu-CoqhBDql.js";
16
+ const ge = {
17
+ class: "fm-typo-en-title-md-600"
18
+ }, ye = {
19
+ class: "flex flex-col gap-32 h-full min-h-0 py-16"
20
+ }, be = {
21
+ class: "py-12 px-16 space-y-4"
22
+ }, he = {
23
+ class: "flex gap-8 items-center justify-start"
24
+ }, xe = /* @__PURE__ */ I({
25
+ __name: "Form",
26
+ props: {
27
+ initialValue: {}
28
+ },
29
+ setup(D, {
30
+ expose: V
31
+ }) {
32
+ const b = D, $ = R(), w = P($), S = K(w), p = Y(), {
33
+ t: l
34
+ } = z(), F = h(!1), t = h(!1), L = h(!1), u = h(void 0), E = (e) => {
35
+ fe.isBoolean(e) ? t.value = e : t.value = !t.value;
36
+ }, i = h(q(b.initialValue)), N = k(() => !!i.value.name), U = k(() => {
37
+ var o;
38
+ const e = [], a = "en-US", m = (o = u.value) == null ? void 0 : o[a];
39
+ return i.value.name && !m && e.push({
40
+ locale: a,
41
+ name: i.value.name,
42
+ localeDisplay: A(a)
43
+ }), u.value && Object.entries(u.value).filter(([_, v]) => v && v.trim()).sort(([_], [v]) => _.localeCompare(v)).forEach(([_, v]) => {
44
+ e.push({
45
+ locale: _,
46
+ name: v,
47
+ localeDisplay: A(_)
48
+ });
49
+ }), e;
50
+ });
51
+ function B(e) {
52
+ u.value = e;
53
+ }
54
+ const s = de(() => {
55
+ const e = p.subcategories.find((v) => v._id === i.value._id), a = i.value.name !== (e == null ? void 0 : e.name), m = (e == null ? void 0 : e.name_locale) || {}, o = u.value || {}, _ = JSON.stringify(m) !== JSON.stringify(o);
56
+ return a || _;
57
+ }, () => {
58
+ t.value = !1;
59
+ });
60
+ async function r() {
61
+ const e = p.subcategories.find((m) => m._id === i.value._id), {
62
+ updateMenu: a
63
+ } = S;
64
+ await a({
65
+ module: Z.F_MENU_MODULE_V4_KEY.enum.subCategory,
66
+ operation: X.F_OPERATION_TYPE.update,
67
+ // @ts-ignore FIXME: The backend hasn't exported SubcategoryRequest yet. Fix this once it's available.
68
+ data: {
69
+ ...e,
70
+ name: i.value.name ?? (e == null ? void 0 : e.name),
71
+ ...u.value && {
72
+ name_locale: u.value
73
+ }
74
+ }
75
+ }, i.value.name), E(!1);
76
+ }
77
+ return ae(() => t.value, () => {
78
+ if (!t.value) return;
79
+ i.value = q(b.initialValue);
80
+ const e = p.subcategories.find((a) => a._id === i.value._id);
81
+ u.value = e == null ? void 0 : e.name_locale;
82
+ }), V({
83
+ trigger: E,
84
+ show: t
85
+ }), (e, a) => {
86
+ const m = x("fm-button"), o = x("FmTooltip"), _ = x("FmTextField"), v = x("fm-side-sheet");
87
+ return f(), C(j, null, [oe(e.$slots, "default", {
88
+ trigger: E
89
+ }), d(v, {
90
+ id: "group-form",
91
+ modelValue: t.value,
92
+ "onUpdate:modelValue": a[3] || (a[3] = (g) => t.value = g),
93
+ "is-container": n(H).FmForm,
94
+ "is-container-props": {
95
+ onValidationSuccess: r,
96
+ blameFormChildOnValidationFailed: !0
97
+ },
98
+ "max-width": 560,
99
+ "onOn:clickedAway": n(s)
100
+ }, {
101
+ "side-sheet-header": y(() => [c("p", ge, T(n(l)("menu.subcategory.title")), 1)]),
102
+ "side-sheet-footer": y(() => [c("div", he, [d(m, {
103
+ label: n(l)("menu.common.actions.update"),
104
+ loading: F.value,
105
+ size: "lg",
106
+ type: "submit",
107
+ variant: "primary",
108
+ disabled: !i.value._id
109
+ }, null, 8, ["label", "loading", "disabled"]), d(m, {
110
+ label: n(l)("menu.common.actions.cancel"),
111
+ size: "lg",
112
+ variant: "tertiary",
113
+ onClick: a[2] || (a[2] = () => t.value = !1)
114
+ }, null, 8, ["label"])])]),
115
+ default: y(() => [c("div", ye, [d(_, {
116
+ label: n(l)("menu.subcategory.name"),
117
+ modelValue: i.value.name,
118
+ "onUpdate:modelValue": a[1] || (a[1] = (g) => i.value.name = g),
119
+ disabled: !i.value._id,
120
+ rules: [n(pe)]
121
+ }, {
122
+ append: y(() => [d(o, {
123
+ variant: "plain",
124
+ placement: "top",
125
+ "z-index": 999
126
+ }, {
127
+ content: y(() => [c("div", be, [(f(!0), C(j, null, Q(U.value, (g) => (f(), C("div", {
128
+ key: g.locale
129
+ }, T(g.name) + " (" + T(g.localeDisplay) + ") ", 1))), 128))])]),
130
+ default: y(() => [d(m, {
131
+ variant: "tertiary",
132
+ icon: "g_translate",
133
+ onClick: a[0] || (a[0] = (g) => L.value = !0),
134
+ disabled: !N.value
135
+ }, null, 8, ["disabled"])]),
136
+ _: 1
137
+ })]),
138
+ _: 1
139
+ }, 8, ["label", "modelValue", "disabled", "rules"])])]),
140
+ _: 1
141
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]), d(_e, {
142
+ modelValue: L.value,
143
+ "onUpdate:modelValue": a[4] || (a[4] = (g) => L.value = g),
144
+ title: n(l)("menu.subcategory.title"),
145
+ name: i.value.name,
146
+ "name-locale": u.value,
147
+ "onUpdate:nameLocale": B
148
+ }, null, 8, ["modelValue", "title", "name", "name-locale"])], 64);
149
+ };
150
+ }
151
+ }), Ce = xe, ke = {
152
+ key: 0
153
+ }, Ve = {
154
+ class: "flex justify-end items-center"
155
+ }, we = {
156
+ class: "w-[320px]"
157
+ }, Fe = {
158
+ key: 1,
159
+ class: "flex-1 flex flex-col min-h-0"
160
+ }, Le = {
161
+ class: "p-8"
162
+ }, $e = {
163
+ class: "flex flex-1 flex-col min-h-0 overflow-scroll divide-y divide-fm-color-neutral-gray-100 pb-64"
164
+ }, Se = ["onClick"], Ee = {
165
+ class: "flex-1 space-y-4"
166
+ }, Me = {
167
+ class: "fm-typo-en-body-lg-600"
168
+ }, Te = /* @__PURE__ */ I({
169
+ __name: "SubcategoryTable",
170
+ setup(D) {
171
+ const V = W(), b = R(), $ = P(b), w = K($), S = ee({
172
+ dialog: V,
173
+ menuLoader: w
174
+ }), p = k(() => Y().subcategories), l = h(""), F = k(() => p.value.filter((s) => s.name.toLowerCase().includes(l.value.toLowerCase()))), {
175
+ t
176
+ } = z(), L = h([{
177
+ accessorKey: "name",
178
+ header: () => t("menu.subcategory.columns.title"),
179
+ enableSorting: !1,
180
+ meta: {
181
+ width: "auto"
182
+ },
183
+ cell: (s) => {
184
+ const r = s.row.original, e = s.getValue(), m = Object.keys(r.name_locale ?? {}).map((o) => A(o));
185
+ return M("div", {
186
+ class: "flex items-center gap-8"
187
+ }, [M("span", {
188
+ class: "break-all"
189
+ }, e), ...m.map((o) => M("div", {
190
+ class: "rounded-lg border border-fm-color-primary text-fm-color-primary flex items-center justify-center fm-typo-en-body-sm-600 px-8"
191
+ }, o))]);
192
+ }
193
+ }, {
194
+ id: "actions",
195
+ size: 52,
196
+ meta: {
197
+ cellClass: "pl-16",
198
+ headerContentClass: "-mx-16"
199
+ },
200
+ header: "",
201
+ cell: (s) => {
202
+ const r = s.row.original;
203
+ return M("div", {
204
+ class: "flex justify-end"
205
+ }, [M(H.FmButton, {
206
+ icon: "delete",
207
+ disabled: !r._id,
208
+ variant: "tertiary",
209
+ textColor: "neutral-gray-400",
210
+ onClick: G(async () => {
211
+ await u(r);
212
+ }, ["stop", "prevent"])
213
+ })]);
214
+ }
215
+ }]);
216
+ async function u(s) {
217
+ if (!s._id) {
218
+ b.open({
219
+ message: t("menu.subcategory.dialog.remove.error"),
220
+ type: "warning"
221
+ });
222
+ return;
223
+ }
224
+ V.open({
225
+ title: t("menu.subcategory.dialog.remove.title"),
226
+ message: t("menu.common.dialog.remove_confirmation", {
227
+ name: s.name
228
+ }),
229
+ primaryActions: {
230
+ text: "Remove",
231
+ close: !0,
232
+ variant: J.Destructive
233
+ },
234
+ secondaryActions: {
235
+ text: "Cancel",
236
+ close: !0
237
+ }
238
+ }).onPrimary(async () => {
239
+ await w.updateMenu({
240
+ module: Z.F_MENU_MODULE_V4_KEY.enum.subCategory,
241
+ operation: X.F_OPERATION_TYPE.delete,
242
+ data: s._id
243
+ }, s.name, !0);
244
+ });
245
+ }
246
+ async function E(s) {
247
+ const r = s.map((e) => e._id).filter((e) => !!e);
248
+ await S.rearrange(r);
249
+ }
250
+ const i = te();
251
+ async function N(s) {
252
+ me(i, Ce, {
253
+ initialValue: s
254
+ });
255
+ }
256
+ const U = le(), B = k(() => U.breakpoints.value.xs);
257
+ return (s, r) => {
258
+ const e = x("FmSearch"), a = x("FmTable"), m = x("FmButton");
259
+ return B.value ? (f(), C("div", Fe, [c("div", Le, [d(e, {
260
+ autofocus: "",
261
+ modelValue: l.value,
262
+ "onUpdate:modelValue": r[2] || (r[2] = (o) => l.value = o),
263
+ class: "w-full",
264
+ placeholder: n(t)("menu.common.labels.search_placeholder", {
265
+ type: "categories"
266
+ })
267
+ }, null, 8, ["modelValue", "placeholder"])]), c("div", $e, [(f(!0), C(j, null, Q(F.value, (o) => (f(), C("div", {
268
+ key: o._id || "",
269
+ class: "flex flex-row py-12 px-16",
270
+ onClick: (_) => N(o)
271
+ }, [c("div", Ee, [c("p", Me, T(o.name), 1)]), d(m, {
272
+ "text-color": n(se).NeutralGray400,
273
+ variant: n(J).Tertiary,
274
+ "prepend-icon": "delete",
275
+ disabled: !o._id,
276
+ onClick: G((_) => u(o), ["stop"])
277
+ }, null, 8, ["text-color", "variant", "disabled", "onClick"])], 8, Se))), 128))])])) : (f(), C("div", ke, [c("div", Ve, [c("div", we, [d(e, {
278
+ modelValue: l.value,
279
+ "onUpdate:modelValue": r[0] || (r[0] = (o) => l.value = o),
280
+ autofocus: "",
281
+ class: "mb-8",
282
+ placeholder: n(t)("menu.common.labels.search_placeholder", {
283
+ type: n(t)("menu.subcategory.title")
284
+ })
285
+ }, null, 8, ["modelValue", "placeholder"])])]), d(ue, null, {
286
+ default: y(() => [d(a, {
287
+ "column-defs": L.value,
288
+ draggable: !0,
289
+ "page-size": p.value.length,
290
+ "row-data": p.value,
291
+ "search-value": l.value,
292
+ "shrink-at": !1,
293
+ "hide-footer": "",
294
+ "pin-header-row": "",
295
+ onDndChanged: E,
296
+ onRowClick: r[1] || (r[1] = (o) => N(o.original))
297
+ }, null, 8, ["column-defs", "page-size", "row-data", "search-value"])]),
298
+ _: 1
299
+ })]));
300
+ };
301
+ }
302
+ }), Ne = { class: "flex-1 flex justify-between gap-8 pl-8" }, Oe = { class: "flex items-center" }, De = { class: "bg-fm-color-neutral-gray-100 rounded-md px-8 py-4" }, Ue = { class: "fm-typo-en-body-md-600 font-semibold" }, Xe = /* @__PURE__ */ I({
303
+ __name: "Subcategory",
304
+ setup(D) {
305
+ const V = W(), b = R(), $ = P(b), w = K($), S = ee({ dialog: V, menuLoader: w }), p = k(() => Y().subcategories), { t: l } = z();
306
+ function F() {
307
+ S.create();
308
+ }
309
+ const t = k(() => p.value.length);
310
+ return ve().resetOnMount(), (L, u) => (f(), O(ce, {
311
+ heading: n(l)("menu.subcategory.title")
312
+ }, {
313
+ default: y(() => [
314
+ p.value.length > 0 ? (f(), O(Te, { key: 0 })) : (f(), O(n(re), {
315
+ key: 1,
316
+ action: {
317
+ text: n(l)("menu.subcategory.add"),
318
+ callback: F
319
+ },
320
+ subtitle: n(l)("menu.subcategory.empty.subtitle"),
321
+ title: n(l)("menu.subcategory.empty.title")
322
+ }, null, 8, ["action", "subtitle", "title"]))
323
+ ]),
324
+ "append-heading": y(() => [
325
+ c("div", Ne, [
326
+ c("div", Oe, [
327
+ c("div", De, [
328
+ c("p", Ue, T(t.value), 1)
329
+ ])
330
+ ]),
331
+ p.value.length > 0 ? (f(), O(ie, {
332
+ key: 0,
333
+ label: n(l)("menu.subcategory.add"),
334
+ "prepend-icon": "add",
335
+ onClick: F
336
+ }, null, 8, ["label"])) : ne("", !0)
337
+ ])
338
+ ]),
339
+ _: 1
340
+ }, 8, ["heading"]));
341
+ }
342
+ });
343
+ export {
344
+ Xe as default
345
+ };
@@ -1,12 +1,12 @@
1
1
  import { defineComponent as f, computed as y, ref as k, createBlock as i, openBlock as d, unref as a, withCtx as s, createElementVNode as t, toDisplayString as b, createCommentVNode as g, createVNode as m } from "vue";
2
- import { G as x, u as v, Q as w, M as E, A as M } from "./index.vue_vue_type_script_setup_true_lang-CL6a622s.js";
2
+ import { G as x, u as v, Q as w, M as E, A as M } from "./index.vue_vue_type_script_setup_true_lang-CZJpW7cW.js";
3
3
  import { useI18n as T } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as V } from "@feedmepos/ui-library";
5
5
  import { _ as h } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
6
6
  import { _ as C } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
7
- import { _ as N } from "./Takeaway.vue_vue_type_script_setup_true_lang-GAZ3S2_n.js";
8
- import { T as S, l as L } from "./index-BaxQ5Nq0.js";
9
- import { a as O } from "./menu-LtIuM7Qj.js";
7
+ import { _ as N } from "./Takeaway.vue_vue_type_script_setup_true_lang-Iy2ZwQf_.js";
8
+ import { T as S, l as L } from "./index-DIXBx1sl.js";
9
+ import { a as O } from "./menu-CoqhBDql.js";
10
10
  const U = { class: "flex-1 flex justify-between gap-8 pl-8" }, B = { class: "flex items-center" }, F = { class: "bg-fm-color-neutral-gray-100 rounded-md px-8 py-4" }, A = { class: "fm-typo-en-body-md-600 font-semibold" }, z = /* @__PURE__ */ f({
11
11
  __name: "Takeaway",
12
12
  setup(D) {
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./Takeaway.vue_vue_type_script_setup_true_lang-GAZ3S2_n.js";
1
+ import { _ as f } from "./Takeaway.vue_vue_type_script_setup_true_lang-Iy2ZwQf_.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -0,0 +1,316 @@
1
+ import { getCurrentInstance as te, defineComponent as oe, computed as x, watch as ne, h as E, resolveComponent as O, createElementBlock as C, openBlock as _, Fragment as P, normalizeClass as Y, createElementVNode as k, createVNode as V, unref as n, isRef as j, withCtx as F, renderList as ie, createBlock as G, createCommentVNode as $, toDisplayString as S, withModifiers as Q } from "vue";
2
+ import { G as H, u as J, Q as W, M as N, A as z, I as A, B as se, ap as q, a4 as re } from "./index.vue_vue_type_script_setup_true_lang-CZJpW7cW.js";
3
+ import { useI18n as X, useCoreStore as le } from "@feedmepos/mf-common";
4
+ import { useDialog as ce, useSnackbar as Z, FmButtonVariant as D, components as de, useBreakpoints as me } from "@feedmepos/ui-library";
5
+ import { _ as ue } from "./app-BVB_5Ks2.js";
6
+ import { a as pe, l as ee, T as ye } from "./index-DIXBx1sl.js";
7
+ import { u as fe } from "./search-BAPEUu1R.js";
8
+ import { f as L } from "./currency-B59CBSWJ.js";
9
+ import { defineStore as _e } from "pinia";
10
+ import { C as ke } from "./catalog-8-hugI0j.js";
11
+ import { c as ve } from "./createComponentProgrammatically-Bt2rn1IQ.js";
12
+ import { g as we } from "./translation-BeqjfyEb.js";
13
+ function ge(T, M, l, p) {
14
+ var y, v, w, g;
15
+ const s = A(T);
16
+ s.override.takeaway[l._id] = {
17
+ price: l.price || void 0
18
+ };
19
+ const f = [...l.usedBy, ...M.usedBy];
20
+ for (const r of f) {
21
+ const c = l.usedBy.some(
22
+ (e) => e._id == r._id && e.combinationKey == r.combinationKey
23
+ ) ? l._id : null, a = (s.override.items[r._id] || []).findIndex(
24
+ (e) => e.combinationKey === r.combinationKey
25
+ );
26
+ let d;
27
+ if (a >= 0)
28
+ d = (y = s.override.items[r._id][a]) != null && y.takeawayUsed ? A((v = s.override.items[r._id][a]) == null ? void 0 : v.takeawayUsed) : void 0;
29
+ else {
30
+ const e = p.find((u) => u._id === r._id);
31
+ r.combinationKey ? d = ((g = (w = e == null ? void 0 : e.variant) == null ? void 0 : w.variantCombinations.find(
32
+ (u) => u.combinationKey === r.combinationKey
33
+ )) == null ? void 0 : g.takeawayUsed) || (e == null ? void 0 : e.takeawayUsed) : d = e == null ? void 0 : e.takeawayUsed;
34
+ }
35
+ if (a >= 0)
36
+ s.override.items[r._id][a].takeawayUsed = c;
37
+ else if (d !== c) {
38
+ const e = {
39
+ _id: r._id,
40
+ combinationKey: r.combinationKey,
41
+ takeawayUsed: c
42
+ };
43
+ s.override.items[r._id] = [...s.override.items[r._id] || [], e];
44
+ }
45
+ }
46
+ return s;
47
+ }
48
+ const be = _e("takeaway-manager", () => {
49
+ const T = ce(), M = Z(), l = H(M), p = W(l), s = J(), f = te(), { t: y } = X(), v = (a) => {
50
+ var e, u;
51
+ const { vNode: d } = ve(
52
+ pe,
53
+ f,
54
+ a
55
+ );
56
+ (u = (e = d.component) == null ? void 0 : e.exposed) == null || u.trigger();
57
+ };
58
+ async function w(a) {
59
+ var u, K;
60
+ const e = ((K = (u = s.currentCatalog) == null ? void 0 : u.override.takeaway[a._id]) == null ? void 0 : K.price) ? null : s.state.menu.modules.takeaway.find((b) => b._id === a._id);
61
+ v({
62
+ initialValue: a,
63
+ applyProduct: !0,
64
+ bindToVariant: s.rules.item.bindToVariant,
65
+ fallback: e,
66
+ action: "update",
67
+ "onUpdate:takeaway": async (b) => {
68
+ let o = A(s.currentCatalog);
69
+ b.price ? o.override.takeaway[a._id] = { price: b.price } : delete o.override.takeaway[a._id], o = ge(o, a, b, s.state.menu.modules.item), await new ke(o, s, p.updateMenu, T).update();
70
+ }
71
+ });
72
+ }
73
+ async function g(a) {
74
+ v({
75
+ initialValue: a,
76
+ bindToVariant: s.rules.item.bindToVariant,
77
+ applyProduct: !0,
78
+ action: "update",
79
+ "onUpdate:takeaway": async (d) => {
80
+ await p.updateMenu(
81
+ {
82
+ module: z.F_MENU_MODULE_V4_KEY.enum.takeaway,
83
+ operation: N.F_OPERATION_TYPE.update,
84
+ data: d,
85
+ link: ee(d.usedBy || [])
86
+ },
87
+ d.name
88
+ );
89
+ }
90
+ });
91
+ }
92
+ async function r(a) {
93
+ s.currentCatalog ? await w(a) : await g(a);
94
+ }
95
+ async function c(a) {
96
+ T.open({
97
+ title: y("menu.common.dialog.remove.takeaway.title"),
98
+ message: y("menu.common.dialog.remove.takeaway.message", { name: a.name }),
99
+ primaryActions: {
100
+ text: y("menu.common.actions.remove"),
101
+ close: !0,
102
+ variant: D.Destructive
103
+ },
104
+ secondaryActions: {
105
+ text: y("menu.common.actions.cancel"),
106
+ close: !0
107
+ }
108
+ }).onPrimary(async () => {
109
+ await p.updateMenu(
110
+ {
111
+ module: z.F_MENU_MODULE_V4_KEY.enum.takeaway,
112
+ operation: N.F_OPERATION_TYPE.delete,
113
+ data: a._id
114
+ },
115
+ a.name,
116
+ !0
117
+ );
118
+ });
119
+ }
120
+ return {
121
+ deleteTakeaway: c,
122
+ updateTakeaway: r
123
+ };
124
+ }), he = {
125
+ key: 0,
126
+ class: /* @__PURE__ */ Y(["flex-1 overflow-hidden", "space-y-16", "flex flex-col", "overflow-hidden", "pt-16"])
127
+ }, xe = {
128
+ class: "flex items-center space-x-8 justify-end"
129
+ }, Ce = {
130
+ class: "w-[320px]"
131
+ }, Ve = {
132
+ class: "px-16 pt-8"
133
+ }, Te = {
134
+ class: /* @__PURE__ */ Y(["flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100"])
135
+ }, Me = ["onClick"], Ue = {
136
+ class: "flex-1"
137
+ }, Ee = {
138
+ class: "fm-typo-en-body-lg-600 mb-4"
139
+ }, Ke = {
140
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
141
+ }, Ie = {
142
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
143
+ }, Be = {
144
+ key: 1,
145
+ class: "xs:pt-24"
146
+ }, Ge = /* @__PURE__ */ oe({
147
+ __name: "Takeaway",
148
+ emits: ["update:count"],
149
+ setup(T, {
150
+ emit: M
151
+ }) {
152
+ const l = J(), p = be(), s = x(() => l.rules.item.bindToVariant), f = x(() => l.rules.takeaway), y = W(H(Z())), v = le(), w = x(() => se.Country.getCountry(v.currentCountry.value).currency), g = x(() => l.takeaways.map((o) => ({
153
+ ...o,
154
+ usedBy: l.items.reduce((i, m) => {
155
+ var t, I, R;
156
+ const h = m.takeawayUsed === o._id;
157
+ if ((!s.value || !((I = (t = m.variant) == null ? void 0 : t.variantGroupIds) != null && I.length)) && h)
158
+ i.push({
159
+ _id: m._id
160
+ });
161
+ else {
162
+ const ae = (((R = m.variant) == null ? void 0 : R.variantCombinations) || []).filter((B) => B.takeawayUsed === o._id || !B.takeawayUsed && h).map((B) => ({
163
+ _id: m._id,
164
+ combinationKey: B.combinationKey
165
+ }));
166
+ i = [...i, ...ae];
167
+ }
168
+ return i;
169
+ }, [])
170
+ }))), {
171
+ filter: r,
172
+ searchKey: c
173
+ } = fe(), a = x(() => g.value.filter((o) => r([o.name, L(o.price, !1)]))), d = M;
174
+ ne(() => a.value.length, (o) => {
175
+ d("update:count", o);
176
+ }, {
177
+ immediate: !0
178
+ });
179
+ const {
180
+ t: e
181
+ } = X(), u = x(() => [{
182
+ accessorKey: "name",
183
+ header: () => e("menu.takeaway.table.columns.name"),
184
+ enableSorting: !1,
185
+ size: 700,
186
+ cell: (o) => {
187
+ const i = o.row.original, m = o.getValue(), U = Object.keys(i.name_locale ?? {}).map((t) => we(t));
188
+ return E("div", {
189
+ class: "flex items-center gap-8"
190
+ }, [E("span", {
191
+ class: "break-all"
192
+ }, m), ...U.map((t) => E("div", {
193
+ class: "rounded-lg border border-fm-color-primary text-fm-color-primary flex items-center justify-center fm-typo-en-body-sm-600 px-8"
194
+ }, t))]);
195
+ }
196
+ }, {
197
+ accessorKey: "price",
198
+ header: () => e("menu.takeaway.table.columns.price", {
199
+ symbol: w.value.symbol
200
+ }),
201
+ enableSorting: !1,
202
+ size: 200,
203
+ meta: {
204
+ textAlign: "right"
205
+ },
206
+ cell: (o) => {
207
+ const i = o.getValue();
208
+ return L(i, !1);
209
+ }
210
+ }, {
211
+ accessorKey: "usedBy",
212
+ header: () => e("menu.takeaway.table.columns.products"),
213
+ enableSorting: !1,
214
+ size: 200,
215
+ cell: (o) => {
216
+ const i = o.getValue(), m = q(l.categorizedItems, i).flatMap((h) => h.items).length ?? 0;
217
+ return e("menu.takeaway.table.items_linked", {
218
+ count: m
219
+ });
220
+ }
221
+ }, {
222
+ id: "action",
223
+ size: 52,
224
+ meta: {
225
+ cellClass: "pl-16",
226
+ headerContentClass: "-mx-16"
227
+ },
228
+ cell: (o) => E("div", {
229
+ class: "flex justify-end items-center"
230
+ }, [f.value.delete ? E(de.FmButton, {
231
+ prependIcon: "delete",
232
+ variant: D.Tertiary,
233
+ textColor: "neutral-gray-400",
234
+ onClick: (i) => {
235
+ i.stopPropagation(), p.deleteTakeaway(o.row.original);
236
+ }
237
+ }) : null])
238
+ }]), K = me(), b = x(() => K.breakpoints.value.xs);
239
+ return (o, i) => {
240
+ const m = O("fm-search"), h = O("fm-table"), U = O("fm-button");
241
+ return g.value.length ? (_(), C(P, {
242
+ key: 0
243
+ }, [b.value ? (_(), C(P, {
244
+ key: 1
245
+ }, [k("div", Ve, [V(m, {
246
+ class: "w-full",
247
+ autofocus: "",
248
+ modelValue: n(c),
249
+ "onUpdate:modelValue": i[2] || (i[2] = (t) => j(c) ? c.value = t : null),
250
+ placeholder: n(e)("menu.takeaway.table.search.placeholder")
251
+ }, null, 8, ["modelValue", "placeholder"])]), k("div", Te, [(_(!0), C(P, null, ie(a.value, (t) => (_(), C("div", {
252
+ key: t._id,
253
+ class: Y(["py-12 px-16", "flex space-x-8", "items-center"]),
254
+ onClick: () => {
255
+ f.value.edit && n(p).updateTakeaway(t);
256
+ }
257
+ }, [k("div", Ue, [k("p", Ee, S(t.name), 1), k("p", Ke, S(`${n(q)(n(l).categorizedItems, t.usedBy).flatMap((I) => I.items).length ?? 0} items linked`), 1), k("p", Ie, " Price: " + S(w.value.symbol) + S(n(L)(t.price, !1)), 1)]), f.value.delete ? (_(), G(U, {
258
+ key: 0,
259
+ variant: n(D).Tertiary,
260
+ "text-color": "neutral-gray-400",
261
+ "prepend-icon": "delete",
262
+ onClick: Q(() => n(p).deleteTakeaway(t), ["stop"])
263
+ }, null, 8, ["variant", "onClick"])) : $("", !0)], 8, Me))), 128))])], 64)) : (_(), C("div", he, [k("div", xe, [k("div", Ce, [V(m, {
264
+ autofocus: "",
265
+ modelValue: n(c),
266
+ "onUpdate:modelValue": i[0] || (i[0] = (t) => j(c) ? c.value = t : null),
267
+ placeholder: n(e)("menu.takeaway.table.search.placeholder")
268
+ }, null, 8, ["modelValue", "placeholder"])])]), V(ue, null, {
269
+ default: F(() => [V(h, {
270
+ "column-defs": u.value,
271
+ loading: n(y).checkMenuIsLoading(),
272
+ "page-size": a.value.length,
273
+ "row-data": a.value,
274
+ "search-value": n(c),
275
+ "shrink-at": !1,
276
+ class: "flex-1 overflow-hidden",
277
+ "hide-footer": "",
278
+ "pin-header-row": "",
279
+ onRowClick: i[1] || (i[1] = (t) => {
280
+ f.value.edit && n(p).updateTakeaway(t.original);
281
+ })
282
+ }, null, 8, ["column-defs", "loading", "page-size", "row-data", "search-value"])]),
283
+ _: 1
284
+ })]))], 64)) : (_(), C("div", Be, [V(n(re), {
285
+ subtitle: n(e)("menu.takeaway.empty.subtitle"),
286
+ title: n(e)("menu.takeaway.empty.title")
287
+ }, {
288
+ action: F(() => [f.value.create ? (_(), G(n(ye), {
289
+ key: 0,
290
+ "bind-to-variant": s.value,
291
+ action: "add",
292
+ "apply-product": "",
293
+ "onUpdate:takeaway": i[3] || (i[3] = (t) => n(y).updateMenu({
294
+ module: n(z.F_MENU_MODULE_V4_KEY).enum.takeaway,
295
+ operation: n(N.F_OPERATION_TYPE).create,
296
+ data: t,
297
+ link: n(ee)(t.usedBy || [])
298
+ }, t.name))
299
+ }, {
300
+ default: F(({
301
+ trigger: t
302
+ }) => [V(U, {
303
+ "prepend-icon": "add",
304
+ label: n(e)("menu.takeaway.empty.action"),
305
+ onClick: Q(t, ["stop"])
306
+ }, null, 8, ["label", "onClick"])]),
307
+ _: 1
308
+ }, 8, ["bind-to-variant"])) : $("", !0)]),
309
+ _: 1
310
+ }, 8, ["subtitle", "title"])]));
311
+ };
312
+ }
313
+ });
314
+ export {
315
+ Ge as _
316
+ };