-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (44 loc) · 1.19 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
window.$ = window.jQuery = require('jquery');
require('bootstrap');
require('moment');
require('fullcalendar');
require('fullcalendar-scheduler');
const events = require('./lib/events');
const floors = require('./lib/floors');
const onSelect = require('./lib/on-select');
const onClick = require('./lib/on-click');
$(document).ready(function() {
const calendar = $('#calendar').fullCalendar(
{
header: {
left: 'prev,next today',
center: 'title'
},
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
defaultView: 'timelineMonth',
nowIndicator: true,
selectable: true,
selectHelper: true,
editable: true,
events: [],
select: onSelect,
eventClick: onClick,
eventRender: function(event, element) {
element.find('.fc-title').append(`<br/>`);
},
resourceColumns: [
{
labelText: 'Hostel #3',
field: 'title'
}
],
resourceGroupField: 'groupId',
resources: floors
});
displayStoredEvents(calendar);
});
function displayStoredEvents(calendar) {
events.getAll().forEach(event => {
calendar.fullCalendar('renderEvent', event, true);
});
}