Skip to content

Commit

Permalink
# Implemented Calendar for task events.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushman1024 committed May 15, 2019
1 parent 34f24c9 commit e9c902c
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.ios.backend.resources;

import java.util.List;

public class CalendarListResource {

private List<CalendarResource> events;

public List<CalendarResource> getEvents() {
return events;
}

public void setEvents(List<CalendarResource> events) {
this.events = events;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.ios.backend.resources;

import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;

public class CalendarResource {

private String title;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime start;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime end;

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public LocalDateTime getStart() {
return start;
}

public void setStart(LocalDateTime start) {
this.start = start;
}

public LocalDateTime getEnd() {
return end;
}

public void setEnd(LocalDateTime end) {
this.end = end;
}

}
6 changes: 6 additions & 0 deletions frontend/src/app/framework/models/TaskCalendar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class TaskCalendar {
title: string;
start: string;
end: string;
constructor() {}
}
6 changes: 6 additions & 0 deletions frontend/src/app/framework/models/TaskCalendarList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { TaskCalendar } from './TaskCalendar';

export class TaskCalendarList {
events: TaskCalendar[];
constructor() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host >>> .fc-view-container {
height: 70%;
width: auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div id="f-cal">
<p-fullCalendar [style]="{'height':'75%'}" [events]="events" [options]="options">
</p-fullCalendar>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Component, OnInit } from '@angular/core';
import { GlobalService } from 'src/app/framework/services/global.service';
import { Router, ActivatedRoute } from '@angular/router';
import { TaskService } from 'src/app/framework/services/task.service';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';

@Component({
selector: 'app-task-calendar',
templateUrl: './task-calendar.component.html',
styleUrls: ['./task-calendar.component.css']
})
export class TaskCalendarComponent implements OnInit {

events: any[];
options: any;

constructor(private service: TaskService, private global: GlobalService, private router: Router, private route: ActivatedRoute) { }

ngOnInit() {
this.service.getAllTaskCalendar().subscribe(data => this.events = data.events);

this.options = {
plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
defaultDate: Date.now(),
header: {
left: 'prev,next,month,agendaWeek,agendaDay',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
dateClick: (e) => { console.log(e); }
};
}

}

0 comments on commit e9c902c

Please sign in to comment.