Spaces:
Sleeping
Sleeping
Update app.py
Browse files101 unmodified lines10210310410510610710810911044 unmodified lines155156157158159160161162163164165166167168169170171172173174175176177101 unmodified lines<div style='text-align: center;'><img src='{dish['image']}' alt='{dish['name']}'style='width: 150px; height: 100px; object-fit: cover; border-radius: 10px;'><button onclick=\"showPopup('{dish['image']}', '{dish['name']}', '{dish['description']}', '{dish['price']}')\"style=\"margin-top: 15px; padding: 10px 20px; background-color: #28a745; color: white; border: none;border-radius: 5px; cursor: pointer;\">Add</button></div></div>"""44 unmodified linescolor: white; border: none; border-radius: 5px; cursor: pointer;">Close</button></div><script>function showPopup(image, title, description, price) {document.getElementById('popup-image').src = image;document.getElementById('popup-title').textContent = title;document.getElementById('popup-description').textContent = description;document.getElementById('popup-price').textContent = "Price: " + price;// Display the popupdocument.getElementById('popup').style.display = 'block';}function closePopup() {document.getElementById('popup').style.display = 'none';}function addToCart(dishName, spiceLevel) {const selectedExtras = Array.from(document.querySelectorAll('input[name=extras]:checked')).map(cb => cb.value).join(", ");alert(dishName + " with " + spiceLevel + " spice level and extras: " + selectedExtras + " has been added to the cart!");}</script>""")# Button click eventsbtn_all.click(101 unmodified lines10210310410510610710810911044 unmodified lines155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187101 unmodified lines<div style='text-align: center;'><img src='{dish['image']}' alt='{dish['name']}'style='width: 150px; height: 100px; object-fit: cover; border-radius: 10px;'><button onclick="showPopup('{dish['image']}', '{dish['name']}', '{dish['description']}', '{dish['price']}', event)"style="margin-top: 15px; padding: 10px 20px; background-color: #28a745; color: white; border: none;border-radius: 5px; cursor: pointer;">Add</button></div></div>"""44 unmodified linescolor: white; border: none; border-radius: 5px; cursor: pointer;">Close</button></div><script>function showPopup(image, title, description, price, event) {// Get the position of the clicked itemconst rect = event.target.getBoundingClientRect();// Set the content of the pop-updocument.getElementById('popup-image').src = image;document.getElementById('popup-title').textContent = title;document.getElementById('popup-description').textContent = description;document.getElementById('popup-price').textContent = "Price: " + price;// Position the pop-up near the clicked itemconst popup = document.getElementById('popup');popup.style.display = 'block';popup.style.position = 'absolute';popup.style.top = `${rect.top + window.scrollY + rect.height + 10}px`; // Below the buttonpopup.style.left = `${rect.left + window.scrollX}px`; // Align with the left of the button}function closePopup() {document.getElementById('popup').style.display = 'none';}function addToCart(dishName, spiceLevel) {const selectedExtras = Array.from(document.querySelectorAll('input[name=extras]:checked')).map(cb => cb.value).join(", ");alert(dishName + " with " + spiceLevel + " spice level and extras: " + selectedExtras + " has been added to the cart!");}</script>""")# Button click eventsbtn_all.click(
app.py+29-19