diff --git a/src/app/pages/page-agenda/page-agenda.component.html b/src/app/pages/page-agenda/page-agenda.component.html index 295dd85..f667068 100644 --- a/src/app/pages/page-agenda/page-agenda.component.html +++ b/src/app/pages/page-agenda/page-agenda.component.html @@ -57,7 +57,11 @@ (click)="navigateNext($event)" >Next - team : {{ teamId }} - user: {{ userId }} - role: {{ role }} + + + team : {{ teamId }} - user: {{ userId }} - role: {{ role }} + + (token); - this.userId = decodedToken.userId; - this.teamId = decodedToken.teamId; - this.role = decodedToken.auth[0].authority; - }else{ - // - } + this.userId = this.tokenService.getCurrentMembreId(); + this.teamId = this.tokenService.getCurrentTeamId(); } // petite triche pour eviter la repetition du nom dans le RDV @@ -191,22 +185,28 @@ export class PageAgendaComponent implements AfterViewInit { text: this.rdvSplit(args.e.text()), membre: {id:args.e.data.tags.membre}, team: {id:this.teamId} - } - this.evenementService.updateEvenements(event).subscribe( - { - next: result => { - this.viewChange(); - this.alert={"type":"success", "content":"L'évènement à bien été modifié"}; - this.isShow = true; - }, - error: err => { - this.viewChange(); - this.alert={"type":"danger", "content":"Problème lors de la modification de l'évenment"}; - this.isShow = true; - }, - complete: () => console.log('DONE!') - } - ); + } + 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(); + this.alert={"type":"success", "content":"L'évènement à bien été déplacé"}; + this.isShow = true; + }, + error: err => { + this.viewChange(); + this.alert={"type":"danger", "content":"Problème lors de la modification de l'évenement"}; + this.isShow = true; + }, + complete: () => console.log('DONE!') + } + ); + }else{ + this.viewChange(); + this.alert={"type":"danger", "content":"Vous ne pouvez pas déplacé cet évènement !"}; + this.isShow = true; + } } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 0a4331f..63d46e1 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,6 +6,7 @@ export const environment = { production: false, apiUrl: 'http://localhost:8080', tokenKey: 'TOKEN-ORGANIZEE', + debug: true, }; /*