import { ClassificationFields, ClassificationSummary, evidenceLabels, type Classification, } from '@/components/funding-classification'; import { card, input, button } from '@/pages/investment/shared'; export type FundingSource = { 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; territory_id: string; territory_path?: { name: string }[]; }; export type FundingProduct = FundingSource & { code: string; title: string; instrument: string; needs: string[]; coverage: string; coverage_text: string; territory_ids: string[]; territory_paths?: { name: string }[][]; conditions: string; amounts: string; availability: string; contact_url: string; }; export type InstitutionDetails = Classification & { institution_key: string; institution_nature: string; contacts: FundingContact[]; locations: FundingLocation[]; products: FundingProduct[]; }; export const emptyInstitution: InstitutionDetails = { institution_key: '', institution_nature: 'unknown', contacts: [], locations: [], products: [], }; const source: FundingSource = { source_url: '', source_reference: '', checked_on: '', }; function Text({ label, value, change, type = 'text', }: { label: string; value: string; change: (v: string) => void; type?: string; }) { return ( ); } function Sources({ value, change, }: { value: FundingSource; change: (v: Partial) => void; }) { return (
Fonte e data deste elemento — Alterar change({ source_url })} /> {!value.source_url && ( <> change({ source_document_name }) } /> change({ source_document_sha256 }) } /> )} {value.source_document_sha256 && ( )} change({ source_reference })} /> change({ checked_on })} />
); } export function InstitutionFields({ value, change, territories, natures, needs, }: { value: InstitutionDetails; change: (patch: Partial) => void; territories: { id: string | number; name?: string }[]; natures: Record; needs: Record; }) { const update = ( key: K, index: number, patch: Partial, ) => change({ [key]: value[key].map((row, i) => i === index ? { ...row, ...patch } : row, ), }); return (

Instituição, presença física e produtos

A sede ou balcão não determina a cobertura do financiamento. Não preencha condições desconhecidas por inferência.

change({ institution_key })} />
Contactos ({value.contacts.length}) — Alterar {value.contacts.map((row, i) => (
Contacto {i + 1} update('contacts', i, { value: v })} /> update('contacts', i, v)} />
))}
Sede e balcões ({value.locations.length}) — Alterar {value.locations.map((row, i) => (
Local físico {i + 1} update('locations', i, { label }) } /> update('locations', i, { address }) } /> update('locations', i, v)} />
))}
Programas/produtos ({value.products.length}) — Alterar {value.products.map((row, i) => (
Produto {i + 1} update('products', i, { title })} /> update('products', i, { instrument }) } /> {row.coverage === 'territorial' && ( )} update('products', i, { coverage_text }) } />