calendrier component pour le dashboard
This commit is contained in:
		
							parent
							
								
									4b5b3020ac
								
							
						
					
					
						commit
						de0413930b
					
				
					 3 changed files with 44 additions and 3 deletions
				
			
		|  | @ -83,7 +83,6 @@ registerLocaleData(localeFr) | ||||||
|     CardAvatarComponent, |     CardAvatarComponent, | ||||||
|     DeconnexionComponent, |     DeconnexionComponent, | ||||||
|     HumeurComponent |     HumeurComponent | ||||||
| 
 |  | ||||||
|   ], |   ], | ||||||
|   imports: [ |   imports: [ | ||||||
|     BrowserModule, |     BrowserModule, | ||||||
|  |  | ||||||
|  | @ -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); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Hedi
						Hedi