@opengis/admin 0.2.99 → 0.2.101

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.
@@ -1,5 +1,5 @@
1
1
  import { resolveComponent as e, openBlock as r, createBlock as t } from "vue";
2
- import { _ as c } from "./import-file-DGpixqr_.js";
2
+ import { _ as c } from "./import-file-CIA2eGIc.js";
3
3
  const n = {};
4
4
  function s(_, p, a, i, f, m) {
5
5
  const o = e("router-view");
@@ -0,0 +1,138 @@
1
+ import { _ as g, u as f, e as m } from "./import-file-CIA2eGIc.js";
2
+ import { resolveComponent as y, openBlock as h, createElementBlock as x, createElementVNode as c, createBlock as w, normalizeStyle as k, createCommentVNode as v } from "vue";
3
+ const $ = {
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
+ methods: {
17
+ flattenMenu(e) {
18
+ const t = [];
19
+ return e.forEach((r) => {
20
+ r.menu ? t.push(...this.flattenMenu(r.menu)) : t.push(r);
21
+ }), t;
22
+ },
23
+ async getFormScheme() {
24
+ var i, o;
25
+ const e = this.flattenMenu(f.value);
26
+ e != null && e.length || this.$router.replace("/404");
27
+ const t = e == null ? void 0 : e.find((a) => {
28
+ var n, s;
29
+ return (a == null ? void 0 : a.path) == ((s = (n = this.$route) == null ? void 0 : n.query) == null ? void 0 : s.table);
30
+ });
31
+ t || this.$router.replace("/404");
32
+ const r = t == null ? void 0 : t.table;
33
+ this.table = r;
34
+ try {
35
+ const {
36
+ data: { form: a }
37
+ } = await m.get(`/api/template/table/${r}`), { data: n } = await m.get(
38
+ `/api/table/${this.table}/${(o = (i = this.$route) == null ? void 0 : i.query) == null ? void 0 : o.id}`
39
+ );
40
+ this.token = (n == null ? void 0 : n.token) || "", this.formValues = n || {};
41
+ const { data: s } = await m.get(`/api/template/form/${a}`);
42
+ this.scheme = (s == null ? void 0 : s.schema) || s, this.style = (s == null ? void 0 : s.style) || null;
43
+ } catch {
44
+ }
45
+ },
46
+ async onlyEditObject() {
47
+ var t, r, i, o, a, n, s, l, u;
48
+ const e = this.$refs.form;
49
+ try {
50
+ await e.doValidation(), await m.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
51
+ title: "Успішно!",
52
+ message: "Об'єкт успішно створено",
53
+ type: "success"
54
+ });
55
+ } catch (b) {
56
+ const d = ((t = b == null ? void 0 : b.response) == null ? void 0 : t.data) || "";
57
+ let p = ((a = (o = (i = (r = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : r[0]) == null ? void 0 : i[1]) == null ? void 0 : o[0]) == null ? void 0 : a.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (u = (l = (s = (n = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : n[0]) == null ? void 0 : s[1]) == null ? void 0 : l[0]) == null ? void 0 : u.message;
58
+ this.$notify({
59
+ title: "Помилка!",
60
+ message: d || p || "Сталася помилка валідаціі",
61
+ type: "error"
62
+ });
63
+ }
64
+ },
65
+ getGroupedErrorNotification(e, t) {
66
+ if (!e || !t) return "";
67
+ const r = {};
68
+ return Object.entries(e).forEach(([o, a]) => {
69
+ var s;
70
+ const n = ((s = t[o]) == null ? void 0 : s.ua) || o;
71
+ a.forEach((l) => {
72
+ const u = l.message;
73
+ r[u] || (r[u] = []), r[u].push(`"${n}"`);
74
+ });
75
+ }), Object.entries(r).map(([o, a]) => `<b>${o}:</b> ${a.join(", ")}`).join("<br>") || "Сталася помилка валідації";
76
+ },
77
+ async editObjectAndRedirect() {
78
+ const e = this.$refs.form;
79
+ try {
80
+ await e.doValidation(), await m.put(`/api/table/${this.token}`, this.formValues), await this.$router.back(), await this.$notify({
81
+ title: "Успішно!",
82
+ message: "Об'єкт успішно створено",
83
+ type: "success"
84
+ });
85
+ } catch {
86
+ const r = this.getGroupedErrorNotification(
87
+ e == null ? void 0 : e.formErrors,
88
+ e == null ? void 0 : e.scheme
89
+ );
90
+ this.$notify({
91
+ title: "Помилка!",
92
+ message: r,
93
+ type: "error"
94
+ });
95
+ }
96
+ }
97
+ }
98
+ }, V = { class: "bg-gray-50 lg:w-[calc(100vw-260px)] w-[100vw]" }, _ = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl" }, j = { class: "flex items-center gap-[6px]" }, E = {
99
+ style: { height: "calc(100vh - 155px)" },
100
+ class: "bg-gray-50 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
101
+ }, O = { 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" };
102
+ function M(e, t, r, i, o, a) {
103
+ var s;
104
+ const n = y("VsForm");
105
+ return h(), x("div", V, [
106
+ c("div", _, [
107
+ t[3] || (t[3] = c("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
108
+ c("div", j, [
109
+ c("button", {
110
+ onClick: t[0] || (t[0] = (l) => e.$router.back()),
111
+ 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"
112
+ }, " Скасувати "),
113
+ c("button", {
114
+ onClick: t[1] || (t[1] = (...l) => a.editObjectAndRedirect && a.editObjectAndRedirect(...l)),
115
+ 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"
116
+ }, " Зберегти ")
117
+ ])
118
+ ]),
119
+ c("div", E, [
120
+ c("div", O, [
121
+ o.scheme ? (h(), w(n, {
122
+ key: 0,
123
+ ref: "form",
124
+ scheme: o.scheme,
125
+ columns: (s = o.style) == null ? void 0 : s.columns,
126
+ style: k(o.style),
127
+ modelValue: o.formValues,
128
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => o.formValues = l),
129
+ class: "p-0 mt-[20px]"
130
+ }, null, 8, ["scheme", "columns", "style", "modelValue"])) : v("", !0)
131
+ ])
132
+ ])
133
+ ]);
134
+ }
135
+ const N = /* @__PURE__ */ g($, [["render", M]]);
136
+ export {
137
+ N as default
138
+ };
@@ -3694,16 +3694,16 @@ function PB(t) {
3694
3694
  }
3695
3695
  const RB = [
3696
3696
  // { name: 'profile', path: '/profile', component: () => import('../components/profile/vs-profile.vue') },
3697
- { name: "edit", path: "/edit", component: () => import("./edit-page-CSJOoVP1.js") },
3698
- { name: "add", path: "/add", component: () => import("./add-page-_B2Mt84e.js") },
3697
+ { name: "edit", path: "/edit", component: () => import("./edit-page-COqubwSc.js") },
3698
+ { name: "add", path: "/add", component: () => import("./add-page-CIxr0QVt.js") },
3699
3699
  {
3700
3700
  name: "card-view",
3701
3701
  path: "/card",
3702
- component: () => import("./card-view-CJw5lupT.js"),
3702
+ component: () => import("./card-view-BXGlPipy.js"),
3703
3703
  children: [{
3704
3704
  name: "table",
3705
3705
  path: ":table",
3706
- component: () => import("./card-view-CJw5lupT.js"),
3706
+ component: () => import("./card-view-BXGlPipy.js"),
3707
3707
  children: [{ name: "card", path: ":id", component: () => Promise.resolve().then(() => voe) }]
3708
3708
  }]
3709
3709
  }
@@ -3757,14 +3757,14 @@ const BB = /* @__PURE__ */ ut(OB, [["render", NB]]), FB = (t) => {
3757
3757
  {
3758
3758
  path: "/",
3759
3759
  name: "home",
3760
- component: () => import("./admin-view-B1AlUdTq.js"),
3760
+ component: () => import("./admin-view-hNFc7Wm7.js"),
3761
3761
  children: [
3762
3762
  ...e,
3763
3763
  ...t,
3764
3764
  // { path: '/', redirect: '/home' },
3765
3765
  {
3766
3766
  path: "/:catchAll(.*)",
3767
- component: () => import("./admin-interface-NcFPI355.js")
3767
+ component: () => import("./admin-interface-DohUSsAx.js")
3768
3768
  }
3769
3769
  ]
3770
3770
  }