fix: add urine_test_result to supervisor incident detail select
This commit is contained in:
@@ -4,6 +4,7 @@ import { notFound } from 'next/navigation'
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { createClient } from '@/lib/supabase/server'
|
import { createClient } from '@/lib/supabase/server'
|
||||||
import { IncidentDetail, type Incident } from '@/components/incidents/incident-detail'
|
import { IncidentDetail, type Incident } from '@/components/incidents/incident-detail'
|
||||||
|
import { InvestigationPanel } from '@/components/incidents/investigation-panel'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: Promise<{ id: string }>
|
params: Promise<{ id: string }>
|
||||||
@@ -30,12 +31,26 @@ export default async function SupervisorIncidentDetailPage({ params }: Props) {
|
|||||||
|
|
||||||
if (error || !incident) notFound()
|
if (error || !incident) notFound()
|
||||||
|
|
||||||
|
const { data: investigation } = await supabase
|
||||||
|
.from('investigations')
|
||||||
|
.select(`
|
||||||
|
id, method, five_why_steps, fishbone_categories,
|
||||||
|
findings_text, root_cause_summary, alcohol_test_result, urine_test_result,
|
||||||
|
witness_statement_refs, completed_at,
|
||||||
|
investigator:users!investigator_id (name, email)
|
||||||
|
`)
|
||||||
|
.eq('incident_id', id)
|
||||||
|
.maybeSingle()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-3xl mx-auto px-4 py-6">
|
<main className="max-w-3xl mx-auto px-4 py-6">
|
||||||
<Link href="/supervisor/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href="/supervisor/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
||||||
← Back to inbox
|
← Back to inbox
|
||||||
</Link>
|
</Link>
|
||||||
<IncidentDetail incident={incident as unknown as Incident} />
|
<IncidentDetail incident={incident as unknown as Incident} />
|
||||||
|
{investigation && (
|
||||||
|
<InvestigationPanel investigation={investigation as never} />
|
||||||
|
)}
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user