You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
209 lines
5.5 KiB
209 lines
5.5 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Buyer Signup</title>
|
|
<style>
|
|
/* General Styles */
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #0ced0c;
|
|
color: #04e64c;
|
|
background-image: url('./images/alok.png'); /* Add background image */
|
|
background-size: cover; /* Ensures the image covers the entire background */
|
|
background-position: center; /* Center the background image */
|
|
background-attachment: fixed; /* Keeps the background fixed during scroll */
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh; /* Full viewport height */
|
|
box-sizing: border-box;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* Signup Container */
|
|
.signup-container {
|
|
width: 100%;
|
|
max-width: 400px; /* Maximum width of the form */
|
|
padding: 30px;
|
|
background: #fff;
|
|
border: 2px solid #ccc; /* Border for the container */
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Subtle shadow */
|
|
text-align: center;
|
|
}
|
|
|
|
/* Form Heading */
|
|
.signup-container h1 {
|
|
font-size: 1.8rem;
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
text-align: center;
|
|
}
|
|
|
|
/* Form Styles */
|
|
.signup-form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 15px; /* Space between form elements */
|
|
}
|
|
|
|
/* Form Group */
|
|
.form-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
width: 100%;
|
|
}
|
|
|
|
/* Labels */
|
|
.form-group label {
|
|
font-size: 1rem;
|
|
font-weight: bold;
|
|
margin-bottom: 5px;
|
|
color: #555;
|
|
}
|
|
|
|
/* Input Fields */
|
|
input,
|
|
textarea {
|
|
width: 100%; /* Full width of the container */
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 5px;
|
|
font-size: 1rem;
|
|
color: #333;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
input:focus,
|
|
textarea:focus {
|
|
border-color: #007bff; /* Highlighted border on focus */
|
|
outline: none;
|
|
}
|
|
|
|
/* Textarea */
|
|
textarea {
|
|
resize: none;
|
|
height: 80px;
|
|
}
|
|
|
|
/* Submit Button */
|
|
button {
|
|
width: 100%; /* Full width of the container */
|
|
padding: 10px;
|
|
font-size: 1rem;
|
|
font-weight: bold;
|
|
color: #fff;
|
|
background-color: #007bff;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
|
|
/* Back Button */
|
|
.back-btn {
|
|
padding: 10px 20px;
|
|
background-color: #ccc;
|
|
border: none;
|
|
border-radius: 5px;
|
|
font-size: 1rem;
|
|
cursor: pointer;
|
|
margin-top: 20px;
|
|
text-decoration: none;
|
|
color: #333;
|
|
display: inline-block;
|
|
}
|
|
|
|
.back-btn:hover {
|
|
background-color: #bbb;
|
|
}
|
|
|
|
/* Footer */
|
|
footer {
|
|
background-color: #333;
|
|
color: #fff;
|
|
text-align: center;
|
|
padding: 10px;
|
|
width: 100%;
|
|
margin-top: 50px; /* Add more space between the signup container and footer */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="signup-container">
|
|
<h1>Buyer Signup</h1>
|
|
<form class="signup-form">
|
|
<div class="form-group">
|
|
<label for="buyer-name">Full Name:</label>
|
|
<input type="text" id="buyer-name" name="buyer-name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="buyer-email">Email:</label>
|
|
<input type="email" id="buyer-email" name="buyer-email" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="buyer-password">Password:</label>
|
|
<input type="password" id="buyer-password" name="buyer-password" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="buyer-address">Address:</label>
|
|
<textarea id="buyer-address" name="buyer-address" required></textarea>
|
|
</div>
|
|
<button type="submit">Register as Buyer</button>
|
|
</form>
|
|
|
|
<!-- Back Button -->
|
|
<a href="index.html" class="back-btn">Back</a>
|
|
</div>
|
|
|
|
<!-- Footer -->
|
|
<footer>
|
|
<p>© 2025 GREENTECH. All rights reserved.</p>
|
|
</footer>
|
|
|
|
<script>
|
|
// Get the buyer signup form
|
|
const buyerSignupForm = document.querySelector('.signup-form');
|
|
|
|
// Handle buyer registration
|
|
buyerSignupForm.addEventListener('submit', (event) => {
|
|
event.preventDefault(); // Prevent form submission
|
|
|
|
// Get form values
|
|
const name = document.getElementById('buyer-name').value.trim();
|
|
const email = document.getElementById('buyer-email').value.trim();
|
|
const password = document.getElementById('buyer-password').value;
|
|
const address = document.getElementById('buyer-address').value.trim();
|
|
|
|
// Check if the email is already registered
|
|
const users = JSON.parse(localStorage.getItem('users')) || {};
|
|
if (users[email]) {
|
|
alert('Email is already registered. Please use a different email.');
|
|
return;
|
|
}
|
|
|
|
// Save buyer details to localStorage
|
|
users[email] = {
|
|
name,
|
|
password,
|
|
address,
|
|
userType: 'Buyer' // Set user type to Buyer
|
|
};
|
|
localStorage.setItem('users', JSON.stringify(users));
|
|
|
|
// Redirect to the login page
|
|
alert('Registration successful! Redirecting to the login page...');
|
|
window.location.href = 'login.html'; // Redirect to the login page
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|