13.07.2023 over all changes : Venkateshwaran

This commit is contained in:
venkateswaran ubuntu 2023-07-13 17:56:29 +05:30
parent c8124ee962
commit 34c6a2842d
31 changed files with 1404 additions and 617 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ application/logs/*
!application/logs/index.html
!application/logs/.htaccess
vendor
assets/uploads

View File

@ -35,7 +35,7 @@ public function __construct()
$this->load->model('Asset_model','Asset_model');
$this->load->model('Audit/audit_model','Audit_model');
$this->load->helper(array('form', 'url'));
// print_r($business);die();
//print_r($business);die();
}
@ -896,8 +896,8 @@ public function add_or_edit_ThirdPartyForm()
redirect('Asset/masterDataList');
} else {
$userData = $this->MY_Model->insert($action, $table);
if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
$this->session->set_flashdata('msg', $type);
// if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
// $this->session->set_flashdata('msg', $type);
redirect('Asset/masterDataList');
}
@ -932,8 +932,8 @@ public function add_or_edit_LocationForm()
redirect('Asset/masterDataList');
} else {
$userData = $this->MY_Model->insert($action, $table);
if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
$this->session->set_flashdata('msg', "location");
// if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
// $this->session->set_flashdata('msg', "location");
redirect('Asset/masterDataList');
}
@ -971,8 +971,8 @@ public function add_or_edit_CategoriesForm()
redirect('Asset/masterDataList');
} else {
$userData = $this->MY_Model->insert($action, $table);
if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
$this->session->set_flashdata('msg', "categories");
// if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
// $this->session->set_flashdata('msg', "categories");
redirect('Asset/masterDataList');
}
@ -1009,8 +1009,8 @@ public function add_or_edit_DepartmentForm()
redirect('Asset/masterDataList');
} else {
$userData = $this->MY_Model->insert($action, $table);
if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
$this->session->set_flashdata('msg', "department");
// if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
// $this->session->set_flashdata('msg', "department");
redirect('Asset/masterDataList');
}
@ -1059,8 +1059,8 @@ public function add_or_edit_LeaveForm()
redirect('Asset/masterDataList');
} else {
$userData = $this->MY_Model->insert($action, $table);
if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
$this->session->set_flashdata('msg', "leave");
// if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
// $this->session->set_flashdata('msg', "leave");
redirect('Asset/masterDataList');
}
@ -1108,8 +1108,8 @@ public function add_or_edit_DeclineForm()
redirect('Asset/masterDataList');
} else {
$userData = $this->MY_Model->insert($action, $table);
if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
$this->session->set_flashdata('msg', "decline");
// if($business->is_master_data_entered == 0){ $this->MY_Model->editBusiness(); }
// $this->session->set_flashdata('msg', "decline");
redirect('Asset/masterDataList');
}

View File

@ -26,7 +26,7 @@
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Days<a style="color:red;">*</a></label>
<div class="col-md-9 col-sm-9 ">
<input type="text" class="form-control" name="days" value="<?php if(isset($leave_data)) { echo $leave_data->days; } ?>" required>
<input type="text" class="form-control" name="days" value="<?php if(isset($leave_data)) { echo $leave_data->days; } ?>" onkeypress="validateKeyPress(event)" required>
</div>
</div>
@ -37,6 +37,18 @@
<button type="submit" class="btn btn-primary"><?php echo $submit_button_title; ?></button>
</div>
</form>
<script>
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[0-9]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
</script>
</div>
</div>

View File

@ -496,6 +496,7 @@
<input type="hidden" class="form-control" id="change_active" value="<?php echo $this->session->flashdata('msg'); ?>" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
@ -543,6 +544,7 @@
});
$(document).on('click','.manufacture',function(){
var id = $(this).attr("id")
if (id) {
var URL = "<?php echo base_url();?>Asset/getThirdPartyForm/"+id

View File

@ -51,7 +51,7 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<div class='input-group date'onclick="openDatePicker('fromdate')">
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="" required />
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="" required autocomplete="off" />
</div>
</div>
@ -59,7 +59,7 @@
<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-3 col-sm-3 ">
<div class='input-group date' onclick="openDatePicker('todate')">
<input type='text' class="form-control input-field" placeholder="DD-MM-YYYY " id="todate" name= "to_date" value="" required />
<input type='text' class="form-control input-field" placeholder="DD-MM-YYYY " id="todate" name= "to_date" value="" required autocomplete="off"/>
</div>
</div>
@ -114,6 +114,8 @@
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
toDateInput.datepicker("option", "minDate", dateText);
validateDateRange();
@ -122,6 +124,8 @@
toDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
validateDateRange();
}

View File

@ -22,7 +22,7 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search to up
margin-top: -30px !important; //search to up
@ -53,9 +53,10 @@
<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%">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<tr class="headings">
<th hidden class="column-title">id</th>
<th class="column-title">Delegate Duration</th>
<th class="column-title">Delegated To </th>
<th class="column-title"> Delegation Date </th>
@ -68,7 +69,7 @@
<?php if(user()->id == $value->emp_id) { ?>
<tr class="even pointer">
<td hidden > <?php echo $value->id;?> </td>
<td class=" "><?php echo $value->from_date;?> to <?php echo $value->to_date;?> </td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->delegated_to; ?>)</td>
<td class=" "> <?php echo $value->delegated_at;?> </td>
@ -108,6 +109,19 @@
<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>
$(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>

View File

@ -62,7 +62,7 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<div class='input-group date'>
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="<?php echo $data->from_date ?>" required />
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="<?php echo $data->from_date ?>" required autocomplete="off"/>
</div>
</div>
@ -70,7 +70,7 @@
<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-3 col-sm-3 ">
<div class='input-group date' >
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date" value="<?php echo $data->to_date ?>" required />
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date" value="<?php echo $data->to_date ?>" required autocomplete="off"/>
</div>
</div>
@ -131,6 +131,8 @@
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
toDateInput.datepicker("option", "minDate", dateText);
validateDateRange();
@ -139,6 +141,8 @@
toDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
validateDateRange();
}

View File

@ -123,12 +123,15 @@ public function createEmp()
'email' => $this->input->post('email'),
'user_name' => $this->input->post('user_name'),
'mobile' => $this->input->post('mobile'),
'is_active'=> 1,
'password' => hash_password($this->input->post('password'))
);
$table="users";
$create_user = $this->MY_Model->insert($data,$table);
$user_insert_id = $this->db->insert_id();
//audit
if($create_user)
@ -174,7 +177,31 @@ public function createEmp()
$table="employees";
$create_emp_details = $this->MY_Model->insert($data,$table);
}
//print_r($this->db->last_query());
$emp_insert_id = $this->db->insert_id();
$joining_year = date('Y', strtotime($this->input->post('j_date')));
$joining_month = date('m', strtotime($this->input->post('j_date')));
$all_leave_count = $this->Emp_model->get_leave_type(user()->business_id);
$joining_month_total = (12 - $joining_month) + 1 ;
//echo $joining_month_total; die();
foreach ($all_leave_count as $key => $value) {
$remaining_days = ceil(((int)$value->days / 12) * $joining_month_total);
if($value->id != '9'){
$days['remaining_days'] = $remaining_days;
$days['business_id'] = user()->business_id;
$days['emp_id'] = $user_insert_id;
$days['total_days'] = $remaining_days;
$days['type'] = $value->id;
$days['year'] = $joining_year;
$this->MY_Model->insert($days,'emp_leave_days');
}
}
}
//audit
if($create_emp_details)
{
@ -186,7 +213,7 @@ public function createEmp()
//audit history generation for insert
$test = $this->audit->create_history('insert');
}
redirect('Employee/addEmployee');
redirect('Employee/empList');
}

View File

@ -10,6 +10,7 @@ public function get_employee($business_id)
$this->db->where('users.business_id', $business_id);
$this->db->where('users.is_active', 1);
$this->db->where('employees.is_active', 1);
$this->db->order_by('users.id', 'desc');
$query = $this->db->get();
if ($query->num_rows() > 0) {
@ -76,5 +77,26 @@ public function get_manager_name($manager_id)
return $query->result();
}
public function get_user_data_by_insert_id($insert_id)
{
$this->db->select('*');
$this->db->from('users');
$this->db->join('employees', 'users.id = employees.user_id');
$this->db->where('users.id', $insert_id);
$query = $this->db->get();
$result = $query->result();
}
public function get_leave_type($business_id)
{
$this->db->select('*');
$this->db->from('leave_master');
$this->db->where('business_id', $business_id);
$query = $this->db->get();
return $query->result();
}
}

View File

@ -1,6 +1,13 @@
<!-- Body page content -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<div class="">
@ -56,6 +63,7 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name">Department<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="department" name="department" required="required" class="form-control" >
<option value="">--Select--</option>
<option value="<?php if(isset($editData)) { echo $editData->department; } ?>"><?php if(isset($assetData)) { echo $editData->department; } ?></option>
<?php foreach ($departmentData as $key => $value) { ?>
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
@ -64,10 +72,33 @@
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="email">Join date<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date" value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control" type="text" required placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" autocomplete="off">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control">
<option value="">--Select--</option>
<?php foreach ($manager 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="email"> Gender<a style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label>
<div class="col-md-5 col-sm-5 " style="padding:10px;">
<input type="radio" name="gender" value="male" />Male
<input type="radio" name="gender" value="female" />Female
@ -81,8 +112,7 @@
<option value="married">Married</option>
<option value="others">Others</option>
</select>
</div>
</div>
</div>
<div class="item form-group">
@ -102,7 +132,7 @@
<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>
</div>
</div>
</div>
@ -137,7 +167,7 @@
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
<div class="col-md-5 col-sm-5 ">
<input id="relation_tel" name="relation_tel" onkeypress = "return matchnum(event)" value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>" class="form-control" type="text" >
<input id="relation_tel" name="relation_tel" onkeypress = "return matchnum(event)" value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>" class="form-control" type="text">
</div>
</div>
@ -189,11 +219,6 @@
<div class="col-md-5 col-sm-5 ">
<input type="text" id="employee_id" name="emp_id" value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email">Join date</label>
<div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date" value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control" type="date" >
</div>
</div>
@ -215,19 +240,9 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
<div class="col-md-5 col-sm-5 ">
<input type="file" id="image" name="image" value="<?php if(isset($editData)) { echo $editData->profile_pic; } ?>" class="form-control ">
<input type="file" id="image" name="image" value="<?php if(isset($editData)) { echo $editData->profile_pic; } ?>" class="form-control typeFile" onchange="validateFile(this)" accept="image/png, image/jpeg, image/jpg, application/pdf">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="" >
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control">
<option value="">--Select--</option>
<?php foreach ($manager as $key => $value) { ?>
<option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
@ -237,7 +252,6 @@
<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 class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
@ -290,4 +304,70 @@ function validateKeyPress(event) {
reader.readAsDataURL(file);
}
});
</script>
</script>
<script>
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#j_date");
console.log(fromDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
yearRange: "1990:c",
maxDate: new Date(),
onSelect: function (dateText, inst) {
}
});
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z._/]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
</script>
<script>
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension)) {
// Invalid file type
new PNotify({
text: 'Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.',
type: 'error',
styling: 'bootstrap3'
});
input.value = "";
return;
}
if (fileExtension === "pdf") {
// Preview PDF
const reader = new FileReader();
reader.onload = function(e) {
const pdfObject = `<embed src="${e.target.result}" width="500" height="600" type="application/pdf">`;
document.getElementById("previewContainer").innerHTML = pdfObject;
};
reader.readAsDataURL(file);
} else {
// Preview image
const reader = new FileReader();
reader.onload = function(e) {
const imageObject = `<img src="${e.target.result}" alt="Preview" width="500">`;
document.getElementById("previewContainer").innerHTML = imageObject;
};
reader.readAsDataURL(file);
}
}
</script>

View File

@ -1,8 +1,5 @@
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-dialog modal-sm" style="z-index: 0 !important;">
<div class="modal-content" style="height:170px;">
<div class="modal-header">
<h6 class="modal-title" id="myModalLabel2">Are you sure you want to delete</h6>

View File

@ -1,5 +1,11 @@
<!-- Body page content -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@ -71,9 +77,31 @@
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="email"> Joining Date<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date" value="<?php if(isset($editData)) { echo $editData->j_date; } ?>" class="form-control" type="text" placeholder="DD-MM-YYYY" required onkeypress="validateKeyPress(event)" autocomplete="off">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control">
<?php foreach ($manager_name as $key => $val) { ?>
<option value="<?php echo $val->id; ?>"><?php echo $val->name; ?></option>
<?php foreach ($manager as $key => $value) { ?>
<?php if ($val->name !== $value->name) { ?>
<option value="<?php echo $value->user_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="email"> Gender<a style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label>
<div class="col-md-5 col-sm-5 " style="padding:10px;">
<?php
if ($editData->gender == 'male')
@ -194,11 +222,6 @@
<div class="col-md-5 col-sm-5 ">
<input type="text" id="emp_id" name="emp_id" value="<?php if(isset($editData)) { echo $editData->emp_id; } ?>"class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Joining Date</label>
<div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date" value="<?php if(isset($editData)) { echo $editData->j_date; } ?>" class="form-control" type="date" >
</div>
</div>
@ -220,21 +243,9 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
<div class="col-md-5 col-sm-5 ">
<input type="file" id="image" name="image" value="<?php if(isset($editData->profile_pic)) { echo $editData->profile_pic; } ?>" class="form-control ">
<input type="file" id="image" name="image" value="<?php if(isset($editData->profile_pic)) { echo $editData->profile_pic; } ?>" class="form-control " onchange="validateFile(this)">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="<?php echo base_url();?>/assets/uploads/<?php echo $editData->profile_pic ?>" alt="Avatar" title="Change the avatar">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control">
<?php foreach ($manager_name as $key => $val) { ?>
<option value="<?php echo $val->name; ?>"><?php echo $val->name; ?></option>
<?php foreach ($manager as $key => $value) { ?>
<?php if ($val->name !== $value->name) { ?>
<option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option>
<?php } } } ?>
</select>
</div>
</div>
</div>
@ -273,7 +284,13 @@
</div>
</div>
</div>
<script>
$('#myDatepicker').datetimepicker({
format: 'DD.MM.YYYY'
});
</script>
<script>
function matchnum(event)
@ -310,4 +327,60 @@ function validateKeyPress(event) {
}
});
</script>
<script>
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#j_date");
console.log(fromDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
maxDate: new Date(),
onSelect: function (dateText, inst) {
}
});
</script>
<script>
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension)) {
// Invalid file type
new PNotify({
text: 'Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.',
type: 'error',
styling: 'bootstrap3'
});
input.value = "";
return;
}
if (fileExtension === "pdf") {
// Preview PDF
const reader = new FileReader();
reader.onload = function(e) {
const pdfObject = `<embed src="${e.target.result}" width="500" height="600" type="application/pdf">`;
document.getElementById("previewContainer").innerHTML = pdfObject;
};
reader.readAsDataURL(file);
} else {
// Preview image
const reader = new FileReader();
reader.onload = function(e) {
const imageObject = `<img src="${e.target.result}" alt="Preview" width="500">`;
document.getElementById("previewContainer").innerHTML = imageObject;
};
reader.readAsDataURL(file);
}
}
</script>
<!-- /Body page content -->

View File

@ -1,4 +1,9 @@
<head>
<style>
div.dataTables_wrapper div.dataTables_filter{
margin-top: -30px !important; //search move to up
}
</style>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
</head>
<div class="col-md-12 col-sm-12 ">
@ -13,9 +18,10 @@
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatable-buttons" class="table table-striped table-bordered" width="100%">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<tr class="headings">
<th hidden >id</th>
<th class="column-title">Name </th>
<th class="column-title">Email </th>
<th class="column-title">Mobile </th>
@ -28,6 +34,7 @@
<?php if (!is_null($tableData)) {
foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td hidden ><?php echo $value->id; ?> </td>
<td class=" "> <?php echo $value->name; ?> </td>
<!-- <?php if (is_superadmin()) { ?>
<td class=" "> <?php echo $value->business ?> </td>
@ -96,6 +103,20 @@
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
});
</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>

View File

@ -197,9 +197,16 @@ public function expence_list()
}
public function getDeleteConfirmationPopup()
{
$data = array();
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
echo json_encode($htmlPage);
}
public function Approve_Expence()
{
$id=$this->input->get('id');
$id=$this->input->post('id');
$action['status'] = 'Approved';
$action['approved_by']= user()->name;
$action['approved_at'] = date('d-m-Y H:i:s');
@ -224,7 +231,7 @@ public function manager_approvel_list()
public function Manager_Approvel()
{
$id=$this->input->get('id');
$id=$this->input->post('id');
$action['status'] = 'Approved';
$action['approved_by']= user()->name;
$action['approved_at'] = date('d-m-Y H:i:s');

View File

@ -0,0 +1,26 @@
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="myModalLabel2">Are you sure you want to delete</h6>
<button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
</div>
</br>
<center>
<form class="delete_url" method="post" action="" id="">
<button type="button" class="btn btn-sm btn-secondary" id="close-form" data-dismiss="modal" aria-label="Close">No</button>
&nbsp; &nbsp; &nbsp; &nbsp;
<input type="hidden" class="delete_id" name="id" value="">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>" >
<button type="submit" class="btn btn-sm btn-primary" id="">Yes</button>
</form>
</center>
</br>
</div>
</div>

View File

@ -11,6 +11,14 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<div class="">
@ -75,9 +83,7 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name"> Date of expence<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<div class='input-group date'>
<input type='text' placeholder="DD-MM-YYYY" class="form-control" id='myDatepicker' required name="date_of_expence" value="<?php echo $data->date_of_expence; ?>" />
</div>
<input type='text' placeholder="DD-MM-YYYY" class="form-control" id='ExpenseDate' required name="date_of_expence" value="<?php echo $data->date_of_expence; ?>" />
</div>
</div>
@ -207,9 +213,19 @@ function validateFile(input) {
});
$('#myDatepicker').datetimepicker({
format: 'DD.MM.YYYY'
});
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#ExpenseDate");
console.log(fromDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
yearRange: "1990:c",
onSelect: function (dateText, inst) {
}
});
</script>

View File

@ -34,7 +34,7 @@
cursor: pointer;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search to up
margin-top: -30px !important; //search to up
}
.alert-success {
@ -94,9 +94,10 @@
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatable-buttons" class="table table-striped table-bordered" width="100%">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th hidden class="column-title">id</th>
<th class="column-title">Claim Date </th>
<th class="column-title">Desription</th>
<th class="column-title">Expense Date</th>
@ -110,6 +111,7 @@
<?php foreach ($tableData as $key => $value) { ?>
<?php if(user()->id == $value->emp_id) { ?>
<tr class="even pointer">
<td hidden class=" "><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time;?></td>
<td class=" "><?php echo $value->comments; ?></td>
<td class=" "> <?php echo dateFormat('d-m-Y',$value->date_of_expence);?></td>
@ -186,6 +188,18 @@ function openModal(itemId) {
}
}
</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>

View File

@ -10,6 +10,14 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.alert-success {
@ -32,6 +40,38 @@
appearance: none;
background-image: none;
}
.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;
}
.preview-item {
width: 100%;
margin-right: 10px;
margin-bottom: 10px;
}
.preview-item img,
.preview-item object {
width: 290px;
height: 280px;
}
</style>
<div class="clearfix"></div>
@ -62,7 +102,7 @@
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " for="last-name">Expense Requisted For</label>
<label class="control-label col-md-2 col-sm-2" for="last-name">Expense Requisted For</label>
<div class="col-md-5 col-sm-5 ">
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
@ -76,6 +116,7 @@
<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>
@ -85,9 +126,7 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<div class='input-group date' >
<input type='text' id='myDatepicker' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence" value="" />
</div>
<input type='text' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence" value="" autocomplete='off' />
</div>
</div>
@ -97,7 +136,7 @@
<label class="control-label col-md-2 col-sm-2 " 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 if(isset($assetData)) { echo $assetData->cost; } ?>" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name">
<input id="cost" name="amount" required value="<?php if(isset($assetData)) { echo $assetData->cost; } ?>" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
</div>
@ -105,7 +144,7 @@
<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">
<div class="col-md-5 col-sm-3">
<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="">
@ -121,11 +160,11 @@
<input id="formFile" name="bill" onchange="validateFile(this)" class="typeFile" type="file" value="">
</div>
</div>
<div class="item form-group">
<!-- <div class="item form-group">
<div class="col-md-2 col-sm-2 ">
<div id="previewContainer" style="text-align:center;"></div>
</div>
</div>
</div> -->
<!-- <div class="item form-group">
@ -179,7 +218,7 @@
<script>
<!-- <script>
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
@ -192,8 +231,24 @@ function validateFile(input) {
}
</script>
-->
<script>
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#ExpenseDate");
console.log(fromDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
yearRange: "1990:c",
onSelect: function (dateText, inst) {
}
});
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
@ -299,6 +354,7 @@ function matchnum(event)
console.log(manager_id);
$("#manager_id").val(manager_id);
})
@ -313,5 +369,75 @@ function PreviewImage() {
};
};
</script> -->
<script>
function handleFiles(files) {
const dropZone = document.getElementById('drop-zone');
const previewContainer = document.getElementById('preview-container');
previewContainer.innerHTML = '';
for (let i = 0; i < files.length; i++) {
const file = files[i];
const reader = new FileReader();
reader.onload = function(e) {
const previewItem = document.createElement('div');
previewItem.className = 'preview-item';
if (file.type.startsWith('image/')) {
const img = document.createElement('img');
img.src = e.target.result;
previewItem.appendChild(img);
} else if (file.type === 'application/pdf') {
const obj = document.createElement('object');
obj.data = e.target.result;
obj.type = 'application/pdf';
obj.width = '100%';
obj.height = '200';
previewItem.appendChild(obj);
}
previewContainer.appendChild(previewItem);
};
reader.readAsDataURL(file);
}
dropZone.classList.remove('dragover');
}
function handleDragOver(e) {
e.preventDefault();
const dropZone = document.getElementById('drop-zone');
dropZone.classList.add('dragover');
}
function handleDragLeave(e) {
e.preventDefault();
const dropZone = document.getElementById('drop-zone');
dropZone.classList.remove('dragover');
}
function initializeDropZone() {
const dropZone = document.getElementById('drop-zone');
const fileInput = document.getElementById('file-input');
dropZone.addEventListener('dragover', handleDragOver);
dropZone.addEventListener('dragleave', handleDragLeave);
dropZone.addEventListener('drop', function(e) {
e.preventDefault();
const files = e.dataTransfer.files;
handleFiles(files);
});
fileInput.addEventListener('change', function(e) {
const files = e.target.files;
handleFiles(files);
});
}
initializeDropZone();
</script>

View File

@ -7,7 +7,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<style>
.design {
.modal_default {
display: none;
position: fixed;
z-index: 1;
@ -19,9 +19,9 @@
background-color: rgba(0, 0, 0, 0.4);
}
.design-form {
.modal-content_default {
background-color: #fefefe;
margin: 15% auto;
margin: 15% auto;s
padding: 20px;
border: 1px solid #888;
width: 380px;
@ -34,16 +34,16 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search to up
margin-top: -30px !important; //search to up
</style>
<style>
/* Modal Popup Styles */
.modal {
.modal_default {
display: none; /* Hide the modal by default */
position: fixed;
z-index: 1;
/* z-index: 1;*/
left: 0;
top: 0;
width: 100%;
@ -52,7 +52,7 @@
background-color: rgba(0, 0, 0, 0.9);
}
.modal img {
.modal_default img {
display: block;
margin: 0 auto;
max-width: 80%;
@ -71,7 +71,7 @@
cursor: pointer;
}
.modal-content {
.modal-content_default {
background-color: #fefefe;
margin: 15% auto;
padding: 30px;
@ -97,10 +97,11 @@
<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%">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Claim Date</th>
<tr class="headings">
<th hidden class="column-title">id</th>
<th class="column-title">Claim Date</th>
<th class="column-title">Employee Name</th>
<th class="column-title">Description </th>
<th class="column-title">Expense Date</th>
@ -113,7 +114,7 @@
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td hidden><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time;?></td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->emp_id; ?>) </td>
<td class=" "><?php echo $value->comments; ?></td>
@ -146,7 +147,7 @@
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Expence/Approve_Expence')?>?id=<?php echo $value->id;?> "><i class="fa fa-check" aria-hidden="true"title="Approve" onclick = "return alert()" ></i></a> &nbsp;
<a><i class="fa fa-check approveexpense" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve Expense" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
@ -164,8 +165,8 @@
</div>
</div>
<div id="customPrompt" class="modal">
<div class="modal-content ">
<div id="customPrompt" class="modal modal_default">
<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" />
@ -182,9 +183,30 @@
<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>
$('.approveexpense').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Expence/Approve_Expence";
$.ajax({
url: "<?php echo base_url()?>Expence/getDeleteConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
$('.delete_id').attr('value',id);
$('.delete_url').attr('action',url);
}
});
});
</script>
<script>
@ -220,7 +242,7 @@ function submitCustomPrompt() {
</script>
</div>
<div id="myModal" class="modal">
<div id="myModal" class="modal modal_default">
<span class="close">&times;</span>
<img id="modalImage" src="" alt="Image">
</div>
@ -260,6 +282,18 @@ function alert()
})
}
</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>

