É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>
</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 matColumnDef="manufacturer">
<th mat-header-cell *matHeaderCellDef>Manufacturer</th>
<td mat-cell *matCellDef="let element">{{element.manufacturer}}</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 matColumnDef="maxSize">
<th mat-header-cell *matHeaderCellDef>Canopy size</th>
<td mat-cell *matCellDef="let element">{{element.maxSize}} - {{element.minSize}}</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 matColumnDef="aad">
<th mat-header-cell *matHeaderCellDef>AAD system</th>
<td mat-cell *matCellDef="let element">{{element.aad}}</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 matColumnDef="mainCanopy">
<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>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>

View File

@@ -14,11 +14,11 @@ export class ListOfGearsComponent implements OnInit {
public displayedColumns: Array<string> = [
'id',
'name',
'latitude',
'longitude',
'address',
'email',
'type'
'manufacturer',
'maxSize',
'aad',
'mainCanopy',
'reserveCanopy'
];
public dataSourceTable: MatTableDataSource<GearResp>;
public resultsLength = 0;
@@ -37,7 +37,6 @@ export class ListOfGearsComponent implements OnInit {
getListOfGears() {
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.paginator = this.paginator;
this.resultsLength = data.length;

View File

@@ -1,7 +1,32 @@
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
<div>
<label for="aircraftName">Aircraft name</label>
<input id="aircraftName" type="text" formControlName="aircraftName">
<label for="name">Name of gear</label>
<input id="name" type="text" formControlName="name">
</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>
</form>

View File

@@ -11,7 +11,13 @@ export class NewGearComponent implements OnInit {
constructor() {
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 name: string;
public manufacturer: string;
public minSize: number;
public maxSize: number;
public aad: string;
public mainCanopy: string;
public reserveCanopy: string;
}
export class GearResp {
@@ -14,4 +20,10 @@ export class GearResp {
public id: number;
public name: string;
public manufacturer: string;
public minSize: number;
public maxSize: number;
public aad: string;
public mainCanopy: string;
public reserveCanopy: string;
}