oportunidades 7
tests / ci (push) Waiting to run

This commit is contained in:
2026-10-13 11:40:29 +02:00
parent 20971d523f
commit 287e991486
2902 changed files with 1085456 additions and 25957 deletions
+6 -1
View File
@@ -62,7 +62,12 @@ export function AppSidebar() {
});
}
}
items.push(...profileLinks(profileAccess).map(link => ({...link, icon: LayoutGrid})));
items.push(
...profileLinks(profileAccess).map((link) => ({
...link,
icon: LayoutGrid,
})),
);
return (
<Sidebar collapsible="icon" variant="inset">
<SidebarHeader>
@@ -11,6 +11,7 @@ export default function CountrySelect({
label = 'País',
required = false,
allowLegacyValue = false,
error,
}: {
countries: Country[];
value: string;
@@ -20,6 +21,7 @@ export default function CountrySelect({
label?: string;
required?: boolean;
allowLegacyValue?: boolean;
error?: string;
}) {
const generatedId = useId();
const [search, setSearch] = useState('');
@@ -52,6 +54,10 @@ export default function CountrySelect({
disabled={disabled}
id={id ?? generatedId}
aria-label={label}
aria-invalid={!!error}
aria-describedby={
error ? (id ?? generatedId) + '-error' : undefined
}
required={required}
className="w-full rounded border p-2"
value={value}
@@ -71,6 +77,15 @@ export default function CountrySelect({
</option>
))}
</select>
{error && (
<p
id={(id ?? generatedId) + '-error'}
role="alert"
className="text-red-700"
>
{error}
</p>
)}
{matches.length === 0 && (
<p role="status">Nenhum país corresponde à pesquisa.</p>
)}
@@ -1,3 +1,4 @@
import { createOperationKey } from '@/lib/operation-key';
import { useForm } from '@inertiajs/react';
import { card, input, button } from '@/pages/investment/shared';
@@ -197,7 +198,7 @@ export function RequestOperations({
occurred_at: '',
summary: '',
evidence: '',
client_key: crypto.randomUUID(),
client_key: createOperationKey(),
});
return (
<section className="space-y-3">
@@ -433,7 +434,7 @@ export function RequestOperations({
communication.reset('summary', 'evidence');
communication.setData(
'client_key',
crypto.randomUUID(),
createOperationKey(),
);
},
},
@@ -194,7 +194,7 @@ export default function InteractiveInvestmentMap({
{error && <p role="status">{error}</p>}
<div
ref={element}
className="relative z-0 h-[460px] w-full rounded"
className="relative z-0 h-[460px] w-full min-w-0 overflow-hidden rounded"
role="region"
aria-label="Mapa; navegação por setas e teclas mais e menos"
/>
@@ -256,10 +256,11 @@ export default function InteractiveInvestmentMap({
<a className="underline" href={area.url}>
{area.title}
</a>{' '}
· {area.purpose === 'administrative_boundary'
·{' '}
{area.purpose === 'administrative_boundary'
? 'Limite administrativo da edição indicada; não representa um local de investimento'
: 'Polígono cadastrado; comparação com limite administrativo pendente'} ·
Fonte: {area.source_reference ?? 'Não indicada'} · Data:{' '}
: 'Polígono cadastrado; comparação com limite administrativo pendente'}{' '}
· Fonte: {area.source_reference ?? 'Não indicada'} · Data:{' '}
{area.source_date ?? 'Não documentada'}
</p>
))}
@@ -1,9 +1,9 @@
import { useEffect, useState } from "react";
import TerritoryGeometryPreview from "./territory-geometry-preview";
import { useEffect, useState } from 'react';
import TerritoryGeometryPreview from './territory-geometry-preview';
import InteractiveInvestmentMap, {
type InvestmentMapFeature,
type InvestmentMapArea,
} from "./interactive-investment-map";
} from './interactive-investment-map';
export default function InvestmentMapPanel({
filters,
@@ -17,7 +17,7 @@ export default function InvestmentMapPanel({
const [missing, setMissing] = useState<
{ id: number; title: string; url: string }[]
>([]);
const [error, setError] = useState("");
const [error, setError] = useState('');
const [areas, setAreas] = useState<InvestmentMapArea[]>([]);
useEffect(() => {
const controller = new AbortController();
@@ -26,10 +26,10 @@ export default function InvestmentMapPanel({
setAreas([]);
fetch(`/api/v1/investment/map?${params}`, {
signal: controller.signal,
headers: { Accept: "application/json" },
headers: { Accept: 'application/json' },
})
.then(async (response) => {
if (!response.ok) throw new Error("Mapa indisponível.");
if (!response.ok) throw new Error('Mapa indisponível.');
return response.json();
})
.then((data) => {
@@ -39,8 +39,8 @@ export default function InvestmentMapPanel({
setMissing(data.unlocated ?? []);
setError(
data.truncated
? "Cobertura limitada: refine os filtros."
: "",
? 'Cobertura limitada: refine os filtros.'
: '',
);
})
.catch((e) => {
@@ -61,7 +61,7 @@ export default function InvestmentMapPanel({
filters.district_id ||
filters.province_id ||
filters.geo_location_id ||
"",
'',
)
}
/>
@@ -40,7 +40,10 @@ export function ProvinceSelect({
const [error, setError] = useState('');
const [retry, setRetry] = useState(0);
const [search, setSearch] = useState('');
const [geometrySelection, setGeometrySelection] = useState<{ value: string; id: string } | null>(null);
const [geometrySelection, setGeometrySelection] = useState<{
value: string;
id: string;
} | null>(null);
const [geometryFeedback, setGeometryFeedback] = useState('');
useEffect(() => {
@@ -49,19 +52,38 @@ export function ProvinceSelect({
setGeometryFeedback('');
if (!value) return;
// Preserve historical text. Only one exact catalogue match supplies a map ID.
void fetch(`${endpoint}?${new URLSearchParams({ type: 'province', page: '1', q: value })}`, {
signal: controller.signal, headers: { Accept: 'application/json' },
}).then(async (response) => {
if (!response.ok) throw new Error('Não foi possível consultar a correspondência cartográfica.');
const data = await response.json();
const matches = (data.data as Option[]).filter((option) => option.name === value);
if (controller.signal.aborted) return;
if (matches.length === 1 && !data.next_page_url)
setGeometrySelection({ value, id: matches[0].id });
else setGeometryFeedback('Seleção guardada preservada; sem correspondência cartográfica inequívoca neste cadastro.');
}).catch((cause: unknown) => {
if (!controller.signal.aborted) setGeometryFeedback(cause instanceof Error ? cause.message : 'Erro de ligação.');
});
void fetch(
`${endpoint}?${new URLSearchParams({ type: 'province', page: '1', q: value })}`,
{
signal: controller.signal,
headers: { Accept: 'application/json' },
},
)
.then(async (response) => {
if (!response.ok)
throw new Error(
'Não foi possível consultar a correspondência cartográfica.',
);
const data = await response.json();
const matches = (data.data as Option[]).filter(
(option) => option.name === value,
);
if (controller.signal.aborted) return;
if (matches.length === 1 && !data.next_page_url)
setGeometrySelection({ value, id: matches[0].id });
else
setGeometryFeedback(
'Seleção guardada preservada; sem correspondência cartográfica inequívoca neste cadastro.',
);
})
.catch((cause: unknown) => {
if (!controller.signal.aborted)
setGeometryFeedback(
cause instanceof Error
? cause.message
: 'Erro de ligação.',
);
});
return () => controller.abort();
}, [endpoint, value, retry]);
@@ -153,9 +175,17 @@ export function ProvinceSelect({
)}
{geometryFeedback && <p role="status">{geometryFeedback}</p>}
<TerritoryGeometryPreview
territoryId={geometrySelection && geometrySelection.value === value ? geometrySelection.id : undefined}
territoryId={
geometrySelection && geometrySelection.value === value
? geometrySelection.id
: undefined
}
management={endpoint.startsWith('/management/')}
endpoint={endpoint.startsWith('/minhas-oportunidades/') ? '/minhas-oportunidades/territory-geometries' : undefined}
endpoint={
endpoint.startsWith('/minhas-oportunidades/')
? '/minhas-oportunidades/territory-geometries'
: undefined
}
/>
</>
);
@@ -211,7 +241,11 @@ export function TerritoryFields({
<TerritoryGeometryPreview
territoryId={path.at(-1)?.id}
management={endpoint.startsWith('/management/')}
endpoint={endpoint.startsWith('/minhas-oportunidades/') ? '/minhas-oportunidades/territory-geometries' : undefined}
endpoint={
endpoint.startsWith('/minhas-oportunidades/')
? '/minhas-oportunidades/territory-geometries'
: undefined
}
/>
</div>
);
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,225 @@
import { useState } from 'react';
import { button, control } from '@/pages/management/shared';
export default function OpportunityContactForm({
id,
etag,
organization,
investors,
disabled,
onSaved,
}: {
id: number;
etag: string;
organization: string | null;
investors: { id: string; legal_name: string }[];
disabled: boolean;
onSaved: (contact: { id: string; full_name: string }) => void;
}) {
const [values, setValues] = useState({
full_name: '',
email: '',
phone: '',
investor_id: '',
investor_type: '',
});
const [busy, setBusy] = useState(false);
const [errors, setErrors] = useState<Record<string, string>>({});
const [message, setMessage] = useState('');
async function save() {
if (busy || disabled) return;
setBusy(true);
setErrors({});
setMessage('');
try {
const xsrf = document.cookie
.split('; ')
.find((item) => item.startsWith('XSRF-TOKEN='));
const response = await fetch(
`/minhas-oportunidades/${id}/contacts`,
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-XSRF-TOKEN': xsrf
? decodeURIComponent(xsrf.slice(11))
: '',
},
body: JSON.stringify({
...values,
investor_id: values.investor_id || null,
investor_type: values.investor_type || null,
etag,
}),
},
);
const result = await response.json();
setMessage(
result.message ??
'Não foi possível guardar o contacto. Os valores foram preservados.',
);
if (!response.ok) {
setErrors(
Object.fromEntries(
Object.entries(result.errors ?? {}).map(
([key, value]) => [
key,
Array.isArray(value)
? value.join(' ')
: String(value),
],
),
),
);
return;
}
onSaved(result.contact);
} catch {
setMessage(
'Resposta indisponível. Recupere a oportunidade antes de repetir; os valores foram preservados.',
);
} finally {
setBusy(false);
requestAnimationFrame(() =>
document.getElementById('contact-result')?.focus(),
);
}
}
return (
<details className="rounded border p-3">
<summary>Cadastrar contacto do promotor</summary>
<p>
Reutiliza o cadastro de contactos. Indique dados reais e
autorizados do promotor desta oportunidade. O operador do portal
não substitui o promotor real. A gravação não publica o
contacto.
</p>
<fieldset disabled={disabled || busy} className="space-y-3">
<legend>Dados do contacto</legend>
{(['full_name', 'email', 'phone'] as const).map((field) => (
<div key={field}>
<label htmlFor={`contact-${field}`}>
{
{
full_name: 'Nome completo',
email: 'Email',
phone: 'Telefone internacional (exemplo: +258…)',
}[field]
}
</label>
<input
id={`contact-${field}`}
className={control}
type={
field === 'email'
? 'email'
: field === 'phone'
? 'tel'
: 'text'
}
value={values[field]}
onChange={(event) =>
setValues({
...values,
[field]: event.target.value,
})
}
aria-invalid={Boolean(errors[field])}
aria-describedby={
errors[field]
? `contact-${field}-error`
: undefined
}
/>
{errors[field] && (
<p id={`contact-${field}-error`} role="alert">
{errors[field]}
</p>
)}
</div>
))}
{organization && investors.length > 1 && (
<div>
<label htmlFor="contact-investor_id">
Cadastro mestre do promotor
</label>
<select
id="contact-investor_id"
className={control}
value={values.investor_id}
onChange={(event) =>
setValues({
...values,
investor_id: event.target.value,
})
}
aria-invalid={Boolean(errors.investor_id)}
aria-describedby={
errors.investor_id
? 'contact-investor_id-error'
: undefined
}
>
<option value="">Por selecionar</option>
{investors.map((investor) => (
<option key={investor.id} value={investor.id}>
{investor.legal_name}
</option>
))}
</select>
{errors.investor_id && (
<p id="contact-investor_id-error" role="alert">
{errors.investor_id}
</p>
)}
</div>
)}
{organization && investors.length === 0 && (
<div>
<label htmlFor="contact-investor_type">
Classificação no cadastro do promotor
</label>
<select
id="contact-investor_type"
className={control}
value={values.investor_type}
onChange={(event) =>
setValues({
...values,
investor_type: event.target.value,
})
}
aria-invalid={Boolean(errors.investor_type)}
aria-describedby="contact-investor-type-help"
>
<option value="">Por indicar</option>
<option value="domestic">Nacional</option>
<option value="foreign">Estrangeiro</option>
<option value="institutional">Institucional</option>
<option value="individual">Individual</option>
</select>
<p id="contact-investor-type-help">
A organização já cadastrada será ligada ao cadastro
CRM existente, sem criar outra organização ou um
pedido fictício.
</p>
{errors.investor_type && (
<p role="alert">{errors.investor_type}</p>
)}
</div>
)}
<button
className={button}
type="button"
onClick={() => void save()}
>
Guardar contacto e selecionar
</button>
</fieldset>
<p id="contact-result" role="status" tabIndex={-1}>
{message}
</p>
</details>
);
}
@@ -1,6 +1,6 @@
import InteractiveInvestmentMap from "./interactive-investment-map";
import { control } from "@/pages/management/shared";
import type { MultiPolygon } from "geojson";
import InteractiveInvestmentMap from './interactive-investment-map';
import { control } from '@/pages/management/shared';
import type { MultiPolygon } from 'geojson';
type Point = [number | null, number | null];
export default function OpportunityParcelGeometry({
@@ -11,13 +11,13 @@ export default function OpportunityParcelGeometry({
onChange: (v: unknown) => void;
}) {
const data =
value && typeof value === "object"
value && typeof value === 'object'
? (value as { coordinates?: Point[][][] })
: {};
const polygons = Array.isArray(data.coordinates) ? data.coordinates : [];
function replace(p: number, r: number, points: Point[]) {
onChange({
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: polygons.map((poly, i) =>
i === p
? poly.map((ring, j) => (j === r ? points : ring))
@@ -38,7 +38,7 @@ export default function OpportunityParcelGeometry({
point.length === 2 &&
point.every(
(c) =>
typeof c === "number" &&
typeof c === 'number' &&
Number.isFinite(c),
),
) &&
@@ -57,25 +57,25 @@ export default function OpportunityParcelGeometry({
<legend>Polígono {p + 1}</legend>
{poly.map((ring, r) => (
<section key={r}>
<h4>
<p className="font-medium">
{r === 0
? "Anel exterior"
? 'Anel exterior'
: `Anel interior ${r}`}
</h4>
</p>
{ring.map((point, i) => (
<div key={i} className="flex flex-wrap gap-2">
{[0, 1].map((axis) => (
<label key={axis}>
{axis === 0
? "Longitude"
: "Latitude"}
? 'Longitude'
: 'Latitude'}
<input
className={control}
type="number"
step="any"
min={axis === 0 ? -180 : -90}
max={axis === 0 ? 180 : 90}
value={point[axis] ?? ""}
value={point[axis] ?? ''}
onChange={(e) =>
replace(
p,
@@ -89,7 +89,7 @@ export default function OpportunityParcelGeometry({
? e
.target
.value ===
""
''
? null
: Number(
e
@@ -121,7 +121,7 @@ export default function OpportunityParcelGeometry({
))}
<button
type="button"
className="underline mr-4"
className="mr-4 underline"
onClick={() =>
replace(p, r, [...ring, [null, null]])
}
@@ -130,7 +130,7 @@ export default function OpportunityParcelGeometry({
</button>
<button
type="button"
className="underline mr-4"
className="mr-4 underline"
disabled={
!ring.length ||
ring[0].some((c) => c === null)
@@ -148,7 +148,7 @@ export default function OpportunityParcelGeometry({
type="button"
onClick={() =>
onChange({
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: polygons.map((v, i) =>
i === p
? v.filter((_, j) => j !== r)
@@ -163,10 +163,10 @@ export default function OpportunityParcelGeometry({
))}
<button
type="button"
className="underline mr-4"
className="mr-4 underline"
onClick={() =>
onChange({
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: polygons.map((v, i) =>
i === p ? [...v, []] : v,
),
@@ -179,7 +179,7 @@ export default function OpportunityParcelGeometry({
type="button"
onClick={() =>
onChange({
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: polygons.filter((_, i) => i !== p),
})
}
@@ -193,7 +193,7 @@ export default function OpportunityParcelGeometry({
className="underline"
onClick={() =>
onChange({
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: [...polygons, [[]]],
})
}
@@ -206,13 +206,13 @@ export default function OpportunityParcelGeometry({
contextOnly
areas={[
{
purpose: "declared_parcel",
title: "Perímetro declarado pelo Promotor",
purpose: 'declared_parcel',
title: 'Perímetro declarado pelo Promotor',
source_reference:
"Declaração do Promotor; revisão cadastral pendente",
url: "#",
'Declaração do Promotor; revisão cadastral pendente',
url: '#',
geometry: {
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: polygons as [number, number][][][],
} as MultiPolygon,
},
@@ -15,6 +15,8 @@ export default function OpportunityProfileActions({
publishers = [],
opinions = [],
publicationVisibility,
conditions = [],
conditionResponsibles = [],
}: {
id: number;
etag: string;
@@ -23,6 +25,16 @@ export default function OpportunityProfileActions({
documents: { id: string; title: string }[];
approvalHash?: string;
publicationVisibility?: string;
conditions?: {
id: string;
gate: string;
description: string;
responsible_name: string;
due_on: string | null;
blocking_action: string;
status: string;
}[];
conditionResponsibles?: { id: number; name: string }[];
onErrors?: (errors: Record<string, string>) => void;
publishers?: { id: number; name: string }[];
participants?: {
@@ -49,6 +61,11 @@ export default function OpportunityProfileActions({
const [confirmed, setConfirmed] = useState(false);
const [recipient, setRecipient] = useState('');
const [opinion, setOpinion] = useState('');
const [conditionDescription, setConditionDescription] = useState('');
const [conditionResponsible, setConditionResponsible] = useState('');
const [conditionDue, setConditionDue] = useState('');
const [conditionBlocking, setConditionBlocking] = useState('approve');
const [resolvedConditions, setResolvedConditions] = useState<string[]>([]);
const [actionErrors, setActionErrors] = useState<Record<string, string>>(
{},
);
@@ -97,6 +114,23 @@ export default function OpportunityProfileActions({
evidence_document_ids: evidence,
}
: {}),
...(action === 'review_gate'
? {
resolve_condition_ids: resolvedConditions,
...(conditionDescription.trim()
? {
condition: {
description:
conditionDescription.trim(),
responsible_user_id:
Number(conditionResponsible),
due_on: conditionDue || null,
blocking_action: conditionBlocking,
},
}
: {}),
}
: {}),
...(action === 'pending_opinion'
? { gate, recipient_user_id: Number(recipient) }
: {}),
@@ -120,6 +154,14 @@ export default function OpportunityProfileActions({
if (error instanceof ProfileValidationError) {
setActionErrors(error.fields);
onErrors?.(error.fields);
const first = Object.keys(error.fields)[0];
requestAnimationFrame(() =>
document
.getElementById(
`workflow-${id}-${first?.startsWith('conditions.') ? 'conditions' : first}`,
)
?.focus(),
);
}
setMessage(
error instanceof Error
@@ -148,17 +190,56 @@ export default function OpportunityProfileActions({
público e ação independente do Publicador; não representa uma
decisão externa.
</p>
{conditions.length > 0 && (
<section
aria-label="Condições de revisão"
id={`workflow-${id}-conditions`}
tabIndex={-1}
>
<h3>Condições e evidências</h3>
{conditions.map((c) => (
<p key={c.id}>
{c.description} —{' '}
{c.status === 'resolved'
? 'Verificada internamente'
: 'Pendente'}
; responsável: {c.responsible_name}; prazo:{' '}
{c.due_on ?? 'não definido'}; impede:{' '}
{c.blocking_action === 'approve'
? 'aprovação'
: 'publicação'}
. A verificação interna não constitui decisão
externa.
</p>
))}
</section>
)}
{!!actions.length && (
<>
<label className="block">
Fundamentação
<textarea
id={`workflow-${id}-reason`}
aria-invalid={!!actionErrors.reason}
aria-describedby={
actionErrors.reason
? `workflow-${id}-reason-error`
: undefined
}
className={control}
minLength={20}
maxLength={1000}
value={reason}
onChange={(e) => setReason(e.target.value)}
/>
{actionErrors.reason && (
<span
id={`workflow-${id}-reason-error`}
role="alert"
>
{actionErrors.reason}
</span>
)}
</label>
{actions.includes('request_correction') && (
<label className="block">
@@ -178,6 +259,7 @@ export default function OpportunityProfileActions({
<label>
Revisão
<select
id={`workflow-${id}-gate`}
className={control}
value={gate}
onChange={(e) => setGate(e.target.value)}
@@ -222,6 +304,145 @@ export default function OpportunityProfileActions({
))}
</fieldset>
)}
{actions.includes('review_gate') && (
<fieldset className="space-y-2">
<legend>Condição explícita desta revisão</legend>
<p>
Opcional. Só bloqueia a ação indicada. Sem prazo
automático ou responsabilidade externa
atribuída.
</p>
<label className="block">
Descrição da condição
<textarea
className={control}
id={`workflow-${id}-condition.description`}
value={conditionDescription}
onChange={(e) =>
setConditionDescription(e.target.value)
}
aria-invalid={
!!actionErrors['condition.description']
}
aria-describedby={
actionErrors['condition.description']
? `workflow-${id}-condition.description-error`
: undefined
}
/>
{actionErrors['condition.description'] && (
<span
id={`workflow-${id}-condition.description-error`}
role="alert"
>
{actionErrors['condition.description']}
</span>
)}
</label>
<label className="block">
Responsável pela preparação da evidência
<select
className={control}
id={`workflow-${id}-condition.responsible_user_id`}
value={conditionResponsible}
onChange={(e) =>
setConditionResponsible(e.target.value)
}
aria-invalid={
!!actionErrors[
'condition.responsible_user_id'
]
}
aria-describedby={
actionErrors[
'condition.responsible_user_id'
]
? `workflow-${id}-condition.responsible_user_id-error`
: undefined
}
>
<option value="">Selecione</option>
{conditionResponsibles.map((p) => (
<option key={p.id} value={p.id}>
{p.name}
</option>
))}
</select>
{actionErrors[
'condition.responsible_user_id'
] && (
<span
id={`workflow-${id}-condition.responsible_user_id-error`}
role="alert"
>
{
actionErrors[
'condition.responsible_user_id'
]
}
</span>
)}
</label>
<label className="block">
Prazo específico da condição, se definido
<input
className={control}
type="date"
id={`workflow-${id}-condition.due_on`}
value={conditionDue}
onChange={(e) =>
setConditionDue(e.target.value)
}
aria-invalid={
!!actionErrors['condition.due_on']
}
/>
</label>
<label className="block">
Ação impedida até verificação
<select
className={control}
value={conditionBlocking}
onChange={(e) =>
setConditionBlocking(e.target.value)
}
>
<option value="approve">Aprovação</option>
<option value="publish">Publicação</option>
</select>
</label>
{conditions
.filter(
(c) =>
c.gate === gate && c.status === 'open',
)
.map((c) => (
<label key={c.id} className="block">
<input
type="checkbox"
checked={resolvedConditions.includes(
c.id,
)}
onChange={(e) =>
setResolvedConditions(
e.target.checked
? [
...resolvedConditions,
c.id,
]
: resolvedConditions.filter(
(id) =>
id !== c.id,
),
)
}
/>
Verifiquei com os documentos
selecionados: {c.description}
</label>
))}
</fieldset>
)}
{(actions.includes('assign_review') ||
actions.includes('assign_publication')) && (
<label className="block">
@@ -297,7 +518,10 @@ export default function OpportunityProfileActions({
.filter(([key]) => !key.startsWith('canonical'))
.map(([key, msg]) => (
<p key={key} role="alert">
{key}: {msg}
{key.startsWith('conditions.')
? 'Condição de revisão'
: key}
: {msg}
</p>
))}
{actions.includes('publish') && (
@@ -163,8 +163,9 @@ export function PortalGroupedMenu() {
aria-label="Sessão da conta"
className="mb-3 flex flex-wrap items-center justify-between gap-3 rounded-lg bg-slate-50 px-3 py-2"
>
<p className="min-w-0 break-words text-sm text-slate-700 [overflow-wrap:anywhere]">
Sessão: {props.auth.user.name || props.auth.user.email}
<p className="min-w-0 text-sm [overflow-wrap:anywhere] break-words text-slate-700">
Sessão:{' '}
{props.auth.user.name || props.auth.user.email}
</p>
<Link
href={logout()}
@@ -181,7 +182,9 @@ export function PortalGroupedMenu() {
className="inline-flex min-h-11 shrink-0 items-center gap-2 rounded-lg border border-slate-400 bg-white px-3 py-2 text-sm font-semibold text-slate-900 hover:bg-slate-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700 disabled:cursor-wait disabled:opacity-60"
>
<LogOut aria-hidden="true" className="size-4" />
{loggingOut ? 'A terminar sessão…' : 'Terminar sessão'}
{loggingOut
? 'A terminar sessão…'
: 'Terminar sessão'}
</Link>
</nav>
)}
@@ -293,7 +293,12 @@ export function SimulationCashflowPlanner({
{projection.vatRefundRecognized}. Estes valores não
foram somados à caixa.
</p>
<div className="overflow-x-auto focus-visible:outline-2" tabIndex={0} role="region" aria-label="Tabela do fluxo de caixa">
<div
className="overflow-x-auto focus-visible:outline-2"
tabIndex={0}
role="region"
aria-label="Tabela do fluxo de caixa"
>
<table className="min-w-full text-sm">
<caption className="sr-only">
Projecção mensal de tesouraria
@@ -369,7 +369,12 @@ export function SimulationFinancialTools({
efectiva converte a taxa anual para a
periodicidade indicada.
</p>
<div className="max-h-64 overflow-auto focus-visible:outline-2" tabIndex={0} role="region" aria-label="Plano de reembolso indicativo">
<div
className="max-h-64 overflow-auto focus-visible:outline-2"
tabIndex={0}
role="region"
aria-label="Plano de reembolso indicativo"
>
<table className="min-w-full text-xs">
<caption className="sr-only">
Plano de reembolso indicativo
File diff suppressed because it is too large Load Diff
@@ -15,7 +15,7 @@ export default function TerritorialSources({
}) {
if (!sources?.length) return null;
return (
<section className="space-y-3 rounded border p-4">
<section className="min-w-0 space-y-3 rounded border p-4 [overflow-wrap:anywhere]">
<h2 className="text-xl font-bold">
Fundamento documental das associações
</h2>
@@ -14,10 +14,12 @@ export default function TerritoryGeometryPreview({
territoryId,
management = false,
endpoint: suppliedEndpoint,
label = 'Cobertura cartográfica da seleção',
}: {
territoryId?: string;
management?: boolean;
endpoint?: string;
label?: string;
}) {
const [context, setContext] = useState<Context | null>(null);
const [error, setError] = useState('');
@@ -26,9 +28,11 @@ export default function TerritoryGeometryPreview({
setError('');
if (!territoryId) return;
const controller = new AbortController();
const endpoint = suppliedEndpoint ?? (management
? '/management/territory-geometries'
: '/api/v1/investment/territory-geometries');
const endpoint =
suppliedEndpoint ??
(management
? '/management/territory-geometries'
: '/api/v1/investment/territory-geometries');
void fetch(
`${endpoint}?${new URLSearchParams({ territory_id: territoryId })}`,
{
@@ -56,10 +60,7 @@ export default function TerritoryGeometryPreview({
}, [territoryId, management, suppliedEndpoint]);
if (!territoryId) return null;
return (
<section
className="space-y-2 md:col-span-full"
aria-label="Cobertura cartográfica da seleção"
>
<section className="space-y-2 md:col-span-full" aria-label={label}>
<p>Território selecionado no cadastro.</p>
{error && <p role="alert">{error}</p>}
{!context && !error && <p role="status">A consultar geometria…</p>}