Browse Source

Extend coupons with createdAt

pull/7257/head
Thomas Kaul 1 week ago
parent
commit
5156a457e7
  1. 8
      apps/client/src/app/components/admin-overview/admin-overview.component.ts
  2. 22
      apps/client/src/app/components/admin-overview/admin-overview.html

8
apps/client/src/app/components/admin-overview/admin-overview.component.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
};

22
apps/client/src/app/components/admin-overview/admin-overview.html

@ -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

Loading…
Cancel
Save