Merge branch 'dev' into Vincent

OK
This commit is contained in:
Vincent Ramiere 2022-02-18 10:25:20 +01:00
commit a0df10e724
20 changed files with 248 additions and 190 deletions

View File

@ -1,5 +1,5 @@
<div class="container position-relative shadow p-0 mb-5 bg-body rounded rounded m-5 rounded-top "
style="width: 21rem;">
style="width: 22rem;">
<img class="card-img-top " src="assets/ImagesRestos/photo.jpg" alt="Card image cap">
<div class="rond position-absolute">
<app-icon class="heart"
@ -10,9 +10,9 @@
<h3 class="titre-resto d-flex justify-content-center d-flex align-items-center" style="font-size: 24px;">
{{restaurant.nom }}</h3>
<div class="accordion " id="accordionExample">
<div class="accordion " id="accordionExample">
<h2 class="accordion-header pt-1" id="headingOne">
<button class="btn accordion-button collapsed ps-5 pe-5 " type="button" data-bs-toggle="collapse"
<button class="btn shadow accordion-button collapsed ps-5 pe-5 " type="button" data-bs-toggle="collapse"
[attr.data-bs-target]="'#restaurant'+ restaurant.id" aria-expanded="true" aria-controls="collapseOne">
PLUS D'INFOS</button>
</h2>
@ -21,7 +21,7 @@
<div class=" body accordion-body">
<strong>This is the first item's accordion body.</strong>
<div class="star-icon d-flex justify-content-flex-start d-flex align-items-center pt-2 ">
<ul class="avis-star d-flex flex-row ps-1 pt-3 pe-0 pb-0 mb-0 ">
<ul class="avis-star d-flex flex-row ps-1 pt-3 pe-0 pb-2 mb-0 ">
<li class="star pe-2"><i class="bi bi-star-fill"></i></li>
<li class="star pe-2"><i class="bi bi-star-fill"></i></li>
<li class="star pe-2"><i class="bi bi-star-fill"></i></li>
@ -30,35 +30,34 @@
</ul>
<span class="ps-3 mt-3 " style="font-size: 1.1em; color:#545454">5/5</span>
</div>
<div class="infos ps-1 pt-2" style="color:#545454">
<div>
<span class="categorie pe-4" style="font-style: italic;" *ngFor="let categorie of restaurant.typerestaus">{{ categorie.libelle }}</span>
</div>
<div>
<i class="fas fa-walking ps-2 pe-1" style="color:#a8a8a8"></i>
<span class="categorie pe-4" style="font-weight: bold;">{{distance}} mètres</span>
</div>
<div>
<i class="fas fa-euro-sign ps-2 pe-1" style="color:#a8a8a8"></i>
<span class="prix" style="font-weight: bold;">5-10€</span>
</div>
<div>
<span class="categorie ps-1 pe-4" style="font-style: italic;" *ngFor="let categorie of restaurant.typerestaus">{{ categorie.libelle }}</span>
</div>
<div class="trait-rouge pt-3"></div>
<div *ngIf="restaurant.website; else noWebsite">
<p class="description pt-3 ps-1 pe-1 text-justify d-block" style="font-size:0.9em; color:#545454">
<a href="{{restaurant.website}}" class="description pe-1" style="font-style: italic;font-weight: bold;">Site Web</a>
</p>
</div>
<!-- le else de notre *ngIf plus haut-->
<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 class="infos pt-2" style="color:#545454">
<i class="fas fa-walking ps-2 pe-2" style="color:#a8a8a8"></i>
<span class="categorie pe-2" style="font-weight: bold;">{{distance}}m</span>
<i class="fas fa-euro-sign ps-2 pe-2" style="color:#a8a8a8"></i>
<span class="prix" style="font-weight: bold;">5-10€</span>
<div class="d-inline-flex" *ngIf="restaurant.website; else noWebsite">
<p class="description pt-3 ps-2 pe-1"><i class="bi bi-globe2 ps-2 pe-2" style="color:#a8a8a8"></i>
<a href="{{restaurant.website}}" class="description text-decoration-none pe-1" style="font-style: italic;font-weight: bold; color:#545454">Site Web</a>
</p>
</div>
</ng-template>
<!-- ------------------------------------ -->
<!-- le else de notre *ngIf plus haut-->
<ng-template #noWebsite>
<div class="d-inline-flex">
<p class="description pt-3 ps-3 pe-1 " style="font-size:1.9vh ;color:#545454"> Pas de site Web </p>
</div>
</ng-template>
<!-- ------------------------------------ -->
</div>
<div class="trait-rouge pt-2 pb-0"></div>
<div class="critere ps-1 pt-3">
@ -76,6 +75,7 @@
<div class="trait-rouge pt-3"></div>
<div class="critere d-flex justify-content-center ps-1 pt-3 pb-3">
<span class="acces-pmr pe-1" style="color:#545454">Accès PMR :</span>
<app-icon
[iconName]="restaurant.accesPMR ? 'bi bi-check-square-fill' : 'bi bi-x-square-fill ps-1 pt-1'"
[iconColor]="restaurant.accesPMR ? '#4ECB71' : '#ED2F2F'"
@ -85,8 +85,5 @@
<button type="button" class="button">Réserver</button>
</div>
</div>
</div>
</div>

