Ajout de la possibilité de supprimer un saut

Ajout de la possibilité de ne pas reset le
formulaire après ajout de sauts
This commit is contained in:
Sébastien André
2021-04-20 10:38:05 +02:00
parent 27928f1696
commit 49c2a87423
5 changed files with 64 additions and 44 deletions

View File

@@ -2,6 +2,7 @@
<div class="content">
<div>
<button mat-raised-button color="accent" [routerLink]="['/jumps']" [routerLinkActive]="['active']" skipLocationChange>View the jumps</button>
<p><mat-checkbox [(ngModel)]="resetForm" labelPosition="before">Reset form after adding : </mat-checkbox></p>
</div>
<form class="formNewJumps" (ngSubmit)="onFormSubmit()" *ngIf="notLoadingToDisplay() else loading">
<mat-form-field>

View File

@@ -17,24 +17,25 @@ import { GearService } from "../../services/gear.service";
styleUrls: ["./new-jump.component.css"]
})
export class NewJumpComponent implements OnInit {
beginDate: Date;
endDate: Date;
exitAltitude: number;
deployAltitude: number;
countOfJumps: number;
selectedDz: DropZoneResp;
selectedGear: GearResp;
selectedAircraft: AircraftResp;
selectedJumpType: JumpTypeResp;
withCutaway: boolean;
listOfJumpType: Array<JumpTypeResp>;
listOfAircraft: Array<AircraftResp>;
private listOfDropZone: Array<DropZoneResp>;
listOfFilteredDropZone: Array<DropZoneResp>;
listOfGear: Array<GearResp>;
public beginDate: Date;
public endDate: Date;
public exitAltitude: number;
public deployAltitude: number;
public countOfJumps: number;
public selectedDz: DropZoneResp;
public selectedGear: GearResp;
public selectedAircraft: AircraftResp;
public selectedJumpType: JumpTypeResp;
public withCutaway: boolean;
public listOfJumpType: Array<JumpTypeResp>;
public listOfAircraft: Array<AircraftResp>;
public listOfFilteredDropZone: Array<DropZoneResp>;
public listOfGear: Array<GearResp>;
public comments: string;
public resetForm: boolean;
private countDatasLoaded: number;
private pendingAddRequest: boolean;
comments: string;
private listOfDropZone: Array<DropZoneResp>;
constructor(private serviceComm: ServiceComm,
private serviceJump: JumpService,
@@ -69,28 +70,28 @@ export class NewJumpComponent implements OnInit {
this.comments);
setTimeout(() => {
this.initForm();
if (this.resetForm === true) {
this.initForm();
}
this.pendingAddRequest = false;
}, 1000);
}
public isValidatedForm(): boolean {
return (
this.selectedDz !== undefined &&
this.selectedDz.id !== undefined &&
this.selectedGear !== undefined &&
this.selectedGear.id !== undefined &&
this.selectedAircraft !== undefined &&
this.selectedAircraft.id !== undefined &&
this.selectedJumpType !== undefined &&
this.selectedJumpType.id !== undefined &&
this.exitAltitude !== undefined &&
typeof this.exitAltitude === "number" &&
this.deployAltitude !== undefined &&
typeof this.deployAltitude === "number" &&
this.countOfJumps !== undefined &&
typeof this.countOfJumps === "number"
);
return (this.selectedDz !== undefined &&
this.selectedDz.id !== undefined &&
this.selectedGear !== undefined &&
this.selectedGear.id !== undefined &&
this.selectedAircraft !== undefined &&
this.selectedAircraft.id !== undefined &&
this.selectedJumpType !== undefined &&
this.selectedJumpType.id !== undefined &&
this.exitAltitude !== undefined &&
typeof this.exitAltitude === "number" &&
this.deployAltitude !== undefined &&
typeof this.deployAltitude === "number" &&
this.countOfJumps !== undefined &&
typeof this.countOfJumps === "number");
}
private getListOfJumpTypes() {