4 changed files with 932 additions and 0 deletions
-
22src/main/java/com/gcc/greencommitte/controller/Apicontroller.java
-
5src/main/java/com/gcc/greencommitte/controller/Maincontroller.java
-
406src/main/java/com/gcc/greencommitte/service/Greencommitteeservice.java
-
499src/main/resources/templates/modules/pgrcomplaints.html
@ -0,0 +1,499 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>GCC Green Committee</title> |
||||
|
<meta name="description" content=""> |
||||
|
<meta name="keywords" content=""> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
|
<base th:href="${baseURL}"/> |
||||
|
<link rel="icon" th:href="@{images/favicon.ico}" type="image/x-icon" /> |
||||
|
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800" rel="stylesheet"> |
||||
|
<link rel="stylesheet" type="text/css" th:href="@{assets/node_modules/bootstrap/dist/css/bootstrap.min.css}"> |
||||
|
<link rel="stylesheet" type="text/css" th:href="@{assets/node_modules/select2/dist/css/select2.min.css}"> |
||||
|
<link rel="stylesheet" type="text/css" th:href="@{assets/node_modules/sweetalert2/sweetalert2.min.css}"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"> |
||||
|
|
||||
|
|
||||
|
<!-- DataTables CSS --> |
||||
|
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet"/> |
||||
|
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet"/> |
||||
|
|
||||
|
<style> |
||||
|
/* Header Styling */ |
||||
|
.header { |
||||
|
background-color: #1d495a; |
||||
|
padding: 10px 20px; |
||||
|
color: white; |
||||
|
font-family: Arial, sans-serif; |
||||
|
} |
||||
|
|
||||
|
.header .logo img { |
||||
|
height: 50px; |
||||
|
} |
||||
|
|
||||
|
.header .center-text { |
||||
|
text-align: center; |
||||
|
font-size: 24px; |
||||
|
} |
||||
|
|
||||
|
.header .menu-btn { |
||||
|
background-color: transparent; |
||||
|
border: none; |
||||
|
font-size: 24px; |
||||
|
color: white; |
||||
|
} |
||||
|
|
||||
|
.header .menu-btn:hover { |
||||
|
color: #ccc; |
||||
|
} |
||||
|
|
||||
|
/* Menu Dropdown */ |
||||
|
.menu-dropdown { |
||||
|
position: absolute; |
||||
|
top: 60px; |
||||
|
right: 20px; |
||||
|
background-color: #1d495a; |
||||
|
padding: 10px; |
||||
|
display: none; |
||||
|
flex-direction: column; |
||||
|
z-index: 1000; /* Add z-index to bring the menu above other elements */ |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.menu-dropdown a { |
||||
|
color: white; |
||||
|
margin-bottom: 5px; |
||||
|
text-decoration: none; |
||||
|
} |
||||
|
|
||||
|
.menu-dropdown a:hover { |
||||
|
text-decoration: underline; |
||||
|
} |
||||
|
|
||||
|
/* Mobile Specific Styling */ |
||||
|
@media (max-width: 768px) { |
||||
|
.header { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.center-text { |
||||
|
font-size: 18px !important; |
||||
|
flex-grow: 1; |
||||
|
text-align: center; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.menu-dropdown { |
||||
|
|
||||
|
right: 0; |
||||
|
left: 0; |
||||
|
z-index: 1000; /* Add z-index to bring the menu above other elements */ |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.card { |
||||
|
border-radius: 12px; |
||||
|
} |
||||
|
|
||||
|
.card-h{ |
||||
|
border-top-left-radius: 12px; |
||||
|
border-top-right-radius: 12px; |
||||
|
} |
||||
|
|
||||
|
#sendOtpButton { |
||||
|
padding: 12px; |
||||
|
font-size: 16px; |
||||
|
border-radius: 6px; |
||||
|
transition: 0.3s ease; |
||||
|
} |
||||
|
|
||||
|
#sendOtpButton:hover { |
||||
|
transform: translateY(-2px); |
||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.2); |
||||
|
} |
||||
|
|
||||
|
.otp-input-box { |
||||
|
/*display: flex; |
||||
|
justify-content: space-between;*/ |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.otp-input { |
||||
|
width: 30px; |
||||
|
height: 30px; |
||||
|
border: 1px solid #ccc; |
||||
|
border-radius: 5px; |
||||
|
text-align: center; |
||||
|
font-size: 16px; |
||||
|
margin-right: 10px; |
||||
|
} |
||||
|
|
||||
|
.chcolor{ |
||||
|
background-color: #1d495a; |
||||
|
border-top-left-radius: 12px !important; |
||||
|
border-top-right-radius: 12px !important; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
</head> |
||||
|
<body style="background-color: #ebf1fa;"> |
||||
|
|
||||
|
<!-- Header Start--> |
||||
|
<header> |
||||
|
<div class="header d-flex justify-content-between align-items-center"> |
||||
|
<!-- Left: Logo --> |
||||
|
<div class="logo"> |
||||
|
<img src="https://gccservices.in/gcc/assets/images/logo.png" alt="Logo"> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Center: Text --> |
||||
|
<div class="center-text"> |
||||
|
GREATER CHENNAI CORPORATION |
||||
|
</div> |
||||
|
|
||||
|
<!-- Right: Button for Menu --> |
||||
|
<div class="menu"> |
||||
|
<button class="menu-btn" onclick="toggleMenu()"> |
||||
|
☰ <!-- Unicode for hamburger menu icon --> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Dropdown Menu --> |
||||
|
<div class="menu-dropdown" id="menuDropdown"> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/">Home</a> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/about-GCC/">About GCC</a> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/who-is-who/index_data.jsp">Who's Who</a> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/council/about-council/">Council</a> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/tender/">Tender</a> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/department/">Departments</a> |
||||
|
<a href="https://chennaicorporation.gov.in/gcc/online-services/">Online Services</a> |
||||
|
<a href="https://gccservices.in/gcc/login">Official Login</a> |
||||
|
</div> |
||||
|
|
||||
|
</header> |
||||
|
<!-- Header End--> |
||||
|
|
||||
|
<main class="container-fluid mt-4"> |
||||
|
|
||||
|
<div class="card shadow-lg border-0"> |
||||
|
<div class="card-h text-center text-white py-3" style="background-color: #1d495a;"> |
||||
|
<h5 class="mb-0">Green Committee Pruning Complaint Creation</h5> |
||||
|
</div> |
||||
|
|
||||
|
<div class="card-body"> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<table id="RequestListDatatable" 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">C By</th> |
||||
|
<th class="text-center">Refid</th> |
||||
|
<th class="text-center">Name</th> |
||||
|
<th class="text-center">Name Length</th> |
||||
|
<th class="text-center">Mobile</th> |
||||
|
<th class="text-center">Remarks length</th> |
||||
|
<th class="text-center no-sort" width="%2">Action</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
</tbody> |
||||
|
</table> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<button |
||||
|
type="button" |
||||
|
class="btn btn-secondary mt-2 mb-2" |
||||
|
style="font-size: 1.1rem;min-width: 70px;" |
||||
|
id="backButton" onclick="gotoback()"> |
||||
|
Back |
||||
|
</button> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</main> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<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> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<script type="text/javascript" th:src="@{assets/node_modules/jquery/dist/jquery.min.js}"></script> |
||||
|
<script type="text/javascript" th:src="@{assets/node_modules/bootstrap/dist/js/bootstrap.min.js}"></script> |
||||
|
<script type="text/javascript" th:src="@{assets/node_modules/select2/dist/js/select2.min.js}"></script> |
||||
|
<script type="text/javascript" th:src="@{assets/node_modules/sweetalert2/sweetalert2.min.js}"></script> |
||||
|
|
||||
|
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> |
||||
|
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> |
||||
|
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> |
||||
|
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
||||
|
|
||||
|
<script type="text/javascript"> |
||||
|
function gotoback(){ |
||||
|
window.location.href = '/greencommittee/home'; |
||||
|
} |
||||
|
|
||||
|
$(document).ready(function () { |
||||
|
|
||||
|
var table = $('#RequestListDatatable').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', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn' |
||||
|
} |
||||
|
], |
||||
|
fixedHeader: false, |
||||
|
autoWidth: true, |
||||
|
responsive: true, |
||||
|
searching: false, |
||||
|
select: false, |
||||
|
processing: false |
||||
|
|
||||
|
|
||||
|
}); |
||||
|
|
||||
|
fetchDetails(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
function fetchDetails(){ |
||||
|
|
||||
|
$('#pageLoader').show(); |
||||
|
$.ajax({ |
||||
|
url: '/greencommittee/api/getpurninglist', |
||||
|
method: 'GET', |
||||
|
contentType: 'application/json', |
||||
|
success: function (data) { |
||||
|
$('#pageLoader').hide(); |
||||
|
let tableContainer = $('#RequestListDatatable'); |
||||
|
|
||||
|
// Destroy any existing DataTable instance |
||||
|
if ($.fn.DataTable.isDataTable(tableContainer)) { |
||||
|
tableContainer.DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
tableContainer.DataTable({ |
||||
|
destroy: true, |
||||
|
searching: true, |
||||
|
autoWidth: false, |
||||
|
paging: true, |
||||
|
info: true, |
||||
|
data: data, |
||||
|
columns: [ |
||||
|
{ |
||||
|
data: null, |
||||
|
render: (data, type, row, meta) => meta.row + 1, |
||||
|
className: 'text-center' |
||||
|
}, |
||||
|
{ data: 'cby', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'ref_id', defaultContent: '-', className: 'text-center' }, |
||||
|
|
||||
|
{ |
||||
|
data: null, |
||||
|
className: 'text-center', |
||||
|
render: function (data, type, row) { |
||||
|
return row.p_name?.trim() || |
||||
|
row.dept_name?.trim() || |
||||
|
row.deptname?.trim() || |
||||
|
"-"; |
||||
|
} |
||||
|
}, |
||||
|
{ data: 'name_length', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'ph_no', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'remarks_length', defaultContent: '-', className: 'text-center' }, |
||||
|
{ |
||||
|
data: 'ref_id', |
||||
|
render: function (data, type, row) { |
||||
|
return `<button class="btn btn-primary btn-create" |
||||
|
data-refid="${data}"> |
||||
|
Generate PGR |
||||
|
</button>`; |
||||
|
}, |
||||
|
className: 'text-center' |
||||
|
} |
||||
|
|
||||
|
], |
||||
|
dom: 'Bfrtip', |
||||
|
buttons: [ |
||||
|
{ extend: 'pageLength', className: 'btn btn-warning' }, |
||||
|
{ 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' } |
||||
|
], |
||||
|
columnDefs: [{ targets: 'no-sort', orderable: false }], |
||||
|
lengthMenu: [ |
||||
|
[50, 100, 200, 500, -1], |
||||
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
||||
|
], |
||||
|
scrollY: '80vh', |
||||
|
scrollX: true, |
||||
|
responsive: false |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
error: function (xhr, status, error) { |
||||
|
$('#pageLoader').hide(); |
||||
|
console.error("Error fetching data:", error); |
||||
|
alert("Failed to load Details ."); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
$(document).on("click", ".btn-create", function () { |
||||
|
|
||||
|
const button = $(this); |
||||
|
const refId = button.data("refid"); |
||||
|
|
||||
|
Swal.fire({ |
||||
|
title: "Generate PGR Complaint?", |
||||
|
text: "Are you sure you want to generate a PGR complaint for " + refId + "?", |
||||
|
icon: "question", |
||||
|
showCancelButton: true, |
||||
|
confirmButtonText: "Yes", |
||||
|
cancelButtonText: "No" |
||||
|
}).then((result) => { |
||||
|
|
||||
|
if (!result.isConfirmed) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
button.prop("disabled", true).text("Generating..."); |
||||
|
|
||||
|
$('#pageLoader').show(); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/greencommittee/api/generatepgrcomplaints", |
||||
|
type: "POST", |
||||
|
data: { |
||||
|
refid: refId |
||||
|
}, |
||||
|
|
||||
|
success: function (response) { |
||||
|
console.log(response); |
||||
|
console.log(response.complaintNumber); |
||||
|
|
||||
|
$('#pageLoader').hide(); |
||||
|
|
||||
|
button.prop("disabled", false).text("Generate PGR"); |
||||
|
|
||||
|
if (response.status) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: "success", |
||||
|
title: "Success", |
||||
|
html: |
||||
|
"<b>PGR Complaint Generated Successfully</b><br><br>" + |
||||
|
"Complaint No : <b>" + (response.complaintNumber) + "</b>" |
||||
|
}).then(() => { |
||||
|
|
||||
|
// Refresh table |
||||
|
fetchDetails(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
} else { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: "warning", |
||||
|
title: "Failed", |
||||
|
text: response.message || "Unable to generate complaint." |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
error: function (xhr) { |
||||
|
|
||||
|
$('#pageLoader').hide(); |
||||
|
|
||||
|
button.prop("disabled", false).text("Generate PGR"); |
||||
|
|
||||
|
let message = "Something went wrong."; |
||||
|
|
||||
|
if (xhr.responseJSON && xhr.responseJSON.message) { |
||||
|
message = xhr.responseJSON.message; |
||||
|
} |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: "error", |
||||
|
title: "Error", |
||||
|
text: message |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue