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