@@ -157,6 +157,7 @@ export default function OpportunityResources({
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [message, setMessage] = useState('');
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
const foreignCountry = Boolean(payload.country_code && payload.country_code !== 'MZ');
|
||||
const set = (name: string, value: Payload[string]) =>
|
||||
setPayload((previous) => ({ ...previous, [name]: value }));
|
||||
function select(nextKind: Kind, record: Resource | null = null) {
|
||||
@@ -239,7 +240,7 @@ export default function OpportunityResources({
|
||||
}
|
||||
setMessage(data.message);
|
||||
setEditing(null);
|
||||
setPayload({});
|
||||
setPayload(kind === 'locations' ? {country_code:'MZ'} : {});
|
||||
setPath([]);
|
||||
setGeometry('');
|
||||
setFile(null);
|
||||
@@ -272,8 +273,9 @@ export default function OpportunityResources({
|
||||
</Link>
|
||||
<p>
|
||||
Recursos de preparação. Não alteram automaticamente a ficha
|
||||
pública ou relações territoriais aceites. ClamD real pendente;
|
||||
scan simulado nunca verifica ficheiros reais.
|
||||
pública ou relações territoriais aceites. O estado e o motor
|
||||
do scan são apresentados por ficheiro e versão; um scan
|
||||
simulado nunca verifica ficheiros reais.
|
||||
</p>
|
||||
<div
|
||||
id="resource-result"
|
||||
@@ -300,9 +302,8 @@ export default function OpportunityResources({
|
||||
<p className="rounded border p-3">
|
||||
Pode guardar anexos para preparação. Cada ficheiro permanece
|
||||
sem download ou pré-visualização enquanto o seu scan não
|
||||
estiver concluído. ClamD pendente não impede guardar
|
||||
metadados, locais ou rascunhos; testes com scanner simulado
|
||||
não verificam os seus ficheiros.
|
||||
estiver concluído. Guardar metadados, locais ou rascunhos
|
||||
é independente do scan e não publica ficheiros.
|
||||
</p>
|
||||
)}
|
||||
<section>
|
||||
@@ -411,10 +412,37 @@ export default function OpportunityResources({
|
||||
</h2>
|
||||
{kind === 'locations' && (
|
||||
<div>
|
||||
<Field label="País da localização" error={errors.country_code}><select className={control} disabled={readOnly} value={String(payload.country_code ?? '')} onChange={e=>set('country_code',e.target.value)}><option value="">Por indicar</option>{countries.map(c=><option key={c.code} value={c.code}>{c.name}</option>)}</select></Field>
|
||||
{payload.country_code !== 'MZ' && <p>A hierarquia abaixo corresponde a Moçambique. Uma localização noutro país requer o seu próprio cadastro; não use territórios moçambicanos para a representar.</p>}
|
||||
<Field label="País da localização" error={errors.country_code}>
|
||||
<select
|
||||
className={control}
|
||||
disabled={readOnly}
|
||||
value={String(payload.country_code ?? '')}
|
||||
onChange={(event) => {
|
||||
const country = event.target.value;
|
||||
set('country_code', country || null);
|
||||
if (country && country !== 'MZ' && path.length) {
|
||||
setPath([]);
|
||||
setMessage('A seleção territorial de Moçambique foi retirada do preenchimento ao mudar de país. Guarde para registar a alteração; a geometria própria foi preservada.');
|
||||
}
|
||||
}}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
{countries.map(c=><option key={c.code} value={c.code}>{c.name}</option>)}
|
||||
</select>
|
||||
</Field>
|
||||
{foreignCountry && (
|
||||
<p>A hierarquia abaixo corresponde a Moçambique e não é aplicável ao país escolhido. Pode guardar uma localização incompleta noutro país sem esta hierarquia.</p>
|
||||
)}
|
||||
{foreignCountry && path.length > 0 && (
|
||||
<p role="alert">
|
||||
Este registo conserva uma seleção territorial de Moçambique incompatível com o país. Escolha Moçambique ou{' '}
|
||||
<button type="button" className="underline" disabled={readOnly} onClick={() => setPath([])}>
|
||||
retirar a seleção territorial deste preenchimento
|
||||
</button>. O registo guardado só muda quando guardar.
|
||||
</p>
|
||||
)}
|
||||
<TerritoryGeometryPreview
|
||||
territoryId={path.at(-1)?.id}
|
||||
territoryId={foreignCountry ? undefined : path.at(-1)?.id}
|
||||
management
|
||||
endpoint={basePath === '/minhas-oportunidades' ? '/minhas-oportunidades/territory-geometries' : undefined}
|
||||
/>
|
||||
@@ -424,6 +452,7 @@ export default function OpportunityResources({
|
||||
index={index}
|
||||
parent={path[index - 1]?.id ?? ''}
|
||||
selected={path[index]}
|
||||
disabled={readOnly || foreignCountry}
|
||||
endpoint={basePath === '/minhas-oportunidades' ? '/minhas-oportunidades/territory-options' : '/management/territory-options'}
|
||||
onChange={(value) =>
|
||||
setPath((previous) =>
|
||||
|
||||
@@ -55,7 +55,7 @@ export function Management({
|
||||
aiEnabled?: boolean;
|
||||
}>().props;
|
||||
return (
|
||||
<main className="space-y-6 p-4 md:p-8">
|
||||
<div className="space-y-6 p-4 md:p-8">
|
||||
<Head title={title} />
|
||||
{auth?.canManagePortal && basePath !== '/minhas-oportunidades' ? <nav
|
||||
className="flex flex-wrap gap-4 text-sm underline"
|
||||
@@ -116,7 +116,7 @@ export function Management({
|
||||
</p>
|
||||
)}
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user