export class CalendarComponent {
public currentView: View = 'Month';
public views: View[] = ['Day', 'Week', 'Month'];
public scheduleObj: ScheduleComponent;
public selectedDate: Date = new Date();
private dataManger: DataManager = new DataManager({
url:
environment.apiUrl +
'calendar/' +
this.authService.getCurrentlyLoggedInUserId(),
adaptor: new ODataV4Adaptor(),
crossDomain: true
});
public eventSettings: EventSettingsModel = { dataSource: this.dataManger };
public temp: string =
'<div class="tooltip-wrap">' +
'<div class="image ${EventType}"></div>' +
'<div class="content-area"><div class="name">${Subject}</></div>' +
'${if(Location !== null && Location !== undefined)}<div class="location">Location : ${Location}</div>${/if}' +
'<div class="time">From : ${StartTime.toLocaleString()} </div>' +
'<div class="time">To : ${EndTime.toLocaleString()} </div></div></div>';
constructor(private router: Router, private authService: AuthService) {}
onChange(args: ChangeEventArgs): void {
if (args.checked) {
this.scheduleObj.eventSettings.enableTooltip = true;
} else {
this.scheduleObj.eventSettings.enableTooltip = false;
}
this.scheduleObj.dataBind();
}
onTemplateChange(args: ChangeEventArgs): void {
if (args.checked) {
this.scheduleObj.eventSettings.tooltipTemplate = this.temp;
} else {
this.scheduleObj.eventSettings.tooltipTemplate = null;
}
this.scheduleObj.dataBind();
}
oneventRendered(args: EventRenderedArgs): void {
const categoryColor: string = args.data.CategoryColor as string;
if (!args.element || !categoryColor) {
return;
}
args.element.style.backgroundColor = categoryColor;
}
onPopupOpen(args: PopupOpenEventArgs): void {
if (args.type === 'Editor' || args.type === 'QuickInfo') {
args.cancel = true;
this.router.navigate(['/']);
}
}
}