Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -284,7 +284,38 @@ button {
|
|
284 |
alert("Your final order has been submitted!");
|
285 |
}
|
286 |
</script>
|
287 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
# Gradio App
|
289 |
def app():
|
290 |
with gr.Blocks() as demo:
|
@@ -325,37 +356,8 @@ def app():
|
|
325 |
# Output area for menu items
|
326 |
menu_output = gr.HTML(value=filter_menu("All"))
|
327 |
|
328 |
-
# Modal window
|
329 |
-
modal_window = gr.HTML(
|
330 |
-
<div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
|
331 |
-
<div style="text-align: right;">
|
332 |
-
<button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button>
|
333 |
-
</div>
|
334 |
-
<img id="modal-image" style="width: 100%; height: 300px; border-radius: 8px; margin-bottom: 20px;" />
|
335 |
-
<h2 id="modal-name"></h2>
|
336 |
-
<p id="modal-description"></p>
|
337 |
-
<p id="modal-price"></p>
|
338 |
-
<!-- Biryani Extras -->
|
339 |
-
<label for="biryani-extras">Extras :</label>
|
340 |
-
<div id="biryani-extras-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
|
341 |
-
<label><input type="checkbox" name="biryani-extra" value="Thums up" /> Thums up + $2.00</label>
|
342 |
-
<label><input type="checkbox" name="biryani-extra" value="Sprite" /> Sprite + $2.00</label>
|
343 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Raitha" /> Extra Raitha + $1.00</label>
|
344 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Salan" /> Extra Salan + $2.00</label>
|
345 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
|
346 |
-
<label><input type="checkbox" name="biryani-extra" value="Chilli Chicken" /> Chilli Chicken + $14.00</label>
|
347 |
-
<label><input type="checkbox" name="biryani-extra" value="Veg Manchurian" /> Veg Manchurian + $12.00</label>
|
348 |
-
</div>
|
349 |
-
<!-- Quantity and Special Instructions -->
|
350 |
-
<label for="quantity">Quantity:</label>
|
351 |
-
<input type="number" id="quantity" value="1" min="1" style="width: 50px;" />
|
352 |
-
<br><br>
|
353 |
-
<textarea id="special-instructions" placeholder="Add special instructions here..." style="width: 100%; height: 60px;"></textarea>
|
354 |
-
<br><br>
|
355 |
-
<!-- Add to Cart Button -->
|
356 |
-
<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>
|
357 |
-
</div>
|
358 |
-
""")
|
359 |
|
360 |
# Layout
|
361 |
gr.Row([selected_preference])
|
|
|
284 |
alert("Your final order has been submitted!");
|
285 |
}
|
286 |
</script>
|
287 |
+
# Modal HTML Content
|
288 |
+
MODAL_HTML = """
|
289 |
+
<div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
|
290 |
+
<div style="text-align: right;">
|
291 |
+
<button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button>
|
292 |
+
</div>
|
293 |
+
<img id="modal-image" style="width: 100%; height: 300px; border-radius: 8px; margin-bottom: 20px;" />
|
294 |
+
<h2 id="modal-name"></h2>
|
295 |
+
<p id="modal-description"></p>
|
296 |
+
<p id="modal-price"></p>
|
297 |
+
<!-- Biryani Extras -->
|
298 |
+
<label for="biryani-extras">Extras :</label>
|
299 |
+
<div id="biryani-extras-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
|
300 |
+
<label><input type="checkbox" name="biryani-extra" value="Thums up" /> Thums up + $2.00</label>
|
301 |
+
<label><input type="checkbox" name="biryani-extra" value="Sprite" /> Sprite + $2.00</label>
|
302 |
+
<label><input type="checkbox" name="biryani-extra" value="Extra Raitha" /> Extra Raitha + $1.00</label>
|
303 |
+
<label><input type="checkbox" name="biryani-extra" value="Extra Salan" /> Extra Salan + $2.00</label>
|
304 |
+
<label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
|
305 |
+
<label><input type="checkbox" name="biryani-extra" value="Chilli Chicken" /> Chilli Chicken + $14.00</label>
|
306 |
+
<label><input type="checkbox" name="biryani-extra" value="Veg Manchurian" /> Veg Manchurian + $12.00</label>
|
307 |
+
</div>
|
308 |
+
<!-- Quantity and Special Instructions -->
|
309 |
+
<label for="quantity">Quantity:</label>
|
310 |
+
<input type="number" id="quantity" value="1" min="1" style="width: 50px;" />
|
311 |
+
<br><br>
|
312 |
+
<textarea id="special-instructions" placeholder="Add special instructions here..." style="width: 100%; height: 60px;"></textarea>
|
313 |
+
<br><br>
|
314 |
+
<!-- Add to Cart Button -->
|
315 |
+
<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>
|
316 |
+
</div>
|
317 |
+
"""
|
318 |
+
|
319 |
# Gradio App
|
320 |
def app():
|
321 |
with gr.Blocks() as demo:
|
|
|
356 |
# Output area for menu items
|
357 |
menu_output = gr.HTML(value=filter_menu("All"))
|
358 |
|
359 |
+
# Modal window using the pre-defined MODAL_HTML
|
360 |
+
modal_window = gr.HTML(MODAL_HTML)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
# Layout
|
363 |
gr.Row([selected_preference])
|