|
|
@ -6,10 +6,7 @@ import { |
|
|
DEFAULT_LOCALE |
|
|
DEFAULT_LOCALE |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
import { CreateOrderDto, UpdateOrderDto } from '@ghostfolio/common/dtos'; |
|
|
import { CreateOrderDto, UpdateOrderDto } from '@ghostfolio/common/dtos'; |
|
|
import { |
|
|
import { getStringOrNull } from '@ghostfolio/common/helper'; |
|
|
getDateFormatString, |
|
|
|
|
|
getStringOrNull |
|
|
|
|
|
} from '@ghostfolio/common/helper'; |
|
|
|
|
|
import { |
|
|
import { |
|
|
AssetClassSelectorOption, |
|
|
AssetClassSelectorOption, |
|
|
LookupItem |
|
|
LookupItem |
|
|
@ -41,7 +38,6 @@ import { |
|
|
} from '@angular/forms'; |
|
|
} from '@angular/forms'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatCheckboxModule } from '@angular/material/checkbox'; |
|
|
import { MatCheckboxModule } from '@angular/material/checkbox'; |
|
|
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core'; |
|
|
|
|
|
import { MatDatepickerModule } from '@angular/material/datepicker'; |
|
|
import { MatDatepickerModule } from '@angular/material/datepicker'; |
|
|
import { |
|
|
import { |
|
|
MAT_DIALOG_DATA, |
|
|
MAT_DIALOG_DATA, |
|
|
@ -102,7 +98,6 @@ export class GfCreateOrUpdateActivityDialogComponent { |
|
|
protected currencies: string[] = []; |
|
|
protected currencies: string[] = []; |
|
|
protected currencyOfAssetProfile: string | undefined; |
|
|
protected currencyOfAssetProfile: string | undefined; |
|
|
protected currentMarketPrice: number | null = null; |
|
|
protected currentMarketPrice: number | null = null; |
|
|
protected defaultDateFormat: string; |
|
|
|
|
|
protected defaultLookupItems: LookupItem[] = []; |
|
|
protected defaultLookupItems: LookupItem[] = []; |
|
|
protected hasPermissionToCreateOwnTag: boolean; |
|
|
protected hasPermissionToCreateOwnTag: boolean; |
|
|
protected isLoading = false; |
|
|
protected isLoading = false; |
|
|
@ -119,7 +114,6 @@ export class GfCreateOrUpdateActivityDialogComponent { |
|
|
|
|
|
|
|
|
private readonly changeDetectorRef = inject(ChangeDetectorRef); |
|
|
private readonly changeDetectorRef = inject(ChangeDetectorRef); |
|
|
private readonly dataService = inject(DataService); |
|
|
private readonly dataService = inject(DataService); |
|
|
private readonly dateAdapter = inject<DateAdapter<Date, string>>(DateAdapter); |
|
|
|
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
private readonly dialogRef = |
|
|
private readonly dialogRef = |
|
|
inject<MatDialogRef<GfCreateOrUpdateActivityDialogComponent>>(MatDialogRef); |
|
|
inject<MatDialogRef<GfCreateOrUpdateActivityDialogComponent>>(MatDialogRef); |
|
|
@ -127,7 +121,6 @@ export class GfCreateOrUpdateActivityDialogComponent { |
|
|
private readonly impersonationStorageService = inject( |
|
|
private readonly impersonationStorageService = inject( |
|
|
ImpersonationStorageService |
|
|
ImpersonationStorageService |
|
|
); |
|
|
); |
|
|
private locale = inject<string>(MAT_DATE_LOCALE); |
|
|
|
|
|
private readonly userService = inject(UserService); |
|
|
private readonly userService = inject(UserService); |
|
|
|
|
|
|
|
|
public constructor() { |
|
|
public constructor() { |
|
|
@ -143,15 +136,11 @@ export class GfCreateOrUpdateActivityDialogComponent { |
|
|
!this.impersonationStorageService.getId() && |
|
|
!this.impersonationStorageService.getId() && |
|
|
hasPermission(this.data.user?.permissions, permissions.createOwnTag); |
|
|
hasPermission(this.data.user?.permissions, permissions.createOwnTag); |
|
|
|
|
|
|
|
|
this.locale = this.data.user.settings.locale ?? DEFAULT_LOCALE; |
|
|
|
|
|
this.mode = this.data.activity?.id ? 'update' : 'create'; |
|
|
this.mode = this.data.activity?.id ? 'update' : 'create'; |
|
|
|
|
|
|
|
|
this.dateAdapter.setLocale(this.locale); |
|
|
|
|
|
|
|
|
|
|
|
const { currencies } = this.dataService.fetchInfo(); |
|
|
const { currencies } = this.dataService.fetchInfo(); |
|
|
|
|
|
|
|
|
this.currencies = currencies; |
|
|
this.currencies = currencies; |
|
|
this.defaultDateFormat = getDateFormatString(this.locale); |
|
|
|
|
|
|
|
|
|
|
|
this.dataService |
|
|
this.dataService |
|
|
.fetchPortfolioHoldings({ |
|
|
.fetchPortfolioHoldings({ |
|
|
|