Browse Source

feat(client): add control type in holding form

pull/7050/head
KenTandrian 3 months ago
parent
commit
4515ec08df
  1. 18
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

18
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -44,7 +44,12 @@ import {
inject inject
} from '@angular/core'; } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import {
FormBuilder,
FormControl,
FormGroup,
ReactiveFormsModule
} from '@angular/forms';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatChipsModule } from '@angular/material/chips'; import { MatChipsModule } from '@angular/material/chips';
import { import {
@ -130,7 +135,9 @@ export class GfHoldingDetailDialogComponent implements OnInit {
protected hasPermissionToCreateOwnTag: boolean; protected hasPermissionToCreateOwnTag: boolean;
protected hasPermissionToReadMarketDataOfOwnAssetProfile: boolean; protected hasPermissionToReadMarketDataOfOwnAssetProfile: boolean;
protected historicalDataItems: LineChartItem[]; protected historicalDataItems: LineChartItem[];
protected holdingForm: FormGroup; protected holdingForm: FormGroup<{
tags: FormControl<Tag[] | null>;
}>;
protected investmentInBaseCurrencyWithCurrencyEffect: number; protected investmentInBaseCurrencyWithCurrencyEffect: number;
protected investmentInBaseCurrencyWithCurrencyEffectPrecision = 2; protected investmentInBaseCurrencyWithCurrencyEffectPrecision = 2;
protected readonly isUUID = isUUID; protected readonly isUUID = isUUID;
@ -193,12 +200,11 @@ export class GfHoldingDetailDialogComponent implements OnInit {
const filters = this.getActivityFilters(); const filters = this.getActivityFilters();
this.holdingForm = this.formBuilder.group({ this.holdingForm = this.formBuilder.group({
tags: [] as string[] tags: new FormControl<Tag[]>([])
}); });
this.holdingForm this.holdingForm.controls.tags.valueChanges
.get('tags') .pipe(takeUntilDestroyed(this.destroyRef))
?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((tags: Tag[]) => { .subscribe((tags: Tag[]) => {
const newTag = tags.find(({ id }) => { const newTag = tags.find(({ id }) => {
return id === undefined; return id === undefined;

Loading…
Cancel
Save