Spaces:
Sleeping
Sleeping
Update templates/menu_page.html
Browse files- templates/menu_page.html +7 -9
templates/menu_page.html
CHANGED
@@ -95,7 +95,6 @@
|
|
95 |
<div class="filter-buttons">
|
96 |
<button onclick="filterMenu('Veg')">Vegetarian</button>
|
97 |
<button onclick="filterMenu('Non-Veg')">Non-Vegetarian</button>
|
98 |
-
<button onclick="resetMenu()">Show All</button>
|
99 |
</div>
|
100 |
|
101 |
<!-- Menu Display -->
|
@@ -148,10 +147,8 @@
|
|
148 |
const command = event.results[0][0].transcript.toLowerCase();
|
149 |
if (command.includes("vegetarian") || command.includes("veg")) {
|
150 |
filterMenu("Veg");
|
151 |
-
speak("Here are the vegetarian items.");
|
152 |
} else if (command.includes("non-vegetarian") || command.includes("non veg")) {
|
153 |
filterMenu("Non-Veg");
|
154 |
-
speak("Here are the non-vegetarian items.");
|
155 |
} else {
|
156 |
speak("Sorry, I didn't understand. Please say Vegetarian or Non-Vegetarian.", function() {
|
157 |
startListening();
|
@@ -160,24 +157,25 @@
|
|
160 |
};
|
161 |
}
|
162 |
|
163 |
-
// ✅ Function to filter menu by category
|
164 |
function filterMenu(type) {
|
165 |
const allItems = document.querySelectorAll('.menu-item');
|
|
|
|
|
166 |
allItems.forEach(item => {
|
167 |
const category = item.dataset.category.toLowerCase();
|
168 |
if (type === "Veg" && (category.includes("veg") || category.includes("paneer") || category.includes("channa"))) {
|
169 |
item.style.display = "block";
|
|
|
170 |
} else if (type === "Non-Veg" && (category.includes("chicken") || category.includes("mutton") || category.includes("fish") || category.includes("prawn"))) {
|
171 |
item.style.display = "block";
|
|
|
172 |
} else {
|
173 |
item.style.display = "none";
|
174 |
}
|
175 |
});
|
176 |
-
}
|
177 |
|
178 |
-
|
179 |
-
function resetMenu() {
|
180 |
-
document.querySelectorAll('.menu-item').forEach(item => item.style.display = "block");
|
181 |
}
|
182 |
|
183 |
// ✅ Function to add items to cart
|
@@ -207,7 +205,7 @@
|
|
207 |
cartContainer.style.display = "block";
|
208 |
}
|
209 |
|
210 |
-
// ✅ Function to checkout
|
211 |
function checkout() {
|
212 |
if (cart.length > 0) {
|
213 |
speak("Your order has been placed successfully!");
|
|
|
95 |
<div class="filter-buttons">
|
96 |
<button onclick="filterMenu('Veg')">Vegetarian</button>
|
97 |
<button onclick="filterMenu('Non-Veg')">Non-Vegetarian</button>
|
|
|
98 |
</div>
|
99 |
|
100 |
<!-- Menu Display -->
|
|
|
147 |
const command = event.results[0][0].transcript.toLowerCase();
|
148 |
if (command.includes("vegetarian") || command.includes("veg")) {
|
149 |
filterMenu("Veg");
|
|
|
150 |
} else if (command.includes("non-vegetarian") || command.includes("non veg")) {
|
151 |
filterMenu("Non-Veg");
|
|
|
152 |
} else {
|
153 |
speak("Sorry, I didn't understand. Please say Vegetarian or Non-Vegetarian.", function() {
|
154 |
startListening();
|
|
|
157 |
};
|
158 |
}
|
159 |
|
160 |
+
// ✅ Function to filter menu by category and speak items
|
161 |
function filterMenu(type) {
|
162 |
const allItems = document.querySelectorAll('.menu-item');
|
163 |
+
let availableItems = [];
|
164 |
+
|
165 |
allItems.forEach(item => {
|
166 |
const category = item.dataset.category.toLowerCase();
|
167 |
if (type === "Veg" && (category.includes("veg") || category.includes("paneer") || category.includes("channa"))) {
|
168 |
item.style.display = "block";
|
169 |
+
availableItems.push(item.querySelector('h3').innerText);
|
170 |
} else if (type === "Non-Veg" && (category.includes("chicken") || category.includes("mutton") || category.includes("fish") || category.includes("prawn"))) {
|
171 |
item.style.display = "block";
|
172 |
+
availableItems.push(item.querySelector('h3').innerText);
|
173 |
} else {
|
174 |
item.style.display = "none";
|
175 |
}
|
176 |
});
|
|
|
177 |
|
178 |
+
speak("Here are the available items: " + availableItems.join(", "));
|
|
|
|
|
179 |
}
|
180 |
|
181 |
// ✅ Function to add items to cart
|
|
|
205 |
cartContainer.style.display = "block";
|
206 |
}
|
207 |
|
208 |
+
// ✅ Function to checkout
|
209 |
function checkout() {
|
210 |
if (cart.length > 0) {
|
211 |
speak("Your order has been placed successfully!");
|