@opengis/admin 0.1.70 → 0.1.71

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,275 @@
1
+ import { g as V, h as z, _ as A, u as L, a as q } from "./import-file-DsHdUJ7C.js";
2
+ import { computed as B, resolveComponent as R, openBlock as r, createElementBlock as s, createElementVNode as u, toDisplayString as M, createVNode as N, withCtx as E, createTextVNode as S, createBlock as H, createCommentVNode as b, normalizeClass as j, Fragment as w, renderList as C, resolveDynamicComponent as T } from "vue";
3
+ const G = { class: "h-[76px] bg-white border rounded-xl flex items-center justify-between px-[20px] mb-[16px]" }, O = { class: "text-lg font-semibold md:text-xl text-stone-800 dark:text-neutral-200" }, F = { class: "flex items-center gap-[6px]" }, I = {
4
+ __name: "admin-card-header",
5
+ props: {
6
+ title: {
7
+ type: String
8
+ },
9
+ getRoute: {
10
+ type: String,
11
+ required: !0
12
+ }
13
+ },
14
+ setup(n) {
15
+ const c = n, a = V(), l = z(), t = () => {
16
+ a.back();
17
+ }, d = B(
18
+ () => {
19
+ var x;
20
+ return `/edit?table=${c.getRoute}&id=${(x = l == null ? void 0 : l.params) == null ? void 0 : x.id}`;
21
+ }
22
+ );
23
+ return (x, g) => {
24
+ const v = R("router-link");
25
+ return r(), s("div", G, [
26
+ u("div", null, [
27
+ u("button", {
28
+ onClick: t,
29
+ class: "text-sm h-[20px] text-blue-600 font-medium hover:border-b-2 hover:border-b-blue-500"
30
+ }, " До таблиці "),
31
+ u("h2", O, M(n.title), 1)
32
+ ]),
33
+ u("div", F, [
34
+ N(v, {
35
+ to: d.value,
36
+ 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"
37
+ }, {
38
+ default: E(() => g[0] || (g[0] = [
39
+ S(" Редагувати ")
40
+ ])),
41
+ _: 1
42
+ }, 8, ["to"])
43
+ ])
44
+ ]);
45
+ };
46
+ }
47
+ }, P = {
48
+ components: { AdminCardHeader: I },
49
+ data() {
50
+ return {
51
+ objectData: null,
52
+ component: ""
53
+ };
54
+ },
55
+ computed: {
56
+ getRoute() {
57
+ const n = this.flattenMenu(L.value);
58
+ n != null && n.length || this.$router.replace("/404");
59
+ const c = n == null ? void 0 : n.find((a) => {
60
+ var l, t;
61
+ return (a == null ? void 0 : a.table) == ((t = (l = this.$route) == null ? void 0 : l.params) == null ? void 0 : t.table);
62
+ });
63
+ return c || this.$router.replace("/404"), c == null ? void 0 : c.path;
64
+ },
65
+ getTitle() {
66
+ var n, c, a, l, t, d, x, g, v, e, i, D, o, k, _;
67
+ if ((a = (c = (n = this.objectData) == null ? void 0 : n.rows) == null ? void 0 : c[0]) != null && a.name)
68
+ return ((x = (d = (t = (l = this.objectData) == null ? void 0 : l.rows) == null ? void 0 : t[0]) == null ? void 0 : d.name) == null ? void 0 : x.length) < 35 ? (e = (v = (g = this.objectData) == null ? void 0 : g.rows) == null ? void 0 : v[0]) == null ? void 0 : e.name : ((k = (o = (D = (i = this.objectData) == null ? void 0 : i.rows) == null ? void 0 : D[0]) == null ? void 0 : o.name) == null ? void 0 : k.slice(0, 35)) + " ...";
69
+ {
70
+ const p = (_ = this.flattenMenu(L.value)) == null ? void 0 : _.find(
71
+ (h) => {
72
+ var f, y;
73
+ return (h == null ? void 0 : h.table) === ((y = (f = this.$route) == null ? void 0 : f.params) == null ? void 0 : y.table);
74
+ }
75
+ );
76
+ return p == null ? void 0 : p.ua;
77
+ }
78
+ }
79
+ },
80
+ async mounted() {
81
+ await this.getObjectData(), await this.checkActiveComponent();
82
+ },
83
+ watch: {
84
+ component(n) {
85
+ this.$router.replace({ ...this.$route, query: { tab: n } });
86
+ }
87
+ },
88
+ methods: {
89
+ async getObjectData() {
90
+ var a;
91
+ const { table: n, id: c } = (a = this.$route) == null ? void 0 : a.params;
92
+ (!n || !c) && this.$router.replace("/404");
93
+ try {
94
+ const { data: l } = await q.get(`/api/table-data/${n}/${c}`);
95
+ this.objectData = l;
96
+ } catch (l) {
97
+ console.error(l);
98
+ }
99
+ },
100
+ getColClass(n) {
101
+ return `col-span-${n || 12}`;
102
+ },
103
+ getGridClass() {
104
+ return "grid-cols-12";
105
+ },
106
+ checkActiveComponent() {
107
+ var n, c, a, l, t, d, x, g, v;
108
+ if ((c = (n = this.$route) == null ? void 0 : n.query) != null && c.tab)
109
+ this.component = (l = (a = this.$route) == null ? void 0 : a.query) == null ? void 0 : l.tab;
110
+ else {
111
+ const e = (d = (t = this.objectData) == null ? void 0 : t.panels) == null ? void 0 : d.find((i) => (i == null ? void 0 : i.type) === "tabs");
112
+ (x = e == null ? void 0 : e.items) != null && x.length && (this.component = ((g = e.items[0]) == null ? void 0 : g.component) || ((v = e.items[0]) == null ? void 0 : v.name));
113
+ }
114
+ },
115
+ flattenMenu(n) {
116
+ const c = [];
117
+ return n.forEach((a) => {
118
+ a.menu ? c.push(...this.flattenMenu(a.menu)) : c.push(a);
119
+ }), c;
120
+ }
121
+ }
122
+ }, $ = {
123
+ style: { width: "calc(100vw - 260px)", height: "calc(100vh - 60px)" },
124
+ class: "p-4 overflow-y-auto bg-gray-50"
125
+ }, J = {
126
+ key: 0,
127
+ class: "bg-white border rounded-xl"
128
+ }, K = { class: "p-[10px] pl-[20px] text-md font-[500]" }, Q = ["innerHTML"], U = { key: 1 }, W = { class: "p-[10px] pl-[20px] text-md font-[500]" }, X = {
129
+ key: 0,
130
+ class: "p-[20px] border-t"
131
+ }, Y = {
132
+ key: 1,
133
+ class: "p-[20px] border-t"
134
+ }, Z = ["innerHTML"], m = { class: "flex space-x-1 w-full bg-white border border-b-0 rounded-tr-xl rounded-tl-xl h-[60px] items-center pl-[20px]" }, oo = ["onClick"], eo = {
135
+ key: 0,
136
+ class: "bg-white border border-t-0 rounded-bl-xl rounded-br-xl"
137
+ }, to = {
138
+ key: 0,
139
+ class: "p-[20px] border-t"
140
+ }, ro = {
141
+ key: 1,
142
+ class: "p-[20px] border-t"
143
+ }, no = ["innerHTML"], so = {
144
+ key: 3,
145
+ class: "flex"
146
+ }, co = { class: "flex flex-col space-y-2 w-[200px] border rounded-xl mr-4 h-auto items-start pl-[10px] bg-white py-[20px]" }, ao = ["onClick"], lo = { class: "flex-grow" }, uo = {
147
+ key: 0,
148
+ class: "h-full bg-white border rounded-xl"
149
+ }, po = {
150
+ key: 0,
151
+ class: "p-[20px]"
152
+ }, ho = {
153
+ key: 1,
154
+ class: "p-[20px] border-t"
155
+ }, bo = ["innerHTML"];
156
+ function xo(n, c, a, l, t, d) {
157
+ var g, v;
158
+ const x = R("AdminCardHeader");
159
+ return r(), s("div", $, [
160
+ ((g = t.objectData) == null ? void 0 : g.isHeader) !== !1 ? (r(), H(x, {
161
+ key: 0,
162
+ title: d.getTitle,
163
+ "get-route": d.getRoute
164
+ }, null, 8, ["title", "get-route"])) : b("", !0),
165
+ u("div", {
166
+ class: j(["grid gap-[20px]", d.getGridClass()])
167
+ }, [
168
+ (r(!0), s(w, null, C((v = t.objectData) == null ? void 0 : v.panels, (e, i) => {
169
+ var D;
170
+ return r(), s("div", {
171
+ key: i,
172
+ class: j(d.getColClass(e.col))
173
+ }, [
174
+ e != null && e.name ? (r(), s("div", J, [
175
+ u("h2", K, M((e == null ? void 0 : e.title) || "Панель"), 1),
176
+ u("div", {
177
+ class: "p-[20px] border-t",
178
+ innerHTML: (D = t.objectData) == null ? void 0 : D.data[e == null ? void 0 : e.name]
179
+ }, null, 8, Q)
180
+ ])) : e.type === "container" ? (r(), s("div", U, [
181
+ (r(!0), s(w, null, C(e.items, (o, k) => {
182
+ var _, p, h, f, y;
183
+ return r(), s("div", {
184
+ key: k,
185
+ class: j([{ "mb-[20px]": e.items.length > 1 }, "border rounded-xl bg-white"])
186
+ }, [
187
+ u("h2", W, M((o == null ? void 0 : o.title) || "Панель"), 1),
188
+ o != null && o.component ? (r(), s("div", X, [
189
+ (r(), H(T(o.component), {
190
+ geometry: (p = (_ = t.objectData) == null ? void 0 : _.rows[0]) == null ? void 0 : p.geom,
191
+ zoom: 16,
192
+ id: (f = (h = n.$route) == null ? void 0 : h.params) == null ? void 0 : f.id
193
+ }, null, 8, ["geometry", "id"]))
194
+ ])) : b("", !0),
195
+ o != null && o.name ? (r(), s("div", Y, [
196
+ u("div", {
197
+ innerHTML: (y = t.objectData) == null ? void 0 : y.data[o == null ? void 0 : o.name]
198
+ }, null, 8, Z)
199
+ ])) : b("", !0)
200
+ ], 2);
201
+ }), 128))
202
+ ])) : b("", !0),
203
+ (e == null ? void 0 : e.type) === "tabs" ? (r(), s(w, { key: 2 }, [
204
+ u("nav", m, [
205
+ (r(!0), s(w, null, C(e == null ? void 0 : e.items, (o) => (r(), s("button", {
206
+ key: (o == null ? void 0 : o.name) || (o == null ? void 0 : o.component),
207
+ onClick: (k) => t.component = (o == null ? void 0 : o.component) || (o == null ? void 0 : o.name),
208
+ class: j(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:bg-gray-100 focus:bg-gray-100 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none", {
209
+ " font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800": t.component === (o == null ? void 0 : o.component) || t.component === (o == null ? void 0 : o.name),
210
+ "": t.component !== (o == null ? void 0 : o.component) && t.component !== (o == null ? void 0 : o.name)
211
+ }])
212
+ }, M(o == null ? void 0 : o.title), 11, oo))), 128))
213
+ ]),
214
+ (r(!0), s(w, null, C(e.items, (o, k) => {
215
+ var _, p, h, f, y;
216
+ return r(), s(w, { key: k }, [
217
+ t.component === (o == null ? void 0 : o.component) || t.component === (o == null ? void 0 : o.name) ? (r(), s("div", eo, [
218
+ o != null && o.component ? (r(), s("div", to, [
219
+ (r(), H(T(o.component), {
220
+ geometry: (p = (_ = t.objectData) == null ? void 0 : _.rows[0]) == null ? void 0 : p.geom,
221
+ zoom: 16,
222
+ id: (f = (h = n.$route) == null ? void 0 : h.params) == null ? void 0 : f.id
223
+ }, null, 8, ["geometry", "id"]))
224
+ ])) : b("", !0),
225
+ o != null && o.name ? (r(), s("div", ro, [
226
+ u("div", {
227
+ innerHTML: (y = t.objectData) == null ? void 0 : y.data[o == null ? void 0 : o.name]
228
+ }, null, 8, no)
229
+ ])) : b("", !0)
230
+ ])) : b("", !0)
231
+ ], 64);
232
+ }), 128))
233
+ ], 64)) : b("", !0),
234
+ (e == null ? void 0 : e.type) === "vertical_tabs" ? (r(), s("div", so, [
235
+ u("nav", co, [
236
+ (r(!0), s(w, null, C(e == null ? void 0 : e.items, (o) => (r(), s("button", {
237
+ key: (o == null ? void 0 : o.name) || (o == null ? void 0 : o.component),
238
+ onClick: (k) => t.component = (o == null ? void 0 : o.component) || (o == null ? void 0 : o.name),
239
+ class: j(["relative inline-flex items-center w-full py-1 text-sm border-transparent pe-4 gap-x-2 border-e-2 whitespace-nowrap hover:text-blue-600 focus:outline-none focus:text-blue-600", {
240
+ "font-semibold after:absolute after:top-[0] after:right-[-1px] after:h-full text-blue-600 after:w-[2px] after:bg-blue-600 ": t.component === (o == null ? void 0 : o.component) || t.component === (o == null ? void 0 : o.name),
241
+ "text-gray-500": t.component !== (o == null ? void 0 : o.component) && t.component !== (o == null ? void 0 : o.name)
242
+ }])
243
+ }, M(o == null ? void 0 : o.title), 11, ao))), 128))
244
+ ]),
245
+ u("div", lo, [
246
+ (r(!0), s(w, null, C(e.items, (o, k) => {
247
+ var _, p, h, f, y;
248
+ return r(), s(w, { key: k }, [
249
+ t.component === (o == null ? void 0 : o.component) || t.component === (o == null ? void 0 : o.name) ? (r(), s("div", uo, [
250
+ o != null && o.component ? (r(), s("div", po, [
251
+ (r(), H(T(o.component), {
252
+ geometry: (p = (_ = t.objectData) == null ? void 0 : _.rows[0]) == null ? void 0 : p.geom,
253
+ zoom: 16,
254
+ id: (f = (h = n.$route) == null ? void 0 : h.params) == null ? void 0 : f.id
255
+ }, null, 8, ["geometry", "id"]))
256
+ ])) : b("", !0),
257
+ o != null && o.name ? (r(), s("div", ho, [
258
+ u("div", {
259
+ innerHTML: (y = t.objectData) == null ? void 0 : y.data[o == null ? void 0 : o.name]
260
+ }, null, 8, bo)
261
+ ])) : b("", !0)
262
+ ])) : b("", !0)
263
+ ], 64);
264
+ }), 128))
265
+ ])
266
+ ])) : b("", !0)
267
+ ], 2);
268
+ }), 128))
269
+ ], 2)
270
+ ]);
271
+ }
272
+ const fo = /* @__PURE__ */ A(P, [["render", xo], ["__scopeId", "data-v-611b5b18"]]);
273
+ export {
274
+ fo as default
275
+ };
@@ -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-DgJqxKyF.js";
2
+ import { _ as c } from "./import-file-DsHdUJ7C.js";
3
3
  const n = {};
