fix: preserve territorial search across investment catalogues

This commit is contained in:
2026-10-22 12:52:52 +02:00
parent 5f4eb5cfaa
commit 9ac623a433
14 changed files with 118 additions and 24 deletions
+6 -4
View File
@@ -1,4 +1,5 @@
import { Link, useForm } from '@inertiajs/react';
import { Link, useForm, usePage } from '@inertiajs/react';
import { searchTerritoryHref } from '@/lib/search-territory';
import { catalogueDetailHref } from '@/lib/catalogue-context';
import { Management } from '../management/shared';
import type { Paginated } from '../management/shared';
@@ -35,6 +36,7 @@ export default function Index({
locality_id: filters.locality_id ?? '',
});
const base = management ? '/management/portfolio' : '/carteira';
const { url } = usePage();
const Frame = management ? Management : Layout;
return (
<Frame title="Corredores, clusters e projectos âncora">
@@ -151,7 +153,7 @@ export default function Index({
(r.corridor_id || r.cluster_id || r.project_id) && (
<Link
className="ml-4 underline"
href={`/oportunidades?${new URLSearchParams(r.corridor_id ? { corridor_id: r.corridor_id } : r.cluster_id ? { cluster_id: r.cluster_id } : { project_id: r.project_id! })}`}
href={searchTerritoryHref(`/oportunidades?${new URLSearchParams(r.corridor_id ? { corridor_id: r.corridor_id } : r.cluster_id ? { cluster_id: r.cluster_id } : { project_id: r.project_id! })}`, url)}
>
Ver oportunidades associadas
</Link>
@@ -174,10 +176,10 @@ export default function Index({
aria-label="Alternativas de exploração"
className="flex flex-wrap gap-4"
>
<Link className="underline" href="/oportunidades">
<Link className="underline" href={searchTerritoryHref('/oportunidades', url)}>
Ver oportunidades publicadas
</Link>
<Link className="underline" href="/zonas">
<Link className="underline" href={searchTerritoryHref('/zonas', url)}>
Consultar ZEE, ZFI e parques
</Link>
<Link className="underline" href="/Simulador">