Rammohan0504 commited on
Commit
27856d6
·
verified ·
1 Parent(s): 52706d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -19
app.py CHANGED
@@ -92,23 +92,13 @@ extras = [
92
  {"name": "Extra Onion & Lemon", "price": "$2.00"}
93
  ]
94
 
95
- # JavaScript for popup modal
96
-
97
  # JavaScript for popup modal
98
  popup_js = """
99
  <script>
100
  function showPopup(name, description, price, image) {
101
  const popup = document.getElementById("custom-popup");
102
  const overlay = document.getElementById("overlay");
103
- const content = document.getElementById("content");
104
-
105
- // Add blur to the background content
106
- content.style.filter = "blur(5px)";
107
- content.style.pointerEvents = "none"; // Disable interaction with the menu while pop-up is open
108
-
109
- // Set up pop-up content
110
  popup.innerHTML = `
111
- <span onclick="closePopup()" style="position: absolute; top: 10px; right: 10px; font-size: 20px; font-weight: bold; cursor: pointer;">&times;</span>
112
  <img src="${image}" alt="${name}" style="width: 200px; height: auto; border-radius: 10px; margin-bottom: 10px;">
113
  <h3 style="margin-top: 10px;">${name}</h3>
114
  <p>${description}</p>
@@ -133,6 +123,7 @@ popup_js = """
133
  </div>
134
 
135
  <button onclick="closePopup()" style="margin-top: 20px; padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer;">Add to Cart</button>
 
136
  `;
137
  popup.style.display = "block";
138
  overlay.style.display = "block";
@@ -141,13 +132,6 @@ popup_js = """
141
  function closePopup() {
142
  const popup = document.getElementById("custom-popup");
143
  const overlay = document.getElementById("overlay");
144
- const content = document.getElementById("content");
145
-
146
- // Remove blur and enable interaction with the menu
147
- content.style.filter = "none";
148
- content.style.pointerEvents = "auto";
149
-
150
- // Hide pop-up and overlay
151
  popup.style.display = "none";
152
  overlay.style.display = "none";
153
  }
@@ -158,13 +142,13 @@ popup_js = """
158
  popup_html = """
159
  <div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 999;"></div>
160
  <div id="custom-popup"
161
- style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50%; max-width: 400px; background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 4px 6px rgba(0,0,0,0.1); display: none; z-index: 1000; text-align: center; position: relative;">
162
  </div>
163
  """
164
 
165
  # Generate dish cards
166
  def display_dishes(category):
167
- html_content = "<div id='content' style='display: flex; flex-direction: column; gap: 20px; width: 80%; margin: 0 auto;'>"
168
  for dish in menu_data:
169
  if category == "ALL" or dish["category"] == category:
170
  html_content += f"""
 
92
  {"name": "Extra Onion & Lemon", "price": "$2.00"}
93
  ]
94
 
 
 
95
  # JavaScript for popup modal
96
  popup_js = """
97
  <script>
98
  function showPopup(name, description, price, image) {
99
  const popup = document.getElementById("custom-popup");
100
  const overlay = document.getElementById("overlay");
 
 
 
 
 
 
 
101
  popup.innerHTML = `
 
102
  <img src="${image}" alt="${name}" style="width: 200px; height: auto; border-radius: 10px; margin-bottom: 10px;">
103
  <h3 style="margin-top: 10px;">${name}</h3>
104
  <p>${description}</p>
 
123
  </div>
124
 
125
  <button onclick="closePopup()" style="margin-top: 20px; padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer;">Add to Cart</button>
126
+ <button onclick="closePopup()" style="margin-top: 20px; margin-left: 10px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;">Close</button>
127
  `;
128
  popup.style.display = "block";
129
  overlay.style.display = "block";
 
132
  function closePopup() {
133
  const popup = document.getElementById("custom-popup");
134
  const overlay = document.getElementById("overlay");
 
 
 
 
 
 
 
135
  popup.style.display = "none";
136
  overlay.style.display = "none";
137
  }
 
142
  popup_html = """
143
  <div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 999;"></div>
144
  <div id="custom-popup"
145
+ style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50%; max-width: 400px; background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 4px 6px rgba(0,0,0,0.1); display: none; z-index: 1000; text-align: center;">
146
  </div>
147
  """
148
 
149
  # Generate dish cards
150
  def display_dishes(category):
151
+ html_content = "<div style='display: flex; flex-direction: column; gap: 20px; width: 80%; margin: 0 auto;'>"
152
  for dish in menu_data:
153
  if category == "ALL" or dish["category"] == category:
154
  html_content += f"""