Browse Source

feat(client): enforce encapsulation

pull/7294/head
KenTandrian 5 days ago
parent
commit
527bde0438
  1. 43
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

43
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -75,9 +75,10 @@ import { ActivityType } from './types/activity-type.type';
templateUrl: 'create-or-update-activity-dialog.html' templateUrl: 'create-or-update-activity-dialog.html'
}) })
export class GfCreateOrUpdateActivityDialogComponent { export class GfCreateOrUpdateActivityDialogComponent {
public activityForm: FormGroup; protected activityForm: FormGroup;
public assetClassOptions: AssetClassSelectorOption[] = Object.keys(AssetClass) protected readonly assetClassOptions: AssetClassSelectorOption[] =
Object.keys(AssetClass)
.map((id) => { .map((id) => {
return { id, label: translate(id) } as AssetClassSelectorOption; return { id, label: translate(id) } as AssetClassSelectorOption;
}) })
@ -85,20 +86,20 @@ export class GfCreateOrUpdateActivityDialogComponent {
return a.label.localeCompare(b.label); return a.label.localeCompare(b.label);
}); });
public assetSubClassOptions: AssetClassSelectorOption[] = []; protected assetSubClassOptions: AssetClassSelectorOption[] = [];
public currencies: string[] = []; protected currencies: string[] = [];
public currencyOfAssetProfile: string | undefined; protected currencyOfAssetProfile: string | undefined;
public currentMarketPrice: number | null = null; protected currentMarketPrice: number | null = null;
public defaultDateFormat: string; protected defaultDateFormat: string;
public defaultLookupItems: LookupItem[] = []; protected defaultLookupItems: LookupItem[] = [];
public hasPermissionToCreateOwnTag: boolean | undefined; protected hasPermissionToCreateOwnTag: boolean | undefined;
public isLoading = false; protected isLoading = false;
public isToday = isToday; protected readonly isToday = isToday;
public mode: 'create' | 'update'; protected mode: 'create' | 'update';
public tagsAvailable: Tag[] = []; protected tagsAvailable: Tag[] = [];
public total = 0; protected total = 0;
public typesTranslationMap = new Map<Type, string>(); protected typesTranslationMap = new Map<Type, string>();
public Validators = Validators; protected readonly Validators = Validators;
public constructor( public constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
@ -106,7 +107,7 @@ export class GfCreateOrUpdateActivityDialogComponent {
private dataService: DataService, private dataService: DataService,
private dateAdapter: DateAdapter<Date, string>, private dateAdapter: DateAdapter<Date, string>,
private destroyRef: DestroyRef, private destroyRef: DestroyRef,
public dialogRef: MatDialogRef<GfCreateOrUpdateActivityDialogComponent>, private dialogRef: MatDialogRef<GfCreateOrUpdateActivityDialogComponent>,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
@Inject(MAT_DATE_LOCALE) private locale: string, @Inject(MAT_DATE_LOCALE) private locale: string,
private userService: UserService private userService: UserService
@ -465,14 +466,14 @@ export class GfCreateOrUpdateActivityDialogComponent {
} }
} }
public applyCurrentMarketPrice() { protected applyCurrentMarketPrice() {
this.activityForm.patchValue({ this.activityForm.patchValue({
currencyOfUnitPrice: this.activityForm.get('currency')?.value, currencyOfUnitPrice: this.activityForm.get('currency')?.value,
unitPrice: this.currentMarketPrice unitPrice: this.currentMarketPrice
}); });
} }
public dateFilter(aDate: Date) { protected dateFilter(aDate: Date) {
if (!aDate) { if (!aDate) {
return true; return true;
} }
@ -480,11 +481,11 @@ export class GfCreateOrUpdateActivityDialogComponent {
return isAfter(aDate, new Date(0)); return isAfter(aDate, new Date(0));
} }
public onCancel() { protected onCancel() {
this.dialogRef.close(); this.dialogRef.close();
} }
public async onSubmit() { protected async onSubmit() {
const activity: CreateOrderDto | UpdateOrderDto = { const activity: CreateOrderDto | UpdateOrderDto = {
accountId: this.activityForm.get('accountId')?.value, accountId: this.activityForm.get('accountId')?.value,
assetClass: this.activityForm.get('assetClass')?.value, assetClass: this.activityForm.get('assetClass')?.value,

Loading…
Cancel
Save