Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +50 -285
templates/index.html
CHANGED
@@ -3,304 +3,69 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>Biryani Hub
|
7 |
-
<
|
8 |
-
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
9 |
</head>
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
font-family: 'Roboto', sans-serif;
|
14 |
-
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
15 |
-
margin: 0;
|
16 |
-
display: flex;
|
17 |
-
justify-content: center;
|
18 |
-
align-items: center;
|
19 |
-
height: 100vh;
|
20 |
-
text-align: center;
|
21 |
-
}
|
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 |
-
|
31 |
-
h1 {
|
32 |
-
font-size: 30px;
|
33 |
-
font-weight: bold;
|
34 |
-
color: #ff6a00;
|
35 |
-
}
|
36 |
-
|
37 |
-
label {
|
38 |
-
font-size: 16px;
|
39 |
-
margin-top: 20px;
|
40 |
-
display: block;
|
41 |
-
text-align: left;
|
42 |
-
font-weight: bold;
|
43 |
-
}
|
44 |
-
|
45 |
-
input[type="text"] {
|
46 |
-
width: 100%;
|
47 |
-
padding: 12px;
|
48 |
-
font-size: 16px;
|
49 |
-
border: 2px solid #ccc;
|
50 |
-
border-radius: 8px;
|
51 |
-
margin-top: 8px;
|
52 |
-
box-sizing: border-box;
|
53 |
-
}
|
54 |
-
|
55 |
-
input[type="text"]:focus {
|
56 |
-
border-color: #ff6a00;
|
57 |
-
outline: none;
|
58 |
-
}
|
59 |
-
|
60 |
-
.info {
|
61 |
-
margin-top: 20px;
|
62 |
-
font-size: 16px;
|
63 |
-
color: #ff6a00;
|
64 |
-
font-weight: bold;
|
65 |
-
}
|
66 |
-
|
67 |
-
.status {
|
68 |
-
font-size: 14px;
|
69 |
-
color: gray;
|
70 |
-
margin-top: 20px;
|
71 |
-
}
|
72 |
-
|
73 |
-
.image-logo {
|
74 |
-
width: 80px;
|
75 |
-
margin-bottom: 20px;
|
76 |
-
}
|
77 |
-
|
78 |
-
/* static/styles.css */
|
79 |
-
body {
|
80 |
-
font-family: Arial, sans-serif;
|
81 |
-
margin: 0;
|
82 |
-
padding: 0;
|
83 |
-
background-color: #f0f0f0;
|
84 |
-
}
|
85 |
-
|
86 |
-
.container {
|
87 |
-
width: 60%;
|
88 |
-
margin: 0 auto;
|
89 |
-
padding: 20px;
|
90 |
-
background-color: #fff;
|
91 |
-
border-radius: 10px;
|
92 |
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
93 |
-
margin-top: 50px;
|
94 |
-
}
|
95 |
-
|
96 |
-
h1 {
|
97 |
-
color: #333;
|
98 |
-
}
|
99 |
-
|
100 |
-
label {
|
101 |
-
font-weight: bold;
|
102 |
-
}
|
103 |
-
|
104 |
-
input[type="text"], input[type="email"] {
|
105 |
-
width: 100%;
|
106 |
-
padding: 10px;
|
107 |
-
margin: 10px 0;
|
108 |
-
border: 1px solid #ccc;
|
109 |
-
border-radius: 5px;
|
110 |
-
}
|
111 |
-
|
112 |
-
button {
|
113 |
-
background-color: #4CAF50;
|
114 |
-
color: white;
|
115 |
-
padding: 10px 20px;
|
116 |
-
border: none;
|
117 |
-
border-radius: 5px;
|
118 |
-
cursor: pointer;
|
119 |
-
}
|
120 |
-
|
121 |
-
button:hover {
|
122 |
-
background-color: #45a049;
|
123 |
-
}
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
}
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
padding: 20px;
|
134 |
-
border-radius: 5px;
|
135 |
-
margin-top: 20px;
|
136 |
-
}
|
137 |
|
138 |
-
|
|
|
139 |
|
140 |
-
<
|
141 |
-
|
142 |
-
<img src="https://yourimageurl.com/logo.png" alt="Logo" class="image-logo">
|
143 |
-
<h1>Welcome to Biryani Hub 🍽 🍗</h1>
|
144 |
-
|
145 |
-
<label for="name">Your Name</label>
|
146 |
-
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
147 |
-
|
148 |
-
<label for="email">Your Email</label>
|
149 |
-
<input type="text" id="email" placeholder="Your email will appear here..." readonly>
|
150 |
-
|
151 |
-
<label for="mobile">Your Mobile Number</label>
|
152 |
-
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
153 |
|
154 |
-
|
155 |
|
156 |
-
<p class="info" id="infoMessage">Listening 🗣🎙️...</p>
|
157 |
-
<p class="status" id="status">🔊...</p>
|
158 |
-
</div>
|
159 |
-
|
160 |
-
<div id="confirmation" style="display: none;">
|
161 |
-
<h2>Confirm Your Details:</h2>
|
162 |
-
<p><strong>Name:</strong> <span id="confirmName"></span></p>
|
163 |
-
<p><strong>Email:</strong> <span id="confirmEmail"></span></p>
|
164 |
-
<p><strong>Phone:</strong> <span id="confirmPhone"></span></p>
|
165 |
-
<button type="button" id="submitBtn">Submit</button>
|
166 |
-
</div>
|
167 |
<script>
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
const speech = new SpeechSynthesisUtterance(text);
|
184 |
-
speech.onend = callback;
|
185 |
-
window.speechSynthesis.speak(speech);
|
186 |
-
}
|
187 |
-
|
188 |
-
function startListeningForName() {
|
189 |
-
recognition.start();
|
190 |
-
recognition.onresult = function(event) {
|
191 |
-
nameCaptured = event.results[0][0].transcript.trim();
|
192 |
-
document.getElementById('name').value = nameCaptured;
|
193 |
-
recognition.stop();
|
194 |
-
setTimeout(confirmName, 500);
|
195 |
-
};
|
196 |
-
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
recognition.stop();
|
204 |
-
if (confirmation.includes("ok") || confirmation.includes("yes")) {
|
205 |
-
setTimeout(() => speak("Great! Now, tell me your email.", startListeningForEmail), 500);
|
206 |
-
} else {
|
207 |
-
setTimeout(() => speak("Let's try again. Tell me your name.", startListeningForName), 500);
|
208 |
-
}
|
209 |
};
|
210 |
-
});
|
211 |
-
}
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
speak("Let's try again. Tell me your email.", startListeningForEmail);
|
228 |
-
}
|
229 |
-
};
|
230 |
-
});
|
231 |
-
};
|
232 |
-
}
|
233 |
-
|
234 |
-
function startListeningForMobile() {
|
235 |
-
recognition.start();
|
236 |
-
recognition.onresult = function(event) {
|
237 |
-
mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
238 |
-
document.getElementById('mobile').value = mobileCaptured;
|
239 |
-
recognition.stop();
|
240 |
-
speak("You said " + mobileCaptured + ". Is it correct?", function() {
|
241 |
-
recognition.start();
|
242 |
-
recognition.onresult = function(event) {
|
243 |
-
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
244 |
-
recognition.stop();
|
245 |
-
if (confirmation.includes("ok") || confirmation.includes("yes")) {
|
246 |
-
speak("Your registration is complete. Thank you for registering.");
|
247 |
-
setTimeout(() => location.reload(), 20000);
|
248 |
-
} else {
|
249 |
-
speak("Let's try again. Tell me your mobile number.", startListeningForMobile);
|
250 |
-
}
|
251 |
-
};
|
252 |
-
});
|
253 |
-
};
|
254 |
-
}
|
255 |
-
|
256 |
-
function startProcess() {
|
257 |
-
speak("Welcome to Biryani Hub", function() {
|
258 |
-
speak("Tell me your name, and I will confirm it with you.", function() {
|
259 |
-
setTimeout(startListeningForName, 500);
|
260 |
});
|
261 |
});
|
262 |
-
}
|
263 |
-
|
264 |
-
window.onload = function () {
|
265 |
-
setTimeout(startProcess, 4000);
|
266 |
-
};
|
267 |
-
|
268 |
-
document.getElementById('confirmBtn').addEventListener('click', function() {
|
269 |
-
var name = document.getElementById('name').value;
|
270 |
-
var email = document.getElementById('email').value;
|
271 |
-
var phone = document.getElementById('phone').value;
|
272 |
-
|
273 |
-
// Show confirmation details
|
274 |
-
document.getElementById('confirmName').textContent = name;
|
275 |
-
document.getElementById('confirmEmail').textContent = email;
|
276 |
-
document.getElementById('confirmPhone').textContent = phone;
|
277 |
-
|
278 |
-
// Hide the form and show confirmation
|
279 |
-
document.getElementById('userForm').style.display = 'none';
|
280 |
-
document.getElementById('confirmation').style.display = 'block';
|
281 |
-
});
|
282 |
-
|
283 |
-
document.getElementById('submitBtn').addEventListener('click', function() {
|
284 |
-
var name = document.getElementById('name').value;
|
285 |
-
var email = document.getElementById('email').value;
|
286 |
-
var phone = document.getElementById('phone').value;
|
287 |
-
|
288 |
-
fetch('/submit', {
|
289 |
-
method: 'POST',
|
290 |
-
headers: {
|
291 |
-
'Content-Type': 'application/json'
|
292 |
-
},
|
293 |
-
body: JSON.stringify({ name: name, email: email, phone: phone })
|
294 |
-
})
|
295 |
-
.then(response => response.json())
|
296 |
-
.then(data => {
|
297 |
-
if (data.success) {
|
298 |
-
document.getElementById('message').textContent = 'Your details were submitted successfully!';
|
299 |
-
} else {
|
300 |
-
document.getElementById('message').textContent = 'There was an error submitting your details.';
|
301 |
-
}
|
302 |
-
document.getElementById('message').style.display = 'block';
|
303 |
-
});
|
304 |
});
|
305 |
</script>
|
306 |
</body>
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Biryani Hub Login</title>
|
7 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
8 |
</head>
|
9 |
+
<body>
|
10 |
+
<h1>Welcome to Biryani Hub!</h1>
|
11 |
+
<p>Please provide your details:</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
<!-- User Input Form -->
|
14 |
+
<form id="userDetailsForm">
|
15 |
+
<label for="name">Name:</label>
|
16 |
+
<input type="text" id="name" name="name" required><br><br>
|
|
|
17 |
|
18 |
+
<label for="email">Email:</label>
|
19 |
+
<input type="email" id="email" name="email" required><br><br>
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
<label for="phone">Phone Number:</label>
|
22 |
+
<input type="text" id="phone" name="phone" required><br><br>
|
23 |
|
24 |
+
<button type="submit">Submit</button>
|
25 |
+
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
<div id="responseMessage"></div>
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
<script>
|
30 |
+
$(document).ready(function() {
|
31 |
+
// Handle form submission
|
32 |
+
$('#userDetailsForm').on('submit', function(event) {
|
33 |
+
event.preventDefault();
|
34 |
+
|
35 |
+
// Get form values
|
36 |
+
var name = $('#name').val();
|
37 |
+
var email = $('#email').val();
|
38 |
+
var phone = $('#phone').val();
|
39 |
+
|
40 |
+
// Validate the input
|
41 |
+
if (!name || !email || !phone) {
|
42 |
+
$('#responseMessage').text("All fields are required.");
|
43 |
+
return;
|
44 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
// Create an object with the data
|
47 |
+
var formData = {
|
48 |
+
name: name,
|
49 |
+
email: email,
|
50 |
+
phone: phone
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
};
|
|
|
|
|
52 |
|
53 |
+
// Send the data to the backend via POST request
|
54 |
+
$.ajax({
|
55 |
+
url: '/submit', // Backend route to handle data
|
56 |
+
type: 'POST',
|
57 |
+
contentType: 'application/json',
|
58 |
+
data: JSON.stringify(formData),
|
59 |
+
success: function(response) {
|
60 |
+
// Handle the success response
|
61 |
+
$('#responseMessage').text("User registered successfully!");
|
62 |
+
},
|
63 |
+
error: function(xhr, status, error) {
|
64 |
+
// Handle the error response
|
65 |
+
$('#responseMessage').text("Error: " + xhr.responseJSON.error);
|
66 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
});
|
68 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
});
|
70 |
</script>
|
71 |
</body>
|