@opengis/admin 0.1.0

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 (65) hide show
  1. package/README.md +29 -0
  2. package/config.js +5 -0
  3. package/dist/add-page-C-msiPrU.js +64 -0
  4. package/dist/admin-interface-vPkHXzQK.js +762 -0
  5. package/dist/admin-view-BYF4ITZY.js +220 -0
  6. package/dist/card-page-HOwuHNjV.js +49 -0
  7. package/dist/card-view-CjZRvfqy.js +11 -0
  8. package/dist/edit-page-7yrRusn4.js +58 -0
  9. package/dist/form-TrZSpRSC.js +38 -0
  10. package/dist/import-file-DPHo57R5.js +3726 -0
  11. package/dist/settings.js +4 -0
  12. package/dist/settings.umd.cjs +36 -0
  13. package/dist/style.css +1 -0
  14. package/dist/userMenu-CT1xO2Pt.js +5 -0
  15. package/package.json +52 -0
  16. package/plugin.js +25 -0
  17. package/server/helpers/controllers/badge.js +12 -0
  18. package/server/helpers/controllers/hb.js +3 -0
  19. package/server/helpers/controllers/map.js +3 -0
  20. package/server/helpers/controllers/mls.js +3 -0
  21. package/server/helpers/controllers/vue.js +3 -0
  22. package/server/helpers/index.mjs +13 -0
  23. package/server/plugins/docs.js +28 -0
  24. package/server/plugins/hook.js +94 -0
  25. package/server/plugins/vite.js +64 -0
  26. package/server/routes/data/controllers/cardData.js +30 -0
  27. package/server/routes/data/controllers/metaFormat/getSelectVal.js +19 -0
  28. package/server/routes/data/controllers/metaFormat/index.js +29 -0
  29. package/server/routes/data/controllers/tableData.js +129 -0
  30. package/server/routes/data/controllers/tableDataId.js +28 -0
  31. package/server/routes/data/controllers/tableFilter.js +51 -0
  32. package/server/routes/data/index.mjs +10 -0
  33. package/server/routes/menu/controllers/getMenu.js +50 -0
  34. package/server/routes/menu/index.mjs +5 -0
  35. package/server/routes/root.mjs +3 -0
  36. package/server/routes/templates/controllers/getTemplate.js +9 -0
  37. package/server/routes/templates/funcs/addTempateFolder.js +47 -0
  38. package/server/routes/templates/funcs/getTemplate.js +70 -0
  39. package/server/routes/templates/funcs/getTemplatePath.js +39 -0
  40. package/server/routes/templates/funcs/loadTemplate.js +1 -0
  41. package/server/routes/templates/funcs/loadTemplateDir.js +1 -0
  42. package/server/routes/templates/funcs/loadTemplatePath.js +1 -0
  43. package/server/routes/templates/index.mjs +14 -0
  44. package/server/templates/cls/test.json +10 -0
  45. package/server/templates/form/admin.user_cls.data.form.json +50 -0
  46. package/server/templates/form/admin.user_group_rel.form.json +22 -0
  47. package/server/templates/form/cp_building.form.json +33 -0
  48. package/server/templates/form/form-user-pass.json +11 -0
  49. package/server/templates/form/form-user_group.json +40 -0
  50. package/server/templates/form/form-users.json +157 -0
  51. package/server/templates/form/user_group_access.form.json +23 -0
  52. package/server/templates/interface/management.user_group.html +1 -0
  53. package/server/templates/interface/management.user_group.json +10 -0
  54. package/server/templates/interface/management.users.html +1 -0
  55. package/server/templates/interface/management.users.json +10 -0
  56. package/server/templates/map/dgm_level_line.xml +52 -0
  57. package/server/templates/pt/admin-menu-pt.html +108 -0
  58. package/server/templates/pt/management.user_group.table.pt.html +127 -0
  59. package/server/templates/pt/management.users.table.pt.html +130 -0
  60. package/server/templates/pt/table-standard-pt.html +202 -0
  61. package/server/templates/select/account_id.json +3 -0
  62. package/server/templates/select/account_id.sql +1 -0
  63. package/server/templates/table/gis.dataset.table.json +44 -0
  64. package/server/templates/table/management.user_group.table.json +113 -0
  65. package/server/templates/table/management.users.table.json +127 -0
