bbone/application/modules/Expence/views/emp_expence_list.php
2024-01-17 10:55:20 +05:30

268 lines
9.2 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;
}
.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 Approval.<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/expence_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>
<h3>Expense Claims</h3>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr class="headings">
<th hidden class="column-title">id</th>
<th class="column-title">Claim Date</th>
<th class="column-title">Expense Name</th>
<th class="column-title">Business Reason</th>
<th class="column-title">Total Amount(₹)</th>
<th class="column-title">No of List</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->requested_for) { ?>
<tr class="even pointer">
<td hidden><?php echo $value->id; ?></td>
<td><?php echo date('d-m-Y', strtotime($value->created_on));?>
<td class=" "><?php echo $value->expense_name; ?></td>
<td class=" "><?php echo $value->business_reason; ?></td>
<?php foreach ($count_amount as $key => $count_value) { ?>
<?php if($value->id == $count_value->id) { ?>
<td class=" ">₹<?php echo $count_value->amount ?></td>
<td class=" "><?php echo $count_value->count ?></td>
<?php } } ?>
<?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 date('d-m-Y h:i:s', strtotime($value->approved_at));?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
<?php }
else if($value->status == 'Cancelled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo date('d-m-Y h:i:s', strtotime($value->cancelled_at));?></td>
<?php }
else if($value->status == 'Draft'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php } else if($value->status == 'Partially approved'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php } ?>
<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 != 'Draft') { ?>
<a href="<?php echo base_url()?>Expence/edit_expence/<?php echo md5($value->id);?>"><i class="fa fa-list-alt" aria-hidden="true"title="View List"></i></a> &nbsp;
<?php } ?>
<?php if( $value->status == 'Draft') { ?>
<a href="<?php echo base_url()?>Expence/edit_expence/<?php echo md5($value->id);?> "><i class="fa fa-edit" aria-hidden="true"title="Edit"></i></a> &nbsp;
<a href="#"><i class="fa fa-ban cancelexpense" aria-hidden="true"title="Cancel" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo md5($value->id);?>"></i></a> &nbsp;
<a href="#"><i class="fa fa-check Submitexpense" aria-hidden="true"title="Submit" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo $value->id;?>"></i></a> &nbsp;
<!-- <a href="<?php echo base_url()?>Expence/submit/<?php echo $value->id;?>" onclick="return confirm('Are sure to Submit this Expence')"><i class="fa fa-check" aria-hidden="true"title="Submit All"></i></a> &nbsp; -->
<?php } ?>
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</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(url) {
if (url.endsWith('.pdf')) {
window.open(url, '_blank');
} else if (url.match(/\.(jpeg|jpg|png|gif)$/i)) {
// If the URL ends with .jpeg, .jpg, .png, or .gif, show the image
var img = new Image();
img.src = url;
var win = window.open('', '_blank');
win.document.write('<img src="' + img.src + '" alt="Image">');
} else {
alert('The selected file is not a PDF or an image.');
}
}
</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>
<script>
$('.cancelexpense').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Expence/cancled_expence";
$.ajax({
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
$('.delete_id').attr('value',id);
$('.delete_url').attr('action',url);
}
});
});
$('.Submitexpense').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Expence/submit";
$.ajax({
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
$('.delete_id').attr('value',id);
$('.delete_url').attr('action',url);
}
});
});
</script>