@feedmepos/mf-menu-portal 1.0.4-dev.2 → 1.0.4-dev.4

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 (82) hide show
  1. package/dist/{App-DtX4DyDA.js → App-CrpoLCjA.js} +3 -3
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-C9OSr8ft.js → ApplyProduct.vue_vue_type_script_setup_true_lang-Hdsnu29V.js} +1 -1
  3. package/dist/{BindingTable.vue_vue_type_script_setup_true_lang-BJN8ajuD.js → BindingTable.vue_vue_type_script_setup_true_lang-D3CmOOPY.js} +1 -1
  4. package/dist/{Catalog-Dly_r1yA.js → Catalog-VU3HhNro.js} +4 -4
  5. package/dist/{CatalogBinding-CNG4YcVq.js → CatalogBinding-BNATtZEY.js} +3 -3
  6. package/dist/{CatalogEditTabs.vue_vue_type_script_setup_true_lang-Cy2culdR.js → CatalogEditTabs.vue_vue_type_script_setup_true_lang-BmG-xpW4.js} +3 -3
  7. package/dist/CatalogEditor.vue_vue_type_script_setup_true_lang-BFsRDFpj.js +784 -0
  8. package/dist/{CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-4EZ4yM_N.js → CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-Bk4FqVmx.js} +14 -14
  9. package/dist/{Category-Dz1yFYyY.js → Category-DMoXTsfG.js} +5 -5
  10. package/dist/{Category-BS-vFDYy.js → Category-DxjdQ-NN.js} +2 -2
  11. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-B3Ts1O-9.js +847 -0
  12. package/dist/{CookingGuide-CmbvWFgp.js → CookingGuide-DiZZDYD-.js} +5 -5
  13. package/dist/{Group-B7s-vPXb.js → Group-DFR8q-tt.js} +5 -5
  14. package/dist/{Group-BRmWZnHh.js → Group-rzfh_o6r.js} +2 -2
  15. package/dist/GroupList.vue_vue_type_script_setup_true_lang-DiN-wQXX.js +1807 -0
  16. package/dist/Ingredient-DpjGIuH9.js +505 -0
  17. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-CnI80Ojd.js +782 -0
  18. package/dist/{MenuSetting-Ci7V_Jxn.js → MenuSetting-DR-pDSF_.js} +4 -4
  19. package/dist/OrderPacing-JcTuweqF.js +769 -0
  20. package/dist/{OrderPacingFields.vue_vue_type_script_setup_true_lang-NCH-SrZU.js → OrderPacingFields.vue_vue_type_script_setup_true_lang-HwwJ2mGv.js} +2 -2
  21. package/dist/{Preview-BBGNaj1F.js → Preview-BZyun5lZ.js} +1 -1
  22. package/dist/{PriceTierNotice.vue_vue_type_script_setup_true_lang-BXJDpDCm.js → PriceTierNotice.vue_vue_type_script_setup_true_lang-DquqNbE1.js} +1 -1
  23. package/dist/PrintRoute-CzEx2dCt.js +518 -0
  24. package/dist/{Product-DqN0NFUU.js → Product-CQb0n06E.js} +4 -4
  25. package/dist/ProductAttributeFilter.vue_vue_type_script_setup_true_lang-B2KdolJS.js +7931 -0
  26. package/dist/{ProductEditorHost.vue_vue_type_script_setup_true_lang-Fkiw4lZp.js → ProductEditorHost.vue_vue_type_script_setup_true_lang-CBlDEjqF.js} +9 -9
  27. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-D8NQTCLx.js +2011 -0
  28. package/dist/{ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-CNWCT1OB.js → ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-cG47Pu-6.js} +1 -1
  29. package/dist/{ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-BoQ9mVPY.js → ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-0UwUcA2L.js} +800 -749
  30. package/dist/{ProductInternalTools-CC3SWSlT.js → ProductInternalTools-QrBR1nFp.js} +2 -2
  31. package/dist/{ProductInventoryDialog-SAhsVekx.js → ProductInventoryDialog-fV38GO1a.js} +1 -1
  32. package/dist/{ProductInventoryDialog.vue_vue_type_script_setup_true_lang-BB8UIIsW.js → ProductInventoryDialog.vue_vue_type_script_setup_true_lang-Bzb3RrMg.js} +1 -1
  33. package/dist/ProductList.vue_vue_type_script_setup_true_lang-BwKQESr3.js +2765 -0
  34. package/dist/{ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-BMDSkfcn.js → ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-CDYcHXo1.js} +1 -1
  35. package/dist/{Products-Cn6j1DOQ.js → Products-B8tysOAL.js} +3 -3
  36. package/dist/Publish-DTvOvFNa.js +1337 -0
  37. package/dist/Recipe-Ddx31csF.js +388 -0
  38. package/dist/{Scheduler-DlaSVACJ.js → Scheduler-CST5L_cw.js} +314 -254
  39. package/dist/ServingSequence-DYyEZI2S.js +374 -0
  40. package/dist/{Setting-CyCp2uw4.js → Setting-Ip0pGjks.js} +6 -6
  41. package/dist/Subcategory-BIgjzVta.js +459 -0
  42. package/dist/{Takeaway-sVVykWDg.js → Takeaway-CekhGM-m.js} +2 -2
  43. package/dist/{Takeaway-tYHCAXYU.js → Takeaway-aXsPg4JT.js} +5 -5
  44. package/dist/{TakeawayList.vue_vue_type_script_setup_true_lang-CV24v8Zg.js → TakeawayList.vue_vue_type_script_setup_true_lang-CaRR4_j3.js} +4 -4
  45. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CshqYpc9.js +1291 -0
  46. package/dist/Unit-BMW8u0Us.js +424 -0
  47. package/dist/{Variant-BNnR5rLv.js → Variant-CZsrYRMU.js} +5 -5
  48. package/dist/{_id_-a9ZtdjtT.js → _id_-D4swrvNa.js} +3 -3
  49. package/dist/{app-CmElp8cO.js → app-BWwwHsWi.js} +337 -337
  50. package/dist/app.js +1 -1
  51. package/dist/apps/mf-menu/src/app.d.ts +80 -0
  52. package/dist/apps/mf-menu/src/components/PriceTier/LinkPriceTierSection.vue.d.ts +9 -0
  53. package/dist/apps/mf-menu/src/components/Product/BulkCategorySelect.vue.d.ts +37 -0
  54. package/dist/apps/mf-menu/src/components/Product/ProductAttributeFilter.vue.d.ts +11 -1
  55. package/dist/apps/mf-menu/src/components/ProductList.vue.d.ts +2 -2
  56. package/dist/apps/mf-menu/src/components/feature/NestedGroupManager/NestedGroupOverrideSheets.vue.d.ts +27 -0
  57. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesFilter.vue.d.ts +20 -0
  58. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  59. package/dist/assets/{menu-compute-B_wpWLAj.js → menu-compute-D7TdiHt4.js} +4 -4
  60. package/dist/assets/{validate-menu-DjxNxUxH.js → validate-menu-DXppWUVq.js} +2 -2
  61. package/dist/mf-menu-portal.css +1 -1
  62. package/dist/{provide-BJRbSauL.js → provide-CDmXzkhz.js} +67539 -65978
  63. package/dist/{useActionFeedback-89GwO41T.js → useActionFeedback-Dm2HDa_2.js} +1 -1
  64. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-pY-_msnM.js → vuedraggable-CBtQLb_S.js} +140 -139
  65. package/package.json +2 -2
  66. package/dist/CatalogEditor.vue_vue_type_script_setup_true_lang-Byp1db9_.js +0 -484
  67. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-CrHYjrTn.js +0 -797
  68. package/dist/GroupList.vue_vue_type_script_setup_true_lang-CWr52_a-.js +0 -2183
  69. package/dist/Ingredient-BMAlctE4.js +0 -463
  70. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-CR99740r.js +0 -709
  71. package/dist/OrderPacing-Bz5kn6DY.js +0 -698
  72. package/dist/PrintRoute-BnARWdR2.js +0 -473
  73. package/dist/ProductChipSummary.vue_vue_type_script_setup_true_lang-D8DygCBl.js +0 -110
  74. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-DryxrG-x.js +0 -1257
  75. package/dist/ProductList.vue_vue_type_script_setup_true_lang-BDnTs366.js +0 -10353
  76. package/dist/Publish-BPJhG39B.js +0 -1261
  77. package/dist/Recipe-mt1vec5-.js +0 -350
  78. package/dist/ServingSequence-Cr1REWZP.js +0 -336
  79. package/dist/Subcategory-kuB7gYvc.js +0 -412
  80. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Dz-Chgek.js +0 -1213
  81. package/dist/Unit-BSOvZxRy.js +0 -385
  82. package/dist/apps/mf-menu/src/views/MenuManagementEditor/RestaurantAttributesFilter.vue.d.ts +0 -2
@@ -1,797 +0,0 @@
1
- import { defineComponent as Re, computed as F, ref as Y, watch as ae, onMounted as qe, onUnmounted as Pe, openBlock as b, createElementBlock as te, createElementVNode as h, createTextVNode as Se, toDisplayString as A, unref as o, isRef as ye, createVNode as C, createBlock as I, createCommentVNode as H, withCtx as R, shallowRef as q, h as ge, withModifiers as Le, resolveComponent as se, renderSlot as pe, Fragment as He, normalizeClass as Je, withDirectives as Qe, mergeProps as Xe } from "vue";
2
- import { useI18n as Ee } from "@feedmepos/mf-common";
3
- import { components as oe, useDialog as Ye, FmButtonVariant as be } from "@feedmepos/ui-library";
4
- import { _ as Ze } from "./index.vue_vue_type_script_setup_true_lang-CGPDazqs.js";
5
- import { f as ea } from "./ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-CNWCT1OB.js";
6
- import { useAppStore as aa } from "@feedmepos/mf-remy-panel";
7
- import { _ as ta } from "./ListCountTag.vue_vue_type_script_setup_true_lang-0bjk8Aly.js";
8
- import { _ as oa } from "./TranslationLanguageSelector.vue_vue_type_script_setup_true_lang-BJZ6VcrT.js";
9
- import { _ as Ue } from "./FormSection.vue_vue_type_script_setup_true_lang-pY-_msnM.js";
10
- import { _ as la } from "./PageLayout.vue_vue_type_script_setup_true_lang-B3szUH39.js";
11
- import { _ as na } from "./ProductEditorHost.vue_vue_type_script_setup_true_lang-Fkiw4lZp.js";
12
- import { _ as sa } from "./TranslationSideSheet.vue_vue_type_script_setup_true_lang-B0j2PNih.js";
13
- import { u as ra } from "./useActionFeedback-89GwO41T.js";
14
- import { u as Fe } from "./useEditorValidation-Ctef5Bxt.js";
15
- import { b as ia, u as ua } from "./provide-BJRbSauL.js";
16
- import { v as ca } from "./tableSemantics-C9WFO_I_.js";
17
- const da = {
18
- key: 0,
19
- class: "space-y-4"
20
- }, ma = { class: "fm-typo-en-body-lg-600" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, ga = { class: "fm-typo-en-body-lg-600 pb-4" }, pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, fa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ya = /* @__PURE__ */ Re({
21
- __name: "CategoryImageField",
22
- props: {
23
- thumbnailUrl: {},
24
- change: {},
25
- disabled: { type: Boolean }
26
- },
27
- emits: ["select", "clear", "encoding"],
28
- setup(fe, { emit: k }) {
29
- const t = fe, D = k, { t: L } = Ee(), B = aa(), M = F(() => !!B.showRemy), u = Y(t.thumbnailUrl);
30
- let $ = null, g = 0, N = !1, d = !1, V = !1, f = !1;
31
- function y(s) {
32
- f !== s && (f = s, D("encoding", s));
33
- }
34
- function z() {
35
- $ && URL.revokeObjectURL($), $ = null;
36
- }
37
- ae(
38
- () => [t.thumbnailUrl, t.change],
39
- () => {
40
- t.change !== "selected" && (g++, y(!1), N = !1, d = !1, z(), u.value = t.change === "cleared" ? null : t.thumbnailUrl);
41
- }
42
- );
43
- function l(s) {
44
- return new Promise((i, r) => {
45
- const U = URL.createObjectURL(s), m = new Image();
46
- m.onload = () => {
47
- URL.revokeObjectURL(U);
48
- const p = m.naturalWidth, w = m.naturalHeight;
49
- if (!p || !w) {
50
- r(new Error("Empty category image"));
51
- return;
52
- }
53
- const P = Math.max(p, w * 16 / 9), Q = Math.max(w, p * 9 / 16), j = 2e3 / P, G = document.createElement("canvas");
54
- G.width = 2e3, G.height = Math.round(Q * j);
55
- const X = G.getContext("2d");
56
- if (!X) {
57
- r(new Error("Category image canvas unavailable"));
58
- return;
59
- }
60
- const ie = getComputedStyle(document.documentElement).getPropertyValue("--fm-color-neutral-white").trim();
61
- if (!ie) {
62
- r(new Error("Category image theme unavailable"));
63
- return;
64
- }
65
- X.fillStyle = ie, X.fillRect(0, 0, G.width, G.height), X.drawImage(
66
- m,
67
- (P - p) / 2 * j,
68
- (Q - w) / 2 * j,
69
- p * j,
70
- w * j
71
- ), G.toBlob(
72
- (ue) => ue ? i(ue) : r(new Error("Category image encoding failed")),
73
- "image/png"
74
- );
75
- }, m.onerror = () => {
76
- URL.revokeObjectURL(U), r(new Error("Category image could not be read"));
77
- }, m.src = U;
78
- });
79
- }
80
- async function le(s) {
81
- const i = Array.isArray(s) ? s[0] : s;
82
- if (!i || t.disabled) return;
83
- const r = ++g;
84
- y(!0);
85
- try {
86
- const U = await l(i);
87
- if (r !== g) return;
88
- z(), $ = URL.createObjectURL(U), N = !0, d = !1, u.value = $;
89
- } catch {
90
- r === g && y(!1);
91
- }
92
- }
93
- function re(s) {
94
- if (!N && !d || t.disabled || !s.canvas) return;
95
- const i = ++g, { width: r, height: U } = s.canvas;
96
- y(!0), s.canvas.toBlob(
97
- (m) => {
98
- i === g && (m && D("select", {
99
- bytes: m,
100
- contentType: m.type || "image/jpeg",
101
- width: r,
102
- height: U
103
- }), y(!1));
104
- },
105
- "image/jpeg",
106
- 0.75
107
- );
108
- }
109
- function Z() {
110
- g++, y(!1);
111
- }
112
- function T() {
113
- t.disabled || (g++, y(!1), N = !1, d = !1, V = !1, z(), u.value = null, D("clear"));
114
- }
115
- async function J() {
116
- if (t.disabled || !u.value) return;
117
- let s;
118
- try {
119
- const i = await fetch(u.value);
120
- if (i.ok) {
121
- const r = await i.blob();
122
- s = await new Promise((U, m) => {
123
- const p = new FileReader();
124
- p.onload = () => U(String(p.result)), p.onerror = () => m(p.error), p.readAsDataURL(r);
125
- });
126
- }
127
- } catch {
128
- }
129
- V = !0, B.activate({ imageData: s, command: "modifyImage" });
130
- }
131
- function K(s) {
132
- var r;
133
- if (!V || t.disabled) return;
134
- const i = (r = s.detail) == null ? void 0 : r.imageData;
135
- typeof i != "string" || !i || (V = !1, g++, y(!0), N = !0, d = !1, z(), u.value = i);
136
- }
137
- return qe(() => window.addEventListener("apply-image", K)), Pe(() => {
138
- window.removeEventListener("apply-image", K), g++, y(!1), z();
139
- }), (s, i) => u.value ? (b(), te("div", da, [
140
- h("p", ma, [
141
- Se(A(o(L)("menu.common.labels.category_image")) + " ", 1),
142
- h("span", va, A(o(L)("menu.common.labels.optional")), 1)
143
- ]),
144
- h("div", {
145
- class: "relative h-[150px] w-[200px] overflow-hidden rounded-md border-2 border-dashed border-fm-color-neutral-gray-300",
146
- onPointerdown: i[0] || (i[0] = (r) => ye(d) ? d.value = !0 : d = !0),
147
- onWheel: i[1] || (i[1] = (r) => ye(d) ? d.value = !0 : d = !0),
148
- onKeydown: i[2] || (i[2] = (r) => ye(d) ? d.value = !0 : d = !0)
149
- }, [
150
- C(o(ea), {
151
- class: "h-[150px] w-[200px]",
152
- src: u.value,
153
- "stencil-props": { handlers: {}, movable: !1, scalable: !1 },
154
- "stencil-size": { width: 200, height: 150 },
155
- "image-restriction": "stencil",
156
- onChange: re,
157
- onError: Z
158
- }, null, 8, ["src"]),
159
- C(o(oe).FmButton, {
160
- "aria-label": o(L)("menu.category.image.remove"),
161
- disabled: s.disabled,
162
- label: o(L)("menu.category.image.remove"),
163
- class: "!absolute right-12 top-12 z-10 !h-24 !w-24 !rounded-full !p-0",
164
- "bg-color": "neutral-white",
165
- icon: "close",
166
- variant: "tertiary",
167
- onClick: T
168
- }, null, 8, ["aria-label", "disabled", "label"]),
169
- M.value ? (b(), I(o(oe).FmButton, {
170
- key: 0,
171
- "aria-label": o(L)("menu.remy.title"),
172
- disabled: s.disabled,
173
- label: o(L)("menu.remy.title"),
174
- class: "!absolute right-12 top-[44px] z-10 !h-24 !w-24 !rounded-full !p-0",
175
- "bg-color": "neutral-white",
176
- icon: "auto_awesome",
177
- variant: "tertiary",
178
- onClick: J
179
- }, null, 8, ["aria-label", "disabled", "label"])) : H("", !0)
180
- ], 32)
181
- ])) : (b(), I(o(oe).FmDropField, {
182
- key: 1,
183
- accept: ".jpg, .jpeg, .png, .gif, .JPG, .JPEG, .PNG, .GIF",
184
- "content-class": "h-[150px] w-[200px]",
185
- disabled: s.disabled,
186
- onFileUpload: le
187
- }, {
188
- label: R(() => [
189
- h("p", ga, [
190
- Se(A(o(L)("menu.common.labels.category_image")) + " ", 1),
191
- h("span", pa, A(o(L)("menu.common.labels.optional")), 1)
192
- ])
193
- ]),
194
- "accept-text": R(() => [
195
- h("p", fa, A(o(L)("menu.common.file.accepts")), 1)
196
- ]),
197
- _: 1
198
- }, 8, ["disabled"]));
199
- }
200
- }), ba = {
201
- key: 0,
202
- class: "flex-1 flex justify-between gap-8 pl-8"
203
- }, ha = { class: "flex items-center" }, wa = {
204
- key: 1,
205
- class: "flex items-center gap-8 ml-auto"
206
- }, ka = {
207
- key: 0,
208
- class: "text-fm-color-typo-secondary",
209
- role: "alert"
210
- }, _a = {
211
- key: 1,
212
- class: "text-fm-color-typo-secondary"
213
- }, Ca = { class: "w-[320px]" }, xa = { class: "fm-typo-en-title-md-600" }, Sa = { class: "flex flex-col gap-32 h-full min-h-0 py-16" }, La = { class: "flex gap-24 items-center" }, Ua = { class: "text-fm-color-typo-secondary" }, Fa = { class: "flex-1" }, Ra = { class: "flex-1 overflow-hidden min-h-[300px]" }, Pa = { class: "flex gap-8 items-center justify-start" }, qa = /* @__PURE__ */ Re({
214
- __name: "CategoryList",
215
- props: {
216
- sdk: {},
217
- catalogPage: { type: Boolean, default: !1 },
218
- heading: { default: "" }
219
- },
220
- setup(fe) {
221
- const k = fe, { t } = Ee(), D = ia(), L = Ye(), { run: B } = ra(), M = ua(k.sdk.category.list), u = F(
222
- () => M.value.status === "ready" ? M.value.value : null
223
- ), $ = F(() => {
224
- var e;
225
- return ((e = u.value) == null ? void 0 : e.query) ?? "";
226
- }), g = Y(!1), N = Y(0), d = Y(!1), V = Y(""), f = q(
227
- k.sdk.category.editor()
228
- ), y = q(
229
- f.value.get()
230
- );
231
- let z = f.value.subscribe((e) => {
232
- y.value = e;
233
- });
234
- const l = F(
235
- () => y.value.status === "ready" ? y.value.value : null
236
- ), le = Fe(() => f.value), re = F(
237
- () => l.value ? le.issue(l.value.fieldIssues, "name") ?? l.value.nameIssue : null
238
- ), Z = Y(!1), T = q(null), J = q({ status: "loading" });
239
- let K = null;
240
- const s = F(
241
- () => J.value.status === "ready" ? J.value.value : null
242
- ), i = Y(!1), r = q(null), U = Fe(() => r.value), m = q({
243
- status: "loading"
244
- }), p = F(
245
- () => m.value.status === "ready" ? m.value.value : null
246
- );
247
- let w = null, P = null;
248
- function Q() {
249
- var e;
250
- P == null || P(), P = null, (e = r.value) == null || e.dispose(), r.value = null, w == null || w.dispose(), w = null, m.value = { status: "loading" };
251
- }
252
- function j(e, a) {
253
- var n;
254
- P == null || P(), (n = r.value) == null || n.dispose(), r.value = k.sdk.item.editor(e, {
255
- initialCategoryId: a
256
- }), m.value = r.value.get(), P = r.value.subscribe((_) => {
257
- m.value = _;
258
- });
259
- }
260
- function G() {
261
- var a, n;
262
- const e = (a = l.value) == null ? void 0 : a.categoryId;
263
- !e || ((n = l.value) == null ? void 0 : n.products.state) !== "allowed" || (Q(), w = k.sdk.item.editorScope(), j(void 0, e), i.value = !0);
264
- }
265
- function X(e) {
266
- var a;
267
- ((a = l.value) == null ? void 0 : a.products.state) === "allowed" && (Q(), w = k.sdk.item.editorScope(), j(e.id), i.value = !0);
268
- }
269
- function ie(e) {
270
- var n;
271
- const a = ((n = p.value) == null ? void 0 : n.itemId) ?? void 0;
272
- w == null || w.select(e), j(a);
273
- }
274
- async function ue() {
275
- const e = r.value;
276
- if (!e) return;
277
- (await B(
278
- () => U.submit(() => e.submit()),
279
- {
280
- showLoading: () => {
281
- var n;
282
- return ((n = p.value) == null ? void 0 : n.status) === "submitting";
283
- },
284
- successMessage: p.value ? D(p.value.saveMessage) : ""
285
- }
286
- )).kind === "success" && r.value === e && (i.value = !1);
287
- }
288
- function W(e) {
289
- var a;
290
- K == null || K(), K = null, e && ((a = T.value) == null || a.dispose()), T.value = null, J.value = { status: "loading" }, Z.value = !1;
291
- }
292
- function $e() {
293
- var a;
294
- if (((a = l.value) == null ? void 0 : a.translation.state) !== "allowed") return;
295
- W(!0);
296
- const e = f.value.translationEditor();
297
- T.value = e, J.value = e.get(), K = e.subscribe((n) => {
298
- J.value = n;
299
- }), Z.value = !0;
300
- }
301
- function Ve(e) {
302
- var _;
303
- const a = T.value, n = (_ = s.value) == null ? void 0 : _.nameLocale;
304
- if (!(!a || !n)) {
305
- for (const v of Object.keys(n))
306
- v in e || a.removeLocale(v);
307
- for (const [v, x] of Object.entries(e))
308
- v in n || a.addLocale(v), a.setNameLocale(v, x);
309
- }
310
- }
311
- async function Ie() {
312
- const e = T.value;
313
- if (!e) return;
314
- (await B(async () => e.apply(), {
315
- showLoading: !1
316
- })).kind === "success" && W(!1);
317
- }
318
- function he() {
319
- W(!0);
320
- }
321
- function De(e) {
322
- e ? Z.value = !0 : he();
323
- }
324
- function we(e) {
325
- W(!0), z(), f.value.dispose(), f.value = k.sdk.category.editor(e), N.value++, d.value = !1, y.value = f.value.get(), z = f.value.subscribe((a) => {
326
- y.value = a;
327
- });
328
- }
329
- function ke() {
330
- we(), g.value = !0;
331
- }
332
- function Be(e) {
333
- !e.id && !e.isSynthetic || (we(e.isSynthetic ? null : e.id), g.value = !0);
334
- }
335
- function ce() {
336
- W(!0), g.value = !1;
337
- }
338
- function _e() {
339
- var e;
340
- if (!((e = l.value) != null && e.dirty)) {
341
- ce();
342
- return;
343
- }
344
- L.open({
345
- zIndex: 101,
346
- title: t("menu.common.dialog.dismiss.title"),
347
- message: t("menu.common.dialog.dismiss.message"),
348
- primaryActions: {
349
- text: t("menu.common.dialog.dismiss.discard"),
350
- close: !0,
351
- variant: be.Destructive
352
- },
353
- secondaryActions: {
354
- text: t("menu.common.actions.cancel"),
355
- close: !0
356
- }
357
- }).onPrimary(ce);
358
- }
359
- function Me(e) {
360
- e ? g.value = !0 : _e();
361
- }
362
- ae(g, (e) => {
363
- e || W(!0);
364
- }), ae(i, (e) => {
365
- e || Q();
366
- }), ae(y, (e) => {
367
- T.value && (e.status !== "ready" || e.value.translation.state !== "allowed") && W(!0);
368
- });
369
- async function ze() {
370
- var _, v, x;
371
- if (d.value) return;
372
- const e = (_ = l.value) == null ? void 0 : _.mode, a = ((x = (v = l.value) == null ? void 0 : v.name) == null ? void 0 : x.trim()) ?? "";
373
- (await B(
374
- () => le.submit(() => f.value.submit()),
375
- {
376
- successMessage: e === "update" ? t("menu.category.manager.dialog.update.success", { name: a }) : t("menu.category.manager.dialog.add.success", { name: a }),
377
- showLoading: () => {
378
- var O;
379
- return ((O = l.value) == null ? void 0 : O.status) === "submitting";
380
- },
381
- // The approved Storage 403 baseline closes Loading but leaves the image
382
- // preview and sheet open without a settled snackbar.
383
- silentFailureCodes: ["menu.category.image.upload_failed"]
384
- }
385
- )).kind === "success" && ce();
386
- }
387
- function Te(e) {
388
- e.remove.state !== "allowed" || !e.id || L.open({
389
- title: t("menu.category.dialog.remove.title"),
390
- message: t("menu.common.dialog.remove_confirmation", {
391
- name: e.name
392
- }),
393
- primaryActions: {
394
- text: t("menu.common.actions.remove"),
395
- close: !0,
396
- variant: be.Destructive
397
- },
398
- secondaryActions: {
399
- text: t("menu.common.actions.cancel"),
400
- close: !0
401
- }
402
- }).onPrimary(async () => {
403
- await B(() => k.sdk.category.remove(e.id), {
404
- successMessage: t("menu.category.dialog.remove.success", {
405
- name: e.name
406
- })
407
- });
408
- });
409
- }
410
- const je = F(() => {
411
- var e;
412
- return $.value || ((e = u.value) == null ? void 0 : e.reorder.state) !== "allowed" ? () => !1 : (a) => !a.isSynthetic;
413
- }), de = q([]);
414
- ae(
415
- () => {
416
- var e;
417
- return (e = u.value) == null ? void 0 : e.rows;
418
- },
419
- (e) => {
420
- e && (de.value = [...e]);
421
- },
422
- { immediate: !0 }
423
- );
424
- async function Oe(e) {
425
- var v, x, O;
426
- if ($.value || ((v = u.value) == null ? void 0 : v.reorder.state) !== "allowed") return;
427
- const a = e.map((c) => c.id).filter((c) => !!c);
428
- if (a.length === 0) return;
429
- const n = de.value;
430
- (await B(() => k.sdk.category.reorder(a), {
431
- successMessage: ((x = u.value) == null ? void 0 : x.reorderScope) === "catalog" ? t("menu.catalog.saved", { name: t("menu.category.entity") }) : t("menu.category.reorder.success")
432
- })).kind !== "success" && (de.value = [...((O = u.value) == null ? void 0 : O.rows) ?? n]);
433
- }
434
- function Ae(e) {
435
- k.sdk.category.search(e);
436
- }
437
- const Ne = F(() => [
438
- {
439
- accessorKey: "name",
440
- header: () => t("menu.category.columns.title"),
441
- enableSorting: !1,
442
- meta: { width: "auto" },
443
- cell: (e) => e.row.original.nameMessage ? D(e.row.original.nameMessage) : e.row.original.name
444
- },
445
- {
446
- accessorKey: "linkedProductCount",
447
- header: () => t("menu.category.columns.products"),
448
- enableSorting: !1,
449
- size: 200,
450
- // Plural selection is an i18n concern, never a template expression
451
- // (ADR-0003 §3). The legacy table treats zero and one alike.
452
- cell: (e) => t("menu.common.labels.product_linked", {
453
- count: e.row.original.linkedProductCount
454
- })
455
- },
456
- // Catalog scope only changes membership/order. Categories remain master
457
- // entities, so the scoped table deliberately has no destructive action
458
- // column — the legacy editor renders just its two data columns there.
459
- ...k.catalogPage ? [] : [
460
- {
461
- id: "actions",
462
- size: 52,
463
- meta: { cellClass: "pl-16", headerContentClass: "-mx-16" },
464
- header: "",
465
- cell: (e) => {
466
- const a = e.row.original;
467
- return ge("div", { class: "flex justify-end" }, [
468
- ge(oe.FmButton, {
469
- icon: "delete",
470
- disabled: a.remove.state !== "allowed",
471
- variant: "tertiary",
472
- textColor: "neutral-gray-400",
473
- "aria-label": t("menu.category.dialog.remove.title"),
474
- onClick: Le(
475
- () => Te(a),
476
- ["stop", "prevent"]
477
- )
478
- })
479
- ]);
480
- }
481
- }
482
- ]
483
- ]), me = F(() => {
484
- var n;
485
- const e = ((n = l.value) == null ? void 0 : n.productRows) ?? [], a = V.value.trim().toLocaleLowerCase();
486
- return a ? e.filter(
487
- (_) => _.name.toLocaleLowerCase().includes(a) || (_.code ?? "").toLocaleLowerCase().includes(a)
488
- ) : e;
489
- }), ve = q([]);
490
- ae(
491
- me,
492
- (e) => {
493
- ve.value = [...e];
494
- },
495
- { immediate: !0 }
496
- );
497
- const Ke = F(() => {
498
- var e, a;
499
- return me.value.length === 0 ? !1 : V.value || ((e = l.value) == null ? void 0 : e.products.state) !== "allowed" || me.value.length < 2 ? () => !1 : (a = l.value) != null && a.synthetic ? () => !1 : () => !0;
500
- });
501
- async function Ge(e) {
502
- var v, x;
503
- const a = (v = l.value) == null ? void 0 : v.categoryId;
504
- if (!a || V.value || ((x = l.value) == null ? void 0 : x.products.state) !== "allowed")
505
- return;
506
- const n = ve.value;
507
- (await B(
508
- () => k.sdk.item.reorderForCategory(
509
- a,
510
- e.map((O) => O.id)
511
- ),
512
- {
513
- successMessage: t("menu.product.table.bulk_edit.saved", {
514
- count: e.length
515
- })
516
- }
517
- )).kind !== "success" && (ve.value = [...me.value ?? n]);
518
- }
519
- const We = F(() => [
520
- {
521
- accessorKey: "name",
522
- header: () => t("menu.category.products.columns.name"),
523
- enableSorting: !1
524
- },
525
- {
526
- accessorKey: "code",
527
- header: () => t("menu.category.products.columns.code"),
528
- enableSorting: !1
529
- },
530
- {
531
- id: "actions",
532
- size: 52,
533
- meta: { cellClass: "pl-16", headerContentClass: "-mx-16" },
534
- header: "",
535
- cell: (e) => ge("div", { class: "flex justify-end" }, [
536
- ge(oe.FmButton, {
537
- icon: "edit",
538
- variant: be.Tertiary,
539
- textColor: "neutral-gray-400",
540
- "aria-label": t("menu.common.labels.a11y_labelled_name", {
541
- label: t("menu.common.actions.edit"),
542
- name: e.row.original.name
543
- }),
544
- onClick: Le(
545
- () => X(e.row.original),
546
- ["stop", "prevent"]
547
- )
548
- })
549
- ])
550
- }
551
- ]);
552
- return Pe(() => {
553
- k.sdk.category.search(""), W(!0), Q(), z(), f.value.dispose();
554
- }), (e, a) => {
555
- const n = se("FmButton"), _ = se("FmCircularProgress"), v = se("FmSearch"), x = se("FmTable"), O = se("FmSideSheet");
556
- return b(), I(la, {
557
- heading: e.catalogPage ? e.heading : o(t)("menu.category.title")
558
- }, {
559
- "prepend-heading": R(() => [
560
- pe(e.$slots, "prepend-heading")
561
- ]),
562
- "append-heading": R(() => {
563
- var c;
564
- return [
565
- e.catalogPage ? H("", !0) : (b(), te("div", ba, [
566
- h("div", ha, [
567
- C(ta, {
568
- value: ((c = u.value) == null ? void 0 : c.totalCount) ?? 0
569
- }, null, 8, ["value"])
570
- ]),
571
- u.value && u.value.totalCount > 0 ? (b(), I(n, {
572
- key: 0,
573
- disabled: u.value.create.state !== "allowed",
574
- label: o(t)("menu.category.add"),
575
- "prepend-icon": "add",
576
- onClick: ke
577
- }, null, 8, ["disabled", "label"])) : H("", !0)
578
- ])),
579
- e.catalogPage ? (b(), te("div", wa, [
580
- pe(e.$slots, "append-heading")
581
- ])) : pe(e.$slots, "append-heading", { key: 2 })
582
- ];
583
- }),
584
- default: R(() => [
585
- pe(e.$slots, "navigation"),
586
- o(M).status === "error" ? (b(), te("p", ka, A(o(D)(o(M).error.message)), 1)) : o(M).status === "unavailable" ? (b(), te("p", _a, A(o(D)(o(M).reason)), 1)) : o(M).status === "loading" ? (b(), I(_, { key: 2 })) : u.value && u.value.rows.length === 0 && !$.value ? (b(), I(o(Ze), {
587
- key: 3,
588
- action: e.catalogPage ? void 0 : { text: o(t)("menu.category.add"), callback: ke },
589
- subtitle: o(t)("menu.category.empty.subtitle"),
590
- title: o(t)("menu.category.empty.title")
591
- }, null, 8, ["action", "subtitle", "title"])) : u.value ? (b(), te(He, { key: 4 }, [
592
- h("div", {
593
- class: Je(["flex justify-end items-center", { "pt-16": e.catalogPage }])
594
- }, [
595
- h("div", Ca, [
596
- C(v, {
597
- class: "mb-8",
598
- "model-value": $.value,
599
- placeholder: o(t)("menu.common.labels.search_placeholder", {
600
- type: o(t)("menu.category.title")
601
- }),
602
- "onUpdate:modelValue": Ae
603
- }, null, 8, ["model-value", "placeholder"])
604
- ])
605
- ], 2),
606
- Qe(C(x, {
607
- "column-defs": Ne.value,
608
- draggable: je.value,
609
- "page-size": u.value.rows.length,
610
- "row-data": de.value,
611
- "shrink-at": !1,
612
- "hide-footer": "",
613
- "pin-header-row": "",
614
- onDndChanged: Oe,
615
- onRowClick: a[0] || (a[0] = (c) => Be(c.original))
616
- }, null, 8, ["column-defs", "draggable", "page-size", "row-data"]), [
617
- [o(ca), o(t)("menu.category.columns.title")]
618
- ])
619
- ], 64)) : H("", !0),
620
- C(O, {
621
- "model-value": g.value && !i.value,
622
- "is-container": o(oe).FmForm,
623
- "is-container-props": { onValidationSuccess: ze },
624
- "max-width": 560,
625
- "z-index": 100,
626
- "onOn:clickedAway": _e,
627
- "onUpdate:modelValue": Me
628
- }, {
629
- "side-sheet-header": R(() => {
630
- var c, E;
631
- return [
632
- h("p", xa, A((c = l.value) != null && c.synthetic ? o(t)("menu.category.entity") : ((E = l.value) == null ? void 0 : E.mode) === "update" ? o(t)("menu.category.manager.dialog.update.title") : o(t)("menu.category.manager.dialog.add.title")), 1)
633
- ];
634
- }),
635
- "side-sheet-footer": R(() => {
636
- var c, E, ne;
637
- return [
638
- h("div", Pa, [
639
- ((c = l.value) == null ? void 0 : c.submit.state) !== "hidden" ? (b(), I(n, {
640
- key: 0,
641
- disabled: ((E = l.value) == null ? void 0 : E.submit.state) !== "allowed" || d.value,
642
- label: ((ne = l.value) == null ? void 0 : ne.mode) === "update" ? o(t)("menu.common.actions.update") : o(t)("menu.category.manager.dialog.add.action"),
643
- size: "lg",
644
- type: "submit",
645
- variant: "primary"
646
- }, null, 8, ["disabled", "label"])) : H("", !0),
647
- C(n, {
648
- label: o(t)("menu.common.actions.cancel"),
649
- size: "lg",
650
- variant: "tertiary",
651
- onClick: ce
652
- }, null, 8, ["label"])
653
- ])
654
- ];
655
- }),
656
- default: R(() => {
657
- var c, E, ne;
658
- return [
659
- h("div", Sa, [
660
- C(Ue, {
661
- title: o(t)("menu.category.detail")
662
- }, {
663
- default: R(() => {
664
- var S, ee;
665
- return [
666
- C(oa, Xe({
667
- "error-messages": re.value ? [o(D)(re.value)] : [],
668
- label: o(t)("menu.category.name"),
669
- readonly: (S = l.value) == null ? void 0 : S.synthetic,
670
- "model-value": ((ee = l.value) == null ? void 0 : ee.name) ?? ""
671
- }, o(le).field("name", f.value.setName)), {
672
- append: R(() => {
673
- var Ce, xe;
674
- return [
675
- ((Ce = l.value) == null ? void 0 : Ce.translation.state) !== "hidden" ? (b(), I(n, {
676
- key: 0,
677
- "aria-label": o(t)("menu.common.translation.translation_label"),
678
- disabled: ((xe = l.value) == null ? void 0 : xe.translation.state) !== "allowed",
679
- class: "!p-0",
680
- icon: "g_translate",
681
- variant: "tertiary",
682
- onClick: $e
683
- }, null, 8, ["aria-label", "disabled"])) : H("", !0)
684
- ];
685
- }),
686
- _: 1
687
- }, 16, ["error-messages", "label", "readonly", "model-value"])
688
- ];
689
- }),
690
- _: 1
691
- }, 8, ["title"]),
692
- l.value && l.value.image.capability.state !== "hidden" ? (b(), I(ya, {
693
- key: N.value,
694
- "thumbnail-url": ((c = l.value) == null ? void 0 : c.image.thumbnailUrl) ?? null,
695
- change: ((E = l.value) == null ? void 0 : E.image.change) ?? "unchanged",
696
- disabled: ((ne = l.value) == null ? void 0 : ne.image.capability.state) !== "allowed",
697
- onSelect: a[1] || (a[1] = (S) => f.value.setImage(S)),
698
- onClear: a[2] || (a[2] = (S) => f.value.clearImage()),
699
- onEncoding: a[3] || (a[3] = (S) => d.value = S)
700
- }, null, 8, ["thumbnail-url", "change", "disabled"])) : H("", !0),
701
- C(Ue, {
702
- class: "flex-1 min-h-0",
703
- shrinkable: !0,
704
- title: o(t)("menu.category.products.title")
705
- }, {
706
- "append-title": R(() => {
707
- var S;
708
- return [
709
- C(n, {
710
- "border-color": "primary",
711
- disabled: ((S = l.value) == null ? void 0 : S.products.state) !== "allowed",
712
- label: o(t)("menu.category.products.add"),
713
- "prepend-icon": "add",
714
- "text-color": "primary",
715
- variant: "secondary",
716
- onClick: G
717
- }, null, 8, ["disabled", "label"])
718
- ];
719
- }),
720
- default: R(() => {
721
- var S;
722
- return [
723
- h("div", La, [
724
- h("div", Ua, A(o(t)("menu.category.products.linked_count", {
725
- count: ((S = l.value) == null ? void 0 : S.productRows.length) ?? 0
726
- })), 1),
727
- h("div", Fa, [
728
- C(v, {
729
- modelValue: V.value,
730
- "onUpdate:modelValue": a[4] || (a[4] = (ee) => V.value = ee),
731
- placeholder: o(t)("menu.common.actions.search")
732
- }, null, 8, ["modelValue", "placeholder"])
733
- ])
734
- ]),
735
- h("div", Ra, [
736
- C(x, {
737
- "column-defs": We.value,
738
- draggable: Ke.value,
739
- "hide-footer": "",
740
- "pin-header-row": "",
741
- "row-data": ve.value,
742
- "shrink-at": !1,
743
- onDndChanged: Ge,
744
- onRowClick: a[5] || (a[5] = (ee) => X(ee.original))
745
- }, null, 8, ["column-defs", "draggable", "row-data"])
746
- ])
747
- ];
748
- }),
749
- _: 1
750
- }, 8, ["title"])
751
- ])
752
- ];
753
- }),
754
- _: 1
755
- }, 8, ["model-value", "is-container", "is-container-props"]),
756
- C(na, {
757
- open: i.value,
758
- "onUpdate:open": a[6] || (a[6] = (c) => i.value = c),
759
- sdk: e.sdk,
760
- session: r.value,
761
- validation: o(U),
762
- view: p.value,
763
- onSelectScope: ie,
764
- onSubmit: ue
765
- }, null, 8, ["open", "sdk", "session", "validation", "view"]),
766
- s.value ? (b(), I(sa, {
767
- key: 5,
768
- "model-value": Z.value,
769
- dirty: s.value.dirty,
770
- name: s.value.name,
771
- "name-locale": s.value.nameLocale,
772
- "supported-locales": s.value.supportedLocales,
773
- title: o(t)("menu.common.translation.sheet_title", {
774
- entity: o(t)("menu.category.entity")
775
- }),
776
- "name-section-label": o(t)("menu.common.translation.name_section", {
777
- entity: o(t)("menu.category.entity")
778
- }),
779
- "z-index": 200,
780
- onDiscard: he,
781
- onSave: Ie,
782
- "onUpdate:modelValue": De,
783
- "onUpdate:name": a[7] || (a[7] = (c) => {
784
- var E;
785
- return (E = T.value) == null ? void 0 : E.setName(c);
786
- }),
787
- "onUpdate:nameLocale": Ve
788
- }, null, 8, ["model-value", "dirty", "name", "name-locale", "supported-locales", "title", "name-section-label"])) : H("", !0)
789
- ]),
790
- _: 3
791
- }, 8, ["heading"]);
792
- };
793
- }
794
- });
795
- export {
796
- qa as _
797
- };