avancement filtres
This commit is contained in:
parent
5d3549b0b6
commit
637e8f75cd
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,8 +67,8 @@
|
||||
<span>A Emporter</span>
|
||||
</div>
|
||||
<div class="PlaceEmporterCheck m-3 d-flex justify-content-around">
|
||||
<input class="surPlace-check-input" type="checkbox" value="surPlaceOption" style="width: 25px; height: 25px; border-radius: 300px;">
|
||||
<input class="Emporter-check-input" type="checkbox" value="aEmporterOption" style="width: 25px; height: 25px;">
|
||||
<input class="surPlace-check-input" type="checkbox" value="surPlaceOption" style="width: 25px; height: 25px; border-radius: 300px;" (change) = "changeValueSurPlace($event)">
|
||||
<input class="Emporter-check-input" type="checkbox" value="aEmporterOption" style="width: 25px; height: 25px;" (change) = "changeValueEmporter($event)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -89,7 +89,7 @@
|
||||
<span>Accès PMR</span>
|
||||
</div>
|
||||
<div class="pmr-check d-flex justify-content-center p-2">
|
||||
<input class="pmr-check-input mx-auto" type="checkbox" value="" style="width: 25px; height: 25px;">
|
||||
<input class="pmr-check-input mx-auto" type="checkbox" value="AccesPMR" style="width: 25px; height: 25px;" (change) = "changeValuePMR($event)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -108,7 +108,7 @@
|
||||
<div class="titreAvis m-3 d-flex justify-content-around">
|
||||
<span>Choisissez parmi les avis déjà donnés</span>
|
||||
</div>
|
||||
<app-avis-bar></app-avis-bar>
|
||||
<app-avis-bar (stateNumber)="onStateNumberChange($event)"></app-avis-bar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -116,5 +116,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn-search btn-primary" type="button">LANCER LA RECHERCHE</button>
|
||||
<button class="btn-search btn-primary" type="button"
|
||||
(click) = "onSendFilters()"
|
||||
(click) ="onSendRating()">LANCER LA RECHERCHE</button>
|
||||
|
||||
|
@ -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;
|
||||
|
||||
this.listRestau = [];
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
ngOnInit(): void {
|
||||
this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => {
|
||||
this.listRestau = restaurants;
|
||||
console.log(this.listRestau);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
changeValueDistance(valueDistance: any){
|
||||
this.selectDistance = valueDistance.target.value;
|
||||
console.log(this.selectDistance);
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ export class RestoPageComponent implements OnInit {
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user