From 449eaa1baa678c3be98f137cc5196986c0480fb1 Mon Sep 17 00:00:00 2001 From: David Requeno <108202767+DavidReque@users.noreply.github.com> Date: Mon, 8 Jun 2026 10:10:47 -0600 Subject: [PATCH] Task/prefill form with current cash balance value in account details dialog (#6998) * Prefill form with current cash balance value * Update changelog --- CHANGELOG.md | 6 ++++++ .../account-detail-dialog.html | 1 + .../account-balances/account-balances.component.ts | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef50d292f..07002a2d1 100644 --- a/CHANGELOG.md +++ b/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/), 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 ### Added diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html index cd397e35e..4b652db96 100644 --- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html +++ b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html @@ -148,6 +148,7 @@ [accountBalances]="accountBalances" [accountCurrency]="currency" [accountId]="data.accountId" + [currentBalance]="balance" [locale]="user?.settings?.locale" [showActions]=" !data.hasImpersonationId && diff --git a/libs/ui/src/lib/account-balances/account-balances.component.ts b/libs/ui/src/lib/account-balances/account-balances.component.ts index 7b26263b0..503f84071 100644 --- a/libs/ui/src/lib/account-balances/account-balances.component.ts +++ b/libs/ui/src/lib/account-balances/account-balances.component.ts @@ -13,6 +13,7 @@ import { OnChanges, OnInit, Output, + effect, inject, input, viewChild @@ -70,6 +71,7 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit { input.required(); public readonly accountCurrency = input.required(); public readonly accountId = input.required(); + public readonly currentBalance = input(); public readonly displayedColumns: string[] = ['date', 'value', 'actions']; public readonly locale = input(getLocale()); public readonly showActions = input(true); @@ -89,6 +91,17 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit { public constructor() { 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() {