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.
 
 

1750 lines
72 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 */
.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 */
}
#returnretrieddetailsModal .modal-body{
max-height:80vh;
overflow-y:auto;
}
#returnretrieddreportetailsModals .modal-body{
max-height:80vh;
overflow-y:auto;
}
/* Ensure consistent table borders */
.table {
border-collapse: collapse !important;
}
.table thead th {
background-color: #343a40; /* Dark header background */
color: #ffffff; /* White text */
text-align: center;
}
.table-bordered td, .table-bordered th {
border: 1px solid #dee2e6 !important; /* Ensure borders are visible */
}
/* Ensure proper column width */
#SecondFollowupDatatables, #FollowupDatatable, #reportFollowupDatatables {
table-layout: fixed;
width: 100%;
}
#SecondFollowupDatatables th,
#FollowupDatatable th,
#reportFollowupDatatables th {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Add padding for better readability */
td, th {
padding: 10px;
text-align: center;
}
</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>Report</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">Reports</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;">Pensioner Report</h5>
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span>&nbsp;</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> </h5>
<div class="row mb-4">
<div class="col-md-3">
<label for="startdate" class="form-label fw-bold">Start Date<span class="text-danger">*</span></label>
<input type="date" id="startdate" class="form-control" onclick="this.showPicker()" >
</div>
<div class="col-md-3">
<label for="enddate" class="form-label fw-bold">End Date<span class="text-danger">*</span></label>
<input type="date" id="enddate" class="form-control" onclick="this.showPicker()" >
</div>
<div class="col-md-3">
<label for="typeofreport" class="form-label fw-bold">Type of Report<span class="text-danger">*</span></label>
<select id="typeofreport" class="form-control" style="width: 100%;" required>
<option value="" selected>-- Select Option --</option>
<option value="Abstract">Abstract</option>
<option value="Detailed">Detailed</option>
</select>
</div>
<div class="col-md-3" id="categoryDiv1" style="display: none;">
<label for="typeofcategory1" class="form-label fw-bold">Type of Category<span class="text-danger">*</span></label>
<select id="typeofcategory1" class="form-control" style="width: 100%;">
<option value="" selected>-- Select Category --</option>
</select>
</div>
<div class="col-md-3" id="deptDiv" style="display: none;">
<label for="departmentDropdown" class="form-label fw-bold">Department <span class="text-danger">*</span></label>
<!-- Styled Checkbox Container -->
<div class="form-control p-3 border rounded" style="height: 110px; overflow-y: auto; background-color: #f8f9fa;">
<!-- Select All Checkbox -->
<label class="d-block">Select Department
<!-- <input type="checkbox" id="selectAllDept" value="ALL"> <strong>Select All</strong> -->
</label>
<hr> <!-- Separator for better spacing -->
<!-- Departments List (Will be populated dynamically) -->
<div id="departmentCheckboxContainer">
<!-- Dynamic Checkboxes will be inserted here -->
</div>
</div>
</div>
<!-- Type of Category (Initially Hidden) -->
<div class="col-md-3" id="categoryDiv" style="display: none;">
<label for="typeofcategory" class="form-label fw-bold">Type of File Category<span class="text-danger">*</span></label>
<select id="typeofcategory" class="form-control" style="width: 100%;">
<option value="" selected>-- Select Category --</option>
</select>
</div>
<div class="col-md-3" id="statusDiv" style="display: none;">
<label for="statusDropdown" class="form-label fw-bold">File Status</label>
<select id="statusDropdown" class="form-control" style="width: 100%;">
<option value="" selected>-- Select Status --</option>
<option value="[1,3]">Audit Pending</option>
<option value="[2,5,6,9]">Department Pending</option>
<option value="[4,7,8,10]">Pension Pending</option>
<option value="[11]">File Completed</option>
<option value="[12]">File Closed</option>
</select>
</div>
<div class="col-md-4 mt-20">
<button id="searchButton" class="btn btn-primary mt-2 mx-2">Search</button>
<button id="resetButton" class="btn btn-secondary mt-2">Reset</button>
</div>
</div>
<div class="page-header-title"></div>
<div style= display:none id="audittable">
<!-- <div style="visibility: hidden; height: 0; overflow: hidden;" id="audittable"> -->
<table id="FileCategoryTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<th class="text-center">S.No</th>
<th class="text-center">Department</th>
<th class="text-center">Audit Pending</th>
<th class="text-center">Department Pending</th>
<th class="text-center">Pension Pending</th>
<th class="text-center">Completed</th>
<th class="text-center">Total count</th>
</tr>
</thead>
<tbody id="fileCategoryTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</tbody>
</table>
</div>
<div style= display:none id="cpstable">
<table id="FileDetailsTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<th class="text-center">S.No</th>
<th class="text-center">Employee Code</th>
<th class="text-center">Name</th>
<th class="text-center">Designation</th>
<th class="text-center">Type of Retirement</th>
<th class="text-center">Pending Duration</th>
<th class="text-center">File Status</th>
<th class="text-center">File category</th>
<th class="text-center">File Moved Date</th>
<th class="text-center">Remarks</th>
</tr>
</thead>
<tbody id="fileDetailsTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</tbody>
</table>
</div>
<!-- retirement datatable -->
<div style= display:none id="retiretable">
<table id="FileRetirementTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<th class="text-center">S.No</th>
<th class="text-center">Employee Code</th>
<th class="text-center">Name</th>
<th class="text-center">Designation</th>
<th class="text-center">Department</th>
<th class="text-center">Type of Retirement</th>
<th class="text-center">Date of Retirement</th>
<th class="text-center">File Status</th>
<th class="text-center">File Category</th>
<th class="text-center">File Moved Date</th>
<th class="text-center">Comments/Remarks</th>
</tr>
</thead>
<tbody id="fileRetireTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</tbody>
</table>
</div>
<!-- Family pension datatable -->
<div style= display:none id="familypensiontable">
<table id="FileFamilyPensionTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<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">Service Death Date</th>
<th class="text-center">Relationship Type</th>
<th class="text-center">Pending Duration</th>
<th class="text-center">File Status</th>
<th class="text-center">File Category</th>
<th class="text-center">File Moved Date</th>
<th class="text-center">Comments/Remarks</th>
</tr>
</thead>
<tbody id="fileFamilyTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</tbody>
</table>
</div>
<!-- Pendency datatable -->
<div style= display:none id="pendencytable">
<table id="FilePendencyTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<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">Type of Retirement</th>
<th class="text-center">Date of Retirement</th>
<th class="text-center">Pending Duration</th>
<th class="text-center">File Status</th>
<th class="text-center">File Category</th>
<th class="text-center">File Moved Date</th>
<th class="text-center">Comments/Remarks</th>
</tr>
</thead>
<tbody id="filePendencyTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</tbody>
</table>
</div>
<!-- Gis datatable -->
<div style= display:none id="gistable">
<table id="FileGisTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<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">Service Death Date</th>
<th class="text-center">Sanctioned Amount</th>
<th class="text-center">File Status</th>
<th class="text-center">File category</th>
<th class="text-center">File Moved Date</th>
<th class="text-center">Comments/Remarks</th>
</tr>
</thead>
<tbody id="fileGisTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</tbody>
</table>
</div>
<!-- provisonal datatable -->
<div style= display:none id="provisionaltable">
<table id="FileProvisionalTable" class="table table-striped table-bordered dataTable">
<thead class="thead-dark">
<tr>
<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">Type of Retirement</th>
<th class="text-center">Date of Retirement</th>
<th class="text-center">File Status</th>
<th class="text-center">File category</th>
<th class="text-center">File Moved Date</th>
<th class="text-center">Comments/Remarks</th>
</tr>
</thead>
<tbody id="fileProvisionalTableBody" style="text-align:center;">
<!-- Data will be inserted dynamically -->
</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>
<!-- Modal Box -->
<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 () {
function loadFileCategories() {
$.ajax({
url: "/getFileCategories", // Ensure this is the correct endpoint
type: "GET",
dataType: "json",
success: function (response) {
console.log("File Categories Loaded:", response); // Debugging
if (response.length === 0) {
console.warn("No categories found!");
return;
}
let $categoryDropdown = $("#typeofcategory");
$categoryDropdown.empty().append('<option value="">-- Select Category --</option>');
response.forEach(category => {
$categoryDropdown.append(`<option value="${category.id}">${category.file_name}</option>`);
});
let $categoryDropdown1 = $("#typeofcategory1");
$categoryDropdown1.empty().append('<option value="">-- Select Category --</option>');
response.forEach(category => {
$categoryDropdown1.append(`<option value="${category.id}">${category.file_name}</option>`);
});
},
error: function (xhr, status, error) {
console.error("Error fetching categories:", xhr.responseText);
Swal.fire({
icon: "error",
title: "Error Fetching Data",
text: "Failed to load categories. Please try again later.",
});
}
});
}
// Call function to load categories when the page is ready
loadFileCategories();
});
$(document).ready(function () {
function loadDepartments() {
$.ajax({
url: "/getdepartment",
type: "GET",
dataType: "json",
success: function (response) {
console.log("Departments:", response);
$("#departmentCheckboxContainer").empty(); // Clear previous checkboxes
// Append "Select All" checkbox
$("#departmentCheckboxContainer").append(`
<label>
<input type="checkbox" id="selectAllDept" value="ALL"> Select All
</label><br>
`);
// Append individual department checkboxes
response.forEach(dept => {
$("#departmentCheckboxContainer").append(`
<label>
<input type="checkbox" class="deptCheckbox" value="${dept.id}"> ${dept.dept_name}
</label><br>
`);
});
// Handle "Select All" logic
$("#selectAllDept").change(function () {
if (this.checked) {
$(".deptCheckbox").prop("checked", false).prop("disabled", true);
} else {
$(".deptCheckbox").prop("disabled", false);
}
});
},
error: function (xhr) {
console.error("AJAX Error:", xhr.status, xhr.responseText);
Swal.fire({
icon: "error",
title: "Error Fetching Data",
text: "Failed to load departments. Please try again.",
});
}
});
}
loadDepartments();
});
/* $(document).ready(function () {
loadFileStatus(); // Load status on page load
function loadFileStatus() {
$.ajax({
url: "/getstatus", // ✅ API endpoint to fetch status data
type: "GET",
dataType: "json",
success: function (response) {
let statusDropdown = $("#statusDropdown");
statusDropdown.empty().append('<option value="">Select Status</option>');
$.each(response, function (index, status) {
statusDropdown.append('<option value="' + status.id + '">' + status.file_status + '</option>');
});
},
error: function () {
console.error("Error fetching status data");
Swal.fire({
icon: "error",
title: "Error",
text: "Failed to load status options. Please try again.",
confirmButtonText: "OK"
});
}
});
}
}); */
$('#resetButton').on('click', function () {
window.location.href = "/gcc/pensioner/reports";
});
$(document).ready(function () {
// Initialize DataTables
// count datatable
let fileCategoryTable = $("#FileCategoryTable").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',
fixedColumns: { left: 1, right: 1 },
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',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
doc.content[1].table.widths = Array(doc.content[1].table.body[0].length + 1).join('*').split('');
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Department", data: "dept_name", className: "text-center" },
{ title: "Audit Pending", data: "audit_pending", className: "text-center" },
{ title: "Department Pending", data: "department_pending", className: "text-center" },
{ title: "Pension Pending", data: "pension_pending", className: "text-center" },
{ title: "Completed", data: "completed", className: "text-center" },
{ title: "Total Count", data: "total_count", className: "text-center" }
]
});
//cps datatable
let fileDetailsTable = $("#FileDetailsTable").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',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
// Set Table Header Style
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
// Align table body text to center
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
// Adjust Column Widths (Set Last Column "Remarks" to wider space)
let colCount = doc.content[1].table.body[0].length;
let colWidths = Array(colCount - 1).fill("auto");
colWidths.push("30%"); // Last column (Remarks) should take 30% width
doc.content[1].table.widths = colWidths;
// Ensure long text wraps properly
doc.content[1].table.body.forEach(function(row) {
row.forEach(function(cell) {
cell.alignment = 'center'; // Center align all cells
cell.noWrap = false; // Allow text wrapping
});
});
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Employee Code", data: "emp_no", className: "text-center" },
{ title: "Name", data: "emp_name", className: "text-center" },
{ title: "Designation", data: "designation", className: "text-center" },
{ title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
{ title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
{ title: "File Status", data: "fst", className: "text-center" },
{ title: "File Category", data: "file_category_name", className: "text-center" },
{
title: "File Moved Date",
data: "created_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Comments/Remarks", data: "remarks", className: "text-center" },
]
});
// retirement datatable
let fileRetireTable = $("#FileRetirementTable").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',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
// Set Table Header Style
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
// Align table body text to center
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
// Adjust Column Widths (Set Last Column "Remarks" to wider space)
let colCount = doc.content[1].table.body[0].length;
let colWidths = Array(colCount - 1).fill("auto");
colWidths.push("30%"); // Last column (Remarks) should take 30% width
doc.content[1].table.widths = colWidths;
// Ensure long text wraps properly
doc.content[1].table.body.forEach(function(row) {
row.forEach(function(cell) {
cell.alignment = 'center'; // Center align all cells
cell.noWrap = false; // Allow text wrapping
});
});
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Employee Code", data: "emp_no", className: "text-center" },
{ title: "Name", data: "emp_name", className: "text-center" },
{ title: "Department", data: "dept_name", className: "text-center" },
{ title: "Designation", data: "designation", className: "text-center" },
{ title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
{
title: "Date of Retirement",
data: "retirement_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "File Status", data: "fst", className: "text-center" },
{ title: "File Category", data: "file_category_name", className: "text-center" },
{
title: "File Moved Date",
data: "file_moved_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Comments/Remarks", data: "remarks", className: "text-center" },
]
});
// family pension datatable
let fileFamilyPensionTable = $("#FileFamilyPensionTable").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',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
// Set Table Header Style
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
// Align table body text to center
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
// Adjust Column Widths (Set Last Column "Remarks" to wider space)
let colCount = doc.content[1].table.body[0].length;
let colWidths = Array(colCount - 1).fill("auto");
colWidths.push("30%"); // Last column (Remarks) should take 30% width
doc.content[1].table.widths = colWidths;
// Ensure long text wraps properly
doc.content[1].table.body.forEach(function(row) {
row.forEach(function(cell) {
cell.alignment = 'center'; // Center align all cells
cell.noWrap = false; // Allow text wrapping
});
});
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Employee Code", data: "emp_no", className: "text-center" },
{ title: "Name", data: "emp_name", className: "text-center" },
{ title: "Department", data: "dept_name", className: "text-center" },
{ title: "Designation", data: "designation", className: "text-center" },
{
title: "Service Death Date",
data: "service_death",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Relationship Type", data: "relationship_deceased", className: "text-center" },
{ title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
{ title: "File Status", data: "fst", className: "text-center" },
{ title: "File Category", data: "file_category_name", className: "text-center" },
{
title: "File Moved Date",
data: "file_moved_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Comments/Remarks", data: "remarks", className: "text-center" },
]
});
// pendency datatable
let filePendencyTable = $("#FilePendencyTable").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',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
// Set Table Header Style
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
// Align table body text to center
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
// Adjust Column Widths (Set Last Column "Remarks" to wider space)
let colCount = doc.content[1].table.body[0].length;
let colWidths = Array(colCount - 1).fill("auto");
colWidths.push("30%"); // Last column (Remarks) should take 30% width
doc.content[1].table.widths = colWidths;
// Ensure long text wraps properly
doc.content[1].table.body.forEach(function(row) {
row.forEach(function(cell) {
cell.alignment = 'center'; // Center align all cells
cell.noWrap = false; // Allow text wrapping
});
});
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Employee Code", data: "emp_no", className: "text-center" },
{ title: "Name", data: "emp_name", className: "text-center" },
{ title: "Department", data: "dept_name", className: "text-center" },
{ title: "Designation", data: "designation", className: "text-center" },
{ title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
{
title: "Date of Retirement",
data: "retirement_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Pending Duration", data: "reason_for_pending", className: "text-center" },
{ title: "File Status", data: "fst", className: "text-center" },
{ title: "File Category", data: "file_category_name", className: "text-center" },
{
title: "File Moved Date",
data: "file_moved_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Comments/Remarks", data: "remarks", className: "text-center" },
]
});
// Gis datatable
let fileGisTable = $("#FileGisTable").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',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
// Set Table Header Style
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
// Align table body text to center
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
// Adjust Column Widths (Set Last Column "Remarks" to wider space)
let colCount = doc.content[1].table.body[0].length;
let colWidths = Array(colCount - 1).fill("auto");
colWidths.push("30%"); // Last column (Remarks) should take 30% width
doc.content[1].table.widths = colWidths;
// Ensure long text wraps properly
doc.content[1].table.body.forEach(function(row) {
row.forEach(function(cell) {
cell.alignment = 'center'; // Center align all cells
cell.noWrap = false; // Allow text wrapping
});
});
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Employee Code", data: "emp_no", className: "text-center" },
{ title: "Name", data: "emp_name", className: "text-center" },
{ title: "Department", data: "dept_name", className: "text-center" },
{ title: "Designation", data: "designation", className: "text-center" },
{
title: "Service Death Date",
data: "service_death",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Sanctioned Amount", data: "sanctional_gis_amount", className: "text-center" },
{ title: "File Status", data: "fst", className: "text-center" },
{ title: "File Category", data: "file_category_name", className: "text-center" },
{
title: "File Moved Date",
data: "file_moved_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Comments/Remarks", data: "remarks", className: "text-center" },
]
});
// provisional datatable
let fileProvisionalTable = $("#FileProvisionalTable").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',
fixedColumns: { left: 1, right: 1 },
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning ' }, // GIS-style
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary ' }, // GIS-style
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, // GIS-style
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, // GIS-style
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
orientation: 'landscape', // Landscape Mode
pageSize: 'A4', // Set to A4 size
customize: function(doc) {
// Set Table Header Style
doc.styles.tableHeader = {
bold: true,
fontSize: 10,
color: 'black',
fillColor: '#f5f5f5',
alignment: 'center'
};
// Align table body text to center
doc.styles.tableBodyEven = { alignment: 'center' };
doc.styles.tableBodyOdd = { alignment: 'center' };
// Adjust Column Widths (Set Last Column "Remarks" to wider space)
let colCount = doc.content[1].table.body[0].length;
let colWidths = Array(colCount - 1).fill("auto");
colWidths.push("30%"); // Last column (Remarks) should take 30% width
doc.content[1].table.widths = colWidths;
// Ensure long text wraps properly
doc.content[1].table.body.forEach(function(row) {
row.forEach(function(cell) {
cell.alignment = 'center'; // Center align all cells
cell.noWrap = false; // Allow text wrapping
});
});
}
}
],
fixedHeader: false,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false,
data: [],
columns: [
{ title: "S.No", data: "index", className: "text-center" },
{ title: "Employee Code", data: "emp_no", className: "text-center" },
{ title: "Name", data: "emp_name", className: "text-center" },
{ title: "Department", data: "dept_name", className: "text-center" },
{ title: "Designation", data: "designation", className: "text-center" },
{ title: "Type of Retirement", data: "type_of_retirement", className: "text-center" },
{
title: "Date of Retirement",
data: "retirement_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "File Category", data: "file_category_name", className: "text-center" },
{ title: "File Status", data: "fst", className: "text-center" },
{
title: "File Moved Date",
data: "file_moved_date",
className: "text-center",
render: function(data, type, row) {
if (data) {
let date = new Date(data);
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
return `${day}-${month}-${year}`;
}
return "";
}
},
{ title: "Comments/Remarks", data: "remarks", className: "text-center" },
]
});
// Listen for changes in the Type of Report dropdown
/* $("#typeofreport").change(function () {
let selectedValue = $(this).val();
if (selectedValue === "Detailed") {
$("#categoryDiv").show();
} else {
$("#categoryDiv").hide();
$("#typeofcategory").val("");
$("#statusDiv").show();// Reset category value
}
}); */
$(document).ready(function () {
$("#typeofreport").change(function () {
let selectedValue = $(this).val();
if (selectedValue === "Detailed") {
$("#categoryDiv").show(); // Show File Category dropdown
$("#deptDiv").show();
$("#categoryDiv1").hide();
$("#typeofcategory1").val(""); // Reset selection
} else if(selectedValue === "Abstract") {
$("#categoryDiv1").show();
$("#categoryDiv").hide(); // Show File Category dropdown
$("#deptDiv").hide();
$("#statusDiv").hide();
$("#statusDropdown").val("");
$("#departmentDropdown").val("");
$("#typeofcategory").val("");
}
else{
$("#categoryDiv").hide(); // Hide File Category dropdown
$("#statusDiv").hide(); // ✅ Hide Status dropdown
$("#deptDiv").hide();
$("#categoryDiv1").hide();
$("#statusDropdown").val("");
$("#departmentDropdown").val("");
$("#typeofcategory").val("");
$("#typeofcategory1").val("");
}
});
$("#typeofcategory").change(function () {
let selectedCatValue = $(this).val();
let statusDropdown = $("#statusDropdown");
if(selectedCatValue==""){
$("#statusDiv").hide();
$("#statusDropdown").val("");
}
else{
$("#statusDiv").show();
}
// Backup of all options (only once)
if (!statusDropdown.data("original-options")) {
statusDropdown.data("original-options", statusDropdown.html());
}
if (selectedCatValue === "1") {
// Restore all options
statusDropdown.html(statusDropdown.data("original-options"));
} else {
// Remove the last two options ("File Completed" and "File Closed")
statusDropdown.html(statusDropdown.data("original-options"));
statusDropdown.find("option[value='[12]']").remove();
}
});
});
$('#startdate').on('change', function () {
const fromDate = $(this).val();
$('#enddate').attr('min', fromDate); // Update min attribute for To Date
// If To Date is earlier than the new From Date, adjust it
const toDate = $('#enddate').val();
if (new Date(toDate) < new Date(fromDate)) {
$('#enddate').val(fromDate);
}
});
// Update From Date's max attribute when To Date changes
$('#enddate').on('change', function () {
const toDate = $(this).val();
$('#startdate').attr('max', toDate); // Update max attribute for From Date
// If From Date is later than the new To Date, adjust it
const fromDate = $('#startdate').val();
if (new Date(fromDate) > new Date(toDate)) {
$('#startdate').val(toDate);
}
});
$('#statusDropdown').on('change', function () {
let selectedValue = $(this).val();
let statusArray = selectedValue ? JSON.parse(selectedValue) : []; // Convert string to array
console.log(statusArray); // Output: [1,3] or [2,5,6,9] etc.
});
$("#searchButton").click(function () {
let startDate = $("#startdate").val();
let endDate = $("#enddate").val();
let typeOfReport = $("#typeofreport").val();
let typeOfCategory1 = $("#typeofcategory1").val();
let typeOfCategory = $("#typeofcategory").val();
let selectedStatus = $("#statusDropdown").val();
let statusArray = selectedStatus ? JSON.parse(selectedStatus) : [];
console.log("startDate", startDate);
console.log("endDate", endDate);
console.log("typeOfReport", typeOfReport);
console.log("typeOfCategory1", typeOfCategory1);
console.log("typeOfCategory", typeOfCategory);
let selectedDeptIds = [];
if ($("#selectAllDept").is(":checked")) {
selectedDeptIds = ["ALL"]; // ✅ Set "ALL" when selected
} else {
$(".deptCheckbox:checked").each(function () {
selectedDeptIds.push($(this).val());
});
}
console.log("Selected Department IDs:", selectedDeptIds);
console.log("statusArray", statusArray);
if (!startDate || !endDate) {
Swal.fire({
icon: "warning",
title: "Validation Error",
text: "Please select Both Date before searching.",
confirmButtonText: "OK"
});
return;
}
if (!typeOfReport) {
Swal.fire({
icon: "warning",
title: "Validation Error",
text: "Please select a Type of Report before searching.",
confirmButtonText: "OK"
});
return;
}
if (typeOfReport === "Abstract" && typeOfCategory1 === "") {
Swal.fire({
icon: "warning",
title: "Validation Error",
text: "Please select a Category for Abstract report.",
confirmButtonText: "OK"
});
return;
}
if (typeOfReport === "Detailed" && typeOfCategory === "") {
Swal.fire({
icon: "warning",
title: "Validation Error",
text: "Please select a Category for Detailed report.",
confirmButtonText: "OK"
});
return;
}
if (typeOfReport === "Detailed" && selectedDeptIds.length === 0) {
Swal.fire({
icon: "warning",
title: "Validation Error",
text: "Please select a Department for Detailed report.",
confirmButtonText: "OK"
});
return;
}
let url, data;
if (typeOfReport === "Detailed") {
url = "/getReportDetailspension";
data = { startDate: startDate, endDate: endDate, deptIds: selectedDeptIds, fileCatId: typeOfCategory, fileStatus: statusArray };
$("#audittable").hide();
} else {
url = "/getReportDatapension";
data = { startDate: startDate, endDate: endDate, fileCategoryId: typeOfCategory1 };
$("#audittable").show();
$("#cpstable").hide();
$("#retiretable").hide();
// $(".audittable").hide();
$("#familypensiontable").hide();
$("#pendencytable").hide();
$("#gistable").hide();
$("#provisionaltable").hide();
}
$(".dataTables_wrapper").hide();
$('#pageLoader').show();
$.ajax({
url: url,
type: "GET",
data: data,
traditional: true,
dataType: "json",
success: function (response) {
$('#pageLoader').hide();
if (response.length === 0) {
$('#FileDetailsTable').DataTable().clear().draw();
$('#FileCategoryTable').DataTable().clear().draw();
$('#FileRetirementTable').DataTable().clear().draw();
$('#FileFamilyPensionTable').DataTable().clear().draw();
$('#FilePendencyTable').DataTable().clear().draw();
$('#FileGisTable').DataTable().clear().draw();
$('#FileProvisionalTable').DataTable().clear().draw();
$(".dataTables_wrapper").hide();
Swal.fire({
icon: "info",
title: "No Data Found",
text: "No records match your selection.",
confirmButtonText: "OK"
});
return;
} else {
$('#pageLoader').hide();
$(".dataTables_wrapper").show();
if (typeOfReport === "Detailed") {
if (typeOfCategory === '6') {
$("#cpstable").css("display", "block");
$("#audittable, #retiretable, #familypensiontable, #pendencytable, #gistable, #provisionaltable").hide();
let formattedData = response.map((row, index) => ({
index: index + 1,
emp_no: row.emp_no,
emp_name: row.emp_name,
dept_name: row.dept_name,
designation: row.designation,
type_of_retirement: row.type_of_retirement,
reason_for_pending: row.reason_for_pending,
fst: row.fst,
file_category_name: row.file_category_name,
remarks: row.remarks,
created_date: row.created_date
}));
fileDetailsTable.clear().rows.add(formattedData).draw();
}
if (typeOfCategory === '1') {
$("#retiretable").css("display", "block");
$("#cpstable, #audittable, #familypensiontable, #pendencytable, #gistable, #provisionaltable").hide();
let formattedData = response.map((row, index) => ({
index: index + 1,
emp_no: row.emp_no,
emp_name: row.emp_name,
dept_name: row.dept_name,
designation: row.designation,
type_of_retirement: row.type_of_retirement,
retirement_date: row.retirement_date,
fst: row.fst,
file_category_name: row.file_category_name,
remarks: row.remarks,
file_moved_date: row.file_moved_date
}));
fileRetireTable.clear().rows.add(formattedData).draw();
}
if (typeOfCategory === '2') {
$("#familypensiontable").css("display", "block");
$("#cpstable, #audittable, #retiretable, #pendencytable, #gistable, #provisionaltable").hide();
let formattedData = response.map((row, index) => ({
index: index + 1,
emp_no: row.emp_no,
emp_name: row.emp_name,
dept_name: row.dept_name,
designation: row.designation,
service_death: row.service_death,
relationship_deceased: row.relationship_deceased,
reason_for_pending: row.reason_for_pending,
fst: row.fst,
file_category_name: row.file_category_name,
remarks: row.remarks,
file_moved_date: row.file_moved_date
}));
fileFamilyPensionTable.clear().rows.add(formattedData).draw();
}
if (typeOfCategory === '3') {
$("#pendencytable").css("display", "block");
$("#cpstable, #audittable, #retiretable, #familypensiontable, #gistable, #provisionaltable").hide();
let formattedData = response.map((row, index) => ({
index: index + 1,
emp_no: row.emp_no,
emp_name: row.emp_name,
dept_name: row.dept_name,
designation: row.designation,
type_of_retirement: row.type_of_retirement,
retirement_date: row.retirement_date,
reason_for_pending: row.reason_for_pending,
fst: row.fst,
file_category_name: row.file_category_name,
remarks: row.remarks,
file_moved_date: row.file_moved_date
}));
filePendencyTable.clear().rows.add(formattedData).draw();
}
if (typeOfCategory === '4') {
$("#gistable").css("display", "block");
$("#cpstable, #audittable, #retiretable, #familypensiontable, #pendencytable, #provisionaltable").hide();
let formattedData = response.map((row, index) => ({
index: index + 1,
emp_no: row.emp_no,
emp_name: row.emp_name,
dept_name: row.dept_name,
designation: row.designation,
service_death: row.service_death,
sanctional_gis_amount: row.sanctional_gis_amount,
fst: row.fst,
file_category_name: row.file_category_name,
remarks: row.remarks,
file_moved_date: row.file_moved_date
}));
fileGisTable.clear().rows.add(formattedData).draw();
}
if (typeOfCategory === '5') {
$("#retiretable").css("display", "block");
$("#cpstable, #audittable, #familypensiontable, #pendencytable, #gistable, #provisionaltable").hide();
let formattedData = response.map((row, index) => ({
index: index + 1,
emp_no: row.emp_no,
emp_name: row.emp_name,
dept_name: row.dept_name,
designation: row.designation,
type_of_retirement: row.type_of_retirement,
retirement_date: row.retirement_date,
fst: row.fst,
file_category_name: row.file_category_name,
remarks: row.remarks,
file_moved_date: row.file_moved_date
}));
fileRetireTable.clear().rows.add(formattedData).draw();
}
}
if (typeOfReport === "Abstract") {
$("#audittable").css("display", "block");
let formattedData = response.map((row, index) => ({
index: index + 1,
dept_name: row.dept_name || "N/A",
audit_pending: row.audit_pending || 0,
department_pending: row.department_pending || 0,
pension_pending: row.pension_pending || 0,
completed: row.completed || 0,
total_count:
(row.department_pending || 0) +
(row.audit_pending || 0) +
(row.pension_pending || 0) +
(row.completed || 0)
}));
fileCategoryTable.clear().rows.add(formattedData).draw();
}
}
},
error: function (xhr, status, error) {
$('#pageLoader').hide();
Swal.fire({
icon: "error",
title: "Error",
text: "Failed to load data. Please try again.",
confirmButtonText: "OK"
});
}
});
});
});
//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 startdateInput = document.getElementById("startdate");
let enddateInput = document.getElementById("enddate");
// Set max attribute to disable future dates
startdateInput.setAttribute("max", today);
enddateInput.setAttribute("max", today);
// Prevent manual future date entry
startdateInput.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>