forked from Henry33y/Safo-hall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewRooms.php
79 lines (76 loc) · 2.7 KB
/
viewRooms.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
<?php
$title = 'Rooms Info';
require_once 'includes/session.php';
require_once 'includes/header.php';
require_once 'includes/auth_check.php';
require_once 'includes/db_conn.php';
$results = $crud->getRoomDetails();
?>
<div class="container-xxl w-100">
<div>
<h3 class="my-3 text-center">All Rooms</h3>
</div>
<table id="myTable" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>#</th>
<th>Room Number</th>
<th>Current Students</th>
<th>Maximum Students</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
while($r = $results->fetch(PDO::FETCH_ASSOC)){ ?>
<tr>
<td><?php echo $r['room_id'] ?></td>
<td><?php echo $r['room_number'] ?></td>
<td><?php echo $r['current_students'] ?></td>
<td><?php echo $r['max_students'] ?></td>
<td>
<!-- <a title="View" href="view.php?id=<?php echo $r['id'] ?>" class="btn btn-primary"><i class="bi bi-eye-fill"></i></a> -->
<a title="Edit" href="editRoom.php?no=<?php echo $r['room_number'] ?>" class="btn btn-success">Edit<i class="ms-2 bi bi-pencil-square"></i></a>
<!-- <a title="Delete" onclick="return confirm('Are you sure you want to delete this record? This action cannot be reversed.')" href="delete.php?id=<?php echo $r['id'] ?>" class="btn btn-danger"><i class="bi bi-trash3-fill"></i></a> -->
</td>
</tr>
<?php
} ?>
</tbody>
</table>
</div>
<script>
$(document).ready( function () {
$('#myTable').DataTable({
responsive: true,
rowReorder: {
selector: 'td:nth-child(2)'
},
dom: 'Bfrtip',
buttons: [
{
extend: 'collection',
text: 'Options',
className: 'custom-html-collection',
buttons: [
'<h3>Export</h3>',
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL'
},
'csv',
'excel',
'<h3 class="not-top-heading">Column Visibility</h3>',
{
extend: 'colvis',
collectionLayout: 'fixed columns',
collectionTitle: 'Column visibility control'
}
]
}
]
});
} );
</script>
<?php require_once 'includes/footer.php' ?>