Skip to content

Commit 0ca6e98

Browse files
committed
pas ouf comme commit
1 parent c9fc082 commit 0ca6e98

File tree

5 files changed

+103
-86
lines changed

5 files changed

+103
-86
lines changed

src/app/dashboard/dashboard.component.html

Lines changed: 38 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
<html>
33
<div>
44

5-
<br>
6-
<br>
7-
<h1>Hello {{user.prenomUtilisateur}}</h1>
8-
<br>
9-
<br>
105
<div style="position: relative; left: 10px; background-color: white; border-color: black; border-width: thick;">
6+
<br>
7+
<br>
8+
<div>
9+
<br>
10+
<br>
11+
<p>Bonjour {{user.prenomUtilisateur}}, vous êtes bien sur le site officiel de <b>Real
12+
Estate Agency</b></p>
13+
</div>
1114
<table>
1215
<th>
1316
<h2 style="color: chocolate;"><b>Qui sommes nous ? </b></h2>
@@ -498,116 +501,87 @@ <h4 class="card-title">Employees Stats</h4>
498501
</div>-->
499502
<br>
500503
<br>
501-
<div style="position: relative; left: 25px;bottom: 0px;">
504+
<div style="position: relative; left: 1px;bottom: 0px;">
502505
<div class="card card-plain">
503-
<div class="card-header card-header-danger">
504-
<h4 class="card-title mt-0"> Top 5 des plus recherchés</h4>
505-
<p class="card-category">Si vous manquez d'inspi, voici les biens les plus demandés...</p>
506+
<div style="background-color: chocolate; color: black;">
507+
<h3> &nbsp;&nbsp; Nos services, votre bonheur </h3>
508+
<p style="color: white;"> &nbsp; Si vous manquez d'inspiration, voici échantillon de ce que vous pourriez
509+
trouvez sur notre site ! </p>
510+
</div>
511+
<div>
512+
<img src="assets/img/villa.jpg" width="150" height="100"
513+
style="position: relative; left: 250px; top: 150px;">
506514
</div>
507515
<div class="card-body">
508-
<div class="table-responsive">
509-
<table class="table table-hover">
516+
<div class="table-responsive" style="color: chocolate;">
517+
<table class="table table-hover" style="background-color: white;">
510518
<thead class="">
511519
<th>
512-
Type de bien
520+
<b>Type de bien</b>
513521
</th>
514522
<th>
515-
Ville
523+
<b>Ville</b>
516524
</th>
517525
<th>
518-
Country
519-
</th>
526+
<b>Description</b>
520527
<th>
521-
City
522-
</th>
523-
<th>
524-
Salary
528+
&nbsp;
525529
</th>
526530
</thead>
527531
<tbody>
528532
<tr>
529533
<td>
530-
1
531-
</td>
532-
<td>
533-
Dakota Rice
534+
Appartement
534535
</td>
535536
<td>
536-
Niger
537+
Paris
537538
</td>
538539
<td>
539-
Oud-Turnhout
540-
</td>
541-
<td>
542-
$36,738
540+
Appartement bien situé et bien isolé du bruit !
543541
</td>
544542
</tr>
545543
<tr>
546544
<td>
547-
2
548-
</td>
549-
<td>
550-
Minerva Hooper
551-
</td>
552-
<td>
553-
Curaçao
545+
Maison
554546
</td>
555547
<td>
556-
Sinaai-Waas
548+
Canne
557549
</td>
558550
<td>
559-
$23,789
551+
Villa somptueuse au bord de la mer...
560552
</td>
561553
</tr>
562554
<tr>
563555
<td>
564-
3
556+
Appartement
565557
</td>
566558
<td>
567-
Sage Rodriguez
559+
Annecy
568560
</td>
569561
<td>
570-
Netherlands
571-
</td>
572-
<td>
573-
Baileux
574-
</td>
575-
<td>
576-
$56,142
562+
Si vous recherchez un nid douillet, il est fait pour vous !
577563
</td>
578564
</tr>
579565
<tr>
580566
<td>
581-
4
582-
</td>
583-
<td>
584-
Philip Chaney
567+
Terrain
585568
</td>
586569
<td>
587-
Korea, South
570+
TrouPerdu
588571
</td>
589572
<td>
590-
Overland Park
591-
</td>
592-
<td>
593-
$38,735
573+
Constructible, sans vis-à-vis, l'idéal pour se construire un havre de paix
594574
</td>
595575
</tr>
596576
<tr>
597577
<td>
598-
5
599-
</td>
600-
<td>
601-
Doris Greene
602-
</td>
603-
<td>
604-
Malawi
578+
Garage
605579
</td>
606580
<td>
607-
Feldkirchen in Kärnten
581+
Lyon
608582
</td>
609583
<td>
610-
$63,542
584+
Ce pourrait être votre premier bien immobilier en location !
611585
</td>
612586
</tr>
613587
</tbody>

src/app/icons/icons.component.html

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
<div class="main-content">
2-
<div class="container-fluid">
3-
<div class="card card-plain">
4-
<div class="card-header card-header-danger">
5-
<h4 class="card-title">Liste de tous les utilisateurs</h4>
6-
<p class="card-category">Seuls les administrateurs peuvent y avoir accès. Les modifications sont
7-
enregistrées directement dans la DB
8-
</p>
9-
</div>
10-
<div class="row">
11-
<div class="col-md-12">
12-
<div class="card-body">
13-
<p>gentille liste de tous les utilisateurs</p>
14-
<p>Cliquer sur modifier/sauvegarder</p>
15-
</div>
16-
</div>
17-
</div>
18-
</div>
19-
</div>
1+
<div>
2+
<table>
3+
<tr>
4+
<th>Nom</th>
5+
<th>Prénom</th>
6+
<th>Action</th>
7+
</tr>
8+
<tr *ngFor="let u of utilisateur">
9+
<td>{{u.nomUtilisateur}}</td>
10+
<td>{{u.prenomUtilisateur}}</td>
11+
<td><button (click)="deleteUtilisateur(u.idUtilisateur)">Delete</button>
12+
<button (click)="editUtilisateur(u)">Editer</button>
13+
</td>
14+
</tr>
15+
</table>
2016
</div>

src/app/icons/icons.component.ts

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,62 @@
1+
import { HttpClient } from '@angular/common/http';
12
import { Component, OnInit } from '@angular/core';
3+
import { Router } from '@angular/router';
4+
import { AppService } from 'app/app.service';
5+
import { Utilisateur } from 'app/model/utilisateur';
6+
import { RoleService } from 'app/services/role.service';
7+
import { UtilisateurService } from 'app/services/utilisateur.service';
28

39
@Component({
410
selector: 'app-icons',
511
templateUrl: './icons.component.html',
612
styleUrls: ['./icons.component.css']
713
})
814
export class IconsComponent implements OnInit {
15+
// Déclaration d'un tableau d'utilisateurs
16+
// ! : le tableau n'est pas initialisé
17+
users!: any[]; // any : n'importe quel type de données
18+
// step 1
19+
roles!: any[];
20+
utilisateur: Utilisateur = new Utilisateur();
21+
// DI : par constrcuteur
22+
constructor(private utilisateurService: UtilisateurService,/*step2*/private roleService: RoleService, private router: Router) { }
923

10-
constructor() { }
11-
12-
ngOnInit() {
24+
ngOnInit(): void {
25+
this.findAllUtilisateurs();
26+
// step 4
27+
this.findAllRoles();
28+
}
29+
findAllUtilisateurs() {
30+
// subscribe : utilisation de l'expression lambda
31+
// data => {this.users = data}
32+
this.utilisateurService.findAll().subscribe(data => { this.users = data; });
1333
}
34+
// step 3
35+
findAllRoles() {
36+
this.roleService.findAll().subscribe(data => { this.roles = data; });
37+
}
38+
1439

40+
41+
//Méthode save :
42+
saveUtilisateur() {
43+
this.utilisateurService.save(this.utilisateur).subscribe(
44+
() => {
45+
this.findAllUtilisateurs(); // MAJ la lise des utilisateurs
46+
this.utilisateur = new Utilisateur(); // Vider le formulaire
47+
}
48+
)
49+
}
50+
/**/
51+
deleteUtilisateur(id: number) {
52+
this.utilisateurService.delete(id).subscribe(() => { this.findAllUtilisateurs() });
53+
}
54+
editUtilisateur(utilisateur: Utilisateur) {
55+
// localStorage : créer un attribut (name = "editUserId") dans le navigateur et lui affecter une valeur (editUserId= idUtilisateur)
56+
// Step 1 : MAJ du composant
57+
localStorage.removeItem("editUserId");
58+
// Step 2 : Sélectionner une ligne :
59+
localStorage.setItem("editUserId", utilisateur.idUtilisateur.toString());
60+
this.router.navigate(['/editUser', utilisateur.idUtilisateur]);
61+
}
1562
}

src/assets/img/garage.jpg

1010 KB
Loading

src/assets/img/villa.jpg

7.63 MB
Loading

0 commit comments

Comments
 (0)