Autcomplete ajouté sur les dropdown list

du formulaire d'ajout de sauts
This commit is contained in:
Sébastien André
2019-11-25 11:20:50 +01:00
parent ec5fac8826
commit 41eecd2a68
3 changed files with 99 additions and 73 deletions

View File

@@ -1,18 +1,18 @@
import { Component, OnInit } from "@angular/core";
import { ServiceComm } from "../../services/service-comm.service";
import { ServiceApiGet } from "../../services/service-api-get.service";
import { ServiceApiPost } from "../../services/service-api-post.service";
import { JumpTypeResp } from "../../models/jumpType";
import { AircraftResp } from "../../models/aircraft";
import { DropZoneResp } from "../../models/dropzone";
import { DateService } from "../../services/date.service";
import { GearResp } from "../../models/gear";
import { isNumber } from "util";
import { Component, OnInit } from '@angular/core';
import { ServiceComm } from '../../services/service-comm.service';
import { ServiceApiGet } from '../../services/service-api-get.service';
import { ServiceApiPost } from '../../services/service-api-post.service';
import { JumpTypeResp } from '../../models/jumpType';
import { AircraftResp } from '../../models/aircraft';
import { DropZoneResp } from '../../models/dropzone';
import { DateService } from '../../services/date.service';
import { GearResp } from '../../models/gear';
import { isNumber } from 'util';
@Component({
selector: "app-new-jump",
templateUrl: "./new-jump.component.html",
styleUrls: ["./new-jump.component.css"]
selector: 'app-new-jump',
templateUrl: './new-jump.component.html',
styleUrls: ['./new-jump.component.css']
})
export class NewJumpComponent implements OnInit {
beginDate: Date;
@@ -20,10 +20,10 @@ export class NewJumpComponent implements OnInit {
exitAltitude: number;
deployAltitude: number;
countOfJumps: number;
selectedDz: number;
selectedGear: number;
selectedAircraft: number;
selectedJumpType: number;
selectedDz: DropZoneResp;
selectedGear: GearResp;
selectedAircraft: AircraftResp;
selectedJumpType: JumpTypeResp;
withCutaway: boolean;
listOfJumpType: Array<JumpTypeResp>;
listOfAircraft: Array<AircraftResp>;
@@ -35,10 +35,10 @@ export class NewJumpComponent implements OnInit {
private serviceApiGet: ServiceApiGet,
private serviceApiPost: ServiceApiPost,
private dateService: DateService
) {}
) { }
ngOnInit() {
this.serviceComm.updatedComponentTitle("Add a new jump");
this.serviceComm.updatedComponentTitle('Add a new jump');
this.endDate = new Date();
@@ -53,10 +53,10 @@ export class NewJumpComponent implements OnInit {
onFormSubmit() {
this.serviceApiPost.AddListOfJump(
this.selectedJumpType,
this.selectedAircraft,
this.selectedDz,
this.selectedGear,
this.selectedJumpType.id,
this.selectedAircraft.id,
this.selectedDz.id,
this.selectedGear.id,
this.withCutaway,
this.beginDate,
this.endDate,
@@ -68,13 +68,13 @@ export class NewJumpComponent implements OnInit {
public isValidatedForm(): boolean {
return (
this.selectedDz != undefined &&
this.selectedGear != undefined &&
this.selectedAircraft != undefined &&
this.selectedJumpType != undefined &&
this.exitAltitude != undefined && isNumber(this.exitAltitude) &&
this.deployAltitude != undefined && isNumber(this.deployAltitude) &&
this.countOfJumps != undefined && isNumber(this.countOfJumps)
this.selectedDz !== undefined &&
this.selectedGear !== undefined &&
this.selectedAircraft !== undefined &&
this.selectedJumpType !== undefined &&
this.exitAltitude !== undefined && isNumber(this.exitAltitude) &&
this.deployAltitude !== undefined && isNumber(this.deployAltitude) &&
this.countOfJumps !== undefined && isNumber(this.countOfJumps)
);
}
@@ -104,4 +104,9 @@ export class NewJumpComponent implements OnInit {
this.listOfGear = data;
});
}
displayFn(data?: JumpTypeResp): string | undefined {
return data ? data.name : undefined;
}
}