@opengis/admin 0.1.100 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ import { openBlock as e, createElementBlock as t, createElementVNode as n } from "vue";
2
+ import { _ as r } from "./import-file-By5-gtTh.js";
3
+ const l = {}, s = {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ viewBox: "0 0 24 24",
6
+ fill: "none",
7
+ stroke: "currentColor",
8
+ "stroke-width": "2",
9
+ "stroke-linecap": "round",
10
+ "stroke-linejoin": "round",
11
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"
12
+ };
13
+ function c(i, o, a, p, d, u) {
14
+ return e(), t("svg", s, o[0] || (o[0] = [
15
+ n("path", {
16
+ stroke: "none",
17
+ d: "M0 0h24v24H0z",
18
+ fill: "none"
19
+ }, null, -1),
20
+ n("path", { d: "M6 9l6 6l6 -6" }, null, -1)
21
+ ]));
22
+ }
23
+ const m = /* @__PURE__ */ r(l, [["render", c]]);
24
+ export {
25
+ m as I
26
+ };
@@ -0,0 +1,105 @@
1
+ import { _ as g, u as f, c as u } from "./import-file-By5-gtTh.js";
2
+ import { resolveComponent as x, openBlock as d, createElementBlock as w, createElementVNode as n, createBlock as k, createCommentVNode as y } from "vue";
3
+ const v = {
4
+ data() {
5
+ return {
6
+ formValues: {},
7
+ scheme: null,
8
+ table: "",
9
+ token: "",
10
+ api: ""
11
+ };
12
+ },
13
+ mounted() {
14
+ this.getFormScheme();
15
+ },
16
+ methods: {
17
+ flattenMenu(t) {
18
+ const e = [];
19
+ return t.forEach((o) => {
20
+ o.menu ? e.push(...this.flattenMenu(o.menu)) : e.push(o);
21
+ }), e;
22
+ },
23
+ async getFormScheme() {
24
+ var i, a;
25
+ const t = this.flattenMenu(f.value);
26
+ t != null && t.length || this.$router.replace("/404");
27
+ const e = t == null ? void 0 : t.find((r) => {
28
+ var s, l;
29
+ return (r == null ? void 0 : r.path) == ((l = (s = this.$route) == null ? void 0 : s.query) == null ? void 0 : l.table);
30
+ });
31
+ e || this.$router.replace("/404");
32
+ const o = e == null ? void 0 : e.table;
33
+ this.table = o;
34
+ try {
35
+ const r = await u.get(`/api/table-data/${o}`), { data: s } = await u.get(
36
+ `/api/template/form/${(i = r == null ? void 0 : r.data) == null ? void 0 : i.form}`
37
+ );
38
+ this.scheme = (s == null ? void 0 : s.schema) || s, this.api = (s == null ? void 0 : s.api) || "", this.token = (a = r == null ? void 0 : r.data) == null ? void 0 : a.addToken;
39
+ } catch {
40
+ }
41
+ },
42
+ async createObject() {
43
+ var e, o, i, a, r, s, l, m, b;
44
+ const t = this.$refs.form;
45
+ try {
46
+ await t.doValidation(), await u.post(
47
+ this.api || `/api/table/${this.token}`,
48
+ this.formValues
49
+ ), await this.$router.back(), await this.$notify({
50
+ title: "Успішно!",
51
+ message: "Об'єкт успішно створено",
52
+ type: "success"
53
+ });
54
+ } catch (c) {
55
+ const h = ((e = c == null ? void 0 : c.response) == null ? void 0 : e.data) || "";
56
+ let p = ((r = (a = (i = (o = Object.entries(t == null ? void 0 : t.formErrors)) == null ? void 0 : o[0]) == null ? void 0 : i[1]) == null ? void 0 : a[0]) == null ? void 0 : r.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (b = (m = (l = (s = Object.entries(t == null ? void 0 : t.formErrors)) == null ? void 0 : s[0]) == null ? void 0 : l[1]) == null ? void 0 : m[0]) == null ? void 0 : b.message;
57
+ this.$notify({
58
+ title: "Помилка!",
59
+ message: h || p || "Сталася помилка валідаціі",
60
+ type: "error"
61
+ });
62
+ }
63
+ }
64
+ }
65
+ }, V = {
66
+ style: { width: "calc(100vw - 260px)" },
67
+ class: "bg-gray-50"
68
+ }, _ = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl" }, $ = { class: "flex items-center gap-[6px]" }, j = {
69
+ style: { height: "calc(100vh - 165px)", width: "calc(100vw - 260px)" },
70
+ class: "bg-gray-50 p-[20px] flex"
71
+ }, E = { class: "bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" };
72
+ function O(t, e, o, i, a, r) {
73
+ const s = x("VsForm");
74
+ return d(), w("div", V, [
75
+ n("div", _, [
76
+ e[3] || (e[3] = n("h2", { class: "text-xl font-medium" }, "Створити", -1)),
77
+ n("div", $, [
78
+ n("button", {
79
+ onClick: e[0] || (e[0] = (l) => t.$router.back()),
80
+ 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"
81
+ }, " Скасувати "),
82
+ n("button", {
83
+ onClick: e[1] || (e[1] = (...l) => r.createObject && r.createObject(...l)),
84
+ class: "inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"
85
+ }, " Зберегти ")
86
+ ])
87
+ ]),
88
+ n("div", j, [
89
+ n("div", E, [
90
+ a.scheme ? (d(), k(s, {
91
+ key: 0,
92
+ ref: "form",
93
+ scheme: a.scheme,
94
+ modelValue: a.formValues,
95
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => a.formValues = l),
96
+ class: "p-0 mt-[20px]"
97
+ }, null, 8, ["scheme", "modelValue"])) : y("", !0)
98
+ ])
99
+ ])
100
+ ]);
101
+ }
102
+ const M = /* @__PURE__ */ g(v, [["render", O]]);
103
+ export {
104
+ M as default
105
+ };