|
|
<!DOCTYPE html><html lang="en" xmlns:th="http://www.thymeleaf.org"><head th:replace="~{fragments/modules/base/head :: head}"></head><style> .required{ color: red; } #modalBody h4 { font-weight: bold; margin-top: 15px; margin-bottom: 10px; }
#modalBody p { margin: 5px 0; }
#modalBody hr { margin: 15px 0; } .comment { margin-bottom: 20px; }
.comment p { margin: 0; }
hr { border: 1px solid #ccc; margin-top: 20px; margin-bottom: 20px; } h5 { font-size: bold; } /* Limit the height of the dropdown menu and make it scrollable */.dropdown-menu { max-height: 200px; /* Adjust this value as needed */ overflow-y: auto;}
.col-4 { font-weight: bold; text-align: right; }
.col-8 { padding-left: 20px; }
.comment { padding: 10px 0; }
.comment .text-muted { font-size: 0.9em; color: #6c757d; }
.comment hr { border-top: 1px solid #ccc; }
.comment .btn-link { font-size: 0.9em; text-decoration: underline; color: #007bff; } /* Make the modal body scrollable */ #detailsModal .modal-body { max-height: 70vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ } .card-box { border-radius: 20px; box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; } #followupCard { transition: transform 0.2s ease; /* Smooth scaling transition */ cursor: pointer; /* Default cursor change */}
#followupCard:hover { transform: scale(1.05); /* Slightly scale up on hover */ cursor: pointer; /* Change cursor to hand symbol */}
.card-block { padding: 20px;}
.form-label { margin-bottom: 0.5rem;}
input.form-control { padding: 10px;}.form-select { padding: 10px; height: 40px;}
#employeeCard label{padding-top: 2%;}
#returnretrieddetailsModal .modal-body{ max-height:80vh; overflow-y:auto; }
#returnretrieddetailsModal .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-remarks { font-size: 0.8rem; color: #777; white-space: pre-wrap; /* Prevent wrapping */ overflow: visible; text-overflow: ellipsis;}
.form-check { margin-right: 30px; /* Adjust space between Yes and No */}
</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>File Closing</h5> <span>Search Employee Number</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">Retirement File Closing</li> <li class="breadcrumb-item" aria-current="page">File Closing</li> <!-- <li class="breadcrumb-item active" aria-current="page">Family Pension</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;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> <h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> Retirement File Closing</h5> <span th:text="${userId}" id="userId" style="display:none"></span> <div class="row mb-4"> <!-- Input Fields for Year Selection --> <!-- Start Year Dropdown as Button Dropdown --> <!-- Start Year Dropdown as Button Dropdown --> <div class="col-md-4" > <label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label> <div class="dropdown"> <input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required> <small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small> </div> </div>
<div class="col-md-4 mt-20" > <button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button> <!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> --> </div> </div> </div> </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;">Retirement File Closing</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="audittable"> <table id="AuditDatatable" 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;"> </tbody> </table> </div> </div> </div> </div> </div>
</div> </div> <div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> <div style="position: relative; top: 50%; transform: translateY(-50%);"> <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> <span class="sr-only">Loading...</span> </div> <!-- Add the 'Please wait' text below the spinner --> <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> </div> </div> <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> </div> </div>
<!-- model 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"> Retirement File Closing - Employee (<span id="modalEmployeeCode"></span>) </h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="row" id="sec1"> <!-- 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="retirementdate" class="form-label fw-bold">Retirement Date </label> <input type="date" id="retirementdate" class="form-control" readonly> </div> <!-- Class --> <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> <!-- 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> <!-- Date File Sent to Audit --> <div class="col-md-4"> <label for="datefile_modal" class="form-label fw-bold">File Updated Date</label> <input type="date" 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" placeholder="Enter your remarks here" readonly></textarea> </div> </div> <div id="showZoneBenefit"> <hr> <p style="font-weight: bold;font-size: medium;text-decoration: underline;">Zone Benefits</p> <div class="row mt-2" id="sec2"> <!-- GPF --> <div class="col-md-4 mb-2"> <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">Enter GPF Amount</label> <input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)"> </div> </div> <!-- Earned Leave & Leave on Private Affairs --> <div class="col-md-4 mb-2"> <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">Enter EL and LPA Amount</label> <input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)"> </div> </div> <!-- SPFGS --> <div class="col-md-4 mb-2"> <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">Enter 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 mb-2"> <label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> <input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee"> </div> <!-- DCRF File is Ready --> <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> <!-- <p style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</p> --> <!-- <div class="row" id="sec3">
<div class="col-md-4 mt-2 mb-2"> <label for="pensionNumber" class="form-label">Pension Number</label> <input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" > </div> <div class="col-md-4 mt-2 mb-2"> <label for="ledgerNumber" class="form-label">Ledger Number</label> <input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number"> </div> </div> --> <!-- <div class="row mt-2">
<div class="col-md-4 mb-2"> <label class="form-label fw-bold">Sanctions Pensions Benefit-Pension</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</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-4 mb-2"> <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</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-4 mb-2"> <label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation</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</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> --> <!-- file history -->
<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> <hr> <div class="row"> <div class="col-md-3"> <label for="datefile" class="form-label fw-bold">Date File Completed <span class="text-danger">*</span></label> <input type="text" id="datefile" class="form-control" readonly="readonly"> </div> <div class="col-md-3"> <label for="deathdate" class="form-label fw-bold">Employee Death Date<span class="text-danger">*</span></label> <input type="date" id="deathdate" class="form-control" onclick="this.showPicker()"> </div> <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 mt-4"> <div class="col-12 d-flex justify-content-center"> <button id="closedbutton" class="btn btn-warning mt-2 mx-2">Mark as Closed</button> <button id="backbutton" class="btn btn-secondary mt-2" data-dismiss="modal">Back</button> </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 function initializeDataTable() { $('#AuditDatatable').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, paging: true, info: true, ordering: false }); }
// Call once on page load initializeDataTable(); // Trigger search on pressing Enter key $('#empCode').on('keydown', function (event) { if (event.key === 'Enter') { event.preventDefault(); // Prevent default form submission or page reload
const empCode = $('#empCode').val(); // Get the value of empCode if (!empCode) { // Show Swal alert if the employee number is missing Swal.fire({ icon: "warning", // Display a warning icon title: "Missing Employee Number", text: "Please enter an employee number to proceed.", confirmButtonText: "OK", customClass: { confirmButton: "btn btn-primary" // Optional styling for the button } }); return; // Stop further execution } $('#searchButton').click(); // Trigger the click event of the search button } }); // Handle Search button click $('#searchButton').on('click', function () { const empCode = $('#empCode').val(); const deptId=$('#deptId').text().trim(); if (empCode) { $('#pageLoader').show(); document.getElementById("audittable").style.display = "block"; }else{ Swal.fire({ icon: "warning", // Display a warning icon title: "Missing Employee Number", text: "Please enter an employee number to proceed.", confirmButtonText: "OK", customClass: { confirmButton: "btn btn-primary" // Optional styling for the button } }); return; }
$('#pageLoader').show(); $('#audittable').show();
$.ajax({ url: '/gcc/api/fileclosing/getdetails', type: 'GET', data: { empCode: empCode,deptId:deptId }, success: function (response) { console.log("response==",response); let employeeDetails=response; $('#pageLoader').hide(); if (employeeDetails && employeeDetails.length > 0) { populateDataTable(employeeDetails); // Function to populate DataTable } else { Swal.fire({ icon: "warning", title: "No Data Found", text: "No details found for this employee number.", confirmButtonText: "OK", customClass: { confirmButton: "btn btn-primary" } }); } }, error: function () { $('#pageLoader').hide(); Swal.fire({ icon: "error", title: "Error", text: "An error occurred while fetching data. Please try again.", confirmButtonText: "OK" }); } }); });
function populateDataTable(data) { let tbodyHtml = ""; $.each(data, function (index, audit) { tbodyHtml += ` <tr> <td class="text-center">${index + 1}</td> <td class="text-center">${audit.emp_no || 'N/A'}</td> <td class="text-center">${audit.emp_name || 'N/A'}</td> <td class="text-center">${audit.dept_name || 'N/A'}</td> <td class="text-center">${audit.designation || 'N/A'}</td> <td class="text-center">${audit.file_moved_date ? formatDate(audit.file_moved_date, 'dd-MM-yyyy') : 'N/A'}</td> <td class="text-center">${audit.file_entry_type || 'N/A'}</td> <td class="text-center"> <button class="btn btn-primary btn-sm view-btn" data-id="${audit.emp_no}" data-temp-id="${audit.temp_id}"> View </button> </td> </tr>`; });
// Destroy old DataTable before reinitializing let table = $('#AuditDatatable').DataTable(); table.clear().destroy(); $('#AuditDatatable tbody').html(tbodyHtml);
// Reinitialize DataTable with updated data initializeDataTable(); }
function formatDate(dateString, format = 'dd-MM-yyyy') { if (!dateString) return 'N/A';
// Handle case where date might have time part (e.g., "2024-05-31 00:00:00.0") let parts = dateString.split(' ')[0].split('-'); // Extract only the date part if (parts.length !== 3) return 'N/A';
let [year, month, day] = parts; // Assuming date format is "YYYY-MM-DD" if (format === 'dd-MM-yyyy') { return `${day}-${month}-${year}`; } else if (format === 'MM-dd-yyyy') { return `${month}-${day}-${year}`; } else { return dateString; // Default case (return original format) } }
});
//model function function fetchEmployeeDetails(tempId) { $.ajax({ url: '/gcc/api/fileclosing/getemployeedetails', // 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 employeeDetails = response[0]; // Access the first object in the array console.log("response:",response); //console.log("retirementdate",retirementdate); // Populate modal fields $('#employeenomodel').val(employeeDetails.emp_no); $('#employeename').val(employeeDetails.emp_name); $('#department').val(employeeDetails.dept_name); $('#designation').val(employeeDetails.designation); $('#typeofretirement').val(employeeDetails.type_of_retirement); $('#classes').val(employeeDetails.retirement_class); $('#datefile_modal').val(employeeDetails.file_moved_date); $('#remarks_modal').val(employeeDetails.remarks); $('#retirementdate').val(employeeDetails.retirement_date); console.log("retirementdate",retirementdate); let status=employeeDetails.file_status; console.log("status=:"+status); // Update the modal title with the employee code $('#modalEmployeeCode').text(employeeDetails.emp_no);
// Show the modal $('#returnretrieddetailsModal').modal('show'); //zone benefits fields if (status >= 6 && status <= 8) { $('#showZoneBenefit').show(); if (employeeDetails.gpf === 'yes') { $('#gpfYes').prop('checked', true); // Disable radio $('#gpfNo').prop('disabled', true); $('#gpf50').prop('disabled', true); $('#gpfAmountDiv').show(); $('#gpfAmount').val(employeeDetails.gpf_amount).prop('readonly', true); // Make input readonly } else if (employeeDetails.gpf === 'no') { $('#gpfNo').prop('checked', true); $('#gpfYes').prop('disabled', true); $('#gpf50').prop('disabled', true); $('#gpfAmountDiv').hide(); } else if (employeeDetails.gpf === '90') { $('#gpf50').prop('checked', true); $('#gpfYes').prop('disabled', true); $('#gpfNo').prop('disabled', true); $('#gpfAmountDiv').show(); $('#gpfAmount').val(employeeDetails.gpf_amount).prop('readonly', true); }else { $('#gpf50').prop('disabled', true); $('#gpfYes').prop('disabled', true); $('#gpfNo').prop('disabled', true); $('#gpfAmountDiv').hide(); }
// Populate Earned Leave & Leave on Private Affairs if (employeeDetails.private_affairs === 'yes') { $('#earnedleaveYes').prop('checked', true); $('#earnedleaveNo').prop('disabled', true); $('#earnedleaveAmountDiv').show(); $('#earnedleaveAmount').val(employeeDetails.private_affairs_amount).prop('readonly', true); } else if (employeeDetails.private_affairs === 'no') { $('#earnedleaveNo').prop('checked', true); $('#earnedleaveYes').prop('disabled', true); $('#earnedleaveAmountDiv').hide(); } else { $('#earnedleaveNo').prop('disabled', true); $('#earnedleaveYes').prop('disabled', true); $('#earnedleaveAmountDiv').hide(); }
// Populate SPFGS if (employeeDetails.spfgs === 'yes') { $('#spfgsYes').prop('checked', true); $('#spfgsNo').prop('disabled', true); $('#spfgsAmountDiv').show(); $('#spfgsAmount').val(employeeDetails.spfgs_amount).prop('readonly', true); } else if (employeeDetails.spfgs === 'no') { $('#spfgsNo').prop('checked', true); $('#spfgsYes').prop('disabled', true); $('#spfgsAmountDiv').hide(); }else { $('#spfgsNo').prop('disabled', true); $('#spfgsYes').prop('disabled', true); $('#spfgsAmountDiv').hide(); }
// Populate Recovery From Employee $('#recoveryemployeevalue') .val(employeeDetails.recovery_emp) .prop('readonly', true); // Make input readonly
// Populate DCRG if (employeeDetails.dcrg === 'yes') { $('#dcrgYes').prop('checked', true); $('#dcrgNo').prop('disabled', true); }else if (employeeDetails.dcrg === 'no') { $('#dcrgNo').prop('checked', true); $('#dcrgYes').prop('disabled', true); }else { $('#dcrgNo').prop('disabled', true); $('#dcrgYes').prop('disabled', true); } } else if(status <=5) { $('#showZoneBenefit').hide(); } /* $('#pensionNumber').val(employeeDetails.pension_number).prop('readonly',true); $('#ledgerNumber').val(employeeDetails.ledger_number).prop('readonly',true); $('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); if (employeeDetails.benefit_pension === "yes") { $('#PbAmountDiv').show(); $('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount).prop('readonly',true); // bpYes bpNo PbAmountDiv benefit_pension_amount $('#bpYes').prop('checked', true); $('#bpNo').prop('disabled', true); } else if(employeeDetails.benefit_pension === "no"){ $('#PbAmountDiv').hide(); $('#bpNo').prop('checked', true); $('#bpYes').prop('disabled', true); } else{ $('#bpNo').prop('disabled', true); $('#bpYes').prop('disabled', true); } $('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); if (employeeDetails.benefit_dcrg === "yes") { $('#dcrgAmountDiv').show(); $('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount).prop('readonly',true); // DcrgYes DcrgNo dcrgAmountDiv benefit_dcrg_amount $('#DcrgYes').prop('checked', true); $('#DcrgNo').prop('disabled', true); } else if(employeeDetails.benefit_dcrg === "no"){ $('#dcrgAmountDiv').hide(); $('#DcrgNo').prop('checked', true); $('#DcrgYes').prop('disabled', true); }else { $('#dcrgAmountDiv').hide(); $('#DcrgNo').prop('disabled', true); $('#DcrgYes').prop('disabled', true); } $('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); if (employeeDetails.benefit_commutation === "yes") { $('#CommutationAmountDiv').show(); $('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount).prop('readonly',true); // commutationYes commutationNo CommutationAmountDiv benefit_commutation_amount $('#commutationYes').prop('checked', true); $('#commutationNo').prop('disabled', true); } else if (employeeDetails.benefit_commutation === "no"){ $('#CommutationAmountDiv').hide(); $('#commutationNo').prop('checked', true); $('#commutationYes').prop('disabled', true); }else { $('#CommutationAmountDiv').hide(); $('#commutationNo').prop('disabled', true); $('#commutationYes').prop('disabled', true); } */ //$('#datefile').val(''); $('#remarks').val(''); /* document.getElementById('closedbutton').addEventListener('click', function () { let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value
// Trigger the save function and pass the value saveEntryDetails(tempId,employeeNo); }); */ $('#closedbutton').off('click').on('click', function () { let employeeNo = $('#employeenomodel').val(); // Get the employee number saveEntryDetails(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 const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value console.log("empCode====="+empCode); console.log("tempId====="+tempId); // Hide the receivedcard section before showing the modal $("#receivedcard").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 $('#backbutton').click(function () { $('#returnretrieddetailsModal').modal('hide'); }); $('.close').click(function () { $('#returnretrieddetailsModal').modal('hide'); }); // Listen for changes on the GPF radio buttons document.querySelectorAll('input[name="gpf"]').forEach(radio => { radio.addEventListener('change', function () { const gpfAmountDiv = document.getElementById('gpfAmountDiv'); if (this.value === 'yes' || this.value === '90') { gpfAmountDiv.style.display = 'block'; // Show the input field } else { gpfAmountDiv.style.display = 'none'; // Hide the input field document.getElementById('gpfAmount').value = ''; // Clear the input field } }); }); // Listen for changes on the private affaires radio buttons document.querySelectorAll('input[name="earnedleave"]').forEach(radio => { radio.addEventListener('change', function () { const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv'); if (this.value === 'yes') { earnedleaveAmountDiv.style.display = 'block'; // Show the input field } else { earnedleaveAmountDiv.style.display = 'none'; // Hide the input field document.getElementById('earnedleaveAmount').value = ''; // Clear the input field } }); }); // Listen for changes on the spfgs radio buttons document.querySelectorAll('input[name="spfgs"]').forEach(radio => { radio.addEventListener('change', function () { const spfgsAmountDiv = document.getElementById('spfgsAmountDiv'); if (this.value === 'yes') { spfgsAmountDiv.style.display = 'block'; // Show the input field } else { spfgsAmountDiv.style.display = 'none'; // Hide the input field document.getElementById('spfgsAmount').value = ''; // Clear the input field } }); }); /* 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">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 }
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}`; } function saveEntryDetails(tempId,empNo) { let entryDetails = { empNo:empNo, tempId: tempId, // Pass the stored tempId value dateToAudit: convertDateFormat($('#datefile').val()?.trim()), serviceDeath:$('#deathdate').val(), remarks: $('#remarks').val(), deptId:$('#deptId').text().trim(), filemovedby:$('#userId').text().trim(), }; if (!entryDetails.serviceDeath) { Swal.fire({ icon: 'warning', title: 'Validation Error!', text: 'Employee Death Date is required.', confirmButtonText: 'OK' }); return; } if (!entryDetails.remarks) { Swal.fire({ icon: 'warning', title: 'Validation Error!', text: 'Remarks are required.', confirmButtonText: 'OK' }); return; } console.log("entryDetails:",entryDetails); $('#closedbutton').prop('disabled', true).text('Processing...'); $.ajax({ url: '/gcc/api/fileclosing/updateDetails', type: 'POST', contentType: 'application/json', data: JSON.stringify(entryDetails), success: function (response) { $('#closedbutton').prop('disabled', false).text('Mark as Closed'); Swal.fire({ icon: 'success', title: 'Success', text: response, allowOutsideClick: false, allowEscapeKey: false, allowEnterKey: false, confirmButtonText: 'OK' }).then((result) => { if (result.isConfirmed) { $('#closedbutton').prop('disabled', false).text('Mark as Closed'); window.location.href = "/gcc/departmentfileclosing/fileclosing"; console.log("Continue clicked"); } }); }, error: function (xhr, status, error) { $('#auditsubmit').prop('disabled', false).text('Mark as Closed'); Swal.fire({ icon: 'error', title: 'Error', text: 'Failed to save details. Please try again.', confirmButtonText: 'OK' }); console.error('Error:', xhr.responseText); } }); } //disable future dates document.addEventListener("DOMContentLoaded", function () { let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format let deathdate = document.getElementById("deathdate");
// Set max attribute to disable future dates deathdate.setAttribute("max", today);
// Prevent manual future date entry deathdate.addEventListener("change", function () { if (this.value > today) { Swal.fire({ icon: 'warning', title: 'Invalid Date', text: 'Future dates are not allowed.', confirmButtonText: 'OK' }); this.value = ""; // Clear the invalid input } }); }); </script>
</body></html>
|