diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts index 9e153d173..10726afdd 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts @@ -31,6 +31,7 @@ import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces'; }) export class CreateOrUpdateAccountDialog implements OnDestroy { public accountForm: FormGroup; + public accountCurrency: Currency; public currencies: Currency[] = []; public filteredPlatforms: Observable; public platforms: Platform[]; @@ -51,6 +52,10 @@ export class CreateOrUpdateAccountDialog implements OnDestroy { label: currency, value: currency })); + this.accountCurrency = { + label: this.data.account.currency, + value: this.data.account.currency + }; this.platforms = platforms; this.accountForm = this.formBuilder.group({ diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html index c901a9111..15afabc26 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html @@ -23,6 +23,7 @@ @@ -36,7 +37,7 @@ (keydown.enter)="$event.stopPropagation()" /> {{ accountForm.controls['currency'].value }}{{ accountForm.controls['currency']?.value?.value }} diff --git a/libs/ui/src/lib/currency-selector/currency-selector.component.ts b/libs/ui/src/lib/currency-selector/currency-selector.component.ts index c38b44c20..12037b9e7 100644 --- a/libs/ui/src/lib/currency-selector/currency-selector.component.ts +++ b/libs/ui/src/lib/currency-selector/currency-selector.component.ts @@ -39,9 +39,9 @@ import { map, startWith, takeUntil } from 'rxjs/operators'; }) export class CurrencySelectorComponent extends AbstractMatFormField - implements OnInit, OnDestroy -{ + implements OnInit, OnDestroy { @Input() private currencies: Currency[] = []; + @Input() defaultValue: Currency; @ViewChild(MatInput, { static: false }) private input: MatInput; @@ -64,6 +64,12 @@ export class CurrencySelectorComponent this.controlType = 'currency-autocomplete'; } + public ngOnChanges() { + if (this.defaultValue) { + this.value = this.defaultValue; + } + } + public ngOnInit() { if (this.disabled) { this.control.disable();