|
|
@ -20,6 +20,7 @@ import {
|
|
|
|
parseISO
|
|
|
|
parseISO
|
|
|
|
} from 'date-fns';
|
|
|
|
} from 'date-fns';
|
|
|
|
import { uniq } from 'lodash';
|
|
|
|
import { uniq } from 'lodash';
|
|
|
|
|
|
|
|
import { StringValue } from 'ms';
|
|
|
|
import { Subject } from 'rxjs';
|
|
|
|
import { Subject } from 'rxjs';
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
|
|
|
|
|
|
|
|
|
|
@ -29,6 +30,7 @@ import { takeUntil } from 'rxjs/operators';
|
|
|
|
templateUrl: './admin-overview.html'
|
|
|
|
templateUrl: './admin-overview.html'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
|
|
|
|
public couponDuration: StringValue = '30 days';
|
|
|
|
public coupons: Coupon[];
|
|
|
|
public coupons: Coupon[];
|
|
|
|
public customCurrencies: string[];
|
|
|
|
public customCurrencies: string[];
|
|
|
|
public dataGatheringInProgress: boolean;
|
|
|
|
public dataGatheringInProgress: boolean;
|
|
|
@ -105,7 +107,10 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public onAddCoupon() {
|
|
|
|
public onAddCoupon() {
|
|
|
|
const coupons = [...this.coupons, { code: this.generateCouponCode(16) }];
|
|
|
|
const coupons = [
|
|
|
|
|
|
|
|
...this.coupons,
|
|
|
|
|
|
|
|
{ code: this.generateCouponCode(16), duration: this.couponDuration }
|
|
|
|
|
|
|
|
];
|
|
|
|
this.putCoupons(coupons);
|
|
|
|
this.putCoupons(coupons);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -118,6 +123,10 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public onChangeCouponDuration(aCouponDuration: StringValue) {
|
|
|
|
|
|
|
|
this.couponDuration = aCouponDuration;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public onDeleteCoupon(aCouponCode: string) {
|
|
|
|
public onDeleteCoupon(aCouponCode: string) {
|
|
|
|
const confirmation = confirm('Do you really want to delete this coupon?');
|
|
|
|
const confirmation = confirm('Do you really want to delete this coupon?');
|
|
|
|
|
|
|
|
|
|
|
|