diff --git a/src/main/java/com/trekmate/manager/BookingManager.java b/src/main/java/com/trekmate/manager/BookingManager.java new file mode 100644 index 0000000..e6e3a40 --- /dev/null +++ b/src/main/java/com/trekmate/manager/BookingManager.java @@ -0,0 +1,17 @@ +package com.trekmate.manager; + +import com.trekmate.model.Trek; +import java.util.ArrayList; +import java.util.List; + +public class BookingManager { + private static List bookings = new ArrayList<>(); + + public static void addBooking(Trek trek) { + bookings.add(trek); + } + + public static List getBookings() { + return new ArrayList<>(bookings); // Return a copy to avoid external modification + } +} \ No newline at end of file diff --git a/src/main/java/com/trekmate/manager/SceneManager.java b/src/main/java/com/trekmate/manager/SceneManager.java index 37533dd..e1e39ed 100644 --- a/src/main/java/com/trekmate/manager/SceneManager.java +++ b/src/main/java/com/trekmate/manager/SceneManager.java @@ -10,11 +10,17 @@ import com.trekmate.view.auth.SignUpPage; import com.trekmate.view.homePage.HomePage; import com.trekmate.view.leaderboard.LeaderboardPage; +import com.trekmate.view.settings.AboutUs; + import com.trekmate.view.settings.ChangePassword; + import com.trekmate.view.settings.ProfilePage; import com.trekmate.view.settings.SettingsPage; + +import com.trekmate.view.settings.TermsAndConditions; import com.trekmate.view.trek.AddTrekPage; import com.trekmate.view.trek.TrekDetailsPage; +import com.trekmate.view.trek.MyBooking; public class SceneManager { @@ -31,8 +37,8 @@ public void addScene(String name, Scene scene) { scenes.put(name, scene); } - public void switchTo(String name) { - Scene scene = scenes.get(name); + public void switchTo(String sceneName) { + Scene scene = scenes.get(sceneName); if (scene != null) { primaryStage.setScene(scene); primaryStage.show(); @@ -57,23 +63,39 @@ public void addOrUpdateScenes(Stage primaryStage) { ChangePassword changePassword = new ChangePassword(this); Scene changePasswordScene = changePassword.createScene(); + AboutUs aboutus = new AboutUs(this); + Scene aboutusScene = aboutus.createScene(); + + TermsAndConditions terms = new TermsAndConditions(this); + Scene termScene = terms.createScene(); + ProfilePage profilePage = new ProfilePage(this); Scene profileScene = profilePage.createScene(); AddTrekPage addTrekPage = new AddTrekPage(this); Scene addTrekScene = addTrekPage.createScene(); - LeaderboardPage leaderboardPage = new LeaderboardPage(this); - Scene leaderboardScene = leaderboardPage.createScene(); + LeaderboardPage leaderboard = new LeaderboardPage(this); + Scene leaderboardScene = leaderboard.createScene(); + + MyBooking myBookingPage = new MyBooking(this); + Scene myBookingScene = myBookingPage.getScene(); + + // Add scenes to the map this.addScene("SignInPage", signInScene); this.addScene("SignUpPage", signUpScene); this.addScene("HomePage", homeScene); this.addScene("SettingsPage", settingsScene); this.addScene("ChangePassword", changePasswordScene); + this.addScene("AboutUs", aboutusScene); // Add Aboutus scene to SceneManager this.addScene("ProfilePage", profileScene); this.addScene("AddTrekPage", addTrekScene); this.addScene("LeaderboardPage", leaderboardScene); + + this.addScene("TermsAndConditions", termScene); + this.addScene("MyBooking", myBookingScene); + } public void loadTrekDetails(Trek trek) { @@ -82,4 +104,12 @@ public void loadTrekDetails(Trek trek) { this.addScene("TrekDetailsPage", trekDetailsScene); switchTo("TrekDetailsPage"); } + + public void refreshMyBookingsPage() { + MyBooking myBookingPage = new MyBooking(this); + Scene myBookingScene = myBookingPage.getScene(); + this.addScene("MyBooking", myBookingScene); + } + } + diff --git a/src/main/java/com/trekmate/view/settings/AboutUs.java b/src/main/java/com/trekmate/view/settings/AboutUs.java new file mode 100644 index 0000000..3038bc5 --- /dev/null +++ b/src/main/java/com/trekmate/view/settings/AboutUs.java @@ -0,0 +1,134 @@ +package com.trekmate.view.settings; + +import com.trekmate.manager.SceneManager; +import com.trekmate.model.User; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.ScrollPane; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.*; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; +import javafx.stage.Screen; + +public class AboutUs { + + private SceneManager sceneManager; + + public AboutUs(SceneManager sceneManager) { + this.sceneManager = sceneManager; + } + + public Scene createScene() { + // Fetch user details from session (mocking user details for About Us page) + User user = new User(); + user.setFirstName("Bug"); + user.setLastName("Optimizers"); + user.setEmail("treakmate@gmail.com"); + + // Creating labels with information + Label welcomeLabel = new Label("Welcome to TrekMate!"); + welcomeLabel.setFont(Font.font("Arial", FontWeight.BOLD, 24)); + welcomeLabel.setTextFill(Color.YELLOW); + + Label missionLabel = new Label("About Our App :"); + missionLabel.setFont(Font.font("Arial", FontWeight.BOLD, 18)); + missionLabel.setTextFill(Color.WHITE); + + Label missionText = new Label("At TrekMate, we are passionate about adventure and connecting people with unforgettable trekking experiences.\n Whether you're a seasoned trekker or new to the trail, TrekMate is here to guide you every step of the way.\nOur mission is to simplify your trekking journey by providing detailed information on various trekking routes, insightful tips on gear\n and preparation, and a community of fellow adventurers to share experiences with.\n With TrekMate, embark on journeys that take you through breathtaking landscapes, discover hidden trails, and forge lasting memories."); + missionText.setFont(Font.font(17)); + missionText.setTextFill(Color.WHITE); + + // About Us section + Label aboutLabel = new Label("About Us"); + aboutLabel.setFont(Font.font("Arial", FontWeight.BOLD, 20)); + aboutLabel.setTextFill(Color.WHITE); + + Label groupNameLabel = new Label("Group Name: " + user.getFirstName() + " " + user.getLastName()); + groupNameLabel.setFont(Font.font("Arial", FontWeight.BOLD, 15)); + groupNameLabel.setTextFill(Color.WHITE); + + Label membersLabel = new Label("Group Members:\n- Bhakti Satpute\n- Sarita Disale \n- Priyanka Karmalkar"); + membersLabel.setFont(Font.font(20)); + membersLabel.setTextFill(Color.WHITE); + + Label conceptsLabel = new Label("Concepts Used:\n- Inheritance\n- Polymorphism\n- Abstraction\n- Interface\n- Exception Handling\n- JavaFX\n- Maven\n- MVC Pattern\n- Firestore "); + conceptsLabel.setFont(Font.font(17)); + conceptsLabel.setTextFill(Color.WHITE); + + // Create images for social media icons (mocking images) + Image instagramIcon = new Image("images/instagram.png"); + ImageView instagramView = new ImageView(instagramIcon); + instagramView.setFitWidth(70); + instagramView.setPreserveRatio(true); + + Image linkedinIcon = new Image("images/linkedin.png"); + ImageView linkedinView = new ImageView(linkedinIcon); + linkedinView.setFitWidth(70); + linkedinView.setPreserveRatio(true); + + Image facebookIcon = new Image("images/facebook.png"); + ImageView facebookView = new ImageView(facebookIcon); + facebookView.setFitWidth(70); + facebookView.setPreserveRatio(true); + + // Create an HBox for social media icons + HBox socialMediaBox = new HBox(10); + socialMediaBox.getChildren().addAll(instagramView, linkedinView, facebookView); + socialMediaBox.setAlignment(Pos.CENTER); + + // Create a VBox to hold the labels + VBox vbox = new VBox(20); + vbox.setPadding(new Insets(20)); + vbox.getChildren().addAll( + welcomeLabel, missionLabel, missionText, aboutLabel, + groupNameLabel, membersLabel, conceptsLabel, socialMediaBox + ); + + // Create the back button + Button backButton = new Button(">>>"); + backButton.setOnAction(event -> sceneManager.switchTo("SettingsPage")); + backButton.setStyle("-fx-background-color: #ff0000; -fx-text-fill: white; -fx-font-weight: bold;"); + + // Create an AnchorPane to position the back button in the bottom right corner + AnchorPane anchorPane = new AnchorPane(); + AnchorPane.setBottomAnchor(backButton, 20.0); + AnchorPane.setRightAnchor(backButton, 20.0); + anchorPane.getChildren().add(backButton); + + // Create the main layout + VBox mainLayout = new VBox(20); + mainLayout.setAlignment(Pos.CENTER); + mainLayout.getChildren().addAll(vbox, anchorPane); + mainLayout.setPadding(new Insets(20)); + mainLayout.setStyle("-fx-background-color: rgba(0, 0, 0, 0.7); -fx-border-color: black;"); // Semi-transparent black background + mainLayout.setMinHeight(Screen.getPrimary().getBounds().getHeight()); + mainLayout.setMinWidth(Screen.getPrimary().getBounds().getWidth()); + + // Set background image for the main layout + Image backgroundImage = new Image("images/aboutus1.jpg"); + BackgroundImage background = new BackgroundImage( + backgroundImage, + BackgroundRepeat.NO_REPEAT, + BackgroundRepeat.NO_REPEAT, + BackgroundPosition.CENTER, + new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, false, false, true, true) + ); + mainLayout.setBackground(new Background(background)); + + // Wrap the main layout in a ScrollPane + ScrollPane scrollPane = new ScrollPane(mainLayout); + scrollPane.setFitToWidth(true); + scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); + scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); + + // Create the scene with primary screen bounds + Scene aboutUsScene = new Scene(scrollPane, Screen.getPrimary().getBounds().getWidth(), Screen.getPrimary().getBounds().getHeight()); + return aboutUsScene; + } +} \ No newline at end of file diff --git a/src/main/java/com/trekmate/view/settings/ChangePassword.java b/src/main/java/com/trekmate/view/settings/ChangePassword.java index 9c4cbf7..8794d0e 100644 --- a/src/main/java/com/trekmate/view/settings/ChangePassword.java +++ b/src/main/java/com/trekmate/view/settings/ChangePassword.java @@ -36,7 +36,7 @@ public Scene createScene() { BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, - new BackgroundSize(800, 600, false, false, true, false)); + new BackgroundSize(1000, 600, false, false, true, false)); // Create a Pane and set its background Pane pane = new Pane(); @@ -105,6 +105,6 @@ public Scene createScene() { scaleTransition.play(); // Setting the scene - return new Scene(pane, 800, 600); + return new Scene(pane, 2080, 1080); } } diff --git a/src/main/java/com/trekmate/view/settings/SettingsPage.java b/src/main/java/com/trekmate/view/settings/SettingsPage.java index 7a88583..e97cb5d 100644 --- a/src/main/java/com/trekmate/view/settings/SettingsPage.java +++ b/src/main/java/com/trekmate/view/settings/SettingsPage.java @@ -100,7 +100,7 @@ private GridPane createSettingsGrid() { // Terms & Conditions ImageView termsImageView = createImageView(TERMS_IMAGE_PATH, 40, 40); - Button termsButton = createCenteredButton("Terms & Conditions", event -> sceneManager.switchTo("TermsAndConditions")); + Button termsButton = createCenteredButton("Terms & Conditions ", event -> sceneManager.switchTo("TermsAndConditions")); grid.add(termsImageView, 0, 3); grid.add(termsButton, 1, 3); @@ -136,4 +136,4 @@ private Button createCenteredButton(String text, EventHandler handl GridPane.setHalignment(button, javafx.geometry.HPos.CENTER); return button; } -} +} \ No newline at end of file diff --git a/src/main/java/com/trekmate/view/settings/TermsAndConditions.java b/src/main/java/com/trekmate/view/settings/TermsAndConditions.java new file mode 100644 index 0000000..317471d --- /dev/null +++ b/src/main/java/com/trekmate/view/settings/TermsAndConditions.java @@ -0,0 +1,94 @@ +package com.trekmate.view.settings; + +import com.trekmate.manager.SceneManager; +import com.trekmate.model.Trek; +import com.trekmate.view.trek.TrekDetailsPage; + +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.*; +import javafx.scene.web.WebView; +import javafx.scene.input.MouseEvent; + +public class TermsAndConditions { + + private SceneManager sceneManager; + + public TermsAndConditions(SceneManager sceneManager) { + this.sceneManager = sceneManager; + } + + public Scene createScene() { + // Create a WebView to display the terms and conditions + WebView termsWebView = new WebView(); + termsWebView.getEngine().loadContent(getTermsAndConditionsHtml()); + termsWebView.setStyle("-fx-background-color: rgba(255, 255, 255, 0.8);"); + public void loadTrekDetails(Trek trek) { + TrekDetailsPage trekDetailsPage = new TrekDetailsPage(trek); + Scene trekDetailsScene = trekDetailsPage.getScene(this); + this.addScene("TrekDetailsPage", trekDetailsScene); + switchTo("TrekDetailsPage"); + } + // Create a VBox for the content + VBox contentBox = new VBox(10, termsWebView, createBackButton()); + contentBox.setStyle("-fx-background-color: #f0f0f0; -fx-padding: 20px;"); + + // Create the Scene + Scene scene = new Scene(contentBox, 2080, 1080); + return scene; + } + + private String getTermsAndConditionsHtml() { + return "" + + "

Terms and Conditions

" + + "

Last updated: [17/7/2024]

" + + "

Welcome to TrekMate!

" + + "

These terms and conditions outline the rules and regulations for the use of TrekMate, " + + "located at [Website URL].

" + + "

By accessing this app, we assume you accept these terms and conditions. " + + "Do not continue to use TrekMate if you do not agree to take all of the terms and conditions stated on this page.

" + + "

1. Introduction

" + + "

1.1 These terms and conditions govern your use of TrekMate.

" + + "

1.2 By using this app, you agree to these terms and conditions in full. " + + "If you disagree with these terms and conditions or any part of these terms and conditions, you must not use this app.

" + + "

2. Intellectual Property Rights

" + + "

2.1 Unless otherwise stated, TrekMate and/or its licensors own the intellectual property rights for all material on TrekMate. All intellectual property rights are reserved.

" + + "

2.2 You may access this from TrekMate for your own personal use subject to restrictions set in these terms and conditions.

" + + "

3. User Responsibilities

" + + "

3.1 You must not:

" + + "
    " + + "
  • Republish material from TrekMate.
  • " + + "
  • Sell, rent, or sub-license material from TrekMate.
  • " + + "
  • Reproduce, duplicate, or copy material from TrekMate.
  • " + + "
  • Redistribute content from TrekMate.
  • " + + "
" + + "

3.2 You must not use TrekMate in any way that causes, or may cause, damage to the app or impairment of the availability or accessibility of TrekMate.

" + + "

4. Privacy Policy

" + + "

4.1 Your privacy is important to us. Please read our Privacy Policy for details on how we collect, use, and protect your information.

" + + "

5. Limitation of Liability

" + + "

5.1 TrekMate will not be liable to you in relation to the contents of, or use of, or otherwise in connection with, this app:

" + + "
    " + + "
  • for any indirect, special, or consequential loss; or
  • " + + "
  • for any business losses, loss of revenue, income, profits, or anticipated savings, loss of contracts or business relationships, loss of reputation or goodwill, or loss or corruption of information or data.
  • " + + "
" + + "

6. Changes to Terms and Conditions

" + + "

6.1 We may revise these terms and conditions from time to time. Revised terms and conditions will apply to the use of this app from the date of the publication of the revised terms and conditions on this app.

" + + ""; + } + + private Button createBackButton() { + Button backButton = new Button("> > >"); + backButton.setStyle("-fx-background-color: #CCCCCC;"); // Set initial color + backButton.setOnMousePressed(e -> backButton.setStyle("-fx-background-color: #AAAAAA;")); // Darker color when + // pressed + backButton.setOnMouseReleased(e -> backButton.setStyle("-fx-background-color: #CCCCCC;")); // Restore color when + // released + backButton.setOnAction(e -> handleBack()); + return backButton; + } + + private void handleBack() { + System.out.println("Back button clicked. Navigating back to SettingsPage..."); + sceneManager.switchTo("SettingsPage"); + } +} diff --git a/src/main/java/com/trekmate/view/trek/MyBooking.java b/src/main/java/com/trekmate/view/trek/MyBooking.java new file mode 100644 index 0000000..ceeaf73 --- /dev/null +++ b/src/main/java/com/trekmate/view/trek/MyBooking.java @@ -0,0 +1,114 @@ +package com.trekmate.view.trek; + +import com.trekmate.manager.BookingManager; +import com.trekmate.manager.SceneManager; +import com.trekmate.model.Trek; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.ToggleButton; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.*; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; + +public class MyBooking { + + private SceneManager sceneManager; + + public MyBooking(SceneManager sceneManager) { + this.sceneManager = sceneManager; + } + + public Scene getScene() { + // Title + Label titleLabel = new Label("My Bookings"); + titleLabel.setFont(Font.font("Arial", FontWeight.BOLD, 36)); + titleLabel.setTextFill(Color.YELLOW); + + // Booking details + VBox bookingsBox = new VBox(10); + bookingsBox.setAlignment(Pos.CENTER); + bookingsBox.setPadding(new Insets(20)); + + // Populate with current bookings + for (Trek trek : BookingManager.getBookings()) { + // Image of the fort + String imageUrl = trek.getImageUrl().isEmpty() ? "default-image.png" : trek.getImageUrl().get(0); // Use default image if list is empty + ImageView trekImageView = new ImageView(new Image(imageUrl)); + trekImageView.setFitHeight(150); + trekImageView.setFitWidth(150); + + // Name of the fort + Label trekLabel = new Label(trek.getFortName()); + trekLabel.setFont(Font.font("Arial", 24)); + trekLabel.setTextFill(Color.RED); + + // Rating stars + HBox ratingStars = new HBox(7); + ratingStars.setAlignment(Pos.CENTER_LEFT); + + // Array to store ToggleButtons for rating stars + ToggleButton[] stars = new ToggleButton[5]; + for (int i = 0; i < 5; i++) { + final int index = i; // Final variable for lambda expression + ToggleButton star = new ToggleButton(); + star.setGraphic(new ImageView(new Image("/images/unselectstar.png"))); // Replace with your star image + star.setPrefSize(30, 30); + star.setOnAction(event -> { + // Toggle the selected state of stars + for (int j = 0; j <= index; j++) { + stars[j].setSelected(true); + stars[j].setGraphic(new ImageView(new Image("/images/selectstar.png"))); // Replace with your selected star image + } + for (int j = index + 1; j < 5; j++) { + stars[j].setSelected(false); + stars[j].setGraphic(new ImageView(new Image("/images/unselectstar.png"))); // Replace with your unselected star image + } + }); + stars[i] = star; + ratingStars.getChildren().add(star); + } + + // Container for image, name, and rating + HBox trekInfoBox = new HBox(7, trekLabel, ratingStars); + trekInfoBox.setAlignment(Pos.CENTER_LEFT); + + // Container for image and info + HBox trekBox = new HBox(10, trekImageView, trekInfoBox); + trekBox.setAlignment(Pos.CENTER_LEFT); + trekBox.setPadding(new Insets(10)); + trekBox.setStyle("-fx-border-color:black; -fx-border-width: 1px;"); + + bookingsBox.getChildren().add(trekBox); + } + + // Back button + Button backButton = new Button("> > >"); + backButton.setStyle("-fx-background-color: aqua; -fx-text-fill: black; -fx-font-size: 16px; -fx-padding: 10px;"); + backButton.setOnAction(e -> { + sceneManager.switchTo("HomePage"); // Navigate back to home page + }); + + // Layout + VBox layout = new VBox(20, titleLabel, bookingsBox, backButton); + layout.setAlignment(Pos.CENTER); + layout.setPadding(new Insets(10)); + + // Set background image + BackgroundImage backgroundImage = new BackgroundImage( + new Image("/images/mybookig.jpg", 1280, 700, false, true), // Ensure the path is correct + BackgroundRepeat.NO_REPEAT, + BackgroundRepeat.NO_REPEAT, + BackgroundPosition.CENTER, + BackgroundSize.DEFAULT + ); + layout.setBackground(new Background(backgroundImage)); + + return new Scene(layout, 2080,1080); + } +} diff --git a/src/main/resources/images/Pastel2.jpg b/src/main/resources/images/Pastel2.jpg new file mode 100644 index 0000000..db6442e Binary files /dev/null and b/src/main/resources/images/Pastel2.jpg differ diff --git a/src/main/resources/images/aboutus1.jpg b/src/main/resources/images/aboutus1.jpg new file mode 100644 index 0000000..a396daa Binary files /dev/null and b/src/main/resources/images/aboutus1.jpg differ diff --git a/src/main/resources/images/facebook.png b/src/main/resources/images/facebook.png new file mode 100644 index 0000000..2a7ae3e Binary files /dev/null and b/src/main/resources/images/facebook.png differ diff --git a/src/main/resources/images/instagram.png b/src/main/resources/images/instagram.png new file mode 100644 index 0000000..e7e3d2d Binary files /dev/null and b/src/main/resources/images/instagram.png differ diff --git a/src/main/resources/images/linkedin.png b/src/main/resources/images/linkedin.png new file mode 100644 index 0000000..e6a9672 Binary files /dev/null and b/src/main/resources/images/linkedin.png differ