Spaces:
Sleeping
Sleeping
Update templates/menu_page.html
Browse files- templates/menu_page.html +5 -32
templates/menu_page.html
CHANGED
@@ -270,38 +270,11 @@
|
|
270 |
document.getElementById('cart-total').innerText = "Total: ₹" + total;
|
271 |
}
|
272 |
|
273 |
-
// Voice greeting for menu categories
|
274 |
-
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
275 |
-
recognition.lang = "en-US";
|
276 |
-
recognition.interimResults = false;
|
277 |
-
function speak(text) {
|
278 |
-
const msg = new SpeechSynthesisUtterance(text);
|
279 |
-
window.speechSynthesis.speak(msg);
|
280 |
-
}
|
281 |
-
|
282 |
-
window.onload = function() {
|
283 |
-
speak("Welcome to Biryani Hub! We have the following categories: Main Course and Appetizers. Please say 'Main Course' or 'Appetizers' to select a category.");
|
284 |
-
recognition.start();
|
285 |
-
recognition.onresult = (event) => {
|
286 |
-
const categoryCommand = event.results[0][0].transcript.toLowerCase();
|
287 |
-
if (categoryCommand.includes("main course")) {
|
288 |
-
displayMenuItems('Main Course');
|
289 |
-
mainCoursePage.style.display = "block";
|
290 |
-
categoryPage.style.display = "none";
|
291 |
-
} else if (categoryCommand.includes("appetizers")) {
|
292 |
-
displayMenuItems('Appetizers');
|
293 |
-
appetizerPage.style.display = "block";
|
294 |
-
categoryPage.style.display = "none";
|
295 |
-
} else {
|
296 |
-
speak("Sorry, I couldn't understand that. Please say 'Main Course' or 'Appetizers'.");
|
297 |
-
}
|
298 |
-
};
|
299 |
-
};
|
300 |
-
|
301 |
// Handle Order Form Submission and Salesforce integration
|
302 |
document.getElementById("order-form").addEventListener("submit", function(e) {
|
303 |
e.preventDefault();
|
304 |
-
|
|
|
305 |
const customerName = document.getElementById("customer-name").value;
|
306 |
const customerEmail = document.getElementById("customer-email").value;
|
307 |
const customerPhone = document.getElementById("customer-phone").value;
|
@@ -325,11 +298,11 @@
|
|
325 |
|
326 |
// Example Salesforce integration
|
327 |
// Replace the URL below with your actual Salesforce endpoint and configure authentication as needed.
|
328 |
-
fetch('https://
|
329 |
method: 'POST',
|
330 |
headers: {
|
331 |
-
'Content-Type': 'application/json'
|
332 |
-
//
|
333 |
},
|
334 |
body: JSON.stringify(orderDetails)
|
335 |
})
|
|
|
270 |
document.getElementById('cart-total').innerText = "Total: ₹" + total;
|
271 |
}
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
// Handle Order Form Submission and Salesforce integration
|
274 |
document.getElementById("order-form").addEventListener("submit", function(e) {
|
275 |
e.preventDefault();
|
276 |
+
|
277 |
+
// Collecting the form data
|
278 |
const customerName = document.getElementById("customer-name").value;
|
279 |
const customerEmail = document.getElementById("customer-email").value;
|
280 |
const customerPhone = document.getElementById("customer-phone").value;
|
|
|
298 |
|
299 |
// Example Salesforce integration
|
300 |
// Replace the URL below with your actual Salesforce endpoint and configure authentication as needed.
|
301 |
+
fetch('https://your-salesforce-endpoint.com/api/orders', {
|
302 |
method: 'POST',
|
303 |
headers: {
|
304 |
+
'Content-Type': 'application/json',
|
305 |
+
'Authorization': 'Bearer YOUR_OAUTH_TOKEN' // Replace with actual OAuth token
|
306 |
},
|
307 |
body: JSON.stringify(orderDetails)
|
308 |
})
|