@opengis/admin 0.3.69 → 0.3.71

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.
Files changed (115) hide show
  1. package/README.md +97 -97
  2. package/config.js +4 -4
  3. package/dist/add-page-Ce8CyfEs.js +126 -0
  4. package/dist/{admin-interface-B5Qi_7Tg.js → admin-interface-pbcmGMWh.js} +13 -13
  5. package/dist/{admin-view-D9N7IOYE.js → admin-view-_a-D8Ku7.js} +6 -6
  6. package/dist/admin.js +1 -1
  7. package/dist/admin.umd.cjs +103 -103
  8. package/dist/assets/logo.svg +41 -41
  9. package/dist/{card-view-BJr6noRt.js → card-view-7dYWB91p.js} +3 -3
  10. package/dist/edit-page-CA3TA9va.js +154 -0
  11. package/dist/{import-file-Ch8huzhb.js → import-file-DCoMW-85.js} +18179 -18301
  12. package/dist/{profile-page-B0oQUepx.js → profile-page-KnFXr9D6.js} +4 -4
  13. package/dist/style.css +1 -1
  14. package/module/settings/card/admin.accounts.table/index.yml +7 -7
  15. package/module/settings/card/admin.accounts.table/rules.hbs +18 -18
  16. package/module/settings/card/admin.accounts.table/users.hbs +13 -13
  17. package/module/settings/card/admin.routes.table/groups.hbs +11 -11
  18. package/module/settings/card/admin.routes.table/users.hbs +16 -16
  19. package/module/settings/cls/core.actions.json +17 -17
  20. package/module/settings/cls/core.scope.json +13 -13
  21. package/module/settings/cls/properties.site_status.json +13 -13
  22. package/module/settings/cls/properties.widget_status.json +13 -13
  23. package/module/settings/cls/yes_no.json +11 -11
  24. package/module/settings/form/admin.accounts.form.json +13 -13
  25. package/module/settings/form/admin.properties.form.json +15 -15
  26. package/module/settings/form/admin.roles.form.json +21 -21
  27. package/module/settings/form/admin.user_properties.form.json +15 -15
  28. package/module/settings/form/admin.user_roles_card.form.json +13 -13
  29. package/module/settings/interface/admin.properties.json +4 -4
  30. package/module/settings/interface/admin.roles.json +4 -4
  31. package/module/settings/interface/admin.routes.json +4 -4
  32. package/module/settings/interface/admin.users.json +4 -4
  33. package/module/settings/select/core.routes.sql +1 -1
  34. package/module/settings/select/core.user_mentioned.sql +1 -1
  35. package/module/settings/select/core.user_uid.sql +1 -1
  36. package/module/settings/table/admin.properties.table.json +39 -39
  37. package/module/settings/table/admin.user_properties.table.json +34 -34
  38. package/package.json +3 -3
  39. package/server/helpers/core/badge.js +16 -16
  40. package/server/helpers/core/buttonHelper.js +21 -21
  41. package/server/helpers/core/coalesce.js +7 -7
  42. package/server/helpers/core/select.js +48 -48
  43. package/server/helpers/core/token.js +18 -18
  44. package/server/helpers/list/buttonHelper.js +21 -21
  45. package/server/helpers/list/utils/button.js +5 -5
  46. package/server/helpers/temp/contentList.js +58 -58
  47. package/server/helpers/temp/ifCond.js +101 -101
  48. package/server/helpers/utils/button.js +5 -5
  49. package/server/helpers/utils/mdToHTML.js +17 -17
  50. package/server/plugins/access/index.mjs +6 -6
  51. package/server/plugins/adminHook.js +81 -81
  52. package/server/plugins/cron.js +10 -10
  53. package/server/plugins/docs.js +28 -28
  54. package/server/routes/access/controllers/access.group.js +29 -29
  55. package/server/routes/access/controllers/access.group.post.js +54 -54
  56. package/server/routes/access/index.mjs +11 -11
  57. package/server/routes/access/schema.mjs +67 -67
  58. package/server/routes/calendar/controllers/calendar.data.js +125 -125
  59. package/server/routes/calendar/index.mjs +7 -7
  60. package/server/routes/calendar/schema.js +21 -21
  61. package/server/routes/data/controllers/cardTabData.js +49 -49
  62. package/server/routes/data/controllers/funcs/getFilterSQL/index.js +92 -92
  63. package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +170 -170
  64. package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  65. package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +64 -64
  66. package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  67. package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
  68. package/server/routes/data/controllers/tableDataId.js +27 -27
  69. package/server/routes/data/controllers/tokenInfo.js +9 -9
  70. package/server/routes/data/controllers/utils/assignTokens.js +30 -30
  71. package/server/routes/data/controllers/utils/conditions.js +20 -20
  72. package/server/routes/data/controllers/utils/getColumns.js +8 -8
  73. package/server/routes/data/index.mjs +20 -20
  74. package/server/routes/data/schema.js +54 -54
  75. package/server/routes/notifications/controllers/readNotifications.js +18 -18
  76. package/server/routes/notifications/controllers/testEmail.js +35 -35
  77. package/server/routes/notifications/controllers/userNotifications.js +53 -53
  78. package/server/routes/notifications/hook/onWidgetSet.js +56 -56
  79. package/server/routes/notifications/index.mjs +26 -26
  80. package/server/routes/notifications/schema.js +16 -16
  81. package/server/routes/print/controllers/cardPrint.js +135 -135
  82. package/server/routes/properties/schema.js +10 -10
  83. package/server/routes/report/controllers/data.js +76 -76
  84. package/server/routes/report/controllers/list.js +18 -18
  85. package/server/routes/report/index.mjs +7 -7
  86. package/server/routes/report/utils/formatValue.js +179 -179
  87. package/server/routes/root.mjs +3 -3
  88. package/server/routes/templates/controllers/getTemplate.js +44 -44
  89. package/server/routes/templates/schema.js +8 -8
  90. package/server/routes/user/controllers/user.cls.id.js +14 -14
  91. package/server/routes/user/controllers/user.cls.js +72 -72
  92. package/server/routes/user/controllers/user.info.js +17 -17
  93. package/server/routes/user/schema.js +14 -14
  94. package/server/routes/util/controllers/code.generator.js +89 -89
  95. package/server/routes/widget/controllers/widget.del.js +80 -80
  96. package/server/routes/widget/controllers/widget.set.js +101 -101
  97. package/server/routes/widget/hook/onWidgetSet.js +12 -12
  98. package/server/routes/widget/index.mjs +20 -20
  99. package/server/routes/widget/schema.js +12 -12
  100. package/server/templates/cls/itree.recrzone_category.json +73 -73
  101. package/server/templates/cls/test.json +9 -9
  102. package/server/templates/form/admin.user_cls.data.form.json +49 -49
  103. package/server/templates/form/admin.user_group_rel.form.json +21 -21
  104. package/server/templates/form/form-user-pass.json +10 -10
  105. package/server/templates/form/form-user_group.json +39 -39
  106. package/server/templates/form/form-users.json +156 -156
  107. package/server/templates/form/user_group_access.form.json +22 -22
  108. package/server/templates/select/account_id.json +2 -2
  109. package/server/templates/table/gis.dataset.table.json +43 -43
  110. package/server/templates/table/management.user_group.table.json +112 -112
  111. package/server/templates/table/management.users.table.json +126 -126
  112. package/server/utils/addNotification.js +21 -21
  113. package/server/utils/sendNotification.js +89 -89
  114. package/dist/add-page-CgHg3dNM.js +0 -127
  115. package/dist/edit-page-BPbIUzpb.js +0 -145
