feat: Grade details
This commit is contained in:
@@ -3,6 +3,7 @@ package cz.jzitnik.controllers;
|
|||||||
import cz.jzitnik.router.Route;
|
import cz.jzitnik.router.Route;
|
||||||
import cz.jzitnik.router.Router;
|
import cz.jzitnik.router.Router;
|
||||||
import cz.jzitnik.query.QueryOptions;
|
import cz.jzitnik.query.QueryOptions;
|
||||||
|
import cz.jzitnik.util.TimetableRenderer;
|
||||||
import io.github.tomhula.jecnaapi.data.room.Room;
|
import io.github.tomhula.jecnaapi.data.room.Room;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -93,7 +94,7 @@ public class ClassroomDetailController extends DashboardBaseController {
|
|||||||
|
|
||||||
if (timetableGrid != null) {
|
if (timetableGrid != null) {
|
||||||
if (room.getTimetable() != null) {
|
if (room.getTimetable() != null) {
|
||||||
cz.jzitnik.util.TimetableRenderer.renderTimetable(timetableGrid, room.getTimetable());
|
TimetableRenderer.renderTimetable(timetableGrid, room.getTimetable());
|
||||||
} else {
|
} else {
|
||||||
timetableGrid.getChildren().clear();
|
timetableGrid.getChildren().clear();
|
||||||
timetableGrid.getColumnConstraints().clear();
|
timetableGrid.getColumnConstraints().clear();
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ public class GradesController extends DashboardBaseController {
|
|||||||
else badge.getStyleClass().add("grade-other");
|
else badge.getStyleClass().add("grade-other");
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
|
/*
|
||||||
StringBuilder tooltipText = new StringBuilder();
|
StringBuilder tooltipText = new StringBuilder();
|
||||||
if (desc != null && !desc.isEmpty()) {
|
if (desc != null && !desc.isEmpty()) {
|
||||||
tooltipText.append(desc).append("\n");
|
tooltipText.append(desc).append("\n");
|
||||||
@@ -290,9 +291,38 @@ public class GradesController extends DashboardBaseController {
|
|||||||
Tooltip tooltip = new Tooltip(tooltipText.toString().trim());
|
Tooltip tooltip = new Tooltip(tooltipText.toString().trim());
|
||||||
Tooltip.install(badge, tooltip);
|
Tooltip.install(badge, tooltip);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isPredicted) {
|
||||||
|
badge.setOnMouseClicked(e -> showGradeDetailsDialog(desc, teacher, date));
|
||||||
|
badge.getStyleClass().add("clickable-grade");
|
||||||
|
}
|
||||||
|
|
||||||
return badge;
|
return badge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showGradeDetailsDialog(String desc, String teacher, String date) {
|
||||||
|
Dialog<Void> dialog = new Dialog<>();
|
||||||
|
dialog.setTitle("Detail známky");
|
||||||
|
dialog.setHeaderText(null);
|
||||||
|
dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
|
||||||
|
|
||||||
|
VBox content = new VBox(10);
|
||||||
|
content.setPadding(new Insets(20));
|
||||||
|
|
||||||
|
if (desc != null && !desc.isEmpty()) {
|
||||||
|
content.getChildren().add(new Label("Popis: " + desc));
|
||||||
|
}
|
||||||
|
if (teacher != null && !teacher.isEmpty()) {
|
||||||
|
content.getChildren().add(new Label("Učitel: " + teacher));
|
||||||
|
}
|
||||||
|
if (date != null && !date.isEmpty()) {
|
||||||
|
content.getChildren().add(new Label("Datum: " + date));
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.getDialogPane().setContent(content);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void onBackToDashboard() {
|
protected void onBackToDashboard() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cz.jzitnik.router.Route;
|
|||||||
import cz.jzitnik.router.Router;
|
import cz.jzitnik.router.Router;
|
||||||
import cz.jzitnik.query.QueryOptions;
|
import cz.jzitnik.query.QueryOptions;
|
||||||
import cz.jzitnik.util.ImageFetcher;
|
import cz.jzitnik.util.ImageFetcher;
|
||||||
|
import cz.jzitnik.util.TimetableRenderer;
|
||||||
import io.github.tomhula.jecnaapi.data.schoolStaff.Teacher;
|
import io.github.tomhula.jecnaapi.data.schoolStaff.Teacher;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -117,7 +118,7 @@ public class TeacherProfileController extends DashboardBaseController {
|
|||||||
|
|
||||||
if (timetableGrid != null) {
|
if (timetableGrid != null) {
|
||||||
if (teacher.getTimetable() != null) {
|
if (teacher.getTimetable() != null) {
|
||||||
cz.jzitnik.util.TimetableRenderer.renderTimetable(timetableGrid, teacher.getTimetable());
|
TimetableRenderer.renderTimetable(timetableGrid, teacher.getTimetable());
|
||||||
} else {
|
} else {
|
||||||
timetableGrid.getChildren().clear();
|
timetableGrid.getChildren().clear();
|
||||||
timetableGrid.getColumnConstraints().clear();
|
timetableGrid.getColumnConstraints().clear();
|
||||||
|
|||||||
@@ -67,4 +67,11 @@
|
|||||||
.grade-3 { -fx-background-color: #d29922; } /* Primer Yellow */
|
.grade-3 { -fx-background-color: #d29922; } /* Primer Yellow */
|
||||||
.grade-4 { -fx-background-color: #f85149; } /* Primer Red */
|
.grade-4 { -fx-background-color: #f85149; } /* Primer Red */
|
||||||
.grade-5 { -fx-background-color: #da3633; -fx-border-color: #ff7b72; -fx-border-width: 1px; -fx-border-radius: 4px; } /* Darker Red */
|
.grade-5 { -fx-background-color: #da3633; -fx-border-color: #ff7b72; -fx-border-width: 1px; -fx-border-radius: 4px; } /* Darker Red */
|
||||||
.grade-other { -fx-background-color: #6e7681; } /* Primer Gray */
|
.grade-other { -fx-background-color: #6e7681; } /* Primer Gray */
|
||||||
|
|
||||||
|
.clickable-grade {
|
||||||
|
-fx-cursor: hand;
|
||||||
|
}
|
||||||
|
.clickable-grade:hover {
|
||||||
|
-fx-opacity: 0.8;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user