This commit is contained in:
Sébastien André
2020-08-25 17:10:35 +02:00
parent 498ec2c741
commit fca55827e8

View File

@@ -34,6 +34,7 @@ export class NewJumpComponent implements OnInit {
listOfFilteredDropZone: Array<DropZoneResp>;
listOfGear: Array<GearResp>;
private countDatasLoaded: number;
private pendingAddRequest: boolean;
constructor(
private serviceComm: ServiceComm,
@@ -47,6 +48,7 @@ export class NewJumpComponent implements OnInit {
ngOnInit() {
this.serviceComm.UpdatedComponentTitle("Add a new jump");
this.pendingAddRequest = false;
this.endDate = new Date();
this.beginDate = this.dateService.AddDays(new Date(), -1);
@@ -59,6 +61,8 @@ export class NewJumpComponent implements OnInit {
}
onFormSubmit() {
this.pendingAddRequest = true;
this.serviceJump.AddListOfJump(
this.selectedJumpType.id,
this.selectedAircraft.id,
@@ -72,7 +76,10 @@ export class NewJumpComponent implements OnInit {
this.countOfJumps
);
this.initForm();
setTimeout(() => {
this.initForm();
this.pendingAddRequest = false;
}, 1000);
}
public isValidatedForm(): boolean {
@@ -140,6 +147,8 @@ export class NewJumpComponent implements OnInit {
this.selectedGear = undefined;
this.selectedAircraft = undefined;
this.selectedJumpType = undefined;
this.listOfFilteredDropZone = this.listOfDropZone;
}
public displayFn(data?: JumpTypeResp): string | undefined {
@@ -160,7 +169,7 @@ export class NewJumpComponent implements OnInit {
);
}
public allDatasLoaded(): boolean {
return this.countDatasLoaded === 4;
public loadingToDisplay(): boolean {
return this.pendingAddRequest || this.countDatasLoaded === 4;
}
}