View File

@ -34,18 +34,19 @@
}
.accordion-button.collapsed {
background: #CE0000;
}
.accordion-button.collapsed::after {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}
.ps-5 {
padding-left: 6.4rem !important;
padding-left: 7.3rem !important;
}
.pe-5 {
padding-right: 6rem !important;
padding-right: 6.8rem !important;
}

View File

@ -1,4 +1,5 @@
import { Component,EventEmitter, Input, Output, OnInit } from '@angular/core';
import { ApiBackService } from '../services/api-back.service';
@Component({
selector: 'app-card-resto',
@ -13,7 +14,7 @@ export class CardRestoComponent implements OnInit {
@Output() clickLike = new EventEmitter<boolean>();
isLiked : boolean = false;
constructor() {
constructor(private apiBackService : ApiBackService) {
this.distance = 0 ;
}
@ -22,7 +23,7 @@ export class CardRestoComponent implements OnInit {
console.log(this.restaurant);
this.distance = Math.round(
this.getDistanceFromLatLonInKm(
this.apiBackService.setDistance(
48.86201110271593 , //latitude Simplon
2.4361804827725417, //longitude Simplon
this.restaurant.latitude,
@ -39,23 +40,6 @@ export class CardRestoComponent implements OnInit {
this.clickLike.emit(this.isLiked);
}
getDistanceFromLatLonInKm(lat1 : number , lon1 : number, lat2 : number, lon2 : number) {
let R = 6371; // Radius of the earth in km
let dLat = this.deg2rad(lat2-lat1); // deg2rad below
let dLon = this.deg2rad(lon2-lon1);
let a =
Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2)
;
let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
let d = R * c * 1000; // Distance in meters
return d;
}
deg2rad(deg : number) {
return deg * (Math.PI/180)
}

View File

@ -1,6 +1,6 @@
<div (mouseleave)="onMouseLeave()">
<app-icon *ngFor="let star of starStates; let starIndex = index"
[iconName]="star.stateHoverUser ? 'bi-star-fill' : 'bi-star'"
[iconName]="star.stateHoverUser ? 'star-fill' : 'star'"
[iconSize]="2.5"
[iconColor]="'#ffbf00'"
style="padding: 6px;"

View File

@ -10,7 +10,7 @@ img{
display: block;
margin: 0 auto;
padding: 0;
margin: 0.5em 0 0 0;
// filter: drop-shadow(0 0 0.30rem rgb(165, 165, 165));
}

View File

@ -1 +1,8 @@
<p>favoris-user works!</p>
<h2 class="titre ">Mes favoris :</h2>
<div class="separation"></div>
<div class="parent d-flex justify-content-center align-items-center">
<div class="card">
<h3>Mon top</h3>
</div>
</div>

View File

@ -0,0 +1,27 @@
.parent{
width: auto;
margin: 3em 10em 0 10em ;
}
.separation{
display: flex;
justify-content: flex-start;
border-bottom: 2px solid #CE0000;
max-width: 83%;
}
.titre{
display: flex;
justify-content: flex-start;
margin: 2.5em 0 0.5em 8.2em;
color: #CE0000;
}
.card{
width: 800px;
margin: 0;
padding: 0;
background-color: #CE0000;
}

View File

@ -17,14 +17,16 @@
aria-labelledby="panelsStayOpen-headingOne">
<div class="accordion-body">
<div class="distance p-3">
<span>Veuillez sélectionner la distance souhaitée</span>
<span>Veuillez sélectionner la distance souhaitée (En Km) </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>
<span>0</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
</div>
</div>
</div>
@ -109,28 +111,10 @@
</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>
</div>
<app-avis-bar (stateNumber)="onStateNumberChange($event)"></app-avis-bar>
</div>
</div>
</div>
<!---------------------------------------------------------------------------------------------------------------------------------------------------->
</div>
<button class="btn-search btn-primary" type="button" (click)="onSendFilters()" (click)="onSendRating()">LANCER LA
RECHERCHE</button>
<button class="btn-search btn-primary" type="button" (click)="onSendFilters()">LANCER LA
RECHERCHE</button>

View File

@ -1,4 +1,4 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ApiBackService } from 'src/app/services/api-back.service';
@ -9,101 +9,133 @@ import { ApiBackService } from 'src/app/services/api-back.service';
})
export class FiltersPageComponent implements OnInit {
public minDistance : any;
public maxDistance : any;
public minDistance: any;
public maxDistance: any;
public minPrice : any;
public maxPrice: any;
public selectPrice : number;
public selectDistance : any;
public selectPmr :any;
public selectSurPlace : any;
public selectEmporter : any;
@Output() stateNumber = new EventEmitter();
@Output() rangeNumber = new EventEmitter();
public minPrice: any;
public maxPrice: any;
public selectPrice: any;
public selectDistance: any;
public selectPmr: any;
public selectSurPlace: any;
public selectEmporter: any;
public selectRating: number;
public listRestau: any[];
constructor(private apiBackService : ApiBackService, private route : Router, private activatedRoute : ActivatedRoute) {
constructor(private apiBackService: ApiBackService, private route: Router, private activatedRoute: ActivatedRoute) {
this.minDistance = 0;
this.maxDistance = 4;
this.selectDistance = null;
this.maxDistance = 4000;
this.minPrice = 1;
this.maxPrice = 4;
this.selectPrice = 0;
this.selectPrice = null;
this.selectDistance = null;
this.selectPmr = false;
this.selectEmporter = false;
this.selectSurPlace = false;
this.selectRating = 0;
this.listRestau = [];
}
ngOnInit(): void {
this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => {
this.listRestau = restaurants;
});
this.apiBackService.getRestaurants().subscribe((restaurants: any[]) => {
this.listRestau = restaurants;
});
console.log(this.listRestau);
}
OnChangeValueDistance(valueDistance: any){
this.selectDistance = valueDistance.target.value;
}
OnChangeValuePrice(valuePrice: any){
this.selectPrice = valuePrice.target.value;
}
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);
}
OnChangeValueDistance(valueDistance: any) {
this.selectDistance = valueDistance.target.value;
}
onSendFilters() : void{
let restaus = this.listRestau;
OnChangeValuePrice(valuePrice: any) {
this.selectPrice = valuePrice.target.value;
}
restaus = restaus.filter((restau)=>
OnChangeValuePMR(valuePmr: any) {
this.selectPmr = (valuePmr.target.checked);
}
this.selectPrice == restau.prix
OnChangeValueSurPlace(valuePlace: any) {
this.selectSurPlace = valuePlace.target.checked;
}
),
console.log( this.activatedRoute.snapshot.routeConfig?.path);
OnChangeValueEmporter(valueEmporter: any) {
this.selectEmporter = valueEmporter.target.checked;
}
this.apiBackService.setListRestau(restaus, this.activatedRoute.snapshot.routeConfig?.path);
onSendFilters(): void {
let restaus = this.listRestau;
// ------------------------------------------------Filtre par Distance-------------------------------------------------------------------------
if (this.selectDistance != null) {
restaus = restaus.filter((restau) =>
this.selectDistance >= Math.round(
this.apiBackService.setDistance(
48.86201110271593 , //latitude Simplon
2.4361804827725417, //longitude Simplon
restau.latitude,
restau.longitude)
))
}
// ------------------------------------------------Filtre par Prix-------------------------------------------------------------------------
if (this.selectPrice != null) {
restaus = restaus.filter((restau) =>
this.selectPrice == restau.prix
)
}
// ------------------------------------------------Filtre par Acces PMR---------------------------------------------------------------------
if (this.selectPmr === true) {
restaus = restaus.filter((restau) =>
this.selectPmr === restau.accesPMR
)
}
// ------------------------------------------------Filtre par A emporter--------------------------------------------------------------------
if (this.selectEmporter === true) {
restaus = restaus.filter((restau) =>
this.selectEmporter === restau.aEmporter
)
}
// ------------------------------------------------Filtre par Sur Place----------------------------------------------------------------------
if (this.selectSurPlace === true) {
restaus = restaus.filter((restau) =>
this.selectSurPlace === restau.surPlace
)
}
// -------------------------------------------------------------------------------------------------------------------------------------------
console.log(this.activatedRoute.snapshot.routeConfig?.path);
console.log(restaus);
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']);
}
this.route.navigate(['restaurants']);
}
}

View File

@ -1,8 +1,2 @@
<h2 class="titre ">Catégories :</h2>
<div class="separation"></div>
<div class="parent d-flex justify-content-center align-items-center flex-wrap flex-row ">
<div *ngFor="let category of listCategories">
<app-card-category [categoryData]="category"></app-card-category>
</div>
</div>
<h1>Hello :D</h1>

View File

@ -1,20 +0,0 @@
.parent{
width: auto;
margin: 3em 10em 0 10em ;
}
.separation{
display: flex;
justify-content: flex-start;
border-bottom: 2px solid #CE0000;
max-width: 83%;
}
.titre{
display: flex;
justify-content: flex-start;
margin: 2.5em 0 0.5em 8.2em;
color: #CE0000;
}

View File

@ -8,19 +8,13 @@ import { ApiBackService } from 'src/app/services/api-back.service';
})
export class HomePageComponent implements OnInit {
listCategories : string[];
constructor(private apiBackService : ApiBackService) {
this.listCategories = [];
}
ngOnInit(): void {
this.apiBackService.getCategories().subscribe((listCategories: any[]) => {
// console.log(listCategories);
this.listCategories = listCategories;
});
}
onEventLike(isLiked : boolean) {

View File

@ -1 +1,7 @@
category-works!
<h2 class="titre ">Catégories :</h2>
<div class="separation"></div>
<div class="parent d-flex justify-content-center align-items-center flex-wrap flex-row ">
<div *ngFor="let category of listCategories">
<app-card-category [categoryData]="category"></app-card-category>
</div>
</div>

View File

@ -0,0 +1,20 @@
.parent{
width: auto;
margin: 3em 10em 0 10em ;
}
.separation{
display: flex;
justify-content: flex-start;
border-bottom: 2px solid #CE0000;
max-width: 83%;
}
.titre{
display: flex;
justify-content: flex-start;
margin: 2.5em 0 0.5em 8.2em;
color: #CE0000;
}

View File

@ -8,9 +8,18 @@ import { ApiBackService } from 'src/app/services/api-back.service';
styleUrls: ['./list-categories.component.scss']
})
export class ListCategoriesComponent implements OnInit {
listCategories : string[];
constructor(private apiBackService : ApiBackService) {
this.listCategories = [];
}
ngOnInit(): void {}
ngOnInit(): void {
this.apiBackService.getCategories().subscribe((listCategories: any[]) => {
// console.log(listCategories);
this.listCategories = listCategories;
});
}
}

