@burdenoff/microfe-healthybowl 2026.813.23 → 2026.813.25
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/Modal.js +4 -1
- package/dist/healthybowl/components/Modal.js.map +1 -1
- package/dist/healthybowl/components/PlanExecutionPanel.js +112 -94
- 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/package.json +1 -1
|
@@ -15,7 +15,10 @@ var c = {
|
|
|
15
15
|
className: c[m],
|
|
16
16
|
children: [
|
|
17
17
|
/* @__PURE__ */ t(o, { children: [d && /* @__PURE__ */ e(s, { children: d }), f && /* @__PURE__ */ e(i, { children: f })] }),
|
|
18
|
-
|
|
18
|
+
/* @__PURE__ */ e("div", {
|
|
19
|
+
className: "max-h-[60dvh] overflow-y-auto overscroll-contain pr-1",
|
|
20
|
+
children: p
|
|
21
|
+
}),
|
|
19
22
|
h && /* @__PURE__ */ e(a, { children: h })
|
|
20
23
|
]
|
|
21
24
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":[],"sources":["../../../src/healthybowl/components/Modal.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n} from '@burdenoff/fe-libs/ui';\n\ninterface ModalProps {\n open: boolean;\n onClose: () => void;\n title: string;\n description?: string;\n children: ReactNode;\n size?: 'sm' | 'md' | 'lg' | 'xl';\n footer?: ReactNode;\n}\n\nconst sizeClasses: Record<NonNullable<ModalProps['size']>, string> = {\n sm: 'sm:max-w-sm',\n md: 'sm:max-w-lg',\n lg: 'sm:max-w-2xl',\n xl: 'sm:max-w-3xl',\n};\n\n/**\n * Modal scaffold wrapping the Boff `ResponsiveDialog` (centred dialog on\n * desktop, bottom-sheet on mobile). The primitive provides the scrim, Escape\n * handling, scroll-lock and close affordance, so those are no longer hand-rolled\n * here. `onClose` fires whenever the dialog is dismissed.\n */\nexport const Modal: FC<ModalProps> = ({ open, onClose, title, description, children, size = 'md', footer }) => {\n return (\n <ResponsiveDialog\n open={open}\n onOpenChange={(next) => {\n if (!next) {\n onClose();\n }\n }}\n >\n <ResponsiveDialogContent className={sizeClasses[size]}>\n <ResponsiveDialogHeader>\n {title && <ResponsiveDialogTitle>{title}</ResponsiveDialogTitle>}\n {description && <ResponsiveDialogDescription>{description}</ResponsiveDialogDescription>}\n </ResponsiveDialogHeader>\n {children}\n {footer && <ResponsiveDialogFooter>{footer}</ResponsiveDialogFooter>}\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n};\n"],"mappings":";;;AAoBA,IAAM,IAA+D;CACnE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAQY,KAAyB,EAAE,SAAM,YAAS,UAAO,gBAAa,aAAU,UAAO,MAAM,gBAE9F,kBAAC,GAAD;CACQ;CACN,eAAe,MAAS;AACtB,EAAK,KACH,GAAS;;WAIb,kBAAC,GAAD;EAAyB,WAAW,EAAY;YAAhD;GACE,kBAAC,GAAD,EAAA,UAAA,CACG,KAAS,kBAAC,GAAD,EAAA,UAAwB,GAA8B,CAAA,EAC/D,KAAe,kBAAC,GAAD,EAAA,UAA8B,GAA0C,CAAA,CACjE,EAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"Modal.js","names":[],"sources":["../../../src/healthybowl/components/Modal.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n} from '@burdenoff/fe-libs/ui';\n\ninterface ModalProps {\n open: boolean;\n onClose: () => void;\n title: string;\n description?: string;\n children: ReactNode;\n size?: 'sm' | 'md' | 'lg' | 'xl';\n footer?: ReactNode;\n}\n\nconst sizeClasses: Record<NonNullable<ModalProps['size']>, string> = {\n sm: 'sm:max-w-sm',\n md: 'sm:max-w-lg',\n lg: 'sm:max-w-2xl',\n xl: 'sm:max-w-3xl',\n};\n\n/**\n * Modal scaffold wrapping the Boff `ResponsiveDialog` (centred dialog on\n * desktop, bottom-sheet on mobile). The primitive provides the scrim, Escape\n * handling, scroll-lock and close affordance, so those are no longer hand-rolled\n * here. `onClose` fires whenever the dialog is dismissed.\n */\nexport const Modal: FC<ModalProps> = ({ open, onClose, title, description, children, size = 'md', footer }) => {\n return (\n <ResponsiveDialog\n open={open}\n onOpenChange={(next) => {\n if (!next) {\n onClose();\n }\n }}\n >\n <ResponsiveDialogContent className={sizeClasses[size]}>\n <ResponsiveDialogHeader>\n {title && <ResponsiveDialogTitle>{title}</ResponsiveDialogTitle>}\n {description && <ResponsiveDialogDescription>{description}</ResponsiveDialogDescription>}\n </ResponsiveDialogHeader>\n {/*\n Cap the body so a tall form scrolls instead of pushing the footer — and with it the\n submit button — below the fold. `ResponsiveDialogContent` grows to fit its children and\n nothing here was scrollable, so on a short viewport (a laptop with ~500px of usable\n height, or a phone) the primary action simply became unreachable: visible in the DOM,\n enabled, and impossible to click.\n\n `max-h` only engages once the content would exceed it, so short modals are unchanged.\n `dvh` rather than `vh` so mobile browser chrome is accounted for.\n */}\n <div className=\"max-h-[60dvh] overflow-y-auto overscroll-contain pr-1\">{children}</div>\n {footer && <ResponsiveDialogFooter>{footer}</ResponsiveDialogFooter>}\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n};\n"],"mappings":";;;AAoBA,IAAM,IAA+D;CACnE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAQY,KAAyB,EAAE,SAAM,YAAS,UAAO,gBAAa,aAAU,UAAO,MAAM,gBAE9F,kBAAC,GAAD;CACQ;CACN,eAAe,MAAS;AACtB,EAAK,KACH,GAAS;;WAIb,kBAAC,GAAD;EAAyB,WAAW,EAAY;YAAhD;GACE,kBAAC,GAAD,EAAA,UAAA,CACG,KAAS,kBAAC,GAAD,EAAA,UAAwB,GAA8B,CAAA,EAC/D,KAAe,kBAAC,GAAD,EAAA,UAA8B,GAA0C,CAAA,CACjE,EAAA,CAAA;GAWzB,kBAAC,OAAD;IAAK,WAAU;IAAyD;IAAe,CAAA;GACtF,KAAU,kBAAC,GAAD,EAAA,UAAyB,GAAgC,CAAA;GAC5C;;CACT,CAAA"}
|
|
@@ -4,9 +4,9 @@ import { useToast as r } from "../hooks/useToast.js";
|
|
|
4
4
|
import "./index.js";
|
|
5
5
|
import { usePlanExecution as ee } from "../hooks/usePlanExecution.js";
|
|
6
6
|
import { useMemo as i, useState as a } from "react";
|
|
7
|
-
import { Activity as
|
|
7
|
+
import { Activity as o, CalendarClock as te, PackageCheck as ne, Pencil as re, Sprout as ie, Target as ae, Trash2 as oe, X as se } from "lucide-react";
|
|
8
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
|
|
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 ce } from "@burdenoff/fe-libs/ui";
|
|
10
10
|
//#region src/healthybowl/components/PlanExecutionPanel.tsx
|
|
11
11
|
var _ = [
|
|
12
12
|
{
|
|
@@ -49,35 +49,39 @@ var _ = [
|
|
|
49
49
|
value: "OTHER",
|
|
50
50
|
label: "Other"
|
|
51
51
|
}
|
|
52
|
-
],
|
|
52
|
+
], le = (e) => _.find((t) => t.value === e)?.label ?? e, v = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), ue = (e) => {
|
|
53
53
|
let t = Number(e);
|
|
54
54
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
55
55
|
};
|
|
56
56
|
function y() {
|
|
57
57
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `hb-harvest-${Date.now()}-${Math.round(Math.random() * 1e9)}`;
|
|
58
58
|
}
|
|
59
|
-
var b = ({ plan: b, crops: C }) => {
|
|
60
|
-
let { toast: w } = r(), { execution: T, loading:
|
|
59
|
+
var b = ({ plan: b, crops: C, onCropChanged: de }) => {
|
|
60
|
+
let { toast: w } = r(), { execution: T, loading: fe, setTransplantDate: pe, addActivity: me, updateActivity: he, deleteActivity: ge, recordHarvest: _e } = ee(b.id), E = i(() => {
|
|
61
61
|
let e = C.filter((e) => !b.fieldId || e.field === b.fieldId);
|
|
62
62
|
return e.length > 0 ? e : C;
|
|
63
|
-
}, [C, b.fieldId]),
|
|
64
|
-
if (
|
|
65
|
-
|
|
63
|
+
}, [C, b.fieldId]), ve = i(() => E.find((e) => e.name === b.cropName)?.id ?? E[0]?.id ?? "", [E, b.cropName]), [D, O] = a(""), [ye, k] = a(!1), be = async () => {
|
|
64
|
+
if (D) {
|
|
65
|
+
k(!0);
|
|
66
66
|
try {
|
|
67
|
-
await
|
|
67
|
+
await pe(D), w({
|
|
68
68
|
title: "Transplant date set",
|
|
69
69
|
variant: "success"
|
|
70
|
-
}),
|
|
70
|
+
}), O("");
|
|
71
71
|
} catch {
|
|
72
72
|
w({
|
|
73
73
|
title: "Could not set transplant date",
|
|
74
74
|
variant: "error"
|
|
75
75
|
});
|
|
76
76
|
} finally {
|
|
77
|
-
|
|
77
|
+
k(!1);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
}, [
|
|
80
|
+
}, [A, j] = a("WATERING"), [M, N] = a(v()), [P, F] = a(""), [I, L] = a(""), [R, z] = a(""), [B, V] = a(""), [H, U] = a(!1), [W, G] = a(null), K = () => {
|
|
81
|
+
G(null), j("WATERING"), N(v()), F(""), L(""), z(""), V("");
|
|
82
|
+
}, xe = (e) => {
|
|
83
|
+
G(e.id), j(e.type), N((e.activityDate ?? "").slice(0, 10)), F(e.quantity == null ? "" : String(e.quantity)), L(e.unit ?? ""), z(e.laborHours == null ? "" : String(e.laborHours)), V(e.notes ?? "");
|
|
84
|
+
}, Se = async () => {
|
|
81
85
|
if (!M) {
|
|
82
86
|
w({
|
|
83
87
|
title: "Pick an activity date",
|
|
@@ -85,30 +89,34 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
85
89
|
});
|
|
86
90
|
return;
|
|
87
91
|
}
|
|
88
|
-
|
|
92
|
+
U(!0);
|
|
93
|
+
let e = {
|
|
94
|
+
type: A,
|
|
95
|
+
activityDate: M,
|
|
96
|
+
quantity: P ? Number(P) : null,
|
|
97
|
+
unit: I.trim() || null,
|
|
98
|
+
laborHours: R ? Number(R) : null,
|
|
99
|
+
notes: B.trim() || null
|
|
100
|
+
};
|
|
89
101
|
try {
|
|
90
|
-
await
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
unit: F.trim() || null,
|
|
95
|
-
laborHours: L ? Number(L) : null,
|
|
96
|
-
notes: R.trim() || null
|
|
97
|
-
}), w({
|
|
102
|
+
W ? (await he(W, e), w({
|
|
103
|
+
title: "Activity updated",
|
|
104
|
+
variant: "success"
|
|
105
|
+
})) : (await me(e), w({
|
|
98
106
|
title: "Activity logged",
|
|
99
107
|
variant: "success"
|
|
100
|
-
})
|
|
108
|
+
})), A === "TRANSPLANT" && de?.(), K();
|
|
101
109
|
} catch {
|
|
102
110
|
w({
|
|
103
|
-
title: "Could not log activity",
|
|
111
|
+
title: W ? "Could not update activity" : "Could not log activity",
|
|
104
112
|
variant: "error"
|
|
105
113
|
});
|
|
106
114
|
} finally {
|
|
107
|
-
|
|
115
|
+
U(!1);
|
|
108
116
|
}
|
|
109
|
-
},
|
|
117
|
+
}, Ce = async (e) => {
|
|
110
118
|
try {
|
|
111
|
-
await
|
|
119
|
+
await ge(e), W === e && K(), w({
|
|
112
120
|
title: "Activity removed",
|
|
113
121
|
variant: "success"
|
|
114
122
|
});
|
|
@@ -118,8 +126,8 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
118
126
|
variant: "error"
|
|
119
127
|
});
|
|
120
128
|
}
|
|
121
|
-
}, [
|
|
122
|
-
let e =
|
|
129
|
+
}, [we, Te] = a(""), [Ee, De] = a(""), [Oe, ke] = a("kg"), [q, Ae] = a("A"), [je, Me] = a(v()), [J, Ne] = a(""), [Y, Pe] = a(!0), [X, Z] = a(!1), [Fe, Ie] = a(() => y()), Q = we || ve, Le = async () => {
|
|
130
|
+
let e = ue(Ee);
|
|
123
131
|
if (!Q) {
|
|
124
132
|
w({
|
|
125
133
|
title: "Add a crop on this field first",
|
|
@@ -144,20 +152,20 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
144
152
|
if (!X) {
|
|
145
153
|
Z(!0);
|
|
146
154
|
try {
|
|
147
|
-
await
|
|
155
|
+
await _e({
|
|
148
156
|
cropId: Q,
|
|
149
157
|
fieldId: b.fieldId,
|
|
150
158
|
quantity: e,
|
|
151
|
-
unit:
|
|
152
|
-
quality:
|
|
153
|
-
harvestDate:
|
|
154
|
-
pricePerUnit:
|
|
159
|
+
unit: Oe.trim() || "kg",
|
|
160
|
+
quality: q,
|
|
161
|
+
harvestDate: je,
|
|
162
|
+
pricePerUnit: J ? Number(J) : null,
|
|
155
163
|
addToInventory: Y,
|
|
156
|
-
clientMutationId:
|
|
164
|
+
clientMutationId: Fe
|
|
157
165
|
}), w({
|
|
158
166
|
title: Y ? "Harvest recorded & added to inventory" : "Harvest recorded",
|
|
159
167
|
variant: "success"
|
|
160
|
-
}),
|
|
168
|
+
}), De(""), Ne(""), Ie(y());
|
|
161
169
|
} catch {
|
|
162
170
|
w({
|
|
163
171
|
title: "Could not record harvest",
|
|
@@ -167,7 +175,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
167
175
|
Z(!1);
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
|
-
}, $ = T?.yieldVariancePct,
|
|
178
|
+
}, $ = T?.yieldVariancePct, Re = $ == null ? "—" : `${$ > 0 ? "+" : ""}${t(Math.round($))}%`, ze = $ == null ? "muted" : $ >= 0 ? "success" : "warning";
|
|
171
179
|
return /* @__PURE__ */ c("div", {
|
|
172
180
|
className: "space-y-6",
|
|
173
181
|
"data-testid": "plan-execution-panel",
|
|
@@ -179,7 +187,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
179
187
|
children: [
|
|
180
188
|
/* @__PURE__ */ c("h3", {
|
|
181
189
|
className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
182
|
-
children: [/* @__PURE__ */ s(
|
|
190
|
+
children: [/* @__PURE__ */ s(ae, { className: "h-4 w-4 text-info" }), " Execution & yield"]
|
|
183
191
|
}),
|
|
184
192
|
/* @__PURE__ */ c("div", {
|
|
185
193
|
className: "grid grid-cols-2 gap-4 md:grid-cols-4",
|
|
@@ -200,8 +208,8 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
200
208
|
}), /* @__PURE__ */ s("div", {
|
|
201
209
|
className: "mt-1",
|
|
202
210
|
children: /* @__PURE__ */ s(n, {
|
|
203
|
-
label:
|
|
204
|
-
variant:
|
|
211
|
+
label: Re,
|
|
212
|
+
variant: ze
|
|
205
213
|
})
|
|
206
214
|
})] }),
|
|
207
215
|
/* @__PURE__ */ s(x, {
|
|
@@ -215,7 +223,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
215
223
|
children: [/* @__PURE__ */ c("div", { children: [
|
|
216
224
|
/* @__PURE__ */ c("div", {
|
|
217
225
|
className: "flex items-center gap-1 text-xs text-text-secondary",
|
|
218
|
-
children: [/* @__PURE__ */ s(
|
|
226
|
+
children: [/* @__PURE__ */ s(te, { className: "h-3.5 w-3.5" }), " Transplant date"]
|
|
219
227
|
}),
|
|
220
228
|
/* @__PURE__ */ s("div", {
|
|
221
229
|
className: "mt-1 text-sm font-medium text-text-primary",
|
|
@@ -225,15 +233,15 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
225
233
|
className: "mt-2 flex items-center gap-2",
|
|
226
234
|
children: [/* @__PURE__ */ s(d, {
|
|
227
235
|
type: "date",
|
|
228
|
-
value:
|
|
229
|
-
onChange: (e) =>
|
|
236
|
+
value: D,
|
|
237
|
+
onChange: (e) => O(e.target.value),
|
|
230
238
|
className: "h-9 w-44",
|
|
231
239
|
"aria-label": "Transplant date"
|
|
232
240
|
}), /* @__PURE__ */ s(l, {
|
|
233
241
|
size: "sm",
|
|
234
242
|
variant: "outline",
|
|
235
|
-
onClick:
|
|
236
|
-
disabled: !
|
|
243
|
+
onClick: be,
|
|
244
|
+
disabled: !D || ye,
|
|
237
245
|
children: T?.transplantDate ? "Update" : "Set"
|
|
238
246
|
})]
|
|
239
247
|
})
|
|
@@ -253,7 +261,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
253
261
|
children: [
|
|
254
262
|
/* @__PURE__ */ c("h3", {
|
|
255
263
|
className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
256
|
-
children: [/* @__PURE__ */ s(
|
|
264
|
+
children: [/* @__PURE__ */ s(o, { className: "h-4 w-4 text-info" }), " Activity log"]
|
|
257
265
|
}),
|
|
258
266
|
T && T.activities.length > 0 ? /* @__PURE__ */ s("ul", {
|
|
259
267
|
className: "mb-5 space-y-2",
|
|
@@ -264,7 +272,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
264
272
|
children: [/* @__PURE__ */ c("div", {
|
|
265
273
|
className: "flex items-center gap-2",
|
|
266
274
|
children: [/* @__PURE__ */ s(n, {
|
|
267
|
-
label:
|
|
275
|
+
label: le(r.type),
|
|
268
276
|
variant: "info"
|
|
269
277
|
}), /* @__PURE__ */ s("span", {
|
|
270
278
|
className: "text-xs text-text-secondary",
|
|
@@ -278,17 +286,26 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
278
286
|
r.notes
|
|
279
287
|
].filter(Boolean).join(" · ") || "—"
|
|
280
288
|
})]
|
|
281
|
-
}), /* @__PURE__ */
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
}), /* @__PURE__ */ c("div", {
|
|
290
|
+
className: "flex shrink-0 items-center gap-1",
|
|
291
|
+
children: [/* @__PURE__ */ s(l, {
|
|
292
|
+
size: "sm",
|
|
293
|
+
variant: "ghost",
|
|
294
|
+
onClick: () => xe(r),
|
|
295
|
+
"aria-label": "Edit activity",
|
|
296
|
+
children: /* @__PURE__ */ s(re, { className: "h-4 w-4 text-text-secondary" })
|
|
297
|
+
}), /* @__PURE__ */ s(l, {
|
|
298
|
+
size: "sm",
|
|
299
|
+
variant: "ghost",
|
|
300
|
+
onClick: () => Ce(r.id),
|
|
301
|
+
"aria-label": "Remove activity",
|
|
302
|
+
children: /* @__PURE__ */ s(oe, { className: "h-4 w-4 text-text-secondary" })
|
|
303
|
+
})]
|
|
287
304
|
})]
|
|
288
305
|
}, r.id))
|
|
289
306
|
}) : /* @__PURE__ */ s("p", {
|
|
290
307
|
className: "mb-5 text-sm text-text-secondary",
|
|
291
|
-
children:
|
|
308
|
+
children: fe ? "Loading activities…" : "No activities logged yet. Record watering, tilling and field work below."
|
|
292
309
|
}),
|
|
293
310
|
/* @__PURE__ */ c("div", {
|
|
294
311
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",
|
|
@@ -296,8 +313,8 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
296
313
|
/* @__PURE__ */ s(S, {
|
|
297
314
|
label: "Type",
|
|
298
315
|
children: /* @__PURE__ */ c(f, {
|
|
299
|
-
value:
|
|
300
|
-
onValueChange:
|
|
316
|
+
value: A,
|
|
317
|
+
onValueChange: j,
|
|
301
318
|
children: [/* @__PURE__ */ s(h, {
|
|
302
319
|
className: "w-full",
|
|
303
320
|
children: /* @__PURE__ */ s(g, {})
|
|
@@ -312,7 +329,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
312
329
|
children: /* @__PURE__ */ s(d, {
|
|
313
330
|
type: "date",
|
|
314
331
|
value: M,
|
|
315
|
-
onChange: (e) =>
|
|
332
|
+
onChange: (e) => N(e.target.value)
|
|
316
333
|
})
|
|
317
334
|
}),
|
|
318
335
|
/* @__PURE__ */ s(S, {
|
|
@@ -321,16 +338,16 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
321
338
|
type: "number",
|
|
322
339
|
min: "0",
|
|
323
340
|
step: "any",
|
|
324
|
-
value:
|
|
325
|
-
onChange: (e) =>
|
|
341
|
+
value: P,
|
|
342
|
+
onChange: (e) => F(e.target.value),
|
|
326
343
|
placeholder: "e.g. 20"
|
|
327
344
|
})
|
|
328
345
|
}),
|
|
329
346
|
/* @__PURE__ */ s(S, {
|
|
330
347
|
label: "Unit",
|
|
331
348
|
children: /* @__PURE__ */ s(d, {
|
|
332
|
-
value:
|
|
333
|
-
onChange: (e) =>
|
|
349
|
+
value: I,
|
|
350
|
+
onChange: (e) => L(e.target.value),
|
|
334
351
|
placeholder: "L, kg…"
|
|
335
352
|
})
|
|
336
353
|
}),
|
|
@@ -340,33 +357,34 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
340
357
|
type: "number",
|
|
341
358
|
min: "0",
|
|
342
359
|
step: "any",
|
|
343
|
-
value:
|
|
344
|
-
onChange: (e) =>
|
|
360
|
+
value: R,
|
|
361
|
+
onChange: (e) => z(e.target.value),
|
|
345
362
|
placeholder: "e.g. 1.5"
|
|
346
363
|
})
|
|
347
364
|
}),
|
|
348
365
|
/* @__PURE__ */ s(S, {
|
|
349
366
|
label: "Notes",
|
|
350
|
-
children: /* @__PURE__ */ s(
|
|
351
|
-
value:
|
|
352
|
-
onChange: (e) =>
|
|
367
|
+
children: /* @__PURE__ */ s(ce, {
|
|
368
|
+
value: B,
|
|
369
|
+
onChange: (e) => V(e.target.value),
|
|
353
370
|
rows: 1,
|
|
354
371
|
placeholder: "Optional"
|
|
355
372
|
})
|
|
356
373
|
})
|
|
357
374
|
]
|
|
358
375
|
}),
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
className: "mt-4",
|
|
361
|
-
children: /* @__PURE__ */ c(l, {
|
|
362
|
-
onClick:
|
|
363
|
-
disabled:
|
|
364
|
-
children: [
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
376
|
+
/* @__PURE__ */ c("div", {
|
|
377
|
+
className: "mt-4 flex items-center gap-2",
|
|
378
|
+
children: [/* @__PURE__ */ c(l, {
|
|
379
|
+
onClick: Se,
|
|
380
|
+
disabled: H,
|
|
381
|
+
children: [/* @__PURE__ */ s(o, { className: "h-4 w-4" }), H ? W ? "Saving…" : "Logging…" : W ? "Save changes" : "Log activity"]
|
|
382
|
+
}), W && /* @__PURE__ */ c(l, {
|
|
383
|
+
variant: "ghost",
|
|
384
|
+
onClick: K,
|
|
385
|
+
disabled: H,
|
|
386
|
+
children: [/* @__PURE__ */ s(se, { className: "h-4 w-4" }), " Cancel"]
|
|
387
|
+
})]
|
|
370
388
|
})
|
|
371
389
|
]
|
|
372
390
|
}),
|
|
@@ -376,7 +394,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
376
394
|
children: [
|
|
377
395
|
/* @__PURE__ */ c("h3", {
|
|
378
396
|
className: "mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
379
|
-
children: [/* @__PURE__ */ s(
|
|
397
|
+
children: [/* @__PURE__ */ s(ie, { className: "h-4 w-4 text-info" }), " Harvest & inventory"]
|
|
380
398
|
}),
|
|
381
399
|
T && T.harvests.length > 0 ? /* @__PURE__ */ s("ul", {
|
|
382
400
|
className: "mb-5 space-y-2",
|
|
@@ -405,7 +423,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
405
423
|
})]
|
|
406
424
|
}), r.productId ? /* @__PURE__ */ c("span", {
|
|
407
425
|
className: "inline-flex items-center gap-1 whitespace-nowrap text-xs font-medium text-status-success-text",
|
|
408
|
-
children: [/* @__PURE__ */ s(
|
|
426
|
+
children: [/* @__PURE__ */ s(ne, { className: "h-4 w-4" }), " In inventory"]
|
|
409
427
|
}) : /* @__PURE__ */ s(n, {
|
|
410
428
|
label: r.status,
|
|
411
429
|
variant: "muted"
|
|
@@ -413,7 +431,7 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
413
431
|
}, r.id))
|
|
414
432
|
}) : /* @__PURE__ */ s("p", {
|
|
415
433
|
className: "mb-5 text-sm text-text-secondary",
|
|
416
|
-
children:
|
|
434
|
+
children: fe ? "Loading harvests…" : "No harvests recorded against this plan yet."
|
|
417
435
|
}),
|
|
418
436
|
/* @__PURE__ */ c("div", {
|
|
419
437
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",
|
|
@@ -422,11 +440,11 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
422
440
|
label: "Crop",
|
|
423
441
|
children: /* @__PURE__ */ c(f, {
|
|
424
442
|
value: Q,
|
|
425
|
-
onValueChange:
|
|
443
|
+
onValueChange: Te,
|
|
426
444
|
children: [/* @__PURE__ */ s(h, {
|
|
427
445
|
className: "w-full",
|
|
428
446
|
children: /* @__PURE__ */ s(g, { placeholder: "Select crop" })
|
|
429
|
-
}), /* @__PURE__ */ s(p, { children:
|
|
447
|
+
}), /* @__PURE__ */ s(p, { children: E.map((e) => /* @__PURE__ */ s(m, {
|
|
430
448
|
value: e.id,
|
|
431
449
|
children: e.variety ? `${e.name} — ${e.variety}` : e.name
|
|
432
450
|
}, e.id)) })]
|
|
@@ -438,24 +456,24 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
438
456
|
type: "number",
|
|
439
457
|
min: "0",
|
|
440
458
|
step: "any",
|
|
441
|
-
value:
|
|
442
|
-
onChange: (e) =>
|
|
459
|
+
value: Ee,
|
|
460
|
+
onChange: (e) => De(e.target.value),
|
|
443
461
|
placeholder: "e.g. 120"
|
|
444
462
|
})
|
|
445
463
|
}),
|
|
446
464
|
/* @__PURE__ */ s(S, {
|
|
447
465
|
label: "Unit",
|
|
448
466
|
children: /* @__PURE__ */ s(d, {
|
|
449
|
-
value:
|
|
450
|
-
onChange: (e) =>
|
|
467
|
+
value: Oe,
|
|
468
|
+
onChange: (e) => ke(e.target.value),
|
|
451
469
|
placeholder: "kg"
|
|
452
470
|
})
|
|
453
471
|
}),
|
|
454
472
|
/* @__PURE__ */ s(S, {
|
|
455
473
|
label: "Quality",
|
|
456
474
|
children: /* @__PURE__ */ c(f, {
|
|
457
|
-
value:
|
|
458
|
-
onValueChange:
|
|
475
|
+
value: q,
|
|
476
|
+
onValueChange: Ae,
|
|
459
477
|
children: [/* @__PURE__ */ s(h, {
|
|
460
478
|
className: "w-full",
|
|
461
479
|
children: /* @__PURE__ */ s(g, {})
|
|
@@ -479,8 +497,8 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
479
497
|
label: "Harvest date",
|
|
480
498
|
children: /* @__PURE__ */ s(d, {
|
|
481
499
|
type: "date",
|
|
482
|
-
value:
|
|
483
|
-
onChange: (e) =>
|
|
500
|
+
value: je,
|
|
501
|
+
onChange: (e) => Me(e.target.value)
|
|
484
502
|
})
|
|
485
503
|
}),
|
|
486
504
|
/* @__PURE__ */ s(S, {
|
|
@@ -489,8 +507,8 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
489
507
|
type: "number",
|
|
490
508
|
min: "0",
|
|
491
509
|
step: "any",
|
|
492
|
-
value:
|
|
493
|
-
onChange: (e) =>
|
|
510
|
+
value: J,
|
|
511
|
+
onChange: (e) => Ne(e.target.value),
|
|
494
512
|
placeholder: "Optional"
|
|
495
513
|
})
|
|
496
514
|
})
|
|
@@ -503,14 +521,14 @@ var b = ({ plan: b, crops: C }) => {
|
|
|
503
521
|
children: [/* @__PURE__ */ s("input", {
|
|
504
522
|
type: "checkbox",
|
|
505
523
|
checked: Y,
|
|
506
|
-
onChange: (e) =>
|
|
524
|
+
onChange: (e) => Pe(e.target.checked),
|
|
507
525
|
className: "h-4 w-4 rounded border-border-subtle"
|
|
508
526
|
}), "Add harvested quantity to inventory"]
|
|
509
527
|
}), /* @__PURE__ */ c(l, {
|
|
510
|
-
onClick:
|
|
528
|
+
onClick: Le,
|
|
511
529
|
disabled: X,
|
|
512
530
|
children: [
|
|
513
|
-
/* @__PURE__ */ s(
|
|
531
|
+
/* @__PURE__ */ s(ie, { className: "h-4 w-4" }),
|
|
514
532
|
" ",
|
|
515
533
|
X ? "Recording…" : "Record harvest"
|
|
516
534
|
]
|