import { Link } from '@inertiajs/react'; export type PublicDocument = { id: number; title: string; description: string | null; issuer: string | null; document_number: string | null; document_date: string | null; applicable_from: string | null; applicable_until: string | null; source_url: string | null; source_confirmation: string; usage_notice: string | null; view_url: string | null; download_url: string; context_actions: { href: string; label: string }[]; }; export function PublicDocumentContent({ resource: r, detail = false, back = '/documentos', }: { resource: PublicDocument; detail?: boolean; back?: string; }) { return ( <> {detail ? (

{r.title}

) : (

{r.title}

)} {r.description && (

{r.description}

)}
Entidade emissora / autor
{r.issuer ?? 'Não indicada'}
{r.document_number && (
Número
{r.document_number}
)} {r.document_date && (
Data do documento
{r.document_date}
)} {r.applicable_from && (
Data de início indicada no registo
{r.applicable_from}
)} {r.applicable_until && (
Data final indicada no registo
{r.applicable_until}
)}
Fonte
{r.source_confirmation === 'official_confirmed' ? 'Fonte oficial' : r.source_url ? 'Fonte identificada' : 'Não indicada'}
{r.usage_notice && (

{r.usage_notice}

)}
{!detail && ( Consultar ficha )} {r.view_url && ( Consultar ficheiro )} Descarregar documento {r.source_url && ( {r.source_confirmation === 'official_confirmed' ? 'Abrir fonte oficial' : 'Abrir fonte'} )} {r.context_actions.map((action) => ( {action.label} ))}
); }