Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
export const dynamic = 'force-dynamic'
|
|
|
|
import { redirect } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { createClient } from '@/lib/supabase/server'
|
|
import { CapaBoard } from '@/components/capa/capa-board'
|
|
|
|
export default async function CapaListPage() {
|
|
const supabase = await createClient()
|
|
const { data, error: authError } = await supabase.auth.getUser()
|
|
if (authError || !data?.user) redirect('/login?redirect=/hse/capa')
|
|
|
|
const { data: capas } = await supabase
|
|
.from('capa_actions')
|
|
.select(`
|
|
id, incident_id, description, department, due_date, priority, status,
|
|
incidents (reference_no, incident_type),
|
|
owner:users!owner_user_id (name, email)
|
|
`)
|
|
.order('due_date', { ascending: true })
|
|
|
|
return (
|
|
<main className="max-w-6xl mx-auto px-4 py-6">
|
|
<div className="flex items-center justify-between mb-6">
|
|
<h1 className="text-2xl font-bold text-gray-900">CAPA Board</h1>
|
|
<Link href="/hse/incidents" className="text-sm text-blue-600 hover:underline">
|
|
← Incidents
|
|
</Link>
|
|
</div>
|
|
<CapaBoard capas={(capas ?? []) as unknown as Parameters<typeof CapaBoard>[0]['capas']} />
|
|
</main>
|
|
)
|
|
}
|