commit
eae6a14406
8 changed files with 2796 additions and 0 deletions
-
383Dump20250423.sql
-
174backend/cdwaste/controller/DumpRegistrationAPIController.java
-
75backend/cdwaste/controller/MainController.java
-
161backend/cdwaste/service/OfficerService.java
-
40backend/cdwaste/service/SMSService.java
-
430frontend/cdwastecollect/lessoneton.html
-
1122frontend/cdwastecollect/officer.html
-
411frontend/cdwastecollect/reports.html
383
Dump20250423.sql
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,174 @@ |
|||
package in.gov.chennaicorporation.gccoffice.cdwaste.controller; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
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.RestTemplate; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.cdwaste.service.OfficerService; |
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping("/gcc/api/dumpregistration") |
|||
public class DumpRegistrationAPIController { |
|||
|
|||
|
|||
@Autowired |
|||
private OfficerService officerService; |
|||
|
|||
private final RestTemplate restTemplate; |
|||
private final AppConfig appConfig; |
|||
|
|||
@Autowired |
|||
public DumpRegistrationAPIController(RestTemplate restTemplate, AppConfig appConfig) { |
|||
this.restTemplate = restTemplate; |
|||
this.appConfig = appConfig; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/wastecollectorlist") |
|||
public ResponseEntity<String> getWasteCollectorList( |
|||
@RequestParam(required = false) Long mobileNo, |
|||
@RequestParam(required = false) Long refId) { |
|||
|
|||
StringBuilder apiUrl = new StringBuilder(appConfig.dumpregister + "/dumpregistration/api/wastecollectorlist"); |
|||
|
|||
// If at least one param is present, append '?' |
|||
if (mobileNo != null || refId != null) { |
|||
apiUrl.append("?"); |
|||
} |
|||
|
|||
// Append parameters |
|||
List<String> params = new ArrayList<>(); |
|||
if (mobileNo != null) { |
|||
params.add("mobileNo=" + mobileNo); |
|||
} |
|||
if (refId != null) { |
|||
params.add("refId=" + refId); |
|||
} |
|||
|
|||
apiUrl.append(String.join("&", params)); |
|||
|
|||
try { |
|||
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl.toString(), String.class); |
|||
return ResponseEntity.ok(responseEntity.getBody()); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Failed to fetch data: " + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/getallcharges") |
|||
public ResponseEntity<String> getpaymentcharges() { |
|||
String apiUrl = appConfig.dumpregister + "/dumpregistration/dropdown/api/getallcharges"; |
|||
|
|||
try { |
|||
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class); |
|||
return ResponseEntity.ok(responseEntity.getBody()); // Return the real response, not a fixed string |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Failed to fetch data: " + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
@PostMapping("/saveWasteRequest") |
|||
public ResponseEntity<String> saveWasteRequest(@RequestBody Map<String, Object> payload) { |
|||
try { |
|||
officerService.saveRequestDetails(payload); |
|||
return ResponseEntity.ok("Saved successfully"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error saving request"); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@GetMapping("/getless1tonlist") |
|||
public ResponseEntity<String> getWasteCollectorLess1TonList() { |
|||
StringBuilder apiUrl = new StringBuilder(appConfig.dumpregister + "/dumpregistration/api/getless1tonlist"); |
|||
|
|||
try { |
|||
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl.toString(), String.class); |
|||
return ResponseEntity.ok(responseEntity.getBody()); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Failed to fetch data: " + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/getless1tonlistbyId") |
|||
public ResponseEntity<String> getWasteCollectorLess1TonListbyId(@RequestParam(required = true) Long refId) { |
|||
if (refId == null) { |
|||
return ResponseEntity.badRequest().body("refId is required"); |
|||
} |
|||
|
|||
try { |
|||
String apiUrl = appConfig.dumpregister + "/dumpregistration/api/getless1tonlistbyid?refId=" + refId; |
|||
|
|||
ResponseEntity<String> responseEntity = restTemplate.getForEntity(apiUrl, String.class); |
|||
return ResponseEntity.ok(responseEntity.getBody()); |
|||
|
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Failed to fetch data: " + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/getAllDetails") |
|||
public ResponseEntity<?> getAllRequestDetails( |
|||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate, |
|||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate toDate, |
|||
@RequestParam(required = false) String wastequantity, |
|||
@RequestParam(required = false) String zone) { |
|||
try { |
|||
|
|||
List<Map<String, Object>> response = officerService.getAllRequestDetails(fromDate, toDate, wastequantity, zone); |
|||
return ResponseEntity.ok(response); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body(Collections.singletonMap("error", "Failed to fetch data: " + e.getMessage())); |
|||
} |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getquantity") |
|||
public List<Map<String, Object>> getwastequantity() { |
|||
return officerService.getAllwastequantity(); |
|||
} |
|||
|
|||
//fetch all zones |
|||
|
|||
@GetMapping("/getzones") |
|||
public ResponseEntity<?> getAllZones() { |
|||
try { |
|||
List<Map<String, Object>> response = officerService.getZonesList(); |
|||
return ResponseEntity.ok(response); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body(Collections.singletonMap("error", "Failed to fetch data: " + e.getMessage())); |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,75 @@ |
|||
package in.gov.chennaicorporation.gccoffice.cdwaste.controller; |
|||
|
|||
|
|||
|
|||
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 org.springframework.web.client.RestTemplate; |
|||
|
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
|||
|
|||
@RequestMapping("/gcc/dumpregistration") |
|||
@Controller("dumpregistrationMainController") |
|||
public class MainController { |
|||
|
|||
private final LoginUserInfo loginUserInfo; |
|||
private final RestTemplate restTemplate; |
|||
private final AppConfig appConfig; |
|||
|
|||
@Autowired |
|||
public MainController(RestTemplate restTemplate,LoginUserInfo loginUserInfo, |
|||
AppConfig appConfig) { |
|||
this.restTemplate = restTemplate; |
|||
this.appConfig = appConfig; |
|||
this.loginUserInfo = loginUserInfo; |
|||
} |
|||
|
|||
@GetMapping("/officer") |
|||
public String viewOfficer(Model model) |
|||
{ |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
|
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
model.addAttribute("UserRole", UserRole); |
|||
|
|||
|
|||
return "modules/cdwastecollect/officer"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/lessthanoneton") |
|||
public String viewLessoneTonList(Model model) |
|||
{ |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
|
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
model.addAttribute("UserRole", UserRole); |
|||
|
|||
return "modules/cdwastecollect/lessoneton"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/overallreport") |
|||
public String wasteCollectionReports(Model model) |
|||
{ |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
|
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
model.addAttribute("UserRole", UserRole); |
|||
return "modules/cdwastecollect/reports"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,161 @@ |
|||
package in.gov.chennaicorporation.gccoffice.cdwaste.service; |
|||
|
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.time.LocalDate; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalTime; |
|||
import java.util.ArrayList; |
|||
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.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
@Service |
|||
public class OfficerService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
private RestTemplate restTemplate; |
|||
|
|||
@Autowired |
|||
private SMSService smsService; |
|||
|
|||
@Autowired |
|||
public void setDataSourcemysql(@Qualifier("mysqlCDManagerSystemDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
|
|||
@Transactional |
|||
public void saveRequestDetails(Map<String, Object> payload) { |
|||
double actualWeight = Double.parseDouble(payload.get("actualWeight").toString()); |
|||
String paymentType = payload.get("paymentType").toString(); |
|||
/* |
|||
* double processingCharge = |
|||
* Double.parseDouble(payload.get("processingCharge").toString()); double |
|||
* wasteCharge = Double.parseDouble(payload.get("wasteCharge").toString()); |
|||
*/ |
|||
|
|||
double processingCharge = payload.get("processingCharge") != null |
|||
? Double.parseDouble(payload.get("processingCharge").toString()) |
|||
: 0.0; |
|||
|
|||
double wasteCharge = payload.get("wasteCharge") != null |
|||
? Double.parseDouble(payload.get("wasteCharge").toString()) |
|||
: 0.0; |
|||
double totalCharge = Double.parseDouble(payload.get("totalCharge").toString()); |
|||
String paymentMobNo = payload.get("paymentMobileNo") != null ? payload.get("paymentMobileNo").toString() : null; |
|||
String refId = payload.get("refId") != null ? payload.get("refId").toString() : null; |
|||
|
|||
// ✅ Check if record exists |
|||
String checkSql = "SELECT COUNT(*) FROM waste_collectors_request WHERE refid = ?"; |
|||
Integer count = jdbcTemplate.queryForObject(checkSql, new Object[]{refId}, Integer.class); |
|||
|
|||
if (count != null && count > 0) { |
|||
// ✅ Update the existing record |
|||
String updateSql = "UPDATE waste_collectors_request SET actual_weight = ?, payment_type = ?, processing_charge = ?, waste_collection_charge = ?, total_charge = ?, payment_mobile_no = ? WHERE refid = ?"; |
|||
jdbcTemplate.update(updateSql, actualWeight, paymentType, processingCharge, wasteCharge, totalCharge, paymentMobNo, refId); |
|||
|
|||
// ✅ Send WhatsApp message if payment type is 'generateLink' and mobile number is provided |
|||
if ("generateLink".equalsIgnoreCase(paymentType) && paymentMobNo != null && !paymentMobNo.isBlank()) { |
|||
sendWhatsappMessage(refId, actualWeight, totalCharge, paymentMobNo); |
|||
} |
|||
} else { |
|||
throw new RuntimeException("No request found for Ref ID: " + refId); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
public void sendWhatsappMessage(String refId, double actualWeight, double totalCharge, String mobileNumber) { |
|||
try { |
|||
String message = String.format( |
|||
"Your request (Request ID: *%s*) has been processed. Please proceed with the payment.\n\nActual Weight: *%.0f kg*\nAmount Payable: *%.0f*", |
|||
refId, actualWeight, totalCharge |
|||
); |
|||
|
|||
String encodedMessage = URLEncoder.encode(message, StandardCharsets.UTF_8); |
|||
String encodedHeader = URLEncoder.encode("C&D Waste Collection – Payment Request", StandardCharsets.UTF_8); |
|||
String encodedFooter = URLEncoder.encode("Greater Chennai Corporation", StandardCharsets.UTF_8); |
|||
|
|||
String redirectUrlParam = URLEncoder.encode("dumpregistration/paymentform?requestId=" + refId, StandardCharsets.UTF_8); |
|||
|
|||
String apiUrl = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507" + |
|||
"&password=h2YjFNcJ" + |
|||
"&send_to=" + mobileNumber + |
|||
"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE" + |
|||
"&msg=" + encodedMessage + |
|||
"&isTemplate=true" + |
|||
"&header=" + encodedHeader + |
|||
"&footer=" + encodedFooter + |
|||
"&buttonUrlParam=" + redirectUrlParam; |
|||
|
|||
// Optional: log URL before hitting for debugging |
|||
System.out.println("WhatsApp API URL: " + apiUrl); |
|||
|
|||
// Make API call |
|||
// restTemplate.getForObject(apiUrl, String.class); |
|||
smsService.sendMsg(apiUrl); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
// Optionally log or alert failure |
|||
} |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getAllRequestDetails(LocalDate fromDate, LocalDate toDate, String wastequantity, String zone) { |
|||
StringBuilder query = new StringBuilder( |
|||
"SELECT wcr.id, wcr.name, wcr.mobile_no, wcr.area, wcr.zone, qm.quantity, " + |
|||
"wtm.waste_type, dl.location, wcr.actual_weight, wcr.payment_status,wcr.waste_collection_charge, " + |
|||
"wcr.processing_charge, wcr.total_charge, DATE_FORMAT(wcr.cdate, '%d-%m-%Y') AS request_date, wcr.refid " + |
|||
"FROM waste_collectors_request wcr " + |
|||
"JOIN dumping_location dl ON wcr.dump_location_id = dl.id " + |
|||
"JOIN waste_type_master wtm ON wcr.waste_type_id = wtm.id " + |
|||
"JOIN quantity_master qm ON wcr.waste_quantity_id = qm.id " + |
|||
"WHERE wcr.cdate BETWEEN ? AND ?"); |
|||
|
|||
LocalDateTime fromDateTime = fromDate.atStartOfDay(); |
|||
LocalDateTime toDateTime = toDate.atTime(LocalTime.MAX); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
params.add(fromDateTime); |
|||
params.add(toDateTime); |
|||
|
|||
if (wastequantity != null && !wastequantity.isEmpty()) { |
|||
query.append(" AND qm.quantity = ?"); |
|||
params.add(wastequantity); |
|||
} |
|||
|
|||
if (zone != null && !zone.isEmpty()) { |
|||
query.append(" AND wcr.zone = ?"); |
|||
params.add(zone); |
|||
} |
|||
|
|||
return jdbcTemplate.queryForList(query.toString(), params.toArray()); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getAllwastequantity() { |
|||
String sql = " SELECT id,quantity FROM quantity_master where is_active = 1 "; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getZonesList() { |
|||
String sql = " SELECT id,zone_name from zones where is_active = 1 "; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
package in.gov.chennaicorporation.gccoffice.cdwaste.service; |
|||
|
|||
|
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
|
|||
@Service |
|||
public class SMSService { |
|||
public String sendMsg(String msgUrl) { |
|||
System.out.println("Whatsapp URL :-"+msgUrl); |
|||
|
|||
String response =""; |
|||
try{ |
|||
HttpURLConnection connection =null; |
|||
|
|||
URL url = new URL(msgUrl); |
|||
connection = (HttpURLConnection) url.openConnection(); |
|||
connection.setRequestMethod("GET"); |
|||
|
|||
int responseCode = connection.getResponseCode(); |
|||
response=responseCode+""; |
|||
System.out.println("Response Code: " + responseCode); |
|||
|
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public String sendSMS(String SMS_Url) { |
|||
System.out.println("SMS URL:- "+ SMS_Url); |
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
String response =restTemplate.getForObject(SMS_Url,String.class); |
|||
return response; |
|||
} |
|||
} |
|||
@ -0,0 +1,430 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"> |
|||
|
|||
</head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
.card-box { |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
|
|||
} |
|||
|
|||
@media (max-width: 768px) { |
|||
.card-box { |
|||
text-align: center; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<div class="wrapper"> |
|||
<!-- Header --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
|
|||
<div class="page-wrap"> |
|||
<!-- Left Menu --> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
|
|||
<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="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Less 1 Ton List</h5> |
|||
<span>C & N Manager System</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="/gcc/index"><i class="ik ik-home"></i></a> |
|||
</li> |
|||
<li class="breadcrumb-item" aria-current="page">C & N Manager System</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Less 1 Ton List</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-header"> |
|||
<h3>Less 1 Ton List</h3> |
|||
</div> |
|||
|
|||
<!-- <div class="row mt-3 ml-2"> |
|||
<div class="col-md-3"> |
|||
<label for="startDate" class="form-label" style="font-size: medium;">From Date:</label> |
|||
<input type="date" id="startDate" class="form-control" placeholder="Start Date" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="endDate" class="form-label" style="font-size: medium;">To Date:</label> |
|||
<input type="date" id="endDate" class="form-control" placeholder="End Date" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-3" style="margin-top: 30px;"> |
|||
<button id="searchBtn" class="btn btn-primary">Search</button> |
|||
<button id="resetBtn" class="btn btn-secondary">Reset</button> |
|||
</div> |
|||
</div> --> |
|||
|
|||
<div class="card-body"> |
|||
|
|||
<table id="QaqcDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
|
|||
<tr role="row"> |
|||
<th class="text-center no-sort" style="text-align: center;">S.No</th> |
|||
<th class="text-center no-sort" style="text-align: center;">Reference ID</th> |
|||
<th class="text-center no-sort" style="text-align: center;">Name</th> |
|||
<th class="text-center no-sort" style="text-align: center;">Request Date</th> |
|||
<th class="text-center no-sort" style="text-align: center;">Quantity</th> |
|||
<th class="text-center no-sort" style="text-align: center;">Mobile No</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal --> |
|||
<div class="modal fade" id="publicinfodetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
|
|||
<div class="modal-header"> |
|||
|
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Public Information (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
|
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
|
|||
</div> |
|||
|
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- requester Name--> |
|||
<div class="col-md-6"> |
|||
<label for="userName" class="form-label fw-bold">Name</label> |
|||
<input type="text" id="userName" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Phone Number --> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="contactNumber" class="form-label fw-bold">Phone Number</label> |
|||
<input type="number" id="contactNumber" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- waste Selection --> |
|||
<div class="col-md-6"> |
|||
<label for="wasteSelection" class="form-label fw-bold">Waste Selection</label> |
|||
<input type="text" id="wasteSelection" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- vehicle Selection --> |
|||
<div class="col-md-6"> |
|||
<label for="vehicleSelection" class="form-label fw-bold">Vehicle Selection </label> |
|||
<input type="text" id="vehicleSelection" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Request Date --> |
|||
<div class="col-md-6"> |
|||
<label for="requestDate" class="form-label fw-bold">Request Date </label> |
|||
<input type="text" id="requestDate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Zone --> |
|||
<div class="col-md-6"> |
|||
<label for="zone" class="form-label fw-bold">Zone </label> |
|||
<input type="text" id="zone" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Wards --> |
|||
<div class="col-md-6"> |
|||
<label for="ward" class="form-label fw-bold">Ward </label> |
|||
<input type="text" id="ward" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Waste Type --> |
|||
<div class="col-md-6"> |
|||
<label for="wasteType" class="form-label fw-bold">Waste Type </label> |
|||
<input type="text" id="wasteType" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Location --> |
|||
<div class="col-md-6"> |
|||
<label for="location" class="form-label fw-bold">Location </label> |
|||
<input type="text" id="location" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<div class="modal-footer"> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<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() { |
|||
|
|||
var table = $('#QaqcDatatable').DataTable({ |
|||
|
|||
|
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
fixedColumns: { |
|||
left: 1, |
|||
right: 1 |
|||
}, |
|||
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: true, |
|||
searching:true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
// Initialize DataTable with export buttons |
|||
const tableApiUrl = "/gcc/api/dumpregistration/getless1tonlist"; |
|||
|
|||
|
|||
// Fetch and Populate Table Data Function |
|||
|
|||
const fetchTableData = async (startDate = "", endDate = "") => { |
|||
try { |
|||
const params = new URLSearchParams(); |
|||
if (startDate) params.append("startDate", startDate); |
|||
if (endDate) params.append("endDate", endDate); |
|||
|
|||
const response = await fetch(`${tableApiUrl}?${params.toString()}`); |
|||
const tableData = await response.json(); |
|||
|
|||
// Update DataTable with new data |
|||
table.clear(); // Clear existing data |
|||
tableData.forEach((row, index) => { |
|||
table.row.add([ |
|||
|
|||
`<div style="text-align: center;">${index + 1}</div>`, |
|||
`<button class="btn btn-success" data-ref_id="${row.refid}" |
|||
onclick="fetchRequestDetails('${row.refid}')" style="text-align: center;">${row.refid}</button>`, |
|||
|
|||
`<div style="text-align: center;">${row.name}</div>`, |
|||
`<div style="text-align: center;">${row.request_date}</div>`, |
|||
`<div style="text-align: center;">${row.quantity}</div>`, |
|||
`<div style="text-align: center;">${row.mobile_no}</div>`, |
|||
|
|||
]); |
|||
|
|||
}); |
|||
table.draw(); // Redraw the DataTable with the updated data |
|||
|
|||
} catch (error) { |
|||
console.error("Error fetching table data:", error); |
|||
} |
|||
|
|||
}; |
|||
|
|||
|
|||
// Example: Fetch Data initially without filters |
|||
fetchTableData(); |
|||
|
|||
|
|||
|
|||
// ✅ This makes fetchRequestDetails globally available for the onclick |
|||
window.fetchRequestDetails = function (refId) { |
|||
console.log("refId", refId); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/dumpregistration/getless1tonlistbyId', |
|||
type: 'GET', |
|||
data: { refId: refId }, |
|||
dataType: "json", |
|||
success: function (response) { |
|||
let details = null; |
|||
|
|||
if (Array.isArray(response) && response.length > 0) { |
|||
details = response[0]; |
|||
} else if (response && typeof response === 'object') { |
|||
details = response; |
|||
} |
|||
|
|||
if (details) { |
|||
$('#userName').val(details.name); |
|||
$('#contactNumber').val(details.mobile_no); |
|||
$('#wasteSelection').val(details.quantity); |
|||
$('#vehicleSelection').val(details.vehicle_name); |
|||
$('#requestDate').val(details.request_date); |
|||
$('#zone').val(details.zone); |
|||
$('#ward').val(details.ward); |
|||
$('#wasteType').val(details.waste_type); |
|||
$('#location').val(details.location); |
|||
$('#modalEmployeeCode').text(details.refid); |
|||
|
|||
// ✅ Show the modal |
|||
$('#publicinfodetailsModal').modal('show'); |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected entry.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
|
|||
/* |
|||
// 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); |
|||
}); |
|||
|
|||
// Search Button Click |
|||
document.getElementById("searchBtn").addEventListener("click", () => { |
|||
const startDate = document.getElementById("startDate").value; |
|||
const endDate = document.getElementById("endDate").value; |
|||
|
|||
//console.log("xsnskjx"); |
|||
console.log(startDate); |
|||
|
|||
// Check if startDate or endDate is empty |
|||
if (!startDate || !endDate) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Incomplete Search", |
|||
text: "Please select the Date Before searching", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} else { |
|||
// Call fetchTableData if dates are provided |
|||
fetchTableData(startDate, endDate); |
|||
} |
|||
}); */ |
|||
|
|||
// Reset Button Click |
|||
document.getElementById("resetBtn").addEventListener("click", () => { |
|||
|
|||
window.location.reload(); |
|||
}); |
|||
|
|||
|
|||
fetchTableData(); |
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
1122
frontend/cdwastecollect/officer.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,411 @@ |
|||
<!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>Reports</h5> |
|||
<span>C&D Waste Collections Reports</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">C&D Waste Collections Reports</li> |
|||
<li class="breadcrumb-item active" aria-current="page"> Reports</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;">Reports Filters</span> |
|||
</div> |
|||
<div class="card-body"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-sm-2 mb-2"> |
|||
<label for="startDate" class="form-label">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" class="form-label" >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="wastequantity" class="form-label">Select weight quantity<span class="text-danger">*</span> |
|||
</label> <select id="wastequantity" class="form-control"> |
|||
|
|||
<!-- dynamically get the quantities --> |
|||
</select> |
|||
</div> |
|||
|
|||
<div class="col-sm-2 mb-2"> |
|||
|
|||
<label for="zoneDropdown" class="form-label"> Select |
|||
Zone <span class="text-danger">*</span> |
|||
</label> <select id="zoneDropdown" class="form-control"> |
|||
<option value="">Select Zone</option> |
|||
<!-- Zones will be loaded dynamically --> |
|||
</select> |
|||
|
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-md-12 mb-2 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="button">Reset</button> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<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">Request ID</th> |
|||
<th class="text-center">Request Date</th> |
|||
<th class="text-center">Name</th> |
|||
<th class="text-center">Mobile Number</th> |
|||
<th class="text-center">Area</th> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Weight Quantity</th> |
|||
<th class="text-center">Waste Type</th> |
|||
<th class="text-center">Dumping Location</th> |
|||
<th class="text-center">Actual Weight</th> |
|||
<th class="text-center">Payment Status</th> |
|||
<th class="text-center">Total Amount</th> |
|||
|
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
</tbody> |
|||
</table> |
|||
</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> |
|||
</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() { |
|||
|
|||
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: false, |
|||
scrollX: true, |
|||
responsive: false, |
|||
paging:true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
// Event listener for From Date selection |
|||
|
|||
$(document).ready(function () { |
|||
const today = new Date(); |
|||
const formattedToday = today.toISOString().split('T')[0]; |
|||
|
|||
// Get date 30 days ago |
|||
const pastDate = new Date(); |
|||
pastDate.setDate(today.getDate() - 30); |
|||
const formattedPast = pastDate.toISOString().split('T')[0]; |
|||
|
|||
// Set default values and limits |
|||
$("#startDate").val(formattedPast); |
|||
$("#startDate").attr("max", formattedToday); |
|||
$("#endDate").val(formattedToday); |
|||
$("#endDate").attr("min", formattedPast); |
|||
$("#endDate").attr("max", formattedToday); |
|||
|
|||
// Load quantities |
|||
$.ajax({ |
|||
url: "/gcc/api/dumpregistration/getquantity", |
|||
type: "GET", |
|||
success: function (data) { |
|||
let quantityDropdown = $("#wastequantity"); |
|||
quantityDropdown.empty().append("<option value=''>Select Quantity</option>"); |
|||
$.each(data, function (index, item) { |
|||
quantityDropdown.append(`<option value="${item.quantity}">${item.quantity}</option>`); |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("Error fetching quantities:", error); |
|||
} |
|||
}); |
|||
|
|||
// Function to fetch and load data |
|||
function loadReportData() { |
|||
let startDate = $('#startDate').val(); |
|||
let endDate = $('#endDate').val(); |
|||
let zone = $('#zoneDropdown').val(); |
|||
let wasteQuantity = $('#wastequantity').val(); |
|||
|
|||
const params = new URLSearchParams({ |
|||
fromDate: startDate, |
|||
toDate: endDate |
|||
}); |
|||
|
|||
if (zone) { |
|||
params.append("zone", zone); |
|||
} |
|||
|
|||
if (wasteQuantity) { |
|||
params.append("wastequantity", wasteQuantity); |
|||
} |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
type: "GET", |
|||
url: `/gcc/api/dumpregistration/getAllDetails?${params.toString()}`, |
|||
contentType: "application/json", |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
|
|||
if (Array.isArray(response) && response.length > 0) { |
|||
$('#ReportDatatable').DataTable({ |
|||
destroy: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
autoWidth: true, // IMPORTANT: let you control column width |
|||
scrollX: true, // Enables horizontal scroll |
|||
responsive: true, // Disable built-in responsive which hides columns |
|||
data: response, |
|||
columns: [ |
|||
{ data: null, render: (data, type, row, meta) => meta.row + 1, className: 'text-center' }, |
|||
{ data: 'refid', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'request_date', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'name', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'mobile_no', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'area', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'zone', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'quantity', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'waste_type', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'location', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'actual_weight', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'payment_status', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'total_charge', defaultContent: '-', className: 'text-center' } |
|||
|
|||
], |
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
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: true |
|||
}); |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'No Data', |
|||
text: 'No data available for the selected criteria.' |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Something went wrong while fetching the data.' |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Bind search button to loadReportData |
|||
$('#searchBtn').on('click', function (e) { |
|||
e.preventDefault(); |
|||
|
|||
let startDate = $('#startDate').val(); |
|||
let endDate = $('#endDate').val(); |
|||
|
|||
if (!startDate || !endDate) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Error', |
|||
text: 'Please Select Both From Date and To Date', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
loadReportData(); |
|||
}); |
|||
|
|||
// Load data for the last 30 days on page load |
|||
loadReportData(); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
$('#resetBtn').click(function () { |
|||
location.reload(); |
|||
}); |
|||
|
|||
|
|||
|
|||
// Load all zones |
|||
$(document).ready(function () { |
|||
$.ajax({ |
|||
url: '/gcc/api/dumpregistration/getzones', |
|||
type: 'GET', |
|||
success: function (zones) { |
|||
|
|||
$.each(zones, function (index, zone) { |
|||
$('#zoneDropdown').append('<option value="' + zone.id + '">' + zone.zone_name + '</option>'); |
|||
}); |
|||
}, |
|||
error: function () { |
|||
alert('Failed to load zones.'); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue