tracker issues fix : RV

This commit is contained in:
VENKATESHWARAN 2023-12-22 17:52:24 +05:30
parent ebffc559ce
commit e2b789a599
30 changed files with 787 additions and 1135 deletions

View File

@ -106,6 +106,25 @@ public function create_business()
unset($data['module_id']);
$create_business = $this->MY_Model->insert($data,$table);
if($create_business){
$data1=[
'business_id' => $this->input->post('uid'),
'type'=> 'Permission',
'days'=> '0',
'is_active' => '1',
'code ' => 'permission'
];
$data2=[
'business_id' => $this->input->post('uid'),
'type'=> 'Casual Leave',
'days'=> '0',
'is_active' => '1',
];
$table = "leave_master";
$leavemaster1 = $this->MY_Model->insert($data1,$table);
$leavemaster2 = $this->MY_Model->insert($data2,$table);
}
// audit history
if($create_business)
{

View File

@ -253,7 +253,7 @@ class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<div class="col-md-5 col-sm-5 offset-md-1">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Business/business_list" class="btn btn-secondary">Cancel</a>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>

View File

@ -32,7 +32,7 @@
<div class="col-md-5 col-sm-5 offset-md-1">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Business/module_list" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>

View File

@ -260,7 +260,7 @@ class="form-control" type="text">
<div class="ln_solid"></div>
<div class="item form-group">
<div class="offset-md-8">
<button class="btn btn-primary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Business/business_list" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-success">Update</button>
</div>
</div>

View File

@ -37,7 +37,7 @@
<div class="col-md-5 col-sm-5 offset-md-1">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Business/module_list" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-success">Update</button>
</div>
</div>

View File

@ -90,7 +90,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Delegation/Delegation_list" class="btn btn-secondary">Cancel</a>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>

View File

@ -22,7 +22,8 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important; //search to up
margin-top: -30px !important;
}

View File

@ -127,6 +127,10 @@
/* Allow labels to line wrap when menu is artificially narrowed */
white-space: normal;
}
#errMessage {
color: red;
}
</style>
@ -274,7 +278,8 @@ class="fa fa-fw fa-eye field-icon toggle-password"></span>
<div class="col-md-3 col-sm-3 ">
<input type="password" id="confirm_password" name="confirm_password" value=""
required="required" class="form-control ">
<span id='message'></span>
<span id='message'></span><span id='errMessage'></span>
</div>
@ -445,7 +450,7 @@ class="form-control typeFile" onchange="validateFile(this)"
<div class="item form-group">
<div class="offset-md-8">
<a href="<?php echo base_url();?>Employee/empList" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-success">Submit</button>
<button id="submit" type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</div>
@ -593,5 +598,26 @@ function check_if_exists(id, value, name) {
}
}
});
}
}
$('#password').keyup(function() {
if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password');
} else {
$('#errMessage').html('');
}
});
$('#confirm_password').keyup(function() {
if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password');
} else {
$('#errMessage').html('');
}
});
</script>

View File

@ -1,7 +1,7 @@
<head>
<style>
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important; //search move to up
margin-top: -30px !important;
}
</style>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
@ -109,14 +109,34 @@
<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
}
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'Employees',
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: 'Employees',
exportOptions: {
columns: ':not(:last-child)'
}
}
]
});
});
});
</script>
</div>

View File

@ -1,185 +0,0 @@
<!-- Body page content -->
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Expence Request</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Employee/rise_expence_request" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
<div class="item form-group">
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="last-name">Expence Requisted For</label>
<div class="col-md-5 col-sm-5 ">
<input type="radio" name="created_by" value="self"style="margin:10px;"checked /><b>Self</b>
<input type="radio" name="created_by" value="<?php echo user()->name;?>" style="margin: 10px;" /><b>Others</b>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="last-name"> Employee Name </label>
<div class="col-md-5 col-sm-5 ">
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;" class="form-control manager" > </select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="first-name"> Date of expence</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<div class='input-group date' id='myDatepicker'>
<input type='text' class="form-control" name="date_of_expence" value="<?php if(isset($expenceData)) { echo $expenceData->purchase_date; } ?>" />
<span class="input-group-addon">
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="first-name"> Expence Cost </label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount" value="<?php if(isset($assetData)) { echo $assetData->cost; } ?>" class="form-control" type="text" name="middle-name">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="last-name">Description</label>
<div class="col-md-5 col-sm-5">
<textarea id="comments" name="comments" value="" class="form-control" style="height:200px !important;" type="text" ></textarea>
<input type="hidden" id="manager_id" name="manager" value="">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="first-name">Expence Bill</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill" class="typeFile" type="file" >
</div>
</div>
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /Body page content -->
<script>
$(document).ready(function(){
var currentUserName = '<?php echo user()->name; ?>';
var currentUserId = '<?php echo user()->id; ?>';
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
currentUserName + '</option>');
$('#user_dropdown').prop('disabled', true);
$('#user_dropdown').on('change',function() {
});
$('input[type="radio"][name="created_by"]').change(function() {
var selectedValue = $(this).val();
var $userDropdown = $('#user_dropdown');
$userDropdown.empty();
if (selectedValue === 'self') {
var currentUserName = '<?php echo user()->name; ?>';
var currentUserId = '<?php echo user()->id; ?>';
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName + '</option>');
$userDropdown.prop('disabled', true);
} else if (selectedValue === '<?php echo user()->name; ?>') {
$.ajax({
url: '<?php echo base_url('Employee/get_emp_name/')?>"',
method: 'GET',
dataType: 'json',
success: function(response) {
$('#user_dropdown').append(response);
$('#user_dropdown').prop('disabled', false);
},
error: function(xhr, status, error) {
console.error(error);
}
});
}
});
});
</script>
<script>
//get manager id from the dropdown employee assign the value to $("#manager_id") input field
$("#user_dropdown").on("change", function(){
let manager_id = $(this).children(":selected").attr("id");
$("#manager_id").val(manager_id);
})
</script>

