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.
 
 

701 lines
28 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 */
}
#receivedprovisionalModal .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;
}
</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>Provisional Retirement</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">Provisional Retirement</li>
</ol>
</nav>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
<div class="card">
<div class="card-block">
<span th:text="${filecategory}" id="filecategory" style="display:none"></span>
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;Department</h5>
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Provisional Retirement</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;">
<!-- Thymeleaf loop to populate data -->
<tr th:each="provisional, iterStat : ${provisionallist}">
<td th:text="${iterStat.index + 1}" class="text-center"></td>
<td th:text="${provisional['emp_no']}" class="text-center"></td>
<td th:text="${provisional['emp_name']}" class="text-center"></td>
<td th:text="${provisional['dept_name']}" class="text-center"></td>
<td th:text="${provisional['designation']}" class="text-center"></td>
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td>
<td th:text="${provisional['file_entry_type']}" class="text-center"></td>
<td class="text-center">
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['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="receivedprovisionalModal" 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 - Provisional Retirement (<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-6">
<label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label>
<input type="number" id="employeenomodel" class="form-control" readonly>
</div>
<!-- Employee Name -->
<div class="col-md-6">
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label>
<input type="text" id="employeename" class="form-control" readonly>
</div>
<!-- Department -->
<div class="col-md-6">
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label>
<input type="text" id="department" class="form-control" readonly>
</div>
<!-- Designation -->
<div class="col-md-6">
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label>
<input type="text" id="designation" class="form-control" readonly>
</div>
<!-- Class -->
<div class="col-md-6">
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label>
<input type="text" id="classes" class="form-control" readonly>
</div>
<!-- Type Of Retirement -->
<div class="col-md-6">
<label for="typeofretirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label>
<input type="text" id="typeofretirement" class="form-control" readonly>
</div>
<div class="col-md-6">
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label>
<input type="date" id="retirementdate" class="form-control" readonly>
</div>
<!-- Reason For Provisional Pension is given -->
<!-- provisionalreason
otherReason -->
<div class="col-md-6">
<label for="provisionalreason" class="form-label fw-bold">Reason For Provisional Pension is given <span class="text-danger">*</span></label>
<input type="text" id="provisionalreason" class="form-control" readonly>
<div id="otherReasonDiv" style="display: none; margin-top: 10px;">
<label for="otherReason" class="form-label">Please specify:</label>
<input type="text" id="otherReason" class="form-control" placeholder="Enter reason" readonly>
</div>
</div>
<!-- Date File Sent to Pension Section -->
<div class="col-md-6">
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension Section <span class="text-danger">*</span></label>
<input type="date" id="datefile_modal" class="form-control" readonly onclick="this.showPicker()">
</div>
<!-- Pending Duration -->
<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="yespen" name="pendingDuration" value="Yes" class="form-check-input" disabled>
<label for="yespen" class="form-check-label">yes</label>
</div>
<div class="form-check">
<input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" disabled>
<label for="nopen" class="form-check-label">no</label>
</div>
</div>
<div id="clickyesdiv" style="display: none; margin-top: 10px;">
<label for="clickyes" class="form-label">Please specify:</label>
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason">
</div>
</div>
<!-- dp -->
<div class="col-md-6">
<label for="DP" class="form-label fw-bold">DP<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="yes" name="DP" value="yes" class="form-check-input" disabled>
<label for="yes" class="form-check-label">yes</label>
</div>
<br>
<div class="form-check" >
<input type="radio" id="no" name="DP" value="no" class="form-check-input" disabled>
<label for="no" class="form-check-label" >no</label>
</div>
</div>
</div>
<!-- Retirement Amount -->
<div class="col-md-6">
<label for="RetirementAmount" class="form-label fw-bold">
Provisional Retirement Amount <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="fifty" name="RetirementAmount" value="50" class="form-check-input" disabled>
<label for="fifty" class="form-check-label">50%</label>
</div>
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="seventyfive" name="RetiremesntAmount" value="75" class="form-check-input" disabled>
<label for="seventyfive" class="form-check-label">75%</label>
</div>
<div class="form-check" style="padding-right:10px;">
<input type="radio" id="hundred" name="RetirementAmount" value="100" class="form-check-input" disabled>
<label for="hundred" class="form-check-label">100%</label>
</div>
</div>
<!-- Additional Input Field -->
<div class="mt-3" id="additionalInputDiv" style="display: none;">
<input type="number" id="additionalInput" class="form-control" placeholder="Enter Amount" readonly>
</div>
</div>
<!-- Remarks -->
<div class="col-md-12">
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label>
<textarea id="remarks_modal" class="form-control" rows="2" placeholder="Enter your remarks here" readonly></textarea>
</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>
<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-dismiss="modal" id="back">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>
// Initialize DataTable
const table = $('#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,
select: false,
processing: false
});
$(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();
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
$('#receivedprovisionalModal').modal({
backdrop: 'static',
keyboard: false,
show: false // Ensure it doesn't auto-show on page load
});
// Handle Close button click
$('.close').click(function () {
$('#receivedprovisionalModal').modal('hide'); // Hide the modal
clearFields(); // Clear input fields
});
// Handle Back button click
$('#back').click(function () {
$('#receivedprovisionalModal').modal('hide'); // Hide the modal
clearFields(); // Clear input fields
});
// Function to clear input fields
/* function clearFields() {
$('#datefile').val(''); // Clear date input
$('#remarks').val(''); // Clear textarea
} */
});
//model function
function fetchEmployeeDetails(tempId) {
$.ajax({
url: '/gcc/api/department/audit/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);
// 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);
$('#retirementdate').val(employeeDetails.retirement_date);
$('#classes').val(employeeDetails.retirement_class);
$('#datefile_modal').val(employeeDetails.file_moved_date);
$('#remarks_modal').val(employeeDetails.remarks);
$('#provisionalreason').val(employeeDetails.reason_for_provisional_pension);
// Ensure employeeDetails exists
if (employeeDetails) {
let prPercentage = employeeDetails.pr_percentage;
let prAmount = employeeDetails.pr_amount || '';
// Convert pr_percentage to string to avoid type mismatches
prPercentage = prPercentage ? prPercentage.toString() : '';
// Reset any previously selected radio buttons (in case of multiple calls)
$('#fifty').prop('checked', false).prop('disabled', false);
$('#seventyfive').prop('checked', false).prop('disabled', false);
$('#hundred').prop('checked', false).prop('disabled', false);
// Hide the additional input field initially
$('#additionalInputDiv').hide();
// Check if pr_percentage is a valid percentage
if (prPercentage === "50") {
// Select 50% radio button and disable all
$('#fifty').prop('checked', true).prop('disabled', true);
$('#seventyfive').prop('disabled', true);
$('#hundred').prop('disabled', true);
$('#additionalInputDiv').show();
$('#additionalInput').val(prAmount).prop('readonly', true);
} else if (prPercentage === "75" || prPercentage === "75.00") {
// Select 75% radio button and disable all
$('#seventyfive').prop('checked', true).prop('disabled', true);
$('#fifty').prop('disabled', true);
$('#hundred').prop('disabled', true);
// If pr_amount exists, set it in the additional input
$('#additionalInputDiv').show();
$('#additionalInput').val(prAmount).prop('readonly', true);
} else if (prPercentage === "100") {
// Select 100% radio button and disable all
$('#hundred').prop('checked', true).prop('disabled', true);
$('#fifty').prop('disabled', true);
$('#seventyfive').prop('disabled', true);
$('#additionalInputDiv').show();
$('#additionalInput').val(prAmount).prop('readonly', true);
} else {
// If pr_percentage is NOT 50, 75, or 100, show the additional input field
$('#additionalInputDiv').show();
$('#additionalInput').val(prAmount).prop('readonly', true);
}
}
// Populate Pending Duration and Reason fields
if (employeeDetails.pending_duration === "Yes") {
$('#yespen').prop('checked', true); // Check the Yes radio button
$('#clickyesdiv').show(); // Show the reason input
$('#Clickyes').val(employeeDetails.reason_for_pending || '').prop('readonly' ,true); // Set reason and make readonly
} else if (employeeDetails.pending_duration === "No") {
$('#nopen').prop('checked', true); // Check the No radio button
$('#clickyesdiv').hide(); // Hide the reason input
}
//populate reason for provisional pension
if (employeeDetails.reason_for_provisional_pension === "Others") {
$('#otherReasonDiv').show(); // Show the input field for 'Others'
$('#otherReason')
.val(employeeDetails.others_provisional_pension || '')
.prop('readonly' ,true); // Populate and make readonly
} else {
$('#otherReasonDiv').hide(); // Hide the input field if reason is not 'Others'
}
// Handle DP value
if (employeeDetails.dp === "yes") {
$('#yes').prop('checked', true); // Select 'yes' radio button
} else if (employeeDetails.dp === "no") {
$('#no').prop('checked', true); // Select 'no' radio button
}
// Update the modal title with the employee code
$('#modalEmployeeCode').text(employeeDetails.emp_no);
// Show the modal
$('#receivedprovisionalModal').modal('show');
} 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',
});
},
});
}
///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>