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] 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+