@burdenoff/microfe-healthybowl 2026.904.21 → 2026.904.22
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/components/assistant/AssistantChatArea.js +7 -9
- package/dist/components/assistant/AssistantChatArea.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoot.js +56 -57
- package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoutes.js +36 -48
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
- package/dist/healthybowl/components/PageLayout.js +10 -11
- package/dist/healthybowl/components/PageLayout.js.map +1 -1
- package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
- package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +141 -157
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlData.js +0 -18
- package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +37 -52
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +78 -135
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
- package/dist/healthybowl/offline/OfflineStatusPill.js +21 -40
- package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
- package/dist/healthybowl/offline/OfflineSyncProvider.js +130 -153
- package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
- package/dist/healthybowl/offline/graphql.js.map +1 -1
- package/dist/healthybowl/offline/store.js +1 -1
- package/dist/healthybowl/offline/syncEngine.js +1 -2
- package/dist/healthybowl/offline/syncEngine.js.map +1 -1
- package/dist/healthybowl/offline/types.js.map +1 -1
- package/dist/healthybowl/pages/GettingStartedPage.js +0 -1
- package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
- package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/ReportsPage.js +99 -136
- package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +162 -204
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +178 -196
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +141 -142
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropFieldsPage.js +0 -2
- package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropHarvestPage.js +272 -316
- package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +0 -6
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +846 -871
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +334 -376
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +188 -415
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/labels.js +2 -10
- package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js +0 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
- package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
- package/dist/healthybowl/pages/fields/FieldMapPage.js +0 -2
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js +107 -92
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +188 -228
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +191 -261
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js +307 -338
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +102 -126
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +215 -257
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js +0 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js +0 -4
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +9 -8
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +419 -520
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +130 -129
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +237 -285
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
- package/dist/healthybowl/utils/plantingCapacity.js +10 -10
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +86 -74
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/services/assistantApi.js +30 -59
- package/dist/services/assistantApi.js.map +1 -1
- package/dist/utils/pageContext.js +1 -15
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
- package/dist/healthybowl/hooks/useAgronomyDecisions.js +0 -79
- package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +0 -1
- package/dist/healthybowl/hooks/useAnalyticsReports.js +0 -173
- package/dist/healthybowl/hooks/useAnalyticsReports.js.map +0 -1
- package/dist/healthybowl/hooks/useComplianceExports.js +0 -74
- package/dist/healthybowl/hooks/useComplianceExports.js.map +0 -1
- package/dist/healthybowl/hooks/useConsultationPayments.js +0 -59
- package/dist/healthybowl/hooks/useConsultationPayments.js.map +0 -1
- package/dist/healthybowl/hooks/usePlantingEstimate.js +0 -88
- package/dist/healthybowl/hooks/usePlantingEstimate.js.map +0 -1
- package/dist/healthybowl/offline/HeaderOfflinePill.js +0 -28
- package/dist/healthybowl/offline/HeaderOfflinePill.js.map +0 -1
- package/dist/healthybowl/offline/captureCache.js +0 -30
- package/dist/healthybowl/offline/captureCache.js.map +0 -1
- package/dist/healthybowl/offline/headerSlot.js +0 -24
- package/dist/healthybowl/offline/headerSlot.js.map +0 -1
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js +0 -287
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +0 -291
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +0 -300
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js +0 -135
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +0 -49
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +0 -48
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +0 -54
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +0 -1
- package/dist/healthybowl/pages/livestock/PedigreeTree.js +0 -154
- package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +0 -1
- package/dist/healthybowl/pages/livestock/eidTagInput.js +0 -39
- package/dist/healthybowl/pages/livestock/eidTagInput.js.map +0 -1
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js +0 -68
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +0 -1
- package/dist/healthybowl/pages/weather/alertDelivery.js +0 -105
- package/dist/healthybowl/pages/weather/alertDelivery.js.map +0 -1
- package/dist/healthybowl/utils/icsInspection.js +0 -18
- package/dist/healthybowl/utils/icsInspection.js.map +0 -1
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
|
-
import { StatusBadge as t } from "../../components/StatusBadge.js";
|
|
3
|
-
import { EmptyState as n } from "../../components/EmptyState.js";
|
|
4
|
-
import { ToastContainer as r } from "../../components/Toast.js";
|
|
5
|
-
import { useConfirm as i } from "../../components/ConfirmDialog.js";
|
|
6
|
-
import { useToast as a } from "../../hooks/useToast.js";
|
|
7
|
-
import "../../components/index.js";
|
|
8
|
-
import { useAgronomyDecisions as o } from "../../hooks/useAgronomyDecisions.js";
|
|
9
|
-
import { useMemo as s, useState as c } from "react";
|
|
10
|
-
import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
-
import { Cpu as u, Droplets as d, Ruler as f, ShieldAlert as p, Sprout as m } from "lucide-react";
|
|
12
|
-
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
13
|
-
import { Button as _ } from "@burdenoff/fe-libs/ui";
|
|
14
|
-
//#region src/healthybowl/pages/ai/AiDecisionsPage.tsx
|
|
15
|
-
var v = {
|
|
16
|
-
IRRIGATION: d,
|
|
17
|
-
TREATMENT: m
|
|
18
|
-
};
|
|
19
|
-
function y(e) {
|
|
20
|
-
return e === "PASS" ? "success" : e === "BLOCKED" ? "error" : "muted";
|
|
21
|
-
}
|
|
22
|
-
function b(e) {
|
|
23
|
-
return !e || typeof e != "object" ? [] : Object.entries(e).filter(([, e]) => e != null && e !== "").map(([e, t]) => `${e}: ${typeof t == "object" ? JSON.stringify(t) : String(t)}`);
|
|
24
|
-
}
|
|
25
|
-
var x = () => {
|
|
26
|
-
let { t } = l(), { toasts: f, toast: p, dismiss: v } = a(), y = i(), { decisions: b, loading: x, error: C, propose: w, proposing: T, decide: E, deciding: D } = o(), [O, k] = c("PROPOSED"), A = s(() => {
|
|
27
|
-
let e = {
|
|
28
|
-
PROPOSED: [],
|
|
29
|
-
ACCEPTED: [],
|
|
30
|
-
REJECTED: [],
|
|
31
|
-
BLOCKED: []
|
|
32
|
-
};
|
|
33
|
-
for (let t of b) {
|
|
34
|
-
let n = e[t.status];
|
|
35
|
-
n && n.push(t);
|
|
36
|
-
}
|
|
37
|
-
return e;
|
|
38
|
-
}, [b]), j = async (e) => {
|
|
39
|
-
try {
|
|
40
|
-
let n = await w(e);
|
|
41
|
-
if (n.skippedReason) {
|
|
42
|
-
p({
|
|
43
|
-
title: t("healthybowl.ai.decisions.sweepSkipped.title", "Nothing to propose"),
|
|
44
|
-
description: n.skippedReason,
|
|
45
|
-
variant: "info"
|
|
46
|
-
});
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
p({
|
|
50
|
-
title: t("healthybowl.ai.decisions.sweepDone.title", "Sweep complete"),
|
|
51
|
-
description: t("healthybowl.ai.decisions.sweepDone.description", `${n.decisions.length} proposal(s).`),
|
|
52
|
-
variant: "success"
|
|
53
|
-
});
|
|
54
|
-
} catch (e) {
|
|
55
|
-
p({
|
|
56
|
-
title: t("healthybowl.ai.decisions.sweepFailed", "Sweep failed"),
|
|
57
|
-
description: e instanceof Error ? e.message : String(e),
|
|
58
|
-
variant: "error"
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}, M = async (e, n) => {
|
|
62
|
-
if (await y({
|
|
63
|
-
title: n === "ACCEPTED" ? t("healthybowl.ai.decisions.confirmAccept", "Accept this proposal?") : t("healthybowl.ai.decisions.confirmReject", "Reject this proposal?"),
|
|
64
|
-
message: e.title
|
|
65
|
-
})) try {
|
|
66
|
-
await E(e.id, n), p({
|
|
67
|
-
title: n === "ACCEPTED" ? t("healthybowl.ai.decisions.accepted", "Proposal accepted") : t("healthybowl.ai.decisions.rejected", "Proposal rejected"),
|
|
68
|
-
variant: "success"
|
|
69
|
-
});
|
|
70
|
-
} catch (e) {
|
|
71
|
-
p({
|
|
72
|
-
title: t("healthybowl.ai.decisions.decideFailed", "Could not record that decision"),
|
|
73
|
-
description: e instanceof Error ? e.message : String(e),
|
|
74
|
-
variant: "error"
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}, N = [
|
|
78
|
-
{
|
|
79
|
-
id: "PROPOSED",
|
|
80
|
-
label: t("healthybowl.ai.decisions.tabs.proposals", "Proposals")
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: "ACCEPTED",
|
|
84
|
-
label: t("healthybowl.ai.decisions.tabs.accepted", "Accepted")
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: "REJECTED",
|
|
88
|
-
label: t("healthybowl.ai.decisions.tabs.rejected", "Rejected")
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: "BLOCKED",
|
|
92
|
-
label: t("healthybowl.ai.decisions.tabs.blocked", "Blocked")
|
|
93
|
-
}
|
|
94
|
-
], P = A[O];
|
|
95
|
-
return /* @__PURE__ */ g(e, {
|
|
96
|
-
title: t("healthybowl.ai.decisions.title", "AI Decisions"),
|
|
97
|
-
description: t("healthybowl.ai.decisions.subtitle", "Irrigation and treatment proposals for you to accept or reject. Nothing here acts on its own."),
|
|
98
|
-
actions: /* @__PURE__ */ g("div", {
|
|
99
|
-
className: "flex flex-wrap gap-2",
|
|
100
|
-
children: [/* @__PURE__ */ g(_, {
|
|
101
|
-
variant: "outline",
|
|
102
|
-
disabled: T,
|
|
103
|
-
onClick: () => void j("IRRIGATION"),
|
|
104
|
-
children: [/* @__PURE__ */ h(d, { className: "me-2 h-4 w-4" }), t("healthybowl.ai.decisions.sweepIrrigation", "Check irrigation")]
|
|
105
|
-
}), /* @__PURE__ */ g(_, {
|
|
106
|
-
variant: "outline",
|
|
107
|
-
disabled: T,
|
|
108
|
-
onClick: () => void j("TREATMENT"),
|
|
109
|
-
children: [/* @__PURE__ */ h(m, { className: "me-2 h-4 w-4" }), t("healthybowl.ai.decisions.sweepTreatment", "Check treatments")]
|
|
110
|
-
})]
|
|
111
|
-
}),
|
|
112
|
-
children: [
|
|
113
|
-
/* @__PURE__ */ h(r, {
|
|
114
|
-
toasts: f,
|
|
115
|
-
onDismiss: v
|
|
116
|
-
}),
|
|
117
|
-
/* @__PURE__ */ h("div", {
|
|
118
|
-
className: "mb-4 flex flex-wrap gap-2",
|
|
119
|
-
role: "tablist",
|
|
120
|
-
children: N.map((e) => /* @__PURE__ */ g("button", {
|
|
121
|
-
type: "button",
|
|
122
|
-
role: "tab",
|
|
123
|
-
"aria-selected": O === e.id,
|
|
124
|
-
"data-testid": `hb-ai-decisions-tab-${e.id.toLowerCase()}`,
|
|
125
|
-
onClick: () => k(e.id),
|
|
126
|
-
className: O === e.id ? "rounded-md border border-border-strong bg-bg-subtle px-3 py-1.5 text-sm font-medium text-text-primary" : "rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:text-text-primary",
|
|
127
|
-
children: [
|
|
128
|
-
e.label,
|
|
129
|
-
" (",
|
|
130
|
-
A[e.id].length,
|
|
131
|
-
")"
|
|
132
|
-
]
|
|
133
|
-
}, e.id))
|
|
134
|
-
}),
|
|
135
|
-
x && P.length === 0 ? /* @__PURE__ */ h("p", {
|
|
136
|
-
className: "text-sm text-text-secondary",
|
|
137
|
-
children: t("healthybowl.ai.decisions.loading", "Loading decisions…")
|
|
138
|
-
}) : C ? /* @__PURE__ */ g("div", {
|
|
139
|
-
role: "alert",
|
|
140
|
-
className: "rounded-md border border-border-danger bg-bg-danger-subtle p-3 text-sm text-text-danger",
|
|
141
|
-
children: [/* @__PURE__ */ h("p", {
|
|
142
|
-
className: "font-medium",
|
|
143
|
-
children: t("healthybowl.ai.decisions.loadFailed.title", "Could not load decisions")
|
|
144
|
-
}), /* @__PURE__ */ h("p", {
|
|
145
|
-
className: "mt-1",
|
|
146
|
-
children: C.message
|
|
147
|
-
})]
|
|
148
|
-
}) : P.length === 0 ? /* @__PURE__ */ h(n, {
|
|
149
|
-
icon: /* @__PURE__ */ h(u, { className: "h-6 w-6" }),
|
|
150
|
-
title: t("healthybowl.ai.decisions.empty.title", "Nothing here yet"),
|
|
151
|
-
description: O === "PROPOSED" ? t("healthybowl.ai.decisions.empty.proposals", "Run a check above. If a field has no recent probe reading, or the farm has no location set, the engine will say so rather than guess.") : t("healthybowl.ai.decisions.empty.other", "No decisions in this state.")
|
|
152
|
-
}) : /* @__PURE__ */ h("div", {
|
|
153
|
-
className: "space-y-4",
|
|
154
|
-
children: P.map((e) => /* @__PURE__ */ h(S, {
|
|
155
|
-
decision: e,
|
|
156
|
-
busy: D,
|
|
157
|
-
onDecide: M
|
|
158
|
-
}, e.id))
|
|
159
|
-
})
|
|
160
|
-
]
|
|
161
|
-
});
|
|
162
|
-
}, S = ({ decision: e, busy: n, onDecide: r }) => {
|
|
163
|
-
let { t: i } = l(), a = v[e.decisionType] ?? u, o = b(e.inputs), s = e.status === "BLOCKED", c = typeof e.confidence == "number" ? Math.round(Math.min(1, Math.max(0, e.confidence)) * 100) : null;
|
|
164
|
-
return /* @__PURE__ */ g("div", {
|
|
165
|
-
"data-testid": `hb-ai-decision-card-${e.id}`,
|
|
166
|
-
className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
167
|
-
children: [
|
|
168
|
-
/* @__PURE__ */ g("div", {
|
|
169
|
-
className: "mb-2 flex flex-wrap items-center gap-2",
|
|
170
|
-
children: [
|
|
171
|
-
/* @__PURE__ */ h(a, { className: "h-4 w-4 text-text-secondary" }),
|
|
172
|
-
/* @__PURE__ */ h(t, { label: e.decisionType }),
|
|
173
|
-
/* @__PURE__ */ h(t, {
|
|
174
|
-
label: e.source === "MODEL" ? i("healthybowl.ai.decisions.sourceModel", "AI model") : i("healthybowl.ai.decisions.sourceHeuristic", "Rule-based"),
|
|
175
|
-
variant: e.source === "MODEL" ? "info" : "muted"
|
|
176
|
-
}),
|
|
177
|
-
typeof e.recommendedMm == "number" && e.recommendedMm > 0 ? /* @__PURE__ */ g("span", {
|
|
178
|
-
className: "inline-flex items-center gap-1 text-xs text-text-secondary",
|
|
179
|
-
children: [
|
|
180
|
-
/* @__PURE__ */ h(f, { className: "h-3 w-3" }),
|
|
181
|
-
e.recommendedMm,
|
|
182
|
-
" mm"
|
|
183
|
-
]
|
|
184
|
-
}) : null
|
|
185
|
-
]
|
|
186
|
-
}),
|
|
187
|
-
/* @__PURE__ */ h("h3", {
|
|
188
|
-
className: "text-base font-medium text-text-primary",
|
|
189
|
-
children: e.title
|
|
190
|
-
}),
|
|
191
|
-
s ? /* @__PURE__ */ g("div", {
|
|
192
|
-
"data-testid": "hb-ai-decision-blocked-banner",
|
|
193
|
-
className: "mt-3 flex items-start gap-2 rounded-md border border-border-danger bg-bg-danger-subtle p-3",
|
|
194
|
-
children: [/* @__PURE__ */ h(p, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-danger" }), /* @__PURE__ */ h("p", {
|
|
195
|
-
className: "text-sm text-text-danger",
|
|
196
|
-
children: e.blockedReason ?? i("healthybowl.ai.decisions.blockedFallback", "A compliance rail refused this proposal.")
|
|
197
|
-
})]
|
|
198
|
-
}) : null,
|
|
199
|
-
/* @__PURE__ */ h("p", {
|
|
200
|
-
className: "mt-3 text-sm text-text-secondary",
|
|
201
|
-
children: e.rationale
|
|
202
|
-
}),
|
|
203
|
-
o.length > 0 ? /* @__PURE__ */ g("div", {
|
|
204
|
-
className: "mt-3",
|
|
205
|
-
children: [/* @__PURE__ */ h("p", {
|
|
206
|
-
className: "mb-1 text-xs font-medium uppercase text-text-tertiary",
|
|
207
|
-
children: i("healthybowl.ai.decisions.inputs", "Inputs")
|
|
208
|
-
}), /* @__PURE__ */ h("div", {
|
|
209
|
-
className: "flex flex-wrap gap-1.5",
|
|
210
|
-
children: o.map((e) => /* @__PURE__ */ h("span", {
|
|
211
|
-
className: "rounded-full border border-border-subtle px-2 py-0.5 text-xs text-text-secondary",
|
|
212
|
-
children: e
|
|
213
|
-
}, e))
|
|
214
|
-
})]
|
|
215
|
-
}) : null,
|
|
216
|
-
c === null ? null : /* @__PURE__ */ g("div", {
|
|
217
|
-
className: "mt-3",
|
|
218
|
-
children: [/* @__PURE__ */ g("div", {
|
|
219
|
-
className: "mb-1 flex items-center justify-between text-xs text-text-tertiary",
|
|
220
|
-
children: [/* @__PURE__ */ h("span", { children: i("healthybowl.ai.decisions.confidence", "Confidence") }), /* @__PURE__ */ g("span", { children: [c, "%"] })]
|
|
221
|
-
}), /* @__PURE__ */ h("div", {
|
|
222
|
-
className: "h-1.5 w-full rounded-full bg-bg-subtle",
|
|
223
|
-
children: /* @__PURE__ */ h("div", {
|
|
224
|
-
className: "h-1.5 rounded-full bg-bg-brand",
|
|
225
|
-
style: { width: `${c}%` }
|
|
226
|
-
})
|
|
227
|
-
})]
|
|
228
|
-
}),
|
|
229
|
-
e.railChecks.length > 0 ? /* @__PURE__ */ h(C, { checks: e.railChecks }) : null,
|
|
230
|
-
e.status === "PROPOSED" ? /* @__PURE__ */ g("div", {
|
|
231
|
-
className: "mt-4 flex flex-wrap gap-2",
|
|
232
|
-
children: [/* @__PURE__ */ h(_, {
|
|
233
|
-
size: "sm",
|
|
234
|
-
disabled: n,
|
|
235
|
-
"data-testid": "hb-ai-decision-accept",
|
|
236
|
-
onClick: () => void r(e, "ACCEPTED"),
|
|
237
|
-
children: i("healthybowl.ai.decisions.accept", "Accept")
|
|
238
|
-
}), /* @__PURE__ */ h(_, {
|
|
239
|
-
size: "sm",
|
|
240
|
-
variant: "outline",
|
|
241
|
-
disabled: n,
|
|
242
|
-
"data-testid": "hb-ai-decision-reject",
|
|
243
|
-
onClick: () => void r(e, "REJECTED"),
|
|
244
|
-
children: i("healthybowl.ai.decisions.reject", "Reject")
|
|
245
|
-
})]
|
|
246
|
-
}) : null
|
|
247
|
-
]
|
|
248
|
-
});
|
|
249
|
-
}, C = ({ checks: e }) => {
|
|
250
|
-
let { t: n } = l();
|
|
251
|
-
return /* @__PURE__ */ g("div", {
|
|
252
|
-
className: "mt-3",
|
|
253
|
-
children: [/* @__PURE__ */ h("p", {
|
|
254
|
-
className: "mb-1 text-xs font-medium uppercase text-text-tertiary",
|
|
255
|
-
children: n("healthybowl.ai.decisions.railChecks", "Rail checks")
|
|
256
|
-
}), /* @__PURE__ */ h("div", {
|
|
257
|
-
className: "overflow-x-auto",
|
|
258
|
-
children: /* @__PURE__ */ h("table", {
|
|
259
|
-
className: "w-full text-left text-xs",
|
|
260
|
-
children: /* @__PURE__ */ h("tbody", { children: e.map((e) => /* @__PURE__ */ g("tr", {
|
|
261
|
-
className: "border-t border-border-subtle",
|
|
262
|
-
children: [
|
|
263
|
-
/* @__PURE__ */ h("td", {
|
|
264
|
-
className: "py-1.5 pe-3 align-top text-text-secondary",
|
|
265
|
-
children: e.rail
|
|
266
|
-
}),
|
|
267
|
-
/* @__PURE__ */ h("td", {
|
|
268
|
-
className: "py-1.5 pe-3 align-top",
|
|
269
|
-
children: /* @__PURE__ */ h(t, {
|
|
270
|
-
label: e.outcome,
|
|
271
|
-
variant: y(e.outcome)
|
|
272
|
-
})
|
|
273
|
-
}),
|
|
274
|
-
/* @__PURE__ */ h("td", {
|
|
275
|
-
className: "py-1.5 align-top text-text-tertiary",
|
|
276
|
-
children: e.detail
|
|
277
|
-
})
|
|
278
|
-
]
|
|
279
|
-
}, e.rail)) })
|
|
280
|
-
})
|
|
281
|
-
})]
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
//#endregion
|
|
285
|
-
export { x as default };
|
|
286
|
-
|
|
287
|
-
//# sourceMappingURL=AiDecisionsPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AiDecisionsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/ai/AiDecisionsPage.tsx"],"sourcesContent":["import { useMemo, useState, type FC } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { Droplets, Sprout, ShieldAlert, Cpu, Ruler } from 'lucide-react';\nimport { PageLayout, StatusBadge, EmptyState, useConfirm } from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { useToast } from '../../hooks/useToast';\nimport { useAgronomyDecisions, type AgronomyDecision, type AgronomyRailCheck } from '../../hooks/useAgronomyDecisions';\n\n/**\n * HB-UC-18/19 — the AI agronomic decision inbox.\n *\n * The engine proposes; a human decides. Every card carries the rationale, the real records it was\n * derived from, and an honest MODEL/HEURISTIC label.\n *\n * ### Two things this page deliberately does\n *\n * **BLOCKED cards are shown, never filtered out.** A treatment the compliance rail refused is\n * evidence that the engine considered it and said no — hiding it looks identical to the engine\n * never having noticed. It sits in its own tab with the failing rail named and a per-rail table,\n * and it has no Accept button at all: the rail's verdict is not a suggestion.\n *\n * **A HEURISTIC card reads as rule-based, not as AI.** Spec 15's honesty rule is binding — every\n * user-visible \"AI\" string must be backed by a real model call or relabelled. The badge says which.\n *\n * @module healthybowl\n */\n\ntype TabId = 'PROPOSED' | 'ACCEPTED' | 'REJECTED' | 'BLOCKED';\n\nconst DECISION_TYPE_ICON: Record<string, FC<{ className?: string }>> = {\n IRRIGATION: Droplets,\n TREATMENT: Sprout,\n};\n\n/** Map a rail outcome onto the shared badge's variants. */\nfunction railVariant(outcome: string): 'success' | 'error' | 'muted' {\n if (outcome === 'PASS') return 'success';\n if (outcome === 'BLOCKED') return 'error';\n // NOT_APPLICABLE is muted, not neutral-styled-as-success: a rail that could not apply must not\n // read like a rail that passed.\n return 'muted';\n}\n\n/**\n * Turn the `inputs` JSON into chips.\n *\n * Every card must cite at least one real record a farmer can go and look at — a probe code, a\n * reading timestamp, a scan id. Rendering the raw keys keeps that honest: if the backend ever stops\n * sending evidence, the card visibly has none rather than quietly looking complete.\n */\nfunction inputChips(inputs: Record<string, unknown> | null | undefined): string[] {\n if (!inputs || typeof inputs !== 'object') return [];\n return Object.entries(inputs)\n .filter(([, value]) => value !== null && value !== undefined && value !== '')\n .map(([key, value]) => `${key}: ${typeof value === 'object' ? JSON.stringify(value) : String(value)}`);\n}\n\nconst AiDecisionsPage: FC = () => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const confirm = useConfirm();\n const { decisions, loading, error, propose, proposing, decide, deciding } = useAgronomyDecisions();\n const [tab, setTab] = useState<TabId>('PROPOSED');\n\n const byTab = useMemo(() => {\n const buckets: Record<TabId, AgronomyDecision[]> = {\n PROPOSED: [],\n ACCEPTED: [],\n REJECTED: [],\n BLOCKED: [],\n };\n for (const decision of decisions) {\n const bucket = buckets[decision.status as TabId];\n if (bucket) bucket.push(decision);\n }\n return buckets;\n }, [decisions]);\n\n const runSweep = async (decisionType: 'IRRIGATION' | 'TREATMENT'): Promise<void> => {\n try {\n const result = await propose(decisionType);\n if (result.skippedReason) {\n // Surfaced rather than swallowed: \"no proposals\" and \"could not look\" are different\n // answers, and only one of them tells the farmer there is something they can fix.\n toast({\n title: t('healthybowl.ai.decisions.sweepSkipped.title', 'Nothing to propose'),\n description: result.skippedReason,\n variant: 'info',\n });\n return;\n }\n toast({\n title: t('healthybowl.ai.decisions.sweepDone.title', 'Sweep complete'),\n description: t('healthybowl.ai.decisions.sweepDone.description', `${result.decisions.length} proposal(s).`),\n variant: 'success',\n });\n } catch (error) {\n toast({\n title: t('healthybowl.ai.decisions.sweepFailed', 'Sweep failed'),\n description: error instanceof Error ? error.message : String(error),\n variant: 'error',\n });\n }\n };\n\n const onDecide = async (decision: AgronomyDecision, verdict: 'ACCEPTED' | 'REJECTED'): Promise<void> => {\n const ok = await confirm({\n title:\n verdict === 'ACCEPTED'\n ? t('healthybowl.ai.decisions.confirmAccept', 'Accept this proposal?')\n : t('healthybowl.ai.decisions.confirmReject', 'Reject this proposal?'),\n message: decision.title,\n });\n if (!ok) return;\n\n try {\n await decide(decision.id, verdict);\n toast({\n title:\n verdict === 'ACCEPTED'\n ? t('healthybowl.ai.decisions.accepted', 'Proposal accepted')\n : t('healthybowl.ai.decisions.rejected', 'Proposal rejected'),\n variant: 'success',\n });\n } catch (error) {\n toast({\n title: t('healthybowl.ai.decisions.decideFailed', 'Could not record that decision'),\n description: error instanceof Error ? error.message : String(error),\n variant: 'error',\n });\n }\n };\n\n const TABS: Array<{ id: TabId; label: string }> = [\n { id: 'PROPOSED', label: t('healthybowl.ai.decisions.tabs.proposals', 'Proposals') },\n { id: 'ACCEPTED', label: t('healthybowl.ai.decisions.tabs.accepted', 'Accepted') },\n { id: 'REJECTED', label: t('healthybowl.ai.decisions.tabs.rejected', 'Rejected') },\n { id: 'BLOCKED', label: t('healthybowl.ai.decisions.tabs.blocked', 'Blocked') },\n ];\n\n const visible = byTab[tab];\n\n return (\n <PageLayout\n title={t('healthybowl.ai.decisions.title', 'AI Decisions')}\n description={t(\n 'healthybowl.ai.decisions.subtitle',\n 'Irrigation and treatment proposals for you to accept or reject. Nothing here acts on its own.'\n )}\n actions={\n <div className=\"flex flex-wrap gap-2\">\n <Button variant=\"outline\" disabled={proposing} onClick={() => void runSweep('IRRIGATION')}>\n <Droplets className=\"me-2 h-4 w-4\" />\n {t('healthybowl.ai.decisions.sweepIrrigation', 'Check irrigation')}\n </Button>\n <Button variant=\"outline\" disabled={proposing} onClick={() => void runSweep('TREATMENT')}>\n <Sprout className=\"me-2 h-4 w-4\" />\n {t('healthybowl.ai.decisions.sweepTreatment', 'Check treatments')}\n </Button>\n </div>\n }\n >\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n\n <div className=\"mb-4 flex flex-wrap gap-2\" role=\"tablist\">\n {TABS.map((entry) => (\n <button\n key={entry.id}\n type=\"button\"\n role=\"tab\"\n aria-selected={tab === entry.id}\n data-testid={`hb-ai-decisions-tab-${entry.id.toLowerCase()}`}\n onClick={() => setTab(entry.id)}\n className={\n tab === entry.id\n ? 'rounded-md border border-border-strong bg-bg-subtle px-3 py-1.5 text-sm font-medium text-text-primary'\n : 'rounded-md border border-border-subtle px-3 py-1.5 text-sm text-text-secondary hover:text-text-primary'\n }\n >\n {entry.label} ({byTab[entry.id].length})\n </button>\n ))}\n </div>\n\n {loading && visible.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">{t('healthybowl.ai.decisions.loading', 'Loading decisions…')}</p>\n ) : error ? (\n <div\n role=\"alert\"\n className=\"rounded-md border border-border-danger bg-bg-danger-subtle p-3 text-sm text-text-danger\"\n >\n <p className=\"font-medium\">{t('healthybowl.ai.decisions.loadFailed.title', 'Could not load decisions')}</p>\n <p className=\"mt-1\">{error.message}</p>\n </div>\n ) : visible.length === 0 ? (\n <EmptyState\n icon={<Cpu className=\"h-6 w-6\" />}\n title={t('healthybowl.ai.decisions.empty.title', 'Nothing here yet')}\n description={\n tab === 'PROPOSED'\n ? t(\n 'healthybowl.ai.decisions.empty.proposals',\n 'Run a check above. If a field has no recent probe reading, or the farm has no location set, the engine will say so rather than guess.'\n )\n : t('healthybowl.ai.decisions.empty.other', 'No decisions in this state.')\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {visible.map((decision) => (\n <DecisionCard key={decision.id} decision={decision} busy={deciding} onDecide={onDecide} />\n ))}\n </div>\n )}\n </PageLayout>\n );\n};\n\ninterface DecisionCardProps {\n decision: AgronomyDecision;\n busy: boolean;\n onDecide: (decision: AgronomyDecision, verdict: 'ACCEPTED' | 'REJECTED') => Promise<void>;\n}\n\nconst DecisionCard: FC<DecisionCardProps> = ({ decision, busy, onDecide }) => {\n const { t } = useI18n();\n const Icon = DECISION_TYPE_ICON[decision.decisionType] ?? Cpu;\n const chips = inputChips(decision.inputs);\n const isBlocked = decision.status === 'BLOCKED';\n const confidencePct =\n typeof decision.confidence === 'number' ? Math.round(Math.min(1, Math.max(0, decision.confidence)) * 100) : null;\n\n return (\n <div\n data-testid={`hb-ai-decision-card-${decision.id}`}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <div className=\"mb-2 flex flex-wrap items-center gap-2\">\n <Icon className=\"h-4 w-4 text-text-secondary\" />\n <StatusBadge label={decision.decisionType} />\n {/* Spec 15's honesty rule: a rule-based card must not read as AI. */}\n <StatusBadge\n label={\n decision.source === 'MODEL'\n ? t('healthybowl.ai.decisions.sourceModel', 'AI model')\n : t('healthybowl.ai.decisions.sourceHeuristic', 'Rule-based')\n }\n variant={decision.source === 'MODEL' ? 'info' : 'muted'}\n />\n {typeof decision.recommendedMm === 'number' && decision.recommendedMm > 0 ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-text-secondary\">\n <Ruler className=\"h-3 w-3\" />\n {decision.recommendedMm} mm\n </span>\n ) : null}\n </div>\n\n <h3 className=\"text-base font-medium text-text-primary\">{decision.title}</h3>\n\n {isBlocked ? (\n <div\n data-testid=\"hb-ai-decision-blocked-banner\"\n className=\"mt-3 flex items-start gap-2 rounded-md border border-border-danger bg-bg-danger-subtle p-3\"\n >\n <ShieldAlert className=\"mt-0.5 h-4 w-4 shrink-0 text-text-danger\" />\n <p className=\"text-sm text-text-danger\">\n {decision.blockedReason ??\n t('healthybowl.ai.decisions.blockedFallback', 'A compliance rail refused this proposal.')}\n </p>\n </div>\n ) : null}\n\n <p className=\"mt-3 text-sm text-text-secondary\">{decision.rationale}</p>\n\n {chips.length > 0 ? (\n <div className=\"mt-3\">\n <p className=\"mb-1 text-xs font-medium uppercase text-text-tertiary\">\n {t('healthybowl.ai.decisions.inputs', 'Inputs')}\n </p>\n <div className=\"flex flex-wrap gap-1.5\">\n {chips.map((chip) => (\n <span\n key={chip}\n className=\"rounded-full border border-border-subtle px-2 py-0.5 text-xs text-text-secondary\"\n >\n {chip}\n </span>\n ))}\n </div>\n </div>\n ) : null}\n\n {confidencePct !== null ? (\n <div className=\"mt-3\">\n <div className=\"mb-1 flex items-center justify-between text-xs text-text-tertiary\">\n <span>{t('healthybowl.ai.decisions.confidence', 'Confidence')}</span>\n <span>{confidencePct}%</span>\n </div>\n <div className=\"h-1.5 w-full rounded-full bg-bg-subtle\">\n <div className=\"h-1.5 rounded-full bg-bg-brand\" style={{ width: `${confidencePct}%` }} />\n </div>\n </div>\n ) : null}\n\n {decision.railChecks.length > 0 ? <RailTable checks={decision.railChecks} /> : null}\n\n {decision.status === 'PROPOSED' ? (\n <div className=\"mt-4 flex flex-wrap gap-2\">\n <Button\n size=\"sm\"\n disabled={busy}\n data-testid=\"hb-ai-decision-accept\"\n onClick={() => void onDecide(decision, 'ACCEPTED')}\n >\n {t('healthybowl.ai.decisions.accept', 'Accept')}\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={busy}\n data-testid=\"hb-ai-decision-reject\"\n onClick={() => void onDecide(decision, 'REJECTED')}\n >\n {t('healthybowl.ai.decisions.reject', 'Reject')}\n </Button>\n </div>\n ) : null}\n {/* No Accept on a BLOCKED card, deliberately. The rail's verdict is not a suggestion, and an\n override button here would defeat the guardrail the whole slice exists to enforce. */}\n </div>\n );\n};\n\nconst RailTable: FC<{ checks: AgronomyRailCheck[] }> = ({ checks }) => {\n const { t } = useI18n();\n return (\n <div className=\"mt-3\">\n <p className=\"mb-1 text-xs font-medium uppercase text-text-tertiary\">\n {t('healthybowl.ai.decisions.railChecks', 'Rail checks')}\n </p>\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-left text-xs\">\n <tbody>\n {checks.map((check) => (\n <tr key={check.rail} className=\"border-t border-border-subtle\">\n <td className=\"py-1.5 pe-3 align-top text-text-secondary\">{check.rail}</td>\n <td className=\"py-1.5 pe-3 align-top\">\n <StatusBadge label={check.outcome} variant={railVariant(check.outcome)} />\n </td>\n <td className=\"py-1.5 align-top text-text-tertiary\">{check.detail}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n );\n};\n\nexport default AiDecisionsPage;\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAM,IAAiE;CACrE,YAAY;CACZ,WAAW;AACb;AAGA,SAAS,EAAY,GAAgD;CAKnE,OAJI,MAAY,SAAe,YAC3B,MAAY,YAAkB,UAG3B;AACT;AASA,SAAS,EAAW,GAA8D;CAEhF,OADI,CAAC,KAAU,OAAO,KAAW,WAAiB,CAAC,IAC5C,OAAO,QAAQ,CAAM,EACzB,QAAQ,GAAG,OAAW,KAAU,QAA+B,MAAU,EAAE,EAC3E,KAAK,CAAC,GAAK,OAAW,GAAG,EAAI,IAAI,OAAO,KAAU,WAAW,KAAK,UAAU,CAAK,IAAI,OAAO,CAAK,GAAG;AACzG;AAEA,IAAM,UAA4B;CAChC,IAAM,EAAE,MAAM,EAAQ,GAChB,EAAE,WAAQ,UAAO,eAAY,EAAS,GACtC,IAAU,EAAW,GACrB,EAAE,cAAW,YAAS,UAAO,YAAS,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AS,GAAU,UAAU;eAEhD,EAAE,mCAAmC,QAAQ;IACxC,CAAA,GACR,kBAAC,GAAD;KACE,MAAK;KACL,SAAQ;KACR,UAAU;KACV,eAAY;KACZ,eAAe,KAAK,EAAS,GAAU,UAAU;eAEhD,EAAE,mCAAmC,QAAQ;IACxC,CAAA,CACL;QACH;EAGD;;AAET,GAEM,KAAkD,EAAE,gBAAa;CACrE,IAAM,EAAE,SAAM,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,KAAD;GAAG,WAAU;aACV,EAAE,uCAAuC,aAAa;EACtD,CAAA,GACH,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,SAAD;IAAO,WAAU;cACf,kBAAC,SAAD,EAAA,UACG,EAAO,KAAK,MACX,kBAAC,MAAD;KAAqB,WAAU;eAA/B;MACE,kBAAC,MAAD;OAAI,WAAU;iBAA6C,EAAM;MAAS,CAAA;MAC1E,kBAAC,MAAD;OAAI,WAAU;iBACZ,kBAAC,GAAD;QAAa,OAAO,EAAM;QAAS,SAAS,EAAY,EAAM,OAAO;OAAI,CAAA;MACvE,CAAA;MACJ,kBAAC,MAAD;OAAI,WAAU;iBAAuC,EAAM;MAAW,CAAA;KACpE;OANK,EAAM,IAMX,CACL,EACI,CAAA;GACF,CAAA;EACJ,CAAA,CACF;;AAET"}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { formatDate as e, todayLocalDate as t } from "../../utils/helpers.js";
|
|
2
|
-
import { PageLayout as n } from "../../components/PageLayout.js";
|
|
3
|
-
import { DataTable as r } from "../../components/DataTable.js";
|
|
4
|
-
import { StatusBadge as i } from "../../components/StatusBadge.js";
|
|
5
|
-
import { EmptyState as a } from "../../components/EmptyState.js";
|
|
6
|
-
import { ErrorState as o } from "../../components/ErrorState.js";
|
|
7
|
-
import { ToastContainer as s } from "../../components/Toast.js";
|
|
8
|
-
import { useConfirm as c } from "../../components/ConfirmDialog.js";
|
|
9
|
-
import { PageLoader as l } from "../../components/PageLoader.js";
|
|
10
|
-
import { Modal as u } from "../../components/Modal.js";
|
|
11
|
-
import { useToast as d } from "../../hooks/useToast.js";
|
|
12
|
-
import "../../components/index.js";
|
|
13
|
-
import { useHealthyBowlCompliance as f } from "../../hooks/useHealthyBowlCompliance.js";
|
|
14
|
-
import { buildResidueTestInput as p, emptyResidueTestForm as m, residueVerdict as h } from "./substanceRuleForm.js";
|
|
15
|
-
import { useMemo as g, useState as _ } from "react";
|
|
16
|
-
import { useI18n as v } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
17
|
-
import { FlaskConical as y, Plus as b, Trash2 as x } from "lucide-react";
|
|
18
|
-
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
19
|
-
import { Button as w, Input as T, Textarea as E } from "@burdenoff/fe-libs/ui";
|
|
20
|
-
//#region src/healthybowl/pages/compliance/ResidueTestsPage.tsx
|
|
21
|
-
var D = "mb-1 block text-sm font-medium text-text-primary", O = {
|
|
22
|
-
BREACH: {
|
|
23
|
-
variant: "error",
|
|
24
|
-
key: "healthybowl.compliance.residueTests.verdict.breach",
|
|
25
|
-
fallback: "Over the limit"
|
|
26
|
-
},
|
|
27
|
-
PROHIBITED: {
|
|
28
|
-
variant: "error",
|
|
29
|
-
key: "healthybowl.compliance.residueTests.verdict.prohibited",
|
|
30
|
-
fallback: "Prohibited substance detected"
|
|
31
|
-
},
|
|
32
|
-
WITHIN_LIMIT: {
|
|
33
|
-
variant: "success",
|
|
34
|
-
key: "healthybowl.compliance.residueTests.verdict.within",
|
|
35
|
-
fallback: "Within limit"
|
|
36
|
-
},
|
|
37
|
-
NO_RULE: {
|
|
38
|
-
variant: "muted",
|
|
39
|
-
key: "healthybowl.compliance.residueTests.verdict.noRule",
|
|
40
|
-
fallback: "No rule for this substance"
|
|
41
|
-
}
|
|
42
|
-
}, k = () => {
|
|
43
|
-
let { t: k } = v(), A = c(), { toast: j, toasts: M, dismiss: N } = d(), { residueTests: P, substanceRules: F, loading: I, errors: L, createResidueTest: R, deleteResidueTest: z } = f(), [B, V] = _(!1), [H, U] = _(() => m(t())), [W, G] = _([]), [K, q] = _(!1), J = (e) => W.find((t) => t.field === e), Y = (e, t) => U((n) => ({
|
|
44
|
-
...n,
|
|
45
|
-
[e]: t
|
|
46
|
-
})), X = g(() => P.map((e) => ({
|
|
47
|
-
...e,
|
|
48
|
-
...h(e, F)
|
|
49
|
-
})), [P, F]), Z = () => {
|
|
50
|
-
U(m(t())), G([]), V(!0);
|
|
51
|
-
}, Q = async () => {
|
|
52
|
-
let e = p(H);
|
|
53
|
-
if (!e.ok) {
|
|
54
|
-
G(e.errors);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
q(!0);
|
|
58
|
-
try {
|
|
59
|
-
await R(e.input), V(!1), j({
|
|
60
|
-
title: k("healthybowl.compliance.residueTests.toast.created", "Residue test recorded"),
|
|
61
|
-
description: k("healthybowl.compliance.residueTests.toast.createdDesc", "It has been screened against the substance rulebook. Any breach appears in Compliance alerts."),
|
|
62
|
-
variant: "success"
|
|
63
|
-
});
|
|
64
|
-
} catch (e) {
|
|
65
|
-
j({
|
|
66
|
-
title: k("healthybowl.compliance.residueTests.toast.failed", "Could not record the test"),
|
|
67
|
-
description: e instanceof Error ? e.message : String(e),
|
|
68
|
-
variant: "error"
|
|
69
|
-
});
|
|
70
|
-
} finally {
|
|
71
|
-
q(!1);
|
|
72
|
-
}
|
|
73
|
-
}, $ = async (e) => {
|
|
74
|
-
if (await A({
|
|
75
|
-
title: k("healthybowl.compliance.residueTests.confirm.title", "Remove this test result?"),
|
|
76
|
-
message: k("healthybowl.compliance.residueTests.confirm.description", "Any compliance finding this result raised stays on record. Remove it only if the result was entered in error.")
|
|
77
|
-
})) try {
|
|
78
|
-
await z(e.id), j({
|
|
79
|
-
title: k("healthybowl.compliance.residueTests.toast.removed", "Test removed"),
|
|
80
|
-
variant: "success"
|
|
81
|
-
});
|
|
82
|
-
} catch (e) {
|
|
83
|
-
j({
|
|
84
|
-
title: k("healthybowl.compliance.residueTests.toast.removeFailed", "Could not remove the test"),
|
|
85
|
-
description: e instanceof Error ? e.message : String(e),
|
|
86
|
-
variant: "error"
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
return I.residue && P.length === 0 ? /* @__PURE__ */ S(l, {}) : L.residue && P.length === 0 ? /* @__PURE__ */ S(o, { description: L.residue.message }) : /* @__PURE__ */ C(n, {
|
|
91
|
-
title: k("healthybowl.compliance.residueTests.title", "Lab residue tests"),
|
|
92
|
-
description: k("healthybowl.compliance.residueTests.description", "Recorded laboratory measurements, screened against this workspace’s substance rules as they are entered."),
|
|
93
|
-
purpose: "Record what a laboratory measured on a batch or a crop. Each result is checked against the substance rulebook on save — a reading over a limit, or any detection of a prohibited substance, raises a critical compliance finding immediately.",
|
|
94
|
-
actions: /* @__PURE__ */ C(w, {
|
|
95
|
-
onClick: Z,
|
|
96
|
-
children: [/* @__PURE__ */ S(b, { className: "h-4 w-4" }), k("healthybowl.compliance.residueTests.add", "Record test")]
|
|
97
|
-
}),
|
|
98
|
-
children: [
|
|
99
|
-
X.length === 0 ? /* @__PURE__ */ S(a, {
|
|
100
|
-
icon: /* @__PURE__ */ S(y, { className: "h-6 w-6" }),
|
|
101
|
-
title: k("healthybowl.compliance.residueTests.emptyTitle", "No residue tests recorded"),
|
|
102
|
-
description: k("healthybowl.compliance.residueTests.emptyDescription", "Record a laboratory result to have it screened against your substance rules."),
|
|
103
|
-
action: /* @__PURE__ */ S(w, {
|
|
104
|
-
onClick: Z,
|
|
105
|
-
children: k("healthybowl.compliance.residueTests.add", "Record test")
|
|
106
|
-
})
|
|
107
|
-
}) : /* @__PURE__ */ S(r, {
|
|
108
|
-
data: X,
|
|
109
|
-
keyField: "id",
|
|
110
|
-
columns: [
|
|
111
|
-
{
|
|
112
|
-
key: "substanceName",
|
|
113
|
-
header: k("healthybowl.compliance.residueTests.col.substance", "Substance"),
|
|
114
|
-
render: (e) => /* @__PURE__ */ S("span", {
|
|
115
|
-
className: "font-medium text-text-primary",
|
|
116
|
-
children: e.substanceName
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
key: "measuredMgPerKg",
|
|
121
|
-
header: k("healthybowl.compliance.residueTests.col.measured", "Measured"),
|
|
122
|
-
render: (e) => /* @__PURE__ */ S("span", {
|
|
123
|
-
className: "tabular-nums text-text-primary",
|
|
124
|
-
children: k("healthybowl.compliance.residueTests.mgPerKg", "{{n}} mg/kg", { n: e.measuredMgPerKg })
|
|
125
|
-
})
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
key: "verdict",
|
|
129
|
-
header: k("healthybowl.compliance.residueTests.col.verdict", "Against the rulebook"),
|
|
130
|
-
render: (e) => {
|
|
131
|
-
let t = O[e.verdict];
|
|
132
|
-
return /* @__PURE__ */ C("span", {
|
|
133
|
-
className: "inline-flex items-center gap-2",
|
|
134
|
-
children: [/* @__PURE__ */ S(i, {
|
|
135
|
-
variant: t.variant,
|
|
136
|
-
label: k(t.key, t.fallback)
|
|
137
|
-
}), e.rule !== null && e.rule.mrlMgPerKg !== null ? /* @__PURE__ */ S("span", {
|
|
138
|
-
className: "text-xs tabular-nums text-text-secondary",
|
|
139
|
-
children: k("healthybowl.compliance.residueTests.limitIs", "limit {{n}}", { n: e.rule.mrlMgPerKg })
|
|
140
|
-
}) : null]
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
key: "testedAt",
|
|
146
|
-
header: k("healthybowl.compliance.residueTests.col.testedAt", "Tested"),
|
|
147
|
-
render: (t) => e(t.testedAt)
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
key: "laboratory",
|
|
151
|
-
header: k("healthybowl.compliance.residueTests.col.lab", "Laboratory"),
|
|
152
|
-
render: (e) => e.laboratory ?? "—"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
key: "actions",
|
|
156
|
-
header: "",
|
|
157
|
-
render: (e) => /* @__PURE__ */ S("div", {
|
|
158
|
-
className: "flex justify-end",
|
|
159
|
-
children: /* @__PURE__ */ S(w, {
|
|
160
|
-
variant: "ghost",
|
|
161
|
-
size: "sm",
|
|
162
|
-
onClick: () => void $(e),
|
|
163
|
-
"aria-label": k("healthybowl.compliance.residueTests.remove", "Remove test"),
|
|
164
|
-
children: /* @__PURE__ */ S(x, { className: "h-3.5 w-3.5" })
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
]
|
|
169
|
-
}),
|
|
170
|
-
/* @__PURE__ */ S(u, {
|
|
171
|
-
open: B,
|
|
172
|
-
onClose: () => V(!1),
|
|
173
|
-
title: k("healthybowl.compliance.residueTests.addTitle", "Record a residue test"),
|
|
174
|
-
footer: /* @__PURE__ */ C("div", {
|
|
175
|
-
className: "flex justify-end gap-2",
|
|
176
|
-
children: [/* @__PURE__ */ S(w, {
|
|
177
|
-
variant: "outline",
|
|
178
|
-
onClick: () => V(!1),
|
|
179
|
-
disabled: K,
|
|
180
|
-
children: k("common.cancel", "Cancel")
|
|
181
|
-
}), /* @__PURE__ */ S(w, {
|
|
182
|
-
onClick: () => void Q(),
|
|
183
|
-
disabled: K,
|
|
184
|
-
children: K ? k("common.saving", "Saving…") : k("common.save", "Save")
|
|
185
|
-
})]
|
|
186
|
-
}),
|
|
187
|
-
children: /* @__PURE__ */ C("div", {
|
|
188
|
-
className: "space-y-4",
|
|
189
|
-
children: [
|
|
190
|
-
/* @__PURE__ */ C("div", { children: [
|
|
191
|
-
/* @__PURE__ */ S("label", {
|
|
192
|
-
htmlFor: "residue-substance",
|
|
193
|
-
className: D,
|
|
194
|
-
children: k("healthybowl.compliance.residueTests.field.substance", "Substance name")
|
|
195
|
-
}),
|
|
196
|
-
/* @__PURE__ */ S(T, {
|
|
197
|
-
id: "residue-substance",
|
|
198
|
-
value: H.substanceName,
|
|
199
|
-
onChange: (e) => Y("substanceName", e.target.value),
|
|
200
|
-
placeholder: "Chlorpyrifos",
|
|
201
|
-
list: "hb-substance-names"
|
|
202
|
-
}),
|
|
203
|
-
/* @__PURE__ */ S("datalist", {
|
|
204
|
-
id: "hb-substance-names",
|
|
205
|
-
children: F.map((e) => /* @__PURE__ */ S("option", { value: e.substanceName }, e.id))
|
|
206
|
-
}),
|
|
207
|
-
J("substanceName") ? /* @__PURE__ */ S("p", {
|
|
208
|
-
className: "mt-1 text-xs text-status-error-text",
|
|
209
|
-
children: k(J("substanceName").messageKey, J("substanceName").messageFallback)
|
|
210
|
-
}) : null
|
|
211
|
-
] }),
|
|
212
|
-
/* @__PURE__ */ C("div", {
|
|
213
|
-
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
214
|
-
children: [/* @__PURE__ */ C("div", { children: [
|
|
215
|
-
/* @__PURE__ */ S("label", {
|
|
216
|
-
htmlFor: "residue-measured",
|
|
217
|
-
className: D,
|
|
218
|
-
children: k("healthybowl.compliance.residueTests.field.measured", "Measured residue (mg/kg)")
|
|
219
|
-
}),
|
|
220
|
-
/* @__PURE__ */ S(T, {
|
|
221
|
-
id: "residue-measured",
|
|
222
|
-
inputMode: "decimal",
|
|
223
|
-
value: H.measuredMgPerKg,
|
|
224
|
-
onChange: (e) => Y("measuredMgPerKg", e.target.value),
|
|
225
|
-
placeholder: "0.005"
|
|
226
|
-
}),
|
|
227
|
-
J("measuredMgPerKg") ? /* @__PURE__ */ S("p", {
|
|
228
|
-
className: "mt-1 text-xs text-status-error-text",
|
|
229
|
-
children: k(J("measuredMgPerKg").messageKey, J("measuredMgPerKg").messageFallback)
|
|
230
|
-
}) : null
|
|
231
|
-
] }), /* @__PURE__ */ C("div", { children: [
|
|
232
|
-
/* @__PURE__ */ S("label", {
|
|
233
|
-
htmlFor: "residue-tested-at",
|
|
234
|
-
className: D,
|
|
235
|
-
children: k("healthybowl.compliance.residueTests.field.testedAt", "Test date")
|
|
236
|
-
}),
|
|
237
|
-
/* @__PURE__ */ S(T, {
|
|
238
|
-
id: "residue-tested-at",
|
|
239
|
-
type: "date",
|
|
240
|
-
value: H.testedAt,
|
|
241
|
-
onChange: (e) => Y("testedAt", e.target.value)
|
|
242
|
-
}),
|
|
243
|
-
J("testedAt") ? /* @__PURE__ */ S("p", {
|
|
244
|
-
className: "mt-1 text-xs text-status-error-text",
|
|
245
|
-
children: k(J("testedAt").messageKey, J("testedAt").messageFallback)
|
|
246
|
-
}) : null
|
|
247
|
-
] })]
|
|
248
|
-
}),
|
|
249
|
-
/* @__PURE__ */ C("div", {
|
|
250
|
-
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
251
|
-
children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
252
|
-
htmlFor: "residue-lab",
|
|
253
|
-
className: D,
|
|
254
|
-
children: k("healthybowl.compliance.residueTests.field.lab", "Laboratory (optional)")
|
|
255
|
-
}), /* @__PURE__ */ S(T, {
|
|
256
|
-
id: "residue-lab",
|
|
257
|
-
value: H.laboratory,
|
|
258
|
-
onChange: (e) => Y("laboratory", e.target.value)
|
|
259
|
-
})] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
260
|
-
htmlFor: "residue-batch",
|
|
261
|
-
className: D,
|
|
262
|
-
children: k("healthybowl.compliance.residueTests.field.batch", "Trace batch id (optional)")
|
|
263
|
-
}), /* @__PURE__ */ S(T, {
|
|
264
|
-
id: "residue-batch",
|
|
265
|
-
value: H.traceBatchId,
|
|
266
|
-
onChange: (e) => Y("traceBatchId", e.target.value)
|
|
267
|
-
})] })]
|
|
268
|
-
}),
|
|
269
|
-
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
270
|
-
htmlFor: "residue-notes",
|
|
271
|
-
className: D,
|
|
272
|
-
children: k("healthybowl.compliance.residueTests.field.notes", "Notes (optional)")
|
|
273
|
-
}), /* @__PURE__ */ S(E, {
|
|
274
|
-
id: "residue-notes",
|
|
275
|
-
value: H.notes,
|
|
276
|
-
onChange: (e) => Y("notes", e.target.value)
|
|
277
|
-
})] })
|
|
278
|
-
]
|
|
279
|
-
})
|
|
280
|
-
}),
|
|
281
|
-
/* @__PURE__ */ S(s, {
|
|
282
|
-
toasts: M,
|
|
283
|
-
onDismiss: N
|
|
284
|
-
})
|
|
285
|
-
]
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
//#endregion
|
|
289
|
-
export { k as ResidueTestsPage };
|
|
290
|
-
|
|
291
|
-
//# sourceMappingURL=ResidueTestsPage.js.map
|