@opengis/surveyor 0.0.0-stage → 0.0.2

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 (139) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +188 -3
  3. package/dist/chunks/AppIcon-CIR6y5uE.js +85 -0
  4. package/dist/chunks/AppealDetailField-CI-1qhs3.js +58 -0
  5. package/dist/chunks/AppealStatusBadge-CSXnfarR.js +132 -0
  6. package/dist/chunks/AppealStatusBadge-DYBe9hqP.js +171 -0
  7. package/dist/chunks/ApplicationHistorySection-C0wwhwA4.js +769 -0
  8. package/dist/chunks/BaseModal-C7PVYz0m.js +85 -0
  9. package/dist/chunks/FormFilePicker-C3XQw50i.js +76 -0
  10. package/dist/chunks/MapLayerMenu-DjYCxEc3.js +145 -0
  11. package/dist/chunks/RegistryForm-CEUqFmsF.js +99 -0
  12. package/dist/chunks/RegistryFormModal-DfY4z_7r.js +85 -0
  13. package/dist/chunks/RegistryToolbar-BV4mYVAc.js +452 -0
  14. package/dist/chunks/UserAccessBadge-D8JfgGfN.js +44 -0
  15. package/dist/chunks/UserTypeBadge-YIwwoCho.js +188 -0
  16. package/dist/chunks/VerifiedBadge-Bba8WnuB.js +34 -0
  17. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  18. package/dist/chunks/account-types-Br7gx_D_.js +35 -0
  19. package/dist/chunks/account_types-DLL1w122.js +25 -0
  20. package/dist/chunks/appealMapLayers-CQMK3rrz.js +115 -0
  21. package/dist/chunks/application_status-BhNGiY2I.js +45 -0
  22. package/dist/chunks/applications-BB9JRcgl.js +132 -0
  23. package/dist/chunks/buildSchema-CccjX9TJ.js +37 -0
  24. package/dist/chunks/card-B-ftozcq.js +739 -0
  25. package/dist/chunks/card-BctFHFZe.js +538 -0
  26. package/dist/chunks/card-CKD1N0QD.js +330 -0
  27. package/dist/chunks/card-CiNZxAd5.js +297 -0
  28. package/dist/chunks/card-DUtDfwMk.js +607 -0
  29. package/dist/chunks/card-fL26_Gvc.js +1189 -0
  30. package/dist/chunks/certificates-BSd1i0un.js +424 -0
  31. package/dist/chunks/create-DxMC_IL1.js +1033 -0
  32. package/dist/chunks/filterQuery-CvfZrkTC.js +99 -0
  33. package/dist/chunks/form-Bh6i5n1U.js +315 -0
  34. package/dist/chunks/form-DDjELqZ9.js +89 -0
  35. package/dist/chunks/geometry-DyhIVRcw.js +67 -0
  36. package/dist/chunks/map-Z57iMvFb.js +2763 -0
  37. package/dist/chunks/map-layers-DnmkOEld.js +400 -0
  38. package/dist/chunks/mapLayersApi-CWoQ2be-.js +251 -0
  39. package/dist/chunks/organizations-BO1_JETm.js +476 -0
  40. package/dist/chunks/organizations-BbYipLwk.js +14 -0
  41. package/dist/chunks/profile-ByahbF4B.js +164 -0
  42. package/dist/chunks/profile-Dwwn_4Pr.js +243 -0
  43. package/dist/chunks/requests-BCin936Z.js +232 -0
  44. package/dist/chunks/requests-CFv5wwAN.js +530 -0
  45. package/dist/chunks/resendSurveyorRegistration-BHTTVIw1.js +27 -0
  46. package/dist/chunks/resources-2e8RFqWR.js +129 -0
  47. package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
  48. package/dist/chunks/surveyorAccount-C7UiiIYg.js +78 -0
  49. package/dist/chunks/users-DtTYsgMb.js +291 -0
  50. package/dist/chunks/work_types-Hwme-FEX.js +34 -0
  51. package/dist/index.css +3 -0
  52. package/dist/index.js +336 -0
  53. package/migrations/20260924120000_surveyor_schema.sql +450 -0
  54. package/migrations/20261008170000_address_lookup.sql +20 -0
  55. package/migrations/20261016120000_map_layers.sql +156 -0
  56. package/migrations/20261016150000_password_reset.sql +15 -0
  57. package/migrations/20261016170000_address_lookup_format.sql +37 -0
  58. package/migrations/20261016180000_settlement_lookup.sql +16 -0
  59. package/migrations/20261019170000_actor_lookup.sql +15 -0
  60. package/package.json +86 -6
  61. package/plugin.d.ts +15 -0
  62. package/plugin.js +8 -0
  63. package/server/app.ts +51 -0
  64. package/server/dictionaries/index.ts +17 -0
  65. package/server/dictionaries/surveyor/account_types.ts +12 -0
  66. package/server/dictionaries/surveyor/application_status.ts +16 -0
  67. package/server/dictionaries/surveyor/map_layer_components.ts +11 -0
  68. package/server/dictionaries/surveyor/map_layer_groups.ts +10 -0
  69. package/server/dictionaries/surveyor/map_layer_types.ts +11 -0
  70. package/server/dictionaries/surveyor/work_types.ts +15 -0
  71. package/server/dictionaries/surveyor/yes_no.ts +11 -0
  72. package/server/fastify.d.ts +12 -0
  73. package/server/index.ts +23 -0
  74. package/server/modules/surveyor/route.ts +410 -0
  75. package/server/modules/surveyor/schema.ts +439 -0
  76. package/server/modules/surveyor/services/applicationTile.ts +53 -0
  77. package/server/modules/surveyor/services/cancelApplication.ts +74 -0
  78. package/server/modules/surveyor/services/changeSurveyorPassword.ts +52 -0
  79. package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -0
  80. package/server/modules/surveyor/services/completeApplication.ts +46 -0
  81. package/server/modules/surveyor/services/completeSurveyorRegistration.ts +48 -0
  82. package/server/modules/surveyor/services/createApplication.ts +169 -0
  83. package/server/modules/surveyor/services/geometryExport.ts +34 -0
  84. package/server/modules/surveyor/services/geometryImport.ts +66 -0
  85. package/server/modules/surveyor/services/getSurveyorUser.ts +56 -0
  86. package/server/modules/surveyor/services/identifyApplications.ts +82 -0
  87. package/server/modules/surveyor/services/issueSourceData.ts +55 -0
  88. package/server/modules/surveyor/services/loginSurveyor.ts +67 -0
  89. package/server/modules/surveyor/services/mapLayers.ts +61 -0
  90. package/server/modules/surveyor/services/rasterExport.ts +15 -0
  91. package/server/modules/surveyor/services/registerSurveyor.ts +161 -0
  92. package/server/modules/surveyor/services/requestPasswordReset.ts +49 -0
  93. package/server/modules/surveyor/services/resendRegistration.ts +42 -0
  94. package/server/modules/surveyor/services/resetSurveyorPassword.ts +53 -0
  95. package/server/modules/surveyor/services/searchApplications.ts +63 -0
  96. package/server/modules/surveyor/services/submitSurvey.ts +70 -0
  97. package/server/modules/surveyor/services/updateSurveyorAccountStatus.ts +52 -0
  98. package/server/modules/surveyor/services/updateSurveyorStatus.ts +53 -0
  99. package/server/modules/surveyor/services/vectorExport.ts +86 -0
  100. package/server/modules/surveyor/services/verifyApplication.ts +59 -0
  101. package/server/modules/surveyor/utils/accessibleApplication.ts +37 -0
  102. package/server/modules/surveyor/utils/application.ts +68 -0
  103. package/server/modules/surveyor/utils/export.ts +39 -0
  104. package/server/modules/surveyor/utils/firstBoundary.ts +48 -0
  105. package/server/modules/surveyor/utils/mail.ts +161 -0
  106. package/server/modules/surveyor/utils/permissions.ts +29 -0
  107. package/server/modules/surveyor/utils/registration.ts +33 -0
  108. package/server/modules/surveyor/utils/shared.ts +305 -0
  109. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -0
  110. package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -0
  111. package/server/modules/surveyor/utils/templates/ds.surveyor_registration.pt.hbs +80 -0
  112. package/server/modules/surveyor/utils/templates/ds.surveyor_send_mail.pt.hbs +79 -0
  113. package/server/modules/surveyor/utils/vectorLayer.ts +41 -0
  114. package/server/plugins/convertVector.ts +74 -0
  115. package/server/plugins/proto/convertVector.proto +21 -0
  116. package/server/plugins/swagger.ts +54 -0
  117. package/server/plugins/vite.dev.ts +52 -0
  118. package/server/plugins/vite.prod.ts +55 -0
  119. package/server/resources/helpers/actor_lookup.ts +5 -0
  120. package/server/resources/helpers/address_lookup.ts +8 -0
  121. package/server/resources/helpers/settlement_lookup.ts +7 -0
  122. package/server/resources/helpers/user_lookup.ts +5 -0
  123. package/server/resources/index.ts +30 -0
  124. package/server/resources/surveyor-admin/application_comments.ts +24 -0
  125. package/server/resources/surveyor-admin/application_status_history.ts +46 -0
  126. package/server/resources/surveyor-admin/applications.ts +125 -0
  127. package/server/resources/surveyor-admin/certificates.ts +87 -0
  128. package/server/resources/surveyor-admin/map_layers.ts +69 -0
  129. package/server/resources/surveyor-admin/organization_surveyors.ts +32 -0
  130. package/server/resources/surveyor-admin/organizations.ts +61 -0
  131. package/server/resources/surveyor-admin/surveyors.ts +71 -0
  132. package/server/resources/surveyor-user/application_status_history.ts +52 -0
  133. package/server/resources/surveyor-user/applications.ts +131 -0
  134. package/server/resources/surveyor-user/certificates.ts +67 -0
  135. package/server/resources/surveyor-user/organizations.ts +40 -0
  136. package/server/resources/surveyor-user/surveyors.ts +69 -0
  137. package/server/suggests/index.ts +17 -0
  138. package/server/tsconfig.json +3 -0
  139. package/surveyor-types.d.ts +30 -0
