-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_list.php
More file actions
87 lines (86 loc) · 2.63 KB
/
Copy pathstudent_list.php
File metadata and controls
87 lines (86 loc) · 2.63 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
<?php include'db_connect.php' ?>
<div class="col-lg-12">
<div class="card card-outline card-primary">
<div class="card-header">
<div class="card-tools">
<a class="btn btn-block btn-sm btn-default btn-flat border-primary " href="./index.php?page=new_student"><i class="fa fa-plus"></i> Add New</a>
</div>
</div>
<div class="card-body">
<table class="table tabe-hover table-bordered" id="list">
<colgroup>
<col width="5%">
<col width="15%">
<col width="25%">
<col width="25%">
<col width="15%">
</colgroup>
<thead>
<tr>
<th class="text-center">#</th>
<th>Student ID</th>
<th>Name</th>
<th>Semester</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$qry = $conn->query("SELECT s.*,concat(c.level,'-',c.section) as class,concat(firstname,' ',middlename,' ',lastname) as name FROM students s inner join classes c on c.id = s.class_id order by concat(firstname,' ',middlename,' ',lastname) asc ");
while($row= $qry->fetch_assoc()):
?>
<tr>
<td class="text-center"><?php echo $i++ ?></td>
<td class=""><b><?php echo $row['student_code'] ?></b></td>
<td><b><?php echo ucwords($row['name']) ?></b></td>
<td><b><?php echo ucwords($row['class']) ?></b></td>
<td class="text-center">
<div class="btn-group">
<a href="index.php?page=edit_student&id=<?php echo $row['id'] ?>" class="btn btn-primary btn-flat ">
<i class="fas fa-edit"></i>
</a>
<button type="button" class="btn btn-danger btn-flat delete_student" data-id="<?php echo $row['id'] ?>">
<i class="fas fa-trash"></i>
</button>
</div>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
<style>
table td{
vertical-align: middle !important;
}
</style>
<script>
$(document).ready(function(){
$('#list').dataTable()
$('.view_student').click(function(){
uni_modal("Student's Details","view_student.php?id="+$(this).attr('data-id'),"large")
})
$('.delete_student').click(function(){
_conf("Are you sure to delete this Student?","delete_student",[$(this).attr('data-id')])
})
})
function delete_student($id){
start_load()
$.ajax({
url:'ajax.php?action=delete_student',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
}
</script>