Browse Source
Task/various improvements in subscription table of user detail dialog (#7091)
Various improvements
pull/7084/head
Thomas Kaul
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
22 additions and
21 deletions
-
apps/api/src/app/admin/admin.service.ts
-
apps/client/src/app/components/user-detail-dialog/user-detail-dialog.component.ts
-
apps/client/src/app/components/user-detail-dialog/user-detail-dialog.html
|
|
|
@ -182,7 +182,7 @@ export class AdminService { |
|
|
|
} |
|
|
|
|
|
|
|
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { |
|
|
|
const subscriptions = await this.prismaService.subscription.findMany({ |
|
|
|
user.subscriptions = await this.prismaService.subscription.findMany({ |
|
|
|
orderBy: { |
|
|
|
expiresAt: 'desc' |
|
|
|
}, |
|
|
|
@ -190,13 +190,6 @@ export class AdminService { |
|
|
|
userId: id |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
user.subscriptions = subscriptions.map((subscription) => { |
|
|
|
return { |
|
|
|
...subscription, |
|
|
|
price: subscription.price ?? 0 |
|
|
|
}; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
return user; |
|
|
|
|
|
|
|
@ -106,9 +106,13 @@ export class GfUserDetailDialogComponent implements OnInit { |
|
|
|
|
|
|
|
public getSum() { |
|
|
|
return getSum( |
|
|
|
this.subscriptionsDataSource.data.map(({ price }) => { |
|
|
|
return new Big(price); |
|
|
|
}) |
|
|
|
this.subscriptionsDataSource.data |
|
|
|
.filter(({ price }) => { |
|
|
|
return price !== null; |
|
|
|
}) |
|
|
|
.map(({ price }) => { |
|
|
|
return new Big(price); |
|
|
|
}) |
|
|
|
).toNumber(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -128,7 +128,7 @@ |
|
|
|
@if (subscriptionsDataSource.data.length > 0) { |
|
|
|
<div class="row"> |
|
|
|
<div class="col"> |
|
|
|
<h2 class="h6" i18n>Subscriptions</h2> |
|
|
|
<h2 class="h6" i18n>Subscription History</h2> |
|
|
|
<div class="overflow-x-auto"> |
|
|
|
<table |
|
|
|
class="gf-table w-100" |
|
|
|
@ -137,7 +137,7 @@ |
|
|
|
> |
|
|
|
<ng-container matColumnDef="createdAt"> |
|
|
|
<th *matHeaderCellDef class="px-1" mat-header-cell> |
|
|
|
<ng-container i18n>Created</ng-container> |
|
|
|
<ng-container i18n>Creation</ng-container> |
|
|
|
</th> |
|
|
|
<td *matCellDef="let element" class="px-1" mat-cell> |
|
|
|
<gf-value |
|
|
|
@ -170,13 +170,17 @@ |
|
|
|
class="px-1 text-right" |
|
|
|
mat-cell |
|
|
|
> |
|
|
|
<gf-value |
|
|
|
class="d-inline-block justify-content-end" |
|
|
|
[isCurrency]="true" |
|
|
|
[locale]="data.locale" |
|
|
|
[unit]="baseCurrency" |
|
|
|
[value]="element.price" |
|
|
|
/> |
|
|
|
@if (element.price === null) { |
|
|
|
<span>—</span> |
|
|
|
} @else { |
|
|
|
<gf-value |
|
|
|
class="d-inline-block justify-content-end" |
|
|
|
[isCurrency]="true" |
|
|
|
[locale]="data.locale" |
|
|
|
[unit]="baseCurrency" |
|
|
|
[value]="element.price" |
|
|
|
/> |
|
|
|
} |
|
|
|
</td> |
|
|
|
<td *matFooterCellDef class="px-1 text-right" mat-footer-cell> |
|
|
|
<gf-value |
|
|
|
@ -191,7 +195,7 @@ |
|
|
|
|
|
|
|
<ng-container matColumnDef="expiresAt"> |
|
|
|
<th *matHeaderCellDef class="px-1" mat-header-cell> |
|
|
|
<ng-container i18n>Expires</ng-container> |
|
|
|
<ng-container i18n>Expiration</ng-container> |
|
|
|
</th> |
|
|
|
<td *matCellDef="let element" class="px-1" mat-cell> |
|
|
|
<gf-value |
|
|
|
|