diff --git a/src/main/java/app/Main.java b/src/main/java/app/Main.java index a1c0d3e..e9947a6 100644 --- a/src/main/java/app/Main.java +++ b/src/main/java/app/Main.java @@ -29,7 +29,7 @@ public static void main(String[] args) { @Override public void start(Stage stage) throws Exception { Database.initializeDatabase(); - + System.out.println("DB path: " + new java.io.File("givehope.db").getAbsolutePath()); OrganizationDao orgDao = new OrganizationDao(); Organization[] orgs = InnsamlingskontrollenClient.fetchOrganizations(); for (Organization org : orgs) { diff --git a/src/main/java/application/user/UserDonate.java b/src/main/java/application/user/UserDonate.java new file mode 100644 index 0000000..bf8f187 --- /dev/null +++ b/src/main/java/application/user/UserDonate.java @@ -0,0 +1,21 @@ +package application.user; + +import domain.donation.Donation; +import domain.organization.Organization; +import domain.user.User; +import persistence.DonationDao; + +import java.math.BigDecimal; + +public class UserDonate { + private final DonationDao donationDao; + + public UserDonate() { + this.donationDao = new DonationDao(); + } + + public void execute(User user, Organization org, BigDecimal amount) { + Donation donation = new Donation(amount, user, org); + donationDao.insert(donation); + } +} diff --git a/src/main/java/domain/user/User.java b/src/main/java/domain/user/User.java index 69a51b8..10c5efb 100644 --- a/src/main/java/domain/user/User.java +++ b/src/main/java/domain/user/User.java @@ -39,7 +39,7 @@ public String getPhoneNumber() { return phoneNumber; } - public String getEMail() { + public String getEmail() { return eMail; } diff --git a/src/main/java/persistence/DonationDao.java b/src/main/java/persistence/DonationDao.java index d467e99..9e70812 100644 --- a/src/main/java/persistence/DonationDao.java +++ b/src/main/java/persistence/DonationDao.java @@ -28,6 +28,10 @@ public class DonationDao { * @throws RuntimeException if a database error occurs during the insert */ public void insert(Donation donation) { + System.out.println("Inserting donation:"); + System.out.println(" user_id = " + donation.getUser().getID()); + System.out.println(" org_id = " + donation.getOrganization().getOrgNumber()); + String sql = "INSERT INTO donation(amount, donation_date" + ", user_id, organization_id) VALUES(?, ?, ?, ?)"; @@ -202,6 +206,7 @@ SELECT SUM(CAST(amount as REAL)) ResultSet rs = stmt.executeQuery(); if (rs.next()) { BigDecimal amount = rs.getBigDecimal(1); + if (amount == null) return "0"; return amount.toString(); } return "0"; @@ -272,11 +277,4 @@ private String mapRowFavorite(ResultSet rs) throws SQLException { return rs.getString("name") + " (" + rs.getInt("donation_count") + " donasjoner)"; } - - - - - - - -} \ No newline at end of file +} diff --git a/src/main/java/persistence/UserDao.java b/src/main/java/persistence/UserDao.java index 2fa7765..d343376 100644 --- a/src/main/java/persistence/UserDao.java +++ b/src/main/java/persistence/UserDao.java @@ -21,7 +21,7 @@ public void insert(User user) { stmt.setString(1, user.getUsername()); stmt.setString(2, user.getPhoneNumber()); - stmt.setString(3, user.getEMail()); + stmt.setString(3, user.getEmail()); //endre denne til passwordhash når det er fikset. stmt.setString(4, user.getPassword()); diff --git a/src/main/java/ui/DonationSession.java b/src/main/java/ui/DonationSession.java new file mode 100644 index 0000000..991f91a --- /dev/null +++ b/src/main/java/ui/DonationSession.java @@ -0,0 +1,52 @@ +package ui; + +import domain.organization.Organization; + +public class DonationSession { + private Organization organization; + private int amount; + private String name; + private String email; + private String phone; + + public Organization getOrganization() { + return organization; + } + + public int getAmount() { + return amount; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + public String getPhone() { + return phone; + } + + public void setOrganization(Organization organization) { + this.organization = organization; + } + + public void setAmount(int amount) { + this.amount = amount; + } + + public void setName(String name) { + this.name = name; + } + + public void setEmail(String email) { + this.email = email; + } + + public void setPhone(String phone) { + this.phone = phone; + } +} + diff --git a/src/main/java/ui/DonationSessionAware.java b/src/main/java/ui/DonationSessionAware.java new file mode 100644 index 0000000..8ceab22 --- /dev/null +++ b/src/main/java/ui/DonationSessionAware.java @@ -0,0 +1,5 @@ +package ui; + +public interface DonationSessionAware { + void setDonationSession(DonationSession session); +} diff --git a/src/main/java/ui/Page.java b/src/main/java/ui/Page.java index e2066c8..d926d43 100644 --- a/src/main/java/ui/Page.java +++ b/src/main/java/ui/Page.java @@ -3,10 +3,15 @@ public enum Page { HOME("Home.fxml"), PROFILE("MyProfile.fxml"), - SIGNIN("SignIn.fxml"), + SIGN_IN("SignIn.fxml"), REGISTER("Register.fxml"), ORGANIZATIONS("OrganizationsView.fxml"), - MYPROFILE("MyProfile.fxml"); + MY_PROFILE("MyProfile.fxml"), + DONATION_NOT_LOGGED_IN("DonationNotLoggedIn.fxml"), + DONATION_AMOUNT("DonationAmount.fxml"), + DONATION_PAYMENT("DonationPayment.fxml"), + DONATION_CONFIRMATION("DonationConfirmation.fxml"); + private final String fileName; diff --git a/src/main/java/ui/controller/HomeController.java b/src/main/java/ui/controller/HomeController.java index 8aafbd2..5d5a217 100644 --- a/src/main/java/ui/controller/HomeController.java +++ b/src/main/java/ui/controller/HomeController.java @@ -19,13 +19,6 @@ public void setOnNavigate(Consumer onNavigate) { this.onNavigate = onNavigate; } - public Button signInButton; - - @FXML - private void handleSignIn() throws IOException { - onNavigate.accept(Page.SIGNIN); - } - @FXML private void handleBrowseOrganizations() { onNavigate.accept(Page.ORGANIZATIONS); diff --git a/src/main/java/ui/controller/MainController.java b/src/main/java/ui/controller/MainController.java index 1586f28..b7077fc 100644 --- a/src/main/java/ui/controller/MainController.java +++ b/src/main/java/ui/controller/MainController.java @@ -2,13 +2,17 @@ import application.user.UserRegister; import application.user.UserSignIn; +import domain.organization.Organization; import integration.security.Sha256PasswordHasher; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.layout.BorderPane; import persistence.UserDao; +import ui.DonationSession; import ui.Page; +import ui.DonationSessionAware; +import ui.controller.donation.DonationFlowController; import java.io.IOException; @@ -20,7 +24,17 @@ public class MainController { @FXML private NavbarController navbarController; + private DonationSession donationSession; + private DonationFlowController donationFlowController; + public void initialize() { + donationFlowController = new DonationFlowController(mainPane, navbarController); + donationFlowController.setOnNavigate(page -> { + try { loadPage(page); } + catch (IOException e) { throw new RuntimeException(e); } + }); + + try { navbarController.setOnNavigate(page -> { try { @@ -49,15 +63,30 @@ public void loadPage(Page page) throws IOException { } }); } + if (controller instanceof OrganizationController c) { + c.setOnDonate(org -> { + try { loadDonationPage(org); } + catch (IOException e) { throw new RuntimeException(e); } + }); + + } if (controller instanceof SignInController c) { c.setUserSignIn(new UserSignIn(new Sha256PasswordHasher(), new UserDao())); } if (controller instanceof RegisterController c) { c.setUserRegister(new UserRegister(new Sha256PasswordHasher(), new UserDao())); } + if (controller instanceof DonationSessionAware c) { + c.setDonationSession(donationSession); + } mainPane.setCenter(root); navbarController.setActivePage(page); navbarController.updateAuthButton(); + navbarController.showNavbar(); + } + + public void loadDonationPage(Organization org) throws IOException { + donationFlowController.start(org); } } diff --git a/src/main/java/ui/controller/MyProfileController.java b/src/main/java/ui/controller/MyProfileController.java index f6b82ff..2af08f7 100644 --- a/src/main/java/ui/controller/MyProfileController.java +++ b/src/main/java/ui/controller/MyProfileController.java @@ -37,11 +37,11 @@ public void setOnNavigate(Consumer onNavigate) { @FXML public void initialize() { - User user = SessionManager.getCurrentUser(); + User user = SessionManager.getSignedInUser(); if (user == null) return; nameLabel.setText("Name: " + user.getUsername()); - emailLabel.setText("E-mail: " + user.getEMail()); + emailLabel.setText("E-mail: " + user.getEmail()); phoneLabel.setText("Phonenumber: " + user.getPhoneNumber()); UserStatistics stats = new UserStatistics(); diff --git a/src/main/java/ui/controller/NavbarController.java b/src/main/java/ui/controller/NavbarController.java index 24e7aac..18a56ea 100644 --- a/src/main/java/ui/controller/NavbarController.java +++ b/src/main/java/ui/controller/NavbarController.java @@ -4,6 +4,7 @@ import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.layout.HBox; import ui.Page; import util.SessionManager; @@ -11,6 +12,8 @@ public class NavbarController { private Consumer onNavigate; @FXML + private HBox navBar; + @FXML private Button homeBtn; @FXML private Button orgBtn; @@ -29,7 +32,7 @@ public void setActivePage(Page page) { Button buttonForPage = switch (page) { case HOME -> homeBtn; case ORGANIZATIONS -> orgBtn; - case SIGNIN, PROFILE -> signInBtn; + case SIGN_IN, PROFILE -> signInBtn; default -> null; }; @@ -46,7 +49,7 @@ public void goToSignIn() { if (SessionManager.isSignedIn()) { onNavigate.accept(Page.PROFILE); } else { - onNavigate.accept(Page.SIGNIN); + onNavigate.accept(Page.SIGN_IN); } } @@ -54,9 +57,6 @@ public void goToOrganizations() { onNavigate.accept(Page.ORGANIZATIONS); } - public void goToMyProfile() { - onNavigate.accept(Page.PROFILE); - } public void updateAuthButton() { if (SessionManager.isSignedIn()) { @@ -65,4 +65,20 @@ public void updateAuthButton() { signInBtn.setText("Sign In"); } } + + public void clearActivePage() { + homeBtn.getStyleClass().remove("nav-button-active"); + orgBtn.getStyleClass().remove("nav-button-active"); + signInBtn.getStyleClass().remove("nav-button-active"); + } + + public void hideNavbar() { + navBar.setVisible(false); + navBar.setManaged(false); + } + + public void showNavbar() { + navBar.setVisible(true); + navBar.setManaged(true); + } } diff --git a/src/main/java/ui/controller/OrganizationController.java b/src/main/java/ui/controller/OrganizationController.java index 547c746..e5f4ac2 100644 --- a/src/main/java/ui/controller/OrganizationController.java +++ b/src/main/java/ui/controller/OrganizationController.java @@ -1,10 +1,7 @@ package ui.controller; -import application.security.PasswordHasher; -import application.user.UserSignIn; import domain.organization.Organization; -import integration.security.Sha256PasswordHasher; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; @@ -12,18 +9,15 @@ import javafx.scene.layout.FlowPane; import javafx.scene.layout.VBox; import persistence.OrganizationDao; -import persistence.UserDao; import ui.Page; -import util.SessionManager; -import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import java.util.stream.Collectors; -public class OrganizationController { +public class OrganizationController implements NavigationAware{ @FXML private TextField searchField; @@ -35,8 +29,6 @@ public class OrganizationController { private Button nextPageBtn; @FXML private Label pageLabel; - @FXML - private Button signInAndMyProfileBtn; private List allOrgs; private List filtrertOrgs; @@ -44,11 +36,16 @@ public class OrganizationController { private final int PER_PAGE = 15; private Consumer onNavigate; + private Consumer onDonate; public void setOnNavigate(Consumer onNavigate) { this.onNavigate = onNavigate; } + public void setOnDonate(Consumer onDonate) { + this.onDonate = onDonate; + } + public void initialize() { try { OrganizationDao dao = new OrganizationDao(); @@ -117,11 +114,12 @@ private VBox createCard(Organization org) { Label status = new Label(org.isPreApproved() ? "✓ Forhåndsgodkjent" : "✓ Verified"); status.getStyleClass().add("org-status"); - Button donasjonBtn = new Button("Donate"); - donasjonBtn.getStyleClass().add("donate-button"); - donasjonBtn.setMaxWidth(Double.MAX_VALUE); + Button donateBtn = new Button("Donate"); + donateBtn.getStyleClass().add("donate-button"); + donateBtn.setMaxWidth(Double.MAX_VALUE); + donateBtn.setOnAction(e -> onDonate.accept(org)); - card.getChildren().addAll(name, orgnr, status, donasjonBtn); + card.getChildren().addAll(name, orgnr, status, donateBtn); return card; } @@ -137,14 +135,4 @@ private void nextPage() { showPage(); } - @FXML - private void handleGoHome() { - onNavigate.accept(Page.HOME); - } - - @FXML - private void handleSignIn() { - onNavigate.accept(Page.SIGNIN); - } - } diff --git a/src/main/java/ui/controller/RegisterController.java b/src/main/java/ui/controller/RegisterController.java index 9db9bb4..a43a47d 100644 --- a/src/main/java/ui/controller/RegisterController.java +++ b/src/main/java/ui/controller/RegisterController.java @@ -1,17 +1,12 @@ package ui.controller; -import application.security.PasswordHasher; import application.user.UserRegister; -import application.user.UserSignIn; -import integration.security.Sha256PasswordHasher; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; -import persistence.UserDao; import ui.Page; -import java.io.IOException; import java.util.function.Consumer; public class RegisterController implements NavigationAware { @@ -56,7 +51,7 @@ private void handleRegister() { try { userRegister.execute(username, phoneNr, password, email); - onNavigate.accept(Page.SIGNIN); + onNavigate.accept(Page.SIGN_IN); } catch (IllegalArgumentException e) { errorLabel.setText(e.getMessage()); } @@ -64,7 +59,7 @@ private void handleRegister() { @FXML private void handleSignIn() { - onNavigate.accept(Page.SIGNIN); + onNavigate.accept(Page.SIGN_IN); } @FXML diff --git a/src/main/java/ui/controller/donation/DonationAmountController.java b/src/main/java/ui/controller/donation/DonationAmountController.java new file mode 100644 index 0000000..064c07d --- /dev/null +++ b/src/main/java/ui/controller/donation/DonationAmountController.java @@ -0,0 +1,79 @@ +package ui.controller.donation; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import ui.DonationSession; +import ui.DonationSessionAware; + + +import java.util.function.Consumer; + +public class DonationAmountController implements DonationSessionAware { + + @FXML private Label orgLabel; + @FXML private TextField amountField; + @FXML private Label errorLabel; + + private DonationSession donationSession; + private Consumer onContinue; + private Runnable onBack; + + @Override + public void setDonationSession(DonationSession donationSession) { + this.donationSession = donationSession; + orgLabel.setText("Donating to: " + donationSession.getOrganization().getName()); + } + + public void setOnContinue(Consumer onContinue) { + this.onContinue = onContinue; + } + + public void setOnBack(Runnable onBack) { + this.onBack = onBack; + } + + @FXML + public void handleContinue() { + if (amountField.getText().isBlank()) { + errorLabel.setText("Please enter an amount."); + return; + } + try { + int amount = Integer.parseInt(amountField.getText().trim()); + if (amount <= 0) { + errorLabel.setText("Please enter an amount greater than 0."); + return; + } + donationSession.setAmount(amount); + onContinue.accept(donationSession); + } catch (NumberFormatException e) { + errorLabel.setText("Please enter a valid number."); + } + } + + @FXML + private void handleBack() { + onBack.run(); + } + + @FXML + private void handleSelect50() { + amountField.setText("50"); + } + + @FXML + private void handleSelect100() { + amountField.setText("100"); + } + + @FXML + private void handleSelect500() { + amountField.setText("500"); + } + + @FXML + private void handleSelect1000() { + amountField.setText("1000"); + } +} diff --git a/src/main/java/ui/controller/donation/DonationConfirmationController.java b/src/main/java/ui/controller/donation/DonationConfirmationController.java new file mode 100644 index 0000000..7fe397c --- /dev/null +++ b/src/main/java/ui/controller/donation/DonationConfirmationController.java @@ -0,0 +1,36 @@ +package ui.controller.donation; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import ui.DonationSession; +import ui.DonationSessionAware; +import ui.Page; +import ui.controller.NavigationAware; + +import java.util.function.Consumer; + +public class DonationConfirmationController implements NavigationAware, DonationSessionAware { + + @FXML private Label orgLabel; + @FXML private Label amountLabel; + + private Consumer onNavigate; + private DonationSession donationSession; + + @Override + public void setOnNavigate(Consumer onNavigate) { + this.onNavigate = onNavigate; + } + + @Override + public void setDonationSession(DonationSession session) { + this.donationSession = session; + orgLabel.setText(session.getOrganization().getName()); + amountLabel.setText(session.getAmount() + " kr"); + } + + @FXML + private void handleBackToHome() { + onNavigate.accept(Page.HOME); + } +} diff --git a/src/main/java/ui/controller/donation/DonationFlowController.java b/src/main/java/ui/controller/donation/DonationFlowController.java new file mode 100644 index 0000000..f9d014a --- /dev/null +++ b/src/main/java/ui/controller/donation/DonationFlowController.java @@ -0,0 +1,119 @@ +package ui.controller.donation; + +import application.user.UserDonate; +import domain.organization.Organization; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.layout.BorderPane; +import ui.DonationSession; +import ui.Page; +import ui.controller.NavbarController; +import util.SessionManager; + +import java.io.IOException; +import java.math.BigDecimal; +import java.util.function.Consumer; + +public class DonationFlowController { + private final BorderPane mainPane; + private final NavbarController navbarController; + private DonationSession session; + private Consumer onNavigate; + private final UserDonate userDonate = new UserDonate(); + + public DonationFlowController(BorderPane mainPane, NavbarController navbarController) { + this.mainPane = mainPane; + this.navbarController = navbarController; + } + + public void start(Organization org) throws IOException { + session = new DonationSession(); + session.setOrganization(org); + navbarController.hideNavbar(); + + if (SessionManager.isSignedIn()) { + loadStep2(); + } else { + loadStep1(); + } + } + + private void loadStep1() throws IOException { + FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/DonationNotLoggedIn.fxml")); + Parent root = loader.load(); + + DonationNotLoggedInController controller = loader.getController(); + controller.setDonationSession(session); + + controller.setOnNavigate(onNavigate); + mainPane.setCenter(root); + } + private void loadStep2() throws IOException { + FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/DonationAmount.fxml")); + Parent root = loader.load(); + + DonationAmountController controller = loader.getController(); + controller.setDonationSession(session); + + + controller.setOnContinue(updatedSession -> { + session = updatedSession; + try { + loadStep3(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); + + controller.setOnBack(() -> { + onNavigate.accept(Page.ORGANIZATIONS); + }); + + mainPane.setCenter(root); + } + + private void loadStep3() throws IOException { + FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/DonationPayment.fxml")); + Parent root = loader.load(); + + DonationPaymentController controller = loader.getController(); + controller.setDonationSession(session); + + + controller.setOnContinue(updatedSession -> { + session = updatedSession; + userDonate.execute( + SessionManager.getSignedInUser(), + session.getOrganization(), + new BigDecimal(session.getAmount()) + ); + try { + loadStep4(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); + + controller.setOnBack(() -> { + try { loadStep2(); } + catch (IOException e) { throw new RuntimeException(e); } + }); + + mainPane.setCenter(root); + } + private void loadStep4() throws IOException { + FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/DonationConfirmation.fxml")); + Parent root = loader.load(); + + DonationConfirmationController controller = loader.getController(); + controller.setDonationSession(session); + + controller.setOnNavigate(onNavigate); + + mainPane.setCenter(root); + } + + public void setOnNavigate(Consumer onNavigate) { + this.onNavigate = onNavigate; + } +} \ No newline at end of file diff --git a/src/main/java/ui/controller/donation/DonationNotLoggedInController.java b/src/main/java/ui/controller/donation/DonationNotLoggedInController.java new file mode 100644 index 0000000..fa21d72 --- /dev/null +++ b/src/main/java/ui/controller/donation/DonationNotLoggedInController.java @@ -0,0 +1,45 @@ +package ui.controller.donation; + +import domain.organization.Organization; +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import ui.DonationSession; +import ui.DonationSessionAware; +import ui.Page; +import ui.controller.NavigationAware; + +import java.util.function.Consumer; + +public class DonationNotLoggedInController implements NavigationAware, DonationSessionAware { + + @FXML private Label orgLabel; + + private Consumer onNavigate; + private DonationSession donationSession; + + + @Override + public void setOnNavigate(Consumer onNavigate) { + this.onNavigate = onNavigate; + } + + @Override + public void setDonationSession(DonationSession session) { + this.donationSession = session; + orgLabel.setText("You need an account to make a donation to " + donationSession.getOrganization().getName()); + } + + public void goToSignIn() { + onNavigate.accept(Page.SIGN_IN); + } + + public void goToRegister() { + onNavigate.accept(Page.REGISTER); + } + + public void handleBack() { + onNavigate.accept(Page.ORGANIZATIONS); + } + +} + diff --git a/src/main/java/ui/controller/donation/DonationPaymentController.java b/src/main/java/ui/controller/donation/DonationPaymentController.java new file mode 100644 index 0000000..ece65d7 --- /dev/null +++ b/src/main/java/ui/controller/donation/DonationPaymentController.java @@ -0,0 +1,65 @@ +package ui.controller.donation; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import ui.DonationSession; +import ui.DonationSessionAware; + +import java.util.function.Consumer; + +public class DonationPaymentController implements DonationSessionAware { + + @FXML private Label orgLabel; + @FXML private Label amountLabel; + @FXML private Label errorLabel; + @FXML private TextField cardNumberField; + @FXML private TextField expiryField; + @FXML private TextField cvcField; + + private DonationSession donationSession; + private Consumer onContinue; + private Runnable onBack; + + @Override + public void setDonationSession(DonationSession donationSession) { + this.donationSession = donationSession; + orgLabel.setText("Donating to: " + donationSession.getOrganization().getName()); + amountLabel.setText("Amount: " + donationSession.getAmount() + " kr"); + } + + public void setOnContinue(Consumer onContinue) { + this.onContinue = onContinue; + } + + @FXML + public void handleConfirmDonation() { + String cardNumber = cardNumberField.getText().trim().replace(" ", ""); + if (!cardNumber.matches("\\d{16}")) { + errorLabel.setText("Please enter a valid 16-digit card number."); + return; + } + String expiry = expiryField.getText().trim(); + if (!expiry.matches("\\d{2}/\\d{2}")) { + errorLabel.setText("Please enter expiry date in MM/YY format."); + return; + } + String cvc = cvcField.getText().trim(); + if (!cvc.matches("\\d{3}")) { + errorLabel.setText("Please enter a valid 3-digit CVC."); + return; + } + + onContinue.accept(donationSession); + } + + public void setOnBack(Runnable onBack) { + this.onBack = onBack; + } + + @FXML + private void handleBack() { + onBack.run(); + } + +} diff --git a/src/main/java/util/SessionManager.java b/src/main/java/util/SessionManager.java index 9d020c3..b11cec9 100644 --- a/src/main/java/util/SessionManager.java +++ b/src/main/java/util/SessionManager.java @@ -20,7 +20,7 @@ public static boolean isSignedIn() { return SignedIn; } - public static User getCurrentUser() { + public static User getSignedInUser() { return currentUser; } } diff --git a/src/main/resources/css/Donation.css b/src/main/resources/css/Donation.css new file mode 100644 index 0000000..68722d4 --- /dev/null +++ b/src/main/resources/css/Donation.css @@ -0,0 +1,122 @@ +.donation-container { + -fx-alignment: center; + -fx-padding: 40 15% 40 15%; + -fx-spacing: 20; +} + +.donation-title { + -fx-font-size: 22px; + -fx-font-weight: bold; + -fx-text-fill: #1a1a2e; +} + +.donation-subtitle { + -fx-font-size: 14px; + -fx-text-fill: #666666; +} + +.donation-label { + -fx-font-size: 13px; + -fx-text-fill: #555555; + -fx-font-weight: bold; +} + +.donation-field { + -fx-background-radius: 6; + -fx-border-radius: 6; + -fx-border-color: #c0c8dc; + -fx-border-width: 1.5; + -fx-padding: 8 12 8 12; + -fx-font-size: 13px; +} + +.amount-button { + -fx-background-color: #f0f4ff; + -fx-border-color: #1e3a8a; + -fx-border-width: 1.5; + -fx-border-radius: 6; + -fx-background-radius: 6; + -fx-text-fill: #1e3a8a; + -fx-font-weight: bold; + -fx-cursor: hand; + -fx-padding: 8 16 8 16; +} + +.amount-button:hover { + -fx-background-color: #dce6f7; + -fx-scale-x: 1.03; + -fx-scale-y: 1.03; +} + +.confirm-button { + -fx-background-color: #1e3a8a; + -fx-text-fill: white; + -fx-font-weight: bold; + -fx-background-radius: 6; + -fx-padding: 10 24 10 24; + -fx-cursor: hand; + -fx-font-size: 14px; +} + +.confirm-button:hover { + -fx-background-color: #2649a8; + -fx-scale-x: 1.03; + -fx-scale-y: 1.03; +} + +.confirm-button:pressed { + -fx-background-color: #162d6e; + -fx-scale-x: 0.97; + -fx-scale-y: 0.97; +} + +.back-button { + -fx-background-color: transparent; + -fx-border-color: #c0c8dc; + -fx-border-width: 1.5; + -fx-border-radius: 6; + -fx-background-radius: 6; + -fx-text-fill: #555555; + -fx-cursor: hand; + -fx-padding: 6 14 6 14; +} + +.back-button:hover { + -fx-background-color: #f0f0f0; + -fx-scale-x: 1.03; + -fx-scale-y: 1.03; +} + +.back-button:pressed { + -fx-background-color: #e0e0e0; + -fx-scale-x: 0.97; + -fx-scale-y: 0.97; +} + +.success-icon { + -fx-font-size: 48px; + -fx-text-fill: #2d6a4f; +} + +.secondary-button { + -fx-background-color: transparent; + -fx-border-color: #1e3a8a; + -fx-border-width: 1.5; + -fx-border-radius: 6; + -fx-background-radius: 6; + -fx-text-fill: #1e3a8a; + -fx-font-weight: bold; + -fx-padding: 10 24 10 24; + -fx-cursor: hand; + -fx-font-size: 14px; +} + +.secondary-button:hover { + -fx-background-color: #f0f4ff; +} + +.secondary-button:pressed { + -fx-background-color: #dce6f7; + -fx-scale-x: 0.97; + -fx-scale-y: 0.97; +} \ No newline at end of file diff --git a/src/main/resources/view/DonationAmount.fxml b/src/main/resources/view/DonationAmount.fxml new file mode 100644 index 0000000..8098a23 --- /dev/null +++ b/src/main/resources/view/DonationAmount.fxml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + +