feat/kindErstellen #9

Merged
PBS2H21ASH merged 23 commits from feat/kindErstellen into stable 2023-02-05 20:40:12 +01:00
3 changed files with 55 additions and 1 deletions
Showing only changes of commit b66cb3e9bc - Show all commits

View File

@ -0,0 +1,37 @@
package com.bib.essensbestellungsverwaltung;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class OrderHistoryController {
public ListView listView;
@FXML
public void initialize() {
List<Child> children = AccountMgr.getAllChildrenFromParentWithId(AccountMgr.currentUser.getId());
List<String> orders = new ArrayList<>();
for (Child child : children) {
System.out.println(child.getId());
List<String> selections = Database.select("food_selection", new String[] { "childid" }, new String[] { String.valueOf(child.getId()) });
for (String selection : selections) {
String[] selectionParts = selection.split(":");
String foodplanid = selectionParts[2];
String foodid = selectionParts[3];
String foodName = FoodMgr.getFoodById(Long.parseLong(foodid)).getName();
String date = FoodMgr.getFoodPlanById(Long.parseLong(foodplanid)).getDate();
orders.add(String.format("%s\t %s \t %s", date, child.getFirstname(), foodName));
}
}
Collections.sort(orders);
for(String order : orders){
listView.getItems().add(order);
}
}
}

View File

@ -44,7 +44,7 @@ public class ParentMenuController {
@FXML @FXML
public void onBestellungClick(MouseEvent mouseEvent) { public void onBestellungClick(MouseEvent mouseEvent) {
setButtonActive(bestellungButton); setButtonActive(bestellungButton);
changePage("dailyOrder-view.fxml"); changePage("orderHistory-view.fxml");
} }
@FXML @FXML

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane prefHeight="700.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.OrderHistoryController">
<children>
<Text layoutX="91.0" layoutY="84.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Bestellungen">
<font>
<Font name="System Bold" size="25.0" />
</font>
</Text>
<ListView fx:id="listView" layoutX="91.0" layoutY="135.0" prefHeight="428.0" prefWidth="499.0" />
</children>
</AnchorPane>