-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
194 lines (181 loc) · 6.42 KB
/
admin.php
File metadata and controls
194 lines (181 loc) · 6.42 KB
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
<?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);
$popular_products = find_popular_products(5);
$recent_products = find_recent_product_added(5);
$recent_sales = find_recent_sale_added(5);
$recent_sales = find_recent_sales(5);
?>
<?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'); ?>
<!-- /* -------------DASHBOARD CARD BOX ----------- */ -->
<div class="dBoxMain">
<a href="users.php" class="dBoxWrap">
<div class="dBox">
<img src="libs/logos/card-logos/user.png" alt="icon">
<div class="dBoxRight">
<h2 class="text-muted">Users</h2>
<p>
<?php echo $c_user['total']; ?>
</p>
</div>
</div>
</a>
<a href="categorie.php" class="dBoxWrap">
<div class="dBox">
<img src="libs/logos/card-logos/categories.png" alt="icon">
<div class="dBoxRight">
<h2 class="text-muted">Categories</h2>
<p>
<?php echo $c_categorie['total']; ?>
</p>
</div>
</div>
</a>
<a href="product.php" class="dBoxWrap">
<div class="dBox">
<img src="libs/logos/card-logos/products.png" alt="icon">
<div class="dBoxRight">
<h2 class="text-muted">Products</h2>
<p>
<?php echo $c_product['total']; ?>
</p>
</div>
</div>
</a>
<a href="usages.php" class="dBoxWrap">
<div class="dBox">
<img src="libs/logos/card-logos/active.png" alt="icon">
<div class="dBoxRight">
<h2 class="text-muted">Active</h2>
<p>
<?php echo $c_sale['total']; ?>
</p>
</div>
</div>
</a>
</div>
<!-- /* -------------DASHBOARD MAIN TABLE ----------- */ -->
<div class="tableMain">
<div class="tableMainWrap">
<div class="tableHeader">
<img src="libs/logos/table-logo/active.png" alt="">
<span>Most Using Items</span>
</div>
<div class="tableBody">
<table class="tableBodyWrap">
<thead>
<tr>
<th>#</th>
<th>Item Name</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<?php
$most_used_items = find_popular_products(5); // Use the function to fetch the top 5 most popular items
$serial = 1;
foreach ($most_used_items as $item):
?>
<tr>
<td>
<?php echo $serial++; ?>
</td>
<td>
<?php echo remove_junk($item['name']); ?>
</td>
<td>
<?php echo (int) $item['quantity']; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="tableMainWrap">
<div class="tableHeader">
<img src="libs/logos/table-logo/deactive.png" alt="">
<span>Recent Inactive</span>
</div>
<div class="tableBody">
<table class="tableBodyWrap">
<thead>
<tr>
<th>Product Name</th>
<th>Date</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_sales as $recent_sale): ?>
<tr>
<td>
<?php echo remove_junk(first_character($recent_sale['name'])); ?>
</td>
<td>
<?php
$formattedDate = date("d-m-Y", strtotime($recent_sale['date'])); // Format date as dd-mm-yyyy
echo remove_junk($formattedDate);
?>
</td>
<td>
<?php echo (int) $recent_sale['qty']; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="tableMainWrap">
<div class="tableHeader">
<img src="libs/logos/table-logo/product.png" alt="">
<span>Recently Added</span>
</div>
<div class="tableBody">
<table class="tableBodyWrap">
<thead>
<tr>
<th>Product Name</th>
<th>Date</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_sales as $recent_sale): ?>
<tr>
<td>
<?php echo remove_junk(first_character($recent_sale['name'])); ?>
</td>
<td>
<?php
$formattedDate = date("d-m-Y", strtotime($recent_sale['date'])); // Format date as dd-mm-yyyy
echo remove_junk($formattedDate);
?>
</td>
<td>
<?php echo (int) $recent_sale['qty']; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<?php include_once('layouts/footer.php'); ?>