Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/main/java/com/trekmate/manager/BookingManager.java
Original file line number Diff line number Diff line change
@@ -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<Trek> bookings = new ArrayList<>();

public static void addBooking(Trek trek) {
bookings.add(trek);
}

public static List<Trek> getBookings() {
return new ArrayList<>(bookings); // Return a copy to avoid external modification
}
}
38 changes: 34 additions & 4 deletions src/main/java/com/trekmate/manager/SceneManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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();
Expand All @@ -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) {
Expand All @@ -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);
}

}

134 changes: 134 additions & 0 deletions src/main/java/com/trekmate/view/settings/AboutUs.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/trekmate/view/settings/ChangePassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -105,6 +105,6 @@ public Scene createScene() {
scaleTransition.play();

// Setting the scene
return new Scene(pane, 800, 600);
return new Scene(pane, 2080, 1080);
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/trekmate/view/settings/SettingsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -136,4 +136,4 @@ private Button createCenteredButton(String text, EventHandler<ActionEvent> handl
GridPane.setHalignment(button, javafx.geometry.HPos.CENTER);
return button;
}
}
}
94 changes: 94 additions & 0 deletions src/main/java/com/trekmate/view/settings/TermsAndConditions.java
Original file line number Diff line number Diff line change
@@ -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 "<html><body style='font-size:14px; line-height:1.6;'>"
+ "<h2>Terms and Conditions</h2>"
+ "<p><strong>Last updated:</strong> [17/7/2024]</p>"
+ "<p>Welcome to <strong>TrekMate</strong>!</p>"
+ "<p>These terms and conditions outline the rules and regulations for the use of <strong>TrekMate</strong>, "
+ "located at [Website URL].</p>"
+ "<p>By accessing this app, we assume you accept these terms and conditions. "
+ "Do not continue to use <strong>TrekMate</strong> if you do not agree to take all of the terms and conditions stated on this page.</p>"
+ "<h3>1. Introduction</h3>"
+ "<p><strong>1.1</strong> These terms and conditions govern your use of <strong>TrekMate</strong>.</p>"
+ "<p><strong>1.2</strong> 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.</p>"
+ "<h3>2. Intellectual Property Rights</h3>"
+ "<p><strong>2.1</strong> Unless otherwise stated, <strong>TrekMate</strong> and/or its licensors own the intellectual property rights for all material on <strong>TrekMate</strong>. All intellectual property rights are reserved.</p>"
+ "<p><strong>2.2</strong> You may access this from <strong>TrekMate</strong> for your own personal use subject to restrictions set in these terms and conditions.</p>"
+ "<h3>3. User Responsibilities</h3>"
+ "<p><strong>3.1</strong> You must not:</p>"
+ "<ul>"
+ "<li>Republish material from <strong>TrekMate</strong>.</li>"
+ "<li>Sell, rent, or sub-license material from <strong>TrekMate</strong>.</li>"
+ "<li>Reproduce, duplicate, or copy material from <strong>TrekMate</strong>.</li>"
+ "<li>Redistribute content from <strong>TrekMate</strong>.</li>"
+ "</ul>"
+ "<p><strong>3.2</strong> You must not use <strong>TrekMate</strong> in any way that causes, or may cause, damage to the app or impairment of the availability or accessibility of <strong>TrekMate</strong>.</p>"
+ "<h3>4. Privacy Policy</h3>"
+ "<p><strong>4.1</strong> Your privacy is important to us. Please read our <a href='#'>Privacy Policy</a> for details on how we collect, use, and protect your information.</p>"
+ "<h3>5. Limitation of Liability</h3>"
+ "<p><strong>5.1</strong> <strong>TrekMate</strong> will not be liable to you in relation to the contents of, or use of, or otherwise in connection with, this app:</p>"
+ "<ul>"
+ "<li>for any indirect, special, or consequential loss; or</li>"
+ "<li>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.</li>"
+ "</ul>"
+ "<h3>6. Changes to Terms and Conditions</h3>"
+ "<p><strong>6.1</strong> 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.</p>"
+ "</body></html>";
}

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");
}
}
Loading