commit df7bdeffc1cb0614d915e520775458b1636ee1f7 Author: unknown Date: Fri Oct 18 10:25:47 2024 +0200 css diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..b47c0c4 --- /dev/null +++ b/css/style.css @@ -0,0 +1,277 @@ +/* Podstawowe style dla zakładek */ +.tab { + display: none; +} + +.tab.active { + display: block; +} + +/* Style dla przycisków kategorii */ +.category-buttons { + margin: 10px 0; + text-align: center; +} + +.category-buttons button { + margin: 5px; + padding: 10px 15px; + font-size: 16px; + cursor: pointer; + background-color: #f2f2f2; + border: 1px solid #ccc; + border-radius: 4px; + transition: background-color 0.3s, color 0.3s, border 0.3s; +} + +.category-buttons button.active { + background-color: #4CAF50; + color: white; + border: 1px solid #4CAF50; +} + +/* Stylizacja tabeli */ +table { + width: 100%; + border-collapse: collapse; + margin-top: 20px; +} + +th, td { + border: 1px solid #ddd; + padding: 8px; + text-align: center; +} + +th { + background-color: #f2f2f2; +} + +tr:nth-child(even) { + background-color: #f9f9f9; +} + +/* Stylizacja kontenera klasy */ +.select-class { + margin-top: 20px; + text-align: center; +} + +.select-class select { + padding: 5px; + font-size: 16px; + border: 1px solid #ccc; + border-radius: 4px; +} + +/* Stylizacja nagłówków */ +h1, h2, h3 { + text-align: center; +} + +/* Dodatkowe style dla układu */ +body { + font-family: Arial, sans-serif; + margin: 20px; + background-color: #fafafa; +} + +/* Stylizacja stopki */ +footer.footer { + width: 100%; + padding: 20px 0; + background-color: #fafafa; + color: #555; +} + +.footer-container { + max-width: 1200px; + margin: 0 auto; + display: flex; + flex-direction: column; + align-items: stretch; +} + +.footer-left, .footer-right { + width: 100%; +} + +.footer-left { + text-align: left; +} + +.footer-right { + text-align: right; +} + +.footer-line { + border: none; + border-top: 2px solid #ddd; + margin: 20px 0; + width: 100%; +} + +/* Dodatkowe style dla estetyki */ +.footer-left p, +.footer-right p { + margin: 5px 0; + font-size: 14px; + color: #333; +} + +/* Stylizacja przycisków ogólna */ +button { + outline: none; +} + +button:hover { + opacity: 0.8; +} + +/* Stylizacja checkboxów */ +input[type="checkbox"] { + transform: scale(1.2); + cursor: pointer; +} + + +/* Style dla przycisków kategorii */ +.category-buttons button { + margin: 5px; + padding: 10px 15px; + font-size: 16px; + cursor: pointer; + background-color: #4CAF50; /* A vibrant green color */ + color: white; /* White text for contrast */ + border: none; /* No border */ + border-radius: 4px; + transition: background-color 0.3s, transform 0.2s; +} + +.category-buttons button:hover { + background-color: #45a049; /* Slightly darker green on hover */ + transform: scale(1.05); /* Slight scaling effect */ +} + +.category-buttons button:active { + background-color: #388e3c; /* Darker shade when pressed */ + transform: scale(0.95); /* Slightly smaller when pressed */ +} + +/* Active button state */ +.category-buttons button.active { + background-color: #2e7d32; /* Dark green for active button */ + color: white; /* Keep the text white */ + border: 1px solid #2e7d32; /* Dark green border */ +} + + +/* Style dla głównych przycisków */ +.button-main { + margin: 10px; + padding: 12px 20px; + font-size: 18px; + cursor: pointer; + background-color: #2e7d32; /* Bright blue color */ + color: white; /* White text */ + border: none; /* No border */ + border-radius: 5px; /* Rounded corners */ + transition: background-color 0.3s, transform 0.2s; /* Smooth transitions */ + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */ +} + +.button-main:hover { + background-color: #2e7d32; /* Darker blue on hover */ + transform: scale(1.05); /* Slight scaling effect */ +} + +.button-main:active { + background-color: #2e7d32; /* Even darker shade when pressed */ + transform: scale(0.95); /* Slightly smaller when pressed */ +} + +.day-navigation { + display: flex; + justify-content: center; + margin: 20px 0; +} + +.day-navigation button { + margin: 0 10px; /* Spacing between buttons */ + padding: 10px 20px; /* Padding for the buttons */ + font-size: 16px; /* Font size */ + color: white; /* Text color */ + background-color: #2e7d32; /* Blue background color */ + border: none; /* No border */ + border-radius: 4px; /* Rounded corners */ + cursor: pointer; /* Pointer cursor on hover */ + transition: background-color 0.3s, transform 0.2s; /* Smooth transitions */ +} + +.day-navigation button:hover { + background-color: #2e7d32; /* Darker blue on hover */ + transform: scale(1.05); /* Slight scaling effect */ +} + +.day-navigation button:active { + background-color: #0D47A1; /* Even darker blue when pressed */ + transform: scale(0.95); /* Slightly smaller when pressed */ +} + + + +/* Container for the statistics section */ +.statistics-container { + margin: 20px auto; /* Centering the container */ + padding: 20px; /* Inner spacing */ + border: 1px solid #ddd; /* Light border */ + border-radius: 8px; /* Rounded corners */ + background-color: #f9f9f9; /* Light background color */ + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */ +} + +/* Styling for labels */ +.statistics-container label { + display: block; /* Block display for labels */ + margin: 10px 0 5px; /* Spacing around labels */ + font-weight: bold; /* Bold text */ +} + +/* Styling for input fields */ +.statistics-container input[type="number"] { + width: 100%; /* Full width inputs */ + padding: 10px; /* Inner padding */ + font-size: 16px; /* Font size */ + border: 1px solid #ccc; /* Border color */ + border-radius: 4px; /* Rounded corners */ + margin-bottom: 15px; /* Space below inputs */ + transition: border-color 0.3s; /* Smooth border color change */ +} + +.statistics-container input[type="number"]:focus { + border-color: #4CAF50; /* Change border color on focus */ + outline: none; /* Remove default outline */ +} + +/* Styling for the table */ +.statistics-container table { + width: 100%; /* Full width table */ + border-collapse: collapse; /* Remove gaps between table cells */ + margin-top: 20px; /* Space above table */ +} + +.statistics-container th, +.statistics-container td { + border: 1px solid #ddd; /* Cell borders */ + padding: 10px; /* Inner spacing */ + text-align: center; /* Centered text */ +} + +.statistics-container th { + background-color: #4CAF50; /* Header background color */ + color: white; /* Header text color */ +} + +.statistics-container tr:nth-child(even) { + background-color: #f2f2f2; /* Alternating row colors */ +} diff --git a/data/class.json b/data/class.json new file mode 100644 index 0000000..b7447ae --- /dev/null +++ b/data/class.json @@ -0,0 +1,34 @@ +[ + { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych I", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "3", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi", + "file_path": "students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json", + "student_count": 17 + }, + { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych II", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "4", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi", + "file_path": "students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json", + "student_count": 18 + } +] diff --git a/data/criteria.json b/data/criteria.json new file mode 100644 index 0000000..c726e17 --- /dev/null +++ b/data/criteria.json @@ -0,0 +1,161 @@ +{ + "criteria": [ + { + "id": 1, + "name": "Tardiness" + }, + { + "id": 2, + "name": "Disruption" + }, + { + "id": 3, + "name": "Disrespect towards teachers" + }, + { + "id": 4, + "name": "Participation in class" + }, + { + "id": 5, + "name": "Preparedness for class" + }, + { + "id": 6, + "name": "Attendance" + }, + { + "id": 7, + "name": "Involvement in projects" + }, + { + "id": 8, + "name": "Warning from homeroom teacher" + }, + { + "id": 9, + "name": "Warning from principal" + }, + { + "id": 10, + "name": "Achievements in competitions" + }, + { + "id": 11, + "name": "Representing the school" + }, + { + "id": 12, + "name": "Independence" + }, + { + "id": 13, + "name": "Engagement in lessons" + } + ], + "categories": [ + { + "id": "behavior", + "name": "Behavior", + "criteria_ids": [ + 1, + 2, + 3, + 4 + ] + }, + { + "id": "responsibility", + "name": "Responsibility", + "criteria_ids": [ + 5, + 6, + 7 + ] + }, + { + "id": "discipline", + "name": "Discipline", + "criteria_ids": [ + 8, + 9 + ] + }, + { + "id": "achievement", + "name": "Achievements", + "criteria_ids": [ + 10, + 11 + ] + }, + { + "id": "self_assessment", + "name": "Self-Assessment", + "criteria_ids": [ + 12, + 13 + ] + } + ], + "roles": { + "teacher": { + "criteria_ids": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ] + }, + "homeroom_teacher": { + "criteria_ids": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ] + }, + "principal": { + "criteria_ids": [ + 8, + 9, + 10, + 11 + ] + }, + "student": { + "criteria_ids": [ + 12, + 13 + ] + } + }, + "people": [ + { + "name": "M. Pabiszczak", + "roles": [ + "teacher", + "homeroom_teacher" + ] + }, + { + "name": "A. Nowak", + "roles": [ + "principal" + ] + }, + { + "name": "K. Kowalski", + "roles": [ + "teacher" + ] + } + ] +} diff --git a/data/students/_class_json_schema.json b/data/students/_class_json_schema.json new file mode 100644 index 0000000..d906e47 --- /dev/null +++ b/data/students/_class_json_schema.json @@ -0,0 +1,105 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "header": { + "type": "object", + "properties": { + "school": { + "type": "string" + }, + "city": { + "type": "string" + }, + "year": { + "type": "string" + }, + "semester": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "level": { + "type": "string" + }, + "publisher": { + "type": "string" + }, + "class": { + "type": "string" + }, + "group": { + "type": "string" + }, + "profile": { + "type": "string" + }, + "max_points": { + "type": "integer" + }, + "teacher": { + "type": "string" + } + }, + "required": [ + "school", + "city", + "year", + "semester", + "subject", + "class", + "group", + "profile", + "teacher" + ] + }, + "students": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "name": { + "type": "string" + }, + "grade": { + "type": [ + "string", + "null" + ] + }, + "points": { + "type": [ + "number", + "null" + ] + }, + "status": { + "type": "integer" + } + }, + "required": [ + "id", + "first_name", + "last_name", + "name", + "grade", + "status" + ] + } + } + }, + "required": [ + "header", + "students" + ] +} \ No newline at end of file diff --git a/data/students/_validate_json.py b/data/students/_validate_json.py new file mode 100644 index 0000000..47e21af --- /dev/null +++ b/data/students/_validate_json.py @@ -0,0 +1,37 @@ +import json +import sys +from jsonschema import validate, ValidationError + +def validate_json(schema_file, json_file): + try: + # Wczytaj schemat JSON + with open(schema_file, 'r') as f: + schema = json.load(f) + + # Wczytaj dane JSON + with open(json_file, 'r') as f: + data = json.load(f) + + # Sprawdź, czy dane JSON są zgodne ze schematem + validate(instance=data, schema=schema) + print("JSON jest zgodny z schematem") + + except ValidationError as e: + print("JSON nie jest zgodny z schematem:", e.message) + except json.JSONDecodeError as e: + print("Błąd wczytywania JSON:", e) + except FileNotFoundError as e: + print("Plik nie został znaleziony:", e) + except Exception as e: + print("Wystąpił błąd:", e) + +if __name__ == "__main__": + if len(sys.argv) != 3: + print("Użycie: python validate_json.py ") + sys.exit(1) + + schema_file = sys.argv[1] + json_file = sys.argv[2] + + validate_json(schema_file, json_file) + diff --git a/data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json b/data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json new file mode 100644 index 0000000..ac5c22f --- /dev/null +++ b/data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json @@ -0,0 +1,171 @@ +{ + "header": { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych I", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "3", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi" + }, + "students": [ + { + "id": 1, + "first_name": "Nikodem", + "last_name": "And", + "name": "And N", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 2, + "first_name": "Karol", + "last_name": "Bar", + "name": "Bar K", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 3, + "first_name": "Roman", + "last_name": "Baz", + "name": "Baz R", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 4, + "first_name": "Jakub", + "last_name": "Bed", + "name": "Bed J", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 5, + "first_name": "Marcel", + "last_name": "Gaj", + "name": "Gaj M", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 6, + "first_name": "Rostyslav", + "last_name": "Hum", + "name": "Hum R", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 7, + "first_name": "Szymon", + "last_name": "Jacz", + "name": "Jacz S", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 8, + "first_name": "Eryk", + "last_name": "Kar", + "name": "Kar E", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 9, + "first_name": "Fabian", + "last_name": "Korz", + "name": "Korz F", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 10, + "first_name": "Zuzanna", + "last_name": "Lo", + "name": "Lo Z", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 11, + "first_name": "Maja", + "last_name": "Miz", + "name": "Miz M", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 12, + "first_name": "Jakub", + "last_name": "Ole", + "name": "Ole J", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 13, + "first_name": "Łukasz", + "last_name": "Oś", + "name": "Oś Ł", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 14, + "first_name": "Maciej", + "last_name": "Pac", + "name": "Pac M", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 15, + "first_name": "Lena", + "last_name": "Pło", + "name": "Pło L", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 16, + "first_name": "Hubert", + "last_name": "Py", + "name": "Py H", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 17, + "first_name": "Antoni", + "last_name": "Wó", + "name": "Wó A", + "grade": "Brak ocen", + "points": null, + "status": 1 + } + ] +} diff --git a/data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json b/data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json new file mode 100644 index 0000000..25d61c5 --- /dev/null +++ b/data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json @@ -0,0 +1,198 @@ +{ + "header": { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych II", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "4", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi" + }, + "students": [ + { + "id": 1, + "first_name": "Aleksander", + "last_name": "Adam", + "name": "Adam A", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 2, + "first_name": "Bartosz", + "last_name": "Boh", + "name": "Boh B", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 3, + "first_name": "Jakub", + "last_name": "Gj", + "name": "Gj J", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 4, + "first_name": "Wiktor", + "last_name": "Kier", + "name": "Kier W", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 5, + "first_name": "Jakub", + "last_name": "Km", + "name": "Km J", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 6, + "first_name": "Fabian", + "last_name": "Kow", + "name": "Kow F", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 7, + "first_name": "Patryk", + "last_name": "Mac", + "name": "Mac P", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 8, + "first_name": "Marcel", + "last_name": "Mars", + "name": "Mars M", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 9, + "first_name": "Szymon", + "last_name": "Pt", + "name": "Pt S", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 10, + "first_name": "Dmytro", + "last_name": "Shev", + "name": "Shev D", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 11, + "first_name": "Anna", + "last_name": "Sik", + "name": "Sik A", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 12, + "first_name": "Szymon", + "last_name": "Spili", + "name": "Spili S", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 13, + "first_name": "Alan", + "last_name": "Stas", + "name": "Stas A", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 14, + "first_name": "Kamil", + "last_name": "Szy", + "name": "Szy K", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 15, + "first_name": "Jakub", + "last_name": "Toc", + "name": "Toc J", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 16, + "first_name": "Mateusz", + "last_name": "Wój", + "name": "Wój M", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 17, + "first_name": "Tomasz", + "last_name": "Zad", + "name": "Zad T", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 18, + "first_name": "Wiktor", + "last_name": "Zal", + "name": "Zal W", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + } + ] +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..7646523 --- /dev/null +++ b/index.html @@ -0,0 +1,176 @@ + + + + + Ocena Zachowania + + + + +

Ocena Zachowania

+ +
+ +
+ + + + +
+ + +
+

Ustal punkty dla kryteriów

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KryteriumPunkty
Frekwencja 95-100%
Brak godzin nieusprawiedliwionych
Minimum 85% frekwencja
Etap szkolny
Etap rejonowy
Etap wojewódzki
Etap ogólnopolski
Udział w konkursach
Wyróżnienie w konkursie
Reprezentacja indywidualna
Reprezentacja zespołowa
Udział w zawodach
Organizacja imprez
Funkcje w klasie
Uroczystości okolicznościowe
Udział w poczcie sztandarowej
Pomoc nauczycielowi
Wolontariat
+
+ + +
+

Kryteria oceny zachowania -

+ +
+ + +
+ + +
+

Wybierz klasę:

+ +
+ +
+ + + + + +
+ + + + + + + + + + + + +
Imię i Nazwisko
+
+ + +
+

Statystyka dla wszystkich dni

+
+
+ +
+ + + +
+ + + + + + diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/js/script.js b/js/script.js new file mode 100644 index 0000000..b9faca1 --- /dev/null +++ b/js/script.js @@ -0,0 +1,345 @@ +// Definicja kategorii i ich kryteriów +const categories = { + frekwencja: [ + { name: "Frekwencja 95-100%", id: "frekwencja" }, + { name: "Brak godzin nieusprawiedliwionych", id: "brak_godzin" }, + { name: "Minimum 85% frekwencja", id: "min_85" } + ], + olimpiady: [ + { name: "Etap szkolny", id: "etap_szkolny" }, + { name: "Etap rejonowy", id: "etap_rejonowy" }, + { name: "Etap wojewódzki", id: "etap_wojewodzki" }, + { name: "Etap ogólnopolski", id: "etap_ogolnopolski" } + ], + konkursy: [ + { name: "Udział w konkursach", id: "udzial_konkurs" }, + { name: "Wyróżnienie w konkursie", id: "wyroznienie_konkurs" } + ], + reprezentacja: [ + { name: "Reprezentacja indywidualna", id: "reprezentacja_indywidualna" }, + { name: "Reprezentacja zespołowa", id: "reprezentacja_zespolowa" }, + { name: "Udział w zawodach", id: "udzial_zawody" } + ], + aktywnosc: [ + { name: "Organizacja imprez", id: "organizacja_imprez" }, + { name: "Funkcje w klasie", id: "funkcja_klasa" }, + { name: "Uroczystości okolicznościowe", id: "uroczystosci" }, + { name: "Udział w poczcie sztandarowej", id: "poczta_sztandar" }, + { name: "Pomoc nauczycielowi", id: "pomoc_nauczyciel" }, + { name: "Wolontariat", id: "wolontariat" } + ] +}; + +// Zmienne globalne +let currentCategory = 'frekwencja'; +let currentClass = ''; +let studentsData = []; +let currentDay = 0; +const baseDate = new Date(); + +// Funkcja do wczytywania pliku JSON +async function fetchJSONFile(filePath) { + try { + const response = await fetch(filePath); + if (!response.ok) { + throw new Error(`Błąd HTTP! Status: ${response.status}`); + } + return await response.json(); + } catch (error) { + console.error("Błąd podczas pobierania pliku JSON:", error); + return null; + } +} + +// Funkcja do wczytania pliku class.json +async function loadClasses() { + const classFilePath = '/data/class.json'; + const classes = await fetchJSONFile(classFilePath); + + if (classes) { + console.log('Załadowane klasy:', classes); + + const selectClass = document.getElementById("select-class-select"); + selectClass.innerHTML = ""; // Wyczyść istniejące opcje + + classes.forEach(classInfo => { + const option = document.createElement('option'); + option.value = classInfo.file_path; + option.textContent = `Klasa: ${classInfo.class}`; + selectClass.appendChild(option); + console.log("Dodano klasę ", classInfo.class, " do SELECT"); + }); + + // Dodaj nasłuchiwacz zdarzeń na zmianę wyboru klasy + selectClass.addEventListener('change', function() { + const selectedClassFile = this.value; + console.log(`Wybrano klasę: ${selectedClassFile}`); + loadStudents(selectedClassFile); + }); + + // Opcjonalnie, ustaw domyślnie pierwszą klasę i załaduj jej uczniów + if (classes.length > 0) { + selectClass.selectedIndex = 0; + const defaultClassFile = classes[0].file_path; + loadStudents(defaultClassFile); + } + } +} + +// Funkcja do wczytania danych uczniów dla wybranej klasy +async function loadStudents(classFilePath) { + if (!classFilePath) { + console.warn("Nie wybrano żadnej klasy."); + return; + } + + const studentsFilePath = `/data/${classFilePath}`; + const data = await fetchJSONFile(studentsFilePath); + + if (data && Array.isArray(data.students)) { + console.log(`Uczniowie załadowani z pliku ${classFilePath}:`, data); + studentsData = data.students; // Aktualizuj globalną tablicę uczniów + + // Inicjalizacja 'behavior' dla każdego ucznia, jeśli jest niezdefiniowany + studentsData.forEach(student => { + if (!student.behavior) { + student.behavior = {}; + } + }); + + currentClass = classFilePath; // Ustaw aktualną klasę + generateTable(currentCategory); // Regeneruj tabelę z aktualną kategorią + } else { + console.error("Błąd: Nie udało się załadować danych uczniów lub dane są niepoprawne."); + studentsData = []; // Jeśli nie udało się załadować danych, wyczyść tablicę uczniów + currentClass = ''; + generateTable(currentCategory); // Regeneruj pustą tabelę + } +} + +// Funkcja do wczytania pliku criteria.json +async function loadCriteria() { + const criteriaFilePath = '/data/criteria.json'; + const criteria = await fetchJSONFile(criteriaFilePath); + + console.log("Załadowane kryteria:", criteria); + // Implementacja dalszego przetwarzania kryteriów, jeśli jest potrzebna +} + +// Funkcja do przełączania głównych zakładek +function showTab(tabName) { + // Ukryj wszystkie główne taby + const tabs = document.querySelectorAll('.tab'); + tabs.forEach(tab => tab.classList.remove('active')); + + // Pokaż wybrany tab + const selectedTab = document.getElementById(tabName); + if (selectedTab) { + selectedTab.classList.add('active'); + } + + if (tabName === 'criteria') { + loadDayData(); + } else if (tabName === 'points') { + calculateStats(); + } +} + +// Funkcja do przełączania kategorii w tabeli uczniów +function showInnerTab(category) { + currentCategory = category; + // Generowanie tabeli na podstawie wybranej kategorii + generateTable(category); + + // Podkreślenie aktywnego przycisku + const buttons = document.querySelectorAll('.category-buttons button'); + buttons.forEach(button => button.classList.remove('active')); + const activeButton = document.querySelector(`.category-buttons button[data-category="${category}"]`); + if (activeButton) { + activeButton.classList.add('active'); + } +} + +// Funkcja, aby ustawić domyślną kategorię i zakładkę +document.addEventListener("DOMContentLoaded", function() { + // Domyślnie pokazujemy kategorię 'frekwencja' + showInnerTab('frekwencja'); + + // Ustawienie daty na dziś + document.getElementById('current-date').innerText = baseDate.toLocaleDateString(); + + // Uruchomienie wczytywania klas i kryteriów + loadClasses(); + loadCriteria(); +}); + +// Funkcja do zmiany dnia +function changeDay(direction) { + saveDayData(); + currentDay += direction; + const newDate = new Date(baseDate); + newDate.setDate(baseDate.getDate() + currentDay); + document.getElementById('current-date').innerText = newDate.toLocaleDateString(); + loadDayData(); +} + +// Funkcja do ładowania danych dnia +function loadDayData() { + studentsData.forEach(student => { + const studentId = `${student.first_name}-${student.last_name}`.replace(/ /g, '-'); + const behavior = student.behavior[`day${currentDay}`] || {}; + + // Pobierz kryteria dla aktualnej kategorii + const categoryColumns = categories[currentCategory]; + categoryColumns.forEach(column => { + const checkbox = document.getElementById(`${column.id}-${studentId}`); + if (checkbox) { + checkbox.checked = behavior[column.id] || false; + } + }); + }); + + calculateStats(); +} + +// Funkcja do zapisywania danych dnia +function saveDayData() { + studentsData.forEach(student => { + const studentId = `${student.first_name}-${student.last_name}`.replace(/ /g, '-'); + + // Upewnij się, że 'behavior' jest zdefiniowany + if (!student.behavior) { + student.behavior = {}; + } + + let behavior = student.behavior[`day${currentDay}`] || {}; + + const categoryColumns = categories[currentCategory]; + + categoryColumns.forEach(column => { + const checkbox = document.getElementById(`${column.id}-${studentId}`); + if (checkbox) { + behavior[column.id] = checkbox.checked; + } + }); + + student.behavior[`day${currentDay}`] = behavior; + }); +} + +// Funkcja do obliczania statystyk +function calculateStats() { + // Pobieranie punktów z zakładki "Ustal punkty" + const points = { + frekwencja: parseInt(document.getElementById('frekwencja-punkty').value) || 0, + brak_godzin: parseInt(document.getElementById('brak_godzin-punkty').value) || 0, + min_85: parseInt(document.getElementById('min_85-punkty').value) || 0, + etap_szkolny: parseInt(document.getElementById('etap_szkolny-punkty').value) || 5, + etap_rejonowy: parseInt(document.getElementById('etap_rejonowy-punkty').value) || 10, + etap_wojewodzki: parseInt(document.getElementById('etap_wojewodzki-punkty').value) || 15, + etap_ogolnopolski: parseInt(document.getElementById('etap_ogolnopolski-punkty').value) || 20, + udzial_konkurs: parseInt(document.getElementById('udzial_konkurs-punkty').value) || 5, + wyroznienie_konkurs: parseInt(document.getElementById('wyroznienie_konkurs-punkty').value) || 10, + reprezentacja_indywidualna: parseInt(document.getElementById('reprezentacja_indywidualna-punkty').value) || 5, + reprezentacja_zespolowa: parseInt(document.getElementById('reprezentacja_zespolowa-punkty').value) || 10, + udzial_zawody: parseInt(document.getElementById('udzial_zawody-punkty').value) || 15, + organizacja_imprez: parseInt(document.getElementById('organizacja_imprez-punkty').value) || 10, + funkcja_klasa: parseInt(document.getElementById('funkcja_klasa-punkty').value) || 10, + uroczystosci: parseInt(document.getElementById('uroczystosci-punkty').value) || 10, + poczta_sztandar: parseInt(document.getElementById('poczta_sztandar-punkty').value) || 20, + pomoc_nauczyciel: parseInt(document.getElementById('pomoc_nauczyciel-punkty').value) || 10, + wolontariat: parseInt(document.getElementById('wolontariat-punkty').value) || 10 + }; + + let stats = ''; + + studentsData.forEach(student => { + let totalPoints = 0; + + Object.keys(student.behavior).forEach(day => { + const behavior = student.behavior[day]; + + let dayPoints = 0; + for (const [criterion, value] of Object.entries(behavior)) { + if (value && points[criterion]) { + dayPoints += points[criterion]; + } + } + + totalPoints += dayPoints; + }); + + stats += `${student.first_name} ${student.last_name}: ${totalPoints} punktów (${getGrade(totalPoints)})\n`; + }); + + document.getElementById('stats-output').innerText = stats; +} + +// Funkcja do przypisywania ocen na podstawie punktów +function getGrade(points) { + if (points >= 250) return "Wzorowe"; + if (points >= 180) return "Bardzo dobre"; + if (points >= 100) return "Dobre"; + if (points >= 50) return "Poprawne"; + if (points >= 0) return "Nieodpowiednie"; + return "Naganne"; +} + +// Funkcja do generowania tabeli uczniów na podstawie wybranej kategorii +function generateTable(category) { + const table = document.getElementById('student-table'); + const thead = table.querySelector('thead tr'); + const tbody = table.querySelector('tbody'); + + // Wyczyść istniejące nagłówki i wiersze + thead.innerHTML = ''; + tbody.innerHTML = ''; + + // Dodaj nagłówek 'Imię i Nazwisko' + const thName = document.createElement('th'); + thName.textContent = "Imię i Nazwisko"; + thead.appendChild(thName); + + // Pobierz kolumny dla wybranej kategorii + const categoryColumns = categories[category]; + + // Dodaj nagłówki dla kryteriów w kategorii + categoryColumns.forEach(column => { + const th = document.createElement('th'); + th.textContent = column.name; + thead.appendChild(th); + }); + + // Generuj wiersze dla uczniów + studentsData.forEach(student => { + const row = document.createElement('tr'); + + // Komórka z imieniem i nazwiskiem + const tdName = document.createElement('td'); + tdName.textContent = `${student.first_name} ${student.last_name}`; + row.appendChild(tdName); + + // Upewnij się, że 'behavior' jest zdefiniowany + if (!student.behavior) { + student.behavior = {}; + } + + // Komórki z checkboxami dla kryteriów + categoryColumns.forEach(column => { + const td = document.createElement('td'); + const checkbox = document.createElement('input'); + checkbox.type = 'checkbox'; + const studentId = `${student.first_name}-${student.last_name}`.replace(/ /g, '-'); + checkbox.id = `${column.id}-${studentId}`; + checkbox.onchange = calculateStats; + + // Ustawienie stanu checkboxa na podstawie zapisanych danych + checkbox.checked = student.behavior[`day${currentDay}`]?.[column.id] || false; + + td.appendChild(checkbox); + row.appendChild(td); + }); + + tbody.appendChild(row); + }); +} diff --git a/templates/criteria.html b/templates/criteria.html new file mode 100644 index 0000000..cf39461 --- /dev/null +++ b/templates/criteria.html @@ -0,0 +1,7 @@ +
+

Kryteria Weryfikacyjne

+
    + +
+
+ diff --git a/templates/dashboard.html b/templates/dashboard.html new file mode 100644 index 0000000..d006bd8 --- /dev/null +++ b/templates/dashboard.html @@ -0,0 +1,51 @@ + + + + + + Behavior Assessment Dashboard + + + +

Behavior Assessment Dashboard

+ +
+ + + + + + + + + + + +
+ +

Criteria Table

+ + + + + + + + + + +
Student
+ + + + + diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..41adefc --- /dev/null +++ b/templates/header.html @@ -0,0 +1,12 @@ +
+

Ocena Zachowania

+

Zalogowany jako: Nauczyciel

+
+ + + diff --git a/templates/statistics.html b/templates/statistics.html new file mode 100644 index 0000000..ce95227 --- /dev/null +++ b/templates/statistics.html @@ -0,0 +1,27 @@ +
+

Statystyki i Ustalanie Wag

+ + +
+ + +
+ + + +

Statystyki dla uczniów

+ + + + + + + + + + + + +
UczeńPunktyOcena
+
+