feat: CAPA board — kanban/table view, create CAPA from incident, status tracking

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
This commit is contained in:
2026-07-11 15:16:49 +08:00
co-authored by Claude Opus 4.8
parent 63cb28f520
commit 1780586185
6 changed files with 476 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
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>
)
}