bbone/application/modules/Leave/views/leavehistory.php

218 lines
7.4 KiB
PHP

<head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
<style>
.alert-success {
background-color: #dff0d8;
color: #3c763d;
border-color: #d6e9c6;
}
.flash-message {
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
margin-left: 650px;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important;
}
</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>Submited for Approval.<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('Success');?>" >
<?php $this->session->unset_userdata('Success');?>
<script>
$(document).ready(function(){
if($('#error').val() == 1 )
{
$('#button').click();
}
})
</script>
<ul class="nav navbar-right panel_toolbox">
<a href="<?php echo base_url();?>Leave/applyLeave" class="btn btn-sm btn-primary" style="margin-top: 20px;">Apply Leave</a>
<?php if(is_user() || user()->role == null) { ?>
<a href="<?php echo base_url();?>Leave/manager_approvel" class="btn btn-sm btn-warning" style="margin-top: 20px;">My Approvals</a>
<?php } ?>
<?php if(is_admin()) { ?>
<a href="<?php echo base_url();?>Leave/leaveList" class="btn btn-sm btn-warning" style="margin-top: 20px;">My Approvals</a>
<?php }?>
</ul>
<h1>My Leaves</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">Created Date/Time</th>
<th class="column-title">Leave Type </th>
<th class="column-title">Leave Duration</th>
<th class="column-title">No of Days </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) { ?>
<?php foreach ($leave_type as $leave => $type) { ?>
<?php if($type->id === $value->type ) { ?>
<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 $type->type; ?></td>
<?php if($value->from_date == "" && $value->to_date == "") { ?>
<td class="">
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
<?php echo timeFormat('h:i a', $value->from_time); ?> to
<?php echo timeFormat('h:i a', $value->to_time);; ?>
</td>
<?php } else { ?>
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
<?php } ?>
<?php if($value->no_of_days == 0){ ?>
<td class=" ">---</td>
<?php } else { ?>
<td class=""><?php echo $value->no_of_days; ?></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->ApproveBy; ?><br><?php echo $value->approved_at; ?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> By <?php echo $value->DeclineBy; ?> <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($value->status == 'pending') { ?>
<a href="<?php echo base_url('Leave/edit_leave_function')?>?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('Leave/cancled')?>?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/>
<!-- Large modal -->
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> -->
<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>
$('.deleteEmp').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Employee/deleteEmp";
$.ajax({
url: "<?php echo base_url()?>Employee/getDeleteConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
$('.delete_id').attr('value',id);
$('.delete_url').attr('action',url);
}
});
});
$(document).on('click','.bi-card-list',function(){
var id = $(this).attr("id")
$.ajax({
type: "get",
url: "<?php echo base_url()?>Employee/view_emp_history/"+id,
success: function(response) {
response = JSON.parse(response);
console.log(response);
$('.bs-example-modal-lg').html(response);
$('.bs-example-modal-lg').modal("show");
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
});
</script>
<script>
$(document).ready(function() {
$('#datatables').DataTable({
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'Leave',
text: 'PDF',
customize: function(doc) {
doc.content[1].table.body.forEach(function(row) {
// Remove the first and last columns
row.splice(0, 1);
row.pop();
});
}
},
{
extend: 'excelHtml5',
text: 'Excel',
title: 'Leave',
exportOptions: {
columns: ':not(:last-child)'
}
}
]
});
});
</script>
</div>