Add messages in menu and improve grades
This commit is contained in:
parent
1361a17038
commit
c34dc6774a
4 changed files with 60 additions and 22 deletions
|
@ -19,3 +19,7 @@ and modify the .envsample file.
|
|||
```shell
|
||||
python manage.py runserver
|
||||
```
|
||||
or if you run Windows you can run:
|
||||
```shell
|
||||
runserver.bat
|
||||
```
|
||||
|
|
|
@ -40,12 +40,14 @@ body {
|
|||
}
|
||||
|
||||
.grade {
|
||||
font-size: 20px;
|
||||
width: 25px;
|
||||
height: 30px;
|
||||
background: #ff0000;
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 5px;
|
||||
display: block;
|
||||
border-radius: 5px;
|
||||
cursor: pointer !important;
|
||||
font-size: 20px !important;
|
||||
width: 25px !important;
|
||||
height: 30px !important;
|
||||
text-align: center !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
margin-top: 5px !important;
|
||||
}
|
|
@ -15,24 +15,44 @@ const getGrades = () => {
|
|||
body: cookies_data
|
||||
}).then(response => response.json()).then(data => {
|
||||
allGrades = data.data.Oceny
|
||||
const content = document.getElementById("content")
|
||||
|
||||
allGrades.forEach((grade) => {
|
||||
content = document.getElementById("content")
|
||||
czastkowe = grade.OcenyCzastkowe
|
||||
//console.log(grade)
|
||||
const czastkowe = grade.OcenyCzastkowe
|
||||
|
||||
czastkowe.forEach((czastkowa) => {
|
||||
const gradeDiv = document.createElement("div")
|
||||
gradeDiv.className = "grade"
|
||||
gradeDiv.classList = "grade modal-trigger"
|
||||
gradeDiv.href = "#modal1"
|
||||
gradeDiv.innerHTML = `${czastkowa.Wpis}`
|
||||
if (czastkowa.Wpis == "6" || czastkowa.Wpis == "6-") gradeDiv.style.background = "#3dbbf5"
|
||||
else if (czastkowa.Wpis == "5" || czastkowa.Wpis == "5-" || czastkowa.Wpis == "5+") gradeDiv.style.background = "#4caf50"
|
||||
else if (czastkowa.Wpis == "4" || czastkowa.Wpis == "4-" || czastkowa.Wpis == "4+") gradeDiv.style.background = "#a0c431"
|
||||
else if (czastkowa.Wpis == "3" || czastkowa.Wpis == "3-" || czastkowa.Wpis == "3+") gradeDiv.style.background = "#ffb940"
|
||||
else if (czastkowa.Wpis == "2" || czastkowa.Wpis == "2-" || czastkowa.Wpis == "2+") gradeDiv.style.background = "#ff774d"
|
||||
else if (czastkowa.Wpis == "1" || czastkowa.Wpis == "1-") gradeDiv.style.background = "#d43f3f"
|
||||
else gradeDiv.style.background = "#607d8b"
|
||||
console.log(czastkowa)
|
||||
content.appendChild(gradeDiv)
|
||||
|
||||
switch (czastkowa.Wpis) {
|
||||
case "6" || "6-":
|
||||
gradeDiv.style.background = "#3dbbf5"
|
||||
break;
|
||||
case "5" || "5-" || "5+":
|
||||
gradeDiv.style.background = "#4caf50"
|
||||
break;
|
||||
case "4" || "4-" || "4+":
|
||||
gradeDiv.style.background = "#a0c431"
|
||||
break;
|
||||
case "3" || "3-" || "3+":
|
||||
gradeDiv.style.background = "#ffb940"
|
||||
break;
|
||||
case "2" || "2-" || "2+":
|
||||
gradeDiv.style.background = "#ff774d"
|
||||
break;
|
||||
case "1" || "1+":
|
||||
gradeDiv.style.background = "#d43f3f"
|
||||
break;
|
||||
default:
|
||||
gradeDiv.style.background = "#607d8b"
|
||||
}
|
||||
gradeDiv.addEventListener('click', () => {
|
||||
console.log(`Nauczyciel: ${czastkowa.Nauczyciel}, Waga: ${czastkowa.Waga}, Data: ${czastkowa.DataOceny}, Przedmiot: ${grade.Przedmiot}`)
|
||||
})
|
||||
|
||||
content.append(gradeDiv)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -46,7 +46,13 @@
|
|||
<li><a id="exams_">Sprawdziany</a></li>
|
||||
<li><a id="homeworks_">Zadania Domowe</a></li>
|
||||
<li><a id="attendance_">Frekwencjaa</a></li>
|
||||
<li><a id="messages_">Wiadomości</a></li>
|
||||
<li><a id="messages_" class="dropdown-trigger" href="#!" data-target="dropdown1"><i class="material-icons">email</i>Wiadomości</a></li>
|
||||
<ul id='dropdown1' class='dropdown-content'>
|
||||
<li><a href="#!">Odebrane</a></li>
|
||||
<li><a href="#!">Wysłane</a></li>
|
||||
<li><a href="#!">Napisz Wiadomość</a></li>
|
||||
<li><a href="#!">Usunięte</a></li>
|
||||
</ul>
|
||||
<li><a id="notes_">Uwagi</a></li>
|
||||
</ul>
|
||||
<a href="#" data-target="slide-out" class="sidenav-trigger"><i class="material-icons">menu</i></a>
|
||||
|
@ -71,6 +77,12 @@
|
|||
var elems = document.querySelectorAll('.modal');
|
||||
var instances = M.Modal.init(elems, options);
|
||||
});
|
||||
|
||||
var dropdowns = document.querySelectorAll('.dropdown-trigger')
|
||||
for (var i = 0; i < dropdowns.length; i++){
|
||||
M.Dropdown.init(dropdowns[i]);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue