import { Link } from '@inertiajs/react'; import TechnicalIncidentHandling from '@/components/technical-incident-handling'; import TechnicalIncidentNotice from '@/components/technical-incident-notice'; import { handlingLabels, commandLabels, incidentOperationLabel, incidentErrorLabel, } from '@/lib/technical-incident-labels'; import type { HandlingProps, Command } from '@/lib/technical-incident-handling'; import { Management, Pagination, type Paginated } from '../management/shared'; export default function TechnicalIncident( props: HandlingProps & { backUrl: string; notice?: { unread: boolean }; history: Paginated<{ id: string; version: number | null; action: Command | null; status: string | null; actor: string | null; occurred_at: string; note: string | null; note_available: boolean; }>; }, ) { const row = props.incident; return ( Voltar à fila de suporte

{incidentOperationLabel(row.operation)} · versão observada{' '} {row.observed_version}

Referência: {row.reference}

{row.occurred_at}

{incidentErrorLabel(row.error_code)}

Estado técnico: {handlingLabels[row.handling.status]}

Responsável actual:{' '} {row.handling.assignee_name || 'Por assumir'}

{props.notice && ( )}

Histórico do tratamento

{!props.history.data.length &&

Sem tratamento registado.

} {props.history.data.map((entry) => (

Versão {entry.version ?? 'não identificada'} ·{' '} {entry.action ? commandLabels[entry.action] : 'Registo anterior'}

{entry.actor || 'Autor não identificado'} ·{' '} {entry.occurred_at}

Estado:{' '} {entry.status ? handlingLabels[entry.status] || 'Não identificado' : 'Não identificado'}

{entry.note_available ? entry.note : 'Nota indisponível para leitura; original preservado.'}

))}
); }