This commit is contained in:
Sébastien André
2021-05-03 09:40:30 +02:00
parent 08c923cc72
commit 2e8182d153
7 changed files with 24 additions and 15 deletions

View File

@@ -20,3 +20,7 @@ table {
align-items: initial;
padding-top: 25px;
}
th.mat-header-cell {
text-align: center;
}

View File

@@ -9,7 +9,7 @@
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<th mat-header-cell *matHeaderCellDef style="min-width: 130px;">Name</th>
<td mat-cell *matCellDef="let element">{{element.name}}</td>
</ng-container>
@@ -19,8 +19,8 @@
</ng-container>
<ng-container matColumnDef="maxSize">
<th mat-header-cell *matHeaderCellDef>Canopy size</th>
<td mat-cell *matCellDef="let element">{{element.maxSize}} - {{element.minSize}}</td>
<th mat-header-cell *matHeaderCellDef style="min-width: 90px;">Canopy size</th>
<td mat-cell *matCellDef="let element">{{element.minSize}} - {{element.maxSize}}</td>
</ng-container>
<ng-container matColumnDef="aad">

View File

@@ -5,17 +5,20 @@
<div *ngIf="dataSourceTable != null else loading">
<table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="infos">
<th mat-header-cell *matHeaderCellDef style="width: 60px;"></th>
<th mat-header-cell *matHeaderCellDef style="min-width: 90px;"></th>
<td mat-cell *matCellDef="let element" style="text-align: left;">
<mat-icon aria-hidden="false" aria-label="Additional informations of the jump"
style="cursor: pointer;" (click)='openDialog(element, false)'>info</mat-icon>
<mat-icon aria-hidden="false" aria-label="Special jump" [style.visibility]="element.notes != undefined ? 'visible' : 'hidden'">sticky_note_2</mat-icon>
<mat-icon aria-hidden="false" aria-label="Special jump" [style.visibility]="element.isSpecial ? 'visible' : 'hidden'">celebration</mat-icon>
<mat-icon aria-hidden="false" aria-label="Additional informations of the jump" style="cursor: pointer;"
(click)='openDialog(element, false)' *ngIf="toShow(element)">info</mat-icon>
</td>
</ng-container>
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef style="width: 90px;">Num</th>
<td mat-cell *matCellDef="let element; let i = index">{{ resultsLength - i }}</td>
<th mat-header-cell *matHeaderCellDef style="min-width: 90px;">Num</th>
<td mat-cell *matCellDef="let element; let i = index">
{{ resultsLength - ( (dataSourceTable.paginator.pageIndex * dataSourceTable.paginator.pageSize ) + i ) }}
</td>
</ng-container>
<ng-container matColumnDef="jumpDate">
@@ -52,7 +55,7 @@
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef style="width: 70px;"></th>
<th mat-header-cell *matHeaderCellDef style="min-width: 70px;"></th>
<td mat-cell *matCellDef="let element" style="text-align: left;">
<mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;"
(click)='delete(element)'>delete</mat-icon>

View File

@@ -58,6 +58,7 @@ export class ListOfJumpsComponent implements OnInit {
this.dataSourceTable = new MatTableDataSource<JumpResp>(data);
this.dataSourceTable.paginator = this.paginator;
this.paginator.pageSize
this.resultsLength = data.length;
}, 500);
});
@@ -71,10 +72,6 @@ export class ListOfJumpsComponent implements OnInit {
});
}
toShow(item: JumpResp) {
return item.withCutaway === true || item.notes != undefined;
}
delete(item: JumpResp) {
let data : Array<JumpResp> = this.dataSourceTable.data;
data = data.filter(d => d.id !== item.id);

View File

@@ -60,6 +60,8 @@ export class SummaryComponent implements OnInit {
}
public onTabChanged(event: MatTabChangeEvent) {
console.log(event.index);
switch (event.index) {
case 0:
this.serviceApi.getStatsOfLastMonth()
@@ -82,6 +84,7 @@ export class SummaryComponent implements OnInit {
case 2:
this.serviceApi.getStatsByDz()
.subscribe(data => {
data.sort((a, b) => b.nb - a.nb );
this.dsNbJumpByDz = new MatTableDataSource(data);
});
break;

View File

@@ -9,5 +9,6 @@ export enum CacheApiKey {
StatsByJumpType,
StatsByGear,
StatsOfLastYear,
StatsOfLastMonth
StatsOfLastMonth,
StatsByYear
}

View File

@@ -23,6 +23,7 @@ export class StatsService extends BaseService {
this.serviceCacheApi.delete(CacheApiKey.StatsByAircraft);
this.serviceCacheApi.delete(CacheApiKey.StatsByJumpType);
this.serviceCacheApi.delete(CacheApiKey.StatsByGear);
this.serviceCacheApi.delete(CacheApiKey.StatsByYear);
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastYear);
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastMonth);
}
@@ -96,7 +97,7 @@ export class StatsService extends BaseService {
})
);
return this.serviceCacheApi.get<Array<StatsByYearResp>>(CacheApiKey.StatsByGear, callToApi);
return this.serviceCacheApi.get<Array<StatsByYearResp>>(CacheApiKey.StatsByYear, callToApi);
}
public getStatsOfLastYear(): Observable<StatsForLastYearResp> {