DSatishchandra commited on
Commit
9b37efb
·
verified ·
1 Parent(s): 53b01b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -14
app.py CHANGED
@@ -74,16 +74,17 @@ def app():
74
 
75
  # Modal window
76
  modal_window = gr.HTML("""
77
- <div id="modal" style="display: none; position: fixed; top: 40%; left: 50%; transform: translate(-50%, -40%); width: 50%; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
78
  <div style="text-align: right;">
79
  <button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">&times;</button>
80
  </div>
81
  <img id="modal-image" style="width: 100%; height: auto; border-radius: 8px; margin-bottom: 20px;" />
82
- <h2 id="modal-name"></h2>
83
- <p id="modal-description"></p>
84
- <p id="modal-price"></p>
 
85
  <!-- Spice Levels -->
86
- <label for="spice-level">Choose a Spice Level (Required):</label>
87
  <div id="spice-level-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
88
  <label><input type="radio" name="spice-level" value="American Mild" required /> American Mild</label>
89
  <label><input type="radio" name="spice-level" value="American Medium" required /> American Medium</label>
@@ -92,8 +93,9 @@ def app():
92
  <label><input type="radio" name="spice-level" value="Indian Medium" required /> Indian Medium</label>
93
  <label><input type="radio" name="spice-level" value="Indian Very Spicy" required /> Indian Very Spicy</label>
94
  </div>
 
95
  <!-- Biryani Extras -->
96
- <label for="biryani-extras">Biryani Extras (Optional - Choose as many as you like):</label>
97
  <div id="biryani-extras-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
98
  <label><input type="checkbox" name="biryani-extra" value="Extra Raitha 4oz" /> Extra Raitha 4oz + $1.00</label>
99
  <label><input type="checkbox" name="biryani-extra" value="Extra Raitha 8oz" /> Extra Raitha 8oz + $2.00</label>
@@ -103,27 +105,33 @@ def app():
103
  <label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
104
  <label><input type="checkbox" name="biryani-extra" value="Extra Fried Onion" /> Extra Fried Onion 4oz + $2.00</label>
105
  </div>
 
106
  <!-- Quantity and Special Instructions -->
107
- <label for="quantity">Quantity:</label>
108
- <input type="number" id="quantity" value="1" min="1" style="width: 50px;" />
109
- <br><br>
110
- <textarea id="special-instructions" placeholder="Add special instructions here..." style="width: 100%; height: 60px;"></textarea>
111
- <br><br>
112
  <!-- Add to Cart Button -->
113
  <button style="background-color: #28a745; color: white; border: none; padding: 10px 20px; font-size: 14px; border-radius: 5px; cursor: pointer;" onclick="addToCart()">Add to Cart</button>
114
  </div>
 
115
  <script>
116
  let cart = [];
117
  function openModal(name, image, description, price) {
118
- document.getElementById('modal').style.display = 'block';
 
119
  document.getElementById('modal-image').src = image;
120
  document.getElementById('modal-name').innerText = name;
121
  document.getElementById('modal-description').innerText = description;
122
  document.getElementById('modal-price').innerText = price;
123
  }
 
124
  function closeModal() {
125
- document.getElementById('modal').style.display = 'none';
 
126
  }
 
127
  function addToCart() {
128
  const name = document.getElementById('modal-name').innerText;
129
  const price = document.getElementById('modal-price').innerText;
@@ -157,4 +165,4 @@ def app():
157
 
158
  if __name__ == "__main__":
159
  demo = app()
160
- demo.launch()
 
74
 
75
  # Modal window
76
  modal_window = gr.HTML("""
77
+ <div id="modal" style="display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 600px; max-height: 90%; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000; overflow-y: auto;">
78
  <div style="text-align: right;">
79
  <button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">&times;</button>
80
  </div>
81
  <img id="modal-image" style="width: 100%; height: auto; border-radius: 8px; margin-bottom: 20px;" />
82
+ <h2 id="modal-name" style="margin-bottom: 10px;"></h2>
83
+ <p id="modal-description" style="margin-bottom: 10px;"></p>
84
+ <p id="modal-price" style="margin-bottom: 20px;"></p>
85
+
86
  <!-- Spice Levels -->
87
+ <label for="spice-level" style="font-weight: bold;">Choose a Spice Level (Required):</label>
88
  <div id="spice-level-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
89
  <label><input type="radio" name="spice-level" value="American Mild" required /> American Mild</label>
90
  <label><input type="radio" name="spice-level" value="American Medium" required /> American Medium</label>
 
93
  <label><input type="radio" name="spice-level" value="Indian Medium" required /> Indian Medium</label>
94
  <label><input type="radio" name="spice-level" value="Indian Very Spicy" required /> Indian Very Spicy</label>
95
  </div>
96
+
97
  <!-- Biryani Extras -->
98
+ <label for="biryani-extras" style="font-weight: bold;">Biryani Extras (Optional - Choose as many as you like):</label>
99
  <div id="biryani-extras-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
100
  <label><input type="checkbox" name="biryani-extra" value="Extra Raitha 4oz" /> Extra Raitha 4oz + $1.00</label>
101
  <label><input type="checkbox" name="biryani-extra" value="Extra Raitha 8oz" /> Extra Raitha 8oz + $2.00</label>
 
105
  <label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
106
  <label><input type="checkbox" name="biryani-extra" value="Extra Fried Onion" /> Extra Fried Onion 4oz + $2.00</label>
107
  </div>
108
+
109
  <!-- Quantity and Special Instructions -->
110
+ <label for="quantity" style="font-weight: bold;">Quantity:</label>
111
+ <input type="number" id="quantity" value="1" min="1" style="width: 50px; margin-bottom: 10px;" />
112
+ <br>
113
+ <textarea id="special-instructions" placeholder="Add special instructions here..." style="width: 100%; height: 60px; margin-bottom: 20px;"></textarea>
114
+
115
  <!-- Add to Cart Button -->
116
  <button style="background-color: #28a745; color: white; border: none; padding: 10px 20px; font-size: 14px; border-radius: 5px; cursor: pointer;" onclick="addToCart()">Add to Cart</button>
117
  </div>
118
+
119
  <script>
120
  let cart = [];
121
  function openModal(name, image, description, price) {
122
+ const modal = document.getElementById('modal');
123
+ modal.style.display = 'block';
124
  document.getElementById('modal-image').src = image;
125
  document.getElementById('modal-name').innerText = name;
126
  document.getElementById('modal-description').innerText = description;
127
  document.getElementById('modal-price').innerText = price;
128
  }
129
+
130
  function closeModal() {
131
+ const modal = document.getElementById('modal');
132
+ modal.style.display = 'none';
133
  }
134
+
135
  function addToCart() {
136
  const name = document.getElementById('modal-name').innerText;
137
  const price = document.getElementById('modal-price').innerText;
 
165
 
166
  if __name__ == "__main__":
167
  demo = app()
168
+ demo.launch()