@feedmepos/mf-menu 0.31.37-beta.1 → 0.31.38-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/{App-JVqsu5i5.js → App-DImB7TmJ.js} +8 -8
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-D8rkiKNx.js → ApplyProduct.vue_vue_type_script_setup_true_lang-CydSm4tS.js} +2 -2
  3. package/dist/Catalog-Bs8xF8l0.js +676 -0
  4. package/dist/{Category-kX2gPfA3.js → Category-CnyXlo8t.js} +5 -5
  5. package/dist/{Category-MV3t6EJk.js → Category-L6hXMCPd.js} +4 -4
  6. package/dist/{CookingGuide-Chj8oHGW.js → CookingGuide-AVGXyKfv.js} +3 -3
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-CPCLRRfh.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-1SDbYGZk.js} +1 -1
  8. package/dist/{Group-BMuw4V73.js → Group-BjIYkJbi.js} +1 -1
  9. package/dist/{Group-FbfSJjbJ.js → Group-CLm4ElT0.js} +3 -3
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-zAQcrQqS.js → Group.vue_vue_type_script_setup_true_lang-DFhbrdW-.js} +7 -7
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-B-QA1Lvn.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-B6cOuL_i.js} +4 -4
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-JGlqXOon.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-BQAbW8xI.js} +7 -7
  13. package/dist/{Ingredient-CUpYZ9sY.js → Ingredient-DbuEA9Ap.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-5cHy0doF.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DJziHpYR.js} +1052 -1052
  15. package/dist/{LinkProductSideSheet-8e0LCQa6.js → LinkProductSideSheet-DFkZOFlG.js} +2 -2
  16. package/dist/{MenuSetting-Bw45wuok.js → MenuSetting-Cr8Thb0S.js} +4 -4
  17. package/dist/{PrintRoute-BZDiS1CH.js → PrintRoute-BlQe3rLl.js} +3 -3
  18. package/dist/{Product-BLR4R5KI.js → Product-CL4dOu2K.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-DJpCLt3x.js → Product.vue_vue_type_script_setup_true_lang-VwawqmeD.js} +12 -12
  20. package/dist/{ProductInternalTools-B6AKoMLJ.js → ProductInternalTools-BReOd2q0.js} +5 -5
  21. package/dist/{Products-Wf78fl4M.js → Products-zHmJbMjn.js} +11 -11
  22. package/dist/{Publish-Bc80fm57.js → Publish-FNg1n8rp.js} +18 -18
  23. package/dist/{Recipe-BnE9m_yt.js → Recipe-CBZEG0UF.js} +4 -4
  24. package/dist/{Scheduler-Cu5pCzJe.js → Scheduler-DXa8VamP.js} +3 -3
  25. package/dist/{ServingSequence-BnfhPEe4.js → ServingSequence-CDJEBJIT.js} +3 -3
  26. package/dist/{Setting-C4GEKR9p.js → Setting-BfmwAEbA.js} +5 -5
  27. package/dist/{Subcategory-DiWL0UvQ.js → Subcategory-uyzqVZaL.js} +4 -4
  28. package/dist/{Takeaway-COyEx9Ru.js → Takeaway-BhWlBH-j.js} +1 -1
  29. package/dist/{Takeaway-CyzYEJhj.js → Takeaway-HmPRnVuF.js} +4 -4
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-B2L5jB7I.js → Takeaway.vue_vue_type_script_setup_true_lang-B1_etaMz.js} +5 -5
  31. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-DG13eZuB.js → Thumbnail.vue_vue_type_script_setup_true_lang-EXn2-zQP.js} +4 -4
  32. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-q1NX8coJ.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Dq3MLZz9.js} +12 -12
  33. package/dist/{Unit-BaDQVQae.js → Unit-I8IsKunR.js} +2 -2
  34. package/dist/{Variant-CnufNMfT.js → Variant-CNI8MGt7.js} +3 -3
  35. package/dist/{_id_-BMu7r1lR.js → _id_-DATov0z0.js} +10 -10
  36. package/dist/{app-C8BfPhyx.js → app-B8iVDfvK.js} +25 -25
  37. package/dist/{app-BdYXB2nV.js → app-Bwva4cJA.js} +1 -1
  38. package/dist/app.js +1 -1
  39. package/dist/apps/mf-menu/src/manager/menu/catalog.d.ts +1 -1
  40. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  41. package/dist/assets/{linked-status-BP7hEYMz.js → linked-status-DydTLbzr.js} +2 -2
  42. package/dist/assets/{override-menu-C54IHXo6.js → override-menu-CyH6M0bf.js} +2 -2
  43. package/dist/assets/{validate-menu-dOfGDX4r.js → validate-menu-RAQvdsXP.js} +2 -2
  44. package/dist/{catalog-DbA_6adn.js → catalog-DgnMKSCs.js} +25 -28
  45. package/dist/{catalogSetting-Bp-b1KRg.js → catalogSetting-D36LAZsZ.js} +1 -1
  46. package/dist/{category-Cc-uCxHx.js → category-CXgCUcAt.js} +1 -1
  47. package/dist/{currency-C9_OiO1D.js → currency-Crv-jHiq.js} +1 -1
  48. package/dist/{dayjs.min-BCQeSvY-.js → dayjs.min-z4r00xnP.js} +1 -1
  49. package/dist/{index-C5qSCjm7.js → index-Bp14bOjn.js} +3 -3
  50. package/dist/{index-B2TsCIP7.js → index-CDjc7iw4.js} +3 -3
  51. package/dist/{index-JhNLC60f.js → index-DVcYqIfa.js} +1 -1
  52. package/dist/{item-DZpy4qYw.js → item-DfftwjB5.js} +15 -15
  53. package/dist/{jszip.min-Dr0OvSAn.js → jszip.min-BxIhQP7P.js} +245 -245
  54. package/dist/{menu-Btv2jW2E.js → menu-CD579Nmq.js} +1 -1
  55. package/dist/{menu-DxjVpyj_.js → menu-lWBbGru3.js} +5 -5
  56. package/dist/{menuV2-BV8HnRYY.js → menuV2-CctLCO2N.js} +47 -47
  57. package/dist/{priceTier-BUBx56Mf.js → priceTier-DATUpeg7.js} +1 -1
  58. package/dist/{scheduler-DWQphf4L.js → scheduler-BlO5fH4a.js} +3 -3
  59. package/dist/{subcategory-vx0cop0o.js → subcategory-DKPGRdmY.js} +2 -2
  60. package/dist/{toExcel-Bt1gnsxz.js → toExcel-BAyyxPBY.js} +2 -2
  61. package/dist/{unit-Cw1iGz1g.js → unit-uVlABwha.js} +2 -2
  62. package/package.json +1 -1
  63. package/dist/Catalog-CmmQPBKA.js +0 -666