4
4
  function s(_, p, a, i, f, m) {
5
5
  const o = e("router-view");
@@ -0,0 +1,120 @@
1
+ import { _ as d, u as m, a as n } from "./import-file-DsHdUJ7C.js";
2
+ import { resolveComponent as b, openBlock as u, createElementBlock as h, createElementVNode as a, createBlock as f, createCommentVNode as p } from "vue";
3
+ const g = {
4
+ data() {
5
+ return {
6
+ formValues: {},
7
+ scheme: null,
8
+ table: "",
9
+ token: ""
10
+ };
11
+ },
12
+ mounted() {
13
+ this.getFormScheme();
14
+ },
15
+ methods: {
16
+ flattenMenu(t) {
17
+ const e = [];
18
+ return t.forEach((l) => {
19
+ l.menu ? e.push(...this.flattenMenu(l.menu)) : e.push(l);
20
+ }), e;
21
+ },
22
+ async getFormScheme() {
23
+ var c, i;
24
+ const t = this.flattenMenu(m.value);
25
+ t != null && t.length || this.$router.replace("/404");
26
+ const e = t == null ? void 0 : t.find((o) => {
27
+ var s, r;
28
+ return (o == null ? void 0 : o.path) == ((r = (s = this.$route) == null ? void 0 : s.query) == null ? void 0 : r.table);
29
+ });
30
+ e || this.$router.replace("/404");
31
+ const l = e == null ? void 0 : e.table;
32
+ this.table = l;
33
+ try {
34
+ const {
35
+ data: { form: o }
36
+ } = await n.get(`/api/template/table/${l}`), { data: s } = await n.get(
37
+ `/api/table/${this.table}/${(i = (c = this.$route) == null ? void 0 : c.query) == null ? void 0 : i.id}`
38
+ );
39
+ this.token = (s == null ? void 0 : s.token) || "", this.formValues = s || {};
40
+ const { data: r } = await n.get(`/api/template/form/${o}`);
41
+ this.scheme = (r == null ? void 0 : r.schema) || r;
42
+ } catch {
43
+ }
44
+ },
45
+ async onlyEditObject() {
46
+ try {
47
+ await this.$refs.form.doValidation(), await n.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
48
+ title: "Успішно!",
49
+ message: "Об'єкт успішно створено",
50
+ type: "success"
51
+ });
52
+ } catch {
53
+ this.$notify({
54
+ title: "Помилка!",
55
+ message: "Сталася помилка",
56
+ type: "error"
57
+ });
58
+ }
59
+ },
60
+ async editObjectAndRedirect() {
61
+ try {
62
+ await this.$refs.form.doValidation(), await n.put(`/api/table/${this.token}`, this.formValues), await this.$router.back(), await this.$notify({
63
+ title: "Успішно!",
64
+ message: "Об'єкт успішно створено",
65
+ type: "success"
66
+ });
67
+ } catch {
68
+ this.$notify({
69
+ title: "Помилка!",
70
+ message: "Сталася помилка",
71
+ type: "error"
72
+ });
73
+ }
74
+ }
75
+ }
76
+ }, x = {
77
+ style: { width: "calc(100vw - 260px)" },
78
+ class: "bg-gray-50"
79
+ }, y = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl" }, w = { class: "flex items-center gap-[6px]" }, k = {
80
+ style: { height: "calc(100vh - 155px)", width: "calc(100vw - 260px)" },
81
+ class: "bg-gray-50 p-[20px] flex"
82
+ }, v = { 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" };
83
+ function V(t, e, l, c, i, o) {
84
+ const s = b("VsForm");
85
+ return u(), h("div", x, [
86
+ a("div", y, [
87
+ e[4] || (e[4] = a("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
88
+ a("div", w, [
89
+ a("button", {
90
+ onClick: e[0] || (e[0] = (r) => t.$router.back()),
91
+ 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"
92
+ }, " Повернутися "),
93
+ a("button", {
94
+ onClick: e[1] || (e[1] = (...r) => o.onlyEditObject && o.onlyEditObject(...r)),
95
+ 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"
96
+ }, " Зберегти "),
97
+ a("button", {
98
+ onClick: e[2] || (e[2] = (...r) => o.editObjectAndRedirect && o.editObjectAndRedirect(...r)),
99
+ 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"
100
+ }, " Зберегти і повернутися ")
101
+ ])
102
+ ]),
103
+ a("div", k, [
104
+ a("div", v, [
105
+ i.scheme ? (u(), f(s, {
106
+ key: 0,
107
+ ref: "form",
108
+ scheme: i.scheme,
109
+ modelValue: i.formValues,
110
+ "onUpdate:modelValue": e[3] || (e[3] = (r) => i.formValues = r),
111
+ class: "p-0 mt-[20px]"
112
+ }, null, 8, ["scheme", "modelValue"])) : p("", !0)
113
+ ])
114
+ ])
115
+ ]);
116
+ }
117
+ const j = /* @__PURE__ */ d(g, [["render", V]]);
118
+ export {
119
+ j as default
120
+ };