@@ -0,0 +1,762 @@
1
+ import { _ as m, a as k } from "./import-file-DPHo57R5.js";
2
+ import { u as I } from "./userMenu-CT1xO2Pt.js";
3
+ import { openBlock as r, createElementBlock as i, createStaticVNode as S, createElementVNode as n, Fragment as f, resolveComponent as c, createVNode as p, withCtx as _, createTextVNode as M, withModifiers as H, renderList as v, toDisplayString as V, withDirectives as E, vModelCheckbox as L, createBlock as F, vModelText as O, resolveDynamicComponent as N, Transition as q, createCommentVNode as R, vShow as G } from "vue";
4
+ const J = {}, K = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox: "0 0 24 24",
7
+ fill: "none",
8
+ stroke: "currentColor",
9
+ "stroke-width": "2",
10
+ "stroke-linecap": "round",
11
+ "stroke-linejoin": "round",
12
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-adjustments-horizontal"
13
+ };
14
+ function Q(t, e, s, a, l, o) {
15
+ return r(), i("svg", K, e[0] || (e[0] = [
16
+ S('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 6l8 0"></path><path d="M16 6l4 0"></path><path d="M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 12l2 0"></path><path d="M10 12l10 0"></path><path d="M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 18l11 0"></path><path d="M19 18l1 0"></path>', 10)
17
+ ]));
18
+ }
19
+ const W = /* @__PURE__ */ m(J, [["render", Q]]), X = {}, Y = {
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ viewBox: "0 0 24 24",
22
+ fill: "none",
23
+ stroke: "currentColor",
24
+ "stroke-width": "2",
25
+ "stroke-linecap": "round",
26
+ "stroke-linejoin": "round",
27
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"
28
+ };
29
+ function Z(t, e, s, a, l, o) {
30
+ return r(), i("svg", Y, e[0] || (e[0] = [
31
+ n("path", {
32
+ stroke: "none",
33
+ d: "M0 0h24v24H0z",
34
+ fill: "none"
35
+ }, null, -1),
36
+ n("path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
37
+ n("path", { d: "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
38
+ n("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
39
+ ]));
40
+ }
41
+ const ee = /* @__PURE__ */ m(X, [["render", Z]]), te = {}, ne = {
42
+ class: "flex-shrink-0 size-3.5",
43
+ xmlns: "http://www.w3.org/2000/svg",
44
+ viewBox: "0 0 24 24",
45
+ fill: "none",
46
+ stroke: "currentColor",
47
+ "stroke-width": "2",
48
+ "stroke-linecap": "round",
49
+ "stroke-linejoin": "round"
50
+ };
51
+ function se(t, e, s, a, l, o) {
52
+ return r(), i("svg", ne, e[0] || (e[0] = [
53
+ S('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>', 5)
54
+ ]));
55
+ }
56
+ const le = /* @__PURE__ */ m(te, [["render", se]]), oe = {
57
+ props: {
58
+ height: { type: String, default: "16" },
59
+ width: { type: String, default: "12" },
60
+ color: { type: String, default: "black" }
61
+ }
62
+ }, re = { style: { display: "none" } }, ae = ["height", "width", "fill"];
63
+ function ie(t, e, s, a, l, o) {
64
+ return r(), i(f, null, [
65
+ (r(), i("svg", re, e[0] || (e[0] = [
66
+ n("symbol", {
67
+ id: "icon-pencil",
68
+ viewBox: "0 0 32 32"
69
+ }, [
70
+ n("path", { d: "M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z" })
71
+ ], -1)
72
+ ]))),
73
+ (r(), i("svg", {
74
+ height: s.height,
75
+ width: s.width,
76
+ fill: s.color
77
+ }, e[1] || (e[1] = [
78
+ n("use", { "xlink:href": "#icon-pencil" }, null, -1)
79
+ ]), 8, ae))
80
+ ], 64);
81
+ }
82
+ const de = /* @__PURE__ */ m(oe, [["render", ie]]), ue = {
83
+ components: {
84
+ IconMore: ee,
85
+ IconDelete: le,
86
+ IconEdit: de
87
+ },
88
+ emits: ["updateTable"],
89
+ props: { item: Object, table: String },
90
+ data() {
91
+ return {
92
+ formVisible: !1,
93
+ isDeleteConfirm: !1,
94
+ formValue: {},
95
+ top: 0,
96
+ left: 0
97
+ };
98
+ },
99
+ methods: {
100
+ openConfirm() {
101
+ this.isDeleteConfirm = !0, document.querySelector("body").click();
102
+ },
103
+ async getData() {
104
+ var t;
105
+ try {
106
+ const { data: e } = await k.get(
107
+ `/api/table/${this.table}/${(t = this.item) == null ? void 0 : t.id}`
108
+ );
109
+ this.formValue = e;
110
+ } catch (e) {
111
+ console.error(e);
112
+ }
113
+ },
114
+ doSomethingOnCancel() {
115
+ this.formVisible = !1;
116
+ },
117
+ async deleteElement() {
118
+ var t;
119
+ try {
120
+ k.delete(`/api/table/${this.table}/${(t = this.item) == null ? void 0 : t.id}`), this.$notify({
121
+ title: "Успішно!",
122
+ message: "Об`єкт успішно видалeно",
123
+ type: "success"
124
+ }), this.$emit("update-table"), this.isDeleteConfirm = !1;
125
+ } catch {
126
+ this.$notify({
127
+ title: "Помилка!",
128
+ message: "Сталася помилка",
129
+ type: "error"
130
+ });
131
+ }
132
+ }
133
+ }
134
+ }, ce = { class: "hs-dropdown [--placement:bottom-right] inline-flex" }, pe = {
135
+ id: "hs-pro-dupc1",
136
+ type: "button",
137
+ class: "gap-x-2 p-2 rounded-lg hover:border-transparent focus:outline-none text-black hover:bg-gray-50"
138
+ }, be = { class: "pt-[7px] pb-[7px] flex flex-col items-start" }, he = { class: "p-4" }, me = { class: "mt-4 flex justify-end gap-x-3" };
139
+ function ge(t, e, s, a, l, o) {
140
+ const b = c("IconMore"), d = c("IconEdit"), h = c("router-link"), g = c("IconDelete"), w = c("VsPopover"), A = c("VsDialog");
141
+ return r(), i(f, null, [
142
+ n("div", ce, [
143
+ p(w, {
144
+ trigger: "click",
145
+ placement: "left"
146
+ }, {
147
+ reference: _(() => [
148
+ n("button", pe, [
149
+ p(b, {
150
+ height: "16",
151
+ width: "16"
152
+ })
153
+ ])
154
+ ]),
155
+ default: _(() => {
156
+ var y, $, C;
157
+ return [
158
+ n("div", be, [
159
+ p(h, {
160
+ to: `/edit?table=${($ = (y = t.$route) == null ? void 0 : y.params) == null ? void 0 : $.catchAll}&id=${(C = s.item) == null ? void 0 : C.id}`,
161
+ class: "w-[100px] ml-[2px] flex items-center justify-center gap-x-3 rounded-lg text-[13px] text-gray-800"
162
+ }, {
163
+ default: _(() => [
164
+ p(d, { color: "#000" }),
165
+ e[4] || (e[4] = M(" Редагувати "))
166
+ ]),
167
+ _: 1
168
+ }, 8, ["to"]),
169
+ e[6] || (e[6] = n("div", { class: "h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto mt-[10px] mb-[10px]" }, null, -1)),
170
+ n("button", {
171
+ onClick: e[0] || (e[0] = H((...T) => o.openConfirm && o.openConfirm(...T), ["stop"])),
172
+ type: "button",
173
+ class: "w-[100px] flex items-center justify-center gap-x-3 rounded-lg text-[14px] text-red-500"
174
+ }, [
175
+ p(g),
176
+ e[5] || (e[5] = n("span", { class: "text-gray-800" }, "Видалити", -1))
177
+ ])
178
+ ])
179
+ ];
180
+ }),
181
+ _: 1
182
+ })
183
+ ]),
184
+ p(A, {
185
+ visible: l.isDeleteConfirm,
186
+ "onUpdate:visible": e[3] || (e[3] = (y) => l.isDeleteConfirm = y),
187
+ title: "Ви впевнені?"
188
+ }, {
189
+ default: _(() => [
190
+ n("div", he, [
191
+ e[7] || (e[7] = n("p", { class: "mt-1 text-gray-500 dark:text-neutral-500" }, " Ви впевнені, що хочете видалити цей об'єкт? ", -1)),
192
+ n("div", me, [
193
+ n("button", {
194
+ type: "button",
195
+ class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",
196
+ onClick: e[1] || (e[1] = (y) => l.isDeleteConfirm = !1)
197
+ }, " Скасувати "),
198
+ n("button", {
199
+ type: "button",
200
+ class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",
201
+ onClick: e[2] || (e[2] = (...y) => o.deleteElement && o.deleteElement(...y))
202
+ }, " Так, я впевнена/ий ")
203
+ ])
204
+ ])
205
+ ]),
206
+ _: 1
207
+ }, 8, ["visible"])
208
+ ], 64);
209
+ }
210
+ const fe = /* @__PURE__ */ m(ue, [["render", ge]]), xe = {}, ye = {
211
+ class: "flex-shrink-0 mt-0.5 size-3.5",
212
+ xmlns: "http://www.w3.org/2000/svg",
213
+ viewBox: "0 0 24 24",
214
+ fill: "none",
215
+ stroke: "currentColor",
216
+ "stroke-width": "2",
217
+ "stroke-linecap": "round",
218
+ "stroke-linejoin": "round"
219
+ };
220
+ function _e(t, e, s, a, l, o) {
221
+ return r(), i("svg", ye, e[0] || (e[0] = [
222
+ n("path", { d: "m3 16 4 4 4-4" }, null, -1),
223
+ n("path", { d: "M7 20V4" }, null, -1),
224
+ n("path", { d: "m21 8-4-4-4 4" }, null, -1),
225
+ n("path", { d: "M17 4v16" }, null, -1)
226
+ ]));
227
+ }
228
+ const ke = /* @__PURE__ */ m(xe, [["render", _e]]), ve = {
229
+ props: {
230
+ columns: { type: Object, default: () => {
231
+ } },
232
+ table: { type: String, default: () => "" }
233
+ },
234
+ data() {
235
+ return {
236
+ tableFormats: ["json", "csv", "xlsx"],
237
+ format: "",
238
+ cols: []
239
+ };
240
+ },
241
+ methods: {
242
+ async exportTable() {
243
+ try {
244
+ const t = await k.get("/api/export", {
245
+ params: {
246
+ table: this.table,
247
+ format: this.format,
248
+ cols: this.cols.join(",")
249
+ },
250
+ responseType: "blob"
251
+ }), e = new Blob([t.data], {
252
+ type: "application/octet-stream"
253
+ }), s = window.URL.createObjectURL(e), a = document.createElement("a");
254
+ a.href = s, a.setAttribute(
255
+ "download",
256
+ `${this.table.split(".")[0]}.${this.format}`
257
+ ), document.body.appendChild(a), a.click(), document.body.removeChild(a), window.URL.revokeObjectURL(s), this.$notify({
258
+ type: "success",
259
+ title: "Експорт",
260
+ message: "Файл успішно експортовано!"
261
+ });
262
+ } catch (t) {
263
+ console.error("Ошибка при экспорте файла:", t), this.$notify({
264
+ type: "error",
265
+ title: "Помилка",
266
+ message: "Не вдалося експортувати файл."
267
+ });
268
+ }
269
+ },
270
+ selectFormat(t) {
271
+ this.format = t;
272
+ }
273
+ }
274
+ }, we = { class: "p-4" }, $e = { class: "pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700" }, Ce = { class: "mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]" }, Me = { class: "pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700" }, Te = { class: "mt-2 space-y-2" }, De = ["id", "onChange"], Ve = ["for"], Fe = { class: "pb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700" }, Ae = { class: "text-center" };
275
+ function Ie(t, e, s, a, l, o) {
276
+ const b = c("VsCheckbox");
277
+ return r(), i(f, null, [
278
+ e[4] || (e[4] = n("div", { class: "dark:border-neutral-700" }, null, -1)),
279
+ n("div", we, [
280
+ n("div", $e, [
281
+ e[2] || (e[2] = n("label", { class: "text-sm text-gray-500 dark:text-neutral-500" }, " Виберіть стовпці таблиці для експорту: ", -1)),
282
+ n("div", Ce, [
283
+ (r(!0), i(f, null, v(s.columns, (d, h) => (r(), i("div", {
284
+ class: "flex items-center",
285
+ key: h,
286
+ style: { width: "calc((100% - 10px) / 2)" }
287
+ }, [
288
+ p(b, {
289
+ class: "py-0 shrink-0 border-gray-300 rounded text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",
290
+ modelValue: l.cols,
291
+ "onUpdate:modelValue": e[0] || (e[0] = (g) => l.cols = g),
292
+ value: d == null ? void 0 : d.name,
293
+ label: d == null ? void 0 : d.ua
294
+ }, null, 8, ["modelValue", "value", "label"])
295
+ ]))), 128))
296
+ ])
297
+ ]),
298
+ n("div", Me, [
299
+ e[3] || (e[3] = n("label", { class: "text-sm text-gray-500 dark:text-neutral-500" }, " Виберіть формат таблиці: ", -1)),
300
+ n("div", Te, [
301
+ (r(!0), i(f, null, v(l.tableFormats, (d, h) => (r(), i("div", {
302
+ class: "flex items-center",
303
+ key: h
304
+ }, [
305
+ n("input", {
306
+ type: "radio",
307
+ name: "hs-pro-duecmfm",
308
+ class: "shrink-0 border-gray-300 rounded-full text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",
309
+ id: d,
310
+ onChange: (g) => o.selectFormat(d)
311
+ }, null, 40, De),
312
+ n("label", {
313
+ for: d,
314
+ class: "text-sm text-gray-800 ms-3 dark:text-neutral-400"
315
+ }, " Формат " + V(d), 9, Ve)
316
+ ]))), 128))
317
+ ])
318
+ ]),
319
+ n("div", Fe, [
320
+ n("div", Ae, [
321
+ n("button", {
322
+ type: "button",
323
+ class: "p-2 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500",
324
+ onClick: e[1] || (e[1] = (...d) => o.exportTable && o.exportTable(...d))
325
+ }, " Завантажити таблицю ")
326
+ ])
327
+ ])
328
+ ])
329
+ ], 64);
330
+ }
331
+ const Ee = /* @__PURE__ */ m(ve, [["render", Ie]]), Se = {
332
+ components: { IconExport: ke, AdminTableExportForm: Ee },
333
+ props: { table: String, columns: Array },
334
+ data() {
335
+ return {
336
+ isOpen: !1
337
+ };
338
+ }
339
+ };
340
+ function je(t, e, s, a, l, o) {
341
+ const b = c("IconExport"), d = c("AdminTableExportForm"), h = c("VsDialog");
342
+ return r(), i(f, null, [
343
+ n("button", {
344
+ onClick: e[0] || (e[0] = (g) => l.isOpen = !0),
345
+ class: "py-2 px-3 relative flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"
346
+ }, [
347
+ p(b, {
348
+ height: "16",
349
+ width: "16"
350
+ }),
351
+ e[2] || (e[2] = M(" Експорт "))
352
+ ]),
353
+ p(h, {
354
+ visible: l.isOpen,
355
+ "onUpdate:visible": e[1] || (e[1] = (g) => l.isOpen = g),
356
+ title: "Експорт таблиці"
357
+ }, {
358
+ default: _(() => [
359
+ p(d, {
360
+ table: s.table,
361
+ columns: s.columns
362
+ }, null, 8, ["table", "columns"])
363
+ ]),
364
+ _: 1
365
+ }, 8, ["visible"])
366
+ ], 64);
367
+ }
368
+ const ze = /* @__PURE__ */ m(Se, [["render", je]]), Pe = {}, Be = {
369
+ xmlns: "http://www.w3.org/2000/svg",
370
+ viewBox: "0 0 24 24",
371
+ fill: "none",
372
+ stroke: "currentColor",
373
+ "stroke-width": "2",
374
+ "stroke-linecap": "round",
375
+ "stroke-linejoin": "round",
376
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-columns"
377
+ };
378
+ function Ue(t, e, s, a, l, o) {
379
+ return r(), i("svg", Be, e[0] || (e[0] = [
380
+ S('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>', 9)
381
+ ]));
382
+ }
383
+ const He = /* @__PURE__ */ m(Pe, [["render", Ue]]), Le = {
384
+ props: { column: Object },
385
+ emits: ["update-column"],
386
+ data() {
387
+ return {
388
+ value: !1
389
+ };
390
+ },
391
+ watch: {
392
+ value(t) {
393
+ this.$emit("update-column", { ...this.column, hidden: !t });
394
+ }
395
+ },
396
+ mounted() {
397
+ var t;
398
+ ((t = this.column) == null ? void 0 : t.hidden) !== !0 && (this.value = !0);
399
+ }
400
+ }, Oe = { class: "flex w-full gap-[8px] items-centr" };
401
+ function Ne(t, e, s, a, l, o) {
402
+ var b, d;
403
+ return r(), i("label", Oe, [
404
+ E(n("input", {
405
+ "onUpdate:modelValue": e[0] || (e[0] = (h) => l.value = h),
406
+ type: "checkbox"
407
+ }, null, 512), [
408
+ [L, l.value]
409
+ ]),
410
+ M(" " + V(((b = s.column) == null ? void 0 : b.ua) || ((d = s.column) == null ? void 0 : d.title)), 1)
411
+ ]);
412
+ }
413
+ const qe = /* @__PURE__ */ m(Le, [["render", Ne]]), Re = {
414
+ components: { IconColumns: He, AdminTableColumnsHiddenItem: qe },
415
+ emits: ["update-columns"],
416
+ props: { columns: Array },
417
+ methods: {
418
+ updateColumn(t) {
419
+ const e = this.columns.findIndex((a) => (a == null ? void 0 : a.name) === (t == null ? void 0 : t.name)), s = this.columns;
420
+ s[e] = t, this.$emit("update-columns", [...s]);
421
+ }
422
+ }
423
+ }, Ge = { class: "py-2 px-3 flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300" }, Je = { class: "flex flex-col gap-[3px] h-[400px] w-[300px] 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" };
424
+ function Ke(t, e, s, a, l, o) {
425
+ const b = c("IconColumns"), d = c("AdminTableColumnsHiddenItem"), h = c("VsPopover");
426
+ return r(), F(h, {
427
+ trigger: "click",
428
+ placement: "bottom"
429
+ }, {
430
+ reference: _(() => [
431
+ n("button", Ge, [
432
+ p(b, {
433
+ height: "20",
434
+ width: "16"
435
+ })
436
+ ])
437
+ ]),
438
+ default: _(() => [
439
+ n("div", null, [
440
+ e[0] || (e[0] = n("h2", { class: "text-sm mb-[8px]" }, "Оберіть колонки, щоб приховати", -1)),
441
+ n("ul", Je, [
442
+ (r(!0), i(f, null, v(s.columns, (g, w) => (r(), i("li", { key: w }, [
443
+ p(d, {
444
+ column: g,
445
+ onUpdateColumn: o.updateColumn
446
+ }, null, 8, ["column", "onUpdateColumn"])
447
+ ]))), 128))
448
+ ])
449
+ ])
450
+ ]),
451
+ _: 1
452
+ });
453
+ }
454
+ const Qe = /* @__PURE__ */ m(Re, [["render", Ke]]), We = {
455
+ props: { table: String },
456
+ components: {
457
+ IconFilter: W,
458
+ AdminTableControl: fe,
459
+ AdminTableExport: ze,
460
+ AdminTableColumnsHidden: Qe
461
+ },
462
+ data() {
463
+ return {
464
+ tableData: {},
465
+ isFilters: !1,
466
+ filterScheme: [],
467
+ page: 1,
468
+ searchValue: "",
469
+ limit: 20,
470
+ filters: null
471
+ };
472
+ },
473
+ mounted() {
474
+ var t, e;
475
+ this.page = ((e = (t = this.$route) == null ? void 0 : t.query) == null ? void 0 : e.page) || 1, this.getTableData(), this.getFilters();
476
+ },
477
+ computed: {
478
+ defaultPage() {
479
+ var t, e;
480
+ return ((e = (t = this.$route) == null ? void 0 : t.query) == null ? void 0 : e.page) || 1;
481
+ },
482
+ getFilterScheme() {
483
+ var t;
484
+ return (t = this.tableData) == null ? void 0 : t.filters;
485
+ },
486
+ columns() {
487
+ var t, e;
488
+ return (e = (t = this.tableData) == null ? void 0 : t.columns) == null ? void 0 : e.filter((s) => (s == null ? void 0 : s.hidden) !== !0);
489
+ }
490
+ },
491
+ watch: {
492
+ table() {
493
+ this.getTableData();
494
+ },
495
+ searchValue() {
496
+ this.getTableData();
497
+ }
498
+ },
499
+ methods: {
500
+ async getTableData() {
501
+ try {
502
+ const { data: t } = await k.get(`/api/template/table/${this.table}`), e = await k.get(`/api/table-data/${this.table}`, {
503
+ params: {
504
+ page: this.page,
505
+ search: this.searchValue || null,
506
+ limit: this.limit,
507
+ filter: this.filters || null
508
+ }
509
+ });
510
+ this.tableData = {
511
+ ...this.tableData,
512
+ ...t,
513
+ ...(e == null ? void 0 : e.data) || {}
514
+ };
515
+ } catch {
516
+ }
517
+ },
518
+ async getFilters() {
519
+ var t;
520
+ try {
521
+ const { data: e } = await k.get(`/api/table-filter/${this.table}`);
522
+ this.filterScheme = (t = e == null ? void 0 : e.list) == null ? void 0 : t.map((s) => ({
523
+ ...s,
524
+ label: (s == null ? void 0 : s.label) || (s == null ? void 0 : s.ua)
525
+ }));
526
+ } catch {
527
+ }
528
+ },
529
+ async handlePageChange(t) {
530
+ const e = this.$route.query;
531
+ this.page = t, !(!(e != null && e.page) && t === 1 || e.page === t) && (await this.$router.replace({ query: { ...e, page: t } }), await this.getTableData());
532
+ },
533
+ async changeLimit(t) {
534
+ this.limit = await t, this.defaultPage = 1, await this.getTableData();
535
+ },
536
+ closeFilter({ target: t }) {
537
+ this.isFilters && t.classList.contains("filter-container") && (this.isFilters = !1);
538
+ },
539
+ async filterChange({ url: t }) {
540
+ this.filters = t, this.page = 1, await this.getTableData();
541
+ }
542
+ }
543
+ }, Xe = { class: "w-[calc(100vw - 320px)]" }, Ye = { class: "h-[58px] bg-gray-50 flex items-center justify-between px-[30px]" }, Ze = { class: "text-xl font-medium" }, et = {
544
+ style: { height: "calc(100vh - 60px)", width: "calc(100vw - 260px)" },
545
+ class: "bg-gray-50 p-[20px] flex"
546
+ }, tt = { class: "bg-white w-full rounded-xl border p-[20px]" }, nt = { class: "flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px]" }, st = { class: "flex gap-[6px] ml-auto" }, lt = { class: "space-y-5 flex items-start w-full justify-start" }, ot = {
547
+ style: { height: "calc(100vh - 250px)" },
548
+ class: "overflow-x-auto w-full [&::-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"
549
+ }, rt = { class: "inline-block align-middle" }, at = { class: "divide-y divide-gray-200 dark:divide-neutral-700 relative" }, it = { class: "sticky top-0 bg-white" }, dt = { class: "border-t border-stone-200" }, ut = { class: "pe-4 py-3 gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200" }, ct = { class: "divide-y divide-gray-200 dark:divide-neutral-700" }, pt = ["onClick"], bt = { class: "text-center sticky right-0 bg-white" }, ht = { class: "p-[20px] flex justify-end w-full" }, mt = { class: "filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px]" };
550
+ function gt(t, e, s, a, l, o) {
551
+ var $, C, T, j, z, P, B, U;
552
+ const b = c("router-link"), d = c("AdminTableColumnsHidden"), h = c("AdminTableExport"), g = c("IconFilter"), w = c("AdminTableControl"), A = c("VsPagination"), y = c("VsFilter");
553
+ return r(), i(f, null, [
554
+ n("div", Xe, [
555
+ n("div", Ye, [
556
+ n("h2", Ze, V((C = ($ = l.tableData) == null ? void 0 : $.title_full) == null ? void 0 : C.ua), 1),
557
+ p(b, {
558
+ to: `/add?table=${(j = (T = t.$route) == null ? void 0 : T.params) == null ? void 0 : j.catchAll}`,
559
+ class: "py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg bg-blue-500 text-gray-800 shadow-sm hover:bg-blue-700 hover:text-white duration-300"
560
+ }, {
561
+ default: _(() => e[5] || (e[5] = [
562
+ M(" Додати ")
563
+ ])),
564
+ _: 1
565
+ }, 8, ["to"])
566
+ ]),
567
+ n("div", et, [
568
+ n("div", tt, [
569
+ n("div", nt, [
570
+ E(n("input", {
571
+ "onUpdate:modelValue": e[0] || (e[0] = (u) => l.searchValue = u),
572
+ class: "py-2 pl-[15px] h-[38px] w-[400px] block w-full border rounded-lg text-sm focus:border-blue-600 focus:border-[2px] outline-none",
573
+ placeholder: "Пошук..."
574
+ }, null, 512), [
575
+ [O, l.searchValue]
576
+ ]),
577
+ n("div", st, [
578
+ p(d, {
579
+ columns: (z = l.tableData) == null ? void 0 : z.columns,
580
+ onUpdateColumns: e[1] || (e[1] = (u) => l.tableData.columns = u)
581
+ }, null, 8, ["columns"]),
582
+ p(h, {
583
+ table: s.table,
584
+ columns: (P = l.tableData) == null ? void 0 : P.columns
585
+ }, null, 8, ["table", "columns"]),
586
+ n("button", {
587
+ onClick: e[2] || (e[2] = (u) => l.isFilters = !l.isFilters),
588
+ class: "py-2 px-3 flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"
589
+ }, [
590
+ p(g, {
591
+ height: "16",
592
+ width: "16"
593
+ }),
594
+ e[6] || (e[6] = M(" Фільтри "))
595
+ ])
596
+ ])
597
+ ]),
598
+ n("div", lt, [
599
+ n("div", ot, [
600
+ n("div", rt, [
601
+ n("table", at, [
602
+ n("thead", it, [
603
+ n("tr", dt, [
604
+ (r(!0), i(f, null, v(o.columns, (u) => (r(), i("th", {
605
+ class: "min-w-[200px] text-start",
606
+ key: u.name
607
+ }, [
608
+ n("div", ut, V((u == null ? void 0 : u.ua) || u.name), 1)
609
+ ]))), 128)),
610
+ e[7] || (e[7] = n("th", { class: "min-w-[150px] sticky right-0 top-0 bg-white z-[10]" }, " Дія ", -1))
611
+ ])
612
+ ]),
613
+ n("tbody", ct, [
614
+ (r(!0), i(f, null, v((B = l.tableData) == null ? void 0 : B.rows, (u, D) => (r(), i("tr", { key: D }, [
615
+ (r(!0), i(f, null, v(o.columns, (x) => (r(), i("td", {
616
+ onClick: (vt) => t.$router.push(`/card/${s.table}/${u == null ? void 0 : u.id}`),
617
+ class: "size-px min-w-[200px] whitespace-nowrap text-start pe-4 py-3 text-sm text-gray-600",
618
+ key: x.name
619
+ }, [
620
+ (r(), F(N(
621
+ t.$componentsConfig[`table-format-${(x == null ? void 0 : x.format) || t.text}`]
622
+ ), {
623
+ name: x == null ? void 0 : x.name,
624
+ data: u,
625
+ value: u == null ? void 0 : u[x == null ? void 0 : x.name]
626
+ }, null, 8, ["name", "data", "value"]))
627
+ ], 8, pt))), 128)),
628
+ n("td", bt, [
629
+ p(w, {
630
+ item: u,
631
+ table: s.table,
632
+ onUpdateTable: o.getTableData
633
+ }, null, 8, ["item", "table", "onUpdateTable"])
634
+ ])
635
+ ]))), 128))
636
+ ])
637
+ ])
638
+ ])
639
+ ])
640
+ ]),
641
+ n("div", ht, [
642
+ p(A, {
643
+ goTo: !1,
644
+ class: "justify-end",
645
+ style: { width: "calc(50% + 100px)" },
646
+ "default-page": o.defaultPage,
647
+ total: ((U = l.tableData) == null ? void 0 : U.total) || 0,
648
+ pageSize: l.limit,
649
+ onPageChange: o.handlePageChange,
650
+ pageSizes: [10, 16, 20],
651
+ onPageSizeChange: o.changeLimit
652
+ }, null, 8, ["default-page", "total", "pageSize", "onPageChange", "onPageSizeChange"])
653
+ ])
654
+ ])
655
+ ])
656
+ ]),
657
+ p(q, { name: "fade" }, {
658
+ default: _(() => {
659
+ var u;
660
+ return [
661
+ E(n("div", {
662
+ onClick: e[4] || (e[4] = (...D) => o.closeFilter && o.closeFilter(...D)),
663
+ style: { height: "100vh" },
664
+ class: "fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 overflow-x-auto bg-[rgba(0,0,0,0.5)] [&::-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"
665
+ }, [
666
+ n("div", mt, [
667
+ (u = l.filterScheme) != null && u.length ? (r(), F(y, {
668
+ key: 0,
669
+ ref: "filter",
670
+ scheme: l.filterScheme,
671
+ layout: "default",
672
+ "apply-vue-router": "",
673
+ history: "",
674
+ name: "filter",
675
+ onFilterChange: o.filterChange,
676
+ closeFilterBtn: !0,
677
+ onFilterClose: e[3] || (e[3] = (D) => l.isFilters = !1)
678
+ }, null, 8, ["scheme", "onFilterChange"])) : R("", !0)
679
+ ])
680
+ ], 512), [
681
+ [G, l.isFilters]
682
+ ])
683
+ ];
684
+ }),
685
+ _: 1
686
+ })
687
+ ], 64);
688
+ }
689
+ const ft = /* @__PURE__ */ m(We, [["render", gt]]), xt = {
690
+ components: { AdminTable: ft },
691
+ data() {
692
+ return {
693
+ table: !1,
694
+ interface: ""
695
+ };
696
+ },
697
+ watch: {
698
+ $route: {
699
+ async handler() {
700
+ var t;
701
+ (t = I) != null && t.value || await this.getMenu(), await this.checkPageType();
702
+ },
703
+ deep: !0
704
+ }
705
+ },
706
+ async mounted() {
707
+ await this.checkPageType();
708
+ },
709
+ methods: {
710
+ flattenMenu(t) {
711
+ const e = [];
712
+ return t.forEach((s) => {
713
+ s.menu ? e.push(...this.flattenMenu(s.menu)) : e.push(s);
714
+ }), e;
715
+ },
716
+ async getMenu() {
717
+ try {
718
+ const { data: t } = await k.get("/api/user-menu");
719
+ I.value = t;
720
+ } catch {
721
+ }
722
+ },
723
+ async checkPageType() {
724
+ const t = this.flattenMenu(I.value);
725
+ t != null && t.length || this.$router.replace("/404");
726
+ const e = t == null ? void 0 : t.find((a) => {
727
+ var l, o;
728
+ return (a == null ? void 0 : a.path) == ((o = (l = this.$route) == null ? void 0 : l.params) == null ? void 0 : o.catchAll);
729
+ });
730
+ e || this.$router.replace("/404");
731
+ const s = e == null ? void 0 : e.table;
732
+ this.table = s || !1, !s && this.getInterface();
733
+ },
734
+ async getInterface() {
735
+ var t, e;
736
+ try {
737
+ const { data: s } = await k.get(
738
+ `/api/template/interface/${((e = (t = this.$route) == null ? void 0 : t.params) == null ? void 0 : e.catchAll) || ""}`
739
+ );
740
+ this.interface = s || "";
741
+ } catch {
742
+ this.interface = "";
743
+ }
744
+ }
745
+ }
746
+ }, yt = {
747
+ key: 1,
748
+ class: "w-full"
749
+ }, _t = ["innerHTML"];
750
+ function kt(t, e, s, a, l, o) {
751
+ const b = c("AdminTable");
752
+ return l.table ? (r(), F(b, {
753
+ key: 0,
754
+ table: l.table
755
+ }, null, 8, ["table"])) : (r(), i("div", yt, [
756
+ n("div", { innerHTML: l.interface }, null, 8, _t)
757
+ ]));
758
+ }
759
+ const Mt = /* @__PURE__ */ m(xt, [["render", kt]]);
760
+ export {
761
+ Mt as default
762
+ };