You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1415 lines
62 KiB

<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<style>
.required{
color: red;
}
#returnretrieddetailsModal .modal-body{
max-height:80vh;
overflow-y:auto;
}
#returnretrieddetailsModal .col-md-12,.col-md-4,.col-md-6{
padding-bottom: 10px;
}
.file-history-list {
margin-top: 10px;
padding-left: 0;
}
.file-history-item {
display: flex;
padding: 5px 10px;
font-family: Arial, sans-serif;
align-items: flex-start;
position: relative; /* For vertical line positioning */
margin-bottom: 1px; /* Add space between items */
}
.file-history-item::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 120px; /* Position of the vertical line */
width: 1px;
background-color: #ddd;
}
.file-history-date {
margin-top: 10px;
flex: 0 0 100px;
font-weight: bold;
font-size: 0.8rem;
color: #333;
text-align: center;
white-space: nowrap; /* Prevent wrapping */
}
.file-history-content {
flex: 5;
padding-left: 20px; /* Adds space after the vertical line */
display: flex;
flex-direction: column;
gap: 5px; /* Adds spacing between status and remarks */
white-space: pre-wrap; /* Prevents wrapping */
overflow: visible; /* Prevents content overflow */
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */
}
.file-history-status {
font-size: 0.8rem;
font-weight: bold;
color: #555;
white-space:pre-wrap; /* Prevent wrapping */
overflow: visible;
text-overflow: ellipsis;
}
.file-history-remarks {
font-size: 0.8rem;
color: #777;
white-space: pre-wrap; /* Prevent wrapping */
overflow: visible;
text-overflow: ellipsis;
}
.col-md-4 .form-check{
width: 25%;
}
.col-md-6 .form-check{
width: 25%;
}
.form-check-label{
padding-top: 4%;
}
</style>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="wrapper">
<!-- header top menu Start -->
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<!-- header top menu end -->
<div class="page-wrap">
<!--=============== Left Menu side Start ================-->
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<!--=============== Left side End ================-->
<div class="main-content">
<div class="container-fluid">
<div class="page-header mb-2">
<div class="row align-items-end">
<div class="col-lg-8">
<div class="page-header-title">
<i class="fa fa-list-alt bg-blue"></i>
<div class="d-inline">
<h5>Pendency</h5>
<span>Pensioner Entries</span>
</div>
</div>
</div>
<div class="col-lg-4">
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li>
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li>
<li class="breadcrumb-item" aria-current="page">Received From Department</li>
<li class="breadcrumb-item active" aria-current="page">Pendency</li>
</ol>
</nav>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
<div class="card">
<div class="card-block">
<h5 style="font-weight:bold;">Received From Department - Pendency</h5>
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5>
<span th:text="${userId}" id="userId" style="display:none"></span>
<div id="returnretriedtable">
<table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
<thead class="thead-dark">
<tr role="row">
<th class="text-center">S.No</th>
<th class="text-center">Employee Code</th>
<th class="text-center">Name </th>
<th class="text-center">Department</th>
<th class="text-center">Designation</th>
<th class="text-center">File Sent Date</th>
<th class="text-center">File Type</th>
<th class="text-center">View</th>
</tr>
</thead>
<tbody style="text-align:center;">
<!-- Thymeleaf loop to populate data -->
<tr th:each="forward, iterStat : ${forwardlist}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${forward['emp_no']}" class="text-center"></td>
<td th:text="${forward['emp_name']}" class="text-center"></td>
<td th:text="${forward['dept_name']}" class="text-center"></td>
<td th:text="${forward['designation']}" class="text-center"></td>
<td th:text="${forward['file_moved_date'] != null ? #dates.format(forward['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
<td th:text="${forward['file_entry_type']}" class="text-center"></td>
<td class="text-center">
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${forward['emp_no']}, data-temp-id=${forward['temp_id']}">
View
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<!-- Modal Box -->
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="detailsModalLabel">
Received From Department - Pendency (<span id="modalEmployeeCode"></span>)
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Employee No -->
<div class="col-md-4">
<label for="employeenomodel" class="form-label fw-bold">Employee No </label>
<input type="number" id="employeenomodel" class="form-control" readonly>
</div>
<!-- Employee Name -->
<div class="col-md-4">
<label for="employeename" class="form-label fw-bold">Employee Name </label>
<input type="text" id="employeename" class="form-control" readonly>
</div>
<!-- Department -->
<div class="col-md-4">
<label for="department" class="form-label fw-bold">Department </label>
<input type="text" id="department" class="form-control" readonly>
</div>
<!-- Designation -->
<div class="col-md-4">
<label for="designation" class="form-label fw-bold">Designation </label>
<input type="text" id="designation" class="form-control" readonly>
</div>
<div class="col-md-4">
<label for="classes" class="form-label fw-bold">Class</label>
<input type="text" id="classes" class="form-control" readonly>
</div>
<div class="col-md-4">
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label>
<input type="date" id="retirementdate" class="form-control" readonly>
</div>
<!-- Type of Retirement -->
<div class="col-md-4">
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label>
<input type="text" id="typeofretirement" class="form-control" readonly>
</div>
<div class="col-md-4">
<label for="pendingDuration" class="form-label fw-bold">
Pending Duration
</label>
<div class="d-flex align-items-center">
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled>
<label for="yes" class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled>
<label for="no" class="form-check-label">No</label>
</div>
</div>
<div class="text" id="pendingDurationInputContainer" style="margin-top: 10px;">
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-md-4">
<label class="form-label fw-bold">GPF</label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes">
<label class="form-check-label" for="gpfYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no">
<label class="form-check-label" for="gpfNo">No</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90">
<label class="form-check-label" for="gpf50">90%</label>
</div>
</div>
<!-- Placeholder for dynamically added input -->
<div id="gpfAmountDiv" class="mt-3" style="display: none;">
<label for="gpfAmount" class="form-label">GPF Amount</label>
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)">
</div>
</div>
<div class="col-md-4">
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs</label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes">
<label class="form-check-label" for="earnedleaveYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no">
<label class="form-check-label" for="earnedleaveNo">No</label>
</div>
</div>
<!-- Placeholder for dynamically added input -->
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;">
<label for="earnedleaveAmount" class="form-label">EL and LPA Amount</label>
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)">
</div>
</div>
<div class="col-md-4">
<label class="form-label fw-bold">SPFGS</label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes">
<label class="form-check-label" for="spfgsYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no">
<label class="form-check-label" for="spfgsNo">No</label>
</div>
</div>
<!-- Placeholder for dynamically added input -->
<div id="spfgsAmountDiv" class="mt-3" style="display: none;">
<label for="spfgsAmount" class="form-label">SPFGS Amount</label>
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)">
</div>
</div>
<div class="col-md-4">
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label>
<input type="text" id="recoveryemployeevalue" class="form-control" >
</div>
<div class="col-md-4">
<label class="form-label fw-bold">DCRG File is Ready</label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes">
<label class="form-check-label" for="dcrgYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no">
<label class="form-check-label" for="dcrgNo">No</label>
</div>
</div>
</div>
</div>
<div class="row mt-2">
<!-- Date File Sent to Audit -->
<div class="col-md-4">
<label for="datefile_modal" class="form-label fw-bold">Date File sent to Pension </label>
<input type="text" id="datefile_modal" class="form-control" readonly>
</div>
<!-- Remarks -->
<div class="col-md-12">
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks</label>
<textarea id="remarks_modal" class="form-control" rows="4" readonly></textarea>
</div>
</div>
<!-- new -->
<div class="col-md-12 mt-4">
<h5>File History</h5>
<div id="fileHistoryContainer" class="file-history-list">
<!-- File History will be dynamically loaded here -->
</div>
</div>
<div class="row mb-2 mt-2">
<div class="col-md-12 d-flex justify-content-center">
<button type="button" class="btn btn-primary mx-2" id="benefitbutton">Add Pension Benefits</button>
<button type="button" class="btn btn-info mx-2" id="returndisplaybutton">Return to Department</button>
<button type="button" class="btn btn-secondary mx-2" data-dismiss="modal" id="back">Back</button>
</div>
</div>
<div style="display :none" id="commonbenefitcard">
<div class="col-md-6">
<label class="form-label fw-bold">File Pending<span class="text-danger">*</span></label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="PendingYes" name="filepending" value="yes">
<label class="form-check-label" for="PendingYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="PendingNo" name="filepending" value="no">
<label class="form-check-label" for="PendingNo">No</label>
</div>
</div>
</div>
</div>
<div style="display :none" id="filependingContainer">
<div class="row">
<div class="col-md-6">
<label for="datefileyes" class="form-label fw-bold">Enter file received Date<span class="text-danger">*</span></label>
<input type="text" id="datefileyes" class="form-control" readonly>
</div>
<div class="col-md-12">
<label for="remarksyes" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
<textarea id="remarksyes" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
</div>
</div>
<div class="row mb-2 mt-2">
<div class="col-md-12 d-flex justify-content-center">
<button type="button" class="btn btn-primary" id="pendingbutton">Submit</button>
</div>
</div>
</div>
<div style="display :none" id="benefitContainer">
<div class="row">
<div class="col-md-6">
<label for="pensionNumber" class="form-label">Pension Number<span class="text-danger">*</span></label>
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number">
</div>
<div class="col-md-6">
<label for="ledgerNumber" class="form-label">Ledger Number<span class="text-danger">*</span></label>
<input type="text" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number">
</div>
<div class="col-md-6 mb-2">
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension<span class="text-danger">*</span></label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes">
<label class="form-check-label" for="bpYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no">
<label class="form-check-label" for="bpNo">No</label>
</div>
</div>
<!-- Placeholder for dynamically added input -->
<div id="PbAmountDiv" class="mt-3" style="display: none;">
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount<span class="text-danger">*</span></label>
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" min="1" oninput="validatePositiveNumber(this)">
</div>
</div>
<div class="col-md-6 mb-2" id="dcrgCard" style="display: none;">
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG</label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes">
<label class="form-check-label" for="DcrgYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no">
<label class="form-check-label" for="DcrgNo">No</label>
</div>
</div>
<!-- Placeholder for dynamically added input -->
<div id="dcrgAmountDiv" class="mt-3" style="display: none;">
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount<span class="text-danger">*</span></label>
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" min="1" oninput="validatePositiveNumber(this)">
</div>
</div>
<div class="col-md-6 mb-2">
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation<span class="text-danger">*</span></label>
<div class="d-flex align-items-center gap-5">
<div class="form-check">
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes">
<label class="form-check-label" for="commutationYes">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no">
<label class="form-check-label" for="commutationNo">No</label>
</div>
</div>
<!-- Placeholder for dynamically added input -->
<div id="CommutationAmountDiv" class="mt-3" style="display: none;">
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount<span class="text-danger">*</span></label>
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" min="1" oninput="validatePositiveNumber(this)">
</div>
</div>
<div class="col-md-6">
<label for="datefilereceived" class="form-label fw-bold">File Received Date <span class="text-danger">*</span></label>
<input type="text" id="datefilereceived" class="form-control" readonly>
</div>
<div class="col-md-12">
<label for="remarksreceived" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
<textarea id="remarksreceived" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
</div>
</div>
<div class="row mb-2 mt-2">
<div class="col-md-12 d-flex justify-content-center">
<button type="button" class="btn btn-primary" id="completedbutton">Mark as Completed</button>
</div>
</div>
</div>
<div style="display :none" id="receivedcard">
<div class="row">
<!-- Date File Sent to Audit -->
<div class="col-md-6">
<label for="datefile" class="form-label fw-bold">Enter Date File Returned to Department <span class="text-danger">*</span></label>
<input type="text" id="datefile" class="form-control" readonly>
</div>
<!-- Remarks -->
<div class="col-md-12">
<label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label>
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea>
</div>
</div>
<div class="row mb-2 mt-2">
<div class="col-md-12 d-flex justify-content-center">
<button type="button" class="btn btn-primary" id="returnsubmit">Return</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
<script th:replace="~{fragments/modules/base/script :: script}"></script>
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Bootstrap 5 JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$(document).ready(function () {
// Initialize DataTable
const table = $('#ReturnRetriedDatatable').DataTable({
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning' },
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' },
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' },
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' },
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' }
],
fixedHeader: true,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false
});
});
document.addEventListener("DOMContentLoaded", function() {
// Get today's date
const today = new Date();
// Format the date as DD-MM-YYYY for display
const day = String(today.getDate()).padStart(2, '0');
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
const year = today.getFullYear();
// Combine into DD-MM-YYYY format for display
const formattedDateDisplay = `${day}-${month}-${year}`;
// Set the value of the input field to the current date (in DD-MM-YYYY format for display)
document.getElementById("datefile").value = formattedDateDisplay;
document.getElementById("datefilereceived").value = formattedDateDisplay;
document.getElementById("datefileyes").value = formattedDateDisplay;
});
function convertDateFormat(dateString) {
if (!dateString) return '';
let [day, month, year] = dateString.split('-');
return `${year}-${month}-${day}`;
}
//model function
function fetchEmployeeDetails(tempId) {
$.ajax({
url: '/gcc/api/department/audit/getfilependingbenefits', // API to fetch employee details
type: 'GET',
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter
success: function (response) {
if (response && response.length > 0) {
let BenefitDetails = response[0]; // Access the first object in the array
console.log("response:",response);
// Populate modal fields
$('#employeenomodel').val(BenefitDetails.emp_no);
$('#employeename').val(BenefitDetails.emp_name);
$('#department').val(BenefitDetails.dept_name);
$('#designation').val(BenefitDetails.designation);
$('#typeofretirement').val(BenefitDetails.type_of_retirement);
$('#classes').val(BenefitDetails.retirement_class);
$('#datefile_modal').val(BenefitDetails.file_moved_date);
$('#remarks_modal').val(BenefitDetails.remarks);
$('#retirementdate').val(BenefitDetails.retirement_date);
// Show Pending Duration and Input based on the value
let pendingDuration = BenefitDetails.pending_duration; // Assuming this comes from the response
let pendingReason = BenefitDetails.reason_for_pending; // Assuming this comes from the response
if (pendingDuration === "yes") {
$('#pendingDurationInputContainer').show(); // Show the text box
$('#pendingDurationInput').val(pendingReason); // Populate the input field
} else {
$('#pendingDurationInputContainer').hide(); // Hide the text box
}
// Update radio button selection
if (pendingDuration === "yes") {
$('#yes').prop('checked', true);
} else {
$('#no').prop('checked', true);
}
let file_Pending=BenefitDetails.file_pending;
console.log("file_pending=:"+file_Pending);
// Populate GPF
if (BenefitDetails.gpf === 'yes') {
$('#gpfYes').prop('checked', true); // Disable radio
$('#gpfNo').prop('disabled', true);
$('#gpf50').prop('disabled', true);
$('#gpfAmountDiv').show();
$('#gpfAmount').val(BenefitDetails.gpf_amount).prop('readonly', true); // Make input readonly
} else if (BenefitDetails.gpf === 'no') {
$('#gpfNo').prop('checked', true);
$('#gpfYes').prop('disabled', true);
$('#gpf50').prop('disabled', true);
$('#gpfAmountDiv').hide();
} else if (BenefitDetails.gpf === '90') {
$('#gpf50').prop('checked', true);
$('#gpfYes').prop('disabled', true);
$('#gpfNo').prop('disabled', true);
$('#gpfAmountDiv').show();
$('#gpfAmount').val(BenefitDetails.gpf_amount).prop('readonly', true);
}
// Populate Earned Leave & Leave on Private Affairs
if (BenefitDetails.private_affairs === 'yes') {
$('#earnedleaveYes').prop('checked', true);
$('#earnedleaveNo').prop('disabled', true);
$('#earnedleaveAmountDiv').show();
$('#earnedleaveAmount').val(BenefitDetails.private_affairs_amount).prop('readonly', true);
} else if (BenefitDetails.private_affairs === 'no') {
$('#earnedleaveNo').prop('checked', true);
$('#earnedleaveYes').prop('disabled', true);
$('#earnedleaveAmountDiv').hide();
}
// Populate SPFGS
if (BenefitDetails.spfgs === 'yes') {
$('#spfgsYes').prop('checked', true);
$('#spfgsNo').prop('disabled', true);
$('#spfgsAmountDiv').show();
$('#spfgsAmount').val(BenefitDetails.spfgs_amount).prop('readonly', true);
} else if (BenefitDetails.spfgs === 'no') {
$('#spfgsNo').prop('checked', true);
$('#spfgsYes').prop('disabled', true);
$('#spfgsAmountDiv').hide();
}
// Populate Recovery From Employee
$('#recoveryemployeevalue')
.val(BenefitDetails.recovery_emp)
.prop('readonly', true); // Make input readonly
// Populate DCRG
if (BenefitDetails.dcrg === 'yes') {
$('#dcrgYes').prop('checked', true);
$('#dcrgNo').prop('disabled', true);
/* $('#DcrgYes').prop('disabled', false);
$('#DcrgNo').prop('disabled', false); */
$('#dcrgCard').show();
} if (BenefitDetails.dcrg === 'no') {
$('#dcrgNo').prop('checked', true);
$('#dcrgYes').prop('disabled', true);
/* $('#DcrgYes').prop('disabled', true);
$('#DcrgNo').prop('disabled', true); */
$('#dcrgCard').hide();
}
// Update the modal title with the employee code
$('#modalEmployeeCode').text(BenefitDetails.emp_no);
// Show the modal
$('#returnretrieddetailsModal').modal('show');
//additional card display function
document.getElementById("returndisplaybutton").addEventListener("click", function() {
//$('#datefile').val('');
$('#remarks').val('');
document.getElementById("commonbenefitcard").style.display = "none";
document.getElementById("receivedcard").style.display = "block";
document.getElementById("benefitContainer").style.display = "none";
document.getElementById("filependingContainer").style.display = "none";
document.getElementById("returndisplaybutton").scrollIntoView({
behavior: "smooth", // Smooth scrolling effect
block: "center" // Aligns the element to the center of the viewport
});
});
/* $('#benefitbutton').off('click').on('click', function() {
document.getElementById("benefitbutton").scrollIntoView({
behavior: "smooth", // Smooth scrolling effect
block: "center" // Aligns the element to the center of the viewport
});
if(file_Pending==='yes'){
$('input[name="filepending"][value="' + BenefitDetails.file_pending + '"]').prop('checked', true);
$('#commonbenefitcard').show();
$('#filependingContainer').show();
$('#datefileyes').val(BenefitDetails.file_moved_date);
$('#remarksyes').val(BenefitDetails.remarks);
$('#pendingbutton').prop('disabled', true);
}
else{
$('input[name="filepending"]').prop('checked', false);
document.getElementById("commonbenefitcard").style.display = "block";
document.getElementById("receivedcard").style.display = "none";
$('#pendingbutton').prop('disabled', false);
}
}); */
$('#benefitbutton').off('click').on('click', function() {
// Show the required elements first
$('#commonbenefitcard').show();
// Delay scroll to ensure elements are fully rendered
setTimeout(() => {
document.getElementById("benefitbutton").scrollIntoView({
behavior: "smooth",
block: "center"
});
}, 100); // Small delay
if (file_Pending === 'yes') {
$('input[name="filepending"][value="' + BenefitDetails.file_pending + '"]').prop('checked', true);
$('#filependingContainer').show();
$('#datefileyes').val(BenefitDetails.file_moved_date);
$('#remarksyes').val(BenefitDetails.remarks);
$('#pendingbutton').prop('disabled', true);
$('#pendingbutton').hide();
} else {
$('input[name="filepending"]').prop('checked', false);
document.getElementById("receivedcard").style.display = "none";
$('#pendingbutton').prop('disabled', false);
}
});
// Function to scroll inside the modal
function scrollToElement(targetElement) {
var modalBody = $('#returnretrieddetailsModal .modal-body');
// Ensure the modal content is fully loaded before scrolling
setTimeout(function () {
modalBody.animate({
scrollTop: $(targetElement).offset().top - modalBody.offset().top + modalBody.scrollTop()
}, 'fast');
}, 200);
}
//Scroll when "PendingYes" is clicked
$('input[name="filepending"]').on('change', function () {
if ($(this).val() === "yes") {
$("#filependingContainer").show(); // Show before scrolling
scrollToElement("#filependingContainer");
} else {
$("#filependingContainer").hide();
$("#benefitContainer").show(); // Ensure benefitContainer is visible
scrollToElement("#benefitContainer"); // Scroll to benefitContainer
}
});
/* document.getElementById("benefitbutton").addEventListener("click", function() {
$('input[name="filepending"]').prop('checked', false);
document.getElementById("commonbenefitcard").style.display = "block";
document.getElementById("receivedcard").style.display = "none";
});
document.getElementById('pendingbutton').addEventListener('click', function () {
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
savePendingDetails(tempId,employeeNo);
}); */
$('#pendingbutton').off('click').on('click', function () {
let employeeNo = $('#employeenomodel').val(); // Get the employee number
savePendingDetails(tempId, employeeNo); // Call function with parameters
});
/* $(document).off('click', '#completedbutton').on('click', '#completedbutton', function () {
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
saveCompletedDetails(tempId,employeeNo);
}); */
$('#completedbutton').off('click').on('click', function () {
let employeeNo = $('#employeenomodel').val(); // Get the employee number
saveCompletedDetails(tempId, employeeNo); // Call function with parameters
});
/* document.getElementById('returnsubmit').addEventListener('click', function () {
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
saveReturnDetails(tempId,employeeNo);
}); */
$('#returnsubmit').off('click').on('click', function () {
let employeeNo = $('#employeenomodel').val(); // Get the employee number
saveReturnDetails(tempId, employeeNo); // Call function with parameters
});
} else {
Swal.fire({
icon: 'info',
title: 'No Data',
text: 'No details found for the selected employee.',
confirmButtonText: 'OK',
});
}
},
error: function () {
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to fetch employee details. Please try again.',
confirmButtonText: 'OK',
});
},
});
}
$(document).ready(function () {
$(document).on('click', '.view-btn', function () {
const empCode = $(this).data('id'); // Fetch `data-id` value
console.log("empCode====="+empCode);
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value
// Hide the receivedcard section before showing the modal
$("#receivedcard").hide();
$("#commonbenefitcard").hide();
$("#filependingContainer").hide();
$("#benefitContainer").hide()
fetchEmployeeDetails(tempId); // Call the function to fetch employee details
loadFileHistory(tempId); // Load the file history for the selected employee
});
// Initialize the modal with static backdrop and disabled keyboard closing
$('#returnretrieddetailsModal').modal({
backdrop: 'static',
keyboard: false,
show: false // Ensure it doesn't auto-show on page load
});
// Handle close button click
$('#back').click(function () {
$('#returnretrieddetailsModal').modal('hide');
});
$('.close').click(function () {
$('#returnretrieddetailsModal').modal('hide');
});
document.querySelectorAll('input[name="filepending"]').forEach(radio => {
radio.addEventListener('change', function () {
const filependingContainer = document.getElementById('filependingContainer')
const benefitContainer = document.getElementById('benefitContainer');
if (this.value === 'yes') {
filependingContainer.style.display = 'block'; // Show the input field
//document.getElementById('datefileyes').value = '';
document.getElementById('remarksyes').value = '';
document.getElementById("benefitContainer").style.display = "none";
}if (this.value === 'no') {
benefitContainer.style.display = 'block'; // Hide the input field
filependingContainer.style.display = 'none';
// pensionNumber,ledgerNumber,benefit_pension,benefit_dcrg,benefit_commutation,datefilereceived,remarksreceived
document.getElementById('pensionNumber').value = '';
document.getElementById('ledgerNumber').value = '';
$('input[name="benefit_pension"]').prop('checked', false);
$('input[name="benefit_dcrg"]').prop('checked', false);
$('input[name="benefit_commutation"]').prop('checked', false);
document.getElementById('benefit_pension_amount').value = '';
document.getElementById('benefit_dcrg_amount').value = '';
document.getElementById('benefit_commutation_amount').value = '';
//document.getElementById('datefilereceived').value = '';
document.getElementById('remarksreceived').value = '';
document.getElementById("filependingContainer").style.display = "none";
document.getElementById("PbAmountDiv").style.display = "none";
document.getElementById("dcrgAmountDiv").style.display = "none";
document.getElementById("CommutationAmountDiv").style.display = "none";
}
});
});
document.querySelectorAll('input[name="benefit_pension"]').forEach(radio => {
radio.addEventListener('change', function () {
const PbAmountDiv = document.getElementById('PbAmountDiv');
if (this.value === 'yes') {
PbAmountDiv.style.display = 'block'; // Show the input field
} else {
PbAmountDiv.style.display = 'none'; // Hide the input field
document.getElementById('benefit_pension_amount').value = ''; // Clear the input field
}
});
});
document.querySelectorAll('input[name="benefit_dcrg"]').forEach(radio => {
radio.addEventListener('change', function () {
const dcrgAmountDiv = document.getElementById('dcrgAmountDiv');
if (this.value === 'yes') {
dcrgAmountDiv.style.display = 'block'; // Show the input field
} else {
dcrgAmountDiv.style.display = 'none'; // Hide the input field
document.getElementById('benefit_dcrg_amount').value = ''; // Clear the input field
}
});
});
document.querySelectorAll('input[name="benefit_commutation"]').forEach(radio => {
radio.addEventListener('change', function () {
const CommutationAmountDiv = document.getElementById('CommutationAmountDiv');
if (this.value === 'yes') {
CommutationAmountDiv.style.display = 'block'; // Show the input field
} else {
CommutationAmountDiv.style.display = 'none'; // Hide the input field
document.getElementById('benefit_commutation_amount').value = ''; // Clear the input field
}
});
});
});
function loadFileHistory(tempId) {
$.ajax({
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint
type: 'GET',
data: { tempId: tempId }, // Pass empCode as a parameter
success: function (response) {
if (response.length > 0) {
let historyHtml = '';
response.forEach(item => {
historyHtml += `
<div class="file-history-item">
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div>
<div class="file-history-content">
<div class="file-history-status">${item.fileStatusHistory}</div>
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div>
</div>
</div>
`;
});
$('#fileHistoryContainer').html(historyHtml);
} else {
$('#fileHistoryContainer').html('<p>No file history available.</p>');
}
},
error: function () {
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>');
}
});
}
// Function to format date and time
function formatDateTime(dateString) {
const options = {
day: '2-digit',
month: '2-digit',
year: 'numeric',
};
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy
}
function saveCompletedDetails(tempId,empCode) {
//console.log("emp_no inside=="+empCode);
let selecteddcrg=null;
let selbenefitdcrgamount=null;
let selectedfilePending = $('input[name="filepending"]:checked').val();
let selectedPd = $('input[name="benefit_pension"]:checked').val();
let selectedPdAmount=null;
if (selectedPd === 'yes') {
selectedPdAmount = $('#benefit_pension_amount').val();
if (!selectedPdAmount) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Please Enter Pension Benefit Amount',
confirmButtonText: 'OK'
});
return; // Stop further execution if validation fails
}
}
let confirmDcrg=$('input[name="dcrg"]:checked').val();
if(confirmDcrg == 'yes'){
selecteddcrg = $('input[name="benefit_dcrg"]:checked').val();
selbenefitdcrgamount=null;
if(!selecteddcrg)
{
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Please Select DCRG Pension Benefit',
confirmButtonText: 'OK'
});
return;
}
if(selecteddcrg ==='yes'){
selbenefitdcrgamount=$('#benefit_dcrg_amount').val();
if (!selbenefitdcrgamount) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Please Enter DCRG Benefit Amount',
confirmButtonText: 'OK'
});
return; // Stop further execution if validation fails
}
}
}
if(confirmDcrg == 'no'){
selecteddcrg=null;
selbenefitdcrgamount=null;
}
let selectedcom = $('input[name="benefit_commutation"]:checked').val();
let selectedcomAmount=null;
if (selectedcom === 'yes') {
selectedcomAmount = $('#benefit_commutation_amount').val();
if (!selectedcomAmount) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Please Enter Commutation Benefit Amount',
confirmButtonText: 'OK'
});
return; // Stop further execution if validation fails
}
}
let entryDetails = {
empNo: empCode,
tempId: tempId,
file_pending:selectedfilePending,
pension_number:$('#pensionNumber').val(),
ledger_number:$('#ledgerNumber').val(),
benefit_pension:selectedPd,
benefit_dcrg:selecteddcrg || null,
benefit_commutation:selectedcom,
benefit_pension_amount:selectedPdAmount,
benefit_dcrg_amount:selbenefitdcrgamount || null,
benefit_commutation_amount:selectedcomAmount,
dateToAudit: convertDateFormat($('#datefilereceived').val()?.trim()),
remarks: $('#remarksreceived').val(),
deptId:$('#deptId').text().trim(),
filemovedby:$('#userId').text().trim()
};
console.log("entryDetails:",entryDetails);
if(!entryDetails.benefit_pension){
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Benefit Pension are required.',
confirmButtonText: 'OK'
});
return;
}
if(!entryDetails.file_pending){
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'File Pending are required.',
confirmButtonText: 'OK'
});
return;
}
if(!entryDetails.benefit_commutation){
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Benefit Commutation are required.',
confirmButtonText: 'OK'
});
return;
}
if(!entryDetails.pension_number){
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Pension Number are required.',
confirmButtonText: 'OK'
});
return;
}
if(!entryDetails.ledger_number){
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Ledger Number are required.',
confirmButtonText: 'OK'
});
return;
}
if (!entryDetails.remarks) {
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Remarks are required.',
confirmButtonText: 'OK'
});
return;
}
// Disable the button to prevent multiple submissions
$('#completedbutton').prop('disabled', true).text('Processing...');
$.ajax({
url: '/gcc/api/pension/received/updateforretirementcompleted',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(entryDetails),
success: function (response) {
$('#completedbutton').prop('disabled', false).text('Mark as Completed');
Swal.fire({
icon: 'success',
title: 'Success',
text: response,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
$('#completedbutton').prop('disabled', false).text('Mark as Completed');
window.location.href = "/gcc/pensioner/received/pendency";
console.log("Continue clicked");
}
});
},
error: function (xhr, status, error) {
$('#completedbutton').prop('disabled', false).text('Mark as Completed');
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to save details. Please try again.',
confirmButtonText: 'OK'
});
console.error('Error:', xhr.responseText);
}
});
}
//savePendingDetails
function savePendingDetails(tempId,empCode) {
//console.log("emp_no inside=="+empCode);
let selectedfilePending = $('input[name="filepending"]:checked').val();
let entryDetails = {
empNo: empCode,
tempId: tempId,
file_pending:selectedfilePending,
dateToAudit: convertDateFormat($('#datefileyes').val()?.trim()),
remarks: $('#remarksyes').val(),
deptId:$('#deptId').text().trim(),
filemovedby:$('#userId').text().trim()
};
console.log("entryDetails:",entryDetails);
if (!entryDetails.file_pending) {
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'File Pending are required.',
confirmButtonText: 'OK'
});
return;
}
if (!entryDetails.remarks) {
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Remarks are required.',
confirmButtonText: 'OK'
});
return;
}
// Disable the button to prevent multiple submissions pendingbutton Submit
$('#pendingbutton').prop('disabled', true).text('Processing...');
$.ajax({
url: '/gcc/api/pension/received/updateforretirementpending',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(entryDetails),
success: function (response) {
$('#pendingbutton').prop('disabled', false).text('Submit');
Swal.fire({
icon: 'success',
title: 'Success',
text: response,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
$('#pendingbutton').prop('disabled', false).text('Submit');
window.location.href = "/gcc/pensioner/received/pendency";
console.log("Continue clicked");
}
});
},
error: function (xhr, status, error) {
$('#pendingbutton').prop('disabled', false).text('Submit');
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to save details. Please try again.',
confirmButtonText: 'OK'
});
console.error('Error:', xhr.responseText);
}
});
}
//saveReturnDetails
//datefile remarks
function saveReturnDetails(tempId,empCode) {
let entryDetails = {
empNo: empCode,
tempId: tempId,
dateToAudit: convertDateFormat($('#datefile').val()?.trim()),
remarks: $('#remarks').val(),
deptId:$('#deptId').text().trim(),
filemovedby:$('#userId').text().trim()
};
console.log("entryDetails:",entryDetails);
if (!entryDetails.remarks) {
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
text: 'Remarks are required.',
confirmButtonText: 'OK'
});
return;
}
//returnsubmit Return
// Disable the button to prevent multiple submissions pendingbutton Submit
$('#returnsubmit').prop('disabled', true).text('Processing...');
$.ajax({
url: '/gcc/api/pension/received/updateforretirementreturn',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(entryDetails),
success: function (response) {
$('#returnsubmit').prop('disabled', false).text('Return');
Swal.fire({
icon: 'success',
title: 'Success',
text: response,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
$('#returnsubmit').prop('disabled', false).text('Return');
window.location.href = "/gcc/pensioner/received/pendency";
console.log("Continue clicked");
}
});
},
error: function (xhr, status, error) {
$('#returnsubmit').prop('disabled', false).text('Return');
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to save details. Please try again.',
confirmButtonText: 'OK'
});
console.error('Error:', xhr.responseText);
}
});
}
//amount field validation
function validatePositiveNumber(input) {
if (input.value < 1) {
input.value = "";
}
}
</script>
</body>
</html>