Merge branch 'dev' into Romain

This commit is contained in:
Romain Verger 2022-02-16 14:19:22 +01:00
commit a97d444fe1
6 changed files with 44 additions and 21 deletions

View File

@ -1,7 +1,11 @@
<div class="container position-relative shadow p-0 mb-5 bg-body rounded rounded m-5 rounded-top " <div class="container position-relative shadow p-0 mb-5 bg-body rounded rounded m-5 rounded-top "
style="width: 19rem;"> style="width: 21rem;">
<img class="card-img-top " src="assets/ImagesRestos/photo.jpg" alt="Card image cap"> <img class="card-img-top " src="assets/ImagesRestos/photo.jpg" alt="Card image cap">
<div class="rond position-absolute"><i class="heart far fa-heart"></i></div> <div class="rond position-absolute">
<app-icon class="heart"
[iconName]="isLiked ? 'heart-fill' : 'heart'"
[iconColor]="'#e35d6a'"
(click)="onClickLike()"></app-icon></div>
<div class="card-body rounded-bottom"> <div class="card-body rounded-bottom">
<h3 class="titre-resto d-flex justify-content-center d-flex align-items-center" style="font-size: 24px;"> <h3 class="titre-resto d-flex justify-content-center d-flex align-items-center" style="font-size: 24px;">
{{restaurant.nom }}</h3> {{restaurant.nom }}</h3>
@ -26,6 +30,7 @@
</ul> </ul>
<span class="ps-3 mt-3 " style="font-size: 1.1em; color:#545454">5/5</span> <span class="ps-3 mt-3 " style="font-size: 1.1em; color:#545454">5/5</span>
</div> </div>
<div class="infos ps-1 pt-2" style="color:#545454"> <div class="infos ps-1 pt-2" style="color:#545454">
<div> <div>
<span class="categorie pe-4" style="font-style: italic;" *ngFor="let categorie of restaurant.typerestaus">{{ categorie.libelle }}</span> <span class="categorie pe-4" style="font-style: italic;" *ngFor="let categorie of restaurant.typerestaus">{{ categorie.libelle }}</span>
@ -57,14 +62,14 @@
<div class="trait-rouge pt-2 pb-0"></div> <div class="trait-rouge pt-2 pb-0"></div>
<div class="critere ps-1 pt-3"> <div class="critere ps-1 pt-3">
<span class="sur-place pe-1" style="color:#545454">Sur place :</span> <span class="sur-place pe-3" style="color:#545454">Sur place :</span>
<app-icon <app-icon
[iconName]="restaurant.surPlace ? 'fas fa-check-square' : 'fas fa-times-circle ps-1 pt-1'" [iconName]="restaurant.surPlace ? 'bi bi-check-square-fill' : 'bi bi-x-square-fill ps-2 pt-1 '"
[iconColor]="restaurant.surPlace ? '#4ECB71' : '#ED2F2F'" [iconColor]="restaurant.surPlace ? '#4ECB71' : '#ED2F2F'"
></app-icon> ></app-icon>
<span class="a-emporter ps-3 pe-1" style="color:#545454">A emporter :</span> <span class="a-emporter pe-2 ps-4 " style="color:#545454">A emporter :</span>
<app-icon <app-icon
[iconName]="restaurant.emporter ? 'fas fa-check-square' : 'fas fa-times-circle ps-1 pt-1'" [iconName]="restaurant.emporter ? 'bi bi-check-square-fill' : 'bi bi-x-square-fill ps-2 pt-1'"
[iconColor]="restaurant.emporter ? '#4ECB71' : '#ED2F2F'" [iconColor]="restaurant.emporter ? '#4ECB71' : '#ED2F2F'"
></app-icon> ></app-icon>
</div> </div>
@ -72,7 +77,7 @@
<div class="critere d-flex justify-content-center ps-1 pt-3 pb-3"> <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> <span class="acces-pmr pe-1" style="color:#545454">Accès PMR :</span>
<app-icon <app-icon
[iconName]="restaurant.accesPMR ? 'fas fa-check-square' : 'fas fa-times-circle ps-1 pt-1'" [iconName]="restaurant.accesPMR ? 'bi bi-check-square-fill' : 'bi bi-x-square-fill ps-1 pt-1'"
[iconColor]="restaurant.accesPMR ? '#4ECB71' : '#ED2F2F'" [iconColor]="restaurant.accesPMR ? '#4ECB71' : '#ED2F2F'"
></app-icon> ></app-icon>
</div> </div>

View File

@ -1,17 +1,22 @@
.rond{ .rond{
padding: 0.7em; padding: 1em;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
top: 1em; top: 1em;
right: 1em; right: 1em;
border-radius: 50%; border-radius: 50%;
} width: 50px;
height: 50px;
}
.heart{ .heart{
display: flex; position: absolute;
font-size: 1.6em; top: 7px;
padding: 0; left: 13px;
margin:0; font-size: 1.5em;
color: #FF2048; transform: rotate(5deg);
} }
.titre-resto{ .titre-resto{
@ -37,10 +42,10 @@
} }
.ps-5 { .ps-5 {
padding-left: 5.4rem !important; padding-left: 6.4rem !important;
} }
.pe-5 { .pe-5 {
padding-right: 5rem !important; padding-right: 6rem !important;
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component,EventEmitter, Input, Output, OnInit } from '@angular/core';
@Component({ @Component({
selector: 'app-card-resto', selector: 'app-card-resto',
@ -9,6 +9,9 @@ export class CardRestoComponent implements OnInit {
@Input() restaurant : any ; @Input() restaurant : any ;
distance : number; distance : number;
@Input() likeResto: any;
@Output() clickLike = new EventEmitter<boolean>();
isLiked : boolean = false;
constructor() { constructor() {
this.distance = 0 ; this.distance = 0 ;
@ -30,6 +33,11 @@ export class CardRestoComponent implements OnInit {
} }
onClickLike() {
console.log('click');
this.isLiked = !this.isLiked;
this.clickLike.emit(this.isLiked);
}
getDistanceFromLatLonInKm(lat1 : number , lon1 : number, lat2 : number, lon2 : number) { getDistanceFromLatLonInKm(lat1 : number , lon1 : number, lat2 : number, lon2 : number) {
let R = 6371; // Radius of the earth in km let R = 6371; // Radius of the earth in km

View File

@ -1,3 +1,4 @@
<i class="{{iconName}}" <i class="bi-{{iconName}}"
[ngStyle]="{'font-size.rem': iconSize, 'color': iconColor}"></i> [ngStyle]="{'font-size.rem': iconSize, 'color': iconColor}"></i>

View File

@ -16,12 +16,15 @@ export class HomePageComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.apiBackService.getCategories().subscribe((listCategories: any[]) => { this.apiBackService.getCategories().subscribe((listCategories: any[]) => {
console.log(listCategories); // console.log(listCategories);
this.listCategories = listCategories; this.listCategories = listCategories;
}); });
} }
onEventLike(isLiked : boolean) {
this.apiBackService.restoLiked$.next(isLiked);
}
} }

View File

@ -9,6 +9,7 @@ import { environment } from 'src/environments/environment';
export class ApiBackService { export class ApiBackService {
public restoByCat : Observable<any[]> = of([]); public restoByCat : Observable<any[]> = of([]);
restoLiked$ = new Subject<any>();
public restoFilter : any[]; public restoFilter : any[];
public routeParam ?: string; public routeParam ?: string;