Merge pull request #86 from AlineRinquin/dev

Dev Verssion 1.0 au 05/03/22
This commit is contained in:
AlineRinquin 2022-03-05 19:12:17 +01:00 committed by GitHub
commit b12da5fb36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 891 additions and 599 deletions

View File

@ -7,7 +7,6 @@ import { PageAgendaComponent } from './pages/page-agenda/page-agenda.component';
import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout-contact.component'; import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout-contact.component';
import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component'; import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
import { PageDashboardComponent } from './pages/page-dashboard/page-dashboard.component'; import { PageDashboardComponent } from './pages/page-dashboard/page-dashboard.component';
import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component';
import { PageDeleteMemberComponent } from './pages/page-delete-member/page-delete-member.component'; import { PageDeleteMemberComponent } from './pages/page-delete-member/page-delete-member.component';
import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.component'; import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.component';
import { PageMenuSemaineComponent } from './pages/page-menu-semaine/page-menu-semaine.component'; import { PageMenuSemaineComponent } from './pages/page-menu-semaine/page-menu-semaine.component';
@ -17,11 +16,11 @@ import { PageRepertoireComponent } from './pages/page-repertoire/page-repertoire
import { PageResetPasswordComponent } from './pages/page-reset-password/page-reset-password.component'; import { PageResetPasswordComponent } from './pages/page-reset-password/page-reset-password.component';
import { PageSignupComponent } from './pages/page-signup/page-signup.component'; import { PageSignupComponent } from './pages/page-signup/page-signup.component';
import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.component'; import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.component';
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component'; import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component';
import { PageSupportComponent } from './pages/page-support/page-support.component'; import { PageSupportComponent } from './pages/page-support/page-support.component';
import { FooterComponent } from './components/footer/footer.component'; import { FooterComponent } from './components/footer/footer.component';
import { AuthGuard } from './auth.guard'; import { AuthGuard } from './auth.guard';
import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'accueil', pathMatch: 'full' }, { path: '', redirectTo: 'accueil', pathMatch: 'full' },
@ -32,7 +31,6 @@ const routes: Routes = [
{ path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent }, { path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent },
{ path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent }, { path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent },
{ path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent }, { path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent },
{ path: 'supprimer-compte', canActivate: [AuthGuard], component: PageDeleteAccountComponent },
{ path: 'password-oublie', component: PageForgotPasswordComponent }, { path: 'password-oublie', component: PageForgotPasswordComponent },
{ path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent }, { path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent },
{ path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent }, { path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent },
@ -40,11 +38,11 @@ const routes: Routes = [
{ path: 'creation-compte', component: PageSignupComponent }, { path: 'creation-compte', component: PageSignupComponent },
{ path: 'page-support', component: PageSupportComponent}, { path: 'page-support', component: PageSupportComponent},
{ path: 'to-do-list', canActivate: [AuthGuard], component: PageToDoListComponent }, { path: 'to-do-list', canActivate: [AuthGuard], component: PageToDoListComponent },
{ path: 'modifier-membre', canActivate: [AuthGuard], component: PageUpdateMemberComponent }, { path: 'modifier-membre/:id', canActivate: [AuthGuard], component: PageUpdateMemberComponent },
{ path: 'modifier-compte', canActivate: [AuthGuard], component: PageUpdateAccountComponent },
{ path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent }, { path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent },
{ path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent }, { path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent },
{ path: 'footer', component: FooterComponent}, { path: 'footer', component: FooterComponent},
{ path: 'ajout-evenement', canActivate: [AuthGuard], component: PageAjoutEvenementsComponent },
{ path: '**', component: PageNotFoundComponent }, { path: '**', component: PageNotFoundComponent },
]; ];

View File

@ -23,10 +23,8 @@ import { MeteoComponent } from './components/meteo/meteo.component';
import { CalendrierComponent } from './components/calendrier/calendrier.component'; import { CalendrierComponent } from './components/calendrier/calendrier.component';
import { CardMemberComponent } from './components/card-member/card-member.component'; import { CardMemberComponent } from './components/card-member/card-member.component';
import { ToDoListComponent } from './components/to-do-list/to-do-list.component'; import { ToDoListComponent } from './components/to-do-list/to-do-list.component';
import { TacheComponent } from './components/tache/tache.component';
import { CardMenuComponent } from './components/card-menu/card-menu.component'; import { CardMenuComponent } from './components/card-menu/card-menu.component';
import { FicheContactComponent } from './components/fiche-contact/fiche-contact.component'; import { FicheContactComponent } from './components/fiche-contact/fiche-contact.component';
import { PaginationComponent } from './components/pagination/pagination.component';
import { CreneauComponent } from './components/creneau/creneau.component'; import { CreneauComponent } from './components/creneau/creneau.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
@ -35,8 +33,6 @@ import { PageModifierContactComponent } from './pages/page-modifier-contact/page
import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component'; import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
import { AutofocusFixModule } from 'ngx-autofocus-fix'; import { AutofocusFixModule } from 'ngx-autofocus-fix';
import { FooterComponent } from './components/footer/footer.component'; import { FooterComponent } from './components/footer/footer.component';
import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component';
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
import { registerLocaleData } from '@angular/common'; import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr'; import localeFr from '@angular/common/locales/fr';
@ -44,6 +40,7 @@ import { CardAvatarComponent } from './components/card-avatar/card-avatar.compon
import { HumeurComponent } from './components/humeur/humeur.component'; import { HumeurComponent } from './components/humeur/humeur.component';
import { DeconnexionComponent } from './components/deconnexion/deconnexion.component'; import { DeconnexionComponent } from './components/deconnexion/deconnexion.component';
import { AlertComponent } from './components/alert/alert.component'; import { AlertComponent } from './components/alert/alert.component';
import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component';
registerLocaleData(localeFr) registerLocaleData(localeFr)
@NgModule({ @NgModule({
@ -70,21 +67,18 @@ registerLocaleData(localeFr)
CalendrierComponent, CalendrierComponent,
CardMemberComponent, CardMemberComponent,
ToDoListComponent, ToDoListComponent,
TacheComponent,
CardMenuComponent, CardMenuComponent,
FicheContactComponent, FicheContactComponent,
PaginationComponent,
CreneauComponent, CreneauComponent,
PageAjoutContactComponent, PageAjoutContactComponent,
PageModifierContactComponent, PageModifierContactComponent,
PageCreationTeamComponent, PageCreationTeamComponent,
FooterComponent, FooterComponent,
PageDeleteAccountComponent,
PageUpdateAccountComponent,
CardAvatarComponent, CardAvatarComponent,
DeconnexionComponent, DeconnexionComponent,
HumeurComponent, HumeurComponent,
AlertComponent AlertComponent,
PageAjoutEvenementsComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View File

@ -19,6 +19,7 @@ export class AuthGuard implements CanActivate {
this.tokenKey = environment.tokenKey; this.tokenKey = environment.tokenKey;
} }
//s'il n'y a pas de token, le user ne peut pas naviguer sur les url où cette option est activée
canActivate( canActivate(
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot state: RouterStateSnapshot
@ -35,20 +36,17 @@ export class AuthGuard implements CanActivate {
console.log('decodedToken : ', decodedToken); console.log('decodedToken : ', decodedToken);
if (decodedToken.exp) { if (decodedToken.exp) {
console.log("Date d'exp decodedToken : ", decodedToken.exp);
const dateExp = new Date(decodedToken.exp * 1000); const dateExp = new Date(decodedToken.exp * 1000);
if (new Date() >= dateExp) { if (new Date() >= dateExp) {
// le token a expiré, je n'autorise pas l'accès // le token a expiré, je n'autorise pas l'accès et je redirige pour connexion
this.router.navigate(['accueil']); this.router.navigate(['accueil']);
return false; return false;
} }
} }
console.log("C'est ok ! ");
return true; return true;
} else { } else {
console.log('You shall not pass !!!!'); console.log('You shall not pass !!!!');
this.router.navigate(['accueil']); // redirection de notre utilisateur vers une url de notre application (dans notre code TS) this.router.navigate(['accueil']);
return false; return false;
} }
} }

View File

@ -1,13 +1,12 @@
<div class="container mt-5 membre"> <div class="card m-1 p-1 avatar bg-light">
<div class="row d-flex justify-content-center">
<div class="col-md-auto"> <div class="card-img-top">
<div class="card p-3 py-4 align-items"> <div class="rounded-circle"id="couleur"[style.background-color]="membre.couleur">
<!-- récuperer couleur du back--> </div>
<div class="text-center"><div class="rounded-circle"id="couleur"[style.background-color]="membre.couleur"></div></div>
<div class="text-center mt-3">
<h3 class="mt-2 mb-0">{{membre.prenom }} {{membre.nom }}</h3>
</div>
</div>
</div>
</div> </div>
</div>
<div class="card-body">
<h6 class="card-title flex-wrap d-flex flex-column border">{{membre.prenom }} {{membre.nom }}</h6>
</div>
</div>

View File

@ -3,18 +3,14 @@
height: 60px; height: 60px;
margin: 0 auto; margin: 0 auto;
background: black; background: black;
} }
.card { .card-title{
min-height: 8px; text-align: center;
border: none;
overflow: hidden;
border-radius: 8px;
justify-content: center;
} }
.avatar{
h3 { width: 150px;
font-size: small; height: 170px;
} border-radius: 20px;
}

View File

@ -7,7 +7,7 @@
<div class="text-center mt-3"> <div class="text-center mt-3">
<h3 class="mt-2 mb-0">{{membre.prenom }} {{membre.nom }}</h3> <h3 class="mt-2 mb-0">{{membre.prenom }} {{membre.nom }}</h3>
<div class="buttons text-center"><button button type="button" class="btn btn-outline-primary px-4" <div class="buttons text-center"><button button type="button" class="btn btn-outline-primary px-4"
routerLink="../modifier-membre" routerLink="../modifier-membre/{{membre.id}}"
routerLinkActive="active-custom"> routerLinkActive="active-custom">
Modifier Modifier
</button><button button type="button" class="btn btn-primary px-4" </button><button button type="button" class="btn btn-primary px-4"

View File

