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