DSatishchandra commited on
Commit
e5373c3
·
verified ·
1 Parent(s): 79c9afc

Update templates/index.html

Browse files
Files changed (1) hide show
  1. 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 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
-
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
- <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;
176
- recognition.interimResults = false;
177
- recognition.lang = 'en-US';
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) {
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
- function confirmName() {
199
- speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
200
- recognition.start();
201
- recognition.onresult = function(event) {
202
- let confirmation = event.results[0][0].transcript.trim().toLowerCase();
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
- function startListeningForEmail() {
214
- recognition.start();
215
- recognition.onresult = function(event) {
216
- emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
217
- document.getElementById('email').value = emailCaptured;
218
- recognition.stop();
219
- speak("You said " + emailCaptured + ". Is it correct?", function() {
220
- recognition.start();
221
- recognition.onresult = function(event) {
222
- let confirmation = event.results[0][0].transcript.trim().toLowerCase();
223
- recognition.stop();
224
- if (confirmation.includes("ok") || confirmation.includes("yes")) {
225
- setTimeout(() => speak("Great! Now, tell me your mobile number.", startListeningForMobile), 500);
226
- } else {
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>