Ajout des infos dans les listes déroulantes
du formulaire d'ajout
This commit is contained in:
@@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { ServiceApiPost } from '../../services/serviceApiPost';
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -20,6 +23,9 @@ export class NewJumpComponent implements OnInit {
|
||||
selectedAircraft: number;
|
||||
selectedJumpType: number;
|
||||
withCutaway: boolean;
|
||||
listOfJumpType: Array<JumpTypeResp>;
|
||||
listOfAircraft: Array<AircraftResp>;
|
||||
listOfDropZone: Array<DropZoneResp>;
|
||||
|
||||
constructor(private serviceComm: ServiceComm,
|
||||
private serviceApiGet: ServiceApiGet,
|
||||
@@ -30,11 +36,18 @@ export class NewJumpComponent implements OnInit {
|
||||
this.serviceComm.updatedComponentTitle('Add a new jump');
|
||||
|
||||
this.beginDate = new Date();
|
||||
|
||||
const t = this.beginDate.getTime();
|
||||
this.endDate = new Date();
|
||||
this.endDate.setTime(t - (1000 * 60 * 60 * 24));
|
||||
|
||||
this.defaultExitAltitude = 4000;
|
||||
this.defaultDeployAltitude = 1000;
|
||||
this.countOfJumps = 0;
|
||||
|
||||
this.getListOfJumpTypes();
|
||||
this.getListOfAircrafts();
|
||||
this.getListOfDropZones();
|
||||
}
|
||||
|
||||
onFormSubmit() {
|
||||
@@ -51,4 +64,32 @@ export class NewJumpComponent implements OnInit {
|
||||
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