diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5850a5c..62aab10 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -83,7 +83,6 @@ registerLocaleData(localeFr) CardAvatarComponent, DeconnexionComponent, HumeurComponent - ], imports: [ BrowserModule, diff --git a/src/app/components/calendrier/calendrier.component.html b/src/app/components/calendrier/calendrier.component.html index b2a5529..911973f 100644 --- a/src/app/components/calendrier/calendrier.component.html +++ b/src/app/components/calendrier/calendrier.component.html @@ -1 +1 @@ -

calendrier works!

+ \ No newline at end of file diff --git a/src/app/components/calendrier/calendrier.component.ts b/src/app/components/calendrier/calendrier.component.ts index 29cc2c8..4edb2ef 100644 --- a/src/app/components/calendrier/calendrier.component.ts +++ b/src/app/components/calendrier/calendrier.component.ts @@ -1,4 +1,7 @@ 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({ selector: 'app-calendrier', @@ -7,9 +10,48 @@ import { Component, OnInit } from '@angular/core'; }) 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 { + 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); + }); + } }