-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin.php
178 lines (170 loc) · 5.88 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
<?php
$page_title = 'Admin página de inicio';
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">Usuarios</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">Categorías</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">Productos</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">Ventas</p>
</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>Productos más vendidos</span>
</strong>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Título</th>
<th>Total vendido</th>
<th>Cantidad total</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>ÚLTIMAS VENTAS</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>Producto</th>
<th>Fecha</th>
<th>Venta total</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>Productos recientemente añadidos</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['categorie'])); ?>
</span>
</a>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<?php include_once('layouts/footer.php'); ?>