Spaces:
Running
Running
Update templates/menu_page.html
Browse files- templates/menu_page.html +32 -77
templates/menu_page.html
CHANGED
@@ -1,74 +1,44 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
-
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
<title>Menu - Biryani Hub</title>
|
8 |
<style>
|
9 |
-
body {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
.menu-container {
|
17 |
-
max-width: 1200px;
|
18 |
-
margin: 0 auto;
|
19 |
-
padding: 20px;
|
20 |
-
background-color: #fff;
|
21 |
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
22 |
-
border-radius: 8px;
|
23 |
-
margin-top: 50px;
|
24 |
-
}
|
25 |
-
|
26 |
-
h1 {
|
27 |
-
text-align: center;
|
28 |
-
font-size: 2.5rem;
|
29 |
-
color: #333;
|
30 |
-
margin-bottom: 30px;
|
31 |
-
}
|
32 |
-
|
33 |
-
.menu-item {
|
34 |
-
border-bottom: 1px solid #eee;
|
35 |
-
padding: 15px 0;
|
36 |
-
display: flex;
|
37 |
-
justify-content: space-between;
|
38 |
-
align-items: center;
|
39 |
-
}
|
40 |
-
|
41 |
-
.order-btn {
|
42 |
-
display: none; /* Hide the button since ordering is voice-controlled */
|
43 |
-
}
|
44 |
</style>
|
45 |
</head>
|
46 |
-
|
47 |
<body>
|
48 |
<div class="menu-container">
|
49 |
<h1>Welcome to the Menu</h1>
|
50 |
-
|
51 |
-
{% for item in menu_items %}
|
52 |
-
<div class="menu-item" data-item="{{ item.name | lower }}">
|
53 |
-
<div class="details">
|
54 |
-
<h3>{{ item.name }}</h3>
|
55 |
-
<p><strong>Ingredients:</strong> {{ item.ingredients }}</p>
|
56 |
-
<p><strong>Category:</strong> {{ item.category }}</p>
|
57 |
-
<p class="price">Price: ${{ item.price }}</p>
|
58 |
-
</div>
|
59 |
-
<button class="order-btn">Order</button>
|
60 |
-
</div>
|
61 |
-
{% endfor %}
|
62 |
</div>
|
63 |
|
64 |
<script>
|
65 |
-
const menuItems =
|
66 |
-
name:
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
71 |
-
recognition.lang =
|
72 |
recognition.interimResults = false;
|
73 |
|
74 |
function speak(text, callback) {
|
@@ -78,42 +48,27 @@
|
|
78 |
}
|
79 |
|
80 |
function readMenuItems() {
|
81 |
-
let menuText =
|
82 |
-
menuItems.forEach(item => {
|
83 |
-
|
84 |
-
});
|
85 |
-
menuText += "Please say the name of the item you would like to order.";
|
86 |
speak(menuText, startListening);
|
87 |
}
|
88 |
|
89 |
-
function startListening() {
|
90 |
-
recognition.start();
|
91 |
-
}
|
92 |
|
93 |
recognition.onresult = (event) => {
|
94 |
const command = event.results[0][0].transcript.toLowerCase();
|
95 |
-
|
96 |
-
|
97 |
-
const matchedItem = menuItems.find(item => command.includes(item.name));
|
98 |
if (matchedItem) {
|
99 |
speak(`You have ordered ${matchedItem.name}. Your order has been placed.`);
|
100 |
-
console.log(`Order placed for: ${matchedItem.name}`);
|
101 |
} else {
|
102 |
-
speak(
|
103 |
-
startListening();
|
104 |
}
|
105 |
};
|
106 |
|
107 |
-
recognition.onerror = (
|
108 |
-
console.error("Speech recognition error:", event.error);
|
109 |
-
speak("Sorry, I couldn't understand that. Please try again.");
|
110 |
-
};
|
111 |
|
112 |
-
|
113 |
-
window.onload = function () {
|
114 |
-
readMenuItems();
|
115 |
-
};
|
116 |
</script>
|
117 |
</body>
|
118 |
-
|
119 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Menu - Biryani Hub</title>
|
7 |
<style>
|
8 |
+
body { font-family: Arial, sans-serif; background-color: #f8f8f8; margin: 0; padding: 0; }
|
9 |
+
.menu-container { max-width: 1200px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 8px; margin-top: 20px; }
|
10 |
+
h1 { text-align: center; font-size: 2.5rem; color: #333; }
|
11 |
+
.menu-item { margin-bottom: 20px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; }
|
12 |
+
.menu-item img { width: 100px; height: 100px; border-radius: 8px; margin-right: 10px; }
|
13 |
+
.details { display: flex; align-items: center; }
|
14 |
+
.text { margin-left: 10px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
</style>
|
16 |
</head>
|
|
|
17 |
<body>
|
18 |
<div class="menu-container">
|
19 |
<h1>Welcome to the Menu</h1>
|
20 |
+
<div id="menu-items"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
</div>
|
22 |
|
23 |
<script>
|
24 |
+
const menuItems = [
|
25 |
+
{ name: 'Samosa', price: 9, ingredients: 'Potatoes, Peas, Flour, Spices', description: 'Crispy fried pastry filled with spiced potatoes and peas.' },
|
26 |
+
{ name: 'Onion Pakoda', price: 10, ingredients: 'Onions, Gram Flour, Spices', description: 'Deep-fried onion fritters seasoned with herbs and spices.' },
|
27 |
+
{ name: 'Chilli Gobi', price: 12, ingredients: 'Cauliflower, Chili Sauce, Spices', description: 'Cauliflower florets tossed in a spicy chili sauce.' },
|
28 |
+
{ name: 'Chicken Biryani', price: 14, ingredients: 'Chicken, Basmati Rice, Spices', description: 'Aromatic basmati rice cooked with tender chicken and spices.' },
|
29 |
+
{ name: 'Mutton Biryani', price: 16, ingredients: 'Mutton, Basmati Rice, Spices', description: 'Flavorful rice dish made with succulent mutton and aromatic spices.' }
|
30 |
+
];
|
31 |
+
|
32 |
+
const menuContainer = document.getElementById('menu-items');
|
33 |
+
menuItems.forEach(item => {
|
34 |
+
const div = document.createElement('div');
|
35 |
+
div.classList.add('menu-item');
|
36 |
+
div.innerHTML = `<div class="details"><img src="https://via.placeholder.com/100" alt="${item.name}"><div class="text"><h3>${item.name}</h3><p>${item.description}</p><p><strong>Ingredients:</strong> ${item.ingredients}</p><p><strong>Price:</strong> $${item.price}</p></div></div>`;
|
37 |
+
menuContainer.appendChild(div);
|
38 |
+
});
|
39 |
|
40 |
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
41 |
+
recognition.lang = 'en-US';
|
42 |
recognition.interimResults = false;
|
43 |
|
44 |
function speak(text, callback) {
|
|
|
48 |
}
|
49 |
|
50 |
function readMenuItems() {
|
51 |
+
let menuText = 'Here is the menu. ';
|
52 |
+
menuItems.forEach(item => { menuText += `${item.name}, `; });
|
53 |
+
menuText += 'Please say the name of the item you would like to order.';
|
|
|
|
|
54 |
speak(menuText, startListening);
|
55 |
}
|
56 |
|
57 |
+
function startListening() { recognition.start(); }
|
|
|
|
|
58 |
|
59 |
recognition.onresult = (event) => {
|
60 |
const command = event.results[0][0].transcript.toLowerCase();
|
61 |
+
const matchedItem = menuItems.find(item => command.includes(item.name.toLowerCase()));
|
|
|
|
|
62 |
if (matchedItem) {
|
63 |
speak(`You have ordered ${matchedItem.name}. Your order has been placed.`);
|
|
|
64 |
} else {
|
65 |
+
speak('Item not found. Please try again.', startListening);
|
|
|
66 |
}
|
67 |
};
|
68 |
|
69 |
+
recognition.onerror = () => { speak('Sorry, I could not understand. Please try again.'); };
|
|
|
|
|
|
|
70 |
|
71 |
+
window.onload = readMenuItems;
|
|
|
|
|
|
|
72 |
</script>
|
73 |
</body>
|
|
|
74 |
</html>
|