fix: complete InvesteMoz validation and error corrections

This commit is contained in:
2026-10-29 21:47:33 +02:00
parent 63147312e2
commit daf8623441
718 changed files with 127308 additions and 20959 deletions
@@ -153,7 +153,7 @@ export function NavigationContextProvider({
}
const view = focus
? await contextApi<NavigationView>(
`/investimentos/${focus.case_id}${direct===focus.case_id && new URL(url,'https://context.invalid').searchParams.get('opportunity') ? '?opportunity='+encodeURIComponent(new URL(url,'https://context.invalid').searchParams.get('opportunity')!) : ''}`,
`/investimentos/${focus.case_id}${direct === focus.case_id && new URL(url, 'https://context.invalid').searchParams.get('opportunity') ? '?opportunity=' + encodeURIComponent(new URL(url, 'https://context.invalid').searchParams.get('opportunity')!) : ''}`,
)
: null;
if (!stopped) {
@@ -235,22 +235,28 @@ export function NavigationContextSummary() {
const saved = view?.investment_context;
const ref = saved?.selection;
const params = new URLSearchParams(url.split('?')[1] ?? '');
const scopedChoice = saved?.opportunity_choices?.find(c=>c.opportunity.key===params.get('opportunity'));
const multiple = (saved?.opportunity_choices?.length ?? 0)>1;
const scopedChoice = saved?.opportunity_choices?.find(
(c) => c.opportunity.key === params.get('opportunity'),
);
const multiple = (saved?.opportunity_choices?.length ?? 0) > 1;
const currentStep = view?.steps.find((s) => s.code === step);
const sector = scopedChoice ? scopedChoice.opportunity.fields.sector || 'Não indicado' :
ref?.sector?.title ||
saved?.fields.sector ||
view?.sector_contexts.map((s) => s.name).join(' · ') ||
'Não indicado';
const location = scopedChoice ? scopedChoice.territory?.title || 'Por definir' : multiple ? 'Consulte a localização de cada oportunidade' :
saved?.fields.location ||
ref?.territory?.title ||
ref?.park?.title ||
view?.zone_contexts
.map((z) => `${z.title} (v${z.consulted_public_version})`)
.join(' · ') ||
'Não indicada';
const sector = scopedChoice
? scopedChoice.opportunity.fields.sector || 'Não indicado'
: ref?.sector?.title ||
saved?.fields.sector ||
view?.sector_contexts.map((s) => s.name).join(' · ') ||
'Não indicado';
const location = scopedChoice
? scopedChoice.territory?.title || 'Por definir'
: multiple
? 'Consulte a localização de cada oportunidade'
: saved?.fields.location ||
ref?.territory?.title ||
ref?.park?.title ||
view?.zone_contexts
.map((z) => `${z.title} (v${z.consulted_public_version})`)
.join(' · ') ||
'Não indicada';
return (
<aside
className="sticky top-0 z-30 border-y border-emerald-200 bg-emerald-50 px-4 py-3 text-xs text-slate-900 shadow-sm"
@@ -263,7 +269,11 @@ export function NavigationContextSummary() {
view?.case.title ||
'Selecione um dossier',
Oportunidade:
scopedChoice?.opportunity.title || (multiple ? 'Várias — oportunidade em tratamento no formulário' : ref?.opportunity?.title || 'Sem oportunidade associada'),
scopedChoice?.opportunity.title ||
(multiple
? 'Várias — oportunidade em tratamento no formulário'
: ref?.opportunity?.title ||
'Sem oportunidade associada'),
Sector: sector,
Localização: location,
'Etapa atual': currentStep
@@ -285,7 +295,7 @@ export function NavigationContextSummary() {
{view && (
<Link
className="font-semibold underline"
href={`/investimentos/${active}${scopedChoice ? '?opportunity='+encodeURIComponent(scopedChoice.opportunity.key) : ''}`}
href={`/investimentos/${active}${scopedChoice ? '?opportunity=' + encodeURIComponent(scopedChoice.opportunity.key) : ''}`}
>
Abrir dossier atual
</Link>
@@ -293,7 +303,7 @@ export function NavigationContextSummary() {
{view?.next && (
<Link
className="underline"
href={`/investimentos/${active}${scopedChoice ? '?opportunity='+encodeURIComponent(scopedChoice.opportunity.key) : ''}#${view.next.code}`}
href={`/investimentos/${active}${scopedChoice ? '?opportunity=' + encodeURIComponent(scopedChoice.opportunity.key) : ''}#${view.next.code}`}
>
Preparar {view.next.code}
</Link>