Correction sur le check de validation de formulaire

This commit is contained in:
2026-01-21 15:53:19 +01:00
parent 3baeb3066e
commit 7698754db2
4 changed files with 58 additions and 54 deletions

View File

@@ -46,7 +46,7 @@
aria-label="Clear"
(click)="selectedJumpType = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -78,7 +78,7 @@
aria-label="Clear"
(click)="selectedAircraft = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -104,9 +104,9 @@
aria-hidden="false"
aria-label="Favorite"
color="primary"
svgIcon="favorite"
>
favorite</mat-icon
>
</mat-icon>
}
</mat-option>
}
@@ -118,7 +118,7 @@
aria-label="Clear"
(click)="resetDz()"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -148,7 +148,7 @@
aria-label="Clear"
(click)="selectedGear = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -202,7 +202,7 @@
aria-label="Clear"
(click)="exitAltitude = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -221,7 +221,7 @@
aria-label="Clear"
(click)="deployAltitude = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -240,7 +240,7 @@
aria-label="Clear"
(click)="countOfJumps = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
@@ -259,12 +259,12 @@
aria-label="Clear"
(click)="comments = undefined"
>
<mat-icon>close</mat-icon>
<mat-icon svgIcon="close"></mat-icon>
</button>
}
</mat-form-field>
<br />
@if (isValidatedForm()) {
@if (this.isValidatedForm()) {
<button mat-raised-button color="accent">
{{ "NewJump_Submit" | translate }}
</button>

View File

@@ -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 {

View File

@@ -141,7 +141,7 @@
}
</mat-form-field>
<br />
@if (isValidatedForm()) {
@if (this.isValidatedForm()) {
<button mat-raised-button color="accent">
{{ "NewTunnelFlight_Submit" | translate }}
</button>

View File

@@ -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 {