Browse Source

fetched data based on status

master
AJITHKUMAR12 4 months ago
parent
commit
d1a0187baa
  1. 5
      src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java
  2. 2
      src/main/java/com/gcc/commissionerreview/controller/TenementController.java
  3. 14
      src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java
  4. 8
      src/main/java/com/gcc/commissionerreview/service/TenementService.java
  5. 456
      src/main/resources/templates/modules/vendorreport.html

5
src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java

@ -116,10 +116,11 @@ public class IeComplaintsApiController {
@RequestParam String ward,
@RequestParam(required = false) String complaintId,
@RequestParam(required = false) String fromDate,
@RequestParam(required = false) String toDate) {
@RequestParam(required = false) String toDate,
@RequestParam(required = false) String status) {
return ResponseEntity.ok(
iecomplaintservice.getvendorComplaintDetails(zone, ward, complaintId, fromDate, toDate));
iecomplaintservice.getvendorComplaintDetails(zone, ward, complaintId, fromDate, toDate, status));
}
@GetMapping("/vendorcomplaintDashboard")

2
src/main/java/com/gcc/commissionerreview/controller/TenementController.java

@ -83,6 +83,7 @@ public class TenementController {
@RequestParam String ward,
@RequestParam String schemeid,
@RequestParam(required = false) String status,
@RequestParam(required = false) String fromDate,
@RequestParam(required = false) String toDate) {
@ -90,6 +91,7 @@ public class TenementController {
return tenementService.getComplaintDetails(
ward,
schemeid,
status,
fromDate,
toDate);

14
src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java

@ -695,7 +695,7 @@ public class IeComplaintsService {
}
public Map<String, Object> getvendorComplaintDetails(String zone, String ward,
String complaintId, String fromDate, String toDate) {
String complaintId, String fromDate, String toDate, String status) {
Map<String, Object> response = new HashMap<>();
@ -748,6 +748,18 @@ public class IeComplaintsService {
params.add(complaintId);
}
if (status != null && !status.equalsIgnoreCase("all")) {
if (status.equalsIgnoreCase("completed")) {
sql.append(" AND comp.ref_id IS NOT NULL ");
} else if (status.equalsIgnoreCase("pending")) {
sql.append(" AND comp.ref_id IS NULL ");
}
}
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) {
sql.append("AND ( ");

8
src/main/java/com/gcc/commissionerreview/service/TenementService.java

@ -384,6 +384,7 @@ public class TenementService {
String ward,
String schemeid,
String status,
String fromDate,
String toDate) {
@ -466,6 +467,13 @@ public class TenementService {
params.add(toDate);
}
// STATUS FILTER
if (status != null && !status.isEmpty()) {
sql.append("AND il1.final_status = ? ");
params.add(status);
}
sql.append("ORDER BY il1.id DESC ");
List<Map<String, Object>> result = jdbcTemplate.queryForList(

456
src/main/resources/templates/modules/vendorreport.html

@ -325,7 +325,7 @@
<thead class="table-header">
<tr>
<th class="text-center">Complaint Name</th>
<!--<th class="text-center">Complaint Name</th>-->
<th class="text-center">Before Image</th>
<th class="text-center">Complaint Created Date</th>
@ -366,7 +366,7 @@
<div class="table-responsive">
<table class="table table-bordered text-center">
<table id="schemeTable" class="table table-bordered text-center">
<thead class="table-header">
@ -415,7 +415,7 @@
<div class="table-responsive">
<table class="table table-bordered text-center">
<table id="tenementComplaintTable" class="table table-bordered text-center">
<thead class=" table-header">
@ -612,7 +612,7 @@
html += `
<tr>
<td>${c.complaint_name}</td>
<td>${c.complaint_name}</td>
<td>
@ -639,23 +639,30 @@ ${c.after_image ? `<img src="${c.after_image}" width="80" class="preview-img" st
$("#complaintDetailsBody").html(html);
$("#complaintTable").DataTable({
destroy: true,
pageLength: 10,
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
text: 'Download Excel',
title: 'Complaint_Details'
},
{
extend: 'pdfHtml5',
text: 'Download PDF',
title: 'Complaint_Details',
orientation: 'landscape'
orientation: 'landscape',
pageSize: 'A4'
}
]
});
$("#complaintModal").modal("show");
});
@ -956,7 +963,7 @@ ${(
$("#zoneTable tbody").html(rows);
$('#zoneTable').DataTable({
/*$('#zoneTable').DataTable({
destroy: true,
paging: false,
@ -965,6 +972,36 @@ ${(
info: false,
autoWidth: false,
scrollX: true
});*/
$('#zoneTable').DataTable({
destroy: true,
paging: false,
searching: true,
ordering: false,
info: false,
autoWidth: false,
scrollX: true,
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
text: 'Download Excel',
title: 'IE_Complaints_Report'
},
{
extend: 'pdfHtml5',
text: 'Download PDF',
title: 'IE_Complaints_Report',
orientation: 'landscape',
pageSize: 'A3'
}
]
});
}).fail(function (err) {
@ -1227,6 +1264,9 @@ ${(
garbageData.length,
tenementData.length
);
if ($.fn.DataTable.isDataTable('#wardTable')) {
$('#wardTable').DataTable().destroy();
}
// ward name map
let wardNameMap = {
@ -1262,7 +1302,7 @@ ${(
<!-- HOTSPOT -->
<td>
<!--<td>
${h.total_count > 0 ?
@ -1281,12 +1321,59 @@ ${h.total_count}
<td>${h.pending_count || 0}</td>
-->
<!-- HOTSPOT -->
<td>
<!-- TRANSPORT -->
${h.total_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','4','all')">
${h.total_count}
</a>`
: 0}
</td>
<td>
${h.completed_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','4','completed')">
${h.completed_count}
</a>`
: 0}
</td>
<td>
${h.pending_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','4','pending')">
${h.pending_count}
</a>`
: 0}
</td>
<!-- TRANSPORT -->
<!--<td>
${t.total_count > 0 ?
`<a href="javascript:void(0)"
@ -1302,14 +1389,60 @@ ${t.total_count}
<td>${t.completed_count || 0}</td>
<td>${t.pending_count || 0}</td>
<td>${t.pending_count || 0}</td>-->
<!-- RC BIN -->
<td>
${t.total_count > 0 ?
<!-- GARBAGE -->
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','6','all')">
${t.total_count}
</a>`
: 0}
</td>
<td>
${t.completed_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','6','completed')">
${t.completed_count}
</a>`
: 0}
</td>
<td>
${t.pending_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','6','pending')">
${t.pending_count}
</a>`
: 0}
</td>
<!-- GARBAGE -->
<!--<td>
${g.total_count > 0 ?
`<a href="javascript:void(0)"
@ -1325,7 +1458,53 @@ ${g.total_count}
<td>${g.completed_count || 0}</td>
<td>${g.pending_count || 0}</td>
<td>${g.pending_count || 0}</td>-->
<!-- GARBAGE -->
<td>
${g.total_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','12','all')">
${g.total_count}
</a>`
: 0}
</td>
<td>
${g.completed_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','12','completed')">
${g.completed_count}
</a>`
: 0}
</td>
<td>
${g.pending_count > 0 ?
`<a href="javascript:void(0)"
onclick="openComplaintDetails('${zone}','${ward}','12','pending')">
${g.pending_count}
</a>`
: 0}
</td>
@ -1355,9 +1534,38 @@ ${ten.total_complaint_count}
}
$("#wardTableBody").html(html);
$('#wardTable').DataTable({
destroy: true,
dom: 'Bfrtip',
pageLength: 15,
scrollX: true,
buttons: [
{
extend: 'excelHtml5',
text: 'Download Excel',
title: 'Ward_Activity_Report'
},
{
extend: 'pdfHtml5',
text: 'Download PDF',
title: 'Ward_Activity_Report',
orientation: 'landscape',
pageSize: 'A3'
}
]
});
$("#wardModal").modal("show");
});
}
function openWardModalworking(zone) {
@ -1550,7 +1758,72 @@ ${ten.total_complaint_count}
});
}
function openComplaintDetails(zone, ward, complaintId) {
function openComplaintDetails(zone, ward, complaintId, status) {
let fromDate = $("#fromDate").val();
let toDate = $("#toDate").val();
$.get("/commissionerreview/api/iecomplaints/vendorcomplaintDetails", {
zone: zone,
ward: ward,
complaintId: complaintId,
status: status,
fromDate: fromDate,
toDate: toDate
}, function (res) {
console.log(res);
let data = res.data || [];
let html = "";
data.forEach(item => {
html += `
<tr>
<!-- <td>${item.complaint_name || ''}</td> -->
<td>
${item.before_image ?
`<img src="${item.before_image}"
style="width:80px;height:80px;" class="preview-img" style="cursor:pointer" >`
: 'No Image'}
</td>
<td>${item.complaint_created_date || ''}</td>
<td>${item.complaint_street_name || ''}</td>
<td>
${item.after_image ?
`<img src="${item.after_image}"
style="width:80px;height:80px;" class="preview-img" style="cursor:pointer" >`
: 'Pending'}
</td>
<td>${item.completion_date || 'Pending'}</td>
<td>${item.completion_street_name || 'Pending'}</td>
</tr>
`;
});
$("#complaintDetailsBody").html(html);
$("#complaintModal").modal("show");
});
}
function openComplaintDetailslastworkinglive(zone, ward, complaintId) {
let fromDate = $("#fromDate").val();
let toDate = $("#toDate").val();
@ -1580,8 +1853,8 @@ ${ten.total_complaint_count}
<tr>
<td>${row.complaint_name || ''}</td>
<td>
<img src="${row.before_image}"
width="80"
<img src="${row.before_image} "
width="80" c
height="80">
</td>
<td>${row.complaint_created_date || ''}</td>
@ -1749,15 +2022,86 @@ height="80">`
: 0}
</td>
<td>${row.total_complaint_closed_count || 0}</td>
<!--<td>${row.total_complaint_closed_count || 0}</td>
<td>${row.total_complaint_pending_count || 0}</td>-->
<!-- COMPLETED -->
<td>
${row.total_complaint_closed_count > 0
? `<a href="javascript:void(0)"
onclick="openTenementComplaintModal(
'${ward}',
'${row.schemeid}',
'completed'
)">
${row.total_complaint_closed_count}
</a>`
: 0}
</td>
<!-- PENDING -->
<td>
${row.total_complaint_pending_count > 0
<td>${row.total_complaint_pending_count || 0}</td>
? `<a href="javascript:void(0)"
onclick="openTenementComplaintModal(
'${ward}',
'${row.schemeid}',
'created'
)">
${row.total_complaint_pending_count}
</a>`
: 0}
</td>
</tr>
`;
}
$("#schemeTableBody").html(html);
if ($.fn.DataTable.isDataTable('#schemeTable')) {
$('#schemeTable').DataTable().destroy();
}
$('#schemeTable').DataTable({
destroy: true,
dom: 'Bfrtip',
pageLength: 10,
buttons: [
{
extend: 'excelHtml5',
text: 'Download Excel',
title: 'Tenement_Scheme_Report'
},
{
extend: 'pdfHtml5',
text: 'Download PDF',
title: 'Tenement_Scheme_Report',
orientation: 'landscape',
pageSize: 'A4'
}
]
});
// ATTACH EVENT FIRST
$('#wardModal').one('hidden.bs.modal', function () {
@ -1779,7 +2123,8 @@ height="80">`
}
function openTenementComplaintModal(
ward,
schemeid
schemeid,
status
) {
console.log("WARD", ward);
console.log("SCHEMEID", schemeid);
@ -1792,13 +2137,17 @@ height="80">`
{
ward: ward,
schemeid: schemeid,
status: status,
fromDate: fromDate,
toDate: toDate
},
function (res) {
console.log("RES=", res);
if ($.fn.DataTable.isDataTable('#tenementComplaintTable')) {
$('#tenementComplaintTable').DataTable().destroy();
}
let data = res.data || [];
@ -1852,6 +2201,38 @@ ${row.after_image ? `<img src="${row.after_image}" width="80" class="preview-img
});
$("#tenementComplaintTableBody").html(html);
if ($.fn.DataTable.isDataTable('#tenementComplaintTable')) {
$('#tenementComplaintTable').DataTable().destroy();
}
$('#tenementComplaintTable').DataTable({
pageLength: 10,
searching: true,
ordering: false,
lengthChange: false,
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
title: 'Tenement Complaint Details'
},
{
extend: 'pdfHtml5',
title: 'Tenement Complaint Details',
orientation: 'landscape',
pageSize: 'A4'
}
]
});
$("#tenementComplaintModal").modal("show");
}
@ -2000,7 +2381,7 @@ ${w.ward}
}
$("#zoneTableBody").html(html);
$("#zoneTable").DataTable({
/*$("#zoneTable").DataTable({
destroy: true,
dom: 'Bfrtip',
pageLength: 15,
@ -2017,6 +2398,36 @@ ${w.ward}
orientation: 'landscape'
}
]
});*/
$('#zoneTable').DataTable({
destroy: true,
paging: false,
searching: true,
ordering: false,
info: false,
autoWidth: false,
scrollX: true,
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
text: 'Download Excel',
title: 'IE_Complaints_Report'
},
{
extend: 'pdfHtml5',
text: 'Download PDF',
title: 'IE_Complaints_Report',
orientation: 'landscape',
pageSize: 'A3'
}
]
});
});
@ -2084,7 +2495,10 @@ ${w.ward}
<div class="card-header complaint-header">
${item.complaint_id == 6
? 'RC Bin Overflow'
: item.complaint_name}
: item.complaint_id == 12
? 'Unauthorized garbage dumping'
: item.complaint_name
}
</div>
<!--<div class="card-header complaint-header">

Loading…
Cancel
Save