@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.
- package/dist/healthybowl/components/PlanExecutionPanel.js +232 -205
- package/dist/healthybowl/components/PlanExecutionPanel.js.map +1 -1
- package/dist/healthybowl/hooks/usePlanExecution.js +65 -42
- package/dist/healthybowl/hooks/usePlanExecution.js.map +1 -1
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +207 -206
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
- package/dist/healthybowl/utils/planActivityForm.js +25 -0
- package/dist/healthybowl/utils/planActivityForm.js.map +1 -0
- package/package.json +1 -1
|
@@ -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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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
|
-
],
|
|
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
|
|
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
|
|
60
|
-
let { toast:
|
|
61
|
-
let e =
|
|
62
|
-
return e.length > 0 ? e :
|
|
63
|
-
}, [
|
|
64
|
-
if (
|
|
65
|
-
|
|
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
|
|
68
|
+
await he(D), C({
|
|
68
69
|
title: "Transplant date set",
|
|
69
70
|
variant: "success"
|
|
70
|
-
}),
|
|
71
|
+
}), O("");
|
|
71
72
|
} catch {
|
|
72
|
-
|
|
73
|
+
C({
|
|
73
74
|
title: "Could not set transplant date",
|
|
74
75
|
variant: "error"
|
|
75
76
|
});
|
|
76
77
|
} finally {
|
|
77
|
-
|
|
78
|
+
k(!1);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
}, [
|
|
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
|
-
|
|
88
|
+
C({
|
|
83
89
|
title: "Pick an activity date",
|
|
84
90
|
variant: "error"
|
|
85
91
|
});
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
|
-
|
|
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
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
})
|
|
110
|
+
})), A === "TRANSPLANT" && me?.(), K();
|
|
101
111
|
} catch {
|
|
102
|
-
|
|
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
|
-
|
|
117
|
+
U(!1);
|
|
108
118
|
}
|
|
109
|
-
},
|
|
119
|
+
}, Te = async (e) => {
|
|
110
120
|
try {
|
|
111
|
-
await
|
|
121
|
+
await ve(e), W === e && K(), C({
|
|
112
122
|
title: "Activity removed",
|
|
113
123
|
variant: "success"
|
|
114
124
|
});
|
|
115
125
|
} catch {
|
|
116
|
-
|
|
126
|
+
C({
|
|
117
127
|
title: "Could not remove activity",
|
|
118
128
|
variant: "error"
|
|
119
129
|
});
|
|
120
130
|
}
|
|
121
|
-
}, [
|
|
122
|
-
let e =
|
|
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
|
-
|
|
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 (!
|
|
131
|
-
|
|
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
|
-
|
|
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
|
|
157
|
+
await ye({
|
|
148
158
|
cropId: Q,
|
|
149
|
-
fieldId:
|
|
159
|
+
fieldId: y.fieldId,
|
|
150
160
|
quantity: e,
|
|
151
|
-
unit:
|
|
152
|
-
quality:
|
|
153
|
-
harvestDate:
|
|
154
|
-
pricePerUnit:
|
|
161
|
+
unit: ke.trim() || "kg",
|
|
162
|
+
quality: je,
|
|
163
|
+
harvestDate: Ne,
|
|
164
|
+
pricePerUnit: J ? Number(J) : null,
|
|
155
165
|
addToInventory: Y,
|
|
156
|
-
clientMutationId:
|
|
157
|
-
}),
|
|
166
|
+
clientMutationId: Le
|
|
167
|
+
}), C({
|
|
158
168
|
title: Y ? "Harvest recorded & added to inventory" : "Harvest recorded",
|
|
159
169
|
variant: "success"
|
|
160
|
-
}),
|
|
170
|
+
}), Oe(""), Fe(""), Re(v());
|
|
161
171
|
} catch {
|
|
162
|
-
|
|
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
|
-
}, $ =
|
|
171
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
190
|
+
/* @__PURE__ */ s("h3", {
|
|
181
191
|
className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
182
|
-
children: [/* @__PURE__ */
|
|
192
|
+
children: [/* @__PURE__ */ o(ce, { className: "h-4 w-4 text-info" }), " Execution & yield"]
|
|
183
193
|
}),
|
|
184
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ s("div", {
|
|
185
195
|
className: "grid grid-cols-2 gap-4 md:grid-cols-4",
|
|
186
196
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ o(b, {
|
|
188
198
|
label: "Planned yield",
|
|
189
|
-
value: t(
|
|
199
|
+
value: t(w?.plannedYield ?? y.expectedYield ?? 0),
|
|
190
200
|
unit: "kg"
|
|
191
201
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ o(b, {
|
|
193
203
|
label: "Actual yield",
|
|
194
|
-
value: t(
|
|
204
|
+
value: t(w?.actualYield ?? 0),
|
|
195
205
|
unit: "kg"
|
|
196
206
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
|
|
198
208
|
className: "text-xs text-text-secondary",
|
|
199
209
|
children: "Variance"
|
|
200
|
-
}), /* @__PURE__ */
|
|
210
|
+
}), /* @__PURE__ */ o("div", {
|
|
201
211
|
className: "mt-1",
|
|
202
|
-
children: /* @__PURE__ */
|
|
203
|
-
label:
|
|
204
|
-
variant:
|
|
212
|
+
children: /* @__PURE__ */ o(n, {
|
|
213
|
+
label: Be,
|
|
214
|
+
variant: Ve
|
|
205
215
|
})
|
|
206
216
|
})] }),
|
|
207
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ o(b, {
|
|
208
218
|
label: "Harvests",
|
|
209
|
-
value: t(
|
|
219
|
+
value: t(w?.harvestCount ?? 0)
|
|
210
220
|
})
|
|
211
221
|
]
|
|
212
222
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
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__ */
|
|
216
|
-
/* @__PURE__ */
|
|
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__ */
|
|
228
|
+
children: [/* @__PURE__ */ o(ae, { className: "h-3.5 w-3.5" }), " Transplant date"]
|
|
219
229
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ o("div", {
|
|
221
231
|
className: "mt-1 text-sm font-medium text-text-primary",
|
|
222
|
-
children:
|
|
232
|
+
children: w?.transplantDate ? e(w.transplantDate) : "Not set"
|
|
223
233
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ s("div", {
|
|
225
235
|
className: "mt-2 flex items-center gap-2",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
236
|
+
children: [/* @__PURE__ */ o(u, {
|
|
227
237
|
type: "date",
|
|
228
|
-
value:
|
|
229
|
-
onChange: (e) =>
|
|
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__ */
|
|
242
|
+
}), /* @__PURE__ */ o(c, {
|
|
233
243
|
size: "sm",
|
|
234
244
|
variant: "outline",
|
|
235
|
-
onClick:
|
|
236
|
-
disabled: !
|
|
237
|
-
children:
|
|
245
|
+
onClick: Se,
|
|
246
|
+
disabled: !D || xe,
|
|
247
|
+
children: w?.transplantDate ? "Update" : "Set"
|
|
238
248
|
})]
|
|
239
249
|
})
|
|
240
|
-
] }), /* @__PURE__ */
|
|
250
|
+
] }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("div", {
|
|
241
251
|
className: "text-xs text-text-secondary",
|
|
242
252
|
children: "Sow / nursery date"
|
|
243
|
-
}), /* @__PURE__ */
|
|
253
|
+
}), /* @__PURE__ */ o("div", {
|
|
244
254
|
className: "mt-1 text-sm font-medium text-text-primary",
|
|
245
|
-
children:
|
|
255
|
+
children: w?.sowDate ? e(w.sowDate) : "—"
|
|
246
256
|
})] })]
|
|
247
257
|
})
|
|
248
258
|
]
|
|
249
259
|
}),
|
|
250
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ s(l, {
|
|
251
261
|
treatment: "glass",
|
|
252
262
|
className: "border-border-seam p-6",
|
|
253
263
|
children: [
|
|
254
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ s("h3", {
|
|
255
265
|
className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
256
|
-
children: [/* @__PURE__ */
|
|
266
|
+
children: [/* @__PURE__ */ o(ie, { className: "h-4 w-4 text-info" }), " Activity log"]
|
|
257
267
|
}),
|
|
258
|
-
|
|
268
|
+
w && w.activities.length > 0 ? /* @__PURE__ */ o("ul", {
|
|
259
269
|
className: "mb-5 space-y-2",
|
|
260
|
-
children:
|
|
261
|
-
className:
|
|
262
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
274
|
+
children: [/* @__PURE__ */ s("div", {
|
|
265
275
|
className: "flex items-center gap-2",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
267
|
-
label:
|
|
276
|
+
children: [/* @__PURE__ */ o(n, {
|
|
277
|
+
label: fe(r.type),
|
|
268
278
|
variant: "info"
|
|
269
|
-
}), /* @__PURE__ */
|
|
279
|
+
}), /* @__PURE__ */ o("span", {
|
|
270
280
|
className: "text-xs text-text-secondary",
|
|
271
281
|
children: e(r.activityDate)
|
|
272
282
|
})]
|
|
273
|
-
}), /* @__PURE__ */
|
|
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(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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__ */
|
|
315
|
+
}) : /* @__PURE__ */ o("p", {
|
|
290
316
|
className: "mb-5 text-sm text-text-secondary",
|
|
291
|
-
children:
|
|
317
|
+
children: T ? "Loading activities…" : "No activities logged yet. Record watering, tilling and field work below."
|
|
292
318
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
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__ */
|
|
322
|
+
/* @__PURE__ */ o(x, {
|
|
297
323
|
label: "Type",
|
|
298
|
-
children: /* @__PURE__ */
|
|
299
|
-
value:
|
|
300
|
-
onValueChange:
|
|
301
|
-
children: [/* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ s(d, {
|
|
325
|
+
value: A,
|
|
326
|
+
onValueChange: j,
|
|
327
|
+
children: [/* @__PURE__ */ o(m, {
|
|
302
328
|
className: "w-full",
|
|
303
|
-
children: /* @__PURE__ */
|
|
304
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
336
|
+
/* @__PURE__ */ o(x, {
|
|
311
337
|
label: "Date",
|
|
312
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ o(u, {
|
|
313
339
|
type: "date",
|
|
314
340
|
value: M,
|
|
315
|
-
onChange: (e) =>
|
|
341
|
+
onChange: (e) => N(e.target.value)
|
|
316
342
|
})
|
|
317
343
|
}),
|
|
318
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ o(x, {
|
|
319
345
|
label: "Quantity",
|
|
320
|
-
children: /* @__PURE__ */
|
|
346
|
+
children: /* @__PURE__ */ o(u, {
|
|
321
347
|
type: "number",
|
|
322
348
|
min: "0",
|
|
323
349
|
step: "any",
|
|
324
|
-
value:
|
|
325
|
-
onChange: (e) =>
|
|
350
|
+
value: P,
|
|
351
|
+
onChange: (e) => F(e.target.value),
|
|
326
352
|
placeholder: "e.g. 20"
|
|
327
353
|
})
|
|
328
354
|
}),
|
|
329
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ o(x, {
|
|
330
356
|
label: "Unit",
|
|
331
|
-
children: /* @__PURE__ */
|
|
332
|
-
value:
|
|
333
|
-
onChange: (e) =>
|
|
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__ */
|
|
363
|
+
/* @__PURE__ */ o(x, {
|
|
338
364
|
label: "Labor (hrs)",
|
|
339
|
-
children: /* @__PURE__ */
|
|
365
|
+
children: /* @__PURE__ */ o(u, {
|
|
340
366
|
type: "number",
|
|
341
367
|
min: "0",
|
|
342
368
|
step: "any",
|
|
343
|
-
value:
|
|
344
|
-
onChange: (e) =>
|
|
369
|
+
value: R,
|
|
370
|
+
onChange: (e) => z(e.target.value),
|
|
345
371
|
placeholder: "e.g. 1.5"
|
|
346
372
|
})
|
|
347
373
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ o(x, {
|
|
349
375
|
label: "Notes",
|
|
350
|
-
children: /* @__PURE__ */
|
|
351
|
-
value:
|
|
352
|
-
onChange: (e) =>
|
|
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
|
|
362
|
-
onClick:
|
|
363
|
-
disabled:
|
|
364
|
-
children: [
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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__ */
|
|
400
|
+
/* @__PURE__ */ s(l, {
|
|
374
401
|
treatment: "glass",
|
|
375
402
|
className: "border-border-seam p-6",
|
|
376
403
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ s("h3", {
|
|
378
405
|
className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
406
|
+
children: [/* @__PURE__ */ o(a, { className: "h-4 w-4 text-info" }), " Harvest & inventory"]
|
|
380
407
|
}),
|
|
381
|
-
|
|
408
|
+
w && w.harvests.length > 0 ? /* @__PURE__ */ o("ul", {
|
|
382
409
|
className: "mb-5 space-y-2",
|
|
383
|
-
children:
|
|
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__ */
|
|
412
|
+
children: [/* @__PURE__ */ s("div", {
|
|
386
413
|
className: "min-w-0",
|
|
387
|
-
children: [/* @__PURE__ */
|
|
414
|
+
children: [/* @__PURE__ */ s("div", {
|
|
388
415
|
className: "flex items-center gap-2",
|
|
389
|
-
children: [/* @__PURE__ */
|
|
416
|
+
children: [/* @__PURE__ */ o("span", {
|
|
390
417
|
className: "truncate text-sm font-medium text-text-primary",
|
|
391
|
-
children: r.cropName ||
|
|
392
|
-
}), /* @__PURE__ */
|
|
418
|
+
children: r.cropName || y.cropName
|
|
419
|
+
}), /* @__PURE__ */ o(n, {
|
|
393
420
|
label: `Grade ${r.qualityGrade}`,
|
|
394
421
|
variant: "muted"
|
|
395
422
|
})]
|
|
396
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
409
|
-
}) : /* @__PURE__ */
|
|
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__ */
|
|
441
|
+
}) : /* @__PURE__ */ o("p", {
|
|
415
442
|
className: "mb-5 text-sm text-text-secondary",
|
|
416
|
-
children:
|
|
443
|
+
children: T ? "Loading harvests…" : "No harvests recorded against this plan yet."
|
|
417
444
|
}),
|
|
418
|
-
/* @__PURE__ */
|
|
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__ */
|
|
448
|
+
/* @__PURE__ */ o(x, {
|
|
422
449
|
label: "Crop",
|
|
423
|
-
children: /* @__PURE__ */
|
|
450
|
+
children: /* @__PURE__ */ s(d, {
|
|
424
451
|
value: Q,
|
|
425
|
-
onValueChange:
|
|
426
|
-
children: [/* @__PURE__ */
|
|
452
|
+
onValueChange: De,
|
|
453
|
+
children: [/* @__PURE__ */ o(m, {
|
|
427
454
|
className: "w-full",
|
|
428
|
-
children: /* @__PURE__ */
|
|
429
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
462
|
+
/* @__PURE__ */ o(x, {
|
|
436
463
|
label: "Quantity",
|
|
437
|
-
children: /* @__PURE__ */
|
|
464
|
+
children: /* @__PURE__ */ o(u, {
|
|
438
465
|
type: "number",
|
|
439
466
|
min: "0",
|
|
440
467
|
step: "any",
|
|
441
|
-
value:
|
|
442
|
-
onChange: (e) =>
|
|
468
|
+
value: q,
|
|
469
|
+
onChange: (e) => Oe(e.target.value),
|
|
443
470
|
placeholder: "e.g. 120"
|
|
444
471
|
})
|
|
445
472
|
}),
|
|
446
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ o(x, {
|
|
447
474
|
label: "Unit",
|
|
448
|
-
children: /* @__PURE__ */
|
|
449
|
-
value:
|
|
450
|
-
onChange: (e) =>
|
|
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__ */
|
|
481
|
+
/* @__PURE__ */ o(x, {
|
|
455
482
|
label: "Quality",
|
|
456
|
-
children: /* @__PURE__ */
|
|
457
|
-
value:
|
|
458
|
-
onValueChange:
|
|
459
|
-
children: [/* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ s(d, {
|
|
484
|
+
value: je,
|
|
485
|
+
onValueChange: Me,
|
|
486
|
+
children: [/* @__PURE__ */ o(m, {
|
|
460
487
|
className: "w-full",
|
|
461
|
-
children: /* @__PURE__ */
|
|
462
|
-
}), /* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
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__ */
|
|
494
|
+
/* @__PURE__ */ o(p, {
|
|
468
495
|
value: "B",
|
|
469
496
|
children: "Grade B"
|
|
470
497
|
}),
|
|
471
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ o(p, {
|
|
472
499
|
value: "C",
|
|
473
500
|
children: "Grade C"
|
|
474
501
|
})
|
|
475
502
|
] })]
|
|
476
503
|
})
|
|
477
504
|
}),
|
|
478
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ o(x, {
|
|
479
506
|
label: "Harvest date",
|
|
480
|
-
children: /* @__PURE__ */
|
|
507
|
+
children: /* @__PURE__ */ o(u, {
|
|
481
508
|
type: "date",
|
|
482
|
-
value:
|
|
483
|
-
onChange: (e) =>
|
|
509
|
+
value: Ne,
|
|
510
|
+
onChange: (e) => Pe(e.target.value)
|
|
484
511
|
})
|
|
485
512
|
}),
|
|
486
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ o(x, {
|
|
487
514
|
label: "Price / unit",
|
|
488
|
-
children: /* @__PURE__ */
|
|
515
|
+
children: /* @__PURE__ */ o(u, {
|
|
489
516
|
type: "number",
|
|
490
517
|
min: "0",
|
|
491
518
|
step: "any",
|
|
492
|
-
value:
|
|
493
|
-
onChange: (e) =>
|
|
519
|
+
value: J,
|
|
520
|
+
onChange: (e) => Fe(e.target.value),
|
|
494
521
|
placeholder: "Optional"
|
|
495
522
|
})
|
|
496
523
|
})
|
|
497
524
|
]
|
|
498
525
|
}),
|
|
499
|
-
/* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ s("div", {
|
|
500
527
|
className: "mt-4 flex flex-wrap items-center gap-4",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
528
|
+
children: [/* @__PURE__ */ s("label", {
|
|
502
529
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
503
|
-
children: [/* @__PURE__ */
|
|
530
|
+
children: [/* @__PURE__ */ o("input", {
|
|
504
531
|
type: "checkbox",
|
|
505
532
|
checked: Y,
|
|
506
|
-
onChange: (e) =>
|
|
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
|
|
510
|
-
onClick:
|
|
536
|
+
}), /* @__PURE__ */ s(c, {
|
|
537
|
+
onClick: ze,
|
|
511
538
|
disabled: X,
|
|
512
539
|
children: [
|
|
513
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
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__ */
|
|
553
|
+
}), /* @__PURE__ */ s("div", {
|
|
527
554
|
className: "mt-1 text-lg font-semibold text-text-primary",
|
|
528
|
-
children: [t, n ? /* @__PURE__ */
|
|
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
|
-
})] }),
|
|
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__ */
|
|
562
|
+
}), /* @__PURE__ */ o("div", {
|
|
536
563
|
className: "mt-1",
|
|
537
564
|
children: t
|
|
538
565
|
})] });
|
|
539
566
|
//#endregion
|
|
540
|
-
export {
|
|
567
|
+
export { y as PlanExecutionPanel };
|
|
541
568
|
|
|
542
569
|
//# sourceMappingURL=PlanExecutionPanel.js.map
|