Skip to content

Commit 4c9b323

Browse files
author
*rkeita31*
committed
Recherche avancée
1 parent de5c356 commit 4c9b323

File tree

7 files changed

+151
-18
lines changed

7 files changed

+151
-18
lines changed

src/app/components/login/login.component.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,32 @@
1717
}
1818

1919
.form-group {
20-
20+
position: relative;
2121
background-color: none;
2222
margin-top: 5%;
2323
border-width: 10px;
2424
border-color: rgb(194, 93, 53);
2525
border-style:groove;
2626
border-radius: 15px;
2727

28-
28+
}
29+
30+
.form-group input{
31+
border: 1px solid #ddd;
32+
height : 40px;
33+
padding: 0 15px;
34+
border-radius: 5px;
35+
font-size: 15px;
36+
width: 100%;
37+
38+
}
39+
40+
.eyeicon{
41+
position: absolute;
42+
right: 60px;
43+
top: 175px;
44+
cursor: pointer;
45+
2946
}
3047

3148

@@ -45,7 +62,10 @@ <h1>Connectez vous</h1>
4562
</div>
4663
<div>
4764
<label for="password">Mot de passe</label>
48-
<input type="text" class="form-control" [(ngModel)]="credentials.password" name="password">
65+
<input [type]="changetype? 'password' : 'text'" class="form-control" [(ngModel)]="credentials.password" name="password">
66+
<span class = "eyeicon" (click)="viewpass()"><i [ngClass]="visible?'fa fa-eye' : 'fa fa-eye-slash'"></i>
67+
68+
</span>
4969
<br>
5070
</div>
5171
<button class="btn btn-warning" type="submit">Se connecter</button>

