Merge branch 'dev' into cecile
This commit is contained in:
commit
03ec7ffe92
44 changed files with 782 additions and 273 deletions
|
@ -20,35 +20,37 @@ import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.c
|
|||
import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
|
||||
import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component';
|
||||
import { PageSupportComponent } from './pages/page-support/page-support.component';
|
||||
|
||||
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
import { AuthGuard } from './auth.guard';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'accueil', pathMatch: 'full' },
|
||||
{ path: 'modifier-contact/:id', component: PageModifierContactComponent },
|
||||
{ path: 'compte', component: PageAccountComponent },
|
||||
{ path: 'modifier-contact/:id', canActivate: [AuthGuard], component: PageModifierContactComponent },
|
||||
{ path: 'compte', canActivate: [AuthGuard], component: PageAccountComponent },
|
||||
{ path: 'accueil', component: PageAccueilComponent },
|
||||
{ path: 'ajout-membre', component: PageAddMemberComponent },
|
||||
{ path: 'agenda', component: PageAgendaComponent },
|
||||
{ path: 'tableau-de-bord', component: PageDashboardComponent },
|
||||
{ path: 'supprimer-membre', component: PageDeleteMemberComponent },
|
||||
{ path: 'supprimer-compte', component: PageDeleteAccountComponent },
|
||||
{ path: 'ajout-membre', canActivate: [AuthGuard], component: PageAddMemberComponent },
|
||||
{ path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent },
|
||||
{ path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent },
|
||||
{ path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent },
|
||||
{ path: 'supprimer-compte', canActivate: [AuthGuard], component: PageDeleteAccountComponent },
|
||||
{ path: 'password-oublie', component: PageForgotPasswordComponent },
|
||||
{ path: 'menu', component: PageMenuSemaineComponent },
|
||||
{ path: 'repertoire', component: PageRepertoireComponent },
|
||||
{ path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent },
|
||||
{ path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent },
|
||||
{ path: 'reinitialisation-password', component: PageResetPasswordComponent },
|
||||
{ path: 'creation-compte', component: PageSignupComponent },
|
||||
{ path: 'to-do-list', component: PageToDoListComponent },
|
||||
{ path: 'modifier-membre', component: PageUpdateMemberComponent },
|
||||
{ path: 'modifier-compte', component: PageUpdateAccountComponent },
|
||||
{ path: 'ajouter-contact', component: PageAjoutContactComponent },
|
||||
{ path: 'creation-team', component: PageCreationTeamComponent },
|
||||
{ path: 'page-support', component: PageSupportComponent},
|
||||
{ path: 'to-do-list', canActivate: [AuthGuard], component: PageToDoListComponent },
|
||||
{ path: 'modifier-membre', canActivate: [AuthGuard], component: PageUpdateMemberComponent },
|
||||
{ path: 'modifier-compte', canActivate: [AuthGuard], component: PageUpdateAccountComponent },
|
||||
{ path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent },
|
||||
{ path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent },
|
||||
{ path: 'humeur', canActivate: [AuthGuard], component: PageHumeurComponent },
|
||||
{ path: 'footer', component: FooterComponent},
|
||||
{ path: '**', component: PageNotFoundComponent },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
imports: [RouterModule.forRoot(routes, {onSameUrlNavigation:'reload'})],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AppRoutingModule {}
|
||||
|
|
|
@ -40,6 +40,8 @@ import { PageUpdateAccountComponent } from './pages/page-update-account/page-upd
|
|||
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import localeFr from '@angular/common/locales/fr';
|
||||
import { CardAvatarComponent } from './components/card-avatar/card-avatar.component';
|
||||
import { DeconnexionComponent } from './components/deconnexion/deconnexion.component';
|
||||
registerLocaleData(localeFr)
|
||||
|
||||
@NgModule({
|
||||
|
@ -78,6 +80,8 @@ registerLocaleData(localeFr)
|
|||
FooterComponent,
|
||||
PageDeleteAccountComponent,
|
||||
PageUpdateAccountComponent,
|
||||
CardAvatarComponent,
|
||||
DeconnexionComponent,
|
||||
|
||||
],
|
||||
imports: [
|
||||
|
|
|
@ -39,7 +39,7 @@ export class AuthGuard implements CanActivate {
|
|||
const dateExp = new Date(decodedToken.exp * 1000);
|
||||
if (new Date() >= dateExp) {
|
||||
// le token a expiré, je n'autorise pas l'accès
|
||||
this.router.navigate(['account/signin']);
|
||||
this.router.navigate(['accueil']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export class AuthGuard implements CanActivate {
|
|||
return true;
|
||||
} else {
|
||||
console.log('You shall not pass !!!!');
|
||||
this.router.navigate(['account/signin']); // redirection de notre utilisateur vers une url de notre application (dans notre code TS)
|
||||
this.router.navigate(['accueil']); // redirection de notre utilisateur vers une url de notre application (dans notre code TS)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
13
src/app/components/card-avatar/card-avatar.component.html
Normal file
13
src/app/components/card-avatar/card-avatar.component.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div class="container mt-5 membre">
|
||||
<div class="row d-flex justify-content-center">
|
||||
<div class="col-md-auto">
|
||||
<div class="card p-3 py-4 align-items">
|
||||
<!-- récuperer couleur du back-->
|
||||
<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>
|
20
src/app/components/card-avatar/card-avatar.component.scss
Normal file
20
src/app/components/card-avatar/card-avatar.component.scss
Normal file
|
@ -0,0 +1,20 @@
|
|||
#couleur{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin: 0 auto;
|
||||
background: black;
|
||||
|
||||
}
|
||||
|
||||
.card {
|
||||
min-height: 8px;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
h3 {
|
||||
font-size: small;
|
||||
}
|
25
src/app/components/card-avatar/card-avatar.component.spec.ts
Normal file
25
src/app/components/card-avatar/card-avatar.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CardAvatarComponent } from './card-avatar.component';
|
||||
|
||||
describe('CardAvatarComponent', () => {
|
||||
let component: CardAvatarComponent;
|
||||
let fixture: ComponentFixture<CardAvatarComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CardAvatarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CardAvatarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
17
src/app/components/card-avatar/card-avatar.component.ts
Normal file
17
src/app/components/card-avatar/card-avatar.component.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card-avatar',
|
||||
templateUrl: './card-avatar.component.html',
|
||||
styleUrls: ['./card-avatar.component.scss']
|
||||
})
|
||||
export class CardAvatarComponent implements OnInit {
|
||||
@Input() membre: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -45,7 +45,7 @@
|
|||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-dark"
|
||||
class="btn btn-outline-warning"
|
||||
(click)="modal.close(saveMenu())"
|
||||
>
|
||||
Enregistrer
|
||||
|
@ -120,7 +120,7 @@
|
|||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-dark"
|
||||
class="btn btn-outline-warning"
|
||||
(click)="modal.close(updateMenu(menu.id))"
|
||||
>
|
||||
Mettre à jour
|
||||
|
|
|
@ -34,24 +34,35 @@ public upMenuForm : FormGroup;
|
|||
) {
|
||||
this.listMenus=[];
|
||||
this.menuForm = new FormGroup({});
|
||||
this.upMenuForm = new FormGroup({});
|
||||
this.upMenuForm = this.initForm();
|
||||
}
|
||||
|
||||
//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
|
||||
deleteMenu(id_menu : number): void {
|
||||
window.alert("Le menu a bien été supprimé!")
|
||||
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
||||
this.router.navigate(['menu']);
|
||||
// this.router.navigate(['menu']);
|
||||
});
|
||||
|
||||
}
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
//updateMenu
|
||||
updateMenu(id_menu : number): void {
|
||||
|
||||
const dateValue = this.menuForm.value['dateMenuFc'];
|
||||
const repasMidiValue = this.menuForm.value['repasMidiFc'];
|
||||
const repasSoirValue = this.menuForm.value['repasSoirFc'];
|
||||
const dateValue = this.upMenuForm.value['dateMenuFc'];
|
||||
const repasMidiValue = this.upMenuForm.value['repasMidiFc'];
|
||||
const repasSoirValue = this.upMenuForm.value['repasSoirFc'];
|
||||
|
||||
|
||||
const menu: Menu = {
|
||||
|
@ -64,20 +75,11 @@ updateMenu(id_menu : number): void {
|
|||
console.log(id_menu);
|
||||
|
||||
this.menusService.updateMenu(menu, id_menu)?.subscribe((resp) => {
|
||||
console.log("ok");
|
||||
this.router.navigate(['menu']);
|
||||
console.log(menu, id_menu);
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
//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 : ''],
|
||||
libelle: [menu ? menu.repasMidi : ''],
|
||||
repas: [menu ? menu.repasSoir : ''],
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//ajout d'un menu
|
||||
|
@ -99,7 +101,8 @@ saveMenu(): void {
|
|||
|
||||
console.log(menu.dateMenu);
|
||||
this.menusService.addMenu(menu)?.subscribe((resp) => {
|
||||
this.router.navigate(['menu']);
|
||||
window.location.reload();
|
||||
|
||||
});
|
||||
} else {
|
||||
this.router.navigate(['accueil']);
|
||||
|
@ -120,10 +123,22 @@ this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
|
|||
this.menuForm = this.fb.group(
|
||||
{
|
||||
dateMenuFc: new FormControl('',[Validators.required]),
|
||||
libelleFc: new FormControl('',[Validators.required]),
|
||||
repasFc: new FormControl('',[Validators.required]),
|
||||
repasMidiFc: new FormControl('',[Validators.required]),
|
||||
repasSoirFc: new FormControl('',[Validators.required]),
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
this.upMenuForm = this.fb.group(
|
||||
{
|
||||
dateMenuFc: new FormControl('',[Validators.required]),
|
||||
repasMidiFc: new FormControl('',[Validators.required]),
|
||||
repasSoirFc: new FormControl('',[Validators.required]),
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
open(content: any) {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-primary btn-circle btn-xl"
|
||||
(click)="onClickDeco()"
|
||||
>
|
||||
Se déconnecter
|
||||
</button>
|
10
src/app/components/deconnexion/deconnexion.component.scss
Normal file
10
src/app/components/deconnexion/deconnexion.component.scss
Normal file
|
@ -0,0 +1,10 @@
|
|||
.btn-circle.btn-xl {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
padding: 10px 16px;
|
||||
border-radius: 40px;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
float: right;
|
||||
margin-right: 20px;
|
||||
}
|
25
src/app/components/deconnexion/deconnexion.component.spec.ts
Normal file
25
src/app/components/deconnexion/deconnexion.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeconnexionComponent } from './deconnexion.component';
|
||||
|
||||
describe('DeconnexionComponent', () => {
|
||||
let component: DeconnexionComponent;
|
||||
let fixture: ComponentFixture<DeconnexionComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DeconnexionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeconnexionComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
26
src/app/components/deconnexion/deconnexion.component.ts
Normal file
26
src/app/components/deconnexion/deconnexion.component.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-deconnexion',
|
||||
templateUrl: './deconnexion.component.html',
|
||||
styleUrls: ['./deconnexion.component.scss']
|
||||
})
|
||||
export class DeconnexionComponent implements OnInit {
|
||||
|
||||
constructor(private tokenService: TokenService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
|
||||
onClickDeco(){
|
||||
this.tokenService.eraseToken();
|
||||
this.router.navigate(['accueil']);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,17 @@
|
|||
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light shadow py-0 ">
|
||||
<div class="container-fluid">
|
||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||
<div class="navbar-nav">
|
||||
<img id="img" routerLink="accueil" routerLinkActive="active-custom" src="../../../assets/images/logo-organizee.png"/>
|
||||
</div>
|
||||
</div>
|
||||
<a class="navbar-brand" href="#">Organizee</a>
|
||||
<nav
|
||||
class="navbar sticky-top navbar-expand-lg navbar-light bg-light shadow py-0"
|
||||
>
|
||||
<div class="container-fluid">
|
||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||
<div class="navbar-nav">
|
||||
<img
|
||||
id="img"
|
||||
routerLink="accueil"
|
||||
routerLinkActive="active-custom"
|
||||
src="../../../assets/images/logo-organizee.png"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<a class="navbar-brand" href="#">Organizee</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.navbar-brand {
|
||||
position: absolute;
|
||||
margin-left: 12%;
|
||||
position: relative;
|
||||
margin-right: 70%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
font-size: 3rem;
|
||||
|
@ -29,5 +29,8 @@ a:active {
|
|||
}
|
||||
|
||||
#img {
|
||||
margin-left: 50%;
|
||||
position: absolute;
|
||||
max-width: 5%;
|
||||
margin-left: 5%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './header.component.html',
|
||||
|
@ -7,9 +8,12 @@ import { Component, OnInit } from '@angular/core';
|
|||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(){
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -28,7 +28,12 @@ export class SigninComponent implements OnInit {
|
|||
if (email !== '' && password !== '') {
|
||||
this.authService.signin(email, password).subscribe((resp) => {
|
||||
console.log('Component Signin: ', resp);
|
||||
this.router.navigate(['tableau-de-bord']);
|
||||
//if(resp == ){
|
||||
this.router.navigate(['tableau-de-bord']);
|
||||
//}else{
|
||||
// window.alert("Votre identifiant/mot de passe est erroné");
|
||||
//}
|
||||
console.log('Component Signin: ', resp);
|
||||
});
|
||||
} else {
|
||||
// afficher une erreur à l'utilisateur
|
||||
|
|
|
@ -1,31 +1,48 @@
|
|||
<app-header></app-header>
|
||||
<app-deconnexion></app-deconnexion>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<app-side-bar></app-side-bar>
|
||||
<div class="col-9 offset-2" id="main">
|
||||
<h1>Ma team</h1>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button button type="button" class="btn btn-primary btn-lg"
|
||||
routerLink="../modifier-compte"
|
||||
routerLinkActive="active-custom">Modifier mon compte</button>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button button type="button" class="btn btn-primary btn-lg"
|
||||
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 class="row">
|
||||
<div class="col" *ngFor="let membreData of listMembres">
|
||||
<app-card-member [membre]="membreData">
|
||||
</app-card-member>
|
||||
</div>
|
||||
</div>
|
||||
<h1>Ma team</h1>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button
|
||||
button
|
||||
type="button"
|
||||
class="btn btn-primary btn-lg"
|
||||
routerLink="../modifier-compte"
|
||||
routerLinkActive="active-custom"
|
||||
>
|
||||
Modifier mon compte
|
||||
</button>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button
|
||||
button
|
||||
type="button"
|
||||
class="btn btn-primary btn-lg"
|
||||
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 class="row">
|
||||
<div class="col" *ngFor="let membreData of listMembres">
|
||||
<app-card-member [membre]="membreData"> </app-card-member>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TeamService } from 'src/app/services/team.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-account',
|
||||
|
@ -10,14 +10,15 @@ import { TeamService } from 'src/app/services/team.service';
|
|||
export class PageAccountComponent implements OnInit {
|
||||
public listMembres: any[];
|
||||
|
||||
constructor(private teamService: TeamService, private membreService: MembreService) {
|
||||
constructor(private membreService: MembreService) {
|
||||
this.listMembres = [];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.membreService.getMembres().subscribe((membres: any[]) => {
|
||||
this.membreService.getMembresByTeamId()?.subscribe((membres: any[]) => {
|
||||
console.log(membres);
|
||||
this.listMembres = membres;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<app-header></app-header>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<app-side-bar></app-side-bar>
|
||||
|
@ -6,12 +7,14 @@
|
|||
<div class="form-addMember">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
||||
<div class="form-floating">
|
||||
<input type="color"
|
||||
class="form-control"
|
||||
id="floatingInputcouleur"
|
||||
placeholder=""
|
||||
name="couleur"
|
||||
formControlName="couleurFc">
|
||||
<input
|
||||
type="color"
|
||||
class="form-control"
|
||||
id="floatingInputcouleur"
|
||||
placeholder=""
|
||||
name="couleur"
|
||||
formControlName="couleurFc"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
|
@ -68,7 +71,9 @@
|
|||
!addMemberForm.controls['dateNaissanceFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputdateNaissance">VOTRE DATE DE NAISSANCE</label>
|
||||
<label for="floatingInputdateNaissance"
|
||||
>VOTRE DATE DE NAISSANCE</label
|
||||
>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
|
@ -87,7 +92,20 @@
|
|||
!addMemberForm.controls['emailFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputemail">VOTRE EMAIL</label>
|
||||
<label for="floatingInputemail">Votre 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 class="form-floating">
|
||||
<input
|
||||
|
@ -125,17 +143,20 @@
|
|||
!addMemberForm.controls['passwordConfirmFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPasswordConfirm">CONFIRMEZ VOTRE MOT DE PASSE</label>
|
||||
<label for="floatingPasswordConfirm"
|
||||
>CONFIRMEZ VOTRE MOT DE PASSE</label
|
||||
>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="w-100 btn btn-lg btn-outline-success"
|
||||
type="submit"
|
||||
[disabled]="addMemberForm.invalid"
|
||||
>Ajouter le membre</button>
|
||||
>
|
||||
Ajouter le membre
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ export class PageAddMemberComponent implements OnInit {
|
|||
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,
|
||||
|
@ -53,9 +54,10 @@ export class PageAddMemberComponent implements OnInit {
|
|||
public onSubmit(): void {
|
||||
console.log('value : ', this.addMemberForm.value);
|
||||
console.log('form : ', this.addMemberForm);
|
||||
const firstNameValue = this.addMemberForm.value['firstNameFc'];
|
||||
const lastNameValue = this.addMemberForm.value['lastNameFc'];
|
||||
const firstNameValue = this.addMemberForm.value['firstNameFc'];
|
||||
const emailValue = this.addMemberForm.value['emailFc'];
|
||||
const roleValue = this.addMemberForm.value['roleFc'];
|
||||
const passwordValue = this.addMemberForm.value['passwordFc'];
|
||||
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
||||
const couleurValue = this.addMemberForm.value['couleurFc'];
|
||||
|
@ -63,19 +65,19 @@ export class PageAddMemberComponent implements OnInit {
|
|||
|
||||
|
||||
const membre: Membre = {
|
||||
nom: firstNameValue,
|
||||
prenom: lastNameValue,
|
||||
nom: lastNameValue,
|
||||
prenom: firstNameValue,
|
||||
email: emailValue,
|
||||
password: passwordValue,
|
||||
couleur: couleurValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
roleList: ["ROLE_PARENT"]
|
||||
roleList: [roleValue]
|
||||
};
|
||||
|
||||
|
||||
if (membre.email !== '' && membre.password !== '') {
|
||||
this.membreService.addMembre(membre).subscribe((resp) => {
|
||||
this.membreService.addMembre(membre)?.subscribe((resp) => {
|
||||
this.router.navigate(['compte']);
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -1,37 +1,80 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
|
||||
<div class="alert alert-{{alert.type}}" role="alert" style="position:absolute;z-index:999;top:50%;left:40%; width: 500px;" *ngIf="isShow" id="showAlert">
|
||||
{{alert.content}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close" (click)="onClickCloseAlert()">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div
|
||||
class="alert alert-{{ alert.type }}"
|
||||
role="alert"
|
||||
style="position: absolute; z-index: 999; top: 50%; left: 40%; width: 500px"
|
||||
*ngIf="isShow"
|
||||
id="showAlert"
|
||||
>
|
||||
{{ alert.content }}
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="alert"
|
||||
aria-label="Close"
|
||||
(click)="onClickCloseAlert()"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style="display: flex;">
|
||||
<div style="width:150px;">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
|
||||
<div style="width: 100%;">
|
||||
<div class="wrap">
|
||||
<div class="left">
|
||||
<daypilot-navigator [config]="navigatorConfig" [(date)]="date" #navigator></daypilot-navigator>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div style="width:100%; margin:10px">
|
||||
<a href="#" class="btn btn-sm btn-primary" style="margin-right:5px;" (click)="navigatePrevious($event)">Previous</a>
|
||||
<a href="#" class="btn btn-sm btn-primary" style="margin-right:5px;" (click)="navigateToday($event)">Today</a>
|
||||
<a href="#" class="btn btn-sm btn-primary" style="margin-right:5px;" (click)="navigateNext($event)">Next</a>
|
||||
team : {{teamId}} - user: {{userId}} - role: {{role}}
|
||||
<span style="float:right"><a href="#" class="btn btn-sm btn-primary" style="margin-right:5px;">Ajouter un évènement</a></span>
|
||||
|
||||
</div>
|
||||
|
||||
<daypilot-calendar [config]="config" [events]="events" #calendar (viewChange)="viewChange()"></daypilot-calendar>
|
||||
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<div style="width: 150px">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
|
||||
<div style="width: 100%">
|
||||
<div class="wrap">
|
||||
<div class="left">
|
||||
<daypilot-navigator
|
||||
[config]="navigatorConfig"
|
||||
[(date)]="date"
|
||||
#navigator
|
||||
></daypilot-navigator>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div style="width: 100%; margin: 10px">
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-sm btn-primary"
|
||||
style="margin-right: 5px"
|
||||
(click)="navigatePrevious($event)"
|
||||
>Previous</a
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-sm btn-primary"
|
||||
style="margin-right: 5px"
|
||||
(click)="navigateToday($event)"
|
||||
>Today</a
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-sm btn-primary"
|
||||
style="margin-right: 5px"
|
||||
(click)="navigateNext($event)"
|
||||
>Next</a
|
||||
>
|
||||
team : {{ teamId }} - user: {{ userId }} - role: {{ role }}
|
||||
<span style="float: right"
|
||||
><a
|
||||
href="#"
|
||||
class="btn btn-sm btn-primary"
|
||||
style="margin-right: 5px"
|
||||
>Ajouter un évènement</a
|
||||
></span
|
||||
>
|
||||
</div>
|
||||
|
||||
<daypilot-calendar
|
||||
[config]="config"
|
||||
[events]="events"
|
||||
#calendar
|
||||
(viewChange)="viewChange()"
|
||||
></daypilot-calendar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<div>
|
||||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<app-header></app-header>
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<div class="ajoutContact-form text-center">
|
||||
<h1>Ajouter un contact</h1>
|
||||
<h3>Ajouter un contact</h3>
|
||||
<main class="form-ajoutContact">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm">
|
||||
|
||||
|
@ -12,25 +13,74 @@
|
|||
formControlName="couleurFc">
|
||||
</div>
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc">
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc"
|
||||
/>
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc"
|
||||
/>
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
</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>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc">
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputAdresse"
|
||||
placeholder=""
|
||||
name="adresse"
|
||||
formControlName="adresseFc"
|
||||
/>
|
||||
<label for="floatingInputfirstName">Adresse</label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -83,4 +133,6 @@
|
|||
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,27 +1,40 @@
|
|||
<app-header></app-header>
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<div class=" col team-form text-center">
|
||||
<h1>Créer votre team</h1>
|
||||
<main class="form-team">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="teamForm">
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputName"
|
||||
placeholder=""
|
||||
name="name"
|
||||
formControlName="nameFc"
|
||||
[ngClass]="{'is-valid' : teamForm.controls['nameFc'].touched && teamForm.controls['nameFc'].valid,
|
||||
'is-invalid': teamForm.controls['nameFc'].touched && !teamForm.controls['nameFc'].valid}">
|
||||
<label for="floatingInputName">Nom</label>
|
||||
</div>
|
||||
<button class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="teamForm.invalid">Je crée ma team</button>
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<div class="col team-form text-center">
|
||||
<h1>Créer votre team</h1>
|
||||
<main class="form-team">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="teamForm">
|
||||
<div class="form-floating">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputName"
|
||||
placeholder=""
|
||||
name="name"
|
||||
formControlName="nameFc"
|
||||
[ngClass]="{
|
||||
'is-valid':
|
||||
teamForm.controls['nameFc'].touched &&
|
||||
teamForm.controls['nameFc'].valid,
|
||||
'is-invalid':
|
||||
teamForm.controls['nameFc'].touched &&
|
||||
!teamForm.controls['nameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputName">Nom</label>
|
||||
</div>
|
||||
<button
|
||||
class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="teamForm.invalid"
|
||||
>
|
||||
Je crée ma team
|
||||
</button>
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
} from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Team } from 'src/app/models/team';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TeamService } from 'src/app/services/team.service';
|
||||
|
||||
@Component({
|
||||
|
@ -18,6 +19,7 @@ export class PageCreationTeamComponent implements OnInit {
|
|||
public teamForm: FormGroup;
|
||||
constructor(
|
||||
private teamService: TeamService,
|
||||
private membreService: MembreService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
|
@ -39,9 +41,6 @@ export class PageCreationTeamComponent implements OnInit {
|
|||
const team: Team = {
|
||||
nom : nameValue,
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (team.nom !== '' ) {
|
||||
this.teamService.addTeam(team).subscribe((resp) => {
|
||||
this.router.navigate(['compte']);
|
||||
|
|
|
@ -1,13 +1,43 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-meteo></app-meteo>
|
||||
<app-humeur></app-humeur>
|
||||
|
||||
<app-deconnexion></app-deconnexion>
|
||||
|
||||
<div class="container">
|
||||
<div>
|
||||
<h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
|
||||
</div>
|
||||
<div class="row d-flex align-items-center flex-row">
|
||||
|
||||
<div class="d-flex justify-content-center">
|
||||
<button button type="button" class="btn btn-primary btn-lg" routerLink="../creation-team"
|
||||
routerLinkActive="active-custom">Créer ma team</button>
|
||||
<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 class="row">
|
||||
<div class="col-sm-3 col-xs-6 box border" id="boxFour">
|
||||
<div>
|
||||
<p>Humeur en attente component
|
||||
</p>
|
||||
<p>Humeur en attente component
|
||||
</p>
|
||||
<p>Humeur en attente component
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row avatar">
|
||||
<div class="col" *ngFor="let membreData of listMembres">
|
||||
<app-card-avatar [membre]="membreData">
|
||||
</app-card-avatar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-footer></app-footer>
|
||||
|
||||
|
|
|
@ -1,5 +1,50 @@
|
|||
.titre{
|
||||
display: inline-flex;
|
||||
margin-left: 20px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.meteo {
|
||||
display: flex;
|
||||
margin-left: 300px;
|
||||
margin-left: 500px;
|
||||
margin-top: -60px;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
|
||||
button{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.calendrier{
|
||||
align-content: flex-end;
|
||||
}
|
||||
|
||||
#boxFour{
|
||||
height: 150px;
|
||||
margin-top: -70px;
|
||||
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{
|
||||
margin-top: -50px;
|
||||
justify-content: space-between;
|
||||
margin: 0;
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-dashboard',
|
||||
|
@ -8,26 +11,27 @@ import { FormsModule } from '@angular/forms';
|
|||
})
|
||||
export class PageDashboardComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
conectedUser: any;
|
||||
listMembres: any[];
|
||||
|
||||
constructor(private membreService: MembreService,
|
||||
private http: HttpClient,
|
||||
private router: Router,
|
||||
private tokenService: TokenService) {
|
||||
this.listMembres = [];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.membreService.getMembreId(this.tokenService.getCurrentMembreId()).subscribe((result) => {
|
||||
this.conectedUser = result ;
|
||||
console.log(result);
|
||||
})
|
||||
|
||||
this.membreService.getMembresByTeamId()?.subscribe((membres: any[]) => {
|
||||
console.log(membres);
|
||||
this.listMembres = membres;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
<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">
|
||||
<div class="col compte text-center">
|
||||
<h1>Supprimer ce membre</h1>
|
||||
<main class="contenu-compte">
|
||||
|
||||
</main>
|
||||
<main class="contenu-compte"></main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<app-header></app-header>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar class="sidebarMenu"></app-side-bar>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<div>
|
||||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<app-header></app-header>
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
|
||||
<div class="modifContact-form text-center">
|
||||
<h1>Modifier ce contact</h1>
|
||||
<h3>Modifier ce contact</h3>
|
||||
<main class="form-modifContact">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="modifContactForm">
|
||||
|
||||
|
@ -84,4 +85,5 @@
|
|||
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
|
@ -1,41 +1,63 @@
|
|||
<app-header></app-header>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
</div>
|
||||
|
||||
<div class=" col compte text-center py-3 border">
|
||||
<div>
|
||||
<button class="btn btn-sm btn-rounded btn-secondary m-3" type="submit">Tous les contacts
|
||||
</button>
|
||||
<button routerLink="/ajouter-contact" class="btn btn-sm btn-rounded btn-secondary m-3">
|
||||
Ajouter un contact
|
||||
</button>
|
||||
<div class="col compte text-center py-3 border">
|
||||
<div>
|
||||
<button class="btn btn-sm btn-rounded btn-secondary m-3" type="submit">
|
||||
Tous les contacts
|
||||
</button>
|
||||
<button
|
||||
routerLink="/ajouter-contact"
|
||||
class="btn btn-sm btn-rounded btn-secondary m-3"
|
||||
>
|
||||
Ajouter un contact
|
||||
</button>
|
||||
|
||||
<div class="input-group mb-3 d-flex justify-content-center">
|
||||
<input type="text" class="form-control" placeholder="Rechercher un contact"
|
||||
aria-label="Rechercher un contact" aria-describedby="basic-addon2" #word
|
||||
(keyup)="onSearchChange(word.value)">
|
||||
<div class="input-group mb-3 d-flex justify-content-center">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="Rechercher un contact"
|
||||
aria-label="Rechercher un contact"
|
||||
aria-describedby="basic-addon2"
|
||||
#word
|
||||
(keyup)="onSearchChange(word.value)"
|
||||
/>
|
||||
|
||||
<div class="input-group-append"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Liste des Contacts</h4>
|
||||
</div>
|
||||
<div class="row justify-content-evenly">
|
||||
<div class="col-4">
|
||||
<div class="row my-3 d-flex justify-content-center flex-row" *ngFor="let personne of listContact"
|
||||
(click)="onClick(personne)">
|
||||
<div class="couleur col-4" [style.background-color]="personne.couleur"></div>
|
||||
<span class="fiche-contact col-7">{{ personne.prenom }} {{ personne.nom }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4" *ngIf="openDetails">
|
||||
<app-fiche-contact [personne]="openDetails" (clickDelete)="onClickDelete($event)">
|
||||
</app-fiche-contact>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group-append"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Liste des Contacts</h4>
|
||||
</div>
|
||||
<div class="row justify-content-evenly">
|
||||
<div class="col-4">
|
||||
<div
|
||||
class="row my-3 d-flex justify-content-center flex-row"
|
||||
*ngFor="let personne of listContact"
|
||||
(click)="onClick(personne)"
|
||||
>
|
||||
<div
|
||||
class="couleur col-4"
|
||||
[style.background-color]="personne.couleur"
|
||||
></div>
|
||||
<span class="fiche-contact col-7"
|
||||
>{{ personne.prenom }} {{ personne.nom }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4" *ngIf="openDetails">
|
||||
<app-fiche-contact
|
||||
[personne]="openDetails"
|
||||
(clickDelete)="onClickDelete($event)"
|
||||
>
|
||||
</app-fiche-contact>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -69,5 +69,6 @@ export class PageRepertoireComponent implements OnInit {
|
|||
}
|
||||
this.router.navigate(['repertoire/']);
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
|
||||
<div class="d-flex align-items-stretch">
|
||||
<div class="row">
|
||||
<div class="col" *ngFor="let todos of result">
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<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">
|
||||
<div class="col compte text-center">
|
||||
<h1>Modifier votre compte</h1>
|
||||
<main class="contenu-compte">
|
||||
|
||||
</main>
|
||||
<main class="contenu-compte"></main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<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">
|
||||
<div class="col compte text-center">
|
||||
<h1>Modifier ce membre</h1>
|
||||
<main class="contenu-compte">
|
||||
|
||||
</main>
|
||||
<main class="contenu-compte"></main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
16
src/app/services/auth.interceptor.spec.ts
Normal file
16
src/app/services/auth.interceptor.spec.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AuthInterceptor } from './auth.interceptor';
|
||||
|
||||
describe('AuthInterceptor', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({
|
||||
providers: [
|
||||
AuthInterceptor
|
||||
]
|
||||
}));
|
||||
|
||||
it('should be created', () => {
|
||||
const interceptor: AuthInterceptor = TestBed.inject(AuthInterceptor);
|
||||
expect(interceptor).toBeTruthy();
|
||||
});
|
||||
});
|
31
src/app/services/auth.interceptor.ts
Normal file
31
src/app/services/auth.interceptor.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
HttpRequest,
|
||||
HttpHandler,
|
||||
HttpEvent,
|
||||
HttpInterceptor
|
||||
} from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TokenService } from './token.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthInterceptor implements HttpInterceptor {
|
||||
|
||||
constructor(private tokenService: TokenService) {}
|
||||
|
||||
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||
console.log('Coucou je suis le videur ! ');
|
||||
const token = this.tokenService.getToken();
|
||||
if(token) {
|
||||
|
||||
const authReq = request.clone(
|
||||
{
|
||||
headers : request.headers.set('Authorization', `Bearer ${token}`)
|
||||
}
|
||||
)
|
||||
return next.handle(authReq);
|
||||
} else {
|
||||
return next.handle(request);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ export class AuthService {
|
|||
private tokenKey: string;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
// On se sert des variables d'environnement de notre application
|
||||
|
||||
this.apiUrl = environment.apiUrl;
|
||||
this.tokenKey = environment.tokenKey;
|
||||
}
|
||||
|
@ -34,19 +34,14 @@ export class AuthService {
|
|||
};
|
||||
|
||||
console.log('Mon body : ', body);
|
||||
|
||||
// Modifier cette partie ci-dessous :
|
||||
// - pour pouvoir stocker dans le localstorage notre accesstoken
|
||||
// - Sous la clé "TOKEN-LBP"
|
||||
|
||||
return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe(
|
||||
map((x: any) => {
|
||||
console.log('Service : ', x.token);
|
||||
// Modification à faire ici
|
||||
localStorage.setItem(this.tokenKey, x.token);
|
||||
return x; // permet de renvoyer la réponse à l'initiateur (page Signin) après le traitement du map
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
forgotPassword(email: string): Observable<any> {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Membre } from '../models/membre';
|
||||
import { TokenService } from './token.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -11,7 +13,7 @@ export class MembreService {
|
|||
apiUrl: string;
|
||||
tokenKey: string;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
constructor(private http: HttpClient, private tokenService: TokenService, private router: Router) {
|
||||
this.apiUrl = environment.apiUrl;
|
||||
this.tokenKey = environment.tokenKey;
|
||||
}
|
||||
|
@ -20,14 +22,27 @@ export class MembreService {
|
|||
return this.http.get(`${this.apiUrl}/membres/all`);
|
||||
}
|
||||
|
||||
getMembreId(id: any): Observable<any> {
|
||||
return this.http.get(`${this.apiUrl}/membres/1` + id);
|
||||
getMembresByTeamId(): Observable<any> | void{
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
if (teamId){
|
||||
return this.http.get(`${this.apiUrl}/membres/team/${teamId}`);
|
||||
}else {
|
||||
this.router.navigate(['accueil']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addMembre(membre: Membre): Observable<any> {
|
||||
console.log(membre);
|
||||
getMembreId(id: any): Observable<any> {
|
||||
return this.http.get(`${this.apiUrl}/membres/` + id);
|
||||
}
|
||||
|
||||
return this.http.post(`${this.apiUrl}/membres/sign-up`, membre);
|
||||
addMembre(membre: Membre): Observable<any> | void{
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
if (teamId){
|
||||
return this.http.post(`${this.apiUrl}/membres/add/${teamId}`, membre);
|
||||
}else {
|
||||
this.router.navigate(['accueil']);
|
||||
}
|
||||
}
|
||||
|
||||
deleteMembre(membre: Membre): Observable<any> {
|
||||
|
|
|
@ -57,4 +57,5 @@ apiUrl: string;
|
|||
this.router.navigate(['accueil']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Team } from '../models/team';
|
||||
import { TokenService } from './token.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -12,7 +14,7 @@ export class TeamService {
|
|||
tokenKey: string;
|
||||
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
constructor(private http: HttpClient, private tokenService: TokenService, private router: Router) {
|
||||
this.apiUrl = environment.apiUrl;
|
||||
this.tokenKey = environment.tokenKey;
|
||||
}
|
||||
|
@ -20,8 +22,13 @@ export class TeamService {
|
|||
return this.http.get(`${this.apiUrl}/teams/all`);
|
||||
}
|
||||
|
||||
getTeamById(id: any): Observable<any> {
|
||||
return this.http.get(`${this.apiUrl}/teams/1` + id);
|
||||
getTeamById(): Observable<any> | void {
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
if (teamId){
|
||||
return this.http.get(`${this.apiUrl}/teams/${teamId}`);
|
||||
} else {
|
||||
this.router.navigate(['accueil']);
|
||||
}
|
||||
}
|
||||
|
||||
addTeam(team: Team): Observable<any> {
|
||||
|
|
|
@ -20,6 +20,17 @@ tokenKey = environment.tokenKey;
|
|||
}
|
||||
}
|
||||
|
||||
public eraseToken(): string | null {
|
||||
const token = localStorage.getItem(this.tokenKey);
|
||||
if(token) {
|
||||
this.tokenKey = '';
|
||||
return token;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public getCurrentMembreId(): number | null {
|
||||
const token = this.getToken();
|
||||
if(token) {
|
||||
|
|
Loading…
Add table
Reference in a new issue