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