10 changed files with 3081 additions and 5 deletions
-
15pom.xml
-
12src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
-
79src/main/java/com/gcc/commissionerreview/controller/BannerRemovalApiController.java
-
11src/main/java/com/gcc/commissionerreview/controller/MainController.java
-
128src/main/java/com/gcc/commissionerreview/controller/PosterRemovalApiController.java
-
164src/main/java/com/gcc/commissionerreview/service/BannerApiService.java
-
511src/main/java/com/gcc/commissionerreview/service/PosterReportService.java
-
887src/main/resources/templates/modules/poster/bannerReport.html
-
917src/main/resources/templates/modules/poster/posterReport.html
-
362src/main/resources/templates/modules/poster/street_details.jrxml
@ -0,0 +1,79 @@ |
|||||
|
package com.gcc.commissionerreview.controller; |
||||
|
|
||||
|
import com.gcc.commissionerreview.service.BannerApiService; |
||||
|
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 java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/commissionerreview/api/bannerremoval") |
||||
|
|
||||
|
public class BannerRemovalApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private BannerApiService bannerApiService ; |
||||
|
|
||||
|
|
||||
|
@GetMapping("/zone-wise") |
||||
|
public ResponseEntity<Map<String, Object>> getZoneData( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate) { |
||||
|
|
||||
|
Map<String, Object> data = |
||||
|
bannerApiService.fetchZoneData(assetTypeId, fromDate, toDate); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/ward-wise") |
||||
|
public ResponseEntity<Map<String, Object>> getWardData( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone) { |
||||
|
|
||||
|
Map<String, Object> data = |
||||
|
bannerApiService.fetchWardData(assetTypeId, fromDate, toDate,zone); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/street-wise") |
||||
|
public ResponseEntity<Map<String, Object>> getStreetData( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward) { |
||||
|
|
||||
|
Map<String, Object> data = |
||||
|
bannerApiService.fetchStreetData(assetTypeId, fromDate, toDate,zone,ward); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/street-details") |
||||
|
public ResponseEntity<List<Map<String, Object>>> getStreetDetails( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward, |
||||
|
@RequestParam String streetid) { |
||||
|
|
||||
|
List<Map<String, Object>> data = |
||||
|
bannerApiService.fetchStreetDetails(assetTypeId, fromDate, toDate, zone, ward, streetid); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,128 @@ |
|||||
|
package com.gcc.commissionerreview.controller; |
||||
|
|
||||
|
import com.gcc.commissionerreview.service.PosterReportService; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
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 java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/commissionerreview/api/posterremoval") |
||||
|
|
||||
|
public class PosterRemovalApiController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private PosterReportService posterReportService; |
||||
|
|
||||
|
|
||||
|
@GetMapping("/zone-wise") |
||||
|
public ResponseEntity<Map<String, Object>> getZoneData( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate) { |
||||
|
|
||||
|
Map<String, Object> data = |
||||
|
posterReportService.fetchZoneData(assetTypeId, fromDate, toDate); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/ward-wise") |
||||
|
public ResponseEntity<Map<String, Object>> getWardData( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone) { |
||||
|
|
||||
|
Map<String, Object> data = |
||||
|
posterReportService.fetchWardData(assetTypeId, fromDate, toDate,zone); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/street-wise") |
||||
|
public ResponseEntity<Map<String, Object>> getStreetData( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward) { |
||||
|
|
||||
|
Map<String, Object> data = |
||||
|
posterReportService.fetchStreetData(assetTypeId, fromDate, toDate,zone,ward); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/street-details") |
||||
|
public ResponseEntity<List<Map<String, Object>>> getStreetDetails( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward, |
||||
|
@RequestParam String streetid) { |
||||
|
|
||||
|
List<Map<String, Object>> data = |
||||
|
posterReportService.fetchStreetDetails(assetTypeId, fromDate, toDate, zone, ward, streetid); |
||||
|
|
||||
|
return ResponseEntity.ok(data); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// add using jrxml format |
||||
|
|
||||
|
@GetMapping("/download-street-report") |
||||
|
public void downloadStreetReport( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward, |
||||
|
@RequestParam String streetid, |
||||
|
HttpServletResponse response) throws Exception { |
||||
|
|
||||
|
posterReportService.downloadStreetReport( |
||||
|
assetTypeId, |
||||
|
fromDate, |
||||
|
toDate, |
||||
|
zone, |
||||
|
ward, |
||||
|
streetid, |
||||
|
response); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/download-street-pdf-report") |
||||
|
public void downloadStreetPdfReport( |
||||
|
@RequestParam Integer assetTypeId, |
||||
|
@RequestParam String fromDate, |
||||
|
@RequestParam String toDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward, |
||||
|
@RequestParam String streetid, |
||||
|
HttpServletResponse response) throws Exception { |
||||
|
|
||||
|
posterReportService.downloadStreetPdfReport( |
||||
|
assetTypeId, |
||||
|
fromDate, |
||||
|
toDate, |
||||
|
zone, |
||||
|
ward, |
||||
|
streetid, |
||||
|
response); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,164 @@ |
|||||
|
package com.gcc.commissionerreview.service; |
||||
|
|
||||
|
|
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class BannerApiService { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
private ObjectMapper objectMapper; |
||||
|
|
||||
|
|
||||
|
public Map<String, Object> fetchZoneData(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReports" |
||||
|
+ "?assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
return objectMapper.readValue(response, Map.class); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new HashMap<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Map<String, Object> fetchWardData(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate,String zone) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReports?" |
||||
|
+ "assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate |
||||
|
+ "&zone=" + zone; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
return objectMapper.readValue(response, Map.class); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new HashMap<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Map<String, Object> fetchStreetData(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate,String zone,String ward) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReports?" |
||||
|
+ "assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate |
||||
|
+ "&zone=" + zone |
||||
|
+ "&ward=" + ward ; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
return objectMapper.readValue(response, Map.class); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new HashMap<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchStreetDetails(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate, |
||||
|
String zone, |
||||
|
String ward, |
||||
|
String streetid) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReportsByDate?" |
||||
|
+ "assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate |
||||
|
+ "&zone=" + zone |
||||
|
+ "&ward=" + ward |
||||
|
+ "&streetid=" + streetid; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
Object parsed = objectMapper.readValue(response, Object.class); |
||||
|
|
||||
|
|
||||
|
if (parsed instanceof List) { |
||||
|
return (List<Map<String, Object>>) parsed; |
||||
|
} |
||||
|
|
||||
|
Map<String, Object> result = (Map<String, Object>) parsed; |
||||
|
|
||||
|
if (result.containsKey("data")) { |
||||
|
return (List<Map<String, Object>>) result.get("data"); |
||||
|
} |
||||
|
|
||||
|
if (result.containsKey("zoneWise")) { |
||||
|
return (List<Map<String, Object>>) result.get("zoneWise"); |
||||
|
} |
||||
|
|
||||
|
// fallback |
||||
|
return new ArrayList<>(); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,511 @@ |
|||||
|
package com.gcc.commissionerreview.service; |
||||
|
|
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import net.sf.jasperreports.engine.*; |
||||
|
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; |
||||
|
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; |
||||
|
import net.sf.jasperreports.export.SimpleExporterInput; |
||||
|
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput; |
||||
|
import net.sf.jasperreports.export.SimpleXlsxReportConfiguration; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import java.io.InputStream; |
||||
|
import java.time.LocalDate; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class PosterReportService { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
private ObjectMapper objectMapper; |
||||
|
|
||||
|
|
||||
|
public Map<String, Object> fetchZoneData(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReports" |
||||
|
+ "?assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
return objectMapper.readValue(response, Map.class); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new HashMap<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Map<String, Object> fetchWardData(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate,String zone) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReports?" |
||||
|
+ "assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate |
||||
|
+ "&zone=" + zone; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
return objectMapper.readValue(response, Map.class); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new HashMap<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Map<String, Object> fetchStreetData(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate,String zone,String ward) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReports?" |
||||
|
+ "assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate |
||||
|
+ "&zone=" + zone |
||||
|
+ "&ward=" + ward ; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
return objectMapper.readValue(response, Map.class); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new HashMap<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> fetchStreetDetails(Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate, |
||||
|
String zone, |
||||
|
String ward, |
||||
|
String streetid) { |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
String url = "https://gccservices.in/gccofficialapp/api/asset/filterReportsByDate?" |
||||
|
+ "assetTypeId=" + assetTypeId |
||||
|
+ "&fromDate=" + formattedFromDate |
||||
|
+ "&toDate=" + formattedToDate |
||||
|
+ "&zone=" + zone |
||||
|
+ "&ward=" + ward |
||||
|
+ "&streetid=" + streetid; |
||||
|
|
||||
|
String response = restTemplate.getForObject(url, String.class); |
||||
|
|
||||
|
Object parsed = objectMapper.readValue(response, Object.class); |
||||
|
|
||||
|
|
||||
|
if (parsed instanceof List) { |
||||
|
return (List<Map<String, Object>>) parsed; |
||||
|
} |
||||
|
|
||||
|
Map<String, Object> result = (Map<String, Object>) parsed; |
||||
|
|
||||
|
if (result.containsKey("data")) { |
||||
|
return (List<Map<String, Object>>) result.get("data"); |
||||
|
} |
||||
|
|
||||
|
if (result.containsKey("zoneWise")) { |
||||
|
return (List<Map<String, Object>>) result.get("zoneWise"); |
||||
|
} |
||||
|
|
||||
|
// fallback |
||||
|
return new ArrayList<>(); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
System.out.println("Error: " + e.getMessage()); |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void downloadStreetReport( |
||||
|
Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate, |
||||
|
String zone, |
||||
|
String ward, |
||||
|
String streetid, |
||||
|
HttpServletResponse response) throws Exception { |
||||
|
|
||||
|
// EXISTING METHOD CALL |
||||
|
List<Map<String, Object>> data = |
||||
|
fetchStreetDetails( |
||||
|
assetTypeId, |
||||
|
fromDate, |
||||
|
toDate, |
||||
|
zone, |
||||
|
ward, |
||||
|
streetid); |
||||
|
|
||||
|
|
||||
|
|
||||
|
List<Map<String, Object>> finalList = new ArrayList<>(); |
||||
|
|
||||
|
for (Map<String, Object> row : data) { |
||||
|
|
||||
|
String beforeImage = ""; |
||||
|
String afterImage = ""; |
||||
|
|
||||
|
Object feedbackObj = row.get("feedback_file"); |
||||
|
|
||||
|
if (feedbackObj instanceof List<?>) { |
||||
|
|
||||
|
List<?> feedbackFiles = (List<?>) feedbackObj; |
||||
|
|
||||
|
for (Object obj : feedbackFiles) { |
||||
|
|
||||
|
if (obj instanceof Map<?, ?> fileMap) { |
||||
|
|
||||
|
String action = ""; |
||||
|
|
||||
|
if (fileMap.get("fileaction") != null) { |
||||
|
action = |
||||
|
String.valueOf( |
||||
|
fileMap.get("fileaction")); |
||||
|
} |
||||
|
|
||||
|
String imageUrl = ""; |
||||
|
|
||||
|
if (fileMap.get("imageUrl") != null) { |
||||
|
imageUrl = |
||||
|
String.valueOf( |
||||
|
fileMap.get("imageUrl")); |
||||
|
} |
||||
|
|
||||
|
// BEFORE IMAGE |
||||
|
if ("before".equalsIgnoreCase(action)) { |
||||
|
beforeImage = imageUrl; |
||||
|
} |
||||
|
|
||||
|
// AFTER IMAGE |
||||
|
if ("after".equalsIgnoreCase(action)) { |
||||
|
afterImage = imageUrl; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
Map<String, Object> jasperMap = |
||||
|
new HashMap<>(); |
||||
|
|
||||
|
jasperMap.put("zone", |
||||
|
row.get("zone")); |
||||
|
|
||||
|
jasperMap.put("ward", |
||||
|
row.get("ward")); |
||||
|
|
||||
|
jasperMap.put("streetname", |
||||
|
row.get("streetname")); |
||||
|
|
||||
|
jasperMap.put("beforeImage", |
||||
|
beforeImage); |
||||
|
|
||||
|
jasperMap.put("afterImage", |
||||
|
afterImage); |
||||
|
|
||||
|
finalList.add(jasperMap); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
JRBeanCollectionDataSource dataSource = |
||||
|
new JRBeanCollectionDataSource(finalList); |
||||
|
|
||||
|
InputStream inputStream = |
||||
|
getClass().getResourceAsStream( |
||||
|
"/templates/modules/poster/street_details.jrxml"); |
||||
|
|
||||
|
JasperReport jasperReport = |
||||
|
JasperCompileManager.compileReport(inputStream); |
||||
|
|
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
|
||||
|
JasperPrint jasperPrint = |
||||
|
JasperFillManager.fillReport( |
||||
|
jasperReport, |
||||
|
params, |
||||
|
dataSource); |
||||
|
|
||||
|
response.setContentType( |
||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
||||
|
|
||||
|
response.setHeader( |
||||
|
"Content-Disposition", |
||||
|
"attachment; filename=Street_Details_Report.xlsx"); |
||||
|
|
||||
|
JRXlsxExporter exporter = new JRXlsxExporter(); |
||||
|
|
||||
|
exporter.setExporterInput( |
||||
|
new SimpleExporterInput(jasperPrint)); |
||||
|
|
||||
|
exporter.setExporterOutput( |
||||
|
new SimpleOutputStreamExporterOutput( |
||||
|
response.getOutputStream())); |
||||
|
|
||||
|
SimpleXlsxReportConfiguration configuration = |
||||
|
new SimpleXlsxReportConfiguration(); |
||||
|
|
||||
|
configuration.setOnePagePerSheet(false); |
||||
|
configuration.setDetectCellType(true); |
||||
|
configuration.setCollapseRowSpan(false); |
||||
|
configuration.setRemoveEmptySpaceBetweenRows(true); |
||||
|
configuration.setWhitePageBackground(false); |
||||
|
|
||||
|
exporter.setConfiguration(configuration); |
||||
|
|
||||
|
exporter.exportReport(); |
||||
|
|
||||
|
response.flushBuffer(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void downloadStreetPdfReport( |
||||
|
Integer assetTypeId, |
||||
|
String fromDate, |
||||
|
String toDate, |
||||
|
String zone, |
||||
|
String ward, |
||||
|
String streetid, |
||||
|
HttpServletResponse response) throws Exception { |
||||
|
|
||||
|
List<Map<String, Object>> data = |
||||
|
fetchStreetDetails( |
||||
|
assetTypeId, |
||||
|
fromDate, |
||||
|
toDate, |
||||
|
zone, |
||||
|
ward, |
||||
|
streetid); |
||||
|
|
||||
|
|
||||
|
|
||||
|
List<Map<String, Object>> finalList = |
||||
|
new ArrayList<>(); |
||||
|
|
||||
|
for (Map<String, Object> row : data) { |
||||
|
|
||||
|
String beforeImage = ""; |
||||
|
String afterImage = ""; |
||||
|
String removalDate = ""; |
||||
|
|
||||
|
|
||||
|
String enumeratedDate = ""; |
||||
|
|
||||
|
if (row.get("cdate") != null) { |
||||
|
|
||||
|
String fullDate = String.valueOf(row.get("cdate")); |
||||
|
|
||||
|
if (fullDate.contains("T")) { |
||||
|
String datePart = fullDate.split("T")[0]; |
||||
|
String[] parts = datePart.split("-"); |
||||
|
enumeratedDate = parts[2] + "-" + parts[1] + "-" + parts[0]; |
||||
|
} else { |
||||
|
enumeratedDate = fullDate; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// LATITUDE |
||||
|
String latitude = ""; |
||||
|
|
||||
|
if (row.get("latitude") != null) { |
||||
|
latitude = String.valueOf(row.get("latitude")); |
||||
|
} |
||||
|
|
||||
|
// LONGITUDE |
||||
|
String longitude = ""; |
||||
|
|
||||
|
if (row.get("longitude") != null) { |
||||
|
longitude = String.valueOf(row.get("longitude")); |
||||
|
} |
||||
|
|
||||
|
Object feedbackObj = row.get("feedback_file"); |
||||
|
|
||||
|
if (feedbackObj instanceof List<?>) { |
||||
|
|
||||
|
List<?> feedbackFiles = (List<?>) feedbackObj; |
||||
|
|
||||
|
for (Object obj : feedbackFiles) { |
||||
|
|
||||
|
if (obj instanceof Map<?, ?> fileMap) { |
||||
|
|
||||
|
String action = ""; |
||||
|
|
||||
|
if (fileMap.get("fileaction") != null) { |
||||
|
action = |
||||
|
String.valueOf( |
||||
|
fileMap.get("fileaction")); |
||||
|
} |
||||
|
|
||||
|
String imageUrl = ""; |
||||
|
|
||||
|
if (fileMap.get("imageUrl") != null) { |
||||
|
imageUrl = |
||||
|
String.valueOf( |
||||
|
fileMap.get("imageUrl")); |
||||
|
} |
||||
|
|
||||
|
// BEFORE IMAGE |
||||
|
if ("before".equalsIgnoreCase(action)) { |
||||
|
beforeImage = imageUrl; |
||||
|
} |
||||
|
|
||||
|
// AFTER IMAGE + REMOVAL DATE |
||||
|
if ("after".equalsIgnoreCase(action)) { |
||||
|
|
||||
|
afterImage = imageUrl; |
||||
|
|
||||
|
if (fileMap.get("cdate") != null) { |
||||
|
|
||||
|
String removeDate = String.valueOf( |
||||
|
fileMap.get("cdate")); |
||||
|
|
||||
|
if (removeDate.contains("T")) { |
||||
|
String datePart = removeDate.split("T")[0]; |
||||
|
String[] parts = datePart.split("-"); |
||||
|
|
||||
|
removalDate = parts[2] + "-" + parts[1] + "-" + parts[0]; |
||||
|
} else { |
||||
|
removalDate = removeDate; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
Map<String, Object> jasperMap = |
||||
|
new HashMap<>(); |
||||
|
|
||||
|
jasperMap.put("zone", |
||||
|
row.get("zone")); |
||||
|
|
||||
|
jasperMap.put("ward", |
||||
|
row.get("ward")); |
||||
|
|
||||
|
jasperMap.put("latitude", |
||||
|
latitude); |
||||
|
|
||||
|
jasperMap.put("longitude", |
||||
|
longitude); |
||||
|
|
||||
|
jasperMap.put("streetname", |
||||
|
row.get("streetname")); |
||||
|
|
||||
|
jasperMap.put("enumeratedDate", |
||||
|
enumeratedDate); |
||||
|
|
||||
|
jasperMap.put("removalDate", |
||||
|
removalDate); |
||||
|
|
||||
|
jasperMap.put("beforeImage", |
||||
|
beforeImage); |
||||
|
|
||||
|
jasperMap.put("afterImage", |
||||
|
afterImage); |
||||
|
|
||||
|
finalList.add(jasperMap); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
JRBeanCollectionDataSource dataSource = |
||||
|
new JRBeanCollectionDataSource(finalList); |
||||
|
|
||||
|
InputStream inputStream = |
||||
|
getClass().getResourceAsStream( |
||||
|
"/templates/modules/poster/street_details.jrxml"); |
||||
|
|
||||
|
JasperReport jasperReport = |
||||
|
JasperCompileManager.compileReport(inputStream); |
||||
|
|
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedFromDate = LocalDate.parse(fromDate, inputFormat).format(outputFormat); |
||||
|
String formattedToDate = LocalDate.parse(toDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
params.put("zone", zone); |
||||
|
params.put("ward", ward); |
||||
|
params.put("fromDate", formattedFromDate); |
||||
|
params.put("toDate", formattedToDate); |
||||
|
|
||||
|
JasperPrint jasperPrint = |
||||
|
JasperFillManager.fillReport( |
||||
|
jasperReport, |
||||
|
params, |
||||
|
dataSource); |
||||
|
|
||||
|
response.setContentType("application/pdf"); |
||||
|
|
||||
|
response.setHeader( |
||||
|
"Content-Disposition", |
||||
|
"attachment; filename=Street_Details_Report.pdf"); |
||||
|
|
||||
|
JasperExportManager.exportReportToPdfStream( |
||||
|
jasperPrint, |
||||
|
response.getOutputStream()); |
||||
|
|
||||
|
response.flushBuffer(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,887 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<title>Banner Removal Report</title> |
||||
|
|
||||
|
<!-- Bootstrap --> |
||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> |
||||
|
|
||||
|
<!-- DataTables --> |
||||
|
<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"/> |
||||
|
|
||||
|
</head> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
.modal-content.modal-blur { |
||||
|
filter: blur(3px); |
||||
|
opacity: 0.5; |
||||
|
pointer-events: none; |
||||
|
transition: all 0.3s ease; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<body> |
||||
|
|
||||
|
|
||||
|
<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" style="width:3rem; height:3rem;"></div> |
||||
|
<p class="mt-2 text-primary">Please wait...</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="container mt-4"> |
||||
|
|
||||
|
<h4 class="text-center fw-bold mb-3">Banner Removal Report</h4> |
||||
|
|
||||
|
<!-- Date Filter --> |
||||
|
<div class="d-flex justify-content-center gap-3 mb-3"> |
||||
|
<input type="date" id="fromDate" class="form-control w-auto"> |
||||
|
<input type="date" id="toDate" class="form-control w-auto"> |
||||
|
<button id="btnSearch" class="btn btn-primary">Search</button> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Zone Table --> |
||||
|
<table id="zoneTable" class="table table-bordered table-striped"></table> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="wardModal"> |
||||
|
<div class="modal-dialog modal-xl"> |
||||
|
<div class="modal-content"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title" id="wardModalTitle">Ward Wise Details</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<table id="wardTable" class="table table-bordered table-striped"></table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="detailsModal"> |
||||
|
<div class="modal-dialog modal-xl"> |
||||
|
<div class="modal-content"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title" id="streetModalTitle">Street Wise Details</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<table id="detailsTable" class="table table-bordered table-striped"></table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="streetdetailsModal"> |
||||
|
<div class="modal-dialog modal-xl"> |
||||
|
<div class="modal-content"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title">Street Details</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<table id="streetdetailsTable" class="table table-bordered table-striped"></table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="imageModal"> |
||||
|
<div class="modal-dialog modal-lg modal-dialog-centered"> |
||||
|
<div class="modal-content text-center"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title">Image Preview</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<img id="popupImage" |
||||
|
style="width:100%; max-height:500px; object-fit:contain;" /> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- JS --> |
||||
|
<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/dist/js/bootstrap.bundle.min.js"></script> |
||||
|
|
||||
|
<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://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
let table; |
||||
|
let wardTable; |
||||
|
let streetTable; |
||||
|
let streetDetailTable; |
||||
|
let selectedZone = ''; |
||||
|
|
||||
|
function formatOnlyDate(dateStr) { |
||||
|
if (!dateStr) return ''; |
||||
|
|
||||
|
let datePart = dateStr.split('T')[0]; // yyyy-MM-dd |
||||
|
let parts = datePart.split('-'); |
||||
|
|
||||
|
return parts[2] + '-' + parts[1] + '-' + parts[0]; // dd-MM-yyyy |
||||
|
} |
||||
|
|
||||
|
function formatDate(dateStr) { |
||||
|
let parts = dateStr.split("-"); |
||||
|
return parts[2] + "-" + parts[1] + "-" + parts[0]; // dd-MM-yyyy |
||||
|
} |
||||
|
|
||||
|
function getImage(row, type) { |
||||
|
|
||||
|
console.log("ROW DATA:", row); |
||||
|
|
||||
|
|
||||
|
let files = row.feedback_file || []; |
||||
|
|
||||
|
if (!files || !Array.isArray(files) || files.length === 0) { |
||||
|
return '<span style="color:red">No Image</span>'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
let file = files.find(f => f.fileaction === type); |
||||
|
|
||||
|
if (!file) { |
||||
|
return '<span style="color:red">No Image</span>'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
let url = file.imageUrl || file.imageurl || ''; |
||||
|
|
||||
|
if (!url) { |
||||
|
return '<span style="color:red">No Image</span>'; |
||||
|
} |
||||
|
|
||||
|
console.log("IMAGE URL:", url); |
||||
|
|
||||
|
|
||||
|
return ` |
||||
|
<img src="${url}" |
||||
|
style="width:80px;height:80px;object-fit:cover;border-radius:5px;cursor:pointer" |
||||
|
onclick="openImagePopup('${url}')" |
||||
|
onerror="this.style.display='none'" /> |
||||
|
`; |
||||
|
} |
||||
|
|
||||
|
function openImagePopup(url) { |
||||
|
$("#popupImage").attr("src", url); |
||||
|
$("#imageModal").modal("show"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function showLoader() { $("#pageLoader").show(); } |
||||
|
function hideLoader() { $("#pageLoader").hide(); } |
||||
|
|
||||
|
$(document).ready(function () { |
||||
|
|
||||
|
let today = new Date(); |
||||
|
let format = d => d.toISOString().split('T')[0]; |
||||
|
|
||||
|
let todayStr = format(today); |
||||
|
|
||||
|
$("#fromDate").val(todayStr); |
||||
|
$("#toDate").val(todayStr); |
||||
|
|
||||
|
$("#fromDate").attr("max", todayStr); |
||||
|
$("#toDate").attr("max", todayStr); |
||||
|
|
||||
|
loadData(); |
||||
|
|
||||
|
$("#btnSearch").click(loadData); |
||||
|
|
||||
|
$("#fromDate").on("change", function () { |
||||
|
|
||||
|
let fromDate = $(this).val(); |
||||
|
let today = new Date().toISOString().split('T')[0]; |
||||
|
|
||||
|
if (fromDate === today) { |
||||
|
$("#toDate").val(today); |
||||
|
$("#toDate").attr("min", today); |
||||
|
$("#toDate").attr("max", today); |
||||
|
} else { |
||||
|
$("#toDate").attr("min", fromDate); |
||||
|
$("#toDate").attr("max", today); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
function loadData() { |
||||
|
|
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
|
||||
|
if (fromDate > toDate) { |
||||
|
alert("From Date cannot be greater than To Date"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
showLoader(); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/bannerremoval/zone-wise", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
assetTypeId: 59, |
||||
|
fromDate: fromDate, |
||||
|
toDate: toDate |
||||
|
}, |
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res.zoneWise || []; |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#zoneTable')) { |
||||
|
$('#zoneTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
table = $('#zoneTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
filename: 'zone_wise_bannerRemoval' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
filename: 'zone_wise_bannerRemoval', |
||||
|
orientation: 'portrait', |
||||
|
pageSize: 'A4', |
||||
|
|
||||
|
customize: function (doc) { |
||||
|
|
||||
|
doc.content.splice(0, 1); |
||||
|
|
||||
|
let fromDate = formatDate($("#fromDate").val()); |
||||
|
let toDate = formatDate($("#toDate").val()); |
||||
|
|
||||
|
|
||||
|
doc.content[0].alignment = 'center'; |
||||
|
|
||||
|
|
||||
|
doc.content.unshift( |
||||
|
{ |
||||
|
text: 'Zone Wise BannerRemoval Report', |
||||
|
fontSize: 18, |
||||
|
style: 'header', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 10, 0, 5] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'From Date: ' + fromDate + ' To Date: ' + toDate, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 10] |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
let table = doc.content[doc.content.length - 1].table; |
||||
|
table.widths = ['15%', '35%', '35%']; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableHeader = { |
||||
|
bold: true, |
||||
|
fontSize: 11, |
||||
|
color: 'white', |
||||
|
fillColor: '#2c3e50', |
||||
|
alignment: 'center' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableBodyEven = { alignment: 'center' }; |
||||
|
doc.styles.tableBodyOdd = { alignment: 'center' }; |
||||
|
|
||||
|
|
||||
|
doc.content[doc.content.length - 1].layout = { |
||||
|
hLineWidth: function () { return 0.5; }, |
||||
|
vLineWidth: function () { return 0.5; }, |
||||
|
hLineColor: function () { return '#aaa'; }, |
||||
|
vLineColor: function () { return '#aaa'; }, |
||||
|
paddingLeft: function () { return 6; }, |
||||
|
paddingRight: function () { return 6; }, |
||||
|
paddingTop: function () { return 4; }, |
||||
|
paddingBottom: function () { return 4; } |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
|
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
{ |
||||
|
title: "Zone", |
||||
|
data: 'zone', |
||||
|
render: function(data,type,row){ |
||||
|
|
||||
|
if (row.ward === 'Total') { |
||||
|
return `<span class="fw-bold">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
if (row.total_completed == 0) { |
||||
|
return `<span class="text-muted">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
return `<span class="zone-link text-primary fw-bold" style="cursor:pointer">${data}</span>`; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: "Total Closed", |
||||
|
data: 'total_completed' |
||||
|
} |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$('#zoneTable tbody').off('click').on('click','.zone-link', function () { |
||||
|
|
||||
|
let row = table.row($(this).closest('tr')).data(); |
||||
|
selectedZone = row.zone; |
||||
|
$("#wardModalTitle").text("Ward Wise Details - Zone " + selectedZone); |
||||
|
openWardModal(row.zone); |
||||
|
}); |
||||
|
|
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function openWardModal(zone) { |
||||
|
|
||||
|
$('#wardModal').modal('show'); |
||||
|
showLoader(); |
||||
|
|
||||
|
console.log("zone...",zone); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/bannerremoval/ward-wise", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
|
||||
|
assetTypeId: 59, |
||||
|
zone: zone, |
||||
|
|
||||
|
fromDate: $("#fromDate").val(), |
||||
|
toDate: $("#toDate").val() |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res.zoneWise || []; |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#wardTable')) { |
||||
|
$('#wardTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
wardTable = $('#wardTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
filename: `ward_wise_bannerRemoval_zone_${selectedZone}` |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
filename: `ward_wise_bannerRemoval_zone_${selectedZone}`, |
||||
|
orientation: 'portrait', |
||||
|
pageSize: 'A4', |
||||
|
|
||||
|
customize: function (doc) { |
||||
|
|
||||
|
doc.content.splice(0, 1); |
||||
|
|
||||
|
let fromDate = formatDate($("#fromDate").val()); |
||||
|
let toDate = formatDate($("#toDate").val()); |
||||
|
|
||||
|
|
||||
|
doc.content.unshift( |
||||
|
{ |
||||
|
text: 'Ward Wise BannerRemoval Report', |
||||
|
fontSize: 18, |
||||
|
bold: true, |
||||
|
style: 'header', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 10, 0, 5] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'Zone: ' + selectedZone, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 3] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'From Date: ' + fromDate + ' To Date: ' + toDate, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 10] |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
let table = doc.content[doc.content.length - 1].table; |
||||
|
table.widths = ['20%', '40%', '40%']; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableHeader = { |
||||
|
bold: true, |
||||
|
fontSize: 11, |
||||
|
color: 'white', |
||||
|
fillColor: '#2c3e50', |
||||
|
alignment: 'center' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableBodyEven = { alignment: 'center' }; |
||||
|
doc.styles.tableBodyOdd = { alignment: 'center' }; |
||||
|
|
||||
|
|
||||
|
doc.content[doc.content.length - 1].layout = { |
||||
|
hLineWidth: () => 0.5, |
||||
|
vLineWidth: () => 0.5, |
||||
|
hLineColor: () => '#aaa', |
||||
|
vLineColor: () => '#aaa', |
||||
|
paddingLeft: () => 6, |
||||
|
paddingRight: () => 6, |
||||
|
paddingTop: () => 4, |
||||
|
paddingBottom: () => 4 |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
{ |
||||
|
title: "Ward", |
||||
|
data: 'ward', |
||||
|
|
||||
|
|
||||
|
|
||||
|
render: function(data, type, row){ |
||||
|
if (row.ward === 'Total') { |
||||
|
return `<span class="fw-bold">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
if (row.total_completed == 0) { |
||||
|
return `<span class="text-muted">${data}</span>`; |
||||
|
} |
||||
|
return `<span class="ward-link text-primary fw-bold" style="cursor:pointer">${data}</span>`; |
||||
|
} |
||||
|
}, |
||||
|
// { title: "Ward", data: 'ward' }, |
||||
|
{ title: "Total Closed", data: 'total_completed' } |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
$('#wardTable tbody').off('click').on('click','.ward-link', function () { |
||||
|
|
||||
|
let row = wardTable.row($(this).closest('tr')).data(); |
||||
|
|
||||
|
$('#wardModal .modal-content').addClass('modal-blur'); |
||||
|
openStreetModal(row.zone,row.ward); |
||||
|
}); |
||||
|
|
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function openStreetModal(zone, ward) { |
||||
|
|
||||
|
$("#streetModalTitle").html( |
||||
|
`Street Wise Details |
||||
|
<span class="text-primary">(Zone ${zone} - Ward ${ward})</span>` |
||||
|
); |
||||
|
|
||||
|
$('#detailsModal').modal('show'); |
||||
|
showLoader(); |
||||
|
|
||||
|
console.log("zone...",zone); |
||||
|
console.log("ward...",ward); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/bannerremoval/street-wise", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
|
||||
|
assetTypeId: 59, |
||||
|
zone: zone, |
||||
|
ward:ward, |
||||
|
fromDate: $("#fromDate").val(), |
||||
|
toDate: $("#toDate").val() |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res.zoneWise || []; |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#detailsTable')) { |
||||
|
$('#detailsTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
streetTable = $('#detailsTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
filename: `street_wise_bannerRemoval_zone_${zone}_ward_${ward}` |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
filename: `street_wise_bannerRemoval_zone_${zone}_ward_${ward}`, |
||||
|
orientation: 'portrait', |
||||
|
pageSize: 'A4', |
||||
|
|
||||
|
customize: function (doc) { |
||||
|
|
||||
|
doc.content.splice(0, 1); |
||||
|
|
||||
|
let fromDate = formatDate($("#fromDate").val()); |
||||
|
let toDate = formatDate($("#toDate").val()); |
||||
|
|
||||
|
|
||||
|
doc.content.unshift( |
||||
|
{ |
||||
|
text: 'Street Wise BannerRemoval Report', |
||||
|
fontSize: 18, |
||||
|
bold: true, |
||||
|
style: 'header', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 10, 0, 5] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'Zone: ' + zone + ' Ward: ' + ward, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 3] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'From Date: ' + fromDate + ' To Date: ' + toDate, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 10] |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
let tableNode = doc.content.find(c => c.table); |
||||
|
if (tableNode) { |
||||
|
tableNode.table.widths = ['10%', '15%', '15%', '40%', '20%']; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
doc.styles.tableHeader = { |
||||
|
bold: true, |
||||
|
fontSize: 11, |
||||
|
color: 'white', |
||||
|
fillColor: '#2c3e50', |
||||
|
alignment: 'center' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableBodyEven = { alignment: 'center' }; |
||||
|
doc.styles.tableBodyOdd = { alignment: 'center' }; |
||||
|
|
||||
|
|
||||
|
doc.content[doc.content.length - 1].layout = { |
||||
|
hLineWidth: () => 0.5, |
||||
|
vLineWidth: () => 0.5, |
||||
|
hLineColor: () => '#aaa', |
||||
|
vLineColor: () => '#aaa', |
||||
|
paddingLeft: () => 6, |
||||
|
paddingRight: () => 6, |
||||
|
paddingTop: () => 4, |
||||
|
paddingBottom: () => 4 |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
|
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
|
||||
|
{ title: "Zone", data: 'zone' }, |
||||
|
{ title: "Ward", data: 'ward' }, |
||||
|
{ |
||||
|
title: "Street Name", |
||||
|
data: 'streetname', |
||||
|
render: function (data, type, row) { |
||||
|
|
||||
|
|
||||
|
if (!row.streetid) { |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
if (!row.streetid || row.total_completed == 0) { |
||||
|
return `<span class="text-muted">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
return `<span class="street-link text-primary fw-bold" |
||||
|
style="cursor:pointer;"> |
||||
|
${data} |
||||
|
</span>`; |
||||
|
} |
||||
|
}, |
||||
|
// { title: "Street Name", data: 'streetname' }, |
||||
|
{ title: "Total Closed", data: 'total_completed' } |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
$('#detailsTable tbody').off('click').on('click', '.street-link', function () { |
||||
|
|
||||
|
let row = streetTable.row($(this).closest('tr')).data(); |
||||
|
|
||||
|
if (!row) return; |
||||
|
$('#detailsModal .modal-content').addClass('modal-blur'); |
||||
|
|
||||
|
openStreetDetails(row.zone, row.ward, row.streetid); |
||||
|
}); |
||||
|
|
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
function openStreetDetails(zone, ward, streetid) { |
||||
|
|
||||
|
$('#streetdetailsModal').modal('show'); |
||||
|
showLoader(); |
||||
|
|
||||
|
|
||||
|
console.log("zone...",zone); |
||||
|
console.log("ward...",ward); |
||||
|
console.log("streetid...",streetid); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/bannerremoval/street-details", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
|
||||
|
assetTypeId: 59, |
||||
|
zone: zone, |
||||
|
ward:ward, |
||||
|
streetid: streetid, |
||||
|
fromDate: $("#fromDate").val(), |
||||
|
toDate: $("#toDate").val() |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res; |
||||
|
console.log("FINAL DATA:", data); |
||||
|
|
||||
|
// let data = Array.isArray(res) ? res : (res.zoneWise || []); |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#streetdetailsTable')) { |
||||
|
$('#streetdetailsTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
streetDetailTable = $('#streetdetailsTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
text: 'Export PDF', |
||||
|
action: function () { |
||||
|
|
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
|
||||
|
let url = |
||||
|
"/commissionerreview/api/posterremoval/download-street-pdf-report?" |
||||
|
+ "assetTypeId=59" |
||||
|
+ "&fromDate=" + fromDate |
||||
|
+ "&toDate=" + toDate |
||||
|
+ "&zone=" + encodeURIComponent(zone) |
||||
|
+ "&ward=" + encodeURIComponent(ward) |
||||
|
+ "&streetid=" + encodeURIComponent(streetid); |
||||
|
|
||||
|
window.open(url, "_blank"); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
], |
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
|
||||
|
{ title: "Zone", data: 'zone' }, |
||||
|
{ title: "Ward", data: 'ward' }, |
||||
|
{title: "Latitude", data: 'latitude' }, |
||||
|
{title: "Longitude", data: 'longitude' }, |
||||
|
|
||||
|
{ title: "Street Name", data: 'streetname' }, |
||||
|
{ |
||||
|
title: "Enumerated Date", |
||||
|
data: 'cdate', |
||||
|
render: function (data) { |
||||
|
return formatOnlyDate(data); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: "Removal Date", |
||||
|
data: null, |
||||
|
render: function (data, type, row) { |
||||
|
|
||||
|
let files = row.feedback_file || []; |
||||
|
let afterFile = files.find(f => f.fileaction === 'after'); |
||||
|
|
||||
|
if (!afterFile || !afterFile.cdate) { |
||||
|
return '<span style="color:red">No Date</span>'; |
||||
|
} |
||||
|
|
||||
|
return formatOnlyDate(afterFile.cdate); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: "Before Image", |
||||
|
data: null, |
||||
|
render: function (data, type, row) { |
||||
|
return getImage(row, 'before'); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: "After Image", |
||||
|
data: null, |
||||
|
render: function (data, type, row) { |
||||
|
return getImage(row, 'after'); |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}); |
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
$('#wardModal').on('hidden.bs.modal', function () { |
||||
|
|
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#wardTable')) { |
||||
|
$('#wardTable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$('#wardTable').html(''); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
$('#detailsModal').on('hidden.bs.modal', function () { |
||||
|
|
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#detailsTable')) { |
||||
|
$('#detailsTable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$('#detailsTable').html(''); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$('#detailsModal').on('hidden.bs.modal', function () { |
||||
|
$('#wardModal .modal-content').removeClass('modal-blur'); |
||||
|
}); |
||||
|
|
||||
|
$('#streetdetailsModal').on('hidden.bs.modal', function () { |
||||
|
$('#detailsModal .modal-content').removeClass('modal-blur'); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
|
|
||||
|
|
||||
|
|
||||
@ -0,0 +1,917 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<title>Poster Removal Report</title> |
||||
|
|
||||
|
<!-- Bootstrap --> |
||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> |
||||
|
|
||||
|
<!-- DataTables --> |
||||
|
<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"/> |
||||
|
|
||||
|
</head> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
.modal-content.modal-blur { |
||||
|
filter: blur(3px); |
||||
|
opacity: 0.5; |
||||
|
pointer-events: none; |
||||
|
transition: all 0.3s ease; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<body> |
||||
|
|
||||
|
|
||||
|
<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" style="width:3rem; height:3rem;"></div> |
||||
|
<p class="mt-2 text-primary">Please wait...</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="container mt-4"> |
||||
|
|
||||
|
<h4 class="text-center fw-bold mb-3">Poster Removal Report</h4> |
||||
|
|
||||
|
<!-- Date Filter --> |
||||
|
<div class="d-flex justify-content-center gap-3 mb-3"> |
||||
|
<input type="date" id="fromDate" class="form-control w-auto"> |
||||
|
<input type="date" id="toDate" class="form-control w-auto"> |
||||
|
<button id="btnSearch" class="btn btn-primary">Search</button> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Zone Table --> |
||||
|
<table id="zoneTable" class="table table-bordered table-striped"></table> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="wardModal"> |
||||
|
<div class="modal-dialog modal-xl"> |
||||
|
<div class="modal-content"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title" id="wardModalTitle">Ward Wise Details</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<table id="wardTable" class="table table-bordered table-striped"></table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="detailsModal"> |
||||
|
<div class="modal-dialog modal-xl"> |
||||
|
<div class="modal-content"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title" id="streetModalTitle">Street Wise Details</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<table id="detailsTable" class="table table-bordered table-striped"></table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="streetdetailsModal"> |
||||
|
<div class="modal-dialog modal-xl"> |
||||
|
<div class="modal-content"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title">Street Details</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<table id="streetdetailsTable" class="table table-bordered table-striped"></table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="modal fade" id="imageModal"> |
||||
|
<div class="modal-dialog modal-lg modal-dialog-centered"> |
||||
|
<div class="modal-content text-center"> |
||||
|
|
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title">Image Preview</h5> |
||||
|
<button class="btn-close" data-bs-dismiss="modal"></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="modal-body"> |
||||
|
<img id="popupImage" |
||||
|
style="width:100%; max-height:500px; object-fit:contain;" /> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- JS --> |
||||
|
<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/dist/js/bootstrap.bundle.min.js"></script> |
||||
|
|
||||
|
<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://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script> |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
let table; |
||||
|
let wardTable; |
||||
|
let streetTable; |
||||
|
let streetDetailTable; |
||||
|
let selectedZone = ''; |
||||
|
|
||||
|
function formatOnlyDate(dateStr) { |
||||
|
if (!dateStr) return ''; |
||||
|
|
||||
|
let datePart = dateStr.split('T')[0]; // yyyy-MM-dd |
||||
|
let parts = datePart.split('-'); |
||||
|
|
||||
|
return parts[2] + '-' + parts[1] + '-' + parts[0]; // dd-MM-yyyy |
||||
|
} |
||||
|
|
||||
|
function formatDate(dateStr) { |
||||
|
let parts = dateStr.split("-"); |
||||
|
return parts[2] + "-" + parts[1] + "-" + parts[0]; // dd-MM-yyyy |
||||
|
} |
||||
|
|
||||
|
function getImage(row, type) { |
||||
|
|
||||
|
console.log("ROW DATA:", row); |
||||
|
|
||||
|
|
||||
|
let files = row.feedback_file || []; |
||||
|
|
||||
|
if (!files || !Array.isArray(files) || files.length === 0) { |
||||
|
return '<span style="color:red">No Image</span>'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
let file = files.find(f => f.fileaction === type); |
||||
|
|
||||
|
if (!file) { |
||||
|
return '<span style="color:red">No Image</span>'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
let url = file.imageUrl || file.imageurl || ''; |
||||
|
|
||||
|
if (!url) { |
||||
|
return '<span style="color:red">No Image</span>'; |
||||
|
} |
||||
|
|
||||
|
console.log("IMAGE URL:", url); |
||||
|
|
||||
|
|
||||
|
return ` |
||||
|
<img src="${url}" |
||||
|
style="width:80px;height:80px;object-fit:cover;border-radius:5px;cursor:pointer" |
||||
|
onclick="openImagePopup('${url}')" |
||||
|
onerror="this.style.display='none'" /> |
||||
|
`; |
||||
|
} |
||||
|
|
||||
|
function openImagePopup(url) { |
||||
|
$("#popupImage").attr("src", url); |
||||
|
$("#imageModal").modal("show"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function showLoader() { $("#pageLoader").show(); } |
||||
|
function hideLoader() { $("#pageLoader").hide(); } |
||||
|
|
||||
|
$(document).ready(function () { |
||||
|
|
||||
|
let today = new Date(); |
||||
|
let format = d => d.toISOString().split('T')[0]; |
||||
|
|
||||
|
let todayStr = format(today); |
||||
|
|
||||
|
$("#fromDate").val(todayStr); |
||||
|
$("#toDate").val(todayStr); |
||||
|
|
||||
|
$("#fromDate").attr("max", todayStr); |
||||
|
$("#toDate").attr("max", todayStr); |
||||
|
|
||||
|
loadData(); |
||||
|
|
||||
|
$("#btnSearch").click(loadData); |
||||
|
|
||||
|
$("#fromDate").on("change", function () { |
||||
|
|
||||
|
let fromDate = $(this).val(); |
||||
|
let today = new Date().toISOString().split('T')[0]; |
||||
|
|
||||
|
if (fromDate === today) { |
||||
|
$("#toDate").val(today); |
||||
|
$("#toDate").attr("min", today); |
||||
|
$("#toDate").attr("max", today); |
||||
|
} else { |
||||
|
$("#toDate").attr("min", fromDate); |
||||
|
$("#toDate").attr("max", today); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
function loadData() { |
||||
|
|
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
|
||||
|
if (fromDate > toDate) { |
||||
|
alert("From Date cannot be greater than To Date"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
showLoader(); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/posterremoval/zone-wise", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
assetTypeId: 57, |
||||
|
fromDate: fromDate, |
||||
|
toDate: toDate |
||||
|
}, |
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res.zoneWise || []; |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#zoneTable')) { |
||||
|
$('#zoneTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
table = $('#zoneTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
filename: 'zone_wise_posterRemoval' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
filename: 'zone_wise_posterRemoval', |
||||
|
orientation: 'portrait', |
||||
|
pageSize: 'A4', |
||||
|
|
||||
|
customize: function (doc) { |
||||
|
|
||||
|
doc.content.splice(0, 1); |
||||
|
|
||||
|
let fromDate = formatDate($("#fromDate").val()); |
||||
|
let toDate = formatDate($("#toDate").val()); |
||||
|
|
||||
|
|
||||
|
doc.content[0].alignment = 'center'; |
||||
|
|
||||
|
|
||||
|
doc.content.unshift( |
||||
|
{ |
||||
|
text: 'Zone Wise PosterRemoval Report', |
||||
|
fontSize: 18, |
||||
|
style: 'header', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 10, 0, 5] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'From Date: ' + fromDate + ' To Date: ' + toDate, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 10] |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
let table = doc.content[doc.content.length - 1].table; |
||||
|
table.widths = ['15%', '35%', '35%']; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableHeader = { |
||||
|
bold: true, |
||||
|
fontSize: 11, |
||||
|
color: 'white', |
||||
|
fillColor: '#2c3e50', |
||||
|
alignment: 'center' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableBodyEven = { alignment: 'center' }; |
||||
|
doc.styles.tableBodyOdd = { alignment: 'center' }; |
||||
|
|
||||
|
|
||||
|
doc.content[doc.content.length - 1].layout = { |
||||
|
hLineWidth: function () { return 0.5; }, |
||||
|
vLineWidth: function () { return 0.5; }, |
||||
|
hLineColor: function () { return '#aaa'; }, |
||||
|
vLineColor: function () { return '#aaa'; }, |
||||
|
paddingLeft: function () { return 6; }, |
||||
|
paddingRight: function () { return 6; }, |
||||
|
paddingTop: function () { return 4; }, |
||||
|
paddingBottom: function () { return 4; } |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
|
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
{ |
||||
|
title: "Zone", |
||||
|
data: 'zone', |
||||
|
render: function(data,type,row){ |
||||
|
|
||||
|
if (row.ward === 'Total') { |
||||
|
return `<span class="fw-bold">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
if (row.total_completed == 0) { |
||||
|
return `<span class="text-muted">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
return `<span class="zone-link text-primary fw-bold" style="cursor:pointer">${data}</span>`; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: "Total Closed", |
||||
|
data: 'total_completed' |
||||
|
} |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$('#zoneTable tbody').off('click').on('click','.zone-link', function () { |
||||
|
|
||||
|
let row = table.row($(this).closest('tr')).data(); |
||||
|
selectedZone = row.zone; |
||||
|
$("#wardModalTitle").text("Ward Wise Details - Zone " + selectedZone); |
||||
|
openWardModal(row.zone); |
||||
|
}); |
||||
|
|
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function openWardModal(zone) { |
||||
|
|
||||
|
$('#wardModal').modal('show'); |
||||
|
showLoader(); |
||||
|
|
||||
|
console.log("zone...",zone); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/posterremoval/ward-wise", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
|
||||
|
assetTypeId: 57, |
||||
|
zone: zone, |
||||
|
|
||||
|
fromDate: $("#fromDate").val(), |
||||
|
toDate: $("#toDate").val() |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res.zoneWise || []; |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#wardTable')) { |
||||
|
$('#wardTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
wardTable = $('#wardTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
filename: `ward_wise_posterRemoval_zone_${selectedZone}` |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
filename: `ward_wise_posterRemoval_zone_${selectedZone}`, |
||||
|
orientation: 'portrait', |
||||
|
pageSize: 'A4', |
||||
|
|
||||
|
customize: function (doc) { |
||||
|
|
||||
|
doc.content.splice(0, 1); |
||||
|
|
||||
|
let fromDate = formatDate($("#fromDate").val()); |
||||
|
let toDate = formatDate($("#toDate").val()); |
||||
|
|
||||
|
|
||||
|
doc.content.unshift( |
||||
|
{ |
||||
|
text: 'Ward Wise PosterRemoval Report', |
||||
|
fontSize: 18, |
||||
|
bold: true, |
||||
|
style: 'header', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 10, 0, 5] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'Zone: ' + selectedZone, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 3] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'From Date: ' + fromDate + ' To Date: ' + toDate, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 10] |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
let table = doc.content[doc.content.length - 1].table; |
||||
|
table.widths = ['20%', '40%', '40%']; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableHeader = { |
||||
|
bold: true, |
||||
|
fontSize: 11, |
||||
|
color: 'white', |
||||
|
fillColor: '#2c3e50', |
||||
|
alignment: 'center' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableBodyEven = { alignment: 'center' }; |
||||
|
doc.styles.tableBodyOdd = { alignment: 'center' }; |
||||
|
|
||||
|
|
||||
|
doc.content[doc.content.length - 1].layout = { |
||||
|
hLineWidth: () => 0.5, |
||||
|
vLineWidth: () => 0.5, |
||||
|
hLineColor: () => '#aaa', |
||||
|
vLineColor: () => '#aaa', |
||||
|
paddingLeft: () => 6, |
||||
|
paddingRight: () => 6, |
||||
|
paddingTop: () => 4, |
||||
|
paddingBottom: () => 4 |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
/*buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
title: 'Zone Report' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
title: 'Zone Report' |
||||
|
} |
||||
|
],*/ |
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
{ |
||||
|
title: "Ward", |
||||
|
data: 'ward', |
||||
|
|
||||
|
|
||||
|
|
||||
|
render: function(data, type, row){ |
||||
|
if (row.ward === 'Total') { |
||||
|
return `<span class="fw-bold">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
if (row.total_completed == 0) { |
||||
|
return `<span class="text-muted">${data}</span>`; |
||||
|
} |
||||
|
return `<span class="ward-link text-primary fw-bold" style="cursor:pointer">${data}</span>`; |
||||
|
} |
||||
|
}, |
||||
|
// { title: "Ward", data: 'ward' }, |
||||
|
{ title: "Total Closed", data: 'total_completed' } |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
$('#wardTable tbody').off('click').on('click','.ward-link', function () { |
||||
|
|
||||
|
let row = wardTable.row($(this).closest('tr')).data(); |
||||
|
|
||||
|
$('#wardModal .modal-content').addClass('modal-blur'); |
||||
|
openStreetModal(row.zone,row.ward); |
||||
|
}); |
||||
|
|
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function openStreetModal(zone, ward) { |
||||
|
|
||||
|
$("#streetModalTitle").html( |
||||
|
`Street Wise Details |
||||
|
<span class="text-primary">(Zone ${zone} - Ward ${ward})</span>` |
||||
|
); |
||||
|
|
||||
|
$('#detailsModal').modal('show'); |
||||
|
showLoader(); |
||||
|
|
||||
|
console.log("zone...",zone); |
||||
|
console.log("ward...",ward); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/posterremoval/street-wise", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
|
||||
|
assetTypeId: 57, |
||||
|
zone: zone, |
||||
|
ward:ward, |
||||
|
fromDate: $("#fromDate").val(), |
||||
|
toDate: $("#toDate").val() |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res.zoneWise || []; |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#detailsTable')) { |
||||
|
$('#detailsTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
streetTable = $('#detailsTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Export Excel', |
||||
|
filename: `street_wise_posterRemoval_zone_${zone}_ward_${ward}` |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'Export PDF', |
||||
|
filename: `street_wise_posterRemoval_zone_${zone}_ward_${ward}`, |
||||
|
orientation: 'portrait', |
||||
|
pageSize: 'A4', |
||||
|
|
||||
|
customize: function (doc) { |
||||
|
|
||||
|
doc.content.splice(0, 1); |
||||
|
|
||||
|
let fromDate = formatDate($("#fromDate").val()); |
||||
|
let toDate = formatDate($("#toDate").val()); |
||||
|
|
||||
|
|
||||
|
doc.content.unshift( |
||||
|
{ |
||||
|
text: 'Street Wise PosterRemoval Report', |
||||
|
fontSize: 18, |
||||
|
bold: true, |
||||
|
style: 'header', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 10, 0, 5] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'Zone: ' + zone + ' Ward: ' + ward, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 3] |
||||
|
}, |
||||
|
{ |
||||
|
text: 'From Date: ' + fromDate + ' To Date: ' + toDate, |
||||
|
style: 'subheader', |
||||
|
alignment: 'center', |
||||
|
margin: [0, 0, 0, 10] |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
let tableNode = doc.content.find(c => c.table); |
||||
|
if (tableNode) { |
||||
|
tableNode.table.widths = ['10%', '15%', '15%', '40%', '20%']; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
doc.styles.tableHeader = { |
||||
|
bold: true, |
||||
|
fontSize: 11, |
||||
|
color: 'white', |
||||
|
fillColor: '#2c3e50', |
||||
|
alignment: 'center' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
doc.styles.tableBodyEven = { alignment: 'center' }; |
||||
|
doc.styles.tableBodyOdd = { alignment: 'center' }; |
||||
|
|
||||
|
|
||||
|
doc.content[doc.content.length - 1].layout = { |
||||
|
hLineWidth: () => 0.5, |
||||
|
vLineWidth: () => 0.5, |
||||
|
hLineColor: () => '#aaa', |
||||
|
vLineColor: () => '#aaa', |
||||
|
paddingLeft: () => 6, |
||||
|
paddingRight: () => 6, |
||||
|
paddingTop: () => 4, |
||||
|
paddingBottom: () => 4 |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
|
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
|
||||
|
{ title: "Zone", data: 'zone' }, |
||||
|
{ title: "Ward", data: 'ward' }, |
||||
|
{ |
||||
|
title: "Street Name", |
||||
|
data: 'streetname', |
||||
|
render: function (data, type, row) { |
||||
|
|
||||
|
|
||||
|
if (!row.streetid) { |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
if (!row.streetid || row.total_completed == 0) { |
||||
|
return `<span class="text-muted">${data}</span>`; |
||||
|
} |
||||
|
|
||||
|
return `<span class="street-link text-primary fw-bold" |
||||
|
style="cursor:pointer;"> |
||||
|
${data} |
||||
|
</span>`; |
||||
|
} |
||||
|
}, |
||||
|
// { title: "Street Name", data: 'streetname' }, |
||||
|
{ title: "Total Closed", data: 'total_completed' } |
||||
|
] |
||||
|
}); |
||||
|
|
||||
|
$('#detailsTable tbody').off('click').on('click', '.street-link', function () { |
||||
|
|
||||
|
let row = streetTable.row($(this).closest('tr')).data(); |
||||
|
|
||||
|
if (!row) return; |
||||
|
$('#detailsModal .modal-content').addClass('modal-blur'); |
||||
|
|
||||
|
openStreetDetails(row.zone, row.ward, row.streetid); |
||||
|
}); |
||||
|
|
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
function openStreetDetails(zone, ward, streetid) { |
||||
|
|
||||
|
$('#streetdetailsModal').modal('show'); |
||||
|
showLoader(); |
||||
|
|
||||
|
|
||||
|
console.log("zone...",zone); |
||||
|
console.log("ward...",ward); |
||||
|
console.log("streetid...",streetid); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/commissionerreview/api/posterremoval/street-details", |
||||
|
type: "GET", |
||||
|
data: { |
||||
|
|
||||
|
assetTypeId: 57, |
||||
|
zone: zone, |
||||
|
ward:ward, |
||||
|
streetid: streetid, |
||||
|
fromDate: $("#fromDate").val(), |
||||
|
toDate: $("#toDate").val() |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
success: function (res) { |
||||
|
|
||||
|
let data = res; |
||||
|
console.log("FINAL DATA:", data); |
||||
|
|
||||
|
// let data = Array.isArray(res) ? res : (res.zoneWise || []); |
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#streetdetailsTable')) { |
||||
|
$('#streetdetailsTable').DataTable().destroy(); |
||||
|
} |
||||
|
|
||||
|
streetDetailTable = $('#streetdetailsTable').DataTable({ |
||||
|
data: data, |
||||
|
destroy: true, |
||||
|
dom: 'Bfrtip', |
||||
|
paging: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
text: 'Export PDF', |
||||
|
action: function () { |
||||
|
|
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
|
||||
|
let url = |
||||
|
"/commissionerreview/api/posterremoval/download-street-pdf-report?" |
||||
|
+ "assetTypeId=57" |
||||
|
+ "&fromDate=" + fromDate |
||||
|
+ "&toDate=" + toDate |
||||
|
+ "&zone=" + encodeURIComponent(zone) |
||||
|
+ "&ward=" + encodeURIComponent(ward) |
||||
|
+ "&streetid=" + encodeURIComponent(streetid); |
||||
|
|
||||
|
window.open(url, "_blank"); |
||||
|
} |
||||
|
}, |
||||
|
/*{ |
||||
|
text: 'Export Excel', |
||||
|
action: function () { |
||||
|
|
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
|
||||
|
let url = |
||||
|
"/commissionerreview/api/posterremoval/download-street-report?" |
||||
|
+ "assetTypeId=57" |
||||
|
+ "&fromDate=" + fromDate |
||||
|
+ "&toDate=" + toDate |
||||
|
+ "&zone=" + encodeURIComponent(zone) |
||||
|
+ "&ward=" + encodeURIComponent(ward) |
||||
|
+ "&streetid=" + encodeURIComponent(streetid); |
||||
|
|
||||
|
window.open(url, "_blank"); |
||||
|
} |
||||
|
}*/ |
||||
|
], |
||||
|
|
||||
|
columns: [ |
||||
|
{ |
||||
|
title: "S.No", |
||||
|
data: null, |
||||
|
render: (d,t,r,m)=>m.row+1 |
||||
|
}, |
||||
|
|
||||
|
{ title: "Zone", data: 'zone' }, |
||||
|
{ title: "Ward", data: 'ward' }, |
||||
|
{title: "Latitude", data: 'latitude' }, |
||||
|
{title: "Longitude", data: 'longitude' }, |
||||
|
|
||||
|
{ title: "Street Name", data: 'streetname' }, |
||||
|
{ |
||||
|
title: "Enumerated Date", |
||||
|
data: 'cdate', |
||||
|
render: function (data) { |
||||
|
return formatOnlyDate(data); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: "Removal Date", |
||||
|
data: null, |
||||
|
render: function (data, type, row) { |
||||
|
|
||||
|
let files = row.feedback_file || []; |
||||
|
let afterFile = files.find(f => f.fileaction === 'after'); |
||||
|
|
||||
|
if (!afterFile || !afterFile.cdate) { |
||||
|
return '<span style="color:red">No Date</span>'; |
||||
|
} |
||||
|
|
||||
|
return formatOnlyDate(afterFile.cdate); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: "Before Image", |
||||
|
data: null, |
||||
|
render: function (data, type, row) { |
||||
|
return getImage(row, 'before'); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: "After Image", |
||||
|
data: null, |
||||
|
render: function (data, type, row) { |
||||
|
return getImage(row, 'after'); |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}); |
||||
|
hideLoader(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
$('#wardModal').on('hidden.bs.modal', function () { |
||||
|
|
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#wardTable')) { |
||||
|
$('#wardTable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$('#wardTable').html(''); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
$('#detailsModal').on('hidden.bs.modal', function () { |
||||
|
|
||||
|
|
||||
|
if ($.fn.DataTable.isDataTable('#detailsTable')) { |
||||
|
$('#detailsTable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$('#detailsTable').html(''); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$('#detailsModal').on('hidden.bs.modal', function () { |
||||
|
$('#wardModal .modal-content').removeClass('modal-blur'); |
||||
|
}); |
||||
|
|
||||
|
$('#streetdetailsModal').on('hidden.bs.modal', function () { |
||||
|
$('#detailsModal .modal-content').removeClass('modal-blur'); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
|
|
||||
|
|
||||
|
|
||||
@ -0,0 +1,362 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
|
||||
|
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports |
||||
|
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" |
||||
|
name="street_details" |
||||
|
pageWidth="1220" |
||||
|
pageHeight="842" |
||||
|
orientation="Landscape" |
||||
|
columnWidth="1180" |
||||
|
leftMargin="20" |
||||
|
rightMargin="20" |
||||
|
topMargin="20" |
||||
|
bottomMargin="20" |
||||
|
uuid="123e4567-e89b-12d3-a456-426614174000"> |
||||
|
|
||||
|
<parameter name="zone" class="java.lang.String"/> |
||||
|
<parameter name="ward" class="java.lang.String"/> |
||||
|
<parameter name="fromDate" class="java.lang.String"/> |
||||
|
<parameter name="toDate" class="java.lang.String"/> |
||||
|
|
||||
|
<!-- ===================================================== --> |
||||
|
<!-- FIELDS --> |
||||
|
<!-- ===================================================== --> |
||||
|
|
||||
|
<field name="zone" class="java.lang.String"/> |
||||
|
<field name="ward" class="java.lang.String"/> |
||||
|
<field name="latitude" class="java.lang.String"/> |
||||
|
<field name="longitude" class="java.lang.String"/> |
||||
|
<field name="streetname" class="java.lang.String"/> |
||||
|
<field name="enumeratedDate" class="java.lang.String"/> |
||||
|
<field name="removalDate" class="java.lang.String"/> |
||||
|
<field name="beforeImage" class="java.lang.String"/> |
||||
|
<field name="afterImage" class="java.lang.String"/> |
||||
|
|
||||
|
<!-- ===================================================== --> |
||||
|
<!-- TITLE --> |
||||
|
<!-- ===================================================== --> |
||||
|
|
||||
|
<title> |
||||
|
<band height="90"> |
||||
|
|
||||
|
<!-- REPORT TITLE --> |
||||
|
<textField> |
||||
|
<reportElement x="0" y="0" width="1180" height="25"/> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="18" isBold="true"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA["Street Details Report"]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- ZONE + WARD --> |
||||
|
<textField> |
||||
|
<reportElement x="0" y="30" width="1180" height="20"/> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="14" isBold="true"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[ |
||||
|
"Zone: " + $P{zone} + " Ward: " + $P{ward} |
||||
|
]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- FROM DATE + TO DATE --> |
||||
|
<textField> |
||||
|
<reportElement x="0" y="55" width="1180" height="20"/> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[ |
||||
|
"From Date: " + $P{fromDate} + " To Date: " + $P{toDate} |
||||
|
]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
</band> |
||||
|
</title> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<columnHeader> |
||||
|
<band height="40"> |
||||
|
|
||||
|
<!-- S.NO --> |
||||
|
<staticText> |
||||
|
<reportElement x="0" y="0" width="50" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[S.No]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- ZONE --> |
||||
|
<staticText> |
||||
|
<reportElement x="50" y="0" width="70" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Zone]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- WARD --> |
||||
|
<staticText> |
||||
|
<reportElement x="120" y="0" width="70" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Ward]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- LATITUDE --> |
||||
|
<staticText> |
||||
|
<reportElement x="190" y="0" width="170" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Latitude]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- LONGITUDE --> |
||||
|
<staticText> |
||||
|
<reportElement x="360" y="0" width="170" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Longitude]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- STREET --> |
||||
|
<staticText> |
||||
|
<reportElement x="530" y="0" width="160" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Street Name]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- ENUMERATED DATE --> |
||||
|
<staticText> |
||||
|
<reportElement x="690" y="0" width="110" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Enumerated Date]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- REMOVAL DATE --> |
||||
|
<staticText> |
||||
|
<reportElement x="800" y="0" width="110" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Removal Date]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- BEFORE IMAGE --> |
||||
|
<staticText> |
||||
|
<reportElement x="910" y="0" width="135" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[Before Image]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
<!-- AFTER IMAGE --> |
||||
|
<staticText> |
||||
|
<reportElement x="1045" y="0" width="135" height="40" |
||||
|
backcolor="#D9D9D9" |
||||
|
mode="Opaque"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font isBold="true" size="14"/> |
||||
|
</textElement> |
||||
|
<text><![CDATA[After Image]]></text> |
||||
|
</staticText> |
||||
|
|
||||
|
</band> |
||||
|
</columnHeader> |
||||
|
|
||||
|
<!-- ===================================================== --> |
||||
|
<!-- DETAIL --> |
||||
|
<!-- ===================================================== --> |
||||
|
|
||||
|
<detail> |
||||
|
<band height="120"> |
||||
|
|
||||
|
<!-- S.NO --> |
||||
|
<textField> |
||||
|
<reportElement x="0" y="0" width="50" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- ZONE --> |
||||
|
<textField> |
||||
|
<reportElement x="50" y="0" width="70" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{zone}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- WARD --> |
||||
|
<textField> |
||||
|
<reportElement x="120" y="0" width="70" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{ward}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- LATITUDE --> |
||||
|
<textField> |
||||
|
<reportElement x="190" y="0" width="170" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{latitude}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- LONGITUDE --> |
||||
|
<textField> |
||||
|
<reportElement x="360" y="0" width="170" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{longitude}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- STREET NAME --> |
||||
|
<textField isStretchWithOverflow="true"> |
||||
|
<reportElement x="530" y="0" width="160" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Left" verticalAlignment="Middle"> |
||||
|
<font size= "14"/> |
||||
|
<paragraph leftIndent="5"/> |
||||
|
|
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{streetname}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- ENUMERATED DATE --> |
||||
|
<textField> |
||||
|
<reportElement x="690" y="0" width="110" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{enumeratedDate}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- REMOVAL DATE --> |
||||
|
<textField> |
||||
|
<reportElement x="800" y="0" width="110" height="120"/> |
||||
|
<box><pen lineWidth="1"/></box> |
||||
|
<textElement textAlignment="Center" verticalAlignment="Middle"> |
||||
|
<font size="12"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[$F{removalDate}]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
<!-- BEFORE IMAGE --> |
||||
|
<image scaleImage="FillFrame" onErrorType="Blank"> |
||||
|
|
||||
|
<reportElement x="910" y="10" |
||||
|
width="135" |
||||
|
height="100"/> |
||||
|
|
||||
|
<box> |
||||
|
<pen lineWidth="1"/> |
||||
|
</box> |
||||
|
|
||||
|
<imageExpression class="java.net.URL"><![CDATA[ |
||||
|
($F{beforeImage} != null |
||||
|
&& !$F{beforeImage}.toString().trim().isEmpty()) |
||||
|
? |
||||
|
new java.net.URL($F{beforeImage}.toString()) |
||||
|
: |
||||
|
null |
||||
|
]]></imageExpression> |
||||
|
|
||||
|
</image> |
||||
|
|
||||
|
<!-- AFTER IMAGE --> |
||||
|
<image scaleImage="FillFrame" onErrorType="Blank"> |
||||
|
|
||||
|
<reportElement x="1045" y="10" |
||||
|
width="135" |
||||
|
height="100"/> |
||||
|
|
||||
|
<box> |
||||
|
<pen lineWidth="1"/> |
||||
|
</box> |
||||
|
|
||||
|
<imageExpression class="java.net.URL"><![CDATA[ |
||||
|
($F{afterImage} != null |
||||
|
&& !$F{afterImage}.toString().trim().isEmpty()) |
||||
|
? |
||||
|
new java.net.URL($F{afterImage}.toString()) |
||||
|
: |
||||
|
null |
||||
|
]]></imageExpression> |
||||
|
|
||||
|
</image> |
||||
|
|
||||
|
</band> |
||||
|
</detail> |
||||
|
|
||||
|
<!-- ===================================================== --> |
||||
|
<!-- FOOTER --> |
||||
|
<!-- ===================================================== --> |
||||
|
|
||||
|
<pageFooter> |
||||
|
<band height="25"> |
||||
|
|
||||
|
<textField> |
||||
|
<reportElement x="0" y="5" width="1180" height="20"/> |
||||
|
<textElement textAlignment="Right"> |
||||
|
<font size="10" isBold="true"/> |
||||
|
</textElement> |
||||
|
<textFieldExpression><![CDATA[ |
||||
|
"Page " + $V{PAGE_NUMBER} |
||||
|
]]></textFieldExpression> |
||||
|
</textField> |
||||
|
|
||||
|
</band> |
||||
|
</pageFooter> |
||||
|
|
||||
|
</jasperReport> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue