@@ -195,6 +195,7 @@ export default function InteractiveInvestmentMap({
|
||||
<div
|
||||
ref={element}
|
||||
className="relative z-0 h-[460px] w-full rounded"
|
||||
role="region"
|
||||
aria-label="Mapa; navegação por setas e teclas mais e menos"
|
||||
/>
|
||||
{points === null ? (
|
||||
@@ -255,7 +256,9 @@ export default function InteractiveInvestmentMap({
|
||||
<a className="underline" href={area.url}>
|
||||
{area.title}
|
||||
</a>{' '}
|
||||
· Polígono cadastrado, limites oficiais por verificar ·
|
||||
· {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:{' '}
|
||||
{area.source_date ?? 'Não documentada'}
|
||||
</p>
|
||||
|
||||
@@ -27,6 +27,8 @@ function resourceTerritory(resource?: Resource) {
|
||||
}
|
||||
export type CanonicalOptions = {
|
||||
version: string;
|
||||
modularProfiles?: Record<string, string>;
|
||||
historyVersion?: string | null;
|
||||
schema: Schema;
|
||||
definitions: Record<string, Schema>;
|
||||
contacts: { id: string; full_name: string }[];
|
||||
@@ -70,6 +72,53 @@ const labels: Record<string, string> = {
|
||||
real_estate: "Imobiliário",
|
||||
land_rights: "DUAT e direitos fundiários",
|
||||
business_transaction: "Negócio",
|
||||
module_profile_version: "Versão do contrato QA (seleção explícita)",
|
||||
module_details: "Condições do módulo",
|
||||
mode: "Percurso: procura, oferta ou modalidade",
|
||||
conditions_status: "Condições propostas ou compromisso documentado",
|
||||
object: "Objeto",
|
||||
representation_document_id: "Documento de representação",
|
||||
object_document_id: "Documento do objeto/procedimento",
|
||||
disclosure_authorization_document_id: "Autorização de divulgação da intenção/chamada",
|
||||
external_decision_document_id: "Ato competente do direito atribuído",
|
||||
granting_entity: "Entidade concedente declarada",
|
||||
procedure_regime: "Regime/procedimento declarado",
|
||||
scope: "Âmbito territorial ou digital",
|
||||
term_value: "Duração ou prazo",
|
||||
term_unit: "Unidade da duração",
|
||||
remuneration_obligations: "Remuneração e obrigações",
|
||||
participation_conditions: "Condições de participação",
|
||||
land_required: "Precisa de terra?",
|
||||
construction_required: "Inclui construção?",
|
||||
applicable_authorizations: "Autorizações aplicáveis e situação",
|
||||
instrument: "Instrumento de financiamento",
|
||||
offered_capacity: "Capacidade oferecida pelo financiador",
|
||||
eligibility_criteria: "Critérios declarados do financiador",
|
||||
capacity_document_id: "Evidência da capacidade declarada",
|
||||
financial_plan_document_id: "Plano financeiro do projeto",
|
||||
secured_evidence_document_id: "Evidência do financiamento assegurado",
|
||||
use_of_funds: "Finalidade do financiamento procurado",
|
||||
disbursement_calendar: "Calendário proposto de desembolso",
|
||||
repayment_periodicity: "Periodicidade de reembolso",
|
||||
proposed_rights: "Direitos propostos",
|
||||
equity_percentage: "Percentagem de capital proposta",
|
||||
terms: "Condições",
|
||||
scenario: "Cenário identificado",
|
||||
source: "Fonte identificada",
|
||||
terms_date: "Data da fonte/condições",
|
||||
commitment_document_id: "Documento do compromisso assumido",
|
||||
acceptance_criteria: "Critérios de aceitação do fornecimento",
|
||||
quotation_method: "Método de cotação",
|
||||
total_price: "Preço total (impostos identificados separadamente)",
|
||||
declared_taxes: "Impostos declarados, sem cálculo implícito",
|
||||
advance_or_guarantee: "Há adiantamento ou garantia?",
|
||||
subtype: "Subtipo para classificação funcional",
|
||||
recipients: "Destinatários",
|
||||
expected_output: "Resultado esperado",
|
||||
history_status: "Situação do histórico financeiro",
|
||||
history_declaration: "Declaração de ausência de exercícios completos",
|
||||
history_declaration_document_id: "Documento da declaração",
|
||||
projections: "Projeções identificadas — não são contas realizadas",
|
||||
transaction_type: "Modalidade",
|
||||
property_type: "Tipo de imóvel",
|
||||
construction_status: "Estado construtivo",
|
||||
@@ -173,12 +222,10 @@ const labels: Record<string, string> = {
|
||||
direct_jobs: "Empregos diretos",
|
||||
employment_type: "Tipo de emprego",
|
||||
geometry: "Geometria da parcela",
|
||||
module_profile_version: "Perfil modular aprovado",
|
||||
start_date: "Data de início",
|
||||
end_date: "Data de fim",
|
||||
responsible_name: "Responsável declarado",
|
||||
dependencies: "Marcos dos quais depende",
|
||||
scenario: "Cenário analisado",
|
||||
npv: "Valor atual líquido",
|
||||
irr: "Taxa interna de retorno (%)",
|
||||
payback_years: "Prazo de retorno (anos)",
|
||||
@@ -568,7 +615,7 @@ export default function OpportunityCanonicalFields({
|
||||
: ["business_sale", "business_partnership", "franchise"].includes(
|
||||
category,
|
||||
)
|
||||
? ["business_transaction"]
|
||||
? ["module_profile_version", "business_transaction"]
|
||||
: category === "investment_project"
|
||||
? [
|
||||
"opportunity_type",
|
||||
@@ -594,7 +641,18 @@ export default function OpportunityCanonicalFields({
|
||||
"risks",
|
||||
"relations",
|
||||
]
|
||||
: ["module_profile_version"];
|
||||
: ["module_profile_version", "module_details", ...(category === "financing" ? ["total_investment", "investment_breakdown", "secured_financing", "funding_sought"] : [])];
|
||||
const details = (value.module_details ?? {}) as Data;
|
||||
const mode = String(details.mode ?? "");
|
||||
const modularFields = ["mode", "object", "representation_document_id", "object_document_id",
|
||||
...(category === "concession" ? ["granting_entity", "procedure_regime", "scope", "term_value", "term_unit", "remuneration_obligations", "participation_conditions", "land_required", "construction_required", "applicable_authorizations", "start_date", "end_date", "disclosure_authorization_document_id", "external_decision_document_id", "territorial_right_document_id", "construction_license_document_id"] : []),
|
||||
...(["financing", "supply"].includes(category) ? ["conditions_status", "terms", "scenario", "source", "terms_date", "commitment_document_id"] : []),
|
||||
...(category === "financing" ? ["instrument", "disbursement_calendar", "term_value", "term_unit", "repayment_periodicity", "equity_percentage", "proposed_rights",
|
||||
...(mode === "funding_offer" ? ["offered_capacity", "eligibility_criteria", "capacity_document_id"] : ["use_of_funds", "financial_plan_document_id", "secured_evidence_document_id"])] : []),
|
||||
...(category === "supply" ? ["quantity", "unit", "destination", "start_date", "end_date", "acceptance_criteria", "quotation_method", "unit_price", "total_price", "declared_taxes", "advance_or_guarantee", ...(mode === "supply_offer" ? ["capacity_document_id"] : [])] : []),
|
||||
...(category === "other" ? ["subtype", "purpose", "recipients", "expected_output", "risks"] : []),
|
||||
];
|
||||
const modes = category === "concession" ? ["intention_call", "awarded_right"] : category === "financing" ? ["seeking_funding", "funding_offer"] : category === "supply" ? ["purchase_request", "supply_offer"] : ["classified_other"];
|
||||
return (
|
||||
<fieldset disabled={disabled} className="space-y-4 rounded border p-4">
|
||||
<legend>Contrato da oportunidade — {category}</legend>
|
||||
@@ -603,7 +661,23 @@ export default function OpportunityCanonicalFields({
|
||||
aplicáveis e os recursos guardados. Validação interna não
|
||||
equivale a autorização externa.
|
||||
</p>
|
||||
{options.modularProfiles?.[category] && (
|
||||
<p className="rounded border border-amber-400 p-3">
|
||||
Primeira versão QA: {options.modularProfiles[category]}. Selecione-a explicitamente no campo de versão.
|
||||
Financiamento distingue procura do projeto de oferta do financiador; fornecimento distingue pedido de compra de oferta.
|
||||
Condições propostas não representam compromisso nem decisão externa.
|
||||
</p>
|
||||
)}
|
||||
{Array.from(new Set([...common, ...specialized])).map((key) => {
|
||||
if (key === "module_profile_version") {
|
||||
const current = String(value[key] ?? "");
|
||||
const version = options.modularProfiles?.[category] ?? (["business_sale", "business_partnership", "franchise"].includes(category) ? options.historyVersion : null);
|
||||
return <label key={key} className="block">{labels[key]}<select className={control} value={current} onChange={(e) => set(key, e.target.value || null)}>
|
||||
<option value="">Contrato original / por selecionar</option>
|
||||
{current && current !== version && <option value={current}>{current} — versão existente preservada</option>}
|
||||
{version && <option value={version}>{version}</option>}
|
||||
</select><FieldErrors path={"canonical." + key} errors={errors} /></label>;
|
||||
}
|
||||
if (
|
||||
[
|
||||
"sector_id",
|
||||
@@ -731,7 +805,11 @@ export default function OpportunityCanonicalFields({
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
const schema = options.schema.properties?.[key];
|
||||
let schema = options.schema.properties?.[key];
|
||||
if (key === "module_details" && schema?.properties) {
|
||||
schema = { ...schema, properties: Object.fromEntries(Object.entries(schema.properties).filter(([field]) => modularFields.includes(field))) };
|
||||
schema.properties!.mode = { enum: modes };
|
||||
}
|
||||
return schema ? (
|
||||
<Editor
|
||||
key={key}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { ProfileAccess } from '@/types/profile-access';
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import { Link, router, usePage } from '@inertiajs/react';
|
||||
import { LogOut } from 'lucide-react';
|
||||
import { logout } from '@/routes';
|
||||
import { useEffect, useId, useRef, useState } from 'react';
|
||||
import type { OpportunityManagementAccess } from '@/types/opportunity-management';
|
||||
import {
|
||||
@@ -11,10 +13,14 @@ import {
|
||||
|
||||
export function PortalGroupedMenu() {
|
||||
const { props, url } = usePage<{
|
||||
auth: { user: unknown; canManagePortal: boolean };
|
||||
auth: {
|
||||
user: { name?: string; email?: string } | null;
|
||||
canManagePortal: boolean;
|
||||
};
|
||||
existingBusinessEnabled?: boolean;
|
||||
educationEnabled?: boolean;
|
||||
aiEnabled?: boolean;
|
||||
legacyContentEnabled?: boolean;
|
||||
portalOperator?: string | null;
|
||||
profileAccess?: ProfileAccess | null;
|
||||
opportunityManagement?: OpportunityManagementAccess | null;
|
||||
@@ -25,6 +31,7 @@ export function PortalGroupedMenu() {
|
||||
businesses: props.existingBusinessEnabled,
|
||||
education: props.educationEnabled,
|
||||
ai: props.aiEnabled,
|
||||
legacyContent: props.legacyContentEnabled,
|
||||
opportunityManagement: props.opportunityManagement,
|
||||
profileAccess: props.profileAccess,
|
||||
});
|
||||
@@ -33,6 +40,7 @@ export function PortalGroupedMenu() {
|
||||
const [open, setOpen] = useState<string | null>(null);
|
||||
const [branch, setBranch] = useState<string | null>(null);
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [loggingOut, setLoggingOut] = useState(false);
|
||||
const root = useRef<HTMLElement>(null);
|
||||
const id = useId();
|
||||
useEffect(() => {
|
||||
@@ -150,6 +158,33 @@ export function PortalGroupedMenu() {
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
{props.auth?.user && (
|
||||
<nav
|
||||
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>
|
||||
<Link
|
||||
href={logout()}
|
||||
as="button"
|
||||
type="button"
|
||||
disabled={loggingOut}
|
||||
onClick={() => {
|
||||
close();
|
||||
router.flushAll();
|
||||
}}
|
||||
onStart={() => setLoggingOut(true)}
|
||||
onFinish={() => setLoggingOut(false)}
|
||||
data-test="portal-logout-button"
|
||||
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'}
|
||||
</Link>
|
||||
</nav>
|
||||
)}
|
||||
<nav aria-label="Áreas do portal">
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{groups.map((group) => (
|
||||
|
||||
@@ -293,7 +293,7 @@ export function SimulationCashflowPlanner({
|
||||
{projection.vatRefundRecognized}. Estes valores não
|
||||
foram somados à caixa.
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<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,7 @@ export function SimulationFinancialTools({
|
||||
efectiva converte a taxa anual para a
|
||||
periodicidade indicada.
|
||||
</p>
|
||||
<div className="max-h-64 overflow-auto">
|
||||
<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
|
||||
|
||||
@@ -1154,6 +1154,7 @@ export function SimulationForm() {
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setReady(false);
|
||||
void (async () => {
|
||||
let local: SimulationDraft = {};
|
||||
const requestedDraftId = new URLSearchParams(
|
||||
@@ -1229,6 +1230,7 @@ export function SimulationForm() {
|
||||
}
|
||||
}
|
||||
if (payload.data) {
|
||||
if (cancelled) return;
|
||||
draftIdRef.current = payload.data.id;
|
||||
draftEtagRef.current = response.headers.get('ETag');
|
||||
setDraftVersionNo(payload.data.version_no);
|
||||
@@ -1475,7 +1477,7 @@ export function SimulationForm() {
|
||||
]);
|
||||
|
||||
async function returnToInvestment() {
|
||||
if (!contextId || !draftIdRef.current) return;
|
||||
if (!ready || !contextId || !draftIdRef.current) return;
|
||||
setContinuityError('');
|
||||
try {
|
||||
await saveQueueRef.current;
|
||||
@@ -1496,8 +1498,14 @@ export function SimulationForm() {
|
||||
'Não foi possível recuperar o rascunho guardado.',
|
||||
);
|
||||
if (
|
||||
saved.data.economic_snapshot.financial_tools_snapshot !==
|
||||
draft.financial_tools_snapshot
|
||||
simulationDraftFingerprint(
|
||||
restoreSimulationDraft(
|
||||
saved.data.economic_snapshot,
|
||||
Array.isArray(saved.data.personal_snapshot)
|
||||
? {}
|
||||
: saved.data.personal_snapshot,
|
||||
),
|
||||
) !== simulationDraftFingerprint(draft)
|
||||
)
|
||||
throw new Error(
|
||||
'Aguarde a gravação das entradas da ferramenta e tente novamente.',
|
||||
@@ -1912,6 +1920,7 @@ export function SimulationForm() {
|
||||
value: string | string[],
|
||||
label?: string | string[],
|
||||
) {
|
||||
if (!ready) return;
|
||||
setContinueLaterSaved(false);
|
||||
setServerFieldErrors((previous) => {
|
||||
const next = { ...previous };
|
||||
@@ -2035,6 +2044,7 @@ export function SimulationForm() {
|
||||
}
|
||||
|
||||
function navigate(nextStep: number) {
|
||||
if (!ready) return;
|
||||
setOpenedTool(null);
|
||||
if (nextStep > step) {
|
||||
for (let index = step; index < nextStep; index++) {
|
||||
@@ -2390,7 +2400,12 @@ export function SimulationForm() {
|
||||
<section
|
||||
className="space-y-6 rounded-xl border bg-white p-4 sm:p-6"
|
||||
aria-labelledby="simulator-step-title"
|
||||
aria-busy={!ready}
|
||||
>
|
||||
{!ready && (
|
||||
<p role="status">A recuperar o rascunho. Aguarde para editar.</p>
|
||||
)}
|
||||
<fieldset disabled={!ready} className="min-w-0 space-y-6">
|
||||
{canSavePersonalData && draftVersionNo && draftIdRef.current && (
|
||||
<a
|
||||
className="inline-block underline"
|
||||
@@ -4336,6 +4351,7 @@ export function SimulationForm() {
|
||||
associados à conta. A submissão formal ainda não está disponível
|
||||
neste formulário.
|
||||
</p>
|
||||
</fieldset>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -165,6 +165,8 @@ function Sidebar({
|
||||
return (
|
||||
<div
|
||||
data-slot="sidebar"
|
||||
role="complementary"
|
||||
aria-label="Navegação da conta"
|
||||
className={cn(
|
||||
"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
||||
className
|
||||
@@ -179,10 +181,6 @@ function Sidebar({
|
||||
if (isMobile) {
|
||||
return (
|
||||
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
||||
<SheetHeader className="sr-only">
|
||||
<SheetTitle>Sidebar</SheetTitle>
|
||||
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
||||
</SheetHeader>
|
||||
<SheetContent
|
||||
data-sidebar="sidebar"
|
||||
data-slot="sidebar"
|
||||
@@ -195,6 +193,10 @@ function Sidebar({
|
||||
}
|
||||
side={side}
|
||||
>
|
||||
<SheetHeader className="sr-only">
|
||||
<SheetTitle>Navegação da conta</SheetTitle>
|
||||
<SheetDescription>Menu móvel do portal.</SheetDescription>
|
||||
</SheetHeader>
|
||||
<div className="flex h-full w-full flex-col">{children}</div>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
@@ -209,6 +211,8 @@ function Sidebar({
|
||||
data-variant={variant}
|
||||
data-side={side}
|
||||
data-slot="sidebar"
|
||||
role="complementary"
|
||||
aria-label="Navegação da conta"
|
||||
>
|
||||
{/* This is what handles the sidebar gap on desktop */}
|
||||
<div
|
||||
|
||||
@@ -55,7 +55,7 @@ export function UserMenuContent({ user }: Props) {
|
||||
data-test="logout-button"
|
||||
>
|
||||
<LogOut className="mr-2" />
|
||||
Log out
|
||||
Terminar sessão
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user