Compare commits
No commits in common. "master" and "samu_masken" have entirely different histories.
master
...
samu_maske
@ -1 +1 @@
|
|||||||
Essensverwaltung.java
|
HelloController.java
|
Binary file not shown.
20
pom.xml
20
pom.xml
@ -76,26 +76,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<transformers>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
||||||
<mainClass>de.subway_surfers.vpr_app.Main</mainClass>
|
|
||||||
</transformer>
|
|
||||||
</transformers>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
@ -5,10 +5,6 @@ package Logik;
|
|||||||
|
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
import RestAPISchnittstelle.RestApiClient;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sven Alteköster und Samuel Wolff
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Account {
|
public class Account {
|
||||||
|
|
||||||
// region Felder
|
// region Felder
|
||||||
|
@ -9,9 +9,6 @@ package Logik;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
|
||||||
public class ElternAccount extends Account {
|
public class ElternAccount extends Account {
|
||||||
|
|
||||||
// region Felder
|
// region Felder
|
||||||
@ -40,7 +37,6 @@ public class ElternAccount extends Account {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lädt eine Rechnung herunter
|
* Lädt eine Rechnung herunter
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void rechnungHerunterladen() {
|
public void rechnungHerunterladen() {
|
||||||
|
|
||||||
@ -48,7 +44,6 @@ public class ElternAccount extends Account {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bestellt eine Mahlzeit
|
* Bestellt eine Mahlzeit
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void mahlzeitBestellen() {
|
public void mahlzeitBestellen() {
|
||||||
|
|
||||||
@ -57,7 +52,6 @@ public class ElternAccount extends Account {
|
|||||||
/**
|
/**
|
||||||
* Zeigt Rechnungen gefiltert an
|
* Zeigt Rechnungen gefiltert an
|
||||||
* @param params Die Filter Argumente
|
* @param params Die Filter Argumente
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void rechnungAnzeigen(String params) {
|
public void rechnungAnzeigen(String params) {
|
||||||
|
|
||||||
|
@ -2,9 +2,6 @@ package Logik;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Samuel Wolff und Sven Alteköster
|
|
||||||
*/
|
|
||||||
public class Kind {
|
public class Kind {
|
||||||
|
|
||||||
// region Felder
|
// region Felder
|
||||||
|
@ -2,9 +2,6 @@ package Logik;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sven Alteköster
|
|
||||||
*/
|
|
||||||
public class Mahlzeit {
|
public class Mahlzeit {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
@ -20,6 +17,22 @@ public class Mahlzeit {
|
|||||||
zutaten = new ArrayList<>();
|
zutaten = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mahlzeit (int id, String name, float preis, String beschreibung) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.preis = preis;
|
||||||
|
this.beschreibung = beschreibung;
|
||||||
|
zutaten = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@ package Logik;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
|
||||||
public class MitarbeiterAccount extends Account {
|
public class MitarbeiterAccount extends Account {
|
||||||
|
|
||||||
// region Konstrukoren
|
// region Konstrukoren
|
||||||
@ -28,12 +25,12 @@ public class MitarbeiterAccount extends Account {
|
|||||||
* @param passwort Das neue Passwort
|
* @param passwort Das neue Passwort
|
||||||
*/
|
*/
|
||||||
public void passwortZurzecksetzen(Account other, String passwort) {
|
public void passwortZurzecksetzen(Account other, String passwort) {
|
||||||
|
// Soll das so?
|
||||||
other.setPasswort(passwort);
|
other.setPasswort(passwort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bestellt eine Mahlzeit
|
* Bestellt eine Mahlzeit
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void mahlzeitBestellen() {
|
public void mahlzeitBestellen() {
|
||||||
|
|
||||||
@ -41,7 +38,6 @@ public class MitarbeiterAccount extends Account {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ändert einen Tagesplan
|
* Ändert einen Tagesplan
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void tagesplanAendern() {
|
public void tagesplanAendern() {
|
||||||
|
|
||||||
@ -63,24 +59,25 @@ public class MitarbeiterAccount extends Account {
|
|||||||
/**
|
/**
|
||||||
* Zeigt Rechnungen gefilter nach params an
|
* Zeigt Rechnungen gefilter nach params an
|
||||||
* @param params Die Filter Arguemente
|
* @param params Die Filter Arguemente
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void rechnungAnzeigen(String[] params) {
|
public void rechnungAnzeigen(String[] params) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO sollte hier nicht noch ein User mitgegeben werden?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weist ein Kind einem Account zu
|
* Weist ein Kind einem Account zu
|
||||||
* @param kind Das zuzuweisende Kind
|
* @param kind Das zuzuweisende Kind
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void kinderZuweisen(Kind kind) {
|
public void kinderZuweisen(Kind kind) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO hier auch?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zeigt einen Benutzer an
|
* Zeigt einen Benutzer an
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public void zeigeBenutzer() {
|
public void zeigeBenutzer() {
|
||||||
|
|
||||||
|
@ -2,9 +2,6 @@ package Logik;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sven Alteköster
|
|
||||||
*/
|
|
||||||
public class Tagesplan {
|
public class Tagesplan {
|
||||||
|
|
||||||
private ArrayList<Mahlzeit> gerichte;
|
private ArrayList<Mahlzeit> gerichte;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package Logik;
|
package Logik;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sven Alteköster
|
|
||||||
*/
|
|
||||||
public class Zutat {
|
public class Zutat {
|
||||||
private String name;
|
private String name;
|
||||||
public Zutat (String name) {
|
public Zutat (String name) {
|
||||||
@ -12,10 +9,4 @@ public class Zutat {
|
|||||||
public String getName(){
|
public String getName(){
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
package RestAPISchnittstelle;
|
package RestAPISchnittstelle;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
|
||||||
public interface IRestAPI {
|
public interface IRestAPI {
|
||||||
|
|
||||||
// region Get
|
// region Get
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package RestAPISchnittstelle;
|
package RestAPISchnittstelle;
|
||||||
|
|
||||||
import java.net.ConnectException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.http.HttpClient;
|
import java.net.http.HttpClient;
|
||||||
import java.net.http.HttpRequest;
|
import java.net.http.HttpRequest;
|
||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import Logik.ElternAccount;
|
import Logik.ElternAccount;
|
||||||
@ -14,17 +12,16 @@ import Logik.Kind;
|
|||||||
import Logik.Mahlzeit;
|
import Logik.Mahlzeit;
|
||||||
import Logik.Tagesplan;
|
import Logik.Tagesplan;
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* noch nicht getestet
|
||||||
|
* TODO FERTIG MACHEN
|
||||||
* @author Samuel Wolff
|
* @author Samuel Wolff
|
||||||
*/
|
*/
|
||||||
public class RestApiClient implements IRestAPI{
|
public class RestApiClient implements IRestAPI{
|
||||||
|
|
||||||
private final String urlBase = "https://pbg2h22awo.web.pb.bib.de/VPR_Schnittstelle/VPR_Schnittstelle/restAPI.php";
|
private final String urlBase = "https://pbg2h22awo.web.pb.bib.de/VPR_Schnittstelle/VPR_Schnittstelle/restAPI.php";
|
||||||
|
|
||||||
private final int timeout = 10;
|
|
||||||
|
|
||||||
private final HttpClient client;
|
private final HttpClient client;
|
||||||
|
|
||||||
private final Gson gson;
|
private final Gson gson;
|
||||||
@ -34,18 +31,29 @@ public class RestApiClient implements IRestAPI{
|
|||||||
gson = new Gson();
|
gson = new Gson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
|
||||||
|
RestApiClient client1 = new RestApiClient();
|
||||||
|
|
||||||
|
client1.delete("Kind", 15);
|
||||||
|
|
||||||
|
|
||||||
|
Tagesplan t = client1.getGerichteOnTag("2023-12-17");
|
||||||
|
|
||||||
|
for(Mahlzeit m : t.getGerichte())
|
||||||
|
System.out.println(m);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Get-Aufruf. Ruft alle Elemente einer Tabelle auf.
|
* Methode für einen Get-Aufruf. Ruft alle Elemente einer Tabelle auf.
|
||||||
*
|
*
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
* @param controllerName Name des aufzurufenden Controllers
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName) {
|
public String get(String controllerName) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s", urlBase, controllerName));
|
URI apiUri = URI.create(String.format("%s/%s", urlBase, controllerName));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
@ -55,17 +63,10 @@ public class RestApiClient implements IRestAPI{
|
|||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
return httpResponse.body();
|
return httpResponse.body();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -76,14 +77,12 @@ public class RestApiClient implements IRestAPI{
|
|||||||
*
|
*
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
* @param controllerName Name des aufzurufenden Controllers
|
||||||
* @param id Id der Aufzurufenden Zeile
|
* @param id Id der Aufzurufenden Zeile
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName, int id) {
|
public String get(String controllerName, int id) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase, controllerName, id));
|
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase, controllerName, id));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
@ -93,40 +92,29 @@ public class RestApiClient implements IRestAPI{
|
|||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
||||||
|
|
||||||
return httpResponse.body();
|
return httpResponse.body();
|
||||||
|
|
||||||
//System.out.println("Response Body: " + test);
|
//System.out.println("Response Body: " + test);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --DEPRECATED--
|
|
||||||
* Methode für einen Get-Aufruf. Ruft ein spezielles Element auf.
|
* Methode für einen Get-Aufruf. Ruft ein spezielles Element auf.
|
||||||
*
|
*
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
* @param controllerName Name des aufzurufenden Controllers
|
||||||
* @param id Id der Aufzurufenden Zeile
|
* @param id Id der Aufzurufenden Zeile
|
||||||
* @param bezahlt TODO Warum ist das hier?
|
* @param bezahlt TODO Warum ist das hier?
|
||||||
* @deprecated
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName, int id, boolean bezahlt) {
|
public String get(String controllerName, int id, boolean bezahlt) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s?%s&%s", urlBase, controllerName, id, bezahlt));
|
URI apiUri = URI.create(String.format("%s/%s?%s&%s", urlBase, controllerName, id, bezahlt));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
@ -136,29 +124,15 @@ public class RestApiClient implements IRestAPI{
|
|||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
return httpResponse.body();
|
return httpResponse.body();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* Ein gefilterter Get Aufruf
|
|
||||||
* @param controllerName
|
|
||||||
* @param params
|
|
||||||
* @return
|
|
||||||
* @author Sven Alteköster
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName, String[] params) {
|
public String get(String controllerName, String[] params) {
|
||||||
String ende = "";
|
String ende = "";
|
||||||
@ -169,7 +143,6 @@ public class RestApiClient implements IRestAPI{
|
|||||||
URI apiUri = URI.create(String.format("%s/%s?%s", urlBase, controllerName, ende));
|
URI apiUri = URI.create(String.format("%s/%s?%s", urlBase, controllerName, ende));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
@ -178,20 +151,13 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
||||||
|
|
||||||
return httpResponse.body();
|
return httpResponse.body();
|
||||||
|
|
||||||
//System.out.println("Response Body: " + test);
|
//System.out.println("Response Body: " + test);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -203,7 +169,6 @@ public class RestApiClient implements IRestAPI{
|
|||||||
* @param controllerName Name des aufzurufenden Controllers.
|
* @param controllerName Name des aufzurufenden Controllers.
|
||||||
* @param id Id des zu änderenden Eintrags.
|
* @param id Id des zu änderenden Eintrags.
|
||||||
* @param jsonData JsonString mit den neuen Daten.
|
* @param jsonData JsonString mit den neuen Daten.
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void put(String controllerName, int id, String jsonData) {
|
public void put(String controllerName, int id, String jsonData) {
|
||||||
@ -211,7 +176,6 @@ public class RestApiClient implements IRestAPI{
|
|||||||
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase,controllerName, id));
|
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase,controllerName, id));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.PUT(HttpRequest.BodyPublishers.ofString(jsonData, StandardCharsets.UTF_8))
|
.PUT(HttpRequest.BodyPublishers.ofString(jsonData, StandardCharsets.UTF_8))
|
||||||
@ -221,16 +185,10 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,16 +198,14 @@ public class RestApiClient implements IRestAPI{
|
|||||||
*
|
*
|
||||||
* @param controllerName Name des aufzurufenden Controllers.
|
* @param controllerName Name des aufzurufenden Controllers.
|
||||||
* @param jsonData JsonString mit den Daten des Eintrags.
|
* @param jsonData JsonString mit den Daten des Eintrags.
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void post(String controllerName, String jsonData) {
|
public void post(String controllerName, String jsonData) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s", urlBase,controllerName));
|
URI apiUri = URI.create(String.format("%s/%s", urlBase,controllerName));
|
||||||
|
|
||||||
//System.out.println(apiUri);
|
System.out.println(apiUri);
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(jsonData, StandardCharsets.UTF_8))
|
.POST(HttpRequest.BodyPublishers.ofString(jsonData, StandardCharsets.UTF_8))
|
||||||
@ -259,16 +215,10 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,16 +228,14 @@ public class RestApiClient implements IRestAPI{
|
|||||||
*
|
*
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
* @param controllerName Name des aufzurufenden Controllers
|
||||||
* @param id Id des zu löschenden Eintrags.
|
* @param id Id des zu löschenden Eintrags.
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(String controllerName, int id) {
|
public void delete(String controllerName, int id) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s/%d", urlBase,controllerName, id));
|
URI apiUri = URI.create(String.format("%s/%s/%d", urlBase,controllerName, id));
|
||||||
|
|
||||||
//System.out.println(apiUri);
|
System.out.println(apiUri);
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.DELETE()
|
.DELETE()
|
||||||
@ -297,31 +245,18 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* Holt die nöchste Autoinkrement Id für den mitgegebenen Controller aus der Datenbank
|
|
||||||
* @param controllerName
|
|
||||||
* @return
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
|
||||||
public int nextId(String controllerName){
|
public int nextId(String controllerName){
|
||||||
URI apiUri = URI.create(String.format("%s/%s/nextId", urlBase, controllerName));
|
URI apiUri = URI.create(String.format("%s/%s/nextId", urlBase, controllerName));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
@ -330,9 +265,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
|
|
||||||
JsonElement jsonElement = JsonParser.parseString(httpResponse.body());
|
JsonElement jsonElement = JsonParser.parseString(httpResponse.body());
|
||||||
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
||||||
@ -341,14 +276,7 @@ public class RestApiClient implements IRestAPI{
|
|||||||
|
|
||||||
return json.get("auto_increment").getAsInt();
|
return json.get("auto_increment").getAsInt();
|
||||||
|
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -359,7 +287,6 @@ public class RestApiClient implements IRestAPI{
|
|||||||
*
|
*
|
||||||
* @param credentials Die Anmeldedaten in Json-String form
|
* @param credentials Die Anmeldedaten in Json-String form
|
||||||
* @return True oder false, je nach Erfolg des Anmeldeversuchs
|
* @return True oder false, je nach Erfolg des Anmeldeversuchs
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
public boolean anmeldeVersuch(String credentials){
|
public boolean anmeldeVersuch(String credentials){
|
||||||
|
|
||||||
@ -371,9 +298,8 @@ public class RestApiClient implements IRestAPI{
|
|||||||
passwort = passwort.substring(1, passwort.length()-1);
|
passwort = passwort.substring(1, passwort.length()-1);
|
||||||
|
|
||||||
URI apiUri = URI.create(String.format("%s/Benutzer/anmeldeVersuch?Benutzername=%s&passwort=%s", urlBase, benutzer, passwort));
|
URI apiUri = URI.create(String.format("%s/Benutzer/anmeldeVersuch?Benutzername=%s&passwort=%s", urlBase, benutzer, passwort));
|
||||||
//System.out.println(apiUri);
|
System.out.println(apiUri);
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.GET()
|
.GET()
|
||||||
@ -383,30 +309,15 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
if(httpResponse.body().equals("true"))
|
if(httpResponse.body().equals("true"))
|
||||||
return true;
|
return true;
|
||||||
else{
|
else
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Falsche Anmeldedaten");
|
|
||||||
alert.setHeaderText("Fehler!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception e) {
|
||||||
}
|
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Ein Uwuwarteter Fehler ist aufgetreten!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,14 +327,12 @@ public class RestApiClient implements IRestAPI{
|
|||||||
*
|
*
|
||||||
* @param datum Das angeforderte Datum in String Form (YYYY-MM-DD)
|
* @param datum Das angeforderte Datum in String Form (YYYY-MM-DD)
|
||||||
* @return Ein Tagesplan Objekt mit allen Gerichten
|
* @return Ein Tagesplan Objekt mit allen Gerichten
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
public Tagesplan getGerichteOnTag(String datum){
|
public Tagesplan getGerichteOnTag(String datum){
|
||||||
|
|
||||||
URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichteOnTag?datum=%s", urlBase, datum));
|
URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichteOnTag?datum=%s", urlBase, datum));
|
||||||
//System.out.println(apiUri);
|
System.out.println(apiUri);
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.timeout(Duration.ofSeconds(timeout))
|
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.GET()
|
.GET()
|
||||||
@ -433,9 +342,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
|
|
||||||
Tagesplan t = new Tagesplan(datum);
|
Tagesplan t = new Tagesplan(datum);
|
||||||
|
|
||||||
@ -456,30 +365,16 @@ public class RestApiClient implements IRestAPI{
|
|||||||
|
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(ConnectException conex){
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setContentText("Verbindung zum Server konnte nicht aufgebaut werden!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Holt die Id des Gerichtes mit dem mitgegebenen Namen an einem mitgegebenen Tag und gibt sie zurück
|
|
||||||
* @param name
|
|
||||||
* @param datum
|
|
||||||
* @return
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
|
||||||
public int getGerichtIdOnTag(String name, String datum){
|
public int getGerichtIdOnTag(String name, String datum){
|
||||||
|
|
||||||
URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichtIdOnTag?name=%s&datum=%s", urlBase, name, datum));
|
URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichtIdOnTag?name=%s&datum=%s", urlBase, name, datum));
|
||||||
//System.out.println(apiUri);
|
System.out.println(apiUri);
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
@ -490,9 +385,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
|
|
||||||
JsonElement jsonElement = JsonParser.parseString(httpResponse.body());
|
JsonElement jsonElement = JsonParser.parseString(httpResponse.body());
|
||||||
|
|
||||||
@ -508,14 +403,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Löscht ein Gericht mit der mitgebenen Id aus der Datenbank
|
|
||||||
* @param id
|
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
|
||||||
public void deleteGericht(int id){
|
public void deleteGericht(int id){
|
||||||
URI apiUri = URI.create(String.format("%s/Tagesplan/%d", urlBase, id));
|
URI apiUri = URI.create(String.format("%s/Tagesplan/%d", urlBase, id));
|
||||||
//System.out.println(apiUri);
|
System.out.println(apiUri);
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
.uri(apiUri)
|
.uri(apiUri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
@ -526,9 +416,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// // Print the response status code and body
|
// Print the response status code and body
|
||||||
// System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
// System.out.println("Delete Gericht: Response Body: " + httpResponse.body());
|
System.out.println("Delete Gericht: Response Body: " + httpResponse.body());
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -35,10 +35,6 @@ public class AccounterstellungMitarbeiter {
|
|||||||
|
|
||||||
private ArrayList<Kind> kinder;
|
private ArrayList<Kind> kinder;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialisiert die Accounterstellungsmaske
|
|
||||||
* @author Sven Alteköster
|
|
||||||
*/
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
//Die Radiobuttons zum auswählen eines Accountypes werden einer ToggleGroup hinzugefügt
|
//Die Radiobuttons zum auswählen eines Accountypes werden einer ToggleGroup hinzugefügt
|
||||||
accountTyp = new ToggleGroup();
|
accountTyp = new ToggleGroup();
|
||||||
@ -47,7 +43,6 @@ public class AccounterstellungMitarbeiter {
|
|||||||
|
|
||||||
einmalpw.setText(einmalPwGenerieren());
|
einmalpw.setText(einmalPwGenerieren());
|
||||||
|
|
||||||
//kinder wird initialisiert
|
|
||||||
kinder = new ArrayList<>();
|
kinder = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +62,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
* @author Sven Alteköster
|
* @author Sven Alteköster
|
||||||
*/
|
*/
|
||||||
public void onAbmelden(ActionEvent actionEvent) {
|
public void onAbmelden(ActionEvent actionEvent) {
|
||||||
VerwaltungApplication.abmelden();
|
//VerwaltungApplication.abmelden();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,10 +190,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
*/
|
*/
|
||||||
public void onSpeichern(ActionEvent actionEvent) {
|
public void onSpeichern(ActionEvent actionEvent) {
|
||||||
if (eingabenGueltig()) {
|
if (eingabenGueltig()) {
|
||||||
//speichert das aktuelle Passwort zwischen
|
//Zeigt generiert ein Einmalpasswort und zeigt es an
|
||||||
String passwort = einmalpw.getText();
|
|
||||||
|
|
||||||
//generiert ein neues Einmalpasswort und zeigt es an
|
|
||||||
einmalpw.setText(einmalPwGenerieren());
|
einmalpw.setText(einmalPwGenerieren());
|
||||||
|
|
||||||
//Schnittstelle zur RestAPI
|
//Schnittstelle zur RestAPI
|
||||||
@ -221,20 +213,23 @@ public class AccounterstellungMitarbeiter {
|
|||||||
Account neuer;
|
Account neuer;
|
||||||
//Handelt es sich um einen Elternaccount, werden alle Eingegebenen Kinder erstellt.
|
//Handelt es sich um einen Elternaccount, werden alle Eingegebenen Kinder erstellt.
|
||||||
if (typEltern.isSelected()) {
|
if (typEltern.isSelected()) {
|
||||||
neuer = new ElternAccount(passwort, accountname.getText(), email.getText());
|
neuer = new ElternAccount(String.format("%d",einmalpw.getText().hashCode()), accountname.getText(), email.getText());
|
||||||
//Kinder dem neuen Account hinzufügen
|
//Kinder dem neuen Account hinzufügen
|
||||||
for (Kind k : kinder) {
|
for (Kind k : kinder) {
|
||||||
((ElternAccount)neuer).getKinder().add(k);
|
((ElternAccount)neuer).getKinder().add(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (typMitarbeiter.isSelected()) {
|
else if (typMitarbeiter.isSelected()) {
|
||||||
neuer = new MitarbeiterAccount(passwort, accountname.getText(), email.getText());
|
neuer = new MitarbeiterAccount(String.format("%d",einmalpw.getText().hashCode()), accountname.getText(), email.getText());
|
||||||
}
|
}
|
||||||
//Ist kein Radio Button ausgewählt, wird hier abgebrochen
|
//Ist kein Radio Button ausgewählt, wird hier abgebrochen
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Die Liste, zum Speichern der gespeicherten Liste wird zurückgesetzt, da die Kinder jetzt im Elternobjekt gespeichert werden
|
||||||
|
kinder.clear();
|
||||||
|
|
||||||
//Das Elternelement wird in der DB gespeichert, wenn es keinen gleichnamigen Account gibt.
|
//Das Elternelement wird in der DB gespeichert, wenn es keinen gleichnamigen Account gibt.
|
||||||
if (!kontoVorhanden) {
|
if (!kontoVorhanden) {
|
||||||
api.post("Benutzer", gson.toJson(neuer));
|
api.post("Benutzer", gson.toJson(neuer));
|
||||||
@ -246,19 +241,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
for (Kind k : ((ElternAccount)neuer).getKinder()) {
|
for (Kind k : ((ElternAccount)neuer).getKinder()) {
|
||||||
//setzen des Fremdschlüssels bid
|
//setzen des Fremdschlüssels bid
|
||||||
k.setBid(id);
|
k.setBid(id);
|
||||||
String neues = gson.toJson(k);
|
api.post("Kind", gson.toJson(k));
|
||||||
|
|
||||||
//region hässlich
|
|
||||||
neues = neues.replaceAll("ä", "ae");
|
|
||||||
neues = neues.replaceAll("ö", "oe");
|
|
||||||
neues = neues.replaceAll("ü", "ue");
|
|
||||||
neues = neues.replaceAll("Ä", "Ae");
|
|
||||||
neues = neues.replaceAll("Ö", "Oe");
|
|
||||||
neues = neues.replaceAll("Ü", "Ue");
|
|
||||||
neues = neues.replaceAll("ß", "ss");
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
api.post("Kind", neues);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status.setText("Daten Erfolgreich gespeichert");
|
status.setText("Daten Erfolgreich gespeichert");
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
import RestAPISchnittstelle.IRestAPI;
|
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.scene.control.Accordion;
|
import javafx.scene.control.Accordion;
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.control.TitledPane;
|
import javafx.scene.control.TitledPane;
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -23,25 +18,18 @@ public class BestelluebersichtMitarbeiter {
|
|||||||
@FXML
|
@FXML
|
||||||
private Accordion accordion;
|
private Accordion accordion;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialisiert die Bestellübersicht durch Erstellung eines Accordion mit TitledPanes für verschiedene Datumsangaben.
|
|
||||||
* Geschrieben von: Stefan Groß
|
|
||||||
*/
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
List<String> datum = new ArrayList<>();
|
List<String> datum = new ArrayList<>();
|
||||||
|
|
||||||
//Placeholder für richtige Daten
|
datum.add("15.10.1999");
|
||||||
datum.add("15.10.2023");
|
datum.add("23.12.2002");
|
||||||
datum.add("23.12.2023");
|
datum.add("05.01.2020");
|
||||||
datum.add("05.01.2024");
|
|
||||||
|
|
||||||
accordion.setStyle("-fx-box-border: transparent;");
|
accordion.setStyle("-fx-box-border: transparent;");
|
||||||
|
|
||||||
for (String i : datum) {
|
for (String s : datum) {
|
||||||
Accordion gerichtAkkordion = createGerichtAkkordion();
|
TitledPane datumUeberschrift = new TitledPane(s, createGerichtAkkordion());
|
||||||
|
|
||||||
TitledPane datumUeberschrift = new TitledPane(i, gerichtAkkordion);
|
|
||||||
|
|
||||||
datumUeberschrift.getStyleClass().add("titledPaneUeberschrift");
|
datumUeberschrift.getStyleClass().add("titledPaneUeberschrift");
|
||||||
datumUeberschrift.animatedProperty().set(false);
|
datumUeberschrift.animatedProperty().set(false);
|
||||||
@ -54,31 +42,35 @@ public class BestelluebersichtMitarbeiter {
|
|||||||
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
|
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private Accordion createGerichtAkkordion() {
|
||||||
* Erstellt ein Accordion mit TitledPanes für die Bestellübersicht der Gerichte und Nachtische.
|
|
||||||
* Geschrieben von: Stefan Groß
|
|
||||||
*/
|
|
||||||
|
|
||||||
public Accordion createGerichtAkkordion() {
|
|
||||||
Accordion accordion = new Accordion();
|
Accordion accordion = new Accordion();
|
||||||
|
int anzahlGerichtA = 1;
|
||||||
//Placeholder für richtige Daten
|
|
||||||
int anzahlGerichtB = 15;
|
int anzahlGerichtB = 15;
|
||||||
int anzahlGerichtC = 3;
|
int anzahlGerichtC = 3;
|
||||||
|
int anzahlGerichtD = 2;
|
||||||
|
|
||||||
double preisGerichtB = 4.99;
|
double preisGerichtA = 4.99;
|
||||||
double preisGerichtC = 9.99;
|
double preisGerichtB = 9.99;
|
||||||
|
double preisGerichtC = 3.99;
|
||||||
|
double preisGerichtD = 12.49;
|
||||||
|
|
||||||
int anzahlNachtischA = 2;
|
int anzahlNachtischA = 2;
|
||||||
|
int anzahlNachtischB = 213;
|
||||||
|
|
||||||
double preisNachtischA = 0.49;
|
double preisNachtischA = 0.49;
|
||||||
|
double preisNachtischB = 99.49;
|
||||||
|
|
||||||
|
|
||||||
|
if (anzahlGerichtA >= 1) {
|
||||||
|
TitledPane tp = new TitledPane();
|
||||||
|
tp.setText("GerichtA " + anzahlGerichtA + "-Mal " + preisGerichtA * anzahlGerichtA + " €");
|
||||||
|
accordion.getPanes().addAll(tp);
|
||||||
|
}
|
||||||
|
|
||||||
if (anzahlGerichtB >= 1) {
|
if (anzahlGerichtB >= 1) {
|
||||||
TitledPane tp = new TitledPane();
|
TitledPane tp = new TitledPane();
|
||||||
tp.setText("GerichtB " + anzahlGerichtB + "-Mal " + preisGerichtB * anzahlGerichtB + " €");
|
tp.setText("GerichtB " + anzahlGerichtB + "-Mal " + preisGerichtB * anzahlGerichtB + " €");
|
||||||
accordion.getPanes().addAll(tp);
|
accordion.getPanes().addAll(tp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anzahlGerichtC >= 1) {
|
if (anzahlGerichtC >= 1) {
|
||||||
@ -87,27 +79,27 @@ public class BestelluebersichtMitarbeiter {
|
|||||||
accordion.getPanes().addAll(tp);
|
accordion.getPanes().addAll(tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anzahlNachtischA >= 1) {
|
if (anzahlGerichtD >= 1) {
|
||||||
|
TitledPane tp = new TitledPane();
|
||||||
|
tp.setText("GerichtD " + anzahlGerichtD + "-Mal " + preisGerichtD * anzahlGerichtD + " €");
|
||||||
|
accordion.getPanes().addAll(tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(anzahlNachtischA >= 1){
|
||||||
TitledPane tp = new TitledPane();
|
TitledPane tp = new TitledPane();
|
||||||
tp.setText("NachtischA " + anzahlNachtischA + "-Mal " + preisNachtischA * anzahlNachtischA + " €");
|
tp.setText("NachtischA " + anzahlNachtischA + "-Mal " + preisNachtischA * anzahlNachtischA + " €");
|
||||||
accordion.getPanes().addAll(tp);
|
accordion.getPanes().addAll(tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anzahlNachtischA >= 1) {
|
if(anzahlNachtischA >= 1){
|
||||||
|
TitledPane tp = new TitledPane();
|
||||||
Label label2 = new Label("Beispiel Eltern bestellen \"essen\" für Kind: Anja Arbeitslos");
|
tp.setText("NachtischB " + anzahlNachtischB + "-Mal " + preisNachtischB * anzahlNachtischB + " €");
|
||||||
|
|
||||||
VBox vbox = new VBox(label2);
|
|
||||||
vbox.setAlignment(Pos.CENTER_LEFT);
|
|
||||||
|
|
||||||
TitledPane tp = new TitledPane("NachtischB " + "-Mal " + preisNachtischA * anzahlGerichtB + " €", vbox);
|
|
||||||
|
|
||||||
accordion.getPanes().addAll(tp);
|
accordion.getPanes().addAll(tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return accordion;
|
return accordion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onAbmelden(ActionEvent event) {
|
public void onAbmelden(ActionEvent event) {
|
||||||
VerwaltungApplication.abmelden();
|
VerwaltungApplication.abmelden();
|
||||||
}
|
}
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
|
|
||||||
public class ErsteLoginViewController {
|
|
||||||
@FXML
|
|
||||||
private Label text;
|
|
||||||
@FXML
|
|
||||||
private TextField passwort;
|
|
||||||
@FXML
|
|
||||||
private TextField bpasswort;
|
|
||||||
@FXML
|
|
||||||
private Label fehlertext;
|
|
||||||
private String benutzername;
|
|
||||||
public void initialize(){
|
|
||||||
benutzername = "Test";
|
|
||||||
text.setText("Willkommen, "+benutzername+"\n\nUm Sie und Ihre Kinder zu schützen, bitten wir Sie darum Ihr Einmalpasswort zu ändern.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onAbmelden(ActionEvent actionEvent) {
|
|
||||||
VerwaltungApplication.abmelden();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onbestaetigen(ActionEvent actionEvent) {
|
|
||||||
if(passwort.getText().equals(bpasswort.getText())){
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
fehlertext.setText("Die Eingaben müssen identisch sein");
|
|
||||||
fehlertext.setTextFill(Color.color(1, 0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
|
|
||||||
public class EssensverwaltungElternController {
|
|
||||||
|
|
||||||
public void onFilter(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
public void pfeilLinks(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
public void pfeilRechts(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
public void onAbmelden(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
public void onZurueck(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
}
|
|
@ -92,10 +92,10 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
//solange das neu geöffnete Fenster offen ist, wird das Hauptfenster gesperrt
|
//solange das neu geöffnete Fenster offen ist, wird das Hauptfenster gesperrt
|
||||||
gerichterstellung.initModality(Modality.APPLICATION_MODAL);
|
gerichterstellung.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
|
||||||
VerwaltungApplication.sceneWechseln(gerichterstellung, 500, 700, "gerichterstellung_mitarbeiter-view.fxml");
|
VerwaltungApplication.sceneWechseln(gerichterstellung, 400, 530, "gerichterstellung_mitarbeiter-view.fxml");
|
||||||
|
|
||||||
gerichterstellung.minWidthProperty().set(500);
|
gerichterstellung.minWidthProperty().set(400);
|
||||||
gerichterstellung.minHeightProperty().set(700);
|
gerichterstellung.minHeightProperty().set(530);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,7 +193,6 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisiert das responsive grid.
|
* Initialisiert das responsive grid.
|
||||||
* @author Max Heer, Sven Alteköster
|
|
||||||
*/
|
*/
|
||||||
public void initGrid(){
|
public void initGrid(){
|
||||||
for (int i = 0; i < tagesplan.getColumnCount(); i++) {
|
for (int i = 0; i < tagesplan.getColumnCount(); i++) {
|
||||||
@ -218,7 +217,6 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
/**
|
/**
|
||||||
* Methode beim klicken auf den Löschen Button eines Tagesplan Elementes
|
* Methode beim klicken auf den Löschen Button eines Tagesplan Elementes
|
||||||
* @param a
|
* @param a
|
||||||
* @author Samuel Wolff
|
|
||||||
*/
|
*/
|
||||||
private void loeschenButtonKlick(ActionEvent a){
|
private void loeschenButtonKlick(ActionEvent a){
|
||||||
Button btn = (Button) a.getSource();
|
Button btn = (Button) a.getSource();
|
||||||
@ -231,7 +229,7 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
|
|
||||||
t.getGerichte().remove(col);
|
t.getGerichte().remove(col);
|
||||||
|
|
||||||
//System.out.println("Die Id lautet: " + id + col);
|
System.out.println("Die Id lautet: " + id + col);
|
||||||
|
|
||||||
cl.delete("GibtsAm", id);
|
cl.delete("GibtsAm", id);
|
||||||
initGerichte();
|
initGerichte();
|
||||||
|
@ -1,398 +1,51 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
import Logik.Mahlzeit;
|
|
||||||
import Logik.Zutat;
|
import Logik.Zutat;
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
import javafx.event.ActionEvent;
|
||||||
import com.google.gson.*;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class GerichterstellungMitarbeiterView {
|
public class GerichterstellungMitarbeiterView {
|
||||||
|
private @FXML HBox anzeigeInhaltsstoffe;
|
||||||
|
private @FXML TextArea eingabeBeschreibung;
|
||||||
|
private @FXML TextField eingabeName;
|
||||||
|
private @FXML Button buttonInhaltsstoffe;
|
||||||
|
private @FXML TextField eingabeInhaltsstoffe;
|
||||||
|
|
||||||
private @FXML HBox anzeigeInhaltsstoffe;
|
private ArrayList<Zutat> zutaten;
|
||||||
private @FXML TextArea eingabeBeschreibung;
|
|
||||||
private @FXML TextField eingabeName;
|
|
||||||
private @FXML Button buttonInhaltsstoffe;
|
|
||||||
private @FXML TextField eingabeInhaltsstoffe;
|
|
||||||
private @FXML TextField eingabePreis;
|
|
||||||
private @FXML DatePicker datePicker;
|
|
||||||
private @FXML ListView<String> listViewVorschlag;
|
|
||||||
private @FXML Label status;
|
|
||||||
|
|
||||||
private ArrayList<Zutat> zutaten;
|
public void initialize() {
|
||||||
private ArrayList<Mahlzeit> mahlzeiten;
|
zutaten = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
//wird das Fenster vergrößert, wird das Eingabefeld für Inhaltstoffe und den Hinzufügenbutton
|
||||||
* Füllt die Listview mit Vorschlägen und enthält den Eventlistener für das Textfeld
|
// auf die volle breite vergrößert.
|
||||||
* Ist außerdem für die Skalierung der Buttons vom Inhaltsstoff zuständig
|
((Pane) eingabeInhaltsstoffe.getParent()).widthProperty().addListener((obs, oldValue, newValue) -> {
|
||||||
* Geschrieben: Sven Alteköster, Stefan Groß
|
//eingabeName, da dieses Feld immer die gesamte breite der Stage haben.
|
||||||
*
|
eingabeInhaltsstoffe.setPrefWidth(eingabeName.getWidth() - buttonInhaltsstoffe.getPrefWidth());
|
||||||
*/
|
});
|
||||||
public void initialize() {
|
}
|
||||||
zutaten = new ArrayList<>();
|
|
||||||
mahlzeiten = new ArrayList<>();
|
|
||||||
datePicker.setEditable(false);
|
|
||||||
//Liste mit Daten füllen
|
|
||||||
mahlzeiten = getMahlzeiten();
|
|
||||||
for (Mahlzeit m : mahlzeiten) {
|
|
||||||
listViewVorschlag.getItems().add(m.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
//Eventlistener für die Eingabe des Textfelds
|
public void onButtonInhaltsstoffeClick(ActionEvent actionEvent) {
|
||||||
eingabeName.textProperty().addListener((obs, oldValue, newValue) -> {
|
String text = eingabeInhaltsstoffe.getText();
|
||||||
aktualisiereListView(newValue);
|
if (!text.equals("")) {
|
||||||
});
|
eingabeInhaltsstoffe.setText("");
|
||||||
|
|
||||||
//Wenn ein Eintrag in der Listeview 2x angeklickt wird, werden die entsprechenden Felder mit
|
Button neuerInhalt = new Button();
|
||||||
//den Daten des Gerichts eingefügt
|
neuerInhalt.setText(text);
|
||||||
listViewVorschlag.setOnMouseClicked(event -> {
|
anzeigeInhaltsstoffe.getChildren().add(neuerInhalt);
|
||||||
if (event.getClickCount() == 2) {
|
|
||||||
String ausgewaehlterName = listViewVorschlag.getSelectionModel().getSelectedItem();
|
|
||||||
if (ausgewaehlterName != null) {
|
|
||||||
for (Mahlzeit m : mahlzeiten) {
|
|
||||||
if (m.getName().equals(ausgewaehlterName)) {
|
|
||||||
eingabeName.setText(m.getName());
|
|
||||||
eingabePreis.setText(String.valueOf(m.getPreis()));
|
|
||||||
eingabeBeschreibung.setText(m.getBeschreibung());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//wird das Fenster vergrößert, wird das Eingabefeld für Inhaltstoffe und den Hinzufügenbutton
|
|
||||||
// auf die volle breite vergrößert.
|
|
||||||
((Pane) eingabeInhaltsstoffe.getParent()).widthProperty().addListener((obs, oldValue, newValue) -> {
|
|
||||||
//eingabeName, da dieses Feld immer die gesamte breite der Stage haben.
|
|
||||||
eingabeInhaltsstoffe.setPrefWidth(eingabeName.getWidth() - buttonInhaltsstoffe.getPrefWidth());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Holt Mahlzeiten von der API für die ListView.
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
* @return Liste von Mahlzeiten
|
|
||||||
*/
|
|
||||||
public ArrayList<Mahlzeit> getMahlzeiten() {
|
|
||||||
ArrayList<Mahlzeit> mahlzeitenListe = new ArrayList<>();
|
|
||||||
RestApiClient restApiClient = new RestApiClient();
|
|
||||||
JsonElement je = JsonParser.parseString(restApiClient.get("Gericht"));
|
|
||||||
JsonArray js = je.getAsJsonArray();
|
|
||||||
|
|
||||||
for (JsonElement element : js) {
|
|
||||||
JsonObject mahlzeitJson = element.getAsJsonObject();
|
|
||||||
String name = mahlzeitJson.get("name").getAsString();
|
|
||||||
float preis = mahlzeitJson.get("preis").getAsFloat();
|
|
||||||
String beschreibung = mahlzeitJson.get("beschreibung").getAsString();
|
|
||||||
Mahlzeit mahlzeit = new Mahlzeit(name, preis, beschreibung);
|
|
||||||
mahlzeitenListe.add(mahlzeit);
|
|
||||||
}
|
|
||||||
return mahlzeitenListe;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aktualisiert die ListView je nach Eingabe in das eingabeName-Feld
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
* Getestet:
|
|
||||||
*
|
|
||||||
* @param eingabeGerichtFilter "Suchtext" für die Gerichte
|
|
||||||
*/
|
|
||||||
public void aktualisiereListView(String eingabeGerichtFilter) {
|
|
||||||
listViewVorschlag.getItems().clear();
|
|
||||||
|
|
||||||
if (eingabeGerichtFilter == null || eingabeGerichtFilter.isEmpty()) {
|
|
||||||
for (Mahlzeit m : mahlzeiten) {
|
|
||||||
listViewVorschlag.getItems().add(m.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (Mahlzeit m : mahlzeiten) {
|
|
||||||
if (m.getName().toLowerCase().contains(eingabeGerichtFilter.toLowerCase())) {
|
|
||||||
listViewVorschlag.getItems().add(m.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void onButtonInhaltsstoffeClick() {
|
|
||||||
String text = eingabeInhaltsstoffe.getText();
|
|
||||||
if (!text.isEmpty()) {
|
|
||||||
eingabeInhaltsstoffe.setText("");
|
|
||||||
|
|
||||||
Button neuerInhalt = new Button();
|
|
||||||
neuerInhalt.setText(text);
|
|
||||||
anzeigeInhaltsstoffe.getChildren().add(neuerInhalt);
|
|
||||||
|
|
||||||
Zutat neue = new Zutat(text);
|
|
||||||
zutaten.add(neue);
|
|
||||||
neuerInhalt.setOnAction(e -> {
|
|
||||||
((HBox) neuerInhalt.getParent()).getChildren().remove(neuerInhalt);
|
|
||||||
zutaten.remove(neue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bei klick auf den Speichernbutton wird die Eingabe überprüft
|
|
||||||
* es werden gegebenenfalls Fehlermeldungen angezeigt und es werden Mahlzeiten bei gültigen Eingaben gespeichert
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*/
|
|
||||||
public void onSpeichernButtonClick() {
|
|
||||||
String eingabe = eingabeName.getText();
|
|
||||||
String beschreibung = eingabeBeschreibung.getText();
|
|
||||||
StringBuilder fehlerMeldungen = new StringBuilder();
|
|
||||||
boolean istGueltig = true;
|
|
||||||
float preis = 0;
|
|
||||||
|
|
||||||
resetFehlerrahmen();
|
|
||||||
|
|
||||||
if (eingabe.isEmpty()) {
|
|
||||||
eingabeName.setStyle("-fx-text-box-border: #B22222; -fx-focus-color: #B22222;");
|
|
||||||
fehlerMeldungen.append("Name eingeben. ");
|
|
||||||
istGueltig = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (beschreibung.isEmpty()) {
|
|
||||||
eingabeBeschreibung.setStyle("-fx-text-box-border: #B22222; -fx-focus-color: #B22222;");
|
|
||||||
fehlerMeldungen.append("Beschreibung eingeben. ");
|
|
||||||
istGueltig = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
preis = Float.parseFloat(eingabePreis.getText());
|
|
||||||
}
|
|
||||||
catch (NumberFormatException e) {
|
|
||||||
eingabePreis.setStyle("-fx-text-box-border: #B22222; -fx-focus-color: #B22222;");
|
|
||||||
fehlerMeldungen.append("Preis ist ungültig. ");
|
|
||||||
istGueltig = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalDate datum = datePicker.getValue();
|
|
||||||
if (datum == null) {
|
|
||||||
datePicker.setStyle("-fx-border-color: #B22222;");
|
|
||||||
fehlerMeldungen.append("Gültiges Datum eingeben. ");
|
|
||||||
istGueltig = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zutaten.isEmpty()) {
|
|
||||||
eingabeInhaltsstoffe.setStyle("-fx-border-color: #B22222;");
|
|
||||||
fehlerMeldungen.append("Inhaltsstoffe fehlen. ");
|
|
||||||
istGueltig = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!istGueltig) {
|
|
||||||
status.setText(fehlerMeldungen.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Mahlzeit mahlzeit = new Mahlzeit(eingabe, preis, beschreibung);
|
|
||||||
mahlzeiten.add(mahlzeit);
|
|
||||||
status.setText("Mahlzeit hinzugefügt");
|
|
||||||
|
|
||||||
int datumId = datumBearbeiten(datum);
|
|
||||||
int gerichtId = gerichteAbfragen(mahlzeit);
|
|
||||||
inhaltsstoff(gerichtId);
|
|
||||||
gibtsAm(gerichtId, datumId);
|
|
||||||
mahlzeiten.clear();
|
|
||||||
mahlzeiten = getMahlzeiten();
|
|
||||||
aktualisiereListView("");
|
|
||||||
resetEingabeFelder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setzt die "Fehlerrahmen" der aller Elemente zurück
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void resetFehlerrahmen() {
|
|
||||||
eingabeName.setStyle(null);
|
|
||||||
eingabeBeschreibung.setStyle(null);
|
|
||||||
eingabePreis.setStyle(null);
|
|
||||||
eingabeInhaltsstoffe.setStyle(null);
|
|
||||||
datePicker.setStyle(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setzt alle Eingabefelder auf einen leerwert zurück
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
private void resetEingabeFelder() {
|
|
||||||
eingabeName.setText("");
|
|
||||||
eingabeBeschreibung.setText("");
|
|
||||||
eingabePreis.setText("");
|
|
||||||
eingabeInhaltsstoffe.setText("");
|
|
||||||
zutaten.clear();
|
|
||||||
anzeigeInhaltsstoffe.getChildren().clear();
|
|
||||||
datePicker.setValue(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Holt oder erstellt ein Datum mithilfe der API und gibt die ID zurück.
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
* @param datum Das eingegebene Datum
|
|
||||||
*
|
|
||||||
* @return ID des Datums
|
|
||||||
*/
|
|
||||||
private int datumBearbeiten(LocalDate datum) {
|
|
||||||
RestApiClient restApiClient = new RestApiClient();
|
|
||||||
String datumAsString = datum.toString();
|
|
||||||
|
|
||||||
JsonElement jsonElement = JsonParser.parseString(restApiClient.get("Tagesplan"));
|
|
||||||
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
|
||||||
|
|
||||||
for (JsonElement element : jsonArray) {
|
|
||||||
JsonObject obj = element.getAsJsonObject();
|
|
||||||
if (obj.get("datum").getAsString().equals(datumAsString)) {
|
|
||||||
return Integer.parseInt(obj.get("id").getAsString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
restApiClient.post("Tagesplan", "{\"datum\":\"" + datumAsString + "\"}");
|
|
||||||
|
|
||||||
jsonElement = JsonParser.parseString(restApiClient.get("Tagesplan"));
|
|
||||||
jsonArray = jsonElement.getAsJsonArray();
|
|
||||||
|
|
||||||
for (JsonElement element : jsonArray) {
|
|
||||||
JsonObject obj = element.getAsJsonObject();
|
|
||||||
if (obj.get("datum").getAsString().equals(datumAsString)) {
|
|
||||||
return Integer.parseInt(obj.get("id").getAsString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verwendet die API, um eine Beziehung in der Datenbank zwischen Gericht und Datum herzustellen.
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
* @param gid ID des Gerichts
|
|
||||||
* @param tid ID des Datums
|
|
||||||
*/
|
|
||||||
public void gibtsAm(int gid, int tid) {
|
|
||||||
RestApiClient restApiClient = new RestApiClient();
|
|
||||||
|
|
||||||
JsonObject gibtsAmJson = new JsonObject();
|
|
||||||
|
|
||||||
gibtsAmJson.addProperty("tid", tid);
|
|
||||||
gibtsAmJson.addProperty("gid", gid);
|
|
||||||
restApiClient.post("gibtsAm", gibtsAmJson.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ruft Inhaltsstoffe ab und fügt sie zu einem Gericht hinzu.
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
* @param gerichtId ID des Gerichts
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void inhaltsstoff(int gerichtId) {
|
|
||||||
RestApiClient restApiClient = new RestApiClient();
|
|
||||||
|
|
||||||
for (Zutat zutat : zutaten) {
|
|
||||||
JsonElement jE = JsonParser.parseString(restApiClient.get("Inhaltsstoff"));
|
|
||||||
JsonArray inhaltsstoffArray = jE.getAsJsonArray();
|
|
||||||
|
|
||||||
int id = -1;
|
|
||||||
|
|
||||||
// Überprüfen, ob der Inhaltsstoff bereits existiert.
|
|
||||||
// Holt Id falls er existiert
|
|
||||||
for (JsonElement element : inhaltsstoffArray) {
|
|
||||||
JsonObject inhaltsstoff = element.getAsJsonObject();
|
|
||||||
if (inhaltsstoff.get("name").getAsString().equalsIgnoreCase(zutat.getName())) {
|
|
||||||
id = inhaltsstoff.get("id").getAsInt();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fügt Inhaltsstoff hinzu, wenn er nicht existiert
|
|
||||||
if (id == -1) {
|
|
||||||
JsonObject neuerInhaltsstoff = new JsonObject();
|
|
||||||
neuerInhaltsstoff.addProperty("name", zutat.getName());
|
|
||||||
restApiClient.post("Inhaltsstoff", neuerInhaltsstoff.toString());
|
|
||||||
|
|
||||||
// Fragt Id vom neuen Inhaltsstoff ab
|
|
||||||
jE = JsonParser.parseString(restApiClient.get("Inhaltsstoff"));
|
|
||||||
inhaltsstoffArray = jE.getAsJsonArray();
|
|
||||||
JsonObject letzterInhaltsstoff = inhaltsstoffArray.get(inhaltsstoffArray.size() - 1).getAsJsonObject();
|
|
||||||
id = letzterInhaltsstoff.get("id").getAsInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stellt verknüpfung zur Enthälttabelle her
|
|
||||||
JsonObject enthaelt = new JsonObject();
|
|
||||||
enthaelt.addProperty("iid", id);
|
|
||||||
enthaelt.addProperty("gid", gerichtId);
|
|
||||||
restApiClient.post("Enthaelt", enthaelt.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prüft, ob ein Gericht bereits existiert, wenn es nicht existiert wird es hinzugefügt.
|
|
||||||
* Falls es existiert wird Preis und Beschreibung aktualisiert.
|
|
||||||
* Geschrieben: Stefan Groß
|
|
||||||
*
|
|
||||||
* @param mahlzeit Die zu überprüfende oder hinzuzufügende Mahlzeit
|
|
||||||
*
|
|
||||||
* @return ID des Gerichts
|
|
||||||
*/
|
|
||||||
|
|
||||||
private int gerichteAbfragen(Mahlzeit mahlzeit) {
|
|
||||||
RestApiClient restApiClient = new RestApiClient();
|
|
||||||
JsonElement je = JsonParser.parseString(restApiClient.get("Gericht"));
|
|
||||||
JsonArray js = je.getAsJsonArray();
|
|
||||||
|
|
||||||
for (JsonElement element : js) {
|
|
||||||
JsonObject mahlzeitJson = element.getAsJsonObject();
|
|
||||||
String nameMahlzeit = mahlzeitJson.get("name").getAsString();
|
|
||||||
|
|
||||||
if (nameMahlzeit.equals(mahlzeit.getName())) {
|
|
||||||
int id = Integer.parseInt(mahlzeitJson.get("id").getAsString());
|
|
||||||
|
|
||||||
// Update des existierenden Gerichts
|
|
||||||
JsonObject updateGericht = new JsonObject();
|
|
||||||
updateGericht.addProperty("id", id);
|
|
||||||
updateGericht.addProperty("name", mahlzeit.getName());
|
|
||||||
updateGericht.addProperty("preis", mahlzeit.getPreis());
|
|
||||||
updateGericht.addProperty("beschreibung", mahlzeit.getBeschreibung());
|
|
||||||
|
|
||||||
restApiClient.put("Gericht", id, updateGericht.toString());
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neues Gericht zur Datenbank hinzufügen, falls es nicht existiert
|
|
||||||
JsonObject neuesGericht = new JsonObject();
|
|
||||||
neuesGericht.addProperty("name", mahlzeit.getName());
|
|
||||||
neuesGericht.addProperty("preis", mahlzeit.getPreis());
|
|
||||||
neuesGericht.addProperty("beschreibung", mahlzeit.getBeschreibung());
|
|
||||||
|
|
||||||
restApiClient.post("Gericht", neuesGericht.toString());
|
|
||||||
|
|
||||||
// ID des Gerichts abrufen
|
|
||||||
je = JsonParser.parseString(restApiClient.get("Gericht"));
|
|
||||||
js = je.getAsJsonArray();
|
|
||||||
for (JsonElement element : js) {
|
|
||||||
JsonObject mahlzeitJson = element.getAsJsonObject();
|
|
||||||
if (mahlzeitJson.get("name").getAsString().equals(mahlzeit.getName())) {
|
|
||||||
return Integer.parseInt(mahlzeitJson.get("id").getAsString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Zutat neue = new Zutat(text);
|
||||||
|
zutaten.add(neue);
|
||||||
|
neuerInhalt.setOnAction(e -> {
|
||||||
|
((HBox) neuerInhalt.getParent()).getChildren().remove(neuerInhalt);
|
||||||
|
zutaten.remove(neue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,68 +0,0 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
|
||||||
|
|
||||||
import Logik.Tagesplan;
|
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.text.TextAlignment;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class HauptmenueElternController {
|
|
||||||
@FXML
|
|
||||||
private GridPane wochenplan;
|
|
||||||
private String date;
|
|
||||||
private String day;
|
|
||||||
private String month;
|
|
||||||
private String year;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ruft die Methode zum Befüllen der Ansicht auf der Hauptseite auf
|
|
||||||
* @author Max Heer
|
|
||||||
*/
|
|
||||||
public void initialize(){
|
|
||||||
wochenuebersichtFuellen();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Methode zum initialisieren und befüllen der Tabelle im Hauptmenü
|
|
||||||
* @author Max Heer
|
|
||||||
*/
|
|
||||||
public void wochenuebersichtFuellen(){
|
|
||||||
String dateanzeige;
|
|
||||||
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);
|
|
||||||
dateanzeige = String.format("%s.%s.%s",day,month,year);
|
|
||||||
Tagesplan t = new RestApiClient().getGerichteOnTag(date);
|
|
||||||
for(int i=0;i<5;i++){
|
|
||||||
Label tag = new Label();
|
|
||||||
wochenplan.add(tag, i, 0);
|
|
||||||
tag.setText(dateanzeige);
|
|
||||||
for(int j=0; j<t.getGerichte().size();j++){
|
|
||||||
Label name = new Label();
|
|
||||||
name.setWrapText(true);
|
|
||||||
wochenplan.add(name, i, j+1);
|
|
||||||
name.setText(t.getGerichte().get(j).getName());
|
|
||||||
name.setPrefHeight(75);
|
|
||||||
name.setTextAlignment(TextAlignment.CENTER);
|
|
||||||
}
|
|
||||||
day = String.valueOf(Integer.parseInt(day)+1);
|
|
||||||
date = String.format("%s-%s-%s", year, month, day);
|
|
||||||
dateanzeige = String.format("%s.%s.%s",day,month,year);
|
|
||||||
t = new RestApiClient().getGerichteOnTag(date);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void onAbmelden(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
public void onBestellungPlanen(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
public void onBestellhistorieAnzeigen(ActionEvent actionEvent) {}
|
|
||||||
|
|
||||||
}
|
|
@ -22,7 +22,7 @@ public class HauptmenueMitarbeiterView {
|
|||||||
private String year;
|
private String year;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ruft die Methode zum Befüllen der Ansicht auf der Hauptseite auf
|
* Ruft die Methode zum Befüllen der Ansicht auf
|
||||||
* @author Max Heer
|
* @author Max Heer
|
||||||
*/
|
*/
|
||||||
public void initialize(){
|
public void initialize(){
|
||||||
|
@ -7,21 +7,14 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
import Logik.Kind;
|
import Logik.Kind;
|
||||||
import Logik.Zutat;
|
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
|
||||||
import com.google.gson.*;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.control.SelectionMode;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class InhaltsstoffeFilternController {
|
public class InhaltsstoffeFilternController {
|
||||||
|
|
||||||
private @FXML ListView<Zutat> zutatListView;
|
private @FXML ListView<zutatListViewController> zutatListView;
|
||||||
|
|
||||||
private @FXML CheckBox speichernCheckBox;
|
private @FXML CheckBox speichernCheckBox;
|
||||||
|
|
||||||
@ -29,30 +22,11 @@ public class InhaltsstoffeFilternController {
|
|||||||
|
|
||||||
private @FXML Button fortfahrenButton;
|
private @FXML Button fortfahrenButton;
|
||||||
|
|
||||||
private ArrayList<Zutat> zutaten;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialisert sie InhaltsstoffeFiltern View
|
|
||||||
* @author Sven Alteköster
|
|
||||||
*/
|
|
||||||
public void initialize(){
|
public void initialize(){
|
||||||
//mehrere Inhaltsstoffe können ausgewählt werden
|
|
||||||
zutatListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
|
||||||
|
|
||||||
//Befüllen der ListView mit allen existierenden Inhaltsstoffen
|
// hier ListView füllen
|
||||||
RestApiClient api = new RestApiClient();
|
|
||||||
String json = api.get("Inhaltsstoff");
|
|
||||||
|
|
||||||
zutaten = new ArrayList<>();
|
|
||||||
Gson gson = new Gson();
|
|
||||||
|
|
||||||
JsonElement je = JsonParser.parseString(json);
|
|
||||||
JsonArray ja = je.getAsJsonArray();
|
|
||||||
for (JsonElement e : ja) {
|
|
||||||
JsonObject jo = e.getAsJsonObject();
|
|
||||||
zutaten.add(gson.fromJson(jo, Zutat.class));
|
|
||||||
}
|
|
||||||
zutatListView.setItems(FXCollections.observableArrayList(zutaten));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
VerwaltungApplication.main(args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -48,6 +48,7 @@ public class VerwaltungApplication extends Application {
|
|||||||
* Die Scene auf der aktuellen Stage wird durch die in der fxml-Datei definierte Scene ausgetauscht.
|
* Die Scene auf der aktuellen Stage wird durch die in der fxml-Datei definierte Scene ausgetauscht.
|
||||||
*
|
*
|
||||||
* Geschrieben: Sven Alteköster
|
* Geschrieben: Sven Alteköster
|
||||||
|
* Getestet:
|
||||||
*
|
*
|
||||||
* @param fxml name der zu ladenden fxml Datei.
|
* @param fxml name der zu ladenden fxml Datei.
|
||||||
*/
|
*/
|
||||||
@ -83,7 +84,9 @@ public class VerwaltungApplication extends Application {
|
|||||||
/**
|
/**
|
||||||
* in einem neuen Fenster wird die in der fxml-Datei definierte Scene gesetzt.
|
* in einem neuen Fenster wird die in der fxml-Datei definierte Scene gesetzt.
|
||||||
* Die geladene Scene wird <b><u>nicht</u></b> zu der neuen Hauptstage.
|
* Die geladene Scene wird <b><u>nicht</u></b> zu der neuen Hauptstage.
|
||||||
|
*
|
||||||
* Geschrieben: Sven Alteköster
|
* Geschrieben: Sven Alteköster
|
||||||
|
* Getestet:
|
||||||
*
|
*
|
||||||
* @param neue Stage auf der die Scene gesetzt werden soll
|
* @param neue Stage auf der die Scene gesetzt werden soll
|
||||||
* @param width breite des neuen Fensters
|
* @param width breite des neuen Fensters
|
||||||
@ -118,6 +121,7 @@ public class VerwaltungApplication extends Application {
|
|||||||
* Methode zum automatischen vergrößern und verkleinern von Grids
|
* Methode zum automatischen vergrößern und verkleinern von Grids
|
||||||
*
|
*
|
||||||
* Geschrieben: Max Heer, Sven Alteköster
|
* Geschrieben: Max Heer, Sven Alteköster
|
||||||
|
* Getestet
|
||||||
*
|
*
|
||||||
* @param grid das responsiv sein soll
|
* @param grid das responsiv sein soll
|
||||||
*/
|
*/
|
||||||
|
@ -33,5 +33,11 @@ public class VerwaltungController {
|
|||||||
String credentials = String.format("{\"Benutzername\" : \"%s\", \"passwort\" : \"%s\"}", benutzernameTextfield.getText(), passwortTextfield.getText());
|
String credentials = String.format("{\"Benutzername\" : \"%s\", \"passwort\" : \"%s\"}", benutzernameTextfield.getText(), passwortTextfield.getText());
|
||||||
if(client.anmeldeVersuch(credentials))
|
if(client.anmeldeVersuch(credentials))
|
||||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||||
|
else {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
|
alert.setContentText("Falsche Anmeldedaten");
|
||||||
|
alert.setHeaderText("Fehler!");
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
44
src/main/java/de/subway_surfers/vpr_app/logik/Kind.java
Normal file
44
src/main/java/de/subway_surfers/vpr_app/logik/Kind.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package de.subway_surfers.vpr_app.logik;
|
||||||
|
|
||||||
|
import Logik.Zutat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Kind {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String vorname;
|
||||||
|
private int id;
|
||||||
|
private ArrayList<Zutat> filter;
|
||||||
|
|
||||||
|
public Kind(String name, String vorname, int id) {
|
||||||
|
ArrayList<Zutat> filter = new ArrayList<>();
|
||||||
|
this.name = name;
|
||||||
|
this.vorname = vorname;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVorname() {
|
||||||
|
return vorname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVorname(String vorname) {
|
||||||
|
this.vorname = vorname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Zutat> getFilter() {
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
}
|
@ -6,8 +6,6 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<!-- Erstellt von Sven Alteköster -->
|
|
||||||
|
|
||||||
<BorderPane xmlns="http://javafx.com/javafx"
|
<BorderPane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="de.subway_surfers.vpr_app.AccounterstellungMitarbeiter"
|
fx:controller="de.subway_surfers.vpr_app.AccounterstellungMitarbeiter"
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<!--Erstellt von Max Heer-->
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
|
|
||||||
<BorderPane prefHeight="400.0" prefWidth="600.0" stylesheets="@layout.css" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.subway_surfers.vpr_app.ErsteLoginViewController">
|
|
||||||
<top>
|
|
||||||
<BorderPane styleClass="kopfzeile">
|
|
||||||
<right>
|
|
||||||
<Button onAction="#onAbmelden" text="Abmelden" />
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</top>
|
|
||||||
<bottom>
|
|
||||||
<BorderPane styleClass="button-untenrechts">
|
|
||||||
<right>
|
|
||||||
<Button defaultButton="true" onAction="#onbestaetigen" styleClass=".button" text="Bestätigen" />
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</bottom>
|
|
||||||
<left>
|
|
||||||
<AnchorPane BorderPane.alignment="CENTER">
|
|
||||||
<children>
|
|
||||||
<Label fx:id="text" layoutX="27.0" layoutY="34.0" text="Label" />
|
|
||||||
<Label layoutX="27.0" layoutY="127.0" text="Passwort:" />
|
|
||||||
<Label layoutX="27.0" layoutY="178.0" text="Passwort bestätigen:" />
|
|
||||||
<TextField fx:id="passwort" layoutX="175.0" layoutY="122.0" />
|
|
||||||
<TextField fx:id="bpasswort" layoutX="175.0" layoutY="173.0" />
|
|
||||||
<Label layoutX="27.0" layoutY="216.0" fx:id="fehlertext"/>
|
|
||||||
</children></AnchorPane>
|
|
||||||
</left>
|
|
||||||
</BorderPane>
|
|
@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--Erstellt von Max Heer-->
|
|
||||||
|
|
||||||
<?import java.lang.*?>
|
|
||||||
<?import java.util.*?>
|
|
||||||
<?import javafx.scene.*?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
|
|
||||||
<BorderPane xmlns="http://javafx.com/javafx"
|
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
|
||||||
fx:controller="de.subway_surfers.vpr_app.EssensverwaltungElternController"
|
|
||||||
prefHeight="400.0" prefWidth="600.0"
|
|
||||||
stylesheets="@layout.css">
|
|
||||||
<top>
|
|
||||||
<BorderPane styleClass="kopfzeile">
|
|
||||||
<right>
|
|
||||||
<Button text="Abmelden" onAction="#onAbmelden"/>
|
|
||||||
</right>
|
|
||||||
<left>
|
|
||||||
<Button text="Zurück" onAction="#onZurueck"/>
|
|
||||||
</left>
|
|
||||||
</BorderPane>
|
|
||||||
</top>
|
|
||||||
<center>
|
|
||||||
<BorderPane>
|
|
||||||
<top>
|
|
||||||
<BorderPane>
|
|
||||||
<left>
|
|
||||||
<HBox styleClass="test" spacing="10">
|
|
||||||
<Button text="Filter" onAction="#onFilter"/>
|
|
||||||
<Label text="Bestellung Planen für: "/>
|
|
||||||
<ComboBox fx:id="kindAuswahl"/>
|
|
||||||
</HBox>
|
|
||||||
</left>
|
|
||||||
<right>
|
|
||||||
<HBox styleClass="test" spacing="10">
|
|
||||||
<Button styleClass="pfeil, links" onAction="#pfeilLinks"/>
|
|
||||||
<Label fx:id="dateLabel"/>
|
|
||||||
<Button styleClass="pfeil" onAction="#pfeilRechts"/>
|
|
||||||
</HBox>
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</top>
|
|
||||||
<center>
|
|
||||||
<AnchorPane>
|
|
||||||
<GridPane fx:id="tagesplan" AnchorPane.bottomAnchor="20" AnchorPane.rightAnchor="20" AnchorPane.leftAnchor="20" AnchorPane.topAnchor="20" >
|
|
||||||
</GridPane>
|
|
||||||
</AnchorPane>
|
|
||||||
</center>
|
|
||||||
</BorderPane>
|
|
||||||
|
|
||||||
</center>
|
|
||||||
<bottom>
|
|
||||||
<BorderPane styleClass="button-untenrechts">
|
|
||||||
<right>
|
|
||||||
<Button text="Bestätigen" defaultButton="true" styleClass=".button"/>
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</bottom>
|
|
||||||
</BorderPane>
|
|
@ -1,14 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--Sven Alteköster-->
|
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import java.util.*?>
|
<?import java.util.*?>
|
||||||
<?import javafx.scene.*?>
|
<?import javafx.scene.*?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<!-- Erstellt von Sven Alteköster -->
|
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<BorderPane xmlns="http://javafx.com/javafx"
|
<BorderPane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="de.subway_surfers.vpr_app.GerichterstellungMitarbeiterView"
|
fx:controller="de.subway_surfers.vpr_app.GerichterstellungMitarbeiterView"
|
||||||
@ -17,23 +14,19 @@
|
|||||||
<center>
|
<center>
|
||||||
<VBox styleClass="gerichterstellung_felder">
|
<VBox styleClass="gerichterstellung_felder">
|
||||||
<TextField fx:id="eingabeName" promptText="Name des Gerichtes" focusTraversable="false"/>
|
<TextField fx:id="eingabeName" promptText="Name des Gerichtes" focusTraversable="false"/>
|
||||||
<TextField fx:id="eingabePreis" promptText="Preis des Gerichtes" focusTraversable="false"/>
|
<TextArea fx:id="eingabeBeschreibung" promptText="Beschreibung" focusTraversable="false"/>
|
||||||
<ListView fx:id="listViewVorschlag" focusTraversable="false" minHeight="200" maxHeight="250"/>
|
|
||||||
<TextArea fx:id="eingabeBeschreibung" promptText="Beschreibung" focusTraversable="false" minHeight="75"/>
|
|
||||||
<HBox>
|
<HBox>
|
||||||
<TextField fx:id="eingabeInhaltsstoffe" promptText="Inhaltsstoffe" focusTraversable="false"/>
|
<TextField fx:id="eingabeInhaltsstoffe" promptText="Inhaltsstoffe" focusTraversable="false"/>
|
||||||
<Button fx:id="buttonInhaltsstoffe" onAction="#onButtonInhaltsstoffeClick" text="Hinzufügen"/>
|
<Button fx:id="buttonInhaltsstoffe" onAction="#onButtonInhaltsstoffeClick" text="Hinzufügen"/>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox fx:id="anzeigeInhaltsstoffe" minHeight="30"/>
|
<HBox fx:id="anzeigeInhaltsstoffe" />
|
||||||
<DatePicker fx:id="datePicker" maxWidth="Infinity"/>
|
|
||||||
<Label fx:id="status"/>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
</center>
|
</center>
|
||||||
<bottom>
|
<bottom>
|
||||||
<BorderPane>
|
<BorderPane>
|
||||||
<right>
|
<right>
|
||||||
<HBox styleClass="button_untenrechts">
|
<HBox styleClass="button_untenrechts">
|
||||||
<Button fx:id="speichernButton" text="Speichern" defaultButton="true" onAction="#onSpeichernButtonClick"/>
|
<Button text="Speichern" defaultButton="true"/>
|
||||||
</HBox>
|
</HBox>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--Erstellt von Sven Alteköster und Max Heer-->
|
|
||||||
|
|
||||||
<?import java.lang.*?>
|
|
||||||
<?import java.util.*?>
|
|
||||||
<?import javafx.scene.*?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
|
|
||||||
<!-- Erstellt von Sven Alteköster -->
|
|
||||||
|
|
||||||
<BorderPane xmlns="http://javafx.com/javafx"
|
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
|
||||||
fx:controller="de.subway_surfers.vpr_app.HauptmenueElternController"
|
|
||||||
prefHeight="400.0" prefWidth="600.0"
|
|
||||||
stylesheets="@layout.css">
|
|
||||||
<top>
|
|
||||||
<BorderPane styleClass="kopfzeile">
|
|
||||||
<right>
|
|
||||||
<Button text="Abmelden" onAction="#onAbmelden"/>
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</top>
|
|
||||||
<center>
|
|
||||||
<BorderPane styleClass="main">
|
|
||||||
<left>
|
|
||||||
<VBox styleClass="hauptmenue_buttons_links">
|
|
||||||
<Button text="Bestellung Planen" onAction="#onBestellungPlanen"/>
|
|
||||||
<Button text="Bestellhistorie anzeigen" onAction="#onBestellhistorieAnzeigen"/>
|
|
||||||
</VBox>
|
|
||||||
</left>
|
|
||||||
<right>
|
|
||||||
<GridPane fx:id="wochenplan" styleClass="hauptmenue_wochenuebersicht"/>
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</center>
|
|
||||||
</BorderPane>
|
|
@ -25,11 +25,14 @@
|
|||||||
<VBox styleClass="hauptmenue_buttons_links">
|
<VBox styleClass="hauptmenue_buttons_links">
|
||||||
<Button text="Speiseplan" onAction="#onSpeiseplanClick"/>
|
<Button text="Speiseplan" onAction="#onSpeiseplanClick"/>
|
||||||
<Button text="Alle Bestellungen anzeigen" onAction="#onBestellungenAnzeigen"/>
|
<Button text="Alle Bestellungen anzeigen" onAction="#onBestellungenAnzeigen"/>
|
||||||
|
<Button text="Rechnungen herunterladen"/>
|
||||||
|
<Button text="Daten importieren/Exportieren"/>
|
||||||
<Button text="Account anlegen" onAction="#onAccountAnlegenClick"/>
|
<Button text="Account anlegen" onAction="#onAccountAnlegenClick"/>
|
||||||
</VBox>
|
</VBox>
|
||||||
</left>
|
</left>
|
||||||
<right>
|
<right>
|
||||||
<GridPane fx:id="wochenplan" styleClass="hauptmenue_wochenuebersicht"/>
|
<GridPane fx:id="wochenplan" styleClass="hauptmenue_wochenuebersicht">
|
||||||
|
</GridPane>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</center>
|
</center>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--Samuel Wolff-->
|
<!-- @author Samuel Wolff
|
||||||
|
Noch nicht getestet
|
||||||
|
TODO Style einbauen
|
||||||
|
-->
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<!-- Erstellt von Sven Alteköster -->
|
|
||||||
|
|
||||||
<BorderPane xmlns="http://javafx.com/javafx"
|
<BorderPane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="de.subway_surfers.vpr_app.VerwaltungController"
|
fx:controller="de.subway_surfers.vpr_app.VerwaltungController"
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--Samuel Wolff-->
|
<!--
|
||||||
|
@author Samuel Wolff
|
||||||
|
Noch nicht getestet
|
||||||
|
TODO Style einbinden
|
||||||
|
-->
|
||||||
|
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import java.util.*?>
|
<?import java.util.*?>
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--Samuel Wolff-->
|
<!--
|
||||||
|
@author Samuel Wolff
|
||||||
|
Noch nicht getestet
|
||||||
|
TODO Style einbauen
|
||||||
|
-->
|
||||||
|
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import java.util.*?>
|
<?import java.util.*?>
|
||||||
|
Loading…
Reference in New Issue
Block a user