Deleting useless files
This commit is contained in:
parent
99e1ff80bd
commit
22787cdfdd
24 changed files with 4 additions and 27722 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -17,6 +17,10 @@ __pycache__/
|
|||
# C extensions
|
||||
*.so
|
||||
|
||||
frontend/static/frontend/login.js
|
||||
frontend/static/frontend/content.js
|
||||
frontend/static/frontend/AccountManager.js
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
9067
frontend/static/frontend/css/materialize.css
vendored
9067
frontend/static/frontend/css/materialize.css
vendored
File diff suppressed because it is too large
Load diff
13
frontend/static/frontend/css/materialize.min.css
vendored
13
frontend/static/frontend/css/materialize.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -1,40 +0,0 @@
|
|||
var cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'));
|
||||
students = cookies_data.data.students.data;
|
||||
|
||||
const displayData = () => {
|
||||
var primary = '';
|
||||
|
||||
students.forEach((student) => {
|
||||
if (student.UczenNazwisko + ' ' + student.UczenImie2 + ' ' + student.UczenImie + ' ' + student.UczenSymbol != primary) {
|
||||
primary = student.UczenNazwisko + ' ' + student.UczenImie2 + ' ' + student.UczenImie + ' ' + student.UczenSymbol;
|
||||
document.querySelector("#content").innerHTML += `<p>
|
||||
<label>
|
||||
<input class="with-gap" name="group1" value='`+ student.UczenPelnaNazwa + `' type="radio" checked />
|
||||
<span>`+ student.UczenPelnaNazwa + `</span>
|
||||
</label>
|
||||
</p>`;
|
||||
}
|
||||
})
|
||||
document.querySelector("#content").innerHTML += `<button id="button" class="waves-light waves-effect btn red darken-1">LOGIN</button>`;
|
||||
const button_ = document.querySelector("#button");
|
||||
button_.addEventListener('click', logIn);
|
||||
}
|
||||
|
||||
const logIn = () => {
|
||||
var ele = document.getElementsByName('group1');
|
||||
|
||||
for (i = 0; i < ele.length; i++) {
|
||||
if (ele[i].checked) {
|
||||
studentName = ele[i].value;
|
||||
students.forEach((student) => {
|
||||
if (student.UczenPelnaNazwa == studentName) {
|
||||
cookies_data.data.students.data = [student];
|
||||
sessionStorage.setItem('cookies_data', JSON.stringify(cookies_data));
|
||||
window.location.href = '/content/';
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', displayData)
|
|
@ -1,34 +0,0 @@
|
|||
const attendance_ = document.querySelector('#attendance_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
weekAttendance = 0
|
||||
|
||||
const getAttendance = (event) => {
|
||||
if (event.target.id == 'previous-attendance' || event.target.id == 'previous-attendance_i') {
|
||||
weekAttendance -= 1
|
||||
}
|
||||
else if (event.target.id == 'next-attendance' || event.target.id == 'next-attendance_i') {
|
||||
weekAttendance += 1
|
||||
}
|
||||
document.querySelector('#content').innerHTML = 'Here is attendance (in my imagination)';
|
||||
document.querySelector('#content').innerHTML += '<button id="previous-attendance" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-attendance_i">keyboard_arrow_left</i></button>';
|
||||
document.querySelector('#content').innerHTML += '<button id="next-attendance" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-attendance_i">keyboard_arrow_right</i></button>';
|
||||
const left_attendance_ = document.querySelector('#previous-attendance');
|
||||
const right_attendance_ = document.querySelector('#next-attendance');
|
||||
left_attendance_.addEventListener('click', getAttendance);
|
||||
right_attendance_.addEventListener('click', getAttendance);
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/attendance', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: JSON.stringify({"cookies": cookies_data, "week": weekAttendance})
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
|
||||
attendance_.addEventListener('click', getAttendance);
|
|
@ -1,22 +0,0 @@
|
|||
const start_ = document.querySelector('#dashboard_');
|
||||
|
||||
const getDashboard = () => {
|
||||
document.querySelector('#content').innerHTML = 'Dashboard';
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/dashboard', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
window.addEventListener('load', getDashboard);
|
||||
start_.addEventListener('click', getDashboard);
|
|
@ -1,35 +0,0 @@
|
|||
const exams_ = document.querySelector('#exams_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
weekExams = 0
|
||||
|
||||
const getExams = (event) => {
|
||||
if (event.target.id == 'previous-exams' || event.target.id == 'previous-exams_i') {
|
||||
weekExams -= 1
|
||||
}
|
||||
else if (event.target.id == 'next-exams' || event.target.id == 'next-exams_i') {
|
||||
weekExams += 1
|
||||
}
|
||||
document.querySelector('#content').innerHTML = 'Here is exams (in my imagination)';
|
||||
document.querySelector('#content').innerHTML += '<button id="previous-exams" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-exams_i">keyboard_arrow_left</i></button>';
|
||||
document.querySelector('#content').innerHTML += '<button id="next-exams" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-exams_i">keyboard_arrow_right</i></button>';
|
||||
const left_exams_ = document.querySelector('#previous-exams');
|
||||
const right_exams_ = document.querySelector('#next-exams');
|
||||
left_exams_.addEventListener('click', getExams);
|
||||
right_exams_.addEventListener('click', getExams);
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/exams', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: JSON.stringify({"cookies": cookies_data, "week": weekExams})
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
exams_.addEventListener('click', getExams);
|
|
@ -1,101 +0,0 @@
|
|||
var hash = require('object-hash');
|
||||
|
||||
const grades_ = document.querySelector('#grades_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const getGrades = () => {
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/grades', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
const allGrades = data.data.Oceny
|
||||
const content = document.getElementById("content")
|
||||
content.innerHTML = ""
|
||||
const container = document.getElementsByClassName("gradeModals")[0]
|
||||
|
||||
allGrades.forEach((grade) => {
|
||||
const czastkowe = grade.OcenyCzastkowe
|
||||
|
||||
czastkowe.forEach((czastkowa) => {
|
||||
const gradeDiv = document.createElement("div")
|
||||
gradeDiv.classList = "grade modal-trigger"
|
||||
gradeDiv.dataset.target = `${hash.MD5(czastkowa)}`
|
||||
gradeDiv.innerHTML = `${czastkowa.Wpis}`
|
||||
|
||||
switch (czastkowa.Wpis) {
|
||||
case "6" || "6-":
|
||||
czastkowa.Kolor = "#3dbbf5"
|
||||
gradeDiv.style.background = "#3dbbf5"
|
||||
break;
|
||||
case "5" || "5-" || "5+":
|
||||
czastkowa.Kolor = "#4caf50"
|
||||
gradeDiv.style.background = "#4caf50"
|
||||
break;
|
||||
case "4" || "4-" || "4+":
|
||||
czastkowa.Kolor = "#a0c431"
|
||||
gradeDiv.style.background = "#a0c431"
|
||||
break;
|
||||
case "3" || "3-" || "3+":
|
||||
czastkowa.Kolor = "#ffb940"
|
||||
gradeDiv.style.background = "#ffb940"
|
||||
break;
|
||||
case "2" || "2-" || "2+":
|
||||
czastkowa.Kolor = "#ff774d"
|
||||
gradeDiv.style.background = "#ff774d"
|
||||
break;
|
||||
case "1" || "1+":
|
||||
czastkowa.Kolor = "#d43f3f"
|
||||
gradeDiv.style.background = "#d43f3f"
|
||||
break;
|
||||
default:
|
||||
czastkowa.Kolor = "#607d8b"
|
||||
gradeDiv.style.background = "#607d8b"
|
||||
}
|
||||
const gradeModal = document.createElement("div")
|
||||
gradeModal.id = `${hash.MD5(czastkowa)}`
|
||||
gradeModal.classList = "modal"
|
||||
gradeModal.style.marginTop = "15rem"
|
||||
gradeModal.innerHTML = `<div class="modal-content">
|
||||
<h4>${grade.Przedmiot}</h4>
|
||||
<h5>${czastkowa.KodKolumny} - ${czastkowa.NazwaKolumny}</h5>
|
||||
|
||||
<div style="float: right; background: ${czastkowa.Kolor}; width: 60px; height: 70px; text-align: center;"><h1>${czastkowa.Wpis}</h1></div>
|
||||
|
||||
<span class="teacher" style="font-size: 16px;">Nauczyciel</span>
|
||||
<p>${czastkowa.Nauczyciel}</p>
|
||||
|
||||
<span class="weight" style="font-size: 16px;">Waga</span>
|
||||
<p>${czastkowa.Waga}</p>
|
||||
|
||||
<span class="date" style="font-size: 16px;">Data</span>
|
||||
<p>${czastkowa.DataOceny}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#!" class="modal-close${hash.MD5(czastkowa)} waves-effect waves-white btn materialize-red">Zamknij</a>
|
||||
</div>`
|
||||
gradeDiv.addEventListener('click', () => {
|
||||
console.log(czastkowa)
|
||||
gradeModal.style.display = 'block'
|
||||
})
|
||||
|
||||
container.append(gradeModal)
|
||||
|
||||
document.getElementsByClassName(`modal-close${hash.MD5(czastkowa)}`)[0].addEventListener('click', () => {
|
||||
gradeModal.style.display = 'none'
|
||||
})
|
||||
|
||||
content.append(gradeDiv)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
grades_.addEventListener('click', getGrades);
|
|
@ -1,35 +0,0 @@
|
|||
const homeworks_ = document.querySelector('#homeworks_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
weekHomeworks = 0
|
||||
|
||||
const getHomeworks = (event) => {
|
||||
if (event.target.id == 'previous-homeworks' || event.target.id == 'previous-homeworks_i') {
|
||||
weekHomeworks -= 1
|
||||
}
|
||||
else if (event.target.id == 'next-homeworks' || event.target.id == 'next-homeworks_i') {
|
||||
weekHomeworks += 1
|
||||
}
|
||||
document.querySelector('#content').innerHTML = 'Here is homeworks (in my imagination)';
|
||||
document.querySelector('#content').innerHTML += '<button id="previous-homeworks" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-homeworks_i">keyboard_arrow_left</i></button>';
|
||||
document.querySelector('#content').innerHTML += '<button id="next-homeworks" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-homeworks_i">keyboard_arrow_right</i></button>';
|
||||
const left_homeworks_ = document.querySelector('#previous-homeworks');
|
||||
const right_homeworks_ = document.querySelector('#next-homeworks');
|
||||
left_homeworks_.addEventListener('click', getHomeworks);
|
||||
right_homeworks_.addEventListener('click', getHomeworks);
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/homeworks', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: JSON.stringify({"cookies": cookies_data, "week": weekHomeworks})
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
|
||||
homeworks_.addEventListener('click', getHomeworks);
|
|
@ -1,20 +0,0 @@
|
|||
const log_out_ = document.querySelector('#log_out_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const logOut = () => {
|
||||
fetch(url = '../api/log_out', {
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
}
|
||||
}).then(response => response.json()).then(data => {
|
||||
sessionStorage.clear();
|
||||
console.log(data)
|
||||
window.location.href = '../'
|
||||
})
|
||||
}
|
||||
|
||||
log_out_.addEventListener('click', logOut)
|
|
@ -1,68 +0,0 @@
|
|||
const button = document.querySelector('#button');
|
||||
|
||||
const login = () => {
|
||||
const loginName = document.querySelector('#id_loginName').value;
|
||||
const Password = document.querySelector('#id_Password').value;
|
||||
const symbol = document.querySelector('#id_Symbol').value;
|
||||
const diary = document.querySelector('#id_diary').value;
|
||||
button.removeEventListener('click', login)
|
||||
if(loginName != '' && Password != '' && symbol != ''){
|
||||
switch(diary){
|
||||
case 'Fakelog':
|
||||
var diaryUrl = 'http://cufs.fakelog.cf/';
|
||||
sessionStorage.setItem('diary_url', 'http://cufs.fakelog.cf/');
|
||||
break;
|
||||
|
||||
case 'Vulcan UONET+':
|
||||
var diaryUrl = 'https://cufs.vulcan.net.pl/';
|
||||
sessionStorage.setItem('diary_url', 'https://cufs.vulcan.net.pl/');
|
||||
break;
|
||||
}
|
||||
data = {
|
||||
'loginName': loginName,
|
||||
'Password': Password,
|
||||
'Symbol': symbol,
|
||||
'diaryUrl': diaryUrl
|
||||
}
|
||||
fetch(url = 'api/login', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie()
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
}).then(response => response.json()).then(data => {
|
||||
if(data['success']){
|
||||
myStorage = window.sessionStorage;
|
||||
sessionStorage.setItem('cookies_data', JSON.stringify(data));
|
||||
sessionStorage.setItem('csrfcookie', csrfcookie());
|
||||
sessionStorage.setItem('email', document.querySelector('#id_loginName').value);
|
||||
sessionStorage.setItem('symbol', document.querySelector('#id_Symbol').value);
|
||||
window.location.href = "/account-manager/";
|
||||
}
|
||||
else{
|
||||
document.querySelector('#error').innerHTML = 'Nieprawidłowy login, hasło lub symbol';
|
||||
}
|
||||
button.addEventListener('click', login);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var csrfcookie = function() {
|
||||
var cookieValue = null,
|
||||
name = 'csrftoken';
|
||||
if (document.cookie && document.cookie !== '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = cookies[i].trim();
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
};
|
||||
|
||||
button.addEventListener('click', login);
|
12374
frontend/static/frontend/js/materializecss/materialize.js
vendored
12374
frontend/static/frontend/js/materializecss/materialize.js
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,257 +0,0 @@
|
|||
const received_ = document.querySelector('#received_');
|
||||
const sent_ = document.querySelector('#sent_');
|
||||
const deleted_ = document.querySelector('#deleted_');
|
||||
const content = document.getElementById("content");
|
||||
const send_ = document.querySelector('#send_')
|
||||
var hash = require('object-hash');
|
||||
|
||||
const getReceivedMessages = () => {
|
||||
content.innerHTML = ""
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/messages/received', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
const wiadomosci = data.data
|
||||
|
||||
table = document.createElement("table")
|
||||
table.className = "striped"
|
||||
table.innerHTML = "<thead>\n" +
|
||||
" <tr>\n" +
|
||||
" <th>Temat</th>\n" +
|
||||
" <th>Nadawca</th>\n" +
|
||||
" <th>Data</th>\n" +
|
||||
" </tr>\n" +
|
||||
" </thead>" +
|
||||
" <tbody>" +
|
||||
" " +
|
||||
" </tbody>"
|
||||
|
||||
content.append(table)
|
||||
|
||||
wiadomosci.forEach((wiadomosc) => {
|
||||
const tbody = document.getElementsByTagName("tbody")[0]
|
||||
|
||||
wiadomoscRow = tbody.insertRow()
|
||||
|
||||
temat = wiadomoscRow.insertCell()
|
||||
temat.innerHTML = `<span id="${wiadomosc.Id}">${wiadomosc.Temat}</span>`
|
||||
wiadomoscRow.appendChild(temat)
|
||||
|
||||
nadawca = wiadomoscRow.insertCell()
|
||||
nadawca.innerHTML = `<span>${wiadomosc.Nadawca.Name}</span>`
|
||||
wiadomoscRow.appendChild(nadawca)
|
||||
|
||||
|
||||
dataWyslania = wiadomoscRow.insertCell()
|
||||
dataWyslania.innerHTML = `<span>${wiadomosc.Data}</span>`
|
||||
wiadomoscRow.appendChild(dataWyslania)
|
||||
|
||||
document.getElementById(wiadomosc.Id).addEventListener('click', getMessageContent);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const getSentMessages = () => {
|
||||
content.innerHTML = ""
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/messages/sent', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
const wiadomosci = data.data // haha spaghetti code goes brrr
|
||||
|
||||
table = document.createElement("table")
|
||||
table.className = "striped"
|
||||
table.innerHTML = "<thead>\n" +
|
||||
" <tr>\n" +
|
||||
" <th>Temat</th>\n" +
|
||||
" <th>Adresat</th>\n" +
|
||||
" <th>Data</th>\n" +
|
||||
" </tr>\n" +
|
||||
" </thead>" +
|
||||
" <tbody>" +
|
||||
" " +
|
||||
" </tbody>"
|
||||
|
||||
content.append(table)
|
||||
|
||||
wiadomosci.forEach((wiadomosc) => {
|
||||
const tbody = document.getElementsByTagName("tbody")[0]
|
||||
|
||||
wiadomoscRow = tbody.insertRow()
|
||||
|
||||
temat = wiadomoscRow.insertCell()
|
||||
temat.innerHTML = `<span id="${wiadomosc.Id}">${wiadomosc.Temat}</span>`
|
||||
wiadomoscRow.appendChild(temat)
|
||||
|
||||
nadawca = wiadomoscRow.insertCell()
|
||||
nadawca.innerHTML = `<span>${wiadomosc.Adresaci[0]}</span>`
|
||||
wiadomoscRow.appendChild(nadawca)
|
||||
|
||||
|
||||
dataWyslania = wiadomoscRow.insertCell()
|
||||
dataWyslania.innerHTML = `<span>${wiadomosc.Data}</span>`
|
||||
wiadomoscRow.appendChild(dataWyslania)
|
||||
|
||||
document.getElementById(wiadomosc.Id).addEventListener('click', getMessageContent);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const getDeletedMessages = () => {
|
||||
content.innerHTML = ""
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/messages/deleted', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
const wiadomosci = data.data
|
||||
|
||||
table = document.createElement("table")
|
||||
table.className = "striped"
|
||||
table.innerHTML = "<thead>\n" +
|
||||
" <tr>\n" +
|
||||
" <th>Temat</th>\n" +
|
||||
" <th>Nadawca</th>\n" +
|
||||
" <th>Data</th>\n" +
|
||||
" </tr>\n" +
|
||||
" </thead>" +
|
||||
" <tbody>" +
|
||||
" " +
|
||||
" </tbody>"
|
||||
|
||||
content.append(table)
|
||||
|
||||
wiadomosci.forEach((wiadomosc) => {
|
||||
const tbody = document.getElementsByTagName("tbody")[0]
|
||||
|
||||
wiadomoscRow = tbody.insertRow()
|
||||
|
||||
temat = wiadomoscRow.insertCell()
|
||||
temat.innerHTML = `<span id="${wiadomosc.Id}">${wiadomosc.Temat}</span>`
|
||||
wiadomoscRow.appendChild(temat)
|
||||
|
||||
nadawca = wiadomoscRow.insertCell()
|
||||
nadawca.innerHTML = `<span>${wiadomosc.Nadawca.Name}</span>`
|
||||
wiadomoscRow.appendChild(nadawca)
|
||||
|
||||
|
||||
dataWyslania = wiadomoscRow.insertCell()
|
||||
dataWyslania.innerHTML = `<span>${wiadomosc.Data}</span>`
|
||||
wiadomoscRow.appendChild(dataWyslania)
|
||||
|
||||
document.getElementById(wiadomosc.Id).addEventListener('click', getMessageContent);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const getAddressee = () => {
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/messages/recipients', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
document.querySelector('#content').innerHTML = `
|
||||
<form action="javascript:void(0);">
|
||||
<div class="input-field">
|
||||
<select id='recipients' style='display: inline !important;'>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input required="" placeholder="Temat" id="subject" class="input-field">
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input required="" placeholder="Treść" id="message-content" class="input-field">
|
||||
</div>
|
||||
<button id="button" class="waves-light waves-effect btn red darken-1">WYŚLIJ</button>
|
||||
</form>`
|
||||
data.addressee.data.forEach((recipient) => {
|
||||
const recipient_hash = `${hash.MD5(recipient)}`
|
||||
document.querySelector('#recipients').insertAdjacentHTML('beforeend', '<option value="'+recipient_hash+'">'+recipient.Name+'</option>');
|
||||
sessionStorage.setItem(recipient_hash, JSON.stringify(recipient));
|
||||
const button_ = document.querySelector('#button');
|
||||
button_.addEventListener('click', sendMessage);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const sendMessage = () => {
|
||||
const recipient_hash_ = document.querySelector('#recipients').value;
|
||||
const subject_ = document.querySelector('#subject').value;
|
||||
const content_ = document.querySelector('#message-content').value;
|
||||
const recipient_ = JSON.parse(sessionStorage.getItem(recipient_hash_));
|
||||
if(subject_ != '' && content_ != ''){
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
send_data = {
|
||||
'cookies_data': cookies_data,
|
||||
'data': recipient_,
|
||||
'subject': subject_,
|
||||
'content': content_
|
||||
}
|
||||
console.log(cookies_data)
|
||||
console.log(recipient_)
|
||||
fetch(url = '../api/messages/send', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: JSON.stringify(send_data)
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const getMessageContent = (event) => {
|
||||
send_data = {
|
||||
'cookies_data': cookies_data,
|
||||
'message_id': event.target.id
|
||||
}
|
||||
fetch(url = '../api/messages/content', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: JSON.stringify(send_data)
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
received_.addEventListener('click', getReceivedMessages);
|
||||
sent_.addEventListener('click', getSentMessages);
|
||||
deleted_.addEventListener('click', getDeletedMessages);
|
||||
send_.addEventListener('click', getAddressee);
|
|
@ -1,41 +0,0 @@
|
|||
const registered_ = document.querySelector('#mobile_access_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const getRegisteredDevices = () => {
|
||||
document.querySelector('#content').innerHTML = '<button id="register_device_">ZAJERESTRUJ URZĄDZENIE</button><div id="register_device_data"></div><br />Here is registered mobile devices (in my imagination)';
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/mobile/registered', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
const register_device_ = document.querySelector('#register_device_');
|
||||
register_device_.addEventListener('click', registerDevice);
|
||||
})
|
||||
}
|
||||
|
||||
const registerDevice = () => {
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/mobile/register', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
document.querySelector('#register_device_data').innerHTML = data.data.QrCodeImage+'<br /> TOKEN:'+data.data.TokenKey+'<br /> PIN:'+data.data.PIN+'<br /> SYMBOL:'+data.data.CustomerGroup;
|
||||
})
|
||||
}
|
||||
|
||||
registered_.addEventListener('click', getRegisteredDevices);
|
|
@ -1,41 +0,0 @@
|
|||
const notes_ = document.querySelector('#notes_');
|
||||
content = document.getElementById("content")
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const getNotes = () => {
|
||||
content.innerHTML = ""
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/notes', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
const uwagi = data.data.Uwagi
|
||||
const osiagniecia = data.data.Osiagniecia
|
||||
console.log(data);
|
||||
|
||||
const uwagiList = document.createElement("ul")
|
||||
uwagiList.id = "notesList"
|
||||
content.append(uwagiList)
|
||||
|
||||
uwagi.forEach((uwaga) => {
|
||||
uwagaElement = document.createElement("li")
|
||||
uwagaElement.innerHTML = `<div class="noteElement"><h6 style="display:block; margin-top: -5px;">${uwaga.Kategoria}</h6><span style="display:block; float: right; margin-top: -25px; font-size: 13px;">${uwaga.Nauczyciel}</span><span style="display:block; width: 50%; font-size: 12px;">${uwaga.TrescUwagi}</span><span style="float:right; font-size: 20px; margin-top: -20px; font-weight: 700;">${uwaga.Punkty}</span></div>`
|
||||
uwagiList.append(uwagaElement)
|
||||
})
|
||||
|
||||
osiagniecia.forEach((osiagniecie) => {
|
||||
osiagniecieElement = document.createElement("li")
|
||||
osiagniecieElement.innerHTML = `<div class="achievementElement"><span>${osiagniecie}</span></div>`
|
||||
uwagiList.append(osiagniecieElement)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
notes_.addEventListener('click', getNotes);
|
|
@ -1,22 +0,0 @@
|
|||
const school_data = document.querySelector('#school_data_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const getSchoolData = () => {
|
||||
document.querySelector('#content').innerHTML = 'Here is school data (in my imagination)';
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/school_data', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
|
||||
school_data_.addEventListener('click', getSchoolData);
|
|
@ -1,16 +0,0 @@
|
|||
const name_ = document.querySelector('#name');
|
||||
const email_ = document.querySelector('#email');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const studentName = () => {
|
||||
const cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'))
|
||||
name_.innerHTML = cookies_data['data']['students']['data'][0]['UczenImie']+' '+cookies_data['data']['students']['data'][0]['UczenImie2']+' '+cookies_data['data']['students']['data'][0]['UczenNazwisko']
|
||||
};
|
||||
|
||||
const studentEmail = () => {
|
||||
email_.innerHTML = sessionStorage.getItem('email')
|
||||
};
|
||||
|
||||
window.addEventListener('load', studentName);
|
||||
window.addEventListener('load', studentEmail);
|
|
@ -1,46 +0,0 @@
|
|||
const stats_ = document.querySelector('#stats_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const showMenu = () => {
|
||||
document.querySelector('#content').innerHTML = '<button id="partial" class="waves-light waves-effect btn red darken-1">OCENY CZĄSTKOWE</button>';
|
||||
document.querySelector('#content').innerHTML += '<button id="year" class="waves-light waves-effect btn red darken-1">OCENY ROCZNE</button>';
|
||||
const partial_ = document.querySelector('#partial');
|
||||
const year_ = document.querySelector('#year');
|
||||
partial_.addEventListener('click', getPartial);
|
||||
year_.addEventListener('click', getYear);
|
||||
}
|
||||
|
||||
const getPartial = () => {
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/stats/partial', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
const getYear = () => {
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/stats/year', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
stats_.addEventListener('click', showMenu);
|
|
@ -1,22 +0,0 @@
|
|||
const student_data_ = document.querySelector('#student_data_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
|
||||
const getStudentData = () => {
|
||||
document.querySelector('#content').innerHTML = 'Here is student data (in my imagination)';
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/student_data', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
student_data_.addEventListener('click', getStudentData)
|
|
@ -1,35 +0,0 @@
|
|||
const timetable_ = document.querySelector('#timetable_');
|
||||
|
||||
myStorage = window.sessionStorage;
|
||||
weekTimetable = 0
|
||||
|
||||
const getTimetable = (event) => {
|
||||
if (event.target.id == 'previous-timetable' || event.target.id == 'previous-timetable_i') {
|
||||
weekTimetable -= 1
|
||||
}
|
||||
else if (event.target.id == 'next-timetable' || event.target.id == 'next-timetable_i') {
|
||||
weekTimetable += 1
|
||||
}
|
||||
document.querySelector('#content').innerHTML = 'Here is timetable (in my imagination)';
|
||||
document.querySelector('#content').innerHTML += '<button id="previous-timetable" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-timetable_i">keyboard_arrow_left</i></button>';
|
||||
document.querySelector('#content').innerHTML += '<button id="next-timetable" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-timetable_i">keyboard_arrow_right</i></button>';
|
||||
const left_timetable_ = document.querySelector('#previous-timetable');
|
||||
const right_timetable_ = document.querySelector('#next-timetable');
|
||||
left_timetable_.addEventListener('click', getTimetable);
|
||||
right_timetable_.addEventListener('click', getTimetable);
|
||||
cookies_data = sessionStorage.getItem('cookies_data');
|
||||
csrfcookie_ = sessionStorage.getItem('csrfcookie');
|
||||
fetch(url = '../api/timetable', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfcookie_
|
||||
},
|
||||
body: JSON.stringify({"cookies": cookies_data, "week": weekTimetable})
|
||||
}).then(response => response.json()).then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
timetable_.addEventListener('click', getTimetable);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue