Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -281,8 +281,13 @@ button {
|
|
281 |
});
|
282 |
finalOrderHTML += `</ul><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
|
283 |
document.getElementById('final-order').innerHTML = finalOrderHTML;
|
284 |
-
|
|
|
|
|
|
|
|
|
285 |
}
|
|
|
286 |
</script>
|
287 |
"""
|
288 |
# Authentication and Navigation Logic
|
@@ -393,8 +398,16 @@ def app():
|
|
393 |
gr.HTML(modal_and_cart_js)
|
394 |
|
395 |
# Cart & Final Order Page
|
396 |
-
with gr.Column(visible=False) as cart_section:
|
397 |
-
gr.Markdown("### Cart
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
|
399 |
# Floating cart display
|
400 |
cart_output = gr.HTML(value="Your cart is empty.", elem_id="floating-cart")
|
@@ -440,12 +453,14 @@ def app():
|
|
440 |
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
441 |
outputs=[menu_section, cart_section],
|
442 |
)
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
|
|
447 |
)
|
448 |
|
|
|
449 |
return demo
|
450 |
|
451 |
if __name__ == "__main__":
|
|
|
281 |
});
|
282 |
finalOrderHTML += `</ul><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
|
283 |
document.getElementById('final-order').innerHTML = finalOrderHTML;
|
284 |
+
// Trigger navigation to the final order page
|
285 |
+
const finalOrderPage = document.getElementById('final-order-section');
|
286 |
+
const cartPage = document.getElementById('cart-section');
|
287 |
+
cartPage.style.display = 'none';
|
288 |
+
finalOrderPage.style.display = 'block';
|
289 |
}
|
290 |
+
|
291 |
</script>
|
292 |
"""
|
293 |
# Authentication and Navigation Logic
|
|
|
398 |
gr.HTML(modal_and_cart_js)
|
399 |
|
400 |
# Cart & Final Order Page
|
401 |
+
with gr.Column(visible=False, elem_id="cart-section") as cart_section:
|
402 |
+
gr.Markdown("### Cart Page")
|
403 |
+
cart_output = gr.HTML(value="Your cart is empty.", elem_id="floating-cart")
|
404 |
+
back_to_menu_button = gr.Button("Back to Menu")
|
405 |
+
|
406 |
+
with gr.Column(visible=False, elem_id="final-order-section") as final_order_section:
|
407 |
+
gr.Markdown("### Final Order")
|
408 |
+
final_order_output = gr.HTML(value="", elem_id="final-order")
|
409 |
+
|
410 |
+
|
411 |
|
412 |
# Floating cart display
|
413 |
cart_output = gr.HTML(value="Your cart is empty.", elem_id="floating-cart")
|
|
|
453 |
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
454 |
outputs=[menu_section, cart_section],
|
455 |
)
|
456 |
+
|
457 |
+
# Navigate to Final Order Page
|
458 |
+
submitCart_button.click(
|
459 |
+
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
460 |
+
outputs=[cart_section, final_order_section],
|
461 |
)
|
462 |
|
463 |
+
|
464 |
return demo
|
465 |
|
466 |
if __name__ == "__main__":
|