Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -191,6 +191,10 @@ def modal_js():
|
|
191 |
updateCartTotalCost(); // Update total cost displayed
|
192 |
closeModal();
|
193 |
}
|
|
|
|
|
|
|
|
|
194 |
function updateCartButton() {
|
195 |
const cartButton = document.getElementById('cart-button');
|
196 |
cartButton.innerText = `View Cart (${cart.length} items)`;
|
@@ -247,6 +251,10 @@ def modal_js():
|
|
247 |
const totalCost = cart.reduce((total, item) => total + item.totalCost, 0).toFixed(2);
|
248 |
document.getElementById('order-summary').innerHTML = orderDetails;
|
249 |
document.getElementById('total-bill').innerText = `$${totalCost}`;
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
</script>
|
252 |
"""
|
@@ -286,6 +294,14 @@ with gr.Blocks() as app:
|
|
286 |
gr.HTML(create_modal_window())
|
287 |
gr.HTML(modal_js())
|
288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
login_button.click(
|
290 |
lambda email, password: (gr.update(visible=False), gr.update(visible=True), gr.update(value=filter_menu("All")), "Login successful!")
|
291 |
if login(email, password)[0] == "Login successful!" else (gr.update(), gr.update(), gr.update(), "Invalid email or password."),
|
|
|
191 |
updateCartTotalCost(); // Update total cost displayed
|
192 |
closeModal();
|
193 |
}
|
194 |
+
function resetAddOns() {
|
195 |
+
const checkboxes = document.querySelectorAll('input[name="biryani-extra"]');
|
196 |
+
checkboxes.forEach(checkbox => checkbox.checked = false); // Uncheck all add-ons
|
197 |
+
}
|
198 |
function updateCartButton() {
|
199 |
const cartButton = document.getElementById('cart-button');
|
200 |
cartButton.innerText = `View Cart (${cart.length} items)`;
|
|
|
251 |
const totalCost = cart.reduce((total, item) => total + item.totalCost, 0).toFixed(2);
|
252 |
document.getElementById('order-summary').innerHTML = orderDetails;
|
253 |
document.getElementById('total-bill').innerText = `$${totalCost}`;
|
254 |
+
// Close the cart modal
|
255 |
+
closeCartModal();
|
256 |
+
// Navigate to the final order page
|
257 |
+
document.getElementById('final-order-page').style.display = 'block';
|
258 |
}
|
259 |
</script>
|
260 |
"""
|
|
|
294 |
gr.HTML(create_modal_window())
|
295 |
gr.HTML(modal_js())
|
296 |
|
297 |
+
# Final Order Page
|
298 |
+
with gr.Row(visible=False, id='final-order-page'):
|
299 |
+
with gr.Column():
|
300 |
+
gr.HTML("<h2>Final Order:</h2>")
|
301 |
+
order_summary = gr.HTML()
|
302 |
+
gr.HTML("<h3>Total Bill:</h3>")
|
303 |
+
total_bill = gr.Textbox()
|
304 |
+
|
305 |
login_button.click(
|
306 |
lambda email, password: (gr.update(visible=False), gr.update(visible=True), gr.update(value=filter_menu("All")), "Login successful!")
|
307 |
if login(email, password)[0] == "Login successful!" else (gr.update(), gr.update(), gr.update(), "Invalid email or password."),
|