8 changed files with 1530 additions and 21 deletions
-
9gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
-
237gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java
-
62gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmController.java
-
561gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java
-
4gcc_officer_portal/src/main/resources/application.properties
-
394gcc_officer_portal/src/main/resources/templates/modules/nulm/salary-approve-park.html
-
4gcc_officer_portal/src/main/resources/templates/modules/nulm/salary-approve.html
-
274gcc_officer_portal/src/main/resources/templates/modules/nulm/salary-report-park.html
@ -0,0 +1,394 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"> |
||||
|
<!-- Include Bootstrap CSS for styling the modal --> |
||||
|
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"> |
||||
|
</head> |
||||
|
|
||||
|
<body> |
||||
|
<div class="wrapper"> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
<div class="page-wrap"> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-6"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="ik ik-thumbs-up bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Park STAFF</h5> |
||||
|
<span>Salary Approval</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-6"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"> |
||||
|
<a href="/index"><i class="ik ik-home"></i></a> |
||||
|
</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Park Salary Approval</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<hr> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<div class="col-sm-3"> |
||||
|
<label for="month">Month:</label> |
||||
|
<select id="month" class="form-control" required> |
||||
|
<option value="">Select</option> |
||||
|
<option value="January">January</option> |
||||
|
<option value="February">February</option> |
||||
|
<option value="March">March</option> |
||||
|
<option value="April">April</option> |
||||
|
<option value="May">May</option> |
||||
|
<option value="June">June</option> |
||||
|
<option value="July">July</option> |
||||
|
<option value="August">August</option> |
||||
|
<option value="September">September</option> |
||||
|
<option value="October">October</option> |
||||
|
<option value="November">November</option> |
||||
|
<option value="December">December</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
<label for="year">Year:</label> |
||||
|
<input type="number" id="year" class="form-control" min="2000" max="2100" required> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
<label for="salaryStatus">Salary Status:</label> |
||||
|
<select id="salaryStatus" class="form-control"> |
||||
|
<option value="">Select</option> |
||||
|
<option value="Initiated">Initiated</option> |
||||
|
<option value="Approved">Approved</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
<button class="btn btn-primary mt-4" onclick="fetchSalaryReport()">Get Salary Info</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="card-block mt-4"> |
||||
|
<div> |
||||
|
<table id="salaryDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="99.5%"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr role="row"> |
||||
|
<th>S.No</th> |
||||
|
<th>Incharge Name</th> |
||||
|
<th>Total Staff Count</th> |
||||
|
<th>Salary Processed</th> |
||||
|
<th>Total Salary Amount</th> |
||||
|
<th>Salary Status</th> |
||||
|
<th>Action</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr th:each="salaryInitiatedCounts, i : ${salaryInitiatedCounts}"> |
||||
|
<td th:text="${i.count}">0</td> |
||||
|
<td th:text="${salaryInitiatedCounts.incharge_name}"></td> |
||||
|
|
||||
|
<!-- Make the Total Staff Count clickable --> |
||||
|
<td> |
||||
|
<a href="#" class="total-staff-count" |
||||
|
th:data-incharge-id="${salaryInitiatedCounts.incharge_id}" |
||||
|
th:data-month="${salaryInitiatedCounts.month}" |
||||
|
th:data-year="${salaryInitiatedCounts.year}" |
||||
|
th:data-incharge-name="${salaryInitiatedCounts.incharge_name}" |
||||
|
th:data-zone="${salaryInitiatedCounts.zone}" |
||||
|
th:data-enrollment-ids="${salaryInitiatedCounts.enrollment_ids}" |
||||
|
th:text="${salaryInitiatedCounts.total_staff_count}" |
||||
|
data-toggle="modal" data-target="#shgModal"> |
||||
|
</a> |
||||
|
</td> |
||||
|
|
||||
|
<td th:text="${salaryInitiatedCounts.total_approved_count}"></td> |
||||
|
<td th:text="${salaryInitiatedCounts.total_salary_amount}"></td> |
||||
|
<td th:text="${salaryInitiatedCounts.salary_status}"></td> |
||||
|
<td> |
||||
|
<span th:if="${salaryInitiatedCounts.salary_status == 'Approved'}" class="badge badge-success">Approved</span> |
||||
|
<button th:if="${salaryInitiatedCounts.salary_status == 'Initiated'}" |
||||
|
class="btn btn-primary approve-btn" |
||||
|
th:data-enrollment-ids="${salaryInitiatedCounts.enrollment_ids}" |
||||
|
th:data-month="${salaryInitiatedCounts.month}" |
||||
|
th:data-year="${salaryInitiatedCounts.year}"> |
||||
|
Approve |
||||
|
</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
<tfoot class="thead-dark"> |
||||
|
<tr> |
||||
|
<th>S.No</th> |
||||
|
<th>Incharge Name</th> |
||||
|
<th>Total Staff Count</th> |
||||
|
<th>Salary Processed</th> |
||||
|
<th>Total Salary Amount</th> |
||||
|
<th>Salary Status</th> |
||||
|
<th>Action</th> |
||||
|
</tr> |
||||
|
</tfoot> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Modal for displaying staff details --> |
||||
|
<div class="modal fade" id="shgModal" tabindex="-1" role="dialog" aria-labelledby="shgModalLabel" aria-hidden="true"> |
||||
|
<div class="modal-dialog modal-xl" role="document"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title" id="shgModalLabel">Staff Details</h5> |
||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
||||
|
<span aria-hidden="true">×</span> |
||||
|
</button> |
||||
|
</div> |
||||
|
<div class="modal-body"> |
||||
|
<!-- Table for displaying attendance details --> |
||||
|
<div id="attendanceDetailsContainer"> |
||||
|
<h5>Attendance Details</h5> |
||||
|
<table class="table table-striped"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>S.No</th> |
||||
|
<th>Employee ID</th> |
||||
|
<th>Name</th> |
||||
|
<th>Year</th> |
||||
|
<th>Month</th> |
||||
|
<th>Total Days Present</th> |
||||
|
<th>Total Days Absent</th> |
||||
|
<th>Total Days OD</th> |
||||
|
<th>Total Days Salary</th> |
||||
|
<th>Total Salary</th> |
||||
|
<th>Salary Status</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody id="attendanceDetailsTableBody"> |
||||
|
<!-- Dynamic content will be loaded here --> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
<div th:replace="~{fragments/modules/pgr/modal-box :: div}"></div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
||||
|
<script th:replace="~{fragments/modules/pgr/script :: script}"></script> |
||||
|
<script th:inline="javascript"> |
||||
|
|
||||
|
function fetchSalaryReport() { |
||||
|
const month = document.getElementById('month').value; |
||||
|
const year = document.getElementById('year').value; |
||||
|
const salaryStatus = document.getElementById('salaryStatus').value; |
||||
|
|
||||
|
if (month && year) { |
||||
|
window.location.href = `/gcc/nulm/salary-approve-park?month=${month}&year=${year}&salaryStatus=${salaryStatus}`; |
||||
|
} else { |
||||
|
alert("Please select both month and year."); |
||||
|
} |
||||
|
} |
||||
|
$(document).ready(function () { |
||||
|
|
||||
|
function clearUrlParams() { |
||||
|
const currentUrl = window.location.href; |
||||
|
const urlWithoutParams = currentUrl.split('?')[0]; // Remove the query parameters |
||||
|
window.history.replaceState({}, document.title, urlWithoutParams); // Replace the current URL without params |
||||
|
} |
||||
|
|
||||
|
// Call this on page load to reset the URL |
||||
|
clearUrlParams(); |
||||
|
|
||||
|
// Initialize DataTable |
||||
|
var table = $('#salaryDatatable').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', |
||||
|
id: 'copyBtn', |
||||
|
columns: [0,1,2,3,4,5] |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn', |
||||
|
exportOptions: { |
||||
|
columns: [0, 1, 2, 3, 4, 5] |
||||
|
} |
||||
|
}, |
||||
|
/* |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'EXCEL', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn' |
||||
|
}*/ |
||||
|
], |
||||
|
fixedHeader: true, |
||||
|
autoWidth: true, |
||||
|
responsive: true, |
||||
|
searching: true, |
||||
|
select: false, |
||||
|
processing: false |
||||
|
}); |
||||
|
|
||||
|
// Handle total-staff-count click event |
||||
|
$('.total-staff-count').on('click', function (event) { |
||||
|
event.preventDefault(); // Prevent default anchor click behavior |
||||
|
|
||||
|
// Get inchargeName and month from the clicked element's data attributes |
||||
|
// var inchargeName = $(this).data('incharge-name'); |
||||
|
var inchargeId = $(this).data('incharge-id') |
||||
|
var month = $(this).data('month') |
||||
|
var year = $(this).data('year') |
||||
|
var inchargeName = $(this).data('incharge-name') |
||||
|
var zone = $(this).data('zone'); |
||||
|
var enrollmentIds = $(this).data('enrollment-ids'); |
||||
|
console.log(zone); |
||||
|
console.log(inchargeName); |
||||
|
// Make the AJAX call to fetch attendance details |
||||
|
$.ajax({ |
||||
|
url: '/gcc/api/nulm/staffInititeadList-park', |
||||
|
method: 'GET', |
||||
|
data: { |
||||
|
//inchargeName: inchargeName, |
||||
|
inchargeId: inchargeId, |
||||
|
month: month, |
||||
|
year: year, |
||||
|
inchargeName: inchargeName, |
||||
|
enrollmentIds: enrollmentIds.join(',') |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
// Populate the modal's table with the fetched data |
||||
|
var tbody = $('#attendanceDetailsTableBody'); |
||||
|
tbody.empty(); // Clear any previous data |
||||
|
|
||||
|
// Loop through the data and append rows to the table |
||||
|
$.each(data, function (index, item) { |
||||
|
var row = `<tr> |
||||
|
<td>${index + 1}</td> |
||||
|
<td>${item.emp_id}</td> |
||||
|
<td>${item.name}</td> |
||||
|
<td>${item.year}</td> |
||||
|
<td>${item.month}</td> |
||||
|
<td>${item.total_days_present}</td> |
||||
|
<td>${item.total_days_absent}</td> |
||||
|
<td>${item.total_days_od}</td> |
||||
|
<td>${item.total_days_salary}</td> |
||||
|
<td>${item.total_salary}</td> |
||||
|
<td>${item.salary_status}</td> |
||||
|
</tr>`; |
||||
|
tbody.append(row); |
||||
|
}); |
||||
|
|
||||
|
// Show the modal after data is populated |
||||
|
$('#shgModal').modal('show'); |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error('Failed to fetch data:', error); |
||||
|
alert('Failed to load staff details. Please try again.'); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
$(document).on('click', '.approve-btn', function () { |
||||
|
var enrollmentIds = $(this).data('enrollment-ids'); // Get the data attribute |
||||
|
var month = $(this).data('month'); |
||||
|
var year = $(this).data('year'); |
||||
|
|
||||
|
// Confirm the action with SweetAlert |
||||
|
Swal.fire({ |
||||
|
title: 'Are you sure?', |
||||
|
text: 'Do you want to approve the selected enrollments?', |
||||
|
icon: 'warning', |
||||
|
showCancelButton: true, |
||||
|
confirmButtonColor: '#3085d6', |
||||
|
cancelButtonColor: '#d33', |
||||
|
confirmButtonText: 'Yes, approve it!' |
||||
|
}).then((result) => { |
||||
|
if (result.isConfirmed) { |
||||
|
// Make the AJAX call |
||||
|
$.ajax({ |
||||
|
url: '/gcc/api/nulm/update-salary-status-park', |
||||
|
method: 'POST', |
||||
|
contentType: 'application/x-www-form-urlencoded', |
||||
|
data: { |
||||
|
// Pass the enrollment IDs as a comma-separated string |
||||
|
enrollmentIds: enrollmentIds.join(','), // Convert array to a comma-separated string |
||||
|
month: month, |
||||
|
year: year |
||||
|
}, |
||||
|
success: function (response) { |
||||
|
Swal.fire( |
||||
|
'Approved!', |
||||
|
response, |
||||
|
'success' |
||||
|
); |
||||
|
// Optionally refresh the table or update the UI |
||||
|
location.reload(); |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error('Failed to approve:', error); |
||||
|
Swal.fire( |
||||
|
'Error!', |
||||
|
'Failed to approve the selected enrollments. Please try again.', |
||||
|
'error' |
||||
|
); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
</div> |
||||
|
</div> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,274 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" dir=""> |
||||
|
<html xmlns:th="http://www.thymeleaf.org"> |
||||
|
|
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
||||
|
|
||||
|
<body> |
||||
|
<div class="wrapper"> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
|
||||
|
<div class="page-wrap"> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-6"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="ik ik-thumbs-up bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Park STAFF</h5> |
||||
|
<span>Salary Report</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-6"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"> |
||||
|
<a href="/index"><i class="ik ik-home"></i></a> |
||||
|
</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Salary Report Park</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<hr> |
||||
|
|
||||
|
<!-- Filters Section --> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-3"> |
||||
|
<label for="month">Month:</label> |
||||
|
<select id="month" class="form-control" required> |
||||
|
<option value="">Select</option> |
||||
|
<option value="January">January</option> |
||||
|
<option value="February">February</option> |
||||
|
<option value="March">March</option> |
||||
|
<option value="April">April</option> |
||||
|
<option value="May">May</option> |
||||
|
<option value="June">June</option> |
||||
|
<option value="July">July</option> |
||||
|
<option value="August">August</option> |
||||
|
<option value="September">September</option> |
||||
|
<option value="October">October</option> |
||||
|
<option value="November">November</option> |
||||
|
<option value="December">December</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
<label for="year">Year:</label> |
||||
|
<input type="number" id="year" class="form-control" min="2000" max="2100" required> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
<label for="salaryStatus">Salary Status:</label> |
||||
|
<select id="salaryStatus" class="form-control"> |
||||
|
<option value="">Select</option> |
||||
|
<option value="Initiated">Initiated</option> |
||||
|
<option value="Approved">Approved</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
<label for="selfhelp">Self Help Group:</label> |
||||
|
<select id="selfhelp" class="form-control"> |
||||
|
<option value="">Select</option> |
||||
|
<!-- Group names will be populated here --> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<div class="col-sm-3"> |
||||
|
|
||||
|
<button class="btn btn-primary mt-4" onclick="fetchSalaryReport()">Get Salary Info</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Salary Report Table --> |
||||
|
<div class="card-block mt-3"> |
||||
|
<table id="salaryreporttable" class="table table-striped table-bordered"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr> |
||||
|
<th>S.No</th> |
||||
|
<th>Employee Id</th> |
||||
|
<th>Employee Name</th> |
||||
|
<th>Employee Designation</th> |
||||
|
<th>Incharge Name</th> |
||||
|
<th>Incharge Designation</th> |
||||
|
<th>Self Help Group</th> |
||||
|
<th>Days Present</th> |
||||
|
<th>OD</th> |
||||
|
<th>Total Days for Salary</th> |
||||
|
<th>Total Days</th> |
||||
|
<th>Total Days Absent</th> |
||||
|
<th>Month</th> |
||||
|
<th>Year</th> |
||||
|
<th>Salary Amount</th> |
||||
|
<th>Salary Status</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr th:each="salary, i : ${salaryReport}"> |
||||
|
<td th:text="${i.count}">1</td> |
||||
|
<td th:text="${salary.emp_id}"></td> |
||||
|
<td th:text="${salary.name}"></td> |
||||
|
<td th:text="${salary.designation}"></td> |
||||
|
<td th:text="${salary.incharge_name}"></td> |
||||
|
<td th:text="${salary.incharge_designation}"></td> |
||||
|
<td th:text="${salary.group_name}"></td> |
||||
|
<td th:text="${salary.total_days_present}"></td> |
||||
|
<td th:text="${salary.total_days_od}"></td> |
||||
|
<td th:text="${salary.total_days_salary}"></td> |
||||
|
<td th:text="${salary.total_days}"></td> |
||||
|
<td th:text="${salary.total_days_absent}"></td> |
||||
|
<td th:text="${salary.imonth}"></td> |
||||
|
<td th:text="${salary.iyear}"></td> |
||||
|
<td th:text="${salary.total_salary}"></td> |
||||
|
<td th:text="${salary.salary_status}"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
<tfoot class="thead-dark"> |
||||
|
<tr> |
||||
|
<th>S.No</th> |
||||
|
<th>Employee Id</th> |
||||
|
<th>Employee Name</th> |
||||
|
<th>Employee Designation</th> |
||||
|
<th>Incharge Name</th> |
||||
|
<th>Incharge Designation</th> |
||||
|
<th>Self Help Group</th> |
||||
|
<th>Days Present</th> |
||||
|
<th>OD</th> |
||||
|
<th>Total Days for Salary</th> |
||||
|
<th>Total Days</th> |
||||
|
<th>Total Days Absent</th> |
||||
|
<th>Month</th> |
||||
|
<th>Year</th> |
||||
|
<th>Salary Amount</th> |
||||
|
<th>Salary Status</th> |
||||
|
</tr> |
||||
|
</tfoot> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/base/script :: script}"></div> |
||||
|
|
||||
|
<script th:inline="javascript"> |
||||
|
|
||||
|
function fetchSalaryReport() { |
||||
|
const month = document.getElementById('month').value; |
||||
|
const year = document.getElementById('year').value; |
||||
|
const salaryStatus = document.getElementById('salaryStatus').value; |
||||
|
const groupName=document.getElementById('selfhelp').value; |
||||
|
|
||||
|
if (month && year) { |
||||
|
window.location.href = `/gcc/nulm/salary-report-park?month=${month}&year=${year}&salaryStatus=${salaryStatus}&groupName=${groupName}`; |
||||
|
} else { |
||||
|
alert("Please select both month and year."); |
||||
|
} |
||||
|
} |
||||
|
$(document).ready(function () { |
||||
|
|
||||
|
function clearUrlParams() { |
||||
|
const currentUrl = window.location.href; |
||||
|
const urlWithoutParams = currentUrl.split('?')[0]; // Remove the query parameters |
||||
|
window.history.replaceState({}, document.title, urlWithoutParams); // Replace the current URL without params |
||||
|
} |
||||
|
|
||||
|
// Call this on page load to reset the URL |
||||
|
clearUrlParams(); |
||||
|
|
||||
|
// Initialize DataTable |
||||
|
var table = $('#salaryreporttable').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' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn', |
||||
|
exportOptions: { |
||||
|
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] |
||||
|
}, |
||||
|
orientation: 'landscape', // Change to landscape for more horizontal space |
||||
|
pageSize: 'A3', // You can change to A4 or A3 depending on your needs |
||||
|
customize: function (doc) { |
||||
|
// Custom column widths for better fit |
||||
|
//doc.content[1].table.widths = ['2%', '6%', '6%', '6%', '6%', '6%', '6%', '3%', '3%', '3%', '3%', '3%', '3%', '6%', '6%', '6%']; |
||||
|
|
||||
|
// Optional: Adjust font size if needed |
||||
|
doc.styles.tableBodyEven.alignment = 'center'; |
||||
|
doc.styles.tableBodyOdd.alignment = 'center'; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
fixedHeader: true, |
||||
|
autoWidth: true, |
||||
|
responsive: true, |
||||
|
searching: true, |
||||
|
select: false, |
||||
|
processing: false |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
}); |
||||
|
$(document).ready(function () { |
||||
|
$.ajax({ |
||||
|
url: '/gcc/api/nulm/selfHelpGroups', // Your API endpoint |
||||
|
type: 'GET', |
||||
|
success: function (data) { |
||||
|
// Clear existing options (if any) |
||||
|
$('#selfhelp').empty().append('<option value="">Select</option>'); |
||||
|
|
||||
|
// Check if data is an array and iterate through it |
||||
|
if (Array.isArray(data)) { |
||||
|
let options = ''; |
||||
|
data.forEach(function (group) { |
||||
|
// Access the correct properties |
||||
|
options += `<option value="${group.groupName}">${group.groupName}</option>`; |
||||
|
}); |
||||
|
$('#selfhelp').append(options); |
||||
|
} else { |
||||
|
console.error("Data is not an array:", data); |
||||
|
} |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error("Error fetching self-help groups:", error); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
|
||||
|
</html> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue