28.06.2023 change : venkateshwaran

This commit is contained in:
venkateswaran ubuntu 2023-06-29 11:36:03 +05:30
parent f65317b69a
commit 01bc88453f
18 changed files with 484 additions and 211 deletions

View File

@ -225,7 +225,7 @@
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
$config['log_threshold'] = 4;
/*
|--------------------------------------------------------------------------
@ -273,7 +273,7 @@
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['log_date_format'] = 'd-m-m H:i:s';
/*
|--------------------------------------------------------------------------

View File

@ -35,12 +35,13 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required" class="form-control ">
<input type="text" id="name" name="name" value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required" onkeypress="validateKeyPress(event)" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input id="email" name="email" value="<?php if(isset($editData)) { echo $editData->email; } ?>" required="required" class="form-control" type="email" >
<input id="email" name="email" value="<?php if(isset($editData)){ echo $editData->email; } ?>" required="required" class="form-control"type="email"
pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}" oninvalid="setCustomValidity('Enter a Valid E-mail Address.')" oninput="setCustomValidity('')">
</div>
</div>
@ -49,7 +50,7 @@
<label class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input id="mobile" name="mobile" value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" required="required" class="form-control" type="text">
<input id="mobile" name="mobile" value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" onkeypress = "return matchnum(event)"required="required" class="form-control" type="text" pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Department<a style="color:red;">*</a> </label>
@ -117,12 +118,12 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_name" name="relation_name" value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control ">
<input type="text" id="relation_name" name="relation_name" value="<?php if(isset($editData)) { echo $editData->name; } ?>" onkeypress="validateKeyPress(event)" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
<div class="col-md-5 col-sm-5 ">
<input id="relationship" name="relationship" value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control" type="text" >
<input id="relationship" name="relationship" value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control" onkeypress="validateKeyPress(event)" type="text" >
</div>
</div>
@ -131,12 +132,12 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_mobile" name="relation_mobile" value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control ">
<input type="text" id="relation_mobile" name="relation_mobile" onkeypress = "return matchnum(event)" value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control " pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')">
</div>
<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" 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>
@ -171,7 +172,7 @@
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
<div class="col-md-5 col-sm-5 ">
<input id="pincode" name="pincode" value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" class="form-control" type="text" >
<input id="pincode" name="pincode" onkeypress = "return matchnum(event)" value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" class="form-control" type="text" >
</div>
</div>
@ -215,7 +216,7 @@
<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 ">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="" alt="Avatar">
<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>
@ -235,7 +236,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class="offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<a href="<?php echo base_url();?>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>
@ -248,6 +249,29 @@
</div>
<!-- /Body page content -->
<script>
function matchnum(event)
{
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true; //only numbers
return false;
}
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z.]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
$(document).ready(function(){
// $('.fa fa-chevron-up').click();
// setTimeout(() => { $('#chevron1').click(); }, 500);

View File

@ -42,7 +42,7 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required" class="form-control ">
<input type="text" id="name" name="name" value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required" class="form-control " onkeypress="validateKeyPress(event)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a> </label>
@ -56,7 +56,7 @@
<label class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input id="mobile" name="mobile" value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" required="required" class="form-control" type="tel" >
<input id="mobile" name="mobile" value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" onkeypress = "return matchnum(event)" required="required" class="form-control" type="tel" pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')" >
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Department<a style="color:red;">*</a> </label>
@ -227,10 +227,12 @@
<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="<?php echo $manager_name[0]->name; ?>"><?php echo $manager_name[0]->name; ?></option>
<?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 } ?>
<?php } } } ?>
</select>
</div>

View File

@ -6,10 +6,7 @@
<div class="x_title">
<h2>Employee Details </h2>
<ul class="nav navbar-right panel_toolbox">
<!-- <?php if(user()->action_permit != 'view' ) { ?> -->
<a href="<?php echo base_url();?>Employee/addEmployee" class="btn btn-sm btn-primary">Add Employee</a>
<!-- <?php } ?> -->
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>

View File

@ -70,7 +70,7 @@ public function rise_expence_request()
//file upload confic
$config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/';
$config['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
$config['allowed_types'] = 'jpg|png|jpeg|pdf';
$config['file_name'] = time();
$config['max_size'] = 80000;
//upload
@ -96,10 +96,20 @@ public function rise_expence_request()
}
$data['emp_id'] = $emp_id;
if(!is_null($data['manager'])){
$manager = $this->input->post('manager');
if($data['manager']==""){
if(employee()->manager == null)
{
$manager = 0;
}
else
{
$manager = employee()->manager;
}
}else{
$manager = employee()->manager;
$manager = $this->input->post('manager');
}
$data['manager'] = $manager;
$data['business_id'] = user()->business_id;
@ -138,7 +148,7 @@ public function edit_rise_expence_request()
//file upload confic
$config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/';
$config['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
$config['allowed_types'] = 'jpg|png|jpeg|pdf';
$config['file_name'] = time();
$config['max_size'] = 80000;
//upload

View File

@ -1,5 +1,15 @@
<!-- Body page content -->
<!-- bootstrap-daterangepicker -->
<script src="https://localhost/ams//assets/default/moment/min/moment.min.js"></script>
<script src="https://localhost/ams//assets/default/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- bootstrap-datetimepicker -->
<script src="https://localhost/ams//assets/default/bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<!-- Body page content -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></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://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@ -98,11 +108,13 @@
<label class="control-label col-md-2 col-sm-2 " required for="first-name">Upload Bill</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill" onchange="PreviewImage()" class="typeFile" type="file">
<input id="formFile" name="bill" onchange="validateFile(this)" class="typeFile" type="file">
</div>
</div>
<div class="item form-group">
<!-- <div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " required for="first-name"></label>
<div class="col-md-2 col-sm-2 ">
@ -110,7 +122,7 @@
</div>
</div>
</div>-->
<div class="ln_solid"></div>
@ -134,6 +146,19 @@
</div>
<!-- /Body page content -->
<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)) {
Swal.fire("Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.");
input.value = ""; // Clear the input value
}
}
</script>
<script>
$(document).ready(function(){
@ -201,7 +226,7 @@
</script>
<script>
<!-- <script>
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("formFile").files[0]);
@ -210,4 +235,4 @@ function PreviewImage() {
document.getElementById("uploadPreview").src = oFREvent.target.result;
};
};
</script>
</script> -->

View File

@ -8,6 +8,8 @@
<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://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.alert-success {
@ -87,7 +89,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" 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">
</div>
</div>
@ -108,17 +110,22 @@
<label class="control-label col-md-2 col-sm-2 " required for="first-name">Upload Bill </label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill" onchange="PreviewImage()" class="typeFile" type="file">
<input id="formFile" name="bill" onchange="validateFile(this)" class="typeFile" type="file" value="">
</div>
</div>
<div class="item form-group">
<div class="col-md-2 col-sm-2 ">
<div id="previewContainer" style="text-align:center;"></div>
</div>
</div>
<div class="item form-group">
<!-- <div class="item form-group">
<label class="control-label col-md-2 col-sm-2 " required for="first-name"></label>
<div class="col-md-2 col-sm-2 ">
<img src="http://ssl.gstatic.com/accounts/ui/avatar_2x.png" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" style="height: 100px; width: 100px;" alt="avatar"/>
</div>
</div>
</div> -->
<div class="ln_solid"></div>
@ -141,9 +148,68 @@
</div>
<!-- /Body page content -->
<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)) {
Swal.fire("Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.");
input.value = ""; // Clear the input value
}
}
</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
Swal.fire("Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.");
input.value = ""; // Clear the 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>
<script>
function matchnum(event)
{
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true; //only numbers
return false;
}
$(document).ready(function(){
var currentUserName = '<?php echo user()->name; ?>';
@ -205,7 +271,7 @@
})
</script>
<script>
<!-- <script>
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("formFile").files[0]);
@ -214,6 +280,6 @@ function PreviewImage() {
document.getElementById("uploadPreview").src = oFREvent.target.result;
};
};
</script>
</script> -->

View File

@ -146,7 +146,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 confirm('Are you sure to Approve This Leave ')" ></i></a> &nbsp;
<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 href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
@ -247,11 +247,22 @@ function openModal(itemId) {
</script>
<script>
$(function() {
$(".hide-it").hide(5000);
});
function alert()
{
Swal.fire({
title: 'Custom animation with Animate.css',
showClass: {
popup: 'animate__animated animate__fadeInDown'
},
hideClass: {
popup: 'animate__animated animate__fadeOutUp'
}
})
}
</script>

View File

@ -6,37 +6,6 @@
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<style>
.design {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.4);
}
.design-form {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 380px;
height: 280px;
text-align: center;
}
button {
margin-top: 10px;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search to up
</style>
<style>
/* Modal Popup Styles */
@ -80,6 +49,16 @@
height: 280px;
text-align: center;
}
button {
margin-top: 10px;
}
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search to up
}
</style>
</head>
@ -105,18 +84,14 @@
<th class="column-title">Expense Cost()</th>
<th class="column-title">Claim Raised By</th>
<th class="column-title">Status </th>
<th class="column-title" >Action </th>
<th class="column-title" >Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<?php foreach ($get_delegation as $key => $val) { ?>
<?php if(user()->id == $value->manager || 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 ){ ?>
<?php if(user()->id == $value->manager){ ?>
<tr class="even pointer">
@ -130,7 +105,7 @@
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?>By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at;?></td>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at;?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"> <?php echo $value->status; ?><br><?php echo $value->Dreason; ?></td>
@ -162,7 +137,58 @@
</td>
</tr>
<?php } } } ?>
<?php } ?>
<?php foreach ($get_delegation as $key => $val) { ?>
<?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 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>
<td class=" "><?php echo $value->date_of_expence; ?></td>
<td class=" "> <?php echo $value->amount; ?></td>
<td class=" "><?php echo $value->created_by; ?></td>
<?php if($value->status == 'pending'){ ?>
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at;?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"> <?php echo $value->status; ?><br><?php echo $value->Dreason; ?></td>
<?php }
else if($value->status == 'canceled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?></td>
<?php }
else{
}?>
<td style=" text-align: center; font-size: 16px;">
<?php if(!empty($value->bill)) { ?>
<a onclick="openModal('<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>')" title="ViewBill"><i class="fa fa-eye" aria-hidden="true"></i></a><br>
<?php } ?>
<?php if($value->status == '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 href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()"
id= "<?php echo $value->id; ?>"></i></a>&nbsp;
<?php } ?>
</td>
</tr>
<?php } } }?>
</tbody>
</table>
</div>

View File

@ -108,7 +108,7 @@
<li><a href="<?php echo base_url();?>Expence/expence_form">New Claim</a></li>
<li><a href="<?php echo base_url();?>Expence/manager_approvel_list">My Approvals</a></li>
<li><a href="<?php echo base_url();?>Expence/expence_list">My Approvals</a></li>
</ul>
</li>
@ -134,7 +134,7 @@
<li><a><i class="fa fa-tasks"></i> Delegation <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>Delegation/Delegation_list">My Claims</a></li>
<li><a href="<?php echo base_url();?>Delegation/Delegation_list">Delegation List</a></li>
<li><a href="<?php echo base_url();?>Delegation/Delegation/Delegation_form">Assign Delegation</a></li>

View File

@ -66,18 +66,23 @@ public function applyLeave()
{
$business_id = user()->business_id;
$user_id = user()->id;
$emp_leave_count = $this->Leave_model->get_count($user_id, $business_id, "emp_leave_days");
$emp = $this->Emp_model->get_employee(user()->business_id);
$leavetype = $this->Leave_model->getLeaveType($business_id);
//print_r($emp_leave_count); die();
$this->layout->set('emp', $emp);
$this->layout->set('count', $emp_leave_count);
$this->layout->set('leavetype', $leavetype);
$this->layout->buffer('main_content', 'Leave/apply_leave');
$this->layout->render('Employee_Layout');
}
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);
echo json_encode($emp_leave_count);
}
public function get_emp_name()
{
$emp = $this->Leave_model->get_employee(user()->business_id);
@ -94,6 +99,7 @@ public function get_emp_name()
public function createLeave()
{
if($this->input->post('type') === 'Permission')
{
$perm_data = $this->input->post();
@ -103,10 +109,20 @@ public function createLeave()
$emp_id = user()->id;
}
$perm_data['emp_id'] = $emp_id;
if($data['manager']){
$manager = $this->input->post('manager');
if($perm_data['manager']==""){
if(employee()->manager == null)
{
$manager = 0;
}
else
{
$manager = employee()->manager;
}
}else{
$manager = employee()->manager;
$manager = $this->input->post('manager');
}
$perm_data['manager'] = $manager;
$perm_data['business_id'] = user()->business_id;
@ -126,10 +142,21 @@ public function createLeave()
$emp_id = user()->id;
}
$data['emp_id'] = $emp_id;
if(!is_null($data['manager'])){
$manager = $this->input->post('manager');
if($data['manager']==""){
if(employee()->manager == null)
{
$manager = 0;
}
else
{
$manager = employee()->manager;
}
}else{
$manager = employee()->manager;
$manager = $this->input->post('manager');
}
$data['manager'] = $manager;
$data['business_id'] = user()->business_id;
@ -137,9 +164,9 @@ public function createLeave()
$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");
// count number of days between two dates
$days_between = ceil(abs($this->input->post('to_date') - $this->input->post('from_date')) / 86400);
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
$data['no_of_days'] = $days_between + 1;
$noofdays = $days_between + 1;
if (count($emp_leave_count) != 0)
@ -226,7 +253,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', 'Submitted for Approval');
$this->session->set_flashdata('Success', 'Permission Updated Sucessfully');
redirect('Leave/LeaveHistory');
}
@ -293,6 +320,7 @@ public function get_all_leave_count($id)
}
public function ApproveLeave()
{
$id=$this->input->get('id');
@ -381,16 +409,4 @@ public function manager_approvel()
$this->layout->render('Employee_Layout');
}
public function hide_leave_type()
{
$type_id = $this->input->get('type_id');
$emp_id = $this->input->get('emp_id');
$emp_leave_count = $this->Leave_model->get_emp_leave_count($type_id, $emp_id);
echo json_encode($emp_leave_count);
}
}

View File

@ -27,16 +27,17 @@ public function get_with_emp_name($business_id, )
return $query;
}
public function get_count($user_id, $business_id, $table)
public function get_count($emp_id, $business_id)
{
$this->db->select('*');
$this->db->from($table);
$this->db->from('emp_leave_days');
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $user_id);
$this->db->where('emp_id', $emp_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function remaining_days($emp_id, $business_id)
@ -53,7 +54,7 @@ public function remaining_days($emp_id, $business_id)
function get_id($id,$business_id,$table)
{
$this->db->select();
$this->db->select('*');
$this->db->from($table);
$this->db->where('id', $id);
$this->db->where('business_id', $business_id);

View File

@ -8,6 +8,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.13.0/jquery-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- bootstrap-daterangepicker -->
<link href="https://localhost/ams//assets/default/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
@ -30,32 +31,6 @@
<style>
input[type=date] {
position: relative;
/* width: 150px; height: 20px;
color: white;*/
}
input[type=date]:before {
position: absolute;
top: 3px; left: 3px;
content: attr(data-date);
display: inline-block;
color: black;
}
input[type=date]::-webkit-datetime-edit, input::-webkit-inner-spin-button, input::-webkit-clear-button {
display: none;s
}
input[type=date]::-webkit-calendar-picker-indicator {
position: absolute;
top: 3px;
right: 0;
color: black;
opacity: 1;
}
.alert-success {
background-color: #dff0d8;
color: #3c763d;
@ -84,7 +59,7 @@
}
.custom-select::after {
content: '\25BC';
content: '\f107';
position: absolute;
top: 50%;
right: 10px;
@ -108,6 +83,24 @@
}
.hide-arrow {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: none;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
}
</style>
@ -138,7 +131,7 @@
<label class="control-label col-md-2 col-sm-2 " for="last-name">Leave Applied For</label>
<div class="col-md-5 col-sm-5 ">
<input type="radio" name="risedby" value="self(<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
<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>
@ -158,6 +151,7 @@
<select id="type" name="type" required class="form-control" onclick="permission()" >
<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>
@ -213,7 +207,7 @@
</div>
<div class="item form-group" id="showdate" >
<div class="item form-group" id="showdate">
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
@ -223,11 +217,11 @@
</div>
</div>
<div class="item form-group" id="showtime" >
<div class="item form-group" id="showtime">
<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 >
<select class="custom-select" id="from_time" name=from_time required style="-webkit-appearance: none;">
<option>select time</option>
</select>
</div>
@ -273,7 +267,25 @@
</div>
</div>
<!-- /Body page content -->
<script>
// hide the dropdown arrow
$(document).ready(function() {
$("#user_dropdown").addClass("hide-arrow");
$("input[name='risedby']").on("change", function() {
var inputValue = $(this).val();
if (inputValue === "<?php echo user()->name;?>(<?php echo user()->id;?>)") {
$("#user_dropdown").removeClass("hide-arrow");
} else {
$("#user_dropdown").addClass("hide-arrow");
}
});
})
</script>
@ -322,7 +334,7 @@
}
}
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
}
else
@ -369,17 +381,21 @@ function get_all_count(id) {
success: function(response) {
response = JSON.parse(response);
console.log(response);
$('#leave_bal').val( response[0].days);
$('#leave_bal').val( response[0].days + ' days');
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
}
$('#myDatepicker').datetimepicker({
</script>
<script>
$('#myDatepicker').datetimepicker({
format: 'DD.MM.YYYY'
});
</script>
@ -497,6 +513,9 @@ function filterTimeSlots(startingTime, numberOfHours) {
toDateInput.datepicker("option", "minDate", dateText);
validateDateRange();
calculateDateDifference();
//DateDifference();
DateDifferenceOthers()
}
});
@ -505,6 +524,9 @@ function filterTimeSlots(startingTime, numberOfHours) {
onSelect: function (dateText, inst) {
validateDateRange();
calculateDateDifference();
// DateDifference();
DateDifferenceOthers()
}
});
@ -549,11 +571,77 @@ function calculateDateDifference() {
} else {
$("#dateDifference").val("");
}
}
// 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("");
// }
// }
// }
function DateDifferenceOthers() {
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(){
@ -590,6 +678,10 @@ function calculateDateDifference() {
});
</script> -->

View File

@ -127,9 +127,6 @@
<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="<?php echo dateFormat('d-m-Y', $leave->from_date); ?>" required />
<span class="input-group-addon">
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -138,9 +135,6 @@
<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="<?php echo dateFormat('d-m-Y', $leave->to_date); ?>" required />
<span class="input-group-addon">
<li class="fa fa-calendar"></li>
</span>
</div>
</div>

View File

@ -57,12 +57,12 @@
<tr class="headings">
<th class="column-title">Created Date/Time</th>
<th class="column-title">Employee Name </th>
<th class="column-title">Note</th>
<th class="column-title">Leave Duration </th>
<th class="column-title">Leave Type </th>
<th class="column-title">Leave Raised By</th>
<th class="column-title">No of Days </th>
<th class="column-title">Status </th>
<th class="column-title">Note</th>
<th class="column-title" >Action </th>
</tr>
</thead>
@ -73,6 +73,7 @@
<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>
<?php if($value->from_date == "" && $value->to_date == "") { ?>
<td class="">
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
@ -105,7 +106,6 @@
else{
}?>
<td class=" "><?php echo $value->comments; ?></td>
<td style=" text-align: center; font-size: 16px;">
<?php if($value->status == 'pending') { ?>
@ -259,53 +259,8 @@ function submitCustomPrompt() {
alert('Decline Reason is required');
// var customPrompt = document.getElementById("customPrompt");
// customPrompt.style.display = "none";
}
</script>
<script>
function alert(){
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'Are you sure?',
text: "You won't be able to Approve this!",
icon: false,
showCancelButton: true,
confirmButtonText: 'Yes, Approved it!',
cancelButtonText: 'No, cancel!',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
swalWithBootstrapButtons.fire(
'Approved!',
'Leave has been Approved.',
'success'
)
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
})
}
</script>
</div>

View File

@ -90,7 +90,7 @@
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at; ?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->DReason; ?></td>
<td style="color:red"><?php echo $value->status; ?> By <?php echo $value->declined_by; ?> <br> <?php echo $value->DReason; ?></td>
<?php }
else if($value->status == 'canceled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?></td>

View File

@ -34,35 +34,32 @@
div.dataTables_wrapper div.dataTables_filter{
margin-top: -44px !important; //search move to up
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<ul class="nav navbar-right panel_toolbox">
<a href="<?php echo base_url();?>Leave/LeaveHistory" class="btn btn-sm btn-primary" style="margin-top: 20px;" >Back</a>
</ul>
<h1>My Approvals</h1>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12" style="overflow: auto;">
<table id="datatable-buttons" class="table table-striped table-bordered" width="100%">
<table id="datatable-buttons" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Created Date/Time</th>
<th class="column-title">Employee Name </th>
<th class="column-title">Note</th>
<th class="column-title">Leave Duration </th>
<th class="column-title">Leave Type </th>
<th class="column-title">Leave Raised By</th>
<th class="column-title">No of Days </th>
<th class="column-title">Note</th>
<th class="column-title">Status </th>
<th class="column-title" >Action </th>
</tr>
@ -70,13 +67,13 @@
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<?php foreach ($get_delegation as $key => $val) { ?>
<?php if(user()->id == $value->manager || 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 ){ ?>
<?php if(user()->id == $value->manager) { ?>
<tr class="even pointer">
<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>
<?php if($value->from_date == "" && $value->to_date == "") { ?>
<td class="">
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
@ -94,7 +91,6 @@
<?php } else { ?>
<td class=""><?php echo $value->no_of_days; ?></td>
<?php } ?>
<td class=" "><?php echo $value->comments; ?></td>
<?php if($value->status == 'pending'){ ?>
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
@ -122,6 +118,62 @@
<?php } ?>
</td>
</tr>
<?php } ?>
<?php foreach ($get_delegation as $key => $val) { ?>
<?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 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>
<?php if($value->from_date == "" && $value->to_date == "") { ?>
<td class="">
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
<?php echo timeFormat('h:i a', $value->from_time); ?> to
<?php echo timeFormat('h:i a', $value->to_time);; ?>
</td>
<?php } else { ?>
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
<?php } ?>
<td class=" "><?php echo $value->type; ?></td>
<td class=" "><?php echo $value->risedby; ?></td>
<?php if($value->no_of_days == 0){ ?>
<td class=" ">---</td>
<?php } else { ?>
<td class=""><?php echo $value->no_of_days; ?></td>
<?php } ?>
<?php if($value->status == 'pending'){ ?>
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at; ?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->declined_by; ?> <br>" <?php echo $value->DReason; ?> "</td>
<?php }
else if($value->status == 'canceled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?></td>
<?php }
else{
}?>
<td style=" text-align: center; font-size: 16px;">
<?php if($value->status == 'pending') { ?>
<a href="<?php echo base_url('Leave/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 href="#"><i class="fa fa-times test" aria-hidden="true" title="Decline" id= "<?php echo $value->id; ?>" onclick="showCustomPrompt()"></i></a>&nbsp;
<?php } ?>
</td>
</tr>
<?php } } } ?>
</tbody>
</table>
@ -252,4 +304,5 @@ function submitCustomPrompt() {
}
</script>
</div>

View File

@ -99,6 +99,7 @@
case 'testing':
ini_set('display_errors', 1);
//error_reporting(-1);
// if (version_compare(PHP_VERSION, '5.3', '>=')) {
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
// } else {