Spaces:
Sleeping
Sleeping
Create menu.html
Browse files- templates/menu.html +33 -0
templates/menu.html
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Menu</title>
|
5 |
+
</head>
|
6 |
+
<body>
|
7 |
+
<h1>Biryani Hub - Menu</h1>
|
8 |
+
<a href="/cart">View Cart</a>
|
9 |
+
<div>
|
10 |
+
{% for item in menu_items %}
|
11 |
+
<div>
|
12 |
+
<img src="{{ item.Image1__c }}" alt="Food Image" style="width: 100px; height: 100px;">
|
13 |
+
<h3>{{ item.Name }}</h3>
|
14 |
+
<p>{{ item.Description__c }}</p>
|
15 |
+
<p>${{ item.Price__c }}</p>
|
16 |
+
<button onclick="addToCart('{{ item.Name }}', {{ item.Price__c }})">Add</button>
|
17 |
+
</div>
|
18 |
+
{% endfor %}
|
19 |
+
</div>
|
20 |
+
<script>
|
21 |
+
function addToCart(name, price) {
|
22 |
+
fetch("/add_to_cart", {
|
23 |
+
method: "POST",
|
24 |
+
headers: { "Content-Type": "application/json" },
|
25 |
+
body: JSON.stringify({ name: name, price: price })
|
26 |
+
})
|
27 |
+
.then(response => response.json())
|
28 |
+
.then(data => alert(data.message))
|
29 |
+
.catch(error => console.error("Error:", error));
|
30 |
+
}
|
31 |
+
</script>
|
32 |
+
</body>
|
33 |
+
</html>
|