@burdenoff/microfe-healthybowl 2026.1005.2 → 2026.1007.2
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/components/BedLayoutGrid.js +128 -115
- package/dist/healthybowl/components/BedLayoutGrid.js.map +1 -1
- package/dist/healthybowl/components/CropPicker.js +37 -0
- package/dist/healthybowl/components/CropPicker.js.map +1 -0
- package/dist/healthybowl/components/DataTable.js +125 -108
- package/dist/healthybowl/components/DataTable.js.map +1 -1
- package/dist/healthybowl/components/FilterBar.js +9 -6
- package/dist/healthybowl/components/FilterBar.js.map +1 -1
- package/dist/healthybowl/components/PlantCatalogPicker.js +32 -0
- package/dist/healthybowl/components/PlantCatalogPicker.js.map +1 -0
- package/dist/healthybowl/components/WorkspaceRecordPicker.js +164 -0
- package/dist/healthybowl/components/WorkspaceRecordPicker.js.map +1 -0
- package/dist/healthybowl/components/index.js +3 -1
- package/dist/healthybowl/hooks/useCropPage.js +71 -0
- package/dist/healthybowl/hooks/useCropPage.js.map +1 -0
- package/dist/healthybowl/hooks/usePlantCatalog.js +133 -44
- package/dist/healthybowl/hooks/usePlantCatalog.js.map +1 -1
- package/dist/healthybowl/hooks/usePlantingEstimate.js +6 -6
- package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -1
- package/dist/healthybowl/hooks/useWorkspaceRead.js +46 -0
- package/dist/healthybowl/hooks/useWorkspaceRead.js.map +1 -0
- package/dist/healthybowl/pages/HomePage.js +143 -142
- package/dist/healthybowl/pages/HomePage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/ReportsPage.js +8 -8
- package/dist/healthybowl/pages/catalog/PlantCatalogPage.js +266 -192
- package/dist/healthybowl/pages/catalog/PlantCatalogPage.js.map +1 -1
- package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js +58 -0
- package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js.map +1 -0
- package/dist/healthybowl/pages/catalog/browsePagination.js +24 -0
- package/dist/healthybowl/pages/catalog/browsePagination.js.map +1 -0
- package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js +6 -6
- package/dist/healthybowl/pages/crops/CropDetailsPage.js +340 -348
- package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +468 -434
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropsPage.js +633 -542
- package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +875 -800
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +459 -448
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/SuccessionCropLabel.js +21 -0
- package/dist/healthybowl/pages/crops/SuccessionCropLabel.js.map +1 -0
- package/dist/healthybowl/pages/crops/planningEdit.js +30 -0
- package/dist/healthybowl/pages/crops/planningEdit.js.map +1 -0
- package/dist/healthybowl/pages/fields/FieldMapPage.js +989 -941
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +6 -6
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +7 -7
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/TransactionsPage.js +541 -541
- package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +10 -10
- package/dist/healthybowl/pages/government-schemes/CommunicationPage.js +207 -207
- package/dist/healthybowl/pages/government-schemes/CommunicationPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js +38 -38
- package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js +15 -15
- package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +4 -4
- package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +4 -4
- package/dist/healthybowl/pages/livestock/FeedManagementPage.js +4 -4
- package/dist/healthybowl/pages/livestock/HealthRecordsPage.js +16 -16
- package/dist/healthybowl/pages/livestock/HealthRecordsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +4 -4
- package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js +4 -4
- package/dist/healthybowl/pages/market/MarketPricesPage.js +305 -305
- package/dist/healthybowl/pages/market/MarketPricesPage.js.map +1 -1
- package/dist/healthybowl/pages/network/CohortsPage.js +107 -107
- package/dist/healthybowl/pages/network/CohortsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/CommunityPage.js +247 -247
- package/dist/healthybowl/pages/network/CommunityPage.js.map +1 -1
- package/dist/healthybowl/pages/network/EventsPage.js +16 -16
- package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +470 -470
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/MentorsPage.js +6 -6
- package/dist/healthybowl/pages/pest-management/PestIssuesPage.js +8 -8
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +7 -7
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
- package/dist/healthybowl/pages/production/ProductionBatchesPage.js +7 -7
- package/dist/healthybowl/pages/production/RecipeManagementPage.js +5 -5
- package/dist/healthybowl/pages/production/ValueAddedProductsPage.js +7 -7
- package/dist/healthybowl/pages/soil/SoilTestsPage.js +6 -6
- package/dist/healthybowl/pages/soil/SoilTestsPage.js.map +1 -1
- package/dist/healthybowl/pages/suppliers/SuppliersPage.js +10 -10
- package/dist/healthybowl/pages/sustainability/CarbonCreditLedgerPage.js +6 -6
- package/dist/healthybowl/pages/terrace/PlantingFormModal.js +151 -131
- package/dist/healthybowl/pages/terrace/PlantingFormModal.js.map +1 -1
- package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +6 -6
- package/dist/healthybowl/utils/cropComparison.js +1 -1
- package/dist/healthybowl/utils/cropComparison.js.map +1 -1
- package/dist/healthybowl/utils/cropPicker.js +35 -0
- package/dist/healthybowl/utils/cropPicker.js.map +1 -0
- package/dist/healthybowl/utils/plantingCapacity.js +2 -2
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
- package/dist/healthybowl/utils/quotaLabels.js +8 -0
- package/dist/healthybowl/utils/quotaLabels.js.map +1 -0
- package/dist/healthybowl/utils/seedRate.js +1 -8
- package/dist/healthybowl/utils/seedRate.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
|
|
2
|
+
import { formatDate as t, formatNumber as n } from "../../utils/helpers.js";
|
|
3
|
+
import { PageLayout as r } from "../../components/PageLayout.js";
|
|
4
|
+
import { useBasePath as i } from "../../hooks/useBasePath.js";
|
|
5
|
+
import { StatCard as a } from "../../components/StatCard.js";
|
|
6
|
+
import { useCropDetail as o } from "../../hooks/useCropPage.js";
|
|
7
|
+
import { CropPicker as s } from "../../components/CropPicker.js";
|
|
8
|
+
import { PLANT_CATALOG_PAGE_QUERY as ee, useMatchedPlantCatalogEntry as te } from "../../hooks/usePlantCatalog.js";
|
|
9
|
+
import { StatusBadge as c } from "../../components/StatusBadge.js";
|
|
10
|
+
import { EmptyState as ne } from "../../components/EmptyState.js";
|
|
11
|
+
import { ErrorState as re } from "../../components/ErrorState.js";
|
|
12
|
+
import { ToastContainer as l } from "../../components/Toast.js";
|
|
13
|
+
import { Breadcrumbs as u } from "../../components/Breadcrumbs.js";
|
|
14
|
+
import { PageLoader as ie } from "../../components/PageLoader.js";
|
|
15
|
+
import { Modal as ae } from "../../components/Modal.js";
|
|
16
|
+
import { useToast as oe } from "../../hooks/useToast.js";
|
|
13
17
|
import "../../components/index.js";
|
|
14
|
-
import { useHealthyBowlData as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useEffect as
|
|
20
|
-
import { useI18n as
|
|
21
|
-
import { ArrowRight as
|
|
22
|
-
import { useNavigate as
|
|
23
|
-
import { Fragment as
|
|
18
|
+
import { useHealthyBowlData as se } from "../../hooks/useHealthyBowlData.js";
|
|
19
|
+
import { BED_GEOMETRY_NOTICE as ce, BED_GEOMETRY_NOTICE_SHORT as le, GROW_GEOMETRY_PROMPT as ue, capacityModelFor as d, growLocationTypeLabel as f, usesBedGeometry as p } from "../../utils/growLocationType.js";
|
|
20
|
+
import { DEFAULT_BED_WIDTH_M as m, DEFAULT_CROP_SPACING_PRESET as de, DEFAULT_PATH_WIDTH_M as fe, estimateGrowCapacity as pe, estimatePlantingCapacity as me, getCropSpacingPreset as h } from "../../utils/plantingCapacity.js";
|
|
21
|
+
import { computeSeedRate as he } from "../../utils/seedRate.js";
|
|
22
|
+
import { cropMatchesField as g } from "./planningEdit.js";
|
|
23
|
+
import { useEffect as ge, useMemo as _, useRef as _e, useState as v } from "react";
|
|
24
|
+
import { useI18n as ve } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
25
|
+
import { ArrowRight as ye, Beaker as be, Calendar as xe, ClipboardList as Se, MapPin as Ce, Plus as we, Search as Te, Sprout as Ee, Target as De } from "lucide-react";
|
|
26
|
+
import { useNavigate as Oe } from "react-router";
|
|
27
|
+
import { Fragment as ke, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
24
28
|
import { Button as x, Select as S, SelectContent as C, SelectItem as w, SelectTrigger as T, SelectValue as E } from "@burdenoff/fe-libs/ui";
|
|
29
|
+
import { useApolloClient as Ae } from "@apollo/client/react";
|
|
25
30
|
//#region src/healthybowl/pages/crops/CropPlanningPage.tsx
|
|
26
|
-
var
|
|
31
|
+
var je = (e) => {
|
|
27
32
|
switch (e) {
|
|
28
33
|
case "active": return "success";
|
|
29
34
|
case "approved": return "info";
|
|
@@ -31,19 +36,19 @@ var D = (e) => {
|
|
|
31
36
|
case "completed": return "default";
|
|
32
37
|
default: return "muted";
|
|
33
38
|
}
|
|
34
|
-
},
|
|
39
|
+
}, Me = (e) => {
|
|
35
40
|
switch (e) {
|
|
36
41
|
case "high": return "error";
|
|
37
42
|
case "medium": return "warning";
|
|
38
43
|
default: return "success";
|
|
39
44
|
}
|
|
40
|
-
},
|
|
45
|
+
}, D = (e) => {
|
|
41
46
|
switch (e) {
|
|
42
47
|
case "high": return "error";
|
|
43
48
|
case "medium": return "warning";
|
|
44
49
|
default: return "success";
|
|
45
50
|
}
|
|
46
|
-
},
|
|
51
|
+
}, Ne = (e, t) => {
|
|
47
52
|
switch (e) {
|
|
48
53
|
case "kharif": return t("healthybowl.crops.planning.season.kharif", "Kharif");
|
|
49
54
|
case "rabi": return t("healthybowl.crops.planning.season.rabi", "Rabi");
|
|
@@ -51,27 +56,27 @@ var D = (e) => {
|
|
|
51
56
|
case "perennial": return t("healthybowl.crops.planning.season.perennial", "Perennial");
|
|
52
57
|
default: return e;
|
|
53
58
|
}
|
|
54
|
-
}, O = (e) => (e ?? "").trim().toLowerCase(),
|
|
59
|
+
}, O = (e) => (e ?? "").trim().toLowerCase(), Pe = (e, t) => t.find((t) => e.fieldId ? t.id === e.fieldId : O(t.name) === O(e.fieldName)), k = (e, t) => t.find((t) => g(e, t)), Fe = (e, t) => e.cropId ? e.cropId === t.id : O(e.cropName) === O(t.name), A = (e, t) => {
|
|
55
60
|
let n = Number(e);
|
|
56
61
|
return Number.isFinite(n) && n > 0 ? n : t;
|
|
57
|
-
},
|
|
62
|
+
}, Ie = (e, t) => {
|
|
58
63
|
let n = Number(e);
|
|
59
64
|
return Number.isFinite(n) && n >= 0 ? n : t;
|
|
60
|
-
},
|
|
65
|
+
}, Le = (e, t = 1) => new Intl.NumberFormat("en-US", { maximumFractionDigits: t }).format(e), Re = (e, t) => {
|
|
61
66
|
if (!t || !p(t.type)) return null;
|
|
62
|
-
let n =
|
|
63
|
-
return
|
|
67
|
+
let n = h(e);
|
|
68
|
+
return me({
|
|
64
69
|
fieldArea: t.area,
|
|
65
70
|
fieldUnit: t.unit,
|
|
66
|
-
bedWidthM:
|
|
67
|
-
pathWidthM:
|
|
71
|
+
bedWidthM: m,
|
|
72
|
+
pathWidthM: fe,
|
|
68
73
|
plantSpacingCm: n.plantSpacingCm,
|
|
69
74
|
rowSpacingCm: n.rowSpacingCm
|
|
70
75
|
});
|
|
71
|
-
},
|
|
76
|
+
}, ze = (e, t) => {
|
|
72
77
|
if (!t) return null;
|
|
73
|
-
let n =
|
|
74
|
-
return
|
|
78
|
+
let n = h(e);
|
|
79
|
+
return pe({
|
|
75
80
|
type: t.type,
|
|
76
81
|
geometry: t.growGeometry,
|
|
77
82
|
fieldArea: t.area,
|
|
@@ -80,151 +85,164 @@ var D = (e) => {
|
|
|
80
85
|
rowSpacingCm: n.rowSpacingCm
|
|
81
86
|
});
|
|
82
87
|
}, j = () => {
|
|
83
|
-
let {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
let { workspaceId: t } = e();
|
|
89
|
+
return t ? /* @__PURE__ */ y(Be, {}, t) : /* @__PURE__ */ y(r, {
|
|
90
|
+
title: "Crop Planning",
|
|
91
|
+
children: /* @__PURE__ */ y("p", {
|
|
92
|
+
className: "text-sm text-text-secondary",
|
|
93
|
+
children: "Choose a workspace to plan its crops."
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}, Be = () => {
|
|
97
|
+
let { plantingPlans: e, fields: t, crops: g, errors: ye, loadings: be, createPlantingPlan: xe, refetch: je } = se(), Me = Ae(), { t: D } = ve(), O = Oe(), { buildPath: j } = i(), { toasts: Be, toast: P, dismiss: Ue } = oe(), [We, Ge] = v(""), [Ke, qe] = v("all"), [Je, Ye] = v("all"), [Xe, F] = v(!1), [Ze, Qe] = v(""), [I, $e] = v(""), [et, tt] = v("kharif"), [nt, rt] = v("low"), [it, at] = v(""), [ot, st] = v(""), [ct, lt] = v(""), [ut, dt] = v(""), [ft, pt] = v(""), [L, mt] = v(""), [R, ht] = v(String(de.plantSpacingCm)), [z, gt] = v(String(de.rowSpacingCm)), [_t, vt] = v(String(m)), [yt, bt] = v(String(fe)), B = _e({
|
|
98
|
+
plant: !1,
|
|
99
|
+
row: !1
|
|
100
|
+
}), xt = () => {
|
|
101
|
+
Qe(""), $e(""), tt("kharif"), rt("low"), at(""), st(""), lt(""), dt("");
|
|
102
|
+
}, { crop: St } = o(ft), V = _(() => t.find((e) => e.id === L) ?? null, [L, t]), H = _(() => h(St), [St]), U = p(V?.type), W = _(() => !V || !p(V.type) ? null : me({
|
|
103
|
+
fieldArea: V.area,
|
|
104
|
+
fieldUnit: V.unit,
|
|
105
|
+
bedWidthM: A(_t, m),
|
|
106
|
+
pathWidthM: Ie(yt, fe),
|
|
107
|
+
plantSpacingCm: A(R, H.plantSpacingCm),
|
|
108
|
+
rowSpacingCm: A(z, H.rowSpacingCm)
|
|
92
109
|
}), [
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
_t,
|
|
111
|
+
yt,
|
|
112
|
+
R,
|
|
113
|
+
z,
|
|
95
114
|
V,
|
|
96
|
-
H
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
plantSpacingCm: A(V, W.plantSpacingCm),
|
|
105
|
-
rowSpacingCm: A(H, W.rowSpacingCm)
|
|
115
|
+
H
|
|
116
|
+
]), G = _(() => !V || !St ? null : pe({
|
|
117
|
+
type: V.type,
|
|
118
|
+
geometry: V.growGeometry,
|
|
119
|
+
fieldArea: V.area,
|
|
120
|
+
fieldUnit: V.unit,
|
|
121
|
+
plantSpacingCm: A(R, H.plantSpacingCm),
|
|
122
|
+
rowSpacingCm: A(z, H.rowSpacingCm)
|
|
106
123
|
}), [
|
|
107
|
-
U,
|
|
108
|
-
mt,
|
|
109
124
|
V,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
St,
|
|
126
|
+
R,
|
|
127
|
+
z,
|
|
128
|
+
H
|
|
129
|
+
]), K = o(Ze, { skip: !Xe }), q = K.crop, J = te(q, { skip: !Xe }), Y = J.entry, X = _(() => t.find((e) => e.id === I) ?? null, [t, I]), Ct = p(X?.type), Z = _(() => {
|
|
130
|
+
if (!q || !X || !p(X.type)) return null;
|
|
131
|
+
let e = h(q);
|
|
132
|
+
return me({
|
|
133
|
+
fieldArea: X.area,
|
|
134
|
+
fieldUnit: X.unit,
|
|
135
|
+
bedWidthM: m,
|
|
136
|
+
pathWidthM: fe,
|
|
120
137
|
plantSpacingCm: e.plantSpacingCm,
|
|
121
138
|
rowSpacingCm: e.rowSpacingCm
|
|
122
139
|
});
|
|
123
|
-
}, [
|
|
124
|
-
if (!
|
|
125
|
-
let e =
|
|
126
|
-
return
|
|
127
|
-
type:
|
|
128
|
-
geometry:
|
|
129
|
-
fieldArea:
|
|
130
|
-
fieldUnit:
|
|
140
|
+
}, [q, X]), Q = _(() => {
|
|
141
|
+
if (!q || !X) return null;
|
|
142
|
+
let e = h(q);
|
|
143
|
+
return pe({
|
|
144
|
+
type: X.type,
|
|
145
|
+
geometry: X.growGeometry,
|
|
146
|
+
fieldArea: X.area,
|
|
147
|
+
fieldUnit: X.unit,
|
|
131
148
|
plantSpacingCm: e.plantSpacingCm,
|
|
132
149
|
rowSpacingCm: e.rowSpacingCm
|
|
133
150
|
});
|
|
134
|
-
}, [
|
|
135
|
-
plantsNeeded:
|
|
136
|
-
seedsPerGram:
|
|
137
|
-
germinationRate:
|
|
138
|
-
seedsPerCell:
|
|
151
|
+
}, [q, X]), wt = _(() => Z ? Z.totalPlants : Q ? Q.totalPlants : null, [Z, Q]), $ = _(() => wt == null || Q && !Q.usesSeed ? null : he({
|
|
152
|
+
plantsNeeded: wt,
|
|
153
|
+
seedsPerGram: Y?.seedsPerGram ?? null,
|
|
154
|
+
germinationRate: Y?.germinationRate ?? null,
|
|
155
|
+
seedsPerCell: Y?.seedsPerCell ?? null
|
|
139
156
|
}), [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
157
|
+
wt,
|
|
158
|
+
Q,
|
|
159
|
+
Y
|
|
143
160
|
]);
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
let e =
|
|
147
|
-
|
|
161
|
+
ge(() => {
|
|
162
|
+
if (ft || g.length === 0) return;
|
|
163
|
+
let e = g[0], n = h(e), r = k(e, t);
|
|
164
|
+
pt(e.id), B.current.plant || ht(String(n.plantSpacingCm)), B.current.row || gt(String(n.rowSpacingCm)), r && mt(r.id);
|
|
148
165
|
}, [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
]),
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
-
let
|
|
156
|
-
let t = (e.cropName ?? "").toLowerCase().includes(
|
|
166
|
+
ft,
|
|
167
|
+
g,
|
|
168
|
+
t
|
|
169
|
+
]), ge(() => {
|
|
170
|
+
L || t.length === 0 || mt(t[0].id);
|
|
171
|
+
}, [L, t]);
|
|
172
|
+
let Tt = e.filter((e) => {
|
|
173
|
+
let t = (e.cropName ?? "").toLowerCase().includes(We.toLowerCase()) || (e.fieldName ?? "").toLowerCase().includes(We.toLowerCase()), n = Ke === "all" || e.status === Ke, r = Je === "all" || e.season === Je;
|
|
157
174
|
return t && n && r;
|
|
158
|
-
}),
|
|
159
|
-
let
|
|
160
|
-
return e + (
|
|
161
|
-
}, 0),
|
|
162
|
-
let
|
|
175
|
+
}), Et = e.length, Dt = e.reduce((e, t) => e + t.expectedYield, 0), Ot = e.filter((e) => e.status === "active" || e.status === "approved").length, kt = [...new Set(e.map((e) => e.season))], At = [...new Set(e.map((e) => e.status))], jt = e.reduce((e, n) => {
|
|
176
|
+
let r = Pe(n, t);
|
|
177
|
+
return e + (r ? r.area : 0);
|
|
178
|
+
}, 0), Mt = g.map((n) => {
|
|
179
|
+
let r = e.filter((e) => Fe(e, n)), i = k(n, t);
|
|
163
180
|
return {
|
|
164
|
-
crop:
|
|
165
|
-
plans:
|
|
166
|
-
activePlan:
|
|
167
|
-
capacityEstimate:
|
|
168
|
-
growCapacityEstimate:
|
|
169
|
-
capacityNotApplicableFor:
|
|
170
|
-
awaitingGeometryFor:
|
|
181
|
+
crop: n,
|
|
182
|
+
plans: r,
|
|
183
|
+
activePlan: r.find((e) => e.status !== "completed") ?? r[0],
|
|
184
|
+
capacityEstimate: Re(n, i),
|
|
185
|
+
growCapacityEstimate: ze(n, i),
|
|
186
|
+
capacityNotApplicableFor: i && !p(i.type) && d(i.type) === "NONE" ? i : null,
|
|
187
|
+
awaitingGeometryFor: i && !p(i.type) && d(i.type) !== "NONE" && ze(n, i) === null ? i : null
|
|
171
188
|
};
|
|
172
|
-
}),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
189
|
+
}), Nt = Mt.filter((e) => e.plans.length > 0).length, Pt = (e, n) => {
|
|
190
|
+
if (pt(e), !n) return;
|
|
191
|
+
let r = h(n), i = k(n, t);
|
|
192
|
+
B.current = {
|
|
193
|
+
plant: !1,
|
|
194
|
+
row: !1
|
|
195
|
+
}, ht(String(r.plantSpacingCm)), gt(String(r.rowSpacingCm)), i && mt(i.id);
|
|
196
|
+
}, Ft = (e, n) => {
|
|
197
|
+
if (Qe(e), !n) return;
|
|
198
|
+
let r = k(n, t);
|
|
199
|
+
tt(n.season), r && $e(r.id);
|
|
200
|
+
}, It = (e) => {
|
|
201
|
+
let n = k(e, t);
|
|
202
|
+
Qe(e.id), $e(n?.id ?? ""), tt(e.season), at(e.plantingDate || ""), st(e.expectedHarvestDate || ""), lt(e.yieldEstimate ? String(e.yieldEstimate) : ""), dt(""), F(!0);
|
|
185
203
|
};
|
|
186
|
-
return /* @__PURE__ */ b(
|
|
187
|
-
title:
|
|
188
|
-
description:
|
|
204
|
+
return /* @__PURE__ */ b(r, {
|
|
205
|
+
title: D("healthybowl.crops.planning.title", "Crop Planning"),
|
|
206
|
+
description: D("healthybowl.crops.planning.subtitle", "Manage planting plans and schedules"),
|
|
189
207
|
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.",
|
|
190
208
|
actions: /* @__PURE__ */ b(x, {
|
|
191
|
-
onClick: () =>
|
|
209
|
+
onClick: () => F(!0),
|
|
192
210
|
children: [
|
|
193
|
-
/* @__PURE__ */ y(
|
|
211
|
+
/* @__PURE__ */ y(we, { className: "h-4 w-4" }),
|
|
194
212
|
" ",
|
|
195
|
-
|
|
213
|
+
D("healthybowl.crops.planning.actions.addPlan", "Add New Plan")
|
|
196
214
|
]
|
|
197
215
|
}),
|
|
198
216
|
children: [
|
|
199
|
-
/* @__PURE__ */ y(
|
|
200
|
-
label:
|
|
201
|
-
href:
|
|
202
|
-
}, { label:
|
|
217
|
+
/* @__PURE__ */ y(u, { items: [{
|
|
218
|
+
label: D("healthybowl.crops.planning.breadcrumbs.crops", "Crops"),
|
|
219
|
+
href: j("crops")
|
|
220
|
+
}, { label: D("healthybowl.crops.planning.breadcrumbs.planning", "Planning") }] }),
|
|
203
221
|
/* @__PURE__ */ b("div", {
|
|
204
222
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
205
223
|
children: [
|
|
206
|
-
/* @__PURE__ */ y(
|
|
224
|
+
/* @__PURE__ */ y(a, {
|
|
207
225
|
hero: !0,
|
|
208
|
-
label:
|
|
209
|
-
value:
|
|
210
|
-
icon: /* @__PURE__ */ y(
|
|
226
|
+
label: D("healthybowl.crops.planning.stats.loadedPlans", "Loaded Plans"),
|
|
227
|
+
value: Et,
|
|
228
|
+
icon: /* @__PURE__ */ y(Se, { className: "h-5 w-5" })
|
|
211
229
|
}),
|
|
212
|
-
/* @__PURE__ */ y(
|
|
213
|
-
label:
|
|
214
|
-
value:
|
|
230
|
+
/* @__PURE__ */ y(a, {
|
|
231
|
+
label: D("healthybowl.crops.planning.stats.loadedPlannedArea", "Area of Loaded Plans"),
|
|
232
|
+
value: jt,
|
|
215
233
|
unit: "acres",
|
|
216
|
-
icon: /* @__PURE__ */ y(
|
|
234
|
+
icon: /* @__PURE__ */ y(Ce, { className: "h-5 w-5" })
|
|
217
235
|
}),
|
|
218
|
-
/* @__PURE__ */ y(
|
|
219
|
-
label:
|
|
220
|
-
value:
|
|
236
|
+
/* @__PURE__ */ y(a, {
|
|
237
|
+
label: D("healthybowl.crops.planning.stats.loadedExpectedYield", "Yield of Loaded Plans"),
|
|
238
|
+
value: Dt,
|
|
221
239
|
unit: "kg",
|
|
222
|
-
icon: /* @__PURE__ */ y(
|
|
240
|
+
icon: /* @__PURE__ */ y(De, { className: "h-5 w-5" })
|
|
223
241
|
}),
|
|
224
|
-
/* @__PURE__ */ y(
|
|
225
|
-
label:
|
|
226
|
-
value:
|
|
227
|
-
icon: /* @__PURE__ */ y(
|
|
242
|
+
/* @__PURE__ */ y(a, {
|
|
243
|
+
label: D("healthybowl.crops.planning.stats.loadedActivePlans", "Active Loaded Plans"),
|
|
244
|
+
value: Ot,
|
|
245
|
+
icon: /* @__PURE__ */ y(Ee, { className: "h-5 w-5" })
|
|
228
246
|
})
|
|
229
247
|
]
|
|
230
248
|
}),
|
|
@@ -233,40 +251,40 @@ var D = (e) => {
|
|
|
233
251
|
children: [
|
|
234
252
|
/* @__PURE__ */ b("div", {
|
|
235
253
|
className: "relative flex-1",
|
|
236
|
-
children: [/* @__PURE__ */ y(
|
|
254
|
+
children: [/* @__PURE__ */ y(Te, { className: "absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ y("input", {
|
|
237
255
|
type: "text",
|
|
238
|
-
value:
|
|
239
|
-
onChange: (e) =>
|
|
240
|
-
placeholder:
|
|
256
|
+
value: We,
|
|
257
|
+
onChange: (e) => Ge(e.target.value),
|
|
258
|
+
placeholder: D("healthybowl.crops.planning.search.placeholder", "Search plans by crop or field..."),
|
|
241
259
|
className: "w-full rounded-md border border-border-subtle bg-bg-surface py-2 ps-10 pe-4 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
242
260
|
})]
|
|
243
261
|
}),
|
|
244
262
|
/* @__PURE__ */ b(S, {
|
|
245
|
-
value:
|
|
246
|
-
onValueChange:
|
|
263
|
+
value: Ke,
|
|
264
|
+
onValueChange: qe,
|
|
247
265
|
children: [/* @__PURE__ */ y(T, {
|
|
248
266
|
className: "h-9 w-auto",
|
|
249
|
-
children: /* @__PURE__ */ y(E, { placeholder:
|
|
267
|
+
children: /* @__PURE__ */ y(E, { placeholder: D("healthybowl.crops.planning.filters.allStatuses", "All Statuses") })
|
|
250
268
|
}), /* @__PURE__ */ b(C, { children: [/* @__PURE__ */ y(w, {
|
|
251
269
|
value: "all",
|
|
252
|
-
children:
|
|
253
|
-
}),
|
|
270
|
+
children: D("healthybowl.crops.planning.filters.allStatuses", "All Statuses")
|
|
271
|
+
}), At.map((e) => /* @__PURE__ */ y(w, {
|
|
254
272
|
value: e,
|
|
255
273
|
children: (e ?? "").charAt(0).toUpperCase() + (e ?? "").slice(1)
|
|
256
274
|
}, e))] })]
|
|
257
275
|
}),
|
|
258
276
|
/* @__PURE__ */ b(S, {
|
|
259
|
-
value:
|
|
260
|
-
onValueChange:
|
|
277
|
+
value: Je,
|
|
278
|
+
onValueChange: Ye,
|
|
261
279
|
children: [/* @__PURE__ */ y(T, {
|
|
262
280
|
className: "h-9 w-auto",
|
|
263
|
-
children: /* @__PURE__ */ y(E, { placeholder:
|
|
281
|
+
children: /* @__PURE__ */ y(E, { placeholder: D("healthybowl.crops.planning.filters.allSeasons", "All Seasons") })
|
|
264
282
|
}), /* @__PURE__ */ b(C, { children: [/* @__PURE__ */ y(w, {
|
|
265
283
|
value: "all",
|
|
266
|
-
children:
|
|
267
|
-
}),
|
|
284
|
+
children: D("healthybowl.crops.planning.filters.allSeasons", "All Seasons")
|
|
285
|
+
}), kt.map((e) => /* @__PURE__ */ y(w, {
|
|
268
286
|
value: e,
|
|
269
|
-
children:
|
|
287
|
+
children: Ne(e, D)
|
|
270
288
|
}, e))] })]
|
|
271
289
|
})
|
|
272
290
|
]
|
|
@@ -278,9 +296,9 @@ var D = (e) => {
|
|
|
278
296
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
279
297
|
children: [/* @__PURE__ */ y("h2", {
|
|
280
298
|
className: "text-sm font-semibold text-text-primary",
|
|
281
|
-
children:
|
|
282
|
-
}), /* @__PURE__ */ y(
|
|
283
|
-
label:
|
|
299
|
+
children: D("healthybowl.crops.planning.capacity.title", "Planting capacity")
|
|
300
|
+
}), /* @__PURE__ */ y(c, {
|
|
301
|
+
label: U ? H.label : f(D, V?.type),
|
|
284
302
|
variant: "muted"
|
|
285
303
|
})]
|
|
286
304
|
}),
|
|
@@ -290,141 +308,143 @@ var D = (e) => {
|
|
|
290
308
|
/* @__PURE__ */ b("div", {
|
|
291
309
|
className: "xl:col-span-2",
|
|
292
310
|
children: [/* @__PURE__ */ y("label", {
|
|
311
|
+
htmlFor: "planner-capacity-crop",
|
|
293
312
|
className: "text-xs font-medium text-text-secondary",
|
|
294
|
-
children:
|
|
295
|
-
}), /* @__PURE__ */
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
value: e.id,
|
|
303
|
-
children: e.variety ? `${e.name} - ${e.variety}` : e.name
|
|
304
|
-
}, e.id)) })]
|
|
313
|
+
children: D("healthybowl.crops.planning.capacity.crop", "Crop")
|
|
314
|
+
}), /* @__PURE__ */ y(s, {
|
|
315
|
+
id: "planner-capacity-crop",
|
|
316
|
+
value: ft,
|
|
317
|
+
onValueChange: Pt,
|
|
318
|
+
options: g,
|
|
319
|
+
placeholder: D("healthybowl.crops.planning.capacity.cropPlaceholder", "Select crop"),
|
|
320
|
+
className: "mt-1"
|
|
305
321
|
})]
|
|
306
322
|
}),
|
|
307
323
|
/* @__PURE__ */ b("div", {
|
|
308
324
|
className: "xl:col-span-2",
|
|
309
325
|
children: [/* @__PURE__ */ y("label", {
|
|
310
326
|
className: "text-xs font-medium text-text-secondary",
|
|
311
|
-
children:
|
|
327
|
+
children: D("healthybowl.crops.planning.capacity.field", "Field")
|
|
312
328
|
}), /* @__PURE__ */ b(S, {
|
|
313
|
-
value:
|
|
314
|
-
onValueChange:
|
|
329
|
+
value: L,
|
|
330
|
+
onValueChange: mt,
|
|
315
331
|
children: [/* @__PURE__ */ y(T, {
|
|
316
332
|
"data-testid": "planner-capacity-field-select",
|
|
317
333
|
className: "mt-1 w-full",
|
|
318
|
-
children: /* @__PURE__ */ y(E, { placeholder:
|
|
319
|
-
}), /* @__PURE__ */ y(C, { children:
|
|
334
|
+
children: /* @__PURE__ */ y(E, { placeholder: D("healthybowl.crops.planning.capacity.fieldPlaceholder", "Select field") })
|
|
335
|
+
}), /* @__PURE__ */ y(C, { children: t.map((e) => /* @__PURE__ */ y(w, {
|
|
320
336
|
value: e.id,
|
|
321
|
-
children: `${e.name} · ${f(
|
|
337
|
+
children: `${e.name} · ${f(D, e.type)}`
|
|
322
338
|
}, e.id)) })]
|
|
323
339
|
})]
|
|
324
340
|
}),
|
|
325
|
-
(
|
|
341
|
+
(U || V != null && d(V.type) !== "NONE") && /* @__PURE__ */ b(ke, { children: [
|
|
326
342
|
/* @__PURE__ */ y(M, {
|
|
327
|
-
label:
|
|
343
|
+
label: D("healthybowl.crops.planning.capacity.plantSpacing", "Plant spacing"),
|
|
328
344
|
unit: "cm",
|
|
329
|
-
value:
|
|
345
|
+
value: R,
|
|
330
346
|
min: "1",
|
|
331
347
|
step: "1",
|
|
332
|
-
onChange:
|
|
348
|
+
onChange: (e) => {
|
|
349
|
+
B.current.plant = !0, ht(e);
|
|
350
|
+
}
|
|
333
351
|
}),
|
|
334
352
|
/* @__PURE__ */ y(M, {
|
|
335
|
-
label:
|
|
353
|
+
label: D("healthybowl.crops.planning.capacity.rowSpacing", "Row spacing"),
|
|
336
354
|
unit: "cm",
|
|
337
|
-
value:
|
|
355
|
+
value: z,
|
|
338
356
|
min: "1",
|
|
339
357
|
step: "1",
|
|
340
|
-
onChange:
|
|
358
|
+
onChange: (e) => {
|
|
359
|
+
B.current.row = !0, gt(e);
|
|
360
|
+
}
|
|
341
361
|
}),
|
|
342
|
-
|
|
343
|
-
label:
|
|
362
|
+
U && /* @__PURE__ */ b(ke, { children: [/* @__PURE__ */ y(M, {
|
|
363
|
+
label: D("healthybowl.crops.planning.capacity.bedWidth", "Bed width"),
|
|
344
364
|
unit: "m",
|
|
345
|
-
value:
|
|
365
|
+
value: _t,
|
|
346
366
|
min: "0.1",
|
|
347
367
|
step: "0.1",
|
|
348
|
-
onChange:
|
|
368
|
+
onChange: vt
|
|
349
369
|
}), /* @__PURE__ */ y(M, {
|
|
350
|
-
label:
|
|
370
|
+
label: D("healthybowl.crops.planning.capacity.pathWidth", "Path width"),
|
|
351
371
|
unit: "m",
|
|
352
|
-
value:
|
|
372
|
+
value: yt,
|
|
353
373
|
min: "0",
|
|
354
374
|
step: "0.05",
|
|
355
|
-
onChange:
|
|
375
|
+
onChange: bt
|
|
356
376
|
})] })
|
|
357
377
|
] })
|
|
358
378
|
]
|
|
359
379
|
}),
|
|
360
|
-
|
|
380
|
+
G ? /* @__PURE__ */ b("div", {
|
|
361
381
|
className: "mt-4 grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5",
|
|
362
382
|
"data-testid": "planning-grow-capacity",
|
|
363
|
-
"data-model":
|
|
383
|
+
"data-model": G.model,
|
|
364
384
|
children: [
|
|
365
385
|
/* @__PURE__ */ y(N, {
|
|
366
|
-
label:
|
|
367
|
-
value:
|
|
386
|
+
label: G.model === "TREE" ? D("healthybowl.crops.planning.capacity.metrics.block", "Block") : G.model === "RACK" ? D("healthybowl.crops.planning.capacity.metrics.racks", "Racks") : D("healthybowl.crops.planning.capacity.metrics.benches", "Benches"),
|
|
387
|
+
value: n(G.unitCount)
|
|
368
388
|
}),
|
|
369
389
|
/* @__PURE__ */ y(N, {
|
|
370
|
-
label:
|
|
371
|
-
value:
|
|
390
|
+
label: D("healthybowl.crops.planning.capacity.metrics.plantsPerUnit", "Plants / unit"),
|
|
391
|
+
value: n(G.plantsPerUnit)
|
|
372
392
|
}),
|
|
373
393
|
/* @__PURE__ */ y(N, {
|
|
374
|
-
label:
|
|
375
|
-
value:
|
|
394
|
+
label: G.model === "TREE" ? D("healthybowl.crops.planning.capacity.metrics.totalTrees", "Total trees") : D("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
395
|
+
value: n(G.totalPlants)
|
|
376
396
|
}),
|
|
377
|
-
|
|
378
|
-
label:
|
|
379
|
-
value:
|
|
397
|
+
G.seedlingTarget != null && /* @__PURE__ */ y(N, {
|
|
398
|
+
label: D("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
|
|
399
|
+
value: n(G.seedlingTarget)
|
|
380
400
|
}),
|
|
381
401
|
/* @__PURE__ */ y(N, {
|
|
382
|
-
label:
|
|
383
|
-
value:
|
|
402
|
+
label: D("healthybowl.crops.planning.capacity.metrics.growingArea", "Growing area"),
|
|
403
|
+
value: Le(G.usableAreaSqm, 1),
|
|
384
404
|
unit: "m²"
|
|
385
405
|
})
|
|
386
406
|
]
|
|
387
|
-
}) :
|
|
407
|
+
}) : V && !U && d(V.type) !== "NONE" ? /* @__PURE__ */ y("p", {
|
|
388
408
|
className: "mt-4 rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-sm text-text-secondary",
|
|
389
409
|
"data-testid": "planning-grow-geometry-prompt",
|
|
390
|
-
children:
|
|
391
|
-
}) : !
|
|
410
|
+
children: D(ue.key, ue.defaultValue, { type: f(D, V.type) })
|
|
411
|
+
}) : !U && V ? /* @__PURE__ */ y("p", {
|
|
392
412
|
"data-testid": "bed-geometry-notice",
|
|
393
413
|
className: "mt-4 rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-sm text-text-secondary",
|
|
394
|
-
children:
|
|
395
|
-
}) :
|
|
414
|
+
children: D(ce.key, ce.defaultValue, { type: f(D, V.type) })
|
|
415
|
+
}) : W ? /* @__PURE__ */ b("div", {
|
|
396
416
|
"data-testid": "planner-capacity-metrics",
|
|
397
417
|
className: "mt-4 grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6",
|
|
398
418
|
children: [
|
|
399
419
|
/* @__PURE__ */ y(N, {
|
|
400
|
-
label:
|
|
401
|
-
value:
|
|
420
|
+
label: D("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
|
|
421
|
+
value: n(W.bedCount)
|
|
402
422
|
}),
|
|
403
423
|
/* @__PURE__ */ y(N, {
|
|
404
|
-
label:
|
|
405
|
-
value:
|
|
424
|
+
label: D("healthybowl.crops.planning.capacity.metrics.rowsPerBed", "Rows / bed"),
|
|
425
|
+
value: n(W.rowsPerBed)
|
|
406
426
|
}),
|
|
407
427
|
/* @__PURE__ */ y(N, {
|
|
408
|
-
label:
|
|
409
|
-
value:
|
|
428
|
+
label: D("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
|
|
429
|
+
value: n(W.plantsPerBed)
|
|
410
430
|
}),
|
|
411
431
|
/* @__PURE__ */ y(N, {
|
|
412
|
-
label:
|
|
413
|
-
value:
|
|
432
|
+
label: D("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
433
|
+
value: n(W.totalPlants)
|
|
414
434
|
}),
|
|
415
435
|
/* @__PURE__ */ y(N, {
|
|
416
|
-
label:
|
|
417
|
-
value:
|
|
436
|
+
label: D("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
|
|
437
|
+
value: n(W.seedlingTarget)
|
|
418
438
|
}),
|
|
419
439
|
/* @__PURE__ */ y(N, {
|
|
420
|
-
label:
|
|
421
|
-
value:
|
|
440
|
+
label: D("healthybowl.crops.planning.capacity.metrics.bedLength", "Bed length"),
|
|
441
|
+
value: Le(W.bedLengthM),
|
|
422
442
|
unit: "m"
|
|
423
443
|
})
|
|
424
444
|
]
|
|
425
445
|
}) : /* @__PURE__ */ y("p", {
|
|
426
446
|
className: "mt-4 rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-sm text-text-secondary",
|
|
427
|
-
children:
|
|
447
|
+
children: D("healthybowl.crops.planning.capacity.empty", "Select a crop and field to calculate beds and plants.")
|
|
428
448
|
})
|
|
429
449
|
]
|
|
430
450
|
}),
|
|
@@ -434,20 +454,20 @@ var D = (e) => {
|
|
|
434
454
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
435
455
|
children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h2", {
|
|
436
456
|
className: "text-sm font-semibold text-text-primary",
|
|
437
|
-
children:
|
|
457
|
+
children: D("healthybowl.crops.planning.coverage.title", "Crop planning coverage")
|
|
438
458
|
}), /* @__PURE__ */ y("p", {
|
|
439
459
|
className: "mt-1 text-xs text-text-secondary",
|
|
440
|
-
children:
|
|
441
|
-
})] }), /* @__PURE__ */ y(
|
|
442
|
-
label:
|
|
443
|
-
planned:
|
|
444
|
-
total:
|
|
460
|
+
children: D("healthybowl.crops.planning.coverage.loadedDescription", "Coverage among the currently loaded crops and plans only. Use Crop Management or the searchable crop picker to browse every workspace crop.")
|
|
461
|
+
})] }), /* @__PURE__ */ y(c, {
|
|
462
|
+
label: D("healthybowl.crops.planning.coverage.loadedStatus", "{{planned}} / {{total}} loaded crops have a loaded plan", {
|
|
463
|
+
planned: Nt,
|
|
464
|
+
total: g.length
|
|
445
465
|
}),
|
|
446
|
-
variant:
|
|
466
|
+
variant: Nt === g.length && g.length > 0 ? "success" : "warning"
|
|
447
467
|
})]
|
|
448
|
-
}),
|
|
468
|
+
}), g.length > 0 ? /* @__PURE__ */ y("div", {
|
|
449
469
|
className: "grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
450
|
-
children:
|
|
470
|
+
children: Mt.map(({ crop: e, activePlan: t, plans: n, capacityEstimate: r, capacityNotApplicableFor: i, growCapacityEstimate: a, awaitingGeometryFor: o }) => /* @__PURE__ */ y(Ve, {
|
|
451
471
|
crop: e,
|
|
452
472
|
plan: t,
|
|
453
473
|
planCount: n.length,
|
|
@@ -455,130 +475,144 @@ var D = (e) => {
|
|
|
455
475
|
capacityNotApplicableFor: i,
|
|
456
476
|
growCapacityEstimate: a,
|
|
457
477
|
awaitingGeometryFor: o,
|
|
458
|
-
onPlan: () =>
|
|
459
|
-
onViewCrop: () => j(
|
|
460
|
-
onViewPlan: () => t && j(
|
|
478
|
+
onPlan: () => It(e),
|
|
479
|
+
onViewCrop: () => O(j(`crops/${e.id}`)),
|
|
480
|
+
onViewPlan: () => t && O(j(`crops/planning/${t.id}`))
|
|
461
481
|
}, e.id))
|
|
462
|
-
}) :
|
|
482
|
+
}) : be.crops ? /* @__PURE__ */ y(ie, {}) : /* @__PURE__ */ y("p", {
|
|
463
483
|
className: "rounded-md border border-border-subtle bg-bg-surface p-4 text-sm text-text-secondary",
|
|
464
|
-
children:
|
|
484
|
+
children: D("healthybowl.crops.planning.coverage.empty", "No crops available yet. Add crops before planning.")
|
|
465
485
|
})]
|
|
466
486
|
}),
|
|
467
|
-
|
|
487
|
+
Tt.length > 0 ? /* @__PURE__ */ y("div", {
|
|
468
488
|
className: "grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
469
|
-
children:
|
|
489
|
+
children: Tt.map((e) => /* @__PURE__ */ y(He, {
|
|
470
490
|
plan: e,
|
|
471
|
-
onClick: () => j(
|
|
491
|
+
onClick: () => O(j(`crops/planning/${e.id}`))
|
|
472
492
|
}, e.id))
|
|
473
|
-
}) :
|
|
474
|
-
title:
|
|
475
|
-
description:
|
|
493
|
+
}) : be.crops ? /* @__PURE__ */ y(ie, {}) : ye.crops ? /* @__PURE__ */ y(re, { onRetry: je }) : /* @__PURE__ */ y(ne, {
|
|
494
|
+
title: D("healthybowl.crops.planning.emptyState.title", "No plans found"),
|
|
495
|
+
description: We || Ke !== "all" || Je !== "all" ? D("healthybowl.crops.planning.emptyState.filtered", "Try adjusting your search or filters.") : D("healthybowl.crops.planning.emptyState.message", "Get started by creating a new planting plan."),
|
|
476
496
|
action: /* @__PURE__ */ y(x, {
|
|
477
|
-
onClick: () =>
|
|
478
|
-
children:
|
|
497
|
+
onClick: () => F(!0),
|
|
498
|
+
children: D("healthybowl.crops.planning.actions.createPlan", "Create Plan")
|
|
479
499
|
})
|
|
480
500
|
}),
|
|
481
|
-
/* @__PURE__ */
|
|
482
|
-
open:
|
|
501
|
+
/* @__PURE__ */ b(ae, {
|
|
502
|
+
open: Xe,
|
|
483
503
|
onClose: () => {
|
|
484
|
-
|
|
504
|
+
F(!1), xt();
|
|
485
505
|
},
|
|
486
|
-
title:
|
|
487
|
-
description:
|
|
506
|
+
title: D("healthybowl.crops.planning.modal.title", "Add New Planting Plan"),
|
|
507
|
+
description: D("healthybowl.crops.planning.modal.description", "Create a new planting plan for your farm"),
|
|
488
508
|
size: "lg",
|
|
489
|
-
footer: /* @__PURE__ */ b(
|
|
509
|
+
footer: /* @__PURE__ */ b(ke, { children: [/* @__PURE__ */ y(x, {
|
|
490
510
|
variant: "outline",
|
|
491
511
|
onClick: () => {
|
|
492
|
-
|
|
512
|
+
F(!1), xt();
|
|
493
513
|
},
|
|
494
|
-
children:
|
|
514
|
+
children: D("healthybowl.common.cancel", "Cancel")
|
|
495
515
|
}), /* @__PURE__ */ y(x, {
|
|
496
516
|
onClick: async () => {
|
|
497
|
-
if (!
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
});
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
try {
|
|
506
|
-
let e = v.find((e) => e.id === L);
|
|
507
|
-
if (!e) {
|
|
508
|
-
Le({
|
|
509
|
-
title: O("healthybowl.crops.planning.toast.cropNotFound.title", "Crop not found"),
|
|
510
|
-
description: O("healthybowl.crops.planning.toast.cropNotFound.description", "Please select a valid crop."),
|
|
517
|
+
if (!(K.loading || K.error || J.loading || J.error)) {
|
|
518
|
+
if (!Ze || !I) {
|
|
519
|
+
P({
|
|
520
|
+
title: D("healthybowl.crops.planning.toast.missingFields.title", "Missing required fields"),
|
|
521
|
+
description: D("healthybowl.crops.planning.toast.missingFields.description", "Please select a crop and field."),
|
|
511
522
|
variant: "warning"
|
|
512
523
|
});
|
|
513
524
|
return;
|
|
514
525
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
526
|
+
try {
|
|
527
|
+
let e = q;
|
|
528
|
+
if (!e) {
|
|
529
|
+
P({
|
|
530
|
+
title: D("healthybowl.crops.planning.toast.cropNotFound.title", "Crop not found"),
|
|
531
|
+
description: D("healthybowl.crops.planning.toast.cropNotFound.description", "Please select a valid crop."),
|
|
532
|
+
variant: "warning"
|
|
533
|
+
});
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
await xe({
|
|
537
|
+
cropId: e.id,
|
|
538
|
+
fieldId: I,
|
|
539
|
+
season: et,
|
|
540
|
+
startDate: it || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
541
|
+
endDate: ot || void 0,
|
|
542
|
+
expectedYield: Number(ct) || 0,
|
|
543
|
+
seedRequired: Number(ut) || 0,
|
|
544
|
+
fertilizers: [],
|
|
545
|
+
priority: nt,
|
|
546
|
+
weatherRisk: "low",
|
|
547
|
+
plantsNeeded: wt ?? void 0,
|
|
548
|
+
seedGrams: $?.seedGrams ?? void 0,
|
|
549
|
+
seedlingsToRaise: $?.seedlingsToRaise ?? void 0,
|
|
550
|
+
plantCatalogId: Y?.id
|
|
551
|
+
}), P({
|
|
552
|
+
title: D("healthybowl.crops.planning.toast.planCreated.title", "Plan created"),
|
|
553
|
+
description: D("healthybowl.crops.planning.toast.planCreated.description", "New planting plan has been added."),
|
|
554
|
+
variant: "success"
|
|
555
|
+
}), F(!1), xt();
|
|
556
|
+
} catch (e) {
|
|
557
|
+
P({
|
|
558
|
+
title: D("healthybowl.crops.planning.toast.error.title", "Error"),
|
|
559
|
+
description: e instanceof Error ? e.message : D("healthybowl.crops.planning.toast.error.description", "Failed to create planting plan"),
|
|
560
|
+
variant: "error"
|
|
561
|
+
});
|
|
562
|
+
}
|
|
541
563
|
}
|
|
542
564
|
},
|
|
543
|
-
|
|
565
|
+
disabled: K.loading || !!K.error || J.loading || !!J.error,
|
|
566
|
+
children: D("healthybowl.crops.planning.actions.createPlan", "Create Plan")
|
|
544
567
|
})] }),
|
|
545
|
-
children: /* @__PURE__ */ b("div", {
|
|
568
|
+
children: [J.error ? /* @__PURE__ */ b("div", {
|
|
569
|
+
role: "alert",
|
|
570
|
+
className: "mb-3 space-y-2 rounded-md border border-status-error-border bg-status-error-bg p-3 text-sm text-status-error-text",
|
|
571
|
+
children: [/* @__PURE__ */ y("p", { children: "Could not resolve catalog metadata for this crop. Your form values are retained." }), /* @__PURE__ */ y(x, {
|
|
572
|
+
variant: "outline",
|
|
573
|
+
onClick: () => void Me.refetchQueries({ include: [ee] }).catch(() => void 0),
|
|
574
|
+
children: "Retry catalog lookup"
|
|
575
|
+
})]
|
|
576
|
+
}) : J.loading ? /* @__PURE__ */ y("p", {
|
|
577
|
+
role: "status",
|
|
578
|
+
className: "mb-3 text-sm text-text-secondary",
|
|
579
|
+
children: "Loading catalog metadata…"
|
|
580
|
+
}) : null, /* @__PURE__ */ b("div", {
|
|
546
581
|
className: "grid gap-4 sm:grid-cols-2",
|
|
547
582
|
children: [
|
|
548
583
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
584
|
+
htmlFor: "planner-form-crop",
|
|
549
585
|
className: "text-sm font-medium text-text-primary",
|
|
550
|
-
children:
|
|
551
|
-
}), /* @__PURE__ */
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
children: e.variety ? `${e.name} - ${e.variety}` : e.name
|
|
560
|
-
}, e.id)) })]
|
|
586
|
+
children: D("healthybowl.crops.planning.form.fields.cropName.label", "Crop Name")
|
|
587
|
+
}), /* @__PURE__ */ y(s, {
|
|
588
|
+
id: "planner-form-crop",
|
|
589
|
+
value: Ze,
|
|
590
|
+
onValueChange: Ft,
|
|
591
|
+
options: g,
|
|
592
|
+
skip: !Xe,
|
|
593
|
+
placeholder: D("healthybowl.crops.planning.form.fields.cropName.placeholder", "Select crop..."),
|
|
594
|
+
className: "mt-1"
|
|
561
595
|
})] }),
|
|
562
596
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
563
597
|
className: "text-sm font-medium text-text-primary",
|
|
564
|
-
children:
|
|
598
|
+
children: D("healthybowl.crops.planning.form.fields.field.label", "Field")
|
|
565
599
|
}), /* @__PURE__ */ b(S, {
|
|
566
|
-
value:
|
|
567
|
-
onValueChange:
|
|
600
|
+
value: I,
|
|
601
|
+
onValueChange: $e,
|
|
568
602
|
children: [/* @__PURE__ */ y(T, {
|
|
569
603
|
className: "mt-1 w-full",
|
|
570
|
-
children: /* @__PURE__ */ y(E, { placeholder:
|
|
571
|
-
}), /* @__PURE__ */ y(C, { children:
|
|
604
|
+
children: /* @__PURE__ */ y(E, { placeholder: D("healthybowl.crops.planning.form.fields.field.placeholder", "Select field...") })
|
|
605
|
+
}), /* @__PURE__ */ y(C, { children: t.map((e) => /* @__PURE__ */ y(w, {
|
|
572
606
|
value: e.id,
|
|
573
|
-
children: `${e.name} · ${f(
|
|
607
|
+
children: `${e.name} · ${f(D, e.type)}`
|
|
574
608
|
}, e.id)) })]
|
|
575
609
|
})] }),
|
|
576
|
-
|
|
610
|
+
X && !Ct && d(X.type) === "NONE" && /* @__PURE__ */ y("p", {
|
|
577
611
|
"data-testid": "bed-geometry-notice-form",
|
|
578
612
|
className: "rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-xs text-text-secondary sm:col-span-2",
|
|
579
|
-
children:
|
|
613
|
+
children: D(le.key, le.defaultValue, { type: f(D, X.type) })
|
|
580
614
|
}),
|
|
581
|
-
|
|
615
|
+
Z && /* @__PURE__ */ y("div", {
|
|
582
616
|
"data-testid": "planner-form-capacity-preview",
|
|
583
617
|
className: "rounded-md border border-border-subtle bg-bg-sunken/60 p-3 sm:col-span-2",
|
|
584
618
|
children: /* @__PURE__ */ b("div", {
|
|
@@ -586,27 +620,27 @@ var D = (e) => {
|
|
|
586
620
|
children: [
|
|
587
621
|
/* @__PURE__ */ y(N, {
|
|
588
622
|
compact: !0,
|
|
589
|
-
label:
|
|
590
|
-
value:
|
|
623
|
+
label: D("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
|
|
624
|
+
value: n(Z.bedCount)
|
|
591
625
|
}),
|
|
592
626
|
/* @__PURE__ */ y(N, {
|
|
593
627
|
compact: !0,
|
|
594
|
-
label:
|
|
595
|
-
value:
|
|
628
|
+
label: D("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
|
|
629
|
+
value: n(Z.plantsPerBed)
|
|
596
630
|
}),
|
|
597
631
|
/* @__PURE__ */ y(N, {
|
|
598
632
|
compact: !0,
|
|
599
|
-
label:
|
|
600
|
-
value:
|
|
633
|
+
label: D("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
634
|
+
value: n(Z.totalPlants)
|
|
601
635
|
}),
|
|
602
636
|
/* @__PURE__ */ y(N, {
|
|
603
637
|
compact: !0,
|
|
604
|
-
label:
|
|
605
|
-
value:
|
|
638
|
+
label: D("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
|
|
639
|
+
value: n($?.seedlingsToRaise ?? Z.seedlingTarget)
|
|
606
640
|
}),
|
|
607
641
|
/* @__PURE__ */ y(N, {
|
|
608
642
|
compact: !0,
|
|
609
|
-
label:
|
|
643
|
+
label: D("healthybowl.crops.planning.capacity.metrics.seedGrams", "Seed (g)"),
|
|
610
644
|
value: $?.seedGrams == null ? "—" : $.seedGrams.toFixed(2)
|
|
611
645
|
})
|
|
612
646
|
]
|
|
@@ -614,100 +648,100 @@ var D = (e) => {
|
|
|
614
648
|
}),
|
|
615
649
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
616
650
|
className: "text-sm font-medium text-text-primary",
|
|
617
|
-
children:
|
|
651
|
+
children: D("healthybowl.crops.planning.form.fields.season.label", "Season")
|
|
618
652
|
}), /* @__PURE__ */ b(S, {
|
|
619
|
-
value:
|
|
620
|
-
onValueChange: (e) =>
|
|
653
|
+
value: et,
|
|
654
|
+
onValueChange: (e) => tt(e),
|
|
621
655
|
children: [/* @__PURE__ */ y(T, {
|
|
622
656
|
className: "mt-1 w-full",
|
|
623
657
|
children: /* @__PURE__ */ y(E, {})
|
|
624
658
|
}), /* @__PURE__ */ b(C, { children: [
|
|
625
659
|
/* @__PURE__ */ y(w, {
|
|
626
660
|
value: "kharif",
|
|
627
|
-
children:
|
|
661
|
+
children: D("healthybowl.crops.planning.season.kharif", "Kharif")
|
|
628
662
|
}),
|
|
629
663
|
/* @__PURE__ */ y(w, {
|
|
630
664
|
value: "rabi",
|
|
631
|
-
children:
|
|
665
|
+
children: D("healthybowl.crops.planning.season.rabi", "Rabi")
|
|
632
666
|
}),
|
|
633
667
|
/* @__PURE__ */ y(w, {
|
|
634
668
|
value: "zaid",
|
|
635
|
-
children:
|
|
669
|
+
children: D("healthybowl.crops.planning.season.zaid", "Zaid")
|
|
636
670
|
}),
|
|
637
671
|
/* @__PURE__ */ y(w, {
|
|
638
672
|
value: "perennial",
|
|
639
|
-
children:
|
|
673
|
+
children: D("healthybowl.crops.planning.season.perennial", "Perennial")
|
|
640
674
|
})
|
|
641
675
|
] })]
|
|
642
676
|
})] }),
|
|
643
677
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
644
678
|
className: "text-sm font-medium text-text-primary",
|
|
645
|
-
children:
|
|
679
|
+
children: D("healthybowl.crops.planning.form.fields.priority.label", "Priority")
|
|
646
680
|
}), /* @__PURE__ */ b(S, {
|
|
647
|
-
value:
|
|
648
|
-
onValueChange: (e) =>
|
|
681
|
+
value: nt,
|
|
682
|
+
onValueChange: (e) => rt(e),
|
|
649
683
|
children: [/* @__PURE__ */ y(T, {
|
|
650
684
|
className: "mt-1 w-full",
|
|
651
685
|
children: /* @__PURE__ */ y(E, {})
|
|
652
686
|
}), /* @__PURE__ */ b(C, { children: [
|
|
653
687
|
/* @__PURE__ */ y(w, {
|
|
654
688
|
value: "low",
|
|
655
|
-
children:
|
|
689
|
+
children: D("healthybowl.crops.planning.priority.low", "Low")
|
|
656
690
|
}),
|
|
657
691
|
/* @__PURE__ */ y(w, {
|
|
658
692
|
value: "medium",
|
|
659
|
-
children:
|
|
693
|
+
children: D("healthybowl.crops.planning.priority.medium", "Medium")
|
|
660
694
|
}),
|
|
661
695
|
/* @__PURE__ */ y(w, {
|
|
662
696
|
value: "high",
|
|
663
|
-
children:
|
|
697
|
+
children: D("healthybowl.crops.planning.priority.high", "High")
|
|
664
698
|
})
|
|
665
699
|
] })]
|
|
666
700
|
})] }),
|
|
667
701
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
668
702
|
className: "text-sm font-medium text-text-primary",
|
|
669
|
-
children:
|
|
703
|
+
children: D("healthybowl.crops.planning.form.fields.startDate.label", "Start Date")
|
|
670
704
|
}), /* @__PURE__ */ y("input", {
|
|
671
705
|
type: "date",
|
|
672
|
-
value:
|
|
673
|
-
onChange: (e) =>
|
|
706
|
+
value: it,
|
|
707
|
+
onChange: (e) => at(e.target.value),
|
|
674
708
|
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)]"
|
|
675
709
|
})] }),
|
|
676
710
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
677
711
|
className: "text-sm font-medium text-text-primary",
|
|
678
|
-
children:
|
|
712
|
+
children: D("healthybowl.crops.planning.form.fields.endDate.label", "End Date")
|
|
679
713
|
}), /* @__PURE__ */ y("input", {
|
|
680
714
|
type: "date",
|
|
681
|
-
value:
|
|
682
|
-
onChange: (e) =>
|
|
715
|
+
value: ot,
|
|
716
|
+
onChange: (e) => st(e.target.value),
|
|
683
717
|
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)]"
|
|
684
718
|
})] }),
|
|
685
719
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
686
720
|
className: "text-sm font-medium text-text-primary",
|
|
687
|
-
children:
|
|
721
|
+
children: D("healthybowl.crops.planning.form.fields.expectedYield.label", "Expected Yield (kg)")
|
|
688
722
|
}), /* @__PURE__ */ y("input", {
|
|
689
723
|
type: "number",
|
|
690
724
|
placeholder: "0",
|
|
691
|
-
value:
|
|
692
|
-
onChange: (e) =>
|
|
725
|
+
value: ct,
|
|
726
|
+
onChange: (e) => lt(e.target.value),
|
|
693
727
|
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)]"
|
|
694
728
|
})] }),
|
|
695
729
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
696
730
|
className: "text-sm font-medium text-text-primary",
|
|
697
|
-
children:
|
|
731
|
+
children: D("healthybowl.crops.planning.form.fields.seedRequired.label", "Seed Required (kg)")
|
|
698
732
|
}), /* @__PURE__ */ y("input", {
|
|
699
733
|
type: "number",
|
|
700
734
|
placeholder: "0",
|
|
701
|
-
value:
|
|
702
|
-
onChange: (e) =>
|
|
735
|
+
value: ut,
|
|
736
|
+
onChange: (e) => dt(e.target.value),
|
|
703
737
|
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)]"
|
|
704
738
|
})] })
|
|
705
739
|
]
|
|
706
|
-
})
|
|
740
|
+
})]
|
|
707
741
|
}),
|
|
708
|
-
/* @__PURE__ */ y(
|
|
709
|
-
toasts:
|
|
710
|
-
onDismiss:
|
|
742
|
+
/* @__PURE__ */ y(l, {
|
|
743
|
+
toasts: Be,
|
|
744
|
+
onDismiss: Ue
|
|
711
745
|
})
|
|
712
746
|
]
|
|
713
747
|
});
|
|
@@ -739,8 +773,8 @@ var D = (e) => {
|
|
|
739
773
|
children: n
|
|
740
774
|
})]
|
|
741
775
|
})]
|
|
742
|
-
}),
|
|
743
|
-
let { t:
|
|
776
|
+
}), Ve = ({ crop: e, plan: r, planCount: i, capacityEstimate: a, capacityNotApplicableFor: o, growCapacityEstimate: s, awaitingGeometryFor: ee, onPlan: te, onViewCrop: ne, onViewPlan: re }) => {
|
|
777
|
+
let { t: l } = ve(), u = !!r;
|
|
744
778
|
return /* @__PURE__ */ b("div", {
|
|
745
779
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
|
|
746
780
|
children: [
|
|
@@ -750,14 +784,14 @@ var D = (e) => {
|
|
|
750
784
|
className: "min-w-0",
|
|
751
785
|
children: [/* @__PURE__ */ y("h3", {
|
|
752
786
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
753
|
-
children:
|
|
787
|
+
children: e.name
|
|
754
788
|
}), /* @__PURE__ */ y("p", {
|
|
755
789
|
className: "mt-0.5 truncate text-xs text-text-secondary",
|
|
756
|
-
children:
|
|
790
|
+
children: e.variety || e.category
|
|
757
791
|
})]
|
|
758
|
-
}), /* @__PURE__ */ y(
|
|
759
|
-
label:
|
|
760
|
-
variant:
|
|
792
|
+
}), /* @__PURE__ */ y(c, {
|
|
793
|
+
label: u ? l("healthybowl.crops.planning.coverage.card.planned", "Planned") : l("healthybowl.crops.planning.coverage.card.noLoadedPlan", "No plan in loaded records"),
|
|
794
|
+
variant: u ? "success" : "warning"
|
|
761
795
|
})]
|
|
762
796
|
}),
|
|
763
797
|
/* @__PURE__ */ b("div", {
|
|
@@ -765,31 +799,31 @@ var D = (e) => {
|
|
|
765
799
|
children: [
|
|
766
800
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
767
801
|
className: "text-text-secondary",
|
|
768
|
-
children:
|
|
802
|
+
children: l("healthybowl.crops.planning.coverage.card.field", "Field")
|
|
769
803
|
}), /* @__PURE__ */ y("p", {
|
|
770
804
|
className: "mt-0.5 truncate font-medium text-text-primary",
|
|
771
|
-
children:
|
|
805
|
+
children: e.fieldName
|
|
772
806
|
})] }),
|
|
773
807
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
774
808
|
className: "text-text-secondary",
|
|
775
|
-
children:
|
|
809
|
+
children: l("healthybowl.crops.planning.coverage.card.season", "Season")
|
|
776
810
|
}), /* @__PURE__ */ y("p", {
|
|
777
811
|
className: "mt-0.5 font-medium text-text-primary",
|
|
778
|
-
children:
|
|
812
|
+
children: Ne(e.season, l)
|
|
779
813
|
})] }),
|
|
780
814
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
781
815
|
className: "text-text-secondary",
|
|
782
|
-
children:
|
|
816
|
+
children: l("healthybowl.crops.planning.coverage.card.status", "Crop")
|
|
783
817
|
}), /* @__PURE__ */ y("p", {
|
|
784
818
|
className: "mt-0.5 capitalize font-medium text-text-primary",
|
|
785
|
-
children:
|
|
819
|
+
children: e.status.replace(/_/g, " ")
|
|
786
820
|
})] }),
|
|
787
821
|
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
788
822
|
className: "text-text-secondary",
|
|
789
|
-
children:
|
|
823
|
+
children: l("healthybowl.crops.planning.coverage.card.harvest", "Harvest")
|
|
790
824
|
}), /* @__PURE__ */ y("p", {
|
|
791
825
|
className: "mt-0.5 font-medium text-text-primary",
|
|
792
|
-
children: e
|
|
826
|
+
children: t(e.expectedHarvestDate)
|
|
793
827
|
})] })
|
|
794
828
|
]
|
|
795
829
|
}),
|
|
@@ -800,75 +834,75 @@ var D = (e) => {
|
|
|
800
834
|
className: "flex items-center justify-between gap-2",
|
|
801
835
|
children: [/* @__PURE__ */ y("span", {
|
|
802
836
|
className: "text-xs text-text-secondary",
|
|
803
|
-
children:
|
|
804
|
-
}), /* @__PURE__ */ y(
|
|
837
|
+
children: l("healthybowl.crops.planning.coverage.card.currentPlan", "Current plan")
|
|
838
|
+
}), /* @__PURE__ */ y(c, {
|
|
805
839
|
label: r.status,
|
|
806
|
-
variant:
|
|
840
|
+
variant: je(r.status ?? "unknown")
|
|
807
841
|
})]
|
|
808
842
|
}),
|
|
809
843
|
/* @__PURE__ */ b("p", {
|
|
810
844
|
className: "mt-1 text-xs font-medium text-text-primary",
|
|
811
845
|
children: [
|
|
812
|
-
|
|
846
|
+
t(r.startDate),
|
|
813
847
|
" - ",
|
|
814
|
-
|
|
848
|
+
t(r.endDate)
|
|
815
849
|
]
|
|
816
850
|
}),
|
|
817
851
|
i > 1 && /* @__PURE__ */ y("p", {
|
|
818
852
|
className: "mt-1 text-xs text-text-secondary",
|
|
819
|
-
children:
|
|
853
|
+
children: l("healthybowl.crops.planning.coverage.card.planCount", "{{count}} plans total", { count: i })
|
|
820
854
|
})
|
|
821
855
|
]
|
|
822
856
|
}),
|
|
823
|
-
|
|
857
|
+
o && /* @__PURE__ */ y("p", {
|
|
824
858
|
"data-testid": "bed-geometry-notice-coverage",
|
|
825
859
|
className: "mt-3 rounded-md bg-bg-sunken/60 p-3 text-xs text-text-secondary",
|
|
826
|
-
children:
|
|
860
|
+
children: l(le.key, le.defaultValue, { type: f(l, o.type) })
|
|
827
861
|
}),
|
|
828
862
|
ee && /* @__PURE__ */ y("p", {
|
|
829
863
|
className: "mt-3 rounded-md bg-bg-sunken/60 p-3 text-xs text-text-secondary",
|
|
830
864
|
"data-testid": "coverage-grow-geometry-prompt",
|
|
831
|
-
children:
|
|
865
|
+
children: l(ue.key, ue.defaultValue, { type: f(l, ee.type) })
|
|
832
866
|
}),
|
|
833
|
-
|
|
867
|
+
s && /* @__PURE__ */ b("div", {
|
|
834
868
|
className: "mt-3 grid grid-cols-3 gap-2 rounded-md bg-bg-sunken/60 p-3",
|
|
835
869
|
"data-testid": "coverage-grow-capacity",
|
|
836
|
-
"data-model":
|
|
870
|
+
"data-model": s.model,
|
|
837
871
|
children: [
|
|
838
872
|
/* @__PURE__ */ y(N, {
|
|
839
873
|
compact: !0,
|
|
840
|
-
label:
|
|
841
|
-
value:
|
|
874
|
+
label: s.model === "TREE" ? l("healthybowl.crops.planning.capacity.metrics.block", "Block") : s.model === "RACK" ? l("healthybowl.crops.planning.capacity.metrics.racks", "Racks") : l("healthybowl.crops.planning.capacity.metrics.benches", "Benches"),
|
|
875
|
+
value: n(s.unitCount)
|
|
842
876
|
}),
|
|
843
877
|
/* @__PURE__ */ y(N, {
|
|
844
878
|
compact: !0,
|
|
845
|
-
label:
|
|
846
|
-
value:
|
|
879
|
+
label: l("healthybowl.crops.planning.capacity.metrics.plantsPerUnit", "Plants / unit"),
|
|
880
|
+
value: n(s.plantsPerUnit)
|
|
847
881
|
}),
|
|
848
882
|
/* @__PURE__ */ y(N, {
|
|
849
883
|
compact: !0,
|
|
850
|
-
label:
|
|
851
|
-
value:
|
|
884
|
+
label: s.model === "TREE" ? l("healthybowl.crops.planning.capacity.metrics.totalTrees", "Total trees") : l("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
885
|
+
value: n(s.totalPlants)
|
|
852
886
|
})
|
|
853
887
|
]
|
|
854
888
|
}),
|
|
855
|
-
|
|
889
|
+
a && /* @__PURE__ */ b("div", {
|
|
856
890
|
className: "mt-3 grid grid-cols-3 gap-2 rounded-md bg-bg-sunken/60 p-3",
|
|
857
891
|
children: [
|
|
858
892
|
/* @__PURE__ */ y(N, {
|
|
859
893
|
compact: !0,
|
|
860
|
-
label:
|
|
861
|
-
value:
|
|
894
|
+
label: l("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
|
|
895
|
+
value: n(a.bedCount)
|
|
862
896
|
}),
|
|
863
897
|
/* @__PURE__ */ y(N, {
|
|
864
898
|
compact: !0,
|
|
865
|
-
label:
|
|
866
|
-
value:
|
|
899
|
+
label: l("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
|
|
900
|
+
value: n(a.plantsPerBed)
|
|
867
901
|
}),
|
|
868
902
|
/* @__PURE__ */ y(N, {
|
|
869
903
|
compact: !0,
|
|
870
|
-
label:
|
|
871
|
-
value:
|
|
904
|
+
label: l("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
|
|
905
|
+
value: n(a.totalPlants)
|
|
872
906
|
})
|
|
873
907
|
]
|
|
874
908
|
}),
|
|
@@ -877,39 +911,39 @@ var D = (e) => {
|
|
|
877
911
|
children: [/* @__PURE__ */ b(x, {
|
|
878
912
|
variant: "outline",
|
|
879
913
|
size: "sm",
|
|
880
|
-
onClick:
|
|
914
|
+
onClick: ne,
|
|
881
915
|
className: "min-w-0 flex-1",
|
|
882
916
|
children: [
|
|
883
|
-
/* @__PURE__ */ y(
|
|
917
|
+
/* @__PURE__ */ y(Ee, { className: "h-4 w-4" }),
|
|
884
918
|
" ",
|
|
885
|
-
|
|
919
|
+
l("healthybowl.crops.planning.coverage.card.cropAction", "Crop")
|
|
886
920
|
]
|
|
887
|
-
}),
|
|
921
|
+
}), u ? /* @__PURE__ */ b(x, {
|
|
888
922
|
variant: "default",
|
|
889
923
|
size: "sm",
|
|
890
|
-
onClick:
|
|
924
|
+
onClick: re,
|
|
891
925
|
className: "min-w-0 flex-1",
|
|
892
926
|
children: [
|
|
893
|
-
/* @__PURE__ */ y(
|
|
927
|
+
/* @__PURE__ */ y(Se, { className: "h-4 w-4" }),
|
|
894
928
|
" ",
|
|
895
|
-
|
|
929
|
+
l("healthybowl.crops.planning.coverage.card.planAction", "Plan")
|
|
896
930
|
]
|
|
897
931
|
}) : /* @__PURE__ */ b(x, {
|
|
898
932
|
variant: "default",
|
|
899
933
|
size: "sm",
|
|
900
|
-
onClick:
|
|
934
|
+
onClick: te,
|
|
901
935
|
className: "min-w-0 flex-1",
|
|
902
936
|
children: [
|
|
903
|
-
/* @__PURE__ */ y(
|
|
937
|
+
/* @__PURE__ */ y(we, { className: "h-4 w-4" }),
|
|
904
938
|
" ",
|
|
905
|
-
|
|
939
|
+
l("healthybowl.crops.planning.coverage.card.createAction", "Plan crop")
|
|
906
940
|
]
|
|
907
941
|
})]
|
|
908
942
|
})
|
|
909
943
|
]
|
|
910
944
|
});
|
|
911
|
-
},
|
|
912
|
-
let { t: i } =
|
|
945
|
+
}, He = ({ plan: e, onClick: r }) => {
|
|
946
|
+
let { t: i } = ve(), a = /* @__PURE__ */ new Date(), o = new Date(e.startDate), s = new Date(e.endDate).getTime() - o.getTime(), ee = a.getTime() - o.getTime(), te = s > 0 ? Math.max(0, Math.min(100, Math.round(ee / s * 100))) : 0;
|
|
913
947
|
return /* @__PURE__ */ b("div", {
|
|
914
948
|
onClick: r,
|
|
915
949
|
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",
|
|
@@ -920,32 +954,32 @@ var D = (e) => {
|
|
|
920
954
|
className: "min-w-0 flex-1",
|
|
921
955
|
children: [/* @__PURE__ */ y("h3", {
|
|
922
956
|
className: "truncate text-sm font-semibold text-text-primary group-hover:text-primary",
|
|
923
|
-
children:
|
|
957
|
+
children: e.cropName
|
|
924
958
|
}), /* @__PURE__ */ b("div", {
|
|
925
959
|
className: "mt-1 flex items-center gap-1.5 text-xs text-text-secondary",
|
|
926
|
-
children: [/* @__PURE__ */ y(
|
|
960
|
+
children: [/* @__PURE__ */ y(Ce, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ y("span", {
|
|
927
961
|
className: "truncate",
|
|
928
|
-
children:
|
|
962
|
+
children: e.fieldName
|
|
929
963
|
})]
|
|
930
964
|
})]
|
|
931
|
-
}), /* @__PURE__ */ y(
|
|
932
|
-
label:
|
|
933
|
-
variant:
|
|
965
|
+
}), /* @__PURE__ */ y(c, {
|
|
966
|
+
label: e.status,
|
|
967
|
+
variant: je(e.status ?? "unknown")
|
|
934
968
|
})]
|
|
935
969
|
}),
|
|
936
970
|
/* @__PURE__ */ b("div", {
|
|
937
971
|
className: "mt-3 flex flex-wrap items-center gap-2",
|
|
938
972
|
children: [
|
|
939
|
-
/* @__PURE__ */ y(
|
|
940
|
-
label: i("healthybowl.crops.planning.card.priorityBadge", "Priority: {{priority}}", { priority:
|
|
941
|
-
variant:
|
|
973
|
+
/* @__PURE__ */ y(c, {
|
|
974
|
+
label: i("healthybowl.crops.planning.card.priorityBadge", "Priority: {{priority}}", { priority: e.priority }),
|
|
975
|
+
variant: Me(e.priority)
|
|
942
976
|
}),
|
|
943
|
-
/* @__PURE__ */ y(
|
|
944
|
-
label: i("healthybowl.crops.planning.card.riskBadge", "Risk: {{risk}}", { risk:
|
|
945
|
-
variant:
|
|
977
|
+
/* @__PURE__ */ y(c, {
|
|
978
|
+
label: i("healthybowl.crops.planning.card.riskBadge", "Risk: {{risk}}", { risk: e.weatherRisk }),
|
|
979
|
+
variant: D(e.weatherRisk)
|
|
946
980
|
}),
|
|
947
|
-
/* @__PURE__ */ y(
|
|
948
|
-
label:
|
|
981
|
+
/* @__PURE__ */ y(c, {
|
|
982
|
+
label: Ne(e.season, i),
|
|
949
983
|
variant: "muted"
|
|
950
984
|
})
|
|
951
985
|
]
|
|
@@ -957,25 +991,25 @@ var D = (e) => {
|
|
|
957
991
|
children: i("healthybowl.crops.planning.card.startDate", "Start Date")
|
|
958
992
|
}), /* @__PURE__ */ b("p", {
|
|
959
993
|
className: "flex items-center gap-1 text-xs font-medium text-text-primary",
|
|
960
|
-
children: [/* @__PURE__ */ y(
|
|
994
|
+
children: [/* @__PURE__ */ y(xe, { className: "h-3 w-3 text-text-secondary" }), t(e.startDate)]
|
|
961
995
|
})] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
962
996
|
className: "text-xs text-text-secondary",
|
|
963
997
|
children: i("healthybowl.crops.planning.card.endDate", "End Date")
|
|
964
998
|
}), /* @__PURE__ */ b("p", {
|
|
965
999
|
className: "flex items-center gap-1 text-xs font-medium text-text-primary",
|
|
966
|
-
children: [/* @__PURE__ */ y(
|
|
1000
|
+
children: [/* @__PURE__ */ y(xe, { className: "h-3 w-3 text-text-secondary" }), t(e.endDate)]
|
|
967
1001
|
})] })]
|
|
968
1002
|
}),
|
|
969
|
-
|
|
1003
|
+
e.status === "active" && /* @__PURE__ */ b("div", {
|
|
970
1004
|
className: "mt-3",
|
|
971
1005
|
children: [/* @__PURE__ */ b("div", {
|
|
972
1006
|
className: "flex items-center justify-between text-xs text-text-secondary",
|
|
973
|
-
children: [/* @__PURE__ */ y("span", { children: i("healthybowl.crops.planning.card.progress", "Progress") }), /* @__PURE__ */ b("span", { children: [
|
|
1007
|
+
children: [/* @__PURE__ */ y("span", { children: i("healthybowl.crops.planning.card.progress", "Progress") }), /* @__PURE__ */ b("span", { children: [te, "%"] })]
|
|
974
1008
|
}), /* @__PURE__ */ y("div", {
|
|
975
1009
|
className: "mt-1 h-1.5 rounded-full bg-bg-sunken",
|
|
976
1010
|
children: /* @__PURE__ */ y("div", {
|
|
977
1011
|
className: "h-1.5 rounded-full bg-action-primary-bg transition-all",
|
|
978
|
-
style: { width: `${
|
|
1012
|
+
style: { width: `${te}%` }
|
|
979
1013
|
})
|
|
980
1014
|
})]
|
|
981
1015
|
}),
|
|
@@ -986,25 +1020,25 @@ var D = (e) => {
|
|
|
986
1020
|
children: i("healthybowl.crops.planning.card.expectedYield", "Expected Yield")
|
|
987
1021
|
}), /* @__PURE__ */ b("p", {
|
|
988
1022
|
className: "text-sm font-semibold text-text-primary",
|
|
989
|
-
children: [
|
|
1023
|
+
children: [n(e.expectedYield), " kg"]
|
|
990
1024
|
})] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
991
1025
|
className: "text-xs text-text-secondary",
|
|
992
1026
|
children: i("healthybowl.crops.planning.card.seedRequired", "Seed Required")
|
|
993
1027
|
}), /* @__PURE__ */ b("p", {
|
|
994
1028
|
className: "text-sm font-semibold text-text-primary",
|
|
995
|
-
children: [
|
|
1029
|
+
children: [n(e.seedRequired), " kg"]
|
|
996
1030
|
})] })]
|
|
997
1031
|
}),
|
|
998
|
-
(
|
|
1032
|
+
(e.fertilizers ?? []).length > 0 && /* @__PURE__ */ b("div", {
|
|
999
1033
|
className: "mt-3",
|
|
1000
1034
|
children: [/* @__PURE__ */ y("span", {
|
|
1001
1035
|
className: "text-xs text-text-secondary",
|
|
1002
1036
|
children: i("healthybowl.crops.planning.card.fertilizers", "Fertilizers")
|
|
1003
1037
|
}), /* @__PURE__ */ y("div", {
|
|
1004
1038
|
className: "mt-1 flex flex-wrap gap-1",
|
|
1005
|
-
children: (
|
|
1039
|
+
children: (e.fertilizers ?? []).map((e) => /* @__PURE__ */ b("span", {
|
|
1006
1040
|
className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-primary",
|
|
1007
|
-
children: [/* @__PURE__ */ y(
|
|
1041
|
+
children: [/* @__PURE__ */ y(be, { className: "h-2.5 w-2.5" }), e]
|
|
1008
1042
|
}, e))
|
|
1009
1043
|
})]
|
|
1010
1044
|
}),
|
|
@@ -1013,7 +1047,7 @@ var D = (e) => {
|
|
|
1013
1047
|
children: [
|
|
1014
1048
|
i("healthybowl.crops.planning.card.viewDetails", "View Details"),
|
|
1015
1049
|
" ",
|
|
1016
|
-
/* @__PURE__ */ y(
|
|
1050
|
+
/* @__PURE__ */ y(ye, { className: "ms-1 h-3 w-3" })
|
|
1017
1051
|
]
|
|
1018
1052
|
})
|
|
1019
1053
|
]
|