Merge branch 'Romain' into dev

This commit is contained in:
Romain Verger 2022-02-15 15:00:40 +01:00
commit a4b719ba94
4 changed files with 91 additions and 29 deletions

View File

@ -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);
}
}

View File

@ -17,7 +17,7 @@
<div class="distance p-3">
<span>Veuillez sélectionner la distance souhaitée</span>
</div>
<input type="range" class="form-range" min="{{minDistance}}" max="{{maxDistance}}" (change)="changeValueDistance($event)" >
<input type="range" class="form-range" min="{{minDistance}}" max="{{maxDistance}}" (change)="OnChangeValueDistance($event)" >
<div class="valuesDistance d-flex d-flex justify-content-between">
<span>0 KM</span>
<span>2 KM</span>
@ -41,7 +41,7 @@
<div class="minMax p-3">
<span>Veuillez sélectionner le prix souhaité</span>
</div>
<input type="range" class="form-range" ng-model="valuePrix" min="{{minPrice}}" max="{{maxPrice}}" (change)="changeValuePrice($event)">
<input type="range" class="form-range" ng-model="valuePrix" min="{{minPrice}}" max="{{maxPrice}}" (change)="OnChangeValuePrice($event)">
<div class="valuesPrix d-flex d-flex justify-content-between">
<span>0€</span>
<span>10€</span>
@ -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) = "OnChangeValueSurPlace($event)">
<input class="Emporter-check-input" type="checkbox" value="aEmporterOption" style="width: 25px; height: 25px;" (change) = "OnChangeValueEmporter($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) = "OnChangeValuePMR($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>

View File

@ -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',
@ -7,39 +9,90 @@ import { Component, OnInit } from '@angular/core';
})
export class FiltersPageComponent implements OnInit {
minDistance : any;
maxDistance : any;
selectDistance : any;
public minDistance : any;
public maxDistance : any;
public minPrice : any;
public maxPrice: any;
public selectPrice : any;
public selectDistance : any;
public selectPmr :any;
public selectSurPlace : any;
public selectEmporter : any;
@Output() stateNumber = new EventEmitter();
@Output() rangeNumber = new EventEmitter();
public selectRating: number;
public listRestau: string[];
minPrice : any;
maxPrice: any;
selectPrice : any;
constructor() {
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;
ngOnInit(): void {}
this.selectRating = 0;
changeValueDistance(valueDistance: any){
this.selectDistance = valueDistance.target.value;
console.log(this.selectDistance);
this.listRestau = [];
}
ngOnInit(): void {
this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => {
this.listRestau = restaurants;
console.log(this.listRestau);
});
}
OnChangeValueDistance(valueDistance: any){
this.selectDistance = valueDistance.target.value;
}
changeValuePrice(valuePrice: any){
OnChangeValuePrice(valuePrice: any){
this.selectPrice = valuePrice.target.value;
console.log(this.selectPrice);
}
OnChangeValuePMR(valuePmr : any){
this.selectPmr = (valuePmr.target.checked);
}
OnChangeValueSurPlace(valuePlace : any){
this.selectSurPlace = valuePlace.target.checked;
}
OnChangeValueEmporter(valueEmporter : any){
this.selectEmporter = valueEmporter.target.checked;
}
onStateNumberChange(stateNumber: number): void {
this.selectRating = stateNumber;
}
onSendRating() {
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("PMR :" ,this.selectPmr);
console.log("avis :" ,this.selectRating);
}
}

View File

@ -22,6 +22,8 @@ export class RestoPageComponent implements OnInit {
});
}
}