Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +34 -25
templates/index.html
CHANGED
@@ -98,6 +98,20 @@
|
|
98 |
<body>
|
99 |
<h1 class="header-title">Welcome to Biryani Hub 🍽</h1>
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
<!-- Registration Form -->
|
102 |
<div class="container" id="registrationForm">
|
103 |
<div class="form-container">
|
@@ -115,20 +129,6 @@
|
|
115 |
</div>
|
116 |
</div>
|
117 |
|
118 |
-
<!-- Login Form -->
|
119 |
-
<div class="container" id="loginForm">
|
120 |
-
<div class="form-container">
|
121 |
-
<h2>Login</h2>
|
122 |
-
<label for="loginEmail">Your Email</label>
|
123 |
-
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
124 |
-
|
125 |
-
<label for="loginMobile">Your Mobile Number</label>
|
126 |
-
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
127 |
-
|
128 |
-
<p class="info" id="infoMessageLogin">Listening 🗣🎙️...</p>
|
129 |
-
</div>
|
130 |
-
</div>
|
131 |
-
|
132 |
<!-- Confirmation Section -->
|
133 |
<div id="confirmation">
|
134 |
<h2>Confirm Your Details:</h2>
|
@@ -156,34 +156,34 @@
|
|
156 |
}
|
157 |
|
158 |
function askLoginOrRegister() {
|
159 |
-
speak("
|
160 |
recognition.start();
|
161 |
recognition.onresult = function(event) {
|
162 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
163 |
recognition.stop();
|
164 |
-
if (response.includes("
|
165 |
showRegistrationForm();
|
166 |
-
} else if (response.includes("
|
167 |
showLoginForm();
|
168 |
} else {
|
169 |
-
speak("I didn't understand. Please say '
|
170 |
}
|
171 |
};
|
172 |
});
|
173 |
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
function showRegistrationForm() {
|
176 |
document.getElementById('registrationForm').style.display = 'block';
|
177 |
document.getElementById('loginForm').style.display = 'none';
|
178 |
speak("Please say your name to begin registration.", startListeningForName);
|
179 |
}
|
180 |
|
181 |
-
function showLoginForm() {
|
182 |
-
document.getElementById('loginForm').style.display = 'block';
|
183 |
-
document.getElementById('registrationForm').style.display = 'none';
|
184 |
-
speak("Please say your email and mobile number to login.", startListeningForLogin);
|
185 |
-
}
|
186 |
-
|
187 |
let nameCaptured, emailCaptured, mobileCaptured;
|
188 |
let nameField = document.getElementById('name');
|
189 |
let emailField = document.getElementById('email');
|
@@ -263,6 +263,15 @@
|
|
263 |
document.getElementById('confirmEmail').textContent = emailField.value;
|
264 |
document.getElementById('confirmPhone').textContent = mobileField.value;
|
265 |
document.getElementById('confirmation').style.display = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
function autoSubmit() {
|
@@ -289,7 +298,7 @@
|
|
289 |
}
|
290 |
|
291 |
window.onload = function () {
|
292 |
-
askLoginOrRegister();
|
293 |
};
|
294 |
</script>
|
295 |
</body>
|
|
|
98 |
<body>
|
99 |
<h1 class="header-title">Welcome to Biryani Hub 🍽</h1>
|
100 |
|
101 |
+
<!-- Login Form -->
|
102 |
+
<div class="container" id="loginForm">
|
103 |
+
<div class="form-container">
|
104 |
+
<h2>Login</h2>
|
105 |
+
<label for="loginEmail">Your Email</label>
|
106 |
+
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
107 |
+
|
108 |
+
<label for="loginMobile">Your Mobile Number</label>
|
109 |
+
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
110 |
+
|
111 |
+
<p class="info" id="infoMessageLogin">Listening 🗣🎙️...</p>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
|
115 |
<!-- Registration Form -->
|
116 |
<div class="container" id="registrationForm">
|
117 |
<div class="form-container">
|
|
|
129 |
</div>
|
130 |
</div>
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
<!-- Confirmation Section -->
|
133 |
<div id="confirmation">
|
134 |
<h2>Confirm Your Details:</h2>
|
|
|
156 |
}
|
157 |
|
158 |
function askLoginOrRegister() {
|
159 |
+
speak("Welcome to Biryani Hub. Are you a new user or an existing user? Please say 'new user' to register or 'existing user' to login.", function() {
|
160 |
recognition.start();
|
161 |
recognition.onresult = function(event) {
|
162 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
163 |
recognition.stop();
|
164 |
+
if (response.includes("new user")) {
|
165 |
showRegistrationForm();
|
166 |
+
} else if (response.includes("existing user")) {
|
167 |
showLoginForm();
|
168 |
} else {
|
169 |
+
speak("I didn't understand. Please say 'new user' to register or 'existing user' to login.", askLoginOrRegister);
|
170 |
}
|
171 |
};
|
172 |
});
|
173 |
}
|
174 |
|
175 |
+
function showLoginForm() {
|
176 |
+
document.getElementById('loginForm').style.display = 'block';
|
177 |
+
document.getElementById('registrationForm').style.display = 'none';
|
178 |
+
speak("Please tell your email and mobile number to login.", startListeningForLogin);
|
179 |
+
}
|
180 |
+
|
181 |
function showRegistrationForm() {
|
182 |
document.getElementById('registrationForm').style.display = 'block';
|
183 |
document.getElementById('loginForm').style.display = 'none';
|
184 |
speak("Please say your name to begin registration.", startListeningForName);
|
185 |
}
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
let nameCaptured, emailCaptured, mobileCaptured;
|
188 |
let nameField = document.getElementById('name');
|
189 |
let emailField = document.getElementById('email');
|
|
|
263 |
document.getElementById('confirmEmail').textContent = emailField.value;
|
264 |
document.getElementById('confirmPhone').textContent = mobileField.value;
|
265 |
document.getElementById('confirmation').style.display = 'block';
|
266 |
+
setTimeout(submitRegistration, 5000); // Automatically proceed after a short delay
|
267 |
+
}
|
268 |
+
|
269 |
+
function submitRegistration() {
|
270 |
+
// Simulate submission of registration details
|
271 |
+
speak("Registration successful. Redirecting to login page.");
|
272 |
+
setTimeout(() => {
|
273 |
+
location.reload(); // Reload page to go back to the login page after successful registration
|
274 |
+
}, 3000);
|
275 |
}
|
276 |
|
277 |
function autoSubmit() {
|
|
|
298 |
}
|
299 |
|
300 |
window.onload = function () {
|
301 |
+
askLoginOrRegister(); // First, ask the user whether they are a new or existing user
|
302 |
};
|
303 |
</script>
|
304 |
</body>
|