Skip to content

Commit

Permalink
Items show up in both cart and checkout now.
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-wg committed May 28, 2023
1 parent e15db5d commit 08e0acc
Show file tree
Hide file tree
Showing 2 changed files with 567 additions and 567 deletions.
6 changes: 3 additions & 3 deletions src/imat/MainViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!");
Expand Down
Loading

0 comments on commit 08e0acc

Please sign in to comment.