@@ -1,89 +1,89 @@
1
- import { handlebars, pgClients, getTemplate, getRedis, logger } from '@opengis/fastify-table/utils.js';
2
-
3
- import sendEmail from './sendEmail.js';
4
-
5
- // eslint-disable-next-line max-len, no-control-regex
6
- const emailReg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
7
-
8
- const rclient = getRedis();
9
-
10
- async function generateNotificationContent({
11
- pg, table, template, id, message, data: data1,
12
- }) {
13
- if (template) {
14
- const data = table && id ? await pg.one(`select * from ${table} where ${pg.pk[table]}=$1`, [id]) : data1;
15
- // console.log(data);
16
- const body = await getTemplate('pt', template);
17
- // console.log(body);
18
- const html = handlebars.compile(body || template || 'template not found')(data || {});
19
- // console.log(html);
20
- return html;
21
- }
22
- return message;
23
- }
24
-
25
- // to do: refactor fastify-file to remove funcs completely
26
- export default async function notification({
27
- pg = pgClients.client,
28
- provider = ['email'],
29
- from,
30
- to,
31
- template,
32
- table,
33
- message,
34
- title,
35
- file,
36
- data,
37
- id,
38
- nocache,
39
- }) {
40
- if (pg?.readonly) {
41
- return null;
42
- }
43
-
44
- const keyTo = `${pg.options?.database}:mail:${provider[0]}:${to || ''}${id || ''}${table || ''}${title || ''}`;
45
- const uniqueTo = await rclient.setnx(keyTo, 1);
46
-
47
- if (!uniqueTo && !nocache) {
48
- logger.file('notification/sent', { keyTo, send: uniqueTo, nocache });
49
- return `already sent: ${keyTo}`;
50
- }
51
- await rclient.expire(keyTo, 1000 * 600);
52
-
53
- if (!to.length) {
54
- return null;
55
- }
56
-
57
- if (!(Array.isArray(provider) && provider.length)) {
58
- return 'notification provider - must be array and not empty';
59
- }
60
-
61
- const html = await generateNotificationContent({
62
- pg, table, template, id, message, data,
63
- });
64
-
65
- if (provider.includes('email')) {
66
- const files = Array.isArray(file) ? file : [file];
67
- const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
68
- /* const content = await downloadFile(el, { buffer: true }); // ?
69
- return {
70
- filename: el.split('/').pop(),
71
- encoding: 'base64',
72
- content,
73
- }; */
74
- })) : [];
75
-
76
- const toEmail = Array.isArray(to) ? to.map((emails) => emails.match(emailReg)?.join(',')) : to;
77
-
78
- const result = await sendEmail({
79
- attachments,
80
- html,
81
- subject: title,
82
- from,
83
- to: toEmail,
84
- });
85
-
86
- return result;
87
- }
88
- return null;
89
- }
1
+ import { handlebars, pgClients, getTemplate, getRedis, logger } from '@opengis/fastify-table/utils.js';
2
+
3
+ import sendEmail from './sendEmail.js';
4
+
5
+ // eslint-disable-next-line max-len, no-control-regex
6
+ const emailReg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
7
+
8
+ const rclient = getRedis();
9
+
10
+ async function generateNotificationContent({
11
+ pg, table, template, id, message, data: data1,
12
+ }) {
13
+ if (template) {
14
+ const data = table && id ? await pg.one(`select * from ${table} where ${pg.pk[table]}=$1`, [id]) : data1;
15
+ // console.log(data);
16
+ const body = await getTemplate('pt', template);
17
+ // console.log(body);
18
+ const html = handlebars.compile(body || template || 'template not found')(data || {});
19
+ // console.log(html);
20
+ return html;
21
+ }
22
+ return message;
23
+ }
24
+
25
+ // to do: refactor fastify-file to remove funcs completely
26
+ export default async function notification({
27
+ pg = pgClients.client,
28
+ provider = ['email'],
29
+ from,
30
+ to,
31
+ template,
32
+ table,
33
+ message,
34
+ title,
35
+ file,
36
+ data,
37
+ id,
38
+ nocache,
39
+ }) {
40
+ if (pg?.readonly) {
41
+ return null;
42
+ }
43
+
44
+ const keyTo = `${pg.options?.database}:mail:${provider[0]}:${to || ''}${id || ''}${table || ''}${title || ''}`;
45
+ const uniqueTo = await rclient.setnx(keyTo, 1);
46
+
47
+ if (!uniqueTo && !nocache) {
48
+ logger.file('notification/sent', { keyTo, send: uniqueTo, nocache });
49
+ return `already sent: ${keyTo}`;
50
+ }
51
+ await rclient.expire(keyTo, 1000 * 600);
52
+
53
+ if (!to.length) {
54
+ return null;
55
+ }
56
+
57
+ if (!(Array.isArray(provider) && provider.length)) {
58
+ return 'notification provider - must be array and not empty';
59
+ }
60
+
61
+ const html = await generateNotificationContent({
62
+ pg, table, template, id, message, data,
63
+ });
64
+
65
+ if (provider.includes('email')) {
66
+ const files = Array.isArray(file) ? file : [file];
67
+ const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
68
+ /* const content = await downloadFile(el, { buffer: true }); // ?
69
+ return {
70
+ filename: el.split('/').pop(),
71
+ encoding: 'base64',
72
+ content,
73
+ }; */
74
+ })) : [];
75
+
76
+ const toEmail = Array.isArray(to) ? to.map((emails) => emails.match(emailReg)?.join(',')) : to;
77
+
78
+ const result = await sendEmail({
79
+ attachments,
80
+ html,
81
+ subject: title,
82
+ from,
83
+ to: toEmail,
84
+ });
85
+
86
+ return result;
87
+ }
88
+ return null;
89
+ }
@@ -1,127 +0,0 @@
1
- import { _ as p, e as m, u as d, s as g } from "./import-file-Ch8huzhb.js";
2
- import { resolveComponent as f, createElementBlock as x, openBlock as b, createElementVNode as n, normalizeClass as w, normalizeStyle as h, 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
- api: "",
11
- style: null
12
- };
13
- },
14
- mounted() {
15
- this.getFormScheme();
16
- },
17
- computed: {
18
- color() {
19
- return g.value.buttonColor || "blue";
20
- }
21
- },
22
- methods: {
23
- flattenMenu(t) {
24
- const e = [];
25
- return t.forEach((o) => {
26
- o.menu ? e.push(...this.flattenMenu(o.menu)) : e.push(o);
27
- }), e;
28
- },
29
- async getFormScheme() {
30
- var i, a;
31
- const t = this.flattenMenu(d.value);
32
- t != null && t.length || this.$router.replace("/404");
33
- const e = t == null ? void 0 : t.find((r) => {
34
- var s, l;
35
- return (r == null ? void 0 : r.path) == ((l = (s = this.$route) == null ? void 0 : s.query) == null ? void 0 : l.table);
36
- });
37
- e || this.$router.replace("/404");
38
- const o = e == null ? void 0 : e.table;
39
- this.table = o;
40
- try {
41
- const r = await m.get(`/api/table-data/${o}`), { data: s } = await m.get(
42
- `/api/template/form/${(i = r == null ? void 0 : r.data) == null ? void 0 : i.form}`
43
- );
44
- this.scheme = (s == null ? void 0 : s.schema) || s, this.style = (s == null ? void 0 : s.style) || null, this.api = (s == null ? void 0 : s.api) || "", this.token = (a = r == null ? void 0 : r.data) == null ? void 0 : a.addToken;
45
- } catch {
46
- }
47
- },
48
- getGroupedErrorNotification(t, e) {
49
- debugger;
50
- if (!t || !e) return "";
51
- const o = {};
52
- return Object.entries(t).forEach(([a, r]) => {
53
- var l;
54
- const s = ((l = e[a]) == null ? void 0 : l.ua) || a;
55
- r.forEach((c) => {
56
- const u = c.message;
57
- o[u] || (o[u] = []), o[u].push(`"${s}"`);
58
- });
59
- }), Object.entries(o).map(([a, r]) => `<b>${a}:</b> ${r.join(", ")}`).join("<br>") || "Сталася помилка валідації";
60
- },
61
- async createObject() {
62
- var e;
63
- const t = this.$refs.form;
64
- try {
65
- await t.doValidation(), await m.post(
66
- this.api || `/api/table/${this.token}`,
67
- this.formValues
68
- ), await this.$router.back(), await this.$notify({
69
- title: "Успішно!",
70
- message: "Об'єкт успішно створено",
71
- type: "success"
72
- });
73
- } catch (o) {
74
- const i = this.getGroupedErrorNotification(
75
- t == null ? void 0 : t.formErrors,
76
- t == null ? void 0 : t.scheme
77
- );
78
- this.$notify({
79
- title: "Помилка!",
80
- message: ((e = o == null ? void 0 : o.response) == null ? void 0 : e.data) || i,
81
- type: "error"
82
- });
83
- }
84
- }
85
- }
86
- }, $ = { class: "bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]" }, V = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, _ = { class: "flex items-center gap-[6px]" }, j = { class: "bg-white w-full rounded-xl 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" };
87
- function E(t, e, o, i, a, r) {
88
- var l;
89
- const s = f("VsForm");
90
- return b(), x("div", $, [
91
- n("div", V, [
92
- e[3] || (e[3] = n("h2", { class: "text-xl font-medium" }, "Створити", -1)),
93
- n("div", _, [
94
- n("button", {
95
- onClick: e[0] || (e[0] = (c) => t.$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
- n("button", {
99
- onClick: e[1] || (e[1] = (...c) => r.createObject && r.createObject(...c)),
100
- class: w(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${r.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${r.color}-800 hover:text-white`)
101
- }, " Зберегти ", 2)
102
- ])
103
- ]),
104
- n("div", {
105
- style: h({
106
- height: ((l = t.$adminSettings) == null ? void 0 : l.header) === !1 ? "calc(100vh - 100px)" : "calc(100vh - 165px)"
107
- }),
108
- class: "bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
109
- }, [
110
- n("div", j, [
111
- a.scheme ? (b(), y(s, {
112
- key: 0,
113
- ref: "form",
114
- scheme: a.scheme,
115
- style: h(a.style),
116
- modelValue: a.formValues,
117
- "onUpdate:modelValue": e[2] || (e[2] = (c) => a.formValues = c),
118
- class: "p-0 mt-[20px]"
119
- }, null, 8, ["scheme", "style", "modelValue"])) : k("", !0)
120
- ])
121
- ], 4)
122
- ]);
123
- }
124
- const O = /* @__PURE__ */ p(v, [["render", E]]);
125
- export {
126
- O as default
127
- };
@@ -1,145 +0,0 @@
1
- import { _ as f, e as m, u as y, s as x } from "./import-file-Ch8huzhb.js";
2
- import { resolveComponent as w, createElementBlock as k, openBlock as b, createElementVNode as u, normalizeClass as v, normalizeStyle as d, createBlock as $, createCommentVNode as V } from "vue";
3
- const j = {
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 x.value.buttonColor || "blue";
19
- }
20
- },
21
- methods: {
22
- flattenMenu(e) {
23
- const t = [];
24
- return e.forEach((o) => {
25
- o.menu ? t.push(...this.flattenMenu(o.menu)) : t.push(o);
26
- }), t;
27
- },
28
- async getFormScheme() {
29
- var i, a;
30
- const e = this.flattenMenu(y.value);
31
- e != null && e.length || this.$router.replace("/404");
32
- const t = e == null ? void 0 : e.find((r) => {
33
- var l, s;
34
- return (r == null ? void 0 : r.path) == ((s = (l = this.$route) == null ? void 0 : l.query) == null ? void 0 : s.table);
35
- });
36
- t || this.$router.replace("/404");
37
- const o = t == null ? void 0 : t.table;
38
- this.table = o;
39
- try {
40
- const {
41
- data: { form: r }
42
- } = await m.get(`/api/template/table/${o}`), { data: l } = await m.get(
43
- `/api/table/${this.table}/${(a = (i = this.$route) == null ? void 0 : i.query) == null ? void 0 : a.id}`
44
- );
45
- this.token = (l == null ? void 0 : l.token) || "", this.formValues = l || {};
46
- const { data: s } = await m.get(`/api/template/form/${r}`);
47
- this.scheme = (s == null ? void 0 : s.schema) || s, this.style = (s == null ? void 0 : s.style) || null;
48
- } catch {
49
- }
50
- },
51
- async onlyEditObject() {
52
- var t, o, i, a, r, l, s, c, n;
53
- const e = this.$refs.form;
54
- try {
55
- await e.doValidation(), await m.put(`/api/table/${this.token}`, this.formValues), await this.$notify({
56
- title: "Успішно!",
57
- message: "Об'єкт успішно створено",
58
- type: "success"
59
- });
60
- } catch (h) {
61
- const p = ((t = h == null ? void 0 : h.response) == null ? void 0 : t.data) || "";
62
- let g = ((r = (a = (i = (o = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : o[0]) == null ? void 0 : i[1]) == null ? void 0 : a[0]) == null ? void 0 : r.message) === "Це поле обов'язкове" ? "Заповніть обов'язкові поля" : (n = (c = (s = (l = Object.entries(e == null ? void 0 : e.formErrors)) == null ? void 0 : l[0]) == null ? void 0 : s[1]) == null ? void 0 : c[0]) == null ? void 0 : n.message;
63
- this.$notify({
64
- title: "Помилка!",
65
- message: p || g || "Сталася помилка валідаціі",
66
- type: "error"
67
- });
68
- }
69
- },
70
- getGroupedErrorNotification(e, t) {
71
- if (!e || !t) return "";
72
- const o = {};
73
- return Object.entries(e).forEach(([a, r]) => {
74
- var s;
75
- const l = ((s = t[a]) == null ? void 0 : s.ua) || a;
76
- r.forEach((c) => {
77
- const n = c.message;
78
- o[n] || (o[n] = []), o[n].push(`"${l}"`);
79
- });
80
- }), Object.entries(o).map(([a, r]) => `<b>${a}:</b> ${r.join(", ")}`).join("<br>") || "Сталася помилка валідації";
81
- },
82
- async editObjectAndRedirect() {
83
- const e = this.$refs.form;
84
- try {
85
- await e.doValidation(), await m.put(`/api/table/${this.token}`, this.formValues), await this.$router.back(), await this.$notify({
86
- title: "Успішно!",
87
- message: "Об'єкт успішно створено",
88
- type: "success"
89
- });
90
- } catch {
91
- const o = this.getGroupedErrorNotification(
92
- e == null ? void 0 : e.formErrors,
93
- e == null ? void 0 : e.scheme
94
- );
95
- this.$notify({
96
- title: "Помилка!",
97
- message: o,
98
- type: "error"
99
- });
100
- }
101
- }
102
- }
103
- }, E = { class: "bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]" }, _ = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, O = { class: "flex items-center gap-[6px]" }, M = { class: "bg-white w-full rounded-xl 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" };
104
- function C(e, t, o, i, a, r) {
105
- var s, c;
106
- const l = w("VsForm");
107
- return b(), k("div", E, [
108
- u("div", _, [
109
- t[3] || (t[3] = u("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
110
- u("div", O, [
111
- u("button", {
112
- onClick: t[0] || (t[0] = (n) => e.$router.back()),
113
- 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"
114
- }, " Скасувати "),
115
- u("button", {
116
- onClick: t[1] || (t[1] = (...n) => r.editObjectAndRedirect && r.editObjectAndRedirect(...n)),
117
- class: v(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${r.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${r.color}-800 hover:text-white`)
118
- }, " Зберегти ", 2)
119
- ])
120
- ]),
121
- u("div", {
122
- style: d({
123
- height: ((s = e.$adminSettings) == null ? void 0 : s.header) === !1 ? "calc(100vh - 100px)" : "calc(100vh - 165px)"
124
- }),
125
- class: "bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw]"
126
- }, [
127
- u("div", M, [
128
- a.scheme ? (b(), $(l, {
129
- key: 0,
130
- ref: "form",
131
- scheme: a.scheme,
132
- columns: (c = a.style) == null ? void 0 : c.columns,
133
- style: d(a.style),
134
- modelValue: a.formValues,
135
- "onUpdate:modelValue": t[2] || (t[2] = (n) => a.formValues = n),
136
- class: "p-0 mt-[20px]"
137
- }, null, 8, ["scheme", "columns", "style", "modelValue"])) : V("", !0)
138
- ])
139
- ], 4)
140
- ]);
141
- }
142
- const S = /* @__PURE__ */ f(j, [["render", C]]);
143
- export {
144
- S as default
145
- };