feat: add total balance calculation and display in account management; update account card to show calculated balance
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m26s

This commit is contained in:
Julien Froidefond
2025-12-20 11:30:26 +01:00
parent 4e1e623f93
commit 376bc8f84e
8 changed files with 367 additions and 56 deletions

View File

@@ -25,6 +25,7 @@ interface AccountFormData {
folderId: string;
externalUrl: string;
initialBalance: number;
totalBalance: number;
}
interface AccountEditDialogProps {
@@ -101,21 +102,42 @@ export function AccountEditDialog({
</Select>
</div>
<div className="space-y-2">
<Label>Solde initial</Label>
<Label>Solde total</Label>
<Input
type="number"
step="0.01"
value={formData.initialBalance}
value={formData.totalBalance}
onChange={(e) =>
onFormDataChange({
...formData,
initialBalance: parseFloat(e.target.value) || 0,
totalBalance: parseFloat(e.target.value) || 0,
})
}
placeholder="0.00"
/>
<p className="text-xs text-muted-foreground">
Solde de départ pour équilibrer le compte
Solde total du compte (balance + solde initial)
</p>
</div>
<div className="space-y-2">
<Label>Solde initial</Label>
<Input
type="number"
step="0.01"
value={formData.initialBalance}
onChange={(e) => {
const newInitialBalance = parseFloat(e.target.value) || 0;
onFormDataChange({
...formData,
initialBalance: newInitialBalance,
// Ajuster le solde total pour maintenir la cohérence
totalBalance: formData.totalBalance,
});
}}
placeholder="0.00"
/>
<p className="text-xs text-muted-foreground">
Solde de départ pour équilibrer le compte. Le balance sera calculé automatiquement (solde total - solde initial).
</p>
</div>
<div className="space-y-2">