feat: split alcohol and urine test into separate fields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
const [findingsText, setFindingsText] = useState('')
|
||||
const [rootCause, setRootCause] = useState('')
|
||||
const [alcoholTest, setAlcoholTest] = useState('')
|
||||
const [urineTest, setUrineTest] = useState('')
|
||||
const [witnessRefs, setWitnessRefs] = useState<string[]>([''])
|
||||
const [complete, setComplete] = useState(false)
|
||||
const [saving, setSaving] = useState(false)
|
||||
@@ -95,6 +96,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
findings_text: findingsText || null,
|
||||
root_cause_summary: rootCause || null,
|
||||
alcohol_test_result: alcoholTest || null,
|
||||
urine_test_result: urineTest || null,
|
||||
witness_statement_refs: witnessRefs.map(w => w.trim()).filter(Boolean),
|
||||
five_why_steps: method === 'five_why' ? fiveWhy.filter(s => s.answer) : null,
|
||||
fishbone_categories: method === 'fishbone'
|
||||
@@ -211,19 +213,35 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Alcohol / Urine Test Result</label>
|
||||
<select
|
||||
value={alcoholTest}
|
||||
onChange={e => setAlcoholTest(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm"
|
||||
>
|
||||
<option value="">Not applicable / not conducted</option>
|
||||
<option value="negative">Negative</option>
|
||||
<option value="positive">Positive</option>
|
||||
<option value="refused">Refused</option>
|
||||
<option value="pending">Result pending</option>
|
||||
</select>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Alcohol Test Result</label>
|
||||
<select
|
||||
value={alcoholTest}
|
||||
onChange={e => setAlcoholTest(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm"
|
||||
>
|
||||
<option value="">Not conducted</option>
|
||||
<option value="negative">Negative</option>
|
||||
<option value="positive">Positive</option>
|
||||
<option value="refused">Refused</option>
|
||||
<option value="pending">Result pending</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Urine Test Result</label>
|
||||
<select
|
||||
value={urineTest}
|
||||
onChange={e => setUrineTest(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm"
|
||||
>
|
||||
<option value="">Not conducted</option>
|
||||
<option value="negative">Negative</option>
|
||||
<option value="positive">Positive</option>
|
||||
<option value="refused">Refused</option>
|
||||
<option value="pending">Result pending</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
@@ -8,6 +8,7 @@ interface Investigation {
|
||||
findings_text: string | null
|
||||
root_cause_summary: string | null
|
||||
alcohol_test_result: string | null
|
||||
urine_test_result: string | null
|
||||
witness_statement_refs: string[]
|
||||
completed_at: string | null
|
||||
investigator: { name: string | null; email: string } | null
|
||||
@@ -23,6 +24,13 @@ const METHOD_LABELS = {
|
||||
other: 'Other Method',
|
||||
}
|
||||
|
||||
const TEST_RESULT_LABELS: Record<string, string> = {
|
||||
negative: 'Negative',
|
||||
positive: 'Positive',
|
||||
refused: 'Refused',
|
||||
pending: 'Result pending',
|
||||
}
|
||||
|
||||
export function InvestigationPanel({ investigation: inv }: Props) {
|
||||
const investigatorName = inv.investigator?.name ?? inv.investigator?.email ?? 'Unknown'
|
||||
|
||||
@@ -105,11 +113,21 @@ export function InvestigationPanel({ investigation: inv }: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Alcohol test */}
|
||||
{inv.alcohol_test_result && (
|
||||
<div>
|
||||
<h3 className="text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1">Alcohol Test Result</h3>
|
||||
<p className="text-sm text-gray-900">{inv.alcohol_test_result}</p>
|
||||
{/* Drug tests */}
|
||||
{(inv.alcohol_test_result || inv.urine_test_result) && (
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{inv.alcohol_test_result && (
|
||||
<div>
|
||||
<h3 className="text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1">Alcohol Test</h3>
|
||||
<p className="text-sm text-gray-900">{TEST_RESULT_LABELS[inv.alcohol_test_result] ?? inv.alcohol_test_result}</p>
|
||||
</div>
|
||||
)}
|
||||
{inv.urine_test_result && (
|
||||
<div>
|
||||
<h3 className="text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1">Urine Test</h3>
|
||||
<p className="text-sm text-gray-900">{TEST_RESULT_LABELS[inv.urine_test_result] ?? inv.urine_test_result}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user