Update templates/index.html
Browse files- templates/index.html +198 -29
templates/index.html
CHANGED
@@ -4,46 +4,215 @@
|
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
-
<title>Biryani Hub -
|
8 |
-
<link
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</head>
|
10 |
<body>
|
11 |
-
<
|
12 |
-
<h1>Welcome to Biryani Hub π½</h1>
|
13 |
-
<label for="name">Your Name</label>
|
14 |
-
<input type="text" id="name" placeholder="Your name..." readonly>
|
15 |
|
16 |
-
|
17 |
-
<
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
</div>
|
25 |
|
26 |
<script>
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
} else {
|
43 |
-
|
44 |
}
|
45 |
-
}
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
</script>
|
48 |
</body>
|
49 |
</html>
|
|
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Biryani Hub - Register & Login</title>
|
8 |
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
9 |
+
<style>
|
10 |
+
body {
|
11 |
+
font-family: 'Roboto', sans-serif;
|
12 |
+
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
13 |
+
margin: 0;
|
14 |
+
display: flex;
|
15 |
+
flex-direction: column;
|
16 |
+
justify-content: center;
|
17 |
+
align-items: center;
|
18 |
+
height: 100vh;
|
19 |
+
text-align: center;
|
20 |
+
}
|
21 |
+
.header-title {
|
22 |
+
font-size: 40px;
|
23 |
+
font-weight: bold;
|
24 |
+
color: white;
|
25 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
|
26 |
+
margin-bottom: 20px;
|
27 |
+
}
|
28 |
+
.container {
|
29 |
+
background-color: #fff;
|
30 |
+
padding: 40px 50px;
|
31 |
+
border-radius: 10px;
|
32 |
+
width: 500px;
|
33 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
34 |
+
display: none; /* Initially hidden, will show based on selection */
|
35 |
+
}
|
36 |
+
.form-container {
|
37 |
+
width: 100%;
|
38 |
+
}
|
39 |
+
h2 {
|
40 |
+
font-size: 24px;
|
41 |
+
font-weight: bold;
|
42 |
+
color: #ff6a00;
|
43 |
+
margin-bottom: 20px;
|
44 |
+
}
|
45 |
+
label {
|
46 |
+
font-size: 16px;
|
47 |
+
display: block;
|
48 |
+
text-align: left;
|
49 |
+
font-weight: bold;
|
50 |
+
color: #333;
|
51 |
+
margin-top: 10px;
|
52 |
+
}
|
53 |
+
input {
|
54 |
+
width: 100%;
|
55 |
+
padding: 12px;
|
56 |
+
font-size: 16px;
|
57 |
+
border: 2px solid #ccc;
|
58 |
+
border-radius: 8px;
|
59 |
+
margin-top: 8px;
|
60 |
+
box-sizing: border-box;
|
61 |
+
background-color: #f9f9f9;
|
62 |
+
}
|
63 |
+
input:focus {
|
64 |
+
border-color: #ff6a00;
|
65 |
+
outline: none;
|
66 |
+
}
|
67 |
+
.info {
|
68 |
+
margin-top: 20px;
|
69 |
+
font-size: 16px;
|
70 |
+
color: #ff6a00;
|
71 |
+
font-weight: bold;
|
72 |
+
}
|
73 |
+
.status {
|
74 |
+
font-size: 14px;
|
75 |
+
color: gray;
|
76 |
+
margin-top: 10px;
|
77 |
+
}
|
78 |
+
</style>
|
79 |
</head>
|
80 |
<body>
|
81 |
+
<h1 class="header-title">Welcome to Biryani Hub π½</h1>
|
|
|
|
|
|
|
82 |
|
83 |
+
<div class="container" id="registrationForm">
|
84 |
+
<div class="form-container">
|
85 |
+
<h2>Register</h2>
|
86 |
+
<label for="name">Your Name</label>
|
87 |
+
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
88 |
|
89 |
+
<label for="email">Your Email</label>
|
90 |
+
<input type="text" id="email" placeholder="Your email will appear here..." readonly>
|
91 |
|
92 |
+
<label for="mobile">Your Mobile Number</label>
|
93 |
+
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
94 |
+
|
95 |
+
<p class="info" id="infoMessage">Listening π£ποΈ...</p>
|
96 |
+
<p class="status" id="status">π...</p>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
|
100 |
+
<div class="container" id="loginForm">
|
101 |
+
<div class="form-container">
|
102 |
+
<h2>Login</h2>
|
103 |
+
<label for="loginEmail">Your Email</label>
|
104 |
+
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
105 |
+
|
106 |
+
<label for="loginMobile">Your Mobile Number</label>
|
107 |
+
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
108 |
+
|
109 |
+
<p class="info" id="infoMessageLogin">Listening π£ποΈ...</p>
|
110 |
+
<p class="status" id="statusLogin">π...</p>
|
111 |
+
</div>
|
112 |
</div>
|
113 |
|
114 |
<script>
|
115 |
+
let recognition;
|
116 |
+
if ('webkitSpeechRecognition' in window) {
|
117 |
+
recognition = new webkitSpeechRecognition();
|
118 |
+
recognition.continuous = false;
|
119 |
+
recognition.interimResults = false;
|
120 |
+
recognition.lang = 'en-US';
|
121 |
+
} else {
|
122 |
+
alert("Speech Recognition API is not supported in this browser.");
|
123 |
+
}
|
124 |
+
|
125 |
+
function speak(text, callback) {
|
126 |
+
const speech = new SpeechSynthesisUtterance(text);
|
127 |
+
speech.onend = callback;
|
128 |
+
window.speechSynthesis.speak(speech);
|
129 |
+
}
|
130 |
+
|
131 |
+
function askLoginOrRegister() {
|
132 |
+
speak("Welcome to Biryani Hub. Are you a new customer or an existing customer? Say 'Register' for registration or 'Login' to log in.", function() {
|
133 |
+
recognition.start();
|
134 |
+
recognition.onresult = function(event) {
|
135 |
+
let response = event.results[0][0].transcript.trim().toLowerCase();
|
136 |
+
recognition.stop();
|
137 |
+
if (response.includes("register")) {
|
138 |
+
showRegistrationForm();
|
139 |
+
} else if (response.includes("login")) {
|
140 |
+
showLoginForm();
|
141 |
+
} else {
|
142 |
+
speak("Sorry, I didn't understand. Please say 'Register' for registration or 'Login' to log in.", askLoginOrRegister);
|
143 |
+
}
|
144 |
+
};
|
145 |
+
});
|
146 |
+
}
|
147 |
+
|
148 |
+
function showRegistrationForm() {
|
149 |
+
document.getElementById('registrationForm').style.display = 'block';
|
150 |
+
document.getElementById('loginForm').style.display = 'none';
|
151 |
+
speak("Please tell me your name to begin the registration.", startListeningForName);
|
152 |
+
}
|
153 |
+
|
154 |
+
function showLoginForm() {
|
155 |
+
document.getElementById('loginForm').style.display = 'block';
|
156 |
+
document.getElementById('registrationForm').style.display = 'none';
|
157 |
+
speak("Please tell me your email to begin the login process.", startListeningForLoginEmail);
|
158 |
+
}
|
159 |
+
|
160 |
+
function startListeningForName() {
|
161 |
+
recognition.start();
|
162 |
+
recognition.onresult = function(event) {
|
163 |
+
document.getElementById('name').value = event.results[0][0].transcript.trim();
|
164 |
+
recognition.stop();
|
165 |
+
speak("Your name is " + document.getElementById('name').value + ". Is it correct?", confirmName);
|
166 |
+
};
|
167 |
+
}
|
168 |
+
|
169 |
+
function confirmName() {
|
170 |
+
recognition.start();
|
171 |
+
recognition.onresult = function(event) {
|
172 |
+
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
173 |
+
recognition.stop();
|
174 |
+
if (confirmation.includes("ok")) {
|
175 |
+
speak("Great! Now, tell me your email.", startListeningForEmail);
|
176 |
} else {
|
177 |
+
speak("Let's try again. Tell me your name.", startListeningForName);
|
178 |
}
|
179 |
+
};
|
180 |
}
|
181 |
+
|
182 |
+
function startListeningForEmail() {
|
183 |
+
recognition.start();
|
184 |
+
recognition.onresult = function(event) {
|
185 |
+
document.getElementById('email').value = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
186 |
+
recognition.stop();
|
187 |
+
speak("You said " + document.getElementById('email').value + ". Is it correct?", confirmEmail);
|
188 |
+
};
|
189 |
+
}
|
190 |
+
|
191 |
+
function confirmEmail() {
|
192 |
+
recognition.start();
|
193 |
+
recognition.onresult = function(event) {
|
194 |
+
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
195 |
+
recognition.stop();
|
196 |
+
if (confirmation.includes("ok")) {
|
197 |
+
speak("Great! Now, tell me your mobile number.", startListeningForMobile);
|
198 |
+
} else {
|
199 |
+
speak("Let's try again. Tell me your email.", startListeningForEmail);
|
200 |
+
}
|
201 |
+
};
|
202 |
+
}
|
203 |
+
|
204 |
+
function startListeningForLoginEmail() {
|
205 |
+
recognition.start();
|
206 |
+
recognition.onresult = function(event) {
|
207 |
+
document.getElementById('loginEmail').value = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
208 |
+
recognition.stop();
|
209 |
+
speak("You said " + document.getElementById('loginEmail').value + ". Is it correct?", confirmLoginEmail);
|
210 |
+
};
|
211 |
+
}
|
212 |
+
|
213 |
+
window.onload = function () {
|
214 |
+
askLoginOrRegister();
|
215 |
+
};
|
216 |
</script>
|
217 |
</body>
|
218 |
</html>
|