39 changed files with 9825 additions and 68 deletions
-
BINsrc/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store
-
BINsrc/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/.DS_Store
-
278src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteApiController.java
-
73src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteMainController.java
-
534src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpApiController.java
-
55src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpMaincontroller.java
-
308src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/DomesticWasteService.java
-
299src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ScpService.java
-
15src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/APIController.java
-
7src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/MainController.java
-
65src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/service/Petition.java
-
3src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java
-
23src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
-
17src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java
-
7src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java
-
67src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java
-
BINsrc/main/java/in/gov/chennaicorporation/gccoffice/vendor/.DS_Store
-
31src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java
-
48src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java
-
60src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java
-
66src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java
-
49src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java
-
15src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/APIController.java
-
8src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/MainController.java
-
54src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/service/Petition.java
-
BINsrc/main/resources/templates/modules/.DS_Store
-
783src/main/resources/templates/modules/callcenterqaqc/domesticwastecancel.html
-
459src/main/resources/templates/modules/callcenterqaqc/domesticwastecheckstatus.html
-
1579src/main/resources/templates/modules/callcenterqaqc/domesticwastecomplaints.html
-
17src/main/resources/templates/modules/callcenterqaqc/overallreport.html
-
1040src/main/resources/templates/modules/callcenterqaqc/scpreport.html
-
1149src/main/resources/templates/modules/callcenterqaqc/scpverification.html
-
351src/main/resources/templates/modules/com_petition/pending_list.html
-
351src/main/resources/templates/modules/m_petition/pending_list.html
-
6src/main/resources/templates/modules/vendors/RequestList.html
-
114src/main/resources/templates/modules/vendors/streetVendorRequestForm.html
-
98src/main/resources/templates/modules/vendors/streetVendorRequestList.html
-
1574src/main/resources/templates/modules/vendors/zonerequests.html
-
290src/main/resources/templates/modules/zerohours_petition/pending_list.html
@ -0,0 +1,278 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.Collections; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.client.HttpClientErrorException; |
||||
|
import org.springframework.web.client.HttpServerErrorException; |
||||
|
import org.springframework.web.client.ResourceAccessException; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import com.fasterxml.jackson.core.type.TypeReference; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.DomesticWasteService; |
||||
|
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/gcc/api/domestic_waste") |
||||
|
public class DomesticWasteApiController { |
||||
|
|
||||
|
@Autowired |
||||
|
private AppConfig appConfig; |
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
private DomesticWasteService domesticWasteService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getitems") |
||||
|
public ResponseEntity<Map<String, Object>> getItemsList() { |
||||
|
String apiUrl = appConfig.domesticurl + "/get-all-masters"; |
||||
|
Map<String, Object> responseMap = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
String response = restTemplate.getForObject(apiUrl, String.class); |
||||
|
|
||||
|
responseMap.put("status", "success"); |
||||
|
responseMap.put("data", new ObjectMapper().readValue(response, Object.class)); // parse JSON array into list |
||||
|
return ResponseEntity.ok(responseMap); |
||||
|
|
||||
|
} catch (HttpClientErrorException | HttpServerErrorException ex) { |
||||
|
responseMap.put("status", "error"); |
||||
|
responseMap.put("code", ex.getStatusCode().value()); |
||||
|
responseMap.put("message", ex.getStatusText()); |
||||
|
responseMap.put("details", ex.getResponseBodyAsString()); |
||||
|
return ResponseEntity.status(ex.getStatusCode()).body(responseMap); |
||||
|
|
||||
|
} catch (ResourceAccessException ex) { |
||||
|
responseMap.put("status", "error"); |
||||
|
responseMap.put("code", HttpStatus.SERVICE_UNAVAILABLE.value()); |
||||
|
responseMap.put("message", "Service unavailable"); |
||||
|
responseMap.put("details", ex.getMessage()); |
||||
|
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(responseMap); |
||||
|
|
||||
|
} catch (Exception ex) { |
||||
|
responseMap.put("status", "error"); |
||||
|
responseMap.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); |
||||
|
responseMap.put("message", "Unexpected error"); |
||||
|
responseMap.put("details", ex.getMessage()); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMap); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/saverequest") |
||||
|
public ResponseEntity<?> saveRequest( |
||||
|
@RequestParam String user_name, |
||||
|
@RequestParam String mobile, |
||||
|
@RequestParam String address, |
||||
|
@RequestParam String latitude, |
||||
|
@RequestParam String longitude, |
||||
|
@RequestParam String street_name, |
||||
|
@RequestParam String street_id, |
||||
|
@RequestParam String remarks, |
||||
|
@RequestParam("items") String itemsJson, |
||||
|
@RequestParam String userId,@RequestParam String zone,@RequestParam String ward) { |
||||
|
|
||||
|
try { |
||||
|
Map<String, Object> result = domesticWasteService.saveMultipleWasteRequests( |
||||
|
user_name, mobile, address, |
||||
|
latitude, longitude, |
||||
|
street_name, street_id, remarks, |
||||
|
itemsJson,userId,zone,ward |
||||
|
); |
||||
|
|
||||
|
return ResponseEntity.ok(result); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
return ResponseEntity.status(500).body(Map.of("status", false, "message", e.getMessage())); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getalldomesticwastelist") |
||||
|
public Map<String, Object> getFilterReports( |
||||
|
@RequestParam(required = false) String startDate, |
||||
|
@RequestParam(required = false) String endDate, |
||||
|
@RequestParam(required = false) String mobile, |
||||
|
@RequestParam(required = false) String requestId) { |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
System.out.println("startDate="+startDate); |
||||
|
System.out.println("endDate="+endDate); |
||||
|
System.out.println("mobile="+mobile); |
||||
|
System.out.println("requestId="+requestId); |
||||
|
|
||||
|
List<Map<String, Object>> details =domesticWasteService.getAllComplaintsList(startDate,endDate,mobile,requestId) ; |
||||
|
System.out.println(details); |
||||
|
if (details == null || details.isEmpty()) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("message", "No Data"); |
||||
|
} |
||||
|
else { |
||||
|
response.put("status", "success"); |
||||
|
response.put("details", details); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "An error occurred while fetching data."); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/checkstatusbymobile") |
||||
|
public Map<String, Object> getStatusByMobileNumber( |
||||
|
@RequestParam(required = false) String mobile) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
try { |
||||
|
System.out.println("mobile=" + mobile); |
||||
|
|
||||
|
// Construct external API URL |
||||
|
String url = appConfig.domesticurl + "/get-user-bymobile?mobile=" + mobile; |
||||
|
|
||||
|
// Call the external API |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
ResponseEntity<String> apiResponse = restTemplate.getForEntity(url, String.class); |
||||
|
|
||||
|
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
|
||||
|
// Convert JSON string to List of Maps |
||||
|
List<Map<String, Object>> itemsList = mapper.readValue(apiResponse.getBody(), |
||||
|
new TypeReference<List<Map<String, Object>>>() {}); |
||||
|
|
||||
|
if (itemsList.isEmpty()) { |
||||
|
response.put("status", "no data"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} else { |
||||
|
response.put("status", "success"); |
||||
|
response.put("data", itemsList); |
||||
|
} |
||||
|
} else { |
||||
|
response.put("status", "no data"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getpendingcomplaints") |
||||
|
public Map<String, Object> getpendingcomplaints( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam (required = false) String mobile) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
try { |
||||
|
|
||||
|
List<Map<String,Object>> list = domesticWasteService.getpendingcomplaints(startDate,endDate,mobile); |
||||
|
|
||||
|
if (!list.isEmpty()) { |
||||
|
|
||||
|
response.put("status", "success"); |
||||
|
response.put("data", list); |
||||
|
|
||||
|
} else { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getDetailsByReqId") |
||||
|
public Map<String, Object> getDetailsByReqId( |
||||
|
@RequestParam String requestId) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
try { |
||||
|
|
||||
|
List<Map<String,Object>> list = domesticWasteService.getDetailsByReqId(requestId); |
||||
|
|
||||
|
if (!list.isEmpty()) { |
||||
|
|
||||
|
response.put("status", "success"); |
||||
|
response.put("data", list); |
||||
|
|
||||
|
} else { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/cancelbyagents") |
||||
|
public ResponseEntity<Map<String, Object>> saveAnswer(@RequestParam String requestId,@RequestParam String remarks,@RequestParam String userId) { |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
boolean success = domesticWasteService.changeStatus(requestId,remarks,userId); |
||||
|
if (success) { |
||||
|
response.put("status", "success"); |
||||
|
response.put("message", "Complaint cancelled successfully!"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} else { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Fail to Update."); |
||||
|
return ResponseEntity.status(500).body(response); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Exception: " + e.getMessage()); |
||||
|
return ResponseEntity.status(500).body(response); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.QaqcAgentsService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/domestic_waste") |
||||
|
@Controller("callCenterDomesticWasteController") |
||||
|
public class DomesticWasteMainController { |
||||
|
|
||||
|
@Autowired |
||||
|
private QaqcAgentsService agentsService; |
||||
|
|
||||
|
@GetMapping("/registerpage") |
||||
|
public String viewDomesticWastepage(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId",userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
List<Map<String, Object>> agent=agentsService.getAgentName(userId); |
||||
|
model.addAttribute("agent", agent); |
||||
|
|
||||
|
return "modules/callcenterqaqc/domesticwastecomplaints"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/checkstatus") |
||||
|
public String viewComplaintspage(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId",userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
List<Map<String, Object>> agent=agentsService.getAgentName(userId); |
||||
|
model.addAttribute("agent", agent); |
||||
|
|
||||
|
return "modules/callcenterqaqc/domesticwastecheckstatus"; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/cancelpage") |
||||
|
public String viewpendingpage(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId",userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
List<Map<String, Object>> agent=agentsService.getAgentName(userId); |
||||
|
model.addAttribute("agent", agent); |
||||
|
|
||||
|
return "modules/callcenterqaqc/domesticwastecancel"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,534 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collections; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.client.HttpClientErrorException; |
||||
|
import org.springframework.web.client.HttpServerErrorException; |
||||
|
import org.springframework.web.client.ResourceAccessException; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.type.TypeReference; |
||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.ScpService; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/gcc/api/scp") |
||||
|
public class ScpApiController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private RestTemplate restTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
private ObjectMapper objectMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private ScpService scpservice; |
||||
|
|
||||
|
@GetMapping("/getdatabyfilters") |
||||
|
public Map<String, Object> getdatabyfilters( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedStartDate = LocalDate.parse(startDate, inputFormat).format(outputFormat); |
||||
|
String formattedEndDate = LocalDate.parse(endDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
// Build API URL |
||||
|
String apiUrl = "https://gccservices.in/gccofficialapp/api/asset/scpfilterReports" |
||||
|
+ "?assetTypeId=2" |
||||
|
+ "&fromDate=" + formattedStartDate |
||||
|
+ "&toDate=" + formattedEndDate |
||||
|
+ "&loginId=5662"; |
||||
|
|
||||
|
if (!zone.isEmpty()) { |
||||
|
apiUrl += "&zone=" + zone; |
||||
|
} |
||||
|
if (!ward.isEmpty()) { |
||||
|
apiUrl += "&ward=" + ward; |
||||
|
} |
||||
|
|
||||
|
System.out.println("apiUrl=" + apiUrl); |
||||
|
|
||||
|
// Call the external API |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
ResponseEntity<String> apiResponse = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
|
||||
|
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
||||
|
|
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
|
||||
|
// Parse full JSON |
||||
|
JsonNode rootNode = mapper.readTree(apiResponse.getBody()); |
||||
|
|
||||
|
// Extract "scpreport" array |
||||
|
JsonNode reportNode = rootNode.path("scpreport"); |
||||
|
|
||||
|
if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} else { |
||||
|
// Convert JSON array → List<Map<String, Object>> |
||||
|
List<Map<String, Object>> reportList = mapper.convertValue( |
||||
|
reportNode, |
||||
|
new TypeReference<List<Map<String, Object>>>() {} |
||||
|
); |
||||
|
|
||||
|
response.put("status", "success"); |
||||
|
response.put("data", reportList); |
||||
|
if(zone.isEmpty() && ward.isEmpty()) { |
||||
|
response.put("table", "table1"); |
||||
|
} |
||||
|
else if(ward.isEmpty() && !zone.isEmpty()) { |
||||
|
response.put("table", "table2"); |
||||
|
} |
||||
|
else if(!ward.isEmpty() && !zone.isEmpty()) { |
||||
|
response.put("table", "table3"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} else { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getzones") |
||||
|
public ResponseEntity<Map<String, Object>> getzones() { |
||||
|
String apiUrl = "https://gccservices.in/gccrestservices/dropdown/api/zone"; |
||||
|
Map<String, Object> responseMap = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
String response = restTemplate.getForObject(apiUrl, String.class); |
||||
|
|
||||
|
ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
JsonNode rootArray = objectMapper.readTree(response); |
||||
|
|
||||
|
// ✅ The response is an array, so get the first element |
||||
|
if (rootArray.isArray() && rootArray.size() > 0) { |
||||
|
JsonNode firstObject = rootArray.get(0); |
||||
|
|
||||
|
boolean status = firstObject.path("status").asBoolean(false); |
||||
|
|
||||
|
if (status) { |
||||
|
JsonNode dataArray = firstObject.path("data"); |
||||
|
responseMap.put("status", "success"); |
||||
|
responseMap.put("code", 200); |
||||
|
responseMap.put("message", "Data found"); |
||||
|
responseMap.put("data", objectMapper.convertValue( |
||||
|
dataArray, new TypeReference<List<Map<String, Object>>>() {})); |
||||
|
return ResponseEntity.ok(responseMap); |
||||
|
} else { |
||||
|
responseMap.put("status", "failure"); |
||||
|
responseMap.put("code", 404); |
||||
|
responseMap.put("message", "No Zones found"); |
||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); |
||||
|
} |
||||
|
} else { |
||||
|
responseMap.put("status", "failure"); |
||||
|
responseMap.put("code", 404); |
||||
|
responseMap.put("message", "Invalid response format"); |
||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception ex) { |
||||
|
responseMap.put("status", "error"); |
||||
|
responseMap.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); |
||||
|
responseMap.put("message", "Unexpected error occurred"); |
||||
|
responseMap.put("details", ex.getMessage()); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMap); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getwardbyzone") |
||||
|
public ResponseEntity<Map<String, Object>> getwardbyzone( @RequestParam String zone) { |
||||
|
String apiUrl = "https://gccservices.in/gccrestservices/dropdown/api/wardbyzone?zoneId="+zone; |
||||
|
Map<String, Object> responseMap = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
String response = restTemplate.getForObject(apiUrl, String.class); |
||||
|
|
||||
|
ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
JsonNode rootArray = objectMapper.readTree(response); |
||||
|
|
||||
|
// ✅ The response is an array, so get the first element |
||||
|
if (rootArray.isArray() && rootArray.size() > 0) { |
||||
|
JsonNode firstObject = rootArray.get(0); |
||||
|
|
||||
|
boolean status = firstObject.path("status").asBoolean(false); |
||||
|
|
||||
|
if (status) { |
||||
|
JsonNode dataArray = firstObject.path("data"); |
||||
|
responseMap.put("status", "success"); |
||||
|
responseMap.put("code", 200); |
||||
|
responseMap.put("message", "Data found"); |
||||
|
responseMap.put("data", objectMapper.convertValue( |
||||
|
dataArray, new TypeReference<List<Map<String, Object>>>() {})); |
||||
|
return ResponseEntity.ok(responseMap); |
||||
|
} else { |
||||
|
responseMap.put("status", "failure"); |
||||
|
responseMap.put("code", 404); |
||||
|
responseMap.put("message", "No Zones found"); |
||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); |
||||
|
} |
||||
|
} else { |
||||
|
responseMap.put("status", "failure"); |
||||
|
responseMap.put("code", 404); |
||||
|
responseMap.put("message", "Invalid response format"); |
||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception ex) { |
||||
|
responseMap.put("status", "error"); |
||||
|
responseMap.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); |
||||
|
responseMap.put("message", "Unexpected error occurred"); |
||||
|
responseMap.put("details", ex.getMessage()); |
||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMap); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getstreetdetails") |
||||
|
public Map<String, Object> getstreetdetails( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam String variable) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedStartDate = LocalDate.parse(startDate, inputFormat).format(outputFormat); |
||||
|
String formattedEndDate = LocalDate.parse(endDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
// 🔹 Call external API |
||||
|
String apiUrl = "https://gccservices.in/gccofficialapp/api/asset/scpReportAssetList" |
||||
|
+ "?assetTypeId=2" |
||||
|
+ "&fromDate=" + formattedStartDate |
||||
|
+ "&toDate=" + formattedEndDate |
||||
|
+ "&loginId=5662" |
||||
|
+ "&status=Cleaned" |
||||
|
+ "&streetid=" + variable; |
||||
|
|
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
ResponseEntity<String> apiResponse = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
|
||||
|
List<Map<String, Object>> reportData = new ArrayList<>(); |
||||
|
|
||||
|
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
JsonNode rootNode = mapper.readTree(apiResponse.getBody()); |
||||
|
JsonNode reportNode = rootNode.path("scpreport"); |
||||
|
|
||||
|
if (reportNode.isArray() && reportNode.size() > 0) { |
||||
|
reportData = mapper.convertValue( |
||||
|
reportNode, |
||||
|
new TypeReference<List<Map<String, Object>>>() {} |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (reportData.isEmpty()) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} else { |
||||
|
// 🔹 Enrich each data item with questions_part |
||||
|
List<Map<String, Object>> enrichedData = scpservice.enrichScpReportWithQuestions(reportData); |
||||
|
|
||||
|
response.put("status", "success"); |
||||
|
response.put("data", enrichedData); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// @PostMapping("/saveanswer") |
||||
|
// public ResponseEntity<Map<String, Object>> saveAnswer(@RequestBody List<Map<String, Object>> answers) { |
||||
|
// Map<String, Object> response = new HashMap<>(); |
||||
|
// |
||||
|
// try { |
||||
|
// boolean success = scpservice.saveAnswers(answers); |
||||
|
// if (success) { |
||||
|
// response.put("status", "success"); |
||||
|
// response.put("message", "Feedback submitted successfully!"); |
||||
|
// return ResponseEntity.ok(response); |
||||
|
// } else { |
||||
|
// response.put("status", "error"); |
||||
|
// response.put("message", "Fail to Save."); |
||||
|
// return ResponseEntity.status(500).body(response); |
||||
|
// } |
||||
|
// } catch (Exception e) { |
||||
|
// e.printStackTrace(); |
||||
|
// response.put("status", "error"); |
||||
|
// response.put("message", "Exception: " + e.getMessage()); |
||||
|
// return ResponseEntity.status(500).body(response); |
||||
|
// } |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
@PostMapping("/saveanswer") |
||||
|
public ResponseEntity<Map<String, Object>> saveAnswer(@RequestBody List<Map<String, Object>> answers) { |
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
String result = scpservice.saveAnswers(answers); |
||||
|
|
||||
|
if ("success".equals(result)) { |
||||
|
response.put("status", "success"); |
||||
|
response.put("message", "Feedback submitted successfully!"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
|
||||
|
} else if ("duplicate".equals(result)) { |
||||
|
response.put("status", "duplicate"); |
||||
|
response.put("message", "Already submitted by another one, So refresh the page"); |
||||
|
return ResponseEntity.ok(response); |
||||
|
|
||||
|
} else { |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Fail to Save."); |
||||
|
return ResponseEntity.ok(response); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", "Exception: " + e.getMessage()); |
||||
|
return ResponseEntity.status(500).body(response); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("/getreportdatabyfilters") |
||||
|
public Map<String, Object> getreportdatabyfilters( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate, |
||||
|
@RequestParam String zone, |
||||
|
@RequestParam String ward) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
||||
|
|
||||
|
String formattedStartDate = LocalDate.parse(startDate, inputFormat).format(outputFormat); |
||||
|
String formattedEndDate = LocalDate.parse(endDate, inputFormat).format(outputFormat); |
||||
|
|
||||
|
// Build API URL |
||||
|
String apiUrl = "https://gccservices.in/gccofficialapp/api/asset/scpfilterReports" |
||||
|
+ "?assetTypeId=2" |
||||
|
+ "&fromDate=" + formattedStartDate |
||||
|
+ "&toDate=" + formattedEndDate |
||||
|
+ "&loginId=5662"; |
||||
|
|
||||
|
if (!zone.isEmpty()) { |
||||
|
apiUrl += "&zone=" + zone; |
||||
|
} |
||||
|
if (!ward.isEmpty()) { |
||||
|
apiUrl += "&ward=" + ward; |
||||
|
} |
||||
|
|
||||
|
System.out.println("apiUrl=" + apiUrl); |
||||
|
|
||||
|
// Call the external API |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
ResponseEntity<String> apiResponse = restTemplate.getForEntity(apiUrl, String.class); |
||||
|
|
||||
|
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
||||
|
|
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
|
||||
|
// Parse full JSON |
||||
|
JsonNode rootNode = mapper.readTree(apiResponse.getBody()); |
||||
|
|
||||
|
// Extract "scpreport" array |
||||
|
JsonNode reportNode = rootNode.path("scpreport"); |
||||
|
|
||||
|
if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} else { |
||||
|
// Convert JSON array → List<Map<String, Object>> |
||||
|
List<Map<String, Object>> reportList = mapper.convertValue( |
||||
|
reportNode, |
||||
|
new TypeReference<List<Map<String, Object>>>() {} |
||||
|
); |
||||
|
|
||||
|
|
||||
|
// Declare dbMap outside conditional blocks |
||||
|
Map<String, Map<String, Object>> dbMap = new HashMap<>(); |
||||
|
List<Map<String, Object>> dbList = new ArrayList<>(); |
||||
|
|
||||
|
// Fetch DB data based on filters |
||||
|
if (zone.isEmpty() && ward.isEmpty()) { |
||||
|
dbList = scpservice.getZoneWiseReportData(); |
||||
|
dbMap = dbList.stream().collect(Collectors.toMap( |
||||
|
row -> String.valueOf(row.get("zone")), |
||||
|
row -> row |
||||
|
)); |
||||
|
} else if (ward.isEmpty() && !zone.isEmpty()) { |
||||
|
dbList = scpservice.getWardWiseReportData(zone); |
||||
|
dbMap = dbList.stream().collect(Collectors.toMap( |
||||
|
row -> String.valueOf(row.get("ward")), |
||||
|
row -> row |
||||
|
)); |
||||
|
} else if (!ward.isEmpty() && !zone.isEmpty()) { |
||||
|
dbList = scpservice.getStreetWiseReportData(zone, ward); |
||||
|
dbMap = dbList.stream().collect(Collectors.toMap( |
||||
|
row -> String.valueOf(row.get("streetid")), |
||||
|
row -> row |
||||
|
)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// Merge API data with DB data |
||||
|
// Merge API data with DB data |
||||
|
for (int i = 0; i < reportList.size(); i++) { |
||||
|
Map<String, Object> apiRow = reportList.get(i); |
||||
|
String variableValue = String.valueOf(apiRow.get("VARIABLE")); |
||||
|
boolean isLast = (i == reportList.size() - 1); // check if it's the last element |
||||
|
|
||||
|
if (dbMap.containsKey(variableValue)) { |
||||
|
Map<String, Object> dbRow = dbMap.get(variableValue); |
||||
|
apiRow.put("Completed", dbRow.get("Completed")); |
||||
|
apiRow.put("Yes", dbRow.get("YesCount")); |
||||
|
apiRow.put("No", dbRow.get("NoCount")); |
||||
|
apiRow.put("Available", dbRow.get("AvailableCount")); |
||||
|
apiRow.put("Not Available", dbRow.get("NotAvailableCount")); |
||||
|
apiRow.put("Image Not Clear", dbRow.get("ImageNotClearCount")); |
||||
|
apiRow.put("LidGoodYesCount", dbRow.get("LidGoodYesCount")); |
||||
|
apiRow.put("LidGoodNoCount", dbRow.get("LidGoodNoCount")); |
||||
|
} else { |
||||
|
// If last list → use "-" |
||||
|
if (isLast) { |
||||
|
apiRow.put("Completed", "-"); |
||||
|
apiRow.put("Yes", "-"); |
||||
|
apiRow.put("No", "-"); |
||||
|
apiRow.put("Available", "-"); |
||||
|
apiRow.put("Not Available", "-"); |
||||
|
apiRow.put("Image Not Clear", "-"); |
||||
|
apiRow.put("LidGoodYesCount", "-"); |
||||
|
apiRow.put("LidGoodNoCount", "-"); |
||||
|
} else { |
||||
|
// For all others → use 0 |
||||
|
apiRow.put("Completed", 0); |
||||
|
apiRow.put("Yes", 0); |
||||
|
apiRow.put("No", 0); |
||||
|
apiRow.put("Available", 0); |
||||
|
apiRow.put("Not Available", 0); |
||||
|
apiRow.put("Image Not Clear", 0); |
||||
|
apiRow.put("LidGoodYesCount", 0); |
||||
|
apiRow.put("LidGoodNoCount", 0); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
response.put("status", "success"); |
||||
|
response.put("data", reportList); |
||||
|
if(zone.isEmpty() && ward.isEmpty()) { |
||||
|
response.put("table", "table1"); |
||||
|
} |
||||
|
else if(ward.isEmpty() && !zone.isEmpty()) { |
||||
|
response.put("table", "table2"); |
||||
|
} |
||||
|
else if(!ward.isEmpty() && !zone.isEmpty()) { |
||||
|
response.put("table", "table3"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} else { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("data", Collections.emptyList()); |
||||
|
} |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/getdetailreportdata") |
||||
|
public Map<String, Object> getDetailreportdatabyfilters( |
||||
|
@RequestParam String startDate, |
||||
|
@RequestParam String endDate) { |
||||
|
|
||||
|
Map<String, Object> response = new HashMap<>(); |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
List<Map<String,Object>> list=scpservice.getdetailreport(startDate,endDate); |
||||
|
|
||||
|
if(list.isEmpty()) { |
||||
|
response.put("status", "nodata"); |
||||
|
response.put("message", "No Data"); |
||||
|
} |
||||
|
else { |
||||
|
response.put("status", "success"); |
||||
|
response.put("data", list); |
||||
|
response.put("message", "Fetched Data Successfully"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
response.put("status", "error"); |
||||
|
response.put("message", e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.Model; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.QaqcAgentsService; |
||||
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
||||
|
|
||||
|
@RequestMapping("/gcc/callcenterqaqcscp") |
||||
|
@Controller("callCenterQaQcScpController") |
||||
|
public class ScpMaincontroller { |
||||
|
|
||||
|
@Autowired |
||||
|
private QaqcAgentsService agentsService; |
||||
|
|
||||
|
@GetMapping("/scpverification") |
||||
|
public String viewDomesticWastepage(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId",userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
List<Map<String, Object>> agent=agentsService.getAgentName(userId); |
||||
|
model.addAttribute("agent", agent); |
||||
|
|
||||
|
return "modules/callcenterqaqc/scpverification"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@GetMapping("/scpreport") |
||||
|
public String viewReportPage(Model model) { |
||||
|
String loginUserId = LoginUserInfo.getLoginUserId(); |
||||
|
int userId = Integer.parseInt(loginUserId); |
||||
|
|
||||
|
model.addAttribute("LoginUserId", loginUserId); |
||||
|
model.addAttribute("userId",userId); |
||||
|
model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); |
||||
|
model.addAttribute("UserRole", LoginUserInfo.getUserRole()); |
||||
|
|
||||
|
List<Map<String, Object>> agent=agentsService.getAgentName(userId); |
||||
|
model.addAttribute("agent", agent); |
||||
|
|
||||
|
return "modules/callcenterqaqc/scpreport"; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,308 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.service; |
||||
|
|
||||
|
import java.sql.PreparedStatement; |
||||
|
import java.sql.Statement; |
||||
|
import java.time.LocalDate; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.ArrayList; |
||||
|
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.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.jdbc.support.GeneratedKeyHolder; |
||||
|
import org.springframework.jdbc.support.KeyHolder; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.type.TypeReference; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
|
||||
|
@Service |
||||
|
public class DomesticWasteService { |
||||
|
|
||||
|
@Autowired |
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Value("${fileBaseUrl}") |
||||
|
private String fileBaseUrl; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDatasource(@Qualifier("mysqlDomesticWasteDataSource") DataSource datasource) { |
||||
|
this.jdbcTemplate=new JdbcTemplate(datasource); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public Map<String, Object> saveMultipleWasteRequests(String user_name, String mobile, String address, |
||||
|
String latitude, String longitude, |
||||
|
String street_name, String street_id, String remarks, |
||||
|
String itemsJson,String userId,String zone, String ward) { |
||||
|
|
||||
|
|
||||
|
int agent_id=Integer.parseInt(userId); |
||||
|
int is_app=3; |
||||
|
String remarks1; |
||||
|
if (remarks == null || remarks.trim().isEmpty()) { |
||||
|
remarks1 = "-"; |
||||
|
} else { |
||||
|
remarks1 = remarks; |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
List<Map<String, Object>> items = objectMapper.readValue(itemsJson, new TypeReference<>() {}); |
||||
|
|
||||
|
String sofaSize = null; // declare before lambda |
||||
|
for (Map<String, Object> item : items) { |
||||
|
if ("2".equals(item.get("item_id").toString())) { // Sofa id = 2 |
||||
|
Object sizeObj = item.get("sofa_size"); // match your JS payload key |
||||
|
if (sizeObj != null && !sizeObj.toString().isEmpty()) { |
||||
|
sofaSize = sizeObj.toString(); |
||||
|
} |
||||
|
break; // found sofa, no need to loop further |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
final String finalSofaSize = sofaSize; |
||||
|
|
||||
|
|
||||
|
// Step 1: Insert main request (one time) |
||||
|
String insertMainSql = "INSERT INTO user_request_table " + |
||||
|
"(request_id, user_name, mobile, address, latitude, longitude, street_name, street_id, remarks,agent_id,is_app,zone,division,sofa_type) " + |
||||
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?)"; |
||||
|
|
||||
|
KeyHolder keyHolder = new GeneratedKeyHolder(); |
||||
|
jdbcTemplate.update(con -> { |
||||
|
PreparedStatement ps = con.prepareStatement(insertMainSql, Statement.RETURN_GENERATED_KEYS); |
||||
|
ps.setString(1, "TEMP"); // placeholder |
||||
|
ps.setString(2, user_name); |
||||
|
ps.setString(3, mobile); |
||||
|
ps.setString(4, address); |
||||
|
ps.setString(5, latitude); |
||||
|
ps.setString(6, longitude); |
||||
|
ps.setString(7, street_name); |
||||
|
ps.setString(8, street_id); |
||||
|
ps.setString(9, remarks1); |
||||
|
ps.setInt(10, agent_id); |
||||
|
ps.setInt(11, is_app); |
||||
|
ps.setString(12, zone); |
||||
|
ps.setString(13, ward); |
||||
|
ps.setString(14, finalSofaSize); |
||||
|
return ps; |
||||
|
}, keyHolder); |
||||
|
|
||||
|
int generatedId = keyHolder.getKey().intValue(); |
||||
|
String requestId = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + generatedId; |
||||
|
|
||||
|
// Update request_id in user_request_table |
||||
|
jdbcTemplate.update("UPDATE user_request_table SET request_id = ? WHERE id = ?", requestId, generatedId); |
||||
|
|
||||
|
|
||||
|
String insertItemSql = "INSERT INTO items (iteam_id, quantity, req_table_id, requedt_id) VALUES (?, ?, ?, ?)"; |
||||
|
|
||||
|
for (Map<String, Object> item : items) { |
||||
|
Object itemIdObj = item.get("item_id"); |
||||
|
Object quantityObj = item.get("quantity"); |
||||
|
|
||||
|
if (itemIdObj == null || quantityObj == null) { |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
int itemId = Integer.parseInt(itemIdObj.toString()); |
||||
|
int quantity = Integer.parseInt(quantityObj.toString()); |
||||
|
|
||||
|
jdbcTemplate.update(insertItemSql, itemId, quantity, generatedId, requestId); |
||||
|
} |
||||
|
|
||||
|
return Map.of("status", true,"message", "Request saved successfully","requestId", requestId); |
||||
|
|
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return Map.of("status", false, "message", "Error: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getAllComplaintsList(String startDate, String endDate, String mobile, String requestId) { |
||||
|
StringBuilder sql = new StringBuilder( |
||||
|
"SELECT u.*, sm.status_master AS status_name, DATE(u.cdate) AS created_date " + |
||||
|
"FROM user_request_table u " + |
||||
|
"JOIN status_master sm ON sm.id = u.status_id " + |
||||
|
"WHERE u.is_active = 1 AND u.is_delete = 0 AND sm.is_active = 1 AND sm.is_delete = 0 " |
||||
|
); |
||||
|
|
||||
|
List<Object> params = new ArrayList<>(); |
||||
|
|
||||
|
if (startDate != null && !startDate.isEmpty() && endDate != null && !endDate.isEmpty()) { |
||||
|
sql.append(" AND DATE(u.cdate) BETWEEN ? AND ? "); |
||||
|
params.add(startDate); |
||||
|
params.add(endDate); |
||||
|
} |
||||
|
|
||||
|
if (mobile != null && !mobile.isEmpty()) { |
||||
|
sql.append(" AND u.mobile = ? "); |
||||
|
params.add(mobile); |
||||
|
} |
||||
|
|
||||
|
if (requestId != null && !requestId.isEmpty()) { |
||||
|
sql.append(" AND u.request_id = ? "); |
||||
|
params.add(requestId); |
||||
|
} |
||||
|
|
||||
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); |
||||
|
|
||||
|
for (Map<String, Object> complaint : result) { |
||||
|
Number reqTableId = (Number) complaint.get("id"); |
||||
|
List<Map<String, Object>> itemList = getItemsByRequestId(reqTableId.intValue()); |
||||
|
complaint.put("items", itemList); |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getpendingcomplaints(String startDate, String endDate, String mobile) { |
||||
|
|
||||
|
StringBuilder sql = new StringBuilder("SELECT u.*, sm.status_master AS status_name, DATE(u.cdate) AS created_date" |
||||
|
+ " FROM user_request_table u " |
||||
|
+ " JOIN status_master sm ON sm.id = u.status" |
||||
|
+ " WHERE u.is_active = 1 AND u.is_delete = 0 AND u.status IN (1,3) " |
||||
|
); |
||||
|
|
||||
|
List<Object> params = new ArrayList<>(); |
||||
|
|
||||
|
if (startDate != null && !startDate.isEmpty() && endDate != null && !endDate.isEmpty()) { |
||||
|
sql.append(" AND DATE(u.cdate) BETWEEN ? AND ? "); |
||||
|
params.add(startDate); |
||||
|
params.add(endDate); |
||||
|
} |
||||
|
|
||||
|
if (mobile != null && !mobile.isEmpty()) { |
||||
|
sql.append(" AND u.mobile = ? "); |
||||
|
params.add(mobile); |
||||
|
} |
||||
|
|
||||
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); |
||||
|
|
||||
|
for (Map<String, Object> complaint : result) { |
||||
|
Number reqTableId = (Number) complaint.get("id"); |
||||
|
List<Map<String, Object>> itemList = getItemsByRequestId(reqTableId.intValue()); |
||||
|
complaint.put("items", itemList); |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getItemsByRequestId(int reqTableId) { |
||||
|
String itemSql = "SELECT i.iteam_id, im.item_name, i.quantity " + |
||||
|
"FROM items i " + |
||||
|
"LEFT JOIN item_master im ON i.iteam_id = im.id " + |
||||
|
"WHERE i.is_active = 1 AND i.is_delete = 0 AND i.req_table_id = ?"; |
||||
|
return jdbcTemplate.queryForList(itemSql, reqTableId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getDetailsByReqId(String requestId) { |
||||
|
|
||||
|
String sql = "SELECT " + |
||||
|
"u.id, u.request_id, u.user_name, u.mobile, u.address, u.latitude, u.longitude, " + |
||||
|
"u.zone, u.division, u.street_name, u.quantity AS main_quantity, u.remarks, " + |
||||
|
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', u.image_url) AS image_url, " + |
||||
|
"DATE_FORMAT(u.cdate, '%d-%m-%Y') AS cdate, " + |
||||
|
"u.is_active, u.is_delete, u.street_id, sm.status_master AS status, u.is_app, " + |
||||
|
"DATE_FORMAT(u.close_date, '%d-%m-%Y') AS close_date, " + |
||||
|
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', u.officer_upload_url) AS officer_upload_url, " + |
||||
|
"itm.iteam_id, itm.quantity, im.item_name " + |
||||
|
"FROM user_request_table u " + |
||||
|
"LEFT JOIN items itm ON u.id = itm.req_table_id " + |
||||
|
"LEFT JOIN item_master im ON itm.iteam_id = im.id AND im.is_active = 1 " + |
||||
|
"LEFT JOIN status_master sm ON sm.id = u.status AND sm.is_active = 1 AND sm.is_delete = 0 " + |
||||
|
"WHERE u.request_id = ? AND u.is_active = 1"; |
||||
|
|
||||
|
List<Map<String, Object>> rawList = jdbcTemplate.queryForList(sql, requestId); |
||||
|
|
||||
|
Map<Integer, Map<String, Object>> groupedMap = new LinkedHashMap<>(); |
||||
|
|
||||
|
for (Map<String, Object> row : rawList) { |
||||
|
Integer id = (Integer) row.get("id"); |
||||
|
|
||||
|
Map<String, Object> item = null; |
||||
|
if (row.get("item_name") != null) { |
||||
|
item = new LinkedHashMap<>(); |
||||
|
item.put("item_name", row.get("item_name")); |
||||
|
item.put("quantity", row.get("quantity")); |
||||
|
} |
||||
|
|
||||
|
if (groupedMap.containsKey(id)) { |
||||
|
if (item != null) { |
||||
|
((List<Map<String, Object>>) groupedMap.get(id).get("items")).add(item); |
||||
|
} |
||||
|
} else { |
||||
|
Map<String, Object> newEntry = new LinkedHashMap<>(); |
||||
|
newEntry.put("id", id); |
||||
|
newEntry.put("request_id", row.get("request_id")); |
||||
|
newEntry.put("user_name", row.get("user_name")); |
||||
|
newEntry.put("mobile", row.get("mobile")); |
||||
|
newEntry.put("address", row.get("address")); |
||||
|
newEntry.put("latitude", row.get("latitude")); |
||||
|
newEntry.put("longitude", row.get("longitude")); |
||||
|
newEntry.put("zone", row.get("zone")); |
||||
|
newEntry.put("division", row.get("division")); |
||||
|
newEntry.put("street_name", row.get("street_name")); |
||||
|
newEntry.put("main_quantity", row.get("main_quantity")); |
||||
|
newEntry.put("remarks", row.get("remarks")); |
||||
|
newEntry.put("image_url", row.get("image_url")); |
||||
|
newEntry.put("cdate", row.get("cdate")); |
||||
|
newEntry.put("is_active", row.get("is_active")); |
||||
|
newEntry.put("is_delete", row.get("is_delete")); |
||||
|
newEntry.put("street_id", row.get("street_id")); |
||||
|
newEntry.put("status", row.get("status")); // Now this is human-readable |
||||
|
newEntry.put("is_app", row.get("is_app")); |
||||
|
newEntry.put("close_date", row.get("close_date")); |
||||
|
newEntry.put("officer_upload_url", row.get("officer_upload_url")); |
||||
|
|
||||
|
List<Map<String, Object>> items = new ArrayList<>(); |
||||
|
if (item != null) { |
||||
|
items.add(item); |
||||
|
} |
||||
|
newEntry.put("items", items); |
||||
|
|
||||
|
groupedMap.put(id, newEntry); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return new ArrayList<>(groupedMap.values()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public boolean changeStatus(String requestId, String remarks, String userId) { |
||||
|
String sql = "UPDATE user_request_table " + |
||||
|
"SET status = 5, " + |
||||
|
"officer_remark = ?, " + |
||||
|
"cancelled_by = ?, " + |
||||
|
"rejecttype = 'Without Location', " + |
||||
|
"reject_latitude = 0.0, " + |
||||
|
"reject_longitude = 0.0 " + |
||||
|
"WHERE request_id = ?"; |
||||
|
|
||||
|
int result = jdbcTemplate.update(sql, remarks, userId, requestId); |
||||
|
return result > 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,299 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.callcenterqaqc.service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collections; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.HashSet; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Objects; |
||||
|
import java.util.Set; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class ScpService { |
||||
|
|
||||
|
private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Autowired |
||||
|
public void setDataSource(@Qualifier("mysqlScpDataSource") DataSource dataSource) { |
||||
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// Method to enrich report data with questions_part |
||||
|
public List<Map<String, Object>> enrichScpReportWithQuestions(List<Map<String, Object>> reportData) { |
||||
|
|
||||
|
// Step 1: Fetch all questions |
||||
|
String questionSql = "SELECT id AS question_id, questions AS question, answer_type, isactive, isdelete FROM questions WHERE isactive=1 AND isdelete=0"; |
||||
|
List<Map<String, Object>> questionList = jdbcTemplate.queryForList(questionSql); |
||||
|
|
||||
|
// Step 2: Fetch all answers (master answers) |
||||
|
String answerSql = "SELECT question_id, answer FROM answers WHERE isactive=1 AND isdelete=0"; |
||||
|
List<Map<String, Object>> answerList = jdbcTemplate.queryForList(answerSql); |
||||
|
|
||||
|
// Convert answerList to Map<question_id, List<String>> for easy mapping |
||||
|
Map<Integer, List<String>> answerMasterMap = new HashMap<>(); |
||||
|
for (Map<String, Object> ans : answerList) { |
||||
|
Integer qid = (Integer) ans.get("question_id"); |
||||
|
String answerVal = (String) ans.get("answer"); |
||||
|
answerMasterMap.computeIfAbsent(qid, k -> new ArrayList<>()).add(answerVal); |
||||
|
} |
||||
|
|
||||
|
// Step 3: Fetch all scp_report entries for these scp_ids |
||||
|
List<Long> scpIds = reportData.stream() |
||||
|
.map(d -> ((Number) d.get("id")).longValue()) |
||||
|
.collect(Collectors.toList()); |
||||
|
|
||||
|
// Step 4: Get existing scp_ids from scp_report |
||||
|
Set<Long> existingScpIds = new HashSet<>(); |
||||
|
if (!scpIds.isEmpty()) { |
||||
|
String inClause = scpIds.stream().map(id -> "?").collect(Collectors.joining(",")); |
||||
|
String sql = "SELECT DISTINCT scp_id FROM scp_report WHERE isactive=1 AND isdelete=0 AND scp_id IN (" + inClause + ")"; |
||||
|
List<Map<String, Object>> existingList = jdbcTemplate.queryForList(sql, scpIds.toArray()); |
||||
|
for (Map<String, Object> row : existingList) { |
||||
|
existingScpIds.add(((Number) row.get("scp_id")).longValue()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Step 5: Filter out already answered scp_ids |
||||
|
List<Map<String, Object>> filteredReportData = reportData.stream() |
||||
|
.filter(d -> !existingScpIds.contains(((Number) d.get("id")).longValue())) |
||||
|
.collect(Collectors.toList()); |
||||
|
|
||||
|
// Step 6: Attach questions only to the filtered list |
||||
|
for (Map<String, Object> report : filteredReportData) { |
||||
|
Long scpId = ((Number) report.get("id")).longValue(); |
||||
|
List<Map<String, Object>> questionsPart = new ArrayList<>(); |
||||
|
|
||||
|
for (Map<String, Object> question : questionList) { |
||||
|
Integer qid = (Integer) question.get("question_id"); |
||||
|
|
||||
|
Map<String, Object> questionPart = new HashMap<>(); |
||||
|
questionPart.put("question_id", qid); |
||||
|
questionPart.put("question", question.get("question")); |
||||
|
questionPart.put("answer_type", question.get("answer_type")); |
||||
|
questionPart.put("answer_master", answerMasterMap.getOrDefault(qid, Collections.emptyList())); |
||||
|
|
||||
|
// Empty answers since these scp_ids don’t exist yet |
||||
|
Map<String, Object> answersMap = new HashMap<>(); |
||||
|
answersMap.put("scp_id", scpId); |
||||
|
answersMap.put("question_id", qid); |
||||
|
answersMap.put("answer", null); |
||||
|
answersMap.put("agent_id", null); |
||||
|
|
||||
|
questionPart.put("answers", answersMap); |
||||
|
questionsPart.add(questionPart); |
||||
|
} |
||||
|
|
||||
|
report.put("questions_part", questionsPart); |
||||
|
} |
||||
|
|
||||
|
return filteredReportData; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// public boolean saveAnswers(List<Map<String, Object>> answers) { |
||||
|
// if (answers == null || answers.isEmpty()) return false; |
||||
|
// |
||||
|
// String sql = "INSERT INTO scp_report (scp_id, question_id, answer, agent_id, zone, ward, streetid, street_name, last_feedback_date) " |
||||
|
// + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
||||
|
// |
||||
|
// int[][] result = jdbcTemplate.batchUpdate(sql, answers, answers.size(), (ps, answer) -> { |
||||
|
// |
||||
|
// // Convert safely to String or Integer |
||||
|
// String scpIdStr = getSafeString(answer.get("scp_id")); |
||||
|
// String questionIdStr = getSafeString(answer.get("question_id")); |
||||
|
// String answerStr = getSafeString(answer.get("answer")); |
||||
|
// String agentIdStr = getSafeString(answer.get("agent_id")); |
||||
|
// String zone = getSafeString(answer.get("zone")); |
||||
|
// String ward = getSafeString(answer.get("ward")); |
||||
|
// String streetId = getSafeString(answer.get("street_id")); |
||||
|
// String streetName = getSafeString(answer.get("street_name")); |
||||
|
// String lastFeedback = getSafeString(answer.get("lastfeedback")); |
||||
|
// |
||||
|
// // Parse integers only if not null |
||||
|
// Integer scpId = (scpIdStr != null) ? Integer.parseInt(scpIdStr) : null; |
||||
|
// Integer questionId = (questionIdStr != null) ? Integer.parseInt(questionIdStr) : null; |
||||
|
// Integer agentId = (agentIdStr != null) ? Integer.parseInt(agentIdStr) : null; |
||||
|
// |
||||
|
// // Set parameters |
||||
|
// ps.setObject(1, scpId); |
||||
|
// ps.setObject(2, questionId); |
||||
|
// ps.setObject(3, answerStr); |
||||
|
// ps.setObject(4, agentId); |
||||
|
// ps.setObject(5, zone); |
||||
|
// ps.setObject(6, ward); |
||||
|
// ps.setObject(7, streetId); |
||||
|
// ps.setObject(8, streetName); |
||||
|
// ps.setObject(9, lastFeedback); |
||||
|
// }); |
||||
|
// |
||||
|
// return result.length > 0; |
||||
|
// } |
||||
|
|
||||
|
public String saveAnswers(List<Map<String, Object>> answers) { |
||||
|
if (answers == null || answers.isEmpty()) return "error"; |
||||
|
|
||||
|
// Step 1: Extract unique scp_ids from the list |
||||
|
List<Integer> scpIds = answers.stream() |
||||
|
.map(a -> { |
||||
|
String idStr = getSafeString(a.get("scp_id")); |
||||
|
return (idStr != null) ? Integer.parseInt(idStr) : null; |
||||
|
}) |
||||
|
.filter(Objects::nonNull) |
||||
|
.distinct() |
||||
|
.toList(); |
||||
|
|
||||
|
// Step 2: Check if any of these scp_ids already exist in DB |
||||
|
String checkSql = "SELECT COUNT(*) FROM scp_report WHERE scp_id IN (:ids)"; |
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
params.put("ids", scpIds); |
||||
|
|
||||
|
NamedParameterJdbcTemplate namedJdbc = new NamedParameterJdbcTemplate(jdbcTemplate); |
||||
|
Integer count = namedJdbc.queryForObject(checkSql, params, Integer.class); |
||||
|
|
||||
|
if (count != null && count > 0) { |
||||
|
// Duplicate found — stop processing |
||||
|
return "duplicate"; |
||||
|
} |
||||
|
|
||||
|
// Step 3: Insert new answers |
||||
|
String insertSql = "INSERT INTO scp_report (scp_id, question_id, answer, agent_id, zone, ward, streetid, street_name, last_feedback_date) " |
||||
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
||||
|
|
||||
|
int[][] result = jdbcTemplate.batchUpdate(insertSql, answers, answers.size(), (ps, answer) -> { |
||||
|
String scpIdStr = getSafeString(answer.get("scp_id")); |
||||
|
String questionIdStr = getSafeString(answer.get("question_id")); |
||||
|
String answerStr = getSafeString(answer.get("answer")); |
||||
|
String agentIdStr = getSafeString(answer.get("agent_id")); |
||||
|
String zone = getSafeString(answer.get("zone")); |
||||
|
String ward = getSafeString(answer.get("ward")); |
||||
|
String streetId = getSafeString(answer.get("street_id")); |
||||
|
String streetName = getSafeString(answer.get("street_name")); |
||||
|
String lastFeedback = getSafeString(answer.get("lastfeedback")); |
||||
|
|
||||
|
Integer scpId = (scpIdStr != null) ? Integer.parseInt(scpIdStr) : null; |
||||
|
Integer questionId = (questionIdStr != null) ? Integer.parseInt(questionIdStr) : null; |
||||
|
Integer agentId = (agentIdStr != null) ? Integer.parseInt(agentIdStr) : null; |
||||
|
|
||||
|
ps.setObject(1, scpId); |
||||
|
ps.setObject(2, questionId); |
||||
|
ps.setObject(3, answerStr); |
||||
|
ps.setObject(4, agentId); |
||||
|
ps.setObject(5, zone); |
||||
|
ps.setObject(6, ward); |
||||
|
ps.setObject(7, streetId); |
||||
|
ps.setObject(8, streetName); |
||||
|
ps.setObject(9, lastFeedback); |
||||
|
}); |
||||
|
|
||||
|
return (result.length > 0) ? "success" : "error"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// Helper method |
||||
|
private String getSafeString(Object val) { |
||||
|
if (val == null) return null; |
||||
|
String s = val.toString().trim(); |
||||
|
return s.isEmpty() ? null : s; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String, Object>> getZoneWiseReportData() { |
||||
|
String sql = "SELECT " |
||||
|
+ "sr.zone," |
||||
|
+ " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" |
||||
|
+ " FROM scp_report sr" |
||||
|
+ " WHERE sr.isactive = 1 AND sr.isdelete = 0" |
||||
|
+ " GROUP BY sr.zone" |
||||
|
+ " ORDER BY sr.zone"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getWardWiseReportData(String zone) { |
||||
|
String sql = "SELECT " |
||||
|
+ "sr.zone," |
||||
|
+ "sr.ward," |
||||
|
+ " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" |
||||
|
+ " FROM scp_report sr" |
||||
|
+ " WHERE sr.isactive = 1 AND sr.isdelete = 0 AND sr.zone= ?" |
||||
|
+ " GROUP BY sr.zone,sr.ward" |
||||
|
+ " ORDER BY sr.zone,sr.ward"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql,zone); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getStreetWiseReportData(String zone,String ward) { |
||||
|
String sql = "SELECT " |
||||
|
+ "sr.zone," |
||||
|
+ "sr.ward," |
||||
|
+ "sr.streetid," |
||||
|
+ " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" |
||||
|
+ " FROM scp_report sr" |
||||
|
+ " WHERE sr.isactive = 1 AND sr.isdelete = 0 AND sr.zone=? AND sr.ward=?" |
||||
|
+ " GROUP BY sr.streetid, sr.street_name,sr.zone,sr.ward" |
||||
|
+ " ORDER BY sr.zone,sr.ward,sr.streetid"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql,zone,ward); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<Map<String,Object>> getdetailreport(String startDate, String endDate) { |
||||
|
|
||||
|
|
||||
|
String sql = "SELECT " |
||||
|
+ "sr.zone," |
||||
|
+ "sr.ward," |
||||
|
+ "sr.street_name," |
||||
|
+ " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," |
||||
|
+ " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" |
||||
|
+ " FROM scp_report sr" |
||||
|
+ " WHERE sr.isactive = 1 AND sr.isdelete = 0 AND DATE(sr.created_date) BETWEEN ? AND ?" |
||||
|
+ " GROUP BY sr.streetid, sr.street_name,sr.zone,sr.ward" |
||||
|
+ " ORDER BY sr.zone,sr.ward,sr.streetid"; |
||||
|
|
||||
|
return jdbcTemplate.queryForList(sql,startDate,endDate); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,783 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"> |
||||
|
|
||||
|
</head> |
||||
|
<style> |
||||
|
#viewModal .modal-body { |
||||
|
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
||||
|
overflow-y: auto; /* Enable vertical scrolling */ |
||||
|
} |
||||
|
|
||||
|
.custom-doc-btn { |
||||
|
height: 20px; |
||||
|
width: 80px; |
||||
|
font-size: 9px; |
||||
|
font-weight:bold; |
||||
|
text-align: center; |
||||
|
padding: 0px; |
||||
|
border:1px solid grey; |
||||
|
} |
||||
|
.col-md-3{ |
||||
|
padding-bottom: 10px; |
||||
|
} |
||||
|
|
||||
|
</style> |
||||
|
<body> |
||||
|
<div class="wrapper"> |
||||
|
|
||||
|
<!-- header top menu Start --> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
<!-- header top menu end --> |
||||
|
<div class="page-wrap"> |
||||
|
<!--=============== Left Menu side Start ================--> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<!--=============== Left side End ================--> |
||||
|
|
||||
|
|
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header mb-2"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-8"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="fa fa-list-alt bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Sofa and Bed Collection</h5> |
||||
|
<span>1913 Sofa and Bed Collection - Cancel Page</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-4"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"><a href="/gcc/index"><i |
||||
|
class="ik ik-home"></i></a></li> |
||||
|
<li class="breadcrumb-item" aria-current="page">Sofa and Bed Collection</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Cancel Complaints</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="row mt-4"> |
||||
|
<div class="col-12"> |
||||
|
<div class="card"> |
||||
|
<div class="card-header"> |
||||
|
<span style="font-size: medium;font-weight: bold;">Details Filters</span> |
||||
|
<span th:text="${userId}" style="display:none;" id="userIdSpan"></span> |
||||
|
</div> |
||||
|
<div class="card-body"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-2 mb-2"> |
||||
|
<label for="startDate" style="font-size: medium;">From Date:<span class="text-danger">*</span></label> |
||||
|
<input type="date" id="startDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-sm-2 mb-2"> |
||||
|
<label for="endDate" style="font-size: medium;">To Date:<span class="text-danger">*</span></label> |
||||
|
<input type="date" id="endDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-sm-2 mb-2"> |
||||
|
<label for="mobileNumber" style="font-size: medium;">Mobile Number:</label> |
||||
|
<input type="number" id="mobileNumber" class="form-control"> |
||||
|
</div> |
||||
|
<!-- <div class="col-sm-2 mb-2"> |
||||
|
<label for="requestNumber" style="font-size: medium;">Request Number:</label> |
||||
|
<input type="number" id="requestNumber" class="form-control"> |
||||
|
</div> --> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div class="row mt-4"> |
||||
|
<div class="col-12 d-flex justify-content-center"> |
||||
|
<button type="submit" id="searchBtn" |
||||
|
class="btn btn-primary mx-2">Search</button> |
||||
|
|
||||
|
<button class="btn btn-danger mx-2" id="resetBtn" |
||||
|
name="reset" type="reset">Reset</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="row mt-4"> |
||||
|
<div class="col-md-12"> |
||||
|
<div class="card"> |
||||
|
<div class="card-header"> |
||||
|
<span style="font-size: medium;font-weight: bold;">Complaints Open And Pending List</span> |
||||
|
</div> |
||||
|
<div class="card-body"> |
||||
|
<div class="table-responsive"> |
||||
|
|
||||
|
<table id="ReportDatatable" |
||||
|
class="table table-striped table-bordered table-hover dataTable" |
||||
|
role="grid"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr role="row"> |
||||
|
|
||||
|
<th class="text-center no-sort">S.No</th> |
||||
|
<th class="text-center" width="100px;">Date</th> |
||||
|
<th class="text-center no-sort">Request Number</th> |
||||
|
<th class="text-center no-sort">Public Name</th> |
||||
|
<th class="text-center">Public Mobile no</th> |
||||
|
<th class="text-center no-sort">Address</th> |
||||
|
<th class="text-center">Street Name</th> |
||||
|
<th class="text-center">Current Status</th> |
||||
|
<th class="text-center">Action</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<!-- Modal --> |
||||
|
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
||||
|
<div class="modal-dialog modal-lg"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h5 class="modal-title" id="viewLabel">Request Details</h5> |
||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
||||
|
<span aria-hidden="true">×</span> |
||||
|
</button> |
||||
|
</div> |
||||
|
<div class="modal-body" id="modalBodyContent"> |
||||
|
<!-- Dynamic content loads here --> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<!-- Image Modal --> |
||||
|
<div class="modal fade" id="docModal" tabindex="-1" aria-hidden="true"> |
||||
|
<div class="modal-dialog modal-dialog-scrollable modal-lg"> |
||||
|
<div class="modal-content border-0"> |
||||
|
<div class="modal-body p-0 text-center" style="background-color: #f8f9fa;"> |
||||
|
<div id="docContainer" style="max-height: 90vh; overflow: auto;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
||||
|
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
||||
|
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
||||
|
<span class="sr-only">Loading...</span> |
||||
|
</div> |
||||
|
<!-- Add the 'Please wait' text below the spinner --> |
||||
|
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- in the code use to show the download different type microsoft --> |
||||
|
|
||||
|
<!-- Include jQuery and Bootstrap JavaScript --> |
||||
|
|
||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
||||
|
|
||||
|
<script |
||||
|
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> |
||||
|
|
||||
|
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
||||
|
<!-- sweet alert --> |
||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
$(document).ready(function() { |
||||
|
|
||||
|
$('#mobileNumber').on('input', function () { |
||||
|
this.value = this.value.replace(/[^0-9]/g, '').slice(0, 10); |
||||
|
}); |
||||
|
|
||||
|
var table = $('#ReportDatatable').DataTable({ |
||||
|
dom: 'Bftip', |
||||
|
columnDefs: [ |
||||
|
{ targets: 'no-sort', orderable: false } |
||||
|
], |
||||
|
lengthMenu: [ |
||||
|
[50, 100, 200, 500, -1], |
||||
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
||||
|
], |
||||
|
scrollY: '80vh', |
||||
|
scrollX: false, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn' |
||||
|
} |
||||
|
], |
||||
|
fixedHeader: true, |
||||
|
autoWidth: false, |
||||
|
responsive: false, |
||||
|
searching: true, |
||||
|
select: false, |
||||
|
processing: false |
||||
|
}); |
||||
|
|
||||
|
// Event listener for From Date selection |
||||
|
$("#startDate").on("change", function() { |
||||
|
const startDate = $(this).val(); // Get the selected start date |
||||
|
// Set the min value for To Date to be the selected From Date |
||||
|
$("#endDate").attr("min", startDate); |
||||
|
}); |
||||
|
|
||||
|
// Event listener for To Date selection |
||||
|
$("#endDate").on("change", function() { |
||||
|
const endDate = $(this).val(); // Get the selected end date |
||||
|
// Set the max value for From Date to be the selected To Date |
||||
|
$("#startDate").attr("max", endDate); |
||||
|
}); |
||||
|
|
||||
|
document.getElementById('resetBtn').addEventListener('click', function () { |
||||
|
event.preventDefault(); |
||||
|
|
||||
|
location.reload(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
document.getElementById('searchBtn').addEventListener('click', function (e) { |
||||
|
|
||||
|
|
||||
|
let startDate = document.getElementById('startDate').value; |
||||
|
let endDate = document.getElementById('endDate').value; |
||||
|
let mobileNumber = document.getElementById('mobileNumber').value; |
||||
|
/* let requestNumber = document.getElementById('requestNumber').value; */ |
||||
|
|
||||
|
|
||||
|
console.log("startdate: ",startDate); |
||||
|
console.log("enddate: ",endDate); |
||||
|
console.log("mobileNumber: ",mobileNumber); |
||||
|
/* console.log("requestNumber: ",requestNumber); */ |
||||
|
|
||||
|
if(!startDate && !endDate){ |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'info', |
||||
|
title: 'Missing', |
||||
|
text: 'Please Select Both Dates', |
||||
|
showConfirmButton: true, |
||||
|
timer: 3000 |
||||
|
}); |
||||
|
e.preventDefault(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if(!startDate){ |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'info', |
||||
|
title: 'Missing', |
||||
|
text: 'Please Select From Date', |
||||
|
showConfirmButton: true, |
||||
|
timer: 3000 |
||||
|
}); |
||||
|
e.preventDefault(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if(!endDate){ |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'info', |
||||
|
title: 'Missing', |
||||
|
text: 'Please Select To Date', |
||||
|
showConfirmButton: true, |
||||
|
timer: 3000 |
||||
|
}); |
||||
|
e.preventDefault(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
/* if(!mobileNumber){ |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'info', |
||||
|
title: 'Missing', |
||||
|
text: 'Please Enter Mobile Number', |
||||
|
showConfirmButton: true, |
||||
|
timer: 3000 |
||||
|
}); |
||||
|
e.preventDefault(); |
||||
|
return; |
||||
|
} */ |
||||
|
|
||||
|
|
||||
|
if(mobileNumber){ |
||||
|
|
||||
|
if (!/^\d{10}$/.test(mobileNumber)) { |
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Please enter a valid 10-digit mobile number.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (/^0{10}$/.test(mobileNumber)) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Mobile number cannot be all zeros.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (mobileNumber.startsWith('0')) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Mobile number cannot start with zero.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (/^(\d)\1{9}$/.test(mobileNumber)) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Mobile number cannot have all digits the same.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
const params = new URLSearchParams({ |
||||
|
startDate:startDate, |
||||
|
endDate:endDate, |
||||
|
mobile:mobileNumber |
||||
|
}); |
||||
|
$('#pageLoader').show(); |
||||
|
$.ajax({ |
||||
|
type: "GET", |
||||
|
url: `/gcc/api/domestic_waste/getpendingcomplaints?${params.toString()}`, // Append query string to URL |
||||
|
contentType: "application/json", |
||||
|
success: function (response) { |
||||
|
console.log("API Response:", response); |
||||
|
$('#pageLoader').hide(); |
||||
|
if (response.status === "success") { |
||||
|
console.log("Details Array:", response.data); |
||||
|
// Ensure details is an array and has at least one entry |
||||
|
if (Array.isArray(response.data) && response.data.length > 0) { |
||||
|
|
||||
|
let tableContainer = $('#ReportDatatable'); |
||||
|
let table = $('#ReportDatatable').DataTable({ |
||||
|
destroy: true, |
||||
|
searching: true, |
||||
|
autoWidth: false, |
||||
|
paging: true, |
||||
|
info: true, |
||||
|
data: response.data, |
||||
|
columns: [ |
||||
|
{ |
||||
|
data: null, |
||||
|
render: (data, type, row, meta) => meta.row + 1, |
||||
|
className: 'text-center' |
||||
|
}, |
||||
|
{ data: 'created_date', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'request_id', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'user_name', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'mobile', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'address', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'street_name', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'status_name', defaultContent: '-', className: 'text-center' } , |
||||
|
{ |
||||
|
data: 'request_id', |
||||
|
render: function (data, type, row) { |
||||
|
return `<button class="btn btn-primary btn-sm btn-view" data-id="${data}">View</button>`; |
||||
|
}, |
||||
|
className: 'text-center' |
||||
|
} |
||||
|
|
||||
|
], |
||||
|
dom: 'Bfrtip', |
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn' |
||||
|
} |
||||
|
], |
||||
|
columnDefs: [ |
||||
|
{ targets: 'no-sort', orderable: false } |
||||
|
], |
||||
|
lengthMenu: [ |
||||
|
[50, 100, 200, 500, -1], |
||||
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
||||
|
], |
||||
|
scrollY: '80vh', |
||||
|
scrollX: true, |
||||
|
responsive: false, |
||||
|
searching: true |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// Bind view buttons |
||||
|
tableContainer.on('click', '.btn-view', function () { |
||||
|
let id = $(this).data('id'); |
||||
|
console.log("req_id="+id); |
||||
|
$.ajax({ |
||||
|
url: `/gcc/api/domestic_waste/getDetailsByReqId?requestId=${id}`, |
||||
|
method: 'GET', |
||||
|
success: function (response) { |
||||
|
console.log("response="+response.data); |
||||
|
|
||||
|
if(response.status === "success"){ |
||||
|
|
||||
|
const details = response.data[0]; |
||||
|
|
||||
|
// ✅ Handle items array |
||||
|
let itemsHTML = ''; |
||||
|
if (details.items && details.items.length > 0) { |
||||
|
itemsHTML += ` |
||||
|
<table class="table table-bordered table-striped"> |
||||
|
<thead class="thead-light"> |
||||
|
<tr> |
||||
|
<th class="text-center">S.No</th> |
||||
|
<th class="text-center">Item Name</th> |
||||
|
<th class="text-center">Quantity</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
`; |
||||
|
details.items.forEach((item, index) => { |
||||
|
itemsHTML += ` |
||||
|
<tr> |
||||
|
<td class="text-center">${index + 1}</td> |
||||
|
<td class="text-center">${item.item_name || '-'}</td> |
||||
|
<td class="text-center">${item.quantity || '-'}</td> |
||||
|
</tr> |
||||
|
`; |
||||
|
}); |
||||
|
itemsHTML += ` |
||||
|
</tbody> |
||||
|
</table> |
||||
|
`; |
||||
|
} else { |
||||
|
itemsHTML = `<p class="text-center text-muted mb-0">No items available.</p>`; |
||||
|
} |
||||
|
|
||||
|
const ImagePhotoBtn= details.image_url ? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.image_url}')">View</button>` : '-'; |
||||
|
|
||||
|
const content = ` |
||||
|
|
||||
|
<div class="container-fluid"> |
||||
|
|
||||
|
<!-- Personal Details --> |
||||
|
<div class="card mb-3"> |
||||
|
|
||||
|
<div class="card-header bg-primary text-white">Personal Details</div> |
||||
|
<div class="card-body row"> |
||||
|
|
||||
|
<div class="col-md-3"><strong>Name:</strong></div> |
||||
|
<div class="col-md-3">${details.user_name || '-'}</div> |
||||
|
<div class="col-md-3"><strong>Mobile:</strong></div> |
||||
|
<div class="col-md-3">${details.mobile || '-'}</div> |
||||
|
<div class="col-md-3"><strong>Zone:</strong></div> |
||||
|
<div class="col-md-3">${details.zone || '-'}</div> |
||||
|
<div class="col-md-3"><strong>Division:</strong></div> |
||||
|
<div class="col-md-3">${details.division || '-'}</div> |
||||
|
<div class="col-md-3"><strong>Address:</strong></div> |
||||
|
<div class="col-md-3">${details.address || '-'}</div> |
||||
|
<div class="col-md-3"><strong>Street:</strong></div> |
||||
|
<div class="col-md-3">${details.street_name || '-'}</div> |
||||
|
<div class="col-md-3"><strong>User Uploaded Image:</strong></div> |
||||
|
<div class="col-md-3">${ImagePhotoBtn || '-'}</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Item Details --> |
||||
|
<div class="card mb-3"> |
||||
|
<div class="card-header bg-success text-white">Item Details</div> |
||||
|
<div class="card-body"> |
||||
|
${itemsHTML} |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Remarks Section --> |
||||
|
<div class="card mb-3"> |
||||
|
<p class="mt-2 ml-3">Remarks<span class="text-danger">*</span></p> |
||||
|
<div class="card-body text-center"> |
||||
|
<textarea id="remarksText" class="form-control mb-3" rows="3" placeholder="Enter remarks..."></textarea> |
||||
|
<button class="btn btn-danger" id="submitRemarksBtn" data-id="${id}"> |
||||
|
Cancel |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
`; |
||||
|
|
||||
|
$('#modalBodyContent').html(content); |
||||
|
$('#viewLabel').text( `${id} - Details`); |
||||
|
$('#viewModal').modal('show'); |
||||
|
} |
||||
|
|
||||
|
else if (response.status === "nodata") { |
||||
|
$('#modalBodyContent').html("<p>No data found for this request.</p>"); |
||||
|
$('#viewLabel').text( `${id} - Details`); |
||||
|
$('#viewModal').modal('show'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
else if (response.status === "error") { |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
else{ |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text:'Something went wrong!' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
error: function (xhr) { |
||||
|
console.error("Error fetching detail:", xhr.responseText); |
||||
|
alert("Failed to fetch vendor details."); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
else if (response.status === "nodata") { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'No Data', |
||||
|
text: 'No Pending data available.' |
||||
|
}); |
||||
|
} |
||||
|
else if (response.status === "error") { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
else { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
error: function (error) { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// Handle Remarks Submit button click |
||||
|
$(document).on('click', '#submitRemarksBtn', function () { |
||||
|
const requestId = $(this).data('id'); |
||||
|
const remarks = $('#remarksText').val().trim(); |
||||
|
let userId = document.getElementById('userIdSpan').textContent; |
||||
|
|
||||
|
if (remarks === "") { |
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Remarks Required', |
||||
|
text: 'Please enter remarks before Cancelling.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
console.log("Request ID:", requestId); |
||||
|
console.log("Remarks:", remarks); |
||||
|
console.log("userId:", userId); |
||||
|
|
||||
|
// ✅ Confirmation popup |
||||
|
Swal.fire({ |
||||
|
title: 'Are you sure to Cancel?', |
||||
|
text: "You won't be able to revert this complaint!", |
||||
|
icon: 'warning', |
||||
|
showCancelButton: true, |
||||
|
confirmButtonColor: '#3085d6', |
||||
|
cancelButtonColor: '#d33', |
||||
|
confirmButtonText: 'Yes, Cancel it!', |
||||
|
cancelButtonText: 'No' |
||||
|
}).then((result) => { |
||||
|
if (result.isConfirmed) { |
||||
|
|
||||
|
cancelRequest(requestId, remarks, userId); |
||||
|
} else { |
||||
|
|
||||
|
console.log("User cancelled the action."); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
function cancelRequest(requestId, remarks, userId){ |
||||
|
|
||||
|
$('#pageLoader').show(); |
||||
|
$.ajax({ |
||||
|
type: "POST", |
||||
|
url: `/gcc/api/domestic_waste/cancelbyagents`, |
||||
|
data:{ |
||||
|
requestId:requestId, |
||||
|
remarks:remarks, |
||||
|
userId:userId |
||||
|
}, |
||||
|
success: function (response) { |
||||
|
$('#pageLoader').hide(); |
||||
|
console.log("API Response:", response); |
||||
|
|
||||
|
if(response.status === "success"){ |
||||
|
Swal.fire({ |
||||
|
icon: 'success', |
||||
|
title: 'Success', |
||||
|
text: response.message, |
||||
|
allowOutsideClick: false, |
||||
|
allowEscapeKey: false, |
||||
|
allowEnterKey: false, |
||||
|
showConfirmButton: true |
||||
|
}).then((result) => { |
||||
|
if (result.isConfirmed) { |
||||
|
location.reload(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
else{ |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
error: function (error) { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
function openDocModal(fileUrl) { |
||||
|
const container = document.getElementById('docContainer'); |
||||
|
const ext = fileUrl.split('.').pop().toLowerCase(); |
||||
|
|
||||
|
if (ext === 'pdf') { |
||||
|
container.innerHTML = `<iframe src="${fileUrl}" style="width:100%; height:90vh;" frameborder="0"></iframe>`; |
||||
|
} else { |
||||
|
container.innerHTML = `<img src="${fileUrl}" class="img-fluid" style="max-height:90vh; max-width:100%;" onerror="No image">`; |
||||
|
} |
||||
|
|
||||
|
$('#docModal').modal('show'); |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,459 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"> |
||||
|
|
||||
|
</head> |
||||
|
<style> |
||||
|
|
||||
|
</style> |
||||
|
<body> |
||||
|
<div class="wrapper"> |
||||
|
|
||||
|
<!-- header top menu Start --> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
<!-- header top menu end --> |
||||
|
<div class="page-wrap"> |
||||
|
<!--=============== Left Menu side Start ================--> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<!--=============== Left side End ================--> |
||||
|
|
||||
|
|
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header mb-2"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-8"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="fa fa-list-alt bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Sofa and Bed Collection</h5> |
||||
|
<span>1913 Sofa and Bed Collection - Check Status</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-4"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"><a href="/gcc/index"><i |
||||
|
class="ik ik-home"></i></a></li> |
||||
|
<li class="breadcrumb-item" aria-current="page">Sofa and Bed Collection</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Check Status</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="row mt-4"> |
||||
|
<div class="col-12"> |
||||
|
<div class="card"> |
||||
|
<div class="card-header"> |
||||
|
<span style="font-size: medium;font-weight: bold;">Enter Registered Mobile Number</span> |
||||
|
</div> |
||||
|
<div class="card-body"> |
||||
|
<div class="row"> |
||||
|
<!-- <div class="col-sm-2 mb-2"> |
||||
|
<label for="startDate" style="font-size: medium;">From Date:</label> |
||||
|
<input type="date" id="startDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-sm-2 mb-2"> |
||||
|
<label for="endDate" style="font-size: medium;">To Date:</label> |
||||
|
<input type="date" id="endDate" class="form-control"> |
||||
|
</div> --> |
||||
|
<div class="col-sm-2 mb-2"> |
||||
|
<label for="mobileNumber" style="font-size: medium;">Mobile Number:</label> |
||||
|
<input type="number" id="mobileNumber" class="form-control"> |
||||
|
</div> |
||||
|
<!-- <div class="col-sm-2 mb-2"> |
||||
|
<label for="requestNumber" style="font-size: medium;">Request Number:</label> |
||||
|
<input type="number" id="requestNumber" class="form-control"> |
||||
|
</div> --> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div class="row mt-4"> |
||||
|
<div class="col-12 d-flex justify-content-center"> |
||||
|
<button type="submit" id="searchBtn" |
||||
|
class="btn btn-primary mx-2">Search</button> |
||||
|
|
||||
|
<button class="btn btn-danger mx-2" id="resetBtn" |
||||
|
name="reset" type="reset">Reset</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="row mt-4"> |
||||
|
<div class="col-md-12"> |
||||
|
<div class="card"> |
||||
|
<div class="card-header"> |
||||
|
<span style="font-size: medium;font-weight: bold;">Reports List</span> |
||||
|
</div> |
||||
|
<div class="card-body"> |
||||
|
<div class="table-responsive"> |
||||
|
|
||||
|
<table id="ReportDatatable" |
||||
|
class="table table-striped table-bordered table-hover dataTable" |
||||
|
role="grid"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr role="row"> |
||||
|
|
||||
|
<th class="text-center no-sort">S.No</th> |
||||
|
<th class="text-center">Date</th> |
||||
|
<th class="text-center no-sort">Request Number</th> |
||||
|
<th class="text-center no-sort">Public Name</th> |
||||
|
<th class="text-center">Public Mobile no</th> |
||||
|
<th class="text-center">Zone</th> |
||||
|
<th class="text-center">Ward</th> |
||||
|
<th class="text-center">Item Type</th> |
||||
|
<th class="text-center no-sort">Address</th> |
||||
|
<th class="text-center">Street Name</th> |
||||
|
<th class="text-center">Remarks</th> |
||||
|
<th class="text-center">Current Status</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
||||
|
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
||||
|
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
||||
|
<span class="sr-only">Loading...</span> |
||||
|
</div> |
||||
|
<!-- Add the 'Please wait' text below the spinner --> |
||||
|
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- in the code use to show the download different type microsoft --> |
||||
|
|
||||
|
<!-- Include jQuery and Bootstrap JavaScript --> |
||||
|
|
||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
||||
|
|
||||
|
<script |
||||
|
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> |
||||
|
|
||||
|
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
||||
|
<!-- sweet alert --> |
||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
$(document).ready(function() { |
||||
|
|
||||
|
$('#mobileNumber').on('input', function () { |
||||
|
this.value = this.value.replace(/[^0-9]/g, '').slice(0, 10); |
||||
|
}); |
||||
|
|
||||
|
var table = $('#ReportDatatable').DataTable({ |
||||
|
dom: 'Bftip', |
||||
|
columnDefs: [ |
||||
|
{ targets: 'no-sort', orderable: false } |
||||
|
], |
||||
|
lengthMenu: [ |
||||
|
[50, 100, 200, 500, -1], |
||||
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
||||
|
], |
||||
|
scrollY: '80vh', |
||||
|
scrollX: true, |
||||
|
|
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn' |
||||
|
} |
||||
|
], |
||||
|
fixedHeader: true, |
||||
|
autoWidth: true, |
||||
|
responsive: false, |
||||
|
searching: true, |
||||
|
select: false, |
||||
|
processing: false |
||||
|
}); |
||||
|
|
||||
|
// Event listener for From Date selection |
||||
|
/* $("#startDate").on("change", function() { |
||||
|
const startDate = $(this).val(); // Get the selected start date |
||||
|
// Set the min value for To Date to be the selected From Date |
||||
|
$("#endDate").attr("min", startDate); |
||||
|
}); |
||||
|
|
||||
|
// Event listener for To Date selection |
||||
|
$("#endDate").on("change", function() { |
||||
|
const endDate = $(this).val(); // Get the selected end date |
||||
|
// Set the max value for From Date to be the selected To Date |
||||
|
$("#startDate").attr("max", endDate); |
||||
|
}); */ |
||||
|
|
||||
|
document.getElementById('resetBtn').addEventListener('click', function () { |
||||
|
event.preventDefault(); |
||||
|
|
||||
|
location.reload(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
document.getElementById('searchBtn').addEventListener('click', function (e) { |
||||
|
|
||||
|
|
||||
|
/* let startDate = document.getElementById('startDate').value; |
||||
|
let endDate = document.getElementById('endDate').value; */ |
||||
|
let mobileNumber = document.getElementById('mobileNumber').value; |
||||
|
/* let requestNumber = document.getElementById('requestNumber').value; */ |
||||
|
|
||||
|
|
||||
|
/* console.log("startdate: ",startDate); |
||||
|
console.log("enddate: ",endDate); */ |
||||
|
console.log("mobileNumber: ",mobileNumber); |
||||
|
/* console.log("requestNumber: ",requestNumber); */ |
||||
|
|
||||
|
if(!mobileNumber){ |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'info', |
||||
|
title: 'Missing', |
||||
|
text: 'Please Enter Mobile Number', |
||||
|
showConfirmButton: true, |
||||
|
timer: 3000 |
||||
|
}); |
||||
|
e.preventDefault(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if(mobileNumber){ |
||||
|
|
||||
|
if (!/^\d{10}$/.test(mobileNumber)) { |
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Please enter a valid 10-digit mobile number.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (/^0{10}$/.test(mobileNumber)) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Mobile number cannot be all zeros.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (mobileNumber.startsWith('0')) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Mobile number cannot start with zero.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (/^(\d)\1{9}$/.test(mobileNumber)) { |
||||
|
|
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'Invalid Mobile Number', |
||||
|
text: 'Mobile number cannot have all digits the same.' |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
const params = new URLSearchParams({ |
||||
|
mobile:mobileNumber |
||||
|
}); |
||||
|
$('#pageLoader').show(); |
||||
|
$.ajax({ |
||||
|
type: "GET", |
||||
|
url: `/gcc/api/domestic_waste/checkstatusbymobile?${params.toString()}`, // Append query string to URL |
||||
|
contentType: "application/json", |
||||
|
success: function (response) { |
||||
|
console.log("API Response:", response); |
||||
|
$('#pageLoader').hide(); |
||||
|
if (response.status === "success") { |
||||
|
console.log("Details Array:", response.data); |
||||
|
// Ensure details is an array and has at least one entry |
||||
|
if (Array.isArray(response.data) && response.data.length > 0) { |
||||
|
let table = $('#ReportDatatable').DataTable({ |
||||
|
destroy: true, |
||||
|
searching: true, |
||||
|
autoWidth: true, |
||||
|
paging: true, |
||||
|
info: true, |
||||
|
data: response.data, |
||||
|
columns: [ |
||||
|
{ |
||||
|
data: null, |
||||
|
render: (data, type, row, meta) => meta.row + 1, |
||||
|
className: 'text-center' |
||||
|
}, |
||||
|
{ data: 'cdate', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'request_id', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'user_name', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'mobile', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'zone', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'division', defaultContent: '-', className: 'text-center' }, |
||||
|
{ |
||||
|
data: 'items', |
||||
|
className: 'text-center', |
||||
|
render: function (data, type, row) { |
||||
|
if (Array.isArray(data) && data.length > 0) { |
||||
|
return data.map(item => `${item.item_name} - ${item.quantity}`).join(', '); |
||||
|
} |
||||
|
return '-'; |
||||
|
} |
||||
|
}, |
||||
|
{ data: 'address', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'street_name', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'remarks', defaultContent: '-', className: 'text-center' }, |
||||
|
{ data: 'status', defaultContent: '-', className: 'text-center' } |
||||
|
|
||||
|
], |
||||
|
dom: 'Bfrtip', |
||||
|
buttons: [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn' |
||||
|
} |
||||
|
], |
||||
|
columnDefs: [ |
||||
|
{ targets: 'no-sort', orderable: false } |
||||
|
], |
||||
|
lengthMenu: [ |
||||
|
[50, 100, 200, 500, -1], |
||||
|
['50 rows', '100 rows', '200 rows', 'Show all'] |
||||
|
], |
||||
|
scrollY: '80vh', |
||||
|
scrollX: true, |
||||
|
responsive: false, |
||||
|
searching: true |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
else if (response.status === "no data") { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'warning', |
||||
|
title: 'No Data', |
||||
|
text: 'No data available for the Mobile Number.' |
||||
|
}); |
||||
|
} |
||||
|
else if (response.status === "error") { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
else { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
error: function (error) { |
||||
|
$('#pageLoader').hide(); |
||||
|
Swal.fire({ |
||||
|
icon: 'error', |
||||
|
title: 'Error', |
||||
|
text: response.message || 'Something went wrong!' |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
1579
src/main/resources/templates/modules/callcenterqaqc/domesticwastecomplaints.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1040
src/main/resources/templates/modules/callcenterqaqc/scpreport.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1149
src/main/resources/templates/modules/callcenterqaqc/scpverification.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,351 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" dir=""> |
||||
|
<html xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
||||
|
<style> |
||||
|
/* Add space between buttons inside the container */ |
||||
|
.col-md-3.d-flex button { |
||||
|
margin-right: 10px; /* Adjust the value as needed */ |
||||
|
} |
||||
|
/* Remove extra margin from the last button */ |
||||
|
.col-md-3.d-flex button:last-child { |
||||
|
margin-right: 0; |
||||
|
} |
||||
|
</style> |
||||
|
<body> |
||||
|
<!--[if lt IE 8]> |
||||
|
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
||||
|
<![endif]--> |
||||
|
|
||||
|
<div class="wrapper"> |
||||
|
<!-- header top menu Start --> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
<!-- header top menu end --> |
||||
|
|
||||
|
<div class="page-wrap"> |
||||
|
<!--=============== Left Menu side Start ================--> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<!--=============== Left side End ================--> |
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-6"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="far fa-list-alt bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Pending List</h5> |
||||
|
<span>Commissioner Petition</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-6"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"> |
||||
|
<a href="/index"><i class="ik ik-home"></i></a> |
||||
|
</li> |
||||
|
<li class="breadcrumb-item" aria-current="page">Commissioner Petition</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Pending List</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<hr> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<!-- <div class="card"> |
||||
|
|
||||
|
<div class="card-block"> --> |
||||
|
<div id="tableLoading"></div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- <div class="row mb-3"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="fromDate">From Date:</label> |
||||
|
<input type="date" id="fromDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="toDate">To Date:</label> |
||||
|
<input type="date" id="toDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3 d-flex align-items-end"> |
||||
|
<button id="filterBtn" class="btn btn-primary">Search</button> |
||||
|
<button id="resetBtn" class="btn btn-secondary">Reset</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label for="eventid">Select Petition Type / மனுவின் வகை</label> |
||||
|
<select class="form-control" id="eventid" name="eventid" style="width: 100%;" data-placeholder="தேர்ந்தெடு.." required onchange="get_complaint_list(this.value);"> |
||||
|
<option value=""></option> |
||||
|
</select> |
||||
|
</div> --> |
||||
|
|
||||
|
<div class="row mb-3"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="fromDate">From Date:</label> |
||||
|
<input type="date" id="fromDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="toDate">To Date:</label> |
||||
|
<input type="date" id="toDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="petitionType">Select Petition Type / மனுவின் வகை</label> |
||||
|
<select class="form-control" id="petitionType" name="petitionType"> |
||||
|
<option value="">-- All Types --</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-md-3 d-flex align-items-end"> |
||||
|
<button id="filterBtn" class="btn btn-primary me-2">Search</button> |
||||
|
<button id="resetBtn" class="btn btn-secondary">Reset</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<table id="ReportDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="100%"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr class="table-bordered"> |
||||
|
<th class="text-center no-sort">S.No</th> |
||||
|
<th class="text-center">Petition No.</th> |
||||
|
<!-- <th class="text-center">Counsilor Ward</th> |
||||
|
<th class="text-center">Counsilor Zone</th> --> |
||||
|
<th class="text-center">Counsilor Name</th> |
||||
|
<th class="text-center">Petition Type </th> |
||||
|
<th class="text-center">Content</th> |
||||
|
<!-- <th class="text-center"> Address </th> --> |
||||
|
<!-- <th class="text-center">Postal Code</th> --> |
||||
|
<!-- <th class="text-center">Type of Complaint</th> --> |
||||
|
<!-- <th class="text-center">Date</th> --> |
||||
|
<th class="text-center">Department Officer</th> |
||||
|
<th class="text-center">Status</th> |
||||
|
|
||||
|
<!-- <th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th> --> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/zerohours_petition/modal-box :: div}"></div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
||||
|
|
||||
|
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
||||
|
<script th:replace="~{fragments/modules/zerohours_petition/script :: script}"></script> |
||||
|
<script th:inline="javascript"> |
||||
|
var createdBy = /*[[${LoginUserId}]]*/''; |
||||
|
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script |
||||
|
var officerMasterList = ""; |
||||
|
|
||||
|
// Loading Div id |
||||
|
const loading = $("#tableLoading"); |
||||
|
|
||||
|
// DataTables buttons configuration |
||||
|
var buttons = [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'print', |
||||
|
text: 'Print', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'printBtn', |
||||
|
title: 'Petition List', |
||||
|
exportOptions: { |
||||
|
columns: ':visible:not(.no-print)' // Exclude columns with class 'no-print' from print view |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'colvis', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
function call_loading(){ |
||||
|
loading.html(searchinfo("<b>"+loading_text_msg+"</b>")); |
||||
|
} |
||||
|
|
||||
|
function remove_loading(){ |
||||
|
loading.html(""); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//Report List |
||||
|
|
||||
|
// Function to load petition types into dropdown |
||||
|
function loadPetitionTypes() { |
||||
|
$.ajax({ |
||||
|
url: '/gcc/api/com_petition/getPetitionTypes', |
||||
|
type: 'GET', |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
let $dropdown = $("#petitionType"); |
||||
|
$dropdown.empty(); |
||||
|
$dropdown.append('<option value="">-- All Types --</option>'); |
||||
|
|
||||
|
// If response is an array |
||||
|
if (Array.isArray(response)) { |
||||
|
$.each(response, function (index, item) { |
||||
|
$dropdown.append('<option value="' + item.petition_type_id + '">' + item.name + '</option>'); |
||||
|
}); |
||||
|
} else { |
||||
|
// If response is a single object |
||||
|
$dropdown.append('<option value="' + response.petition_type_id + '">' + response.name + '</option>'); |
||||
|
} |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error("Error loading petition types:", error); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function loadReportData(fromDate, toDate, petitionTypeId = "", isReset = false) { |
||||
|
let apiUrl = '/gcc/api/com_petition/getReportList'; |
||||
|
let params = []; |
||||
|
|
||||
|
if (!isReset) { |
||||
|
if (fromDate && toDate) { |
||||
|
params.push("fromDate=" + fromDate); |
||||
|
params.push("toDate=" + toDate); |
||||
|
} |
||||
|
if (petitionTypeId) { |
||||
|
params.push("petitionType=" + petitionTypeId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (params.length > 0) { |
||||
|
apiUrl += "?" + params.join("&"); |
||||
|
} |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: apiUrl, |
||||
|
type: 'GET', |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
if ($.fn.DataTable.isDataTable('#ReportDatatable')) { |
||||
|
$('#ReportDatatable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
$('#ReportDatatable').DataTable({ |
||||
|
data: response, |
||||
|
dom: 'Bfrtip', |
||||
|
buttons: buttons, |
||||
|
columns: [ |
||||
|
{ |
||||
|
data: null, |
||||
|
className: "text-center", |
||||
|
render: function (data, type, row, meta) { |
||||
|
return meta.row + 1; |
||||
|
} |
||||
|
}, |
||||
|
{ data: 'petition_no', className: "text-center" }, |
||||
|
{ data: 'petitioner_name', className: "text-center" }, |
||||
|
{ data: 'petition_type', className: "text-center" }, |
||||
|
{ data: 'complaint_nature', className: "text-center" }, |
||||
|
{ data: 'officer_name', className: "text-center" }, |
||||
|
{ data: 'status', className: "text-center" } |
||||
|
] |
||||
|
}); |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error("Error fetching report list:", error); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$(document).ready(function () { |
||||
|
// Load petition types dynamically |
||||
|
loadPetitionTypes(); |
||||
|
|
||||
|
// Default load today's data |
||||
|
let today = new Date().toISOString().split('T')[0]; |
||||
|
$("#fromDate").val(today); |
||||
|
$("#toDate").val(today); |
||||
|
loadReportData(today, today); |
||||
|
|
||||
|
// On Filter Button Click |
||||
|
$("#filterBtn").click(function () { |
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
let petitionTypeId = $("#petitionType").val(); |
||||
|
|
||||
|
if (fromDate && toDate) { |
||||
|
loadReportData(fromDate, toDate, petitionTypeId); |
||||
|
} else { |
||||
|
alert("Please select both From Date and To Date"); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// Reset button click |
||||
|
$("#resetBtn").click(function () { |
||||
|
location.reload(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
////////// |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,351 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" dir=""> |
||||
|
<html xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
||||
|
<style> |
||||
|
/* Add space between buttons inside the container */ |
||||
|
.col-md-3.d-flex button { |
||||
|
margin-right: 10px; /* Adjust the value as needed */ |
||||
|
} |
||||
|
/* Remove extra margin from the last button */ |
||||
|
.col-md-3.d-flex button:last-child { |
||||
|
margin-right: 0; |
||||
|
} |
||||
|
</style> |
||||
|
<body> |
||||
|
<!--[if lt IE 8]> |
||||
|
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
||||
|
<![endif]--> |
||||
|
|
||||
|
<div class="wrapper"> |
||||
|
<!-- header top menu Start --> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
<!-- header top menu end --> |
||||
|
|
||||
|
<div class="page-wrap"> |
||||
|
<!--=============== Left Menu side Start ================--> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<!--=============== Left side End ================--> |
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-6"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="far fa-list-alt bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Pending List</h5> |
||||
|
<span>Mayor Petition</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-6"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"> |
||||
|
<a href="/index"><i class="ik ik-home"></i></a> |
||||
|
</li> |
||||
|
<li class="breadcrumb-item" aria-current="page">Mayor Petition</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Pending List</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<hr> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<!-- <div class="card"> |
||||
|
|
||||
|
<div class="card-block"> --> |
||||
|
<div id="tableLoading"></div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- <div class="row mb-3"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="fromDate">From Date:</label> |
||||
|
<input type="date" id="fromDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="toDate">To Date:</label> |
||||
|
<input type="date" id="toDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3 d-flex align-items-end"> |
||||
|
<button id="filterBtn" class="btn btn-primary">Search</button> |
||||
|
<button id="resetBtn" class="btn btn-secondary">Reset</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label for="eventid">Select Petition Type / மனுவின் வகை</label> |
||||
|
<select class="form-control" id="eventid" name="eventid" style="width: 100%;" data-placeholder="தேர்ந்தெடு.." required onchange="get_complaint_list(this.value);"> |
||||
|
<option value=""></option> |
||||
|
</select> |
||||
|
</div> --> |
||||
|
|
||||
|
<div class="row mb-3"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="fromDate">From Date:</label> |
||||
|
<input type="date" id="fromDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="toDate">To Date:</label> |
||||
|
<input type="date" id="toDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="petitionType">Select Petition Type / மனுவின் வகை</label> |
||||
|
<select class="form-control" id="petitionType" name="petitionType"> |
||||
|
<option value="">-- All Types --</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-md-3 d-flex align-items-end"> |
||||
|
<button id="filterBtn" class="btn btn-primary me-2">Search</button> |
||||
|
<button id="resetBtn" class="btn btn-secondary">Reset</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<table id="ReportDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="100%"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr class="table-bordered"> |
||||
|
<th class="text-center no-sort">S.No</th> |
||||
|
<th class="text-center">Petition No.</th> |
||||
|
<!-- <th class="text-center">Counsilor Ward</th> |
||||
|
<th class="text-center">Counsilor Zone</th> --> |
||||
|
<th class="text-center">Counsilor Name</th> |
||||
|
<th class="text-center">Petition Type </th> |
||||
|
<th class="text-center">Content</th> |
||||
|
<!-- <th class="text-center"> Address </th> --> |
||||
|
<!-- <th class="text-center">Postal Code</th> --> |
||||
|
<!-- <th class="text-center">Type of Complaint</th> --> |
||||
|
<!-- <th class="text-center">Date</th> --> |
||||
|
<th class="text-center">Department Officer</th> |
||||
|
<th class="text-center">Status</th> |
||||
|
|
||||
|
<!-- <th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th> --> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/zerohours_petition/modal-box :: div}"></div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
||||
|
|
||||
|
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
||||
|
<script th:replace="~{fragments/modules/zerohours_petition/script :: script}"></script> |
||||
|
<script th:inline="javascript"> |
||||
|
var createdBy = /*[[${LoginUserId}]]*/''; |
||||
|
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script |
||||
|
var officerMasterList = ""; |
||||
|
|
||||
|
// Loading Div id |
||||
|
const loading = $("#tableLoading"); |
||||
|
|
||||
|
// DataTables buttons configuration |
||||
|
var buttons = [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'print', |
||||
|
text: 'Print', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'printBtn', |
||||
|
title: 'Petition List', |
||||
|
exportOptions: { |
||||
|
columns: ':visible:not(.no-print)' // Exclude columns with class 'no-print' from print view |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'colvis', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
function call_loading(){ |
||||
|
loading.html(searchinfo("<b>"+loading_text_msg+"</b>")); |
||||
|
} |
||||
|
|
||||
|
function remove_loading(){ |
||||
|
loading.html(""); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//Report List |
||||
|
|
||||
|
// Function to load petition types into dropdown |
||||
|
function loadPetitionTypes() { |
||||
|
$.ajax({ |
||||
|
url: '/gcc/api/m_petition/getPetitionTypes', |
||||
|
type: 'GET', |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
let $dropdown = $("#petitionType"); |
||||
|
$dropdown.empty(); |
||||
|
$dropdown.append('<option value="">-- All Types --</option>'); |
||||
|
|
||||
|
// If response is an array |
||||
|
if (Array.isArray(response)) { |
||||
|
$.each(response, function (index, item) { |
||||
|
$dropdown.append('<option value="' + item.petition_type_id + '">' + item.name + '</option>'); |
||||
|
}); |
||||
|
} else { |
||||
|
// If response is a single object |
||||
|
$dropdown.append('<option value="' + response.petition_type_id + '">' + response.name + '</option>'); |
||||
|
} |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error("Error loading petition types:", error); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function loadReportData(fromDate, toDate, petitionTypeId = "", isReset = false) { |
||||
|
let apiUrl = '/gcc/api/m_petition/getReportList'; |
||||
|
let params = []; |
||||
|
|
||||
|
if (!isReset) { |
||||
|
if (fromDate && toDate) { |
||||
|
params.push("fromDate=" + fromDate); |
||||
|
params.push("toDate=" + toDate); |
||||
|
} |
||||
|
if (petitionTypeId) { |
||||
|
params.push("petitionType=" + petitionTypeId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (params.length > 0) { |
||||
|
apiUrl += "?" + params.join("&"); |
||||
|
} |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: apiUrl, |
||||
|
type: 'GET', |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
if ($.fn.DataTable.isDataTable('#ReportDatatable')) { |
||||
|
$('#ReportDatatable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
$('#ReportDatatable').DataTable({ |
||||
|
data: response, |
||||
|
dom: 'Bfrtip', |
||||
|
buttons: buttons, |
||||
|
columns: [ |
||||
|
{ |
||||
|
data: null, |
||||
|
className: "text-center", |
||||
|
render: function (data, type, row, meta) { |
||||
|
return meta.row + 1; |
||||
|
} |
||||
|
}, |
||||
|
{ data: 'petition_no', className: "text-center" }, |
||||
|
{ data: 'petitioner_name', className: "text-center" }, |
||||
|
{ data: 'petition_type', className: "text-center" }, |
||||
|
{ data: 'complaint_nature', className: "text-center" }, |
||||
|
{ data: 'officer_name', className: "text-center" }, |
||||
|
{ data: 'status', className: "text-center" } |
||||
|
] |
||||
|
}); |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error("Error fetching report list:", error); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$(document).ready(function () { |
||||
|
// Load petition types dynamically |
||||
|
loadPetitionTypes(); |
||||
|
|
||||
|
// Default load today's data |
||||
|
let today = new Date().toISOString().split('T')[0]; |
||||
|
$("#fromDate").val(today); |
||||
|
$("#toDate").val(today); |
||||
|
loadReportData(today, today); |
||||
|
|
||||
|
// On Filter Button Click |
||||
|
$("#filterBtn").click(function () { |
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
let petitionTypeId = $("#petitionType").val(); |
||||
|
|
||||
|
if (fromDate && toDate) { |
||||
|
loadReportData(fromDate, toDate, petitionTypeId); |
||||
|
} else { |
||||
|
alert("Please select both From Date and To Date"); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// Reset button click |
||||
|
$("#resetBtn").click(function () { |
||||
|
location.reload(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
////////// |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
1574
src/main/resources/templates/modules/vendors/zonerequests.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,290 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" dir=""> |
||||
|
<html xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
||||
|
<style> |
||||
|
/* Add space between buttons inside the container */ |
||||
|
.col-md-3.d-flex button { |
||||
|
margin-right: 10px; /* Adjust the value as needed */ |
||||
|
} |
||||
|
/* Remove extra margin from the last button */ |
||||
|
.col-md-3.d-flex button:last-child { |
||||
|
margin-right: 0; |
||||
|
} |
||||
|
</style> |
||||
|
<body> |
||||
|
<!--[if lt IE 8]> |
||||
|
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
||||
|
<![endif]--> |
||||
|
|
||||
|
<div class="wrapper"> |
||||
|
<!-- header top menu Start --> |
||||
|
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
||||
|
<!-- header top menu end --> |
||||
|
|
||||
|
<div class="page-wrap"> |
||||
|
<!--=============== Left Menu side Start ================--> |
||||
|
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
||||
|
<!--=============== Left side End ================--> |
||||
|
<div class="main-content"> |
||||
|
<div class="container-fluid"> |
||||
|
<div class="page-header"> |
||||
|
<div class="row align-items-end"> |
||||
|
<div class="col-lg-6"> |
||||
|
<div class="page-header-title"> |
||||
|
<i class="far fa-list-alt bg-blue"></i> |
||||
|
<div class="d-inline"> |
||||
|
<h5>Pending List</h5> |
||||
|
<span>Commissioner Petition</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-lg-6"> |
||||
|
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
||||
|
<ol class="breadcrumb"> |
||||
|
<li class="breadcrumb-item"> |
||||
|
<a href="/index"><i class="ik ik-home"></i></a> |
||||
|
</li> |
||||
|
<li class="breadcrumb-item" aria-current="page">Commissioner Petition</li> |
||||
|
<li class="breadcrumb-item active" aria-current="page">Pending List</li> |
||||
|
</ol> |
||||
|
</nav> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<hr> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<!-- <div class="card"> |
||||
|
|
||||
|
<div class="card-block"> --> |
||||
|
<div id="tableLoading"></div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<div class="row mb-3"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="fromDate">From Date:</label> |
||||
|
<input type="date" id="fromDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="toDate">To Date:</label> |
||||
|
<input type="date" id="toDate" class="form-control"> |
||||
|
</div> |
||||
|
<div class="col-md-3 d-flex align-items-end"> |
||||
|
<button id="filterBtn" class="btn btn-primary">Search</button> |
||||
|
<button id="resetBtn" class="btn btn-secondary">Reset</button> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<!-- <div class="form-group"> |
||||
|
<label for="eventid">Select Event / நிகழ்வை தேர்ந்தெடுக்கவும்</label> |
||||
|
<select class="form-control" id="eventid" name="eventid" style="width: 100%;" data-placeholder="தேர்ந்தெடு.." required onchange="get_complaint_list(this.value);"> |
||||
|
<option value=""></option> |
||||
|
</select> |
||||
|
</div> |
||||
|
--> |
||||
|
<div> |
||||
|
<table id="ReportDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="100%"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr class="table-bordered"> |
||||
|
<th class="text-center no-sort">S.No</th> |
||||
|
<th class="text-center">Petition No.</th> |
||||
|
<th class="text-center">Counsilor Ward</th> |
||||
|
<th class="text-center">Counsilor Zone</th> |
||||
|
<th class="text-center">Counsilor Name</th> |
||||
|
<th class="text-center">Content</th> |
||||
|
<!-- <th class="text-center"> Address </th> --> |
||||
|
<!-- <th class="text-center">Postal Code</th> --> |
||||
|
<!-- <th class="text-center">Type of Complaint</th> --> |
||||
|
<!-- <th class="text-center">Date</th> --> |
||||
|
<th class="text-center">Department Officer</th> |
||||
|
<th class="text-center">Status</th> |
||||
|
|
||||
|
<!-- <th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th> --> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/zerohours_petition/modal-box :: div}"></div> |
||||
|
|
||||
|
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
||||
|
|
||||
|
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
||||
|
<script th:replace="~{fragments/modules/zerohours_petition/script :: script}"></script> |
||||
|
<script th:inline="javascript"> |
||||
|
var createdBy = /*[[${LoginUserId}]]*/''; |
||||
|
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script |
||||
|
var officerMasterList = ""; |
||||
|
|
||||
|
// Loading Div id |
||||
|
const loading = $("#tableLoading"); |
||||
|
|
||||
|
// DataTables buttons configuration |
||||
|
var buttons = [ |
||||
|
{ |
||||
|
extend: 'pageLength', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
{ |
||||
|
title: 'Data export', |
||||
|
extend: 'copyHtml5', |
||||
|
text: 'Copy', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'copyBtn' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'excelHtml5', |
||||
|
text: 'Excel', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'excelBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'csvHtml5', |
||||
|
text: 'CSV', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'csvBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'pdfHtml5', |
||||
|
text: 'PDF', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'pdfBtn', |
||||
|
title: 'Petition List' |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'print', |
||||
|
text: 'Print', |
||||
|
className: 'btn btn-secondary', |
||||
|
id: 'printBtn', |
||||
|
title: 'Petition List', |
||||
|
exportOptions: { |
||||
|
columns: ':visible:not(.no-print)' // Exclude columns with class 'no-print' from print view |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'colvis', |
||||
|
className: 'btn btn-warning' |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
function call_loading(){ |
||||
|
loading.html(searchinfo("<b>"+loading_text_msg+"</b>")); |
||||
|
} |
||||
|
|
||||
|
function remove_loading(){ |
||||
|
loading.html(""); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//Report List |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
function loadReportData(fromDate, toDate, isReset = false) { |
||||
|
let apiUrl = '/gcc/api/zerohours_petition/getReportList'; |
||||
|
|
||||
|
// Add params only if dates are provided AND not reset |
||||
|
if (!isReset && fromDate && toDate) { |
||||
|
apiUrl += '?fromDate=' + fromDate + '&toDate=' + toDate; |
||||
|
} |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: apiUrl, |
||||
|
type: 'GET', |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
if ($.fn.DataTable.isDataTable('#ReportDatatable')) { |
||||
|
$('#ReportDatatable').DataTable().clear().destroy(); |
||||
|
} |
||||
|
|
||||
|
$('#ReportDatatable').DataTable({ |
||||
|
data: response, |
||||
|
dom: 'Bfrtip', // 👈 this line enables buttons |
||||
|
buttons: buttons, // 👈 your defined buttons array |
||||
|
columns: [ |
||||
|
{ |
||||
|
data: null, |
||||
|
className: "text-center", |
||||
|
render: function (data, type, row, meta) { |
||||
|
return meta.row + 1; |
||||
|
} |
||||
|
}, |
||||
|
{ data: 'petition_no', className: "text-center" }, |
||||
|
{ data: 'ward', className: "text-center" }, |
||||
|
{ data: 'zone', className: "text-center" }, |
||||
|
{ data: 'petitioner_name', className: "text-center" }, |
||||
|
{ data: 'complaint_nature', className: "text-center" }, |
||||
|
{ data: 'officer_name', className: "text-center" }, |
||||
|
{ data: 'status', className: "text-center" } |
||||
|
] |
||||
|
}); |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error("Error fetching report list:", error); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
$(document).ready(function () { |
||||
|
// Default load today's data |
||||
|
let today = new Date().toISOString().split('T')[0]; |
||||
|
$("#fromDate").val(today); |
||||
|
$("#toDate").val(today); |
||||
|
loadReportData(today, today); |
||||
|
|
||||
|
// On Filter Button Click |
||||
|
$("#filterBtn").click(function () { |
||||
|
let fromDate = $("#fromDate").val(); |
||||
|
let toDate = $("#toDate").val(); |
||||
|
|
||||
|
if (fromDate && toDate) { |
||||
|
loadReportData(fromDate, toDate); |
||||
|
} else { |
||||
|
alert("Please select both From Date and To Date"); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// Reset button click |
||||
|
$("#resetBtn").click(function () { |
||||
|
location.reload(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
////////// |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue