Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -36,6 +36,7 @@ type Result = {
|
||||
}[];
|
||||
};
|
||||
type Props = {
|
||||
entity_kind?: string;
|
||||
definition: { version: string; questions: Record<string, Question> };
|
||||
case: { id: string; title: string; version: number } | null;
|
||||
canWrite: boolean;
|
||||
@@ -98,7 +99,7 @@ function Comparator(props: Props) {
|
||||
}),
|
||||
);
|
||||
};
|
||||
async function save() {
|
||||
async function save(next?: string) {
|
||||
if (!dossier || busy) return;
|
||||
setBusy(true);
|
||||
setError('');
|
||||
@@ -107,8 +108,9 @@ function Comparator(props: Props) {
|
||||
version: dossier.version,
|
||||
operation_key: operation.current,
|
||||
answers: currentValues(),
|
||||
...(next ? { continue_preparation: true } : {}),
|
||||
});
|
||||
router.visit(base, { preserveState: false });
|
||||
router.visit(next ?? base, { preserveState: false });
|
||||
} catch (e) {
|
||||
setError(
|
||||
e instanceof Error
|
||||
@@ -222,7 +224,7 @@ function Comparator(props: Props) {
|
||||
type="button"
|
||||
className={button}
|
||||
disabled={busy}
|
||||
onClick={save}
|
||||
onClick={() => void save()}
|
||||
>
|
||||
{busy ? 'A guardar…' : 'Guardar no dossier'}
|
||||
</button>
|
||||
@@ -321,9 +323,36 @@ function Comparator(props: Props) {
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<h3 className="mt-4 font-semibold">
|
||||
Preparar a próxima conversa
|
||||
</h3>
|
||||
<h3 className="mt-4 font-semibold">Continuar a preparação</h3>
|
||||
{dossier &&
|
||||
!['company', 'organization'].includes(
|
||||
props.entity_kind ?? '',
|
||||
) &&
|
||||
!readOnly &&
|
||||
props.canWrite &&
|
||||
answers.preferred &&
|
||||
answers.preferred !== 'unknown' && (
|
||||
<button
|
||||
className={button}
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() =>
|
||||
void save(
|
||||
`/investimentos/${dossier.id}/preparar-empresa?form=${encodeURIComponent(answers.preferred)}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
Usar esta opção e continuar a preparação da empresa
|
||||
</button>
|
||||
)}
|
||||
{dossier && (
|
||||
<Link
|
||||
className="block underline"
|
||||
href={`/simulador-fiscal?context=${dossier.id}`}
|
||||
>
|
||||
Continuar a viabilidade sem repetir esta comparação
|
||||
</Link>
|
||||
)}
|
||||
<ul className="list-disc pl-5">
|
||||
{result.preparation.map((item) => (
|
||||
<li key={item}>{item}</li>
|
||||
|
||||
Reference in New Issue
Block a user