Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +188 -61
templates/index.html
CHANGED
@@ -5,71 +5,143 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Biryani Hub Registration</title>
|
7 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
8 |
-
<
|
9 |
-
body {
|
10 |
-
font-family: 'Roboto', sans-serif;
|
11 |
-
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
12 |
-
margin: 0;
|
13 |
-
display: flex;
|
14 |
-
justify-content: center;
|
15 |
-
align-items: center;
|
16 |
-
height: 100vh;
|
17 |
-
text-align: center;
|
18 |
-
}
|
19 |
-
.container {
|
20 |
-
background-color: #87ceeb; /* Light blue */
|
21 |
-
padding: 40px 50px;
|
22 |
-
border-radius: 10px;
|
23 |
-
width: 400px;
|
24 |
-
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
25 |
-
}
|
26 |
-
h1 {
|
27 |
-
font-size: 30px;
|
28 |
-
font-weight: bold;
|
29 |
-
color: #ff6a00;
|
30 |
-
}
|
31 |
-
label {
|
32 |
-
font-size: 16px;
|
33 |
-
margin-top: 20px;
|
34 |
-
display: block;
|
35 |
-
text-align: left;
|
36 |
-
font-weight: bold;
|
37 |
-
}
|
38 |
-
input[type="text"] {
|
39 |
-
width: 100%;
|
40 |
-
padding: 12px;
|
41 |
-
font-size: 16px;
|
42 |
-
border: 2px solid #ccc;
|
43 |
-
border-radius: 8px;
|
44 |
-
margin-top: 8px;
|
45 |
-
box-sizing: border-box;
|
46 |
-
}
|
47 |
-
input[type="text"]:focus {
|
48 |
-
border-color: #ff6a00;
|
49 |
-
outline: none;
|
50 |
-
}
|
51 |
-
.info {
|
52 |
-
margin-top: 20px;
|
53 |
-
font-size: 16px;
|
54 |
-
color: #ff6a00;
|
55 |
-
font-weight: bold;
|
56 |
-
}
|
57 |
-
.status {
|
58 |
-
font-size: 14px;
|
59 |
-
color: gray;
|
60 |
-
margin-top: 20px;
|
61 |
-
}
|
62 |
-
.image-logo {
|
63 |
-
width: 80px;
|
64 |
-
margin-bottom: 20px;
|
65 |
-
}
|
66 |
-
</style>
|
67 |
</head>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
<body>
|
69 |
<div class="container">
|
|
|
70 |
<h1>Welcome to Biryani Hub 🍽 🍗</h1>
|
71 |
|
72 |
-
|
73 |
<label for="name">Your Name</label>
|
74 |
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
75 |
|
@@ -79,15 +151,25 @@
|
|
79 |
<label for="mobile">Your Mobile Number</label>
|
80 |
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
81 |
|
|
|
|
|
82 |
<p class="info" id="infoMessage">Listening 🗣🎙️...</p>
|
83 |
<p class="status" id="status">🔊...</p>
|
84 |
</div>
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
<script>
|
87 |
let recognition;
|
88 |
let nameCaptured = "";
|
89 |
let emailCaptured = "";
|
90 |
let mobileCaptured = "";
|
|
|
91 |
if ('webkitSpeechRecognition' in window) {
|
92 |
recognition = new webkitSpeechRecognition();
|
93 |
recognition.continuous = false;
|
@@ -96,11 +178,13 @@
|
|
96 |
} else {
|
97 |
alert("Speech Recognition API is not supported in this browser.");
|
98 |
}
|
|
|
99 |
function speak(text, callback) {
|
100 |
const speech = new SpeechSynthesisUtterance(text);
|
101 |
speech.onend = callback;
|
102 |
window.speechSynthesis.speak(speech);
|
103 |
}
|
|
|
104 |
function startListeningForName() {
|
105 |
recognition.start();
|
106 |
recognition.onresult = function(event) {
|
@@ -110,6 +194,7 @@
|
|
110 |
setTimeout(confirmName, 500);
|
111 |
};
|
112 |
}
|
|
|
113 |
function confirmName() {
|
114 |
speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
|
115 |
recognition.start();
|
@@ -124,6 +209,7 @@
|
|
124 |
};
|
125 |
});
|
126 |
}
|
|
|
127 |
function startListeningForEmail() {
|
128 |
recognition.start();
|
129 |
recognition.onresult = function(event) {
|
@@ -144,6 +230,7 @@
|
|
144 |
});
|
145 |
};
|
146 |
}
|
|
|
147 |
function startListeningForMobile() {
|
148 |
recognition.start();
|
149 |
recognition.onresult = function(event) {
|
@@ -165,6 +252,7 @@
|
|
165 |
});
|
166 |
};
|
167 |
}
|
|
|
168 |
function startProcess() {
|
169 |
speak("Welcome to Biryani Hub", function() {
|
170 |
speak("Tell me your name, and I will confirm it with you.", function() {
|
@@ -172,9 +260,48 @@
|
|
172 |
});
|
173 |
});
|
174 |
}
|
|
|
175 |
window.onload = function () {
|
176 |
setTimeout(startProcess, 4000);
|
177 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
</script>
|
179 |
</body>
|
180 |
</html>
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Biryani Hub Registration</title>
|
7 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
8 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</head>
|
10 |
+
<styles>
|
11 |
+
/* static/styles.css */
|
12 |
+
body {
|
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 |
+
#message {
|
126 |
+
margin-top: 20px;
|
127 |
+
font-size: 16px;
|
128 |
+
font-weight: bold;
|
129 |
+
}
|
130 |
+
|
131 |
+
#confirmation {
|
132 |
+
background-color: #f9f9f9;
|
133 |
+
padding: 20px;
|
134 |
+
border-radius: 5px;
|
135 |
+
margin-top: 20px;
|
136 |
+
}
|
137 |
+
|
138 |
+
</styles>
|
139 |
+
|
140 |
<body>
|
141 |
<div class="container">
|
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 |
|
|
|
151 |
<label for="mobile">Your Mobile Number</label>
|
152 |
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
153 |
|
154 |
+
<button type="button" id="confirmBtn">Confirm</button>
|
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 |
let recognition;
|
169 |
let nameCaptured = "";
|
170 |
let emailCaptured = "";
|
171 |
let mobileCaptured = "";
|
172 |
+
|
173 |
if ('webkitSpeechRecognition' in window) {
|
174 |
recognition = new webkitSpeechRecognition();
|
175 |
recognition.continuous = false;
|
|
|
178 |
} else {
|
179 |
alert("Speech Recognition API is not supported in this browser.");
|
180 |
}
|
181 |
+
|
182 |
function speak(text, callback) {
|
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) {
|
|
|
194 |
setTimeout(confirmName, 500);
|
195 |
};
|
196 |
}
|
197 |
+
|
198 |
function confirmName() {
|
199 |
speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
|
200 |
recognition.start();
|
|
|
209 |
};
|
210 |
});
|
211 |
}
|
212 |
+
|
213 |
function startListeningForEmail() {
|
214 |
recognition.start();
|
215 |
recognition.onresult = function(event) {
|
|
|
230 |
});
|
231 |
};
|
232 |
}
|
233 |
+
|
234 |
function startListeningForMobile() {
|
235 |
recognition.start();
|
236 |
recognition.onresult = function(event) {
|
|
|
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() {
|
|
|
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>
|
307 |
</html>
|