Integrate supplied institutions by location category and type through investor dossiers

This commit is contained in:
2026-11-10 20:59:24 +02:00
parent 5ff9402fd0
commit 5a5cc9e815
26 changed files with 33731 additions and 80 deletions
+114 -31
View File
@@ -1,12 +1,26 @@
import {
ClassificationFields,
ClassificationSummary,
evidenceLabels,
type Classification,
} from '@/components/funding-classification';
import { card, input, button } from '@/pages/investment/shared';
export type FundingSource = {
source_url: string;
source_url: string | null;
source_document_name?: string | null;
source_document_sha256?: string | null;
evidence_status?: string | null;
origin?: string;
source_refs?: string[];
source_reference: string;
checked_on: string;
};
export type FundingContact = FundingSource & { kind: string; value: string };
export type FundingLocation = FundingSource & {
id?: string;
location_text?: string;
hours?: string;
role: string;
label: string;
address: string;
@@ -27,7 +41,7 @@ export type FundingProduct = FundingSource & {
availability: string;
contact_url: string;
};
export type InstitutionDetails = {
export type InstitutionDetails = Classification & {
institution_key: string;
institution_nature: string;
contacts: FundingContact[];
@@ -83,9 +97,45 @@ function Sources({
<Text
label="Endereço da fonte"
type="url"
value={value.source_url}
value={value.source_url ?? ''}
change={(source_url) => change({ source_url })}
/>
{!value.source_url && (
<>
<Text
label="Documento de origem"
value={value.source_document_name ?? ''}
change={(source_document_name) =>
change({ source_document_name })
}
/>
<Text
label="SHA-256 do original"
value={value.source_document_sha256 ?? ''}
change={(source_document_sha256) =>
change({ source_document_sha256 })
}
/>
</>
)}
{value.source_document_sha256 && (
<label>
Situação desta informação
<select
className={input}
value={value.evidence_status ?? 'to_confirm'}
onChange={(e) =>
change({ evidence_status: e.target.value })
}
>
{Object.entries(evidenceLabels).map(([key, label]) => (
<option key={key} value={key}>
{label}
</option>
))}
</select>
</label>
)}
<Text
label="Referência/edição"
value={value.source_reference}
@@ -130,6 +180,7 @@ export function InstitutionFields({
A sede ou balcão não determina a cobertura do financiamento. Não
preencha condições desconhecidas por inferência.
</p>
<ClassificationFields value={value} change={change} needs={needs} />
<Text
label="Identidade estável da instituição (referência do cadastro/fonte)"
value={value.institution_key}
@@ -502,40 +553,63 @@ export function InstitutionFields({
}
function Source({ value }: { value: FundingSource }) {
return (
<p>
<a
className="underline"
href={value.source_url}
target="_blank"
rel="noopener noreferrer"
>
{value.source_reference}
</a>{' '}
· consulta {value.checked_on}
</p>
<div>
<p>
{value.source_url ? (
<a
className="underline"
href={value.source_url}
target="_blank"
rel="noopener noreferrer"
>
{value.source_reference}
</a>
) : (
value.source_reference
)}{' '}
· consulta {value.checked_on}
</p>
{value.source_document_name && (
<p>
Documento: {value.source_document_name} · SHA-256{' '}
{value.source_document_sha256}
</p>
)}
{value.evidence_status && (
<p>
{evidenceLabels[value.evidence_status] ??
value.evidence_status}{' '}
· {value.origin}
</p>
)}
</div>
);
}
export function InstitutionView({ value }: { value: InstitutionDetails }) {
return (
<section className={card}>
<h2>Instituição financeira</h2>
<p>
Natureza:{' '}
{
(
{
bank: 'Banco',
credit: 'Instituição de crédito',
microfinance: 'Microfinanças',
investment_fund: 'Fundo de investimento',
development:
'Agência de desenvolvimento/financiamento',
other: 'Outra natureza documentada',
unknown: 'Por confirmar',
} as Record<string, string>
)[value.institution_nature]
}
</p>
<ClassificationSummary value={value} />
{!value.institution_types?.length && (
<p>
Natureza:{' '}
{
(
{
bank: 'Banco',
credit: 'Instituição de crédito',
microfinance: 'Microfinanças',
investment_fund: 'Fundo de investimento',
development:
'Agência de desenvolvimento/financiamento',
other: 'Outra natureza documentada',
unknown: 'Por confirmar',
} as Record<string, string>
)[value.institution_nature]
}
</p>
)}
<h3>Contactos</h3>
{value.contacts.length === 0 && <p>Contactos por confirmar.</p>}
{value.contacts.map((c, i) => (
@@ -575,6 +649,15 @@ export function InstitutionView({ value }: { value: InstitutionDetails }) {
{l.territory_path?.map((n) => n.name).join(' / ') ||
'Correspondência ao cadastro territorial por confirmar'}
</p>
{l.location_text && (
<p>Local indicado: {l.location_text}</p>
)}
{l.hours && (
<p>
Horário indicado na fonte (pode ter mudado):{' '}
{l.hours}
</p>
)}
<Source value={l} />
</article>
))}