Browse Source
Task/extend coupons with createdAt (#7257)
* Extend coupons with createdAt
pull/7260/head^2
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
31 additions and
2 deletions
-
apps/client/src/app/components/admin-overview/admin-overview.component.ts
-
apps/client/src/app/components/admin-overview/admin-overview.html
-
libs/common/src/lib/interfaces/coupon.interface.ts
|
|
|
@ -90,7 +90,12 @@ export class GfAdminOverviewComponent implements OnInit { |
|
|
|
protected activitiesCount: number; |
|
|
|
protected couponDuration: StringValue = '14 days'; |
|
|
|
protected readonly couponsDataSource = new MatTableDataSource<Coupon>(); |
|
|
|
protected readonly couponsDisplayedColumns = ['code', 'duration', 'actions']; |
|
|
|
protected readonly couponsDisplayedColumns = [ |
|
|
|
'code', |
|
|
|
'duration', |
|
|
|
'createdAt', |
|
|
|
'actions' |
|
|
|
]; |
|
|
|
protected hasPermissionForSubscription: boolean; |
|
|
|
protected hasPermissionForSystemMessage: boolean; |
|
|
|
protected hasPermissionToSyncDemoUserAccount: boolean; |
|
|
|
@ -201,6 +206,7 @@ export class GfAdminOverviewComponent implements OnInit { |
|
|
|
protected onAddCoupon() { |
|
|
|
const newCoupon: Coupon = { |
|
|
|
code: `${ghostfolioPrefix}${this.generateCouponCode(14)}`, |
|
|
|
createdAt: new Date().toISOString(), |
|
|
|
duration: this.couponDuration |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -180,6 +180,28 @@ |
|
|
|
</td> |
|
|
|
</ng-container> |
|
|
|
|
|
|
|
<ng-container matColumnDef="createdAt"> |
|
|
|
<th *matHeaderCellDef class="px-1 text-right" mat-header-cell> |
|
|
|
<ng-container i18n>Creation</ng-container> |
|
|
|
</th> |
|
|
|
<td |
|
|
|
*matCellDef="let element" |
|
|
|
class="px-1 text-right" |
|
|
|
mat-cell |
|
|
|
> |
|
|
|
@if (element.createdAt) { |
|
|
|
<gf-value |
|
|
|
class="d-inline-block justify-content-end" |
|
|
|
[isDate]="true" |
|
|
|
[locale]="user?.settings?.locale" |
|
|
|
[value]="element.createdAt" |
|
|
|
/> |
|
|
|
} @else { |
|
|
|
<span>-</span> |
|
|
|
} |
|
|
|
</td> |
|
|
|
</ng-container> |
|
|
|
|
|
|
|
<ng-container matColumnDef="actions" stickyEnd> |
|
|
|
<th |
|
|
|
*matHeaderCellDef |
|
|
|
|
|
|
|
@ -2,5 +2,6 @@ import { StringValue } from 'ms'; |
|
|
|
|
|
|
|
export interface Coupon { |
|
|
|
code: string; |
|
|
|
duration?: StringValue; |
|
|
|
createdAt: string; |
|
|
|
duration: StringValue; |
|
|
|
} |
|
|
|
|