feat(capa): wire owner notes form into capa-owner page and HSE detail view
This commit is contained in:
@@ -5,6 +5,7 @@ import { createClient } from '@/lib/supabase/server'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { StatCard } from '@/components/dashboard/stat-card'
|
||||
import { CapaOwnerActions } from '@/components/capa/capa-owner-actions'
|
||||
import { CapaOwnerNotesForm } from '@/components/capa/capa-owner-notes-form'
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
open: 'Open',
|
||||
@@ -36,7 +37,7 @@ export default async function CapaOwnerPage() {
|
||||
|
||||
const { data: capas } = await supabase
|
||||
.from('capa_actions')
|
||||
.select('id, description, due_date, priority, status, incident_id, incidents (reference_no)')
|
||||
.select('id, description, due_date, priority, status, incident_id, owner_notes, incidents (reference_no)')
|
||||
.eq('owner_user_id', user.id)
|
||||
.order('due_date', { ascending: true, nullsFirst: false })
|
||||
|
||||
@@ -99,6 +100,7 @@ export default async function CapaOwnerPage() {
|
||||
<CapaOwnerActions capaId={capa.id} currentStatus={capa.status} />
|
||||
</div>
|
||||
</div>
|
||||
<CapaOwnerNotesForm capaId={capa.id} initialNotes={(capa as { owner_notes: string | null }).owner_notes} />
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
@@ -30,6 +30,7 @@ export default async function CapaDetailPage({ params }: Props) {
|
||||
.select(`
|
||||
id, incident_id, root_cause_ref, description, department,
|
||||
due_date, priority, status, completed_at, verified_by, verified_at, created_at,
|
||||
owner_notes,
|
||||
incidents (reference_no, incident_type),
|
||||
owner:users!owner_user_id (name, email)
|
||||
`)
|
||||
@@ -77,6 +78,14 @@ export default async function CapaDetailPage({ params }: Props) {
|
||||
<p className="text-xs text-gray-500">Status</p>
|
||||
<p className="text-gray-800 capitalize">{status.replace(/_/g, ' ')}</p>
|
||||
</div>
|
||||
{(capa as { owner_notes: string | null }).owner_notes && (
|
||||
<div className="col-span-2">
|
||||
<p className="text-xs text-gray-500">Owner Notes</p>
|
||||
<p className="text-sm text-gray-800 whitespace-pre-wrap">
|
||||
{(capa as { owner_notes: string }).owner_notes}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{(capa as { root_cause_ref: string | null }).root_cause_ref && (
|
||||
|
||||
Reference in New Issue
Block a user