god knows what I did here
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
package de.subway_surfers.vpr_app;
|
||||
|
||||
import Logik.Mahlzeit;
|
||||
import Logik.Tagesplan;
|
||||
import RestAPISchnittstelle.RestApiClient;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
@@ -12,19 +20,74 @@ import javafx.scene.layout.RowConstraints;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.net.http.WebSocket;
|
||||
import java.text.DateFormat;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import static java.time.LocalTime.now;
|
||||
|
||||
|
||||
public class EssensverwaltungMitarbeiterView {
|
||||
|
||||
public Label g1Name;
|
||||
public Label g2Name;
|
||||
public Label g3Name;
|
||||
public Label g4Name;
|
||||
public Label g1Beschreibung;
|
||||
public Label g2Beschreibung;
|
||||
public Label g3Beschreibung;
|
||||
public Label g4Beschreibung;
|
||||
public Label dateLabel;
|
||||
@FXML
|
||||
private GridPane tagesplan;
|
||||
|
||||
private Tagesplan t;
|
||||
|
||||
private String date;
|
||||
|
||||
private String day;
|
||||
|
||||
private String month;
|
||||
|
||||
private String year;
|
||||
|
||||
private ChangeListener listener;
|
||||
|
||||
public void initialize(){
|
||||
|
||||
/*
|
||||
(obs,oldValue,newValue) -> {
|
||||
final int zeile = 1;
|
||||
for (Node n : tagesplan.getChildren()){
|
||||
if(n instanceof Control && GridPane.getRowIndex(n) == zeile){
|
||||
((Control) n).setPrefHeight(newValue.floatValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
DateFormat dateFormat = DateFormat.getDateInstance();
|
||||
date = dateFormat.format(new Date());
|
||||
date = date.replace('.', '-');
|
||||
day = date.split("-")[0];
|
||||
month = date.split("-")[1];
|
||||
year = date.split("-")[2];
|
||||
date = String.format("%s-%s-%s", year, month, day);
|
||||
|
||||
dateLabel.setText(String.format("%s.%s.%s", day, month, year));
|
||||
|
||||
|
||||
initGerichte();
|
||||
|
||||
for (int i = 0; i < tagesplan.getColumnCount(); i++) {
|
||||
ColumnConstraints cc = new ColumnConstraints();
|
||||
cc.setHgrow(Priority.ALWAYS);
|
||||
cc.setFillWidth(true);
|
||||
tagesplan.getColumnConstraints().add(cc);
|
||||
}
|
||||
VerwaltungApplication.responsiveBreiteGrid(tagesplan);
|
||||
|
||||
tagesplan.heightProperty().addListener((obs,oldValue,newValue) -> {
|
||||
final int zeile = 1;
|
||||
@@ -35,6 +98,9 @@ public class EssensverwaltungMitarbeiterView {
|
||||
}
|
||||
});
|
||||
|
||||
VerwaltungApplication.responsiveBreiteGrid(tagesplan);
|
||||
|
||||
|
||||
}
|
||||
public void onAbmelden(ActionEvent actionEvent) {
|
||||
VerwaltungApplication.sceneWechseln("login-view.fxml");
|
||||
@@ -59,4 +125,67 @@ public class EssensverwaltungMitarbeiterView {
|
||||
public void onZurueck(ActionEvent actionEvent) {
|
||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||
}
|
||||
|
||||
public void pfeilLinks(ActionEvent actionEvent) {
|
||||
|
||||
tagesplan.getChildren().clear();
|
||||
|
||||
day = String.valueOf(Integer.parseInt(day)-1);
|
||||
date = String.format("%s-%s-%s", year, month, day);
|
||||
|
||||
dateLabel.setText(String.format("%s.%s.%s", day, month, year));
|
||||
|
||||
initGerichte();
|
||||
|
||||
}
|
||||
|
||||
public void pfeilRechts(ActionEvent actionEvent) {
|
||||
|
||||
tagesplan.getChildren().clear();
|
||||
|
||||
day = String.valueOf(Integer.parseInt(day)+1);
|
||||
date = String.format("%s-%s-%s", year, month, day);
|
||||
|
||||
dateLabel.setText(String.format("%s.%s.%s", day, month, year));
|
||||
|
||||
initGerichte();
|
||||
|
||||
}
|
||||
|
||||
private void initGerichte(){
|
||||
|
||||
tagesplan.getStyleClass().clear();
|
||||
|
||||
t = new RestApiClient().getGerichteOnTag(date);
|
||||
|
||||
if(!t.getGerichte().isEmpty()) {
|
||||
for (int i = 0; i < t.getGerichte().size(); i++) {
|
||||
Label name = new Label();
|
||||
tagesplan.add(name, i, 0);
|
||||
Label beschreibung = new Label();
|
||||
beschreibung.setWrapText(true);
|
||||
tagesplan.add(beschreibung, i, 1);
|
||||
Button loeschen = new Button("Löschen");
|
||||
tagesplan.add(loeschen, i ,2);
|
||||
|
||||
name.setText(t.getGerichte().get(i).getName());
|
||||
beschreibung.setText(t.getGerichte().get(i).getBeschreibung());
|
||||
}
|
||||
}
|
||||
else {
|
||||
Label label = new Label();
|
||||
|
||||
label.setText("Für diesen Tag sind keine Gerichte eingetragen");
|
||||
tagesplan.add(label, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
tagesplan.getStyleClass().add("essensuebersicht_gridlines");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -3,4 +3,7 @@ package de.subway_surfers.vpr_app;
|
||||
import javafx.scene.control.Button;
|
||||
|
||||
public class LoginView {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,26 +1,43 @@
|
||||
package de.subway_surfers.vpr_app;
|
||||
|
||||
import RestAPISchnittstelle.RestApiClient;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class VerwaltungController {
|
||||
|
||||
@FXML
|
||||
public PasswordField passwortTextfield;
|
||||
@FXML
|
||||
public TextField benutzernameTextfield;
|
||||
|
||||
public void initialize(){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wird der Abmeldenbutton geklickt, wird der Nutzer angemeldet.
|
||||
* Wird der Anmeldenbutton geklickt, wird der Nutzer angemeldet.
|
||||
*/
|
||||
public void onAnmeldenClick(ActionEvent actionEvent) {
|
||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||
RestApiClient client = new RestApiClient();
|
||||
|
||||
String credentials = String.format("{\"Benutzername\" : \"%s\", \"passwort\" : \"%s\"}", benutzernameTextfield.getText(), passwortTextfield.getText());
|
||||
if(client.anmeldeVersuch(credentials))
|
||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||
else {
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setContentText("Falsche Anmeldedaten");
|
||||
alert.setHeaderText("Fehler!");
|
||||
alert.showAndWait();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user