diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/Account.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/Account.java index 2e5bdc0..6d1d720 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/Account.java +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/Account.java @@ -4,17 +4,19 @@ public class Account { private String name; private String surname; private String email; + private String password; private String phone; private String street; private String city; private String cityCode; // 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) { this.name = name; this.surname = surname; this.email = email; + this.password = password; this.phone = phone; this.street = street; this.city = city; @@ -45,6 +47,14 @@ public class Account { this.email = email; } + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + public String getPhone() { return phone; } diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java index 439dd9a..858add7 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java @@ -14,6 +14,7 @@ import java.util.Objects; public class App extends Application { private static Scene scene; + public static Account account; @Override public void start(Stage stage) throws IOException { diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/LoginController.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/LoginController.java index 34063f7..0665726 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/LoginController.java +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/LoginController.java @@ -4,7 +4,10 @@ import java.io.IOException; import javafx.event.ActionEvent; import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; +import javafx.scene.control.ButtonType; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; @@ -132,20 +135,22 @@ public class LoginController { } @FXML - private void handleLoginButtonClick(MouseEvent event) { + private void handleLoginButtonClick(ActionEvent event) throws IOException { String username = usernameInput.getText(); String password = passwordInput.getText(); if (validateCredentials(username, password)) { - System.out.println("Login successful!"); - // Navigate to the main page or user dashboard + Alert alert = new Alert(AlertType.INFORMATION, "Login Successful.", ButtonType.OK); + alert.showAndWait(); + App.setRoot("shop"); } 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) { // Replace this with actual authentication logic - return "user".equals(username) && "password".equals(password); + return App.account.getEmail().equals(username) && App.account.getPassword().equals(password); } } diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/RegisterController.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/RegisterController.java index 1e627d7..dcee741 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/RegisterController.java +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/RegisterController.java @@ -2,50 +2,151 @@ package com.example; import java.io.IOException; +import javafx.event.ActionEvent; import javafx.fxml.FXML; +import javafx.scene.control.Alert; import javafx.scene.control.Button; +import javafx.scene.control.ButtonType; import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.scene.control.Alert.AlertType; 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 { - @FXML - private Label mainTitle; - @FXML private Button cartBtn; @FXML - private Button loginBtn; + private TextField cityCodeInput; @FXML - private TextField nameInput; - - @FXML - private TextField surnameInput; - - @FXML - private TextField emailInput; - - @FXML - private TextField phoneInput; - - @FXML - private TextField streetInput; + private Label cityCodeLabel; @FXML private TextField cityInput; @FXML - private TextField cityCodeInput; + private Label cityLabel; + + @FXML + private VBox contactUs; @FXML 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 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 void handleTitleClick(MouseEvent event) throws IOException { App.setRoot("shop"); @@ -62,31 +163,33 @@ public class RegisterController { } @FXML - private void handleCreateAccountButtonClick(MouseEvent event) { + private void handleCreateAccountButtonClick(ActionEvent event) throws IOException { String name = nameInput.getText(); String surname = surnameInput.getText(); String email = emailInput.getText(); + String password = passwordInput.getText(); String phone = phoneInput.getText(); String street = streetInput.getText(); String city = cityInput.getText(); String cityCode = cityCodeInput.getText(); - if (validateForm(name, surname, email, phone, street, city, cityCode)) { - System.out.println("Account created successfully!"); - System.out.println("Name: " + name + " " + surname); - System.out.println("Email: " + email); - System.out.println("Phone: " + phone); - System.out.println("Address: " + street + ", " + city + " - " + cityCode); - // Add logic to save user data or navigate to a new page + if (validateForm(name, surname, email, password, phone, street, city, cityCode)) { + App.account = new Account(name, surname, email, password, phone, street, city, cityCode); + Alert alert = new Alert(AlertType.INFORMATION, "Account created.", ButtonType.OK); + alert.showAndWait(); + App.setRoot("login"); } 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) { // 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()); } } diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/background b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/background deleted file mode 100644 index 31a0c60..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/background and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/background.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/background.png new file mode 100644 index 0000000..0721bb7 Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/background.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/earthsea.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/earthsea.jpg deleted file mode 100644 index 5278bc4..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/earthsea.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/earthsea.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/earthsea.png new file mode 100644 index 0000000..4992deb Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/earthsea.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/kingkiller.jpeg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/kingkiller.jpeg deleted file mode 100644 index f2d9670..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/kingkiller.jpeg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/kingkiller.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/kingkiller.png new file mode 100644 index 0000000..a17841f Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/kingkiller.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/lotr.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/lotr.jpg deleted file mode 100644 index 95a73e8..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/lotr.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/lotr.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/lotr.png new file mode 100644 index 0000000..36cc75a Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/lotr.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/mistborn.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/mistborn.jpg deleted file mode 100644 index d5e2ff2..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/mistborn.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/mistborn.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/mistborn.png new file mode 100644 index 0000000..607b532 Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/mistborn.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/narnia.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/narnia.jpg deleted file mode 100644 index 4e580df..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/narnia.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/narnia.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/narnia.png new file mode 100644 index 0000000..39e71e7 Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/narnia.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/stormlight.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/stormlight.jpg deleted file mode 100644 index 5ff0418..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/stormlight.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/stormlight.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/stormlight.png new file mode 100644 index 0000000..12cf40d Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/stormlight.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/theFirstLaw.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/theFirstLaw.jpg deleted file mode 100644 index 259c741..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/theFirstLaw.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/theFirstLaw.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/theFirstLaw.png new file mode 100644 index 0000000..d800c65 Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/theFirstLaw.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/wheel.jpg b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/wheel.jpg deleted file mode 100644 index 8a53c9a..0000000 Binary files a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/wheel.jpg and /dev/null differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/wheel.png b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/wheel.png new file mode 100644 index 0000000..bcc788d Binary files /dev/null and b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/images/wheel.png differ diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/login.fxml b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/login.fxml index 31b72f5..e5ff686 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/login.fxml +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/login.fxml @@ -86,7 +86,7 @@ - diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/register.fxml b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/register.fxml index 6c2043a..ee7974d 100644 --- a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/register.fxml +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/register.fxml @@ -57,6 +57,8 @@ -