Spaces:
Sleeping
Sleeping
Update templates/Menu.html
Browse files- templates/Menu.html +8 -0
templates/Menu.html
CHANGED
|
@@ -214,6 +214,7 @@
|
|
| 214 |
|
| 215 |
<script>
|
| 216 |
let filteredMenu = [];
|
|
|
|
| 217 |
|
| 218 |
// Fetch menu items from Flask backend
|
| 219 |
async function fetchMenu() {
|
|
@@ -284,6 +285,13 @@
|
|
| 284 |
fetchMenu(); // Fetch menu data from the backend
|
| 285 |
});
|
| 286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
</script>
|
| 288 |
</body>
|
| 289 |
</html>
|
|
|
|
| 214 |
|
| 215 |
<script>
|
| 216 |
let filteredMenu = [];
|
| 217 |
+
let cart = []; // Array to store added items
|
| 218 |
|
| 219 |
// Fetch menu items from Flask backend
|
| 220 |
async function fetchMenu() {
|
|
|
|
| 285 |
fetchMenu(); // Fetch menu data from the backend
|
| 286 |
});
|
| 287 |
|
| 288 |
+
// Function to handle adding an item to the cart
|
| 289 |
+
function addToCart(item) {
|
| 290 |
+
cart.push(item); // Add item to cart array
|
| 291 |
+
console.log("Cart:", cart); // Log updated cart
|
| 292 |
+
alert(`${item.Name} added to cart!`); // Alert user
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
</script>
|
| 296 |
</body>
|
| 297 |
</html>
|