Merge pull request #65 from AlineRinquin/calendrier-dashboard

calendrier component pour le dashboard
This commit is contained in:
AlineRinquin 2022-03-01 18:50:34 +01:00 committed by GitHub
commit 0784bacd2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 3 deletions

View File

@ -83,7 +83,6 @@ registerLocaleData(localeFr)
CardAvatarComponent,
DeconnexionComponent,
HumeurComponent
],
imports: [
BrowserModule,

View File

@ -1 +1 @@
<p>calendrier works!</p>
<daypilot-calendar [config]="config" [events]="events"></daypilot-calendar>

View File

@ -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);
});
}
}