@@ -1,4 +1,5 @@
|
||||
import {
|
||||
import { displayValue } from '@/lib/display-value';
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useId,
|
||||
@@ -814,7 +815,12 @@ export function SimulationForm() {
|
||||
recommendation_reason: string;
|
||||
applicability: string;
|
||||
basis_reference: string | null;
|
||||
documentary_evidence: Array<{ key: string; label: string; citation: string | null; status: string }>;
|
||||
documentary_evidence: Array<{
|
||||
key: string;
|
||||
label: string;
|
||||
citation: string | null;
|
||||
status: string;
|
||||
}>;
|
||||
}>
|
||||
>([]);
|
||||
const [linkableBusinesses, setLinkableBusinesses] = useState<
|
||||
@@ -1054,7 +1060,9 @@ export function SimulationForm() {
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
let local: SimulationDraft = {};
|
||||
const requestedDraftId = new URLSearchParams(window.location.search).get('draft');
|
||||
const requestedDraftId = new URLSearchParams(
|
||||
window.location.search,
|
||||
).get('draft');
|
||||
try {
|
||||
const stored = sessionStorage.getItem(draftKey);
|
||||
if (stored) local = JSON.parse(stored) as SimulationDraft;
|
||||
@@ -1065,7 +1073,9 @@ export function SimulationForm() {
|
||||
}
|
||||
try {
|
||||
const response = await fetch(
|
||||
requestedDraftId ? `/api/v1/simulation-drafts/${encodeURIComponent(requestedDraftId)}` : '/api/v1/simulation-drafts/current',
|
||||
requestedDraftId
|
||||
? `/api/v1/simulation-drafts/${encodeURIComponent(requestedDraftId)}`
|
||||
: '/api/v1/simulation-drafts/current',
|
||||
{
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
@@ -2106,7 +2116,20 @@ export function SimulationForm() {
|
||||
className="space-y-6 rounded-xl border bg-white p-4 sm:p-6"
|
||||
aria-labelledby="simulator-step-title"
|
||||
>
|
||||
{canSavePersonalData && draftVersionNo && draftIdRef.current && <PartnershipSourceLinks type="simulation" id={draftIdRef.current}/>}
|
||||
{canSavePersonalData && draftVersionNo && draftIdRef.current && (
|
||||
<a
|
||||
className="inline-block underline"
|
||||
href={`/balcao-virtual/painel?simulation_id=${draftIdRef.current}`}
|
||||
>
|
||||
Preparar apoio no Balcão Virtual com este dossier guardado
|
||||
</a>
|
||||
)}
|
||||
{canSavePersonalData && draftVersionNo && draftIdRef.current && (
|
||||
<PartnershipSourceLinks
|
||||
type="simulation"
|
||||
id={draftIdRef.current}
|
||||
/>
|
||||
)}
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2
|
||||
@@ -2619,14 +2642,14 @@ export function SimulationForm() {
|
||||
[
|
||||
'Investimento declarado',
|
||||
draft.total_investment
|
||||
? `${draft.total_investment} ${draft.currency ?? ''}`
|
||||
? `${displayValue(draft.total_investment)} ${displayValue(draft.currency)}`
|
||||
: '',
|
||||
'financial',
|
||||
],
|
||||
[
|
||||
'Estado do resultado calculado',
|
||||
result
|
||||
? `${simulationStatusLabel(result.status)} · versão ${result.version_no}${arithmeticResult.value ? ` · ${arithmeticResult.value} ${String(arithmeticSnapshot?.currency ?? '')}` : ''}`
|
||||
? `${simulationStatusLabel(result.status)} · versão ${result.version_no}${arithmeticResult.value ? ` · ${arithmeticResult.value} ${displayValue(arithmeticSnapshot?.currency)}` : ''}`
|
||||
: 'Sem resultado de cálculo guardado',
|
||||
'financial',
|
||||
],
|
||||
@@ -3037,11 +3060,30 @@ export function SimulationForm() {
|
||||
? 'origem identificada'
|
||||
: 'por confirmar'}
|
||||
</p>
|
||||
{document.documentary_evidence.length > 0 && (
|
||||
{document.documentary_evidence.length >
|
||||
0 && (
|
||||
<div className="mt-2 rounded bg-slate-50 p-2 text-sm">
|
||||
<strong>Evidência documental relacionada (não activa cálculos fiscais):</strong>
|
||||
<strong>
|
||||
Evidência documental
|
||||
relacionada (não activa
|
||||
cálculos fiscais):
|
||||
</strong>
|
||||
<ul className="list-disc pl-5">
|
||||
{document.documentary_evidence.map((item) => <li key={item.key}>{item.label}: {item.citation} A citação foi localizada no ficheiro; a interpretação e aplicação fiscal permanecem pendentes.</li>)}
|
||||
{document.documentary_evidence.map(
|
||||
(item) => (
|
||||
<li key={item.key}>
|
||||
{item.label}:{' '}
|
||||
{item.citation}{' '}
|
||||
A citação foi
|
||||
localizada no
|
||||
ficheiro; a
|
||||
interpretação e
|
||||
aplicação fiscal
|
||||
permanecem
|
||||
pendentes.
|
||||
</li>
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user