fix: harmonizar pesquisa e navegacao dos catalogos em QA
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import InvestmentZoneInstallation, { type ParkInstallationPlan } from '@/components/investment-zone-installation';
|
||||
import InvestmentZoneInstallation, {
|
||||
type ParkInstallationPlan,
|
||||
} from '@/components/investment-zone-installation';
|
||||
import { Link, router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { catalogueDetailHref } from '@/lib/catalogue-context';
|
||||
import {
|
||||
TerritoryFields,
|
||||
type TerritoryOption,
|
||||
@@ -41,7 +44,22 @@ type Zone = {
|
||||
scope_type: string;
|
||||
}[];
|
||||
};
|
||||
const parkLabels: Record<string,string> = { pending:'Por confirmar', general:'Geral', not_applicable:'Não aplicável', unknown:'Não informado', not_informed:'Não informada', announced:'Anunciado', planned:'Planeado', in_development:'Em desenvolvimento', partially_operational:'Parcialmente operacional', operational:'Operacional segundo o cadastro', suspended:'Suspenso', confirmed:'Confirmada segundo o cadastro', unavailable:'Indisponível', reported_unverified:'Declarada, não confirmada' };
|
||||
const parkLabels: Record<string, string> = {
|
||||
pending: 'Por confirmar',
|
||||
general: 'Geral',
|
||||
not_applicable: 'Não aplicável',
|
||||
unknown: 'Não informado',
|
||||
not_informed: 'Não informada',
|
||||
announced: 'Anunciado',
|
||||
planned: 'Planeado',
|
||||
in_development: 'Em desenvolvimento',
|
||||
partially_operational: 'Parcialmente operacional',
|
||||
operational: 'Operacional segundo o cadastro',
|
||||
suspended: 'Suspenso',
|
||||
confirmed: 'Confirmada segundo o cadastro',
|
||||
unavailable: 'Indisponível',
|
||||
reported_unverified: 'Declarada, não confirmada',
|
||||
};
|
||||
export default function Zones({
|
||||
installation,
|
||||
detailsInstallation,
|
||||
@@ -105,33 +123,57 @@ export default function Zones({
|
||||
: 'ZEE, ZFI e parques industriais'
|
||||
}
|
||||
>
|
||||
{management && installation && <InvestmentZoneInstallation initial={installation} />}
|
||||
{management && detailsInstallation && <InvestmentZoneInstallation initial={detailsInstallation} endpoint="/management/investment/zones/operational-install" title="Complemento operacional L1 dos parques" summary="Uma coluna de detalhes, com dados privados cifrados e projeção pública separada. Sem importação ou publicação de fichas." />}
|
||||
{management && installation && (
|
||||
<InvestmentZoneInstallation initial={installation} />
|
||||
)}
|
||||
{management && detailsInstallation && (
|
||||
<InvestmentZoneInstallation
|
||||
initial={detailsInstallation}
|
||||
endpoint="/management/investment/zones/operational-install"
|
||||
title="Complemento operacional L1 dos parques"
|
||||
summary="Uma coluna de detalhes, com dados privados cifrados e projeção pública separada. Sem importação ou publicação de fichas."
|
||||
/>
|
||||
)}
|
||||
<p>
|
||||
A informação territorial não atribui benefícios nem substitui
|
||||
certificados ou decisões das entidades competentes.
|
||||
</p>
|
||||
<nav
|
||||
aria-label="Dimensões de investimento"
|
||||
className="flex flex-wrap gap-4 underline"
|
||||
<details className="rounded border p-3">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
Catálogos relacionados
|
||||
</summary>
|
||||
<nav
|
||||
aria-label="Dimensões de investimento"
|
||||
className="flex flex-wrap gap-4 underline"
|
||||
>
|
||||
<Link href="/clusters">Por Cluster</Link>
|
||||
<Link href="/corredores">Por Corredor</Link>
|
||||
<Link href="/zonas?category=zee">Por ZEE</Link>
|
||||
<Link href="/zonas?category=zfi">Por ZFI</Link>
|
||||
<Link href="/zonas?category=industrial_park">
|
||||
Parques industriais
|
||||
</Link>
|
||||
</nav>
|
||||
</details>
|
||||
<form
|
||||
method="get"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const url = new URL(form.action);
|
||||
const params = new URLSearchParams();
|
||||
for (const [name, value] of new FormData(form))
|
||||
if (typeof value === 'string')
|
||||
params.append(name, value);
|
||||
url.search = params.toString();
|
||||
router.get(
|
||||
url.toString(),
|
||||
{},
|
||||
{ preserveState: true, preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
className={card + ' grid gap-4 md:grid-cols-3'}
|
||||
>
|
||||
<Link href="/clusters">Por Cluster</Link>
|
||||
<Link href="/corredores">Por Corredor</Link>
|
||||
<Link href="/zonas?category=zee">Por ZEE</Link>
|
||||
<Link href="/zonas?category=zfi">Por ZFI</Link>
|
||||
<Link href="/zonas?category=industrial_park">
|
||||
Parques industriais
|
||||
</Link>
|
||||
</nav>
|
||||
<form method="get" onSubmit={event => {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const url = new URL(form.action);
|
||||
const params = new URLSearchParams();
|
||||
for (const [name, value] of new FormData(form)) if (typeof value === 'string') params.append(name, value);
|
||||
url.search = params.toString();
|
||||
router.get(url.toString(), {}, {preserveState: true, preserveScroll: true});
|
||||
}} className={card + ' grid gap-4 md:grid-cols-3'}>
|
||||
<Field label="Pesquisar por nome ou código">
|
||||
<input
|
||||
className={input}
|
||||
@@ -251,8 +293,7 @@ export default function Zones({
|
||||
)}
|
||||
{!records.total && (
|
||||
<p className={card}>
|
||||
Sem registos disponíveis para estes filtros. As zonas
|
||||
aguardam cadastro e validação documental.
|
||||
Não foram encontrados resultados para esta pesquisa.
|
||||
</p>
|
||||
)}
|
||||
{records.data.map((zone) => (
|
||||
@@ -260,11 +301,31 @@ export default function Zones({
|
||||
<h2 className="text-xl font-bold">
|
||||
<Link
|
||||
className="underline"
|
||||
href={`${management ? '/management/investment/zones' : '/zonas'}/${zone.id}`}
|
||||
href={catalogueDetailHref(
|
||||
`${management ? '/management/investment/zones' : '/zonas'}/${zone.id}`,
|
||||
exportParams.toString(),
|
||||
)}
|
||||
>
|
||||
{zone.name}
|
||||
</Link>
|
||||
</h2>
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`${management ? '/management/investment/zones' : '/zonas'}/${zone.id}`,
|
||||
exportParams.toString(),
|
||||
)}
|
||||
>
|
||||
Consultar ficha
|
||||
</Link>
|
||||
{!management && (
|
||||
<Link
|
||||
className="ml-4 underline"
|
||||
href={`/oportunidades?${new URLSearchParams({ [zone.category === 'zee' ? 'zee_id' : zone.category === 'zfi' ? 'zfi_id' : 'park_id']: zone.id })}`}
|
||||
>
|
||||
Ver oportunidades associadas
|
||||
</Link>
|
||||
)}
|
||||
<p>
|
||||
{zone.code} · {zone.category.toUpperCase()} ·{' '}
|
||||
{[zone.district, zone.province]
|
||||
@@ -273,19 +334,29 @@ export default function Zones({
|
||||
</p>
|
||||
{zone.legal_regime && (
|
||||
<p>
|
||||
Regime jurídico: {zone.category === 'industrial_park' ? (parkLabels[zone.legal_regime] ?? zone.legal_regime.toUpperCase()) : zone.legal_regime.toUpperCase()}
|
||||
Regime jurídico:{' '}
|
||||
{zone.category === 'industrial_park'
|
||||
? (parkLabels[zone.legal_regime] ??
|
||||
zone.legal_regime.toUpperCase())
|
||||
: zone.legal_regime.toUpperCase()}
|
||||
</p>
|
||||
)}
|
||||
{zoneExtensionsAvailable && zone.development_status && (
|
||||
<p>
|
||||
Desenvolvimento:{' '}
|
||||
{zone.category === 'industrial_park' ? (parkLabels[zone.development_status] ?? 'Por confirmar') : zone.development_status.replaceAll('_', ' ')}
|
||||
{zone.category === 'industrial_park'
|
||||
? (parkLabels[zone.development_status] ??
|
||||
'Por confirmar')
|
||||
: zone.development_status.replaceAll('_', ' ')}
|
||||
</p>
|
||||
)}
|
||||
{zoneExtensionsAvailable && zone.availability_status && (
|
||||
<p>
|
||||
Disponibilidade para instalação:{' '}
|
||||
{zone.category === 'industrial_park' ? (parkLabels[zone.availability_status] ?? 'Não informada') : zone.availability_status.replaceAll('_', ' ')}
|
||||
{zone.category === 'industrial_park'
|
||||
? (parkLabels[zone.availability_status] ??
|
||||
'Não informada')
|
||||
: zone.availability_status.replaceAll('_', ' ')}
|
||||
</p>
|
||||
)}
|
||||
{zone.area_value && (
|
||||
@@ -334,7 +405,15 @@ export default function Zones({
|
||||
))}
|
||||
</p>
|
||||
)}
|
||||
{zone.category === 'industrial_park' && <p>{zone.resources?.length ? `${zone.resources.length} recursos descritos; consulte o âmbito e a fonte na ficha.` : 'Infraestruturas, serviços, acessos e capacidades: não informados.'} {!zone.activities?.length && 'Atividades: não informadas.'}</p>}
|
||||
{zone.category === 'industrial_park' && (
|
||||
<p>
|
||||
{zone.resources?.length
|
||||
? `${zone.resources.length} recursos descritos; consulte o âmbito e a fonte na ficha.`
|
||||
: 'Infraestruturas, serviços, acessos e capacidades: não informados.'}{' '}
|
||||
{!zone.activities?.length &&
|
||||
'Atividades: não informadas.'}
|
||||
</p>
|
||||
)}
|
||||
<p>{zone.description}</p>
|
||||
<p>Validação: {zone.validation_status}</p>
|
||||
{management && (
|
||||
|
||||
Reference in New Issue
Block a user