|
|
@ -9,7 +9,7 @@ import { |
|
|
Component, |
|
|
Component, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
DestroyRef, |
|
|
DestroyRef, |
|
|
Inject, |
|
|
inject, |
|
|
OnInit |
|
|
OnInit |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
@ -49,28 +49,30 @@ import { |
|
|
templateUrl: './user-detail-dialog.html' |
|
|
templateUrl: './user-detail-dialog.html' |
|
|
}) |
|
|
}) |
|
|
export class GfUserDetailDialogComponent implements OnInit { |
|
|
export class GfUserDetailDialogComponent implements OnInit { |
|
|
public baseCurrency: string; |
|
|
protected baseCurrency: string; |
|
|
public readonly getCountryName = getCountryName; |
|
|
protected readonly getCountryName = getCountryName; |
|
|
public subscriptionsDataSource = new MatTableDataSource<Subscription>(); |
|
|
protected readonly subscriptionsDataSource = |
|
|
public subscriptionsDisplayedColumns = [ |
|
|
new MatTableDataSource<Subscription>(); |
|
|
|
|
|
protected readonly subscriptionsDisplayedColumns = [ |
|
|
'createdAt', |
|
|
'createdAt', |
|
|
'type', |
|
|
'type', |
|
|
'price', |
|
|
'price', |
|
|
'expiresAt' |
|
|
'expiresAt' |
|
|
]; |
|
|
]; |
|
|
public user: AdminUserResponse; |
|
|
protected user: AdminUserResponse; |
|
|
|
|
|
|
|
|
public constructor( |
|
|
protected readonly data = inject<UserDetailDialogParams>(MAT_DIALOG_DATA); |
|
|
private adminService: AdminService, |
|
|
|
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private readonly adminService = inject(AdminService); |
|
|
@Inject(MAT_DIALOG_DATA) public data: UserDetailDialogParams, |
|
|
private readonly changeDetectorRef = inject(ChangeDetectorRef); |
|
|
private dataService: DataService, |
|
|
private readonly dataService = inject(DataService); |
|
|
private destroyRef: DestroyRef, |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
public dialogRef: MatDialogRef< |
|
|
private readonly dialogRef = |
|
|
GfUserDetailDialogComponent, |
|
|
inject<MatDialogRef<GfUserDetailDialogComponent, UserDetailDialogResult>>( |
|
|
UserDetailDialogResult |
|
|
MatDialogRef |
|
|
> |
|
|
); |
|
|
) { |
|
|
|
|
|
|
|
|
public constructor() { |
|
|
this.baseCurrency = this.dataService.fetchInfo().baseCurrency; |
|
|
this.baseCurrency = this.dataService.fetchInfo().baseCurrency; |
|
|
|
|
|
|
|
|
addIcons({ |
|
|
addIcons({ |
|
|
@ -98,14 +100,14 @@ export class GfUserDetailDialogComponent implements OnInit { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public deleteUser() { |
|
|
protected deleteUser() { |
|
|
this.dialogRef.close({ |
|
|
this.dialogRef.close({ |
|
|
action: 'delete', |
|
|
action: 'delete', |
|
|
userId: this.data.userId |
|
|
userId: this.data.userId |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public getSum() { |
|
|
protected getSum() { |
|
|
return getSum( |
|
|
return getSum( |
|
|
this.subscriptionsDataSource.data |
|
|
this.subscriptionsDataSource.data |
|
|
.filter(({ price }) => { |
|
|
.filter(({ price }) => { |
|
|
@ -117,7 +119,7 @@ export class GfUserDetailDialogComponent implements OnInit { |
|
|
).toNumber(); |
|
|
).toNumber(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public getType({ createdAt, expiresAt, price }: Subscription) { |
|
|
protected getType({ createdAt, expiresAt, price }: Subscription) { |
|
|
if (price) { |
|
|
if (price) { |
|
|
return $localize`Paid`; |
|
|
return $localize`Paid`; |
|
|
} |
|
|
} |
|
|
@ -127,7 +129,7 @@ export class GfUserDetailDialogComponent implements OnInit { |
|
|
: $localize`Coupon`; |
|
|
: $localize`Coupon`; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onClose() { |
|
|
protected onClose() { |
|
|
this.dialogRef.close(); |
|
|
this.dialogRef.close(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|