fixed a bit of stuff

This commit is contained in:
Patrick 2025-01-13 21:49:14 +01:00
parent ee44560575
commit 88cc2680ad
50 changed files with 178 additions and 55 deletions

View file

@ -4,17 +4,19 @@ public class Account {
private String name; private String name;
private String surname; private String surname;
private String email; private String email;
private String password;
private String phone; private String phone;
private String street; private String street;
private String city; private String city;
private String cityCode; private String cityCode;
// Getters and setters for all fields // Getters and setters for all fields
public Account(String name, String surname, String email, String phone, String street, String city, public Account(String name, String surname, String email, String password, String phone, String street, String city,
String cityCode) { String cityCode) {
this.name = name; this.name = name;
this.surname = surname; this.surname = surname;
this.email = email; this.email = email;
this.password = password;
this.phone = phone; this.phone = phone;
this.street = street; this.street = street;
this.city = city; this.city = city;
@ -45,6 +47,14 @@ public class Account {
this.email = email; this.email = email;
} }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhone() { public String getPhone() {
return phone; return phone;
} }

View file

@ -14,6 +14,7 @@ import java.util.Objects;
public class App extends Application { public class App extends Application {
private static Scene scene; private static Scene scene;
public static Account account;
@Override @Override
public void start(Stage stage) throws IOException { public void start(Stage stage) throws IOException {

View file

@ -4,7 +4,10 @@ import java.io.IOException;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.PasswordField; import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
@ -132,20 +135,22 @@ public class LoginController {
} }
@FXML @FXML
private void handleLoginButtonClick(MouseEvent event) { private void handleLoginButtonClick(ActionEvent event) throws IOException {
String username = usernameInput.getText(); String username = usernameInput.getText();
String password = passwordInput.getText(); String password = passwordInput.getText();
if (validateCredentials(username, password)) { if (validateCredentials(username, password)) {
System.out.println("Login successful!"); Alert alert = new Alert(AlertType.INFORMATION, "Login Successful.", ButtonType.OK);
// Navigate to the main page or user dashboard alert.showAndWait();
App.setRoot("shop");
} else { } else {
System.out.println("Invalid username or password."); Alert alert = new Alert(AlertType.INFORMATION, "Account created.", ButtonType.OK);
alert.showAndWait();
} }
} }
private boolean validateCredentials(String username, String password) { private boolean validateCredentials(String username, String password) {
// Replace this with actual authentication logic // Replace this with actual authentication logic
return "user".equals(username) && "password".equals(password); return App.account.getEmail().equals(username) && App.account.getPassword().equals(password);
} }
} }

View file

@ -2,50 +2,151 @@ package com.example;
import java.io.IOException; import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
public class RegisterController { public class RegisterController {
@FXML
private Label mainTitle;
@FXML @FXML
private Button cartBtn; private Button cartBtn;
@FXML @FXML
private Button loginBtn; private TextField cityCodeInput;
@FXML @FXML
private TextField nameInput; private Label cityCodeLabel;
@FXML
private TextField surnameInput;
@FXML
private TextField emailInput;
@FXML
private TextField phoneInput;
@FXML
private TextField streetInput;
@FXML @FXML
private TextField cityInput; private TextField cityInput;
@FXML @FXML
private TextField cityCodeInput; private Label cityLabel;
@FXML
private VBox contactUs;
@FXML @FXML
private Button createAccountButton; private Button createAccountButton;
@FXML
private TextField emailInput;
@FXML
private Label emailLabel;
@FXML
private VBox followUs;
@FXML
private VBox footer;
@FXML
private Label footerAbout;
@FXML
private Label footerBluesky;
@FXML
private Label footerContact;
@FXML
private VBox footerCopy;
@FXML @FXML
private Label footerCopyText; private Label footerCopyText;
@FXML
private Label footerEmail;
@FXML
private Label footerFacebook;
@FXML
private Label footerHeading2;
@FXML
private Label footerHeading3;
@FXML
private Label footerHome;
@FXML
private Label footerInstagram;
@FXML
private HBox footerLinks;
@FXML
private Label footerPhone;
@FXML
private Label footerText;
@FXML
private VBox formFields;
@FXML
private Label formTitle;
@FXML
private HBox header;
@FXML
private Button loginBtn;
@FXML
private GridPane mainGrid;
@FXML
private Label mainTitle;
@FXML
private TextField nameInput;
@FXML
private Label nameLabel;
@FXML
private TextField passwordInput;
@FXML
private Label passwordLabel;
@FXML
private TextField phoneInput;
@FXML
private Label phoneLabel;
@FXML
private VBox quickLinks;
@FXML
private Pane spacerPane;
@FXML
private TextField streetInput;
@FXML
private Label streetLabel;
@FXML
private TextField surnameInput;
@FXML
private Label surnameLabel;
@FXML @FXML
void handleTitleClick(MouseEvent event) throws IOException { void handleTitleClick(MouseEvent event) throws IOException {
App.setRoot("shop"); App.setRoot("shop");
@ -62,31 +163,33 @@ public class RegisterController {
} }
@FXML @FXML
private void handleCreateAccountButtonClick(MouseEvent event) { private void handleCreateAccountButtonClick(ActionEvent event) throws IOException {
String name = nameInput.getText(); String name = nameInput.getText();
String surname = surnameInput.getText(); String surname = surnameInput.getText();
String email = emailInput.getText(); String email = emailInput.getText();
String password = passwordInput.getText();
String phone = phoneInput.getText(); String phone = phoneInput.getText();
String street = streetInput.getText(); String street = streetInput.getText();
String city = cityInput.getText(); String city = cityInput.getText();
String cityCode = cityCodeInput.getText(); String cityCode = cityCodeInput.getText();
if (validateForm(name, surname, email, phone, street, city, cityCode)) { if (validateForm(name, surname, email, password, phone, street, city, cityCode)) {
System.out.println("Account created successfully!"); App.account = new Account(name, surname, email, password, phone, street, city, cityCode);
System.out.println("Name: " + name + " " + surname); Alert alert = new Alert(AlertType.INFORMATION, "Account created.", ButtonType.OK);
System.out.println("Email: " + email); alert.showAndWait();
System.out.println("Phone: " + phone); App.setRoot("login");
System.out.println("Address: " + street + ", " + city + " - " + cityCode);
// Add logic to save user data or navigate to a new page
} else { } else {
System.out.println("Please fill in all the fields correctly."); Alert alert = new Alert(AlertType.ERROR, "You have to fill all fields!", ButtonType.OK);
alert.showAndWait();
} }
} }
private boolean validateForm(String name, String surname, String email, String phone, String street, String city, private boolean validateForm(String name, String surname, String email, String password, String phone,
String street, String city,
String cityCode) { String cityCode) {
// Basic validation to ensure no fields are empty // Basic validation to ensure no fields are empty
return !(name.isEmpty() || surname.isEmpty() || email.isEmpty() || phone.isEmpty() || street.isEmpty() return !(name.isEmpty() || surname.isEmpty() || email.isEmpty() || password.isEmpty() || phone.isEmpty()
|| street.isEmpty()
|| city.isEmpty() || cityCode.isEmpty()); || city.isEmpty() || cityCode.isEmpty());
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 KiB

View file

@ -86,7 +86,7 @@
<VBox fx:id="formFields" spacing="15.0"> <VBox fx:id="formFields" spacing="15.0">
<!-- Username Field --> <!-- Username Field -->
<VBox spacing="5.0"> <VBox spacing="5.0">
<Label fx:id="usernameLabel" styleClass="formLabel" text="Username" /> <Label fx:id="usernameLabel" styleClass="formLabel" text="E-Mail" />
<TextField fx:id="usernameInput" styleClass="formInput" /> <TextField fx:id="usernameInput" styleClass="formInput" />
</VBox> </VBox>
<!-- Password Field --> <!-- Password Field -->

View file

@ -57,6 +57,8 @@
<Label id="emailLabel" fx:id="emailLabel" styleClass="formLabel" text="Email address" /> <Label id="emailLabel" fx:id="emailLabel" styleClass="formLabel" text="Email address" />
<TextField id="emailInput" fx:id="emailInput" styleClass="formInput" /> <TextField id="emailInput" fx:id="emailInput" styleClass="formInput" />
<Label id="emailLabel" fx:id="passwordLabel" styleClass="formLabel" text="Password" />
<TextField id="emailInput" fx:id="passwordInput" styleClass="formInput" />
<Label id="phoneLabel" fx:id="phoneLabel" styleClass="formLabel" text="Phone number" /> <Label id="phoneLabel" fx:id="phoneLabel" styleClass="formLabel" text="Phone number" />
<TextField id="phoneInput" fx:id="phoneInput" styleClass="formInput" /> <TextField id="phoneInput" fx:id="phoneInput" styleClass="formInput" />
@ -71,7 +73,7 @@
<TextField id="cityCodeInput" fx:id="cityCodeInput" styleClass="formInput" /> <TextField id="cityCodeInput" fx:id="cityCodeInput" styleClass="formInput" />
</children> </children>
</VBox> </VBox>
<Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" /> <Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" onAction="#handleCreateAccountButtonClick" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" />
</children> </children>
</GridPane> </GridPane>
</center> </center>

View file

@ -5,7 +5,7 @@
-fx-padding: 20; -fx-padding: 20;
-fx-hgap: 20; -fx-hgap: 20;
-fx-vgap: 20; -fx-vgap: 20;
-fx-background-image: url("images/background"); -fx-background-image: url("images/background.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-position: center center; -fx-background-position: center center;
-fx-background-blend-mode: overlay; -fx-background-blend-mode: overlay;
@ -98,35 +98,35 @@
} }
#cardDiv1 { #cardDiv1 {
-fx-background-image: url("images/lotr.jpg"); -fx-background-image: url("images/lotr.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv2 { #cardDiv2 {
-fx-background-image: url("images/wheel.jpg"); -fx-background-image: url("images/wheel.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv3 { #cardDiv3 {
-fx-background-image: url("images/narnia.jpg"); -fx-background-image: url("images/narnia.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv4 { #cardDiv4 {
-fx-background-image: url("images/earthsea.jpg"); -fx-background-image: url("images/earthsea.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv5 { #cardDiv5 {
-fx-background-image: url("images/theFirstLaw.jpg"); -fx-background-image: url("images/theFirstLaw.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
@ -140,14 +140,14 @@
} }
#cardDiv7 { #cardDiv7 {
-fx-background-image: url("images/mistborn.jpg"); -fx-background-image: url("images/mistborn.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv8 { #cardDiv8 {
-fx-background-image: url("images/stormlight.jpg"); -fx-background-image: url("images/stormlight.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 KiB

View file

@ -86,7 +86,7 @@
<VBox fx:id="formFields" spacing="15.0"> <VBox fx:id="formFields" spacing="15.0">
<!-- Username Field --> <!-- Username Field -->
<VBox spacing="5.0"> <VBox spacing="5.0">
<Label fx:id="usernameLabel" styleClass="formLabel" text="Username" /> <Label fx:id="usernameLabel" styleClass="formLabel" text="E-Mail" />
<TextField fx:id="usernameInput" styleClass="formInput" /> <TextField fx:id="usernameInput" styleClass="formInput" />
</VBox> </VBox>
<!-- Password Field --> <!-- Password Field -->

View file

@ -57,6 +57,8 @@
<Label id="emailLabel" fx:id="emailLabel" styleClass="formLabel" text="Email address" /> <Label id="emailLabel" fx:id="emailLabel" styleClass="formLabel" text="Email address" />
<TextField id="emailInput" fx:id="emailInput" styleClass="formInput" /> <TextField id="emailInput" fx:id="emailInput" styleClass="formInput" />
<Label id="emailLabel" fx:id="passwordLabel" styleClass="formLabel" text="Password" />
<TextField id="emailInput" fx:id="passwordInput" styleClass="formInput" />
<Label id="phoneLabel" fx:id="phoneLabel" styleClass="formLabel" text="Phone number" /> <Label id="phoneLabel" fx:id="phoneLabel" styleClass="formLabel" text="Phone number" />
<TextField id="phoneInput" fx:id="phoneInput" styleClass="formInput" /> <TextField id="phoneInput" fx:id="phoneInput" styleClass="formInput" />
@ -71,7 +73,7 @@
<TextField id="cityCodeInput" fx:id="cityCodeInput" styleClass="formInput" /> <TextField id="cityCodeInput" fx:id="cityCodeInput" styleClass="formInput" />
</children> </children>
</VBox> </VBox>
<Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" /> <Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" onAction="#handleCreateAccountButtonClick" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" />
</children> </children>
</GridPane> </GridPane>
</center> </center>

View file

@ -5,7 +5,7 @@
-fx-padding: 20; -fx-padding: 20;
-fx-hgap: 20; -fx-hgap: 20;
-fx-vgap: 20; -fx-vgap: 20;
-fx-background-image: url("images/background"); -fx-background-image: url("images/background.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-position: center center; -fx-background-position: center center;
-fx-background-blend-mode: overlay; -fx-background-blend-mode: overlay;
@ -98,35 +98,35 @@
} }
#cardDiv1 { #cardDiv1 {
-fx-background-image: url("images/lotr.jpg"); -fx-background-image: url("images/lotr.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv2 { #cardDiv2 {
-fx-background-image: url("images/wheel.jpg"); -fx-background-image: url("images/wheel.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv3 { #cardDiv3 {
-fx-background-image: url("images/narnia.jpg"); -fx-background-image: url("images/narnia.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv4 { #cardDiv4 {
-fx-background-image: url("images/earthsea.jpg"); -fx-background-image: url("images/earthsea.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv5 { #cardDiv5 {
-fx-background-image: url("images/theFirstLaw.jpg"); -fx-background-image: url("images/theFirstLaw.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
@ -140,14 +140,14 @@
} }
#cardDiv7 { #cardDiv7 {
-fx-background-image: url("images/mistborn.jpg"); -fx-background-image: url("images/mistborn.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;
} }
#cardDiv8 { #cardDiv8 {
-fx-background-image: url("images/stormlight.jpg"); -fx-background-image: url("images/stormlight.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
-fx-background-position: center; -fx-background-position: center;