From 08e0acce9f124c7890098ffddf70c2d82787c0b1 Mon Sep 17 00:00:00 2001 From: Simon Westlin Green Date: Sun, 28 May 2023 21:21:13 +0200 Subject: [PATCH] Items show up in both cart and checkout now. --- src/imat/MainViewController.java | 6 +- src/imat/imat_app.fxml | 1128 +++++++++++++++--------------- 2 files changed, 567 insertions(+), 567 deletions(-) diff --git a/src/imat/MainViewController.java b/src/imat/MainViewController.java index 32a3601..1502150 100644 --- a/src/imat/MainViewController.java +++ b/src/imat/MainViewController.java @@ -16,6 +16,7 @@ import javafx.event.Event; import javafx.fxml.FXML; import javafx.fxml.Initializable; +import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; @@ -123,12 +124,11 @@ public void initialize(URL url, ResourceBundle rb) { void updateCart() { vboxCart.getChildren().clear(); + vboxCheckoutCart.getChildren().clear(); for (ShoppingItem shoppingItem : iMatDataHandler.getShoppingCart().getItems()) { vboxCart.getChildren().add(new CartCard(shoppingItem, this)); + vboxCheckoutCart.getChildren().add(new CartCard(shoppingItem, this)); } - vboxCheckoutCart.getChildren().clear(); - vboxCheckoutCart.getChildren().addAll(vboxCart.getChildren()); - vboxCart.getChildren().addAll(vboxCheckoutCart.getChildren()); labelCartTotal.setText(iMatDataHandler.getShoppingCart().getTotal() + " kr"); din_varukorg_antal_varor.setText( iMatDataHandler.getShoppingCart().getItems().size() + " varor klara för leverans hem till din dörr!"); diff --git a/src/imat/imat_app.fxml b/src/imat/imat_app.fxml index dc43eac..9b2e03d 100644 --- a/src/imat/imat_app.fxml +++ b/src/imat/imat_app.fxml @@ -479,165 +479,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + @@ -2190,38 +2036,199 @@ - - - - - + - + + + + + +