From 1a4d45aed479c8d69ae996dbcf4840f90aa8f3fe Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Tue, 31 Jan 2023 04:30:09 +0100 Subject: [PATCH 01/23] add: parent menu --- .../ParentMenuController.java | 78 ++++++++++++++++++ .../bib/essensbestellungsverwaltung/menue.css | 30 ++----- .../parentMenu.fxml | 81 +++++++++++++++++++ 3 files changed, 166 insertions(+), 23 deletions(-) create mode 100644 src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java create mode 100644 src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java new file mode 100644 index 0000000..f42f378 --- /dev/null +++ b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java @@ -0,0 +1,78 @@ +package com.bib.essensbestellungsverwaltung; + +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.control.Button; +import javafx.scene.input.ContextMenuEvent; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.Background; +import javafx.scene.layout.BorderPane; + +import java.io.IOException; +import java.util.Arrays; + +public class ParentMenuController { + + @FXML + BorderPane contentView; + @FXML + Button essensplanButton; + @FXML + Button kinderButton; + @FXML + Button bestellungButton; + @FXML + Button einstellungenButton; + + @FXML + public void initialize() { + changePage("menue-view.fxml"); + setButtonActive(essensplanButton); + } + + + @FXML + public void onEssensplanClick(MouseEvent mouseEvent) { + setButtonActive(essensplanButton); + changePage("menue-view.fxml"); + } + + @FXML + public void onKinderClick(MouseEvent mouseEvent) { + setButtonActive(kinderButton); + changePage("child-view.fxml"); + } + + @FXML + public void onBestellungClick(MouseEvent mouseEvent) { + setButtonActive(bestellungButton); + changePage("dailyOrder-view.fxml"); + } + + @FXML + public void onEinstellungenClick(MouseEvent mouseEvent) { + setButtonActive(einstellungenButton); + changePage("menue-view.fxml"); + } + + @FXML + public void onAusloggenClick(MouseEvent mouseEvent) { + } + + private void changePage(String page) { + try { + Parent root = FXMLLoader.load(getClass().getResource(page)); + contentView.setCenter(root); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + private void setButtonActive(Button b){ + einstellungenButton.getStyleClass().remove("active"); + kinderButton.getStyleClass().remove("active"); + bestellungButton.getStyleClass().remove("active"); + essensplanButton.getStyleClass().remove("active"); + b.getStyleClass().add("active"); + } +} diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css b/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css index 1ed99ac..8ea9a07 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css @@ -1,25 +1,9 @@ -#btFoodChoice{ - -fx-background-color: transparent; - +.sidebar-nav_button { + -fx-background-color: #69b6ff; + -fx-text-fill: #123; + -fx-border-color: #000; + -fx-border-radius: 20; } - -#btFoodChoice:hover{ - -fx-underline: true; - -fx-text-fill: black; -} -#btPlaceOrder{ - -fx-background-color: lightblue; - -fx-text-fill: white; - -fx-background-radius: 25; -} - - -#btPlaceOrder:hover{ - -fx-border-width: 0; - -fx-text-fill: black; - -fx-underline: true; -} - -#cbChooseChild{ - -fx-background-color: lightgray; +.sidebar-nav_button.active { + -fx-background-color: #4e92b4; } \ No newline at end of file diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml new file mode 100644 index 0000000..40a5e8b --- /dev/null +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
From 2b5839f0eaf638b5329d85f8a42a525260c7c249 Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Tue, 31 Jan 2023 04:30:25 +0100 Subject: [PATCH 02/23] add: workerMenu --- .../WorkerMenuController.java | 93 +++++++++++++++ .../workerMenu.fxml | 111 ++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java create mode 100644 src/main/resources/com/bib/essensbestellungsverwaltung/workerMenu.fxml diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java new file mode 100644 index 0000000..5d5ddcd --- /dev/null +++ b/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java @@ -0,0 +1,93 @@ +package com.bib.essensbestellungsverwaltung; + +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.control.Button; +import javafx.scene.input.ContextMenuEvent; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.BorderPane; + +import java.io.IOException; + +public class WorkerMenuController { + @FXML + public BorderPane contentView; + + @FXML + Button tagesbestellungButton; + @FXML + Button wochenplanButton; + @FXML + Button monatsabrechnungButton; + @FXML + Button mitarbeiterButton; + @FXML + Button mahlzeitButton; + @FXML + Button einstellungenButton; + + @FXML + public void initialize() { + changePage("menue-view.fxml"); + setButtonActive(tagesbestellungButton); + } + + @FXML + public void onTagesbestellungenClick(MouseEvent mouseEvent) { + changePage("menue-view.fxml"); + setButtonActive(tagesbestellungButton); + } + + @FXML + public void onWochenplanClick(MouseEvent mouseEvent) { + setButtonActive(wochenplanButton); + } + + @FXML + public void onMonatsabrechnungClick(MouseEvent mouseEvent) { + changePage("invoice-view.fxml"); + setButtonActive(monatsabrechnungButton); + } + + + @FXML + public void onMitarbeiterClick(MouseEvent mouseEvent) { + changePage("createCoworker-view.fxml"); + setButtonActive(mitarbeiterButton); + } + + + @FXML + public void onMahlzeitClick(MouseEvent mouseEvent) { + setButtonActive(mahlzeitButton); + } + + + public void onEinstellungenClick(MouseEvent mouseEvent) { + setButtonActive(einstellungenButton); + } + + @FXML + public void onAusloggenClick(MouseEvent mouseEvent) { + } + + private void changePage(String page) { + try { + Parent root = FXMLLoader.load(getClass().getResource(page)); + contentView.setCenter(root); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void setButtonActive(Button b) { + tagesbestellungButton.getStyleClass().remove("active"); + monatsabrechnungButton.getStyleClass().remove("active"); + wochenplanButton.getStyleClass().remove("active"); + mahlzeitButton.getStyleClass().remove("active"); + mitarbeiterButton.getStyleClass().remove("active"); + einstellungenButton.getStyleClass().remove("active"); + b.getStyleClass().add("active"); + } +} diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/workerMenu.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/workerMenu.fxml new file mode 100644 index 0000000..92368ad --- /dev/null +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/workerMenu.fxml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
From c981fbca197e59367f410b5373631ffa78404444 Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Tue, 31 Jan 2023 06:01:53 +0100 Subject: [PATCH 03/23] add: Rechnung View --- .../InvoiceController.java | 67 +++++++++++++++++++ .../ParentMenuController.java | 6 +- .../StartViewApplication.java | 4 +- .../WorkerMenuController.java | 6 +- .../invoice-view.fxml | 66 +++++++++++++++--- 5 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/bib/essensbestellungsverwaltung/InvoiceController.java diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/InvoiceController.java b/src/main/java/com/bib/essensbestellungsverwaltung/InvoiceController.java new file mode 100644 index 0000000..aebd7ba --- /dev/null +++ b/src/main/java/com/bib/essensbestellungsverwaltung/InvoiceController.java @@ -0,0 +1,67 @@ +package com.bib.essensbestellungsverwaltung; + +import javafx.fxml.FXML; +import javafx.scene.control.ChoiceBox; +import javafx.scene.control.Spinner; +import javafx.scene.input.MouseEvent; +import javafx.scene.text.Text; + +import java.util.Calendar; + +public class InvoiceController { + @FXML + Text responseText; + @FXML + ChoiceBox monatChoiceBox; + + @FXML + Spinner jahrSpinner; + + @FXML + public void initialize() { + monatChoiceBox.setValue(intToMonth(Calendar.getInstance().get(Calendar.MONTH) + 1)); + jahrSpinner.getValueFactory().setValue(Calendar.getInstance().get(Calendar.YEAR)); + } + + @FXML + void onRechnungErstellenClick(MouseEvent mouseEvent) { + responseText.setText(monatChoiceBox.getValue().toString() + jahrSpinner.getValue()); + // hier rechnung erstellen + } + + private int monthToInt(String month) { + return switch (month) { + case "Januar" -> 1; + case "Februar" -> 2; + case "März" -> 3; + case "April" -> 4; + case "Mai" -> 5; + case "Juni" -> 6; + case "Juli" -> 7; + case "August" -> 8; + case "September" -> 9; + case "Oktober" -> 10; + case "November" -> 11; + case "Dezember" -> 12; + default -> -1; + }; + } + + private String intToMonth(int month) { + return switch (month) { + case 1 -> "Januar"; + case 2 -> "Februar"; + case 3 -> "März"; + case 4 -> "April"; + case 5 -> "Mai"; + case 6 -> "Juni"; + case 7 -> "Juli"; + case 8 -> "August"; + case 9 -> "September"; + case 10 -> "Oktober"; + case 11 -> "November"; + case 12 -> "Dezember"; + default -> ""; + }; + } +} diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java index f42f378..a50d7ae 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java @@ -3,11 +3,13 @@ package com.bib.essensbestellungsverwaltung; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; +import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.input.ContextMenuEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Background; import javafx.scene.layout.BorderPane; +import javafx.stage.Stage; import java.io.IOException; import java.util.Arrays; @@ -57,7 +59,9 @@ public class ParentMenuController { } @FXML - public void onAusloggenClick(MouseEvent mouseEvent) { + public void onAusloggenClick(MouseEvent mouseEvent) throws IOException { + Parent p = FXMLLoader.load(StartViewApplication.class.getResource("workerMenu.fxml")); + StartViewApplication.primary.getScene().setRoot(p); } private void changePage(String page) { diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java index fe03394..8e64c57 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java @@ -17,8 +17,8 @@ public class StartViewApplication extends Application { @Override public void start(Stage stage) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 950,480); - //stage = primary; + Scene scene = new Scene(fxmlLoader.load(), 1200,900); + primary = stage; stage.setTitle("Essen Bestellung im Kindergarten"); stage.setScene(scene); stage.show(); diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java index 5d5ddcd..d552aea 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java @@ -3,10 +3,12 @@ package com.bib.essensbestellungsverwaltung; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; +import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.input.ContextMenuEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; +import javafx.stage.Stage; import java.io.IOException; @@ -69,7 +71,9 @@ public class WorkerMenuController { } @FXML - public void onAusloggenClick(MouseEvent mouseEvent) { + public void onAusloggenClick(MouseEvent mouseEvent) throws IOException { + Parent p = FXMLLoader.load(StartViewApplication.class.getResource("parentMenu.fxml")); + StartViewApplication.primary.getScene().setRoot(p); } private void changePage(String page) { diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/invoice-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/invoice-view.fxml index 1087a44..399a6bd 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/invoice-view.fxml +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/invoice-view.fxml @@ -1,14 +1,64 @@ - - + + + - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + +
- +
diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenue-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenue-view.fxml deleted file mode 100644 index 71aaf0c..0000000 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenue-view.fxml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - - + + +
- +
From 1c85261c7be1afb5463e0e60cc5593124c355422 Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Tue, 31 Jan 2023 07:41:21 +0100 Subject: [PATCH 06/23] add: change Scenes --- .../LoginController.java | 16 +++------------- .../ParentMenuController.java | 3 +-- .../SingUpController.java | 11 +++++++++++ .../StartViewApplication.java | 9 ++++++++- .../WorkerMenuController.java | 5 +++-- 5 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java b/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java index 4325d3b..87b5479 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java @@ -26,12 +26,8 @@ public class LoginController { String email = tfEmail.getText(); String password = pfPassword.getText(); if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){ - FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("menue-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 950,480); - Stage stage = new Stage(); - stage.setTitle("Essen Bestellung im Kindergarten"); - stage.setScene(scene); - stage.show(); + // if user is worker: StartViewApplication.changeScene("workerMenu-view.fxml"); + StartViewApplication.changeScene("parentMenu-view.fxml"); }else { Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch"); alert.showAndWait(); @@ -42,12 +38,6 @@ public class LoginController { } @FXML protected void changeToSignUp() throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("signUp-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 950,480); - Stage stage = new Stage(); - stage.setTitle("Essen Bestellung im Kindergarten"); - stage.setScene(scene); - stage.show(); - + StartViewApplication.changeScene("signUp-view.fxml"); } } diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java index 87c5f37..4f21d1b 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java @@ -55,8 +55,7 @@ public class ParentMenuController { @FXML public void onAusloggenClick(MouseEvent mouseEvent) throws IOException { - Parent p = FXMLLoader.load(StartViewApplication.class.getResource("workerMenu-view.fxml")); - StartViewApplication.primary.getScene().setRoot(p); + StartViewApplication.changeScene("workerMenu-view.fxml"); } private void changePage(String page) { diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java b/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java new file mode 100644 index 0000000..f6a5b6f --- /dev/null +++ b/src/main/java/com/bib/essensbestellungsverwaltung/SingUpController.java @@ -0,0 +1,11 @@ +package com.bib.essensbestellungsverwaltung; + +import javafx.event.ActionEvent; + +public class SingUpController { + public void onKontoErstellenBtClick(ActionEvent actionEvent) { + } + + public void onAnmeldenBtClick(ActionEvent actionEvent) { + } +} diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java index 1d7a126..ffc7b5a 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/StartViewApplication.java @@ -7,6 +7,7 @@ package com.bib.essensbestellungsverwaltung; import javafx.application.Application; import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; @@ -14,10 +15,11 @@ import java.io.IOException; public class StartViewApplication extends Application { public static Stage primary; + @Override public void start(Stage stage) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 1200,750); + Scene scene = new Scene(fxmlLoader.load(), 1200, 750); primary = stage; stage.setTitle("Essen Bestellung im Kindergarten"); stage.setScene(scene); @@ -34,4 +36,9 @@ public class StartViewApplication extends Application { //Database.deleteSample(); launch(); } + + public static void changeScene(String scene) throws IOException { + Parent p = FXMLLoader.load(StartViewApplication.class.getResource(scene)); + primary.getScene().setRoot(p); + } } \ No newline at end of file diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java index 1bc78ce..42d7bcb 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/WorkerMenuController.java @@ -40,6 +40,7 @@ public class WorkerMenuController { @FXML public void onWochenplanClick(MouseEvent mouseEvent) { + changePage("createFoodplan-view.fxml"); setButtonActive(wochenplanButton); } @@ -59,6 +60,7 @@ public class WorkerMenuController { @FXML public void onMahlzeitClick(MouseEvent mouseEvent) { + changePage("createFood-view.fxml"); setButtonActive(mahlzeitButton); } @@ -69,8 +71,7 @@ public class WorkerMenuController { @FXML public void onAusloggenClick(MouseEvent mouseEvent) throws IOException { - Parent p = FXMLLoader.load(StartViewApplication.class.getResource("parentMenu-view.fxml")); - StartViewApplication.primary.getScene().setRoot(p); + StartViewApplication.changeScene("parentMenu-view.fxml"); } private void changePage(String page) { From 8927755462b92e264a773bbae129e4857edb2f63 Mon Sep 17 00:00:00 2001 From: pbs2h21asc Date: Tue, 31 Jan 2023 14:34:37 +0100 Subject: [PATCH 07/23] Admin Controller --- .../AdminController.java | 118 +++++++- .../createCoworker-view.fxml | 285 +++++++++--------- 2 files changed, 260 insertions(+), 143 deletions(-) diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/AdminController.java b/src/main/java/com/bib/essensbestellungsverwaltung/AdminController.java index 6494355..5092741 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/AdminController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/AdminController.java @@ -1,4 +1,120 @@ +/*Schulte*/ + package com.bib.essensbestellungsverwaltung; +import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.PasswordField; +import javafx.scene.control.TextField; + public class AdminController { -} + + @FXML + TextField lastname; + @FXML + TextField firstname; + @FXML + TextField street; + @FXML + TextField number; + @FXML + TextField city; + @FXML + TextField plz; + @FXML + TextField email; + @FXML + PasswordField password; + + + + @FXML + protected void onBtSignUp(){ + + String ln = lastname.getText(); + String fn = firstname.getText(); + String st = street.getText(); + String nr = number.getText(); + String cityString = city.getText(); + String plzString = plz.getText(); + String emailString = email.getText(); + String pw = password.getText(); + + boolean userData = false; + boolean pwCorrect = false; + boolean emailCorrect = false; + + + if(ln.isEmpty() || fn.isEmpty() || st.isEmpty() ||nr.isEmpty() || cityString.isEmpty() || plzString.isEmpty()){ + Alert alert = new Alert(Alert.AlertType.ERROR); + alert.setTitle("Felder"); + alert.setHeaderText("Felder nicht ausgefüllt"); + alert.setContentText("Bitte füllen sie alle Felder aus"); + alert.showAndWait(); + } + else { + userData = true; + } + + + if(!pw.matches("^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,}$")){ + + Alert alert = new Alert(Alert.AlertType.ERROR); + alert.setTitle("Passwort"); + alert.setHeaderText("Ungültiges Passwort"); + alert.setContentText("Das Passwort benötigt mindestens: \n-8 Zeichen\n-einen Kleinbuchstaben\n-einen Großbuchstaben\n-ein Sonderzeichen\n-kein Leerzeichen"); + password.setText(""); + alert.showAndWait(); + } + else { + pwCorrect = true; + } + + if(!emailString.matches("^(.+)@(\\S+)$")){ + Alert alert = new Alert(Alert.AlertType.ERROR); + alert.setTitle("E-Mail"); + alert.setHeaderText("Ungültige E-Mail Adresse"); + alert.setContentText("Bitte geben sie eine gültige E-Mail Adresse an"); + email.setText(""); + alert.showAndWait(); + } + else{ + emailCorrect = true; + } + + //String[] userData = new String[]{ln,fn,pw,emailString}; + //String[] addressData = new String[]{st,nr,plzString,cityString}; + + + if(emailCorrect && pwCorrect && userData) { + Address address = new Address(st, nr, plzString, cityString); + Worker worker = new Worker(ln, fn, pw, emailString, address); + + + System.out.println(AccountMgr.createWorker(worker)); + + Alert alert = new Alert(Alert.AlertType.INFORMATION); + alert.setTitle("Bestätigung"); + alert.setHeaderText("Bestätigung"); + alert.setContentText("Mitarbeiter " + fn + " " + ln + " wurde Erfolgreich angelegt"); + alert.showAndWait(); + } + + } + + @FXML + protected void onBtCancel(){ + + lastname.setText(""); + firstname.setText(""); + street.setText(""); + number.setText(""); + city.setText(""); + plz.setText(""); + email.setText(""); + password.setText(""); + + } + + +} \ No newline at end of file diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/createCoworker-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/createCoworker-view.fxml index 54f3aee..cae69d6 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/createCoworker-view.fxml +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/createCoworker-view.fxml @@ -3,154 +3,155 @@ + - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - + - + - - + - + + + - + - + - + - - - - - - - - - - + - + - - - - - - - - - - + - + - - - - - - - - - - + - + - - - - - - - - - -