Spaces:
Sleeping
Sleeping
Update components/popup_card.py
Browse files- components/popup_card.py +20 -11
components/popup_card.py
CHANGED
|
@@ -1,17 +1,26 @@
|
|
| 1 |
def generate_popup_card(name, model_path):
|
| 2 |
"""
|
| 3 |
-
Generates an HTML popup card dynamically for the selected menu item.
|
| 4 |
"""
|
| 5 |
html_content = f"""
|
| 6 |
-
<div style="
|
| 7 |
-
<
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
"""
|
| 17 |
-
return html_content
|
|
|
|
| 1 |
def generate_popup_card(name, model_path):
|
| 2 |
"""
|
| 3 |
+
Generates an HTML popup card dynamically for the selected menu item with a black background overlay.
|
| 4 |
"""
|
| 5 |
html_content = f"""
|
| 6 |
+
<div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 9999; display: flex; justify-content: center; align-items: center;">
|
| 7 |
+
<div style="border: 1px solid #ddd; padding: 20px; border-radius: 10px; background-color: #fff; width: 300px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);">
|
| 8 |
+
<h2 style="text-align: center; color: #333;">{name}</h2>
|
| 9 |
+
<model-viewer src="{model_path}" alt="3D Model of {name}" camera-controls auto-rotate style="width: 100%;"></model-viewer>
|
| 10 |
+
<label for="instructions" style="display: block; margin-top: 10px;">Special Instructions:</label>
|
| 11 |
+
<textarea id="instructions" placeholder="Add any requests here..." style="width: 100%; margin-bottom: 10px;"></textarea>
|
| 12 |
+
<label for="quantity" style="display: block;">Quantity:</label>
|
| 13 |
+
<input type="number" id="quantity" min="1" max="10" value="1" style="width: 100%; margin-bottom: 10px;">
|
| 14 |
+
<div style="text-align: center;">
|
| 15 |
+
<button style="margin-top: 10px; padding: 10px 20px; background-color: #008cba; color: white; border: none; border-radius: 5px;">Add to Cart</button>
|
| 16 |
+
<button style="margin-top: 10px; padding: 10px 20px; background-color: #ccc; color: black; border: none; border-radius: 5px; margin-left: 10px;" onclick="closePopup()">Close</button>
|
| 17 |
+
</div>
|
| 18 |
+
</div>
|
| 19 |
</div>
|
| 20 |
+
<script>
|
| 21 |
+
function closePopup() {{
|
| 22 |
+
document.getElementById('overlay').style.display = 'none';
|
| 23 |
+
}}
|
| 24 |
+
</script>
|
| 25 |
"""
|
| 26 |
+
return html_content
|