@webx-ui/module-delivery 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/BindingsPage-pjTbDDWA.js +280 -0
- package/dist/BindingsPage-pjTbDDWA.js.map +1 -0
- package/dist/BindingsPage.d.ts +2 -0
- package/dist/CarrierDialog.d.ts +26 -0
- package/dist/CarriersPage-Dpre8dbl.js +650 -0
- package/dist/CarriersPage-Dpre8dbl.js.map +1 -0
- package/dist/CarriersPage.d.ts +2 -0
- package/dist/GeographyPage-IBg0JnNH.js +750 -0
- package/dist/GeographyPage-IBg0JnNH.js.map +1 -0
- package/dist/GeographyPage.d.ts +2 -0
- package/dist/LocalityDialog.d.ts +39 -0
- package/dist/LocalitySearch.d.ts +33 -0
- package/dist/MethodPane.d.ts +29 -0
- package/dist/MethodsPage-Bpzsa_6v.js +414 -0
- package/dist/MethodsPage-Bpzsa_6v.js.map +1 -0
- package/dist/MethodsPage.d.ts +2 -0
- package/dist/OrderChangeDialog.d.ts +7 -0
- package/dist/OrderDeliveryNode.d.ts +2 -0
- package/dist/PointDialog.d.ts +22 -0
- package/dist/PointsPage-CzYIM86R.js +336 -0
- package/dist/PointsPage-CzYIM86R.js.map +1 -0
- package/dist/PointsPage.d.ts +2 -0
- package/dist/PopularPage-CSrvVg4o.js +141 -0
- package/dist/PopularPage-CSrvVg4o.js.map +1 -0
- package/dist/PopularPage.d.ts +2 -0
- package/dist/RegionDialog.d.ts +11 -0
- package/dist/WaybillDialog.d.ts +8 -0
- package/dist/api.d.ts +151 -0
- package/dist/fields/CountryField.d.ts +14 -0
- package/dist/fields/LocalitiesField.d.ts +14 -0
- package/dist/fields/LocalityField.d.ts +16 -0
- package/dist/fields/PointKindField.d.ts +20 -0
- package/dist/fields/RegionField.d.ts +19 -0
- package/dist/fields/ScheduleField.d.ts +24 -0
- package/dist/i18n.d.ts +5 -0
- package/dist/index-5nt0M0In.js +2539 -0
- package/dist/index-5nt0M0In.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +7 -0
- package/dist/module.d.ts +19 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +467 -0
- package/package.json +64 -3
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
import { defineComponent as de, ref as p, useTemplateRef as Me, onMounted as Ae, nextTick as Ee, openBlock as c, createBlock as w, unref as t, isRef as Ne, withCtx as n, createVNode as s, createElementVNode as x, withKeys as re, createTextVNode as V, toDisplayString as u, computed as _, watch as N, createElementBlock as $, Fragment as K, withModifiers as Pe, createCommentVNode as B, resolveDynamicComponent as Ie } from "vue";
|
|
2
|
+
import { useRoute as Ke, useRouter as Fe } from "vue-router";
|
|
3
|
+
import { useModal as Ge, WxDialog as He, WxFormItem as A, WxInput as se, WxSpace as Je, WxButton as F, createModal as Qe, WxTable as Xe, WxBadge as ee, WxSelect as z, WxText as Ye, WxSkeleton as ue, WxEmpty as le, WxSortableList as ce, WxSwitch as Ze, WxAlert as el, toast as d, confirm as ae } from "@webx-ui/core";
|
|
4
|
+
import { useAdmin as ve, useErrorText as ye, rowMenuWidth as ll, WxListScreen as al, WxRowMenu as te } from "@webx-ui/module-admin";
|
|
5
|
+
import { c as me, u as ge, L as tl, _ as ol } from "./index-5nt0M0In.js";
|
|
6
|
+
const nl = /* @__PURE__ */ de({
|
|
7
|
+
name: "WxDeliveryRegionDialog",
|
|
8
|
+
__name: "RegionDialog",
|
|
9
|
+
props: {
|
|
10
|
+
country: {},
|
|
11
|
+
region: { default: null }
|
|
12
|
+
},
|
|
13
|
+
setup(oe) {
|
|
14
|
+
const k = oe, { open: m, resolve: W } = Ge(), E = me(ve()), e = ge(), f = ye(), v = p({ ...k.region?.names ?? {} }), D = p(k.region?.code ?? ""), S = p({}), g = p(!1), r = Me("field");
|
|
15
|
+
Ae(async () => {
|
|
16
|
+
await Ee(), r.value?.querySelector("input")?.focus();
|
|
17
|
+
});
|
|
18
|
+
const C = () => Object.values(v.value).some((b) => b.trim() !== "");
|
|
19
|
+
function L(b) {
|
|
20
|
+
const i = Object.keys(S.value).find((h) => h === b || h.startsWith(`${b}.`));
|
|
21
|
+
return i === void 0 ? void 0 : S.value[i]?.[0];
|
|
22
|
+
}
|
|
23
|
+
async function R() {
|
|
24
|
+
if (!C() || g.value) return;
|
|
25
|
+
g.value = !0, S.value = {};
|
|
26
|
+
const b = Object.fromEntries(
|
|
27
|
+
Object.entries(v.value).map(([i, h]) => [i, h.trim()]).filter(([, i]) => i !== "")
|
|
28
|
+
);
|
|
29
|
+
try {
|
|
30
|
+
k.region ? await E.saveRegion(k.region.id, { names: b, code: D.value.trim() || null }) : await E.createRegion(k.country, b, D.value.trim() || null), W(!0);
|
|
31
|
+
} catch (i) {
|
|
32
|
+
S.value = i.errors ?? {}, Object.keys(S.value).length === 0 && (S.value = { names: [f(i)] });
|
|
33
|
+
} finally {
|
|
34
|
+
g.value = !1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return (b, i) => (c(), w(t(He), {
|
|
38
|
+
open: t(m),
|
|
39
|
+
"onUpdate:open": i[3] || (i[3] = (h) => Ne(m) ? m.value = h : null),
|
|
40
|
+
title: k.region ? t(e)("region.edit-title") : t(e)("region.new-title"),
|
|
41
|
+
width: 480
|
|
42
|
+
}, {
|
|
43
|
+
footer: n(() => [
|
|
44
|
+
s(t(Je), { size: "sm" }, {
|
|
45
|
+
default: n(() => [
|
|
46
|
+
s(t(F), {
|
|
47
|
+
variant: "outline",
|
|
48
|
+
onClick: i[2] || (i[2] = (h) => m.value = !1)
|
|
49
|
+
}, {
|
|
50
|
+
default: n(() => [
|
|
51
|
+
V(u(t(e)("common.cancel")), 1)
|
|
52
|
+
]),
|
|
53
|
+
_: 1
|
|
54
|
+
}),
|
|
55
|
+
s(t(F), {
|
|
56
|
+
type: "primary",
|
|
57
|
+
loading: g.value,
|
|
58
|
+
disabled: !C(),
|
|
59
|
+
"data-test": "region-save",
|
|
60
|
+
onClick: R
|
|
61
|
+
}, {
|
|
62
|
+
default: n(() => [
|
|
63
|
+
V(u(k.region ? t(e)("common.save") : t(e)("common.add")), 1)
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
}, 8, ["loading", "disabled"])
|
|
67
|
+
]),
|
|
68
|
+
_: 1
|
|
69
|
+
})
|
|
70
|
+
]),
|
|
71
|
+
default: n(() => [
|
|
72
|
+
s(t(A), {
|
|
73
|
+
label: t(e)("region.name"),
|
|
74
|
+
help: t(e)("locality.names-help"),
|
|
75
|
+
error: L("names"),
|
|
76
|
+
required: ""
|
|
77
|
+
}, {
|
|
78
|
+
default: n(() => [
|
|
79
|
+
x("div", {
|
|
80
|
+
ref_key: "field",
|
|
81
|
+
ref: r
|
|
82
|
+
}, [
|
|
83
|
+
s(t(se), {
|
|
84
|
+
modelValue: v.value,
|
|
85
|
+
"onUpdate:modelValue": i[0] || (i[0] = (h) => v.value = h),
|
|
86
|
+
localized: "",
|
|
87
|
+
maxlength: 120,
|
|
88
|
+
"aria-label": t(e)("region.name"),
|
|
89
|
+
"data-test": "region-name",
|
|
90
|
+
onKeyup: re(R, ["enter"])
|
|
91
|
+
}, null, 8, ["modelValue", "aria-label"])
|
|
92
|
+
], 512)
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 8, ["label", "help", "error"]),
|
|
96
|
+
s(t(A), {
|
|
97
|
+
label: t(e)("region.code"),
|
|
98
|
+
help: t(e)("region.code-help"),
|
|
99
|
+
error: L("code")
|
|
100
|
+
}, {
|
|
101
|
+
default: n(() => [
|
|
102
|
+
s(t(se), {
|
|
103
|
+
modelValue: D.value,
|
|
104
|
+
"onUpdate:modelValue": i[1] || (i[1] = (h) => D.value = h),
|
|
105
|
+
maxlength: 8,
|
|
106
|
+
onKeyup: re(R, ["enter"])
|
|
107
|
+
}, null, 8, ["modelValue"])
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
}, 8, ["label", "help", "error"])
|
|
111
|
+
]),
|
|
112
|
+
_: 1
|
|
113
|
+
}, 8, ["open", "title"]));
|
|
114
|
+
}
|
|
115
|
+
}), il = { class: "wx-delivery-geo__name" }, rl = {
|
|
116
|
+
key: 0,
|
|
117
|
+
class: "wx-delivery-geo__muted"
|
|
118
|
+
}, sl = {
|
|
119
|
+
key: 0,
|
|
120
|
+
class: "wx-delivery-geo__muted"
|
|
121
|
+
}, ul = { class: "wx-delivery-geo__muted" }, cl = {
|
|
122
|
+
key: 0,
|
|
123
|
+
class: "wx-delivery-geo__bar"
|
|
124
|
+
}, dl = { class: "wx-delivery-geo__country" }, vl = { class: "wx-delivery-geo__name" }, yl = { class: "wx-delivery-geo__muted" }, ml = { class: "wx-delivery-geo__muted" }, gl = {
|
|
125
|
+
key: 0,
|
|
126
|
+
class: "wx-delivery-geo__leader"
|
|
127
|
+
}, pl = { class: "wx-delivery-geo__muted" }, fl = { class: "wx-delivery-geo__country-actions" }, bl = { class: "wx-delivery-geo__bar" }, hl = { class: "wx-delivery-geo__name" }, _l = {
|
|
128
|
+
key: 0,
|
|
129
|
+
class: "wx-delivery-geo__muted"
|
|
130
|
+
}, wl = { class: "wx-delivery-geo__muted wx-delivery-geo__count" }, xl = /* @__PURE__ */ de({
|
|
131
|
+
__name: "GeographyPage",
|
|
132
|
+
setup(oe) {
|
|
133
|
+
const k = ve(), m = me(k), W = Ke(), E = Fe(), e = ge(), f = ye(), v = _(() => k.can("delivery.manage")), D = _(
|
|
134
|
+
() => k.state.manifest?.modules.find((l) => l.id === "delivery-geography")?.title ?? e("sections.geography")
|
|
135
|
+
), S = _(() => [
|
|
136
|
+
{ value: "localities", label: e("country.localities-tab") },
|
|
137
|
+
{ value: "countries", label: e("country.title") },
|
|
138
|
+
{ value: "regions", label: e("region.title") }
|
|
139
|
+
]), g = _({
|
|
140
|
+
get: () => W.query.view === "countries" || W.query.view === "regions" ? W.query.view : "localities",
|
|
141
|
+
set: (l) => {
|
|
142
|
+
E.replace({
|
|
143
|
+
query: { ...W.query, view: l === "localities" ? void 0 : String(l) }
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}), r = _({
|
|
147
|
+
get: () => typeof W.query.country == "string" ? W.query.country : "",
|
|
148
|
+
set: (l) => {
|
|
149
|
+
E.replace({
|
|
150
|
+
query: { ...W.query, country: l || void 0, region: void 0 }
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}), C = p(null), L = p(!1), R = p(null);
|
|
154
|
+
async function b() {
|
|
155
|
+
L.value = !0;
|
|
156
|
+
try {
|
|
157
|
+
C.value = await m.countries();
|
|
158
|
+
} catch (l) {
|
|
159
|
+
d.danger(f(l));
|
|
160
|
+
} finally {
|
|
161
|
+
L.value = !1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
b(), N(
|
|
165
|
+
[g, C],
|
|
166
|
+
() => {
|
|
167
|
+
const l = C.value?.countries ?? [];
|
|
168
|
+
g.value === "regions" && r.value === "" && l.length > 0 && (r.value = (l.find((o) => o.active) ?? l[0]).code);
|
|
169
|
+
},
|
|
170
|
+
{ immediate: !0 }
|
|
171
|
+
);
|
|
172
|
+
const i = p([]);
|
|
173
|
+
N(C, (l) => i.value = l?.countries ?? []);
|
|
174
|
+
const h = _(
|
|
175
|
+
() => i.value.map((l) => ({
|
|
176
|
+
value: l.code,
|
|
177
|
+
label: `${l.name} (${l.code})${l.active ? "" : ` · ${e("country.off")}`}`
|
|
178
|
+
}))
|
|
179
|
+
), pe = _(() => {
|
|
180
|
+
const l = new Set(i.value.filter((o) => o.active).map((o) => o.code));
|
|
181
|
+
return (C.value?.choices ?? []).filter((o) => !l.has(o.code)).map((o) => ({ value: o.code, label: `${o.name} (${o.code})` }));
|
|
182
|
+
}), G = _(() => [
|
|
183
|
+
{ value: "", label: e("country.leader-none") },
|
|
184
|
+
...C.value?.carriers ?? []
|
|
185
|
+
]);
|
|
186
|
+
async function fe(l) {
|
|
187
|
+
if (l)
|
|
188
|
+
try {
|
|
189
|
+
await m.enableCountry(l), R.value = null, r.value = l, await b();
|
|
190
|
+
} catch (o) {
|
|
191
|
+
d.danger(f(o));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async function be(l, o) {
|
|
195
|
+
try {
|
|
196
|
+
o ? await m.enableCountry(l) : (await m.disableCountry(l), d.info(e("country.disabled"))), await b();
|
|
197
|
+
} catch (a) {
|
|
198
|
+
d.danger(f(a));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function he(l, o) {
|
|
202
|
+
try {
|
|
203
|
+
await m.lead(l, o === "" ? null : o), d.success(e("common.saved"));
|
|
204
|
+
} catch (a) {
|
|
205
|
+
d.danger(f(a));
|
|
206
|
+
} finally {
|
|
207
|
+
await b();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
async function _e() {
|
|
211
|
+
try {
|
|
212
|
+
await m.orderCountries(i.value.map((l) => l.code));
|
|
213
|
+
} catch (l) {
|
|
214
|
+
d.danger(f(l, e("common.order-failed"))), await b();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async function we(l) {
|
|
218
|
+
const o = l.regions > 0 || l.localities > 0;
|
|
219
|
+
if (await ae({
|
|
220
|
+
title: e("country.remove-title", { name: l.name }),
|
|
221
|
+
message: e(o ? "country.remove-held" : "country.remove-text"),
|
|
222
|
+
confirmText: e(o ? "country.disable" : "country.remove"),
|
|
223
|
+
cancelText: e("common.cancel"),
|
|
224
|
+
tone: "danger"
|
|
225
|
+
}))
|
|
226
|
+
try {
|
|
227
|
+
const y = await m.removeCountry(l.code);
|
|
228
|
+
d.success(e(y === "deleted" ? "country.removed" : "country.deactivated")), y === "deleted" && r.value === l.code && (r.value = ""), await b();
|
|
229
|
+
} catch (y) {
|
|
230
|
+
d.danger(f(y));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function xe(l) {
|
|
234
|
+
return v.value ? [
|
|
235
|
+
{
|
|
236
|
+
key: "remove",
|
|
237
|
+
icon: "trash",
|
|
238
|
+
label: e("country.remove"),
|
|
239
|
+
danger: !0,
|
|
240
|
+
run: () => {
|
|
241
|
+
we(l);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
] : [];
|
|
245
|
+
}
|
|
246
|
+
const U = p([]), H = p(!1), ke = Qe(
|
|
247
|
+
nl
|
|
248
|
+
);
|
|
249
|
+
async function Ve() {
|
|
250
|
+
try {
|
|
251
|
+
await m.orderRegions(
|
|
252
|
+
r.value,
|
|
253
|
+
U.value.map((l) => l.id)
|
|
254
|
+
);
|
|
255
|
+
} catch (l) {
|
|
256
|
+
d.danger(f(l, e("common.order-failed"))), await P();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async function P() {
|
|
260
|
+
if (r.value === "") {
|
|
261
|
+
U.value = [];
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
H.value = !0;
|
|
265
|
+
try {
|
|
266
|
+
U.value = await m.regions(r.value);
|
|
267
|
+
} catch (l) {
|
|
268
|
+
d.danger(f(l));
|
|
269
|
+
} finally {
|
|
270
|
+
H.value = !1;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
N(
|
|
274
|
+
[r, g],
|
|
275
|
+
() => {
|
|
276
|
+
(g.value === "regions" || g.value === "localities") && P();
|
|
277
|
+
},
|
|
278
|
+
{ immediate: !0 }
|
|
279
|
+
);
|
|
280
|
+
async function J(l) {
|
|
281
|
+
r.value !== "" && await ke({ country: r.value, region: l }) && (d.success(e("region.saved")), await P());
|
|
282
|
+
}
|
|
283
|
+
async function We(l) {
|
|
284
|
+
if (await ae({
|
|
285
|
+
title: e("region.delete-title", { name: l.name }),
|
|
286
|
+
message: e("region.delete-text"),
|
|
287
|
+
confirmText: e("common.delete"),
|
|
288
|
+
cancelText: e("common.cancel"),
|
|
289
|
+
tone: "danger"
|
|
290
|
+
}))
|
|
291
|
+
try {
|
|
292
|
+
await m.removeRegion(l.id), d.success(e("region.deleted")), await P();
|
|
293
|
+
} catch (a) {
|
|
294
|
+
d.danger(f(a));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function Ce(l) {
|
|
298
|
+
return v.value ? [
|
|
299
|
+
{ key: "edit", icon: "edit", label: e("region.edit"), run: () => {
|
|
300
|
+
J(l);
|
|
301
|
+
} },
|
|
302
|
+
{
|
|
303
|
+
key: "delete",
|
|
304
|
+
icon: "trash",
|
|
305
|
+
label: e("common.delete"),
|
|
306
|
+
danger: !0,
|
|
307
|
+
disabled: l.localities > 0,
|
|
308
|
+
hint: l.localities > 0 ? e("region.delete-held") : void 0,
|
|
309
|
+
run: () => {
|
|
310
|
+
We(l);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
] : [];
|
|
314
|
+
}
|
|
315
|
+
const Q = p(null), X = p(!1), T = p(null), j = p(""), M = p(""), ne = p(null), Y = p(!1), Re = _(() => [
|
|
316
|
+
{ key: "name", label: e("locality.names"), minWidth: 160 },
|
|
317
|
+
{ key: "kind", label: e("locality.kind"), width: 120, hideBelow: 560 },
|
|
318
|
+
{ key: "region", label: e("locality.region"), minWidth: 140, hideBelow: 640 },
|
|
319
|
+
{ key: "source", label: e("locality.source"), width: 120, hideBelow: 760 },
|
|
320
|
+
{ key: "bindings", label: e("locality.bindings"), minWidth: 120, hideBelow: 900 },
|
|
321
|
+
{ key: "weight", label: e("locality.weight"), width: 90, align: "right", hideBelow: 900 },
|
|
322
|
+
{ key: "active", label: e("locality.active"), width: 110 },
|
|
323
|
+
{ key: "actions", label: "", width: ll, align: "right" }
|
|
324
|
+
]), Ue = _(() => [
|
|
325
|
+
{ value: "", label: e("locality.any-source") },
|
|
326
|
+
{ value: "manual", label: e("locality.sources.manual") },
|
|
327
|
+
{ value: "import", label: e("locality.sources.import") },
|
|
328
|
+
{ value: "carrier", label: e("locality.sources.carrier") }
|
|
329
|
+
]), $e = _(() => [
|
|
330
|
+
{ value: "", label: e("common.any-state") },
|
|
331
|
+
{ value: "active", label: e("common.active") },
|
|
332
|
+
{ value: "inactive", label: e("common.inactive") }
|
|
333
|
+
]), Se = _(
|
|
334
|
+
() => U.value.map((l) => ({ value: l.id, label: l.name }))
|
|
335
|
+
);
|
|
336
|
+
let I = { page: 1, perPage: 25, sort: null, search: "" };
|
|
337
|
+
async function q(l = I) {
|
|
338
|
+
I = l, X.value = !0;
|
|
339
|
+
try {
|
|
340
|
+
Q.value = await m.localities({
|
|
341
|
+
page: l.page,
|
|
342
|
+
per_page: l.perPage,
|
|
343
|
+
q: l.search,
|
|
344
|
+
country: r.value,
|
|
345
|
+
region: T.value,
|
|
346
|
+
source: j.value,
|
|
347
|
+
state: M.value
|
|
348
|
+
});
|
|
349
|
+
} catch (o) {
|
|
350
|
+
d.danger(f(o));
|
|
351
|
+
} finally {
|
|
352
|
+
X.value = !1;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
N([r, T, j, M], () => {
|
|
356
|
+
g.value === "localities" && q({ ...I, page: 1 });
|
|
357
|
+
}), N(r, () => T.value = null);
|
|
358
|
+
const Te = _(() => {
|
|
359
|
+
const l = Q.value?.elsewhere ?? [], o = (O) => O.map((je) => je.name).join(", "), a = l.filter((O) => O.active), y = l.filter((O) => !O.active), Le = I.search !== "" || !!r.value || !!T.value || !!j.value || !!M.value;
|
|
360
|
+
return [
|
|
361
|
+
e(Le ? "locality.nothing-found" : "locality.empty"),
|
|
362
|
+
a.length > 0 ? e("locality.found-in", { countries: o(a) }) : "",
|
|
363
|
+
y.length > 0 ? e("locality.found-off", { countries: o(y) }) : ""
|
|
364
|
+
].filter((O) => O !== "").join(" ");
|
|
365
|
+
});
|
|
366
|
+
function Z(l) {
|
|
367
|
+
ne.value = l, Y.value = !0;
|
|
368
|
+
}
|
|
369
|
+
async function ie(l) {
|
|
370
|
+
try {
|
|
371
|
+
await m.activateLocality(l.id), d.success(e("locality.activated")), await q();
|
|
372
|
+
} catch (o) {
|
|
373
|
+
d.danger(f(o));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
async function qe(l) {
|
|
377
|
+
try {
|
|
378
|
+
await m.deactivateLocality(l.id), d.success(e("locality.switched-off")), await q();
|
|
379
|
+
} catch (o) {
|
|
380
|
+
d.danger(f(o));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async function Oe(l) {
|
|
384
|
+
let o = [];
|
|
385
|
+
try {
|
|
386
|
+
o = (await m.locality(l.id)).locality.held_by;
|
|
387
|
+
} catch (y) {
|
|
388
|
+
d.danger(f(y));
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (await ae({
|
|
392
|
+
title: e("locality.delete-title", { name: l.name }),
|
|
393
|
+
message: o.length > 0 ? e("locality.held-text", { what: o.join(", ") }) : e("locality.delete-text"),
|
|
394
|
+
confirmText: o.length > 0 ? e("locality.deactivate") : e("common.delete"),
|
|
395
|
+
cancelText: e("common.cancel"),
|
|
396
|
+
tone: "danger"
|
|
397
|
+
}))
|
|
398
|
+
try {
|
|
399
|
+
const { removal: y } = await m.removeLocality(l.id);
|
|
400
|
+
d.success(e(y === "deleted" ? "locality.deleted" : "locality.deactivated")), await q();
|
|
401
|
+
} catch (y) {
|
|
402
|
+
d.danger(f(y));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function Be(l) {
|
|
406
|
+
return v.value ? [
|
|
407
|
+
{ key: "edit", icon: "edit", label: e("common.edit"), run: () => Z(l.id) },
|
|
408
|
+
l.active ? {
|
|
409
|
+
key: "off",
|
|
410
|
+
icon: "eye-off",
|
|
411
|
+
label: e("locality.deactivate"),
|
|
412
|
+
run: () => {
|
|
413
|
+
qe(l);
|
|
414
|
+
}
|
|
415
|
+
} : { key: "on", icon: "eye", label: e("locality.activate"), run: () => {
|
|
416
|
+
ie(l);
|
|
417
|
+
} },
|
|
418
|
+
{
|
|
419
|
+
key: "delete",
|
|
420
|
+
icon: "trash",
|
|
421
|
+
label: e("common.delete"),
|
|
422
|
+
danger: !0,
|
|
423
|
+
run: () => {
|
|
424
|
+
Oe(l);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
] : [];
|
|
428
|
+
}
|
|
429
|
+
function ze() {
|
|
430
|
+
q();
|
|
431
|
+
}
|
|
432
|
+
const De = _(() => v.value ? g.value === "localities" ? [{ key: "new", label: e("locality.new"), primary: !0, run: () => Z(null) }] : g.value === "regions" && r.value !== "" ? [{ key: "new", label: e("region.add"), primary: !0, run: () => {
|
|
433
|
+
J(null);
|
|
434
|
+
} }] : [] : []);
|
|
435
|
+
return (l, o) => (c(), w(t(al), {
|
|
436
|
+
view: g.value,
|
|
437
|
+
"onUpdate:view": o[12] || (o[12] = (a) => g.value = a),
|
|
438
|
+
title: D.value,
|
|
439
|
+
views: S.value,
|
|
440
|
+
actions: De.value
|
|
441
|
+
}, {
|
|
442
|
+
default: n(() => [
|
|
443
|
+
g.value === "localities" ? (c(), $(K, { key: 0 }, [
|
|
444
|
+
s(t(Xe), {
|
|
445
|
+
data: Q.value,
|
|
446
|
+
columns: Re.value,
|
|
447
|
+
"row-key": "id",
|
|
448
|
+
searchable: "",
|
|
449
|
+
clickable: "",
|
|
450
|
+
hover: "",
|
|
451
|
+
flush: "",
|
|
452
|
+
loading: X.value,
|
|
453
|
+
"search-placeholder": t(e)("locality.search"),
|
|
454
|
+
"empty-text": Te.value,
|
|
455
|
+
"filters-count": (r.value ? 1 : 0) + (T.value ? 1 : 0) + (j.value ? 1 : 0) + (M.value ? 1 : 0),
|
|
456
|
+
onRowClick: o[4] || (o[4] = (a) => Z(a.id)),
|
|
457
|
+
onStateChange: q
|
|
458
|
+
}, {
|
|
459
|
+
filters: n(() => [
|
|
460
|
+
s(t(A), {
|
|
461
|
+
label: t(e)("locality.country")
|
|
462
|
+
}, {
|
|
463
|
+
default: n(() => [
|
|
464
|
+
s(t(z), {
|
|
465
|
+
modelValue: r.value,
|
|
466
|
+
"onUpdate:modelValue": o[0] || (o[0] = (a) => r.value = a),
|
|
467
|
+
options: [{ value: "", label: t(e)("locality.any-country") }, ...h.value],
|
|
468
|
+
size: "sm",
|
|
469
|
+
filterable: "",
|
|
470
|
+
"data-test": "locality-country"
|
|
471
|
+
}, null, 8, ["modelValue", "options"])
|
|
472
|
+
]),
|
|
473
|
+
_: 1
|
|
474
|
+
}, 8, ["label"]),
|
|
475
|
+
s(t(A), {
|
|
476
|
+
label: t(e)("locality.region")
|
|
477
|
+
}, {
|
|
478
|
+
default: n(() => [
|
|
479
|
+
s(t(z), {
|
|
480
|
+
modelValue: T.value,
|
|
481
|
+
"onUpdate:modelValue": o[1] || (o[1] = (a) => T.value = a),
|
|
482
|
+
options: Se.value,
|
|
483
|
+
placeholder: t(e)("locality.any-region"),
|
|
484
|
+
size: "sm",
|
|
485
|
+
filterable: "",
|
|
486
|
+
clearable: ""
|
|
487
|
+
}, null, 8, ["modelValue", "options", "placeholder"])
|
|
488
|
+
]),
|
|
489
|
+
_: 1
|
|
490
|
+
}, 8, ["label"]),
|
|
491
|
+
s(t(A), {
|
|
492
|
+
label: t(e)("locality.source")
|
|
493
|
+
}, {
|
|
494
|
+
default: n(() => [
|
|
495
|
+
s(t(z), {
|
|
496
|
+
modelValue: j.value,
|
|
497
|
+
"onUpdate:modelValue": o[2] || (o[2] = (a) => j.value = a),
|
|
498
|
+
options: Ue.value,
|
|
499
|
+
size: "sm"
|
|
500
|
+
}, null, 8, ["modelValue", "options"])
|
|
501
|
+
]),
|
|
502
|
+
_: 1
|
|
503
|
+
}, 8, ["label"]),
|
|
504
|
+
s(t(A), {
|
|
505
|
+
label: t(e)("locality.active")
|
|
506
|
+
}, {
|
|
507
|
+
default: n(() => [
|
|
508
|
+
s(t(z), {
|
|
509
|
+
modelValue: M.value,
|
|
510
|
+
"onUpdate:modelValue": o[3] || (o[3] = (a) => M.value = a),
|
|
511
|
+
options: $e.value,
|
|
512
|
+
size: "sm"
|
|
513
|
+
}, null, 8, ["modelValue", "options"])
|
|
514
|
+
]),
|
|
515
|
+
_: 1
|
|
516
|
+
}, 8, ["label"])
|
|
517
|
+
]),
|
|
518
|
+
"cell-name": n(({ row: a }) => [
|
|
519
|
+
x("span", il, u(a.name), 1),
|
|
520
|
+
a.district ? (c(), $("span", rl, " · " + u(a.district), 1)) : B("", !0)
|
|
521
|
+
]),
|
|
522
|
+
"cell-kind": n(({ row: a }) => [
|
|
523
|
+
V(u(a.kind_label), 1)
|
|
524
|
+
]),
|
|
525
|
+
"cell-region": n(({ row: a }) => [
|
|
526
|
+
V(u(a.region?.name ?? "") + " ", 1),
|
|
527
|
+
r.value ? B("", !0) : (c(), $("span", sl, " · " + u(a.country), 1))
|
|
528
|
+
]),
|
|
529
|
+
"cell-source": n(({ row: a }) => [
|
|
530
|
+
s(t(ee), { size: "sm" }, {
|
|
531
|
+
default: n(() => [
|
|
532
|
+
V(u(t(e)(`locality.sources.${a.source}`)), 1)
|
|
533
|
+
]),
|
|
534
|
+
_: 2
|
|
535
|
+
}, 1024)
|
|
536
|
+
]),
|
|
537
|
+
"cell-bindings": n(({ row: a }) => [
|
|
538
|
+
x("span", ul, u(a.bindings.map((y) => y.carrier_title).join(", ")), 1)
|
|
539
|
+
]),
|
|
540
|
+
"cell-active": n(({ row: a }) => [
|
|
541
|
+
a.active ? (c(), w(t(ee), {
|
|
542
|
+
key: 0,
|
|
543
|
+
type: "success",
|
|
544
|
+
dot: ""
|
|
545
|
+
}, {
|
|
546
|
+
default: n(() => [
|
|
547
|
+
V(u(t(e)("common.active")), 1)
|
|
548
|
+
]),
|
|
549
|
+
_: 1
|
|
550
|
+
})) : v.value ? (c(), w(t(F), {
|
|
551
|
+
key: 1,
|
|
552
|
+
size: "sm",
|
|
553
|
+
variant: "outline",
|
|
554
|
+
onClick: Pe((y) => ie(a), ["stop"])
|
|
555
|
+
}, {
|
|
556
|
+
default: n(() => [
|
|
557
|
+
V(u(t(e)("locality.activate")), 1)
|
|
558
|
+
]),
|
|
559
|
+
_: 1
|
|
560
|
+
}, 8, ["onClick"])) : (c(), w(t(ee), {
|
|
561
|
+
key: 2,
|
|
562
|
+
dot: ""
|
|
563
|
+
}, {
|
|
564
|
+
default: n(() => [
|
|
565
|
+
V(u(t(e)("common.inactive")), 1)
|
|
566
|
+
]),
|
|
567
|
+
_: 1
|
|
568
|
+
}))
|
|
569
|
+
]),
|
|
570
|
+
"cell-actions": n(({ row: a }) => [
|
|
571
|
+
s(t(te), {
|
|
572
|
+
actions: Be(a),
|
|
573
|
+
label: a.name
|
|
574
|
+
}, null, 8, ["actions", "label"])
|
|
575
|
+
]),
|
|
576
|
+
_: 1
|
|
577
|
+
}, 8, ["data", "columns", "loading", "search-placeholder", "empty-text", "filters-count"]),
|
|
578
|
+
s(tl, {
|
|
579
|
+
id: ne.value,
|
|
580
|
+
open: Y.value,
|
|
581
|
+
"onUpdate:open": o[5] || (o[5] = (a) => Y.value = a),
|
|
582
|
+
country: r.value || null,
|
|
583
|
+
onSaved: ze,
|
|
584
|
+
onRemoved: o[6] || (o[6] = (a) => q())
|
|
585
|
+
}, null, 8, ["id", "open", "country"])
|
|
586
|
+
], 64)) : g.value === "countries" ? (c(), $(K, { key: 1 }, [
|
|
587
|
+
v.value ? (c(), $("div", cl, [
|
|
588
|
+
s(t(z), {
|
|
589
|
+
modelValue: R.value,
|
|
590
|
+
"onUpdate:modelValue": o[7] || (o[7] = (a) => R.value = a),
|
|
591
|
+
options: pe.value,
|
|
592
|
+
filterable: "",
|
|
593
|
+
placeholder: t(e)("country.choose"),
|
|
594
|
+
"aria-label": t(e)("country.add"),
|
|
595
|
+
class: "wx-delivery-geo__choose",
|
|
596
|
+
"data-test": "country-choice"
|
|
597
|
+
}, null, 8, ["modelValue", "options", "placeholder", "aria-label"]),
|
|
598
|
+
s(t(F), {
|
|
599
|
+
type: "primary",
|
|
600
|
+
disabled: !R.value,
|
|
601
|
+
"data-test": "country-enable",
|
|
602
|
+
onClick: o[8] || (o[8] = (a) => fe(R.value))
|
|
603
|
+
}, {
|
|
604
|
+
default: n(() => [
|
|
605
|
+
V(u(t(e)("country.enable")), 1)
|
|
606
|
+
]),
|
|
607
|
+
_: 1
|
|
608
|
+
}, 8, ["disabled"])
|
|
609
|
+
])) : B("", !0),
|
|
610
|
+
i.value.length > 0 && G.value.length > 1 ? (c(), w(t(Ye), {
|
|
611
|
+
key: 1,
|
|
612
|
+
class: "wx-delivery-geo__note",
|
|
613
|
+
tone: "muted",
|
|
614
|
+
size: "sm",
|
|
615
|
+
"data-test": "leader-help"
|
|
616
|
+
}, {
|
|
617
|
+
default: n(() => [
|
|
618
|
+
V(u(t(e)("country.leader-help")), 1)
|
|
619
|
+
]),
|
|
620
|
+
_: 1
|
|
621
|
+
})) : B("", !0),
|
|
622
|
+
L.value && i.value.length === 0 ? (c(), w(t(ue), {
|
|
623
|
+
key: 2,
|
|
624
|
+
rows: 3
|
|
625
|
+
})) : i.value.length === 0 ? (c(), w(t(le), {
|
|
626
|
+
key: 3,
|
|
627
|
+
title: t(e)("country.empty"),
|
|
628
|
+
description: t(e)("country.empty-help")
|
|
629
|
+
}, null, 8, ["title", "description"])) : (c(), w(t(ce), {
|
|
630
|
+
key: 4,
|
|
631
|
+
modelValue: i.value,
|
|
632
|
+
"onUpdate:modelValue": o[9] || (o[9] = (a) => i.value = a),
|
|
633
|
+
class: "wx-delivery-geo__list",
|
|
634
|
+
plain: "",
|
|
635
|
+
hoverable: "",
|
|
636
|
+
"item-key": "code",
|
|
637
|
+
handle: v.value ? "grip" : "row",
|
|
638
|
+
"item-label": (a) => a.name,
|
|
639
|
+
disabled: !v.value,
|
|
640
|
+
onMove: _e
|
|
641
|
+
}, {
|
|
642
|
+
default: n(({ item: a }) => [
|
|
643
|
+
x("div", dl, [
|
|
644
|
+
x("span", vl, u(a.name), 1),
|
|
645
|
+
x("span", yl, u(a.code), 1),
|
|
646
|
+
x("span", ml, u(t(e)("country.regions")) + ": " + u(a.regions) + " · " + u(t(e)("country.localities")) + ": " + u(a.localities), 1),
|
|
647
|
+
G.value.length > 1 ? (c(), $("span", gl, [
|
|
648
|
+
x("span", pl, u(t(e)("country.leader")), 1),
|
|
649
|
+
s(t(z), {
|
|
650
|
+
size: "sm",
|
|
651
|
+
"model-value": a.leader ?? "",
|
|
652
|
+
options: G.value,
|
|
653
|
+
disabled: !v.value || a.leader_fixed,
|
|
654
|
+
"aria-label": t(e)("country.leader"),
|
|
655
|
+
"onUpdate:modelValue": (y) => he(a.code, String(y ?? ""))
|
|
656
|
+
}, null, 8, ["model-value", "options", "disabled", "aria-label", "onUpdate:modelValue"])
|
|
657
|
+
])) : B("", !0)
|
|
658
|
+
])
|
|
659
|
+
]),
|
|
660
|
+
actions: n(({ item: a }) => [
|
|
661
|
+
x("span", fl, [
|
|
662
|
+
s(t(Ze), {
|
|
663
|
+
"model-value": a.active,
|
|
664
|
+
disabled: !v.value,
|
|
665
|
+
"aria-label": a.active ? t(e)("country.disable") : t(e)("country.enable"),
|
|
666
|
+
"onUpdate:modelValue": (y) => be(a.code, !!y)
|
|
667
|
+
}, null, 8, ["model-value", "disabled", "aria-label", "onUpdate:modelValue"]),
|
|
668
|
+
s(t(te), {
|
|
669
|
+
actions: xe(a),
|
|
670
|
+
label: a.name
|
|
671
|
+
}, null, 8, ["actions", "label"])
|
|
672
|
+
])
|
|
673
|
+
]),
|
|
674
|
+
_: 1
|
|
675
|
+
}, 8, ["modelValue", "handle", "item-label", "disabled"]))
|
|
676
|
+
], 64)) : (c(), $(K, { key: 2 }, [
|
|
677
|
+
x("div", bl, [
|
|
678
|
+
s(t(z), {
|
|
679
|
+
modelValue: r.value,
|
|
680
|
+
"onUpdate:modelValue": o[10] || (o[10] = (a) => r.value = a),
|
|
681
|
+
options: h.value,
|
|
682
|
+
filterable: "",
|
|
683
|
+
placeholder: t(e)("country.choose"),
|
|
684
|
+
"aria-label": t(e)("locality.country"),
|
|
685
|
+
class: "wx-delivery-geo__choose"
|
|
686
|
+
}, null, 8, ["modelValue", "options", "placeholder", "aria-label"])
|
|
687
|
+
]),
|
|
688
|
+
r.value === "" ? (c(), w(t(le), {
|
|
689
|
+
key: 0,
|
|
690
|
+
title: t(e)("region.country-first")
|
|
691
|
+
}, null, 8, ["title"])) : H.value && U.value.length === 0 ? (c(), w(t(ue), {
|
|
692
|
+
key: 1,
|
|
693
|
+
rows: 3
|
|
694
|
+
})) : U.value.length === 0 ? (c(), w(t(le), {
|
|
695
|
+
key: 2,
|
|
696
|
+
title: t(e)("region.empty")
|
|
697
|
+
}, null, 8, ["title"])) : (c(), $(K, { key: 3 }, [
|
|
698
|
+
s(t(ce), {
|
|
699
|
+
modelValue: U.value,
|
|
700
|
+
"onUpdate:modelValue": o[11] || (o[11] = (a) => U.value = a),
|
|
701
|
+
class: "wx-delivery-geo__list",
|
|
702
|
+
plain: "",
|
|
703
|
+
hoverable: "",
|
|
704
|
+
"item-key": "id",
|
|
705
|
+
handle: v.value ? "grip" : "row",
|
|
706
|
+
"item-label": (a) => a.name,
|
|
707
|
+
disabled: !v.value,
|
|
708
|
+
"aria-label": t(e)("region.title"),
|
|
709
|
+
"data-test": "regions",
|
|
710
|
+
onMove: Ve
|
|
711
|
+
}, {
|
|
712
|
+
default: n(({ item: a }) => [
|
|
713
|
+
(c(), w(Ie(v.value ? "button" : "div"), {
|
|
714
|
+
type: v.value ? "button" : void 0,
|
|
715
|
+
class: "wx-delivery-geo__region",
|
|
716
|
+
onClick: (y) => v.value && J(a)
|
|
717
|
+
}, {
|
|
718
|
+
default: n(() => [
|
|
719
|
+
x("span", hl, u(a.name), 1),
|
|
720
|
+
a.code ? (c(), $("span", _l, u(a.code), 1)) : B("", !0),
|
|
721
|
+
x("span", wl, u(t(e)("country.localities")) + ": " + u(a.localities), 1)
|
|
722
|
+
]),
|
|
723
|
+
_: 2
|
|
724
|
+
}, 1032, ["type", "onClick"]))
|
|
725
|
+
]),
|
|
726
|
+
actions: n(({ item: a }) => [
|
|
727
|
+
s(t(te), {
|
|
728
|
+
actions: Ce(a),
|
|
729
|
+
label: a.name
|
|
730
|
+
}, null, 8, ["actions", "label"])
|
|
731
|
+
]),
|
|
732
|
+
_: 1
|
|
733
|
+
}, 8, ["modelValue", "handle", "item-label", "disabled", "aria-label"]),
|
|
734
|
+
v.value && U.value.length > 1 ? (c(), w(t(el), {
|
|
735
|
+
key: 0,
|
|
736
|
+
class: "wx-delivery-geo__hint",
|
|
737
|
+
type: "info",
|
|
738
|
+
description: t(e)("common.drag")
|
|
739
|
+
}, null, 8, ["description"])) : B("", !0)
|
|
740
|
+
], 64))
|
|
741
|
+
], 64))
|
|
742
|
+
]),
|
|
743
|
+
_: 1
|
|
744
|
+
}, 8, ["view", "title", "views", "actions"]));
|
|
745
|
+
}
|
|
746
|
+
}), $l = /* @__PURE__ */ ol(xl, [["__scopeId", "data-v-1f489156"]]);
|
|
747
|
+
export {
|
|
748
|
+
$l as default
|
|
749
|
+
};
|
|
750
|
+
//# sourceMappingURL=GeographyPage-IBg0JnNH.js.map
|