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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html lang="en">
|
| 2 |
+
<head>
|
| 3 |
+
<meta charset="UTF-8">
|
| 4 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
| 5 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
| 6 |
+
<title>Order History</title>
|
| 7 |
+
<style>
|
| 8 |
+
/* Reset padding and margin for all elements */
|
| 9 |
+
* {
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
box-sizing: border-box;
|
| 13 |
+
}
|
| 14 |
+
body {
|
| 15 |
+
font-family: Arial, sans-serif;
|
| 16 |
+
background-color: #fdf4e3; /* Light orange background for the whole page */
|
| 17 |
+
margin: 0;
|
| 18 |
+
padding: 0;
|
| 19 |
+
}
|
| 20 |
+
/* Light Orange Background for the back-side */
|
| 21 |
+
.background {
|
| 22 |
+
padding: 8vw 0;
|
| 23 |
+
position: relative;
|
| 24 |
+
}
|
| 25 |
+
/* Green Back Button styling */
|
| 26 |
+
.back-button {
|
| 27 |
+
position: absolute;
|
| 28 |
+
top: 15px;
|
| 29 |
+
left: 15px;
|
| 30 |
+
display: inline-block;
|
| 31 |
+
background-color: green; /* Green color */
|
| 32 |
+
color: white;
|
| 33 |
+
padding: 10px 20px;
|
| 34 |
+
text-decoration: none;
|
| 35 |
+
font-weight: bold;
|
| 36 |
+
border-radius: 4px;
|
| 37 |
+
z-index: 10; /* Ensure it stays above other content */
|
| 38 |
+
}
|
| 39 |
+
.back-button:hover {
|
| 40 |
+
background-color: darkgreen; /* Darker green color on hover */
|
| 41 |
+
}
|
| 42 |
+
/* Container */
|
| 43 |
+
.container {
|
| 44 |
+
width: 85%; /* Decreased width for smaller template size */
|
| 45 |
+
max-width: 450px; /* Reduced max-width */
|
| 46 |
+
margin: 30px auto 0; /* Added margin-top to push content down */
|
| 47 |
+
padding: 15px;
|
| 48 |
+
background-color: white;
|
| 49 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 50 |
+
border-radius: 8px;
|
| 51 |
+
}
|
| 52 |
+
.order-item {
|
| 53 |
+
padding: 12px;
|
| 54 |
+
border: 1px solid #6c757d;
|
| 55 |
+
margin-bottom: 12px;
|
| 56 |
+
border-radius: 5px;
|
| 57 |
+
}
|
| 58 |
+
.order-details {
|
| 59 |
+
font-size: 14px;
|
| 60 |
+
font-weight: bold;
|
| 61 |
+
color: black;
|
| 62 |
+
}
|
| 63 |
+
.order-details p {
|
| 64 |
+
margin: 4px 0;
|
| 65 |
+
}
|
| 66 |
+
.order-date-time {
|
| 67 |
+
font-size: 11px;
|
| 68 |
+
color: black;
|
| 69 |
+
}
|
| 70 |
+
.order-price {
|
| 71 |
+
font-size: 13px;
|
| 72 |
+
font-weight: bold;
|
| 73 |
+
color: black;
|
| 74 |
+
margin: 5px 0;
|
| 75 |
+
}
|
| 76 |
+
.order-status {
|
| 77 |
+
font-size: 11px;
|
| 78 |
+
font-weight: bold;
|
| 79 |
+
margin-top: 6px;
|
| 80 |
+
}
|
| 81 |
+
.order-status.pending {
|
| 82 |
+
color: green;
|
| 83 |
+
}
|
| 84 |
+
.order-status.completed {
|
| 85 |
+
color: #28a745;
|
| 86 |
+
}
|
| 87 |
+
.order-buttons {
|
| 88 |
+
margin-top: 6px;
|
| 89 |
+
}
|
| 90 |
+
.reorder-btn, .rate-order-btn {
|
| 91 |
+
background-color: #ff7f00;
|
| 92 |
+
color: white;
|
| 93 |
+
border: none;
|
| 94 |
+
padding: 6px 12px;
|
| 95 |
+
margin-right: 8px;
|
| 96 |
+
cursor: pointer;
|
| 97 |
+
border-radius: 4px;
|
| 98 |
+
}
|
| 99 |
+
.reorder-btn:hover, .rate-order-btn:hover {
|
| 100 |
+
background-color: #f55b00;
|
| 101 |
+
}
|
| 102 |
+
.total-price {
|
| 103 |
+
font-size: 14px;
|
| 104 |
+
font-weight: bold;
|
| 105 |
+
color: #333;
|
| 106 |
+
margin-top: 15px;
|
| 107 |
+
}
|
| 108 |
+
.order-heading {
|
| 109 |
+
font-size: 16px;
|
| 110 |
+
font-weight: bold;
|
| 111 |
+
color: #ff7f00;
|
| 112 |
+
margin-bottom: 15px;
|
| 113 |
+
text-align: center;
|
| 114 |
+
}
|
| 115 |
+
.show-more-btn {
|
| 116 |
+
background-color: #ff7f00;
|
| 117 |
+
color: white;
|
| 118 |
+
padding: 10px 20px;
|
| 119 |
+
border: none;
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
border-radius: 4px;
|
| 122 |
+
margin-top: 20px;
|
| 123 |
+
font-weight: bold;
|
| 124 |
+
}
|
| 125 |
+
.show-more-btn:hover {
|
| 126 |
+
background-color: #f55b00;
|
| 127 |
+
}
|
| 128 |
+
/* Responsive design adjustments */
|
| 129 |
+
@media (max-width: 480px) {
|
| 130 |
+
.container {
|
| 131 |
+
width: 90%;
|
| 132 |
+
margin: 30px auto 0;
|
| 133 |
+
padding: 10px;
|
| 134 |
+
}
|
| 135 |
+
.order-details {
|
| 136 |
+
font-size: 12px;
|
| 137 |
+
}
|
| 138 |
+
.order-price {
|
| 139 |
+
font-size: 12px;
|
| 140 |
+
}
|
| 141 |
+
.order-status {
|
| 142 |
+
font-size: 10px;
|
| 143 |
+
}
|
| 144 |
+
.order-heading {
|
| 145 |
+
font-size: 14px;
|
| 146 |
+
}
|
| 147 |
+
.show-more-btn {
|
| 148 |
+
padding: 6px 12px;
|
| 149 |
+
}
|
| 150 |
+
.back-button {
|
| 151 |
+
top: 10px;
|
| 152 |
+
left: 10px;
|
| 153 |
+
padding: 8px 16px;
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
</style>
|
| 157 |
+
</head>
|
| 158 |
+
<body>
|
| 159 |
+
|
| 160 |
+
<!-- Background container with light orange -->
|
| 161 |
+
<div class="background">
|
| 162 |
+
<a href="{{ url_for('menu') }}" class="back-button"><i class="fa fa-arrow-left"></i></a>
|
| 163 |
+
|
| 164 |
+
<div class="container">
|
| 165 |
+
<div class="order-heading">Order History</div>
|
| 166 |
+
|
| 167 |
+
<!-- Loop through the orders (first 3) -->
|
| 168 |
+
{% for order in orders[:3] %}
|
| 169 |
+
<div class="order-item">
|
| 170 |
+
<div class="order-details">
|
| 171 |
+
<p>{{ order.formatted_items }}</p>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<div class="order-date-time">
|
| 175 |
+
<p>{{ order.formatted_date }}</p>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<div class="order-price">
|
| 179 |
+
<p>Total: ₹{{ order.Total_Bill__c }}</p>
|
| 180 |
+
</div>
|
| 181 |
+
|
| 182 |
+
<div class="order-status {% if order.order_status == 'Pending' %}pending{% else %}completed{% endif %}">
|
| 183 |
+
<p>Status: {{ order.order_status }}</p>
|
| 184 |
+
</div>
|
| 185 |
+
</div>
|
| 186 |
+
{% endfor %}
|
| 187 |
+
|
| 188 |
+
<!-- Loop through the remaining orders (hidden initially) -->
|
| 189 |
+
<div class="more-orders" id="more-orders">
|
| 190 |
+
{% for order in orders[3:] %}
|
| 191 |
+
<div class="order-item">
|
| 192 |
+
<div class="order-details">
|
| 193 |
+
<p>{{ order.formatted_items }}</p>
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<div class="order-date-time">
|
| 197 |
+
<p>Order Placed: {{ order.formatted_date }}</p>
|
| 198 |
+
</div>
|
| 199 |
+
|
| 200 |
+
<div class="order-price">
|
| 201 |
+
<p>Total: ₹{{ order.Total_Bill__c }}</p>
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
<div class="order-status {% if order.order_status == 'Pending' %}pending{% else %}completed{% endif %}">
|
| 205 |
+
<p>Status: {{ order.order_status }}</p>
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
{% endfor %}
|
| 209 |
+
</div>
|
| 210 |
+
|
| 211 |
+
<!-- Show More button -->
|
| 212 |
+
{% if orders|length > 3 %}
|
| 213 |
+
<button class="show-more-btn" onclick="toggleOrders()">Show More</button>
|
| 214 |
+
{% endif %}
|
| 215 |
+
|
| 216 |
+
<!-- If no orders exist -->
|
| 217 |
+
{% if not orders %}
|
| 218 |
+
<div class="no-orders">
|
| 219 |
+
<p>No orders found.</p>
|
| 220 |
+
</div>
|
| 221 |
+
{% endif %}
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<script>
|
| 226 |
+
// Function to toggle between Show More and Show Less
|
| 227 |
+
function toggleOrders() {
|
| 228 |
+
const moreOrders = document.getElementById("more-orders");
|
| 229 |
+
const button = document.querySelector(".show-more-btn");
|
| 230 |
+
if (moreOrders.style.display === "none") {
|
| 231 |
+
moreOrders.style.display = "block";
|
| 232 |
+
button.innerHTML = "Show Less"; // Change button text
|
| 233 |
+
} else {
|
| 234 |
+
moreOrders.style.display = "none";
|
| 235 |
+
button.innerHTML = "Show More"; // Change button text back
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
</script>
|
| 239 |
+
|
| 240 |
+
</body>
|
| 241 |
+
</html>
|