@burdenoff/microfe-healthybowl 2026.813.24 → 2026.813.26

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.
@@ -3,12 +3,13 @@ import { StatusBadge as n } from "./StatusBadge.js";
3
3
  import { useToast as r } from "../hooks/useToast.js";
4
4
  import "./index.js";
5
5
  import { usePlanExecution as ee } from "../hooks/usePlanExecution.js";
6
- import { useMemo as i, useState as a } from "react";
7
- import { Activity as te, CalendarClock as ne, PackageCheck as re, Sprout as o, Target as ie, Trash2 as ae } from "lucide-react";
8
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
- import { Button as l, GlassCard as u, Input as d, Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, SelectValue as g, Textarea as oe } from "@burdenoff/fe-libs/ui";
6
+ import { toActivityPayload as te, toFormFields as ne } from "../utils/planActivityForm.js";
7
+ import { useMemo as re, useState as i } from "react";
8
+ import { Activity as ie, CalendarClock as ae, PackageCheck as oe, Pencil as se, Sprout as a, Target as ce, Trash2 as le, X as ue } from "lucide-react";
9
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
10
+ import { Button as c, GlassCard as l, Input as u, Select as d, SelectContent as f, SelectItem as p, SelectTrigger as m, SelectValue as h, Textarea as de } from "@burdenoff/fe-libs/ui";
10
11
  //#region src/healthybowl/components/PlanExecutionPanel.tsx
11
- var _ = [
12
+ var g = [
12
13
  {
13
14
  value: "WATERING",
14
15
  label: "Watering"
@@ -49,93 +50,102 @@ var _ = [
49
50
  value: "OTHER",
50
51
  label: "Other"
51
52
  }
52
- ], se = (e) => _.find((t) => t.value === e)?.label ?? e, v = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), ce = (e) => {
53
+ ], fe = (e) => g.find((t) => t.value === e)?.label ?? e, _ = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), pe = (e) => {
53
54
  let t = Number(e);
54
55
  return Number.isFinite(t) && t > 0 ? t : null;
55
56
  };
