bbone/application/modules/Expence/views/emp_expence_list.php
2023-07-21 17:12:54 +05:30

210 lines
6.7 KiB
PHP

<head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
<style>
/* Modal Popup Styles */
.modal {
display: none; /* Hide the modal by default */
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.9);
}
.modal img {
display: block;
margin: 0 auto;
max-width: 80%;
max-height: 100%;
margin-top: 5%;
margin-bottom: 5%;
}
.close {
color: #fff;
font-size: 40px;
font-weight: bold;
position: absolute;
top: 10px;
right: 20px;
cursor: pointer;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important; //search to up
}
.alert-success {
background-color: #dff0d8;
color: #3c763d;
border-color: #d6e9c6;
}
.flash-message {
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
margin-left: 690px;
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Submmited for Approvel.<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('Create');?>" >
<?php $this->session->unset_userdata('Create');?>
<script>
$(document).ready(function(){
if($('#error').val() == 1 )
{
$('#button').click();
}
})
</script>
<ul class="nav navbar-right panel_toolbox">
<a href="<?php echo base_url();?>Expence/expence_form" class="btn btn-sm btn-primary" style="margin-top: 20px;">New Claim</a>
<?php if(is_user() || user()->role == null) { ?>
<a href="<?php echo base_url();?>Expence/manager_approvel_list" class="btn btn-sm btn-warning" style="margin-top: 20px;">My Approval</a>
<?php } ?>
<?php if(is_admin()) { ?>
<a href="<?php echo base_url();?>Expence/expence_list" class="btn btn-sm btn-warning" style="margin-top: 20px;">My Approval</a>
<?php }?>
</ul>
<h1>Expense Claims</h1>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th hidden class="column-title">id</th>
<th class="column-title">Claim Date </th>
<th class="column-title">Desription</th>
<th class="column-title">Expense Date</th>
<th class="column-title">Expense Cost(₹)</th>
<th class="column-title">Status </th>
<th class="column-title">Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<?php if(user()->id == $value->emp_id) { ?>
<tr class="even pointer">
<td hidden class=" "><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time;?></td>
<td class=" "><?php echo $value->comments; ?></td>
<td class=" "> <?php echo dateFormat('d-m-Y',$value->date_of_expence);?></td>
<td class=" ">₹ <?php echo $value->amount; ?></td>
<?php if($value->status == 'pending'){ ?>
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at; ?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> <br> <?php echo $value->Dreason; ?></td>
<?php }
else if($value->status == 'canceled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?></td>
<?php }
else{
}?>
<td style=" text-align: center; font-size: 16px;">
<?php if(!empty($value->bill)) { ?>
<a onclick="openModal('<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>')" title="ViewBill"><i class="fa fa-eye" aria-hidden="true"></i></a><br>
<?php } ?>
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Expence/edit_expence')?>?id=<?php echo md5($value->id);?> "><i class="fa fa-edit" aria-hidden="true"title="Edit"></i></a> &nbsp;
<a href="<?php echo base_url('Expence/cancled_expence')?>?id=<?php echo md5($value->id);?> "><i class="fa fa-ban" aria-hidden="true"title="Cancel"></i></a> &nbsp;
<?php } ?>
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<br/>
<div class="modal fade bs-example-modal-lg" id="ItemModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
<div class="modal bs-example-modal-sm" tabindex="-1" role="dialog" aria-hidden="true" id="popup"> </div>
<div id="myModal" class="modal">
<span class="close">&times;</span>
<img id="modalImage" src="" alt="Image">
</div>
<!-- JavaScript -->
<script>
function openModal(itemId) {
// Get the image URL for the item with the specified ID
var imageUrl = itemId;
// Set the image source of the modal
document.getElementById("modalImage").src = imageUrl;
// Open the modal
var modal = document.getElementById("myModal");
modal.style.display = "block";
// Close the modal when the user clicks on the close button
var closeButton = document.getElementsByClassName("close")[0];
closeButton.onclick = function() {
modal.style.display = "none";
}
}
</script>
<script>
$(document).ready(function() {
$('#datatables').DataTable({
"order": [[0, 'desc']], // Set initial sorting to descending on the first column
"dom": 'Bfrtip', // Show export buttons
"buttons": [ 'excel', 'pdf'], // Enable export options
"language": {
"search": "Search: " // Customize search label
}
});
});
</script>