select class

This commit is contained in:
konradm 2024-10-16 12:42:08 +02:00
parent 5f2d191788
commit 97d6865fdd
4 changed files with 47 additions and 1 deletions

View File

@ -32,4 +32,11 @@ button {
}
.active {
display: block;
}
select {
margin-bottom: 10px;
padding: 5px;
background-color: #f2f2f2;
}

View File

@ -64,10 +64,18 @@
<button onclick="changeDay(-1)">Poprzedni Dzień</button>
<button onclick="changeDay(1)">Następny Dzień</button>
</div>
<div class="select-class">
<p>Wybierz klase:</p>
</div>
<table>
<thead>
<tr>
<th rowSpan="2">Uczeń</th>
<th rowSpan="2"><select class="select-class" id="select-class">
<option value="">Klasa 1</option>
<option value="">Klasa 2</option>
<option value="">Klasa 3</option>
</select></th>
<th colspan="3">Frekwencja</th>
<th colspan="4">Olimpiady</th>
<th colspan="2">Konkursy Szkolne</th>
@ -108,6 +116,8 @@
</div>
<footer style="margin: 20px">
K. Michalak
</br>
F. Kowalski
</br>
Led and Authored by M. Pabiszczak

View File

@ -1,3 +1,10 @@
//Funkcja do sprawdzania ktora klasa jest wybrana w SELECT
function selected_class() {
}
// Funkcja do wczytania pliku JSON
async function fetchJSONFile(filePath) {
try {
@ -19,15 +26,31 @@ async function loadClasses() {
if (classes) {
console.log('Classes loaded:', classes);
var section_HTML = ""
// Iterowanie po wszystkich klasach i wczytywanie plików z danymi uczniów
for (const classInfo of classes) {
const studentsFilePath = '/data/'+ classInfo.file_path;
const studentsData = await fetchJSONFile(studentsFilePath);
// Wczytywanie klas do elementu select w html
const section_by_id = document.getElementById("select-class")
if (!section_HTML.includes(classInfo.class)) {
const section_option = "<option>" + "Klasa: " + classInfo.class + "</option>"
section_HTML += section_option;
console.log("DODANO KLASE ", classInfo.class, " DO SELECT")
section_by_id.innerHTML = section_HTML
}
if (studentsData) {
console.log(`Students loaded for class ${classInfo.class}:`, studentsData);
// Tutaj możesz przechowywać dane lub je przetwarzać według potrzeb
processClassData(classInfo, studentsData);
}
}
}
@ -90,9 +113,14 @@ function generateTable() {
const table = document.getElementById('student-table');
table.innerHTML = '';
//xd
studentsData.forEach(student => {
const row = document.createElement('tr');
row.innerHTML = `
<td>${student.name}</td>
<td><input type="checkbox" id="frekwencja-${student.name.replace(' ', '-')}" onchange="calculateStats()"></td>
<td><input type="checkbox" id="brak-godzin-${student.name.replace(' ', '-')}" onchange="calculateStats()"></td>

1
p1/token.txt Normal file
View File

@ -0,0 +1 @@
a4dd89352b730d2ef7a3eff72ab98dbc2b7e8d6b