Spaces:
Runtime error
Runtime error
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Order History</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| background-color: #f8f9fa; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .container { | |
| width: 70%; | |
| margin: 30px auto; | |
| padding: 20px; | |
| background-color: #fdf4e3; | |
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | |
| border-radius: 8px; | |
| } | |
| .order-item { | |
| padding: 10px; | |
| border: 2px solid #ffe5b4; | |
| margin-bottom: 20px; | |
| border-radius: 5px; | |
| } | |
| .order-details { | |
| font-size: 16px; | |
| font-weight: bold; | |
| color: gray; | |
| } | |
| .order-details p { | |
| margin: 5px 0; | |
| } | |
| .order-date-time { | |
| font-size: 14px; | |
| color: gray; | |
| } | |
| .order-price { | |
| font-size: 16px; | |
| font-weight: bold; | |
| color: gray; | |
| margin: 10px 0; | |
| } | |
| .order-status p { | |
| margin: 5px 0; | |
| } | |
| .order-status .status-label { | |
| color: lightgrey; /* Light grey color for "Status:" label */ | |
| font-weight: normal; /* Optional: make the label less bold */ | |
| } | |
| .order-status { | |
| font-size: 14px; | |
| font-weight: bold; | |
| color: #28a745; /* Green for completed, can be customized based on the status */ | |
| margin-top: 10px; | |
| } | |
| .order-buttons { | |
| margin-top: 10px; | |
| } | |
| .reorder-btn, .rate-order-btn { | |
| background-color: #ff7f00; | |
| color: white; | |
| border: none; | |
| padding: 8px 16px; | |
| margin-right: 10px; | |
| cursor: pointer; | |
| border-radius: 4px; | |
| } | |
| .reorder-btn:hover, .rate-order-btn:hover { | |
| background-color: #f55b00; | |
| } | |
| .total-price { | |
| font-size: 18px; | |
| font-weight: bold; | |
| color: #333; | |
| margin-top: 20px; | |
| } | |
| .order-heading { | |
| font-size: 20px; | |
| font-weight: bold; | |
| color: black; | |
| margin-bottom: 20px; | |
| text-align: center; | |
| } | |
| .back-button { | |
| display: inline-block; | |
| background-color: green; | |
| color: white; | |
| padding: 10px 20px; | |
| text-decoration: none; | |
| font-weight: bold; | |
| border-radius: 4px; | |
| margin-bottom: 20px; | |
| } | |
| .back-button:hover { | |
| background-color: darkgreen; | |
| } | |
| /* Hide additional orders by default */ | |
| .more-orders { | |
| display: none; | |
| } | |
| /* Style for the Show More/Show Less button */ | |
| .show-more-btn { | |
| background-color: #ff7f00; | |
| color: white; | |
| padding: 10px 20px; | |
| border: none; | |
| cursor: pointer; | |
| border-radius: 4px; | |
| margin-top: 20px; | |
| } | |
| .show-more-btn:hover { | |
| background-color: #f55b00; | |
| } | |
| @media (max-width: 768px) { | |
| .order-details, .order-price, .order-date-time { | |
| font-size: 14px; | |
| } | |
| .order-heading { | |
| font-size: 18px; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <a href="{{ url_for('menu') }}" class="back-button">Back to Menu</a> | |
| <div class="container"> | |
| <div class="order-heading">Order History</div> | |
| <!-- Loop through the orders (first 3) --> | |
| {% for order in orders[:3] %} | |
| <div class="order-item"> | |
| <!-- Order details: item names and quantities --> | |
| <div class="order-details"> | |
| <p>{{ order.formatted_items }}</p> | |
| </div> | |
| <!-- Order date and time --> | |
| <div class="order-date-time"> | |
| <p>{{ order.formatted_date }}</p> | |
| </div> | |
| <!-- Total price --> | |
| <div class="order-price"> | |
| <p>Total: ₹{{ order.Total_Bill__c }}</p> | |
| </div> | |
| <div class="order-status"> | |
| <p>Status: {{ order.order_status }}</p> <!-- Display order status --> | |
| </div> | |
| </div> | |
| {% endfor %} | |
| <!-- Loop through the remaining orders (hidden initially) --> | |
| <div class="more-orders" id="more-orders"> | |
| {% for order in orders[3:] %} | |
| <div class="order-item"> | |
| <!-- Order details: item names and quantities --> | |
| <div class="order-details"> | |
| <p>{{ order.formatted_items }}</p> | |
| </div> | |
| <!-- Order date and time --> | |
| <div class="order-date-time"> | |
| <p>Order Placed:{{ order.formatted_date }}</p> | |
| </div> | |
| <!-- Total price --> | |
| <div class="order-price"> | |
| <p>Total: ₹{{ order.Total_Bill__c }}</p> | |
| </div> | |
| <!-- Order Status --> | |
| <div class="order-status"> | |
| <p>Status: {{ order.order_status }}</p> <!-- Display order status --> | |
| </div> | |
| </div> | |
| {% endfor %} | |
| </div> | |
| <!-- Show More button --> | |
| {% if orders|length > 3 %} | |
| <button class="show-more-btn" onclick="toggleOrders()">Show More</button> | |
| {% endif %} | |
| <!-- If no orders exist --> | |
| {% if not orders %} | |
| <div class="no-orders"> | |
| <p>No orders found.</p> | |
| </div> | |
| {% endif %} | |
| </div> | |
| <script> | |
| // Function to toggle between Show More and Show Less | |
| function toggleOrders() { | |
| const moreOrders = document.getElementById("more-orders"); | |
| const button = document.querySelector(".show-more-btn"); | |
| if (moreOrders.style.display === "none") { | |
| moreOrders.style.display = "block"; | |
| button.innerHTML = "Show Less"; // Change button text | |
| } else { | |
| moreOrders.style.display = "none"; | |
| button.innerHTML = "Show More"; // Change button text back | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |