4 Commits

Author SHA1 Message Date
pbs2h21asc
3a2288f8c8 Merge remote-tracking branch 'origin/stable' into stable
# Conflicts:
#	src/main/resources/com/bib/essensbestellungsverwaltung/child-view.fxml
2023-02-05 21:41:33 +01:00
pbs2h21asc
6ca54aa026 singup mit Datebase verbunden und new Adresse 2023-02-05 21:38:27 +01:00
6fc28a0827 From main:
Reshad Meher:
sanitized 7932c7e896
2023-02-05 21:19:21 +01:00
13bc9ae1dd Merge pull request 'feat/kindErstellen' (#9) from feat/kindErstellen into stable
Reviewed-on: #9
2023-02-05 20:40:12 +01:00
4 changed files with 255 additions and 63 deletions

View File

@@ -0,0 +1,140 @@
/*Schulte*/
package com.bib.essensbestellungsverwaltung;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.Formattable;
import java.util.List;
import java.util.ResourceBundle;
public class ChildViewController implements Initializable {
@FXML
public TextField name;
@FXML
public TextField lastname;
@FXML
public TextField street;
@FXML
public TextField number;
@FXML
public TextField plz;
@FXML
public TextField city;
//@FXML
//public ComboBox group;
//@FXML
//public TextField age;
//@FXML
//public TextField allergies;
@FXML
public ListView allergiesList;
@FXML
public ComboBox selectAllergy;
@FXML
public ComboBox selectAllergySeverity;
@FXML
protected void onBtClick(){
boolean childData = false;
String childName = name.getText();
String childLastname = lastname.getText();
String streetString = street.getText();
String numberString = number.getText();
String plzString = plz.getText();
String cityString = city.getText();
if(childName.isEmpty() || childLastname.isEmpty() || streetString.isEmpty() || numberString.isEmpty() ||plzString.isEmpty() || cityString.isEmpty()){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Felder");
alert.setHeaderText("Eingabe unvollständig");
alert.setContentText("Bitte füllen sie alle Felder aus");
alert.showAndWait();
}
else childData = true;
if(childData) {
Address adress = new Address(streetString, numberString, plzString, cityString);
List<Allergy> childAllergyList = allergiesList.getItems();
ArrayList<AllergySeverity> allergySeverityArrayList = new ArrayList<>();
/*for (Allergy a : childAllergyList) {
AllergySeverity aS = new AllergySeverity(a, )
}*/ //Allergy Severity doesn't work in my case so the List will be left empty for now
Child child = new Child(childLastname, childName, adress, allergySeverityArrayList);
System.out.println(AccountMgr.createChild(child));
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Bestätigung");
alert.setHeaderText("Bestätigung");
alert.setContentText("Ihr Kind " + childName + " " + childLastname + " wurde Erfolgreich angelegt");
alert.showAndWait();
}
}
public ArrayList<Allergy> allergyComboBox(){
ArrayList<Allergy> allergyArrayList = new ArrayList<>();
for (int i = 1; i < 23; i++){
Allergy a = FoodMgr.getAllergyById(i);
allergyArrayList.add(a);
}
return allergyArrayList;
}
@FXML
public void addAllergy() {
boolean allergyEmpty = (selectAllergy.getValue() == "Allergie Wählen");
boolean severityEmpty = (selectAllergySeverity.getValue() == "Schwere");
if(allergyEmpty || severityEmpty) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Fehler");
alert.setHeaderText("Ungültige Auswahl");
alert.setContentText("Bitte Wählen Sie Allergie und schwere aus");
alert.showAndWait();
}
String addedAllergy = selectAllergy.getValue().toString();
String addedSeverity = selectAllergySeverity.getValue().toString().split(":")[0];
allergiesList.getItems().add(addedAllergy + ":" + addedSeverity);
selectAllergy.setValue("Allergie Wählen");
selectAllergySeverity.setValue("Schwere");
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
selectAllergy.getItems().addAll(allergyComboBox());
selectAllergySeverity.getItems().addAll("1:Harmlos","2:Warnung","3:Kritisch");
}
}

View File

@@ -12,55 +12,55 @@ import java.io.IOException;
public class SingUpController {
@FXML
private TextField tfName;
private TextField tfLastName;
@FXML
private TextField tfVorname;
private TextField tfFirstName;
@FXML
private TextField tfEmail;
@FXML
private PasswordField pfPasswort;
private PasswordField pfPassword;
@FXML
private TextField tfPLZ;
private TextField tfPostCode;
@FXML
private TextField tfStadt;
private TextField tfCity;
@FXML
private TextField tfStrasse;
private TextField tfStreet;
@FXML
private TextField tfHausnummer;
private TextField tfHouseNumber;
@FXML
private void onKontoErstellenBtClick(){
String name = tfName.getText();
String vorname = tfVorname.getText();
String lastName = tfLastName.getText();
String firstName = tfFirstName.getText();
String email = tfEmail.getText();
String passwort = pfPasswort.getText();
String plz = tfPLZ.getText();
String stadt = tfStadt.getText();
String strasse = tfStrasse.getText();
String hausnummer = tfHausnummer.getText();
String password = pfPassword.getText();
String postCode = tfPostCode.getText();
String city = tfCity.getText();
String street = tfStreet.getText();
String houseNumber = tfHouseNumber.getText();
Alert alert;
if(name.isEmpty() || vorname.isEmpty() || email.isEmpty() || passwort.isEmpty() || plz.isEmpty() ||
stadt.isEmpty() || strasse.isEmpty() || hausnummer.isEmpty()){
if(lastName.isEmpty() || firstName.isEmpty() || email.isEmpty() || password.isEmpty() || postCode.isEmpty() ||
city.isEmpty() || street.isEmpty() || houseNumber.isEmpty()){
if(name.isEmpty()){
if(lastName.isEmpty()){
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Name' ist leer.");
alert.showAndWait();
} else if (vorname.isEmpty()) {
} else if (firstName.isEmpty()) {
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Vorname' ist leer.");
alert.showAndWait();
} else if (email.isEmpty()) {
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'E-Mail' ist leer.");
alert.showAndWait();
} else if (passwort.isEmpty()) {
} else if (password.isEmpty()) {
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Passwort' ist leer.");
alert.showAndWait();
} else if (plz.isEmpty()) {
} else if (postCode.isEmpty()) {
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Postleitzahl' ist leer.");
alert.showAndWait();
} else if (stadt.isEmpty()) {
} else if (city.isEmpty()) {
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Stadt' ist leer.");
alert.showAndWait();
} else if (strasse.isEmpty()) {
} else if (street.isEmpty()) {
alert = new Alert(Alert.AlertType.ERROR," Die Eingabefeld 'Straße' ist leer.");
alert.showAndWait();
}else {
@@ -69,8 +69,8 @@ public class SingUpController {
}
}else {
Address newAdresse = new Address(strasse,hausnummer,plz,stadt);
User newUser = new User(name,vorname,passwort,email,newAdresse);
Address newAdresse = new Address(street,houseNumber,postCode,city);
User newUser = new User(lastName,firstName,password,email,newAdresse);
if(StartViewApplication.firstLaunch){
long id = AccountMgr.createWorker(new Worker(newUser));
if(id < 1) {
@@ -91,14 +91,14 @@ public class SingUpController {
alert = new Alert(Alert.AlertType.CONFIRMATION,"Eltern Account erfolgreich erstellt");
alert.showAndWait();
}
tfName.setText("");
tfVorname.setText("");
tfLastName.setText("");
tfFirstName.setText("");
tfEmail.setText("");
pfPasswort.setText("");
tfPLZ.setText("");
tfStadt.setText("");
tfStrasse.setText("");
tfHausnummer.setText("");
pfPassword.setText("");
tfPostCode.setText("");
tfCity.setText("");
tfStreet.setText("");
tfHouseNumber.setText("");
}
}

View File

@@ -1,28 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import org.controlsfx.control.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane prefHeight="700.0" prefWidth="950.0" stylesheets="@child.css" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.ChildController">
<AnchorPane prefHeight="700.0" prefWidth="950.0" stylesheets="@child.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.ChildViewController">
<children>
<Text layoutX="51.0" layoutY="90.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Kinder">
<font>
<Font size="58.0" />
</font>
</Text>
<HBox id="contentContainer" alignment="CENTER" layoutX="8.0" layoutY="165.0" prefHeight="127.0" prefWidth="937.0">
<HBox id="contentContainer" alignment="CENTER" layoutX="8.0" layoutY="165.0" prefHeight="331.0" prefWidth="937.0">
<children>
<VBox id="contentContainer" prefHeight="250.0" prefWidth="256.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Vorname">
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Name">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<TextField fx:id="firstName" prefWidth="97.0">
<TextField fx:id="name" prefWidth="97.0">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Nachname">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<TextField fx:id="lastname" prefWidth="97.0">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
@@ -34,16 +49,66 @@
</VBox>
<VBox id="contentContainer" prefHeight="250.0" prefWidth="256.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Nachname">
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Straße">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<TextField fx:id="lastName" prefWidth="97.0">
<TextField fx:id="street" prefWidth="97.0">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Hausnummer">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<TextField fx:id="number" prefWidth="97.0">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="PLZ">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<TextField fx:id="plz" prefWidth="97.0">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Stadt">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<TextField fx:id="city" prefWidth="97.0">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</TextField>
</children>
<HBox.margin>
<Insets left="15.0" right="15.0" />
</HBox.margin>
</VBox>
<VBox id="contentContainer" prefHeight="250.0" prefWidth="256.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Allergien">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<ListView prefHeight="101.0" prefWidth="227.0" />
<HBox prefHeight="26.0" prefWidth="256.0">
<children>
<ComboBox fx:id="selectAllergy" prefWidth="150.0" promptText="Allergie wählen" />
<ComboBox fx:id="selectAllergySeverity" prefWidth="150.0" promptText="Schwere" />
</children>
</HBox>
<Button fx:id="addAllergy" mnemonicParsing="false" onAction="#addAllergy" prefHeight="25.0" prefWidth="171.0" text="Allergie hinzufügen" />
</children>
<HBox.margin>
<Insets left="15.0" right="15.0" />
@@ -51,19 +116,6 @@
</VBox>
</children>
</HBox>
<Button id="btAddChild" fx:id="kindHinzufügenButton" layoutX="779.0" layoutY="646.0" mnemonicParsing="false" onAction="#onKindHinzufügen" prefHeight="26.0" prefWidth="125.0" text="Kind hinzufügen" />
<ChoiceBox fx:id="childChoiceBox" layoutX="704.0" layoutY="62.0" onAction="#onSelectChild" prefWidth="150.0" />
<Label layoutX="704.0" layoutY="44.0" text="Kind" />
<VBox id="contentContainer" layoutX="493.0" layoutY="330.0" prefHeight="250.0" prefWidth="256.0" spacing="20.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Allergien">
<VBox.margin>
<Insets bottom="15.0" top="15.0" />
</VBox.margin>
</Text>
<CheckComboBox fx:id="allergienComboBox" prefHeight="25.0" prefWidth="200.0" />
</children>
</VBox>
<Button id="btAddChild" fx:id="kindLoeschenButton" layoutX="621.0" layoutY="646.0" mnemonicParsing="false" onAction="#onKindLoeschen" prefHeight="26.0" prefWidth="125.0" text="Kind löschen" />
<Button id="btAddChild" layoutX="421.0" layoutY="587.0" mnemonicParsing="false" onAction="#onBtClick" prefHeight="26.0" prefWidth="125.0" text="Kind hinzufügen" />
</children>
</AnchorPane>

View File

@@ -31,7 +31,7 @@
<Circle fill="#93c4f23d" layoutY="258.0" radius="106.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" />
<VBox layoutX="262.0" prefHeight="400.0" prefWidth="364.0" style="-fx-background-color: white;">
<children>
<TextField fx:id="tfName" alignment="TOP_LEFT" prefHeight="26.0" prefWidth="282.0" promptText="Name" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField fx:id="tfLastName" alignment="TOP_LEFT" prefHeight="26.0" prefWidth="282.0" promptText="Name" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<effect>
<Blend />
</effect>
@@ -42,7 +42,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</TextField>
<TextField fx:id="tfVorname" promptText="Vorname" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField fx:id="tfFirstName" promptText="Vorname" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<effect>
<Blend />
</effect>
@@ -64,7 +64,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</TextField>
<PasswordField fx:id="pfPasswort" accessibleRole="TEXT_FIELD" promptText="Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<PasswordField fx:id="pfPassword" accessibleRole="TEXT_FIELD" promptText="Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<font>
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font>
@@ -80,7 +80,7 @@
</PasswordField>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TextField fx:id="tfPLZ" prefHeight="35.0" prefWidth="92.0" promptText="PLZ" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField fx:id="tfPostCode" prefHeight="35.0" prefWidth="92.0" promptText="PLZ" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin>
@@ -88,7 +88,7 @@
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font>
</TextField>
<TextField fx:id="tfStadt" prefHeight="35.0" prefWidth="182.0" promptText="Stadt" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField fx:id="tfCity" prefHeight="35.0" prefWidth="182.0" promptText="Stadt" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin>
@@ -100,7 +100,7 @@
</HBox>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TextField fx:id="tfStrasse" prefHeight="27.0" prefWidth="134.0" promptText="Straße" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField fx:id="tfStreet" prefHeight="27.0" prefWidth="134.0" promptText="Straße" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin>
@@ -108,7 +108,7 @@
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font>
</TextField>
<TextField fx:id="tfHausnummer" prefHeight="27.0" prefWidth="99.0" promptText="Hausnummer" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField fx:id="tfHouseNumber" prefHeight="27.0" prefWidth="99.0" promptText="Hausnummer" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin>