Update templates/index.html
Browse files- templates/index.html +18 -43
templates/index.html
CHANGED
@@ -177,85 +177,60 @@
|
|
177 |
function showLoginForm() {
|
178 |
document.getElementById('loginForm').style.display = 'block';
|
179 |
document.getElementById('registrationForm').style.display = 'none';
|
|
|
180 |
}
|
181 |
|
182 |
-
function
|
183 |
-
speak("Please say your
|
184 |
-
recognition.start();
|
185 |
-
recognition.onresult = function (event) {
|
186 |
-
let nameCaptured = event.results[0][0].transcript.trim();
|
187 |
-
document.getElementById('name').value = nameCaptured;
|
188 |
-
recognition.stop();
|
189 |
-
speak("You said " + nameCaptured + ". Is it correct?", function () {
|
190 |
-
confirmName(nameCaptured);
|
191 |
-
});
|
192 |
-
};
|
193 |
-
});
|
194 |
-
}
|
195 |
-
|
196 |
-
function confirmName(nameCaptured) {
|
197 |
-
recognition.start();
|
198 |
-
recognition.onresult = function (event) {
|
199 |
-
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
200 |
-
recognition.stop();
|
201 |
-
if (confirmation.includes("yes") || confirmation.includes("ok")) {
|
202 |
-
captureEmail();
|
203 |
-
} else {
|
204 |
-
captureName();
|
205 |
-
}
|
206 |
-
};
|
207 |
-
}
|
208 |
-
|
209 |
-
function captureEmail() {
|
210 |
-
speak("Now, say your email.", function () {
|
211 |
recognition.start();
|
212 |
recognition.onresult = function (event) {
|
213 |
let emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
214 |
-
document.getElementById('
|
215 |
recognition.stop();
|
216 |
speak("You said " + emailCaptured + ". Is it correct?", function () {
|
217 |
-
|
218 |
});
|
219 |
};
|
220 |
});
|
221 |
}
|
222 |
|
223 |
-
function
|
224 |
recognition.start();
|
225 |
recognition.onresult = function (event) {
|
226 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
227 |
recognition.stop();
|
228 |
if (confirmation.includes("yes") || confirmation.includes("ok")) {
|
229 |
-
|
230 |
} else {
|
231 |
-
|
232 |
}
|
233 |
};
|
234 |
}
|
235 |
|
236 |
-
function
|
237 |
speak("Now, say your mobile number.", function () {
|
238 |
recognition.start();
|
239 |
recognition.onresult = function (event) {
|
240 |
let mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
241 |
-
document.getElementById('
|
242 |
recognition.stop();
|
243 |
speak("You said " + mobileCaptured + ". Is it correct?", function () {
|
244 |
-
|
245 |
});
|
246 |
};
|
247 |
});
|
248 |
}
|
249 |
|
250 |
-
function
|
251 |
recognition.start();
|
252 |
recognition.onresult = function (event) {
|
253 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
254 |
recognition.stop();
|
255 |
if (confirmation.includes("yes") || confirmation.includes("ok")) {
|
|
|
256 |
showConfirmationDetails();
|
257 |
} else {
|
258 |
-
|
259 |
}
|
260 |
};
|
261 |
}
|
@@ -263,8 +238,8 @@
|
|
263 |
// Show the confirmation details to the user
|
264 |
function showConfirmationDetails() {
|
265 |
const name = document.getElementById('name').value;
|
266 |
-
const email = document.getElementById('
|
267 |
-
const phone = document.getElementById('
|
268 |
|
269 |
document.getElementById('confirmedName').textContent = "Name: " + name;
|
270 |
document.getElementById('confirmedEmail').textContent = "Email: " + email;
|
@@ -276,8 +251,8 @@
|
|
276 |
// Automatically submit to backend (Salesforce)
|
277 |
function submitDetails() {
|
278 |
const name = document.getElementById('name').value;
|
279 |
-
const email = document.getElementById('
|
280 |
-
const phone = document.getElementById('
|
281 |
|
282 |
// Send the details to your backend for Salesforce submission
|
283 |
fetch('/submit', {
|
|
|
177 |
function showLoginForm() {
|
178 |
document.getElementById('loginForm').style.display = 'block';
|
179 |
document.getElementById('registrationForm').style.display = 'none';
|
180 |
+
captureLoginEmail();
|
181 |
}
|
182 |
|
183 |
+
function captureLoginEmail() {
|
184 |
+
speak("Please say your email for login.", function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
recognition.start();
|
186 |
recognition.onresult = function (event) {
|
187 |
let emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
188 |
+
document.getElementById('loginEmail').value = emailCaptured;
|
189 |
recognition.stop();
|
190 |
speak("You said " + emailCaptured + ". Is it correct?", function () {
|
191 |
+
confirmLoginEmail(emailCaptured);
|
192 |
});
|
193 |
};
|
194 |
});
|
195 |
}
|
196 |
|
197 |
+
function confirmLoginEmail(emailCaptured) {
|
198 |
recognition.start();
|
199 |
recognition.onresult = function (event) {
|
200 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
201 |
recognition.stop();
|
202 |
if (confirmation.includes("yes") || confirmation.includes("ok")) {
|
203 |
+
captureLoginMobile();
|
204 |
} else {
|
205 |
+
captureLoginEmail();
|
206 |
}
|
207 |
};
|
208 |
}
|
209 |
|
210 |
+
function captureLoginMobile() {
|
211 |
speak("Now, say your mobile number.", function () {
|
212 |
recognition.start();
|
213 |
recognition.onresult = function (event) {
|
214 |
let mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
215 |
+
document.getElementById('loginMobile').value = mobileCaptured;
|
216 |
recognition.stop();
|
217 |
speak("You said " + mobileCaptured + ". Is it correct?", function () {
|
218 |
+
confirmLoginMobile(mobileCaptured);
|
219 |
});
|
220 |
};
|
221 |
});
|
222 |
}
|
223 |
|
224 |
+
function confirmLoginMobile(mobileCaptured) {
|
225 |
recognition.start();
|
226 |
recognition.onresult = function (event) {
|
227 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
228 |
recognition.stop();
|
229 |
if (confirmation.includes("yes") || confirmation.includes("ok")) {
|
230 |
+
// After confirmation, show the details and submit
|
231 |
showConfirmationDetails();
|
232 |
} else {
|
233 |
+
captureLoginMobile();
|
234 |
}
|
235 |
};
|
236 |
}
|
|
|
238 |
// Show the confirmation details to the user
|
239 |
function showConfirmationDetails() {
|
240 |
const name = document.getElementById('name').value;
|
241 |
+
const email = document.getElementById('loginEmail').value;
|
242 |
+
const phone = document.getElementById('loginMobile').value;
|
243 |
|
244 |
document.getElementById('confirmedName').textContent = "Name: " + name;
|
245 |
document.getElementById('confirmedEmail').textContent = "Email: " + email;
|
|
|
251 |
// Automatically submit to backend (Salesforce)
|
252 |
function submitDetails() {
|
253 |
const name = document.getElementById('name').value;
|
254 |
+
const email = document.getElementById('loginEmail').value;
|
255 |
+
const phone = document.getElementById('loginMobile').value;
|
256 |
|
257 |
// Send the details to your backend for Salesforce submission
|
258 |
fetch('/submit', {
|