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

156 lines
6.2 KiB
PHP

<div class="row dash-main-row">
<div class="col-md-10 col-lg-10 p-0">
<ul class="nav nav-pills mb-3 rooms-sections row" id="pills-tab" role="tablist">
<li class="nav-item section-sec col-md-3 p-0">
<a class="nav-link sec-head " href="<?php echo base_url() ?>blocks" role="tab" aria-controls="pills-blocks" aria-selected="true">Blocks</a>
</li>
<li class="nav-item section-sec col-md-3 p-0">
<a class="nav-link sec-head" href="<?php echo base_url() ?>floors" aria-selected="false">Floors</a>
</li>
<li class="nav-item section-sec col-md-3 p-0">
<a class="nav-link sec-head" href="<?php echo base_url() ?>rooms" aria-selected="false">Rooms</a>
</li>
<li class="nav-item section-sec col-md-3 p-0">
<a class="nav-link sec-head active" href="<?php echo base_url() ?>beds" aria-selected="false">Beds</a>
</li>
</ul>
</div>
</div>
<div class="row dash-main-row">
<div class="col-md-12 col-lg-12 p-0">
<?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">
<thead>
<tr>
<th scope="col" class="dash-th">SI.No</th>
<th scope="col" class="dash-th rooms-th">Bed Number</th>
<th scope="col" class="dash-th rooms-th">Room No</th>
<th scope="col" class="dash-th rooms-th">Room Type</th>
<th scope="col" class="dash-th rooms-th">Floor Name</th>
<th scope="col" class="dash-th rooms-th">Block</th>
<th scope="col" class="dash-th rooms-th">Status</th>
<th scope="col" class="dash-th-action">Actions</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>
<?php if($beds_data) { ?>
<?php foreach ($beds_data as $key => $value) {
$link = $value['student_id'] == NULL ? 'javascript:void(0)' : base_url() . 'profile/'.$value['student_id'];
?>
<tr>
<td ><?= $key + 1 ?></td>
<td class="rooms-td"><?= $value['bed_name'] ?></td>
<td class="rooms-td"><?= $value['room_name'] ?></td>
<td class="rooms-td"><?= $value['room_ac'] ?></td>
<td class="rooms-td"><?= $value['floor_name'] ?></td>
<td class="rooms-td"><?= $value['block_name'] ?></td>
<td class="rooms-td"><?= $value['bed_status'] ?></td>
<td class="preview-img">
<a href="<?= $link ?>">
<img class="mr-1" src="<?php echo base_url() ?>assets-hms/images/dashboard/eye-icon.svg" alt="">
</a>
<img onclick ="beddel(<?php echo $value['id'] ?>)" src="<?= base_url() ?>assets-hms/images/dashboard/delete-icon.svg" alt="" data-toggle="modal" data-target="#DeleteRoomsCenter" data-backdrop="static" data-keyboard="false">
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
<!-- Delete Modal -->
<div class="modal fade" id="DeleteRoomsCenter" tabindex="-1" role="dialog" aria-labelledby="DeleteRoomsCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header add-block-header">
<h5 class="modal-title" id="exampleModalLongTitle">Delete Floor</h5>
</div>
<div class="modal-body add-block-body">
<input type="hidden" id="bed_del_id" />
<h6>Are you sure you want to delete ?</h6>
</div>
<div class="modal-footer add-block-footer">
<button type="button" onclick="deletedata($('#bed_del_id').val());" class="btn btn-danger ">Yes</button>
<button type="button" class="btn btn-dark " data-dismiss="modal">No</button>
</div>
</div>
</div>
</div>
</div>
<script>
function beddel(icn){
$('#bed_del_id').val(icn);
}
//
function deletedata(id){
window.location.href = "<?php echo base_url(); ?>HmsAdmin/delete_beds/" + id;
}
$(document).ready(function() {
$('.example').DataTable( {
initComplete: function () {
this.api().columns([1, 2, 3, 4, 5, 6]).every( function () {
var column = this;
var select = $('<select><option value="">Filter</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>