@@ -37,20 +37,34 @@ type DocumentResource = {
|
||||
|
||||
const modulePaths: Record<string, { href: string; label: string }> = {
|
||||
simulator: { href: '/Simulador', label: 'Simulador fiscal' },
|
||||
investment: { href: '/oportunidades', label: 'Oportunidades de investimento' },
|
||||
investment: {
|
||||
href: '/oportunidades',
|
||||
label: 'Oportunidades de investimento',
|
||||
},
|
||||
zones: { href: '/zonas', label: 'ZEE, ZFI e parques industriais' },
|
||||
education: { href: '/educacao', label: 'Educação e competências' },
|
||||
business: { href: '/negocios', label: 'Negócios' },
|
||||
land: { href: '/investidor/terra-duat', label: 'Terra e DUAT' },
|
||||
};
|
||||
const documentTypeLabels: Record<string, string> = {
|
||||
legislation: 'Legislação', procedure: 'Procedimento oficial', official_form: 'Formulário oficial',
|
||||
digital_adaptation: 'Adaptação digital de formulário', guidance_template: 'Modelo orientativo',
|
||||
guide: 'Guia', study: 'Estudo', reference_data: 'Dados de referência', unknown: 'Tipo por classificar',
|
||||
legislation: 'Legislação',
|
||||
procedure: 'Procedimento oficial',
|
||||
official_form: 'Formulário oficial',
|
||||
digital_adaptation: 'Adaptação digital de formulário',
|
||||
guidance_template: 'Modelo orientativo',
|
||||
guide: 'Guia',
|
||||
study: 'Estudo',
|
||||
reference_data: 'Dados de referência',
|
||||
unknown: 'Tipo por classificar',
|
||||
};
|
||||
const legalStatusLabels: Record<string, string> = {
|
||||
not_applicable: 'Não aplicável', in_force: 'Vigência indicada; confirme o período', historical: 'Histórico',
|
||||
proposed: 'Proposta; não é norma vigente', repealed: 'Revogada', amended: 'Alterada; consulte alterações posteriores', unknown: 'Por confirmar',
|
||||
not_applicable: 'Não aplicável',
|
||||
in_force: 'Vigência indicada; confirme o período',
|
||||
historical: 'Histórico',
|
||||
proposed: 'Proposta; não é norma vigente',
|
||||
repealed: 'Revogada',
|
||||
amended: 'Alterada; consulte alterações posteriores',
|
||||
unknown: 'Por confirmar',
|
||||
};
|
||||
|
||||
export default function DocumentPage({
|
||||
@@ -67,46 +81,220 @@ export default function DocumentPage({
|
||||
<Head title={resource.title} />
|
||||
<PortalMenu />
|
||||
<main className="mx-auto max-w-4xl space-y-6 px-5 py-10">
|
||||
<Link className="underline" href={backUrl}>← Voltar à pesquisa</Link>
|
||||
<Link className="underline" href={backUrl}>
|
||||
← Voltar à pesquisa
|
||||
</Link>
|
||||
<article className="space-y-5 rounded-xl border bg-white p-5 sm:p-8">
|
||||
<header className="space-y-2">
|
||||
<p className="text-sm text-slate-600">{resource.category} · {resource.topic}</p>
|
||||
<h1 className="break-words text-3xl font-bold">{resource.title}</h1>
|
||||
{resource.description && <p className="whitespace-pre-line">{resource.description}</p>}
|
||||
<p className="text-sm text-slate-600">
|
||||
{resource.category} · {resource.topic}
|
||||
</p>
|
||||
<h1 className="text-3xl font-bold break-words">
|
||||
{resource.title}
|
||||
</h1>
|
||||
{resource.description && (
|
||||
<p className="whitespace-pre-line">
|
||||
{resource.description}
|
||||
</p>
|
||||
)}
|
||||
</header>
|
||||
<dl className="grid gap-4 sm:grid-cols-2">
|
||||
<div><dt className="font-semibold">Tipo documental</dt><dd>{documentTypeLabels[resource.document_type] ?? resource.document_type}</dd></div>
|
||||
<div><dt className="font-semibold">Entidade emitente / autor</dt><dd>{resource.issuer ?? 'Não indicada'}</dd></div>
|
||||
<div><dt className="font-semibold">Número e data</dt><dd>{[resource.document_number, resource.document_date].filter(Boolean).join(' · ') || 'Não indicados'}</dd></div>
|
||||
<div><dt className="font-semibold">Período de aplicação documentado</dt><dd>{resource.applicable_from || resource.applicable_until ? `${resource.applicable_from ?? 'Início não indicado'} — ${resource.applicable_until ?? 'Sem data final indicada'}` : 'Não registado'}</dd></div>
|
||||
<div><dt className="font-semibold">Versão e idioma</dt><dd>{resource.version_label ?? 'Versão não indicada'} · {resource.language}</dd></div>
|
||||
<div><dt className="font-semibold">Âmbito</dt><dd>{resource.territorial_scope === 'national' ? 'Nacional' : resource.territory_name ?? 'Por confirmar'}</dd></div>
|
||||
<div><dt className="font-semibold">Situação documental</dt><dd>{legalStatusLabels[resource.legal_status] ?? resource.legal_status}</dd></div>
|
||||
<div><dt className="font-semibold">Fonte</dt><dd>{resource.source_confirmation === 'official_confirmed' ? 'Fonte oficial confirmada' : resource.source_confirmation === 'identified' ? 'Origem identificada' : 'Por confirmar'}</dd></div>
|
||||
<div>
|
||||
<dt className="font-semibold">Tipo documental</dt>
|
||||
<dd>
|
||||
{documentTypeLabels[resource.document_type] ??
|
||||
resource.document_type}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">
|
||||
Entidade emitente / autor
|
||||
</dt>
|
||||
<dd>{resource.issuer ?? 'Não indicada'}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">Número e data</dt>
|
||||
<dd>
|
||||
{[
|
||||
resource.document_number,
|
||||
resource.document_date,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ') || 'Não indicados'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">
|
||||
Período de aplicação documentado
|
||||
</dt>
|
||||
<dd>
|
||||
{resource.applicable_from ||
|
||||
resource.applicable_until
|
||||
? `${resource.applicable_from ?? 'Início não indicado'} — ${resource.applicable_until ?? 'Sem data final indicada'}`
|
||||
: 'Não registado'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">Versão e idioma</dt>
|
||||
<dd>
|
||||
{resource.version_label ??
|
||||
'Versão não indicada'}{' '}
|
||||
· {resource.language}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">Âmbito</dt>
|
||||
<dd>
|
||||
{resource.territorial_scope === 'national'
|
||||
? 'Nacional'
|
||||
: (resource.territory_name ??
|
||||
'Por confirmar')}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">
|
||||
Situação documental
|
||||
</dt>
|
||||
<dd>
|
||||
{legalStatusLabels[resource.legal_status] ??
|
||||
resource.legal_status}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold">Fonte</dt>
|
||||
<dd>
|
||||
{resource.source_confirmation ===
|
||||
'official_confirmed'
|
||||
? 'Fonte oficial confirmada'
|
||||
: resource.source_confirmation ===
|
||||
'identified'
|
||||
? 'Origem identificada'
|
||||
: 'Por confirmar'}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
{resource.source_confirmation === 'identified' && <p className="rounded border border-amber-300 bg-amber-50 p-3" role="note">A origem está identificada, mas a autenticidade desta cópia não foi confirmada independentemente. Consulte a fonte indicada.</p>}
|
||||
<p className="break-words text-sm">Referência: {resource.source_reference}</p>
|
||||
{resource.links.length > 0 && <section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Base legal e documentos relacionados no portal</h2>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
{resource.links.map((link, index) => {
|
||||
const destination = link.target_type === 'module' ? modulePaths[link.target_key] : undefined;
|
||||
return <li key={`${link.target_type}-${link.target_key}-${index}`}>
|
||||
{destination ? <Link className="underline" href={destination.href}>{destination.label}</Link> : <span>{link.target_type === 'requirement' ? `Requisito documental: ${link.target_label ?? link.target_key}` : `${link.target_type}: ${link.target_key}`}</span>}
|
||||
{' · '}{link.applicability === 'evidence' ? 'evidência documental' : link.applicability}
|
||||
{link.condition_text && <span> · Condição: {link.condition_text}</span>}
|
||||
{link.basis_reference && <span> · Referência documental (não é regra fiscal): {link.basis_reference}</span>}
|
||||
{link.review_status === 'confirmed' ? <span> · Citação conferida no ficheiro; aplicação fiscal pendente</span> : <span> · Pendente de conferência; não constitui fundamento confirmado</span>}
|
||||
</li>;
|
||||
})}
|
||||
</ul>
|
||||
</section>}
|
||||
{resource.source_confirmation === 'identified' && (
|
||||
<p
|
||||
className="rounded border border-amber-300 bg-amber-50 p-3"
|
||||
role="note"
|
||||
>
|
||||
A origem está identificada, mas a autenticidade
|
||||
desta cópia não foi confirmada independentemente.
|
||||
Consulte a fonte indicada.
|
||||
</p>
|
||||
)}
|
||||
<p className="text-sm break-words">
|
||||
Referência: {resource.source_reference}
|
||||
</p>
|
||||
{resource.links.length > 0 && (
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Base legal e documentos relacionados no portal
|
||||
</h2>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
{resource.links.map((link, index) => {
|
||||
const destination =
|
||||
link.target_type === 'module'
|
||||
? modulePaths[link.target_key]
|
||||
: undefined;
|
||||
return (
|
||||
<li
|
||||
key={`${link.target_type}-${link.target_key}-${index}`}
|
||||
>
|
||||
{destination ? (
|
||||
<Link
|
||||
className="underline"
|
||||
href={destination.href}
|
||||
>
|
||||
{destination.label}
|
||||
</Link>
|
||||
) : (
|
||||
<span>
|
||||
{link.target_type ===
|
||||
'requirement'
|
||||
? `Requisito documental: ${link.target_label ?? link.target_key}`
|
||||
: `${link.target_type}: ${link.target_key}`}
|
||||
</span>
|
||||
)}
|
||||
{' · '}
|
||||
{link.applicability === 'evidence'
|
||||
? 'evidência documental'
|
||||
: link.applicability}
|
||||
{link.condition_text && (
|
||||
<span>
|
||||
{' '}
|
||||
· Condição:{' '}
|
||||
{link.condition_text}
|
||||
</span>
|
||||
)}
|
||||
{link.basis_reference && (
|
||||
<span>
|
||||
{' '}
|
||||
· Referência documental (não
|
||||
é regra fiscal):{' '}
|
||||
{link.basis_reference}
|
||||
</span>
|
||||
)}
|
||||
{link.review_status ===
|
||||
'confirmed' ? (
|
||||
<span>
|
||||
{' '}
|
||||
· Citação conferida no
|
||||
ficheiro; aplicação fiscal
|
||||
pendente
|
||||
</span>
|
||||
) : (
|
||||
<span>
|
||||
{' '}
|
||||
· Pendente de conferência;
|
||||
não constitui fundamento
|
||||
confirmado
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
<div className="flex flex-wrap gap-3 border-t pt-4">
|
||||
<a className="rounded-lg bg-emerald-800 px-5 py-3 font-semibold text-white" href={downloadUrl}>Descarregar ficheiro ({resource.file_name}{resource.size_bytes ? ` · ${Math.ceil(resource.size_bytes / 1024)} KB` : ''})</a>
|
||||
{resource.view_url && <a className="rounded-lg border px-5 py-3 font-semibold underline" href={resource.view_url} target="_blank" rel="noreferrer">Consultar ficheiro</a>}
|
||||
{resource.source_url && <a className="rounded-lg border px-5 py-3 font-semibold underline" href={resource.source_url} target="_blank" rel="noreferrer">Abrir fonte identificada</a>}
|
||||
<a
|
||||
className="rounded-lg bg-emerald-800 px-5 py-3 font-semibold text-white"
|
||||
href={downloadUrl}
|
||||
>
|
||||
Descarregar ficheiro ({resource.file_name}
|
||||
{resource.size_bytes
|
||||
? ` · ${Math.ceil(resource.size_bytes / 1024)} KB`
|
||||
: ''}
|
||||
)
|
||||
</a>
|
||||
{resource.view_url && (
|
||||
<a
|
||||
className="rounded-lg border px-5 py-3 font-semibold underline"
|
||||
href={resource.view_url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Consultar ficheiro
|
||||
</a>
|
||||
)}
|
||||
{resource.source_url && (
|
||||
<a
|
||||
className="rounded-lg border px-5 py-3 font-semibold underline"
|
||||
href={resource.source_url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Abrir fonte identificada
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-sm text-slate-600">A disponibilização desta referência não certifica vigência, elegibilidade, viabilidade ou aprovação oficial. Consulte o diploma ou a entidade competente para confirmar a sua aplicação ao caso concreto.</p>
|
||||
<p className="text-sm text-slate-600">
|
||||
A disponibilização desta referência não certifica
|
||||
vigência, elegibilidade, viabilidade ou aprovação
|
||||
oficial. Consulte o diploma ou a entidade competente
|
||||
para confirmar a sua aplicação ao caso concreto.
|
||||
</p>
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user