fix: validar datas fiscais e iniciar revisao integrada do simulador

This commit is contained in:
2026-10-20 20:03:40 +02:00
parent e69ab1499f
commit 59ab4fe956
10 changed files with 80 additions and 24 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
return (
<Loader2Icon
role="status"
aria-label="Loading"
aria-label="A carregar"
className={cn("size-4 animate-spin", className)}
{...props}
/>
+4 -1
View File
@@ -468,7 +468,10 @@ export function exportFinancialToolsCsv(
['Pressupostos do empréstimo'],
['Capital', input.loan.principal],
['Taxa anual (%)', input.loan.annualRatePercent],
['Tipo de taxa', input.loan.rateType],
[
'Tipo de taxa',
input.loan.rateType === 'nominal' ? 'Nominal' : 'Efectiva',
],
['Prazo (meses)', input.loan.termMonths],
['Periodicidade (meses)', input.loan.periodMonths],
['Carência (períodos)', input.loan.gracePeriods ?? 0],
+3 -2
View File
@@ -28,9 +28,10 @@ export function getFiscalPeriodRange(
return { start: `${yearValue}-01-01`, end: `${yearValue}-12-31` };
if (draft.fiscal_periodicity === 'one_off') {
const date = String(draft.fiscal_reference_date ?? '');
const parsed = new Date(`${date}T00:00:00.000Z`);
return /^\d{4}-\d{2}-\d{2}$/.test(date) &&
new Date(`${date}T00:00:00.000Z`).toISOString().slice(0, 10) ===
date &&
Number.isFinite(parsed.getTime()) &&
parsed.toISOString().slice(0, 10) === date &&
date.startsWith(`${yearValue}-`)
? { start: date, end: date }
: null;
+9 -9
View File
@@ -16,7 +16,7 @@ import PasskeyVerify from '@/components/passkey-verify';
export default function ConfirmPassword() {
return (
<>
<Head title="Confirm password" />
<Head title="Confirmar palavra-passe" />
{/* @chisel-passkeys */}
<PasskeyVerify
@@ -24,9 +24,9 @@ export default function ConfirmPassword() {
options: confirmOptions(),
submit: confirmStore(),
}}
label="Confirm with passkey"
loadingLabel="Confirming..."
separator="Or confirm with password"
label="Confirmar com chave de acesso"
loadingLabel="A confirmar…"
separator="Ou confirmar com palavra-passe"
/>
{/* @end-chisel-passkeys */}
@@ -34,11 +34,11 @@ export default function ConfirmPassword() {
{({ processing, errors }) => (
<div className="space-y-6">
<div className="grid gap-2">
<Label htmlFor="password">Password</Label>
<Label htmlFor="password">Palavra-passe</Label>
<PasswordInput
id="password"
name="password"
placeholder="Password"
placeholder="Palavra-passe"
autoComplete="current-password"
autoFocus
/>
@@ -53,7 +53,7 @@ export default function ConfirmPassword() {
data-test="confirm-password-button"
>
{processing && <Spinner />}
Confirm password
Confirmar palavra-passe
</Button>
</div>
</div>
@@ -64,7 +64,7 @@ export default function ConfirmPassword() {
}
ConfirmPassword.layout = {
title: 'Confirm password',
title: 'Confirmar palavra-passe',
description:
'This is a secure area of the application. Please confirm your password before continuing.',
'Esta é uma área protegida. Confirme a sua palavra-passe para continuar.',
};
+13 -11
View File
@@ -28,15 +28,15 @@ export default function Security(props: Props) {
return (
<>
<Head title="Security settings" />
<Head title="Definições de segurança" />
<h1 className="sr-only">Security settings</h1>
<h1 className="sr-only">Definições de segurança</h1>
<div className="space-y-6">
<Heading
variant="small"
title="Update password"
description="Ensure your account is using a long, random password to stay secure"
title="Alterar palavra-passe"
description="Use uma palavra-passe longa e difícil de adivinhar para proteger a sua conta."
/>
<Form
@@ -65,7 +65,7 @@ export default function Security(props: Props) {
<>
<div className="grid gap-2">
<Label htmlFor="current_password">
Current password
Palavra-passe actual
</Label>
<PasswordInput
@@ -74,14 +74,16 @@ export default function Security(props: Props) {
name="current_password"
className="mt-1 block w-full"
autoComplete="current-password"
placeholder="Current password"
placeholder="Palavra-passe actual"
/>
<InputError message={errors.current_password} />
</div>
<div className="grid gap-2">
<Label htmlFor="password">New password</Label>
<Label htmlFor="password">
Nova palavra-passe
</Label>
<PasswordInput
id="password"
@@ -89,7 +91,7 @@ export default function Security(props: Props) {
name="password"
className="mt-1 block w-full"
autoComplete="new-password"
placeholder="New password"
placeholder="Nova palavra-passe"
passwordrules={props.passwordRules}
/>
@@ -98,7 +100,7 @@ export default function Security(props: Props) {
<div className="grid gap-2">
<Label htmlFor="password_confirmation">
Confirm password
Confirmar palavra-passe
</Label>
<PasswordInput
@@ -106,7 +108,7 @@ export default function Security(props: Props) {
name="password_confirmation"
className="mt-1 block w-full"
autoComplete="new-password"
placeholder="Confirm password"
placeholder="Confirmar palavra-passe"
passwordrules={props.passwordRules}
/>
@@ -120,7 +122,7 @@ export default function Security(props: Props) {
disabled={processing}
data-test="update-password-button"
>
Save
Guardar
</Button>
</div>
</>