@opengis/admin 0.3.104 → 0.3.106

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.
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M1.3335 8C1.3335 8 3.3335 3.33333 8.00016 3.33333C12.6668 3.33333 14.6668 8 14.6668 8C14.6668 8 12.6668 12.6667 8.00016 12.6667C3.3335 12.6667 1.3335 8 1.3335 8Z" stroke="#6B7280" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M8 10C9.10457 10 10 9.10457 10 8C10 6.89543 9.10457 6 8 6C6.89543 6 6 6.89543 6 8C6 9.10457 6.89543 10 8 10Z" stroke="#6B7280" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.45837 1.16666H3.50004C3.19062 1.16666 2.89388 1.28957 2.67508 1.50837C2.45629 1.72716 2.33337 2.0239 2.33337 2.33332V11.6667C2.33337 11.9761 2.45629 12.2728 2.67508 12.4916C2.89388 12.7104 3.19062 12.8333 3.50004 12.8333H10.5C10.8095 12.8333 11.1062 12.7104 11.325 12.4916C11.5438 12.2728 11.6667 11.9761 11.6667 11.6667V4.37499L8.45837 1.16666Z" stroke="#2563EB" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M8.16663 1.16666V4.66666H11.6666" stroke="#2563EB" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M7 7V10.5" stroke="#2563EB" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M8.75 8.75L7 7L5.25 8.75" stroke="#2563EB" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </svg>
@@ -1,9 +1,9 @@
1
- import { resolveComponent as e, openBlock as r, createBlock as t } from "vue";
2
- import { _ as c } from "./import-file-KkQTE8rh.js";
1
+ import { resolveComponent as e, createBlock as r, openBlock as t } from "vue";
2
+ import { _ as c } from "./import-file-DcMkaBsX.js";
3
3
  const n = {};
4
4
  function s(_, p, a, i, f, m) {
5
5
  const o = e("router-view");
6
- return r(), t(o);
6
+ return t(), r(o);
7
7
  }
8
8
  const l = /* @__PURE__ */ c(n, [["render", s]]);
