Package Controller
Class OrderController
java.lang.Object
Controller.OrderController
.Controller for the Order Screen
- Since:
 - 2023-03-07
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.TextFieldText field to input the customer's nameprivate DatabaseConnectConnection to the databaseprivate javafx.scene.control.ButtonButtonButton to navigate data trends sceneprivate javafx.scene.control.ButtonButtonButton to navigate edit menu sceneprivate final longID number of the employee completing the orderprivate javafx.scene.control.ButtonButtonButton to navigate employees sceneprivate javafx.scene.control.ButtonButtonButton to navigate inventory sceneprivate javafx.scene.control.ButtonButtonButton to logoutMapof the menu items Elements: <id, <name, price>>private javafx.scene.layout.FlowPaneFlowPaneFlowPane that holds the menu itemsprivate OrderOrderbeing completedprivate javafx.scene.layout.VBoxHolds the order item buttonsprivate javafx.scene.control.ButtonButtonButton to navigate order sceneprivate javafx.scene.control.ButtonButtonButton to navigate order history sceneprivate javafx.scene.control.ScrollPaneScrollPaneScrollPane that holds the orderBoxprivate SceneSwitchSwitches between scenes or tabsprivate SessionDataCurrent session dataprivate javafx.scene.control.ButtonButton to submit the orderprivate javafx.scene.control.LabelShows total cost of the order - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptiondoublegetMenuItemCost(long id) Returns the COST of a menu item given its IDlonggetMenuItemId(String name) Returns the ID of a menu item given its NAMEgetMenuItemName(long id) Returns the NAME of a menu item given its IDvoidSet up page.voidinsertOrderItem(Order order) Inserts an order into the databasevoidinsertSoldItem(Order order) Inserts each individual menu item in an order into thesolditemdatabasevoidmenuItemButtonOnClick(javafx.event.ActionEvent event) Handles the button click event for the menu itemsvoidnavButtonClicked(javafx.event.ActionEvent event) Handle loading a new window when a navigation buttonprivate voidRefreshes the front-endvoidremoveItemButtonOnClick(javafx.event.ActionEvent event) Remove an item from theOrderwhen the dynamically createdButtonis pressedvoidHandles the buttom click event for the submit order button.voidupdateInventory(Order order) Update the inventory count based on anOrdervoidupdateMenuItem(Order order) Updates themenuitemdatabase based on anOrder 
- 
Field Details
- 
session
Current session data- See Also:
 
 - 
database
Connection to the database- See Also:
 
 - 
sceneSwitch
Switches between scenes or tabs- See Also:
 
 - 
employeeId
private final long employeeIdID number of the employee completing the order - 
order
Orderbeing completed - 
orderButton
private javafx.scene.control.Button orderButtonButtonButton to navigate order scene - 
orderHistoryButton
private javafx.scene.control.Button orderHistoryButtonButtonButton to navigate order history scene - 
inventoryButton
private javafx.scene.control.Button inventoryButtonButtonButton to navigate inventory scene - 
employeesButton
private javafx.scene.control.Button employeesButtonButtonButton to navigate employees scene - 
editMenuButton
private javafx.scene.control.Button editMenuButtonButtonButton to navigate edit menu scene - 
dataTrendsButton
private javafx.scene.control.Button dataTrendsButtonButtonButton to navigate data trends scene - 
logoutButton
private javafx.scene.control.Button logoutButtonButtonButton to logout - 
orderScrollPane
private javafx.scene.control.ScrollPane orderScrollPaneScrollPaneScrollPane that holds the orderBox - 
orderBox
private javafx.scene.layout.VBox orderBoxHolds the order item buttons - 
customerNameField
private javafx.scene.control.TextField customerNameFieldText field to input the customer's name - 
totalCostLabel
private javafx.scene.control.Label totalCostLabelShows total cost of the order - 
submitOrderButton
private javafx.scene.control.Button submitOrderButtonButton to submit the order 
 - 
 - 
Constructor Details
- 
OrderController
Constructor- Parameters:
 session- Session's Information
 
 - 
 - 
Method Details
- 
initialize
public void initialize()Set up page. Load menu table into hash map, load buttons from hash map, set navbar visibility, and refresh page - 
refreshPage
private void refreshPage()Refreshes the front-end - 
removeItemButtonOnClick
public void removeItemButtonOnClick(javafx.event.ActionEvent event) Remove an item from theOrderwhen the dynamically createdButtonis pressed- Parameters:
 event-ActionEventof the button
 - 
submitOrderOnClick
public void submitOrderOnClick()Handles the buttom click event for the submit order button. Inserts the order into both the orderitem and solditem tables. - 
getMenuItemName
Returns the NAME of a menu item given its ID- Parameters:
 id- Identification number as aString- Returns:
 - the name of the menu item
 
 - 
getMenuItemCost
public double getMenuItemCost(long id) Returns the COST of a menu item given its ID- Parameters:
 id- Identification number as aString- Returns:
 - the cost of the menu item
 
 - 
insertOrderItem
Inserts an order into the database- Parameters:
 order-Orderto insert
 - 
insertSoldItem
Inserts each individual menu item in an order into thesolditemdatabase- Parameters:
 order-Orderto insert into the database
 - 
updateMenuItem
Updates themenuitemdatabase based on anOrder- Parameters:
 order-Orderto insert into the database
 - 
getMenuItemId
Returns the ID of a menu item given its NAME- Parameters:
 name- of the menu item as aString- Returns:
 - the Identification number, -1 when not found
 
 - 
updateInventory
Update the inventory count based on anOrder- Parameters:
 order-Orderthat will update inventory
 
 -