375 lines
12 KiB
PHP
375 lines
12 KiB
PHP
|
|
<head>
|
|
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
|
|
<style>
|
|
.modal_default {
|
|
display: none;
|
|
position: fixed;
|
|
/* z-index: 1;*/
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: auto;
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
.modal-content_default {
|
|
background-color: #fefefe;
|
|
margin: 15% auto;
|
|
padding: 20px;
|
|
border: 1px solid #888;
|
|
width: 380px;
|
|
height: 280px;
|
|
text-align: center;
|
|
}
|
|
|
|
button {
|
|
margin-top: 10px;
|
|
}
|
|
|
|
div.dataTables_wrapper div.dataTables_filter{
|
|
margin-top: -30px !important;
|
|
}
|
|
|
|
</style>
|
|
|
|
<style>
|
|
/* Modal Popup Styles */
|
|
.modal_default {
|
|
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_default 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;
|
|
}
|
|
|
|
.modal-content_default {
|
|
background-color: #fefefe;
|
|
margin: 15% auto;
|
|
padding: 30px;
|
|
border: 1px solid #888;
|
|
width: 380px;
|
|
height: 280px;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
|
|
|
|
</head>
|
|
<div class="col-md-12 col-sm-12 ">
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<ul class="nav navbar-right panel_toolbox">
|
|
<a href="<?php echo base_url();?>Expence/expence_list" class="btn btn-sm btn-primary" style="margin-top: 20px;">Back</a>
|
|
</ul>
|
|
<h3>Expense Approval List </h3>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Created by</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<div class="form-group">
|
|
<input readonly type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->created_name; } ?>" autocomplete='off' required />
|
|
</div>
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Requested For</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<div class="form-group">
|
|
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->requested_name; } ?>" autocomplete='off'/>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Expense Name</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<div class="form-group">
|
|
<input readonly type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->expense_name; } ?>" autocomplete='off' required />
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" id="expense_id" name="expense_pid" value="<?php echo $expense_name[0]->id; ?>">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Business Reason</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<div class="form-group">
|
|
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->business_reason; } ?>" autocomplete='off'/>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Status</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<div class="form-group">
|
|
<input readonly type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_name[0]->id))
|
|
{
|
|
if($expense_name[0]->status == "Approved")
|
|
{
|
|
echo $expense_name[0]->status .' By '. $expense_name[0]->approved_by .' - '. date('d-m-Y h:i:s', strtotime($expense_name[0]->approved_at));
|
|
}
|
|
else if($expense_name[0]->status == "Declined")
|
|
{
|
|
echo $expense_name[0]->status .' By '. $expense_name[0]->decline_by;
|
|
}
|
|
else
|
|
{
|
|
echo $expense_name[0]->status;
|
|
}
|
|
}
|
|
?>"
|
|
autocomplete='off' required />
|
|
</div>
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Submitted Date</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<div class="form-group">
|
|
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo date('d-m-Y h:i:s', strtotime($expense_name[0]->updated_on)); } ?>" autocomplete='off'/>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a><i class="fa fa-check approveexpense float-right btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve" id ></i></a>
|
|
|
|
|
|
</div>
|
|
<div class="x_content">
|
|
<div class="row">
|
|
<div class="col-sm-12" style="overflow: auto;">
|
|
<table class="table table-striped" width="100%">
|
|
<thead>
|
|
<tr class="headings">
|
|
<th hidden class="column-title">id</th>
|
|
<th class="column-title">Claim Date</th>
|
|
<th class="column-title">Date of Expense</th>
|
|
<th class="column-title">Amount</th>
|
|
<th class="column-title">Description</th>
|
|
<th class="column-title">Status </th>
|
|
<th class="column-title" >Action </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($tableData as $key => $value) { ?>
|
|
<tr class="even pointer">
|
|
<td hidden><?php echo $value->id; ?></td>
|
|
<td><?php echo date('d-m-Y', strtotime($value->created_on));?></td>
|
|
<td class=" "><?php echo date('d-m-Y', strtotime($value->date_of_expense)) ?></td>
|
|
<td class=" "><?php echo $value->amount; ?></td>
|
|
<td class=" "><?php echo $value->description; ?></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 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 $value->cancelled_at; ?></td>
|
|
<?php }
|
|
else if($value->status == 'Draft'){?>
|
|
|
|
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
|
|
|
<?php } ?>
|
|
|
|
<td style=" text-align: center; font-size: 16px;">
|
|
|
|
<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 if($value->status == 'pending') { ?>
|
|
|
|
<a><i class="fa fa-check approveexpense" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve" id="<?php echo $value->id;?>"></i></a>
|
|
<a><i class="fa fa-times test" data-toggle="modal" data-target=".bs-example-modal-sm" title="Decline" id="<?php echo $value->id;?>"></i></a>
|
|
<!-- <a><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()" id= "<?php echo $value->id; ?>"></i></a> -->
|
|
|
|
<?php } ?>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="customPrompt" class="modal modal_default" style="z-index: 1060;">
|
|
<div class="modal-content modal-content_default ">
|
|
<span onclick="$('#customPrompt').hide()" style="text-align: right;"><i class="fa fa-times fa-2x" aria-hidden="true"></i></span>
|
|
<h3>Decline Reason</h3>
|
|
<input list="browsers" style="padding:20px; margin:6px;" id="decline_reason" required name="myBrowser" />
|
|
<button onclick="submitCustomPrompt()" type="button" class="btn btn-primary">Submit</button>
|
|
|
|
</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 style="display:none" id="sub-value">
|
|
|
|
<script>
|
|
$('.approveexpense').click(function() {
|
|
var id = $(this).attr('id');
|
|
var expence_id = document.getElementById('expense_id').value;
|
|
var url = "<?php echo base_url()?>Expence/Approve_Child_Expence";
|
|
|
|
$.ajax({
|
|
url: "<?php echo base_url()?>Expence/getDeleteConfirmationPopup",
|
|
type:"GET",
|
|
success:function(data){
|
|
$('#popup').html(JSON.parse(data));
|
|
$('.delete_id').attr('value',id);
|
|
$('.expence_id').attr('value',expence_id);
|
|
$('.delete_url').attr('action',url);
|
|
}
|
|
});
|
|
});
|
|
|
|
$('.test').click(function() {
|
|
var id = $(this).attr('id');
|
|
var expence_id = document.getElementById('expense_id').value;
|
|
var url = "<?php echo base_url()?>Expence/Approve_Child_Expence";
|
|
|
|
$.ajax({
|
|
url: "<?php echo base_url()?>Expence/getDeclineConfirmationPopup",
|
|
type:"GET",
|
|
success:function(data){
|
|
$('#popup').html(JSON.parse(data));
|
|
$('.delete_id').attr('value',id);
|
|
$('.expence_id').attr('value',expence_id);
|
|
$('.delete_url').attr('action',url);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
|
function showCustomPrompt() {
|
|
var customPrompt = document.getElementById("customPrompt");
|
|
customPrompt.style.display = "block";
|
|
}
|
|
|
|
function submitCustomPrompt() {
|
|
|
|
var id = $('.test').attr("id");
|
|
var reason = document.getElementById("decline_reason").value;
|
|
var expence_id = document.getElementById('expense_id').value;
|
|
if( reason != "")
|
|
|
|
$.ajax({
|
|
|
|
data:{id : id , reason : reason, expence_id : expence_id },
|
|
url:"<?php echo base_url('Expence/Approve_Child_Expence');?>",
|
|
type:"get",
|
|
success: function(response) {
|
|
|
|
console.log(response);
|
|
window.location ="<?php echo base_url()?>Expence/expence_list_view/"+expence_id;
|
|
console.log(response);
|
|
}
|
|
|
|
|
|
});
|
|
else
|
|
|
|
alert('Decline Reason is required');
|
|
}
|
|
|
|
</script>
|
|
</div>
|
|
|
|
<div id="myModal" class="modal modal_default">
|
|
<span class="close">×</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>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|