From a820fe2ace8cc0db9d8f3efa173c4c8a9c642daa Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 18 Aug 2026 20:58:47 +0200 Subject: [PATCH] Improve usability --- .../transfer-balance-dialog.component.ts | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts b/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts index 4f1a0efdc..5085283d5 100644 --- a/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts @@ -13,7 +13,6 @@ import { FormControl, FormGroup, ReactiveFormsModule, - ValidationErrors, Validators } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; @@ -62,19 +61,14 @@ export class GfTransferBalanceDialogComponent { }); }); - protected readonly transferBalanceForm: TransferBalanceForm = new FormGroup( - { - balance: new FormControl('', Validators.required), - fromAccount: new FormControl('', Validators.required), - toAccount: new FormControl( - { disabled: true, value: '' }, - Validators.required - ) - }, - { - validators: this.compareAccounts - } - ); + protected readonly transferBalanceForm: TransferBalanceForm = new FormGroup({ + balance: new FormControl('', Validators.required), + fromAccount: new FormControl('', Validators.required), + toAccount: new FormControl( + { disabled: true, value: null }, + Validators.required + ) + }); private readonly dialogRef = inject>(MatDialogRef); @@ -97,11 +91,11 @@ export class GfTransferBalanceDialogComponent { if (id) { if (toAccountControl.value === id) { toAccountControl.setValue(null); + toAccountControl.markAsPristine(); + toAccountControl.markAsUntouched(); } toAccountControl.enable(); - } else { - toAccountControl.disable(); } } ); @@ -121,19 +115,6 @@ export class GfTransferBalanceDialogComponent { this.dialogRef.close({ account }); } - private compareAccounts( - formGroup: TransferBalanceForm - ): ValidationErrors | null { - const accountFrom = formGroup.controls.fromAccount; - const accountTo = formGroup.controls.toAccount; - - if (accountFrom.value === accountTo.value) { - return { invalid: true }; - } - - return null; - } - private getAccountById(aId: string | null) { return this.accounts.find(({ id }) => { return id === aId;