select class
This commit is contained in:
parent
5f2d191788
commit
97d6865fdd
|
@ -32,4 +32,11 @@ button {
|
||||||
}
|
}
|
||||||
.active {
|
.active {
|
||||||
display: block;
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
|
||||||
}
|
}
|
12
index.html
12
index.html
|
@ -64,10 +64,18 @@
|
||||||
<button onclick="changeDay(-1)">Poprzedni Dzień</button>
|
<button onclick="changeDay(-1)">Poprzedni Dzień</button>
|
||||||
<button onclick="changeDay(1)">Następny Dzień</button>
|
<button onclick="changeDay(1)">Następny Dzień</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="select-class">
|
||||||
|
<p>Wybierz klase:</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<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="3">Frekwencja</th>
|
||||||
<th colspan="4">Olimpiady</th>
|
<th colspan="4">Olimpiady</th>
|
||||||
<th colspan="2">Konkursy Szkolne</th>
|
<th colspan="2">Konkursy Szkolne</th>
|
||||||
|
@ -108,6 +116,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer style="margin: 20px">
|
<footer style="margin: 20px">
|
||||||
|
K. Michalak
|
||||||
|
</br>
|
||||||
F. Kowalski
|
F. Kowalski
|
||||||
</br>
|
</br>
|
||||||
Led and Authored by M. Pabiszczak
|
Led and Authored by M. Pabiszczak
|
||||||
|
|
28
js/script.js
28
js/script.js
|
@ -1,3 +1,10 @@
|
||||||
|
//Funkcja do sprawdzania ktora klasa jest wybrana w SELECT
|
||||||
|
|
||||||
|
function selected_class() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Funkcja do wczytania pliku JSON
|
// Funkcja do wczytania pliku JSON
|
||||||
async function fetchJSONFile(filePath) {
|
async function fetchJSONFile(filePath) {
|
||||||
try {
|
try {
|
||||||
|
@ -19,15 +26,31 @@ async function loadClasses() {
|
||||||
if (classes) {
|
if (classes) {
|
||||||
console.log('Classes loaded:', classes);
|
console.log('Classes loaded:', classes);
|
||||||
|
|
||||||
|
var section_HTML = ""
|
||||||
|
|
||||||
// Iterowanie po wszystkich klasach i wczytywanie plików z danymi uczniów
|
// Iterowanie po wszystkich klasach i wczytywanie plików z danymi uczniów
|
||||||
for (const classInfo of classes) {
|
for (const classInfo of classes) {
|
||||||
const studentsFilePath = '/data/'+ classInfo.file_path;
|
const studentsFilePath = '/data/'+ classInfo.file_path;
|
||||||
const studentsData = await fetchJSONFile(studentsFilePath);
|
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) {
|
if (studentsData) {
|
||||||
console.log(`Students loaded for class ${classInfo.class}:`, studentsData);
|
console.log(`Students loaded for class ${classInfo.class}:`, studentsData);
|
||||||
// Tutaj możesz przechowywać dane lub je przetwarzać według potrzeb
|
// Tutaj możesz przechowywać dane lub je przetwarzać według potrzeb
|
||||||
processClassData(classInfo, studentsData);
|
processClassData(classInfo, studentsData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,9 +113,14 @@ function generateTable() {
|
||||||
const table = document.getElementById('student-table');
|
const table = document.getElementById('student-table');
|
||||||
table.innerHTML = '';
|
table.innerHTML = '';
|
||||||
|
|
||||||
|
//xd
|
||||||
|
|
||||||
studentsData.forEach(student => {
|
studentsData.forEach(student => {
|
||||||
const row = document.createElement('tr');
|
const row = document.createElement('tr');
|
||||||
row.innerHTML = `
|
row.innerHTML = `
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<td>${student.name}</td>
|
<td>${student.name}</td>
|
||||||
<td><input type="checkbox" id="frekwencja-${student.name.replace(' ', '-')}" onchange="calculateStats()"></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>
|
<td><input type="checkbox" id="brak-godzin-${student.name.replace(' ', '-')}" onchange="calculateStats()"></td>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
a4dd89352b730d2ef7a3eff72ab98dbc2b7e8d6b
|
Loading…
Reference in New Issue