@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.
Files changed (101) hide show
  1. package/dist/healthybowl/components/BedLayoutGrid.js +128 -115
  2. package/dist/healthybowl/components/BedLayoutGrid.js.map +1 -1
  3. package/dist/healthybowl/components/CropPicker.js +37 -0
  4. package/dist/healthybowl/components/CropPicker.js.map +1 -0
  5. package/dist/healthybowl/components/DataTable.js +125 -108
  6. package/dist/healthybowl/components/DataTable.js.map +1 -1
  7. package/dist/healthybowl/components/FilterBar.js +9 -6
  8. package/dist/healthybowl/components/FilterBar.js.map +1 -1
  9. package/dist/healthybowl/components/PlantCatalogPicker.js +32 -0
  10. package/dist/healthybowl/components/PlantCatalogPicker.js.map +1 -0
  11. package/dist/healthybowl/components/WorkspaceRecordPicker.js +164 -0
  12. package/dist/healthybowl/components/WorkspaceRecordPicker.js.map +1 -0
  13. package/dist/healthybowl/components/index.js +3 -1
  14. package/dist/healthybowl/hooks/useCropPage.js +71 -0
  15. package/dist/healthybowl/hooks/useCropPage.js.map +1 -0
  16. package/dist/healthybowl/hooks/usePlantCatalog.js +133 -44
  17. package/dist/healthybowl/hooks/usePlantCatalog.js.map +1 -1
  18. package/dist/healthybowl/hooks/usePlantingEstimate.js +6 -6
  19. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -1
  20. package/dist/healthybowl/hooks/useWorkspaceRead.js +46 -0
  21. package/dist/healthybowl/hooks/useWorkspaceRead.js.map +1 -0
  22. package/dist/healthybowl/pages/HomePage.js +143 -142
  23. package/dist/healthybowl/pages/HomePage.js.map +1 -1
  24. package/dist/healthybowl/pages/analytics/ReportsPage.js +8 -8
  25. package/dist/healthybowl/pages/catalog/PlantCatalogPage.js +266 -192
  26. package/dist/healthybowl/pages/catalog/PlantCatalogPage.js.map +1 -1
  27. package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js +58 -0
  28. package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js.map +1 -0
  29. package/dist/healthybowl/pages/catalog/browsePagination.js +24 -0
  30. package/dist/healthybowl/pages/catalog/browsePagination.js.map +1 -0
  31. package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js +6 -6
  32. package/dist/healthybowl/pages/crops/CropDetailsPage.js +340 -348
  33. package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
  34. package/dist/healthybowl/pages/crops/CropPlanningPage.js +468 -434
  35. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  36. package/dist/healthybowl/pages/crops/CropsPage.js +633 -542
  37. package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
  38. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +875 -800
  39. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  40. package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +459 -448
  41. package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
  42. package/dist/healthybowl/pages/crops/SuccessionCropLabel.js +21 -0
  43. package/dist/healthybowl/pages/crops/SuccessionCropLabel.js.map +1 -0
  44. package/dist/healthybowl/pages/crops/planningEdit.js +30 -0
  45. package/dist/healthybowl/pages/crops/planningEdit.js.map +1 -0
  46. package/dist/healthybowl/pages/fields/FieldMapPage.js +989 -941
  47. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  48. package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +6 -6
  49. package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +7 -7
  50. package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
  51. package/dist/healthybowl/pages/financial/TransactionsPage.js +541 -541
  52. package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
  53. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +10 -10
  54. package/dist/healthybowl/pages/government-schemes/CommunicationPage.js +207 -207
  55. package/dist/healthybowl/pages/government-schemes/CommunicationPage.js.map +1 -1
  56. package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js +38 -38
  57. package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js.map +1 -1
  58. package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js +15 -15
  59. package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js.map +1 -1
  60. package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +4 -4
  61. package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +4 -4
  62. package/dist/healthybowl/pages/livestock/FeedManagementPage.js +4 -4
  63. package/dist/healthybowl/pages/livestock/HealthRecordsPage.js +16 -16
  64. package/dist/healthybowl/pages/livestock/HealthRecordsPage.js.map +1 -1
  65. package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +4 -4
  66. package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js +4 -4
  67. package/dist/healthybowl/pages/market/MarketPricesPage.js +305 -305
  68. package/dist/healthybowl/pages/market/MarketPricesPage.js.map +1 -1
  69. package/dist/healthybowl/pages/network/CohortsPage.js +107 -107
  70. package/dist/healthybowl/pages/network/CohortsPage.js.map +1 -1
  71. package/dist/healthybowl/pages/network/CommunityPage.js +247 -247
  72. package/dist/healthybowl/pages/network/CommunityPage.js.map +1 -1
  73. package/dist/healthybowl/pages/network/EventsPage.js +16 -16
  74. package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
  75. package/dist/healthybowl/pages/network/ExpertsPage.js +470 -470
  76. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  77. package/dist/healthybowl/pages/network/MentorsPage.js +6 -6
  78. package/dist/healthybowl/pages/pest-management/PestIssuesPage.js +8 -8
  79. package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +7 -7
  80. package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
  81. package/dist/healthybowl/pages/production/ProductionBatchesPage.js +7 -7
  82. package/dist/healthybowl/pages/production/RecipeManagementPage.js +5 -5
  83. package/dist/healthybowl/pages/production/ValueAddedProductsPage.js +7 -7
  84. package/dist/healthybowl/pages/soil/SoilTestsPage.js +6 -6
  85. package/dist/healthybowl/pages/soil/SoilTestsPage.js.map +1 -1
  86. package/dist/healthybowl/pages/suppliers/SuppliersPage.js +10 -10
  87. package/dist/healthybowl/pages/sustainability/CarbonCreditLedgerPage.js +6 -6
  88. package/dist/healthybowl/pages/terrace/PlantingFormModal.js +151 -131
  89. package/dist/healthybowl/pages/terrace/PlantingFormModal.js.map +1 -1
  90. package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +6 -6
  91. package/dist/healthybowl/utils/cropComparison.js +1 -1
  92. package/dist/healthybowl/utils/cropComparison.js.map +1 -1
  93. package/dist/healthybowl/utils/cropPicker.js +35 -0
  94. package/dist/healthybowl/utils/cropPicker.js.map +1 -0
  95. package/dist/healthybowl/utils/plantingCapacity.js +2 -2
  96. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  97. package/dist/healthybowl/utils/quotaLabels.js +8 -0
  98. package/dist/healthybowl/utils/quotaLabels.js.map +1 -0
  99. package/dist/healthybowl/utils/seedRate.js +1 -8
  100. package/dist/healthybowl/utils/seedRate.js.map +1 -1
  101. package/package.json +1 -1
