-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplications.php
428 lines (367 loc) · 16.2 KB
/
applications.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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<?php
session_start();
$hostel = $_SERVER["QUERY_STRING"];
if($hostel == null){
header("location:Hostels.php");
}else{
$con = mysqli_connect("localhost","root","");
if(!$con){
die('Connection Failed'.mysqli_error($con));
}
mysqli_select_db($con,"hmdata");
$query2 = mysqli_query($con,"Select * from bookings where hostelId = $hostel");
$count_book = mysqli_num_rows($query2);
$query3 = mysqli_query($con, "select * from bookings where hostelId = $hostel AND Status = 0");
$count_disapprove = mysqli_num_rows($query3);
$query4 = mysqli_query($con,"select * from bookings where hostelId = $hostel AND Status = 1");
$count_approve = mysqli_num_rows($query4);
$esi = mysqli_query($con,"select Gender,AllocatedRoomNumber,HostelName,NoOfRooms,BedSpace,AllocatedBedSpace from hostels where HostelNameId = $hostel")or die('Connection Failed1'.mysqli_error($con));
$rows = mysqli_fetch_array($esi, MYSQLI_ASSOC);
$Hostel_name = $rows["HostelName"];
$bedSpace_left = $rows["BedSpace"] - $rows["AllocatedBedSpace"];
$AllocatedBedSpace =$rows["AllocatedBedSpace"];
$Total_BedSpace = $rows["BedSpace"];
$Current_Room = $rows["AllocatedRoomNumber"];
$Rooms_left = $rows["NoOfRooms"] - $rows["AllocatedRoomNumber"];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Admin | Applications </title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<link rel="shortcut icon" href="img/favicon.ico"/>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<!-- global css -->
<link type="text/css" href="css/app.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="css/custom.css">
<link rel="stylesheet" href="css/bootstrap-table.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap_tables.css">
<!-- end of global css -->
</head>
<body class="skin-coreplus">
<div class="preloader">
<div class="loader_img"><img src="preloader.gif" alt="loading..." height="64" width="64"></div>
</div>
<!-- header logo: style can be found in header-->
<header class="header">
<nav class="navbar navbar-static-top" role="navigation">
<a href="index-2.html" class="logo">
<!-- Add the class icon to your logo <img src="logo.jpg" alt="logo" style="width:230px;height:89px;"/> image or logo icon to add the margining -->
</a>
<!-- Header Navbar: style can be found in header-->
<!-- Sidebar toggle button-->
<!-- Sidebar toggle button-->
<div>
<a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button"> <i
class="fa fa-fw fa-bars"></i>
</a>
</div>
<div class="navbar-right">
<ul class="nav navbar-nav">
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i
class="fa fa-fw fa-check -o black fa-2x"></i>
<span class="label label-success"><?php echo $count_approve; ?></span>
</a>
</li>
<!--tasks-->
<li class="dropdown tasks-menu hidden-xs">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-fw fa-edit black fa-2x"></i>
<span class="label label-primary"><?php echo $count_book; ?></span>
</a>
</li>
<!-- Notifications: style can be found in dropdown-->
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-fw fa-remove fa-2x"></i>
<span class="label label-warning"><?php echo $count_disapprove; ?></span>
</a>
</li>
<!-- User Account: style can be found in dropdown-->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle padding-user" data-toggle="dropdown">
<img src="avatar1.png" width="35" class="img-circle img-responsive pull-left"
height="35" alt="User Image">
<div class="riot">
<div>
<?php echo $_SESSION['AdminName'];?>
<span>
<i class="caret"></i>
</span>
</div>
</div>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="avatar1.png" class="img-circle" alt="User Image">
<p><?php echo $_SESSION['AdminName'];?></p>
</li>
<!-- Menu Body -->
</li>
<li role="presentation"></li>
<li><a href="edit_user.html"> <i class="fa fa-fw fa-gear"></i> Account Settings </a></li>
<li role="presentation" class="divider"></li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-right">
<a href="Adminlogout.php">
<i class="fa fa-fw fa-sign-out"></i>
Logout
</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<div class="wrapper row-offcanvas row-offcanvas-left">
<!-- Left side column. contains the logo and sidebar -->
<aside class="left-side sidebar-offcanvas">
<!-- sidebar: style can be found in sidebar-->
<section class="sidebar">
<div id="menu" role="navigation">
<div class="nav_profile">
<div class="media profile-left">
<a class="pull-left profile-thumb" href="#">
<img src="avatar1.png" class="img-circle" alt="User Image">
</a>
<div class="content-profile">
<h4 class="media-heading">
<?php echo $_SESSION['AdminName'];?>
</h4>
<ul class="icon-list">
<li>
<a href="adminlogout.php">
<i class="fa fa-fw fa-sign-out"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<ul class="navigation">
<li>
<a href="hostels.php">
<i class="menu-icon fa fa-fw fa-home"></i>
<span class="mm-text ">DASHBOARD</span>
</a>
</li>
<li>
<a href="applications.php?1">
<i class="menu-icon fa fa-fw fa-chain"></i>
<span class="mm-text ">JIBOWU</span>
</a>
</li>
<li>
<a href="applications.php?6">
<i class="menu-icon fa fa-fw fa-database"></i>
<span class="mm-text ">AKINDẸKO</span>
</a>
</li>
<li>
<a href="applications.php?3">
<i class="menu-icon fa fa-fw fa-user"></i>
<span class="mm-text ">ABIOLA</span>
</a>
</li>
<li>
<a href="applications.php?4">
<i class="menu-icon fa fa-fw fa-lock"></i>
<span class="mm-text ">JADESOLA</span>
</a>
</li>
<li>
<a href="applications.php?2">
<i class="menu-icon fa fa-fw fa-eye"></i>
<span class="mm-text ">ADENIYI</span>
</a>
</li>
<li>
<a href="applications.php?5">
<i class="menu-icon fa fa-fw fa-tachometer"></i>
<span class="mm-text ">JIBOWU ANNEX</span>
</a>
</li>
</ul>
</ul>
<!-- / .navigation -->
</div>
<!-- menu -->
</section>
<!-- /.sidebar -->
</aside>
<aside class="right-side">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>Blank</h1>
<ol class="breadcrumb">
<li>
<a href="hostels.php">
<i class="fa fa-fw fa-home"></i> Dashboard
</a>
</li>
<li> Applications</li>
<li class="active">
<a href=""><?php echo $Hostel_name ?></a>
</li>
</ol>
</section>
<!-- Main content -->
<div class="row col-md-8">
<div class="">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title" style="margin-left:100px;">
<center> <i class="fa fa-fw fa-home"></i><?php echo $Hostel_name ?></center>
</h3>
<span class="pull-right">
<i class="fa fa-fw fa-chevron-up clickable"></i>
<i class="fa fa-fw fa-times removepanel clickable"></i>
</span>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="">
<tbody>
<thead><tr> <th>STUDENT NAME</th><th>MATRIC NUMBER</th><th>DEPARTMENT</th><th>LEVEL</th><th>ACTIONS</th></tr></thead><tbody>
<?php
$result = mysqli_query($con,"select BookersId from bookings where HostelId = $hostel AND Status =0 OR hostelId = $hostel AND Status =3")or die('Connection Failed'.mysqli_error($con));
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$num = $row["BookersId"];
$retVal = mysqli_query($con,"SELECT StudentId,StudentName,Level,MatricNumber,dept from Student_table where StudentId ='$num'") or die('Connection 2 failed'.mysqli_error($con));
$rows = mysqli_fetch_array($retVal, MYSQLI_ASSOC);
$html ='<tr><td>'.$rows["StudentName"].'</td><td>'.$rows["MatricNumber"].'</td><td>'.$rows["dept"].'</td><td>'.$rows["Level"].'</td><td><a id='.$rows["StudentId"].' class="button btn btn-primary" Value="Approve">Approve</a>|<a id='.$rows["StudentId"].' class="button btn btn-danger" Value="Disapprove">Disapprove</a></input></td></tr>';
echo $html;
}
if(!isset($num)){
echo '<center><h3 style="margin-left:72px;"><em><strong>No Student Appplied Yet.</strong></em></h3></center>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row col-md-4">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title" style="margin-left:115px;">
<i class="fa fa-fw fa-home"></i><?php echo $Hostel_name ?>'s Status
</h3>
<span class="pull-right">
<i class="fa fa-fw fa-chevron-up clickable"></i>
<i class="fa fa-fw fa-times removepanel clickable"></i>
</span>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>
<strong>TOTAL BEDSPACE</strong>
</th>
<th>
<strong><?php echo $Total_BedSpace; ?></strong>
</th>
</tr>
<tr>
<th>
<strong>ALLOCATED BEDSPACE</strong>
</th>
<th>
<strong><?php echo $AllocatedBedSpace; ?></strong>
</th>
</tr>
<tr>
<th>
<strong>BEDSPACE LEFT</strong>
</th>
<th>
<strong><?php echo $bedSpace_left; ?></strong>
</th>
</tr>
<tr>
<th>
<strong>ROOMS LEFT</strong>
</th>
<th>
<strong><?php echo $Rooms_left; ?></strong>
</th>
</tr>
<tr>
<th>
<strong>ALLOCATED ROOMS</strong>
</th>
<th>
<strong><?php echo $Current_Room; ?></strong>
</th>
</tr>
</table>
</div>
</div>
</div>
<section class="content p-l-r-15">
<div id="right">
</div>
</div>
</section>
<!-- /.content -->
</aside>
<!-- /.right-side -->
</div>
<!-- /.right-side -->
<!-- ./wrapper -->
<!-- global js -->
</body>
<script src="js/app.js" type="text/javascript"></script>
<script src="material.min.js" type="text/javascript"></script>
<script src="js/toastr_notifications.js" type="text/javascript"></script>
<script src="js/toastr.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script>
$(".btn-primary").click(function (){
var val="<?php echo $hostel;?>";
var d = $(this).prop("id");
//alert(d);
$.ajax({
type:"POST",
url:"prequest.php",
data:{bookersId:d,hostelId:val,myid:1}
}).done(function(msg){
if(msg == "Hostel Approved"){
location.reload(true);
toastr["success"](msg + " Refresh to see changes!");
}else{
toastr["error"](msg);
}
})
});
$(".btn-danger").click(function (){
var val="<?php echo $hostel;?>";
var d = $(this).prop("id");
//alert(d);
$.ajax({
type:"POST",
url:"prequest.php",
data:{bookersId:d,hostelId:val,myid:2}
}).done(function(msg){
toastr["success"](msg);
})
});
</script>
<!-- Mirrored from dev.lorvent.com/core_plus/blank.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 16 Dec 2016 09:55:10 GMT -->
</html>