|
|
@ -6,7 +6,6 @@ import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { |
|
|
|
PROPERTY_COUPONS, |
|
|
|
PROPERTY_CURRENCIES, |
|
|
|
PROPERTY_IS_DATA_GATHERING_ENABLED, |
|
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED, |
|
|
@ -41,8 +40,6 @@ import { takeUntil } from 'rxjs/operators'; |
|
|
|
export class AdminOverviewComponent implements OnDestroy, OnInit { |
|
|
|
public couponDuration: StringValue = '14 days'; |
|
|
|
public coupons: Coupon[]; |
|
|
|
public customCurrencies: string[]; |
|
|
|
public exchangeRates: { label1: string; label2: string; value: number }[]; |
|
|
|
public hasPermissionForSubscription: boolean; |
|
|
|
public hasPermissionForSystemMessage: boolean; |
|
|
|
public hasPermissionToToggleReadOnlyMode: boolean; |
|
|
@ -138,19 +135,6 @@ export class AdminOverviewComponent implements OnDestroy, OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public onDeleteCurrency(aCurrency: string) { |
|
|
|
this.notificationService.confirm({ |
|
|
|
confirmFn: () => { |
|
|
|
const currencies = this.customCurrencies.filter((currency) => { |
|
|
|
return currency !== aCurrency; |
|
|
|
}); |
|
|
|
this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies }); |
|
|
|
}, |
|
|
|
confirmType: ConfirmationDialogType.Warn, |
|
|
|
title: $localize`Do you really want to delete this currency?` |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public onDeleteSystemMessage() { |
|
|
|
this.notificationService.confirm({ |
|
|
|
confirmFn: () => { |
|
|
@ -231,25 +215,17 @@ export class AdminOverviewComponent implements OnDestroy, OnInit { |
|
|
|
this.adminService |
|
|
|
.fetchAdminData() |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe( |
|
|
|
({ exchangeRates, settings, transactionCount, userCount, version }) => { |
|
|
|
this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? []; |
|
|
|
this.customCurrencies = settings[PROPERTY_CURRENCIES] as string[]; |
|
|
|
this.exchangeRates = exchangeRates; |
|
|
|
this.isDataGatheringEnabled = |
|
|
|
settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false |
|
|
|
? false |
|
|
|
: true; |
|
|
|
this.systemMessage = settings[ |
|
|
|
PROPERTY_SYSTEM_MESSAGE |
|
|
|
] as SystemMessage; |
|
|
|
this.transactionCount = transactionCount; |
|
|
|
this.userCount = userCount; |
|
|
|
this.version = version; |
|
|
|
.subscribe(({ settings, transactionCount, userCount, version }) => { |
|
|
|
this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? []; |
|
|
|
this.isDataGatheringEnabled = |
|
|
|
settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false ? false : true; |
|
|
|
this.systemMessage = settings[PROPERTY_SYSTEM_MESSAGE] as SystemMessage; |
|
|
|
this.transactionCount = transactionCount; |
|
|
|
this.userCount = userCount; |
|
|
|
this.version = version; |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
} |
|
|
|
); |
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private generateCouponCode(aLength: number) { |
|
|
|