-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewOrder.php
232 lines (218 loc) · 8.49 KB
/
viewOrder.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
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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<title>Your Order</title>
<link rel = "icon" href ="img/logo.jpg" type = "image/x-icon">
<style>
.footer {
position: fixed;
bottom: 0;
}
.table-wrapper {
background: #fff;
padding: 20px 25px;
margin: 30px auto;
border-radius: 3px;
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-wrapper .btn {
float: right;
color: #333;
background-color: #fff;
border-radius: 3px;
border: none;
outline: none !important;
margin-left: 10px;
}
.table-wrapper .btn:hover {
color: #333;
background: #f2f2f2;
}
.table-wrapper .btn.btn-primary {
color: #fff;
background: #03A9F4;
}
.table-wrapper .btn.btn-primary:hover {
background: #03a3e7;
}
.table-title .btn {
font-size: 13px;
border: none;
}
.table-title .btn i {
float: left;
font-size: 21px;
margin-right: 5px;
}
.table-title .btn span {
float: left;
margin-top: 2px;
}
.table-title {
color: #fff;
background: #4b5366;
padding: 16px 25px;
margin: -20px -25px 10px;
border-radius: 3px 3px 0 0;
}
.table-title h2 {
margin: 5px 0 0;
font-size: 24px;
}
table.table tr th, table.table tr td {
border-color: #e9e9e9;
padding: 12px 15px;
vertical-align: middle;
}
table.table tr th:first-child {
width: 60px;
}
table.table tr th:last-child {
width: 80px;
}
table.table-striped tbody tr:nth-of-type(odd) {
background-color: #fcfcfc;
}
table.table-striped.table-hover tbody tr:hover {
background: #f5f5f5;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table td a {
font-weight: bold;
color: #566787;
display: inline-block;
text-decoration: none;
}
table.table td a:hover {
color: #2196F3;
}
table.table td a.view {
width: 30px;
height: 30px;
color: #2196F3;
border: 2px solid;
border-radius: 30px;
text-align: center;
}
table.table td a.view i {
font-size: 22px;
margin: 2px 0 0 1px;
}
table.table .avatar {
border-radius: 50%;
vertical-align: middle;
margin-right: 10px;
}
table {
counter-reset: section;
}
.count:before {
counter-increment: section;
content: counter(section);
}
</style>
</head>
<body>
<?php include 'partials/_dbconnect.php';?>
<?php include 'partials/_nav.php';?>
<?php
if($loggedin){
?>
<div class="container">
<div class="table-wrapper" id="empty">
<div class="table-title">
<div class="row">
<div class="col-sm-4">
<h2>Order <b>Details</b></h2>
</div>
<div class="col-sm-8">
<a href="" class="btn btn-primary"><i class="material-icons"></i> <span>Refresh List</span></a>
<a href="#" onclick="window.print()" class="btn btn-info"><i class="material-icons"></i> <span>Print</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover text-center">
<thead>
<tr>
<th>Order Id</th>
<th>Address</th>
<th>Phone No</th>
<th>Amount</th>
<th>Payment Mode</th>
<th>Order Date</th>
<th>Status</th>
<th>Items</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM `orders` WHERE `userId`= $userId";
$result = mysqli_query($conn, $sql);
$counter = 0;
while($row = mysqli_fetch_assoc($result)){
$orderId = $row['orderId'];
$address = $row['address'];
$zipCode = $row['zipCode'];
$phoneNo = $row['phoneNo'];
$amount = $row['amount'];
$orderDate = $row['orderDate'];
$paymentMode = $row['paymentMode'];
if($paymentMode == 0) {
$paymentMode = "Cash on Delivery";
}
else {
$paymentMode = "Online";
}
$orderStatus = $row['orderStatus'];
$counter++;
echo '<tr>
<td>' . $orderId . '</td>
<td>' . substr($address, 0, 20) . '...</td>
<td>' . $phoneNo . '</td>
<td>' . $amount . '</td>
<td>' . $paymentMode . '</td>
<td>' . $orderDate . '</td>
<td><a href="#" data-toggle="modal" data-target="#orderStatus' . $orderId . '" class="view"><i class="material-icons"></i></a></td>
<td><a href="#" data-toggle="modal" data-target="#orderItem' . $orderId . '" class="view" title="View Details"><i class="material-icons"></i></a></td>
</tr>';
}
if($counter==0) {
?><script> document.getElementById("empty").innerHTML = '<div class="col-md-12 my-5"><div class="card"><div class="card-body cart"><div class="col-sm-12 empty-cart-cls text-center"> <img src="https://i.imgur.com/dCdflKN.png" width="130" height="130" class="img-fluid mb-4 mr-3"><h3><strong>You have not ordered any items.</strong></h3><h4>Please order to make me happy :)</h4> <a href="index.php" class="btn btn-primary cart-btn-transform m-3" data-abc="true">continue shopping</a> </div></div></div></div>';</script> <?php
}
?>
</tbody>
</table>
</div>
</div>
<?php
}
else {
echo '<div class="container" style="min-height : 610px;">
<div class="alert alert-info my-3">
<font style="font-size:22px"><center>Check your Order. You need to <strong><a class="alert-link" data-toggle="modal" data-target="#loginModal">Login</a></strong></center></font>
</div></div>';
}
?>
<?php
include 'partials/_orderItemModal.php';
include 'partials/_orderStatusModal.php';
require 'partials/_footer.php';?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-show-password.min.js"></script>
</body>
</html>