import { Link } from '@inertiajs/react'; import EducationReview from '@/components/education-review'; import type { EducationReviewProps } from '@/lib/education-review'; import { Management } from '../management/shared'; import type { Paginated } from '../management/shared'; type ReviewEntry = { id: string; version: number | null; actor: string | null; occurred_at: string; available: boolean; status: 'reviewed' | 'rejected' | null; reason: string | null; previous_reason: string | null; }; export default function Declaration( props: EducationReviewProps & { backUrl: string; references: Record; history?: Paginated; }, ) { const row = props.declaration; const labels: Record = { occupation: 'Ocupação', skill: 'Competência', location: 'Localização', project: 'Projecto', course: 'Curso', }; return ( Voltar às declarações

{row.qualification}

{row.quantity}{' '} {props.kind === 'demands' ? 'trabalhadores' : 'vagas formativas'}{' '} · {row.period_start} a {row.period_end}

Fonte válida até {row.valid_until} {row.valid_until < props.today ? ' · Expirada' : ''}

{row.reference_date && (

Data de referência: {row.reference_date}

)} {props.kind === 'demands' && row.employer && (

Empregador declarado: {row.employer}

)}

Fonte: {row.source}

{!!Object.keys(props.references).length && (

Referências no cadastro actual

)} {Object.entries(props.references).map(([field, value]) => (

{labels[field] ?? field}:{' '} {value || 'Não identificado no cadastro actual'}

))} {row.submitted_by_name && (

Submetida por {row.submitted_by_name}

)} {row.reviewed_by_name && (

Revisão actual por {row.reviewed_by_name}

)} {row.review_reason && (

Último fundamento registado: {row.review_reason}

)} {props.kind === 'demands' && ( Analisar procura e oferta )}
{props.history && (

Registos de revisão disponíveis

Os registos anteriores à preservação dos fundamentos podem não estar disponíveis.

{!props.history.data.length && (

Sem registos de revisão preservados.

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

Versão {entry.version ?? 'não identificada'} ·{' '} {entry.actor ?? 'Autor não identificado'}

{entry.occurred_at}

{entry.available ? ( <>

{entry.status === 'reviewed' ? 'Revista' : 'Rejeitada'}

Fundamento: {entry.reason}

{entry.previous_reason && (

Fundamento anterior capturado:{' '} {entry.previous_reason}

)} ) : (

Fundamento indisponível para leitura. O registo original foi preservado.

)}
))}
)}
); }