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