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