@feedmepos/mf-menu 0.31.17 → 0.31.18-prod

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 (60) hide show
  1. package/dist/{App-C0zWv8Bb.js → App-CA9Sl2_e.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BlBfa-ly.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DXC06G_p.js} +2 -2
  3. package/dist/Catalog-DO0Z3SSz.js +666 -0
  4. package/dist/{Category-BTpAWhsI.js → Category-B1kXrXpy.js} +5 -5
  5. package/dist/{Category-CxDoeXi_.js → Category-DTh_5WI5.js} +4 -4
  6. package/dist/{CookingGuide-C87lhZ67.js → CookingGuide-eHhSbisd.js} +3 -3
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-BEKiJBLy.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-DKGEMS0s.js} +1 -1
  8. package/dist/{Group-D1kUgRjF.js → Group-Bd61FXOa.js} +3 -3
  9. package/dist/{Group-Dad3CsPD.js → Group-Dh5RNyxf.js} +1 -1
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-C-AS_gUD.js → Group.vue_vue_type_script_setup_true_lang-p3ZeU8Ad.js} +7 -7
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Dz9BUoZe.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CuR3HOn4.js} +3 -3
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-BfZuETkY.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-BjwTTR43.js} +6 -6
  13. package/dist/{Ingredient-CL0V9EvP.js → Ingredient-BLfFgX0g.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-BFTt-8OI.js → InventoryBinding.vue_vue_type_script_setup_true_lang-C2f4oQV_.js} +2 -2
  15. package/dist/{LinkProductSideSheet-CWMNlFCF.js → LinkProductSideSheet-DPIxXikN.js} +1 -1
  16. package/dist/{MenuSetting-DA35bTTq.js → MenuSetting-UVUYswl1.js} +4 -4
  17. package/dist/{PrintRoute-B49FDrP6.js → PrintRoute-B4WpCa5j.js} +3 -3
  18. package/dist/{Product-CBGfSsYA.js → Product-DMqUEuUP.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-B3kyqD2S.js → Product.vue_vue_type_script_setup_true_lang-DvqDdaNh.js} +11 -11
  20. package/dist/{ProductInternalTools-DiISILIn.js → ProductInternalTools-BjQILwqA.js} +5 -5
  21. package/dist/{Products-BDvqmjZI.js → Products-BR612MbF.js} +10 -10
  22. package/dist/{Publish-1zBRSD7U.js → Publish-HQprte7i.js} +3 -3
  23. package/dist/{Recipe-D0VAcSN-.js → Recipe-CW8DpUib.js} +4 -4
  24. package/dist/{Scheduler-8BDLlHCV.js → Scheduler-jwxuWWBc.js} +3 -3
  25. package/dist/{ServingSequence-Bh3DhN3i.js → ServingSequence-DILOiy8d.js} +3 -3
  26. package/dist/{Setting-BdSJCn6q.js → Setting-DtHcu5eE.js} +4 -4
  27. package/dist/{Subcategory-CBfEsTKy.js → Subcategory-BuBhmpHK.js} +4 -4
  28. package/dist/{Takeaway-WPQ-ow5H.js → Takeaway-CFH-2jGX.js} +1 -1
  29. package/dist/{Takeaway-aLJ1QKbm.js → Takeaway-Dadg_p4p.js} +4 -4
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-ZYP7hH6p.js → Takeaway.vue_vue_type_script_setup_true_lang-Ccm340Do.js} +5 -5
  31. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-aHMZigPA.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BO_RY7Nb.js} +13 -13
  32. package/dist/{Unit-Csan3-PW.js → Unit-BhC7HKdj.js} +2 -2
  33. package/dist/{Variant-aYCqqz9A.js → Variant-op1jI8lu.js} +3 -3
  34. package/dist/{_id_-BL-Q5Nck.js → _id_-C8aH00wO.js} +9 -9
  35. package/dist/{app-CV3Y87bf.js → app-CgdrcHjA.js} +24 -24
  36. package/dist/{app-CngqdPlx.js → app-DTuhoxK_.js} +1 -1
  37. package/dist/app.js +1 -1
  38. package/dist/apps/mf-menu/src/components/feature/TreeEditor/fmtree/dragging.d.ts +1 -1
  39. package/dist/assets/{linked-status-CQPFAl1J.js → linked-status-DjuegQzl.js} +2 -2
  40. package/dist/assets/{override-menu-DP9T_24q.js → override-menu-SwLrxhgz.js} +2 -2
  41. package/dist/assets/{validate-menu-CcOso72D.js → validate-menu-kf0hkaus.js} +2 -2
  42. package/dist/{catalog-ClQJMV9X.js → catalog-C_ivwYaQ.js} +1 -1
  43. package/dist/{catalogSetting-CXeRg55T.js → catalogSetting-DZueIrzX.js} +1 -1
  44. package/dist/{category-_lR1fIWU.js → category-B3iKQFQ-.js} +1 -1
  45. package/dist/{currency-x_SA4GNt.js → currency-CA5FQbXi.js} +1 -1
  46. package/dist/{dayjs.min-JzYVBtTX.js → dayjs.min-B5JdMy-O.js} +1 -1
  47. package/dist/{index-Cjo_VHIT.js → index-BFdAL_N3.js} +3 -3
  48. package/dist/{index-BaLeGLHZ.js → index-g0Su2v11.js} +2 -2
  49. package/dist/{index-Cb7zxMMe.js → index-jZfKRlag.js} +1 -1
  50. package/dist/{item-E-Egz6v8.js → item-SVoStXDW.js} +14 -14
  51. package/dist/{jszip.min-8UVTn3ZT.js → jszip.min-DYjqumCW.js} +2 -2
  52. package/dist/{menu-CrEs_Qy-.js → menu-CTQtotYO.js} +1 -1
  53. package/dist/{menu-DYMiA6Oc.js → menu-GZ7mL7Mu.js} +5 -5
  54. package/dist/{priceTier-Bs3jL4nk.js → priceTier-D7hqwCP7.js} +1 -1
  55. package/dist/{scheduler-DxMNHPSa.js → scheduler-sOWjTP9q.js} +3 -3
  56. package/dist/{subcategory-h4VL-0kK.js → subcategory-DzOnwchb.js} +37 -37
  57. package/dist/{toExcel-DRJ3j3P7.js → toExcel-CXiBEHW2.js} +2 -2
  58. package/dist/{unit-D4v2m10X.js → unit-CejxJLsQ.js} +1 -1
  59. package/package.json +1 -1
  60. package/dist/Catalog-hTR0c1zS.js +0 -641
