Compare commits

...

2 Commits

Author SHA1 Message Date
pbs2h21asc
2814244d29 Merge remote-tracking branch 'origin/Richards_Branch' into Richards_Branch
# Conflicts:
#	src/main/resources/com/bib/essensbestellungsverwaltung/createCoworker-view.fxml
2023-01-31 12:27:59 +01:00
pbs2h21asc
1a9f13581e Admin Controller bearbeitet 2023-01-31 12:27:14 +01:00
2 changed files with 74 additions and 35 deletions

View File

@ -1,43 +1,81 @@
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 {
private TextField lastname;
private TextField firstname;
private TextField street;
private TextField number;
private TextField city;
private TextField plz;
private TextField email;
private PasswordField password;
@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.toString();
String fn = firstname.toString();
String st = street.toString();
String nr = number.toString();
String cityString = city.toString();
String plzString = plz.toString();
String emailString = email.toString();
String pw = password.toString();
String[] userData = new String[]{ln,fn,pw,emailString};
String[] addressData = new String[]{st,nr,plzString,cityString};
Address adresse = new Address(st,nr,plzString,cityString);
Worker worker = new Worker(ln,fn,pw,emailString,adresse);
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();
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("");
}
if(!emailString.matches("^(?=.{1,64}@)[A-Za-z0-9_-]+(\\\\.[A-Za-z0-9_-]+)*@[^-][A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)*(\\\\.[A-Za-z]{2,})$")){
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("");
}
//String[] userData = new String[]{ln,fn,pw,emailString};
//String[] addressData = new String[]{st,nr,plzString,cityString};
Address address = new Address(st,nr,plzString,cityString);
Worker worker = new Worker(ln,fn,pw,emailString,address);
AccountMgr.createWorker(worker);
}
@FXML
protected void onBtCancel(){
}
}

View File

@ -3,21 +3,22 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?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?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="479.0" prefWidth="719.0" stylesheets="@createCoworker.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="860.0" prefWidth="850.0" stylesheets="@createCoworker.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.AdminController">
<children>
<Label layoutX="301.0" layoutY="49.0" />
<Label layoutX="230.0" layoutY="30.0" prefHeight="28.0" prefWidth="220.0" text="Mitarbeiter hinzufügen">
<Label layoutX="223.0" layoutY="76.0" prefHeight="28.0" prefWidth="220.0" text="Mitarbeiter hinzufügen">
<font>
<Font size="18.0" />
</font>
</Label>
<VBox layoutX="119.0" layoutY="95.0" prefHeight="317.0" prefWidth="331.0">
<VBox layoutX="223.0" layoutY="149.0" prefHeight="317.0" prefWidth="514.0">
<children>
<HBox prefHeight="43.0" prefWidth="331.0">
<children>
@ -26,7 +27,7 @@
<Font size="16.0" />
</font>
</Label>
<TextField prefHeight="25.0" prefWidth="194.0" />
<TextField id="lastname" prefHeight="25.0" prefWidth="194.0" />
</children>
</HBox>
<HBox prefHeight="60.0" prefWidth="331.0">
@ -39,7 +40,7 @@
<Font size="16.0" />
</font>
</Label>
<TextField prefHeight="25.0" prefWidth="193.0">
<TextField id="firstname" prefHeight="25.0" prefWidth="193.0">
<HBox.margin>
<Insets top="10.0" />
</HBox.margin>
@ -56,7 +57,7 @@
<Insets top="10.0" />
</padding>
</Label>
<TextField prefHeight="25.0" prefWidth="195.0">
<TextField id="street" prefHeight="25.0" prefWidth="195.0">
<HBox.margin>
<Insets top="10.0" />
</HBox.margin>
@ -73,7 +74,7 @@
<Insets top="10.0" />
</padding>
</Label>
<TextField prefHeight="25.0" prefWidth="87.0">
<TextField id="number" prefHeight="25.0" prefWidth="87.0">
<HBox.margin>
<Insets top="10.0" />
</HBox.margin>
@ -87,7 +88,7 @@
<Font size="16.0" />
</font>
</Label>
<TextField prefHeight="25.0" prefWidth="87.0">
<TextField id="plz" prefHeight="25.0" prefWidth="87.0">
<HBox.margin>
<Insets />
</HBox.margin>
@ -104,7 +105,7 @@
<Font size="16.0" />
</font>
</Label>
<TextField prefHeight="13.0" prefWidth="194.0">
<TextField id="city" prefHeight="13.0" prefWidth="194.0">
<HBox.margin>
<Insets top="5.0" />
</HBox.margin>
@ -124,14 +125,14 @@
<Insets top="10.0" />
</padding>
</Label>
<TextField prefHeight="25.0" prefWidth="196.0">
<TextField id="email" prefHeight="25.0" prefWidth="196.0">
<HBox.margin>
<Insets top="10.0" />
</HBox.margin>
</TextField>
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="200.0">
<HBox prefHeight="100.0" prefWidth="471.0">
<children>
<Label prefHeight="35.0" prefWidth="122.0" text="Passwort">
<font>
@ -141,16 +142,16 @@
<Insets top="10.0" />
</padding>
</Label>
<TextField prefHeight="25.0" prefWidth="194.0">
<PasswordField id="password" accessibleRole="PASSWORD_FIELD" prefHeight="25.0" prefWidth="194.0">
<HBox.margin>
<Insets top="10.0" />
</HBox.margin>
</TextField>
</PasswordField>
</children>
</HBox>
</children>
</VBox>
<Button id="btCreateCoworker" layoutX="119.0" layoutY="412.0" mnemonicParsing="false" prefHeight="44.0" prefWidth="158.0" text="Mitarbeiter hinzufügen" />
<Button id="btCancelCoworker" layoutX="357.0" layoutY="412.0" mnemonicParsing="false" prefHeight="44.0" prefWidth="158.0" text="Abbrechen" />
<Button id="btCreateCoworker" fx:id="btCreateCoworker" layoutX="216.0" layoutY="533.0" mnemonicParsing="false" onAction="#onBtSignUp" prefHeight="44.0" prefWidth="158.0" text="Mitarbeiter hinzufügen" />
<Button id="btCancelCoworker" fx:id="btCancelCoworker" layoutX="443.0" layoutY="533.0" mnemonicParsing="false" onAction="#onBtCancel" prefHeight="44.0" prefWidth="158.0" text="Abbrechen" />
</children>
</AnchorPane>