Spaces:
Build error
Build error
Update app.py
Browse files128 unmodified lines129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171166 unmodified lines338339340341342343344128 unmodified lines};let finalized = false;function openModal(name, image, description, price) {if (finalized) {alert("You cannot add more items after finalizing your order.");return;}const modal = document.getElementById('modal');const buttonRect = event.target.getBoundingClientRect(); // Get button position// Adjust modal width based on screen sizeif (window.innerWidth <= 768) { // For phone screensmodal.style.width = '90%';}else { // For larger screens (laptops)modal.style.width = '30%';}const modalWidth = modal.offsetWidth;const modalHeight = modal.offsetHeight;// Calculate the modal's position dynamicallyconst modalTop = window.scrollY + buttonRect.top + buttonRect.height / 2 - modalHeight / 2;const modalLeft = window.scrollX + buttonRect.left + buttonRect.width / 2 - modalWidth / 2;// Set modal positionmodal.style.display = 'block';modal.style.position = 'absolute'; // Use absolute to position it dynamicallymodal.style.top = `${modalTop}px`;modal.style.left = `${modalLeft}px`;// Update modal contentdocument.getElementById('modal-image').src = image;document.getElementById('modal-name').innerText = name;document.getElementById('modal-description').innerText = description;document.getElementById('modal-price').innerText = price;// Reset extras and input fieldsconst extrasInputs = document.querySelectorAll('input[name="biryani-extra"]');extrasInputs.forEach(input => input.checked = false);document.getElementById('quantity').value = 1;document.getElementById('special-instructions').value = '';}166 unmodified lines# Modal windowmodal_window = gr.HTML("""<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;"><div style="text-align: right;"><button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button></div>128 unmodified lines129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168166 unmodified lines335336337338339340341128 unmodified lines};let finalized = false;function openModal(name, image, description, price) {if (finalized) {alert("You cannot add more items after finalizing your order.");return;}const modal = document.getElementById('modal');const buttonRect = event.target.getBoundingClientRect(); // Get button position// Set modal width based on device sizeif (window.innerWidth <= 768) {modal.style.width = '90%'; // For mobile devices} else {modal.style.width = '30%'; // For laptops and larger screens}const modalWidth = modal.offsetWidth;const modalHeight = modal.offsetHeight;// Dynamically calculate modal positionconst modalTop = window.scrollY + buttonRect.top + buttonRect.height / 2 - modalHeight / 2;const modalLeft = window.scrollX + buttonRect.left + buttonRect.width / 2 - modalWidth / 2;// Apply positioning stylesmodal.style.display = 'block';modal.style.top = `${modalTop}px`;modal.style.left = `${modalLeft}px`;// Populate modal contentdocument.getElementById('modal-image').src = image;document.getElementById('modal-name').innerText = name;document.getElementById('modal-description').innerText = description;document.getElementById('modal-price').innerText = `$${price}`;// Reset inputsdocument.getElementById('quantity').value = 1;document.getElementById('special-instructions').value = '';}166 unmodified lines# Modal windowmodal_window = gr.HTML("""<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;"><div style="text-align: right;"><button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button></div>
app.py+14-17