|
|
@ -261,8 +261,9 @@ padding-top: 2%; |
|
|
<label for="no" class="form-check-label">No</label> |
|
|
<label for="no" class="form-check-label">No</label> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|
|
|
|
|
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration"> |
|
|
|
|
|
|
|
|
<div id="clickyesdiv" style="display: none; margin-top: 10px;"> |
|
|
|
|
|
<label for="clickyes" class="form-label">Please specify:<span class="text-danger">*</span></label> |
|
|
|
|
|
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -362,7 +363,7 @@ $(document).ready(function (){ |
|
|
$('#pendingDurationInput').val(''); |
|
|
$('#pendingDurationInput').val(''); |
|
|
$('#remarks').val(''); |
|
|
$('#remarks').val(''); |
|
|
$('input[name="pendingDuration"]').prop('checked', false); |
|
|
$('input[name="pendingDuration"]').prop('checked', false); |
|
|
document.getElementById("pendingDurationInputContainer").style.display = "none"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// STEP 1: Check if the employee already exists in the database. |
|
|
// STEP 1: Check if the employee already exists in the database. |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
@ -467,6 +468,34 @@ $(document).ready(function (){ |
|
|
}); |
|
|
}); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Function to handle radio button state based on retirement date |
|
|
|
|
|
function handlePendingDurationState() { |
|
|
|
|
|
const currentDate = new Date().toISOString().split('T')[0]; // Get today's date in YYYY-MM-DD format |
|
|
|
|
|
const retirementDate = employeeDetails.RETIREMENT_DATE; // Assuming this comes in YYYY-MM-DD format |
|
|
|
|
|
|
|
|
|
|
|
const yesRadio = document.getElementById("yes"); |
|
|
|
|
|
const noRadio = document.getElementById("no"); |
|
|
|
|
|
|
|
|
|
|
|
const inputFieldDiv = document.getElementById('clickyesdiv'); |
|
|
|
|
|
if (retirementDate <= currentDate) { |
|
|
|
|
|
// If retirement date is less than or equal to current date, disable 'Yes' option |
|
|
|
|
|
|
|
|
|
|
|
yesRadio.checked = true; |
|
|
|
|
|
inputFieldDiv.style.display = 'block'; |
|
|
|
|
|
noRadio.disabled = true; // Default to 'No' |
|
|
|
|
|
} else { |
|
|
|
|
|
// If retirement date is greater than current date, disable 'No' option |
|
|
|
|
|
noRadio.checked = true; |
|
|
|
|
|
yesRadio.disabled = true; // Default to 'Yes' |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Call the function after fetching `employeeDetails` |
|
|
|
|
|
handlePendingDurationState(); |
|
|
|
|
|
|
|
|
// Populate the form fields with the fetched employee details. |
|
|
// Populate the form fields with the fetched employee details. |
|
|
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|
|
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|
|
@ -631,21 +660,21 @@ $(document).ready(function (){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function saveEntryDetails() { |
|
|
function saveEntryDetails() { |
|
|
|
|
|
|
|
|
let pendingDuration= $('input[name="pendingDuration"]:checked').val(); |
|
|
|
|
|
let pendingDurationReason=null; |
|
|
|
|
|
if (pendingDuration === 'yes' ) { |
|
|
|
|
|
pendingDurationReason = $('#pendingDurationInput').val(); // Retrieve the amount if available, else null |
|
|
|
|
|
if (!pendingDurationReason) { |
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'warning', |
|
|
|
|
|
title: 'Validation Error', |
|
|
|
|
|
text: 'Please Enter Pending Reason', |
|
|
|
|
|
confirmButtonText: 'OK' |
|
|
|
|
|
}); |
|
|
|
|
|
return; // Stop further execution if validation fails |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let selectedPendingDurationValue = $('input[name="pendingDuration"]:checked').val(); |
|
|
|
|
|
let selectedReasonValue = $('#reason').val(); |
|
|
|
|
|
// Check for "Yes" in Pending Duration |
|
|
|
|
|
if (selectedPendingDurationValue === 'yes') { |
|
|
|
|
|
selectedReasonPending = $('#Clickyes').val()?.trim() || null; |
|
|
|
|
|
if (!selectedReasonPending) { |
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'warning', |
|
|
|
|
|
title: 'Validation Error', |
|
|
|
|
|
text: 'Please specify the reason for selecting "Yes" for Pending Duration.', |
|
|
|
|
|
confirmButtonText: 'OK' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//pendencyCategory:$('#typeofcategory').val(), |
|
|
//pendencyCategory:$('#typeofcategory').val(), |
|
|
|
|
|
|
|
|
@ -658,8 +687,8 @@ $(document).ready(function (){ |
|
|
retirementclass: $('#classes').val(), |
|
|
retirementclass: $('#classes').val(), |
|
|
typeOfRetirement: $('#retirement').val(), |
|
|
typeOfRetirement: $('#retirement').val(), |
|
|
retirementDate:$('#retirementdate').val(), |
|
|
retirementDate:$('#retirementdate').val(), |
|
|
pendingDuration: pendingDuration, |
|
|
|
|
|
reasonPending: pendingDurationReason, |
|
|
|
|
|
|
|
|
pendingDuration: selectedPendingDurationValue, |
|
|
|
|
|
reasonPending: selectedReasonPending || null, |
|
|
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), |
|
|
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), |
|
|
remarks: $('#remarks').val(), |
|
|
remarks: $('#remarks').val(), |
|
|
deptId:$('#deptId').text().trim(), |
|
|
deptId:$('#deptId').text().trim(), |
|
|
|