diff --git a/bg2.png b/bg2.png new file mode 100644 index 0000000..cff851e Binary files /dev/null and b/bg2.png differ diff --git a/facebook.png b/facebook.png new file mode 100644 index 0000000..2a7ae3e Binary files /dev/null and b/facebook.png differ diff --git a/google.png b/google.png new file mode 100644 index 0000000..796b00a Binary files /dev/null and b/google.png differ diff --git a/index.html b/index.html index 7d6fb37..4399007 100644 --- a/index.html +++ b/index.html @@ -420,13 +420,27 @@

Scoop Up the Savings!

+ - - No thanks -

By signing up, you agree to our Terms of Service and Privacy Policy.

- - + + No thanks +

By signing up, you agree to our Terms of Service and Privacy Policy.

+ + + + + @@ -513,6 +527,60 @@

What Make + + + + + + + + diff --git a/instagram.png b/instagram.png new file mode 100644 index 0000000..0c78bc7 Binary files /dev/null and b/instagram.png differ diff --git a/login/login.html b/login/login.html index b08c112..bfb0c64 100644 --- a/login/login.html +++ b/login/login.html @@ -4,39 +4,20 @@ Login Page - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- - diff --git a/login/login.js b/login/login.js index dacbb47..e7298af 100644 --- a/login/login.js +++ b/login/login.js @@ -46,43 +46,47 @@ if (loginCard) { if (signupCard) { addHoverEffect(signupCard); } -document.querySelector(".login-form").addEventListener("submit", function (e) { - e.preventDefault(); // Prevent form submission - - const email = document.querySelector('.login-form input[type="email"]').value; - const password = document.querySelector( - '.login-form input[type="password"]' - ).value; - - // Retrieve data from local storage - const existingUsersData = localStorage.getItem("users"); - - if (existingUsersData) { - const usersArray = JSON.parse(existingUsersData); // Parse the JSON string back to an array of objects - let userFound = false; // Flag to track if user is found - - // Loop through users and check if any match the input credentials - usersArray.forEach((userData) => { - if (email === userData.email && password === userData.password) { - userFound = true; - alert("Glad you are back for another treat!"); - // Redirect to index.html - window.location.assign("../index.html"); - } - }); - if (!userFound) { - // If no matching user is found - alert("Invalid email or password!"); - } - } else { - // If no users found in local storage - alert("No user found. Please sign up first."); - window.location.assign("../signup/signup.html"); - } +document.addEventListener('DOMContentLoaded', () => { + const loginForm = document.querySelector('.login-form'); + + loginForm.addEventListener('submit', function (e) { + e.preventDefault(); // Prevent default form submission + + const email = document.querySelector('input[name="email"]').value; + const password = document.querySelector('input[name="password"]').value; + + // Retrieve data from local storage + const existingUsersData = localStorage.getItem("users"); + + if (existingUsersData) { + const usersArray = JSON.parse(existingUsersData); + let userFound = false; + + // Check if user exists + for (const userData of usersArray) { + if (email === userData.email && password === userData.password) { + userFound = true; + alert("Glad you are back for another treat!"); + // Redirect to profile.html after a short delay + setTimeout(() => { + window.location.href = '../profile.html'; // Redirect to the profile page + }, 500); // 500 milliseconds delay + break; // Exit the loop once found + } + } + + if (!userFound) { + alert("Invalid email or password!"); // Show alert only once + } + } else { + alert("No user found. Please sign up first."); + window.location.href = "../signup/signup.html"; // Redirect to signup page + } - // Clear the form fields - document.querySelector(".login-form").reset(); + // Clear the form fields after processing + loginForm.reset(); + }); }); diff --git a/profile.html b/profile.html new file mode 100644 index 0000000..27f197c --- /dev/null +++ b/profile.html @@ -0,0 +1,386 @@ + + + + + + Profile + + + +
+

Profile

+
+ Profile Picture + +
+ +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+ +
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+ +
+

Previous Orders

+
    + +
  • +
    + Order #001: Vanilla Ice Cream + Quantity: 2 + Price: Rs 200 + Date: 2024-09-20 +
    + +
  • +
  • +
    + Order #002: Chocolate Fudge Sundae + Quantity: 1 + Price: Rs 120 + Date: 2024-09-25 +
    + +
  • +
  • +
    + Order #003: Strawberry Cheesecake Ice Cream + Quantity: 3 + Price: Rs 200 + Date: 2024-10-01 +
    + +
  • +
+
+
+ + +
+ + + diff --git a/profile.js b/profile.js new file mode 100644 index 0000000..b61f8ff --- /dev/null +++ b/profile.js @@ -0,0 +1,100 @@ +document.addEventListener("DOMContentLoaded", function () { + + // Handle profile picture change + const profileImage = document.getElementById("profile-image"); + const uploadInput = document.getElementById("upload"); + + // Trigger file input when 'Change Picture' button is clicked + profileImage.addEventListener("click", function () { + uploadInput.click(); + }); + + // Handle image file selection and preview + uploadInput.addEventListener("change", function () { + const file = uploadInput.files[0]; + if (file) { + const reader = new FileReader(); + reader.onload = function (e) { + profileImage.src = e.target.result; + }; + reader.readAsDataURL(file); + } + }); + + // Form Submission Handler (You can replace this with your server-side form handling) + const form = document.querySelector("form"); + form.addEventListener("submit", function (e) { + e.preventDefault(); + const formData = new FormData(form); + console.log("Form Submitted with Data:", Object.fromEntries(formData.entries())); + alert("Profile Saved!"); + // Add AJAX call here to send data to the server if needed + }); + + // Cancel button: clear form fields and reset profile picture + const cancelButton = document.querySelector(".cancel-btn"); + cancelButton.addEventListener("click", function () { + form.reset(); + profileImage.src = "profilepic.png"; // Reset profile picture to default + }); + + // Logout button handler + const logoutButton = document.querySelector(".logout-btn"); + logoutButton.addEventListener("click", function () { + alert("Logging out..."); + window.location.href = "index.html"; // Redirect to logout page + }); + + // Delete Account button handler + const deleteButton = document.querySelector(".delete-btn"); + deleteButton.addEventListener("click", function () { + const confirmDelete = confirm("Are you sure you want to delete your account?"); + if (confirmDelete) { + alert("Account Deleted!"); + // Add AJAX call here to handle account deletion if needed + window.location.href = "index.html"; // Redirect after deletion + } + }); + + // Social sign-in buttons (you can add additional functionality or API integration here) + document.querySelector(".google").addEventListener("click", function () { + window.open('https://accounts.google.com/signin'); + }); + + document.querySelector(".facebook").addEventListener("click", function () { + window.open('https://www.facebook.com/'); + }); + + document.querySelector(".instagram").addEventListener("click", function () { + window.open('https://www.instagram.com/accounts/login/'); + }); + + const upcomingBookings = [ + { trip: 'Bus to Mumbai', date: '15th Oct 2024', departure: 'City Terminal', seat: 'A12' }, + { trip: 'Train to Delhi', date: '25th Oct 2024', departure: 'Central Station', seat: 'B34' } + ]; + + const upcomingList = document.getElementById("upcoming-list"); + + // Populate Upcoming Bookings + upcomingBookings.forEach(booking => { + const li = document.createElement("li"); + li.classList.add("booking-item"); + li.innerHTML = ` +
+ ${booking.trip} + Date: ${booking.date} + Departure: ${booking.departure} + Seat: ${booking.seat} + +
+ `; + upcomingList.appendChild(li); + }); + + +}); + +function downloadTicket(trip) { + alert(`Downloading ticket for ${trip}`); +} diff --git a/profilepic.png b/profilepic.png new file mode 100644 index 0000000..5eb139a Binary files /dev/null and b/profilepic.png differ diff --git a/signup/signup.html b/signup/signup.html index 2ad45aa..b8343c6 100644 --- a/signup/signup.html +++ b/signup/signup.html @@ -4,45 +4,24 @@ Signup Page - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- - + diff --git a/signup/signup.js b/signup/signup.js index 97eb563..7bf5ac4 100644 --- a/signup/signup.js +++ b/signup/signup.js @@ -76,18 +76,11 @@ document.querySelector(".signup-form").addEventListener("submit", function (e) { document.querySelector(".signup-form").reset(); // Clear the form fields }); -// password toggle feature -function togglePasswordVisibility() { - const passwordInput = document.getElementById("password"); - const eyeIcon = document.getElementById("eye-icon"); - - if (passwordInput.type === "password") { - passwordInput.type = "text"; - eyeIcon.classList.remove("fa-eye"); - eyeIcon.classList.add("fa-eye-slash"); - } else { - passwordInput.type = "password"; - eyeIcon.classList.remove("fa-eye-slash"); - eyeIcon.classList.add("fa-eye"); - } -} \ No newline at end of file +document.querySelector('.signup-form').addEventListener('submit', function(event) { + event.preventDefault(); // Prevent the default form submission + + // You can add form validation or any other logic here + + // Redirect to profile.html + window.location.href = '../profile.html'; +});