diff --git a/src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java b/src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java index 08cd1ff..fab2faa 100644 --- a/src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java +++ b/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") diff --git a/src/main/java/com/gcc/commissionerreview/controller/TenementController.java b/src/main/java/com/gcc/commissionerreview/controller/TenementController.java index 2221723..f9c94b3 100644 --- a/src/main/java/com/gcc/commissionerreview/controller/TenementController.java +++ b/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); diff --git a/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java b/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java index c89cd67..d16d4cb 100644 --- a/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java +++ b/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java @@ -695,7 +695,7 @@ public class IeComplaintsService { } public Map getvendorComplaintDetails(String zone, String ward, - String complaintId, String fromDate, String toDate) { + String complaintId, String fromDate, String toDate, String status) { Map 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 ( "); diff --git a/src/main/java/com/gcc/commissionerreview/service/TenementService.java b/src/main/java/com/gcc/commissionerreview/service/TenementService.java index feddca9..ea7a73d 100644 --- a/src/main/java/com/gcc/commissionerreview/service/TenementService.java +++ b/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> result = jdbcTemplate.queryForList( diff --git a/src/main/resources/templates/modules/vendorreport.html b/src/main/resources/templates/modules/vendorreport.html index 8db8416..8f3418f 100644 --- a/src/main/resources/templates/modules/vendorreport.html +++ b/src/main/resources/templates/modules/vendorreport.html @@ -325,7 +325,7 @@ - Complaint Name + Before Image Complaint Created Date @@ -366,7 +366,7 @@
- +
@@ -415,7 +415,7 @@
-
+
@@ -612,7 +612,7 @@ html += ` - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -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 += ` + + + + + + + + + + + + + + + + + + +`; + }); + + $("#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} @@ -1749,15 +2022,86 @@ height="80">` : 0} - + + + + + + + + + `; } $("#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 ? `
- ${item.complaint_id == 6 + ${item.complaint_id == 6 ? 'RC Bin Overflow' - : item.complaint_name} + : item.complaint_id == 12 + ? 'Unauthorized garbage dumping' + : item.complaint_name + }
${c.complaint_name}${c.complaint_name} @@ -639,23 +639,30 @@ ${c.after_image ? ` - + + + - +${h.total_count > 0 ? + + ` + +${h.total_count} + +` + + : 0} + + + +${h.completed_count > 0 ? + + ` + +${h.completed_count} + +` + + : 0} + + +${h.pending_count > 0 ? + + ` + +${h.pending_count} + +` + + : 0} + + +${t.total_count > 0 ? - + ` + +${t.total_count} + +` + + : 0} + + + +${t.completed_count > 0 ? + + ` + +${t.completed_count} + +` + + : 0} + + +${t.pending_count > 0 ? + + ` + +${t.pending_count} + +` + + : 0} + + + +${g.total_count > 0 ? + + ` + +${g.total_count} + +` + + : 0} + + + +${g.completed_count > 0 ? + + ` + +${g.completed_count} + +` + + : 0} + + + +${g.pending_count > 0 ? + + ` + +${g.pending_count} + +` + + : 0} + +
+${item.before_image ? + + `` + + : 'No Image'} +${item.complaint_created_date || ''}${item.complaint_street_name || ''} +${item.after_image ? + + `` + + : 'Pending'} +${item.completion_date || 'Pending'}${item.completion_street_name || 'Pending'}
${row.complaint_name || ''} - ${row.complaint_created_date || ''}${row.total_complaint_closed_count || 0} + +${row.total_complaint_closed_count > 0 + + ? ` + +${row.total_complaint_closed_count} + +` + + : 0} + + + +${row.total_complaint_pending_count > 0 + + ? ` + +${row.total_complaint_pending_count} + +` + + : 0} -${row.total_complaint_pending_count || 0}