@burdenoff/microfe-healthybowl 2026.713.2 → 2026.713.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { __toESM as e } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { geocodePlace as t } from "../../utils/geocode.js";
|
|
3
3
|
import { useHealthyBowl as n } from "../../context/HealthyBowlContext.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
4
|
+
import { useBasePath as r } from "../../hooks/useBasePath.js";
|
|
5
|
+
import { PageLayout as i } from "../../components/PageLayout.js";
|
|
6
|
+
import { EmptyState as a } from "../../components/EmptyState.js";
|
|
7
|
+
import { ErrorState as o } from "../../components/ErrorState.js";
|
|
8
|
+
import { ToastContainer as ee } from "../../components/Toast.js";
|
|
9
|
+
import { useConfirm as te } from "../../components/ConfirmDialog.js";
|
|
10
|
+
import { Modal as ne } from "../../components/Modal.js";
|
|
11
|
+
import { require_leaflet_src as s } from "../../../node_modules/leaflet/dist/leaflet-src.js";
|
|
12
|
+
import { useToast as re } from "../../hooks/useToast.js";
|
|
13
|
+
import { ensureLeafletCss as ie } from "../../utils/leaflet.js";
|
|
14
|
+
import { extractPolygon as ae, isValidPolygon as oe, polygonAreaInUnit as se, polygonAreaSqMeters as c, polygonCentroid as ce, ringToPolygon as le } from "../../utils/geo.js";
|
|
15
|
+
import { SOIL_PALETTE as ue, soilColor as de, soilLegendFor as fe } from "../../utils/soil.js";
|
|
16
|
+
import { elevationColor as pe, fetchElevations as me } from "../../utils/elevation.js";
|
|
17
|
+
import { bedPlantCount as he, generateBeds as ge } from "../../utils/bedLayout.js";
|
|
16
18
|
import "../../utils/index.js";
|
|
17
19
|
import "../../components/index.js";
|
|
18
|
-
import { useHealthyBowlData as
|
|
19
|
-
import { DEFAULT_BED_WIDTH_M as
|
|
20
|
-
import { useCallback as
|
|
21
|
-
import { useI18n as
|
|
22
|
-
import { Check as
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
20
|
+
import { useHealthyBowlData as _e } from "../../hooks/useHealthyBowlData.js";
|
|
21
|
+
import { DEFAULT_BED_WIDTH_M as ve, DEFAULT_PATH_WIDTH_M as ye, getCropSpacingPreset as be } from "../../utils/plantingCapacity.js";
|
|
22
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
23
|
+
import { useI18n as xe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
24
|
+
import { Check as Se, Droplet as m, Fence as h, Layers as Ce, LayoutGrid as we, LocateFixed as Te, MapPinned as Ee, Pencil as De, Plus as Oe, Ruler as ke, Save as Ae, Search as je, Shapes as Me, Spline as Ne, Sprout as g, Square as Pe, Trash2 as Fe, TriangleAlert as Ie, Warehouse as Le, Waypoints as _, X as Re } from "lucide-react";
|
|
25
|
+
import { useNavigate as ze } from "react-router-dom";
|
|
26
|
+
import { Fragment as Be, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
27
|
+
import { Button as b, Select as Ve, SelectContent as He, SelectItem as x, SelectTrigger as Ue, SelectValue as We } from "@burdenoff/fe-libs/ui";
|
|
28
|
+
import { gql as S } from "@apollo/client";
|
|
29
|
+
import { useMutation as C, useQuery as Ge } from "@apollo/client/react";
|
|
27
30
|
//#region src/healthybowl/pages/fields/FieldMapPage.tsx
|
|
28
|
-
var
|
|
31
|
+
var w = /* @__PURE__ */ e(s(), 1), Ke = S`
|
|
29
32
|
mutation UpdateHealthyBowlFieldBoundaryOnMapPage($input: UpdateHealthyBowlFieldInput!) {
|
|
30
33
|
updateHealthyBowlField(input: $input) {
|
|
31
34
|
id
|
|
@@ -34,7 +37,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
34
37
|
location
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
`,
|
|
40
|
+
`, qe = S`
|
|
38
41
|
query HealthyBowlBedsOnMapPage($context: ContextInput!, $fieldId: ID) {
|
|
39
42
|
healthyBowlBeds(context: $context, fieldId: $fieldId) {
|
|
40
43
|
id
|
|
@@ -50,13 +53,13 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
50
53
|
status
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
|
-
`,
|
|
56
|
+
`, Je = S`
|
|
54
57
|
mutation CreateHealthyBowlBedOnMapPage($input: CreateHealthyBowlBedInput!) {
|
|
55
58
|
createHealthyBowlBed(input: $input) {
|
|
56
59
|
id
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
`,
|
|
62
|
+
`, Ye = S`
|
|
60
63
|
mutation UpdateHealthyBowlBedOnMapPage($input: UpdateHealthyBowlBedInput!) {
|
|
61
64
|
updateHealthyBowlBed(input: $input) {
|
|
62
65
|
id
|
|
@@ -64,11 +67,11 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
64
67
|
plantCount
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
`,
|
|
70
|
+
`, Xe = S`
|
|
68
71
|
mutation DeleteHealthyBowlBedOnMapPage($id: ID!, $context: ContextInput!) {
|
|
69
72
|
deleteHealthyBowlBed(id: $id, context: $context)
|
|
70
73
|
}
|
|
71
|
-
`,
|
|
74
|
+
`, Ze = S`
|
|
72
75
|
query HealthyBowlMapFeaturesOnMapPage($context: ContextInput!) {
|
|
73
76
|
healthyBowlMapFeatures(context: $context) {
|
|
74
77
|
id
|
|
@@ -79,17 +82,17 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
79
82
|
color
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
`,
|
|
85
|
+
`, Qe = S`
|
|
83
86
|
mutation CreateHealthyBowlMapFeatureOnMapPage($input: CreateHealthyBowlMapFeatureInput!) {
|
|
84
87
|
createHealthyBowlMapFeature(input: $input) {
|
|
85
88
|
id
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
`,
|
|
91
|
+
`, $e = S`
|
|
89
92
|
mutation DeleteHealthyBowlMapFeatureOnMapPage($id: ID!, $context: ContextInput!) {
|
|
90
93
|
deleteHealthyBowlMapFeature(id: $id, context: $context)
|
|
91
94
|
}
|
|
92
|
-
`,
|
|
95
|
+
`, et = [
|
|
93
96
|
{
|
|
94
97
|
type: "BUFFER_ZONE",
|
|
95
98
|
kind: "polygon",
|
|
@@ -103,7 +106,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
103
106
|
fillColor: "#f59e0b",
|
|
104
107
|
fillOpacity: .15
|
|
105
108
|
},
|
|
106
|
-
icon:
|
|
109
|
+
icon: Pe
|
|
107
110
|
},
|
|
108
111
|
{
|
|
109
112
|
type: "GREENHOUSE",
|
|
@@ -117,7 +120,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
117
120
|
fillColor: "#14b8a6",
|
|
118
121
|
fillOpacity: .3
|
|
119
122
|
},
|
|
120
|
-
icon:
|
|
123
|
+
icon: g
|
|
121
124
|
},
|
|
122
125
|
{
|
|
123
126
|
type: "BUILDING",
|
|
@@ -131,7 +134,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
131
134
|
fillColor: "#6b7280",
|
|
132
135
|
fillOpacity: .4
|
|
133
136
|
},
|
|
134
|
-
icon:
|
|
137
|
+
icon: Le
|
|
135
138
|
},
|
|
136
139
|
{
|
|
137
140
|
type: "ENCLOSURE",
|
|
@@ -146,7 +149,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
146
149
|
fillColor: "#92400e",
|
|
147
150
|
fillOpacity: .2
|
|
148
151
|
},
|
|
149
|
-
icon:
|
|
152
|
+
icon: h
|
|
150
153
|
},
|
|
151
154
|
{
|
|
152
155
|
type: "CUSTOM",
|
|
@@ -160,7 +163,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
160
163
|
fillColor: "#8b5cf6",
|
|
161
164
|
fillOpacity: .25
|
|
162
165
|
},
|
|
163
|
-
icon:
|
|
166
|
+
icon: Me
|
|
164
167
|
},
|
|
165
168
|
{
|
|
166
169
|
type: "IRRIGATION_LINE",
|
|
@@ -172,7 +175,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
172
175
|
color: "#3b82f6",
|
|
173
176
|
weight: 3
|
|
174
177
|
},
|
|
175
|
-
icon:
|
|
178
|
+
icon: _
|
|
176
179
|
},
|
|
177
180
|
{
|
|
178
181
|
type: "WATER_SOURCE",
|
|
@@ -186,7 +189,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
186
189
|
fillColor: "#3b82f6",
|
|
187
190
|
fillOpacity: 1
|
|
188
191
|
},
|
|
189
|
-
icon:
|
|
192
|
+
icon: m
|
|
190
193
|
},
|
|
191
194
|
{
|
|
192
195
|
type: "HAZARD",
|
|
@@ -200,70 +203,70 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
|
|
|
200
203
|
fillColor: "#dc2626",
|
|
201
204
|
fillOpacity: 1
|
|
202
205
|
},
|
|
203
|
-
icon:
|
|
206
|
+
icon: Ie
|
|
204
207
|
}
|
|
205
|
-
],
|
|
206
|
-
async function
|
|
208
|
+
], T = new Map(et.map((e) => [e.type, e])), tt = (e) => e === "polygon" ? "Area" : e === "line" ? "Line" : "Point", nt = 250, rt = 20;
|
|
209
|
+
async function it(e, t, n) {
|
|
207
210
|
for (let r = 0; r < e.length; r += t) await Promise.all(e.slice(r, r + t).map(n));
|
|
208
211
|
}
|
|
209
|
-
var
|
|
212
|
+
var at = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", ot = "Esri, Maxar, Earthstar Geographics", st = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", ct = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", lt = 21, ut = 16, dt = 2.47105, ft = "#16a34a", pt = {
|
|
210
213
|
color: "#f59e0b",
|
|
211
214
|
weight: 2,
|
|
212
215
|
dashArray: "6 4",
|
|
213
216
|
fillColor: "#f59e0b",
|
|
214
217
|
fillOpacity: .15
|
|
215
|
-
},
|
|
218
|
+
}, mt = {
|
|
216
219
|
color: "#ffffff",
|
|
217
220
|
weight: 2,
|
|
218
221
|
dashArray: "6 4",
|
|
219
222
|
fillColor: "#22c55e",
|
|
220
223
|
fillOpacity: .2
|
|
221
|
-
},
|
|
224
|
+
}, ht = {
|
|
222
225
|
color: "#38bdf8",
|
|
223
226
|
weight: 3,
|
|
224
227
|
dashArray: "6 6"
|
|
225
|
-
},
|
|
228
|
+
}, gt = {
|
|
226
229
|
color: "#b45309",
|
|
227
230
|
weight: 1,
|
|
228
231
|
dashArray: "4 3",
|
|
229
232
|
fillColor: "#f59e0b",
|
|
230
233
|
fillOpacity: .25
|
|
231
|
-
},
|
|
234
|
+
}, _t = {
|
|
232
235
|
color: "#065f46",
|
|
233
236
|
weight: 2,
|
|
234
237
|
fillColor: "#34d399",
|
|
235
238
|
fillOpacity: .5
|
|
236
|
-
},
|
|
239
|
+
}, vt = {
|
|
237
240
|
color: "#065f46",
|
|
238
241
|
weight: 2,
|
|
239
242
|
fillColor: "#059669",
|
|
240
243
|
fillOpacity: .6
|
|
241
|
-
},
|
|
242
|
-
let t =
|
|
243
|
-
return t &&
|
|
244
|
-
},
|
|
244
|
+
}, yt = (e) => !!(e && Number.isFinite(e.lat) && Number.isFinite(e.lng) && e.lat >= -90 && e.lat <= 90 && e.lng >= -180 && e.lng <= 180 && (e.lat !== 0 || e.lng !== 0)), E = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), bt = (e) => E(e.unit) ? e.area * dt : e.area, xt = (e) => `${e.area.toFixed(1)} ${E(e.unit) ? "ha" : "ac"}`, D = (e) => {
|
|
245
|
+
let t = ae(e.boundary);
|
|
246
|
+
return t && oe(t) ? t : null;
|
|
247
|
+
}, St = w.default.divIcon({
|
|
245
248
|
className: "",
|
|
246
249
|
html: "<span style=\"display:block;width:12px;height:12px;background:#22c55e;border:2px solid #fff;border-radius:2px;box-shadow:0 0 3px rgba(0,0,0,.6)\"></span>",
|
|
247
250
|
iconSize: [16, 16],
|
|
248
251
|
iconAnchor: [8, 8]
|
|
249
|
-
}),
|
|
250
|
-
let { t: e } =
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}, [
|
|
254
|
-
|
|
255
|
-
}, [
|
|
256
|
-
|
|
257
|
-
}, [
|
|
258
|
-
let
|
|
259
|
-
let e =
|
|
260
|
-
return e ?
|
|
261
|
-
}, [
|
|
252
|
+
}), Ct = () => {
|
|
253
|
+
let { t: e } = xe(), { workspaceId: s } = n(), m = te(), { fields: h, crops: g, farm: Pe, loadings: Ie, errors: Le, refetch: _, createField: S } = _e(), { toasts: dt, toast: E, dismiss: Ct } = re(), wt = ze(), { buildPath: Tt } = r(), Et = !!Pe?.id, [Dt] = C(Ke), [Ot] = C(Je), [kt] = C(Ye), [At] = C(Xe), [jt] = C(Qe), [Mt] = C($e), [O, Nt] = p("loading"), [k, A] = p("view"), [j, M] = p(null), [Pt, Ft] = p(!1), [It, Lt] = p(!0), [Rt, zt] = p(!1), [N, Bt] = p({}), [Vt, Ht] = p(""), [Ut, Wt] = p(""), [Gt, Kt] = p(!1), [qt, Jt] = p(0), [Yt, Xt] = p(null), [Zt, Qt] = p(!1), [$t, en] = p(!1), [P, tn] = p(null), [nn, rn] = p(!1), [F, an] = p(ve), [on, sn] = p(ye), [I, cn] = p(0), [ln, un] = p(""), [dn, fn] = p(!1), [pn, mn] = p(!1), [L, hn] = p(null), [gn, _n] = p(""), [vn, yn] = p(!1), [bn, xn] = p(!0), [Sn, Cn] = p(!1), [wn, Tn] = p(null), [En, Dn] = p(0), [R, On] = p(null), [kn, An] = p(""), [jn, Mn] = p(""), [Nn, Pn] = p(!1), [z, Fn] = p(null), [In, Ln] = p(!1), [B, Rn] = p(null), [zn, Bn] = p(!1), [Vn, Hn] = p(""), [Un, Wn] = p("Clay loam"), [Gn, Kn] = p("Drip"), [qn, Jn] = p("active"), Yn = f(null), V = f(null), Xn = f(null), Zn = f(null), Qn = f(null), $n = f(null), er = f(null), tr = f(null), nr = f(null), rr = f(null), H = f(null), U = f([]), ir = f(null), W = f(null), ar = f([]), or = f(null), sr = f([]), cr = f(null), lr = f([]), G = f("view"), ur = f(!1);
|
|
254
|
+
u(() => {
|
|
255
|
+
G.current = k;
|
|
256
|
+
}, [k]), u(() => {
|
|
257
|
+
W.current = wn;
|
|
258
|
+
}, [wn]), u(() => {
|
|
259
|
+
k !== "element" && (H.current?.clearLayers(), U.current = [], ir.current = null);
|
|
260
|
+
}, [k]);
|
|
261
|
+
let dr = d(() => h.filter((e) => D(e) !== null).length, [h]), fr = d(() => h.reduce((e, t) => e + bt(t), 0), [h]), pr = d(() => fe(h.map((e) => e.soilType)), [h]), K = d(() => h.find((e) => e.id === j) ?? null, [h, j]), mr = d(() => {
|
|
262
|
+
let e = Vt.trim().toLowerCase();
|
|
263
|
+
return e ? h.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : h;
|
|
264
|
+
}, [h, Vt]), hr = d(() => {
|
|
262
265
|
let e = [];
|
|
263
|
-
for (let t of
|
|
264
|
-
let n =
|
|
266
|
+
for (let t of h) {
|
|
267
|
+
let n = D(t);
|
|
265
268
|
if (n) {
|
|
266
|
-
let r =
|
|
269
|
+
let r = ce(n);
|
|
267
270
|
if (r) {
|
|
268
271
|
e.push({
|
|
269
272
|
id: t.id,
|
|
@@ -273,78 +276,78 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
273
276
|
continue;
|
|
274
277
|
}
|
|
275
278
|
}
|
|
276
|
-
|
|
279
|
+
yt(t.location) && e.push({
|
|
277
280
|
id: t.id,
|
|
278
281
|
lat: t.location.lat,
|
|
279
282
|
lng: t.location.lng
|
|
280
283
|
});
|
|
281
284
|
}
|
|
282
285
|
return e;
|
|
283
|
-
}, [
|
|
284
|
-
|
|
285
|
-
if (
|
|
286
|
-
|
|
286
|
+
}, [h]);
|
|
287
|
+
u(() => {
|
|
288
|
+
if (hr.length === 0) {
|
|
289
|
+
Bt({});
|
|
287
290
|
return;
|
|
288
291
|
}
|
|
289
292
|
let e = new AbortController(), t = !1;
|
|
290
|
-
return
|
|
293
|
+
return me(hr.map((e) => ({
|
|
291
294
|
lat: e.lat,
|
|
292
295
|
lng: e.lng
|
|
293
296
|
})), e.signal).then((e) => {
|
|
294
297
|
if (t) return;
|
|
295
298
|
let n = {};
|
|
296
|
-
|
|
299
|
+
hr.forEach((t, r) => {
|
|
297
300
|
n[t.id] = e[r] ?? null;
|
|
298
|
-
}),
|
|
301
|
+
}), Bt(n);
|
|
299
302
|
}), () => {
|
|
300
303
|
t = !0, e.abort();
|
|
301
304
|
};
|
|
302
|
-
}, [
|
|
303
|
-
let [
|
|
304
|
-
let e = Object.values(
|
|
305
|
+
}, [d(() => hr.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [hr])]);
|
|
306
|
+
let [gr, _r] = d(() => {
|
|
307
|
+
let e = Object.values(N).filter((e) => e != null && Number.isFinite(e));
|
|
305
308
|
return e.length === 0 ? [0, 0] : [Math.min(...e), Math.max(...e)];
|
|
306
|
-
}, [
|
|
309
|
+
}, [N]), vr = d(() => Object.values(N).some((e) => e != null && Number.isFinite(e)), [N]), yr = l((e) => {
|
|
307
310
|
if (!e) return "";
|
|
308
|
-
let t =
|
|
311
|
+
let t = g.find((t) => t.field === e.id || t.fieldName === e.name);
|
|
309
312
|
return t ? t.name : (e.crops ?? []).join(", ");
|
|
310
|
-
}, [
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
]),
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}, [
|
|
318
|
-
let
|
|
319
|
-
bedWidthM:
|
|
320
|
-
pathWidthM:
|
|
321
|
-
orientationDeg:
|
|
313
|
+
}, [g]), br = d(() => K ? D(K) : null, [K]), xr = d(() => K ? g.find((e) => e.field === K.id || e.fieldName === K.name) ?? null : null, [g, K]), Sr = d(() => g.find((e) => e.id === ln) ?? xr, [
|
|
314
|
+
g,
|
|
315
|
+
ln,
|
|
316
|
+
xr
|
|
317
|
+
]), q = d(() => be(Sr), [Sr]);
|
|
318
|
+
u(() => {
|
|
319
|
+
un("");
|
|
320
|
+
}, [j]);
|
|
321
|
+
let J = d(() => br ? ge(br, {
|
|
322
|
+
bedWidthM: F,
|
|
323
|
+
pathWidthM: on,
|
|
324
|
+
orientationDeg: I
|
|
322
325
|
}) : null, [
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
]),
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
]), { data:
|
|
326
|
+
br,
|
|
327
|
+
F,
|
|
328
|
+
on,
|
|
329
|
+
I
|
|
330
|
+
]), Cr = d(() => J ? J.beds.reduce((e, t) => e + he(c(t), F, q.plantSpacingCm, q.rowSpacingCm), 0) : 0, [
|
|
331
|
+
J,
|
|
332
|
+
F,
|
|
333
|
+
q
|
|
334
|
+
]), { data: wr, loading: Tr, refetch: Er } = Ge(qe, {
|
|
332
335
|
variables: {
|
|
333
|
-
context: { workspaceId:
|
|
334
|
-
fieldId:
|
|
336
|
+
context: { workspaceId: s },
|
|
337
|
+
fieldId: j ?? void 0
|
|
335
338
|
},
|
|
336
|
-
skip: !
|
|
339
|
+
skip: !j,
|
|
337
340
|
fetchPolicy: "cache-and-network"
|
|
338
|
-
}),
|
|
339
|
-
variables: { context: { workspaceId:
|
|
341
|
+
}), Y = d(() => wr?.healthyBowlBeds ?? [], [wr]), { data: Dr, refetch: Or } = Ge(Ze, {
|
|
342
|
+
variables: { context: { workspaceId: s } },
|
|
340
343
|
fetchPolicy: "cache-and-network"
|
|
341
|
-
}),
|
|
342
|
-
|
|
343
|
-
let t =
|
|
344
|
-
t && (t.clearLayers(),
|
|
345
|
-
let r =
|
|
346
|
-
if (!r || !
|
|
347
|
-
let i =
|
|
344
|
+
}), kr = d(() => Dr?.healthyBowlMapFeatures ?? [], [Dr]), Ar = d(() => T.get(wn ?? "") ?? null, [wn]), jr = l((e) => e ? g.find((t) => t.id === e)?.name ?? null : null, [g]);
|
|
345
|
+
u(() => {
|
|
346
|
+
let t = nr.current;
|
|
347
|
+
t && (t.clearLayers(), k === "view" && (Y.forEach((n) => {
|
|
348
|
+
let r = ae(n.boundary);
|
|
349
|
+
if (!r || !oe(r)) return;
|
|
350
|
+
let i = jr(n.cropId), a = w.default.geoJSON(r, { style: () => n.cropId ? vt : _t });
|
|
348
351
|
a.bindTooltip(e("healthybowl.fieldMapPage.beds.savedTooltip", "{{name}}{{crop}} · {{plants}} plants", {
|
|
349
352
|
name: n.name,
|
|
350
353
|
crop: i ? ` · ${i}` : "",
|
|
@@ -353,10 +356,10 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
353
356
|
sticky: !0,
|
|
354
357
|
direction: "top"
|
|
355
358
|
}), a.on("click", (e) => {
|
|
356
|
-
|
|
359
|
+
w.default.DomEvent.stopPropagation(e), hn(n), _n(n.cropId ?? "");
|
|
357
360
|
}), a.addTo(t);
|
|
358
|
-
}),
|
|
359
|
-
let r =
|
|
361
|
+
}), nn && J && J.beds.forEach((n) => {
|
|
362
|
+
let r = c(n), i = he(r, F, q.plantSpacingCm, q.rowSpacingCm), a = w.default.geoJSON(n, { style: () => gt });
|
|
360
363
|
a.bindTooltip(e("healthybowl.fieldMapPage.beds.bedTooltip", "{{plants}} plants · {{area}} m²", {
|
|
361
364
|
plants: String(i),
|
|
362
365
|
area: r.toFixed(0)
|
|
@@ -366,27 +369,27 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
366
369
|
}), a.addTo(t);
|
|
367
370
|
})));
|
|
368
371
|
}, [
|
|
369
|
-
|
|
370
|
-
Y,
|
|
371
|
-
L,
|
|
372
|
+
nn,
|
|
372
373
|
J,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
F,
|
|
375
|
+
q,
|
|
376
|
+
k,
|
|
377
|
+
Y,
|
|
378
|
+
jr,
|
|
376
379
|
e
|
|
377
|
-
]),
|
|
378
|
-
let t =
|
|
379
|
-
t && (t.clearLayers(),
|
|
380
|
-
let r =
|
|
380
|
+
]), u(() => {
|
|
381
|
+
let t = rr.current;
|
|
382
|
+
t && (t.clearLayers(), bn && kr.forEach((n) => {
|
|
383
|
+
let r = T.get(n.type), i = n.color || r?.color || "#8b5cf6", a = r?.style ?? {
|
|
381
384
|
color: i,
|
|
382
385
|
weight: 2,
|
|
383
386
|
fillColor: i,
|
|
384
387
|
fillOpacity: .25
|
|
385
388
|
}, o = null;
|
|
386
389
|
try {
|
|
387
|
-
o =
|
|
390
|
+
o = w.default.geoJSON(n.geometry, {
|
|
388
391
|
style: () => a,
|
|
389
|
-
pointToLayer: (e, t) =>
|
|
392
|
+
pointToLayer: (e, t) => w.default.circleMarker(t, {
|
|
390
393
|
radius: 7,
|
|
391
394
|
color: "#fff",
|
|
392
395
|
weight: 2,
|
|
@@ -398,170 +401,170 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
398
401
|
o = null;
|
|
399
402
|
}
|
|
400
403
|
if (!o) return;
|
|
401
|
-
let
|
|
402
|
-
o.bindTooltip(`${n.name} · ${
|
|
404
|
+
let ee = r ? e(r.labelKey, r.label) : n.type;
|
|
405
|
+
o.bindTooltip(`${n.name} · ${ee}`, {
|
|
403
406
|
sticky: !0,
|
|
404
407
|
direction: "top"
|
|
405
408
|
}), o.on("click", (e) => {
|
|
406
|
-
|
|
409
|
+
w.default.DomEvent.stopPropagation(e), G.current === "view" && Fn(n);
|
|
407
410
|
}), o.addTo(t);
|
|
408
411
|
}));
|
|
409
412
|
}, [
|
|
410
|
-
|
|
411
|
-
|
|
413
|
+
kr,
|
|
414
|
+
bn,
|
|
412
415
|
e
|
|
413
416
|
]);
|
|
414
|
-
let
|
|
415
|
-
if (!(!
|
|
416
|
-
if (
|
|
417
|
-
|
|
417
|
+
let Mr = l(async () => {
|
|
418
|
+
if (!(!K || !J || J.beds.length === 0)) {
|
|
419
|
+
if (J.bedCount > nt) {
|
|
420
|
+
E({
|
|
418
421
|
title: e("healthybowl.fieldMapPage.beds.tooMany.title", "Too many beds to save"),
|
|
419
422
|
description: e("healthybowl.fieldMapPage.beds.tooMany.description", "This layout has {{count}} beds (max {{max}}). Increase the bed width to reduce the count, then save.", {
|
|
420
|
-
count: String(
|
|
421
|
-
max: String(
|
|
423
|
+
count: String(J.bedCount),
|
|
424
|
+
max: String(nt)
|
|
422
425
|
}),
|
|
423
426
|
variant: "warning"
|
|
424
427
|
});
|
|
425
428
|
return;
|
|
426
429
|
}
|
|
427
|
-
|
|
430
|
+
fn(!0);
|
|
428
431
|
try {
|
|
429
|
-
await
|
|
432
|
+
await it(Y, rt, (e) => At({ variables: {
|
|
430
433
|
id: e.id,
|
|
431
|
-
context: { workspaceId:
|
|
434
|
+
context: { workspaceId: s }
|
|
432
435
|
} }));
|
|
433
|
-
let t =
|
|
434
|
-
await
|
|
436
|
+
let t = J.beds;
|
|
437
|
+
await it(t.map((e, t) => ({
|
|
435
438
|
bed: e,
|
|
436
439
|
index: t
|
|
437
|
-
})),
|
|
438
|
-
let r =
|
|
439
|
-
return
|
|
440
|
-
fieldId:
|
|
440
|
+
})), rt, ({ bed: t, index: n }) => {
|
|
441
|
+
let r = c(t), i = he(r, F, q.plantSpacingCm, q.rowSpacingCm);
|
|
442
|
+
return Ot({ variables: { input: {
|
|
443
|
+
fieldId: K.id,
|
|
441
444
|
name: e("healthybowl.fieldMapPage.beds.bedName", "Bed {{n}}", { n: String(n + 1) }),
|
|
442
445
|
boundary: t,
|
|
443
446
|
area: r,
|
|
444
447
|
unit: "sqm",
|
|
445
|
-
widthM:
|
|
446
|
-
orientationDeg:
|
|
447
|
-
cropId:
|
|
448
|
+
widthM: F,
|
|
449
|
+
orientationDeg: I,
|
|
450
|
+
cropId: Sr?.id ?? void 0,
|
|
448
451
|
plantCount: i,
|
|
449
|
-
context: { workspaceId:
|
|
452
|
+
context: { workspaceId: s }
|
|
450
453
|
} } });
|
|
451
|
-
}), await
|
|
454
|
+
}), await Er(), E({
|
|
452
455
|
title: e("healthybowl.fieldMapPage.beds.saved.title", "Bed layout saved"),
|
|
453
456
|
description: e("healthybowl.fieldMapPage.beds.saved.description", "Saved {{count}} beds for {{name}}.", {
|
|
454
457
|
count: String(t.length),
|
|
455
|
-
name:
|
|
458
|
+
name: K.name
|
|
456
459
|
}),
|
|
457
460
|
variant: "success"
|
|
458
461
|
});
|
|
459
462
|
} catch (t) {
|
|
460
|
-
|
|
463
|
+
E({
|
|
461
464
|
title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
|
|
462
465
|
description: String(t),
|
|
463
466
|
variant: "error"
|
|
464
467
|
});
|
|
465
468
|
} finally {
|
|
466
|
-
|
|
469
|
+
fn(!1);
|
|
467
470
|
}
|
|
468
471
|
}
|
|
469
472
|
}, [
|
|
470
|
-
|
|
471
|
-
Y,
|
|
472
|
-
R,
|
|
473
|
+
Sr,
|
|
473
474
|
J,
|
|
474
|
-
|
|
475
|
-
yt,
|
|
476
|
-
xt,
|
|
477
|
-
vr,
|
|
478
|
-
X,
|
|
475
|
+
I,
|
|
479
476
|
q,
|
|
477
|
+
F,
|
|
478
|
+
Ot,
|
|
479
|
+
At,
|
|
480
|
+
Er,
|
|
481
|
+
Y,
|
|
482
|
+
K,
|
|
480
483
|
e,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
]),
|
|
484
|
-
if (!(!
|
|
484
|
+
E,
|
|
485
|
+
s
|
|
486
|
+
]), Nr = l(async () => {
|
|
487
|
+
if (!(!K || Y.length === 0) && await m({
|
|
485
488
|
title: e("healthybowl.fieldMapPage.beds.clearConfirm.title", "Clear saved beds?"),
|
|
486
489
|
message: e("healthybowl.fieldMapPage.beds.clearConfirm.description", "This deletes all {{count}} saved beds for {{name}}. You can re-generate and save again.", {
|
|
487
|
-
count: String(
|
|
488
|
-
name:
|
|
490
|
+
count: String(Y.length),
|
|
491
|
+
name: K.name
|
|
489
492
|
}),
|
|
490
493
|
okButtonTitle: e("healthybowl.common.delete", "Delete")
|
|
491
494
|
})) {
|
|
492
|
-
|
|
495
|
+
mn(!0);
|
|
493
496
|
try {
|
|
494
|
-
await
|
|
497
|
+
await it(Y, rt, (e) => At({ variables: {
|
|
495
498
|
id: e.id,
|
|
496
|
-
context: { workspaceId:
|
|
497
|
-
} })), await
|
|
499
|
+
context: { workspaceId: s }
|
|
500
|
+
} })), await Er(), E({
|
|
498
501
|
title: e("healthybowl.fieldMapPage.beds.cleared.title", "Saved beds cleared"),
|
|
499
502
|
description: e("healthybowl.fieldMapPage.beds.cleared.description", "Removed the saved layout."),
|
|
500
503
|
variant: "success"
|
|
501
504
|
});
|
|
502
505
|
} catch (t) {
|
|
503
|
-
|
|
506
|
+
E({
|
|
504
507
|
title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
|
|
505
508
|
description: String(t),
|
|
506
509
|
variant: "error"
|
|
507
510
|
});
|
|
508
511
|
} finally {
|
|
509
|
-
|
|
512
|
+
mn(!1);
|
|
510
513
|
}
|
|
511
514
|
}
|
|
512
515
|
}, [
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
516
|
+
m,
|
|
517
|
+
At,
|
|
518
|
+
Er,
|
|
519
|
+
Y,
|
|
520
|
+
K,
|
|
518
521
|
e,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
]),
|
|
522
|
-
if (!
|
|
523
|
-
let t =
|
|
524
|
-
|
|
522
|
+
E,
|
|
523
|
+
s
|
|
524
|
+
]), Pr = l(async () => {
|
|
525
|
+
if (!L) return;
|
|
526
|
+
let t = g.find((e) => e.id === gn) ?? null, n = be(t), r = ae(L.boundary), i = he(L.area ?? (r ? c(r) : 0), L.widthM ?? F, n.plantSpacingCm, n.rowSpacingCm);
|
|
527
|
+
yn(!0);
|
|
525
528
|
try {
|
|
526
|
-
await
|
|
527
|
-
id:
|
|
528
|
-
cropId:
|
|
529
|
+
await kt({ variables: { input: {
|
|
530
|
+
id: L.id,
|
|
531
|
+
cropId: gn || null,
|
|
529
532
|
plantCount: i,
|
|
530
|
-
context: { workspaceId:
|
|
531
|
-
} } }), await
|
|
533
|
+
context: { workspaceId: s }
|
|
534
|
+
} } }), await Er(), hn(null), E({
|
|
532
535
|
title: e("healthybowl.fieldMapPage.beds.assigned.title", "Crop assigned"),
|
|
533
536
|
description: t ? e("healthybowl.fieldMapPage.beds.assigned.description", "{{bed}}: {{crop}} · {{plants}} plants.", {
|
|
534
|
-
bed:
|
|
537
|
+
bed: L.name,
|
|
535
538
|
crop: t.name,
|
|
536
539
|
plants: String(i)
|
|
537
|
-
}) : e("healthybowl.fieldMapPage.beds.assigned.cleared", "{{bed}}: crop cleared.", { bed:
|
|
540
|
+
}) : e("healthybowl.fieldMapPage.beds.assigned.cleared", "{{bed}}: crop cleared.", { bed: L.name }),
|
|
538
541
|
variant: "success"
|
|
539
542
|
});
|
|
540
543
|
} catch (t) {
|
|
541
|
-
|
|
544
|
+
E({
|
|
542
545
|
title: e("healthybowl.fieldMapPage.beds.assignFailed.title", "Could not assign crop"),
|
|
543
546
|
description: String(t),
|
|
544
547
|
variant: "error"
|
|
545
548
|
});
|
|
546
549
|
} finally {
|
|
547
|
-
|
|
550
|
+
yn(!1);
|
|
548
551
|
}
|
|
549
552
|
}, [
|
|
550
|
-
z,
|
|
551
|
-
sn,
|
|
552
553
|
L,
|
|
553
|
-
|
|
554
|
-
|
|
554
|
+
gn,
|
|
555
|
+
F,
|
|
556
|
+
g,
|
|
557
|
+
Er,
|
|
555
558
|
e,
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
]),
|
|
560
|
-
let t =
|
|
559
|
+
E,
|
|
560
|
+
kt,
|
|
561
|
+
s
|
|
562
|
+
]), Fr = l((e) => {
|
|
563
|
+
let t = V.current;
|
|
561
564
|
if (!t) return;
|
|
562
|
-
let n =
|
|
565
|
+
let n = D(e);
|
|
563
566
|
if (n) try {
|
|
564
|
-
let e =
|
|
567
|
+
let e = w.default.geoJSON(n).getBounds();
|
|
565
568
|
if (e.isValid()) {
|
|
566
569
|
t.fitBounds(e, {
|
|
567
570
|
padding: [40, 40],
|
|
@@ -570,30 +573,30 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
570
573
|
return;
|
|
571
574
|
}
|
|
572
575
|
} catch {}
|
|
573
|
-
|
|
574
|
-
}, []),
|
|
575
|
-
|
|
576
|
-
}, [
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
}, [
|
|
580
|
-
let
|
|
581
|
-
let t =
|
|
576
|
+
yt(e.location) && t.flyTo([e.location.lat, e.location.lng], ut, { duration: .6 });
|
|
577
|
+
}, []), Ir = l((e) => {
|
|
578
|
+
G.current === "draw" || G.current === "measure" || (M(e.id), Fr(e));
|
|
579
|
+
}, [Fr]);
|
|
580
|
+
u(() => {
|
|
581
|
+
j && document.querySelector(`[data-field-id="${j}"]`)?.scrollIntoView({ block: "nearest" });
|
|
582
|
+
}, [j]);
|
|
583
|
+
let Lr = l(() => {
|
|
584
|
+
let t = V.current, n = Qn.current;
|
|
582
585
|
if (!t || !n) return;
|
|
583
586
|
n.clearLayers();
|
|
584
587
|
let r = [];
|
|
585
|
-
for (let t of
|
|
586
|
-
if (
|
|
587
|
-
let i = t.id ===
|
|
588
|
-
if (
|
|
589
|
-
let e =
|
|
588
|
+
for (let t of h) {
|
|
589
|
+
if (k === "edit" && t.id === j) continue;
|
|
590
|
+
let i = t.id === j, a = N[t.id], o = Rt && a != null ? pe(a, gr, _r) : It ? de(t.soilType) : ft, ee = `${t.name} — ${xt(t)}`, te = D(t);
|
|
591
|
+
if (te) {
|
|
592
|
+
let e = w.default.geoJSON(te, { style: () => ({
|
|
590
593
|
color: i ? "#ffffff" : o,
|
|
591
594
|
weight: i ? 5 : 2,
|
|
592
595
|
opacity: 1,
|
|
593
596
|
fillColor: o,
|
|
594
597
|
fillOpacity: i ? .62 : .5
|
|
595
598
|
}) });
|
|
596
|
-
e.on("click", () =>
|
|
599
|
+
e.on("click", () => M(t.id)), e.bindTooltip(ee, {
|
|
597
600
|
permanent: !0,
|
|
598
601
|
direction: "center",
|
|
599
602
|
className: "hb-field-label"
|
|
@@ -602,94 +605,94 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
602
605
|
let t = e.getBounds();
|
|
603
606
|
t.isValid() && r.push(t);
|
|
604
607
|
} catch {}
|
|
605
|
-
} else if (
|
|
606
|
-
let a =
|
|
608
|
+
} else if (yt(t.location)) {
|
|
609
|
+
let a = w.default.circleMarker([t.location.lat, t.location.lng], {
|
|
607
610
|
radius: i ? 9 : 7,
|
|
608
611
|
color: i ? "#ffffff" : "#fff",
|
|
609
612
|
weight: i ? 3 : 2,
|
|
610
613
|
fillColor: o,
|
|
611
614
|
fillOpacity: 1
|
|
612
615
|
});
|
|
613
|
-
a.on("click", () =>
|
|
616
|
+
a.on("click", () => M(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
|
|
614
617
|
permanent: !1,
|
|
615
618
|
direction: "top"
|
|
616
|
-
}), a.addTo(n), r.push(
|
|
619
|
+
}), a.addTo(n), r.push(w.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
|
|
617
620
|
}
|
|
618
621
|
}
|
|
619
|
-
if (!
|
|
620
|
-
let e = r.reduce((e, t) => e.extend(t),
|
|
622
|
+
if (!ur.current && r.length > 0) {
|
|
623
|
+
let e = r.reduce((e, t) => e.extend(t), w.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
|
|
621
624
|
try {
|
|
622
625
|
t.fitBounds(e, {
|
|
623
626
|
padding: [40, 40],
|
|
624
627
|
maxZoom: 17
|
|
625
|
-
}),
|
|
628
|
+
}), ur.current = !0;
|
|
626
629
|
} catch {}
|
|
627
630
|
}
|
|
628
631
|
}, [
|
|
629
|
-
|
|
632
|
+
h,
|
|
633
|
+
k,
|
|
630
634
|
j,
|
|
635
|
+
It,
|
|
636
|
+
Rt,
|
|
631
637
|
N,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
F,
|
|
635
|
-
cr,
|
|
636
|
-
lr,
|
|
638
|
+
gr,
|
|
639
|
+
_r,
|
|
637
640
|
e
|
|
638
641
|
]);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}, [
|
|
642
|
-
let
|
|
643
|
-
|
|
644
|
-
}, []),
|
|
645
|
-
let e =
|
|
642
|
+
u(() => {
|
|
643
|
+
O === "ready" && Lr();
|
|
644
|
+
}, [Lr, O]);
|
|
645
|
+
let X = l(() => {
|
|
646
|
+
$n.current?.clearLayers(), or.current = null, ar.current = [], Jt(0);
|
|
647
|
+
}, []), Rr = l(() => {
|
|
648
|
+
let e = $n.current;
|
|
646
649
|
if (!e) return;
|
|
647
|
-
|
|
648
|
-
let t =
|
|
649
|
-
t.length >= 2 && (
|
|
650
|
-
}, []),
|
|
651
|
-
let t =
|
|
650
|
+
or.current &&= (e.removeLayer(or.current), null);
|
|
651
|
+
let t = ar.current;
|
|
652
|
+
t.length >= 2 && (or.current = w.default.polygon(t, pt).addTo(e));
|
|
653
|
+
}, []), zr = l(() => {
|
|
654
|
+
let t = ar.current;
|
|
652
655
|
if (t.length < 3) {
|
|
653
|
-
|
|
656
|
+
E({
|
|
654
657
|
title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
|
|
655
658
|
description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
|
|
656
659
|
variant: "warning"
|
|
657
660
|
});
|
|
658
661
|
return;
|
|
659
662
|
}
|
|
660
|
-
let n =
|
|
663
|
+
let n = le(t.map((e) => ({
|
|
661
664
|
lat: e.lat,
|
|
662
665
|
lng: e.lng
|
|
663
666
|
})));
|
|
664
|
-
|
|
667
|
+
X(), G.current = "view", A("view"), n && (Rn({
|
|
665
668
|
boundary: n,
|
|
666
|
-
area:
|
|
667
|
-
centroid:
|
|
668
|
-
}),
|
|
669
|
+
area: se(n, "acres"),
|
|
670
|
+
centroid: ce(n) ?? [0, 0]
|
|
671
|
+
}), Hn(""), Wn("Clay loam"), Kn("Drip"), Jn("active"));
|
|
669
672
|
}, [
|
|
670
|
-
|
|
673
|
+
X,
|
|
671
674
|
e,
|
|
672
|
-
|
|
673
|
-
]),
|
|
674
|
-
|
|
675
|
-
}, [
|
|
676
|
-
|
|
677
|
-
}, [
|
|
678
|
-
|
|
679
|
-
}, []),
|
|
680
|
-
if (!
|
|
681
|
-
|
|
682
|
-
let e =
|
|
675
|
+
E
|
|
676
|
+
]), Br = l(() => {
|
|
677
|
+
M(null), X(), G.current = "draw", A("draw");
|
|
678
|
+
}, [X]), Vr = l(() => {
|
|
679
|
+
X(), G.current = "view", A("view");
|
|
680
|
+
}, [X]), Hr = l(() => {
|
|
681
|
+
er.current?.clearLayers(), cr.current = null, sr.current = [], Xt(null), Qt(!1);
|
|
682
|
+
}, []), Ur = l(() => {
|
|
683
|
+
if (!er.current || !cr.current) return;
|
|
684
|
+
cr.current.setLatLngs(sr.current);
|
|
685
|
+
let e = le(sr.current.map((e) => ({
|
|
683
686
|
lat: e.lat,
|
|
684
687
|
lng: e.lng
|
|
685
688
|
})));
|
|
686
|
-
e &&
|
|
687
|
-
}, [
|
|
688
|
-
let t =
|
|
689
|
-
if (!t || !n || !
|
|
690
|
-
let r =
|
|
689
|
+
e && Xt(se(e, K?.unit ?? "acres"));
|
|
690
|
+
}, [K]), Wr = l(() => {
|
|
691
|
+
let t = V.current, n = er.current;
|
|
692
|
+
if (!t || !n || !K) return;
|
|
693
|
+
let r = D(K);
|
|
691
694
|
if (!r) {
|
|
692
|
-
|
|
695
|
+
E({
|
|
693
696
|
title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
|
|
694
697
|
description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
|
|
695
698
|
variant: "warning"
|
|
@@ -697,89 +700,89 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
697
700
|
return;
|
|
698
701
|
}
|
|
699
702
|
n.clearLayers();
|
|
700
|
-
let i = r.coordinates[0].slice(0, -1).map(([e, t]) =>
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
icon:
|
|
703
|
+
let i = r.coordinates[0].slice(0, -1).map(([e, t]) => w.default.latLng(t, e));
|
|
704
|
+
sr.current = i, cr.current = w.default.polygon(i, mt).addTo(n), i.forEach((e, t) => {
|
|
705
|
+
w.default.marker(i[t], {
|
|
706
|
+
icon: St,
|
|
704
707
|
draggable: !0
|
|
705
708
|
}).addTo(n).on("drag", (e) => {
|
|
706
|
-
|
|
709
|
+
sr.current[t] = e.target.getLatLng(), Ur(), Qt(!0);
|
|
707
710
|
});
|
|
708
|
-
}),
|
|
711
|
+
}), G.current = "edit", A("edit"), Qt(!1), Xt(se(r, K.unit));
|
|
709
712
|
}, [
|
|
710
|
-
|
|
711
|
-
|
|
713
|
+
Ur,
|
|
714
|
+
K,
|
|
712
715
|
e,
|
|
713
|
-
|
|
714
|
-
]),
|
|
715
|
-
|
|
716
|
-
}, [
|
|
717
|
-
if (!
|
|
718
|
-
let t =
|
|
716
|
+
E
|
|
717
|
+
]), Gr = l(() => {
|
|
718
|
+
Hr(), G.current = "view", A("view"), Lr();
|
|
719
|
+
}, [Hr, Lr]), Kr = l(async () => {
|
|
720
|
+
if (!K) return;
|
|
721
|
+
let t = le(sr.current.map((e) => ({
|
|
719
722
|
lat: e.lat,
|
|
720
723
|
lng: e.lng
|
|
721
724
|
})));
|
|
722
725
|
if (t) {
|
|
723
|
-
|
|
726
|
+
en(!0);
|
|
724
727
|
try {
|
|
725
|
-
let n =
|
|
726
|
-
await
|
|
727
|
-
id:
|
|
728
|
+
let n = se(t, K.unit);
|
|
729
|
+
await Dt({ variables: { input: {
|
|
730
|
+
id: K.id,
|
|
728
731
|
boundary: t,
|
|
729
732
|
area: n,
|
|
730
|
-
context: { workspaceId:
|
|
731
|
-
} } }), await
|
|
733
|
+
context: { workspaceId: s }
|
|
734
|
+
} } }), await _(), Hr(), G.current = "view", A("view"), E({
|
|
732
735
|
title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
|
|
733
736
|
description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
|
|
734
737
|
area: String(n),
|
|
735
|
-
unit:
|
|
738
|
+
unit: K.unit
|
|
736
739
|
}),
|
|
737
740
|
variant: "success"
|
|
738
741
|
});
|
|
739
742
|
} catch (t) {
|
|
740
|
-
|
|
743
|
+
E({
|
|
741
744
|
title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
|
|
742
745
|
description: String(t),
|
|
743
746
|
variant: "error"
|
|
744
747
|
});
|
|
745
748
|
} finally {
|
|
746
|
-
|
|
749
|
+
en(!1);
|
|
747
750
|
}
|
|
748
751
|
}
|
|
749
752
|
}, [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
+
Hr,
|
|
754
|
+
_,
|
|
755
|
+
K,
|
|
753
756
|
e,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
]),
|
|
758
|
-
if (
|
|
759
|
-
if (!
|
|
760
|
-
|
|
757
|
+
E,
|
|
758
|
+
Dt,
|
|
759
|
+
s
|
|
760
|
+
]), qr = l(async () => {
|
|
761
|
+
if (K) {
|
|
762
|
+
if (!D(K)) {
|
|
763
|
+
E({
|
|
761
764
|
title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
|
|
762
765
|
description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
|
|
763
766
|
variant: "warning"
|
|
764
767
|
});
|
|
765
768
|
return;
|
|
766
769
|
}
|
|
767
|
-
if (await
|
|
770
|
+
if (await m({
|
|
768
771
|
title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
|
|
769
|
-
message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name:
|
|
772
|
+
message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: K.name }),
|
|
770
773
|
okButtonTitle: e("healthybowl.common.delete", "Delete")
|
|
771
774
|
})) try {
|
|
772
|
-
await
|
|
773
|
-
id:
|
|
775
|
+
await Dt({ variables: { input: {
|
|
776
|
+
id: K.id,
|
|
774
777
|
boundary: null,
|
|
775
|
-
context: { workspaceId:
|
|
776
|
-
} } }), await
|
|
778
|
+
context: { workspaceId: s }
|
|
779
|
+
} } }), await _(), E({
|
|
777
780
|
title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
|
|
778
781
|
description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
|
|
779
782
|
variant: "success"
|
|
780
783
|
});
|
|
781
784
|
} catch (t) {
|
|
782
|
-
|
|
785
|
+
E({
|
|
783
786
|
title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
|
|
784
787
|
description: String(t),
|
|
785
788
|
variant: "error"
|
|
@@ -787,90 +790,90 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
787
790
|
}
|
|
788
791
|
}
|
|
789
792
|
}, [
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
+
m,
|
|
794
|
+
_,
|
|
795
|
+
K,
|
|
793
796
|
e,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
]),
|
|
798
|
-
|
|
799
|
-
}, []),
|
|
800
|
-
let e =
|
|
797
|
+
E,
|
|
798
|
+
Dt,
|
|
799
|
+
s
|
|
800
|
+
]), Z = l(() => {
|
|
801
|
+
tr.current?.clearLayers(), lr.current = [], tn(null);
|
|
802
|
+
}, []), Jr = l(() => {
|
|
803
|
+
let e = tr.current;
|
|
801
804
|
if (!e) return;
|
|
802
805
|
e.clearLayers();
|
|
803
|
-
let t =
|
|
806
|
+
let t = lr.current;
|
|
804
807
|
t.forEach((t) => {
|
|
805
|
-
|
|
808
|
+
w.default.circleMarker(t, {
|
|
806
809
|
radius: 4,
|
|
807
810
|
color: "#38bdf8",
|
|
808
811
|
weight: 2,
|
|
809
812
|
fillColor: "#fff",
|
|
810
813
|
fillOpacity: 1
|
|
811
814
|
}).addTo(e);
|
|
812
|
-
}), t.length >= 2 &&
|
|
815
|
+
}), t.length >= 2 && w.default.polyline(t, ht).addTo(e);
|
|
813
816
|
let n = 0;
|
|
814
817
|
for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
|
|
815
818
|
let r = null;
|
|
816
819
|
if (t.length >= 3) {
|
|
817
|
-
let e =
|
|
820
|
+
let e = le(t.map((e) => ({
|
|
818
821
|
lat: e.lat,
|
|
819
822
|
lng: e.lng
|
|
820
823
|
})));
|
|
821
|
-
e && (r =
|
|
824
|
+
e && (r = c(e));
|
|
822
825
|
}
|
|
823
|
-
|
|
826
|
+
tn({
|
|
824
827
|
distance: n,
|
|
825
828
|
area: r
|
|
826
829
|
});
|
|
827
|
-
}, []),
|
|
828
|
-
|
|
830
|
+
}, []), Yr = l(() => {
|
|
831
|
+
M(null), Z(), G.current = "measure", A("measure"), tn({
|
|
829
832
|
distance: 0,
|
|
830
833
|
area: null
|
|
831
834
|
});
|
|
832
|
-
}, [
|
|
833
|
-
|
|
834
|
-
}, [
|
|
835
|
-
|
|
836
|
-
}, []),
|
|
837
|
-
let e =
|
|
835
|
+
}, [Z]), Xr = l(() => {
|
|
836
|
+
Z(), G.current = "view", A("view");
|
|
837
|
+
}, [Z]), Q = l(() => {
|
|
838
|
+
H.current?.clearLayers(), ir.current = null, U.current = [], Dn(0);
|
|
839
|
+
}, []), Zr = l(() => {
|
|
840
|
+
let e = H.current, t = T.get(W.current ?? "");
|
|
838
841
|
if (!e || !t) return;
|
|
839
|
-
|
|
840
|
-
let n =
|
|
841
|
-
t.kind === "polygon" && n.length >= 2 ?
|
|
842
|
+
ir.current &&= (e.removeLayer(ir.current), null);
|
|
843
|
+
let n = U.current;
|
|
844
|
+
t.kind === "polygon" && n.length >= 2 ? ir.current = w.default.polygon(n, {
|
|
842
845
|
...t.style,
|
|
843
846
|
dashArray: "6 4"
|
|
844
|
-
}).addTo(e) : t.kind === "line" && n.length >= 2 && (
|
|
847
|
+
}).addTo(e) : t.kind === "line" && n.length >= 2 && (ir.current = w.default.polyline(n, {
|
|
845
848
|
...t.style,
|
|
846
849
|
dashArray: "6 4"
|
|
847
850
|
}).addTo(e));
|
|
848
|
-
}, []),
|
|
849
|
-
|
|
851
|
+
}, []), Qr = l((e, t) => {
|
|
852
|
+
Q(), Tn(null), W.current = null, G.current = "view", A("view"), An(""), Mn(""), On({
|
|
850
853
|
type: e,
|
|
851
854
|
geometry: t
|
|
852
855
|
});
|
|
853
|
-
}, [
|
|
854
|
-
let t =
|
|
856
|
+
}, [Q]), $r = l(() => {
|
|
857
|
+
let t = T.get(W.current ?? "");
|
|
855
858
|
if (!t) return;
|
|
856
|
-
let n =
|
|
859
|
+
let n = U.current;
|
|
857
860
|
if (t.kind === "polygon") {
|
|
858
861
|
if (n.length < 3) {
|
|
859
|
-
|
|
862
|
+
E({
|
|
860
863
|
title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
|
|
861
864
|
description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
|
|
862
865
|
variant: "warning"
|
|
863
866
|
});
|
|
864
867
|
return;
|
|
865
868
|
}
|
|
866
|
-
let r =
|
|
869
|
+
let r = le(n.map((e) => ({
|
|
867
870
|
lat: e.lat,
|
|
868
871
|
lng: e.lng
|
|
869
872
|
})));
|
|
870
|
-
r &&
|
|
873
|
+
r && Qr(t.type, r);
|
|
871
874
|
} else if (t.kind === "line") {
|
|
872
875
|
if (n.length < 2) {
|
|
873
|
-
|
|
876
|
+
E({
|
|
874
877
|
title: e("healthybowl.fieldMapPage.toast.needLine.title", "Need at least 2 points"),
|
|
875
878
|
description: e("healthybowl.fieldMapPage.toast.needLine.description", "Click the map to add more points."),
|
|
876
879
|
variant: "warning"
|
|
@@ -881,526 +884,544 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
881
884
|
type: "LineString",
|
|
882
885
|
coordinates: n.map((e) => [e.lng, e.lat])
|
|
883
886
|
};
|
|
884
|
-
|
|
887
|
+
Qr(t.type, r);
|
|
885
888
|
}
|
|
886
889
|
}, [
|
|
887
|
-
|
|
890
|
+
Qr,
|
|
888
891
|
e,
|
|
889
|
-
|
|
890
|
-
]),
|
|
891
|
-
|
|
892
|
+
E
|
|
893
|
+
]), ei = l((e) => {
|
|
894
|
+
X(), Hr(), Z(), Q(), M(null), Fn(null), Cn(!1), T.has(e) && (Tn(e), W.current = e, G.current = "element", A("element"));
|
|
892
895
|
}, [
|
|
896
|
+
X,
|
|
897
|
+
Hr,
|
|
893
898
|
Z,
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
]),
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (K.current === "element") {
|
|
902
|
-
let t = E.get(G.current ?? "");
|
|
899
|
+
Q
|
|
900
|
+
]), ti = l(() => {
|
|
901
|
+
Q(), Tn(null), W.current = null, G.current = "view", A("view");
|
|
902
|
+
}, [Q]), ni = l((e) => {
|
|
903
|
+
if (V.current) {
|
|
904
|
+
if (G.current === "element") {
|
|
905
|
+
let t = T.get(W.current ?? "");
|
|
903
906
|
if (!t) return;
|
|
904
907
|
if (t.kind === "point") {
|
|
905
|
-
|
|
908
|
+
Qr(t.type, {
|
|
906
909
|
type: "Point",
|
|
907
910
|
coordinates: [e.latlng.lng, e.latlng.lat]
|
|
908
911
|
});
|
|
909
912
|
return;
|
|
910
913
|
}
|
|
911
|
-
|
|
912
|
-
let n =
|
|
914
|
+
U.current.push(e.latlng);
|
|
915
|
+
let n = U.current.length === 1, r = w.default.circleMarker(e.latlng, {
|
|
913
916
|
radius: n ? 7 : 5,
|
|
914
917
|
color: "#fff",
|
|
915
918
|
weight: 2,
|
|
916
919
|
fillColor: t.color,
|
|
917
920
|
fillOpacity: 1
|
|
918
|
-
}).addTo(
|
|
921
|
+
}).addTo(H.current);
|
|
919
922
|
n && t.kind === "polygon" && r.on("click", (e) => {
|
|
920
|
-
|
|
921
|
-
}),
|
|
923
|
+
w.default.DomEvent.stopPropagation(e), $r();
|
|
924
|
+
}), Dn(U.current.length), Zr();
|
|
922
925
|
return;
|
|
923
926
|
}
|
|
924
|
-
if (
|
|
925
|
-
|
|
926
|
-
let t =
|
|
927
|
+
if (G.current === "draw") {
|
|
928
|
+
ar.current.push(e.latlng);
|
|
929
|
+
let t = ar.current.length === 1, n = w.default.circleMarker(e.latlng, {
|
|
927
930
|
radius: t ? 7 : 5,
|
|
928
931
|
color: "#fff",
|
|
929
932
|
weight: 2,
|
|
930
933
|
fillColor: t ? "#16a34a" : "#f59e0b",
|
|
931
934
|
fillOpacity: 1
|
|
932
|
-
}).addTo(
|
|
935
|
+
}).addTo($n.current);
|
|
933
936
|
t && n.on("click", (e) => {
|
|
934
|
-
|
|
935
|
-
}),
|
|
936
|
-
} else
|
|
937
|
+
w.default.DomEvent.stopPropagation(e), zr();
|
|
938
|
+
}), Jt(ar.current.length), Rr();
|
|
939
|
+
} else G.current === "measure" && (lr.current.push(e.latlng), Jr());
|
|
937
940
|
}
|
|
938
941
|
}, [
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
]),
|
|
942
|
+
zr,
|
|
943
|
+
Jr,
|
|
944
|
+
Rr,
|
|
945
|
+
Qr,
|
|
946
|
+
$r,
|
|
947
|
+
Zr
|
|
948
|
+
]), ri = l(async (n) => {
|
|
946
949
|
n.preventDefault();
|
|
947
|
-
let r =
|
|
950
|
+
let r = V.current, i = Ut.trim();
|
|
948
951
|
if (!r || !i) return;
|
|
949
952
|
let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
|
|
950
953
|
if (a) {
|
|
951
|
-
r.flyTo([Number(a[1]), Number(a[2])],
|
|
954
|
+
r.flyTo([Number(a[1]), Number(a[2])], ut, { duration: .6 });
|
|
952
955
|
return;
|
|
953
956
|
}
|
|
954
|
-
|
|
957
|
+
Kt(!0);
|
|
955
958
|
try {
|
|
956
959
|
let n = await t(i);
|
|
957
960
|
if (!n) {
|
|
958
|
-
|
|
961
|
+
E({
|
|
959
962
|
title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
|
|
960
963
|
description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
|
|
961
964
|
variant: "warning"
|
|
962
965
|
});
|
|
963
966
|
return;
|
|
964
967
|
}
|
|
965
|
-
r.flyTo([n.latitude, n.longitude],
|
|
968
|
+
r.flyTo([n.latitude, n.longitude], ut, { duration: .6 });
|
|
966
969
|
} catch (t) {
|
|
967
|
-
|
|
970
|
+
E({
|
|
968
971
|
title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
|
|
969
972
|
description: t instanceof Error ? t.message : String(t),
|
|
970
973
|
variant: "error"
|
|
971
974
|
});
|
|
972
975
|
} finally {
|
|
973
|
-
|
|
976
|
+
Kt(!1);
|
|
974
977
|
}
|
|
975
978
|
}, [
|
|
976
|
-
|
|
979
|
+
Ut,
|
|
977
980
|
e,
|
|
978
|
-
|
|
979
|
-
]),
|
|
980
|
-
if (
|
|
981
|
-
if (!
|
|
982
|
-
|
|
981
|
+
E
|
|
982
|
+
]), ii = l(async () => {
|
|
983
|
+
if (B) {
|
|
984
|
+
if (!Vn.trim()) {
|
|
985
|
+
E({
|
|
983
986
|
title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
|
|
984
987
|
description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
|
|
985
988
|
variant: "warning"
|
|
986
989
|
});
|
|
987
990
|
return;
|
|
988
991
|
}
|
|
989
|
-
|
|
992
|
+
Bn(!0);
|
|
990
993
|
try {
|
|
991
|
-
let [t, n] =
|
|
992
|
-
name:
|
|
993
|
-
area:
|
|
994
|
+
let [t, n] = B.centroid, r = await S({
|
|
995
|
+
name: Vn.trim(),
|
|
996
|
+
area: B.area,
|
|
994
997
|
unit: "acres",
|
|
995
|
-
soilType:
|
|
996
|
-
irrigationType:
|
|
998
|
+
soilType: Un,
|
|
999
|
+
irrigationType: Gn,
|
|
997
1000
|
organicCertified: !1,
|
|
998
|
-
status:
|
|
1001
|
+
status: qn,
|
|
999
1002
|
crops: [],
|
|
1000
1003
|
location: {
|
|
1001
1004
|
lat: t,
|
|
1002
1005
|
lng: n
|
|
1003
1006
|
}
|
|
1004
1007
|
});
|
|
1005
|
-
r?.id && await
|
|
1008
|
+
r?.id && await Dt({ variables: { input: {
|
|
1006
1009
|
id: r.id,
|
|
1007
|
-
boundary:
|
|
1008
|
-
area:
|
|
1009
|
-
context: { workspaceId:
|
|
1010
|
-
} } }), await
|
|
1010
|
+
boundary: B.boundary,
|
|
1011
|
+
area: B.area,
|
|
1012
|
+
context: { workspaceId: s }
|
|
1013
|
+
} } }), await _(), Rn(null), r?.id && M(r.id), E({
|
|
1011
1014
|
title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
|
|
1012
1015
|
description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
|
|
1013
|
-
name:
|
|
1014
|
-
area: String(
|
|
1016
|
+
name: Vn.trim(),
|
|
1017
|
+
area: String(B.area)
|
|
1015
1018
|
}),
|
|
1016
1019
|
variant: "success"
|
|
1017
1020
|
});
|
|
1018
1021
|
} catch (t) {
|
|
1019
|
-
|
|
1022
|
+
E({
|
|
1020
1023
|
title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
|
|
1021
1024
|
description: String(t),
|
|
1022
1025
|
variant: "error"
|
|
1023
1026
|
});
|
|
1024
1027
|
} finally {
|
|
1025
|
-
|
|
1028
|
+
Bn(!1);
|
|
1026
1029
|
}
|
|
1027
1030
|
}
|
|
1028
1031
|
}, [
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1032
|
+
S,
|
|
1033
|
+
Gn,
|
|
1034
|
+
Vn,
|
|
1035
|
+
Un,
|
|
1036
|
+
qn,
|
|
1037
|
+
B,
|
|
1038
|
+
_,
|
|
1036
1039
|
e,
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
]),
|
|
1041
|
-
if (!
|
|
1042
|
-
if (!
|
|
1043
|
-
|
|
1040
|
+
E,
|
|
1041
|
+
Dt,
|
|
1042
|
+
s
|
|
1043
|
+
]), ai = l(async () => {
|
|
1044
|
+
if (!R) return;
|
|
1045
|
+
if (!kn.trim()) {
|
|
1046
|
+
E({
|
|
1044
1047
|
title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
|
|
1045
1048
|
description: e("healthybowl.fieldMapPage.elements.nameRequired", "Give this map element a name."),
|
|
1046
1049
|
variant: "warning"
|
|
1047
1050
|
});
|
|
1048
1051
|
return;
|
|
1049
1052
|
}
|
|
1050
|
-
let t =
|
|
1051
|
-
|
|
1053
|
+
let t = T.get(R.type);
|
|
1054
|
+
Pn(!0);
|
|
1052
1055
|
try {
|
|
1053
|
-
await
|
|
1054
|
-
name:
|
|
1055
|
-
type:
|
|
1056
|
-
geometry:
|
|
1057
|
-
notes:
|
|
1056
|
+
await jt({ variables: { input: {
|
|
1057
|
+
name: kn.trim(),
|
|
1058
|
+
type: R.type,
|
|
1059
|
+
geometry: R.geometry,
|
|
1060
|
+
notes: jn.trim() || void 0,
|
|
1058
1061
|
color: t?.color,
|
|
1059
|
-
context: { workspaceId:
|
|
1060
|
-
} } }), await
|
|
1062
|
+
context: { workspaceId: s }
|
|
1063
|
+
} } }), await Or(), On(null), E({
|
|
1061
1064
|
title: e("healthybowl.fieldMapPage.elements.saved.title", "Map element added"),
|
|
1062
|
-
description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name:
|
|
1065
|
+
description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name: kn.trim() }),
|
|
1063
1066
|
variant: "success"
|
|
1064
1067
|
});
|
|
1065
1068
|
} catch (t) {
|
|
1066
|
-
|
|
1069
|
+
E({
|
|
1067
1070
|
title: e("healthybowl.fieldMapPage.elements.saveFailed.title", "Could not add element"),
|
|
1068
1071
|
description: String(t),
|
|
1069
1072
|
variant: "error"
|
|
1070
1073
|
});
|
|
1071
1074
|
} finally {
|
|
1072
|
-
|
|
1075
|
+
Pn(!1);
|
|
1073
1076
|
}
|
|
1074
1077
|
}, [
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1078
|
+
jt,
|
|
1079
|
+
kn,
|
|
1080
|
+
jn,
|
|
1081
|
+
R,
|
|
1082
|
+
Or,
|
|
1080
1083
|
e,
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
]),
|
|
1084
|
-
if (
|
|
1084
|
+
E,
|
|
1085
|
+
s
|
|
1086
|
+
]), oi = l(async () => {
|
|
1087
|
+
if (z && await m({
|
|
1085
1088
|
title: e("healthybowl.fieldMapPage.elements.deleteConfirm.title", "Delete map element?"),
|
|
1086
|
-
message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name:
|
|
1089
|
+
message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name: z.name }),
|
|
1087
1090
|
okButtonTitle: e("healthybowl.common.delete", "Delete")
|
|
1088
1091
|
})) {
|
|
1089
|
-
|
|
1092
|
+
Ln(!0);
|
|
1090
1093
|
try {
|
|
1091
|
-
await
|
|
1092
|
-
id:
|
|
1093
|
-
context: { workspaceId:
|
|
1094
|
-
} }), await
|
|
1094
|
+
await Mt({ variables: {
|
|
1095
|
+
id: z.id,
|
|
1096
|
+
context: { workspaceId: s }
|
|
1097
|
+
} }), await Or(), Fn(null), E({
|
|
1095
1098
|
title: e("healthybowl.fieldMapPage.elements.deleted.title", "Map element removed"),
|
|
1096
1099
|
description: e("healthybowl.fieldMapPage.elements.deleted.description", "The element was deleted."),
|
|
1097
1100
|
variant: "success"
|
|
1098
1101
|
});
|
|
1099
1102
|
} catch (t) {
|
|
1100
|
-
|
|
1103
|
+
E({
|
|
1101
1104
|
title: e("healthybowl.fieldMapPage.elements.deleteFailed.title", "Could not delete element"),
|
|
1102
1105
|
description: String(t),
|
|
1103
1106
|
variant: "error"
|
|
1104
1107
|
});
|
|
1105
1108
|
} finally {
|
|
1106
|
-
|
|
1109
|
+
Ln(!1);
|
|
1107
1110
|
}
|
|
1108
1111
|
}
|
|
1109
1112
|
}, [
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1113
|
+
m,
|
|
1114
|
+
Mt,
|
|
1115
|
+
Or,
|
|
1116
|
+
z,
|
|
1114
1117
|
e,
|
|
1115
|
-
|
|
1116
|
-
|
|
1118
|
+
E,
|
|
1119
|
+
s
|
|
1117
1120
|
]);
|
|
1118
|
-
|
|
1119
|
-
let e =
|
|
1121
|
+
u(() => {
|
|
1122
|
+
let e = Yn.current;
|
|
1120
1123
|
if (!e) return;
|
|
1121
|
-
|
|
1122
|
-
let t =
|
|
1123
|
-
attribution:
|
|
1124
|
-
maxZoom:
|
|
1124
|
+
ie();
|
|
1125
|
+
let t = w.default.tileLayer(at, {
|
|
1126
|
+
attribution: ot,
|
|
1127
|
+
maxZoom: lt,
|
|
1125
1128
|
maxNativeZoom: 18
|
|
1126
|
-
}), n =
|
|
1127
|
-
attribution:
|
|
1128
|
-
maxZoom:
|
|
1129
|
+
}), n = w.default.tileLayer(st, {
|
|
1130
|
+
attribution: ct,
|
|
1131
|
+
maxZoom: lt,
|
|
1129
1132
|
maxNativeZoom: 17,
|
|
1130
1133
|
opacity: .65
|
|
1131
1134
|
});
|
|
1132
|
-
|
|
1133
|
-
let r =
|
|
1135
|
+
Xn.current = t, Zn.current = n;
|
|
1136
|
+
let r = w.default.map(e, {
|
|
1134
1137
|
center: [20, 78],
|
|
1135
1138
|
zoom: 4,
|
|
1136
1139
|
scrollWheelZoom: !0,
|
|
1137
|
-
maxZoom:
|
|
1140
|
+
maxZoom: lt,
|
|
1138
1141
|
layers: [t]
|
|
1139
1142
|
});
|
|
1140
|
-
return
|
|
1141
|
-
r.off("click",
|
|
1143
|
+
return V.current = r, Qn.current = w.default.layerGroup().addTo(r), nr.current = w.default.layerGroup().addTo(r), rr.current = w.default.layerGroup().addTo(r), $n.current = w.default.layerGroup().addTo(r), er.current = w.default.layerGroup().addTo(r), tr.current = w.default.layerGroup().addTo(r), H.current = w.default.layerGroup().addTo(r), r.on("click", ni), Nt("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
|
|
1144
|
+
r.off("click", ni), r.remove(), V.current = null, Xn.current = null, Zn.current = null, Qn.current = null, nr.current = null, rr.current = null, $n.current = null, er.current = null, tr.current = null, H.current = null;
|
|
1142
1145
|
};
|
|
1143
|
-
}, []),
|
|
1144
|
-
let e =
|
|
1145
|
-
!e || !t || (
|
|
1146
|
-
}, [
|
|
1147
|
-
let
|
|
1148
|
-
if (
|
|
1146
|
+
}, []), u(() => {
|
|
1147
|
+
let e = V.current, t = Zn.current;
|
|
1148
|
+
!e || !t || (Pt ? t.addTo(e) : e.removeLayer(t));
|
|
1149
|
+
}, [Pt]);
|
|
1150
|
+
let si = R ? T.get(R.type) ?? null : null, $ = z ? T.get(z.type) ?? null : null, ci = !Ie.crops && h.length === 0, li = P ? P.distance >= 1e3 ? `${(P.distance / 1e3).toFixed(2)} km` : `${P.distance.toFixed(0)} m` : "";
|
|
1151
|
+
if (Le.crops && h.length === 0) return /* @__PURE__ */ v(i, {
|
|
1152
|
+
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
1153
|
+
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
1154
|
+
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
1155
|
+
children: /* @__PURE__ */ v(o, { onRetry: _ })
|
|
1156
|
+
});
|
|
1157
|
+
if (!Ie.dashboard && !Et) return /* @__PURE__ */ v(i, {
|
|
1149
1158
|
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
1150
1159
|
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
1151
1160
|
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
1152
|
-
children: /* @__PURE__ */
|
|
1161
|
+
children: /* @__PURE__ */ v(a, {
|
|
1162
|
+
illustration: "onboarding",
|
|
1163
|
+
title: e("healthybowl.fieldMapPage.noFarm.title", "Set up your farm first"),
|
|
1164
|
+
description: e("healthybowl.fieldMapPage.noFarm.description", "The Field Map attaches every boundary you draw to your farm. Create your farm, then come back to trace and save your fields on the satellite view."),
|
|
1165
|
+
action: /* @__PURE__ */ y(b, {
|
|
1166
|
+
onClick: () => wt(Tt("getting-started")),
|
|
1167
|
+
children: [
|
|
1168
|
+
/* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
|
|
1169
|
+
" ",
|
|
1170
|
+
e("healthybowl.fieldMapPage.noFarm.action", "Set up your farm")
|
|
1171
|
+
]
|
|
1172
|
+
})
|
|
1173
|
+
})
|
|
1153
1174
|
});
|
|
1154
|
-
let
|
|
1175
|
+
let ui = (e, t, n, r) => /* @__PURE__ */ y("button", {
|
|
1155
1176
|
type: "button",
|
|
1156
1177
|
onClick: t,
|
|
1157
1178
|
"aria-pressed": e,
|
|
1158
1179
|
className: `flex flex-col items-center gap-1 rounded-md px-3 py-1.5 text-[11px] font-medium transition-colors ${e ? "bg-success text-white" : "text-text-primary hover:bg-bg-sunken"}`,
|
|
1159
1180
|
children: [n, r]
|
|
1160
1181
|
});
|
|
1161
|
-
return /* @__PURE__ */
|
|
1182
|
+
return /* @__PURE__ */ y(i, {
|
|
1162
1183
|
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
1163
1184
|
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
1164
1185
|
hero: !0,
|
|
1165
1186
|
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
1166
1187
|
purpose: "Trace each plot on the aerial view to auto-calculate its acreage, shade fields by soil type, overlay terrain, and see your whole holding at a glance. Click any field in the list to fly straight to it.",
|
|
1167
1188
|
children: [
|
|
1168
|
-
/* @__PURE__ */
|
|
1189
|
+
/* @__PURE__ */ y("div", {
|
|
1169
1190
|
className: "flex flex-col gap-4 lg:flex-row",
|
|
1170
|
-
children: [/* @__PURE__ */
|
|
1191
|
+
children: [/* @__PURE__ */ y("div", {
|
|
1171
1192
|
className: "min-w-0 flex-1 space-y-3",
|
|
1172
1193
|
children: [
|
|
1173
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ y("form", {
|
|
1174
1195
|
className: "flex gap-2",
|
|
1175
|
-
onSubmit:
|
|
1176
|
-
children: [/* @__PURE__ */
|
|
1196
|
+
onSubmit: ri,
|
|
1197
|
+
children: [/* @__PURE__ */ y("div", {
|
|
1177
1198
|
className: "relative min-w-0 flex-1",
|
|
1178
|
-
children: [/* @__PURE__ */
|
|
1199
|
+
children: [/* @__PURE__ */ v(je, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ v("input", {
|
|
1179
1200
|
type: "search",
|
|
1180
|
-
value:
|
|
1181
|
-
onChange: (e) =>
|
|
1201
|
+
value: Ut,
|
|
1202
|
+
onChange: (e) => Wt(e.target.value),
|
|
1182
1203
|
placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
|
|
1183
1204
|
"aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
|
|
1184
1205
|
className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1185
1206
|
})]
|
|
1186
|
-
}), /* @__PURE__ */ b
|
|
1207
|
+
}), /* @__PURE__ */ y(b, {
|
|
1187
1208
|
type: "submit",
|
|
1188
1209
|
variant: "outline",
|
|
1189
1210
|
size: "sm",
|
|
1190
|
-
disabled:
|
|
1211
|
+
disabled: O !== "ready" || Gt,
|
|
1191
1212
|
children: [
|
|
1192
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ v(Te, { className: "h-4 w-4" }),
|
|
1193
1214
|
" ",
|
|
1194
|
-
|
|
1215
|
+
Gt ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
|
|
1195
1216
|
]
|
|
1196
1217
|
})]
|
|
1197
1218
|
}),
|
|
1198
|
-
/* @__PURE__ */
|
|
1219
|
+
/* @__PURE__ */ y("div", {
|
|
1199
1220
|
className: "relative",
|
|
1200
1221
|
children: [
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
ref:
|
|
1222
|
+
/* @__PURE__ */ v("div", {
|
|
1223
|
+
ref: Yn,
|
|
1203
1224
|
className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
|
|
1204
1225
|
}),
|
|
1205
|
-
|
|
1226
|
+
O === "ready" && /* @__PURE__ */ y("div", {
|
|
1206
1227
|
className: "absolute right-3 top-3 z-[1000] flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface/95 p-1 shadow-md",
|
|
1207
1228
|
children: [
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
}, /* @__PURE__ */
|
|
1229
|
+
ui(k === "draw", () => k === "draw" ? Vr() : Br(), /* @__PURE__ */ v(De, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
|
|
1230
|
+
ui(k === "edit", () => k === "edit" ? Gr() : Wr(), /* @__PURE__ */ v(Ne, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
|
|
1231
|
+
ui(!1, qr, /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
|
|
1232
|
+
ui(k === "measure", () => k === "measure" ? Xr() : Yr(), /* @__PURE__ */ v(ke, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure")),
|
|
1233
|
+
ui(k === "element" || Sn, () => {
|
|
1234
|
+
k === "element" ? (ti(), Cn(!1)) : Cn((e) => !e);
|
|
1235
|
+
}, /* @__PURE__ */ v(Me, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.elements", "Elements"))
|
|
1215
1236
|
]
|
|
1216
1237
|
}),
|
|
1217
|
-
|
|
1238
|
+
O === "ready" && Sn && k !== "element" && /* @__PURE__ */ y("div", {
|
|
1218
1239
|
className: "absolute right-3 top-16 z-[1001] w-60 rounded-lg border border-border-subtle bg-bg-surface/95 p-2 shadow-lg",
|
|
1219
|
-
children: [/* @__PURE__ */
|
|
1240
|
+
children: [/* @__PURE__ */ v("p", {
|
|
1220
1241
|
className: "px-1.5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-text-secondary",
|
|
1221
1242
|
children: e("healthybowl.fieldMapPage.elements.menuTitle", "Add map element")
|
|
1222
|
-
}),
|
|
1243
|
+
}), et.map((t) => {
|
|
1223
1244
|
let n = t.icon;
|
|
1224
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ y("button", {
|
|
1225
1246
|
type: "button",
|
|
1226
|
-
onClick: () =>
|
|
1247
|
+
onClick: () => ei(t.type),
|
|
1227
1248
|
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken",
|
|
1228
1249
|
children: [
|
|
1229
|
-
/* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ v(n, {
|
|
1230
1251
|
className: "h-4 w-4 shrink-0",
|
|
1231
1252
|
style: { color: t.color }
|
|
1232
1253
|
}),
|
|
1233
|
-
/* @__PURE__ */
|
|
1254
|
+
/* @__PURE__ */ v("span", {
|
|
1234
1255
|
className: "min-w-0 flex-1 truncate",
|
|
1235
1256
|
children: e(t.labelKey, t.label)
|
|
1236
1257
|
}),
|
|
1237
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ v("span", {
|
|
1238
1259
|
className: "shrink-0 text-[10px] uppercase tracking-wide text-text-secondary",
|
|
1239
|
-
children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`,
|
|
1260
|
+
children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, tt(t.kind))
|
|
1240
1261
|
})
|
|
1241
1262
|
]
|
|
1242
1263
|
}, t.type);
|
|
1243
1264
|
})]
|
|
1244
1265
|
}),
|
|
1245
|
-
|
|
1266
|
+
k === "draw" && /* @__PURE__ */ y("div", {
|
|
1246
1267
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
1247
1268
|
children: [
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */ b
|
|
1269
|
+
/* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(qt) }) }),
|
|
1270
|
+
/* @__PURE__ */ y(b, {
|
|
1250
1271
|
size: "sm",
|
|
1251
1272
|
variant: "default",
|
|
1252
|
-
onClick:
|
|
1273
|
+
onClick: zr,
|
|
1253
1274
|
children: [
|
|
1254
|
-
/* @__PURE__ */
|
|
1275
|
+
/* @__PURE__ */ v(Se, { className: "h-3.5 w-3.5" }),
|
|
1255
1276
|
" ",
|
|
1256
1277
|
e("healthybowl.fieldMapPage.finish", "Finish")
|
|
1257
1278
|
]
|
|
1258
1279
|
}),
|
|
1259
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ v(b, {
|
|
1260
1281
|
size: "sm",
|
|
1261
1282
|
variant: "outline",
|
|
1262
|
-
onClick:
|
|
1263
|
-
children: /* @__PURE__ */
|
|
1283
|
+
onClick: Vr,
|
|
1284
|
+
children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
|
|
1264
1285
|
})
|
|
1265
1286
|
]
|
|
1266
1287
|
}),
|
|
1267
|
-
|
|
1288
|
+
k === "edit" && /* @__PURE__ */ y("div", {
|
|
1268
1289
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
1269
1290
|
children: [
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
area: String(
|
|
1272
|
-
unit:
|
|
1291
|
+
/* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
|
|
1292
|
+
area: String(Yt ?? ""),
|
|
1293
|
+
unit: K?.unit ?? "acres"
|
|
1273
1294
|
}) }),
|
|
1274
|
-
/* @__PURE__ */ b
|
|
1295
|
+
/* @__PURE__ */ y(b, {
|
|
1275
1296
|
size: "sm",
|
|
1276
1297
|
variant: "default",
|
|
1277
|
-
onClick:
|
|
1278
|
-
disabled: !
|
|
1298
|
+
onClick: Kr,
|
|
1299
|
+
disabled: !Zt || $t,
|
|
1279
1300
|
children: [
|
|
1280
|
-
/* @__PURE__ */
|
|
1301
|
+
/* @__PURE__ */ v(Ae, { className: "h-3.5 w-3.5" }),
|
|
1281
1302
|
" ",
|
|
1282
|
-
|
|
1303
|
+
$t ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
|
|
1283
1304
|
]
|
|
1284
1305
|
}),
|
|
1285
|
-
/* @__PURE__ */
|
|
1306
|
+
/* @__PURE__ */ v(b, {
|
|
1286
1307
|
size: "sm",
|
|
1287
1308
|
variant: "outline",
|
|
1288
|
-
onClick:
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1309
|
+
onClick: Gr,
|
|
1310
|
+
children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
|
|
1290
1311
|
})
|
|
1291
1312
|
]
|
|
1292
1313
|
}),
|
|
1293
|
-
|
|
1314
|
+
k === "measure" && P && /* @__PURE__ */ y("div", {
|
|
1294
1315
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-3 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
1295
1316
|
children: [
|
|
1296
|
-
/* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1317
|
+
/* @__PURE__ */ y("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: li }), P.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (P.area / 4046.8564224).toFixed(2) })}`] }),
|
|
1318
|
+
/* @__PURE__ */ v(b, {
|
|
1298
1319
|
size: "sm",
|
|
1299
1320
|
variant: "outline",
|
|
1300
|
-
onClick:
|
|
1321
|
+
onClick: Z,
|
|
1301
1322
|
children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
|
|
1302
1323
|
}),
|
|
1303
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ v(b, {
|
|
1304
1325
|
size: "sm",
|
|
1305
1326
|
variant: "outline",
|
|
1306
|
-
onClick:
|
|
1307
|
-
children: /* @__PURE__ */
|
|
1327
|
+
onClick: Xr,
|
|
1328
|
+
children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
|
|
1308
1329
|
})
|
|
1309
1330
|
]
|
|
1310
1331
|
}),
|
|
1311
|
-
|
|
1332
|
+
k === "element" && Ar && /* @__PURE__ */ y("div", {
|
|
1312
1333
|
className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
|
|
1313
1334
|
children: [
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
|
|
1335
|
+
/* @__PURE__ */ v("span", { children: Ar.kind === "point" ? e("healthybowl.fieldMapPage.elements.hint.point", "Click the map to place {{label}}.", { label: e(Ar.labelKey, Ar.label) }) : Ar.kind === "line" ? e("healthybowl.fieldMapPage.elements.hint.line", "Click to add points ({{count}}) — then Finish.", { count: String(En) }) : e("healthybowl.fieldMapPage.elements.hint.polygon", "Click to add corners ({{count}}) — click the first point or Finish.", { count: String(En) }) }),
|
|
1336
|
+
Ar.kind !== "point" && /* @__PURE__ */ y(b, {
|
|
1316
1337
|
size: "sm",
|
|
1317
1338
|
variant: "default",
|
|
1318
|
-
onClick:
|
|
1339
|
+
onClick: $r,
|
|
1319
1340
|
children: [
|
|
1320
|
-
/* @__PURE__ */
|
|
1341
|
+
/* @__PURE__ */ v(Se, { className: "h-3.5 w-3.5" }),
|
|
1321
1342
|
" ",
|
|
1322
1343
|
e("healthybowl.fieldMapPage.finish", "Finish")
|
|
1323
1344
|
]
|
|
1324
1345
|
}),
|
|
1325
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ v(b, {
|
|
1326
1347
|
size: "sm",
|
|
1327
1348
|
variant: "outline",
|
|
1328
|
-
onClick:
|
|
1329
|
-
children: /* @__PURE__ */
|
|
1349
|
+
onClick: ti,
|
|
1350
|
+
children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
|
|
1330
1351
|
})
|
|
1331
1352
|
]
|
|
1332
1353
|
}),
|
|
1333
|
-
|
|
1354
|
+
O === "ready" && /* @__PURE__ */ y("div", {
|
|
1334
1355
|
className: "absolute bottom-3 left-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
1335
1356
|
children: [
|
|
1336
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ y("div", {
|
|
1337
1358
|
className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
|
|
1338
1359
|
children: [
|
|
1339
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ v(Ce, { className: "h-3.5 w-3.5" }),
|
|
1340
1361
|
" ",
|
|
1341
1362
|
e("healthybowl.fieldMapPage.layers.title", "Layers")
|
|
1342
1363
|
]
|
|
1343
1364
|
}),
|
|
1344
|
-
/* @__PURE__ */
|
|
1365
|
+
/* @__PURE__ */ y("label", {
|
|
1345
1366
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
1346
|
-
children: [/* @__PURE__ */
|
|
1367
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1347
1368
|
type: "checkbox",
|
|
1348
1369
|
checked: !0,
|
|
1349
1370
|
readOnly: !0,
|
|
1350
1371
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
1351
1372
|
}), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
|
|
1352
1373
|
}),
|
|
1353
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ y("label", {
|
|
1354
1375
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
1355
|
-
children: [/* @__PURE__ */
|
|
1376
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1356
1377
|
type: "checkbox",
|
|
1357
|
-
checked:
|
|
1358
|
-
onChange: (e) =>
|
|
1378
|
+
checked: Pt,
|
|
1379
|
+
onChange: (e) => Ft(e.target.checked),
|
|
1359
1380
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
1360
1381
|
}), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
|
|
1361
1382
|
}),
|
|
1362
|
-
/* @__PURE__ */
|
|
1383
|
+
/* @__PURE__ */ y("label", {
|
|
1363
1384
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
1364
|
-
children: [/* @__PURE__ */
|
|
1385
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1365
1386
|
type: "checkbox",
|
|
1366
|
-
checked:
|
|
1367
|
-
onChange: (e) =>
|
|
1387
|
+
checked: It,
|
|
1388
|
+
onChange: (e) => Lt(e.target.checked),
|
|
1368
1389
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
1369
1390
|
}), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
|
|
1370
1391
|
}),
|
|
1371
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ y("label", {
|
|
1372
1393
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
1373
|
-
children: [/* @__PURE__ */
|
|
1394
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1374
1395
|
type: "checkbox",
|
|
1375
|
-
checked:
|
|
1376
|
-
onChange: (e) =>
|
|
1396
|
+
checked: Rt,
|
|
1397
|
+
onChange: (e) => zt(e.target.checked),
|
|
1377
1398
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
1378
1399
|
}), e("healthybowl.fieldMapPage.layers.elevation", "Elevation")]
|
|
1379
1400
|
}),
|
|
1380
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ y("label", {
|
|
1381
1402
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
1382
|
-
children: [/* @__PURE__ */
|
|
1403
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1383
1404
|
type: "checkbox",
|
|
1384
|
-
checked:
|
|
1385
|
-
onChange: (e) =>
|
|
1405
|
+
checked: bn,
|
|
1406
|
+
onChange: (e) => xn(e.target.checked),
|
|
1386
1407
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
1387
1408
|
}), e("healthybowl.fieldMapPage.layers.elements", "Map elements")]
|
|
1388
1409
|
}),
|
|
1389
|
-
|
|
1410
|
+
bn && /* @__PURE__ */ y("div", {
|
|
1390
1411
|
className: "mt-1.5 max-h-40 overflow-y-auto border-t border-border-subtle pt-1.5",
|
|
1391
|
-
children: [/* @__PURE__ */
|
|
1412
|
+
children: [/* @__PURE__ */ v("div", {
|
|
1392
1413
|
className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-text-secondary",
|
|
1393
1414
|
children: e("healthybowl.fieldMapPage.elements.legendTitle", "Element types")
|
|
1394
|
-
}),
|
|
1415
|
+
}), et.map((t) => {
|
|
1395
1416
|
let n = t.icon;
|
|
1396
|
-
return /* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ y("div", {
|
|
1397
1418
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
1398
1419
|
children: [
|
|
1399
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ v("span", {
|
|
1400
1421
|
className: `inline-block shrink-0 ${t.kind === "line" ? "h-0.5 w-3.5 rounded-full" : "h-3 w-3 rounded-sm"}`,
|
|
1401
1422
|
style: { backgroundColor: t.color }
|
|
1402
1423
|
}),
|
|
1403
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ v(n, {
|
|
1404
1425
|
className: "h-3 w-3 shrink-0",
|
|
1405
1426
|
style: { color: t.color }
|
|
1406
1427
|
}),
|
|
@@ -1411,71 +1432,71 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
1411
1432
|
})
|
|
1412
1433
|
]
|
|
1413
1434
|
}),
|
|
1414
|
-
|
|
1435
|
+
O === "ready" && Rt && /* @__PURE__ */ y("div", {
|
|
1415
1436
|
className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
1416
|
-
children: [/* @__PURE__ */
|
|
1437
|
+
children: [/* @__PURE__ */ v("div", {
|
|
1417
1438
|
className: "mb-1.5 font-semibold text-text-primary",
|
|
1418
1439
|
children: e("healthybowl.fieldMapPage.elevationLegend.title", "Elevation")
|
|
1419
|
-
}),
|
|
1440
|
+
}), vr ? /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v("span", {
|
|
1420
1441
|
className: "block h-2 w-40 rounded-full",
|
|
1421
1442
|
style: { background: "linear-gradient(to right, #16a34a, #f59e0b, #dc2626)" }
|
|
1422
|
-
}), /* @__PURE__ */
|
|
1443
|
+
}), /* @__PURE__ */ y("div", {
|
|
1423
1444
|
className: "mt-1 flex justify-between gap-3 text-text-secondary",
|
|
1424
|
-
children: [/* @__PURE__ */
|
|
1425
|
-
})] }) : /* @__PURE__ */
|
|
1445
|
+
children: [/* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(gr)) }) }), /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(_r)) }) })]
|
|
1446
|
+
})] }) : /* @__PURE__ */ v("span", {
|
|
1426
1447
|
className: "text-text-secondary",
|
|
1427
1448
|
children: e("healthybowl.fieldMapPage.elevationLegend.loading", "Loading elevation…")
|
|
1428
1449
|
})]
|
|
1429
1450
|
}),
|
|
1430
|
-
|
|
1451
|
+
O === "ready" && It && !Rt && pr.length > 0 && /* @__PURE__ */ y("div", {
|
|
1431
1452
|
className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
1432
|
-
children: [/* @__PURE__ */
|
|
1453
|
+
children: [/* @__PURE__ */ v("div", {
|
|
1433
1454
|
className: "mb-1.5 font-semibold text-text-primary",
|
|
1434
1455
|
children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
|
|
1435
|
-
}),
|
|
1456
|
+
}), pr.map((t) => /* @__PURE__ */ y("div", {
|
|
1436
1457
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
1437
|
-
children: [/* @__PURE__ */
|
|
1458
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1438
1459
|
className: "inline-block h-3 w-3 rounded-sm",
|
|
1439
1460
|
style: { backgroundColor: t.color }
|
|
1440
1461
|
}), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
|
|
1441
1462
|
}, t.key))]
|
|
1442
1463
|
}),
|
|
1443
|
-
|
|
1464
|
+
O === "ready" && Pt && /* @__PURE__ */ y("div", {
|
|
1444
1465
|
className: "absolute left-3 top-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 px-3 py-2 text-[11px] text-text-secondary shadow-md",
|
|
1445
|
-
children: [/* @__PURE__ */
|
|
1466
|
+
children: [/* @__PURE__ */ v("div", {
|
|
1446
1467
|
className: "font-semibold text-text-primary",
|
|
1447
1468
|
children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
|
|
1448
|
-
}), /* @__PURE__ */
|
|
1469
|
+
}), /* @__PURE__ */ y("div", {
|
|
1449
1470
|
className: "mt-1 flex items-center gap-2",
|
|
1450
|
-
children: [/* @__PURE__ */
|
|
1471
|
+
children: [/* @__PURE__ */ v("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
|
|
1451
1472
|
})]
|
|
1452
1473
|
}),
|
|
1453
|
-
(
|
|
1474
|
+
(O === "loading" || Ie.crops && h.length === 0) && /* @__PURE__ */ v("div", {
|
|
1454
1475
|
className: "pointer-events-none absolute inset-0 z-[900] flex items-center justify-center rounded-lg bg-bg-surface/60 text-sm text-text-secondary",
|
|
1455
1476
|
children: e("healthybowl.fieldMapPage.loading", "Loading map…")
|
|
1456
1477
|
}),
|
|
1457
|
-
|
|
1478
|
+
ci && O === "ready" && k === "view" && /* @__PURE__ */ v("div", {
|
|
1458
1479
|
className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1480
|
+
children: /* @__PURE__ */ y("div", {
|
|
1460
1481
|
className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
|
|
1461
1482
|
children: [
|
|
1462
|
-
/* @__PURE__ */
|
|
1483
|
+
/* @__PURE__ */ v("div", {
|
|
1463
1484
|
className: "mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-success/15",
|
|
1464
|
-
children: /* @__PURE__ */
|
|
1485
|
+
children: /* @__PURE__ */ v(Ee, { className: "h-6 w-6 text-success" })
|
|
1465
1486
|
}),
|
|
1466
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ v("h3", {
|
|
1467
1488
|
className: "text-lg font-semibold text-text-primary",
|
|
1468
1489
|
children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
|
|
1469
1490
|
}),
|
|
1470
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ v("p", {
|
|
1471
1492
|
className: "mt-1 text-sm text-text-secondary",
|
|
1472
1493
|
children: e("healthybowl.fieldMapPage.empty.description", "Draw the shape of each field on the satellite view to auto-calculate its area and unlock soil & terrain overlays.")
|
|
1473
1494
|
}),
|
|
1474
|
-
/* @__PURE__ */ b
|
|
1495
|
+
/* @__PURE__ */ y(b, {
|
|
1475
1496
|
className: "mt-4",
|
|
1476
|
-
onClick:
|
|
1497
|
+
onClick: Br,
|
|
1477
1498
|
children: [
|
|
1478
|
-
/* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
|
|
1479
1500
|
" ",
|
|
1480
1501
|
e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
|
|
1481
1502
|
]
|
|
@@ -1485,188 +1506,188 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
1485
1506
|
})
|
|
1486
1507
|
]
|
|
1487
1508
|
}),
|
|
1488
|
-
/* @__PURE__ */
|
|
1509
|
+
/* @__PURE__ */ v("p", {
|
|
1489
1510
|
className: "text-xs text-text-secondary",
|
|
1490
1511
|
children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
|
|
1491
1512
|
})
|
|
1492
1513
|
]
|
|
1493
|
-
}), /* @__PURE__ */
|
|
1514
|
+
}), /* @__PURE__ */ y("aside", {
|
|
1494
1515
|
className: "shrink-0 space-y-4 lg:w-80",
|
|
1495
1516
|
children: [
|
|
1496
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ y("div", {
|
|
1497
1518
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
1498
1519
|
children: [
|
|
1499
|
-
/* @__PURE__ */
|
|
1520
|
+
/* @__PURE__ */ v("h2", {
|
|
1500
1521
|
className: "text-base font-semibold text-text-primary",
|
|
1501
1522
|
children: e("healthybowl.fieldMapPage.panel.title", "Fields")
|
|
1502
1523
|
}),
|
|
1503
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ v("p", {
|
|
1504
1525
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
1505
1526
|
children: e("healthybowl.fieldMapPage.panel.summary", "{{acres}} acres · {{count}} fields · {{mapped}} mapped", {
|
|
1506
|
-
acres:
|
|
1507
|
-
count: String(
|
|
1508
|
-
mapped: String(
|
|
1527
|
+
acres: fr.toFixed(1),
|
|
1528
|
+
count: String(h.length),
|
|
1529
|
+
mapped: String(dr)
|
|
1509
1530
|
})
|
|
1510
1531
|
}),
|
|
1511
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ y("div", {
|
|
1512
1533
|
className: "relative mt-3",
|
|
1513
|
-
children: [/* @__PURE__ */
|
|
1534
|
+
children: [/* @__PURE__ */ v(je, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ v("input", {
|
|
1514
1535
|
type: "search",
|
|
1515
|
-
value:
|
|
1516
|
-
onChange: (e) =>
|
|
1536
|
+
value: Vt,
|
|
1537
|
+
onChange: (e) => Ht(e.target.value),
|
|
1517
1538
|
placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
|
|
1518
1539
|
className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1519
1540
|
})]
|
|
1520
1541
|
}),
|
|
1521
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ y("div", {
|
|
1522
1543
|
className: "mt-3 max-h-[38vh] space-y-1 overflow-y-auto",
|
|
1523
|
-
children: [
|
|
1524
|
-
let n =
|
|
1525
|
-
return /* @__PURE__ */
|
|
1544
|
+
children: [mr.map((t) => {
|
|
1545
|
+
let n = D(t) !== null;
|
|
1546
|
+
return /* @__PURE__ */ y("button", {
|
|
1526
1547
|
type: "button",
|
|
1527
1548
|
"data-field-id": t.id,
|
|
1528
|
-
onClick: () =>
|
|
1529
|
-
className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id ===
|
|
1549
|
+
onClick: () => Ir(t),
|
|
1550
|
+
className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === j ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
|
|
1530
1551
|
children: [
|
|
1531
|
-
/* @__PURE__ */
|
|
1552
|
+
/* @__PURE__ */ v("span", {
|
|
1532
1553
|
className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
|
|
1533
|
-
style: { backgroundColor:
|
|
1554
|
+
style: { backgroundColor: de(t.soilType) }
|
|
1534
1555
|
}),
|
|
1535
|
-
/* @__PURE__ */
|
|
1556
|
+
/* @__PURE__ */ y("span", {
|
|
1536
1557
|
className: "min-w-0 flex-1",
|
|
1537
|
-
children: [/* @__PURE__ */
|
|
1558
|
+
children: [/* @__PURE__ */ v("span", {
|
|
1538
1559
|
className: "block truncate text-sm font-medium text-text-primary",
|
|
1539
1560
|
children: t.name
|
|
1540
|
-
}), /* @__PURE__ */
|
|
1561
|
+
}), /* @__PURE__ */ y("span", {
|
|
1541
1562
|
className: "block truncate text-xs text-text-secondary",
|
|
1542
1563
|
children: [
|
|
1543
|
-
|
|
1564
|
+
xt(t),
|
|
1544
1565
|
" ·",
|
|
1545
1566
|
" ",
|
|
1546
1567
|
t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil"),
|
|
1547
|
-
|
|
1568
|
+
N[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[t.id])) })}`
|
|
1548
1569
|
]
|
|
1549
1570
|
})]
|
|
1550
1571
|
}),
|
|
1551
|
-
!n && /* @__PURE__ */
|
|
1572
|
+
!n && /* @__PURE__ */ v("span", {
|
|
1552
1573
|
className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
|
|
1553
1574
|
children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
|
|
1554
1575
|
})
|
|
1555
1576
|
]
|
|
1556
1577
|
}, t.id);
|
|
1557
|
-
}),
|
|
1578
|
+
}), mr.length === 0 && /* @__PURE__ */ v("p", {
|
|
1558
1579
|
className: "px-2 py-4 text-center text-xs text-text-secondary",
|
|
1559
1580
|
children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
|
|
1560
1581
|
})]
|
|
1561
1582
|
}),
|
|
1562
|
-
/* @__PURE__ */ b
|
|
1583
|
+
/* @__PURE__ */ y(b, {
|
|
1563
1584
|
className: "mt-3 w-full",
|
|
1564
|
-
onClick:
|
|
1565
|
-
disabled:
|
|
1585
|
+
onClick: Br,
|
|
1586
|
+
disabled: k === "draw",
|
|
1566
1587
|
children: [
|
|
1567
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
|
|
1568
1589
|
" ",
|
|
1569
1590
|
e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
|
|
1570
1591
|
]
|
|
1571
1592
|
})
|
|
1572
1593
|
]
|
|
1573
1594
|
}),
|
|
1574
|
-
|
|
1595
|
+
K && /* @__PURE__ */ y("div", {
|
|
1575
1596
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
1576
1597
|
children: [
|
|
1577
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ v("h3", {
|
|
1578
1599
|
className: "text-sm font-semibold text-text-primary",
|
|
1579
|
-
children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name:
|
|
1600
|
+
children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: K.name })
|
|
1580
1601
|
}),
|
|
1581
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ y("dl", {
|
|
1582
1603
|
className: "mt-3 space-y-2 text-sm",
|
|
1583
1604
|
children: [
|
|
1584
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ y("div", {
|
|
1585
1606
|
className: "flex justify-between gap-3",
|
|
1586
|
-
children: [/* @__PURE__ */
|
|
1607
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
1587
1608
|
className: "text-text-secondary",
|
|
1588
1609
|
children: e("healthybowl.fieldMapPage.detail.area", "Area")
|
|
1589
|
-
}), /* @__PURE__ */
|
|
1610
|
+
}), /* @__PURE__ */ y("dd", {
|
|
1590
1611
|
className: "font-medium text-text-primary",
|
|
1591
1612
|
children: [
|
|
1592
|
-
|
|
1613
|
+
K.area,
|
|
1593
1614
|
" ",
|
|
1594
|
-
|
|
1615
|
+
K.unit
|
|
1595
1616
|
]
|
|
1596
1617
|
})]
|
|
1597
1618
|
}),
|
|
1598
|
-
/* @__PURE__ */
|
|
1619
|
+
/* @__PURE__ */ y("div", {
|
|
1599
1620
|
className: "flex justify-between gap-3",
|
|
1600
|
-
children: [/* @__PURE__ */
|
|
1621
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
1601
1622
|
className: "text-text-secondary",
|
|
1602
1623
|
children: e("healthybowl.fieldMapPage.detail.elevation", "Elevation")
|
|
1603
|
-
}), /* @__PURE__ */
|
|
1624
|
+
}), /* @__PURE__ */ v("dd", {
|
|
1604
1625
|
className: "font-medium text-text-primary",
|
|
1605
|
-
children:
|
|
1626
|
+
children: N[K.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[K.id])) })
|
|
1606
1627
|
})]
|
|
1607
1628
|
}),
|
|
1608
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ y("div", {
|
|
1609
1630
|
className: "flex justify-between gap-3",
|
|
1610
|
-
children: [/* @__PURE__ */
|
|
1631
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
1611
1632
|
className: "text-text-secondary",
|
|
1612
1633
|
children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
|
|
1613
|
-
}), /* @__PURE__ */
|
|
1634
|
+
}), /* @__PURE__ */ v("dd", {
|
|
1614
1635
|
className: "font-medium text-text-primary",
|
|
1615
|
-
children:
|
|
1636
|
+
children: K.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
|
|
1616
1637
|
})]
|
|
1617
1638
|
}),
|
|
1618
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ y("div", {
|
|
1619
1640
|
className: "flex justify-between gap-3",
|
|
1620
|
-
children: [/* @__PURE__ */
|
|
1641
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
1621
1642
|
className: "text-text-secondary",
|
|
1622
1643
|
children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
|
|
1623
|
-
}), /* @__PURE__ */
|
|
1644
|
+
}), /* @__PURE__ */ v("dd", {
|
|
1624
1645
|
className: "font-medium text-text-primary",
|
|
1625
|
-
children:
|
|
1646
|
+
children: K.irrigationType || "—"
|
|
1626
1647
|
})]
|
|
1627
1648
|
}),
|
|
1628
|
-
/* @__PURE__ */
|
|
1649
|
+
/* @__PURE__ */ y("div", {
|
|
1629
1650
|
className: "flex justify-between gap-3",
|
|
1630
|
-
children: [/* @__PURE__ */
|
|
1651
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
1631
1652
|
className: "text-text-secondary",
|
|
1632
1653
|
children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
|
|
1633
|
-
}), /* @__PURE__ */
|
|
1654
|
+
}), /* @__PURE__ */ v("dd", {
|
|
1634
1655
|
className: "font-medium text-text-primary",
|
|
1635
|
-
children:
|
|
1656
|
+
children: yr(K) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
|
|
1636
1657
|
})]
|
|
1637
1658
|
}),
|
|
1638
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ y("div", {
|
|
1639
1660
|
className: "flex justify-between gap-3",
|
|
1640
|
-
children: [/* @__PURE__ */
|
|
1661
|
+
children: [/* @__PURE__ */ v("dt", {
|
|
1641
1662
|
className: "text-text-secondary",
|
|
1642
1663
|
children: e("healthybowl.fieldMapPage.detail.status", "Status")
|
|
1643
|
-
}), /* @__PURE__ */
|
|
1664
|
+
}), /* @__PURE__ */ v("dd", {
|
|
1644
1665
|
className: "font-medium capitalize text-text-primary",
|
|
1645
|
-
children:
|
|
1666
|
+
children: K.status
|
|
1646
1667
|
})]
|
|
1647
1668
|
})
|
|
1648
1669
|
]
|
|
1649
1670
|
}),
|
|
1650
|
-
/* @__PURE__ */
|
|
1671
|
+
/* @__PURE__ */ y("div", {
|
|
1651
1672
|
className: "mt-3 flex gap-2",
|
|
1652
|
-
children: [/* @__PURE__ */ b
|
|
1673
|
+
children: [/* @__PURE__ */ y(b, {
|
|
1653
1674
|
variant: "outline",
|
|
1654
1675
|
size: "sm",
|
|
1655
1676
|
className: "flex-1",
|
|
1656
|
-
onClick: () =>
|
|
1677
|
+
onClick: () => Fr(K),
|
|
1657
1678
|
children: [
|
|
1658
|
-
/* @__PURE__ */
|
|
1679
|
+
/* @__PURE__ */ v(Ee, { className: "h-4 w-4" }),
|
|
1659
1680
|
" ",
|
|
1660
1681
|
e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
|
|
1661
1682
|
]
|
|
1662
|
-
}),
|
|
1683
|
+
}), D(K) && /* @__PURE__ */ y(b, {
|
|
1663
1684
|
variant: "outline",
|
|
1664
1685
|
size: "sm",
|
|
1665
1686
|
className: "flex-1",
|
|
1666
|
-
onClick:
|
|
1667
|
-
disabled:
|
|
1687
|
+
onClick: Wr,
|
|
1688
|
+
disabled: k === "edit",
|
|
1668
1689
|
children: [
|
|
1669
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ v(Ne, { className: "h-4 w-4" }),
|
|
1670
1691
|
" ",
|
|
1671
1692
|
e("healthybowl.fieldMapPage.detail.edit", "Edit")
|
|
1672
1693
|
]
|
|
@@ -1674,256 +1695,256 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
1674
1695
|
})
|
|
1675
1696
|
]
|
|
1676
1697
|
}),
|
|
1677
|
-
|
|
1698
|
+
K && br && /* @__PURE__ */ y("div", {
|
|
1678
1699
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
1679
1700
|
children: [
|
|
1680
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ y("div", {
|
|
1681
1702
|
className: "flex items-center justify-between gap-2",
|
|
1682
|
-
children: [/* @__PURE__ */
|
|
1703
|
+
children: [/* @__PURE__ */ y("h3", {
|
|
1683
1704
|
className: "flex items-center gap-1.5 text-sm font-semibold text-text-primary",
|
|
1684
1705
|
children: [
|
|
1685
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ v(we, { className: "h-4 w-4" }),
|
|
1686
1707
|
" ",
|
|
1687
1708
|
e("healthybowl.fieldMapPage.beds.title", "Bed layout")
|
|
1688
1709
|
]
|
|
1689
|
-
}), /* @__PURE__ */
|
|
1710
|
+
}), /* @__PURE__ */ y("label", {
|
|
1690
1711
|
className: "flex cursor-pointer items-center gap-2 text-xs font-medium text-text-primary",
|
|
1691
|
-
children: [/* @__PURE__ */
|
|
1712
|
+
children: [/* @__PURE__ */ v("input", {
|
|
1692
1713
|
type: "checkbox",
|
|
1693
|
-
checked:
|
|
1694
|
-
onChange: (e) =>
|
|
1714
|
+
checked: nn,
|
|
1715
|
+
onChange: (e) => rn(e.target.checked),
|
|
1695
1716
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
1696
1717
|
}), e("healthybowl.fieldMapPage.beds.show", "Show beds")]
|
|
1697
1718
|
})]
|
|
1698
1719
|
}),
|
|
1699
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ v("p", {
|
|
1700
1721
|
className: "mt-1 text-xs text-text-secondary",
|
|
1701
1722
|
children: e("healthybowl.fieldMapPage.beds.hint", "Draw planting bed strips inside this field, then save the layout. Click a saved bed to assign a crop.")
|
|
1702
1723
|
}),
|
|
1703
|
-
/* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ y("div", {
|
|
1704
1725
|
className: "mt-3 grid grid-cols-2 gap-3",
|
|
1705
|
-
children: [/* @__PURE__ */
|
|
1726
|
+
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1706
1727
|
className: "text-xs font-medium text-text-primary",
|
|
1707
1728
|
children: e("healthybowl.fieldMapPage.beds.bedWidth", "Bed width (m)")
|
|
1708
|
-
}), /* @__PURE__ */
|
|
1729
|
+
}), /* @__PURE__ */ v("input", {
|
|
1709
1730
|
type: "number",
|
|
1710
1731
|
min: .2,
|
|
1711
1732
|
step: .1,
|
|
1712
|
-
value:
|
|
1713
|
-
onChange: (e) =>
|
|
1733
|
+
value: F,
|
|
1734
|
+
onChange: (e) => an(Math.max(.2, Number(e.target.value) || 0)),
|
|
1714
1735
|
className: "mt-1 h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1715
|
-
})] }), /* @__PURE__ */
|
|
1736
|
+
})] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1716
1737
|
className: "text-xs font-medium text-text-primary",
|
|
1717
1738
|
children: e("healthybowl.fieldMapPage.beds.pathWidth", "Path width (m)")
|
|
1718
|
-
}), /* @__PURE__ */
|
|
1739
|
+
}), /* @__PURE__ */ v("input", {
|
|
1719
1740
|
type: "number",
|
|
1720
1741
|
min: 0,
|
|
1721
1742
|
step: .05,
|
|
1722
|
-
value:
|
|
1723
|
-
onChange: (e) =>
|
|
1743
|
+
value: on,
|
|
1744
|
+
onChange: (e) => sn(Math.max(0, Number(e.target.value) || 0)),
|
|
1724
1745
|
className: "mt-1 h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1725
1746
|
})] })]
|
|
1726
1747
|
}),
|
|
1727
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ y("div", {
|
|
1728
1749
|
className: "mt-3",
|
|
1729
|
-
children: [/* @__PURE__ */
|
|
1750
|
+
children: [/* @__PURE__ */ y("div", {
|
|
1730
1751
|
className: "flex items-center justify-between",
|
|
1731
|
-
children: [/* @__PURE__ */
|
|
1752
|
+
children: [/* @__PURE__ */ v("label", {
|
|
1732
1753
|
className: "text-xs font-medium text-text-primary",
|
|
1733
1754
|
children: e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
|
|
1734
|
-
}), /* @__PURE__ */
|
|
1755
|
+
}), /* @__PURE__ */ y("span", {
|
|
1735
1756
|
className: "text-xs text-text-secondary",
|
|
1736
|
-
children: [
|
|
1757
|
+
children: [I, "°"]
|
|
1737
1758
|
})]
|
|
1738
|
-
}), /* @__PURE__ */
|
|
1759
|
+
}), /* @__PURE__ */ v("input", {
|
|
1739
1760
|
type: "range",
|
|
1740
1761
|
min: 0,
|
|
1741
1762
|
max: 180,
|
|
1742
1763
|
step: 1,
|
|
1743
|
-
value:
|
|
1744
|
-
onChange: (e) =>
|
|
1764
|
+
value: I,
|
|
1765
|
+
onChange: (e) => cn(Number(e.target.value)),
|
|
1745
1766
|
className: "mt-1 w-full accent-[var(--color-success)]",
|
|
1746
1767
|
"aria-label": e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
|
|
1747
1768
|
})]
|
|
1748
1769
|
}),
|
|
1749
|
-
|
|
1770
|
+
g.length > 0 && /* @__PURE__ */ y("div", {
|
|
1750
1771
|
className: "mt-3",
|
|
1751
1772
|
children: [
|
|
1752
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ v("label", {
|
|
1753
1774
|
className: "text-xs font-medium text-text-primary",
|
|
1754
1775
|
children: e("healthybowl.fieldMapPage.beds.crop", "Spacing for crop")
|
|
1755
1776
|
}),
|
|
1756
|
-
/* @__PURE__ */
|
|
1757
|
-
value:
|
|
1758
|
-
onValueChange:
|
|
1759
|
-
children: [/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ y(Ve, {
|
|
1778
|
+
value: Sr?.id ?? "",
|
|
1779
|
+
onValueChange: un,
|
|
1780
|
+
children: [/* @__PURE__ */ v(Ue, {
|
|
1760
1781
|
className: "mt-1 w-full",
|
|
1761
|
-
children: /* @__PURE__ */
|
|
1762
|
-
}), /* @__PURE__ */
|
|
1782
|
+
children: /* @__PURE__ */ v(We, { placeholder: e("healthybowl.fieldMapPage.beds.cropPlaceholder", "Standard spacing") })
|
|
1783
|
+
}), /* @__PURE__ */ v(He, { children: g.map((e) => /* @__PURE__ */ v(x, {
|
|
1763
1784
|
value: e.id,
|
|
1764
1785
|
children: e.name
|
|
1765
1786
|
}, e.id)) })]
|
|
1766
1787
|
}),
|
|
1767
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ v("p", {
|
|
1768
1789
|
className: "mt-1 text-[11px] text-text-secondary",
|
|
1769
1790
|
children: e("healthybowl.fieldMapPage.beds.spacingLine", "{{preset}} · {{plant}}×{{row}} cm", {
|
|
1770
|
-
preset:
|
|
1771
|
-
plant: String(
|
|
1772
|
-
row: String(
|
|
1791
|
+
preset: q.label,
|
|
1792
|
+
plant: String(q.plantSpacingCm),
|
|
1793
|
+
row: String(q.rowSpacingCm)
|
|
1773
1794
|
})
|
|
1774
1795
|
})
|
|
1775
1796
|
]
|
|
1776
1797
|
}),
|
|
1777
|
-
|
|
1798
|
+
J && /* @__PURE__ */ y("div", {
|
|
1778
1799
|
className: "mt-3 rounded-md bg-warning/10 px-3 py-2 text-sm font-medium text-text-primary",
|
|
1779
1800
|
children: [e("healthybowl.fieldMapPage.beds.readout", "{{beds}} beds · ~{{plants}} plants", {
|
|
1780
|
-
beds: String(
|
|
1781
|
-
plants:
|
|
1782
|
-
}), /* @__PURE__ */
|
|
1801
|
+
beds: String(J.bedCount),
|
|
1802
|
+
plants: Cr.toLocaleString()
|
|
1803
|
+
}), /* @__PURE__ */ v("span", {
|
|
1783
1804
|
className: "ml-1 text-xs font-normal text-text-secondary",
|
|
1784
1805
|
children: e("healthybowl.fieldMapPage.beds.previewTag", "(preview)")
|
|
1785
1806
|
})]
|
|
1786
1807
|
}),
|
|
1787
|
-
|
|
1808
|
+
Y.length > 0 && /* @__PURE__ */ y("div", {
|
|
1788
1809
|
className: "mt-2 flex items-center gap-2 rounded-md bg-success/10 px-3 py-2 text-sm font-medium text-text-primary",
|
|
1789
|
-
children: [/* @__PURE__ */
|
|
1810
|
+
children: [/* @__PURE__ */ v("span", { className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-[#065f46] bg-[#34d399]" }), e("healthybowl.fieldMapPage.beds.savedCount", "Saved ({{count}} beds)", { count: String(Y.length) })]
|
|
1790
1811
|
}),
|
|
1791
|
-
|
|
1812
|
+
Tr && Y.length === 0 && /* @__PURE__ */ v("p", {
|
|
1792
1813
|
className: "mt-2 text-xs text-text-secondary",
|
|
1793
1814
|
children: e("healthybowl.fieldMapPage.beds.loadingSaved", "Loading saved beds…")
|
|
1794
1815
|
}),
|
|
1795
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ y("div", {
|
|
1796
1817
|
className: "mt-3 flex gap-2",
|
|
1797
|
-
children: [/* @__PURE__ */ b
|
|
1818
|
+
children: [/* @__PURE__ */ y(b, {
|
|
1798
1819
|
size: "sm",
|
|
1799
1820
|
className: "flex-1",
|
|
1800
|
-
onClick:
|
|
1801
|
-
disabled: !
|
|
1821
|
+
onClick: Mr,
|
|
1822
|
+
disabled: !J || J.beds.length === 0 || dn,
|
|
1802
1823
|
children: [
|
|
1803
|
-
/* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ v(Ae, { className: "h-4 w-4" }),
|
|
1804
1825
|
" ",
|
|
1805
|
-
|
|
1826
|
+
dn ? e("healthybowl.fieldMapPage.beds.saving", "Saving…") : Y.length > 0 ? e("healthybowl.fieldMapPage.beds.resave", "Save layout (replace)") : e("healthybowl.fieldMapPage.beds.save", "Save layout")
|
|
1806
1827
|
]
|
|
1807
|
-
}),
|
|
1828
|
+
}), Y.length > 0 && /* @__PURE__ */ y(b, {
|
|
1808
1829
|
variant: "outline",
|
|
1809
1830
|
size: "sm",
|
|
1810
|
-
onClick:
|
|
1811
|
-
disabled:
|
|
1831
|
+
onClick: Nr,
|
|
1832
|
+
disabled: pn,
|
|
1812
1833
|
children: [
|
|
1813
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ v(Fe, { className: "h-4 w-4" }),
|
|
1814
1835
|
" ",
|
|
1815
|
-
|
|
1836
|
+
pn ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
|
|
1816
1837
|
]
|
|
1817
1838
|
})]
|
|
1818
1839
|
}),
|
|
1819
|
-
|
|
1840
|
+
J && J.bedCount > nt && /* @__PURE__ */ v("p", {
|
|
1820
1841
|
className: "mt-2 text-xs text-warning",
|
|
1821
|
-
children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(
|
|
1842
|
+
children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(nt) })
|
|
1822
1843
|
})
|
|
1823
1844
|
]
|
|
1824
1845
|
})
|
|
1825
1846
|
]
|
|
1826
1847
|
})]
|
|
1827
1848
|
}),
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
open:
|
|
1830
|
-
onClose: () =>
|
|
1849
|
+
/* @__PURE__ */ v(ne, {
|
|
1850
|
+
open: B !== null,
|
|
1851
|
+
onClose: () => Rn(null),
|
|
1831
1852
|
title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
|
|
1832
1853
|
description: e("healthybowl.fieldMapPage.create.description", "Name the field you just drew. Its area is auto-calculated."),
|
|
1833
|
-
footer: /* @__PURE__ */
|
|
1854
|
+
footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
|
|
1834
1855
|
variant: "outline",
|
|
1835
|
-
onClick: () =>
|
|
1856
|
+
onClick: () => Rn(null),
|
|
1836
1857
|
className: "text-text-secondary",
|
|
1837
1858
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
1838
|
-
}), /* @__PURE__ */
|
|
1839
|
-
onClick:
|
|
1840
|
-
disabled:
|
|
1841
|
-
children:
|
|
1859
|
+
}), /* @__PURE__ */ v(b, {
|
|
1860
|
+
onClick: ii,
|
|
1861
|
+
disabled: zn,
|
|
1862
|
+
children: zn ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
|
|
1842
1863
|
})] }),
|
|
1843
|
-
children: /* @__PURE__ */
|
|
1864
|
+
children: /* @__PURE__ */ y("div", {
|
|
1844
1865
|
className: "space-y-4",
|
|
1845
1866
|
children: [
|
|
1846
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ v("div", {
|
|
1847
1868
|
className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
|
|
1848
|
-
children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(
|
|
1869
|
+
children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(B?.area ?? 0) })
|
|
1849
1870
|
}),
|
|
1850
|
-
/* @__PURE__ */
|
|
1871
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1851
1872
|
className: "text-sm font-medium text-text-primary",
|
|
1852
1873
|
children: e("healthybowl.fieldMapPage.create.name", "Field name *")
|
|
1853
|
-
}), /* @__PURE__ */
|
|
1874
|
+
}), /* @__PURE__ */ v("input", {
|
|
1854
1875
|
type: "text",
|
|
1855
|
-
value:
|
|
1856
|
-
onChange: (e) =>
|
|
1876
|
+
value: Vn,
|
|
1877
|
+
onChange: (e) => Hn(e.target.value),
|
|
1857
1878
|
placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
|
|
1858
1879
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1859
1880
|
})] }),
|
|
1860
|
-
/* @__PURE__ */
|
|
1881
|
+
/* @__PURE__ */ y("div", {
|
|
1861
1882
|
className: "grid grid-cols-2 gap-3",
|
|
1862
|
-
children: [/* @__PURE__ */
|
|
1883
|
+
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1863
1884
|
className: "text-sm font-medium text-text-primary",
|
|
1864
1885
|
children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
|
|
1865
|
-
}), /* @__PURE__ */
|
|
1866
|
-
value:
|
|
1867
|
-
onValueChange:
|
|
1868
|
-
children: [/* @__PURE__ */
|
|
1886
|
+
}), /* @__PURE__ */ y(Ve, {
|
|
1887
|
+
value: Un,
|
|
1888
|
+
onValueChange: Wn,
|
|
1889
|
+
children: [/* @__PURE__ */ v(Ue, {
|
|
1869
1890
|
className: "mt-1 w-full",
|
|
1870
|
-
children: /* @__PURE__ */
|
|
1871
|
-
}), /* @__PURE__ */
|
|
1891
|
+
children: /* @__PURE__ */ v(We, {})
|
|
1892
|
+
}), /* @__PURE__ */ v(He, { children: ue.map((t) => /* @__PURE__ */ v(x, {
|
|
1872
1893
|
value: t.label,
|
|
1873
1894
|
children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
|
|
1874
1895
|
}, t.key)) })]
|
|
1875
|
-
})] }), /* @__PURE__ */
|
|
1896
|
+
})] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1876
1897
|
className: "text-sm font-medium text-text-primary",
|
|
1877
1898
|
children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
|
|
1878
|
-
}), /* @__PURE__ */
|
|
1879
|
-
value:
|
|
1880
|
-
onValueChange:
|
|
1881
|
-
children: [/* @__PURE__ */
|
|
1899
|
+
}), /* @__PURE__ */ y(Ve, {
|
|
1900
|
+
value: Gn,
|
|
1901
|
+
onValueChange: Kn,
|
|
1902
|
+
children: [/* @__PURE__ */ v(Ue, {
|
|
1882
1903
|
className: "mt-1 w-full",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
1884
|
-
}), /* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1904
|
+
children: /* @__PURE__ */ v(We, {})
|
|
1905
|
+
}), /* @__PURE__ */ y(He, { children: [
|
|
1906
|
+
/* @__PURE__ */ v(x, {
|
|
1886
1907
|
value: "Drip",
|
|
1887
1908
|
children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
|
|
1888
1909
|
}),
|
|
1889
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ v(x, {
|
|
1890
1911
|
value: "Sprinkler",
|
|
1891
1912
|
children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
|
|
1892
1913
|
}),
|
|
1893
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ v(x, {
|
|
1894
1915
|
value: "Flood",
|
|
1895
1916
|
children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
|
|
1896
1917
|
}),
|
|
1897
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ v(x, {
|
|
1898
1919
|
value: "Rainfed",
|
|
1899
1920
|
children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
|
|
1900
1921
|
}),
|
|
1901
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ v(x, {
|
|
1902
1923
|
value: "None",
|
|
1903
1924
|
children: e("healthybowl.fieldMapPage.irrigation.none", "None")
|
|
1904
1925
|
})
|
|
1905
1926
|
] })]
|
|
1906
1927
|
})] })]
|
|
1907
1928
|
}),
|
|
1908
|
-
/* @__PURE__ */
|
|
1929
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1909
1930
|
className: "text-sm font-medium text-text-primary",
|
|
1910
1931
|
children: e("healthybowl.fieldMapPage.create.status", "Status")
|
|
1911
|
-
}), /* @__PURE__ */
|
|
1912
|
-
value:
|
|
1913
|
-
onValueChange:
|
|
1914
|
-
children: [/* @__PURE__ */
|
|
1932
|
+
}), /* @__PURE__ */ y(Ve, {
|
|
1933
|
+
value: qn,
|
|
1934
|
+
onValueChange: Jn,
|
|
1935
|
+
children: [/* @__PURE__ */ v(Ue, {
|
|
1915
1936
|
className: "mt-1 w-full",
|
|
1916
|
-
children: /* @__PURE__ */
|
|
1917
|
-
}), /* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1937
|
+
children: /* @__PURE__ */ v(We, {})
|
|
1938
|
+
}), /* @__PURE__ */ y(He, { children: [
|
|
1939
|
+
/* @__PURE__ */ v(x, {
|
|
1919
1940
|
value: "active",
|
|
1920
1941
|
children: e("healthybowl.fieldMapPage.status.active", "Active")
|
|
1921
1942
|
}),
|
|
1922
|
-
/* @__PURE__ */
|
|
1943
|
+
/* @__PURE__ */ v(x, {
|
|
1923
1944
|
value: "preparation",
|
|
1924
1945
|
children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
|
|
1925
1946
|
}),
|
|
1926
|
-
/* @__PURE__ */
|
|
1947
|
+
/* @__PURE__ */ v(x, {
|
|
1927
1948
|
value: "fallow",
|
|
1928
1949
|
children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
|
|
1929
1950
|
})
|
|
@@ -1932,39 +1953,39 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
1932
1953
|
]
|
|
1933
1954
|
})
|
|
1934
1955
|
}),
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
open:
|
|
1937
|
-
onClose: () =>
|
|
1938
|
-
title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed:
|
|
1956
|
+
/* @__PURE__ */ v(ne, {
|
|
1957
|
+
open: L !== null,
|
|
1958
|
+
onClose: () => hn(null),
|
|
1959
|
+
title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed: L?.name ?? "" }),
|
|
1939
1960
|
description: e("healthybowl.fieldMapPage.beds.assign.description", "Pick a crop for this bed. Its plant count is recomputed from the crop's spacing."),
|
|
1940
|
-
footer: /* @__PURE__ */
|
|
1961
|
+
footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
|
|
1941
1962
|
variant: "outline",
|
|
1942
|
-
onClick: () =>
|
|
1963
|
+
onClick: () => hn(null),
|
|
1943
1964
|
className: "text-text-secondary",
|
|
1944
1965
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
1945
|
-
}), /* @__PURE__ */
|
|
1946
|
-
onClick:
|
|
1947
|
-
disabled:
|
|
1948
|
-
children:
|
|
1966
|
+
}), /* @__PURE__ */ v(b, {
|
|
1967
|
+
onClick: Pr,
|
|
1968
|
+
disabled: vn,
|
|
1969
|
+
children: vn ? e("healthybowl.fieldMapPage.beds.assign.saving", "Saving…") : e("healthybowl.fieldMapPage.beds.assign.action", "Assign")
|
|
1949
1970
|
})] }),
|
|
1950
|
-
children: /* @__PURE__ */
|
|
1971
|
+
children: /* @__PURE__ */ y("div", {
|
|
1951
1972
|
className: "space-y-3",
|
|
1952
|
-
children: [/* @__PURE__ */
|
|
1973
|
+
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
1953
1974
|
className: "text-sm font-medium text-text-primary",
|
|
1954
1975
|
children: e("healthybowl.fieldMapPage.beds.assign.crop", "Crop")
|
|
1955
|
-
}), /* @__PURE__ */
|
|
1956
|
-
value:
|
|
1957
|
-
onValueChange:
|
|
1958
|
-
children: [/* @__PURE__ */
|
|
1976
|
+
}), /* @__PURE__ */ y(Ve, {
|
|
1977
|
+
value: gn,
|
|
1978
|
+
onValueChange: _n,
|
|
1979
|
+
children: [/* @__PURE__ */ v(Ue, {
|
|
1959
1980
|
className: "mt-1 w-full",
|
|
1960
|
-
children: /* @__PURE__ */
|
|
1961
|
-
}), /* @__PURE__ */
|
|
1981
|
+
children: /* @__PURE__ */ v(We, { placeholder: e("healthybowl.fieldMapPage.beds.assign.none", "No crop") })
|
|
1982
|
+
}), /* @__PURE__ */ v(He, { children: g.map((e) => /* @__PURE__ */ v(x, {
|
|
1962
1983
|
value: e.id,
|
|
1963
1984
|
children: e.name
|
|
1964
1985
|
}, e.id)) })]
|
|
1965
1986
|
})] }), (() => {
|
|
1966
|
-
let t =
|
|
1967
|
-
return /* @__PURE__ */
|
|
1987
|
+
let t = be(g.find((e) => e.id === gn) ?? null), n = L ? ae(L.boundary) : null, r = he(L?.area ?? (n ? c(n) : 0), L?.widthM ?? F, t.plantSpacingCm, t.rowSpacingCm);
|
|
1988
|
+
return /* @__PURE__ */ v("div", {
|
|
1968
1989
|
className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
|
|
1969
1990
|
children: e("healthybowl.fieldMapPage.beds.assign.preview", "{{preset}} · {{plant}}×{{row}} cm · ~{{plants}} plants", {
|
|
1970
1991
|
preset: t.label,
|
|
@@ -1976,47 +1997,47 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
1976
1997
|
})()]
|
|
1977
1998
|
})
|
|
1978
1999
|
}),
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
open:
|
|
1981
|
-
onClose: () =>
|
|
2000
|
+
/* @__PURE__ */ v(ne, {
|
|
2001
|
+
open: R !== null,
|
|
2002
|
+
onClose: () => On(null),
|
|
1982
2003
|
title: e("healthybowl.fieldMapPage.elements.save.title", "Save map element"),
|
|
1983
2004
|
description: e("healthybowl.fieldMapPage.elements.save.description", "Name the element you just drew. It will show on the map with its type styling."),
|
|
1984
|
-
footer: /* @__PURE__ */
|
|
2005
|
+
footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
|
|
1985
2006
|
variant: "outline",
|
|
1986
|
-
onClick: () =>
|
|
2007
|
+
onClick: () => On(null),
|
|
1987
2008
|
className: "text-text-secondary",
|
|
1988
2009
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
1989
|
-
}), /* @__PURE__ */
|
|
1990
|
-
onClick:
|
|
1991
|
-
disabled:
|
|
1992
|
-
children:
|
|
2010
|
+
}), /* @__PURE__ */ v(b, {
|
|
2011
|
+
onClick: ai,
|
|
2012
|
+
disabled: Nn,
|
|
2013
|
+
children: Nn ? e("healthybowl.fieldMapPage.elements.save.saving", "Saving…") : e("healthybowl.fieldMapPage.elements.save.action", "Save element")
|
|
1993
2014
|
})] }),
|
|
1994
|
-
children: /* @__PURE__ */
|
|
2015
|
+
children: /* @__PURE__ */ y("div", {
|
|
1995
2016
|
className: "space-y-4",
|
|
1996
2017
|
children: [
|
|
1997
|
-
|
|
2018
|
+
si && /* @__PURE__ */ y("div", {
|
|
1998
2019
|
className: "flex items-center gap-2 rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
|
|
1999
|
-
children: [/* @__PURE__ */
|
|
2020
|
+
children: [/* @__PURE__ */ v(si.icon, {
|
|
2000
2021
|
className: "h-4 w-4 shrink-0",
|
|
2001
|
-
style: { color:
|
|
2002
|
-
}), e("healthybowl.fieldMapPage.elements.save.typeLine", "Type: {{type}}", { type: e(
|
|
2022
|
+
style: { color: si.color }
|
|
2023
|
+
}), e("healthybowl.fieldMapPage.elements.save.typeLine", "Type: {{type}}", { type: e(si.labelKey, si.label) })]
|
|
2003
2024
|
}),
|
|
2004
|
-
/* @__PURE__ */
|
|
2025
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
2005
2026
|
className: "text-sm font-medium text-text-primary",
|
|
2006
2027
|
children: e("healthybowl.fieldMapPage.elements.save.name", "Name *")
|
|
2007
|
-
}), /* @__PURE__ */
|
|
2028
|
+
}), /* @__PURE__ */ v("input", {
|
|
2008
2029
|
type: "text",
|
|
2009
|
-
value:
|
|
2010
|
-
onChange: (e) =>
|
|
2030
|
+
value: kn,
|
|
2031
|
+
onChange: (e) => An(e.target.value),
|
|
2011
2032
|
placeholder: e("healthybowl.fieldMapPage.elements.save.namePlaceholder", "e.g., North buffer strip"),
|
|
2012
2033
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
2013
2034
|
})] }),
|
|
2014
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
2015
2036
|
className: "text-sm font-medium text-text-primary",
|
|
2016
2037
|
children: e("healthybowl.fieldMapPage.elements.save.notes", "Notes")
|
|
2017
|
-
}), /* @__PURE__ */
|
|
2018
|
-
value:
|
|
2019
|
-
onChange: (e) =>
|
|
2038
|
+
}), /* @__PURE__ */ v("textarea", {
|
|
2039
|
+
value: jn,
|
|
2040
|
+
onChange: (e) => Mn(e.target.value),
|
|
2020
2041
|
rows: 3,
|
|
2021
2042
|
placeholder: e("healthybowl.fieldMapPage.elements.save.notesPlaceholder", "Optional details…"),
|
|
2022
2043
|
className: "mt-1 w-full resize-y rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
@@ -2024,57 +2045,57 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
2024
2045
|
]
|
|
2025
2046
|
})
|
|
2026
2047
|
}),
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
open:
|
|
2029
|
-
onClose: () =>
|
|
2030
|
-
title:
|
|
2031
|
-
description: $ ? e($.labelKey, $.label) :
|
|
2032
|
-
footer: /* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ v(ne, {
|
|
2049
|
+
open: z !== null,
|
|
2050
|
+
onClose: () => Fn(null),
|
|
2051
|
+
title: z?.name ?? e("healthybowl.fieldMapPage.elements.detail.title", "Map element"),
|
|
2052
|
+
description: $ ? e($.labelKey, $.label) : z?.type ?? "",
|
|
2053
|
+
footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
|
|
2033
2054
|
variant: "outline",
|
|
2034
|
-
onClick: () =>
|
|
2055
|
+
onClick: () => Fn(null),
|
|
2035
2056
|
className: "text-text-secondary",
|
|
2036
2057
|
children: e("healthybowl.common.close", "Close")
|
|
2037
|
-
}), /* @__PURE__ */ b
|
|
2058
|
+
}), /* @__PURE__ */ y(b, {
|
|
2038
2059
|
variant: "destructive",
|
|
2039
|
-
onClick:
|
|
2040
|
-
disabled:
|
|
2060
|
+
onClick: oi,
|
|
2061
|
+
disabled: In,
|
|
2041
2062
|
children: [
|
|
2042
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ v(Fe, { className: "h-4 w-4" }),
|
|
2043
2064
|
" ",
|
|
2044
|
-
|
|
2065
|
+
In ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
|
|
2045
2066
|
]
|
|
2046
2067
|
})] }),
|
|
2047
|
-
children: /* @__PURE__ */
|
|
2068
|
+
children: /* @__PURE__ */ y("div", {
|
|
2048
2069
|
className: "space-y-3 text-sm",
|
|
2049
|
-
children: [/* @__PURE__ */
|
|
2070
|
+
children: [/* @__PURE__ */ y("div", {
|
|
2050
2071
|
className: "flex justify-between gap-3",
|
|
2051
|
-
children: [/* @__PURE__ */
|
|
2072
|
+
children: [/* @__PURE__ */ v("span", {
|
|
2052
2073
|
className: "text-text-secondary",
|
|
2053
2074
|
children: e("healthybowl.fieldMapPage.elements.detail.type", "Type")
|
|
2054
|
-
}), /* @__PURE__ */
|
|
2075
|
+
}), /* @__PURE__ */ y("span", {
|
|
2055
2076
|
className: "flex items-center gap-1.5 font-medium text-text-primary",
|
|
2056
|
-
children: [$ && /* @__PURE__ */
|
|
2077
|
+
children: [$ && /* @__PURE__ */ v($.icon, {
|
|
2057
2078
|
className: "h-4 w-4",
|
|
2058
2079
|
style: { color: $.color }
|
|
2059
|
-
}), $ ? e($.labelKey, $.label) :
|
|
2080
|
+
}), $ ? e($.labelKey, $.label) : z?.type]
|
|
2060
2081
|
})]
|
|
2061
|
-
}),
|
|
2082
|
+
}), z?.notes && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("span", {
|
|
2062
2083
|
className: "text-text-secondary",
|
|
2063
2084
|
children: e("healthybowl.fieldMapPage.elements.detail.notes", "Notes")
|
|
2064
|
-
}), /* @__PURE__ */
|
|
2085
|
+
}), /* @__PURE__ */ v("p", {
|
|
2065
2086
|
className: "mt-1 whitespace-pre-wrap text-text-primary",
|
|
2066
|
-
children:
|
|
2087
|
+
children: z.notes
|
|
2067
2088
|
})] })]
|
|
2068
2089
|
})
|
|
2069
2090
|
}),
|
|
2070
|
-
/* @__PURE__ */
|
|
2071
|
-
toasts:
|
|
2072
|
-
onDismiss:
|
|
2091
|
+
/* @__PURE__ */ v(ee, {
|
|
2092
|
+
toasts: dt,
|
|
2093
|
+
onDismiss: Ct
|
|
2073
2094
|
})
|
|
2074
2095
|
]
|
|
2075
2096
|
});
|
|
2076
2097
|
};
|
|
2077
2098
|
//#endregion
|
|
2078
|
-
export {
|
|
2099
|
+
export { Ct as FieldMapPage };
|
|
2079
2100
|
|
|
2080
2101
|
//# sourceMappingURL=FieldMapPage.js.map
|