5 changed files with 1463 additions and 0 deletions
-
12src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
-
87src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java
-
5src/main/java/com/gcc/commissionerreview/controller/MainController.java
-
596src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java
-
763src/main/resources/templates/modules/iecomplaintsreport.html
@ -0,0 +1,87 @@ |
|||
package com.gcc.commissionerreview.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.gcc.commissionerreview.service.IeComplaintsService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/iecomplaints") |
|||
|
|||
public class IeComplaintsApiController { |
|||
@Autowired |
|||
private IeComplaintsService iecomplaintservice; |
|||
|
|||
@GetMapping("/getIESummary") |
|||
public ResponseEntity<Map<String, Object>> getIESummary() { |
|||
|
|||
return ResponseEntity.ok( |
|||
iecomplaintservice.getIEComplaintSummary()); |
|||
} |
|||
|
|||
@GetMapping("/complaintDashboard") |
|||
public ResponseEntity<Map<String, Object>> complaintDashboard( |
|||
|
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
iecomplaintservice.getComplaintDashboard(fromDate, toDate)); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/zoneActivity") |
|||
public ResponseEntity<Map<String, Object>> zoneActivity( |
|||
|
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate, |
|||
@RequestParam(required = false) Integer complaintId) { |
|||
|
|||
return ResponseEntity.ok( |
|||
iecomplaintservice.getZoneActivity(fromDate, toDate, complaintId)); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/complaintTypes") |
|||
public ResponseEntity<Map<String, Object>> complaintTypes() { |
|||
|
|||
return ResponseEntity.ok( |
|||
iecomplaintservice.getComplaintTypes()); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/wardActivity") |
|||
public ResponseEntity<Map<String, Object>> wardActivity( |
|||
|
|||
@RequestParam String zone, |
|||
@RequestParam(required = false) String complaintId, |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
iecomplaintservice.getWardActivity(zone, complaintId, fromDate, toDate)); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/complaintDetails") |
|||
public ResponseEntity<Map<String, Object>> complaintDetails( |
|||
|
|||
@RequestParam String zone, |
|||
@RequestParam String ward, |
|||
@RequestParam(required = false) String complaintId, |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
iecomplaintservice.getComplaintDetails(zone, ward, complaintId, fromDate, toDate)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,596 @@ |
|||
package com.gcc.commissionerreview.service; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.HashMap; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.core.env.Environment; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Service |
|||
|
|||
public class IeComplaintsService { |
|||
|
|||
@Autowired |
|||
@Value("${fileBaseUrl}") |
|||
|
|||
private String fileBaseUrl; |
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
@Autowired |
|||
private Environment environment; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlIEComplaintsDataSource") DataSource IEComplaintsDataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(IEComplaintsDataSource); |
|||
} |
|||
|
|||
public IeComplaintsService(Environment environment) { |
|||
|
|||
this.environment = environment; |
|||
|
|||
this.fileBaseUrl = environment.getProperty("fileBaseUrl"); |
|||
} |
|||
|
|||
public Map<String, Object> getIEComplaintSummary() { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
String sql = "SELECT " + |
|||
"COUNT(*) AS total_count, " + |
|||
"COUNT(CASE WHEN status='completed' THEN 1 END) AS completed_count, " + |
|||
"COUNT(CASE WHEN status='pending' THEN 1 END) AS pending_count " + |
|||
"FROM complaint_details"; |
|||
|
|||
Map<String, Object> result = jdbcTemplate.queryForMap(sql); |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("message", "IE Complaint Summary"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "Error"); |
|||
response.put("message", "Something went wrong"); |
|||
response.put("data", null); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getComplaintDashboard(String fromDate, String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
sql.append("cm.complaint_id, cm.complaint_name, "); |
|||
|
|||
sql.append("COUNT(DISTINCT cd.ref_id) AS total_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN comp.ref_id IS NOT NULL "); |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
sql.append("AND DATE(comp.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("THEN comp.ref_id END) AS completed_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN comp.ref_id IS NULL "); |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
sql.append("AND DATE(cd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("THEN cd.ref_id END) AS pending_count "); |
|||
|
|||
sql.append("FROM complaint_master cm "); |
|||
|
|||
sql.append("LEFT JOIN complaint_details cd "); |
|||
sql.append("ON cm.complaint_id = cd.complaint_id "); |
|||
|
|||
sql.append("LEFT JOIN completion comp "); |
|||
sql.append("ON comp.ref_id = cd.ref_id "); |
|||
|
|||
sql.append("GROUP BY cm.complaint_id, cm.complaint_name "); |
|||
sql.append("ORDER BY cm.complaint_id"); |
|||
|
|||
List<Map<String, Object>> 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", "Something went wrong"); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
/* |
|||
* public Map<String, Object> getZoneActivity(String fromDate, String toDate, |
|||
* Integer complaintId) { |
|||
* |
|||
* Map<String, Object> response = new HashMap<>(); |
|||
* |
|||
* try { |
|||
* |
|||
* StringBuilder sql = new StringBuilder(); |
|||
* |
|||
* List<Object> params = new ArrayList<>(); |
|||
* |
|||
* sql.append("SELECT "); |
|||
* sql.append("zm.zone_name, "); |
|||
* |
|||
* sql.append("COUNT(cd.ref_id) AS total_count, "); |
|||
* |
|||
* sql. |
|||
* append("COUNT(CASE WHEN cd.status = 'completed' THEN 1 END) AS completed_count, " |
|||
* ); |
|||
* |
|||
* sql. |
|||
* append("COUNT(CASE WHEN cd.status = 'pending' THEN 1 END) AS pending_count " |
|||
* ); |
|||
* |
|||
* sql.append("FROM gcc_street_vendor.zone_master zm "); |
|||
* |
|||
* sql.append("LEFT JOIN complaint_details cd "); |
|||
* sql.append("ON zm.zone_name = cd.zone "); |
|||
* |
|||
* sql.append("AND cd.is_delete = 0 "); |
|||
* sql.append("AND cd.is_active = 1 "); |
|||
* |
|||
* if (complaintId != null) { |
|||
* sql.append("AND cd.complaint_id = ? "); |
|||
* params.add(complaintId); |
|||
* } |
|||
* |
|||
* if (fromDate != null && !fromDate.isEmpty() && toDate != null && |
|||
* !toDate.isEmpty()) { |
|||
* sql.append("AND DATE(cd.cdate) BETWEEN ? AND ? "); |
|||
* params.add(fromDate); |
|||
* params.add(toDate); |
|||
* } |
|||
* |
|||
* sql.append("GROUP BY zm.zone_name "); |
|||
* sql.append("ORDER BY zm.zone_name "); |
|||
* |
|||
* List<Map<String, Object>> 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", "Something went wrong"); |
|||
* |
|||
* } |
|||
* |
|||
* return response; |
|||
* } |
|||
*/ |
|||
public Map<String, Object> getZoneActivity(String fromDate, String toDate, Integer complaintId) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
sql.append("zm.zone_name, "); |
|||
|
|||
sql.append("COUNT(DISTINCT cd.ref_id) AS total_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN comp.ref_id IS NOT NULL "); |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
sql.append("AND DATE(comp.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("THEN comp.ref_id END) AS completed_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN comp.ref_id IS NULL "); |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
sql.append("AND DATE(cd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("THEN cd.ref_id END) AS pending_count "); |
|||
|
|||
sql.append("FROM gcc_street_vendor.zone_master zm "); |
|||
|
|||
sql.append("LEFT JOIN complaint_details cd "); |
|||
sql.append("ON zm.zone_name = cd.zone "); |
|||
sql.append("AND cd.is_delete = 0 "); |
|||
sql.append("AND cd.is_active = 1 "); |
|||
|
|||
if (complaintId != null) { |
|||
sql.append("AND cd.complaint_id = ? "); |
|||
params.add(complaintId); |
|||
} |
|||
|
|||
sql.append("LEFT JOIN completion comp "); |
|||
sql.append("ON comp.ref_id = cd.ref_id "); |
|||
|
|||
sql.append("GROUP BY zm.zone_name "); |
|||
sql.append("ORDER BY zm.zone_name "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
response.put("status", "Error"); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getComplaintTypes() { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
String sql = "SELECT complaint_id, complaint_name FROM complaint_master"; |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql); |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
response.put("status", "Error"); |
|||
response.put("message", "Something went wrong"); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getWardActivity(String zone, String complaintId, |
|||
String fromDate, String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
sql.append("wm.ward_name AS ward, "); |
|||
|
|||
sql.append("COUNT(DISTINCT cd.ref_id) AS total_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN comp.ref_id IS NOT NULL "); |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
sql.append("AND DATE(comp.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("THEN comp.ref_id END) AS completed_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN comp.ref_id IS NULL "); |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
sql.append("AND DATE(cd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("THEN cd.ref_id END) AS pending_count "); |
|||
|
|||
sql.append("FROM gcc_street_vendor.ward_master wm "); |
|||
|
|||
// Complaint details join |
|||
sql.append("LEFT JOIN complaint_details cd "); |
|||
sql.append("ON wm.ward_name = cd.ward "); |
|||
// this below condition is here because if to get all the ward if no data for |
|||
// that ward also |
|||
sql.append("AND cd.zone = ? "); |
|||
params.add(zone); |
|||
|
|||
sql.append("AND cd.is_delete = 0 "); |
|||
sql.append("AND cd.is_active = 1 "); |
|||
|
|||
if (complaintId != null && !complaintId.isEmpty()) { |
|||
sql.append("AND cd.complaint_id = ? "); |
|||
params.add(complaintId); |
|||
} |
|||
|
|||
// Completion join |
|||
sql.append("LEFT JOIN completion comp "); |
|||
sql.append("ON comp.ref_id = cd.ref_id "); |
|||
|
|||
// Zone filter |
|||
sql.append("WHERE wm.zone_id = ? "); |
|||
params.add(zone); |
|||
|
|||
sql.append("GROUP BY wm.ward_name "); |
|||
sql.append("ORDER BY wm.ward_name "); |
|||
|
|||
List<Map<String, Object>> 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", "Something went wrong"); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
/* |
|||
* public Map<String, Object> getWardActivity(String zone, String complaintId, |
|||
* String fromDate, String toDate) { |
|||
* |
|||
* Map<String, Object> response = new HashMap<>(); |
|||
* |
|||
* try { |
|||
* |
|||
* StringBuilder sql = new StringBuilder(); |
|||
* List<Object> params = new ArrayList<>(); |
|||
* |
|||
* sql.append("SELECT "); |
|||
* sql.append("wm.ward_name AS ward, "); |
|||
* |
|||
* sql.append("COUNT(cd.ref_id) AS total_count, "); |
|||
* |
|||
* sql. |
|||
* append("COUNT(CASE WHEN cd.status='completed' THEN 1 END) AS completed_count, " |
|||
* ); |
|||
* |
|||
* sql. |
|||
* append("COUNT(CASE WHEN cd.status='pending' THEN 1 END) AS pending_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 "); |
|||
* |
|||
* if (complaintId != null && !complaintId.isEmpty()) { |
|||
* sql.append("AND cd.complaint_id = ? "); |
|||
* params.add(complaintId); |
|||
* } |
|||
* |
|||
* if (fromDate != null && !fromDate.isEmpty() && toDate != null && |
|||
* !toDate.isEmpty()) { |
|||
* sql.append("AND DATE(cd.cdate) BETWEEN ? AND ? "); |
|||
* params.add(fromDate); |
|||
* 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<Map<String, Object>> 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", "Something went wrong"); |
|||
* |
|||
* } |
|||
* |
|||
* return response; |
|||
* } |
|||
*/ |
|||
|
|||
public Map<String, Object> getComplaintDetails(String zone, String ward, |
|||
String complaintId, String fromDate, String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
String beforeImageColumn = "cd.image_path"; |
|||
String afterImageColumn = "comp.image_path"; |
|||
|
|||
sql.append("SELECT "); |
|||
sql.append("cm.complaint_name, "); |
|||
sql.append("cd.street_name, "); |
|||
sql.append("cd.status, "); |
|||
sql.append("DATE_FORMAT(cd.cdate,'%d-%m-%Y') AS complaint_created_date, "); |
|||
sql.append("IFNULL(DATE_FORMAT(comp.cdate,'%d-%m-%Y'),'Pending') AS completion_date, "); |
|||
/* |
|||
* sql.append("DATE(cd.cdate) AS complaint_created_date, "); |
|||
* sql.append("IFNULL(DATE(comp.cdate),'Pending') AS completion_date, "); |
|||
*/ |
|||
|
|||
sql.append( |
|||
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files'," + beforeImageColumn + ") AS before_image, "); |
|||
sql.append("CONCAT('" + fileBaseUrl + "/gccofficialapp/files'," + afterImageColumn + ") AS after_image "); |
|||
|
|||
sql.append("FROM complaint_details cd "); |
|||
|
|||
sql.append("LEFT JOIN complaint_master cm "); |
|||
sql.append("ON cm.complaint_id = cd.complaint_id "); |
|||
|
|||
sql.append("LEFT JOIN completion comp "); |
|||
sql.append("ON comp.ref_id = cd.ref_id "); |
|||
|
|||
sql.append("WHERE cd.zone = ? "); |
|||
params.add(zone); |
|||
|
|||
sql.append("AND cd.ward = ? "); |
|||
params.add(ward); |
|||
|
|||
sql.append("AND cd.is_delete = 0 "); |
|||
sql.append("AND cd.is_active = 1 "); |
|||
|
|||
if (complaintId != null && !complaintId.isEmpty()) { |
|||
sql.append("AND cd.complaint_id = ? "); |
|||
params.add(complaintId); |
|||
} |
|||
|
|||
if (fromDate != null && !fromDate.isEmpty() && toDate != null && !toDate.isEmpty()) { |
|||
|
|||
sql.append("AND ( "); |
|||
|
|||
sql.append("(comp.ref_id IS NOT NULL AND DATE(comp.cdate) BETWEEN ? AND ?) "); |
|||
|
|||
sql.append("OR "); |
|||
|
|||
sql.append("(comp.ref_id IS NULL AND DATE(cd.cdate) BETWEEN ? AND ?) "); |
|||
|
|||
sql.append(") "); |
|||
|
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
response.put("status", "Error"); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
/* |
|||
* public Map<String, Object> getComplaintDetails(String zone, String ward, |
|||
* String complaintId, String fromDate, String toDate) { |
|||
* |
|||
* Map<String, Object> response = new HashMap<>(); |
|||
* |
|||
* try { |
|||
* |
|||
* StringBuilder sql = new StringBuilder(); |
|||
* List<Object> params = new ArrayList<>(); |
|||
* String beforeImageColumn = "cd.image_path"; |
|||
* String afterImageColumn = "comp.image_path"; |
|||
* |
|||
* sql.append("SELECT "); |
|||
* sql.append("cm.complaint_name, "); |
|||
* sql.append("cd.street_name, "); |
|||
* sql.append("cd.status, "); |
|||
* sql.append( |
|||
* "CONCAT('" + fileBaseUrl + "/gccofficialapp/files'," + beforeImageColumn + |
|||
* ") AS before_image, "); |
|||
* |
|||
* sql.append("CONCAT('" + fileBaseUrl + "/gccofficialapp/files'," + |
|||
* afterImageColumn + ") AS after_image "); |
|||
* |
|||
* sql.append("FROM complaint_details cd "); |
|||
* |
|||
* sql.append("LEFT JOIN complaint_master cm "); |
|||
* sql.append("ON cm.complaint_id=cd.complaint_id "); |
|||
* |
|||
* sql.append("LEFT JOIN completion comp "); |
|||
* sql.append("ON comp.ref_id=cd.ref_id "); |
|||
* |
|||
* sql.append("WHERE cd.zone=? "); |
|||
* params.add(zone); |
|||
* |
|||
* sql.append("AND cd.ward=? "); |
|||
* params.add(ward); |
|||
* |
|||
* if (complaintId != null && !complaintId.isEmpty()) { |
|||
* sql.append("AND cd.complaint_id=? "); |
|||
* params.add(complaintId); |
|||
* } |
|||
* |
|||
* if (fromDate != null && !fromDate.isEmpty() && toDate != null && |
|||
* !toDate.isEmpty()) { |
|||
* sql.append("AND DATE(cd.cdate) BETWEEN ? AND ? "); |
|||
* params.add(fromDate); |
|||
* params.add(toDate); |
|||
* } |
|||
* |
|||
* List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), |
|||
* params.toArray()); |
|||
* |
|||
* response.put("status", "Success"); |
|||
* response.put("data", result); |
|||
* |
|||
* } catch (Exception e) { |
|||
* |
|||
* e.printStackTrace(); |
|||
* response.put("status", "Error"); |
|||
* } |
|||
* |
|||
* return response; |
|||
* |
|||
* } |
|||
*/ |
|||
|
|||
} |
|||
@ -0,0 +1,763 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head> |
|||
<title>IE Complaints Report </title> |
|||
|
|||
<!-- Bootstrap 5 CSS --> |
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|||
|
|||
<!-- DataTables CSS --> |
|||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet" /> |
|||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet" /> |
|||
|
|||
<style> |
|||
#ieSummaryTable { |
|||
border-collapse: collapse; |
|||
width: 100%; |
|||
} |
|||
|
|||
#ieSummaryTable th, |
|||
#ieSummaryTable td { |
|||
border: 1px solid black; |
|||
text-align: center; |
|||
vertical-align: middle; |
|||
} |
|||
|
|||
.table-header th { |
|||
background: #0b3c6d; |
|||
color: white; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
#ieSummaryTable tbody tr { |
|||
background: #e6e6e6; |
|||
} |
|||
|
|||
.summary-card { |
|||
border-radius: 8px; |
|||
padding: 15px; |
|||
border: 1px dashed #999; |
|||
} |
|||
|
|||
.complaint-card { |
|||
border-radius: 8px; |
|||
} |
|||
|
|||
.complaint-header { |
|||
background: #0b3c6d; |
|||
color: white; |
|||
text-align: center; |
|||
font-weight: 600; |
|||
} |
|||
|
|||
.summary-box { |
|||
padding: 12px; |
|||
border-radius: 6px; |
|||
border: 1px dashed #ccc; |
|||
} |
|||
|
|||
.total { |
|||
background: #d7e7f1; |
|||
} |
|||
|
|||
.completed { |
|||
background: #cfe8cf; |
|||
} |
|||
|
|||
.pending { |
|||
background: #e7e2ec; |
|||
} |
|||
|
|||
.summary-box h4 { |
|||
font-weight: 700; |
|||
color: #1e63d5; |
|||
margin: 0; |
|||
} |
|||
|
|||
@media (max-width: 576px) { |
|||
|
|||
.card-body .row { |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.card-body .col-4 { |
|||
width: 100%; |
|||
margin-bottom: 8px; |
|||
} |
|||
|
|||
} |
|||
</style> |
|||
</head> |
|||
|
|||
<body> |
|||
|
|||
<div class="page-header-title text-center"> |
|||
<h4 class>IE Complaints Report</h4> |
|||
</div> |
|||
|
|||
<div class=" container mt-4"> |
|||
|
|||
<table id="ieSummaryTable" class="table table-bordered text-center"> |
|||
<thead class="table-header"> |
|||
<tr> |
|||
<th>Total Complaints</th> |
|||
<th>Completed</th> |
|||
<th>Pending</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody></tbody> |
|||
</table> |
|||
|
|||
<!-- Date Filter --> |
|||
<div class="card mt-3 mb-4"> |
|||
<div class="card-body"> |
|||
|
|||
<div class="row align-items-end"> |
|||
|
|||
<div class="col-md-4"> |
|||
<label class="form-label">From Date</label> |
|||
<input type="date" id="fromDate" class="form-control"> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label class="form-label">To Date</label> |
|||
<input type="date" id="toDate" class="form-control"> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<button class="btn btn-primary w-100 " onclick="loadDashboard(true)"> |
|||
Search |
|||
</button> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="container mt-4"> |
|||
|
|||
<div id="dashboardCards" class="row"></div> |
|||
|
|||
</div> |
|||
|
|||
<div class="container mt-4"> |
|||
|
|||
<div class="row mb-2"> |
|||
<div class="col-md-4"> |
|||
<label class="form-label">Complaint Type</label> |
|||
<select id="complaintDropdown" class="form-control"> |
|||
<option value="">All Complaints</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<table id="zoneTable" class="table table-bordered text-center"> |
|||
|
|||
<thead class="table-header"> |
|||
<tr> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Total</th> |
|||
<th class="text-center">Completed</th> |
|||
<th class="text-center">Pending</th> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody id="zoneTableBody"></tbody> |
|||
|
|||
</table> |
|||
|
|||
</div> |
|||
<div class="modal fade" id="wardModal" tabindex="-1"> |
|||
<div class="modal-dialog modal-lg"> |
|||
<div class="modal-content"> |
|||
|
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Ward Activity - Zone <span id="zoneTitle"></span></h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button> |
|||
</div> |
|||
|
|||
<div class="modal-body"> |
|||
|
|||
<table id="wardTable" class="table table-bordered text-center"> |
|||
|
|||
<thead class="table-header"> |
|||
<tr> |
|||
<th class="text-center">Ward</th> |
|||
<th class="text-center">Total</th> |
|||
<th class="text-center">Completed</th> |
|||
<th class="text-center">Pending</th> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody id="wardTableBody"></tbody> |
|||
|
|||
</table> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="modal fade" id="complaintModal" tabindex="-1"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
|
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Complaint Details - Ward <span id="wardTitle"></span> </h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button> |
|||
</div> |
|||
|
|||
<div class="modal-body"> |
|||
|
|||
<table id="complaintTable" class="table table-bordered text-center"> |
|||
|
|||
<thead class="table-header"> |
|||
<tr> |
|||
<th class="text-center">Complaint Name</th> |
|||
|
|||
<th class="text-center">Before Image</th> |
|||
<th class="text-center">Complaint Created Date</th> |
|||
|
|||
<th class="text-center">After Image</th> |
|||
<th class="text-center">Completion Date</th> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody id="complaintDetailsBody"></tbody> |
|||
|
|||
</table> |
|||
|
|||
</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-header"> |
|||
<h5 class="modal-title">Image Preview</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button> |
|||
</div> |
|||
|
|||
<div class="modal-body text-center"> |
|||
<img id="modalImage" src="" class="img-fluid" style="max-height:80vh;"> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Image Modal --> |
|||
<!-- <div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-hidden="true"> |
|||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
|
|||
<div class="modal-body text-center p-0"> |
|||
<img id="modalImage" src="" class="img-fluid" alt="Preview" style="max-height: 80vh;"/> |
|||
</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"></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> |
|||
|
|||
|
|||
<!-- Scripts --> |
|||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<!-- DataTables JS --> |
|||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
|||
|
|||
<!-- SweetAlert --> |
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
/* |
|||
$(document).on('click', '.preview-img', function() { |
|||
const src = $(this).attr('src'); |
|||
$('#modalImage').attr('src', src); |
|||
$('#imageModal').modal('show'); |
|||
}); */ |
|||
$("#fromDate").on("change", function () { |
|||
|
|||
let fromDate = $(this).val(); |
|||
|
|||
if (fromDate) { |
|||
$("#toDate").attr("min", fromDate); // restrict past dates |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
loadDashboard(); |
|||
loadZoneActivity(); |
|||
loadComplaintDropdown(); |
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/iecomplaints/getIESummary', |
|||
method: 'GET', |
|||
|
|||
success: function (res) { |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
let data = res.data; |
|||
|
|||
let row = ` |
|||
<tr> |
|||
<td>${data.total_count}</td> |
|||
<td>${data.completed_count}</td> |
|||
<td>${data.pending_count}</td> |
|||
</tr> |
|||
`; |
|||
|
|||
$("#ieSummaryTable tbody").html(row); |
|||
|
|||
$('#ieSummaryTable').DataTable({ |
|||
|
|||
destroy: true, |
|||
|
|||
dom: 'Bfrtip', |
|||
|
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Download Excel', |
|||
title: 'IE_Complaints_Summary' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Download PDF', |
|||
title: 'IE_Complaints_Summary', |
|||
orientation: 'landscape' |
|||
} |
|||
], |
|||
|
|||
paging: false, |
|||
searching: false, |
|||
ordering: false |
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
}); |
|||
|
|||
}); |
|||
$("#complaintDropdown, #fromDate, #toDate").change(function () { |
|||
loadZoneActivity(); |
|||
}); |
|||
function loadComplaintDropdown() { |
|||
|
|||
$.get("/commissionerreview/api/iecomplaints/complaintTypes", function (res) { |
|||
|
|||
let html = `<option value="">All Complaints</option>`; |
|||
|
|||
res.data.forEach(c => { |
|||
|
|||
html += `<option value="${c.complaint_id}"> |
|||
${c.complaint_name} |
|||
</option>`; |
|||
|
|||
}); |
|||
|
|||
$("#complaintDropdown").html(html); |
|||
|
|||
}); |
|||
|
|||
} |
|||
$(document).on('click', '.preview-img', function () { |
|||
|
|||
let src = $(this).attr("src"); |
|||
|
|||
$("#modalImage").attr("src", src); |
|||
|
|||
$("#imageModal").modal("show"); |
|||
|
|||
}); |
|||
function loadComplaintDetails(zone, ward) { |
|||
$("#wardTitle").text(ward); |
|||
|
|||
|
|||
let complaintId = $("#complaintDropdown").val(); |
|||
let fromDate = $("#fromDate").val(); |
|||
let toDate = $("#toDate").val(); |
|||
if ($.fn.DataTable.isDataTable('#complaintTable')) { |
|||
$('#complaintTable').DataTable().destroy(); |
|||
} |
|||
|
|||
$.get("/commissionerreview/api/iecomplaints/complaintDetails", { |
|||
|
|||
zone: zone, |
|||
ward: ward, |
|||
complaintId: complaintId, |
|||
fromDate: fromDate, |
|||
toDate: toDate |
|||
|
|||
}, function (res) { |
|||
console.log(res) |
|||
|
|||
let html = ""; |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
res.data.forEach(c => { |
|||
|
|||
html += ` |
|||
<tr> |
|||
<td>${c.complaint_name}</td> |
|||
|
|||
|
|||
<td> |
|||
<img src="${c.before_image}" width="80" class="preview-img" style="cursor:pointer"> |
|||
</td> |
|||
|
|||
<td>${c.complaint_created_date}</td> |
|||
|
|||
<td> |
|||
${c.after_image ? `<img src="${c.after_image}" width="80" class="preview-img" style="cursor:pointer">` : 'Pending'} |
|||
</td> |
|||
|
|||
<td>${c.completion_date} </td> |
|||
|
|||
</tr> |
|||
`; |
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
$("#complaintDetailsBody").html(html); |
|||
$("#complaintTable").DataTable({ |
|||
destroy: true, |
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Download Excel', |
|||
title: 'Complaint_Details' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Download PDF', |
|||
title: 'Complaint_Details', |
|||
orientation: 'landscape' |
|||
} |
|||
] |
|||
}); |
|||
|
|||
$("#complaintModal").modal("show"); |
|||
|
|||
}); |
|||
|
|||
} |
|||
function loadWardActivity(zone) { |
|||
console.log(zone); |
|||
$("#zoneTitle").text(zone); |
|||
|
|||
let complaintId = $("#complaintDropdown").val(); |
|||
let fromDate = $("#fromDate").val(); |
|||
let toDate = $("#toDate").val(); |
|||
console.log("complaintId"); |
|||
console.log(complaintId); |
|||
if ($.fn.DataTable.isDataTable('#wardTable')) { |
|||
$('#wardTable').DataTable().destroy(); |
|||
} |
|||
|
|||
$.get("/commissionerreview/api/iecomplaints/wardActivity", { |
|||
|
|||
zone: zone, |
|||
complaintId: complaintId, |
|||
fromDate: fromDate, |
|||
toDate: toDate |
|||
|
|||
}, function (res) { |
|||
|
|||
let html = ""; |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
/*res.data.forEach(w => { |
|||
let wardCell = w.total_count > 0 |
|||
? `<a href="javascript:void(0)" onclick="loadComplaintDetails('${zone}','${w.ward}')">${w.ward}</a>` |
|||
: `${w.ward}`; |
|||
|
|||
html += ` |
|||
<tr> |
|||
<td> |
|||
${wardCell} |
|||
|
|||
</td> |
|||
<td>${w.total_count}</td> |
|||
<td>${w.completed_count}</td> |
|||
<td>${w.pending_count}</td> |
|||
</tr> |
|||
`;*/ |
|||
res.data.forEach(w => { |
|||
|
|||
let total = Number(w.completed_count) + Number(w.pending_count); |
|||
|
|||
let wardCell = total > 0 |
|||
? `<a href="javascript:void(0)" onclick="loadComplaintDetails('${zone}','${w.ward}')">${w.ward}</a>` |
|||
: `${w.ward}`; |
|||
|
|||
html += ` |
|||
<tr> |
|||
<td>${wardCell}</td> |
|||
<td>${total}</td> |
|||
<td>${w.completed_count}</td> |
|||
<td>${w.pending_count}</td> |
|||
</tr> |
|||
`; |
|||
|
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
$("#wardTableBody").html(html); |
|||
$("#wardTable").DataTable({ |
|||
destroy: true, |
|||
dom: 'Bfrtip', |
|||
pageLength: 15, |
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Download Excel', |
|||
title: 'Ward_Activity' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Download PDF', |
|||
title: 'Ward_Activity', |
|||
orientation: 'landscape' |
|||
} |
|||
] |
|||
}); |
|||
|
|||
$("#wardModal").modal("show"); |
|||
|
|||
}); |
|||
|
|||
} |
|||
function loadZoneActivity() { |
|||
|
|||
let complaintId = $("#complaintDropdown").val(); |
|||
let fromDate = $("#fromDate").val(); |
|||
let toDate = $("#toDate").val(); |
|||
if ($.fn.DataTable.isDataTable('#zoneTable')) { |
|||
$('#zoneTable').DataTable().destroy(); |
|||
} |
|||
|
|||
|
|||
$.get("/commissionerreview/api/iecomplaints/zoneActivity", { |
|||
complaintId: complaintId, |
|||
fromDate: fromDate, |
|||
toDate: toDate |
|||
}, function (res) { |
|||
|
|||
let html = ""; |
|||
|
|||
if (res.status === "Success" && res.data) { |
|||
/*<td> |
|||
<a href="javascript:void(0)" onclick="loadWardActivity('${z.zone}')"> |
|||
${z.zone_name} |
|||
</a> |
|||
</td> |
|||
|
|||
<td> |
|||
<a href="javascript:void(0)" onclick="loadComplaintDetails('${zone}','${w.ward}')"> |
|||
${w.ward} |
|||
</a> |
|||
</td>*/ |
|||
|
|||
res.data.forEach(z => { |
|||
|
|||
let total = Number(z.completed_count) + Number(z.pending_count); |
|||
|
|||
let zoneCell = total > 0 |
|||
? `<a href="javascript:void(0)" onclick="loadWardActivity('${z.zone_name}')">${z.zone_name}</a>` |
|||
: `${z.zone_name}`; |
|||
|
|||
html += ` |
|||
<tr> |
|||
<td>${zoneCell}</td> |
|||
<td>${total}</td> |
|||
<td>${z.completed_count}</td> |
|||
<td>${z.pending_count}</td> |
|||
</tr> |
|||
`; |
|||
}); |
|||
|
|||
} |
|||
|
|||
$("#zoneTableBody").html(html); |
|||
$("#zoneTable").DataTable({ |
|||
destroy: true, |
|||
dom: 'Bfrtip', |
|||
pageLength: 15, |
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Download Excel', |
|||
title: 'Zone_Activity' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Download PDF', |
|||
title: 'Zone_Activity', |
|||
orientation: 'landscape' |
|||
} |
|||
] |
|||
}); |
|||
|
|||
}); |
|||
|
|||
} |
|||
function loadDashboard(isUserAction = false) { |
|||
|
|||
let fromDate = $("#fromDate").val(); |
|||
let toDate = $("#toDate").val(); |
|||
if (isUserAction) { |
|||
|
|||
if (!fromDate || !toDate) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Missing Date', |
|||
text: 'Please select From Date and To Date', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Check if From Date > To Date |
|||
if (fromDate > toDate) { |
|||
|
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Invalid Date Range', |
|||
text: 'From Date cannot be greater than To Date', |
|||
confirmButtonColor: '#3085d6' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
$.ajax({ |
|||
|
|||
url: '/commissionerreview/api/iecomplaints/complaintDashboard', |
|||
method: 'GET', |
|||
|
|||
data: { |
|||
fromDate: fromDate, |
|||
toDate: toDate |
|||
}, |
|||
|
|||
success: function (res) { |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
|
|||
|
|||
let html = '<div class="row">'; |
|||
|
|||
res.data.forEach(item => { |
|||
/*<div class="col-md-4 mb-4">*/ |
|||
|
|||
html += ` |
|||
<div class="col-12 col-sm-6 col-md-6 col-lg-4 col-xl-4 mb-4"> |
|||
<div class="card complaint-card"> |
|||
|
|||
<div class="card-header complaint-header"> |
|||
${item.complaint_name} |
|||
</div> |
|||
|
|||
<div class="card-body text-center"> |
|||
|
|||
<div class="row"> |
|||
|
|||
<div class="col-4"> |
|||
<div class="summary-box total"> |
|||
<p>Total</p> |
|||
<h4>${Number(item.completed_count) + Number(item.pending_count)}</h4> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-4"> |
|||
<div class="summary-box completed"> |
|||
<p>Completed</p> |
|||
<h4>${item.completed_count}</h4> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-4"> |
|||
<div class="summary-box pending"> |
|||
<p>Pending</p> |
|||
<h4>${item.pending_count}</h4> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
`; |
|||
|
|||
}); |
|||
|
|||
html += '</div>'; |
|||
|
|||
$("#dashboardCards").html(html); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
|
|||
</html> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue