fix: share selected opportunity across simulator stages and land shortcuts

This commit is contained in:
2026-10-23 18:25:09 +02:00
parent bc84fbdb3e
commit 1afdfee8c0
17 changed files with 337 additions and 46 deletions
+1
View File
@@ -19,6 +19,7 @@ export const pathStates: Record<string, string> = {
expired: 'Acto externo expirado',
};
export type PathResult = {
context_opportunity?: string | null;
id: string;
financial_snapshot: string;
currency: string | null;
@@ -284,6 +284,11 @@ function makeSections(
);
if (context.version === 1) {
const section = sections.get('sources');
if (context.consumer_opportunity) section?.rows.push({field:'Oportunidade em tratamento', value:context.consumer_opportunity, origin:context.opportunity_choices?.[0]?.opportunity?.title ?? 'Escolha guardada no dossier', classification:'Âmbito desta análise'});
for (const step of context.path?.steps ?? []) {
if (step.applicability === 'not_needed_for_preparation') section?.paragraphs.push(`${step.code} — preparação não necessária neste âmbito: ${step.reason || 'Decisão guardada do promotor'}. Histórico conservado; não constitui dispensa legal.`);
else section?.rows.push({field:`Etapa ${step.code}: ${step.title}`,value:step.applicability === 'undetermined' ? 'Aplicabilidade por determinar' : step.state,origin:context.consumer_opportunity ?? 'Contexto comum do dossier',classification:'Preparação no âmbito seleccionado'});
}
const zone = context.zone;
section?.rows.push({
field: 'Contexto do investimento',