View File

@ -7,12 +7,44 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></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;s
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; //search to up
</style>
<style>
/* Modal Popup Styles */
.modal {
.modal_default {
display: none; /* Hide the modal by default */
position: fixed;
z-index: 1;
/* z-index: 1;*/
left: 0;
top: 0;
width: 100%;
@ -21,7 +53,7 @@
background-color: rgba(0, 0, 0, 0.9);
}
.modal img {
.modal_default img {
display: block;
margin: 0 auto;
max-width: 80%;
@ -40,7 +72,7 @@
cursor: pointer;
}
.modal-content {
.modal-content_default {
background-color: #fefefe;
margin: 15% auto;
padding: 30px;
@ -49,16 +81,6 @@
height: 280px;
text-align: center;
}
button {
margin-top: 10px;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search to up
}
</style>
</head>
@ -74,9 +96,10 @@
<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%">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<tr class="headings">
<th hidden class="column-title">id</th>
<th class="column-title">Claim Date</th>
<th class="column-title">Employee Name</th>
<th class="column-title">Description </th>
@ -94,7 +117,7 @@
<?php if(user()->id == $value->manager){ ?>
<tr class="even pointer">
<td hidden><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time;?></td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->emp_id; ?>)</td>
<td class=" "><?php echo $value->comments; ?></td>
@ -126,7 +149,7 @@
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Expence/Manager_Approvel')?>?id=<?php echo $value->id;?> "><i class="fa fa-check" aria-hidden="true"title="Approve" onclick = "return confirm('Are you sure to Approve This Claim')"></i></a> &nbsp;
<a><i class="fa fa-check approveexpense" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve Expense" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
@ -144,7 +167,7 @@
<?php if(user()->id == $val->delegated_to && date('d-m-Y') >= $val->from_date && date('d-m-Y') <= $val->to_date && $value->created_date >= $val->from_date && $value->created_date <= $val->to_date) { ?>
<tr class="even pointer">
<td hidden><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time;?></td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->emp_id; ?>)</td>
<td class=" "><?php echo $value->comments; ?></td>
@ -176,7 +199,7 @@
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Expence/Manager_Approvel')?>?id=<?php echo $value->id;?> "><i class="fa fa-check" aria-hidden="true"title="Approve" onclick = "return confirm('Are you sure to Approve This Claim')"></i></a> &nbsp;
<a><i class="fa fa-check approveexpense" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve Expense" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
@ -197,8 +220,8 @@
</div>
</div>
<div id="customPrompt" class="modal">
<div class="modal-content ">
<div id="customPrompt" class="modal modal_default">
<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" />
@ -215,9 +238,30 @@
<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>
$('.approveexpense').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Expence/Manager_Approvel";
$.ajax({
url: "<?php echo base_url()?>Expence/getDeleteConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
$('.delete_id').attr('value',id);
$('.delete_url').attr('action',url);
}
});
});
</script>
<script>
@ -252,7 +296,7 @@ function submitCustomPrompt() {
</script>
</div>
<div id="myModal" class="modal">
<div id="myModal" class="modal modal_default">
<span class="close">&times;</span>
<img id="modalImage" src="" alt="Image">
</div>
@ -272,6 +316,18 @@ function openModal(itemId) {
}
}
</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>

