Ajout des infos dans les listes déroulantes
du formulaire d'ajout
This commit is contained in:
@@ -2,25 +2,27 @@
|
|||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Choose the jump type</mat-label>
|
<mat-label>Choose the jump type</mat-label>
|
||||||
<mat-select [(ngModel)]="selectedJumpType" name="selectedJumpType">
|
<mat-select [(ngModel)]="selectedJumpType" name="selectedJumpType">
|
||||||
<mat-option value="1">Option 1</mat-option>
|
<mat-option *ngFor="let jumpType of listOfJumpType" [value]="jumpType.id">
|
||||||
<mat-option value="2" disabled>Option 2 (disabled)</mat-option>
|
{{jumpType.name}}
|
||||||
<mat-option value="3">Option 3</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Choose the aircraft</mat-label>
|
<mat-label>Choose the aircraft</mat-label>
|
||||||
<mat-select [(ngModel)]="selectedAircraft" name="selectedAircraft">
|
<mat-select [(ngModel)]="selectedAircraft" name="selectedAircraft">
|
||||||
<mat-option value="4">Option 1</mat-option>
|
<mat-option *ngFor="let aircraft of listOfAircraft" [value]="aircraft.id">
|
||||||
<mat-option value="5">Option 2</mat-option>
|
{{aircraft.name}}
|
||||||
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Choose the DZ</mat-label>
|
<mat-label>Choose the DZ</mat-label>
|
||||||
<mat-select [(ngModel)]="selectedDz" name="selectedDz">
|
<mat-select [(ngModel)]="selectedDz" name="selectedDz">
|
||||||
<mat-option value="6">Option 1</mat-option>
|
<mat-option *ngFor="let dropZone of listOfDropZone" [value]="dropZone.id">
|
||||||
<mat-option value="7">Option 2</mat-option>
|
{{dropZone.name}}
|
||||||
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
@@ -34,12 +36,6 @@
|
|||||||
|
|
||||||
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">With a cutaway ?</mat-checkbox>
|
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">With a cutaway ?</mat-checkbox>
|
||||||
|
|
||||||
<!-- <mat-form-field>
|
|
||||||
<input matInput [matDatepicker]="beginDateDp" [(ngModel)]="beginDate2" name="beginDate2" disabled>
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="beginDateDp"></mat-datepicker-toggle>
|
|
||||||
<mat-datepicker #beginDateDp disabled="false"></mat-datepicker>
|
|
||||||
</mat-form-field> -->
|
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput [matDatepicker]="beginDateDp" [(ngModel)]="beginDate" name="beginDate" disabled>
|
<input matInput [matDatepicker]="beginDateDp" [(ngModel)]="beginDate" name="beginDate" disabled>
|
||||||
<mat-datepicker-toggle matSuffix [for]="beginDateDp"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="beginDateDp"></mat-datepicker-toggle>
|
||||||
@@ -67,7 +63,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="Count of jumps" [(ngModel)]="countOfJumps" name="countOfJumps">
|
<input matInput placeholder="Count of jumps" [(ngModel)]="countOfJumps" name="countOfJumps">
|
||||||
<button mat-button *ngIf="countOfJumps" matSuffix mat-icon-button aria-label="Clear" (click)="countOfJumps=''">
|
<button mat-button *ngIf="countOfJumps" matSuffix mat-icon-button aria-label="Clear" (click)="countOfJumps=''">
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { ServiceComm } from '../../services/serviceComm';
|
import { ServiceComm } from '../../services/serviceComm';
|
||||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||||
import { ServiceApiPost } from '../../services/serviceApiPost';
|
import { ServiceApiPost } from '../../services/serviceApiPost';
|
||||||
|
import { JumpTypeResp } from '../../models/jumpType';
|
||||||
|
import { AircraftResp } from '../../models/aircraft';
|
||||||
|
import { DropZoneResp } from '../../models/dropzone';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -20,6 +23,9 @@ export class NewJumpComponent implements OnInit {
|
|||||||
selectedAircraft: number;
|
selectedAircraft: number;
|
||||||
selectedJumpType: number;
|
selectedJumpType: number;
|
||||||
withCutaway: boolean;
|
withCutaway: boolean;
|
||||||
|
listOfJumpType: Array<JumpTypeResp>;
|
||||||
|
listOfAircraft: Array<AircraftResp>;
|
||||||
|
listOfDropZone: Array<DropZoneResp>;
|
||||||
|
|
||||||
constructor(private serviceComm: ServiceComm,
|
constructor(private serviceComm: ServiceComm,
|
||||||
private serviceApiGet: ServiceApiGet,
|
private serviceApiGet: ServiceApiGet,
|
||||||
@@ -30,11 +36,18 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.serviceComm.updatedComponentTitle('Add a new jump');
|
this.serviceComm.updatedComponentTitle('Add a new jump');
|
||||||
|
|
||||||
this.beginDate = new Date();
|
this.beginDate = new Date();
|
||||||
|
|
||||||
|
const t = this.beginDate.getTime();
|
||||||
this.endDate = new Date();
|
this.endDate = new Date();
|
||||||
|
this.endDate.setTime(t - (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
this.defaultExitAltitude = 4000;
|
this.defaultExitAltitude = 4000;
|
||||||
this.defaultDeployAltitude = 1000;
|
this.defaultDeployAltitude = 1000;
|
||||||
this.countOfJumps = 0;
|
this.countOfJumps = 0;
|
||||||
|
|
||||||
|
this.getListOfJumpTypes();
|
||||||
|
this.getListOfAircrafts();
|
||||||
|
this.getListOfDropZones();
|
||||||
}
|
}
|
||||||
|
|
||||||
onFormSubmit() {
|
onFormSubmit() {
|
||||||
@@ -51,4 +64,32 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.countOfJumps
|
this.countOfJumps
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getListOfJumpTypes() {
|
||||||
|
this.serviceApiGet.getListOfJumpTypes()
|
||||||
|
.subscribe(data => {
|
||||||
|
this.listOfJumpType = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private getListOfAircrafts() {
|
||||||
|
this.serviceApiGet.getListOfAircrafts()
|
||||||
|
.subscribe(data => {
|
||||||
|
this.listOfAircraft = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private getListOfDropZones() {
|
||||||
|
this.serviceApiGet.getListOfDropZones()
|
||||||
|
.subscribe(data => {
|
||||||
|
this.listOfDropZone = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// private getListOfGears() {
|
||||||
|
// this.serviceApiGet.getListOfGears()
|
||||||
|
// .subscribe(data => {
|
||||||
|
// this.listOfGear = data;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user