56
- function y() {
57
+ function v() {
57
58
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `hb-harvest-${Date.now()}-${Math.round(Math.random() * 1e9)}`;
58
59
  }
59
- var b = ({ plan: b, crops: C }) => {
60
- let { toast: w } = r(), { execution: T, loading: E, setTransplantDate: le, addActivity: ue, deleteActivity: de, recordHarvest: fe } = ee(b.id), D = i(() => {
61
- let e = C.filter((e) => !b.fieldId || e.field === b.fieldId);
62
- return e.length > 0 ? e : C;
63
- }, [C, b.fieldId]), pe = i(() => D.find((e) => e.name === b.cropName)?.id ?? D[0]?.id ?? "", [D, b.cropName]), [O, k] = a(""), [me, A] = a(!1), he = async () => {
64
- if (O) {
65
- A(!0);
60
+ var y = ({ plan: y, crops: S, onCropChanged: me }) => {
61
+ let { toast: C } = r(), { execution: w, loading: T, setTransplantDate: he, addActivity: ge, updateActivity: _e, deleteActivity: ve, recordHarvest: ye } = ee(y.id), E = re(() => {
62
+ let e = S.filter((e) => !y.fieldId || e.field === y.fieldId);
63
+ return e.length > 0 ? e : S;
64
+ }, [S, y.fieldId]), be = re(() => E.find((e) => e.name === y.cropName)?.id ?? E[0]?.id ?? "", [E, y.cropName]), [D, O] = i(""), [xe, k] = i(!1), Se = async () => {
65
+ if (D) {
66
+ k(!0);
66
67
  try {
67
- await le(O), w({
68
+ await he(D), C({
68
69
  title: "Transplant date set",
69
70
  variant: "success"
70
- }), k("");
71
+ }), O("");
71
72
  } catch {
72
- w({
73
+ C({
73
74
  title: "Could not set transplant date",
74
75
  variant: "error"
75
76
  });
76
77
  } finally {
77
- A(!1);
78
+ k(!1);
78
79
  }
79
80
  }
80
- }, [j, ge] = a("WATERING"), [M, _e] = a(v()), [N, P] = a(""), [F, I] = a(""), [L, ve] = a(""), [R, z] = a(""), [B, V] = a(!1), ye = async () => {
81
+ }, [A, j] = i("WATERING"), [M, N] = i(_()), [P, F] = i(""), [I, L] = i(""), [R, z] = i(""), [B, V] = i(""), [H, U] = i(!1), [W, G] = i(null), K = () => {
82
+ G(null), j("WATERING"), N(_()), F(""), L(""), z(""), V("");
83
+ }, Ce = (e) => {
84
+ let t = ne(e);
85
+ G(e.id), j(t.type), N(t.date), F(t.quantity), L(t.unit), z(t.labor), V(t.notes);
86
+ }, we = async () => {
81
87
  if (!M) {
82
- w({
88
+ C({
83
89
  title: "Pick an activity date",
84
90
  variant: "error"
85
91
  });
86
92
  return;
87
93
  }
88
- V(!0);
94
+ U(!0);
95
+ let e = te({
96
+ type: A,
97
+ date: M,
98
+ quantity: P,
99
+ unit: I,
100
+ labor: R,
101
+ notes: B
102
+ });
89
103
  try {
90
- await ue({
91
- type: j,
92
- activityDate: M,
93
- quantity: N ? Number(N) : null,
94
- unit: F.trim() || null,
95
- laborHours: L ? Number(L) : null,
96
- notes: R.trim() || null
97
- }), w({
104
+ W ? (await _e(W, e), C({
105
+ title: "Activity updated",
106
+ variant: "success"
107
+ })) : (await ge(e), C({
98
108
  title: "Activity logged",
99
109
  variant: "success"
100
- }), P(""), I(""), ve(""), z("");
110
+ })), A === "TRANSPLANT" && me?.(), K();
101
111
  } catch {
102
- w({
103
- title: "Could not log activity",
112
+ C({
113
+ title: W ? "Could not update activity" : "Could not log activity",
104
114
  variant: "error"
105
115
  });
106
116
  } finally {
107
- V(!1);
117
+ U(!1);
108
118
  }
109
- }, be = async (e) => {
119
+ }, Te = async (e) => {
110
120
  try {
111
- await de(e), w({
121
+ await ve(e), W === e && K(), C({
112
122
  title: "Activity removed",
113
123
  variant: "success"
114
124
  });
115
125
  } catch {
116
- w({
126
+ C({
117
127
  title: "Could not remove activity",
118
128
  variant: "error"
119
129
  });
120
130
  }
121
- }, [xe, Se] = a(""), [H, U] = a(""), [W, Ce] = a("kg"), [G, we] = a("A"), [K, Te] = a(v()), [q, J] = a(""), [Y, Ee] = a(!0), [X, Z] = a(!1), [De, Oe] = a(() => y()), Q = xe || pe, ke = async () => {
122
- let e = ce(H);
131
+ }, [Ee, De] = i(""), [q, Oe] = i(""), [ke, Ae] = i("kg"), [je, Me] = i("A"), [Ne, Pe] = i(_()), [J, Fe] = i(""), [Y, Ie] = i(!0), [X, Z] = i(!1), [Le, Re] = i(() => v()), Q = Ee || be, ze = async () => {
132
+ let e = pe(q);
123
133
  if (!Q) {
124
- w({
134
+ C({
125
135
  title: "Add a crop on this field first",
126
136
  variant: "error"
127
137
  });
128
138
  return;
129
139
  }
130
- if (!b.fieldId) {
131
- w({
140
+ if (!y.fieldId) {
141
+ C({
132
142
  title: "This plan has no field",
133
143
  variant: "error"
134
144
  });
135
145
  return;
136
146
  }
137
147
  if (e == null) {
138
- w({
148
+ C({
139
149
  title: "Enter a harvest quantity",
140
150
  variant: "error"
141
151
  });
@@ -144,22 +154,22 @@ var b = ({ plan: b, crops: C }) => {
144
154
  if (!X) {
145
155
  Z(!0);
146
156
  try {
147
- await fe({
157
+ await ye({
148
158
  cropId: Q,
149
- fieldId: b.fieldId,
159
+ fieldId: y.fieldId,
150
160
  quantity: e,
151
- unit: W.trim() || "kg",
152
- quality: G,
153
- harvestDate: K,
154
- pricePerUnit: q ? Number(q) : null,
161
+ unit: ke.trim() || "kg",
162
+ quality: je,
163
+ harvestDate: Ne,
164
+ pricePerUnit: J ? Number(J) : null,
155
165
  addToInventory: Y,
156
- clientMutationId: De
157
- }), w({
166
+ clientMutationId: Le
167
+ }), C({
158
168
  title: Y ? "Harvest recorded & added to inventory" : "Harvest recorded",
159
169
  variant: "success"
160
- }), U(""), J(""), Oe(y());
170
+ }), Oe(""), Fe(""), Re(v());
161
171
  } catch {
162
- w({
172
+ C({
163
173
  title: "Could not record harvest",
164
174
  variant: "error"
165
175
  });
@@ -167,110 +177,110 @@ var b = ({ plan: b, crops: C }) => {
167
177
  Z(!1);
168
178
  }
169
179
  }
170
- }, $ = T?.yieldVariancePct, Ae = $ == null ? "—" : `${$ > 0 ? "+" : ""}${t(Math.round($))}%`, je = $ == null ? "muted" : $ >= 0 ? "success" : "warning";
171
- return /* @__PURE__ */ c("div", {
180
+ }, $ = w?.yieldVariancePct, Be = $ == null ? "—" : `${$ > 0 ? "+" : ""}${t(Math.round($))}%`, Ve = $ == null ? "muted" : $ >= 0 ? "success" : "warning";
181
+ return /* @__PURE__ */ s("div", {
172
182
  className: "space-y-6",
173
183
  "data-testid": "plan-execution-panel",
174
184
  children: [
175
- /* @__PURE__ */ c(u, {
185
+ /* @__PURE__ */ s(l, {
176
186
  treatment: "glass",
177
187
  glow: !0,
178
188
  className: "border-border-seam p-6",
179
189
  children: [
180
- /* @__PURE__ */ c("h3", {
190
+ /* @__PURE__ */ s("h3", {
181
191
  className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
182
- children: [/* @__PURE__ */ s(ie, { className: "h-4 w-4 text-info" }), " Execution & yield"]
192
+ children: [/* @__PURE__ */ o(ce, { className: "h-4 w-4 text-info" }), " Execution & yield"]
183
193
  }),
184
- /* @__PURE__ */ c("div", {
194
+ /* @__PURE__ */ s("div", {
185
195
  className: "grid grid-cols-2 gap-4 md:grid-cols-4",
186
196
  children: [
187
- /* @__PURE__ */ s(x, {
197
+ /* @__PURE__ */ o(b, {
188
198
  label: "Planned yield",
189
- value: t(T?.plannedYield ?? b.expectedYield ?? 0),
199
+ value: t(w?.plannedYield ?? y.expectedYield ?? 0),
190
200
  unit: "kg"
191
201
  }),
192
- /* @__PURE__ */ s(x, {
202
+ /* @__PURE__ */ o(b, {
193
203
  label: "Actual yield",
194
- value: t(T?.actualYield ?? 0),
204
+ value: t(w?.actualYield ?? 0),
195
205
  unit: "kg"
196
206
  }),
197
- /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("div", {
207
+ /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
198
208
  className: "text-xs text-text-secondary",
199
209
  children: "Variance"
200
- }), /* @__PURE__ */ s("div", {
210
+ }), /* @__PURE__ */ o("div", {
201
211
  className: "mt-1",
202
- children: /* @__PURE__ */ s(n, {
203
- label: Ae,
204
- variant: je
212
+ children: /* @__PURE__ */ o(n, {
213
+ label: Be,
214
+ variant: Ve
205
215
  })
206
216
  })] }),
207
- /* @__PURE__ */ s(x, {
217
+ /* @__PURE__ */ o(b, {
208
218
  label: "Harvests",
209
- value: t(T?.harvestCount ?? 0)
219
+ value: t(w?.harvestCount ?? 0)
210
220
  })
211
221
  ]
212
222
  }),
213
- /* @__PURE__ */ c("div", {
223
+ /* @__PURE__ */ s("div", {
214
224
  className: "mt-5 grid grid-cols-1 gap-4 border-t border-border-subtle pt-4 sm:grid-cols-2",
215
- children: [/* @__PURE__ */ c("div", { children: [
216
- /* @__PURE__ */ c("div", {
225
+ children: [/* @__PURE__ */ s("div", { children: [
226
+ /* @__PURE__ */ s("div", {
217
227
  className: "flex items-center gap-1 text-xs text-text-secondary",
218
- children: [/* @__PURE__ */ s(ne, { className: "h-3.5 w-3.5" }), " Transplant date"]
228
+ children: [/* @__PURE__ */ o(ae, { className: "h-3.5 w-3.5" }), " Transplant date"]
219
229
  }),
220
- /* @__PURE__ */ s("div", {
230
+ /* @__PURE__ */ o("div", {
221
231
  className: "mt-1 text-sm font-medium text-text-primary",
222
- children: T?.transplantDate ? e(T.transplantDate) : "Not set"
232
+ children: w?.transplantDate ? e(w.transplantDate) : "Not set"
223
233
  }),
224
- /* @__PURE__ */ c("div", {
234
+ /* @__PURE__ */ s("div", {
225
235
  className: "mt-2 flex items-center gap-2",
226
- children: [/* @__PURE__ */ s(d, {
236
+ children: [/* @__PURE__ */ o(u, {
227
237
  type: "date",
228
- value: O,
229
- onChange: (e) => k(e.target.value),
238
+ value: D,
239
+ onChange: (e) => O(e.target.value),
230
240
  className: "h-9 w-44",
231
241
  "aria-label": "Transplant date"
232
- }), /* @__PURE__ */ s(l, {
242
+ }), /* @__PURE__ */ o(c, {
233
243
  size: "sm",
234
244
  variant: "outline",
235
- onClick: he,
236
- disabled: !O || me,
237
- children: T?.transplantDate ? "Update" : "Set"
245
+ onClick: Se,
246
+ disabled: !D || xe,
247
+ children: w?.transplantDate ? "Update" : "Set"
238
248
  })]
239
249
  })
240
- ] }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("div", {
250
+ ] }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
241
251
  className: "text-xs text-text-secondary",
242
252
  children: "Sow / nursery date"
243
- }), /* @__PURE__ */ s("div", {
253
+ }), /* @__PURE__ */ o("div", {
244
254
  className: "mt-1 text-sm font-medium text-text-primary",
245
- children: T?.sowDate ? e(T.sowDate) : "—"
255
+ children: w?.sowDate ? e(w.sowDate) : "—"
246
256
  })] })]
247
257
  })
248
258
  ]
249
259
  }),
250
- /* @__PURE__ */ c(u, {
260
+ /* @__PURE__ */ s(l, {
251
261
  treatment: "glass",
252
262
  className: "border-border-seam p-6",
253
263
  children: [
254
- /* @__PURE__ */ c("h3", {
264
+ /* @__PURE__ */ s("h3", {
255
265
  className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
256
- children: [/* @__PURE__ */ s(te, { className: "h-4 w-4 text-info" }), " Activity log"]
266
+ children: [/* @__PURE__ */ o(ie, { className: "h-4 w-4 text-info" }), " Activity log"]
257
267
  }),
258
- T && T.activities.length > 0 ? /* @__PURE__ */ s("ul", {
268
+ w && w.activities.length > 0 ? /* @__PURE__ */ o("ul", {
259
269
  className: "mb-5 space-y-2",
260
- children: T.activities.map((r) => /* @__PURE__ */ c("li", {
261
- className: "flex items-center justify-between gap-3 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2",
262
- children: [/* @__PURE__ */ c("div", {
270
+ children: w.activities.map((r) => /* @__PURE__ */ s("li", {
271
+ className: `flex items-center justify-between gap-3 rounded-lg border px-3 py-2 ${W === r.id ? "border-primary bg-primary/5" : "border-border-subtle bg-bg-surface"}`,
272
+ children: [/* @__PURE__ */ s("div", {
263
273
  className: "min-w-0",
264
- children: [/* @__PURE__ */ c("div", {
274
+ children: [/* @__PURE__ */ s("div", {
265
275
  className: "flex items-center gap-2",
266
- children: [/* @__PURE__ */ s(n, {
267
- label: se(r.type),
276
+ children: [/* @__PURE__ */ o(n, {
277
+ label: fe(r.type),
268
278
  variant: "info"
269
- }), /* @__PURE__ */ s("span", {
279
+ }), /* @__PURE__ */ o("span", {
270
280
  className: "text-xs text-text-secondary",
271
281
  children: e(r.activityDate)
272
282
  })]
273
- }), /* @__PURE__ */ s("div", {
283
+ }), /* @__PURE__ */ o("div", {
274
284
  className: "mt-1 truncate text-xs text-text-secondary",
275
285
  children: [
276
286
  r.quantity == null ? null : `${t(r.quantity)}${r.unit ? ` ${r.unit}` : ""}`,
@@ -278,78 +288,94 @@ var b = ({ plan: b, crops: C }) => {
278
288
  r.notes
279
289
  ].filter(Boolean).join(" · ") || "—"
280
290
  })]
281
- }), /* @__PURE__ */ s(l, {
282
- size: "sm",
283
- variant: "ghost",
284
- onClick: () => be(r.id),
285
- "aria-label": "Remove activity",
286
- children: /* @__PURE__ */ s(ae, { className: "h-4 w-4 text-text-secondary" })
291
+ }), /* @__PURE__ */ s("div", {
292
+ className: "flex shrink-0 items-center gap-1",
293
+ children: [
294
+ W === r.id && /* @__PURE__ */ o("span", {
295
+ className: "mr-1 text-xs font-medium text-primary",
296
+ children: "Editing"
297
+ }),
298
+ /* @__PURE__ */ o(c, {
299
+ size: "sm",
300
+ variant: "ghost",
301
+ onClick: () => Ce(r),
302
+ "aria-label": "Edit activity",
303
+ children: /* @__PURE__ */ o(se, { className: "h-4 w-4 text-text-secondary" })
304
+ }),
305
+ /* @__PURE__ */ o(c, {
306
+ size: "sm",
307
+ variant: "ghost",
308
+ onClick: () => Te(r.id),
309
+ "aria-label": "Remove activity",
310
+ children: /* @__PURE__ */ o(le, { className: "h-4 w-4 text-text-secondary" })
311
+ })
312
+ ]
287
313
  })]
288
314
  }, r.id))
289
- }) : /* @__PURE__ */ s("p", {
315
+ }) : /* @__PURE__ */ o("p", {
290
316
  className: "mb-5 text-sm text-text-secondary",
291
- children: E ? "Loading activities…" : "No activities logged yet. Record watering, tilling and field work below."
317
+ children: T ? "Loading activities…" : "No activities logged yet. Record watering, tilling and field work below."
292
318
  }),
293
- /* @__PURE__ */ c("div", {
319
+ /* @__PURE__ */ s("div", {
294
320
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",
295
321
  children: [
296
- /* @__PURE__ */ s(S, {
322
+ /* @__PURE__ */ o(x, {
297
323
  label: "Type",
298
- children: /* @__PURE__ */ c(f, {
299
- value: j,
300
- onValueChange: ge,
301
- children: [/* @__PURE__ */ s(h, {
324
+ children: /* @__PURE__ */ s(d, {
325
+ value: A,
326
+ onValueChange: j,
327
+ children: [/* @__PURE__ */ o(m, {
302
328
  className: "w-full",
303
- children: /* @__PURE__ */ s(g, {})
304
- }), /* @__PURE__ */ s(p, { children: _.map((e) => /* @__PURE__ */ s(m, {
329
+ children: /* @__PURE__ */ o(h, {})
330
+ }), /* @__PURE__ */ o(f, { children: g.map((e) => /* @__PURE__ */ o(p, {
305
331
  value: e.value,
306
332
  children: e.label
307
333
  }, e.value)) })]
308
334
  })
309
335
  }),
310
- /* @__PURE__ */ s(S, {
336
+ /* @__PURE__ */ o(x, {
311
337
  label: "Date",
312
- children: /* @__PURE__ */ s(d, {
338
+ children: /* @__PURE__ */ o(u, {
313
339
  type: "date",
314
340
  value: M,
315
- onChange: (e) => _e(e.target.value)
341
+ onChange: (e) => N(e.target.value)
316
342
  })
317
343
  }),
318
- /* @__PURE__ */ s(S, {
344
+ /* @__PURE__ */ o(x, {
319
345
  label: "Quantity",
320
- children: /* @__PURE__ */ s(d, {
346
+ children: /* @__PURE__ */ o(u, {
321
347
  type: "number",
322
348
  min: "0",
323
349
  step: "any",
324
- value: N,
325
- onChange: (e) => P(e.target.value),
350
+ value: P,
351
+ onChange: (e) => F(e.target.value),
326
352
  placeholder: "e.g. 20"
327
353
  })
328
354
  }),
329
- /* @__PURE__ */ s(S, {
355
+ /* @__PURE__ */ o(x, {
330
356
  label: "Unit",
331
- children: /* @__PURE__ */ s(d, {
332
- value: F,
333
- onChange: (e) => I(e.target.value),
357
+ children: /* @__PURE__ */ o(u, {
358
+ value: I,
359
+ onChange: (e) => L(e.target.value),
334
360
  placeholder: "L, kg…"
335
361
  })
336
362
  }),
337
- /* @__PURE__ */ s(S, {
363
+ /* @__PURE__ */ o(x, {
338
364
  label: "Labor (hrs)",
339
- children: /* @__PURE__ */ s(d, {
365
+ children: /* @__PURE__ */ o(u, {
340
366
  type: "number",
341
367
  min: "0",
342
368
  step: "any",
343
- value: L,
344
- onChange: (e) => ve(e.target.value),
369
+ value: R,
370
+ onChange: (e) => z(e.target.value),
345
371
  placeholder: "e.g. 1.5"
346
372
  })
347
373
  }),
348
- /* @__PURE__ */ s(S, {
374
+ /* @__PURE__ */ o(x, {
349
375
  label: "Notes",
350
- children: /* @__PURE__ */ s(oe, {
351
- value: R,
352
- onChange: (e) => z(e.target.value),
376
+ children: /* @__PURE__ */ o(de, {
377
+ value: B,
378
+ onChange: (e) => V(e.target.value),
353
379
  rows: 1,
354
380
  placeholder: "Optional"
355
381
  })
@@ -357,43 +383,44 @@ var b = ({ plan: b, crops: C }) => {
357
383
  ]
358
384
  }),
359
385
  /* @__PURE__ */ s("div", {
360
- className: "mt-4",
361
- children: /* @__PURE__ */ c(l, {
362
- onClick: ye,
363
- disabled: B,
364
- children: [
365
- /* @__PURE__ */ s(te, { className: "h-4 w-4" }),
366
- " ",
367
- B ? "Logging…" : "Log activity"
368
- ]
369
- })
386
+ className: "mt-4 flex items-center gap-2",
387
+ children: [/* @__PURE__ */ s(c, {
388
+ onClick: we,
389
+ disabled: H,
390
+ children: [/* @__PURE__ */ o(ie, { className: "h-4 w-4" }), H ? W ? "Saving…" : "Logging…" : W ? "Save changes" : "Log activity"]
391
+ }), W && /* @__PURE__ */ s(c, {
392
+ variant: "ghost",
393
+ onClick: K,
394
+ disabled: H,
395
+ children: [/* @__PURE__ */ o(ue, { className: "h-4 w-4" }), " Cancel"]
396
+ })]
370
397
  })
371
398
  ]
372
399
  }),
373
- /* @__PURE__ */ c(u, {
400
+ /* @__PURE__ */ s(l, {
374
401
  treatment: "glass",
375
402
  className: "border-border-seam p-6",
376
403
  children: [
377
- /* @__PURE__ */ c("h3", {
404
+ /* @__PURE__ */ s("h3", {
378
405
  className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
379
- children: [/* @__PURE__ */ s(o, { className: "h-4 w-4 text-info" }), " Harvest & inventory"]
406
+ children: [/* @__PURE__ */ o(a, { className: "h-4 w-4 text-info" }), " Harvest & inventory"]
380
407
  }),
381
- T && T.harvests.length > 0 ? /* @__PURE__ */ s("ul", {
408
+ w && w.harvests.length > 0 ? /* @__PURE__ */ o("ul", {
382
409
  className: "mb-5 space-y-2",
383
- children: T.harvests.map((r) => /* @__PURE__ */ c("li", {
410
+ children: w.harvests.map((r) => /* @__PURE__ */ s("li", {
384
411
  className: "flex items-center justify-between gap-3 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2",
385
- children: [/* @__PURE__ */ c("div", {
412
+ children: [/* @__PURE__ */ s("div", {
386
413
  className: "min-w-0",
387
- children: [/* @__PURE__ */ c("div", {
414
+ children: [/* @__PURE__ */ s("div", {
388
415
  className: "flex items-center gap-2",
389
- children: [/* @__PURE__ */ s("span", {
416
+ children: [/* @__PURE__ */ o("span", {
390
417
  className: "truncate text-sm font-medium text-text-primary",
391
- children: r.cropName || b.cropName
392
- }), /* @__PURE__ */ s(n, {
418
+ children: r.cropName || y.cropName
419
+ }), /* @__PURE__ */ o(n, {
393
420
  label: `Grade ${r.qualityGrade}`,
394
421
  variant: "muted"
395
422
  })]
396
- }), /* @__PURE__ */ c("div", {
423
+ }), /* @__PURE__ */ s("div", {
397
424
  className: "mt-1 text-xs text-text-secondary",
398
425
  children: [
399
426
  t(r.quantity),
@@ -403,114 +430,114 @@ var b = ({ plan: b, crops: C }) => {
403
430
  e(r.harvestDate)
404
431
  ]
405
432
  })]
406
- }), r.productId ? /* @__PURE__ */ c("span", {
433
+ }), r.productId ? /* @__PURE__ */ s("span", {
407
434
  className: "inline-flex items-center gap-1 whitespace-nowrap text-xs font-medium text-status-success-text",
408
- children: [/* @__PURE__ */ s(re, { className: "h-4 w-4" }), " In inventory"]
409
- }) : /* @__PURE__ */ s(n, {
435
+ children: [/* @__PURE__ */ o(oe, { className: "h-4 w-4" }), " In inventory"]
436
+ }) : /* @__PURE__ */ o(n, {
410
437
  label: r.status,
411
438
  variant: "muted"
412
439
  })]
413
440
  }, r.id))
414
- }) : /* @__PURE__ */ s("p", {
441
+ }) : /* @__PURE__ */ o("p", {
415
442
  className: "mb-5 text-sm text-text-secondary",
416
- children: E ? "Loading harvests…" : "No harvests recorded against this plan yet."
443
+ children: T ? "Loading harvests…" : "No harvests recorded against this plan yet."
417
444
  }),
418
- /* @__PURE__ */ c("div", {
445
+ /* @__PURE__ */ s("div", {
419
446
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",
420
447
  children: [
421
- /* @__PURE__ */ s(S, {
448
+ /* @__PURE__ */ o(x, {
422
449
  label: "Crop",
423
- children: /* @__PURE__ */ c(f, {
450
+ children: /* @__PURE__ */ s(d, {
424
451
  value: Q,
425
- onValueChange: Se,
426
- children: [/* @__PURE__ */ s(h, {
452
+ onValueChange: De,
453
+ children: [/* @__PURE__ */ o(m, {
427
454
  className: "w-full",
428
- children: /* @__PURE__ */ s(g, { placeholder: "Select crop" })
429
- }), /* @__PURE__ */ s(p, { children: D.map((e) => /* @__PURE__ */ s(m, {
455
+ children: /* @__PURE__ */ o(h, { placeholder: "Select crop" })
456
+ }), /* @__PURE__ */ o(f, { children: E.map((e) => /* @__PURE__ */ o(p, {
430
457
  value: e.id,
431
458
  children: e.variety ? `${e.name} — ${e.variety}` : e.name
432
459
  }, e.id)) })]
433
460
  })
434
461
  }),
435
- /* @__PURE__ */ s(S, {
462
+ /* @__PURE__ */ o(x, {
436
463
  label: "Quantity",
437
- children: /* @__PURE__ */ s(d, {
464
+ children: /* @__PURE__ */ o(u, {
438
465
  type: "number",
439
466
  min: "0",
440
467
  step: "any",
441
- value: H,
442
- onChange: (e) => U(e.target.value),
468
+ value: q,
469
+ onChange: (e) => Oe(e.target.value),
443
470
  placeholder: "e.g. 120"
444
471
  })
445
472
  }),
446
- /* @__PURE__ */ s(S, {
473
+ /* @__PURE__ */ o(x, {
447
474
  label: "Unit",
448
- children: /* @__PURE__ */ s(d, {
449
- value: W,
450
- onChange: (e) => Ce(e.target.value),
475
+ children: /* @__PURE__ */ o(u, {
476
+ value: ke,
477
+ onChange: (e) => Ae(e.target.value),
451
478
  placeholder: "kg"
452
479
  })
453
480
  }),
454
- /* @__PURE__ */ s(S, {
481
+ /* @__PURE__ */ o(x, {
455
482
  label: "Quality",
456
- children: /* @__PURE__ */ c(f, {
457
- value: G,
458
- onValueChange: we,
459
- children: [/* @__PURE__ */ s(h, {
483
+ children: /* @__PURE__ */ s(d, {
484
+ value: je,
485
+ onValueChange: Me,
486
+ children: [/* @__PURE__ */ o(m, {
460
487
  className: "w-full",
461
- children: /* @__PURE__ */ s(g, {})
462
- }), /* @__PURE__ */ c(p, { children: [
463
- /* @__PURE__ */ s(m, {
488
+ children: /* @__PURE__ */ o(h, {})
489
+ }), /* @__PURE__ */ s(f, { children: [
490
+ /* @__PURE__ */ o(p, {
464
491
  value: "A",
465
492
  children: "Grade A"
466
493
  }),
467
- /* @__PURE__ */ s(m, {
494
+ /* @__PURE__ */ o(p, {
468
495
  value: "B",
469
496
  children: "Grade B"
470
497
  }),
471
- /* @__PURE__ */ s(m, {
498
+ /* @__PURE__ */ o(p, {
472
499
  value: "C",
473
500
  children: "Grade C"
474
501
  })
475
502
  ] })]
476
503
  })
477
504
  }),
478
- /* @__PURE__ */ s(S, {
505
+ /* @__PURE__ */ o(x, {
479
506
  label: "Harvest date",
480
- children: /* @__PURE__ */ s(d, {
507
+ children: /* @__PURE__ */ o(u, {
481
508
  type: "date",
482
- value: K,
483
- onChange: (e) => Te(e.target.value)
509
+ value: Ne,
510
+ onChange: (e) => Pe(e.target.value)
484
511
  })
485
512
  }),
486
- /* @__PURE__ */ s(S, {
513
+ /* @__PURE__ */ o(x, {
487
514
  label: "Price / unit",
488
- children: /* @__PURE__ */ s(d, {
515
+ children: /* @__PURE__ */ o(u, {
489
516
  type: "number",
490
517
  min: "0",
491
518
  step: "any",
492
- value: q,
493
- onChange: (e) => J(e.target.value),
519
+ value: J,
520
+ onChange: (e) => Fe(e.target.value),
494
521
  placeholder: "Optional"
495
522
  })
496
523
  })
497
524
  ]
498
525
  }),
499
- /* @__PURE__ */ c("div", {
526
+ /* @__PURE__ */ s("div", {
500
527
  className: "mt-4 flex flex-wrap items-center gap-4",
501
- children: [/* @__PURE__ */ c("label", {
528
+ children: [/* @__PURE__ */ s("label", {
502
529
  className: "flex items-center gap-2 text-sm text-text-primary",
503
- children: [/* @__PURE__ */ s("input", {
530
+ children: [/* @__PURE__ */ o("input", {
504
531
  type: "checkbox",
505
532
  checked: Y,
506
- onChange: (e) => Ee(e.target.checked),
533
+ onChange: (e) => Ie(e.target.checked),
507
534
  className: "h-4 w-4 rounded border-border-subtle"
508
535
  }), "Add harvested quantity to inventory"]
509
- }), /* @__PURE__ */ c(l, {
510
- onClick: ke,
536
+ }), /* @__PURE__ */ s(c, {
537
+ onClick: ze,
511
538
  disabled: X,
512
539
  children: [
513
- /* @__PURE__ */ s(o, { className: "h-4 w-4" }),
540
+ /* @__PURE__ */ o(a, { className: "h-4 w-4" }),
514
541
  " ",
515
542
  X ? "Recording…" : "Record harvest"
516
543
  ]
@@ -520,23 +547,23 @@ var b = ({ plan: b, crops: C }) => {
520
547
  })
521
548
  ]
522
549
  });
523
- }, x = ({ label: e, value: t, unit: n }) => /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("div", {
550
+ }, b = ({ label: e, value: t, unit: n }) => /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
524
551
  className: "text-xs text-text-secondary",
525
552
  children: e
526
- }), /* @__PURE__ */ c("div", {
553
+ }), /* @__PURE__ */ s("div", {
527
554
  className: "mt-1 text-lg font-semibold text-text-primary",
528
- children: [t, n ? /* @__PURE__ */ s("span", {
555
+ children: [t, n ? /* @__PURE__ */ o("span", {
529
556
  className: "ms-1 text-xs font-normal text-text-secondary",
530
557
  children: n
531
558
  }) : null]
532
- })] }), S = ({ label: e, children: t }) => /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("label", {
559
+ })] }), x = ({ label: e, children: t }) => /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
533
560
  className: "text-xs font-medium text-text-secondary",
534
561
  children: e
535
- }), /* @__PURE__ */ s("div", {
562
+ }), /* @__PURE__ */ o("div", {
536
563
  className: "mt-1",
537
564
  children: t
538
565
  })] });
539
566
  //#endregion
540
- export { b as PlanExecutionPanel };
567
+ export { y as PlanExecutionPanel };
541
568
 
542
569
  //# sourceMappingURL=PlanExecutionPanel.js.map