BBnepal-Accounts/hostel/application/views/hms-admin/students.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

101 lines
3.5 KiB
PHP

<div class="row dash-main-row students-row">
<div class="col-md-12 col-lg-12 p-0">
<div class="block-head">
<h3 class="dash-tab-head">Students</h3>
</div>
<?php if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('success') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<?php if ($this->session->flashdata('failed')) { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('failed') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<table class="table example dash-table mb-3 text-center">
<thead>
<tr>
<th scope="col" class="dash-th">Student ID</th>
<th scope="col" class="dash-th rooms-th">Student Name</th>
<th scope="col" class="dash-th rooms-th">Class</th>
<th scope="col" class="dash-th rooms-th">Room</th>
<th scope="col" class="dash-th rooms-th">Contact</th>
<th scope="col" class="dash-th rooms-th">Student profile</th>
<th scope="col" class="dash-th rooms-th">Room Status</th>
</tr>
</thead>
<tfoot class="text-center">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
<tbody class="pb-2">
<?php foreach ($students as $key => $value) {
$room = isset($value['room_name']) ? $value['room_name'] : '-';
$assigned = isset($value['room_name']) ? true : false;
?>
<tr>
<td class=""><?= $value['studentId'] ?></td>
<td class="rooms-td"><?= $value['name'] ?></td>
<td class="rooms-td"><?= $value['classroom_name'] ?></td>
<td class="rooms-td"><?= $room ?></td>
<td class="rooms-td"><?= $value['emergency_contact_number'] ?></td>
<td class="student-view"><img src="<?php echo base_url() ?>assets-hms/images/dashboard/user-icon.svg" alt=""><a href="<?php echo base_url() ?>profile/<?= $value['id'] ?>">View</a> </td>
<td class="rooms-td">
<?php if($assigned) { ?>
<a href="<?php echo base_url() ?>assign-students/<?= $value['id'] ?>" class="btn btn-outline-primary student-edit-btn">Edit</a>
<?php } else { ?>
<a href="<?php echo base_url() ?>assign-students/<?= $value['id'] ?>" class="btn btn-primary student-update-btn">Assign</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('.example').DataTable( {
initComplete: function () {
this.api().columns([1, 2, 3]).every( function () {
var column = this;
var select = $('<select><option value="">Choose</option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
} );
})
</script>