View File

@ -1,296 +0,0 @@
<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.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>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<style>
.design {
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);
}
.design-form {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 380px;
height: 280px;
text-align: center;
}
button {
margin-top: 10px;
}
</style>
<style>
#myImg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
#myImg:hover {opacity: 0.7;}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (image) */
.modal-content {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
}
/* Caption of Modal Image */
#caption {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
text-align: center;
color: #ccc;
padding: 10px 0;
height: 150px;
}
/* Add Animation */
.modal-content, #caption {
-webkit-animation-name: zoom;
-webkit-animation-duration: 0.6s;
animation-name: zoom;
animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
from {-webkit-transform:scale(0)}
to {-webkit-transform:scale(1)}
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
.close {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
}
.close:hover,
.close:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
.modal-content {
width: 100%;
}
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h1>Expence List</h1>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12" style="overflow: auto;">
<table id="datatable-buttons" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Creadted Date</th>
<th class="column-title">Employee Id</th>
<th class="column-title">Employee Name</th>
<th class="column-title">Expence Date</th>
<th class="column-title">Expence Raised By</th>
<th class="column-title">Expence Cost()</th>
<th class="column-title">Expence Bill</th>
<th class="column-title">Comments </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 class=" "><?php echo $value->created_at; ?> </td>
<td class=" "><?php echo $value->emp_id; ?> </td>
<td class=" "><?php echo $value->name; ?> </td>
<td class=" "><?php echo $value->date_of_expence; ?></td>
<td class=" "><?php echo $value->created_by; ?></td>
<td class=" "> <?php echo $value->amount; ?></td>
<td class=" ">
<img id="myImg" style="width: 50%; display: block;" src="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" alt="invoice"/>
</td>
<td class=" "><?php echo $value->comments; ?></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($value->status == 'pending') { ?>
<a href="<?php echo base_url('Employee/Approve_Expence')?>?id=<?php echo $value->id;?> "><i class="fa fa-check" aria-hidden="true"title="Approve" onclick = "return confirm('Are you sure to Approve This Leave ')" ></i></a> &nbsp;
<a href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
id= "<?php echo $value->id; ?>"></i></a>&nbsp;
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="customPrompt" class="design">
<div class="design-form ">
<span onclick="$('#customPrompt').hide()">X</span>
<h3>Decline Reason</h3>
<input list="browsers" id="decline_reason" required name="myBrowser" />
<datalist id="browsers" >
<?php foreach ($dropdown as $key => $value) { ?>
<option value="<?php echo $value->enum_value; ?>"><?php echo $value->enum_value; ?></option>
<?php } ?>
</datalist>
<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>
<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;
if( reason != "")
$.ajax(
{
data:{id : id , reason : reason },
url:"<?php echo base_url('Employee/Decline_expence');?>",
type:"get",
success: function(response) {
window.location ='<?php echo base_url('Employee/expence_list');?>';
}
});
else
alert('Decline Reason is required');
}
</script>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<span class="close">&times;</span>
<img class="modal-content" id="img01">
<div id="caption"></div>
</div>
<script>
$(document).ready(function(){
$('#myImg').on('click', function(){
var modal = document.getElementById("myModal");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.src;
captionText.innerHTML = this.alt;
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
});
});
</script>

View File