@ -7,7 +7,7 @@
} }
.card { .card {
min-height: 22rem; min-height: 14rem;
border: none; border: none;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
@ -22,6 +22,7 @@
.buttons button:nth-child(1) { .buttons button:nth-child(1) {
margin-top: 5px; margin-top: 5px;
margin-right: 5px;
border: 1px solid #7879F1 !important; border: 1px solid #7879F1 !important;
color: #7879F1; color: #7879F1;
height: 40px; height: 40px;
@ -30,6 +31,7 @@
.buttons button:nth-child(1):hover { .buttons button:nth-child(1):hover {
margin-top: 5px; margin-top: 5px;
margin-right: 5px;
border: 1px solid #7879F1 !important; border: 1px solid #7879F1 !important;
color: #fff; color: #fff;
height: 40px; height: 40px;

View File

@ -58,6 +58,11 @@
</button> </button>
<div class="container mt-5 menu"> <div class="container mt-5 menu">
<app-alert
*ngIf="isShow"
[alert]="alert"
(eventClose)="onClickCloseAlert()"
></app-alert>
<div class="row d-flex justify-content-center"> <div class="row d-flex justify-content-center">
<div class="col-md-auto" *ngFor="let menu of listMenus"> <div class="col-md-auto" *ngFor="let menu of listMenus">
<div class="card p-3 py-4 align-items" style="width: 14rem"> <div class="card p-3 py-4 align-items" style="width: 14rem">
@ -94,6 +99,7 @@
class="form-control" class="form-control"
formControlName="dateMenuFc" formControlName="dateMenuFc"
value="{{ menu.dateMenu }}" value="{{ menu.dateMenu }}"
[(ngModel)]="menu.dateMenu"
placeholder="Date" placeholder="Date"
name="date" name="date"
/> />
@ -102,6 +108,7 @@
class="form-control" class="form-control"
formControlName="repasMidiFc" formControlName="repasMidiFc"
value="{{ menu.repasMidi }}" value="{{ menu.repasMidi }}"
[(ngModel)]="menu.repasMidi"
placeholder="Repas du midi" placeholder="Repas du midi"
name="repasMidi" name="repasMidi"
/> />
@ -110,6 +117,7 @@
class="form-control" class="form-control"
formControlName="repasSoirFc" formControlName="repasSoirFc"
value="{{ menu.repasSoir }}" value="{{ menu.repasSoir }}"
[(ngModel)]="menu.repasSoir"
placeholder="Repas du soir" placeholder="Repas du soir"
name="repasSoir" name="repasSoir"
/> />

View File

@ -19,6 +19,8 @@ import {
}) })
export class CardMenuComponent implements OnInit { export class CardMenuComponent implements OnInit {
closeResult = ''; closeResult = '';
alert : any;
isShow : boolean;
public listMenus:any[]; public listMenus:any[];
public menuId : any; public menuId : any;
public menuForm : FormGroup; public menuForm : FormGroup;
@ -35,30 +37,21 @@ public upMenuForm : FormGroup;
this.listMenus=[]; this.listMenus=[];
this.menuForm = new FormGroup({}); this.menuForm = new FormGroup({});
this.upMenuForm = new FormGroup({}); this.upMenuForm = new FormGroup({});
this.upMenuForm = this.initForm(); this.isShow = false;
}
//Méthode qui initialise les champs du formulaire avec les infos de la BDD
private initForm(menu?: Menu): FormGroup {
return this.fb.group({
dateMenu: [menu ? menu.dateMenu : ''],
repasMidi: [menu ? menu.repasMidi : ''],
repasSoir: [menu ? menu.repasSoir : ''],
});
} }
//delete d'un menu
//delete d'un menu - fait appel au service dédié MenuService qui gère les observables
deleteMenu(id_menu : number): void { deleteMenu(id_menu : number): void {
// window.alert("Le menu a bien été supprimé!") this.alert={"type":"danger", "content":"Le menu a bien été supprimé"};
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => { this.isShow = true;
// this.router.navigate(['menu']); this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
window.location.reload(); window.location.reload();
}); });
} }
//updateMenu //updateMenu - fait appel au service dédié MenuService qui gère les observables
updateMenu(id_menu : number): void { updateMenu(id_menu : number): void {
const dateValue = this.upMenuForm.value['dateMenuFc']; const dateValue = this.upMenuForm.value['dateMenuFc'];
@ -83,14 +76,14 @@ updateMenu(id_menu : number): void {
//ajout d'un menu //ajout d'un menu - fait appel au service dédié MenuService qui gère les observables
saveMenu(): void { saveMenu(): void {
const dateValue = this.menuForm.value['dateMenuFc']; const dateValue = this.menuForm.value['dateMenuFc'];
const repasMidiValue = this.menuForm.value['repasMidiFc']; const repasMidiValue = this.menuForm.value['repasMidiFc'];
const repasSoirValue = this.menuForm.value['repasSoirFc']; const repasSoirValue = this.menuForm.value['repasSoirFc'];
//permet de construire l'objet à passer en base
const menu: Menu = { const menu: Menu = {
dateMenu: dateValue, dateMenu: dateValue,
repasMidi: repasMidiValue, repasMidi: repasMidiValue,
@ -102,7 +95,7 @@ saveMenu(): void {
console.log(menu.dateMenu); console.log(menu.dateMenu);
this.menusService.addMenu(menu)?.subscribe((resp) => { this.menusService.addMenu(menu)?.subscribe((resp) => {
window.location.reload(); window.location.reload(); //rechargement de la page pour affichage des modifications
}); });
} else { } else {
@ -113,10 +106,10 @@ saveMenu(): void {
ngOnInit(): void { ngOnInit(): void {
//affichage des menus d'une team //affichage des menus d'une team - fait appel au service dédié MenuService qui gère les observables
this.menusService.getMenu()?.subscribe((listMenus: any[])=>{ this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
console.log(listMenus); console.log(listMenus);
this.listMenus=listMenus; this.listMenus=listMenus; //socke les objets récupérés de la base
}); });
@ -129,7 +122,6 @@ this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
} }
); );
this.upMenuForm = this.fb.group( this.upMenuForm = this.fb.group(
{ {
dateMenuFc: new FormControl('',[Validators.required]), dateMenuFc: new FormControl('',[Validators.required]),
@ -141,7 +133,7 @@ this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
} }
//gestion de la fenêtre modale, open au click
open(content: any) { open(content: any) {
this.modalService.open(content, this.modalService.open(content,
{ariaLabelledBy: 'menu'}).result.then((result)=> { {ariaLabelledBy: 'menu'}).result.then((result)=> {
@ -152,6 +144,7 @@ open(content: any) {
}); });
} }
//gestion de la fenêtre modale, mode de fermeture
private getDismissReason(reason: any): string { private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) { if (reason === ModalDismissReasons.ESC) {
return 'by pressing ESC'; return 'by pressing ESC';
@ -161,6 +154,11 @@ open(content: any) {
return `with: ${reason}`; return `with: ${reason}`;
} }
} }
//fermeture du message d'alerte quand un menu est supprimé
onClickCloseAlert(){
this.isShow = ! this.isShow;
}
} }

View File

@ -16,7 +16,7 @@ export class DeconnexionComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
} }
//au click on fait appel au ServiceToken pour supprimer le token et on redirige l'utilisateur
onClickDeco(){ onClickDeco(){
this.tokenService.eraseToken(); this.tokenService.eraseToken();
this.router.navigate(['accueil']); this.router.navigate(['accueil']);

View File

@ -24,6 +24,7 @@ export class FicheContactComponent implements OnInit {
} }
} }
// supprime le contact
onClickDelete(numPerson: number){ onClickDelete(numPerson: number){
window.alert("Le contact à bien été supprimé!") window.alert("Le contact à bien été supprimé!")
this.clickDelete.emit(numPerson); this.clickDelete.emit(numPerson);

View File

@ -1 +0,0 @@
<p>pagination works!</p>

View File

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PaginationComponent } from './pagination.component';
describe('PaginationComponent', () => {
let component: PaginationComponent;
let fixture: ComponentFixture<PaginationComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PaginationComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PaginationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-pagination',
templateUrl: './pagination.component.html',
styleUrls: ['./pagination.component.scss']
})
export class PaginationComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1,27 +1,32 @@
<nav class="wrapper md-auto position-fixed "> <nav class="wrapper md-auto position-fixed" [ngStyle]="{'background-color':backgroundColor}">
<ul class="nav flex-column" id="sticky-sidebar"> <ul class="nav flex-column" id="sticky-sidebar">
<li class="nav-item" ngbNavItem="maTeam" > <li class="nav-item" ngbNavItem="maTeam" >
<a routerLink="../compte" routerLinkActive="active-custom" class="nav-link"> <a routerLink="/compte" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-people-fill"></i> <i class="bi bi-people-fill"></i>
Ma Team</a> Ma Team</a>
</li> </li>
<li class="nav-item" ngbNavItem="maTeam" >
<a routerLink="/tableau-de-bord" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-clipboard-data"></i>
Dashboard</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a routerLink="/repertoire" routerLinkActive="active-custom" class="nav-link"> <a routerLink="/repertoire" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-person-rolodex"></i> <i class="bi bi-person-rolodex"></i>
Répertoire</a> Répertoire</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a routerLink="../to-do-list" routerLinkActive="active-custom" class="nav-link"> <a routerLink="/to-do-list" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-check2-square"></i> <i class="bi bi-check2-square"></i>
To-Do-List</a> To-Do-List</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a routerLink="../menu" routerLinkActive="active-custom" class="nav-link"> <a routerLink="/menu" routerLinkActive="active-custom" class="nav-link">
<i class='fas fa-pizza-slice'></i> <i class='fas fa-pizza-slice'></i>
Menus</a> Menus</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a routerLink="../agenda" routerLinkActive="active-custom" class="nav-link"> <a routerLink="/agenda" routerLinkActive="active-custom" class="nav-link">
<i class="bi bi-calendar-event"></i> <i class="bi bi-calendar-event"></i>
Agenda</a> Agenda</a>
</li> </li>

View File

@ -5,7 +5,7 @@
width: auto; width: auto;
height: 100%; height: 100%;
position: absolute; position: absolute;
background-color: rgb(238, 238, 238); //background-color: #c3c3e7;
} }
.nav{ .nav{
margin-top: 20px; margin-top: 20px;

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
@Component({ @Component({
selector: 'app-side-bar', selector: 'app-side-bar',
@ -6,10 +6,14 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./side-bar.component.scss'] styleUrls: ['./side-bar.component.scss']
}) })
export class SideBarComponent implements OnInit { export class SideBarComponent implements OnInit {
@Input() backgroundColor!: string;
//@Input() backgroundColor = '#c3c3e7';
constructor() {}
constructor() { }
ngOnInit(): void { ngOnInit(): void {
} }
} }

View File

@ -27,7 +27,9 @@
<!-- <div *ngIf="errorForm"> <!-- <div *ngIf="errorForm">
<p class="text-danger">Il manque des informations dans le formulaire...</p> <p class="text-danger">Il manque des informations dans le formulaire...</p>
</div> --> </div> -->
<app-alert *ngIf="isShow" [alert]="alert" (eventClose)="onClickCloseAlert();"></app-alert> <app-alert *ngIf="isShow" [alert]="alert" (eventClose)="onClickCloseAlert();"></app-alert>
<!-- <div *ngIf="isShow"> <!-- <div *ngIf="isShow">
<div class="alert alert-{{alert.type}}" role="alert"> <div class="alert alert-{{alert.type}}" role="alert">
{{alert.content}} {{alert.content}}

View File

@ -1,12 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { AuthService } from '../../services/auth.service'; import { AuthService } from '../../services/auth.service';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
@Component({ @Component({
selector: 'app-signin', selector: 'app-signin',
@ -22,8 +17,9 @@ export class SigninComponent implements OnInit {
ngOnInit(): void {} ngOnInit(): void {}
//quand on se connecte - appel au service d'authentification
public onSubmit(submittedForm: any): void { public onSubmit(submittedForm: any): void {
console.log(submittedForm.form.value);
const email = submittedForm.form.value['email']; const email = submittedForm.form.value['email'];
const password = submittedForm.form.value['password']; const password = submittedForm.form.value['password'];
if (email !== '' && password !== '') { if (email !== '' && password !== '') {
@ -32,19 +28,20 @@ export class SigninComponent implements OnInit {
next: resp => { next: resp => {
this.router.navigate(['tableau-de-bord']); this.router.navigate(['tableau-de-bord']);
}, },
error: err => { error: err => { //gestion des alertes si les id/pwd sont faux
this.alert={"type":"danger", "content":"Le login ou paswword est invalide"}; this.alert={"type":"danger", "content":"Le login ou paswword est invalide"};
this.isShow = true; this.isShow = true;
}, },
complete: () => console.log('DONE!') complete: () => console.log('DONE!')
}); });
} else { } else {
// afficher une erreur à l'utilisateur // affiche une erreur à l'utilisateur
this.alert={"type":"danger", "content":"Le login ou password est invalide"}; this.alert={"type":"danger", "content":"Le login ou password est invalide"};
this.isShow = true; this.isShow = true;
} }
} }
//fermeture du message d'alerte
onClickCloseAlert(){ onClickCloseAlert(){
console.log('fermeture'); console.log('fermeture');
this.isShow = ! this.isShow; this.isShow = ! this.isShow;

View File

@ -1 +0,0 @@
<p>tache works!</p>

View File

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TacheComponent } from './tache.component';
describe('TacheComponent', () => {
let component: TacheComponent;
let fixture: ComponentFixture<TacheComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TacheComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TacheComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-tache',
templateUrl: './tache.component.html',
styleUrls: ['./tache.component.scss']
})
export class TacheComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -40,14 +40,15 @@ export class ToDoListComponent implements OnInit {
this.idTodo = 4; this.idTodo = 4;
this.todoTitle = ''; this.todoTitle = '';
} }
//supprimer la todoList //supprimer la todoList en fonction de son id
deleteTodo(id: number): void { deleteTodo(id: number): void {
window.alert('La to-do-List a bien été supprimé!');
this.TodoService.deleteTodoById(id).subscribe((resp) => { this.TodoService.deleteTodoById(id).subscribe((resp) => {
window.location.reload(); window.location.reload();
}); });
} }
//ajouter tache
//ajouter tache par l'id de son parent todoList
addTache(idTodoList: number) { addTache(idTodoList: number) {
//idTodoList id que la todoList que l'on récupère //idTodoList id que la todoList que l'on récupère
console.log(idTodoList); console.log(idTodoList);
@ -58,9 +59,13 @@ export class ToDoListComponent implements OnInit {
editing: false, editing: false,
}; };
console.log(this.tache); console.log(this.tache);
this.TodoService.addTache(tache, idTodoList).subscribe((resp) => { if (this.todoTitle != '') {
window.location.reload(); this.TodoService.addTache(tache, idTodoList).subscribe((resp) => {
}); window.location.reload();
});
} else {
window.alert('Il faut saisir du texte'); // sinon msg d'erreur
}
} }
//modifier le titre de la to-do-list //modifier le titre de la to-do-list
@ -70,13 +75,13 @@ export class ToDoListComponent implements OnInit {
}); });
} }
//modifier par l'input //modifier la tâche par l'input
modifier(tache: Tache): void { modifier(tache: Tache): void {
this.beforeEditCache = tache.texte; this.beforeEditCache = tache.texte;
tache.editing = true; tache.editing = true;
} }
// ajouter la modification dans la liste // modifier une tâche validation de l'input
doneEdit(tache: Tache): void { doneEdit(tache: Tache): void {
if (tache.texte.trim().length === 0) { if (tache.texte.trim().length === 0) {
tache.texte = this.beforeEditCache; tache.texte = this.beforeEditCache;
@ -112,12 +117,6 @@ export class ToDoListComponent implements OnInit {
return this.todo.taches.filter((tache: Tache) => tache).length > 0; return this.todo.taches.filter((tache: Tache) => tache).length > 0;
} }
//Effacer la to do list
effacerList(): void {
//this.todo = [];
}
//cocher toutes les cases de la todoList //cocher toutes les cases de la todoList
cocherAllTodoList(): void { cocherAllTodoList(): void {
for (var i = 0; i < this.todo.taches.length; i++) { for (var i = 0; i < this.todo.taches.length; i++) {

View File

@ -1,4 +1,5 @@
export interface Membre { export interface Membre {
id: string;
nom: string; nom: string;
prenom: string; prenom: string;
email: string; email: string;

View File

@ -1,47 +1,38 @@
<app-header></app-header> <app-header></app-header>
<app-side-bar></app-side-bar>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<app-side-bar></app-side-bar>
<div class="col-9 offset-2" id="main"> <div class="col-9 offset-2" id="main">
<h1>Ma team</h1> <h1 class="col-md-auto">{{ currentTeam.nom }}</h1>
<div class="d-flex justify-content-center"> <div>
<button <!-- Pour récupérer le membre connecté-->
button <div class="d-flex justify-content-center">
type="button" <app-card-member [membre]="currentUser"> </app-card-member>
class="btn btn-primary btn-lg" </div>
routerLink="../modifier-compte" <div class="d-flex justify-content-center">
routerLinkActive="active-custom" <button
> id="bouton-ajout"
Modifier mon compte type="button"
</button> class="btn btn-primary btn-lg"
</div> routerLink="../ajout-membre"
<div class="d-flex justify-content-center"> routerLinkActive="active-custom"
<button >
button Ajouter un membre
type="button" </button>
class="btn btn-primary btn-lg" </div>
routerLink="../supprimer-compte"
routerLinkActive="active-custom"
>
Supprimer mon compte
</button>
</div>
<div class="d-flex justify-content-center">
<button
button
type="button"
class="btn btn-primary btn-lg"
routerLink="../ajout-membre"
routerLinkActive="active-custom"
>
Ajouter un membre
</button>
</div> </div>
<div class="row"> <div class="row">
<div class="col" *ngFor="let membreData of listMembres"> <!-- Pour exclure le membre connecté de la liste car il est récupéré plus haut-->
<app-card-member [membre]="membreData"> </app-card-member> <!-- ng-container pour gérer l'espace vide que laissé le membre exclu à cause du dom -->
</div> <!-- cf. : https://angular.io/guide/built-in-directives#hosting-a-directive-without-a-dom-element-->
<ng-container *ngFor="let membreData of listMembres">
<!-- Condition dans ngIf mais une div à la place du ng-container pour le style-->
<div class="col" *ngIf="membreData.id != currentUser.id">
<app-card-member [membre]="membreData"> </app-card-member>
</div>
</ng-container>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<app-footer></app-footer>

View File

@ -1,3 +1,29 @@
button{ button{
margin-bottom: 5px; margin-bottom: 5px;
} }
#main{
margin-top: 20px;
}
ng-container{
display: flex;
}
#bouton-ajout {
margin-top: 5px;
border: 1px solid #7879F1 !important;
background-color: #7879F1;
color: #fff;
height: 50px;
width: 250px;
}
#bouton-ajout:hover {
margin-top: 5px;
border: 1px solid #191933 !important;
background-color: #191933;
color: #fff;
height: 50px;
width: 250px;
}

View File

@ -1,5 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { MembreService } from 'src/app/services/membre.service'; import { MembreService } from 'src/app/services/membre.service';
import { TeamService } from 'src/app/services/team.service';
import { TokenService } from 'src/app/services/token.service';
@Component({ @Component({
@ -9,16 +13,28 @@ import { MembreService } from 'src/app/services/membre.service';
}) })
export class PageAccountComponent implements OnInit { export class PageAccountComponent implements OnInit {
public listMembres: any[]; public listMembres: any[];
currentUser: any;
currentTeam: any;
constructor(private membreService: MembreService) { constructor(private membreService: MembreService,
private teamService: TeamService,
private tokenService: TokenService,
private router: Router) {
this.listMembres = []; this.listMembres = [];
} }
ngOnInit(): void { ngOnInit(): void {
/** Récuperer la team du membre connecté **/
this.teamService.getTeamById()?.subscribe((team) => {
this.currentTeam = team;
});
/** Récuperer le membre connecté **/
this.membreService.getMembreId(this.tokenService.getCurrentMembreId()).subscribe((user) => {
this.currentUser = user;
});
/** Récuperer la liste des membres de la team **/
this.membreService.getMembresByTeamId()?.subscribe((membres: any[]) => { this.membreService.getMembresByTeamId()?.subscribe((membres: any[]) => {
console.log(membres);
this.listMembres = membres; this.listMembres = membres;
});
});
} }
} }

View File

@ -10,7 +10,7 @@ import { TokenService } from 'src/app/services/token.service';
}) })
export class PageAccueilComponent implements OnInit { export class PageAccueilComponent implements OnInit {
constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) { constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) {
} }

View File

@ -1,12 +1,12 @@
<app-header></app-header> <app-header></app-header>
<app-side-bar></app-side-bar>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<app-side-bar></app-side-bar>
<div class="col-9 offset-2" id="main"> <div class="col-9 offset-2" id="main">
<h1 class="d-flex justify-content-center">Ajouter un nouveau membre à {{currentTeam.nom}}</h1>
<div class="form-addMember"> <div class="form-addMember">
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm"> <form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
<div class="form-floating"> <div class="form-floating input">
<input <input
type="color" type="color"
class="form-control" class="form-control"
@ -16,6 +16,7 @@
formControlName="couleurFc" formControlName="couleurFc"
/> />
</div> </div>
<label for="floatingInputcouleur" class="d-flex justify-content-center" >Choisissez une couleur</label>
<div class="form-floating"> <div class="form-floating">
<input <input
type="text" type="text"
@ -33,7 +34,7 @@
!addMemberForm.controls['lastNameFc'].valid !addMemberForm.controls['lastNameFc'].valid
}" }"
/> />
<label for="floatingInputlastName">VOTRE NOM</label> <label for="floatingInputlastName">Nom</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -52,9 +53,9 @@
!addMemberForm.controls['firstNameFc'].valid !addMemberForm.controls['firstNameFc'].valid
}" }"
/> />
<label for="floatingInputfirstName">VOTRE PRENOM</label> <label for="floatingInputfirstName">Prénom</label>
</div> </div>
<div class="form-floating"> <div class="form-floating ">
<input <input
type="date" type="date"
class="form-control" class="form-control"
@ -72,7 +73,7 @@
}" }"
/> />
<label for="floatingInputdateNaissance" <label for="floatingInputdateNaissance"
>VOTRE DATE DE NAISSANCE</label >Date de naissance</label
> >
</div> </div>
<div class="form-floating"> <div class="form-floating">
@ -92,20 +93,7 @@
!addMemberForm.controls['emailFc'].valid !addMemberForm.controls['emailFc'].valid
}" }"
/> />
<label for="floatingInputemail">Votre Email</label> <label for="floatingInputemail">Email</label>
</div>
<div class="form-floating">
<select
class="form-control"
id="floatingInputRole"
placeholder=""
name="Role"
formControlName="roleFc"
>
<option value="ROLE_PARENT">Adulte</option>
<option value="ROLE_ENFANT">Enfant</option>
</select>
<label value="ROLE_PARENT">Sélectionner un profil</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -124,7 +112,7 @@
!addMemberForm.controls['passwordFc'].valid !addMemberForm.controls['passwordFc'].valid
}" }"
/> />
<label for="floatingPassword">MOT DE PASSE</label> <label for="floatingPassword">Mot de passe</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -144,9 +132,22 @@
}" }"
/> />
<label for="floatingPasswordConfirm" <label for="floatingPasswordConfirm"
>CONFIRMEZ VOTRE MOT DE PASSE</label >Confirmez le mot de passe</label
> >
</div> </div>
<div class="form-floating select">
<select
class="form-control"
id="floatingInputRole"
placeholder=""
name="Role"
formControlName="roleFc"
>
<option value="ROLE_PARENT">Adulte</option>
<option value="ROLE_ENFANT">Enfant</option>
</select>
<label value="ROLE_PARENT">Sélectionnez un profil</label>
</div>
<button <button
class="w-100 btn btn-lg btn-outline-success" class="w-100 btn btn-lg btn-outline-success"

