diff --git a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts index e13b81f..e969d41 100644 --- a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts +++ b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts @@ -34,6 +34,7 @@ export class NewJumpComponent implements OnInit { listOfFilteredDropZone: Array; listOfGear: Array; 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; } }