Reconciliar fontes instaladas 423bd512d8c5 com main
This commit is contained in:
@@ -8,7 +8,7 @@ import AuthLayout from '@/layouts/auth-layout';
|
||||
import SettingsLayout from '@/layouts/settings/layout';
|
||||
import PortalNavigation from '@/layouts/portal-navigation';
|
||||
|
||||
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
|
||||
const appName = import.meta.env.VITE_APP_NAME || 'InvesteMoz';
|
||||
const pages = import.meta.glob<{ default: ComponentType }>('./pages/**/*.tsx');
|
||||
|
||||
void createInertiaApp({
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { newSubmissionKey } from '@/lib/portal-api';
|
||||
export function useInterestDraft<T>(name: string, initial: T) {
|
||||
const storage = 'investemoz-interest:' + name;
|
||||
const [draft, setDraft] = useState<{form:T; key:string}>(() => {
|
||||
try { const value = JSON.parse(sessionStorage.getItem(storage) ?? 'null');
|
||||
if (value?.form && typeof value.key === 'string') return value;
|
||||
} catch { /* unavailable storage leaves the current form usable */ }
|
||||
return { form: initial, key: newSubmissionKey() };
|
||||
});
|
||||
useEffect(() => { try { sessionStorage.setItem(storage, JSON.stringify(draft)); } catch {} }, [storage, draft]);
|
||||
const setForm = (value: T | ((old:T)=>T)) => setDraft(old => ({...old, form: typeof value === 'function' ? (value as (old:T)=>T)(old.form) : value}));
|
||||
return { form: draft.form, setForm, key: draft.key,
|
||||
clear: () => { sessionStorage.removeItem(storage); sessionStorage.removeItem('investemoz-participation-identity'); },
|
||||
authenticate: () => { const identity = draft.form as {name?: string; fullName?: string; email?: string}; sessionStorage.setItem('investemoz-participation-identity', JSON.stringify({name: identity.fullName ?? identity.name ?? '', email: identity.email ?? ''})); sessionStorage.setItem(storage, JSON.stringify(draft)); window.location.assign('/participar/entrar?return=' + encodeURIComponent(location.pathname + location.search)); } };
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import PortalProductIdentity from '@/components/portal-product-identity';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import AppLogoIcon from '@/components/app-logo-icon';
|
||||
import { home } from '@/routes';
|
||||
import type { AuthLayoutProps } from '@/types';
|
||||
|
||||
@@ -9,7 +9,7 @@ export default function AuthSimpleLayout({
|
||||
description,
|
||||
}: AuthLayoutProps) {
|
||||
return (
|
||||
<div className="bg-background flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10">
|
||||
<div className="bg-background flex min-h-[28rem] flex-col items-center justify-start gap-6 p-6 md:p-8">
|
||||
<div className="w-full max-w-sm">
|
||||
<div className="flex flex-col gap-8">
|
||||
<div className="flex flex-col items-center gap-4">
|
||||
@@ -17,8 +17,8 @@ export default function AuthSimpleLayout({
|
||||
href={home()}
|
||||
className="flex flex-col items-center gap-2 font-medium"
|
||||
>
|
||||
<div className="mb-1 flex h-9 w-9 items-center justify-center rounded-md">
|
||||
<AppLogoIcon className="size-9 fill-current text-[var(--foreground)] dark:text-white" />
|
||||
<div className="mb-1 flex min-h-12 items-center justify-center">
|
||||
<PortalProductIdentity />
|
||||
</div>
|
||||
<span className="sr-only">{title}</span>
|
||||
</Link>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import SearchFeedback from '@/components/search-feedback';
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import { createContext, useContext } from 'react';
|
||||
import { PortalGroupedMenu } from '@/components/portal-grouped-menu';
|
||||
@@ -120,6 +121,11 @@ export default function PortalNavigation({
|
||||
Saltar para o conteúdo
|
||||
</a>
|
||||
</nav>
|
||||
{props.homologationReserved === true && (
|
||||
<aside aria-label="Ambiente de homologação" className="border-b border-amber-200 bg-amber-50 px-5 py-2 text-sm text-amber-950 print:hidden">
|
||||
Homologação reservada à revisão da Tempo. Consulte o conteúdo público; entre na sua conta quando iniciar uma operação.
|
||||
</aside>
|
||||
)}
|
||||
{portalShell && (
|
||||
<div
|
||||
className={
|
||||
@@ -164,6 +170,7 @@ export default function PortalNavigation({
|
||||
<NavigationContextSummary />
|
||||
</div>
|
||||
)}
|
||||
<SearchFeedback />
|
||||
{children}
|
||||
</div>
|
||||
<aside
|
||||
|
||||
@@ -6,6 +6,21 @@ function csrfToken(): string {
|
||||
?.slice('XSRF-TOKEN='.length) ?? '',
|
||||
);
|
||||
}
|
||||
export type ContextDocument = {
|
||||
resource_id: number;
|
||||
document_id: string;
|
||||
metadata_version: number;
|
||||
document_version: number;
|
||||
edition: string | null;
|
||||
sha256: string;
|
||||
source_reference: string;
|
||||
title: string;
|
||||
support_id: string;
|
||||
support_version: number;
|
||||
section: string | null;
|
||||
opportunity_id: number;
|
||||
download_url: string;
|
||||
};
|
||||
export type ContextReference = {
|
||||
key: string;
|
||||
kind: string;
|
||||
@@ -15,6 +30,9 @@ export type ContextReference = {
|
||||
version: number | string | null;
|
||||
sha256: string;
|
||||
fields: Record<string, string>;
|
||||
documents?: ContextDocument[];
|
||||
visibility?: 'private' | 'public';
|
||||
state?: string | null;
|
||||
};
|
||||
export type DossierContext = {
|
||||
revision: number;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export function participationIdentity(): {name:string;email:string} {
|
||||
try { const value = JSON.parse(sessionStorage.getItem('investemoz-participation-identity') ?? 'null');
|
||||
return {name: typeof value?.name === 'string' ? value.name : '', email: typeof value?.email === 'string' ? value.email : ''};
|
||||
} catch { return {name:'',email:''}; }
|
||||
}
|
||||
@@ -113,6 +113,10 @@ export async function portalRequest<T>(
|
||||
): Promise<T> {
|
||||
const headers = new Headers(options.headers);
|
||||
headers.set('Accept', 'application/json');
|
||||
if (options.method && !['GET', 'HEAD'].includes(options.method.toUpperCase())) {
|
||||
const token = document.cookie.split('; ').find(value => value.startsWith('XSRF-TOKEN='))?.slice(11);
|
||||
if (token) headers.set('X-XSRF-TOKEN', decodeURIComponent(token));
|
||||
}
|
||||
const response = await fetch(url, {
|
||||
...options,
|
||||
credentials: 'same-origin',
|
||||
|
||||
@@ -440,11 +440,11 @@ export function currentNavigationItem(
|
||||
export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
const previous = legacyPortalNavigation(access);
|
||||
return uniqueNavigationDestinations([
|
||||
link('home', 'Início', '/'),
|
||||
{
|
||||
id: 'discovery',
|
||||
label: 'Descoberta',
|
||||
children: [
|
||||
link('home', 'Início', '/'),
|
||||
link(
|
||||
'why',
|
||||
'Porquê investir em Moçambique',
|
||||
|
||||
@@ -367,7 +367,7 @@ export async function generateProjectDossierDocx(
|
||||
annexesIncluded: boolean,
|
||||
): Promise<Blob> {
|
||||
const children: (Paragraph | Table)[] = [
|
||||
new Paragraph({ text: 'InvestMoz', heading: HeadingLevel.HEADING_2 }),
|
||||
new Paragraph({ text: 'InvesteMoz', heading: HeadingLevel.HEADING_2 }),
|
||||
new Paragraph({
|
||||
text: 'Relatório consolidado do projecto',
|
||||
heading: HeadingLevel.TITLE,
|
||||
@@ -447,7 +447,8 @@ export async function generateProjectDossierDocx(
|
||||
alignment: AlignmentType.RIGHT,
|
||||
children: [
|
||||
new TextRun({
|
||||
text: 'InvestMoz · relatório privado · página ',
|
||||
text: 'InvesteMoz · '+model.title.slice(0, 60)+' · privado · página ',
|
||||
size: 18,
|
||||
}),
|
||||
new SimpleField('PAGE'),
|
||||
],
|
||||
@@ -455,14 +456,14 @@ export async function generateProjectDossierDocx(
|
||||
],
|
||||
});
|
||||
const doc = new Document({
|
||||
creator: 'InvestMoz',
|
||||
creator: 'InvesteMoz',
|
||||
title: `Relatório do projecto — ${model.title}`,
|
||||
description:
|
||||
'Dossier consolidado exportado localmente a partir do formulário InvestMoz.',
|
||||
'Dossier consolidado exportado localmente a partir do formulário InvesteMoz.',
|
||||
styles: {
|
||||
default: {
|
||||
document: {
|
||||
run: { font: 'Aptos', size: 20, color: '17211F' },
|
||||
run: { font: 'Arial', size: 20, color: '17211F' },
|
||||
paragraph: { spacing: { after: 120, line: 276 } },
|
||||
},
|
||||
},
|
||||
@@ -472,7 +473,7 @@ export async function generateProjectDossierDocx(
|
||||
name: 'Title',
|
||||
basedOn: 'Normal',
|
||||
run: {
|
||||
font: 'Aptos Display',
|
||||
font: 'Arial',
|
||||
size: 34,
|
||||
bold: true,
|
||||
color: '123B35',
|
||||
@@ -485,7 +486,7 @@ export async function generateProjectDossierDocx(
|
||||
basedOn: 'Normal',
|
||||
next: 'Normal',
|
||||
run: {
|
||||
font: 'Aptos Display',
|
||||
font: 'Arial',
|
||||
size: 26,
|
||||
bold: true,
|
||||
color: '123B35',
|
||||
@@ -501,7 +502,7 @@ export async function generateProjectDossierDocx(
|
||||
basedOn: 'Normal',
|
||||
next: 'Normal',
|
||||
run: {
|
||||
font: 'Aptos',
|
||||
font: 'Arial',
|
||||
size: 24,
|
||||
bold: true,
|
||||
color: '27675C',
|
||||
@@ -517,7 +518,7 @@ export async function generateProjectDossierDocx(
|
||||
basedOn: 'Normal',
|
||||
next: 'Normal',
|
||||
run: {
|
||||
font: 'Aptos',
|
||||
font: 'Arial',
|
||||
size: 22,
|
||||
bold: true,
|
||||
color: '27675C',
|
||||
@@ -533,7 +534,7 @@ export async function generateProjectDossierDocx(
|
||||
{
|
||||
properties: {
|
||||
page: {
|
||||
size: { width: 12240, height: 15840 },
|
||||
size: { width: 11906, height: 16838 },
|
||||
margin: {
|
||||
top: 900,
|
||||
right: 960,
|
||||
@@ -569,7 +570,7 @@ async function fileDataUrl(file: File): Promise<string> {
|
||||
}
|
||||
|
||||
function htmlTable(headers: string[], rows: string[][]): string {
|
||||
return `<table><thead><tr>${headers.map((value) => `<th>${escapeHtml(value)}</th>`).join('')}</tr></thead><tbody>${rows.map((row) => `<tr>${headers.map((_, index) => `<td>${escapeHtml(row[index] ?? '')}</td>`).join('')}</tr>`).join('')}</tbody></table>`;
|
||||
return `<table class="${headers[0] === 'Campo' && headers[2] === 'Classificação / origem' ? 'report-table' : 'annex-table'}"><thead><tr>${headers.map((value) => `<th>${escapeHtml(value)}</th>`).join('')}</tr></thead><tbody>${rows.map((row) => `<tr>${headers.map((_, index) => `<td>${escapeHtml(row[index] ?? '')}</td>`).join('')}</tr>`).join('')}</tbody></table>`;
|
||||
}
|
||||
|
||||
export async function createProjectDossierPrintHtml(
|
||||
@@ -640,8 +641,8 @@ export async function createProjectDossierPrintHtml(
|
||||
content.push('</section>');
|
||||
}
|
||||
return `<!doctype html><html lang="pt-MZ"><head><meta charset="utf-8"><title>Relatório — ${escapeHtml(model.title)}</title><style>
|
||||
@page{size:A4;margin:18mm 17mm 20mm}*{box-sizing:border-box}body{font:10.5pt/1.45 Arial,sans-serif;color:#17211f;margin:0}h1{font-size:24pt;color:#123b35;margin:0 0 7mm}h2{font-size:16pt;color:#123b35;border-bottom:1px solid #b8c9c3;padding-bottom:2mm;margin:8mm 0 3mm;break-after:avoid}h3{font-size:12pt;color:#27675c;break-after:avoid}p{white-space:pre-wrap}table{width:100%;border-collapse:collapse;table-layout:fixed;margin:3mm 0 5mm;break-inside:auto}th,td{border:1px solid #cbd5d1;padding:5px 6px;text-align:left;vertical-align:top;overflow-wrap:anywhere}th{background:#123b35;color:white}tr{break-inside:avoid}th:first-child,td:first-child{width:22%}th:last-child,td:last-child{width:32%;font-size:9pt;color:#40524d}.private{padding:3mm;background:#fff4df;border-left:3px solid #b66a0c;font-weight:bold}section{break-inside:auto}figure{margin:5mm auto;text-align:center;break-inside:avoid}img{max-width:100%;max-height:210mm;object-fit:contain}figcaption{font-style:italic;color:#52615d}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:9.5pt/1.4 Arial,sans-serif}@media print{a{color:inherit;text-decoration:none}.no-print{display:none}}
|
||||
</style></head><body><h1>InvestMoz<br>Relatório consolidado do projecto</h1><p><strong>${escapeHtml(model.title)}</strong><br>Gerado em ${escapeHtml(new Date(model.generatedAt).toLocaleString('pt-MZ'))}<br>Versão/revisão: ${escapeHtml(model.version)}</p><p class="private">Documento privado. O portal não publica nem partilha este conteúdo.</p>${content.join('')}<footer><small>InvestMoz · Relatório privado · ${escapeHtml(model.version)}</small></footer><script>window.addEventListener('load',()=>setTimeout(()=>window.print(),350));</script></body></html>`;
|
||||
@page{size:A4;margin:18mm 17mm 20mm}*{box-sizing:border-box}body{font:10.5pt/1.45 Arial,sans-serif;color:#17211f;margin:0}h1{font-size:24pt;color:#123b35;margin:0 0 7mm}h2{font-size:16pt;color:#123b35;border-bottom:1px solid #b8c9c3;padding-bottom:2mm;margin:8mm 0 3mm;break-after:avoid}h3{font-size:12pt;color:#27675c;break-after:avoid}p{white-space:pre-wrap}table{width:100%;border-collapse:collapse;table-layout:fixed;margin:3mm 0 5mm;break-inside:auto}th,td{border:1px solid #cbd5d1;padding:5px 6px;text-align:left;vertical-align:top;overflow-wrap:anywhere}th{background:#123b35;color:white}tr{break-inside:avoid}.report-table th:first-child,.report-table td:first-child{width:22%}.report-table th:last-child,.report-table td:last-child{width:32%}.report-table td:last-child{font-size:9pt;color:#40524d}.annex-table{table-layout:fixed;font-size:9pt}thead{display:table-header-group}.private{padding:3mm;background:#fff4df;border-left:3px solid #b66a0c;font-weight:bold}section{break-inside:auto}figure{margin:5mm auto;text-align:center;break-inside:avoid}img{max-width:100%;max-height:210mm;object-fit:contain}figcaption{font-style:italic;color:#52615d}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:9.5pt/1.4 Arial,sans-serif}@media screen{body{max-width:1040px;margin:24px auto;padding:24px}table{font-size:11pt}}@media screen{body{max-width:1040px;margin:24px auto;padding:24px}table{font-size:11pt}}@media print{a{color:inherit;text-decoration:none}.no-print{display:none}th{color:#17211f;background:#edf4f1}footer{position:fixed;bottom:-14mm;left:0;right:0;font-size:9pt;color:#40524d}}
|
||||
</style></head><body><h1>InvesteMoz<br>Relatório consolidado do projecto</h1><p><strong>${escapeHtml(model.title)}</strong><br>Gerado em ${escapeHtml(new Date(model.generatedAt).toLocaleString('pt-MZ'))}<br>Versão/revisão: ${escapeHtml(model.version)}</p><p class="private">Documento privado. O portal não publica nem partilha este conteúdo.</p>${content.join('')}<footer><small>InvesteMoz · Relatório privado · ${escapeHtml(model.version)}</small></footer><script>window.addEventListener('load',()=>setTimeout(()=>window.print(),350));</script></body></html>`;
|
||||
}
|
||||
|
||||
export async function generateProjectDossierPackage(
|
||||
|
||||
@@ -111,6 +111,30 @@ function classification(origin: string): string {
|
||||
return 'Referência/estado indicado';
|
||||
}
|
||||
|
||||
export function formatDossierReportValue(field: string, value: string, currency = ''): string {
|
||||
if (field === 'Estado do plano detalhado') {
|
||||
return value.replace('Snapshot versionado disponível; usar também a exportação do plano financeiro', 'Plano guardado disponível; consulte também a exportação financeira');
|
||||
}
|
||||
if (field === 'Reconciliação do financiamento') {
|
||||
const states: Record<string, string> = { shortfall: 'Financiamento insuficiente', surplus: 'Fontes superiores aos usos previstos', balanced: 'Fontes e usos equilibrados', unknown: 'Informação insuficiente', incomplete: 'Informação insuficiente' };
|
||||
return states[value] ?? value;
|
||||
}
|
||||
if (/^Necessidade \d+$/.test(field)) {
|
||||
value = value.replace('; gap;', '; Competência em falta;').replace('; unknown;', '; Por confirmar;').replace('; available;', '; Disponível (declarado);');
|
||||
}
|
||||
if (/^Marco \d+$/.test(field)) {
|
||||
value = value.replace('; planned;', '; Planeado;').replace('; in_progress;', '; Em curso;').replace('; completed;', '; Concluído (declarado);');
|
||||
}
|
||||
if (/^(Necessidade|Marco) \d+$/.test(field)) {
|
||||
value = value.replace(/(custo|planeado|realizado): ([^;]*)(?=;|$)/g, (_, label: string, amount: string) => {
|
||||
const raw = amount.trim();
|
||||
return `${label}: ${raw ? (/^\d+(?:\.\d{1,2})?$/.test(raw) ? `${raw} ${currency || '(moeda não informada)'}` : raw) : 'Não informado'}`;
|
||||
}).replace(/prazo: (?=;|$)/g, 'prazo: Não informado');
|
||||
}
|
||||
// Presentation only: group the decimal string without converting the amount
|
||||
// to a JavaScript float or changing the saved financial snapshot.
|
||||
return value.replace(/^(-?)(\d+)\.(\d{2}) ([A-Z]{3})$/, (_, sign: string, whole: string, cents: string, currency: string) => `${sign}${whole.replace(/\B(?=(\d{3})+(?!\d))/g, ' ')},${cents} ${currency}`);
|
||||
}
|
||||
const rowSection: Record<string, DossierReportSectionId> = {
|
||||
Projecto: 'project',
|
||||
Mercado: 'market',
|
||||
@@ -180,28 +204,31 @@ function makeSections(
|
||||
{
|
||||
field: 'Data de geração',
|
||||
value: new Date(generatedAt).toLocaleString('pt-MZ'),
|
||||
origin: 'Relógio do dispositivo no momento da exportação',
|
||||
classification: 'Metadado do relatório',
|
||||
origin: 'Emissão no momento da exportação',
|
||||
classification: 'Data de emissão',
|
||||
},
|
||||
{
|
||||
field: 'Versão/revisão do dossier',
|
||||
value: version,
|
||||
origin: 'Revisão de rascunho guardada ou impressão digital local',
|
||||
classification: 'Metadado técnico',
|
||||
origin: 'Revisão do dossier exportado',
|
||||
classification: 'Referência da revisão',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
for (const [sectionName, field, value, origin] of rows.slice(1)) {
|
||||
// Questionnaire schema identifiers remain stored; they do not help the
|
||||
// reader assess the project and are not a business report field.
|
||||
if (field === 'Versão do questionário') continue;
|
||||
const id = rowSection[sectionName];
|
||||
if (!id) continue;
|
||||
const section = sections.get(id);
|
||||
if (!section) continue;
|
||||
section.rows.push({
|
||||
field,
|
||||
value: absent(value),
|
||||
value: absent(formatDossierReportValue(field, value, text(draft, 'currency'))),
|
||||
origin,
|
||||
classification: classification(origin),
|
||||
classification: value.trim() === '' ? 'Informação em falta' : classification(origin),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -321,7 +348,7 @@ function makeSections(
|
||||
field: 'Versão do motor/cenário',
|
||||
value: `${typeof context?.engine_version === 'string' ? context.engine_version : 'não identificada'} / ${typeof context?.scenario_version === 'number' ? context.scenario_version : currentCalculation.version}`,
|
||||
origin: 'Contexto guardado na execução',
|
||||
classification: 'Metadado técnico',
|
||||
classification: 'Referência da revisão',
|
||||
},
|
||||
{
|
||||
field: 'Fórmula e valores usados',
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import SearchState from '@/components/search-state';
|
||||
import { useInterestDraft } from '@/hooks/use-interest-draft';
|
||||
import { createContext, useContext, useRef, useState } from 'react';
|
||||
import { router } from '@inertiajs/react';
|
||||
import { PortalMenu } from '@/layouts/portal-navigation';
|
||||
import { useTempoUi } from '@/components/tempo-brand';
|
||||
import { ProvinceSelect } from '@/components/investment-territory';
|
||||
import { MATURITY_LEVELS } from '@/lib/investment-maturity';
|
||||
import CountrySelect, { type Country } from '@/components/country-select';
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
PortalApiError,
|
||||
fieldErrors,
|
||||
interestPayload,
|
||||
newSubmissionKey,
|
||||
money,
|
||||
portalRequest,
|
||||
searchUrl,
|
||||
@@ -95,6 +95,48 @@ function QueryStatus({
|
||||
/* Componentes */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
function TopBar({
|
||||
onNavigate,
|
||||
requestCount,
|
||||
}: {
|
||||
onNavigate: (view: View) => void;
|
||||
requestCount: number;
|
||||
}) {
|
||||
return (
|
||||
<nav
|
||||
aria-label="Navegação das manifestações"
|
||||
className="sticky top-0 z-30 border-b border-slate-200 bg-white/95 backdrop-blur"
|
||||
>
|
||||
<div className="mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-3 px-5 py-4">
|
||||
<button
|
||||
onClick={() => onNavigate('home')}
|
||||
className="flex items-baseline gap-1 font-black tracking-tight text-slate-900"
|
||||
>
|
||||
<span className="text-lg">INVESTE</span>
|
||||
<span className="text-lg text-emerald-700">Moçambique</span>
|
||||
</button>
|
||||
|
||||
<div className="flex items-center gap-3 text-xs text-slate-500">
|
||||
<a href="/investidor/manifestacoes" className="underline">
|
||||
O meu painel
|
||||
</a>
|
||||
<span className="hidden sm:inline">
|
||||
{requestCount} pedido{requestCount === 1 ? '' : 's'}{' '}
|
||||
recebido
|
||||
{requestCount === 1 ? '' : 's'}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => onNavigate('interest')}
|
||||
className="rounded-lg bg-slate-900 px-4 py-2 text-sm font-bold text-white hover:bg-slate-700"
|
||||
>
|
||||
Manifestar interesse
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
function Hero({
|
||||
query,
|
||||
setQuery,
|
||||
@@ -140,12 +182,6 @@ function Hero({
|
||||
>
|
||||
Explorar oportunidades <ArrowRight size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onNavigate('interest')}
|
||||
className="rounded-lg border border-white/30 px-5 py-3 font-semibold text-white hover:bg-white/10"
|
||||
>
|
||||
Manifestar interesse
|
||||
</button>
|
||||
<a
|
||||
href="/simulador-fiscal"
|
||||
className="rounded-lg border border-emerald-300 px-5 py-3 font-semibold text-emerald-100 hover:bg-emerald-900"
|
||||
@@ -356,10 +392,11 @@ function OpportunitiesView({
|
||||
|
||||
return (
|
||||
<section className="mx-auto max-w-6xl px-5 py-12">
|
||||
<SearchState loading={query.loading} error={query.error} total={total} retry={query.retry} />
|
||||
<h1 className="text-3xl font-black text-slate-900">
|
||||
Oportunidades de investimento
|
||||
</h1>
|
||||
<p className="mt-2 text-slate-600">
|
||||
<p role="status" aria-live="polite" className="mt-2 text-slate-600">
|
||||
{query.loading ? (
|
||||
'A pesquisar oportunidades...'
|
||||
) : query.error ? (
|
||||
@@ -668,7 +705,7 @@ function InterestForm({
|
||||
const pending = useRef(false);
|
||||
const submission = useRef<{ body: string; key: string } | null>(null);
|
||||
const [submitError, setSubmitError] = useState<string | null>(null);
|
||||
const [form, setForm] = useState<InterestFormData>({
|
||||
const draft = useInterestDraft<InterestFormData>('opportunity:' + (preselected?.reference ?? 'general'), {
|
||||
name: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
@@ -681,6 +718,7 @@ function InterestForm({
|
||||
message: '',
|
||||
privacyConsent: false,
|
||||
});
|
||||
const { form, setForm } = draft;
|
||||
const [errors, setErrors] = useState<FormErrors>({});
|
||||
const [result, setResult] = useState<{ reference: string } | null>(null);
|
||||
|
||||
@@ -719,7 +757,7 @@ function InterestForm({
|
||||
try {
|
||||
const body = JSON.stringify(interestPayload(form));
|
||||
if (submission.current?.body !== body) {
|
||||
submission.current = { body, key: newSubmissionKey() };
|
||||
submission.current = { body, key: draft.key };
|
||||
}
|
||||
const response = await portalRequest<{
|
||||
success: boolean;
|
||||
@@ -737,9 +775,11 @@ function InterestForm({
|
||||
typeof response.data?.reference !== 'string'
|
||||
)
|
||||
throw new Error('Invalid confirmation');
|
||||
draft.clear();
|
||||
setResult({ reference: response.data.reference });
|
||||
onSubmitted();
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof PortalApiError && error.status === 401) { draft.authenticate(); return; }
|
||||
if (error instanceof PortalApiError) {
|
||||
setErrors(fieldErrors(error));
|
||||
setSubmitError(error.message);
|
||||
@@ -765,7 +805,7 @@ function InterestForm({
|
||||
A sua referência é <strong>{result.reference}</strong>. A
|
||||
equipa do portal irá analisar o pedido e poderá solicitar
|
||||
informação adicional.
|
||||
</p>
|
||||
</p><a href="/investidor/manifestacoes" className="mt-4 inline-block underline">Acompanhar manifestações</a>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1011,6 +1051,23 @@ function Field({
|
||||
);
|
||||
}
|
||||
|
||||
function Footer() {
|
||||
return (
|
||||
<footer className="border-t border-slate-200 bg-slate-950 py-10 text-slate-400">
|
||||
<div className="mx-auto max-w-6xl px-5 text-sm">
|
||||
<p className="font-bold text-white">INVESTE Moçambique</p>
|
||||
<p className="mt-2 max-w-md">
|
||||
Portal do Investidor — conheça as oportunidades de
|
||||
investimento em Moçambique e manifeste o seu interesse.{' '}
|
||||
<a href="/acesso-gestao" className="underline">
|
||||
Acesso à gestão
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* App */
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -1038,7 +1095,7 @@ export default function PortalInvestidorApp({
|
||||
const selected = initialOpportunity
|
||||
? toOpportunity(initialOpportunity)
|
||||
: null;
|
||||
const { registerSubmittedInterest } = useTempoUi();
|
||||
const [requestCount, setRequestCount] = useState(0);
|
||||
const [heroQuery, setHeroQuery] = useState('');
|
||||
const [filters, setFilters] = useState<Filters>({
|
||||
query: initialQuery,
|
||||
@@ -1083,6 +1140,7 @@ export default function PortalInvestidorApp({
|
||||
return (
|
||||
<SectorContext.Provider value={sectors}>
|
||||
<div className="min-h-screen bg-slate-50 font-sans text-slate-900">
|
||||
{view !== 'home' && <TopBar onNavigate={navigate} requestCount={requestCount} />}
|
||||
<PortalMenu />
|
||||
<main>
|
||||
{view === 'home' && (
|
||||
@@ -1321,10 +1379,11 @@ export default function PortalInvestidorApp({
|
||||
key={selected?.reference ?? 'general'}
|
||||
preselected={selected}
|
||||
countries={countries}
|
||||
onSubmitted={registerSubmittedInterest}
|
||||
onSubmitted={() => setRequestCount((c) => c + 1)}
|
||||
/>
|
||||
)}
|
||||
</main>
|
||||
<Footer />
|
||||
|
||||
<style>{`
|
||||
.input {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { participationIdentity } from '@/lib/participation-identity';
|
||||
import { Form, Head, usePage } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
@@ -27,7 +28,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
const pageErrors = usePage<{ errors: { email?: string } }>().props.errors;
|
||||
return (
|
||||
<>
|
||||
<Head title="Log in" />
|
||||
<Head title="Entrar" />
|
||||
|
||||
{qaAccount && (
|
||||
<aside
|
||||
@@ -46,7 +47,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
)}
|
||||
|
||||
{/* @chisel-passkeys */}
|
||||
<PasskeyVerify />
|
||||
<PasskeyVerify label="Entrar com chave de acesso" loadingLabel="A autenticar…" separator="Ou continuar com email" />
|
||||
{/* @end-chisel-passkeys */}
|
||||
|
||||
<Form
|
||||
@@ -58,17 +59,16 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
<>
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
required
|
||||
autoFocus
|
||||
tabIndex={1}
|
||||
autoComplete="email"
|
||||
placeholder="email@example.com"
|
||||
defaultValue={qaAccount?.email}
|
||||
defaultValue={qaAccount?.email ?? participationIdentity().email}
|
||||
/>
|
||||
<InputError
|
||||
message={errors.email ?? pageErrors.email}
|
||||
@@ -77,14 +77,14 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Label htmlFor="password">Palavra-passe</Label>
|
||||
{canResetPassword && (
|
||||
<TextLink
|
||||
href={request()}
|
||||
className="ml-auto text-sm"
|
||||
tabIndex={5}
|
||||
>
|
||||
Forgot your password?
|
||||
Esqueceu a palavra-passe?
|
||||
</TextLink>
|
||||
)}
|
||||
</div>
|
||||
@@ -94,7 +94,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
required
|
||||
tabIndex={2}
|
||||
autoComplete="current-password"
|
||||
placeholder="Password"
|
||||
placeholder="Palavra-passe"
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
@@ -105,7 +105,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
name="remember"
|
||||
tabIndex={3}
|
||||
/>
|
||||
<Label htmlFor="remember">Remember me</Label>
|
||||
<Label htmlFor="remember">Manter sessão iniciada</Label>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
@@ -116,15 +116,15 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
data-test="login-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Log in
|
||||
Entrar
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* @chisel-registration */}
|
||||
<div className="text-muted-foreground text-center text-sm">
|
||||
Don't have an account?{' '}
|
||||
Ainda não tem conta?{' '}
|
||||
<TextLink href={register()} tabIndex={5}>
|
||||
Sign up
|
||||
Criar conta
|
||||
</TextLink>
|
||||
</div>
|
||||
{/* @end-chisel-registration */}
|
||||
@@ -142,6 +142,6 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
}
|
||||
|
||||
Login.layout = {
|
||||
title: 'Log in to your account',
|
||||
description: 'Enter your email and password below to log in',
|
||||
title: 'Entrar na sua conta',
|
||||
description: 'Entre para continuar a operação que escolheu. Os dados preenchidos permanecem guardados neste navegador.',
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { participationIdentity } from '@/lib/participation-identity';
|
||||
import { Form, Head } from '@inertiajs/react';
|
||||
import InputError from '@/components/input-error';
|
||||
import PasswordInput from '@/components/password-input';
|
||||
@@ -16,7 +17,7 @@ type Props = {
|
||||
export default function Register({ passwordRules }: Props) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Register" />
|
||||
<Head title="Criar conta" />
|
||||
<Form
|
||||
{...store.form()}
|
||||
resetOnSuccess={['password', 'password_confirmation']}
|
||||
@@ -27,16 +28,16 @@ export default function Register({ passwordRules }: Props) {
|
||||
<>
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Label htmlFor="name">Nome</Label>
|
||||
<Input
|
||||
id="name"
|
||||
defaultValue={participationIdentity().name}
|
||||
type="text"
|
||||
required
|
||||
autoFocus
|
||||
tabIndex={1}
|
||||
autoComplete="name"
|
||||
name="name"
|
||||
placeholder="Full name"
|
||||
placeholder="Nome completo"
|
||||
/>
|
||||
<InputError
|
||||
message={errors.name}
|
||||
@@ -45,9 +46,10 @@ export default function Register({ passwordRules }: Props) {
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
defaultValue={participationIdentity().email}
|
||||
type="email"
|
||||
required
|
||||
tabIndex={2}
|
||||
@@ -59,14 +61,14 @@ export default function Register({ passwordRules }: Props) {
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Label htmlFor="password">Palavra-passe</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
required
|
||||
tabIndex={3}
|
||||
autoComplete="new-password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
placeholder="Palavra-passe"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
@@ -74,7 +76,7 @@ export default function Register({ passwordRules }: Props) {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password_confirmation">
|
||||
Confirm password
|
||||
Confirmar palavra-passe
|
||||
</Label>
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
@@ -82,7 +84,7 @@ export default function Register({ passwordRules }: Props) {
|
||||
tabIndex={4}
|
||||
autoComplete="new-password"
|
||||
name="password_confirmation"
|
||||
placeholder="Confirm password"
|
||||
placeholder="Confirmar palavra-passe"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError
|
||||
@@ -97,14 +99,14 @@ export default function Register({ passwordRules }: Props) {
|
||||
data-test="register-user-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Create account
|
||||
Criar conta
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="text-muted-foreground text-center text-sm">
|
||||
Already have an account?{' '}
|
||||
Já tem conta?{' '}
|
||||
<TextLink href={login()} tabIndex={6}>
|
||||
Log in
|
||||
Entrar
|
||||
</TextLink>
|
||||
</div>
|
||||
</>
|
||||
@@ -115,6 +117,6 @@ export default function Register({ passwordRules }: Props) {
|
||||
}
|
||||
|
||||
Register.layout = {
|
||||
title: 'Create an account',
|
||||
description: 'Enter your details below to create your account',
|
||||
title: 'Criar conta',
|
||||
description: 'Crie uma conta simples para continuar e acompanhar a sua operação. Não é necessário configurar MFA para participar.',
|
||||
};
|
||||
|
||||
@@ -190,9 +190,9 @@ export default function RequestPage({
|
||||
{request.protocol && (
|
||||
<a
|
||||
className="underline"
|
||||
href={`/balcao-virtual/pedidos/${request.id}/recibo`}
|
||||
href={`/balcao-virtual/pedidos/${request.id}/recibo?format=html`}
|
||||
>
|
||||
Descarregar recibo interno e snapshot
|
||||
Consultar e imprimir recibo interno
|
||||
</a>
|
||||
)}
|
||||
</section>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useInterestDraft } from '@/hooks/use-interest-draft';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import type { FormEvent } from 'react';
|
||||
@@ -38,7 +39,7 @@ export default function BusinessInterest({
|
||||
returnUrl = '/negocios',
|
||||
countries,
|
||||
}: Props) {
|
||||
const [form, setForm] = useState<Form>({
|
||||
const draft = useInterestDraft<Form>('business:' + record.id, {
|
||||
declared_origin_country_code: '',
|
||||
fullName: '',
|
||||
email: '',
|
||||
@@ -52,11 +53,12 @@ export default function BusinessInterest({
|
||||
privacyConsent: false,
|
||||
shareWithProponent: false,
|
||||
});
|
||||
const {form, setForm} = draft;
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
const [fieldErrors, setFieldErrors] = useState<Partial<Record<keyof Form, string>>>({});
|
||||
const [receipt, setReceipt] = useState('');
|
||||
const key = useRef(newSubmissionKey());
|
||||
const key = useRef(draft.key);
|
||||
const update = <K extends keyof Form>(field: K, value: Form[K]) => {
|
||||
setForm((current) => ({ ...current, [field]: value }));
|
||||
setFieldErrors((current) => ({ ...current, [field]: undefined }));
|
||||
@@ -102,6 +104,7 @@ export default function BusinessInterest({
|
||||
existingBusinessId: record.id,
|
||||
}),
|
||||
});
|
||||
if (response.status === 401) { draft.authenticate(); return; }
|
||||
const data = await response.json();
|
||||
if (!response.ok) {
|
||||
const errors: Partial<Record<keyof Form, string>> = {};
|
||||
@@ -117,6 +120,7 @@ export default function BusinessInterest({
|
||||
return;
|
||||
}
|
||||
setFieldErrors({});
|
||||
draft.clear();
|
||||
setReceipt(data.data.reference);
|
||||
key.current = newSubmissionKey();
|
||||
} catch (cause) {
|
||||
@@ -140,7 +144,7 @@ export default function BusinessInterest({
|
||||
{receipt ? (
|
||||
<section className={card} role="status">
|
||||
<h2 className="text-xl font-bold">Pedido recebido</h2>
|
||||
<p>Referência: {receipt}</p>
|
||||
<p>Referência: {receipt}</p><Link href="/investidor/manifestacoes" className="underline">Acompanhar manifestações</Link>
|
||||
<p>
|
||||
A equipa fará a triagem antes de qualquer partilha com o
|
||||
proponente.
|
||||
|
||||
@@ -32,6 +32,7 @@ type Props = {
|
||||
record: Business;
|
||||
modalities: string[];
|
||||
formSchema: FormSchema;
|
||||
modalityFormType?: string | null;
|
||||
objects: BusinessObject[];
|
||||
objectKinds: string[];
|
||||
sectors: { id: number; name: string }[];
|
||||
@@ -176,42 +177,11 @@ function TerritoryField({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
function opportunityTypeFor(modality: string): string {
|
||||
if (
|
||||
[
|
||||
'investment_project',
|
||||
'company_sale',
|
||||
'asset_sale',
|
||||
'business_partnership',
|
||||
'financing_request',
|
||||
'concession_opportunity',
|
||||
'supply_opportunity',
|
||||
].includes(modality)
|
||||
)
|
||||
return modality;
|
||||
if (['participation_sale'].includes(modality)) return 'company_sale';
|
||||
if (['asset_lease'].includes(modality)) return 'asset_sale';
|
||||
if (['capital_increase', 'financial_investor'].includes(modality))
|
||||
return 'financing_request';
|
||||
if (['strategic_partner', 'joint_venture'].includes(modality))
|
||||
return 'business_partnership';
|
||||
if (
|
||||
[
|
||||
'expansion',
|
||||
'agricultural_investment',
|
||||
'internationalization',
|
||||
].includes(modality)
|
||||
)
|
||||
return 'investment_project';
|
||||
if (['buyer_search', 'position_assignment'].includes(modality))
|
||||
return 'company_sale';
|
||||
return 'investment_project';
|
||||
}
|
||||
|
||||
export default function BusinessWizard({
|
||||
countries,
|
||||
record,
|
||||
formSchema,
|
||||
modalityFormType,
|
||||
objects,
|
||||
objectKinds,
|
||||
sectors,
|
||||
@@ -223,7 +193,7 @@ export default function BusinessWizard({
|
||||
...record.payload,
|
||||
opportunity_type:
|
||||
record.payload.opportunity_type ??
|
||||
opportunityTypeFor(record.modality),
|
||||
modalityFormType ?? '',
|
||||
wizard_version: '2',
|
||||
};
|
||||
if (
|
||||
@@ -236,9 +206,7 @@ export default function BusinessWizard({
|
||||
}
|
||||
return initial;
|
||||
});
|
||||
const [modality, setModality] = useState(
|
||||
record.payload.opportunity_type ?? opportunityTypeFor(record.modality),
|
||||
);
|
||||
const modality = record.modality;
|
||||
const [sectorId, setSectorId] = useState(record.sector_id ?? null);
|
||||
const [sectorSearch, setSectorSearch] = useState('');
|
||||
const [publicTitle, setPublicTitle] = useState(record.public_title ?? '');
|
||||
@@ -397,7 +365,6 @@ export default function BusinessWizard({
|
||||
);
|
||||
const update = (key: string, value: string) => {
|
||||
setError('');
|
||||
if (key === 'opportunity_type') setModality(value);
|
||||
setPayload((current) => {
|
||||
const next = { ...current, [key]: value };
|
||||
if (key === 'geography_scope' && value === 'multiple') {
|
||||
@@ -533,6 +500,8 @@ export default function BusinessWizard({
|
||||
)}
|
||||
>
|
||||
<div lang={english ? 'en' : 'pt'} className="space-y-5">
|
||||
<p>{t('Modalidade registada', 'Registered modality')}: {businessModalities[record.modality] ?? record.modality}</p>
|
||||
{!modalityFormType && <p role="status">{t('Pode guardar e recuperar esta preparação. O formulário específico de submissão desta modalidade ainda não está disponível; os dados e a modalidade original serão preservados.', 'You can save and recover this draft. Its specific submission form is not available yet; the original modality and data are preserved.')}</p>}
|
||||
<a className="underline" href={`/investidor/negocios/${record.id}/classificacao`}>{t('Classificação multidimensional deste anúncio', 'Multidimensional classification of this listing')}</a>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -14,6 +14,7 @@ import type { Country } from '@/components/country-select';
|
||||
type Props = {
|
||||
countries: Country[];
|
||||
formSchema: FormSchema;
|
||||
modalityFormType?: string | null;
|
||||
sectors: { id: number; name: string }[];
|
||||
record: Business;
|
||||
canEdit: boolean;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { usePortalQuery } from '@/hooks/use-portal-query';
|
||||
import SearchState from '@/components/search-state';
|
||||
import CatalogueNavigation from '@/components/catalogue-navigation';
|
||||
import { ClassificationFilters } from '@/components/opportunity-classification';
|
||||
import { Link, router, useForm, usePage } from '@inertiajs/react';
|
||||
@@ -114,9 +116,7 @@ export default function Catalogue({
|
||||
{ id: string; title: string; kind: string; url: string }[]
|
||||
>([]);
|
||||
const [error, setError] = useState('');
|
||||
const [suggestions, setSuggestions] = useState<
|
||||
{ title: string; slug: string }[]
|
||||
>([]);
|
||||
const [mapAttempt, setMapAttempt] = useState(0);
|
||||
const filterKey = JSON.stringify(filters);
|
||||
const draftFilterKey = JSON.stringify(form.data);
|
||||
const lastRequest = useRef(draftFilterKey);
|
||||
@@ -189,29 +189,9 @@ export default function Catalogue({
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [view, filterKey]);
|
||||
useEffect(() => {
|
||||
if (form.data.q.length < 2) {
|
||||
setSuggestions([]);
|
||||
return;
|
||||
}
|
||||
let active = true;
|
||||
const timer = setTimeout(() => {
|
||||
api(
|
||||
`/api/v1/investment/suggest?q=${encodeURIComponent(form.data.q)}`,
|
||||
)
|
||||
.then((data) => {
|
||||
if (active) setSuggestions(data.opportunities);
|
||||
})
|
||||
.catch(() => {
|
||||
if (active) setSuggestions([]);
|
||||
});
|
||||
}, 300);
|
||||
return () => {
|
||||
active = false;
|
||||
clearTimeout(timer);
|
||||
};
|
||||
}, [form.data.q]);
|
||||
}, [view, filterKey, mapAttempt]);
|
||||
const suggestionQuery = usePortalQuery<{opportunities:{title:string;slug:string}[]}>(`/api/v1/investment/suggest?q=${encodeURIComponent(form.data.q)}`, 300);
|
||||
const currentSuggestions = form.data.q.length >= 2 ? suggestionQuery.data?.opportunities ?? [] : [];
|
||||
const query = () => {
|
||||
const params = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(filters)) {
|
||||
@@ -369,13 +349,14 @@ export default function Catalogue({
|
||||
aria-describedby="search-suggestions"
|
||||
/>
|
||||
</Field>
|
||||
{suggestions.length > 0 && (
|
||||
{form.data.q.length >= 2 && <SearchState loading={suggestionQuery.loading} error={suggestionQuery.error} total={currentSuggestions.length} retry={suggestionQuery.retry} />}
|
||||
{currentSuggestions.length > 0 && (
|
||||
<ul
|
||||
id="search-suggestions"
|
||||
aria-label="Sugestões de pesquisa"
|
||||
className="space-y-2"
|
||||
>
|
||||
{suggestions.map((s) => (
|
||||
{currentSuggestions.map((s) => (
|
||||
<li key={s.slug}>
|
||||
<Link
|
||||
href={`/oportunidades/${s.slug}`}
|
||||
@@ -1130,7 +1111,7 @@ export default function Catalogue({
|
||||
Favoritos e pedidos
|
||||
</Link>
|
||||
</div>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
<SearchState loading={points === null && !error} error={error} total={(points?.length ?? 0) + unlocated.length} retry={() => setMapAttempt(value => value + 1)} />
|
||||
{!error && <Map points={points} areas={areas} />}
|
||||
{['map', 'combined'].includes(view) && (
|
||||
<TerritoryGeometryPreview
|
||||
|
||||
@@ -28,8 +28,10 @@ export default function EditContext({
|
||||
return (
|
||||
<Management title={'Contexto: ' + record.title}>
|
||||
<p>
|
||||
As relações e características são parte da ficha publicada.
|
||||
Guardar devolve-a a rascunho para revisão.
|
||||
Associações territoriais e produtivas ligam esta oportunidade a
|
||||
corredores, clusters e projectos; não substituem o registo de
|
||||
onde se localiza. As relações e características são parte da
|
||||
ficha publicada. Guardar devolve-a a rascunho para revisão.
|
||||
</p>
|
||||
<Link
|
||||
href={`/management/opportunities/${record.id}/edit`}
|
||||
@@ -37,6 +39,18 @@ export default function EditContext({
|
||||
>
|
||||
Editar e publicar a ficha principal
|
||||
</Link>
|
||||
<p>
|
||||
As localizações documentadas são preparadas nos recursos da
|
||||
ficha, reutilizando a hierarquia existente. As referências
|
||||
anteriores abaixo são preservadas; não constituem confirmação de
|
||||
implantação ou de regime especial.
|
||||
</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/opportunities/${record.id}/resources`}
|
||||
>
|
||||
Onde se localiza — consultar ou documentar locais
|
||||
</Link>
|
||||
<form
|
||||
className="space-y-6"
|
||||
onSubmit={(e) => {
|
||||
@@ -78,7 +92,7 @@ export default function EditContext({
|
||||
'Clusters',
|
||||
'Corredores',
|
||||
'Projectos âncora',
|
||||
'Localizações',
|
||||
'Referências territoriais anteriores',
|
||||
][i]
|
||||
}
|
||||
</legend>
|
||||
|
||||
@@ -22,7 +22,8 @@ export default function Detail({
|
||||
returnUrl?: string;
|
||||
dossierOrigin?: { id: string; title: string } | null;
|
||||
}) {
|
||||
const { auth } = usePage<{ auth: { user: unknown } }>().props;
|
||||
const page = usePage<{ auth: { user: unknown } }>();
|
||||
const { auth } = page.props;
|
||||
const [sharing, setSharing] = useState('');
|
||||
return (
|
||||
<Frame title={r.title}>
|
||||
@@ -61,9 +62,7 @@ export default function Detail({
|
||||
<ClassificationSummary rows={c.classification ?? []} />
|
||||
<TerritorialSources sources={c.source_evidence} />
|
||||
<section className={card + ' space-y-3'}>
|
||||
<h2 className="text-xl font-bold">
|
||||
Implantação declarada da oportunidade
|
||||
</h2>
|
||||
<h2 className="text-xl font-bold">Onde se localiza</h2>
|
||||
<p>
|
||||
As relações cadastradas não confirmam disponibilidade ou
|
||||
capacidade. Locais dos projetos associados, áreas de impacto
|
||||
@@ -111,7 +110,7 @@ export default function Detail({
|
||||
Preparar manifestação de interesse
|
||||
</button>
|
||||
) : (
|
||||
<Link className={button} href="/login">
|
||||
<Link className={button} href={`/participar/entrar?return=${encodeURIComponent(page.url)}`}>
|
||||
Entrar para preparar manifestação
|
||||
</Link>
|
||||
)}
|
||||
@@ -237,7 +236,7 @@ export default function Detail({
|
||||
'Clusters',
|
||||
'Corredores',
|
||||
'Projectos âncora',
|
||||
'Territórios',
|
||||
'Referências territoriais anteriores',
|
||||
][i]
|
||||
}
|
||||
</h2>
|
||||
|
||||
@@ -9,6 +9,9 @@ import { Conversation } from './conversation';
|
||||
import type { Message } from './conversation';
|
||||
import CountrySelect, { type Country } from '@/components/country-select';
|
||||
type Payload = {
|
||||
simple_participation?: boolean;
|
||||
opportunity_title?: string;
|
||||
opportunity_reference?: string;
|
||||
full_name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
@@ -82,7 +85,7 @@ type Props = {
|
||||
needs: Need[];
|
||||
attachments: { id: string; file_name: string }[];
|
||||
events: { action: string; version: number; created_at: string }[];
|
||||
receipt: { reference: string; status: string } | null;
|
||||
receipt: { reference: string; status: string; next_action?: string | null; next_action_due_at?: string | null } | null;
|
||||
target: string | null;
|
||||
management: boolean;
|
||||
messages: Message[];
|
||||
@@ -338,6 +341,16 @@ function Editor({
|
||||
)[receipt.status] ?? receipt.status}
|
||||
</p>
|
||||
)}
|
||||
{receipt?.next_action && <p role="status">Próxima acção: {receipt.next_action} {receipt.next_action_due_at && new Date(receipt.next_action_due_at).toLocaleDateString("pt-MZ")}</p>}
|
||||
{s.status === 'submitted' && s.payload.simple_participation ? <section className={card}>
|
||||
<h2 className="text-xl font-bold">Dados da manifestação</h2>
|
||||
<dl className="mt-3 space-y-3">{[
|
||||
['Nome', s.payload.full_name], ['Email', s.payload.email],
|
||||
['Telefone', s.payload.phone], ['País declarado', s.payload.country],
|
||||
['Sector', s.payload.sector], ['Oportunidade', target],
|
||||
['Mensagem', s.payload.objective],
|
||||
].filter(([,value]) => value).map(([label,value]) => <div key={label}><dt className="font-semibold">{label}</dt><dd className="whitespace-pre-wrap">{value}</dd></div>)}</dl>
|
||||
</section> : <>
|
||||
<nav
|
||||
aria-label="Etapas da manifestação"
|
||||
className="flex flex-wrap gap-2"
|
||||
@@ -1117,6 +1130,7 @@ function Editor({
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
</>}
|
||||
<details className={card}>
|
||||
<summary className="cursor-pointer font-bold">
|
||||
Histórico do pedido
|
||||
@@ -1130,7 +1144,7 @@ function Editor({
|
||||
draft_created: 'Rascunho criado',
|
||||
draft_saved: 'Rascunho guardado',
|
||||
attachment_added: 'Anexo acrescentado',
|
||||
submitted: 'Submetido',
|
||||
submitted: 'Submetido', received: 'Recebido', in_review: 'Em análise', contacted: 'Contactado', closed: 'Encerrado',
|
||||
} as Record<string, string>
|
||||
)[e.action] ?? e.action}{' '}
|
||||
· versão {e.version}
|
||||
|
||||
@@ -123,7 +123,15 @@ export default function Zones({
|
||||
Parques industriais
|
||||
</Link>
|
||||
</nav>
|
||||
<form method="get" className={card + ' grid gap-4 md:grid-cols-3'}>
|
||||
<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}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import ContextDocuments from '@/components/context-documents';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Frame, card, input, button } from '@/pages/investment/shared';
|
||||
@@ -26,6 +27,7 @@ export default function ContextStart({
|
||||
dossier. A referência é para preparação e não confirma direitos
|
||||
ou benefícios.
|
||||
</p>
|
||||
<ContextDocuments source={source ?? undefined} />
|
||||
{source && (
|
||||
<section className={card}>
|
||||
<h2 className="font-bold">Origem consultada</h2>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import ContextDocuments from '@/components/context-documents';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Frame, button, card, input } from '@/pages/investment/shared';
|
||||
@@ -130,6 +131,7 @@ export default function ContextEditor({
|
||||
}
|
||||
return (
|
||||
<Frame title="Contexto do investimento">
|
||||
<ContextDocuments source={view.context.selection.opportunity} />
|
||||
<div className="space-y-5 [overflow-wrap:anywhere]">
|
||||
<Link
|
||||
className="underline"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import ContextDocuments from '@/components/context-documents';
|
||||
import type { DossierContext } from '@/lib/investor-context';
|
||||
import FintechInvestment, {
|
||||
type FintechView,
|
||||
@@ -411,6 +412,9 @@ export default function InvestmentPath(path: Path) {
|
||||
Os meus investimentos
|
||||
</Link>
|
||||
<h1 className="text-2xl font-semibold">{path.case.title}</h1>
|
||||
<ContextDocuments
|
||||
source={path.investment_context?.selection.opportunity}
|
||||
/>
|
||||
{path.investment_context && (
|
||||
<section className="space-y-2 rounded border border-emerald-300 bg-emerald-50 p-4">
|
||||
<h2 className="font-semibold">
|
||||
|
||||
@@ -22,13 +22,13 @@ export default function PrintCase({
|
||||
const p = record.payload ?? {};
|
||||
const text = (value: unknown): string =>
|
||||
value === null || value === undefined || value === ''
|
||||
? '—'
|
||||
? 'Não informado'
|
||||
: Array.isArray(value)
|
||||
? value.map(text).join(', ')
|
||||
: typeof value === 'object'
|
||||
? Object.values(value as Record<string, unknown>)
|
||||
.map(text)
|
||||
.filter((x) => x !== '—')
|
||||
.filter((x) => x !== 'Não informado')
|
||||
.join(' · ')
|
||||
: displayValue(value);
|
||||
return (
|
||||
@@ -45,7 +45,7 @@ export default function PrintCase({
|
||||
</button>
|
||||
</div>
|
||||
<header className="space-y-2 border-b pb-4">
|
||||
<p>InvestMoz · modelo de preparação · {modelVersion}</p>
|
||||
<p>InvesteMoz · modelo de preparação · {modelVersion}</p>
|
||||
<h1 className="text-2xl font-bold">
|
||||
Terra e DUAT — dados preenchidos pelo requerente
|
||||
</h1>
|
||||
@@ -56,7 +56,7 @@ export default function PrintCase({
|
||||
</p>
|
||||
<p className="font-semibold">{disclaimer}</p>
|
||||
<p>
|
||||
Esta cópia reflecte os dados guardados no InvestMoz e não é
|
||||
Esta cópia reflecte os dados guardados no InvesteMoz e não é
|
||||
requerimento oficialmente recebido, título, parecer, prova
|
||||
de consulta ou decisão.
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Head, router, usePage } from '@inertiajs/react';
|
||||
import { useRef, useState } from 'react';
|
||||
type Row={id:string;protocol:string;status:string;version:number;analyst_id:number|null;due_at:string|null;etag?:string};
|
||||
export default function DeskAssignments(){
|
||||
const {requests,analysts,kind,flash}=usePage<{requests:Row[];analysts:{id:number;name:string}[];kind?:'interest';flash?:{success?:string}}>().props;
|
||||
const alertRef=useRef<HTMLDivElement>(null);
|
||||
const stateNames:Record<string,string>={received:'Recebido',submitted:'Submetido',in_review:'Em revisão',reviewed:'Revisto',qualification:'Em qualificação',qualified:'Qualificado',contacted:'Contactado',contact_accepted:'Contacto aceite',referred:'Encaminhado',due_diligence:'Em diligência',negotiation:'Em negociação',pending:'Pendente',accepted:'Aceite',rejected:'Recusado',returned:'Devolvido',processing:'Em tratamento',draft:'Rascunho'};
|
||||
const title=kind==='interest'?'Atribuições de interesses':'Atribuições do Balcão';
|
||||
const [selected,setSelected]=useState<Record<string,string>>({});
|
||||
const [reason,setReason]=useState<Record<string,string>>({});
|
||||
const [errors,setErrors]=useState<Record<string,string>>({});
|
||||
const [busy,setBusy]=useState<string|null>(null);
|
||||
function assign(row:Row){setBusy(row.id);setErrors({});router.post(kind==='interest'?`/management/interests/${row.id}/responsavel`:`/balcao-virtual/pedidos/${row.id}/responsavel`,{...(kind==='interest'?{etag:row.etag}:{version:row.version}),analyst_id:selected[row.id]??String(row.analyst_id??''),reason:reason[row.id]??''},{preserveScroll:true,onError:e=>{setErrors(e);queueMicrotask(()=>alertRef.current?.focus());},onFinish:()=>setBusy(null)});}
|
||||
return <main className="mx-auto max-w-5xl space-y-6 p-6"><Head title={title}/><h1 className="text-2xl font-semibold">{title}</h1><p>Atribua o acompanhamento de um pedido. Esta lista não dá acesso ao conteúdo privado do dossier. O proponente não pode ser designado como analista do seu pedido.</p><a href={kind==='interest'?'/management/interests':'/balcao-virtual/painel'} className="underline">{kind==='interest'?'Interesses atribuídos':'Voltar ao Balcão'}</a><div ref={alertRef} role="alert" tabIndex={-1}>{Object.values(errors).join(' ')}</div>{flash?.success&&<p role="status">{flash.success}</p>}{requests.length===0?<p>Não há pedidos para atribuir.</p>:requests.map(row=><section key={row.id} className="space-y-3 rounded border p-4"><h2 className="font-semibold">{row.protocol||row.id}</h2><p>Estado: {stateNames[row.status]??'Por esclarecer'}</p><label className="block">Responsável<select className="ml-2 border p-2" value={selected[row.id]??String(row.analyst_id??'')} onChange={e=>setSelected({...selected,[row.id]:e.target.value})}><option value="">Seleccione</option>{analysts.map(a=><option key={a.id} value={a.id}>{a.name}</option>)}</select></label><label className="block">Fundamento<textarea className="block w-full border p-2" value={reason[row.id]??''} onChange={e=>setReason({...reason,[row.id]:e.target.value})}/></label><button className="rounded bg-emerald-900 px-4 py-2 text-white" disabled={busy!==null} onClick={()=>assign(row)}>{busy===row.id?'A guardar…':'Guardar atribuição'}</button></section>)}</main>;
|
||||
}
|
||||
@@ -245,6 +245,14 @@ export default function OpportunityDraft({
|
||||
<Link href={basePath}>
|
||||
{profileMode ? 'Minhas oportunidades' : 'Voltar à gestão'}
|
||||
</Link>
|
||||
{record && (
|
||||
<Link
|
||||
href={`/investimentos/iniciar?source=opportunity:${record.id}`}
|
||||
className={button}
|
||||
>
|
||||
Preparar ou continuar investimento com esta ficha
|
||||
</Link>
|
||||
)}
|
||||
{profileMode && (
|
||||
<section
|
||||
aria-label="Âmbito desta entrega"
|
||||
@@ -459,7 +467,18 @@ export default function OpportunityDraft({
|
||||
disabled={busy || readOnly || unavailable}
|
||||
className="space-y-4"
|
||||
>
|
||||
<section aria-label="Localização registada">
|
||||
<section aria-label="Onde se localiza — referência principal">
|
||||
<h2 className="font-semibold">
|
||||
Onde se localiza — referência principal
|
||||
</h2>
|
||||
<p>
|
||||
Seleccione o território conhecido. Endereço,
|
||||
geometria e locais adicionais documentados podem
|
||||
ser preparados em Localizações, reutilizando
|
||||
esta hierarquia. Uma referência provincial não
|
||||
determina distrito, coordenadas ou pertença a
|
||||
uma associação.
|
||||
</p>
|
||||
<TerritoryGeometryPreview
|
||||
territoryId={path.at(-1)?.id}
|
||||
management
|
||||
@@ -863,7 +882,7 @@ export default function OpportunityDraft({
|
||||
)}
|
||||
{record && !profileMode && (
|
||||
<Link href={`${basePath}/${record.id}/context`}>
|
||||
Consultar projetos, clusters e relações existentes
|
||||
Associações territoriais e produtivas existentes
|
||||
</Link>
|
||||
)}
|
||||
{profileMode && canonicalOptions && (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import OpportunityLibraryReuse, {
|
||||
type LibrarySource,
|
||||
} from '@/components/opportunity-library-reuse';
|
||||
import { createOperationKey } from '@/lib/operation-key';
|
||||
import { valueText } from '@/lib/value-text';
|
||||
import { Link, router, usePage } from '@inertiajs/react';
|
||||
@@ -69,7 +72,7 @@ const fields: Record<Kind, string[]> = {
|
||||
const labels: Record<string, string> = {
|
||||
role: 'Papel da localização',
|
||||
imageRole: 'Tipo de imagem',
|
||||
territorial_purpose: 'Natureza da relação territorial',
|
||||
territorial_purpose: 'Finalidade deste local',
|
||||
rights_status: 'Direitos de utilização',
|
||||
visibility: 'Âmbito de consulta',
|
||||
classification: 'Classificação documental',
|
||||
@@ -98,6 +101,20 @@ const labels: Record<string, string> = {
|
||||
section: 'Página / secção',
|
||||
supported_statement: 'Afirmação fundamentada',
|
||||
};
|
||||
const localLabels: Record<string, string> = {
|
||||
implementation: 'Implantação',
|
||||
context: 'Contexto',
|
||||
impact: 'Impacto',
|
||||
coverage: 'Abrangência',
|
||||
headquarters: 'Sede',
|
||||
production: 'Produção',
|
||||
raw_material: 'Matéria-prima',
|
||||
storage: 'Armazenagem',
|
||||
logistics: 'Logística',
|
||||
market: 'Mercado',
|
||||
support: 'Apoio',
|
||||
other: 'Outro',
|
||||
};
|
||||
const choices: Record<string, string[]> = {
|
||||
role: [
|
||||
'headquarters',
|
||||
@@ -133,6 +150,8 @@ export default function OpportunityResources({
|
||||
existingLocations,
|
||||
assessment,
|
||||
imageProcessingAvailable,
|
||||
librarySources = [],
|
||||
locationReference = { path: [], differences: [] },
|
||||
}: {
|
||||
opportunity: {
|
||||
id: number;
|
||||
@@ -145,6 +164,11 @@ export default function OpportunityResources({
|
||||
existingLocations: { id: string; name: string; location_type: string }[];
|
||||
assessment: string[];
|
||||
imageProcessingAvailable: boolean;
|
||||
librarySources?: LibrarySource[];
|
||||
locationReference?: {
|
||||
path: TerritoryOption[];
|
||||
differences: { resource_id: string; title: string; message: string }[];
|
||||
};
|
||||
}) {
|
||||
const {
|
||||
basePath = '/management/opportunities',
|
||||
@@ -322,11 +346,79 @@ export default function OpportunityResources({
|
||||
</p>
|
||||
)}
|
||||
{kind !== 'locations' && (
|
||||
<section aria-label="Privacidade dos anexos" className="rounded border p-3">
|
||||
<section
|
||||
aria-label="Privacidade dos anexos"
|
||||
className="rounded border p-3"
|
||||
>
|
||||
<h2>Privacidade dos anexos</h2>
|
||||
<p>Os anexos pertencem à oportunidade. Podem ser consultados pelos Promotores autorizados da organização, pelos Validadores e Publicadores com acesso ao tipo e âmbito e pelos Auditores autorizados. O Superutilizador precisa também de perfil operacional no âmbito e de elevação temporária para consulta, aprovada por outro titular. O gestor da biblioteca, por si só, não obtém esse acesso.</p>
|
||||
<p>Classificação e âmbito de consulta são metadados; escolher «public» ou «authenticated» não divulga o ficheiro. Publicar o anúncio não publica os anexos. A retirada lógica impede a entrega do ficheiro; a revogação do perfil impede acessos futuros.</p>
|
||||
<p>Partilhar um anexo com um destinatário individual ou restringi-lo a alguns membros da organização permanece indisponível. Não guarde neste fluxo um ficheiro que exija essa restrição individual. Não é possível retirar cópias já descarregadas.</p>
|
||||
<p>
|
||||
Os anexos pertencem à oportunidade. Podem ser
|
||||
consultados pelos Promotores autorizados da organização,
|
||||
pelos Validadores e Publicadores com acesso ao tipo e
|
||||
âmbito e pelos Auditores autorizados. O Superutilizador
|
||||
precisa também de perfil operacional no âmbito e de
|
||||
elevação temporária para consulta, aprovada por outro
|
||||
titular. O gestor da biblioteca, por si só, não obtém
|
||||
esse acesso.
|
||||
</p>
|
||||
<p>
|
||||
Classificação e âmbito de consulta são metadados;
|
||||
escolher «public» ou «authenticated» não divulga o
|
||||
ficheiro. Publicar o anúncio não publica os anexos. A
|
||||
retirada lógica impede a entrega do ficheiro; a
|
||||
revogação do perfil impede acessos futuros.
|
||||
</p>
|
||||
<p>
|
||||
Partilhar um anexo com um destinatário individual ou
|
||||
restringi-lo a alguns membros da organização permanece
|
||||
indisponível. Não guarde neste fluxo um ficheiro que
|
||||
exija essa restrição individual. Não é possível retirar
|
||||
cópias já descarregadas.
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
{kind === 'locations' && (
|
||||
<section
|
||||
aria-label="Onde se localiza"
|
||||
className="space-y-3 rounded border p-4"
|
||||
>
|
||||
<h2 className="text-xl font-semibold">Onde se localiza</h2>
|
||||
<p>
|
||||
Registe o local principal e os locais adicionais
|
||||
documentados: país, hierarquia territorial, endereço e
|
||||
geometria ou parcela quando conhecidos. Indique a
|
||||
finalidade de cada local: implantação, abrangência,
|
||||
impacto ou contexto. Uma área de contexto não comprova
|
||||
implantação.
|
||||
</p>
|
||||
<p>
|
||||
Referência principal já guardada:{' '}
|
||||
{locationReference.path.length
|
||||
? locationReference.path
|
||||
.map((item) => item.name)
|
||||
.join(' → ')
|
||||
: 'Não indicada'}
|
||||
. Os níveis em falta continuam desconhecidos.
|
||||
</p>
|
||||
<p>
|
||||
Pode guardar a preparação incompleta. No percurso de
|
||||
submissão existente são conferidos distrito, papel,
|
||||
indicação de principal e uma única localização principal
|
||||
seleccionada; área e unidade devem ser coerentes quando
|
||||
preenchidas. Não se acrescentam obrigatoriedades ao
|
||||
guardar este recurso.
|
||||
</p>
|
||||
{locationReference.differences.map((item) => (
|
||||
<p role="status" key={item.resource_id}>
|
||||
{item.title}: {item.message}
|
||||
</p>
|
||||
))}
|
||||
<p>
|
||||
Corredores, clusters, ZEE, ZFI, parques e projectos
|
||||
associados são descritos nas associações da ficha, com
|
||||
finalidade, fonte e estado próprios. Estar num distrito
|
||||
não confirma pertença a nenhum deles.
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
<section>
|
||||
@@ -339,7 +431,11 @@ export default function OpportunityResources({
|
||||
</section>
|
||||
{existingLocations.length > 0 && (
|
||||
<section>
|
||||
<h2>Ligações territoriais existentes preservadas</h2>
|
||||
<h2>Referências territoriais anteriores — preservadas</h2>
|
||||
<p>
|
||||
Estas referências não são novas associações confirmadas
|
||||
nem obrigam a repetir o preenchimento.
|
||||
</p>
|
||||
{existingLocations.map((r) => (
|
||||
<p key={r.id}>
|
||||
{r.name} · {r.location_type}
|
||||
@@ -347,6 +443,13 @@ export default function OpportunityResources({
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
{!readOnly && kind === 'documents' && (
|
||||
<OpportunityLibraryReuse
|
||||
sources={librarySources}
|
||||
action={`${basePath}/${opportunity.id}/library-support`}
|
||||
etag={etag}
|
||||
/>
|
||||
)}
|
||||
<nav className="flex flex-wrap gap-3">
|
||||
{(['locations', 'images', 'documents'] as Kind[]).map((k) => (
|
||||
<button
|
||||
@@ -377,6 +480,12 @@ export default function OpportunityResources({
|
||||
? 'eliminado logicamente'
|
||||
: 'rascunho'}
|
||||
</p>
|
||||
{!!r.payload.library_source && (
|
||||
<p>
|
||||
Original da biblioteca reutilizado; edição e
|
||||
hash preservados, sem cópia dos bytes.
|
||||
</p>
|
||||
)}
|
||||
{r.file && (
|
||||
<p className="break-all">
|
||||
Scan: {r.file.malware_scan_status} · motor:{' '}
|
||||
@@ -437,6 +546,39 @@ export default function OpportunityResources({
|
||||
</h2>
|
||||
{kind === 'locations' && (
|
||||
<div>
|
||||
{locationReference.path.length > 0 && (
|
||||
<div className="my-3 rounded border p-3">
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
disabled={
|
||||
readOnly ||
|
||||
Boolean(editing) ||
|
||||
path.length > 0 ||
|
||||
foreignCountry
|
||||
}
|
||||
onClick={() => {
|
||||
setPath(locationReference.path);
|
||||
setPayload((previous) => ({
|
||||
...previous,
|
||||
country_code: 'MZ',
|
||||
}));
|
||||
setMessage(
|
||||
'Hierarquia principal reutilizada no preenchimento. Só foi reutilizada a hierarquia: coordenadas e parcela não foram copiadas. Papel, finalidade, fonte e indicação de principal continuam sob a sua escolha; nada foi guardado automaticamente.',
|
||||
);
|
||||
}}
|
||||
>
|
||||
Reutilizar hierarquia principal guardada
|
||||
</button>
|
||||
<p>
|
||||
Use-a quando documentar o mesmo território.
|
||||
Para um local diferente, escolha outra
|
||||
hierarquia. A reutilização não substitui um
|
||||
local em edição, um país estrangeiro ou uma
|
||||
selecção já preenchida.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<Field
|
||||
label="País da localização"
|
||||
error={errors.country_code}
|
||||
@@ -549,6 +691,7 @@ export default function OpportunityResources({
|
||||
key={key}
|
||||
aria-label="Original / substituir por nova versão"
|
||||
type="file"
|
||||
disabled={!!editing?.payload.library_source}
|
||||
accept={
|
||||
kind === 'images'
|
||||
? '.jpg,.jpeg,.png,.webp'
|
||||
@@ -619,7 +762,11 @@ export default function OpportunityResources({
|
||||
>
|
||||
<option value="">Pendente</option>
|
||||
{choices[name].map((option) => (
|
||||
<option key={option}>{option}</option>
|
||||
<option key={option} value={option}>
|
||||
{kind === 'locations'
|
||||
? (localLabels[option] ?? option)
|
||||
: option}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
@@ -679,30 +826,53 @@ export default function OpportunityResources({
|
||||
</Field>
|
||||
),
|
||||
)}
|
||||
{kind !== 'documents' && (
|
||||
{kind === 'locations' && (
|
||||
<Field
|
||||
label="Local principal ou adicional"
|
||||
error={errors.is_primary}
|
||||
>
|
||||
<select
|
||||
aria-label="Local principal ou adicional"
|
||||
className={control}
|
||||
disabled={readOnly}
|
||||
value={
|
||||
typeof payload.is_primary === 'boolean'
|
||||
? payload.is_primary
|
||||
? 'primary'
|
||||
: 'additional'
|
||||
: ''
|
||||
}
|
||||
onChange={(event) =>
|
||||
set(
|
||||
'is_primary',
|
||||
event.target.value === ''
|
||||
? null
|
||||
: event.target.value === 'primary',
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
<option value="primary">Principal</option>
|
||||
<option value="additional">Adicional</option>
|
||||
</select>
|
||||
<p>
|
||||
A escolha identifica o papel do local nesta ficha;
|
||||
não confirma a sua implantação nem uma associação
|
||||
territorial.
|
||||
</p>
|
||||
</Field>
|
||||
)}
|
||||
{kind === 'images' && (
|
||||
<label>
|
||||
<input
|
||||
key={key}
|
||||
type="checkbox"
|
||||
checked={
|
||||
!!payload[
|
||||
kind === 'images'
|
||||
? 'is_cover'
|
||||
: 'is_primary'
|
||||
]
|
||||
}
|
||||
checked={!!payload.is_cover}
|
||||
onChange={(event) =>
|
||||
set(
|
||||
kind === 'images'
|
||||
? 'is_cover'
|
||||
: 'is_primary',
|
||||
event.target.checked,
|
||||
)
|
||||
set('is_cover', event.target.checked)
|
||||
}
|
||||
/>
|
||||
{kind === 'images'
|
||||
? 'Selecionar capa de preparação'
|
||||
: 'Localização principal'}
|
||||
Selecionar capa de preparação
|
||||
</label>
|
||||
)}
|
||||
<Field
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import SearchState from '@/components/search-state';
|
||||
import { useEffect, useState } from 'react';
|
||||
import InvestmentTerritory from '@/components/investment-territory';
|
||||
import { Management, Field, control } from './shared';
|
||||
@@ -10,8 +11,11 @@ export default function TerritoryAssociations() {
|
||||
const [rows, setRows] = useState<{ id: string; name: string }[]>([]);
|
||||
const [more, setMore] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [retry, setRetry] = useState(0);
|
||||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
setLoading(true); setError(''); setRows([]);
|
||||
const timer = setTimeout(async () => {
|
||||
try {
|
||||
const params = new URLSearchParams({
|
||||
@@ -31,21 +35,22 @@ export default function TerritoryAssociations() {
|
||||
'Não foi possível carregar os investimentos.',
|
||||
);
|
||||
const data = await response.json();
|
||||
if (controller.signal.aborted) return;
|
||||
setRows(data.data);
|
||||
setMore(Boolean(data.next_page_url));
|
||||
setError('');
|
||||
} 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); }
|
||||
}, 250);
|
||||
return () => {
|
||||
clearTimeout(timer);
|
||||
controller.abort();
|
||||
};
|
||||
}, [kind, q, page]);
|
||||
}, [kind, q, page, retry]);
|
||||
return (
|
||||
<Management title="Localizações dos investimentos">
|
||||
<Field label="Tipo de investimento">
|
||||
@@ -71,6 +76,7 @@ export default function TerritoryAssociations() {
|
||||
<option value="opportunities">Oportunidades</option>
|
||||
</select>
|
||||
</Field>
|
||||
<SearchState loading={loading} error={error} total={rows.length} retry={() => setRetry(value => value + 1)} />
|
||||
<Field label="Pesquisar investimento">
|
||||
<input
|
||||
className={control}
|
||||
|
||||
@@ -162,8 +162,12 @@ export default function Manage({
|
||||
requirementAssociationsEnabled,
|
||||
disclosureAuthorization,
|
||||
legacyContentEnabled = false,
|
||||
documentAccessOnly = false,
|
||||
editorialScopeOnly = false,
|
||||
}: {
|
||||
legacyContentEnabled?: boolean;
|
||||
documentAccessOnly?: boolean;
|
||||
editorialScopeOnly?: boolean;
|
||||
documents: DocumentFile[];
|
||||
resources: Resource[];
|
||||
requirementCatalogue: { key: string; label: string; tax: string }[];
|
||||
@@ -221,10 +225,14 @@ export default function Manage({
|
||||
);
|
||||
|
||||
return (
|
||||
<Management title="Biblioteca documental e Bolsa de Parcerias">
|
||||
<Management title={documentAccessOnly ? "Os meus ficheiros privados" : editorialScopeOnly ? "Gestão editorial do acervo autorizado" : "Biblioteca documental e Bolsa de Parcerias"}>
|
||||
{documentAccessOnly && <p>Carregue e consulte os seus ficheiros. Este acesso não permite publicar nem consultar ficheiros privados de outras contas.</p>}
|
||||
{!documentAccessOnly && <>
|
||||
{!editorialScopeOnly && <>
|
||||
<a className="underline" href="/management/editorial-installation">
|
||||
Estado da gestão editorial
|
||||
</a>
|
||||
</>}
|
||||
<section
|
||||
className="rounded border border-amber-700 bg-amber-50 p-4"
|
||||
aria-live="polite"
|
||||
@@ -236,6 +244,7 @@ export default function Manage({
|
||||
para revisão. A contagem não é certificação documental.
|
||||
</p>
|
||||
</section>
|
||||
</>}
|
||||
<section
|
||||
className="space-y-3 rounded border p-5"
|
||||
aria-label="Estado antimalware"
|
||||
@@ -410,6 +419,7 @@ export default function Manage({
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{!documentAccessOnly && <>
|
||||
<form
|
||||
className="space-y-4 rounded border p-5"
|
||||
onSubmit={(e) => {
|
||||
@@ -1398,6 +1408,7 @@ export default function Manage({
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
</>}
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1307,6 +1307,16 @@ 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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user