@opengis/admin 0.1.19 → 0.1.21

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,919 +0,0 @@
1
- import { _ as b, a as w } from "./import-file-C5Tvx4dB.js";
2
- import { u as B } from "./userMenu-CT1xO2Pt.js";
3
- import { openBlock as a, createElementBlock as i, createStaticVNode as V, createTextVNode as v, toDisplayString as $, createCommentVNode as M, createElementVNode as l, Fragment as x, resolveComponent as u, createVNode as p, withCtx as y, createBlock as k, withModifiers as N, renderList as C, withDirectives as E, vModelCheckbox as R, vModelText as G, resolveDynamicComponent as W, Transition as J, vShow as K } from "vue";
4
- const Q = {}, X = {
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 Y(e, t, r, o, s, n) {
15
- return a(), i("svg", X, t[0] || (t[0] = [
16
- V('<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 Z = /* @__PURE__ */ b(Q, [["render", Y]]), tt = {
20
- data() {
21
- return {
22
- currentSort: ""
23
- };
24
- },
25
- props: {
26
- data: {
27
- type: Object,
28
- default: () => null
29
- },
30
- activeColumn: { type: String }
31
- },
32
- computed: {
33
- label() {
34
- var e, t;
35
- return ((e = this.data) == null ? void 0 : e.ua) || ((t = this.data) == null ? void 0 : t.label) || this.data.title || "null";
36
- },
37
- selectedSortParam() {
38
- var e, t;
39
- return (t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.sort;
40
- },
41
- getVisibleIcon() {
42
- return this.data.format !== "image" && this.data.format !== "verify";
43
- }
44
- },
45
- watch: {
46
- activeColumn(e) {
47
- e !== this.data.name && (this.currentSort = "");
48
- }
49
- },
50
- methods: {
51
- changeCurrentSort(e) {
52
- switch (e) {
53
- case "":
54
- return "asc";
55
- case "asc":
56
- return "desc";
57
- case "desc":
58
- return "";
59
- default:
60
- return "";
61
- }
62
- },
63
- handleClickSortBtn(e) {
64
- this.$emit("change-active", this.data.name), this.currentSort = this.changeCurrentSort(e);
65
- const t = this.$route.query, { sort: r, ...o } = t, s = this.currentSort ? `${this.data.name}-${this.currentSort}` : "";
66
- this.$router.replace({
67
- query: {
68
- ...o,
69
- ...s && { sort: s }
70
- }
71
- });
72
- },
73
- isValueEqualToSelected(e) {
74
- return `${this.data.name}-${e}` === this.selectedSortParam;
75
- }
76
- }
77
- }, et = {
78
- scope: "col",
79
- class: "min-w-[200px] max-w-[300px] text-start"
80
- }, rt = {
81
- class: "flex-shrink-0 size-3.5",
82
- xmlns: "http://www.w3.org/2000/svg",
83
- width: "24",
84
- height: "24",
85
- viewBox: "0 0 24 24",
86
- fill: "none",
87
- stroke: "currentColor",
88
- "stroke-width": "2",
89
- "stroke-linecap": "round",
90
- "stroke-linejoin": "round"
91
- }, lt = {
92
- key: 0,
93
- d: "m7 15 5 5 5-5"
94
- }, st = {
95
- key: 1,
96
- d: "m7 9 5-5 5 5"
97
- }, nt = {
98
- key: 1,
99
- class: "text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"
100
- };
101
- function at(e, t, r, o, s, n) {
102
- return a(), i("th", et, [
103
- n.getVisibleIcon ? (a(), i("button", {
104
- key: 0,
105
- type: "button",
106
- class: "text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",
107
- onClick: t[0] || (t[0] = (m) => n.handleClickSortBtn(s.currentSort))
108
- }, [
109
- v($(n.label) + " ", 1),
110
- (a(), i("svg", rt, [
111
- s.currentSort === "asc" || s.currentSort === "" ? (a(), i("path", lt)) : M("", !0),
112
- s.currentSort === "desc" || s.currentSort === "" ? (a(), i("path", st)) : M("", !0)
113
- ]))
114
- ])) : (a(), i("p", nt, $(n.label), 1))
115
- ]);
116
- }
117
- const ot = /* @__PURE__ */ b(tt, [["render", at]]), it = {}, ct = {
118
- xmlns: "http://www.w3.org/2000/svg",
119
- viewBox: "0 0 24 24",
120
- fill: "none",
121
- stroke: "currentColor",
122
- "stroke-width": "2",
123
- "stroke-linecap": "round",
124
- "stroke-linejoin": "round",
125
- class: "icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"
126
- };
127
- function ut(e, t, r, o, s, n) {
128
- return a(), i("svg", ct, t[0] || (t[0] = [
129
- l("path", {
130
- stroke: "none",
131
- d: "M0 0h24v24H0z",
132
- fill: "none"
133
- }, null, -1),
134
- l("path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
135
- l("path", { d: "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
136
- l("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
137
- ]));
138
- }
139
- const dt = /* @__PURE__ */ b(it, [["render", ut]]), ht = {}, pt = {
140
- class: "flex-shrink-0 size-3.5",
141
- xmlns: "http://www.w3.org/2000/svg",
142
- viewBox: "0 0 24 24",
143
- fill: "none",
144
- stroke: "currentColor",
145
- "stroke-width": "2",
146
- "stroke-linecap": "round",
147
- "stroke-linejoin": "round"
148
- };
149
- function mt(e, t, r, o, s, n) {
150
- return a(), i("svg", pt, t[0] || (t[0] = [
151
- V('<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)
152
- ]));
153
- }
154
- const bt = /* @__PURE__ */ b(ht, [["render", mt]]), ft = {
155
- props: {
156
- height: { type: String, default: "16" },
157
- width: { type: String, default: "12" },
158
- color: { type: String, default: "black" }
159
- }
160
- }, gt = { style: { display: "none" } }, xt = ["height", "width", "fill"];
161
- function yt(e, t, r, o, s, n) {
162
- return a(), i(x, null, [
163
- (a(), i("svg", gt, t[0] || (t[0] = [
164
- l("symbol", {
165
- id: "icon-pencil",
166
- viewBox: "0 0 32 32"
167
- }, [
168
- l("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" })
169
- ], -1)
170
- ]))),
171
- (a(), i("svg", {
172
- height: r.height,
173
- width: r.width,
174
- fill: r.color
175
- }, t[1] || (t[1] = [
176
- l("use", { "xlink:href": "#icon-pencil" }, null, -1)
177
- ]), 8, xt))
178
- ], 64);
179
- }
180
- const _t = /* @__PURE__ */ b(ft, [["render", yt]]), kt = {
181
- components: {
182
- IconMore: dt,
183
- IconDelete: bt,
184
- IconEdit: _t
185
- },
186
- emits: ["updateTable"],
187
- props: { item: Object, table: String, isForm: null },
188
- data() {
189
- return {
190
- formVisible: !1,
191
- isDeleteConfirm: !1,
192
- formValue: {},
193
- top: 0,
194
- left: 0
195
- };
196
- },
197
- methods: {
198
- openConfirm() {
199
- this.isDeleteConfirm = !0, document.querySelector("body").click();
200
- },
201
- async getData() {
202
- var e;
203
- try {
204
- const { data: t } = await w.get(
205
- `/api/table/${this.table}/${(e = this.item) == null ? void 0 : e.id}`
206
- );
207
- this.formValue = t;
208
- } catch (t) {
209
- console.error(t);
210
- }
211
- },
212
- doSomethingOnCancel() {
213
- this.formVisible = !1;
214
- },
215
- async deleteElement() {
216
- var e;
217
- try {
218
- w.delete(`/api/table/${this.table}/${(e = this.item) == null ? void 0 : e.id}`), this.$notify({
219
- title: "Успішно!",
220
- message: "Об`єкт успішно видалeно",
221
- type: "success"
222
- }), await this.$emit("update-table"), this.isDeleteConfirm = !1;
223
- } catch {
224
- this.$notify({
225
- title: "Помилка!",
226
- message: "Сталася помилка",
227
- type: "error"
228
- });
229
- }
230
- }
231
- }
232
- }, wt = { class: "hs-dropdown [--placement:bottom-right] inline-flex" }, vt = {
233
- id: "hs-pro-dupc1",
234
- type: "button",
235
- class: "gap-x-2 p-2 rounded-lg hover:border-transparent focus:outline-none text-black hover:bg-gray-50"
236
- }, Ct = { class: "pt-[7px] pb-[7px] flex flex-col items-start" }, $t = {
237
- key: 1,
238
- class: "h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto mt-[10px] mb-[10px]"
239
- }, Mt = { class: "p-4" }, St = { class: "mt-4 flex justify-end gap-x-3" };
240
- function Tt(e, t, r, o, s, n) {
241
- const m = u("IconMore"), c = u("IconEdit"), f = u("router-link"), g = u("IconDelete"), S = u("VsPopover"), I = u("VsDialog");
242
- return a(), i(x, null, [
243
- l("div", wt, [
244
- p(S, {
245
- trigger: "click",
246
- placement: "left"
247
- }, {
248
- reference: y(() => [
249
- l("button", vt, [
250
- p(m, {
251
- height: "16",
252
- width: "16"
253
- })
254
- ])
255
- ]),
256
- default: y(() => {
257
- var _, T, F;
258
- return [
259
- l("div", Ct, [
260
- r.isForm ? (a(), k(f, {
261
- key: 0,
262
- to: `/edit?table=${(T = (_ = e.$route) == null ? void 0 : _.params) == null ? void 0 : T.catchAll}&id=${(F = r.item) == null ? void 0 : F.id}`,
263
- class: "w-[100px] ml-[2px] flex items-center justify-center gap-x-3 rounded-lg text-[13px] text-gray-800"
264
- }, {
265
- default: y(() => [
266
- p(c, { color: "#000" }),
267
- t[4] || (t[4] = v(" Редагувати "))
268
- ]),
269
- _: 1
270
- }, 8, ["to"])) : M("", !0),
271
- r.isForm ? (a(), i("div", $t)) : M("", !0),
272
- l("button", {
273
- onClick: t[0] || (t[0] = N((...D) => n.openConfirm && n.openConfirm(...D), ["stop"])),
274
- type: "button",
275
- class: "w-[100px] flex items-center justify-center gap-x-3 rounded-lg text-[14px] text-red-500"
276
- }, [
277
- p(g),
278
- t[5] || (t[5] = l("span", { class: "text-gray-800" }, "Видалити", -1))
279
- ])
280
- ])
281
- ];
282
- }),
283
- _: 1
284
- })
285
- ]),
286
- p(I, {
287
- visible: s.isDeleteConfirm,
288
- "onUpdate:visible": t[3] || (t[3] = (_) => s.isDeleteConfirm = _),
289
- title: "Ви впевнені?"
290
- }, {
291
- default: y(() => [
292
- l("div", Mt, [
293
- t[6] || (t[6] = l("p", { class: "mt-1 text-gray-500 dark:text-neutral-500" }, " Ви впевнені, що хочете видалити цей об'єкт? ", -1)),
294
- l("div", St, [
295
- l("button", {
296
- type: "button",
297
- 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",
298
- onClick: t[1] || (t[1] = (_) => s.isDeleteConfirm = !1)
299
- }, " Скасувати "),
300
- l("button", {
301
- type: "button",
302
- 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",
303
- onClick: t[2] || (t[2] = (..._) => n.deleteElement && n.deleteElement(..._))
304
- }, " Так, я впевнена/ий ")
305
- ])
306
- ])
307
- ]),
308
- _: 1
309
- }, 8, ["visible"])
310
- ], 64);
311
- }
312
- const Ft = /* @__PURE__ */ b(kt, [["render", Tt]]), Dt = {}, At = {
313
- class: "flex-shrink-0 mt-0.5 size-3.5",
314
- xmlns: "http://www.w3.org/2000/svg",
315
- viewBox: "0 0 24 24",
316
- fill: "none",
317
- stroke: "currentColor",
318
- "stroke-width": "2",
319
- "stroke-linecap": "round",
320
- "stroke-linejoin": "round"
321
- };
322
- function Vt(e, t, r, o, s, n) {
323
- return a(), i("svg", At, t[0] || (t[0] = [
324
- l("path", { d: "m3 16 4 4 4-4" }, null, -1),
325
- l("path", { d: "M7 20V4" }, null, -1),
326
- l("path", { d: "m21 8-4-4-4 4" }, null, -1),
327
- l("path", { d: "M17 4v16" }, null, -1)
328
- ]));
329
- }
330
- const It = /* @__PURE__ */ b(Dt, [["render", Vt]]), Bt = {
331
- props: {
332
- columns: { type: Object, default: () => {
333
- } },
334
- table: { type: String, default: () => "" }
335
- },
336
- data() {
337
- return {
338
- tableFormats: ["json", "csv", "xlsx"],
339
- format: "",
340
- cols: []
341
- };
342
- },
343
- methods: {
344
- async exportTable() {
345
- try {
346
- const e = await w.get("/api/export", {
347
- params: {
348
- table: this.table,
349
- format: this.format,
350
- cols: this.cols.join(",")
351
- },
352
- responseType: "blob"
353
- }), t = new Blob([e.data], {
354
- type: "application/octet-stream"
355
- }), r = window.URL.createObjectURL(t), o = document.createElement("a");
356
- o.href = r, o.setAttribute(
357
- "download",
358
- `${this.table.split(".")[0]}.${this.format}`
359
- ), document.body.appendChild(o), o.click(), document.body.removeChild(o), window.URL.revokeObjectURL(r), this.$notify({
360
- type: "success",
361
- title: "Експорт",
362
- message: "Файл успішно експортовано!"
363
- });
364
- } catch (e) {
365
- console.error("Ошибка при экспорте файла:", e), this.$notify({
366
- type: "error",
367
- title: "Помилка",
368
- message: "Не вдалося експортувати файл."
369
- });
370
- }
371
- },
372
- selectFormat(e) {
373
- this.format = e;
374
- }
375
- }
376
- }, Et = { class: "p-4" }, jt = { class: "pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700" }, zt = { class: "mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]" }, Pt = { class: "pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700" }, Ut = { class: "mt-2 space-y-2" }, Ot = ["id", "onChange"], Ht = ["for"], qt = { class: "pb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700" }, Lt = { class: "text-center" };
377
- function Nt(e, t, r, o, s, n) {
378
- const m = u("VsCheckbox");
379
- return a(), i(x, null, [
380
- t[4] || (t[4] = l("div", { class: "dark:border-neutral-700" }, null, -1)),
381
- l("div", Et, [
382
- l("div", jt, [
383
- t[2] || (t[2] = l("label", { class: "text-sm text-gray-500 dark:text-neutral-500" }, " Виберіть стовпці таблиці для експорту: ", -1)),
384
- l("div", zt, [
385
- (a(!0), i(x, null, C(r.columns, (c, f) => (a(), i("div", {
386
- class: "flex items-center",
387
- key: f,
388
- style: { width: "calc((100% - 10px) / 2)" }
389
- }, [
390
- p(m, {
391
- 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",
392
- modelValue: s.cols,
393
- "onUpdate:modelValue": t[0] || (t[0] = (g) => s.cols = g),
394
- value: c == null ? void 0 : c.name,
395
- label: c == null ? void 0 : c.ua
396
- }, null, 8, ["modelValue", "value", "label"])
397
- ]))), 128))
398
- ])
399
- ]),
400
- l("div", Pt, [
401
- t[3] || (t[3] = l("label", { class: "text-sm text-gray-500 dark:text-neutral-500" }, " Виберіть формат таблиці: ", -1)),
402
- l("div", Ut, [
403
- (a(!0), i(x, null, C(s.tableFormats, (c, f) => (a(), i("div", {
404
- class: "flex items-center",
405
- key: f
406
- }, [
407
- l("input", {
408
- type: "radio",
409
- name: "hs-pro-duecmfm",
410
- 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",
411
- id: c,
412
- onChange: (g) => n.selectFormat(c)
413
- }, null, 40, Ot),
414
- l("label", {
415
- for: c,
416
- class: "text-sm text-gray-800 ms-3 dark:text-neutral-400"
417
- }, " Формат " + $(c), 9, Ht)
418
- ]))), 128))
419
- ])
420
- ]),
421
- l("div", qt, [
422
- l("div", Lt, [
423
- l("button", {
424
- type: "button",
425
- 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",
426
- onClick: t[1] || (t[1] = (...c) => n.exportTable && n.exportTable(...c))
427
- }, " Завантажити таблицю ")
428
- ])
429
- ])
430
- ])
431
- ], 64);
432
- }
433
- const Rt = /* @__PURE__ */ b(Bt, [["render", Nt]]), Gt = {
434
- components: { IconExport: It, AdminTableExportForm: Rt },
435
- props: { table: String, columns: Array },
436
- data() {
437
- return {
438
- isOpen: !1
439
- };
440
- }
441
- };
442
- function Wt(e, t, r, o, s, n) {
443
- const m = u("IconExport"), c = u("AdminTableExportForm"), f = u("VsDialog");
444
- return a(), i(x, null, [
445
- l("button", {
446
- onClick: t[0] || (t[0] = (g) => s.isOpen = !0),
447
- 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"
448
- }, [
449
- p(m, {
450
- height: "16",
451
- width: "16"
452
- }),
453
- t[2] || (t[2] = v(" Експорт "))
454
- ]),
455
- p(f, {
456
- visible: s.isOpen,
457
- "onUpdate:visible": t[1] || (t[1] = (g) => s.isOpen = g),
458
- title: "Експорт таблиці"
459
- }, {
460
- default: y(() => [
461
- p(c, {
462
- table: r.table,
463
- columns: r.columns
464
- }, null, 8, ["table", "columns"])
465
- ]),
466
- _: 1
467
- }, 8, ["visible"])
468
- ], 64);
469
- }
470
- const Jt = /* @__PURE__ */ b(Gt, [["render", Wt]]), Kt = {}, Qt = {
471
- xmlns: "http://www.w3.org/2000/svg",
472
- viewBox: "0 0 24 24",
473
- fill: "none",
474
- stroke: "currentColor",
475
- "stroke-width": "2",
476
- "stroke-linecap": "round",
477
- "stroke-linejoin": "round",
478
- class: "icon icon-tabler icons-tabler-outline icon-tabler-columns"
479
- };
480
- function Xt(e, t, r, o, s, n) {
481
- return a(), i("svg", Qt, t[0] || (t[0] = [
482
- V('<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)
483
- ]));
484
- }
485
- const Yt = /* @__PURE__ */ b(Kt, [["render", Xt]]), Zt = {
486
- props: { column: Object },
487
- emits: ["update-column"],
488
- data() {
489
- return {
490
- value: !1
491
- };
492
- },
493
- watch: {
494
- value(e) {
495
- this.$emit("update-column", { ...this.column, hidden: !e });
496
- }
497
- },
498
- mounted() {
499
- var e;
500
- ((e = this.column) == null ? void 0 : e.hidden) !== !0 && (this.value = !0);
501
- }
502
- }, te = { class: "flex w-full gap-[8px] items-centr" };
503
- function ee(e, t, r, o, s, n) {
504
- var m, c;
505
- return a(), i("label", te, [
506
- E(l("input", {
507
- "onUpdate:modelValue": t[0] || (t[0] = (f) => s.value = f),
508
- type: "checkbox"
509
- }, null, 512), [
510
- [R, s.value]
511
- ]),
512
- v(" " + $(((m = r.column) == null ? void 0 : m.ua) || ((c = r.column) == null ? void 0 : c.title)), 1)
513
- ]);
514
- }
515
- const re = /* @__PURE__ */ b(Zt, [["render", ee]]), le = {
516
- components: { IconColumns: Yt, AdminTableColumnsHiddenItem: re },
517
- emits: ["update-columns"],
518
- props: { columns: Array },
519
- methods: {
520
- updateColumn(e) {
521
- const t = this.columns.findIndex((o) => (o == null ? void 0 : o.name) === (e == null ? void 0 : e.name)), r = this.columns;
522
- r[t] = e, this.$emit("update-columns", [...r]);
523
- }
524
- }
525
- }, se = { 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" }, ne = { 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" };
526
- function ae(e, t, r, o, s, n) {
527
- const m = u("IconColumns"), c = u("AdminTableColumnsHiddenItem"), f = u("VsPopover");
528
- return a(), k(f, {
529
- trigger: "click",
530
- placement: "bottom"
531
- }, {
532
- reference: y(() => [
533
- l("button", se, [
534
- p(m, {
535
- height: "20",
536
- width: "16"
537
- })
538
- ])
539
- ]),
540
- default: y(() => [
541
- l("div", null, [
542
- t[0] || (t[0] = l("h2", { class: "text-sm mb-[8px]" }, "Оберіть колонки, щоб приховати", -1)),
543
- l("ul", ne, [
544
- (a(!0), i(x, null, C(r.columns, (g, S) => (a(), i("li", { key: S }, [
545
- p(c, {
546
- column: g,
547
- onUpdateColumn: n.updateColumn
548
- }, null, 8, ["column", "onUpdateColumn"])
549
- ]))), 128))
550
- ])
551
- ])
552
- ]),
553
- _: 1
554
- });
555
- }
556
- const oe = /* @__PURE__ */ b(le, [["render", ae]]), ie = {}, ce = { class: "vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden" };
557
- function ue(e, t, r, o, s, n) {
558
- return a(), i("div", ce, t[0] || (t[0] = [
559
- V('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>', 1)
560
- ]));
561
- }
562
- const de = /* @__PURE__ */ b(ie, [["render", ue]]), he = {
563
- props: { table: String },
564
- components: {
565
- IconFilter: Z,
566
- AdminTableControl: Ft,
567
- AdminTableExport: Jt,
568
- AdminTableColumnsHidden: oe,
569
- AdminTableColumn: ot,
570
- AdminNodata: de
571
- },
572
- data() {
573
- return {
574
- tableData: {},
575
- isFilters: !1,
576
- filterScheme: [],
577
- page: 1,
578
- searchValue: "",
579
- limit: 20,
580
- filters: null,
581
- activeColumn: ""
582
- };
583
- },
584
- mounted() {
585
- var e, t;
586
- this.page = ((t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.page) || 1, this.getTableData(), this.getFilters();
587
- },
588
- computed: {
589
- defaultPage() {
590
- var e, t;
591
- return ((t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.page) || 1;
592
- },
593
- getFilterScheme() {
594
- var e;
595
- return (e = this.tableData) == null ? void 0 : e.filters;
596
- },
597
- columns() {
598
- var e, t;
599
- return (t = (e = this.tableData) == null ? void 0 : e.columns) == null ? void 0 : t.filter((r) => (r == null ? void 0 : r.hidden) !== !0);
600
- },
601
- isForm() {
602
- var e;
603
- return (e = this.tableData) == null ? void 0 : e.form;
604
- },
605
- isNoData() {
606
- var e, t;
607
- return !((e = this.tableData) != null && e.rows) || !((t = this.columns) != null && t.length);
608
- }
609
- },
610
- watch: {
611
- async table() {
612
- await this.getTableData();
613
- },
614
- searchValue() {
615
- this.getTableData();
616
- },
617
- $route: {
618
- handler(e, t) {
619
- var r, o;
620
- ((r = e == null ? void 0 : e.params) == null ? void 0 : r.catchAll) !== ((o = t == null ? void 0 : t.params) == null ? void 0 : o.catchAll) && (this.filterScheme = null, this.getFilters());
621
- },
622
- deep: !0
623
- }
624
- },
625
- methods: {
626
- async getTableData() {
627
- var e, t;
628
- try {
629
- const { data: r } = await w.get(`/api/template/table/${this.table}`), o = await w.get(`/api/table-data/${this.table}`, {
630
- params: {
631
- page: this.page,
632
- search: this.searchValue || null,
633
- limit: this.limit,
634
- filter: this.filters || null,
635
- order: ((t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.sort) || null
636
- }
637
- });
638
- this.tableData = {
639
- ...r,
640
- ...(o == null ? void 0 : o.data) || {}
641
- };
642
- } catch {
643
- }
644
- },
645
- async getFilters() {
646
- var e;
647
- try {
648
- const { data: t } = await w.get(`/api/table-filter/${this.table}`);
649
- this.filterScheme = (e = t == null ? void 0 : t.list) == null ? void 0 : e.map((r) => ({
650
- ...r,
651
- label: (r == null ? void 0 : r.label) || (r == null ? void 0 : r.ua)
652
- }));
653
- } catch {
654
- }
655
- },
656
- async handlePageChange(e) {
657
- const t = this.$route.query;
658
- this.page = e, !(!(t != null && t.page) && e === 1 || t.page === e) && (await this.$router.replace({ query: { ...t, page: e } }), await this.getTableData());
659
- },
660
- async changeLimit(e) {
661
- this.limit = await e, this.defaultPage = 1, await this.getTableData();
662
- },
663
- closeFilter({ target: e }) {
664
- this.isFilters && e.classList.contains("filter-container") && (this.isFilters = !1);
665
- },
666
- async filterChange({ url: e }) {
667
- this.filters = e, this.page = 1, await this.getTableData();
668
- },
669
- changeActiveColumn(e) {
670
- this.activeColumn = e, this.getTableData();
671
- }
672
- }
673
- }, pe = { class: "w-[calc(100vw - 320px)]" }, me = { class: "h-[58px] bg-gray-50 flex items-center justify-between px-[30px]" }, be = { class: "text-xl font-medium" }, fe = {
674
- style: { height: "calc(100vh - 120px)", width: "calc(100vw - 260px)" },
675
- class: "bg-gray-50 p-[20px] flex pt-[10px]"
676
- }, ge = { class: "bg-white w-full rounded-xl border p-[20px]" }, xe = { class: "flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px]" }, ye = { class: "flex gap-[6px] ml-auto" }, _e = { class: "space-y-5 flex items-start w-full justify-start" }, ke = {
677
- style: { height: "calc(100vh - 310px)" },
678
- class: "overflow-x-auto w-full border-t [&::-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"
679
- }, we = { class: "inline-block w-full align-middle" }, ve = {
680
- key: 0,
681
- class: "divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"
682
- }, Ce = { class: "sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200" }, $e = { class: "border-stone-200 right-0 z-[1]" }, Me = { class: "divide-y divide-gray-200" }, Se = { class: "min-w-[200px] text-start pe-4 py-3 text-sm text-gray-600" }, Te = { class: "text-center sticky right-0 bg-white w-[80px] px-[10px]" }, Fe = { class: "p-[20px] flex justify-end w-full" }, De = { class: "filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] 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" };
683
- function Ae(e, t, r, o, s, n) {
684
- var D, j, z, P, U, O, H;
685
- const m = u("router-link"), c = u("AdminTableColumnsHidden"), f = u("AdminTableExport"), g = u("IconFilter"), S = u("AdminTableColumn"), I = u("AdminTableControl"), _ = u("AdminNodata"), T = u("VsPagination"), F = u("VsFilter");
686
- return a(), i(x, null, [
687
- l("div", pe, [
688
- l("div", me, [
689
- l("h2", be, $((D = s.tableData) == null ? void 0 : D.title), 1),
690
- n.isForm ? (a(), k(m, {
691
- key: 0,
692
- to: `/add?table=${(z = (j = e.$route) == null ? void 0 : j.params) == null ? void 0 : z.catchAll}`,
693
- 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"
694
- }, {
695
- default: y(() => t[5] || (t[5] = [
696
- v(" Додати ")
697
- ])),
698
- _: 1
699
- }, 8, ["to"])) : M("", !0)
700
- ]),
701
- l("div", fe, [
702
- l("div", ge, [
703
- l("div", xe, [
704
- E(l("input", {
705
- "onUpdate:modelValue": t[0] || (t[0] = (d) => s.searchValue = d),
706
- 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",
707
- placeholder: "Пошук..."
708
- }, null, 512), [
709
- [G, s.searchValue]
710
- ]),
711
- l("div", ye, [
712
- p(c, {
713
- columns: (P = s.tableData) == null ? void 0 : P.columns,
714
- onUpdateColumns: t[1] || (t[1] = (d) => s.tableData.columns = d)
715
- }, null, 8, ["columns"]),
716
- p(f, {
717
- table: r.table,
718
- columns: (U = s.tableData) == null ? void 0 : U.columns
719
- }, null, 8, ["table", "columns"]),
720
- l("button", {
721
- onClick: t[2] || (t[2] = (d) => s.isFilters = !s.isFilters),
722
- 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"
723
- }, [
724
- p(g, {
725
- height: "16",
726
- width: "16"
727
- }),
728
- t[6] || (t[6] = v(" Фільтри "))
729
- ])
730
- ])
731
- ]),
732
- l("div", _e, [
733
- l("div", ke, [
734
- l("div", we, [
735
- n.isNoData ? (a(), k(_, { key: 1 })) : (a(), i("table", ve, [
736
- l("thead", Ce, [
737
- l("tr", $e, [
738
- (a(!0), i(x, null, C(n.columns, (d) => (a(), k(S, {
739
- key: d.name,
740
- data: d,
741
- activeColumn: s.activeColumn,
742
- onChangeActive: n.changeActiveColumn
743
- }, null, 8, ["data", "activeColumn", "onChangeActive"]))), 128)),
744
- t[7] || (t[7] = l("th", { class: "w-[70px] sticky right-0 top-0 bg-white" }, null, -1))
745
- ])
746
- ]),
747
- l("tbody", Me, [
748
- (a(!0), i(x, null, C((O = s.tableData) == null ? void 0 : O.rows, (d, A) => {
749
- var q;
750
- return a(), i("tr", { key: A }, [
751
- l("td", Se, [
752
- p(m, {
753
- to: `/card/${r.table}/${d == null ? void 0 : d.id}`,
754
- class: "text-sm text-green-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline hover:text-green-600"
755
- }, {
756
- default: y(() => {
757
- var h;
758
- return [
759
- v($(d == null ? void 0 : d[(h = n.columns[0]) == null ? void 0 : h.name]), 1)
760
- ];
761
- }),
762
- _: 2
763
- }, 1032, ["to"])
764
- ]),
765
- (a(!0), i(x, null, C((q = n.columns) == null ? void 0 : q.slice(1), (h) => {
766
- var L;
767
- return a(), i("td", {
768
- class: "min-w-[300px] w-full text-start px-[4px] py-3 text-sm text-gray-600",
769
- key: h.name
770
- }, [
771
- (a(), k(W(
772
- (h == null ? void 0 : h.format) === "custom" ? h == null ? void 0 : h.component : e.$componentsConfig[`table-format-${((L = h == null ? void 0 : h.format) == null ? void 0 : L.toLowerCase()) || e.text}`]
773
- ), {
774
- name: h == null ? void 0 : h.name,
775
- data: d,
776
- value: d == null ? void 0 : d[h == null ? void 0 : h.name]
777
- }, null, 8, ["name", "data", "value"]))
778
- ]);
779
- }), 128)),
780
- l("td", Te, [
781
- p(I, {
782
- isForm: n.isForm,
783
- item: d,
784
- table: r.table,
785
- onUpdateTable: n.getTableData
786
- }, null, 8, ["isForm", "item", "table", "onUpdateTable"])
787
- ])
788
- ]);
789
- }), 128))
790
- ])
791
- ]))
792
- ])
793
- ])
794
- ]),
795
- l("div", Fe, [
796
- p(T, {
797
- goTo: !1,
798
- class: "justify-end",
799
- "default-page": n.defaultPage,
800
- total: ((H = s.tableData) == null ? void 0 : H.total) || 0,
801
- pageSize: s.limit,
802
- onPageChange: n.handlePageChange,
803
- pageSizes: [10, 16, 20],
804
- onPageSizeChange: n.changeLimit
805
- }, null, 8, ["default-page", "total", "pageSize", "onPageChange", "onPageSizeChange"])
806
- ])
807
- ])
808
- ])
809
- ]),
810
- p(J, { name: "fade" }, {
811
- default: y(() => {
812
- var d;
813
- return [
814
- E(l("div", {
815
- onClick: t[4] || (t[4] = (...A) => n.closeFilter && n.closeFilter(...A)),
816
- style: { height: "100vh" },
817
- class: "fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"
818
- }, [
819
- l("div", De, [
820
- (d = s.filterScheme) != null && d.length ? (a(), k(F, {
821
- key: 0,
822
- ref: "filter",
823
- scheme: s.filterScheme,
824
- layout: "default",
825
- "apply-vue-router": "",
826
- history: "",
827
- name: "filter",
828
- onFilterChange: n.filterChange,
829
- closeFilterBtn: !0,
830
- onFilterClose: t[3] || (t[3] = (A) => s.isFilters = !1)
831
- }, null, 8, ["scheme", "onFilterChange"])) : M("", !0)
832
- ])
833
- ], 512), [
834
- [K, s.isFilters]
835
- ])
836
- ];
837
- }),
838
- _: 1
839
- })
840
- ], 64);
841
- }
842
- const Ve = /* @__PURE__ */ b(he, [["render", Ae]]), Ie = {
843
- components: { AdminTable: Ve },
844
- data() {
845
- return {
846
- table: !1,
847
- interface: "",
848
- title: ""
849
- };
850
- },
851
- watch: {
852
- $route: {
853
- async handler() {
854
- var e;
855
- (e = B) != null && e.value || await this.getMenu(), await this.checkPageType();
856
- },
857
- deep: !0
858
- },
859
- title(e) {
860
- e && (document.title = e);
861
- }
862
- },
863
- async mounted() {
864
- await this.checkPageType();
865
- },
866
- methods: {
867
- flattenMenu(e) {
868
- const t = [];
869
- return e.forEach((r) => {
870
- r.menu ? t.push(...this.flattenMenu(r.menu)) : t.push(r);
871
- }), t;
872
- },
873
- async getMenu() {
874
- try {
875
- const { data: e } = await w.get("/api/user-menu");
876
- B.value = e;
877
- } catch {
878
- }
879
- },
880
- async checkPageType() {
881
- const e = this.flattenMenu(B.value);
882
- e != null && e.length || this.$router.replace("/404");
883
- const t = e == null ? void 0 : e.find((o) => {
884
- var s, n;
885
- return (o == null ? void 0 : o.path) == ((n = (s = this.$route) == null ? void 0 : s.params) == null ? void 0 : n.catchAll);
886
- });
887
- this.title = t == null ? void 0 : t.ua, t || this.$router.replace("/404");
888
- const r = t == null ? void 0 : t.table;
889
- this.table = r || !1, !r && this.getInterface();
890
- },
891
- async getInterface() {
892
- var e, t;
893
- try {
894
- const { data: r } = await w.get(
895
- `/api/template/interface/${((t = (e = this.$route) == null ? void 0 : e.params) == null ? void 0 : t.catchAll) || ""}`
896
- );
897
- this.interface = r || "";
898
- } catch {
899
- this.interface = "";
900
- }
901
- }
902
- }
903
- }, Be = ["innerHTML"];
904
- function Ee(e, t, r, o, s, n) {
905
- const m = u("AdminTable");
906
- return s.table ? (a(), k(m, {
907
- key: 0,
908
- table: s.table
909
- }, null, 8, ["table"])) : (a(), i("div", {
910
- key: 1,
911
- class: "w-full bg-gray-50",
912
- style: { height: "calc(100vh - 120px)" },
913
- innerHTML: s.interface
914
- }, null, 8, Be));
915
- }
916
- const Ue = /* @__PURE__ */ b(Ie, [["render", Ee]]);
917
- export {
918
- Ue as default
919
- };