Moved from tslint to eslint as tslint was depreciated.
Added prettier and also prettied all the typescript files using prettier ESLint is using the AirBnB rules which are the most strict to lint the files.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import {DataSource} from '@angular/cdk/collections';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Incentive} from '../core/voucher';
|
||||
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Incentive } from '../core/voucher';
|
||||
|
||||
export class IncentiveDataSource extends DataSource<Incentive> {
|
||||
|
||||
constructor(private data: Observable<Incentive[]>) {
|
||||
super();
|
||||
}
|
||||
@@ -13,6 +11,5 @@ export class IncentiveDataSource extends DataSource<Incentive> {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
disconnect() {}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {IncentiveResolver} from './incentive-resolver.service';
|
||||
import { IncentiveResolver } from './incentive-resolver.service';
|
||||
|
||||
describe('IncentiveResolver', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [IncentiveResolver]
|
||||
providers: [IncentiveResolver],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {Voucher} from '../core/voucher';
|
||||
import {VoucherService} from '../core/voucher.service';
|
||||
import {tap} from 'rxjs/operators';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { Voucher } from '../core/voucher';
|
||||
import { VoucherService } from '../core/voucher.service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class IncentiveResolver implements Resolve<Voucher> {
|
||||
|
||||
constructor(private ser: VoucherService) {
|
||||
}
|
||||
constructor(private ser: VoucherService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Voucher> {
|
||||
const id = route.paramMap.get('id');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {IncentiveRoutingModule} from './incentive-routing.module';
|
||||
import { IncentiveRoutingModule } from './incentive-routing.module';
|
||||
|
||||
describe('IncentiveRoutingModule', () => {
|
||||
let incentiveRoutingModule: IncentiveRoutingModule;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {IncentiveResolver} from './incentive-resolver.service';
|
||||
import {AuthGuard} from '../auth/auth-guard.service';
|
||||
import {IncentiveComponent} from './incentive.component';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { IncentiveResolver } from './incentive-resolver.service';
|
||||
import { AuthGuard } from '../auth/auth-guard.service';
|
||||
import { IncentiveComponent } from './incentive.component';
|
||||
|
||||
const incentiveRoutes: Routes = [
|
||||
{
|
||||
@@ -11,39 +11,30 @@ const incentiveRoutes: Routes = [
|
||||
component: IncentiveComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'incentive'
|
||||
permission: 'incentive',
|
||||
},
|
||||
resolve: {
|
||||
voucher: IncentiveResolver
|
||||
voucher: IncentiveResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'always'
|
||||
runGuardsAndResolvers: 'always',
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: IncentiveComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'incentive'
|
||||
permission: 'incentive',
|
||||
},
|
||||
resolve: {
|
||||
voucher: IncentiveResolver
|
||||
voucher: IncentiveResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'always'
|
||||
}
|
||||
runGuardsAndResolvers: 'always',
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(incentiveRoutes)
|
||||
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
],
|
||||
providers: [
|
||||
IncentiveResolver
|
||||
]
|
||||
imports: [CommonModule, RouterModule.forChild(incentiveRoutes)],
|
||||
exports: [RouterModule],
|
||||
providers: [IncentiveResolver],
|
||||
})
|
||||
export class IncentiveRoutingModule {
|
||||
}
|
||||
export class IncentiveRoutingModule {}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
}
|
||||
|
||||
.selected {
|
||||
background: #fff3cd
|
||||
background: #fff3cd;
|
||||
}
|
||||
|
||||
.unposted {
|
||||
background: #f8d7da
|
||||
background: #f8d7da;
|
||||
}
|
||||
|
||||
.center {
|
||||
|
||||
@@ -6,41 +6,48 @@
|
||||
<form [formGroup]="form" fxLayout="column">
|
||||
<div fxLayout="row" fxLayout.lt-md="column" fxLayoutGap="20px" fxLayoutGap.lt-md="0px">
|
||||
<mat-form-field fxFlex>
|
||||
<input matInput [matDatepicker]="date" (focus)="date.open()" placeholder="Date" formControlName="date"
|
||||
autocomplete="off">
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="date"
|
||||
(focus)="date.open()"
|
||||
placeholder="Date"
|
||||
formControlName="date"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
|
||||
<mat-datepicker #date></mat-datepicker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayout.lt-md="column" fxLayoutGap="20px" fxLayoutGap.lt-md="0px">
|
||||
Total Incentive: <strong>{{voucher.incentive | number:'1.2-2'}}</strong>
|
||||
Total Points: <strong>{{totalPoints() | number:'1.2-2'}}</strong>
|
||||
Point Value: <strong>{{pointValue() | number:'1.2-2'}}</strong>
|
||||
Total Incentive: <strong>{{ voucher.incentive | number: '1.2-2' }}</strong> Total Points:
|
||||
<strong>{{ totalPoints() | number: '1.2-2' }}</strong> Point Value:
|
||||
<strong>{{ pointValue() | number: '1.2-2' }}</strong>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" formArrayName="incentives">
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.name}}</mat-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.name }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Designation Column -->
|
||||
<ng-container matColumnDef="designation">
|
||||
<mat-header-cell *matHeaderCellDef>Designation</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.designation}}</mat-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.designation }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Department Column -->
|
||||
<ng-container matColumnDef="department">
|
||||
<mat-header-cell *matHeaderCellDef>Department</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.department}}</mat-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.department }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- DaysWorked Column -->
|
||||
<ng-container matColumnDef="daysWorked">
|
||||
<mat-header-cell *matHeaderCellDef class="right">DaysWorked</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{row.daysWorked | number:'1.2-2'}}</mat-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{
|
||||
row.daysWorked | number: '1.2-2'
|
||||
}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Points Column -->
|
||||
@@ -51,7 +58,12 @@
|
||||
<button matPrefix (click)="less(row, i)">
|
||||
<mat-icon>remove</mat-icon>
|
||||
</button>
|
||||
<input matInput formControlName="points" autocomplete="off" (change)="change(row, i)">
|
||||
<input
|
||||
matInput
|
||||
formControlName="points"
|
||||
autocomplete="off"
|
||||
(change)="change(row, i)"
|
||||
/>
|
||||
<button matSuffix color="warn" (click)="more(row, i)">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
@@ -62,29 +74,42 @@
|
||||
<!-- Amount Column -->
|
||||
<ng-container matColumnDef="amount">
|
||||
<mat-header-cell *matHeaderCellDef class="right">Amount</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{amount(row) | currency:'INR'}}</mat-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{
|
||||
amount(row) | currency: 'INR'
|
||||
}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
</mat-table>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" (click)="save()" [disabled]="!canSave()">
|
||||
{{(voucher.id) ? 'Update' : 'Save'}}
|
||||
{{ voucher.id ? 'Update' : 'Save' }}
|
||||
</button>
|
||||
<button mat-raised-button (click)="post()" *ngIf="voucher.id"
|
||||
[disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1">
|
||||
{{(voucher.posted) ? 'Posted' : 'Post'}}
|
||||
<button
|
||||
mat-raised-button
|
||||
(click)="post()"
|
||||
*ngIf="voucher.id"
|
||||
[disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"
|
||||
>
|
||||
{{ voucher.posted ? 'Posted' : 'Post' }}
|
||||
</button>
|
||||
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()">
|
||||
<button
|
||||
mat-raised-button
|
||||
color="warn"
|
||||
(click)="confirmDelete()"
|
||||
*ngIf="voucher.id"
|
||||
[disabled]="!canSave()"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</mat-card-actions>
|
||||
<mat-card-subtitle *ngIf="voucher.id">
|
||||
Created on <strong>{{voucher.creationDate | localTime}}</strong> and
|
||||
Last Edited on <strong>{{voucher.lastEditDate | localTime}}</strong>
|
||||
by <strong>{{voucher.user.name}}</strong>. {{(voucher.poster) ? 'Posted by ' + voucher.poster : ''}}
|
||||
Created on <strong>{{ voucher.creationDate | localTime }}</strong> and Last Edited on
|
||||
<strong>{{ voucher.lastEditDate | localTime }}</strong> by
|
||||
<strong>{{ voucher.user.name }}</strong
|
||||
>. {{ voucher.poster ? 'Posted by ' + voucher.poster : '' }}
|
||||
</mat-card-subtitle>
|
||||
</mat-card>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {IncentiveComponent} from './incentive.component';
|
||||
import { IncentiveComponent } from './incentive.component';
|
||||
|
||||
describe('IncentiveComponent', () => {
|
||||
let component: IncentiveComponent;
|
||||
@@ -8,9 +8,8 @@ describe('IncentiveComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [IncentiveComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [IncentiveComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {FormArray, FormBuilder, FormGroup} from '@angular/forms';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {BehaviorSubject, Observable} from 'rxjs';
|
||||
import {IncentiveDataSource} from './incentive-datasource';
|
||||
import {Account} from '../core/account';
|
||||
import {VoucherService} from '../core/voucher.service';
|
||||
import {Incentive, Voucher} from '../core/voucher';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { IncentiveDataSource } from './incentive-datasource';
|
||||
import { Account } from '../core/account';
|
||||
import { VoucherService } from '../core/voucher.service';
|
||||
import { Incentive, Voucher } from '../core/voucher';
|
||||
import * as moment from 'moment';
|
||||
import {AuthService} from '../auth/auth.service';
|
||||
import {ConfirmDialogComponent} from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
import {ToasterService} from '../core/toaster.service';
|
||||
import {map} from 'rxjs/operators';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { ToasterService } from '../core/toaster.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-incentive',
|
||||
templateUrl: './incentive.component.html',
|
||||
styleUrls: ['./incentive.component.css']
|
||||
styleUrls: ['./incentive.component.css'],
|
||||
})
|
||||
export class IncentiveComponent implements OnInit {
|
||||
public incentiveObservable = new BehaviorSubject<Incentive[]>([]);
|
||||
@@ -37,29 +37,31 @@ export class IncentiveComponent implements OnInit {
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private auth: AuthService,
|
||||
private ser: VoucherService
|
||||
private ser: VoucherService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.listenToDateChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { voucher: Voucher }) => {
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
}
|
||||
|
||||
loadVoucher(voucher) {
|
||||
this.voucher = voucher;
|
||||
this.form.get('date').setValue(moment(this.voucher.date, 'DD-MMM-YYYY').toDate());
|
||||
this.form.setControl('incentives', this.fb.array(
|
||||
this.voucher.incentives.map(
|
||||
x => this.fb.group({
|
||||
points: x.points
|
||||
})
|
||||
)
|
||||
));
|
||||
this.form.setControl(
|
||||
'incentives',
|
||||
this.fb.array(
|
||||
this.voucher.incentives.map((x) =>
|
||||
this.fb.group({
|
||||
points: x.points,
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
this.dataSource = new IncentiveDataSource(this.incentiveObservable);
|
||||
this.incentiveObservable.next(this.voucher.incentives);
|
||||
}
|
||||
@@ -67,50 +69,64 @@ export class IncentiveComponent implements OnInit {
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
incentives: this.fb.array([])
|
||||
incentives: this.fb.array([]),
|
||||
});
|
||||
}
|
||||
|
||||
listenToDateChange(): void {
|
||||
this.form.get('date').valueChanges.pipe(
|
||||
map(x => moment(x).format('DD-MMM-YYYY'))
|
||||
).subscribe(x => {
|
||||
if (x !== this.voucher.date && !this.voucher.id) {
|
||||
return this.ser.getIncentive(x)
|
||||
.subscribe((voucher: Voucher) => {
|
||||
this.form
|
||||
.get('date')
|
||||
.valueChanges.pipe(map((x) => moment(x).format('DD-MMM-YYYY')))
|
||||
.subscribe((x) => {
|
||||
if (x !== this.voucher.date && !this.voucher.id) {
|
||||
return this.ser.getIncentive(x).subscribe((voucher: Voucher) => {
|
||||
this.loadVoucher(voucher);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
totalPoints() {
|
||||
return this.voucher.incentives.map((item) => {
|
||||
return item.daysWorked * item.points;
|
||||
}).reduce((sum, item) => {
|
||||
return sum + item;
|
||||
});
|
||||
return this.voucher.incentives
|
||||
.map((item) => {
|
||||
return item.daysWorked * item.points;
|
||||
})
|
||||
.reduce((sum, item) => {
|
||||
return sum + item;
|
||||
});
|
||||
}
|
||||
|
||||
pointValue() {
|
||||
return Math.round(this.voucher.incentive * 100 / this.totalPoints()) / 100;
|
||||
return Math.round((this.voucher.incentive * 100) / this.totalPoints()) / 100;
|
||||
}
|
||||
|
||||
less(row: Incentive, i: number) {
|
||||
if (row.points >= 1) {
|
||||
row.points -= 1;
|
||||
this.form.get('incentives').get('' + i).setValue({'points': '' + row.points});
|
||||
this.form
|
||||
.get('incentives')
|
||||
.get('' + i)
|
||||
.setValue({ points: '' + row.points });
|
||||
}
|
||||
}
|
||||
|
||||
change(row: Incentive, i: number) {
|
||||
row.points = +(this.form.get('incentives').get('' + i).get('points').value);
|
||||
this.form.get('incentives').get('' + i).setValue({'points': '' + row.points});
|
||||
row.points = +this.form
|
||||
.get('incentives')
|
||||
.get('' + i)
|
||||
.get('points').value;
|
||||
this.form
|
||||
.get('incentives')
|
||||
.get('' + i)
|
||||
.setValue({ points: '' + row.points });
|
||||
}
|
||||
|
||||
more(row: Incentive, i: number) {
|
||||
row.points += 1;
|
||||
this.form.get('incentives').get('' + i).setValue({'points': '' + row.points});
|
||||
this.form
|
||||
.get('incentives')
|
||||
.get('' + i)
|
||||
.setValue({ points: '' + row.points });
|
||||
}
|
||||
|
||||
amount(row) {
|
||||
@@ -123,38 +139,39 @@ export class IncentiveComponent implements OnInit {
|
||||
} else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1;
|
||||
return (
|
||||
this.voucher.user.id === this.auth.user.id ||
|
||||
this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
post() {
|
||||
this.ser.post(this.voucher.id)
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.loadVoucher(result);
|
||||
this.toaster.show('Success', 'Voucher Posted');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
}
|
||||
);
|
||||
this.ser.post(this.voucher.id).subscribe(
|
||||
(result) => {
|
||||
this.loadVoucher(result);
|
||||
this.toaster.show('Success', 'Voucher Posted');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
save() {
|
||||
const voucher: Voucher = this.getVoucher();
|
||||
this.ser.saveOrUpdate(voucher)
|
||||
.subscribe(
|
||||
(result) => {
|
||||
if (voucher.id === result.id) {
|
||||
this.loadVoucher(result);
|
||||
} else {
|
||||
this.ser.saveOrUpdate(voucher).subscribe(
|
||||
(result) => {
|
||||
if (voucher.id === result.id) {
|
||||
this.loadVoucher(result);
|
||||
} else {
|
||||
this.router.navigate(['/incentive', result.id]);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
}
|
||||
);
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
getVoucher(): Voucher {
|
||||
@@ -168,22 +185,21 @@ export class IncentiveComponent implements OnInit {
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.voucher.id)
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/incentive'], {replaceUrl: true});
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
}
|
||||
);
|
||||
this.ser.delete(this.voucher.id).subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/incentive'], { replaceUrl: true });
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
width: '250px',
|
||||
data: {title: 'Delete Voucher?', content: 'Are you sure? This cannot be undone.'}
|
||||
data: { title: 'Delete Voucher?', content: 'Are you sure? This cannot be undone.' },
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result: boolean) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {IncentiveModule} from './incentive.module';
|
||||
import { IncentiveModule } from './incentive.module';
|
||||
|
||||
describe('IncentiveModule', () => {
|
||||
let incentiveModule: IncentiveModule;
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
|
||||
import {
|
||||
DateAdapter,
|
||||
MAT_DATE_FORMATS,
|
||||
MAT_DATE_LOCALE,
|
||||
MatNativeDateModule,
|
||||
} from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
@@ -15,14 +20,14 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import {SharedModule} from '../shared/shared.module';
|
||||
import {ReactiveFormsModule} from '@angular/forms';
|
||||
import {CdkTableModule} from '@angular/cdk/table';
|
||||
import {IncentiveRoutingModule} from './incentive-routing.module';
|
||||
import {IncentiveComponent} from './incentive.component';
|
||||
import {MomentDateAdapter} from '@angular/material-moment-adapter';
|
||||
import {A11yModule} from '@angular/cdk/a11y';
|
||||
import {FlexLayoutModule} from '@angular/flex-layout';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { IncentiveRoutingModule } from './incentive-routing.module';
|
||||
import { IncentiveComponent } from './incentive.component';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { A11yModule } from '@angular/cdk/a11y';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
|
||||
export const MY_FORMATS = {
|
||||
parse: {
|
||||
@@ -59,15 +64,12 @@ export const MY_FORMATS = {
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SharedModule,
|
||||
IncentiveRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
IncentiveComponent
|
||||
IncentiveRoutingModule,
|
||||
],
|
||||
declarations: [IncentiveComponent],
|
||||
providers: [
|
||||
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
|
||||
{provide: MAT_DATE_FORMATS, useValue: MY_FORMATS},
|
||||
]
|
||||
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
|
||||
],
|
||||
})
|
||||
export class IncentiveModule {
|
||||
}
|
||||
export class IncentiveModule {}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {VoucherService} from './incentive.service';
|
||||
import { VoucherService } from './incentive.service';
|
||||
|
||||
describe('IncentiveService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [VoucherService]
|
||||
providers: [VoucherService],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user