From 7698754db21ad5afced023bbc301ade82e70f9ed Mon Sep 17 00:00:00 2001 From: sandre Date: Wed, 21 Jan 2026 15:53:19 +0100 Subject: [PATCH] Correction sur le check de validation de formulaire --- .../src/app/new-jump/new-jump.component.html | 22 ++++---- .../src/app/new-jump/new-jump.component.ts | 54 ++++++++++--------- .../new-tunnel-flight.component.html | 2 +- .../new-tunnel-flight.component.ts | 34 ++++++------ 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html index b98745a..8dc7392 100644 --- a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html +++ b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.html @@ -46,7 +46,7 @@ aria-label="Clear" (click)="selectedJumpType = undefined" > - close + } @@ -78,7 +78,7 @@ aria-label="Clear" (click)="selectedAircraft = undefined" > - close + } @@ -104,9 +104,9 @@ aria-hidden="false" aria-label="Favorite" color="primary" + svgIcon="favorite" > - favorite + } } @@ -118,7 +118,7 @@ aria-label="Clear" (click)="resetDz()" > - close + } @@ -148,7 +148,7 @@ aria-label="Clear" (click)="selectedGear = undefined" > - close + } @@ -202,7 +202,7 @@ aria-label="Clear" (click)="exitAltitude = undefined" > - close + } @@ -221,7 +221,7 @@ aria-label="Clear" (click)="deployAltitude = undefined" > - close + } @@ -240,7 +240,7 @@ aria-label="Clear" (click)="countOfJumps = undefined" > - close + } @@ -259,12 +259,12 @@ aria-label="Clear" (click)="comments = undefined" > - close + }
- @if (isValidatedForm()) { + @if (this.isValidatedForm()) { 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 1fd0c18..3e91d6b 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 @@ -125,34 +125,36 @@ export class NewJumpComponent implements OnInit { } onFormSubmit() { - this.pendingAddRequest = true; + if (this.isValidatedForm()) { + this.pendingAddRequest = true; - this.serviceJump - .addListOfJump( - this.selectedJumpType.id, - this.selectedAircraft.id, - this.selectedDz.id, - this.selectedGear.id, - this.withCutaway === undefined ? false : this.withCutaway, - this.beginDate, - this.endDate, - this.exitAltitude, - this.deployAltitude, - this.countOfJumps, - this.comments, - this.isSpecial === undefined ? false : this.isSpecial, - ) - .subscribe(() => { - this.statsService.resetStats(); - this.comments = undefined; - this.withCutaway = false; - this.isSpecial = false; + this.serviceJump + .addListOfJump( + this.selectedJumpType.id, + this.selectedAircraft.id, + this.selectedDz.id, + this.selectedGear.id, + this.withCutaway === undefined ? false : this.withCutaway, + this.beginDate, + this.endDate, + this.exitAltitude, + this.deployAltitude, + this.countOfJumps, + this.comments, + this.isSpecial === undefined ? false : this.isSpecial, + ) + .subscribe(() => { + this.statsService.resetStats(); + this.comments = undefined; + this.withCutaway = false; + this.isSpecial = false; - if (this.resetForm === true) { - this.initForm(); - } - this.pendingAddRequest = false; - }); + if (this.resetForm === true) { + this.initForm(); + } + this.pendingAddRequest = false; + }); + } } public isValidatedForm(): boolean { diff --git a/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.html b/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.html index 6cfd9f6..db4c777 100644 --- a/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.html +++ b/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.html @@ -141,7 +141,7 @@ }
- @if (isValidatedForm()) { + @if (this.isValidatedForm()) { diff --git a/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.ts b/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.ts index 1c3d6c3..7552cd8 100644 --- a/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.ts +++ b/Front/skydivelogs-app/src/app/new-tunnel-flight/new-tunnel-flight.component.ts @@ -107,24 +107,26 @@ export class NewTunnelFlightComponent implements OnInit { } public onFormSubmit() { - this.pendingAddRequest = true; + if (this.isValidatedForm()) { + this.pendingAddRequest = true; - this.serviceTunnelFlight - .addFlight( - this.selectedTunnel.id, - this.selectedJumpType.id, - this.flightDate, - this.minutesOfFlight, - this.comments, - ) - .subscribe(() => { - this.comments = undefined; + this.serviceTunnelFlight + .addFlight( + this.selectedTunnel.id, + this.selectedJumpType.id, + this.flightDate, + this.minutesOfFlight, + this.comments, + ) + .subscribe(() => { + this.comments = undefined; - if (this.resetForm === true) { - this.initForm(); - } - this.pendingAddRequest = false; - }); + if (this.resetForm === true) { + this.initForm(); + } + this.pendingAddRequest = false; + }); + } } public isValidatedForm(): boolean {