Affichage de la voile principale sur la sélection

du piège
This commit is contained in:
Sébastien André
2021-05-02 12:52:09 +02:00
parent 97e6153cef
commit 6bc87611e3
2 changed files with 8 additions and 5 deletions

View File

@@ -9,7 +9,7 @@
<mat-label>Choose the jump type</mat-label> <mat-label>Choose the jump type</mat-label>
<input type="text" matInput [matAutocomplete]="autoJumpType" [(ngModel)]="selectedJumpType" <input type="text" matInput [matAutocomplete]="autoJumpType" [(ngModel)]="selectedJumpType"
name="selectedJumpType"> name="selectedJumpType">
<mat-autocomplete #autoJumpType="matAutocomplete" [displayWith]="displayFn"> <mat-autocomplete #autoJumpType="matAutocomplete" [displayWith]="displayNameFn">
<mat-option *ngFor="let jumpType of listOfJumpType" [value]="jumpType"> <mat-option *ngFor="let jumpType of listOfJumpType" [value]="jumpType">
{{jumpType.name}} {{jumpType.name}}
</mat-option> </mat-option>
@@ -24,7 +24,7 @@
<mat-label>Choose the aircraft</mat-label> <mat-label>Choose the aircraft</mat-label>
<input type="text" matInput [matAutocomplete]="autoAircraft" [(ngModel)]="selectedAircraft" <input type="text" matInput [matAutocomplete]="autoAircraft" [(ngModel)]="selectedAircraft"
name="selectedAircraft"> name="selectedAircraft">
<mat-autocomplete #autoAircraft="matAutocomplete" [displayWith]="displayFn"> <mat-autocomplete #autoAircraft="matAutocomplete" [displayWith]="displayNameFn">
<mat-option *ngFor="let aircraft of listOfAircraft" [value]="aircraft"> <mat-option *ngFor="let aircraft of listOfAircraft" [value]="aircraft">
{{aircraft.name}} {{aircraft.name}}
</mat-option> </mat-option>
@@ -39,7 +39,7 @@
<mat-label>Choose the DZ</mat-label> <mat-label>Choose the DZ</mat-label>
<input type="text" matInput [matAutocomplete]="autoDropZone" [(ngModel)]="selectedDz" <input type="text" matInput [matAutocomplete]="autoDropZone" [(ngModel)]="selectedDz"
(ngModelChange)="onChangeDz($event)" name="selectedDz"> (ngModelChange)="onChangeDz($event)" name="selectedDz">
<mat-autocomplete #autoDropZone="matAutocomplete" [displayWith]="displayFn"> <mat-autocomplete #autoDropZone="matAutocomplete" [displayWith]="displayNameFn">
<mat-option *ngFor="let dropZone of listOfFilteredDropZone" [value]="dropZone"> <mat-option *ngFor="let dropZone of listOfFilteredDropZone" [value]="dropZone">
{{dropZone.name}} {{dropZone.name}}
<mat-icon aria-hidden="false" aria-label="Favorite" *ngIf="dropZone.isFavorite === true" color="primary"> <mat-icon aria-hidden="false" aria-label="Favorite" *ngIf="dropZone.isFavorite === true" color="primary">
@@ -54,7 +54,7 @@
<mat-form-field> <mat-form-field>
<mat-label>Choose the used gear</mat-label> <mat-label>Choose the used gear</mat-label>
<input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear"> <input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear">
<mat-autocomplete #autoGear="matAutocomplete" [displayWith]="displayFn"> <mat-autocomplete #autoGear="matAutocomplete" [displayWith]="displayGearFn">
<mat-option *ngFor="let gear of listOfGear" [value]="gear"> <mat-option *ngFor="let gear of listOfGear" [value]="gear">
{{gear.name}} ({{gear.mainCanopy}}) {{gear.name}} ({{gear.mainCanopy}})
</mat-option> </mat-option>

View File

@@ -181,9 +181,12 @@ export class NewJumpComponent implements OnInit {
this.isSpecial = false; this.isSpecial = false;
} }
public displayFn(data?: JumpTypeResp): string | undefined { public displayNameFn(data?: any): string | undefined {
return data ? data.name : undefined; return data ? data.name : undefined;
} }
public displayGearFn(data?: GearResp): string | undefined {
return data ? `${data.name} (${data.mainCanopy})` : undefined;
}
public onChangeDz(event: any) { public onChangeDz(event: any) {
let filterValue: string; let filterValue: string;