@opengis/admin 0.2.44 → 0.2.46

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-CjSMt4zv.js";
2
+ import { _ as c } from "./import-file-CUlcFEmy.js";
3
3
  const n = {};
4
4
  function s(_, p, a, i, f, m) {
5
5
  const o = e("router-view");
@@ -0,0 +1,125 @@
1
+ import { _ as g, u as f, d as b } from "./import-file-CUlcFEmy.js";
2
+ import { resolveComponent as y, openBlock as p, createElementBlock as x, createElementVNode as u, createBlock as w, normalizeStyle as k, createCommentVNode as v } from "vue";
3
+ const V = {
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((l) => {
20
+ l.menu ? t.push(...this.flattenMenu(l.menu)) : t.push(l);
21
+ }), t;
22
+ },
23
+ async getFormScheme() {
24
+ var i, r;
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((o) => {
28
+ var a, s;
29
+ return (o == null ? void 0 : o.path) == ((s = (a = this.$route) == null ? void 0 : a.query) == null ? void 0 : s.table);
30
+ });
31
+ t || this.$router.replace("/404");
32
+ const l = t == null ? void 0 : t.table;
33
+ this.table = l;
34
+ try {
35
+ const {
36
+ data: { form: o }
37
+ } = await b.get(`/api/template/table/${l}`), { data: a } = await b.get(
38
+ `/api/table/${this.table}/${(r = (i = this.$route) == null ? void 0 : i.query) == null ? void 0 : r.id}`
39
+ );
40
+ this.token = (a == null ? void 0 : a.token) || "", this.formValues = a || {};
41
+ const { data: s } = await b.get(`/api/template/form/${o}`);
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, l, i, r, o, a, s, n, m;
48
+ const e = this.$refs.form;
49
+ try {
50
+ await e.doValidation(), await b.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
51
+ title: "Успішно!",
52
+ message: "Об'єкт успішно створено",
53
+ type: "success"
54
+ });
55
+ } catch (c) {
56
+ const d = ((t = c == null ? void 0 : c.response) == null ? void 0 : t.data) || "";
57
+ let h = ((o = (r = (i = (l = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : l[0]) == null ? void 0 : i[1]) == null ? void 0 : r[0]) == null ? void 0 : o.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (m = (n = (s = (a = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : a[0]) == null ? void 0 : s[1]) == null ? void 0 : n[0]) == null ? void 0 : m.message;
58
+ this.$notify({
59
+ title: "Помилка!",
60
+ message: d || h || "Сталася помилка валідаціі",
61
+ type: "error"
62
+ });
63
+ }
64
+ },
65
+ async editObjectAndRedirect() {
66
+ var t, l, i, r, o, a, s, n, m;
67
+ const e = this.$refs.form;
68
+ try {
69
+ await e.doValidation(), await b.put(`/api/table/${this.token}`, this.formValues), await this.$router.back(), await this.$notify({
70
+ title: "Успішно!",
71
+ message: "Об'єкт успішно створено",
72
+ type: "success"
73
+ });
74
+ } catch (c) {
75
+ const d = ((t = c == null ? void 0 : c.response) == null ? void 0 : t.data) || "";
76
+ let h = ((o = (r = (i = (l = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : l[0]) == null ? void 0 : i[1]) == null ? void 0 : r[0]) == null ? void 0 : o.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (m = (n = (s = (a = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : a[0]) == null ? void 0 : s[1]) == null ? void 0 : n[0]) == null ? void 0 : m.message;
77
+ this.$notify({
78
+ title: "Помилка!",
79
+ message: d || h || "Сталася помилка валідаціі",
80
+ type: "error"
81
+ });
82
+ }
83
+ }
84
+ }
85
+ }, $ = { 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" }, E = { class: "flex items-center gap-[6px]" }, j = {
86
+ style: { height: "calc(100vh - 155px)" },
87
+ class: "bg-gray-50 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
88
+ }, 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" };
89
+ function C(e, t, l, i, r, o) {
90
+ var s;
91
+ const a = y("VsForm");
92
+ return p(), x("div", $, [
93
+ u("div", _, [
94
+ t[3] || (t[3] = u("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
95
+ u("div", E, [
96
+ u("button", {
97
+ onClick: t[0] || (t[0] = (n) => e.$router.back()),
98
+ 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"
99
+ }, " Скасувати "),
100
+ u("button", {
101
+ onClick: t[1] || (t[1] = (...n) => o.editObjectAndRedirect && o.editObjectAndRedirect(...n)),
102
+ 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"
103
+ }, " Зберегти ")
104
+ ])
105
+ ]),
106
+ u("div", j, [
107
+ u("div", O, [
108
+ r.scheme ? (p(), w(a, {
109
+ key: 0,
110
+ ref: "form",
111
+ scheme: r.scheme,
112
+ columns: (s = r.style) == null ? void 0 : s.columns,
113
+ style: k(r.style),
114
+ modelValue: r.formValues,
115
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r.formValues = n),
116
+ class: "p-0 mt-[20px]"
117
+ }, null, 8, ["scheme", "columns", "style", "modelValue"])) : v("", !0)
118
+ ])
119
+ ])
120
+ ]);
121
+ }
122
+ const A = /* @__PURE__ */ g(V, [["render", C]]);
123
+ export {
124
+ A as default
125
+ };
@@ -3588,16 +3588,16 @@ function rD(n) {
3588
3588
  }
3589
3589
  const sD = [
3590
3590
  // { name: 'profile', path: '/profile', component: () => import('../components/profile/vs-profile.vue') },
3591
- { name: "edit", path: "/edit", component: () => import("./edit-page-CSEzk0Pj.js") },
3592
- { name: "add", path: "/add", component: () => import("./add-page-CWDoV9kc.js") },
3591
+ { name: "edit", path: "/edit", component: () => import("./edit-page--kj1FQ6l.js") },
3592
+ { name: "add", path: "/add", component: () => import("./add-page-CcNhrDGH.js") },
3593
3593
  {
3594
3594
  name: "card-view",
3595
3595
  path: "/card",
3596
- component: () => import("./card-view-CCxJ3jfb.js"),
3596
+ component: () => import("./card-view-D1HjQpVr.js"),
3597
3597
  children: [{
3598
3598
  name: "table",
3599
3599
  path: ":table",
3600
- component: () => import("./card-view-CCxJ3jfb.js"),
3600
+ component: () => import("./card-view-D1HjQpVr.js"),
3601
3601
  children: [{ name: "card", path: ":id", component: () => Promise.resolve().then(() => u7) }]
3602
3602
  }]
3603
3603
  }
@@ -3651,14 +3651,14 @@ const uD = /* @__PURE__ */ Tt(oD, [["render", cD]]), hD = (n) => {
3651
3651
  {
3652
3652
  path: "/",
3653
3653
  name: "home",
3654
- component: () => import("./admin-view-DJz2GCsB.js"),
3654
+ component: () => import("./admin-view-DpINSe0A.js"),
3655
3655
  children: [
3656
3656
  ...e,
3657
3657
  ...n,
3658
3658
  // { path: '/', redirect: '/home' },
3659
3659
  {
3660
3660
  path: "/:catchAll(.*)",
3661
- component: () => import("./admin-interface-KnUgFCOB.js")
3661
+ component: () => import("./admin-interface-C8C0aWgF.js")
3662
3662
  }
3663
3663
  ]
3664
3664
  }
@@ -6703,7 +6703,7 @@ function QL(n, e, t, i, r, l) {
6703
6703
  return t.edit ? (ce(), un(u, {
6704
6704
  key: 0,
6705
6705
  "model-value": ((a = t.data) == null ? void 0 : a[t.name]) || null,
6706
- component: "vs-datepicker",
6706
+ component: "vs-form-calendar",
6707
6707
  onUpdateValue: l.changeData
6708
6708
  }, {
6709
6709
  default: En(() => [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/admin",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -44,7 +44,7 @@
44
44
  "@opengis/fastify-auth": "^1.0.51",
45
45
  "@opengis/fastify-file": "^1.0.30",
46
46
  "@opengis/fastify-table": "^1.1.123",
47
- "@opengis/v3-core": "^0.3.9",
47
+ "@opengis/v3-core": "^0.3.13",
48
48
  "@opengis/v3-filter": "^0.0.41",
49
49
  "@tiptap/core": "^2.8.0",
50
50
  "@tiptap/extension-color": "^2.8.0",
@@ -10,10 +10,11 @@ import { tableDataSchema, tableDataIdSchema, tableFilterSchema, cardTabDataSchem
10
10
  import tableInfo from "./controllers/tableInfo.js";
11
11
 
12
12
  export default async function route(fastify) {
13
- fastify.get(`/token-info/:token`, tokenInfo);
14
- fastify.get(`/table-data/:table`, { schema: tableDataSchema }, tableData);
15
- fastify.get(`/card-data/:token`, { scheme: cardTabDataSchema }, cardTabData);
16
- fastify.get(`/table-data/:table/:id`, { schema: tableDataIdSchema }, cardData);
17
- fastify.get(`/table-filter/:name`, { config: { policy: ['public'] }, schema: tableFilterSchema }, tableFilter);
18
- fastify.get(`/table-info/:table/:id?`, { config: { policy: ['site'] }, schema: tableDataSchema }, tableInfo);
13
+ const policy = ['public'];
14
+ fastify.get(`/token-info/:token`, { config: { policy: ['admin'] } }, tokenInfo);
15
+ fastify.get(`/table-data/:table`, { config: { policy }, schema: tableDataSchema }, tableData);
16
+ fastify.get(`/card-data/:token`, { config: { policy }, scheme: cardTabDataSchema }, cardTabData);
17
+ fastify.get(`/table-data/:table/:id`, { config: { policy }, schema: tableDataIdSchema }, cardData);
18
+ fastify.get(`/table-filter/:name`, { config: { policy }, schema: tableFilterSchema }, tableFilter);
19
+ fastify.get(`/table-info/:table/:id?`, { config: { policy }, schema: tableDataSchema }, tableInfo);
19
20
  }
@@ -4,7 +4,7 @@ import getTemplateSchema from './schema.js'
4
4
 
5
5
  export default async function route(fastify) {
6
6
  //fastify.decorate('addTempateFolder', addTempateFolder); // call from funcs
7
- fastify.get(`/template/:type/:name`, { scheme: getTemplateSchema }, getTemplateApi);
7
+ fastify.get(`/template/:type/:name`, { config: { policy: ['public'] }, scheme: getTemplateSchema }, getTemplateApi);
8
8
 
9
9
  /*fastify.addHook('onListen', async () => {
10
10
  await addTempateFolder(path.join(process.cwd(), '/module/itree'));
@@ -1,121 +0,0 @@
1
- import { _ as g, u as f, d } from "./import-file-CjSMt4zv.js";
2
- import { resolveComponent as x, openBlock as p, createElementBlock as w, createElementVNode as c, createBlock as y, createCommentVNode as k } from "vue";
3
- const v = {
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(e) {
17
- const t = [];
18
- return e.forEach((a) => {
19
- a.menu ? t.push(...this.flattenMenu(a.menu)) : t.push(a);
20
- }), t;
21
- },
22
- async getFormScheme() {
23
- var n, l;
24
- const e = this.flattenMenu(f.value);
25
- e != null && e.length || this.$router.replace("/404");
26
- const t = e == null ? void 0 : e.find((r) => {
27
- var o, s;
28
- return (r == null ? void 0 : r.path) == ((s = (o = this.$route) == null ? void 0 : o.query) == null ? void 0 : s.table);
29
- });
30
- t || this.$router.replace("/404");
31
- const a = t == null ? void 0 : t.table;
32
- this.table = a;
33
- try {
34
- const {
35
- data: { form: r }
36
- } = await d.get(`/api/template/table/${a}`), { data: o } = await d.get(
37
- `/api/table/${this.table}/${(l = (n = this.$route) == null ? void 0 : n.query) == null ? void 0 : l.id}`
38
- );
39
- this.token = (o == null ? void 0 : o.token) || "", this.formValues = o || {};
40
- const { data: s } = await d.get(`/api/template/form/${r}`);
41
- this.scheme = (s == null ? void 0 : s.schema) || s;
42
- } catch {
43
- }
44
- },
45
- async onlyEditObject() {
46
- var t, a, n, l, r, o, s, u, m;
47
- const e = this.$refs.form;
48
- try {
49
- await e.doValidation(), await d.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
50
- title: "Успішно!",
51
- message: "Об'єкт успішно створено",
52
- type: "success"
53
- });
54
- } catch (i) {
55
- const b = ((t = i == null ? void 0 : i.response) == null ? void 0 : t.data) || "";
56
- let h = ((r = (l = (n = (a = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : a[0]) == null ? void 0 : n[1]) == null ? void 0 : l[0]) == null ? void 0 : r.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (m = (u = (s = (o = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : o[0]) == null ? void 0 : s[1]) == null ? void 0 : u[0]) == null ? void 0 : m.message;
57
- this.$notify({
58
- title: "Помилка!",
59
- message: b || h || "Сталася помилка валідаціі",
60
- type: "error"
61
- });
62
- }
63
- },
64
- async editObjectAndRedirect() {
65
- var t, a, n, l, r, o, s, u, m;
66
- const e = this.$refs.form;
67
- try {
68
- await e.doValidation(), await d.put(`/api/table/${this.token}`, this.formValues), await this.$router.back(), await this.$notify({
69
- title: "Успішно!",
70
- message: "Об'єкт успішно створено",
71
- type: "success"
72
- });
73
- } catch (i) {
74
- const b = ((t = i == null ? void 0 : i.response) == null ? void 0 : t.data) || "";
75
- let h = ((r = (l = (n = (a = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : a[0]) == null ? void 0 : n[1]) == null ? void 0 : l[0]) == null ? void 0 : r.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (m = (u = (s = (o = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : o[0]) == null ? void 0 : s[1]) == null ? void 0 : u[0]) == null ? void 0 : m.message;
76
- this.$notify({
77
- title: "Помилка!",
78
- message: b || h || "Сталася помилка валідаціі",
79
- type: "error"
80
- });
81
- }
82
- }
83
- }
84
- }, $ = { class: "bg-gray-50 lg:w-[calc(100vw-260px)] w-[100vw]" }, V = { 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]" }, E = {
85
- style: { height: "calc(100vh - 155px)" },
86
- class: "bg-gray-50 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
87
- }, j = { 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" };
88
- function O(e, t, a, n, l, r) {
89
- const o = x("VsForm");
90
- return p(), w("div", $, [
91
- c("div", V, [
92
- t[3] || (t[3] = c("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
93
- c("div", _, [
94
- c("button", {
95
- onClick: t[0] || (t[0] = (s) => e.$router.back()),
96
- 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"
97
- }, " Скасувати "),
98
- c("button", {
99
- onClick: t[1] || (t[1] = (...s) => r.editObjectAndRedirect && r.editObjectAndRedirect(...s)),
100
- 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"
101
- }, " Зберегти ")
102
- ])
103
- ]),
104
- c("div", E, [
105
- c("div", j, [
106
- l.scheme ? (p(), y(o, {
107
- key: 0,
108
- ref: "form",
109
- scheme: l.scheme,
110
- modelValue: l.formValues,
111
- "onUpdate:modelValue": t[2] || (t[2] = (s) => l.formValues = s),
112
- class: "p-0 mt-[20px]"
113
- }, null, 8, ["scheme", "modelValue"])) : k("", !0)
114
- ])
115
- ])
116
- ]);
117
- }
118
- const M = /* @__PURE__ */ g(v, [["render", O]]);
119
- export {
120
- M as default
121
- };