@@ -0,0 +1,676 @@
1
+ import { defineComponent as se, computed as x, resolveComponent as _, createBlock as V, openBlock as p, createVNode as o, ref as G, createElementBlock as O, Fragment as K, renderSlot as be, unref as e, withCtx as g, createElementVNode as v, createCommentVNode as z, renderList as X, createTextVNode as xe, toDisplayString as N, markRaw as Ce, toRaw as ke, h as q, withModifiers as Q, normalizeClass as he } from "vue";
2
+ import { useRouter as Oe } from "vue-router";
3
+ import { u as pe, A as M, O as fe, G as ge, D as re, B as Fe, H as le, J as ve, a9 as ie } from "./menu-lWBbGru3.js";
4
+ import { useI18n as ue, useCoreStore as _e } from "@feedmepos/mf-common";
5
+ import { useSnackbar as ye, components as ne, FmButtonVariant as J, FmButtonColorThemeVariant as Z, useDialog as Me, useBreakpoints as Ve } from "@feedmepos/ui-library";
6
+ import { _ as De, R as ce } from "./app-B8iVDfvK.js";
7
+ import { _ as Se } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
8
+ import { a as te } from "./LinkProductSideSheet-DFkZOFlG.js";
9
+ import { _ as Te } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
10
+ import { _ as me, a as Ue } from "./GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-B6cOuL_i.js";
11
+ import { c as we } from "./check-C9mY6LiX.js";
12
+ import { C as B, a as P } from "./catalogSetting-D36LAZsZ.js";
13
+ import { _ as Ee } from "./index.vue_vue_type_script_setup_true_lang-BgqsTzLI.js";
14
+ import { _ as Ae } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
15
+ import { C as Ne } from "./catalog-DgnMKSCs.js";
16
+ const Re = /* @__PURE__ */ se({
17
+ __name: "CatalogUsageTable",
18
+ props: {
19
+ catalog: {}
20
+ },
21
+ setup(ee) {
22
+ const D = ee, {
23
+ t: d
24
+ } = ue(), S = x(() => D.catalog.restaurants.length === 0 ? [{
25
+ name: "--",
26
+ usage: []
27
+ }] : D.catalog.restaurants), R = [{
28
+ accessorKey: "name",
29
+ header: () => o("div", {
30
+ class: "flex flex-col"
31
+ }, [o("p", null, [D.catalog.name]), o("p", {
32
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400"
33
+ }, [d("menu.catalog.usage.tax_calculation") + `: ${D.catalog.taxMode}`])]),
34
+ cell: ({
35
+ row: y
36
+ }) => o("div", {
37
+ class: "space-y-4"
38
+ }, [o("p", null, [y.original.name]), o("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: () => o("div", {
47
+ class: "w-full flex justify-between"
48
+ }, [o("p", null, [d("menu.catalog.usage.usage")]), o(Se, {
49
+ label: `${d("menu.catalog.usage.products", {
50
+ count: D.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 o("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 E = _("FmTable");
71
+ return p(), V(E, {
72
+ "column-defs": R,
73
+ "row-data": S.value,
74
+ "page-size": S.value.length,
75
+ virtual: !0,
76
+ "hide-footer": !0,
77
+ "shrink-at": !1
78
+ }, null, 8, ["row-data", "page-size"]);
79
+ };
80
+ }
81
+ }), Le = { class: "space-y-32" }, $e = {
82
+ key: 0,
83
+ class: "pl-32 space-x-8"
84
+ }, Ie = { class: "pl-[60px] space-y-16" }, Be = { class: "space-x-16 flex items-center" }, Pe = { class: "flex-1 space-y-4" }, ze = { class: "fm-typo-en-body-lg-400" }, Ge = { class: "fm-typo-en-body-md-400" }, Ke = { class: "flex gap-8 items-center justify-start" }, je = /* @__PURE__ */ se({
85
+ __name: "Form",
86
+ setup(ee, { expose: D }) {
87
+ const d = G(!1), S = G(!1), R = (c, u) => {
88
+ we.isBoolean(c) ? d.value = c : d.value = !d.value, d.value && (r.value = B.fromCatalog(
89
+ u ?? re.generator.initMenuV4Catalog(),
90
+ y.value
91
+ ));
92
+ }, y = x(() => C.version === M.F_MENU_VERSION.enum.v4), C = pe(), E = _e(), m = fe(ge(ye())), r = G(
93
+ B.fromCatalog(re.generator.initMenuV4Catalog(), y.value)
94
+ ), ae = x(() => C.catalogs.map((c) => c.name)), j = x({
95
+ get: () => r.value.taxSetting,
96
+ set: (c) => {
97
+ r.value.taxSetting = c;
98
+ }
99
+ }), Y = x(() => {
100
+ var f, k;
101
+ if (!E.currentCountry.value) return [];
102
+ const c = ((f = r.value.taxSetting) == null ? void 0 : f.mode) === P.MANUAL ? ((k = r.value.taxSetting) == null ? void 0 : k.inclusive) ?? [] : [];
103
+ return Fe.Country.getCountry(E.currentCountry.value).taxSystems.map((w) => {
104
+ const A = c.find(($) => $.systemCode === w.code);
105
+ return {
106
+ inclusive: (A == null ? void 0 : A.inclusive) || !1,
107
+ systemCode: w.code
108
+ };
109
+ });
110
+ });
111
+ function L(c) {
112
+ const u = r.value.taxSetting, f = u.mode === P.AUTO ? B.manualTax(Y.value) : le(u);
113
+ f.inclusive ?? (f.inclusive = []);
114
+ const k = f.inclusive.findIndex((w) => w.systemCode === c.systemCode);
115
+ k < 0 ? f.inclusive.push(c) : f.inclusive.splice(k, 1, c), j.value = f;
116
+ }
117
+ function U(c, u) {
118
+ const f = le(r.value);
119
+ f.markupOptions && (f.markupOptions[c] = u, r.value = f);
120
+ }
121
+ function W(c) {
122
+ const u = le(r.value);
123
+ u.markupOptions && (u.markupOptions.splice(c, 1), r.value = u);
124
+ }
125
+ async function H() {
126
+ S.value = !0;
127
+ const c = {
128
+ ...r.value,
129
+ ...B.toCatalog(r.value)
130
+ };
131
+ try {
132
+ await m.updateMenu(
133
+ {
134
+ module: M.F_MENU_MODULE_V4_KEY.enum.catalog,
135
+ operation: ve.F_OPERATION_TYPE.create,
136
+ data: c
137
+ },
138
+ c.name
139
+ ), d.value = !1;
140
+ } finally {
141
+ S.value = !1;
142
+ }
143
+ }
144
+ const { t: i } = ue();
145
+ return D({ trigger: R }), (c, u) => {
146
+ const f = _("fm-text-field"), k = _("fm-radio"), w = _("fm-radio-group"), A = _("fm-checkbox"), $ = _("fm-switch"), s = _("fm-select"), a = _("fm-button"), l = _("fm-chip"), F = _("fm-card"), I = _("fm-side-sheet");
147
+ return p(), O(K, null, [
148
+ be(c.$slots, "default", { trigger: R }),
149
+ o(I, {
150
+ modelValue: d.value,
151
+ "onUpdate:modelValue": u[8] || (u[8] = (t) => d.value = t),
152
+ "is-container": e(ne).FmForm,
153
+ "is-container-props": {
154
+ onValidationSuccess: H,
155
+ blameFormChildOnValidationFailed: !0
156
+ },
157
+ "max-width": 560
158
+ }, {
159
+ "side-sheet-footer": g(() => [
160
+ v("div", Ke, [
161
+ o(a, {
162
+ loading: S.value,
163
+ label: e(i)("menu.common.actions.add"),
164
+ size: "lg",
165
+ type: "submit",
166
+ variant: "primary"
167
+ }, null, 8, ["loading", "label"]),
168
+ o(a, {
169
+ label: e(i)("menu.common.actions.cancel"),
170
+ size: "lg",
171
+ variant: "tertiary",
172
+ onClick: u[7] || (u[7] = () => d.value = !1)
173
+ }, null, 8, ["label"])
174
+ ])
175
+ ]),
176
+ default: g(() => [
177
+ v("div", Le, [
178
+ o(Te, {
179
+ title: e(i)("menu.catalog.detail")
180
+ }, {
181
+ default: g(() => [
182
+ o(f, {
183
+ modelValue: r.value.name,
184
+ "onUpdate:modelValue": u[0] || (u[0] = (t) => r.value.name = t),
185
+ rules: [
186
+ (t) => !ae.value.includes(t.trim()) || e(i)("menu.catalog.validation.name_used"),
187
+ (t) => !!t || e(i)("menu.catalog.validation.name_required")
188
+ ],
189
+ autofocus: "",
190
+ label: e(i)("menu.catalog.form.name")
191
+ }, null, 8, ["modelValue", "rules", "label"]),
192
+ o(te, {
193
+ label: e(i)("menu.catalog.form.tax.title")
194
+ }, {
195
+ default: g(() => {
196
+ var t, b;
197
+ return [
198
+ o(w, {
199
+ "model-value": (t = r.value.taxSetting) == null ? void 0 : t.mode,
200
+ "onUpdate:modelValue": u[1] || (u[1] = (n) => {
201
+ n === e(P).AUTO ? j.value = e(B).autoTax() : j.value = e(B).manualTax(Y.value);
202
+ })
203
+ }, {
204
+ default: g(() => [
205
+ o(k, {
206
+ value: e(P).AUTO,
207
+ label: e(i)("menu.catalog.form.tax.auto.label"),
208
+ sublabel: e(i)("menu.catalog.form.tax.auto.sublabel")
209
+ }, null, 8, ["value", "label", "sublabel"]),
210
+ o(k, {
211
+ value: e(P).MANUAL,
212
+ label: e(i)("menu.catalog.form.tax.manual.label"),
213
+ sublabel: e(i)("menu.catalog.form.tax.manual.sublabel")
214
+ }, null, 8, ["value", "label", "sublabel"])
215
+ ]),
216
+ _: 1
217
+ }, 8, ["model-value"]),
218
+ ((b = r.value.taxSetting) == null ? void 0 : b.mode) === e(P).MANUAL ? (p(), O("div", $e, [
219
+ (p(!0), O(K, null, X(Y.value, (n) => (p(), V(A, {
220
+ key: n.systemCode,
221
+ "model-value": n.inclusive,
222
+ value: !0,
223
+ label: e(i)("menu.catalog.form.tax.inclusive", { code: n.systemCode }),
224
+ "onUpdate:modelValue": (h) => {
225
+ L({
226
+ ...n,
227
+ inclusive: h
228
+ });
229
+ }
230
+ }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128))
231
+ ])) : z("", !0)
232
+ ];
233
+ }),
234
+ _: 1
235
+ }, 8, ["label"])
236
+ ]),
237
+ _: 1
238
+ }, 8, ["title"]),
239
+ y.value ? (p(), V(te, {
240
+ key: 0,
241
+ label: e(i)("menu.catalog.form.link.title")
242
+ }, {
243
+ default: g(() => [
244
+ o($, {
245
+ "model-value": r.value.orderFrom && r.value.orderFrom !== e(M.F_ORDER_FROM).enum.NONE,
246
+ label: e(i)("menu.catalog.form.link.auto_link.label"),
247
+ "label-placement": "right",
248
+ sublabel: e(i)("menu.catalog.form.link.auto_link.sublabel"),
249
+ "onUpdate:modelValue": u[2] || (u[2] = (t) => r.value.orderFrom = t ? e(M.F_ORDER_FROM).enum.ALL : e(M.F_ORDER_FROM).enum.NONE)
250
+ }, null, 8, ["model-value", "label", "sublabel"]),
251
+ r.value.orderFrom !== e(M.F_ORDER_FROM).enum.NONE ? (p(), V(s, {
252
+ key: 0,
253
+ class: "ml-[60px]",
254
+ items: [
255
+ {
256
+ label: e(i)("menu.catalog.form.link.options.all"),
257
+ value: e(M.F_ORDER_FROM).enum.ALL
258
+ },
259
+ {
260
+ label: e(i)("menu.catalog.form.link.options.pos_only"),
261
+ value: e(M.F_ORDER_FROM).enum.POS_ONLY
262
+ }
263
+ ],
264
+ "model-value": r.value.orderFrom,
265
+ "onUpdate:modelValue": u[3] || (u[3] = (t) => r.value.orderFrom = t)
266
+ }, null, 8, ["items", "model-value"])) : z("", !0)
267
+ ]),
268
+ _: 1
269
+ }, 8, ["label"])) : z("", !0),
270
+ y.value ? (p(), V(te, {
271
+ key: 1,
272
+ label: e(i)("menu.catalog.form.markup.title")
273
+ }, {
274
+ default: g(() => [
275
+ o($, {
276
+ "model-value": !!r.value.markupOptions,
277
+ label: e(i)("menu.catalog.form.markup.auto.label"),
278
+ "label-placement": "right",
279
+ sublabel: e(i)("menu.catalog.form.markup.auto.sublabel"),
280
+ "onUpdate:modelValue": u[4] || (u[4] = (t) => r.value.markupOptions = t ? [] : null)
281
+ }, null, 8, ["model-value", "label", "sublabel"]),
282
+ v("div", Ie, [
283
+ o(me, {
284
+ categories: e(C).categories,
285
+ items: e(C).items,
286
+ action: "add",
287
+ "onUpdate:modelValue": u[5] || (u[5] = (t) => t && (r.value.markupOptions = [...r.value.markupOptions ?? [], t]))
288
+ }, {
289
+ default: g(({ trigger: t }) => [
290
+ o(a, {
291
+ "text-color": e(Z).ColorPrimary,
292
+ "border-color": e(Z).ColorPrimary,
293
+ variant: e(J).Secondary,
294
+ label: e(i)("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
+ (p(!0), O(K, null, X(r.value.markupOptions, (t, b) => (p(), V(me, {
302
+ key: b,
303
+ categories: e(C).categories,
304
+ items: e(C).items,
305
+ "model-value": t,
306
+ action: "update",
307
+ "onUpdate:modelValue": (n) => n && U(b, n)
308
+ }, {
309
+ default: g(({ trigger: n }) => [
310
+ o(F, {
311
+ id: JSON.stringify(t),
312
+ class: "py-12 px-16 cursor-pointer",
313
+ variant: "outlined",
314
+ onClick: n
315
+ }, {
316
+ default: g(() => [
317
+ v("div", Be, [
318
+ v("div", Pe, [
319
+ o(l, { class: "text-fm-color-typo-info bg-fm-color-system-info-100 font-semibold" }, {
320
+ default: g(() => [
321
+ xe(N(e(i)("menu.catalog.form.markup.percentage", { value: t.percentage })), 1)
322
+ ]),
323
+ _: 2
324
+ }, 1024),
325
+ v("p", ze, N(e(i)("menu.catalog.form.markup.config", { number: b + 1 })), 1),
326
+ v("p", Ge, N(t.includeItems ? e(i)("menu.catalog.form.markup.products", {
327
+ count: t.includeItems.length
328
+ }) : e(i)("menu.catalog.form.markup.all_items")), 1)
329
+ ]),
330
+ o(a, {
331
+ variant: e(J).Tertiary,
332
+ "prepend-icon": "delete",
333
+ onClick: (h) => W(b)
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"])) : z("", !0),
346
+ o(Ue, {
347
+ modelValue: r.value,
348
+ "onUpdate:modelValue": u[6] || (u[6] = (t) => r.value = t),
349
+ "is-main-catalog": !1,
350
+ "is-v4": y.value
351
+ }, null, 8, ["modelValue", "is-v4"])
352
+ ])
353
+ ]),
354
+ _: 1
355
+ }, 8, ["modelValue", "is-container", "is-container-props"])
356
+ ], 64);
357
+ };
358
+ }
359
+ }), de = je, Ye = {
360
+ key: 0
361
+ }, He = {
362
+ class: "flex justify-end items-center"
363
+ }, Je = {
364
+ class: "w-[320px]"
365
+ }, We = {
366
+ key: 1,
367
+ class: "flex-1 flex flex-col min-h-0"
368
+ }, qe = {
369
+ class: "p-8"
370
+ }, Qe = {
371
+ class: "flex flex-1 flex-col min-h-0 overflow-scroll divide-y divide-fm-color-neutral-gray-100 pb-64"
372
+ }, Xe = ["onClick"], Ze = {
373
+ class: "flex-1 space-y-4"
374
+ }, ea = {
375
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
376
+ }, aa = {
377
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
378
+ }, la = {
379
+ class: "fm-typo-en-body-lg-600"
380
+ }, ta = {
381
+ class: "flex flex-row"
382
+ }, oa = {
383
+ class: "fm-typo-en-title-md-600"
384
+ }, na = {
385
+ key: 0,
386
+ class: "space-y-24"
387
+ }, oe = "main", Ca = /* @__PURE__ */ se({
388
+ __name: "Catalog",
389
+ setup(ee) {
390
+ const D = _e(), d = pe(), S = ye(), R = ge(S), y = Me(), C = fe(R), E = Oe(), {
391
+ t: m
392
+ } = ue(), r = x(() => {
393
+ const s = {};
394
+ return D.restaurants.value.forEach((a) => {
395
+ s[a._id] = a;
396
+ }), s;
397
+ }), ae = x(() => new Map(d.state.menu.modules.item.map((s) => [s._id, s])));
398
+ function j(s, a) {
399
+ var t, b, n, h;
400
+ const l = r.value[a._id], F = [...a.linkedDeliveryCatalogs.map((T) => ({
401
+ label: `Delivery (${T.name})`,
402
+ selector: T.catalog
403
+ })), {
404
+ label: "Delivery (FoodPanda integration)",
405
+ selector: (t = l == null ? void 0 : l.foodpandaDelivery) == null ? void 0 : t.catalogId
406
+ }, {
407
+ label: "Delivery (GrabFood integration)",
408
+ selector: (b = l == null ? void 0 : l.grabfoodDelivery) == null ? void 0 : b.catalogId
409
+ }, {
410
+ label: "Delivery (ShopeeFood integration)",
411
+ selector: (n = l == null ? void 0 : l.shopeefoodDelivery) == null ? void 0 : n.catalogId
412
+ }];
413
+ return [{
414
+ label: "Dine-in",
415
+ selector: a.catalogId
416
+ }, {
417
+ label: "Takeaway",
418
+ selector: a.takeawayCatalog || a.catalogId
419
+ }, {
420
+ label: "Pickup",
421
+ selector: a.pickupCatalog || null
422
+ }, {
423
+ label: "Additional",
424
+ selector: a.additionalCatalogs
425
+ }, {
426
+ label: "Delivery (In house)",
427
+ selector: a.inHouseDelivery
428
+ }, {
429
+ label: "Delivery (Feedme express)",
430
+ selector: (h = l == null ? void 0 : l.feedmeDelivery) == null ? void 0 : h.catalogId
431
+ }, ...ie(F, {
432
+ selector: "label"
433
+ })].filter((T) => s ? Array.isArray(T.selector) ? T.selector.includes(s) : T.selector === s : T.selector === null).map((T) => T.label);
434
+ }
435
+ function Y(s) {
436
+ return d.state.restaurants.map((a) => ({
437
+ id: a._id,
438
+ name: a.name,
439
+ usage: j(s, a)
440
+ })).filter((a) => a.usage.length > 0);
441
+ }
442
+ const L = G(!1), U = G(""), W = x(() => {
443
+ var a;
444
+ return [{
445
+ id: oe,
446
+ name: m("menu.catalog.main"),
447
+ taxes: ((a = d.state.menu.masterCatalogSetting) == null ? void 0 : a.inclusiveTaxes) || null,
448
+ doc: null,
449
+ disableDelete: !0,
450
+ defaultOrderFrom: null
451
+ }, ...d.catalogs.map((l) => ({
452
+ id: l._id,
453
+ name: l.name,
454
+ taxes: l.inclusiveTaxes || null,
455
+ // Use markRaw + toRaw to avoid making a giant proxy while preventing Vue from
456
+ // trying to wrap it again. Object.freeze on a reactive proxy caused runtime
457
+ // errors with read-only property traps ("get on proxy: property 'override' ...").
458
+ // markRaw ensures the catalog snapshot stays non-reactive here without those errors.
459
+ doc: Ce(ke(l)),
460
+ disableDelete: !1,
461
+ defaultOrderFrom: l.defaultOrderFrom
462
+ }))].map((l) => {
463
+ var t;
464
+ const F = Y(((t = l.doc) == null ? void 0 : t._id) || null), I = l.doc ? Ne.getSellingItem(l.doc, ae.value) : d.state.menu.modules.item;
465
+ return {
466
+ ...l,
467
+ taxMode: l.taxes ? "Manual" : "Automatic",
468
+ autoLink: l.defaultOrderFrom !== M.F_ORDER_FROM.enum.NONE ? "Activated" : "Deactivated",
469
+ restaurants: ie(F, {
470
+ selector: "name"
471
+ }),
472
+ totalProducts: I.length,
473
+ disableDelete: l.disableDelete
474
+ };
475
+ });
476
+ }), H = x(() => W.value.filter((s) => s.id !== oe)), i = x(() => H.value.filter((s) => s.name.toLowerCase().includes(U.value.toLowerCase()))), c = (s) => {
477
+ d.selectCatalog(s === oe ? null : s), E.push({
478
+ name: ce.EDIT_CATALOG_PRODUCT,
479
+ params: {
480
+ id: s
481
+ }
482
+ });
483
+ }, u = G(null);
484
+ function f(s) {
485
+ var a;
486
+ (a = u.value) == null || a.trigger(null, {
487
+ ...s.doc,
488
+ name: `${s.name} copy`
489
+ });
490
+ }
491
+ async function k(s) {
492
+ const a = d.state.restaurants.filter((l) => [...l.additionalCatalogs, l.inHouseDelivery, ...l.linkedDeliveryCatalogs.map((F) => F.catalog), l.pickupCatalog, l.takeawayCatalog, l.catalogId].includes(s.id)).map((l) => l.name);
493
+ a.length > 0 ? S.open({
494
+ type: "error",
495
+ message: m("menu.catalog.dialogs.remove.error", {
496
+ restaurants: a
497
+ })
498
+ }) : y.open({
499
+ title: m("menu.catalog.dialogs.remove.title"),
500
+ message: m("menu.catalog.dialogs.remove.message", {
501
+ name: s.name
502
+ }),
503
+ primaryActions: {
504
+ text: m("menu.common.actions.remove"),
505
+ close: !0,
506
+ variant: J.Destructive
507
+ },
508
+ secondaryActions: {
509
+ text: m("menu.common.actions.cancel"),
510
+ close: !0
511
+ }
512
+ }).onPrimary(async () => {
513
+ await C.updateMenu({
514
+ module: M.F_MENU_MODULE_V4_KEY.enum.catalog,
515
+ operation: ve.F_OPERATION_TYPE.delete,
516
+ data: s.id
517
+ }, s.name, !0), d.selectCatalog(null), await E.push({
518
+ name: ce.CATALOG
519
+ });
520
+ });
521
+ }
522
+ const w = x(() => [{
523
+ accessorKey: "name",
524
+ header: () => m("menu.catalog.table.columns.title"),
525
+ enableSorting: !1
526
+ }, {
527
+ accessorKey: "taxMode",
528
+ header: () => m("menu.catalog.table.columns.tax_calculation"),
529
+ enableSorting: !1
530
+ }, {
531
+ accessorKey: "autoLink",
532
+ header: () => m("menu.catalog.table.columns.auto_link"),
533
+ enableSorting: !1,
534
+ cell: (s) => {
535
+ const a = s.row.original;
536
+ return q("div", {
537
+ class: "flex justify-between"
538
+ }, [a.autoLink]);
539
+ }
540
+ }, {
541
+ id: "actions",
542
+ size: 52,
543
+ meta: {
544
+ cellClass: "pl-16",
545
+ headerContentClass: "-mx-16"
546
+ },
547
+ header: "",
548
+ cell: (s) => {
549
+ const a = s.row.original;
550
+ return q("div", {
551
+ class: "flex justify-end"
552
+ }, [q(ne.FmButton, {
553
+ icon: "file_copy",
554
+ disabled: !a.id,
555
+ variant: "tertiary",
556
+ textColor: "neutral-gray-400",
557
+ onClick: Q(async () => {
558
+ await f(a);
559
+ }, ["stop", "prevent"])
560
+ }), q(ne.FmButton, {
561
+ icon: "delete",
562
+ disabled: !a.id,
563
+ variant: "tertiary",
564
+ textColor: "neutral-gray-400",
565
+ onClick: Q(async () => {
566
+ await k(a);
567
+ }, ["stop", "prevent"])
568
+ })]);
569
+ }
570
+ }]), A = Ve(), $ = x(() => A.breakpoints.value.xs);
571
+ return (s, a) => {
572
+ const l = _("fm-button"), F = _("FmSearch"), I = _("FmTable"), t = _("FmButton"), b = _("fm-side-sheet");
573
+ return p(), V(Ae, {
574
+ heading: e(m)("menu.catalog.title")
575
+ }, {
576
+ "append-heading": g(() => [H.value.length > 0 ? (p(), V(e(de), {
577
+ key: 0,
578
+ ref_key: "createCatalogManagerFormRef",
579
+ ref: u
580
+ }, {
581
+ default: g(({
582
+ trigger: n
583
+ }) => [v("div", {
584
+ class: he([["xs:fixed xs:z-10 xs:bottom-[68px] xs:right-16"], "ml-auto xs:ml-0 flex flex-row gap-8"])
585
+ }, [o(l, {
586
+ label: e(m)("menu.catalog.actions.view_usage"),
587
+ onClick: a[0] || (a[0] = (h) => L.value = !0),
588
+ variant: "secondary"
589
+ }, null, 8, ["label"]), o(l, {
590
+ label: e(m)("menu.catalog.actions.add"),
591
+ "prepend-icon": "add",
592
+ onClick: n
593
+ }, null, 8, ["label", "onClick"])])]),
594
+ _: 1
595
+ }, 512)) : z("", !0)]),
596
+ default: g(() => [H.value.length === 0 ? (p(), V(e(Ee), {
597
+ key: 0,
598
+ subtitle: e(m)("menu.catalog.empty.subtitle"),
599
+ title: e(m)("menu.catalog.empty.title")
600
+ }, {
601
+ action: g(() => [o(e(de), null, {
602
+ default: g(({
603
+ trigger: n
604
+ }) => [o(l, {
605
+ label: e(m)("menu.catalog.actions.add"),
606
+ "prepend-icon": "add",
607
+ onClick: n
608
+ }, null, 8, ["label", "onClick"])]),
609
+ _: 1
610
+ })]),
611
+ _: 1
612
+ }, 8, ["subtitle", "title"])) : (p(), O(K, {
613
+ key: 1
614
+ }, [$.value ? (p(), O("div", We, [v("div", qe, [o(F, {
615
+ autofocus: "",
616
+ modelValue: U.value,
617
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => U.value = n),
618
+ class: "w-full",
619
+ placeholder: e(m)("menu.common.labels.search_placeholder", {
620
+ type: e(m)("menu.catalog.title")
621
+ })
622
+ }, null, 8, ["modelValue", "placeholder"])]), v("div", Qe, [(p(!0), O(K, null, X(i.value, (n) => (p(), O("div", {
623
+ key: n.id,
624
+ class: "flex flex-row py-12 px-16 items-center",
625
+ onClick: (h) => c(n.id)
626
+ }, [v("div", Ze, [v("p", ea, " Tax calculation: " + N(n.taxMode), 1), v("p", aa, " Auto link product: " + N(n.autoLink), 1), v("p", la, N(n.name), 1)]), v("div", ta, [o(t, {
627
+ "text-color": e(Z).NeutralGray400,
628
+ variant: e(J).Tertiary,
629
+ "prepend-icon": "file_copy",
630
+ onClick: Q((h) => f(n), ["stop"])
631
+ }, null, 8, ["text-color", "variant", "onClick"]), o(t, {
632
+ "text-color": e(Z).NeutralGray400,
633
+ variant: e(J).Tertiary,
634
+ "prepend-icon": "delete",
635
+ onClick: Q((h) => k(n), ["stop"])
636
+ }, null, 8, ["text-color", "variant", "onClick"])])], 8, Xe))), 128))])])) : (p(), O("div", Ye, [v("div", He, [v("div", Je, [o(F, {
637
+ modelValue: U.value,
638
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => U.value = n),
639
+ autofocus: "",
640
+ class: "mb-8",
641
+ placeholder: e(m)("menu.common.labels.search_placeholder", {
642
+ type: e(m)("menu.catalog.title")
643
+ })
644
+ }, null, 8, ["modelValue", "placeholder"])])]), o(De, null, {
645
+ default: g(() => [o(I, {
646
+ "column-defs": w.value,
647
+ "row-data": i.value,
648
+ "page-size": i.value.length,
649
+ "hide-footer": !0,
650
+ "shrink-at": !1,
651
+ virtual: !0,
652
+ "search-value": U.value,
653
+ onRowClick: a[2] || (a[2] = (n) => c(n.original.id))
654
+ }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])]),
655
+ _: 1
656
+ })])), o(b, {
657
+ modelValue: L.value,
658
+ "onUpdate:modelValue": a[4] || (a[4] = (n) => L.value = n),
659
+ "max-width": 1e3,
660
+ "dismiss-away": ""
661
+ }, {
662
+ "side-sheet-header": g(() => [v("p", oa, N(e(m)("menu.catalog.usage.title")), 1)]),
663
+ default: g(() => [L.value ? (p(), O("div", na, [(p(!0), O(K, null, X(W.value, (n, h) => (p(), V(Re, {
664
+ key: h,
665
+ catalog: n
666
+ }, null, 8, ["catalog"]))), 128))])) : z("", !0)]),
667
+ _: 1
668
+ }, 8, ["modelValue"])], 64))]),
669
+ _: 1
670
+ }, 8, ["heading"]);
671
+ };
672
+ }
673
+ });
674
+ export {
675
+ Ca as default
676
+ };