BBnepal-Accounts/library/application/views/lms-admin/dashboard.php

185 lines
9.6 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<main class="common_margin" id="main">
<div class="main-wrap">
<div class="dashboard-cover">
<div class="common-heading">
<h2>DashBoard</h2>
<!--<div class="dashboard-btn-wrap">-->
<!-- <button class="btn btn-success btn-sm">Issue Book</button>-->
<!-- <button class="subject_addbtn">Receive Book</button>-->
<!--</div>-->
</div>
<div class="dashboard-tabs-wrap">
<div class="dashboard-tabs" onclick="showBook()">
<div class="tab-info">
<h3><?= $ttlData['ttl_books']; ?></h3>
<h5>Total <br> Books</h5>
</div>
<div class="tab-img">
<img src="<?php echo base_url(); ?>assets-lms/images/total-books.png">
</div>
</div>
<div class="dashboard-tabs" onclick="showIssuedBook()">
<div class="tab-info">
<h3><?= $ttlData['ttl_issed_book']; ?></h3>
<h5>Issued <br> Books</h5>
</div>
<div class="tab-img">
<img src="<?php echo base_url(); ?>assets-lms/images/issued-books.png">
</div>
</div>
<div class="dashboard-tabs" onclick="showReturnedBook()">
<div class="tab-info">
<h3><?= $ttlData['ttl_late_fee']; ?></h3>
<h5>Late <br> Dues</h5>
</div>
<div class="tab-img">
<img src="<?php echo base_url(); ?>assets-lms/images/late-dues.png">
</div>
</div>
<div class="dashboard-tabs" onclick="showDamagedBook()">
<div class="tab-info">
<h3><?= $ttlData['ttl_damaged_book']; ?></h3>
<h5>Damaged <br> Books</h5>
</div>
<div class="tab-img">
<img src="<?php echo base_url(); ?>assets-lms/images/damaged-books.png">
</div>
</div>
</div>
<div class="subject_r">
<div class="subject_rsec">
<div class="subject_lhead">Recently Issued Books <a href="<?= base_url(); ?>issued-books" class="dashboardLink">View more</a></div>
<div class="">
<table id="tbl" class="display dataTable table-responsive">
<thead>
<tr>
<th>Book Name</th>
<th>Student Name</th>
<th>Contact</th>
<th>Issued Date</th>
<th>Remaining Days</th>
<th>Over Due</th>
</tr>
</thead>
<tbody>
<?php if(isset($recentlyIssuedBook) && !empty($recentlyIssuedBook)){ foreach($recentlyIssuedBook as $ridata){
$book_name = $this->db->get_where('lms_books', ['id'=> $ridata['book_id']])->row_array();
$stdIs = $ridata['eu_unique_id'];
$eu_name = $this->LmsAdmin_Model->getStudentDataById($stdIs);
$name=''; $mobile='';
if($eu_name)
{
$name = $eu_name['name'];
$mobile = $eu_name['mobile'];
}
//calculating of remaining days
$today = date('Y-m-d');
$remdays_diff = strtotime($ridata['return_date'])-strtotime($today);
$remaining_days = round($remdays_diff / 86400);
if($remaining_days<0)
{
$remaining_days = 0;
}
//calculating of over due days
$oddays = 0; $class='';
$overdue_diff = strtotime($today)-strtotime($ridata['return_date']);
$overdue_days = round($overdue_diff / 86400);
if($overdue_days>$remaining_days){
$oddays = $overdue_days;
$class = 'class="due"';
}
$issDateObj = new DateTime($ridata['issued_date']);
$issueDate = $issDateObj->format('Y-m-d');
$todayDateObj = new DateTime($npCurrDate);
$todayIs = $todayDateObj->format('Y-m-d');
$retDateObj = new DateTime($ridata['return_date']);
$returnDate = $retDateObj->format('Y-m-d');
$remDaysClass='';
$date1 = date_create($todayIs);
$date2 = date_create($returnDate);
$remaining_days = $date1->diff($date2)->format("%r%a");
if($remaining_days == 0){
$remaining_days = 'Due Today';
$remDaysClass='due';
}
else if($remaining_days < 0)
$remaining_days = '0 Days';
else
$remaining_days = $remaining_days.' Days';
$class=''; $over_due_days=0;
$date11 = date_create($returnDate);
$date22 = date_create($todayIs);
$over_due_days = $date11->diff($date22)->format("%r%a");
if($over_due_days > 0)
$class = 'class="due"';
if($over_due_days < 0)
$over_due_days = 0;
?>
<tr>
<td><?= $book_name['title']; ?></td>
<td><?= $name; ?></td>
<td><?= $mobile; ?></td>
<td><?= $issDateObj->format(DATE_FORMAT); ?></td>
<td><?= $remaining_days; ?></td>
<td <?= $class; ?> ><?= $over_due_days; ?> Days</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</main>
<!--End right-top side-->
</div>
<!-- <script src="<?php echo base_url(); ?>assets-lms/js/jquery-3.2.1.slim.min.js"></script> -->
<script src="<?php echo base_url(); ?>assets-lms/js/jquery-3.4.1.min.js" ></script>
<script src="<?php echo base_url(); ?>assets-lms/js/popper.min.js"></script>
<script src="<?php echo base_url(); ?>assets-lms/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
<script defer src="<?php echo base_url(); ?>assets-lms/js/all.js"></script>
<script defer src="<?php echo base_url(); ?>assets-lms/js/main.js"></script>
<script src="<?php echo base_url(); ?>assets-lms/owl-carousel/js/owl.carousel.min.js"></script>
<script>
$(document).ready(function(){
$('.user-drpdown').click(function(){
$('.drpdown-items').toggle();
});
});
//table js
$('#tbl').DataTable( {
"lengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]]
} );
//table js end
</script>
<script>
function showBook()
{
window.location.href="<?= base_url(); ?>books";
}
function showIssuedBook()
{
window.location.href="<?= base_url(); ?>issued-books";
}
function showReturnedBook()
{
window.location.href="<?= base_url(); ?>returned-books";
}
function showDamagedBook()
{
window.location.href="<?= base_url(); ?>damaged-books";
}
</script>
</body>
</html>