-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathadmin.php
241 lines (203 loc) · 6.89 KB
/
admin.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
<?php
$page_title = 'Admin Home Page';
require_once('includes/load.php');
// Checkin What level user has permission to view this page
page_require_level(1);
?>
<?php
$c_categorie = count_by_id('categories');
$c_product = count_by_id('products');
$c_sale = count_by_id('sales');
$c_user = count_by_id('users');
$products_sold = find_higest_saleing_product('10');
$recent_products = find_recent_product_added('5');
$recent_sales = find_recent_sale_added('5')
?>
<?php include_once('layouts/header.php'); ?>
<!-- ************************* -->
<div class="row">
<div class="col-md-6">
<?php echo display_msg($msg); ?>
</div>
</div>
<!-- ************************* -->
<div class="row">
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-green">
<i class="glyphicon glyphicon-user"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_user['total']; ?> </h2>
<p class="text-muted">Users</p>
</div>
</div>
</div>
<!-- ************************* -->
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-red">
<i class="glyphicon glyphicon-list"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_categorie['total']; ?> </h2>
<p class="text-muted">Categories</p>
</div>
</div>
</div>
<!-- ************************* -->
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-blue">
<i class="glyphicon glyphicon-shopping-cart"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_product['total']; ?> </h2>
<p class="text-muted">Products</p>
</div>
</div>
</div>
<!-- ************************* -->
<div class="col-md-3">
<div class="panel panel-box clearfix">
<div class="panel-icon pull-left bg-yellow">
<i class="glyphicon glyphicon-usd"></i>
</div>
<div class="panel-value pull-right">
<h2 class="margin-top"> <?php echo $c_sale['total']; ?></h2>
<p class="text-muted">Sales</p>
</div>
</div>
</div>
<!-- ************************* -->
</div>
<script>
function closePanel()
{
var x = document.getElementById("myDIV");
if (x.style.display === "none")
{
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
<div class="row" id="myDIV">
<div class="col-md-12">
<div class="panel">
<div class="pull-right">
<a href="#" onclick="closePanel();" class="btn btn-xs btn-danger" data-toggle="tooltip" title="Close"><i class="glyphicon glyphicon-remove"></i></a>
</div>
<div class="jumbotron text-center">
<h3>Welcome!</h3>Contact support for additional assistance.
</div>
</div>
</div>
</div>
<!-- ************************* -->
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>Highest Selling Products</span>
</strong>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Title</th>
<th>Total Sold</th>
<th>Total Quantity</th>
<tr>
</thead>
<tbody>
<?php foreach ($products_sold as $product_sold): ?>
<tr>
<td><?php echo remove_junk(first_character($product_sold['name'])); ?></td>
<td><?php echo (int)$product_sold['totalSold']; ?></td>
<td><?php echo (int)$product_sold['totalQty']; ?></td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
</div>
</div>
</div>
<!-- ************************* -->
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>LATEST SALES</span>
</strong>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th class="text-center" style="width: 50px;">#</th>
<th>Product Name</th>
<th>Date</th>
<th>Total Sale</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_sales as $recent_sale): ?>
<tr>
<td class="text-center"><?php echo count_id();?></td>
<td>
<a href="edit_sale.php?id=<?php echo (int)$recent_sale['id']; ?>">
<?php echo remove_junk(first_character($recent_sale['name'])); ?>
</a>
</td>
<td><?php echo remove_junk(ucfirst($recent_sale['date'])); ?></td>
<td>$<?php echo remove_junk(first_character($recent_sale['price'])); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- ************************* -->
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>Recently Added Products</span>
</strong>
</div>
<div class="panel-body">
<div class="list-group">
<?php foreach ($recent_products as $recent_product): ?>
<a class="list-group-item clearfix" href="edit_product.php?id=<?php echo (int)$recent_product['id'];?>">
<h4 class="list-group-item-heading">
<?php if($recent_product['media_id'] === '0'): ?>
<img class="img-avatar img-circle" src="uploads/products/no_image.jpg" alt="">
<?php else: ?>
<img class="img-avatar img-circle" src="uploads/products/<?php echo $recent_product['image'];?>" alt="" />
<?php endif;?>
<?php echo remove_junk(first_character($recent_product['name']));?>
<span class="label label-warning pull-right">
$<?php echo (int)$recent_product['sale_price']; ?>
</span>
</h4>
<span class="list-group-item-text pull-right">
<?php echo remove_junk(first_character($recent_product['category'])); ?>
</span>
</a>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<?php include_once('layouts/footer.php'); ?>