nagasurendra commited on
Commit
dc221de
·
verified ·
1 Parent(s): aaced56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -26
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
- " onclick="openCartModal()">View Cart</div>
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
- // Update the cart display dynamically
457
  function updateCartDisplay() {
458
- let totalBill = 0;
459
- let cartHTML = "<div>";
460
- cart.forEach((item, index) => {
461
- totalBill += item.itemTotal;
462
- cartHTML += `<div style="margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; padding: 10px;">
463
- <strong>${item.name}</strong> (x${item.quantity}) - $${item.itemTotal.toFixed(2)}
464
- <br>Extras: ${item.extras.join(", ") || "None"}
465
- <br>Instructions: ${item.instructions || "None"}
466
- </div>`;
467
- });
468
- cartHTML += `</div><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
469
- cartHTML += `<button onclick="submitCart()" style="
470
- background-color: #007bff;
471
- color: white;
472
- padding: 10px 20px;
473
- border: none;
474
- border-radius: 5px;
475
- font-size: 16px;
476
- cursor: pointer;
477
  ">Submit</button>`;
478
- updateCartContent(cartHTML);
479
- }
480
- </script>
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