Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -355,8 +355,9 @@ def app():
|
|
| 355 |
font-size: 16px;
|
| 356 |
cursor: pointer;
|
| 357 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
|
| 358 |
-
|
| 359 |
-
|
|
|
|
| 360 |
|
| 361 |
# Modal window for item customization
|
| 362 |
modal_window = gr.HTML("""
|
|
@@ -430,6 +431,7 @@ def app():
|
|
| 430 |
</div>
|
| 431 |
''')
|
| 432 |
|
|
|
|
| 433 |
selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
|
| 434 |
gr.Row([selected_preference])
|
| 435 |
gr.Row(menu_output)
|
|
@@ -453,32 +455,32 @@ def app():
|
|
| 453 |
document.getElementById('cart-content').innerHTML = htmlContent;
|
| 454 |
}
|
| 455 |
|
| 456 |
-
//
|
| 457 |
function updateCartDisplay() {
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
">Submit</button>`;
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
|
| 483 |
# Cart & Final Order Page (Not needed as the cart is shown in the modal now)
|
| 484 |
|
|
|
|
| 355 |
font-size: 16px;
|
| 356 |
cursor: pointer;
|
| 357 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
|
| 358 |
+
" onclick="openCartModal()">View Cart</div>
|
| 359 |
+
''')
|
| 360 |
+
|
| 361 |
|
| 362 |
# Modal window for item customization
|
| 363 |
modal_window = gr.HTML("""
|
|
|
|
| 431 |
</div>
|
| 432 |
''')
|
| 433 |
|
| 434 |
+
|
| 435 |
selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
|
| 436 |
gr.Row([selected_preference])
|
| 437 |
gr.Row(menu_output)
|
|
|
|
| 455 |
document.getElementById('cart-content').innerHTML = htmlContent;
|
| 456 |
}
|
| 457 |
|
| 458 |
+
// Ensure existing updateCartDisplay logic works
|
| 459 |
function updateCartDisplay() {
|
| 460 |
+
let totalBill = 0;
|
| 461 |
+
let cartHTML = "<div>";
|
| 462 |
+
cart.forEach((item, index) => {
|
| 463 |
+
totalBill += item.itemTotal;
|
| 464 |
+
cartHTML += `<div style="margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; padding: 10px;">
|
| 465 |
+
<strong>${item.name}</strong> (x${item.quantity}) - $${item.itemTotal.toFixed(2)}
|
| 466 |
+
<br>Extras: ${item.extras.join(", ") || "None"}
|
| 467 |
+
<br>Instructions: ${item.instructions || "None"}
|
| 468 |
+
</div>`;
|
| 469 |
+
});
|
| 470 |
+
cartHTML += `</div><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
|
| 471 |
+
cartHTML += `<button onclick="submitCart()" style="
|
| 472 |
+
background-color: #007bff;
|
| 473 |
+
color: white;
|
| 474 |
+
padding: 10px 20px;
|
| 475 |
+
border: none;
|
| 476 |
+
border-radius: 5px;
|
| 477 |
+
font-size: 16px;
|
| 478 |
+
cursor: pointer;
|
| 479 |
">Submit</button>`;
|
| 480 |
+
updateCartContent(cartHTML);
|
| 481 |
+
}
|
| 482 |
+
</script>
|
| 483 |
+
''')
|
| 484 |
|
| 485 |
# Cart & Final Order Page (Not needed as the cart is shown in the modal now)
|
| 486 |
|