@burdenoff/microfe-healthybowl 2026.709.2 → 2026.709.4
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/crops/CropPlanningPage.js +521 -258
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +535 -370
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/utils/plantingCapacity.js +103 -0
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -0
- package/package.json +1 -1
|
@@ -8,18 +8,19 @@ import { ErrorState as s } from "../../components/ErrorState.js";
|
|
|
8
8
|
import { ToastContainer as c } from "../../components/Toast.js";
|
|
9
9
|
import { Breadcrumbs as l } from "../../components/Breadcrumbs.js";
|
|
10
10
|
import { PageLoader as u } from "../../components/PageLoader.js";
|
|
11
|
-
import { Modal as
|
|
12
|
-
import { useToast as
|
|
11
|
+
import { Modal as d } from "../../components/Modal.js";
|
|
12
|
+
import { useToast as ee } from "../../hooks/useToast.js";
|
|
13
13
|
import "../../components/index.js";
|
|
14
|
-
import { useHealthyBowlData as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
14
|
+
import { useHealthyBowlData as te } from "../../hooks/useHealthyBowlData.js";
|
|
15
|
+
import { DEFAULT_BED_WIDTH_M as f, DEFAULT_CROP_SPACING_PRESET as ne, DEFAULT_PATH_WIDTH_M as p, estimatePlantingCapacity as re, getCropSpacingPreset as m } from "../../utils/plantingCapacity.js";
|
|
16
|
+
import { useEffect as ie, useMemo as h, useState as g } from "react";
|
|
17
|
+
import { useI18n as _ } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
18
|
+
import { ArrowRight as v, Beaker as y, Calendar as b, ClipboardList as ae, MapPin as oe, Plus as se, Search as ce, Sprout as le, Target as ue } from "lucide-react";
|
|
19
|
+
import { useNavigate as de } from "react-router-dom";
|
|
20
|
+
import { Fragment as fe, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
21
|
+
import { Button as C, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O } from "@burdenoff/fe-libs/ui";
|
|
21
22
|
//#region src/healthybowl/pages/crops/CropPlanningPage.tsx
|
|
22
|
-
var
|
|
23
|
+
var k = (e) => {
|
|
23
24
|
switch (e) {
|
|
24
25
|
case "active": return "success";
|
|
25
26
|
case "approved": return "info";
|
|
@@ -27,19 +28,19 @@ var O = (e) => {
|
|
|
27
28
|
case "completed": return "default";
|
|
28
29
|
default: return "muted";
|
|
29
30
|
}
|
|
30
|
-
},
|
|
31
|
+
}, pe = (e) => {
|
|
31
32
|
switch (e) {
|
|
32
33
|
case "high": return "error";
|
|
33
34
|
case "medium": return "warning";
|
|
34
35
|
default: return "success";
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
+
}, me = (e) => {
|
|
37
38
|
switch (e) {
|
|
38
39
|
case "high": return "error";
|
|
39
40
|
case "medium": return "warning";
|
|
40
41
|
default: return "success";
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
+
}, he = (e, t) => {
|
|
43
44
|
switch (e) {
|
|
44
45
|
case "kharif": return t("healthybowl.crops.planning.season.kharif", "Kharif");
|
|
45
46
|
case "rabi": return t("healthybowl.crops.planning.season.rabi", "Rabi");
|
|
@@ -47,178 +48,364 @@ var O = (e) => {
|
|
|
47
48
|
case "perennial": return t("healthybowl.crops.planning.season.perennial", "Perennial");
|
|
48
49
|
default: return e;
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
}, A = (e) => (e ?? "").trim().toLowerCase(), ge = (e, t) => t.find((t) => e.fieldId ? t.id === e.fieldId : A(t.name) === A(e.fieldName)), j = (e, t) => t.find((t) => t.id === e.field || A(t.name) === A(e.fieldName)), _e = (e, t) => e.cropId ? e.cropId === t.id : A(e.cropName) === A(t.name), ve = (e, t) => {
|
|
52
|
+
let n = Number(e);
|
|
53
|
+
return Number.isFinite(n) && n > 0 ? n : t;
|
|
54
|
+
}, ye = (e, t) => {
|
|
55
|
+
let n = Number(e);
|
|
56
|
+
return Number.isFinite(n) && n >= 0 ? n : t;
|
|
57
|
+
}, be = (e, t = 1) => new Intl.NumberFormat("en-US", { maximumFractionDigits: t }).format(e), xe = (e, t) => {
|
|
58
|
+
let n = j(e, t);
|
|
59
|
+
if (!n) return null;
|
|
60
|
+
let r = m(e);
|
|
61
|
+
return re({
|
|
62
|
+
fieldArea: n.area,
|
|
63
|
+
fieldUnit: n.unit,
|
|
64
|
+
bedWidthM: f,
|
|
65
|
+
pathWidthM: p,
|
|
66
|
+
plantSpacingCm: r.plantSpacingCm,
|
|
67
|
+
rowSpacingCm: r.rowSpacingCm
|
|
68
|
+
});
|
|
69
|
+
}, M = () => {
|
|
70
|
+
let { plantingPlans: e, fields: v, crops: y, errors: b, loadings: k, createPlantingPlan: pe, refetch: me } = te(), { t: A } = _(), M = de(), { buildPath: F } = n(), { toasts: we, toast: I, dismiss: Te } = ee(), [L, Ee] = g(""), [R, De] = g("all"), [z, Oe] = g("all"), [ke, B] = g(!1), [V, H] = g(""), [U, W] = g(""), [Ae, G] = g("kharif"), [je, Me] = g("low"), [Ne, Pe] = g(""), [Fe, Ie] = g(""), [Le, Re] = g(""), [ze, Be] = g(""), [K, Ve] = g(""), [q, J] = g(""), [He, Ue] = g(String(ne.plantSpacingCm)), [We, Ge] = g(String(ne.rowSpacingCm)), [Ke, qe] = g(String(f)), [Je, Ye] = g(String(p)), Xe = () => {
|
|
71
|
+
H(""), W(""), G("kharif"), Me("low"), Pe(""), Ie(""), Re(""), Be("");
|
|
72
|
+
}, Ze = h(() => y.find((e) => e.id === K) ?? null, [K, y]), Y = h(() => v.find((e) => e.id === q) ?? null, [q, v]), X = h(() => m(Ze), [Ze]), Z = h(() => Y ? re({
|
|
73
|
+
fieldArea: Y.area,
|
|
74
|
+
fieldUnit: Y.unit,
|
|
75
|
+
bedWidthM: ve(Ke, f),
|
|
76
|
+
pathWidthM: ye(Je, p),
|
|
77
|
+
plantSpacingCm: ve(He, X.plantSpacingCm),
|
|
78
|
+
rowSpacingCm: ve(We, X.rowSpacingCm)
|
|
79
|
+
}) : null, [
|
|
80
|
+
Ke,
|
|
81
|
+
Je,
|
|
82
|
+
He,
|
|
83
|
+
We,
|
|
84
|
+
Y,
|
|
85
|
+
X
|
|
86
|
+
]), Qe = h(() => y.find((e) => e.id === V) ?? null, [y, V]), Q = h(() => v.find((e) => e.id === U) ?? null, [v, U]), $ = h(() => {
|
|
87
|
+
if (!Qe || !Q) return null;
|
|
88
|
+
let e = m(Qe);
|
|
89
|
+
return re({
|
|
90
|
+
fieldArea: Q.area,
|
|
91
|
+
fieldUnit: Q.unit,
|
|
92
|
+
bedWidthM: f,
|
|
93
|
+
pathWidthM: p,
|
|
94
|
+
plantSpacingCm: e.plantSpacingCm,
|
|
95
|
+
rowSpacingCm: e.rowSpacingCm
|
|
96
|
+
});
|
|
97
|
+
}, [Qe, Q]);
|
|
98
|
+
ie(() => {
|
|
99
|
+
if (K || y.length === 0) return;
|
|
100
|
+
let e = y[0], t = m(e), n = j(e, v);
|
|
101
|
+
Ve(e.id), Ue(String(t.plantSpacingCm)), Ge(String(t.rowSpacingCm)), n && J(n.id);
|
|
102
|
+
}, [
|
|
103
|
+
K,
|
|
104
|
+
y,
|
|
105
|
+
v
|
|
106
|
+
]), ie(() => {
|
|
107
|
+
q || v.length === 0 || J(v[0].id);
|
|
108
|
+
}, [q, v]);
|
|
109
|
+
let $e = e.filter((e) => {
|
|
110
|
+
let t = (e.cropName ?? "").toLowerCase().includes(L.toLowerCase()) || (e.fieldName ?? "").toLowerCase().includes(L.toLowerCase()), n = R === "all" || e.status === R, r = z === "all" || e.season === z;
|
|
55
111
|
return t && n && r;
|
|
56
|
-
}),
|
|
57
|
-
let
|
|
58
|
-
return e + (
|
|
59
|
-
}, 0),
|
|
60
|
-
let n = e.filter((e) =>
|
|
112
|
+
}), et = e.length, tt = e.reduce((e, t) => e + t.expectedYield, 0), nt = e.filter((e) => e.status === "active" || e.status === "approved").length, rt = [...new Set(e.map((e) => e.season))], it = [...new Set(e.map((e) => e.status))], at = e.reduce((e, t) => {
|
|
113
|
+
let n = ge(t, v);
|
|
114
|
+
return e + (n ? n.area : 0);
|
|
115
|
+
}, 0), ot = y.map((t) => {
|
|
116
|
+
let n = e.filter((e) => _e(e, t));
|
|
61
117
|
return {
|
|
62
118
|
crop: t,
|
|
63
119
|
plans: n,
|
|
64
|
-
activePlan: n.find((e) => e.status !== "completed") ?? n[0]
|
|
120
|
+
activePlan: n.find((e) => e.status !== "completed") ?? n[0],
|
|
121
|
+
capacityEstimate: xe(t, v)
|
|
65
122
|
};
|
|
66
|
-
}),
|
|
67
|
-
let
|
|
68
|
-
|
|
123
|
+
}), st = ot.filter((e) => e.plans.length > 0).length, ct = (e) => {
|
|
124
|
+
let t = y.find((t) => t.id === e);
|
|
125
|
+
if (Ve(e), !t) return;
|
|
126
|
+
let n = m(t), r = j(t, v);
|
|
127
|
+
Ue(String(n.plantSpacingCm)), Ge(String(n.rowSpacingCm)), r && J(r.id);
|
|
128
|
+
}, lt = (e) => {
|
|
129
|
+
let t = y.find((t) => t.id === e);
|
|
130
|
+
if (H(e), !t) return;
|
|
131
|
+
let n = j(t, v);
|
|
132
|
+
G(t.season), n && W(n.id);
|
|
133
|
+
}, ut = (e) => {
|
|
134
|
+
let t = j(e, v);
|
|
135
|
+
H(e.id), W(t?.id ?? ""), G(e.season), Pe(e.plantingDate || ""), Ie(e.expectedHarvestDate || ""), Re(e.yieldEstimate ? String(e.yieldEstimate) : ""), Be(""), B(!0);
|
|
69
136
|
};
|
|
70
|
-
return /* @__PURE__ */
|
|
137
|
+
return /* @__PURE__ */ S(r, {
|
|
71
138
|
title: A("healthybowl.crops.planning.title", "Crop Planning"),
|
|
72
139
|
description: A("healthybowl.crops.planning.subtitle", "Manage planting plans and schedules"),
|
|
73
140
|
purpose: "Decide what to plant where and when, before the season starts. A good plan helps you rotate crops, stagger planting for steady harvests, and make sure every field is working toward your goals.",
|
|
74
|
-
actions: /* @__PURE__ */
|
|
75
|
-
onClick: () =>
|
|
141
|
+
actions: /* @__PURE__ */ S(C, {
|
|
142
|
+
onClick: () => B(!0),
|
|
76
143
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ x(se, { className: "h-4 w-4" }),
|
|
78
145
|
" ",
|
|
79
146
|
A("healthybowl.crops.planning.actions.addPlan", "Add New Plan")
|
|
80
147
|
]
|
|
81
148
|
}),
|
|
82
149
|
children: [
|
|
83
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ x(l, { items: [{
|
|
84
151
|
label: A("healthybowl.crops.planning.breadcrumbs.crops", "Crops"),
|
|
85
|
-
href:
|
|
152
|
+
href: F("crops")
|
|
86
153
|
}, { label: A("healthybowl.crops.planning.breadcrumbs.planning", "Planning") }] }),
|
|
87
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ S("div", {
|
|
88
155
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
89
156
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ x(i, {
|
|
91
158
|
hero: !0,
|
|
92
159
|
label: A("healthybowl.crops.planning.stats.totalPlans.label", "Total Plans"),
|
|
93
|
-
value:
|
|
94
|
-
icon: /* @__PURE__ */
|
|
160
|
+
value: et,
|
|
161
|
+
icon: /* @__PURE__ */ x(ae, { className: "h-5 w-5" })
|
|
95
162
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ x(i, {
|
|
97
164
|
label: A("healthybowl.crops.planning.stats.plannedArea.label", "Planned Area"),
|
|
98
|
-
value:
|
|
165
|
+
value: at,
|
|
99
166
|
unit: "acres",
|
|
100
|
-
icon: /* @__PURE__ */
|
|
167
|
+
icon: /* @__PURE__ */ x(oe, { className: "h-5 w-5" })
|
|
101
168
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ x(i, {
|
|
103
170
|
label: A("healthybowl.crops.planning.stats.expectedYield.label", "Expected Yield"),
|
|
104
|
-
value:
|
|
171
|
+
value: tt,
|
|
105
172
|
unit: "kg",
|
|
106
|
-
icon: /* @__PURE__ */
|
|
173
|
+
icon: /* @__PURE__ */ x(ue, { className: "h-5 w-5" })
|
|
107
174
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ x(i, {
|
|
109
176
|
label: A("healthybowl.crops.planning.stats.activePlans.label", "Active Plans"),
|
|
110
|
-
value:
|
|
111
|
-
icon: /* @__PURE__ */
|
|
177
|
+
value: nt,
|
|
178
|
+
icon: /* @__PURE__ */ x(le, { className: "h-5 w-5" })
|
|
112
179
|
})
|
|
113
180
|
]
|
|
114
181
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ S("div", {
|
|
116
183
|
className: "flex flex-col gap-3 sm:flex-row sm:items-center",
|
|
117
184
|
children: [
|
|
118
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ S("div", {
|
|
119
186
|
className: "relative flex-1",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
187
|
+
children: [/* @__PURE__ */ x(ce, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ x("input", {
|
|
121
188
|
type: "text",
|
|
122
|
-
value:
|
|
123
|
-
onChange: (e) =>
|
|
189
|
+
value: L,
|
|
190
|
+
onChange: (e) => Ee(e.target.value),
|
|
124
191
|
placeholder: A("healthybowl.crops.planning.search.placeholder", "Search plans by crop or field..."),
|
|
125
192
|
className: "w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-10 pr-4 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
126
193
|
})]
|
|
127
194
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
value:
|
|
130
|
-
onValueChange:
|
|
131
|
-
children: [/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ S(w, {
|
|
196
|
+
value: R,
|
|
197
|
+
onValueChange: De,
|
|
198
|
+
children: [/* @__PURE__ */ x(D, {
|
|
132
199
|
className: "h-9 w-auto",
|
|
133
|
-
children: /* @__PURE__ */
|
|
134
|
-
}), /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ x(O, { placeholder: A("healthybowl.crops.planning.filters.allStatuses", "All Statuses") })
|
|
201
|
+
}), /* @__PURE__ */ S(T, { children: [/* @__PURE__ */ x(E, {
|
|
135
202
|
value: "all",
|
|
136
203
|
children: A("healthybowl.crops.planning.filters.allStatuses", "All Statuses")
|
|
137
|
-
}),
|
|
204
|
+
}), it.map((e) => /* @__PURE__ */ x(E, {
|
|
138
205
|
value: e,
|
|
139
206
|
children: (e ?? "").charAt(0).toUpperCase() + (e ?? "").slice(1)
|
|
140
207
|
}, e))] })]
|
|
141
208
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
value:
|
|
144
|
-
onValueChange:
|
|
145
|
-
children: [/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ S(w, {
|
|
210
|
+
value: z,
|
|
211
|
+
onValueChange: Oe,
|
|
212
|
+
children: [/* @__PURE__ */ x(D, {
|
|
146
213
|
className: "h-9 w-auto",
|
|
147
|
-
children: /* @__PURE__ */
|
|
148
|
-
}), /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ x(O, { placeholder: A("healthybowl.crops.planning.filters.allSeasons", "All Seasons") })
|
|
215
|
+
}), /* @__PURE__ */ S(T, { children: [/* @__PURE__ */ x(E, {
|
|
149
216
|
value: "all",
|
|
150
217
|
children: A("healthybowl.crops.planning.filters.allSeasons", "All Seasons")
|
|
151
|
-
}),
|
|
218
|
+
}), rt.map((e) => /* @__PURE__ */ x(E, {
|
|
152
219
|
value: e,
|
|
153
|
-
children:
|
|
220
|
+
children: he(e, A)
|
|
154
221
|
}, e))] })]
|
|
155
222
|
})
|
|
156
223
|
]
|
|
157
224
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ S("div", {
|
|
226
|
+
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ S("div", {
|
|
229
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
230
|
+
children: [/* @__PURE__ */ x("h2", {
|
|
231
|
+
className: "text-sm font-semibold text-text-primary",
|
|
232
|
+
children: A("healthybowl.crops.planning.capacity.title", "Planting capacity")
|
|
233
|
+
}), /* @__PURE__ */ x(a, {
|
|
234
|
+
label: X.label,
|
|
235
|
+
variant: "muted"
|
|
236
|
+
})]
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ S("div", {
|
|
239
|
+
className: "mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-6",
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ S("div", {
|
|
242
|
+
className: "xl:col-span-2",
|
|
243
|
+
children: [/* @__PURE__ */ x("label", {
|
|
244
|
+
className: "text-xs font-medium text-text-secondary",
|
|
245
|
+
children: A("healthybowl.crops.planning.capacity.crop", "Crop")
|
|
246
|
+
}), /* @__PURE__ */ S(w, {
|
|
247
|
+
value: K,
|
|
248
|
+
onValueChange: ct,
|
|
249
|
+
children: [/* @__PURE__ */ x(D, {
|
|
250
|
+
className: "mt-1 w-full",
|
|
251
|
+
children: /* @__PURE__ */ x(O, { placeholder: A("healthybowl.crops.planning.capacity.cropPlaceholder", "Select crop") })
|
|
252
|
+
}), /* @__PURE__ */ x(T, { children: y.map((e) => /* @__PURE__ */ x(E, {
|
|
253
|
+
value: e.id,
|
|
254
|
+
children: e.variety ? `${e.name} - ${e.variety}` : e.name
|
|
255
|
+
}, e.id)) })]
|
|
256
|
+
})]
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ S("div", {
|
|
259
|
+
className: "xl:col-span-2",
|
|
260
|
+
children: [/* @__PURE__ */ x("label", {
|
|
261
|
+
className: "text-xs font-medium text-text-secondary",
|
|
262
|
+
children: A("healthybowl.crops.planning.capacity.field", "Field")
|
|
263
|
+
}), /* @__PURE__ */ S(w, {
|
|
264
|
+
value: q,
|
|
265
|
+
onValueChange: J,
|
|
266
|
+
children: [/* @__PURE__ */ x(D, {
|
|
267
|
+
className: "mt-1 w-full",
|
|
268
|
+
children: /* @__PURE__ */ x(O, { placeholder: A("healthybowl.crops.planning.capacity.fieldPlaceholder", "Select field") })
|
|
269
|
+
}), /* @__PURE__ */ x(T, { children: v.map((e) => /* @__PURE__ */ x(E, {
|
|
270
|
+
value: e.id,
|
|
271
|
+
children: e.name
|
|
272
|
+
}, e.id)) })]
|
|
273
|
+
})]
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ x(N, {
|
|
276
|
+
label: A("healthybowl.crops.planning.capacity.plantSpacing", "Plant spacing"),
|
|
277
|
+
unit: "cm",
|
|
278
|
+
value: He,
|
|
279
|
+
min: "1",
|
|
280
|
+
step: "1",
|
|
281
|
+
onChange: Ue
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ x(N, {
|
|
284
|
+
label: A("healthybowl.crops.planning.capacity.rowSpacing", "Row spacing"),
|
|
285
|
+
unit: "cm",
|
|
286
|
+
value: We,
|
|
287
|
+
min: "1",
|
|
288
|
+
step: "1",
|
|
289
|
+
onChange: Ge
|
|
290
|
+
}),
|
|
291
|
+
/* @__PURE__ */ x(N, {
|
|
292
|
+
label: A("healthybowl.crops.planning.capacity.bedWidth", "Bed width"),
|
|
293
|
+
unit: "m",
|
|
294
|
+
value: Ke,
|
|
295
|
+
min: "0.1",
|
|
296
|
+
step: "0.1",
|
|
297
|
+
onChange: qe
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ x(N, {
|
|
300
|
+
label: A("healthybowl.crops.planning.capacity.pathWidth", "Path width"),
|
|
301
|
+
unit: "m",
|
|
302
|
+
value: Je,
|
|
303
|
+
min: "0",
|
|
304
|
+
step: "0.05",
|
|
305
|
+
onChange: Ye
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
}),
|
|
309
|
+
Z ? /* @__PURE__ */ S("div", {
|
|
310
|
+
className: "mt-4 grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6",
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ x(P, {
|
|
313
|
+
label: A("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
|
|
314
|
+
value: t(Z.bedCount)
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ x(P, {
|
|
317
|
+
label: A("healthybowl.crops.planning.capacity.metrics.rowsPerBed", "Rows / bed"),
|
|
318
|
+
value: t(Z.rowsPerBed)
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ x(P, {
|
|
321
|
+
label: A("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
|
|
322
|
+
value: t(Z.plantsPerBed)
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ x(P, {
|
|
325
|
+
label: A("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
326
|
+
value: t(Z.totalPlants)
|
|
327
|
+
}),
|
|
328
|
+
/* @__PURE__ */ x(P, {
|
|
329
|
+
label: A("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
|
|
330
|
+
value: t(Z.seedlingTarget)
|
|
331
|
+
}),
|
|
332
|
+
/* @__PURE__ */ x(P, {
|
|
333
|
+
label: A("healthybowl.crops.planning.capacity.metrics.bedLength", "Bed length"),
|
|
334
|
+
value: be(Z.bedLengthM),
|
|
335
|
+
unit: "m"
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}) : /* @__PURE__ */ x("p", {
|
|
339
|
+
className: "mt-4 rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-sm text-text-secondary",
|
|
340
|
+
children: A("healthybowl.crops.planning.capacity.empty", "Select a crop and field to calculate beds and plants.")
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ S("div", {
|
|
159
345
|
className: "space-y-3",
|
|
160
|
-
children: [/* @__PURE__ */
|
|
346
|
+
children: [/* @__PURE__ */ S("div", {
|
|
161
347
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
162
|
-
children: [/* @__PURE__ */
|
|
348
|
+
children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h2", {
|
|
163
349
|
className: "text-sm font-semibold text-text-primary",
|
|
164
350
|
children: A("healthybowl.crops.planning.coverage.title", "Crop planning coverage")
|
|
165
|
-
}), /* @__PURE__ */
|
|
351
|
+
}), /* @__PURE__ */ x("p", {
|
|
166
352
|
className: "mt-1 text-xs text-text-secondary",
|
|
167
353
|
children: A("healthybowl.crops.planning.coverage.description", "Every crop is listed here so missing plans are easy to spot.")
|
|
168
|
-
})] }), /* @__PURE__ */
|
|
354
|
+
})] }), /* @__PURE__ */ x(a, {
|
|
169
355
|
label: A("healthybowl.crops.planning.coverage.status", "{{planned}} / {{total}} planned", {
|
|
170
|
-
planned:
|
|
171
|
-
total:
|
|
356
|
+
planned: st,
|
|
357
|
+
total: y.length
|
|
172
358
|
}),
|
|
173
|
-
variant:
|
|
359
|
+
variant: st === y.length && y.length > 0 ? "success" : "warning"
|
|
174
360
|
})]
|
|
175
|
-
}),
|
|
361
|
+
}), y.length > 0 ? /* @__PURE__ */ x("div", {
|
|
176
362
|
className: "grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
177
|
-
children:
|
|
363
|
+
children: ot.map(({ crop: e, activePlan: t, plans: n, capacityEstimate: r }) => /* @__PURE__ */ x(Se, {
|
|
178
364
|
crop: e,
|
|
179
365
|
plan: t,
|
|
180
366
|
planCount: n.length,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
367
|
+
capacityEstimate: r,
|
|
368
|
+
onPlan: () => ut(e),
|
|
369
|
+
onViewCrop: () => M(F(`crops/${e.id}`)),
|
|
370
|
+
onViewPlan: () => t && M(F(`crops/planning/${t.id}`))
|
|
184
371
|
}, e.id))
|
|
185
|
-
}) :
|
|
372
|
+
}) : k.crops ? /* @__PURE__ */ x(u, {}) : /* @__PURE__ */ x("p", {
|
|
186
373
|
className: "rounded-md border border-border-subtle bg-bg-surface p-4 text-sm text-text-secondary",
|
|
187
374
|
children: A("healthybowl.crops.planning.coverage.empty", "No crops available yet. Add crops before planning.")
|
|
188
375
|
})]
|
|
189
376
|
}),
|
|
190
|
-
|
|
377
|
+
$e.length > 0 ? /* @__PURE__ */ x("div", {
|
|
191
378
|
className: "grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
192
|
-
children:
|
|
379
|
+
children: $e.map((e) => /* @__PURE__ */ x(Ce, {
|
|
193
380
|
plan: e,
|
|
194
|
-
onClick: () =>
|
|
381
|
+
onClick: () => M(F(`crops/planning/${e.id}`))
|
|
195
382
|
}, e.id))
|
|
196
|
-
}) :
|
|
383
|
+
}) : k.crops ? /* @__PURE__ */ x(u, {}) : b.crops ? /* @__PURE__ */ x(s, { onRetry: me }) : /* @__PURE__ */ x(o, {
|
|
197
384
|
title: A("healthybowl.crops.planning.emptyState.title", "No plans found"),
|
|
198
|
-
description:
|
|
199
|
-
action: /* @__PURE__ */
|
|
200
|
-
onClick: () =>
|
|
385
|
+
description: L || R !== "all" || z !== "all" ? A("healthybowl.crops.planning.emptyState.filtered", "Try adjusting your search or filters.") : A("healthybowl.crops.planning.emptyState.message", "Get started by creating a new planting plan."),
|
|
386
|
+
action: /* @__PURE__ */ x(C, {
|
|
387
|
+
onClick: () => B(!0),
|
|
201
388
|
children: A("healthybowl.crops.planning.actions.createPlan", "Create Plan")
|
|
202
389
|
})
|
|
203
390
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
open:
|
|
391
|
+
/* @__PURE__ */ x(d, {
|
|
392
|
+
open: ke,
|
|
206
393
|
onClose: () => {
|
|
207
|
-
|
|
394
|
+
B(!1), Xe();
|
|
208
395
|
},
|
|
209
396
|
title: A("healthybowl.crops.planning.modal.title", "Add New Planting Plan"),
|
|
210
397
|
description: A("healthybowl.crops.planning.modal.description", "Create a new planting plan for your farm"),
|
|
211
398
|
size: "lg",
|
|
212
|
-
footer: /* @__PURE__ */
|
|
399
|
+
footer: /* @__PURE__ */ S(fe, { children: [/* @__PURE__ */ x(C, {
|
|
213
400
|
variant: "outline",
|
|
214
401
|
onClick: () => {
|
|
215
|
-
|
|
402
|
+
B(!1), Xe();
|
|
216
403
|
},
|
|
217
404
|
children: A("healthybowl.common.cancel", "Cancel")
|
|
218
|
-
}), /* @__PURE__ */
|
|
405
|
+
}), /* @__PURE__ */ x(C, {
|
|
219
406
|
onClick: async () => {
|
|
220
|
-
if (!
|
|
221
|
-
|
|
407
|
+
if (!V || !U) {
|
|
408
|
+
I({
|
|
222
409
|
title: A("healthybowl.crops.planning.toast.missingFields.title", "Missing required fields"),
|
|
223
410
|
description: A("healthybowl.crops.planning.toast.missingFields.description", "Please select a crop and field."),
|
|
224
411
|
variant: "warning"
|
|
@@ -226,33 +413,33 @@ var O = (e) => {
|
|
|
226
413
|
return;
|
|
227
414
|
}
|
|
228
415
|
try {
|
|
229
|
-
let e =
|
|
416
|
+
let e = y.find((e) => e.id === V);
|
|
230
417
|
if (!e) {
|
|
231
|
-
|
|
418
|
+
I({
|
|
232
419
|
title: A("healthybowl.crops.planning.toast.cropNotFound.title", "Crop not found"),
|
|
233
420
|
description: A("healthybowl.crops.planning.toast.cropNotFound.description", "Please select a valid crop."),
|
|
234
421
|
variant: "warning"
|
|
235
422
|
});
|
|
236
423
|
return;
|
|
237
424
|
}
|
|
238
|
-
await
|
|
425
|
+
await pe({
|
|
239
426
|
cropId: e.id,
|
|
240
|
-
fieldId:
|
|
241
|
-
season:
|
|
242
|
-
startDate:
|
|
243
|
-
endDate:
|
|
244
|
-
expectedYield: Number(
|
|
245
|
-
seedRequired: Number(
|
|
427
|
+
fieldId: U,
|
|
428
|
+
season: Ae,
|
|
429
|
+
startDate: Ne || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
430
|
+
endDate: Fe || void 0,
|
|
431
|
+
expectedYield: Number(Le) || 0,
|
|
432
|
+
seedRequired: Number(ze) || 0,
|
|
246
433
|
fertilizers: [],
|
|
247
|
-
priority:
|
|
434
|
+
priority: je,
|
|
248
435
|
weatherRisk: "low"
|
|
249
|
-
}),
|
|
436
|
+
}), I({
|
|
250
437
|
title: A("healthybowl.crops.planning.toast.planCreated.title", "Plan created"),
|
|
251
438
|
description: A("healthybowl.crops.planning.toast.planCreated.description", "New planting plan has been added."),
|
|
252
439
|
variant: "success"
|
|
253
|
-
}),
|
|
440
|
+
}), B(!1), Xe();
|
|
254
441
|
} catch (e) {
|
|
255
|
-
|
|
442
|
+
I({
|
|
256
443
|
title: A("healthybowl.crops.planning.toast.error.title", "Error"),
|
|
257
444
|
description: e instanceof Error ? e.message : A("healthybowl.crops.planning.toast.error.description", "Failed to create planting plan"),
|
|
258
445
|
variant: "error"
|
|
@@ -261,365 +448,441 @@ var O = (e) => {
|
|
|
261
448
|
},
|
|
262
449
|
children: A("healthybowl.crops.planning.actions.createPlan", "Create Plan")
|
|
263
450
|
})] }),
|
|
264
|
-
children: /* @__PURE__ */
|
|
451
|
+
children: /* @__PURE__ */ S("div", {
|
|
265
452
|
className: "grid gap-4 sm:grid-cols-2",
|
|
266
453
|
children: [
|
|
267
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
268
455
|
className: "text-sm font-medium text-text-primary",
|
|
269
456
|
children: A("healthybowl.crops.planning.form.fields.cropName.label", "Crop Name")
|
|
270
|
-
}), /* @__PURE__ */
|
|
271
|
-
value:
|
|
272
|
-
onValueChange:
|
|
273
|
-
children: [/* @__PURE__ */
|
|
457
|
+
}), /* @__PURE__ */ S(w, {
|
|
458
|
+
value: V,
|
|
459
|
+
onValueChange: lt,
|
|
460
|
+
children: [/* @__PURE__ */ x(D, {
|
|
274
461
|
className: "mt-1 w-full",
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
}), /* @__PURE__ */
|
|
462
|
+
children: /* @__PURE__ */ x(O, { placeholder: A("healthybowl.crops.planning.form.fields.cropName.placeholder", "Select crop...") })
|
|
463
|
+
}), /* @__PURE__ */ x(T, { children: y.map((e) => /* @__PURE__ */ x(E, {
|
|
277
464
|
value: e.id,
|
|
278
465
|
children: e.variety ? `${e.name} - ${e.variety}` : e.name
|
|
279
466
|
}, e.id)) })]
|
|
280
467
|
})] }),
|
|
281
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
282
469
|
className: "text-sm font-medium text-text-primary",
|
|
283
470
|
children: A("healthybowl.crops.planning.form.fields.field.label", "Field")
|
|
284
|
-
}), /* @__PURE__ */
|
|
285
|
-
value:
|
|
286
|
-
onValueChange:
|
|
287
|
-
children: [/* @__PURE__ */
|
|
471
|
+
}), /* @__PURE__ */ S(w, {
|
|
472
|
+
value: U,
|
|
473
|
+
onValueChange: W,
|
|
474
|
+
children: [/* @__PURE__ */ x(D, {
|
|
288
475
|
className: "mt-1 w-full",
|
|
289
|
-
children: /* @__PURE__ */
|
|
290
|
-
}), /* @__PURE__ */
|
|
476
|
+
children: /* @__PURE__ */ x(O, { placeholder: A("healthybowl.crops.planning.form.fields.field.placeholder", "Select field...") })
|
|
477
|
+
}), /* @__PURE__ */ x(T, { children: v.map((e) => /* @__PURE__ */ x(E, {
|
|
291
478
|
value: e.id,
|
|
292
479
|
children: e.name
|
|
293
480
|
}, e.id)) })]
|
|
294
481
|
})] }),
|
|
295
|
-
/* @__PURE__ */ x("div", {
|
|
482
|
+
$ && /* @__PURE__ */ x("div", {
|
|
483
|
+
className: "rounded-md border border-border-subtle bg-bg-sunken/60 p-3 sm:col-span-2",
|
|
484
|
+
children: /* @__PURE__ */ S("div", {
|
|
485
|
+
className: "grid grid-cols-2 gap-3 sm:grid-cols-4",
|
|
486
|
+
children: [
|
|
487
|
+
/* @__PURE__ */ x(P, {
|
|
488
|
+
compact: !0,
|
|
489
|
+
label: A("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
|
|
490
|
+
value: t($.bedCount)
|
|
491
|
+
}),
|
|
492
|
+
/* @__PURE__ */ x(P, {
|
|
493
|
+
compact: !0,
|
|
494
|
+
label: A("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
|
|
495
|
+
value: t($.plantsPerBed)
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ x(P, {
|
|
498
|
+
compact: !0,
|
|
499
|
+
label: A("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
500
|
+
value: t($.totalPlants)
|
|
501
|
+
}),
|
|
502
|
+
/* @__PURE__ */ x(P, {
|
|
503
|
+
compact: !0,
|
|
504
|
+
label: A("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
|
|
505
|
+
value: t($.seedlingTarget)
|
|
506
|
+
})
|
|
507
|
+
]
|
|
508
|
+
})
|
|
509
|
+
}),
|
|
510
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
296
511
|
className: "text-sm font-medium text-text-primary",
|
|
297
512
|
children: A("healthybowl.crops.planning.form.fields.season.label", "Season")
|
|
298
|
-
}), /* @__PURE__ */
|
|
299
|
-
value:
|
|
513
|
+
}), /* @__PURE__ */ S(w, {
|
|
514
|
+
value: Ae,
|
|
300
515
|
onValueChange: (e) => G(e),
|
|
301
|
-
children: [/* @__PURE__ */
|
|
516
|
+
children: [/* @__PURE__ */ x(D, {
|
|
302
517
|
className: "mt-1 w-full",
|
|
303
|
-
children: /* @__PURE__ */
|
|
304
|
-
}), /* @__PURE__ */
|
|
305
|
-
/* @__PURE__ */
|
|
518
|
+
children: /* @__PURE__ */ x(O, {})
|
|
519
|
+
}), /* @__PURE__ */ S(T, { children: [
|
|
520
|
+
/* @__PURE__ */ x(E, {
|
|
306
521
|
value: "kharif",
|
|
307
522
|
children: A("healthybowl.crops.planning.season.kharif", "Kharif")
|
|
308
523
|
}),
|
|
309
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ x(E, {
|
|
310
525
|
value: "rabi",
|
|
311
526
|
children: A("healthybowl.crops.planning.season.rabi", "Rabi")
|
|
312
527
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ x(E, {
|
|
314
529
|
value: "zaid",
|
|
315
530
|
children: A("healthybowl.crops.planning.season.zaid", "Zaid")
|
|
316
531
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ x(E, {
|
|
318
533
|
value: "perennial",
|
|
319
534
|
children: A("healthybowl.crops.planning.season.perennial", "Perennial")
|
|
320
535
|
})
|
|
321
536
|
] })]
|
|
322
537
|
})] }),
|
|
323
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
324
539
|
className: "text-sm font-medium text-text-primary",
|
|
325
540
|
children: A("healthybowl.crops.planning.form.fields.priority.label", "Priority")
|
|
326
|
-
}), /* @__PURE__ */
|
|
327
|
-
value:
|
|
328
|
-
onValueChange: (e) =>
|
|
329
|
-
children: [/* @__PURE__ */
|
|
541
|
+
}), /* @__PURE__ */ S(w, {
|
|
542
|
+
value: je,
|
|
543
|
+
onValueChange: (e) => Me(e),
|
|
544
|
+
children: [/* @__PURE__ */ x(D, {
|
|
330
545
|
className: "mt-1 w-full",
|
|
331
|
-
children: /* @__PURE__ */
|
|
332
|
-
}), /* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
546
|
+
children: /* @__PURE__ */ x(O, {})
|
|
547
|
+
}), /* @__PURE__ */ S(T, { children: [
|
|
548
|
+
/* @__PURE__ */ x(E, {
|
|
334
549
|
value: "low",
|
|
335
550
|
children: A("healthybowl.crops.planning.priority.low", "Low")
|
|
336
551
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ x(E, {
|
|
338
553
|
value: "medium",
|
|
339
554
|
children: A("healthybowl.crops.planning.priority.medium", "Medium")
|
|
340
555
|
}),
|
|
341
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ x(E, {
|
|
342
557
|
value: "high",
|
|
343
558
|
children: A("healthybowl.crops.planning.priority.high", "High")
|
|
344
559
|
})
|
|
345
560
|
] })]
|
|
346
561
|
})] }),
|
|
347
|
-
/* @__PURE__ */
|
|
562
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
348
563
|
className: "text-sm font-medium text-text-primary",
|
|
349
564
|
children: A("healthybowl.crops.planning.form.fields.startDate.label", "Start Date")
|
|
350
|
-
}), /* @__PURE__ */
|
|
565
|
+
}), /* @__PURE__ */ x("input", {
|
|
351
566
|
type: "date",
|
|
352
|
-
value:
|
|
353
|
-
onChange: (e) =>
|
|
567
|
+
value: Ne,
|
|
568
|
+
onChange: (e) => Pe(e.target.value),
|
|
354
569
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
355
570
|
})] }),
|
|
356
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
357
572
|
className: "text-sm font-medium text-text-primary",
|
|
358
573
|
children: A("healthybowl.crops.planning.form.fields.endDate.label", "End Date")
|
|
359
|
-
}), /* @__PURE__ */
|
|
574
|
+
}), /* @__PURE__ */ x("input", {
|
|
360
575
|
type: "date",
|
|
361
|
-
value:
|
|
362
|
-
onChange: (e) =>
|
|
576
|
+
value: Fe,
|
|
577
|
+
onChange: (e) => Ie(e.target.value),
|
|
363
578
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
364
579
|
})] }),
|
|
365
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
366
581
|
className: "text-sm font-medium text-text-primary",
|
|
367
582
|
children: A("healthybowl.crops.planning.form.fields.expectedYield.label", "Expected Yield (kg)")
|
|
368
|
-
}), /* @__PURE__ */
|
|
583
|
+
}), /* @__PURE__ */ x("input", {
|
|
369
584
|
type: "number",
|
|
370
585
|
placeholder: "0",
|
|
371
|
-
value:
|
|
372
|
-
onChange: (e) =>
|
|
586
|
+
value: Le,
|
|
587
|
+
onChange: (e) => Re(e.target.value),
|
|
373
588
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
374
589
|
})] }),
|
|
375
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
376
591
|
className: "text-sm font-medium text-text-primary",
|
|
377
592
|
children: A("healthybowl.crops.planning.form.fields.seedRequired.label", "Seed Required (kg)")
|
|
378
|
-
}), /* @__PURE__ */
|
|
593
|
+
}), /* @__PURE__ */ x("input", {
|
|
379
594
|
type: "number",
|
|
380
595
|
placeholder: "0",
|
|
381
|
-
value:
|
|
382
|
-
onChange: (e) =>
|
|
596
|
+
value: ze,
|
|
597
|
+
onChange: (e) => Be(e.target.value),
|
|
383
598
|
className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
384
599
|
})] })
|
|
385
600
|
]
|
|
386
601
|
})
|
|
387
602
|
}),
|
|
388
|
-
/* @__PURE__ */
|
|
389
|
-
toasts:
|
|
390
|
-
onDismiss:
|
|
603
|
+
/* @__PURE__ */ x(c, {
|
|
604
|
+
toasts: we,
|
|
605
|
+
onDismiss: Te
|
|
391
606
|
})
|
|
392
607
|
]
|
|
393
608
|
});
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
|
|
609
|
+
}, N = ({ label: e, unit: t, value: n, min: r, step: i, onChange: a }) => /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
610
|
+
className: "text-xs font-medium text-text-secondary",
|
|
611
|
+
children: e
|
|
612
|
+
}), /* @__PURE__ */ S("div", {
|
|
613
|
+
className: "relative mt-1",
|
|
614
|
+
children: [/* @__PURE__ */ x("input", {
|
|
615
|
+
type: "number",
|
|
616
|
+
value: n,
|
|
617
|
+
min: r,
|
|
618
|
+
step: i,
|
|
619
|
+
onChange: (e) => a(e.target.value),
|
|
620
|
+
className: "h-10 w-full rounded-md border border-border-subtle bg-bg-surface px-3 pr-10 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
621
|
+
}), /* @__PURE__ */ x("span", {
|
|
622
|
+
className: "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-xs text-text-secondary",
|
|
623
|
+
children: t
|
|
624
|
+
})]
|
|
625
|
+
})] }), P = ({ label: e, value: t, unit: n, compact: r = !1 }) => /* @__PURE__ */ S("div", {
|
|
626
|
+
className: r ? "min-w-0" : "min-w-0 rounded-md border border-border-subtle bg-bg-sunken/60 p-3",
|
|
627
|
+
children: [/* @__PURE__ */ x("span", {
|
|
628
|
+
className: "block truncate text-xs text-text-secondary",
|
|
629
|
+
children: e
|
|
630
|
+
}), /* @__PURE__ */ S("p", {
|
|
631
|
+
className: r ? "mt-0.5 truncate text-sm font-semibold text-text-primary" : "mt-1 text-lg font-semibold text-text-primary",
|
|
632
|
+
children: [t, n && /* @__PURE__ */ x("span", {
|
|
633
|
+
className: "ml-1 text-xs font-medium text-text-secondary",
|
|
634
|
+
children: n
|
|
635
|
+
})]
|
|
636
|
+
})]
|
|
637
|
+
}), Se = ({ crop: n, plan: r, planCount: i, capacityEstimate: o, onPlan: s, onViewCrop: c, onViewPlan: l }) => {
|
|
638
|
+
let { t: u } = _(), d = !!r;
|
|
639
|
+
return /* @__PURE__ */ S("div", {
|
|
397
640
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
|
|
398
641
|
children: [
|
|
399
|
-
/* @__PURE__ */
|
|
642
|
+
/* @__PURE__ */ S("div", {
|
|
400
643
|
className: "flex items-start justify-between gap-3",
|
|
401
|
-
children: [/* @__PURE__ */
|
|
644
|
+
children: [/* @__PURE__ */ S("div", {
|
|
402
645
|
className: "min-w-0",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
646
|
+
children: [/* @__PURE__ */ x("h3", {
|
|
404
647
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
405
|
-
children:
|
|
406
|
-
}), /* @__PURE__ */
|
|
648
|
+
children: n.name
|
|
649
|
+
}), /* @__PURE__ */ x("p", {
|
|
407
650
|
className: "mt-0.5 truncate text-xs text-text-secondary",
|
|
408
|
-
children:
|
|
651
|
+
children: n.variety || n.category
|
|
409
652
|
})]
|
|
410
|
-
}), /* @__PURE__ */
|
|
411
|
-
label:
|
|
412
|
-
variant:
|
|
653
|
+
}), /* @__PURE__ */ x(a, {
|
|
654
|
+
label: d ? u("healthybowl.crops.planning.coverage.card.planned", "Planned") : u("healthybowl.crops.planning.coverage.card.missing", "Needs plan"),
|
|
655
|
+
variant: d ? "success" : "warning"
|
|
413
656
|
})]
|
|
414
657
|
}),
|
|
415
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ S("div", {
|
|
416
659
|
className: "mt-3 grid grid-cols-2 gap-3 text-xs",
|
|
417
660
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
419
662
|
className: "text-text-secondary",
|
|
420
|
-
children:
|
|
421
|
-
}), /* @__PURE__ */
|
|
663
|
+
children: u("healthybowl.crops.planning.coverage.card.field", "Field")
|
|
664
|
+
}), /* @__PURE__ */ x("p", {
|
|
422
665
|
className: "mt-0.5 truncate font-medium text-text-primary",
|
|
423
|
-
children:
|
|
666
|
+
children: n.fieldName
|
|
424
667
|
})] }),
|
|
425
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
426
669
|
className: "text-text-secondary",
|
|
427
|
-
children:
|
|
428
|
-
}), /* @__PURE__ */
|
|
670
|
+
children: u("healthybowl.crops.planning.coverage.card.season", "Season")
|
|
671
|
+
}), /* @__PURE__ */ x("p", {
|
|
429
672
|
className: "mt-0.5 font-medium text-text-primary",
|
|
430
|
-
children:
|
|
673
|
+
children: he(n.season, u)
|
|
431
674
|
})] }),
|
|
432
|
-
/* @__PURE__ */
|
|
675
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
433
676
|
className: "text-text-secondary",
|
|
434
|
-
children:
|
|
435
|
-
}), /* @__PURE__ */
|
|
677
|
+
children: u("healthybowl.crops.planning.coverage.card.status", "Crop")
|
|
678
|
+
}), /* @__PURE__ */ x("p", {
|
|
436
679
|
className: "mt-0.5 capitalize font-medium text-text-primary",
|
|
437
|
-
children:
|
|
680
|
+
children: n.status.replace(/_/g, " ")
|
|
438
681
|
})] }),
|
|
439
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
440
683
|
className: "text-text-secondary",
|
|
441
|
-
children:
|
|
442
|
-
}), /* @__PURE__ */
|
|
684
|
+
children: u("healthybowl.crops.planning.coverage.card.harvest", "Harvest")
|
|
685
|
+
}), /* @__PURE__ */ x("p", {
|
|
443
686
|
className: "mt-0.5 font-medium text-text-primary",
|
|
444
|
-
children: e(
|
|
687
|
+
children: e(n.expectedHarvestDate)
|
|
445
688
|
})] })
|
|
446
689
|
]
|
|
447
690
|
}),
|
|
448
|
-
|
|
691
|
+
r && /* @__PURE__ */ S("div", {
|
|
449
692
|
className: "mt-3 rounded-md bg-bg-sunken/60 p-3",
|
|
450
693
|
children: [
|
|
451
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ S("div", {
|
|
452
695
|
className: "flex items-center justify-between gap-2",
|
|
453
|
-
children: [/* @__PURE__ */
|
|
696
|
+
children: [/* @__PURE__ */ x("span", {
|
|
454
697
|
className: "text-xs text-text-secondary",
|
|
455
|
-
children:
|
|
456
|
-
}), /* @__PURE__ */
|
|
457
|
-
label:
|
|
458
|
-
variant:
|
|
698
|
+
children: u("healthybowl.crops.planning.coverage.card.currentPlan", "Current plan")
|
|
699
|
+
}), /* @__PURE__ */ x(a, {
|
|
700
|
+
label: r.status,
|
|
701
|
+
variant: k(r.status ?? "unknown")
|
|
459
702
|
})]
|
|
460
703
|
}),
|
|
461
|
-
/* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ S("p", {
|
|
462
705
|
className: "mt-1 text-xs font-medium text-text-primary",
|
|
463
706
|
children: [
|
|
464
|
-
e(
|
|
707
|
+
e(r.startDate),
|
|
465
708
|
" - ",
|
|
466
|
-
e(
|
|
709
|
+
e(r.endDate)
|
|
467
710
|
]
|
|
468
711
|
}),
|
|
469
|
-
|
|
712
|
+
i > 1 && /* @__PURE__ */ x("p", {
|
|
470
713
|
className: "mt-1 text-xs text-text-secondary",
|
|
471
|
-
children:
|
|
714
|
+
children: u("healthybowl.crops.planning.coverage.card.planCount", "{{count}} plans total", { count: i })
|
|
472
715
|
})
|
|
473
716
|
]
|
|
474
717
|
}),
|
|
475
|
-
/* @__PURE__ */
|
|
718
|
+
o && /* @__PURE__ */ S("div", {
|
|
719
|
+
className: "mt-3 grid grid-cols-3 gap-2 rounded-md bg-bg-sunken/60 p-3",
|
|
720
|
+
children: [
|
|
721
|
+
/* @__PURE__ */ x(P, {
|
|
722
|
+
compact: !0,
|
|
723
|
+
label: u("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
|
|
724
|
+
value: t(o.bedCount)
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ x(P, {
|
|
727
|
+
compact: !0,
|
|
728
|
+
label: u("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
|
|
729
|
+
value: t(o.plantsPerBed)
|
|
730
|
+
}),
|
|
731
|
+
/* @__PURE__ */ x(P, {
|
|
732
|
+
compact: !0,
|
|
733
|
+
label: u("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
734
|
+
value: t(o.totalPlants)
|
|
735
|
+
})
|
|
736
|
+
]
|
|
737
|
+
}),
|
|
738
|
+
/* @__PURE__ */ S("div", {
|
|
476
739
|
className: "mt-4 flex gap-2",
|
|
477
|
-
children: [/* @__PURE__ */
|
|
740
|
+
children: [/* @__PURE__ */ S(C, {
|
|
478
741
|
variant: "outline",
|
|
479
742
|
size: "sm",
|
|
480
|
-
onClick:
|
|
743
|
+
onClick: c,
|
|
481
744
|
className: "min-w-0 flex-1",
|
|
482
745
|
children: [
|
|
483
|
-
/* @__PURE__ */
|
|
746
|
+
/* @__PURE__ */ x(le, { className: "h-4 w-4" }),
|
|
484
747
|
" ",
|
|
485
|
-
|
|
748
|
+
u("healthybowl.crops.planning.coverage.card.cropAction", "Crop")
|
|
486
749
|
]
|
|
487
|
-
}),
|
|
750
|
+
}), d ? /* @__PURE__ */ S(C, {
|
|
488
751
|
variant: "default",
|
|
489
752
|
size: "sm",
|
|
490
|
-
onClick:
|
|
753
|
+
onClick: l,
|
|
491
754
|
className: "min-w-0 flex-1",
|
|
492
755
|
children: [
|
|
493
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ x(ae, { className: "h-4 w-4" }),
|
|
494
757
|
" ",
|
|
495
|
-
|
|
758
|
+
u("healthybowl.crops.planning.coverage.card.planAction", "Plan")
|
|
496
759
|
]
|
|
497
|
-
}) : /* @__PURE__ */
|
|
760
|
+
}) : /* @__PURE__ */ S(C, {
|
|
498
761
|
variant: "default",
|
|
499
762
|
size: "sm",
|
|
500
|
-
onClick:
|
|
763
|
+
onClick: s,
|
|
501
764
|
className: "min-w-0 flex-1",
|
|
502
765
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ x(se, { className: "h-4 w-4" }),
|
|
504
767
|
" ",
|
|
505
|
-
|
|
768
|
+
u("healthybowl.crops.planning.coverage.card.createAction", "Plan crop")
|
|
506
769
|
]
|
|
507
770
|
})]
|
|
508
771
|
})
|
|
509
772
|
]
|
|
510
773
|
});
|
|
511
|
-
},
|
|
512
|
-
let { t: i } =
|
|
513
|
-
return /* @__PURE__ */
|
|
774
|
+
}, Ce = ({ plan: n, onClick: r }) => {
|
|
775
|
+
let { t: i } = _(), o = /* @__PURE__ */ new Date(), s = new Date(n.startDate), c = new Date(n.endDate).getTime() - s.getTime(), l = o.getTime() - s.getTime(), u = c > 0 ? Math.max(0, Math.min(100, Math.round(l / c * 100))) : 0;
|
|
776
|
+
return /* @__PURE__ */ S("div", {
|
|
514
777
|
onClick: r,
|
|
515
778
|
className: "group cursor-pointer rounded-lg border border-border-subtle bg-bg-surface p-5 shadow-sm transition-all hover:border-primary/30 hover:shadow-md",
|
|
516
779
|
children: [
|
|
517
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ S("div", {
|
|
518
781
|
className: "flex items-start justify-between",
|
|
519
|
-
children: [/* @__PURE__ */
|
|
782
|
+
children: [/* @__PURE__ */ S("div", {
|
|
520
783
|
className: "min-w-0 flex-1",
|
|
521
|
-
children: [/* @__PURE__ */
|
|
784
|
+
children: [/* @__PURE__ */ x("h3", {
|
|
522
785
|
className: "truncate text-sm font-semibold text-text-primary group-hover:text-primary",
|
|
523
786
|
children: n.cropName
|
|
524
|
-
}), /* @__PURE__ */
|
|
787
|
+
}), /* @__PURE__ */ S("div", {
|
|
525
788
|
className: "mt-1 flex items-center gap-1.5 text-xs text-text-secondary",
|
|
526
|
-
children: [/* @__PURE__ */
|
|
789
|
+
children: [/* @__PURE__ */ x(oe, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ x("span", {
|
|
527
790
|
className: "truncate",
|
|
528
791
|
children: n.fieldName
|
|
529
792
|
})]
|
|
530
793
|
})]
|
|
531
|
-
}), /* @__PURE__ */
|
|
794
|
+
}), /* @__PURE__ */ x(a, {
|
|
532
795
|
label: n.status,
|
|
533
|
-
variant:
|
|
796
|
+
variant: k(n.status ?? "unknown")
|
|
534
797
|
})]
|
|
535
798
|
}),
|
|
536
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ S("div", {
|
|
537
800
|
className: "mt-3 flex flex-wrap items-center gap-2",
|
|
538
801
|
children: [
|
|
539
|
-
/* @__PURE__ */
|
|
802
|
+
/* @__PURE__ */ x(a, {
|
|
540
803
|
label: i("healthybowl.crops.planning.card.priorityBadge", "Priority: {{priority}}", { priority: n.priority }),
|
|
541
|
-
variant:
|
|
804
|
+
variant: pe(n.priority)
|
|
542
805
|
}),
|
|
543
|
-
/* @__PURE__ */
|
|
806
|
+
/* @__PURE__ */ x(a, {
|
|
544
807
|
label: i("healthybowl.crops.planning.card.riskBadge", "Risk: {{risk}}", { risk: n.weatherRisk }),
|
|
545
|
-
variant:
|
|
808
|
+
variant: me(n.weatherRisk)
|
|
546
809
|
}),
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
label:
|
|
810
|
+
/* @__PURE__ */ x(a, {
|
|
811
|
+
label: he(n.season, i),
|
|
549
812
|
variant: "muted"
|
|
550
813
|
})
|
|
551
814
|
]
|
|
552
815
|
}),
|
|
553
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ S("div", {
|
|
554
817
|
className: "mt-4 grid grid-cols-2 gap-3",
|
|
555
|
-
children: [/* @__PURE__ */
|
|
818
|
+
children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
556
819
|
className: "text-xs text-text-secondary",
|
|
557
820
|
children: i("healthybowl.crops.planning.card.startDate", "Start Date")
|
|
558
|
-
}), /* @__PURE__ */
|
|
821
|
+
}), /* @__PURE__ */ S("p", {
|
|
559
822
|
className: "flex items-center gap-1 text-xs font-medium text-text-primary",
|
|
560
|
-
children: [/* @__PURE__ */ b
|
|
561
|
-
})] }), /* @__PURE__ */
|
|
823
|
+
children: [/* @__PURE__ */ x(b, { className: "h-3 w-3 text-text-secondary" }), e(n.startDate)]
|
|
824
|
+
})] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
562
825
|
className: "text-xs text-text-secondary",
|
|
563
826
|
children: i("healthybowl.crops.planning.card.endDate", "End Date")
|
|
564
|
-
}), /* @__PURE__ */
|
|
827
|
+
}), /* @__PURE__ */ S("p", {
|
|
565
828
|
className: "flex items-center gap-1 text-xs font-medium text-text-primary",
|
|
566
|
-
children: [/* @__PURE__ */ b
|
|
829
|
+
children: [/* @__PURE__ */ x(b, { className: "h-3 w-3 text-text-secondary" }), e(n.endDate)]
|
|
567
830
|
})] })]
|
|
568
831
|
}),
|
|
569
|
-
n.status === "active" && /* @__PURE__ */
|
|
832
|
+
n.status === "active" && /* @__PURE__ */ S("div", {
|
|
570
833
|
className: "mt-3",
|
|
571
|
-
children: [/* @__PURE__ */
|
|
834
|
+
children: [/* @__PURE__ */ S("div", {
|
|
572
835
|
className: "flex items-center justify-between text-xs text-text-secondary",
|
|
573
|
-
children: [/* @__PURE__ */
|
|
574
|
-
}), /* @__PURE__ */
|
|
836
|
+
children: [/* @__PURE__ */ x("span", { children: i("healthybowl.crops.planning.card.progress", "Progress") }), /* @__PURE__ */ S("span", { children: [u, "%"] })]
|
|
837
|
+
}), /* @__PURE__ */ x("div", {
|
|
575
838
|
className: "mt-1 h-1.5 rounded-full bg-bg-sunken",
|
|
576
|
-
children: /* @__PURE__ */
|
|
839
|
+
children: /* @__PURE__ */ x("div", {
|
|
577
840
|
className: "h-1.5 rounded-full bg-action-primary-bg transition-all",
|
|
578
841
|
style: { width: `${u}%` }
|
|
579
842
|
})
|
|
580
843
|
})]
|
|
581
844
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ S("div", {
|
|
583
846
|
className: "mt-4 grid grid-cols-2 gap-3",
|
|
584
|
-
children: [/* @__PURE__ */
|
|
847
|
+
children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
585
848
|
className: "text-xs text-text-secondary",
|
|
586
849
|
children: i("healthybowl.crops.planning.card.expectedYield", "Expected Yield")
|
|
587
|
-
}), /* @__PURE__ */
|
|
850
|
+
}), /* @__PURE__ */ S("p", {
|
|
588
851
|
className: "text-sm font-semibold text-text-primary",
|
|
589
852
|
children: [t(n.expectedYield), " kg"]
|
|
590
|
-
})] }), /* @__PURE__ */
|
|
853
|
+
})] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
591
854
|
className: "text-xs text-text-secondary",
|
|
592
855
|
children: i("healthybowl.crops.planning.card.seedRequired", "Seed Required")
|
|
593
|
-
}), /* @__PURE__ */
|
|
856
|
+
}), /* @__PURE__ */ S("p", {
|
|
594
857
|
className: "text-sm font-semibold text-text-primary",
|
|
595
858
|
children: [t(n.seedRequired), " kg"]
|
|
596
859
|
})] })]
|
|
597
860
|
}),
|
|
598
|
-
(n.fertilizers ?? []).length > 0 && /* @__PURE__ */
|
|
861
|
+
(n.fertilizers ?? []).length > 0 && /* @__PURE__ */ S("div", {
|
|
599
862
|
className: "mt-3",
|
|
600
|
-
children: [/* @__PURE__ */
|
|
863
|
+
children: [/* @__PURE__ */ x("span", {
|
|
601
864
|
className: "text-xs text-text-secondary",
|
|
602
865
|
children: i("healthybowl.crops.planning.card.fertilizers", "Fertilizers")
|
|
603
|
-
}), /* @__PURE__ */
|
|
866
|
+
}), /* @__PURE__ */ x("div", {
|
|
604
867
|
className: "mt-1 flex flex-wrap gap-1",
|
|
605
|
-
children: (n.fertilizers ?? []).map((e) => /* @__PURE__ */
|
|
868
|
+
children: (n.fertilizers ?? []).map((e) => /* @__PURE__ */ S("span", {
|
|
606
869
|
className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-primary",
|
|
607
|
-
children: [/* @__PURE__ */
|
|
870
|
+
children: [/* @__PURE__ */ x(y, { className: "h-2.5 w-2.5" }), e]
|
|
608
871
|
}, e))
|
|
609
872
|
})]
|
|
610
873
|
}),
|
|
611
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ S("div", {
|
|
612
875
|
className: "mt-4 flex items-center justify-end text-xs font-medium text-primary opacity-0 transition-opacity group-hover:opacity-100",
|
|
613
876
|
children: [
|
|
614
877
|
i("healthybowl.crops.planning.card.viewDetails", "View Details"),
|
|
615
878
|
" ",
|
|
616
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ x(v, { className: "ml-1 h-3 w-3" })
|
|
617
880
|
]
|
|
618
881
|
})
|
|
619
882
|
]
|
|
620
883
|
});
|
|
621
884
|
};
|
|
622
885
|
//#endregion
|
|
623
|
-
export {
|
|
886
|
+
export { M as CropPlanningPage };
|
|
624
887
|
|
|
625
888
|
//# sourceMappingURL=CropPlanningPage.js.map
|