EssensverwaltungMitarbeiterView fertig

This commit is contained in:
Maximilian Heer 2023-12-20 08:25:05 +01:00
commit 412d9d7497
13 changed files with 608 additions and 26 deletions

3
.idea/misc.xml generated
View File

@ -7,8 +7,9 @@
<option value="$PROJECT_DIR$/pom.xml" /> <option value="$PROJECT_DIR$/pom.xml" />
</list> </list>
</option> </option>
<option name="workspaceImportForciblyTurnedOn" value="true" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" project-jdk-name="21" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

124
.idea/uiDesigner.xml generated Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -0,0 +1,50 @@
// Programmiert von Samuel Wolff
// Noch nicht getestet
package Logik;
public class Account {
// region Felder
private String passwort;
private int id;
private String benutzername;
// endregion
// region Getter & Setter
public String getPasswort() {
return passwort;
}
public void setPasswort(String passwort) {
this.passwort = passwort;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getBenutzername() {
return benutzername;
}
public void setBenutzername(String benutzername) {
this.benutzername = benutzername;
}
// endregion
// region Konstruktoren
public Account(String passwort, String benutzername) {
this.passwort = passwort;
this.benutzername = benutzername;
}
// endregion
}

View File

@ -0,0 +1,72 @@
// Programmiert von Samuel Wolff
// Noch nicht getestet
//
// TODO: Methoden implementieren!
//
package Logik;
import java.nio.file.WatchEvent;
import java.util.ArrayList;
public class Benutzer extends Account {
// region Felder
private String email;
private ArrayList<Kind> kinder;
// endregion
// region Getter & Setter
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public ArrayList<Kind> getKinder() {
return kinder;
}
public void setKinder(ArrayList<Kind> kinder) {
this.kinder = kinder;
}
// endregion
// region Konstruktoren
public Benutzer(String passwort, String benutzername, String email) {
super(passwort, benutzername);
this.email = email;
kinder = new ArrayList<>();
}
// endregion
// region Methoden
/**
* Lädt eine Rechnung herunter
*/
public void rechnungHerunterladen() {
}
/**
* Bestellt eine Mahlzeit
*/
public void mahlzeitBestellen() {
}
/**
* Zeigt Rechnungen gefiltert an
* @param params Die Filter Argumente
*/
public void rechnungAnzeigen(String params) {
}
// endregion
}

View File

@ -0,0 +1,59 @@
package Logik;
import java.util.ArrayList;
public class Kind {
// region Felder
private String name;
private String vorname;
private int id;
// TODO Zutat implementieren!
// private ArrayList<Zutat> filter;
// endregion
// region Getter & Setter
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 void setId(int id) {
this.id = id;
}
// TODO Zutat implementieren!
/*
public ArrayList<Zutat> getFilter() {
return filter;
}
public void setFilter(ArrayList<Zutat> filter) {
this.filter = filter;
}
*/
// endregion
// region Konstruktoren
public Kind(String name, String vorname) {
this.name = name;
this.vorname = vorname;
}
// endregion
}

View File

@ -0,0 +1,87 @@
// Programmiert von Samuel Wolff
// Noch nicht getestet
//
// TODO Methoden implementieren
//
package Logik;
import java.util.ArrayList;
public class MitarbeiterAccount extends Account {
// region Konstrukoren
public MitarbeiterAccount(String passwort, String benutzername) {
super(passwort, benutzername);
}
//endregion
// region Methoden
/**
* Setzt das Passwort eines gegebenen Accounts auf das gegebene Passwort zurück
* @param other Der Accout dessen Passwort zurückgesetzt wird
* @param passwort Das neue Passwort
*/
public void passwortZurzecksetzen(Account other, String passwort) {
// Soll das so?
other.setPasswort(passwort);
}
/**
* Bestellt eine Mahlzeit
*/
public void mahlzeitBestellen() {
}
/**
* Ändert einen Tagesplan
*/
public void tagesplanAendern() {
}
/**
* Erstellt einen neuen Account und fügt ihn in die Datenbank ein
* @param passwort Passwort des neuen Accounts
* @param benutzername Benutzername des neuen Accounts
* @param email Die E-Mail mit der sich der User einloggt
* @param kinder Eine Liste mit allen zugehörigen Kindern des Accounts
*/
public void accountErstellen(String passwort, String benutzername, String email, ArrayList<Kind> kinder) {
Benutzer newAccount = new Benutzer(passwort, benutzername, email);
newAccount.setKinder(kinder);
// Id muss aus der Datenbank geholt werden und dann gesetzt werden
}
/**
* Zeigt Rechnungen gefilter nach params an
* @param params Die Filter Arguemente
*/
public void rechnungAnzeigen(String[] params) {
}
// TODO sollte hier nicht noch ein User mitgegeben werden?
/**
* Weist ein Kind einem Account zu
* @param kind Das zuzuweisende Kind
*/
public void kinderZuweisen(Kind kind) {
}
// TODO hier auch?
/**
* Zeigt einen Benutzer an
*/
public void zeigeBenutzer() {
}
// endregion
}

View File

@ -0,0 +1,128 @@
package de.subway_surfers.vpr_app;
import javafx.collections.ListChangeListener;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.layout.Background;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import java.util.Random;
public class AccounterstellungMitarbeiter {
private @FXML Label status;
private @FXML Label einmalpw;
private @FXML HBox kindanzeige;
private @FXML GridPane kindDaten;
private @FXML RadioButton typMitarbeiter;
private @FXML RadioButton typEltern;
private ToggleGroup accountTyp;
public void initialize() {
accountTyp = new ToggleGroup();
accountTyp.getToggles().add(typEltern);
accountTyp.getToggles().add(typMitarbeiter);
einmalpw.setText(einmalPwGenerieren());
}
public void onZurueck(ActionEvent actionEvent) {
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
}
public void onAbmelden(ActionEvent actionEvent) {
//VerwaltungApplication.abmelden();
}
public void onTypMitarbeiter(ActionEvent actionEvent) {
kindDaten.getChildren().clear();
}
public void onTypEltern(ActionEvent actionEvent) {
Label ueberschrift = new Label();
ueberschrift.setText("Daten des Kindes:");
kindDaten.addRow(0);
kindDaten.addColumn(0);
kindDaten.addRow(1);
kindDaten.add(ueberschrift,0,0);
kindDaten.addRow(1);
Label vname = new Label("Vorname:");
kindDaten.add(vname, 0, 1);
TextField vnameEingabe = new TextField();
kindDaten.add(vnameEingabe, 1, 1);
kindDaten.addRow(2);
Label nname = new Label("Nachname:");
kindDaten.add(nname, 0, 2);
TextField nnameEingabe = new TextField();
kindDaten.add(nnameEingabe, 1, 2);
kindDaten.addRow(3);
Label geburtstag = new Label("Geburtstag: ");
kindDaten.add(geburtstag, 0, 3);
DatePicker geburtstagEingabe = new DatePicker();
geburtstagEingabe.setEditable(false);
kindDaten.add(geburtstagEingabe, 1, 3);
kindDaten.addRow(4);
Button hinzufuegen = new Button("hinzufügen");
kindDaten.add(hinzufuegen, 1, 4);
kindDaten.addRow(5);
hinzufuegen.setOnAction(e -> {
Button neues = new Button(vnameEingabe.getText());
boolean vnameGueltig = false;
boolean gebGueltig = false;
boolean nnameGueltig = false;
if (!vnameEingabe.getText().equals("")) {
vnameGueltig = true;
}
if (!nnameEingabe.getText().equals("")) {
nnameGueltig = true;
}
if (!geburtstagEingabe.getEditor().getText().equals("")) {
gebGueltig = true;
}
if (vnameGueltig && gebGueltig && nnameGueltig) {
kindanzeige.getChildren().add(neues);
neues.setOnAction(a -> {
((HBox) neues.getParent()).getChildren().remove(neues);
});
vnameEingabe.setText("");
nnameEingabe.setText("");
geburtstagEingabe.getEditor().setText("");
}
});
}
private String einmalPwGenerieren() {
final int pwLaenge = 8;
String pw = "";
Random zufall = new Random();
for (int i = 0; i < pwLaenge; i++) {
pw += (char)zufall.nextInt('A', 'Z' + 1);
}
return pw;
}
private boolean eingabenGueltig() {
return true;
}
public void onSpeichern(ActionEvent actionEvent) {
if (eingabenGueltig()) {
status.setText("Daten Erfolgreich gespeichert");
einmalpw.setText(einmalPwGenerieren());
}
}
}

View File

@ -39,12 +39,15 @@ public class EssensverwaltungMitarbeiterView {
} }
public void onFilter(ActionEvent actionEvent) { public void onFilter(ActionEvent actionEvent) {
} }
public void onHinzufuegen(ActionEvent actionEvent) { public void onHinzufuegen(ActionEvent actionEvent) {
} }
public void onZurueck(ActionEvent actionEvent) { public void onZurueck(ActionEvent actionEvent) {
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
} }
} }

View File

@ -3,7 +3,13 @@ package de.subway_surfers.vpr_app;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
public class HauptmenueMitarbeiterView { public class HauptmenueMitarbeiterView {
public void onAbmelden(ActionEvent actionEvent) { public void onAbmelden(ActionEvent actionEvent) {
VerwaltungApplication.sceneWechseln("login-view.fxml"); //VerwaltungApplication.abmelden();
} }
public void onAccountAnlegen(ActionEvent actionEvent) {
VerwaltungApplication.sceneWechseln("accounterstellung_mitarbeiter.fxml");
}
} }

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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.AccounterstellungMitarbeiter"
prefHeight="400.0" prefWidth="600.0"
stylesheets="@layout.css">
<top>
<BorderPane styleClass="kopfzeile">
<left>
<Button text="Zurück" onAction="#onZurueck"/>
</left>
<right>
<Button text="Abmelden" onAction="#onAbmelden"/>
</right>
</BorderPane>
</top>
<center>
<BorderPane styleClass="main">
<left>
<VBox styleClass="accounterstellung_links">
<GridPane styleClass="accounterstellung_daten">
<Label text="Accountname:" GridPane.rowIndex="0" GridPane.columnIndex="0"/>
<TextField GridPane.rowIndex="0" GridPane.columnIndex="1"/>
<Label text="E-Mail:" GridPane.rowIndex="1" GridPane.columnIndex="0"/>
<TextField GridPane.rowIndex="1" GridPane.columnIndex="1"/>
<RadioButton fx:id="typMitarbeiter" onAction="#onTypMitarbeiter" text="Mitarbeiter" GridPane.rowIndex="2" GridPane.columnIndex="0"/>
<RadioButton fx:id="typEltern" onAction="#onTypEltern" text="Eltern" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
</GridPane>
<GridPane fx:id="kindDaten" styleClass="accounterstellung_daten"/>
<HBox fx:id="kindanzeige"/>
</VBox>
</left>
<right>
<HBox>
<Label text="Einmalpasswort: "/>
<Label fx:id="einmalpw"/>
</HBox>
</right>
</BorderPane>
</center>
<bottom>
<BorderPane>
<right>
<HBox styleClass="button-untenrechts">
<Label fx:id="status"/>
<Button text="Speichern" onAction="#onSpeichern"/>
</HBox>
</right>
</BorderPane>
</bottom>
</BorderPane>

