@webx-ui/module-catalog 0.1.0 → 0.2.0
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.
- package/README.md +9 -4
- package/dist/index.js +729 -748
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +7 -7
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { computed as h, ref as D, defineComponent as le, useTemplateRef as Me, onMounted as ie, nextTick as
|
|
1
|
+
import { computed as h, ref as D, defineComponent as le, useTemplateRef as Me, onMounted as ie, nextTick as dt, openBlock as v, createBlock as V, unref as e, isRef as je, withCtx as o, createVNode as _, createElementVNode as G, withKeys as Ke, createTextVNode as W, toDisplayString as k, resolveComponent as Ht, createElementBlock as B, withModifiers as pt, createCommentVNode as M, normalizeClass as Ge, provide as vt, inject as gt, watch as we, onBeforeUnmount as Te, Fragment as ee, renderList as be, useModel as yt, mergeProps as Jt, mergeModels as Xt, reactive as Qt, createSlots as Yt } from "vue";
|
|
2
2
|
import { useRouter as $e, useRoute as ze, onBeforeRouteLeave as mt } from "vue-router";
|
|
3
|
-
import { readCookie as Zt, useAdmin as ae, useTranslate as te, useErrorText as
|
|
4
|
-
import { useModal as Xe, useLocales as Ue, WxDialog as Qe, WxFormItem as
|
|
3
|
+
import { readCookie as Zt, useAdmin as ae, useTranslate as te, useErrorText as ge, rowMenuWidth as Ae, WxListScreen as He, WxRowMenu as Je, provideHistorySubject as ft, provideRecordAddress as ht, useBodyKeys as bt, WxScreenHead as kt, WxScreen as _t, WxSaveState as wt, useRecordAddress as ea, WxDate as xt, WxFilterChips as ta } from "@webx-ui/module-admin";
|
|
4
|
+
import { useModal as Xe, useLocales as Ue, WxDialog as Qe, WxFormItem as ke, WxInput as fe, WxTreeSelect as De, WxSpace as Ye, WxButton as Q, createModal as Ze, WxTable as et, WxBadge as Y, WxText as J, toast as O, confirm as ve, localizedValue as $t, WxSkeleton as xe, WxCard as tt, WxBreadcrumb as Ct, WxBreadcrumbItem as he, WxActionBar as St, WxAlert as We, WxSwitch as Ie, WxSortableList as Pt, WxAction as aa, WxUpload as la, WxSelect as Re, WxDropdown as na, WxDropdownItem as oa, WxIcon as Be, WxProgress as sa, useElementWidth as ra, WxEntityCard as ua, WxTooltip as ia, WxInputNumber as st } from "@webx-ui/core";
|
|
5
5
|
const ca = "catalog";
|
|
6
6
|
function da(n) {
|
|
7
|
-
const
|
|
8
|
-
n.q &&
|
|
9
|
-
for (const [i,
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
else if (Array.isArray(
|
|
13
|
-
for (const
|
|
7
|
+
const a = new URLSearchParams();
|
|
8
|
+
n.q && a.set("q", n.q), n.state && a.set("state", n.state), n.sort && n.sort !== "default" && a.set("sort", n.sort), n.page && n.page > 1 && a.set("page", String(n.page)), n.per_page && a.set("per_page", String(n.per_page));
|
|
9
|
+
for (const [i, m] of Object.entries(n.facets ?? {}))
|
|
10
|
+
if (m === !0)
|
|
11
|
+
a.set(`facets[${i}][]`, "1");
|
|
12
|
+
else if (Array.isArray(m))
|
|
13
|
+
for (const t of m) a.append(`facets[${i}][]`, String(t));
|
|
14
14
|
else
|
|
15
|
-
|
|
16
|
-
return
|
|
15
|
+
m.min != null && a.set(`facets[${i}][min]`, String(m.min)), m.max != null && a.set(`facets[${i}][max]`, String(m.max));
|
|
16
|
+
return a;
|
|
17
17
|
}
|
|
18
|
-
function pa(n,
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
function pa(n, a, i, m) {
|
|
19
|
+
const t = new FormData();
|
|
20
|
+
return t.append("file", i), new Promise((y, r) => {
|
|
21
21
|
const s = new XMLHttpRequest();
|
|
22
|
-
s.open("POST",
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
w.lengthComputable &&
|
|
22
|
+
s.open("POST", a), s.responseType = "json", s.withCredentials = !0, s.setRequestHeader("Accept", "application/json"), s.setRequestHeader("X-Requested-With", "XMLHttpRequest"), s.setRequestHeader("X-Webx-Locale", n.i18n.state.locale);
|
|
23
|
+
const l = Zt("XSRF-TOKEN");
|
|
24
|
+
l && s.setRequestHeader("X-XSRF-TOKEN", l), s.upload.addEventListener("progress", (w) => {
|
|
25
|
+
w.lengthComputable && m?.(Math.round(w.loaded / w.total * 100));
|
|
26
26
|
}), s.addEventListener("load", () => {
|
|
27
27
|
const w = s.response;
|
|
28
28
|
if (s.status >= 200 && s.status < 300 && w?.data) {
|
|
29
|
-
|
|
29
|
+
y(w.data);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
r(
|
|
@@ -35,55 +35,55 @@ function pa(n, t, i, f) {
|
|
|
35
35
|
body: w
|
|
36
36
|
})
|
|
37
37
|
);
|
|
38
|
-
}), s.addEventListener("error", () => r(new Error("Upload failed"))), s.send(
|
|
38
|
+
}), s.addEventListener("error", () => r(new Error("Upload failed"))), s.send(t);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
function ne(n) {
|
|
42
|
-
const
|
|
42
|
+
const a = `${n.apiPath}/${ca}`, i = (t) => t.data, m = (t, y) => y.size > 0 ? `${t}?${y}` : t;
|
|
43
43
|
return {
|
|
44
|
-
products: (
|
|
45
|
-
product: (
|
|
46
|
-
createProduct: (
|
|
47
|
-
saveProduct: (
|
|
48
|
-
removeProduct: (
|
|
44
|
+
products: (t = {}) => n.http.get(m(`${a}/products`, da(t))),
|
|
45
|
+
product: (t) => n.http.get(`${a}/products/${t}`).then(i),
|
|
46
|
+
createProduct: (t) => n.http.post(`${a}/products`, { values: t }).then(i),
|
|
47
|
+
saveProduct: (t, y) => n.http.put(`${a}/products/${t}`, { values: y }).then(i),
|
|
48
|
+
removeProduct: (t) => n.http.delete(`${a}/products/${t}`).then(() => {
|
|
49
49
|
}),
|
|
50
|
-
restoreProduct: (
|
|
51
|
-
addImage: (
|
|
52
|
-
saveImages: (
|
|
53
|
-
images:
|
|
50
|
+
restoreProduct: (t) => n.http.post(`${a}/products/${t}/restore`, {}).then(i),
|
|
51
|
+
addImage: (t, y, r) => typeof y == "string" ? n.http.post(`${a}/products/${t}/images`, { url: y }).then(i) : pa(n, `${a}/products/${t}/images`, y, r),
|
|
52
|
+
saveImages: (t, y) => n.http.put(`${a}/products/${t}/images`, {
|
|
53
|
+
images: y.map(({ id: r, alt: s, title: l }) => ({ id: r, alt: s, title: l }))
|
|
54
54
|
}).then(i),
|
|
55
|
-
removeImage: (
|
|
55
|
+
removeImage: (t, y) => n.http.delete(`${a}/products/${t}/images/${y}`).then(() => {
|
|
56
56
|
}),
|
|
57
|
-
categories: () => n.http.get(`${
|
|
58
|
-
category: (
|
|
59
|
-
createCategory: (
|
|
60
|
-
saveCategory: (
|
|
61
|
-
moveCategory: (
|
|
62
|
-
parent_id:
|
|
57
|
+
categories: () => n.http.get(`${a}/categories`).then(i),
|
|
58
|
+
category: (t) => n.http.get(`${a}/categories/${t}`).then(i),
|
|
59
|
+
createCategory: (t, y) => n.http.post(`${a}/categories`, { values: t, parent_id: y }).then(i),
|
|
60
|
+
saveCategory: (t, y) => n.http.put(`${a}/categories/${t}`, { values: y }).then(i),
|
|
61
|
+
moveCategory: (t, y, r) => n.http.post(`${a}/categories/${t}/move`, {
|
|
62
|
+
parent_id: y,
|
|
63
63
|
before_id: r
|
|
64
64
|
}).then(i),
|
|
65
|
-
removeCategory: (
|
|
65
|
+
removeCategory: (t) => n.http.delete(`${a}/categories/${t}`).then(() => {
|
|
66
66
|
}),
|
|
67
|
-
restoreCategory: (
|
|
68
|
-
facets: () => n.http.get(`${
|
|
69
|
-
bulkActions: () => n.http.get(`${
|
|
70
|
-
startBulk: (
|
|
71
|
-
bulkRun: (
|
|
72
|
-
deleted: ((
|
|
73
|
-
const r = new URLSearchParams({ type:
|
|
74
|
-
return
|
|
67
|
+
restoreCategory: (t) => n.http.post(`${a}/categories/${t}/restore`, {}).then(i),
|
|
68
|
+
facets: () => n.http.get(`${a}/facets`).then((t) => ({ facets: t.data, sorts: t.meta?.sorts ?? [] })),
|
|
69
|
+
bulkActions: () => n.http.get(`${a}/bulk`).then(i),
|
|
70
|
+
startBulk: (t, y, r) => n.http.post(`${a}/bulk`, { action: t, params: y, selection: r }).then(i),
|
|
71
|
+
bulkRun: (t) => n.http.get(`${a}/bulk/${t}`).then(i),
|
|
72
|
+
deleted: ((t, y = {}) => {
|
|
73
|
+
const r = new URLSearchParams({ type: t });
|
|
74
|
+
return y.q && r.set("q", y.q), y.page && y.page > 1 && r.set("page", String(y.page)), y.per_page && r.set("per_page", String(y.per_page)), n.http.get(`${a}/deleted?${r}`);
|
|
75
75
|
})
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function _e(n,
|
|
79
|
-
const i = n[
|
|
78
|
+
function _e(n, a) {
|
|
79
|
+
const i = n[a]?.[0];
|
|
80
80
|
if (i !== void 0) return i;
|
|
81
|
-
const
|
|
82
|
-
return
|
|
81
|
+
const m = Object.keys(n).find((t) => t.startsWith(`${a}.`));
|
|
82
|
+
return m === void 0 ? void 0 : n[m]?.[0];
|
|
83
83
|
}
|
|
84
84
|
const va = {
|
|
85
85
|
module: {
|
|
86
|
-
title: "
|
|
86
|
+
title: "Products",
|
|
87
87
|
group: "Catalog",
|
|
88
88
|
products: "Products",
|
|
89
89
|
categories: "Categories",
|
|
@@ -197,7 +197,7 @@ const va = {
|
|
|
197
197
|
"sku-open-deleted": "Find it in «Deleted»",
|
|
198
198
|
"gallery-add": "Add pictures",
|
|
199
199
|
"gallery-hint": "JPEG, PNG, WebP or GIF. The first picture is the main one.",
|
|
200
|
-
"gallery-url": "
|
|
200
|
+
"gallery-url": "Upload from an address",
|
|
201
201
|
"gallery-url-add": "Fetch",
|
|
202
202
|
"gallery-empty": "No pictures yet.",
|
|
203
203
|
"gallery-main": "Main",
|
|
@@ -250,55 +250,55 @@ const va = {
|
|
|
250
250
|
"column-parent": "Was inside",
|
|
251
251
|
"restore-bare": "Comes back without a category"
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, rt = /* @__PURE__ */ new WeakSet();
|
|
254
254
|
function oe() {
|
|
255
255
|
try {
|
|
256
256
|
const { i18n: n } = ae();
|
|
257
|
-
|
|
257
|
+
rt.has(n) || (n.defaults("webx-catalog", va), rt.add(n));
|
|
258
258
|
} catch {
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
const
|
|
261
|
+
const ut = /* @__PURE__ */ new WeakMap();
|
|
262
262
|
function At(n) {
|
|
263
|
-
let
|
|
264
|
-
return
|
|
263
|
+
let a = ut.get(n);
|
|
264
|
+
return a || (a = {
|
|
265
265
|
tree: { value: D(null), pending: null },
|
|
266
266
|
facets: { value: D(null), pending: null }
|
|
267
|
-
},
|
|
267
|
+
}, ut.set(n, a)), a;
|
|
268
268
|
}
|
|
269
|
-
function Wt(n,
|
|
269
|
+
function Wt(n, a, i) {
|
|
270
270
|
if (!i && n.value.value !== null) return Promise.resolve(n.value.value);
|
|
271
271
|
if (!i && n.pending) return n.pending;
|
|
272
|
-
const
|
|
273
|
-
n.pending ===
|
|
272
|
+
const m = a().then((t) => (n.pending === m && (n.value.value = t), t)).finally(() => {
|
|
273
|
+
n.pending === m && (n.pending = null);
|
|
274
274
|
});
|
|
275
|
-
return n.pending =
|
|
275
|
+
return n.pending = m, m;
|
|
276
276
|
}
|
|
277
277
|
function ye(n) {
|
|
278
|
-
const
|
|
278
|
+
const a = At(n).tree, i = ne(n);
|
|
279
279
|
return {
|
|
280
|
-
nodes:
|
|
281
|
-
load: (
|
|
282
|
-
take: (
|
|
283
|
-
|
|
280
|
+
nodes: a.value,
|
|
281
|
+
load: (m = !1) => Wt(a, () => i.categories(), m),
|
|
282
|
+
take: (m) => {
|
|
283
|
+
a.pending = null, a.value.value = m;
|
|
284
284
|
},
|
|
285
285
|
drop: () => {
|
|
286
|
-
|
|
286
|
+
a.pending = null, a.value.value = null;
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
290
|
function Vt(n) {
|
|
291
|
-
const
|
|
291
|
+
const a = At(n).facets, i = ne(n);
|
|
292
292
|
return {
|
|
293
|
-
facets: h(() =>
|
|
294
|
-
sorts: h(() =>
|
|
293
|
+
facets: h(() => a.value.value?.facets ?? null),
|
|
294
|
+
sorts: h(() => a.value.value?.sorts ?? []),
|
|
295
295
|
load: () => Wt(
|
|
296
|
-
|
|
297
|
-
() => i.facets().then((
|
|
298
|
-
sorts:
|
|
299
|
-
facets:
|
|
300
|
-
...
|
|
301
|
-
kind: String(
|
|
296
|
+
a,
|
|
297
|
+
() => i.facets().then((m) => ({
|
|
298
|
+
sorts: m.sorts,
|
|
299
|
+
facets: m.facets.map((t) => ({
|
|
300
|
+
...t,
|
|
301
|
+
kind: String(t.kind).toLowerCase()
|
|
302
302
|
}))
|
|
303
303
|
})),
|
|
304
304
|
!1
|
|
@@ -306,36 +306,36 @@ function Vt(n) {
|
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
function qe(n) {
|
|
309
|
-
return n.flatMap((
|
|
309
|
+
return n.flatMap((a) => [a, ...qe(a.children ?? [])]);
|
|
310
310
|
}
|
|
311
|
-
function ga(n,
|
|
312
|
-
const i = new Map(qe(n).map((
|
|
313
|
-
let
|
|
314
|
-
for (;
|
|
315
|
-
|
|
316
|
-
return
|
|
311
|
+
function ga(n, a) {
|
|
312
|
+
const i = new Map(qe(n).map((y) => [y.id, y])), m = [];
|
|
313
|
+
let t = i.get(a);
|
|
314
|
+
for (; t; )
|
|
315
|
+
m.push(t), t = t.parent_id === null ? void 0 : i.get(t.parent_id);
|
|
316
|
+
return m;
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const ya = /* @__PURE__ */ le({
|
|
319
319
|
__name: "CategoryCreateDialog",
|
|
320
320
|
props: {
|
|
321
321
|
parent: { default: null }
|
|
322
322
|
},
|
|
323
323
|
setup(n) {
|
|
324
|
-
const
|
|
324
|
+
const a = n, { open: i, resolve: m, dismiss: t } = Xe(), y = ae(), r = ne(y), s = ye(y), l = Ue();
|
|
325
325
|
oe();
|
|
326
|
-
const w = te("webx-catalog"), b = D(""),
|
|
326
|
+
const w = te("webx-catalog"), b = D(""), f = D(a.parent), x = D(!1), C = D({}), P = Me("field"), S = h(() => s.nodes.value ?? []);
|
|
327
327
|
ie(async () => {
|
|
328
328
|
s.load().catch(() => {
|
|
329
|
-
}), await
|
|
329
|
+
}), await dt(), P.value?.querySelector("input")?.focus();
|
|
330
330
|
});
|
|
331
331
|
async function q() {
|
|
332
332
|
if (!(b.value.trim() === "" || x.value)) {
|
|
333
333
|
x.value = !0, C.value = {};
|
|
334
334
|
try {
|
|
335
|
-
const F = typeof
|
|
336
|
-
|
|
335
|
+
const F = typeof f.value == "number" ? f.value : null;
|
|
336
|
+
m(
|
|
337
337
|
await r.createCategory(
|
|
338
|
-
{ name: { [
|
|
338
|
+
{ name: { [l.active.value]: b.value.trim() }, is_published: !1 },
|
|
339
339
|
F
|
|
340
340
|
)
|
|
341
341
|
);
|
|
@@ -346,32 +346,32 @@ const ma = /* @__PURE__ */ le({
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
return (F,
|
|
349
|
+
return (F, E) => (v(), V(e(Qe), {
|
|
350
350
|
open: e(i),
|
|
351
|
-
"onUpdate:open":
|
|
351
|
+
"onUpdate:open": E[3] || (E[3] = (L) => je(i) ? i.value = L : null),
|
|
352
352
|
title: e(w)("panel.new-category"),
|
|
353
353
|
width: 480
|
|
354
354
|
}, {
|
|
355
355
|
footer: o(() => [
|
|
356
|
-
|
|
356
|
+
_(e(Ye), { size: "sm" }, {
|
|
357
357
|
default: o(() => [
|
|
358
|
-
|
|
358
|
+
_(e(Q), {
|
|
359
359
|
variant: "outline",
|
|
360
|
-
onClick:
|
|
360
|
+
onClick: E[2] || (E[2] = (L) => e(t)())
|
|
361
361
|
}, {
|
|
362
362
|
default: o(() => [
|
|
363
|
-
|
|
363
|
+
W(k(e(w)("panel.cancel")), 1)
|
|
364
364
|
]),
|
|
365
365
|
_: 1
|
|
366
366
|
}),
|
|
367
|
-
|
|
367
|
+
_(e(Q), {
|
|
368
368
|
type: "primary",
|
|
369
369
|
loading: x.value,
|
|
370
370
|
disabled: b.value.trim() === "",
|
|
371
371
|
onClick: q
|
|
372
372
|
}, {
|
|
373
373
|
default: o(() => [
|
|
374
|
-
|
|
374
|
+
W(k(e(w)("panel.create")), 1)
|
|
375
375
|
]),
|
|
376
376
|
_: 1
|
|
377
377
|
}, 8, ["loading", "disabled"])
|
|
@@ -380,7 +380,7 @@ const ma = /* @__PURE__ */ le({
|
|
|
380
380
|
})
|
|
381
381
|
]),
|
|
382
382
|
default: o(() => [
|
|
383
|
-
|
|
383
|
+
_(e(ke), {
|
|
384
384
|
label: e(w)("category.name"),
|
|
385
385
|
error: e(_e)(C.value, "name") ?? e(_e)(C.value, "slug"),
|
|
386
386
|
required: ""
|
|
@@ -388,11 +388,11 @@ const ma = /* @__PURE__ */ le({
|
|
|
388
388
|
default: o(() => [
|
|
389
389
|
G("div", {
|
|
390
390
|
ref_key: "field",
|
|
391
|
-
ref:
|
|
391
|
+
ref: P
|
|
392
392
|
}, [
|
|
393
|
-
|
|
393
|
+
_(e(fe), {
|
|
394
394
|
modelValue: b.value,
|
|
395
|
-
"onUpdate:modelValue":
|
|
395
|
+
"onUpdate:modelValue": E[0] || (E[0] = (L) => b.value = L),
|
|
396
396
|
"aria-label": e(w)("category.name"),
|
|
397
397
|
onKeyup: Ke(q, ["enter"])
|
|
398
398
|
}, null, 8, ["modelValue", "aria-label"])
|
|
@@ -400,14 +400,14 @@ const ma = /* @__PURE__ */ le({
|
|
|
400
400
|
]),
|
|
401
401
|
_: 1
|
|
402
402
|
}, 8, ["label", "error"]),
|
|
403
|
-
|
|
403
|
+
_(e(ke), {
|
|
404
404
|
label: e(w)("panel.field-parent"),
|
|
405
405
|
error: e(_e)(C.value, "parent_id")
|
|
406
406
|
}, {
|
|
407
407
|
default: o(() => [
|
|
408
|
-
|
|
409
|
-
modelValue:
|
|
410
|
-
"onUpdate:modelValue":
|
|
408
|
+
_(e(De), {
|
|
409
|
+
modelValue: f.value,
|
|
410
|
+
"onUpdate:modelValue": E[1] || (E[1] = (L) => f.value = L),
|
|
411
411
|
nodes: S.value,
|
|
412
412
|
"node-key": "id",
|
|
413
413
|
"label-key": "name",
|
|
@@ -430,29 +430,29 @@ const ma = /* @__PURE__ */ le({
|
|
|
430
430
|
});
|
|
431
431
|
function Ve(n) {
|
|
432
432
|
if (!n) return null;
|
|
433
|
-
let
|
|
433
|
+
let a;
|
|
434
434
|
try {
|
|
435
|
-
|
|
435
|
+
a = new URL(n, "http://panel.invalid").pathname;
|
|
436
436
|
} catch {
|
|
437
437
|
return null;
|
|
438
438
|
}
|
|
439
|
-
const i =
|
|
439
|
+
const i = a.split("/").filter((m) => m !== "");
|
|
440
440
|
return i.length > 0 ? decodeURIComponent(i[i.length - 1]) : null;
|
|
441
441
|
}
|
|
442
|
-
const
|
|
442
|
+
const ma = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
443
443
|
__name: "CategoriesPage",
|
|
444
444
|
props: {
|
|
445
445
|
base: { default: "/catalog" }
|
|
446
446
|
},
|
|
447
447
|
setup(n) {
|
|
448
|
-
const
|
|
448
|
+
const a = n, i = ae(), m = ne(i), t = ye(i), y = $e();
|
|
449
449
|
oe();
|
|
450
|
-
const r = te("webx-catalog"), s =
|
|
451
|
-
const z =
|
|
452
|
-
return qe(
|
|
450
|
+
const r = te("webx-catalog"), s = ge(), l = D([]), w = D(!0), b = D(!1), f = D(""), x = Ze(ya), C = h(() => i.can("catalog.manage")), P = h(() => i.can("catalog.delete")), S = h(() => f.value.trim() === ""), q = h(() => {
|
|
451
|
+
const z = f.value.trim().toLowerCase();
|
|
452
|
+
return qe(l.value).filter(
|
|
453
453
|
(I) => I.name.toLowerCase().includes(z) || (I.slug ?? "").toLowerCase().includes(z)
|
|
454
454
|
).map((I) => ({ ...I, children: [] }));
|
|
455
|
-
}), F = h(() => S.value ?
|
|
455
|
+
}), F = h(() => S.value ? l.value : q.value), E = h(() => [
|
|
456
456
|
{ key: "name", label: r("category.name"), minWidth: 200 },
|
|
457
457
|
{ key: "slug", label: r("category.slug"), width: 200, hideBelow: 620 },
|
|
458
458
|
{ key: "products_count", label: r("panel.column-products"), width: 110, align: "right" },
|
|
@@ -467,7 +467,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
467
467
|
} : void 0
|
|
468
468
|
);
|
|
469
469
|
function U(z) {
|
|
470
|
-
|
|
470
|
+
l.value = z.map(N);
|
|
471
471
|
}
|
|
472
472
|
function N(z) {
|
|
473
473
|
return { ...z, children: (z.children ?? []).map(N) };
|
|
@@ -475,41 +475,41 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
475
475
|
async function c(z = !0) {
|
|
476
476
|
w.value = !0;
|
|
477
477
|
try {
|
|
478
|
-
U(await
|
|
478
|
+
U(await t.load(z)), b.value = !0;
|
|
479
479
|
} catch (I) {
|
|
480
|
-
|
|
480
|
+
O.danger(s(I));
|
|
481
481
|
} finally {
|
|
482
482
|
w.value = !1;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
function g(z) {
|
|
486
|
-
|
|
486
|
+
f.value = z.search;
|
|
487
487
|
}
|
|
488
488
|
function p(z) {
|
|
489
|
-
|
|
489
|
+
y.push(`${a.base}/categories/${z.id}`);
|
|
490
490
|
}
|
|
491
491
|
async function j(z) {
|
|
492
492
|
const I = await x({ parent: z?.id ?? null });
|
|
493
|
-
I && (
|
|
493
|
+
I && (t.drop(), y.push(`${a.base}/categories/${I.category.id}`));
|
|
494
494
|
}
|
|
495
495
|
async function H(z) {
|
|
496
|
-
const I = z.parent?.id ?? null, T = (z.parent ? z.parent.children ?? [] :
|
|
496
|
+
const I = z.parent?.id ?? null, T = (z.parent ? z.parent.children ?? [] : l.value)[z.index + 1]?.id ?? null;
|
|
497
497
|
try {
|
|
498
|
-
const $ = await
|
|
499
|
-
|
|
498
|
+
const $ = await m.moveCategory(z.row.id, I, T);
|
|
499
|
+
t.take($), U($), O.success(r("panel.category-moved"));
|
|
500
500
|
} catch ($) {
|
|
501
|
-
|
|
501
|
+
O.danger(s($)), await c();
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
async function se(z, I) {
|
|
505
505
|
try {
|
|
506
|
-
await
|
|
506
|
+
await m.saveCategory(z.id, { is_published: I }), O.success(r(I ? "panel.category-published" : "panel.category-unpublished")), await c();
|
|
507
507
|
} catch (Z) {
|
|
508
|
-
|
|
508
|
+
O.danger(s(Z));
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
async function X(z) {
|
|
512
|
-
if (await
|
|
512
|
+
if (await ve({
|
|
513
513
|
title: r("panel.delete-category-title", { name: z.name }),
|
|
514
514
|
message: r("panel.delete-category-text"),
|
|
515
515
|
confirmText: r("panel.delete"),
|
|
@@ -517,13 +517,13 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
517
517
|
tone: "danger"
|
|
518
518
|
}))
|
|
519
519
|
try {
|
|
520
|
-
await
|
|
520
|
+
await m.removeCategory(z.id), O.success(r("panel.category-deleted")), await c();
|
|
521
521
|
} catch (Z) {
|
|
522
|
-
|
|
522
|
+
O.danger(s(Z));
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
function re(z) {
|
|
526
|
-
return { path: `${
|
|
526
|
+
return { path: `${a.base}/products`, query: { "f.category": String(z.id) } };
|
|
527
527
|
}
|
|
528
528
|
function ue(z) {
|
|
529
529
|
const I = [
|
|
@@ -533,7 +533,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
533
533
|
icon: "list",
|
|
534
534
|
label: r("panel.show-products"),
|
|
535
535
|
run: () => {
|
|
536
|
-
|
|
536
|
+
y.push(re(z));
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
];
|
|
@@ -556,7 +556,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
556
556
|
se(z, !0);
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
),
|
|
559
|
+
), P.value && I.push({
|
|
560
560
|
key: "delete",
|
|
561
561
|
icon: "trash",
|
|
562
562
|
label: r("panel.delete"),
|
|
@@ -579,31 +579,29 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
579
579
|
run: () => {
|
|
580
580
|
j(null);
|
|
581
581
|
}
|
|
582
|
-
}),
|
|
582
|
+
}), P.value && z.push({
|
|
583
583
|
key: "deleted",
|
|
584
584
|
label: r("module.deleted"),
|
|
585
585
|
icon: "trash",
|
|
586
586
|
menu: !0,
|
|
587
587
|
run: () => {
|
|
588
|
-
|
|
588
|
+
y.push({ path: `${a.base}/deleted`, query: { type: "categories" } });
|
|
589
589
|
}
|
|
590
590
|
}), z;
|
|
591
591
|
});
|
|
592
592
|
return (z, I) => {
|
|
593
593
|
const Z = Ht("router-link");
|
|
594
|
-
return v(), B("div",
|
|
595
|
-
|
|
594
|
+
return v(), B("div", ma, [
|
|
595
|
+
_(e(He), {
|
|
596
596
|
title: e(r)("module.categories"),
|
|
597
|
-
subtitle: C.value &&
|
|
598
|
-
back: `${t.base}/products`,
|
|
599
|
-
"back-label": e(r)("module.products"),
|
|
597
|
+
subtitle: C.value && l.value.length > 0 ? e(r)("panel.category-order") : void 0,
|
|
600
598
|
actions: ce.value
|
|
601
599
|
}, {
|
|
602
600
|
default: o(() => [
|
|
603
601
|
(v(), V(e(et), {
|
|
604
602
|
key: b.value ? "tree" : "waiting",
|
|
605
603
|
data: F.value,
|
|
606
|
-
columns:
|
|
604
|
+
columns: E.value,
|
|
607
605
|
"row-key": "id",
|
|
608
606
|
tree: L.value,
|
|
609
607
|
searchable: "",
|
|
@@ -614,7 +612,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
614
612
|
loading: w.value,
|
|
615
613
|
"cards-below": 0,
|
|
616
614
|
"search-placeholder": e(r)("panel.search-categories"),
|
|
617
|
-
"empty-text":
|
|
615
|
+
"empty-text": f.value ? e(r)("panel.empty-search") : e(r)("panel.empty-categories"),
|
|
618
616
|
"aria-label": e(r)("module.categories"),
|
|
619
617
|
onRowClick: p,
|
|
620
618
|
onStateChange: g,
|
|
@@ -623,7 +621,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
623
621
|
"cell-name": o(({ row: T }) => [
|
|
624
622
|
G("span", {
|
|
625
623
|
class: Ge(["wx-catalog-categories__name", { "is-hidden": !T.visible }])
|
|
626
|
-
},
|
|
624
|
+
}, k(T.name), 3)
|
|
627
625
|
]),
|
|
628
626
|
"cell-slug": o(({ row: T }) => [
|
|
629
627
|
T.slug ? (v(), V(e(J), {
|
|
@@ -634,7 +632,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
634
632
|
truncate: ""
|
|
635
633
|
}, {
|
|
636
634
|
default: o(() => [
|
|
637
|
-
|
|
635
|
+
W(" /" + k(e(Ve)(T.url) ?? T.slug) + "/ ", 1)
|
|
638
636
|
]),
|
|
639
637
|
_: 2
|
|
640
638
|
}, 1024)) : M("", !0)
|
|
@@ -644,11 +642,11 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
644
642
|
key: 0,
|
|
645
643
|
class: "wx-catalog-categories__count",
|
|
646
644
|
to: re(T),
|
|
647
|
-
onClick: I[0] || (I[0] =
|
|
645
|
+
onClick: I[0] || (I[0] = pt(() => {
|
|
648
646
|
}, ["stop"]))
|
|
649
647
|
}, {
|
|
650
648
|
default: o(() => [
|
|
651
|
-
|
|
649
|
+
W(k(T.products_count), 1)
|
|
652
650
|
]),
|
|
653
651
|
_: 2
|
|
654
652
|
}, 1032, ["to"])) : (v(), V(e(J), {
|
|
@@ -657,7 +655,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
657
655
|
tone: "muted"
|
|
658
656
|
}, {
|
|
659
657
|
default: o(() => [...I[1] || (I[1] = [
|
|
660
|
-
|
|
658
|
+
W("0", -1)
|
|
661
659
|
])]),
|
|
662
660
|
_: 1
|
|
663
661
|
}))
|
|
@@ -670,7 +668,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
670
668
|
size: "sm"
|
|
671
669
|
}, {
|
|
672
670
|
default: o(() => [
|
|
673
|
-
|
|
671
|
+
W(k(e(r)("states.published")), 1)
|
|
674
672
|
]),
|
|
675
673
|
_: 1
|
|
676
674
|
})) : (v(), V(e(Y), {
|
|
@@ -681,7 +679,7 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
681
679
|
title: e(r)("panel.category-hidden")
|
|
682
680
|
}, {
|
|
683
681
|
default: o(() => [
|
|
684
|
-
|
|
682
|
+
W(k(e(r)("states.published")), 1)
|
|
685
683
|
]),
|
|
686
684
|
_: 1
|
|
687
685
|
}, 8, ["title"])) : (v(), V(e(Y), {
|
|
@@ -690,13 +688,13 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
690
688
|
size: "sm"
|
|
691
689
|
}, {
|
|
692
690
|
default: o(() => [
|
|
693
|
-
|
|
691
|
+
W(k(e(r)("states.unpublished")), 1)
|
|
694
692
|
]),
|
|
695
693
|
_: 1
|
|
696
694
|
}))
|
|
697
695
|
]),
|
|
698
696
|
"cell-actions": o(({ row: T }) => [
|
|
699
|
-
|
|
697
|
+
_(e(Je), {
|
|
700
698
|
actions: ue(T),
|
|
701
699
|
label: T.name
|
|
702
700
|
}, null, 8, ["actions", "label"])
|
|
@@ -705,28 +703,28 @@ const ya = { class: "wx-catalog-categories" }, fa = /* @__PURE__ */ le({
|
|
|
705
703
|
}, 8, ["data", "columns", "tree", "loading", "search-placeholder", "empty-text", "aria-label"]))
|
|
706
704
|
]),
|
|
707
705
|
_: 1
|
|
708
|
-
}, 8, ["title", "subtitle", "
|
|
706
|
+
}, 8, ["title", "subtitle", "actions"])
|
|
709
707
|
]);
|
|
710
708
|
};
|
|
711
709
|
}
|
|
712
|
-
}),
|
|
710
|
+
}), de = (n, a) => {
|
|
713
711
|
const i = n.__vccOpts || n;
|
|
714
|
-
for (const [
|
|
715
|
-
i[
|
|
712
|
+
for (const [m, t] of a)
|
|
713
|
+
i[m] = t;
|
|
716
714
|
return i;
|
|
717
|
-
}, ha = /* @__PURE__ */
|
|
715
|
+
}, ha = /* @__PURE__ */ de(fa, [["__scopeId", "data-v-5385c84c"]]), Tt = /* @__PURE__ */ Symbol("wx-catalog-product");
|
|
718
716
|
function ba(n) {
|
|
719
|
-
|
|
717
|
+
vt(Tt, n);
|
|
720
718
|
}
|
|
721
719
|
function ka() {
|
|
722
|
-
return
|
|
720
|
+
return gt(Tt, null);
|
|
723
721
|
}
|
|
724
722
|
const zt = /* @__PURE__ */ Symbol("wx-catalog-category");
|
|
725
723
|
function _a(n) {
|
|
726
|
-
|
|
724
|
+
vt(zt, n);
|
|
727
725
|
}
|
|
728
726
|
function wa() {
|
|
729
|
-
return
|
|
727
|
+
return gt(zt, null);
|
|
730
728
|
}
|
|
731
729
|
const xa = /* @__PURE__ */ le({
|
|
732
730
|
name: "WxCatalogCategoryEditor",
|
|
@@ -735,46 +733,46 @@ const xa = /* @__PURE__ */ le({
|
|
|
735
733
|
base: { default: "/catalog" }
|
|
736
734
|
},
|
|
737
735
|
setup(n) {
|
|
738
|
-
const
|
|
736
|
+
const a = n, i = ae(), m = ne(i), t = ye(i), y = ze(), r = $e(), s = Ue();
|
|
739
737
|
oe();
|
|
740
|
-
const
|
|
741
|
-
const T =
|
|
742
|
-
return
|
|
738
|
+
const l = te("webx-catalog"), w = ge(), b = h(() => Number(y.params.id)), f = h(() => `${a.base}/categories`), x = D(null), C = D(void 0), P = D({}), S = D(""), q = D(!0), F = D(!1), E = D({}), L = h(() => i.can("catalog.manage")), U = h(() => i.can("catalog.delete")), N = h(() => !L.value || F.value), c = h(() => JSON.stringify(P.value)), g = h(() => S.value !== "" && c.value !== S.value), p = h(() => F.value ? "saving" : g.value ? "unsaved" : "saved"), j = h(() => {
|
|
739
|
+
const T = P.value.name;
|
|
740
|
+
return $t(T, s.active.value, x.value?.name ?? "") || l("panel.untitled");
|
|
743
741
|
}), H = h(() => {
|
|
744
742
|
const T = Ve(x.value?.url);
|
|
745
743
|
return T === null ? void 0 : `/${T}/`;
|
|
746
744
|
}), se = h(
|
|
747
|
-
() => x.value ? ga(
|
|
745
|
+
() => x.value ? ga(t.nodes.value ?? [], x.value.id).slice(1).reverse() : []
|
|
748
746
|
);
|
|
749
|
-
_a({ category: x, locked: N, facetsFrom: C }),
|
|
750
|
-
values:
|
|
747
|
+
_a({ category: x, locked: N, facetsFrom: C }), ft({ id: h(() => x.value?.id ?? null) }), ht({
|
|
748
|
+
values: P,
|
|
751
749
|
prefix: D(""),
|
|
752
750
|
path: h(() => Ve(x.value?.url)),
|
|
753
|
-
moving: () =>
|
|
751
|
+
moving: () => l("panel.address-moving")
|
|
754
752
|
});
|
|
755
753
|
function X(T) {
|
|
756
|
-
x.value = T.category, C.value = T.facets_from,
|
|
754
|
+
x.value = T.category, C.value = T.facets_from, P.value = T.values, S.value = JSON.stringify(T.values);
|
|
757
755
|
}
|
|
758
756
|
async function re() {
|
|
759
757
|
q.value = !0;
|
|
760
758
|
try {
|
|
761
|
-
const [T] = await Promise.all([
|
|
759
|
+
const [T] = await Promise.all([m.category(b.value), t.load().catch(() => [])]);
|
|
762
760
|
X(T);
|
|
763
761
|
} catch (T) {
|
|
764
|
-
|
|
762
|
+
O.danger(w(T)), r.push(f.value);
|
|
765
763
|
} finally {
|
|
766
764
|
q.value = !1;
|
|
767
765
|
}
|
|
768
766
|
}
|
|
769
767
|
async function ue() {
|
|
770
768
|
if (!(!x.value || F.value || !L.value)) {
|
|
771
|
-
F.value = !0,
|
|
769
|
+
F.value = !0, E.value = {};
|
|
772
770
|
try {
|
|
773
|
-
X(await
|
|
774
|
-
}),
|
|
771
|
+
X(await m.saveCategory(x.value.id, P.value)), t.drop(), t.load().catch(() => {
|
|
772
|
+
}), O.success(l("panel.saved"));
|
|
775
773
|
} catch (T) {
|
|
776
774
|
const $ = T.body;
|
|
777
|
-
$?.errors && Object.keys($.errors).length > 0 ? (
|
|
775
|
+
$?.errors && Object.keys($.errors).length > 0 ? (E.value = $.errors, O.danger(l("panel.save-failed"))) : O.danger(w(T));
|
|
778
776
|
} finally {
|
|
779
777
|
F.value = !1;
|
|
780
778
|
}
|
|
@@ -782,17 +780,17 @@ const xa = /* @__PURE__ */ le({
|
|
|
782
780
|
}
|
|
783
781
|
async function ce() {
|
|
784
782
|
const T = x.value;
|
|
785
|
-
if (!(!T || !await
|
|
786
|
-
title:
|
|
787
|
-
message:
|
|
788
|
-
confirmText:
|
|
789
|
-
cancelText:
|
|
783
|
+
if (!(!T || !await ve({
|
|
784
|
+
title: l("panel.delete-category-title", { name: T.name }),
|
|
785
|
+
message: l("panel.delete-category-text"),
|
|
786
|
+
confirmText: l("panel.delete"),
|
|
787
|
+
cancelText: l("panel.cancel"),
|
|
790
788
|
tone: "danger"
|
|
791
789
|
})))
|
|
792
790
|
try {
|
|
793
|
-
await
|
|
791
|
+
await m.removeCategory(T.id), t.drop(), O.success(l("panel.category-deleted")), S.value = c.value, r.push(f.value);
|
|
794
792
|
} catch (R) {
|
|
795
|
-
|
|
793
|
+
O.danger(w(R));
|
|
796
794
|
}
|
|
797
795
|
}
|
|
798
796
|
function z(T) {
|
|
@@ -801,35 +799,35 @@ const xa = /* @__PURE__ */ le({
|
|
|
801
799
|
function I(T) {
|
|
802
800
|
(T.ctrlKey || T.metaKey) && T.key.toLowerCase() === "s" && (T.preventDefault(), g.value && ue());
|
|
803
801
|
}
|
|
804
|
-
|
|
802
|
+
bt(I), we(b, () => {
|
|
805
803
|
re();
|
|
806
804
|
}), ie(() => {
|
|
807
805
|
re(), window.addEventListener("beforeunload", z);
|
|
808
806
|
}), Te(() => {
|
|
809
807
|
window.removeEventListener("beforeunload", z);
|
|
810
|
-
}), mt(async () => !g.value || !L.value ? !0 : await
|
|
811
|
-
title:
|
|
812
|
-
message:
|
|
813
|
-
confirmText:
|
|
814
|
-
cancelText:
|
|
808
|
+
}), mt(async () => !g.value || !L.value ? !0 : await ve({
|
|
809
|
+
title: l("panel.leave-title"),
|
|
810
|
+
message: l("panel.leave-text"),
|
|
811
|
+
confirmText: l("panel.leave"),
|
|
812
|
+
cancelText: l("panel.cancel"),
|
|
815
813
|
tone: "danger"
|
|
816
814
|
}));
|
|
817
815
|
const Z = h(() => {
|
|
818
816
|
const T = x.value, $ = [];
|
|
819
|
-
return T && (T.url && T.visible && $.push({ key: "site", label:
|
|
817
|
+
return T && (T.url && T.visible && $.push({ key: "site", label: l("panel.open-on-site"), icon: "link", href: T.url }), $.push({
|
|
820
818
|
key: "products",
|
|
821
|
-
label:
|
|
819
|
+
label: l("panel.show-products"),
|
|
822
820
|
icon: "list",
|
|
823
821
|
menu: !0,
|
|
824
822
|
run: () => {
|
|
825
823
|
r.push({
|
|
826
|
-
path: `${
|
|
824
|
+
path: `${a.base}/products`,
|
|
827
825
|
query: { "f.category": String(T.id) }
|
|
828
826
|
});
|
|
829
827
|
}
|
|
830
828
|
}), U.value && $.push({
|
|
831
829
|
key: "delete",
|
|
832
|
-
label:
|
|
830
|
+
label: l("panel.delete"),
|
|
833
831
|
icon: "trash",
|
|
834
832
|
danger: !0,
|
|
835
833
|
menu: !0,
|
|
@@ -843,54 +841,54 @@ const xa = /* @__PURE__ */ le({
|
|
|
843
841
|
onKeydown: I
|
|
844
842
|
}, [
|
|
845
843
|
q.value || !x.value ? (v(), B(ee, { key: 0 }, [
|
|
846
|
-
|
|
844
|
+
_(e(xe), {
|
|
847
845
|
class: "wx-catalog-category-editor__ghost",
|
|
848
846
|
title: "",
|
|
849
847
|
rows: 1
|
|
850
848
|
}),
|
|
851
|
-
|
|
849
|
+
_(e(tt), null, {
|
|
852
850
|
default: o(() => [
|
|
853
|
-
|
|
851
|
+
_(e(xe), { rows: 6 })
|
|
854
852
|
]),
|
|
855
853
|
_: 1
|
|
856
854
|
})
|
|
857
855
|
], 64)) : (v(), B(ee, { key: 1 }, [
|
|
858
|
-
|
|
856
|
+
_(e(kt), {
|
|
859
857
|
divider: "",
|
|
860
|
-
back:
|
|
861
|
-
"back-label": e(
|
|
858
|
+
back: f.value,
|
|
859
|
+
"back-label": e(l)("module.categories"),
|
|
862
860
|
title: j.value,
|
|
863
861
|
subtitle: H.value,
|
|
864
862
|
actions: Z.value
|
|
865
863
|
}, {
|
|
866
864
|
trail: o(() => [
|
|
867
|
-
|
|
865
|
+
_(e(Ct), {
|
|
868
866
|
size: "sm",
|
|
869
|
-
label: e(
|
|
867
|
+
label: e(l)("panel.category-trail")
|
|
870
868
|
}, {
|
|
871
869
|
default: o(() => [
|
|
872
|
-
|
|
870
|
+
_(e(he), {
|
|
873
871
|
as: "router-link",
|
|
874
|
-
to:
|
|
872
|
+
to: f.value
|
|
875
873
|
}, {
|
|
876
874
|
default: o(() => [
|
|
877
|
-
|
|
875
|
+
W(k(e(l)("module.categories")), 1)
|
|
878
876
|
]),
|
|
879
877
|
_: 1
|
|
880
878
|
}, 8, ["to"]),
|
|
881
|
-
(v(!0), B(ee, null,
|
|
879
|
+
(v(!0), B(ee, null, be(se.value, (R) => (v(), V(e(he), {
|
|
882
880
|
key: R.id,
|
|
883
881
|
as: "router-link",
|
|
884
|
-
to: `${
|
|
882
|
+
to: `${f.value}/${R.id}`
|
|
885
883
|
}, {
|
|
886
884
|
default: o(() => [
|
|
887
|
-
|
|
885
|
+
W(k(R.name), 1)
|
|
888
886
|
]),
|
|
889
887
|
_: 2
|
|
890
888
|
}, 1032, ["to"]))), 128)),
|
|
891
|
-
|
|
889
|
+
_(e(he), { current: "" }, {
|
|
892
890
|
default: o(() => [
|
|
893
|
-
|
|
891
|
+
W(k(j.value), 1)
|
|
894
892
|
]),
|
|
895
893
|
_: 1
|
|
896
894
|
})
|
|
@@ -905,7 +903,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
905
903
|
dot: ""
|
|
906
904
|
}, {
|
|
907
905
|
default: o(() => [
|
|
908
|
-
|
|
906
|
+
W(k(e(l)("panel.category-hidden")), 1)
|
|
909
907
|
]),
|
|
910
908
|
_: 1
|
|
911
909
|
})) : (v(), V(e(Y), {
|
|
@@ -913,33 +911,33 @@ const xa = /* @__PURE__ */ le({
|
|
|
913
911
|
dot: ""
|
|
914
912
|
}, {
|
|
915
913
|
default: o(() => [
|
|
916
|
-
|
|
914
|
+
W(k(e(l)("states.unpublished")), 1)
|
|
917
915
|
]),
|
|
918
916
|
_: 1
|
|
919
917
|
}))
|
|
920
918
|
]),
|
|
921
919
|
_: 1
|
|
922
920
|
}, 8, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
923
|
-
|
|
924
|
-
modelValue:
|
|
925
|
-
"onUpdate:modelValue": $[0] || ($[0] = (R) =>
|
|
921
|
+
_(e(_t), {
|
|
922
|
+
modelValue: P.value,
|
|
923
|
+
"onUpdate:modelValue": $[0] || ($[0] = (R) => P.value = R),
|
|
926
924
|
name: "catalog.category-form",
|
|
927
|
-
errors:
|
|
925
|
+
errors: E.value,
|
|
928
926
|
disabled: N.value
|
|
929
927
|
}, null, 8, ["modelValue", "errors", "disabled"]),
|
|
930
928
|
L.value ? (v(), V(e(St), { key: 0 }, {
|
|
931
929
|
state: o(() => [
|
|
932
|
-
|
|
930
|
+
_(e(wt), { state: p.value }, null, 8, ["state"])
|
|
933
931
|
]),
|
|
934
932
|
default: o(() => [
|
|
935
|
-
|
|
933
|
+
_(e(Q), {
|
|
936
934
|
type: "primary",
|
|
937
935
|
loading: F.value,
|
|
938
936
|
disabled: !g.value,
|
|
939
937
|
onClick: ue
|
|
940
938
|
}, {
|
|
941
939
|
default: o(() => [
|
|
942
|
-
|
|
940
|
+
W(k(e(l)("panel.save")), 1)
|
|
943
941
|
]),
|
|
944
942
|
_: 1
|
|
945
943
|
}, 8, ["loading", "disabled"])
|
|
@@ -949,7 +947,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
949
947
|
], 64))
|
|
950
948
|
], 32));
|
|
951
949
|
}
|
|
952
|
-
}), $a = /* @__PURE__ */
|
|
950
|
+
}), $a = /* @__PURE__ */ de(xa, [["__scopeId", "data-v-45d5817b"]]), Ca = /* @__PURE__ */ le({
|
|
953
951
|
name: "WxCatalogCategoryField",
|
|
954
952
|
inheritAttrs: !1,
|
|
955
953
|
__name: "CategoryField",
|
|
@@ -961,50 +959,50 @@ const xa = /* @__PURE__ */ le({
|
|
|
961
959
|
}),
|
|
962
960
|
emits: ["update:modelValue"],
|
|
963
961
|
setup(n) {
|
|
964
|
-
const
|
|
962
|
+
const a = n, i = yt(n, "modelValue"), m = ae(), t = ye(m), y = ea();
|
|
965
963
|
oe();
|
|
966
964
|
const r = te("webx-catalog"), s = h(() => {
|
|
967
|
-
const b =
|
|
965
|
+
const b = y?.values.value.category_id;
|
|
968
966
|
return typeof b == "number" ? b : null;
|
|
969
|
-
}),
|
|
970
|
-
const b = (
|
|
967
|
+
}), l = h(() => {
|
|
968
|
+
const b = (f) => f.map((x) => ({
|
|
971
969
|
...x,
|
|
972
|
-
locked:
|
|
970
|
+
locked: a.multiple && x.id === s.value,
|
|
973
971
|
children: b(x.children ?? [])
|
|
974
972
|
}));
|
|
975
|
-
return b(
|
|
973
|
+
return b(t.nodes.value ?? []);
|
|
976
974
|
}), w = h({
|
|
977
|
-
get: () =>
|
|
975
|
+
get: () => a.multiple ? Array.isArray(i.value) ? i.value : [] : typeof i.value == "number" ? i.value : null,
|
|
978
976
|
set: (b) => {
|
|
979
|
-
if (
|
|
980
|
-
const
|
|
981
|
-
i.value =
|
|
977
|
+
if (a.multiple) {
|
|
978
|
+
const f = (Array.isArray(b) ? b : []).map(Number);
|
|
979
|
+
i.value = f.filter((x) => x !== s.value);
|
|
982
980
|
return;
|
|
983
981
|
}
|
|
984
982
|
i.value = b == null || Array.isArray(b) ? null : Number(b);
|
|
985
983
|
}
|
|
986
984
|
});
|
|
987
985
|
return ie(() => {
|
|
988
|
-
|
|
986
|
+
t.load().catch(() => {
|
|
989
987
|
});
|
|
990
|
-
}), (b,
|
|
988
|
+
}), (b, f) => (v(), V(e(De), Jt(b.$attrs, {
|
|
991
989
|
modelValue: w.value,
|
|
992
|
-
"onUpdate:modelValue":
|
|
990
|
+
"onUpdate:modelValue": f[0] || (f[0] = (x) => w.value = x),
|
|
993
991
|
class: "wx-catalog-category",
|
|
994
|
-
nodes:
|
|
995
|
-
multiple:
|
|
996
|
-
"check-strictly":
|
|
992
|
+
nodes: l.value,
|
|
993
|
+
multiple: a.multiple,
|
|
994
|
+
"check-strictly": a.multiple,
|
|
997
995
|
"node-key": "id",
|
|
998
996
|
"label-key": "name",
|
|
999
997
|
"children-key": "children",
|
|
1000
998
|
"disabled-key": "locked",
|
|
1001
|
-
"show-path": !
|
|
999
|
+
"show-path": !a.multiple,
|
|
1002
1000
|
separator: " / ",
|
|
1003
1001
|
filterable: "",
|
|
1004
1002
|
clearable: "",
|
|
1005
1003
|
"default-expand-all": "",
|
|
1006
1004
|
teleport: "",
|
|
1007
|
-
placeholder:
|
|
1005
|
+
placeholder: a.multiple ? e(r)("panel.pick-categories") : e(r)("panel.pick-category")
|
|
1008
1006
|
}), null, 16, ["modelValue", "nodes", "multiple", "check-strictly", "show-path", "placeholder"]));
|
|
1009
1007
|
}
|
|
1010
1008
|
}), Sa = { class: "wx-catalog-deleted" }, Pa = { class: "wx-catalog-deleted__name" }, Aa = { class: "wx-catalog-deleted__title" }, Wa = {
|
|
@@ -1022,16 +1020,16 @@ const xa = /* @__PURE__ */ le({
|
|
|
1022
1020
|
base: { default: "/catalog" }
|
|
1023
1021
|
},
|
|
1024
1022
|
setup(n) {
|
|
1025
|
-
const
|
|
1023
|
+
const a = n, i = ae(), m = ne(i), t = ye(i), y = ze(), r = $e();
|
|
1026
1024
|
oe();
|
|
1027
|
-
const s = te("webx-catalog"),
|
|
1028
|
-
get: () =>
|
|
1025
|
+
const s = te("webx-catalog"), l = ge(), w = D(null), b = D(!0), f = D(typeof y.query.q == "string" ? y.query.q : ""), x = h(() => i.can("catalog.delete")), C = h({
|
|
1026
|
+
get: () => y.query.type === "categories" ? "categories" : "products",
|
|
1029
1027
|
set: (c) => {
|
|
1030
|
-
|
|
1028
|
+
f.value = "", w.value = null, r.replace({
|
|
1031
1029
|
query: { type: c === "categories" ? "categories" : void 0 }
|
|
1032
1030
|
});
|
|
1033
1031
|
}
|
|
1034
|
-
}),
|
|
1032
|
+
}), P = h(() => [
|
|
1035
1033
|
{ value: "products", label: s("module.products") },
|
|
1036
1034
|
{ value: "categories", label: s("module.categories") }
|
|
1037
1035
|
]), S = h(
|
|
@@ -1052,34 +1050,34 @@ const xa = /* @__PURE__ */ le({
|
|
|
1052
1050
|
const g = ++q;
|
|
1053
1051
|
b.value = !0;
|
|
1054
1052
|
try {
|
|
1055
|
-
const p = await
|
|
1056
|
-
q: c?.search ??
|
|
1053
|
+
const p = await m.deleted(C.value, {
|
|
1054
|
+
q: c?.search ?? f.value,
|
|
1057
1055
|
page: c?.page,
|
|
1058
1056
|
per_page: c?.perPage
|
|
1059
1057
|
});
|
|
1060
1058
|
g === q && (w.value = p);
|
|
1061
1059
|
} catch (p) {
|
|
1062
|
-
|
|
1060
|
+
O.danger(l(p));
|
|
1063
1061
|
} finally {
|
|
1064
1062
|
g === q && (b.value = !1);
|
|
1065
1063
|
}
|
|
1066
1064
|
}
|
|
1067
|
-
function
|
|
1065
|
+
function E(c) {
|
|
1068
1066
|
r.replace({
|
|
1069
|
-
query: { ...
|
|
1067
|
+
query: { ...y.query, q: c.search === "" ? void 0 : c.search }
|
|
1070
1068
|
}), F(c);
|
|
1071
1069
|
}
|
|
1072
1070
|
async function L(c) {
|
|
1073
1071
|
try {
|
|
1074
1072
|
if (C.value === "categories")
|
|
1075
|
-
await
|
|
1073
|
+
await m.restoreCategory(c.id), t.drop(), O.success(s("panel.category-restored"));
|
|
1076
1074
|
else {
|
|
1077
|
-
const p = (await
|
|
1078
|
-
|
|
1075
|
+
const p = (await m.restoreProduct(c.id)).category === null && c.category !== null;
|
|
1076
|
+
O.success(s(p ? "panel.product-restored-bare" : "panel.product-restored"));
|
|
1079
1077
|
}
|
|
1080
1078
|
await F();
|
|
1081
1079
|
} catch (g) {
|
|
1082
|
-
|
|
1080
|
+
O.danger(l(g));
|
|
1083
1081
|
}
|
|
1084
1082
|
}
|
|
1085
1083
|
function U(c, g) {
|
|
@@ -1098,20 +1096,20 @@ const xa = /* @__PURE__ */ le({
|
|
|
1098
1096
|
}), g;
|
|
1099
1097
|
}
|
|
1100
1098
|
return (c, g) => (v(), B("div", Sa, [
|
|
1101
|
-
|
|
1099
|
+
_(e(He), {
|
|
1102
1100
|
view: C.value,
|
|
1103
1101
|
"onUpdate:view": g[1] || (g[1] = (p) => C.value = p),
|
|
1104
1102
|
title: e(s)("module.deleted"),
|
|
1105
1103
|
subtitle: e(s)("panel.deleted-help"),
|
|
1106
|
-
back: `${
|
|
1104
|
+
back: `${a.base}/products`,
|
|
1107
1105
|
"back-label": e(s)("module.products"),
|
|
1108
|
-
views:
|
|
1106
|
+
views: P.value
|
|
1109
1107
|
}, {
|
|
1110
1108
|
default: o(() => [
|
|
1111
1109
|
(v(), V(e(et), {
|
|
1112
1110
|
key: String(C.value),
|
|
1113
|
-
search:
|
|
1114
|
-
"onUpdate:search": g[0] || (g[0] = (p) =>
|
|
1111
|
+
search: f.value,
|
|
1112
|
+
"onUpdate:search": g[0] || (g[0] = (p) => f.value = p),
|
|
1115
1113
|
data: w.value,
|
|
1116
1114
|
columns: S.value,
|
|
1117
1115
|
"row-key": "id",
|
|
@@ -1122,25 +1120,25 @@ const xa = /* @__PURE__ */ le({
|
|
|
1122
1120
|
layout: "fixed",
|
|
1123
1121
|
loading: b.value,
|
|
1124
1122
|
"search-placeholder": e(s)("panel.deleted-search"),
|
|
1125
|
-
"empty-text":
|
|
1123
|
+
"empty-text": f.value ? e(s)("panel.empty-search") : e(s)("panel.deleted-empty"),
|
|
1126
1124
|
"aria-label": e(s)("module.deleted"),
|
|
1127
|
-
onStateChange:
|
|
1125
|
+
onStateChange: E
|
|
1128
1126
|
}, {
|
|
1129
1127
|
"cell-name": o(({ row: p }) => [
|
|
1130
1128
|
G("div", Pa, [
|
|
1131
|
-
G("span", Aa,
|
|
1132
|
-
"sku" in p && p.sku ? (v(), B("span", Wa,
|
|
1129
|
+
G("span", Aa, k(p.name), 1),
|
|
1130
|
+
"sku" in p && p.sku ? (v(), B("span", Wa, k(p.sku), 1)) : "slug" in p && p.slug ? (v(), B("span", Va, " /" + k(p.slug) + "/ ", 1)) : M("", !0)
|
|
1133
1131
|
])
|
|
1134
1132
|
]),
|
|
1135
1133
|
"cell-category": o(({ row: p }) => [
|
|
1136
1134
|
U(p, "category") ? (v(), B("span", Ta, [
|
|
1137
|
-
|
|
1135
|
+
_(e(J), {
|
|
1138
1136
|
size: "sm",
|
|
1139
1137
|
truncate: "",
|
|
1140
1138
|
tone: U(p, "category")?.deleted ? "muted" : void 0
|
|
1141
1139
|
}, {
|
|
1142
1140
|
default: o(() => [
|
|
1143
|
-
|
|
1141
|
+
W(k(U(p, "category")?.name), 1)
|
|
1144
1142
|
]),
|
|
1145
1143
|
_: 2
|
|
1146
1144
|
}, 1032, ["tone"]),
|
|
@@ -1151,7 +1149,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1151
1149
|
round: ""
|
|
1152
1150
|
}, {
|
|
1153
1151
|
default: o(() => [
|
|
1154
|
-
|
|
1152
|
+
W(k(e(s)("panel.restore-bare")), 1)
|
|
1155
1153
|
]),
|
|
1156
1154
|
_: 1
|
|
1157
1155
|
})) : M("", !0)
|
|
@@ -1161,7 +1159,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1161
1159
|
tone: "muted"
|
|
1162
1160
|
}, {
|
|
1163
1161
|
default: o(() => [
|
|
1164
|
-
|
|
1162
|
+
W(k(e(s)("product.no-category")), 1)
|
|
1165
1163
|
]),
|
|
1166
1164
|
_: 1
|
|
1167
1165
|
}))
|
|
@@ -1174,9 +1172,9 @@ const xa = /* @__PURE__ */ le({
|
|
|
1174
1172
|
tone: U(p, "parent")?.deleted ? "muted" : void 0
|
|
1175
1173
|
}, {
|
|
1176
1174
|
default: o(() => [
|
|
1177
|
-
|
|
1175
|
+
W(k(U(p, "parent")?.name) + " ", 1),
|
|
1178
1176
|
U(p, "parent")?.deleted ? (v(), B(ee, { key: 0 }, [
|
|
1179
|
-
|
|
1177
|
+
W(" (" + k(e(s)("panel.category-gone")) + ")", 1)
|
|
1180
1178
|
], 64)) : M("", !0)
|
|
1181
1179
|
]),
|
|
1182
1180
|
_: 2
|
|
@@ -1186,13 +1184,13 @@ const xa = /* @__PURE__ */ le({
|
|
|
1186
1184
|
tone: "muted"
|
|
1187
1185
|
}, {
|
|
1188
1186
|
default: o(() => [
|
|
1189
|
-
|
|
1187
|
+
W(k(e(s)("panel.parent-root")), 1)
|
|
1190
1188
|
]),
|
|
1191
1189
|
_: 1
|
|
1192
1190
|
}))
|
|
1193
1191
|
]),
|
|
1194
1192
|
"cell-deleted_at": o(({ row: p }) => [
|
|
1195
|
-
|
|
1193
|
+
_(e(xt), {
|
|
1196
1194
|
value: p.deleted_at,
|
|
1197
1195
|
compact: ""
|
|
1198
1196
|
}, null, 8, ["value"])
|
|
@@ -1211,7 +1209,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1211
1209
|
}, 8, ["view", "title", "subtitle", "back", "back-label", "views"])
|
|
1212
1210
|
]));
|
|
1213
1211
|
}
|
|
1214
|
-
}), Ua = /* @__PURE__ */
|
|
1212
|
+
}), Ua = /* @__PURE__ */ de(za, [["__scopeId", "data-v-1fad643b"]]), Da = { class: "wx-catalog-facets" }, qa = { class: "wx-catalog-facets__own" }, Na = {
|
|
1215
1213
|
key: 0,
|
|
1216
1214
|
class: "wx-catalog-facets__inherited"
|
|
1217
1215
|
}, Fa = /* @__PURE__ */ le({
|
|
@@ -1223,10 +1221,10 @@ const xa = /* @__PURE__ */ le({
|
|
|
1223
1221
|
},
|
|
1224
1222
|
emits: ["update:modelValue"],
|
|
1225
1223
|
setup(n) {
|
|
1226
|
-
const
|
|
1224
|
+
const a = yt(n, "modelValue"), i = ae(), m = ne(i), t = Vt(i), y = wa();
|
|
1227
1225
|
oe();
|
|
1228
|
-
const r = te("webx-catalog"), s = D(!0),
|
|
1229
|
-
function
|
|
1226
|
+
const r = te("webx-catalog"), s = D(!0), l = D(!1), w = D(null), b = h(() => t.facets.value ?? []), f = h(() => new Map(b.value.map((c) => [c.key, c.label]))), x = h(() => Array.isArray(a.value)), C = h(() => y?.locked.value ?? !1);
|
|
1227
|
+
function P(c) {
|
|
1230
1228
|
const g = new Set(c.map((p) => p.key));
|
|
1231
1229
|
return [
|
|
1232
1230
|
...c.map((p) => ({ key: p.key, visible: p.visible })),
|
|
@@ -1234,21 +1232,21 @@ const xa = /* @__PURE__ */ le({
|
|
|
1234
1232
|
];
|
|
1235
1233
|
}
|
|
1236
1234
|
const S = h(
|
|
1237
|
-
() => w.value === null ? b.value.map((c) => ({ key: c.key, visible: !0 })) :
|
|
1235
|
+
() => w.value === null ? b.value.map((c) => ({ key: c.key, visible: !0 })) : P(w.value.rows)
|
|
1238
1236
|
), q = h({
|
|
1239
|
-
get: () =>
|
|
1237
|
+
get: () => P(a.value ?? []).map((c) => ({
|
|
1240
1238
|
...c,
|
|
1241
|
-
label:
|
|
1242
|
-
known:
|
|
1239
|
+
label: f.value.get(c.key) ?? c.key,
|
|
1240
|
+
known: f.value.has(c.key)
|
|
1243
1241
|
})),
|
|
1244
1242
|
set: (c) => {
|
|
1245
|
-
|
|
1243
|
+
a.value = c.map((g) => ({ key: g.key, visible: g.visible }));
|
|
1246
1244
|
}
|
|
1247
1245
|
}), F = h(
|
|
1248
|
-
() => S.value.filter((c) => c.visible &&
|
|
1246
|
+
() => S.value.filter((c) => c.visible && f.value.has(c.key)).map((c) => f.value.get(c.key)).join(", ")
|
|
1249
1247
|
);
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1248
|
+
function E(c) {
|
|
1249
|
+
a.value = c ? S.value.map((g) => ({ ...g })) : null;
|
|
1252
1250
|
}
|
|
1253
1251
|
function L(c, g) {
|
|
1254
1252
|
q.value = q.value.map(
|
|
@@ -1256,16 +1254,16 @@ const xa = /* @__PURE__ */ le({
|
|
|
1256
1254
|
);
|
|
1257
1255
|
}
|
|
1258
1256
|
async function U(c) {
|
|
1259
|
-
const g =
|
|
1257
|
+
const g = y?.facetsFrom.value;
|
|
1260
1258
|
if (w.value = null, g === null) return;
|
|
1261
1259
|
if (g !== void 0) {
|
|
1262
|
-
const j = await
|
|
1260
|
+
const j = await m.category(g.id);
|
|
1263
1261
|
Array.isArray(j.values.facets) && (w.value = { name: g.name, rows: j.values.facets });
|
|
1264
1262
|
return;
|
|
1265
1263
|
}
|
|
1266
1264
|
let p = c;
|
|
1267
1265
|
for (; p !== null; ) {
|
|
1268
|
-
const j = await
|
|
1266
|
+
const j = await m.category(p), H = j.values.facets;
|
|
1269
1267
|
if (Array.isArray(H)) {
|
|
1270
1268
|
w.value = { name: j.category.name, rows: H };
|
|
1271
1269
|
return;
|
|
@@ -1274,17 +1272,17 @@ const xa = /* @__PURE__ */ le({
|
|
|
1274
1272
|
}
|
|
1275
1273
|
}
|
|
1276
1274
|
async function N() {
|
|
1277
|
-
s.value = !0,
|
|
1275
|
+
s.value = !0, l.value = !1;
|
|
1278
1276
|
try {
|
|
1279
|
-
await Promise.all([
|
|
1277
|
+
await Promise.all([t.load(), U(y?.category.value?.parent_id ?? null)]);
|
|
1280
1278
|
} catch {
|
|
1281
|
-
|
|
1279
|
+
l.value = !0;
|
|
1282
1280
|
} finally {
|
|
1283
1281
|
s.value = !1;
|
|
1284
1282
|
}
|
|
1285
1283
|
}
|
|
1286
1284
|
return we(
|
|
1287
|
-
() => [
|
|
1285
|
+
() => [y?.category.value?.parent_id, JSON.stringify(y?.facetsFrom.value)],
|
|
1288
1286
|
(c, g) => {
|
|
1289
1287
|
(c[0] !== g[0] || c[1] !== g[1]) && N();
|
|
1290
1288
|
}
|
|
@@ -1292,25 +1290,25 @@ const xa = /* @__PURE__ */ le({
|
|
|
1292
1290
|
s.value ? (v(), V(e(xe), {
|
|
1293
1291
|
key: 0,
|
|
1294
1292
|
rows: 3
|
|
1295
|
-
})) :
|
|
1293
|
+
})) : l.value ? (v(), V(e(We), {
|
|
1296
1294
|
key: 1,
|
|
1297
1295
|
type: "warning",
|
|
1298
1296
|
variant: "soft",
|
|
1299
1297
|
description: e(r)("panel.facets-failed")
|
|
1300
1298
|
}, null, 8, ["description"])) : (v(), B(ee, { key: 2 }, [
|
|
1301
1299
|
G("div", qa, [
|
|
1302
|
-
|
|
1300
|
+
_(e(Ie), {
|
|
1303
1301
|
"model-value": x.value,
|
|
1304
1302
|
disabled: C.value,
|
|
1305
1303
|
label: e(r)("panel.facets-own"),
|
|
1306
|
-
"onUpdate:modelValue":
|
|
1304
|
+
"onUpdate:modelValue": E
|
|
1307
1305
|
}, null, 8, ["model-value", "disabled", "label"]),
|
|
1308
|
-
|
|
1306
|
+
_(e(J), {
|
|
1309
1307
|
size: "sm",
|
|
1310
1308
|
tone: "muted"
|
|
1311
1309
|
}, {
|
|
1312
1310
|
default: o(() => [
|
|
1313
|
-
|
|
1311
|
+
W(k(x.value ? e(r)("panel.facets-own-help") : e(r)("panel.facets-inherited-help")), 1)
|
|
1314
1312
|
]),
|
|
1315
1313
|
_: 1
|
|
1316
1314
|
})
|
|
@@ -1328,20 +1326,20 @@ const xa = /* @__PURE__ */ le({
|
|
|
1328
1326
|
default: o(({ item: p }) => [
|
|
1329
1327
|
G("span", {
|
|
1330
1328
|
class: Ge(["wx-catalog-facets__name", { "is-off": !p.visible }])
|
|
1331
|
-
},
|
|
1329
|
+
}, k(p.label), 3),
|
|
1332
1330
|
p.known ? M("", !0) : (v(), V(e(J), {
|
|
1333
1331
|
key: 0,
|
|
1334
1332
|
size: "sm",
|
|
1335
1333
|
tone: "muted"
|
|
1336
1334
|
}, {
|
|
1337
1335
|
default: o(() => [
|
|
1338
|
-
|
|
1336
|
+
W(k(e(r)("panel.facets-unknown")), 1)
|
|
1339
1337
|
]),
|
|
1340
1338
|
_: 1
|
|
1341
1339
|
}))
|
|
1342
1340
|
]),
|
|
1343
1341
|
actions: o(({ item: p }) => [
|
|
1344
|
-
|
|
1342
|
+
_(e(Ie), {
|
|
1345
1343
|
size: "sm",
|
|
1346
1344
|
"model-value": p.visible,
|
|
1347
1345
|
disabled: C.value || !p.known,
|
|
@@ -1351,9 +1349,9 @@ const xa = /* @__PURE__ */ le({
|
|
|
1351
1349
|
]),
|
|
1352
1350
|
_: 1
|
|
1353
1351
|
}, 8, ["modelValue", "disabled", "empty-text"])) : (v(), B("div", Na, [
|
|
1354
|
-
|
|
1352
|
+
_(e(J), { weight: "medium" }, {
|
|
1355
1353
|
default: o(() => [
|
|
1356
|
-
|
|
1354
|
+
W(k(w.value ? e(r)("panel.facets-inherited", { name: w.value.name }) : e(r)("panel.facets-default")), 1)
|
|
1357
1355
|
]),
|
|
1358
1356
|
_: 1
|
|
1359
1357
|
}),
|
|
@@ -1363,7 +1361,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1363
1361
|
tone: "muted"
|
|
1364
1362
|
}, {
|
|
1365
1363
|
default: o(() => [
|
|
1366
|
-
|
|
1364
|
+
W(k(F.value), 1)
|
|
1367
1365
|
]),
|
|
1368
1366
|
_: 1
|
|
1369
1367
|
})) : b.value.length === 0 ? (v(), V(e(J), {
|
|
@@ -1372,7 +1370,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1372
1370
|
tone: "muted"
|
|
1373
1371
|
}, {
|
|
1374
1372
|
default: o(() => [
|
|
1375
|
-
|
|
1373
|
+
W(k(e(r)("panel.facets-empty")), 1)
|
|
1376
1374
|
]),
|
|
1377
1375
|
_: 1
|
|
1378
1376
|
})) : M("", !0)
|
|
@@ -1380,46 +1378,49 @@ const xa = /* @__PURE__ */ le({
|
|
|
1380
1378
|
], 64))
|
|
1381
1379
|
]));
|
|
1382
1380
|
}
|
|
1383
|
-
}),
|
|
1381
|
+
}), Ea = /* @__PURE__ */ de(Fa, [["__scopeId", "data-v-4ca00a4d"]]), Oa = { class: "wx-catalog-gallery" }, Ia = { class: "wx-catalog-gallery__item" }, Ra = ["href"], Ba = ["src"], La = {
|
|
1382
|
+
key: 1,
|
|
1383
|
+
class: "wx-catalog-gallery__size"
|
|
1384
|
+
}, Ma = { class: "wx-catalog-gallery__words" }, ja = { class: "wx-catalog-gallery__address" }, Ka = 800, Ga = /* @__PURE__ */ le({
|
|
1384
1385
|
name: "WxCatalogGallery",
|
|
1385
1386
|
__name: "GalleryField",
|
|
1386
1387
|
setup(n) {
|
|
1387
|
-
const
|
|
1388
|
+
const a = ae(), i = ne(a), m = ka();
|
|
1388
1389
|
oe();
|
|
1389
|
-
const
|
|
1390
|
-
get: () =>
|
|
1390
|
+
const t = te("webx-catalog"), y = ge(), r = D([]), s = D(""), l = D(!1), w = h(() => m?.product.value?.id ?? null), b = h(() => m === null || m.locked.value), f = h({
|
|
1391
|
+
get: () => m?.images.value ?? [],
|
|
1391
1392
|
set: (N) => {
|
|
1392
|
-
|
|
1393
|
+
m && (m.images.value = N);
|
|
1393
1394
|
}
|
|
1394
1395
|
});
|
|
1395
1396
|
let x, C = "";
|
|
1396
|
-
function
|
|
1397
|
+
function P(N) {
|
|
1397
1398
|
return JSON.stringify(N.map((c) => [c.id, c.alt, c.title]));
|
|
1398
1399
|
}
|
|
1399
1400
|
async function S(N) {
|
|
1400
1401
|
const c = w.value;
|
|
1401
1402
|
if (c === null) return;
|
|
1402
1403
|
clearTimeout(x);
|
|
1403
|
-
const g =
|
|
1404
|
+
const g = P(f.value);
|
|
1404
1405
|
C = g;
|
|
1405
1406
|
try {
|
|
1406
|
-
const p = await i.saveImages(c,
|
|
1407
|
-
|
|
1407
|
+
const p = await i.saveImages(c, f.value);
|
|
1408
|
+
P(f.value) === g && (f.value = p);
|
|
1408
1409
|
} catch (p) {
|
|
1409
|
-
|
|
1410
|
+
O.danger(`${N} ${y(p)}`);
|
|
1410
1411
|
}
|
|
1411
1412
|
}
|
|
1412
1413
|
function q(N, c, g) {
|
|
1413
|
-
|
|
1414
|
+
f.value = f.value.map(
|
|
1414
1415
|
(p) => p.id === N.id ? { ...p, [c]: g ?? {} } : p
|
|
1415
1416
|
), clearTimeout(x), x = setTimeout(() => {
|
|
1416
|
-
S(
|
|
1417
|
-
},
|
|
1417
|
+
S(t("panel.gallery-captions-failed"));
|
|
1418
|
+
}, Ka);
|
|
1418
1419
|
}
|
|
1419
1420
|
function F() {
|
|
1420
|
-
S(
|
|
1421
|
+
S(t("panel.gallery-reorder-failed"));
|
|
1421
1422
|
}
|
|
1422
|
-
async function
|
|
1423
|
+
async function E(N) {
|
|
1423
1424
|
const c = w.value;
|
|
1424
1425
|
if (c !== null)
|
|
1425
1426
|
for (const g of N) {
|
|
@@ -1430,59 +1431,59 @@ const xa = /* @__PURE__ */ le({
|
|
|
1430
1431
|
p({ status: "uploading", progress: 0 });
|
|
1431
1432
|
try {
|
|
1432
1433
|
const j = await i.addImage(c, g.raw, (H) => p({ progress: H }));
|
|
1433
|
-
|
|
1434
|
+
f.value = [...f.value, j], r.value = r.value.filter((H) => H.id !== g.id);
|
|
1434
1435
|
} catch (j) {
|
|
1435
|
-
p({ status: "error", error:
|
|
1436
|
+
p({ status: "error", error: y(j) });
|
|
1436
1437
|
}
|
|
1437
1438
|
}
|
|
1438
1439
|
}
|
|
1439
1440
|
async function L() {
|
|
1440
1441
|
const N = w.value, c = s.value.trim();
|
|
1441
1442
|
if (!(N === null || c === "")) {
|
|
1442
|
-
|
|
1443
|
+
l.value = !0;
|
|
1443
1444
|
try {
|
|
1444
|
-
|
|
1445
|
+
f.value = [...f.value, await i.addImage(N, c)], s.value = "";
|
|
1445
1446
|
} catch (g) {
|
|
1446
|
-
|
|
1447
|
+
O.danger(`${t("panel.gallery-failed")} ${y(g)}`);
|
|
1447
1448
|
} finally {
|
|
1448
|
-
|
|
1449
|
+
l.value = !1;
|
|
1449
1450
|
}
|
|
1450
1451
|
}
|
|
1451
1452
|
}
|
|
1452
1453
|
async function U(N) {
|
|
1453
1454
|
const c = w.value;
|
|
1454
|
-
if (!(c === null || !await
|
|
1455
|
-
title:
|
|
1456
|
-
message:
|
|
1457
|
-
confirmText:
|
|
1458
|
-
cancelText:
|
|
1455
|
+
if (!(c === null || !await ve({
|
|
1456
|
+
title: t("panel.gallery-remove-title"),
|
|
1457
|
+
message: t("panel.gallery-remove-text"),
|
|
1458
|
+
confirmText: t("panel.delete"),
|
|
1459
|
+
cancelText: t("panel.cancel"),
|
|
1459
1460
|
tone: "danger"
|
|
1460
1461
|
})))
|
|
1461
1462
|
try {
|
|
1462
|
-
await i.removeImage(c, N.id),
|
|
1463
|
+
await i.removeImage(c, N.id), f.value = f.value.filter((p) => p.id !== N.id), O.success(t("panel.gallery-removed"));
|
|
1463
1464
|
} catch (p) {
|
|
1464
|
-
|
|
1465
|
+
O.danger(y(p));
|
|
1465
1466
|
}
|
|
1466
1467
|
}
|
|
1467
1468
|
return Te(() => {
|
|
1468
|
-
x !== void 0 &&
|
|
1469
|
-
}), (N, c) => (v(), B("div",
|
|
1470
|
-
e(
|
|
1471
|
-
b.value &&
|
|
1469
|
+
x !== void 0 && P(f.value) !== C && S(""), clearTimeout(x);
|
|
1470
|
+
}), (N, c) => (v(), B("div", Oa, [
|
|
1471
|
+
e(m) ? (v(), B(ee, { key: 1 }, [
|
|
1472
|
+
b.value && f.value.length === 0 ? (v(), V(e(We), {
|
|
1472
1473
|
key: 0,
|
|
1473
1474
|
type: "info",
|
|
1474
1475
|
variant: "soft",
|
|
1475
|
-
description: e(
|
|
1476
|
+
description: e(t)("panel.gallery-locked")
|
|
1476
1477
|
}, null, 8, ["description"])) : M("", !0),
|
|
1477
|
-
|
|
1478
|
+
f.value.length > 0 ? (v(), V(e(Pt), {
|
|
1478
1479
|
key: 1,
|
|
1479
|
-
modelValue:
|
|
1480
|
-
"onUpdate:modelValue": c[0] || (c[0] = (g) =>
|
|
1480
|
+
modelValue: f.value,
|
|
1481
|
+
"onUpdate:modelValue": c[0] || (c[0] = (g) => f.value = g),
|
|
1481
1482
|
class: "wx-catalog-gallery__list",
|
|
1482
1483
|
"item-key": "id",
|
|
1483
1484
|
"item-label": (g) => g.path.split("/").pop() ?? String(g.id),
|
|
1484
1485
|
disabled: b.value,
|
|
1485
|
-
title: e(
|
|
1486
|
+
title: e(t)("panel.gallery-order"),
|
|
1486
1487
|
onMove: F
|
|
1487
1488
|
}, {
|
|
1488
1489
|
default: o(({ item: g, index: p }) => [
|
|
@@ -1504,51 +1505,32 @@ const xa = /* @__PURE__ */ le({
|
|
|
1504
1505
|
size: "sm"
|
|
1505
1506
|
}, {
|
|
1506
1507
|
default: o(() => [
|
|
1507
|
-
|
|
1508
|
+
W(k(e(t)("panel.gallery-main")), 1)
|
|
1508
1509
|
]),
|
|
1509
1510
|
_: 1
|
|
1510
|
-
})) : M("", !0)
|
|
1511
|
+
})) : M("", !0),
|
|
1512
|
+
g.width && g.height ? (v(), B("span", La, k(g.width) + "×" + k(g.height), 1)) : M("", !0)
|
|
1511
1513
|
], 8, Ra),
|
|
1512
|
-
G("div",
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
}, {
|
|
1517
|
-
default: o(() => [
|
|
1518
|
-
k(e(he), {
|
|
1519
|
-
"model-value": g.alt,
|
|
1520
|
-
localized: "",
|
|
1521
|
-
size: "sm",
|
|
1522
|
-
disabled: b.value,
|
|
1523
|
-
"onUpdate:modelValue": (j) => q(g, "alt", j)
|
|
1524
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
1525
|
-
]),
|
|
1526
|
-
_: 2
|
|
1527
|
-
}, 1032, ["label", "help"]),
|
|
1528
|
-
k(e(de), {
|
|
1529
|
-
label: e(l)("panel.gallery-title")
|
|
1530
|
-
}, {
|
|
1531
|
-
default: o(() => [
|
|
1532
|
-
k(e(he), {
|
|
1533
|
-
"model-value": g.title,
|
|
1534
|
-
localized: "",
|
|
1535
|
-
size: "sm",
|
|
1536
|
-
disabled: b.value,
|
|
1537
|
-
"onUpdate:modelValue": (j) => q(g, "title", j)
|
|
1538
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
1539
|
-
]),
|
|
1540
|
-
_: 2
|
|
1541
|
-
}, 1032, ["label"]),
|
|
1542
|
-
g.width && g.height ? (v(), V(e(J), {
|
|
1543
|
-
key: 0,
|
|
1514
|
+
G("div", Ma, [
|
|
1515
|
+
_(e(fe), {
|
|
1516
|
+
"model-value": g.alt,
|
|
1517
|
+
localized: "",
|
|
1544
1518
|
size: "sm",
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1519
|
+
placeholder: e(t)("panel.gallery-alt"),
|
|
1520
|
+
"aria-label": e(t)("panel.gallery-alt"),
|
|
1521
|
+
title: e(t)("panel.gallery-alt-help"),
|
|
1522
|
+
disabled: b.value,
|
|
1523
|
+
"onUpdate:modelValue": (j) => q(g, "alt", j)
|
|
1524
|
+
}, null, 8, ["model-value", "placeholder", "aria-label", "title", "disabled", "onUpdate:modelValue"]),
|
|
1525
|
+
_(e(fe), {
|
|
1526
|
+
"model-value": g.title,
|
|
1527
|
+
localized: "",
|
|
1528
|
+
size: "sm",
|
|
1529
|
+
placeholder: e(t)("panel.gallery-title"),
|
|
1530
|
+
"aria-label": e(t)("panel.gallery-title"),
|
|
1531
|
+
disabled: b.value,
|
|
1532
|
+
"onUpdate:modelValue": (j) => q(g, "title", j)
|
|
1533
|
+
}, null, 8, ["model-value", "placeholder", "aria-label", "disabled", "onUpdate:modelValue"])
|
|
1552
1534
|
])
|
|
1553
1535
|
])
|
|
1554
1536
|
]),
|
|
@@ -1557,7 +1539,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1557
1539
|
key: 0,
|
|
1558
1540
|
type: "remove",
|
|
1559
1541
|
size: "sm",
|
|
1560
|
-
title: e(
|
|
1542
|
+
title: e(t)("panel.delete"),
|
|
1561
1543
|
onClick: (p) => U(g)
|
|
1562
1544
|
}, null, 8, ["title", "onClick"]))
|
|
1563
1545
|
]),
|
|
@@ -1567,121 +1549,122 @@ const xa = /* @__PURE__ */ le({
|
|
|
1567
1549
|
tone: "muted"
|
|
1568
1550
|
}, {
|
|
1569
1551
|
default: o(() => [
|
|
1570
|
-
|
|
1552
|
+
W(k(e(t)("panel.gallery-empty")), 1)
|
|
1571
1553
|
]),
|
|
1572
1554
|
_: 1
|
|
1573
1555
|
})),
|
|
1574
1556
|
b.value ? M("", !0) : (v(), B(ee, { key: 3 }, [
|
|
1575
|
-
|
|
1557
|
+
_(e(la), {
|
|
1576
1558
|
modelValue: r.value,
|
|
1577
1559
|
"onUpdate:modelValue": c[1] || (c[1] = (g) => r.value = g),
|
|
1578
1560
|
accept: "image/jpeg,image/png,image/webp,image/gif",
|
|
1579
1561
|
multiple: "",
|
|
1580
|
-
"button-text": e(
|
|
1581
|
-
hint: e(
|
|
1582
|
-
onAdd:
|
|
1562
|
+
"button-text": e(t)("panel.gallery-add"),
|
|
1563
|
+
hint: e(t)("panel.gallery-hint"),
|
|
1564
|
+
onAdd: E
|
|
1583
1565
|
}, null, 8, ["modelValue", "button-text", "hint"]),
|
|
1584
|
-
|
|
1585
|
-
|
|
1566
|
+
_(e(tt), {
|
|
1567
|
+
title: e(t)("panel.gallery-url")
|
|
1586
1568
|
}, {
|
|
1587
1569
|
default: o(() => [
|
|
1588
|
-
G("div",
|
|
1589
|
-
|
|
1570
|
+
G("div", ja, [
|
|
1571
|
+
_(e(fe), {
|
|
1590
1572
|
modelValue: s.value,
|
|
1591
1573
|
"onUpdate:modelValue": c[2] || (c[2] = (g) => s.value = g),
|
|
1592
1574
|
type: "url",
|
|
1593
1575
|
size: "sm",
|
|
1594
1576
|
placeholder: "https://",
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1577
|
+
"aria-label": e(t)("panel.gallery-url"),
|
|
1578
|
+
onKeydown: Ke(pt(L, ["prevent"]), ["enter"])
|
|
1579
|
+
}, null, 8, ["modelValue", "aria-label", "onKeydown"]),
|
|
1580
|
+
_(e(Q), {
|
|
1598
1581
|
size: "sm",
|
|
1599
1582
|
variant: "outline",
|
|
1600
|
-
loading:
|
|
1583
|
+
loading: l.value,
|
|
1601
1584
|
disabled: s.value.trim() === "",
|
|
1602
1585
|
onClick: L
|
|
1603
1586
|
}, {
|
|
1604
1587
|
default: o(() => [
|
|
1605
|
-
|
|
1588
|
+
W(k(e(t)("panel.gallery-url-add")), 1)
|
|
1606
1589
|
]),
|
|
1607
1590
|
_: 1
|
|
1608
1591
|
}, 8, ["loading", "disabled"])
|
|
1609
1592
|
])
|
|
1610
1593
|
]),
|
|
1611
1594
|
_: 1
|
|
1612
|
-
}, 8, ["
|
|
1595
|
+
}, 8, ["title"])
|
|
1613
1596
|
], 64))
|
|
1614
1597
|
], 64)) : (v(), V(e(We), {
|
|
1615
1598
|
key: 0,
|
|
1616
1599
|
type: "info",
|
|
1617
1600
|
variant: "soft",
|
|
1618
|
-
description: e(
|
|
1601
|
+
description: e(t)("panel.gallery-empty")
|
|
1619
1602
|
}, null, 8, ["description"]))
|
|
1620
1603
|
]));
|
|
1621
1604
|
}
|
|
1622
|
-
}),
|
|
1605
|
+
}), Ha = /* @__PURE__ */ de(Ga, [["__scopeId", "data-v-695c0f5d"]]), Ja = /* @__PURE__ */ le({
|
|
1623
1606
|
name: "WxCatalogProductEditor",
|
|
1624
1607
|
__name: "ProductEditorPage",
|
|
1625
1608
|
props: {
|
|
1626
1609
|
base: { default: "/catalog" }
|
|
1627
1610
|
},
|
|
1628
1611
|
setup(n) {
|
|
1629
|
-
const
|
|
1612
|
+
const a = n, i = ae(), m = ne(i), t = ze(), y = $e(), r = Ue();
|
|
1630
1613
|
oe();
|
|
1631
|
-
const s = te("webx-catalog"),
|
|
1614
|
+
const s = te("webx-catalog"), l = ge(), w = h(() => Number(t.params.id)), b = h(() => `${a.base}/products`), f = D(null), x = D({}), C = D([]), P = D(""), S = D(!0), q = D(!1), F = D({}), E = D(null), L = h(() => i.can("catalog.manage")), U = h(() => i.can("catalog.delete")), N = h(() => !L.value || q.value), c = h(() => JSON.stringify(x.value)), g = h(() => P.value !== "" && c.value !== P.value), p = h(() => q.value ? "saving" : g.value ? "unsaved" : "saved"), j = h(
|
|
1632
1615
|
() => i.state.manifest?.modules.find(($) => $.id === "catalog")?.title ?? s("module.title")
|
|
1633
1616
|
), H = h(() => {
|
|
1634
1617
|
const $ = x.value.name;
|
|
1635
|
-
return
|
|
1618
|
+
return $t($, r.active.value, f.value?.name ?? "") || s("panel.untitled");
|
|
1636
1619
|
}), se = h(() => {
|
|
1637
|
-
const $ =
|
|
1620
|
+
const $ = f.value;
|
|
1638
1621
|
if ($)
|
|
1639
1622
|
return $.is_published && !$.visible ? s("panel.invisible") : $.sku ?? void 0;
|
|
1640
1623
|
});
|
|
1641
|
-
ba({ product:
|
|
1624
|
+
ba({ product: f, images: C, locked: N }), ft({ id: h(() => f.value?.id ?? null) }), ht({
|
|
1642
1625
|
values: x,
|
|
1643
1626
|
prefix: D(""),
|
|
1644
|
-
path: h(() => Ve(
|
|
1627
|
+
path: h(() => Ve(f.value?.url)?.replace(new RegExp(`-${f.value?.id}$`), "") ?? null),
|
|
1645
1628
|
moving: () => s("panel.address-moving")
|
|
1646
1629
|
});
|
|
1647
1630
|
function X($) {
|
|
1648
|
-
|
|
1631
|
+
f.value = $.product, x.value = $.values, C.value = $.images, P.value = JSON.stringify($.values);
|
|
1649
1632
|
}
|
|
1650
1633
|
async function re() {
|
|
1651
1634
|
S.value = !0;
|
|
1652
1635
|
try {
|
|
1653
|
-
X(await
|
|
1636
|
+
X(await m.product(w.value));
|
|
1654
1637
|
} catch ($) {
|
|
1655
|
-
|
|
1638
|
+
O.danger(l($)), y.push(b.value);
|
|
1656
1639
|
} finally {
|
|
1657
1640
|
S.value = !1;
|
|
1658
1641
|
}
|
|
1659
1642
|
}
|
|
1660
1643
|
async function ue() {
|
|
1661
|
-
if (!(!
|
|
1662
|
-
q.value = !0, F.value = {},
|
|
1644
|
+
if (!(!f.value || q.value || !L.value)) {
|
|
1645
|
+
q.value = !0, F.value = {}, E.value = null;
|
|
1663
1646
|
try {
|
|
1664
|
-
X(await
|
|
1647
|
+
X(await m.saveProduct(f.value.id, x.value)), O.success(s("panel.saved"));
|
|
1665
1648
|
} catch ($) {
|
|
1666
1649
|
const R = $.body;
|
|
1667
|
-
R?.errors && Object.keys(R.errors).length > 0 ? (F.value = R.errors,
|
|
1650
|
+
R?.errors && Object.keys(R.errors).length > 0 ? (F.value = R.errors, E.value = R.meta?.taken_by ?? null, O.danger(s("panel.save-failed"))) : O.danger(l($));
|
|
1668
1651
|
} finally {
|
|
1669
1652
|
q.value = !1;
|
|
1670
1653
|
}
|
|
1671
1654
|
}
|
|
1672
1655
|
}
|
|
1673
1656
|
const ce = h(() => {
|
|
1674
|
-
const $ =
|
|
1657
|
+
const $ = E.value;
|
|
1675
1658
|
if (!$) return null;
|
|
1676
1659
|
if ($.deleted) {
|
|
1677
1660
|
const R = typeof x.value.sku == "string" ? x.value.sku : "";
|
|
1678
|
-
return { path: `${
|
|
1661
|
+
return { path: `${a.base}/deleted`, query: R ? { q: R } : {} };
|
|
1679
1662
|
}
|
|
1680
|
-
return { path: `${
|
|
1663
|
+
return { path: `${a.base}/products/${$.id}` };
|
|
1681
1664
|
});
|
|
1682
1665
|
async function z() {
|
|
1683
|
-
const $ =
|
|
1684
|
-
if (!(!$ || !await
|
|
1666
|
+
const $ = f.value;
|
|
1667
|
+
if (!(!$ || !await ve({
|
|
1685
1668
|
title: s("panel.delete-product-title", { name: $.name }),
|
|
1686
1669
|
message: s("panel.delete-product-text"),
|
|
1687
1670
|
confirmText: s("panel.delete"),
|
|
@@ -1689,9 +1672,9 @@ const xa = /* @__PURE__ */ le({
|
|
|
1689
1672
|
tone: "danger"
|
|
1690
1673
|
})))
|
|
1691
1674
|
try {
|
|
1692
|
-
await
|
|
1693
|
-
} catch (
|
|
1694
|
-
|
|
1675
|
+
await m.removeProduct($.id), O.success(s("panel.product-deleted")), P.value = c.value, y.push(b.value);
|
|
1676
|
+
} catch (pe) {
|
|
1677
|
+
O.danger(l(pe));
|
|
1695
1678
|
}
|
|
1696
1679
|
}
|
|
1697
1680
|
function I($) {
|
|
@@ -1700,13 +1683,13 @@ const xa = /* @__PURE__ */ le({
|
|
|
1700
1683
|
function Z($) {
|
|
1701
1684
|
($.ctrlKey || $.metaKey) && $.key.toLowerCase() === "s" && ($.preventDefault(), g.value && ue());
|
|
1702
1685
|
}
|
|
1703
|
-
|
|
1686
|
+
bt(Z), we(w, () => {
|
|
1704
1687
|
re();
|
|
1705
1688
|
}), ie(() => {
|
|
1706
1689
|
re(), window.addEventListener("beforeunload", I);
|
|
1707
1690
|
}), Te(() => {
|
|
1708
1691
|
window.removeEventListener("beforeunload", I);
|
|
1709
|
-
}), mt(async () => !g.value || !L.value ? !0 : await
|
|
1692
|
+
}), mt(async () => !g.value || !L.value ? !0 : await ve({
|
|
1710
1693
|
title: s("panel.leave-title"),
|
|
1711
1694
|
message: s("panel.leave-text"),
|
|
1712
1695
|
confirmText: s("panel.leave"),
|
|
@@ -1714,7 +1697,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1714
1697
|
tone: "danger"
|
|
1715
1698
|
}));
|
|
1716
1699
|
const T = h(() => {
|
|
1717
|
-
const $ =
|
|
1700
|
+
const $ = f.value, R = [];
|
|
1718
1701
|
return $ && ($.url && R.push({ key: "site", label: s("panel.open-on-site"), icon: "link", href: $.url }), U.value && R.push({
|
|
1719
1702
|
key: "delete",
|
|
1720
1703
|
label: s("panel.delete"),
|
|
@@ -1730,20 +1713,20 @@ const xa = /* @__PURE__ */ le({
|
|
|
1730
1713
|
class: "wx-catalog-product",
|
|
1731
1714
|
onKeydown: Z
|
|
1732
1715
|
}, [
|
|
1733
|
-
S.value || !
|
|
1734
|
-
|
|
1716
|
+
S.value || !f.value ? (v(), B(ee, { key: 0 }, [
|
|
1717
|
+
_(e(xe), {
|
|
1735
1718
|
class: "wx-catalog-product__ghost",
|
|
1736
1719
|
title: "",
|
|
1737
1720
|
rows: 1
|
|
1738
1721
|
}),
|
|
1739
|
-
|
|
1722
|
+
_(e(tt), null, {
|
|
1740
1723
|
default: o(() => [
|
|
1741
|
-
|
|
1724
|
+
_(e(xe), { rows: 8 })
|
|
1742
1725
|
]),
|
|
1743
1726
|
_: 1
|
|
1744
1727
|
})
|
|
1745
1728
|
], 64)) : (v(), B(ee, { key: 1 }, [
|
|
1746
|
-
|
|
1729
|
+
_(e(kt), {
|
|
1747
1730
|
divider: "",
|
|
1748
1731
|
back: b.value,
|
|
1749
1732
|
"back-label": e(s)("module.products"),
|
|
@@ -1752,34 +1735,34 @@ const xa = /* @__PURE__ */ le({
|
|
|
1752
1735
|
actions: T.value
|
|
1753
1736
|
}, {
|
|
1754
1737
|
trail: o(() => [
|
|
1755
|
-
|
|
1738
|
+
_(e(Ct), {
|
|
1756
1739
|
size: "sm",
|
|
1757
1740
|
label: e(s)("panel.product-trail")
|
|
1758
1741
|
}, {
|
|
1759
1742
|
default: o(() => [
|
|
1760
|
-
|
|
1743
|
+
_(e(he), {
|
|
1761
1744
|
as: "router-link",
|
|
1762
1745
|
to: b.value
|
|
1763
1746
|
}, {
|
|
1764
1747
|
default: o(() => [
|
|
1765
|
-
|
|
1748
|
+
W(k(j.value), 1)
|
|
1766
1749
|
]),
|
|
1767
1750
|
_: 1
|
|
1768
1751
|
}, 8, ["to"]),
|
|
1769
|
-
|
|
1752
|
+
f.value.category ? (v(), V(e(he), {
|
|
1770
1753
|
key: 0,
|
|
1771
1754
|
current: ""
|
|
1772
1755
|
}, {
|
|
1773
1756
|
default: o(() => [
|
|
1774
|
-
|
|
1757
|
+
W(k(f.value.category.name), 1)
|
|
1775
1758
|
]),
|
|
1776
1759
|
_: 1
|
|
1777
|
-
})) : (v(), V(e(
|
|
1760
|
+
})) : (v(), V(e(he), {
|
|
1778
1761
|
key: 1,
|
|
1779
1762
|
current: ""
|
|
1780
1763
|
}, {
|
|
1781
1764
|
default: o(() => [
|
|
1782
|
-
|
|
1765
|
+
W(k(e(s)("product.no-category")), 1)
|
|
1783
1766
|
]),
|
|
1784
1767
|
_: 1
|
|
1785
1768
|
}))
|
|
@@ -1788,69 +1771,69 @@ const xa = /* @__PURE__ */ le({
|
|
|
1788
1771
|
}, 8, ["label"])
|
|
1789
1772
|
]),
|
|
1790
1773
|
"title-after": o(() => [
|
|
1791
|
-
|
|
1792
|
-
type:
|
|
1774
|
+
_(e(Y), {
|
|
1775
|
+
type: f.value.is_published ? f.value.visible ? "success" : "warning" : "default",
|
|
1793
1776
|
dot: ""
|
|
1794
1777
|
}, {
|
|
1795
1778
|
default: o(() => [
|
|
1796
|
-
|
|
1779
|
+
W(k(e(s)(`states.${f.value.state}`)), 1)
|
|
1797
1780
|
]),
|
|
1798
1781
|
_: 1
|
|
1799
1782
|
}, 8, ["type"]),
|
|
1800
|
-
|
|
1783
|
+
f.value.category ? M("", !0) : (v(), V(e(Y), {
|
|
1801
1784
|
key: 0,
|
|
1802
1785
|
type: "warning",
|
|
1803
1786
|
round: ""
|
|
1804
1787
|
}, {
|
|
1805
1788
|
default: o(() => [
|
|
1806
|
-
|
|
1789
|
+
W(k(e(s)("product.no-category")), 1)
|
|
1807
1790
|
]),
|
|
1808
1791
|
_: 1
|
|
1809
1792
|
}))
|
|
1810
1793
|
]),
|
|
1811
1794
|
_: 1
|
|
1812
1795
|
}, 8, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
1813
|
-
|
|
1796
|
+
E.value && ce.value ? (v(), V(e(We), {
|
|
1814
1797
|
key: 0,
|
|
1815
1798
|
type: "warning",
|
|
1816
1799
|
description: F.value.sku?.[0] ?? "",
|
|
1817
1800
|
closable: "",
|
|
1818
|
-
onClose: R[1] || (R[1] = (
|
|
1801
|
+
onClose: R[1] || (R[1] = (pe) => E.value = null)
|
|
1819
1802
|
}, {
|
|
1820
1803
|
actions: o(() => [
|
|
1821
|
-
|
|
1804
|
+
_(e(Q), {
|
|
1822
1805
|
size: "sm",
|
|
1823
1806
|
variant: "outline",
|
|
1824
|
-
onClick: R[0] || (R[0] = (
|
|
1807
|
+
onClick: R[0] || (R[0] = (pe) => e(y).push(ce.value))
|
|
1825
1808
|
}, {
|
|
1826
1809
|
default: o(() => [
|
|
1827
|
-
|
|
1810
|
+
W(k(E.value.deleted ? e(s)("panel.sku-open-deleted") : e(s)("panel.sku-open")), 1)
|
|
1828
1811
|
]),
|
|
1829
1812
|
_: 1
|
|
1830
1813
|
})
|
|
1831
1814
|
]),
|
|
1832
1815
|
_: 1
|
|
1833
1816
|
}, 8, ["description"])) : M("", !0),
|
|
1834
|
-
|
|
1817
|
+
_(e(_t), {
|
|
1835
1818
|
modelValue: x.value,
|
|
1836
|
-
"onUpdate:modelValue": R[2] || (R[2] = (
|
|
1819
|
+
"onUpdate:modelValue": R[2] || (R[2] = (pe) => x.value = pe),
|
|
1837
1820
|
name: "catalog.product-form",
|
|
1838
1821
|
errors: F.value,
|
|
1839
1822
|
disabled: N.value
|
|
1840
1823
|
}, null, 8, ["modelValue", "errors", "disabled"]),
|
|
1841
1824
|
L.value ? (v(), V(e(St), { key: 1 }, {
|
|
1842
1825
|
state: o(() => [
|
|
1843
|
-
|
|
1826
|
+
_(e(wt), { state: p.value }, null, 8, ["state"])
|
|
1844
1827
|
]),
|
|
1845
1828
|
default: o(() => [
|
|
1846
|
-
|
|
1829
|
+
_(e(Q), {
|
|
1847
1830
|
type: "primary",
|
|
1848
1831
|
loading: q.value,
|
|
1849
1832
|
disabled: !g.value,
|
|
1850
1833
|
onClick: ue
|
|
1851
1834
|
}, {
|
|
1852
1835
|
default: o(() => [
|
|
1853
|
-
|
|
1836
|
+
W(k(e(s)("panel.save")), 1)
|
|
1854
1837
|
]),
|
|
1855
1838
|
_: 1
|
|
1856
1839
|
}, 8, ["loading", "disabled"])
|
|
@@ -1860,60 +1843,60 @@ const xa = /* @__PURE__ */ le({
|
|
|
1860
1843
|
], 64))
|
|
1861
1844
|
], 32));
|
|
1862
1845
|
}
|
|
1863
|
-
}),
|
|
1846
|
+
}), Xa = /* @__PURE__ */ de(Ja, [["__scopeId", "data-v-837dd378"]]), Qa = /* @__PURE__ */ le({
|
|
1864
1847
|
__name: "BulkParamsDialog",
|
|
1865
1848
|
props: {
|
|
1866
1849
|
action: {},
|
|
1867
1850
|
count: {}
|
|
1868
1851
|
},
|
|
1869
1852
|
setup(n) {
|
|
1870
|
-
const
|
|
1853
|
+
const a = n, { open: i, resolve: m, dismiss: t } = Xe(), y = ae(), r = ye(y);
|
|
1871
1854
|
oe();
|
|
1872
|
-
const s = te("webx-catalog"),
|
|
1873
|
-
() =>
|
|
1874
|
-
(C) => !C.rules?.includes("required") ||
|
|
1855
|
+
const s = te("webx-catalog"), l = Qt({}), w = h(
|
|
1856
|
+
() => a.action.params.every(
|
|
1857
|
+
(C) => !C.rules?.includes("required") || l[C.name] !== void 0 && l[C.name] !== null && l[C.name] !== ""
|
|
1875
1858
|
)
|
|
1876
1859
|
);
|
|
1877
1860
|
ie(() => {
|
|
1878
|
-
|
|
1861
|
+
a.action.params.some((C) => C.type === "category") && r.load().catch(() => {
|
|
1879
1862
|
});
|
|
1880
1863
|
});
|
|
1881
1864
|
function b(C) {
|
|
1882
1865
|
return Array.isArray(C.values) ? C.values.map(
|
|
1883
|
-
(
|
|
1866
|
+
(P) => typeof P == "object" ? { value: P.value, label: P.label } : { value: P, label: String(P) }
|
|
1884
1867
|
) : [];
|
|
1885
1868
|
}
|
|
1886
|
-
function
|
|
1887
|
-
|
|
1869
|
+
function f(C, P) {
|
|
1870
|
+
l[C.name] = Array.isArray(P) ? P[0] ?? null : P;
|
|
1888
1871
|
}
|
|
1889
1872
|
function x() {
|
|
1890
|
-
w.value &&
|
|
1873
|
+
w.value && m({ ...l });
|
|
1891
1874
|
}
|
|
1892
|
-
return (C,
|
|
1875
|
+
return (C, P) => (v(), V(e(Qe), {
|
|
1893
1876
|
open: e(i),
|
|
1894
|
-
"onUpdate:open":
|
|
1877
|
+
"onUpdate:open": P[1] || (P[1] = (S) => je(i) ? i.value = S : null),
|
|
1895
1878
|
title: e(s)("panel.bulk-confirm-title", { action: n.action.label }),
|
|
1896
1879
|
width: 440
|
|
1897
1880
|
}, {
|
|
1898
1881
|
footer: o(() => [
|
|
1899
|
-
|
|
1882
|
+
_(e(Ye), { size: "sm" }, {
|
|
1900
1883
|
default: o(() => [
|
|
1901
|
-
|
|
1884
|
+
_(e(Q), {
|
|
1902
1885
|
variant: "outline",
|
|
1903
|
-
onClick:
|
|
1886
|
+
onClick: P[0] || (P[0] = (S) => e(t)())
|
|
1904
1887
|
}, {
|
|
1905
1888
|
default: o(() => [
|
|
1906
|
-
|
|
1889
|
+
W(k(e(s)("panel.cancel")), 1)
|
|
1907
1890
|
]),
|
|
1908
1891
|
_: 1
|
|
1909
1892
|
}),
|
|
1910
|
-
|
|
1893
|
+
_(e(Q), {
|
|
1911
1894
|
type: n.action.permission === "catalog.delete" && !n.action.trashed ? "danger" : "primary",
|
|
1912
1895
|
disabled: !w.value,
|
|
1913
1896
|
onClick: x
|
|
1914
1897
|
}, {
|
|
1915
1898
|
default: o(() => [
|
|
1916
|
-
|
|
1899
|
+
W(k(e(s)("panel.bulk-apply")), 1)
|
|
1917
1900
|
]),
|
|
1918
1901
|
_: 1
|
|
1919
1902
|
}, 8, ["type", "disabled"])
|
|
@@ -1922,16 +1905,16 @@ const xa = /* @__PURE__ */ le({
|
|
|
1922
1905
|
})
|
|
1923
1906
|
]),
|
|
1924
1907
|
default: o(() => [
|
|
1925
|
-
|
|
1908
|
+
_(e(J), {
|
|
1926
1909
|
tone: "muted",
|
|
1927
1910
|
size: "sm"
|
|
1928
1911
|
}, {
|
|
1929
1912
|
default: o(() => [
|
|
1930
|
-
|
|
1913
|
+
W(k(e(s)("panel.bulk-confirm-text", { count: n.count })), 1)
|
|
1931
1914
|
]),
|
|
1932
1915
|
_: 1
|
|
1933
1916
|
}),
|
|
1934
|
-
(v(!0), B(ee, null,
|
|
1917
|
+
(v(!0), B(ee, null, be(n.action.params, (S) => (v(), V(e(ke), {
|
|
1935
1918
|
key: S.name,
|
|
1936
1919
|
label: S.label,
|
|
1937
1920
|
required: S.rules?.includes("required"),
|
|
@@ -1940,7 +1923,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
1940
1923
|
default: o(() => [
|
|
1941
1924
|
S.type === "category" ? (v(), V(e(De), {
|
|
1942
1925
|
key: 0,
|
|
1943
|
-
"model-value":
|
|
1926
|
+
"model-value": l[S.name] ?? null,
|
|
1944
1927
|
nodes: e(r).nodes.value ?? [],
|
|
1945
1928
|
"node-key": "id",
|
|
1946
1929
|
"label-key": "name",
|
|
@@ -1949,17 +1932,17 @@ const xa = /* @__PURE__ */ le({
|
|
|
1949
1932
|
filterable: "",
|
|
1950
1933
|
"filter-placeholder": e(s)("panel.search-categories"),
|
|
1951
1934
|
"aria-label": S.label,
|
|
1952
|
-
"onUpdate:modelValue": (q) =>
|
|
1935
|
+
"onUpdate:modelValue": (q) => f(S, q)
|
|
1953
1936
|
}, null, 8, ["model-value", "nodes", "filter-placeholder", "aria-label", "onUpdate:modelValue"])) : Array.isArray(S.values) ? (v(), V(e(Re), {
|
|
1954
1937
|
key: 1,
|
|
1955
|
-
"model-value":
|
|
1938
|
+
"model-value": l[S.name] ?? null,
|
|
1956
1939
|
options: b(S),
|
|
1957
1940
|
"aria-label": S.label,
|
|
1958
|
-
"onUpdate:modelValue": (q) =>
|
|
1959
|
-
}, null, 8, ["model-value", "options", "aria-label", "onUpdate:modelValue"])) : (v(), V(e(
|
|
1941
|
+
"onUpdate:modelValue": (q) => l[S.name] = q
|
|
1942
|
+
}, null, 8, ["model-value", "options", "aria-label", "onUpdate:modelValue"])) : (v(), V(e(fe), {
|
|
1960
1943
|
key: 2,
|
|
1961
|
-
modelValue:
|
|
1962
|
-
"onUpdate:modelValue": (q) =>
|
|
1944
|
+
modelValue: l[S.name],
|
|
1945
|
+
"onUpdate:modelValue": (q) => l[S.name] = q,
|
|
1963
1946
|
"aria-label": S.label
|
|
1964
1947
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "aria-label"]))
|
|
1965
1948
|
]),
|
|
@@ -1969,35 +1952,35 @@ const xa = /* @__PURE__ */ le({
|
|
|
1969
1952
|
_: 1
|
|
1970
1953
|
}, 8, ["open", "title"]));
|
|
1971
1954
|
}
|
|
1972
|
-
}),
|
|
1955
|
+
}), Ya = /* @__PURE__ */ de(Qa, [["__scopeId", "data-v-b83c3fb0"]]), Za = { class: "wx-catalog-bulk" }, el = {
|
|
1973
1956
|
key: 1,
|
|
1974
1957
|
class: "wx-catalog-bulk__progress",
|
|
1975
1958
|
role: "status"
|
|
1976
|
-
},
|
|
1959
|
+
}, tl = {
|
|
1977
1960
|
key: 2,
|
|
1978
1961
|
class: "wx-catalog-bulk__refused"
|
|
1979
|
-
},
|
|
1962
|
+
}, al = { class: "wx-catalog-bulk__errors" }, it = 1500, ll = /* @__PURE__ */ le({
|
|
1980
1963
|
__name: "BulkBar",
|
|
1981
1964
|
props: {
|
|
1982
1965
|
count: {},
|
|
1983
1966
|
selection: {}
|
|
1984
1967
|
},
|
|
1985
1968
|
emits: ["finished"],
|
|
1986
|
-
setup(n, { emit:
|
|
1987
|
-
const i = n,
|
|
1969
|
+
setup(n, { emit: a }) {
|
|
1970
|
+
const i = n, m = a, t = ae(), y = ne(t);
|
|
1988
1971
|
oe();
|
|
1989
|
-
const r = te("webx-catalog"), s =
|
|
1990
|
-
|
|
1991
|
-
), w = D([]), b = D(null),
|
|
1972
|
+
const r = te("webx-catalog"), s = ge(), l = Ze(
|
|
1973
|
+
Ya
|
|
1974
|
+
), w = D([]), b = D(null), f = D(!1);
|
|
1992
1975
|
let x;
|
|
1993
1976
|
const C = h(
|
|
1994
1977
|
() => b.value !== null && (b.value.status === "queued" || b.value.status === "running")
|
|
1995
|
-
),
|
|
1978
|
+
), P = h(
|
|
1996
1979
|
() => b.value !== null && !C.value && b.value.failed > 0 ? b.value : null
|
|
1997
1980
|
);
|
|
1998
1981
|
ie(async () => {
|
|
1999
1982
|
try {
|
|
2000
|
-
w.value = await
|
|
1983
|
+
w.value = await y.bulkActions();
|
|
2001
1984
|
} catch {
|
|
2002
1985
|
w.value = [];
|
|
2003
1986
|
}
|
|
@@ -2008,57 +1991,57 @@ const xa = /* @__PURE__ */ le({
|
|
|
2008
1991
|
async function q(U) {
|
|
2009
1992
|
let N = {};
|
|
2010
1993
|
if (S(U)) {
|
|
2011
|
-
const c = await
|
|
1994
|
+
const c = await l({ action: U, count: i.count });
|
|
2012
1995
|
if (!c) return;
|
|
2013
1996
|
N = c;
|
|
2014
1997
|
}
|
|
2015
|
-
|
|
1998
|
+
f.value = !0;
|
|
2016
1999
|
try {
|
|
2017
|
-
F(await
|
|
2000
|
+
F(await y.startBulk(U.key, N, i.selection));
|
|
2018
2001
|
} catch (c) {
|
|
2019
|
-
|
|
2002
|
+
O.danger(s(c));
|
|
2020
2003
|
} finally {
|
|
2021
|
-
|
|
2004
|
+
f.value = !1;
|
|
2022
2005
|
}
|
|
2023
2006
|
}
|
|
2024
2007
|
function F(U) {
|
|
2025
2008
|
if (b.value = U, U.status === "queued" || U.status === "running") {
|
|
2026
2009
|
x = setTimeout(() => {
|
|
2027
|
-
|
|
2028
|
-
},
|
|
2010
|
+
E(U.id);
|
|
2011
|
+
}, it);
|
|
2029
2012
|
return;
|
|
2030
2013
|
}
|
|
2031
2014
|
L(U);
|
|
2032
2015
|
}
|
|
2033
|
-
async function
|
|
2016
|
+
async function E(U) {
|
|
2034
2017
|
try {
|
|
2035
|
-
F(await
|
|
2018
|
+
F(await y.bulkRun(U));
|
|
2036
2019
|
} catch {
|
|
2037
2020
|
x = setTimeout(() => {
|
|
2038
|
-
|
|
2039
|
-
},
|
|
2021
|
+
E(U);
|
|
2022
|
+
}, it * 2);
|
|
2040
2023
|
}
|
|
2041
2024
|
}
|
|
2042
2025
|
function L(U) {
|
|
2043
|
-
U.total === 0 ?
|
|
2026
|
+
U.total === 0 ? O.warning(r("panel.bulk-nothing")) : U.status === "failed" ? O.danger(r("panel.bulk-stopped", { count: U.done })) : U.failed === 0 && O.success(r("panel.bulk-done", { count: U.done })), U.failed === 0 && U.status !== "failed" && (b.value = null), m(
|
|
2044
2027
|
"finished",
|
|
2045
2028
|
U.errors.map((N) => N.id)
|
|
2046
2029
|
);
|
|
2047
2030
|
}
|
|
2048
|
-
return (U, N) => (v(), B("div",
|
|
2031
|
+
return (U, N) => (v(), B("div", Za, [
|
|
2049
2032
|
w.value.length > 0 && !C.value ? (v(), V(e(na), {
|
|
2050
2033
|
key: 0,
|
|
2051
2034
|
align: "start"
|
|
2052
2035
|
}, {
|
|
2053
2036
|
trigger: o(() => [
|
|
2054
|
-
|
|
2037
|
+
_(e(Q), {
|
|
2055
2038
|
size: "sm",
|
|
2056
2039
|
variant: "outline",
|
|
2057
|
-
loading:
|
|
2040
|
+
loading: f.value
|
|
2058
2041
|
}, {
|
|
2059
2042
|
default: o(() => [
|
|
2060
|
-
|
|
2061
|
-
|
|
2043
|
+
W(k(e(r)("panel.bulk-actions")) + " ", 1),
|
|
2044
|
+
_(e(Be), {
|
|
2062
2045
|
name: "chevron-down",
|
|
2063
2046
|
size: "sm"
|
|
2064
2047
|
})
|
|
@@ -2067,86 +2050,86 @@ const xa = /* @__PURE__ */ le({
|
|
|
2067
2050
|
}, 8, ["loading"])
|
|
2068
2051
|
]),
|
|
2069
2052
|
default: o(() => [
|
|
2070
|
-
(v(!0), B(ee, null,
|
|
2053
|
+
(v(!0), B(ee, null, be(w.value, (c) => (v(), V(e(oa), {
|
|
2071
2054
|
key: c.key,
|
|
2072
2055
|
tone: c.permission === "catalog.delete" && !c.trashed ? "danger" : "default",
|
|
2073
2056
|
onClick: (g) => q(c)
|
|
2074
2057
|
}, {
|
|
2075
2058
|
default: o(() => [
|
|
2076
|
-
|
|
2059
|
+
W(k(c.label), 1)
|
|
2077
2060
|
]),
|
|
2078
2061
|
_: 2
|
|
2079
2062
|
}, 1032, ["tone", "onClick"]))), 128))
|
|
2080
2063
|
]),
|
|
2081
2064
|
_: 1
|
|
2082
2065
|
})) : M("", !0),
|
|
2083
|
-
C.value && b.value ? (v(), B("div",
|
|
2084
|
-
|
|
2066
|
+
C.value && b.value ? (v(), B("div", el, [
|
|
2067
|
+
_(e(sa), {
|
|
2085
2068
|
value: b.value.done + b.value.failed,
|
|
2086
2069
|
max: Math.max(1, b.value.total),
|
|
2087
2070
|
size: "sm",
|
|
2088
2071
|
"aria-label": b.value.label
|
|
2089
2072
|
}, null, 8, ["value", "max", "aria-label"]),
|
|
2090
|
-
|
|
2073
|
+
_(e(J), {
|
|
2091
2074
|
size: "sm",
|
|
2092
2075
|
tone: "muted"
|
|
2093
2076
|
}, {
|
|
2094
2077
|
default: o(() => [
|
|
2095
|
-
|
|
2078
|
+
W(k(b.value.label) + " · " + k(e(r)("panel.bulk-running", { done: b.value.done + b.value.failed, total: b.value.total })), 1)
|
|
2096
2079
|
]),
|
|
2097
2080
|
_: 1
|
|
2098
2081
|
})
|
|
2099
2082
|
])) : M("", !0),
|
|
2100
|
-
|
|
2101
|
-
|
|
2083
|
+
P.value ? (v(), B("div", tl, [
|
|
2084
|
+
_(e(J), {
|
|
2102
2085
|
size: "sm",
|
|
2103
2086
|
weight: "medium"
|
|
2104
2087
|
}, {
|
|
2105
2088
|
default: o(() => [
|
|
2106
|
-
|
|
2089
|
+
W(k(P.value.label) + " · " + k(e(r)("panel.bulk-done", { count: P.value.done })) + " · " + k(e(r)("panel.bulk-refused", { count: P.value.failed })), 1)
|
|
2107
2090
|
]),
|
|
2108
2091
|
_: 1
|
|
2109
2092
|
}),
|
|
2110
|
-
G("details",
|
|
2111
|
-
G("summary", null,
|
|
2093
|
+
G("details", al, [
|
|
2094
|
+
G("summary", null, k(e(r)("panel.bulk-errors")), 1),
|
|
2112
2095
|
G("ul", null, [
|
|
2113
|
-
(v(!0), B(ee, null,
|
|
2096
|
+
(v(!0), B(ee, null, be(P.value.errors, (c) => (v(), B("li", {
|
|
2114
2097
|
key: c.id
|
|
2115
2098
|
}, [
|
|
2116
|
-
G("strong", null,
|
|
2117
|
-
|
|
2099
|
+
G("strong", null, k(c.name), 1),
|
|
2100
|
+
W(" — " + k(c.message), 1)
|
|
2118
2101
|
]))), 128))
|
|
2119
2102
|
])
|
|
2120
2103
|
]),
|
|
2121
|
-
|
|
2104
|
+
_(e(Q), {
|
|
2122
2105
|
size: "sm",
|
|
2123
2106
|
variant: "text",
|
|
2124
2107
|
onClick: N[0] || (N[0] = (c) => b.value = null)
|
|
2125
2108
|
}, {
|
|
2126
2109
|
default: o(() => [
|
|
2127
|
-
|
|
2110
|
+
W(k(e(r)("panel.bulk-close")), 1)
|
|
2128
2111
|
]),
|
|
2129
2112
|
_: 1
|
|
2130
2113
|
})
|
|
2131
2114
|
])) : M("", !0)
|
|
2132
2115
|
]));
|
|
2133
2116
|
}
|
|
2134
|
-
}),
|
|
2117
|
+
}), nl = /* @__PURE__ */ de(ll, [["__scopeId", "data-v-94557c14"]]), ol = /* @__PURE__ */ le({
|
|
2135
2118
|
__name: "ProductCreateDialog",
|
|
2136
2119
|
setup(n) {
|
|
2137
|
-
const { open:
|
|
2120
|
+
const { open: a, resolve: i, dismiss: m } = Xe(), t = ae(), y = ne(t), r = Ue();
|
|
2138
2121
|
oe();
|
|
2139
|
-
const s = te("webx-catalog"),
|
|
2122
|
+
const s = te("webx-catalog"), l = D(""), w = D(!1), b = D({}), f = Me("field");
|
|
2140
2123
|
ie(async () => {
|
|
2141
|
-
await
|
|
2124
|
+
await dt(), f.value?.querySelector("input")?.focus();
|
|
2142
2125
|
});
|
|
2143
2126
|
async function x() {
|
|
2144
|
-
if (!(
|
|
2127
|
+
if (!(l.value.trim() === "" || w.value)) {
|
|
2145
2128
|
w.value = !0, b.value = {};
|
|
2146
2129
|
try {
|
|
2147
2130
|
i(
|
|
2148
|
-
await
|
|
2149
|
-
name: { [r.active.value]:
|
|
2131
|
+
await y.createProduct({
|
|
2132
|
+
name: { [r.active.value]: l.value.trim() },
|
|
2150
2133
|
is_published: !1
|
|
2151
2134
|
})
|
|
2152
2135
|
);
|
|
@@ -2157,32 +2140,32 @@ const xa = /* @__PURE__ */ le({
|
|
|
2157
2140
|
}
|
|
2158
2141
|
}
|
|
2159
2142
|
}
|
|
2160
|
-
return (C,
|
|
2161
|
-
open: e(
|
|
2162
|
-
"onUpdate:open":
|
|
2143
|
+
return (C, P) => (v(), V(e(Qe), {
|
|
2144
|
+
open: e(a),
|
|
2145
|
+
"onUpdate:open": P[2] || (P[2] = (S) => je(a) ? a.value = S : null),
|
|
2163
2146
|
title: e(s)("panel.new-product"),
|
|
2164
2147
|
width: 440
|
|
2165
2148
|
}, {
|
|
2166
2149
|
footer: o(() => [
|
|
2167
|
-
|
|
2150
|
+
_(e(Ye), { size: "sm" }, {
|
|
2168
2151
|
default: o(() => [
|
|
2169
|
-
|
|
2152
|
+
_(e(Q), {
|
|
2170
2153
|
variant: "outline",
|
|
2171
|
-
onClick:
|
|
2154
|
+
onClick: P[1] || (P[1] = (S) => e(m)())
|
|
2172
2155
|
}, {
|
|
2173
2156
|
default: o(() => [
|
|
2174
|
-
|
|
2157
|
+
W(k(e(s)("panel.cancel")), 1)
|
|
2175
2158
|
]),
|
|
2176
2159
|
_: 1
|
|
2177
2160
|
}),
|
|
2178
|
-
|
|
2161
|
+
_(e(Q), {
|
|
2179
2162
|
type: "primary",
|
|
2180
2163
|
loading: w.value,
|
|
2181
|
-
disabled:
|
|
2164
|
+
disabled: l.value.trim() === "",
|
|
2182
2165
|
onClick: x
|
|
2183
2166
|
}, {
|
|
2184
2167
|
default: o(() => [
|
|
2185
|
-
|
|
2168
|
+
W(k(e(s)("panel.create")), 1)
|
|
2186
2169
|
]),
|
|
2187
2170
|
_: 1
|
|
2188
2171
|
}, 8, ["loading", "disabled"])
|
|
@@ -2191,7 +2174,7 @@ const xa = /* @__PURE__ */ le({
|
|
|
2191
2174
|
})
|
|
2192
2175
|
]),
|
|
2193
2176
|
default: o(() => [
|
|
2194
|
-
|
|
2177
|
+
_(e(ke), {
|
|
2195
2178
|
label: e(s)("product.name"),
|
|
2196
2179
|
error: e(_e)(b.value, "name") ?? e(_e)(b.value, "slug"),
|
|
2197
2180
|
required: ""
|
|
@@ -2199,11 +2182,11 @@ const xa = /* @__PURE__ */ le({
|
|
|
2199
2182
|
default: o(() => [
|
|
2200
2183
|
G("div", {
|
|
2201
2184
|
ref_key: "field",
|
|
2202
|
-
ref:
|
|
2185
|
+
ref: f
|
|
2203
2186
|
}, [
|
|
2204
|
-
|
|
2205
|
-
modelValue:
|
|
2206
|
-
"onUpdate:modelValue":
|
|
2187
|
+
_(e(fe), {
|
|
2188
|
+
modelValue: l.value,
|
|
2189
|
+
"onUpdate:modelValue": P[0] || (P[0] = (S) => l.value = S),
|
|
2207
2190
|
"aria-label": e(s)("product.name"),
|
|
2208
2191
|
onKeyup: Ke(x, ["enter"])
|
|
2209
2192
|
}, null, 8, ["modelValue", "aria-label"])
|
|
@@ -2216,50 +2199,50 @@ const xa = /* @__PURE__ */ le({
|
|
|
2216
2199
|
}, 8, ["open", "title"]));
|
|
2217
2200
|
}
|
|
2218
2201
|
}), Le = "f.";
|
|
2219
|
-
function
|
|
2202
|
+
function sl(n, a) {
|
|
2220
2203
|
const i = {};
|
|
2221
|
-
for (const
|
|
2222
|
-
const
|
|
2223
|
-
if (
|
|
2224
|
-
if (
|
|
2225
|
-
|
|
2226
|
-
else if (
|
|
2227
|
-
const [r, s] =
|
|
2204
|
+
for (const m of a) {
|
|
2205
|
+
const t = n[`${Le}${m.key}`], y = typeof t == "string" ? t.trim() : "";
|
|
2206
|
+
if (y !== "")
|
|
2207
|
+
if (m.kind === "toggle")
|
|
2208
|
+
y === "1" && (i[m.key] = !0);
|
|
2209
|
+
else if (m.kind === "range") {
|
|
2210
|
+
const [r, s] = y.split("-", 2).map((w) => w === "" ? null : Number(w)), l = {
|
|
2228
2211
|
min: Number.isFinite(r) ? r : null,
|
|
2229
2212
|
max: Number.isFinite(s) ? s : null
|
|
2230
2213
|
};
|
|
2231
|
-
(
|
|
2214
|
+
(l.min !== null || l.max !== null) && (i[m.key] = l);
|
|
2232
2215
|
} else {
|
|
2233
|
-
const r =
|
|
2234
|
-
r.length > 0 && (i[
|
|
2216
|
+
const r = y.split(",").filter((s) => s !== "");
|
|
2217
|
+
r.length > 0 && (i[m.key] = r);
|
|
2235
2218
|
}
|
|
2236
2219
|
}
|
|
2237
2220
|
return i;
|
|
2238
2221
|
}
|
|
2239
|
-
function
|
|
2222
|
+
function rl(n) {
|
|
2240
2223
|
if (n == null) return;
|
|
2241
2224
|
if (n === !0) return "1";
|
|
2242
2225
|
if (Array.isArray(n)) return n.length > 0 ? n.join(",") : void 0;
|
|
2243
|
-
const
|
|
2244
|
-
return
|
|
2226
|
+
const a = n.min ?? null, i = n.max ?? null;
|
|
2227
|
+
return a === null && i === null ? void 0 : `${a ?? ""}-${i ?? ""}`;
|
|
2245
2228
|
}
|
|
2246
|
-
const
|
|
2229
|
+
const ul = {
|
|
2247
2230
|
key: 0,
|
|
2248
2231
|
class: "wx-catalog-products__selection"
|
|
2249
|
-
},
|
|
2232
|
+
}, il = {
|
|
2250
2233
|
key: 1,
|
|
2251
2234
|
class: "wx-catalog-products__range"
|
|
2252
|
-
},
|
|
2235
|
+
}, cl = ["src"], dl = { class: "wx-catalog-products__name" }, pl = { class: "wx-catalog-products__title" }, vl = { class: "wx-catalog-products__sku" }, gl = { class: "wx-catalog-products__price" }, yl = { key: 0 }, ml = { key: 0 }, ct = 640, fl = /* @__PURE__ */ le({
|
|
2253
2236
|
__name: "ProductsPage",
|
|
2254
2237
|
props: {
|
|
2255
2238
|
base: { default: "/catalog" }
|
|
2256
2239
|
},
|
|
2257
2240
|
setup(n) {
|
|
2258
|
-
const
|
|
2241
|
+
const a = n, i = ae(), m = ne(i), t = ye(i), y = Vt(i), r = ze(), s = $e();
|
|
2259
2242
|
oe();
|
|
2260
|
-
const
|
|
2243
|
+
const l = te("webx-catalog"), w = te("webx-admin"), b = ge(), f = Me("root"), x = ra(f), C = D(null), P = D(!0), S = D([]), q = D(!1), F = D(typeof r.query.q == "string" ? r.query.q : ""), E = D(Number(r.query.page ?? 1) || 1);
|
|
2261
2244
|
let L;
|
|
2262
|
-
const U = Ze(
|
|
2245
|
+
const U = Ze(ol), N = h(() => i.can("catalog.manage")), c = h(() => i.can("catalog.delete")), g = h(() => l("module.products")), p = h({
|
|
2263
2246
|
get: () => typeof r.query.view == "string" ? r.query.view : "",
|
|
2264
2247
|
set: (d) => {
|
|
2265
2248
|
s.replace({
|
|
@@ -2267,37 +2250,37 @@ const rl = {
|
|
|
2267
2250
|
});
|
|
2268
2251
|
}
|
|
2269
2252
|
}), j = h(
|
|
2270
|
-
() =>
|
|
2253
|
+
() => y.sorts.value.length > 0 ? y.sorts.value : [{ key: "default", label: l("panel.sort-default") }]
|
|
2271
2254
|
), H = h(() => {
|
|
2272
2255
|
const d = r.query.sort;
|
|
2273
|
-
return typeof d == "string" &&
|
|
2274
|
-
}), se = h(() =>
|
|
2256
|
+
return typeof d == "string" && y.sorts.value.some((A) => A.key === d) ? d : "default";
|
|
2257
|
+
}), se = h(() => y.facets.value ?? []), X = h(() => sl(r.query, se.value)), re = h(() => {
|
|
2275
2258
|
const d = C.value?.counts.no_category ?? 0;
|
|
2276
2259
|
return [
|
|
2277
|
-
{ value: "", label:
|
|
2278
|
-
{ value: "published", label:
|
|
2279
|
-
{ value: "unpublished", label:
|
|
2260
|
+
{ value: "", label: l("panel.view-all") },
|
|
2261
|
+
{ value: "published", label: l("panel.view-published") },
|
|
2262
|
+
{ value: "unpublished", label: l("panel.view-unpublished") },
|
|
2280
2263
|
{
|
|
2281
2264
|
value: "no-category",
|
|
2282
|
-
label:
|
|
2265
|
+
label: l("panel.view-no-category"),
|
|
2283
2266
|
badge: d > 0 ? d : void 0
|
|
2284
2267
|
}
|
|
2285
2268
|
];
|
|
2286
|
-
}), ue = h(() => (C.value?.data ?? []).some((d) => "price" in d)), ce = h(() => C.value?.columns ?? []), z = h(() => x.value > 0 && x.value <
|
|
2287
|
-
() => new Map(qe(
|
|
2269
|
+
}), ue = h(() => (C.value?.data ?? []).some((d) => "price" in d)), ce = h(() => C.value?.columns ?? []), z = h(() => x.value > 0 && x.value < ct), I = h(
|
|
2270
|
+
() => new Map(qe(t.nodes.value ?? []).map((d) => [String(d.id), d.name]))
|
|
2288
2271
|
), Z = h(() => z.value ? [{ key: "card", label: "" }] : [
|
|
2289
2272
|
{ key: "image", label: "", width: 64 },
|
|
2290
|
-
{ key: "name", label:
|
|
2291
|
-
{ key: "category", label:
|
|
2292
|
-
...ue.value ? [{ key: "price", label:
|
|
2273
|
+
{ key: "name", label: l("panel.column-product"), minWidth: 200 },
|
|
2274
|
+
{ key: "category", label: l("product.category"), width: 180, hideBelow: 860 },
|
|
2275
|
+
...ue.value ? [{ key: "price", label: l("product.price"), width: 150, align: "right" }] : [],
|
|
2293
2276
|
...ce.value.map((d) => ({
|
|
2294
2277
|
key: `x.${d.key}`,
|
|
2295
2278
|
label: d.label,
|
|
2296
2279
|
width: 120,
|
|
2297
2280
|
hideBelow: 1040
|
|
2298
2281
|
})),
|
|
2299
|
-
{ key: "state", label:
|
|
2300
|
-
{ key: "updated_at", label:
|
|
2282
|
+
{ key: "state", label: l("panel.column-state"), width: 150, hideBelow: 720 },
|
|
2283
|
+
{ key: "updated_at", label: l("panel.column-updated"), width: 130, hideBelow: 1180 },
|
|
2301
2284
|
{ key: "actions", label: "", width: Ae, align: "right" }
|
|
2302
2285
|
]);
|
|
2303
2286
|
function T(d) {
|
|
@@ -2305,36 +2288,36 @@ const rl = {
|
|
|
2305
2288
|
q: d?.search ?? F.value,
|
|
2306
2289
|
state: p.value,
|
|
2307
2290
|
sort: H.value,
|
|
2308
|
-
page: d?.page ??
|
|
2291
|
+
page: d?.page ?? E.value,
|
|
2309
2292
|
per_page: d?.perPage ?? L,
|
|
2310
2293
|
facets: X.value
|
|
2311
2294
|
};
|
|
2312
2295
|
}
|
|
2313
2296
|
let $ = 0;
|
|
2314
2297
|
async function R(d) {
|
|
2315
|
-
const
|
|
2316
|
-
|
|
2298
|
+
const A = ++$;
|
|
2299
|
+
P.value = !0;
|
|
2317
2300
|
try {
|
|
2318
|
-
const u = await
|
|
2319
|
-
|
|
2301
|
+
const u = await m.products(T(d));
|
|
2302
|
+
A === $ && (C.value = u);
|
|
2320
2303
|
} catch (u) {
|
|
2321
|
-
|
|
2304
|
+
O.danger(b(u));
|
|
2322
2305
|
} finally {
|
|
2323
|
-
|
|
2306
|
+
A === $ && (P.value = !1);
|
|
2324
2307
|
}
|
|
2325
2308
|
}
|
|
2326
|
-
function
|
|
2309
|
+
function pe(d) {
|
|
2327
2310
|
L = d.perPage;
|
|
2328
|
-
const
|
|
2311
|
+
const A = {
|
|
2329
2312
|
...r.query,
|
|
2330
2313
|
q: d.search === "" ? void 0 : d.search,
|
|
2331
2314
|
page: d.page === 1 ? void 0 : String(d.page)
|
|
2332
2315
|
};
|
|
2333
|
-
s.replace({ query:
|
|
2316
|
+
s.replace({ query: A }), R(d);
|
|
2334
2317
|
}
|
|
2335
|
-
function
|
|
2318
|
+
function me(d, A) {
|
|
2336
2319
|
s.replace({
|
|
2337
|
-
query: { ...r.query, [`${Le}${d}`]:
|
|
2320
|
+
query: { ...r.query, [`${Le}${d}`]: rl(A), page: void 0 }
|
|
2338
2321
|
});
|
|
2339
2322
|
}
|
|
2340
2323
|
function Ut(d) {
|
|
@@ -2348,50 +2331,50 @@ const rl = {
|
|
|
2348
2331
|
}
|
|
2349
2332
|
function Dt() {
|
|
2350
2333
|
const d = Object.fromEntries(
|
|
2351
|
-
Object.entries(r.query).filter(([
|
|
2334
|
+
Object.entries(r.query).filter(([A]) => !A.startsWith(Le))
|
|
2352
2335
|
);
|
|
2353
2336
|
s.replace({ query: { ...d, page: void 0 } });
|
|
2354
2337
|
}
|
|
2355
2338
|
function qt(d) {
|
|
2356
|
-
const
|
|
2339
|
+
const A = C.value?.facets?.[d]?.values ?? [], u = A.map((K) => ({
|
|
2357
2340
|
value: K.value,
|
|
2358
2341
|
label: `${K.label} (${K.count})`
|
|
2359
2342
|
}));
|
|
2360
2343
|
for (const K of Ne(d))
|
|
2361
|
-
|
|
2344
|
+
A.some((Gt) => Gt.value === K) || u.push({ value: K, label: K });
|
|
2362
2345
|
return u;
|
|
2363
2346
|
}
|
|
2364
|
-
function Nt(d,
|
|
2365
|
-
return d.kind === "tree" ? I.value.get(String(
|
|
2347
|
+
function Nt(d, A) {
|
|
2348
|
+
return d.kind === "tree" ? I.value.get(String(A)) ?? `#${A}` : C.value?.facets?.[d.key]?.values?.find((u) => u.value === String(A))?.label ?? String(A);
|
|
2366
2349
|
}
|
|
2367
|
-
function
|
|
2368
|
-
const u = C.value?.facets?.[d]?.[
|
|
2369
|
-
return typeof u == "number" ?
|
|
2350
|
+
function at(d, A) {
|
|
2351
|
+
const u = C.value?.facets?.[d]?.[A];
|
|
2352
|
+
return typeof u == "number" ? nt.value.format(u) : "";
|
|
2370
2353
|
}
|
|
2371
2354
|
const Ce = h(
|
|
2372
2355
|
() => se.value.flatMap((d) => {
|
|
2373
|
-
const
|
|
2374
|
-
if (
|
|
2356
|
+
const A = X.value[d.key];
|
|
2357
|
+
if (A === void 0) return [];
|
|
2375
2358
|
let u;
|
|
2376
|
-
return
|
|
2359
|
+
return A === !0 ? u = d.label : Array.isArray(A) ? u = `${d.label}: ${A.map((K) => Nt(d, K)).join(", ")}` : u = `${d.label}: ${A.min ?? "…"} – ${A.max ?? "…"}`, [{ key: d.key, label: u, clear: () => me(d.key, null) }];
|
|
2377
2360
|
})
|
|
2378
|
-
), Ft = h(() => F.value !== "" || Ce.value.length > 0 || p.value !== "" ?
|
|
2361
|
+
), Ft = h(() => F.value !== "" || Ce.value.length > 0 || p.value !== "" ? l("panel.empty-search") : l("panel.empty-products"));
|
|
2379
2362
|
function Se(d) {
|
|
2380
|
-
const
|
|
2381
|
-
return
|
|
2363
|
+
const A = X.value[d];
|
|
2364
|
+
return A && !Array.isArray(A) && A !== !0 ? A : {};
|
|
2382
2365
|
}
|
|
2383
2366
|
function Ne(d) {
|
|
2384
|
-
const
|
|
2385
|
-
return Array.isArray(
|
|
2367
|
+
const A = X.value[d];
|
|
2368
|
+
return Array.isArray(A) ? A.map(String) : [];
|
|
2386
2369
|
}
|
|
2387
|
-
function
|
|
2370
|
+
function Et(d) {
|
|
2388
2371
|
return Ne(d).map(Number);
|
|
2389
2372
|
}
|
|
2390
|
-
const Pe = h(() => C.value?.total ?? 0),
|
|
2373
|
+
const Pe = h(() => C.value?.total ?? 0), Ot = h(() => {
|
|
2391
2374
|
if (!q.value) return { ids: S.value.map(Number) };
|
|
2392
2375
|
const d = {};
|
|
2393
|
-
for (const [
|
|
2394
|
-
d[
|
|
2376
|
+
for (const [A, u] of Object.entries(X.value))
|
|
2377
|
+
d[A] = u === !0 ? ["1"] : u;
|
|
2395
2378
|
return { query: { q: F.value, state: String(p.value), facets: d } };
|
|
2396
2379
|
});
|
|
2397
2380
|
function It() {
|
|
@@ -2403,136 +2386,129 @@ const rl = {
|
|
|
2403
2386
|
we([p, H, () => JSON.stringify(X.value), F], () => {
|
|
2404
2387
|
q.value = !1;
|
|
2405
2388
|
}), we([p, H, () => JSON.stringify(X.value)], () => {
|
|
2406
|
-
|
|
2389
|
+
E.value !== 1 ? E.value = 1 : R();
|
|
2407
2390
|
}), ie(() => {
|
|
2408
|
-
|
|
2409
|
-
}),
|
|
2391
|
+
y.load().catch(() => {
|
|
2392
|
+
}), t.load().catch(() => {
|
|
2410
2393
|
});
|
|
2411
2394
|
});
|
|
2412
2395
|
function Fe(d) {
|
|
2413
|
-
s.push({ path: `${
|
|
2396
|
+
s.push({ path: `${a.base}/products/${d.id}` });
|
|
2414
2397
|
}
|
|
2415
2398
|
async function Bt() {
|
|
2416
2399
|
const d = await U({});
|
|
2417
2400
|
d && Fe(d.product);
|
|
2418
2401
|
}
|
|
2419
|
-
async function
|
|
2402
|
+
async function lt(d, A) {
|
|
2420
2403
|
try {
|
|
2421
|
-
await
|
|
2404
|
+
await m.saveProduct(d.id, { is_published: A }), O.success(l(A ? "panel.product-published" : "panel.product-unpublished")), await R();
|
|
2422
2405
|
} catch (u) {
|
|
2423
|
-
|
|
2406
|
+
O.danger(b(u));
|
|
2424
2407
|
}
|
|
2425
2408
|
}
|
|
2426
2409
|
async function Lt(d) {
|
|
2427
|
-
if (await
|
|
2428
|
-
title:
|
|
2429
|
-
message:
|
|
2430
|
-
confirmText:
|
|
2431
|
-
cancelText:
|
|
2410
|
+
if (await ve({
|
|
2411
|
+
title: l("panel.delete-product-title", { name: d.name }),
|
|
2412
|
+
message: l("panel.delete-product-text"),
|
|
2413
|
+
confirmText: l("panel.delete"),
|
|
2414
|
+
cancelText: l("panel.cancel"),
|
|
2432
2415
|
tone: "danger"
|
|
2433
2416
|
}))
|
|
2434
2417
|
try {
|
|
2435
|
-
await
|
|
2418
|
+
await m.removeProduct(d.id), S.value = S.value.filter((u) => u !== d.id), O.success(l("panel.product-deleted")), await R();
|
|
2436
2419
|
} catch (u) {
|
|
2437
|
-
|
|
2420
|
+
O.danger(b(u));
|
|
2438
2421
|
}
|
|
2439
2422
|
}
|
|
2440
2423
|
function Mt(d) {
|
|
2441
|
-
const
|
|
2442
|
-
{ key: "open", icon: "edit", label:
|
|
2424
|
+
const A = [
|
|
2425
|
+
{ key: "open", icon: "edit", label: l("panel.open"), run: () => Fe(d) }
|
|
2443
2426
|
];
|
|
2444
|
-
return d.url &&
|
|
2427
|
+
return d.url && A.push({ key: "site", icon: "link", label: l("panel.open-on-site"), href: d.url }), N.value && A.push(
|
|
2445
2428
|
d.is_published ? {
|
|
2446
2429
|
key: "unpublish",
|
|
2447
2430
|
icon: "eye-off",
|
|
2448
|
-
label:
|
|
2431
|
+
label: l("panel.unpublish"),
|
|
2449
2432
|
run: () => {
|
|
2450
|
-
|
|
2433
|
+
lt(d, !1);
|
|
2451
2434
|
}
|
|
2452
2435
|
} : {
|
|
2453
2436
|
key: "publish",
|
|
2454
2437
|
icon: "eye",
|
|
2455
|
-
label:
|
|
2438
|
+
label: l("panel.publish"),
|
|
2456
2439
|
run: () => {
|
|
2457
|
-
|
|
2440
|
+
lt(d, !0);
|
|
2458
2441
|
}
|
|
2459
2442
|
}
|
|
2460
|
-
), c.value &&
|
|
2443
|
+
), c.value && A.push({
|
|
2461
2444
|
key: "delete",
|
|
2462
2445
|
icon: "trash",
|
|
2463
|
-
label:
|
|
2446
|
+
label: l("panel.delete"),
|
|
2464
2447
|
danger: !0,
|
|
2465
2448
|
run: () => {
|
|
2466
2449
|
Lt(d);
|
|
2467
2450
|
}
|
|
2468
|
-
}),
|
|
2451
|
+
}), A;
|
|
2469
2452
|
}
|
|
2470
|
-
function
|
|
2453
|
+
function Ee(d) {
|
|
2471
2454
|
return d.is_published ? d.visible ? "success" : "warning" : "default";
|
|
2472
2455
|
}
|
|
2473
|
-
const
|
|
2456
|
+
const nt = h(
|
|
2474
2457
|
() => new Intl.NumberFormat(i.i18n.state.locale, {
|
|
2475
2458
|
minimumFractionDigits: 0,
|
|
2476
2459
|
maximumFractionDigits: 2
|
|
2477
2460
|
})
|
|
2478
2461
|
);
|
|
2479
|
-
function
|
|
2480
|
-
return d == null ? "—" :
|
|
2462
|
+
function Oe(d) {
|
|
2463
|
+
return d == null ? "—" : nt.value.format(d);
|
|
2481
2464
|
}
|
|
2482
|
-
function
|
|
2483
|
-
return d.unit ? ` / ${
|
|
2465
|
+
function ot(d) {
|
|
2466
|
+
return d.unit ? ` / ${l(`units.${d.unit}`)}` : "";
|
|
2484
2467
|
}
|
|
2485
|
-
function jt(d,
|
|
2486
|
-
const u = d.columns?.[
|
|
2468
|
+
function jt(d, A) {
|
|
2469
|
+
const u = d.columns?.[A];
|
|
2487
2470
|
return u == null || u === "" ? "—" : typeof u == "boolean" ? u ? "✓" : "—" : String(u);
|
|
2488
2471
|
}
|
|
2489
2472
|
const Kt = h(() => {
|
|
2490
2473
|
const d = [];
|
|
2491
2474
|
return N.value && d.push({
|
|
2492
2475
|
key: "new",
|
|
2493
|
-
label:
|
|
2476
|
+
label: l("panel.new-product"),
|
|
2494
2477
|
icon: "plus",
|
|
2495
2478
|
primary: !0,
|
|
2496
2479
|
run: () => {
|
|
2497
2480
|
Bt();
|
|
2498
2481
|
}
|
|
2499
|
-
}), d.push({
|
|
2500
|
-
key: "categories",
|
|
2501
|
-
label: a("module.categories"),
|
|
2502
|
-
icon: "folder",
|
|
2503
|
-
run: () => {
|
|
2504
|
-
s.push(`${t.base}/categories`);
|
|
2505
|
-
}
|
|
2506
2482
|
}), c.value && d.push({
|
|
2507
2483
|
key: "deleted",
|
|
2508
|
-
label:
|
|
2484
|
+
label: l("module.deleted"),
|
|
2509
2485
|
icon: "trash",
|
|
2510
2486
|
menu: !0,
|
|
2511
2487
|
run: () => {
|
|
2512
|
-
s.push(`${
|
|
2488
|
+
s.push(`${a.base}/deleted`);
|
|
2513
2489
|
}
|
|
2514
2490
|
}), d;
|
|
2515
2491
|
});
|
|
2516
|
-
return (d,
|
|
2492
|
+
return (d, A) => (v(), B("div", {
|
|
2517
2493
|
ref_key: "root",
|
|
2518
|
-
ref:
|
|
2494
|
+
ref: f,
|
|
2519
2495
|
class: "wx-catalog-products"
|
|
2520
2496
|
}, [
|
|
2521
|
-
|
|
2497
|
+
_(e(He), {
|
|
2522
2498
|
view: p.value,
|
|
2523
|
-
"onUpdate:view":
|
|
2499
|
+
"onUpdate:view": A[4] || (A[4] = (u) => p.value = u),
|
|
2524
2500
|
title: g.value,
|
|
2525
2501
|
views: re.value,
|
|
2526
2502
|
actions: Kt.value
|
|
2527
2503
|
}, {
|
|
2528
2504
|
default: o(() => [
|
|
2529
|
-
S.value.length > 0 || q.value ? (v(), B("div",
|
|
2530
|
-
|
|
2505
|
+
S.value.length > 0 || q.value ? (v(), B("div", ul, [
|
|
2506
|
+
_(e(J), {
|
|
2531
2507
|
size: "sm",
|
|
2532
2508
|
weight: "medium"
|
|
2533
2509
|
}, {
|
|
2534
2510
|
default: o(() => [
|
|
2535
|
-
|
|
2511
|
+
W(k(q.value ? e(l)("panel.selected-all", { count: Pe.value }) : e(l)("panel.selected", { count: S.value.length })), 1)
|
|
2536
2512
|
]),
|
|
2537
2513
|
_: 1
|
|
2538
2514
|
}),
|
|
@@ -2540,37 +2516,37 @@ const rl = {
|
|
|
2540
2516
|
key: 0,
|
|
2541
2517
|
size: "sm",
|
|
2542
2518
|
variant: "text",
|
|
2543
|
-
onClick:
|
|
2519
|
+
onClick: A[0] || (A[0] = (u) => q.value = !0)
|
|
2544
2520
|
}, {
|
|
2545
2521
|
default: o(() => [
|
|
2546
|
-
|
|
2522
|
+
W(k(e(l)("panel.select-all-found", { count: Pe.value })), 1)
|
|
2547
2523
|
]),
|
|
2548
2524
|
_: 1
|
|
2549
2525
|
})) : M("", !0),
|
|
2550
|
-
|
|
2526
|
+
_(e(Q), {
|
|
2551
2527
|
size: "sm",
|
|
2552
2528
|
variant: "text",
|
|
2553
2529
|
onClick: It
|
|
2554
2530
|
}, {
|
|
2555
2531
|
default: o(() => [
|
|
2556
|
-
|
|
2532
|
+
W(k(e(l)("panel.select-clear")), 1)
|
|
2557
2533
|
]),
|
|
2558
2534
|
_: 1
|
|
2559
2535
|
}),
|
|
2560
|
-
N.value || c.value ? (v(), V(
|
|
2536
|
+
N.value || c.value ? (v(), V(nl, {
|
|
2561
2537
|
key: 1,
|
|
2562
2538
|
count: q.value ? Pe.value : S.value.length,
|
|
2563
|
-
selection:
|
|
2539
|
+
selection: Ot.value,
|
|
2564
2540
|
onFinished: Rt
|
|
2565
2541
|
}, null, 8, ["count", "selection"])) : M("", !0)
|
|
2566
2542
|
])) : M("", !0),
|
|
2567
|
-
|
|
2543
|
+
_(e(et), {
|
|
2568
2544
|
selected: S.value,
|
|
2569
|
-
"onUpdate:selected":
|
|
2545
|
+
"onUpdate:selected": A[1] || (A[1] = (u) => S.value = u),
|
|
2570
2546
|
search: F.value,
|
|
2571
|
-
"onUpdate:search":
|
|
2572
|
-
page:
|
|
2573
|
-
"onUpdate:page":
|
|
2547
|
+
"onUpdate:search": A[2] || (A[2] = (u) => F.value = u),
|
|
2548
|
+
page: E.value,
|
|
2549
|
+
"onUpdate:page": A[3] || (A[3] = (u) => E.value = u),
|
|
2574
2550
|
data: C.value,
|
|
2575
2551
|
columns: Z.value,
|
|
2576
2552
|
"row-key": "id",
|
|
@@ -2579,23 +2555,23 @@ const rl = {
|
|
|
2579
2555
|
clickable: "",
|
|
2580
2556
|
hover: "",
|
|
2581
2557
|
flush: "",
|
|
2582
|
-
loading:
|
|
2558
|
+
loading: P.value,
|
|
2583
2559
|
layout: "fixed",
|
|
2584
|
-
"cards-below":
|
|
2560
|
+
"cards-below": ct,
|
|
2585
2561
|
"filters-count": Ce.value.length,
|
|
2586
2562
|
"filters-label": e(w)("filters.title"),
|
|
2587
|
-
"search-placeholder": e(
|
|
2563
|
+
"search-placeholder": e(l)("panel.search-products"),
|
|
2588
2564
|
"empty-text": Ft.value,
|
|
2589
2565
|
"aria-label": g.value,
|
|
2590
2566
|
onRowClick: Fe,
|
|
2591
|
-
onStateChange:
|
|
2567
|
+
onStateChange: pe
|
|
2592
2568
|
}, Yt({
|
|
2593
2569
|
filters: o(() => [
|
|
2594
|
-
|
|
2595
|
-
label: e(
|
|
2570
|
+
_(e(ke), {
|
|
2571
|
+
label: e(l)("panel.sort")
|
|
2596
2572
|
}, {
|
|
2597
2573
|
default: o(() => [
|
|
2598
|
-
|
|
2574
|
+
_(e(Re), {
|
|
2599
2575
|
"model-value": H.value,
|
|
2600
2576
|
options: j.value.map((u) => ({ value: u.key, label: u.label })),
|
|
2601
2577
|
size: "sm",
|
|
@@ -2604,15 +2580,15 @@ const rl = {
|
|
|
2604
2580
|
]),
|
|
2605
2581
|
_: 1
|
|
2606
2582
|
}, 8, ["label"]),
|
|
2607
|
-
(v(!0), B(ee, null,
|
|
2583
|
+
(v(!0), B(ee, null, be(se.value, (u) => (v(), V(e(ke), {
|
|
2608
2584
|
key: u.key,
|
|
2609
2585
|
label: u.label
|
|
2610
2586
|
}, {
|
|
2611
2587
|
default: o(() => [
|
|
2612
2588
|
u.kind === "tree" ? (v(), V(e(De), {
|
|
2613
2589
|
key: 0,
|
|
2614
|
-
"model-value":
|
|
2615
|
-
nodes: e(
|
|
2590
|
+
"model-value": Et(u.key),
|
|
2591
|
+
nodes: e(t).nodes.value ?? [],
|
|
2616
2592
|
"node-key": "id",
|
|
2617
2593
|
"label-key": "name",
|
|
2618
2594
|
"children-key": "children",
|
|
@@ -2621,32 +2597,32 @@ const rl = {
|
|
|
2621
2597
|
filterable: "",
|
|
2622
2598
|
clearable: "",
|
|
2623
2599
|
size: "sm",
|
|
2624
|
-
placeholder: e(
|
|
2625
|
-
"onUpdate:modelValue": (K) =>
|
|
2626
|
-
}, null, 8, ["model-value", "nodes", "placeholder", "onUpdate:modelValue"])) : u.kind === "range" ? (v(), B("div",
|
|
2627
|
-
|
|
2600
|
+
placeholder: e(l)("panel.any"),
|
|
2601
|
+
"onUpdate:modelValue": (K) => me(u.key, Array.isArray(K) ? K.map(String) : [])
|
|
2602
|
+
}, null, 8, ["model-value", "nodes", "placeholder", "onUpdate:modelValue"])) : u.kind === "range" ? (v(), B("div", il, [
|
|
2603
|
+
_(e(st), {
|
|
2628
2604
|
"model-value": Se(u.key).min ?? null,
|
|
2629
2605
|
min: 0,
|
|
2630
2606
|
controls: !1,
|
|
2631
2607
|
size: "sm",
|
|
2632
|
-
placeholder:
|
|
2633
|
-
"aria-label": `${u.label}: ${e(
|
|
2634
|
-
"onUpdate:modelValue": (K) =>
|
|
2608
|
+
placeholder: at(u.key, "min") || e(l)("panel.range-from"),
|
|
2609
|
+
"aria-label": `${u.label}: ${e(l)("panel.range-from")}`,
|
|
2610
|
+
"onUpdate:modelValue": (K) => me(u.key, { ...Se(u.key), min: K ?? null })
|
|
2635
2611
|
}, null, 8, ["model-value", "placeholder", "aria-label", "onUpdate:modelValue"]),
|
|
2636
|
-
|
|
2612
|
+
_(e(st), {
|
|
2637
2613
|
"model-value": Se(u.key).max ?? null,
|
|
2638
2614
|
min: 0,
|
|
2639
2615
|
controls: !1,
|
|
2640
2616
|
size: "sm",
|
|
2641
|
-
placeholder:
|
|
2642
|
-
"aria-label": `${u.label}: ${e(
|
|
2643
|
-
"onUpdate:modelValue": (K) =>
|
|
2617
|
+
placeholder: at(u.key, "max") || e(l)("panel.range-to"),
|
|
2618
|
+
"aria-label": `${u.label}: ${e(l)("panel.range-to")}`,
|
|
2619
|
+
"onUpdate:modelValue": (K) => me(u.key, { ...Se(u.key), max: K ?? null })
|
|
2644
2620
|
}, null, 8, ["model-value", "placeholder", "aria-label", "onUpdate:modelValue"])
|
|
2645
2621
|
])) : u.kind === "toggle" ? (v(), V(e(Ie), {
|
|
2646
2622
|
key: 2,
|
|
2647
2623
|
"model-value": X.value[u.key] === !0,
|
|
2648
2624
|
size: "sm",
|
|
2649
|
-
"onUpdate:modelValue": (K) =>
|
|
2625
|
+
"onUpdate:modelValue": (K) => me(u.key, K ? !0 : null)
|
|
2650
2626
|
}, null, 8, ["model-value", "onUpdate:modelValue"])) : (v(), V(e(Re), {
|
|
2651
2627
|
key: 3,
|
|
2652
2628
|
"model-value": Ne(u.key),
|
|
@@ -2655,8 +2631,8 @@ const rl = {
|
|
|
2655
2631
|
filterable: "",
|
|
2656
2632
|
clearable: "",
|
|
2657
2633
|
size: "sm",
|
|
2658
|
-
placeholder: e(
|
|
2659
|
-
"onUpdate:modelValue": (K) =>
|
|
2634
|
+
placeholder: e(l)("panel.any"),
|
|
2635
|
+
"onUpdate:modelValue": (K) => me(u.key, Array.isArray(K) ? K.map(String) : [])
|
|
2660
2636
|
}, null, 8, ["model-value", "options", "placeholder", "onUpdate:modelValue"]))
|
|
2661
2637
|
]),
|
|
2662
2638
|
_: 2
|
|
@@ -2669,16 +2645,16 @@ const rl = {
|
|
|
2669
2645
|
onClick: Dt
|
|
2670
2646
|
}, {
|
|
2671
2647
|
icon: o(() => [
|
|
2672
|
-
|
|
2648
|
+
_(e(Be), { name: "close" })
|
|
2673
2649
|
]),
|
|
2674
2650
|
default: o(() => [
|
|
2675
|
-
|
|
2651
|
+
W(" " + k(e(w)("filters.reset")), 1)
|
|
2676
2652
|
]),
|
|
2677
2653
|
_: 1
|
|
2678
2654
|
})) : M("", !0)
|
|
2679
2655
|
]),
|
|
2680
2656
|
applied: o(() => [
|
|
2681
|
-
|
|
2657
|
+
_(e(ta), { filters: Ce.value }, null, 8, ["filters"])
|
|
2682
2658
|
]),
|
|
2683
2659
|
"cell-image": o(({ row: u }) => [
|
|
2684
2660
|
G("span", {
|
|
@@ -2689,7 +2665,7 @@ const rl = {
|
|
|
2689
2665
|
src: u.image.thumb ?? u.image.url,
|
|
2690
2666
|
alt: "",
|
|
2691
2667
|
loading: "lazy"
|
|
2692
|
-
}, null, 8,
|
|
2668
|
+
}, null, 8, cl)) : (v(), V(e(Be), {
|
|
2693
2669
|
key: 1,
|
|
2694
2670
|
name: "image",
|
|
2695
2671
|
size: "sm"
|
|
@@ -2697,9 +2673,9 @@ const rl = {
|
|
|
2697
2673
|
], 2)
|
|
2698
2674
|
]),
|
|
2699
2675
|
"cell-name": o(({ row: u }) => [
|
|
2700
|
-
G("div",
|
|
2701
|
-
G("span",
|
|
2702
|
-
G("span",
|
|
2676
|
+
G("div", dl, [
|
|
2677
|
+
G("span", pl, k(u.name), 1),
|
|
2678
|
+
G("span", vl, k(u.sku ?? ""), 1)
|
|
2703
2679
|
])
|
|
2704
2680
|
]),
|
|
2705
2681
|
"cell-category": o(({ row: u }) => [
|
|
@@ -2710,7 +2686,7 @@ const rl = {
|
|
|
2710
2686
|
tone: u.category.deleted ? "muted" : void 0
|
|
2711
2687
|
}, {
|
|
2712
2688
|
default: o(() => [
|
|
2713
|
-
|
|
2689
|
+
W(k(u.category.name), 1)
|
|
2714
2690
|
]),
|
|
2715
2691
|
_: 2
|
|
2716
2692
|
}, 1032, ["tone"])) : (v(), V(e(Y), {
|
|
@@ -2720,33 +2696,33 @@ const rl = {
|
|
|
2720
2696
|
round: ""
|
|
2721
2697
|
}, {
|
|
2722
2698
|
default: o(() => [
|
|
2723
|
-
|
|
2699
|
+
W(k(e(l)("product.no-category")), 1)
|
|
2724
2700
|
]),
|
|
2725
2701
|
_: 1
|
|
2726
2702
|
}))
|
|
2727
2703
|
]),
|
|
2728
2704
|
"cell-price": o(({ row: u }) => [
|
|
2729
|
-
G("span",
|
|
2705
|
+
G("span", gl, [
|
|
2730
2706
|
G("span", null, [
|
|
2731
|
-
|
|
2732
|
-
u.price != null ? (v(), B("small",
|
|
2707
|
+
W(k(Oe(u.price)), 1),
|
|
2708
|
+
u.price != null ? (v(), B("small", yl, k(ot(u)), 1)) : M("", !0)
|
|
2733
2709
|
]),
|
|
2734
|
-
u.old_price != null ? (v(), B("s", ml,
|
|
2710
|
+
u.old_price != null ? (v(), B("s", ml, k(Oe(u.old_price)), 1)) : M("", !0)
|
|
2735
2711
|
])
|
|
2736
2712
|
]),
|
|
2737
2713
|
"cell-state": o(({ row: u }) => [
|
|
2738
2714
|
u.is_published && !u.visible ? (v(), V(e(ia), {
|
|
2739
2715
|
key: 0,
|
|
2740
|
-
content: e(
|
|
2716
|
+
content: e(l)("panel.invisible")
|
|
2741
2717
|
}, {
|
|
2742
2718
|
default: o(() => [
|
|
2743
|
-
|
|
2744
|
-
type:
|
|
2719
|
+
_(e(Y), {
|
|
2720
|
+
type: Ee(u),
|
|
2745
2721
|
dot: "",
|
|
2746
2722
|
size: "sm"
|
|
2747
2723
|
}, {
|
|
2748
2724
|
default: o(() => [
|
|
2749
|
-
|
|
2725
|
+
W(k(e(l)(`states.${u.state}`)), 1)
|
|
2750
2726
|
]),
|
|
2751
2727
|
_: 2
|
|
2752
2728
|
}, 1032, ["type"])
|
|
@@ -2754,24 +2730,24 @@ const rl = {
|
|
|
2754
2730
|
_: 2
|
|
2755
2731
|
}, 1032, ["content"])) : (v(), V(e(Y), {
|
|
2756
2732
|
key: 1,
|
|
2757
|
-
type:
|
|
2733
|
+
type: Ee(u),
|
|
2758
2734
|
dot: "",
|
|
2759
2735
|
size: "sm"
|
|
2760
2736
|
}, {
|
|
2761
2737
|
default: o(() => [
|
|
2762
|
-
|
|
2738
|
+
W(k(e(l)(`states.${u.state}`)), 1)
|
|
2763
2739
|
]),
|
|
2764
2740
|
_: 2
|
|
2765
2741
|
}, 1032, ["type"]))
|
|
2766
2742
|
]),
|
|
2767
2743
|
"cell-updated_at": o(({ row: u }) => [
|
|
2768
|
-
|
|
2744
|
+
_(e(xt), {
|
|
2769
2745
|
value: u.updated_at,
|
|
2770
2746
|
compact: ""
|
|
2771
2747
|
}, null, 8, ["value"])
|
|
2772
2748
|
]),
|
|
2773
2749
|
"cell-card": o(({ row: u }) => [
|
|
2774
|
-
|
|
2750
|
+
_(e(ua), {
|
|
2775
2751
|
variant: "plain",
|
|
2776
2752
|
title: u.name,
|
|
2777
2753
|
image: u.image?.thumb ?? u.image?.url ?? void 0,
|
|
@@ -2780,13 +2756,13 @@ const rl = {
|
|
|
2780
2756
|
subtitle: u.sku ?? void 0
|
|
2781
2757
|
}, {
|
|
2782
2758
|
meta: o(() => [
|
|
2783
|
-
|
|
2784
|
-
type:
|
|
2759
|
+
_(e(Y), {
|
|
2760
|
+
type: Ee(u),
|
|
2785
2761
|
dot: "",
|
|
2786
2762
|
size: "sm"
|
|
2787
2763
|
}, {
|
|
2788
2764
|
default: o(() => [
|
|
2789
|
-
|
|
2765
|
+
W(k(e(l)(`states.${u.state}`)), 1)
|
|
2790
2766
|
]),
|
|
2791
2767
|
_: 2
|
|
2792
2768
|
}, 1032, ["type"]),
|
|
@@ -2797,7 +2773,7 @@ const rl = {
|
|
|
2797
2773
|
round: ""
|
|
2798
2774
|
}, {
|
|
2799
2775
|
default: o(() => [
|
|
2800
|
-
|
|
2776
|
+
W(k(e(l)("product.no-category")), 1)
|
|
2801
2777
|
]),
|
|
2802
2778
|
_: 1
|
|
2803
2779
|
})),
|
|
@@ -2806,7 +2782,7 @@ const rl = {
|
|
|
2806
2782
|
size: "sm"
|
|
2807
2783
|
}, {
|
|
2808
2784
|
default: o(() => [
|
|
2809
|
-
|
|
2785
|
+
W(k(Oe(u.price)) + k(ot(u)), 1)
|
|
2810
2786
|
]),
|
|
2811
2787
|
_: 2
|
|
2812
2788
|
}, 1024)) : M("", !0)
|
|
@@ -2815,22 +2791,22 @@ const rl = {
|
|
|
2815
2791
|
}, 1032, ["title", "image", "subtitle"])
|
|
2816
2792
|
]),
|
|
2817
2793
|
"cell-actions": o(({ row: u }) => [
|
|
2818
|
-
|
|
2794
|
+
_(e(Je), {
|
|
2819
2795
|
actions: Mt(u),
|
|
2820
2796
|
label: u.name
|
|
2821
2797
|
}, null, 8, ["actions", "label"])
|
|
2822
2798
|
]),
|
|
2823
2799
|
_: 2
|
|
2824
2800
|
}, [
|
|
2825
|
-
|
|
2801
|
+
be(ce.value, (u) => ({
|
|
2826
2802
|
name: `cell-x.${u.key}`,
|
|
2827
2803
|
fn: o(({ row: K }) => [
|
|
2828
|
-
|
|
2804
|
+
_(e(J), {
|
|
2829
2805
|
size: "sm",
|
|
2830
2806
|
truncate: ""
|
|
2831
2807
|
}, {
|
|
2832
2808
|
default: o(() => [
|
|
2833
|
-
|
|
2809
|
+
W(k(jt(K, u.key)), 1)
|
|
2834
2810
|
]),
|
|
2835
2811
|
_: 2
|
|
2836
2812
|
}, 1024)
|
|
@@ -2842,57 +2818,62 @@ const rl = {
|
|
|
2842
2818
|
}, 8, ["view", "title", "views", "actions"])
|
|
2843
2819
|
], 512));
|
|
2844
2820
|
}
|
|
2845
|
-
}),
|
|
2846
|
-
function
|
|
2847
|
-
const
|
|
2848
|
-
return {
|
|
2821
|
+
}), hl = /* @__PURE__ */ de(fl, [["__scopeId", "data-v-44965ffc"]]);
|
|
2822
|
+
function xl(n = {}) {
|
|
2823
|
+
const a = n.path ?? "/catalog", i = { base: a }, m = {
|
|
2849
2824
|
id: "catalog",
|
|
2850
|
-
path:
|
|
2825
|
+
path: `${a}/products`,
|
|
2851
2826
|
routes: [
|
|
2852
|
-
{ path:
|
|
2853
|
-
{ path: `${
|
|
2827
|
+
{ path: a, redirect: `${a}/products` },
|
|
2828
|
+
{ path: `${a}/products`, name: "webx.catalog.products", component: hl, props: i },
|
|
2854
2829
|
{
|
|
2855
|
-
path: `${
|
|
2830
|
+
path: `${a}/products/:id(\\d+)`,
|
|
2856
2831
|
name: "webx.catalog.products.edit",
|
|
2857
|
-
component:
|
|
2832
|
+
component: Xa,
|
|
2858
2833
|
props: i
|
|
2859
2834
|
},
|
|
2835
|
+
{ path: `${a}/deleted`, name: "webx.catalog.deleted", component: Ua, props: i }
|
|
2836
|
+
],
|
|
2837
|
+
types: {
|
|
2838
|
+
"wx-catalog-category": { component: Ca, kind: "field" },
|
|
2839
|
+
// Wide: a row of the list carries a name, a switch and a grip, and half a line is too narrow
|
|
2840
|
+
// to read which filter is which.
|
|
2841
|
+
"wx-catalog-facets": { component: Ea, kind: "field", wide: !0 },
|
|
2842
|
+
"wx-catalog-gallery": { component: Ha, kind: "display" }
|
|
2843
|
+
}
|
|
2844
|
+
}, t = {
|
|
2845
|
+
id: "catalog-categories",
|
|
2846
|
+
path: `${a}/categories`,
|
|
2847
|
+
routes: [
|
|
2860
2848
|
{
|
|
2861
|
-
path: `${
|
|
2849
|
+
path: `${a}/categories`,
|
|
2862
2850
|
name: "webx.catalog.categories",
|
|
2863
2851
|
component: ha,
|
|
2864
2852
|
props: i
|
|
2865
2853
|
},
|
|
2866
2854
|
{
|
|
2867
|
-
path: `${
|
|
2855
|
+
path: `${a}/categories/:id(\\d+)`,
|
|
2868
2856
|
name: "webx.catalog.categories.edit",
|
|
2869
2857
|
component: $a,
|
|
2870
2858
|
props: i
|
|
2871
|
-
}
|
|
2872
|
-
|
|
2873
|
-
],
|
|
2874
|
-
types: {
|
|
2875
|
-
"wx-catalog-category": { component: Ca, kind: "field" },
|
|
2876
|
-
// Wide: a row of the list carries a name, a switch and a grip, and half a line is too narrow
|
|
2877
|
-
// to read which filter is which.
|
|
2878
|
-
"wx-catalog-facets": { component: Oa, kind: "field", wide: !0 },
|
|
2879
|
-
"wx-catalog-gallery": { component: Ga, kind: "display" }
|
|
2880
|
-
}
|
|
2859
|
+
}
|
|
2860
|
+
]
|
|
2881
2861
|
};
|
|
2862
|
+
return [m, t];
|
|
2882
2863
|
}
|
|
2883
2864
|
export {
|
|
2884
2865
|
ca as CATALOG_API,
|
|
2885
2866
|
ha as WxCatalogCategoriesPage,
|
|
2886
|
-
|
|
2867
|
+
ya as WxCatalogCategoryCreateDialog,
|
|
2887
2868
|
$a as WxCatalogCategoryEditor,
|
|
2888
2869
|
Ca as WxCatalogCategoryField,
|
|
2889
2870
|
Ua as WxCatalogDeletedPage,
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2871
|
+
Ea as WxCatalogFacetsField,
|
|
2872
|
+
Ha as WxCatalogGallery,
|
|
2873
|
+
ol as WxCatalogProductCreateDialog,
|
|
2874
|
+
Xa as WxCatalogProductEditor,
|
|
2875
|
+
hl as WxCatalogProductsPage,
|
|
2876
|
+
xl as catalog,
|
|
2896
2877
|
va as catalogMessages,
|
|
2897
2878
|
zt as categoryEditorKey,
|
|
2898
2879
|
ne as createCatalogApi,
|