@ -156,7 +156,7 @@ public function edit_expence($id)
public function edit_rise_expence_request()
{
{
$id = $this->input->post('expense_pid');
$data = $this->input->post('emp_id');
if(!empty($data)){
@ -283,6 +283,7 @@ public function expence_list()
$business_id = user()->business_id;
$expence_list = $this->Expence_model->get_expence_list($business_id);
$get_count_amount = $this->Expence_model->get_count_amount();
// $get_business_admin = $this->Expence_model->get_business_admin();
$this->layout->set('count_amount', $get_count_amount);
$this->layout->set('tableData', $expence_list);
$this->layout->buffer('main_content', 'Expence/expence_list');
@ -343,18 +344,83 @@ public function Approve_Expence()
$table = "expense";
$this->MY_Model->edit_option($action, $id, $table);
$this->Expence_model->approve_child_expense($action, $id);
$this->session->set_flashdata('approve', 'Claim Request Approved');
$this->session->set_flashdata('Create', '1');
redirect('Expence/expence_list');
}
public function Approve_Child_Expence()
{
$id=$this->input->post('id');
$action['status'] = 'Approved';
$action['approved_by']= user()->name;
$action['approved_at'] = date('Y-m-d h:i:s');
$this->Expence_model->approve_child_expense_2($action, $id);
redirect('Expence/expence_list_view/'.$this->input->post('expence_id'));
{
if($this->input->get('reason'))
{
$id=$this->input->get('id');
$expense_id=$this->input->get('expence_id');
$decline_action['status'] = 'Declined';
$decline_action['decline_by'] = user()->name;
$decline_action['decline_reason'] = $this->input->get('reason');
$is_decline = $this->Expence_model->approve_child_expense_2($decline_action, $id);
if($is_decline == true)
{
$count = $this->Expence_model->get_status_update($expense_id);
$table = "expense";
if($count->pending_count >= 1)
{
$status_update['status'] = 'pending';
$this->MY_Model->edit_option($status_update, $expense_id, $table);
}
else if($count->approve_count >= 1 && $count->declined_count >= 1)
{
$status_update['status'] = 'Partially approved';
return $this->MY_Model->edit_option($status_update, $expense_id, $table);
}
else if($count->declined_count >= 1 && $count->approve_count == 0 && $count->pending_count == 0)
{
$status_update['status'] = 'Declined';
$status_update['decline_by'] = user()->name;
return $this->MY_Model->edit_option($status_update, $expense_id, $table);
}
}
}
else
{
$id=$this->input->post('id');
$expense_id=$this->input->post('expence_id');
$action['status'] = 'Approved';
$action['approved_at'] = date('Y-m-d h:i:s');
$action['approved_by']= user()->name;
$is_approve = $this->Expence_model->approve_child_expense_2($action, $id);
if($is_approve == true)
{
$count = $this->Expence_model->get_status_update($expense_id);
$table = "expense";
if($count->pending_count >= 1)
{
$status_update['status'] = 'pending';
$this->MY_Model->edit_option($status_update, $expense_id, $table);
}
else if($count->approve_count >= 1 && $count->declined_count >= 1)
{
$status_update['status'] = 'Partially approved';
$this->MY_Model->edit_option($status_update, $expense_id, $table);
}
else if($count->approve_count >= 1 && $count->declined_count == 0 && $count->pending_count == 0)
{
$status_update['status'] = 'Approved';
$action['approved_at'] = date('Y-m-d h:i:s');
$status_update['approved_by'] = user()->name;
$this->MY_Model->edit_option($status_update, $expense_id, $table);
}
}
redirect('Expence/expence_list_view/'.$this->input->post('expence_id'));
}
}
public function Decline_expence()
@ -368,14 +434,6 @@ public function Decline_expence()
return true;
}
public function Decline_Child_Expence()
{
$id=$this->input->get('id');
$action['status'] = 'Declined';
$action['decline_by'] = user()->name;
$action['decline_reason'] = $this->input->get('reason');
return $this->Expence_model->approve_child_expense_2($action, $id);
}
public function getCancelConfirmationPopup()
{

View File

@ -29,6 +29,7 @@ public function get_expence_list($business_id)
$this->db->where('A.status', 'pending');
$this->db->or_where('A.status', 'Approved');
$this->db->or_where('A.status', 'Declined');
$this->db->or_where('A.status', 'Partially approved');
$this->db->order_by('A.id', 'DESC');
$query = $this->db->get();
$query = $query->result();
@ -125,25 +126,10 @@ public function approve_child_expense_2($action, $id)
{
$this->db->where('id', $id);
$this->db->where('status','pending');
$this->db->update('expense_child',$action);
return $this->db->update('expense_child',$action);
}
public function decline_dropdown($business_id)
{
$this->db->select('*');
$this->db->from('enum');
$this->db->where('enum_type', 'decline');
$this->db->where('business_id', $business_id);
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
} else {
return;
}
}
public function get_expence_list_by_id($id)
{
@ -230,7 +216,9 @@ public function update_to_submit_all($id, $data)
$this->db->update('expense_child', $data);
return;
}
// get the value from expense and expense_child sum of the value and count data
// get the value from expense and expense_child sum of the value and count data
public function get_count_amount()
{
$query = $this->db->query('SELECT expense.id, (SELECT SUM(amount) FROM expense_child WHERE expense_child.expense_id = expense.id) as amount, (SELECT COUNT(expense_id) FROM expense_child WHERE expense_child.expense_id = expense.id) as count FROM expense');
@ -238,4 +226,19 @@ public function get_count_amount()
return $query;
}
public function get_status_update($id)
{
$query = $this->db->query('SELECT expense_id,
COUNT(CASE WHEN status = "Approved" THEN 1 ELSE NULL END) AS approve_count,
COUNT(CASE WHEN status = "Declined" THEN 1 ELSE NULL END) AS declined_count,
COUNT(CASE WHEN status = "pending" THEN 1 ELSE NULL END) AS pending_count
FROM expense_child
WHERE expense_id = ?
GROUP BY expense_id', $id);
$result = $query->row();
return $result;
}
}

View File

@ -1,6 +1,3 @@
<div class="modal-dialog modal-sm">
<div class="modal-content">

View File

@ -60,6 +60,10 @@
height: 280px;
}
a:hover {
background-color: skyblue;
}
</style>
<div class="clearfix"></div>
@ -89,7 +93,15 @@
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-primary" style="margin-top: 20px; font-size: small;">Back</a>
</ul>
<h3>Edit Expense - <?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?></h3>
<h3>
<?php if($expense_data[0]->status == 'Draft') { ?>
Edit Expense - <?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>
<?php } else { echo $expense_data[0]->expense_name; } ?>
</h3>
<div class="clearfix"></div>
</div>
@ -121,10 +133,10 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name">Expense Name</label>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Expense Name<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>" autocomplete='off' />
<input type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>" autocomplete='off' required />
</div>
@ -155,6 +167,34 @@
<?php $i=1; foreach ($expense_child_data as $key => $value) { ?>
<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">
<input id="cost" class="form-control" readonly name="middle-name" autocomplete='off' value="
<?php if($value->status == "Approved")
{
echo $value->status . ' By ' . $value->approved_by . ' - ' . date('d-m-Y h:i:s', strtotime($value->approved_at));
}
else if($value->status == "Declined")
{
echo $value->status.' By '.$value->decline_by .' ( ' . $value->decline_reason . ' )';
}
else if($value->status == "Cancelled")
{
echo $value->status.' at '.date('d-m-Y h:i:s', strtotime($value->cancelled_at));
}
else
{
echo $value->status;
}
?>
">
</div>
</div>
<div class="item form-group">
@ -162,7 +202,7 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' id="ExpenseDate<?php echo $i;?>" class="form-control date" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off'/>
<input type='text' id="ExpenseDate<?php echo $i;?>" class="form-control date" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off'/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
</div>
</div>
@ -185,7 +225,7 @@
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple><br>
<a href="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" target="_blank" class="btn btn-info float-right" style="font-size: x-small; margin-top: 7px;"><b>View Recipt</b></a></div>
<a href="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" target="_blank" class="float-right" style="font-size: x-small; color: darkblue; margin-top: 7px;"><b>View Recipt(<?php echo $value->bill; ?>)</b></a></div>
<?php if($expense_data[0]->status == 'Draft') { ?>
@ -207,9 +247,11 @@
yearRange: '2000:' + new Date().getFullYear(),
maxDate: new Date(),
autoclose:true,
allowInput: false,
onChange: function(selectedDates, dateStr) {
console.log('Selected date: ', dateStr);
instance._input.removeAttribute("readonly");
}
});
@ -226,8 +268,8 @@
<div class="item form-group">
<div class=" offset-md-8">
<?php if($expense_data[0]->status == 'Draft') { ?>
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-success" name="update">Update</button>
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-success" name="update" value="update">Update</button>
<?php } ?>
</div>
</div>
@ -398,10 +440,10 @@ function createAndAppendFormGroup() {
var html1 = '';
i++
html1 += '<div id="removeChild'+i+'">'
html1 += '<br><div class="x_title">'+i+'</div><br>'
html1 += '<br><div class="x_title"></div><br>'
html1 += '<div class="item form-group">';
html1 += '<label class="control-label col-md-1 col-sm-1 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="date" id="datepicker'+i+'" class="form-control dates" placeholder="DD-MM-YYYY" required name="date_of_expence2[]" value="" autocomplete="off"/></div></div>';
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="date" id="datepicker'+i+'" class="form-control dates" placeholder="DD-MM-YYYY" required name="date_of_expence2[]" value="" autocomplete="off"/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i></div></div>';
html1 += '<label class="control-label col-md-1 col-sm-1 " for="first-name"> Expense Cost <a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><input id="cost" name="amount2[]" required class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete="off"></div>';
html1 += '</div>';
@ -427,6 +469,7 @@ function createAndAppendFormGroup() {
dateFormat: 'd-m-Y',
maxDate: new Date(),
autoclose:true,
allowInput: false,
onChange: function(selectedDates, dateStr) {
console.log('Selected date: ', dateStr);

View File

@ -144,6 +144,10 @@
<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;">

View File

@ -34,7 +34,7 @@
cursor: pointer;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important;
margin-top: -30px !important; //search to up
}
.alert-success {

View File

@ -8,10 +8,10 @@
<style>
.alert-success {
.alert-success {
background-color: #dff0d8;
color: #3c763d;
border-color: #d6e9c6;
border-color: #d6e9c6;
}
.flash-message {
@ -22,8 +22,8 @@
}
.hide-arrow {
-webkit-appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: none;
@ -32,312 +32,289 @@
}
.drop-zone {
border: 2px dashed #ccc;
padding: 20px;
width: 257px;
height: 300px;
text-align: center;
cursor: pointer;
.drop-zone {
border: 2px dashed #ccc;
padding: 20px;
width: 257px;
height:300px;
text-align: center;
cursor: pointer;
}
.preview-container {
display: flex;
flex-wrap: wrap;
margin-top: 19px;
margin-left: -18px !important;
display: flex;
flex-wrap: wrap;
margin-top: 19px;
margin-left: -18px !important;
}
.preview-item {
width: 100%;
margin-right: 10px;
margin-bottom: 10px;
width: 100%;
margin-right: 10px;
margin-bottom: 10px;
}
.preview-item img,
.preview-item object {
width: 290px;
height: 280px;
width: 290px;
height: 280px;
}
.fa .fa-calendar {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
cursor: pointer;
}
</style>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<div class="x_title">
<div class="col-md-12 col-sm-12 ">
<div class="x_title">
<ul class="nav navbar-right panel_toolbox">
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-primary"
style="margin-top: 20px; font-size: small;">Back</a>
</ul>
<h3>Expense Claim</h3>
<ul class="nav navbar-right panel_toolbox">
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-primary" style="margin-top: 20px; font-size: small;">Back</a>
</ul>
<h3>New Claim</h3>
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post"
action="<?php echo base_url();?>Expence/rise_expence_request" enctype="multipart/form-data">
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Expence/rise_expence_request" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
<div class="x_panel">
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 label-align" for="last-name">Expense Requisted
For</label>
<div class="col-md-4 col-sm-4">
<div class="x_panel">
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 label-align" for="last-name">Expense Requisted For</label>
<div class="col-md-4 col-sm-4">
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"
style="margin:10px;" checked /><b>Self</b>
<input type="radio" name="created_by" value="<?php echo user()->name;?> (<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name"> Employee Name <a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;" class="form-control manager" ></select>
</div>
<input type="radio" name="created_by"
value="<?php echo user()->name;?> (<?php echo user()->id;?>)"
style="margin: 10px;" /><b>Others</b>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name"> Employee Name <a
style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;"
class="form-control manager"> </select>
</div>
</div>
</div>
<div class="item form-group">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Expense Name</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="expense_name"
value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>"
autocomplete='off' />
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Expense Name<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' id="expense_name" class="form-control" name="expense_name" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>" autocomplete='off' required />
</div>
</div>
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Business
Reason</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="business_reason"
value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->business_reason; } ?>"
autocomplete='off' />
</div>
</div>
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Business Reason</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->business_reason; } ?>" autocomplete='off'/>
</div>
</div>
</div>
</div>
<div class="x_panel">
<div class="x_title">
<!-- <ul class="nav navbar-right panel_toolbox">
<div class="x_panel">
<div class="x_title">
<!-- <ul class="nav navbar-right panel_toolbox">
<button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-info" style="font-size:small;" >Add</button>
</ul> -->
<div class="clearfix"></div>
</div><br>
<div class="clearfix"></div>
</div><br>
<?php if(isset($expense_child_data[0]->id)) { foreach ($expense_child_data as $key => $value) { ?>
<?php if(isset($expense_child_data[0]->id)) { foreach ($expense_child_data as $key => $value) { ?>
<div class="item form-group">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a
style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY"
required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>"
autocomplete='off' />
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off' /><i class="fa fa-calendar"></i>
</div>
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Expense Cost <a
style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount[]" required value="<?php echo $value->amount ?>"
class="form-control" onkeypress="return matchnum(event)" type="number"
name="middle-name" autocomplete='off'>
</div>
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Expense Cost <a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount[]" required value="<?php echo $value->amount ?>" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
</div>
<div class="item form-group flex-wrap">
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>
<div class="col-md-5 col-sm-3">
<textarea id="comments" name="description[]" value="" class="form-control"
style="height:50px !important;" type="text"><?php echo $value->description ?></textarea>
<div class="item form-group flex-wrap">
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>
<div class="col-md-5 col-sm-3">
<textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ><?php echo $value->description ?></textarea>
<!-- <input type="hidden" id="manager_id" name="manager" value=""> -->
<!-- <input type="hidden" id="manager_id" name="manager" value=""> -->
</div>
<label class="control-label col-md-1 col-sm-1 label-align"
for="first-name">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile"
type="file" value="<?php echo $value->bill ?>" multiple>
</div>
<div class="col-12"><button type="button" class="float-right btn btn-danger"
onclick="remove_row(<?php echo $value->id ?>)" id="remove-button2"><i
class="fa fa-trash"></i></button></div>
</div>
<?php } } else { ?>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a
style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY"
required name="date_of_expence[]" value="" autocomplete='off' />
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a
style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount[]" required value="" class="form-control"
onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>
<div class="col-md-5 col-sm-3">
<textarea id="comments" name="description[]" value="" class="form-control"
style="height:50px !important;" type="text"></textarea>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile"
type="file" value="" multiple>
</div>
</div>
<div class="col-12"><button type="button" id="add-button" onclick="createAndAppendFormGroup()"
class="btn btn-primary float-right">Add</button></div>
<?php } ?>
<div id="formContainer"></div>
</div>
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-primary" name="save">Save</button>
<?php if(isset($expense_data[0]->id)) { ?>
<button type="submit" class="btn btn-success" name="submit">Submit</button>
<button type="submit" class="btn btn-warning" name="update">Update</button>
<?php } ?>
</div>
</div>
</form>
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple>
</div>
<div class="col-12"><button type="button" class="float-right btn btn-danger" onclick="remove_row(<?php echo $value->id ?>)" id="remove-button2"><i class="fa fa-trash"></i></button></div></div>
<?php } } else { ?>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="" autocomplete='off'/>
<i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount[]" required value="" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>
<div class="col-md-5 col-sm-3">
<textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ></textarea>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="" multiple></div>
</div><div class="col-12"><button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-primary float-right">Add</button></div>
<?php } ?>
<div id="formContainer"></div>
</div>
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-primary" name="save">Save</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /Body page content -->
<script>
// hide the dropdown arrow
// hide the dropdown arrow
$(document).ready(function() {
$(document).ready(function() {
$("#user_dropdown").addClass("hide-arrow");
$("input[name='created_by']").on("change", function() {
var inputValue = $(this).val();
if (inputValue === "<?php echo user()->name;?> (<?php echo user()->id;?>)") {
$("#user_dropdown").removeClass("hide-arrow");
} else {
$("#user_dropdown").addClass("hide-arrow");
}
});
$("#user_dropdown").addClass("hide-arrow");
$("input[name='created_by']").on("change", function() {
var inputValue = $(this).val();
if (inputValue === "<?php echo user()->name;?> (<?php echo user()->id;?>)") {
$("#user_dropdown").removeClass("hide-arrow");
} else {
$("#user_dropdown").addClass("hide-arrow");
}
});
})
})
</script>
<script>
const datepickerInput = document.getElementById('ExpenseDate');
flatpickr(datepickerInput, {
dateFormat: 'd-m-Y',
maxDate: new Date(),
flatpickr(datepickerInput, {
dateFormat: 'd-m-Y',
maxDate: new Date(),
allowInput: false,
autoclose:true,
onChange: function(selectedDates, dateStr) {
console.log('Selected date: ', dateStr);
console.log('Selected date: ', dateStr);
}
});
});
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase();
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension)) {
new PNotify({
title: 'Invalid file type.',
text: 'Only JPG, JPEG, PNG, and PDF files are allowed.',
styling: 'bootstrap3'
});
input.value = "";
return;
}
if (!allowedExtensions.includes(fileExtension)) {
new PNotify({
title: 'Invalid file type.',
text: 'Only JPG, JPEG, PNG, and PDF files are allowed.',
styling: 'bootstrap3'
});
input.value = "";
return;
}
}
</script>
<script>
function matchnum(event) {
var charcode;
charcode = event.which || event.keyCode;
function matchnum(event)
{
var charcode;
if (charcode >= 48 && charcode <= 57) return true; //only numbers
return false;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true; //only numbers
return false;
}
$(document).ready(function(){
$(document).ready(function() {
var currentUserName = '<?php echo user()->name; ?>';
var currentUserId = '<?php echo user()->id; ?>';
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
var currentUserName = '<?php echo user()->name; ?>';
var currentUserId = '<?php echo user()->id; ?>';
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
currentUserName + '</option>');
$('#user_dropdown').prop('disabled', true);
$('#user_dropdown').prop('disabled', true);
$('#user_dropdown').on('change', function() {
$('#user_dropdown').on('change',function() {
});
});
$('input[type="radio"][name="created_by"]').change(function() {
$('input[type="radio"][name="created_by"]').change(function() {
var selectedValue = $(this).val();
var $userDropdown = $('#user_dropdown');
@ -345,22 +322,22 @@ function matchnum(event) {
$userDropdown.empty();
if (selectedValue === 'self (<?php echo user()->id;?>)') {
var currentUserName = '<?php echo user()->name; ?>';
var currentUserId = '<?php echo user()->id; ?>';
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName +
'</option>');
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName + '</option>');
$userDropdown.prop('disabled', true);
} else if (selectedValue === '<?php echo user()->name; ?> (<?php echo user()->id;?>)') {
$.ajax({
url: '<?php echo base_url('Expence/get_emp_name/')?>"',
url: '<?php echo base_url('Expence/get_emp_name/')?>"',
method: 'GET',
dataType: 'json',
success: function(response) {
$('#user_dropdown').append(response);
$('#user_dropdown').append(response);
$('#user_dropdown').prop('disabled', false);
$('#user_dropdown').prop('required', true);
},
error: function(xhr, status, error) {
console.error(error);
@ -368,132 +345,122 @@ function matchnum(event) {
});
}
});
});
$('input[type="radio"][name="created_by"]').change(function() {
var selectedValue = $(this).val();
var $userDropdown = $('#user_dropdown');
if (selectedValue === '<?php echo user()->name; ?> (<?php echo user()->id;?>)') {
$('#user_dropdown').prop('required', true);
$('#user_dropdown').prop('disabled', false);
}
});
</script>
<script>
<script>
//get manager id from the dropdown employee assign the value to $("#manager_id") input field
$("#user_dropdown").on("change", function() {
let manager_id = $(this).children(":selected").attr("id");
$("#user_dropdown").on("change", function(){
let manager_id = $(this).children(":selected").attr("id");
console.log(manager_id);
$("#manager_id").val(manager_id);
console.log(manager_id);
$("#manager_id").val(manager_id);
})
</script>
<script>
var i = 1;
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var addButton = document.getElementById("add-button");
addButton.style.display = "block"; // Show the "Add" button initially
});
var i=1;
function createAndAppendFormGroup() {
var html1 = '';
i++
html1 += '<div id="removeChild' + i + '">'
html1 += '<br><div class="x_title">' + i + '</div><br>'
html1 += '<div class="item form-group">';
html1 +=
'<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="text" id="datepicker' + i +
'" class="form-control date-picker" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="" autocomplete="off"/></div></div>';
html1 +=
'<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Expense Cost <a style="color:red;">*</a></label>';
html1 +=
'<div class="col-md-5 col-sm-5 "><input id="cost" name="amount[]" required class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete="off"></div>';
html1 += '</div>';
var html1 = '';
i++
html1 += '<div id="removeChild'+i+'"><br>'
html1 += '<br><div class="x_title"></div><br>'
html1 += '<div class="item form-group">';
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="text" id="datepicker'+i+'" class="form-control date-picker" placeholder="DD-MM-YYYY" name="date_of_expence[]" value="" autocomplete="off" required/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i></div></div>';
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><input id="cost" name="amount[]" required class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete="off"></div>';
html1 += '</div>';
html1 += '<div class="item form-group flex-wrap">'
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>'
html1 +=
'<div class="col-md-5 col-sm-3"><textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ></textarea></div>'
html1 += '<div class="item form-group flex-wrap">'
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>'
html1 += '<div class="col-md-5 col-sm-3"><textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ></textarea></div>'
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Recipt </label>'
html1 +=
'<div class="col-md-5 col-sm-5 "><input id="formFile" name="bill[]" multiple onchange="validateFile(this)" class="typeFile" type="file" value="" ></div>'
html1 += '</div>'
html1 +=
'<div class="col-12"><button type="button" class="float-right btn btn-danger"" id="remove-button" onclick="removebutton(' +
i +
')"><i class="fa fa-trash"></i></button></div><button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-primary float-right">Add</button></div>'
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt </label>'
html1 += '<div class="col-md-5 col-sm-5 "><input id="formFile" name="bill[]" multiple onchange="validateFile(this)" class="typeFile" type="file" value="" ></div>'
html1 += '</div>'
html1 += '<div class="col-12"><button type="button" class="float-right btn btn-danger"" id="remove-button" onclick="removebutton('+i+')"><i class="fa fa-trash"></i></button></div><button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-primary float-right">Add</button></div>'
var formContainer = document.getElementById('formContainer');
//formContainer.innerHTML += html1;
formContainer.insertAdjacentHTML('beforeend', html1);
var formContainer = document.getElementById('formContainer');
//formContainer.innerHTML += html1;
formContainer.insertAdjacentHTML('beforeend', html1);
const datepickerInput = document.getElementById('datepicker' + i);
flatpickr(datepickerInput, {
dateFormat: 'd-m-Y',
maxDate: new Date(),
autoclose: true,
const datepickerInput = document.getElementById('datepicker'+i);
flatpickr(datepickerInput, {
dateFormat: 'd-m-Y',
maxDate: new Date(),
autoclose:true,
allowInput: false,
onChange: function(selectedDates, dateStr) {
console.log('Selected date: ', dateStr);
}
});
}
function removebutton(index) {
//console.log(index)
var element = document.getElementById('removeChild' + index);
//console.log(element)
if (element) {
element.remove();
onChange: function(selectedDates, dateStr) {
console.log('Selected date: ', dateStr);
}
});
}
function removebutton(index) {
//console.log(index)
var element = document.getElementById('removeChild'+ index);
//console.log(element)
if (element) {
element.remove();
}
}
// function date(date){
// console.log('called');
// var element = document.getElementById('ExpenseDates'+ date);
// element.datepicker({
// dateFormat: "dd-mm-yy",
// changeYear: true,
// changeMonth: true,
// yearRange: "1990:c",
// maxDate: new Date(),
// autoclose: true,
// todayHighlight: true,
// });
// }
</script>
<!-- <script>
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("formFile").files[0]);
oFReader.onload = function (oFREvent) {
document.getElementById("uploadPreview").src = oFREvent.target.result;
};
};
</script> -->
<script>
function remove_row(id) {
$.ajax({
function remove_row(id)
{
$.ajax({
data: {
id: id
},
url: "<?php echo base_url('Expence/remove_row');?>",
type: "get",
data:{id : id},
url:"<?php echo base_url('Expence/remove_row');?>",
type:"get",
success: function(response) {
if(response==true);
{
location.reload(true)
}
if (response == true); {
location.reload(true)
}
}
});
}
}
});
}
</script>
</script>

View File

@ -21,7 +21,7 @@
.modal-content_default {
background-color: #fefefe;
margin: 15% auto;
margin: 15% auto;s
padding: 20px;
border: 1px solid #888;
width: 380px;
@ -34,8 +34,8 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important;
}
margin-top: -30px !important; //search to up
</style>
<style>
@ -87,6 +87,39 @@
<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>Expense Approved<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<button hidden id="button2" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Expense Declined<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();
}
else if($('#error').val() == 2)
{
$('#button2').click();
}
})
</script>
<ul class="nav navbar-right panel_toolbox">
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-sm btn-primary" style="margin-top: 20px;">Back</a>
</ul>
@ -144,8 +177,11 @@
<?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'){?>
<?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>
@ -265,6 +301,11 @@ function submitCustomPrompt() {
console.log(response);
window.location ='<?php echo base_url('Expence/expence_list');?>';
new PNotify({
text: '<html><h2>Expense Declined<h2></html>',
type: 'success',
styling: 'bootstrap3'
});
}

View File

@ -6,7 +6,6 @@
<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;
@ -175,6 +174,8 @@
</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>&nbsp;
</div>
<div class="x_content">
@ -294,13 +295,14 @@ function submitCustomPrompt() {
$.ajax({
data:{id : id , reason : reason },
url:"<?php echo base_url('Expence/Decline_Child_Expence');?>",
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);
}

View File

@ -22,7 +22,7 @@
.modal-content_default {
background-color: #fefefe;
margin: 15% auto;
margin: 15% auto;s
padding: 20px;
border: 1px solid #888;
width: 380px;
@ -35,8 +35,7 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important;
}
margin-top: -30px !important; //search to up
</style>

View File

@ -70,7 +70,7 @@ public function applyLeave($update = null)
$user_id = user()->id;
$emp = $this->Emp_model->get_employee(user()->business_id);
$leave_master = $this->Leave_model->get_leave_master($business_id);
$leavetype = $this->Leave_model->getLeaveType($business_id);
$leavetype = $this->Leave_model->get_leave_master($business_id);
$this->layout->set('emp', $emp);
$this->layout->set('leave_master', $leave_master);
$this->layout->set('leavetype', $leavetype);
@ -103,7 +103,7 @@ public function get_leave_master_count()
public function get_emp_name()
{
$emp = $this->Leave_model->get_employee(user()->business_id);
$html = '<option>--Select Employee--</option>';
$html = '<option value="" >--Select Employee--</option>';
foreach($emp as $val)
{
if($val->user_id != user()->id)
@ -118,7 +118,7 @@ public function createLeave()
{
//permission type create part
if($this->input->post('type') === '9')
if(!empty($this->input->post('from_time')))
{
$perm_data = $this->input->post();
if(isset($perm_data['emp_id'])){

View File

@ -383,11 +383,12 @@ public function get_leave_master($business_id)
{
$this->db->select('*');
$this->db->from('leave_master');
$this->db->where('business_id', $business_id);
$this->db->where('(business_id = 0 OR business_id = ' . $business_id . ')');
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
$result = $query->result();
return $result;
}
public function get_leave_master_count($type_id, $business_id)

View File

@ -162,11 +162,11 @@
<label class="control-label col-md-2 col-sm-2 " for="last-name">Leave Type<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="type" name="type" required class="form-control" onclick="permission()" >
<select id="type" name="type" required class="form-control" onchange="permission(this.id)" >
<option value="">--Select--</option>
<?php foreach ($leavetype as $key => $value) { ?>
<option id="<?php echo $value->id; ?>" value="<?php echo $value->id; ?>"><?php echo $value->type; ?></option>
<option id="<?php echo $value->code; ?>" value="<?php echo $value->id; ?>"><?php echo $value->type; ?></option>
<?php } ?>
</select>
</div>
@ -209,7 +209,7 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<div class='input-group date'>
<input type='text' class="form-control" required name="perm_date" placeholder="DD-MM-YYYY" value="" id='myDatepicker'/></div>
<input type='text' class="form-control" required name="perm_date" placeholder="DD-MM-YYYY" value="" id='perm_id'/></div>
</div>
</div>
@ -217,15 +217,15 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<select class="custom-select" id="from_time" name=from_time required style="-webkit-appearance: none;">
<option>select time</option>
<select class="custom-select" id="from_time" name=from_time required >
<option value="">select time</option>
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">To<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<select id="to_time" class="custom-select" name="to_time" required>
<option>select time</option>
<option value="">select time</option>
</select>
</div>
@ -248,7 +248,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Leave/LeaveHistory" class="btn btn-secondary">Cancel</a>
<button type="submit" id="submit" class="btn btn-success">Submit</button>
</div>
</div>
@ -387,44 +387,41 @@ function get_all_count(id) {
</script>
<script>
$('#myDatepicker').datetimepicker({
format: 'DD.MM.YYYY'
});
</script>
<script>
$('#showtime').hide()
$('#showdate').hide()
function permission() {
var type = $('#type').val();
if( type === '9' ){
$('#type').change(function() {
$('#hidedate').hide();
$('#balance').hide();
$('#leave_bal').hide();
$('#fromdate').removeAttr('required');
$('#todate').removeAttr('required');
$('#showtime').show();
$('#showdate').show();
}
else{
var selectedOptionId = $(this).find(":selected").attr("id");
if( selectedOptionId === 'permission'){
$('#from_time').removeAttr('required');
$('#to_time').removeAttr('required');
$('#myDatepicker').removeAttr('required');
$('#hidedate').show();
$('#showtime').hide();
$('#showdate').hide();
$('#balance').show();
$('#leave_bal').show();
}
$('#hidedate').hide();
$('#balance').hide();
$('#leave_bal').hide();
$('#fromdate').removeAttr('required');
$('#todate').removeAttr('required');
$('#showtime').show();
$('#showdate').show();
$('#from_time').prop('required', true);
$('#to_time').prop('required', true);
}
else{
$('#from_time').removeAttr('required');
$('#to_time').removeAttr('required');
$('#perm_id').removeAttr('required');
$('#hidedate').show();
$('#showtime').hide();
$('#showdate').hide();
$('#balance').show();
$('#leave_bal').show();
$('#fromdate').prop('required', true);
$('#todate').prop('required', true);
}
});
</script>
@ -450,7 +447,7 @@ function permission() {
$('#leave_bal').val('');
$('#type').val('');
})
})
</script>
@ -511,6 +508,7 @@ function filterTimeSlots(startingTime, numberOfHours) {
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#fromdate");
var toDateInput = $("#todate");
var permissionDate = $("#perm_id");
fromDateInput.datepicker({
dateFormat: dateFormat,
@ -533,6 +531,15 @@ function filterTimeSlots(startingTime, numberOfHours) {
}
});
permissionDate.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
DateValidate();
}
});
function calculateDateDifference() {
var fromDate = fromDateInput.datepicker("getDate");
var toDate = toDateInput.datepicker("getDate");
@ -557,10 +564,15 @@ function calculateDateDifference() {
$('#subimt').click(function() {
let val = $('#user_dropdown').val()
console.log(val);
});
// $(document).ready(function() {
// $('#submit').click(function() {
// let selectedValue = $('#user_dropdown').val();
// alert(selectedValue);
// if(selectedValue = ""){
// }
// });
// });
</script>

View File

@ -1,160 +0,0 @@
<!-- Body page content -->
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Assign Leave</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<!-- <h6>General Information</h6> -->
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Leave/createLeave" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="last-name">Employee Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="emp_id" name="emp_id" required="required" class="form-control" >
<option value="">--Select--</option>
<?php foreach ($emp as $key => $value) { ?>
<option value="<?php echo $value->id; ?>"><?php echo $value->name; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="last-name">Leave Type<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="type" name="type" required="required" class="form-control" >
<option value="">--Select--</option>
<?php foreach ($leavetype as $key => $value) { ?>
<option id="<?php echo $value->id; ?>" value="<?php echo $value->type; ?>"><?php echo $value->type; ?></option>
<?php } ?>
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Leave Balance</label>
<div class="col-md-2 col-sm-2 ">
<input type="text" id="leave_bal" name="" value="" class="form-control " readonly>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> From Date<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<input id="from_date" name="from_date" value="" required="required" class="form-control" type="date" >
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">To Date<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<input id="to_date" name="to_date" value="" required="required" class="form-control" type="date" >
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="last-name">Comments</label>
<div class="col-md-5 col-sm-5">
<textarea id="comments" name="comments" value="" class="form-control" style="height:100px !important;" type="text" ></textarea>
</div>
</div>
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /Body page content -->
<script>
var id;
$('#emp_id').on('change', function() {
id = this.value;
});
$('#type').on('change',function() {
// var type_id = this.id;
var type_id = $('option:selected', this).attr('id');
if (id)
{
$.ajax({
type: "get",
url: "<?php echo base_url()?>Leave/get_leave_count/"+id+'_'+type_id,
success: function(response) {
response = JSON.parse(response);
console.log(response);
if(response.length == 0)
{
get_all_count(type_id);
}
else
{
$('#leave_bal').val(response[0].remaining_days);
}
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
}
else
{
$('#leave_bal').val("");
}
});
function get_all_count(id) {
$.ajax({
type: "get",
url: "<?php echo base_url()?>Leave/get_all_leave_count/"+id,
success: function(response) {
response = JSON.parse(response);
$('#leave_bal').val( response[0].days);
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
}
</script>

View File

@ -214,7 +214,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>Leave/LeaveHistory" class="btn btn-secondary">Cancel</a>
<button type="submit" id="submit" onclick="sweert()" class="btn btn-success">Update</button>
</div>
</div>

View File

@ -92,7 +92,7 @@
<td class=" "><?php echo $type->type; ?></td>
<td class=" "><?php echo $value->Risedby; ?></td>
<td class=" "><?php if($value->Risedby == ''){echo 'self'; }else{echo $value->Risedby; }; ?></td>
<?php if($value->no_of_days == 0){ ?>
<td class=" ">---</td>
<?php } else { ?>
@ -118,7 +118,7 @@
<?php if($value->status == 'pending') { ?>
<a><i class="fa fa-check approveleave" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve Leave" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a><i class="fa fa-check approveleave" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()" id="<?php echo $value->id; ?>"></i></a>&nbsp;
<?php } ?>
@ -229,18 +229,38 @@ function submitCustomPrompt() {
}
</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
$(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)'
}
}
});
],
"searching": true
});
});
</script>
<script>

View File

@ -24,7 +24,7 @@
<div class="x_title">
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Submmited for Approvel.<h2></html>',
text: '<html><h2>Submited for Approval.<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
@ -121,7 +121,7 @@
<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="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>
@ -180,16 +180,36 @@
</script>
<script>
$(document).ready(function() {
$(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
}
"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>

View File

@ -118,7 +118,7 @@
<?php } ?>
<td style=" text-align: center; font-size: 16px;">
<?php if($value->status == 'pending') { ?>
<a><i class="fa fa-check approveleave" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve Leave" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a><i class="fa fa-check approveleave" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" id= "<?php echo $value->id; ?>" onclick="showCustomPrompt()"></i></a>&nbsp;
<?php } ?>
</td>
@ -256,16 +256,36 @@ function submitCustomPrompt() {
</script>
<script>
$(document).ready(function() {
$(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
}
"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>

View File

@ -1,5 +1,9 @@
<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.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>
.status-success {
background-color: #c1ffc1;
@ -18,6 +22,10 @@
width: 300px;
height: 200px;
}
div.dataTables_wrapper div.dataTables_filter {
margin-top: -30px !important;
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
@ -35,7 +43,7 @@
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatable" class="table table-striped table-bordered" width="100%">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Name </th>
@ -124,4 +132,36 @@
});
});
</script>
<script>
$(document).ready(function() {
$('#datatables').DataTable({
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'Users',
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: 'Users',
exportOptions: {
columns: ':not(:last-child)'
}
}
]
});
});
</script>