@@ -1,29 +1,34 @@
1
- import { formatDate as e, formatNumber as t } from "../../utils/helpers.js";
2
- import { PageLayout as n } from "../../components/PageLayout.js";
3
- import { useBasePath as r } from "../../hooks/useBasePath.js";
4
- import { StatCard as i } from "../../components/StatCard.js";
5
- import { StatusBadge as a } from "../../components/StatusBadge.js";
6
- import { EmptyState as o } from "../../components/EmptyState.js";
7
- import { ErrorState as s } from "../../components/ErrorState.js";
8
- import { ToastContainer as c } from "../../components/Toast.js";
9
- import { Breadcrumbs as ee } from "../../components/Breadcrumbs.js";
10
- import { PageLoader as l } from "../../components/PageLoader.js";
11
- import { Modal as te } from "../../components/Modal.js";
12
- import { useToast as ne } from "../../hooks/useToast.js";
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 u } from "../../hooks/useHealthyBowlData.js";
15
- import { usePlantCatalog as re } from "../../hooks/usePlantCatalog.js";
16
- import { BED_GEOMETRY_NOTICE as ie, BED_GEOMETRY_NOTICE_SHORT as ae, GROW_GEOMETRY_PROMPT as oe, capacityModelFor as d, growLocationTypeLabel as f, usesBedGeometry as p } from "../../utils/growLocationType.js";
17
- import { DEFAULT_BED_WIDTH_M as se, DEFAULT_CROP_SPACING_PRESET as ce, DEFAULT_PATH_WIDTH_M as le, estimateGrowCapacity as ue, estimatePlantingCapacity as de, getCropSpacingPreset as m } from "../../utils/plantingCapacity.js";
18
- import { computeSeedRate as fe, matchPlantCatalogEntry as pe } from "../../utils/seedRate.js";
19
- import { useEffect as me, useMemo as h, useState as g } from "react";
20
- import { useI18n as he } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
21
- import { ArrowRight as _, Beaker as v, Calendar as ge, ClipboardList as _e, MapPin as ve, Plus as ye, Search as be, Sprout as xe, Target as Se } from "lucide-react";
22
- import { useNavigate as Ce } from "react-router";
23
- import { Fragment as we, jsx as y, jsxs as b } from "react/jsx-runtime";
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 D = (e) => {
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
- }, Te = (e) => {
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
- }, Ee = (e) => {
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
- }, De = (e, t) => {
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(), Oe = (e, t) => t.find((t) => e.fieldId ? t.id === e.fieldId : O(t.name) === O(e.fieldName)), k = (e, t) => t.find((t) => t.id === e.field || O(t.name) === O(e.fieldName)), ke = (e, t) => e.cropId ? e.cropId === t.id : O(e.cropName) === O(t.name), A = (e, t) => {
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
- }, Ae = (e, t) => {
62
+ }, Ie = (e, t) => {
58
63
  let n = Number(e);
59
64
  return Number.isFinite(n) && n >= 0 ? n : t;
60
- }, je = (e, t = 1) => new Intl.NumberFormat("en-US", { maximumFractionDigits: t }).format(e), Me = (e, t) => {
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 = m(e);
63
- return de({
67
+ let n = h(e);
68
+ return me({
64
69
  fieldArea: t.area,
65
70
  fieldUnit: t.unit,
66
- bedWidthM: se,
67
- pathWidthM: le,
71
+ bedWidthM: m,
72
+ pathWidthM: fe,
68
73
  plantSpacingCm: n.plantSpacingCm,
69
74
  rowSpacingCm: n.rowSpacingCm
70
75
  });
71
- }, Ne = (e, t) => {
76
+ }, ze = (e, t) => {
72
77
  if (!t) return null;
73
- let n = m(e);
74
- return ue({
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 { plantingPlans: e, fields: _, crops: v, errors: ge, loadings: D, createPlantingPlan: Te, refetch: Ee } = u(), { t: O } = he(), j = Ce(), { buildPath: P } = r(), { toasts: Ie, toast: Le, dismiss: Re } = ne(), [ze, Be] = g(""), [F, Ve] = g("all"), [He, Ue] = g("all"), [We, I] = g(!1), [L, Ge] = g(""), [R, Ke] = g(""), [qe, Je] = g("kharif"), [Ye, Xe] = g("low"), [Ze, Qe] = g(""), [$e, et] = g(""), [tt, nt] = g(""), [rt, it] = g(""), [z, at] = g(""), [B, ot] = g(""), [V, st] = g(String(ce.plantSpacingCm)), [H, ct] = g(String(ce.rowSpacingCm)), [lt, ut] = g(String(se)), [dt, ft] = g(String(le)), pt = () => {
84
- Ge(""), Ke(""), Je("kharif"), Xe("low"), Qe(""), et(""), nt(""), it("");
85
- }, mt = h(() => v.find((e) => e.id === z) ?? null, [z, v]), U = h(() => _.find((e) => e.id === B) ?? null, [B, _]), W = h(() => m(mt), [mt]), G = p(U?.type), K = h(() => !U || !p(U.type) ? null : de({
86
- fieldArea: U.area,
87
- fieldUnit: U.unit,
88
- bedWidthM: A(lt, se),
89
- pathWidthM: Ae(dt, le),
90
- plantSpacingCm: A(V, W.plantSpacingCm),
91
- rowSpacingCm: A(H, W.rowSpacingCm)
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
- lt,
94
- dt,
110
+ _t,
111
+ yt,
112
+ R,
113
+ z,
95
114
  V,
96
- H,
97
- U,
98
- W
99
- ]), q = h(() => !U || !mt ? null : ue({
100
- type: U.type,
101
- geometry: U.growGeometry,
102
- fieldArea: U.area,
103
- fieldUnit: U.unit,
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
- H,
111
- W
112
- ]), { entries: ht } = re(), J = h(() => v.find((e) => e.id === L) ?? null, [v, L]), Y = h(() => _.find((e) => e.id === R) ?? null, [_, R]), gt = p(Y?.type), X = h(() => {
113
- if (!J || !Y || !p(Y.type)) return null;
114
- let e = m(J);
115
- return de({
116
- fieldArea: Y.area,
117
- fieldUnit: Y.unit,
118
- bedWidthM: se,
119
- pathWidthM: le,
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
- }, [J, Y]), Z = h(() => {
124
- if (!J || !Y) return null;
125
- let e = m(J);
126
- return ue({
127
- type: Y.type,
128
- geometry: Y.growGeometry,
129
- fieldArea: Y.area,
130
- fieldUnit: Y.unit,
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
- }, [J, Y]), _t = h(() => X ? X.totalPlants : Z ? Z.totalPlants : null, [X, Z]), Q = h(() => pe(J, ht), [J, ht]), $ = h(() => _t == null || Z && !Z.usesSeed ? null : fe({
135
- plantsNeeded: _t,
136
- seedsPerGram: Q?.seedsPerGram ?? null,
137
- germinationRate: Q?.germinationRate ?? null,
138
- seedsPerCell: Q?.seedsPerCell ?? null
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
- _t,
141
- Z,
142
- Q
157
+ wt,
158
+ Q,
159
+ Y
143
160
  ]);
144
- me(() => {
145
- if (z || v.length === 0) return;
146
- let e = v[0], t = m(e), n = k(e, _);
147
- at(e.id), st(String(t.plantSpacingCm)), ct(String(t.rowSpacingCm)), n && ot(n.id);
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
- z,
150
- v,
151
- _
152
- ]), me(() => {
153
- B || _.length === 0 || ot(_[0].id);
154
- }, [B, _]);
155
- let vt = e.filter((e) => {
156
- let t = (e.cropName ?? "").toLowerCase().includes(ze.toLowerCase()) || (e.fieldName ?? "").toLowerCase().includes(ze.toLowerCase()), n = F === "all" || e.status === F, r = He === "all" || e.season === He;
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
- }), yt = e.length, bt = e.reduce((e, t) => e + t.expectedYield, 0), xt = e.filter((e) => e.status === "active" || e.status === "approved").length, St = [...new Set(e.map((e) => e.season))], Ct = [...new Set(e.map((e) => e.status))], wt = e.reduce((e, t) => {
159
- let n = Oe(t, _);
160
- return e + (n ? n.area : 0);
161
- }, 0), Tt = v.map((t) => {
162
- let n = e.filter((e) => ke(e, t)), r = k(t, _);
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: t,
165
- plans: n,
166
- activePlan: n.find((e) => e.status !== "completed") ?? n[0],
167
- capacityEstimate: Me(t, r),
168
- growCapacityEstimate: Ne(t, r),
169
- capacityNotApplicableFor: r && !p(r.type) && d(r.type) === "NONE" ? r : null,
170
- awaitingGeometryFor: r && !p(r.type) && d(r.type) !== "NONE" && Ne(t, r) === null ? r : null
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
- }), Et = Tt.filter((e) => e.plans.length > 0).length, Dt = (e) => {
173
- let t = v.find((t) => t.id === e);
174
- if (at(e), !t) return;
175
- let n = m(t), r = k(t, _);
176
- st(String(n.plantSpacingCm)), ct(String(n.rowSpacingCm)), r && ot(r.id);
177
- }, Ot = (e) => {
178
- let t = v.find((t) => t.id === e);
179
- if (Ge(e), !t) return;
180
- let n = k(t, _);
181
- Je(t.season), n && Ke(n.id);
182
- }, kt = (e) => {
183
- let t = k(e, _);
184
- Ge(e.id), Ke(t?.id ?? ""), Je(e.season), Qe(e.plantingDate || ""), et(e.expectedHarvestDate || ""), nt(e.yieldEstimate ? String(e.yieldEstimate) : ""), it(""), I(!0);
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(n, {
187
- title: O("healthybowl.crops.planning.title", "Crop Planning"),
188
- description: O("healthybowl.crops.planning.subtitle", "Manage planting plans and schedules"),
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: () => I(!0),
209
+ onClick: () => F(!0),
192
210
  children: [
193
- /* @__PURE__ */ y(ye, { className: "h-4 w-4" }),
211
+ /* @__PURE__ */ y(we, { className: "h-4 w-4" }),
194
212
  " ",
195
- O("healthybowl.crops.planning.actions.addPlan", "Add New Plan")
213
+ D("healthybowl.crops.planning.actions.addPlan", "Add New Plan")
196
214
  ]
197
215
  }),
198
216
  children: [
199
- /* @__PURE__ */ y(ee, { items: [{
200
- label: O("healthybowl.crops.planning.breadcrumbs.crops", "Crops"),
201
- href: P("crops")
202
- }, { label: O("healthybowl.crops.planning.breadcrumbs.planning", "Planning") }] }),
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(i, {
224
+ /* @__PURE__ */ y(a, {
207
225
  hero: !0,
208
- label: O("healthybowl.crops.planning.stats.totalPlans.label", "Total Plans"),
209
- value: yt,
210
- icon: /* @__PURE__ */ y(_e, { className: "h-5 w-5" })
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(i, {
213
- label: O("healthybowl.crops.planning.stats.plannedArea.label", "Planned Area"),
214
- value: wt,
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(ve, { className: "h-5 w-5" })
234
+ icon: /* @__PURE__ */ y(Ce, { className: "h-5 w-5" })
217
235
  }),
218
- /* @__PURE__ */ y(i, {
219
- label: O("healthybowl.crops.planning.stats.expectedYield.label", "Expected Yield"),
220
- value: bt,
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(Se, { className: "h-5 w-5" })
240
+ icon: /* @__PURE__ */ y(De, { className: "h-5 w-5" })
223
241
  }),
224
- /* @__PURE__ */ y(i, {
225
- label: O("healthybowl.crops.planning.stats.activePlans.label", "Active Plans"),
226
- value: xt,
227
- icon: /* @__PURE__ */ y(xe, { className: "h-5 w-5" })
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(be, { className: "absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ y("input", {
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: ze,
239
- onChange: (e) => Be(e.target.value),
240
- placeholder: O("healthybowl.crops.planning.search.placeholder", "Search plans by crop or field..."),
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: F,
246
- onValueChange: Ve,
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: O("healthybowl.crops.planning.filters.allStatuses", "All Statuses") })
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: O("healthybowl.crops.planning.filters.allStatuses", "All Statuses")
253
- }), Ct.map((e) => /* @__PURE__ */ y(w, {
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: He,
260
- onValueChange: Ue,
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: O("healthybowl.crops.planning.filters.allSeasons", "All Seasons") })
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: O("healthybowl.crops.planning.filters.allSeasons", "All Seasons")
267
- }), St.map((e) => /* @__PURE__ */ y(w, {
284
+ children: D("healthybowl.crops.planning.filters.allSeasons", "All Seasons")
285
+ }), kt.map((e) => /* @__PURE__ */ y(w, {
268
286
  value: e,
269
- children: De(e, O)
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: O("healthybowl.crops.planning.capacity.title", "Planting capacity")
282
- }), /* @__PURE__ */ y(a, {
283
- label: G ? W.label : f(O, U?.type),
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: O("healthybowl.crops.planning.capacity.crop", "Crop")
295
- }), /* @__PURE__ */ b(S, {
296
- value: z,
297
- onValueChange: Dt,
298
- children: [/* @__PURE__ */ y(T, {
299
- className: "mt-1 w-full",
300
- children: /* @__PURE__ */ y(E, { placeholder: O("healthybowl.crops.planning.capacity.cropPlaceholder", "Select crop") })
301
- }), /* @__PURE__ */ y(C, { children: v.map((e) => /* @__PURE__ */ y(w, {
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: O("healthybowl.crops.planning.capacity.field", "Field")
327
+ children: D("healthybowl.crops.planning.capacity.field", "Field")
312
328
  }), /* @__PURE__ */ b(S, {
313
- value: B,
314
- onValueChange: ot,
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: O("healthybowl.crops.planning.capacity.fieldPlaceholder", "Select field") })
319
- }), /* @__PURE__ */ y(C, { children: _.map((e) => /* @__PURE__ */ y(w, {
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(O, e.type)}`
337
+ children: `${e.name} · ${f(D, e.type)}`
322
338
  }, e.id)) })]
323
339
  })]
324
340
  }),
325
- (G || U != null && d(U.type) !== "NONE") && /* @__PURE__ */ b(we, { children: [
341
+ (U || V != null && d(V.type) !== "NONE") && /* @__PURE__ */ b(ke, { children: [
326
342
  /* @__PURE__ */ y(M, {
327
- label: O("healthybowl.crops.planning.capacity.plantSpacing", "Plant spacing"),
343
+ label: D("healthybowl.crops.planning.capacity.plantSpacing", "Plant spacing"),
328
344
  unit: "cm",
329
- value: V,
345
+ value: R,
330
346
  min: "1",
331
347
  step: "1",
332
- onChange: st
348
+ onChange: (e) => {
349
+ B.current.plant = !0, ht(e);
350
+ }
333
351
  }),
334
352
  /* @__PURE__ */ y(M, {
335
- label: O("healthybowl.crops.planning.capacity.rowSpacing", "Row spacing"),
353
+ label: D("healthybowl.crops.planning.capacity.rowSpacing", "Row spacing"),
336
354
  unit: "cm",
337
- value: H,
355
+ value: z,
338
356
  min: "1",
339
357
  step: "1",
340
- onChange: ct
358
+ onChange: (e) => {
359
+ B.current.row = !0, gt(e);
360
+ }
341
361
  }),
342
- G && /* @__PURE__ */ b(we, { children: [/* @__PURE__ */ y(M, {
343
- label: O("healthybowl.crops.planning.capacity.bedWidth", "Bed width"),
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: lt,
365
+ value: _t,
346
366
  min: "0.1",
347
367
  step: "0.1",
348
- onChange: ut
368
+ onChange: vt
349
369
  }), /* @__PURE__ */ y(M, {
350
- label: O("healthybowl.crops.planning.capacity.pathWidth", "Path width"),
370
+ label: D("healthybowl.crops.planning.capacity.pathWidth", "Path width"),
351
371
  unit: "m",
352
- value: dt,
372
+ value: yt,
353
373
  min: "0",
354
374
  step: "0.05",
355
- onChange: ft
375
+ onChange: bt
356
376
  })] })
357
377
  ] })
358
378
  ]
359
379
  }),
360
- q ? /* @__PURE__ */ b("div", {
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": q.model,
383
+ "data-model": G.model,
364
384
  children: [
365
385
  /* @__PURE__ */ y(N, {
366
- label: q.model === "TREE" ? O("healthybowl.crops.planning.capacity.metrics.block", "Block") : q.model === "RACK" ? O("healthybowl.crops.planning.capacity.metrics.racks", "Racks") : O("healthybowl.crops.planning.capacity.metrics.benches", "Benches"),
367
- value: t(q.unitCount)
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: O("healthybowl.crops.planning.capacity.metrics.plantsPerUnit", "Plants / unit"),
371
- value: t(q.plantsPerUnit)
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: q.model === "TREE" ? O("healthybowl.crops.planning.capacity.metrics.totalTrees", "Total trees") : O("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
375
- value: t(q.totalPlants)
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
- q.seedlingTarget != null && /* @__PURE__ */ y(N, {
378
- label: O("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
379
- value: t(q.seedlingTarget)
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: O("healthybowl.crops.planning.capacity.metrics.growingArea", "Growing area"),
383
- value: je(q.usableAreaSqm, 1),
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
- }) : U && !G && d(U.type) !== "NONE" ? /* @__PURE__ */ y("p", {
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: O(oe.key, oe.defaultValue, { type: f(O, U.type) })
391
- }) : !G && U ? /* @__PURE__ */ y("p", {
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: O(ie.key, ie.defaultValue, { type: f(O, U.type) })
395
- }) : K ? /* @__PURE__ */ b("div", {
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: O("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
401
- value: t(K.bedCount)
420
+ label: D("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
421
+ value: n(W.bedCount)
402
422
  }),
403
423
  /* @__PURE__ */ y(N, {
404
- label: O("healthybowl.crops.planning.capacity.metrics.rowsPerBed", "Rows / bed"),
405
- value: t(K.rowsPerBed)
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: O("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
409
- value: t(K.plantsPerBed)
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: O("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
413
- value: t(K.totalPlants)
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: O("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
417
- value: t(K.seedlingTarget)
436
+ label: D("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
437
+ value: n(W.seedlingTarget)
418
438
  }),
419
439
  /* @__PURE__ */ y(N, {
420
- label: O("healthybowl.crops.planning.capacity.metrics.bedLength", "Bed length"),
421
- value: je(K.bedLengthM),
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: O("healthybowl.crops.planning.capacity.empty", "Select a crop and field to calculate beds and plants.")
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: O("healthybowl.crops.planning.coverage.title", "Crop planning coverage")
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: O("healthybowl.crops.planning.coverage.description", "Every crop is listed here so missing plans are easy to spot.")
441
- })] }), /* @__PURE__ */ y(a, {
442
- label: O("healthybowl.crops.planning.coverage.status", "{{planned}} / {{total}} planned", {
443
- planned: Et,
444
- total: v.length
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: Et === v.length && v.length > 0 ? "success" : "warning"
466
+ variant: Nt === g.length && g.length > 0 ? "success" : "warning"
447
467
  })]
448
- }), v.length > 0 ? /* @__PURE__ */ y("div", {
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: Tt.map(({ crop: e, activePlan: t, plans: n, capacityEstimate: r, capacityNotApplicableFor: i, growCapacityEstimate: a, awaitingGeometryFor: o }) => /* @__PURE__ */ y(Pe, {
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: () => kt(e),
459
- onViewCrop: () => j(P(`crops/${e.id}`)),
460
- onViewPlan: () => t && j(P(`crops/planning/${t.id}`))
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
- }) : D.crops ? /* @__PURE__ */ y(l, {}) : /* @__PURE__ */ y("p", {
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: O("healthybowl.crops.planning.coverage.empty", "No crops available yet. Add crops before planning.")
484
+ children: D("healthybowl.crops.planning.coverage.empty", "No crops available yet. Add crops before planning.")
465
485
  })]
466
486
  }),
467
- vt.length > 0 ? /* @__PURE__ */ y("div", {
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: vt.map((e) => /* @__PURE__ */ y(Fe, {
489
+ children: Tt.map((e) => /* @__PURE__ */ y(He, {
470
490
  plan: e,
471
- onClick: () => j(P(`crops/planning/${e.id}`))
491
+ onClick: () => O(j(`crops/planning/${e.id}`))
472
492
  }, e.id))
473
- }) : D.crops ? /* @__PURE__ */ y(l, {}) : ge.crops ? /* @__PURE__ */ y(s, { onRetry: Ee }) : /* @__PURE__ */ y(o, {
474
- title: O("healthybowl.crops.planning.emptyState.title", "No plans found"),
475
- description: ze || F !== "all" || He !== "all" ? O("healthybowl.crops.planning.emptyState.filtered", "Try adjusting your search or filters.") : O("healthybowl.crops.planning.emptyState.message", "Get started by creating a new planting plan."),
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: () => I(!0),
478
- children: O("healthybowl.crops.planning.actions.createPlan", "Create Plan")
497
+ onClick: () => F(!0),
498
+ children: D("healthybowl.crops.planning.actions.createPlan", "Create Plan")
479
499
  })
480
500
  }),
481
- /* @__PURE__ */ y(te, {
482
- open: We,
501
+ /* @__PURE__ */ b(ae, {
502
+ open: Xe,
483
503
  onClose: () => {
484
- I(!1), pt();
504
+ F(!1), xt();
485
505
  },
486
- title: O("healthybowl.crops.planning.modal.title", "Add New Planting Plan"),
487
- description: O("healthybowl.crops.planning.modal.description", "Create a new planting plan for your farm"),
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(we, { children: [/* @__PURE__ */ y(x, {
509
+ footer: /* @__PURE__ */ b(ke, { children: [/* @__PURE__ */ y(x, {
490
510
  variant: "outline",
491
511
  onClick: () => {
492
- I(!1), pt();
512
+ F(!1), xt();
493
513
  },
494
- children: O("healthybowl.common.cancel", "Cancel")
514
+ children: D("healthybowl.common.cancel", "Cancel")
495
515
  }), /* @__PURE__ */ y(x, {
496
516
  onClick: async () => {
497
- if (!L || !R) {
498
- Le({
499
- title: O("healthybowl.crops.planning.toast.missingFields.title", "Missing required fields"),
500
- description: O("healthybowl.crops.planning.toast.missingFields.description", "Please select a crop and field."),
501
- variant: "warning"
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
- await Te({
516
- cropId: e.id,
517
- fieldId: R,
518
- season: qe,
519
- startDate: Ze || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
520
- endDate: $e || void 0,
521
- expectedYield: Number(tt) || 0,
522
- seedRequired: Number(rt) || 0,
523
- fertilizers: [],
524
- priority: Ye,
525
- weatherRisk: "low",
526
- plantsNeeded: _t ?? void 0,
527
- seedGrams: $?.seedGrams ?? void 0,
528
- seedlingsToRaise: $?.seedlingsToRaise ?? void 0,
529
- plantCatalogId: Q?.id
530
- }), Le({
531
- title: O("healthybowl.crops.planning.toast.planCreated.title", "Plan created"),
532
- description: O("healthybowl.crops.planning.toast.planCreated.description", "New planting plan has been added."),
533
- variant: "success"
534
- }), I(!1), pt();
535
- } catch (e) {
536
- Le({
537
- title: O("healthybowl.crops.planning.toast.error.title", "Error"),
538
- description: e instanceof Error ? e.message : O("healthybowl.crops.planning.toast.error.description", "Failed to create planting plan"),
539
- variant: "error"
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
- children: O("healthybowl.crops.planning.actions.createPlan", "Create Plan")
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: O("healthybowl.crops.planning.form.fields.cropName.label", "Crop Name")
551
- }), /* @__PURE__ */ b(S, {
552
- value: L,
553
- onValueChange: Ot,
554
- children: [/* @__PURE__ */ y(T, {
555
- className: "mt-1 w-full",
556
- children: /* @__PURE__ */ y(E, { placeholder: O("healthybowl.crops.planning.form.fields.cropName.placeholder", "Select crop...") })
557
- }), /* @__PURE__ */ y(C, { children: v.map((e) => /* @__PURE__ */ y(w, {
558
- value: e.id,
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: O("healthybowl.crops.planning.form.fields.field.label", "Field")
598
+ children: D("healthybowl.crops.planning.form.fields.field.label", "Field")
565
599
  }), /* @__PURE__ */ b(S, {
566
- value: R,
567
- onValueChange: Ke,
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: O("healthybowl.crops.planning.form.fields.field.placeholder", "Select field...") })
571
- }), /* @__PURE__ */ y(C, { children: _.map((e) => /* @__PURE__ */ y(w, {
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(O, e.type)}`
607
+ children: `${e.name} · ${f(D, e.type)}`
574
608
  }, e.id)) })]
575
609
  })] }),
576
- Y && !gt && d(Y.type) === "NONE" && /* @__PURE__ */ y("p", {
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: O(ae.key, ae.defaultValue, { type: f(O, Y.type) })
613
+ children: D(le.key, le.defaultValue, { type: f(D, X.type) })
580
614
  }),
581
- X && /* @__PURE__ */ y("div", {
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: O("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
590
- value: t(X.bedCount)
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: O("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
595
- value: t(X.plantsPerBed)
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: O("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
600
- value: t(X.totalPlants)
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: O("healthybowl.crops.planning.capacity.metrics.seedlings", "Seedlings"),
605
- value: t($?.seedlingsToRaise ?? X.seedlingTarget)
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: O("healthybowl.crops.planning.capacity.metrics.seedGrams", "Seed (g)"),
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: O("healthybowl.crops.planning.form.fields.season.label", "Season")
651
+ children: D("healthybowl.crops.planning.form.fields.season.label", "Season")
618
652
  }), /* @__PURE__ */ b(S, {
619
- value: qe,
620
- onValueChange: (e) => Je(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: O("healthybowl.crops.planning.season.kharif", "Kharif")
661
+ children: D("healthybowl.crops.planning.season.kharif", "Kharif")
628
662
  }),
629
663
  /* @__PURE__ */ y(w, {
630
664
  value: "rabi",
631
- children: O("healthybowl.crops.planning.season.rabi", "Rabi")
665
+ children: D("healthybowl.crops.planning.season.rabi", "Rabi")
632
666
  }),
633
667
  /* @__PURE__ */ y(w, {
634
668
  value: "zaid",
635
- children: O("healthybowl.crops.planning.season.zaid", "Zaid")
669
+ children: D("healthybowl.crops.planning.season.zaid", "Zaid")
636
670
  }),
637
671
  /* @__PURE__ */ y(w, {
638
672
  value: "perennial",
639
- children: O("healthybowl.crops.planning.season.perennial", "Perennial")
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: O("healthybowl.crops.planning.form.fields.priority.label", "Priority")
679
+ children: D("healthybowl.crops.planning.form.fields.priority.label", "Priority")
646
680
  }), /* @__PURE__ */ b(S, {
647
- value: Ye,
648
- onValueChange: (e) => Xe(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: O("healthybowl.crops.planning.priority.low", "Low")
689
+ children: D("healthybowl.crops.planning.priority.low", "Low")
656
690
  }),
657
691
  /* @__PURE__ */ y(w, {
658
692
  value: "medium",
659
- children: O("healthybowl.crops.planning.priority.medium", "Medium")
693
+ children: D("healthybowl.crops.planning.priority.medium", "Medium")
660
694
  }),
661
695
  /* @__PURE__ */ y(w, {
662
696
  value: "high",
663
- children: O("healthybowl.crops.planning.priority.high", "High")
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: O("healthybowl.crops.planning.form.fields.startDate.label", "Start Date")
703
+ children: D("healthybowl.crops.planning.form.fields.startDate.label", "Start Date")
670
704
  }), /* @__PURE__ */ y("input", {
671
705
  type: "date",
672
- value: Ze,
673
- onChange: (e) => Qe(e.target.value),
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: O("healthybowl.crops.planning.form.fields.endDate.label", "End Date")
712
+ children: D("healthybowl.crops.planning.form.fields.endDate.label", "End Date")
679
713
  }), /* @__PURE__ */ y("input", {
680
714
  type: "date",
681
- value: $e,
682
- onChange: (e) => et(e.target.value),
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: O("healthybowl.crops.planning.form.fields.expectedYield.label", "Expected Yield (kg)")
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: tt,
692
- onChange: (e) => nt(e.target.value),
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: O("healthybowl.crops.planning.form.fields.seedRequired.label", "Seed Required (kg)")
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: rt,
702
- onChange: (e) => it(e.target.value),
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(c, {
709
- toasts: Ie,
710
- onDismiss: Re
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
- }), Pe = ({ crop: n, plan: r, planCount: i, capacityEstimate: o, capacityNotApplicableFor: s, growCapacityEstimate: c, awaitingGeometryFor: ee, onPlan: l, onViewCrop: te, onViewPlan: ne }) => {
743
- let { t: u } = he(), re = !!r;
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: n.name
787
+ children: e.name
754
788
  }), /* @__PURE__ */ y("p", {
755
789
  className: "mt-0.5 truncate text-xs text-text-secondary",
756
- children: n.variety || n.category
790
+ children: e.variety || e.category
757
791
  })]
758
- }), /* @__PURE__ */ y(a, {
759
- label: re ? u("healthybowl.crops.planning.coverage.card.planned", "Planned") : u("healthybowl.crops.planning.coverage.card.missing", "Needs plan"),
760
- variant: re ? "success" : "warning"
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: u("healthybowl.crops.planning.coverage.card.field", "Field")
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: n.fieldName
805
+ children: e.fieldName
772
806
  })] }),
773
807
  /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
774
808
  className: "text-text-secondary",
775
- children: u("healthybowl.crops.planning.coverage.card.season", "Season")
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: De(n.season, u)
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: u("healthybowl.crops.planning.coverage.card.status", "Crop")
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: n.status.replace(/_/g, " ")
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: u("healthybowl.crops.planning.coverage.card.harvest", "Harvest")
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(n.expectedHarvestDate)
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: u("healthybowl.crops.planning.coverage.card.currentPlan", "Current plan")
804
- }), /* @__PURE__ */ y(a, {
837
+ children: l("healthybowl.crops.planning.coverage.card.currentPlan", "Current plan")
838
+ }), /* @__PURE__ */ y(c, {
805
839
  label: r.status,
806
- variant: D(r.status ?? "unknown")
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
- e(r.startDate),
846
+ t(r.startDate),
813
847
  " - ",
814
- e(r.endDate)
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: u("healthybowl.crops.planning.coverage.card.planCount", "{{count}} plans total", { count: i })
853
+ children: l("healthybowl.crops.planning.coverage.card.planCount", "{{count}} plans total", { count: i })
820
854
  })
821
855
  ]
822
856
  }),
823
- s && /* @__PURE__ */ y("p", {
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: u(ae.key, ae.defaultValue, { type: f(u, s.type) })
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: u(oe.key, oe.defaultValue, { type: f(u, ee.type) })
865
+ children: l(ue.key, ue.defaultValue, { type: f(l, ee.type) })
832
866
  }),
833
- c && /* @__PURE__ */ b("div", {
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": c.model,
870
+ "data-model": s.model,
837
871
  children: [
838
872
  /* @__PURE__ */ y(N, {
839
873
  compact: !0,
840
- label: c.model === "TREE" ? u("healthybowl.crops.planning.capacity.metrics.block", "Block") : c.model === "RACK" ? u("healthybowl.crops.planning.capacity.metrics.racks", "Racks") : u("healthybowl.crops.planning.capacity.metrics.benches", "Benches"),
841
- value: t(c.unitCount)
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: u("healthybowl.crops.planning.capacity.metrics.plantsPerUnit", "Plants / unit"),
846
- value: t(c.plantsPerUnit)
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: c.model === "TREE" ? u("healthybowl.crops.planning.capacity.metrics.totalTrees", "Total trees") : u("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
851
- value: t(c.totalPlants)
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
- o && /* @__PURE__ */ b("div", {
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: u("healthybowl.crops.planning.capacity.metrics.beds", "Beds"),
861
- value: t(o.bedCount)
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: u("healthybowl.crops.planning.capacity.metrics.plantsPerBed", "Plants / bed"),
866
- value: t(o.plantsPerBed)
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: u("healthybowl.crops.planning.capacity.metrics.totalPlants", "Total plants"),
871
- value: t(o.totalPlants)
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: te,
914
+ onClick: ne,
881
915
  className: "min-w-0 flex-1",
882
916
  children: [
883
- /* @__PURE__ */ y(xe, { className: "h-4 w-4" }),
917
+ /* @__PURE__ */ y(Ee, { className: "h-4 w-4" }),
884
918
  " ",
885
- u("healthybowl.crops.planning.coverage.card.cropAction", "Crop")
919
+ l("healthybowl.crops.planning.coverage.card.cropAction", "Crop")
886
920
  ]
887
- }), re ? /* @__PURE__ */ b(x, {
921
+ }), u ? /* @__PURE__ */ b(x, {
888
922
  variant: "default",
889
923
  size: "sm",
890
- onClick: ne,
924
+ onClick: re,
891
925
  className: "min-w-0 flex-1",
892
926
  children: [
893
- /* @__PURE__ */ y(_e, { className: "h-4 w-4" }),
927
+ /* @__PURE__ */ y(Se, { className: "h-4 w-4" }),
894
928
  " ",
895
- u("healthybowl.crops.planning.coverage.card.planAction", "Plan")
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: l,
934
+ onClick: te,
901
935
  className: "min-w-0 flex-1",
902
936
  children: [
903
- /* @__PURE__ */ y(ye, { className: "h-4 w-4" }),
937
+ /* @__PURE__ */ y(we, { className: "h-4 w-4" }),
904
938
  " ",
905
- u("healthybowl.crops.planning.coverage.card.createAction", "Plan crop")
939
+ l("healthybowl.crops.planning.coverage.card.createAction", "Plan crop")
906
940
  ]
907
941
  })]
908
942
  })
909
943
  ]
910
944
  });
911
- }, Fe = ({ plan: n, onClick: r }) => {
912
- let { t: i } = he(), o = /* @__PURE__ */ new Date(), s = new Date(n.startDate), c = new Date(n.endDate).getTime() - s.getTime(), ee = o.getTime() - s.getTime(), l = c > 0 ? Math.max(0, Math.min(100, Math.round(ee / c * 100))) : 0;
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: n.cropName
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(ve, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ y("span", {
960
+ children: [/* @__PURE__ */ y(Ce, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ y("span", {
927
961
  className: "truncate",
928
- children: n.fieldName
962
+ children: e.fieldName
929
963
  })]
930
964
  })]
931
- }), /* @__PURE__ */ y(a, {
932
- label: n.status,
933
- variant: D(n.status ?? "unknown")
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(a, {
940
- label: i("healthybowl.crops.planning.card.priorityBadge", "Priority: {{priority}}", { priority: n.priority }),
941
- variant: Te(n.priority)
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(a, {
944
- label: i("healthybowl.crops.planning.card.riskBadge", "Risk: {{risk}}", { risk: n.weatherRisk }),
945
- variant: Ee(n.weatherRisk)
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(a, {
948
- label: De(n.season, i),
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(ge, { className: "h-3 w-3 text-text-secondary" }), e(n.startDate)]
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(ge, { className: "h-3 w-3 text-text-secondary" }), e(n.endDate)]
1000
+ children: [/* @__PURE__ */ y(xe, { className: "h-3 w-3 text-text-secondary" }), t(e.endDate)]
967
1001
  })] })]
968
1002
  }),
969
- n.status === "active" && /* @__PURE__ */ b("div", {
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: [l, "%"] })]
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: `${l}%` }
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: [t(n.expectedYield), " kg"]
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: [t(n.seedRequired), " kg"]
1029
+ children: [n(e.seedRequired), " kg"]
996
1030
  })] })]
997
1031
  }),
998
- (n.fertilizers ?? []).length > 0 && /* @__PURE__ */ b("div", {
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: (n.fertilizers ?? []).map((e) => /* @__PURE__ */ b("span", {
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(v, { className: "h-2.5 w-2.5" }), e]
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(_, { className: "ms-1 h-3 w-3" })
1050
+ /* @__PURE__ */ y(ye, { className: "ms-1 h-3 w-3" })
1017
1051
  ]
1018
1052
  })
1019
1053
  ]