-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorders.php
203 lines (172 loc) · 8.33 KB
/
orders.php
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
<?php
$title = "My Orders";
include_once "./site-parts/header.php";
if (!isset($_SESSION["username"])) {
include_once "./site-parts/login-message.php";
include_once "./site-parts/footer-main.php";
exit();
}
include_once "./site-parts/cart-label.php";
?>
<?php
require_once './site-parts/getters.php';
get_jambo("./resources/img/12.jpg", "See your orders", "You can see all the products that you ordered.");
?>
<section class="defalt-container-style" style="overflow: auto;">
<table class="table table-hover table-dark">
<thead>
<tr style="font-size: 10px">
<th scope="col">Order ID</th>
<th scope="col">Product name</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<?php
require_once "./includes/orders.inc.php";
require_once "./includes/db.inc.php";
$results = get_orders($conn);
if ($results) {
while ($row = mysqli_fetch_assoc($results)) {
?>
<tr>
<th>
<span class="badge badge-light">
<?php echo $row["orderId"] ?>
</span>
</th>
<td>
<span class="badge badge-light">
<?php echo $row["productName"] ?>
</span>
</td>
<td>
<?php
if ($row["status"] == "pending") {
echo
'<span class="badge badge-warning">
' . $row["status"] . '
</span>';
} else if ($row["status"] == 1) {
echo
'<span class="badge badge-success">
Complete
</span>';
} else {
echo
'<span class="badge badge-info">
' . $row["status"] . '
</span>';
}
?>
</td>
<td>
<p>
<button class="btn btn-primary btn-sm" type="button" data-toggle="collapse"
data-target="#dis<?php echo $row["orderId"] ?>" aria-expanded="false"
aria-controls="dis<?php echo $row["orderId"] ?>">
Details
</button>
</p>
</td>
</tr>
<tr class="collapse" id="dis<?php echo $row["orderId"] ?>">
<td colspan="5">
<div class="defalt-container-style"
style="margin: 0; width: 100%; display:flex; justify-content:center; align-items:center;">
<table style="width: 100%;">
<tbody>
<tr>
<td>Order Id</td>
<td>
<span class="badge badge-light">
<?php echo $row["orderId"] ?>
</span>
</td>
</tr>
<tr>
<td>Order date</td>
<td>
<span class="badge badge-light">
<?php echo $row["date"] ?>
</span>
</td>
</tr>
<tr>
<td>Product Id</td>
<td>
<span class="badge badge-light">
<?php echo $row["productId"] ?>
</span>
</td>
</tr>
<tr>
<td>Product name</td>
<td>
<span class="badge badge-light">
<?php echo $row["productName"] ?>
</span>
</td>
</tr>
<tr>
<td>Quantity</td>
<td>
<span class="badge badge-dark">
<?php echo $row["quantity"] ?>
</span>
</td>
</tr>
<tr>
<td>Item price</td>
<td>
<span class="badge badge-dark">
<?php echo $row["itemPrice"] ?>
</span>
</td>
</tr>
<tr>
<td>Total price</td>
<td>
<span class="badge badge-dark">
<?php echo ($row["itemPrice"] * $row["quantity"]) ?>
</span>
</td>
</tr>
<tr>
<td>Status</td>
<td>
<?php
if ($row["status"] == "pending") {
echo
'<span class="badge badge-warning">
' . $row["status"] . '
</span>';
} else if ($row["status"] == 1) {
echo
'<span class="badge badge-success">
Complete
</span>';
} else {
echo
'<span class="badge badge-info">
' . $row["status"] . '
</span>';
}
?>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</section>
<?php
include_once "./site-parts/footer-main.php";
?>