9
9
  export {
@@ -0,0 +1,154 @@
1
+ import { _ as $, f as d, u as k, s as V } from "./import-file-DcMkaBsX.js";
2
+ import { resolveComponent as j, createElementBlock as g, openBlock as p, createElementVNode as m, createCommentVNode as b, normalizeClass as x, normalizeStyle as y, createBlock as E } from "vue";
3
+ const O = {
4
+ data() {
5
+ return {
6
+ formValues: {},
7
+ scheme: null,
8
+ table: "",
9
+ token: "",
10
+ style: null
11
+ };
12
+ },
13
+ mounted() {
14
+ this.getFormScheme();
15
+ },
16
+ computed: {
17
+ color() {
18
+ return V.value.buttonColor || "blue";
19
+ }
20
+ },
21
+ methods: {
22
+ flattenMenu(t) {
23
+ const e = [];
24
+ return t.forEach((n) => {
25
+ n.menu ? e.push(...this.flattenMenu(n.menu)) : e.push(n);
26
+ }), e;
27
+ },
28
+ async getFormScheme() {
29
+ var i, r;
30
+ const t = this.flattenMenu(k.value);
31
+ t != null && t.length || this.$router.replace("/404");
32
+ const e = t == null ? void 0 : t.find((s) => {
33
+ var a, o;
34
+ return (s == null ? void 0 : s.path) == ((o = (a = this.$route) == null ? void 0 : a.query) == null ? void 0 : o.table);
35
+ });
36
+ e || this.$router.replace("/404");
37
+ const n = e == null ? void 0 : e.table;
38
+ this.table = n;
39
+ try {
40
+ const {
41
+ data: { form: s }
42
+ } = await d.get(`/api/template/table/${n}`), { data: a } = await d.get(
43
+ `/api/table/${this.table}/${(r = (i = this.$route) == null ? void 0 : i.query) == null ? void 0 : r.id}`
44
+ );
45
+ this.token = (a == null ? void 0 : a.token) || "", this.formValues = a || {};
46
+ const { data: o } = await d.get(`/api/template/form/${s}`);
47
+ this.scheme = (o == null ? void 0 : o.schema) || o, this.style = (o == null ? void 0 : o.style) || null;
48
+ } catch {
49
+ }
50
+ },
51
+ async onlyEditObject() {
52
+ var e, n, i, r, s, a, o, u, l, c, f;
53
+ const t = (n = (e = this.$refs.form) == null ? void 0 : e.$refs) == null ? void 0 : n.form;
54
+ try {
55
+ await t.doValidation(), await d.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
56
+ title: "Успішно!",
57
+ message: "Об'єкт успішно створено",
58
+ type: "success"
59
+ });
60
+ } catch (h) {
61
+ const w = ((i = h == null ? void 0 : h.response) == null ? void 0 : i.data) || "";
62
+ let v = ((o = (a = (s = (r = Object.entries(t == null ? void 0 : t.formErrors)) == null ? void 0 : r[0]) == null ? void 0 : s[1]) == null ? void 0 : a[0]) == null ? void 0 : o.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (f = (c = (l = (u = Object.entries(t == null ? void 0 : t.formErrors)) == null ? void 0 : u[0]) == null ? void 0 : l[1]) == null ? void 0 : c[0]) == null ? void 0 : f.message;
63
+ this.$notify({
64
+ title: "Помилка!",
65
+ message: w || v || "Сталася помилка валідаціі",
66
+ type: "error"
67
+ });
68
+ }
69
+ },
70
+ getGroupedErrorNotification(t, e) {
71
+ if (!t || !e) return "";
72
+ const n = {};
73
+ return Object.entries(t).forEach(([r, s]) => {
74
+ var o;
75
+ const a = ((o = e[r]) == null ? void 0 : o.ua) || r;
76
+ s.forEach((u) => {
77
+ const l = u.message;
78
+ n[l] || (n[l] = []), n[l].push(`"${a}"`);
79
+ });
80
+ }), Object.entries(n).map(([r, s]) => `<b>${r}:</b> ${s.join(", ")}`).join("<br>") || "Сталася помилка валідації";
81
+ },
82
+ async editObjectAndRedirect(t = !0) {
83
+ var n, i;
84
+ const e = (i = (n = this.$refs.form) == null ? void 0 : n.$refs) == null ? void 0 : i.form;
85
+ try {
86
+ t && await e.doValidation(), await d.put(
87
+ `/api/table/${this.token}${t ? "" : "?draft=1"}`,
88
+ this.formValues
89
+ ), await this.$router.back(), await this.$notify({
90
+ title: "Успішно!",
91
+ message: "Об'єкт успішно створено",
92
+ type: "success"
93
+ });
94
+ } catch {
95
+ const s = this.getGroupedErrorNotification(
96
+ e == null ? void 0 : e.formErrors,
97
+ e == null ? void 0 : e.scheme
98
+ );
99
+ this.$notify({
100
+ title: "Помилка!",
101
+ message: s,
102
+ type: "error"
103
+ });
104
+ }
105
+ }
106
+ }
107
+ }, C = { class: "bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]" }, M = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, _ = { class: "flex items-center gap-[6px]" }, N = { class: "bg-white w-full rounded-xl" };
108
+ function A(t, e, n, i, r, s) {
109
+ var o, u, l;
110
+ const a = j("VsFormWithNavigation");
111
+ return p(), g("div", C, [
112
+ m("div", M, [
113
+ e[4] || (e[4] = m("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
114
+ m("div", _, [
115
+ m("button", {
116
+ onClick: e[0] || (e[0] = (c) => t.$router.back()),
117
+ class: "flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"
118
+ }, " Скасувати "),
119
+ (o = r.style) != null && o.draft ? (p(), g("button", {
120
+ key: 0,
121
+ onClick: e[1] || (e[1] = (c) => s.editObjectAndRedirect(!1)),
122
+ class: x(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${s.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${s.color}-800 hover:text-white`)
123
+ }, " Зберегти DRAFT ", 2)) : b("", !0),
124
+ m("button", {
125
+ onClick: e[2] || (e[2] = (...c) => s.editObjectAndRedirect && s.editObjectAndRedirect(...c)),
126
+ class: x(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${s.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${s.color}-800 hover:text-white`)
127
+ }, " Зберегти ", 2)
128
+ ])
129
+ ]),
130
+ m("div", {
131
+ style: y({
132
+ height: ((u = t.$adminSettings) == null ? void 0 : u.header) === !1 ? "calc(100vh - 91px)" : "calc(100vh - 150px)"
133
+ }),
134
+ class: "bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"
135
+ }, [
136
+ m("div", N, [
137
+ r.scheme ? (p(), E(a, {
138
+ key: 0,
139
+ ref: "form",
140
+ scheme: r.scheme,
141
+ columns: (l = r.style) == null ? void 0 : l.columns,
142
+ style: y(r.style),
143
+ modelValue: r.formValues,
144
+ "onUpdate:modelValue": e[3] || (e[3] = (c) => r.formValues = c),
145
+ class: "p-[20px] h-full"
146
+ }, null, 8, ["scheme", "columns", "style", "modelValue"])) : b("", !0)
147
+ ])
148
+ ], 4)
149
+ ]);
150
+ }
151
+ const B = /* @__PURE__ */ $(O, [["render", A]]);
152
+ export {
153
+ B as default
154
+ };