@webx-ui/module-tariffs 0.1.16 → 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/dist/TariffsPage-Trs7f5Rf.js +330 -0
- package/dist/TariffsPage-Trs7f5Rf.js.map +1 -0
- package/dist/index-Cg_PgXDL.js +384 -0
- package/dist/index-Cg_PgXDL.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +10 -691
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,694 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { onBeforeRouteUpdate as Be, onBeforeRouteLeave as Ce, useRoute as Le, useRouter as Ae } from "vue-router";
|
|
4
|
-
import { useLocales as Pe, localizedValue as Re, WxSkeleton as ue, WxBadge as X, WxActionBar as Ve, WxButton as De, toast as x, confirm as Y, WxCard as Ie, WxListDetail as Ue, WxEmpty as ie, WxInput as ze, WxIcon as j, WxSelect as Oe, WxSortableList as Me, WxAlert as Ee } from "@webx-ui/core";
|
|
5
|
-
const Z = "tariffs";
|
|
6
|
-
function ce(s) {
|
|
7
|
-
const l = `${s.apiPath}/${Z}`, n = (t) => t.data;
|
|
8
|
-
return {
|
|
9
|
-
list: (t = {}) => {
|
|
10
|
-
const u = new URLSearchParams();
|
|
11
|
-
return t.search && u.set("search", t.search), t.category != null && u.set("category", String(t.category)), t.trashed && u.set("trashed", "1"), s.http.get(u.size > 0 ? `${l}?${u}` : l);
|
|
12
|
-
},
|
|
13
|
-
get: (t) => s.http.get(`${l}/${t}`).then(n),
|
|
14
|
-
create: (t) => s.http.post(l, { values: t }).then(n),
|
|
15
|
-
save: (t, u) => s.http.put(`${l}/${t}`, { values: u }).then(n),
|
|
16
|
-
remove: (t) => s.http.delete(`${l}/${t}`).then(() => {
|
|
17
|
-
}),
|
|
18
|
-
// The resource of the list line, and not the form's pair: a restored tariff stays closed.
|
|
19
|
-
restore: (t) => s.http.post(`${l}/${t}/restore`, {}).then(n),
|
|
20
|
-
reorder: (t, u = null) => me(s, Z, t, u)
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const Fe = {
|
|
24
|
-
module: {
|
|
25
|
-
group: "Tariffs",
|
|
26
|
-
tariffs: "Tariffs",
|
|
27
|
-
groups: "Groups"
|
|
28
|
-
},
|
|
29
|
-
tariff: {
|
|
30
|
-
new: "New tariff",
|
|
31
|
-
untitled: "Untitled",
|
|
32
|
-
search: "Search the tariffs",
|
|
33
|
-
empty: "No tariffs yet.",
|
|
34
|
-
"empty-help": "A tariff reaches the site in a tariffs block, on any page.",
|
|
35
|
-
"empty-search": "Nothing matches that.",
|
|
36
|
-
"empty-bin": "The bin is empty.",
|
|
37
|
-
all: "All",
|
|
38
|
-
trashed: "Bin",
|
|
39
|
-
"filter-category": "Group",
|
|
40
|
-
"any-category": "Any group",
|
|
41
|
-
"not-published": "Not published",
|
|
42
|
-
featured: "Recommended",
|
|
43
|
-
"no-price": "No price",
|
|
44
|
-
order: "Drag to change the order of the cards on the site.",
|
|
45
|
-
choose: "Choose a tariff",
|
|
46
|
-
"choose-help": "Or add a new one: the first line of the list.",
|
|
47
|
-
save: "Save",
|
|
48
|
-
saved: "The tariff is saved.",
|
|
49
|
-
"save-failed": "The tariff was not saved.",
|
|
50
|
-
cancel: "Cancel",
|
|
51
|
-
delete: "Delete",
|
|
52
|
-
"delete-title": "Delete the tariff “:name”?",
|
|
53
|
-
"delete-text": "It goes to the bin and leaves every block on the site. Restored, it comes back to its places.",
|
|
54
|
-
deleted: "The tariff is in the bin.",
|
|
55
|
-
restore: "Restore",
|
|
56
|
-
restored: "The tariff is back.",
|
|
57
|
-
"reorder-failed": "The new order was not saved.",
|
|
58
|
-
"order-group": "Drag to change the order inside this group. The rest of the list keeps its own.",
|
|
59
|
-
"leave-title": "Leave without saving?",
|
|
60
|
-
"leave-text": "What you changed in this tariff is not on the server.",
|
|
61
|
-
leave: "Leave",
|
|
62
|
-
back: "Back to the list"
|
|
63
|
-
},
|
|
64
|
-
screen: {
|
|
65
|
-
tariff: "Tariff",
|
|
66
|
-
name: "Name",
|
|
67
|
-
"name-help": "Required in the default language. Not written in another one, it is shown as written in the default one.",
|
|
68
|
-
badge: "Badge",
|
|
69
|
-
"badge-help": "A short line over the name: “30 HOURS / 25$”.",
|
|
70
|
-
featured: "Recommended",
|
|
71
|
-
"featured-help": "The card stands out among the others.",
|
|
72
|
-
pricing: "Price",
|
|
73
|
-
price: "Price",
|
|
74
|
-
"price-help": "A number, up to two digits after the point. Empty — the words below are shown instead.",
|
|
75
|
-
currency: "Currency",
|
|
76
|
-
"currency-help": "The list comes from the site’s settings.",
|
|
77
|
-
"currency-placeholder": "Choose a currency",
|
|
78
|
-
period: "Period",
|
|
79
|
-
"period-help": "Printed after the price: “/mo”, “a year”.",
|
|
80
|
-
"price-text": "Price in words",
|
|
81
|
-
"price-text-help": "Printed when there is no price: “On request”, “Custom”.",
|
|
82
|
-
features: "What is included",
|
|
83
|
-
"features-help": "A line not written in a language is left out of the list in that language.",
|
|
84
|
-
"features-add": "Add a line",
|
|
85
|
-
"features-empty": "No lines yet.",
|
|
86
|
-
feature: "Line",
|
|
87
|
-
about: "Description",
|
|
88
|
-
description: "Description",
|
|
89
|
-
"description-help": "Shown only in the languages it is written in.",
|
|
90
|
-
button: "Button",
|
|
91
|
-
"button-label": "Label",
|
|
92
|
-
"button-label-help": "Without a label in a language, the card has no button in it.",
|
|
93
|
-
"button-link": "Link",
|
|
94
|
-
"button-link-help": "A page of the site or an address. A draft or a page in the bin hides the button.",
|
|
95
|
-
"button-variant": "Look",
|
|
96
|
-
"button-variant-placeholder": "Choose a look",
|
|
97
|
-
settings: "Settings",
|
|
98
|
-
categories: "Groups",
|
|
99
|
-
"categories-help": "What a block picks the tariff by, and the tabs of a page of prices.",
|
|
100
|
-
"categories-add": "Add to a group",
|
|
101
|
-
"categories-empty": "In no group yet.",
|
|
102
|
-
services: "Services",
|
|
103
|
-
"services-help": "The services this tariff is for: a tariffs block on a service’s page can show only its own.",
|
|
104
|
-
published: "Published",
|
|
105
|
-
"published-help": "On the site in every block that shows its groups, from the moment it is saved."
|
|
106
|
-
},
|
|
107
|
-
category: {
|
|
108
|
-
"field-title": "Title",
|
|
109
|
-
visible: "Shown on the site",
|
|
110
|
-
"visible-help": "Hidden, it drops out of every page of prices; its tariffs stay in the blocks that show them.",
|
|
111
|
-
new: "New group",
|
|
112
|
-
empty: "No groups yet.",
|
|
113
|
-
"empty-help": "A group gathers tariffs — for individuals, for business: a block shows the ones you pick, and a page of prices can show each group as a tab.",
|
|
114
|
-
order: "Drag to change the order of the groups on the site.",
|
|
115
|
-
hidden: "Hidden from the site",
|
|
116
|
-
tariffs: "Tariffs: :count",
|
|
117
|
-
"show-tariffs": "Show its tariffs",
|
|
118
|
-
"delete-blocked": "This group still holds tariffs. Move them first.",
|
|
119
|
-
"delete-text": "It goes to the bin and leaves every page of prices. Its tariffs stay.",
|
|
120
|
-
deleted: "The group is in the bin.",
|
|
121
|
-
saved: "The group is saved."
|
|
122
|
-
}
|
|
123
|
-
}, se = /* @__PURE__ */ new WeakSet();
|
|
124
|
-
function de() {
|
|
125
|
-
try {
|
|
126
|
-
const { i18n: s } = ee();
|
|
127
|
-
se.has(s) || (s.defaults("webx-tariffs", Fe), se.add(s));
|
|
128
|
-
} catch {
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function Ge(s, l) {
|
|
132
|
-
if (s.price === null || s.price === void 0) return (s.price_text ?? "").trim();
|
|
133
|
-
const n = Number.isInteger(s.price), t = new Intl.NumberFormat(l, {
|
|
134
|
-
minimumFractionDigits: n ? 0 : 2,
|
|
135
|
-
maximumFractionDigits: n ? 0 : 2
|
|
136
|
-
}).format(s.price), u = s.symbol ?? s.currency ?? "", r = (s.period ?? "").trim();
|
|
137
|
-
return [`${u}${t}`, r].filter((q) => q !== "").join(" ");
|
|
138
|
-
}
|
|
139
|
-
const He = /* @__PURE__ */ le({
|
|
140
|
-
name: "WxTariffPane",
|
|
141
|
-
__name: "TariffPane",
|
|
142
|
-
props: {
|
|
143
|
-
id: {},
|
|
144
|
-
category: { default: null },
|
|
145
|
-
inline: { type: Boolean, default: !0 }
|
|
146
|
-
},
|
|
147
|
-
emits: ["back", "saved", "created", "removed"],
|
|
148
|
-
setup(s, { emit: l }) {
|
|
149
|
-
const n = s, t = l, u = ee(), r = ce(u), q = Pe();
|
|
150
|
-
de();
|
|
151
|
-
const f = oe("webx-tariffs"), P = ne(), _ = S(null), m = S({}), L = S(""), N = S(n.id !== null), c = S(!1), W = S({}), w = v(() => u.can("tariffs.manage")), R = v(() => JSON.stringify(m.value)), y = v(() => L.value !== "" && R.value !== L.value), M = v(() => c.value ? "saving" : y.value || n.id === null ? "unsaved" : "saved"), K = v(() => {
|
|
152
|
-
const i = m.value.name, d = n.id === null ? f("tariff.new") : _.value?.name ?? "";
|
|
153
|
-
return Re(i, q.active.value, d) || f("tariff.untitled");
|
|
154
|
-
});
|
|
155
|
-
function $(i) {
|
|
156
|
-
_.value = i.tariff, m.value = i.values, L.value = JSON.stringify(i.values);
|
|
157
|
-
}
|
|
158
|
-
if (n.id === null) {
|
|
159
|
-
const i = {
|
|
160
|
-
name: {},
|
|
161
|
-
badge: {},
|
|
162
|
-
price: null,
|
|
163
|
-
period: {},
|
|
164
|
-
price_text: {},
|
|
165
|
-
features: [],
|
|
166
|
-
description: {},
|
|
167
|
-
button_label: {},
|
|
168
|
-
button_link: null,
|
|
169
|
-
featured: !1,
|
|
170
|
-
published: !1,
|
|
171
|
-
categories: n.category === null ? [] : [n.category]
|
|
172
|
-
};
|
|
173
|
-
m.value = i, L.value = JSON.stringify(i);
|
|
174
|
-
}
|
|
175
|
-
async function E() {
|
|
176
|
-
if (n.id !== null) {
|
|
177
|
-
N.value = !0;
|
|
178
|
-
try {
|
|
179
|
-
$(await r.get(n.id));
|
|
180
|
-
} catch (i) {
|
|
181
|
-
x.danger(P(i)), t("back");
|
|
182
|
-
} finally {
|
|
183
|
-
N.value = !1;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
async function F() {
|
|
188
|
-
if (!(c.value || !w.value)) {
|
|
189
|
-
c.value = !0, W.value = {};
|
|
190
|
-
try {
|
|
191
|
-
const i = n.id === null, d = i ? await r.create(m.value) : await r.save(n.id, m.value);
|
|
192
|
-
$(d), x.success(f("tariff.saved")), t(i ? "created" : "saved", d.tariff);
|
|
193
|
-
} catch (i) {
|
|
194
|
-
const d = i.body;
|
|
195
|
-
d?.errors ? (W.value = d.errors, x.danger(f("tariff.save-failed"))) : x.danger(P(i));
|
|
196
|
-
} finally {
|
|
197
|
-
c.value = !1;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
async function J() {
|
|
202
|
-
const i = _.value;
|
|
203
|
-
if (!(!i || !await Y({
|
|
204
|
-
title: f("tariff.delete-title", { name: i.name }),
|
|
205
|
-
message: f("tariff.delete-text"),
|
|
206
|
-
confirmText: f("tariff.delete"),
|
|
207
|
-
cancelText: f("tariff.cancel"),
|
|
208
|
-
tone: "danger"
|
|
209
|
-
})))
|
|
210
|
-
try {
|
|
211
|
-
await r.remove(i.id), x.success(f("tariff.deleted")), L.value = R.value, t("removed", i.id);
|
|
212
|
-
} catch (D) {
|
|
213
|
-
x.danger(P(D));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function T(i) {
|
|
217
|
-
y.value && i.preventDefault();
|
|
218
|
-
}
|
|
219
|
-
function V(i) {
|
|
220
|
-
(i.ctrlKey || i.metaKey) && i.key.toLowerCase() === "s" && (i.preventDefault(), (y.value || n.id === null) && F());
|
|
221
|
-
}
|
|
222
|
-
ye(V), We(() => {
|
|
223
|
-
E(), window.addEventListener("beforeunload", T);
|
|
224
|
-
}), fe(() => {
|
|
225
|
-
window.removeEventListener("beforeunload", T);
|
|
226
|
-
});
|
|
227
|
-
async function G() {
|
|
228
|
-
return !y.value || !w.value ? !0 : await Y({
|
|
229
|
-
title: f("tariff.leave-title"),
|
|
230
|
-
message: f("tariff.leave-text"),
|
|
231
|
-
confirmText: f("tariff.leave"),
|
|
232
|
-
cancelText: f("tariff.cancel"),
|
|
233
|
-
tone: "danger"
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
Be(
|
|
237
|
-
async (i, d) => i.query.tariff === d.query.tariff ? !0 : await G()
|
|
238
|
-
), Ce(G);
|
|
239
|
-
const U = v(
|
|
240
|
-
() => w.value && _.value !== null ? [
|
|
241
|
-
{
|
|
242
|
-
key: "delete",
|
|
243
|
-
label: f("tariff.delete"),
|
|
244
|
-
icon: "trash",
|
|
245
|
-
danger: !0,
|
|
246
|
-
menu: !0,
|
|
247
|
-
run: () => {
|
|
248
|
-
J();
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
] : []
|
|
252
|
-
);
|
|
253
|
-
return (i, d) => (p(), A("div", {
|
|
254
|
-
class: "wx-tariff",
|
|
255
|
-
onKeydown: V
|
|
256
|
-
}, [
|
|
257
|
-
N.value ? (p(), k(a(ue), {
|
|
258
|
-
key: 0,
|
|
259
|
-
class: "wx-tariff__ghost",
|
|
260
|
-
title: "",
|
|
261
|
-
rows: 6
|
|
262
|
-
})) : (p(), A(Q, { key: 1 }, [
|
|
263
|
-
b(a(be), {
|
|
264
|
-
level: 3,
|
|
265
|
-
back: !n.inline,
|
|
266
|
-
"back-label": a(f)("tariff.back"),
|
|
267
|
-
title: K.value,
|
|
268
|
-
actions: U.value,
|
|
269
|
-
"collapse-below": 480,
|
|
270
|
-
onBack: d[0] || (d[0] = (D) => t("back"))
|
|
271
|
-
}, qe({ _: 2 }, [
|
|
272
|
-
_.value && !_.value.published ? {
|
|
273
|
-
name: "title-after",
|
|
274
|
-
fn: g(() => [
|
|
275
|
-
b(a(X), { dot: "" }, {
|
|
276
|
-
default: g(() => [
|
|
277
|
-
O(C(a(f)("tariff.not-published")), 1)
|
|
278
|
-
]),
|
|
279
|
-
_: 1
|
|
280
|
-
})
|
|
281
|
-
]),
|
|
282
|
-
key: "0"
|
|
283
|
-
} : void 0
|
|
284
|
-
]), 1032, ["back", "back-label", "title", "actions"]),
|
|
285
|
-
b(a(we), {
|
|
286
|
-
modelValue: m.value,
|
|
287
|
-
"onUpdate:modelValue": d[1] || (d[1] = (D) => m.value = D),
|
|
288
|
-
name: "tariffs.form",
|
|
289
|
-
errors: W.value,
|
|
290
|
-
disabled: !w.value || c.value
|
|
291
|
-
}, null, 8, ["modelValue", "errors", "disabled"]),
|
|
292
|
-
w.value ? (p(), k(a(Ve), { key: 0 }, {
|
|
293
|
-
state: g(() => [
|
|
294
|
-
b(a(xe), { state: M.value }, null, 8, ["state"])
|
|
295
|
-
]),
|
|
296
|
-
default: g(() => [
|
|
297
|
-
b(a(De), {
|
|
298
|
-
type: "primary",
|
|
299
|
-
loading: c.value,
|
|
300
|
-
disabled: !y.value && n.id !== null,
|
|
301
|
-
onClick: F
|
|
302
|
-
}, {
|
|
303
|
-
default: g(() => [
|
|
304
|
-
O(C(a(f)("tariff.save")), 1)
|
|
305
|
-
]),
|
|
306
|
-
_: 1
|
|
307
|
-
}, 8, ["loading", "disabled"])
|
|
308
|
-
]),
|
|
309
|
-
_: 1
|
|
310
|
-
})) : B("", !0)
|
|
311
|
-
], 64))
|
|
312
|
-
], 32));
|
|
313
|
-
}
|
|
314
|
-
}), pe = (s, l) => {
|
|
315
|
-
const n = s.__vccOpts || s;
|
|
316
|
-
for (const [t, u] of l)
|
|
317
|
-
n[t] = u;
|
|
318
|
-
return n;
|
|
319
|
-
}, Ke = /* @__PURE__ */ pe(He, [["__scopeId", "data-v-196f1a0d"]]), Je = { class: "wx-tariffs__bar" }, je = { class: "wx-tariff-row__body" }, Qe = { class: "wx-tariff-row__who" }, Xe = { class: "wx-tariff-row__name" }, Ye = ["aria-label"], Ze = { class: "wx-tariff-row__facts" }, et = {
|
|
320
|
-
key: 1,
|
|
321
|
-
class: "wx-tariff-row__badge"
|
|
322
|
-
}, tt = /* @__PURE__ */ le({
|
|
323
|
-
__name: "TariffsPage",
|
|
324
|
-
props: {
|
|
325
|
-
base: { default: "/tariffs" }
|
|
326
|
-
},
|
|
327
|
-
setup(s) {
|
|
328
|
-
const l = ee(), n = ce(l), t = Le(), u = Ae();
|
|
329
|
-
de();
|
|
330
|
-
const r = oe("webx-tariffs"), q = ne(), f = S([]), P = S([]), _ = S(!0), m = v(() => l.can("tariffs.manage")), L = v(
|
|
331
|
-
() => l.state.manifest?.modules.find((e) => e.id === "tariffs")?.title ?? r("module.tariffs")
|
|
332
|
-
), N = v({
|
|
333
|
-
get: () => t.query.view === "trashed" ? "trashed" : "",
|
|
334
|
-
set: (e) => {
|
|
335
|
-
const h = {
|
|
336
|
-
...t.query,
|
|
337
|
-
view: e === "" ? void 0 : String(e)
|
|
338
|
-
};
|
|
339
|
-
delete h.tariff, u.replace({ query: h });
|
|
340
|
-
}
|
|
341
|
-
}), c = v(() => N.value === "trashed"), W = v(() => {
|
|
342
|
-
const e = t.query.category;
|
|
343
|
-
return typeof e == "string" && e !== "" && Number(e) || null;
|
|
344
|
-
}), w = v(() => typeof t.query.q == "string" ? t.query.q : ""), R = S(w.value), y = v(() => {
|
|
345
|
-
const e = t.query.tariff;
|
|
346
|
-
return e === "new" ? m.value ? "new" : null : typeof e == "string" && e !== "" && Number(e) || null;
|
|
347
|
-
}), M = v({
|
|
348
|
-
get: () => y.value !== null,
|
|
349
|
-
set: (e) => {
|
|
350
|
-
e || i();
|
|
351
|
-
}
|
|
352
|
-
}), K = v(() => [
|
|
353
|
-
{ value: "", label: r("tariff.all") },
|
|
354
|
-
{ value: "trashed", label: r("tariff.trashed"), icon: "trash" }
|
|
355
|
-
]), $ = _e(Z, () => ({
|
|
356
|
-
q: w.value,
|
|
357
|
-
category: W.value,
|
|
358
|
-
filtered: c.value
|
|
359
|
-
})), E = v(() => m.value && $.sortable.value), F = v(() => $.mode.value === "category" ? r("tariff.order-group") : $.mode.value === "all" ? r("tariff.order") : $.hint.value), J = v(() => w.value !== "" ? r("tariff.empty-search") : c.value ? r("tariff.empty-bin") : r("tariff.empty"));
|
|
360
|
-
async function T() {
|
|
361
|
-
_.value = !0;
|
|
362
|
-
try {
|
|
363
|
-
const e = await n.list({
|
|
364
|
-
search: w.value,
|
|
365
|
-
category: c.value ? null : W.value,
|
|
366
|
-
trashed: c.value
|
|
367
|
-
});
|
|
368
|
-
f.value = e.data, P.value = e.filters.categories;
|
|
369
|
-
} catch (e) {
|
|
370
|
-
x.danger(q(e));
|
|
371
|
-
} finally {
|
|
372
|
-
_.value = !1;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
re(
|
|
376
|
-
() => [N.value, W.value, w.value],
|
|
377
|
-
() => {
|
|
378
|
-
T();
|
|
379
|
-
}
|
|
380
|
-
), T();
|
|
381
|
-
let V;
|
|
382
|
-
re(R, (e) => {
|
|
383
|
-
clearTimeout(V), V = setTimeout(() => {
|
|
384
|
-
u.replace({ query: { ...t.query, q: e.trim() === "" ? void 0 : e } });
|
|
385
|
-
}, 300);
|
|
386
|
-
}), fe(() => clearTimeout(V));
|
|
387
|
-
function G(e) {
|
|
388
|
-
u.replace({
|
|
389
|
-
query: { ...t.query, category: typeof e == "number" ? String(e) : void 0 }
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
function U(e) {
|
|
393
|
-
u.replace({ query: { ...t.query, tariff: String(e) } });
|
|
394
|
-
}
|
|
395
|
-
function i() {
|
|
396
|
-
const e = { ...t.query };
|
|
397
|
-
delete e.tariff, u.replace({ query: e });
|
|
398
|
-
}
|
|
399
|
-
function d(e) {
|
|
400
|
-
U(e.id), T();
|
|
401
|
-
}
|
|
402
|
-
async function D() {
|
|
403
|
-
try {
|
|
404
|
-
await $.move(f.value.map((e) => e.id));
|
|
405
|
-
} catch (e) {
|
|
406
|
-
x.danger(q(e, r("tariff.reorder-failed"))), await T();
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
function ve(e) {
|
|
410
|
-
return m.value ? c.value ? [
|
|
411
|
-
{
|
|
412
|
-
key: "restore",
|
|
413
|
-
icon: "refresh",
|
|
414
|
-
label: r("tariff.restore"),
|
|
415
|
-
run: () => {
|
|
416
|
-
ge(e);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
] : [
|
|
420
|
-
{
|
|
421
|
-
key: "delete",
|
|
422
|
-
icon: "trash",
|
|
423
|
-
label: r("tariff.delete"),
|
|
424
|
-
danger: !0,
|
|
425
|
-
run: () => {
|
|
426
|
-
he(e);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
] : [];
|
|
430
|
-
}
|
|
431
|
-
async function he(e) {
|
|
432
|
-
if (await Y({
|
|
433
|
-
title: r("tariff.delete-title", { name: e.name }),
|
|
434
|
-
message: r("tariff.delete-text"),
|
|
435
|
-
confirmText: r("tariff.delete"),
|
|
436
|
-
cancelText: r("tariff.cancel"),
|
|
437
|
-
tone: "danger"
|
|
438
|
-
}))
|
|
439
|
-
try {
|
|
440
|
-
await n.remove(e.id), x.success(r("tariff.deleted")), te(e.id);
|
|
441
|
-
} catch (o) {
|
|
442
|
-
x.danger(q(o));
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
function te(e) {
|
|
446
|
-
y.value === e && i(), T();
|
|
447
|
-
}
|
|
448
|
-
async function ge(e) {
|
|
449
|
-
try {
|
|
450
|
-
await n.restore(e.id), x.success(r("tariff.restored"));
|
|
451
|
-
} catch (h) {
|
|
452
|
-
x.danger(q(h));
|
|
453
|
-
} finally {
|
|
454
|
-
await T();
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function ae(e) {
|
|
458
|
-
return Ge(e, l.i18n.state.locale);
|
|
459
|
-
}
|
|
460
|
-
return (e, h) => (p(), k(a(ke), {
|
|
461
|
-
view: N.value,
|
|
462
|
-
"onUpdate:view": h[4] || (h[4] = (o) => N.value = o),
|
|
463
|
-
title: L.value,
|
|
464
|
-
views: K.value,
|
|
465
|
-
card: !1
|
|
466
|
-
}, {
|
|
467
|
-
default: g(() => [
|
|
468
|
-
b(a(Ie), {
|
|
469
|
-
class: "wx-tariffs",
|
|
470
|
-
padding: "none"
|
|
471
|
-
}, {
|
|
472
|
-
default: g(() => [
|
|
473
|
-
b(a(Ue), {
|
|
474
|
-
open: M.value,
|
|
475
|
-
"onUpdate:open": h[3] || (h[3] = (o) => M.value = o),
|
|
476
|
-
class: "wx-tariffs__panes",
|
|
477
|
-
"list-width": 360,
|
|
478
|
-
"detail-min": 460,
|
|
479
|
-
"detail-label": a(r)("module.tariffs")
|
|
480
|
-
}, {
|
|
481
|
-
list: g(() => [
|
|
482
|
-
I("div", Je, [
|
|
483
|
-
b(a(ze), {
|
|
484
|
-
modelValue: R.value,
|
|
485
|
-
"onUpdate:modelValue": h[0] || (h[0] = (o) => R.value = o),
|
|
486
|
-
class: "wx-tariffs__search",
|
|
487
|
-
size: "sm",
|
|
488
|
-
clearable: "",
|
|
489
|
-
placeholder: a(r)("tariff.search"),
|
|
490
|
-
"aria-label": a(r)("tariff.search")
|
|
491
|
-
}, {
|
|
492
|
-
prefix: g(() => [
|
|
493
|
-
b(a(j), {
|
|
494
|
-
name: "search",
|
|
495
|
-
size: "sm"
|
|
496
|
-
})
|
|
497
|
-
]),
|
|
498
|
-
_: 1
|
|
499
|
-
}, 8, ["modelValue", "placeholder", "aria-label"]),
|
|
500
|
-
c.value ? B("", !0) : (p(), k(a(Oe), {
|
|
501
|
-
key: 0,
|
|
502
|
-
"model-value": W.value,
|
|
503
|
-
options: P.value.map((o) => ({ value: o.id, label: o.title })),
|
|
504
|
-
placeholder: a(r)("tariff.any-category"),
|
|
505
|
-
"aria-label": a(r)("tariff.filter-category"),
|
|
506
|
-
clearable: "",
|
|
507
|
-
size: "sm",
|
|
508
|
-
"onUpdate:modelValue": G
|
|
509
|
-
}, null, 8, ["model-value", "options", "placeholder", "aria-label"]))
|
|
510
|
-
]),
|
|
511
|
-
m.value && !c.value ? (p(), A("button", {
|
|
512
|
-
key: 0,
|
|
513
|
-
type: "button",
|
|
514
|
-
class: H(["wx-tariffs__new", { "is-current": y.value === "new" }]),
|
|
515
|
-
onClick: h[1] || (h[1] = (o) => U("new"))
|
|
516
|
-
}, [
|
|
517
|
-
b(a(j), {
|
|
518
|
-
name: "plus",
|
|
519
|
-
size: "sm"
|
|
520
|
-
}),
|
|
521
|
-
O(" " + C(a(r)("tariff.new")), 1)
|
|
522
|
-
], 2)) : B("", !0),
|
|
523
|
-
_.value && f.value.length === 0 ? (p(), k(a(ue), {
|
|
524
|
-
key: 1,
|
|
525
|
-
class: "wx-tariffs__loading",
|
|
526
|
-
rows: 5
|
|
527
|
-
})) : f.value.length === 0 ? (p(), k(a(ie), {
|
|
528
|
-
key: 2,
|
|
529
|
-
title: J.value,
|
|
530
|
-
description: !c.value && w.value === "" ? a(r)("tariff.empty-help") : void 0
|
|
531
|
-
}, null, 8, ["title", "description"])) : (p(), A(Q, { key: 3 }, [
|
|
532
|
-
b(a(Me), {
|
|
533
|
-
modelValue: f.value,
|
|
534
|
-
"onUpdate:modelValue": h[2] || (h[2] = (o) => f.value = o),
|
|
535
|
-
class: H(["wx-tariffs__list", { "is-loading": _.value }]),
|
|
536
|
-
plain: "",
|
|
537
|
-
"item-key": "id",
|
|
538
|
-
handle: E.value ? "grip" : "row",
|
|
539
|
-
"item-label": (o) => o.name,
|
|
540
|
-
disabled: !E.value,
|
|
541
|
-
onMove: D
|
|
542
|
-
}, {
|
|
543
|
-
default: g(({ item: o }) => [
|
|
544
|
-
(p(), k(Ne(c.value ? "div" : "button"), {
|
|
545
|
-
type: c.value ? void 0 : "button",
|
|
546
|
-
class: H(["wx-tariff-row", { "is-current": y.value === o.id }]),
|
|
547
|
-
onClick: (z) => c.value ? void 0 : U(o.id)
|
|
548
|
-
}, {
|
|
549
|
-
default: g(() => [
|
|
550
|
-
I("span", je, [
|
|
551
|
-
I("span", Qe, [
|
|
552
|
-
I("span", Xe, C(o.name), 1),
|
|
553
|
-
o.featured ? (p(), A("span", {
|
|
554
|
-
key: 0,
|
|
555
|
-
class: "wx-tariff-row__star",
|
|
556
|
-
role: "img",
|
|
557
|
-
"aria-label": a(r)("tariff.featured")
|
|
558
|
-
}, [
|
|
559
|
-
b(a(j), {
|
|
560
|
-
name: "star",
|
|
561
|
-
size: "sm"
|
|
562
|
-
})
|
|
563
|
-
], 8, Ye)) : B("", !0)
|
|
564
|
-
]),
|
|
565
|
-
I("span", {
|
|
566
|
-
class: H(["wx-tariff-row__price", { "is-missing": ae(o) === "" }])
|
|
567
|
-
}, C(ae(o) || a(r)("tariff.no-price")), 3),
|
|
568
|
-
I("span", Ze, [
|
|
569
|
-
o.published ? B("", !0) : (p(), k(a(X), {
|
|
570
|
-
key: 0,
|
|
571
|
-
dot: "",
|
|
572
|
-
size: "sm"
|
|
573
|
-
}, {
|
|
574
|
-
default: g(() => [
|
|
575
|
-
O(C(a(r)("tariff.not-published")), 1)
|
|
576
|
-
]),
|
|
577
|
-
_: 1
|
|
578
|
-
})),
|
|
579
|
-
o.badge ? (p(), A("span", et, C(o.badge), 1)) : B("", !0),
|
|
580
|
-
(p(!0), A(Q, null, $e(o.categories, (z) => (p(), k(a(X), {
|
|
581
|
-
key: z.id,
|
|
582
|
-
size: "sm",
|
|
583
|
-
round: ""
|
|
584
|
-
}, {
|
|
585
|
-
default: g(() => [
|
|
586
|
-
O(C(z.title), 1)
|
|
587
|
-
]),
|
|
588
|
-
_: 2
|
|
589
|
-
}, 1024))), 128))
|
|
590
|
-
])
|
|
591
|
-
])
|
|
592
|
-
]),
|
|
593
|
-
_: 2
|
|
594
|
-
}, 1032, ["type", "class", "onClick"]))
|
|
595
|
-
]),
|
|
596
|
-
actions: g(({ item: o }) => [
|
|
597
|
-
b(a(Te), {
|
|
598
|
-
actions: ve(o),
|
|
599
|
-
label: o.name
|
|
600
|
-
}, null, 8, ["actions", "label"])
|
|
601
|
-
]),
|
|
602
|
-
_: 1
|
|
603
|
-
}, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
|
|
604
|
-
m.value && !c.value ? (p(), k(a(Ee), {
|
|
605
|
-
key: 0,
|
|
606
|
-
class: "wx-tariffs__note",
|
|
607
|
-
type: "info",
|
|
608
|
-
description: F.value
|
|
609
|
-
}, null, 8, ["description"])) : B("", !0)
|
|
610
|
-
], 64))
|
|
611
|
-
]),
|
|
612
|
-
detail: g(({ inline: o, back: z }) => [
|
|
613
|
-
y.value !== null ? (p(), k(Ke, {
|
|
614
|
-
id: y.value === "new" ? null : y.value,
|
|
615
|
-
key: String(y.value),
|
|
616
|
-
category: W.value,
|
|
617
|
-
inline: o,
|
|
618
|
-
onBack: z,
|
|
619
|
-
onSaved: T,
|
|
620
|
-
onCreated: d,
|
|
621
|
-
onRemoved: te
|
|
622
|
-
}, null, 8, ["id", "category", "inline", "onBack"])) : B("", !0)
|
|
623
|
-
]),
|
|
624
|
-
empty: g(() => [
|
|
625
|
-
b(a(ie), {
|
|
626
|
-
title: a(r)("tariff.choose"),
|
|
627
|
-
description: m.value ? a(r)("tariff.choose-help") : void 0
|
|
628
|
-
}, null, 8, ["title", "description"])
|
|
629
|
-
]),
|
|
630
|
-
_: 1
|
|
631
|
-
}, 8, ["open", "detail-label"])
|
|
632
|
-
]),
|
|
633
|
-
_: 1
|
|
634
|
-
})
|
|
635
|
-
]),
|
|
636
|
-
_: 1
|
|
637
|
-
}, 8, ["view", "title", "views"]));
|
|
638
|
-
}
|
|
639
|
-
}), at = /* @__PURE__ */ pe(tt, [["__scopeId", "data-v-d86b91c1"]]);
|
|
640
|
-
function rt(s = "/tariffs") {
|
|
641
|
-
return {
|
|
642
|
-
api: "tariffs/categories",
|
|
643
|
-
path: `${s}/groups`,
|
|
644
|
-
name: "webx.tariffs.groups",
|
|
645
|
-
module: "tariff-groups",
|
|
646
|
-
screen: "tariffs.category-form",
|
|
647
|
-
manage: "tariffs.groups.manage",
|
|
648
|
-
count: "tariffs_count",
|
|
649
|
-
// The list narrowed to one group is also where its own order is dragged.
|
|
650
|
-
items: (l) => ({ path: s, query: { category: String(l) } }),
|
|
651
|
-
words: {
|
|
652
|
-
new: "webx-tariffs::category.new",
|
|
653
|
-
empty: "webx-tariffs::category.empty",
|
|
654
|
-
"empty-help": "webx-tariffs::category.empty-help",
|
|
655
|
-
order: "webx-tariffs::category.order",
|
|
656
|
-
hidden: "webx-tariffs::category.hidden",
|
|
657
|
-
count: "webx-tariffs::category.tariffs",
|
|
658
|
-
"show-items": "webx-tariffs::category.show-tariffs",
|
|
659
|
-
"delete-blocked": "webx-tariffs::category.delete-blocked",
|
|
660
|
-
"delete-text": "webx-tariffs::category.delete-text",
|
|
661
|
-
deleted: "webx-tariffs::category.deleted",
|
|
662
|
-
saved: "webx-tariffs::category.saved",
|
|
663
|
-
"field-title": "webx-tariffs::category.field-title"
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
function lt(s = {}) {
|
|
668
|
-
const l = s.path ?? "/tariffs";
|
|
669
|
-
return [
|
|
670
|
-
{
|
|
671
|
-
id: "tariffs",
|
|
672
|
-
path: l,
|
|
673
|
-
// One route: the open tariff is in the address (`?tariff=`), beside the list it was opened
|
|
674
|
-
// from, so a link to it is a link to both.
|
|
675
|
-
routes: [{ path: l, name: "webx.tariffs", component: at, props: { base: l } }]
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
id: "tariff-groups",
|
|
679
|
-
path: `${l}/groups`,
|
|
680
|
-
routes: Se(rt(l))
|
|
681
|
-
}
|
|
682
|
-
];
|
|
683
|
-
}
|
|
1
|
+
import "vue";
|
|
2
|
+
import { T as r, a as i, W as e, c as t, p, t as o, b as T, d as c } from "./index-Cg_PgXDL.js";
|
|
684
3
|
export {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
4
|
+
r as TARIFFS_API,
|
|
5
|
+
i as WxTariffPane,
|
|
6
|
+
e as WxTariffsPage,
|
|
7
|
+
t as createTariffsApi,
|
|
8
|
+
p as priceLine,
|
|
9
|
+
o as tariffGroupsOptions,
|
|
10
|
+
T as tariffs,
|
|
11
|
+
c as tariffsMessages
|
|
693
12
|
};
|
|
694
13
|
//# sourceMappingURL=index.js.map
|