Browse Source

Task/prefill form with current cash balance value in account details dialog (#6998)

* Prefill form with current cash balance value

* Update changelog
main
David Requeno 14 hours ago
committed by GitHub
parent
commit
449eaa1baa
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 1
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html
  3. 13
      libs/ui/src/lib/account-balances/account-balances.component.ts

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Prefilled the form in the account balance management with the current cash balance
## 3.8.0 - 2026-06-07 ## 3.8.0 - 2026-06-07
### Added ### Added

1
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html

@ -148,6 +148,7 @@
[accountBalances]="accountBalances" [accountBalances]="accountBalances"
[accountCurrency]="currency" [accountCurrency]="currency"
[accountId]="data.accountId" [accountId]="data.accountId"
[currentBalance]="balance"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[showActions]=" [showActions]="
!data.hasImpersonationId && !data.hasImpersonationId &&

13
libs/ui/src/lib/account-balances/account-balances.component.ts

@ -13,6 +13,7 @@ import {
OnChanges, OnChanges,
OnInit, OnInit,
Output, Output,
effect,
inject, inject,
input, input,
viewChild viewChild
@ -70,6 +71,7 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit {
input.required<AccountBalancesResponse['balances']>(); input.required<AccountBalancesResponse['balances']>();
public readonly accountCurrency = input.required<string>(); public readonly accountCurrency = input.required<string>();
public readonly accountId = input.required<string>(); public readonly accountId = input.required<string>();
public readonly currentBalance = input<number | null>();
public readonly displayedColumns: string[] = ['date', 'value', 'actions']; public readonly displayedColumns: string[] = ['date', 'value', 'actions'];
public readonly locale = input(getLocale()); public readonly locale = input(getLocale());
public readonly showActions = input(true); public readonly showActions = input(true);
@ -89,6 +91,17 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit {
public constructor() { public constructor() {
addIcons({ calendarClearOutline, ellipsisHorizontal, trashOutline }); addIcons({ calendarClearOutline, ellipsisHorizontal, trashOutline });
effect(() => {
const currentBalance = this.currentBalance();
if (
this.accountBalanceForm.controls.balance.pristine &&
typeof currentBalance === 'number'
) {
this.accountBalanceForm.controls.balance.setValue(currentBalance);
}
});
} }
public ngOnInit() { public ngOnInit() {

Loading…
Cancel
Save