add: Rechnung View

This commit is contained in:
Johannes Kantz
2023-01-31 06:01:53 +01:00
parent 2b5839f0ea
commit c981fbca19
5 changed files with 137 additions and 12 deletions

View File

@@ -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 -> "";
};
}
}

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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) {