View File

@ -67,11 +67,7 @@
<script src="<?php echo base_url(); ?>/assets/default/pnotify/dist/pnotify.buttons.js"></script>
<script src="<?php echo base_url(); ?>/assets/default/pnotify/dist/pnotify.nonblock.js"></script>
<!-- bootstrap-daterangepicker -->

View File

@ -55,21 +55,27 @@ public function leaveList()
$business_id = user()->business_id;
$leave_list = $this->Leave_model->get_leave_with_emp_name(user()->business_id);
$leave_type = $this->Leave_model->get_leave_type($business_id);
$decline_dropdown = $this->Leave_model->decline_dropdown($business_id);
$this->layout->set('tableData', $leave_list);
$this->layout->set('leave_type', $leave_type);
$this->layout->set('dropdown', $decline_dropdown);
$this->layout->buffer('main_content', 'Leave/leave_list');
$this->layout->render('Employee_Layout');
}
public function applyLeave()
public function applyLeave($update = null)
{
$business_id = user()->business_id;
$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);
$this->layout->set('emp', $emp);
$this->layout->set('leave_master', $leave_master);
$this->layout->set('leavetype', $leavetype);
if($update == null)
$this->session->set_flashdata('error', 0);
$this->layout->buffer('main_content', 'Leave/apply_leave');
$this->layout->render('Employee_Layout');
@ -79,14 +85,25 @@ public function get_emp_leave_count()
{
$business_id = user()->business_id;
$emp_id = $this->input->get('emp_id');
$emp_leave_count = $this->Leave_model->get_count($emp_id, $business_id);
$type_id = $this->input->get('type_id');
$emp_leave_count = $this->Leave_model->get_count($emp_id, $business_id, $type_id);
echo json_encode($emp_leave_count);
}
public function get_leave_master_count()
{
$business_id = user()->business_id;
$type_id = $this->input->get('type_id');
// $year = $this->input->get('fromDate');
// $emp_id = $this->input->get('emp_id');
$emp_leave_count = $this->Leave_model->get_leave_master_count($type_id, $business_id);
echo json_encode($emp_leave_count);
}
public function get_emp_name()
{
$emp = $this->Leave_model->get_employee(user()->business_id);
$html = '<option>--select Employee--</option>';
$html = '<option>--Select Employee--</option>';
foreach($emp as $val)
{
if($val->user_id != user()->id)
@ -99,8 +116,9 @@ public function get_emp_name()
public function createLeave()
{
//permission type create part
if($this->input->post('type') === 'Permission')
if($this->input->post('type') === '9')
{
$perm_data = $this->input->post();
if(isset($perm_data['emp_id'])){
@ -131,11 +149,18 @@ public function createLeave()
$perm_data['created_time'] = date('H:i A');
$table="leave_list";
$create_permission = $this->MY_Model->insert($perm_data,$table);
$this->session->set_flashdata('Success', 'Submitted for Approval');
$this->session->set_flashdata('Success', '1');
redirect('Leave/LeaveHistory');
}
//end of permission
//Leave create part
$data = $this->input->post();
unset($data['perm_date']);
unset($data['from_time']);
unset($data['to_time']);
if(isset($data['emp_id'])){
$emp_id =$this->input->post('emp_id');
}else{
@ -163,33 +188,78 @@ public function createLeave()
$data['status'] = 'pending';
$data['created_date'] = date('d-m-Y');
$data['created_time'] = date('H:i A');
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days");
$leave_year = date('Y', strtotime($this->input->post('from_date')));
//get employee's leave count
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
// count number of days between two dates
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
$data['no_of_days'] = $days_between + 1;
$data['no_of_days'] = $days_between + 1;
$noofdays = $days_between + 1;
//this part is create and update leave data
if (count($emp_leave_count) != 0)
{
if($noofdays > $emp_leave_count[0]->remaining_days)
{
$this->session->set_flashdata('error', '1');
redirect('Leave/applyLeave/'.'update');
}
else
{
//this part is update if date inculeded in emp_leave_days table
$data['leave_bal'] = $emp_leave_count[0]->remaining_days;
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
}
}
else
{
if($noofdays > $leave_master_count[0]->days && $get_from_date > 0)
{
$this->session->set_flashdata('error', '1');
redirect('Leave/applyLeave/'.'update');
}
else
{
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
$data['leave_bal'] = $all_leave_count[0]->days;
$days['remaining_days'] = $all_leave_count[0]->days;
$days['business_id'] = user()->business_id;
$days['emp_id'] = $emp_id;
$days['total_days'] = $all_leave_count[0]->days;
$days['type'] = $all_leave_count[0]->id;
$days['year'] = $leave_year;
$this->MY_Model->insert($days,'emp_leave_days');
}
}
$get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
$get_emp_join_date = $this->Leave_model->get_emp_join_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
//print_r($get_emp_join_date); die;
if( $get_emp_join_date == 0 && $get_from_date == 0)
{
$data['leave_bal'] = $emp_leave_count[0]->remaining_days;
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
$this->Leave_model->update($days , $emp_id , 'emp_leave_days');
$table="leave_list";
$create_leave = $this->MY_Model->insert($data,$table);
}
else
{
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
$data['leave_bal'] = $all_leave_count[0]->days;
$days['remaining_days'] = $all_leave_count[0]->days;
$days['business_id'] = user()->business_id;
$days['emp_id'] = $emp_id;
$days['total_days'] = $all_leave_count[0]->days;
$days['type'] = $all_leave_count[0]->id;
$this->MY_Model->insert($days,'emp_leave_days');
$this->session->set_flashdata('error', '1');
redirect('Leave/applyLeave/'.'update');
}
$table="leave_list";
$create_leave = $this->MY_Model->insert($data,$table);
//audit
if($create_leave)
@ -202,11 +272,28 @@ public function createLeave()
//audit history generation for insert
$test = $this->audit->create_history('insert');
}
$this->session->set_flashdata('Success', 'Submitted for Approval');
$this->session->set_flashdata('Success', '1');
redirect('Leave/LeaveHistory');
}
// public function get_from_to_date_count()
// { if($this->input->get('emp_id') == "")
// {
// $emp_id = user()->id;
// }
// else
// {
// $emp_id = $this->input->get('emp_id');
// }
// //$emp_id = $this->input->get('emp_id');
// $fromDate = $this->input->get('fromDate');
// $toDate = $this->input->get('toDate');
// $get_from_date = $this->Leave_model->get_from_date($emp_id, $fromDate, $toDate);
// print_r($get_from_date); die();
// }
@ -228,7 +315,8 @@ public function edit_leave_function()
public function editleave()
{
if($this->input->post('type') === 'Permission')
if($this->input->post('type') === '9')
{
$action = $this->input->post();
unset($action['from_date']);
@ -253,7 +341,7 @@ public function editleave()
$action['created_time'] = date('H:i A');
$table="leave_list";
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
$this->session->set_flashdata('Success', 'Permission Updated Sucessfully');
$this->session->set_flashdata('update', '0');
redirect('Leave/LeaveHistory');
}
@ -269,71 +357,117 @@ public function editleave()
$action['emp_id'] = $emp_id;
$action['business_id'] = user()->business_id;
$action['status'] = 'pending';
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days");
$leave_year = date('Y', strtotime($this->input->post('from_date')));
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
// count number of days between two dates
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
$action['no_of_days'] = $days_between + 1;
$noofdays = $days_between + 1;
if (count($emp_leave_count) != 0)
$leave_id = $this->input->post('id');
if (count($emp_leave_count) != 0)
{
if($noofdays > $emp_leave_count[0]->remaining_days)
{
$this->session->set_flashdata('error', '1');
redirect('Leave/edit_leave_function?id='.md5($leave_id));
}
else
{
//this part is update if date inculeded in emp_leave_days table
$action['leave_bal'] = $emp_leave_count[0]->remaining_days;
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
}
}
else
{
if($noofdays > $leave_master_count[0]->days)
{ $this->session->set_flashdata('error', '1');
redirect('Leave/edit_leave_function?id='.md5($leave_id));
}
else
{
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
$data['leave_bal'] = $all_leave_count[0]->days;
$days['remaining_days'] = $all_leave_count[0]->days;
$days['business_id'] = user()->business_id;
$days['emp_id'] = $emp_id;
$days['total_days'] = $all_leave_count[0]->days;
$days['type'] = $all_leave_count[0]->id;
$days['year'] = $leave_year;
$this->MY_Model->insert($days,'emp_leave_days');
}
}
$get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
// echo "<pre>";
// print_r($get_from_date); die();
if($get_from_date == 0)
{
$action['leave_bal'] = $emp_leave_count[0]->remaining_days;
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
$this->Leave_model->update($days , $emp_id , 'emp_leave_days');
$table="leave_list";
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
$this->session->set_flashdata('update', '0');
redirect('Leave/LeaveHistory');
}
else
{
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
$action['leave_bal'] = $all_leave_count[0]->days;
$days['remaining_days'] = $all_leave_count[0]->days;
$days['business_id'] = user()->business_id;
$days['emp_id'] = $emp_id;
$days['total_days'] = $all_leave_count[0]->days;
$days['type'] = $all_leave_count[0]->id;
$this->MY_Model->update($days,'emp_leave_days');
$this->session->set_flashdata('error', '1');
redirect('Leave/applyLeave/'.'update');
}
$table="leave_list";
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
$this->session->set_flashdata('Success', 'Leave Updated Successfully');
redirect('Leave/LeaveHistory');
}
public function get_leave_count($id)
public function get_leave_count()
{
$str = $id;
$res = preg_split('~[_]+~', $str, 0, PREG_SPLIT_NO_EMPTY);
$emp_leave_count = $this->Leave_model->get_leave_based_on_tpye($res[0] , $res[1] , user()->business_id , "emp_leave_days");
$id = $this->input->get('id');
$type_id = $this->input->get('type_id');
$year = date('Y');
$emp_leave_count = $this->Leave_model->get_leave_based_on_tpye($id, $type_id, user()->business_id, "emp_leave_days", $year);
echo json_encode($emp_leave_count);
}
public function get_all_leave_count($id)
public function get_all_leave_count()
{
$id = $this->input->get('type_id');
$all_leave_count = $this->Leave_model->get_id( $id , user()->business_id , "leave_master");
echo json_encode($all_leave_count);
}
public function ApproveLeave()
public function getDeleteConfirmationPopup()
{
$id=$this->input->get('id');
$emp_id = $this->Leave_model->get_emp_id($id);
$no_of_days = $this->Leave_model->get_Leave_nodays($emp_id);
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id);
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
$data = array();
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
echo json_encode($htmlPage);
}
public function ApproveLeave()
{
$id=$this->input->post('id');
$business_id = user()->business_id;
$emp_id = $this->Leave_model->get_emp_id($id);
$no_of_days = $this->Leave_model->get_Leave_nodays($id,);
$leave_year = date('Y', strtotime($no_of_days->from_date));
//print_r($no_of_days); die('approveleave');
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
$this->Leave_model->emp_leave_days_update($emp_id, $days);
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
$data['status'] = 'Approved';
$data['approved_by']= user()->name;
@ -342,24 +476,32 @@ public function ApproveLeave()
redirect('Leave/leaveList');
}
public function getManagerConfirmationPopup()
{
$data = array();
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
echo json_encode($htmlPage);
}
public function ManagerLeaveApprove()
{
$id=$this->input->get('id');
$id=$this->input->post('id');
$business_id = user()->business_id;
$emp_id = $this->Leave_model->get_emp_id($id);
$no_of_days = $this->Leave_model->get_Leave_nodays($emp_id);
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id);
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
$no_of_days = $this->Leave_model->get_Leave_nodays($id,);
$leave_year = date('Y', strtotime($no_of_days->from_date));
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
$this->Leave_model->emp_leave_days_update($emp_id, $days);
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
$data['status'] = 'Approved';
$data['approved_by']= user()->name;
$data['approved_at'] = date('d-m-Y H:i:s');
$this->Leave_model->LeaveApprove($id, $data);
$this->Leave_model->LeaveApprove($id, $data);
redirect('Leave/manager_approvel');
}
@ -385,9 +527,12 @@ public function cancled()
}
public function LeaveHistory()
{
{
$business_id = user()->business_id;
$leave_list = $this->Leave_model->get_leave_with_emp_name(user()->business_id);
$leave_type = $this->Leave_model->get_leave_type($business_id);
$this->layout->set('tableData', $leave_list);
$this->layout->set('leave_type', $leave_type);
$this->layout->buffer('main_content', 'Leave/leavehistory');
$this->layout->render('Employee_Layout');
}
@ -401,7 +546,9 @@ public function manager_approvel()
$get_delegation = $this->Leave_model->Get_delegation_id($business_id);
$decline_dropdown = $this->Leave_model->decline_dropdown($business_id);
$leave_list = $this->Leave_model->get_with_emp_name(user()->business_id);
$leave_type = $this->Leave_model->get_leave_type($business_id);
$this->layout->set('tableData', $leave_list);
$this->layout->set('leave_type', $leave_type);
$this->layout->set('dropdown', $decline_dropdown);
$this->layout->set('get_delegation', $get_delegation);
$this->layout->set('manager', $manager);

View File

@ -7,11 +7,12 @@ public function get_leave_with_emp_name($business_id)
$this->db->from('leave_list A');
$this->db->join('users', 'users.id = A.emp_id', 'left');
$this->db->where('A.business_id', $business_id);
$this->db->order_by('id','DESC');
$this->db->order_by('A.id','DESC');
$this->db->where('A.is_active', 1);
$query = $this->db->get();
$query = $query->result();
$query = $query->result();
return $query;
}
public function get_with_emp_name($business_id, )
@ -27,12 +28,13 @@ public function get_with_emp_name($business_id, )
return $query;
}
public function get_count($emp_id, $business_id)
public function get_count($emp_id, $business_id, $type_id)
{
$this->db->select('*');
$this->db->from('emp_leave_days');
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $emp_id);
$this->db->where('type', $type_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
@ -40,18 +42,34 @@ public function get_count($emp_id, $business_id)
}
public function remaining_days($emp_id, $business_id)
public function remaining_days($emp_id, $business_id, $leave_year, $type)
{
$this->db->select('remaining_days');
$this->db->select('*');
$this->db->from('emp_leave_days');
$this->db->where('emp_id', $emp_id);
$this->db->where('business_id', $business_id);
$this->db->where('year', $leave_year);
$this->db->where('type', $type);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
// public function remaining_days_2($emp_id, $business_id, $next_year, $type)
// {
// $this->db->select('*');
// $this->db->from('emp_leave_days');
// $this->db->where('emp_id', $emp_id);
// $this->db->where('business_id', $business_id);
// $this->db->where('year', $next_year);
// $this->db->where('type', $type);
// $this->db->where('is_active', 1);
// $query = $this->db->get();
// $query = $query->row();
// return $query;
// }
function get_id($id,$business_id,$table)
{
$this->db->select('*');
@ -68,7 +86,7 @@ function get_by_type($type,$business_id,$table)
{
$this->db->select();
$this->db->from($table);
$this->db->where('type', $type);
$this->db->where('id', $type);
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
@ -94,26 +112,28 @@ public function get_employee($business_id)
}
}
public function get_leave($id , $business_id , $table)
{
$this->db->select('*');
$this->db->from($table);
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $id);
$this->db->order_by('id','DESC');
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_leave_based_on_tpye($id , $type , $business_id , $table)
public function get_leave($id , $business_id , $table, $leave_year, $type)
{
$this->db->select('*');
$this->db->from($table);
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $id);
$this->db->where('type', $type);
$this->db->where('year', $leave_year);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_leave_based_on_tpye($id , $type , $business_id , $table, $year)
{
$this->db->select('*');
$this->db->from($table);
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $id);
$this->db->where('type', $type);
$this->db->where('year', $year);
$this->db->order_by('id','DESC');
$this->db->where('is_active', 1);
$query = $this->db->get();
@ -133,8 +153,10 @@ public function get_leave_by_md5_id($id,$business_id,$table)
return $query;
}
function update($action,$id,$table){
function update_leave($action,$id,$table,$current_year,$type_id){
$this->db->where('emp_id',$id);
$this->db->where('type', $type_id);
$this->db->where('year', $current_year);
$this->db->update($table,$action);
return;
}
@ -182,18 +204,30 @@ public function get_Leave_nodays($id)
{
$this->db->select('*');
$this->db->from('leave_list');
$this->db->where('emp_id',$id);
$this->db->where('id',$id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->row();
return $query;
}
public function emp_leave_days_update($id, $days)
public function emp_leave_days_update($id, $days, $current_year, $business_id, $type)
{
$this->db->where('emp_id',$id);
$this->db->where('year', $current_year);
$this->db->where('business_id', $business_id);
$this->db->where('type', $type);
$this->db->update('emp_leave_days', $days);
}
// public function emp_leave_days_update_2($id, $days, $next_year, $business_id, $type)
// {
// $this->db->where('emp_id',$id);
// $this->db->where('year', $next_year);
// $this->db->where('business_id', $business_id);
// $this->db->where('type', $type);
// $this->db->update('emp_leave_days', $days);
// }
public function get_emp_id($id)
{
@ -273,4 +307,73 @@ public function get_emp_leave_count($type_id, $emp_id)
return $query->result();
}
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('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_leave_master_count($type_id, $business_id)
{
$this->db->select('*');
$this->db->from('leave_master');
$this->db->where('business_id', $business_id);
$this->db->where('id', $type_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_emp_joing_year_month($emp_id, $business_id)
{
$this->db->select('A.*, name', 'users.name');
$this->db->from('employees A');
$this->db->join('users', 'users.id = A.user_id', 'left');
$this->db->where('A.business_id', $business_id);
$this->db->where('A.user_id', $emp_id);
$this->db->where('A.is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_leave_type($business_id)
{
$this->db->select('*');
$this->db->from('leave_master');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_from_date($emp_id, $from_date, $to_date)
{
$this->db->select('*');
$this->db->from('leave_list');
$this->db->where('emp_id', $emp_id);
$this->db->where('from_date >=', $from_date);
$this->db->where('to_date <=', $to_date);
$query = $this->db->count_all_results();
return $query;
}
public function get_emp_join_date($emp_id, $from_date, $to_date)
{
$this->db->select('*');
$this->db->from('employees');
$this->db->where('user_id', $emp_id);
$this->db->where('j_date >=', $from_date);
$query = $this->db->count_all_results();
return $query;
}
}

View File

@ -31,7 +31,7 @@
<style>
.alert-success {
.alert-success {
background-color: #dff0d8;
color: #3c763d;
border-color: #d6e9c6;
@ -41,7 +41,7 @@
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
margin-left: 690px;
margin-left: 650px;
}
.custom-select {
@ -97,18 +97,31 @@
-webkit-appearance: none;
-moz-appearance: none;
}
</style>
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: 'No sufficient leave balance please check the Date.',
type: 'error',
styling: 'bootstrap3'
});">Error</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('error');?>" >
<?php echo $this->session->unset_userdata('error');?>
<script>
$(document).ready(function(){
if($('#error').val() == 1)
{
$('#button').click();
}
})
</script>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_panel" style=" position: relative !important; ">
<div class="x_title">
<ul class="nav navbar-right panel_toolbox">
@ -119,6 +132,8 @@
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="myForm" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Leave/createLeave" enctype="multipart/form-data">
@ -133,7 +148,7 @@
<input type="radio" id="self" name="risedby" value="self(<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
<input type="radio" name="risedby" value="<?php echo user()->name;?>(<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
<input type="radio" id="others" name="risedby" value="<?php echo user()->name;?>(<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
</div>
</div>
@ -152,7 +167,7 @@
<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>
<option id="<?php echo $value->id; ?>" value="<?php echo $value->id; ?>"><?php echo $value->type; ?></option>
<?php } ?>
</select>
</div>
@ -163,31 +178,13 @@
</div>
</div>
<!-- <div class="item form-group" id="hidedate" >
<label class="control-label col-md-2 col-sm-2 " 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 class="form-control" type="date" data-date="" data-date-format="DD-MM-YYYY" >
</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" required class="form-control" type="date" date-date="" data-date-format="DD-MM-YYYY" value="" date-date="">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"></label>
<div class="col-md-2 col-sm-2 ">
<input id="dateDifference" value="" readonly class="form-control" style="width:90px;" type="text" >
</div>
</div> -->
<div class="item form-group" id="hidedate" >
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<div class='input-group date'>
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="" required />
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="" required autocomplete="off" />
</div>
</div>
@ -195,7 +192,7 @@
<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 ">
<div class='input-group date' >
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date" value="" required />
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date" value="" required autocomplete="off"/>
</div>
</div>
@ -222,7 +219,7 @@
<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>
<option>select time</option>
</select>
</div>
@ -253,7 +250,6 @@
<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" id="submit" class="btn btn-success">Submit</button>
</div>
</div>
@ -269,8 +265,7 @@
<!-- /Body page content -->
<script>
// hide the dropdown arrow
// hide the dropdown arrow
$(document).ready(function() {
$("#user_dropdown").addClass("hide-arrow");
@ -292,8 +287,6 @@
<script>
$(document).ready(function(){
var currentUserName = '<?php echo user()->name; ?>';
var currentUserId = '<?php echo user()->id; ?>';
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
@ -306,21 +299,33 @@
});
$('#type').on('change',function() {
let id = $("#user_dropdown").val();
var type_id = $('option:selected', this).attr('id');
var fromdate = document.getElementById("fromdate").value;
if (id)
{
$.ajax({
type: "get",
url: "<?php echo base_url()?>Leave/get_leave_count/"+id+'_'+type_id,
data: {id : id, type_id : type_id},
type: 'get',
url: "<?php echo base_url()?>Leave/get_leave_count/",
success: function(response) {
response = JSON.parse(response);
if(response.length == 0)
if(response.length == 0 )
{
get_all_count(type_id);
$.ajax({
type: "get",
data: {type_id : type_id},
url: "<?php echo base_url()?>Leave/get_all_leave_count/",
success: function(response) {
response = JSON.parse(response);
$('#leave_bal').val( response[0].days + ' days');
},
});
}
else
{
@ -375,16 +380,7 @@
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);
console.log(response);
$('#leave_bal').val( response[0].days + ' days');
},
});
}
@ -403,12 +399,11 @@ function get_all_count(id) {
$('#showtime').hide()
$('#showdate').hide()
function permission() {
console.log($('#showtime').val())
var type = $('#type').val();
if( type === 'Permission' ){
if( type === '9' ){
$('#hidedate').hide();
$('#balance').hide();
@ -444,6 +439,20 @@ function permission() {
$("#manager_id").val(manager_id);
})
$('#others').on('change', function(){
$('#leave_bal').val('');
$('#type').val('');
})
$('#self').on('change', function(){
$('#leave_bal').val('');
$('#type').val('');
})
</script>
<script>
@ -500,59 +509,31 @@ function filterTimeSlots(startingTime, numberOfHours) {
</script>
<script>
// Initialize datepickers
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#fromdate");
console.log(fromDateInput);
var toDateInput = $("#todate");
console.log(toDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
toDateInput.datepicker("option", "minDate", dateText);
validateDateRange();
calculateDateDifference();
//DateDifference();
DateDifferenceOthers()
DateValidate();
}
});
toDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
onSelect: function (dateText, inst) {
validateDateRange();
calculateDateDifference();
// DateDifference();
DateDifferenceOthers()
DateValidate();
}
});
// Function to validate the date range
function validateDateRange() {
var fromDate = fromDateInput.datepicker("getDate");
var toDate = toDateInput.datepicker("getDate");
// Check if both dates are selected
if (!fromDate || !toDate) {
$("#error-msg").text("Please select both From Date and To Date");
return false;
}
// Compare the dates
if (fromDate > toDate) {
$("#error-msg").text("From Date cannot be after To Date");
return false;
}
// Clear the error message if the date range is valid
$("#error-msg").text("");
return true;
}
function calculateDateDifference() {
var fromDate = fromDateInput.datepicker("getDate");
var toDate = toDateInput.datepicker("getDate");
@ -574,112 +555,116 @@ function calculateDateDifference() {
}
// function DateDifference() {
// var fromDate = fromDateInput.datepicker("getDate");
// var toDate = toDateInput.datepicker("getDate");
// if (fromDate && toDate) {
// var difference = Math.ceil((toDate - fromDate) / (1000 * 60 * 60 * 24) + 1);
//
// //alert(remainingDays);
// if (difference >) {
// Swal.fire('You Have only "'+ remainingDays +'" days for Leave you select "'+ difference +'" days' );
// $("#fromdate").val('');
// $("#todate").val('');
// $("#dateDifference").val("");
// }
// }
// }
// $(document).ready(function() {
function DateDifferenceOthers() {
// $('#type').change(function() {
// var leave_type_id = $('#type').val();
// console.log(leave_type_id);
// let employee_id = $('#user_dropdown').val();
// DateDifferenceOthers(leave_type_id, employee_id);
// });
// });
// function DateDifferenceOthers( leave_type_id, employee_id ) {
// let type_id = leave_type_id;
// let emp_id = employee_id;
// // var type_id = $('option:selected', this).attr('id');
// // let emp_id = $('#user_dropdown').val();
// var fromDate = fromDateInput.datepicker("getDate");
// var toDate = toDateInput.datepicker("getDate");
// $.ajax({
// data: {emp_id : emp_id, type_id : type_id},
// url : "<?php echo base_url()?>Leave/get_emp_leave_count/",
// type: "get",
// success: function(response) {
// response = JSON.parse(response);
// if (fromDate && toDate) {
// var difference = Math.ceil((toDate - fromDate) / (1000 * 60 * 60 * 24) + 1);
// if(response.length == 0)
// {
// $.ajax({
// type: "get",
// url: "<?php echo base_url()?>Leave/get_leave_master_count/",
// data: {type_id: type_id},
// success: function(response) {
// response = JSON.parse(response);
// if (difference > response[0].days)
// {
// Swal.fire('No sufficient leave balance please check the Date');
// $("#todate").val('');
// $("#dateDifference").val("");
// }
// },
// });
// }
// else{
// if (difference > response[0].remaining_days)
// {
// Swal.fire('No sufficient leave balance please check the Date' );
// $("#todate").val('');
// $("#dateDifference").val("");
// }
// }
// }
// }
// });
// }
// $('#user_dropdown').on('change', function(){
// let emp_id = $('#user_dropdown').val();
// DateValidate(emp_id);
// });
// function DateValidate(emp_id) {
// var fromDate = fromDateInput.datepicker("getDate");
// var toDate = toDateInput.datepicker("getDate");
// $.ajax({
// data: {emp_id : emp_id, fromDate : fromDate, toDate : toDate},
// url : "<?php echo base_url()?>Leave/get_from_to_date_count/",
// type: "get",
// success: function(response) {
// alert(response);
// response = JSON.parse(response);
// }
// });
var fromDate = fromDateInput.datepicker("getDate");
var toDate = toDateInput.datepicker("getDate");
let emp_id = $('#user_dropdown').val();
console.log(emp_id);
$.ajax({
data: {emp_id : emp_id},
url : "<?php echo base_url()?>Leave/get_emp_leave_count/",
type: "get",
success: function(response) {
response = JSON.parse(response);
//alert(response);
if (fromDate && toDate) {
var difference = Math.ceil((toDate - fromDate) / (1000 * 60 * 60 * 24) + 1);
if (difference > response[0].remaining_days) {
Swal.fire('You Have only "'+ response[0].remaining_days +'" days for Leave you select "'+ difference +'" days' );
$("#fromdate").val('');
$("#todate").val('');
$("#dateDifference").val("");
}
else if (difference > response[0].remaining_days) {
Swal.fire('You Have only "'+ response[0].remaining_days +'" days for Leave you select "'+ difference +'" days' );
$("#fromdate").val('');
$("#todate").val('');
$("#dateDifference").val("");
}
}
}
});
}
// }
</script>
<!-- <script>
$('#type, #user_dropdown').on('change', function(){
let get_emp_id = document.getElementById("user_dropdown");
let emp_id = get_emp_id.value;
console.log(emp_id);
var selectElement = document.getElementById("type");
var selectedOption = selectElement.selectedOptions[0];
var type_id = selectedOption.id;
console.log(type_id);
$.ajax({
data: {type_id : type_id, emp_id : emp_id},
url : "<?php echo base_url()?>Leave/hide_leave_type/",
type: "get",
success: function(response) {
response = JSON.parse(response);
if(response[0].remaining_days == 0 || response[0].remaining_days <= -1)
{
alert('your leave is completed');
}
},
});
});
</script> -->

View File

@ -0,0 +1,26 @@
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="myModalLabel2">Are you sure you want to delete</h6>
<button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
</div>
</br>
<center>
<form class="delete_url" method="post" action="" id="">
<button type="button" class="btn btn-sm btn-secondary" id="close-form" data-dismiss="modal" aria-label="Close">No</button>
&nbsp; &nbsp; &nbsp; &nbsp;
<input type="hidden" class="delete_id" name="id" value="">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>" >
<button type="submit" class="btn btn-sm btn-primary" id="">Yes</button>
</form>
</center>
</br>
</div>
</div>

View File

@ -54,6 +54,27 @@
opacity: 1;
}
</style>
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: 'No sufficient leave balance please check the Date.',
type: 'error',
styling: 'bootstrap3'
});">Error</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('error');?>" >
<?php echo $this->session->unset_userdata('error');?>
<script>
$(document).ready(function(){
if($('#error').val() == 1)
{
$('#button').click();
}
})
</script>
<div class="">
<div class="page-title">
@ -106,9 +127,13 @@
<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" class="form-control" >
<option value="<?php echo $leave->type; ?>"><?php echo $leave->type; ?></option>
<?php foreach ($leavetype as $key => $val) { ?>
<?php if($leave->type == $val->id) { ?>
<option value="<?php echo $leave->type; ?>"><?php echo $val->type; ?></option>
<?php } }?>
<?php foreach ($leavetype as $key => $value) { ?>
<option id="<?php echo $value->id; ?>" value="<?php echo $value->type; ?>"><?php echo $value->type; ?></option>
<option id="<?php echo $value->id; ?>" value="<?php echo $value->id; ?>"><?php echo $value->type; ?></option>
<?php } ?>
</select>
</div>
@ -190,7 +215,6 @@
<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" id="submit" onclick="sweert()" class="btn btn-success">Update</button>
</div>
</div>
@ -224,21 +248,33 @@
});
$('#type').on('change',function() {
let id = $("#user_dropdown").val();
var type_id = $('option:selected', this).attr('id');
var type_id = $('option:selected', this).attr('id');
var fromdate = document.getElementById("fromdate").value;
if (id)
{
$.ajax({
type: "get",
url: "<?php echo base_url()?>Leave/get_leave_count/"+id+'_'+type_id,
data: {id : id, type_id : type_id},
type: 'get',
url: "<?php echo base_url()?>Leave/get_leave_count/",
success: function(response) {
response = JSON.parse(response);
if(response.length == 0)
{
get_all_count(type_id);
if(response.length == 0 )
{
$.ajax({
type: "get",
data: {type_id : type_id},
url: "<?php echo base_url()?>Leave/get_all_leave_count/",
success: function(response) {
response = JSON.parse(response);
$('#leave_bal').val( response[0].days + ' days');
},
});
}
else
{
@ -252,7 +288,7 @@
}
}
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
}
else
@ -388,7 +424,7 @@ function calculateDateDifference() {
console.log($('#showtime').val())
if( type === 'Permission' ){
if( type === '9' ){
$('#hidedate').hide()
$('#balance').hide()

View File

@ -6,10 +6,10 @@
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.modal {
.modal_default {
display: none;
position: fixed;
z-index: 1;
/* z-index: 1;*/
left: 0;
top: 0;
width: 100%;
@ -18,7 +18,7 @@
background-color: rgba(0, 0, 0, 0.4);
}
.modal-content {
.modal-content_default {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
@ -33,8 +33,10 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search move to up
margin-top: -30px !important; //search move to up
}
</style>
</head>
@ -52,9 +54,10 @@
<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%">
<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">Employee Name </th>
<th class="column-title">Note</th>
@ -69,8 +72,10 @@
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<?php foreach ($leave_type as $leave => $type) { ?>
<?php if($type->id === $value->type ) { ?>
<tr class="even pointer">
<td hidden ><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time; ?></td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->emp_id; ?>) </td>
<td class=" "><?php echo $value->comments; ?></td>
@ -84,7 +89,9 @@
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
<?php } ?>
<td class=" "><?php echo $value->type; ?></td>
<td class=" "><?php echo $type->type; ?></td>
<td class=" "><?php echo $value->risedby; ?></td>
<?php if($value->no_of_days == 0){ ?>
<td class=" ">---</td>
@ -110,7 +117,7 @@
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Leave/ApproveLeave')?>?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><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 href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
@ -119,7 +126,7 @@
<?php } ?>
</td>
</tr>
<?php } ?>
<?php } } } ?>
</tbody>
</table>
</div>
@ -128,8 +135,8 @@
</div>
</div>
<div id="customPrompt" class="modal">
<div class="modal-content">
<div id="customPrompt" class="modal modal_default">
<div class="modal-content modal-content_default">
<span style="text-align: right;" onclick="$('#customPrompt').hide()"><i class="fa fa-times" aria-hidden="true"></i></span>
<h3>Decline Reason</h3>
<input list="browsers" onfocus id="decline_reason" required name="myBrowser" style="margin-top: 10%;padding: 10px;"/>
@ -154,12 +161,12 @@
<div style="display:none" id="sub-value">
<script>
$('.deleteEmp').click(function() {
$('.approveleave').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Employee/deleteEmp";
var url = "<?php echo base_url()?>Leave/ApproveLeave";
$.ajax({
url: "<?php echo base_url()?>Employee/getDeleteConfirmationPopup",
url: "<?php echo base_url()?>Leave/getDeleteConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
@ -186,49 +193,6 @@
});
</script>
<!-- <script>
$(document).on('click','.test',function(){
var id = $(this).attr("id");
var reason = prompt("Decline Reason", "");
if(reason != null && reason != "" ){
$.ajax(
{
data:{id : id , reason : reason },
url:"<?php echo base_url('Leave/Decline');?>",
type:"get",
success: function(response) {
window.location = '<?php echo base_url('Leave/leaveList');?>';
}
});
}
else if(reason == "")
{
alert('Decline Reason is Required');
}
});
</script> -->
<!-- <script>
var reason = $('#decline_reason').val();
$.ajax(
{
data:{id : id , reason : reason },
url:"<?php echo base_url('Leave/Decline');?>",
type:"get",
success: function(response) {
window.location = '<?php echo base_url('Leave/leaveList');?>';
}
});
</script> -->
<script>
function showCustomPrompt() {
@ -262,5 +226,50 @@ 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
}
});
});
</script>
<script>
function showConfirmationPopup() {
var popup = document.getElementById('confirmationPopup');
popup.style.display = 'flex';
}
function hideConfirmationPopup() {
var popup = document.getElementById('confirmationPopup');
popup.style.display = 'none';
}
function confirmAction() {
// Handle the action to be performed on confirmation
hideConfirmationPopup();
// ...
}
</script>
</div>

View File

@ -15,7 +15,7 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search move to up
margin-top: -30px !important; //search move to up
</style>
</head>
@ -23,13 +23,25 @@
<div class="x_panel">
<div class="x_title">
<?php if ($this->session->userdata('Success')): ?>
<div class="alert-success flash-message" id="customPrompt" style="text-align: right;">
<h2><?php echo $this->session->userdata('Success'); ?></h2>
<span onclick="$('#customPrompt').hide()" style="text-align: right;" ><i class="fa fa-times" aria-hidden="true"></i></span>
</div>
<?php endif; ?>
<?php $this->session->unset_userdata('Success');?>
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Submmited for Approvel.<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('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>
@ -50,9 +62,10 @@
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatable-buttons" class="table table-striped table-bordered" width="100%">
<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>
@ -65,9 +78,13 @@
<?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 $value->type; ?></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>
@ -111,7 +128,7 @@
</tr>
<?php } } ?>
<?php } } } }?>
</tbody>
</table>
</div>
@ -162,6 +179,19 @@
});
</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>

View File

@ -6,10 +6,10 @@
<style>
.modal {
.modal_first {
display: none;
position: fixed;
z-index: 1;
/* z-index: 1;*/
left: 0;
top: 0;
width: 100%;
@ -18,7 +18,7 @@
background-color: rgba(0, 0, 0, 0.4);
}
.modal-content {
.modal-content_first {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
@ -33,9 +33,13 @@
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search move to up
margin-top: -30px !important; //search move to up
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
@ -50,9 +54,10 @@
<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%">
<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">Employee Name </th>
<th class="column-title">Note</th>
@ -65,12 +70,14 @@
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<?php foreach ($tableData as $key => $value) { ?>
<?php foreach ($leave_type as $leave => $type) { ?>
<?php if($type->id === $value->type ) { ?>
<?php if(user()->id == $value->manager) { ?>
<?php if(user()->id == $value->manager ) { ?>
<tr class="even pointer">
<td hidden><?php echo $value->id; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time; ?></td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->emp_id; ?>) </td>
<td class=" "><?php echo $value->comments; ?></td>
@ -84,7 +91,7 @@
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
<?php } ?>
<td class=" "><?php echo $value->type; ?></td>
<td class=" "><?php echo $type->type; ?></td>
<td class=" "><?php echo $value->risedby; ?></td>
<?php if($value->no_of_days == 0){ ?>
<td class=" ">---</td>
@ -110,8 +117,7 @@
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Leave/ManagerLeaveApprove')?>?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><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 href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" id= "<?php echo $value->id; ?>" onclick="showCustomPrompt()"></i></a>&nbsp;
@ -125,10 +131,10 @@
<?php if(user()->id == $val->delegated_to && date('d-m-Y') >= $val->from_date && date('d-m-Y') <= $val->to_date && $value->created_date >= $val->from_date && $value->created_date <= $val->to_date) { ?>
<tr class="even pointer">
<td hidden><?php echo $value->comments; ?></td>
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time; ?></td>
<td class=" "><?php echo $value->comments; ?></td>
<td class=" "><?php echo $value->name; ?> (<?php echo $value->emp_id; ?>) </td>
<td class=" "><?php echo $value->comments; ?></td>
<?php if($value->from_date == "" && $value->to_date == "") { ?>
<td class="">
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
@ -139,7 +145,7 @@
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
<?php } ?>
<td class=" "><?php echo $value->type; ?></td>
<td class=" "><?php echo $type->type; ?></td>
<td class=" "><?php echo $value->risedby; ?></td>
<?php if($value->no_of_days == 0){ ?>
<td class=" ">---</td>
@ -165,7 +171,7 @@
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Leave/ManagerLeaveApprove')?>?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><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 href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" id= "<?php echo $value->id; ?>" onclick="showCustomPrompt()"></i></a>&nbsp;
@ -174,7 +180,7 @@
</td>
</tr>
<?php } } } ?>
<?php } } } } } ?>
</tbody>
</table>
</div>
@ -183,8 +189,8 @@
</div>
</div>
<div id="customPrompt" class="modal">
<div class="modal-content">
<div id="customPrompt" class="modal modal_first">
<div class="modal-content modal-content_first">
<span style="text-align: right;" onclick="$('#customPrompt').hide()"><i class="fa fa-times" aria-hidden="true"></i></span>
<h3>Decline Reason</h3>
<input list="browsers" onfocus id="decline_reason" required name="myBrowser" style="margin-top: 10%;padding: 10px;"/>
@ -209,12 +215,12 @@
<div style="display:none" id="sub-value">
<script>
$('.deleteEmp').click(function() {
$('.approveleave').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Employee/deleteEmp";
var url = "<?php echo base_url()?>Leave/ManagerLeaveApprove";
$.ajax({
url: "<?php echo base_url()?>Employee/getDeleteConfirmationPopup",
url: "<?php echo base_url()?>Leave/getManagerConfirmationPopup",
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
@ -304,5 +310,18 @@ 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
}
});
});
</script>
</div>

View File

@ -1,100 +0,0 @@
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Permission</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/Permission" 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<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="time" >
</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 ">
<input id="to_date" name="to_date" value="" required="required" class="form-control" type="time">
</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 -->

View File

@ -71,7 +71,7 @@ function va(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f
c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function wa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:Ab(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Ab(a.aoPreSearchCols[d])}})};u(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
b)}}function Kb(a){var b,c,d=a.aoColumns;if(a.oFeatures.bStateSave){var e=a.fnStateLoadCallback.call(a.oInstance,a);if(e&&e.time&&(b=u(a,"aoStateLoadParams","stateLoadParams",[a,e]),-1===h.inArray(!1,b)&&(b=a.iStateDuration,!(0<b&&e.time<+new Date-1E3*b)&&d.length===e.columns.length))){a.oLoadedState=h.extend(!0,{},e);e.start!==k&&(a._iDisplayStart=e.start,a.iInitDisplayStart=e.start);e.length!==k&&(a._iDisplayLength=e.length);e.order!==k&&(a.aaSorting=[],h.each(e.order,function(b,c){a.aaSorting.push(c[0]>=
d.length?[0,c[1]]:c)}));e.search!==k&&h.extend(a.oPreviousSearch,Bb(e.search));b=0;for(c=e.columns.length;b<c;b++){var f=e.columns[b];f.visible!==k&&(d[b].bVisible=f.visible);f.search!==k&&h.extend(a.aoPreSearchCols[b],Bb(f.search))}u(a,"aoStateLoaded","stateLoaded",[a,e])}}}function xa(a){var b=m.settings,a=h.inArray(a,G(b,"nTable"));return-1!==a?b[a]:null}function L(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+
d);if(b)D.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&u(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function E(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?E(a,b,d[0],d[1]):E(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Lb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==
d);if(b)D.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&u(a,null,"error",[a,d,c]),"alert"==b);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function E(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?E(a,b,d[0],d[1]):E(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Lb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==
e&&h.isArray(d)?d.slice():d);return a}function Wa(a,b,c){h(a).bind("click.DT",b,function(b){a.blur();c(b)}).bind("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).bind("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function u(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Sa(a){var b=a._iDisplayStart,
c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Na(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ya(a,b){var c=[],c=Mb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),
c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function db(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Xa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Xa)}},function(b,c){v.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(v.type.search[b+a]=v.type.search.html)})}function Nb(a){return function(){var b=[xa(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,