Merge branch 'dev' into Romain
This commit is contained in:
commit
6c9aa254e8
@ -1,36 +1,33 @@
|
|||||||
<div class="signup-form text-center">
|
<div class="signup-form text-center">
|
||||||
<main class="form-signup">
|
<main class="form-signup">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||||
<h1>Enregistrer un restaurant</h1>
|
<h2>Enregistrer un restaurant</h2>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text" class="form-control" id="floatingInputNom" placeholder="" name="nom"
|
||||||
class="form-control"
|
formControlName="nomFc"
|
||||||
id="floatingInputNom"
|
[ngClass]="{'is-valid' : signupForm.controls['nomFc'].touched && signupForm.controls['nomFc'].valid,
|
||||||
placeholder=""
|
|
||||||
name="nom"
|
|
||||||
formControlName="nomFc"
|
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['nomFc'].touched && signupForm.controls['nomFc'].valid,
|
|
||||||
'is-invalid': signupForm.controls['nomFc'].touched && !signupForm.controls['nomFc'].valid}">
|
'is-invalid': signupForm.controls['nomFc'].touched && !signupForm.controls['nomFc'].valid}">
|
||||||
<label for="floatingInputNom">Nom **</label>
|
<label for="floatingInputNom">Nom **</label>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class="form-floating">
|
||||||
|
<select type="number" class="form-control" id="floatingInputCategories" placeholder="" name="categories"
|
||||||
|
formControlName="typerestausFc">
|
||||||
|
<option value=null></option>
|
||||||
|
<option *ngFor="let category of listCategories" value={{category.id}}>{{category.libelle}}</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<label for="floatingInputlastName">Categorie</label>
|
||||||
|
</div> -->
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text" class="form-control" id="floatingInputAdresse" placeholder="" name="adresse"
|
||||||
class="form-control"
|
formControlName="adresseFc"
|
||||||
id="floatingInputAdresse"
|
[ngClass]="{'is-valid' : signupForm.controls['adresseFc'].touched && signupForm.controls['adresseFc'].valid,
|
||||||
placeholder=""
|
|
||||||
name="adresse"
|
|
||||||
formControlName="adresseFc"
|
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['adresseFc'].touched && signupForm.controls['adresseFc'].valid,
|
|
||||||
'is-invalid': signupForm.controls['adresseFc'].touched && !signupForm.controls['adresseFc'].valid}">
|
'is-invalid': signupForm.controls['adresseFc'].touched && !signupForm.controls['adresseFc'].valid}">
|
||||||
<label for="floatingInputAdresse">Adresse **</label>
|
<label for="floatingInputAdresse">Adresse **</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<select type="number"
|
<select type="number" class="form-control" id="floatingInputPrice" placeholder="" name="prix"
|
||||||
class="form-control"
|
formControlName="prixFc">
|
||||||
id="floatingInputPrice"
|
|
||||||
placeholder=""
|
|
||||||
name="prix"
|
|
||||||
formControlName="prixFc">
|
|
||||||
<option value=1>€ 1€ à 10€</option>
|
<option value=1>€ 1€ à 10€</option>
|
||||||
<option value=2>€€ 11€ à 20€</option>
|
<option value=2>€€ 11€ à 20€</option>
|
||||||
<option value=3>€€€ 21€ à 30€</option>
|
<option value=3>€€€ 21€ à 30€</option>
|
||||||
@ -39,44 +36,28 @@
|
|||||||
<label for="floatingInputlastName">Prix</label>
|
<label for="floatingInputlastName">Prix</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text" class="form-control" id="floatingInputLat" placeholder="" name="latitude"
|
||||||
class="form-control"
|
formControlName="latitudeFc"
|
||||||
id="floatingInputLat"
|
[ngClass]="{'is-valid' : signupForm.controls['latitudeFc'].touched && signupForm.controls['latitudeFc'].valid,
|
||||||
placeholder=""
|
|
||||||
name="latitude"
|
|
||||||
formControlName="latitudeFc"
|
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['latitudeFc'].touched && signupForm.controls['latitudeFc'].valid,
|
|
||||||
'is-invalid': signupForm.controls['latitudeFc'].touched && !signupForm.controls['latitudeFc'].valid}">
|
'is-invalid': signupForm.controls['latitudeFc'].touched && !signupForm.controls['latitudeFc'].valid}">
|
||||||
<label for="floatingInputLat">Latitude **</label>
|
<label for="floatingInputLat">Latitude **</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text" class="form-control" id="floatingInputLong" placeholder="" name="longitude"
|
||||||
class="form-control"
|
formControlName="longitudeFc"
|
||||||
id="floatingInputLong"
|
[ngClass]="{'is-valid' : signupForm.controls['longitudeFc'].touched && signupForm.controls['longitudeFc'].valid,
|
||||||
placeholder=""
|
|
||||||
name="longitude"
|
|
||||||
formControlName="longitudeFc"
|
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['longitudeFc'].touched && signupForm.controls['longitudeFc'].valid,
|
|
||||||
'is-invalid': signupForm.controls['longitudeFc'].touched && !signupForm.controls['longitudeFc'].valid}">
|
'is-invalid': signupForm.controls['longitudeFc'].touched && !signupForm.controls['longitudeFc'].valid}">
|
||||||
<label for="floatingInputLong">Longitude **</label>
|
<label for="floatingInputLong">Longitude **</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text" class="form-control" id="floatingInputTel" placeholder="" name="telephone"
|
||||||
class="form-control"
|
formControlName="telephoneFc">
|
||||||
id="floatingInputTel"
|
|
||||||
placeholder=""
|
|
||||||
name="telephone"
|
|
||||||
formControlName="telephoneFc">
|
|
||||||
<label for="floatingInputTel">Téléphone</label>
|
<label for="floatingInputTel">Téléphone</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text" class="form-control" id="floatingInputWebsite" placeholder="" name="website"
|
||||||
class="form-control"
|
formControlName="websiteFc"
|
||||||
id="floatingInputWebsite"
|
[ngClass]="{'is-valid' : signupForm.controls['websiteFc'].touched && signupForm.controls['websiteFc'].valid,
|
||||||
placeholder=""
|
|
||||||
name="website"
|
|
||||||
formControlName="websiteFc"
|
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['websiteFc'].touched && signupForm.controls['websiteFc'].valid,
|
|
||||||
'is-invalid': signupForm.controls['websiteFc'].touched && !signupForm.controls['websiteFc'].valid}">
|
'is-invalid': signupForm.controls['websiteFc'].touched && !signupForm.controls['websiteFc'].valid}">
|
||||||
<label for="floatingInputWebsite">Site Web</label>
|
<label for="floatingInputWebsite">Site Web</label>
|
||||||
</div>
|
</div>
|
||||||
@ -84,67 +65,37 @@
|
|||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<p class="text-left"> Sur Place :</p>
|
<p class="text-left"> Sur Place :</p>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxSurPlaceTrue" name="surPlaceFc" value=true
|
||||||
type="radio"
|
formControlName="surPlaceFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxSurPlaceTrue"
|
|
||||||
name="surPlaceFc"
|
|
||||||
value=true
|
|
||||||
formControlName="surPlaceFc">
|
|
||||||
<label class="form-check-label" for="checkboxSurPlaceTrue">Oui</label>
|
<label class="form-check-label" for="checkboxSurPlaceTrue">Oui</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxSurPlaceFalse" name="surPlaceFc"
|
||||||
type="radio"
|
value=false formControlName="surPlaceFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxSurPlaceFalse"
|
|
||||||
name="surPlaceFc"
|
|
||||||
value=false
|
|
||||||
formControlName="surPlaceFc">
|
|
||||||
<label class="form-check-label" for="checkboxSurPlaceFalse">Non</label>
|
<label class="form-check-label" for="checkboxSurPlaceFalse">Non</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxSurPlaceNull" name="surPlaceFc" value=null
|
||||||
type="radio"
|
formControlName="surPlaceFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxSurPlaceNull"
|
|
||||||
name="surPlaceFc"
|
|
||||||
value=null
|
|
||||||
formControlName="surPlaceFc">
|
|
||||||
<label class="form-check-label" for="checkboxSurPlaceNull">Pas d'infos</label>
|
<label class="form-check-label" for="checkboxSurPlaceNull">Pas d'infos</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<p class="text-left"> A Emporter :</p>
|
<p class="text-left"> A Emporter :</p>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxAEmporterTrue" name="aEmporterFc"
|
||||||
type="radio"
|
value=true formControlName="aEmporterFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxAEmporterTrue"
|
|
||||||
name="aEmporterFc"
|
|
||||||
value=true
|
|
||||||
formControlName="aEmporterFc">
|
|
||||||
<label class="form-check-label" for="checkboxAEmporterTrue">Oui</label>
|
<label class="form-check-label" for="checkboxAEmporterTrue">Oui</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxAEmporterFalse" name="aEmporterFc"
|
||||||
type="radio"
|
value=false formControlName="aEmporterFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxAEmporterFalse"
|
|
||||||
name="aEmporterFc"
|
|
||||||
value=false
|
|
||||||
formControlName="aEmporterFc">
|
|
||||||
<label class="form-check-label" for="checkboxAEmporterFalse">Non</label>
|
<label class="form-check-label" for="checkboxAEmporterFalse">Non</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxAEmporterNull" name="aEmporterFc"
|
||||||
type="radio"
|
value=null formControlName="aEmporterFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxAEmporterNull"
|
|
||||||
name="aEmporterFc"
|
|
||||||
value=null
|
|
||||||
formControlName="aEmporterFc">
|
|
||||||
<label class="form-check-label" for="checkboxAEmporterNull">Pas d'infos</label>
|
<label class="form-check-label" for="checkboxAEmporterNull">Pas d'infos</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -152,43 +103,27 @@
|
|||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<p class="text-left"> Accès PMR :</p>
|
<p class="text-left"> Accès PMR :</p>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxAccesPMRTrue" name="accesPMRFc" value=true
|
||||||
type="radio"
|
formControlName="accesPMRFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxAccesPMRTrue"
|
|
||||||
name="accesPMRFc"
|
|
||||||
value=true
|
|
||||||
formControlName="accesPMRFc">
|
|
||||||
<label class="form-check-label" for="checkboxAccesPMRTrue">Oui</label>
|
<label class="form-check-label" for="checkboxAccesPMRTrue">Oui</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxAccesPMRFalse" name="accesPMRFc"
|
||||||
type="radio"
|
value=false formControlName="accesPMRFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxAccesPMRFalse"
|
|
||||||
name="accesPMRFc"
|
|
||||||
value=false
|
|
||||||
formControlName="accesPMRFc">
|
|
||||||
<label class="form-check-label" for="checkboxAccesPMRFalse">Non</label>
|
<label class="form-check-label" for="checkboxAccesPMRFalse">Non</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input
|
<input type="radio" class="form-check-input" id="checkboxAccesPMRNull" name="accesPMRFc" value=null
|
||||||
type="radio"
|
formControlName="accesPMRFc">
|
||||||
class="form-check-input"
|
|
||||||
id="checkboxAccesPMRNull"
|
|
||||||
name="accesPMRFc"
|
|
||||||
value=null
|
|
||||||
formControlName="accesPMRFc">
|
|
||||||
<label class="form-check-label" for="checkboxAccesPMRNull">Pas d'infos</label>
|
<label class="form-check-label" for="checkboxAccesPMRNull">Pas d'infos</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="errorMessage" class="alert alert-danger">
|
<div *ngIf="errorMessage" class="alert alert-danger">
|
||||||
<p class="alert-link">{{errorMessage}}</p>
|
<p class="alert-link">{{errorMessage}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="w-100 btn btn-lg btn-success"
|
<button class="w-100 btn btn-lg btn-success" type="submit">Enregistrer</button>
|
||||||
type="submit">Enregistrer</button>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
import { Restaurant } from 'src/app/pages/models/restaurant';
|
import { Restaurant } from 'src/app/pages/models/restaurant';
|
||||||
import { ApiBackService } from 'src/app/services/api-back.service';
|
import { ApiBackService } from 'src/app/services/api-back.service';
|
||||||
|
|
||||||
@ -15,12 +16,18 @@ export class AddRestauComponent implements OnInit {
|
|||||||
|
|
||||||
public signupForm: FormGroup;
|
public signupForm: FormGroup;
|
||||||
public errorMessage ?: string;
|
public errorMessage ?: string;
|
||||||
|
public listCategories : any[];
|
||||||
|
public expanded = false;
|
||||||
|
|
||||||
constructor( private router: Router, private apiBackService : ApiBackService) {
|
constructor( private router: Router, private apiBackService : ApiBackService) {
|
||||||
this.signupForm = new FormGroup({});
|
this.signupForm = new FormGroup({});
|
||||||
|
this.listCategories = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
this.getCategories();
|
||||||
|
|
||||||
this.signupForm = new FormGroup({
|
this.signupForm = new FormGroup({
|
||||||
nomFc : new FormControl('', [Validators.required]),
|
nomFc : new FormControl('', [Validators.required]),
|
||||||
prixFc : new FormControl(''),
|
prixFc : new FormControl(''),
|
||||||
@ -31,10 +38,21 @@ export class AddRestauComponent implements OnInit {
|
|||||||
websiteFc : new FormControl('',[Validators.pattern("/^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/")]),
|
websiteFc : new FormControl('',[Validators.pattern("/^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/")]),
|
||||||
surPlaceFc : new FormControl(''),
|
surPlaceFc : new FormControl(''),
|
||||||
aEmporterFc : new FormControl(''),
|
aEmporterFc : new FormControl(''),
|
||||||
accesPMRFc : new FormControl('')
|
accesPMRFc : new FormControl(''),
|
||||||
|
// typerestausFc : new FormControl('')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getCategories() : void{
|
||||||
|
this.apiBackService.getCategories().subscribe((listCategories: any[]) => {
|
||||||
|
// console.log(listCategories);
|
||||||
|
|
||||||
|
this.listCategories = listCategories;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public onSubmit(): void {
|
public onSubmit(): void {
|
||||||
console.log("value : ", this.signupForm.value);
|
console.log("value : ", this.signupForm.value);
|
||||||
console.log("form : ", this.signupForm);
|
console.log("form : ", this.signupForm);
|
||||||
@ -48,6 +66,7 @@ export class AddRestauComponent implements OnInit {
|
|||||||
const surPlaceFc = this.signupForm.value['surPlaceFc'];
|
const surPlaceFc = this.signupForm.value['surPlaceFc'];
|
||||||
const aEmporterFc = this.signupForm.value['aEmporterFc'];
|
const aEmporterFc = this.signupForm.value['aEmporterFc'];
|
||||||
const accesPMRFc = this.signupForm.value['accesPMRFc'];
|
const accesPMRFc = this.signupForm.value['accesPMRFc'];
|
||||||
|
// const typerestausFc = this.signupForm.value['typerestausFc'];
|
||||||
|
|
||||||
const restaurant: Restaurant = {
|
const restaurant: Restaurant = {
|
||||||
latitude: latitudeFc,
|
latitude: latitudeFc,
|
||||||
@ -59,8 +78,10 @@ export class AddRestauComponent implements OnInit {
|
|||||||
website : websiteFc,
|
website : websiteFc,
|
||||||
surPlace : surPlaceFc,
|
surPlace : surPlaceFc,
|
||||||
aEmporter : aEmporterFc,
|
aEmporter : aEmporterFc,
|
||||||
accesPMR : accesPMRFc
|
accesPMR : accesPMRFc,
|
||||||
|
// typerestaus : typerestausFc
|
||||||
}
|
}
|
||||||
|
|
||||||
if( restaurant.latitude !== '' &&
|
if( restaurant.latitude !== '' &&
|
||||||
restaurant.longitude !== '' &&
|
restaurant.longitude !== '' &&
|
||||||
restaurant.nom !== '' &&
|
restaurant.nom !== '' &&
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
<h2>Modifier/Supprimer un restaurant</h2>
|
||||||
|
<app-search-bar (resultSearch)="saveRestauList($event)"></app-search-bar>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item d-flex justify-content-between" *ngFor="let restau of restauList" >
|
||||||
|
<div>
|
||||||
|
{{restau.nom}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button class="btn btn-danger" type="button" (click)="deleteRestau(restau.id)"><i class="bi bi-trash"></i></button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UpdateDelRestauComponent } from './update-del-restau.component';
|
||||||
|
|
||||||
|
describe('UpdateDelRestauComponent', () => {
|
||||||
|
let component: UpdateDelRestauComponent;
|
||||||
|
let fixture: ComponentFixture<UpdateDelRestauComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ UpdateDelRestauComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(UpdateDelRestauComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,38 @@
|
|||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { Restaurant } from 'src/app/pages/models/restaurant';
|
||||||
|
import { ApiBackService } from 'src/app/services/api-back.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-update-del-restau',
|
||||||
|
templateUrl: './update-del-restau.component.html',
|
||||||
|
styleUrls: ['./update-del-restau.component.scss']
|
||||||
|
})
|
||||||
|
export class UpdateDelRestauComponent implements OnInit {
|
||||||
|
|
||||||
|
restauList : Restaurant[];
|
||||||
|
|
||||||
|
constructor(private apiBackService : ApiBackService) {
|
||||||
|
this.restauList = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
saveRestauList(event : any){
|
||||||
|
console.log(event);
|
||||||
|
this.restauList = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteRestau(idRestau : number | undefined){
|
||||||
|
this.apiBackService.deleteRestau(idRestau).subscribe(
|
||||||
|
resp =>{
|
||||||
|
|
||||||
|
|
||||||
|
this.restauList = this.restauList.filter(restaus => restaus.id != idRestau)
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
<!-- <app-header-logo *ngIf="dontShow"></app-header-logo>
|
||||||
|
<app-nav-bar *ngIf="dontShow"></app-nav-bar> -->
|
||||||
<app-search-bar *ngIf="router.url != '/signin'"></app-search-bar>
|
<app-search-bar *ngIf="router.url != '/signin'"></app-search-bar>
|
||||||
<app-nav-bar *ngIf="router.url != '/signin'"></app-nav-bar>
|
<app-nav-bar *ngIf="router.url != '/signin'"></app-nav-bar>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
|
@ -20,6 +20,8 @@ import { IconComponent } from './filters/icon/icon.component';
|
|||||||
import { TemplatePageComponent } from './components/template-page/template-page.component';
|
import { TemplatePageComponent } from './components/template-page/template-page.component';
|
||||||
import { AdminPageComponent } from './pages/admin-page/admin-page.component';
|
import { AdminPageComponent } from './pages/admin-page/admin-page.component';
|
||||||
import { AddRestauComponent } from './admin-component/add-restau/add-restau.component';
|
import { AddRestauComponent } from './admin-component/add-restau/add-restau.component';
|
||||||
|
import { UpdateDelRestauComponent } from './admin-component/update-del-restau/update-del-restau.component';
|
||||||
|
import { HeaderLogoComponent } from './header/components/header-logo/header-logo.component';
|
||||||
import { AuthInterceptor } from './services/auth.interceptor';
|
import { AuthInterceptor } from './services/auth.interceptor';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -40,7 +42,9 @@ import { AuthInterceptor } from './services/auth.interceptor';
|
|||||||
SigninComponent,
|
SigninComponent,
|
||||||
TemplatePageComponent,
|
TemplatePageComponent,
|
||||||
AdminPageComponent,
|
AdminPageComponent,
|
||||||
AddRestauComponent
|
AddRestauComponent,
|
||||||
|
UpdateDelRestauComponent,
|
||||||
|
HeaderLogoComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
<nav class="navbar navbar-light p-0">
|
||||||
|
<div class="container-fluid d-flex align-items-center pt-3">
|
||||||
|
<div class="logo ps-4">
|
||||||
|
<img src="assets/images-header/LOGO2.png" alt="logo">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<app-search-bar></app-search-bar>
|
||||||
|
|
||||||
|
<div class="trait">
|
||||||
|
<p>LE BON PLAN POUR MANGER</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
@ -0,0 +1,29 @@
|
|||||||
|
.container-fluid
|
||||||
|
{
|
||||||
|
padding-top: 2%;
|
||||||
|
width : 100%;
|
||||||
|
margin: auto;
|
||||||
|
padding-bottom: 0,5%;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
max-height: 20%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.trait{
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
border-bottom: 2px solid #CE0000;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
p{
|
||||||
|
background-color: white;
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
left: 68px;
|
||||||
|
padding : 0 10px 0 10px;
|
||||||
|
color: grey;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { HeaderLogoComponent } from './header-logo.component';
|
||||||
|
|
||||||
|
describe('HeaderLogoComponent', () => {
|
||||||
|
let component: HeaderLogoComponent;
|
||||||
|
let fixture: ComponentFixture<HeaderLogoComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ HeaderLogoComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(HeaderLogoComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-header-logo',
|
||||||
|
templateUrl: './header-logo.component.html',
|
||||||
|
styleUrls: ['./header-logo.component.scss']
|
||||||
|
})
|
||||||
|
export class HeaderLogoComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,14 +1,5 @@
|
|||||||
<nav class="navbar navbar-light p-0">
|
<form class="d-flex align-items-center pe-2 pt-2">
|
||||||
<div class="container-fluid d-flex align-items-center pt-3">
|
<input class="form-control me-5 position-relative" type="search" #newItem placeholder="Trouver votre SIMPL'EAT..."
|
||||||
<div class="logo ps-4">
|
aria-label="Search">
|
||||||
<img src="assets/images-header/LOGO2.png" alt="logo">
|
<button (click)="onChangeInput(newItem.value)">Recherche</button>
|
||||||
</div>
|
</form>
|
||||||
<form style="width: 30%;" class="d-flex align-items-center pe-2 pt-2">
|
|
||||||
<input class="form-control me-5 position-relative" type="search" #newItem placeholder="Trouver votre SIMPL'EAT..." aria-label="Search">
|
|
||||||
<button (click) = "onChangeInput(newItem.value)">Recherche</button>
|
|
||||||
</form>
|
|
||||||
<div class="trait">
|
|
||||||
<p>LE BON PLAN POUR MANGER</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
@ -1,35 +1,3 @@
|
|||||||
.container-fluid
|
|
||||||
{
|
|
||||||
padding-top: 2%;
|
|
||||||
width : 100%;
|
|
||||||
margin: auto;
|
|
||||||
padding-bottom: 0,5%;
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
max-height: 20%;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.trait{
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
height: 30px;
|
|
||||||
border-bottom: 2px solid #CE0000;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
p{
|
|
||||||
background-color: white;
|
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
left: 68px;
|
|
||||||
padding : 0 10px 0 10px;
|
|
||||||
color: grey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
input[type="search"], textarea{
|
input[type="search"], textarea{
|
||||||
background-color: #edf5f1;
|
background-color: #edf5f1;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { Restaurant } from 'src/app/pages/models/restaurant';
|
||||||
import { RestoPageComponent } from 'src/app/pages/resto-page/resto-page.component';
|
import { RestoPageComponent } from 'src/app/pages/resto-page/resto-page.component';
|
||||||
import { ApiBackService } from 'src/app/services/api-back.service';
|
import { ApiBackService } from 'src/app/services/api-back.service';
|
||||||
|
|
||||||
@ -10,11 +11,17 @@ import { ApiBackService } from 'src/app/services/api-back.service';
|
|||||||
})
|
})
|
||||||
export class SearchBarComponent implements OnInit {
|
export class SearchBarComponent implements OnInit {
|
||||||
|
|
||||||
searchText = new EventEmitter();
|
|
||||||
listRestau: any[];
|
listRestau: any[];
|
||||||
restauByName: any[];
|
restauByName: any[];
|
||||||
|
@Output() resultSearch = new EventEmitter<Restaurant[]>();
|
||||||
|
|
||||||
constructor(private apiBackService: ApiBackService, public route: Router) {
|
|
||||||
|
|
||||||
|
constructor(private apiBackService: ApiBackService,
|
||||||
|
private route: Router,
|
||||||
|
private activatedRoute : ActivatedRoute) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.listRestau = [];
|
this.listRestau = [];
|
||||||
this.restauByName = [];
|
this.restauByName = [];
|
||||||
@ -33,12 +40,19 @@ export class SearchBarComponent implements OnInit {
|
|||||||
|
|
||||||
this.restauByName = this.restauByName.filter((restau: any) =>
|
this.restauByName = this.restauByName.filter((restau: any) =>
|
||||||
restau.nom.toLowerCase().includes(search.toLowerCase()));
|
restau.nom.toLowerCase().includes(search.toLowerCase()));
|
||||||
console.log(this.restauByName);
|
|
||||||
|
// Composant search-bar utilisé dans la page admin
|
||||||
|
if(this.activatedRoute.snapshot.routeConfig?.path === "admin"){
|
||||||
|
|
||||||
|
this.resultSearch.emit(this.restauByName);
|
||||||
|
|
||||||
|
}else{ // la search bar utilisée dans la nav-bar pour trouver un restau
|
||||||
|
|
||||||
this.apiBackService.setListRestau(this.restauByName, "filtres");
|
this.apiBackService.setListRestau(this.restauByName, "filtres");
|
||||||
//this.route.routeReuseStrategy.shouldReuseRoute= () => false;
|
//this.route.routeReuseStrategy.shouldReuseRoute= () => false;
|
||||||
//this.route.onSameUrlNavigation = 'reload';
|
// this.route.onSameUrlNavigation = 'reload';
|
||||||
this.route.navigate(['restaurants']);
|
this.route.navigate(['restaurants']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1,9 @@
|
|||||||
<app-add-restau></app-add-restau>
|
<div class="container">
|
||||||
|
<div class="d-flex flex-row justify-content-around"><div>
|
||||||
|
<app-add-restau></app-add-restau>
|
||||||
|
</div>
|
||||||
|
<div class="search-bar">
|
||||||
|
<app-update-del-restau></app-update-del-restau>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,3 @@
|
|||||||
|
.search-bar{
|
||||||
|
width : 30%;
|
||||||
|
}
|
@ -15,11 +15,22 @@ export class FavorisUserComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private apiBackService : ApiBackService,private tokenService : TokenService) {
|
constructor(private apiBackService : ApiBackService,private tokenService : TokenService) {
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
constructor(private apiBackService : ApiBackService,private tokenService : TokenService) {
|
||||||
|
>>>>>>> dev
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
this.personneConnectee = this.apiBackService.getPersonneById(this.tokenService.getCurrentUserId());
|
|
||||||
|
this.apiBackService.getPersonneById(this.tokenService.getCurrentUserId()).subscribe(
|
||||||
|
resp =>{
|
||||||
|
console.log(resp);
|
||||||
|
|
||||||
|
this.personneConnectee = resp;
|
||||||
|
}
|
||||||
|
);
|
||||||
console.log(this.personneConnectee);
|
console.log(this.personneConnectee);
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,4 +10,5 @@ export interface Restaurant {
|
|||||||
aEmporter?: boolean;
|
aEmporter?: boolean;
|
||||||
accesPMR?: boolean;
|
accesPMR?: boolean;
|
||||||
surPlace?: boolean;
|
surPlace?: boolean;
|
||||||
|
typerestaus ?: any[];
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,14 @@ import { Restaurant } from '../pages/models/restaurant';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ApiBackService {
|
export class ApiBackService {
|
||||||
|
|
||||||
public restoByCat : Observable<any[]> = of([]);
|
|
||||||
restoLiked$ = new Subject<any>();
|
|
||||||
public restoFilter : any[];
|
|
||||||
public routeParam ?: string;
|
|
||||||
@Input() restaurant : any;
|
|
||||||
|
|
||||||
constructor(private httpClient: HttpClient) {
|
public restoByCat: Observable<any[]> = of([]);
|
||||||
|
restoLiked$ = new Subject<any>();
|
||||||
|
public restoFilter: any[];
|
||||||
|
public routeParam?: string;
|
||||||
|
@Input() restaurant: any;
|
||||||
|
|
||||||
|
constructor(private httpClient: HttpClient) {
|
||||||
this.restoFilter = [];
|
this.restoFilter = [];
|
||||||
this.routeParam = "";
|
this.routeParam = "";
|
||||||
}
|
}
|
||||||
@ -24,50 +24,53 @@ export class ApiBackService {
|
|||||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/restaurants`);
|
return this.httpClient.get<any[]>(`${environment.apiUrl}/restaurants`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRestaurantsByCateg(id : number, routeParam ?: string ): void {
|
getRestaurantsByCateg(id: number, routeParam?: string): void {
|
||||||
this.restoByCat = this.httpClient.get<any[]>(`${environment.apiUrl}/restaurantbytype/${id}`);
|
this.restoByCat = this.httpClient.get<any[]>(`${environment.apiUrl}/restaurantbytype/${id}`);
|
||||||
this.routeParam = routeParam;
|
this.routeParam = routeParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCategories(): Observable<any[]>{
|
getCategories(): Observable<any[]> {
|
||||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/types`);
|
return this.httpClient.get<any[]>(`${environment.apiUrl}/types`);
|
||||||
}
|
}
|
||||||
|
|
||||||
setListRestau(listRestau : any[], routeParam ?: string ) : void{
|
setListRestau(listRestau: any[], routeParam?: string): void {
|
||||||
|
|
||||||
this.restoFilter = listRestau;
|
this.restoFilter = listRestau;
|
||||||
this.routeParam = routeParam;
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
addRestaurant( newRestau : Restaurant) : Observable<any>{
|
|
||||||
return this.httpClient.post<any[]>(`${environment.apiUrl}/add-restaurant`, newRestau);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPersonneById(id : number | null){
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
addRestaurant(newRestau: Restaurant): Observable<any> {
|
||||||
|
return this.httpClient.post<any[]>(`${environment.apiUrl}/add-restaurant`, newRestau);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteRestau(idRestau: number | undefined): Observable<any> {
|
||||||
|
|
||||||
|
return this.httpClient.delete<Restaurant>(`${environment.apiUrl}/delete-restaurant/${idRestau}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getPersonneById(id: any) {
|
||||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/user/${id}`);
|
return this.httpClient.get<any[]>(`${environment.apiUrl}/user/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user