Ajout de la page listant les pièges

This commit is contained in:
Sébastien André
2019-11-23 16:48:52 +01:00
parent b9a29bcd79
commit 3f7966091c
17 changed files with 310 additions and 174 deletions

View File

@@ -8,7 +8,7 @@ namespace skydiveLogs_api.Model
{
public int Id { get; set; }
public string Mame { get; set; }
public string Name { get; set; }
public string Manufacturer { get; set; }

View File

@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.DataContract;

Binary file not shown.

View File

@@ -15,13 +15,16 @@
<ul>
<li><a routerLink="/summary" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>Summary</a>
</li>
<li><a routerLink="/jumpsList" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
<li><a routerLink="/jumps" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
jumps</a></li>
<li><a routerLink="/dz" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of DZs</a></li>
<li><a routerLink="/aircraftList" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
<li><a routerLink="/dzs" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of DZs</a>
</li>
<li><a routerLink="/aircrafts" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
aircrafts</a></li>
<li><a routerLink="/jumpTypeList" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
<li><a routerLink="/jumpTypes" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
jump types</a></li>
<li><a routerLink="/gears" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>List of
gears</a></li>
<li><a routerLink="/newjump" routerLinkActive="active" (click)="toggleMenu()" skipLocationChange>Add a new
jump</a></li>
</ul>

View File

@@ -1,23 +1,24 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
import { AppComponent } from './app.component';
import { AppComponent } from "./app.component";
import { SummaryComponent } from './summary/summary.component';
import { ListOfJumpsComponent } from './list-of-jumps/list-of-jumps.component';
import { ListOfDzsComponent } from './list-of-dzs/list-of-dzs.component';
import { NewJumpComponent } from './new-jump/new-jump.component';
import { ListOfAircraftsComponent } from './list-of-aircrafts/list-of-aircrafts.component';
import { ListOfJumpTypesComponent } from './list-of-jump-types/list-of-jump-types.component';
import { SummaryComponent } from "./summary/summary.component";
import { ListOfJumpsComponent } from "./list-of-jumps/list-of-jumps.component";
import { ListOfDzsComponent } from "./list-of-dzs/list-of-dzs.component";
import { NewJumpComponent } from "./new-jump/new-jump.component";
import { ListOfAircraftsComponent } from "./list-of-aircrafts/list-of-aircrafts.component";
import { ListOfJumpTypesComponent } from "./list-of-jump-types/list-of-jump-types.component";
import { ListOfGearsComponent } from "./list-of-gears/list-of-gears.component";
import { DateService } from '../services/date.service';
import { ServiceApiGet } from '../services/service-api-get.service';
import { ServiceApiPost } from '../services/service-api-post.service';
import { ServiceComm } from '../services/service-comm.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { DateService } from "../services/date.service";
import { ServiceApiGet } from "../services/service-api-get.service";
import { ServiceApiPost } from "../services/service-api-post.service";
import { ServiceComm } from "../services/service-comm.service";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { FormsModule } from "@angular/forms";
import {
MatPaginatorModule,
MatTableModule,
@@ -30,17 +31,18 @@ import {
MatInputModule,
MatButtonModule,
MatIconModule
} from '@angular/material';
import { RequestCache } from '../services/request-cache.service';
import { CachingInterceptor } from '../services/caching-interceptor.service';
} from "@angular/material";
import { RequestCache } from "../services/request-cache.service";
import { CachingInterceptor } from "../services/caching-interceptor.service";
const appRoutes: Routes = [
{ path: 'summary', component: SummaryComponent },
{ path: 'jumpsList', component: ListOfJumpsComponent },
{ path: 'dz', component: ListOfDzsComponent },
{ path: 'newjump', component: NewJumpComponent },
{ path: 'aircraftList', component: ListOfAircraftsComponent },
{ path: 'jumpTypeList', component: ListOfJumpTypesComponent }
{ path: "summary", component: SummaryComponent },
{ path: "jumps", component: ListOfJumpsComponent },
{ path: "dzs", component: ListOfDzsComponent },
{ path: "newjump", component: NewJumpComponent },
{ path: "aircrafts", component: ListOfAircraftsComponent },
{ path: "jumpTypes", component: ListOfJumpTypesComponent },
{ path: "gears", component: ListOfGearsComponent }
];
@NgModule({
@@ -51,7 +53,8 @@ const appRoutes: Routes = [
ListOfDzsComponent,
NewJumpComponent,
ListOfAircraftsComponent,
ListOfJumpTypesComponent
ListOfJumpTypesComponent,
ListOfGearsComponent
],
imports: [
RouterModule.forRoot(
@@ -84,4 +87,4 @@ const appRoutes: Routes = [
],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {}

View File

@@ -0,0 +1,3 @@
table {
width: 100%;
}

View File

@@ -0,0 +1,37 @@
<table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>ID</th>
<td mat-cell *matCellDef="let element">{{element.id}}</td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let element">{{element.name}} <a href='http://{{element.website}}'>ici</a></td>
</ng-container>
<ng-container matColumnDef="latitude">
<th mat-header-cell *matHeaderCellDef>Latitude</th>
<td mat-cell *matCellDef="let element">{{element.latitude}}</td>
</ng-container>
<ng-container matColumnDef="longitude">
<th mat-header-cell *matHeaderCellDef>Longitude</th>
<td mat-cell *matCellDef="let element">{{element.longitude}}</td>
</ng-container>
<ng-container matColumnDef="address">
<th mat-header-cell *matHeaderCellDef>Address</th>
<td mat-cell *matCellDef="let element"><span [innerHTML]="element.address"></span></td>
</ng-container>
<ng-container matColumnDef="email">
<th mat-header-cell *matHeaderCellDef>E-mail</th>
<td mat-cell *matCellDef="let element">{{element.email}}</td>
</ng-container>
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef>Type</th>
<td mat-cell *matCellDef="let element">{{element.type}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ListOfGearsComponent } from './list-of-gears.component';
describe('ListOfGearsComponent', () => {
let component: ListOfGearsComponent;
let fixture: ComponentFixture<ListOfGearsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListOfGearsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListOfGearsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,44 @@
import { Component, OnInit, ViewChild } from "@angular/core";
import { MatPaginator, MatTableDataSource } from "@angular/material";
import { ServiceApiGet } from "../../services/service-api-get.service";
import { ServiceComm } from "../../services/service-comm.service";
import { GearResp } from "../../models/gear";
@Component({
selector: "app-list-of-gears",
templateUrl: "./list-of-gears.component.html",
styleUrls: ["./list-of-gears.component.css"]
})
export class ListOfGearsComponent implements OnInit {
public displayedColumns: Array<string> = [
"id",
"name",
"latitude",
"longitude",
"address",
"email",
"type"
];
public dataSourceTable;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(
private serviceApi: ServiceApiGet,
private serviceComm: ServiceComm
) {}
ngOnInit() {
this.serviceComm.updatedComponentTitle("List of gears");
this.getListOfGears();
}
getListOfGears() {
this.serviceApi.getListOfGears().subscribe(data => {
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
this.dataSourceTable.paginator = this.paginator;
this.resultsLength = data.length;
});
}
}

View File

@@ -1,17 +1,17 @@
export class AircraftReq {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public name: number;
public id: number;
public name: number;
}
export class AircraftResp {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public name: number;
}
public id: number;
public name: number;
}

View File

@@ -1,29 +1,29 @@
export class DropZoneResp {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public latitude: string;
public longitude: string;
public name: string;
public address: string;
public website: string;
public email: string;
public type: Array<string>;
public id: number;
public latitude: string;
public longitude: string;
public name: string;
public address: string;
public website: string;
public email: string;
public type: Array<string>;
}
export class DropZoneReq {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public latitude: string;
public longitude: string;
public name: string;
public address: string;
public website: string;
public email: string;
public type: Array<string>;
public id: number;
public latitude: string;
public longitude: string;
public name: string;
public address: string;
public website: string;
public email: string;
public type: Array<string>;
}

View File

@@ -0,0 +1,17 @@
export class GearReq {
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public name: number;
}
export class GearResp {
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public name: number;
}

View File

@@ -1,33 +1,33 @@
export class JumpReq {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public jumpTypeId: number;
public aircraftId: number;
public dropZoneId: number;
public gearId: number;
public exitAltitude: number;
public deployAltitude: number;
public withCutaway: boolean;
public notes: string;
public jumpDate: Date;
public id: number;
public jumpTypeId: number;
public aircraftId: number;
public dropZoneId: number;
public gearId: number;
public exitAltitude: number;
public deployAltitude: number;
public withCutaway: boolean;
public notes: string;
public jumpDate: Date;
}
export class JumpResp {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public jumpTypeId: number;
public aircraftId: number;
public dropZoneId: number;
public gearId: number;
public exitAltitude: number;
public deployAltitude: number;
public withCutaway: boolean;
public notes: string;
public jumpDate: Date;
public id: number;
public jumpTypeId: number;
public aircraftId: number;
public dropZoneId: number;
public gearId: number;
public exitAltitude: number;
public deployAltitude: number;
public withCutaway: boolean;
public notes: string;
public jumpDate: Date;
}

View File

@@ -1,17 +1,17 @@
export class JumpTypeReq {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public name: number;
public id: number;
public name: number;
}
export class JumpTypeResp {
constructor(data: any) {
Object.assign(this, data);
}
constructor(data: any) {
Object.assign(this, data);
}
public id: number;
public name: number;
}
public id: number;
public name: number;
}

View File

@@ -0,0 +1,50 @@
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;
}

View File

@@ -1,51 +0,0 @@
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;
}

View File

@@ -1,12 +1,15 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Injectable } from "@angular/core";
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
import { environment } from "../environments/environment";
import { DropZoneResp } from "../models/dropzone";
import { JumpResp } from "../models/jump";
import { AircraftResp } from "../models/aircraft";
import { JumpTypeResp } from "../models/jumpType";
import { GearResp } from "../models/gear";
import { DropZoneResp } from '../models/dropzone';
import { JumpResp } from '../models/jump';
import { AircraftResp } from '../models/aircraft';
import { JumpTypeResp } from '../models/jumpType';
import {
StatsResp,
StatsByDzResp,
@@ -14,20 +17,20 @@ import {
StatsByJumpTypeResp,
StatsByRigResp,
StatsByYearResp
} from '../models/statsresp';
import { environment } from '../environments/environment';
} from "../models/stats";
@Injectable()
export class ServiceApiGet {
private readonly headers = new HttpHeaders({
'Access-Control-Allow-Origin': environment.urlApi
"Access-Control-Allow-Origin": environment.urlApi
});
constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {}
public getListOfDropZones(): Observable<Array<DropZoneResp>> {
return this.http.get<Array<DropZoneResp>>(`${environment.urlApi}/api/DropZone`, {
headers: this.headers
})
return this.http
.get<Array<DropZoneResp>>(`${environment.urlApi}/api/DropZone`, {
headers: this.headers
})
.pipe(
map(response => {
const details = response.map(data => new DropZoneResp(data));
@@ -56,6 +59,12 @@ export class ServiceApiGet {
);
}
public getListOfGears(): Observable<Array<GearResp>> {
return this.http.get<Array<GearResp>>(`${environment.urlApi}/api/Gear`, {
headers: this.headers
});
}
public getStatsOfJumps(): StatsResp {
const resultat = new StatsResp();
resultat.statsByDz = this.http.get<StatsByDzResp>(