diff --git a/src/app/models/membre.ts b/src/app/models/membre.ts
index a715404..970362e 100644
--- a/src/app/models/membre.ts
+++ b/src/app/models/membre.ts
@@ -9,6 +9,6 @@ export interface Membre {
dateNaissance: Date;
couleur: string;
passwordConfirm: string;
- //team: Team;
roleList: string[];
+ team?: Team;
}
diff --git a/src/app/pages/page-account/page-account.component.html b/src/app/pages/page-account/page-account.component.html
index e87ebd6..22e9e59 100644
--- a/src/app/pages/page-account/page-account.component.html
+++ b/src/app/pages/page-account/page-account.component.html
@@ -24,7 +24,7 @@
-
+
diff --git a/src/app/pages/page-account/page-account.component.ts b/src/app/pages/page-account/page-account.component.ts
index e705c09..8699f62 100644
--- a/src/app/pages/page-account/page-account.component.ts
+++ b/src/app/pages/page-account/page-account.component.ts
@@ -42,11 +42,9 @@ export class PageAccountComponent implements OnInit {
const userRole = this.tokenService.getRole();
if(userRole == "ROLE_PARENT"){
this.parent = true;
- console.log('Rôle : ' + userRole);
}
else if(userRole== "ROLE_ENFANT"){
this.parent = false;
- console.log('Rôle : ' + userRole);
}
}
diff --git a/src/app/pages/page-add-member/page-add-member.component.ts b/src/app/pages/page-add-member/page-add-member.component.ts
index bd54d6e..c9209e1 100644
--- a/src/app/pages/page-add-member/page-add-member.component.ts
+++ b/src/app/pages/page-add-member/page-add-member.component.ts
@@ -89,12 +89,11 @@ export class PageAddMemberComponent implements OnInit {
const mail: Mail = {
recipient: emailValue,
- subject: "Votre mot de passe Organizee",
- //message: 'Votre mot de passe'
+ subject: "Votre mot de passe provisoire Organizee",
message: `Bonjour ${firstNameValue}!\n Voici vos identifiants de connexion : \n
Identifiant : ${emailValue}
- Mot de passe : ${passwordValue}
- Veuillez modifier votre mot de passe à la première connexion :
+ Mot de passe provisoire : ${passwordValue}
+ Veuillez modifier votre mot de passe dès la première connexion :
http://localhost:4200/password-oublie
`
};
diff --git a/src/app/pages/page-delete-member/page-delete-member.component.html b/src/app/pages/page-delete-member/page-delete-member.component.html
index da8ade7..ee1f3fb 100644
--- a/src/app/pages/page-delete-member/page-delete-member.component.html
+++ b/src/app/pages/page-delete-member/page-delete-member.component.html
@@ -23,7 +23,7 @@
id = "bouton-ajout"
type="button"
class="btn btn-primary btn-lg bouton-oui"
- (clickDelete)="onClickDelete()"
+ (click)="onClickDelete()"
[hidden]="parent == false"
>Oui, je souhaite supprimer ce compte
diff --git a/src/app/pages/page-delete-member/page-delete-member.component.ts b/src/app/pages/page-delete-member/page-delete-member.component.ts
index 47a086d..f923b58 100644
--- a/src/app/pages/page-delete-member/page-delete-member.component.ts
+++ b/src/app/pages/page-delete-member/page-delete-member.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, OnInit, Output } from '@angular/core';
+import { Component,OnInit} from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { MembreService } from 'src/app/services/membre.service';
import { TokenService } from 'src/app/services/token.service';
@@ -32,7 +32,6 @@ export class PageDeleteMemberComponent implements OnInit {
.getMembreId(this.membreId)
.subscribe((membreInfos: any) => {
this.membreInfos = membreInfos;
- console.log(membreInfos.id);
});
/** Récupérer le rôle de l'uilisateur connecté pour lui imposer des limitations s'il a un ROLE_ENFANT **/
@@ -40,19 +39,17 @@ export class PageDeleteMemberComponent implements OnInit {
const userRole = this.tokenService.getRole();
if(userRole == "ROLE_PARENT"){
this.parent = true;
- console.log('Rôle : ' + userRole);
}
else if(userRole== "ROLE_ENFANT"){
this.parent = false;
- console.log('Rôle : ' + userRole);
}
}
/********************** Suppresion d'un membre au click ********************/
onClickDelete(): void {
- console.log(this.membreInfos);
- this.membreService.deleteMembre(this.membreInfos.id).subscribe((resp) => {
- return resp
+ console.log("coucou");
+ this.membreService.deleteMembre(this.membreInfos).subscribe((resp) => {
+ this.router.navigate(['compte']);
});
}
}
diff --git a/src/app/pages/page-signup/page-signup.component.ts b/src/app/pages/page-signup/page-signup.component.ts
index f46ce63..288acfd 100644
--- a/src/app/pages/page-signup/page-signup.component.ts
+++ b/src/app/pages/page-signup/page-signup.component.ts
@@ -5,7 +5,7 @@ import {
FormGroup,
Validators,
} from '@angular/forms';
-import { Router, RouterLink } from '@angular/router';
+import { Router} from '@angular/router';
import { Team } from 'src/app/models/team';
import { TeamService } from 'src/app/services/team.service';
import { Membre } from '../../models/membre';
@@ -59,7 +59,6 @@ export class PageSignupComponent implements OnInit {
}
public onSubmit(): void {
- const teamIdValue = this.signupForm.value[''];
const teamNameValue = this.signupForm.value['teamNameFc'];
const idValue = this.signupForm.value[''];
const prenomValue = this.signupForm.value['firstNameFc'];
@@ -72,29 +71,34 @@ export class PageSignupComponent implements OnInit {
const roleValue = ['ROLE_PARENT'];
const team: Team = {
- id : teamIdValue,
+ id : "",
nom : teamNameValue,
};
- const membre: Membre = {
- id: idValue,
- nom: nomValue,
- prenom: prenomValue,
- email: emailValue,
- password: passwordValue,
- couleur: couleurValue,
- dateNaissance: dateNaissanceValue,
- passwordConfirm: passwordConfirmValue,
- //team: teamIdValue,
- roleList: roleValue,
- };
+ if (emailValue !== '' && passwordValue !== '' && team.nom!== '') {
+ //création Team
+ this.teamService.addTeam(team).subscribe((respTeam) => {
+ //récupération de l'id auto-généré (respTeam.id) dans l'id team (team.id)
+ team.id = respTeam.id;
+ //création objet membre avec l'objet team crée
+ const membre: Membre = {
+ id: idValue,
+ nom: nomValue,
+ prenom: prenomValue,
+ email: emailValue,
+ password: passwordValue,
+ couleur: couleurValue,
+ dateNaissance: dateNaissanceValue,
+ passwordConfirm: passwordConfirmValue,
+ team: team,
+ roleList: roleValue,
+ };
+ //création du membre en bdd avec l'objet membre
+ this.authService.signup(membre).subscribe((respMembre) => {
+ this.router.navigate(['accueil']);
+ return respMembre
+ });
- if (membre.email !== '' && membre.password !== '' && team.nom!== '') {
- this.teamService.addTeam(team).subscribe((resp) => {
- return resp
- });
- this.authService.signup(membre).subscribe((resp) => {
- this.router.navigate(['accueil']);
});
} else {
// affichage erreur
diff --git a/src/app/pages/page-to-do-list/page-to-do-list.component.scss b/src/app/pages/page-to-do-list/page-to-do-list.component.scss
index 499b75c..72fe441 100644
--- a/src/app/pages/page-to-do-list/page-to-do-list.component.scss
+++ b/src/app/pages/page-to-do-list/page-to-do-list.component.scss
@@ -3,7 +3,7 @@
color: #5d5fef;
font-size: 30px;
margin-left: 240px;
- margin-top: 40px;
+ margin-top: 20px;
}
.btn {
diff --git a/src/app/pages/page-update-member/page-update-member.component.html b/src/app/pages/page-update-member/page-update-member.component.html
index 5361655..32b822c 100644
--- a/src/app/pages/page-update-member/page-update-member.component.html
+++ b/src/app/pages/page-update-member/page-update-member.component.html
@@ -80,8 +80,7 @@
placeholder=""
name="Role"
formControlName="roleFc"
- value="{{membreInfos.roleList}}"
- [(ngModel)]="membreInfos.roleList"
+ value=""
>
diff --git a/src/app/pages/page-update-member/page-update-member.component.ts b/src/app/pages/page-update-member/page-update-member.component.ts
index cb36871..6864adf 100644
--- a/src/app/pages/page-update-member/page-update-member.component.ts
+++ b/src/app/pages/page-update-member/page-update-member.component.ts
@@ -100,8 +100,6 @@ export class PageUpdateMemberComponent implements OnInit {
roleList: [roleValue]
};
- console.log(membre);
-
this.membreService.updateMembre(membre)?.subscribe((resp) => {
this.router.navigate(['compte']);
});
diff --git a/src/app/services/membre.service.ts b/src/app/services/membre.service.ts
index 5d30104..a69bb6b 100644
--- a/src/app/services/membre.service.ts
+++ b/src/app/services/membre.service.ts
@@ -46,7 +46,7 @@ export class MembreService {
}
deleteMembre(membre: Membre): Observable{
- return this.http.delete(`${this.apiUrl}/membres/delete/${membre.id}`);
+ return this.http.delete(`${this.apiUrl}/membres/delete/${membre.id}`, {responseType: "text"});
}
updateMembre(membre: Membre): Observable | void {
diff --git a/src/app/services/team.service.ts b/src/app/services/team.service.ts
index 3e96bab..0de1c80 100644
--- a/src/app/services/team.service.ts
+++ b/src/app/services/team.service.ts
@@ -32,8 +32,6 @@ export class TeamService {
}
addTeam(team: Team): Observable {
- console.log(team);
-
return this.http.post(`${this.apiUrl}/teams/add`, team);
}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index bd6eab6..f6c7117 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -6,7 +6,8 @@ export const environment = {
production: false,
apiUrl: 'http://localhost:8088',
tokenKey: 'TOKEN-ORGANIZEE',
- debug: true,
+ // pour afficher des infos en mode debug
+ debug: false,
};
/*