merge dev vers Romain
This commit is contained in:
commit
0d9546fff0
|
@ -34,7 +34,8 @@ import { TemplatePageComponent } from './components/template-page/template-page.
|
|||
FiltersPageComponent,
|
||||
AvisBarComponent,
|
||||
IconComponent,
|
||||
SigninComponent
|
||||
SigninComponent,
|
||||
TemplatePageComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ApiBackService } from '../services/api-back.service';
|
||||
|
||||
@Component({
|
||||
|
@ -11,20 +11,18 @@ export class CardCategoryComponent implements OnInit {
|
|||
|
||||
@Input() categoryData : any;
|
||||
|
||||
constructor(private apiBackService : ApiBackService, private route : Router) { }
|
||||
constructor(private apiBackService : ApiBackService, private route : Router, private activatedRoute : ActivatedRoute) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
onClickCateg(id : number){
|
||||
|
||||
|
||||
this.apiBackService.getRestaurantsByCateg(id);
|
||||
this.apiBackService.getRestaurantsByCateg(id , this.activatedRoute.snapshot.routeConfig?.path);
|
||||
// on fait passer en second parametre le path de la route c'est a dire "home"(pour l'instant)
|
||||
|
||||
this.route.navigate(['restaurants']);
|
||||
|
||||
//console.log('salut les copains');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,11 @@
|
|||
</p>
|
||||
</div>
|
||||
<!-- le else de notre *ngIf plus haut-->
|
||||
<ng-template #noWebsite class="description pe-1" style="font-style: italic;font-weight: bold;">Pas de site Web</ng-template>
|
||||
<ng-template #noWebsite class="description pe-1" style="font-style: italic;font-weight: bold;">
|
||||
<div>
|
||||
<p class="description pt-3 ps-1 pe-1 text-justify d-block" style="font-size:0.9em; color:#545454"> Pas de site Web </p>
|
||||
</div>
|
||||
</ng-template>
|
||||
<!-- ------------------------------------ -->
|
||||
|
||||
<div class="trait-rouge pt-2 pb-0"></div>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
<div class="accordion">
|
||||
|
||||
<<<<<<< HEAD
|
||||
<!-------------------------------------------------------------------------- Accordéon Distance -------------------------------------------------------------------------->
|
||||
|
||||
<div class="accordion-item">
|
||||
|
@ -48,8 +49,61 @@
|
|||
<span>20€</span>
|
||||
</div>
|
||||
</div>
|
||||
=======
|
||||
<!-------------------------------------------------------------------------- Accordéon Distance -------------------------------------------------------------------------->
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="panelsStayOpen-headingOne">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#panelsStayOpen-collapseOne">
|
||||
<p style="font-family:'Roboto';font-size: 20px;">Distance</p>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="panelsStayOpen-collapseOne" class="accordion-collapse collapse"
|
||||
aria-labelledby="panelsStayOpen-headingOne">
|
||||
<div class="accordion-body">
|
||||
<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)="OnChangeValueDistance($event)">
|
||||
<div class="valuesDistance d-flex d-flex justify-content-between">
|
||||
<span>0 KM</span>
|
||||
<span>2 KM</span>
|
||||
<span>4 KM</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-------------------------------------------------------------------------- Accordéon Prix -------------------------------------------------------------------------->
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="panelsStayOpen-headingTwo">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#panelsStayOpen-collapseTwo">
|
||||
<p style="font-family:'Roboto'; font-size: 20px;">Prix</p>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="panelsStayOpen-collapseTwo" class="accordion-collapse collapse"
|
||||
aria-labelledby="panelsStayOpen-headingTwo">
|
||||
<div class="accordion-body">
|
||||
|
||||
<div class="minMax p-3">
|
||||
<span>Veuillez sélectionner le prix souhaité</span>
|
||||
>>>>>>> dev
|
||||
</div>
|
||||
<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>1</span>
|
||||
<span>2</span>
|
||||
<span>3</span>
|
||||
<span>4</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<<<<<<< HEAD
|
||||
|
||||
<!-------------------------------------------------------------------------- Accordéon Place/Emporter -------------------------------------------------------------------------->
|
||||
|
||||
|
@ -109,14 +163,90 @@
|
|||
<span>Choisissez parmi les avis déjà donnés</span>
|
||||
</div>
|
||||
<app-avis-bar (stateNumber)="onStateNumberChange($event)"></app-avis-bar>
|
||||
=======
|
||||
</div>
|
||||
|
||||
<!-------------------------------------------------------------------------- Accordéon Place/Emporter -------------------------------------------------------------------------->
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="panelsStayOpen-headingThree">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#panelsStayOpen-collapseThree">
|
||||
<p style="font-family:'Roboto'; font-size: 20px;">Sur Place / A Emporter</p>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="panelsStayOpen-collapseThree" class="accordion-collapse collapse"
|
||||
aria-labelledby="panelsStayOpen-headingThree">
|
||||
<div class="accordion-body">
|
||||
|
||||
<div class="Titles m-3 d-flex justify-content-around">
|
||||
<span>Sur Place</span>
|
||||
<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;" (change)="OnChangeValueSurPlace($event)">
|
||||
<input class="Emporter-check-input" type="checkbox" value="aEmporterOption" style="width: 25px; height: 25px;"
|
||||
(change)="OnChangeValueEmporter($event)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-------------------------------------------------------------------------- Accordéon AccesPMR -------------------------------------------------------------------------->
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="panelsStayOpen-headingFour">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#panelsStayOpen-collapseFour">
|
||||
<p style="font-family:'Roboto'; font-size: 20px;">Accès PMR</p>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="panelsStayOpen-collapseFour" class="accordion-collapse collapse"
|
||||
aria-labelledby="panelsStayOpen-headingFour">
|
||||
<div class="accordion-body">
|
||||
|
||||
<div class="titrePmr m-3 d-flex justify-content-around">
|
||||
<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="AccesPMR" style="width: 25px; height: 25px;"
|
||||
(change)="OnChangeValuePMR($event)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-------------------------------------------------------------------------- Accordéon Avis -------------------------------------------------------------------------->
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="panelsStayOpen-headingFive">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#panelsStayOpen-collapseFive">
|
||||
<p style="font-family:'Roboto'; font-size: 20px;">Avis</p>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="panelsStayOpen-collapseFive" class="accordion-collapse collapse"
|
||||
aria-labelledby="panelsStayOpen-headingFive">
|
||||
<div class="accordion-body">
|
||||
<div class="titreAvis m-3 d-flex justify-content-around">
|
||||
<span>Choisissez parmi les avis déjà donnés</span>
|
||||
>>>>>>> dev
|
||||
</div>
|
||||
<app-avis-bar (stateNumber)="onStateNumberChange($event)"></app-avis-bar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<button class="btn-search btn-primary" type="button"
|
||||
(click) = "onSendFilters($event, null, null, null, null, null)"
|
||||
(click) ="onSendRating()">LANCER LA RECHERCHE</button>
|
||||
|
||||
=======
|
||||
<button class="btn-search btn-primary" type="button" (click)="onSendFilters()" (click)="onSendRating()">LANCER LA
|
||||
RECHERCHE</button>
|
||||
>>>>>>> dev
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ApiBackService } from 'src/app/services/api-back.service';
|
||||
|
||||
@Component({
|
||||
|
@ -14,7 +14,7 @@ export class FiltersPageComponent implements OnInit {
|
|||
|
||||
public minPrice : any;
|
||||
public maxPrice: any;
|
||||
public selectPrice : any;
|
||||
public selectPrice : number;
|
||||
public selectDistance : any;
|
||||
public selectPmr :any;
|
||||
public selectSurPlace : any;
|
||||
|
@ -24,18 +24,18 @@ export class FiltersPageComponent implements OnInit {
|
|||
@Output() rangeNumber = new EventEmitter();
|
||||
public selectRating: number;
|
||||
|
||||
public listRestau: string[];
|
||||
public listRestau: any[];
|
||||
|
||||
|
||||
constructor(private apiBackService : ApiBackService, private route : Router) {
|
||||
constructor(private apiBackService : ApiBackService, private route : Router, private activatedRoute : ActivatedRoute) {
|
||||
|
||||
this.minDistance = 0;
|
||||
this.maxDistance = 4;
|
||||
this.selectDistance = null;
|
||||
|
||||
this.minPrice = 0;
|
||||
this.maxPrice = 20;
|
||||
this.selectPrice = null;
|
||||
this.minPrice = 1;
|
||||
this.maxPrice = 4;
|
||||
this.selectPrice = 0;
|
||||
|
||||
this.selectPmr = false;
|
||||
this.selectEmporter = false;
|
||||
|
@ -51,8 +51,10 @@ export class FiltersPageComponent implements OnInit {
|
|||
ngOnInit(): void {
|
||||
this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => {
|
||||
this.listRestau = restaurants;
|
||||
console.log(this.listRestau);
|
||||
});
|
||||
|
||||
console.log(this.listRestau);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,13 +87,22 @@ onSendRating() {
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
onSendFilters() : void{
|
||||
let restaus = this.listRestau;
|
||||
|
||||
restaus = restaus.filter((restau)=>
|
||||
|
||||
this.selectPrice == restau.prix
|
||||
|
||||
),
|
||||
console.log( this.activatedRoute.snapshot.routeConfig?.path);
|
||||
|
||||
|
||||
this.apiBackService.setListRestau(restaus, this.activatedRoute.snapshot.routeConfig?.path);
|
||||
// on fait passer en second parametre le path de la route c'est a dire "filtres"
|
||||
|
||||
this.route.navigate(['restaurants']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,16 +18,9 @@ export class HomePageComponent implements OnInit {
|
|||
this.apiBackService.getCategories().subscribe((listCategories: any[]) => {
|
||||
console.log(listCategories);
|
||||
|
||||
// const listCategoriesLibelle = listCategories.map(
|
||||
// (category) => category.libelle
|
||||
// );
|
||||
|
||||
this.listCategories = listCategories;
|
||||
|
||||
});
|
||||
console.log(this.apiBackService);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,22 @@ export class RestoPageComponent implements OnInit {
|
|||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.apiBackService.restoByCat.subscribe((restaurants: any[]) => {
|
||||
// arrivée sur la restau-page depuis filtres ou home(catégories) : appel a une méthode différente du service
|
||||
if(this.apiBackService.routeParam === "filtres"){
|
||||
this.listRestaurants = this.apiBackService.restoFilter;
|
||||
|
||||
}else if(this.apiBackService.routeParam === "home"){
|
||||
this.apiBackService.restoByCat.subscribe((restaurants: any[]) => {
|
||||
this.listRestaurants = restaurants;
|
||||
});
|
||||
}else{ // si on arrive sur l'url /restaurants directement = tous les restau affichés
|
||||
|
||||
this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => {
|
||||
this.listRestaurants = restaurants;
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,22 +9,32 @@ import { environment } from 'src/environments/environment';
|
|||
export class ApiBackService {
|
||||
|
||||
public restoByCat : Observable<any[]> = of([]);
|
||||
public restoFilter : any[];
|
||||
public routeParam ?: string;
|
||||
|
||||
constructor(private httpClient: HttpClient) {
|
||||
this.restoFilter = [];
|
||||
this.routeParam = "";
|
||||
}
|
||||
|
||||
getRestaurants(): Observable<any[]> {
|
||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/restaurants`);
|
||||
}
|
||||
|
||||
getRestaurantsByCateg(id : number): void {
|
||||
getRestaurantsByCateg(id : number, routeParam ?: string ): void {
|
||||
this.restoByCat = this.httpClient.get<any[]>(`${environment.apiUrl}/restaurantbytype/${id}`);
|
||||
this.routeParam = routeParam;
|
||||
}
|
||||
|
||||
getCategories(): Observable<any[]>{
|
||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/types`);
|
||||
}
|
||||
|
||||
setListRestau(listRestau : any[], routeParam ?: string ) : void{
|
||||
|
||||
this.restoFilter = listRestau;
|
||||
this.routeParam = routeParam;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue