Reconciliar fontes instaladas 423bd512d8c5 com main
This commit is contained in:
@@ -1,11 +1,2 @@
|
||||
export default function AppLogo() {
|
||||
return (
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="h-8 w-auto max-w-full object-contain group-data-[collapsible=icon]:h-auto group-data-[collapsible=icon]:w-8"
|
||||
/>
|
||||
);
|
||||
}
|
||||
import PortalProductIdentity from '@/components/portal-product-identity';
|
||||
export default function AppLogo() { return <PortalProductIdentity />; }
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import type { ContextReference } from '@/lib/investor-context';
|
||||
|
||||
export default function ContextDocuments({
|
||||
source,
|
||||
}: {
|
||||
source?: ContextReference;
|
||||
}) {
|
||||
if (!source) return null;
|
||||
return (
|
||||
<section
|
||||
aria-label="Fonte e documentos do contexto"
|
||||
className="space-y-2 rounded border p-4"
|
||||
>
|
||||
<h2 className="font-semibold">Fonte e documentos do contexto</h2>
|
||||
<p>
|
||||
<Link className="underline" href={source.href}>
|
||||
{source.title}
|
||||
</Link>{' '}
|
||||
· versão da oportunidade {source.version ?? 'não indicada'} ·{' '}
|
||||
{source.visibility === 'private'
|
||||
? 'Preparação privada — não publicada'
|
||||
: 'Referência pública'}
|
||||
</p>
|
||||
{(source.documents ?? []).map((doc) => (
|
||||
<article
|
||||
key={doc.support_id}
|
||||
className="space-y-1 rounded border p-3"
|
||||
>
|
||||
<p>
|
||||
{doc.title} · {doc.edition ?? 'Edição não indicada'} ·
|
||||
versão documental {doc.document_version} · metadados v
|
||||
{doc.metadata_version}
|
||||
</p>
|
||||
<p className="break-all">SHA256: {doc.sha256}</p>
|
||||
{doc.section && <p>Referência utilizada: {doc.section}</p>}
|
||||
<p>{doc.source_reference}</p>
|
||||
<a className="underline" href={doc.download_url}>
|
||||
Consultar original autorizado —{' '}
|
||||
{doc.edition ?? doc.title}
|
||||
</a>
|
||||
</article>
|
||||
))}
|
||||
{!source.documents?.length && (
|
||||
<p>Sem suporte da biblioteca associado nesta versão.</p>
|
||||
)}
|
||||
<p>
|
||||
Referência guardada nesta versão do dossier. A consulta do
|
||||
original continua sujeita às permissões actuais; esta ligação
|
||||
não publica nem concede acesso adicional.
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -50,6 +50,7 @@ export default function CountrySelect({
|
||||
onChange={(event) => setSearch(event.target.value)}
|
||||
placeholder="Pesquisar nome ou código do país"
|
||||
/>
|
||||
{search.trim() && <p role="status" aria-live="polite">{matches.length ? `${matches.length} resultados encontrados` : "Não foram encontrados resultados para esta pesquisa"}</p>}
|
||||
<select
|
||||
disabled={disabled}
|
||||
id={id ?? generatedId}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import SearchState from '@/components/search-state';
|
||||
import { useEffect, useState } from 'react';
|
||||
import TerritoryGeometryPreview from './territory-geometry-preview';
|
||||
import InteractiveInvestmentMap, {
|
||||
@@ -18,11 +19,12 @@ export default function InvestmentMapPanel({
|
||||
{ id: number; title: string; url: string }[]
|
||||
>([]);
|
||||
const [error, setError] = useState('');
|
||||
const [retry, setRetry] = useState(0);
|
||||
const [areas, setAreas] = useState<InvestmentMapArea[]>([]);
|
||||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
const params = new URLSearchParams(JSON.parse(key));
|
||||
setPoints(null);
|
||||
setPoints(null); setError(''); setMissing([]);
|
||||
setAreas([]);
|
||||
fetch(`/api/v1/investment/map?${params}`, {
|
||||
signal: controller.signal,
|
||||
@@ -43,14 +45,14 @@ export default function InvestmentMapPanel({
|
||||
: '',
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
if (!controller.signal.aborted) setError(e.message);
|
||||
.catch(() => {
|
||||
if (!controller.signal.aborted) setError('Não foi possível concluir a pesquisa.');
|
||||
});
|
||||
return () => controller.abort();
|
||||
}, [key]);
|
||||
}, [key, retry]);
|
||||
return (
|
||||
<section className="space-y-3">
|
||||
{error && <p role="alert">{error}</p>}
|
||||
<SearchState loading={points === null && !error} error={error} total={(points?.length ?? 0) + missing.length} retry={() => setRetry(value => value + 1)} />
|
||||
<InteractiveInvestmentMap points={points} areas={areas} />
|
||||
<TerritoryGeometryPreview
|
||||
territoryId={
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import SearchState from '@/components/search-state';
|
||||
import { useEffect, useId, useState } from 'react';
|
||||
import { api } from '@/pages/investment/shared';
|
||||
import { replaceTerritoryPath } from '@/lib/territory-path.js';
|
||||
@@ -110,12 +111,10 @@ export function ProvinceSelect({
|
||||
.then((data) => {
|
||||
if (!controller.signal.aborted) setOptions(data.data);
|
||||
})
|
||||
.catch((cause) => {
|
||||
.catch(() => {
|
||||
if (!controller.signal.aborted)
|
||||
setError(
|
||||
cause instanceof Error
|
||||
? cause.message
|
||||
: 'Erro de ligação.',
|
||||
'Não foi possível concluir a pesquisa.',
|
||||
);
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -131,6 +130,7 @@ export function ProvinceSelect({
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchState loading={loading} error={error} total={options.length} retry={() => setRetry(value => value + 1)} />
|
||||
<input
|
||||
className={className}
|
||||
aria-label={`Pesquisar ${label}`}
|
||||
@@ -162,17 +162,6 @@ export function ProvinceSelect({
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{error && (
|
||||
<span role="alert" className="block text-sm">
|
||||
{error}{' '}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setRetry((current) => current + 1)}
|
||||
>
|
||||
Tentar novamente
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
{geometryFeedback && <p role="status">{geometryFeedback}</p>}
|
||||
<TerritoryGeometryPreview
|
||||
territoryId={
|
||||
@@ -309,10 +298,10 @@ export function TerritoryLevel({
|
||||
if (controller.signal.aborted) return;
|
||||
setOptions(data.data);
|
||||
setMore(Boolean(data.next_page_url));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
if (!controller.signal.aborted)
|
||||
setError(
|
||||
e instanceof Error ? e.message : 'Erro de ligação.',
|
||||
'Não foi possível concluir a pesquisa.',
|
||||
);
|
||||
} finally {
|
||||
if (!controller.signal.aborted) setLoading(false);
|
||||
@@ -325,6 +314,7 @@ export function TerritoryLevel({
|
||||
}, [index, parent, page, enabled, endpoint, retry, search]);
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{enabled && <SearchState loading={loading} error={error} total={options.length} retry={() => setRetry(value => value + 1)} />}
|
||||
<label htmlFor={id} className="font-medium">
|
||||
{labels[index]}
|
||||
</label>
|
||||
@@ -370,22 +360,11 @@ export function TerritoryLevel({
|
||||
))}
|
||||
</select>
|
||||
{loading && <p role="status">A carregar…</p>}
|
||||
{error && (
|
||||
<div role="alert">
|
||||
{error}{' '}
|
||||
<button type="button" onClick={() => setRetry(retry + 1)}>
|
||||
Tentar novamente
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{fieldError && (
|
||||
<p id={`${id}-error`} role="alert">
|
||||
{fieldError}
|
||||
</p>
|
||||
)}
|
||||
{enabled && !loading && !error && options.length === 0 && (
|
||||
<p className="text-sm">Sem opções para esta pesquisa.</p>
|
||||
)}
|
||||
<div className="flex gap-3 text-sm">
|
||||
{page > 1 && (
|
||||
<button type="button" onClick={() => setPage(page - 1)}>
|
||||
|
||||
@@ -72,7 +72,7 @@ const labels: Record<string, string> = {
|
||||
location_mode: 'Uma ou várias localizações',
|
||||
geographic_scope: 'Âmbito geográfico',
|
||||
multi_district_rationale: 'Justificação territorial',
|
||||
locations: 'Localizações guardadas',
|
||||
locations: 'Onde se localiza — locais documentados',
|
||||
executive_summary: 'Resumo executivo',
|
||||
demand_statement: 'Necessidade e proposta',
|
||||
visibility: 'Visibilidade após publicação',
|
||||
@@ -632,6 +632,16 @@ export default function OpportunityCanonicalFields({
|
||||
disabled?: boolean;
|
||||
errors?: Record<string, string>;
|
||||
}) {
|
||||
const initiative = (value.initiative ?? {}) as Data;
|
||||
const isInitiative = category === 'investment_project' && ['program', 'portfolio'].includes(valueText(initiative.kind ?? ''));
|
||||
const applicability = (initiative.applicability ?? {}) as Record<string, string>;
|
||||
const groups: Record<string, { label: string; fields: string[] }> = {
|
||||
physical_site: { label: 'Implantação física, obra e licenças próprias', fields: ['location_mode', 'licenses', 'environmental_social'] },
|
||||
individual_business: { label: 'Empresa ou operação individual', fields: ['promoter_id', 'promoter_type', 'opportunity_type', 'investor_profiles', 'products', 'assets', 'inputs', 'markets', 'competitive_advantage', 'employment', 'impact_indicators', 'enterprise_size'] },
|
||||
unit_investment: { label: 'Investimento e financiamento por projecto', fields: ['total_investment', 'currency', 'investment_breakdown', 'secured_financing', 'funding_sought', 'financial_indicators'] },
|
||||
};
|
||||
const ignoredFields = isInitiative ? ['promoter_type', ...Object.entries(groups).flatMap(([key, group]) => applicability[key] === 'not_applicable' ? group.fields : [])] : [];
|
||||
const setInitiative = (key: string, next: unknown) => onChange({ ...value, opportunity_category: category, initiative: { ...initiative, [key]: next } });
|
||||
const set = (key: string, v: unknown) =>
|
||||
onChange({
|
||||
...value,
|
||||
@@ -642,7 +652,7 @@ export default function OpportunityCanonicalFields({
|
||||
? { economic_activity_id: null }
|
||||
: {}),
|
||||
opportunity_category: category,
|
||||
promoter_id: organization ?? actorId,
|
||||
...(isInitiative ? {} : { promoter_id: organization ?? actorId }),
|
||||
});
|
||||
const common = [
|
||||
'official_title',
|
||||
@@ -820,7 +830,49 @@ export default function OpportunityCanonicalFields({
|
||||
propostas não representam compromisso nem decisão externa.
|
||||
</p>
|
||||
)}
|
||||
{Array.from(new Set([...common, ...specialized])).map((key) => {
|
||||
{category === 'investment_project' && (
|
||||
<section aria-label="Enquadramento e aplicabilidade" className="space-y-4 rounded border p-4">
|
||||
<label className="block">Natureza da ficha
|
||||
<select className={control} aria-label="Natureza da ficha" value={valueText(initiative.kind ?? '')} onChange={(e) => {
|
||||
if (!e.target.value) { const next = { ...value }; delete next.initiative; onChange(next); }
|
||||
else setInitiative('kind', e.target.value);
|
||||
}}>
|
||||
<option value="">Projecto ou componente concreta</option>
|
||||
<option value="program">Programa ou iniciativa agregadora</option>
|
||||
<option value="portfolio">Carteira de oportunidades/PME</option>
|
||||
</select>
|
||||
</label>
|
||||
{isInitiative && <>
|
||||
<p>O responsável do programa/carteira não substitui os promotores das componentes. Abrangência não comprova implantação. A classificação não confirma financiamento, licenças ou disponibilidade.</p>
|
||||
<label className="block">Responsável do programa ou carteira
|
||||
<input className={control} aria-label="Responsável do programa ou carteira" value={valueText(initiative.responsible_name ?? '')} onChange={(e) => setInitiative('responsible_name', e.target.value || null)} />
|
||||
</label>
|
||||
<FieldErrors path="canonical.initiative.responsible_name" errors={errors} />
|
||||
<label className="block">Abrangência territorial documentada
|
||||
<textarea className={control} aria-label="Abrangência territorial documentada" value={valueText(initiative.coverage_statement ?? '')} onChange={(e) => setInitiative('coverage_statement', e.target.value || null)} />
|
||||
</label>
|
||||
<FieldErrors path="canonical.initiative.coverage_statement" errors={errors} />
|
||||
<label className="block">Orçamento agregado — fonte e situação, sem confirmação automática
|
||||
<textarea className={control} aria-label="Orçamento agregado" value={valueText(initiative.aggregate_budget_statement ?? '')} onChange={(e) => setInitiative('aggregate_budget_statement', e.target.value || null)} />
|
||||
</label>
|
||||
{Object.entries(groups).map(([key, group]) => <div key={key}>
|
||||
<label className="block">{group.label}
|
||||
<select className={control} aria-label={group.label} value={applicability[key] ?? 'missing'} onChange={(e) => setInitiative('applicability', { ...applicability, [key]: e.target.value })}>
|
||||
<option value="missing">Informação em falta — aplicabilidade por determinar</option>
|
||||
<option value="not_applicable">Não aplicável a esta ficha agregadora</option>
|
||||
<option value="applicable">Aplicável — preencher os dados próprios</option>
|
||||
</select>
|
||||
</label>
|
||||
<FieldErrors path={'canonical.initiative.applicability.' + key} errors={errors} />
|
||||
{applicability[key] === 'not_applicable' && <details><summary>Não aplicável — consultar dados anteriores preservados</summary><pre className="overflow-auto whitespace-pre-wrap">{JSON.stringify(Object.fromEntries(group.fields.filter((field) => field in value).map((field) => [field, value[field]])), null, 2)}</pre><p>Sem eliminação dos valores. As componentes concretas mantêm os seus requisitos.</p></details>}
|
||||
</div>)}
|
||||
<p>Os recursos territoriais abaixo documentam a abrangência quando a implantação não é aplicável. A informação em falta continua pendente; não é convertida em “não aplicável”.</p>
|
||||
</>}
|
||||
</section>
|
||||
)}
|
||||
{[...new Set([...common, ...specialized])].map((key) => {
|
||||
if (ignoredFields.includes(key)) return null;
|
||||
|
||||
if (key === 'relations' && options.classification) {
|
||||
const rows = (value.relations ??
|
||||
[]) as ClassificationRelation[];
|
||||
@@ -936,14 +988,40 @@ export default function OpportunityCanonicalFields({
|
||||
if (a.historical_only) return false;
|
||||
if (a.level) {
|
||||
return key === 'subsector_id'
|
||||
? a.level === 2 && a.code === '01' && a.sector_id === Number(value.sector_id)
|
||||
: a.level === 5 && a.code === '01120' && !!a.path?.some((p) => p.id === value.subsector_id);
|
||||
? a.level === 2 &&
|
||||
a.code === '01' &&
|
||||
a.sector_id ===
|
||||
Number(
|
||||
value.sector_id,
|
||||
)
|
||||
: a.level === 5 &&
|
||||
a.code === '01120' &&
|
||||
!!a.path?.some(
|
||||
(p) =>
|
||||
p.id ===
|
||||
value.subsector_id,
|
||||
);
|
||||
}
|
||||
return key === 'subsector_id'
|
||||
? options.activities.some((root) => root.sector_id === Number(value.sector_id) && a.parent_id === root.id)
|
||||
: a.parent_id === value.subsector_id;
|
||||
? options.activities.some(
|
||||
(root) =>
|
||||
root.sector_id ===
|
||||
Number(
|
||||
value.sector_id,
|
||||
) &&
|
||||
a.parent_id === root.id,
|
||||
)
|
||||
: a.parent_id ===
|
||||
value.subsector_id;
|
||||
})
|
||||
.map((a) => ({ id: a.id, label: (a.display_label ?? a.label_pt_mz) + (a.historical_only ? ' — histórico preservado' : '') }));
|
||||
.map((a) => ({
|
||||
id: a.id,
|
||||
label:
|
||||
(a.display_label ?? a.label_pt_mz) +
|
||||
(a.historical_only
|
||||
? ' — histórico preservado'
|
||||
: ''),
|
||||
}));
|
||||
return (
|
||||
<label key={key} className="block">
|
||||
{labels[key]}
|
||||
@@ -972,12 +1050,25 @@ export default function OpportunityCanonicalFields({
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{key === 'economic_activity_id' && options.activities.find((a) => a.id === value[key])?.level && (
|
||||
<p className="mt-1 text-sm" data-economic-path="five-levels">
|
||||
{options.activities.find((a) => a.id === value[key])?.path?.map((p) => `${p.code} — ${p.label}`).join(' → ')}
|
||||
{' · Exemplar eBAU; edição normativa não determinada; divergência 600/579 aberta.'}
|
||||
</p>
|
||||
)}
|
||||
{key === 'economic_activity_id' &&
|
||||
options.activities.find(
|
||||
(a) => a.id === value[key],
|
||||
)?.level && (
|
||||
<p
|
||||
className="mt-1 text-sm"
|
||||
data-economic-path="five-levels"
|
||||
>
|
||||
{options.activities
|
||||
.find((a) => a.id === value[key])
|
||||
?.path?.map(
|
||||
(p) => `${p.code} — ${p.label}`,
|
||||
)
|
||||
.join(' → ')}
|
||||
{
|
||||
' · Exemplar eBAU; edição normativa não determinada; divergência 600/579 aberta.'
|
||||
}
|
||||
</p>
|
||||
)}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -987,7 +1078,19 @@ export default function OpportunityCanonicalFields({
|
||||
: [];
|
||||
return (
|
||||
<fieldset key={key}>
|
||||
<legend>{labels[key]}</legend>
|
||||
<legend>{isInitiative && key === 'locations' ? 'Abrangência territorial — recursos guardados' : labels[key]}</legend>
|
||||
{key === 'locations' && (
|
||||
<p>
|
||||
Seleccione os locais já guardados em
|
||||
Recursos; não volte a introduzir a
|
||||
hierarquia. O local principal, os adicionais
|
||||
e a finalidade de cada um são definidos
|
||||
nesse registo. Abrangência, impacto e
|
||||
contexto não significam implantação. Pode
|
||||
guardar incompleto; a submissão conserva as
|
||||
verificações existentes.
|
||||
</p>
|
||||
)}
|
||||
<FieldErrors
|
||||
path={'canonical.' + key}
|
||||
errors={errors}
|
||||
|
||||
@@ -30,7 +30,18 @@ export type ClassificationOptions = {
|
||||
dimensions: Record<string, string>;
|
||||
types: Record<string, string>;
|
||||
purposes: Record<string, string>;
|
||||
targets: Record<string, { id: string | number; label: string; code?: string; level?: number | null; path?: { id: string; code: string; label: string }[]; source_version?: string | null; edition?: string | null }[]>;
|
||||
targets: Record<
|
||||
string,
|
||||
{
|
||||
id: string | number;
|
||||
label: string;
|
||||
code?: string;
|
||||
level?: number | null;
|
||||
path?: { id: string; code: string; label: string }[];
|
||||
source_version?: string | null;
|
||||
edition?: string | null;
|
||||
}[]
|
||||
>;
|
||||
externalStates: string[];
|
||||
};
|
||||
const typeLabels: Record<string, string> = {
|
||||
@@ -61,7 +72,7 @@ const externalLabels: Record<string, string> = {
|
||||
expired: 'Caducado',
|
||||
};
|
||||
const help =
|
||||
'Associação, publicação e ato externo têm estados separados. Localização ou proximidade não concedem licença, benefício, terreno ou capacidade. Dados ausentes permanecem por determinar. Os elos identificados como Modelo editorial não confirmam operadores, capacidade ou relações comerciais. O recorte CAE conserva cinco níveis; 600/579 permanece documentalmente aberto.';
|
||||
'Indique relações com corredores, clusters, projectos âncora, zonas, parques, cadeias e actividades, quando aplicáveis. Cada associação tem finalidade, fonte e estado próprios. A implantação, a abrangência e a proximidade são diferentes: estar num distrito não comprova pertença a um cluster, parque ou regime especial. Associação, publicação e acto externo são decisões separadas; dados ausentes permanecem por determinar.';
|
||||
|
||||
export function ClassificationEditor({
|
||||
rows,
|
||||
@@ -117,7 +128,16 @@ export function ClassificationEditor({
|
||||
className="space-y-4"
|
||||
aria-label="Classificação multidimensional"
|
||||
>
|
||||
<h3 className="font-semibold">Quatro dimensões da oportunidade</h3>
|
||||
<h3 className="font-semibold">
|
||||
Associações territoriais e produtivas
|
||||
</h3>
|
||||
<p>
|
||||
Inclui relações territoriais, produtivas, regulatórias e de
|
||||
actividade. Não repita aqui o endereço nem a hierarquia dos
|
||||
locais. Pode preparar relações preliminares; confirmação e
|
||||
publicação seguem as verificações já existentes de fonte,
|
||||
citação e revisão.
|
||||
</p>
|
||||
<p>{help}</p>
|
||||
{Object.entries(options.dimensions).map(([dimension, label]) => (
|
||||
<fieldset
|
||||
@@ -193,9 +213,25 @@ export function ClassificationEditor({
|
||||
<option value="">
|
||||
Selecionar referência
|
||||
</option>
|
||||
{row.related_id && !(options.targets[row.classification.target_type] ?? []).some((t) => String(t.id) === String(row.related_id)) && (
|
||||
<option value={row.related_id}>Referência guardada, atualmente indisponível — {row.related_id}</option>
|
||||
)}
|
||||
{row.related_id &&
|
||||
!(
|
||||
options.targets[
|
||||
row.classification
|
||||
.target_type
|
||||
] ?? []
|
||||
).some(
|
||||
(t) =>
|
||||
String(t.id) ===
|
||||
String(row.related_id),
|
||||
) && (
|
||||
<option
|
||||
value={row.related_id}
|
||||
>
|
||||
Referência guardada,
|
||||
atualmente indisponível
|
||||
— {row.related_id}
|
||||
</option>
|
||||
)}
|
||||
{(
|
||||
options.targets[
|
||||
row.classification
|
||||
@@ -210,9 +246,27 @@ export function ClassificationEditor({
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{row.related_id && !(options.targets[row.classification.target_type] ?? []).some((t) => String(t.id) === String(row.related_id)) && (
|
||||
<span className="block text-sm">A referência deixou de estar disponível para novas escolhas. A relação histórica permanece guardada; não selecione outro valor para a recuperar.</span>
|
||||
)}
|
||||
{row.related_id &&
|
||||
!(
|
||||
options.targets[
|
||||
row.classification
|
||||
.target_type
|
||||
] ?? []
|
||||
).some(
|
||||
(t) =>
|
||||
String(t.id) ===
|
||||
String(row.related_id),
|
||||
) && (
|
||||
<span className="block text-sm">
|
||||
A referência deixou de estar
|
||||
disponível para novas
|
||||
escolhas. A relação
|
||||
histórica permanece
|
||||
guardada; não selecione
|
||||
outro valor para a
|
||||
recuperar.
|
||||
</span>
|
||||
)}
|
||||
{errors[
|
||||
`canonical.relations.${index}.related_id`
|
||||
] && (
|
||||
@@ -775,7 +829,7 @@ export function ClassificationSummary({
|
||||
aria-label="Quatro dimensões da oportunidade"
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
Classificação multidimensional
|
||||
Associações territoriais e produtivas
|
||||
</h2>
|
||||
<p>{help}</p>
|
||||
{Object.entries({
|
||||
@@ -792,12 +846,22 @@ export function ClassificationSummary({
|
||||
.map((r, i) => (
|
||||
<p key={i} className="break-words">
|
||||
{r.reference_path?.length
|
||||
? r.reference_path.map((n) => `${n.code} — ${n.label}`).join(' → ')
|
||||
: r.label} · {classificationStates[r.state]}{' '}
|
||||
? r.reference_path
|
||||
.map(
|
||||
(n) =>
|
||||
`${n.code} — ${n.label}`,
|
||||
)
|
||||
.join(' → ')
|
||||
: r.label}{' '}
|
||||
·{' '}
|
||||
{classificationStates[r.state] ??
|
||||
'Por determinar'}{' '}
|
||||
· {r.purpose_label ?? r.purpose} ·{' '}
|
||||
{r.source_reference || 'Fonte por indicar'}{' '}
|
||||
{r.citation} {r.production_stage} · Ato
|
||||
externo: {externalLabels[r.external_status]}
|
||||
externo:{' '}
|
||||
{externalLabels[r.external_status] ??
|
||||
'Não determinado'}
|
||||
. Benefício ou capacidade disponível: não
|
||||
inferido.
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
import { router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { createOperationKey } from '@/lib/operation-key';
|
||||
import { contextApi } from '@/lib/investor-context';
|
||||
|
||||
export type LibrarySource = {
|
||||
id: number;
|
||||
title: string;
|
||||
version_label: string | null;
|
||||
metadata_version: number;
|
||||
sha256: string;
|
||||
};
|
||||
export default function OpportunityLibraryReuse({
|
||||
sources,
|
||||
action,
|
||||
etag,
|
||||
}: {
|
||||
sources: LibrarySource[];
|
||||
action: string;
|
||||
etag: string;
|
||||
}) {
|
||||
const [selected, setSelected] = useState('');
|
||||
const [section, setSection] = useState('');
|
||||
const [reason, setReason] = useState('');
|
||||
const [key, setKey] = useState(createOperationKey);
|
||||
const [message, setMessage] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
return (
|
||||
<section
|
||||
aria-label="Reutilizar original da biblioteca"
|
||||
className="space-y-3 rounded border p-4"
|
||||
>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Reutilizar original da biblioteca
|
||||
</h2>
|
||||
<p>
|
||||
O suporte aponta para os mesmos bytes e conserva edição, hash e
|
||||
histórico. Mantém-se privado; a ficha e o original têm
|
||||
permissões e publicação próprias.
|
||||
</p>
|
||||
<label className="grid gap-1">
|
||||
Original da biblioteca
|
||||
<select
|
||||
aria-label="Original da biblioteca"
|
||||
className="w-full rounded border p-2"
|
||||
value={selected}
|
||||
onChange={(e) => setSelected(e.target.value)}
|
||||
>
|
||||
<option value="">Seleccionar original acessível</option>
|
||||
{sources.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.title} · {s.version_label ?? 'sem edição'} ·
|
||||
metadados v{s.metadata_version}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="grid gap-1">
|
||||
Secções utilizadas
|
||||
<input
|
||||
aria-label="Secções utilizadas"
|
||||
className="w-full rounded border p-2"
|
||||
value={section}
|
||||
maxLength={255}
|
||||
onChange={(e) => setSection(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1">
|
||||
Motivo da reutilização
|
||||
<textarea
|
||||
aria-label="Motivo da reutilização"
|
||||
className="w-full rounded border p-2"
|
||||
value={reason}
|
||||
minLength={20}
|
||||
maxLength={1000}
|
||||
onChange={(e) => setReason(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
className="rounded border bg-emerald-800 px-4 py-2 text-white disabled:opacity-50"
|
||||
type="button"
|
||||
disabled={!selected || reason.length < 20 || busy}
|
||||
onClick={async () => {
|
||||
setBusy(true);
|
||||
setMessage('');
|
||||
try {
|
||||
const result = await contextApi<{ message: string }>(
|
||||
action,
|
||||
{
|
||||
resource_id: Number(selected),
|
||||
section: section || null,
|
||||
reason,
|
||||
etag,
|
||||
creation_key: key,
|
||||
},
|
||||
);
|
||||
setMessage(result.message);
|
||||
setKey(createOperationKey);
|
||||
router.reload();
|
||||
} catch (e) {
|
||||
setMessage(
|
||||
e instanceof Error
|
||||
? e.message
|
||||
: 'Não foi possível associar o original. Selecção preservada.',
|
||||
);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Associar original como suporte privado
|
||||
</button>
|
||||
<p role="status">
|
||||
{message ||
|
||||
(!sources.length
|
||||
? 'Não há originais acessíveis à conta neste âmbito.'
|
||||
: 'Seleccionar não grava nem divulga o original.')}
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,39 +1,13 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
export default function PartnershipSearchResults({ query }: { query: string }) {
|
||||
const [items, setItems] = useState<{ id: number; title: string }[]>([]);
|
||||
useEffect(() => {
|
||||
if (!query.trim()) {
|
||||
setItems([]);
|
||||
return;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
fetch('/api/v1/partnerships?q=' + encodeURIComponent(query), {
|
||||
signal: controller.signal,
|
||||
headers: { Accept: 'application/json' },
|
||||
})
|
||||
.then((r) => (r.ok ? r.json() : null))
|
||||
.then((data) => setItems(data?.data ?? []))
|
||||
.catch(() => {});
|
||||
return () => controller.abort();
|
||||
}, [query]);
|
||||
if (!items.length) return null;
|
||||
return (
|
||||
<section className="my-5 space-y-3 rounded border p-4">
|
||||
<h2 className="text-xl font-bold">Parcerias nesta pesquisa</h2>
|
||||
{items.slice(0, 5).map((item) => (
|
||||
<p key={item.id}>
|
||||
<Link className="underline" href={'/parcerias/' + item.id}>
|
||||
{item.title}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
<Link
|
||||
className="underline"
|
||||
href={'/parcerias?q=' + encodeURIComponent(query)}
|
||||
>
|
||||
Ver todas as parcerias correspondentes
|
||||
</Link>
|
||||
</section>
|
||||
);
|
||||
import { usePortalQuery } from '@/hooks/use-portal-query';
|
||||
import SearchState from '@/components/search-state';
|
||||
export default function PartnershipSearchResults({query}: {query:string}) {
|
||||
const result = usePortalQuery<{data:{id:number;title:string}[]; total?:number}>('/api/v1/partnerships?q=' + encodeURIComponent(query), 250);
|
||||
const items = result.data?.data ?? [];
|
||||
if (!query.trim()) return null;
|
||||
return <section className="my-5 space-y-3 rounded border p-4"><h2 className="text-xl font-bold">Parcerias nesta pesquisa</h2>
|
||||
<SearchState loading={result.loading} error={result.error} total={result.data?.total ?? items.length} retry={result.retry}/>
|
||||
{!result.error && !result.loading && items.slice(0,5).map(item => <p key={item.id}><Link className="underline" href={'/parcerias/'+item.id}>{item.title}</Link></p>)}
|
||||
<Link className="underline" href={'/parcerias?q='+encodeURIComponent(query)}>Ver todas as parcerias correspondentes</Link>
|
||||
</section>;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function PasswordInput({
|
||||
type="button"
|
||||
onClick={() => setShowPassword((prev) => !prev)}
|
||||
className="text-muted-foreground hover:text-foreground focus-visible:ring-ring absolute inset-y-0 right-0 flex items-center rounded-r-md px-3 focus-visible:ring-[3px] focus-visible:outline-none"
|
||||
aria-label={showPassword ? 'Hide password' : 'Show password'}
|
||||
aria-label={showPassword ? 'Ocultar palavra-passe' : 'Mostrar palavra-passe'}
|
||||
tabIndex={-1}
|
||||
>
|
||||
{showPassword ? (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import PortalProductIdentity from '@/components/portal-product-identity';
|
||||
import { Link, router, usePage } from '@inertiajs/react';
|
||||
import {
|
||||
ChevronDown,
|
||||
@@ -48,6 +49,7 @@ export function PortalGroupedMenu() {
|
||||
legacyContentEnabled?: boolean;
|
||||
profileAccess?: ProfileAccess | null;
|
||||
opportunityManagement?: OpportunityManagementAccess | null;
|
||||
scopedAdministration?: {label:string;href:string}[];
|
||||
}>();
|
||||
const { t, language, requestCount } = useTempoUi();
|
||||
const navigation = useNavigationContext();
|
||||
@@ -65,6 +67,7 @@ export function PortalGroupedMenu() {
|
||||
opportunityManagement: props.opportunityManagement,
|
||||
profileAccess: props.profileAccess,
|
||||
});
|
||||
if (props.scopedAdministration?.length) groups.push({id:'scoped-administration',label:'Administração',children:props.scopedAdministration.map((item,index)=>({id:`scoped-${index}`,label:item.label,href:item.href}))});
|
||||
const current = currentNavigationGroup(groups, url);
|
||||
const currentItem = currentNavigationItem(groups, url);
|
||||
const [loggingOut, setLoggingOut] = useState(false);
|
||||
@@ -127,16 +130,10 @@ export function PortalGroupedMenu() {
|
||||
<div className="tempo-header-inner">
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="Tempo — início"
|
||||
aria-label="InvesteMoz — início"
|
||||
className="tempo-logo-link"
|
||||
>
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="tempo-header-logo"
|
||||
/>
|
||||
<PortalProductIdentity />
|
||||
</Link>
|
||||
<nav
|
||||
id={institutionalId}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/** Product identity and ownership are distinct; reuse the existing owner logo. */
|
||||
export default function PortalProductIdentity() {
|
||||
return (
|
||||
<span className="flex flex-col items-start gap-1">
|
||||
<span className="text-xl font-semibold tracking-tight">InvesteMoz</span>
|
||||
<span className="flex items-center gap-1.5 text-[10px] font-normal">
|
||||
Propriedade da
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo, Lda."
|
||||
width="1787"
|
||||
height="564"
|
||||
className="h-3.5 w-auto object-contain"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { router, usePage } from '@inertiajs/react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
// Shared feedback for existing Inertia search consumers; form state is never reset.
|
||||
const collections = ['results','records','resources','partnerships','opportunities','interests','investors','leads','articles','services','items','entries','documents','requests','batches','users','assignments','zones','matches','businesses'];
|
||||
function count(props: Record<string, unknown>): number | null {
|
||||
if (props.demands && props.capacities) return Number((props.demands as {total:number}).total) + Number((props.capacities as {total:number}).total);
|
||||
if (props.plan && Array.isArray((props.plan as {rows:unknown[]}).rows)) return (props.plan as {rows:unknown[]}).rows.length;
|
||||
if (typeof props.total === 'number') return props.total;
|
||||
if (typeof props.match === 'boolean' && Array.isArray(props.articles)) return props.match ? props.articles.length : 0;
|
||||
for (const key of collections) {
|
||||
const value = props[key] as {total?:number; meta?:{total?:number}; data?:unknown[]} | unknown[] | undefined;
|
||||
if (!value) continue;
|
||||
if (Array.isArray(value)) return value.length;
|
||||
if (typeof value.total === 'number') return value.total;
|
||||
if (typeof value.meta?.total === 'number') return value.meta.total;
|
||||
if (Array.isArray(value.data)) return value.data.length;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
export default function SearchFeedback() {
|
||||
const page = usePage();
|
||||
const [state, setState] = useState<'idle'|'loading'|'error'>('idle');
|
||||
const latest = useRef<{url: string; data: Record<string, unknown>} | null>(null);
|
||||
const active = useRef(false);
|
||||
const searchable = page.props.filters !== undefined || ['portal/legacy','desk/catalogue','investment/zones','partnerships/catalogue','education/index','management/territory-geometry-import'].includes(page.component);
|
||||
const total = searchable ? count(page.props) : null;
|
||||
useEffect(() => {
|
||||
const off = [router.on('before', event => {
|
||||
const visit = event.detail.visit;
|
||||
if (visit.method !== 'get') { active.current = false; return; }
|
||||
const data = visit.data as Record<string, unknown>;
|
||||
const url = visit.url;
|
||||
const isSearch = total !== null || ['q','query','search','filter','status','sector'].some(key => key in data || url.searchParams.has(key));
|
||||
active.current = isSearch;
|
||||
if (isSearch) { latest.current = {url: url.toString(), data}; setState('loading'); }
|
||||
}), router.on('success', () => { if (active.current) { active.current = false; setState('idle'); } }),
|
||||
router.on('error', () => { if (active.current) setState('error'); }),
|
||||
router.on('httpException', event => { if (active.current) { event.preventDefault(); setState('error'); } }),
|
||||
router.on('networkError', event => { if (active.current) { event.preventDefault(); setState('error'); } })];
|
||||
return () => off.forEach(remove => remove());
|
||||
}, [total]);
|
||||
if (total === null && state === 'idle') return null;
|
||||
return <aside data-search-feedback role={state === 'error' ? 'alert' : 'status'} aria-live="polite" aria-atomic="true" className="sticky top-0 z-50 border-b bg-white p-3 text-center text-slate-950 shadow">
|
||||
{state === 'loading' ? 'A pesquisar…' : state === 'error' ? <><span>Não foi possível concluir a pesquisa. Os resultados anteriores mantêm-se abaixo. </span><button type="button" className="underline" onClick={() => { const request = latest.current; if (request) router.get(request.url, request.data as never, {preserveState:true, preserveScroll:true}); }}>Tentar novamente</button></> : total === 0 ? 'Não foram encontrados resultados para esta pesquisa' : `${total} resultados encontrados`}
|
||||
</aside>;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export default function SearchState({loading, error, total, retry}: {loading:boolean; error?:string; total:number; retry:()=>void}) {
|
||||
return <div role={error ? 'alert' : 'status'} aria-live="polite" aria-atomic="true" className="my-3 rounded border p-3">
|
||||
{loading ? 'A pesquisar…' : error ? <>Não foi possível concluir a pesquisa. <button type="button" className="underline" onClick={retry}>Tentar novamente</button></> : total === 0 ? 'Não foram encontrados resultados para esta pesquisa' : `${total} resultados encontrados`}
|
||||
</div>;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export type StructureGeography = {
|
||||
};
|
||||
|
||||
const roles: Record<string, string> = {
|
||||
opportunity: 'Implantação cadastrada da oportunidade',
|
||||
opportunity: 'Localização declarada da oportunidade',
|
||||
primary: 'Localização principal',
|
||||
secondary: 'Localização secundária',
|
||||
impact: 'Área de impacto',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import PortalProductIdentity from '@/components/portal-product-identity';
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import { ChevronRight, Mail, MapPin, Phone } from 'lucide-react';
|
||||
import { TempoSocialLinks, useTempoUi } from '@/components/tempo-brand';
|
||||
|
||||
@@ -9,6 +10,7 @@ const navigation = [
|
||||
|
||||
export function TempoFooter() {
|
||||
const { t, language } = useTempoUi();
|
||||
const { portalInstitutionalContactEmail } = usePage<{ portalInstitutionalContactEmail?: string | null }>().props;
|
||||
return (
|
||||
<footer
|
||||
className="tempo-footer border-t border-white/5"
|
||||
@@ -18,17 +20,10 @@ export function TempoFooter() {
|
||||
<div className="space-y-8">
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="Tempo — início"
|
||||
aria-label="InvesteMoz — início"
|
||||
className="block w-fit"
|
||||
>
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="h-10 w-auto object-contain md:h-12"
|
||||
loading="lazy"
|
||||
/>
|
||||
<PortalProductIdentity />
|
||||
</Link>
|
||||
<div className="flex items-start gap-4">
|
||||
<MapPin
|
||||
@@ -63,16 +58,14 @@ export function TempoFooter() {
|
||||
</a>
|
||||
))}
|
||||
<a
|
||||
href="mailto:info@tempo.co.mz"
|
||||
href={portalInstitutionalContactEmail ? `mailto:${portalInstitutionalContactEmail}` : '/apoio'}
|
||||
className="tempo-contact-link"
|
||||
>
|
||||
<span className="tempo-contact-icon">
|
||||
<Mail size={16} aria-hidden="true" />
|
||||
</span>
|
||||
<strong className="min-w-0 text-sm font-medium [overflow-wrap:anywhere]">
|
||||
comercial@
|
||||
<wbr />
|
||||
tempo.co.mz
|
||||
<strong className="min-w-0 text-sm font-medium [overflow-wrap:anywhere]">
|
||||
{portalInstitutionalContactEmail ?? t('Apoio ao investidor')}
|
||||
</strong>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user