Fix sur le formulaire d'ajout de sauts

This commit is contained in:
Sébastien André
2020-05-05 13:21:54 +02:00
parent 9d3ea9900c
commit db6923f5a3
4 changed files with 32 additions and 8 deletions

View File

@@ -50,6 +50,7 @@ import { MatTableModule } from "@angular/material/table";
import { MatTabsModule } from "@angular/material/tabs"; import { MatTabsModule } from "@angular/material/tabs";
import { MatDialogModule } from "@angular/material/dialog"; import { MatDialogModule } from "@angular/material/dialog";
import { MatCardModule } from "@angular/material/card"; import { MatCardModule } from "@angular/material/card";
import { MatRadioModule } from "@angular/material/radio";
import { CachingInterceptor } from "../interceptor/caching.interceptor"; import { CachingInterceptor } from "../interceptor/caching.interceptor";
//import { BasicAuthInterceptor } from '../interceptor/basic-auth.interceptor'; //import { BasicAuthInterceptor } from '../interceptor/basic-auth.interceptor';
@@ -151,6 +152,7 @@ const appRoutes: Routes = [
MatTabsModule, MatTabsModule,
MatDialogModule, MatDialogModule,
MatCardModule, MatCardModule,
MatRadioModule,
], ],
exports: [HttpClientModule], exports: [HttpClientModule],
providers: [ providers: [

View File

@@ -46,6 +46,14 @@
</button> </button>
</mat-form-field> </mat-form-field>
<div>
<label>Float label: </label>
<mat-radio-group [(ngModel)]="toto">
<mat-radio-button value="auto">Auto</mat-radio-button>
<mat-radio-button value="always">Always</mat-radio-button>
</mat-radio-group>
</div>
<mat-form-field> <mat-form-field>
<mat-label>Choose the used gear</mat-label> <mat-label>Choose the used gear</mat-label>
<input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear"> <input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear">

View File

@@ -12,10 +12,12 @@ import { JumpTypeService } from "../../services/jump-type.service";
import { GearService } from "../../services/gear.service"; import { GearService } from "../../services/gear.service";
import { isNumber } from "util"; import { isNumber } from "util";
import { FormControl } from "@angular/forms";
@Component({ @Component({
selector: "app-new-jump", selector: "app-new-jump",
templateUrl: "./new-jump.component.html", templateUrl: "./new-jump.component.html",
styleUrls: ["./new-jump.component.css"] styleUrls: ["./new-jump.component.css"],
}) })
export class NewJumpComponent implements OnInit { export class NewJumpComponent implements OnInit {
beginDate: Date; beginDate: Date;
@@ -35,6 +37,9 @@ export class NewJumpComponent implements OnInit {
listOfGear: Array<GearResp>; listOfGear: Array<GearResp>;
private countDatasLoaded: number; private countDatasLoaded: number;
// floatLabelControl = new FormControl("auto");
public toto: string;
constructor( constructor(
private serviceComm: ServiceComm, private serviceComm: ServiceComm,
private serviceJump: JumpService, private serviceJump: JumpService,
@@ -93,7 +98,7 @@ export class NewJumpComponent implements OnInit {
} }
private getListOfJumpTypes() { private getListOfJumpTypes() {
this.serviceJumpType.getListOfJumpTypes().subscribe(data => { this.serviceJumpType.getListOfJumpTypes().subscribe((data) => {
this.listOfJumpType = data; this.listOfJumpType = data;
this.countDatasLoaded = 1; this.countDatasLoaded = 1;
@@ -104,14 +109,14 @@ export class NewJumpComponent implements OnInit {
} }
private getListOfAircrafts() { private getListOfAircrafts() {
this.serviceAircraft.getListOfAircrafts().subscribe(data => { this.serviceAircraft.getListOfAircrafts().subscribe((data) => {
this.listOfAircraft = data; this.listOfAircraft = data;
this.countDatasLoaded++; this.countDatasLoaded++;
}); });
} }
private getListOfDropZones() { private getListOfDropZones() {
this.serviceDropzone.getListOfDropZones().subscribe(data => { this.serviceDropzone.getListOfDropZones().subscribe((data) => {
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0)); data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
this.listOfDropZone = data; this.listOfDropZone = data;
this.listOfFilteredDropZone = data; this.listOfFilteredDropZone = data;
@@ -120,7 +125,7 @@ export class NewJumpComponent implements OnInit {
} }
private getListOfGears() { private getListOfGears() {
this.serviceGear.getListOfGears().subscribe(data => { this.serviceGear.getListOfGears().subscribe((data) => {
this.listOfGear = data; this.listOfGear = data;
this.countDatasLoaded++; this.countDatasLoaded++;
}); });
@@ -130,11 +135,16 @@ export class NewJumpComponent implements OnInit {
return data ? data.name : undefined; return data ? data.name : undefined;
} }
public onChangeDz(event: string) { public onChangeDz(event: any) {
const filterValue = event.toLowerCase(); let filterValue: string;
if (event.id !== undefined) {
filterValue = event.name.toLowerCase();
} else {
filterValue = event.toLowerCase();
}
this.listOfFilteredDropZone = this.listOfDropZone; this.listOfFilteredDropZone = this.listOfDropZone;
this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter(option => this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter((option) =>
option.name.toLowerCase().includes(filterValue) option.name.toLowerCase().includes(filterValue)
); );
} }

View File

@@ -12,6 +12,10 @@ export class DropZoneResp {
public email: string; public email: string;
public type: Array<string>; public type: Array<string>;
public isFavorite: boolean; public isFavorite: boolean;
public isType(searchedType: string): boolean {
return this.type.includes(searchedType);
}
} }
export class DropZoneReq { export class DropZoneReq {