Browse Source

Clean and safe message template added

main
kanimozhi 8 months ago
parent
commit
d61a07540f
  1. 361
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/CreateEventAPIController.java
  2. 1159
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java
  3. 25
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java
  4. 664
      gcc_officer_portal/src/main/resources/templates/modules/vendors/EventList.html
  5. 782
      gcc_officer_portal/src/main/resources/templates/modules/vendors/RequestList.html
  6. 2609
      gcc_officer_portal/src/main/resources/templates/modules/vendors/streetVendorRequestForm.html

361
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/CreateEventAPIController.java

@ -31,187 +31,182 @@ import in.gov.chennaicorporation.gccoffice.vendor.service.StreetVendorService;
@RequestMapping("/gcc/api/vending")
@RestController
public class CreateEventAPIController {
@Autowired
private createventService createventservices;
@Autowired
private StreetVendorService StreetVendorService;
// @Autowired
// private Environment environment;
@PostMapping("/save")
public ResponseEntity<Map<String, Object>> saveEventWithFile(
@RequestParam("eventName") String eventName,
@RequestParam("eventDate") String eventDateStr,
@RequestParam("file") MultipartFile file,
@RequestParam("cby") String cby) {
Map<String, Object> response = new HashMap<>();
try {
if (file == null || file.isEmpty()) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "File is required");
return ResponseEntity.badRequest().body(response);
}
if (eventName == null || eventName.trim().isEmpty()) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "Event name cannot be empty");
return ResponseEntity.badRequest().body(response);
}
LocalDate eventDate;
try {
eventDate = LocalDate.parse(eventDateStr);
} catch (Exception ex) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "Invalid date format (use yyyy-MM-dd)");
return ResponseEntity.badRequest().body(response);
}
String eventFilePath = StreetVendorService.fileUpload(file, "event_file");
if (eventFilePath == null) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "File upload failed");
return ResponseEntity.internalServerError().body(response);
}
String saveStatus = createventservices.insertEvent(eventName, eventDate, eventFilePath, cby);
if (saveStatus == null || saveStatus.equalsIgnoreCase("error")) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "Failed to save event details");
return ResponseEntity.internalServerError().body(response);
}
response.put("status", true);
response.put("message", "success");
response.put("description", "Details saved successfully");
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
response.put("status", false);
response.put("message", "failed");
response.put("description", "Internal server error: " + e.getMessage());
return ResponseEntity.internalServerError().body(response);
}
}
//save file and get path
// private String saveFile(MultipartFile file) throws IOException {
//
// String uploadDirectory = environment.getProperty("file.upload.directory");
//
// String folderName = environment.getProperty("vending.foldername");
//
// String fileName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) + "_" + file.getOriginalFilename();
//
// String folderPath = uploadDirectory + "/" + folderName + "/";
//
//
// Path dirPath = Paths.get(folderPath);
// if (!Files.exists(dirPath)) {
// Files.createDirectories(dirPath);
// }
//
// Path filePath = dirPath.resolve(fileName);
//
// Files.write(filePath, file.getBytes());
//
// return filePath.toAbsolutePath().toString();
// }
@GetMapping("/dropdown-Event")
public ResponseEntity<List<Map<String, Object>>> ViewDropdownEvent() {
try {
List<Map<String, Object>> result = createventservices.ViewDropdownEvent();
return ResponseEntity.ok(result);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("error", "Unable to fetch event list");
error.put("details", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Collections.singletonList(error));
}
}
@GetMapping("/committedropdown")
public List<Map<String, Object>> ViewCommitteeDropdownEvent() {
return createventservices.ViewCommitteeDropdownEvent();
}
@GetMapping("/getreports")
public List<Map<String, Object>> getreports(
@RequestParam(required = false) String meeting,
@RequestParam(required = false) String status,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String ward,
@RequestParam String userId) {
List<Map<String, Object>> streetdb = StreetVendorService.getdataforreport(zone,ward); // BASE LIST
List<Map<String, Object>> vendingdb = createventservices.getdataforreport(meeting, status,userId); // FILTERED REQUEST LIST
// Convert vendingdb to map: vdid → vendor record
Map<Integer, Map<String, Object>> vendingMap = vendingdb.stream()
.filter(m -> m.get("vdid") != null)
.collect(Collectors.toMap(
m -> Integer.parseInt(m.get("vdid").toString()),
m -> m
));
List<Map<String, Object>> finalList = new ArrayList<>();
// Merge logic
for (Map<String, Object> row : streetdb) {
int id = Integer.parseInt(row.get("id").toString());
if (!vendingMap.containsKey(id)) {
continue;
}
// Merge map
Map<String, Object> merged = new HashMap<>(row);
Map<String, Object> vdata = vendingMap.get(id);
merged.put("status", vdata.get("status"));
merged.put("remarks", vdata.get("remarks"));
merged.put("uid_no", vdata.get("uid_no"));
merged.put("event_req_id", vdata.get("event_req_id"));
merged.put("cdate", vdata.get("cdate"));
finalList.add(merged);
}
return finalList;
}
@GetMapping("/finalvendorDetailsById")
public List<Map<String, Object>> finalvendorDetailsById(String requestId){
return createventservices.finalvendorDetailsById(requestId);
}
@Autowired
private createventService createventservices;
@Autowired
private StreetVendorService StreetVendorService;
// @Autowired
// private Environment environment;
@PostMapping("/save")
public ResponseEntity<Map<String, Object>> saveEventWithFile(
@RequestParam("eventName") String eventName,
@RequestParam("eventDate") String eventDateStr,
@RequestParam("file") MultipartFile file,
@RequestParam("cby") String cby) {
Map<String, Object> response = new HashMap<>();
try {
if (file == null || file.isEmpty()) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "File is required");
return ResponseEntity.badRequest().body(response);
}
if (eventName == null || eventName.trim().isEmpty()) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "Event name cannot be empty");
return ResponseEntity.badRequest().body(response);
}
LocalDate eventDate;
try {
eventDate = LocalDate.parse(eventDateStr);
} catch (Exception ex) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "Invalid date format (use yyyy-MM-dd)");
return ResponseEntity.badRequest().body(response);
}
String eventFilePath = StreetVendorService.fileUpload(file, "event_file");
if (eventFilePath == null) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "File upload failed");
return ResponseEntity.internalServerError().body(response);
}
String saveStatus = createventservices.insertEvent(eventName, eventDate, eventFilePath, cby);
if (saveStatus == null || saveStatus.equalsIgnoreCase("error")) {
response.put("status", false);
response.put("message", "failed");
response.put("description", "Failed to save event details");
return ResponseEntity.internalServerError().body(response);
}
response.put("status", true);
response.put("message", "success");
response.put("description", "Details saved successfully");
return ResponseEntity.ok(response);
} catch (Exception e) {
e.printStackTrace();
response.put("status", false);
response.put("message", "failed");
response.put("description", "Internal server error: " + e.getMessage());
return ResponseEntity.internalServerError().body(response);
}
}
// save file and get path
// private String saveFile(MultipartFile file) throws IOException {
//
// String uploadDirectory = environment.getProperty("file.upload.directory");
//
// String folderName = environment.getProperty("vending.foldername");
//
// String fileName =
// LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) +
// "_" + file.getOriginalFilename();
//
// String folderPath = uploadDirectory + "/" + folderName + "/";
//
//
// Path dirPath = Paths.get(folderPath);
// if (!Files.exists(dirPath)) {
// Files.createDirectories(dirPath);
// }
//
// Path filePath = dirPath.resolve(fileName);
//
// Files.write(filePath, file.getBytes());
//
// return filePath.toAbsolutePath().toString();
// }
@GetMapping("/dropdown-Event")
public ResponseEntity<List<Map<String, Object>>> ViewDropdownEvent(@RequestParam String userId) {
try {
List<Map<String, Object>> result = createventservices.ViewDropdownEvent(userId);
return ResponseEntity.ok(result);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("error", "Unable to fetch event list");
error.put("details", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Collections.singletonList(error));
}
}
@GetMapping("/committedropdown")
public List<Map<String, Object>> ViewCommitteeDropdownEvent(@RequestParam String userId) {
return createventservices.ViewCommitteeDropdownEvent(userId);
}
@GetMapping("/getreports")
public List<Map<String, Object>> getreports(
@RequestParam(required = false) String meeting,
@RequestParam(required = false) String status,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String ward,
@RequestParam String userId) {
List<Map<String, Object>> streetdb = StreetVendorService.getdataforreport(zone, ward); // BASE LIST
List<Map<String, Object>> vendingdb = createventservices.getdataforreport(meeting, status, userId); // FILTERED
// REQUEST
// LIST
// Convert vendingdb to map: vdid → vendor record
Map<Integer, Map<String, Object>> vendingMap = vendingdb.stream()
.filter(m -> m.get("vdid") != null)
.collect(Collectors.toMap(
m -> Integer.parseInt(m.get("vdid").toString()),
m -> m));
List<Map<String, Object>> finalList = new ArrayList<>();
// Merge logic
for (Map<String, Object> row : streetdb) {
int id = Integer.parseInt(row.get("id").toString());
if (!vendingMap.containsKey(id)) {
continue;
}
// Merge map
Map<String, Object> merged = new HashMap<>(row);
Map<String, Object> vdata = vendingMap.get(id);
merged.put("status", vdata.get("status"));
merged.put("remarks", vdata.get("remarks"));
merged.put("uid_no", vdata.get("uid_no"));
merged.put("event_req_id", vdata.get("event_req_id"));
merged.put("cdate", vdata.get("cdate"));
finalList.add(merged);
}
return finalList;
}
@GetMapping("/finalvendorDetailsById")
public List<Map<String, Object>> finalvendorDetailsById(String requestId) {
return createventservices.finalvendorDetailsById(requestId);
}
}

