Spaces:
Sleeping
Sleeping
Update templates/menu_page.html
Browse files- templates/menu_page.html +20 -19
templates/menu_page.html
CHANGED
|
@@ -97,31 +97,32 @@
|
|
| 97 |
|
| 98 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/annyang/2.6.1/annyang.min.js"></script>
|
| 99 |
<script>
|
| 100 |
-
|
| 101 |
-
{ name: "Samosa", price: 9.0, ingredients: "Potatoes, Peas, Flour, Spices", category: "Appetizer" },
|
| 102 |
-
{ name: "Chilli Gobi", price: 12.0, ingredients: "Cauliflower, Chili Sauce, Spices", category: "Appetizer" },
|
| 103 |
-
{ name: "Veg Biryani", price: 12.0, ingredients: "Mixed Vegetables, Basmati Rice, Spices", category: "Main Course" }
|
| 104 |
-
];
|
| 105 |
-
|
| 106 |
let selectedItem = "";
|
| 107 |
let quantity = 0;
|
| 108 |
let step = 0;
|
| 109 |
|
| 110 |
const menuItemsContainer = document.getElementById('menu-items');
|
| 111 |
|
| 112 |
-
//
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
// Ensure annyang is initialized
|
| 127 |
if (annyang) {
|
|
|
|
| 97 |
|
| 98 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/annyang/2.6.1/annyang.min.js"></script>
|
| 99 |
<script>
|
| 100 |
+
let menuItems = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
let selectedItem = "";
|
| 102 |
let quantity = 0;
|
| 103 |
let step = 0;
|
| 104 |
|
| 105 |
const menuItemsContainer = document.getElementById('menu-items');
|
| 106 |
|
| 107 |
+
// Fetch menu items from the backend (Flask)
|
| 108 |
+
fetch('/menu') // Endpoint that returns the menu data as JSON
|
| 109 |
+
.then(response => response.json())
|
| 110 |
+
.then(data => {
|
| 111 |
+
menuItems = data;
|
| 112 |
+
menuItems.forEach(item => {
|
| 113 |
+
const menuItemDiv = document.createElement('div');
|
| 114 |
+
menuItemDiv.classList.add('menu-item');
|
| 115 |
+
menuItemDiv.innerHTML = `
|
| 116 |
+
<h3>${item.name}</h3>
|
| 117 |
+
<p>Price: $${item.price}</p>
|
| 118 |
+
<p>Ingredients: ${item.ingredients}</p>
|
| 119 |
+
<p>Category: ${item.category}</p>
|
| 120 |
+
<button class="order-btn" data-item="${item.name}">Order</button>
|
| 121 |
+
`;
|
| 122 |
+
menuItemsContainer.appendChild(menuItemDiv);
|
| 123 |
+
});
|
| 124 |
+
})
|
| 125 |
+
.catch(error => console.error('Error fetching menu items:', error));
|
| 126 |
|
| 127 |
// Ensure annyang is initialized
|
| 128 |
if (annyang) {
|