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