Added calendar

This commit is contained in:
2018-12-04 14:53:17 +01:00
parent adab80734e
commit 5deb2662ce
10 changed files with 1577 additions and 3 deletions
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+49
View File
@@ -0,0 +1,49 @@
var loadingDiv = document.getElementById('loading');
var errorDiv = document.getElementById('error');
var resultDiv = document.getElementById('result');
const timeout = 10000;
var emptyCoursesShown = false;
var calendar;
function getTable() {
// Send XHR to totalTable
loadingDiv.style.display = "";
errorDiv.style.display = "none";
let xhr = new XMLHttpRequest();
xhr.timeout = timeout;
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
let events = JSON.parse(xhr.responseText);
setData(events);
} else {
setError();
}
}
};
xhr.open('GET', CALENDAR_URL, true);
xhr.send();
}
function setData(events) {
console.log(events);
loadingDiv.style.display = "none";
errorDiv.style.display = "none";
calendar = new FullCalendar.Calendar(resultDiv, {
events: events,
defaultView: 'agendaWeek',
minTime: "07:00:00",
maxTime: "19:00:00",
timeZone: 'UTC',
});
calendar.render();
}
function setError() {
loadingDiv.style.display = "none";
errorDiv.style.display = "";
}
document.getElementById('tryAgain').addEventListener('click', getTable);
getTable();