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

<!-- Background container with light orange -->
<div class="background">
    <a href="{{ url_for('menu.menu') }}" class="back-button"><i class="fa fa-arrow-left"></i></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">
            <div class="order-details">
                <p>{{ order.formatted_items }}</p>
            </div>

            <div class="order-date-time">
                <p>{{ order.formatted_date }}</p>
            </div>

            <div class="order-price">
                <p>Total: ₹{{ order.Total_Bill__c }}</p>
            </div>

            <div class="order-status {% if order.order_status == 'Pending' %}pending{% else %}completed{% endif %}">
                <p>Status: {{ order.order_status }}</p>
            </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">
                <div class="order-details">
                    <p>{{ order.formatted_items }}</p>
                </div>

                <div class="order-date-time">
                    <p>Order Placed: {{ order.formatted_date }}</p>
                </div>

                <div class="order-price">
                    <p>Total: ₹{{ order.Total_Bill__c }}</p>
                </div>

                <div class="order-status {% if order.order_status == 'Pending' %}pending{% else %}completed{% endif %}">
                    <p>Status: {{ order.order_status }}</p>
                </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>
</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>