lokesh341 commited on
Commit
731cc60
Β·
verified Β·
1 Parent(s): af04085

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +54 -87
templates/index.html CHANGED
@@ -4,7 +4,7 @@
4
  <head>
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Biryani Hub - Login or Registration</title>
8
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
9
  <style>
10
  body {
@@ -21,8 +21,13 @@
21
  background-color: #fff;
22
  padding: 40px 50px;
23
  border-radius: 10px;
24
- width: 450px;
25
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
 
 
 
 
 
26
  }
27
  h1 {
28
  font-size: 30px;
@@ -62,34 +67,50 @@
62
  color: gray;
63
  margin-top: 20px;
64
  }
65
- .form-container {
66
- display: flex;
67
- justify-content: space-between;
68
- gap: 30px;
69
- }
70
- .form-container > div {
71
- width: 48%;
72
  }
73
  .form-section {
74
  padding: 20px;
75
  background-color: #f9f9f9;
76
  border-radius: 10px;
77
  }
78
- .header {
79
- font-size: 24px;
 
 
 
 
 
 
 
80
  font-weight: bold;
81
- color: #ff6a00;
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
  </style>
84
  </head>
85
  <body>
86
  <div class="container">
87
- <h1>Welcome to Biryani Hub 🍽 πŸ—</h1>
88
-
89
- <!-- Form Section -->
90
- <div class="form-container">
91
- <!-- Registration Form -->
92
- <div class="form-section" id="registrationForm" style="display: none;">
93
  <h2 class="header">Register</h2>
94
  <label for="name">Your Name</label>
95
  <input type="text" id="name" placeholder="Your name will appear here..." readonly>
@@ -103,9 +124,12 @@
103
  <p class="info" id="infoMessage">Listening πŸ—£πŸŽ™οΈ...</p>
104
  <p class="status" id="status">πŸ”Š...</p>
105
  </div>
 
106
 
107
- <!-- Login Form -->
108
- <div class="form-section" id="loginForm" style="display: none;">
 
 
109
  <h2 class="header">Login</h2>
110
  <label for="loginEmail">Your Email</label>
111
  <input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
@@ -119,6 +143,15 @@
119
  </div>
120
  </div>
121
 
 
 
 
 
 
 
 
 
 
122
  <script>
123
  let recognition;
124
  let nameCaptured = "";
@@ -140,7 +173,7 @@
140
  window.speechSynthesis.speak(speech);
141
  }
142
 
143
- // Function to ask user if they want to register or login
144
  function askLoginOrRegister() {
145
  speak("Are you a new customer or an existing customer? Say 'new' for registration or 'existing' for login.", function() {
146
  recognition.start();
@@ -275,72 +308,6 @@
275
  });
276
  }
277
 
278
- // Start login process
279
- function startListeningForLoginEmail() {
280
- recognition.start();
281
- recognition.onresult = function(event) {
282
- emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
283
- document.getElementById('loginEmail').value = emailCaptured;
284
- recognition.stop();
285
- speak("You said " + emailCaptured + ". Is it correct?", confirmLoginEmail);
286
- };
287
- }
288
-
289
- function confirmLoginEmail() {
290
- recognition.start();
291
- recognition.onresult = function(event) {
292
- let confirmation = event.results[0][0].transcript.trim().toLowerCase();
293
- recognition.stop();
294
- if (confirmation.includes("ok")) {
295
- speak("Great! Now, tell me your mobile number.", startListeningForLoginMobile);
296
- } else {
297
- speak("Let's try again. Tell me your email.", startListeningForLoginEmail);
298
- }
299
- };
300
- }
301
-
302
- function startListeningForLoginMobile() {
303
- recognition.start();
304
- recognition.onresult = function(event) {
305
- mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
306
- document.getElementById('loginMobile').value = mobileCaptured;
307
- recognition.stop();
308
- speak("You said " + mobileCaptured + ". Is it correct?", confirmLoginMobile);
309
- };
310
- }
311
-
312
- function confirmLoginMobile() {
313
- recognition.start();
314
- recognition.onresult = function(event) {
315
- let confirmation = event.results[0][0].transcript.trim().toLowerCase();
316
- recognition.stop();
317
- if (confirmation.includes("ok")) {
318
- submitLogin();
319
- } else {
320
- speak("Let's try again. Tell me your mobile number.", startListeningForLoginMobile);
321
- }
322
- };
323
- }
324
-
325
- // Submit login details to backend
326
- function submitLogin() {
327
- let email = document.getElementById('loginEmail').value;
328
- let mobile = document.getElementById('loginMobile').value;
329
- fetch('/submit_login', {
330
- method: 'POST',
331
- headers: { 'Content-Type': 'application/json' },
332
- body: JSON.stringify({ email: email, mobile: mobile })
333
- })
334
- .then(response => response.json())
335
- .then(data => {
336
- speak("Login successful. Welcome back!");
337
- // Redirect or perform other actions
338
- })
339
- .catch(error => {
340
- speak("There was an error with your login. Please try again.");
341
- });
342
- }
343
-
344
  window.onload = function () {
345
  askLoginOrRegister();
346
  };
 
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 {
 
21
  background-color: #fff;
22
  padding: 40px 50px;
23
  border-radius: 10px;
24
+ width: 500px;
25
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
26
+ display: flex;
27
+ justify-content: space-between;
28
+ }
29
+ .form-container {
30
+ width: 48%;
31
  }