View File

@ -3,6 +3,11 @@
padding-top: 40px; padding-top: 40px;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
h1{
color: rgba(0, 0, 0, 0.658);
font-size: 34px;
margin-top: 20px;
}
.form-addMember { .form-addMember {
width: 100%; width: 100%;

View File

@ -3,9 +3,9 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Mail } from 'src/app/models/mail'; import { Mail } from 'src/app/models/mail';
import { Membre } from 'src/app/models/membre'; import { Membre } from 'src/app/models/membre';
import { AuthService } from 'src/app/services/auth.service';
import { MailService } from 'src/app/services/mail.service'; import { MailService } from 'src/app/services/mail.service';
import { MembreService } from 'src/app/services/membre.service'; import { MembreService } from 'src/app/services/membre.service';
import { TeamService } from 'src/app/services/team.service';
@Component({ @Component({
selector: 'app-page-add-member', selector: 'app-page-add-member',
@ -13,12 +13,17 @@ import { MembreService } from 'src/app/services/membre.service';
styleUrls: ['./page-add-member.component.scss'] styleUrls: ['./page-add-member.component.scss']
}) })
export class PageAddMemberComponent implements OnInit { export class PageAddMemberComponent implements OnInit {
public addMemberForm: FormGroup; public addMemberForm: FormGroup;
alert: any;
isShow!: boolean;
currentTeam: any;
constructor( constructor(
private membreService: MembreService, private membreService: MembreService,
private teamService: TeamService,
private mailService: MailService, private mailService: MailService,
private authService: AuthService,
private router: Router, private router: Router,
private fb: FormBuilder private fb: FormBuilder
) { ) {
@ -26,7 +31,11 @@ export class PageAddMemberComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
// *********************************pensser a changer group car déprécié******************************** /** Récuperer la team du membre connecté **/
this.teamService.getTeamById()?.subscribe((team) => {
this.currentTeam = team;
});
/** group est déprécié mais pas d'autres solutions sinon revoir la fonction confirmeValidator **/
this.addMemberForm = this.fb.group( this.addMemberForm = this.fb.group(
{ {
firstNameFc: new FormControl('', [Validators.required]), firstNameFc: new FormControl('', [Validators.required]),
@ -38,7 +47,7 @@ export class PageAddMemberComponent implements OnInit {
Validators.email, Validators.email,
Validators.required, Validators.required,
Validators.pattern(/^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/gim), Validators.pattern(/^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/gim),
]), // chercher une meilleure regex ]),
passwordFc: new FormControl('', [ passwordFc: new FormControl('', [
Validators.minLength(8), Validators.minLength(8),
Validators.required, Validators.required,
@ -55,8 +64,7 @@ export class PageAddMemberComponent implements OnInit {
} }
public onSubmit(): void { public onSubmit(): void {
console.log('value : ', this.addMemberForm.value); const idValue = this.addMemberForm.value[''];
console.log('form : ', this.addMemberForm);
const lastNameValue = this.addMemberForm.value['lastNameFc']; const lastNameValue = this.addMemberForm.value['lastNameFc'];
const firstNameValue = this.addMemberForm.value['firstNameFc']; const firstNameValue = this.addMemberForm.value['firstNameFc'];
const emailValue = this.addMemberForm.value['emailFc']; const emailValue = this.addMemberForm.value['emailFc'];
@ -68,6 +76,7 @@ export class PageAddMemberComponent implements OnInit {
const membre: Membre = { const membre: Membre = {
id: idValue,
nom: lastNameValue, nom: lastNameValue,
prenom: firstNameValue, prenom: firstNameValue,
email: emailValue, email: emailValue,
@ -89,17 +98,19 @@ export class PageAddMemberComponent implements OnInit {
if (membre.email !== '' && membre.password !== '') { if (membre.email !== '' && membre.password !== '') {
this.membreService.addMembre(membre)?.subscribe((resp) => { this.membreService.addMembre(membre)?.subscribe((_resp) => {
this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{ this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{
console.log("Mail envoyé"); return respMail
}) })
this.router.navigate(['compte']); this.router.navigate(['compte']);
}); });
} else { } else {
// affichage erreur this.alert={"type":"danger", "content":"Le membre n'a pas été rajouté"};
this.isShow = true;
} }
} }
/** Méthode pour compare le mot de passe et la confirmation de mot de passe **/
ConfirmedValidator(controlName: string, matchingControlName: string) { ConfirmedValidator(controlName: string, matchingControlName: string) {
return (formGroup: FormGroup) => { return (formGroup: FormGroup) => {
const control = formGroup.controls[controlName]; const control = formGroup.controls[controlName];

View File

@ -1,7 +1,11 @@
<app-header></app-header> <app-header></app-header>
<app-side-bar></app-side-bar> <app-side-bar></app-side-bar>
<app-alert *ngIf="isShow" [alert]="alert" (eventClose)="onClickCloseAlert();"></app-alert> <app-alert
*ngIf="isShow"
[alert]="alert"
(eventClose)="onClickCloseAlert()"
></app-alert>
<!-- <div <!-- <div
class="alert alert-{{ alert.type }}" class="alert alert-{{ alert.type }}"
@ -59,14 +63,16 @@
(click)="navigateNext($event)" (click)="navigateNext($event)"
>Next</a >Next</a
> >
<!-- DEBUT : Pour le debugage --> <!-- DEBUT : Pour le debugage -->
<span *ngIf="debug">team : {{ teamId }} - user: {{ userId }} - role: {{ role }}</span> <span *ngIf="debug"
>team : {{ teamId }} - user: {{ userId }} - role: {{ role }}</span
>
<!-- FIN : Pour le debugage --> <!-- FIN : Pour le debugage -->
<span style="float: right" <span style="float: right"
><a ><a
href="#" routerLink="/ajout-evenement"
class="btn btn-sm btn-primary" class="btn btn-sm btn-primary"
style="margin-right: 5px" style="margin-right: 5px"
>Ajouter un évènement</a >Ajouter un évènement</a

View File

@ -23,7 +23,7 @@ export class PageAgendaComponent implements AfterViewInit {
constructor(private evenementService:EvenementService, private tokenService: TokenService) { constructor(private evenementService:EvenementService, private tokenService: TokenService) {
this.isShow = false; this.isShow = false;
this.alert = ""; this.alert = "";
this.debug = environment.debug; this.debug = environment.debug; // Pour afficher ou pas les infos du token
} }
get date(): DayPilot.Date { get date(): DayPilot.Date {
@ -34,6 +34,7 @@ export class PageAgendaComponent implements AfterViewInit {
this.config.startDate = value; this.config.startDate = value;
} }
// config pour les option d'affichage du mini calendrier de navigation
navigatorConfig: DayPilot.NavigatorConfig = { navigatorConfig: DayPilot.NavigatorConfig = {
showMonths: 1, showMonths: 1,
skipMonths: 1, skipMonths: 1,
@ -45,16 +46,17 @@ export class PageAgendaComponent implements AfterViewInit {
titleHeight: 30 titleHeight: 30
}; };
// intialisation de events, pour accueillir les evenements
events: DayPilot.EventData[] = []; events: DayPilot.EventData[] = [];
// methode pour fermer l'alert de message
onClickCloseAlert(){ onClickCloseAlert(){
console.log('fermeture');
this.isShow = ! this.isShow; this.isShow = ! this.isShow;
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
} }
ngOnInit(): void { ngOnInit(): void {
this.userId = this.tokenService.getCurrentMembreId(); this.userId = this.tokenService.getCurrentMembreId();
this.teamId = this.tokenService.getCurrentTeamId(); this.teamId = this.tokenService.getCurrentTeamId();
@ -62,12 +64,15 @@ export class PageAgendaComponent implements AfterViewInit {
} }
// petite triche pour eviter la repetition du nom dans le RDV // petite triche pour eviter la repetition du nom dans le RDV
// on split sur un retour chariot pour ne conserver que la premiere partie
// qui est le titre de l'evenement
rdvSplit(rdv:any){ rdvSplit(rdv:any){
let titleRDV = rdv.split('\r'); let titleRDV = rdv.split('\r');
console.log(titleRDV[0]); console.log(titleRDV[0]);
return titleRDV[0]; return titleRDV[0];
} }
// config des options du calendrier
config: DayPilot.CalendarConfig = { config: DayPilot.CalendarConfig = {
startDate: DayPilot.Date.today(), startDate: DayPilot.Date.today(),
locale: "fr-fr", locale: "fr-fr",
@ -92,7 +97,7 @@ export class PageAgendaComponent implements AfterViewInit {
{ {
next: result => { next: result => {
this.viewChange(); this.viewChange();
this.alert={"type":"success", "content":"L'évènement à bien été modifié"}; this.alert={"type":"success", "content":"L'évènement a bien été modifié"};
this.isShow = true; this.isShow = true;
}, },
error: err => { error: err => {
@ -102,11 +107,11 @@ export class PageAgendaComponent implements AfterViewInit {
}, },
complete: () => console.log('DONE!') complete: () => console.log('DONE!')
} }
); );
}else{ }else{
this.viewChange(); this.viewChange();
this.alert={"type":"danger", "content":"Vous ne pouvez pas modifié cet évènement !"}; this.alert={"type":"danger", "content":"Vous ne pouvez pas modifier cet évènement !"};
this.isShow = true; this.isShow = true;
} }
}, },
@ -126,18 +131,7 @@ export class PageAgendaComponent implements AfterViewInit {
Object.assign(event, {id: ""}); Object.assign(event, {id: ""});
Object.assign(event, {membre: {id:this.userId}}); Object.assign(event, {membre: {id:this.userId}});
Object.assign(event, {team: {id:this.teamId}}); Object.assign(event, {team: {id:this.teamId}});
console.log("Event added: " + event); //console.log("Event added: " + event);
// let data = dp.events;
// Object.keys(data).map(function(key, index) {
// data[key] = {
// barColor:data[key].membre.couleur,
// //backColor:data[key].membre.couleur,
// "id": data[key].id,
// "start": data[key].start,
// "end": data[key].end,
// "text": data[key].text
// };
// });
this.evenementService.addEvenements(event).subscribe({ this.evenementService.addEvenements(event).subscribe({
next: result => { next: result => {
this.viewChange(); this.viewChange();
@ -172,7 +166,7 @@ export class PageAgendaComponent implements AfterViewInit {
}else{ }else{
this.viewChange(); this.viewChange();
this.alert={"type":"danger", "content":"Vous ne pouvez pas suprimé cet évènement !"}; this.alert={"type":"danger", "content":"Vous ne pouvez pas suprimé cet évènement !"};
this.isShow = true; this.isShow = true;
} }
}, },
eventResizeHandling: "Update", eventResizeHandling: "Update",
@ -206,11 +200,12 @@ export class PageAgendaComponent implements AfterViewInit {
}else{ }else{
this.viewChange(); this.viewChange();
this.alert={"type":"danger", "content":"Vous ne pouvez pas déplacé cet évènement !"}; this.alert={"type":"danger", "content":"Vous ne pouvez pas déplacé cet évènement !"};
this.isShow = true; this.isShow = true;
} }
} }
} }
// petite fonction pour eclaircir la couleur du membre a l'affichage de son evenement
adjust(color:string, amount:number) { adjust(color:string, amount:number) {
return '#' + color.replace(/^#/, '').replace(/../g, color => return '#' + color.replace(/^#/, '').replace(/../g, color =>
('0' + Math.min(255, Math.max(0, parseInt(color, 16) + amount)).toString(16)).substr(-2)); ('0' + Math.min(255, Math.max(0, parseInt(color, 16) + amount)).toString(16)).substr(-2));
@ -220,37 +215,23 @@ export class PageAgendaComponent implements AfterViewInit {
var from = this.calendar.control.visibleStart(); var from = this.calendar.control.visibleStart();
var to = this.calendar.control.visibleEnd(); var to = this.calendar.control.visibleEnd();
console.log("viewChange(): " + from + " " + to); // Récuperation des evenements d'une team
this.evenementService.getEvenementsByIdTeam(this.teamId).subscribe((data: any) => {
// this.ds.getEvents(from, to).subscribe(result => { Object.keys(data).map((key, index) => {
//this.events = this.evenements; data[key] = {
this.evenementService.getEvenementsByIdTeam(this.teamId).subscribe((data: any) => { barColor:data[key].membre.couleur,
// this.events = [{ backColor: this.adjust(data[key].membre.couleur, 90),
// "id": data[0].id, id: data[key].id,
// "start": data[0].eventDebut, start: data[key].start,
// "end": data[0].eventFin, end: data[key].end,
// "text": data[0].libelle, text: data[key].text.toUpperCase()+'\r('+data[key].membre.prenom+')',
// barColor: data[0].membre.couleur, tags : {membre: data[key].membre.id}
// //cssClass: "toto" };
// }];
Object.keys(data).map((key, index) => {
data[key] = {
barColor:data[key].membre.couleur,
backColor: this.adjust(data[key].membre.couleur, 90),
id: data[key].id,
start: data[key].start,
end: data[key].end,
text: data[key].text.toUpperCase()+'\r('+data[key].membre.prenom+')',
tags : {
membre: data[key].membre.id
}
};
});
this.events = data;
console.log(data);
console.log(this.events);
}); });
// }); this.events = data;
console.log(data);
console.log(this.events);
});
} }
navigatePrevious(event: MouseEvent): void { navigatePrevious(event: MouseEvent): void {

View File

@ -1,7 +1,7 @@
<app-header></app-header> <app-header></app-header>
<div class="row"> <div class="row">
<div class="col-md-auto"> <div class="col-md-auto">
<app-side-bar></app-side-bar> <app-side-bar [backgroundColor]="'#5a1e63'"></app-side-bar>
</div> </div>
<div class="ajoutContact-form text-center"> <div class="ajoutContact-form text-center">
<h3>Ajouter un contact</h3> <h3>Ajouter un contact</h3>
@ -87,53 +87,6 @@
<label for="floatingInputfirstName">Adresse</label> <label for="floatingInputfirstName">Adresse</label>
</div> </div>
<div class="form-floating">
<input
type="text"
class="form-control"
id="floatingInputTelephone"
placeholder=""
name="telephone"
formControlName="telephoneFc"
/>
<label for="floatingInputfirstName">Téléphone</label>
</div>
<div class="form-floating">
<input
type="email"
class="form-control"
id="floatingInput"
placeholder=""
name="email"
formControlName="emailFc"
/>
<label for="floatingInput">Adresse email</label>
</div>
<div class="form-floating">
<input
type="date"
class="form-control"
id="floatingInputdateNaissance"
placeholder=""
name="dateNaissance"
formControlName="dateNaissanceFc"
/>
<label for="floatingInputfirstName">Date de naissance</label>
</div>
<div class="form-floating">
<input
type="text"
class="form-control"
id="floatingInputAdresse"
placeholder=""
name="adresse"
formControlName="adresseFc"
/>
<label for="floatingInputfirstName">Adresse</label>
</div>
<button <button
class="w-100 btn btn-lg btn-secondary" class="w-100 btn btn-lg btn-secondary"
type="submit" type="submit"
@ -144,4 +97,5 @@
</form> </form>
</main> </main>
</div> </div>
<app-footer></app-footer>
</div> </div>

View File

@ -63,7 +63,7 @@ export class PageAjoutContactComponent implements OnInit {
email: emailValue, email: emailValue,
dateNaissance: dateNaissanceValue, dateNaissance: dateNaissanceValue,
adresse: adresseValue, adresse: adresseValue,
team: { id: teamId }, // changer l'id quand la personne est logé => recuperer l'id de la team du membre team: { id: teamId },
}; };
if (contact.nom !== '') { if (contact.nom !== '') {

View File

@ -0,0 +1,78 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar class="sidebarMenu"></app-side-bar>
</div>
<div class="col-md-4 offset-md-4 text-center">
<h2>Ajouter un évènement à l'agenda</h2>
<div class="text-center col-md-7 offset-md-3">
<main class="form-ajout-evenement">
<form (ngSubmit)="onSubmit()" [formGroup]="eventForm">
<div class="row g-2">
<div class="col-md">
<div class="form-floating">
<input type="date"
class="form-control"
id="floatingInputDebut"
placeholder=""
name="startDate"
formControlName="startDateFc">
<label for="floatingInputfirstName">Date de début</label>
</div>
</div>
<div class="col-md">
<div class="form-floating">
<input type="time"
class="form-control"
id="floatingInputDebut"
placeholder=""
name="startHour"
formControlName="startHourFc">
<label for="floatingInputfirstName">Heure de début</label>
</div>
</div>
</div>
<div class="row g-2">
<div class="col-md">
<div class="form-floating">
<input type="date"
class="form-control"
id="floatingInputFin"
placeholder=""
name="endDate"
formControlName="endDateFc">
<label for="floatingInputlastName">Date de fin</label>
</div>
</div>
<div class="col-md">
<div class="form-floating">
<input type="time"
class="form-control"
id="floatingInputFin"
placeholder=""
name="endHour"
formControlName="endHourFc">
<label for="floatingInputlastName">Heure de fin</label>
</div>
</div>
</div>
<div class="form-floating">
<input type="text"
class="form-control"
id="floatingInputText"
placeholder=""
name="text"
formControlName="textFc">
<label for="floatingInputlastName">Libelle</label>
</div>
<button class="btn btn-lg btn-primary"
type="submit"
[disabled]="eventForm.invalid">Ajouter</button>
<a routerLink="../agenda" class="btn btn-lg btn-primary">Annuler</a>
</form>
</main>
</div>
</div>
</div>
<app-footer></app-footer>

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageAjoutEvenementsComponent } from './page-ajout-evenements.component';
describe('PageAjoutEvenementsComponent', () => {
let component: PageAjoutEvenementsComponent;
let fixture: ComponentFixture<PageAjoutEvenementsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageAjoutEvenementsComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageAjoutEvenementsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,71 @@
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { EvenementService } from 'src/app/services/evenement.service';
import { TokenService } from 'src/app/services/token.service';
@Component({
selector: 'app-page-ajout-evenements',
templateUrl: './page-ajout-evenements.component.html',
styleUrls: ['./page-ajout-evenements.component.scss']
})
export class PageAjoutEvenementsComponent implements OnInit {
public eventForm: FormGroup;
public userId : any;
public teamId : any;
public isShow: boolean;
public alert:any;
constructor(private evenementService:EvenementService, private tokenService: TokenService, private router: Router,) {
this.eventForm = new FormGroup({});
this.isShow = false;
this.alert = "";
}
ngOnInit(): void {
this.userId = this.tokenService.getCurrentMembreId();
this.teamId = this.tokenService.getCurrentTeamId();
this.eventForm = new FormGroup({
startDateFc : new FormControl(''),
startHourFc : new FormControl(''),
endDateFc : new FormControl(''),
endHourFc : new FormControl(''),
textFc : new FormControl('', [ Validators.required])
})
}
public onSubmit(): void {
const startDateValue = this.eventForm.value['startDateFc'];
const startHourValue = this.eventForm.value['startHourFc'];
const endDateValue = this.eventForm.value['endDateFc'];
const endHourValue = this.eventForm.value['endHourFc'];
const textValue = this.eventForm.value['textFc'];
const event = {
start: startDateValue+'T'+startHourValue+':00',
end: endDateValue+'T'+endHourValue+':00',
text: textValue,
id:"",
membre: {id:this.userId},
team: {id:this.teamId}
}
this.evenementService.addEvenements(event).subscribe({
next: result => {
this.alert={"type":"success", "content":"L'évènement à été correctement ajouté au calendrier"};
this.isShow = true;
},
error: err => {
this.alert={"type":"danger", "content":"Problème lors de l'ajout de l'évenment"};
this.isShow = true;
},
complete: () => {
console.log('DONE!');
this.router.navigate(['agenda']);
}
});
}
}

View File

@ -2,30 +2,37 @@
<app-side-bar></app-side-bar> <app-side-bar></app-side-bar>
<div class="container"> <div class="container">
<div> <div class="row p-1 col-12 ">
<h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
</div> <div class="row ">
<div class="row d-flex align-items-center flex-row"> <h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
<div class="col-sm-3 col-xs-6 box border" id="boxThree">
<app-meteo></app-meteo>
</div>
<div class="col-sm-3 col-xs-6 box border" id="boxTwo">
<app-calendrier>A venir</app-calendrier>
</div> </div>
<div class="row"> <div class="row col-12">
<div class="col-sm-3 col-xs-6 box border" id="boxFour">
<div> <div class="col-5 d-flex flex-column align-items-start">
<div class="d-flex justify-content-center w-100 my-2" id="boxThree">
<app-meteo></app-meteo>
</div>
<div class="d-flex justify-content-center w-100 my-2">
<app-humeur></app-humeur> <app-humeur></app-humeur>
</div> </div>
</div> </div>
<div class=" col-7" id="boxTwo">
<app-calendrier class="w-100 h-100">A venir</app-calendrier>
</div>
</div> </div>
<div class="row avatar"> <div class="row d-flex flex-wrap my-2 p-1">
<div class="col" *ngFor="let membreData of listMembres"> <ul class="list-inline">
<app-card-avatar [membre]="membreData"> </app-card-avatar> <li class="list-inline-item" *ngFor="let membreData of listMembres">
<app-card-avatar class="avatar" [membre]="membreData"> </app-card-avatar>
</li>
</ul>
</div> </div>
</div>
</div> </div>
</div> </div>

View File

@ -11,40 +11,9 @@
} }
.container { .container {
display: flex; margin-left:200px;
padding: 20px;
}
button{
margin-bottom: 5px;
}
.calendrier{
align-content: flex-end;
}
#boxFour{
height: 150px;
margin-top: -99px;
width: fit-content;
}
#boxThree{
margin-top: -85px;
height: 150px;
width: fit-content;
}
#boxTwo{
margin-top: 50px;
margin-left: 150px;
height: 50%;
width: fit-content;
} }
.avatar{ .avatar{
margin-top: -50px; margin:O;
justify-content: space-between;
margin: 0;
} }

View File

@ -1,12 +0,0 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<h1>Supprimer votre compte</h1>
<main class="contenu-compte">
</main>
</div>
</div>

View File

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageDeleteAccountComponent } from './page-delete-account.component';
describe('PageDeleteAccountComponent', () => {
let component: PageDeleteAccountComponent;
let fixture: ComponentFixture<PageDeleteAccountComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageDeleteAccountComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageDeleteAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-delete-account',
templateUrl: './page-delete-account.component.html',
styleUrls: ['./page-delete-account.component.scss']
})
export class PageDeleteAccountComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1,16 +1,11 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { AuthService } from '../../services/auth.service'; import { AuthService } from '../../services/auth.service';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
import { Membre } from 'src/app/models/membre'; import { Membre } from 'src/app/models/membre';
import { MailService } from 'src/app/services/mail.service'; import { MailService } from 'src/app/services/mail.service';
import { Mail } from 'src/app/models/mail'; import { Mail } from 'src/app/models/mail';
@Component({ @Component({
selector: 'app-page-forgot-password', selector: 'app-page-forgot-password',
templateUrl: './page-forgot-password.component.html', templateUrl: './page-forgot-password.component.html',
@ -20,7 +15,7 @@ export class PageForgotPasswordComponent implements OnInit {
alert : any; alert : any;
isShow : boolean; isShow : boolean;
constructor(private authService: AuthService, private router: Router, private mailService: MailService,) { constructor(private authService: AuthService, private router: Router, private mailService: MailService,) {
this.alert = ""; this.alert = "";
this.isShow = false; this.isShow = false;
@ -30,6 +25,7 @@ export class PageForgotPasswordComponent implements OnInit {
public onSubmit(submittedForm: any): void { public onSubmit(submittedForm: any): void {
const membre: Membre = { const membre: Membre = {
id: "",
nom: "", nom: "",
prenom: "", prenom: "",
dateNaissance: new Date(), dateNaissance: new Date(),
@ -41,9 +37,7 @@ export class PageForgotPasswordComponent implements OnInit {
}; };
console.log(membre); console.log(membre);
// this.authService.forgotPassword(membre).subscribe((resp) => {
// console.log('----'+resp)
// });
this.authService.forgotPassword(membre).subscribe( this.authService.forgotPassword(membre).subscribe(
{ {
@ -65,12 +59,12 @@ export class PageForgotPasswordComponent implements OnInit {
}) })
}, },
error: err => { error: err => {
this.alert={"type":"danger", "content":"Le mail a merdé, ou il n'y a personne ds la bdd !"}; this.alert={"type":"danger", "content":"Votre email est erroné"};
this.isShow = true; this.isShow = true;
}, },
complete: () => console.log('DONE!') complete: () => console.log('DONE!')
} }
); );

View File

@ -11,3 +11,4 @@
</main> </main>
</div> </div>
</div> </div>
<app-footer></app-footer>

View File

@ -1,7 +1,7 @@
<app-header></app-header> <app-header></app-header>
<div class="row"> <div class="row">
<div class="col-md-auto"> <div class="col-md-auto">
<app-side-bar></app-side-bar> <app-side-bar [backgroundColor]="'#5a1e63'"></app-side-bar>
</div> </div>
<div class="modifContact-form text-center"> <div class="modifContact-form text-center">
@ -11,7 +11,8 @@
<div class="form-floating"> <div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur" <input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
formControlName="couleurFc" value= "{{ listContactInfo.couleur }}"> formControlName="couleurFc" value= "{{ listContactInfo.couleur }}"
[(ngModel)]="listContactInfo.couleur">
</div> </div>
<div class="form-floating"> <div class="form-floating">
@ -20,10 +21,10 @@
id="floatingInputlastName" id="floatingInputlastName"
placeholder="" placeholder=""
name="lastName" name="lastName"
formControlName="lastNameFc" value= "{{ listContactInfo.nom }}"> formControlName="lastNameFc" value= "{{ listContactInfo.nom }}"
[(ngModel)]="listContactInfo.nom">
<label for="floatingInputlastName">Nom</label> <label for="floatingInputlastName">Nom</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input type="text" <input type="text"
@ -31,10 +32,10 @@
id="floatingInputfirstName" id="floatingInputfirstName"
placeholder="" placeholder=""
name="firstName" name="firstName"
formControlName="firstNameFc" value= "{{ listContactInfo.prenom }}"> formControlName="firstNameFc" value= "{{ listContactInfo.prenom }}"
[(ngModel)]="listContactInfo.prenom">
<label for="floatingInputfirstName">Prénom</label> <label for="floatingInputfirstName">Prénom</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input type="text" <input type="text"
@ -42,10 +43,10 @@
id="floatingInputTelephone" id="floatingInputTelephone"
placeholder="" placeholder=""
name="telephone" name="telephone"
formControlName="telephoneFc" value= "{{ listContactInfo.telephone }}"> formControlName="telephoneFc" value= "{{ listContactInfo.telephone }}"
[(ngModel)]="listContactInfo.telephone">
<label for="floatingInputfirstName">Téléphone</label> <label for="floatingInputfirstName">Téléphone</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input type="email" <input type="email"
@ -53,37 +54,40 @@
id="floatingInput" id="floatingInput"
placeholder="" placeholder=""
name="email" name="email"
formControlName="emailFc" value= "{{ listContactInfo.email }}"> formControlName="emailFc" value= "{{ listContactInfo.email }}"
[(ngModel)]="listContactInfo.email">
<label for="floatingInput">Adresse email</label> <label for="floatingInput">Adresse email</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input type="date" <input type="date"
class="form-control" class="form-control"
id="floatingInputdateNaissance" id="floatingInputdateNaissance"
placeholder="" placeholder=""
name="dateNaissance" name="dateNaissance"
formControlName="dateNaissanceFc" value= "{{ listContactInfo.dateNaissance }}"> formControlName="dateNaissanceFc"
value= "{{ listContactInfo.dateNaissance }}"
[(ngModel)]="listContactInfo.dateNaissance">
<label for="floatingInputfirstName">Date de naissance</label> <label for="floatingInputfirstName">Date de naissance</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input type="text" <input type="text"
class="form-control" class="form-control"
id="floatingInputAdresse" id="floatingInputAdresse"
placeholder="" placeholder=""
name="adresse" name="adresse"
formControlName="adresseFc" value= "{{ listContactInfo.adresse }}"> formControlName="adresseFc" value= "{{ listContactInfo.adresse }}"
[(ngModel)]="listContactInfo.adresse">
<label for="floatingInputfirstName">Adresse</label> <label for="floatingInputfirstName">Adresse</label>
</div> </div>
<button class="w-100 btn btn-lg btn-secondary" <button class="w-100 btn btn-lg btn-secondary"
type="submit" type="submit"
[disabled]="modifContactForm.invalid">Valider</button> >Valider</button>
</form> </form>
</main> </main>
</div> </div>
<app-footer></app-footer>
</div> </div>

View File

@ -2,10 +2,10 @@
<div class="row"> <div class="row">
<div class="col-md-auto"> <div class="col-md-auto">
<app-side-bar></app-side-bar> <app-side-bar [backgroundColor]="'#5a1e63'"></app-side-bar>
</div> </div>
<div class="col compte text-center py-3 border"> <div class="col compte text-center py-3">
<div> <div>
<button <button
*ngIf="parent" *ngIf="parent"
@ -34,7 +34,7 @@
<div class="row justify-content-evenly"> <div class="row justify-content-evenly">
<div class="col-4"> <div class="col-4">
<div <div
class="row my-3 d-flex justify-content-center flex-row" class="row my-3 d-flex justify-content-center flex-row pointer"
*ngFor="let personne of listContact" *ngFor="let personne of listContact"
(click)="onClick(personne)" (click)="onClick(personne)"
> >
@ -58,4 +58,6 @@
</div> </div>
</div> </div>
</div> </div>
<app-footer></app-footer>
</div> </div>

View File

@ -31,4 +31,8 @@
.h4 { .h4 {
color: black; color: black;
font-weight: bold; font-weight: bold;
}
.pointer{
cursor: pointer;
} }

View File

@ -36,16 +36,6 @@ export class PageResetPasswordComponent implements OnInit {
); );
} }
// public onSubmit(submittedForm: any): void {
// console.log(submittedForm.form.value);
// const password = submittedForm.form.value['password'];
// console.log(email);
// this.authService.resetPassword(email, password).subscribe((resp: any) => {
// window.alert("Votre mot de passe est bien ré-initialisé !")
// this.router.navigate(['accueil']);
// });
// }
public onSubmit(): void { public onSubmit(): void {
console.log('value : ', this.resetForm.value); console.log('value : ', this.resetForm.value);
@ -54,6 +44,7 @@ export class PageResetPasswordComponent implements OnInit {
const passwordConfirmValue = this.resetForm.value['passwordConfirmFc']; const passwordConfirmValue = this.resetForm.value['passwordConfirmFc'];
const membre: Membre = { const membre: Membre = {
id: "",
nom: "", nom: "",
prenom: "", prenom: "",
dateNaissance: new Date(), dateNaissance: new Date(),

View File

@ -4,10 +4,30 @@
<label for="floatingInputcouleur">Choisissez une couleur</label> <label for="floatingInputcouleur">Choisissez une couleur</label>
<main class="form-signup"> <main class="form-signup">
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm"> <form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
<div class="form-floating"> <div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur" <input type="color" class="form-control" id="floatingInputcouleur" placeholder=""
formControlName="couleurFc"> name="couleur"
</div> formControlName="couleurFc">
</div>
<div class="form-floating">
<input
type="text"
class="form-control"
id="floatingInputteamName"
placeholder=""
name="teamName"
formControlName="teamNameFc"
[ngClass]="{
'is-valid':
signupForm.controls['teamNameFc'].touched &&
signupForm.controls['teamNameFc'].valid,
'is-invalid':
signupForm.controls['teamNameFc'].touched &&
!signupForm.controls['teamNameFc'].valid
}"
/>
<label for="floatingInputlastName">Le nom de votre team</label>
</div>
<div class="form-floating"> <div class="form-floating">
<input <input
type="text" type="text"
@ -25,7 +45,7 @@
!signupForm.controls['lastNameFc'].valid !signupForm.controls['lastNameFc'].valid
}" }"
/> />
<label for="floatingInputlastName">VOTRE NOM</label> <label for="floatingInputlastName">Votre nom</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -44,7 +64,7 @@
!signupForm.controls['firstNameFc'].valid !signupForm.controls['firstNameFc'].valid
}" }"
/> />
<label for="floatingInputfirstName">VOTRE PRENOM</label> <label for="floatingInputfirstName">Votre prénom</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -63,7 +83,7 @@
!signupForm.controls['dateNaissanceFc'].valid !signupForm.controls['dateNaissanceFc'].valid
}" }"
/> />
<label for="floatingInputdateNaissance">VOTRE DATE DE NAISSANCE</label> <label for="floatingInputdateNaissance">Votr date de naissance</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -82,7 +102,7 @@
!signupForm.controls['emailFc'].valid !signupForm.controls['emailFc'].valid
}" }"
/> />
<label for="floatingInputemail">VOTRE EMAIL</label> <label for="floatingInputemail">Votre adresse mail</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -101,7 +121,7 @@
!signupForm.controls['passwordFc'].valid !signupForm.controls['passwordFc'].valid
}" }"
/> />
<label for="floatingPassword">MOT DE PASSE</label> <label for="floatingPassword">Votre mot de passe</label>
</div> </div>
<div class="form-floating"> <div class="form-floating">
<input <input
@ -120,7 +140,7 @@
!signupForm.controls['passwordConfirmFc'].valid !signupForm.controls['passwordConfirmFc'].valid
}" }"
/> />
<label for="floatingPasswordConfirm">CONFIRMEZ VOTRE MOT DE PASSE</label> <label for="floatingPasswordConfirm">Confirmez votre mot de passe</label>
</div> </div>
<button <button

View File

@ -16,6 +16,7 @@ import { AuthService } from '../../services/auth.service';
}) })
export class PageSignupComponent implements OnInit { export class PageSignupComponent implements OnInit {
public signupForm: FormGroup; public signupForm: FormGroup;
constructor( constructor(
private authService: AuthService, private authService: AuthService,
private router: Router, private router: Router,
@ -54,8 +55,7 @@ export class PageSignupComponent implements OnInit {
} }
public onSubmit(): void { public onSubmit(): void {
console.log('value : ', this.signupForm.value); const idValue = this.signupForm.value[''];
console.log('form : ', this.signupForm);
const prenomValue = this.signupForm.value['firstNameFc']; const prenomValue = this.signupForm.value['firstNameFc'];
const nomValue = this.signupForm.value['lastNameFc']; const nomValue = this.signupForm.value['lastNameFc'];
const emailValue = this.signupForm.value['emailFc']; const emailValue = this.signupForm.value['emailFc'];
@ -66,6 +66,7 @@ export class PageSignupComponent implements OnInit {
const roleValue = ['ROLE_PARENT']; const roleValue = ['ROLE_PARENT'];
const membre: Membre = { const membre: Membre = {
id: idValue,
nom: nomValue, nom: nomValue,
prenom: prenomValue, prenom: prenomValue,
email: emailValue, email: emailValue,
@ -84,7 +85,7 @@ export class PageSignupComponent implements OnInit {
// affichage erreur // affichage erreur
} }
} }
/** Méthode pour compare le mot de passe et la confirmation de mot de passe **/
ConfirmedValidator(controlName: string, matchingControlName: string) { ConfirmedValidator(controlName: string, matchingControlName: string) {
return (formGroup: FormGroup) => { return (formGroup: FormGroup) => {
const control = formGroup.controls[controlName]; const control = formGroup.controls[controlName];

View File

@ -25,3 +25,5 @@
</div> </div>
</div> </div>
</div> </div>
<app-footer></app-footer>

View File

@ -21,6 +21,7 @@ export class PageToDoListComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
//récupère les todoLists existantes en fonctoin de l'id de la team en utilisant le service
this.TodoService.getToDoListByTeamId()?.subscribe((listTodos: any) => { this.TodoService.getToDoListByTeamId()?.subscribe((listTodos: any) => {
console.log(listTodos); console.log(listTodos);
this.listTodos = listTodos; this.listTodos = listTodos;
@ -28,23 +29,21 @@ export class PageToDoListComponent implements OnInit {
this.idTodo = 0; this.idTodo = 0;
}); });
} }
//Ajouter une todo List
//Ajouter une todo List si l'input n'est pas vide
addTodoByTeamId() { addTodoByTeamId() {
const todoList: ToDoList = { const todoList: ToDoList = {
nom: this.todoListTitle, nom: this.todoListTitle,
taches: [], taches: [],
id: 0, id: 0,
}; };
this.TodoService.addTodoByTeamId(todoList)?.subscribe((resp) => { if (this.todoListTitle != '') {
console.log(todoList); this.TodoService.addTodoByTeamId(todoList)?.subscribe((resp) => {
window.location.reload(); console.log(todoList);
}); window.location.reload(); //rafraîchit l'aperçu
} });
}else{
deleteTodo(id: number): void { window.alert('Il faut saisir du texte'); // sinon msg d'erreur
window.alert('La to-do-List a bien été supprimé!'); }
this.TodoService.deleteTodoById(id).subscribe((resp) => {
window.location.reload();
});
} }
} }

View File

@ -1,11 +0,0 @@
<app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar>
</div>
<div class="col compte text-center">
<h1>Modifier votre compte</h1>
<main class="contenu-compte"></main>
</div>
</div>

View File

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageUpdateAccountComponent } from './page-update-account.component';
describe('PageUpdateAccountComponent', () => {
let component: PageUpdateAccountComponent;
let fixture: ComponentFixture<PageUpdateAccountComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageUpdateAccountComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageUpdateAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-update-account',
templateUrl: './page-update-account.component.html',
styleUrls: ['./page-update-account.component.scss']
})
export class PageUpdateAccountComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -1,11 +1,112 @@
<app-header></app-header> <app-header></app-header>
<app-side-bar></app-side-bar>
<div class="row"> <div class="container-fluid">
<div class="col-md-auto"> <div class="row">
<app-side-bar></app-side-bar> <div class="col-9 offset-2" id="main">
</div> <h1 class="d-flex justify-content-center">Modifier profil</h1>
<div class="col compte text-center"> <div class="form-updateMember">
<h1>Modifier ce membre</h1> <form (ngSubmit)="onSubmit()" [formGroup]="updateMembreForm">
<main class="contenu-compte"></main> <div class="form-floating input">
<input
type="color"
class="form-control"
id="floatingInputcouleur"
placeholder=""
name="couleur"
formControlName="couleurFc"
value="{{membreInfos.couleur}}"
[(ngModel)]="membreInfos.couleur"
/>
</div>
<label for="floatingInputcouleur" class="d-flex justify-content-center" >Choisissez une couleur</label>
<div class="form-floating">
<input
type="text"
class="form-control"
id="floatingInputlastName"
placeholder=""
name="lastName"
formControlName="lastNameFc"
value="{{membreInfos.nom}}"
[(ngModel)]="membreInfos.nom"
/>
<label for="floatingInputlastName">Nom</label>
</div>
<div class="form-floating">
<input
type="text"
class="form-control"
id="floatingInputfirstName"
placeholder=""
name="firstName"
formControlName="firstNameFc"
value="{{membreInfos.prenom}}"
[(ngModel)]="membreInfos.prenom"
/>
<label for="floatingInputfirstName">Prénom</label>
</div>
<div class="form-floating ">
<input
type="date"
class="form-control"
id="floatingInputdateNaissance"
placeholder=""
name="dateNaissance"
formControlName="dateNaissanceFc"
value="{{membreInfos.dateNaissance}}"
[(ngModel)]="membreInfos.dateNaissance"
/>
<label for="floatingInputdateNaissance"
>Date de naissance</label
>
</div>
<div class="form-floating">
<input
type="email"
class="form-control"
id="floatingInputemail"
placeholder=""
name="email"
formControlName="emailFc"
value="{{membreInfos.email}}"
[(ngModel)]="membreInfos.email"
/>
<label for="floatingInputemail">Email</label>
</div>
<div class="form-floating select">
<select
class="form-control"
id="floatingInputRole"
placeholder=""
name="Role"
formControlName="roleFc"
value="{{membreInfos.roleList}}"
[(ngModel)]="membreInfos.roleList"
>
<option value="ROLE_PARENT">Adulte</option>
<option value="ROLE_ENFANT">Enfant</option>
</select>
<label value="ROLE_PARENT">Sélectionnez un profil</label>
</div>
<div class="form-floating">
<input hidden
type="password"
class="form-control"
id="floatingPassword"
placeholder=""
name="password"
formControlName="passwordFc"
value="{{membreInfos.password}}"
[(ngModel)]="membreInfos.password"
/>
</div>
<button
class="w-100 btn btn-lg btn-outline-success"
type="submit"
>Valider
</button>
</form>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,80 @@
.login-form {
height: 100vh;
padding-top: 40px;
background-color: #f5f5f5;
}
h1{
color: rgba(0, 0, 0, 0.658);
font-size: 34px;
margin-top: 20px;
}
.form-updateMember {
width: 100%;
max-width: 330px;
padding: 15px;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
border: solid 1px;
border-radius: 10px;
background-color: #fcddec;
border-color: #ef5da8;
}
.form-updateMember .checkbox {
font-weight: 400;
}
.form-updateMember .form-floating:focus-within {
z-index: 2;
}
.form-updateMember input[type="email"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-updateMember input[type="color"] {
border: none;
margin-bottom: 10px;
margin-top: -70px;
margin-left: 100px;
border-radius: 50%;
width: 100px;
height: 100px;
}
.form-updateMember input[type="color"]::-webkit-color-swatch {
border: none;
margin-top: -15px;
border-radius: 80%;
width: 80px;
height: 80px;
}
.form-updateMember input[type="text"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-updateMember input[type="date"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-updateMember input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.btn-outline-success {
margin-top: 10px;
background-color: #ffff;
color: #ef5da8 !important;
border-color: #ef5da8 !important;
}

View File

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { Membre } from 'src/app/models/membre';
import { MembreService } from 'src/app/services/membre.service';
@Component({ @Component({
selector: 'app-page-update-member', selector: 'app-page-update-member',
@ -6,10 +10,121 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./page-update-member.component.scss'] styleUrls: ['./page-update-member.component.scss']
}) })
export class PageUpdateMemberComponent implements OnInit { export class PageUpdateMemberComponent implements OnInit {
public updateMembreForm: FormGroup;
public membreData: FormGroup;
public membreInfos: any;
public membreId: any;
constructor() { }
constructor(private membreService: MembreService,
private router: Router,
private fb: FormBuilder,
private route: ActivatedRoute) {
this.updateMembreForm = new FormGroup({});
this.membreData = this.initForm();
this.membreInfos = '';
}
ngOnInit(): void { ngOnInit(): void {
/** Pour récuperer l'id du membre à modifier **/
this.membreId = this.route.snapshot.paramMap.get('id');
/** Appel Api **/
this.membreService
.getMembreId(this.membreId)
.subscribe((membreInfos: any) => {
this.membreInfos = membreInfos;
});
/** group est déprécié mais pas d'autres solutions sinon revoir la fonction confirmeValidator **/
this.updateMembreForm = this.fb.group(
{
firstNameFc: new FormControl('', [Validators.required]),
lastNameFc: new FormControl('', [Validators.required]),
dateNaissanceFc: new FormControl('', [Validators.required]),
roleFc: new FormControl('', []),
couleurFc: new FormControl('', []),
emailFc: new FormControl('', [
Validators.email,
Validators.required,
Validators.pattern(/^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/gim),
]),
passwordFc: new FormControl('', [
Validators.minLength(8),
]),
passwordConfirmFc: new FormControl('', [
Validators.minLength(8),
]),
},
{
validator: this.ConfirmedValidator('passwordFc', 'passwordConfirmFc'),
}
)};
/** Méthode qui initialise les champs du formulaire avec les infos de la BDD **/
private initForm(membre?: Membre): FormGroup {
return this.fb.group({
nom:[membre ? membre.nom : ''],
prenom: [membre ? membre.prenom : ''],
email: [membre ? membre.email : ''],
password: [membre ? membre.password : ''],
couleur: [membre ? membre.couleur : ''],
dateNaissance: [membre ? membre.dateNaissance : ''],
passwordConfirm: [membre ? membre.passwordConfirm : ''],
roleList: [membre ? membre.roleList : ['']],
});
} }
/** Méthode qui envoie les champs modifiés pour mise à jour **/
public onSubmit(): void {
const firstNameValue = this.updateMembreForm.value['firstNameFc'];
const lastNameValue = this.updateMembreForm.value['lastNameFc'];
const emailValue = this.updateMembreForm.value['emailFc'];
const passwordValue = this.updateMembreForm.value['passwordFc'];
const dateNaissanceValue = this.updateMembreForm.value['dateNaissanceFc'];
const couleurValue = this.updateMembreForm.value['couleurFc'];
const passwordConfirmValue = this.updateMembreForm.value['passwordConfirmFc'];
const roleValue = this.updateMembreForm.value['roleFc'];
const membre: Membre = {
id: this.membreId,
nom: lastNameValue,
prenom: firstNameValue,
email: emailValue,
password: passwordValue,
dateNaissance: dateNaissanceValue,
couleur: couleurValue,
passwordConfirm: passwordConfirmValue,
roleList: [roleValue]
};
console.log(membre);
this.membreService.updateMembre(membre)?.subscribe((resp) => {
//this.router.navigate(['compte']);
});
}
/** Méthode pour compare le mot de passe et la confirmation de mot de passe **/
ConfirmedValidator(controlName: string, matchingControlName: string) {
return (formGroup: FormGroup) => {
const control = formGroup.controls[controlName];
const matchingControl = formGroup.controls[matchingControlName];
if (
matchingControl.errors &&
!matchingControl.errors['confirmedValidator']
) {
return;
}
if (control.value !== matchingControl.value) {
matchingControl.setErrors({ confirmedValidator: true });
} else {
matchingControl.setErrors(null);
}
};
}
} }

View File

@ -14,7 +14,6 @@ export class AuthInterceptor implements HttpInterceptor {
constructor(private tokenService: TokenService) {} constructor(private tokenService: TokenService) {}
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> { intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
console.log('Coucou je suis le videur ! ');
const token = this.tokenService.getToken(); const token = this.tokenService.getToken();
if(token) { if(token) {

View File

@ -19,6 +19,7 @@ export class AuthService {
this.tokenKey = environment.tokenKey; this.tokenKey = environment.tokenKey;
} }
//methode pour s'inscrire - on passe l'objet en entier
signup(membre: Membre): Observable<any> { signup(membre: Membre): Observable<any> {
console.log(membre); console.log(membre);
@ -26,17 +27,15 @@ export class AuthService {
} }
//methode pour se connecter - on passe id et pwd
signin(email: string, password: string): Observable<any> { signin(email: string, password: string): Observable<any> {
const body = { const body = {
email: email, email: email,
password: password, password: password,
}; };
console.log('Mon body : ', body);
return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe( return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe(
map((x: any) => { map((x: any) => {
console.log('Service : ', x.token);
localStorage.setItem(this.tokenKey, x.token); localStorage.setItem(this.tokenKey, x.token);
return x; // permet de renvoyer la réponse à l'initiateur (page Signin) après le traitement du map return x; // permet de renvoyer la réponse à l'initiateur (page Signin) après le traitement du map
}) })
@ -44,10 +43,12 @@ export class AuthService {
} }
//permet d'envoyer un mail à l'utilisateur pour qu'il change son pwd
forgotPassword(membre: Membre): Observable<any> { forgotPassword(membre: Membre): Observable<any> {
return this.http.post(`${this.apiUrl}/membres/forgot-password`, membre, {responseType: "text"}); return this.http.post(`${this.apiUrl}/membres/forgot-password`, membre, {responseType: "text"});
} }
//permet à l'utilisateur de changer son pwd
resetPassword(membre: Membre, uuid:string): Observable<any> { resetPassword(membre: Membre, uuid:string): Observable<any> {
console.log('--'+uuid+' / '+membre); console.log('--'+uuid+' / '+membre);
return this.http.put(`${this.apiUrl}/membres/reset-password/${uuid}`, membre); return this.http.put(`${this.apiUrl}/membres/reset-password/${uuid}`, membre);

View File

@ -49,7 +49,12 @@ export class MembreService {
return this.http.delete(`${this.apiUrl}/membres/delete/1`); return this.http.delete(`${this.apiUrl}/membres/delete/1`);
} }
updateMembre(membre: Membre): Observable<any> { updateMembre(membre: Membre): Observable<any> | void {
return this.http.put(`${this.apiUrl}/membres/update/1`, membre); const teamId = this.tokenService.getCurrentTeamId();
} if (teamId){
return this.http.put(`${this.apiUrl}/membres/update/${teamId}/${membre.id}`, membre);
}else {
this.router.navigate(['accueil']);
}
}
} }

View File

@ -19,7 +19,7 @@ apiUrl: string;
this.apiUrl = environment.apiUrl; this.apiUrl = environment.apiUrl;
} }
//on affiche les menus d'une team //on affiche les menus d'une team - on récupère l'id de la team dans le token
getMenu(): Observable<any> | void { getMenu(): Observable<any> | void {
const teamId = this.tokenService.getCurrentTeamId(); const teamId = this.tokenService.getCurrentTeamId();
if (teamId){ if (teamId){
@ -33,6 +33,7 @@ apiUrl: string;
return this.http.get(`${this.apiUrl}/menus/` + id); return this.http.get(`${this.apiUrl}/menus/` + id);
} }
//permet d'ajouter un menu et de lui attribuer l'id de la bonne team
addMenu(menu: Menu): Observable<any> | void { addMenu(menu: Menu): Observable<any> | void {
console.log(menu); console.log(menu);
const teamId = this.tokenService.getCurrentTeamId(); const teamId = this.tokenService.getCurrentTeamId();
@ -44,11 +45,12 @@ apiUrl: string;
} }
//suppression d'un menu
deleteMenu(id:number): Observable<any> { deleteMenu(id:number): Observable<any> {
return this.http.delete(`${this.apiUrl}/menus/delete/${id}`, {responseType:"text"}); return this.http.delete(`${this.apiUrl}/menus/delete/${id}`, {responseType:"text"});
} }
//modification d'un menu - avec id du menu et id de la team
updateMenu(menu: Menu, id:number): Observable<any> | void { updateMenu(menu: Menu, id:number): Observable<any> | void {
const teamId = this.tokenService.getCurrentTeamId(); const teamId = this.tokenService.getCurrentTeamId();
if (teamId){ if (teamId){

View File

@ -18,37 +18,46 @@ export class TodoService {
this.apiUrl = environment.apiUrl; this.apiUrl = environment.apiUrl;
} }
//recupère les todolistexistantes en BDD par le tokenService en fonction de l'iD de la team
getToDoListByTeamId(): Observable<any> | void { getToDoListByTeamId(): Observable<any> | void {
const teamId = this.tokenService.getCurrentTeamId(); const teamId = this.tokenService.getCurrentTeamId();
return this.http.get(`${this.apiUrl}/todolist/team/${teamId}`); return this.http.get(`${this.apiUrl}/todolist/team/${teamId}`);
} }
//supprime les taches par l'id dela tache dans la todoList
deleteTacheById(idTache: any): Observable<any> { deleteTacheById(idTache: any): Observable<any> {
return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`, { return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`, {
responseType: 'text', responseType: 'text',
}); });
} }
//ajoute une tache avec auto-incrémentation de l'id dans la todolist
addTache(newtache: Tache, idTodoList: number): Observable<any> { addTache(newtache: Tache, idTodoList: number): Observable<any> {
// console.log(newtache); // console.log(newtache);
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache); return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
} }
// modifie une tâche par son id
updateTache(tache: Tache): Observable<any> { updateTache(tache: Tache): Observable<any> {
console.log(tache); // console.log(tache);
return this.http.put(`${this.apiUrl}/taches/update/1`, tache); return this.http.put(`${this.apiUrl}/taches/update/1`, tache);
} }
//ajoute ne todoList sur une team (par son id) via le token
addTodoByTeamId(newtodoList: TodoList): Observable<any> { addTodoByTeamId(newtodoList: TodoList): Observable<any> {
const teamId = this.tokenService.getCurrentTeamId(); const teamId = this.tokenService.getCurrentTeamId();
console.log(newtodoList + 'newtodoList'); console.log(newtodoList + 'newtodoList');
return this.http.post(`${this.apiUrl}/todolist/add/${teamId}`, newtodoList); return this.http.post(`${this.apiUrl}/todolist/add/${teamId}`, newtodoList);
} }
//suprime une todoList en fonction de son id
deleteTodoById(idTodo: any): Observable<any> { deleteTodoById(idTodo: any): Observable<any> {
return this.http.delete(`${this.apiUrl}/todolist/delete/${idTodo}`, { return this.http.delete(`${this.apiUrl}/todolist/delete/${idTodo}`, {
responseType: 'text', responseType: 'text',
}); });
} }
//modfie une todoList par son id
updateTodo(todoList: TodoList): Observable<any> { updateTodo(todoList: TodoList): Observable<any> {
console.log(todoList); console.log(todoList);
return this.http.put(`${this.apiUrl}/todolist/update/666`, todoList); return this.http.put(`${this.apiUrl}/todolist/update/666`, todoList);

View File

@ -11,6 +11,7 @@ tokenKey = environment.tokenKey;
constructor() { } constructor() { }
//récupère le token
public getToken(): string | null { public getToken(): string | null {
const token = localStorage.getItem(this.tokenKey); const token = localStorage.getItem(this.tokenKey);
if(token) { if(token) {
@ -20,17 +21,18 @@ tokenKey = environment.tokenKey;
} }
} }
//supprime le token
public eraseToken(): string | null { public eraseToken(): string | null {
const token = localStorage.getItem(this.tokenKey); const token = localStorage.getItem(this.tokenKey);
if(token) { if(token) {
localStorage.removeItem(this.tokenKey); localStorage.removeItem(this.tokenKey); //.clear() supprime tous les token du localStorage !
return token; return token; //utiliser remove()
}else { }else {
return null; return null;
} }
} }
//recupère l'id du membre stocké dans le token
public getCurrentMembreId(): number | null { public getCurrentMembreId(): number | null {
const token = this.getToken(); const token = this.getToken();
if(token) { if(token) {
@ -42,6 +44,7 @@ tokenKey = environment.tokenKey;
} }
} }
//recupère l'id de la team stocké dans le token
public getCurrentTeamId(): number | null { public getCurrentTeamId(): number | null {
const token = this.getToken(); const token = this.getToken();
if(token){ if(token){
@ -55,6 +58,7 @@ return null;
} }
//recupère le role du membre stocké dans le token
public getRole(): string | null { public getRole(): string | null {
const token = this.getToken(); const token = this.getToken();
if(token){ if(token){

View File

@ -4,7 +4,7 @@
export const environment = { export const environment = {
production: false, production: false,
apiUrl: 'http://localhost:8080', apiUrl: 'http://localhost:8088',
tokenKey: 'TOKEN-ORGANIZEE', tokenKey: 'TOKEN-ORGANIZEE',
debug: true, debug: true,
}; };