diff --git a/Front/skydivelogs-app/src/app/app.module.ts b/Front/skydivelogs-app/src/app/app.module.ts index c9af62c..8f0c46c 100644 --- a/Front/skydivelogs-app/src/app/app.module.ts +++ b/Front/skydivelogs-app/src/app/app.module.ts @@ -50,6 +50,7 @@ import { MatTableModule } from "@angular/material/table"; import { MatTabsModule } from "@angular/material/tabs"; import { MatDialogModule } from "@angular/material/dialog"; import { MatCardModule } from "@angular/material/card"; +import { MatRadioModule } from "@angular/material/radio"; import { CachingInterceptor } from "../interceptor/caching.interceptor"; //import { BasicAuthInterceptor } from '../interceptor/basic-auth.interceptor'; @@ -151,6 +152,7 @@ const appRoutes: Routes = [ MatTabsModule, MatDialogModule, MatCardModule, + MatRadioModule, ], exports: [HttpClientModule], providers: [ 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 b7d84df..8f7d1c3 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,6 +46,14 @@ +
+ + + Auto + Always + +
+ Choose the used gear 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 6a5dd1b..36a9e95 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 @@ -12,10 +12,12 @@ import { JumpTypeService } from "../../services/jump-type.service"; import { GearService } from "../../services/gear.service"; import { isNumber } from "util"; +import { FormControl } from "@angular/forms"; + @Component({ selector: "app-new-jump", templateUrl: "./new-jump.component.html", - styleUrls: ["./new-jump.component.css"] + styleUrls: ["./new-jump.component.css"], }) export class NewJumpComponent implements OnInit { beginDate: Date; @@ -35,6 +37,9 @@ export class NewJumpComponent implements OnInit { listOfGear: Array; private countDatasLoaded: number; + // floatLabelControl = new FormControl("auto"); + public toto: string; + constructor( private serviceComm: ServiceComm, private serviceJump: JumpService, @@ -93,7 +98,7 @@ export class NewJumpComponent implements OnInit { } private getListOfJumpTypes() { - this.serviceJumpType.getListOfJumpTypes().subscribe(data => { + this.serviceJumpType.getListOfJumpTypes().subscribe((data) => { this.listOfJumpType = data; this.countDatasLoaded = 1; @@ -104,14 +109,14 @@ export class NewJumpComponent implements OnInit { } private getListOfAircrafts() { - this.serviceAircraft.getListOfAircrafts().subscribe(data => { + this.serviceAircraft.getListOfAircrafts().subscribe((data) => { this.listOfAircraft = data; this.countDatasLoaded++; }); } private getListOfDropZones() { - this.serviceDropzone.getListOfDropZones().subscribe(data => { + this.serviceDropzone.getListOfDropZones().subscribe((data) => { data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0)); this.listOfDropZone = data; this.listOfFilteredDropZone = data; @@ -120,7 +125,7 @@ export class NewJumpComponent implements OnInit { } private getListOfGears() { - this.serviceGear.getListOfGears().subscribe(data => { + this.serviceGear.getListOfGears().subscribe((data) => { this.listOfGear = data; this.countDatasLoaded++; }); @@ -130,11 +135,16 @@ export class NewJumpComponent implements OnInit { return data ? data.name : undefined; } - public onChangeDz(event: string) { - const filterValue = event.toLowerCase(); + public onChangeDz(event: any) { + let filterValue: string; + if (event.id !== undefined) { + filterValue = event.name.toLowerCase(); + } else { + filterValue = event.toLowerCase(); + } this.listOfFilteredDropZone = this.listOfDropZone; - this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter(option => + this.listOfFilteredDropZone = this.listOfFilteredDropZone.filter((option) => option.name.toLowerCase().includes(filterValue) ); } diff --git a/Front/skydivelogs-app/src/models/dropzone.ts b/Front/skydivelogs-app/src/models/dropzone.ts index d35123c..7b5e03a 100644 --- a/Front/skydivelogs-app/src/models/dropzone.ts +++ b/Front/skydivelogs-app/src/models/dropzone.ts @@ -12,6 +12,10 @@ export class DropZoneResp { public email: string; public type: Array; public isFavorite: boolean; + + public isType(searchedType: string): boolean { + return this.type.includes(searchedType); + } } export class DropZoneReq {