View File

@ -27,7 +27,7 @@
<Button text="Alle Bestellungen anzeigen"/> <Button text="Alle Bestellungen anzeigen"/>
<Button text="Rechnungen herunterladen"/> <Button text="Rechnungen herunterladen"/>
<Button text="Daten importieren/Exportieren"/> <Button text="Daten importieren/Exportieren"/>
<Button text="Account anlegen"/> <Button text="Account anlegen" onAction="#onAccountAnlegen"/>
</VBox> </VBox>
</left> </left>
<right> <right>
@ -43,9 +43,4 @@
</right> </right>
</BorderPane> </BorderPane>
</center> </center>
<right>
<TilePane>
</TilePane>
</right>
</BorderPane> </BorderPane>

View File

@ -3,6 +3,9 @@
-fx-font-size: 15; -fx-font-size: 15;
} }
* {
-fx-font-size: 15;
}
.kopfzeile{ .kopfzeile{
@ -49,7 +52,7 @@
-fx-pref-width: 200; -fx-pref-width: 200;
} }
.login_btn_anmelden { .button-untenrechts {
-fx-padding: 20; -fx-padding: 20;
} }
@ -61,26 +64,21 @@
-fx-font-size: 30; -fx-font-size: 30;
} }
.test { .text-field {
-fx-padding: 10 20; -fx-pref-width: 225;
-fx-pref-height: 32;
} }
.essensuebersicht_gridlines { .accounterstellung_daten {
-fx-grid-lines-visible: true; -fx-vgap: 10;
-fx-hgap: 10;
} }
.essensuebersicht_gridlines > * { .accounterstellung_links {
-fx-alignment: center; -fx-spacing: 20;
} }
.pfeil{ .falscheEingabe {
-fx-background-color: -fx-mark-highlight-color, -fx-mark-color; -fx-background-color: #FFDCDC;
-fx-background-insets: 0 0 -1 0, 0; -fx-text-fill: #FFDCDC;
-fx-padding: 0.25em;
-fx-shape: "M 0 -3.5 v 7 l 4 -3.5 z";
-fx-pref-width: 25;
}
.links {
-fx-rotate: 180;
} }

View File

@ -30,7 +30,7 @@
<bottom> <bottom>
<BorderPane> <BorderPane>
<right> <right>
<VBox styleClass="login_btn_anmelden"> <VBox styleClass="button-untenrechts">
<Button text="Anmelden" onAction="#onAnmeldenClick"/> <Button text="Anmelden" onAction="#onAnmeldenClick"/>
</VBox> </VBox>