diff --git a/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java b/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java index ba66e14..e97a57a 100644 --- a/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java +++ b/src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java @@ -597,7 +597,7 @@ public class IeComplaintsService { sql.append("ON zm.zone_name = cd.zone "); sql.append("AND cd.is_delete = 0 "); sql.append("AND cd.is_active = 1 "); - sql.append("AND cd.complaint_id IN (4,6,12) "); + sql.append("AND cd.complaint_id IN (3,4,6,12) "); if (complaintId != null) { @@ -712,15 +712,16 @@ public class IeComplaintsService { String complaintId, String fromDate, String toDate) { - System.out.println("zone:" + zone); - System.out.println("complaintId:" + complaintId); - System.out.println("fromDate:" + fromDate); - System.out.println("toDate:" + toDate); Map response = new HashMap<>(); try { + System.out.println("zone:" + zone); + System.out.println("complaintId:" + complaintId); + System.out.println("fromDate:" + fromDate); + System.out.println("toDate:" + toDate); + StringBuilder sql = new StringBuilder(); List params = new ArrayList<>(); @@ -730,10 +731,41 @@ public class IeComplaintsService { // TOTAL sql.append("COUNT(DISTINCT cd.ref_id) AS total_count, "); - // COMPLETED = VERIFIED + // VENDOR PENDING + sql.append("COUNT(DISTINCT CASE "); + sql.append("WHEN cd.status IN ('pending') "); + + sql.append("THEN cd.ref_id END) AS vendor_pending_count, "); + + // IE PENDING = COMPLETED + sql.append("COUNT(DISTINCT CASE "); + sql.append("WHEN cd.status IN ('completed') "); + + sql.append("THEN cd.ref_id END) AS ie_pending_count, "); + + // COMPLETED sql.append("COUNT(DISTINCT CASE "); sql.append("WHEN cd.status = 'verified' "); + sql.append("THEN cd.ref_id END) AS completed_count "); + + sql.append("FROM gcc_street_vendor.ward_master wm "); + + sql.append("LEFT JOIN complaint_details cd "); + sql.append("ON wm.ward_name = cd.ward "); + sql.append("AND cd.zone = ? "); + params.add(zone); + + sql.append("AND cd.is_delete = 0 "); + sql.append("AND cd.is_active = 1 "); + sql.append("AND cd.complaint_id IN (3,4,6,12) "); + + if (complaintId != null && !complaintId.isEmpty()) { + + sql.append("AND cd.complaint_id = ? "); + params.add(complaintId); + } + if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { @@ -742,6 +774,55 @@ public class IeComplaintsService { params.add(toDate); } + sql.append("WHERE wm.zone_id = ? "); + params.add(zone); + + sql.append("GROUP BY wm.ward_name "); + sql.append("ORDER BY wm.ward_name "); + + List> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); + + response.put("status", "Success"); + response.put("data", result); + + } catch (Exception e) { + + e.printStackTrace(); + + response.put("status", "Error"); + response.put("message", e.getMessage()); + } + + return response; + } + + public Map getvendorWardActivitywithoutvendorpendingandiepending( + String zone, + String complaintId, + String fromDate, + String toDate) { + System.out.println("zone:" + zone); + System.out.println("complaintId:" + complaintId); + System.out.println("fromDate:" + fromDate); + System.out.println("toDate:" + toDate); + + Map response = new HashMap<>(); + + try { + + StringBuilder sql = new StringBuilder(); + List params = new ArrayList<>(); + + sql.append("SELECT "); + sql.append("wm.ward_name AS ward, "); + + // TOTAL + sql.append("COUNT(DISTINCT cd.ref_id) AS total_count, "); + + // COMPLETED = VERIFIED + sql.append("COUNT(DISTINCT CASE "); + sql.append("WHEN cd.status = 'verified' "); + sql.append("THEN cd.ref_id END) AS completed_count, "); // PENDING = PENDING + COMPLETED @@ -899,7 +980,7 @@ public class IeComplaintsService { sql.append( "CASE " + "WHEN cd.status = 'verified' THEN 'Completed' " + - "WHEN cd.status IN ('pending','completed') THEN 'Pending' " + + "WHEN cd.status IN ('completed') THEN 'Pending' " + "ELSE cd.status " + "END AS ie_status, "); @@ -984,7 +1065,7 @@ public class IeComplaintsService { sql.append("AND cd.is_delete = 0 "); sql.append("AND cd.is_active = 1 "); - sql.append("AND cd.complaint_id IN (4,6,12) "); + sql.append("AND cd.complaint_id IN (3,4,6,12) "); if (complaintId != null && !complaintId.isEmpty()) { @@ -1001,8 +1082,12 @@ public class IeComplaintsService { } else if (status.equalsIgnoreCase("pending")) { - sql.append("AND cd.status IN ('pending','completed') "); + sql.append("AND cd.status IN ('pending') "); + } else if (status.equalsIgnoreCase("completed")) { + + sql.append("AND cd.status IN ('completed') "); } + } if (fromDate != null && !fromDate.isEmpty() @@ -1180,7 +1265,7 @@ public class IeComplaintsService { sql.append("LEFT JOIN complaint_details cd "); sql.append("ON cm.complaint_id = cd.complaint_id "); - sql.append("WHERE cm.complaint_id IN (4,6,12) "); + sql.append("WHERE cm.complaint_id IN (3,4,6,12) "); sql.append("GROUP BY cm.complaint_id, cm.complaint_name "); diff --git a/src/main/java/com/gcc/commissionerreview/service/TenementService.java b/src/main/java/com/gcc/commissionerreview/service/TenementService.java index ea5b3b1..f8de61d 100644 --- a/src/main/java/com/gcc/commissionerreview/service/TenementService.java +++ b/src/main/java/com/gcc/commissionerreview/service/TenementService.java @@ -427,9 +427,14 @@ public class TenementService { sql.append("AS total_complaint_closed_count, "); sql.append("COUNT(DISTINCT CASE "); - sql.append("WHEN il1.final_status IN ('created','completed') "); + sql.append("WHEN il1.final_status = 'created' "); sql.append("THEN il1.id END) "); - sql.append("AS total_complaint_pending_count "); + sql.append("AS total_complaint_vendor_pending_count, "); + + sql.append("COUNT(DISTINCT CASE "); + sql.append("WHEN il1.final_status = 'completed' "); + sql.append("THEN il1.id END) "); + sql.append("AS total_complaint_ie_pending_count "); sql.append("FROM gcc_street_vendor.ward_master wm "); @@ -579,13 +584,18 @@ public class TenementService { sql.append("COUNT(DISTINCT CASE "); sql.append("WHEN il1.final_status = 'verified' "); sql.append("THEN il1.id END) "); - sql.append("AS total_complaint_closed_count, "); + sql.append("AS total_complaint_verified_count, "); // PENDING = CREATED + COMPLETED sql.append("COUNT(DISTINCT CASE "); - sql.append("WHEN il1.final_status IN ('created','completed') "); + sql.append("WHEN il1.final_status IN ('created') "); sql.append("THEN il1.id END) "); - sql.append("AS total_complaint_pending_count "); + sql.append("AS total_complaint_vendor_pending_count, "); + + sql.append("COUNT(DISTINCT CASE "); + sql.append("WHEN il1.final_status IN ('completed') "); + sql.append("THEN il1.id END) "); + sql.append("AS total_complaint_ie_pending_count "); sql.append("FROM asset_master am "); @@ -829,11 +839,16 @@ public class TenementService { sql.append("AND il1.final_status = 'verified' "); - } else if ("pending".equalsIgnoreCase(status)) { + } else if ("created".equalsIgnoreCase(status)) { - sql.append( - "AND il1.final_status IN ('created','completed') "); + sql.append("AND il1.final_status = 'created' "); } + + else if ("completed".equalsIgnoreCase(status)) { + + sql.append("AND il1.final_status = 'completed' "); + } + } sql.append("ORDER BY il1.id DESC "); diff --git a/src/main/resources/templates/modules/pet/petreport.html b/src/main/resources/templates/modules/pet/petreport.html index 3d6d1d1..b294943 100644 --- a/src/main/resources/templates/modules/pet/petreport.html +++ b/src/main/resources/templates/modules/pet/petreport.html @@ -1079,10 +1079,11 @@ // 🔹 Make table use full width doc.content[1].table.widths = [ - '25%', // Ward - '25%', // Total - '25%', // Approved - '25%' // Pending + '20%', // Ward + '20%', // Total + '20%', // Approved + '20%', // Pending + '20%' // Rejected ]; // 🔹 Reduce margins to gain width diff --git a/src/main/resources/templates/modules/vendorreport.html b/src/main/resources/templates/modules/vendorreport.html index bad2a89..6a20cbe 100644 --- a/src/main/resources/templates/modules/vendorreport.html +++ b/src/main/resources/templates/modules/vendorreport.html @@ -106,6 +106,81 @@ } } + + /* Sweeping */ + #zoneTable tbody td:nth-child(2), + #zoneTable tbody td:nth-child(3), + #zoneTable tbody td:nth-child(4) { + background-color: #f8f9fa; + } + + /* Hotspot - Dark */ + #zoneTable tbody td:nth-child(5), + #zoneTable tbody td:nth-child(6), + #zoneTable tbody td:nth-child(7) { + background-color: #E1ECFC; + } + + /* RC Bin Overflow */ + #zoneTable tbody td:nth-child(8), + #zoneTable tbody td:nth-child(9), + #zoneTable tbody td:nth-child(10) { + background-color: #f8f9fa; + } + + /* Unauthorized Garbage Dumping - Dark */ + #zoneTable tbody td:nth-child(11), + #zoneTable tbody td:nth-child(12), + #zoneTable tbody td:nth-child(13) { + background-color: #E1ECFC; + } + + /* Tenement */ + #zoneTable tbody td:nth-child(14), + #zoneTable tbody td:nth-child(15), + #zoneTable tbody td:nth-child(16) { + background-color: #f8f9fa; + } + + /* Sweeping */ + #wardTable tbody td:nth-child(2), + #wardTable tbody td:nth-child(3), + #wardTable tbody td:nth-child(4), + #wardTable tbody td:nth-child(5) { + background-color: #f8f9fa; + } + + /* Hotspot */ + #wardTable tbody td:nth-child(6), + #wardTable tbody td:nth-child(7), + #wardTable tbody td:nth-child(8), + #wardTable tbody td:nth-child(9) { + background-color: #E1ECFC; + } + + /* RC Bin Overflow */ + #wardTable tbody td:nth-child(10), + #wardTable tbody td:nth-child(11), + #wardTable tbody td:nth-child(12), + #wardTable tbody td:nth-child(13) { + background-color: #f8f9fa; + } + + /* Unauthorized Garbage Dumping */ + #wardTable tbody td:nth-child(14), + #wardTable tbody td:nth-child(15), + #wardTable tbody td:nth-child(16), + #wardTable tbody td:nth-child(17) { + background-color: #E1ECFC; + } + + /* Tenement */ + #wardTable tbody td:nth-child(18), + #wardTable tbody td:nth-child(19), + #wardTable tbody td:nth-child(20), + #wardTable tbody td:nth-child(21) { + background-color: #f8f9fa; + } @@ -200,6 +275,9 @@ Zone + + Sweeping + @@ -225,6 +303,11 @@ + + Complaints + Completed + Pending + Complaints Completed @@ -272,32 +355,49 @@ Ward + + Sweeping - Hotspot + Hotspot - RC Bin Overflow + RC Bin Overflow - Unauthorized garbage dumping + Unauthorized garbage dumping - Tenement + Tenement + + Total + Completed + Vendor Pending + IE Pending + Total Completed - Pending + Vendor Pending + IE Pending + Total Completed - Pending + Vendor Pending + IE Pending + Total Completed - Pending + Vendor Pending + IE Pending + Total Completed - Pending + Vendor Pending + IE Pending + + @@ -378,7 +478,8 @@ Scheme Name Total Completed - Pending + Vendor Pending + IE Pending @@ -771,6 +872,14 @@ ${wardCell} let toDate = $("#toDate").val(); $.when( + // SWEeping + $.get("/commissionerreview/api/iecomplaints/vendorzoneActivity", { + + fromDate: fromDate, + toDate: toDate, + complaintId: 3 + + }), // HOTSPOT $.get("/commissionerreview/api/iecomplaints/vendorzoneActivity", { @@ -809,6 +918,7 @@ ${wardCell} ).done(function ( + sweepingRes, hotspotRes, transportRes, garbageRes, @@ -816,6 +926,7 @@ ${wardCell} ) { + let sweepingData = sweepingRes[0].data || []; let hotspotData = hotspotRes[0].data || []; let transportData = transportRes[0].data || []; let garbageData = garbageRes[0].data || []; @@ -830,11 +941,17 @@ ${wardCell} $("#zoneTable tbody").empty(); // maps + let sweepingMap = {}; let hotspotMap = {}; let transportMap = {}; let garbageMap = {}; let tenementMap = {}; + sweepingData.forEach(item => { + + sweepingMap[item.zone_name] = item; + }); + hotspotData.forEach(item => { hotspotMap[item.zone_name] = item; @@ -903,6 +1020,7 @@ ${wardCell} let h = hotspotMap[zone] || {}; let t = transportMap[zone] || {}; let g = garbageMap[zone] || {}; + let s = sweepingMap[zone] || {}; let ten = tenementMap[zone] || { @@ -918,11 +1036,13 @@ ${wardCell} + ${( g.total_count > 0 || h.total_count > 0 || t.total_count > 0 || + s.total_count > 0 || ten.total > 0 ) @@ -943,6 +1063,12 @@ ${( + + +${s.total_count || 0} +${s.completed_count || 0} +${s.pending_count || 0} + ${h.total_count || 0} @@ -1215,6 +1341,16 @@ ${( $.when( + // SWEEPING + $.get("/commissionerreview/api/iecomplaints/vendorwardActivity", { + + zone: zone, + complaintId: 3, + fromDate: fromDate, + toDate: toDate + + }), + // HOTSPOT $.get("/commissionerreview/api/iecomplaints/vendorwardActivity", { @@ -1255,7 +1391,7 @@ ${( }) ).done(function ( - + sweepingRes, hotspotRes, transportRes, garbageRes, @@ -1263,6 +1399,7 @@ ${( ) { + let sweepingData = sweepingRes[0].data || []; let hotspotData = hotspotRes[0].data || []; let transportData = transportRes[0].data || []; let garbageData = garbageRes[0].data || []; @@ -1271,12 +1408,13 @@ ${( let html = ""; let maxLength = Math.max( - + sweepingData.length, hotspotData.length, transportData.length, garbageData.length, tenementData.length ); + console.log("SWEEPING DATA", sweepingData); console.log("HOTSPOT DATA", hotspotData); console.log("TRANSPORT DATA", transportData); console.log("GARBAGE DATA", garbageData); @@ -1296,12 +1434,14 @@ ${( for (let i = 0; i < maxLength; i++) { + let s = sweepingData[i] || {}; let h = hotspotData[i] || {}; let t = transportData[i] || {}; let g = garbageData[i] || {}; let ten = tenementData[i] || {}; let ward = + s.ward || h.ward || t.ward || g.ward || @@ -1317,6 +1457,62 @@ ${( ${displayWard} + + + +${s.total_count > 0 ? + + ` + + ${s.total_count} + ` + + : 0} + + + + +${s.completed_count > 0 ? + + ` + + ${s.completed_count} + ` + + : 0} + + + + + +${s.vendor_pending_count > 0 ? + + ` + + ${s.vendor_pending_count} + ` + + : 0} + + + + + +${s.ie_pending_count > 0 ? + + ` + + ${s.ie_pending_count} + ` + + : 0} + + + @@ -1441,12 +1654,12 @@ ${t.completed_count} -${t.pending_count > 0 ? +${t.vendor_pending_count > 0 ? ` -${t.pending_count} +${t.vendor_pending_count} ` @@ -1454,8 +1667,23 @@ ${t.pending_count} + + +${t.ie_pending_count > 0 ? + + + ` + +${t.ie_pending_count} + +` + + : 0} + + @@ -1544,7 +1787,9 @@ ${ten.total_complaint_count} ${ten.total_complaint_closed_count || 0} -${ten.total_complaint_pending_count || 0} +${ten.total_complaint_vendor_pending_count || 0} +${ten.total_complaint_ie_pending_count || 0} + `; @@ -2108,7 +2353,7 @@ height="80">` -${row.total_complaint_closed_count > 0 +${row.total_complaint_verified_count > 0 ? ` -${row.total_complaint_closed_count} +${row.total_complaint_verified_count} ` @@ -2127,7 +2372,7 @@ ${row.total_complaint_closed_count} - + + + + +${row.total_complaint_vendor_pending_count > 0 + + ? ` + +${row.total_complaint_vendor_pending_count} + +` + + : 0} + + + + + +${row.total_complaint_ie_pending_count > 0 + + ? ` + +${row.total_complaint_ie_pending_count} + ` : 0} + `; } @@ -2444,7 +2728,7 @@ ${w.ward} let total = Number(z.completed_count) + Number(z.pending_count); let zoneCell = total > 0 - ? `${z.zone_name}` + ? `${z.zone_name}` : `${z.zone_name}`; html += `