@burdenoff/microfe-healthybowl 2026.710.10 → 2026.710.11
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.
|
@@ -5,24 +5,24 @@ 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
7
|
import { useConfirm as o } from "../../components/ConfirmDialog.js";
|
|
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
|
|
8
|
+
import { Modal as ee } from "../../components/Modal.js";
|
|
9
|
+
import { require_leaflet_src as s } from "../../../node_modules/leaflet/dist/leaflet-src.js";
|
|
10
|
+
import { useToast as te } from "../../hooks/useToast.js";
|
|
11
|
+
import { ensureLeafletCss as ne } from "../../utils/leaflet.js";
|
|
12
|
+
import { extractPolygon as re, isValidPolygon as c, polygonAreaInUnit as l, polygonAreaSqMeters as ie, polygonCentroid as ae, ringToPolygon as u } from "../../utils/geo.js";
|
|
13
|
+
import { SOIL_PALETTE as oe, soilColor as se, soilLegendFor as ce } from "../../utils/soil.js";
|
|
14
14
|
import "../../utils/index.js";
|
|
15
15
|
import "../../components/index.js";
|
|
16
|
-
import { useHealthyBowlData as
|
|
17
|
-
import { useCallback as
|
|
18
|
-
import { useI18n as
|
|
19
|
-
import { Check as
|
|
20
|
-
import { Fragment as
|
|
21
|
-
import { Button as
|
|
22
|
-
import { gql as
|
|
23
|
-
import { useMutation as
|
|
16
|
+
import { useHealthyBowlData as le } from "../../hooks/useHealthyBowlData.js";
|
|
17
|
+
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
18
|
+
import { useI18n as ue } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
19
|
+
import { Check as de, Layers as fe, LocateFixed as pe, MapPinned as me, Pencil as he, Plus as ge, Ruler as _e, Save as ve, Search as ye, Spline as be, Trash2 as xe, X as Se } from "lucide-react";
|
|
20
|
+
import { Fragment as Ce, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
21
|
+
import { Button as v, Select as we, SelectContent as Te, SelectItem as y, SelectTrigger as Ee, SelectValue as De } from "@burdenoff/fe-libs/ui";
|
|
22
|
+
import { gql as Oe } from "@apollo/client";
|
|
23
|
+
import { useMutation as ke } from "@apollo/client/react";
|
|
24
24
|
//#region src/healthybowl/pages/fields/FieldMapPage.tsx
|
|
25
|
-
var
|
|
25
|
+
var b = /* @__PURE__ */ e(s(), 1), Ae = Oe`
|
|
26
26
|
mutation UpdateHealthyBowlFieldBoundaryOnMapPage($input: UpdateHealthyBowlFieldInput!) {
|
|
27
27
|
updateHealthyBowlField(input: $input) {
|
|
28
28
|
id
|
|
@@ -31,48 +31,48 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
31
31
|
location
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`, je = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", Me = "Esri, Maxar, Earthstar Geographics", Ne = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", Pe = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", Fe = 21, Ie = 16, Le = 2.47105, Re = "#16a34a", ze = {
|
|
35
35
|
color: "#f59e0b",
|
|
36
36
|
weight: 2,
|
|
37
37
|
dashArray: "6 4",
|
|
38
38
|
fillColor: "#f59e0b",
|
|
39
39
|
fillOpacity: .15
|
|
40
|
-
},
|
|
40
|
+
}, Be = {
|
|
41
41
|
color: "#ffffff",
|
|
42
42
|
weight: 2,
|
|
43
43
|
dashArray: "6 4",
|
|
44
44
|
fillColor: "#22c55e",
|
|
45
45
|
fillOpacity: .2
|
|
46
|
-
},
|
|
46
|
+
}, Ve = {
|
|
47
47
|
color: "#38bdf8",
|
|
48
48
|
weight: 3,
|
|
49
49
|
dashArray: "6 6"
|
|
50
|
-
},
|
|
51
|
-
let t =
|
|
52
|
-
return t &&
|
|
53
|
-
},
|
|
50
|
+
}, He = (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)), Ue = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), We = (e) => Ue(e.unit) ? e.area * Le : e.area, Ge = (e) => `${e.area.toFixed(1)} ${Ue(e.unit) ? "ha" : "ac"}`, x = (e) => {
|
|
51
|
+
let t = re(e.boundary);
|
|
52
|
+
return t && c(t) ? t : null;
|
|
53
|
+
}, Ke = b.default.divIcon({
|
|
54
54
|
className: "",
|
|
55
55
|
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>",
|
|
56
56
|
iconSize: [16, 16],
|
|
57
57
|
iconAnchor: [8, 8]
|
|
58
|
-
}),
|
|
59
|
-
let { t: e } =
|
|
60
|
-
|
|
61
|
-
q.current =
|
|
62
|
-
}, [
|
|
63
|
-
let
|
|
64
|
-
let e =
|
|
65
|
-
return e ?
|
|
66
|
-
}, [
|
|
58
|
+
}), S = () => {
|
|
59
|
+
let { t: e } = ue(), { workspaceId: s } = n(), re = o(), { fields: c, crops: Oe, loadings: Le, errors: Ue, refetch: S, createField: qe } = le(), { toasts: Je, toast: C, dismiss: Ye } = te(), [w] = ke(Ae), [T, Xe] = h("loading"), [E, D] = h("view"), [O, k] = h(null), [A, Ze] = h(!1), [j, Qe] = h(!0), [M, $e] = h(""), [N, et] = h(""), [tt, nt] = h(!1), [rt, it] = h(0), [at, P] = h(null), [ot, st] = h(!1), [ct, lt] = h(!1), [F, ut] = h(null), [I, L] = h(null), [dt, ft] = h(!1), [R, pt] = h(""), [mt, ht] = h("Clay loam"), [gt, _t] = h("Drip"), [vt, yt] = h("active"), bt = m(null), z = m(null), xt = m(null), St = m(null), Ct = m(null), B = m(null), V = m(null), H = m(null), U = m([]), W = m(null), G = m([]), K = m(null), wt = m([]), q = m("view"), Tt = m(!1);
|
|
60
|
+
f(() => {
|
|
61
|
+
q.current = E;
|
|
62
|
+
}, [E]);
|
|
63
|
+
let Et = p(() => c.filter((e) => x(e) !== null).length, [c]), Dt = p(() => c.reduce((e, t) => e + We(t), 0), [c]), Ot = p(() => ce(c.map((e) => e.soilType)), [c]), J = p(() => c.find((e) => e.id === O) ?? null, [c, O]), kt = p(() => {
|
|
64
|
+
let e = M.trim().toLowerCase();
|
|
65
|
+
return e ? c.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : c;
|
|
66
|
+
}, [c, M]), At = d((e) => {
|
|
67
67
|
if (!e) return "";
|
|
68
|
-
let t =
|
|
68
|
+
let t = Oe.find((t) => t.field === e.id || t.fieldName === e.name);
|
|
69
69
|
return t ? t.name : (e.crops ?? []).join(", ");
|
|
70
|
-
}, [
|
|
70
|
+
}, [Oe]), jt = d((e) => {
|
|
71
71
|
let t = z.current;
|
|
72
72
|
if (!t) return;
|
|
73
|
-
let n =
|
|
73
|
+
let n = x(e);
|
|
74
74
|
if (n) try {
|
|
75
|
-
let e =
|
|
75
|
+
let e = b.default.geoJSON(n).getBounds();
|
|
76
76
|
if (e.isValid()) {
|
|
77
77
|
t.fitBounds(e, {
|
|
78
78
|
padding: [40, 40],
|
|
@@ -81,25 +81,29 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
} catch {}
|
|
84
|
-
|
|
85
|
-
}, []),
|
|
86
|
-
q.current === "draw" || q.current === "measure" || (
|
|
87
|
-
}, [
|
|
88
|
-
|
|
84
|
+
He(e.location) && t.flyTo([e.location.lat, e.location.lng], Ie, { duration: .6 });
|
|
85
|
+
}, []), Mt = d((e) => {
|
|
86
|
+
q.current === "draw" || q.current === "measure" || (k(e.id), jt(e));
|
|
87
|
+
}, [jt]);
|
|
88
|
+
f(() => {
|
|
89
|
+
O && document.querySelector(`[data-field-id="${O}"]`)?.scrollIntoView({ block: "nearest" });
|
|
90
|
+
}, [O]);
|
|
91
|
+
let Y = d(() => {
|
|
92
|
+
let t = z.current, n = Ct.current;
|
|
89
93
|
if (!t || !n) return;
|
|
90
94
|
n.clearLayers();
|
|
91
95
|
let r = [];
|
|
92
|
-
for (let t of
|
|
93
|
-
if (
|
|
94
|
-
let i = t.id ===
|
|
95
|
-
if (
|
|
96
|
-
let e =
|
|
96
|
+
for (let t of c) {
|
|
97
|
+
if (E === "edit" && t.id === O) continue;
|
|
98
|
+
let i = t.id === O, a = j ? se(t.soilType) : Re, o = `${t.name} — ${Ge(t)}`, ee = x(t);
|
|
99
|
+
if (ee) {
|
|
100
|
+
let e = b.default.geoJSON(ee, { style: () => ({
|
|
97
101
|
color: i ? "#ffffff" : a,
|
|
98
102
|
weight: i ? 4 : 2,
|
|
99
103
|
fillColor: a,
|
|
100
104
|
fillOpacity: i ? .5 : .3
|
|
101
105
|
}) });
|
|
102
|
-
e.on("click", () =>
|
|
106
|
+
e.on("click", () => k(t.id)), e.bindTooltip(o, {
|
|
103
107
|
permanent: !0,
|
|
104
108
|
direction: "center",
|
|
105
109
|
className: "hb-field-label"
|
|
@@ -108,90 +112,90 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
108
112
|
let t = e.getBounds();
|
|
109
113
|
t.isValid() && r.push(t);
|
|
110
114
|
} catch {}
|
|
111
|
-
} else if (
|
|
112
|
-
let o =
|
|
115
|
+
} else if (He(t.location)) {
|
|
116
|
+
let o = b.default.circleMarker([t.location.lat, t.location.lng], {
|
|
113
117
|
radius: i ? 9 : 7,
|
|
114
118
|
color: i ? "#ffffff" : "#fff",
|
|
115
119
|
weight: i ? 3 : 2,
|
|
116
120
|
fillColor: a,
|
|
117
121
|
fillOpacity: 1
|
|
118
122
|
});
|
|
119
|
-
o.on("click", () =>
|
|
123
|
+
o.on("click", () => k(t.id)), o.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
|
|
120
124
|
permanent: !1,
|
|
121
125
|
direction: "top"
|
|
122
|
-
}), o.addTo(n), r.push(
|
|
126
|
+
}), o.addTo(n), r.push(b.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
|
-
if (!
|
|
126
|
-
let e = r.reduce((e, t) => e.extend(t),
|
|
129
|
+
if (!Tt.current && r.length > 0) {
|
|
130
|
+
let e = r.reduce((e, t) => e.extend(t), b.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
|
|
127
131
|
try {
|
|
128
132
|
t.fitBounds(e, {
|
|
129
133
|
padding: [40, 40],
|
|
130
134
|
maxZoom: 17
|
|
131
|
-
}),
|
|
135
|
+
}), Tt.current = !0;
|
|
132
136
|
} catch {}
|
|
133
137
|
}
|
|
134
138
|
}, [
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
c,
|
|
140
|
+
E,
|
|
141
|
+
O,
|
|
137
142
|
j,
|
|
138
|
-
P,
|
|
139
143
|
e
|
|
140
144
|
]);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, [Y,
|
|
144
|
-
let X =
|
|
145
|
-
B.current?.clearLayers(), W.current = null, U.current = [],
|
|
146
|
-
}, []),
|
|
145
|
+
f(() => {
|
|
146
|
+
T === "ready" && Y();
|
|
147
|
+
}, [Y, T]);
|
|
148
|
+
let X = d(() => {
|
|
149
|
+
B.current?.clearLayers(), W.current = null, U.current = [], it(0);
|
|
150
|
+
}, []), Nt = d(() => {
|
|
147
151
|
let e = B.current;
|
|
148
152
|
if (!e) return;
|
|
149
153
|
W.current &&= (e.removeLayer(W.current), null);
|
|
150
154
|
let t = U.current;
|
|
151
|
-
t.length >= 2 && (W.current =
|
|
152
|
-
}, []),
|
|
155
|
+
t.length >= 2 && (W.current = b.default.polygon(t, ze).addTo(e));
|
|
156
|
+
}, []), Pt = d(() => {
|
|
153
157
|
let t = U.current;
|
|
154
158
|
if (t.length < 3) {
|
|
155
|
-
|
|
159
|
+
C({
|
|
156
160
|
title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
|
|
157
161
|
description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
|
|
158
162
|
variant: "warning"
|
|
159
163
|
});
|
|
160
164
|
return;
|
|
161
165
|
}
|
|
162
|
-
let n =
|
|
166
|
+
let n = u(t.map((e) => ({
|
|
163
167
|
lat: e.lat,
|
|
164
168
|
lng: e.lng
|
|
165
169
|
})));
|
|
166
|
-
X(), q.current = "view",
|
|
170
|
+
X(), q.current = "view", D("view"), n && (L({
|
|
167
171
|
boundary: n,
|
|
168
|
-
area:
|
|
169
|
-
centroid:
|
|
170
|
-
}),
|
|
172
|
+
area: l(n, "acres"),
|
|
173
|
+
centroid: ae(n) ?? [0, 0]
|
|
174
|
+
}), pt(""), ht("Clay loam"), _t("Drip"), yt("active"));
|
|
171
175
|
}, [
|
|
172
176
|
X,
|
|
173
177
|
e,
|
|
174
|
-
|
|
175
|
-
]),
|
|
176
|
-
|
|
177
|
-
}, [X]),
|
|
178
|
-
X(), q.current = "view",
|
|
179
|
-
}, [X]), Z =
|
|
180
|
-
V.current?.clearLayers(), K.current = null, G.current = [],
|
|
181
|
-
}, []),
|
|
178
|
+
C
|
|
179
|
+
]), Ft = d(() => {
|
|
180
|
+
k(null), X(), q.current = "draw", D("draw");
|
|
181
|
+
}, [X]), It = d(() => {
|
|
182
|
+
X(), q.current = "view", D("view");
|
|
183
|
+
}, [X]), Z = d(() => {
|
|
184
|
+
V.current?.clearLayers(), K.current = null, G.current = [], P(null), st(!1);
|
|
185
|
+
}, []), Lt = d(() => {
|
|
182
186
|
if (!V.current || !K.current) return;
|
|
183
187
|
K.current.setLatLngs(G.current);
|
|
184
|
-
let e =
|
|
188
|
+
let e = u(G.current.map((e) => ({
|
|
185
189
|
lat: e.lat,
|
|
186
190
|
lng: e.lng
|
|
187
191
|
})));
|
|
188
|
-
e &&
|
|
189
|
-
}, [J]),
|
|
192
|
+
e && P(l(e, J?.unit ?? "acres"));
|
|
193
|
+
}, [J]), Rt = d(() => {
|
|
190
194
|
let t = z.current, n = V.current;
|
|
191
195
|
if (!t || !n || !J) return;
|
|
192
|
-
let r =
|
|
196
|
+
let r = x(J);
|
|
193
197
|
if (!r) {
|
|
194
|
-
|
|
198
|
+
C({
|
|
195
199
|
title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
|
|
196
200
|
description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
|
|
197
201
|
variant: "warning"
|
|
@@ -199,38 +203,38 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
199
203
|
return;
|
|
200
204
|
}
|
|
201
205
|
n.clearLayers();
|
|
202
|
-
let i = r.coordinates[0].slice(0, -1).map(([e, t]) =>
|
|
203
|
-
G.current = i, K.current =
|
|
204
|
-
|
|
205
|
-
icon:
|
|
206
|
+
let i = r.coordinates[0].slice(0, -1).map(([e, t]) => b.default.latLng(t, e));
|
|
207
|
+
G.current = i, K.current = b.default.polygon(i, Be).addTo(n), i.forEach((e, t) => {
|
|
208
|
+
b.default.marker(i[t], {
|
|
209
|
+
icon: Ke,
|
|
206
210
|
draggable: !0
|
|
207
211
|
}).addTo(n).on("drag", (e) => {
|
|
208
|
-
G.current[t] = e.target.getLatLng(),
|
|
212
|
+
G.current[t] = e.target.getLatLng(), Lt(), st(!0);
|
|
209
213
|
});
|
|
210
|
-
}), q.current = "edit",
|
|
214
|
+
}), q.current = "edit", D("edit"), st(!1), P(l(r, J.unit));
|
|
211
215
|
}, [
|
|
212
|
-
|
|
216
|
+
Lt,
|
|
213
217
|
J,
|
|
214
218
|
e,
|
|
215
|
-
|
|
216
|
-
]),
|
|
217
|
-
Z(), q.current = "view",
|
|
218
|
-
}, [Z, Y]),
|
|
219
|
+
C
|
|
220
|
+
]), zt = d(() => {
|
|
221
|
+
Z(), q.current = "view", D("view"), Y();
|
|
222
|
+
}, [Z, Y]), Bt = d(async () => {
|
|
219
223
|
if (!J) return;
|
|
220
|
-
let t =
|
|
224
|
+
let t = u(G.current.map((e) => ({
|
|
221
225
|
lat: e.lat,
|
|
222
226
|
lng: e.lng
|
|
223
227
|
})));
|
|
224
228
|
if (t) {
|
|
225
|
-
|
|
229
|
+
lt(!0);
|
|
226
230
|
try {
|
|
227
|
-
let n =
|
|
228
|
-
await
|
|
231
|
+
let n = l(t, J.unit);
|
|
232
|
+
await w({ variables: { input: {
|
|
229
233
|
id: J.id,
|
|
230
234
|
boundary: t,
|
|
231
235
|
area: n,
|
|
232
|
-
context: { workspaceId:
|
|
233
|
-
} } }), await
|
|
236
|
+
context: { workspaceId: s }
|
|
237
|
+
} } }), await S(), Z(), q.current = "view", D("view"), C({
|
|
234
238
|
title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
|
|
235
239
|
description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
|
|
236
240
|
area: String(n),
|
|
@@ -239,49 +243,49 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
239
243
|
variant: "success"
|
|
240
244
|
});
|
|
241
245
|
} catch (t) {
|
|
242
|
-
|
|
246
|
+
C({
|
|
243
247
|
title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
|
|
244
248
|
description: String(t),
|
|
245
249
|
variant: "error"
|
|
246
250
|
});
|
|
247
251
|
} finally {
|
|
248
|
-
|
|
252
|
+
lt(!1);
|
|
249
253
|
}
|
|
250
254
|
}
|
|
251
255
|
}, [
|
|
252
256
|
Z,
|
|
253
|
-
|
|
257
|
+
S,
|
|
254
258
|
J,
|
|
255
259
|
e,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
]),
|
|
260
|
+
C,
|
|
261
|
+
w,
|
|
262
|
+
s
|
|
263
|
+
]), Vt = d(async () => {
|
|
260
264
|
if (J) {
|
|
261
|
-
if (!
|
|
262
|
-
|
|
265
|
+
if (!x(J)) {
|
|
266
|
+
C({
|
|
263
267
|
title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
|
|
264
268
|
description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
|
|
265
269
|
variant: "warning"
|
|
266
270
|
});
|
|
267
271
|
return;
|
|
268
272
|
}
|
|
269
|
-
if (await
|
|
273
|
+
if (await re({
|
|
270
274
|
title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
|
|
271
275
|
message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: J.name }),
|
|
272
276
|
okButtonTitle: e("healthybowl.common.delete", "Delete")
|
|
273
277
|
})) try {
|
|
274
|
-
await
|
|
278
|
+
await w({ variables: { input: {
|
|
275
279
|
id: J.id,
|
|
276
280
|
boundary: null,
|
|
277
|
-
context: { workspaceId:
|
|
278
|
-
} } }), await
|
|
281
|
+
context: { workspaceId: s }
|
|
282
|
+
} } }), await S(), C({
|
|
279
283
|
title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
|
|
280
284
|
description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
|
|
281
285
|
variant: "success"
|
|
282
286
|
});
|
|
283
287
|
} catch (t) {
|
|
284
|
-
|
|
288
|
+
C({
|
|
285
289
|
title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
|
|
286
290
|
description: String(t),
|
|
287
291
|
variant: "error"
|
|
@@ -289,54 +293,54 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
289
293
|
}
|
|
290
294
|
}
|
|
291
295
|
}, [
|
|
292
|
-
|
|
293
|
-
|
|
296
|
+
re,
|
|
297
|
+
S,
|
|
294
298
|
J,
|
|
295
299
|
e,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
]), Q =
|
|
300
|
-
H.current?.clearLayers(),
|
|
301
|
-
}, []),
|
|
300
|
+
C,
|
|
301
|
+
w,
|
|
302
|
+
s
|
|
303
|
+
]), Q = d(() => {
|
|
304
|
+
H.current?.clearLayers(), wt.current = [], ut(null);
|
|
305
|
+
}, []), Ht = d(() => {
|
|
302
306
|
let e = H.current;
|
|
303
307
|
if (!e) return;
|
|
304
308
|
e.clearLayers();
|
|
305
|
-
let t =
|
|
309
|
+
let t = wt.current;
|
|
306
310
|
t.forEach((t) => {
|
|
307
|
-
|
|
311
|
+
b.default.circleMarker(t, {
|
|
308
312
|
radius: 4,
|
|
309
313
|
color: "#38bdf8",
|
|
310
314
|
weight: 2,
|
|
311
315
|
fillColor: "#fff",
|
|
312
316
|
fillOpacity: 1
|
|
313
317
|
}).addTo(e);
|
|
314
|
-
}), t.length >= 2 &&
|
|
318
|
+
}), t.length >= 2 && b.default.polyline(t, Ve).addTo(e);
|
|
315
319
|
let n = 0;
|
|
316
320
|
for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
|
|
317
321
|
let r = null;
|
|
318
322
|
if (t.length >= 3) {
|
|
319
|
-
let e =
|
|
323
|
+
let e = u(t.map((e) => ({
|
|
320
324
|
lat: e.lat,
|
|
321
325
|
lng: e.lng
|
|
322
326
|
})));
|
|
323
|
-
e && (r =
|
|
327
|
+
e && (r = ie(e));
|
|
324
328
|
}
|
|
325
|
-
|
|
329
|
+
ut({
|
|
326
330
|
distance: n,
|
|
327
331
|
area: r
|
|
328
332
|
});
|
|
329
|
-
}, []),
|
|
330
|
-
|
|
333
|
+
}, []), Ut = d(() => {
|
|
334
|
+
k(null), Q(), q.current = "measure", D("measure"), ut({
|
|
331
335
|
distance: 0,
|
|
332
336
|
area: null
|
|
333
337
|
});
|
|
334
|
-
}, [Q]),
|
|
335
|
-
Q(), q.current = "view",
|
|
336
|
-
}, [Q]),
|
|
338
|
+
}, [Q]), Wt = d(() => {
|
|
339
|
+
Q(), q.current = "view", D("view");
|
|
340
|
+
}, [Q]), Gt = d((e) => {
|
|
337
341
|
if (z.current) if (q.current === "draw") {
|
|
338
342
|
U.current.push(e.latlng);
|
|
339
|
-
let t = U.current.length === 1, n =
|
|
343
|
+
let t = U.current.length === 1, n = b.default.circleMarker(e.latlng, {
|
|
340
344
|
radius: t ? 7 : 5,
|
|
341
345
|
color: "#fff",
|
|
342
346
|
weight: 2,
|
|
@@ -344,79 +348,79 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
344
348
|
fillOpacity: 1
|
|
345
349
|
}).addTo(B.current);
|
|
346
350
|
t && n.on("click", (e) => {
|
|
347
|
-
|
|
348
|
-
}),
|
|
349
|
-
} else q.current === "measure" && (
|
|
351
|
+
b.default.DomEvent.stopPropagation(e), Pt();
|
|
352
|
+
}), it(U.current.length), Nt();
|
|
353
|
+
} else q.current === "measure" && (wt.current.push(e.latlng), Ht());
|
|
350
354
|
}, [
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
]),
|
|
355
|
+
Pt,
|
|
356
|
+
Ht,
|
|
357
|
+
Nt
|
|
358
|
+
]), Kt = d(async (n) => {
|
|
355
359
|
n.preventDefault();
|
|
356
|
-
let r = z.current, i =
|
|
360
|
+
let r = z.current, i = N.trim();
|
|
357
361
|
if (!r || !i) return;
|
|
358
362
|
let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
|
|
359
363
|
if (a) {
|
|
360
|
-
r.flyTo([Number(a[1]), Number(a[2])],
|
|
364
|
+
r.flyTo([Number(a[1]), Number(a[2])], Ie, { duration: .6 });
|
|
361
365
|
return;
|
|
362
366
|
}
|
|
363
|
-
|
|
367
|
+
nt(!0);
|
|
364
368
|
try {
|
|
365
369
|
let n = await t(i);
|
|
366
370
|
if (!n) {
|
|
367
|
-
|
|
371
|
+
C({
|
|
368
372
|
title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
|
|
369
373
|
description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
|
|
370
374
|
variant: "warning"
|
|
371
375
|
});
|
|
372
376
|
return;
|
|
373
377
|
}
|
|
374
|
-
r.flyTo([n.latitude, n.longitude],
|
|
378
|
+
r.flyTo([n.latitude, n.longitude], Ie, { duration: .6 });
|
|
375
379
|
} catch (t) {
|
|
376
|
-
|
|
380
|
+
C({
|
|
377
381
|
title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
|
|
378
382
|
description: t instanceof Error ? t.message : String(t),
|
|
379
383
|
variant: "error"
|
|
380
384
|
});
|
|
381
385
|
} finally {
|
|
382
|
-
|
|
386
|
+
nt(!1);
|
|
383
387
|
}
|
|
384
388
|
}, [
|
|
385
|
-
|
|
389
|
+
N,
|
|
386
390
|
e,
|
|
387
|
-
|
|
388
|
-
]),
|
|
391
|
+
C
|
|
392
|
+
]), qt = d(async () => {
|
|
389
393
|
if (I) {
|
|
390
394
|
if (!R.trim()) {
|
|
391
|
-
|
|
395
|
+
C({
|
|
392
396
|
title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
|
|
393
397
|
description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
|
|
394
398
|
variant: "warning"
|
|
395
399
|
});
|
|
396
400
|
return;
|
|
397
401
|
}
|
|
398
|
-
|
|
402
|
+
ft(!0);
|
|
399
403
|
try {
|
|
400
|
-
let [t, n] = I.centroid, r = await
|
|
404
|
+
let [t, n] = I.centroid, r = await qe({
|
|
401
405
|
name: R.trim(),
|
|
402
406
|
area: I.area,
|
|
403
407
|
unit: "acres",
|
|
404
|
-
soilType:
|
|
405
|
-
irrigationType:
|
|
408
|
+
soilType: mt,
|
|
409
|
+
irrigationType: gt,
|
|
406
410
|
organicCertified: !1,
|
|
407
|
-
status:
|
|
411
|
+
status: vt,
|
|
408
412
|
crops: [],
|
|
409
413
|
location: {
|
|
410
414
|
lat: t,
|
|
411
415
|
lng: n
|
|
412
416
|
}
|
|
413
417
|
});
|
|
414
|
-
r?.id && await
|
|
418
|
+
r?.id && await w({ variables: { input: {
|
|
415
419
|
id: r.id,
|
|
416
420
|
boundary: I.boundary,
|
|
417
421
|
area: I.area,
|
|
418
|
-
context: { workspaceId:
|
|
419
|
-
} } }), await
|
|
422
|
+
context: { workspaceId: s }
|
|
423
|
+
} } }), await S(), L(null), r?.id && k(r.id), C({
|
|
420
424
|
title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
|
|
421
425
|
description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
|
|
422
426
|
name: R.trim(),
|
|
@@ -425,279 +429,279 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
425
429
|
variant: "success"
|
|
426
430
|
});
|
|
427
431
|
} catch (t) {
|
|
428
|
-
|
|
432
|
+
C({
|
|
429
433
|
title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
|
|
430
434
|
description: String(t),
|
|
431
435
|
variant: "error"
|
|
432
436
|
});
|
|
433
437
|
} finally {
|
|
434
|
-
|
|
438
|
+
ft(!1);
|
|
435
439
|
}
|
|
436
440
|
}
|
|
437
441
|
}, [
|
|
438
|
-
|
|
439
|
-
|
|
442
|
+
qe,
|
|
443
|
+
gt,
|
|
440
444
|
R,
|
|
441
|
-
|
|
442
|
-
|
|
445
|
+
mt,
|
|
446
|
+
vt,
|
|
443
447
|
I,
|
|
444
|
-
|
|
448
|
+
S,
|
|
445
449
|
e,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
450
|
+
C,
|
|
451
|
+
w,
|
|
452
|
+
s
|
|
449
453
|
]);
|
|
450
|
-
|
|
451
|
-
let e =
|
|
454
|
+
f(() => {
|
|
455
|
+
let e = bt.current;
|
|
452
456
|
if (!e) return;
|
|
453
|
-
|
|
454
|
-
let t =
|
|
455
|
-
attribution:
|
|
456
|
-
maxZoom:
|
|
457
|
+
ne();
|
|
458
|
+
let t = b.default.tileLayer(je, {
|
|
459
|
+
attribution: Me,
|
|
460
|
+
maxZoom: Fe,
|
|
457
461
|
maxNativeZoom: 18
|
|
458
|
-
}), n =
|
|
459
|
-
attribution:
|
|
460
|
-
maxZoom:
|
|
462
|
+
}), n = b.default.tileLayer(Ne, {
|
|
463
|
+
attribution: Pe,
|
|
464
|
+
maxZoom: Fe,
|
|
461
465
|
maxNativeZoom: 17,
|
|
462
466
|
opacity: .65
|
|
463
467
|
});
|
|
464
|
-
|
|
465
|
-
let r =
|
|
468
|
+
xt.current = t, St.current = n;
|
|
469
|
+
let r = b.default.map(e, {
|
|
466
470
|
center: [20, 78],
|
|
467
471
|
zoom: 4,
|
|
468
472
|
scrollWheelZoom: !0,
|
|
469
|
-
maxZoom:
|
|
473
|
+
maxZoom: Fe,
|
|
470
474
|
layers: [t]
|
|
471
475
|
});
|
|
472
|
-
return z.current = r,
|
|
473
|
-
r.off("click",
|
|
476
|
+
return z.current = r, Ct.current = b.default.layerGroup().addTo(r), B.current = b.default.layerGroup().addTo(r), V.current = b.default.layerGroup().addTo(r), H.current = b.default.layerGroup().addTo(r), r.on("click", Gt), Xe("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
|
|
477
|
+
r.off("click", Gt), r.remove(), z.current = null, xt.current = null, St.current = null, Ct.current = null, B.current = null, V.current = null, H.current = null;
|
|
474
478
|
};
|
|
475
|
-
}, []),
|
|
476
|
-
let e = z.current, t =
|
|
477
|
-
!e || !t || (
|
|
478
|
-
}, [
|
|
479
|
-
let
|
|
480
|
-
if (
|
|
479
|
+
}, []), f(() => {
|
|
480
|
+
let e = z.current, t = St.current;
|
|
481
|
+
!e || !t || (A ? t.addTo(e) : e.removeLayer(t));
|
|
482
|
+
}, [A]);
|
|
483
|
+
let Jt = !Le.crops && c.length === 0, Yt = F ? F.distance >= 1e3 ? `${(F.distance / 1e3).toFixed(2)} km` : `${F.distance.toFixed(0)} m` : "";
|
|
484
|
+
if (Ue.crops && c.length === 0) return /* @__PURE__ */ g(r, {
|
|
481
485
|
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
482
486
|
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
483
487
|
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
484
|
-
children: /* @__PURE__ */
|
|
488
|
+
children: /* @__PURE__ */ g(i, { onRetry: S })
|
|
485
489
|
});
|
|
486
|
-
let $ = (e, t, n, r) => /* @__PURE__ */
|
|
490
|
+
let $ = (e, t, n, r) => /* @__PURE__ */ _("button", {
|
|
487
491
|
type: "button",
|
|
488
492
|
onClick: t,
|
|
489
493
|
"aria-pressed": e,
|
|
490
494
|
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"}`,
|
|
491
495
|
children: [n, r]
|
|
492
496
|
});
|
|
493
|
-
return /* @__PURE__ */
|
|
497
|
+
return /* @__PURE__ */ _(r, {
|
|
494
498
|
title: e("healthybowl.fieldMapPage.title", "Field Map"),
|
|
495
499
|
titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
|
|
496
500
|
hero: !0,
|
|
497
501
|
description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
|
|
498
502
|
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.",
|
|
499
503
|
children: [
|
|
500
|
-
/* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ _("div", {
|
|
501
505
|
className: "flex flex-col gap-4 lg:flex-row",
|
|
502
|
-
children: [/* @__PURE__ */
|
|
506
|
+
children: [/* @__PURE__ */ _("div", {
|
|
503
507
|
className: "min-w-0 flex-1 space-y-3",
|
|
504
508
|
children: [
|
|
505
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ _("form", {
|
|
506
510
|
className: "flex gap-2",
|
|
507
|
-
onSubmit:
|
|
508
|
-
children: [/* @__PURE__ */
|
|
511
|
+
onSubmit: Kt,
|
|
512
|
+
children: [/* @__PURE__ */ _("div", {
|
|
509
513
|
className: "relative min-w-0 flex-1",
|
|
510
|
-
children: [/* @__PURE__ */
|
|
514
|
+
children: [/* @__PURE__ */ g(ye, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g("input", {
|
|
511
515
|
type: "search",
|
|
512
|
-
value:
|
|
513
|
-
onChange: (e) =>
|
|
516
|
+
value: N,
|
|
517
|
+
onChange: (e) => et(e.target.value),
|
|
514
518
|
placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
|
|
515
519
|
"aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
|
|
516
520
|
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)]"
|
|
517
521
|
})]
|
|
518
|
-
}), /* @__PURE__ */
|
|
522
|
+
}), /* @__PURE__ */ _(v, {
|
|
519
523
|
type: "submit",
|
|
520
524
|
variant: "outline",
|
|
521
525
|
size: "sm",
|
|
522
|
-
disabled:
|
|
526
|
+
disabled: T !== "ready" || tt,
|
|
523
527
|
children: [
|
|
524
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ g(pe, { className: "h-4 w-4" }),
|
|
525
529
|
" ",
|
|
526
|
-
|
|
530
|
+
tt ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
|
|
527
531
|
]
|
|
528
532
|
})]
|
|
529
533
|
}),
|
|
530
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ _("div", {
|
|
531
535
|
className: "relative",
|
|
532
536
|
children: [
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
ref:
|
|
537
|
+
/* @__PURE__ */ g("div", {
|
|
538
|
+
ref: bt,
|
|
535
539
|
className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
|
|
536
540
|
}),
|
|
537
|
-
|
|
541
|
+
T === "ready" && /* @__PURE__ */ _("div", {
|
|
538
542
|
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",
|
|
539
543
|
children: [
|
|
540
|
-
$(
|
|
541
|
-
$(
|
|
542
|
-
$(!1,
|
|
543
|
-
$(
|
|
544
|
+
$(E === "draw", () => E === "draw" ? It() : Ft(), /* @__PURE__ */ g(he, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
|
|
545
|
+
$(E === "edit", () => E === "edit" ? zt() : Rt(), /* @__PURE__ */ g(be, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
|
|
546
|
+
$(!1, Vt, /* @__PURE__ */ g(xe, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
|
|
547
|
+
$(E === "measure", () => E === "measure" ? Wt() : Ut(), /* @__PURE__ */ g(_e, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure"))
|
|
544
548
|
]
|
|
545
549
|
}),
|
|
546
|
-
|
|
550
|
+
E === "draw" && /* @__PURE__ */ _("div", {
|
|
547
551
|
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",
|
|
548
552
|
children: [
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(rt) }) }),
|
|
554
|
+
/* @__PURE__ */ _(v, {
|
|
551
555
|
size: "sm",
|
|
552
556
|
variant: "default",
|
|
553
|
-
onClick:
|
|
557
|
+
onClick: Pt,
|
|
554
558
|
children: [
|
|
555
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ g(de, { className: "h-3.5 w-3.5" }),
|
|
556
560
|
" ",
|
|
557
561
|
e("healthybowl.fieldMapPage.finish", "Finish")
|
|
558
562
|
]
|
|
559
563
|
}),
|
|
560
|
-
/* @__PURE__ */ v
|
|
564
|
+
/* @__PURE__ */ g(v, {
|
|
561
565
|
size: "sm",
|
|
562
566
|
variant: "outline",
|
|
563
|
-
onClick:
|
|
564
|
-
children: /* @__PURE__ */
|
|
567
|
+
onClick: It,
|
|
568
|
+
children: /* @__PURE__ */ g(Se, { className: "h-3.5 w-3.5" })
|
|
565
569
|
})
|
|
566
570
|
]
|
|
567
571
|
}),
|
|
568
|
-
|
|
572
|
+
E === "edit" && /* @__PURE__ */ _("div", {
|
|
569
573
|
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",
|
|
570
574
|
children: [
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
area: String(
|
|
575
|
+
/* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
|
|
576
|
+
area: String(at ?? ""),
|
|
573
577
|
unit: J?.unit ?? "acres"
|
|
574
578
|
}) }),
|
|
575
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ _(v, {
|
|
576
580
|
size: "sm",
|
|
577
581
|
variant: "default",
|
|
578
|
-
onClick:
|
|
579
|
-
disabled: !
|
|
582
|
+
onClick: Bt,
|
|
583
|
+
disabled: !ot || ct,
|
|
580
584
|
children: [
|
|
581
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ g(ve, { className: "h-3.5 w-3.5" }),
|
|
582
586
|
" ",
|
|
583
|
-
|
|
587
|
+
ct ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
|
|
584
588
|
]
|
|
585
589
|
}),
|
|
586
|
-
/* @__PURE__ */ v
|
|
590
|
+
/* @__PURE__ */ g(v, {
|
|
587
591
|
size: "sm",
|
|
588
592
|
variant: "outline",
|
|
589
|
-
onClick:
|
|
590
|
-
children: /* @__PURE__ */
|
|
593
|
+
onClick: zt,
|
|
594
|
+
children: /* @__PURE__ */ g(Se, { className: "h-3.5 w-3.5" })
|
|
591
595
|
})
|
|
592
596
|
]
|
|
593
597
|
}),
|
|
594
|
-
|
|
598
|
+
E === "measure" && F && /* @__PURE__ */ _("div", {
|
|
595
599
|
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",
|
|
596
600
|
children: [
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */ v
|
|
601
|
+
/* @__PURE__ */ _("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: Yt }), F.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (F.area / 4046.8564224).toFixed(2) })}`] }),
|
|
602
|
+
/* @__PURE__ */ g(v, {
|
|
599
603
|
size: "sm",
|
|
600
604
|
variant: "outline",
|
|
601
605
|
onClick: Q,
|
|
602
606
|
children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
|
|
603
607
|
}),
|
|
604
|
-
/* @__PURE__ */ v
|
|
608
|
+
/* @__PURE__ */ g(v, {
|
|
605
609
|
size: "sm",
|
|
606
610
|
variant: "outline",
|
|
607
|
-
onClick:
|
|
608
|
-
children: /* @__PURE__ */
|
|
611
|
+
onClick: Wt,
|
|
612
|
+
children: /* @__PURE__ */ g(Se, { className: "h-3.5 w-3.5" })
|
|
609
613
|
})
|
|
610
614
|
]
|
|
611
615
|
}),
|
|
612
|
-
|
|
616
|
+
T === "ready" && /* @__PURE__ */ _("div", {
|
|
613
617
|
className: "absolute bottom-3 left-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
614
618
|
children: [
|
|
615
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ _("div", {
|
|
616
620
|
className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
|
|
617
621
|
children: [
|
|
618
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ g(fe, { className: "h-3.5 w-3.5" }),
|
|
619
623
|
" ",
|
|
620
624
|
e("healthybowl.fieldMapPage.layers.title", "Layers")
|
|
621
625
|
]
|
|
622
626
|
}),
|
|
623
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ _("label", {
|
|
624
628
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
629
|
+
children: [/* @__PURE__ */ g("input", {
|
|
626
630
|
type: "checkbox",
|
|
627
631
|
checked: !0,
|
|
628
632
|
readOnly: !0,
|
|
629
633
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
630
634
|
}), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
|
|
631
635
|
}),
|
|
632
|
-
/* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ _("label", {
|
|
633
637
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
634
|
-
children: [/* @__PURE__ */
|
|
638
|
+
children: [/* @__PURE__ */ g("input", {
|
|
635
639
|
type: "checkbox",
|
|
636
|
-
checked:
|
|
637
|
-
onChange: (e) =>
|
|
640
|
+
checked: A,
|
|
641
|
+
onChange: (e) => Ze(e.target.checked),
|
|
638
642
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
639
643
|
}), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
|
|
640
644
|
}),
|
|
641
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ _("label", {
|
|
642
646
|
className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
|
|
643
|
-
children: [/* @__PURE__ */
|
|
647
|
+
children: [/* @__PURE__ */ g("input", {
|
|
644
648
|
type: "checkbox",
|
|
645
|
-
checked:
|
|
646
|
-
onChange: (e) =>
|
|
649
|
+
checked: j,
|
|
650
|
+
onChange: (e) => Qe(e.target.checked),
|
|
647
651
|
className: "h-3.5 w-3.5 accent-[var(--color-success)]"
|
|
648
652
|
}), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
|
|
649
653
|
})
|
|
650
654
|
]
|
|
651
655
|
}),
|
|
652
|
-
|
|
656
|
+
T === "ready" && j && Ot.length > 0 && /* @__PURE__ */ _("div", {
|
|
653
657
|
className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
|
|
654
|
-
children: [/* @__PURE__ */
|
|
658
|
+
children: [/* @__PURE__ */ g("div", {
|
|
655
659
|
className: "mb-1.5 font-semibold text-text-primary",
|
|
656
660
|
children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
|
|
657
|
-
}),
|
|
661
|
+
}), Ot.map((t) => /* @__PURE__ */ _("div", {
|
|
658
662
|
className: "flex items-center gap-2 py-0.5 text-text-secondary",
|
|
659
|
-
children: [/* @__PURE__ */
|
|
663
|
+
children: [/* @__PURE__ */ g("span", {
|
|
660
664
|
className: "inline-block h-3 w-3 rounded-sm",
|
|
661
665
|
style: { backgroundColor: t.color }
|
|
662
666
|
}), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
|
|
663
667
|
}, t.key))]
|
|
664
668
|
}),
|
|
665
|
-
|
|
669
|
+
T === "ready" && A && /* @__PURE__ */ _("div", {
|
|
666
670
|
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",
|
|
667
|
-
children: [/* @__PURE__ */
|
|
671
|
+
children: [/* @__PURE__ */ g("div", {
|
|
668
672
|
className: "font-semibold text-text-primary",
|
|
669
673
|
children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
|
|
670
|
-
}), /* @__PURE__ */
|
|
674
|
+
}), /* @__PURE__ */ _("div", {
|
|
671
675
|
className: "mt-1 flex items-center gap-2",
|
|
672
|
-
children: [/* @__PURE__ */
|
|
676
|
+
children: [/* @__PURE__ */ g("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
|
|
673
677
|
})]
|
|
674
678
|
}),
|
|
675
|
-
(
|
|
679
|
+
(T === "loading" || Le.crops && c.length === 0) && /* @__PURE__ */ g("div", {
|
|
676
680
|
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",
|
|
677
681
|
children: e("healthybowl.fieldMapPage.loading", "Loading map…")
|
|
678
682
|
}),
|
|
679
|
-
|
|
683
|
+
Jt && T === "ready" && E === "view" && /* @__PURE__ */ g("div", {
|
|
680
684
|
className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
|
|
681
|
-
children: /* @__PURE__ */
|
|
685
|
+
children: /* @__PURE__ */ _("div", {
|
|
682
686
|
className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
|
|
683
687
|
children: [
|
|
684
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ g("div", {
|
|
685
689
|
className: "mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-success/15",
|
|
686
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ g(me, { className: "h-6 w-6 text-success" })
|
|
687
691
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ g("h3", {
|
|
689
693
|
className: "text-lg font-semibold text-text-primary",
|
|
690
694
|
children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
|
|
691
695
|
}),
|
|
692
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ g("p", {
|
|
693
697
|
className: "mt-1 text-sm text-text-secondary",
|
|
694
698
|
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.")
|
|
695
699
|
}),
|
|
696
|
-
/* @__PURE__ */
|
|
700
|
+
/* @__PURE__ */ _(v, {
|
|
697
701
|
className: "mt-4",
|
|
698
|
-
onClick:
|
|
702
|
+
onClick: Ft,
|
|
699
703
|
children: [
|
|
700
|
-
/* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ g(ge, { className: "h-4 w-4" }),
|
|
701
705
|
" ",
|
|
702
706
|
e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
|
|
703
707
|
]
|
|
@@ -707,104 +711,105 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
707
711
|
})
|
|
708
712
|
]
|
|
709
713
|
}),
|
|
710
|
-
/* @__PURE__ */
|
|
714
|
+
/* @__PURE__ */ g("p", {
|
|
711
715
|
className: "text-xs text-text-secondary",
|
|
712
716
|
children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
|
|
713
717
|
})
|
|
714
718
|
]
|
|
715
|
-
}), /* @__PURE__ */
|
|
719
|
+
}), /* @__PURE__ */ _("aside", {
|
|
716
720
|
className: "shrink-0 space-y-4 lg:w-80",
|
|
717
|
-
children: [/* @__PURE__ */
|
|
721
|
+
children: [/* @__PURE__ */ _("div", {
|
|
718
722
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
719
723
|
children: [
|
|
720
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ g("h2", {
|
|
721
725
|
className: "text-base font-semibold text-text-primary",
|
|
722
726
|
children: e("healthybowl.fieldMapPage.panel.title", "Fields")
|
|
723
727
|
}),
|
|
724
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ g("p", {
|
|
725
729
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
726
730
|
children: e("healthybowl.fieldMapPage.panel.summary", "{{acres}} acres · {{count}} fields · {{mapped}} mapped", {
|
|
727
|
-
acres:
|
|
728
|
-
count: String(
|
|
729
|
-
mapped: String(
|
|
731
|
+
acres: Dt.toFixed(1),
|
|
732
|
+
count: String(c.length),
|
|
733
|
+
mapped: String(Et)
|
|
730
734
|
})
|
|
731
735
|
}),
|
|
732
|
-
/* @__PURE__ */
|
|
736
|
+
/* @__PURE__ */ _("div", {
|
|
733
737
|
className: "relative mt-3",
|
|
734
|
-
children: [/* @__PURE__ */
|
|
738
|
+
children: [/* @__PURE__ */ g(ye, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g("input", {
|
|
735
739
|
type: "search",
|
|
736
|
-
value:
|
|
737
|
-
onChange: (e) =>
|
|
740
|
+
value: M,
|
|
741
|
+
onChange: (e) => $e(e.target.value),
|
|
738
742
|
placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
|
|
739
743
|
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)]"
|
|
740
744
|
})]
|
|
741
745
|
}),
|
|
742
|
-
/* @__PURE__ */
|
|
746
|
+
/* @__PURE__ */ _("div", {
|
|
743
747
|
className: "mt-3 max-h-[38vh] space-y-1 overflow-y-auto",
|
|
744
|
-
children: [
|
|
745
|
-
let n =
|
|
746
|
-
return /* @__PURE__ */
|
|
748
|
+
children: [kt.map((t) => {
|
|
749
|
+
let n = x(t) !== null;
|
|
750
|
+
return /* @__PURE__ */ _("button", {
|
|
747
751
|
type: "button",
|
|
748
|
-
|
|
749
|
-
|
|
752
|
+
"data-field-id": t.id,
|
|
753
|
+
onClick: () => Mt(t),
|
|
754
|
+
className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === O ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
|
|
750
755
|
children: [
|
|
751
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ g("span", {
|
|
752
757
|
className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
|
|
753
|
-
style: { backgroundColor:
|
|
758
|
+
style: { backgroundColor: se(t.soilType) }
|
|
754
759
|
}),
|
|
755
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ _("span", {
|
|
756
761
|
className: "min-w-0 flex-1",
|
|
757
|
-
children: [/* @__PURE__ */
|
|
762
|
+
children: [/* @__PURE__ */ g("span", {
|
|
758
763
|
className: "block truncate text-sm font-medium text-text-primary",
|
|
759
764
|
children: t.name
|
|
760
|
-
}), /* @__PURE__ */
|
|
765
|
+
}), /* @__PURE__ */ _("span", {
|
|
761
766
|
className: "block truncate text-xs text-text-secondary",
|
|
762
767
|
children: [
|
|
763
|
-
|
|
764
|
-
"
|
|
768
|
+
Ge(t),
|
|
769
|
+
" ·",
|
|
765
770
|
" ",
|
|
766
771
|
t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
|
|
767
772
|
]
|
|
768
773
|
})]
|
|
769
774
|
}),
|
|
770
|
-
!n && /* @__PURE__ */
|
|
775
|
+
!n && /* @__PURE__ */ g("span", {
|
|
771
776
|
className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
|
|
772
777
|
children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
|
|
773
778
|
})
|
|
774
779
|
]
|
|
775
780
|
}, t.id);
|
|
776
|
-
}),
|
|
781
|
+
}), kt.length === 0 && /* @__PURE__ */ g("p", {
|
|
777
782
|
className: "px-2 py-4 text-center text-xs text-text-secondary",
|
|
778
783
|
children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
|
|
779
784
|
})]
|
|
780
785
|
}),
|
|
781
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ _(v, {
|
|
782
787
|
className: "mt-3 w-full",
|
|
783
|
-
onClick:
|
|
784
|
-
disabled:
|
|
788
|
+
onClick: Ft,
|
|
789
|
+
disabled: E === "draw",
|
|
785
790
|
children: [
|
|
786
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ g(ge, { className: "h-4 w-4" }),
|
|
787
792
|
" ",
|
|
788
793
|
e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
|
|
789
794
|
]
|
|
790
795
|
})
|
|
791
796
|
]
|
|
792
|
-
}), J && /* @__PURE__ */
|
|
797
|
+
}), J && /* @__PURE__ */ _("div", {
|
|
793
798
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
794
799
|
children: [
|
|
795
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ g("h3", {
|
|
796
801
|
className: "text-sm font-semibold text-text-primary",
|
|
797
802
|
children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: J.name })
|
|
798
803
|
}),
|
|
799
|
-
/* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ _("dl", {
|
|
800
805
|
className: "mt-3 space-y-2 text-sm",
|
|
801
806
|
children: [
|
|
802
|
-
/* @__PURE__ */
|
|
807
|
+
/* @__PURE__ */ _("div", {
|
|
803
808
|
className: "flex justify-between gap-3",
|
|
804
|
-
children: [/* @__PURE__ */
|
|
809
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
805
810
|
className: "text-text-secondary",
|
|
806
811
|
children: e("healthybowl.fieldMapPage.detail.area", "Area")
|
|
807
|
-
}), /* @__PURE__ */
|
|
812
|
+
}), /* @__PURE__ */ _("dd", {
|
|
808
813
|
className: "font-medium text-text-primary",
|
|
809
814
|
children: [
|
|
810
815
|
J.area,
|
|
@@ -813,68 +818,68 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
813
818
|
]
|
|
814
819
|
})]
|
|
815
820
|
}),
|
|
816
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ _("div", {
|
|
817
822
|
className: "flex justify-between gap-3",
|
|
818
|
-
children: [/* @__PURE__ */
|
|
823
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
819
824
|
className: "text-text-secondary",
|
|
820
825
|
children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
|
|
821
|
-
}), /* @__PURE__ */
|
|
826
|
+
}), /* @__PURE__ */ g("dd", {
|
|
822
827
|
className: "font-medium text-text-primary",
|
|
823
828
|
children: J.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
|
|
824
829
|
})]
|
|
825
830
|
}),
|
|
826
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ _("div", {
|
|
827
832
|
className: "flex justify-between gap-3",
|
|
828
|
-
children: [/* @__PURE__ */
|
|
833
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
829
834
|
className: "text-text-secondary",
|
|
830
835
|
children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
|
|
831
|
-
}), /* @__PURE__ */
|
|
836
|
+
}), /* @__PURE__ */ g("dd", {
|
|
832
837
|
className: "font-medium text-text-primary",
|
|
833
838
|
children: J.irrigationType || "—"
|
|
834
839
|
})]
|
|
835
840
|
}),
|
|
836
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ _("div", {
|
|
837
842
|
className: "flex justify-between gap-3",
|
|
838
|
-
children: [/* @__PURE__ */
|
|
843
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
839
844
|
className: "text-text-secondary",
|
|
840
845
|
children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
|
|
841
|
-
}), /* @__PURE__ */
|
|
846
|
+
}), /* @__PURE__ */ g("dd", {
|
|
842
847
|
className: "font-medium text-text-primary",
|
|
843
|
-
children:
|
|
848
|
+
children: At(J) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
|
|
844
849
|
})]
|
|
845
850
|
}),
|
|
846
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ _("div", {
|
|
847
852
|
className: "flex justify-between gap-3",
|
|
848
|
-
children: [/* @__PURE__ */
|
|
853
|
+
children: [/* @__PURE__ */ g("dt", {
|
|
849
854
|
className: "text-text-secondary",
|
|
850
855
|
children: e("healthybowl.fieldMapPage.detail.status", "Status")
|
|
851
|
-
}), /* @__PURE__ */
|
|
856
|
+
}), /* @__PURE__ */ g("dd", {
|
|
852
857
|
className: "font-medium capitalize text-text-primary",
|
|
853
858
|
children: J.status
|
|
854
859
|
})]
|
|
855
860
|
})
|
|
856
861
|
]
|
|
857
862
|
}),
|
|
858
|
-
/* @__PURE__ */
|
|
863
|
+
/* @__PURE__ */ _("div", {
|
|
859
864
|
className: "mt-3 flex gap-2",
|
|
860
|
-
children: [/* @__PURE__ */
|
|
865
|
+
children: [/* @__PURE__ */ _(v, {
|
|
861
866
|
variant: "outline",
|
|
862
867
|
size: "sm",
|
|
863
868
|
className: "flex-1",
|
|
864
|
-
onClick: () =>
|
|
869
|
+
onClick: () => jt(J),
|
|
865
870
|
children: [
|
|
866
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ g(me, { className: "h-4 w-4" }),
|
|
867
872
|
" ",
|
|
868
873
|
e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
|
|
869
874
|
]
|
|
870
|
-
}),
|
|
875
|
+
}), x(J) && /* @__PURE__ */ _(v, {
|
|
871
876
|
variant: "outline",
|
|
872
877
|
size: "sm",
|
|
873
878
|
className: "flex-1",
|
|
874
|
-
onClick:
|
|
875
|
-
disabled:
|
|
879
|
+
onClick: Rt,
|
|
880
|
+
disabled: E === "edit",
|
|
876
881
|
children: [
|
|
877
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ g(be, { className: "h-4 w-4" }),
|
|
878
883
|
" ",
|
|
879
884
|
e("healthybowl.fieldMapPage.detail.edit", "Edit")
|
|
880
885
|
]
|
|
@@ -884,105 +889,105 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
884
889
|
})]
|
|
885
890
|
})]
|
|
886
891
|
}),
|
|
887
|
-
/* @__PURE__ */
|
|
892
|
+
/* @__PURE__ */ g(ee, {
|
|
888
893
|
open: I !== null,
|
|
889
894
|
onClose: () => L(null),
|
|
890
895
|
title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
|
|
891
896
|
description: e("healthybowl.fieldMapPage.create.description", "Name the field you just drew. Its area is auto-calculated."),
|
|
892
|
-
footer: /* @__PURE__ */
|
|
897
|
+
footer: /* @__PURE__ */ _(Ce, { children: [/* @__PURE__ */ g(v, {
|
|
893
898
|
variant: "outline",
|
|
894
899
|
onClick: () => L(null),
|
|
895
900
|
className: "text-text-secondary",
|
|
896
901
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
897
|
-
}), /* @__PURE__ */ v
|
|
898
|
-
onClick:
|
|
899
|
-
disabled:
|
|
900
|
-
children:
|
|
902
|
+
}), /* @__PURE__ */ g(v, {
|
|
903
|
+
onClick: qt,
|
|
904
|
+
disabled: dt,
|
|
905
|
+
children: dt ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
|
|
901
906
|
})] }),
|
|
902
|
-
children: /* @__PURE__ */
|
|
907
|
+
children: /* @__PURE__ */ _("div", {
|
|
903
908
|
className: "space-y-4",
|
|
904
909
|
children: [
|
|
905
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ g("div", {
|
|
906
911
|
className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
|
|
907
912
|
children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(I?.area ?? 0) })
|
|
908
913
|
}),
|
|
909
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
910
915
|
className: "text-sm font-medium text-text-primary",
|
|
911
916
|
children: e("healthybowl.fieldMapPage.create.name", "Field name *")
|
|
912
|
-
}), /* @__PURE__ */
|
|
917
|
+
}), /* @__PURE__ */ g("input", {
|
|
913
918
|
type: "text",
|
|
914
919
|
value: R,
|
|
915
|
-
onChange: (e) =>
|
|
920
|
+
onChange: (e) => pt(e.target.value),
|
|
916
921
|
placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
|
|
917
922
|
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)]"
|
|
918
923
|
})] }),
|
|
919
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ _("div", {
|
|
920
925
|
className: "grid grid-cols-2 gap-3",
|
|
921
|
-
children: [/* @__PURE__ */
|
|
926
|
+
children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
922
927
|
className: "text-sm font-medium text-text-primary",
|
|
923
928
|
children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
|
|
924
|
-
}), /* @__PURE__ */
|
|
925
|
-
value:
|
|
926
|
-
onValueChange:
|
|
927
|
-
children: [/* @__PURE__ */
|
|
929
|
+
}), /* @__PURE__ */ _(we, {
|
|
930
|
+
value: mt,
|
|
931
|
+
onValueChange: ht,
|
|
932
|
+
children: [/* @__PURE__ */ g(Ee, {
|
|
928
933
|
className: "mt-1 w-full",
|
|
929
|
-
children: /* @__PURE__ */
|
|
930
|
-
}), /* @__PURE__ */
|
|
934
|
+
children: /* @__PURE__ */ g(De, {})
|
|
935
|
+
}), /* @__PURE__ */ g(Te, { children: oe.map((t) => /* @__PURE__ */ g(y, {
|
|
931
936
|
value: t.label,
|
|
932
937
|
children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
|
|
933
938
|
}, t.key)) })]
|
|
934
|
-
})] }), /* @__PURE__ */
|
|
939
|
+
})] }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
935
940
|
className: "text-sm font-medium text-text-primary",
|
|
936
941
|
children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
|
|
937
|
-
}), /* @__PURE__ */
|
|
938
|
-
value:
|
|
939
|
-
onValueChange:
|
|
940
|
-
children: [/* @__PURE__ */
|
|
942
|
+
}), /* @__PURE__ */ _(we, {
|
|
943
|
+
value: gt,
|
|
944
|
+
onValueChange: _t,
|
|
945
|
+
children: [/* @__PURE__ */ g(Ee, {
|
|
941
946
|
className: "mt-1 w-full",
|
|
942
|
-
children: /* @__PURE__ */
|
|
943
|
-
}), /* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
947
|
+
children: /* @__PURE__ */ g(De, {})
|
|
948
|
+
}), /* @__PURE__ */ _(Te, { children: [
|
|
949
|
+
/* @__PURE__ */ g(y, {
|
|
945
950
|
value: "Drip",
|
|
946
951
|
children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
|
|
947
952
|
}),
|
|
948
|
-
/* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ g(y, {
|
|
949
954
|
value: "Sprinkler",
|
|
950
955
|
children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
|
|
951
956
|
}),
|
|
952
|
-
/* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ g(y, {
|
|
953
958
|
value: "Flood",
|
|
954
959
|
children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
|
|
955
960
|
}),
|
|
956
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ g(y, {
|
|
957
962
|
value: "Rainfed",
|
|
958
963
|
children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
|
|
959
964
|
}),
|
|
960
|
-
/* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ g(y, {
|
|
961
966
|
value: "None",
|
|
962
967
|
children: e("healthybowl.fieldMapPage.irrigation.none", "None")
|
|
963
968
|
})
|
|
964
969
|
] })]
|
|
965
970
|
})] })]
|
|
966
971
|
}),
|
|
967
|
-
/* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
968
973
|
className: "text-sm font-medium text-text-primary",
|
|
969
974
|
children: e("healthybowl.fieldMapPage.create.status", "Status")
|
|
970
|
-
}), /* @__PURE__ */
|
|
971
|
-
value:
|
|
972
|
-
onValueChange:
|
|
973
|
-
children: [/* @__PURE__ */
|
|
975
|
+
}), /* @__PURE__ */ _(we, {
|
|
976
|
+
value: vt,
|
|
977
|
+
onValueChange: yt,
|
|
978
|
+
children: [/* @__PURE__ */ g(Ee, {
|
|
974
979
|
className: "mt-1 w-full",
|
|
975
|
-
children: /* @__PURE__ */
|
|
976
|
-
}), /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
980
|
+
children: /* @__PURE__ */ g(De, {})
|
|
981
|
+
}), /* @__PURE__ */ _(Te, { children: [
|
|
982
|
+
/* @__PURE__ */ g(y, {
|
|
978
983
|
value: "active",
|
|
979
984
|
children: e("healthybowl.fieldMapPage.status.active", "Active")
|
|
980
985
|
}),
|
|
981
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ g(y, {
|
|
982
987
|
value: "preparation",
|
|
983
988
|
children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
|
|
984
989
|
}),
|
|
985
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ g(y, {
|
|
986
991
|
value: "fallow",
|
|
987
992
|
children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
|
|
988
993
|
})
|
|
@@ -991,14 +996,14 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
|
|
|
991
996
|
]
|
|
992
997
|
})
|
|
993
998
|
}),
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
toasts:
|
|
996
|
-
onDismiss:
|
|
999
|
+
/* @__PURE__ */ g(a, {
|
|
1000
|
+
toasts: Je,
|
|
1001
|
+
onDismiss: Ye
|
|
997
1002
|
})
|
|
998
1003
|
]
|
|
999
1004
|
});
|
|
1000
1005
|
};
|
|
1001
1006
|
//#endregion
|
|
1002
|
-
export {
|
|
1007
|
+
export { S as FieldMapPage };
|
|
1003
1008
|
|
|
1004
1009
|
//# sourceMappingURL=FieldMapPage.js.map
|