-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
207 lines (197 loc) · 7.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OG Tech - Admin Panel</title>
<?php
include "header.php";
include "static/pages/side_nav.html";
include "static/pages/admin_nav.php";
require_once "includes/class_autoloader.php";
?>
</head>
<body>
<div class="grid" style="margin-top: 100px;">
<div class="grid">
<div style="width: 340px; height: 238px">
<div class="col s12 m6">
<div class="card blue darken-1" style="width: 340px;">
<div class="card-content white-text" style="height: 160px;">
<span class="card-title ">SignUps</span>
<div class="grid">
<i class="material-icons white-text">supervisor_account</i>
<div id="signup">
<?php
$sql = "SELECT * FROM Members";
$conn = new Dbhandler();
$result = $conn->conn()->query($sql) or die($conn->conn()->error);
$signUpCount = $result->num_rows;
?>
<a class='white-text'><?php echo($signUpCount); ?></a>
</div>
</div>
</div>
<div class="card-action left" style="width: 340px;">
<a href="admin_report.php#user">View Report</a>
<a href="admin_manage_users.php">Manage Users</a>
</div>
</div>
</div>
</div>
</div>
<div class="grid">
<div style="width: 340px; height: 238px">
<div class="col s12 m6">
<div class="card amber darken-4" style="width: 340px;">
<div class="card-content white-text" style="height: 160px;">
<span class="card-title ">Products</span>
<div class="grid">
<i class="material-icons white-text">category</i>
<?php
$sql = "SELECT * FROM Items";
$conn = new Dbhandler();
$result = $conn->conn()->query($sql) or die($conn->conn()->error);
$productCount = $result->num_rows;
?>
<p><?php echo($productCount); ?></p>
</div>
</div>
<div class="card-action left" style="width: 340px;">
<a href="admin_report.php#product">View Report</a>
<a href="admin_manage_products.php">Manage Products</a>
</div>
</div>
</div>
</div>
</div>
<div class="grid">
<div style="width: 340px; height: 238px">
<div class="col s12 m6">
<div class="card green darken-1" style="width: 340px;">
<div class="card-content white-text" style="height: 160px;">
<span class="card-title ">Total Orders</span>
<div class="grid">
<i class="material-icons white-text">shopping_cart</i>
<div id="order">
<?php
$sql = "SELECT M.*, O.*, P.* FROM Members M, Orders O, Payment P
WHERE M.PrivilegeLevel = 0 AND P.OrderID = O.OrderID AND M.MemberID = O.MemberID ORDER BY P.PaymentDate DESC";
$conn = new Dbhandler();
$result = $conn->conn()->query($sql) or die($conn->conn()->error);
$orderCount = $result->num_rows;
?>
<a class='white-text'><?php echo($orderCount); ?></a>
</div>
</div>
</div>
<div class="card-action left" style="width: 340px;">
<a href="admin_report.php#order">View Report</a>
<a href="admin_view_orders.php">Manage Orders</a>
</div>
</div>
</div>
</div>
</div>
<div class="grid">
<div style="width: 340px; height: 238px">
<div class="col s12 m6">
<div class="card red lighten-1" style="width: 340px;">
<div class="card-content white-text" style="height: 160px;">
<span class="card-title">Today's Orders</span>
<div class="grid">
<div id="order1">
<?php
$sql = "SELECT M.*, O.*, P.* FROM Members M, Orders O, Payment P
WHERE M.PrivilegeLevel = 0 AND P.OrderID = O.OrderID AND M.MemberID = O.MemberID
AND P.PaymentDate = CURDATE() ORDER BY P.PaymentDate DESC";
$conn = new Dbhandler();
$result = $conn->conn()->query($sql) or die($conn->conn()->error);
$orderCountNew = $result->num_rows;
if ($orderCountNew === 1)
echo("
<a class='btn-floating cyan pulse'><i class='material-icons'>add_shopping_cart</i></a>
<a class='white-text' style='margin-left: 10px'>1 New ~</a>
");
else if ($orderCountNew > 1) echo(
"<a class='btn-floating cyan pulse'><i class='material-icons'>add_shopping_cart</i></a>
<a class='white-text' style='margin-left: 10px'>$orderCountNew</a><a class='white-text bold' style='margin-left: 5px'>New</a>
");
else echo("
<i class='material-icons white-text'>add_shopping_cart</i>
<a class='white-text' style='margin-left: 10px'>$orderCountNew</a>");
?>
</div>
</div>
</div>
<div class="card-action center">
<a href="admin_view_orders.php">Manage</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="container">
<div class="grid">
<div class="rounded-card-parent">
<div class="rounded-card amber darken-2" style="width: 910px">
<div class="card-content white-text">
<table class="responsive-table center" id="pagination">
<thead class="text-primary center">
<tr>
<h5 class="white-text bold" style="padding-bottom: 20px">Product Reviews</h5>
</tr>
</thead>
<tbody>
<?php
$oper = new adminContr;
$oper->showReviews();
?>
</tbody>
</table>
<div class="col-md-12 center text-center">
<span class="left" id="total_reg"></span>
<ul class="pagination pager" id="myPager"></ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
$('#pagination').pageMe({
pagerSelector:'#myPager',
activeColor: 'blue',
prevText:'Previous',
nextText:'Next',
showPrevNext:true,
hidePageNumbers:false,
perPage:3
});
autoSyncTotalOrder();
autoSyncTodayOrder();
autoSyncTotalSignUp();
});
function autoSyncTotalOrder(){
$("#order").load(location.href + " #order", function(){
setTimeout(autoSyncTotalOrder, 3000);
});
}
function autoSyncTodayOrder(){
$("#order1").load(location.href + " #order1", function(){
setTimeout(autoSyncTotalOrder, 3000);
});
}
function autoSyncTotalSignUp(){
$("#signup").load(location.href + " #signup", function(){
setTimeout(autoSyncTotalSignUp, 3000);
});
}
</script>
</html>