@@ -0,0 +1,400 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
+ import { t as n } from "./AppIcon-CIR6y5uE.js";
4
+ import { i as r, n as i } from "./resources-2e8RFqWR.js";
5
+ import { r as a } from "./filterQuery-CvfZrkTC.js";
6
+ import { a as o, i as s, n as c, r as l, t as u } from "./RegistryToolbar-BV4mYVAc.js";
7
+ import { t as d } from "./RegistryFormModal-DfY4z_7r.js";
8
+ import { i as f, n as p, o as m, r as h, s as g, t as _ } from "./form-Bh6i5n1U.js";
9
+ import { Teleport as v, computed as y, createBlock as b, createCommentVNode as x, createElementBlock as S, createElementVNode as C, createTextVNode as w, createVNode as T, defineComponent as E, normalizeClass as D, normalizeStyle as O, onMounted as k, onUnmounted as A, openBlock as j, ref as M, toDisplayString as N, vModelText as P, withCtx as F, withDirectives as I, withModifiers as L } from "vue";
10
+ import { RouterLink as R, useRouter as z } from "vue-router";
11
+ import { confirm as B, notify as V } from "@opengis/core";
12
+ //#region admin/src/static/registry/map-layers/table.ts
13
+ var H = {
14
+ resource: g,
15
+ pageSize: 20,
16
+ sort: "sort_order",
17
+ columns: [
18
+ {
19
+ key: "name",
20
+ label: "Назва шару"
21
+ },
22
+ {
23
+ key: "code",
24
+ label: "Код"
25
+ },
26
+ {
27
+ key: "layer_group",
28
+ label: "Група"
29
+ },
30
+ {
31
+ key: "layer_type",
32
+ label: "Тип"
33
+ },
34
+ {
35
+ key: "components",
36
+ label: "Компоненти"
37
+ },
38
+ {
39
+ key: "sort_order",
40
+ label: "Порядок"
41
+ },
42
+ {
43
+ key: "is_default",
44
+ label: "За замовчуванням"
45
+ },
46
+ {
47
+ key: "enabled",
48
+ label: "Увімкнено"
49
+ },
50
+ {
51
+ key: "actions",
52
+ label: "Дії"
53
+ }
54
+ ]
55
+ }, U = {
56
+ resource: g,
57
+ view: "inline",
58
+ fields: {
59
+ layer_group: {
60
+ component: "select",
61
+ label: "Група",
62
+ placeholder: "Група",
63
+ width: 180,
64
+ options: h
65
+ },
66
+ layer_type: {
67
+ component: "select",
68
+ label: "Тип",
69
+ placeholder: "Тип",
70
+ width: 180,
71
+ options: f
72
+ },
73
+ enabled: {
74
+ component: "select",
75
+ label: "Стан",
76
+ placeholder: "Стан",
77
+ width: 160,
78
+ options: [{
79
+ id: "true",
80
+ text: "Увімкнені"
81
+ }, {
82
+ id: "false",
83
+ text: "Вимкнені"
84
+ }]
85
+ }
86
+ }
87
+ }, W = /* @__PURE__ */ e({
88
+ filter: () => U,
89
+ form: () => _,
90
+ resource: () => g,
91
+ table: () => H
92
+ }), G = /*@__PURE__*/ E({
93
+ __name: "index",
94
+ setup(e, { expose: t }) {
95
+ t();
96
+ let _ = H.columns, { query: v, filterValues: b, page: x, pageSize: S, listFilters: C, bindListLoader: w, refreshList: T } = o({ buildFilters: a }), E = M([]), D = M(0), O = M(!1), j = M(""), N = M(!1), P = M(null), F = M({
97
+ top: "0px",
98
+ left: "0px"
99
+ }), I = z(), L = y(() => O.value ? "Завантаження…" : j.value ? j.value : "Шарів за заданими фільтрами не знайдено.");
100
+ function U(e, t) {
101
+ if (P.value === e) {
102
+ P.value = null;
103
+ return;
104
+ }
105
+ let n = t.currentTarget.getBoundingClientRect(), r = window.innerHeight - n.bottom < 100 ? n.top - 92 - 4 : n.bottom + 4, i = Math.min(Math.max(8, n.right - 176), window.innerWidth - 176 - 8);
106
+ F.value = {
107
+ top: `${r}px`,
108
+ left: `${i}px`
109
+ }, P.value = e;
110
+ }
111
+ function G(e) {
112
+ let t = e.target;
113
+ t instanceof Element && t.closest("[data-row-actions]") || (P.value = null);
114
+ }
115
+ function K(e) {
116
+ P.value = null, I.push({
117
+ name: "map-layer-detail",
118
+ params: { id: e.layer_id },
119
+ query: { edit: "1" }
120
+ });
121
+ }
122
+ function q(e) {
123
+ P.value = null, B({
124
+ title: "Підтвердження",
125
+ type: "error",
126
+ message: `Видалити шар «${e.name}»?`,
127
+ confirmButtonText: "Видалити",
128
+ cancelButtonText: "Скасувати",
129
+ onConfirm: async () => {
130
+ try {
131
+ await i(g, e.layer_id), E.value.length === 1 && x.value > 1 ? --x.value : await Y();
132
+ } catch (e) {
133
+ V({
134
+ type: "error",
135
+ title: "Помилка видалення",
136
+ message: e instanceof Error ? e.message : "Не вдалося видалити шар"
137
+ });
138
+ }
139
+ }
140
+ });
141
+ }
142
+ let J = 0;
143
+ async function Y() {
144
+ let e = ++J;
145
+ O.value = !0, j.value = "";
146
+ try {
147
+ let t = await r(g, {
148
+ page: x.value,
149
+ limit: S.value,
150
+ sort: H.sort,
151
+ search: v.value.trim() || void 0,
152
+ filters: C.value
153
+ });
154
+ if (e !== J) return;
155
+ E.value = t.rows ?? [], D.value = Number(t.total) || 0;
156
+ } catch (t) {
157
+ if (e !== J) return;
158
+ E.value = [], D.value = 0, j.value = t instanceof Error ? t.message : "Не вдалося завантажити шари";
159
+ } finally {
160
+ e === J && (O.value = !1);
161
+ }
162
+ }
163
+ w(() => {
164
+ P.value = null, Y();
165
+ });
166
+ function X(e) {
167
+ b.value = e;
168
+ }
169
+ function Z() {
170
+ x.value === 1 ? T(() => {
171
+ Y();
172
+ }) : x.value = 1;
173
+ }
174
+ function Q(e) {
175
+ return e?.length ? e.map((e) => m(p, e)).join(", ") : "—";
176
+ }
177
+ k(() => {
178
+ document.addEventListener("click", G), window.addEventListener("resize", G), window.addEventListener("scroll", G, !0);
179
+ }), A(() => {
180
+ document.removeEventListener("click", G), window.removeEventListener("resize", G), window.removeEventListener("scroll", G, !0);
181
+ });
182
+ let $ = {
183
+ columns: _,
184
+ query: v,
185
+ filterValues: b,
186
+ page: x,
187
+ pageSize: S,
188
+ listFilters: C,
189
+ bindListLoader: w,
190
+ refreshList: T,
191
+ rows: E,
192
+ total: D,
193
+ loading: O,
194
+ error: j,
195
+ showAddModal: N,
196
+ actionsOpen: P,
197
+ menuStyle: F,
198
+ router: I,
199
+ emptyText: L,
200
+ toggleActions: U,
201
+ closeActions: G,
202
+ editLayer: K,
203
+ removeLayer: q,
204
+ get requestId() {
205
+ return J;
206
+ },
207
+ set requestId(e) {
208
+ J = e;
209
+ },
210
+ loadRows: Y,
211
+ onFilterValuesUpdate: X,
212
+ onLayerSaved: Z,
213
+ componentsText: Q,
214
+ colWidths: {
215
+ name: "w-[240px]",
216
+ code: "w-[140px]",
217
+ layer_group: "w-[150px]",
218
+ layer_type: "w-[150px]",
219
+ components: "w-[260px]",
220
+ sort_order: "w-[100px]",
221
+ is_default: "w-[140px]",
222
+ enabled: "w-[120px]",
223
+ actions: "w-[80px]"
224
+ },
225
+ AppIcon: n,
226
+ get RouterLink() {
227
+ return R;
228
+ },
229
+ PageHeader: s,
230
+ RegistryTable: l,
231
+ TablePagination: c,
232
+ RegistryFormModal: d,
233
+ RegistryToolbar: u,
234
+ get config() {
235
+ return W;
236
+ },
237
+ get LAYER_GROUP_OPTIONS() {
238
+ return h;
239
+ },
240
+ get LAYER_TYPE_OPTIONS() {
241
+ return f;
242
+ },
243
+ get optionText() {
244
+ return m;
245
+ }
246
+ };
247
+ return Object.defineProperty($, "__isScriptSetup", {
248
+ enumerable: !1,
249
+ value: !0
250
+ }), $;
251
+ }
252
+ }), K = { class: "px-4" }, q = { class: "relative block" }, J = { class: "mt-3 flex items-center justify-between border-t border-slate-100 pt-3 text-xs text-slate-400" }, Y = { class: "font-semibold text-slate-600" }, X = {
253
+ key: 1,
254
+ class: "text-xs text-slate-600"
255
+ }, Z = {
256
+ key: 2,
257
+ class: "text-slate-600"
258
+ }, Q = {
259
+ key: 3,
260
+ class: "text-slate-600"
261
+ }, $ = {
262
+ key: 4,
263
+ class: "block break-words text-slate-600"
264
+ }, ee = {
265
+ key: 5,
266
+ class: "text-slate-600"
267
+ }, te = {
268
+ key: 6,
269
+ class: "text-slate-600"
270
+ }, ne = {
271
+ key: 8,
272
+ class: "flex justify-center"
273
+ }, re = [
274
+ "aria-expanded",
275
+ "aria-label",
276
+ "onClick"
277
+ ], ie = ["onClick"], ae = ["onClick"];
278
+ function oe(e, t, n, r, i, a) {
279
+ return j(), S("div", null, [
280
+ T(r.PageHeader, {
281
+ title: "Шари карти",
282
+ subtitle: "Базові та додаткові шари для карти, форми окреслення геометрії та картки заявки"
283
+ }, {
284
+ default: F(() => [C("button", {
285
+ type: "button",
286
+ class: "inline-flex h-10 items-center justify-center gap-2 rounded-lg bg-brand-600 px-4 text-sm font-semibold text-white shadow-sm transition-colors hover:bg-brand-700",
287
+ onClick: t[0] ||= (e) => r.showAddModal = !0
288
+ }, [T(r.AppIcon, {
289
+ name: "plus",
290
+ class: "h-4 w-4"
291
+ }), t[5] ||= w(" Додати ", -1)])]),
292
+ _: 1
293
+ }),
294
+ C("section", K, [
295
+ T(r.RegistryToolbar, {
296
+ "search-min": "min-w-[220px]",
297
+ "filter-config": r.config.filter,
298
+ "filter-values": r.filterValues,
299
+ "onUpdate:filterValues": r.onFilterValuesUpdate
300
+ }, {
301
+ search: F(() => [C("label", q, [T(r.AppIcon, {
302
+ name: "search",
303
+ class: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"
304
+ }), I(C("input", {
305
+ "onUpdate:modelValue": t[1] ||= (e) => r.query = e,
306
+ type: "search",
307
+ placeholder: "Пошук за назвою або кодом…",
308
+ class: "h-10 w-full rounded-lg border border-slate-200 bg-white pl-9 pr-3 text-sm text-slate-700 outline-none transition-colors placeholder:text-slate-400 focus:border-brand-400 focus:ring-1 focus:ring-brand-400"
309
+ }, null, 512), [[P, r.query]])])]),
310
+ _: 1
311
+ }, 8, ["filter-config", "filter-values"]),
312
+ C("div", J, [C("span", null, [t[6] ||= w("Знайдено шарів: ", -1), C("strong", Y, N(r.total), 1)])]),
313
+ T(r.RegistryTable, {
314
+ class: "mt-3",
315
+ rows: r.rows,
316
+ columns: r.columns,
317
+ "visible-keys": r.columns.map((e) => e.key),
318
+ "row-key": "layer_id",
319
+ "min-width": "1180px",
320
+ "column-widths": r.colWidths,
321
+ "cell-class": { sort_order: "text-right tabular-nums" },
322
+ "empty-text": r.emptyText
323
+ }, {
324
+ cell: F(({ row: e, column: n }) => [n === "name" ? (j(), b(r.RouterLink, {
325
+ key: 0,
326
+ to: `/map-layers/${e.layer_id}`,
327
+ class: "block w-full max-w-full break-words text-left font-semibold text-brand-700 hover:text-brand-900 hover:underline"
328
+ }, {
329
+ default: F(() => [w(N(e.name), 1)]),
330
+ _: 2
331
+ }, 1032, ["to"])) : n === "code" ? (j(), S("code", X, N(e.code), 1)) : n === "layer_group" ? (j(), S("span", Z, N(r.optionText(r.LAYER_GROUP_OPTIONS, e.layer_group)), 1)) : n === "layer_type" ? (j(), S("span", Q, N(r.optionText(r.LAYER_TYPE_OPTIONS, e.layer_type)), 1)) : n === "components" ? (j(), S("span", $, N(r.componentsText(e.components)), 1)) : n === "sort_order" ? (j(), S("span", ee, N(e.sort_order ?? 0), 1)) : n === "is_default" ? (j(), S("span", te, N(e.is_default ? "Так" : "—"), 1)) : n === "enabled" ? (j(), S("span", {
332
+ key: 7,
333
+ class: D(["inline-flex rounded-full px-2 py-0.5 text-xs font-medium", e.enabled ? "bg-emerald-50 text-emerald-700" : "bg-slate-100 text-slate-500"])
334
+ }, N(e.enabled ? "Увімкнено" : "Вимкнено"), 3)) : n === "actions" ? (j(), S("div", ne, [C("button", {
335
+ type: "button",
336
+ "data-row-actions": "",
337
+ class: "inline-flex h-8 w-8 items-center justify-center rounded-lg text-slate-400 transition-colors hover:bg-brand-50 hover:text-brand-700",
338
+ "aria-expanded": r.actionsOpen === e.layer_id,
339
+ "aria-label": `Дії для ${e.name}`,
340
+ onClick: L((t) => r.toggleActions(e.layer_id, t), ["stop"])
341
+ }, [T(r.AppIcon, {
342
+ name: "more-vertical",
343
+ class: "h-4 w-4"
344
+ })], 8, re), (j(), b(v, { to: "body" }, [r.actionsOpen === e.layer_id ? (j(), S("div", {
345
+ key: 0,
346
+ "data-row-actions": "",
347
+ class: "fixed z-50 w-44 overflow-hidden rounded-lg border border-slate-200 bg-white py-1 text-left shadow-card-hover",
348
+ style: O(r.menuStyle)
349
+ }, [
350
+ C("button", {
351
+ type: "button",
352
+ class: "flex w-full items-center gap-2 px-3 py-2.5 text-sm text-slate-700 transition-colors hover:bg-slate-50",
353
+ onClick: (t) => r.editLayer(e)
354
+ }, [T(r.AppIcon, {
355
+ name: "pencil",
356
+ class: "h-4 w-4 text-slate-400"
357
+ }), t[7] ||= w(" Редагувати ", -1)], 8, ie),
358
+ t[9] ||= C("div", { class: "my-1 border-t border-slate-100" }, null, -1),
359
+ C("button", {
360
+ type: "button",
361
+ class: "flex w-full items-center gap-2 px-3 py-2.5 text-sm text-red-600 transition-colors hover:bg-red-50",
362
+ onClick: (t) => r.removeLayer(e)
363
+ }, [T(r.AppIcon, {
364
+ name: "trash-2",
365
+ class: "h-4 w-4"
366
+ }), t[8] ||= w(" Видалити ", -1)], 8, ae)
367
+ ], 4)) : x("", !0)]))])) : x("", !0)]),
368
+ _: 1
369
+ }, 8, [
370
+ "rows",
371
+ "columns",
372
+ "visible-keys",
373
+ "empty-text"
374
+ ]),
375
+ r.total > 0 ? (j(), b(r.TablePagination, {
376
+ key: 0,
377
+ page: r.page,
378
+ "onUpdate:page": t[2] ||= (e) => r.page = e,
379
+ "page-size": r.pageSize,
380
+ "onUpdate:pageSize": t[3] ||= (e) => r.pageSize = e,
381
+ total: r.total
382
+ }, null, 8, [
383
+ "page",
384
+ "page-size",
385
+ "total"
386
+ ])) : x("", !0)
387
+ ]),
388
+ T(r.RegistryFormModal, {
389
+ modelValue: r.showAddModal,
390
+ "onUpdate:modelValue": t[4] ||= (e) => r.showAddModal = e,
391
+ title: "Новий шар карти",
392
+ width: "max-w-3xl",
393
+ config: r.config.form,
394
+ onSaved: r.onLayerSaved
395
+ }, null, 8, ["modelValue", "config"])
396
+ ]);
397
+ }
398
+ var se = /*#__PURE__*/ t(G, [["render", oe], ["__file", "D:/Softpro/surveyor/admin/src/pages/map-layers/index.vue"]]);
399
+ //#endregion
400
+ export { se as default };
@@ -0,0 +1,251 @@
1
+ import { a as e, d as t, g as n, h as r, o as i, s as a, t as o } from "./appealMapLayers-CQMK3rrz.js";
2
+ import { t as s } from "./application_status-BhNGiY2I.js";
3
+ //#region shared/map/lib/maplibreCdn.ts
4
+ var c = "5.6.2", l = `https://unpkg.com/maplibre-gl@${c}/dist/maplibre-gl.js`, u = `https://unpkg.com/maplibre-gl@${c}/dist/maplibre-gl.css`, d = "Не вдалося завантажити карту. Перевірте з’єднання та оновіть сторінку.", f = {
5
+ "NavigationControl.ZoomIn": "Збільшити",
6
+ "NavigationControl.ZoomOut": "Зменшити",
7
+ "NavigationControl.ResetBearing": "Скинути орієнтацію на північ"
8
+ }, p = null;
9
+ function m() {
10
+ if (document.querySelector(`link[data-maplibre-cdn="${c}"]`)) return;
11
+ let e = document.createElement("link");
12
+ e.rel = "stylesheet", e.href = u, e.dataset.maplibreCdn = c, document.head.appendChild(e);
13
+ }
14
+ function h() {
15
+ return new Promise((e, t) => {
16
+ let n = document.createElement("script");
17
+ n.src = l, n.async = !0, n.dataset.maplibreCdn = c, n.onload = () => {
18
+ window.maplibregl ? e(window.maplibregl) : t(/* @__PURE__ */ Error("MapLibre loaded without global"));
19
+ }, n.onerror = () => {
20
+ n.remove(), t(/* @__PURE__ */ Error("Failed to load MapLibre script"));
21
+ }, document.head.appendChild(n);
22
+ });
23
+ }
24
+ function g() {
25
+ return window.maplibregl ? Promise.resolve(window.maplibregl) : (p ||= (m(), h().catch((e) => {
26
+ throw p = null, e;
27
+ })), p);
28
+ }
29
+ //#endregion
30
+ //#region shared/map/lib/overlayRender.ts
31
+ function _(e, t, n) {
32
+ n && e.getLayer(n) ? e.addLayer(t, n) : e.addLayer(t);
33
+ }
34
+ function v(e) {
35
+ return e ? "visible" : "none";
36
+ }
37
+ function y() {
38
+ return [
39
+ "match",
40
+ ["get", "status"],
41
+ ...s.items.flatMap((e) => [e.code, e.color ?? "#64748b"]),
42
+ "#64748b"
43
+ ];
44
+ }
45
+ function b(e, t, n = []) {
46
+ for (let n of [...t].reverse()) for (let t of r(n)) if (e.getLayer(t)) return t;
47
+ return n.find((t) => e.getLayer(t));
48
+ }
49
+ function x(e, t, r) {
50
+ e.getLayer("basemap") && e.removeLayer(i), e.getSource("basemap") && e.removeSource(a), e.addSource(a, n(t)), _(e, {
51
+ id: i,
52
+ type: "raster",
53
+ source: a
54
+ }, r);
55
+ }
56
+ function S(e, r, i, a) {
57
+ if (r.kind === "geometry" || !t(r) || e.getSource(r.id)) return;
58
+ let o = { visibility: v(i) };
59
+ if (r.kind === "raster") {
60
+ e.addSource(r.id, n(r)), _(e, {
61
+ id: `${r.id}-raster`,
62
+ type: "raster",
63
+ source: r.id,
64
+ layout: o,
65
+ paint: { "raster-opacity": r.opacity ?? 1 }
66
+ }, a);
67
+ return;
68
+ }
69
+ if (r.kind === "applications") {
70
+ let t = r.opacity ?? 1;
71
+ e.addSource(r.id, {
72
+ type: "vector",
73
+ tiles: r.tiles,
74
+ promoteId: "id"
75
+ }), _(e, {
76
+ id: `${r.id}-fill`,
77
+ type: "fill",
78
+ source: r.id,
79
+ "source-layer": r.sourceLayer,
80
+ layout: o,
81
+ paint: {
82
+ "fill-color": y(),
83
+ "fill-opacity": .26 * t
84
+ }
85
+ }, a), _(e, {
86
+ id: `${r.id}-line`,
87
+ type: "line",
88
+ source: r.id,
89
+ "source-layer": r.sourceLayer,
90
+ layout: o,
91
+ paint: {
92
+ "line-color": y(),
93
+ "line-width": 1.5,
94
+ "line-opacity": t
95
+ }
96
+ }, a);
97
+ return;
98
+ }
99
+ if (r.kind !== "vector") return;
100
+ let s = r.opacity ?? 1;
101
+ e.addSource(r.id, {
102
+ type: "vector",
103
+ tiles: r.tiles,
104
+ ...r.minzoom == null ? {} : { minzoom: r.minzoom },
105
+ ...r.maxzoom == null ? {} : { maxzoom: r.maxzoom }
106
+ }), _(e, {
107
+ id: `${r.id}-fill`,
108
+ type: "fill",
109
+ source: r.id,
110
+ "source-layer": r.sourceLayer,
111
+ layout: o,
112
+ paint: {
113
+ "fill-color": r.fillColor,
114
+ "fill-opacity": r.fillOpacity * s
115
+ }
116
+ }, a), _(e, {
117
+ id: `${r.id}-line`,
118
+ type: "line",
119
+ source: r.id,
120
+ "source-layer": r.sourceLayer,
121
+ layout: o,
122
+ paint: {
123
+ "line-color": r.lineColor,
124
+ "line-width": r.lineWidth,
125
+ "line-opacity": s
126
+ }
127
+ }, a);
128
+ }
129
+ function C(e, t) {
130
+ for (let n of [...r(t)].reverse()) e.getLayer(n) && e.removeLayer(n);
131
+ (t.kind === "raster" || t.kind === "vector") && e.getSource(t.id) && e.removeSource(t.id);
132
+ }
133
+ function w(e, t, n) {
134
+ let r = Math.min(100, Math.max(0, n)) / 100;
135
+ if (t.kind === "raster") {
136
+ let n = `${t.id}-raster`;
137
+ e.getLayer(n) && e.setPaintProperty(n, "raster-opacity", r);
138
+ return;
139
+ }
140
+ if (t.kind !== "vector") return;
141
+ let i = `${t.id}-fill`, a = `${t.id}-line`;
142
+ e.getLayer(i) && e.setPaintProperty(i, "fill-opacity", t.fillOpacity * r), e.getLayer(a) && e.setPaintProperty(a, "line-opacity", r);
143
+ }
144
+ function T(e, t, n, i) {
145
+ let a = i;
146
+ for (let i of t) {
147
+ S(e, i, n.includes(i.id), a);
148
+ let t = r(i).filter((t) => e.getLayer(t));
149
+ t[0] && (a = t[0]);
150
+ }
151
+ }
152
+ function E(e, t, n) {
153
+ for (let i of t) {
154
+ let t = v(n.includes(i.id));
155
+ for (let n of r(i)) e.getLayer(n) && e.setLayoutProperty(n, "visibility", t);
156
+ }
157
+ }
158
+ //#endregion
159
+ //#region shared/map/lib/mapLayersApi.ts
160
+ function D() {
161
+ return "".replace(/\/$/, "") || (typeof window < "u" ? window.location.origin : "");
162
+ }
163
+ function O(e) {
164
+ return e.startsWith("/") ? `${D()}${e}` : e;
165
+ }
166
+ function k(e) {
167
+ return typeof e == "string" && e.trim() ? e : void 0;
168
+ }
169
+ function A(e, t) {
170
+ return typeof e == "number" && Number.isFinite(e) ? e : t;
171
+ }
172
+ function j(e) {
173
+ return {
174
+ ...e.minzoom == null ? {} : { minzoom: e.minzoom },
175
+ ...e.maxzoom == null ? {} : { maxzoom: e.maxzoom }
176
+ };
177
+ }
178
+ function M(e) {
179
+ return {
180
+ id: e.code,
181
+ label: e.name,
182
+ tiles: e.tiles.map(O),
183
+ attribution: e.attribution ?? "",
184
+ scheme: e.scheme,
185
+ ...j(e),
186
+ ...e.preview ? { preview: O(e.preview) } : {}
187
+ };
188
+ }
189
+ function N(e) {
190
+ let t = e.style ?? {}, n = k(e.legend?.color) ?? k(t.lineColor) ?? k(t.fillColor), r = k(e.legend?.label) ?? k(e.legend?.name), i = {
191
+ id: e.code,
192
+ label: e.name,
193
+ defaultVisible: e.is_default,
194
+ ...n ? { legendColor: n } : {},
195
+ ...r ? { legendLabel: r } : {}
196
+ }, a = e.tiles.map(O);
197
+ return e.layer_type === "applications" ? {
198
+ ...i,
199
+ kind: "applications",
200
+ tiles: a,
201
+ sourceLayer: e.source_layer ?? "applications",
202
+ opacity: e.opacity,
203
+ hasFilters: e.has_filters
204
+ } : e.layer_type === "vector" ? {
205
+ ...i,
206
+ kind: "vector",
207
+ tiles: a,
208
+ sourceLayer: e.source_layer ?? "",
209
+ fillColor: k(t.fillColor) ?? "#f97316",
210
+ fillOpacity: A(t.fillOpacity, .25),
211
+ opacity: e.opacity,
212
+ lineColor: k(t.lineColor) ?? "#ea580c",
213
+ lineWidth: A(t.lineWidth, 1.5),
214
+ ...j(e)
215
+ } : {
216
+ ...i,
217
+ kind: "raster",
218
+ tiles: a,
219
+ scheme: e.scheme,
220
+ opacity: e.opacity,
221
+ ...j(e)
222
+ };
223
+ }
224
+ function P() {
225
+ let t = e.flatMap((e) => e.kind === "geometry" ? [] : [{
226
+ ...e,
227
+ tiles: e.tiles.map(O)
228
+ }]);
229
+ return {
230
+ defaultBaseId: o[0]?.id ?? "osm",
231
+ baseLayers: o,
232
+ overlays: t
233
+ };
234
+ }
235
+ var F = /* @__PURE__ */ new Map();
236
+ async function I(e) {
237
+ let t = await fetch(`${D()}/api/surveyor/map/layers?component=${encodeURIComponent(e)}`, { credentials: "include" });
238
+ if (!t.ok) throw Error(`HTTP ${t.status}`);
239
+ let n = await t.json(), r = n.base.map(M);
240
+ return r.length ? {
241
+ defaultBaseId: n.default_base ?? r[0].id,
242
+ baseLayers: r,
243
+ overlays: n.overlays.map(N)
244
+ } : P();
245
+ }
246
+ function L(e) {
247
+ let t = F.get(e);
248
+ return t || (t = I(e).catch((t) => (console.warn("[mapLayers] fallback to static layers", t), F.delete(e), P())), F.set(e, t)), t;
249
+ }
250
+ //#endregion
251
+ export { x as a, C as c, g as d, b as i, d as l, w as n, S as o, E as r, T as s, L as t, f as u };