Merge branch 'client/feature-ingredient-nutrition-view' into 'main'

feat(client/nutrition): Nutrition & Ingredient list view

Closes #54 and #56

See merge request cse1105/2025-2026/teams/csep-team-76!54
This commit is contained in:
Aysegul Aydinlik 2026-01-16 16:12:17 +01:00
commit 1abbeee1ae
5 changed files with 403 additions and 110 deletions

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="client.scenes.Ingredient.IngredientListCtrl"
spacing="10" prefWidth="420" prefHeight="520">
<padding>
<Insets top="12" right="12" bottom="12" left="12"/>
</padding>
<Label text="Ingredients" style="-fx-font-size: 18px; -fx-font-weight: bold;"/>
<ListView fx:id="ingredientListView" VBox.vgrow="ALWAYS"/>
<ButtonBar>
<buttons>
<Button text="Add" onAction="#addIngredient"/>
<Button text="Refresh" onAction="#refresh"/>
<Button text="Delete" onAction="#deleteSelected"/>
<Button text="Close" onAction="#close"/>
</buttons>
</ButtonBar>
</VBox>

View file

@ -7,26 +7,21 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Line?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="client.scenes.nutrition.NutritionDetailsCtrl"
prefHeight="400.0" prefWidth="600.0">
<VBox visible="false">
<Label fx:id="ingredientName" />
<HBox>
<Label fx:id="fatInputLabel">Fat: </Label>
<TextField fx:id="fatInputElement" />
</HBox>
<HBox>
<Label fx:id="proteinInputLabel">Protein: </Label>
<TextField fx:id="proteinInputElement" />
</HBox>
<HBox>
<Label fx:id="carbInputLabel">Carbohydrates: </Label>
<TextField fx:id="carbInputElement" />
</HBox>
<Label fx:id="estimatedKcalLabel">Estimated: 0kcal</Label>
<Label fx:id="usageLabel">Not used in any recipes</Label>
</VBox>
</AnchorPane>
<VBox xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="client.scenes.nutrition.NutritionDetailsCtrl"
fx:id="nutritionDetails"
visible="false">
<Label fx:id="ingredientName" />
<GridPane fx:id="nutritionValueContainer">
<Label GridPane.columnIndex="0" GridPane.rowIndex="0" fx:id="fatInputLabel">Fat: </Label>
<TextField GridPane.columnIndex="1" GridPane.rowIndex="0" fx:id="fatInputElement" />
<Label GridPane.columnIndex="0" GridPane.rowIndex="1" fx:id="proteinInputLabel">Protein: </Label>
<TextField GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="proteinInputElement" />
<Label GridPane.columnIndex="0" GridPane.rowIndex="2" fx:id="carbInputLabel">Carbohydrates: </Label>
<TextField GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="carbInputElement" />
</GridPane>
<Button onAction="#handleNutritionSaveClick">Save values</Button>
<Label fx:id="estimatedKcalLabel">Estimated: 0kcal</Label>
<Label fx:id="usageLabel">Not used in any recipes</Label>
</VBox>

View file

@ -11,9 +11,7 @@
fx:controller="client.scenes.nutrition.NutritionViewCtrl"
prefHeight="400.0" prefWidth="600.0">
<SplitPane>
<ListView fx:id="nutritionIngredientsView" />
<AnchorPane>
<fx:include source="NutritionDetails.fxml" />
</AnchorPane>
<fx:include source="IngredientList.fxml" />
<fx:include source="NutritionDetails.fxml" />
</SplitPane>
</AnchorPane>

View file

@ -30,8 +30,7 @@
<ComboBox fx:id="langSelector" onAction="#changeLanguage" />
<!-- Ingredients -->
<fx:include source="IngredientList.fxml" fx:id="ingredientList"
VBox.vgrow="ALWAYS" maxWidth="Infinity" />
<fx:include source="RecipeIngredientList.fxml" fx:id="ingredientList" />
<!-- Preparation -->
<fx:include source="RecipeStepList.fxml" fx:id="stepList"

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="client.scenes.recipe.IngredientListCtrl"
minHeight="200.0" minWidth="200.0" maxWidth="Infinity">
<children>
<HBox alignment="CENTER_LEFT" spacing="20.0">
<children>
<Label fx:id="ingredientsLabel" text="Ingredients">
<padding>
<Insets bottom="5.0" top="5.0" />
</padding>
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<HBox alignment="CENTER" spacing="10.0">
<children>
<Button fx:id="addIngredientButton" mnemonicParsing="false" text="Add" />
<Button fx:id="deleteIngredientButton" mnemonicParsing="false" text="Delete" />
</children>
</HBox>
</children>
<padding>
<Insets left="10.0" right="10.0" />
</padding>
</HBox>
<ListView fx:id="ingredientListView" prefHeight="200.0" prefWidth="200.0" />
</children>
</VBox>