@@ -1,641 +0,0 @@
1
- import { defineComponent as oe, computed as S, resolveComponent as v, createBlock as k, openBlock as d, createVNode as n, ref as B, createElementBlock as T, Fragment as z, renderSlot as ye, unref as e, withCtx as p, createElementVNode as _, createCommentVNode as P, renderList as W, createTextVNode as be, toDisplayString as R, h as J, withModifiers as q, normalizeClass as xe } from "vue";
2
- import { useRouter as ke } from "vue-router";
3
- import { u as de, G as F, O as pe, B as ge, A as re, z as Ce, H as ee, J as fe, a9 as ue } from "./menu-DYMiA6Oc.js";
4
- import { useI18n as ne, useCoreStore as ve } from "@feedmepos/mf-common";
5
- import { useSnackbar as _e, components as te, FmButtonVariant as G, FmButtonColorThemeVariant as Q, useDialog as he, useBreakpoints as Oe } from "@feedmepos/ui-library";
6
- import { _ as Fe, R as ie } from "./app-CV3Y87bf.js";
7
- import { _ as Me } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
8
- import { _ as ae } from "./FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js";
9
- import { _ as De } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
10
- import { _ as ce, a as Te } from "./GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Dz9BUoZe.js";
11
- import { c as Se } from "./check-C9mY6LiX.js";
12
- import { C as L, a as I } from "./catalogSetting-CXeRg55T.js";
13
- import { _ as Ve } from "./index.vue_vue_type_script_setup_true_lang-BgqsTzLI.js";
14
- import { _ as Ee } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
15
- import { C as Ue } from "./catalog-ClQJMV9X.js";
16
- const Ae = /* @__PURE__ */ oe({
17
- __name: "CatalogUsageTable",
18
- props: {
19
- catalog: {}
20
- },
21
- setup(X) {
22
- const M = X, {
23
- t: m
24
- } = ne(), D = S(() => M.catalog.restaurants.length === 0 ? [{
25
- name: "--",
26
- usage: []
27
- }] : M.catalog.restaurants), $ = [{
28
- accessorKey: "name",
29
- header: () => n("div", {
30
- class: "flex flex-col"
31
- }, [n("p", null, [M.catalog.name]), n("p", {
32
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400"
33
- }, [m("menu.catalog.usage.tax_calculation") + `: ${M.catalog.taxMode}`])]),
34
- cell: ({
35
- row: y
36
- }) => n("div", {
37
- class: "space-y-4"
38
- }, [n("p", null, [y.original.name]), n("p", {
39
- class: "text-fm-color-typo-secondary"
40
- }, [y.original.id])]),
41
- enableSorting: !1,
42
- meta: {
43
- headerClass: "px-16 py-4"
44
- }
45
- }, {
46
- header: () => n("div", {
47
- class: "w-full flex justify-between"
48
- }, [n("p", null, [m("menu.catalog.usage.usage")]), n(Me, {
49
- label: `${m("menu.catalog.usage.products", {
50
- count: M.catalog.totalProducts
51
- })}`,
52
- variant: "info",
53
- class: "px-8 py-4"
54
- }, null)]),
55
- accessorKey: "usage",
56
- cell: ({
57
- row: y
58
- }) => {
59
- const C = y.original.usage.join(", ") || "--";
60
- return n("p", {
61
- class: "flex py-8"
62
- }, [C]);
63
- },
64
- enableSorting: !1,
65
- meta: {
66
- headerClass: "px-16 py-4"
67
- }
68
- }];
69
- return (y, C) => {
70
- const V = v("FmTable");
71
- return d(), k(V, {
72
- "column-defs": $,
73
- "row-data": D.value,
74
- "page-size": D.value.length,
75
- "hide-footer": !0,
76
- "shrink-at": !1
77
- }, null, 8, ["row-data", "page-size"]);
78
- };
79
- }
80
- }), Ne = { class: "space-y-32" }, Re = {
81
- key: 0,
82
- class: "pl-32 space-x-8"
83
- }, $e = { class: "pl-[60px] space-y-16" }, we = { class: "space-x-16 flex items-center" }, Le = { class: "flex-1 space-y-4" }, Ie = { class: "fm-typo-en-body-lg-400" }, Pe = { class: "fm-typo-en-body-md-400" }, Be = { class: "flex gap-8 items-center justify-start" }, ze = /* @__PURE__ */ oe({
84
- __name: "Form",
85
- setup(X, { expose: M }) {
86
- const m = B(!1), D = B(!1), $ = (i, s) => {
87
- Se.isBoolean(i) ? m.value = i : m.value = !m.value, m.value && (r.value = L.fromCatalog(
88
- s ?? re.generator.initMenuV4Catalog(),
89
- y.value
90
- ));
91
- }, y = S(() => C.version === F.F_MENU_VERSION.enum.v4), C = de(), V = ve(), g = pe(ge(_e())), r = B(
92
- L.fromCatalog(re.generator.initMenuV4Catalog(), y.value)
93
- ), Z = S(() => C.catalogs.map((i) => i.name)), E = S({
94
- get: () => r.value.taxSetting,
95
- set: (i) => {
96
- r.value.taxSetting = i;
97
- }
98
- }), w = S(() => {
99
- var f, o;
100
- if (!V.currentCountry.value) return [];
101
- const i = ((f = r.value.taxSetting) == null ? void 0 : f.mode) === I.MANUAL ? ((o = r.value.taxSetting) == null ? void 0 : o.inclusive) ?? [] : [];
102
- return Ce.Country.getCountry(V.currentCountry.value).taxSystems.map((l) => {
103
- const a = i.find((b) => b.systemCode === l.code);
104
- return {
105
- inclusive: (a == null ? void 0 : a.inclusive) || !1,
106
- systemCode: l.code
107
- };
108
- });
109
- });
110
- function U(i) {
111
- const s = r.value.taxSetting, f = s.mode === I.AUTO ? L.manualTax(w.value) : ee(s);
112
- f.inclusive ?? (f.inclusive = []);
113
- const o = f.inclusive.findIndex((l) => l.systemCode === i.systemCode);
114
- o < 0 ? f.inclusive.push(i) : f.inclusive.splice(o, 1, i), E.value = f;
115
- }
116
- function K(i, s) {
117
- const f = ee(r.value);
118
- f.markupOptions && (f.markupOptions[i] = s, r.value = f);
119
- }
120
- function j(i) {
121
- const s = ee(r.value);
122
- s.markupOptions && (s.markupOptions.splice(i, 1), r.value = s);
123
- }
124
- async function Y() {
125
- D.value = !0;
126
- const i = {
127
- ...r.value,
128
- ...L.toCatalog(r.value)
129
- };
130
- try {
131
- await g.updateMenu(
132
- {
133
- module: F.F_MENU_MODULE_V4_KEY.enum.catalog,
134
- operation: fe.F_OPERATION_TYPE.create,
135
- data: i
136
- },
137
- i.name
138
- ), m.value = !1;
139
- } finally {
140
- D.value = !1;
141
- }
142
- }
143
- const { t: u } = ne();
144
- return M({ trigger: $ }), (i, s) => {
145
- const f = v("fm-text-field"), o = v("fm-radio"), l = v("fm-radio-group"), a = v("fm-checkbox"), b = v("fm-switch"), A = v("fm-select"), x = v("fm-button"), c = v("fm-chip"), O = v("fm-card"), H = v("fm-side-sheet");
146
- return d(), T(z, null, [
147
- ye(i.$slots, "default", { trigger: $ }),
148
- n(H, {
149
- modelValue: m.value,
150
- "onUpdate:modelValue": s[8] || (s[8] = (t) => m.value = t),
151
- "is-container": e(te).FmForm,
152
- "is-container-props": {
153
- onValidationSuccess: Y,
154
- blameFormChildOnValidationFailed: !0
155
- },
156
- "max-width": 560
157
- }, {
158
- "side-sheet-footer": p(() => [
159
- _("div", Be, [
160
- n(x, {
161
- loading: D.value,
162
- label: e(u)("menu.common.actions.add"),
163
- size: "lg",
164
- type: "submit",
165
- variant: "primary"
166
- }, null, 8, ["loading", "label"]),
167
- n(x, {
168
- label: e(u)("menu.common.actions.cancel"),
169
- size: "lg",
170
- variant: "tertiary",
171
- onClick: s[7] || (s[7] = () => m.value = !1)
172
- }, null, 8, ["label"])
173
- ])
174
- ]),
175
- default: p(() => [
176
- _("div", Ne, [
177
- n(De, {
178
- title: e(u)("menu.catalog.detail")
179
- }, {
180
- default: p(() => [
181
- n(f, {
182
- modelValue: r.value.name,
183
- "onUpdate:modelValue": s[0] || (s[0] = (t) => r.value.name = t),
184
- rules: [
185
- (t) => !Z.value.includes(t.trim()) || e(u)("menu.catalog.validation.name_used"),
186
- (t) => !!t || e(u)("menu.catalog.validation.name_required")
187
- ],
188
- autofocus: "",
189
- label: e(u)("menu.catalog.form.name")
190
- }, null, 8, ["modelValue", "rules", "label"]),
191
- n(ae, {
192
- label: e(u)("menu.catalog.form.tax.title")
193
- }, {
194
- default: p(() => {
195
- var t, N;
196
- return [
197
- n(l, {
198
- "model-value": (t = r.value.taxSetting) == null ? void 0 : t.mode,
199
- "onUpdate:modelValue": s[1] || (s[1] = (h) => {
200
- h === e(I).AUTO ? E.value = e(L).autoTax() : E.value = e(L).manualTax(w.value);
201
- })
202
- }, {
203
- default: p(() => [
204
- n(o, {
205
- value: e(I).AUTO,
206
- label: e(u)("menu.catalog.form.tax.auto.label"),
207
- sublabel: e(u)("menu.catalog.form.tax.auto.sublabel"),
208
- class: "pl-4"
209
- }, null, 8, ["value", "label", "sublabel"]),
210
- n(o, {
211
- value: e(I).MANUAL,
212
- label: e(u)("menu.catalog.form.tax.manual.label"),
213
- sublabel: e(u)("menu.catalog.form.tax.manual.sublabel")
214
- }, null, 8, ["value", "label", "sublabel"])
215
- ]),
216
- _: 1
217
- }, 8, ["model-value"]),
218
- ((N = r.value.taxSetting) == null ? void 0 : N.mode) === e(I).MANUAL ? (d(), T("div", Re, [
219
- (d(!0), T(z, null, W(w.value, (h) => (d(), k(a, {
220
- key: h.systemCode,
221
- "model-value": h.inclusive,
222
- value: !0,
223
- label: e(u)("menu.catalog.form.tax.inclusive", { code: h.systemCode }),
224
- "onUpdate:modelValue": (se) => {
225
- U({
226
- ...h,
227
- inclusive: se
228
- });
229
- }
230
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))
231
- ])) : P("", !0)
232
- ];
233
- }),
234
- _: 1
235
- }, 8, ["label"])
236
- ]),
237
- _: 1
238
- }, 8, ["title"]),
239
- y.value ? (d(), k(ae, {
240
- key: 0,
241
- label: e(u)("menu.catalog.form.link.title")
242
- }, {
243
- default: p(() => [
244
- n(b, {
245
- "model-value": r.value.orderFrom && r.value.orderFrom !== e(F.F_ORDER_FROM).enum.NONE,
246
- label: e(u)("menu.catalog.form.link.auto_link.label"),
247
- "label-placement": "right",
248
- sublabel: e(u)("menu.catalog.form.link.auto_link.sublabel"),
249
- "onUpdate:modelValue": s[2] || (s[2] = (t) => r.value.orderFrom = t ? e(F.F_ORDER_FROM).enum.ALL : e(F.F_ORDER_FROM).enum.NONE)
250
- }, null, 8, ["model-value", "label", "sublabel"]),
251
- r.value.orderFrom !== e(F.F_ORDER_FROM).enum.NONE ? (d(), k(A, {
252
- key: 0,
253
- class: "ml-[60px]",
254
- items: [
255
- {
256
- label: e(u)("menu.catalog.form.link.options.all"),
257
- value: e(F.F_ORDER_FROM).enum.ALL
258
- },
259
- {
260
- label: e(u)("menu.catalog.form.link.options.pos_only"),
261
- value: e(F.F_ORDER_FROM).enum.POS_ONLY
262
- }
263
- ],
264
- "model-value": r.value.orderFrom,
265
- "onUpdate:modelValue": s[3] || (s[3] = (t) => r.value.orderFrom = t)
266
- }, null, 8, ["items", "model-value"])) : P("", !0)
267
- ]),
268
- _: 1
269
- }, 8, ["label"])) : P("", !0),
270
- y.value ? (d(), k(ae, {
271
- key: 1,
272
- label: e(u)("menu.catalog.form.markup.title")
273
- }, {
274
- default: p(() => [
275
- n(b, {
276
- "model-value": !!r.value.markupOptions,
277
- label: e(u)("menu.catalog.form.markup.auto.label"),
278
- "label-placement": "right",
279
- sublabel: e(u)("menu.catalog.form.markup.auto.sublabel"),
280
- "onUpdate:modelValue": s[4] || (s[4] = (t) => r.value.markupOptions = t ? [] : null)
281
- }, null, 8, ["model-value", "label", "sublabel"]),
282
- _("div", $e, [
283
- n(ce, {
284
- categories: e(C).categories,
285
- items: e(C).items,
286
- action: "add",
287
- "onUpdate:modelValue": s[5] || (s[5] = (t) => t && (r.value.markupOptions = [...r.value.markupOptions ?? [], t]))
288
- }, {
289
- default: p(({ trigger: t }) => [
290
- n(x, {
291
- "text-color": e(Q).ColorPrimary,
292
- "border-color": e(Q).ColorPrimary,
293
- variant: e(G).Secondary,
294
- label: e(u)("menu.catalog.form.markup.add"),
295
- "prepend-icon": "add",
296
- onClick: t
297
- }, null, 8, ["text-color", "border-color", "variant", "label", "onClick"])
298
- ]),
299
- _: 1
300
- }, 8, ["categories", "items"]),
301
- (d(!0), T(z, null, W(r.value.markupOptions, (t, N) => (d(), k(ce, {
302
- key: N,
303
- categories: e(C).categories,
304
- items: e(C).items,
305
- "model-value": t,
306
- action: "update",
307
- "onUpdate:modelValue": (h) => h && K(N, h)
308
- }, {
309
- default: p(({ trigger: h }) => [
310
- n(O, {
311
- id: JSON.stringify(t),
312
- class: "py-12 px-16 cursor-pointer",
313
- variant: "outlined",
314
- onClick: h
315
- }, {
316
- default: p(() => [
317
- _("div", we, [
318
- _("div", Le, [
319
- n(c, { class: "text-fm-color-typo-info bg-fm-color-system-info-100 font-semibold" }, {
320
- default: p(() => [
321
- be(R(e(u)("menu.catalog.form.markup.percentage", { value: t.percentage })), 1)
322
- ]),
323
- _: 2
324
- }, 1024),
325
- _("p", Ie, R(e(u)("menu.catalog.form.markup.config", { number: N + 1 })), 1),
326
- _("p", Pe, R(t.includeItems ? e(u)("menu.catalog.form.markup.products", {
327
- count: t.includeItems.length
328
- }) : e(u)("menu.catalog.form.markup.all_items")), 1)
329
- ]),
330
- n(x, {
331
- variant: e(G).Tertiary,
332
- "prepend-icon": "delete",
333
- onClick: (se) => j(N)
334
- }, null, 8, ["variant", "onClick"])
335
- ])
336
- ]),
337
- _: 2
338
- }, 1032, ["id", "onClick"])
339
- ]),
340
- _: 2
341
- }, 1032, ["categories", "items", "model-value", "onUpdate:modelValue"]))), 128))
342
- ])
343
- ]),
344
- _: 1
345
- }, 8, ["label"])) : P("", !0),
346
- y.value ? (d(), k(Te, {
347
- key: 2,
348
- "model-value": r.value.usePriceTiers,
349
- "onUpdate:modelValue": s[6] || (s[6] = (t) => r.value.usePriceTiers = t || null)
350
- }, null, 8, ["model-value"])) : P("", !0)
351
- ])
352
- ]),
353
- _: 1
354
- }, 8, ["modelValue", "is-container", "is-container-props"])
355
- ], 64);
356
- };
357
- }
358
- }), me = ze, Ge = {
359
- key: 1,
360
- class: "flex flex-col overflow-scroll divide-y divide-fm-color-neutral-gray-100"
361
- }, Ke = ["onClick"], je = {
362
- class: "flex-1 space-y-4"
363
- }, Ye = {
364
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
365
- }, He = {
366
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
367
- }, Je = {
368
- class: "fm-typo-en-body-lg-600"
369
- }, qe = {
370
- class: "flex flex-row"
371
- }, We = {
372
- class: "fm-typo-en-title-md-600"
373
- }, Qe = {
374
- class: "space-y-24"
375
- }, le = "main", pa = /* @__PURE__ */ oe({
376
- __name: "Catalog",
377
- setup(X) {
378
- const M = ve(), m = de(), D = _e(), $ = ge(D), y = he(), C = pe($), V = ke(), {
379
- t: g
380
- } = ne();
381
- function r(o, l) {
382
- var x, c, O, H;
383
- const a = M.restaurants.value.find(({
384
- _id: t
385
- }) => t === l._id), b = [...l.linkedDeliveryCatalogs.map((t) => ({
386
- label: `Delivery (${t.name})`,
387
- selector: t.catalog
388
- })), {
389
- label: "Delivery (FoodPanda integration)",
390
- selector: (x = a == null ? void 0 : a.foodpandaDelivery) == null ? void 0 : x.catalogId
391
- }, {
392
- label: "Delivery (GrabFood integration)",
393
- selector: (c = a == null ? void 0 : a.grabfoodDelivery) == null ? void 0 : c.catalogId
394
- }, {
395
- label: "Delivery (ShopeeFood integration)",
396
- selector: (O = a == null ? void 0 : a.shopeefoodDelivery) == null ? void 0 : O.catalogId
397
- }];
398
- return [{
399
- label: "Dine-in",
400
- selector: l.catalogId
401
- }, {
402
- label: "Takeaway",
403
- selector: l.takeawayCatalog || l.catalogId
404
- }, {
405
- label: "Pickup",
406
- selector: l.pickupCatalog || null
407
- }, {
408
- label: "Additional",
409
- selector: l.additionalCatalogs
410
- }, {
411
- label: "Delivery (In house)",
412
- selector: l.inHouseDelivery
413
- }, {
414
- label: "Delivery (Feedme express)",
415
- selector: (H = a == null ? void 0 : a.feedmeDelivery) == null ? void 0 : H.catalogId
416
- }, ...ue(b, {
417
- selector: "label"
418
- })].filter((t) => o ? Array.isArray(t.selector) ? t.selector.includes(o) : t.selector === o : t.selector === null).map((t) => t.label);
419
- }
420
- function Z(o) {
421
- return m.state.restaurants.map((l) => ({
422
- id: l._id,
423
- name: l.name,
424
- usage: r(o, l)
425
- })).filter((l) => l.usage.length > 0);
426
- }
427
- const E = B(!1), w = S(() => {
428
- var l;
429
- return [{
430
- id: le,
431
- name: g("menu.catalog.main"),
432
- taxes: ((l = m.state.menu.masterCatalogSetting) == null ? void 0 : l.inclusiveTaxes) || null,
433
- doc: null,
434
- disableDelete: !0,
435
- defaultOrderFrom: null
436
- }, ...m.catalogs.map((a) => ({
437
- id: a._id,
438
- name: a.name,
439
- taxes: a.inclusiveTaxes || null,
440
- doc: a,
441
- disableDelete: !1,
442
- defaultOrderFrom: a.defaultOrderFrom
443
- }))].map((a) => {
444
- var x;
445
- const b = Z(((x = a.doc) == null ? void 0 : x._id) || null), A = a.doc ? Ue.getSellingItem(a.doc, m.state.menu) : m.state.menu.modules.item;
446
- return {
447
- ...a,
448
- taxMode: a.taxes ? "Manual" : "Automatic",
449
- autoLink: a.defaultOrderFrom !== F.F_ORDER_FROM.enum.NONE ? "Activated" : "Deactivated",
450
- restaurants: ue(b, {
451
- selector: "name"
452
- }),
453
- totalProducts: A.length,
454
- disableDelete: a.disableDelete
455
- };
456
- });
457
- }), U = S(() => w.value.filter((o) => o.id !== le)), K = (o) => {
458
- m.selectCatalog(o === le ? null : o), V.push({
459
- name: ie.EDIT_CATALOG_PRODUCT,
460
- params: {
461
- id: o
462
- }
463
- });
464
- }, j = B(null);
465
- function Y(o) {
466
- var l;
467
- (l = j.value) == null || l.trigger(null, {
468
- ...o.doc,
469
- name: `${o.name} copy`
470
- });
471
- }
472
- async function u(o) {
473
- const l = m.state.restaurants.filter((a) => [...a.additionalCatalogs, a.inHouseDelivery, ...a.linkedDeliveryCatalogs.map((b) => b.catalog), a.pickupCatalog, a.takeawayCatalog, a.catalogId].includes(o.id)).map((a) => a.name);
474
- l.length > 0 ? D.open({
475
- type: "error",
476
- message: g("menu.catalog.dialogs.remove.error", {
477
- restaurants: l
478
- })
479
- }) : y.open({
480
- title: g("menu.catalog.dialogs.remove.title"),
481
- message: g("menu.catalog.dialogs.remove.message", {
482
- name: o.name
483
- }),
484
- primaryActions: {
485
- text: g("menu.common.actions.remove"),
486
- close: !0,
487
- variant: G.Destructive
488
- },
489
- secondaryActions: {
490
- text: g("menu.common.actions.cancel"),
491
- close: !0
492
- }
493
- }).onPrimary(async () => {
494
- await C.updateMenu({
495
- module: F.F_MENU_MODULE_V4_KEY.enum.catalog,
496
- operation: fe.F_OPERATION_TYPE.delete,
497
- data: o.id
498
- }, o.name, !0), m.selectCatalog(null), await V.push({
499
- name: ie.CATALOG
500
- });
501
- });
502
- }
503
- const i = B([{
504
- accessorKey: "name",
505
- header: () => g("menu.catalog.table.columns.title"),
506
- enableSorting: !1
507
- }, {
508
- accessorKey: "taxMode",
509
- header: () => g("menu.catalog.table.columns.tax_calculation"),
510
- enableSorting: !1
511
- }, {
512
- accessorKey: "autoLink",
513
- header: () => g("menu.catalog.table.columns.auto_link"),
514
- enableSorting: !1,
515
- cell: (o) => {
516
- const l = o.row.original;
517
- return J("div", {
518
- class: "flex justify-between"
519
- }, [l.autoLink]);
520
- }
521
- }, {
522
- id: "actions",
523
- size: 52,
524
- meta: {
525
- cellClass: "pl-16",
526
- headerContentClass: "-mx-16"
527
- },
528
- header: "",
529
- cell: (o) => {
530
- const l = o.row.original;
531
- return J("div", {
532
- class: "flex justify-end"
533
- }, [J(te.FmButton, {
534
- icon: "file_copy",
535
- disabled: !l.id,
536
- variant: "tertiary",
537
- textColor: "neutral-gray-400",
538
- onClick: q(async () => {
539
- await Y(l);
540
- }, ["stop", "prevent"])
541
- }), J(te.FmButton, {
542
- icon: "delete",
543
- disabled: !l.id,
544
- variant: "tertiary",
545
- textColor: "neutral-gray-400",
546
- onClick: q(async () => {
547
- await u(l);
548
- }, ["stop", "prevent"])
549
- })]);
550
- }
551
- }]), s = Oe(), f = S(() => s.breakpoints.value.xs);
552
- return (o, l) => {
553
- const a = v("fm-button"), b = v("FmTable"), A = v("FmButton"), x = v("fm-side-sheet");
554
- return d(), k(Ee, {
555
- heading: e(g)("menu.catalog.title")
556
- }, {
557
- "append-heading": p(() => [U.value.length > 0 ? (d(), k(e(me), {
558
- key: 0,
559
- ref_key: "createCatalogManagerFormRef",
560
- ref: j
561
- }, {
562
- default: p(({
563
- trigger: c
564
- }) => [_("div", {
565
- class: xe([["xs:fixed xs:z-10 xs:bottom-[68px] xs:right-16"], "ml-auto xs:ml-0 flex flex-row gap-8"])
566
- }, [n(a, {
567
- label: e(g)("menu.catalog.actions.view_usage"),
568
- onClick: l[0] || (l[0] = (O) => E.value = !0),
569
- variant: "secondary"
570
- }, null, 8, ["label"]), n(a, {
571
- label: e(g)("menu.catalog.actions.add"),
572
- "prepend-icon": "add",
573
- onClick: c
574
- }, null, 8, ["label", "onClick"])])]),
575
- _: 1
576
- }, 512)) : P("", !0)]),
577
- default: p(() => [U.value.length === 0 ? (d(), k(e(Ve), {
578
- key: 0,
579
- subtitle: e(g)("menu.catalog.empty.subtitle"),
580
- title: e(g)("menu.catalog.empty.title")
581
- }, {
582
- action: p(() => [n(e(me), null, {
583
- default: p(({
584
- trigger: c
585
- }) => [n(a, {
586
- label: e(g)("menu.catalog.actions.add"),
587
- "prepend-icon": "add",
588
- onClick: c
589
- }, null, 8, ["label", "onClick"])]),
590
- _: 1
591
- })]),
592
- _: 1
593
- }, 8, ["subtitle", "title"])) : (d(), T(z, {
594
- key: 1
595
- }, [f.value ? (d(), T("div", Ge, [(d(!0), T(z, null, W(U.value, (c) => (d(), T("div", {
596
- key: c.id,
597
- class: "flex flex-row py-12 px-16 items-center",
598
- onClick: (O) => K(c.id)
599
- }, [_("div", je, [_("p", Ye, " Tax calculation: " + R(c.taxMode), 1), _("p", He, " Auto link product: " + R(c.autoLink), 1), _("p", Je, R(c.name), 1)]), _("div", qe, [n(A, {
600
- "text-color": e(Q).NeutralGray400,
601
- variant: e(G).Tertiary,
602
- "prepend-icon": "file_copy",
603
- onClick: q((O) => Y(c), ["stop"])
604
- }, null, 8, ["text-color", "variant", "onClick"]), n(A, {
605
- "text-color": e(Q).NeutralGray400,
606
- variant: e(G).Tertiary,
607
- "prepend-icon": "delete",
608
- onClick: q((O) => u(c), ["stop"])
609
- }, null, 8, ["text-color", "variant", "onClick"])])], 8, Ke))), 128))])) : (d(), k(Fe, {
610
- key: 0
611
- }, {
612
- default: p(() => [n(b, {
613
- "column-defs": i.value,
614
- "row-data": U.value,
615
- "page-size": U.value.length,
616
- "hide-footer": !0,
617
- "shrink-at": !1,
618
- onRowClick: l[1] || (l[1] = (c) => K(c.original.id))
619
- }, null, 8, ["column-defs", "row-data", "page-size"])]),
620
- _: 1
621
- })), n(x, {
622
- modelValue: E.value,
623
- "onUpdate:modelValue": l[2] || (l[2] = (c) => E.value = c),
624
- "max-width": 1e3,
625
- "dismiss-away": ""
626
- }, {
627
- "side-sheet-header": p(() => [_("p", We, R(e(g)("menu.catalog.usage.title")), 1)]),
628
- default: p(() => [_("div", Qe, [(d(!0), T(z, null, W(w.value, (c, O) => (d(), k(Ae, {
629
- key: O,
630
- catalog: c
631
- }, null, 8, ["catalog"]))), 128))])]),
632
- _: 1
633
- }, 8, ["modelValue"])], 64))]),
634
- _: 1
635
- }, 8, ["heading"]);
636
- };
637
- }
638
- });
639
- export {
640
- pa as default
641
- };