-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.php
282 lines (243 loc) · 12.2 KB
/
index.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?php
include('include/header.php');
if(!isset($_SESSION['email'])){
header('location:signin.php');
}
if(isset($_SESSION['email'])){
$email = $_SESSION['email'];
}
?>
<div class="container-fluid mt-2">
<div class="row">
<!---sidenavbar Column-->
<div class="col-md-3 col-lg-3">
<?php require_once('include/sidebar.php'); ?>
</div>
<!---Main Column -->
<div class="col-md-9 col-lg-9">
<!-- Icon Cards-->
<div class="row">
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card text-white bg-success o-hidden h-100">
<div class="card-body">
<div class="card-body-icon">
<i class="fad fa-shopping-cart fa-2x" ></i>
</div>
<?php
$query = "SELECT * FROM customer_order WHERE order_status='pending'";
$run = mysqli_query($con,$query);
$num_new_orders = mysqli_num_rows($run);
?>
<div class="mr-5"> <span style="font-size:24px;"><?php echo $num_new_orders;?></span> Pending Orders</div>
</div>
<a class="card-footer text-white clearfix small z-1" href="pending_furniture_pro.php">
<span class="float-left">View Details</span>
<span class="float-right">
<i class="fas fa-angle-right"></i>
</span>
</a>
</div>
</div>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card text-white bg-warning o-hidden h-100">
<div class="card-body">
<div class="card-body-icon">
<i class="fad fa-truck fa-2x"></i>
</div>
<div class="mr-5">
<?php
$query = "SELECT * FROM customer_order WHERE order_status='delivered'";
$run = mysqli_query($con,$query);
$num_delivered_orders = mysqli_num_rows($run);
?>
<span style="font-size:24px;"><?php echo $num_delivered_orders;?> </span> Delivered Orders</div>
</div>
<a class="card-footer text-white clearfix small z-1" href="delivered_furniture_pro.php">
<span class="float-left">View Details</span>
<span class="float-right">
<i class="fas fa-angle-right"></i>
</span>
</a>
</div>
</div>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card text-white bg-primary o-hidden h-100">
<div class="card-body">
<div class="card-body-icon">
<i class="fad fa-fw fa-users fa-2x"></i>
</div>
<div class="mr-5">
<?php
$query = "SELECT * FROM customer";
$run = mysqli_query($con,$query);
$num_customer = mysqli_num_rows($run);
?>
<span style="font-size:24px;"><?php echo $num_customer;?></span> Active Customers
</div>
</div>
<a class="card-footer text-white clearfix small z-1" href="customers.php">
<span class="float-left">View Details</span>
<span class="float-right">
<i class="fas fa-angle-right"></i>
</span>
</a>
</div>
</div>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card text-white bg-danger o-hidden h-100">
<div class="card-body">
<div class="card-body-icon">
<i class="fad fa-sack fa-2x"></i>
</div>
<div class="mr-5">
<?php
$query = "SELECT SUm(product_amount) as 'earn' FROM customer_order";
$run = mysqli_query($con,$query);
$row=mysqli_fetch_array($run);
$earning = $row['earn'];
?>
<span style="font-size:24px;"><?php echo $earning; ?></span> PKR Earned
</div>
</div>
<a class="card-footer text-white clearfix small z-1" href="#">
<span class="float-left">View Details</span>
<span class="float-right">
<i class="fas fa-angle-right"></i>
</span>
</a>
</div>
</div>
</div>
<!-- DataTables Example -->
<h3 class="mt-5">New Orders</h3>
<table class="table table-responsive table-hover mt-3">
<thead class="thead-light">
<tr>
<th>#Invoice No.</th>
<th>Order ID</th>
<th>Product_id</th>
<th>Product Image</th>
<th>Product Category</th>
<th>Customer Id</th>
<th>Customer Email</th>
<th>Price (Pkr)</th>
<th>Quantity</th>
<th>Order Date</th>
<th>Verify Order</th>
</tr>
</thead>
<tbody class="text-center">
<?php
$order_query = "SELECT * FROM customer_order WHERE order_status='pending' ORDER BY order_id LIMIT 5";
$run = mysqli_query($con,$order_query);
if(mysqli_num_rows($run) > 0){
while($order_row = mysqli_fetch_array($run)){
$order_invoice = $order_row['invoice_no'];
$order_id = $order_row['order_id'];
$cust_id = $order_row['customer_id'];
$cust_email = $order_row['customer_email'];
$order_pro_id = $order_row['product_id'];
$order_qty = $order_row['products_qty'];
$order_amount = $order_row['product_amount'];
$order_date = $order_row['order_date'];
$order_status = $order_row['order_status'];
$pr_query = "SELECT * FROM furniture_product fp INNER JOIN categories cat ON fp.category = cat.id WHERE pid = $order_pro_id ";
$pr_run = mysqli_query($con,$pr_query);
if(mysqli_num_rows($pr_run) > 0){
while($pr_row = mysqli_fetch_array($pr_run)){
$pid = $pr_row['pid'];
$image = $pr_row['image'];
$category = $pr_row['category'];
?>
<tr>
<td>
<?php echo $order_invoice;?>
</td>
<td>
<?php echo $order_id;?>
</td>
<td>
<?php echo $order_pro_id;?>
</td>
<td width="120px">
<img src="img/<?php echo $image;?>" width="100%">
</td>
<td>
<?php echo $category;?>
</td>
<td>
<?php echo $cust_id;?>
</td>
<td>
<?php echo $cust_email;?>
</td>
<td>
<?php echo $order_amount;?>
</td>
<td><?php echo $order_qty;?></td>
<td><?php echo $order_date;?></td>
<td><a href="pending_furniture_pro.php"><button class="btn btn-primary btn-sm">Verify order</button></td>
</tr>
<?php
}
}
}
}else {
echo "<tr><td colspan='12'><h2 class='text-center text-secondary'>You have not any pending order</h2></td></tr>";
}
?>
</tbody>
</table>
<h3 class="mt-5">Customers Account</h3>
<table class="table table-responsive table-hover mt-3">
<thead class="thead-light">
<tr>
<th>#Id</th>
<th>Name</th>
<th>Email</th>
<th>City</th>
<th>Postal code</th>
<th>View Complete</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * FROM customer ORDER BY cust_id DESC LIMIT 5";
$run = mysqli_query($con,$query);
if(mysqli_num_rows($run) > 0){
while($row = mysqli_fetch_array($run)){
$cust_id = $row['cust_id'];
$cust_name = $row['cust_name'];
$cust_email = $row['cust_email'];
$cust_city = $row['cust_city'];
$cust_postalcode = $row['cust_postalcode'];
?>
<tr>
<td >
<?php echo $cust_id;?>
</td>
<td width="150px">
<?php echo $cust_name;?>
</td>
<td>
<?php echo $cust_email;?>
</td>
<td>
<?php echo $cust_city ?>
</td>
<td><?php echo $cust_postalcode;?></td>
<td><a href="customers.php"><button class="btn btn-primary btn-sm">View Detail</button></td>
</tr>
<?php
}
}else {
echo "<tr><td colspan='12'><h2 class='text-center text-secondary'>No Registered Customer Yet</h2></td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.container-fluid -->
<?php include('include/footer.php');?>