ready for testing

This commit is contained in:
Patrick 2025-01-13 22:14:40 +01:00
parent 88cc2680ad
commit fa36d02929
15 changed files with 33 additions and 45 deletions

View file

@ -1,19 +0,0 @@
The Earthsea Cycle
The Chronicles of Narnia
The Mistborn Series
The Earthsea Cycle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Kingkiller Chronicle
The Wheel of Time

View file

@ -76,12 +76,12 @@ public class CartController {
}
@FXML
private void handleCartButton() throws IOException {
private void handleCartButton(ActionEvent event) throws IOException {
App.setRoot("cart");
}
@FXML
private void handleLoginButton() throws IOException {
private void handleLoginButton(ActionEvent event) throws IOException {
App.setRoot("login");
}

View file

@ -1,10 +1,14 @@
package com.example;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.input.MouseEvent;
public class CheckOutController {
@ -78,12 +82,12 @@ public class CheckOutController {
}
@FXML
private void handleCartButton() throws IOException {
private void handleCartButton(ActionEvent event) throws IOException {
App.setRoot("cart");
}
@FXML
private void handleLoginButton() throws IOException {
private void handleLoginButton(ActionEvent event) throws IOException {
App.setRoot("login");
}
@ -109,12 +113,13 @@ public class CheckOutController {
// Validate the input fields
if (fullName.isEmpty() || address.isEmpty() || city.isEmpty() || zip.isEmpty() || cardNumber.isEmpty()
|| cardHolderName.isEmpty() || expiryDate.isEmpty() || cvv.isEmpty()) {
System.out.println("Please fill out all fields.");
|| cardHolderName.isEmpty() || expiryDate.isEmpty() || cvv.isEmpty() || country.isEmpty()) {
Alert alert = new Alert(AlertType.ERROR, "Please fill out all fields.", ButtonType.OK);
alert.showAndWait();
} else {
System.out.println("Form submitted successfully.");
System.out.printf("Billing Info: %s, %s, %s, %s, %s\n", fullName, address, city, zip, country);
System.out.printf("Credit Card Info: %s, %s, %s, CVV: %s\n", cardNumber, cardHolderName, expiryDate, cvv);
Alert alert = new Alert(AlertType.INFORMATION, "Form submitted successfully.", ButtonType.OK);
alert.showAndWait();
FileWriter fileWriter = new FileWriter("cart.txt", false);
App.setRoot("shop");
}
}

View file

@ -130,7 +130,7 @@ public class LoginController {
}
@FXML
private void handleCartButton() throws IOException {
private void handleCartButton(ActionEvent event) throws IOException {
App.setRoot("cart");
}

View file

@ -153,12 +153,12 @@ public class RegisterController {
}
@FXML
private void handleCartButton() throws IOException {
private void handleCartButton(ActionEvent event) throws IOException {
App.setRoot("cart");
}
@FXML
private void handleLoginButton() throws IOException {
private void handleLoginButton(ActionEvent event) throws IOException {
App.setRoot("login");
}

View file

@ -3,6 +3,8 @@ package com.example;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
@ -43,53 +45,53 @@ public class ShopController {
}
@FXML
private void handleCartButton() throws IOException {
private void handleCartButton(ActionEvent event) throws IOException {
App.setRoot("cart");
}
@FXML
private void handleLoginButton() throws IOException {
private void handleLoginButton(ActionEvent event) throws IOException {
App.setRoot("login");
}
// Book Addition Handlers
@FXML
private void handleAddToCartButton1() {
private void handleAddToCartButton1(ActionEvent event) {
addToCart("Lord of the Rings");
}
@FXML
private void handleAddToCartButton2() {
private void handleAddToCartButton2(ActionEvent event) {
addToCart("The Wheel of Time");
}
@FXML
private void handleAddToCartButton3() {
private void handleAddToCartButton3(ActionEvent event) {
addToCart("The Chronicles of Narnia");
}
@FXML
private void handleAddToCartButton4() {
private void handleAddToCartButton4(ActionEvent event) {
addToCart("The Earthsea Cycle");
}
@FXML
private void handleAddToCartButton5() {
private void handleAddToCartButton5(ActionEvent event) {
addToCart("The First Law Trilogy");
}
@FXML
private void handleAddToCartButton6() {
private void handleAddToCartButton6(ActionEvent event) {
addToCart("The Kingkiller Chronicle");
}
@FXML
private void handleAddToCartButton7() {
private void handleAddToCartButton7(ActionEvent event) {
addToCart("The Mistborn Series");
}
@FXML
private void handleAddToCartButton8() {
private void handleAddToCartButton8(ActionEvent event) {
addToCart("The Stormlight Archive");
}

View file

@ -41,7 +41,7 @@
<Insets />
</BorderPane.margin>
<children>
<Button fx:id="btnCheckOut" mnemonicParsing="false" onMouseClicked="#handleCheckOutButton" styleClass="btnCheckOut" text="Check out" GridPane.rowIndex="2" />
<Button fx:id="btnCheckOut" mnemonicParsing="false" onAction="#handleCheckOutButton" styleClass="btnCheckOut" text="Check out" GridPane.rowIndex="2" />
<Label fx:id="cartTitle" styleClass="cartTitle" text="Your cart" />
<TableView fx:id="cartContent" prefHeight="0.0" prefWidth="364.0" GridPane.rowIndex="1">
<columns>

View file

@ -113,7 +113,7 @@
<Label fx:id="cvvLabel" text="CVV:" textFill="WHITE" />
<PasswordField fx:id="cvvField" />
</HBox>
<Button fx:id="submitButton" alignment="CENTER" contentDisplay="CENTER" prefWidth="150" style="-fx-alignment: #4CAF50; -fx-text-fill: white; -fx-font-size: 16px; -fx-font-weight: bold;" styleClass="cartBtn" text="Submit" GridPane.columnSpan="2" GridPane.rowIndex="9" />
<Button fx:id="submitButton" alignment="CENTER" onAction="#handleSubmit" contentDisplay="CENTER" prefWidth="150" style="-fx-alignment: #4CAF50; -fx-text-fill: white; -fx-font-size: 16px; -fx-font-weight: bold;" styleClass="cartBtn" text="Submit" GridPane.columnSpan="2" GridPane.rowIndex="9" />
</children>
<columnConstraints>
<ColumnConstraints />

View file

@ -41,7 +41,7 @@
<Insets />
</BorderPane.margin>
<children>
<Button fx:id="btnCheckOut" mnemonicParsing="false" onMouseClicked="#handleCheckOutButton" styleClass="btnCheckOut" text="Check out" GridPane.rowIndex="2" />
<Button fx:id="btnCheckOut" mnemonicParsing="false" onAction="#handleCheckOutButton" styleClass="btnCheckOut" text="Check out" GridPane.rowIndex="2" />
<Label fx:id="cartTitle" styleClass="cartTitle" text="Your cart" />
<TableView fx:id="cartContent" prefHeight="0.0" prefWidth="364.0" GridPane.rowIndex="1">
<columns>

View file

@ -113,7 +113,7 @@
<Label fx:id="cvvLabel" text="CVV:" textFill="WHITE" />
<PasswordField fx:id="cvvField" />
</HBox>
<Button fx:id="submitButton" alignment="CENTER" contentDisplay="CENTER" prefWidth="150" style="-fx-alignment: #4CAF50; -fx-text-fill: white; -fx-font-size: 16px; -fx-font-weight: bold;" styleClass="cartBtn" text="Submit" GridPane.columnSpan="2" GridPane.rowIndex="9" />
<Button fx:id="submitButton" alignment="CENTER" onAction="#handleSubmit" contentDisplay="CENTER" prefWidth="150" style="-fx-alignment: #4CAF50; -fx-text-fill: white; -fx-font-size: 16px; -fx-font-weight: bold;" styleClass="cartBtn" text="Submit" GridPane.columnSpan="2" GridPane.rowIndex="9" />
</children>
<columnConstraints>
<ColumnConstraints />