nagasurendra commited on
Commit
536706d
·
verified ·
1 Parent(s): 8588da2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -149,7 +149,7 @@ modal_and_cart_js = """
149
  </li>`;
150
  });
151
  cartHTML += `</ul><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
152
- cartHTML += `<button style='margin-top: 10px; background-color: #007bff; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;' onclick='submitCart()'>Submit</button>`;
153
  document.getElementById('floating-cart').innerHTML = cartHTML;
154
  }
155
 
@@ -175,6 +175,11 @@ modal_and_cart_js = """
175
  updateCartDisplay();
176
  }
177
 
 
 
 
 
 
178
  function submitCart() {
179
  let finalOrderHTML = "<h3>Final Order:</h3><ul>";
180
  let totalBill = 0;
@@ -253,12 +258,6 @@ def app():
253
  </div>
254
  """)
255
 
256
- # Finalize Order Button
257
- finalize_button = gr.Button("Finalize Order")
258
-
259
- # Finalize order button click event
260
- finalize_button.click(lambda: "Order finalized!", outputs=[final_order_output])
261
-
262
  # Update menu dynamically based on preference
263
  selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
264
 
@@ -267,7 +266,6 @@ def app():
267
  gr.Row(menu_output)
268
  gr.Row(cart_output)
269
  gr.Row(modal_window)
270
- gr.Row(finalize_button)
271
  gr.Row(final_order_output)
272
  gr.HTML(modal_and_cart_js)
273
 
 
149
  </li>`;
150
  });
151
  cartHTML += `</ul><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
152
+ cartHTML += `<button style='margin-top: 10px; background-color: #007bff; color: white; border: none; padding: 10px; border-radius: 5px; width: 100%; cursor: pointer;' onclick='submitCart()'>Submit</button>`;
153
  document.getElementById('floating-cart').innerHTML = cartHTML;
154
  }
155
 
 
175
  updateCartDisplay();
176
  }
177
 
178
+ function removeItem(index) {
179
+ cart.splice(index, 1); // Remove the item from the cart array
180
+ updateCartDisplay(); // Re-render the cart display
181
+ }
182
+
183
  function submitCart() {
184
  let finalOrderHTML = "<h3>Final Order:</h3><ul>";
185
  let totalBill = 0;
 
258
  </div>
259
  """)
260
 
 
 
 
 
 
 
261
  # Update menu dynamically based on preference
262
  selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
263
 
 
266
  gr.Row(menu_output)
267
  gr.Row(cart_output)
268
  gr.Row(modal_window)
 
269
  gr.Row(final_order_output)
270
  gr.HTML(modal_and_cart_js)
271