1159
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java
File diff suppressed because it is too large
View File

25
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java

@ -671,7 +671,7 @@ public class VehicleService {
break;
case "23":
System.out.println("TempID is 22 (1590940 - Green Committee Report - IMAGE - STATIC)");
System.out.println("TempID is 23 (1590940 - Green Committee Report - IMAGE - STATIC)");
urlString = "https://media.smsgupshup.com/GatewayAPI/rest?"
+ "userid=" + username
+ "&password=" + password
@ -693,6 +693,29 @@ public class VehicleService {
break;
case "24":
System.out.println("TempID is 24 (1590940 - Clean and Safe Guidelines - IMAGE - STATIC)");
urlString = "https://media.smsgupshup.com/GatewayAPI/rest?"
+ "userid=" + username
+ "&password=" + password
+ "&send_to=" + sendTo
+ "&v=1.1&format=json"
+ "&msg_type=IMAGE"
+ "&method=SENDMEDIAMESSAGE"
+ "&caption=%2AGCC+Enforcement+Team+Monitoring%2A%0A%0AToday%27s+%28" + msgDate
+ "%29+Zone+wise+Enforcement+Team+activity+details+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below."
+ "&media_url=" + fileURL
+ "&isTemplate=true&footer=GCC+-+IT+Cell";
urlString = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?type=template"
+ "&apikey=" + apikey
+ "&from=" + from
+ "&to={{to}}&templateid=2784943"
+ "&url=" + fileURL
+ "&placeholders=Clean%20and%20Safe%20Construction%20-%20Vehicle%20Violation";
break;
default:
System.out.println("TempID (" + tempid + ") is unknown");
}

664
gcc_officer_portal/src/main/resources/templates/modules/vendors/EventList.html

@ -1,39 +1,42 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<style>
.required{
color: red;
}
/* Mobile screens - targeting devices with a max width of 767px */
@media (max-width: 767px)
{
#requestlistform label{
margin-top: 10px;
}
}
.required {
color: red;
}
/* Mobile screens - targeting devices with a max width of 767px */
@media (max-width: 767px) {
#requestlistform label {
margin-top: 10px;
}
}
#viewModal .modal-body {
max-height: 70vh; /* Limit the height to 70% of the viewport */
overflow-y: auto; /* Enable vertical scrolling */
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;
}
.comment {
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;
}
.comment {
margin-bottom: 20px;
}
@ -58,244 +61,251 @@ padding-bottom: 10px;
border-top: 1px solid #ccc;
}
</style>
<body>
<!--[if lt IE 8]>
<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 mb-2">
<div class="row align-items-end">
<div class="col-lg-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>Meeting List</h5>
<span>Vending Committe</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">Vending Committe</li>
<li class="breadcrumb-item active" aria-current="page">Meeting List</li>
</ol>
</nav>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" >
<div class="card">
<div class="card-header">
<span style="font-size: medium;font-weight: bold;">Reports Filters</span><span th:text="${LoginUserId}" id="userIdSpan" style="display: none;"></span><span th:text="${zone}" id="userzone" style="display: none;"></span>
</div>
<div class="card-body">
<div class="row" >
<div class="col-md-4 mb-1">
<label for="meetingdropdown" style="font-size: medium;">Meeting:</label>
<select id="meetingdropdown" class="form-control">
<option value="">Select an Meeting</option>
</select>
</div>
<div class="col-md-2 mb-1">
<label for="statusdropdown" style="font-size: medium;">Status:</label>
<select id="statusdropdown" class="form-control">
<option value="">Select Status</option>
<option value="Approved">Approved</option>
<option value="Rejected">Rejected</option>
<option value="Postponed">Postponed</option>
</select>
</div>
<div class="col-md-3 mb-1">
<label for="zonedropdown" style="font-size: medium;">Zone:</label>
<select id="zonedropdown" class="form-control">
<option value="">Select an Zone</option>
</select>
</div>
<div class="col-md-3 mb-1">
<label for="warddropdown" style="font-size: medium;">Ward:</label>
<select id="warddropdown" class="form-control">
<option value="">Select an Ward</option>
</select>
</div>
<!-- <div class="col-md-4 mb-1">
<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="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>Meeting List</h5>
<span>Vending Committe</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">Vending Committe</li>
<li class="breadcrumb-item active" aria-current="page">Meeting List</li>
</ol>
</nav>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<span style="font-size: medium;font-weight: bold;">Reports Filters</span><span
th:text="${LoginUserId}" id="userIdSpan" style="display: none;"></span><span
th:text="${zone}" id="userzone" style="display: none;"></span>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-4 mb-1">
<label for="meetingdropdown" style="font-size: medium;">Meeting:</label>
<select id="meetingdropdown" class="form-control">
<option value="">Select an Meeting</option>
</select>
</div>
<div class="col-md-2 mb-1">
<label for="statusdropdown" style="font-size: medium;">Status:</label>
<select id="statusdropdown" class="form-control">
<option value="">Select Status</option>
<option value="Approved">Approved</option>
<option value="Rejected">Rejected</option>
<option value="Postponed">Postponed</option>
</select>
</div>
<div class="col-md-3 mb-1">
<label for="zonedropdown" style="font-size: medium;">Zone:</label>
<select id="zonedropdown" class="form-control">
<option value="">Select an Zone</option>
</select>
</div>
<div class="col-md-3 mb-1">
<label for="warddropdown" style="font-size: medium;">Ward:</label>
<select id="warddropdown" class="form-control">
<option value="">Select an Ward</option>
</select>
</div>
<!-- <div class="col-md-4 mb-1">
<button class="btn btn-primary" style="margin-top: 32px;" id="submitBtn">Submit</button>
</div> -->
</div>
<div class="row mt-4">
<div class="col-12 d-flex justify-content-center">
<button class="btn btn-primary" id="submitBtn">Submit</button>
<button class="btn btn-danger mx-2" id="resetBtn"
name="reset" type="reset">Reset</button>
</div>
</div>
</div>
<div class="card-block">
<div class="page-header-title" >
<h5 style="margin: 0;font-weight: bold;">Vendors Meeting List</h5><hr>
</div>
<table id="RequestListDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid">
<thead class="thead-dark">
<tr role="row">
<th class="text-center">S.No</th>
<th class="text-center">Request No</th>
<th class="text-center">Zone</th>
<th class="text-center">Ward</th>
<th class="text-center">Public Name</th>
<th class="text-center">Mobile</th>
<th class="text-center">Status</th>
<th class="text-center no-sort" width="%2">View Details</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center">S.No</th>
<th class="text-center">Request No</th>
<th class="text-center">Zone</th>
<th class="text-center">Ward</th>
<th class="text-center">Public Name</th>
<th class="text-center">Mobile</th>
<th class="text-center">Status</th>
<th class="text-center no-sort" width="%2">View Details</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12 d-flex justify-content-center">
<button class="btn btn-primary" id="submitBtn">Submit</button>
<button class="btn btn-danger mx-2" id="resetBtn" name="reset"
type="reset">Reset</button>
</div>
</div>
</div>
<div class="card-block">
<div class="page-header-title">
<h5 style="margin: 0;font-weight: bold;">Vendors Meeting List</h5>
<hr>
</div>
<table id="RequestListDatatable"
class="table table-striped table-bordered table-hover dataTable" role="grid">
<thead class="thead-dark">
<tr role="row">
<th class="text-center">S.No</th>
<th class="text-center">Request No</th>
<th class="text-center">Zone</th>
<th class="text-center">Ward</th>
<th class="text-center">Public Name</th>
<th class="text-center">Mobile</th>
<th class="text-center">Status</th>
<th class="text-center no-sort" width="%2">View Details</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center">S.No</th>
<th class="text-center">Request No</th>
<th class="text-center">Zone</th>
<th class="text-center">Ward</th>
<th class="text-center">Public Name</th>
<th class="text-center">Mobile</th>
<th class="text-center">Status</th>
<th class="text-center no-sort" width="%2">View Details</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-hidden="true"
data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="viewModalLabel">Request Details</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</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-bs-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>
<!-- Modal -->
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="viewModalLabel">Request Details</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</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-bs-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>
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
<script th:replace="~{fragments/modules/base/script :: script}"></script>
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">
</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>
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
<script th:replace="~{fragments/modules/base/script :: script}"></script>
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">
let userzone = document.getElementById('userzone').textContent;
let userId = document.getElementById('userIdSpan').textContent;
// GLOBAL scope — must be outside any other function
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="this.src='/default.jpg'">`;
}
$('#docModal').modal('show');
}
$(document).ready(function() {
var table = $('#RequestListDatatable').DataTable({
// GLOBAL scope — must be outside any other function
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="this.src='/default.jpg'">`;
}
$('#docModal').modal('show');
}
$(document).ready(function () {
var table = $('#RequestListDatatable').DataTable({
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
@ -304,7 +314,7 @@ padding-bottom: 10px;
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
scrollY: '50vh',
buttons: [
{
extend: 'pageLength',
@ -342,12 +352,12 @@ padding-bottom: 10px;
searching: false,
select: false,
processing: false
});
fetchEventDropdown();
fetchEventDropdown(userId);
let zoneString = userzone; // e.g. "01,02,03,04,05"
if (zoneString) {
@ -369,10 +379,10 @@ padding-bottom: 10px;
fetchWardDropdown(selectedZone);
}
});
fetchVendingCommitteeList("","","","",userId)
fetchVendingCommitteeList("", "", "", "", userId)
});
function fetchWardDropdown(zone) {
$.ajax({
@ -403,45 +413,45 @@ padding-bottom: 10px;
}
});
}
$('#resetBtn').on('click', function () {
location.reload();
return;
location.reload();
return;
});
$('#submitBtn').on('click', function () {
const meeting = $('#meetingdropdown').val();
const status = $('#statusdropdown').val();
const zone = $('#zonedropdown').val();
const ward = $('#warddropdown').val();
console.log("Selected Meeting Value:", meeting);
console.log("Selected Status Value:", status);
console.log("Selected zone Value:", zone);
console.log("Selected ward Value:", ward);
// 👉 Now call your API or next function using these two
fetchVendingCommitteeList (meeting, status , zone , ward,userId);
fetchVendingCommitteeList(meeting, status, zone, ward, userId);
});
function fetchVendingCommitteeList(event_req_id,status,zone,ward) {
$('#pageLoader').show();
function fetchVendingCommitteeList(event_req_id, status, zone, ward) {
$('#pageLoader').show();
$.ajax({
url: '/gcc/api/vending/getreports',
data: { meeting: event_req_id,status:status,zone:zone,ward:ward,userId:userId },
data: { meeting: event_req_id, status: status, zone: zone, ward: ward, userId: userId },
method: 'GET',
contentType: 'application/json',
success: function (data) {
$('#pageLoader').hide();
$('#pageLoader').hide();
let tableContainer = $('#RequestListDatatable');
// Destroy any existing DataTable instance
@ -488,11 +498,11 @@ padding-bottom: 10px;
} else if (cellData === 'Rejected') {
$(td).css('color', 'red').css('font-weight', 'bold');
}
else{
$(td).css('color', 'orange').css('font-weight', 'bold');
else {
$(td).css('color', 'orange').css('font-weight', 'bold');
}
}
},
},
{
data: 'id',
render: function (data, type, row) {
@ -500,7 +510,7 @@ padding-bottom: 10px;
},
className: 'text-center'
}
],
dom: 'Bfrtip',
buttons: [
@ -512,25 +522,25 @@ padding-bottom: 10px;
],
columnDefs: [{ targets: 'no-sort', orderable: false }],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '80vh',
scrollX: true,
responsive: false
});
// Bind view buttons
tableContainer.off('click', '.btn-view');
// Bind view buttons
tableContainer.off('click', '.btn-view');
tableContainer.on('click', '.btn-view', function () {
let id = $(this).data('id');
let id = $(this).data('id');
$.ajax({
url: `/gcc/api/vending/finalvendorDetailsById?requestId=${id}`,
method: 'GET',
success: function (detailData) {
if (!detailData || detailData.length === 0) {
$('#modalBodyContent').html("<p>No data found for this request.</p>");
$('#viewModal').modal('show');
@ -538,32 +548,32 @@ padding-bottom: 10px;
}
const details = detailData[0];
const historyList = detailData.map(h => ({
date: h.vc_Inspection_date || "N/A",
status: h.vc_status || "N/A",
remarks: h.vc_remarks || "",
event: h.event_name || "-"
}));
const diffAbledDisplay = details.diff_abled ? (details.diff_abled ? 'Yes' : 'No') : '-';
const pmLoanDisplay = details.pm_svanidhi_loan ? (details.pm_svanidhi_loan ? 'Yes' : 'No') : '-';
const bankAccDisplay = details.bank_acc_status ? (details.bank_acc_status === '1' ? 'Yes' : 'No') : '-';
const idCardDisplay= details.vendor_id_card ? (details.vendor_id_card ==='1' ? 'Yes' : 'No') : '-';
const idCardDisplay = details.vendor_id_card ? (details.vendor_id_card === '1' ? 'Yes' : 'No') : '-';
const bankPassbookDisplay = details.bank_acc_status === '1' && details.bank_passbook
? `<img src="${details.bank_passbook}" alt="Bank Passbook" class="img-fluid" style="max-width: 150px;" onerror="this.src='/default.jpg'">`
: '-';
? `<img src="${details.bank_passbook}" alt="Bank Passbook" class="img-fluid" style="max-width: 150px;" onerror="this.src='/default.jpg'">`
: '-';
const aadharFrontBtn = details.aadhar_front_photo ? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.aadhar_front_photo}')">View</button>` : '-';
const rationCardBtn = details.ration_card_photo ? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.ration_card_photo}')">View</button>` : '-';
const aadharBackBtn = details.aadhar_back_photo ? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.aadhar_back_photo}')">View</button>` : '-';
const bankPassbookBtn = details.bank_acc_status === '1' && details.bank_passbook
? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.bank_passbook}')">View</button>`
: '-';
const spacePhotoBtn= details.vendor_space_photo ? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.vendor_space_photo}')">View</button>` : '-';
const spacePhotoBtn = details.vendor_space_photo ? `<button class="btn btn-sm btn-light custom-doc-btn" onclick="openDocModal('${details.vendor_space_photo}')">View</button>` : '-';
let historyHtml = "";
historyList.forEach(h => {
historyHtml += `
@ -579,8 +589,8 @@ padding-bottom: 10px;
</div>
</div>`;
});
const content = `
<div class="container-fluid">
<!-- Personal Details -->
@ -734,8 +744,8 @@ padding-bottom: 10px;
</div>
</div>
`;
`;
$('#modalBodyContent').html(content);
$('#viewModalLabel').text(`Vendor Details - ${id}`);
$('#viewModal').modal('show');
@ -746,22 +756,23 @@ padding-bottom: 10px;
}
});
});
},
error: function (xhr, status, error) {
$('#pageLoader').hide();
$('#pageLoader').hide();
console.error("Error fetching data:", error);
alert("Failed to load vendor list.");
}
});
}
// Call this function on page load
function fetchEventDropdown() {
// Call this function on page load
function fetchEventDropdown(userId) {
$.ajax({
url: '/gcc/api/vending/committedropdown',
type: 'GET',
data: { userId: userId },
dataType: 'json',
success: function (data) {
let eventDropdown = $('#meetingdropdown');
@ -769,13 +780,13 @@ padding-bottom: 10px;
eventDropdown.append('<option value="">Select an Meeting</option>');
data.forEach(function (event) {
// Optional: filter active & not deleted
eventDropdown.append(
$('<option></option>')
.val(event.req_id)
.text(`${event.event_name} - ${event.formated_date}`)
);
// Optional: filter active & not deleted
eventDropdown.append(
$('<option></option>')
.val(event.req_id)
.text(`${event.event_name} - ${event.formated_date}`)
);
});
},
error: function (xhr, status, error) {
@ -784,10 +795,11 @@ padding-bottom: 10px;
}
});
}
</script>
</body>
</script>
</body>
</html>

782
gcc_officer_portal/src/main/resources/templates/modules/vendors/RequestList.html
File diff suppressed because it is too large
View File

2609
gcc_officer_portal/src/main/resources/templates/modules/vendors/streetVendorRequestForm.html
File diff suppressed because it is too large
View File

Loading…
Cancel
Save