fix: connect documentary anchors to investment preparation and recover accepted territories
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -34,6 +34,7 @@ export type ContextReference = {
|
||||
version: number | string | null;
|
||||
sha256: string;
|
||||
fields: Record<string, string>;
|
||||
analysis?: {documented_sector?: string | null; documented_location?: string | null; [key:string]:unknown};
|
||||
documents?: ContextDocument[];
|
||||
visibility?: 'private' | 'public';
|
||||
state?: string | null;
|
||||
@@ -63,7 +64,7 @@ export type DossierContext = {
|
||||
revision: number;
|
||||
selection: Partial<
|
||||
Record<
|
||||
'opportunity' | 'sector' | 'territory' | 'park',
|
||||
'portfolio' | 'opportunity' | 'sector' | 'territory' | 'park',
|
||||
ContextReference
|
||||
>
|
||||
>;
|
||||
|
||||
@@ -285,6 +285,7 @@ function makeSections(
|
||||
);
|
||||
if (context.version === 1) {
|
||||
const section = sections.get('sources');
|
||||
if (context.portfolio_origin) section?.rows.push({field:'Projecto ou carteira de origem', value:context.portfolio_origin.title, origin:`${context.portfolio_origin.key}; versão ${context.portfolio_origin.version}; ${context.portfolio_origin.href}`, classification:'Origem documental; localização e oferta não presumidas'});
|
||||
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.`);
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
const levels = ['province_id', 'district_id', 'admin_post_id', 'locality_id'];
|
||||
const searchRoutes = ['/carteira', '/oportunidades', '/zonas', '/educacao'];
|
||||
|
||||
/** Keep search geography explicit; a documentary origin is never an invented offer. */
|
||||
export function portfolioPreparationHref(id: string, pageUrl: string): string {
|
||||
const source = new URL(pageUrl, 'https://portal.invalid');
|
||||
const inherited = source.searchParams.has('catalogue_query') ? new URLSearchParams(source.searchParams.get('catalogue_query')!) : source.searchParams;
|
||||
const query = new URLSearchParams({source: `portfolio:${id}`});
|
||||
for (const field of levels) if (inherited.get(field)) query.set(field, inherited.get(field)!);
|
||||
return '/investimentos/iniciar?' + query.toString();
|
||||
}
|
||||
|
||||
/** Preserve an explicit complementary selection while consulting its canonical public fiche. */
|
||||
export function complementPreparationHref(pageUrl: string, target?: string): string | null {
|
||||
const params = new URL(pageUrl, 'https://portal.invalid').searchParams;
|
||||
|
||||
Reference in New Issue
Block a user