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