20 changed files with 9803 additions and 13 deletions
-
41pom.xml
-
44src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
-
79src/main/java/com/gcc/commissionerreview/controller/BannerRemovalApiController.java
-
50src/main/java/com/gcc/commissionerreview/controller/IeComplaintsApiController.java
-
25src/main/java/com/gcc/commissionerreview/controller/MainController.java
-
128src/main/java/com/gcc/commissionerreview/controller/PosterRemovalApiController.java
-
46src/main/java/com/gcc/commissionerreview/controller/StreetVendorApiController.java
-
100src/main/java/com/gcc/commissionerreview/controller/TenementController.java
-
164src/main/java/com/gcc/commissionerreview/service/BannerApiService.java
-
825src/main/java/com/gcc/commissionerreview/service/IeComplaintsService.java
-
511src/main/java/com/gcc/commissionerreview/service/PosterReportService.java
-
475src/main/java/com/gcc/commissionerreview/service/StreetVendorService.java
-
988src/main/java/com/gcc/commissionerreview/service/TenementService.java
-
59src/main/resources/templates/modules/pet/petreport.html
-
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
-
543src/main/resources/templates/modules/streetvendor/inspectiondetails.html
-
577src/main/resources/templates/modules/streetvendor/overalldetails.html
-
2995src/main/resources/templates/modules/vendorreport.html
@ -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,46 @@ |
|||
package com.gcc.commissionerreview.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.gcc.commissionerreview.service.StreetVendorService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/streetvendor") |
|||
public class StreetVendorApiController { |
|||
|
|||
@Autowired |
|||
private StreetVendorService stvservice; |
|||
|
|||
@GetMapping("/getzoneoveralldetails") |
|||
public List<Map<String, Object>> getzoneoveralldetails(@RequestParam String fromdate,@RequestParam String todate) |
|||
{ |
|||
|
|||
return stvservice.getzoneoveralldetails(fromdate,todate); |
|||
} |
|||
|
|||
@GetMapping("/getwardoveralldetails") |
|||
public List<Map<String, Object>> getwardoveralldetails(@RequestParam String fromdate,@RequestParam String todate,@RequestParam String zone) |
|||
{ |
|||
return stvservice.getwardoveralldetails(fromdate, todate, zone); |
|||
} |
|||
|
|||
@GetMapping("/getzoneinspectiondetails") |
|||
public List<Map<String, Object>> getzoneinspectiondetails(@RequestParam String fromdate,@RequestParam String todate) |
|||
{ |
|||
return stvservice.getzoneinspectiondetails(fromdate,todate); |
|||
} |
|||
|
|||
@GetMapping("/getwardinspectiondetails") |
|||
public List<Map<String, Object>> getwardinspectiondetails(@RequestParam String fromdate,@RequestParam String todate,@RequestParam String zone) |
|||
{ |
|||
return stvservice.getwardinspectiondetails(fromdate,todate,zone); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,100 @@ |
|||
package com.gcc.commissionerreview.controller; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.gcc.commissionerreview.service.IeComplaintsService; |
|||
import com.gcc.commissionerreview.service.TenementService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/tenement") |
|||
|
|||
public class TenementController { |
|||
|
|||
@Autowired |
|||
private TenementService tenementService; |
|||
|
|||
@GetMapping("/tenementDashboard") |
|||
public ResponseEntity<Map<String, Object>> getTenementDashboard( |
|||
|
|||
@RequestParam String fromDate, |
|||
@RequestParam String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
tenementService.getTenementDashboard( |
|||
fromDate, |
|||
toDate)); |
|||
} |
|||
|
|||
@GetMapping("/zoneActivity") |
|||
public ResponseEntity<Map<String, Object>> zoneActivity( |
|||
|
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
tenementService.getZoneActivity(fromDate, toDate)); |
|||
} |
|||
|
|||
@GetMapping("/wardActivity") |
|||
public ResponseEntity<Map<String, Object>> wardActivity( |
|||
|
|||
@RequestParam String zone, |
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
tenementService.getWardActivity( |
|||
zone, |
|||
fromDate, |
|||
toDate)); |
|||
} |
|||
// ================= CONTROLLER ================= |
|||
|
|||
@GetMapping("/getSchemeWiseReport") |
|||
public ResponseEntity<Map<String, Object>> getSchemeWiseReport( |
|||
|
|||
@RequestParam String ward, |
|||
|
|||
@RequestParam(required = false) String fromDate, |
|||
|
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return ResponseEntity.ok( |
|||
|
|||
tenementService.getSchemeWiseReport( |
|||
ward, |
|||
fromDate, |
|||
toDate)); |
|||
} |
|||
|
|||
@GetMapping("/getComplaintDetails") |
|||
public Map<String, Object> getComplaintDetails( |
|||
|
|||
@RequestParam String ward, |
|||
@RequestParam String schemeid, |
|||
@RequestParam(required = false) String status, |
|||
|
|||
@RequestParam(required = false) String fromDate, |
|||
@RequestParam(required = false) String toDate) { |
|||
|
|||
return tenementService.getComplaintDetails( |
|||
ward, |
|||
schemeid, |
|||
status, |
|||
|
|||
fromDate, |
|||
toDate); |
|||
} |
|||
|
|||
} |
|||
@ -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,475 @@ |
|||
package com.gcc.commissionerreview.service; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.core.env.Environment; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
@Service |
|||
public class StreetVendorService { |
|||
|
|||
private final Environment environment; |
|||
|
|||
private String fileBaseUrl; |
|||
|
|||
@Autowired |
|||
private JdbcTemplate gccstrTemplate; |
|||
|
|||
@Autowired |
|||
private JdbcTemplate vendingcommitteTemplate; |
|||
|
|||
public StreetVendorService(Environment environment) { |
|||
this.environment = environment; |
|||
this.fileBaseUrl = environment.getProperty("fileBaseUrl"); |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource1(@Qualifier("mysqlVendingCommitteeDataSource") DataSource dataSource) { |
|||
this.vendingcommitteTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource2(@Qualifier("mysqlStreetVendorDataSource") DataSource dataSource) { |
|||
this.gccstrTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getzoneoveralldetails(String fromdate, String todate) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append(" SELECT "); |
|||
sql.append(" vd.zone AS zone, "); |
|||
|
|||
// 1. Application Received |
|||
sql.append(" COUNT(DISTINCT vd.id) AS application_received, "); |
|||
|
|||
// 2. Assistant Processed |
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vd.tamil_name IS NOT NULL AND vd.tamil_name <> '' "); |
|||
sql.append(" AND vd.tamil_f_h_name IS NOT NULL AND vd.tamil_f_h_name <> '' "); |
|||
sql.append(" AND vd.tamil_landmark IS NOT NULL AND vd.tamil_landmark <> '' "); |
|||
sql.append(" AND vd.tamil_gender IS NOT NULL AND vd.tamil_gender <> '' "); |
|||
sql.append(" AND vd.tamil_present_district IS NOT NULL AND vd.tamil_present_district <> '' "); |
|||
sql.append(" AND vd.tamil_vending_category IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) AS assistant_processed, "); |
|||
|
|||
// 3. LI Processed |
|||
sql.append(" COUNT(DISTINCT va1.vdid) AS li_processed, "); |
|||
|
|||
// 4. ARO Processed |
|||
sql.append(" COUNT(DISTINCT va2.vdid) AS aro_processed, "); |
|||
|
|||
// 5. EE Processed |
|||
sql.append(" COUNT(DISTINCT va3.vdid) AS ee_processed, "); |
|||
|
|||
// 6. Committee Processed |
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.vdid IS NOT NULL OR vpl.vdid IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) AS committee_processed, "); |
|||
|
|||
// 7. Total Processed |
|||
sql.append(" ( "); |
|||
|
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vd.tamil_name IS NOT NULL AND vd.tamil_name <> '' "); |
|||
sql.append(" AND vd.tamil_f_h_name IS NOT NULL AND vd.tamil_f_h_name <> '' "); |
|||
sql.append(" AND vd.tamil_landmark IS NOT NULL AND vd.tamil_landmark <> '' "); |
|||
sql.append(" AND vd.tamil_gender IS NOT NULL AND vd.tamil_gender <> '' "); |
|||
sql.append(" AND vd.tamil_present_district IS NOT NULL AND vd.tamil_present_district <> '' "); |
|||
sql.append(" AND vd.tamil_vending_category IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT va1.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va2.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va3.vdid) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.vdid IS NOT NULL OR vpl.vdid IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" ) AS total_processed, "); |
|||
|
|||
// 8. Pending |
|||
sql.append(" ( "); |
|||
sql.append(" COUNT(DISTINCT vd.id) - "); |
|||
|
|||
sql.append(" ( "); |
|||
|
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vd.tamil_name IS NOT NULL AND vd.tamil_name <> '' "); |
|||
sql.append(" AND vd.tamil_f_h_name IS NOT NULL AND vd.tamil_f_h_name <> '' "); |
|||
sql.append(" AND vd.tamil_landmark IS NOT NULL AND vd.tamil_landmark <> '' "); |
|||
sql.append(" AND vd.tamil_gender IS NOT NULL AND vd.tamil_gender <> '' "); |
|||
sql.append(" AND vd.tamil_present_district IS NOT NULL AND vd.tamil_present_district <> '' "); |
|||
sql.append(" AND vd.tamil_vending_category IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT va1.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va2.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va3.vdid) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.vdid IS NOT NULL OR vpl.vdid IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" ) "); |
|||
|
|||
sql.append(" ) AS pending, "); |
|||
|
|||
// 9. Processed within 30 days |
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.cdate IS NOT NULL "); |
|||
sql.append(" AND DATEDIFF(vrl.cdate, vd.cdate) <= 30 "); |
|||
sql.append(" THEN vd.id "); |
|||
|
|||
sql.append(" WHEN vpl.cdate IS NOT NULL "); |
|||
sql.append(" AND DATEDIFF(vpl.cdate, vd.cdate) <= 30 "); |
|||
sql.append(" THEN vd.id "); |
|||
|
|||
sql.append(" END) AS processed_within_30_days "); |
|||
|
|||
sql.append(" FROM gcc_street_vendor.vendor_details vd "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_1 va1 "); |
|||
sql.append(" ON va1.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_2 va2 "); |
|||
sql.append(" ON va2.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_3 va3 "); |
|||
sql.append(" ON va3.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN vendingcommitte.vendor_request_list vrl "); |
|||
sql.append(" ON vrl.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN vendingcommitte.vendor_postponed_list vpl "); |
|||
sql.append(" ON vpl.vdid = vd.id "); |
|||
|
|||
sql.append(" WHERE vd.isactive = 1 "); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromdate != null && !fromdate.isEmpty() |
|||
&& todate != null && !todate.isEmpty()) { |
|||
|
|||
sql.append(" AND DATE(vd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromdate); |
|||
params.add(todate); |
|||
} |
|||
|
|||
sql.append(" AND vd.zone IS NOT NULL "); |
|||
|
|||
sql.append(" GROUP BY vd.zone "); |
|||
sql.append(" ORDER BY vd.zone "); |
|||
|
|||
List<Map<String, Object>> reportList = |
|||
gccstrTemplate.queryForList(sql.toString(), params.toArray()); |
|||
|
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message", "Zone-wise Report"); |
|||
response.put("data", reportList); |
|||
|
|||
return Collections.singletonList(response); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getwardoveralldetails(String fromdate, String todate, String zone) { |
|||
|
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append(" SELECT "); |
|||
sql.append(" vd.ward AS ward, "); |
|||
|
|||
// 1. Application Received |
|||
sql.append(" COUNT(DISTINCT vd.id) AS application_received, "); |
|||
|
|||
// 2. Assistant Processed |
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vd.tamil_name IS NOT NULL AND vd.tamil_name <> '' "); |
|||
sql.append(" AND vd.tamil_f_h_name IS NOT NULL AND vd.tamil_f_h_name <> '' "); |
|||
sql.append(" AND vd.tamil_landmark IS NOT NULL AND vd.tamil_landmark <> '' "); |
|||
sql.append(" AND vd.tamil_gender IS NOT NULL AND vd.tamil_gender <> '' "); |
|||
sql.append(" AND vd.tamil_present_district IS NOT NULL AND vd.tamil_present_district <> '' "); |
|||
sql.append(" AND vd.tamil_vending_category IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) AS assistant_processed, "); |
|||
|
|||
// 3. LI Processed |
|||
sql.append(" COUNT(DISTINCT va1.vdid) AS li_processed, "); |
|||
|
|||
// 4. ARO Processed |
|||
sql.append(" COUNT(DISTINCT va2.vdid) AS aro_processed, "); |
|||
|
|||
// 5. EE Processed |
|||
sql.append(" COUNT(DISTINCT va3.vdid) AS ee_processed, "); |
|||
|
|||
// 6. Committee Processed |
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.vdid IS NOT NULL OR vpl.vdid IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) AS committee_processed, "); |
|||
|
|||
// 7. Total Processed |
|||
sql.append(" ( "); |
|||
|
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vd.tamil_name IS NOT NULL AND vd.tamil_name <> '' "); |
|||
sql.append(" AND vd.tamil_f_h_name IS NOT NULL AND vd.tamil_f_h_name <> '' "); |
|||
sql.append(" AND vd.tamil_landmark IS NOT NULL AND vd.tamil_landmark <> '' "); |
|||
sql.append(" AND vd.tamil_gender IS NOT NULL AND vd.tamil_gender <> '' "); |
|||
sql.append(" AND vd.tamil_present_district IS NOT NULL AND vd.tamil_present_district <> '' "); |
|||
sql.append(" AND vd.tamil_vending_category IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT va1.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va2.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va3.vdid) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.vdid IS NOT NULL OR vpl.vdid IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" ) AS total_processed, "); |
|||
|
|||
// 8. Pending |
|||
sql.append(" ( "); |
|||
sql.append(" COUNT(DISTINCT vd.id) - "); |
|||
|
|||
sql.append(" ( "); |
|||
|
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vd.tamil_name IS NOT NULL AND vd.tamil_name <> '' "); |
|||
sql.append(" AND vd.tamil_f_h_name IS NOT NULL AND vd.tamil_f_h_name <> '' "); |
|||
sql.append(" AND vd.tamil_landmark IS NOT NULL AND vd.tamil_landmark <> '' "); |
|||
sql.append(" AND vd.tamil_gender IS NOT NULL AND vd.tamil_gender <> '' "); |
|||
sql.append(" AND vd.tamil_present_district IS NOT NULL AND vd.tamil_present_district <> '' "); |
|||
sql.append(" AND vd.tamil_vending_category IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT va1.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va2.vdid) "); |
|||
sql.append(" + COUNT(DISTINCT va3.vdid) "); |
|||
|
|||
sql.append(" + COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.vdid IS NOT NULL OR vpl.vdid IS NOT NULL "); |
|||
sql.append(" THEN vd.id "); |
|||
sql.append(" END) "); |
|||
|
|||
sql.append(" ) "); |
|||
|
|||
sql.append(" ) AS pending, "); |
|||
|
|||
// 9. Processed within 30 days |
|||
sql.append(" COUNT(DISTINCT CASE "); |
|||
sql.append(" WHEN vrl.cdate IS NOT NULL "); |
|||
sql.append(" AND DATEDIFF(vrl.cdate, vd.cdate) <= 30 "); |
|||
sql.append(" THEN vd.id "); |
|||
|
|||
sql.append(" WHEN vpl.cdate IS NOT NULL "); |
|||
sql.append(" AND DATEDIFF(vpl.cdate, vd.cdate) <= 30 "); |
|||
sql.append(" THEN vd.id "); |
|||
|
|||
sql.append(" END) AS processed_within_30_days "); |
|||
|
|||
sql.append(" FROM gcc_street_vendor.vendor_details vd "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_1 va1 "); |
|||
sql.append(" ON va1.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_2 va2 "); |
|||
sql.append(" ON va2.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_3 va3 "); |
|||
sql.append(" ON va3.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN vendingcommitte.vendor_request_list vrl "); |
|||
sql.append(" ON vrl.vdid = vd.id "); |
|||
|
|||
sql.append(" LEFT JOIN vendingcommitte.vendor_postponed_list vpl "); |
|||
sql.append(" ON vpl.vdid = vd.id "); |
|||
|
|||
sql.append(" WHERE vd.isactive = 1 "); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromdate != null && !fromdate.isEmpty() |
|||
&& todate != null && !todate.isEmpty()) { |
|||
|
|||
sql.append(" AND DATE(vd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromdate); |
|||
params.add(todate); |
|||
} |
|||
|
|||
if(zone != null && !zone.isEmpty()) { |
|||
sql.append(" AND vd.zone = ? "); |
|||
params.add(zone); |
|||
} |
|||
|
|||
sql.append(" AND vd.zone IS NOT NULL AND vd.ward IS NOT NULL "); |
|||
|
|||
|
|||
sql.append(" GROUP BY vd.ward "); |
|||
sql.append(" ORDER BY vd.ward "); |
|||
|
|||
List<Map<String, Object>> reportList = |
|||
gccstrTemplate.queryForList(sql.toString(), params.toArray()); |
|||
|
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message","Zone:"+ zone+" Ward-wise Report"); |
|||
response.put("data", reportList); |
|||
|
|||
return Collections.singletonList(response); |
|||
|
|||
} |
|||
|
|||
public List<Map<String, Object>> getzoneinspectiondetails(String fromdate, String todate) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append(" SELECT "); |
|||
sql.append(" vd.zone AS zone, "); |
|||
|
|||
// 1. Application Received |
|||
sql.append(" COUNT(DISTINCT vd.id) AS application_received, "); |
|||
|
|||
// 2. LI Processed |
|||
sql.append(" COUNT(DISTINCT va1.vdid) AS li_processed, "); |
|||
|
|||
|
|||
// 8. Pending |
|||
sql.append(" ( "); |
|||
sql.append(" COUNT(DISTINCT vd.id) - "); |
|||
|
|||
|
|||
|
|||
sql.append(" COUNT(DISTINCT va1.vdid) "); |
|||
|
|||
|
|||
sql.append(" ) AS li_pending "); |
|||
|
|||
|
|||
sql.append(" FROM gcc_street_vendor.vendor_details vd "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_1 va1 "); |
|||
sql.append(" ON va1.vdid = vd.id "); |
|||
|
|||
|
|||
sql.append(" WHERE vd.isactive = 1 "); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromdate != null && !fromdate.isEmpty() |
|||
&& todate != null && !todate.isEmpty()) { |
|||
|
|||
sql.append(" AND DATE(vd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromdate); |
|||
params.add(todate); |
|||
} |
|||
|
|||
sql.append(" AND vd.zone IS NOT NULL "); |
|||
|
|||
sql.append(" GROUP BY vd.zone "); |
|||
sql.append(" ORDER BY vd.zone "); |
|||
|
|||
List<Map<String, Object>> reportList = |
|||
gccstrTemplate.queryForList(sql.toString(), params.toArray()); |
|||
|
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message", "LI Inspection Zone-wise Report"); |
|||
response.put("data", reportList); |
|||
|
|||
return Collections.singletonList(response); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getwardinspectiondetails(String fromdate, String todate, String zone) { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
sql.append(" SELECT "); |
|||
sql.append(" vd.ward AS ward, "); |
|||
|
|||
// 1. Application Received |
|||
sql.append(" COUNT(DISTINCT vd.id) AS application_received, "); |
|||
|
|||
// 2. LI Processed |
|||
sql.append(" COUNT(DISTINCT va1.vdid) AS li_processed, "); |
|||
|
|||
|
|||
// 8. Pending |
|||
sql.append(" ( "); |
|||
sql.append(" COUNT(DISTINCT vd.id) - "); |
|||
|
|||
sql.append(" ( "); |
|||
|
|||
sql.append(" COUNT(DISTINCT va1.vdid) "); |
|||
|
|||
sql.append(" ) "); |
|||
|
|||
sql.append(" ) AS li_pending "); |
|||
|
|||
|
|||
sql.append(" FROM gcc_street_vendor.vendor_details vd "); |
|||
|
|||
sql.append(" LEFT JOIN gcc_street_vendor.vendor_approval_level_1 va1 "); |
|||
sql.append(" ON va1.vdid = vd.id "); |
|||
|
|||
|
|||
sql.append(" WHERE vd.isactive = 1 "); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
if (fromdate != null && !fromdate.isEmpty() |
|||
&& todate != null && !todate.isEmpty()) { |
|||
|
|||
sql.append(" AND DATE(vd.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromdate); |
|||
params.add(todate); |
|||
} |
|||
|
|||
if(zone != null && !zone.isEmpty()) { |
|||
sql.append(" AND vd.zone = ? "); |
|||
params.add(zone); |
|||
} |
|||
|
|||
sql.append(" AND vd.zone IS NOT NULL AND vd.ward IS NOT NULL "); |
|||
|
|||
sql.append(" GROUP BY vd.ward "); |
|||
sql.append(" ORDER BY vd.ward "); |
|||
|
|||
List<Map<String, Object>> reportList = |
|||
gccstrTemplate.queryForList(sql.toString(), params.toArray()); |
|||
|
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message","Zone:"+ zone+" Ward-wise Inspection Report"); |
|||
response.put("data", reportList); |
|||
|
|||
return Collections.singletonList(response); |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,988 @@ |
|||
package com.gcc.commissionerreview.service; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.HashMap; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.core.env.Environment; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Service |
|||
|
|||
public class TenementService { |
|||
|
|||
@Autowired |
|||
@Value("${fileBaseUrl}") |
|||
|
|||
private String fileBaseUrl; |
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
@Autowired |
|||
private Environment environment; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlTenementDataSource") DataSource tenementDataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(tenementDataSource); |
|||
} |
|||
|
|||
public TenementService(Environment environment) { |
|||
|
|||
this.environment = environment; |
|||
|
|||
this.fileBaseUrl = environment.getProperty("fileBaseUrl"); |
|||
} |
|||
|
|||
public Map<String, Object> getTenementDashboard( |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
String sql = ""; |
|||
|
|||
List<Map<String, Object>> result; |
|||
|
|||
// WITHOUT DATE FILTER |
|||
if (fromDate == null || fromDate.isBlank() |
|||
|| toDate == null || toDate.isBlank()) { |
|||
|
|||
sql = "SELECT " + |
|||
|
|||
"'Tenement' AS complaint_name, " + |
|||
|
|||
// TOTAL |
|||
"COUNT(*) AS total_count, " + |
|||
|
|||
// COMPLETED = VERIFIED |
|||
"COUNT(CASE " + |
|||
"WHEN final_status = 'verified' " + |
|||
"THEN 1 END) AS completed_count, " + |
|||
|
|||
// PENDING = CREATED + COMPLETED |
|||
"COUNT(CASE " + |
|||
"WHEN final_status IN ('created','completed') " + |
|||
"THEN 1 END) AS pending_count " + |
|||
|
|||
"FROM issue_list1"; |
|||
|
|||
result = jdbcTemplate.queryForList(sql); |
|||
|
|||
} else { |
|||
|
|||
sql = "SELECT " + |
|||
|
|||
"'Tenement' AS complaint_name, " + |
|||
|
|||
// TOTAL |
|||
"COUNT(*) AS total_count, " + |
|||
|
|||
// COMPLETED = VERIFIED |
|||
"COUNT(CASE " + |
|||
"WHEN final_status = 'verified' " + |
|||
"THEN 1 END) AS completed_count, " + |
|||
|
|||
// PENDING = CREATED + COMPLETED |
|||
"COUNT(CASE " + |
|||
"WHEN final_status IN ('created','completed') " + |
|||
"THEN 1 END) AS pending_count " + |
|||
|
|||
"FROM issue_list1 " + |
|||
|
|||
"WHERE DATE(cdate) BETWEEN ? AND ?"; |
|||
|
|||
result = jdbcTemplate.queryForList( |
|||
sql, |
|||
fromDate, |
|||
toDate); |
|||
} |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "Error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getTenementDashboardwithoutcompletedandpending( |
|||
|
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
String sql = ""; |
|||
List<Map<String, Object>> result; |
|||
|
|||
// ✅ if no date filter |
|||
if (fromDate == null || fromDate.isBlank() |
|||
|| toDate == null || toDate.isBlank()) { |
|||
|
|||
sql = "SELECT " + |
|||
|
|||
"'Tenement' AS complaint_name, " + |
|||
|
|||
"COUNT(*) AS total_count, " + |
|||
|
|||
"COUNT(CASE " + |
|||
"WHEN final_status IN ('completed','verified') " + |
|||
"THEN 1 END) AS completed_count, " + |
|||
|
|||
"COUNT(CASE " + |
|||
"WHEN final_status = 'created' " + |
|||
"THEN 1 END) AS pending_count " + |
|||
|
|||
"FROM issue_list1"; |
|||
|
|||
result = jdbcTemplate.queryForList(sql); |
|||
|
|||
} else { |
|||
|
|||
// ✅ with date filter |
|||
sql = "SELECT " + |
|||
|
|||
"'Tenement' AS complaint_name, " + |
|||
|
|||
"COUNT(*) AS total_count, " + |
|||
|
|||
"COUNT(CASE " + |
|||
"WHEN final_status IN ('completed','verified') " + |
|||
"THEN 1 END) AS completed_count, " + |
|||
|
|||
"COUNT(CASE " + |
|||
"WHEN final_status = 'created' " + |
|||
"THEN 1 END) AS pending_count " + |
|||
|
|||
"FROM issue_list1 " + |
|||
|
|||
"WHERE DATE(cdate) BETWEEN ? AND ?"; |
|||
|
|||
result = jdbcTemplate.queryForList( |
|||
sql, |
|||
fromDate, |
|||
toDate); |
|||
} |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "Error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getZoneActivity( |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
String sql = ""; |
|||
List<Map<String, Object>> result; |
|||
|
|||
if (fromDate == null || fromDate.isBlank() |
|||
|| toDate == null || toDate.isBlank()) { |
|||
|
|||
sql = "SELECT " + |
|||
"am.zone, " + |
|||
|
|||
"COUNT(DISTINCT il1.id) AS total_complaint_count, " + |
|||
|
|||
// COMPLETED = VERIFIED |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status = 'verified' " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_closed_count, " + |
|||
|
|||
// PENDING = CREATED + COMPLETED |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status IN ('created','completed') " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_pending_count " + |
|||
|
|||
"FROM asset_master am " + |
|||
|
|||
"LEFT JOIN asset_list al " + |
|||
"ON al.am_id = am.id " + |
|||
|
|||
"LEFT JOIN issue_list1 il1 " + |
|||
"ON il1.assetlist_id = al.id " + |
|||
|
|||
"GROUP BY am.zone " + |
|||
"ORDER BY am.zone"; |
|||
|
|||
result = jdbcTemplate.queryForList(sql); |
|||
|
|||
} else { |
|||
|
|||
sql = "SELECT " + |
|||
"am.zone, " + |
|||
|
|||
"COUNT(DISTINCT il1.id) AS total_complaint_count, " + |
|||
|
|||
// COMPLETED = VERIFIED |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status = 'verified' " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_closed_count, " + |
|||
|
|||
// PENDING = CREATED + COMPLETED |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status IN ('created','completed') " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_pending_count " + |
|||
|
|||
"FROM asset_master am " + |
|||
|
|||
"LEFT JOIN asset_list al " + |
|||
"ON al.am_id = am.id " + |
|||
|
|||
"LEFT JOIN issue_list1 il1 " + |
|||
"ON il1.assetlist_id = al.id " + |
|||
"AND DATE(il1.cdate) BETWEEN ? AND ? " + |
|||
|
|||
"GROUP BY am.zone " + |
|||
"ORDER BY am.zone"; |
|||
|
|||
result = jdbcTemplate.queryForList( |
|||
sql, |
|||
fromDate, |
|||
toDate); |
|||
} |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getZoneActivitywithoutcompletedandpending( |
|||
|
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
String sql = ""; |
|||
|
|||
List<Map<String, Object>> result; |
|||
|
|||
// ✅ PAGE LOAD -> fetch all data without date filter |
|||
if (fromDate == null || fromDate.isBlank() |
|||
|| toDate == null || toDate.isBlank()) { |
|||
|
|||
sql = |
|||
|
|||
"SELECT " + |
|||
|
|||
"am.zone, " + |
|||
|
|||
// ✅ total complaints |
|||
"COUNT(DISTINCT il1.id) AS total_complaint_count, " + |
|||
|
|||
// ✅ completed |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status IN ('completed','verified') " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_closed_count, " + |
|||
|
|||
// ✅ pending |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status = 'created' " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_pending_count " + |
|||
|
|||
"FROM asset_master am " + |
|||
|
|||
"LEFT JOIN asset_list al " + |
|||
"ON al.am_id = am.id " + |
|||
|
|||
"LEFT JOIN issue_list1 il1 " + |
|||
"ON il1.assetlist_id = al.id " + |
|||
|
|||
"GROUP BY am.zone " + |
|||
|
|||
"ORDER BY am.zone"; |
|||
|
|||
result = jdbcTemplate.queryForList(sql); |
|||
|
|||
} else { |
|||
|
|||
// ✅ SEARCH BUTTON -> apply date filter |
|||
sql = |
|||
|
|||
"SELECT " + |
|||
|
|||
"am.zone, " + |
|||
|
|||
// ✅ total complaints |
|||
"COUNT(DISTINCT il1.id) AS total_complaint_count, " + |
|||
|
|||
// ✅ completed |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status IN ('completed','verified') " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_closed_count, " + |
|||
|
|||
// ✅ pending |
|||
"COUNT(DISTINCT CASE " + |
|||
"WHEN il1.final_status = 'created' " + |
|||
"THEN il1.id END) " + |
|||
"AS total_complaint_pending_count " + |
|||
|
|||
"FROM asset_master am " + |
|||
|
|||
"LEFT JOIN asset_list al " + |
|||
"ON al.am_id = am.id " + |
|||
|
|||
"LEFT JOIN issue_list1 il1 " + |
|||
"ON il1.assetlist_id = al.id " + |
|||
"AND DATE(il1.cdate) BETWEEN ? AND ? " + |
|||
|
|||
"GROUP BY am.zone " + |
|||
|
|||
"ORDER BY am.zone"; |
|||
|
|||
result = jdbcTemplate.queryForList( |
|||
sql, |
|||
fromDate, |
|||
toDate); |
|||
} |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getWardActivity( |
|||
String zone, |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
sql.append("wm.ward_name AS ward, "); |
|||
|
|||
sql.append("COUNT(DISTINCT il1.id) "); |
|||
sql.append("AS total_complaint_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status = 'verified' "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_closed_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status = 'created' "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_vendor_pending_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status = 'completed' "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_ie_pending_count "); |
|||
|
|||
sql.append("FROM gcc_street_vendor.ward_master wm "); |
|||
|
|||
sql.append("LEFT JOIN asset_master am "); |
|||
sql.append("ON wm.ward_name = am.ward "); |
|||
sql.append("AND am.zone = ? "); |
|||
params.add(zone); |
|||
|
|||
sql.append("LEFT JOIN asset_list al "); |
|||
sql.append("ON al.am_id = am.id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list1 il1 "); |
|||
sql.append("ON il1.assetlist_id = al.id "); |
|||
|
|||
if (fromDate != null |
|||
&& !fromDate.isBlank() |
|||
&& toDate != null |
|||
&& !toDate.isBlank()) { |
|||
|
|||
sql.append("AND DATE(il1.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("WHERE wm.zone_id = ? "); |
|||
params.add(zone); |
|||
|
|||
sql.append("GROUP BY wm.ward_name "); |
|||
sql.append("ORDER BY wm.ward_name "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getWardActivitywithoutcompletedandpending( |
|||
|
|||
String zone, |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
sql.append("am.ward, "); |
|||
|
|||
// total |
|||
sql.append("COUNT(DISTINCT il1.id) "); |
|||
sql.append("AS total_complaint_count, "); |
|||
|
|||
// completed |
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status IN ('completed','verified') "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_closed_count, "); |
|||
|
|||
// pending |
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status = 'created' "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_pending_count "); |
|||
|
|||
sql.append("FROM asset_master am "); |
|||
|
|||
sql.append("LEFT JOIN asset_list al "); |
|||
sql.append("ON al.am_id = am.id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list1 il1 "); |
|||
sql.append("ON il1.assetlist_id = al.id "); |
|||
|
|||
sql.append("WHERE am.zone = ? "); |
|||
params.add(zone); |
|||
|
|||
// date filter |
|||
if (fromDate != null && !fromDate.isBlank() |
|||
&& toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append("AND DATE(il1.cdate) BETWEEN ? AND ? "); |
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("GROUP BY am.ward "); |
|||
sql.append("ORDER BY am.ward "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
// ================= SERVICE ================= |
|||
public Map<String, Object> getSchemeWiseReport( |
|||
|
|||
String ward, |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
|
|||
sql.append("am.scheme_name, "); |
|||
sql.append("am.id as schemeid, "); |
|||
|
|||
// TOTAL |
|||
sql.append("COUNT(DISTINCT il1.id) "); |
|||
sql.append("AS total_complaint_count, "); |
|||
|
|||
// COMPLETED = VERIFIED ONLY |
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status = 'verified' "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_verified_count, "); |
|||
|
|||
// PENDING = CREATED + COMPLETED |
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status IN ('created') "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_vendor_pending_count, "); |
|||
|
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status IN ('completed') "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_ie_pending_count "); |
|||
|
|||
sql.append("FROM asset_master am "); |
|||
|
|||
sql.append("LEFT JOIN asset_list al "); |
|||
sql.append("ON al.am_id = am.id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list1 il1 "); |
|||
sql.append("ON il1.assetlist_id = al.id "); |
|||
|
|||
sql.append("WHERE am.ward = ? "); |
|||
params.add(ward); |
|||
|
|||
// DATE FILTER |
|||
if (fromDate != null && !fromDate.isBlank() |
|||
&& toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append("AND DATE(il1.cdate) BETWEEN ? AND ? "); |
|||
|
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("GROUP BY am.scheme_name, am.id "); |
|||
|
|||
sql.append("ORDER BY am.scheme_name "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getSchemeWiseReportwithcompletedandpending( |
|||
|
|||
String ward, |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
|
|||
sql.append("am.scheme_name, "); |
|||
sql.append("am.id as schemeid, "); |
|||
|
|||
// TOTAL |
|||
sql.append("COUNT(DISTINCT il1.id) "); |
|||
sql.append("AS total_complaint_count, "); |
|||
|
|||
// COMPLETED |
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status IN ('completed','verified') "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_closed_count, "); |
|||
|
|||
// PENDING |
|||
sql.append("COUNT(DISTINCT CASE "); |
|||
sql.append("WHEN il1.final_status = 'created' "); |
|||
sql.append("THEN il1.id END) "); |
|||
sql.append("AS total_complaint_pending_count "); |
|||
|
|||
sql.append("FROM asset_master am "); |
|||
|
|||
sql.append("LEFT JOIN asset_list al "); |
|||
sql.append("ON al.am_id = am.id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list1 il1 "); |
|||
sql.append("ON il1.assetlist_id = al.id "); |
|||
|
|||
sql.append("WHERE am.ward = ? "); |
|||
params.add(ward); |
|||
|
|||
// DATE FILTER |
|||
if (fromDate != null && !fromDate.isBlank() |
|||
&& toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append("AND DATE(il1.cdate) BETWEEN ? AND ? "); |
|||
|
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
sql.append("GROUP BY am.scheme_name, am.id "); |
|||
|
|||
sql.append("ORDER BY am.scheme_name "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getComplaintDetails( |
|||
|
|||
String ward, |
|||
String schemeid, |
|||
String status, |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
|
|||
sql.append("il1.id AS issuelist1_id, "); |
|||
sql.append("il1.final_status, "); |
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il1.final_status = 'verified' THEN 'Completed' " + |
|||
"WHEN il1.final_status IN ('created','completed') THEN 'Pending' " + |
|||
"ELSE il1.final_status " + |
|||
"END AS ie_status, "); |
|||
|
|||
sql.append("DATE_FORMAT(il1.cdate,'%d-%m-%Y') AS created_date, "); |
|||
|
|||
sql.append("IFNULL(il1.remarks,'') AS created_remarks, "); |
|||
|
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il1.before_image IS NOT NULL " + |
|||
"THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il1.before_image) " + |
|||
"ELSE '' END AS before_image, "); |
|||
|
|||
/* |
|||
* sql.append( |
|||
* "IFNULL(DATE_FORMAT(il2.cdate,'%d-%m-%Y'),'Pending') AS completed_date, "); |
|||
* |
|||
* sql.append( |
|||
* "IFNULL(il2.remarks,'Pending') AS completed_remarks, "); |
|||
* |
|||
* sql.append( |
|||
* "CASE " + |
|||
* "WHEN il2.after_image IS NOT NULL " + |
|||
* "THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il2.after_image) " + |
|||
* "ELSE '' END AS after_image, "); |
|||
*/ |
|||
// Completed Date |
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il2.cdate IS NOT NULL " + |
|||
"THEN DATE_FORMAT(il2.cdate,'%d-%m-%Y') " + |
|||
"ELSE 'Pending' " + |
|||
"END AS completed_date, "); |
|||
|
|||
// Completed Remarks |
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il2.cdate IS NOT NULL " + |
|||
"THEN IFNULL(il2.remarks,'') " + |
|||
"ELSE 'Pending' " + |
|||
"END AS completed_remarks, "); |
|||
|
|||
// After Image |
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il2.after_image IS NOT NULL " + |
|||
"THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il2.after_image) " + |
|||
"ELSE '' " + |
|||
"END AS after_image, "); |
|||
|
|||
sql.append( |
|||
"IFNULL(DATE_FORMAT(il3.cdate,'%d-%m-%Y'),'') AS verified_date, "); |
|||
|
|||
sql.append( |
|||
"IFNULL(il3.remarks,'') AS verified_remarks, "); |
|||
|
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il3.verify_image IS NOT NULL " + |
|||
"THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il3.verify_image) " + |
|||
"ELSE '' END AS verify_image "); |
|||
|
|||
sql.append("FROM issue_list1 il1 "); |
|||
|
|||
sql.append("LEFT JOIN asset_list al "); |
|||
sql.append("ON al.id = il1.assetlist_id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list2 il2 "); |
|||
sql.append("ON il2.issuelist1_id = il1.id "); |
|||
sql.append("AND il2.final_status = 'completed' "); |
|||
|
|||
sql.append("LEFT JOIN issue_list3 il3 "); |
|||
sql.append("ON il3.issuelist1_id = il1.id "); |
|||
|
|||
sql.append("WHERE il1.ward = ? "); |
|||
params.add(ward); |
|||
|
|||
sql.append("AND al.am_id = ? "); |
|||
params.add(schemeid); |
|||
|
|||
// Date Filter |
|||
if (fromDate != null && !fromDate.isBlank() |
|||
&& toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append("AND DATE(il1.cdate) BETWEEN ? AND ? "); |
|||
|
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
// Updated Status Filter |
|||
if (status != null && !status.isEmpty()) { |
|||
|
|||
if ("verified".equalsIgnoreCase(status)) { |
|||
|
|||
sql.append("AND il1.final_status = 'verified' "); |
|||
|
|||
} else if ("created".equalsIgnoreCase(status)) { |
|||
|
|||
sql.append("AND il1.final_status = 'created' "); |
|||
} |
|||
|
|||
else if ("completed".equalsIgnoreCase(status)) { |
|||
|
|||
sql.append("AND il1.final_status = 'completed' "); |
|||
} |
|||
|
|||
} |
|||
|
|||
sql.append("ORDER BY il1.id DESC "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getComplaintDetailswithoutcompletedandpending( |
|||
|
|||
String ward, |
|||
String schemeid, |
|||
String status, |
|||
String fromDate, |
|||
String toDate) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
StringBuilder sql = new StringBuilder(); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
sql.append("SELECT "); |
|||
|
|||
sql.append("il1.id AS issuelist1_id, "); |
|||
sql.append("il1.final_status, "); |
|||
sql.append("DATE_FORMAT(il1.cdate,'%d-%m-%Y') AS created_date,"); |
|||
|
|||
// sql.append( |
|||
// "IFNULL(DATE_FORMAT(il1.cdate,'%d-%m-%Y %h:%i %p'),'') AS created_date, "); |
|||
|
|||
sql.append("IFNULL(il1.remarks,'') AS created_remarks, "); |
|||
|
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il1.before_image IS NOT NULL " + |
|||
"THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il1.before_image) " + |
|||
"ELSE '' END AS before_image, "); |
|||
|
|||
/* |
|||
* sql.append( |
|||
* "IFNULL(DATE_FORMAT(il2.cdate,'%d-%m-%Y %h:%i %p'),'') AS completed_date, "); |
|||
*/ |
|||
sql.append("DATE_FORMAT(il2.cdate,'%d-%m-%Y') AS completed_date,"); |
|||
|
|||
sql.append( |
|||
"IFNULL(il2.remarks,'') AS completed_remarks, "); |
|||
|
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il2.after_image IS NOT NULL " + |
|||
"THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il2.after_image) " + |
|||
"ELSE '' END AS after_image, "); |
|||
|
|||
sql.append( |
|||
"IFNULL(DATE_FORMAT(il3.cdate,'%d-%m-%Y %h:%i %p'),'') AS verified_date, "); |
|||
|
|||
sql.append( |
|||
"IFNULL(il3.remarks,'') AS verified_remarks, "); |
|||
|
|||
sql.append( |
|||
"CASE " + |
|||
"WHEN il3.Verify_image IS NOT NULL " + |
|||
"THEN CONCAT('" + fileBaseUrl + "/gccofficialapp/files', il3.Verify_image) " + |
|||
"ELSE '' END AS verify_image "); |
|||
|
|||
sql.append("FROM issue_list1 il1 "); |
|||
|
|||
sql.append("LEFT JOIN asset_list al "); |
|||
sql.append("ON al.id = il1.assetlist_id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list2 il2 "); |
|||
sql.append("ON il2.issuelist1_id = il1.id "); |
|||
|
|||
sql.append("LEFT JOIN issue_list3 il3 "); |
|||
sql.append("ON il3.issuelist1_id = il1.id "); |
|||
|
|||
sql.append("WHERE il1.ward = ? "); |
|||
params.add(ward); |
|||
|
|||
sql.append("AND al.am_id = ? "); |
|||
params.add(schemeid); |
|||
|
|||
// ✅ only if dates available |
|||
if (fromDate != null && !fromDate.isBlank() |
|||
&& toDate != null && !toDate.isBlank()) { |
|||
|
|||
sql.append("AND DATE(il1.cdate) BETWEEN ? AND ? "); |
|||
|
|||
params.add(fromDate); |
|||
params.add(toDate); |
|||
} |
|||
|
|||
// STATUS FILTER |
|||
if (status != null && !status.isEmpty()) { |
|||
|
|||
sql.append("AND il1.final_status = ? "); |
|||
params.add(status); |
|||
} |
|||
|
|||
sql.append("ORDER BY il1.id DESC "); |
|||
|
|||
List<Map<String, Object>> result = jdbcTemplate.queryForList( |
|||
sql.toString(), |
|||
params.toArray()); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", result); |
|||
|
|||
} catch (Exception e) { |
|||
|
|||
e.printStackTrace(); |
|||
|
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
} |
|||
@ -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> |
|||
@ -0,0 +1,543 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>StreetVendor Inspection Details</title> |
|||
|
|||
<!-- Bootstrap 5 CSS --> |
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|||
|
|||
<!-- DataTables CSS --> |
|||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet"/> |
|||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet"/> |
|||
|
|||
<style> |
|||
|
|||
.filter-section { |
|||
background: #fff; |
|||
padding: 15px; |
|||
border-radius: 8px; |
|||
/* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); */ |
|||
margin-bottom: 20px; |
|||
} |
|||
table.dataTable th, table.dataTable td { |
|||
text-align: center; |
|||
vertical-align: middle; |
|||
border: 1px solid #000; |
|||
|
|||
} |
|||
|
|||
table.dataTable th{ |
|||
background-color: #003366 !important; |
|||
color: white; |
|||
} |
|||
|
|||
.dataTables_wrapper .dt-buttons { |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.dataTables_filter { |
|||
margin-bottom: 25px; /* adjust as needed */ |
|||
} |
|||
|
|||
.page-header-title h4 { |
|||
margin: 20px 0; |
|||
text-align: center; |
|||
} |
|||
|
|||
#zoneDetailsTable_wrapper .dataTables_scrollBody { |
|||
border: none !important; |
|||
} |
|||
|
|||
#zoneDetailsTable td, #zoneDetailsTable th { |
|||
vertical-align: middle; |
|||
text-align: center; |
|||
white-space: nowrap; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Street Vendor - Inspection Report (LI)</h4> |
|||
</div> |
|||
|
|||
<div class="filter-section d-flex justify-content-center align-items-end gap-3 flex-wrap"> |
|||
<div> |
|||
<label for="fromDate" class="form-label fw-bold">From Date:</label> |
|||
<input type="date" id="fromDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div> |
|||
<label for="toDate" class="form-label fw-bold">To Date:</label> |
|||
<input type="date" id="toDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div> |
|||
<button id="btnSearch" class="btn btn-primary px-4"><i class="fa-solid fa-search"></i> Search</button> |
|||
</div> |
|||
<div> |
|||
<button id="btnReset" class="btn btn-secondary px-4"> Reset</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;width: 100%;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Application Received</th> |
|||
<th class="text-center">LI Processed</th> |
|||
<th class="text-center">LI Pending </th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" aria-labelledby="zoneDetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Zone Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">Ward</th> |
|||
<th class="text-center">Application Received</th> |
|||
<th class="text-center">LI Processed</th> |
|||
<th class="text-center">LI Pending </th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only"></span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Scripts --> |
|||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<!-- DataTables JS --> |
|||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
|||
|
|||
<!-- SweetAlert --> |
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$('#fromDate, #toDate').on('change', function () { |
|||
|
|||
let fromDate = $('#fromDate').val(); |
|||
let toDate = $('#toDate').val(); |
|||
|
|||
// Both dates selected |
|||
if (fromDate && toDate) { |
|||
|
|||
if (new Date(fromDate) > new Date(toDate)) { |
|||
|
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Invalid Date Range', |
|||
text: 'From Date should not be greater than To Date' |
|||
}); |
|||
|
|||
$(this).val(''); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Set min/max dynamically |
|||
$('#toDate').attr('min', fromDate); |
|||
|
|||
$('#fromDate').attr('max', toDate); |
|||
}); |
|||
|
|||
$('#btnReset').click(function () { |
|||
|
|||
$('#fromDate').val(''); |
|||
$('#toDate').val(''); |
|||
|
|||
|
|||
}); |
|||
|
|||
$('#btnSearch').click(function () { |
|||
|
|||
var fromDate = $('#fromDate').val() || ''; |
|||
var toDate = $('#toDate').val() || ''; |
|||
|
|||
loadZoneReport(fromDate,toDate); |
|||
|
|||
}); |
|||
|
|||
function loadZoneReport(fromdate,todate) { |
|||
|
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/streetvendor/getzoneinspectiondetails', |
|||
method: 'GET', |
|||
data:{fromdate:fromdate,todate:todate}, |
|||
success: function(response) { |
|||
|
|||
// Safely extract data whether it's an array or an object |
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0) { |
|||
console.log("Details Array:", response); |
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: res.data, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'zone', |
|||
render: function (data, type, row) { |
|||
|
|||
|
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${data}</a>`; |
|||
} |
|||
|
|||
}, |
|||
{ data: 'application_received', defaultContent: '-', className: 'text-center' }, |
|||
|
|||
{ data: 'li_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'li_pending', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
|
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Export Excel', |
|||
title: 'Street Vendor Inspection Zone Wise Report', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Export PDF', |
|||
title: 'Street Vendor Inspection Zone Wise Report', |
|||
pageSize: 'A4', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
customize: function (doc) { |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.fontSize = 9; |
|||
|
|||
doc.content[1].table.widths = [ |
|||
'*', '*', '*', '*', '*' |
|||
]; |
|||
|
|||
// Center align all table cells |
|||
let rowCount = doc.content[1].table.body.length; |
|||
|
|||
for (let i = 0; i < rowCount; i++) { |
|||
|
|||
let row = doc.content[1].table.body[i]; |
|||
|
|||
for (let j = 0; j < row.length; j++) { |
|||
|
|||
row[j].alignment = 'center'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
} |
|||
|
|||
else if(Array.isArray(res.data) && res.data.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Error', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
loadZoneReport("",""); |
|||
|
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
if ($.fn.DataTable.isDataTable('#WardDatatable')) { |
|||
let questionDatatable = $('#WardDatatable').DataTable(); |
|||
questionDatatable.columns.adjust().draw(); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
var fromDate = $('#fromDate').val() || ''; |
|||
var toDate = $('#toDate').val() || ''; |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode + ' Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/streetvendor/getwardinspectiondetails', |
|||
method: 'GET', |
|||
data:{fromdate:fromDate,todate:toDate,zone:zoneCode}, |
|||
success: function(response) { |
|||
|
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: res.data, // using response directly |
|||
columns: [ |
|||
{ data: 'ward', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'application_received', defaultContent: '-', className: 'text-center' }, |
|||
|
|||
{ data: 'li_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'li_pending', defaultContent: '-', className: 'text-center' } |
|||
|
|||
], |
|||
dom: 'Bfrtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false, |
|||
buttons: [ |
|||
|
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Export Excel', |
|||
title: 'Street Vendor Inspection Zone: '+zoneCode+' ward wise Report', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Export PDF', |
|||
title: 'Street Vendor Inspection Zone: '+zoneCode+' ward wise Report', |
|||
pageSize: 'A4', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
customize: function (doc) { |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.fontSize = 9; |
|||
|
|||
doc.content[1].table.widths = [ |
|||
'*', '*', '*', '*', '*' |
|||
]; |
|||
|
|||
// Center align all table cells |
|||
let rowCount = doc.content[1].table.body.length; |
|||
|
|||
for (let i = 0; i < rowCount; i++) { |
|||
|
|||
let row = doc.content[1].table.body[i]; |
|||
|
|||
for (let j = 0; j < row.length; j++) { |
|||
|
|||
row[j].alignment = 'center'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
] |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
$('#zoneDetailsModal').modal('show'); |
|||
} |
|||
else if (Array.isArray(res.data) && res.data.length === 0){ |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
else{ |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,577 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>StreetVendor Overall Details</title> |
|||
|
|||
<!-- Bootstrap 5 CSS --> |
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|||
|
|||
<!-- DataTables CSS --> |
|||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet"/> |
|||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet"/> |
|||
|
|||
<style> |
|||
|
|||
.filter-section { |
|||
background: #fff; |
|||
padding: 15px; |
|||
border-radius: 8px; |
|||
/* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); */ |
|||
margin-bottom: 20px; |
|||
} |
|||
table.dataTable th, table.dataTable td { |
|||
text-align: center; |
|||
vertical-align: middle; |
|||
border: 1px solid #000; |
|||
|
|||
} |
|||
|
|||
table.dataTable th{ |
|||
background-color: #003366 !important; |
|||
color: white; |
|||
} |
|||
|
|||
.dataTables_wrapper .dt-buttons { |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.dataTables_filter { |
|||
margin-bottom: 25px; /* adjust as needed */ |
|||
} |
|||
|
|||
.page-header-title h4 { |
|||
margin: 20px 0; |
|||
text-align: center; |
|||
} |
|||
|
|||
#zoneDetailsTable_wrapper .dataTables_scrollBody { |
|||
border: none !important; |
|||
} |
|||
|
|||
#zoneDetailsTable td, #zoneDetailsTable th { |
|||
vertical-align: middle; |
|||
text-align: center; |
|||
white-space: nowrap; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Street Vendor - Zonewise Report</h4> |
|||
</div> |
|||
|
|||
<div class="filter-section d-flex justify-content-center align-items-end gap-3 flex-wrap"> |
|||
<div> |
|||
<label for="fromDate" class="form-label fw-bold">From Date:</label> |
|||
<input type="date" id="fromDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div> |
|||
<label for="toDate" class="form-label fw-bold">To Date:</label> |
|||
<input type="date" id="toDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div> |
|||
<button id="btnSearch" class="btn btn-primary px-4"><i class="fa-solid fa-search"></i> Search</button> |
|||
</div> |
|||
<div> |
|||
<button id="btnReset" class="btn btn-secondary px-4"> Reset</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;width: 100%;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th rowspan="2" class="text-center">Zone</th> |
|||
<th rowspan="2" class="text-center">Application Received</th> |
|||
<th colspan="5" class="text-center">Application Processed</th> |
|||
<th rowspan="2" class="text-center">Total Processed</th> |
|||
<th rowspan="2" class="text-center">Pending </th> |
|||
<th rowspan="2" class="text-center">Processed within 30 days</th> |
|||
|
|||
</tr> |
|||
<tr> |
|||
<th class="text-center">Assistant Processed</th> |
|||
<th class="text-center">LI Processed</th> |
|||
<th class="text-center">ARO Processed</th> |
|||
<th class="text-center">EE Processed</th> |
|||
<th class="text-center">Committee Processed</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" aria-labelledby="zoneDetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Zone Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th rowspan="2" class="text-center">Ward</th> |
|||
<th rowspan="2" class="text-center">Application Received</th> |
|||
<th colspan="5" class="text-center">Application Processed</th> |
|||
<th rowspan="2" class="text-center">Total Processed</th> |
|||
<th rowspan="2" class="text-center">Pending </th> |
|||
<th rowspan="2" class="text-center">Processed within 30 days</th> |
|||
|
|||
</tr> |
|||
<tr> |
|||
<th class="text-center">Assistant Processed</th> |
|||
<th class="text-center">LI Processed</th> |
|||
<th class="text-center">ARO Processed</th> |
|||
<th class="text-center">EE Processed</th> |
|||
<th class="text-center">Committee Processed</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only"></span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Scripts --> |
|||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<!-- DataTables JS --> |
|||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
|||
|
|||
<!-- SweetAlert --> |
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$('#fromDate, #toDate').on('change', function () { |
|||
|
|||
let fromDate = $('#fromDate').val(); |
|||
let toDate = $('#toDate').val(); |
|||
|
|||
// Both dates selected |
|||
if (fromDate && toDate) { |
|||
|
|||
if (new Date(fromDate) > new Date(toDate)) { |
|||
|
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Invalid Date Range', |
|||
text: 'From Date should not be greater than To Date' |
|||
}); |
|||
|
|||
$(this).val(''); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Set min/max dynamically |
|||
$('#toDate').attr('min', fromDate); |
|||
|
|||
$('#fromDate').attr('max', toDate); |
|||
}); |
|||
|
|||
$('#btnReset').click(function () { |
|||
|
|||
$('#fromDate').val(''); |
|||
$('#toDate').val(''); |
|||
|
|||
|
|||
}); |
|||
|
|||
$('#btnSearch').click(function () { |
|||
|
|||
var fromDate = $('#fromDate').val() || ''; |
|||
var toDate = $('#toDate').val() || ''; |
|||
|
|||
loadZoneReport(fromDate,toDate); |
|||
|
|||
}); |
|||
|
|||
function loadZoneReport(fromdate,todate) { |
|||
|
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/streetvendor/getzoneoveralldetails', |
|||
method: 'GET', |
|||
data:{fromdate:fromdate,todate:todate}, |
|||
success: function(response) { |
|||
|
|||
// Safely extract data whether it's an array or an object |
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0) { |
|||
console.log("Details Array:", response); |
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: res.data, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'zone', |
|||
render: function (data, type, row) { |
|||
|
|||
|
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${data}</a>`; |
|||
} |
|||
|
|||
}, |
|||
{ data: 'application_received', defaultContent: '-', className: 'text-center' }, |
|||
|
|||
{ data: 'assistant_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'li_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'aro_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'ee_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'committee_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'total_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'pending', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'processed_within_30_days', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
|
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Export Excel', |
|||
title: 'Street Vendor - Zone Wise Report', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Export PDF', |
|||
title: 'Street Vendor - Zone Wise Report', |
|||
orientation: 'landscape', |
|||
pageSize: 'A4', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
customize: function (doc) { |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.fontSize = 9; |
|||
|
|||
doc.content[1].table.widths = [ |
|||
'*', '*', '*', '*', '*', |
|||
'*', '*', '*', '*', '*' |
|||
]; |
|||
|
|||
// Center align all table cells |
|||
let rowCount = doc.content[1].table.body.length; |
|||
|
|||
for (let i = 0; i < rowCount; i++) { |
|||
|
|||
let row = doc.content[1].table.body[i]; |
|||
|
|||
for (let j = 0; j < row.length; j++) { |
|||
|
|||
row[j].alignment = 'center'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
} |
|||
|
|||
else if(Array.isArray(res.data) && res.data.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Error', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
loadZoneReport("",""); |
|||
|
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
if ($.fn.DataTable.isDataTable('#WardDatatable')) { |
|||
let questionDatatable = $('#WardDatatable').DataTable(); |
|||
questionDatatable.columns.adjust().draw(); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
var fromDate = $('#fromDate').val() || ''; |
|||
var toDate = $('#toDate').val() || ''; |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode + ' Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/streetvendor/getwardoveralldetails', |
|||
method: 'GET', |
|||
data:{fromdate:fromDate,todate:toDate,zone:zoneCode}, |
|||
success: function(response) { |
|||
|
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: res.data, // using response directly |
|||
columns: [ |
|||
{ data: 'ward', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'application_received', defaultContent: '-', className: 'text-center' }, |
|||
|
|||
{ data: 'assistant_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'li_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'aro_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'ee_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'committee_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'total_processed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'pending', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'processed_within_30_days', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'Bfrtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false, |
|||
buttons: [ |
|||
|
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Export Excel', |
|||
title: 'Street Vendor - Zone: '+zoneCode+' ward wise Report', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Export PDF', |
|||
title: 'Street Vendor - Zone: '+zoneCode+' ward wise Report', |
|||
orientation: 'landscape', |
|||
pageSize: 'A4', |
|||
exportOptions: { |
|||
columns: ':visible' |
|||
}, |
|||
customize: function (doc) { |
|||
|
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.fontSize = 9; |
|||
|
|||
doc.content[1].table.widths = [ |
|||
'*', '*', '*', '*', '*', |
|||
'*', '*', '*', '*', '*' |
|||
]; |
|||
|
|||
// Center align all table cells |
|||
let rowCount = doc.content[1].table.body.length; |
|||
|
|||
for (let i = 0; i < rowCount; i++) { |
|||
|
|||
let row = doc.content[1].table.body[i]; |
|||
|
|||
for (let j = 0; j < row.length; j++) { |
|||
|
|||
row[j].alignment = 'center'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
] |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
$('#zoneDetailsModal').modal('show'); |
|||
} |
|||
else if (Array.isArray(res.data) && res.data.length === 0){ |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
else{ |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
2995
src/main/resources/templates/modules/vendorreport.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue