Rammohan0504 commited on
Commit
68a6399
·
verified ·
1 Parent(s): a3508bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -51,17 +51,26 @@ def filter_dishes(category):
51
  return [dish for dish in menu_data if dish["category"] == category]
52
 
53
  # Function to display dishes
54
- def display_dishes(category="ALL"):
55
  filtered_dishes = filter_dishes(category)
56
- html_content = "<div style='display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;'>"
57
  for dish in filtered_dishes:
58
  html_content += f"""
59
- <div style='border: 1px solid #ddd; padding: 10px; border-radius: 5px; width: 200px; text-align: center;'>
60
- <img src='{dish['image']}' alt='{dish['name']}' style='width: 100%; height: 150px; object-fit: cover; border-radius: 5px; margin-bottom: 10px;'>
61
- <h4>{dish['name']}</h4>
62
- <p>{dish['description']}</p>
63
- <p><strong>Price:</strong> ${dish['price']}</p>
64
- <button onclick="showMenuPopup('{dish['name']}', '{dish['description']}', {dish['price']}, '{dish['image']}')" style='padding: 5px 10px; background-color: #28a745; color: white; border: none; border-radius: 3px;'>Add</button>
 
 
 
 
 
 
 
 
 
65
  </div>
66
  """
67
  html_content += "</div>"
 
51
  return [dish for dish in menu_data if dish["category"] == category]
52
 
53
  # Function to display dishes
54
+ def display_dishes(category):
55
  filtered_dishes = filter_dishes(category)
56
+ html_content = "<div style='display: flex; flex-direction: column; align-items: center; width: 100%; height:100%'>"
57
  for dish in filtered_dishes:
58
  html_content += f"""
59
+ <div style='margin: 10px; display: flex; align-items: center; justify-content: space-between;
60
+ width: 80%; padding: 10px; border: 1px solid #ddd; border-radius: 10px;
61
+ background-color: #f9f9f9;'>
62
+ <div style='flex: 1; margin-right: 20px; text-align: left;'>
63
+ <h4 style='font-size: 18px; color: #444; margin: 0;'>{dish['name']}</h4>
64
+ <p style='font-size: 14px; color: #666; margin: 5px 0;'>{dish['description']}</p>
65
+ <p style='font-size: 16px; color: #444; margin: 0;'>Price: {dish['price']}</p>
66
+ </div>
67
+ <div style='text-align: center;'>
68
+ <img src='{dish['image']}' alt='{dish['name']}'
69
+ style='width: 150px; height: 100px; object-fit: cover; border-radius: 10px;'>
70
+ <button onclick="showPopup('{dish['image']}', '{dish['name']}', '{dish['description']}', '{dish['price']}')"
71
+ style="margin-top: 15px; padding: 10px 20px; background-color: #28a745; color: white; border: none;
72
+ border-radius: 5px; cursor: pointer;">Add</button>
73
+ </div>
74
  </div>
75
  """
76
  html_content += "</div>"