Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +40 -30
templates/index.html
CHANGED
@@ -75,22 +75,26 @@
|
|
75 |
color: gray;
|
76 |
margin-top: 10px;
|
77 |
}
|
78 |
-
|
79 |
display: none;
|
80 |
-
|
81 |
padding: 20px;
|
|
|
82 |
border-radius: 10px;
|
83 |
-
|
84 |
-
|
85 |
}
|
86 |
.confirm-button {
|
|
|
87 |
padding: 10px 20px;
|
88 |
background-color: #ff6a00;
|
89 |
color: white;
|
90 |
border: none;
|
91 |
border-radius: 5px;
|
92 |
cursor: pointer;
|
93 |
-
|
|
|
|
|
94 |
}
|
95 |
</style>
|
96 |
</head>
|
@@ -126,13 +130,13 @@
|
|
126 |
</div>
|
127 |
</div>
|
128 |
|
129 |
-
<!-- Confirmation
|
130 |
-
<div
|
131 |
<h2>Confirm Your Details:</h2>
|
132 |
<p><strong>Name:</strong> <span id="confirmName"></span></p>
|
133 |
<p><strong>Email:</strong> <span id="confirmEmail"></span></p>
|
134 |
<p><strong>Phone:</strong> <span id="confirmPhone"></span></p>
|
135 |
-
<button class="confirm-button" onclick="
|
136 |
</div>
|
137 |
|
138 |
<script>
|
@@ -142,8 +146,6 @@
|
|
142 |
recognition.continuous = false;
|
143 |
recognition.interimResults = false;
|
144 |
recognition.lang = 'en-US';
|
145 |
-
} else {
|
146 |
-
alert("Speech Recognition API is not supported in this browser.");
|
147 |
}
|
148 |
|
149 |
function speak(text, callback) {
|
@@ -180,7 +182,25 @@
|
|
180 |
recognition.onresult = function(event) {
|
181 |
document.getElementById('name').value = event.results[0][0].transcript.trim();
|
182 |
recognition.stop();
|
183 |
-
speak("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
};
|
185 |
}
|
186 |
|
@@ -188,33 +208,23 @@
|
|
188 |
document.getElementById('confirmName').textContent = document.getElementById('name').value;
|
189 |
document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
|
190 |
document.getElementById('confirmPhone').textContent = document.getElementById('mobile').value;
|
191 |
-
document.getElementById('
|
192 |
speak("Please confirm your details and submit.");
|
193 |
}
|
194 |
|
195 |
-
function
|
196 |
-
let name = document.getElementById('name').value;
|
197 |
-
let email = document.getElementById('email').value;
|
198 |
-
let phone = document.getElementById('mobile').value;
|
199 |
-
|
200 |
fetch('/register', {
|
201 |
method: 'POST',
|
202 |
headers: { 'Content-Type': 'application/json' },
|
203 |
-
body: JSON.stringify({
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
} else {
|
210 |
-
speak("Error submitting details. Please try again.");
|
211 |
-
}
|
212 |
-
});
|
213 |
}
|
214 |
|
215 |
-
window.onload =
|
216 |
-
askLoginOrRegister();
|
217 |
-
};
|
218 |
</script>
|
219 |
</body>
|
220 |
</html>
|
|
|
75 |
color: gray;
|
76 |
margin-top: 10px;
|
77 |
}
|
78 |
+
.confirmation {
|
79 |
display: none;
|
80 |
+
margin-top: 20px;
|
81 |
padding: 20px;
|
82 |
+
background: #fff;
|
83 |
border-radius: 10px;
|
84 |
+
text-align: center;
|
85 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
86 |
}
|
87 |
.confirm-button {
|
88 |
+
margin-top: 15px;
|
89 |
padding: 10px 20px;
|
90 |
background-color: #ff6a00;
|
91 |
color: white;
|
92 |
border: none;
|
93 |
border-radius: 5px;
|
94 |
cursor: pointer;
|
95 |
+
}
|
96 |
+
.confirm-button:hover {
|
97 |
+
background-color: #e65e00;
|
98 |
}
|
99 |
</style>
|
100 |
</head>
|
|
|
130 |
</div>
|
131 |
</div>
|
132 |
|
133 |
+
<!-- Confirmation Section -->
|
134 |
+
<div class="confirmation" id="confirmationBox">
|
135 |
<h2>Confirm Your Details:</h2>
|
136 |
<p><strong>Name:</strong> <span id="confirmName"></span></p>
|
137 |
<p><strong>Email:</strong> <span id="confirmEmail"></span></p>
|
138 |
<p><strong>Phone:</strong> <span id="confirmPhone"></span></p>
|
139 |
+
<button class="confirm-button" onclick="submitToSalesforce()">Confirm & Submit</button>
|
140 |
</div>
|
141 |
|
142 |
<script>
|
|
|
146 |
recognition.continuous = false;
|
147 |
recognition.interimResults = false;
|
148 |
recognition.lang = 'en-US';
|
|
|
|
|
149 |
}
|
150 |
|
151 |
function speak(text, callback) {
|
|
|
182 |
recognition.onresult = function(event) {
|
183 |
document.getElementById('name').value = event.results[0][0].transcript.trim();
|
184 |
recognition.stop();
|
185 |
+
speak("Now, say your email.", startListeningForEmail);
|
186 |
+
};
|
187 |
+
}
|
188 |
+
|
189 |
+
function startListeningForEmail() {
|
190 |
+
recognition.start();
|
191 |
+
recognition.onresult = function(event) {
|
192 |
+
document.getElementById('email').value = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
193 |
+
recognition.stop();
|
194 |
+
speak("Now, say your mobile number.", startListeningForMobile);
|
195 |
+
};
|
196 |
+
}
|
197 |
+
|
198 |
+
function startListeningForMobile() {
|
199 |
+
recognition.start();
|
200 |
+
recognition.onresult = function(event) {
|
201 |
+
document.getElementById('mobile').value = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
202 |
+
recognition.stop();
|
203 |
+
confirmDetails();
|
204 |
};
|
205 |
}
|
206 |
|
|
|
208 |
document.getElementById('confirmName').textContent = document.getElementById('name').value;
|
209 |
document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
|
210 |
document.getElementById('confirmPhone').textContent = document.getElementById('mobile').value;
|
211 |
+
document.getElementById('confirmationBox').style.display = 'block';
|
212 |
speak("Please confirm your details and submit.");
|
213 |
}
|
214 |
|
215 |
+
function submitToSalesforce() {
|
|
|
|
|
|
|
|
|
216 |
fetch('/register', {
|
217 |
method: 'POST',
|
218 |
headers: { 'Content-Type': 'application/json' },
|
219 |
+
body: JSON.stringify({
|
220 |
+
name: document.getElementById('name').value,
|
221 |
+
email: document.getElementById('email').value,
|
222 |
+
phone: document.getElementById('mobile').value
|
223 |
+
})
|
224 |
+
}).then(() => location.reload());
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
+
window.onload = askLoginOrRegister;
|
|
|
|
|
228 |
</script>
|
229 |
</body>
|
230 |
</html>
|