@feedmepos/mf-menu 0.18.17 → 0.19.0-beta.2

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 (90) hide show
  1. package/dist/ApplyProduct.vue_vue_type_script_setup_true_lang-DFJJHptK.js +158 -0
  2. package/dist/{ApplyProducts.vue_vue_type_script_setup_true_lang-BJ0b_uKf.js → ApplyProducts.vue_vue_type_script_setup_true_lang-CXoRwrTi.js} +2 -2
  3. package/dist/Catalog-CXzqtCF8.js +551 -0
  4. package/dist/Category-DKbtLbq8.js +387 -0
  5. package/dist/CookingGuide-BKon8TdH.js +862 -0
  6. package/dist/Group-D1UDksBG.js +46 -0
  7. package/dist/{Group-jEtbECLb.js → Group-izOWb_Bh.js} +1 -1
  8. package/dist/Group.vue_vue_type_script_setup_true_lang-DAlQcgYp.js +558 -0
  9. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Q7es2wmt.js +237 -0
  10. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Bw4uxqAp.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-Db0uYw5O.js} +11723 -11723
  11. package/dist/Ingredient-BIJu9P_9.js +484 -0
  12. package/dist/LinkProductSideSheet-BNdFZThd.js +104 -0
  13. package/dist/PrintRoute--fYPFcy7.js +417 -0
  14. package/dist/{Product-Bnr9oFr2.js → Product-vLtISbkD.js} +1 -1
  15. package/dist/Product.vue_vue_type_script_setup_true_lang-BHCihe6o.js +826 -0
  16. package/dist/Products-JaCNtcHS.js +236 -0
  17. package/dist/Publish-jpmiyB-b.js +525 -0
  18. package/dist/Recipe-B6y-oLPG.js +320 -0
  19. package/dist/Scheduler-Dj1rlr-U.js +222 -0
  20. package/dist/SchedulerSelector.vue_vue_type_script_setup_true_lang-BVAkohGJ.js +48 -0
  21. package/dist/ServingSequence-BhIfCyXl.js +4 -0
  22. package/dist/{Setting-DN8TQdIR.js → Setting-B5R1JfaL.js} +1 -1
  23. package/dist/Setting.vue_vue_type_script_setup_true_lang-xXtg0JOn.js +253 -0
  24. package/dist/Takeaway-BSFSz_JL.js +63 -0
  25. package/dist/{Takeaway-y0Nk0JAb.js → Takeaway-DjFTtbw6.js} +1 -1
  26. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-BUGL0wfZ.js +302 -0
  27. package/dist/TaxSetting-D9Q8XNgJ.js +25 -0
  28. package/dist/Unit-Cr_8O3zB.js +142 -0
  29. package/dist/Variant-loUMfNRB.js +222 -0
  30. package/dist/_id_-0w7KjYyQ.js +189 -0
  31. package/dist/{app-D7e31gIv.js → app-t9ONnc0s.js} +31701 -26207
  32. package/dist/app.js +7 -6
  33. package/dist/apps/mf-menu/src/app.d.ts +2784 -0
  34. package/dist/apps/mf-menu/src/components/feature/Fields/OrderFrom.vue.d.ts +2 -2
  35. package/dist/apps/mf-menu/src/components/feature/LinkProduct/LinkProductSideSheet.vue.d.ts +2 -2
  36. package/dist/apps/mf-menu/src/manager/menu/catalog.d.ts +1 -0
  37. package/dist/apps/mf-menu/src/stores/manager/item.d.ts +1 -1
  38. package/dist/apps/mf-menu/src/stores/menu.d.ts +16 -16
  39. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +12 -12
  40. package/dist/apps/mf-menu/src/views/Scheduler/FilterForm.vue.d.ts +4 -4
  41. package/dist/apps/mf-menu/src/views/Scheduler/SchedulerDialog.vue.d.ts +4 -4
  42. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  43. package/dist/assets/{linked-status-D5tq3eE2.js → linked-status-DLL4aRiX.js} +8 -8
  44. package/dist/assets/{validate-menu-AcCpPyQZ.js → validate-menu-CoXc16jh.js} +8 -8
  45. package/dist/{catalog-Ck7lLTN2.js → catalog-4OmC0JA3.js} +66 -62
  46. package/dist/category-BE33DRqp.js +155 -0
  47. package/dist/{currency-CclA5a-2.js → currency-JHgYNbTQ.js} +1 -1
  48. package/dist/{index-DDd9B_ur.js → index-CE3zjhyh.js} +732 -740
  49. package/dist/index-pSg9p-28.js +238 -0
  50. package/dist/item-CEPx51U1.js +6371 -0
  51. package/dist/{lodash-BIQx_fko.js → lodash-VivR_BQ2.js} +1 -1
  52. package/dist/{menu-CYzbNubv.js → menu-ETQrtbbU.js} +1 -1
  53. package/dist/{object-DUtbNpoS.js → object-DEM5FMTB.js} +4 -4
  54. package/dist/scheduler-SRT_5Nio.js +491 -0
  55. package/dist/string-DpfFixWH.js +4 -0
  56. package/dist/style.css +1 -1
  57. package/dist/takeaway-RcvqKigG.js +267 -0
  58. package/dist/{toExcel-BXPcj8Gp.js → toExcel-BcgskY3F.js} +2 -2
  59. package/dist/unit-DLL7xIF1.js +350 -0
  60. package/package.json +4 -2
  61. package/dist/ApplyProduct.vue_vue_type_script_setup_true_lang-D9QsJ4vO.js +0 -155
  62. package/dist/Catalog-CZW54QJU.js +0 -570
  63. package/dist/Category-DvsP_L7d.js +0 -405
  64. package/dist/CookingGuide-DC3uXetk.js +0 -848
  65. package/dist/Group-DK5xqeYX.js +0 -44
  66. package/dist/Group.vue_vue_type_script_setup_true_lang-DGZ9hnPg.js +0 -538
  67. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BQXqlXw4.js +0 -234
  68. package/dist/Ingredient-354LLwdX.js +0 -498
  69. package/dist/LinkProductSideSheet-anxSsu0z.js +0 -102
  70. package/dist/PrintRoute-DrSvtNLX.js +0 -425
  71. package/dist/Product.vue_vue_type_script_setup_true_lang-bBY54Q_1.js +0 -815
  72. package/dist/Products-CZyueqSO.js +0 -234
  73. package/dist/Publish-kRM1UuPk.js +0 -518
  74. package/dist/Recipe-nKpLIJs8.js +0 -345
  75. package/dist/Scheduler-DmZ8atXG.js +0 -233
  76. package/dist/SchedulerSelector.vue_vue_type_script_setup_true_lang-CdsxA-p0.js +0 -48
  77. package/dist/ServingSequence-j00_ko5R.js +0 -4
  78. package/dist/Setting.vue_vue_type_script_setup_true_lang-Cx06MCJs.js +0 -247
  79. package/dist/Takeaway-BXZXCAaM.js +0 -61
  80. package/dist/Takeaway.vue_vue_type_script_setup_true_lang-9WVkdLZF.js +0 -316
  81. package/dist/TaxSetting-DdHx7ACN.js +0 -21
  82. package/dist/Unit-biPvleyL.js +0 -161
  83. package/dist/Variant-BP1IRNQx.js +0 -231
  84. package/dist/_id_-BiaNDI2N.js +0 -188
  85. package/dist/category-KiA5-36F.js +0 -154
  86. package/dist/index-BFeZlU8X.js +0 -232
  87. package/dist/item-Bcg7SiYv.js +0 -6325
  88. package/dist/scheduler-D1tgE0_9.js +0 -480
  89. package/dist/takeaway-BKsoD4EL.js +0 -264
  90. package/dist/unit-CswFvAyc.js +0 -346
