Début d'evol pour la page "Summary"
This commit is contained in:
@@ -2,9 +2,9 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { DropZoneResp } from 'src/models/dropzone';
|
||||
import { ServiceApi } from 'src/services/serviceApi';
|
||||
import { ServiceComm } from 'src/services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-dzs',
|
||||
|
||||
@@ -2,9 +2,9 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { JumpTypeResp } from 'src/models/jumpType';
|
||||
import { ServiceApi } from 'src/services/serviceApi';
|
||||
import { ServiceComm } from 'src/services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-jump-types',
|
||||
|
||||
@@ -3,9 +3,9 @@ import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { JumpResp } from '../../models/jump';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { JumpResp } from 'src/models/jump';
|
||||
import { ServiceApi } from 'src/services/serviceApi';
|
||||
import { ServiceComm } from 'src/services/serviceComm';
|
||||
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { ServiceComm } from 'src/services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-jump',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Total Total
|
||||
</p>
|
||||
<p>
|
||||
<label>Per DZ</label>
|
||||
<label>By DZ</label>
|
||||
<table mat-table [dataSource]="dsNbJumpByDz">
|
||||
<ng-container matColumnDef="label">
|
||||
<!-- <th mat-header-cell *matHeaderCellDef>DZ</th> -->
|
||||
@@ -19,7 +19,7 @@
|
||||
</table>
|
||||
</p>
|
||||
<p>
|
||||
<label>Per aircraft</label>
|
||||
<label>By aircraft</label>
|
||||
<table mat-table [dataSource]="dsNbJumpByAircraft">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{element.label}}</td>
|
||||
@@ -32,7 +32,7 @@
|
||||
</table>
|
||||
</p>
|
||||
<p>
|
||||
<label>Per RIG</label>
|
||||
<label>By RIG</label>
|
||||
<table mat-table [dataSource]="dsNbJumpByRig">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{element.label}}</td>
|
||||
@@ -45,7 +45,7 @@
|
||||
</table>
|
||||
</p>
|
||||
<p>
|
||||
<label>Per jump type</label>
|
||||
<label>By jump type</label>
|
||||
<table mat-table [dataSource]="dsNbJumpByType">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{element.label}}</td>
|
||||
@@ -58,7 +58,7 @@
|
||||
</table>
|
||||
</p>
|
||||
<p>
|
||||
Per year
|
||||
By year
|
||||
<table mat-table [dataSource]="dsNbJumpByYear">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{element.label}}</td>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { ServiceComm } from 'src/services/serviceComm';
|
||||
import { ServiceApi } from 'src/services/serviceApi';
|
||||
|
||||
@Component({
|
||||
selector: 'app-summary',
|
||||
@@ -14,7 +15,8 @@ export class SummaryComponent implements OnInit {
|
||||
public dsNbJumpByType;
|
||||
public dsNbJumpByYear;
|
||||
|
||||
constructor(private serviceComm: ServiceComm) { }
|
||||
constructor(private serviceApi: ServiceApi,
|
||||
private serviceComm: ServiceComm) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('Summary');
|
||||
|
||||
51
Front/skydivelogs-app/src/models/statsresp.ts
Normal file
51
Front/skydivelogs-app/src/models/statsresp.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export class StatsResp {
|
||||
public statsByDz: Observable<StatsByDzResp>;
|
||||
public statsByAircraft: Observable<StatsByAircraftResp>;
|
||||
public statsByRig: Observable<StatsByRigResp>;
|
||||
public statsByJumpType: Observable<StatsByJumpTypeResp>;
|
||||
public statsByYear: Observable<StatsByYearResp>;
|
||||
}
|
||||
|
||||
|
||||
export class StatsByDzResp {
|
||||
constructor(data: any) {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
public label: string;
|
||||
public nb: number;
|
||||
}
|
||||
export class StatsByAircraftResp {
|
||||
constructor(data: any) {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
public label: string;
|
||||
public nb: number;
|
||||
}
|
||||
export class StatsByRigResp {
|
||||
constructor(data: any) {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
public label: string;
|
||||
public nb: number;
|
||||
}
|
||||
export class StatsByJumpTypeResp {
|
||||
constructor(data: any) {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
public label: string;
|
||||
public nb: number;
|
||||
}
|
||||
export class StatsByYearResp {
|
||||
constructor(data: any) {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
public label: string;
|
||||
public nb: number;
|
||||
}
|
||||
@@ -3,10 +3,11 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { DropZoneResp } from '../models/dropzone';
|
||||
import { JumpResp } from '../models/jump';
|
||||
import { AircraftResp } from '../models/aircraft';
|
||||
import { JumpTypeResp } from '../models/jumpType';
|
||||
import { DropZoneResp } from 'src/models/dropzone';
|
||||
import { JumpResp } from 'src/models/jump';
|
||||
import { AircraftResp } from 'src/models/aircraft';
|
||||
import { JumpTypeResp } from 'src/models/jumpType';
|
||||
import { StatsResp, StatsByDzResp, StatsByAircraftResp, StatsByJumpTypeResp, StatsByRigResp, StatsByYearResp } from 'src/models/statsresp';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@@ -37,4 +38,15 @@ export class ServiceApi {
|
||||
public getListOfJumpTypes(): Observable<Array<JumpTypeResp>> {
|
||||
return this.http.get<Array<JumpTypeResp>>('http://localhost:5000/api/JumpType', { headers: this.headers });
|
||||
}
|
||||
|
||||
public getStatsOfJumps(): StatsResp {
|
||||
const resultat = new StatsResp();
|
||||
resultat.statsByDz = this.http.get<StatsByDzResp>('http://localhost:5000/api/Stats/ByDz', { headers: this.headers });
|
||||
resultat.statsByAircraft = this.http.get<StatsByAircraftResp>('http://localhost:5000/api/Stats/ByAircraft', { headers: this.headers });
|
||||
resultat.statsByJumpType = this.http.get<StatsByJumpTypeResp>('http://localhost:5000/api/Stats/ByJumpType', { headers: this.headers });
|
||||
resultat.statsByRig = this.http.get<StatsByRigResp>('http://localhost:5000/api/Stats/ByRig', { headers: this.headers });
|
||||
resultat.statsByYear = this.http.get<StatsByYearResp>('http://localhost:5000/api/Stats/ByYear', { headers: this.headers });
|
||||
|
||||
return resultat;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user