Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +105 -153
templates/index.html
CHANGED
@@ -4,103 +4,121 @@
|
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
-
<title>Biryani Hub</title>
|
8 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
9 |
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
</head>
|
11 |
-
|
12 |
-
<style>
|
13 |
-
body {
|
14 |
-
font-family: 'Roboto', sans-serif;
|
15 |
-
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
16 |
-
margin: 0;
|
17 |
-
display: flex;
|
18 |
-
justify-content: center;
|
19 |
-
align-items: center;
|
20 |
-
height: 100vh;
|
21 |
-
text-align: center;
|
22 |
-
}
|
23 |
-
.container {
|
24 |
-
background-color: #87ceeb; /* Light blue */
|
25 |
-
padding: 40px 50px;
|
26 |
-
border-radius: 10px;
|
27 |
-
width: 400px;
|
28 |
-
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
29 |
-
}
|
30 |
-
h1 {
|
31 |
-
font-size: 30px;
|
32 |
-
font-weight: bold;
|
33 |
-
color: #ff6a00;
|
34 |
-
}
|
35 |
-
label {
|
36 |
-
font-size: 16px;
|
37 |
-
margin-top: 20px;
|
38 |
-
display: block;
|
39 |
-
text-align: left;
|
40 |
-
font-weight: bold;
|
41 |
-
}
|
42 |
-
input[type="text"] {
|
43 |
-
width: 100%;
|
44 |
-
padding: 12px;
|
45 |
-
font-size: 16px;
|
46 |
-
border: 2px solid #ccc;
|
47 |
-
border-radius: 8px;
|
48 |
-
margin-top: 8px;
|
49 |
-
box-sizing: border-box;
|
50 |
-
}
|
51 |
-
input[type="text"]:focus {
|
52 |
-
border-color: #ff6a00;
|
53 |
-
outline: none;
|
54 |
-
}
|
55 |
-
.info {
|
56 |
-
margin-top: 20px;
|
57 |
-
font-size: 16px;
|
58 |
-
color: #ff6a00;
|
59 |
-
font-weight: bold;
|
60 |
-
}
|
61 |
-
.status {
|
62 |
-
font-size: 14px;
|
63 |
-
color: gray;
|
64 |
-
margin-top: 20px;
|
65 |
-
}
|
66 |
-
</style>
|
67 |
-
|
68 |
<body>
|
69 |
<div class="container">
|
70 |
<h1>Welcome to Biryani Hub π½ π</h1>
|
71 |
|
72 |
-
<!--
|
73 |
-
<
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<label for="mobile">Your Mobile Number</label>
|
87 |
-
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
|
102 |
-
|
103 |
-
|
|
|
|
|
104 |
</div>
|
105 |
|
106 |
<script>
|
@@ -246,72 +264,6 @@
|
|
246 |
});
|
247 |
}
|
248 |
|
249 |
-
// Start login process (similar to registration process but only email and phone)
|
250 |
-
function startListeningForLoginEmail() {
|
251 |
-
recognition.start();
|
252 |
-
recognition.onresult = function(event) {
|
253 |
-
emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
254 |
-
document.getElementById('loginEmail').value = emailCaptured;
|
255 |
-
recognition.stop();
|
256 |
-
speak("You said " + emailCaptured + ". Is it correct?", confirmLoginEmail);
|
257 |
-
};
|
258 |
-
}
|
259 |
-
|
260 |
-
function confirmLoginEmail() {
|
261 |
-
recognition.start();
|
262 |
-
recognition.onresult = function(event) {
|
263 |
-
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
264 |
-
recognition.stop();
|
265 |
-
if (confirmation.includes("ok")) {
|
266 |
-
speak("Great! Now, tell me your mobile number.", startListeningForLoginMobile);
|
267 |
-
} else {
|
268 |
-
speak("Let's try again. Tell me your email.", startListeningForLoginEmail);
|
269 |
-
}
|
270 |
-
};
|
271 |
-
}
|
272 |
-
|
273 |
-
function startListeningForLoginMobile() {
|
274 |
-
recognition.start();
|
275 |
-
recognition.onresult = function(event) {
|
276 |
-
mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
277 |
-
document.getElementById('loginMobile').value = mobileCaptured;
|
278 |
-
recognition.stop();
|
279 |
-
speak("You said " + mobileCaptured + ". Is it correct?", confirmLoginMobile);
|
280 |
-
};
|
281 |
-
}
|
282 |
-
|
283 |
-
function confirmLoginMobile() {
|
284 |
-
recognition.start();
|
285 |
-
recognition.onresult = function(event) {
|
286 |
-
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
287 |
-
recognition.stop();
|
288 |
-
if (confirmation.includes("ok")) {
|
289 |
-
submitLogin();
|
290 |
-
} else {
|
291 |
-
speak("Let's try again. Tell me your mobile number.", startListeningForLoginMobile);
|
292 |
-
}
|
293 |
-
};
|
294 |
-
}
|
295 |
-
|
296 |
-
// Submit login details to backend
|
297 |
-
function submitLogin() {
|
298 |
-
let email = document.getElementById('loginEmail').value;
|
299 |
-
let mobile = document.getElementById('loginMobile').value;
|
300 |
-
fetch('/submit_login', {
|
301 |
-
method: 'POST',
|
302 |
-
headers: { 'Content-Type': 'application/json' },
|
303 |
-
body: JSON.stringify({ email: email, mobile: mobile })
|
304 |
-
})
|
305 |
-
.then(response => response.json())
|
306 |
-
.then(data => {
|
307 |
-
speak("Login successful. Welcome back!");
|
308 |
-
// Redirect or perform other actions
|
309 |
-
})
|
310 |
-
.catch(error => {
|
311 |
-
speak("There was an error with your login. Please try again.");
|
312 |
-
});
|
313 |
-
}
|
314 |
-
|
315 |
window.onload = function () {
|
316 |
askLoginOrRegister();
|
317 |
};
|
|
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Biryani Hub Login & Registration</title>
|
8 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
9 |
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
10 |
+
<style>
|
11 |
+
body {
|
12 |
+
font-family: 'Roboto', sans-serif;
|
13 |
+
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
14 |
+
margin: 0;
|
15 |
+
display: flex;
|
16 |
+
justify-content: center;
|
17 |
+
align-items: center;
|
18 |
+
height: 100vh;
|
19 |
+
text-align: center;
|
20 |
+
}
|
21 |
+
.container {
|
22 |
+
background-color: #fff; /* White background for contrast */
|
23 |
+
padding: 40px 50px;
|
24 |
+
border-radius: 10px;
|
25 |
+
width: 450px;
|
26 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
27 |
+
margin-right: 20px;
|
28 |
+
}
|
29 |
+
h1 {
|
30 |
+
font-size: 30px;
|
31 |
+
font-weight: bold;
|
32 |
+
color: #ff6a00;
|
33 |
+
}
|
34 |
+
label {
|
35 |
+
font-size: 16px;
|
36 |
+
margin-top: 20px;
|
37 |
+
display: block;
|
38 |
+
text-align: left;
|
39 |
+
font-weight: bold;
|
40 |
+
color: #333;
|
41 |
+
}
|
42 |
+
input[type="text"] {
|
43 |
+
width: 100%;
|
44 |
+
padding: 12px;
|
45 |
+
font-size: 16px;
|
46 |
+
border: 2px solid #ccc;
|
47 |
+
border-radius: 8px;
|
48 |
+
margin-top: 8px;
|
49 |
+
box-sizing: border-box;
|
50 |
+
background-color: #f9f9f9;
|
51 |
+
}
|
52 |
+
input[type="text"]:focus {
|
53 |
+
border-color: #ff6a00;
|
54 |
+
outline: none;
|
55 |
+
}
|
56 |
+
.info {
|
57 |
+
margin-top: 20px;
|
58 |
+
font-size: 16px;
|
59 |
+
color: #ff6a00;
|
60 |
+
font-weight: bold;
|
61 |
+
}
|
62 |
+
.status {
|
63 |
+
font-size: 14px;
|
64 |
+
color: gray;
|
65 |
+
margin-top: 20px;
|
66 |
+
}
|
67 |
+
.form-container {
|
68 |
+
display: flex;
|
69 |
+
justify-content: space-between;
|
70 |
+
gap: 30px;
|
71 |
+
}
|
72 |
+
.form-container > div {
|
73 |
+
width: 48%;
|
74 |
+
}
|
75 |
+
.form-section {
|
76 |
+
padding: 20px;
|
77 |
+
background-color: #f9f9f9;
|
78 |
+
border-radius: 10px;
|
79 |
+
}
|
80 |
+
.header {
|
81 |
+
font-size: 24px;
|
82 |
+
font-weight: bold;
|
83 |
+
color: #ff6a00;
|
84 |
+
}
|
85 |
+
</style>
|
86 |
</head>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
<body>
|
88 |
<div class="container">
|
89 |
<h1>Welcome to Biryani Hub π½ π</h1>
|
90 |
|
91 |
+
<!-- Form Section -->
|
92 |
+
<div class="form-container">
|
93 |
+
<!-- Registration Form -->
|
94 |
+
<div class="form-section" id="registrationForm" style="display: block;">
|
95 |
+
<h2 class="header">Register</h2>
|
96 |
+
<label for="name">Your Name</label>
|
97 |
+
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
98 |
+
|
99 |
+
<label for="email">Your Email</label>
|
100 |
+
<input type="text" id="email" placeholder="Your email will appear here..." readonly>
|
101 |
+
|
102 |
+
<label for="mobile">Your Mobile Number</label>
|
103 |
+
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
|
|
|
|
|
|
104 |
|
105 |
+
<p class="info" id="infoMessage">Listening π£ποΈ...</p>
|
106 |
+
<p class="status" id="status">π...</p>
|
107 |
+
</div>
|
108 |
|
109 |
+
<!-- Login Form -->
|
110 |
+
<div class="form-section" id="loginForm" style="display: none;">
|
111 |
+
<h2 class="header">Login</h2>
|
112 |
+
<label for="loginEmail">Your Email</label>
|
113 |
+
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
114 |
+
|
115 |
+
<label for="loginMobile">Your Mobile Number</label>
|
116 |
+
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
117 |
|
118 |
+
<p class="info" id="infoMessageLogin">Listening π£ποΈ...</p>
|
119 |
+
<p class="status" id="statusLogin">π...</p>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
</div>
|
123 |
|
124 |
<script>
|
|
|
264 |
});
|
265 |
}
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
window.onload = function () {
|
268 |
askLoginOrRegister();
|
269 |
};
|