@webx-ui/module-catalog 0.8.9 → 0.9.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/dist/CategoriesPage-B6GBTzvN.js +279 -0
- package/dist/CategoriesPage-B6GBTzvN.js.map +1 -0
- package/dist/CategoryEditorPage-y6EFmOof.js +232 -0
- package/dist/CategoryEditorPage-y6EFmOof.js.map +1 -0
- package/dist/DeletedPage-TGTyQbzn.js +214 -0
- package/dist/DeletedPage-TGTyQbzn.js.map +1 -0
- package/dist/ExchangeImportPage-C6cSg7Cr.js +603 -0
- package/dist/ExchangeImportPage-C6cSg7Cr.js.map +1 -0
- package/dist/ExchangePage-9RrRcSiS.js +544 -0
- package/dist/ExchangePage-9RrRcSiS.js.map +1 -0
- package/dist/ExchangeProfilePage-BUnh9_D7.js +321 -0
- package/dist/ExchangeProfilePage-BUnh9_D7.js.map +1 -0
- package/dist/ExchangeProfilesPage-T6G3HHD8.js +180 -0
- package/dist/ExchangeProfilesPage-T6G3HHD8.js.map +1 -0
- package/dist/ProductEditorPage-Bfp6ZV3d.js +262 -0
- package/dist/ProductEditorPage-Bfp6ZV3d.js.map +1 -0
- package/dist/ProductsPage-BBmw9W4m.js +963 -0
- package/dist/ProductsPage-BBmw9W4m.js.map +1 -0
- package/dist/index-BTEbHnJ5.js +2571 -0
- package/dist/index-BTEbHnJ5.js.map +1 -0
- package/dist/index.d.ts +67 -9
- package/dist/index.js +46 -6056
- package/dist/index.js.map +1 -1
- package/dist/paths-DvfRnXtl.js +15 -0
- package/dist/paths-DvfRnXtl.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,963 @@
|
|
|
1
|
+
import { defineComponent as ye, reactive as gl, computed as y, onMounted as ge, openBlock as o, createBlock as f, unref as a, isRef as fl, withCtx as u, createVNode as p, createTextVNode as g, toDisplayString as i, createElementBlock as x, Fragment as L, renderList as G, ref as C, onBeforeUnmount as bl, createCommentVNode as $, createElementVNode as A, useTemplateRef as kl, watch as Ae, createSlots as hl, normalizeClass as _l } from "vue";
|
|
2
|
+
import { useRouter as De, useRoute as xl } from "vue-router";
|
|
3
|
+
import { useAdmin as fe, useTranslate as ne, WxSourceSelect as wl, useErrorText as Ie, rowMenuWidth as Se, WxListScreen as $l, WxRowMenu as ql, WxDate as zl, WxFilterChips as Cl } from "@webx-ui/module-admin";
|
|
4
|
+
import { useModal as Al, WxDialog as Sl, WxText as D, WxFormItem as de, WxTreeSelect as je, WxSelect as pe, WxInput as Wl, WxSpace as Vl, WxButton as E, createModal as ve, WxDropdown as Ul, WxDropdownItem as We, WxIcon as me, WxProgress as Tl, toast as S, useElementWidth as Bl, WxAlert as Ve, WxTable as Fl, WxEntityCard as El, WxBadge as Q, WxTooltip as Pl, WxInputNumber as Ue, WxSwitch as Rl, confirm as Nl } from "@webx-ui/core";
|
|
5
|
+
import { u as Le, a as be, _ as ke, c as Ge, E as Ol, b as Ml, d as Dl, r as Il, f as jl, C as Te, F as Be, w as Ll } from "./index-BTEbHnJ5.js";
|
|
6
|
+
const Gl = /* @__PURE__ */ ye({
|
|
7
|
+
__name: "BulkParamsDialog",
|
|
8
|
+
props: {
|
|
9
|
+
action: {},
|
|
10
|
+
count: {}
|
|
11
|
+
},
|
|
12
|
+
setup(z) {
|
|
13
|
+
const W = z, { open: w, resolve: P, dismiss: R } = Al(), q = fe(), v = Le(q);
|
|
14
|
+
be();
|
|
15
|
+
const _ = ne("webx-catalog"), t = gl({}), V = y(
|
|
16
|
+
() => W.action.params.every(
|
|
17
|
+
(b) => !b.rules?.includes("required") || t[b.name] !== void 0 && t[b.name] !== null && t[b.name] !== ""
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
ge(() => {
|
|
21
|
+
W.action.params.some((b) => b.type === "category") && v.load().catch(() => {
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
function N(b) {
|
|
25
|
+
return Array.isArray(b.values) ? b.values.map(
|
|
26
|
+
(d) => typeof d == "object" ? { value: d.value, label: d.label } : { value: d, label: String(d) }
|
|
27
|
+
) : [];
|
|
28
|
+
}
|
|
29
|
+
function T(b) {
|
|
30
|
+
return b.rules?.includes("required") ?? !1;
|
|
31
|
+
}
|
|
32
|
+
function B(b, d) {
|
|
33
|
+
t[b.name] = Array.isArray(d) ? d[0] ?? null : d;
|
|
34
|
+
}
|
|
35
|
+
function r() {
|
|
36
|
+
V.value && P({ ...t });
|
|
37
|
+
}
|
|
38
|
+
return (b, d) => (o(), f(a(Sl), {
|
|
39
|
+
open: a(w),
|
|
40
|
+
"onUpdate:open": d[1] || (d[1] = (s) => fl(w) ? w.value = s : null),
|
|
41
|
+
title: a(_)("panel.bulk-confirm-title", { action: z.action.label }),
|
|
42
|
+
width: 440
|
|
43
|
+
}, {
|
|
44
|
+
footer: u(() => [
|
|
45
|
+
p(a(Vl), { size: "sm" }, {
|
|
46
|
+
default: u(() => [
|
|
47
|
+
p(a(E), {
|
|
48
|
+
variant: "outline",
|
|
49
|
+
onClick: d[0] || (d[0] = (s) => a(R)())
|
|
50
|
+
}, {
|
|
51
|
+
default: u(() => [
|
|
52
|
+
g(i(a(_)("panel.cancel")), 1)
|
|
53
|
+
]),
|
|
54
|
+
_: 1
|
|
55
|
+
}),
|
|
56
|
+
p(a(E), {
|
|
57
|
+
type: z.action.permission === "catalog.delete" && !z.action.trashed ? "danger" : "primary",
|
|
58
|
+
disabled: !V.value,
|
|
59
|
+
onClick: r
|
|
60
|
+
}, {
|
|
61
|
+
default: u(() => [
|
|
62
|
+
g(i(a(_)("panel.bulk-apply")), 1)
|
|
63
|
+
]),
|
|
64
|
+
_: 1
|
|
65
|
+
}, 8, ["type", "disabled"])
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
})
|
|
69
|
+
]),
|
|
70
|
+
default: u(() => [
|
|
71
|
+
p(a(D), {
|
|
72
|
+
tone: "muted",
|
|
73
|
+
size: "sm"
|
|
74
|
+
}, {
|
|
75
|
+
default: u(() => [
|
|
76
|
+
g(i(a(_)("panel.bulk-confirm-text", { count: z.count })), 1)
|
|
77
|
+
]),
|
|
78
|
+
_: 1
|
|
79
|
+
}),
|
|
80
|
+
(o(!0), x(L, null, G(z.action.params, (s) => (o(), f(a(de), {
|
|
81
|
+
key: s.name,
|
|
82
|
+
label: s.label,
|
|
83
|
+
required: T(s),
|
|
84
|
+
class: "wx-catalog-bulk-params__field"
|
|
85
|
+
}, {
|
|
86
|
+
default: u(() => [
|
|
87
|
+
s.type === "category" ? (o(), f(a(je), {
|
|
88
|
+
key: 0,
|
|
89
|
+
"model-value": t[s.name] ?? null,
|
|
90
|
+
nodes: a(v).nodes.value ?? [],
|
|
91
|
+
"node-key": "id",
|
|
92
|
+
"label-key": "name",
|
|
93
|
+
"children-key": "children",
|
|
94
|
+
"check-strictly": "",
|
|
95
|
+
filterable: "",
|
|
96
|
+
placeholder: a(_)("panel.pick-category"),
|
|
97
|
+
"filter-placeholder": a(_)("panel.search-categories"),
|
|
98
|
+
"aria-label": s.label,
|
|
99
|
+
"onUpdate:modelValue": (k) => B(s, k)
|
|
100
|
+
}, null, 8, ["model-value", "nodes", "placeholder", "filter-placeholder", "aria-label", "onUpdate:modelValue"])) : s.source ? (o(), f(a(wl), {
|
|
101
|
+
key: 1,
|
|
102
|
+
"model-value": t[s.name] ?? null,
|
|
103
|
+
source: s.source,
|
|
104
|
+
filterable: "",
|
|
105
|
+
clearable: !T(s),
|
|
106
|
+
placeholder: T(s) ? void 0 : a(_)("panel.bulk-param-empty"),
|
|
107
|
+
"aria-label": s.label,
|
|
108
|
+
"onUpdate:modelValue": (k) => t[s.name] = k
|
|
109
|
+
}, null, 8, ["model-value", "source", "clearable", "placeholder", "aria-label", "onUpdate:modelValue"])) : Array.isArray(s.values) ? (o(), f(a(pe), {
|
|
110
|
+
key: 2,
|
|
111
|
+
"model-value": t[s.name] ?? null,
|
|
112
|
+
options: N(s),
|
|
113
|
+
"aria-label": s.label,
|
|
114
|
+
"onUpdate:modelValue": (k) => t[s.name] = k
|
|
115
|
+
}, null, 8, ["model-value", "options", "aria-label", "onUpdate:modelValue"])) : (o(), f(a(Wl), {
|
|
116
|
+
key: 3,
|
|
117
|
+
modelValue: t[s.name],
|
|
118
|
+
"onUpdate:modelValue": (k) => t[s.name] = k,
|
|
119
|
+
"aria-label": s.label
|
|
120
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "aria-label"]))
|
|
121
|
+
]),
|
|
122
|
+
_: 2
|
|
123
|
+
}, 1032, ["label", "required"]))), 128))
|
|
124
|
+
]),
|
|
125
|
+
_: 1
|
|
126
|
+
}, 8, ["open", "title"]));
|
|
127
|
+
}
|
|
128
|
+
}), Jl = /* @__PURE__ */ ke(Gl, [["__scopeId", "data-v-7cf01e29"]]), Xl = { class: "wx-catalog-bulk" }, Yl = {
|
|
129
|
+
key: 1,
|
|
130
|
+
class: "wx-catalog-bulk__progress",
|
|
131
|
+
role: "status"
|
|
132
|
+
}, Ql = {
|
|
133
|
+
key: 2,
|
|
134
|
+
class: "wx-catalog-bulk__refused"
|
|
135
|
+
}, Hl = { class: "wx-catalog-bulk__errors" }, Fe = 1500, Kl = /* @__PURE__ */ ye({
|
|
136
|
+
__name: "BulkBar",
|
|
137
|
+
props: {
|
|
138
|
+
count: {},
|
|
139
|
+
selection: {},
|
|
140
|
+
base: { default: "/catalog" }
|
|
141
|
+
},
|
|
142
|
+
emits: ["finished"],
|
|
143
|
+
setup(z, { emit: W }) {
|
|
144
|
+
const w = z, P = W, R = fe(), q = Ge(R);
|
|
145
|
+
be();
|
|
146
|
+
const v = ne("webx-catalog"), _ = Ie(), t = ve(
|
|
147
|
+
Jl
|
|
148
|
+
), V = ve(
|
|
149
|
+
Ol
|
|
150
|
+
), N = De();
|
|
151
|
+
async function T() {
|
|
152
|
+
const c = await V({ selection: w.selection, count: w.count });
|
|
153
|
+
c && (S.success(v("panel.exchange-export-started")), N.push({ path: `${w.base}/exchange`, query: { run: String(c.id) } }));
|
|
154
|
+
}
|
|
155
|
+
const B = C([]), r = C(null), b = C(!1);
|
|
156
|
+
let d;
|
|
157
|
+
const s = y(
|
|
158
|
+
() => r.value !== null && (r.value.status === "queued" || r.value.status === "running")
|
|
159
|
+
), k = y(
|
|
160
|
+
() => r.value !== null && !s.value && r.value.failed > 0 ? r.value : null
|
|
161
|
+
);
|
|
162
|
+
ge(async () => {
|
|
163
|
+
try {
|
|
164
|
+
B.value = await q.bulkActions();
|
|
165
|
+
} catch {
|
|
166
|
+
B.value = [];
|
|
167
|
+
}
|
|
168
|
+
}), bl(() => clearTimeout(d));
|
|
169
|
+
function O(c) {
|
|
170
|
+
return c.params.length > 0 || c.permission === "catalog.delete" && !c.trashed;
|
|
171
|
+
}
|
|
172
|
+
async function J(c) {
|
|
173
|
+
let U = {};
|
|
174
|
+
if (O(c)) {
|
|
175
|
+
const h = await t({ action: c, count: w.count });
|
|
176
|
+
if (!h) return;
|
|
177
|
+
U = h;
|
|
178
|
+
}
|
|
179
|
+
b.value = !0;
|
|
180
|
+
try {
|
|
181
|
+
X(await q.startBulk(c.key, U, w.selection));
|
|
182
|
+
} catch (h) {
|
|
183
|
+
S.danger(_(h));
|
|
184
|
+
} finally {
|
|
185
|
+
b.value = !1;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function X(c) {
|
|
189
|
+
if (r.value = c, c.status === "queued" || c.status === "running") {
|
|
190
|
+
d = setTimeout(() => {
|
|
191
|
+
H(c.id);
|
|
192
|
+
}, Fe);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
Y(c);
|
|
196
|
+
}
|
|
197
|
+
async function H(c) {
|
|
198
|
+
try {
|
|
199
|
+
X(await q.bulkRun(c));
|
|
200
|
+
} catch {
|
|
201
|
+
d = setTimeout(() => {
|
|
202
|
+
H(c);
|
|
203
|
+
}, Fe * 2);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function Y(c) {
|
|
207
|
+
c.total === 0 ? S.warning(v("panel.bulk-nothing")) : c.status === "failed" ? S.danger(v("panel.bulk-stopped", { count: c.done })) : c.failed === 0 && S.success(v("panel.bulk-done", { count: c.done })), c.failed === 0 && c.status !== "failed" && (r.value = null), P(
|
|
208
|
+
"finished",
|
|
209
|
+
c.errors.map((U) => U.id)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return (c, U) => (o(), x("div", Xl, [
|
|
213
|
+
s.value ? $("", !0) : (o(), f(a(Ul), {
|
|
214
|
+
key: 0,
|
|
215
|
+
align: "start"
|
|
216
|
+
}, {
|
|
217
|
+
trigger: u(() => [
|
|
218
|
+
p(a(E), {
|
|
219
|
+
size: "sm",
|
|
220
|
+
variant: "outline",
|
|
221
|
+
loading: b.value
|
|
222
|
+
}, {
|
|
223
|
+
default: u(() => [
|
|
224
|
+
g(i(a(v)("panel.bulk-actions")) + " ", 1),
|
|
225
|
+
p(a(me), {
|
|
226
|
+
name: "chevron-down",
|
|
227
|
+
size: "sm"
|
|
228
|
+
})
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["loading"])
|
|
232
|
+
]),
|
|
233
|
+
default: u(() => [
|
|
234
|
+
p(a(We), { onClick: T }, {
|
|
235
|
+
default: u(() => [
|
|
236
|
+
g(i(a(v)("panel.exchange-export")), 1)
|
|
237
|
+
]),
|
|
238
|
+
_: 1
|
|
239
|
+
}),
|
|
240
|
+
(o(!0), x(L, null, G(B.value, (h) => (o(), f(a(We), {
|
|
241
|
+
key: h.key,
|
|
242
|
+
tone: h.permission === "catalog.delete" && !h.trashed ? "danger" : "default",
|
|
243
|
+
onClick: (K) => J(h)
|
|
244
|
+
}, {
|
|
245
|
+
default: u(() => [
|
|
246
|
+
g(i(h.label), 1)
|
|
247
|
+
]),
|
|
248
|
+
_: 2
|
|
249
|
+
}, 1032, ["tone", "onClick"]))), 128))
|
|
250
|
+
]),
|
|
251
|
+
_: 1
|
|
252
|
+
})),
|
|
253
|
+
s.value && r.value ? (o(), x("div", Yl, [
|
|
254
|
+
p(a(Tl), {
|
|
255
|
+
value: r.value.done + r.value.failed,
|
|
256
|
+
max: Math.max(1, r.value.total),
|
|
257
|
+
size: "sm",
|
|
258
|
+
"aria-label": r.value.label
|
|
259
|
+
}, null, 8, ["value", "max", "aria-label"]),
|
|
260
|
+
p(a(D), {
|
|
261
|
+
size: "sm",
|
|
262
|
+
tone: "muted"
|
|
263
|
+
}, {
|
|
264
|
+
default: u(() => [
|
|
265
|
+
g(i(r.value.label) + " · " + i(a(v)("panel.bulk-running", { done: r.value.done + r.value.failed, total: r.value.total })), 1)
|
|
266
|
+
]),
|
|
267
|
+
_: 1
|
|
268
|
+
})
|
|
269
|
+
])) : $("", !0),
|
|
270
|
+
k.value ? (o(), x("div", Ql, [
|
|
271
|
+
p(a(D), {
|
|
272
|
+
size: "sm",
|
|
273
|
+
weight: "medium"
|
|
274
|
+
}, {
|
|
275
|
+
default: u(() => [
|
|
276
|
+
g(i(k.value.label) + " · " + i(a(v)("panel.bulk-done", { count: k.value.done })) + " · " + i(a(v)("panel.bulk-refused", { count: k.value.failed })), 1)
|
|
277
|
+
]),
|
|
278
|
+
_: 1
|
|
279
|
+
}),
|
|
280
|
+
A("details", Hl, [
|
|
281
|
+
A("summary", null, i(a(v)("panel.bulk-errors")), 1),
|
|
282
|
+
A("ul", null, [
|
|
283
|
+
(o(!0), x(L, null, G(k.value.errors, (h) => (o(), x("li", {
|
|
284
|
+
key: h.id
|
|
285
|
+
}, [
|
|
286
|
+
A("strong", null, i(h.name), 1),
|
|
287
|
+
g(" — " + i(h.message), 1)
|
|
288
|
+
]))), 128))
|
|
289
|
+
])
|
|
290
|
+
]),
|
|
291
|
+
p(a(E), {
|
|
292
|
+
size: "sm",
|
|
293
|
+
variant: "text",
|
|
294
|
+
onClick: U[0] || (U[0] = (h) => r.value = null)
|
|
295
|
+
}, {
|
|
296
|
+
default: u(() => [
|
|
297
|
+
g(i(a(v)("panel.bulk-close")), 1)
|
|
298
|
+
]),
|
|
299
|
+
_: 1
|
|
300
|
+
})
|
|
301
|
+
])) : $("", !0)
|
|
302
|
+
]));
|
|
303
|
+
}
|
|
304
|
+
}), Zl = /* @__PURE__ */ ke(Kl, [["__scopeId", "data-v-228a8e67"]]), ea = {
|
|
305
|
+
key: 0,
|
|
306
|
+
class: "wx-catalog-products__selection"
|
|
307
|
+
}, la = {
|
|
308
|
+
key: 3,
|
|
309
|
+
class: "wx-catalog-products__corrected"
|
|
310
|
+
}, aa = {
|
|
311
|
+
key: 1,
|
|
312
|
+
class: "wx-catalog-products__range"
|
|
313
|
+
}, ta = ["src"], na = { class: "wx-catalog-products__name" }, ua = { class: "wx-catalog-products__title" }, oa = { class: "wx-catalog-products__sku" }, sa = { class: "wx-catalog-products__price" }, ia = { key: 0 }, ra = { key: 0 }, Ee = 640, Pe = 180, Re = 120, Ne = 140, Oe = 120, Me = 130, ca = /* @__PURE__ */ ye({
|
|
314
|
+
__name: "ProductsPage",
|
|
315
|
+
props: {
|
|
316
|
+
base: { default: "/catalog" }
|
|
317
|
+
},
|
|
318
|
+
setup(z) {
|
|
319
|
+
const W = z, w = fe(), P = Ge(w), R = Le(w), q = Ml(w), v = xl(), _ = De();
|
|
320
|
+
be();
|
|
321
|
+
const t = ne("webx-catalog"), V = ne("webx-admin"), N = Ie(), T = kl("root"), B = Bl(T), r = C(null), b = C(!0), d = C([]), s = C(!1), k = C(typeof v.query.q == "string" ? v.query.q : ""), O = C(Number(v.query.page ?? 1) || 1), J = C(null), X = y(() => r.value?.corrected ?? null), H = y(() => r.value?.fell_back === !0), Y = y(() => r.value?.outgrown ?? null);
|
|
322
|
+
let c;
|
|
323
|
+
const U = ve(Dl), h = y(() => w.can("catalog.manage")), K = y(() => w.can("catalog.delete")), he = y(() => t("module.products")), M = y({
|
|
324
|
+
get: () => typeof v.query.view == "string" ? v.query.view : "",
|
|
325
|
+
set: (e) => {
|
|
326
|
+
_.replace({
|
|
327
|
+
query: { ...v.query, view: e === "" ? void 0 : String(e), page: void 0 }
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}), Je = y(
|
|
331
|
+
() => q.sorts.value.length > 0 ? q.sorts.value : [{ key: "default", label: t("panel.sort-default") }]
|
|
332
|
+
), Z = y(() => {
|
|
333
|
+
const e = v.query.sort;
|
|
334
|
+
return typeof e == "string" && q.sorts.value.some((n) => n.key === e) ? e : "default";
|
|
335
|
+
}), ue = y(() => q.facets.value ?? []), F = y(() => Il(v.query, ue.value)), Xe = y(() => {
|
|
336
|
+
const e = r.value?.counts.no_category ?? 0;
|
|
337
|
+
return [
|
|
338
|
+
{ value: "", label: t("panel.view-all") },
|
|
339
|
+
{ value: "published", label: t("panel.view-published") },
|
|
340
|
+
{ value: "unpublished", label: t("panel.view-unpublished") },
|
|
341
|
+
{
|
|
342
|
+
value: "no-category",
|
|
343
|
+
label: t("panel.view-no-category"),
|
|
344
|
+
badge: e > 0 ? e : void 0
|
|
345
|
+
}
|
|
346
|
+
];
|
|
347
|
+
}), _e = y(() => (r.value?.data ?? []).some((e) => "price" in e)), ee = y(() => r.value?.columns ?? []), Ye = y(() => B.value > 0 && B.value < Ee), Qe = y(
|
|
348
|
+
() => new Map(jl(R.nodes.value ?? []).map((e) => [String(e.id), e.name]))
|
|
349
|
+
), xe = 108 + Pe + Ne + Oe + Me + Se, we = (e) => xe + Re * (e + 1), He = y(() => Ye.value ? [{ key: "card", label: "" }] : [
|
|
350
|
+
{ key: "image", label: "", width: 64 },
|
|
351
|
+
{ key: "name", label: t("panel.column-product"), minWidth: Pe },
|
|
352
|
+
{ key: "category", label: t("product.category"), width: Ne, hideBelow: xe },
|
|
353
|
+
..._e.value ? [{ key: "price", label: t("product.price"), width: Oe, align: "right" }] : [],
|
|
354
|
+
...ee.value.map((e, n) => ({
|
|
355
|
+
key: `x.${e.key}`,
|
|
356
|
+
label: e.label,
|
|
357
|
+
width: Re,
|
|
358
|
+
hideBelow: we(n)
|
|
359
|
+
})),
|
|
360
|
+
{ key: "state", label: t("panel.column-state"), width: Me, hideBelow: 720 },
|
|
361
|
+
{
|
|
362
|
+
key: "updated_at",
|
|
363
|
+
label: t("panel.column-updated"),
|
|
364
|
+
width: 130,
|
|
365
|
+
hideBelow: Math.max(1180, we(ee.value.length - 1) + 130)
|
|
366
|
+
},
|
|
367
|
+
{ key: "actions", label: "", width: Se, align: "right" }
|
|
368
|
+
]);
|
|
369
|
+
function Ke(e) {
|
|
370
|
+
const n = e?.search ?? k.value;
|
|
371
|
+
return {
|
|
372
|
+
q: n,
|
|
373
|
+
typed: J.value !== null && J.value === n,
|
|
374
|
+
state: M.value,
|
|
375
|
+
sort: Z.value,
|
|
376
|
+
page: e?.page ?? O.value,
|
|
377
|
+
per_page: e?.perPage ?? c,
|
|
378
|
+
facets: F.value
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
let oe = 0;
|
|
382
|
+
async function I(e) {
|
|
383
|
+
const n = ++oe;
|
|
384
|
+
b.value = !0;
|
|
385
|
+
try {
|
|
386
|
+
const l = await P.products(Ke(e));
|
|
387
|
+
n === oe && (r.value = l);
|
|
388
|
+
} catch (l) {
|
|
389
|
+
S.danger(N(l));
|
|
390
|
+
} finally {
|
|
391
|
+
n === oe && (b.value = !1);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function Ze(e) {
|
|
395
|
+
c = e.perPage;
|
|
396
|
+
const n = {
|
|
397
|
+
...v.query,
|
|
398
|
+
q: e.search === "" ? void 0 : e.search,
|
|
399
|
+
page: e.page === 1 ? void 0 : String(e.page)
|
|
400
|
+
};
|
|
401
|
+
_.replace({ query: n }), I(e);
|
|
402
|
+
}
|
|
403
|
+
function j(e, n) {
|
|
404
|
+
_.replace({
|
|
405
|
+
query: { ...v.query, [`${Be}${e}`]: Ll(n), page: void 0 }
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
function el(e) {
|
|
409
|
+
_.replace({
|
|
410
|
+
query: {
|
|
411
|
+
...v.query,
|
|
412
|
+
sort: typeof e == "string" && e !== "default" ? e : void 0,
|
|
413
|
+
page: void 0
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function ll() {
|
|
418
|
+
const e = Object.fromEntries(
|
|
419
|
+
Object.entries(v.query).filter(([n]) => !n.startsWith(Be))
|
|
420
|
+
);
|
|
421
|
+
_.replace({ query: { ...e, page: void 0 } });
|
|
422
|
+
}
|
|
423
|
+
function al(e) {
|
|
424
|
+
const n = r.value?.facets?.[e]?.values ?? [], l = n.map((m) => ({
|
|
425
|
+
value: m.value,
|
|
426
|
+
label: `${m.label} (${m.count})`
|
|
427
|
+
}));
|
|
428
|
+
for (const m of se(e))
|
|
429
|
+
n.some((yl) => yl.value === m) || l.push({ value: m, label: m });
|
|
430
|
+
return l;
|
|
431
|
+
}
|
|
432
|
+
function tl(e, n) {
|
|
433
|
+
return e.kind === "tree" ? Qe.value.get(String(n)) ?? `#${n}` : r.value?.facets?.[e.key]?.values?.find((l) => l.value === String(n))?.label ?? String(n);
|
|
434
|
+
}
|
|
435
|
+
function $e(e, n) {
|
|
436
|
+
const l = r.value?.facets?.[e]?.[n];
|
|
437
|
+
return typeof l == "number" ? ze.value.format(l) : "";
|
|
438
|
+
}
|
|
439
|
+
const le = y(
|
|
440
|
+
() => ue.value.flatMap((e) => {
|
|
441
|
+
const n = F.value[e.key];
|
|
442
|
+
if (n === void 0) return [];
|
|
443
|
+
let l;
|
|
444
|
+
return n === !0 ? l = e.label : Array.isArray(n) ? l = `${e.label}: ${n.map((m) => tl(e, m)).join(", ")}` : l = `${e.label}: ${n.min ?? "…"} – ${n.max ?? "…"}`, [{ key: e.key, label: l, clear: () => j(e.key, null) }];
|
|
445
|
+
})
|
|
446
|
+
), nl = y(() => k.value !== "" || le.value.length > 0 || M.value !== "" ? t("panel.empty-search") : t("panel.empty-products"));
|
|
447
|
+
function ae(e) {
|
|
448
|
+
const n = F.value[e];
|
|
449
|
+
return n && !Array.isArray(n) && n !== !0 ? n : {};
|
|
450
|
+
}
|
|
451
|
+
function se(e) {
|
|
452
|
+
const n = F.value[e];
|
|
453
|
+
return Array.isArray(n) ? n.map(String) : [];
|
|
454
|
+
}
|
|
455
|
+
function ul(e) {
|
|
456
|
+
return se(e).map(Number);
|
|
457
|
+
}
|
|
458
|
+
const te = y(() => r.value?.total ?? 0), ol = y(() => {
|
|
459
|
+
if (!s.value) return { ids: d.value.map(Number) };
|
|
460
|
+
const e = {};
|
|
461
|
+
for (const [n, l] of Object.entries(F.value))
|
|
462
|
+
e[n] = l === !0 ? ["1"] : l;
|
|
463
|
+
return { query: { q: k.value, state: String(M.value), facets: e } };
|
|
464
|
+
});
|
|
465
|
+
function sl() {
|
|
466
|
+
d.value = [], s.value = !1;
|
|
467
|
+
}
|
|
468
|
+
function il() {
|
|
469
|
+
J.value = k.value, I();
|
|
470
|
+
}
|
|
471
|
+
function rl(e) {
|
|
472
|
+
s.value = !1, d.value = e, I();
|
|
473
|
+
}
|
|
474
|
+
Ae([M, Z, () => JSON.stringify(F.value), k], () => {
|
|
475
|
+
s.value = !1;
|
|
476
|
+
}), Ae([M, Z, () => JSON.stringify(F.value)], () => {
|
|
477
|
+
O.value !== 1 ? O.value = 1 : I();
|
|
478
|
+
}), ge(() => {
|
|
479
|
+
q.load().catch(() => {
|
|
480
|
+
}), R.load().catch(() => {
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
function ie(e) {
|
|
484
|
+
_.push({ path: `${W.base}/products/${e.id}` });
|
|
485
|
+
}
|
|
486
|
+
async function cl() {
|
|
487
|
+
const e = await U({});
|
|
488
|
+
e && ie(e.product);
|
|
489
|
+
}
|
|
490
|
+
async function qe(e, n) {
|
|
491
|
+
try {
|
|
492
|
+
await P.saveProduct(e.id, { is_published: n }), S.success(t(n ? "panel.product-published" : "panel.product-unpublished")), await I();
|
|
493
|
+
} catch (l) {
|
|
494
|
+
S.danger(N(l));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
async function dl(e) {
|
|
498
|
+
if (await Nl({
|
|
499
|
+
title: t("panel.delete-product-title", { name: e.name }),
|
|
500
|
+
message: t("panel.delete-product-text"),
|
|
501
|
+
confirmText: t("panel.delete"),
|
|
502
|
+
cancelText: t("panel.cancel"),
|
|
503
|
+
tone: "danger"
|
|
504
|
+
}))
|
|
505
|
+
try {
|
|
506
|
+
await P.removeProduct(e.id), d.value = d.value.filter((l) => l !== e.id), S.success(t("panel.product-deleted")), await I();
|
|
507
|
+
} catch (l) {
|
|
508
|
+
S.danger(N(l));
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function pl(e) {
|
|
512
|
+
const n = [
|
|
513
|
+
{ key: "open", icon: "edit", label: t("panel.open"), run: () => ie(e) }
|
|
514
|
+
];
|
|
515
|
+
return e.url && n.push({ key: "site", icon: "link", label: t("panel.open-on-site"), href: e.url }), h.value && n.push(
|
|
516
|
+
e.is_published ? {
|
|
517
|
+
key: "unpublish",
|
|
518
|
+
icon: "eye-off",
|
|
519
|
+
label: t("panel.unpublish"),
|
|
520
|
+
run: () => {
|
|
521
|
+
qe(e, !1);
|
|
522
|
+
}
|
|
523
|
+
} : {
|
|
524
|
+
key: "publish",
|
|
525
|
+
icon: "eye",
|
|
526
|
+
label: t("panel.publish"),
|
|
527
|
+
run: () => {
|
|
528
|
+
qe(e, !0);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
), K.value && n.push({
|
|
532
|
+
key: "delete",
|
|
533
|
+
icon: "trash",
|
|
534
|
+
label: t("panel.delete"),
|
|
535
|
+
danger: !0,
|
|
536
|
+
run: () => {
|
|
537
|
+
dl(e);
|
|
538
|
+
}
|
|
539
|
+
}), n;
|
|
540
|
+
}
|
|
541
|
+
function re(e) {
|
|
542
|
+
return e.is_published ? e.visible ? "success" : "warning" : "default";
|
|
543
|
+
}
|
|
544
|
+
const ze = y(
|
|
545
|
+
() => new Intl.NumberFormat(w.i18n.state.locale, {
|
|
546
|
+
minimumFractionDigits: 0,
|
|
547
|
+
maximumFractionDigits: 2
|
|
548
|
+
})
|
|
549
|
+
);
|
|
550
|
+
function ce(e) {
|
|
551
|
+
return e == null ? "—" : ze.value.format(e);
|
|
552
|
+
}
|
|
553
|
+
function Ce(e) {
|
|
554
|
+
return e.unit ? ` / ${t(`units.${e.unit}`)}` : "";
|
|
555
|
+
}
|
|
556
|
+
function vl(e) {
|
|
557
|
+
return Array.isArray(e) ? e.length > 0 : e != null && e !== "";
|
|
558
|
+
}
|
|
559
|
+
const ml = y(() => {
|
|
560
|
+
const e = [];
|
|
561
|
+
return h.value && e.push({
|
|
562
|
+
key: "new",
|
|
563
|
+
label: t("panel.new-product"),
|
|
564
|
+
icon: "plus",
|
|
565
|
+
primary: !0,
|
|
566
|
+
run: () => {
|
|
567
|
+
cl();
|
|
568
|
+
}
|
|
569
|
+
}), K.value && e.push({
|
|
570
|
+
key: "deleted",
|
|
571
|
+
label: t("module.deleted"),
|
|
572
|
+
icon: "trash",
|
|
573
|
+
menu: !0,
|
|
574
|
+
run: () => {
|
|
575
|
+
_.push(`${W.base}/deleted`);
|
|
576
|
+
}
|
|
577
|
+
}), e.push({
|
|
578
|
+
key: "exchange",
|
|
579
|
+
label: t("panel.exchange-title"),
|
|
580
|
+
icon: "file-csv",
|
|
581
|
+
menu: !0,
|
|
582
|
+
run: () => {
|
|
583
|
+
_.push(`${W.base}/exchange`);
|
|
584
|
+
}
|
|
585
|
+
}), e;
|
|
586
|
+
});
|
|
587
|
+
return (e, n) => (o(), x("div", {
|
|
588
|
+
ref_key: "root",
|
|
589
|
+
ref: T,
|
|
590
|
+
class: "wx-catalog-products"
|
|
591
|
+
}, [
|
|
592
|
+
p(a($l), {
|
|
593
|
+
view: M.value,
|
|
594
|
+
"onUpdate:view": n[4] || (n[4] = (l) => M.value = l),
|
|
595
|
+
title: he.value,
|
|
596
|
+
views: Xe.value,
|
|
597
|
+
actions: ml.value
|
|
598
|
+
}, {
|
|
599
|
+
default: u(() => [
|
|
600
|
+
d.value.length > 0 || s.value ? (o(), x("div", ea, [
|
|
601
|
+
p(a(D), {
|
|
602
|
+
size: "sm",
|
|
603
|
+
weight: "medium"
|
|
604
|
+
}, {
|
|
605
|
+
default: u(() => [
|
|
606
|
+
g(i(s.value ? a(t)("panel.selected-all", { count: te.value }) : a(t)("panel.selected", { count: d.value.length })), 1)
|
|
607
|
+
]),
|
|
608
|
+
_: 1
|
|
609
|
+
}),
|
|
610
|
+
!s.value && te.value > d.value.length ? (o(), f(a(E), {
|
|
611
|
+
key: 0,
|
|
612
|
+
size: "sm",
|
|
613
|
+
variant: "text",
|
|
614
|
+
onClick: n[0] || (n[0] = (l) => s.value = !0)
|
|
615
|
+
}, {
|
|
616
|
+
default: u(() => [
|
|
617
|
+
g(i(a(t)("panel.select-all-found", { count: te.value })), 1)
|
|
618
|
+
]),
|
|
619
|
+
_: 1
|
|
620
|
+
})) : $("", !0),
|
|
621
|
+
p(a(E), {
|
|
622
|
+
size: "sm",
|
|
623
|
+
variant: "text",
|
|
624
|
+
onClick: sl
|
|
625
|
+
}, {
|
|
626
|
+
default: u(() => [
|
|
627
|
+
g(i(a(t)("panel.select-clear")), 1)
|
|
628
|
+
]),
|
|
629
|
+
_: 1
|
|
630
|
+
}),
|
|
631
|
+
h.value || K.value ? (o(), f(Zl, {
|
|
632
|
+
key: 1,
|
|
633
|
+
count: s.value ? te.value : d.value.length,
|
|
634
|
+
selection: ol.value,
|
|
635
|
+
base: W.base,
|
|
636
|
+
onFinished: rl
|
|
637
|
+
}, null, 8, ["count", "selection", "base"])) : $("", !0)
|
|
638
|
+
])) : $("", !0),
|
|
639
|
+
H.value ? (o(), f(a(Ve), {
|
|
640
|
+
key: 1,
|
|
641
|
+
class: "wx-catalog-products__notice",
|
|
642
|
+
type: "warning"
|
|
643
|
+
}, {
|
|
644
|
+
default: u(() => [
|
|
645
|
+
g(i(a(t)("panel.fell-back")), 1)
|
|
646
|
+
]),
|
|
647
|
+
_: 1
|
|
648
|
+
})) : $("", !0),
|
|
649
|
+
Y.value ? (o(), f(a(Ve), {
|
|
650
|
+
key: 2,
|
|
651
|
+
class: "wx-catalog-products__notice",
|
|
652
|
+
type: "warning"
|
|
653
|
+
}, {
|
|
654
|
+
default: u(() => [
|
|
655
|
+
g(i(a(t)("panel.outgrown", { live: Y.value.live, limit: Y.value.limit })), 1)
|
|
656
|
+
]),
|
|
657
|
+
_: 1
|
|
658
|
+
})) : $("", !0),
|
|
659
|
+
X.value ? (o(), x("div", la, [
|
|
660
|
+
p(a(D), { size: "sm" }, {
|
|
661
|
+
default: u(() => [
|
|
662
|
+
g(i(a(t)("panel.search-corrected", { corrected: X.value })), 1)
|
|
663
|
+
]),
|
|
664
|
+
_: 1
|
|
665
|
+
}),
|
|
666
|
+
p(a(E), {
|
|
667
|
+
size: "sm",
|
|
668
|
+
variant: "text",
|
|
669
|
+
onClick: il
|
|
670
|
+
}, {
|
|
671
|
+
default: u(() => [
|
|
672
|
+
g(i(a(t)("panel.search-instead", { q: k.value })), 1)
|
|
673
|
+
]),
|
|
674
|
+
_: 1
|
|
675
|
+
})
|
|
676
|
+
])) : $("", !0),
|
|
677
|
+
p(a(Fl), {
|
|
678
|
+
selected: d.value,
|
|
679
|
+
"onUpdate:selected": n[1] || (n[1] = (l) => d.value = l),
|
|
680
|
+
search: k.value,
|
|
681
|
+
"onUpdate:search": n[2] || (n[2] = (l) => k.value = l),
|
|
682
|
+
page: O.value,
|
|
683
|
+
"onUpdate:page": n[3] || (n[3] = (l) => O.value = l),
|
|
684
|
+
data: r.value,
|
|
685
|
+
columns: He.value,
|
|
686
|
+
"row-key": "id",
|
|
687
|
+
searchable: "",
|
|
688
|
+
selectable: "",
|
|
689
|
+
clickable: "",
|
|
690
|
+
hover: "",
|
|
691
|
+
flush: "",
|
|
692
|
+
loading: b.value,
|
|
693
|
+
layout: "fixed",
|
|
694
|
+
"cards-below": Ee,
|
|
695
|
+
"filters-count": le.value.length,
|
|
696
|
+
"filters-label": a(V)("filters.title"),
|
|
697
|
+
"select-row-label": a(V)("filters.select-row"),
|
|
698
|
+
"select-all-label": a(V)("filters.select-all"),
|
|
699
|
+
"search-placeholder": a(t)("panel.search-products"),
|
|
700
|
+
"empty-text": nl.value,
|
|
701
|
+
"aria-label": he.value,
|
|
702
|
+
onRowClick: ie,
|
|
703
|
+
onStateChange: Ze
|
|
704
|
+
}, hl({
|
|
705
|
+
filters: u(() => [
|
|
706
|
+
p(a(de), {
|
|
707
|
+
label: a(t)("panel.sort")
|
|
708
|
+
}, {
|
|
709
|
+
default: u(() => [
|
|
710
|
+
p(a(pe), {
|
|
711
|
+
"model-value": Z.value,
|
|
712
|
+
options: Je.value.map((l) => ({ value: l.key, label: l.label })),
|
|
713
|
+
size: "sm",
|
|
714
|
+
"onUpdate:modelValue": el
|
|
715
|
+
}, null, 8, ["model-value", "options"])
|
|
716
|
+
]),
|
|
717
|
+
_: 1
|
|
718
|
+
}, 8, ["label"]),
|
|
719
|
+
(o(!0), x(L, null, G(ue.value, (l) => (o(), f(a(de), {
|
|
720
|
+
key: l.key,
|
|
721
|
+
label: l.label
|
|
722
|
+
}, {
|
|
723
|
+
default: u(() => [
|
|
724
|
+
l.kind === "tree" ? (o(), f(a(je), {
|
|
725
|
+
key: 0,
|
|
726
|
+
"model-value": ul(l.key),
|
|
727
|
+
nodes: a(R).nodes.value ?? [],
|
|
728
|
+
"node-key": "id",
|
|
729
|
+
"label-key": "name",
|
|
730
|
+
"children-key": "children",
|
|
731
|
+
multiple: "",
|
|
732
|
+
"check-strictly": "",
|
|
733
|
+
filterable: "",
|
|
734
|
+
clearable: "",
|
|
735
|
+
size: "sm",
|
|
736
|
+
placeholder: a(t)("panel.any"),
|
|
737
|
+
"onUpdate:modelValue": (m) => j(l.key, Array.isArray(m) ? m.map(String) : [])
|
|
738
|
+
}, null, 8, ["model-value", "nodes", "placeholder", "onUpdate:modelValue"])) : l.kind === "range" ? (o(), x("div", aa, [
|
|
739
|
+
p(a(Ue), {
|
|
740
|
+
"model-value": ae(l.key).min ?? null,
|
|
741
|
+
min: 0,
|
|
742
|
+
controls: !1,
|
|
743
|
+
size: "sm",
|
|
744
|
+
placeholder: $e(l.key, "min") || a(t)("panel.range-from"),
|
|
745
|
+
"aria-label": `${l.label}: ${a(t)("panel.range-from")}`,
|
|
746
|
+
"onUpdate:modelValue": (m) => j(l.key, { ...ae(l.key), min: m ?? null })
|
|
747
|
+
}, null, 8, ["model-value", "placeholder", "aria-label", "onUpdate:modelValue"]),
|
|
748
|
+
p(a(Ue), {
|
|
749
|
+
"model-value": ae(l.key).max ?? null,
|
|
750
|
+
min: 0,
|
|
751
|
+
controls: !1,
|
|
752
|
+
size: "sm",
|
|
753
|
+
placeholder: $e(l.key, "max") || a(t)("panel.range-to"),
|
|
754
|
+
"aria-label": `${l.label}: ${a(t)("panel.range-to")}`,
|
|
755
|
+
"onUpdate:modelValue": (m) => j(l.key, { ...ae(l.key), max: m ?? null })
|
|
756
|
+
}, null, 8, ["model-value", "placeholder", "aria-label", "onUpdate:modelValue"])
|
|
757
|
+
])) : l.kind === "toggle" ? (o(), f(a(Rl), {
|
|
758
|
+
key: 2,
|
|
759
|
+
"model-value": F.value[l.key] === !0,
|
|
760
|
+
size: "sm",
|
|
761
|
+
"onUpdate:modelValue": (m) => j(l.key, m ? !0 : null)
|
|
762
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])) : (o(), f(a(pe), {
|
|
763
|
+
key: 3,
|
|
764
|
+
"model-value": se(l.key),
|
|
765
|
+
options: al(l.key),
|
|
766
|
+
multiple: "",
|
|
767
|
+
filterable: "",
|
|
768
|
+
clearable: "",
|
|
769
|
+
size: "sm",
|
|
770
|
+
placeholder: a(t)("panel.any"),
|
|
771
|
+
"onUpdate:modelValue": (m) => j(l.key, Array.isArray(m) ? m.map(String) : [])
|
|
772
|
+
}, null, 8, ["model-value", "options", "placeholder", "onUpdate:modelValue"]))
|
|
773
|
+
]),
|
|
774
|
+
_: 2
|
|
775
|
+
}, 1032, ["label"]))), 128)),
|
|
776
|
+
le.value.length > 0 ? (o(), f(a(E), {
|
|
777
|
+
key: 0,
|
|
778
|
+
variant: "text",
|
|
779
|
+
size: "sm",
|
|
780
|
+
block: "",
|
|
781
|
+
onClick: ll
|
|
782
|
+
}, {
|
|
783
|
+
icon: u(() => [
|
|
784
|
+
p(a(me), { name: "close" })
|
|
785
|
+
]),
|
|
786
|
+
default: u(() => [
|
|
787
|
+
g(" " + i(a(V)("filters.reset")), 1)
|
|
788
|
+
]),
|
|
789
|
+
_: 1
|
|
790
|
+
})) : $("", !0)
|
|
791
|
+
]),
|
|
792
|
+
applied: u(() => [
|
|
793
|
+
p(a(Cl), { filters: le.value }, null, 8, ["filters"])
|
|
794
|
+
]),
|
|
795
|
+
"cell-image": u(({ row: l }) => [
|
|
796
|
+
A("span", {
|
|
797
|
+
class: _l(["wx-catalog-products__image", { "is-empty": !l.image }])
|
|
798
|
+
}, [
|
|
799
|
+
l.image ? (o(), x("img", {
|
|
800
|
+
key: 0,
|
|
801
|
+
src: l.image.thumb ?? l.image.url,
|
|
802
|
+
alt: "",
|
|
803
|
+
loading: "lazy"
|
|
804
|
+
}, null, 8, ta)) : (o(), f(a(me), {
|
|
805
|
+
key: 1,
|
|
806
|
+
name: "image",
|
|
807
|
+
size: "sm"
|
|
808
|
+
}))
|
|
809
|
+
], 2)
|
|
810
|
+
]),
|
|
811
|
+
"cell-name": u(({ row: l }) => [
|
|
812
|
+
A("div", na, [
|
|
813
|
+
A("span", ua, i(l.name), 1),
|
|
814
|
+
A("span", oa, i(l.sku ?? ""), 1)
|
|
815
|
+
])
|
|
816
|
+
]),
|
|
817
|
+
"cell-category": u(({ row: l }) => [
|
|
818
|
+
l.category ? (o(), f(a(D), {
|
|
819
|
+
key: 1,
|
|
820
|
+
size: "sm",
|
|
821
|
+
truncate: "",
|
|
822
|
+
tone: l.category.deleted ? "muted" : void 0
|
|
823
|
+
}, {
|
|
824
|
+
default: u(() => [
|
|
825
|
+
g(i(l.category.name), 1)
|
|
826
|
+
]),
|
|
827
|
+
_: 2
|
|
828
|
+
}, 1032, ["tone"])) : (o(), f(a(Q), {
|
|
829
|
+
key: 0,
|
|
830
|
+
type: "warning",
|
|
831
|
+
size: "sm",
|
|
832
|
+
round: ""
|
|
833
|
+
}, {
|
|
834
|
+
default: u(() => [
|
|
835
|
+
g(i(a(t)("product.no-category")), 1)
|
|
836
|
+
]),
|
|
837
|
+
_: 1
|
|
838
|
+
}))
|
|
839
|
+
]),
|
|
840
|
+
"cell-price": u(({ row: l }) => [
|
|
841
|
+
A("span", sa, [
|
|
842
|
+
A("span", null, [
|
|
843
|
+
g(i(ce(l.price)), 1),
|
|
844
|
+
l.price != null ? (o(), x("small", ia, i(Ce(l)), 1)) : $("", !0)
|
|
845
|
+
]),
|
|
846
|
+
l.old_price != null ? (o(), x("s", ra, i(ce(l.old_price)), 1)) : $("", !0)
|
|
847
|
+
])
|
|
848
|
+
]),
|
|
849
|
+
"cell-state": u(({ row: l }) => [
|
|
850
|
+
l.is_published && !l.visible ? (o(), f(a(Pl), {
|
|
851
|
+
key: 0,
|
|
852
|
+
content: a(t)("panel.invisible")
|
|
853
|
+
}, {
|
|
854
|
+
default: u(() => [
|
|
855
|
+
p(a(Q), {
|
|
856
|
+
type: re(l),
|
|
857
|
+
dot: "",
|
|
858
|
+
size: "sm"
|
|
859
|
+
}, {
|
|
860
|
+
default: u(() => [
|
|
861
|
+
g(i(a(t)(`states.${l.state}`)), 1)
|
|
862
|
+
]),
|
|
863
|
+
_: 2
|
|
864
|
+
}, 1032, ["type"])
|
|
865
|
+
]),
|
|
866
|
+
_: 2
|
|
867
|
+
}, 1032, ["content"])) : (o(), f(a(Q), {
|
|
868
|
+
key: 1,
|
|
869
|
+
type: re(l),
|
|
870
|
+
dot: "",
|
|
871
|
+
size: "sm"
|
|
872
|
+
}, {
|
|
873
|
+
default: u(() => [
|
|
874
|
+
g(i(a(t)(`states.${l.state}`)), 1)
|
|
875
|
+
]),
|
|
876
|
+
_: 2
|
|
877
|
+
}, 1032, ["type"]))
|
|
878
|
+
]),
|
|
879
|
+
"cell-updated_at": u(({ row: l }) => [
|
|
880
|
+
p(a(zl), {
|
|
881
|
+
value: l.updated_at,
|
|
882
|
+
compact: ""
|
|
883
|
+
}, null, 8, ["value"])
|
|
884
|
+
]),
|
|
885
|
+
"cell-card": u(({ row: l }) => [
|
|
886
|
+
p(a(El), {
|
|
887
|
+
variant: "plain",
|
|
888
|
+
title: l.name,
|
|
889
|
+
image: l.image?.thumb ?? l.image?.url ?? void 0,
|
|
890
|
+
"image-size": "56px",
|
|
891
|
+
"title-lines": 2,
|
|
892
|
+
subtitle: l.sku ?? void 0
|
|
893
|
+
}, {
|
|
894
|
+
meta: u(() => [
|
|
895
|
+
p(a(Q), {
|
|
896
|
+
type: re(l),
|
|
897
|
+
dot: "",
|
|
898
|
+
size: "sm"
|
|
899
|
+
}, {
|
|
900
|
+
default: u(() => [
|
|
901
|
+
g(i(a(t)(`states.${l.state}`)), 1)
|
|
902
|
+
]),
|
|
903
|
+
_: 2
|
|
904
|
+
}, 1032, ["type"]),
|
|
905
|
+
l.category ? $("", !0) : (o(), f(a(Q), {
|
|
906
|
+
key: 0,
|
|
907
|
+
type: "warning",
|
|
908
|
+
size: "sm",
|
|
909
|
+
round: ""
|
|
910
|
+
}, {
|
|
911
|
+
default: u(() => [
|
|
912
|
+
g(i(a(t)("product.no-category")), 1)
|
|
913
|
+
]),
|
|
914
|
+
_: 1
|
|
915
|
+
})),
|
|
916
|
+
_e.value && l.price != null ? (o(), f(a(D), {
|
|
917
|
+
key: 1,
|
|
918
|
+
size: "sm"
|
|
919
|
+
}, {
|
|
920
|
+
default: u(() => [
|
|
921
|
+
g(i(ce(l.price)) + i(Ce(l)), 1)
|
|
922
|
+
]),
|
|
923
|
+
_: 2
|
|
924
|
+
}, 1024)) : $("", !0),
|
|
925
|
+
(o(!0), x(L, null, G(ee.value, (m) => (o(), x(L, {
|
|
926
|
+
key: m.key
|
|
927
|
+
}, [
|
|
928
|
+
vl(l.columns?.[m.key]) ? (o(), f(Te, {
|
|
929
|
+
key: 0,
|
|
930
|
+
value: l.columns?.[m.key]
|
|
931
|
+
}, null, 8, ["value"])) : $("", !0)
|
|
932
|
+
], 64))), 128))
|
|
933
|
+
]),
|
|
934
|
+
_: 2
|
|
935
|
+
}, 1032, ["title", "image", "subtitle"])
|
|
936
|
+
]),
|
|
937
|
+
"cell-actions": u(({ row: l }) => [
|
|
938
|
+
p(a(ql), {
|
|
939
|
+
actions: pl(l),
|
|
940
|
+
label: l.name
|
|
941
|
+
}, null, 8, ["actions", "label"])
|
|
942
|
+
]),
|
|
943
|
+
_: 2
|
|
944
|
+
}, [
|
|
945
|
+
G(ee.value, (l) => ({
|
|
946
|
+
name: `cell-x.${l.key}`,
|
|
947
|
+
fn: u(({ row: m }) => [
|
|
948
|
+
p(Te, {
|
|
949
|
+
value: m.columns?.[l.key]
|
|
950
|
+
}, null, 8, ["value"])
|
|
951
|
+
])
|
|
952
|
+
}))
|
|
953
|
+
]), 1032, ["selected", "search", "page", "data", "columns", "loading", "filters-count", "filters-label", "select-row-label", "select-all-label", "search-placeholder", "empty-text", "aria-label"])
|
|
954
|
+
]),
|
|
955
|
+
_: 1
|
|
956
|
+
}, 8, ["view", "title", "views", "actions"])
|
|
957
|
+
], 512));
|
|
958
|
+
}
|
|
959
|
+
}), ga = /* @__PURE__ */ ke(ca, [["__scopeId", "data-v-b558777e"]]);
|
|
960
|
+
export {
|
|
961
|
+
ga as default
|
|
962
|
+
};
|
|
963
|
+
//# sourceMappingURL=ProductsPage-BBmw9W4m.js.map
|