@burdenoff/microfe-ecoimpacthub 2026.819.4 → 2026.830.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.
- package/dist/ecoimpacthub/hooks/index.d.ts +2 -0
- package/dist/ecoimpacthub/hooks/index.d.ts.map +1 -1
- package/dist/ecoimpacthub/hooks/index.js +2 -0
- package/dist/ecoimpacthub/hooks/useActiveEcoEntity.d.ts +11 -0
- package/dist/ecoimpacthub/hooks/useActiveEcoEntity.d.ts.map +1 -0
- package/dist/ecoimpacthub/hooks/useActiveEcoEntity.js +21 -0
- package/dist/ecoimpacthub/hooks/useActiveEcoEntity.js.map +1 -0
- package/dist/ecoimpacthub/hooks/useTr.d.ts +4 -0
- package/dist/ecoimpacthub/hooks/useTr.d.ts.map +1 -0
- package/dist/ecoimpacthub/hooks/useTr.js +20 -0
- package/dist/ecoimpacthub/hooks/useTr.js.map +1 -0
- package/dist/ecoimpacthub/pages/DashboardPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/DashboardPage.js +162 -138
- package/dist/ecoimpacthub/pages/DashboardPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/_shared/MethodPicker.d.ts +15 -0
- package/dist/ecoimpacthub/pages/_shared/MethodPicker.d.ts.map +1 -0
- package/dist/ecoimpacthub/pages/_shared/MethodPicker.js +36 -0
- package/dist/ecoimpacthub/pages/_shared/MethodPicker.js.map +1 -0
- package/dist/ecoimpacthub/pages/_shared/UseMyLocationButton.d.ts +15 -0
- package/dist/ecoimpacthub/pages/_shared/UseMyLocationButton.d.ts.map +1 -0
- package/dist/ecoimpacthub/pages/_shared/UseMyLocationButton.js +66 -0
- package/dist/ecoimpacthub/pages/_shared/UseMyLocationButton.js.map +1 -0
- package/dist/ecoimpacthub/pages/habitat/HabitatProjectDetailPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/habitat/HabitatProjectDetailPage.js +127 -124
- package/dist/ecoimpacthub/pages/habitat/HabitatProjectDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.js +226 -224
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js +159 -156
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/sites/SiteDetailPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/sites/SiteDetailPage.js +40 -37
- package/dist/ecoimpacthub/pages/sites/SiteDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/sites/SitesPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/sites/SitesPage.js +208 -171
- package/dist/ecoimpacthub/pages/sites/SitesPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.js +211 -214
- package/dist/ecoimpacthub/pages/species/SpeciesDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/species/SpeciesPage.d.ts.map +1 -1
- package/dist/ecoimpacthub/pages/species/SpeciesPage.js +174 -157
- package/dist/ecoimpacthub/pages/species/SpeciesPage.js.map +1 -1
- package/dist/ecoimpacthub/utils/activeEntity.d.ts +30 -0
- package/dist/ecoimpacthub/utils/activeEntity.d.ts.map +1 -0
- package/dist/ecoimpacthub/utils/activeEntity.js +12 -0
- package/dist/ecoimpacthub/utils/activeEntity.js.map +1 -0
- package/dist/ecoimpacthub/utils/pageContext.d.ts.map +1 -1
- package/dist/ecoimpacthub/utils/pageContext.js +30 -25
- package/dist/ecoimpacthub/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { useEcoImpactHub as e } from "../../context/EcoImpactHubContext.js";
|
|
2
2
|
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
-
import { formatEnumLabel as n, formatNumber as r, formatRelativeTime as
|
|
4
|
-
import { StatusBadge as
|
|
5
|
-
import { ErrorView as
|
|
6
|
-
import { EmptyState as
|
|
3
|
+
import { formatEnumLabel as n, formatNumber as r, formatRelativeTime as ee } from "../../utils/formatters.js";
|
|
4
|
+
import { StatusBadge as te } from "../../components/StatusBadge.js";
|
|
5
|
+
import { ErrorView as ne, LoadingView as i } from "../../components/StateViews.js";
|
|
6
|
+
import { EmptyState as a } from "../../components/EmptyState.js";
|
|
7
7
|
import "../../context/index.js";
|
|
8
|
-
import { useEcoCreateSite as
|
|
9
|
-
import { useCursorPager as
|
|
8
|
+
import { useEcoCreateSite as o, useEcoSites as s } from "../../hooks/useEcoImpactHubApi.js";
|
|
9
|
+
import { useCursorPager as c } from "../../hooks/useCursorPager.js";
|
|
10
10
|
import "../../hooks/index.js";
|
|
11
|
-
import { DataTable as
|
|
12
|
-
import { Pagination as
|
|
13
|
-
import { FilterTabs as
|
|
14
|
-
import { SiteTypeBadge as
|
|
15
|
-
import { useMemo as
|
|
16
|
-
import { MapPin as
|
|
17
|
-
import { Fragment as
|
|
18
|
-
import { Button as
|
|
11
|
+
import { DataTable as l } from "../../components/DataTable.js";
|
|
12
|
+
import { Pagination as u } from "../../components/Pagination.js";
|
|
13
|
+
import { FilterTabs as re } from "../../components/FilterTabs.js";
|
|
14
|
+
import { SiteTypeBadge as ie, SiteTypeIcon as ae } from "./siteTypeVisuals.js";
|
|
15
|
+
import { useMemo as d, useState as f } from "react";
|
|
16
|
+
import { MapPin as p, Plus as m, Search as h } from "lucide-react";
|
|
17
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
18
|
+
import { Button as y, Input as b, Label as x, ResponsiveDialog as S, ResponsiveDialogContent as C, ResponsiveDialogDescription as oe, ResponsiveDialogFooter as se, ResponsiveDialogHeader as ce, ResponsiveDialogTitle as le, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, Textarea as k } from "@burdenoff/fe-libs/ui";
|
|
19
19
|
//#region src/ecoimpacthub/pages/sites/SitesPage.tsx
|
|
20
|
-
var
|
|
20
|
+
var A = [
|
|
21
21
|
{
|
|
22
22
|
value: "ALL",
|
|
23
23
|
label: "All"
|
|
@@ -34,7 +34,7 @@ var P = [
|
|
|
34
34
|
value: "ARCHIVED",
|
|
35
35
|
label: "Archived"
|
|
36
36
|
}
|
|
37
|
-
],
|
|
37
|
+
], j = [
|
|
38
38
|
"FACILITY",
|
|
39
39
|
"WATERSHED",
|
|
40
40
|
"FOREST",
|
|
@@ -44,7 +44,7 @@ var P = [
|
|
|
44
44
|
"AIRSHED",
|
|
45
45
|
"COASTAL",
|
|
46
46
|
"OTHER"
|
|
47
|
-
],
|
|
47
|
+
], M = 25, N = {
|
|
48
48
|
name: "",
|
|
49
49
|
code: "",
|
|
50
50
|
type: "FACILITY",
|
|
@@ -55,26 +55,31 @@ var P = [
|
|
|
55
55
|
longitude: "",
|
|
56
56
|
description: ""
|
|
57
57
|
};
|
|
58
|
-
function
|
|
59
|
-
let { navigateTo:
|
|
60
|
-
status:
|
|
61
|
-
type:
|
|
58
|
+
function P() {
|
|
59
|
+
let { navigateTo: P } = e(), [F, I] = f("ALL"), [L, R] = f("ALL"), [z, B] = f(""), V = c(), [H, U] = f(!1), [W, G] = f(N), [K, q] = f(null), { data: J, isLoading: ue, isError: de, refetch: fe } = s({
|
|
60
|
+
status: F === "ALL" ? void 0 : F,
|
|
61
|
+
type: L === "ALL" ? void 0 : L,
|
|
62
62
|
pagination: {
|
|
63
|
-
limit:
|
|
64
|
-
cursor:
|
|
63
|
+
limit: M,
|
|
64
|
+
cursor: V.cursor
|
|
65
65
|
}
|
|
66
|
-
}),
|
|
66
|
+
}), Y = o(), X = d(() => J?.items ?? [], [J]), Z = z.trim().toLowerCase(), Q = d(() => Z ? X.filter((e) => [
|
|
67
|
+
e.name,
|
|
68
|
+
e.code,
|
|
69
|
+
e.region,
|
|
70
|
+
e.country
|
|
71
|
+
].some((e) => (e ?? "").toLowerCase().includes(Z))) : X, [X, Z]), pe = [
|
|
67
72
|
{
|
|
68
73
|
key: "name",
|
|
69
74
|
header: "Site",
|
|
70
|
-
render: (e) => /* @__PURE__ */
|
|
75
|
+
render: (e) => /* @__PURE__ */ v("div", {
|
|
71
76
|
className: "flex items-center gap-3",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ _(ae, { type: e.type }), /* @__PURE__ */ v("div", {
|
|
73
78
|
className: "min-w-0",
|
|
74
|
-
children: [/* @__PURE__ */
|
|
79
|
+
children: [/* @__PURE__ */ _("p", {
|
|
75
80
|
className: "truncate font-semibold text-text-primary",
|
|
76
81
|
children: e.name
|
|
77
|
-
}), e.code && /* @__PURE__ */
|
|
82
|
+
}), e.code && /* @__PURE__ */ _("p", {
|
|
78
83
|
className: "truncate text-xs text-text-tertiary",
|
|
79
84
|
children: e.code
|
|
80
85
|
})]
|
|
@@ -85,7 +90,7 @@ function R() {
|
|
|
85
90
|
key: "type",
|
|
86
91
|
header: "Type",
|
|
87
92
|
hideOnMobile: !0,
|
|
88
|
-
render: (e) => /* @__PURE__ */
|
|
93
|
+
render: (e) => /* @__PURE__ */ _(ie, { type: e.type })
|
|
89
94
|
},
|
|
90
95
|
{
|
|
91
96
|
key: "location",
|
|
@@ -93,10 +98,10 @@ function R() {
|
|
|
93
98
|
hideOnMobile: !0,
|
|
94
99
|
render: (e) => {
|
|
95
100
|
let t = [e.region, e.country].filter(Boolean).join(", ");
|
|
96
|
-
return t ? /* @__PURE__ */
|
|
101
|
+
return t ? /* @__PURE__ */ v("span", {
|
|
97
102
|
className: "inline-flex items-center gap-1.5 text-text-secondary",
|
|
98
|
-
children: [/* @__PURE__ */
|
|
99
|
-
}) : /* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ _(p, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }), t]
|
|
104
|
+
}) : /* @__PURE__ */ _("span", {
|
|
100
105
|
className: "text-text-tertiary",
|
|
101
106
|
children: "—"
|
|
102
107
|
});
|
|
@@ -108,10 +113,10 @@ function R() {
|
|
|
108
113
|
align: "right",
|
|
109
114
|
hideOnMobile: !0,
|
|
110
115
|
sortValue: (e) => e.areaHectares ?? 0,
|
|
111
|
-
render: (e) => e.areaHectares == null ? /* @__PURE__ */
|
|
116
|
+
render: (e) => e.areaHectares == null ? /* @__PURE__ */ _("span", {
|
|
112
117
|
className: "text-text-tertiary",
|
|
113
118
|
children: "—"
|
|
114
|
-
}) : /* @__PURE__ */
|
|
119
|
+
}) : /* @__PURE__ */ v("span", {
|
|
115
120
|
className: "tabular-nums text-text-secondary",
|
|
116
121
|
children: [r(e.areaHectares), " ha"]
|
|
117
122
|
})
|
|
@@ -119,279 +124,311 @@ function R() {
|
|
|
119
124
|
{
|
|
120
125
|
key: "status",
|
|
121
126
|
header: "Status",
|
|
122
|
-
render: (e) => /* @__PURE__ */
|
|
127
|
+
render: (e) => /* @__PURE__ */ _(te, { status: e.status })
|
|
123
128
|
},
|
|
124
129
|
{
|
|
125
130
|
key: "updated",
|
|
126
131
|
header: "Updated",
|
|
127
132
|
align: "right",
|
|
128
133
|
hideOnMobile: !0,
|
|
129
|
-
render: (e) => /* @__PURE__ */
|
|
134
|
+
render: (e) => /* @__PURE__ */ _("span", {
|
|
130
135
|
className: "text-text-tertiary",
|
|
131
|
-
children:
|
|
136
|
+
children: ee(e.updatedAt)
|
|
132
137
|
})
|
|
133
138
|
}
|
|
134
139
|
], $ = () => {
|
|
135
|
-
|
|
140
|
+
G(N), q(null);
|
|
136
141
|
};
|
|
137
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ v(t, {
|
|
138
143
|
title: "Sites",
|
|
139
144
|
description: "Monitored locations — facilities, watersheds, forests, wetlands, farms & protected areas.",
|
|
140
|
-
actions: /* @__PURE__ */
|
|
141
|
-
onClick: () =>
|
|
142
|
-
children: [/* @__PURE__ */
|
|
145
|
+
actions: /* @__PURE__ */ v(y, {
|
|
146
|
+
onClick: () => U(!0),
|
|
147
|
+
children: [/* @__PURE__ */ _(m, { className: "mr-1.5 h-4 w-4" }), " New site"]
|
|
143
148
|
}),
|
|
144
149
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ v("div", {
|
|
146
151
|
className: "mb-5 flex flex-wrap items-center gap-3",
|
|
147
|
-
children: [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
children:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ _(re, {
|
|
154
|
+
options: A,
|
|
155
|
+
value: F,
|
|
156
|
+
onChange: (e) => {
|
|
157
|
+
I(e), V.reset();
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ v(w, {
|
|
161
|
+
value: L,
|
|
162
|
+
onValueChange: (e) => {
|
|
163
|
+
R(e), V.reset();
|
|
164
|
+
},
|
|
165
|
+
children: [/* @__PURE__ */ _(D, {
|
|
166
|
+
className: "w-44",
|
|
167
|
+
children: /* @__PURE__ */ _(O, { placeholder: "All types" })
|
|
168
|
+
}), /* @__PURE__ */ v(T, { children: [/* @__PURE__ */ _(E, {
|
|
169
|
+
value: "ALL",
|
|
170
|
+
children: "All types"
|
|
171
|
+
}), j.map((e) => /* @__PURE__ */ _(E, {
|
|
172
|
+
value: e,
|
|
173
|
+
children: n(e)
|
|
174
|
+
}, e))] })]
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ v("div", {
|
|
177
|
+
className: "relative",
|
|
178
|
+
children: [/* @__PURE__ */ _(h, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary" }), /* @__PURE__ */ _(b, {
|
|
179
|
+
value: z,
|
|
180
|
+
onChange: (e) => B(e.target.value),
|
|
181
|
+
placeholder: "Search this page…",
|
|
182
|
+
className: "w-full pl-9 sm:w-64",
|
|
183
|
+
"aria-label": "Search loaded sites by name, code or location"
|
|
184
|
+
})]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
169
187
|
}),
|
|
170
|
-
|
|
188
|
+
ue ? /* @__PURE__ */ _(i, { label: "Loading sites…" }) : de ? /* @__PURE__ */ _(ne, {
|
|
171
189
|
message: "Couldn't load sites.",
|
|
172
|
-
onRetry: () =>
|
|
173
|
-
}) :
|
|
190
|
+
onRetry: () => fe()
|
|
191
|
+
}) : X.length === 0 ? /* @__PURE__ */ _(a, {
|
|
174
192
|
illustration: "empty-data",
|
|
175
|
-
icon: /* @__PURE__ */
|
|
193
|
+
icon: /* @__PURE__ */ _(p, { className: "h-10 w-10" }),
|
|
176
194
|
title: "No sites yet",
|
|
177
|
-
description:
|
|
178
|
-
action: /* @__PURE__ */
|
|
179
|
-
onClick: () =>
|
|
180
|
-
children: [/* @__PURE__ */
|
|
195
|
+
description: F === "ALL" && L === "ALL" ? "Create your first monitored site to start collecting environmental data." : "No sites match these filters.",
|
|
196
|
+
action: /* @__PURE__ */ v(y, {
|
|
197
|
+
onClick: () => U(!0),
|
|
198
|
+
children: [/* @__PURE__ */ _(m, { className: "mr-1.5 h-4 w-4" }), " New site"]
|
|
199
|
+
})
|
|
200
|
+
}) : Q.length === 0 ? /* @__PURE__ */ _(a, {
|
|
201
|
+
icon: /* @__PURE__ */ _(h, { className: "h-10 w-10" }),
|
|
202
|
+
title: "No matches on this page",
|
|
203
|
+
description: `No sites on this page match “${z.trim()}”. Clear the search or page through the list.`,
|
|
204
|
+
action: /* @__PURE__ */ _(y, {
|
|
205
|
+
variant: "outline",
|
|
206
|
+
onClick: () => B(""),
|
|
207
|
+
children: "Clear search"
|
|
181
208
|
})
|
|
182
|
-
}) : /* @__PURE__ */
|
|
183
|
-
columns:
|
|
209
|
+
}) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(l, {
|
|
210
|
+
columns: pe,
|
|
184
211
|
rows: Q,
|
|
185
212
|
rowKey: (e) => e.id,
|
|
186
|
-
onRowClick: (e) =>
|
|
187
|
-
}), /* @__PURE__ */
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
213
|
+
onRowClick: (e) => P(`sites/${e.id}`)
|
|
214
|
+
}), Z ? /* @__PURE__ */ v("p", {
|
|
215
|
+
className: "mt-4 text-sm tabular-nums text-text-secondary",
|
|
216
|
+
children: [
|
|
217
|
+
Q.length,
|
|
218
|
+
" of ",
|
|
219
|
+
X.length,
|
|
220
|
+
" on this page match “",
|
|
221
|
+
z.trim(),
|
|
222
|
+
"”"
|
|
223
|
+
]
|
|
224
|
+
}) : /* @__PURE__ */ _(u, {
|
|
225
|
+
page: V.page,
|
|
226
|
+
pageSize: M,
|
|
227
|
+
itemCount: X.length,
|
|
228
|
+
hasMore: J?.pageInfo?.hasMore ?? !1,
|
|
229
|
+
onPageChange: (e) => V.onPageChange(e, J?.pageInfo?.cursor)
|
|
193
230
|
})] }),
|
|
194
|
-
/* @__PURE__ */ S
|
|
195
|
-
open:
|
|
231
|
+
/* @__PURE__ */ _(S, {
|
|
232
|
+
open: H,
|
|
196
233
|
onOpenChange: (e) => {
|
|
197
|
-
|
|
234
|
+
U(e), e || $();
|
|
198
235
|
},
|
|
199
|
-
children: /* @__PURE__ */ C
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ v(C, { children: [
|
|
237
|
+
/* @__PURE__ */ v(ce, { children: [/* @__PURE__ */ _(le, { children: "New site" }), /* @__PURE__ */ _(oe, { children: "Register a location to monitor and attribute environmental data to." })] }),
|
|
238
|
+
/* @__PURE__ */ v("div", {
|
|
202
239
|
className: "grid gap-4 py-2",
|
|
203
240
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ v("div", {
|
|
205
242
|
className: "grid gap-2 sm:grid-cols-2",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
243
|
+
children: [/* @__PURE__ */ v("div", {
|
|
207
244
|
className: "grid gap-1.5",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
245
|
+
children: [/* @__PURE__ */ _(x, {
|
|
209
246
|
htmlFor: "name",
|
|
210
247
|
children: "Name *"
|
|
211
|
-
}), /* @__PURE__ */
|
|
248
|
+
}), /* @__PURE__ */ _(b, {
|
|
212
249
|
id: "name",
|
|
213
|
-
value:
|
|
214
|
-
onChange: (e) =>
|
|
215
|
-
...
|
|
250
|
+
value: W.name,
|
|
251
|
+
onChange: (e) => G({
|
|
252
|
+
...W,
|
|
216
253
|
name: e.target.value
|
|
217
254
|
}),
|
|
218
255
|
placeholder: "Palar Wetland Reserve"
|
|
219
256
|
})]
|
|
220
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ v("div", {
|
|
221
258
|
className: "grid gap-1.5",
|
|
222
|
-
children: [/* @__PURE__ */
|
|
259
|
+
children: [/* @__PURE__ */ _(x, {
|
|
223
260
|
htmlFor: "code",
|
|
224
261
|
children: "Code"
|
|
225
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ _(b, {
|
|
226
263
|
id: "code",
|
|
227
|
-
value:
|
|
228
|
-
onChange: (e) =>
|
|
229
|
-
...
|
|
264
|
+
value: W.code,
|
|
265
|
+
onChange: (e) => G({
|
|
266
|
+
...W,
|
|
230
267
|
code: e.target.value
|
|
231
268
|
}),
|
|
232
269
|
placeholder: "SITE-PWR"
|
|
233
270
|
})]
|
|
234
271
|
})]
|
|
235
272
|
}),
|
|
236
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ v("div", {
|
|
237
274
|
className: "grid gap-2 sm:grid-cols-2",
|
|
238
|
-
children: [/* @__PURE__ */
|
|
275
|
+
children: [/* @__PURE__ */ v("div", {
|
|
239
276
|
className: "grid gap-1.5",
|
|
240
|
-
children: [/* @__PURE__ */
|
|
277
|
+
children: [/* @__PURE__ */ _(x, {
|
|
241
278
|
htmlFor: "type",
|
|
242
279
|
children: "Type"
|
|
243
|
-
}), /* @__PURE__ */
|
|
244
|
-
value:
|
|
245
|
-
onValueChange: (e) =>
|
|
246
|
-
...
|
|
280
|
+
}), /* @__PURE__ */ v(w, {
|
|
281
|
+
value: W.type,
|
|
282
|
+
onValueChange: (e) => G({
|
|
283
|
+
...W,
|
|
247
284
|
type: e
|
|
248
285
|
}),
|
|
249
|
-
children: [/* @__PURE__ */
|
|
286
|
+
children: [/* @__PURE__ */ _(D, {
|
|
250
287
|
id: "type",
|
|
251
|
-
children: /* @__PURE__ */
|
|
252
|
-
}), /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ _(O, {})
|
|
289
|
+
}), /* @__PURE__ */ _(T, { children: j.map((e) => /* @__PURE__ */ _(E, {
|
|
253
290
|
value: e,
|
|
254
291
|
children: n(e)
|
|
255
292
|
}, e)) })]
|
|
256
293
|
})]
|
|
257
|
-
}), /* @__PURE__ */
|
|
294
|
+
}), /* @__PURE__ */ v("div", {
|
|
258
295
|
className: "grid gap-1.5",
|
|
259
|
-
children: [/* @__PURE__ */
|
|
296
|
+
children: [/* @__PURE__ */ _(x, {
|
|
260
297
|
htmlFor: "area",
|
|
261
298
|
children: "Area (hectares)"
|
|
262
|
-
}), /* @__PURE__ */
|
|
299
|
+
}), /* @__PURE__ */ _(b, {
|
|
263
300
|
id: "area",
|
|
264
301
|
type: "number",
|
|
265
302
|
min: "0",
|
|
266
303
|
step: "any",
|
|
267
|
-
value:
|
|
268
|
-
onChange: (e) =>
|
|
269
|
-
...
|
|
304
|
+
value: W.areaHectares,
|
|
305
|
+
onChange: (e) => G({
|
|
306
|
+
...W,
|
|
270
307
|
areaHectares: e.target.value
|
|
271
308
|
}),
|
|
272
309
|
placeholder: "42.5"
|
|
273
310
|
})]
|
|
274
311
|
})]
|
|
275
312
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ v("div", {
|
|
277
314
|
className: "grid gap-2 sm:grid-cols-2",
|
|
278
|
-
children: [/* @__PURE__ */
|
|
315
|
+
children: [/* @__PURE__ */ v("div", {
|
|
279
316
|
className: "grid gap-1.5",
|
|
280
|
-
children: [/* @__PURE__ */
|
|
317
|
+
children: [/* @__PURE__ */ _(x, {
|
|
281
318
|
htmlFor: "region",
|
|
282
319
|
children: "Region"
|
|
283
|
-
}), /* @__PURE__ */
|
|
320
|
+
}), /* @__PURE__ */ _(b, {
|
|
284
321
|
id: "region",
|
|
285
|
-
value:
|
|
286
|
-
onChange: (e) =>
|
|
287
|
-
...
|
|
322
|
+
value: W.region,
|
|
323
|
+
onChange: (e) => G({
|
|
324
|
+
...W,
|
|
288
325
|
region: e.target.value
|
|
289
326
|
}),
|
|
290
327
|
placeholder: "Tamil Nadu"
|
|
291
328
|
})]
|
|
292
|
-
}), /* @__PURE__ */
|
|
329
|
+
}), /* @__PURE__ */ v("div", {
|
|
293
330
|
className: "grid gap-1.5",
|
|
294
|
-
children: [/* @__PURE__ */
|
|
331
|
+
children: [/* @__PURE__ */ _(x, {
|
|
295
332
|
htmlFor: "country",
|
|
296
333
|
children: "Country"
|
|
297
|
-
}), /* @__PURE__ */
|
|
334
|
+
}), /* @__PURE__ */ _(b, {
|
|
298
335
|
id: "country",
|
|
299
|
-
value:
|
|
300
|
-
onChange: (e) =>
|
|
301
|
-
...
|
|
336
|
+
value: W.country,
|
|
337
|
+
onChange: (e) => G({
|
|
338
|
+
...W,
|
|
302
339
|
country: e.target.value
|
|
303
340
|
}),
|
|
304
341
|
placeholder: "India"
|
|
305
342
|
})]
|
|
306
343
|
})]
|
|
307
344
|
}),
|
|
308
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ v("div", {
|
|
309
346
|
className: "grid gap-2 sm:grid-cols-2",
|
|
310
|
-
children: [/* @__PURE__ */
|
|
347
|
+
children: [/* @__PURE__ */ v("div", {
|
|
311
348
|
className: "grid gap-1.5",
|
|
312
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ _(x, {
|
|
313
350
|
htmlFor: "lat",
|
|
314
351
|
children: "Latitude"
|
|
315
|
-
}), /* @__PURE__ */
|
|
352
|
+
}), /* @__PURE__ */ _(b, {
|
|
316
353
|
id: "lat",
|
|
317
354
|
type: "number",
|
|
318
355
|
step: "any",
|
|
319
|
-
value:
|
|
320
|
-
onChange: (e) =>
|
|
321
|
-
...
|
|
356
|
+
value: W.latitude,
|
|
357
|
+
onChange: (e) => G({
|
|
358
|
+
...W,
|
|
322
359
|
latitude: e.target.value
|
|
323
360
|
}),
|
|
324
361
|
placeholder: "12.9716"
|
|
325
362
|
})]
|
|
326
|
-
}), /* @__PURE__ */
|
|
363
|
+
}), /* @__PURE__ */ v("div", {
|
|
327
364
|
className: "grid gap-1.5",
|
|
328
|
-
children: [/* @__PURE__ */
|
|
365
|
+
children: [/* @__PURE__ */ _(x, {
|
|
329
366
|
htmlFor: "lng",
|
|
330
367
|
children: "Longitude"
|
|
331
|
-
}), /* @__PURE__ */
|
|
368
|
+
}), /* @__PURE__ */ _(b, {
|
|
332
369
|
id: "lng",
|
|
333
370
|
type: "number",
|
|
334
371
|
step: "any",
|
|
335
|
-
value:
|
|
336
|
-
onChange: (e) =>
|
|
337
|
-
...
|
|
372
|
+
value: W.longitude,
|
|
373
|
+
onChange: (e) => G({
|
|
374
|
+
...W,
|
|
338
375
|
longitude: e.target.value
|
|
339
376
|
}),
|
|
340
377
|
placeholder: "77.5946"
|
|
341
378
|
})]
|
|
342
379
|
})]
|
|
343
380
|
}),
|
|
344
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ v("div", {
|
|
345
382
|
className: "grid gap-1.5",
|
|
346
|
-
children: [/* @__PURE__ */
|
|
383
|
+
children: [/* @__PURE__ */ _(x, {
|
|
347
384
|
htmlFor: "description",
|
|
348
385
|
children: "Description"
|
|
349
|
-
}), /* @__PURE__ */
|
|
386
|
+
}), /* @__PURE__ */ _(k, {
|
|
350
387
|
id: "description",
|
|
351
|
-
value:
|
|
352
|
-
onChange: (e) =>
|
|
353
|
-
...
|
|
388
|
+
value: W.description,
|
|
389
|
+
onChange: (e) => G({
|
|
390
|
+
...W,
|
|
354
391
|
description: e.target.value
|
|
355
392
|
}),
|
|
356
393
|
placeholder: "Optional context about this site.",
|
|
357
394
|
rows: 2
|
|
358
395
|
})]
|
|
359
396
|
}),
|
|
360
|
-
|
|
397
|
+
K && /* @__PURE__ */ _("p", {
|
|
361
398
|
className: "text-sm text-status-error-text",
|
|
362
|
-
children:
|
|
399
|
+
children: K
|
|
363
400
|
})
|
|
364
401
|
]
|
|
365
402
|
}),
|
|
366
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ v(se, { children: [/* @__PURE__ */ _(y, {
|
|
367
404
|
variant: "outline",
|
|
368
|
-
onClick: () =>
|
|
405
|
+
onClick: () => U(!1),
|
|
369
406
|
children: "Cancel"
|
|
370
|
-
}), /* @__PURE__ */
|
|
407
|
+
}), /* @__PURE__ */ _(y, {
|
|
371
408
|
onClick: async () => {
|
|
372
|
-
if (!
|
|
373
|
-
|
|
409
|
+
if (!W.name.trim()) {
|
|
410
|
+
q("Site name is required.");
|
|
374
411
|
return;
|
|
375
412
|
}
|
|
376
413
|
try {
|
|
377
|
-
let e = await
|
|
378
|
-
name:
|
|
379
|
-
code:
|
|
380
|
-
type:
|
|
381
|
-
region:
|
|
382
|
-
country:
|
|
383
|
-
areaHectares:
|
|
384
|
-
latitude:
|
|
385
|
-
longitude:
|
|
386
|
-
description:
|
|
414
|
+
let e = await Y.mutateAsync({
|
|
415
|
+
name: W.name.trim(),
|
|
416
|
+
code: W.code.trim() || null,
|
|
417
|
+
type: W.type,
|
|
418
|
+
region: W.region.trim() || null,
|
|
419
|
+
country: W.country.trim() || null,
|
|
420
|
+
areaHectares: W.areaHectares ? Number(W.areaHectares) : null,
|
|
421
|
+
latitude: W.latitude ? Number(W.latitude) : null,
|
|
422
|
+
longitude: W.longitude ? Number(W.longitude) : null,
|
|
423
|
+
description: W.description.trim() || null
|
|
387
424
|
});
|
|
388
|
-
|
|
425
|
+
U(!1), $(), P(`sites/${e.id}`);
|
|
389
426
|
} catch (e) {
|
|
390
|
-
|
|
427
|
+
q(e instanceof Error ? e.message : "Failed to create site.");
|
|
391
428
|
}
|
|
392
429
|
},
|
|
393
|
-
disabled:
|
|
394
|
-
children:
|
|
430
|
+
disabled: Y.isPending,
|
|
431
|
+
children: Y.isPending ? "Creating…" : "Create site"
|
|
395
432
|
})] })
|
|
396
433
|
] })
|
|
397
434
|
})
|
|
@@ -399,6 +436,6 @@ function R() {
|
|
|
399
436
|
});
|
|
400
437
|
}
|
|
401
438
|
//#endregion
|
|
402
|
-
export {
|
|
439
|
+
export { P as SitesPage };
|
|
403
440
|
|
|
404
441
|
//# sourceMappingURL=SitesPage.js.map
|