Évol autour des infos/formulaires du harnais

This commit is contained in:
Sébastien André
2019-12-04 12:05:02 +01:00
parent 789c190c95
commit ac3dec8193
5 changed files with 70 additions and 25 deletions

View File

@@ -13,26 +13,29 @@
<td mat-cell *matCellDef="let element">{{element.name}} <a href='http://{{element.website}}'>ici</a></td> <td mat-cell *matCellDef="let element">{{element.name}} <a href='http://{{element.website}}'>ici</a></td>
</ng-container> </ng-container>
<ng-container matColumnDef="latitude"> <ng-container matColumnDef="manufacturer">
<th mat-header-cell *matHeaderCellDef>Latitude</th> <th mat-header-cell *matHeaderCellDef>Manufacturer</th>
<td mat-cell *matCellDef="let element">{{element.latitude}}</td> <td mat-cell *matCellDef="let element">{{element.manufacturer}}</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>
<ng-container matColumnDef="address"> <ng-container matColumnDef="maxSize">
<th mat-header-cell *matHeaderCellDef>Address</th> <th mat-header-cell *matHeaderCellDef>Canopy size</th>
<td mat-cell *matCellDef="let element"><span [innerHTML]="element.address"></span></td> <td mat-cell *matCellDef="let element">{{element.maxSize}} - {{element.minSize}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="email">
<th mat-header-cell *matHeaderCellDef>E-mail</th> <ng-container matColumnDef="aad">
<td mat-cell *matCellDef="let element">{{element.email}}</td> <th mat-header-cell *matHeaderCellDef>AAD system</th>
<td mat-cell *matCellDef="let element">{{element.aad}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef>Type</th> <ng-container matColumnDef="mainCanopy">
<td mat-cell *matCellDef="let element">{{element.type}}</td> <th mat-header-cell *matHeaderCellDef>Main canopy</th>
<td mat-cell *matCellDef="let element">{{element.mainCanopy}}</td>
</ng-container>
<ng-container matColumnDef="reserveCanopy">
<th mat-header-cell *matHeaderCellDef>Reserve canopy</th>
<td mat-cell *matCellDef="let element">{{element.reserveCanopy}}</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>

View File

@@ -14,11 +14,11 @@ export class ListOfGearsComponent implements OnInit {
public displayedColumns: Array<string> = [ public displayedColumns: Array<string> = [
'id', 'id',
'name', 'name',
'latitude', 'manufacturer',
'longitude', 'maxSize',
'address', 'aad',
'email', 'mainCanopy',
'type' 'reserveCanopy'
]; ];
public dataSourceTable: MatTableDataSource<GearResp>; public dataSourceTable: MatTableDataSource<GearResp>;
public resultsLength = 0; public resultsLength = 0;
@@ -37,7 +37,6 @@ export class ListOfGearsComponent implements OnInit {
getListOfGears() { getListOfGears() {
this.serviceApi.getListOfGears().subscribe(data => { this.serviceApi.getListOfGears().subscribe(data => {
// data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
this.dataSourceTable = new MatTableDataSource<GearResp>(data); this.dataSourceTable = new MatTableDataSource<GearResp>(data);
this.dataSourceTable.paginator = this.paginator; this.dataSourceTable.paginator = this.paginator;
this.resultsLength = data.length; this.resultsLength = data.length;

View File

@@ -1,7 +1,32 @@
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)"> <form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
<div> <div>
<label for="aircraftName">Aircraft name</label> <label for="name">Name of gear</label>
<input id="aircraftName" type="text" formControlName="aircraftName"> <input id="name" type="text" formControlName="name">
</div> </div>
<div>
<label for="manufacturer">Manufacturer</label>
<input id="manufacturer" type="text" formControlName="manufacturer">
</div>
<div>
<label for="minSize">Min size of canopy</label>
<input id="minSize" type="text" formControlName="minSize">
</div>
<div>
<label for="maxSize">Max size of canopy</label>
<input id="maxSize" type="text" formControlName="maxSize">
</div>
<div>
<label for="aad">AAD system</label>
<input id="aad" type="text" formControlName="aad">
</div>
<div>
<label for="mainCanopy">Main Canopy</label>
<input id="mainCanopy" type="text" formControlName="mainCanopy">
</div>
<div>
<label for="reserveCanopy">Reserve canopy</label>
<input id="reserveCanopy" type="text" formControlName="reserveCanopy">
</div>
<button class="button" type="submit">Add</button> <button class="button" type="submit">Add</button>
</form> </form>

View File

@@ -11,7 +11,13 @@ export class NewGearComponent implements OnInit {
constructor() { constructor() {
this.addForm = new FormGroup({ this.addForm = new FormGroup({
aircraftName: new FormControl('', Validators.required) name: new FormControl('', Validators.required),
manufacturer: new FormControl('', Validators.required),
minSize: new FormControl('', Validators.required),
maxSize: new FormControl('', Validators.required),
aad: new FormControl('', Validators.required),
mainCanopy: new FormControl('', Validators.required),
reserveCanopy: new FormControl('', Validators.required),
}); });
} }

View File

@@ -5,6 +5,12 @@ export class GearReq {
public id: number; public id: number;
public name: string; public name: string;
public manufacturer: string;
public minSize: number;
public maxSize: number;
public aad: string;
public mainCanopy: string;
public reserveCanopy: string;
} }
export class GearResp { export class GearResp {
@@ -14,4 +20,10 @@ export class GearResp {
public id: number; public id: number;
public name: string; public name: string;
public manufacturer: string;
public minSize: number;
public maxSize: number;
public aad: string;
public mainCanopy: string;
public reserveCanopy: string;
} }