Check sur l'ajout de sauts

et retrie du table des DZ sur le set/unset
de favoris
This commit is contained in:
Sébastien André
2020-03-29 19:03:32 +02:00
parent 40e894acba
commit 3ccd0c1056
4 changed files with 13 additions and 1 deletions

View File

@@ -52,10 +52,18 @@ export class ListOfDzsComponent implements OnInit {
public setToFavorite(dropzone: DropZoneResp) {
dropzone.isFavorite = this.serviceApi.SetFavoriteDropZone(dropzone);
const data = this.dataSourceTable.data;
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
this.dataSourceTable.paginator = this.paginator;
}
public removeToFavorite(dropzone: DropZoneResp) {
dropzone.isFavorite = this.serviceApi.RemoveFavoriteDropZone(dropzone);
dropzone.isFavorite = !this.serviceApi.RemoveFavoriteDropZone(dropzone);
const data = this.dataSourceTable.data;
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
this.dataSourceTable.paginator = this.paginator;
}
openDialogToAdd() {

View File

@@ -76,9 +76,13 @@ export class NewJumpComponent implements OnInit {
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 &&
isNumber(this.exitAltitude) &&
this.deployAltitude !== undefined &&