fix: validate simulator dates and reconcile QA calculations reports and language
This commit is contained in:
@@ -1544,6 +1544,10 @@ export function validateSimulationDraft(
|
||||
draft: SimulationDraft,
|
||||
sectionId: string,
|
||||
): Record<string, string> {
|
||||
// The separate arithmetic validator checks its three inputs. Fiscal
|
||||
// eligibility facts are not inputs of this planning-only calculation.
|
||||
if (sectionId === 'tax' && draft.fiscal_scenario_mode === 'custom_planning')
|
||||
return {};
|
||||
const errors: Record<string, string> = {};
|
||||
for (const field of simulationFieldGroups[sectionId] ?? []) {
|
||||
if (field.showWhen && !field.showWhen(draft)) continue;
|
||||
@@ -1594,6 +1598,15 @@ export function validateSimulationDraft(
|
||||
errors[field.key] =
|
||||
'Introduza um endereço de correio electrónico válido.';
|
||||
}
|
||||
if (
|
||||
sectionId === 'tax' &&
|
||||
draft.fiscal_scenario_mode === 'approved_parameters' &&
|
||||
draft.fiscal_periodicity === 'one_off' &&
|
||||
!getFiscalPeriodRange(draft)
|
||||
) {
|
||||
errors.fiscal_reference_date =
|
||||
'Introduza uma data válida da operação no ano fiscal seleccionado. Não foi usada uma data alternativa.';
|
||||
}
|
||||
if (
|
||||
sectionId === 'financial' &&
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user