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.
 
 

690 lines
29 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;
}
#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 */
}
#completedDetailsModal .modal-body{
max-height:80vh;
overflow-y:auto;
}
.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;
}
#completedDetailsModal label{
padding-top: 3%;
}
</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>Contributory Pension Scheme</h5>
<span>Department 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">Department Entries</li>
<li class="breadcrumb-item" aria-current="page">Completed</li>
<li class="breadcrumb-item active" aria-current="page">Contributory Pension Scheme</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>&nbsp;Department</h5>
<h5 style="font-weight:bold;">Completed - Contributory Pension Scheme</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="completedCPSTable">
<table id="CompletedCPSDatatable" 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 Created 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="cps, iterStat : ${completedCPSList}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${cps['emp_no']}" class="text-center"></td>
<td th:text="${cps['emp_name']}" class="text-center"></td>
<td th:text="${cps['dept_name']}" class="text-center"></td>
<td th:text="${cps['designation']}" class="text-center"></td>
<td th:text="${cps['created_date'] != null ? #dates.format(cps['created_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
<td th:text="${cps['file_entry_type']}" class="text-center"></td>
<td class="text-center">
<button class="btn btn-primary btn-sm view-btn"
th:attr="data-id=${cps['emp_no']}, data-temp-id=${cps['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 for CompletedDetails -->
<!-- Modal Box for CompletedDetails -->
<div class="modal fade" id="completedDetailsModal" tabindex="-1" role="dialog" aria-labelledby="completedDetailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="completedDetailsModalLabel">
Contributory pension Scheme Completed Details - (<span id="completedModalEmployeeCode"></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">
<div class="col-md-6">
<label for="completedEmployeeNo" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label>
<input type="text" id="completedEmployeeNo" class="form-control" readonly>
</div>
<div class="col-md-6">
<label for="completedEmployeeName" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label>
<input type="text" id="completedEmployeeName" class="form-control" readonly>
</div>
<div class="col-md-6">
<label for="completedDepartment" class="form-label fw-bold">Department <span class="text-danger">*</span></label>
<input type="text" id="completedDepartment" class="form-control" readonly>
</div>
<div class="col-md-6">
<label for="completedDesignation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label>
<input type="text" id="completedDesignation" class="form-control" readonly>
</div>
<div class="col-md-6">
<label for="completedClass" class="form-label fw-bold">Class <span class="text-danger">*</span></label>
<input type="text" id="completedClass" class="form-control" readonly>
</div>
<div class="col-sm-6">
<label for="completedretirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label>
<input type="date" id="completedretirementdate" class="form-control" readonly>
</div>
<div class="col-md-6">
<label for="completedType" class="form-label fw-bold">Type of Retirement <span class="text-danger">*</span></label>
<input type="text" id="completedType" class="form-control" readonly>
</div>
<!-- UAC Section -->
<div class="col-md-6">
<label class="form-label fw-bold" for="uac">Whether File Sent UAC Date <span class="text-danger">*</span></label>
<div class="d-flex">
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="uacYes" name="uac" class="form-check-input" value="Yes" >
<label for="uacYes" class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input type="radio" id="uacNo" name="uac" class="form-check-input" value="No" >
<label for="uacNo" class="form-check-label">No</label>
</div>
</div>
<div class="mt-3" id="uacInputDiv" style="display: none;">
<input type="date" id="uacDate" class="form-control" readonly>
</div>
</div>
<div class="col-md-6">
<label for="pendingDuration" class="form-label fw-bold">
Pending Duration
<span class="text-danger">*</span>
</label>
<div class="d-flex align-items-center">
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="pendingDurationYes" name="pendingDuration" value="yes" class="form-check-input">
<label for="pendingDurationYes" class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input type="radio" id="pendingDurationNo" name="pendingDuration" value="no" class="form-check-input">
<label for="pendingDurationNo" class="form-check-label">No</label>
</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>
</div>
<!-- CPS Section -->
<div class="col-md-6">
<label class="form-label fw-bold">Whether CPS Amount Settled</label>
<div class="d-flex">
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="cpsYes" name="cps" class="form-check-input" value="Yes" >
<label for="cpsYes" class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input type="radio" id="cpsNo" name="cps" class="form-check-input" value="No">
<label for="cpsNo" class="form-check-label">No</label>
</div>
</div>
<div class="mt-3" id="cpsInputDiv" style="display: none;">
<input type="text" id="cpsAmount" class="form-control" readonly>
</div>
</div>
<!-- EL/LPA Section -->
<div class="col-md-6">
<label class="form-label fw-bold">Whether EL/LPA Amount Settled <span class="text-danger">*</span></label>
<div class="d-flex">
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="elLpaYes" name="el_or_lpa" class="form-check-input" value="yes" >
<label for="elLpaYes" class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input type="radio" id="elLpaNo" name="el_or_lpa" class="form-check-input" value="no" >
<label for="elLpaNo" class="form-check-label">No</label>
</div>
</div>
<div class="mt-3" id="elLpaInputDiv" style="display: none;">
<input type="text" id="elLpaAmount" class="form-control" readonly>
</div>
</div>
<!-- SPFGS Section -->
<div class="col-md-6">
<label class="form-label fw-bold">Whether SPFGS Amount Settled <span class="text-danger">*</span></label>
<div class="d-flex">
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="spfgsYes" name="spfgs" class="form-check-input" value="yes" >
<label for="spfgsYes" class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input type="radio" id="spfgsNo" name="spfgs" class="form-check-input" value="no" >
<label for="spfgsNo" class="form-check-label">No</label>
</div>
</div>
<div class="mt-3" id="spfgsInputDiv" style="display: none;">
<input type="text" id="spfgsAmount" class="form-control" readonly>
</div>
</div>
<div class="col-md-12">
<label for="completedRemarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label>
<textarea id="completedRemarks" class="form-control" rows="4" placeholder="Enter remarks" readonly></textarea>
</div>
<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>
<div class="row mb-2 mt-2">
<div class="col-md-12 d-flex justify-content-center">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="completedBackButton">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>
const table = $('#CompletedCPSDatatable').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).ready(function () {
// Handle view button click to fetch completed details
$(document).on('click', '.view-btn', function () {
const empCode = $(this).data('id');
const tempId = $(this).data('temp-id');
if (!tempId) {
console.error("tempId is missing!");
return;
}
console.log("empCode:", empCode || "Not Provided");
console.log("tempId:", tempId);
fetchCPSDetails(tempId);
loadFileHistory(tempId);
});
// Initialize modal
$('#completedDetailsModal').modal({
backdrop: 'static',
keyboard: false,
show: false
});
// Handle Close and Back button click
$('.close, #back').click(function () {
$('#completedDetailsModal').modal('hide');
//clearFields();
});
function fetchCPSDetails(tempId) {
$.ajax({
url: '/gcc/api/department/audit/getemployeedetailscps',
type: 'GET',
data: { tempId: tempId },
success: function (response) {
if (response && response.length > 0) {
let cpsDetails = response[0]; // Access the first object in the array
console.log("response:", response);
// Populate modal fields with CPS details
$('#completedModalEmployeeCode').text(cpsDetails.emp_no);
$('#completedEmployeeNo').val(cpsDetails.emp_no);
$('#completedEmployeeName').val(cpsDetails.emp_name);
$('#completedDepartment').val(cpsDetails.dept_name);
$('#completedDesignation').val(cpsDetails.designation);
$('#completedClass').val(cpsDetails.retirement_class);
$('#completedType').val(cpsDetails.type_of_retirement);
$('#completedRemarks').val(cpsDetails.remarks);
$('#completedretirementdate').val(cpsDetails.retirement_date)
// Populate UAC Section
if (cpsDetails.uac === "yes") {
$('#uacYes').prop('checked', true); // Check Yes radio button
$('#uacNo').prop('disabled', true); // Disable No radio button
$('#uacInputDiv').show(); // Show date input field
$('#uacDate').val(cpsDetails.uac_date || '').prop('readonly', true); // Set UAC date and make readonly
} else if (cpsDetails.uac === "no") {
$('#uacNo').prop('checked', true); // Check No radio button
$('#uacYes').prop('disabled', true); // Disable Yes radio button
$('#uacInputDiv').hide(); // Hide date input field
}
// Populate Pending Duration and Reason for Pending pendingDurationYes pendingDurationNo pendingDurationInputContainer pendingDurationInput
if (cpsDetails.pending_duration === "yes") {
$('#pendingDurationYes').prop('checked', true);
$('#pendingDurationNo').prop('disabled', true); // Disable the other option
$('#pendingDurationInputContainer').show(); // Hide reason input
$('#pendingDurationInput').val(cpsDetails.reason_for_pending || '').prop('readonly', true);
} else if (cpsDetails.pending_duration === "no") {
$('#pendingDurationYes').prop('disabled', true);
$('#pendingDurationNo').prop('checked', true);
$('#pendingDurationInputContainer').hide(); // Show reason input field
}
// Populate CPS Section based on response or data
if (cpsDetails.cps === "yes") {
$('#cpsYes').prop('checked', true); // Check Yes radio button
$('#cpsNo').prop('disabled', true); // Disable No radio button
$('#cpsInputDiv').show(); // Show CPS amount input field
$('#cpsAmount').val(cpsDetails.cps_amount || '').prop('readonly', true); // Set CPS amount and make readonly
} else if (cpsDetails.cps === "no") {
$('#cpsNo').prop('checked', true); // Check No radio button
$('#cpsYes').prop('disabled', true); // Disable Yes radio button
$('#cpsInputDiv').hide(); // Hide CPS amount input field
}
// Populate EL or LPA Section based on response or data
if (cpsDetails.el_or_lpa === "yes") {
$('#elLpaYes').prop('checked', true); // Check Yes radio button
$('#elLpaNo').prop('disabled', true); // Disable No radio button
$('#elLpaInputDiv').show(); // Show input field for EL or LPA Amount
$('#elLpaAmount').val(cpsDetails.el_or_lpa_amount || '').prop('readonly', true); // Set the amount and make readonly
} else if (cpsDetails.el_or_lpa === "no") {
$('#elLpaNo').prop('checked', true); // Check No radio button
$('#elLpaYes').prop('disabled', true); // Disable Yes radio button
$('#elLpaInputDiv').hide(); // Hide input field for EL or LPA Amount
}
// Populate SPFGS Section based on response or data
if (cpsDetails.spfgs === "yes") {
$('#spfgsYes').prop('checked', true); // Check Yes radio button
$('#spfgsNo').prop('disabled', true); // Disable No radio button
$('#spfgsInputDiv').show(); // Show SPFGS amount input field
$('#spfgsAmount').val(cpsDetails.spfgs_amount || '').prop('readonly', true); // Set SPFGS amount and make readonly
} else if (cpsDetails.spfgs === "no") {
$('#spfgsNo').prop('checked', true); // Check No radio button
$('#spfgsYes').prop('disabled', true); // Disable Yes radio button
$('#spfgsInputDiv').hide(); // Hide SPFGS amount input field
}
// Handle SPFGS changes
$('#spfgsYes').change(function () {
if ($(this).is(':checked')) {
$('#spfgsNo').prop('disabled', true); // Disable No radio button
$('#spfgsInputDiv').show(); // Show SPFGS amount input field
}
});
$('#spfgsNo').change(function () {
if ($(this).is(':checked')) {
$('#spfgsYes').prop('disabled', true); // Disable Yes radio button
$('#spfgsInputDiv').hide(); // Hide SPFGS amount input field
}
});
// Show the modal after fetching details
$('#completedDetailsModal').modal('show');
} else {
Swal.fire({
icon: 'info',
title: 'No Data',
text: 'No details found for the selected CPS record.',
confirmButtonText: 'OK',
});
}
},
error: function () {
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to fetch CPS details. Please try again.',
confirmButtonText: 'OK',
});
},
});
}
});
$('#completedBackButton').on('click', function () {
$('#completedDetailsModal').modal('hide'); // Replace 'yourModalId' with the actual modal ID
});
///history function to show in modal
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
}
</script>
</body>
</html>