fix: harmonizar pesquisa e navegacao dos catalogos em QA
This commit is contained in:
@@ -6,7 +6,11 @@ import {
|
||||
type TerritoryOption,
|
||||
} from '@/components/investment-territory';
|
||||
import { businessModalities } from './business-types';
|
||||
import { ClassificationSummary, classificationStates, type PublicClassification, type ClassificationOptions } from '@/components/opportunity-classification';
|
||||
import {
|
||||
ClassificationSummary,
|
||||
type PublicClassification,
|
||||
type ClassificationOptions,
|
||||
} from '@/components/opportunity-classification';
|
||||
|
||||
type PublicBusiness = {
|
||||
multidimensional?: PublicClassification[];
|
||||
@@ -57,7 +61,22 @@ export default function BusinessMarketplace({
|
||||
classificationOptions,
|
||||
authorities = [],
|
||||
}: Props) {
|
||||
const [classification, setClassification] = useState<Record<string, string>>(() => Object.fromEntries(['sector', 'association_type', 'association_target', 'association_purpose', 'association_state', 'chain_id', 'authority_id', 'subsector_id'].map((key) => [key, filters[key] ?? ''])));
|
||||
const [classification, setClassification] = useState<
|
||||
Record<string, string>
|
||||
>(() =>
|
||||
Object.fromEntries(
|
||||
[
|
||||
'sector',
|
||||
'association_type',
|
||||
'association_target',
|
||||
'association_purpose',
|
||||
'association_state',
|
||||
'chain_id',
|
||||
'authority_id',
|
||||
'subsector_id',
|
||||
].map((key) => [key, filters[key] ?? '']),
|
||||
),
|
||||
);
|
||||
const [query, setQuery] = useState(filters.q ?? '');
|
||||
const [modality, setModality] = useState(filters.modality ?? '');
|
||||
const [territory, setTerritory] = useState<Record<string, string>>({
|
||||
@@ -124,6 +143,35 @@ export default function BusinessMarketplace({
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
{classificationOptions && (
|
||||
<label className="grid gap-1">
|
||||
<span>Sector</span>
|
||||
<select
|
||||
className={input}
|
||||
value={classification.sector}
|
||||
onChange={(event) =>
|
||||
setClassification((current) => ({
|
||||
...current,
|
||||
sector: event.target.value,
|
||||
subsector_id: '',
|
||||
chain_id: '',
|
||||
}))
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{(classificationOptions.targets.sector ?? []).map(
|
||||
(option) => (
|
||||
<option
|
||||
key={option.id}
|
||||
value={String(option.id)}
|
||||
>
|
||||
{option.label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<TerritoryFields
|
||||
initial={territorySelection}
|
||||
onChange={(path) =>
|
||||
@@ -135,22 +183,109 @@ export default function BusinessMarketplace({
|
||||
})
|
||||
}
|
||||
/>
|
||||
{classificationOptions && <fieldset className="w-full rounded border p-3">
|
||||
<legend>Classificação multidimensional — filtros combinados</legend>
|
||||
<p>Critérios diferentes combinam-se por «e». Tipo, referência, finalidade e estado têm de corresponder à mesma relação pública. O setor principal mantém o seu significado.</p>
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{([
|
||||
['sector', 'Setor principal do anúncio', classificationOptions.targets.sector ?? []],
|
||||
['association_type', 'Tipo de associação', Object.keys(classificationOptions.types).map((id) => ({ id, label: ({ corridor: 'Corredor', location: 'Localização', cluster: 'Cluster', project: 'Projeto âncora', chain: 'Cadeia de valor', park: 'Parque industrial', zone: 'Regime de zona', sector: 'Setor associado', activity: 'Subsector ou atividade' } as Record<string, string>)[id] ?? id }))],
|
||||
['association_target', 'Referência da associação', classificationOptions.targets[classification.association_type] ?? []],
|
||||
['association_purpose', 'Finalidade', Object.entries(classificationOptions.purposes).map(([id, label]) => ({ id, label }))],
|
||||
['association_state', 'Estado da associação', Object.entries(classificationStates).filter(([id]) => !['archived', 'revoked'].includes(id)).map(([id, label]) => ({ id, label }))],
|
||||
['chain_id', 'Cadeia de valor', classificationOptions.targets.chain ?? []],
|
||||
['subsector_id', 'Subsector ou atividade', classificationOptions.targets.activity ?? []],
|
||||
['authority_id', 'Entidade competente', authorities.map((a) => ({ id: a.id, label: a.label_pt_mz }))],
|
||||
] as [string, string, { id: string | number; label: string }[]][]).map(([key, label, options]) => <label key={key} className="grid gap-1"><span>{label}</span><select className={input} value={classification[key]} onChange={(e) => setClassification((old) => ({ ...old, [key]: e.target.value, ...(key === 'association_type' ? { association_target: '' } : {}) }))}><option value="">Todos</option>{options.map((o) => <option key={o.id} value={String(o.id)}>{o.label}</option>)}</select></label>)}
|
||||
</div>
|
||||
</fieldset>}
|
||||
{classificationOptions && (
|
||||
<details className="w-full rounded border p-3">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
Mais filtros
|
||||
</summary>
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{(
|
||||
[
|
||||
[
|
||||
'association_type',
|
||||
'Tipo de associação',
|
||||
Object.keys(
|
||||
classificationOptions.types,
|
||||
).map((id) => ({
|
||||
id,
|
||||
label:
|
||||
(
|
||||
{
|
||||
corridor: 'Corredor',
|
||||
location: 'Localização',
|
||||
cluster: 'Cluster',
|
||||
project:
|
||||
'Projeto âncora',
|
||||
chain: 'Cadeia de valor',
|
||||
park: 'Parque industrial',
|
||||
zone: 'Regime de zona',
|
||||
sector: 'Setor associado',
|
||||
activity:
|
||||
'Subsector ou atividade',
|
||||
} as Record<string, string>
|
||||
)[id] ?? id,
|
||||
})),
|
||||
],
|
||||
[
|
||||
'association_target',
|
||||
'Referência da associação',
|
||||
classificationOptions.targets[
|
||||
classification.association_type
|
||||
] ?? [],
|
||||
],
|
||||
[
|
||||
'association_purpose',
|
||||
'Finalidade',
|
||||
Object.entries(
|
||||
classificationOptions.purposes,
|
||||
).map(([id, label]) => ({ id, label })),
|
||||
],
|
||||
[
|
||||
'chain_id',
|
||||
'Cadeia de valor',
|
||||
classificationOptions.targets.chain ??
|
||||
[],
|
||||
],
|
||||
[
|
||||
'subsector_id',
|
||||
'Subsector ou atividade',
|
||||
classificationOptions.targets
|
||||
.activity ?? [],
|
||||
],
|
||||
[
|
||||
'authority_id',
|
||||
'Entidade competente',
|
||||
authorities.map((a) => ({
|
||||
id: a.id,
|
||||
label: a.label_pt_mz,
|
||||
})),
|
||||
],
|
||||
] as [
|
||||
string,
|
||||
string,
|
||||
{ id: string | number; label: string }[],
|
||||
][]
|
||||
).map(([key, label, options]) => (
|
||||
<label key={key} className="grid gap-1">
|
||||
<span>{label}</span>
|
||||
<select
|
||||
className={input}
|
||||
value={classification[key]}
|
||||
onChange={(e) =>
|
||||
setClassification((old) => ({
|
||||
...old,
|
||||
[key]: e.target.value,
|
||||
...(key === 'association_type'
|
||||
? { association_target: '' }
|
||||
: {}),
|
||||
}))
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{options.map((o) => (
|
||||
<option
|
||||
key={o.id}
|
||||
value={String(o.id)}
|
||||
>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
<p role="status">
|
||||
@@ -192,7 +327,11 @@ export default function BusinessMarketplace({
|
||||
{record.amount_max ?? '—'} {record.currency}
|
||||
</p>
|
||||
)}
|
||||
{!!record.multidimensional?.length && <ClassificationSummary rows={record.multidimensional} />}
|
||||
{!!record.multidimensional?.length && (
|
||||
<ClassificationSummary
|
||||
rows={record.multidimensional}
|
||||
/>
|
||||
)}
|
||||
{record.objective && (
|
||||
<p className="mt-3 line-clamp-3">
|
||||
{record.objective}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -110,7 +110,10 @@ export default function Detail({
|
||||
Preparar manifestação de interesse
|
||||
</button>
|
||||
) : (
|
||||
<Link className={button} href={`/participar/entrar?return=${encodeURIComponent(page.url)}`}>
|
||||
<Link
|
||||
className={button}
|
||||
href={`/participar/entrar?return=${encodeURIComponent(page.url)}`}
|
||||
>
|
||||
Entrar para preparar manifestação
|
||||
</Link>
|
||||
)}
|
||||
@@ -182,9 +185,9 @@ export default function Detail({
|
||||
['Investimento', money(r)],
|
||||
['Maturidade', r.maturity_label],
|
||||
[
|
||||
'Catálogo de maturidade',
|
||||
'Classificação da preparação',
|
||||
r.maturity_catalogue_version === 'spec-v2'
|
||||
? 'Oito etapas (V2)'
|
||||
? 'Etapas de preparação'
|
||||
: r.maturity_catalogue_version === 'legacy-v1'
|
||||
? 'Histórico — seis níveis'
|
||||
: 'Versão não registada',
|
||||
|
||||
@@ -23,6 +23,7 @@ export type Entity = {
|
||||
geography?: StructureGeography | null;
|
||||
};
|
||||
export type References = {
|
||||
preparationOptions?: { value: string; label: string; group: string }[];
|
||||
classification?: import('@/components/opportunity-classification').ClassificationOptions;
|
||||
authorities?: { id: string; label_pt_mz: string }[];
|
||||
categories?: string[];
|
||||
|
||||
@@ -3,7 +3,8 @@ import ParkDetailsEditor, {
|
||||
emptyParkDetails,
|
||||
type ParkDetails,
|
||||
} from '@/components/investment-zone-operational-details';
|
||||
import { Link, router, useForm } from '@inertiajs/react';
|
||||
import { Link, router, useForm, usePage } from '@inertiajs/react';
|
||||
import { catalogueReturnHref } from '@/lib/catalogue-context';
|
||||
import InvestmentTerritory from '@/components/investment-territory';
|
||||
import InvestmentMapPanel from '@/components/investment-map-panel';
|
||||
import {
|
||||
@@ -276,6 +277,7 @@ function Editor({
|
||||
attachments,
|
||||
opportunities,
|
||||
}: Props) {
|
||||
const pageUrl = usePage().url;
|
||||
const [message, setMessage] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [locationPath, setLocationPath] = useState<TerritoryOption[]>([]);
|
||||
@@ -347,14 +349,27 @@ function Editor({
|
||||
}
|
||||
return (
|
||||
<Frame title={z.name}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueReturnHref(
|
||||
management ? '/management/investment/zones' : '/zonas',
|
||||
pageUrl,
|
||||
)}
|
||||
>
|
||||
Voltar à pesquisa
|
||||
</Link>
|
||||
<TerritorialSources sources={territorialSources} />
|
||||
{!management && z.category === 'industrial_park' && (
|
||||
<ParkDetailsPublic value={z.operational_details_public} />
|
||||
)}
|
||||
{!management && <PartnershipSourceLinks type="zone" id={z.id} />}
|
||||
<p>
|
||||
{z.code} · {z.category.toUpperCase()} · {z.validation_status} ·{' '}
|
||||
{z.province} {z.district}
|
||||
{z.code} ·{' '}
|
||||
{z.category === 'industrial_park'
|
||||
? 'Parque industrial'
|
||||
: z.category.toUpperCase()}{' '}
|
||||
{management && `· ${z.validation_status}`} · {z.province}{' '}
|
||||
{z.district}
|
||||
</p>
|
||||
<p>
|
||||
A ficha é informativa. A associação territorial não atribui
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
@@ -481,32 +481,6 @@ export default function Services(p: Props) {
|
||||
p.resources?.data.findIndex((resource) =>
|
||||
formTypes.includes(resource.document_type),
|
||||
) ?? -1;
|
||||
const activeFilterNames: Record<string, string> = {
|
||||
q: 'Texto',
|
||||
topic: 'Assunto',
|
||||
category: 'Categoria',
|
||||
document_type: 'Tipo',
|
||||
activity: 'Actividade',
|
||||
stage: 'Etapa',
|
||||
module: 'Módulo',
|
||||
issuer: 'Emitente',
|
||||
language: 'Idioma',
|
||||
legal_status: 'Situação',
|
||||
source_confirmation: 'Fonte',
|
||||
territory_id: 'Território',
|
||||
};
|
||||
const activeFilters = Object.entries(filter.data).flatMap(
|
||||
([key, value]) => {
|
||||
const text = Array.isArray(value)
|
||||
? value.join(', ')
|
||||
: typeof value === 'string'
|
||||
? value
|
||||
: '';
|
||||
return activeFilterNames[key] && text.trim()
|
||||
? [`${activeFilterNames[key]}: ${text}`]
|
||||
: [];
|
||||
},
|
||||
);
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 text-slate-900">
|
||||
<Head title={title} />
|
||||
@@ -677,63 +651,80 @@ export default function Services(p: Props) {
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block min-w-0">
|
||||
Tema
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.topic}
|
||||
onChange={(e) =>
|
||||
filter.setData('topic', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.topics?.map((topic) => (
|
||||
<option key={topic}>{topic}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block min-w-0">
|
||||
Categoria
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.category}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'category',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.categories?.map((category) => (
|
||||
<option key={category} value={category}>
|
||||
{documentTypeLabels[category] ??
|
||||
category}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block min-w-0">
|
||||
Tipo documental
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.document_type}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'document_type',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.documentTypes?.map((type) => (
|
||||
<option key={type} value={type}>
|
||||
{documentTypeLabels[type] ??
|
||||
'Documento'}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{!!(p.topics?.length || filter.data.topic) && (
|
||||
<label className="block min-w-0">
|
||||
Tema
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.topic}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'topic',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.topics?.map((topic) => (
|
||||
<option key={topic}>{topic}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{!!(
|
||||
p.categories?.length || filter.data.category
|
||||
) && (
|
||||
<label className="block min-w-0">
|
||||
Categoria
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.category}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'category',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.categories?.map((category) => (
|
||||
<option
|
||||
key={category}
|
||||
value={category}
|
||||
>
|
||||
{documentTypeLabels[category] ??
|
||||
category}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{!!(
|
||||
p.documentTypes?.length ||
|
||||
filter.data.document_type
|
||||
) && (
|
||||
<label className="block min-w-0">
|
||||
Tipo documental
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.document_type}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'document_type',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.documentTypes?.map((type) => (
|
||||
<option key={type} value={type}>
|
||||
{documentTypeLabels[type] ??
|
||||
'Documento'}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{!!p.activities?.length && (
|
||||
<fieldset className="min-w-0 rounded border p-3">
|
||||
<legend className="px-1">
|
||||
@@ -866,62 +857,78 @@ export default function Services(p: Props) {
|
||||
</div>
|
||||
</fieldset>
|
||||
)}
|
||||
<label className="block min-w-0">
|
||||
Entidade emitente
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.issuer}
|
||||
onChange={(e) =>
|
||||
filter.setData('issuer', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.issuers?.map((issuer) => (
|
||||
<option key={issuer}>{issuer}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block min-w-0">
|
||||
Idioma
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.language}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'language',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.languages?.map((language) => (
|
||||
<option key={language}>
|
||||
{language}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block min-w-0">
|
||||
Situação jurídica indicada
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.legal_status}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'legal_status',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.legalStatuses?.map((status) => (
|
||||
<option key={status} value={status}>
|
||||
{legalStatusLabels[status] ??
|
||||
'Por confirmar'}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{!!(p.issuers?.length || filter.data.issuer) && (
|
||||
<label className="block min-w-0">
|
||||
Entidade emitente
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.issuer}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'issuer',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.issuers?.map((issuer) => (
|
||||
<option key={issuer}>
|
||||
{issuer}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{!!(
|
||||
p.languages?.length || filter.data.language
|
||||
) && (
|
||||
<label className="block min-w-0">
|
||||
Idioma
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.language}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'language',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{p.languages?.map((language) => (
|
||||
<option key={language}>
|
||||
{language}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{!!(
|
||||
p.legalStatuses?.length ||
|
||||
filter.data.legal_status
|
||||
) && (
|
||||
<label className="block min-w-0">
|
||||
Situação jurídica indicada
|
||||
<select
|
||||
className={input}
|
||||
value={filter.data.legal_status}
|
||||
onChange={(e) =>
|
||||
filter.setData(
|
||||
'legal_status',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todas</option>
|
||||
{p.legalStatuses?.map((status) => (
|
||||
<option key={status} value={status}>
|
||||
{legalStatusLabels[status] ??
|
||||
'Por confirmar'}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<label className="block min-w-0">
|
||||
Confirmação da fonte
|
||||
<select
|
||||
@@ -985,30 +992,6 @@ export default function Services(p: Props) {
|
||||
Limpar filtros
|
||||
</Link>
|
||||
</form>
|
||||
{activeFilters.length > 0 && (
|
||||
<section
|
||||
aria-label="Filtros activos"
|
||||
className="rounded border bg-white p-3"
|
||||
>
|
||||
<h2 className="font-semibold">
|
||||
Filtros activos
|
||||
</h2>
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{activeFilters.map((item) => (
|
||||
<li
|
||||
key={item}
|
||||
className="rounded-full bg-slate-100 px-3 py-1 text-sm"
|
||||
>
|
||||
{item}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
<p role="status" aria-live="polite">
|
||||
{p.resources?.total ?? 0} documentos correspondem
|
||||
aos filtros activos.
|
||||
</p>
|
||||
{!!p.topics?.length && (
|
||||
<nav
|
||||
aria-label="Navegar por assunto"
|
||||
@@ -1307,16 +1290,6 @@ export default function Services(p: Props) {
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
<footer className="border-t px-5 py-8 text-center text-sm">
|
||||
Investe Moçambique ·{' '}
|
||||
<Link href="/apoio" className="underline">
|
||||
Apoio ao Investidor
|
||||
</Link>{' '}
|
||||
·{' '}
|
||||
<Link href="/documentos" className="underline">
|
||||
Documentos e Formulários
|
||||
</Link>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { catalogueDetailHref } from '@/lib/catalogue-context';
|
||||
import { Management } from '../management/shared';
|
||||
import type { Paginated } from '../management/shared';
|
||||
import { Layout, Field, control, button, Pagination, kind } from './shared';
|
||||
@@ -102,7 +103,14 @@ export default function Index({
|
||||
<h2 className="text-xl font-semibold">
|
||||
<Link
|
||||
className="underline"
|
||||
href={`${base}/${r.id}`}
|
||||
href={catalogueDetailHref(
|
||||
`${base}/${r.id}`,
|
||||
new URLSearchParams(
|
||||
Object.entries(filters).filter(
|
||||
([, value]) => Boolean(value),
|
||||
) as [string, string][],
|
||||
).toString(),
|
||||
)}
|
||||
>
|
||||
{r.title}
|
||||
</Link>
|
||||
@@ -126,9 +134,28 @@ export default function Index({
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<Link className="underline" href={`${base}/${r.id}`}>
|
||||
Explorar relações e próximos passos
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueDetailHref(
|
||||
`${base}/${r.id}`,
|
||||
new URLSearchParams(
|
||||
Object.entries(filters).filter(
|
||||
([, value]) => Boolean(value),
|
||||
) as [string, string][],
|
||||
).toString(),
|
||||
)}
|
||||
>
|
||||
Consultar ficha
|
||||
</Link>
|
||||
{!management &&
|
||||
(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! })}`}
|
||||
>
|
||||
Ver oportunidades associadas
|
||||
</Link>
|
||||
)}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Head, Link, usePage } from '@inertiajs/react';
|
||||
import { Head, usePage } from '@inertiajs/react';
|
||||
import type { ReactNode } from 'react';
|
||||
export { button, control, Field, Pagination } from '../management/shared';
|
||||
export type Dossier = {
|
||||
@@ -47,16 +47,6 @@ export function Layout({
|
||||
return (
|
||||
<Container className="mx-auto w-full max-w-6xl min-w-0 space-y-6 p-4 break-words md:p-8">
|
||||
<Head title={title} />
|
||||
<nav
|
||||
className="flex flex-wrap gap-5 text-sm underline"
|
||||
aria-label="Investimento"
|
||||
>
|
||||
<Link href="/">InvestMoz</Link>
|
||||
<Link href="/carteira?kind=corridor">Corredores</Link>
|
||||
<Link href="/carteira?kind=cluster">Clusters</Link>
|
||||
<Link href="/carteira?kind=project">Projectos âncora</Link>
|
||||
<Link href="/investidor">O meu painel</Link>
|
||||
</nav>
|
||||
<h1 className="text-3xl font-semibold">{title}</h1>
|
||||
{flash?.success && (
|
||||
<p role="status" className="rounded border p-3">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Link, useForm, router, usePage } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { catalogueReturnHref } from '@/lib/catalogue-context';
|
||||
import InvestmentMapPanel from '@/components/investment-map-panel';
|
||||
import StructureGeographyPanel, {
|
||||
type StructureGeography,
|
||||
@@ -76,8 +77,15 @@ function Editor({
|
||||
const save = useForm({ origin_id: origin?.id ?? null });
|
||||
const Frame = management ? Management : Layout;
|
||||
const base = management ? '/management/portfolio' : '/carteira';
|
||||
const pageUrl = usePage().url;
|
||||
return (
|
||||
<Frame title={record.title}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={catalogueReturnHref(base, pageUrl)}
|
||||
>
|
||||
Voltar à pesquisa
|
||||
</Link>
|
||||
<p>
|
||||
{kind(record)} · {record.content.code}
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user