Evol de la page Summary avec

les stats pour la saison en cours
This commit is contained in:
Sébastien André
2020-02-15 22:40:26 +01:00
parent 6e804b1ae4
commit 0eeb0d3e12
6 changed files with 154 additions and 71 deletions

View File

@@ -43,10 +43,10 @@ export class NewJumpComponent implements OnInit {
private serviceDropzone: DropzoneService,
private serviceGear: GearService,
private dateService: DateService
) { }
) {}
ngOnInit() {
this.serviceComm.UpdatedComponentTitle('Add a new jump');
this.serviceComm.UpdatedComponentTitle("Add a new jump");
this.endDate = new Date();
this.beginDate = this.dateService.AddDays(new Date(), -1);
@@ -126,8 +126,8 @@ export class NewJumpComponent implements OnInit {
return data ? data.name : undefined;
}
public onChangeDz(event: DropZoneResp) {
const filterValue = event.name.toLowerCase();
public onChangeDz(event: string) {
const filterValue = event.toLowerCase();
this.listOfFilteredDropZone = this.listOfDropZone;
this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter(option =>

View File

@@ -15,10 +15,50 @@
<div class="paragraph">
<label>Jumps in the last month</label>
<table mat-table [dataSource]="dsJumpForLastMonthByDz">
<ng-container matColumnDef="label">
<td mat-cell *matCellDef="let element">{{element.label}}</td>
</ng-container>
<ng-container matColumnDef="nb">
<td mat-cell *matCellDef="let element">{{element.nb}}</td>
</ng-container>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<table mat-table [dataSource]="dsJumpForLastMonthByJumpType">
<ng-container matColumnDef="label">
<td mat-cell *matCellDef="let element">{{element.label}}</td>
</ng-container>
<ng-container matColumnDef="nb">
<td mat-cell *matCellDef="let element">{{element.nb}}</td>
</ng-container>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<div class="paragraph">
<label>Jumps in the last year</label>
<table mat-table [dataSource]="dsJumpForLastYearByDz">
<ng-container matColumnDef="label">
<td mat-cell *matCellDef="let element">{{element.label}}</td>
</ng-container>
<ng-container matColumnDef="nb">
<td mat-cell *matCellDef="let element">{{element.nb}}</td>
</ng-container>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<table mat-table [dataSource]="dsJumpForLastYearByJumpType">
<ng-container matColumnDef="label">
<td mat-cell *matCellDef="let element">{{element.label}}</td>
</ng-container>
<ng-container matColumnDef="nb">
<td mat-cell *matCellDef="let element">{{element.nb}}</td>
</ng-container>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<div class="paragraph">

View File

@@ -1,30 +1,42 @@
import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material/table';
import { ServiceComm } from '../../services/service-comm.service';
import { StatsService } from '../../services/stats.service';
import { Component, OnInit } from "@angular/core";
import { MatTableDataSource } from "@angular/material/table";
import { ServiceComm } from "../../services/service-comm.service";
import { StatsService } from "../../services/stats.service";
import {
StatsByDzResp,
StatsByAircraftResp,
StatsByGearResp,
StatsByJumpTypeResp,
StatsByYearResp
} from "../../models/stats";
@Component({
selector: 'app-summary',
templateUrl: './summary.component.html',
styleUrls: ['./summary.component.css']
selector: "app-summary",
templateUrl: "./summary.component.html",
styleUrls: ["./summary.component.css"]
})
export class SummaryComponent implements OnInit {
public displayedColumns: Array<string> = ['label', 'nb'];
public dsNbJumpByDz;
public dsNbJumpByAircraft;
public dsNbJumpByGear;
public dsNbJumpByType;
public dsNbJumpByYear;
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
public dsNbJumpByAircraft: MatTableDataSource<StatsByAircraftResp>;
public dsNbJumpByGear: MatTableDataSource<StatsByGearResp>;
public dsNbJumpByType: MatTableDataSource<StatsByJumpTypeResp>;
public dsNbJumpByYear: MatTableDataSource<StatsByYearResp>;
public dsJumpForLastYearByDz: MatTableDataSource<StatsByDzResp>;
public dsJumpForLastYearByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
public dsJumpForLastMonthByDz: MatTableDataSource<StatsByDzResp>;
public dsJumpForLastMonthByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
private countDatasLoaded: number;
public displayedColumns: Array<string> = ["label", "nb"];
constructor(
private serviceApi: StatsService,
private serviceComm: ServiceComm
) { }
) {}
ngOnInit() {
this.countDatasLoaded = 0;
this.serviceComm.UpdatedComponentTitle('Summary');
this.serviceComm.UpdatedComponentTitle("Summary");
const statsResult = this.serviceApi.getStatsOfJumps();
@@ -50,11 +62,17 @@ export class SummaryComponent implements OnInit {
});
statsResult.statsForLastYear.subscribe(data => {
this.dsNbJumpByYear = new MatTableDataSource(data);
this.dsJumpForLastYearByDz = new MatTableDataSource(data.byDz);
this.dsJumpForLastYearByJumpType = new MatTableDataSource(
data.byJumpType
);
this.countDatasLoaded++;
});
statsResult.statsForLastMonth.subscribe(data => {
this.dsNbJumpByYear = new MatTableDataSource(data);
this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz);
this.dsJumpForLastMonthByJumpType = new MatTableDataSource(
data.byJumpType
);
this.countDatasLoaded++;
});
}