View File

@ -5,6 +5,7 @@
justify-content: flex-start;
border-bottom: 2px solid #CE0000;
max-width: 83%;
padding-bottom: 3vh;
}
.titre{

View File

@ -20,7 +20,7 @@ export class RestoPageComponent implements OnInit {
if(this.apiBackService.routeParam === "filtres"){
this.listRestaurants = this.apiBackService.restoFilter;
}else if(this.apiBackService.routeParam === "home"){
}else if(this.apiBackService.routeParam === "categories"){
this.apiBackService.restoByCat.subscribe((restaurants: any[]) => {
this.listRestaurants = restaurants;
});

View File

@ -1,4 +1,4 @@
import { Injectable } from '@angular/core';
import { Injectable, Input } from '@angular/core';
import { Observable, of, Subject } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@ -12,6 +12,7 @@ export class ApiBackService {
restoLiked$ = new Subject<any>();
public restoFilter : any[];
public routeParam ?: string;
@Input() restaurant : any;
constructor(private httpClient: HttpClient) {
this.restoFilter = [];
@ -36,6 +37,27 @@ export class ApiBackService {
this.restoFilter = listRestau;
this.routeParam = routeParam;
}
}
setDistance(lat1 : number , lon1 : number, lat2 : number, lon2 : number){
let R = 6371; // Radius of the earth in km
let dLat = this.deg2rad(lat2-lat1); // deg2rad below
let dLon = this.deg2rad(lon2-lon1);
let a =
Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2)
;
let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
let d = R * c * 1000; // Distance in meters
return d;
}
deg2rad(deg : number) {
return deg * (Math.PI/180)
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB