@opengis/surveyor 0.0.0-stage → 0.0.1

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 (138) hide show
  1. package/README.md +46 -3
  2. package/README.npm.md +51 -0
  3. package/dist/chunks/AppIcon-C-4QykTP.js +85 -0
  4. package/dist/chunks/AppealDetailField-DNRGpnyD.js +58 -0
  5. package/dist/chunks/AppealStatusBadge-CefimzY3.js +132 -0
  6. package/dist/chunks/AppealStatusBadge-Cu-UzdzA.js +171 -0
  7. package/dist/chunks/ApplicationHistorySection-PwToBfej.js +769 -0
  8. package/dist/chunks/BaseModal-DrTTkLmR.js +85 -0
  9. package/dist/chunks/FormFilePicker-CKVdZJU9.js +76 -0
  10. package/dist/chunks/MapLayerMenu-AUeTqgEp.js +145 -0
  11. package/dist/chunks/RegistryForm-pvIcFR-V.js +99 -0
  12. package/dist/chunks/RegistryFormModal-BjGu7Upv.js +85 -0
  13. package/dist/chunks/RegistryToolbar-CiUgsjpU.js +452 -0
  14. package/dist/chunks/UserAccessBadge-DyZDv7Oo.js +44 -0
  15. package/dist/chunks/UserTypeBadge-LvnMuKGo.js +188 -0
  16. package/dist/chunks/VerifiedBadge-B6droMOf.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-CsCsndMV.js +132 -0
  23. package/dist/chunks/buildSchema-nkA4Y0YG.js +37 -0
  24. package/dist/chunks/card--DHsMNBd.js +330 -0
  25. package/dist/chunks/card-9LaB42Ol.js +538 -0
  26. package/dist/chunks/card-BZn5CDw9.js +739 -0
  27. package/dist/chunks/card-CNqXSyqX.js +297 -0
  28. package/dist/chunks/card-CgGOgGyd.js +973 -0
  29. package/dist/chunks/card-DCyBFoDZ.js +607 -0
  30. package/dist/chunks/certificates-DueBDDvc.js +424 -0
  31. package/dist/chunks/create-l28e-bWl.js +1033 -0
  32. package/dist/chunks/filterQuery-B9XNx1f1.js +99 -0
  33. package/dist/chunks/form-CdGS1nVO.js +315 -0
  34. package/dist/chunks/form-QTkkzwbC.js +89 -0
  35. package/dist/chunks/geometry-DyhIVRcw.js +67 -0
  36. package/dist/chunks/map-BW3iOhQg.js +2763 -0
  37. package/dist/chunks/map-layers-qxWjos2V.js +400 -0
  38. package/dist/chunks/mapLayersApi-CWoQ2be-.js +251 -0
  39. package/dist/chunks/organizations-BtuMZ5s_.js +14 -0
  40. package/dist/chunks/organizations-CZOINYMq.js +476 -0
  41. package/dist/chunks/profile-CuxlkEev.js +243 -0
  42. package/dist/chunks/profile-DxZHxGum.js +164 -0
  43. package/dist/chunks/requests-Bt8fEdRc.js +530 -0
  44. package/dist/chunks/requests-DQJIhz00.js +232 -0
  45. package/dist/chunks/resendSurveyorRegistration-DopjOHaM.js +27 -0
  46. package/dist/chunks/resources-Cl_EvaIy.js +129 -0
  47. package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
  48. package/dist/chunks/surveyorAccount-BceNQypZ.js +78 -0
  49. package/dist/chunks/users-DlaogjC_.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 +259 -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 +75 -4
  61. package/plugin.js +10 -0
  62. package/server/app.ts +50 -0
  63. package/server/dictionaries/index.ts +17 -0
  64. package/server/dictionaries/surveyor/account_types.ts +12 -0
  65. package/server/dictionaries/surveyor/application_status.ts +16 -0
  66. package/server/dictionaries/surveyor/map_layer_components.ts +11 -0
  67. package/server/dictionaries/surveyor/map_layer_groups.ts +10 -0
  68. package/server/dictionaries/surveyor/map_layer_types.ts +11 -0
  69. package/server/dictionaries/surveyor/work_types.ts +15 -0
  70. package/server/dictionaries/surveyor/yes_no.ts +11 -0
  71. package/server/embed.ts +49 -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/tsconfig.json +3 -0
  138. package/surveyor-types.d.ts +30 -0
@@ -0,0 +1,232 @@
1
+ import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
+ import { t } from "./AppIcon-C-4QykTP.js";
3
+ import { i as n } from "./resources-Cl_EvaIy.js";
4
+ import { t as r } from "./filterQuery-B9XNx1f1.js";
5
+ import { a as i, i as a, n as o, r as s, t as c } from "./RegistryToolbar-CiUgsjpU.js";
6
+ import { n as l, r as u, s as d, t as f } from "./AppealStatusBadge-Cu-UzdzA.js";
7
+ import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, openBlock as S, ref as C, renderList as w, toDisplayString as T, vModelText as E, withCtx as D, withDirectives as O } from "vue";
8
+ import { RouterLink as k } from "vue-router";
9
+ //#region admin/src/pages/requests/index.vue?vue&type=script&setup=true&lang.ts
10
+ var A = /*@__PURE__*/ x({
11
+ __name: "index",
12
+ setup(e, { expose: p }) {
13
+ p();
14
+ let h = u.columns, g = h.flatMap((e) => e.sort ? [e.sort] : []), { query: _, filterValues: v, page: y, pageSize: b, sort: x, listFilters: S, bindListLoader: w } = i({
15
+ arrayFilterKeys: ["status", "year"],
16
+ defaultSort: u.sort,
17
+ sortFields: g,
18
+ buildFilters: r
19
+ }), T = C(!1), E = C([
20
+ "number",
21
+ "organization",
22
+ "address",
23
+ "status",
24
+ "workType",
25
+ "createdAt"
26
+ ]), D = C([]), O = C(0), A = C(!1), j = C("");
27
+ function M(e) {
28
+ if (!e) return "—";
29
+ let t = e.match(/^(\d{4})-(\d{2})-(\d{2})/);
30
+ return t ? `${t[3]}.${t[2]}.${t[1]}` : e;
31
+ }
32
+ function N(e) {
33
+ return e.address_id_data?.text || e.location || "—";
34
+ }
35
+ let P = 0, F = m(() => A.value ? "Завантаження…" : j.value ? j.value : "За заданими фільтрами звернень не знайдено.");
36
+ async function I() {
37
+ let e = ++P;
38
+ A.value = !0, j.value = "";
39
+ try {
40
+ let t = await n(d, {
41
+ page: y.value,
42
+ limit: b.value,
43
+ sort: x.value,
44
+ search: _.value.trim() || void 0,
45
+ filters: S.value
46
+ });
47
+ if (e !== P) return;
48
+ D.value = t.rows ?? [], O.value = Number(t.total) || 0;
49
+ } catch (t) {
50
+ if (e !== P) return;
51
+ D.value = [], O.value = 0, j.value = t instanceof Error ? t.message : "Не вдалося завантажити звернення";
52
+ } finally {
53
+ e === P && (A.value = !1);
54
+ }
55
+ }
56
+ w(() => {
57
+ I();
58
+ });
59
+ function L(e) {
60
+ v.value = e;
61
+ }
62
+ function R(e) {
63
+ x.value !== e && (y.value !== 1 && (y.value = 1), x.value = e);
64
+ }
65
+ function z(e) {
66
+ E.value = E.value.includes(e) ? E.value.length > 1 ? E.value.filter((t) => t !== e) : E.value : E.value.length < 7 ? [...E.value, e] : E.value;
67
+ }
68
+ let B = {
69
+ columns: h,
70
+ sortableFields: g,
71
+ query: _,
72
+ filterValues: v,
73
+ page: y,
74
+ pageSize: b,
75
+ sort: x,
76
+ listFilters: S,
77
+ bindListLoader: w,
78
+ columnsOpen: T,
79
+ visibleColumns: E,
80
+ rows: D,
81
+ total: O,
82
+ loading: A,
83
+ error: j,
84
+ formatDate: M,
85
+ addressLabel: N,
86
+ get requestId() {
87
+ return P;
88
+ },
89
+ set requestId(e) {
90
+ P = e;
91
+ },
92
+ emptyText: F,
93
+ loadRows: I,
94
+ onFilterValuesUpdate: L,
95
+ onSort: R,
96
+ toggleColumn: z,
97
+ AppIcon: t,
98
+ get RouterLink() {
99
+ return k;
100
+ },
101
+ AppealStatusBadge: f,
102
+ PageHeader: a,
103
+ RegistryTable: s,
104
+ TablePagination: o,
105
+ RegistryToolbar: c,
106
+ get config() {
107
+ return l;
108
+ }
109
+ };
110
+ return Object.defineProperty(B, "__isScriptSetup", {
111
+ enumerable: !1,
112
+ value: !0
113
+ }), B;
114
+ }
115
+ }), j = { class: "px-4" }, M = { class: "relative block" }, N = {
116
+ type: "button",
117
+ class: "inline-flex h-10 w-10 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 transition-colors hover:border-brand-300 hover:text-brand-700",
118
+ "aria-label": "Експорт"
119
+ }, P = { class: "relative" }, F = {
120
+ key: 0,
121
+ class: "absolute right-0 top-12 z-20 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-card-hover"
122
+ }, I = ["checked", "onChange"], L = { class: "mt-3 flex items-center justify-between border-t border-slate-100 pt-3 text-xs text-slate-400" }, R = { class: "font-semibold text-slate-600" }, z = {
123
+ key: 1,
124
+ class: "min-w-0"
125
+ }, B = { class: "break-words font-semibold text-slate-700" }, V = { class: "break-words text-xs text-slate-400" }, H = {
126
+ key: 2,
127
+ class: "text-slate-600"
128
+ }, U = {
129
+ key: 4,
130
+ class: "text-slate-600"
131
+ }, W = {
132
+ key: 5,
133
+ class: "whitespace-nowrap text-slate-600"
134
+ }, G = {
135
+ key: 6,
136
+ class: "text-slate-600"
137
+ };
138
+ function K(e, t, n, r, i, a) {
139
+ return S(), _("div", null, [b(r.PageHeader, {
140
+ title: "Звернення на видачу та прийом матеріалів",
141
+ subtitle: "Реєстр звернень геодезичного кабінету"
142
+ }), v("section", j, [
143
+ b(r.RegistryToolbar, {
144
+ nowrap: "",
145
+ "search-min": "min-w-[160px]",
146
+ "filter-config": r.config.filter,
147
+ "filter-values": r.filterValues,
148
+ "onUpdate:filterValues": r.onFilterValuesUpdate
149
+ }, {
150
+ search: D(() => [v("label", M, [b(r.AppIcon, {
151
+ name: "search",
152
+ class: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"
153
+ }), O(v("input", {
154
+ "onUpdate:modelValue": t[0] ||= (e) => r.query = e,
155
+ type: "search",
156
+ placeholder: "Пошук…",
157
+ 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"
158
+ }, null, 512), [[E, r.query]])])]),
159
+ actions: D(() => [v("button", N, [b(r.AppIcon, {
160
+ name: "download",
161
+ class: "h-4 w-4"
162
+ })]), v("div", P, [v("button", {
163
+ type: "button",
164
+ class: "inline-flex h-10 w-10 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 transition-colors hover:border-brand-300 hover:text-brand-700",
165
+ onClick: t[1] ||= (e) => r.columnsOpen = !r.columnsOpen
166
+ }, [b(r.AppIcon, {
167
+ name: "columns-3",
168
+ class: "h-4 w-4"
169
+ })]), r.columnsOpen ? (S(), _("div", F, [
170
+ t[4] ||= v("p", { class: "px-2 py-1 text-xs font-semibold uppercase tracking-wide text-slate-400" }, "Налаштувати колонки", -1),
171
+ (S(!0), _(p, null, w(r.columns, (e) => (S(), _("label", {
172
+ key: e.key,
173
+ class: "flex cursor-pointer items-center gap-2 rounded-md px-2 py-2 text-sm text-slate-600 hover:bg-slate-50"
174
+ }, [v("input", {
175
+ type: "checkbox",
176
+ checked: r.visibleColumns.includes(e.key),
177
+ class: "h-4 w-4 accent-brand-600",
178
+ onChange: (t) => r.toggleColumn(e.key)
179
+ }, null, 40, I), y(" " + T(e.label), 1)]))), 128)),
180
+ t[5] ||= v("p", { class: "px-2 pt-1 text-[11px] text-slate-400" }, "До 7 колонок одночасно", -1)
181
+ ])) : g("", !0)])]),
182
+ _: 1
183
+ }, 8, ["filter-config", "filter-values"]),
184
+ v("div", L, [v("span", null, [t[6] ||= y("Знайдено звернень: ", -1), v("strong", R, T(r.total), 1)])]),
185
+ b(r.RegistryTable, {
186
+ class: "mt-3",
187
+ rows: r.rows,
188
+ columns: r.columns,
189
+ "visible-keys": r.visibleColumns,
190
+ "row-key": "app_id",
191
+ sort: r.sort,
192
+ "empty-text": r.emptyText,
193
+ onSort: r.onSort
194
+ }, {
195
+ cell: D(({ row: e, column: t }) => [t === "number" ? (S(), h(r.RouterLink, {
196
+ key: 0,
197
+ to: `/requests/${e.app_id}`,
198
+ class: "font-semibold text-brand-700 underline-offset-4 transition-colors hover:text-brand-900 hover:underline"
199
+ }, {
200
+ default: D(() => [y(T(e.number || "—"), 1)]),
201
+ _: 2
202
+ }, 1032, ["to"])) : t === "organization" ? (S(), _("div", z, [v("p", B, T(e.org_id_data?.text || "—"), 1), v("p", V, T(e.surveyor_id_data?.text || "—"), 1)])) : t === "address" ? (S(), _("span", H, T(r.addressLabel(e)), 1)) : t === "status" ? (S(), h(r.AppealStatusBadge, {
203
+ key: 3,
204
+ status: e.status || "",
205
+ label: e.status_data?.text || void 0,
206
+ size: "sm"
207
+ }, null, 8, ["status", "label"])) : t === "workType" ? (S(), _("span", U, T(e.work_type_data?.text || "—"), 1)) : t === "createdAt" ? (S(), _("span", W, T(r.formatDate(e.created_at)), 1)) : t === "checkedBy" ? (S(), _("span", G, T(e.verified_by_data?.text || "—"), 1)) : g("", !0)]),
208
+ _: 1
209
+ }, 8, [
210
+ "rows",
211
+ "columns",
212
+ "visible-keys",
213
+ "sort",
214
+ "empty-text"
215
+ ]),
216
+ r.total > 0 ? (S(), h(r.TablePagination, {
217
+ key: 0,
218
+ page: r.page,
219
+ "onUpdate:page": t[2] ||= (e) => r.page = e,
220
+ "page-size": r.pageSize,
221
+ "onUpdate:pageSize": t[3] ||= (e) => r.pageSize = e,
222
+ total: r.total
223
+ }, null, 8, [
224
+ "page",
225
+ "page-size",
226
+ "total"
227
+ ])) : g("", !0)
228
+ ])]);
229
+ }
230
+ var q = /*#__PURE__*/ e(A, [["render", K], ["__file", "C:/softpro/surveyor/admin/src/pages/requests/index.vue"]]);
231
+ //#endregion
232
+ export { q as default };
@@ -0,0 +1,27 @@
1
+ import { a as e } from "./resources-Cl_EvaIy.js";
2
+ import { notify as t } from "@opengis/core";
3
+ //#region admin/src/utils/resendSurveyorRegistration.ts
4
+ function n(e) {
5
+ return !e.registered_at && e.enabled !== !1;
6
+ }
7
+ async function r(n) {
8
+ try {
9
+ return (await e(`/api/surveyor/surveyors/${encodeURIComponent(n)}/registration/resend`, { method: "POST" })).sent ? t({
10
+ type: "success",
11
+ title: "Лист надіслано",
12
+ message: "На email надіслано нове посилання для завершення реєстрації"
13
+ }) : t({
14
+ type: "warning",
15
+ title: "Лист не надіслано",
16
+ message: "Нове посилання сформовано, але надсилання email вимкнено або не налаштовано"
17
+ }), !0;
18
+ } catch (e) {
19
+ return t({
20
+ type: "error",
21
+ title: "Помилка",
22
+ message: e instanceof Error ? e.message : "Не вдалося надіслати лист"
23
+ }), !1;
24
+ }
25
+ }
26
+ //#endregion
27
+ export { r as n, n as t };
@@ -0,0 +1,129 @@
1
+ //#region admin/src/utils/auth.ts
2
+ var e = "user";
3
+ function t(e) {
4
+ let t = e.startsWith("/") ? e : `/${e}`, n = "".replace(/\/$/, "");
5
+ return n ? `${n}${t}` : typeof window < "u" && window.location?.origin ? `${window.location.origin}${t}` : t;
6
+ }
7
+ function n() {
8
+ try {
9
+ let t = localStorage.getItem(e);
10
+ return t ? JSON.parse(t) : null;
11
+ } catch {
12
+ return localStorage.removeItem(e), null;
13
+ }
14
+ }
15
+ function r(e, t) {
16
+ let n = e || `HTTP ${t}`;
17
+ try {
18
+ let t = JSON.parse(e);
19
+ n = (typeof t.error == "object" ? t.error.message : void 0) || t.message || n;
20
+ } catch {}
21
+ return n;
22
+ }
23
+ async function i(n, i) {
24
+ let a = await fetch(t("/api/auth/login"), {
25
+ method: "POST",
26
+ credentials: "include",
27
+ headers: { "Content-Type": "application/json" },
28
+ body: JSON.stringify({
29
+ user: n.trim(),
30
+ password: i
31
+ })
32
+ });
33
+ if (!a.ok) throw Error(r(await a.text(), a.status));
34
+ let o = await a.json();
35
+ localStorage.setItem(e, JSON.stringify(o.user));
36
+ }
37
+ async function a() {
38
+ try {
39
+ let n = await fetch(t("/api/auth/user"), { credentials: "include" });
40
+ if (!n.ok) return localStorage.removeItem(e), null;
41
+ let r = await n.json();
42
+ return r.id ? (localStorage.setItem(e, JSON.stringify(r)), r) : (localStorage.removeItem(e), null);
43
+ } catch {
44
+ return localStorage.removeItem(e), null;
45
+ }
46
+ }
47
+ async function o() {
48
+ try {
49
+ await fetch(t("/api/auth/logout"), {
50
+ method: "POST",
51
+ credentials: "include"
52
+ });
53
+ } finally {
54
+ localStorage.removeItem(e);
55
+ }
56
+ }
57
+ var s = {
58
+ get currentUser() {
59
+ return n();
60
+ },
61
+ get isAuthenticated() {
62
+ return !!n()?.id;
63
+ },
64
+ login: i,
65
+ checkUser: a,
66
+ logout: o
67
+ };
68
+ //#endregion
69
+ //#region admin/src/api/resources.ts
70
+ async function c(e, n) {
71
+ let r = await fetch(t(e), {
72
+ ...n,
73
+ credentials: "include",
74
+ headers: {
75
+ ...n?.body ? { "Content-Type": "application/json" } : {},
76
+ ...n?.headers ?? {}
77
+ }
78
+ });
79
+ if (!r.ok) {
80
+ let e = await r.text();
81
+ try {
82
+ let t = JSON.parse(e), n = typeof t.error == "object" ? t.error.message : void 0;
83
+ throw Error(n || t.message || e || `HTTP ${r.status}`);
84
+ } catch (t) {
85
+ throw t instanceof Error && t.message !== e ? t : Error(e || `HTTP ${r.status}`);
86
+ }
87
+ }
88
+ return r.status === 204 ? void 0 : r.json();
89
+ }
90
+ function l(e = {}) {
91
+ let t = new URLSearchParams();
92
+ e.page !== void 0 && t.set("page", String(e.page)), e.limit !== void 0 && t.set("limit", String(e.limit)), e.search && t.set("search", e.search), e.sort && t.set("sort", e.sort), e.order && t.set("order", e.order);
93
+ for (let [n, r] of Object.entries(e.filters ?? {})) if (r != null && r !== "") {
94
+ if (typeof r == "object" && !Array.isArray(r)) {
95
+ for (let [e, i] of Object.entries(r)) i != null && i !== "" && t.set(`filter[${n}][${e}]`, String(i));
96
+ continue;
97
+ }
98
+ t.set(`filter[${n}]`, String(r));
99
+ }
100
+ let n = t.toString();
101
+ return n ? `?${n}` : "";
102
+ }
103
+ async function u(e, t = {
104
+ page: 1,
105
+ limit: 100,
106
+ order: "asc"
107
+ }) {
108
+ return c(`/api/resource/${e}${l(t)}`);
109
+ }
110
+ function d(e, t) {
111
+ return c(`/api/resource/${e}/${t}`);
112
+ }
113
+ function f(e, t) {
114
+ return c(`/api/resource/${e}`, {
115
+ method: "POST",
116
+ body: JSON.stringify(t)
117
+ });
118
+ }
119
+ function p(e, t, n) {
120
+ return c(`/api/resource/${e}/${t}`, {
121
+ method: "PUT",
122
+ body: JSON.stringify(n)
123
+ });
124
+ }
125
+ async function m(e, t) {
126
+ await c(`/api/resource/${e}/${t}`, { method: "DELETE" });
127
+ }
128
+ //#endregion
129
+ export { c as a, s as c, u as i, m as n, p as o, d as r, t as s, f as t };
@@ -0,0 +1,11 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ };
10
+ //#endregion
11
+ export { t };
@@ -0,0 +1,78 @@
1
+ import { a as e } from "./resources-Cl_EvaIy.js";
2
+ import { confirm as t, notify as n } from "@opengis/core";
3
+ //#region admin/src/utils/surveyorAccount.ts
4
+ function r(e) {
5
+ return !!e.registered_at;
6
+ }
7
+ function i(e) {
8
+ return e.enabled !== !1;
9
+ }
10
+ async function a(t) {
11
+ try {
12
+ return await e(`/api/surveyor/surveyors/${encodeURIComponent(t)}/password`, { method: "PUT" }), n({
13
+ type: "success",
14
+ title: "Пароль змінено",
15
+ message: "Новий пароль надіслано на email користувача"
16
+ }), !0;
17
+ } catch (e) {
18
+ return n({
19
+ type: "error",
20
+ title: "Помилка",
21
+ message: e instanceof Error ? e.message : "Не вдалося змінити пароль"
22
+ }), !1;
23
+ }
24
+ }
25
+ async function o(t, r) {
26
+ try {
27
+ return await e(`/api/surveyor/surveyors/${encodeURIComponent(t)}/account-status`, {
28
+ method: "PUT",
29
+ body: JSON.stringify({ enabled: r })
30
+ }), n({
31
+ type: "success",
32
+ title: r ? "Користувача розблоковано" : "Користувача заблоковано",
33
+ message: r ? "Доступ до кабінету відновлено" : "Доступ до кабінету повністю вимкнено"
34
+ }), !0;
35
+ } catch (e) {
36
+ return n({
37
+ type: "error",
38
+ title: "Помилка",
39
+ message: e instanceof Error ? e.message : "Не вдалося змінити блокування користувача"
40
+ }), !1;
41
+ }
42
+ }
43
+ function s(e, n, r) {
44
+ let a = !i(e);
45
+ t({
46
+ title: a ? "Розблокування" : "Повне блокування",
47
+ type: a ? "warning" : "error",
48
+ message: a ? `Розблокувати користувача «${n}»? Доступ до кабінету буде відновлено.` : `Повністю заблокувати користувача «${n}»? Доступ до кабінету буде вимкнено для всіх організацій.`,
49
+ confirmButtonText: a ? "Розблокувати" : "Заблокувати",
50
+ cancelButtonText: "Скасувати",
51
+ onConfirm: async () => {
52
+ await o(e.surveyor_id, a) && r(a);
53
+ }
54
+ });
55
+ }
56
+ async function c(t, r, i) {
57
+ try {
58
+ return await e(`/api/surveyor/surveyors/${encodeURIComponent(t)}/status`, {
59
+ method: "PUT",
60
+ body: JSON.stringify({
61
+ org_id: r,
62
+ enabled: i
63
+ })
64
+ }), n({
65
+ type: "success",
66
+ title: i ? "Користувача активовано" : "Користувача деактивовано",
67
+ message: i ? "Доступ до організації відновлено" : "Доступ до організації вимкнено"
68
+ }), !0;
69
+ } catch (e) {
70
+ return n({
71
+ type: "error",
72
+ title: "Помилка",
73
+ message: e instanceof Error ? e.message : "Не вдалося змінити статус користувача"
74
+ }), !1;
75
+ }
76
+ }
77
+ //#endregion
78
+ export { i as a, c as i, s as n, a as r, r as t };