1 /*****************************************************************************
2 * Copyright (c) 2016 Max Breitenfeldt and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Apache License, Version 2.0
6 * which accompanies this distribution, and is available at
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *****************************************************************************/
11 function parseCalendarEvents(bookings) {
13 for (var i = 0; i < bookings.length; i++) {
14 // convert ISO 8601 timestring to moment, needed for timezone handling
15 start = moment(bookings[i]['start']);
16 end = moment(bookings[i]['end']);
18 id: bookings[i]['id'],
19 title: bookings[i]['purpose'],
28 function loadEvents(url) {
32 success: function (data) {
33 $('#calendar').fullCalendar('addEventSource', parseCalendarEvents(data['bookings']));
35 failure: function (data) {
36 alert('Error loading booking data');
41 $(document).ready(function () {
42 $('#calendar').fullCalendar(calendarOptions);
43 loadEvents(bookings_url);
44 $('#starttimepicker').datetimepicker(timepickerOptions);
45 $('#endtimepicker').datetimepicker(timepickerOptions);