@@ -1,247 +0,0 @@
1
- import { defineComponent as ie, computed as d, ref as B, watch as ue, watchEffect as re, resolveComponent as r, openBlock as u, createElementBlock as O, createVNode as n, normalizeClass as J, withCtx as c, createElementVNode as p, createBlock as v, createCommentVNode as y, unref as l, Fragment as P, renderList as $, createTextVNode as z, toDisplayString as A } from "vue";
2
- import { u as ce, a as me, b as f, i as de, c as pe, d as R } from "./app-D7e31gIv.js";
3
- import { C as H } from "./catalog-Ck7lLTN2.js";
4
- import { C as g, a as C, _ as Y } from "./GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BQXqlXw4.js";
5
- import { useSnackbar as ve, useDialog as fe, FmButtonColorThemeVariant as j, FmButtonVariant as q, components as ge } from "@feedmepos/ui-library";
6
- import { useCoreStore as _e } from "@feedmepos/mf-common";
7
- import { _ as ye } from "./FormSection.vue_vue_type_script_setup_true_lang-BWJUD8NZ.js";
8
- import { _ as N } from "./FormItem.vue_vue_type_script_setup_true_lang-DKsxEK-8.js";
9
- const Ce = {
10
- class: /* @__PURE__ */ J(["overflow-scroll", "flex-1", "xs:px-16 xs:py-16"])
11
- }, be = {
12
- class: "space-y-32"
13
- }, xe = {
14
- key: 0,
15
- class: "pl-32 space-x-8"
16
- }, ke = {
17
- class: "pl-[60px] space-y-16"
18
- }, Oe = {
19
- class: "space-x-16 flex items-center"
20
- }, he = {
21
- class: "flex-1 space-y-4"
22
- }, Se = {
23
- class: "fm-typo-en-body-lg-400"
24
- }, Me = {
25
- class: "fm-typo-en-body-md-400"
26
- }, Fe = {
27
- class: "flex justify-end"
28
- }, Pe = /* @__PURE__ */ ie({
29
- __name: "Setting",
30
- setup(Ve) {
31
- const h = _e(), s = ce(), W = ve(), U = me(W), {
32
- custom: we,
33
- minor: G
34
- } = U, T = fe(), b = d(() => s.currentCatalog);
35
- d(() => new H(b.value, s, E, T));
36
- const x = d(() => !b.value), S = d(() => s.version === f.F_MENU_VERSION.enum.v4), {
37
- checkMenuIsLoading: Ae,
38
- updateMenu: E
39
- } = de(U), t = B(g.initCatalogSetting()), K = d(() => s.catalogs.filter((e) => e._id !== s.state.currentCatalogId).map((e) => e.name)), Q = d(() => s.state.restaurants.filter((e) => [...e.additionalCatalogs, e.inHouseDelivery, ...e.linkedDeliveryCatalogs.map((o) => o.catalog), e.pickupCatalog, e.takeawayCatalog, e.catalogId].includes(s.state.currentCatalogId)).map((e) => e.name));
40
- function L() {
41
- return Q.value.length > 0 ? n("div", {
42
- class: ["flex items-center", "bg-fm-color-system-warning-100", "rounded-lg", "py-16 px-24 space-x-8"]
43
- }, [n(ge.FmIcon, {
44
- color: "system-warning-300",
45
- name: "warning"
46
- }, null), n("p", {
47
- class: "fm-typo-en-body-lg-400"
48
- }, [z("This catalog is being use by delivery company and other order method. This may cause wrong price calculation, please review the price for each catalog usage.")])]) : null;
49
- }
50
- function I() {
51
- const e = b.value;
52
- t.value = e ? g.fromCatalog(e, S.value) : g.fromMainCatalog(s.state.menu.masterCatalogSetting);
53
- }
54
- ue(() => s.state.currentCatalogId, I), B(!1);
55
- const M = d(() => {
56
- if (!h.currentCountry.value) return [];
57
- const e = t.value.taxSetting.mode === C.MANUAL ? t.value.taxSetting.inclusive ?? [] : [];
58
- return pe.Country.getCountry(h.currentCountry.value).taxSystems.map((i) => {
59
- const m = e.find((k) => k.systemCode === i.code);
60
- return {
61
- inclusive: (m == null ? void 0 : m.inclusive) || !1,
62
- systemCode: i.code
63
- };
64
- });
65
- });
66
- function X(e) {
67
- const o = t.value.taxSetting, i = o.mode === C.AUTO ? g.manualTax(M.value) : R(o);
68
- i.inclusive ?? (i.inclusive = []);
69
- const m = i.inclusive.findIndex((k) => k.systemCode === e.systemCode);
70
- m < 0 ? i.inclusive.push(e) : i.inclusive.splice(m, 1, e), F.value = i;
71
- }
72
- re(async () => {
73
- h.currentBusiness.value && (x.value && !s.state.menu._id || I());
74
- });
75
- const F = d({
76
- get: () => t.value.taxSetting,
77
- set: (e) => {
78
- t.value.taxSetting = e;
79
- }
80
- }), Z = async () => {
81
- const e = g.toCatalog(t.value);
82
- b.value ? await new H({
83
- ...b.value,
84
- ...e
85
- }, s, E, T).update() : await G(async () => {
86
- await s.updateMainCatalogSetting({
87
- inclusiveTaxes: e.inclusiveTaxes
88
- });
89
- }, {
90
- successMessage: "Main catalog updated",
91
- customId: s.state.menu._id
92
- });
93
- };
94
- function ee(e, o) {
95
- const i = R(t.value);
96
- i.markupOptions && (i.markupOptions[e] = o, t.value = i);
97
- }
98
- function ae(e) {
99
- const o = R(t.value);
100
- o.markupOptions && (o.markupOptions.splice(e, 1), t.value = o);
101
- }
102
- return (e, o) => {
103
- const i = r("fm-text-field"), m = r("fm-radio"), k = r("fm-radio-group"), te = r("fm-checkbox"), D = r("fm-switch"), oe = r("fm-select"), V = r("fm-button"), le = r("fm-chip"), ne = r("fm-card"), se = r("fm-form");
104
- return u(), O("div", Ce, [n(se, {
105
- class: J(["space-y-40 max-w-[751px]", "h-fit"]),
106
- "blame-form-child-on-validation-failed": "",
107
- onValidationSuccess: Z
108
- }, {
109
- default: c(() => [p("div", be, [x.value ? y("", !0) : (u(), v(ye, {
110
- key: 0,
111
- title: "Catalog Detail"
112
- }, {
113
- default: c(() => [n(i, {
114
- modelValue: t.value.name,
115
- "onUpdate:modelValue": o[0] || (o[0] = (a) => t.value.name = a),
116
- rules: [(a) => !K.value.includes(a.trim()) || "Catalog name used", (a) => !!a.trim() || "Catalog name is required"],
117
- label: "Catalog name"
118
- }, null, 8, ["modelValue", "rules"]), n(L)]),
119
- _: 1
120
- })), n(N, {
121
- label: "Tax calculation"
122
- }, {
123
- default: c(() => [n(k, {
124
- "model-value": t.value.taxSetting.mode,
125
- "onUpdate:modelValue": o[1] || (o[1] = (a) => {
126
- a === l(C).AUTO ? F.value = l(g).autoTax() : F.value = l(g).manualTax(M.value);
127
- })
128
- }, {
129
- default: c(() => [n(m, {
130
- value: l(C).AUTO,
131
- label: "Automatic",
132
- sublabel: "All price default to exclusive, when order through delivery company it will automatically become tax inclusive"
133
- }, null, 8, ["value"]), n(m, {
134
- value: l(C).MANUAL,
135
- label: "Manual",
136
- sublabel: "You can specify own tax calculation for this catalog"
137
- }, null, 8, ["value"])]),
138
- _: 1
139
- }, 8, ["model-value"]), t.value.taxSetting.mode === l(C).MANUAL ? (u(), O("div", xe, [(u(!0), O(P, null, $(M.value, (a) => (u(), v(te, {
140
- key: a.systemCode,
141
- "model-value": a.inclusive,
142
- value: !0,
143
- label: a.systemCode + " inclusive",
144
- "onUpdate:modelValue": (_) => {
145
- X({
146
- ...a,
147
- inclusive: _
148
- });
149
- }
150
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))])) : y("", !0)]),
151
- _: 1
152
- }), !x.value && S.value ? (u(), v(N, {
153
- key: 1,
154
- label: "Link product configuration"
155
- }, {
156
- default: c(() => [n(D, {
157
- "model-value": t.value.orderFrom && t.value.orderFrom !== l(f.F_ORDER_FROM).enum.NONE,
158
- label: "Auto link item",
159
- "label-placement": "right",
160
- sublabel: "Auto-link products to the main catalog for availability",
161
- "onUpdate:modelValue": o[2] || (o[2] = (a) => t.value.orderFrom = a ? l(f.F_ORDER_FROM).enum.ALL : l(f.F_ORDER_FROM).enum.NONE)
162
- }, null, 8, ["model-value"]), t.value.orderFrom !== l(f.F_ORDER_FROM).enum.NONE ? (u(), v(oe, {
163
- key: 0,
164
- class: "ml-[60px]",
165
- items: [{
166
- label: "Available for all",
167
- value: l(f.F_ORDER_FROM).enum.ALL
168
- }, {
169
- label: "Order on POS only",
170
- value: l(f.F_ORDER_FROM).enum.POS_ONLY
171
- }],
172
- "model-value": t.value.orderFrom,
173
- "onUpdate:modelValue": o[3] || (o[3] = (a) => t.value.orderFrom = a)
174
- }, null, 8, ["items", "model-value"])) : y("", !0)]),
175
- _: 1
176
- })) : y("", !0), !x.value && S.value ? (u(), v(N, {
177
- key: 2,
178
- label: "Price markup configuration"
179
- }, {
180
- default: c(() => [n(D, {
181
- "model-value": !!t.value.markupOptions,
182
- label: "Auto markup price",
183
- "label-placement": "right",
184
- sublabel: "Auto-markup prices for catalog, groups, and schedules",
185
- "onUpdate:modelValue": o[4] || (o[4] = (a) => t.value.markupOptions = a ? [] : null)
186
- }, null, 8, ["model-value"]), p("div", ke, [n(Y, {
187
- categories: l(s).categories,
188
- items: l(s).items,
189
- action: "add",
190
- "onUpdate:modelValue": o[5] || (o[5] = (a) => t.value.markupOptions = [...t.value.markupOptions ?? [], a])
191
- }, {
192
- default: c(({
193
- trigger: a
194
- }) => [n(V, {
195
- "text-color": l(j).ColorPrimary,
196
- "border-color": l(j).ColorPrimary,
197
- variant: l(q).Secondary,
198
- label: "Add markup configuration",
199
- "prepend-icon": "add",
200
- onClick: a
201
- }, null, 8, ["text-color", "border-color", "variant", "onClick"])]),
202
- _: 1
203
- }, 8, ["categories", "items"]), (u(!0), O(P, null, $(t.value.markupOptions, (a, _) => (u(), v(Y, {
204
- key: _,
205
- categories: l(s).categories,
206
- items: l(s).items,
207
- "model-value": a,
208
- action: "update",
209
- "onUpdate:modelValue": (w) => ee(_, w)
210
- }, {
211
- default: c(({
212
- trigger: w
213
- }) => [n(ne, {
214
- id: JSON.stringify(a),
215
- class: "py-12 px-16 cursor-pointer",
216
- variant: "outlined",
217
- onClick: w
218
- }, {
219
- default: c(() => [p("div", Oe, [p("div", he, [n(le, {
220
- class: "text-fm-color-typo-info bg-fm-color-system-info-100 font-semibold"
221
- }, {
222
- default: c(() => [z(" Markup percentage: " + A(a.percentage) + "% ", 1)]),
223
- _: 2
224
- }, 1024), p("p", Se, "Configuration " + A(_ + 1), 1), p("p", Me, A(a.includeItems ? `${a.includeItems.length} product(s) linked` : "Apply for all products"), 1)]), n(V, {
225
- variant: l(q).Tertiary,
226
- "prepend-icon": "delete",
227
- onClick: (Re) => ae(_)
228
- }, null, 8, ["variant", "onClick"])])]),
229
- _: 2
230
- }, 1032, ["id", "onClick"])]),
231
- _: 2
232
- }, 1032, ["categories", "items", "model-value", "onUpdate:modelValue"]))), 128))])]),
233
- _: 1
234
- })) : y("", !0), x.value ? (u(), v(L, {
235
- key: 3
236
- })) : y("", !0)]), p("div", Fe, [n(V, {
237
- label: "Save",
238
- type: "submit"
239
- })])]),
240
- _: 1
241
- })]);
242
- };
243
- }
244
- });
245
- export {
246
- Pe as _
247
- };
@@ -1,61 +0,0 @@
1
- import { defineComponent as _, computed as f, ref as y, openBlock as r, createBlock as i, withCtx as s, createVNode as d, createElementVNode as a, toDisplayString as k, unref as t, createCommentVNode as b } from "vue";
2
- import { a as g } from "./menu-CYzbNubv.js";
3
- import { a as v, u as w, _ as T, b as x, h as M, f as E, i as V } from "./app-D7e31gIv.js";
4
- import { _ as h } from "./Takeaway.vue_vue_type_script_setup_true_lang-9WVkdLZF.js";
5
- import { useSnackbar as C } from "@feedmepos/ui-library";
6
- import "@feedmepos/mf-common";
7
- import "vue-router";
8
- import { T as N, l as S } from "./takeaway-BKsoD4EL.js";
9
- const L = { class: "flex-1 flex justify-between gap-8 pl-8" }, O = { class: "flex items-center" }, U = { class: "bg-fm-color-neutral-gray-100 rounded-md px-8 py-4" }, B = { class: "fm-typo-en-body-md-600 font-semibold" }, q = /* @__PURE__ */ _({
10
- __name: "Takeaway",
11
- setup(F) {
12
- const u = C(), l = v(u), m = w(), c = V(l), p = f(() => m.rules.item.bindToVariant), n = y(0);
13
- return g().resetOnMount(), (A, o) => (r(), i(T, { heading: "Takeaway" }, {
14
- default: s(() => [
15
- d(h, {
16
- "onUpdate:count": o[0] || (o[0] = (e) => n.value = e)
17
- })
18
- ]),
19
- "append-heading": s(() => [
20
- a("div", L, [
21
- a("div", O, [
22
- a("div", U, [
23
- a("p", B, k(n.value), 1)
24
- ])
25
- ]),
26
- a("div", null, [
27
- n.value > 0 ? (r(), i(t(N), {
28
- key: 0,
29
- "bind-to-variant": p.value,
30
- action: "add",
31
- "apply-product": "",
32
- "onUpdate:takeaway": o[1] || (o[1] = (e) => t(c).updateMenu(
33
- {
34
- module: t(x.F_MENU_MODULE_V4_KEY).enum.takeaway,
35
- operation: t(M.F_OPERATION_TYPE).create,
36
- data: e,
37
- link: t(S)(e.usedBy || [])
38
- },
39
- e.name
40
- ))
41
- }, {
42
- default: s(({ trigger: e }) => [
43
- d(E, {
44
- label: "Add takeaway",
45
- "prepend-icon": "add",
46
- type: "button",
47
- onClick: e
48
- }, null, 8, ["onClick"])
49
- ]),
50
- _: 1
51
- }, 8, ["bind-to-variant"])) : b("", !0)
52
- ])
53
- ])
54
- ]),
55
- _: 1
56
- }));
57
- }
58
- });
59
- export {
60
- q as default
61
- };
@@ -1,316 +0,0 @@
1
- import { getCurrentInstance as ee, defineComponent as ae, computed as b, watch as te, h as R, resolveComponent as B, openBlock as _, createElementBlock as C, Fragment as I, createElementVNode as v, createVNode as x, unref as l, isRef as Y, withCtx as P, renderList as ne, normalizeClass as D, toDisplayString as E, createBlock as $, withModifiers as j, createCommentVNode as G } from "vue";
2
- import { a as H, u as J, b as F, h as N, i as Q, d as z, l as oe, c as ie, n as se, V as q, j as re, k as le } from "./app-D7e31gIv.js";
3
- import { l as W, a as de, T as ce } from "./takeaway-BKsoD4EL.js";
4
- import { f as O } from "./currency-CclA5a-2.js";
5
- import { useDialog as ue, useSnackbar as X, FmButtonVariant as A, components as me, useBreakpoints as ye } from "@feedmepos/ui-library";
6
- import { useCoreStore as pe } from "@feedmepos/mf-common";
7
- import { defineStore as fe } from "pinia";
8
- import { C as _e } from "./catalog-Ck7lLTN2.js";
9
- function ve(V, T, d, u) {
10
- var p, h, k, w;
11
- const o = z(V);
12
- o.override.takeaway[d._id] = {
13
- price: d.price || void 0
14
- };
15
- const y = [...d.usedBy, ...T.usedBy];
16
- for (const s of y) {
17
- const e = d.usedBy.some(
18
- (a) => a._id == s._id && a.combinationKey == s.combinationKey
19
- ) ? d._id : null, r = (o.override.items[s._id] || []).findIndex(
20
- (a) => a.combinationKey === s.combinationKey
21
- );
22
- let c;
23
- if (r >= 0)
24
- c = (p = o.override.items[s._id][r]) != null && p.takeawayUsed ? z((h = o.override.items[s._id][r]) == null ? void 0 : h.takeawayUsed) : void 0;
25
- else {
26
- const a = u.find((f) => f._id === s._id);
27
- s.combinationKey ? c = ((w = (k = a == null ? void 0 : a.variant) == null ? void 0 : k.variantCombinations.find(
28
- (f) => f.combinationKey === s.combinationKey
29
- )) == null ? void 0 : w.takeawayUsed) || (a == null ? void 0 : a.takeawayUsed) : c = a == null ? void 0 : a.takeawayUsed;
30
- }
31
- if (r >= 0)
32
- o.override.items[s._id][r].takeawayUsed = e;
33
- else if (c !== e) {
34
- const a = {
35
- _id: s._id,
36
- combinationKey: s.combinationKey,
37
- takeawayUsed: e
38
- };
39
- o.override.items[s._id] = [...o.override.items[s._id] || [], a];
40
- }
41
- }
42
- return o;
43
- }
44
- const ke = fe("takeaway-manager", () => {
45
- const V = ue(), T = X(), d = H(T), u = Q(d), o = J(), y = ee(), p = (e) => {
46
- var c, a;
47
- const { vNode: r } = oe(
48
- de,
49
- y,
50
- e
51
- );
52
- (a = (c = r.component) == null ? void 0 : c.exposed) == null || a.trigger();
53
- };
54
- async function h(e) {
55
- var a, f;
56
- const c = ((f = (a = o.currentCatalog) == null ? void 0 : a.override.takeaway[e._id]) == null ? void 0 : f.price) ? null : o.state.menu.modules.takeaway.find((g) => g._id === e._id);
57
- p({
58
- initialValue: e,
59
- applyProduct: !0,
60
- bindToVariant: o.rules.item.bindToVariant,
61
- fallback: c,
62
- action: "update",
63
- "onUpdate:takeaway": async (g) => {
64
- let t = z(o.currentCatalog);
65
- g.price ? t.override.takeaway[e._id] = { price: g.price } : delete t.override.takeaway[e._id], t = ve(t, e, g, o.state.menu.modules.item), await new _e(t, o, u.updateMenu, V).update();
66
- }
67
- });
68
- }
69
- async function k(e) {
70
- p({
71
- initialValue: e,
72
- bindToVariant: o.rules.item.bindToVariant,
73
- applyProduct: !0,
74
- action: "update",
75
- "onUpdate:takeaway": async (r) => {
76
- await u.updateMenu(
77
- {
78
- module: F.F_MENU_MODULE_V4_KEY.enum.takeaway,
79
- operation: N.F_OPERATION_TYPE.update,
80
- data: r,
81
- link: W(r.usedBy || [])
82
- },
83
- r.name
84
- );
85
- }
86
- });
87
- }
88
- async function w(e) {
89
- o.currentCatalog ? await h(e) : await k(e);
90
- }
91
- async function s(e) {
92
- V.open({
93
- title: "Remove takeaway",
94
- message: `Do you want to remove ${e.name}?`,
95
- primaryActions: {
96
- text: "Delete",
97
- close: !0,
98
- variant: A.Destructive
99
- },
100
- secondaryActions: {
101
- text: "Cancel",
102
- close: !0
103
- }
104
- }).onPrimary(async () => {
105
- await u.updateMenu(
106
- {
107
- module: F.F_MENU_MODULE_V4_KEY.enum.takeaway,
108
- operation: N.F_OPERATION_TYPE.delete,
109
- data: e._id
110
- },
111
- e.name,
112
- !0
113
- );
114
- });
115
- }
116
- return {
117
- deleteTakeaway: s,
118
- updateTakeaway: w
119
- };
120
- }), we = {
121
- key: 0,
122
- class: /* @__PURE__ */ D(["flex-1 overflow-hidden", "space-y-16", "flex flex-col", "overflow-hidden"])
123
- }, ge = { class: "flex items-center space-x-8 justify-end" }, be = { class: "w-[320px]" }, he = { class: "px-16 pt-8" }, Ce = {
124
- class: /* @__PURE__ */ D(["flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100"])
125
- }, xe = ["onClick"], Ve = { class: "flex-1" }, Te = { class: "fm-typo-en-body-lg-600 mb-4" }, Ue = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ke = {
126
- key: 1,
127
- class: "xs:pt-24"
128
- }, ze = /* @__PURE__ */ ae({
129
- __name: "Takeaway",
130
- emits: ["update:count"],
131
- setup(V, { emit: T }) {
132
- const d = J(), u = ke(), o = b(() => d.rules.item.bindToVariant), y = b(() => d.rules.takeaway), p = Q(H(X())), h = pe(), k = b(
133
- () => ie.Country.getCountry(h.currentCountry.value).currency
134
- ), w = b(() => d.takeaways.map((t) => ({
135
- ...t,
136
- usedBy: d.items.reduce((i, m) => {
137
- var n, M, L;
138
- const U = m.takeawayUsed === t._id;
139
- if ((!o.value || !((M = (n = m.variant) == null ? void 0 : n.variantGroupIds) != null && M.length)) && U)
140
- i.push({ _id: m._id });
141
- else {
142
- const Z = (((L = m.variant) == null ? void 0 : L.variantCombinations) || []).filter((K) => K.takeawayUsed === t._id || !K.takeawayUsed && U).map((K) => ({ _id: m._id, combinationKey: K.combinationKey }));
143
- i = [...i, ...Z];
144
- }
145
- return i;
146
- }, [])
147
- }))), { filter: s, searchKey: e } = se(), r = b(
148
- () => w.value.filter((t) => s([t.name, O(t.price, !1)]))
149
- ), c = T;
150
- te(
151
- () => r.value.length,
152
- (t) => {
153
- c("update:count", t);
154
- },
155
- { immediate: !0 }
156
- );
157
- const a = b(() => [
158
- {
159
- accessorKey: "name",
160
- header: "Takeaway name",
161
- enableSorting: !1,
162
- size: 700
163
- },
164
- {
165
- accessorKey: "price",
166
- header: `Price (${k.value.symbol})`,
167
- enableSorting: !1,
168
- size: 200,
169
- meta: {
170
- textAlign: "right"
171
- },
172
- cell: (t) => {
173
- const i = t.getValue();
174
- return O(i, !1);
175
- }
176
- },
177
- {
178
- accessorKey: "usedBy",
179
- header: "Apply products",
180
- enableSorting: !1,
181
- size: 200,
182
- cell: (t) => {
183
- const i = t.getValue();
184
- return `${q(d.categorizedItems, i).flatMap((m) => m.items).length ?? 0} items linked`;
185
- }
186
- },
187
- {
188
- id: "action",
189
- size: 52,
190
- meta: {
191
- cellClass: "pl-16",
192
- headerContentClass: "-mx-16"
193
- },
194
- cell: (t) => R(
195
- "div",
196
- {
197
- class: "flex justify-end items-center"
198
- },
199
- [
200
- y.value.delete ? R(me.FmButton, {
201
- prependIcon: "delete",
202
- variant: A.Tertiary,
203
- textColor: "neutral-gray-400",
204
- onClick: (i) => {
205
- i.stopPropagation(), u.deleteTakeaway(t.row.original);
206
- }
207
- }) : null
208
- ]
209
- )
210
- }
211
- ]), f = ye(), g = b(() => f.breakpoints.value.xs);
212
- return (t, i) => {
213
- const m = B("fm-search"), U = B("fm-table"), S = B("fm-button");
214
- return w.value.length ? (_(), C(I, { key: 0 }, [
215
- g.value ? (_(), C(I, { key: 1 }, [
216
- v("div", he, [
217
- x(m, {
218
- class: "w-full",
219
- autofocus: "",
220
- modelValue: l(e),
221
- "onUpdate:modelValue": i[2] || (i[2] = (n) => Y(e) ? e.value = n : null)
222
- }, null, 8, ["modelValue"])
223
- ]),
224
- v("div", Ce, [
225
- (_(!0), C(I, null, ne(r.value, (n) => (_(), C("div", {
226
- key: n._id,
227
- class: D(["py-12 px-16", "flex space-x-8", "items-center"]),
228
- onClick: () => {
229
- y.value.edit && l(u).updateTakeaway(n);
230
- }
231
- }, [
232
- v("div", Ve, [
233
- v("p", Te, E(n.name), 1),
234
- v("p", Ue, E(`${l(q)(l(d).categorizedItems, n.usedBy).flatMap((M) => M.items).length ?? 0} items linked`), 1),
235
- v("p", Me, " Price: " + E(k.value.symbol) + E(l(O)(n.price, !1)), 1)
236
- ]),
237
- y.value.delete ? (_(), $(S, {
238
- key: 0,
239
- variant: l(A).Tertiary,
240
- "text-color": "neutral-gray-400",
241
- "prepend-icon": "delete",
242
- onClick: j(() => l(u).deleteTakeaway(n), ["stop"])
243
- }, null, 8, ["variant", "onClick"])) : G("", !0)
244
- ], 8, xe))), 128))
245
- ])
246
- ], 64)) : (_(), C("div", we, [
247
- v("div", ge, [
248
- v("div", be, [
249
- x(m, {
250
- autofocus: "",
251
- modelValue: l(e),
252
- "onUpdate:modelValue": i[0] || (i[0] = (n) => Y(e) ? e.value = n : null),
253
- placeholder: "Search takeaways"
254
- }, null, 8, ["modelValue"])
255
- ])
256
- ]),
257
- x(re, null, {
258
- default: P(() => [
259
- x(U, {
260
- "column-defs": a.value,
261
- loading: l(p).checkMenuIsLoading(),
262
- "page-size": r.value.length,
263
- "row-data": r.value,
264
- "search-value": l(e),
265
- "shrink-at": !1,
266
- class: "flex-1 overflow-hidden",
267
- "hide-footer": "",
268
- "pin-header-row": "",
269
- onRowClick: i[1] || (i[1] = (n) => {
270
- y.value.edit && l(u).updateTakeaway(n.original);
271
- })
272
- }, null, 8, ["column-defs", "loading", "page-size", "row-data", "search-value"])
273
- ]),
274
- _: 1
275
- })
276
- ]))
277
- ], 64)) : (_(), C("div", Ke, [
278
- x(l(le), {
279
- subtitle: "Seems like you don't have takeaway created.",
280
- title: "No takeaway found"
281
- }, {
282
- action: P(() => [
283
- y.value.create ? (_(), $(l(ce), {
284
- key: 0,
285
- "bind-to-variant": o.value,
286
- action: "add",
287
- "apply-product": "",
288
- "onUpdate:takeaway": i[3] || (i[3] = (n) => l(p).updateMenu(
289
- {
290
- module: l(F.F_MENU_MODULE_V4_KEY).enum.takeaway,
291
- operation: l(N.F_OPERATION_TYPE).create,
292
- data: n,
293
- link: l(W)(n.usedBy || [])
294
- },
295
- n.name
296
- ))
297
- }, {
298
- default: P(({ trigger: n }) => [
299
- x(S, {
300
- "prepend-icon": "add",
301
- label: "Add takeaway",
302
- onClick: j(n, ["stop"])
303
- }, null, 8, ["onClick"])
304
- ]),
305
- _: 1
306
- }, 8, ["bind-to-variant"])) : G("", !0)
307
- ]),
308
- _: 1
309
- })
310
- ]));
311
- };
312
- }
313
- });
314
- export {
315
- ze as _
316
- };
@@ -1,21 +0,0 @@
1
- import { defineComponent as n, openBlock as r, createBlock as s, withCtx as i, createVNode as c } from "vue";
2
- import { a as m } from "./menu-CYzbNubv.js";
3
- import { a as u, _, i as f } from "./app-D7e31gIv.js";
4
- import { _ as p } from "./Setting.vue_vue_type_script_setup_true_lang-Cx06MCJs.js";
5
- import { u as d } from "./category-KiA5-36F.js";
6
- import { useDialog as g, useSnackbar as l } from "@feedmepos/ui-library";
7
- const T = /* @__PURE__ */ n({
8
- __name: "TaxSetting",
9
- setup(x) {
10
- const e = g(), a = l(), o = u(a), t = f(o);
11
- return d({ dialog: e, menuLoader: t }), m().resetOnMount(), (k, h) => (r(), s(_, { heading: "Tax setting" }, {
12
- default: i(() => [
13
- c(p)
14
- ]),
15
- _: 1
16
- }));
17
- }
18
- });
19
- export {
20
- T as default
21
- };