commit 23
This commit is contained in:
@@ -20,6 +20,19 @@ import type { InvestmentMapArea } from '@/components/interactive-investment-map'
|
||||
import { type TerritoryOption } from '@/components/investment-territory';
|
||||
import { Frame, button, card, money, api } from './shared';
|
||||
import type { Opportunity, References } from './shared';
|
||||
import {
|
||||
ArrowUpRight,
|
||||
Bookmark,
|
||||
Columns2,
|
||||
Download,
|
||||
LayoutGrid,
|
||||
List,
|
||||
Map as MapIcon,
|
||||
MapPin,
|
||||
Route,
|
||||
} from 'lucide-react';
|
||||
import CatalogueFilterGroup from '@/components/catalogue-filter-group';
|
||||
import '../../../css/investment-catalogue.css';
|
||||
|
||||
type Feature = {
|
||||
geometry: { coordinates: [number, number] };
|
||||
@@ -63,6 +76,7 @@ export default function Catalogue({
|
||||
const page = usePage<{ auth: { user: unknown } }>();
|
||||
const { auth } = page.props;
|
||||
const [investmentSelection, setInvestmentSelection] = useState<number[]>(
|
||||
<<<<<<< HEAD
|
||||
readOpportunitySelection,
|
||||
);
|
||||
const [selectionStorageUnavailable, setSelectionStorageUnavailable] =
|
||||
@@ -71,11 +85,33 @@ export default function Catalogue({
|
||||
setInvestmentSelection(next);
|
||||
setSelectionStorageUnavailable(!persistOpportunitySelection(next));
|
||||
}
|
||||
=======
|
||||
() => {
|
||||
try {
|
||||
return JSON.parse(
|
||||
sessionStorage.getItem(
|
||||
'investment-opportunity-selection',
|
||||
) ?? '[]',
|
||||
);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
);
|
||||
>>>>>>> origin/main
|
||||
function selectInvestment(id: number, checked: boolean) {
|
||||
const next = checked
|
||||
? [...new Set([...investmentSelection, id])]
|
||||
: investmentSelection.filter((x) => x !== id);
|
||||
<<<<<<< HEAD
|
||||
updateInvestmentSelection(next);
|
||||
=======
|
||||
setInvestmentSelection(next);
|
||||
sessionStorage.setItem(
|
||||
'investment-opportunity-selection',
|
||||
JSON.stringify(next),
|
||||
);
|
||||
>>>>>>> origin/main
|
||||
}
|
||||
const form = useForm({
|
||||
perspective: String(filters.perspective ?? ''),
|
||||
@@ -362,6 +398,7 @@ export default function Catalogue({
|
||||
};
|
||||
return (
|
||||
<Frame
|
||||
mainClassName="investment-catalogue"
|
||||
title={
|
||||
form.data.education
|
||||
? 'Oportunidades na Educação'
|
||||
@@ -379,10 +416,11 @@ export default function Catalogue({
|
||||
Iniciar ou continuar ideia nesta localização
|
||||
</Link>
|
||||
)}
|
||||
<p>
|
||||
<p className="catalogue-intro">
|
||||
Combine os filtros para encontrar oportunidades publicadas.
|
||||
Nenhum critério é alargado automaticamente.
|
||||
</p>
|
||||
<<<<<<< HEAD
|
||||
<OpportunitySearchFilters
|
||||
data={form.data}
|
||||
references={references}
|
||||
@@ -583,20 +621,61 @@ export default function Catalogue({
|
||||
'',
|
||||
) || undefined
|
||||
}
|
||||
=======
|
||||
<div className="catalogue-workspace">
|
||||
<aside aria-label="Filtros do catálogo">
|
||||
<OpportunitySearchFilters
|
||||
data={form.data}
|
||||
references={references}
|
||||
path={territoryPath}
|
||||
change={(patch) =>
|
||||
form.setData((d) => ({ ...d, ...patch }))
|
||||
}
|
||||
territory={changeTerritory}
|
||||
submit={() => runSearch()}
|
||||
errors={form.errors}
|
||||
clear={() => {
|
||||
setTerritoryPath([]);
|
||||
form.setData(
|
||||
(d) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(d).map(
|
||||
([key, value]) => [
|
||||
key,
|
||||
key === 'view'
|
||||
? 'grid'
|
||||
: key === 'sort'
|
||||
? 'recent'
|
||||
: key ===
|
||||
'territory_basis'
|
||||
? 'all'
|
||||
: Array.isArray(value)
|
||||
? []
|
||||
: typeof value ===
|
||||
'boolean'
|
||||
? false
|
||||
: '',
|
||||
],
|
||||
),
|
||||
) as unknown as typeof d,
|
||||
);
|
||||
}}
|
||||
>>>>>>> origin/main
|
||||
/>
|
||||
)}
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
['map', 'combined'].includes(view) &&
|
||||
!error &&
|
||||
mapContext.length > 0 && (
|
||||
<section
|
||||
className={card}
|
||||
aria-label="Estruturas territoriais consultáveis"
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
Estruturas territoriais e projetos
|
||||
</aside>
|
||||
<section
|
||||
id="catalogue-results"
|
||||
className="catalogue-results"
|
||||
aria-label="Oportunidades publicadas"
|
||||
aria-busy={searchLoading}
|
||||
>
|
||||
<header className="catalogue-results-heading">
|
||||
<h2>
|
||||
Oportunidades publicadas
|
||||
{filters.sector && ` · ${references.sectors.find((sector) => sector.slug === filters.sector)?.name ?? filters.sector}`}
|
||||
{territorySelection.length > 0 && ` · ${territorySelection.map((territory) => territory.name).join(' / ')}`}
|
||||
</h2>
|
||||
<<<<<<< HEAD
|
||||
<p>
|
||||
Estas fichas continuam consultáveis
|
||||
independentemente de terem coordenadas. A lista não
|
||||
@@ -724,15 +803,133 @@ export default function Catalogue({
|
||||
>
|
||||
Ver ficha
|
||||
</Link>
|
||||
=======
|
||||
<SearchState
|
||||
loading={searchLoading}
|
||||
error={searchError}
|
||||
total={results.total}
|
||||
retry={() => runSearch()}
|
||||
/>
|
||||
</header>
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
results.total === 0 &&
|
||||
selectedStructures.length > 0 && (
|
||||
<section
|
||||
className={card}
|
||||
aria-label="Estrutura seleccionada"
|
||||
>
|
||||
<p className="font-semibold">
|
||||
Sem oportunidades publicadas associadas com
|
||||
estes filtros.
|
||||
</p>
|
||||
<p>
|
||||
A estrutura continua disponível para
|
||||
consulta. A sua selecção não confirma
|
||||
benefícios nem disponibilidade para
|
||||
investimento.
|
||||
</p>
|
||||
{selectedStructures.map((record) =>
|
||||
record.url ? (
|
||||
<Link
|
||||
key={record.id}
|
||||
className="block underline"
|
||||
href={searchTerritoryHref(
|
||||
record.url,
|
||||
page.url,
|
||||
)}
|
||||
>
|
||||
Consultar ficha: {record.name}
|
||||
</Link>
|
||||
) : (
|
||||
<p key={record.id}>
|
||||
{record.name} — sem ficha pública
|
||||
detalhada disponível.
|
||||
</p>
|
||||
),
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
<div className="catalogue-results-toolbar">
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
results.total === 0 &&
|
||||
(form.data.province_id ||
|
||||
form.data.district_id ||
|
||||
form.data.admin_post_id ||
|
||||
form.data.locality_id) && (
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
onClick={() => {
|
||||
setTerritoryPath([]);
|
||||
form.setData((data) => ({
|
||||
...data,
|
||||
province_id: '',
|
||||
district_id: '',
|
||||
admin_post_id: '',
|
||||
locality_id: '',
|
||||
province: '',
|
||||
district: '',
|
||||
geo_location_id: '',
|
||||
}));
|
||||
}}
|
||||
>
|
||||
Pesquisar noutras províncias (remover localização)
|
||||
</button>
|
||||
)}
|
||||
<div
|
||||
className="catalogue-view-options"
|
||||
role="group"
|
||||
aria-label="Apresentação dos resultados"
|
||||
>
|
||||
{[
|
||||
'grid',
|
||||
'list',
|
||||
'map',
|
||||
'combined',
|
||||
'corridors',
|
||||
].map((value, i) => {
|
||||
const Icon = [
|
||||
LayoutGrid,
|
||||
List,
|
||||
MapIcon,
|
||||
Columns2,
|
||||
Route,
|
||||
][i];
|
||||
return (
|
||||
>>>>>>> origin/main
|
||||
<button
|
||||
aria-pressed={saved.includes(r.id)}
|
||||
className="underline"
|
||||
onClick={() => toggle(r.id)}
|
||||
key={value}
|
||||
disabled={
|
||||
searchLoading || !!searchError
|
||||
}
|
||||
aria-pressed={view === value}
|
||||
className="catalogue-view-button"
|
||||
onClick={() => {
|
||||
const params = new URLSearchParams(
|
||||
query(),
|
||||
);
|
||||
params.set('view', value);
|
||||
router.get(
|
||||
`${catalogueUrl}?${params}`,
|
||||
{},
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
{saved.includes(r.id)
|
||||
? 'Retirar favorito'
|
||||
: 'Guardar favorito'}
|
||||
<Icon size={16} aria-hidden="true" />
|
||||
{
|
||||
[
|
||||
'Grelha',
|
||||
'Lista',
|
||||
'Mapa',
|
||||
'Lista e mapa',
|
||||
'Por corredor',
|
||||
][i]
|
||||
}
|
||||
</button>
|
||||
<<<<<<< HEAD
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -912,25 +1109,526 @@ export default function Catalogue({
|
||||
page.url,
|
||||
)}
|
||||
key={d.id}
|
||||
className={card}
|
||||
=======
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="catalogue-utility-actions">
|
||||
<a
|
||||
className="catalogue-utility-link"
|
||||
aria-disabled={searchLoading || !!searchError}
|
||||
tabIndex={
|
||||
searchLoading || searchError
|
||||
? -1
|
||||
: undefined
|
||||
}
|
||||
onClick={(event) => {
|
||||
if (searchLoading || searchError)
|
||||
event.preventDefault();
|
||||
}}
|
||||
href={'/api/v1/investment/export?' + query()}
|
||||
>
|
||||
<span className="text-sm">
|
||||
{d.content.code} ·{' '}
|
||||
{d.cluster_id
|
||||
? 'Cluster'
|
||||
: d.corridor_id
|
||||
? 'Corredor'
|
||||
: 'Projecto âncora'}
|
||||
</span>
|
||||
<h3 className="mt-2 font-semibold">
|
||||
{d.title}
|
||||
</h3>
|
||||
<Download size={15} aria-hidden="true" />
|
||||
Exportar CSV (até 1.000)
|
||||
</a>
|
||||
<Link
|
||||
className="catalogue-utility-link"
|
||||
href="/investidor/manifestacoes"
|
||||
>
|
||||
<Bookmark size={15} aria-hidden="true" />
|
||||
Favoritos e pedidos
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
['map', 'combined'].includes(view) && (
|
||||
<div
|
||||
role={error ? 'alert' : 'status'}
|
||||
aria-live="polite"
|
||||
>
|
||||
{error ? (
|
||||
<>
|
||||
Não foi possível apresentar o mapa. A
|
||||
lista continua disponível.{' '}
|
||||
<button
|
||||
className="underline"
|
||||
onClick={() =>
|
||||
setMapAttempt(
|
||||
(value) => value + 1,
|
||||
)
|
||||
}
|
||||
>
|
||||
Tentar novamente
|
||||
</button>
|
||||
</>
|
||||
) : points === null ? (
|
||||
'A carregar o mapa…'
|
||||
) : (
|
||||
`${points.length} ${points.length === 1 ? 'local' : 'locais'} no mapa; ${unlocated.length} ${unlocated.length === 1 ? 'oportunidade' : 'oportunidades'} sem coordenadas confirmadas.`
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
['map', 'combined'].includes(view) &&
|
||||
!error && <Map points={points} areas={areas} />}
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
['map', 'combined'].includes(view) && (
|
||||
<TerritoryGeometryPreview
|
||||
territoryId={
|
||||
form.data.locality_id ||
|
||||
form.data.admin_post_id ||
|
||||
form.data.district_id ||
|
||||
form.data.province_id
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
['map', 'combined'].includes(view) &&
|
||||
!error &&
|
||||
mapContext.length > 0 && (
|
||||
<section
|
||||
>>>>>>> origin/main
|
||||
className={card}
|
||||
aria-label="Estruturas territoriais consultáveis"
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
Estruturas territoriais e projetos
|
||||
</h2>
|
||||
<p>
|
||||
Estas fichas continuam consultáveis
|
||||
independentemente de terem coordenadas. A
|
||||
lista não atribui implantação às
|
||||
oportunidades nem cria pontos no mapa. Até
|
||||
30 fichas por conjunto; refine a localização
|
||||
para pesquisar.
|
||||
</p>
|
||||
<ul>
|
||||
{mapContext.map((record) => (
|
||||
<li key={record.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={record.url}
|
||||
>
|
||||
{record.kind}: {record.title}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
['map', 'combined'].includes(view) &&
|
||||
truncated && (
|
||||
<p role="alert">
|
||||
O mapa atingiu o limite de 1.000 registos;
|
||||
refine os filtros. A cobertura não está
|
||||
completa.
|
||||
</p>
|
||||
)}
|
||||
{!searchLoading &&
|
||||
!searchError &&
|
||||
view === 'map' &&
|
||||
unlocated.length > 0 && (
|
||||
<section
|
||||
className={card}
|
||||
aria-label="Investimentos a georreferenciar"
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
{unlocated.length} investimentos sem
|
||||
coordenadas de local confirmadas
|
||||
</h2>
|
||||
<p>
|
||||
Continuam nos resultados. Seleccionar uma
|
||||
província não determina a posição exacta do
|
||||
investimento.
|
||||
</p>
|
||||
<ul>
|
||||
{unlocated.map((record) => (
|
||||
<li key={record.id}>
|
||||
<Link
|
||||
href={record.url}
|
||||
className="underline"
|
||||
>
|
||||
{record.title}
|
||||
</Link>{' '}
|
||||
—{' '}
|
||||
{record.location ||
|
||||
'Localização por completar'}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{view === 'corridors' && !searchLoading && !searchError && (
|
||||
<OpportunityCorridorGroups
|
||||
groups={corridorGroups}
|
||||
selected={investmentSelection}
|
||||
onSelect={selectInvestment}
|
||||
onClear={() => {
|
||||
setInvestmentSelection([]);
|
||||
sessionStorage.removeItem(
|
||||
'investment-opportunity-selection',
|
||||
);
|
||||
}}
|
||||
onCompare={(ids) =>
|
||||
void api(
|
||||
'/api/v1/investment/compare?' +
|
||||
ids
|
||||
.map((id) => 'ids[]=' + id)
|
||||
.join('&'),
|
||||
)
|
||||
.then((data) => setComparison(data.records))
|
||||
.catch((e) => setError(e.message))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{view !== 'corridors' &&
|
||||
!searchLoading &&
|
||||
!searchError &&
|
||||
(view !== 'map' || error || points?.length === 0) && (
|
||||
<div
|
||||
className={
|
||||
view === 'grid'
|
||||
? 'catalogue-cards catalogue-cards-grid'
|
||||
: 'catalogue-cards catalogue-cards-list'
|
||||
}
|
||||
>
|
||||
{results.data.map((r) => (
|
||||
<article
|
||||
key={r.id}
|
||||
className="catalogue-opportunity"
|
||||
>
|
||||
<div className="catalogue-opportunity-body">
|
||||
<p className="catalogue-sector">
|
||||
{r.sector?.name}
|
||||
</p>
|
||||
<p className="catalogue-location">
|
||||
<MapPin
|
||||
size={15}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span>
|
||||
{r.territorial_summary || [r.province, r.district].filter(Boolean).join(' / ') ||
|
||||
'Localização não indicada'}
|
||||
</span>
|
||||
</p>
|
||||
<h2 className="text-xl font-bold">
|
||||
<Link
|
||||
href={`/oportunidades/${r.slug}${query() ? `?${query()}` : ''}`}
|
||||
>
|
||||
{r.title}
|
||||
</Link>
|
||||
</h2>
|
||||
<p className="catalogue-summary">
|
||||
{r.summary}
|
||||
</p>
|
||||
<div className="catalogue-opportunity-facts">
|
||||
<p className="font-semibold">
|
||||
{money(r)}
|
||||
</p>
|
||||
<p className="catalogue-maturity">
|
||||
{r.proactive
|
||||
? r.proactive.group ===
|
||||
'ideas'
|
||||
? 'Ideia em preparação'
|
||||
: r.proactive
|
||||
.group ===
|
||||
'needs'
|
||||
? 'Necessidade identificada'
|
||||
: 'O que existe'
|
||||
: r.maturity_label}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="catalogue-opportunity-actions">
|
||||
<div className="catalogue-opportunity-links">
|
||||
<Link
|
||||
className="catalogue-detail-link"
|
||||
href={`/oportunidades/${r.slug}${query() ? `?${query()}` : ''}`}
|
||||
>
|
||||
Ver ficha
|
||||
<ArrowUpRight
|
||||
size={16}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Link>
|
||||
<button
|
||||
aria-pressed={saved.includes(
|
||||
r.id,
|
||||
)}
|
||||
className="catalogue-favourite"
|
||||
onClick={() => toggle(r.id)}
|
||||
>
|
||||
<Bookmark
|
||||
size={16}
|
||||
aria-hidden="true"
|
||||
fill={
|
||||
saved.includes(r.id)
|
||||
? 'currentColor'
|
||||
: 'none'
|
||||
}
|
||||
/>
|
||||
{saved.includes(r.id)
|
||||
? 'Retirar favorito'
|
||||
: 'Guardar favorito'}
|
||||
</button>
|
||||
</div>
|
||||
<div className="catalogue-opportunity-choices">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={investmentSelection.includes(
|
||||
r.id,
|
||||
)}
|
||||
onChange={(e) =>
|
||||
selectInvestment(
|
||||
r.id,
|
||||
e.target
|
||||
.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Escolher para preparar
|
||||
investimento
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selected.includes(
|
||||
r.id,
|
||||
)}
|
||||
disabled={
|
||||
!selected.includes(
|
||||
r.id,
|
||||
) &&
|
||||
selected.length >= 4
|
||||
}
|
||||
onChange={(e) =>
|
||||
setSelected(
|
||||
e.target.checked
|
||||
? [
|
||||
...selected,
|
||||
r.id,
|
||||
]
|
||||
: selected.filter(
|
||||
(
|
||||
id,
|
||||
) =>
|
||||
id !==
|
||||
r.id,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
Comparar
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{!searchLoading && !searchError && !results.total && (
|
||||
<p className={card}>
|
||||
Não há oportunidades publicadas com estes filtros no cadastro consultado.
|
||||
A informação disponível pode ser incompleta. Pode{' '}
|
||||
<Link href="/apoio" className="underline">
|
||||
pedir apoio
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
)}
|
||||
<nav
|
||||
aria-label="Paginação"
|
||||
className={
|
||||
view === 'corridors'
|
||||
? 'hidden'
|
||||
: 'catalogue-pagination'
|
||||
}
|
||||
>
|
||||
{results.prev_page_url && (
|
||||
<Link href={results.prev_page_url}>Anterior</Link>
|
||||
)}
|
||||
{results.next_page_url && (
|
||||
<Link href={results.next_page_url}>Seguinte</Link>
|
||||
)}
|
||||
</nav>
|
||||
{selected.length > 0 && (
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
api(
|
||||
'/api/v1/investment/compare?' +
|
||||
selected
|
||||
.map((id) => 'ids[]=' + id)
|
||||
.join('&'),
|
||||
)
|
||||
.then((data) => setComparison(data.records))
|
||||
.catch((e) => setError(e.message))
|
||||
}
|
||||
>
|
||||
Comparar {selected.length} oportunidades
|
||||
</button>
|
||||
)}
|
||||
{view !== 'corridors' && !!investmentSelection.length && (
|
||||
<section className={card}>
|
||||
<p>
|
||||
{investmentSelection.length} oportunidades
|
||||
escolhidas, conservadas ao mudar de página.
|
||||
</p>
|
||||
<Link
|
||||
className={button}
|
||||
href={
|
||||
'/investimentos/iniciar?' +
|
||||
investmentSelection
|
||||
.map((id) => 'opportunities[]=' + id)
|
||||
.join('&')
|
||||
}
|
||||
>
|
||||
Preparar investimento com as oportunidades
|
||||
escolhidas
|
||||
</Link>
|
||||
<button
|
||||
className="ml-4 underline"
|
||||
onClick={() => {
|
||||
setInvestmentSelection([]);
|
||||
sessionStorage.removeItem(
|
||||
'investment-opportunity-selection',
|
||||
);
|
||||
}}
|
||||
>
|
||||
Limpar escolha
|
||||
</button>
|
||||
</section>
|
||||
)}
|
||||
{comparison.length > 0 && (
|
||||
<div ref={comparisonRef} className="overflow-x-auto">
|
||||
<table className="w-full border-collapse text-left">
|
||||
<caption className="p-3 text-left font-bold">
|
||||
Comparação — montantes nas moedas de origem
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="border p-3">Campo</th>
|
||||
{comparison.map(({ record: r }) => (
|
||||
<th
|
||||
key={r.id}
|
||||
className="border p-3"
|
||||
>
|
||||
{r.title}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{[
|
||||
'Sector',
|
||||
'Província',
|
||||
'Investimento',
|
||||
'Maturidade',
|
||||
'Parceria',
|
||||
'Impacto',
|
||||
].map((field, i) => (
|
||||
<tr key={field}>
|
||||
<th className="border p-3">
|
||||
{field}
|
||||
</th>
|
||||
{comparison.map(({ record: r }) => (
|
||||
<td
|
||||
className="border p-3"
|
||||
key={r.id}
|
||||
>
|
||||
{[
|
||||
r.sector?.name,
|
||||
r.province,
|
||||
money(r),
|
||||
r.maturity_label,
|
||||
r.financing_modality,
|
||||
r.expected_impact,
|
||||
][i] || 'Não indicado'}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
{territorial.length > 0 && (
|
||||
<section
|
||||
className="catalogue-territorial"
|
||||
aria-label="Contexto territorial e projectos âncora"
|
||||
>
|
||||
<h2 className="text-2xl font-bold">
|
||||
Contexto territorial e projectos âncora
|
||||
</h2>
|
||||
<p>
|
||||
Fichas do documento de referência; montantes e
|
||||
metas conservam a natureza declarada na fonte.
|
||||
</p>
|
||||
{[
|
||||
{
|
||||
title: 'Corredores',
|
||||
records: territorial.filter(
|
||||
(d) => !d.cluster_id && d.corridor_id,
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Clusters',
|
||||
records: territorial.filter(
|
||||
(d) => d.cluster_id,
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Projectos âncora',
|
||||
records: territorial.filter(
|
||||
(d) => !d.cluster_id && !d.corridor_id,
|
||||
),
|
||||
},
|
||||
]
|
||||
.filter((group) => group.records.length)
|
||||
.map((group) => (
|
||||
<CatalogueFilterGroup
|
||||
key={group.title}
|
||||
title={group.title}
|
||||
count={group.records.length}
|
||||
>
|
||||
<div className="catalogue-territorial-links">
|
||||
{group.records.map((d) => (
|
||||
<Link
|
||||
href={searchTerritoryHref(
|
||||
`/carteira/${d.id}`,
|
||||
page.url,
|
||||
)}
|
||||
key={d.id}
|
||||
className="catalogue-territorial-link"
|
||||
>
|
||||
<span className="text-sm">
|
||||
{d.content.code} ·{' '}
|
||||
{d.cluster_id
|
||||
? 'Cluster'
|
||||
: d.corridor_id
|
||||
? 'Corredor'
|
||||
: 'Projecto âncora'}
|
||||
</span>
|
||||
<h3 className="mt-2 font-semibold">
|
||||
{d.title}
|
||||
</h3>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</CatalogueFilterGroup>
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
<CatalogueGuideLinks articles={guides} />
|
||||
</section>
|
||||
)}
|
||||
<CatalogueGuideLinks articles={guides} />
|
||||
</div>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user