@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,570 +0,0 @@
1
- import { defineComponent as se, ref as w, computed as E, watch as ve, resolveComponent as m, openBlock as u, createElementBlock as v, Fragment as A, renderSlot as _e, createVNode as r, unref as s, withCtx as c, createElementVNode as d, renderList as L, createBlock as C, createCommentVNode as $, createTextVNode as ge, toDisplayString as M, h as Z, withModifiers as ee, normalizeClass as q } from "vue";
2
- import { useCoreStore as ie } from "@feedmepos/mf-common";
3
- import { b as x, u as re, i as ue, a as ce, m as te, c as ye, g as be, d as J, h as de, x as ae, _ as xe, k as Ce, j as ke, R as oe } from "./app-D7e31gIv.js";
4
- import { C as Oe } from "./catalog-Ck7lLTN2.js";
5
- import { useRouter as he } from "vue-router";
6
- import { useSnackbar as me, components as pe, FmButtonColorThemeVariant as W, FmButtonVariant as G, useDialog as Fe, useBreakpoints as Ae } from "@feedmepos/ui-library";
7
- import { C as N, a as R, _ as le } from "./GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-BQXqlXw4.js";
8
- import { _ as Me } from "./FormSection.vue_vue_type_script_setup_true_lang-BWJUD8NZ.js";
9
- import { _ as Q } from "./FormItem.vue_vue_type_script_setup_true_lang-DKsxEK-8.js";
10
- const De = { class: "space-y-32" }, Ve = {
11
- key: 0,
12
- class: "pl-32 space-x-8"
13
- }, Se = { class: "pl-[60px] space-y-16" }, Te = { class: "space-x-16 flex items-center" }, Ue = { class: "flex-1 space-y-4" }, Ne = { class: "fm-typo-en-body-lg-400" }, Re = { class: "fm-typo-en-body-md-400" }, Ee = { class: "flex gap-8 items-center justify-start" }, Le = /* @__PURE__ */ se({
14
- __name: "Form",
15
- setup(fe) {
16
- const y = w(!1), _ = w(!1), I = (i) => {
17
- be.isBoolean(i) ? y.value = i : y.value = !y.value;
18
- }, V = E(() => F.version === x.F_MENU_VERSION.enum.v4), F = re(), P = ie(), B = ue(ce(me())), n = w(
19
- N.fromCatalog(te.generator.initMenuV4Catalog(), V.value)
20
- ), K = E(() => F.catalogs.map((i) => i.name));
21
- ve(
22
- () => y.value,
23
- (i) => {
24
- i && (n.value = N.fromCatalog(te.generator.initMenuV4Catalog(), V.value));
25
- }
26
- );
27
- const D = E({
28
- get: () => n.value.taxSetting,
29
- set: (i) => {
30
- n.value.taxSetting = i;
31
- }
32
- }), b = E(() => {
33
- var e, a;
34
- if (!P.currentCountry.value) return [];
35
- const i = ((e = n.value.taxSetting) == null ? void 0 : e.mode) === R.MANUAL ? ((a = n.value.taxSetting) == null ? void 0 : a.inclusive) ?? [] : [];
36
- return ye.Country.getCountry(P.currentCountry.value).taxSystems.map((p) => {
37
- const g = i.find((k) => k.systemCode === p.code);
38
- return {
39
- inclusive: (g == null ? void 0 : g.inclusive) || !1,
40
- systemCode: p.code
41
- };
42
- });
43
- });
44
- function z(i) {
45
- const t = n.value.taxSetting, e = t.mode === R.AUTO ? N.manualTax(b.value) : J(t);
46
- e.inclusive ?? (e.inclusive = []);
47
- const a = e.inclusive.findIndex((p) => p.systemCode === i.systemCode);
48
- a < 0 ? e.inclusive.push(i) : e.inclusive.splice(a, 1, i), D.value = e;
49
- }
50
- function Y(i, t) {
51
- const e = J(n.value);
52
- e.markupOptions && (e.markupOptions[i] = t, n.value = e);
53
- }
54
- function j(i) {
55
- const t = J(n.value);
56
- t.markupOptions && (t.markupOptions.splice(i, 1), n.value = t);
57
- }
58
- async function H() {
59
- _.value = !0;
60
- const i = {
61
- ...n.value,
62
- ...N.toCatalog(n.value)
63
- };
64
- try {
65
- await B.updateMenu(
66
- {
67
- module: x.F_MENU_MODULE_V4_KEY.enum.catalog,
68
- operation: de.F_OPERATION_TYPE.create,
69
- data: i
70
- },
71
- i.name
72
- ), y.value = !1;
73
- } finally {
74
- _.value = !1;
75
- }
76
- }
77
- return (i, t) => {
78
- const e = m("fm-text-field"), a = m("fm-radio"), p = m("fm-radio-group"), g = m("fm-checkbox"), k = m("fm-switch"), S = m("fm-select"), O = m("fm-button"), T = m("fm-chip"), o = m("fm-card"), U = m("fm-side-sheet");
79
- return u(), v(A, null, [
80
- _e(i.$slots, "default", { trigger: I }),
81
- r(U, {
82
- modelValue: y.value,
83
- "onUpdate:modelValue": t[7] || (t[7] = (l) => y.value = l),
84
- "is-container": s(pe).FmForm,
85
- "is-container-props": {
86
- onValidationSuccess: H,
87
- blameFormChildOnValidationFailed: !0
88
- },
89
- "max-width": 560,
90
- "z-index": 80
91
- }, {
92
- "side-sheet-footer": c(() => [
93
- d("div", Ee, [
94
- r(O, {
95
- loading: _.value,
96
- label: "Add",
97
- size: "lg",
98
- type: "submit",
99
- variant: "primary"
100
- }, null, 8, ["loading"]),
101
- r(O, {
102
- label: "Cancel",
103
- size: "lg",
104
- variant: "tertiary",
105
- onClick: t[6] || (t[6] = () => y.value = !1)
106
- })
107
- ])
108
- ]),
109
- default: c(() => [
110
- d("div", De, [
111
- r(Me, { title: "Catalog Detail" }, {
112
- default: c(() => [
113
- r(e, {
114
- modelValue: n.value.name,
115
- "onUpdate:modelValue": t[0] || (t[0] = (l) => n.value.name = l),
116
- rules: [
117
- (l) => !K.value.includes(l.trim()) || "Catalog name used",
118
- (l) => !!l || "Catalog name is required"
119
- ],
120
- autofocus: "",
121
- label: "Catalog name"
122
- }, null, 8, ["modelValue", "rules"]),
123
- r(Q, { label: "Tax calculation" }, {
124
- default: c(() => {
125
- var l, h;
126
- return [
127
- r(p, {
128
- "model-value": (l = n.value.taxSetting) == null ? void 0 : l.mode,
129
- "onUpdate:modelValue": t[1] || (t[1] = (f) => {
130
- f === s(R).AUTO ? D.value = s(N).autoTax() : D.value = s(N).manualTax(b.value);
131
- })
132
- }, {
133
- default: c(() => [
134
- r(a, {
135
- value: s(R).AUTO,
136
- label: "Automatic",
137
- sublabel: "All price default to exclusive, when order through delivery company it will automatically become tax inclusive",
138
- class: "pl-4"
139
- }, null, 8, ["value"]),
140
- r(a, {
141
- value: s(R).MANUAL,
142
- label: "Manual",
143
- sublabel: "You can specify own tax calculation for this catalog"
144
- }, null, 8, ["value"])
145
- ]),
146
- _: 1
147
- }, 8, ["model-value"]),
148
- ((h = n.value.taxSetting) == null ? void 0 : h.mode) === s(R).MANUAL ? (u(), v("div", Ve, [
149
- (u(!0), v(A, null, L(b.value, (f) => (u(), C(g, {
150
- key: f.systemCode,
151
- "model-value": f.inclusive,
152
- value: !0,
153
- label: f.systemCode + " inclusive",
154
- "onUpdate:modelValue": (X) => {
155
- z({
156
- ...f,
157
- inclusive: X
158
- });
159
- }
160
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))
161
- ])) : $("", !0)
162
- ];
163
- }),
164
- _: 1
165
- })
166
- ]),
167
- _: 1
168
- }),
169
- V.value ? (u(), C(Q, {
170
- key: 0,
171
- label: "Link product configuration"
172
- }, {
173
- default: c(() => [
174
- r(k, {
175
- "model-value": n.value.orderFrom && n.value.orderFrom !== s(x.F_ORDER_FROM).enum.NONE,
176
- label: "Auto link item",
177
- "label-placement": "right",
178
- sublabel: "Auto-link products to the main catalog for availability",
179
- "onUpdate:modelValue": t[2] || (t[2] = (l) => n.value.orderFrom = l ? s(x.F_ORDER_FROM).enum.ALL : s(x.F_ORDER_FROM).enum.NONE)
180
- }, null, 8, ["model-value"]),
181
- n.value.orderFrom !== s(x.F_ORDER_FROM).enum.NONE ? (u(), C(S, {
182
- key: 0,
183
- class: "ml-[60px]",
184
- items: [
185
- {
186
- label: "Available for all",
187
- value: s(x.F_ORDER_FROM).enum.ALL
188
- },
189
- {
190
- label: "Order on POS only",
191
- value: s(x.F_ORDER_FROM).enum.POS_ONLY
192
- }
193
- ],
194
- "model-value": n.value.orderFrom,
195
- "onUpdate:modelValue": t[3] || (t[3] = (l) => n.value.orderFrom = l)
196
- }, null, 8, ["items", "model-value"])) : $("", !0)
197
- ]),
198
- _: 1
199
- })) : $("", !0),
200
- V.value ? (u(), C(Q, {
201
- key: 1,
202
- label: "Price markup configuration"
203
- }, {
204
- default: c(() => [
205
- r(k, {
206
- "model-value": !!n.value.markupOptions,
207
- label: "Auto markup price",
208
- "label-placement": "right",
209
- sublabel: "Auto-markup prices for catalog, groups, and schedules",
210
- "onUpdate:modelValue": t[4] || (t[4] = (l) => n.value.markupOptions = l ? [] : null)
211
- }, null, 8, ["model-value"]),
212
- d("div", Se, [
213
- r(le, {
214
- categories: s(F).categories,
215
- items: s(F).items,
216
- action: "add",
217
- "onUpdate:modelValue": t[5] || (t[5] = (l) => l && (n.value.markupOptions = [...n.value.markupOptions ?? [], l]))
218
- }, {
219
- default: c(({ trigger: l }) => [
220
- r(O, {
221
- "text-color": s(W).ColorPrimary,
222
- "border-color": s(W).ColorPrimary,
223
- variant: s(G).Secondary,
224
- label: "Add markup configuration",
225
- "prepend-icon": "add",
226
- onClick: l
227
- }, null, 8, ["text-color", "border-color", "variant", "onClick"])
228
- ]),
229
- _: 1
230
- }, 8, ["categories", "items"]),
231
- (u(!0), v(A, null, L(n.value.markupOptions, (l, h) => (u(), C(le, {
232
- key: h,
233
- categories: s(F).categories,
234
- items: s(F).items,
235
- "model-value": l,
236
- action: "update",
237
- "onUpdate:modelValue": (f) => f && Y(h, f)
238
- }, {
239
- default: c(({ trigger: f }) => [
240
- r(o, {
241
- id: JSON.stringify(l),
242
- class: "py-12 px-16 cursor-pointer",
243
- variant: "outlined",
244
- onClick: f
245
- }, {
246
- default: c(() => [
247
- d("div", Te, [
248
- d("div", Ue, [
249
- r(T, { class: "text-fm-color-typo-info bg-fm-color-system-info-100 font-semibold" }, {
250
- default: c(() => [
251
- ge(" Markup percentage: " + M(l.percentage) + "% ", 1)
252
- ]),
253
- _: 2
254
- }, 1024),
255
- d("p", Ne, "Configuration " + M(h + 1), 1),
256
- d("p", Re, M(l.includeItems ? `${l.includeItems.length} product(s) linked` : "Apply for all items"), 1)
257
- ]),
258
- r(O, {
259
- variant: s(G).Tertiary,
260
- "prepend-icon": "delete",
261
- onClick: (X) => j(h)
262
- }, null, 8, ["variant", "onClick"])
263
- ])
264
- ]),
265
- _: 2
266
- }, 1032, ["id", "onClick"])
267
- ]),
268
- _: 2
269
- }, 1032, ["categories", "items", "model-value", "onUpdate:modelValue"]))), 128))
270
- ])
271
- ]),
272
- _: 1
273
- })) : $("", !0)
274
- ])
275
- ]),
276
- _: 1
277
- }, 8, ["modelValue", "is-container", "is-container-props"])
278
- ], 64);
279
- };
280
- }
281
- }), ne = Le, $e = {
282
- key: 1,
283
- class: "flex flex-col overflow-scroll divide-y divide-fm-color-neutral-gray-100"
284
- }, we = ["onClick"], Ie = { class: "flex-1 space-y-4" }, Pe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Be = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ze = { class: "fm-typo-en-body-lg-600" }, Ye = { class: "space-y-24" }, Ge = { class: "space-y-8 flex-1" }, Ke = { class: "fm-typo-cn-body-lg-600" }, je = { class: "space-y-8 flex-1" }, He = "main", ot = /* @__PURE__ */ se({
285
- __name: "Catalog",
286
- setup(fe) {
287
- const y = ie(), _ = re(), I = me(), V = ce(I), F = Fe(), P = ue(V), B = he();
288
- function n(t, e) {
289
- var k, S, O, T;
290
- const a = y.restaurants.value.find(({ _id: o }) => o === e._id), p = [
291
- ...e.linkedDeliveryCatalogs.map((o) => ({
292
- label: `Delivery (${o.name})`,
293
- selector: o.catalog
294
- })),
295
- {
296
- label: "Delivery (FoodPanda integration)",
297
- selector: (k = a == null ? void 0 : a.foodpandaDelivery) == null ? void 0 : k.catalogId
298
- },
299
- {
300
- label: "Delivery (GrabFood integration)",
301
- selector: (S = a == null ? void 0 : a.grabfoodDelivery) == null ? void 0 : S.catalogId
302
- },
303
- {
304
- label: "Delivery (ShopeeFood integration)",
305
- selector: (O = a == null ? void 0 : a.shopeefoodDelivery) == null ? void 0 : O.catalogId
306
- }
307
- ];
308
- return [
309
- { label: "Dine-in", selector: e.catalogId },
310
- { label: "Takeaway", selector: e.takeawayCatalog || e.catalogId },
311
- { label: "Pickup", selector: e.pickupCatalog || null },
312
- { label: "Additional", selector: e.additionalCatalogs },
313
- { label: "Delivery (In house)", selector: e.inHouseDelivery },
314
- {
315
- label: "Delivery (Feedme express)",
316
- selector: (T = a == null ? void 0 : a.feedmeDelivery) == null ? void 0 : T.catalogId
317
- },
318
- ...ae(p, { selector: "label" })
319
- ].filter((o) => t ? Array.isArray(o.selector) ? o.selector.includes(t) : o.selector === t : o.selector === null).map((o) => o.label);
320
- }
321
- function K(t) {
322
- return _.state.restaurants.map((e) => ({
323
- name: e.name,
324
- usage: n(t, e)
325
- })).filter((e) => e.usage.length > 0);
326
- }
327
- const D = w(!1), b = E(() => [
328
- ..._.catalogs.map((e) => ({
329
- id: e._id,
330
- name: e.name,
331
- taxes: e.inclusiveTaxes || null,
332
- doc: e,
333
- disableDelete: !1,
334
- defaultOrderFrom: e.defaultOrderFrom
335
- }))
336
- ].map((e) => {
337
- var g;
338
- const a = K(((g = e.doc) == null ? void 0 : g._id) || null), p = e.doc ? Oe.getSellingItem(e.doc, _.state.menu) : _.state.menu.modules.item;
339
- return {
340
- ...e,
341
- taxMode: e.taxes ? "Manual" : "Automatic",
342
- autoLink: e.defaultOrderFrom !== x.F_ORDER_FROM.enum.NONE ? "Activated" : "Deactivated",
343
- restaurants: ae(a, { selector: "name" }),
344
- totalProducts: p.length,
345
- disableDelete: e.disableDelete
346
- };
347
- })), z = (t) => {
348
- _.selectCatalog(t === He ? null : t), B.push({
349
- name: oe.EDIT_CATALOG_PRODUCT,
350
- params: { id: t }
351
- });
352
- };
353
- async function Y(t) {
354
- const e = _.state.restaurants.filter(
355
- (a) => [
356
- ...a.additionalCatalogs,
357
- a.inHouseDelivery,
358
- ...a.linkedDeliveryCatalogs.map((p) => p.catalog),
359
- a.pickupCatalog,
360
- a.takeawayCatalog,
361
- a.catalogId
362
- ].includes(t.id)
363
- ).map((a) => a.name);
364
- e.length > 0 ? I.open({
365
- type: "error",
366
- message: `Catalog used by ${e} restaurants`
367
- }) : F.open({
368
- title: "Remove catalog",
369
- message: `Are you sure to remove ${t.name}?`,
370
- primaryActions: {
371
- text: "Remove",
372
- close: !0,
373
- variant: G.Destructive
374
- },
375
- secondaryActions: {
376
- text: "Cancel",
377
- close: !0
378
- }
379
- }).onPrimary(async () => {
380
- await P.updateMenu(
381
- {
382
- module: x.F_MENU_MODULE_V4_KEY.enum.catalog,
383
- operation: de.F_OPERATION_TYPE.delete,
384
- data: t.id
385
- },
386
- t.name,
387
- !0
388
- ), _.selectCatalog(null), await B.push({
389
- name: oe.CATALOG
390
- });
391
- });
392
- }
393
- const j = w([
394
- {
395
- accessorKey: "name",
396
- header: "Catalog title",
397
- enableSorting: !1
398
- },
399
- {
400
- accessorKey: "taxMode",
401
- header: "Tax calculation",
402
- enableSorting: !1
403
- },
404
- {
405
- accessorKey: "autoLink",
406
- header: "Auto link item",
407
- enableSorting: !1,
408
- cell: (t) => {
409
- const e = t.row.original;
410
- return Z(
411
- "div",
412
- {
413
- class: "flex justify-between"
414
- },
415
- [
416
- e.autoLink,
417
- Z(pe.FmIcon, {
418
- name: "delete",
419
- outline: !0,
420
- color: "neutral-gray-400",
421
- onClick: ee(async () => {
422
- await Y(e);
423
- }, ["stop", "prevent"])
424
- })
425
- ]
426
- );
427
- }
428
- }
429
- ]), H = Ae(), i = E(() => H.breakpoints.value.xs);
430
- return (t, e) => {
431
- const a = m("fm-button"), p = m("FmTable"), g = m("FmButton"), k = m("fm-card-header"), S = m("fm-card-section"), O = m("fm-card"), T = m("fm-side-sheet");
432
- return u(), C(xe, { heading: "Catalog" }, {
433
- "append-heading": c(() => [
434
- b.value.length > 0 ? (u(), C(s(ne), { key: 0 }, {
435
- default: c(({ trigger: o }) => [
436
- d("div", {
437
- class: q([["xs:fixed xs:z-10 xs:bottom-[68px] xs:right-16"], "ml-auto xs:ml-0 flex flex-row gap-8"])
438
- }, [
439
- r(a, {
440
- label: "Catalog usage",
441
- onClick: e[0] || (e[0] = (U) => D.value = !0),
442
- variant: "secondary"
443
- }),
444
- r(a, {
445
- label: "Add catalog",
446
- "prepend-icon": "add",
447
- onClick: o
448
- }, null, 8, ["onClick"])
449
- ])
450
- ]),
451
- _: 1
452
- })) : $("", !0)
453
- ]),
454
- default: c(() => [
455
- b.value.length === 0 ? (u(), C(s(Ce), {
456
- key: 0,
457
- subtitle: "Organize your menu with a catalog. Add products, set prices, and customize for dine-in, takeout, or delivery.",
458
- title: "Build your menu catalog"
459
- }, {
460
- action: c(() => [
461
- r(s(ne), null, {
462
- default: c(({ trigger: o }) => [
463
- r(a, {
464
- label: "Add catalog",
465
- "prepend-icon": "add",
466
- onClick: o
467
- }, null, 8, ["onClick"])
468
- ]),
469
- _: 1
470
- })
471
- ]),
472
- _: 1
473
- })) : (u(), v(A, { key: 1 }, [
474
- i.value ? (u(), v("div", $e, [
475
- (u(!0), v(A, null, L(b.value, (o) => (u(), v("div", {
476
- key: o.id,
477
- class: "flex flex-row py-12 px-16",
478
- onClick: (U) => z(o.id)
479
- }, [
480
- d("div", Ie, [
481
- d("p", Pe, " Tax calculation: " + M(o.taxMode), 1),
482
- d("p", Be, " Auto link product: " + M(o.autoLink), 1),
483
- d("p", ze, M(o.name), 1)
484
- ]),
485
- r(g, {
486
- "text-color": s(W).NeutralGray400,
487
- variant: s(G).Tertiary,
488
- "prepend-icon": "delete",
489
- onClick: ee((U) => Y(o), ["stop"])
490
- }, null, 8, ["text-color", "variant", "onClick"])
491
- ], 8, we))), 128))
492
- ])) : (u(), C(ke, { key: 0 }, {
493
- default: c(() => [
494
- r(p, {
495
- "column-defs": j.value,
496
- "row-data": b.value,
497
- "page-size": b.value.length,
498
- "hide-footer": !0,
499
- "shrink-at": !1,
500
- onRowClick: e[1] || (e[1] = (o) => z(o.original.id))
501
- }, null, 8, ["column-defs", "row-data", "page-size"])
502
- ]),
503
- _: 1
504
- })),
505
- r(T, {
506
- modelValue: D.value,
507
- "onUpdate:modelValue": e[2] || (e[2] = (o) => D.value = o),
508
- "max-width": 560,
509
- "z-index": 80
510
- }, {
511
- "side-sheet-header": c(() => e[3] || (e[3] = [
512
- d("p", { class: "fm-typo-en-title-md-600" }, "Catalog usage", -1)
513
- ])),
514
- default: c(() => [
515
- d("div", Ye, [
516
- (u(!0), v(A, null, L(b.value, (o, U) => (u(), C(O, {
517
- key: U,
518
- class: "relative",
519
- variant: "outlined"
520
- }, {
521
- default: c(() => [
522
- r(k, {
523
- subtitle: `Tax calculation: ${o.taxMode} (${o.totalProducts} products)`,
524
- title: o.name
525
- }, null, 8, ["subtitle", "title"]),
526
- r(S, {
527
- class: q(["pt-8 space-y-12", "divide-y divide-fm-color-neutral-gray-100"])
528
- }, {
529
- default: c(() => [
530
- (u(!0), v(A, null, L(o.restaurants, (l, h) => (u(), v("div", {
531
- key: h,
532
- class: q([
533
- "flex xs:flex-col",
534
- "space-x-24 xs:space-x-0",
535
- "xs:space-y-24",
536
- "pt-12 first:pt-0"
537
- ])
538
- }, [
539
- d("div", Ge, [
540
- e[4] || (e[4] = d("p", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Restaurant", -1)),
541
- d("p", Ke, M(l.name), 1)
542
- ]),
543
- d("div", je, [
544
- e[5] || (e[5] = d("p", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Usage", -1)),
545
- (u(!0), v(A, null, L(l.usage, (f) => (u(), v("p", {
546
- key: f,
547
- class: "fm-typo-cn-body-lg-600"
548
- }, M(f), 1))), 128))
549
- ])
550
- ]))), 128))
551
- ]),
552
- _: 2
553
- }, 1024)
554
- ]),
555
- _: 2
556
- }, 1024))), 128))
557
- ])
558
- ]),
559
- _: 1
560
- }, 8, ["modelValue"])
561
- ], 64))
562
- ]),
563
- _: 1
564
- });
565
- };
566
- }
567
- });
568
- export {
569
- ot as default
570
- };