Browse Source

feat(client): enforce immutability

pull/7080/head
KenTandrian 4 weeks ago
parent
commit
be8f63bbf0
  1. 23
      apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

23
apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

@ -42,23 +42,14 @@ import {
templateUrl: 'transfer-balance-dialog.html'
})
export class GfTransferBalanceDialogComponent {
protected accounts: Account[] = [];
protected currency: string;
protected transferBalanceForm: TransferBalanceForm;
protected readonly accounts: Account[] =
inject<TransferBalanceDialogParams>(MAT_DIALOG_DATA).accounts;
private readonly data = inject<TransferBalanceDialogParams>(MAT_DIALOG_DATA);
private readonly dialogRef =
inject<MatDialogRef<GfTransferBalanceDialogComponent>>(MatDialogRef);
public ngOnInit() {
this.accounts = this.data.accounts;
protected currency: string;
this.transferBalanceForm = new FormGroup(
protected readonly transferBalanceForm: TransferBalanceForm = new FormGroup(
{
balance: new FormControl<number | string | null>(
'',
Validators.required
),
balance: new FormControl<number | string | null>('', Validators.required),
fromAccount: new FormControl<string | null>('', Validators.required),
toAccount: new FormControl<string | null>('', Validators.required)
},
@ -67,6 +58,10 @@ export class GfTransferBalanceDialogComponent {
}
);
private readonly dialogRef =
inject<MatDialogRef<GfTransferBalanceDialogComponent>>(MatDialogRef);
public ngOnInit() {
this.transferBalanceForm.controls.fromAccount.valueChanges.subscribe(
(id) => {
const currency = this.accounts.find((account) => {

Loading…
Cancel
Save