Merge pull request #68 from AlineRinquin/component-alert
Component alert
This commit is contained in:
commit
8cdd8d3e64
71 changed files with 1555 additions and 564 deletions
|
@ -20,35 +20,36 @@ 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 { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component';
|
||||||
import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component';
|
import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component';
|
||||||
import { PageSupportComponent } from './pages/page-support/page-support.component';
|
import { PageSupportComponent } from './pages/page-support/page-support.component';
|
||||||
|
import { FooterComponent } from './components/footer/footer.component';
|
||||||
|
import { AuthGuard } from './auth.guard';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: 'accueil', pathMatch: 'full' },
|
{ path: '', redirectTo: 'accueil', pathMatch: 'full' },
|
||||||
{ path: 'modifier-contact/:id', component: PageModifierContactComponent },
|
{ path: 'modifier-contact/:id', canActivate: [AuthGuard], component: PageModifierContactComponent },
|
||||||
{ path: 'compte', component: PageAccountComponent },
|
{ path: 'compte', canActivate: [AuthGuard], component: PageAccountComponent },
|
||||||
{ path: 'accueil', component: PageAccueilComponent },
|
{ path: 'accueil', component: PageAccueilComponent },
|
||||||
{ path: 'ajout-membre', component: PageAddMemberComponent },
|
{ path: 'ajout-membre', canActivate: [AuthGuard], component: PageAddMemberComponent },
|
||||||
{ path: 'agenda', component: PageAgendaComponent },
|
{ path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent },
|
||||||
{ path: 'tableau-de-bord', component: PageDashboardComponent },
|
{ path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent },
|
||||||
{ path: 'supprimer-membre', component: PageDeleteMemberComponent },
|
{ path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent },
|
||||||
{ path: 'supprimer-compte', component: PageDeleteAccountComponent },
|
{ path: 'supprimer-compte', canActivate: [AuthGuard], component: PageDeleteAccountComponent },
|
||||||
{ path: 'password-oublie', component: PageForgotPasswordComponent },
|
{ path: 'password-oublie', component: PageForgotPasswordComponent },
|
||||||
{ path: 'menu', component: PageMenuSemaineComponent },
|
{ path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent },
|
||||||
{ path: 'repertoire', component: PageRepertoireComponent },
|
{ path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent },
|
||||||
{ path: 'reinitialisation-password', component: PageResetPasswordComponent },
|
{ path: 'reinitialisation-password/:uuid', component: PageResetPasswordComponent },
|
||||||
{ path: 'creation-compte', component: PageSignupComponent },
|
{ 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: '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: 'footer', component: FooterComponent},
|
||||||
{ path: '**', component: PageNotFoundComponent },
|
{ path: '**', component: PageNotFoundComponent },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes, {onSameUrlNavigation:'reload'})],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
})
|
})
|
||||||
export class AppRoutingModule {}
|
export class AppRoutingModule {}
|
||||||
|
|
|
@ -40,6 +40,10 @@ import { PageUpdateAccountComponent } from './pages/page-update-account/page-upd
|
||||||
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular";
|
||||||
import { registerLocaleData } from '@angular/common';
|
import { registerLocaleData } from '@angular/common';
|
||||||
import localeFr from '@angular/common/locales/fr';
|
import localeFr from '@angular/common/locales/fr';
|
||||||
|
import { CardAvatarComponent } from './components/card-avatar/card-avatar.component';
|
||||||
|
import { HumeurComponent } from './components/humeur/humeur.component';
|
||||||
|
import { DeconnexionComponent } from './components/deconnexion/deconnexion.component';
|
||||||
|
import { AlertComponent } from './components/alert/alert.component';
|
||||||
registerLocaleData(localeFr)
|
registerLocaleData(localeFr)
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -67,7 +71,6 @@ registerLocaleData(localeFr)
|
||||||
CardMemberComponent,
|
CardMemberComponent,
|
||||||
ToDoListComponent,
|
ToDoListComponent,
|
||||||
TacheComponent,
|
TacheComponent,
|
||||||
|
|
||||||
CardMenuComponent,
|
CardMenuComponent,
|
||||||
FicheContactComponent,
|
FicheContactComponent,
|
||||||
PaginationComponent,
|
PaginationComponent,
|
||||||
|
@ -78,7 +81,10 @@ registerLocaleData(localeFr)
|
||||||
FooterComponent,
|
FooterComponent,
|
||||||
PageDeleteAccountComponent,
|
PageDeleteAccountComponent,
|
||||||
PageUpdateAccountComponent,
|
PageUpdateAccountComponent,
|
||||||
|
CardAvatarComponent,
|
||||||
|
DeconnexionComponent,
|
||||||
|
HumeurComponent,
|
||||||
|
AlertComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|
|
@ -39,7 +39,7 @@ export class AuthGuard implements CanActivate {
|
||||||
const dateExp = new Date(decodedToken.exp * 1000);
|
const dateExp = new Date(decodedToken.exp * 1000);
|
||||||
if (new Date() >= dateExp) {
|
if (new Date() >= dateExp) {
|
||||||
// le token a expiré, je n'autorise pas l'accès
|
// le token a expiré, je n'autorise pas l'accès
|
||||||
this.router.navigate(['account/signin']);
|
this.router.navigate(['accueil']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ export class AuthGuard implements CanActivate {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.log('You shall not pass !!!!');
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
src/app/components/alert/alert.component.html
Normal file
4
src/app/components/alert/alert.component.html
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<div class="alert alert-{{alert.type}} alert-dismissible fade show" role="alert" style="position:absolute;z-index:9999;top:10px;right:50%;transform: translateX(50%);width:600px; text-align:center;">
|
||||||
|
{{alert.content}}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" (click)="onClickCloseAlert()"></button>
|
||||||
|
</div>
|
0
src/app/components/alert/alert.component.scss
Normal file
0
src/app/components/alert/alert.component.scss
Normal file
25
src/app/components/alert/alert.component.spec.ts
Normal file
25
src/app/components/alert/alert.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AlertComponent } from './alert.component';
|
||||||
|
|
||||||
|
describe('AlertComponent', () => {
|
||||||
|
let component: AlertComponent;
|
||||||
|
let fixture: ComponentFixture<AlertComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ AlertComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(AlertComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
20
src/app/components/alert/alert.component.ts
Normal file
20
src/app/components/alert/alert.component.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-alert',
|
||||||
|
templateUrl: './alert.component.html',
|
||||||
|
styleUrls: ['./alert.component.scss']
|
||||||
|
})
|
||||||
|
export class AlertComponent implements OnInit {
|
||||||
|
@Input() alert:any;
|
||||||
|
@Output() eventClose = new EventEmitter<string>();
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickCloseAlert(){
|
||||||
|
//console.log('fermeture from component');
|
||||||
|
this.eventClose.emit('true');
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
<p>calendrier works!</p>
|
<daypilot-calendar [config]="config" [events]="events"></daypilot-calendar>
|
|
@ -1,4 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { DayPilot } from "@daypilot/daypilot-lite-angular";
|
||||||
|
import { EvenementService } from 'src/app/services/evenement.service';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-calendrier',
|
selector: 'app-calendrier',
|
||||||
|
@ -7,9 +10,48 @@ import { Component, OnInit } from '@angular/core';
|
||||||
})
|
})
|
||||||
export class CalendrierComponent implements OnInit {
|
export class CalendrierComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
constructor(private evenementService:EvenementService, private tokenService: TokenService) { }
|
||||||
|
|
||||||
|
get date(): DayPilot.Date {
|
||||||
|
return this.config.startDate as DayPilot.Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
set date(value: DayPilot.Date) {
|
||||||
|
this.config.startDate = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
events: DayPilot.EventData[] = [];
|
||||||
|
|
||||||
|
config: DayPilot.CalendarConfig = {
|
||||||
|
viewType: "Day",
|
||||||
|
timeRangeSelectedHandling: "Disabled",
|
||||||
|
eventDeleteHandling: "Disabled",
|
||||||
|
eventMoveHandling: "Disabled",
|
||||||
|
eventResizeHandling: "Disabled",
|
||||||
|
eventClickHandling: "Disabled"
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
const teamId = this.tokenService.getCurrentTeamId();
|
||||||
|
this.evenementService.getEvenementsByIdTeam(teamId).subscribe((data: any) => {
|
||||||
|
Object.keys(data).map((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.toUpperCase()+'\r('+data[key].membre.prenom+')',
|
||||||
|
tags : {
|
||||||
|
membre: data[key].membre.id
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.events = data;
|
||||||
|
console.log(data);
|
||||||
|
console.log(this.events);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
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">
|
<div class="modal-footer">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-outline-dark"
|
class="btn btn-outline-warning"
|
||||||
(click)="modal.close(saveMenu())"
|
(click)="modal.close(saveMenu())"
|
||||||
>
|
>
|
||||||
Enregistrer
|
Enregistrer
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-outline-dark"
|
class="btn btn-outline-warning"
|
||||||
(click)="modal.close(updateMenu(menu.id))"
|
(click)="modal.close(updateMenu(menu.id))"
|
||||||
>
|
>
|
||||||
Mettre à jour
|
Mettre à jour
|
||||||
|
|
|
@ -34,24 +34,36 @@ public upMenuForm : FormGroup;
|
||||||
) {
|
) {
|
||||||
this.listMenus=[];
|
this.listMenus=[];
|
||||||
this.menuForm = new FormGroup({});
|
this.menuForm = new FormGroup({});
|
||||||
|
this.upMenuForm = new FormGroup({});
|
||||||
this.upMenuForm = this.initForm();
|
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
|
//delete d'un menu
|
||||||
deleteMenu(id_menu : number): void {
|
deleteMenu(id_menu : number): void {
|
||||||
window.alert("Le menu a bien été supprimé!")
|
// window.alert("Le menu a bien été supprimé!")
|
||||||
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
||||||
this.router.navigate(['menu']);
|
// this.router.navigate(['menu']);
|
||||||
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//updateMenu
|
//updateMenu
|
||||||
updateMenu(id_menu : number): void {
|
updateMenu(id_menu : number): void {
|
||||||
|
|
||||||
const dateValue = this.menuForm.value['dateMenuFc'];
|
const dateValue = this.upMenuForm.value['dateMenuFc'];
|
||||||
const repasMidiValue = this.menuForm.value['repasMidiFc'];
|
const repasMidiValue = this.upMenuForm.value['repasMidiFc'];
|
||||||
const repasSoirValue = this.menuForm.value['repasSoirFc'];
|
const repasSoirValue = this.upMenuForm.value['repasSoirFc'];
|
||||||
|
|
||||||
|
|
||||||
const menu: Menu = {
|
const menu: Menu = {
|
||||||
|
@ -64,20 +76,11 @@ updateMenu(id_menu : number): void {
|
||||||
console.log(id_menu);
|
console.log(id_menu);
|
||||||
|
|
||||||
this.menusService.updateMenu(menu, id_menu)?.subscribe((resp) => {
|
this.menusService.updateMenu(menu, id_menu)?.subscribe((resp) => {
|
||||||
console.log("ok");
|
console.log(menu, id_menu);
|
||||||
this.router.navigate(['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
|
//ajout d'un menu
|
||||||
|
@ -99,7 +102,8 @@ saveMenu(): void {
|
||||||
|
|
||||||
console.log(menu.dateMenu);
|
console.log(menu.dateMenu);
|
||||||
this.menusService.addMenu(menu)?.subscribe((resp) => {
|
this.menusService.addMenu(menu)?.subscribe((resp) => {
|
||||||
this.router.navigate(['menu']);
|
window.location.reload();
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['accueil']);
|
this.router.navigate(['accueil']);
|
||||||
|
@ -120,10 +124,22 @@ this.menusService.getMenu()?.subscribe((listMenus: any[])=>{
|
||||||
this.menuForm = this.fb.group(
|
this.menuForm = this.fb.group(
|
||||||
{
|
{
|
||||||
dateMenuFc: new FormControl('',[Validators.required]),
|
dateMenuFc: new FormControl('',[Validators.required]),
|
||||||
libelleFc: new FormControl('',[Validators.required]),
|
repasMidiFc: new FormControl('',[Validators.required]),
|
||||||
repasFc: 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) {
|
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']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,13 +4,17 @@
|
||||||
<div class="couleur col-7" [style.background-color]="personne.couleur"></div>
|
<div class="couleur col-7" [style.background-color]="personne.couleur"></div>
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button routerLink="../modifier-contact/{{personne.id}}"
|
<button
|
||||||
|
*ngIf="parent"
|
||||||
|
routerLink="../modifier-contact/{{personne.id}}"
|
||||||
class=" btn btn-sm btn-rounded btn-secondary mb-2">
|
class=" btn btn-sm btn-rounded btn-secondary mb-2">
|
||||||
Modifier
|
Modifier
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button class=" btn btn-sm btn-rounded btn-secondary" (click)="onClickDelete(personne.id)">
|
<button
|
||||||
|
*ngIf="parent"
|
||||||
|
class=" btn btn-sm btn-rounded btn-secondary" (click)="onClickDelete(personne.id)">
|
||||||
Supprimer
|
Supprimer
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-fiche-contact',
|
selector: 'app-fiche-contact',
|
||||||
|
@ -8,10 +9,20 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
export class FicheContactComponent implements OnInit {
|
export class FicheContactComponent implements OnInit {
|
||||||
@Input() personne: any;
|
@Input() personne: any;
|
||||||
@Output() clickDelete = new EventEmitter();
|
@Output() clickDelete = new EventEmitter();
|
||||||
|
parent: boolean;
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
constructor(private tokenService: TokenService) {
|
||||||
|
this.parent = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
const roleUser = this.tokenService.getRole();
|
||||||
|
|
||||||
|
if(roleUser == "ROLE_PARENT"){
|
||||||
|
this.parent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onClickDelete(numPerson: number){
|
onClickDelete(numPerson: number){
|
||||||
window.alert("Le contact à bien été supprimé!")
|
window.alert("Le contact à bien été supprimé!")
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light shadow py-0 ">
|
<nav
|
||||||
<div class="container-fluid">
|
class="navbar sticky-top navbar-expand-lg navbar-light bg-light shadow py-0"
|
||||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
>
|
||||||
<div class="navbar-nav">
|
<div class="container-fluid">
|
||||||
<img id="img" routerLink="accueil" routerLinkActive="active-custom" src="../../../assets/images/logo-organizee.png"/>
|
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||||
</div>
|
<div class="navbar-nav">
|
||||||
</div>
|
<img
|
||||||
<a class="navbar-brand" href="#">Organizee</a>
|
id="img"
|
||||||
|
routerLink="accueil"
|
||||||
|
routerLinkActive="active-custom"
|
||||||
|
src="../../../assets/images/logo-organizee.png"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<a class="navbar-brand" href="#">Organizee</a>
|
||||||
|
</div>
|
||||||
|
<app-deconnexion *ngIf="isLogged"></app-deconnexion>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.navbar-brand {
|
.navbar-brand {
|
||||||
position: absolute;
|
position: relative;
|
||||||
margin-left: 12%;
|
margin-right: 70%;
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
|
@ -29,5 +29,8 @@ a:active {
|
||||||
}
|
}
|
||||||
|
|
||||||
#img {
|
#img {
|
||||||
margin-left: 50%;
|
position: absolute;
|
||||||
|
max-width: 5%;
|
||||||
|
margin-left: 5%;
|
||||||
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-header',
|
selector: 'app-header',
|
||||||
|
@ -6,10 +8,20 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./header.component.scss']
|
styleUrls: ['./header.component.scss']
|
||||||
})
|
})
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent implements OnInit {
|
||||||
|
isLogged=false;
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
constructor(public tokenService : TokenService){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
if(this.tokenService.getToken()){
|
||||||
|
this.isLogged=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -23,9 +23,15 @@
|
||||||
routerLinkActive="active-custom">S'inscrire</button>
|
routerLinkActive="active-custom">S'inscrire</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
<a routerLink="/password-oublie" routerLinkActive="active-custom" class="nav-link">password perdu ?</a>
|
||||||
<div *ngIf="errorForm">
|
<!-- <div *ngIf="errorForm">
|
||||||
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
||||||
</div>
|
</div> -->
|
||||||
|
<app-alert *ngIf="isShow" [alert]="alert" (eventClose)="onClickCloseAlert();"></app-alert>
|
||||||
|
<!-- <div *ngIf="isShow">
|
||||||
|
<div class="alert alert-{{alert.type}}" role="alert">
|
||||||
|
{{alert.content}}
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,9 +14,10 @@ import {
|
||||||
styleUrls: ['./signin.component.scss'],
|
styleUrls: ['./signin.component.scss'],
|
||||||
})
|
})
|
||||||
export class SigninComponent implements OnInit {
|
export class SigninComponent implements OnInit {
|
||||||
public errorForm: boolean;
|
alert : any;
|
||||||
|
isShow : boolean;
|
||||||
constructor(private authService: AuthService, private router: Router) {
|
constructor(private authService: AuthService, private router: Router) {
|
||||||
this.errorForm = false;
|
this.isShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
|
@ -26,13 +27,26 @@ export class SigninComponent implements OnInit {
|
||||||
const email = submittedForm.form.value['email'];
|
const email = submittedForm.form.value['email'];
|
||||||
const password = submittedForm.form.value['password'];
|
const password = submittedForm.form.value['password'];
|
||||||
if (email !== '' && password !== '') {
|
if (email !== '' && password !== '') {
|
||||||
this.authService.signin(email, password).subscribe((resp) => {
|
this.authService.signin(email, password).subscribe(
|
||||||
console.log('Component Signin: ', resp);
|
{
|
||||||
this.router.navigate(['tableau-de-bord']);
|
next: resp => {
|
||||||
});
|
this.router.navigate(['tableau-de-bord']);
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.alert={"type":"danger", "content":"Le login ou paswword est invalide"};
|
||||||
|
this.isShow = true;
|
||||||
|
},
|
||||||
|
complete: () => console.log('DONE!')
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// afficher une erreur à l'utilisateur
|
// afficher une erreur à l'utilisateur
|
||||||
this.errorForm = true;
|
this.alert={"type":"danger", "content":"Le login ou password est invalide"};
|
||||||
|
this.isShow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickCloseAlert(){
|
||||||
|
console.log('fermeture');
|
||||||
|
this.isShow = ! this.isShow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +1,70 @@
|
||||||
<input
|
<div class="container">
|
||||||
type="text"
|
<input
|
||||||
class="todo-title"
|
type="text"
|
||||||
placeholder="Titre"
|
class="todo-title btn btn-outline-success"
|
||||||
value = "{{todo.nom}}"
|
placeholder="Titre"
|
||||||
/>
|
value="{{ todo.nom }}"
|
||||||
<div>
|
[(ngModel)]="todo.nom"
|
||||||
<button (click)="effacerList()">Effacer la To Do List</button>
|
(keyup.enter)="updateTodo(todo)"
|
||||||
</div>
|
/>
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="todo-input"
|
|
||||||
placeholder="+ Nouvelle Tâche"
|
|
||||||
[(ngModel)]="todoTitle"
|
|
||||||
(keyup.enter)="addTache(todo.id)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
<i class="bi bi-trash3" (click)="deleteTodo(todo.id)"></i>
|
||||||
|
<div class="row justify-align">
|
||||||
<div class="element" *ngFor="let tache of todo.taches">
|
|
||||||
<div class="element-gauche">
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="text"
|
||||||
[(ngModel)]="tache.etat"
|
class="todo-input shadow justify-center"
|
||||||
(change)="doneEdit(tache)"
|
placeholder="+ Nouvelle Tâche"
|
||||||
checked="checked"
|
[(ngModel)]="todoTitle"
|
||||||
|
(keyup.enter)="addTache(todo.id)"
|
||||||
/>
|
/>
|
||||||
<div
|
|
||||||
*ngIf="!tache.editing; else editingTodo"
|
|
||||||
class="nomTache"
|
|
||||||
[ngClass]="{ completed: tache.etat }"
|
|
||||||
(dblclick)="modifier(tache)"
|
|
||||||
>
|
|
||||||
{{ tache.texte }}
|
|
||||||
</div>
|
|
||||||
<ng-template #editingTodo>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="modifier-element"
|
|
||||||
[(ngModel)]="tache.texte"
|
|
||||||
(blur)="doneEdit(tache)"
|
|
||||||
(keyup.enter)="doneEdit(tache)"
|
|
||||||
(keyup.esc)="cancelEdit(tache)"
|
|
||||||
autofocus
|
|
||||||
/>
|
|
||||||
</ng-template>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="deleteTache" (click)="deleteTodo(tache.id)">×</div>
|
<div
|
||||||
</div>
|
class="element btn btn-outline-success shadow"
|
||||||
|
*ngFor="let tache of todo.taches"
|
||||||
|
>
|
||||||
|
<div class="element-gauche">
|
||||||
<div class="extra-container">
|
<input
|
||||||
<div>
|
type="checkbox"
|
||||||
<label
|
[(ngModel)]="tache.etat"
|
||||||
><input
|
(change)="doneEdit(tache)"
|
||||||
|
checked="checked"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
*ngIf="!tache.editing; else editingTodo"
|
||||||
|
class="nomTache"
|
||||||
|
[ngClass]="{ completed: tache.etat }"
|
||||||
|
(dblclick)="modifier(tache)"
|
||||||
|
>
|
||||||
|
{{ tache.texte }}
|
||||||
|
</div>
|
||||||
|
<ng-template #editingTodo>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="modifier-element"
|
||||||
|
[(ngModel)]="tache.texte"
|
||||||
|
(blur)="doneEdit(tache)"
|
||||||
|
(keyup.enter)="doneEdit(tache)"
|
||||||
|
(keyup.esc)="cancelEdit(tache)"
|
||||||
|
autofocus
|
||||||
|
/>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
<div class="deleteTache" (click)="deleteTache(tache.id)">×</div>
|
||||||
|
</div>
|
||||||
|
<div class="selection">
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
class="selection"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
(change)="cocherAllTodoList()"
|
(change)="cocherAllTodoList()"
|
||||||
[(ngModel)]="masterSelected"
|
[(ngModel)]="masterSelected"
|
||||||
/>Selectionner toutes les tâches</label
|
/>Selectionner toutes les tâches</label
|
||||||
>
|
>
|
||||||
|
<div class="casesRestantes">{{ toDoRest() }} tâche(s) restante(s)</div>
|
||||||
</div>
|
</div>
|
||||||
<div>{{ toDoRest() }} tâches</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="extra-container">
|
<!--<div class="extra-container">
|
||||||
<!-- <div>
|
<div>
|
||||||
<button [ngClass]="{ active: filter === 'tous' }" (click)="filter = 'tous'">
|
<button [ngClass]="{ active: filter === 'tous' }" (click)="filter = 'tous'">
|
||||||
Toutes la To Do List
|
Toutes la To Do List
|
||||||
</button>
|
</button>
|
||||||
|
@ -80,6 +81,5 @@
|
||||||
Terminées
|
Terminées
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
-->
|
|
||||||
|
|
||||||
</div>
|
</div> -->
|
||||||
|
|
|
@ -1,30 +1,60 @@
|
||||||
|
.container {
|
||||||
|
border: 3px #4e9e7b solid;
|
||||||
|
padding: 5%;
|
||||||
|
min-width: 300px;
|
||||||
|
max-width: 30%;
|
||||||
|
margin: 5%;
|
||||||
|
border-radius: 5%;
|
||||||
|
margin-bottom: 20% !important;
|
||||||
|
}
|
||||||
|
|
||||||
.todo-title {
|
.todo-title {
|
||||||
width: 25%;
|
width: 75%;
|
||||||
padding: 10px 18px;
|
padding: 10px 18px;
|
||||||
font-size: xx-large;
|
font-size: large !important;
|
||||||
margin-bottom: 16px;
|
font-weight: bold !important;
|
||||||
|
color: #4e9e7b !important;
|
||||||
|
border-top-color: #4e9e7b !important;
|
||||||
|
border-left-color: #4e9e7b !important;
|
||||||
|
border-radius: 5% !important;
|
||||||
|
margin-top: 0%;
|
||||||
|
margin-bottom: 5%;
|
||||||
|
margin-right: 3% !important;
|
||||||
|
color: black;
|
||||||
|
box-shadow: 5px 5px 5px gray;
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
background-color: lightgray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-input {
|
.todo-input {
|
||||||
width: 20%;
|
width: 75%;
|
||||||
padding: 10px 18px;
|
padding: 10px 18px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
color: white !important;
|
||||||
|
background-color: #4e9e7b !important;
|
||||||
|
border-radius: 5%;
|
||||||
|
margin-left: 4%;
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
background-color: lightgray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.element {
|
.element {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
animation-duration: 0.3s;
|
animation-duration: 0.3s;
|
||||||
|
color: black;
|
||||||
|
background-color: #4e9e7b;
|
||||||
|
}
|
||||||
|
|
||||||
|
::placeholder {
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.deleteTache {
|
.deleteTache {
|
||||||
|
@ -36,56 +66,66 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.element-gauche { // later
|
.element-gauche {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nomTache{
|
.nomTache {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid white;
|
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modifier-element {
|
.modifier-element {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
color: #2c3e50;
|
color: white;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid rgb(204, 204, 204); //override defaults
|
border: 1px solid rgb(204, 204, 204); //override defaults
|
||||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color:aquamarine;
|
background-color: grey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selection {
|
||||||
|
margin-left: 0%;
|
||||||
|
text-align: left;
|
||||||
|
font-size: medium;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #4e9e7b;
|
||||||
|
}
|
||||||
|
|
||||||
.completed {
|
.completed {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
color: grey;
|
color: white !important;
|
||||||
|
}
|
||||||
|
.casesRestantes {
|
||||||
|
color: #4cc690;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* button {
|
||||||
button {
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: lightgreen;
|
background: grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
.active {
|
/* .active {
|
||||||
background: lightgreen;
|
background: grey;
|
||||||
}
|
} */
|
||||||
.completed {
|
/* .completed {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Tache} from 'src/app/models/tache';
|
import { Tache } from 'src/app/models/tache';
|
||||||
import { ToDoList} from 'src/app/models/to-do-list';
|
import { ToDoList } from 'src/app/models/to-do-list';
|
||||||
import { TodoService } from 'src/app/services/todo.service';
|
import { TodoService } from 'src/app/services/todo.service';
|
||||||
import { TodoList } from 'src/app/todo-list';
|
import { TodoList } from 'src/app/todo-list';
|
||||||
|
|
||||||
|
@ -16,49 +16,59 @@ export class ToDoListComponent implements OnInit {
|
||||||
//public todos: ToDoList[];
|
//public todos: ToDoList[];
|
||||||
public todoTitle: string;
|
public todoTitle: string;
|
||||||
public idTodo: number;
|
public idTodo: number;
|
||||||
public filter : string;
|
public filter: string;
|
||||||
public casesRestantes : boolean;
|
public casesRestantes: boolean;
|
||||||
public masterSelected: boolean;
|
public masterSelected: boolean;
|
||||||
public result : any;
|
public result: any;
|
||||||
public tache : Tache [];
|
public tache: Tache[];
|
||||||
|
|
||||||
constructor(private TodoService : TodoService, private router: Router ) {
|
constructor(private TodoService: TodoService, private router: Router) {
|
||||||
this.beforeEditCache = '';
|
this.beforeEditCache = '';
|
||||||
//this.todos = [];
|
//this.todos = [];
|
||||||
this.todoTitle = '';
|
this.todoTitle = '';
|
||||||
this.idTodo = 0;
|
this.idTodo = 0;
|
||||||
this.filter ='';
|
this.filter = '';
|
||||||
this.casesRestantes=true;
|
this.casesRestantes = true;
|
||||||
this.masterSelected= false;
|
this.masterSelected = false;
|
||||||
this.tache = [];
|
this.tache = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.beforeEditCache = '';
|
this.beforeEditCache = '';
|
||||||
this.casesRestantes=true;
|
this.casesRestantes = true;
|
||||||
this.filter='tous';
|
this.filter = 'tous';
|
||||||
this.idTodo = 4;
|
this.idTodo = 4;
|
||||||
this.todoTitle = '';
|
this.todoTitle = '';
|
||||||
|
}
|
||||||
|
//supprimer la todoList
|
||||||
|
deleteTodo(id: number): void {
|
||||||
|
this.TodoService.deleteTodoById(id).subscribe((resp) => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//ajouter tache
|
//ajouter tache
|
||||||
|
|
||||||
addTache(idTodoList : number) {//idTodoList id que la todoList que l'on récupère
|
addTache(idTodoList: number) {
|
||||||
console.log(idTodoList);
|
//idTodoList id que la todoList que l'on récupère
|
||||||
|
console.log(idTodoList);
|
||||||
const tache: Tache = {
|
const tache: Tache = {
|
||||||
id : 0,
|
id: 0,
|
||||||
texte: this.todoTitle,
|
texte: this.todoTitle,
|
||||||
etat : false,
|
etat: false,
|
||||||
editing : false,
|
editing: false,
|
||||||
|
};
|
||||||
}
|
|
||||||
console.log(this.tache);
|
console.log(this.tache);
|
||||||
this.TodoService.addTache(tache,idTodoList).subscribe((resp)=>{
|
this.TodoService.addTache(tache, idTodoList).subscribe((resp) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//modifier le titre de la to-do-list
|
||||||
|
updateTodo(todoList: ToDoList): void {
|
||||||
|
this.TodoService.updateTodo(todoList)?.subscribe((resp) => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//modifier par l'input
|
//modifier par l'input
|
||||||
modifier(tache: Tache): void {
|
modifier(tache: Tache): void {
|
||||||
|
@ -71,13 +81,12 @@ console.log(idTodoList);
|
||||||
if (tache.texte.trim().length === 0) {
|
if (tache.texte.trim().length === 0) {
|
||||||
tache.texte = this.beforeEditCache;
|
tache.texte = this.beforeEditCache;
|
||||||
}
|
}
|
||||||
this.casesRestantes= this.casesQuiRestes();
|
this.casesRestantes = this.casesQuiRestes();
|
||||||
tache.editing = false;
|
tache.editing = false;
|
||||||
this.TodoService.updateTache(tache).subscribe((resp)=>{
|
this.TodoService.updateTache(tache).subscribe((resp) => {
|
||||||
console.log(tache);
|
console.log(tache);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// annuler la modification
|
// annuler la modification
|
||||||
|
@ -87,23 +96,20 @@ console.log(idTodoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//supprimer la tache
|
//supprimer la tache
|
||||||
deleteTodo(id: number) {
|
deleteTache(id: number) {
|
||||||
this.TodoService.deleteTacheById(id).subscribe(
|
this.TodoService.deleteTacheById(id).subscribe((resp) => {
|
||||||
resp =>{
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
});
|
||||||
);}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//nombre de tâches restantes
|
//nombre de tâches restantes
|
||||||
toDoRest(): number{
|
toDoRest(): number {
|
||||||
return this.todo.taches.filter((tache: Tache)=> !tache.etat).length;
|
return this.todo.taches.filter((tache: Tache) => !tache.etat).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Cocher toutes les tâches de la liste
|
//Cocher toutes les tâches de la liste
|
||||||
listComplete(): boolean {
|
listComplete(): boolean {
|
||||||
return this.todo.taches.filter((tache: Tache)=> tache).length>0;
|
return this.todo.taches.filter((tache: Tache) => tache).length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Effacer la to do list
|
//Effacer la to do list
|
||||||
|
@ -125,7 +131,7 @@ console.log(idTodoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//barre de filtre des tâches
|
//barre de filtre des tâches
|
||||||
/* todosFilter(): ToDoList[] {
|
/* todosFilter(): ToDoList[] {
|
||||||
if(this.filter === 'tous'){
|
if(this.filter === 'tous'){
|
||||||
return this.todo.taches
|
return this.todo.taches
|
||||||
}else if (this.filter === 'active'){
|
}else if (this.filter === 'active'){
|
||||||
|
@ -135,6 +141,4 @@ console.log(idTodoList);
|
||||||
}
|
}
|
||||||
return this.todo
|
return this.todo
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
5
src/app/models/mail.ts
Normal file
5
src/app/models/mail.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export interface Mail {
|
||||||
|
recipient: string;
|
||||||
|
subject: string;
|
||||||
|
message: string;
|
||||||
|
}
|
|
@ -3,9 +3,6 @@ import { Team } from './team';
|
||||||
|
|
||||||
export interface ToDoList {
|
export interface ToDoList {
|
||||||
nom: string;
|
nom: string;
|
||||||
team: Team;
|
taches: Tache[];
|
||||||
taches: Tache [];
|
id: number;
|
||||||
id:number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,29 +3,45 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
<div class="col-9 offset-2" id="main">
|
<div class="col-9 offset-2" id="main">
|
||||||
<h1>Ma team</h1>
|
<h1>Ma team</h1>
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<button button type="button" class="btn btn-primary btn-lg"
|
<button
|
||||||
routerLink="../modifier-compte"
|
button
|
||||||
routerLinkActive="active-custom">Modifier mon compte</button>
|
type="button"
|
||||||
</div>
|
class="btn btn-primary btn-lg"
|
||||||
<div class="d-flex justify-content-center">
|
routerLink="../modifier-compte"
|
||||||
<button button type="button" class="btn btn-primary btn-lg"
|
routerLinkActive="active-custom"
|
||||||
routerLink="../supprimer-compte"
|
>
|
||||||
routerLinkActive="active-custom">Supprimer mon compte</button>
|
Modifier mon compte
|
||||||
</div>
|
</button>
|
||||||
<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 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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { MembreService } from 'src/app/services/membre.service';
|
import { MembreService } from 'src/app/services/membre.service';
|
||||||
import { TeamService } from 'src/app/services/team.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-account',
|
selector: 'app-page-account',
|
||||||
|
@ -10,14 +10,15 @@ import { TeamService } from 'src/app/services/team.service';
|
||||||
export class PageAccountComponent implements OnInit {
|
export class PageAccountComponent implements OnInit {
|
||||||
public listMembres: any[];
|
public listMembres: any[];
|
||||||
|
|
||||||
constructor(private teamService: TeamService, private membreService: MembreService) {
|
constructor(private membreService: MembreService) {
|
||||||
this.listMembres = [];
|
this.listMembres = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.membreService.getMembres().subscribe((membres: any[]) => {
|
this.membreService.getMembresByTeamId()?.subscribe((membres: any[]) => {
|
||||||
|
console.log(membres);
|
||||||
this.listMembres = membres;
|
this.listMembres = membres;
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-accueil',
|
selector: 'app-page-accueil',
|
||||||
|
@ -7,9 +10,15 @@ import { Component, OnInit } from '@angular/core';
|
||||||
})
|
})
|
||||||
export class PageAccueilComponent implements OnInit {
|
export class PageAccueilComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
const token = this.tokenService.getToken();
|
||||||
|
if(token){
|
||||||
|
this.router.navigate(['tableau-de-bord']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
|
@ -6,12 +7,14 @@
|
||||||
<div class="form-addMember">
|
<div class="form-addMember">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="color"
|
<input
|
||||||
class="form-control"
|
type="color"
|
||||||
id="floatingInputcouleur"
|
class="form-control"
|
||||||
placeholder=""
|
id="floatingInputcouleur"
|
||||||
name="couleur"
|
placeholder=""
|
||||||
formControlName="couleurFc">
|
name="couleur"
|
||||||
|
formControlName="couleurFc"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
|
@ -68,7 +71,9 @@
|
||||||
!addMemberForm.controls['dateNaissanceFc'].valid
|
!addMemberForm.controls['dateNaissanceFc'].valid
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<label for="floatingInputdateNaissance">VOTRE DATE DE NAISSANCE</label>
|
<label for="floatingInputdateNaissance"
|
||||||
|
>VOTRE DATE DE NAISSANCE</label
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
|
@ -87,7 +92,20 @@
|
||||||
!addMemberForm.controls['emailFc'].valid
|
!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>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
|
@ -125,17 +143,20 @@
|
||||||
!addMemberForm.controls['passwordConfirmFc'].valid
|
!addMemberForm.controls['passwordConfirmFc'].valid
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<label for="floatingPasswordConfirm">CONFIRMEZ VOTRE MOT DE PASSE</label>
|
<label for="floatingPasswordConfirm"
|
||||||
|
>CONFIRMEZ VOTRE MOT DE PASSE</label
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="w-100 btn btn-lg btn-outline-success"
|
class="w-100 btn btn-lg btn-outline-success"
|
||||||
type="submit"
|
type="submit"
|
||||||
[disabled]="addMemberForm.invalid"
|
[disabled]="addMemberForm.invalid"
|
||||||
>Ajouter le membre</button>
|
>
|
||||||
|
Ajouter le membre
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { Mail } from 'src/app/models/mail';
|
||||||
import { Membre } from 'src/app/models/membre';
|
import { Membre } from 'src/app/models/membre';
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
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 { MembreService } from 'src/app/services/membre.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,6 +17,7 @@ export class PageAddMemberComponent implements OnInit {
|
||||||
public addMemberForm: FormGroup;
|
public addMemberForm: FormGroup;
|
||||||
constructor(
|
constructor(
|
||||||
private membreService: MembreService,
|
private membreService: MembreService,
|
||||||
|
private mailService: MailService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private fb: FormBuilder
|
private fb: FormBuilder
|
||||||
|
@ -29,6 +32,7 @@ export class PageAddMemberComponent implements OnInit {
|
||||||
firstNameFc: new FormControl('', [Validators.required]),
|
firstNameFc: new FormControl('', [Validators.required]),
|
||||||
lastNameFc: new FormControl('', [Validators.required]),
|
lastNameFc: new FormControl('', [Validators.required]),
|
||||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||||
|
roleFc: new FormControl('', []),
|
||||||
couleurFc: new FormControl('', []),
|
couleurFc: new FormControl('', []),
|
||||||
emailFc: new FormControl('', [
|
emailFc: new FormControl('', [
|
||||||
Validators.email,
|
Validators.email,
|
||||||
|
@ -53,9 +57,10 @@ export class PageAddMemberComponent implements OnInit {
|
||||||
public onSubmit(): void {
|
public onSubmit(): void {
|
||||||
console.log('value : ', this.addMemberForm.value);
|
console.log('value : ', this.addMemberForm.value);
|
||||||
console.log('form : ', this.addMemberForm);
|
console.log('form : ', this.addMemberForm);
|
||||||
const firstNameValue = this.addMemberForm.value['firstNameFc'];
|
|
||||||
const lastNameValue = this.addMemberForm.value['lastNameFc'];
|
const lastNameValue = this.addMemberForm.value['lastNameFc'];
|
||||||
|
const firstNameValue = this.addMemberForm.value['firstNameFc'];
|
||||||
const emailValue = this.addMemberForm.value['emailFc'];
|
const emailValue = this.addMemberForm.value['emailFc'];
|
||||||
|
const roleValue = this.addMemberForm.value['roleFc'];
|
||||||
const passwordValue = this.addMemberForm.value['passwordFc'];
|
const passwordValue = this.addMemberForm.value['passwordFc'];
|
||||||
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
||||||
const couleurValue = this.addMemberForm.value['couleurFc'];
|
const couleurValue = this.addMemberForm.value['couleurFc'];
|
||||||
|
@ -63,19 +68,31 @@ export class PageAddMemberComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
const membre: Membre = {
|
const membre: Membre = {
|
||||||
nom: firstNameValue,
|
nom: lastNameValue,
|
||||||
prenom: lastNameValue,
|
prenom: firstNameValue,
|
||||||
email: emailValue,
|
email: emailValue,
|
||||||
password: passwordValue,
|
password: passwordValue,
|
||||||
couleur: couleurValue,
|
couleur: couleurValue,
|
||||||
dateNaissance: dateNaissanceValue,
|
dateNaissance: dateNaissanceValue,
|
||||||
passwordConfirm: passwordConfirmValue,
|
passwordConfirm: passwordConfirmValue,
|
||||||
roleList: ["ROLE_PARENT"]
|
roleList: [roleValue]
|
||||||
|
};
|
||||||
|
|
||||||
|
const mail: Mail = {
|
||||||
|
recipient: emailValue,
|
||||||
|
subject: "Votre mot de passe Organizee",
|
||||||
|
//message: 'Votre mot de passe'
|
||||||
|
message: `Bonjour ${firstNameValue}!\n Voici vos identifiants de connexion : \n
|
||||||
|
Identifiant : ${emailValue}
|
||||||
|
Mot de passe : ${passwordValue}`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (membre.email !== '' && membre.password !== '') {
|
if (membre.email !== '' && membre.password !== '') {
|
||||||
this.membreService.addMembre(membre).subscribe((resp) => {
|
this.membreService.addMembre(membre)?.subscribe((resp) => {
|
||||||
|
this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{
|
||||||
|
console.log("Mail envoyé");
|
||||||
|
})
|
||||||
this.router.navigate(['compte']);
|
this.router.navigate(['compte']);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,37 +1,86 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<app-side-bar></app-side-bar>
|
<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">
|
<app-alert *ngIf="isShow" [alert]="alert" (eventClose)="onClickCloseAlert();"></app-alert>
|
||||||
{{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
|
||||||
<div style="width:150px;">
|
class="alert alert-{{ alert.type }}"
|
||||||
<app-side-bar></app-side-bar>
|
role="alert"
|
||||||
</div>
|
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="width: 100%;">
|
<div style="display: flex">
|
||||||
<div class="wrap">
|
<div style="width: 150px">
|
||||||
<div class="left">
|
<app-side-bar></app-side-bar>
|
||||||
<daypilot-navigator [config]="navigatorConfig" [(date)]="date" #navigator></daypilot-navigator>
|
</div>
|
||||||
</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>
|
<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
|
||||||
|
>
|
||||||
|
|
||||||
<daypilot-calendar [config]="config" [events]="events" #calendar (viewChange)="viewChange()"></daypilot-calendar>
|
<!-- DEBUT : Pour le debugage -->
|
||||||
|
<span *ngIf="debug">team : {{ teamId }} - user: {{ userId }} - role: {{ role }}</span>
|
||||||
|
<!-- FIN : Pour le debugage -->
|
||||||
|
|
||||||
</div>
|
<span style="float: right"
|
||||||
|
><a
|
||||||
|
href="#"
|
||||||
|
class="btn btn-sm btn-primary"
|
||||||
|
style="margin-right: 5px"
|
||||||
|
>Ajouter un évènement</a
|
||||||
|
></span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<daypilot-calendar
|
||||||
|
[config]="config"
|
||||||
|
[events]="events"
|
||||||
|
#calendar
|
||||||
|
(viewChange)="viewChange()"
|
||||||
|
></daypilot-calendar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -2,7 +2,7 @@ import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
|
||||||
import { DayPilot, DayPilotCalendarComponent, DayPilotNavigatorComponent } from "@daypilot/daypilot-lite-angular";
|
import { DayPilot, DayPilotCalendarComponent, DayPilotNavigatorComponent } from "@daypilot/daypilot-lite-angular";
|
||||||
import { EvenementService } from 'src/app/services/evenement.service';
|
import { EvenementService } from 'src/app/services/evenement.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import jwt_decode from 'jwt-decode';
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-agenda',
|
selector: 'app-page-agenda',
|
||||||
|
@ -10,7 +10,7 @@ import jwt_decode from 'jwt-decode';
|
||||||
styleUrls: ['./page-agenda.component.scss']
|
styleUrls: ['./page-agenda.component.scss']
|
||||||
})
|
})
|
||||||
export class PageAgendaComponent implements AfterViewInit {
|
export class PageAgendaComponent implements AfterViewInit {
|
||||||
|
debug: boolean;
|
||||||
userId : any;
|
userId : any;
|
||||||
teamId : any;
|
teamId : any;
|
||||||
role:any;
|
role:any;
|
||||||
|
@ -20,9 +20,10 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||||
@ViewChild("navigator") navigator!: DayPilotNavigatorComponent;
|
@ViewChild("navigator") navigator!: DayPilotNavigatorComponent;
|
||||||
@ViewChild("calendar") calendar!: DayPilotCalendarComponent;
|
@ViewChild("calendar") calendar!: DayPilotCalendarComponent;
|
||||||
|
|
||||||
constructor(private evenementService:EvenementService) {
|
constructor(private evenementService:EvenementService, private tokenService: TokenService) {
|
||||||
this.isShow = false;
|
this.isShow = false;
|
||||||
this.alert = "";
|
this.alert = "";
|
||||||
|
this.debug = environment.debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
get date(): DayPilot.Date {
|
get date(): DayPilot.Date {
|
||||||
|
@ -55,15 +56,9 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const token = localStorage.getItem(environment.tokenKey);
|
this.userId = this.tokenService.getCurrentMembreId();
|
||||||
if(token) {
|
this.teamId = this.tokenService.getCurrentTeamId();
|
||||||
const decodedToken = jwt_decode<any>(token);
|
this.role = this.tokenService.getRole();
|
||||||
this.userId = decodedToken.userId;
|
|
||||||
this.teamId = decodedToken.teamId;
|
|
||||||
this.role = decodedToken.auth[0].authority;
|
|
||||||
}else{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// petite triche pour eviter la repetition du nom dans le RDV
|
// petite triche pour eviter la repetition du nom dans le RDV
|
||||||
|
@ -188,25 +183,31 @@ export class PageAgendaComponent implements AfterViewInit {
|
||||||
end: args.e.end(),
|
end: args.e.end(),
|
||||||
id: args.e.id(),
|
id: args.e.id(),
|
||||||
barColor: "#555555",
|
barColor: "#555555",
|
||||||
text: args.e.text(),
|
text: this.rdvSplit(args.e.text()),
|
||||||
membre: {id:this.userId},
|
membre: {id:args.e.data.tags.membre},
|
||||||
team: {id:this.teamId}
|
team: {id:this.teamId}
|
||||||
}
|
}
|
||||||
this.evenementService.updateEvenements(event).subscribe(
|
if( (args.e.data.tags.membre == this.userId) || (this.role == 'ROLE_PARENT')){ // mettre role parent en variable
|
||||||
{
|
this.evenementService.updateEvenements(event).subscribe(
|
||||||
next: result => {
|
{
|
||||||
this.viewChange();
|
next: result => {
|
||||||
this.alert={"type":"success", "content":"L'évènement à bien été modifié"};
|
this.viewChange();
|
||||||
this.isShow = true;
|
this.alert={"type":"success", "content":"L'évènement à bien été déplacé"};
|
||||||
},
|
this.isShow = true;
|
||||||
error: err => {
|
},
|
||||||
this.viewChange();
|
error: err => {
|
||||||
this.alert={"type":"danger", "content":"Problème lors de la modification de l'évenment"};
|
this.viewChange();
|
||||||
this.isShow = true;
|
this.alert={"type":"danger", "content":"Problème lors de la modification de l'évenement"};
|
||||||
},
|
this.isShow = true;
|
||||||
complete: () => console.log('DONE!')
|
},
|
||||||
}
|
complete: () => console.log('DONE!')
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
this.viewChange();
|
||||||
|
this.alert={"type":"danger", "content":"Vous ne pouvez pas déplacé cet évènement !"};
|
||||||
|
this.isShow = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,86 +1,147 @@
|
||||||
<div>
|
<app-header></app-header>
|
||||||
<app-header></app-header>
|
<div class="row">
|
||||||
|
<div class="col-md-auto">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
</div>
|
</div>
|
||||||
<div class="ajoutContact-form text-center">
|
<div class="ajoutContact-form text-center">
|
||||||
<h1>Ajouter un contact</h1>
|
<h3>Ajouter un contact</h3>
|
||||||
<main class="form-ajoutContact">
|
<main class="form-ajoutContact">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm">
|
||||||
|
<div class="form-floating">
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
class="form-control"
|
||||||
|
id="floatingInputcouleur"
|
||||||
|
placeholder=""
|
||||||
|
name="couleur"
|
||||||
|
formControlName="couleurFc"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
|
<input
|
||||||
formControlName="couleurFc">
|
type="text"
|
||||||
</div>
|
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">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input
|
||||||
class="form-control"
|
type="date"
|
||||||
id="floatingInputlastName"
|
class="form-control"
|
||||||
placeholder=""
|
id="floatingInputdateNaissance"
|
||||||
name="lastName"
|
placeholder=""
|
||||||
formControlName="lastNameFc">
|
name="dateNaissance"
|
||||||
<label for="floatingInputlastName">Nom</label>
|
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>
|
||||||
|
|
||||||
</div>
|
<div class="form-floating">
|
||||||
<div class="form-floating">
|
<input
|
||||||
<input type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInputfirstName"
|
id="floatingInputTelephone"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="firstName"
|
name="telephone"
|
||||||
formControlName="firstNameFc">
|
formControlName="telephoneFc"
|
||||||
<label for="floatingInputfirstName">Prénom</label>
|
/>
|
||||||
|
<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">
|
||||||
<div class="form-floating">
|
<input
|
||||||
<input type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInputTelephone"
|
id="floatingInputAdresse"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="telephone"
|
name="adresse"
|
||||||
formControlName="telephoneFc">
|
formControlName="adresseFc"
|
||||||
<label for="floatingInputfirstName">Téléphone</label>
|
/>
|
||||||
|
<label for="floatingInputfirstName">Adresse</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
</div>
|
class="w-100 btn btn-lg btn-secondary"
|
||||||
<div class="form-floating">
|
type="submit"
|
||||||
<input type="email"
|
[disabled]="ajoutContactForm.invalid"
|
||||||
class="form-control"
|
>
|
||||||
id="floatingInput"
|
Valider
|
||||||
placeholder=""
|
</button>
|
||||||
name="email"
|
</form>
|
||||||
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"
|
|
||||||
[disabled]="ajoutContactForm.invalid">Valider</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</main>
|
</main>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,27 +1,40 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-auto">
|
<div class="row">
|
||||||
<app-side-bar></app-side-bar>
|
<div class="col-md-auto">
|
||||||
</div>
|
<app-side-bar></app-side-bar>
|
||||||
<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>
|
</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';
|
} from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Team } from 'src/app/models/team';
|
import { Team } from 'src/app/models/team';
|
||||||
|
import { MembreService } from 'src/app/services/membre.service';
|
||||||
import { TeamService } from 'src/app/services/team.service';
|
import { TeamService } from 'src/app/services/team.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -18,6 +19,7 @@ export class PageCreationTeamComponent implements OnInit {
|
||||||
public teamForm: FormGroup;
|
public teamForm: FormGroup;
|
||||||
constructor(
|
constructor(
|
||||||
private teamService: TeamService,
|
private teamService: TeamService,
|
||||||
|
private membreService: MembreService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private fb: FormBuilder
|
private fb: FormBuilder
|
||||||
) {
|
) {
|
||||||
|
@ -39,9 +41,6 @@ export class PageCreationTeamComponent implements OnInit {
|
||||||
const team: Team = {
|
const team: Team = {
|
||||||
nom : nameValue,
|
nom : nameValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (team.nom !== '' ) {
|
if (team.nom !== '' ) {
|
||||||
this.teamService.addTeam(team).subscribe((resp) => {
|
this.teamService.addTeam(team).subscribe((resp) => {
|
||||||
this.router.navigate(['compte']);
|
this.router.navigate(['compte']);
|
||||||
|
|
|
@ -1,13 +1,32 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
<app-meteo></app-meteo>
|
|
||||||
<app-humeur></app-humeur>
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 col-xs-6 box border" id="boxFour">
|
||||||
|
<div>
|
||||||
|
<app-humeur></app-humeur>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-center">
|
<div class="row avatar">
|
||||||
<button button type="button" class="btn btn-primary btn-lg" routerLink="../creation-team"
|
<div class="col" *ngFor="let membreData of listMembres">
|
||||||
routerLinkActive="active-custom">Créer ma team</button>
|
<app-card-avatar [membre]="membreData"> </app-card-avatar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
|
|
|
@ -1,5 +1,50 @@
|
||||||
|
.titre{
|
||||||
|
display: inline-flex;
|
||||||
|
margin-left: 20px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.meteo {
|
.meteo {
|
||||||
display: flex;
|
margin-left: 500px;
|
||||||
margin-left: 300px;
|
|
||||||
margin-top: -60px;
|
margin-top: -60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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 { 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({
|
@Component({
|
||||||
selector: 'app-page-dashboard',
|
selector: 'app-page-dashboard',
|
||||||
|
@ -8,26 +11,27 @@ import { FormsModule } from '@angular/forms';
|
||||||
})
|
})
|
||||||
export class PageDashboardComponent implements OnInit {
|
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 {
|
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>
|
<app-header></app-header>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-auto">
|
<div class="col-md-auto">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
</div>
|
</div>
|
||||||
<div class=" col compte text-center">
|
<div class="col compte text-center">
|
||||||
<h1>Supprimer ce membre</h1>
|
<h1>Supprimer ce membre</h1>
|
||||||
<main class="contenu-compte">
|
<main class="contenu-compte"></main>
|
||||||
|
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,10 +9,22 @@
|
||||||
<label for="floatingInput">Adresse email</label>
|
<label for="floatingInput">Adresse email</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="w-100 btn btn-lg btn-success" type="submit" [disabled]="forgotForm.invalid" routerLink="../reinitialisation-password"
|
<!-- <button class="w-100 btn btn-lg btn-success" type="submit" [disabled]="forgotForm.invalid" routerLink="../reinitialisation-password"
|
||||||
routerLinkActive="active-custom">Ré-initialiser mon mot de passe</button>
|
routerLinkActive="active-custom">Ré-initialiser mon mot de passe</button> -->
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="w-100 btn btn-lg btn-outline-success"
|
||||||
|
type="submit"
|
||||||
|
[disabled]="forgotForm.invalid">
|
||||||
|
Ré-initialiser mon mot de passe
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
<br/> <br/>
|
||||||
|
<div *ngIf="isShow">
|
||||||
|
<div class="alert alert-{{alert.type}}" role="alert">
|
||||||
|
{{alert.content}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!--
|
<!--
|
||||||
<div *ngIf="errorForm">
|
<div *ngIf="errorForm">
|
||||||
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
||||||
|
|
|
@ -7,6 +7,9 @@ import {
|
||||||
FormGroup,
|
FormGroup,
|
||||||
Validators,
|
Validators,
|
||||||
} from '@angular/forms';
|
} 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({
|
@Component({
|
||||||
selector: 'app-page-forgot-password',
|
selector: 'app-page-forgot-password',
|
||||||
|
@ -14,18 +17,76 @@ import {
|
||||||
styleUrls: ['./page-forgot-password.component.scss']
|
styleUrls: ['./page-forgot-password.component.scss']
|
||||||
})
|
})
|
||||||
export class PageForgotPasswordComponent implements OnInit {
|
export class PageForgotPasswordComponent implements OnInit {
|
||||||
constructor(private authService: AuthService, private router: Router) {
|
|
||||||
|
|
||||||
|
alert : any;
|
||||||
|
isShow : boolean;
|
||||||
|
|
||||||
|
constructor(private authService: AuthService, private router: Router, private mailService: MailService,) {
|
||||||
|
this.alert = "";
|
||||||
|
this.isShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
|
|
||||||
public onSubmit(submittedForm: any): void {
|
public onSubmit(submittedForm: any): void {
|
||||||
console.log(submittedForm.form.value);
|
const membre: Membre = {
|
||||||
|
nom: "",
|
||||||
|
prenom: "",
|
||||||
|
dateNaissance: new Date(),
|
||||||
|
email: submittedForm.form.value.email,
|
||||||
|
password: "",
|
||||||
|
roleList: ["ROLE_PARENT"],
|
||||||
|
couleur: "",
|
||||||
|
passwordConfirm: ""
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(membre);
|
||||||
|
// this.authService.forgotPassword(membre).subscribe((resp) => {
|
||||||
|
// console.log('----'+resp)
|
||||||
|
// });
|
||||||
|
|
||||||
|
this.authService.forgotPassword(membre).subscribe(
|
||||||
|
{
|
||||||
|
next: result => {
|
||||||
|
this.alert={"type":"success", "content":"Un mail à été envoyé !"};
|
||||||
|
this.isShow = true;
|
||||||
|
const mail: Mail = {
|
||||||
|
recipient: submittedForm.form.value.email,
|
||||||
|
subject: "Votre mot de passe Organizee",
|
||||||
|
//message: 'Votre mot de passe'
|
||||||
|
message: `
|
||||||
|
Bonjour!\n
|
||||||
|
Vous avez fait une demande de ré-initialisation de mot de passe. \n
|
||||||
|
Cliquez sur le lien pour définir un nouveau mot de passe: \n
|
||||||
|
Lien : http://192.168.1.16:4200/reinitialisation-password/${result}`
|
||||||
|
};
|
||||||
|
this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{
|
||||||
|
console.log("Mail envoyé");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.alert={"type":"danger", "content":"Le mail a merdé, ou il n'y a personne ds la bdd !"};
|
||||||
|
this.isShow = true;
|
||||||
|
},
|
||||||
|
complete: () => console.log('DONE!')
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// service resetpassword
|
||||||
|
// creer un random et le mettre dans password
|
||||||
|
//service envoi de mail // envoyer un lien avec ce random
|
||||||
|
// nouveau formulaire de reset password
|
||||||
|
// update du password
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// const email = submittedForm.form.value['email'];
|
// const email = submittedForm.form.value['email'];
|
||||||
// console.log(email);
|
// console.log(email);
|
||||||
window.alert("Vous allez recevoir un email pour re-initialiser votre mot de passe !")
|
//window.alert("Vous allez recevoir un email pour re-initialiser votre mot de passe !")
|
||||||
// this.router.navigate(['reinitialisation-password']);
|
// this.router.navigate(['reinitialisation-password']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-auto">
|
<div class="col-md-auto">
|
||||||
<app-side-bar class="sidebarMenu"></app-side-bar>
|
<app-side-bar class="sidebarMenu"></app-side-bar>
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<div>
|
<app-header></app-header>
|
||||||
<app-header></app-header>
|
<div class="row">
|
||||||
<app-side-bar></app-side-bar>
|
<div class="col-md-auto">
|
||||||
</div>
|
<app-side-bar></app-side-bar>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="modifContact-form text-center">
|
<div class="modifContact-form text-center">
|
||||||
<h1>Modifier ce contact</h1>
|
<h3>Modifier ce contact</h3>
|
||||||
<main class="form-modifContact">
|
<main class="form-modifContact">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="modifContactForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="modifContactForm">
|
||||||
|
|
||||||
|
@ -85,3 +86,4 @@
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
|
@ -1,41 +1,61 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-auto">
|
<div class="col-md-auto">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" col compte text-center py-3 border">
|
<div class="col compte text-center py-3 border">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-sm btn-rounded btn-secondary m-3" type="submit">Tous les contacts
|
<button
|
||||||
</button>
|
*ngIf="parent"
|
||||||
<button routerLink="/ajouter-contact" class="btn btn-sm btn-rounded btn-secondary m-3">
|
routerLink="/ajouter-contact"
|
||||||
Ajouter un contact
|
class="btn btn-sm btn-rounded btn-secondary m-3"
|
||||||
</button>
|
>
|
||||||
|
Ajouter un contact
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="input-group mb-3 d-flex justify-content-center">
|
<div class="input-group mb-3 d-flex justify-content-center">
|
||||||
<input type="text" class="form-control" placeholder="Rechercher un contact"
|
<input
|
||||||
aria-label="Rechercher un contact" aria-describedby="basic-addon2" #word
|
type="text"
|
||||||
(keyup)="onSearchChange(word.value)">
|
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 class="input-group-append"></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4>Liste des Contacts</h4>
|
<h4>Liste des Contacts</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-evenly">
|
<div class="row justify-content-evenly">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<div class="row my-3 d-flex justify-content-center flex-row" *ngFor="let personne of listContact"
|
<div
|
||||||
(click)="onClick(personne)">
|
class="row my-3 d-flex justify-content-center flex-row"
|
||||||
<div class="couleur col-4" [style.background-color]="personne.couleur"></div>
|
*ngFor="let personne of listContact"
|
||||||
<span class="fiche-contact col-7">{{ personne.prenom }} {{ personne.nom }}</span>
|
(click)="onClick(personne)"
|
||||||
</div>
|
>
|
||||||
</div>
|
<div
|
||||||
|
class="couleur col-4"
|
||||||
<div class="col-4" *ngIf="openDetails">
|
[style.background-color]="personne.couleur"
|
||||||
<app-fiche-contact [personne]="openDetails" (clickDelete)="onClickDelete($event)">
|
></div>
|
||||||
</app-fiche-contact>
|
<span class="fiche-contact col-7"
|
||||||
</div>
|
>{{ personne.prenom }} {{ personne.nom }}</span
|
||||||
</div>
|
>
|
||||||
|
</div>
|
||||||
</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>
|
</div>
|
|
@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Contact } from 'src/app/models/contact';
|
import { Contact } from 'src/app/models/contact';
|
||||||
import { RepertoireService } from 'src/app/services/repertoire.service';
|
import { RepertoireService } from 'src/app/services/repertoire.service';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-repertoire',
|
selector: 'app-page-repertoire',
|
||||||
|
@ -15,18 +16,27 @@ export class PageRepertoireComponent implements OnInit {
|
||||||
public personneid: any;
|
public personneid: any;
|
||||||
keyword: any;
|
keyword: any;
|
||||||
openDetails: any;
|
openDetails: any;
|
||||||
|
parent: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private repertoireService: RepertoireService,
|
private repertoireService: RepertoireService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute,
|
||||||
|
private tokenService: TokenService
|
||||||
) {
|
) {
|
||||||
this.listContact = [];
|
this.listContact = [];
|
||||||
this.listFull = [];
|
this.listFull = [];
|
||||||
this.listContactInfo = '';
|
this.listContactInfo = '';
|
||||||
|
this.parent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
const roleUser = this.tokenService.getRole();
|
||||||
|
|
||||||
|
if(roleUser == "ROLE_PARENT"){
|
||||||
|
this.parent = true;
|
||||||
|
}
|
||||||
|
|
||||||
//récupère tout les contact et leurs info
|
//récupère tout les contact et leurs info
|
||||||
this.repertoireService.getContact().subscribe((listContact: any[]) => {
|
this.repertoireService.getContact().subscribe((listContact: any[]) => {
|
||||||
console.log(listContact);
|
console.log(listContact);
|
||||||
|
@ -69,5 +79,6 @@ export class PageRepertoireComponent implements OnInit {
|
||||||
}
|
}
|
||||||
this.router.navigate(['repertoire/']);
|
this.router.navigate(['repertoire/']);
|
||||||
});
|
});
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,45 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<div class="reset-form text-center">
|
<div class="reset-form text-center">
|
||||||
<main class="form-reset">
|
<main class="form-reset">
|
||||||
<form (ngSubmit)="onSubmit(resetForm)" #resetForm="ngForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="resetForm">
|
||||||
<h3>Entrez ici votre email et votre nouveau mot de passe</h3>
|
<h3>Entrez ici votre email et votre nouveau mot de passe</h3>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="email" class="form-control" id="floatingEmail" placeholder="" name="email" ngModel required
|
<input
|
||||||
[ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['email'] != '' ,
|
type="password"
|
||||||
'is-invalid': resetForm.form.touched && resetForm.form.value['email'] == ''}">
|
class="form-control"
|
||||||
<label for="floatingEmail">Email</label>
|
id="floatingPassword"
|
||||||
|
placeholder=""
|
||||||
|
name="password"
|
||||||
|
formControlName="passwordFc"
|
||||||
|
[ngClass]="{
|
||||||
|
'is-valid':
|
||||||
|
resetForm.controls['passwordFc'].touched &&
|
||||||
|
resetForm.controls['passwordFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
resetForm.controls['passwordFc'].touched &&
|
||||||
|
!resetForm.controls['passwordFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
<label for="floatingPassword">MOT DE PASSE</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="password" class="form-control" id="floatingPassword" placeholder="" name="password" ngModel
|
<input
|
||||||
required [ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['password'] != '' ,
|
type="password"
|
||||||
'is-invalid': resetForm.form.touched && resetForm.form.value['password'] == ''}">
|
class="form-control"
|
||||||
<label for="floatingPassword">Mot de passe</label>
|
id="floatingpasswordConfirm"
|
||||||
|
placeholder=""
|
||||||
|
name="passwordConfirm"
|
||||||
|
formControlName="passwordConfirmFc"
|
||||||
|
[ngClass]="{
|
||||||
|
'is-valid':
|
||||||
|
resetForm.controls['passwordConfirmFc'].touched &&
|
||||||
|
resetForm.controls['passwordConfirmFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
resetForm.controls['passwordConfirmFc'].touched &&
|
||||||
|
!resetForm.controls['passwordConfirmFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
<label for="floatingPasswordConfirm">CONFIRMEZ VOTRE MOT DE PASSE</label>
|
||||||
</div>
|
</div>
|
||||||
<button class="w-100 btn btn-outline-success" type="submit" [disabled]="resetForm.invalid">Enregistrer</button>
|
<button class="w-100 btn btn-outline-success" type="submit" [disabled]="resetForm.invalid">Enregistrer</button>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { Membre } from 'src/app/models/membre';
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
import { AuthService } from 'src/app/services/auth.service';
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,20 +11,80 @@ import { AuthService } from 'src/app/services/auth.service';
|
||||||
styleUrls: ['./page-reset-password.component.scss']
|
styleUrls: ['./page-reset-password.component.scss']
|
||||||
})
|
})
|
||||||
export class PageResetPasswordComponent implements OnInit {
|
export class PageResetPasswordComponent implements OnInit {
|
||||||
|
public resetForm: FormGroup;
|
||||||
|
uuid:string;
|
||||||
|
constructor(private authService: AuthService, private router: Router,private fb: FormBuilder, private activatedRoute: ActivatedRoute) {
|
||||||
|
this.resetForm = new FormGroup({});
|
||||||
|
this.uuid = this.activatedRoute.snapshot.params['uuid'];
|
||||||
|
}
|
||||||
|
|
||||||
constructor(private authService: AuthService, private router: Router,) { }
|
ngOnInit(): void {
|
||||||
|
this.resetForm = this.fb.group(
|
||||||
|
{
|
||||||
|
passwordFc: new FormControl('', [
|
||||||
|
Validators.minLength(8),
|
||||||
|
Validators.required,
|
||||||
|
]),
|
||||||
|
passwordConfirmFc: new FormControl('', [
|
||||||
|
Validators.minLength(8),
|
||||||
|
Validators.required,
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: this.ConfirmedValidator('passwordFc', 'passwordConfirmFc'),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void { }
|
// 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(submittedForm: any): void {
|
// });
|
||||||
console.log(submittedForm.form.value);
|
// }
|
||||||
const password = submittedForm.form.value['password'];
|
|
||||||
const email = submittedForm.form.value['email'];
|
|
||||||
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);
|
||||||
|
console.log('form : ', this.resetForm);
|
||||||
|
const passwordValue = this.resetForm.value['passwordFc'];
|
||||||
|
const passwordConfirmValue = this.resetForm.value['passwordConfirmFc'];
|
||||||
|
|
||||||
|
const membre: Membre = {
|
||||||
|
nom: "",
|
||||||
|
prenom: "",
|
||||||
|
dateNaissance: new Date(),
|
||||||
|
email: "",
|
||||||
|
password: passwordValue,
|
||||||
|
roleList: ["ROLE_PARENT"],
|
||||||
|
couleur: "",
|
||||||
|
passwordConfirm: ""
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.authService.resetPassword(membre,this.uuid).subscribe((resp) => {
|
||||||
|
this.router.navigate(['accueil']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,27 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<app-side-bar></app-side-bar>
|
<div class="row">
|
||||||
<div class="d-flex align-items-stretch">
|
<div class="col-md-auto">
|
||||||
<div class="row">
|
<app-side-bar></app-side-bar>
|
||||||
<div class="col" *ngFor="let todos of result">
|
</div>
|
||||||
<app-to-do-list [todo]="todos"> </app-to-do-list>
|
<div class="col menu text-center">
|
||||||
|
<h2>To-Do-List</h2>
|
||||||
|
<div class="d-flex align-items-stretch"></div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="btn btn-outline-success"
|
||||||
|
placeholder=" Ajouter une To-Do-List"
|
||||||
|
[(ngModel)]="todoListTitle"
|
||||||
|
(keyup.enter)="addTodoByTeamId()"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-stretch">
|
||||||
|
<div class="custom-main container p-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col" *ngFor="let todos of listTodos">
|
||||||
|
<app-to-do-list [todo]="todos"> </app-to-do-list>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
.btn {
|
||||||
|
margin-top: 1%;
|
||||||
|
margin-bottom: 1%;
|
||||||
|
color: black;
|
||||||
|
box-shadow: 5px 5px 5px gray;
|
||||||
|
}
|
|
@ -1,26 +1,50 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ToDoList } from 'src/app/models/to-do-list';
|
||||||
import { TodoService } from 'src/app/services/todo.service';
|
import { TodoService } from 'src/app/services/todo.service';
|
||||||
|
import { Team } from 'src/app/models/team';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-to-do-list',
|
selector: 'app-page-to-do-list',
|
||||||
templateUrl: './page-to-do-list.component.html',
|
templateUrl: './page-to-do-list.component.html',
|
||||||
styleUrls: ['./page-to-do-list.component.scss']
|
styleUrls: ['./page-to-do-list.component.scss'],
|
||||||
})
|
})
|
||||||
export class PageToDoListComponent implements OnInit {
|
export class PageToDoListComponent implements OnInit {
|
||||||
public result : any;
|
public result: any;
|
||||||
|
public listTodos: any[];
|
||||||
constructor(private TodoService : TodoService) { }
|
public todoListTitle: string;
|
||||||
|
public idTodo: number;
|
||||||
ngOnInit(): void {
|
|
||||||
this.TodoService.getToDoListByTeamId().subscribe((data :any)=>{
|
|
||||||
|
|
||||||
this.result = data;
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private TodoService: TodoService) {
|
||||||
|
this.listTodos = [];
|
||||||
|
this.todoListTitle = '';
|
||||||
|
this.idTodo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.TodoService.getToDoListByTeamId()?.subscribe((listTodos: any) => {
|
||||||
|
console.log(listTodos);
|
||||||
|
this.listTodos = listTodos;
|
||||||
|
this.todoListTitle = '';
|
||||||
|
this.idTodo = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Ajouter une todo List
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-auto">
|
<div class="col-md-auto">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
</div>
|
</div>
|
||||||
<div class=" col compte text-center">
|
<div class="col compte text-center">
|
||||||
<h1>Modifier votre compte</h1>
|
<h1>Modifier votre compte</h1>
|
||||||
<main class="contenu-compte">
|
<main class="contenu-compte"></main>
|
||||||
|
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-auto">
|
<div class="col-md-auto">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
</div>
|
</div>
|
||||||
<div class=" col compte text-center">
|
<div class="col compte text-center">
|
||||||
<h1>Modifier ce membre</h1>
|
<h1>Modifier ce membre</h1>
|
||||||
<main class="contenu-compte">
|
<main class="contenu-compte"></main>
|
||||||
|
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
</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;
|
private tokenKey: string;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
// On se sert des variables d'environnement de notre application
|
|
||||||
this.apiUrl = environment.apiUrl;
|
this.apiUrl = environment.apiUrl;
|
||||||
this.tokenKey = environment.tokenKey;
|
this.tokenKey = environment.tokenKey;
|
||||||
}
|
}
|
||||||
|
@ -34,32 +34,23 @@ export class AuthService {
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Mon body : ', body);
|
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(
|
return this.http.post(`${this.apiUrl}/membres/sign-in`, body).pipe(
|
||||||
map((x: any) => {
|
map((x: any) => {
|
||||||
console.log('Service : ', x.token);
|
console.log('Service : ', x.token);
|
||||||
// Modification à faire ici
|
|
||||||
localStorage.setItem(this.tokenKey, x.token);
|
localStorage.setItem(this.tokenKey, x.token);
|
||||||
return x; // permet de renvoyer la réponse à l'initiateur (page Signin) après le traitement du map
|
return x; // permet de renvoyer la réponse à l'initiateur (page Signin) après le traitement du map
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forgotPassword(email: string): Observable<any> {
|
forgotPassword(membre: Membre): Observable<any> {
|
||||||
const body = {
|
return this.http.post(`${this.apiUrl}/membres/forgot-password`, membre, {responseType: "text"});
|
||||||
email: email,
|
|
||||||
};
|
|
||||||
return this.http.get(`${this.apiUrl}/membres/forgot-password`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetPassword(email: string, password: string): Observable<any> {
|
resetPassword(membre: Membre, uuid:string): Observable<any> {
|
||||||
const body = password;
|
console.log('--'+uuid+' / '+membre);
|
||||||
console.log(password);
|
return this.http.put(`${this.apiUrl}/membres/reset-password/${uuid}`, membre);
|
||||||
return this.http.put(`${this.apiUrl}/membres/reset-password/${email}`, body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
creationTeam(team: Team): Observable<any> {
|
creationTeam(team: Team): Observable<any> {
|
||||||
|
|
16
src/app/services/mail.service.spec.ts
Normal file
16
src/app/services/mail.service.spec.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MailService } from './mail.service';
|
||||||
|
|
||||||
|
describe('MailService', () => {
|
||||||
|
let service: MailService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(MailService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
29
src/app/services/mail.service.ts
Normal file
29
src/app/services/mail.service.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
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 { Mail } from '../models/mail';
|
||||||
|
import { TokenService } from './token.service';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class MailService {
|
||||||
|
apiUrl: string;
|
||||||
|
tokenKey: string;
|
||||||
|
|
||||||
|
constructor(private http: HttpClient, private tokenService: TokenService, private router: Router) {
|
||||||
|
this.apiUrl = environment.apiUrl;
|
||||||
|
this.tokenKey = environment.tokenKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
envoiMailText(mail: Mail): Observable<any> | void{
|
||||||
|
return this.http.post(`${this.apiUrl}/sendmail/text`, mail, {
|
||||||
|
responseType: "text"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { Membre } from '../models/membre';
|
import { Membre } from '../models/membre';
|
||||||
|
import { TokenService } from './token.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -11,7 +13,7 @@ export class MembreService {
|
||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
tokenKey: string;
|
tokenKey: string;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient, private tokenService: TokenService, private router: Router) {
|
||||||
this.apiUrl = environment.apiUrl;
|
this.apiUrl = environment.apiUrl;
|
||||||
this.tokenKey = environment.tokenKey;
|
this.tokenKey = environment.tokenKey;
|
||||||
}
|
}
|
||||||
|
@ -20,14 +22,27 @@ export class MembreService {
|
||||||
return this.http.get(`${this.apiUrl}/membres/all`);
|
return this.http.get(`${this.apiUrl}/membres/all`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMembreId(id: any): Observable<any> {
|
getMembresByTeamId(): Observable<any> | void{
|
||||||
return this.http.get(`${this.apiUrl}/membres/1` + id);
|
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> {
|
getMembreId(id: any): Observable<any> {
|
||||||
console.log(membre);
|
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> {
|
deleteMembre(membre: Membre): Observable<any> {
|
||||||
|
|
|
@ -45,7 +45,7 @@ apiUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMenu(id:number): Observable<any> {
|
deleteMenu(id:number): Observable<any> {
|
||||||
return this.http.delete(`${this.apiUrl}/menus/delete/${id}`);
|
return this.http.delete(`${this.apiUrl}/menus/delete/${id}`, {responseType:"text"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,4 +57,5 @@ apiUrl: string;
|
||||||
this.router.navigate(['accueil']);
|
this.router.navigate(['accueil']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { Team } from '../models/team';
|
import { Team } from '../models/team';
|
||||||
|
import { TokenService } from './token.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -12,7 +14,7 @@ export class TeamService {
|
||||||
tokenKey: string;
|
tokenKey: string;
|
||||||
|
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient, private tokenService: TokenService, private router: Router) {
|
||||||
this.apiUrl = environment.apiUrl;
|
this.apiUrl = environment.apiUrl;
|
||||||
this.tokenKey = environment.tokenKey;
|
this.tokenKey = environment.tokenKey;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +22,13 @@ export class TeamService {
|
||||||
return this.http.get(`${this.apiUrl}/teams/all`);
|
return this.http.get(`${this.apiUrl}/teams/all`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTeamById(id: any): Observable<any> {
|
getTeamById(): Observable<any> | void {
|
||||||
return this.http.get(`${this.apiUrl}/teams/1` + id);
|
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> {
|
addTeam(team: Team): Observable<any> {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import { Observable } from 'rxjs';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { Tache } from '../models/tache';
|
import { Tache } from '../models/tache';
|
||||||
import { ToDoList } from '../models/to-do-list';
|
import { ToDoList } from '../models/to-do-list';
|
||||||
|
import { TodoList } from '../todo-list';
|
||||||
|
import { TokenService } from './token.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
|
@ -12,12 +14,13 @@ export class TodoService {
|
||||||
private toDoList: any;
|
private toDoList: any;
|
||||||
private apiUrl: string;
|
private apiUrl: string;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient, private tokenService: TokenService) {
|
||||||
this.apiUrl = environment.apiUrl;
|
this.apiUrl = environment.apiUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
getToDoListByTeamId(): Observable<any> {
|
getToDoListByTeamId(): Observable<any> | void {
|
||||||
return this.http.get(`${this.apiUrl}/todolist/team/1`);
|
const teamId = this.tokenService.getCurrentTeamId();
|
||||||
|
return this.http.get(`${this.apiUrl}/todolist/team/${teamId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTacheById(idTache: any): Observable<any> {
|
deleteTacheById(idTache: any): Observable<any> {
|
||||||
|
@ -27,12 +30,27 @@ export class TodoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
addTache(newtache: Tache, idTodoList: number): Observable<any> {
|
addTache(newtache: Tache, idTodoList: number): Observable<any> {
|
||||||
// console.log(newtache);
|
// console.log(newtache);
|
||||||
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
|
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTache(tache: Tache): Observable<any> {
|
updateTache(tache: Tache): Observable<any> {
|
||||||
console.log(tache);
|
console.log(tache);
|
||||||
return this.http.put(`${this.apiUrl}/taches/update/1`, tache);
|
return this.http.put(`${this.apiUrl}/taches/update/1`, tache);
|
||||||
}
|
}
|
||||||
|
addTodoByTeamId(newtodoList: TodoList): Observable<any> {
|
||||||
|
const teamId = this.tokenService.getCurrentTeamId();
|
||||||
|
console.log(newtodoList + 'newtodoList');
|
||||||
|
return this.http.post(`${this.apiUrl}/todolist/add/${teamId}`, newtodoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteTodoById(idTodo: any): Observable<any> {
|
||||||
|
return this.http.delete(`${this.apiUrl}/todolist/delete/${idTodo}`, {
|
||||||
|
responseType: 'text',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
updateTodo(todoList: TodoList): Observable<any> {
|
||||||
|
console.log(todoList);
|
||||||
|
return this.http.put(`${this.apiUrl}/todolist/update/666`, todoList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,17 @@ tokenKey = environment.tokenKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public eraseToken(): string | null {
|
||||||
|
const token = localStorage.getItem(this.tokenKey);
|
||||||
|
if(token) {
|
||||||
|
localStorage.removeItem(this.tokenKey);
|
||||||
|
return token;
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public getCurrentMembreId(): number | null {
|
public getCurrentMembreId(): number | null {
|
||||||
const token = this.getToken();
|
const token = this.getToken();
|
||||||
if(token) {
|
if(token) {
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
apiUrl: 'http://localhost:8088',
|
apiUrl: 'http://localhost:8080',
|
||||||
tokenKey: 'TOKEN-ORGANIZEE',
|
tokenKey: 'TOKEN-ORGANIZEE',
|
||||||
|
debug: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue