Merge pull request #86 from AlineRinquin/dev
Dev Verssion 1.0 au 05/03/22
This commit is contained in:
commit
b12da5fb36
@ -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 { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.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 { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.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 { PageSignupComponent } from './pages/page-signup/page-signup.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 { PageSupportComponent } from './pages/page-support/page-support.component';
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
import { AuthGuard } from './auth.guard';
|
||||
import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'accueil', pathMatch: 'full' },
|
||||
@ -32,7 +31,6 @@ const routes: Routes = [
|
||||
{ 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', canActivate: [AuthGuard], component: PageMenuSemaineComponent },
|
||||
{ path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent },
|
||||
@ -40,11 +38,11 @@ const routes: Routes = [
|
||||
{ path: 'creation-compte', component: PageSignupComponent },
|
||||
{ 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: 'modifier-membre/:id', canActivate: [AuthGuard], component: PageUpdateMemberComponent },
|
||||
{ path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent },
|
||||
{ path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent },
|
||||
{ path: 'footer', component: FooterComponent},
|
||||
{ path: 'ajout-evenement', canActivate: [AuthGuard], component: PageAjoutEvenementsComponent },
|
||||
{ path: '**', component: PageNotFoundComponent },
|
||||
];
|
||||
|
||||
|
@ -23,10 +23,8 @@ import { MeteoComponent } from './components/meteo/meteo.component';
|
||||
import { CalendrierComponent } from './components/calendrier/calendrier.component';
|
||||
import { CardMemberComponent } from './components/card-member/card-member.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 { FicheContactComponent } from './components/fiche-contact/fiche-contact.component';
|
||||
import { PaginationComponent } from './components/pagination/pagination.component';
|
||||
import { CreneauComponent } from './components/creneau/creneau.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
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 { AutofocusFixModule } from 'ngx-autofocus-fix';
|
||||
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 { registerLocaleData } from '@angular/common';
|
||||
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 { DeconnexionComponent } from './components/deconnexion/deconnexion.component';
|
||||
import { AlertComponent } from './components/alert/alert.component';
|
||||
import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component';
|
||||
registerLocaleData(localeFr)
|
||||
|
||||
@NgModule({
|
||||
@ -70,21 +67,18 @@ registerLocaleData(localeFr)
|
||||
CalendrierComponent,
|
||||
CardMemberComponent,
|
||||
ToDoListComponent,
|
||||
TacheComponent,
|
||||
CardMenuComponent,
|
||||
FicheContactComponent,
|
||||
PaginationComponent,
|
||||
CreneauComponent,
|
||||
PageAjoutContactComponent,
|
||||
PageModifierContactComponent,
|
||||
PageCreationTeamComponent,
|
||||
FooterComponent,
|
||||
PageDeleteAccountComponent,
|
||||
PageUpdateAccountComponent,
|
||||
CardAvatarComponent,
|
||||
DeconnexionComponent,
|
||||
HumeurComponent,
|
||||
AlertComponent
|
||||
AlertComponent,
|
||||
PageAjoutEvenementsComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -19,6 +19,7 @@ export class AuthGuard implements CanActivate {
|
||||
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(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
@ -35,20 +36,17 @@ export class AuthGuard implements CanActivate {
|
||||
console.log('decodedToken : ', decodedToken);
|
||||
|
||||
if (decodedToken.exp) {
|
||||
console.log("Date d'exp decodedToken : ", decodedToken.exp);
|
||||
const dateExp = new Date(decodedToken.exp * 1000);
|
||||
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']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("C'est ok ! ");
|
||||
return true;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
<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 class="card m-1 p-1 avatar bg-light">
|
||||
|
||||
<div class="card-img-top">
|
||||
<div class="rounded-circle"id="couleur"[style.background-color]="membre.couleur">
|
||||
</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>
|
@ -3,18 +3,14 @@
|
||||
height: 60px;
|
||||
margin: 0 auto;
|
||||
background: black;
|
||||
|
||||
}
|
||||
|
||||
.card {
|
||||
min-height: 8px;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
justify-content: center;
|
||||
.card-title{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
h3 {
|
||||
font-size: small;
|
||||
}
|
||||
.avatar{
|
||||
width: 150px;
|
||||
height: 170px;
|
||||
border-radius: 20px;
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
<div class="text-center mt-3">
|
||||
<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"
|
||||
routerLink="../modifier-membre"
|
||||
routerLink="../modifier-membre/{{membre.id}}"
|
||||
routerLinkActive="active-custom">
|
||||
Modifier
|
||||
</button><button button type="button" class="btn btn-primary px-4"
|
||||
|
@ -7,7 +7,7 @@
|
||||
}
|
||||
|
||||
.card {
|
||||
min-height: 22rem;
|
||||
min-height: 14rem;
|
||||
border: none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
.buttons button:nth-child(1) {
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
border: 1px solid #7879F1 !important;
|
||||
color: #7879F1;
|
||||
height: 40px;
|
||||
@ -30,6 +31,7 @@
|
||||
|
||||
.buttons button:nth-child(1):hover {
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
border: 1px solid #7879F1 !important;
|
||||
color: #fff;
|
||||
height: 40px;
|
||||
|
@ -58,6 +58,11 @@
|
||||
</button>
|
||||
|
||||
<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="col-md-auto" *ngFor="let menu of listMenus">
|
||||
<div class="card p-3 py-4 align-items" style="width: 14rem">
|
||||
@ -94,6 +99,7 @@
|
||||
class="form-control"
|
||||
formControlName="dateMenuFc"
|
||||
value="{{ menu.dateMenu }}"
|
||||
[(ngModel)]="menu.dateMenu"
|
||||
placeholder="Date"
|
||||
name="date"
|
||||
/>
|
||||
@ -102,6 +108,7 @@
|
||||
class="form-control"
|
||||
formControlName="repasMidiFc"
|
||||
value="{{ menu.repasMidi }}"
|
||||
[(ngModel)]="menu.repasMidi"
|
||||
placeholder="Repas du midi"
|
||||
name="repasMidi"
|
||||
/>
|
||||
@ -110,6 +117,7 @@
|
||||
class="form-control"
|
||||
formControlName="repasSoirFc"
|
||||
value="{{ menu.repasSoir }}"
|
||||
[(ngModel)]="menu.repasSoir"
|
||||
placeholder="Repas du soir"
|
||||
name="repasSoir"
|
||||
/>
|
||||
|
@ -19,6 +19,8 @@ import {
|
||||
})
|
||||
export class CardMenuComponent implements OnInit {
|
||||
closeResult = '';
|
||||
alert : any;
|
||||
isShow : boolean;
|
||||
public listMenus:any[];
|
||||
public menuId : any;
|
||||
public menuForm : FormGroup;
|
||||
@ -35,30 +37,21 @@ 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 : ''],
|
||||
|
||||
});
|
||||
this.isShow = false;
|
||||
}
|
||||
|
||||
//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 {
|
||||
// window.alert("Le menu a bien été supprimé!")
|
||||
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
||||
// this.router.navigate(['menu']);
|
||||
window.location.reload();
|
||||
this.alert={"type":"danger", "content":"Le menu a bien été supprimé"};
|
||||
this.isShow = true;
|
||||
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//updateMenu
|
||||
//updateMenu - fait appel au service dédié MenuService qui gère les observables
|
||||
updateMenu(id_menu : number): void {
|
||||
|
||||
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 {
|
||||
|
||||
const dateValue = this.menuForm.value['dateMenuFc'];
|
||||
const repasMidiValue = this.menuForm.value['repasMidiFc'];
|
||||
const repasSoirValue = this.menuForm.value['repasSoirFc'];
|
||||
|
||||
|
||||
//permet de construire l'objet à passer en base
|
||||
const menu: Menu = {
|
||||
dateMenu: dateValue,
|
||||
repasMidi: repasMidiValue,
|
||||
@ -102,7 +95,7 @@ saveMenu(): void {
|
||||
|
||||
console.log(menu.dateMenu);
|
||||
this.menusService.addMenu(menu)?.subscribe((resp) => {
|
||||
window.location.reload();
|
||||
window.location.reload(); //rechargement de la page pour affichage des modifications
|
||||
|
||||
});
|
||||
} else {
|
||||
@ -113,10 +106,10 @@ saveMenu(): 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[])=>{
|
||||
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(
|
||||
{
|
||||
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) {
|
||||
this.modalService.open(content,
|
||||
{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 {
|
||||
if (reason === ModalDismissReasons.ESC) {
|
||||
return 'by pressing ESC';
|
||||
@ -161,6 +154,11 @@ open(content: any) {
|
||||
return `with: ${reason}`;
|
||||
}
|
||||
}
|
||||
|
||||
//fermeture du message d'alerte quand un menu est supprimé
|
||||
onClickCloseAlert(){
|
||||
this.isShow = ! this.isShow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ export class DeconnexionComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
|
||||
//au click on fait appel au ServiceToken pour supprimer le token et on redirige l'utilisateur
|
||||
onClickDeco(){
|
||||
this.tokenService.eraseToken();
|
||||
this.router.navigate(['accueil']);
|
||||
|
@ -24,6 +24,7 @@ export class FicheContactComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
// supprime le contact
|
||||
onClickDelete(numPerson: number){
|
||||
window.alert("Le contact à bien été supprimé!")
|
||||
this.clickDelete.emit(numPerson);
|
||||
|
@ -1 +0,0 @@
|
||||
<p>pagination works!</p>
|
@ -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();
|
||||
});
|
||||
});
|
@ -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 {
|
||||
}
|
||||
|
||||
}
|
@ -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">
|
||||
<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>
|
||||
Ma Team</a>
|
||||
</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">
|
||||
<a routerLink="/repertoire" routerLinkActive="active-custom" class="nav-link">
|
||||
<i class="bi bi-person-rolodex"></i>
|
||||
Répertoire</a>
|
||||
</li>
|
||||
<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>
|
||||
To-Do-List</a>
|
||||
</li>
|
||||
<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>
|
||||
Menus</a>
|
||||
</li>
|
||||
<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>
|
||||
Agenda</a>
|
||||
</li>
|
||||
|
@ -5,7 +5,7 @@
|
||||
width: auto;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
background-color: rgb(238, 238, 238);
|
||||
//background-color: #c3c3e7;
|
||||
}
|
||||
.nav{
|
||||
margin-top: 20px;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-side-bar',
|
||||
@ -6,10 +6,14 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./side-bar.component.scss']
|
||||
})
|
||||
export class SideBarComponent implements OnInit {
|
||||
@Input() backgroundColor!: string;
|
||||
//@Input() backgroundColor = '#c3c3e7';
|
||||
|
||||
constructor() {}
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,9 @@
|
||||
<!-- <div *ngIf="errorForm">
|
||||
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
||||
</div> -->
|
||||
|
||||
<app-alert *ngIf="isShow" [alert]="alert" (eventClose)="onClickCloseAlert();"></app-alert>
|
||||
|
||||
<!-- <div *ngIf="isShow">
|
||||
<div class="alert alert-{{alert.type}}" role="alert">
|
||||
{{alert.content}}
|
||||
|
@ -1,12 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-signin',
|
||||
@ -22,8 +17,9 @@ export class SigninComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
//quand on se connecte - appel au service d'authentification
|
||||
public onSubmit(submittedForm: any): void {
|
||||
console.log(submittedForm.form.value);
|
||||
|
||||
const email = submittedForm.form.value['email'];
|
||||
const password = submittedForm.form.value['password'];
|
||||
if (email !== '' && password !== '') {
|
||||
@ -32,19 +28,20 @@ export class SigninComponent implements OnInit {
|
||||
next: resp => {
|
||||
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.isShow = true;
|
||||
},
|
||||
complete: () => console.log('DONE!')
|
||||
});
|
||||
} else {
|
||||
// afficher une erreur à l'utilisateur
|
||||
// affiche une erreur à l'utilisateur
|
||||
this.alert={"type":"danger", "content":"Le login ou password est invalide"};
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
//fermeture du message d'alerte
|
||||
onClickCloseAlert(){
|
||||
console.log('fermeture');
|
||||
this.isShow = ! this.isShow;
|
||||
|
@ -1 +0,0 @@
|
||||
<p>tache works!</p>
|
@ -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();
|
||||
});
|
||||
});
|
@ -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 {
|
||||
}
|
||||
|
||||
}
|
@ -40,14 +40,15 @@ export class ToDoListComponent implements OnInit {
|
||||
this.idTodo = 4;
|
||||
this.todoTitle = '';
|
||||
}
|
||||
//supprimer la todoList
|
||||
//supprimer la todoList en fonction de son id
|
||||
deleteTodo(id: number): void {
|
||||
window.alert('La to-do-List a bien été supprimé!');
|
||||
this.TodoService.deleteTodoById(id).subscribe((resp) => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
//ajouter tache
|
||||
|
||||
//ajouter tache par l'id de son parent todoList
|
||||
addTache(idTodoList: number) {
|
||||
//idTodoList id que la todoList que l'on récupère
|
||||
console.log(idTodoList);
|
||||
@ -58,9 +59,13 @@ export class ToDoListComponent implements OnInit {
|
||||
editing: false,
|
||||
};
|
||||
console.log(this.tache);
|
||||
this.TodoService.addTache(tache, idTodoList).subscribe((resp) => {
|
||||
window.location.reload();
|
||||
});
|
||||
if (this.todoTitle != '') {
|
||||
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
|
||||
@ -70,13 +75,13 @@ export class ToDoListComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
//modifier par l'input
|
||||
//modifier la tâche par l'input
|
||||
modifier(tache: Tache): void {
|
||||
this.beforeEditCache = tache.texte;
|
||||
tache.editing = true;
|
||||
}
|
||||
|
||||
// ajouter la modification dans la liste
|
||||
// modifier une tâche validation de l'input
|
||||
doneEdit(tache: Tache): void {
|
||||
if (tache.texte.trim().length === 0) {
|
||||
tache.texte = this.beforeEditCache;
|
||||
@ -112,12 +117,6 @@ export class ToDoListComponent implements OnInit {
|
||||
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
|
||||
cocherAllTodoList(): void {
|
||||
for (var i = 0; i < this.todo.taches.length; i++) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
export interface Membre {
|
||||
id: string;
|
||||
nom: string;
|
||||
prenom: string;
|
||||
email: string;
|
||||
|
@ -1,47 +1,38 @@
|
||||
<app-header></app-header>
|
||||
<app-side-bar></app-side-bar>
|
||||
<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>
|
||||
<h1 class="col-md-auto">{{ currentTeam.nom }}</h1>
|
||||
<div>
|
||||
<!-- Pour récupérer le membre connecté-->
|
||||
<div class="d-flex justify-content-center">
|
||||
<app-card-member [membre]="currentUser"> </app-card-member>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button
|
||||
id="bouton-ajout"
|
||||
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="col" *ngFor="let membreData of listMembres">
|
||||
<app-card-member [membre]="membreData"> </app-card-member>
|
||||
</div>
|
||||
<!-- Pour exclure le membre connecté de la liste car il est récupéré plus haut-->
|
||||
<!-- ng-container pour gérer l'espace vide que laissé le membre exclu à cause du dom -->
|
||||
<!-- 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>
|
||||
<app-footer></app-footer>
|
||||
|
@ -1,3 +1,29 @@
|
||||
button{
|
||||
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;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
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({
|
||||
@ -9,16 +13,28 @@ import { MembreService } from 'src/app/services/membre.service';
|
||||
})
|
||||
export class PageAccountComponent implements OnInit {
|
||||
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 = [];
|
||||
}
|
||||
|
||||
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[]) => {
|
||||
console.log(membres);
|
||||
this.listMembres = membres;
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import { TokenService } from 'src/app/services/token.service';
|
||||
})
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<app-header></app-header>
|
||||
|
||||
<app-side-bar></app-side-bar>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<app-side-bar></app-side-bar>
|
||||
<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">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
||||
<div class="form-floating">
|
||||
<div class="form-floating input">
|
||||
<input
|
||||
type="color"
|
||||
class="form-control"
|
||||
@ -16,6 +16,7 @@
|
||||
formControlName="couleurFc"
|
||||
/>
|
||||
</div>
|
||||
<label for="floatingInputcouleur" class="d-flex justify-content-center" >Choisissez une couleur</label>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
type="text"
|
||||
@ -33,7 +34,7 @@
|
||||
!addMemberForm.controls['lastNameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputlastName">VOTRE NOM</label>
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -52,9 +53,9 @@
|
||||
!addMemberForm.controls['firstNameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputfirstName">VOTRE PRENOM</label>
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<div class="form-floating ">
|
||||
<input
|
||||
type="date"
|
||||
class="form-control"
|
||||
@ -72,7 +73,7 @@
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputdateNaissance"
|
||||
>VOTRE DATE DE NAISSANCE</label
|
||||
>Date de naissance</label
|
||||
>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
@ -92,20 +93,7 @@
|
||||
!addMemberForm.controls['emailFc'].valid
|
||||
}"
|
||||
/>
|
||||
<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>
|
||||
<label for="floatingInputemail">Email</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -124,7 +112,7 @@
|
||||
!addMemberForm.controls['passwordFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPassword">MOT DE PASSE</label>
|
||||
<label for="floatingPassword">Mot de passe</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -144,9 +132,22 @@
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPasswordConfirm"
|
||||
>CONFIRMEZ VOTRE MOT DE PASSE</label
|
||||
>Confirmez le mot de passe</label
|
||||
>
|
||||
</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
|
||||
class="w-100 btn btn-lg btn-outline-success"
|
||||
|
@ -3,6 +3,11 @@
|
||||
padding-top: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
h1{
|
||||
color: rgba(0, 0, 0, 0.658);
|
||||
font-size: 34px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.form-addMember {
|
||||
width: 100%;
|
||||
|
@ -3,9 +3,9 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'
|
||||
import { Router } from '@angular/router';
|
||||
import { Mail } from 'src/app/models/mail';
|
||||
import { Membre } from 'src/app/models/membre';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { MailService } from 'src/app/services/mail.service';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
import { TeamService } from 'src/app/services/team.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-add-member',
|
||||
@ -13,12 +13,17 @@ import { MembreService } from 'src/app/services/membre.service';
|
||||
styleUrls: ['./page-add-member.component.scss']
|
||||
})
|
||||
export class PageAddMemberComponent implements OnInit {
|
||||
|
||||
public addMemberForm: FormGroup;
|
||||
alert: any;
|
||||
isShow!: boolean;
|
||||
currentTeam: any;
|
||||
|
||||
|
||||
|
||||
constructor(
|
||||
private membreService: MembreService,
|
||||
private teamService: TeamService,
|
||||
private mailService: MailService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
@ -26,7 +31,11 @@ export class PageAddMemberComponent implements OnInit {
|
||||
}
|
||||
|
||||
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(
|
||||
{
|
||||
firstNameFc: new FormControl('', [Validators.required]),
|
||||
@ -38,7 +47,7 @@ export class PageAddMemberComponent implements OnInit {
|
||||
Validators.email,
|
||||
Validators.required,
|
||||
Validators.pattern(/^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/gim),
|
||||
]), // chercher une meilleure regex
|
||||
]),
|
||||
passwordFc: new FormControl('', [
|
||||
Validators.minLength(8),
|
||||
Validators.required,
|
||||
@ -55,8 +64,7 @@ export class PageAddMemberComponent implements OnInit {
|
||||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
console.log('value : ', this.addMemberForm.value);
|
||||
console.log('form : ', this.addMemberForm);
|
||||
const idValue = this.addMemberForm.value[''];
|
||||
const lastNameValue = this.addMemberForm.value['lastNameFc'];
|
||||
const firstNameValue = this.addMemberForm.value['firstNameFc'];
|
||||
const emailValue = this.addMemberForm.value['emailFc'];
|
||||
@ -68,6 +76,7 @@ export class PageAddMemberComponent implements OnInit {
|
||||
|
||||
|
||||
const membre: Membre = {
|
||||
id: idValue,
|
||||
nom: lastNameValue,
|
||||
prenom: firstNameValue,
|
||||
email: emailValue,
|
||||
@ -89,17 +98,19 @@ export class PageAddMemberComponent implements OnInit {
|
||||
|
||||
|
||||
if (membre.email !== '' && membre.password !== '') {
|
||||
this.membreService.addMembre(membre)?.subscribe((resp) => {
|
||||
this.membreService.addMembre(membre)?.subscribe((_resp) => {
|
||||
this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{
|
||||
console.log("Mail envoyé");
|
||||
return respMail
|
||||
})
|
||||
this.router.navigate(['compte']);
|
||||
});
|
||||
} 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) {
|
||||
return (formGroup: FormGroup) => {
|
||||
const control = formGroup.controls[controlName];
|
||||
|
@ -1,7 +1,11 @@
|
||||
<app-header></app-header>
|
||||
<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
|
||||
class="alert alert-{{ alert.type }}"
|
||||
@ -59,14 +63,16 @@
|
||||
(click)="navigateNext($event)"
|
||||
>Next</a
|
||||
>
|
||||
|
||||
|
||||
<!-- 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 -->
|
||||
|
||||
<span style="float: right"
|
||||
><a
|
||||
href="#"
|
||||
routerLink="/ajout-evenement"
|
||||
class="btn btn-sm btn-primary"
|
||||
style="margin-right: 5px"
|
||||
>Ajouter un évènement</a
|
||||
|
@ -23,7 +23,7 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
constructor(private evenementService:EvenementService, private tokenService: TokenService) {
|
||||
this.isShow = false;
|
||||
this.alert = "";
|
||||
this.debug = environment.debug;
|
||||
this.debug = environment.debug; // Pour afficher ou pas les infos du token
|
||||
}
|
||||
|
||||
get date(): DayPilot.Date {
|
||||
@ -34,6 +34,7 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
this.config.startDate = value;
|
||||
}
|
||||
|
||||
// config pour les option d'affichage du mini calendrier de navigation
|
||||
navigatorConfig: DayPilot.NavigatorConfig = {
|
||||
showMonths: 1,
|
||||
skipMonths: 1,
|
||||
@ -45,16 +46,17 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
titleHeight: 30
|
||||
};
|
||||
|
||||
// intialisation de events, pour accueillir les evenements
|
||||
events: DayPilot.EventData[] = [];
|
||||
|
||||
// methode pour fermer l'alert de message
|
||||
onClickCloseAlert(){
|
||||
console.log('fermeture');
|
||||
this.isShow = ! this.isShow;
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.userId = this.tokenService.getCurrentMembreId();
|
||||
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
|
||||
// on split sur un retour chariot pour ne conserver que la premiere partie
|
||||
// qui est le titre de l'evenement
|
||||
rdvSplit(rdv:any){
|
||||
let titleRDV = rdv.split('\r');
|
||||
console.log(titleRDV[0]);
|
||||
return titleRDV[0];
|
||||
}
|
||||
|
||||
// config des options du calendrier
|
||||
config: DayPilot.CalendarConfig = {
|
||||
startDate: DayPilot.Date.today(),
|
||||
locale: "fr-fr",
|
||||
@ -92,7 +97,7 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
{
|
||||
next: result => {
|
||||
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;
|
||||
},
|
||||
error: err => {
|
||||
@ -102,11 +107,11 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
},
|
||||
complete: () => console.log('DONE!')
|
||||
}
|
||||
);
|
||||
);
|
||||
}else{
|
||||
this.viewChange();
|
||||
this.alert={"type":"danger", "content":"Vous ne pouvez pas modifié cet évènement !"};
|
||||
this.isShow = true;
|
||||
this.alert={"type":"danger", "content":"Vous ne pouvez pas modifier cet évènement !"};
|
||||
this.isShow = true;
|
||||
}
|
||||
|
||||
},
|
||||
@ -126,18 +131,7 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
Object.assign(event, {id: ""});
|
||||
Object.assign(event, {membre: {id:this.userId}});
|
||||
Object.assign(event, {team: {id:this.teamId}});
|
||||
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
|
||||
// };
|
||||
// });
|
||||
//console.log("Event added: " + event);
|
||||
this.evenementService.addEvenements(event).subscribe({
|
||||
next: result => {
|
||||
this.viewChange();
|
||||
@ -172,7 +166,7 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
}else{
|
||||
this.viewChange();
|
||||
this.alert={"type":"danger", "content":"Vous ne pouvez pas suprimé cet évènement !"};
|
||||
this.isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
},
|
||||
eventResizeHandling: "Update",
|
||||
@ -206,11 +200,12 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||
}else{
|
||||
this.viewChange();
|
||||
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) {
|
||||
return '#' + color.replace(/^#/, '').replace(/../g, color =>
|
||||
('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 to = this.calendar.control.visibleEnd();
|
||||
|
||||
console.log("viewChange(): " + from + " " + to);
|
||||
|
||||
// this.ds.getEvents(from, to).subscribe(result => {
|
||||
//this.events = this.evenements;
|
||||
this.evenementService.getEvenementsByIdTeam(this.teamId).subscribe((data: any) => {
|
||||
// this.events = [{
|
||||
// "id": data[0].id,
|
||||
// "start": data[0].eventDebut,
|
||||
// "end": data[0].eventFin,
|
||||
// "text": data[0].libelle,
|
||||
// barColor: data[0].membre.couleur,
|
||||
// //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);
|
||||
// Récuperation des evenements d'une team
|
||||
this.evenementService.getEvenementsByIdTeam(this.teamId).subscribe((data: any) => {
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
navigatePrevious(event: MouseEvent): void {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<app-header></app-header>
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#5a1e63'"></app-side-bar>
|
||||
</div>
|
||||
<div class="ajoutContact-form text-center">
|
||||
<h3>Ajouter un contact</h3>
|
||||
@ -87,53 +87,6 @@
|
||||
<label for="floatingInputfirstName">Adresse</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 class="form-floating">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputAdresse"
|
||||
placeholder=""
|
||||
name="adresse"
|
||||
formControlName="adresseFc"
|
||||
/>
|
||||
<label for="floatingInputfirstName">Adresse</label>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="w-100 btn btn-lg btn-secondary"
|
||||
type="submit"
|
||||
@ -144,4 +97,5 @@
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
|
@ -63,7 +63,7 @@ export class PageAjoutContactComponent implements OnInit {
|
||||
email: emailValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
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 !== '') {
|
||||
|
@ -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>
|
@ -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();
|
||||
});
|
||||
});
|
@ -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']);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -2,30 +2,37 @@
|
||||
<app-side-bar></app-side-bar>
|
||||
|
||||
<div class="container">
|
||||
<div>
|
||||
<h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
|
||||
</div>
|
||||
<div class="row d-flex align-items-center flex-row">
|
||||
<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 class="row p-1 col-12 ">
|
||||
|
||||
<div class="row ">
|
||||
<h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-3 col-xs-6 box border" id="boxFour">
|
||||
<div>
|
||||
<div class="row col-12">
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" col-7" id="boxTwo">
|
||||
<app-calendrier class="w-100 h-100">A venir</app-calendrier>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row avatar">
|
||||
<div class="col" *ngFor="let membreData of listMembres">
|
||||
<app-card-avatar [membre]="membreData"> </app-card-avatar>
|
||||
<div class="row d-flex flex-wrap my-2 p-1">
|
||||
<ul class="list-inline">
|
||||
<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>
|
||||
|
||||
|
@ -11,40 +11,9 @@
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
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;
|
||||
margin-left:200px;
|
||||
}
|
||||
|
||||
.avatar{
|
||||
margin-top: -50px;
|
||||
justify-content: space-between;
|
||||
margin: 0;
|
||||
margin:O;
|
||||
}
|
@ -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>
|
@ -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();
|
||||
});
|
||||
});
|
@ -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 {
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { Membre } from 'src/app/models/membre';
|
||||
import { MailService } from 'src/app/services/mail.service';
|
||||
import { Mail } from 'src/app/models/mail';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-forgot-password',
|
||||
templateUrl: './page-forgot-password.component.html',
|
||||
@ -20,7 +15,7 @@ export class PageForgotPasswordComponent implements OnInit {
|
||||
|
||||
alert : any;
|
||||
isShow : boolean;
|
||||
|
||||
|
||||
constructor(private authService: AuthService, private router: Router, private mailService: MailService,) {
|
||||
this.alert = "";
|
||||
this.isShow = false;
|
||||
@ -30,6 +25,7 @@ export class PageForgotPasswordComponent implements OnInit {
|
||||
|
||||
public onSubmit(submittedForm: any): void {
|
||||
const membre: Membre = {
|
||||
id: "",
|
||||
nom: "",
|
||||
prenom: "",
|
||||
dateNaissance: new Date(),
|
||||
@ -41,9 +37,7 @@ export class PageForgotPasswordComponent implements OnInit {
|
||||
};
|
||||
|
||||
console.log(membre);
|
||||
// this.authService.forgotPassword(membre).subscribe((resp) => {
|
||||
// console.log('----'+resp)
|
||||
// });
|
||||
|
||||
|
||||
this.authService.forgotPassword(membre).subscribe(
|
||||
{
|
||||
@ -65,12 +59,12 @@ export class PageForgotPasswordComponent implements OnInit {
|
||||
})
|
||||
},
|
||||
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;
|
||||
},
|
||||
complete: () => console.log('DONE!')
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
@ -11,3 +11,4 @@
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<app-header></app-header>
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#5a1e63'"></app-side-bar>
|
||||
</div>
|
||||
|
||||
<div class="modifContact-form text-center">
|
||||
@ -11,7 +11,8 @@
|
||||
|
||||
<div class="form-floating">
|
||||
<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 class="form-floating">
|
||||
@ -20,10 +21,10 @@
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc" value= "{{ listContactInfo.nom }}">
|
||||
formControlName="lastNameFc" value= "{{ listContactInfo.nom }}"
|
||||
[(ngModel)]="listContactInfo.nom">
|
||||
<label for="floatingInputlastName">Nom</label>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
@ -31,10 +32,10 @@
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc" value= "{{ listContactInfo.prenom }}">
|
||||
formControlName="firstNameFc" value= "{{ listContactInfo.prenom }}"
|
||||
[(ngModel)]="listContactInfo.prenom">
|
||||
<label for="floatingInputfirstName">Prénom</label>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
@ -42,10 +43,10 @@
|
||||
id="floatingInputTelephone"
|
||||
placeholder=""
|
||||
name="telephone"
|
||||
formControlName="telephoneFc" value= "{{ listContactInfo.telephone }}">
|
||||
formControlName="telephoneFc" value= "{{ listContactInfo.telephone }}"
|
||||
[(ngModel)]="listContactInfo.telephone">
|
||||
<label for="floatingInputfirstName">Téléphone</label>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="email"
|
||||
@ -53,37 +54,40 @@
|
||||
id="floatingInput"
|
||||
placeholder=""
|
||||
name="email"
|
||||
formControlName="emailFc" value= "{{ listContactInfo.email }}">
|
||||
formControlName="emailFc" value= "{{ listContactInfo.email }}"
|
||||
[(ngModel)]="listContactInfo.email">
|
||||
<label for="floatingInput">Adresse email</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="date"
|
||||
class="form-control"
|
||||
id="floatingInputdateNaissance"
|
||||
placeholder=""
|
||||
name="dateNaissance"
|
||||
formControlName="dateNaissanceFc" value= "{{ listContactInfo.dateNaissance }}">
|
||||
formControlName="dateNaissanceFc"
|
||||
value= "{{ listContactInfo.dateNaissance }}"
|
||||
[(ngModel)]="listContactInfo.dateNaissance">
|
||||
<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" value= "{{ listContactInfo.adresse }}">
|
||||
formControlName="adresseFc" value= "{{ listContactInfo.adresse }}"
|
||||
[(ngModel)]="listContactInfo.adresse">
|
||||
<label for="floatingInputfirstName">Adresse</label>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-secondary"
|
||||
type="submit"
|
||||
[disabled]="modifContactForm.invalid">Valider</button>
|
||||
>Valider</button>
|
||||
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
</div>
|
@ -2,10 +2,10 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-auto">
|
||||
<app-side-bar></app-side-bar>
|
||||
<app-side-bar [backgroundColor]="'#5a1e63'"></app-side-bar>
|
||||
</div>
|
||||
|
||||
<div class="col compte text-center py-3 border">
|
||||
<div class="col compte text-center py-3">
|
||||
<div>
|
||||
<button
|
||||
*ngIf="parent"
|
||||
@ -34,7 +34,7 @@
|
||||
<div class="row justify-content-evenly">
|
||||
<div class="col-4">
|
||||
<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"
|
||||
(click)="onClick(personne)"
|
||||
>
|
||||
@ -58,4 +58,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
|
@ -31,4 +31,8 @@
|
||||
.h4 {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pointer{
|
||||
cursor: pointer;
|
||||
}
|
@ -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 {
|
||||
console.log('value : ', this.resetForm.value);
|
||||
@ -54,6 +44,7 @@ export class PageResetPasswordComponent implements OnInit {
|
||||
const passwordConfirmValue = this.resetForm.value['passwordConfirmFc'];
|
||||
|
||||
const membre: Membre = {
|
||||
id: "",
|
||||
nom: "",
|
||||
prenom: "",
|
||||
dateNaissance: new Date(),
|
||||
|
@ -4,10 +4,30 @@
|
||||
<label for="floatingInputcouleur">Choisissez une couleur</label>
|
||||
<main class="form-signup">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||
<div class="form-floating">
|
||||
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
|
||||
formControlName="couleurFc">
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="color" class="form-control" id="floatingInputcouleur" placeholder=""
|
||||
name="couleur"
|
||||
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">
|
||||
<input
|
||||
type="text"
|
||||
@ -25,7 +45,7 @@
|
||||
!signupForm.controls['lastNameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputlastName">VOTRE NOM</label>
|
||||
<label for="floatingInputlastName">Votre nom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -44,7 +64,7 @@
|
||||
!signupForm.controls['firstNameFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputfirstName">VOTRE PRENOM</label>
|
||||
<label for="floatingInputfirstName">Votre prénom</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -63,7 +83,7 @@
|
||||
!signupForm.controls['dateNaissanceFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputdateNaissance">VOTRE DATE DE NAISSANCE</label>
|
||||
<label for="floatingInputdateNaissance">Votr date de naissance</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -82,7 +102,7 @@
|
||||
!signupForm.controls['emailFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingInputemail">VOTRE EMAIL</label>
|
||||
<label for="floatingInputemail">Votre adresse mail</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -101,7 +121,7 @@
|
||||
!signupForm.controls['passwordFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPassword">MOT DE PASSE</label>
|
||||
<label for="floatingPassword">Votre mot de passe</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input
|
||||
@ -120,7 +140,7 @@
|
||||
!signupForm.controls['passwordConfirmFc'].valid
|
||||
}"
|
||||
/>
|
||||
<label for="floatingPasswordConfirm">CONFIRMEZ VOTRE MOT DE PASSE</label>
|
||||
<label for="floatingPasswordConfirm">Confirmez votre mot de passe</label>
|
||||
</div>
|
||||
|
||||
<button
|
||||
|
@ -16,6 +16,7 @@ import { AuthService } from '../../services/auth.service';
|
||||
})
|
||||
export class PageSignupComponent implements OnInit {
|
||||
public signupForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
@ -54,8 +55,7 @@ export class PageSignupComponent implements OnInit {
|
||||
}
|
||||
|
||||
public onSubmit(): void {
|
||||
console.log('value : ', this.signupForm.value);
|
||||
console.log('form : ', this.signupForm);
|
||||
const idValue = this.signupForm.value[''];
|
||||
const prenomValue = this.signupForm.value['firstNameFc'];
|
||||
const nomValue = this.signupForm.value['lastNameFc'];
|
||||
const emailValue = this.signupForm.value['emailFc'];
|
||||
@ -66,6 +66,7 @@ export class PageSignupComponent implements OnInit {
|
||||
const roleValue = ['ROLE_PARENT'];
|
||||
|
||||
const membre: Membre = {
|
||||
id: idValue,
|
||||
nom: nomValue,
|
||||
prenom: prenomValue,
|
||||
email: emailValue,
|
||||
@ -84,7 +85,7 @@ export class PageSignupComponent implements OnInit {
|
||||
// affichage erreur
|
||||
}
|
||||
}
|
||||
|
||||
/** 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];
|
||||
|
@ -25,3 +25,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-footer></app-footer>
|
||||
|
@ -21,6 +21,7 @@ export class PageToDoListComponent implements OnInit {
|
||||
}
|
||||
|
||||
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) => {
|
||||
console.log(listTodos);
|
||||
this.listTodos = listTodos;
|
||||
@ -28,23 +29,21 @@ export class PageToDoListComponent implements OnInit {
|
||||
this.idTodo = 0;
|
||||
});
|
||||
}
|
||||
//Ajouter une todo List
|
||||
|
||||
//Ajouter une todo List si l'input n'est pas vide
|
||||
addTodoByTeamId() {
|
||||
const todoList: ToDoList = {
|
||||
nom: this.todoListTitle,
|
||||
taches: [],
|
||||
id: 0,
|
||||
};
|
||||
this.TodoService.addTodoByTeamId(todoList)?.subscribe((resp) => {
|
||||
console.log(todoList);
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
deleteTodo(id: number): void {
|
||||
window.alert('La to-do-List a bien été supprimé!');
|
||||
this.TodoService.deleteTodoById(id).subscribe((resp) => {
|
||||
window.location.reload();
|
||||
});
|
||||
if (this.todoListTitle != '') {
|
||||
this.TodoService.addTodoByTeamId(todoList)?.subscribe((resp) => {
|
||||
console.log(todoList);
|
||||
window.location.reload(); //rafraîchit l'aperçu
|
||||
});
|
||||
}else{
|
||||
window.alert('Il faut saisir du texte'); // sinon msg d'erreur
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
@ -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();
|
||||
});
|
||||
});
|
@ -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 {
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,112 @@
|
||||
<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 ce membre</h1>
|
||||
<main class="contenu-compte"></main>
|
||||
<app-side-bar></app-side-bar>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-9 offset-2" id="main">
|
||||
<h1 class="d-flex justify-content-center">Modifier profil</h1>
|
||||
<div class="form-updateMember">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="updateMembreForm">
|
||||
<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>
|
||||
|
@ -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;
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
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({
|
||||
selector: 'app-page-update-member',
|
||||
@ -6,10 +10,121 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./page-update-member.component.scss']
|
||||
})
|
||||
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 {
|
||||
/** 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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ 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) {
|
||||
|
||||
|
@ -19,6 +19,7 @@ export class AuthService {
|
||||
this.tokenKey = environment.tokenKey;
|
||||
}
|
||||
|
||||
//methode pour s'inscrire - on passe l'objet en entier
|
||||
signup(membre: Membre): Observable<any> {
|
||||
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> {
|
||||
const body = {
|
||||
email: email,
|
||||
password: password,
|
||||
};
|
||||
|
||||
console.log('Mon body : ', body);
|
||||
return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe(
|
||||
map((x: any) => {
|
||||
console.log('Service : ', 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
|
||||
})
|
||||
@ -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> {
|
||||
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> {
|
||||
console.log('--'+uuid+' / '+membre);
|
||||
return this.http.put(`${this.apiUrl}/membres/reset-password/${uuid}`, membre);
|
||||
|
@ -49,7 +49,12 @@ export class MembreService {
|
||||
return this.http.delete(`${this.apiUrl}/membres/delete/1`);
|
||||
}
|
||||
|
||||
updateMembre(membre: Membre): Observable<any> {
|
||||
return this.http.put(`${this.apiUrl}/membres/update/1`, membre);
|
||||
}
|
||||
updateMembre(membre: Membre): Observable<any> | void {
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
if (teamId){
|
||||
return this.http.put(`${this.apiUrl}/membres/update/${teamId}/${membre.id}`, membre);
|
||||
}else {
|
||||
this.router.navigate(['accueil']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ apiUrl: string;
|
||||
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 {
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
if (teamId){
|
||||
@ -33,6 +33,7 @@ apiUrl: string;
|
||||
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 {
|
||||
console.log(menu);
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
@ -44,11 +45,12 @@ apiUrl: string;
|
||||
|
||||
}
|
||||
|
||||
//suppression d'un menu
|
||||
deleteMenu(id:number): Observable<any> {
|
||||
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 {
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
if (teamId){
|
||||
|
@ -18,37 +18,46 @@ export class TodoService {
|
||||
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 {
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
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> {
|
||||
return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`, {
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
||||
//ajoute une tache avec auto-incrémentation de l'id dans la todolist
|
||||
addTache(newtache: Tache, idTodoList: number): Observable<any> {
|
||||
// console.log(newtache);
|
||||
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
|
||||
}
|
||||
|
||||
// modifie une tâche par son id
|
||||
updateTache(tache: Tache): Observable<any> {
|
||||
console.log(tache);
|
||||
// console.log(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> {
|
||||
const teamId = this.tokenService.getCurrentTeamId();
|
||||
console.log(newtodoList + 'newtodoList');
|
||||
return this.http.post(`${this.apiUrl}/todolist/add/${teamId}`, newtodoList);
|
||||
}
|
||||
|
||||
//suprime une todoList en fonction de son id
|
||||
deleteTodoById(idTodo: any): Observable<any> {
|
||||
return this.http.delete(`${this.apiUrl}/todolist/delete/${idTodo}`, {
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
||||
//modfie une todoList par son id
|
||||
updateTodo(todoList: TodoList): Observable<any> {
|
||||
console.log(todoList);
|
||||
return this.http.put(`${this.apiUrl}/todolist/update/666`, todoList);
|
||||
|
@ -11,6 +11,7 @@ tokenKey = environment.tokenKey;
|
||||
|
||||
constructor() { }
|
||||
|
||||
//récupère le token
|
||||
public getToken(): string | null {
|
||||
const token = localStorage.getItem(this.tokenKey);
|
||||
if(token) {
|
||||
@ -20,17 +21,18 @@ tokenKey = environment.tokenKey;
|
||||
}
|
||||
}
|
||||
|
||||
//supprime le token
|
||||
public eraseToken(): string | null {
|
||||
const token = localStorage.getItem(this.tokenKey);
|
||||
if(token) {
|
||||
localStorage.removeItem(this.tokenKey);
|
||||
return token;
|
||||
localStorage.removeItem(this.tokenKey); //.clear() supprime tous les token du localStorage !
|
||||
return token; //utiliser remove()
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//recupère l'id du membre stocké dans le token
|
||||
public getCurrentMembreId(): number | null {
|
||||
const token = this.getToken();
|
||||
if(token) {
|
||||
@ -42,6 +44,7 @@ tokenKey = environment.tokenKey;
|
||||
}
|
||||
}
|
||||
|
||||
//recupère l'id de la team stocké dans le token
|
||||
public getCurrentTeamId(): number | null {
|
||||
const token = this.getToken();
|
||||
if(token){
|
||||
@ -55,6 +58,7 @@ return null;
|
||||
|
||||
}
|
||||
|
||||
//recupère le role du membre stocké dans le token
|
||||
public getRole(): string | null {
|
||||
const token = this.getToken();
|
||||
if(token){
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiUrl: 'http://localhost:8080',
|
||||
apiUrl: 'http://localhost:8088',
|
||||
tokenKey: 'TOKEN-ORGANIZEE',
|
||||
debug: true,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user