32
  h1 {
33
  font-size: 30px;
 
67
  color: gray;
68
  margin-top: 20px;
69
  }
70
+ .header {
71
+ font-size: 24px;
72
+ font-weight: bold;
73
+ color: #ff6a00;
74
+ margin-bottom: 20px;
 
 
75
  }
76
  .form-section {
77
  padding: 20px;
78
  background-color: #f9f9f9;
79
  border-radius: 10px;
80
  }
81
+ #confirmation {
82
+ display: none;
83
+ margin-top: 20px;
84
+ background-color: #f9f9f9;
85
+ padding: 20px;
86
+ border-radius: 10px;
87
+ }
88
+ #confirmation h2 {
89
+ font-size: 20px;
90
  font-weight: bold;
91
+ }
92
+ .confirm-details {
93
+ margin: 10px 0;
94
+ }
95
+ .confirm-button {
96
+ padding: 10px 20px;
97
+ background-color: #ff6a00;
98
+ color: white;
99
+ border: none;
100
+ border-radius: 5px;
101
+ cursor: pointer;
102
+ }
103
+ .confirm-button:hover {
104
+ background-color: #e65e00;
105
  }
106
  </style>
107
  </head>
108
  <body>
109
  <div class="container">
110
+ <!-- Register Section -->
111
+ <div class="form-container" id="registrationForm">
112
+ <h1>Welcome to Biryani Hub 🍽 πŸ—</h1>
113
+ <div class="form-section">
 
 
114
  <h2 class="header">Register</h2>
115
  <label for="name">Your Name</label>
116
  <input type="text" id="name" placeholder="Your name will appear here..." readonly>
 
124
  <p class="info" id="infoMessage">Listening πŸ—£πŸŽ™οΈ...</p>
125
  <p class="status" id="status">πŸ”Š...</p>
126
  </div>
127
+ </div>
128
 
129
+ <!-- Login Section -->
130
+ <div class="form-container" id="loginForm" style="display: none;">
131
+ <h1>Welcome to Biryani Hub 🍽 πŸ—</h1>
132
+ <div class="form-section">
133
  <h2 class="header">Login</h2>
134
  <label for="loginEmail">Your Email</label>
135
  <input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
 
143
  </div>
144
  </div>
145
 
146
+ <!-- Confirmation Section -->
147
+ <div id="confirmation">
148
+ <h2>Confirm Your Details:</h2>
149
+ <p class="confirm-details"><strong>Name:</strong> <span id="confirmName"></span></p>
150
+ <p class="confirm-details"><strong>Email:</strong> <span id="confirmEmail"></span></p>
151
+ <p class="confirm-details"><strong>Phone:</strong> <span id="confirmPhone"></span></p>
152
+ <button class="confirm-button" onclick="autoSubmit()">Confirm</button>
153
+ </div>
154
+
155
  <script>
156
  let recognition;
157
  let nameCaptured = "";
 
173
  window.speechSynthesis.speak(speech);
174
  }
175
 
176
+ // Ask the user if they want to register or login
177
  function askLoginOrRegister() {
178
  speak("Are you a new customer or an existing customer? Say 'new' for registration or 'existing' for login.", function() {
179
  recognition.start();
 
308
  });
309
  }
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  window.onload = function () {
312
  askLoginOrRegister();
313
  };