diff --git a/src/app/filters/avis-bar/avis-bar.component.ts b/src/app/filters/avis-bar/avis-bar.component.ts index e176344..e4757b7 100644 --- a/src/app/filters/avis-bar/avis-bar.component.ts +++ b/src/app/filters/avis-bar/avis-bar.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; @Component({ selector: 'app-avis-bar', @@ -8,6 +8,8 @@ import { Component, OnInit } from '@angular/core'; export class AvisBarComponent implements OnInit { starStates: {stateSelectedUser : boolean, stateHoverUser : boolean}[]; + @Output() stateNumber = new EventEmitter(); + starStateNumber: number = 0; constructor() { @@ -29,7 +31,6 @@ export class AvisBarComponent implements OnInit { } onMouseOver(index: number) { - console.log("star over", index); for (let i = 0; i < this.starStates.length ; i++) { if(i <= index) { this.starStates[i].stateHoverUser = true; @@ -53,13 +54,17 @@ export class AvisBarComponent implements OnInit { } onClickStar(starIndex: number) { + this.starStateNumber = 0; for (let i = 0; i < this.starStates.length ; i++) { if(i <= starIndex) { this.starStates[i].stateSelectedUser = true; + this.starStateNumber++; } else { this.starStates[i].stateSelectedUser = false; } } + //console.log(`Rating : ${this.starStateNumber}`); + this.stateNumber.emit(this.starStateNumber); } } diff --git a/src/app/pages/filters-page/filters-page.component.html b/src/app/pages/filters-page/filters-page.component.html index bfd1eda..69307e4 100644 --- a/src/app/pages/filters-page/filters-page.component.html +++ b/src/app/pages/filters-page/filters-page.component.html @@ -67,8 +67,8 @@ A Emporter
- - + +
@@ -89,7 +89,7 @@ Accès PMR
- +
@@ -108,7 +108,7 @@
Choisissez parmi les avis déjà donnés
- + @@ -116,5 +116,7 @@ - + diff --git a/src/app/pages/filters-page/filters-page.component.ts b/src/app/pages/filters-page/filters-page.component.ts index b2afa2a..89c7c8d 100644 --- a/src/app/pages/filters-page/filters-page.component.ts +++ b/src/app/pages/filters-page/filters-page.component.ts @@ -1,4 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { Router } from '@angular/router'; +import { ApiBackService } from 'src/app/services/api-back.service'; @Component({ selector: 'app-filters-page', @@ -9,37 +11,90 @@ export class FiltersPageComponent implements OnInit { minDistance : any; maxDistance : any; - selectDistance : any; - - minPrice : any; maxPrice: any; selectPrice : any; + selectDistance : any; + selectPmr :any; + selectSurPlace : any; + selectEmporter : any; - constructor() { + @Output() stateNumber = new EventEmitter(); + @Output() rangeNumber = new EventEmitter(); + selectRating: number; + + listRestau: string[]; + + + constructor(private apiBackService : ApiBackService, private route : Router) { this.minDistance = 0; this.maxDistance = 4; - this.selectDistance = 0; + this.selectDistance = null; this.minPrice = 0; this.maxPrice = 20; - this.selectPrice = 0; + this.selectPrice = null; - } + this.selectPmr = false; + this.selectEmporter = false; + this.selectSurPlace = false; + + this.selectRating = 0; - ngOnInit(): void {} + this.listRestau = []; - changeValueDistance(valueDistance: any){ - this.selectDistance = valueDistance.target.value; - console.log(this.selectDistance); + } + + ngOnInit(): void { + this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => { + this.listRestau = restaurants; + console.log(this.listRestau); + }); + } + + +changeValueDistance(valueDistance: any){ + this.selectDistance = valueDistance.target.value; } - changeValuePrice(valuePrice: any){ this.selectPrice = valuePrice.target.value; - console.log(this.selectPrice); +} + +changeValuePMR(valuePmr : any){ +this.selectPmr = (valuePmr.target.checked); +} + +changeValueSurPlace(valuePlace : any){ + this.selectSurPlace = valuePlace.target.checked; +} + +changeValueEmporter(valueEmporter : any){ + this.selectEmporter = valueEmporter.target.checked; +} + +onStateNumberChange(stateNumber: number): void { + this.selectRating = stateNumber; +} + +onSendRating():void { + this.stateNumber.emit(this.selectRating); +} +onSendFilters(){ + + + console.log("distance : " + this.selectDistance); + console.log("prix : " +this.selectPrice); + console.log("sur Place : " +this.selectSurPlace); + console.log("A Emporter : " +this.selectEmporter); + console.log("Acces PMR : " +this.selectPmr); + console.log("Avis : " +this.selectRating); + console.log() + + } } + diff --git a/src/app/pages/resto-page/resto-page.component.ts b/src/app/pages/resto-page/resto-page.component.ts index 78dacce..848c180 100644 --- a/src/app/pages/resto-page/resto-page.component.ts +++ b/src/app/pages/resto-page/resto-page.component.ts @@ -22,6 +22,8 @@ export class RestoPageComponent implements OnInit { }); + + } }