geethareddy commited on
Commit
63131d7
·
verified ·
1 Parent(s): 93a65e5

templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +0 -66
templates/index.html DELETED
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Dynamic Menu</title>
7
- <link rel="stylesheet" href="/static/styles.css">
8
- <script>
9
- // Function to handle pop-up
10
- function openPopup(dishName) {
11
- fetch("/menu_item", {
12
- method: "POST",
13
- headers: { "Content-Type": "application/json" },
14
- body: JSON.stringify({ dish_name: dishName }),
15
- })
16
- .then(response => response.json())
17
- .then(data => {
18
- if (data.error) {
19
- alert(data.error);
20
- } else {
21
- const popup = document.getElementById("popup");
22
- popup.innerHTML = `
23
- <h2>${data["Dish Name"]}</h2>
24
- <img src="${data["Image URL"]}" alt="${data["Dish Name"]}">
25
- <p><strong>Description:</strong> ${data["Description"]}</p>
26
- <p><strong>Ingredients:</strong> ${data["Ingredients"]}</p>
27
- <p><strong>Allergen Info:</strong> ${data["Allergen Info"]}</p>
28
- <p><strong>Recommended Items:</strong> ${data["Recommended Items"]}</p>
29
- <p><strong>Spice Levels:</strong> ${data["Spice Levels"]}</p>
30
- <button onclick="closePopup()">Close</button>
31
- `;
32
- popup.style.display = "block";
33
- }
34
- });
35
- }
36
-
37
- // Function to close the pop-up
38
- function closePopup() {
39
- document.getElementById("popup").style.display = "none";
40
- }
41
- </script>
42
- </head>
43
- <body>
44
- <h1>Dynamic Menu</h1>
45
- <div id="menu-container">
46
- {% for category, items in menu.items() %}
47
- <div class="menu-category">
48
- <h2>{{ category }}</h2>
49
- <div class="menu-items">
50
- {% for item in items %}
51
- <div class="menu-item">
52
- <img src="{{ item['Image URL'] }}" alt="{{ item['Dish Name'] }}">
53
- <h3>{{ item['Dish Name'] }}</h3>
54
- <p>${{ item['Price'] }}</p>
55
- <button onclick="openPopup('{{ item['Dish Name'] }}')">Add</button>
56
- </div>
57
- {% endfor %}
58
- </div>
59
- </div>
60
- {% endfor %}
61
- </div>
62
-
63
- <!-- Pop-Up Modal -->
64
- <div id="popup" class="popup"></div>
65
- </body>
66
- </html>