src/app/components/login/login.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,20 @@ export class LoginComponent implements OnInit {
1616
username!: string;
1717
password!: string;
1818
credentials = { username: '', password: '' }
19+
visible:boolean = true;
20+
changetype:boolean = true;
21+
1922
constructor(private appService: AppService, private httpClient: HttpClient, private router: Router) { }
2023

2124

2225
login() {
2326
this.appService.authenticate(this.credentials, () => { this.router.navigateByUrl("/home") });
2427
}
2528

29+
viewpass(){
30+
this.visible = !this.visible
31+
this.changetype = !this.changetype;
32+
}
2633

2734
/*onSubmit(form:NgForm) {
2835
// Récupération des données du formulaire

src/app/components/registration/registration.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ <h3 class="card-title">Creer un compte</h3>
4949
<div class="row">
5050
<div class="update ml-auto mr-auto">
5151
<button class="btn btn-primary btn-round" name="btn1">Valider</button>
52+
5253
</div>
5354
</div>
5455
</form>

src/app/components/registration/registration.component.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { FormGroup } from '@angular/forms';
2+
import { FormBuilder, FormGroup } from '@angular/forms';
33
import { Router } from '@angular/router';
44
import { Utilisateur } from 'app/model/utilisateur';
55
import { UtilisateurService } from 'app/services/utilisateur.service';
@@ -15,7 +15,7 @@ export class RegistrationComponent implements OnInit {
1515

1616
utilisateur: Utilisateur = new Utilisateur();
1717
myForm: FormGroup;
18-
constructor(private utilisateurService: UtilisateurService, private router: Router) { }
18+
constructor(private fb:FormBuilder, private utilisateurService: UtilisateurService, private router: Router) { }
1919
ngOnInit(): void {
2020
this.saveUtilisateur();
2121

@@ -26,16 +26,19 @@ export class RegistrationComponent implements OnInit {
2626

2727
}
2828

29+
onSubmit() {
30+
const password = this.myForm.get('password').value;
31+
const hashedPassword = bcrypt.hashSync(password);
32+
}
33+
34+
35+
2936
saveUtilisateur() {
3037
this.utilisateurService.save(this.utilisateur).subscribe(
3138
() => {
3239
this.utilisateur = new Utilisateur();
3340
}
3441
)
3542
}
36-
onSubmit() {
37-
const password = this.myForm.get('password').value;
38-
const hashedPassword = bcrypt.hashSync(password, 10);
39-
40-
}
43+
4144
}

src/app/table-list/table-list.component.html

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,77 @@
1+
12
<div class="main-content">
23
<div class="container-fluid">
34
<div class="row">
4-
<div class="col-md-12">
5-
<p>Ici on pourra mettre des exmples d'offres, genre villa pas cher, appart parisien au top, etc.</p>
6-
</div>
7-
<div class="col-md-12">
8-
<p>Ici on pourra mettre un bouton et un champ pour faire des recherches spécifique</p>
9-
<button mat-raised-button type="submit" class="btn btn-danger pull-right">Lancer la recherche !</button>
5+
<div id="rechercheavancee" class="col-md-12">
6+
<form (ngSubmit)="onSubmit()" class="form-group col-md-6">
7+
<label for="ville">Ville :</label>
8+
<input class="form-control" type="text" name="ville" [(ngModel)]="ville">
9+
10+
<label for="typeOffre">Type d'offre :</label>
11+
<input class="form-control" type="text" name="typeOffre" [(ngModel)]="typeOffre">
12+
13+
<label for="prix">Prix :</label>
14+
<input class="form-control" type="number" name="prix" [(ngModel)]="prix">
15+
16+
<label for="surface">Surface :</label>
17+
<input class="form-control" type="number" name="surface" [(ngModel)]="surface">
18+
19+
<label for="orientation">Orientation : </label>
20+
<input class="form-control" type="text" name="orientation" [(ngModel)]="orientation">
21+
22+
<label for="bien">Type de Biens :</label>
23+
<select name="bien" [(ngModel)]="bien">
24+
<option value="appartement">Appartement</option>
25+
<option value="maison">Maison</option>
26+
<option value="maison">Garage</option>
27+
<option value="maison">Terrain</option>
28+
</select>
29+
<button mat-raised-button type="submit" class="btn btn-danger pull-right" (click)="rechercher()">Rechercher</button>
30+
</form>
31+
</div>
32+
<div>
33+
<input type="button" name="boutonrecherche" class="boutonrecherche" id="boutonrecherche" value="Faire une recherche">
34+
35+
</div>
36+
<div class="row">
37+
<div class="col-md-12">
38+
<div class="card">
39+
<div class="card-header">
40+
<h4 class="card-title"></h4>
1041
</div>
42+
<div class="card-body">
43+
<!-- <table>
44+
<thead>
45+
<tr>
46+
<th scope="col">imageOffre</th>
47+
<th scope="col">description</th>
48+
<th scope="col">ville</th>
49+
<th scope="col">adresse</th>
50+
<th scope="col">surfaceOffre</th>
51+
<th scope="col">orientationOffre</th>
52+
<th scope="col">etatOffre</th>
53+
<th scope="col">typeOffre</th>
54+
<th scope="col">prixOffre</th>
55+
<th scope="col">disponibiliteOffre</th> </tr>
56+
</thead>
57+
<tbody>
58+
<tr *ngFor="let o of offreRecherche">
59+
<td>{{o.imageOffre}}</td>
60+
<td>{{o.description}}</td>
61+
<td>{{o.ville}}</td>
62+
<td>{{o.adresse}}</td>
63+
<td>{{o.surfaceOffre}}</td>
64+
<td>{{o.orientationOffre}}</td>
65+
<td>{{o.etatOffre}}</td>
66+
<td>{{o.typeOffre}}</td>
67+
<td>{{o.prixOffre}}</td>
68+
<td>{{o.disponibiliteOffre}}</td>
69+
</tr>
70+
71+
</tbody>
72+
</table> -->
73+
74+
1175

1276
<!--Table d'affichage des offres-->
1377
<div class="container-fluid mt--7">

src/app/table-list/table-list.component.ts

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { HttpClient } from '@angular/common/http';
12
import { Component, OnInit } from '@angular/core';
23
import { Router } from '@angular/router';
34
import { AppService } from 'app/app.service';
@@ -12,17 +13,54 @@ import { OffreService } from 'app/services/offre.service';
1213
export class TableListComponent implements OnInit {
1314

1415
offres: any[];
16+
offreRecherche: any;
17+
bien : any;
18+
ville: string;
19+
typeOffre: string;
20+
prix: number;
21+
surface: number;
22+
orientation: string;
23+
24+
1525

1626
offre: Offre = new Offre();
1727

18-
constructor(private offreService: OffreService, private appService: AppService, private router: Router) { }
28+
constructor(private httpClient:HttpClient, private offreService: OffreService, private appService: AppService, private router: Router) { }
1929

2030
ngOnInit() {
2131
this.findAllOffre();
22-
}
32+
this.ville ='';
33+
this.typeOffre = '';
34+
this.prix = 0;
35+
this.surface = 0;
36+
this.orientation = '';
37+
this.bien = '';
38+
this.rechercher();
39+
40+
41+
42+
$(document).ready(function(){
43+
$("#rechercheavancee").hide();
44+
$("#boutonrecherche").click(function(){
45+
$("#rechercheavancee").toggle(2500);
46+
});
47+
});
48+
}
2349

2450
findAllOffre() {
2551
this.offreService.findAll().subscribe(data => { this.offres = data; });
2652
}
2753

54+
rechercher(){
55+
const url = `/table-list/recherche?ville=${this.ville}&type=${this.typeOffre}
56+
&prix=${this.prix}&surface=${this.surface}&orientation=${this.orientation}`;
57+
this.httpClient.get<any[]>(url).subscribe(data => {
58+
this.bien = data;
59+
});
60+
}
61+
62+
onSubmit(){
63+
this.rechercher();
64+
}
65+
2866
}

src/assets/img/13-01.jpg

253 KB
Loading

0 commit comments

Comments
 (0)