46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
export function InvestmentConsumerIdentity({ raw }: { raw: unknown }) {
|
|
if (typeof raw !== 'string' || !raw) return null;
|
|
try {
|
|
const saved = JSON.parse(raw);
|
|
const c = saved.choice;
|
|
if (!c?.opportunity?.key) return null;
|
|
const states: Record<string, string> = {
|
|
selected: 'Localização escolhida',
|
|
missing: 'Informação em falta',
|
|
conditional: 'Conforme as condições do projecto',
|
|
declared: 'Actividades declaradas',
|
|
undetermined: 'Por determinar',
|
|
};
|
|
return (
|
|
<section
|
|
aria-label="Oportunidade associada ao pedido"
|
|
className="my-3 rounded border p-3"
|
|
>
|
|
<h2 className="font-semibold">
|
|
Oportunidade associada ao pedido
|
|
</h2>
|
|
<p>
|
|
{c.opportunity.title} · {c.opportunity.key}
|
|
</p>
|
|
<p>
|
|
Localização guardada: {c.territory?.title ?? 'Por definir'}{' '}
|
|
· Corredor: {c.corridor_name ?? 'Por definir'}
|
|
</p>
|
|
<p>
|
|
Zona/parque: {c.park?.title ?? 'Sem selecção'} · Revisão do
|
|
dossier: {saved.revision}
|
|
</p>
|
|
{(saved.requirements?.requirements ?? []).map(
|
|
(r: { code: string; title: string; state: string }) => (
|
|
<p key={r.code}>
|
|
{r.title} · {states[r.state] ?? 'Por determinar'}
|
|
</p>
|
|
),
|
|
)}
|
|
</section>
|
|
);
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|