File: /var/www/html/hrms-production/storage/framework/views/40b313b164d4b0a2a46b470cb9acdc6bd74b1854.php
<?php $__env->startSection('content'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h5>Edit Application</h5>
</div>
<!-- /.card-header -->
<div class="card-body">
<form class="form-horizontal" id="leaveApplicationForm">
<input type="hidden" name="_token" id="token" value="<?php echo e(csrf_token()); ?>">
<input type="hidden" name="UserName" id="UserName" value="<?php echo e($LeaveDetails->UserName); ?>">
<input type="hidden" name="Approved" id="Approved" value="<?php echo e($LeaveDetails->Approved); ?>">
<div class="row">
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="EmployeeCode"
class="col-sm-4 col-form-label text-right">Employee Code:</label>
<div class="col-sm-8">
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="EmployeeId"
id="EmployeeId" data-placeholder="Select Employee Code" required >
<option selected="selected" disabled>Employee Code</option>
<?php if(Session::get('UserType') == 'Super Admin'): ?>
<?php $__currentLoopData = $EmployeesData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $AllEmployee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($AllEmployee->EmployeeId === $LeaveDetails->EmployeeId): ?>
<option selected value="<?php echo e($AllEmployee->EmployeeId); ?>"><?php echo e($AllEmployee->EmployeeCode); ?></option>
<?php else: ?>
<option value="<?php echo e($AllEmployee->EmployeeId); ?>"><?php echo e($AllEmployee->EmployeeCode); ?></option>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
<option selected value="<?php echo e($LeaveDetails->EmployeeId); ?>"><?php echo e($LeaveDetails->EmployeeCode); ?></option>
<?php endif; ?>
</select>
</div>
</div>
<div class="form-group row mb-0">
<label for="Department"
class="col-sm-4 col-form-label text-right">Department:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="employeeDepartment" id="employeeDepartment" readonly="readonly">
</div>
</div>
</div>
<div class="form-group row mb-0 mt-2">
<label for="LeaveType" class="col-sm-4 col-form-label text-right">Leave Type:</label>
<div class="col-sm-8">
<select class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="LeaveType"
id="LeaveType" data-placeholder="Select Employee Code" required >
<option selected="selected" disabled>Leave Type</option>
<?php $__currentLoopData = $LeaveTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $LeaveType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($LeaveType->LeaveTypeId === $LeaveDetails->LeaveTypeId): ?>
<option selected value="<?php echo e($LeaveType->LeaveTypeId); ?>"><?php echo e($LeaveType->LeaveTypeName); ?></option>
<?php else: ?>
<option value="<?php echo e($LeaveType->LeaveTypeId); ?>"><?php echo e($LeaveType->LeaveTypeName); ?></option>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
<div class="form-group row mb-0 mt-2">
<label for="FromDate" class="col-sm-4 col-form-label text-right">From Date:</label>
<div class="col-sm-8">
<div class="form-group mb-2">
<div class="input-group date" id="jobFromDate"
data-target-input="nearest">
<input type="text" id="fromDate" name="leaveStartDate"
class="form-control form-control-sm datetimepicker-input"
data-target="#fromDate" onblur="getDayFromDates()" value="<?php echo e(date('d/m/Y', strtotime($LeaveDetails->StartDate))); ?>" />
<div class="input-group-append" data-target="#fromDate"
data-toggle="datetimepicker">
<div class="input-group-text">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mt-2">
<label class="col-sm-4 col-form-label text-right">Profile Name:</label>
<div class="col-sm-8">
<!-- <form method="GET" id="ProfileId"> -->
<select class="form-control form-control-sm select2" aria-hidden="true"
name="ProfileName" id="ProfileName" data-placeholder="Select Profile Name">
<option value="" disabled selected>Select Profile Name</option>
</select>
<input type="hidden" name="ProfileId" id="ProfileId">
<!-- </form> -->
</div>
</div>
<div class="form-group row mb-0">
<label for="NoOfDays"
class="col-sm-4 col-form-label text-right">Approval Authority:</label>
<div class="col-sm-8">
<select multiple="multiple" class="form-control form-control-sm select2"
style="width: 100%;" aria-hidden="true" name="Authority"
id="Authority" data-placeholder="Select Authority" required >
<!-- <option name="Authority" id="Authority"></option> -->
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row mb-0">
<label for="EmployeeName"
class="col-sm-4 col-form-label text-right">Employee Name:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="EmployeeName" id="employeeName" readonly="readonly">
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="Designation"
class="col-sm-4 col-form-label text-right">Designation:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="employeeDesignation" id="employeeDesignation" readonly="readonly">
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="LeaveDay"
class="col-sm-4 col-form-label text-right">Leave Day:</label>
<div class="col-sm-8">
<div class="form-group mt-2">
<div class="form-group clearfix">
<div class="icheck-primary d-inline">
<?php if($LeaveDetails->LeaveName === 'FullPay'): ?>
<input type="radio" id="addFull" value="FullPay" name="LeaveDay" checked="checked">
<?php else: ?>
<input type="radio" id="addFull" value="FullPay" name="LeaveDay">
<?php endif; ?>
<label class="mb-0" for="addFull">Full Pay</label>
</div>
<div class="icheck-primary d-inline">
<?php if($LeaveDetails->LeaveName === 'HalfPay'): ?>
<input type="radio" id="addHalf" value="HalfPay" name="LeaveDay" checked="checked">
<?php else: ?>
<input type="radio" id="addHalf" value="HalfPay" name="LeaveDay">
<?php endif; ?>
<label class="mb-0" for="addHalf">Half Pay</label>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="ToDate" class="col-sm-4 col-form-label text-right">To
Date:</label>
<div class="col-sm-8">
<div class="form-group mb-2">
<div class="input-group date" id="leaveEndDate" data-target-input="nearest">
<input type="text" id="toDate" name="leaveEndDate" class="form-control form-control-sm datetimepicker-input"
data-target="#toDate" onblur="getDayFromDates()" required value="<?php echo e(date('d/m/Y', strtotime($LeaveDetails->EndDate))); ?>" />
<div class="input-group-append" data-target="#toDate" data-toggle="datetimepicker">
<div class="input-group-text">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="NoOfDays"
class="col-sm-4 col-form-label text-right">No. of Day(s):</label>
<div class="col-sm-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
<input type="text" class="form-control form-control-sm"
name="NoOfDays" id="NoOfDays" value="<?php echo e($LeaveDetails->TotalLeave); ?>" readonly>
</div>
</div>
</div>
<div class="form-group row mb-0">
<label for="Remarks"
class="col-sm-4 col-form-label text-right">Remarks:</label>
<div class="col-sm-8">
<textarea class="form-control form-control-sm" name="Remarks"
id="Remarks"><?php echo e($LeaveDetails->Description); ?></textarea>
</div>
</div>
</div>
<div class="col-md-12 mt-3">
<div class="form-group row">
<button type="button" id="btn-save-job-detail"
class="btn btn-warning text-white" onclick="editLeave();">Update Application</button>
<button type="button" onclick="formReset();" class="btn btn-warning text-white">Reset</button>
</div>
</div>
</div>
</form>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<script>
function formReset()
{
Swal.fire({
title: 'Do you want to reset form?',
text: "Are you sure you want to reset this form!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, reset it!'
}).then(function() {
$('form#leaveApplicationForm').each(function() {
this.reset();
});
});
}
</script>
<script>
function getDayFromDates(){
var start_date = $('#fromDate').val();
var end_date = $('#toDate').val();
var sDate = start_date;
var fromDate = sDate.split("/").reverse().join("-");
var eDate = end_date;
var endDate = eDate.split("/").reverse().join("-");
// console.log(fromDate+ "==" +endDate);
var leaveName = $("input[name='LeaveDay']:checked").val();
//alert(leaveName);
if (leaveName == "FullPay") {
var days = daysdifference(fromDate, endDate);
//console.log(days);
$('#NoOfDays').val(days);
function daysdifference(fromDate, endDate){
var startDay = new Date(fromDate);
var endDay = new Date(endDate);
var millisBetween = endDay.getTime() - startDay.getTime();
if (millisBetween < 0) {
$('#toDate').val(start_date);
} else {
var days = millisBetween / (1000 * 3600 * 24);
return Math.round(Math.abs(days+1));
}
}
} else {
$('#leaveEndDate').val(start_date);
}
}
</script>
<script>
$( "#fromDate" ).blur(function()
{ var the_date = $('#fromDate').val();
//alert(the_date);
getDayFromDates();
});
$( "#toDate" ).blur(function()
{ var the_date = $('#toDate').val();
//alert(the_date);
const toTimestamp = (strDate) => {
const dt = Date.parse(strDate);
return dt / 1000;
}
var start_date = $('#fromDate').val();
var end_date = $('#toDate').val();
if(toTimestamp(start_date) > toTimestamp(end_date))
{
$('#toDate').val(start_date);
}
getDayFromDates();
});
//Add Record
$( "input[name='LeaveDay']" ).change(function(){
var leaveName = $("input[name='LeaveDay']:checked").val();
//alert(leaveName);
var days = 0;
if(leaveName == "HalfPay"){
$('#NoOfDays').val('0.5');
//alert(start_date);
var start_date = $('#fromDate').val();
$('#leaveEndDate').val(start_date);
$('#leaveEndDate').attr('readonly', true);
}
else
{
$('#leaveEndDate').removeAttr('readonly');
$('#NoOfDays').val(days);
}
getDayFromDates();
});
</script>
<script>
$(function() {
$("#emplaoyeeTable").DataTable({
"responsive": true,
"lengthChange": true,
"autoWidth": false,
"lengthMenu": [10, 20, 50, 100, 250, 500],
//"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
}).buttons().container().appendTo('#userTable_wrapper .col-md-6:eq(0)');
});
$("#EmployeeId").change(function(){
loadEmaployeeDetails();
});
document.addEventListener('DOMContentLoaded', function() {
loadEmaployeeDetails();
}, false);
// window.onload=loadEmaployeeDetails ;
function loadEmaployeeDetails()
{
var employeeid = $('#EmployeeId').val();
var employeeCode = $("#EmployeeId option:selected").text();
$('#EmployeeCode').val(employeeCode);
$.get("<?php echo e(url('/')); ?>/ajax/employee/details/"+employeeid, function(data, status){
//alert("Data: " + data + "\nStatus: " + status);
if(data.error_code == '200')
{
var EmployeeData = data.EmployeeData;
var EmployeeName = EmployeeData.EmployeeName;
var DepartmentName = EmployeeData.DepartmentName;
var DesignationName = EmployeeData.DesignationName;
$('#employeeName').val(EmployeeName);
$('#employeeDepartment').val(DepartmentName);
$('#employeeDesignation').val(DesignationName);
}
});
//tblBodyQualification
$.get("<?php echo e(url('/')); ?>/ajax/employee/qualification/list/"+employeeid, function(data, status){
//alert("Data: " + data + "\nStatus: " + status);
$('#tblBodyQualification').empty();
if(data)
{
$('#tblBodyQualification').append(data);
}
});
}
function editLeave()
{
event.preventDefault();
var Name = $("#EmployeeId").val();
if(Name == "") {
Swal.fire({
icon: 'warning',
title: 'Employeecode is required!',
showConfirmButton: false,
timer: 2000
});
} else {
var token = $('#token').val();
var EmployeeId = $('#EmployeeId').val();
var employeeCode = $("#EmployeeId option:selected").text();
var EmployeeCode = employeeCode;
var employeeDepartment = $('#employeeDepartment').val();
var LeaveType = $('#LeaveType').val();
var UserName = $('#UserName').val();
var Authority = $('#Authority').val();
var Approved = $('#Approved').val();
var leaveStartDate = $('#fromDate').val();
var leaveEndDate = $('#toDate').val();
var Remarks = $('#Remarks').val();
var LeaveDay = $('input[name=LeaveDay]:checked').val();
var EmployeeName = $('#employeeName').val();
var NoOfDays = $('#NoOfDays').val();
var employeeDesignation = $('#employeeDesignation').val();
var formData = new FormData();
formData.append('_token', token);
formData.append('LeaveId', '<?php echo $LeaveDetails->LeaveId; ?>');
formData.append('EmployeeId', EmployeeId);
formData.append('EmployeeCode', EmployeeCode);
formData.append('employeeDepartment', employeeDepartment);
formData.append('LeaveType', LeaveType);
formData.append('UserName', UserName);
formData.append('Authority', Authority);
formData.append('Approved', Approved);
formData.append('leaveStartDate', leaveStartDate);
formData.append('leaveEndDate', leaveEndDate);
formData.append('Remarks', Remarks);
formData.append('EmployeeName', EmployeeName);
formData.append('employeeDesignation', employeeDesignation);
formData.append('LeaveDay', LeaveDay);
formData.append('NoOfDays', NoOfDays);
$.ajax({
type: "post",
url: "<?php echo e(url('ajax/leave/edit')); ?>",
//data: $('form#addEmpQualificationForm').serialize(),
data : formData,
processData: false,
contentType: false,
success: function(response) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'success',
title: 'Leave application update successfully!'
});
$('form#addEmpQualificationForm').each(function() {
this.reset();
});
$('span#CheckActualWorkPlace').html('');
location.href="<?php echo e(url('/all-application')); ?>";
},
error: function(response) {
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'error',
title: 'Something went wrong!'
})
}
});
}
}
</script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "GET",
url: "<?php echo e(url('/officer-name-list')); ?>",
dataType: "json",
success: function(response) {
var json = response.officerNameList;
var ApprovalProfileId = '<?php echo e($ApprovalDetail->ProfileId); ?>';
$.each(json, function(i, ProfileDetails) {
if(ApprovalProfileId === ProfileDetails.ProfileId)
{
$("#ProfileName").append("<option selected value='" + ProfileDetails.ProfileId + "'>" + ProfileDetails.ProfileName + "</option>");
$('#ProfileName').trigger('change');
}
else
{
if(ProfileDetails.ProfileName != "User"){
$("#ProfileName").append("<option value='" + ProfileDetails.ProfileId + "'>" + ProfileDetails.ProfileName + "</option>");
$('#ProfileName').trigger('change');
}
}
});
}
});
});
$(document).ready(function(e) {
$('#ProfileName').change(function(e) {
var ProfileId = $(this).val();
if (ProfileId == null) {
return false;
}
else{
$("#Authority").empty();
$.ajax({
type: "GET",
url: "<?php echo e(url('/profile-wise-officer/')); ?>/"+ProfileId,
dataType: "json",
success: function(response) {
var json = response.officerWiseName;
var authority = '<?php echo e($LeaveDetails->AssignTo); ?>';
let array = authority.split(",");
$("#Authority").empty();
$.each(json, function(i, UserDetails) {
var firstname = UserDetails.FirstName;
var middlename = UserDetails.MiddleName;
if (middlename) {
var middlename = UserDetails.MiddleName;
} else {
var middlename = '';
}
var lastname = UserDetails.LastName;
if (lastname) {
var lastname = UserDetails.LastName;
} else {
var lastname = '';
}
if(array.includes(UserDetails.UserId)){
$("#Authority").append("<option selected value='" + UserDetails.UserId + "'>" + firstname +' '+ middlename + ' ' + lastname + "</option>");
$('#Authority').trigger('change');
}
else{
$("#Authority").append("<option value='" + UserDetails.UserId + "'>" + UserDetails.FirstName + "</option>");
$('#Authority').trigger('change');
}
});
}
});
}
e.preventDefault();
});
});
</script>
<!-- /.content-wrapper -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.include.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/hrms/resources/views/admin/LeaveManagement/edit-application.blade.php ENDPATH**/ ?>