diff --git a/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java b/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java index b7267e4..fd59e62 100644 --- a/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java +++ b/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java @@ -20,8 +20,7 @@ public class DataSourceConfig { // private static String host = "localhost:3306"; // private static String dbpassword = "root"; - private static String host = - "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; + private static String host ="gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; private static String dbpassword = "gcc-facial-password"; public static class MyDataSourceConfig { diff --git a/src/main/java/com/gcc/commissionerreview/service/GreenCommitteeService.java b/src/main/java/com/gcc/commissionerreview/service/GreenCommitteeService.java index 3b75f77..e3c5321 100644 --- a/src/main/java/com/gcc/commissionerreview/service/GreenCommitteeService.java +++ b/src/main/java/com/gcc/commissionerreview/service/GreenCommitteeService.java @@ -56,6 +56,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -69,6 +71,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -82,6 +86,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -95,6 +101,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -104,7 +112,7 @@ public class GreenCommitteeService { " WHERE id.ref_id = rd.ref_id AND id.isactive=1 " + " AND ( (rd.reinspection_id IS NULL AND id.reinspection_id IS NULL) " + " OR (rd.reinspection_id=id.reinspection_id) ) " + - " ) = 3 " + + " ) >= 2 " + " THEN 1 ELSE 0 END), 0) AS committee_pending, " + " COALESCE(SUM(CASE WHEN rd.is_withdraw = 1 THEN 1 ELSE 0 END), 0) AS withdrawn, " + @@ -115,8 +123,7 @@ public class GreenCommitteeService { "FROM zone_master zm " + "LEFT JOIN reg_details rd " + - " ON rd.zone = zm.zone_name " + - " AND rd.is_active = 1 "; + " ON rd.zone = zm.zone_name "; StringBuilder sql = new StringBuilder(baseSql); List params = new ArrayList<>(); @@ -155,6 +162,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -168,6 +177,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -181,6 +192,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -194,6 +207,8 @@ public class GreenCommitteeService { " COALESCE(SUM(CASE " + " WHEN rd.ref_id IS NOT NULL " + + " AND rd.is_active = 1 " + + " AND rd.is_delete = 0 " + " AND rd.is_withdraw = 0 " + " AND rd.ref_id NOT IN (SELECT ref_id FROM committee_data WHERE isactive=1) " + " AND rd.ref_id NOT IN (SELECT ref_id FROM reinspection WHERE isactive=1) " + @@ -203,7 +218,7 @@ public class GreenCommitteeService { " WHERE id.ref_id = rd.ref_id AND id.isactive=1 " + " AND ( (rd.reinspection_id IS NULL AND id.reinspection_id IS NULL) " + " OR (rd.reinspection_id = id.reinspection_id) ) " + - " ) = 3 " + + " ) >= 2 " + " THEN 1 ELSE 0 END), 0) AS committee_pending, " + " COALESCE(SUM(CASE WHEN rd.is_withdraw=1 THEN 1 ELSE 0 END), 0) AS withdrawn, " + @@ -215,8 +230,7 @@ public class GreenCommitteeService { "FROM ward_master wm " + "JOIN zone_master zm ON zm.id = wm.zone_id AND zm.zone_name = ? " + "LEFT JOIN reg_details rd " + - " ON rd.ward = wm.ward_name " + - " AND rd.is_active = 1 "; + " ON rd.ward = wm.ward_name "; StringBuilder sql = new StringBuilder(baseSql); List params = new ArrayList<>(); @@ -331,6 +345,8 @@ public class GreenCommitteeService { sql.append(" AND DATE(rd.cdate) <= ? "); params.add(endDate); } + + System.out.println("sql="+sql); return jdbcTemplate.query( sql.toString(), @@ -349,7 +365,7 @@ public class GreenCommitteeService { // 1 — Application details Map app = jdbcTemplate.queryForMap( - "SELECT *,DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as r_Cdate,IFNULL(reinspection_id, '') AS com_reinspection_id FROM reg_details WHERE ref_id=? AND is_active=1", + "SELECT *,DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as r_Cdate,IFNULL(reinspection_id, '') AS com_reinspection_id,DATE_FORMAT(withdraw_date, '%d-%m-%Y %l:%i %p') as withdraw_Cdate FROM reg_details WHERE ref_id=? ", refId ); diff --git a/src/main/resources/templates/modules/greencommittee/gcreport.html b/src/main/resources/templates/modules/greencommittee/gcreport.html index 1689172..132f99e 100644 --- a/src/main/resources/templates/modules/greencommittee/gcreport.html +++ b/src/main/resources/templates/modules/greencommittee/gcreport.html @@ -562,7 +562,7 @@ function openPendingModal(zone, ward, type, startDate, endDate, level) { - console.log("data="+zone+","+ward+","+startDate+","+endDate); + console.log("data="+zone+","+ward+","+startDate+","+endDate+",type="+type); $('#pendingModal').modal('show'); $('#pendingModalTitle').text( @@ -585,6 +585,7 @@ $('#pageLoader').hide(); if (res.status === 'Success' && res.data.length > 0) { + console.log("res.data="+res.data); renderComplaintCards(res.data); } else { $('#pendingModalBody').html( @@ -611,7 +612,7 @@ item.p_name && item.p_name.trim() !== '' ? item.p_name : [item.dept_name, item.designation].filter(Boolean).join(' - ') || '-'; - + html += `
@@ -635,6 +636,16 @@

Address: ${item.address}

Remarks: ${item.remarks}

Complaints: ${item.comp_details}

+ ${ + (item.withdraw_remarks && item.withdraw_remarks.trim() !== '') || + (item.withdraw_Cdate && item.withdraw_Cdate.trim() !== '') + ? ` +
+

Withdraw Remarks: ${item.withdraw_remarks || '-'}

+

Withdraw Date: ${item.withdraw_Cdate || '-'}

+ ` + : '' + }