Browse Source

implemented child survey and green commitee changes

master
AJITHKUMAR12 3 months ago
parent
commit
684abcf800
  1. 75
      src/main/java/in/gov/chennaicorporation/gccoffice/childrensurvey/Service/ChildrenSurveyService.java
  2. 10
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
  3. 5
      src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/controller/PendinglistApicontroller.java
  4. 30
      src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/service/PendinglistService.java
  5. 234
      src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/service/ReportService.java
  6. 342
      src/main/resources/templates/modules/childrensurvey/childlist.html
  7. 111
      src/main/resources/templates/modules/childrensurvey/surveylist.html
  8. 26
      src/main/resources/templates/modules/greencommittee/pendinglist.html
  9. 461
      src/main/resources/templates/modules/greencommittee/treepruningreports.html
  10. 1900
      src/main/resources/templates/modules/roadwar/regform.html
  11. 6326
      src/main/resources/templates/modules/roadwar/updateform.html

75
src/main/java/in/gov/chennaicorporation/gccoffice/childrensurvey/Service/ChildrenSurveyService.java

@ -263,6 +263,26 @@ public class ChildrenSurveyService {
masterTable, masterTable,
rawAnswer, rawAnswer,
othersAnswer); othersAnswer);
if (qid == 58) {
personalInfo.put(question, finalAnswer);
int count = 0;
try {
count = Integer.parseInt(finalAnswer);
} catch (Exception e) {
}
if (count > 0) {
finalResponse.put(
"familyMembers",
getFamilyMembers(surveyId));
}
continue;
}
// PERSONAL INFORMATION // PERSONAL INFORMATION
/* /*
@ -530,6 +550,61 @@ public class ChildrenSurveyService {
return rawAnswer; return rawAnswer;
} }
private List<Map<String, Object>> getFamilyMembers(String surveyId) {
String sql = """
SELECT
fm.id,
fm.qid,
fm.answer,
qm.q_english
FROM child_survey_response_family_members fm
INNER JOIN child_survey_questions_master qm
ON qm.qid = fm.qid
WHERE fm.survey_id = ?
AND fm.isactive = 1
AND fm.isdelete = 0
ORDER BY fm.id
""";
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, surveyId);
List<Map<String, Object>> members = new ArrayList<>();
Map<String, Object> member = null;
for (Map<String, Object> row : rows) {
Integer qid = ((Number) row.get("qid")).intValue();
String question = row.get("q_english").toString();
String answer = row.get("answer") == null
? ""
: row.get("answer").toString();
// Every Name starts a new member
if (qid == 6) {
if (member != null) {
members.add(member);
}
member = new LinkedHashMap<>();
}
if (member != null) {
member.put(question, answer);
}
}
if (member != null) {
members.add(member);
}
return members;
}
private String resolveAnswer1( private String resolveAnswer1(
String questionType, String questionType,
String masterTable, String masterTable,

10
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java

@ -24,8 +24,8 @@ import java.util.Properties;
@EnableTransactionManagement @EnableTransactionManagement
public class DataSourceConfig { public class DataSourceConfig {
// private static String host = "localhost:3306";
// private static String dbpassword = "root";
// private static String host = "localhost:3306";
// private static String dbpassword = "root";
// private static String dbpassword = "gccroot"; // private static String dbpassword = "gccroot";
@ -430,7 +430,7 @@ public class DataSourceConfig {
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
/////////////// Bulk Waste Generator ///////////////////// /////////////// Bulk Waste Generator /////////////////////
@Bean(name = "mysqlBulkWasteDataSource") @Bean(name = "mysqlBulkWasteDataSource")
public DataSource mysqlBulkWasteDataSource() { public DataSource mysqlBulkWasteDataSource() {
@ -441,8 +441,8 @@ public class DataSourceConfig {
dataSource.setPassword(dbpassword); dataSource.setPassword(dbpassword);
return dataSource; return dataSource;
} }
//////////////////////////////(For GCC USER) ////////////////////////
////////////////////////////// (For GCC USER) ////////////////////////
@Bean(name = "mysqlGCCUserDataSource") @Bean(name = "mysqlGCCUserDataSource")
public DataSource mysqlGCCUserDataSource() { public DataSource mysqlGCCUserDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();

5
src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/controller/PendinglistApicontroller.java

@ -94,9 +94,10 @@ public class PendinglistApicontroller {
@GetMapping("/getgreencommitteelist") @GetMapping("/getgreencommitteelist")
public List<Map<String, Object>> getgreencommitteelist( public List<Map<String, Object>> getgreencommitteelist(
@RequestParam String date, @RequestParam String zones) {
@RequestParam String date, @RequestParam String zones, @RequestParam String appType,
@RequestParam String compType) {
List<Map<String, Object>> refnums = pendinglistService.getrefnums(date, zones);
List<Map<String, Object>> refnums = pendinglistService.getrefnums(date, zones, appType, compType);
System.out.println("refnums=" + refnums); System.out.println("refnums=" + refnums);
List<Map<String, Object>> savedIds = pendinglistService.getvcsavedrefids(); List<Map<String, Object>> savedIds = pendinglistService.getvcsavedrefids();
System.out.println("savedIds=" + savedIds); System.out.println("savedIds=" + savedIds);

30
src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/service/PendinglistService.java

@ -109,7 +109,7 @@ public class PendinglistService {
// } // }
// } // }
public List<Map<String, Object>> getrefnums(String date, String zones) {
public List<Map<String, Object>> getrefnums(String date, String zones, String appType, String compType) {
System.out.println(date + " " + zones); System.out.println(date + " " + zones);
try { try {
@ -132,6 +132,34 @@ public class PendinglistService {
sql.append(" AND zone = ? "); sql.append(" AND zone = ? ");
params.add(zones); params.add(zones);
} }
if (appType != null && !appType.isEmpty()) {
sql.append(
" AND ref_id IN ( " +
" SELECT ref_id FROM reg_details WHERE cby = ? " +
" ) ");
params.add(appType);
}
if (compType != null && !compType.isEmpty()) {
if ("Felling".equalsIgnoreCase(compType)) {
sql.append(
" AND ref_id IN ( " +
" SELECT ref_id " +
" FROM complaint_details " +
" WHERE comp_nature_id IN (2,4) " +
" ) ");
} else if ("Transplantation".equalsIgnoreCase(compType)) {
sql.append(
" AND ref_id IN ( " +
" SELECT ref_id " +
" FROM complaint_details " +
" WHERE comp_nature_id IN (5,6) " +
" ) ");
}
}
sql.append( sql.append(
" GROUP BY ref_id, inspection_by " + " GROUP BY ref_id, inspection_by " +

234
src/main/java/in/gov/chennaicorporation/gccoffice/greencommittee/service/ReportService.java

@ -575,7 +575,130 @@ public class ReportService {
} }
public List<Map<String, Object>> getReport(
/*
* public List<Map<String, Object>> getReport(
* String fromDate,
* String toDate,
* String zone,
* String ward,
* String status) {
*
* List<Map<String, Object>> result = new ArrayList<>();
*
* try {
*
* String externalUrl =
* "https://erp.chennaicorporation.gov.in/pgr/newmobileservice";
*
* StringBuilder url = new StringBuilder(externalUrl);
*
* url.append("?serviceId=ms_dashboard_details");
*
* // Mandatory
* url.append("&From_date=").append(URLEncoder.encode(fromDate, "UTF-8"));
* url.append("&To_date=").append(URLEncoder.encode(toDate, "UTF-8"));
* url.append("&jsonResp=Yes");
*
* // Status
* if (status == null || status.trim().isEmpty()) {
* url.append("&Status=total");
* } else if ("processing".equalsIgnoreCase(status)) {
* url.append("&Status=processing,redressed");
* } else {
* url.append("&Status=").append(URLEncoder.encode(status, "UTF-8"));
* }
*
* // Mandatory Parameters
* url.append("&isQcuser=Yes");
* url.append("&ComplaintType=")
* .append(URLEncoder.encode("Tree Pruning", "UTF-8"));
*
* url.append("&ComplaintGroupId=")
* .append(URLEncoder.encode("Park and Playground", "UTF-8"));
*
* // Zone
* if (zone != null && !zone.trim().isEmpty()) {
* url.append("&Zoneid=N")
* .append(String.format("%02d", Integer.parseInt(zone)));
* } else {
* url.append("&Zoneid=");
* }
*
* // Mandatory blank
* url.append("&RegionId=");
*
* // Ward
* if (ward != null && !ward.trim().isEmpty()) {
* url.append("&WardId=N")
* .append(String.format("%03d", Integer.parseInt(ward)));
* } else {
* url.append("&WardId=");
* }
*
* System.out.println("======================================");
* System.out.println("Calling URL:");
* System.out.println(url.toString());
* System.out.println("======================================");
*
* URL api = new URL(url.toString());
*
* HttpURLConnection conn = (HttpURLConnection) api.openConnection();
* conn.setRequestMethod("GET");
* conn.setRequestProperty("Accept", "application/json");
*
* int responseCode = conn.getResponseCode();
*
* System.out.println("Response Code : " + responseCode);
*
* BufferedReader br;
*
* if (responseCode >= 200 && responseCode < 300) {
* br = new BufferedReader(
* new InputStreamReader(conn.getInputStream()));
* } else {
* br = new BufferedReader(
* new InputStreamReader(conn.getErrorStream()));
* }
*
* StringBuilder response = new StringBuilder();
*
* String line;
*
* while ((line = br.readLine()) != null) {
* response.append(line);
* }
*
* br.close();
*
* System.out.println("API Response:");
* System.out.println(response.toString());
*
* ObjectMapper mapper = new ObjectMapper();
*
* JsonNode root = mapper.readTree(response.toString());
*
* JsonNode details = root.get("Details");
*
* if (details != null && details.isArray()) {
*
* result = mapper.convertValue(
* details,
* new TypeReference<List<Map<String, Object>>>() {
* });
*
* }
*
* } catch (Exception e) {
*
* e.printStackTrace();
*
* }
*
* return result;
* }
*/
private List<Map<String, Object>> callApi(
String fromDate, String fromDate,
String toDate, String toDate,
String zone, String zone,
@ -592,20 +715,17 @@ public class ReportService {
url.append("?serviceId=ms_dashboard_details"); url.append("?serviceId=ms_dashboard_details");
// Mandatory
url.append("&From_date=").append(URLEncoder.encode(fromDate, "UTF-8")); url.append("&From_date=").append(URLEncoder.encode(fromDate, "UTF-8"));
url.append("&To_date=").append(URLEncoder.encode(toDate, "UTF-8")); url.append("&To_date=").append(URLEncoder.encode(toDate, "UTF-8"));
url.append("&jsonResp=Yes"); url.append("&jsonResp=Yes");
// Status // Status
if (status == null || status.trim().isEmpty()) {
url.append("&Status=total");
} else {
url.append("&Status=").append(URLEncoder.encode(status, "UTF-8"));
}
url.append("&Status=").append(URLEncoder.encode(status, "UTF-8"));
// Mandatory Parameters
// Mandatory
url.append("&isQcuser=Yes"); url.append("&isQcuser=Yes");
url.append("&ComplaintType=") url.append("&ComplaintType=")
.append(URLEncoder.encode("Tree Pruning", "UTF-8")); .append(URLEncoder.encode("Tree Pruning", "UTF-8"));
@ -614,31 +734,42 @@ public class ReportService {
// Zone // Zone
if (zone != null && !zone.trim().isEmpty()) { if (zone != null && !zone.trim().isEmpty()) {
url.append("&Zoneid=N") url.append("&Zoneid=N")
.append(String.format("%02d", Integer.parseInt(zone)));
.append(String.format("%02d",
Integer.parseInt(zone)));
} else { } else {
url.append("&Zoneid="); url.append("&Zoneid=");
} }
// Mandatory blank
// Region
url.append("&RegionId="); url.append("&RegionId=");
// Ward // Ward
if (ward != null && !ward.trim().isEmpty()) { if (ward != null && !ward.trim().isEmpty()) {
url.append("&WardId=N") url.append("&WardId=N")
.append(String.format("%03d", Integer.parseInt(ward)));
.append(String.format("%03d",
Integer.parseInt(ward)));
} else { } else {
url.append("&WardId="); url.append("&WardId=");
} }
System.out.println("======================================");
System.out.println("Calling URL:");
System.out.println("-----------------------------------");
System.out.println("Calling API");
System.out.println(url.toString()); System.out.println(url.toString());
System.out.println("======================================");
System.out.println("-----------------------------------");
URL api = new URL(url.toString()); URL api = new URL(url.toString());
HttpURLConnection conn = (HttpURLConnection) api.openConnection(); HttpURLConnection conn = (HttpURLConnection) api.openConnection();
conn.setRequestMethod("GET"); conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Accept", "application/json");
@ -649,11 +780,15 @@ public class ReportService {
BufferedReader br; BufferedReader br;
if (responseCode >= 200 && responseCode < 300) { if (responseCode >= 200 && responseCode < 300) {
br = new BufferedReader( br = new BufferedReader(
new InputStreamReader(conn.getInputStream())); new InputStreamReader(conn.getInputStream()));
} else { } else {
br = new BufferedReader( br = new BufferedReader(
new InputStreamReader(conn.getErrorStream())); new InputStreamReader(conn.getErrorStream()));
} }
StringBuilder response = new StringBuilder(); StringBuilder response = new StringBuilder();
@ -661,13 +796,14 @@ public class ReportService {
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
response.append(line); response.append(line);
} }
br.close(); br.close();
System.out.println("API Response:");
System.out.println(response.toString());
System.out.println(response);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
@ -675,6 +811,16 @@ public class ReportService {
JsonNode details = root.get("Details"); JsonNode details = root.get("Details");
/*
* if (details != null && details.isArray()) {
*
* result = mapper.convertValue(
* details,
* new TypeReference<List<Map<String, Object>>>() {
* });
*
* }
*/
if (details != null && details.isArray()) { if (details != null && details.isArray()) {
result = mapper.convertValue( result = mapper.convertValue(
@ -682,6 +828,18 @@ public class ReportService {
new TypeReference<List<Map<String, Object>>>() { new TypeReference<List<Map<String, Object>>>() {
}); });
// Get latest status from complaint details API
for (Map<String, Object> row : result) {
String complaintNo = String.valueOf(row.get("Complaint Number"));
Map<String, Object> complaintDetails = getComplaintDetailsreport(complaintNo);
if (!complaintDetails.isEmpty()) {
row.put("complaintcurrentstatus",
complaintDetails.get("complaintcurrentstatus"));
}
}
} }
} catch (Exception e) { } catch (Exception e) {
@ -693,6 +851,50 @@ public class ReportService {
return result; return result;
} }
public List<Map<String, Object>> getReport(
String fromDate,
String toDate,
String zone,
String ward,
String status) {
List<Map<String, Object>> result = new ArrayList<>();
try {
if (status == null || status.trim().isEmpty()) {
// Default
result = callApi(fromDate, toDate, zone, ward, "total");
} else if ("processing".equalsIgnoreCase(status)) {
// Fetch Processing
result.addAll(callApi(fromDate, toDate, zone, ward, "processing"));
// Fetch Redressed
result.addAll(callApi(fromDate, toDate, zone, ward, "redressed"));
} else if ("closed".equalsIgnoreCase(status)) {
// Completed
// result = callApi(fromDate, toDate, zone, ward, status);
result.addAll(callApi(fromDate, toDate, zone, ward, "completed"));
// Fetch Redressed
result.addAll(callApi(fromDate, toDate, zone, ward, "closed"));
} else {
result = callApi(fromDate, toDate, zone, ward, status);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public Map<String, Object> getComplaintDetailsreport(String complaintId) { public Map<String, Object> getComplaintDetailsreport(String complaintId) {
try { try {

342
src/main/resources/templates/modules/childrensurvey/childlist.html

@ -544,14 +544,18 @@
let slno = 1; let slno = 1;
/*for (const rowNode of rows) {
// GET SURVEY ID FROM TABLE
for (const rowNode of rows) {
let surveyId = $(rowNode[1]).text() || rowNode[1]; let surveyId = $(rowNode[1]).text() || rowNode[1];
surveyId = surveyId.toString().trim(); surveyId = surveyId.toString().trim();
// CALL DETAILS API
// SKIP EMPTY ROWS
if (!surveyId || surveyId === "") {
continue;
}
let surveyData = await $.ajax({ let surveyData = await $.ajax({
url: "/gcc/api/children-survey/details", url: "/gcc/api/children-survey/details",
type: "GET", type: "GET",
@ -559,58 +563,107 @@
surveyId: surveyId surveyId: surveyId
} }
}); });
// MERGE ALL SECTIONS
let allQuestions = {
...surveyData.personalInformation,
/*let allQuestions = {
...surveyData.locationDetails, ...surveyData.locationDetails,
...surveyData.personalInformation,
...surveyData.educationDetails, ...surveyData.educationDetails,
...surveyData.healthDetails, ...surveyData.healthDetails,
...surveyData.documentDetails, ...surveyData.documentDetails,
...surveyData.vulnerabilityDetails ...surveyData.vulnerabilityDetails
}; };
// CREATE ROW OBJECT
let rowData = { let rowData = {
"S.No": slno, "S.No": slno,
"Survey ID": surveyId "Survey ID": surveyId
}; };
// ADD ALL QUESTIONS AS COLUMNS
Object.keys(allQuestions).forEach(function (question) { Object.keys(allQuestions).forEach(function (question) {
rowData[question] = allQuestions[question]; rowData[question] = allQuestions[question];
}); });
excelData.push(rowData); excelData.push(rowData);
slno++;
}*/
for (const rowNode of rows) {
let surveyId = $(rowNode[1]).text() || rowNode[1];
slno++;*/
/*const familyMembers = surveyData.familyMembers || [];
surveyId = surveyId.toString().trim();
// Common survey data
let commonData = {
...surveyData.locationDetails,
...surveyData.personalInformation,
...surveyData.educationDetails,
...surveyData.healthDetails,
...surveyData.documentDetails,
...surveyData.vulnerabilityDetails
};
// SKIP EMPTY ROWS
if (!surveyId || surveyId === "") {
continue;
}
if (familyMembers.length > 0) {
let surveyData = await $.ajax({
url: "/gcc/api/children-survey/details",
type: "GET",
data: {
surveyId: surveyId
}
});
familyMembers.forEach(function (member) {
let rowData = {
"S.No": slno,
"Survey ID": surveyId
};
// Survey Questions
Object.keys(commonData).forEach(function (question) {
rowData[question] = commonData[question];
});
// Family Member Columns
rowData["Family Member Name"] =
member["Name of the Child "] || "";
rowData["Family Member Age"] =
member["Age"] || "";
rowData["Family Member Relationship"] =
member["Relationship"] || "";
rowData["Family Member Occupation"] =
member["Occupation"] || "";
rowData["Family Member Gender"] =
member["Gender"] || "";
rowData["Family Member Education"] =
member["Education Status"] || "";
let allQuestions = {
excelData.push(rowData);
slno++;
});
} else {
let rowData = {
"S.No": slno,
"Survey ID": surveyId
};
Object.keys(commonData).forEach(function (question) {
rowData[question] = commonData[question];
});
rowData["Family Member Name"] = "";
rowData["Family Member Age"] = "";
rowData["Family Member Relationship"] = "";
rowData["Family Member Occupation"] = "";
rowData["Family Member Gender"] = "";
rowData["Family Member Education"] = "";
excelData.push(rowData);
slno++;*/ const familyMembers = surveyData.familyMembers || [];
let commonData = {
...surveyData.locationDetails, ...surveyData.locationDetails,
...surveyData.personalInformation, ...surveyData.personalInformation,
...surveyData.educationDetails, ...surveyData.educationDetails,
@ -619,15 +672,39 @@
...surveyData.vulnerabilityDetails ...surveyData.vulnerabilityDetails
}; };
// ONLY ONE ROW PER SURVEY
let rowData = { let rowData = {
"S.No": slno, "S.No": slno,
"Survey ID": surveyId "Survey ID": surveyId
}; };
Object.keys(allQuestions).forEach(function (question) {
// Survey Questions
Object.keys(commonData).forEach(function (question) {
rowData[question] = commonData[question];
});
rowData[question] = allQuestions[question];
// Add every family member dynamically
familyMembers.forEach(function (member, index) {
let no = index + 1;
rowData["Family Member " + no + " Name"] =
member["Name of the Child"] || "";
rowData["Family Member " + no + " Age"] =
member["Age"] || "";
rowData["Family Member " + no + " Relationship"] =
member["Relationship"] || "";
rowData["Family Member " + no + " Occupation"] =
member["Occupation"] || "";
rowData["Family Member " + no + " Gender"] =
member["Gender"] || "";
rowData["Family Member " + no + " Education Status"] =
member["Education Status"] || "";
}); });
excelData.push(rowData); excelData.push(rowData);
@ -671,6 +748,14 @@
"Occupation", "Occupation",
"Family Monthly Income", "Family Monthly Income",
"Contact Number", "Contact Number",
/*"How many members are in the Family",
"Below that need to collect below details for Each Family Members",*/
/*"Family Member Name",
"Family Member Age",
"Family Member Relationship",
"Family Member Occupation",
"Family Member Gender",
"Family Member Education",*/
// EDUCATION // EDUCATION
"Are they Currently Studying", "Are they Currently Studying",
@ -686,6 +771,11 @@
"Are you Staying in any Educational Hostel", "Are you Staying in any Educational Hostel",
"Name of the Hostel?", "Name of the Hostel?",
"Location of the Hostel?", "Location of the Hostel?",
/*"Does any family members need job/skill training?",
"Need skill training ?",
"select skill training",
"Job Required?",
"select job",*/
// HEALTH // HEALTH
"Does the child have any history of health issues?", "Does the child have any history of health issues?",
@ -708,8 +798,57 @@
"Vulnerability Assessment", "Vulnerability Assessment",
"Any Other Support Needed?", "Any Other Support Needed?",
"Comments & Remarks", "Comments & Remarks",
"How many members are in the Family",
"Below that need to collect below details for Each Family Members",
"Does any family members need job/skill training?",
"Need skill training ?",
"select skill training",
"Job Required?",
"select job",
]; ];
// Find maximum family members
// Find maximum family members
let maxFamilyMembers = 0;
excelData.forEach(function (row) {
Object.keys(row).forEach(function (key) {
let match = key.match(/^Family Member (\d+) Name$/);
if (match) {
maxFamilyMembers = Math.max(maxFamilyMembers, parseInt(match[1]));
}
});
});
// Find the position after q58
const insertIndex = headers.indexOf(
"Below that need to collect below details for Each Family Members"
) + 1;
// Create dynamic headers
let familyHeaders = [];
for (let i = 1; i <= maxFamilyMembers; i++) {
familyHeaders.push(
"Family Member " + i + " Name",
"Family Member " + i + " Age",
"Family Member " + i + " Gender",
"Family Member " + i + " Relationship",
"Family Member " + i + " Education Status",
"Family Member " + i + " Occupation"
);
}
// Insert after q58
headers.splice(insertIndex, 0, ...familyHeaders);
// CREATE NEW ORDERED DATA // CREATE NEW ORDERED DATA
let orderedExcelData = []; let orderedExcelData = [];
@ -742,11 +881,11 @@
//const columns = []; //const columns = [];
/*Object.keys(excelData[0]).forEach(function () { /*Object.keys(excelData[0]).forEach(function () {
columns.push({ wch: 30 }); columns.push({ wch: 30 });
}); });
worksheet['!cols'] = columns;*/ worksheet['!cols'] = columns;*/
const columns = []; const columns = [];
@ -927,6 +1066,28 @@
"Personal Information", "Personal Information",
data.personalInformation data.personalInformation
); );
html += `
<div id="familyMemberSection" style="display:none;" class="mb-4">
<h5 class="section-heading">
Family Member Details
</h5>
<div class="table-responsive">
<table class="table table-bordered" id="familyTable">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
`;
html += buildSection( html += buildSection(
"Education Details", "Education Details",
@ -949,6 +1110,105 @@
); );
$("#surveyDetails").html(html); $("#surveyDetails").html(html);
//console.log(data);
//console.log(data.familyMembers);
//const members = data.familyMembers;
//console.log($("#familyMemberSection").length);
/*if (members && members.length > 0) {
let headers = Object.keys(members[0]);
let thead = "<tr><th>S.No</th>";
headers.forEach(function (h) {
thead += "<th>" + h + "</th>";
});
thead += "</tr>";
$("#familyTable thead").html(thead);
let tbody = "";
members.forEach(function (member, index) {
tbody += "<tr>";
tbody += "<td>" + (index + 1) + "</td>";
headers.forEach(function (h) {
tbody += "<td>" + (member[h] || "-") + "</td>";
});
tbody += "</tr>";
});
$("#familyTable tbody").html(tbody);
$("#familyMemberSection").show();
} else {
$("#familyMemberSection").hide();
}*/ const members = data.familyMembers;
if (members && members.length > 0) {
let headers = [
"Name of the Child",
"Age",
"Gender",
"Relationship",
"Occupation",
"Education Status"
];
let thead = "<tr><th>S.No</th>";
headers.forEach(function (h) {
let title = h.trim();
thead += "<th>" + title + "</th>";
});
thead += "</tr>";
$("#familyTable thead").html(thead);
let tbody = "";
members.forEach(function (member, index) {
tbody += "<tr>";
tbody += "<td>" + (index + 1) + "</td>";
headers.forEach(function (h) {
tbody += "<td>" + (member[h] || "-") + "</td>";
});
tbody += "</tr>";
});
$("#familyTable tbody").html(tbody);
$("#familyMemberSection").show();
} else {
$("#familyMemberSection").hide();
}
let modal = new bootstrap.Modal( let modal = new bootstrap.Modal(
document.getElementById('surveyModal') document.getElementById('surveyModal')

111
src/main/resources/templates/modules/childrensurvey/surveylist.html

@ -285,41 +285,40 @@
</div> </div>
</div> </div>
<div class="modal fade" id="surveyModal" tabindex="-1">
<div class="modal-dialog modal-dialog-scrollable" style="max-width:70%; width:70%;">
</div>
<div class="modal fade" id="surveyModal" tabindex="-1">
<div class="modal-content">
<div class="modal-dialog modal-dialog-scrollable" style="max-width:70%; width:70%;">
<div class="modal-header">
<div class="modal-content">
<h5 class="modal-title">
Child Survey Details
</h5>
<div class="modal-header">
<button type="button" class="close" data-bs-dismiss="modal">
<h5 class="modal-title">
Child Survey Details
</h5>
&times;
<button type="button" class="close" data-bs-dismiss="modal">
</button>
&times;
</div>
</button>
<div class="modal-body">
</div>
<div id="surveyDetails"></div>
<div class="modal-body">
</div>
<div id="surveyDetails"></div>
<div class="modal-footer">
</div>
<button class="btn btn-secondary" data-bs-dismiss="modal">
<div class="modal-footer">
Close
<button class="btn btn-secondary" data-bs-dismiss="modal">
</button>
Close
</div>
</button>
</div> </div>
@ -328,6 +327,8 @@
</div> </div>
</div> </div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div> </div>
</div> </div>
@ -473,6 +474,8 @@
success: function (data) { success: function (data) {
let html = ""; let html = "";
function buildSection(title, sectionData) { function buildSection(title, sectionData) {
@ -527,6 +530,27 @@
"Personal Information", "Personal Information",
data.personalInformation data.personalInformation
); );
html += `
<div id="familyMemberSection" style="display:none;" class="mb-4">
<h5 class="section-heading">
Family Member Details
</h5>
<div class="table-responsive">
<table class="table table-bordered" id="familyTable">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
`;
@ -551,6 +575,52 @@
); );
$("#surveyDetails").html(html); $("#surveyDetails").html(html);
console.log(data);
console.log(data.familyMembers);
const members = data.familyMembers;
console.log($("#familyMemberSection").length);
if (members && members.length > 0) {
let headers = Object.keys(members[0]);
let thead = "<tr><th>S.No</th>";
headers.forEach(function (h) {
thead += "<th>" + h + "</th>";
});
thead += "</tr>";
$("#familyTable thead").html(thead);
let tbody = "";
members.forEach(function (member, index) {
tbody += "<tr>";
tbody += "<td>" + (index + 1) + "</td>";
headers.forEach(function (h) {
tbody += "<td>" + (member[h] || "") + "</td>";
});
tbody += "</tr>";
});
$("#familyTable tbody").html(tbody);
$("#familyMemberSection").show();
} else {
$("#familyMemberSection").hide();
}
let modal = new bootstrap.Modal( let modal = new bootstrap.Modal(
document.getElementById('surveyModal') document.getElementById('surveyModal')
@ -872,6 +942,7 @@
data: { surveyId: surveyId }, data: { surveyId: surveyId },
success: function (data) { success: function (data) {
alert("checking");
let html = ""; let html = "";

26
src/main/resources/templates/modules/greencommittee/pendinglist.html

@ -101,6 +101,22 @@
<option value="">Select Zone </option> <option value="">Select Zone </option>
</select> </select>
</div> </div>
<div class="form-group col-sm-4">
<label for="applicationType">Application Type</label>
<select id="applicationType" class="form-control">
<option value="">Select Application Type</option>
<option value="Department">Department</option>
<option value="Public">Public</option>
</select>
</div>
<div class="form-group col-sm-4">
<label for="complaintType">Complaint Type</label>
<select id="complaintType" class="form-control">
<option value="">Select Complaint Type</option>
<option value="Felling">Felling</option>
<option value="Transplantation">Transplantation</option>
</select>
</div>
</div> </div>
<div class="page-header-title"> <div class="page-header-title">
<h5 style="margin: 0;font-weight: bold;">Green Committee Pending List</h5><span <h5 style="margin: 0;font-weight: bold;">Green Committee Pending List</h5><span
@ -732,6 +748,12 @@
$("#modalBodyContent").html(content); $("#modalBodyContent").html(content);
} }
$('#applicationType').on('change', function () {
fetchgreenCommitteeList();
});
$('#complaintType').on('change', function () {
fetchgreenCommitteeList();
});
@ -739,6 +761,8 @@
function fetchgreenCommitteeList() { function fetchgreenCommitteeList() {
const selectedOption = $('#dropdownevent option:selected').text(); const selectedOption = $('#dropdownevent option:selected').text();
let selectedappType = $('#applicationType').val();
let selectedcomType = $('#complaintType').val();
// Assuming the format is: "Event Name - yyyy-mm-dd" // Assuming the format is: "Event Name - yyyy-mm-dd"
const eventDateRaw = selectedOption.split(' - ')[1]; const eventDateRaw = selectedOption.split(' - ')[1];
@ -765,7 +789,7 @@
$.ajax({ $.ajax({
url: '/gcc/api/greencommittee/pendinglist/getgreencommitteelist', url: '/gcc/api/greencommittee/pendinglist/getgreencommitteelist',
data: { date: formattedDate, zones: selectedZone },
data: { date: formattedDate, zones: selectedZone, appType: selectedappType, compType: selectedcomType },
method: 'GET', method: 'GET',
contentType: 'application/json', contentType: 'application/json',
success: function (data) { success: function (data) {

461
src/main/resources/templates/modules/greencommittee/treepruningreports.html

@ -49,6 +49,11 @@
.img-thumbnail { .img-thumbnail {
border-radius: 8px; border-radius: 8px;
} }
#complaintModal label {
font-size: 17px;
font-weight: 600;
}
</style> </style>
<body> <body>
@ -72,7 +77,7 @@
<div class="page-header-title"> <div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i> <i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline"> <div class="d-inline">
<h5>Reports</h5>
<h5>Tree Pruning Reports</h5>
<span>Green Committee</span> <span>Green Committee</span>
</div> </div>
</div> </div>
@ -83,7 +88,7 @@
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a> <li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a>
</li> </li>
<li class="breadcrumb-item" aria-current="page">Green Committee</li> <li class="breadcrumb-item" aria-current="page">Green Committee</li>
<li class="breadcrumb-item active" aria-current="page">Reports</li>
<li class="breadcrumb-item active" aria-current="page">Tree Pruning Reports</li>
</ol> </ol>
</nav> </nav>
</div> </div>
@ -203,248 +208,252 @@
</div> </div>
</div>
</div>
<!-- Complaint Details Modal -->
<div class="modal fade" id="complaintModal" tabindex="-1">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<!-- Header -->
<div class="modal-header bg-dark text-white">
<div>
<h4 class="mb-0">
Complaint Details -
<span id="complaintNo"></span>
</h4>
</div>
<span id="complaintStatus" class="badge badge-warning ml-3"
style="font-size:14px;height:28px;line-height:20px;">
</span>
<button type="button" class="close text-white" data-dismiss="modal">
&times;
</button>
</div>
<!-- Complaint Details Modal -->
<div class="modal fade" id="complaintModal" tabindex="-1">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-body">
<!-- Header -->
<div class="modal-header bg-dark text-white">
<!-- ================= COMPLAINT ================= -->
<div>
<h4 class="mb-0">
Complaint Details -
<span id="complaintNo"></span>
</h4>
</div>
<h6 class="section-title">COMPLAINT</h6>
<hr>
<span id="complaintStatus" class="badge badge-warning ml-3"
style="font-size:14px;height:28px;line-height:20px;">
</span>
<div class="row">
<button type="button" class="close text-white" data-dismiss="modal">
&times;
</button>
<div class="col-md-6">
<label>Complaint Type</label>
<p id="complaintType"></p>
</div> </div>
<div class="col-md-6">
<label>Mode</label>
<p id="mode"></p>
</div>
<div class="modal-body">
<div class="col-md-6">
<label>Department</label>
<p id="department"></p>
</div>
<!-- ================= COMPLAINT ================= -->
<div class="col-md-6">
<label>SLA</label>
<p id="sla"></p>
</div>
<h6 class="section-title">COMPLAINT</h6>
<hr>
<div class="col-md-12">
<label>Remarks</label>
<p id="remarks"></p>
</div>
<div class="row">
</div>
<!-- ================= CUSTOMER ================= -->
<div class="col-md-6">
<label>Complaint Type</label>
<p id="complaintType"></p>
</div>
<h6 class="section-title mt-4">CUSTOMER</h6>
<hr>
<div class="col-md-6">
<label>Mode</label>
<p id="mode"></p>
</div>
<div class="row">
<div class="col-md-6">
<label>Department</label>
<p id="department"></p>
</div>
<div class="col-md-6">
<label>Name</label>
<p id="personName"></p>
</div>
<div class="col-md-6">
<label>SLA</label>
<p id="sla"></p>
</div>
<div class="col-md-6">
<label>Mobile</label>
<p id="mobile"></p>
</div>
<div class="col-md-12">
<label>Remarks</label>
<p id="remarks"></p>
</div>
</div>
</div>
<!-- ================= LOCATION ================= -->
<!-- ================= CUSTOMER ================= -->
<h6 class="section-title mt-4">LOCATION</h6>
<hr>
<h6 class="section-title mt-4">CUSTOMER</h6>
<hr>
<div class="row">
<div class="row">
<div class="col-md-6">
<label>Zone</label>
<p id="zone"></p>
</div>
<div class="col-md-6">
<label>Name</label>
<p id="personName"></p>
</div>
<div class="col-md-6">
<label>Division / Ward</label>
<p id="ward"></p>
</div>
<div class="col-md-6">
<label>Mobile</label>
<p id="mobile"></p>
</div>
<div class="col-md-6">
<label>Area</label>
<p id="area"></p>
</div>
</div>
<div class="col-md-6">
<label>Street</label>
<p id="street"></p>
</div>
<!-- ================= LOCATION ================= -->
<div class="col-md-12">
<label>Landmark</label>
<p id="landmark"></p>
</div>
<h6 class="section-title mt-4">LOCATION</h6>
<hr>
</div>
<div class="row">
<!-- ================= OFFICIAL ================= -->
<div class="col-md-6">
<label>Zone</label>
<p id="zone"></p>
</div>
<h6 class="section-title mt-4">OFFICIAL</h6>
<hr>
<div class="col-md-6">
<label>Division / Ward</label>
<p id="ward"></p>
</div>
<div class="row">
<div class="col-md-6">
<label>Area</label>
<p id="area"></p>
</div>
<div class="col-md-6">
<label>Name</label>
<p id="officialName"></p>
</div>
<div class="col-md-6">
<label>Street</label>
<p id="street"></p>
</div>
<div class="col-md-6">
<label>Mobile</label>
<p id="officialMobile"></p>
</div>
<div class="col-md-12">
<label>Landmark</label>
<p id="landmark"></p>
</div>
<div class="col-md-12">
<label>Response</label>
<p id="officialResponse"></p>
</div>
</div>
</div>
<!-- ================= OFFICIAL ================= -->
<!-- ================= TIMELINE ================= -->
<h6 class="section-title mt-4">OFFICIAL</h6>
<hr>
<h6 class="section-title mt-4">TIMELINE</h6>
<hr>
<div class="row">
<div class="row">
<div class="col-md-6">
<label>Name</label>
<p id="officialName"></p>
</div>
<div class="col-md-6">
<label>Opened</label>
<p id="openedDate"></p>
</div>
<div class="col-md-6">
<label>Mobile</label>
<p id="officialMobile"></p>
</div>
<div class="col-md-6">
<label>Closed</label>
<p id="closedDate"></p>
</div>
<div class="col-md-12">
<label>Response</label>
<p id="officialResponse"></p>
</div>
<div class="col-md-6">
<label>Reopen Date</label>
<p id="reopenDate"></p>
</div>
</div>
<div class="col-md-6">
<label>Final Closed</label>
<p id="finalClosedDate"></p>
</div>
<!-- ================= TIMELINE ================= -->
</div>
<h6 class="section-title mt-4">TIMELINE</h6>
<hr>
<!-- ================= IMAGES ================= -->
<div class="row">
<h6 class="section-title mt-4">IMAGES</h6>
<hr>
<div class="col-md-6">
<label>Opened</label>
<p id="openedDate"></p>
</div>
<div class="row">
<div class="col-md-6">
<label>Closed</label>
<p id="closedDate"></p>
</div>
<div class="col-md-6 text-center">
<label>Before (Citizen)</label>
<div class="col-md-6">
<label>Reopen Date</label>
<p id="reopenDate"></p>
</div>
<img id="citizenImg" class="img-thumbnail"
style="width:100%;height:220px;object-fit:cover;display:none;">
<div class="col-md-6">
<label>Final Closed</label>
<p id="finalClosedDate"></p>
</div>
<div id="citizenNoImage" class="border p-5 mt-2 text-muted">
No Image Available
</div> </div>
</div>
<div class="col-md-6 text-center">
<label>After (Official)</label>
<!-- ================= IMAGES ================= -->
<h6 class="section-title mt-4">IMAGES</h6>
<hr>
<div class="row">
<div class="col-md-6 text-center">
<label><b style="font-size:18px;">Before Image</b> </label>
<!-- <img id="citizenImg" class="img-thumbnail"
style="width:100%;height:220px;object-fit:cover;display:none;">-->
<img id="citizenImg" class="img-thumbnail preview-img"
style="width:100%; height:auto; display:none; cursor:pointer;">
<div id="citizenNoImage" class="border p-5 mt-2 text-muted">
No Image Available
</div>
</div>
<img id="officialImg" class="img-thumbnail"
style="width:100%;height:220px;object-fit:cover;display:none;">
<div class="col-md-6 text-center">
<label><b style="font-size:18px;">After Image</b></label>
<!-- <img id="officialImg" class="img-thumbnail"
style="width:100%;height:220px;object-fit:cover;display:none;">-->
<img id="officialImg" class="img-thumbnail preview-img"
style="width:100%; height:auto; display:none; cursor:pointer;">
<div id="officialNoImage" class="border p-5 mt-2 text-muted">
No Image Available
</div>
</div>
<div id="officialNoImage" class="border p-5 mt-2 text-muted">
No Image Available
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div class="modal fade" id="imageModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal fade" id="imageModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Image Preview</h5>
<div class="modal-header">
<h5 class="modal-title">Image Preview</h5>
<button type="button" class="close" data-dismiss="modal">
&times;
</button>
<button type="button" class="close" data-dismiss="modal">
&times;
</button>
</div>
</div>
<div class="modal-body text-center">
<div class="modal-body text-center">
<img id="modalImage" src="" class="img-fluid" style="max-height:80vh;">
<img id="modalImage" src="" class="img-fluid" style="max-height:80vh;">
</div>
</div>
</div>
</div>
</div> </div>
</div>
</div>
<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 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> </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>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div> </div>
@ -699,6 +708,7 @@
$("#citizenImg") $("#citizenImg")
.attr("src", data.userimages[0].Comp_Image) .attr("src", data.userimages[0].Comp_Image)
.addClass("preview-img") .addClass("preview-img")
.css("cursor", "pointer") .css("cursor", "pointer")
.show(); .show();
@ -710,13 +720,54 @@
$("#citizenNoImage").show(); $("#citizenNoImage").show();
} }
if (data.empimages &&
data.empimages.length > 0 &&
data.empimages[0].Comp_Image &&
data.empimages[0].Comp_Image !== "null") {
/* if (data.empimages &&
data.empimages.length > 0 &&
data.empimages[0].Comp_Image &&
data.empimages[0].Comp_Image !== "null") {
$("#officialImg")
.attr("src", data.empimages[0].Comp_Image)
.addClass("preview-img")
.css("cursor", "pointer")
.show();
$("#officialNoImage").hide();
} else {
$("#officialImg").hide();
$("#officialNoImage").show();
}*/
let officerImage = null;
let latestDate = null;
if (data.Comments && data.Comments.length > 0) {
data.Comments.forEach(function (comment) {
// Only Park users
if (comment.user &&
comment.user.startsWith("Park") &&
comment.userimages &&
comment.userimages.length > 0 &&
comment.userimages[0].Comp_Image &&
comment.userimages[0].Comp_Image !== "null") {
let currentDate = new Date(comment.comment_date);
if (latestDate == null || currentDate > latestDate) {
latestDate = currentDate;
officerImage = comment.userimages[0].Comp_Image;
}
}
});
}
if (officerImage) {
$("#officialImg") $("#officialImg")
.attr("src", data.empimages[0].Comp_Image)
.attr("src", officerImage)
.addClass("preview-img") .addClass("preview-img")
.css("cursor", "pointer") .css("cursor", "pointer")
.show(); .show();
@ -804,15 +855,57 @@
{ data: "Address" }, { data: "Address" },
{ data: "Complaint Mode" }, { data: "Complaint Mode" },
{ data: "Complaint Opened Date" }, { data: "Complaint Opened Date" },
/* {
data: null,
render: function (data, type, row) {
let status = (row["Current Status"] || "").trim().toLowerCase();
let badgeClass = "badge-secondary";
if (status === "closed") {
badgeClass = "badge-success";
} else if (status === "processing" || status === "redressed") {
badgeClass = "badge-warning";
}
return `
<span class="badge ${badgeClass}">
${row["Current Status"]}
</span>
<br>
<small>${row["complaintcurrentstatus"] || "-"}</small>
`;
}
},*/
{ {
data: "Current Status",
render: function (data) {
if (data === "Completed") {
return '<span class="badge badge-success">Completed</span>';
data: null,
render: function (data, type, row) {
console.log(row["Current Status"]);
let badge = "";
if (row["Current Status"] === "Completed" || row["Current Status"] === "Closed") {
badge = '<span class="badge badge-success">Completed</span>';
} else {
badge = '<span class="badge badge-warning">Processing</span>';
} }
return '<span class="badge badge-warning">Processing</span>';
return badge +
'<br><small>' +
(row["complaintcurrentstatus"] || "-") +
'</small>';
} }
}, },
/* {
data: "Current Status",
render: function (data) {
if (data === "Completed") {
return '<span class="badge badge-success">Completed</span>';
}
return '<span class="badge badge-warning">Processing</span>';
}
},*/
{ {
data: null, data: null,
className: "text-center", className: "text-center",

1900
src/main/resources/templates/modules/roadwar/regform.html
File diff suppressed because it is too large
View File

6326
src/main/resources/templates/modules/roadwar/updateform.html
File diff suppressed because it is too large
View File

Loading…
Cancel
Save