Complete APIEX documentary preparation and private contextual SWOT in existing dossiers

This commit is contained in:
2026-11-10 18:00:06 +02:00
parent 7476dc3430
commit 37854d0231
17 changed files with 2982 additions and 24 deletions
File diff suppressed because it is too large Load Diff
+67 -11
View File
@@ -39,6 +39,13 @@ type Step = {
source_paragraph: number;
};
type Path = {
preparation_action?: {
id: string;
title: string;
kind: string;
case_id: string;
opportunity: string | null;
} | null;
context_opportunity: string | null;
opportunity_options: NonNullable<DossierContext['opportunity_choices']>;
private_investment?: Preparation | null;
@@ -193,7 +200,11 @@ function Stage({ step, path }: { step: Step; path: Path }) {
className={`space-y-3 rounded-xl border p-4 ${licensing ? 'md:col-span-2' : ''}`}
>
<Heading
className={licensing ? 'text-lg font-semibold' : 'cursor-pointer font-semibold'}
className={
licensing
? 'text-lg font-semibold'
: 'cursor-pointer font-semibold'
}
>
{step.title} · {pathStates[step.state]}
</Heading>
@@ -270,7 +281,11 @@ function Stage({ step, path }: { step: Step; path: Path }) {
</p>
))}
<Reference className="text-xs">
<ReferenceHeading className={licensing ? 'font-semibold' : 'cursor-pointer underline'}>
<ReferenceHeading
className={
licensing ? 'font-semibold' : 'cursor-pointer underline'
}
>
Fonte e referência desta etapa
</ReferenceHeading>
<p>
@@ -285,9 +300,17 @@ function Stage({ step, path }: { step: Step; path: Path }) {
</Reference>
{step.preparation_allowed && (path.canWrite || path.canReview) && (
<Record
aria-label={licensing ? 'Registar licenciamento' : undefined}
aria-label={
licensing ? 'Registar licenciamento' : undefined
}
>
<RecordHeading className={licensing ? 'font-semibold' : 'cursor-pointer underline'}>
<RecordHeading
className={
licensing
? 'font-semibold'
: 'cursor-pointer underline'
}
>
Registar avanço ou pendência
</RecordHeading>
<form
@@ -437,9 +460,11 @@ function Stage({ step, path }: { step: Step; path: Path }) {
))}
<button
disabled={form.processing}
className={licensing
? 'rounded bg-emerald-800 px-4 py-3 font-semibold text-white disabled:opacity-50'
: 'rounded border p-2'}
className={
licensing
? 'rounded bg-emerald-800 px-4 py-3 font-semibold text-white disabled:opacity-50'
: 'rounded border p-2'
}
>
Guardar registo
</button>
@@ -456,7 +481,11 @@ export default function InvestmentPath(path: Path) {
useEffect(() => {
const reveal = () => {
if (root.current) {
revealPathStage(root.current, window.location.hash, stageCodes.split(','));
revealPathStage(
root.current,
window.location.hash,
stageCodes.split(','),
);
}
};
reveal();
@@ -467,6 +496,15 @@ export default function InvestmentPath(path: Path) {
auth: { user: { id: number } };
flash: { success?: string };
}>().props;
useEffect(() => {
if (path.preparation_action && window.location.hash === '#tarefas') {
const target = document.getElementById('tarefas');
if (target instanceof HTMLDetailsElement) {
target.open = true;
target.scrollIntoView({ block: 'start' });
}
}
}, [path.preparation_action]);
const facts = useForm({
version: path.case.version,
context_opportunity: path.context_opportunity,
@@ -476,7 +514,9 @@ export default function InvestmentPath(path: Path) {
const task = useForm({
version: path.case.version,
code: 'S02',
title: '',
title: path.preparation_action?.title ?? '',
preparation_action: path.preparation_action?.id ?? null,
opportunity: path.preparation_action?.opportunity ?? null,
due_at: '',
consent: false,
});
@@ -498,7 +538,10 @@ export default function InvestmentPath(path: Path) {
);
}
return (
<main ref={root} className="mx-auto max-w-6xl min-w-0 space-y-6 p-4 [overflow-wrap:anywhere] md:p-8 [&_input]:max-w-full [&_input]:min-w-0 [&_label]:min-w-0 [&_select]:max-w-full [&_select]:min-w-0">
<main
ref={root}
className="mx-auto max-w-6xl min-w-0 space-y-6 p-4 [overflow-wrap:anywhere] md:p-8 [&_input]:max-w-full [&_input]:min-w-0 [&_label]:min-w-0 [&_select]:max-w-full [&_select]:min-w-0"
>
<Head title={path.case.title} />
<Link className="underline" href="/investimentos">
Os meus investimentos
@@ -732,6 +775,7 @@ export default function InvestmentPath(path: Path) {
{
(
{
preparation: 'Preparação APIEX e SWOT',
simulator: 'Plano e simulador',
desk: 'Balcão e histórico',
library: 'Biblioteca',
@@ -975,6 +1019,11 @@ export default function InvestmentPath(path: Path) {
>
Preparar os dados para a constituição da empresa
</Link>
{path.tools.preparation && (
<Link className="underline" href={path.tools.preparation}>
Preparação APIEX e análise SWOT deste investimento
</Link>
)}
{path.tools.company && (
<Link className="underline" href={path.tools.company}>
Comparar formas jurídicas para este investimento
@@ -997,10 +1046,17 @@ export default function InvestmentPath(path: Path) {
Anexar ou conferir no Balcão
</Link>
</section>
<details className="space-y-3 rounded-xl border p-4">
<details id="tarefas" className="space-y-3 rounded-xl border p-4">
<summary className="cursor-pointer text-lg font-semibold">
Acompanhamento interno
</summary>
{path.preparation_action && (
<p role="status">
Acção ligada à SWOT deste dossier:{' '}
{path.preparation_action.title}. Confira a etapa e a
data antes de assumir a tarefa.
</p>
)}
{path.canWrite && (
<form
className="grid min-w-0 gap-3 [&_input]:max-w-full [&_input]:min-w-0 [&_label]:min-w-0 [&_select]:max-w-full [&_select]:min-w-0"