nagasurendra commited on
Commit
61eefea
·
verified ·
1 Parent(s): 9953ba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -57,11 +57,17 @@ modal_and_cart_js = """
57
  alert("You cannot add more items after finalizing your order.");
58
  return;
59
  }
60
- document.getElementById('modal').style.display = 'block';
 
 
 
 
 
61
  document.getElementById('modal-image').src = image;
62
  document.getElementById('modal-name').innerText = name;
63
  document.getElementById('modal-description').innerText = description;
64
  document.getElementById('modal-price').innerText = price;
 
65
  // Reset extras
66
  const extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');
67
  extrasInputs.forEach(input => input.checked = false);
@@ -147,7 +153,7 @@ def app():
147
 
148
  # Modal window
149
  modal_window = gr.HTML("""
150
- <div id="modal" style="display: none; position: fixed; top: 10%; left: 5%; width: 90%; max-width: 400px; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
151
  <div style="text-align: right;">
152
  <button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">&times;</button>
153
  </div>
@@ -163,7 +169,7 @@ def app():
163
  <label><input type="checkbox" name="biryani-extra" value="Extra Raitha" /> Extra Raitha + $1.00</label>
164
  <label><input type="checkbox" name="biryani-extra" value="Extra Salan" /> Extra Salan + $2.00</label>
165
  <label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
166
- <label><input type="checkbox" name="biryani-extra" value="Chill Chicken" /> Chilli Chicken + $14.00</label>
167
  <label><input type="checkbox" name="biryani-extra" value="Veg Manchurian" /> Veg Manchurian + $12.00</label>
168
  </div>
169
  <!-- Quantity and Special Instructions -->
 
57
  alert("You cannot add more items after finalizing your order.");
58
  return;
59
  }
60
+ const modal = document.getElementById('modal');
61
+ modal.style.display = 'block';
62
+ modal.style.position = 'absolute';
63
+ modal.style.top = `${window.scrollY + window.innerHeight / 2 - modal.offsetHeight / 2}px`;
64
+ modal.style.left = `${window.innerWidth / 2 - modal.offsetWidth / 2}px`;
65
+
66
  document.getElementById('modal-image').src = image;
67
  document.getElementById('modal-name').innerText = name;
68
  document.getElementById('modal-description').innerText = description;
69
  document.getElementById('modal-price').innerText = price;
70
+
71
  // Reset extras
72
  const extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');
73
  extrasInputs.forEach(input => input.checked = false);
 
153
 
154
  # Modal window
155
  modal_window = gr.HTML("""
156
+ <div id="modal" style="display: none; position: absolute; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
157
  <div style="text-align: right;">
158
  <button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">&times;</button>
159
  </div>
 
169
  <label><input type="checkbox" name="biryani-extra" value="Extra Raitha" /> Extra Raitha + $1.00</label>
170
  <label><input type="checkbox" name="biryani-extra" value="Extra Salan" /> Extra Salan + $2.00</label>
171
  <label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
172
+ <label><input type="checkbox" name="biryani-extra" value="Chilli Chicken" /> Chilli Chicken + $14.00</label>
173
  <label><input type="checkbox" name="biryani-extra" value="Veg Manchurian" /> Veg Manchurian + $12.00</label>
174
  </div>
175
  <!-- Quantity and Special Instructions -->