import { button } from '@/pages/investment/shared'; import { useOrganizationCountryReuse } from '@/lib/organization-country-reuse'; import type { useInvestmentProfileEditor, OrganizationRecord, } from '@/lib/investment-profile-editor'; export default function OrganizationCountryReuse({ companyId, actorId, organizations, editor, reportDirty, }: { companyId: string; actorId: number; organizations: OrganizationRecord[]; editor: ReturnType; reportDirty: (id: string, dirty: boolean) => void; }) { const reuse = useOrganizationCountryReuse( companyId, actorId, editor, reportDirty, organizations, ); const preview = reuse.preview; const sources = organizations.filter((source) => source.country); if ( !organizations.length && !preview && !reuse.uncertain && !reuse.error && !reuse.notice ) return null; return (

Reutilizar o país de constituição

Escolha uma organização representada para consultar o país guardado. A confirmação altera esta declaração; manifestações anteriores conservam os seus valores.

{editor.dirty && !editor.externalBusy && (

Guarde ou confirme a preparação da declaração antes de reutilizar o país.

)} {!reuse.uncertain && (
{sources.map((source) => ( ))}
)} {!sources.length && !reuse.uncertain && (

Sem país guardado nas organizações representadas nesta página.

)} {reuse.error &&

{reuse.error}

} {reuse.notice &&

{reuse.notice}

} {reuse.sourceChanged && (

A organização foi alterada. Consulte novamente o país antes de confirmar.

)} {preview && (

Declaração: versão {preview.companyVersion}; país actual: {preview.companyCountry || 'Não informado'}.

País a reutilizar: {preview.country}, de{' '} {preview.organizationName}, versão{' '} {preview.organizationVersion}.

Fonte ou referência:{' '} {preview.reference || 'Não informada no registo guardado'} .

{reuse.uncertain ? ( ) : ( )}
)}
); }