10 Commits

Author SHA1 Message Date
Balaji d4e31e1509 added on common based : Data encode Date Difference , filesize format and download file script 3 years ago
Balaji 7c2f7e70bc URL Changed Based on Domain and nginx 3 years ago
Balaji e32683bb81 Nodata hardcoded to function 3 years ago
Balaji e5894a8383 Base Head Bell & Ribbon CSS 3 years ago
Balaji c7fd787de5 Error Page 3 years ago
Balaji 2c46f58820 DataSource Config added 3 years ago
Balaji 8a9f3d6653 Module Url Changed 3 years ago
Balaji 78f77049b2 New Mayor Petition Module 3 years ago
Balaji e0e3aef4b5 New Councillor Petition Module 3 years ago
Balaji cbd1b2a323 SQL DateTime dependency 3 years ago
  1. BIN
      .DS_Store
  2. 32
      pom.xml
  3. BIN
      src/.DS_Store
  4. BIN
      src/main/.DS_Store
  5. BIN
      src/main/java/.DS_Store
  6. BIN
      src/main/java/in/.DS_Store
  7. BIN
      src/main/java/in/gov/.DS_Store
  8. BIN
      src/main/java/in/gov/chennaicorporation/.DS_Store
  9. BIN
      src/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store
  10. 151
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/APIController.java
  11. 130
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/MainController.java
  12. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/package-info.java
  13. 21
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/data/ComplaintType.java
  14. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/data/package-info.java
  15. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/entity/package-info.java
  16. 7
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/package-info.java
  17. 671
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/Petition.java
  18. 58
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/PetitionMaster.java
  19. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/package-info.java
  20. 7
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java
  21. 45
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
  22. 5
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java
  23. 16
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java
  24. 56
      src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java
  25. 73
      src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java
  26. 7
      src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java
  27. 35
      src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java
  28. 156
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java
  29. 130
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java
  30. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/package-info.java
  31. 21
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/data/ComplaintType.java
  32. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/data/package-info.java
  33. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/entity/package-info.java
  34. 7
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/package-info.java
  35. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/repository/package-info.java
  36. 671
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java
  37. 58
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/PetitionMaster.java
  38. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/package-info.java
  39. 2
      src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java
  40. 2
      src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java
  41. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java
  42. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java
  43. 2
      src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java
  44. 38
      src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java
  45. 1
      src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java
  46. 2
      src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java
  47. BIN
      src/main/resources/.DS_Store
  48. 16
      src/main/resources/application.properties
  49. BIN
      src/main/resources/static/.DS_Store
  50. BIN
      src/main/resources/static/assets/.DS_Store
  51. BIN
      src/main/resources/static/assets/dist/.DS_Store
  52. 4
      src/main/resources/static/assets/dist/css/theme.css
  53. BIN
      src/main/resources/static/assets/images/.DS_Store
  54. BIN
      src/main/resources/templates/.DS_Store
  55. 2
      src/main/resources/templates/error-403.html
  56. 2
      src/main/resources/templates/error-404.html
  57. 2
      src/main/resources/templates/error-500.html
  58. 2
      src/main/resources/templates/error.html
  59. 2
      src/main/resources/templates/fragments/modules/base/footer.html
  60. 487
      src/main/resources/templates/fragments/modules/base/head.html
  61. 28
      src/main/resources/templates/fragments/modules/base/header.html
  62. 2
      src/main/resources/templates/fragments/modules/base/menu.html
  63. 106
      src/main/resources/templates/fragments/modules/base/script.html
  64. 116
      src/main/resources/templates/fragments/modules/c_petition/modal-box.html
  65. 291
      src/main/resources/templates/fragments/modules/c_petition/petition_view_script.html
  66. 338
      src/main/resources/templates/fragments/modules/c_petition/script.html
  67. 19
      src/main/resources/templates/fragments/modules/c_petition/search_form.html
  68. 116
      src/main/resources/templates/fragments/modules/m_petition/modal-box.html
  69. 291
      src/main/resources/templates/fragments/modules/m_petition/petition_view_script.html
  70. 360
      src/main/resources/templates/fragments/modules/m_petition/script.html
  71. 19
      src/main/resources/templates/fragments/modules/m_petition/search_form.html
  72. 2
      src/main/resources/templates/fragments/modules/pgr/script.html
  73. 163
      src/main/resources/templates/index.html
  74. 2
      src/main/resources/templates/modules/admin/user-group-access.html
  75. 2
      src/main/resources/templates/modules/admin/user-list.html
  76. 750
      src/main/resources/templates/modules/c_petition/complaint_list.html
  77. 267
      src/main/resources/templates/modules/c_petition/new_petition.html
  78. 237
      src/main/resources/templates/modules/c_petition/petition_ack.html
  79. 282
      src/main/resources/templates/modules/c_petition/petition_list.html
  80. 267
      src/main/resources/templates/modules/c_petition/petition_not_mapped_list.html
  81. 719
      src/main/resources/templates/modules/c_petition/petition_update.html
  82. 158
      src/main/resources/templates/modules/c_petition/petition_view.html
  83. 108
      src/main/resources/templates/modules/c_petition/petition_view_modal_page.html
  84. 750
      src/main/resources/templates/modules/m_petition/complaint_list.html
  85. 301
      src/main/resources/templates/modules/m_petition/new_petition.html
  86. 237
      src/main/resources/templates/modules/m_petition/petition_ack.html
  87. 282
      src/main/resources/templates/modules/m_petition/petition_list.html
  88. 267
      src/main/resources/templates/modules/m_petition/petition_not_mapped_list.html
  89. 758
      src/main/resources/templates/modules/m_petition/petition_update.html
  90. 158
      src/main/resources/templates/modules/m_petition/petition_view.html
  91. 108
      src/main/resources/templates/modules/m_petition/petition_view_modal_page.html
  92. 6
      src/main/resources/templates/modules/mtm/index.html
  93. 6
      src/main/resources/templates/modules/mtm/officer/index.html
  94. 16
      src/main/resources/templates/modules/petregistration/accepted-list.html
  95. 2
      src/main/resources/templates/modules/petregistration/index.html
  96. 14
      src/main/resources/templates/modules/petregistration/license-issued.html
  97. 18
      src/main/resources/templates/modules/petregistration/rejected.html
  98. 18
      src/main/resources/templates/modules/petregistration/request-list.html
  99. 12
      src/main/resources/templates/modules/pgr/all-list.html
  100. 52
      src/main/resources/templates/modules/pgr/index.html

BIN
.DS_Store

32
pom.xml

@ -26,7 +26,12 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
</dependency> </dependency>
<!--
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
@ -65,11 +70,17 @@
<groupId>jakarta.persistence</groupId> <groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId> <artifactId>jakarta.persistence-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId> <artifactId>hibernate-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
@ -88,8 +99,27 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
--> -->
<dependency>
<groupId>in.gov.chennaicorporation</groupId>
<artifactId>Community-Hall-Booking</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
<!-- Spring Cloud dependencies -->
<!--
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2020.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
-->
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

BIN
src/.DS_Store

BIN
src/main/.DS_Store

BIN
src/main/java/.DS_Store

BIN
src/main/java/in/.DS_Store

BIN
src/main/java/in/gov/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/.DS_Store

BIN
src/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store

151
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/APIController.java

@ -0,0 +1,151 @@
package in.gov.chennaicorporation.gccoffice.c_petition.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.m_petition.service.Petition;
import in.gov.chennaicorporation.gccoffice.m_petition.service.PetitionMaster;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("gcc/api/c_petition")
@RestController("cpRest") // Mayor Petition Rest
public class APIController {
private PetitionMaster petitionMaster;
private Petition petition;
@Autowired
public APIController(PetitionMaster petitionMaster,Petition petition) {
this.petitionMaster = petitionMaster;
this.petition = petition;
}
@GetMapping(value="/getComplaintTypes")
public List getComplaintTypeList() {
return petitionMaster.getComplaintType();
}
@GetMapping(value="/getOfficerList")
public List getOfficerList() {
return petitionMaster.getOfficerList();
}
@GetMapping(value="/getPetitionList")
public List getPetitionList() {
return petition.getPetitionList();
}
@GetMapping(value="/getUnmapPetitionList")
public List getUnmapPetitionList() {
return petition.getUnmapPetitionList();
}
@GetMapping(value="/getPetitionDetails")
public List getPetitionDetails(@RequestParam("petitionNo") String petitionNo) {
return petition.getPetitionDetails(petitionNo);
}
@PostMapping(value="/savePetition")
public String savePetition(
@RequestParam("createdBy") String createdBy,
@RequestParam("petition_type") String petitionType,
@RequestParam("petitionerName") String petitionerName,
@RequestParam("petitionerMobile") String petitionerMobile,
@RequestParam("complaintType") String petitionerComplaint,
@RequestParam("san_page1") MultipartFile page1,
@RequestParam("san_page2") MultipartFile page2,
@RequestParam("san_page3") MultipartFile page3,
@RequestParam("san_page4") MultipartFile page4) {
return petition.savePetition(petitionType,createdBy, petitionerName, petitionerMobile, petitionerComplaint, page1, page2, page3, page4);
}
@PostMapping(value="/updatePetition")
public Boolean updatePetition(
@RequestParam("petitionType") String petitionType,
@RequestParam("petitionNo") String petitionNo,
@RequestParam("createdBy") String createdBy,
@RequestParam("petitionerName") String petitionerName,
@RequestParam("petitionerMobile") String petitionerMobile,
@RequestParam("petitionerAddress") String petitionerAddress,
@RequestParam("petitionerPincode") String petitionerPincode,
@RequestParam("complaintType") String petitionerComplaint,
@RequestParam("complaintNature") String complaintNature) {
return petition.updatePetition(petitionNo, petitionType, createdBy, petitionerName, petitionerMobile, petitionerAddress, petitionerPincode, petitionerComplaint, complaintNature);
}
@PostMapping(value="/mapComplientToOfficer")
public Boolean updatePetition(
@RequestParam("petitionId") String petitionId,
@RequestParam("petitionNo") String petitionNo,
@RequestParam("createdBy") String createdBy,
@RequestParam(value = "", required = false) String mapOfficers) {
String com_mapping = mapOfficers;
// First before Mapping need to unmaps old list
petition.unmapComplient(petitionId, petitionNo);
if(com_mapping!=null) {
String[] com_mapping_parts = com_mapping.split(",");
for (String values : com_mapping_parts) {
String[] com_mapping_val = values.split("_");
if (com_mapping_val.length > 0) {
String complientId = com_mapping_val[0];
String offcierId = com_mapping_val[1];
petition.mapComplientToOfficer(createdBy, petitionId, petitionNo, complientId, offcierId);
}
}
}
return true;
}
@GetMapping(value="/getComplaintMappingDetails")
public List getComplaintMappingDetails(
@RequestParam("petitionId") String petitionId,
@RequestParam("petitionNo") String petitionNo,
@RequestParam("complaintTypeId") String complaintTypeId) {
return petition.getComplaintMappingDetails(petitionNo,petitionId,complaintTypeId);
}
@GetMapping(value="/getComplaintList")
public List getComplaintList() {
return petition.getComplaintList();
}
@GetMapping(value="/getComplaintListByPetitionId")
public List getComplaintList(@RequestParam("petitionId") String petitionId) {
return petition.getComplaintListByPetitionId(petitionId);
}
@GetMapping(value="/getComplaintDetails")
public List<?> getComplaintDetails(@RequestParam("mapId") String mapId) {
return petition.getComplaintDetails(mapId);
}
@GetMapping(value="/getComplaintActionDetails")
public List<?> getComplaintActionDetails(@RequestParam("mapId") String mapId) {
return petition.getComplaintActionDetails(mapId);
}
@PostMapping(value="/saveComplanitStatus")
public String saveComplanitStatus(
@RequestParam("createdBy") String createdBy,
@RequestParam("mapId") String mapId,
@RequestParam("complaintStatus") String complaintStatus,
@RequestParam("complaintActionText") String complaintActionText,
@RequestParam("action_san_page1") MultipartFile actionPage1,
@RequestParam("petitionId") String petitionId,
@RequestParam("petitionNo") String petitionNo) {
return petition.saveComplanitStatus(createdBy, mapId, complaintStatus, complaintActionText, actionPage1, petitionId, petitionNo);
}
}

130
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/MainController.java

@ -0,0 +1,130 @@
package in.gov.chennaicorporation.gccoffice.c_petition.controller;
import org.hibernate.hql.internal.ast.tree.RestrictableStatement;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import in.gov.chennaicorporation.gccoffice.service.Base64Util;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("/gcc/c_petition")
@Controller("CouncillorPetitionController")
public class MainController {
private final RestTemplate restTemplate;
private String BasePath = "modules/c_petition/";
@Autowired
public MainController(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
@GetMapping({"", "/", "/index", "/dashboard"})
public String dashboard(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"index";
}
@GetMapping({"/new_petition"})
public String newPetition(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"new_petition";
}
@GetMapping("/petition-ack/{petitionNo}")
public String petitionAck(Model model,@PathVariable("petitionNo") String petitionNo) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_ack";
}
@GetMapping("/petition-list")
public String petitionList(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"petition_list";
}
@GetMapping("/unmapped-petition-list")
public String unMappedPetitionList(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"petition_not_mapped_list";
}
@GetMapping("/update-petition")
public String petitionUpadte(Model model,@RequestParam(value="petitionNo", required = false) String petitionNo) {
if (petitionNo != null && !petitionNo.isEmpty()) {
// Decrypt the encrypted value
petitionNo = Base64Util.decodeBase64(petitionNo);
}
else {
petitionNo = null;
}
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_update";
}
@GetMapping("/view-petition")
public String petitionView(Model model,@RequestParam(value="petitionNo", required = false) String petitionNo) {
if (petitionNo != null && !petitionNo.isEmpty()) {
// Decrypt the encrypted value
petitionNo = Base64Util.decodeBase64(petitionNo);
}
else {
petitionNo = null;
}
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_view";
}
@GetMapping("/view-petition-modal")
public String petitionViewModal(Model model,@RequestParam(value="petitionNo", required = false) String petitionNo) {
if (petitionNo != null && !petitionNo.isEmpty()) {
// Decrypt the encrypted value
petitionNo = Base64Util.decodeBase64(petitionNo);
}
else {
petitionNo = null;
}
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_view_modal_page";
}
@GetMapping("/search-petition")
public String petitionSearch(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
//model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_update";
}
@GetMapping("/complaint-list")
public String complaintList(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"complaint_list";
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.c_petition.controller;

21
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/data/ComplaintType.java

@ -0,0 +1,21 @@
package in.gov.chennaicorporation.gccoffice.c_petition.data;
import java.util.Map;
public class ComplaintType {
private int complaintTypeId;
private String complaintType;
public ComplaintType(Map<String, Object> map) {
this.complaintTypeId = (int) map.get("complaint_typeid");
this.complaintType = (String) map.get("complaint_type");
}
public int getComplaintTypeId() {
return complaintTypeId;
}
public String getComplaintType() {
return complaintType;
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/data/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.c_petition.data;

1
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/entity/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.c_petition.entity;

7
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/package-info.java

@ -0,0 +1,7 @@
/**
*
*/
/**
*
*/
package in.gov.chennaicorporation.gccoffice.c_petition;

671
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/Petition.java

@ -0,0 +1,671 @@
package in.gov.chennaicorporation.gccoffice.c_petition.service;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.sql.DataSource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.m_petition.data.ComplaintType;
import in.gov.chennaicorporation.gccoffice.service.Base64Util;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
@Service("cPetitionService")
public class Petition {
private JdbcTemplate jdbcTemplate;
private final Environment environment;
private PetitionMaster petitionMaster;
@Autowired
public Petition(Environment environment,PetitionMaster petitionMaster) {
this.environment = environment;
this.petitionMaster = petitionMaster;
}
@Autowired
public void setDataSource(@Qualifier("mysqlCouncillorPetitionDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Transactional(readOnly = true)
public List getComplaintTypeList() {
return petitionMaster.getComplaintType();
}
@Transactional(readOnly = true)
public static List<ComplaintType> convertToComplaintTypes(List<Map<String, Object>> complaintTypeMaps) {
return complaintTypeMaps.stream()
.map(ComplaintType::new)
.collect(Collectors.toList());
}
@Transactional(readOnly = true)
// Method to map complaint type IDs to their respective complaint types
public static String mapComplaintTypes(List<ComplaintType> complaintTypes, String complaint) {
String[] complaintIds = complaint.split(",");
StringBuilder complaintTxtBuilder = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
for (ComplaintType type : complaintTypes) {
if (type.getComplaintTypeId() == id) {
if (complaintTxtBuilder.length() > 0) {
complaintTxtBuilder.append(",");
}
complaintTxtBuilder.append(type.getComplaintType());
break;
}
}
}
return complaintTxtBuilder.toString();
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionList() {
try {
String sqlQuery = "SELECT * FROM petition WHERE (`isactive`=1 AND `isdelete`=0)";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
Base64Util.encodeBase64(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getUnmapPetitionList() {
try {
String sqlQuery = "SELECT "
+ " p.* "
+ "FROM "
+ " `petition` p "
+ "WHERE "
+ " p.`isactive` = 1 AND p.`isdelete` = 0 "
+ " AND NOT EXISTS ("
+ " SELECT 1 "
+ " FROM `petition_mapping` pm "
+ " WHERE (p.`petition_id` = pm.`petition_id`) AND (pm.`isactive` = 1 AND pm.`isdelete` = 0 ) "
+ " )";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionDetails(String petitionNo) {
try {
String sqlQuery = "SELECT * FROM petition WHERE petition_no = ? AND (`isactive`=1 AND `isdelete`=0) LIMIT 1";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, petitionNo);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional
public String savePetition(
String petitionType,
String createdBy,
String petitionerName,
String petitionerMobile,
String petitionerComplaint,
MultipartFile page1,
MultipartFile page2,
MultipartFile page3,
MultipartFile page4) {
//System.out.println("I am from Service Page "+petitionerName);
//String complaintNature = "";
int lastInsertId = 0;
String sqlQuery = "INSERT INTO `petition` "
+ "(`petition_type`,`created_by`, `petitioner_name`, `petitioner_mobile`, "
+ "`petitioner_complaint`, `petitioner_complaint_txt`) "
+ "VALUES (?, ?, ?, ?, ?, ?)";
try {
// Complaint Type List
List complaintTypelist = getComplaintTypeList();
// Convert the list of maps to a list of ComplaintType objects
List<ComplaintType> complaintTypes = convertToComplaintTypes(complaintTypelist);
// Map complaint types
String petitionerComplaint_txt = mapComplaintTypes(complaintTypes, petitionerComplaint);
KeyHolder keyHolder = new GeneratedKeyHolder();
// Use JdbcTemplate's update method to execute the query with parameters
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sqlQuery, Statement.RETURN_GENERATED_KEYS);
ps.setString(1, petitionType);
ps.setString(2, createdBy);
ps.setString(3, petitionerName);
ps.setString(4, petitionerMobile);
ps.setString(5, petitionerComplaint);
ps.setString(6, petitionerComplaint_txt);
return ps;
}, keyHolder);
// Get the last insert ID
lastInsertId = (int) keyHolder.getKey().longValue();
// Get the value of cp_ackno from application.properties
String ackno = environment.getProperty("cp_ackno");
String ackno_prefix = environment.getProperty("cp_ackno_prefix");
// Convert ackno to int if needed
int acknoInt = Integer.parseInt(ackno);
// Calculate the petition number
int petitionNo = (int) (lastInsertId + acknoInt);
// Construct the petition number string
String petitionNoString = ackno_prefix + petitionNo;
// Update the petition number in the database
updatePetitionNumber(lastInsertId, petitionNoString);
// Add Petition Scan File in the database
addPetitionFile(createdBy,lastInsertId, petitionNoString, page1, page2, page3, page4);
return petitionNoString; // If no exception, query executed successfully
} catch (DataAccessException e) {
// Handle exception (e.g., log error)
e.printStackTrace();
return "error"; // Query execution failed
}
}
@Transactional
public boolean updatePetitionNumber(int petitionId,String petitionNoString) {
String sqlQuery = "UPDATE `petition` SET `petition_no`='"+petitionNoString+"' WHERE `petition_id`='"+petitionId+"'";
jdbcTemplate.update(sqlQuery);
return true;
}
@Transactional
public String addPetitionFile(String createdBy,
int petitionId,
String petitionNoString,
MultipartFile page1,
MultipartFile page2,
MultipartFile page3,
MultipartFile page4) {
String fileName="";
for (int i = 1; i <= 4; i++) {
MultipartFile file = null;
switch (i) {
case 1:
file = page1;
fileName = "Scan1";
break;
case 2:
file = page2;
fileName = "Scan2";
break;
case 3:
file = page3;
fileName = "Scan3";
break;
case 4:
file = page4;
fileName = "Scan4";
break;
}
if (file != null && !file.isEmpty()) {
try {
// Get the bytes of the file
byte[] bytes = file.getBytes();
// Set the file path where you want to save it
String uploadDirectory = environment.getProperty("file.upload.directory");
String serviceFolderName = environment.getProperty("cp_foldername");
uploadDirectory = uploadDirectory + serviceFolderName;
// File name
fileName = petitionId + "_" + fileName + "_" + petitionNoString + "_" + file.getOriginalFilename();
//File Size
Long fileSize = file.getSize();
// File Type
String fileType = file.getContentType();
// Create directory if it doesn't exist
Path directoryPath = Paths.get(uploadDirectory);
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
String filePath = uploadDirectory + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
// Write the bytes to the file
Files.write(path, bytes);
// Save the file path to a database
String sqlQuery = "INSERT INTO `pentition_files`(`created_by`, `file_name`, `file_size`, `file_type`, `petition_no`, `petition_id`) "
+ "VALUES ('"+createdBy+"','"+fileName+"','"+fileSize+"','"+fileType+"','"+petitionNoString+"','"+petitionId+"')";
jdbcTemplate.update(sqlQuery);
} catch (IOException e) {
e.printStackTrace();
return "Failed to save file " + file.getOriginalFilename();
}
}
}
return "success";
}
@Transactional
public boolean updatePetition(
String petitionType,
String petitionNo,
String createdBy,
String petitionerName,
String petitionerMobile,
String petitionerAddress,
String petitionerPincode,
String petitionerComplaint,
String complaintNature) {
try {
// Complaint Type List
List complaintTypelist = getComplaintTypeList();
// Convert the list of maps to a list of ComplaintType objects
List<ComplaintType> complaintTypes = convertToComplaintTypes(complaintTypelist);
// Map complaint types
String petitionerComplaint_txt = mapComplaintTypes(complaintTypes, petitionerComplaint);
String sqlQuery = "UPDATE `petition` SET "
+ "`petition_type`='"+petitionType+"', `created_by`='"+createdBy+"', `petitioner_name`='"+petitionerName+"', `petitioner_mobile`='"+petitionerMobile+"', "
+ "`petitioner_address`='"+petitionerAddress+"', `petitioner_pincode`='"+petitionerPincode+"',"
+ "`petitioner_complaint`='"+petitionerComplaint+"', `petitioner_complaint_txt`='"+petitionerComplaint_txt+"', `complaint_nature`='"+complaintNature+"' "
+ "WHERE (`petition_no`='"+petitionNo+"') LIMIT 1";
// Use JdbcTemplate's update method to execute the query with parameters
jdbcTemplate.update(sqlQuery);
// Add Petition Scan File in the database
//addPetitionFile(createdBy,lastInsertId, petitionNoString, page1, page2, page3, page4);
return true; // If no exception, query executed successfully
} catch (DataAccessException e) {
// Handle exception (e.g., log error)
e.printStackTrace();
return false; // Query execution failed
}
}
@Transactional
public boolean updatePetitionStatus(String petitionId,String petitionNo) {
String status_value = "close";
List<Map<String, Object>> petitionMappingDetails = getPetitionMappingDetails(petitionNo, petitionId);
for (Map<String, Object> mapping : petitionMappingDetails) {
// Access values from the map using keys
Object status = mapping.get("status");
// Check if status is "close"
if (!"close".equals(status)) {
status_value = "partial";
}
}
String sqlQuery = "UPDATE `petition` SET `status`='"+status_value+"' WHERE `petition_no`='"+petitionNo+"' AND `petition_id`='"+petitionId+"' LIMIT 1";
jdbcTemplate.update(sqlQuery);
System.out.println(sqlQuery);
return true;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionMappingDetails(String petitionNo, String petitionId) {
try {
String sqlQuery = "SELECT * FROM petition_mapping WHERE (`petition_id`= ? AND petition_no = ?) AND (`isactive`=1 AND `isdelete`=0)";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, petitionId, petitionNo);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional
public boolean unmapComplient(String petitionId, String petitionNo) {
String sqlQuery = "UPDATE `petition_mapping` SET `isactive`='0',`isdelete`='1' WHERE `petition_id`='"+petitionId+"' AND `petition_no`='"+petitionNo+"'";
jdbcTemplate.update(sqlQuery);
return true;
}
@Transactional
public boolean mapComplientToOfficer(
String createdBy, String petitionId, String petitionNo, String complaintId, String officerId) {
String sqlQuery = "INSERT INTO `petition_mapping`"
+ "(`created_by`, `off_id`, `petition_no`, `complaint_typeid`, `petition_id`) "
+ "VALUES (?, ?, ?, ?, ?)";
jdbcTemplate.update(sqlQuery, createdBy, officerId, petitionNo, complaintId, petitionId);
return true;
}
@Transactional
public boolean updateMapComplientStatus(String mapId,String status) {
String sqlQuery = "UPDATE `petition_mapping` SET `status`=? WHERE `mapid`=? LIMIT 1";
jdbcTemplate.update(sqlQuery, status, mapId);
System.out.println(sqlQuery);
return true;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintMappingDetails(String petitionNo, String petitionId, String complaintTypeId) {
try {
String sqlQuery = "SELECT * FROM petition_mapping WHERE (`petition_id`= ? AND petition_no = ?) AND `complaint_typeid`= ? AND (`isactive`=1 AND `isdelete`=0) LIMIT 1";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, petitionId, petitionNo,complaintTypeId);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintList() {
try {
String sqlQuery = "SELECT "
+ " p.`petition_id`, p.`cdate`, p.`created_by`, p.`isactive`, p.`isdelete`, p.`petition_no`, "
+ " p.`petitioner_address`, p.`petitioner_complaint`, p.`petitioner_complaint_txt`, "
+ " p.`petitioner_mobile`, p.`petitioner_name`, p.`complaint_nature`, p.`petitioner_pincode`, "
+ " pm.`mapid`, pm.`complaint_typeid`, pm.`off_id`, pm.`status`, om.`off_nm`, ctype.`complaint_type` "
+ " FROM "
+ " `petition` p, `petition_mapping` pm, `petition_master`.`officer_master` om, `petition_master`.`complaint_types` ctype "
+ " WHERE "
+ " (p.`isactive` = 1 AND p.`isdelete` = 0) "
+ " AND (pm.`isactive` = 1 AND pm.`isdelete` = 0) "
+ " AND (om.`isactive` = 1 AND om.`isdelete` = 0) "
+ " AND (om.`off_id` = pm.`off_id`) "
+ " AND (ctype.`complaint_typeid` = pm.`complaint_typeid`) "
+ " AND (p.`petition_id` = pm.`petition_id`)"
+ " ";
System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintListByPetitionId(String petitionId) {
try {
String sqlQuery = "SELECT "
+ " p.`petition_id`, p.`cdate`, p.`created_by`, p.`isactive`, p.`isdelete`, p.`petition_no`, "
+ " p.`petitioner_address`, p.`petitioner_complaint`, p.`petitioner_complaint_txt`, "
+ " p.`petitioner_mobile`, p.`petitioner_name`, p.`complaint_nature`, p.`petitioner_pincode`, p.`status` petition_status, "
+ " pm.`mapid`, pm.`complaint_typeid`, pm.`off_id`, pm.`status` complaint_status, pm.`cdate` mappedOn, om.`off_nm`, ctype.`complaint_type` "
+ " FROM "
+ " `mayor_petition`.`petition` p,`mayor_petition`.`petition_mapping` pm, `petition_master`.`officer_master` om, `petition_master`.`complaint_types` ctype "
+ " WHERE "
+ " (p.`petition_id` = '"+petitionId+"' AND p.`isactive` = 1 AND p.`isdelete` = 0) "
+ " AND (pm.`isactive` = 1 AND pm.`isdelete` = 0) "
+ " AND (om.`isactive` = 1 AND om.`isdelete` = 0) "
+ " AND (om.`off_id` = pm.`off_id`) "
+ " AND (ctype.`complaint_typeid` = pm.`complaint_typeid`) "
+ " AND (p.`petition_id` = pm.`petition_id`)"
+ " ";
System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintDetails(String mapid) {
try {
String sqlQuery = "SELECT "
+ " p.`petition_id`, p.`cdate`, p.`created_by`, p.`isactive`, p.`isdelete`, p.`petition_no`, "
+ " p.`petitioner_address`, p.`petitioner_complaint`, p.`petitioner_complaint_txt`, "
+ " p.`petitioner_mobile`, p.`petitioner_name`, p.`complaint_nature`, p.`petitioner_pincode`, "
+ " pm.`mapid`, pm.`complaint_typeid`, pm.`off_id`, pm.`status`, om.`off_nm`, ctype.`complaint_type` "
+ " FROM "
+ " `petition` p,`petition_mapping` pm, `petition_master`.`officer_master` om, `petition_master`.`complaint_types` ctype "
+ " WHERE "
+ " pm.`mapid`='"+mapid+"' "
+ " AND (p.`isactive` = 1 AND p.`isdelete` = 0) "
+ " AND (pm.`isactive` = 1 AND pm.`isdelete` = 0) "
+ " AND (om.`isactive` = 1 AND om.`isdelete` = 0) "
+ " AND (om.`off_id` = pm.`off_id`) "
+ " AND (ctype.`complaint_typeid` = pm.`complaint_typeid`) "
+ " AND (p.`petition_id` = pm.`petition_id`)"
+ " ";
//System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintActionDetails(String mapId) {
try {
String sqlQuery = "SELECT * FROM `petition_action_taken` WHERE (`mapid`= ? AND `isactive`=1 AND `isdelete`=0) LIMIT 1";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, mapId);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional
public String saveComplanitStatus(
String createdBy,
String mapId,
String complaintStatus,
String complaintActionText,
MultipartFile actionPage1,
String petitionId,
String petitionNo) {
//System.out.println("I am from Service Page "+petitionerName);
//String complaintNature = "";
int lastInsertId = 0;
String sqlQuery = "INSERT INTO `petition_action_taken` "
+ "(`created_by`, `off_id`, `mapid`, `status`, "
+ "`comments`) "
+ "VALUES (?, ?, ?, ?, ?)";
try {
KeyHolder keyHolder = new GeneratedKeyHolder();
// Use JdbcTemplate's update method to execute the query with parameters
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sqlQuery, Statement.RETURN_GENERATED_KEYS);
ps.setString(1, createdBy);
ps.setString(2, createdBy);
ps.setString(3, mapId);
ps.setString(4, complaintStatus);
ps.setString(5, complaintActionText);
return ps;
}, keyHolder);
// Get the last insert ID
lastInsertId = (int)keyHolder.getKey().longValue();
String actionID = "error";
if(lastInsertId>0) {
// Update Complaint Status
updateMapComplientStatus(mapId,"close");
// Update Petition Status
updatePetitionStatus(petitionId,petitionNo);
// Add Action Scan File in the database
addActionFile(mapId,lastInsertId, actionPage1);
actionID = ""+lastInsertId;
}
return actionID; // If no exception, query executed successfully
} catch (DataAccessException e) {
// Handle exception (e.g., log error)
e.printStackTrace();
return "error"; // Query execution failed
}
}
@Transactional
public String addActionFile( String mapId, int solmapid,
MultipartFile page1) {
MultipartFile file = page1;
String fileName = "Scan1_"+solmapid;
if (file != null && !file.isEmpty()) {
try {
// Get the bytes of the file
byte[] bytes = file.getBytes();
// Set the file path where you want to save it
String uploadDirectory = environment.getProperty("file.upload.directory");
String serviceFolderName = environment.getProperty("cp_foldername");
String serviceActionFolderName = environment.getProperty("cp_action_Foldername");
uploadDirectory = uploadDirectory + serviceFolderName +"/"+ serviceActionFolderName;
// File name
fileName = mapId + "_" + fileName + "_" + file.getOriginalFilename();
//File Size
Long fileSize = file.getSize();
// File Type
String fileType = file.getContentType();
// Create directory if it doesn't exist
Path directoryPath = Paths.get(uploadDirectory);
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
String filePath = uploadDirectory + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
// Write the bytes to the file
Files.write(path, bytes);
// Save the file path to a database
String sqlQuery = "UPDATE `petition_action_taken` SET "
+ "`file_name`='"+fileName+"', "
+ "`file_size`='"+fileSize+"', "
+ "`file_type`='"+fileType+"' "
+ "WHERE `solmapid`='"+solmapid+"' LIMIT 1";
jdbcTemplate.update(sqlQuery);
} catch (IOException e) {
e.printStackTrace();
return "Failed to save file " + file.getOriginalFilename();
}
}
return "success";
}
}

58
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/PetitionMaster.java

@ -0,0 +1,58 @@
package in.gov.chennaicorporation.gccoffice.c_petition.service;
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;
@Service("CPetitionMaster")
public class PetitionMaster {
private JdbcTemplate jdbcTemplate;
@Autowired
public void setDataSource(@Qualifier("mysqlPetitionMasterDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintType(){
String SqlQuery = "";
SqlQuery = "SELECT * FROM `complaint_types` WHERE `isactive`=1 AND `isdelete`=0";
List<Map<String, Object>> result = jdbcTemplate.queryForList(SqlQuery);
return result;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getOfficerList(){
String SqlQuery = "";
SqlQuery = "SELECT * FROM `officer_master` WHERE `isactive`=1 AND `isdelete`=0";
List<Map<String, Object>> result = jdbcTemplate.queryForList(SqlQuery);
return result;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionTypes(){
String SqlQuery = "";
SqlQuery = "SELECT * FROM `petition_types` WHERE `isactive`=1 AND `isdelete`=0 ORDER BY `orderby` ASC";
List<Map<String, Object>> result = jdbcTemplate.queryForList(SqlQuery);
return result;
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.c_petition.service;

7
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java

@ -9,14 +9,13 @@ import org.springframework.web.client.RestTemplate;
@Configuration @Configuration
public class AppConfig { public class AppConfig {
public String qrAssetFeedback = "http://117.232.67.158:8063";
public String qrAssetFeedback = "http://localhost:8063";
public String mtm = "http://localhost:8060"; public String mtm = "http://localhost:8060";
public String petRegistration = "http://117.232.67.158:8061";
public String garbageCollection = "http://117.232.67.158:8067";
public String petRegistration = "http://localhost:8061";
public String garbageCollection = "http://localhost:8067"; //117.232.67.158
public String gccappsMysqlPassword = "gccroot"; public String gccappsMysqlPassword = "gccroot";
@Bean @Bean
public RestTemplate restTemplate() { public RestTemplate restTemplate() {
return new RestTemplate(); return new RestTemplate();

45
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java

@ -23,6 +23,7 @@ import java.util.Properties;
@EnableTransactionManagement @EnableTransactionManagement
public class DataSourceConfig { public class DataSourceConfig {
//////////////////////////////(For GCC APP) ////////////////////////
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
@EnableJpaRepositories( @EnableJpaRepositories(
@ -69,6 +70,7 @@ public class DataSourceConfig {
} }
} }
//////////////////////////////(For Tax Collection 1913) ////////////////////////
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
@EnableJpaRepositories( @EnableJpaRepositories(
@ -86,12 +88,7 @@ public class DataSourceConfig {
dataSource.setPassword(""); dataSource.setPassword("");
return dataSource; return dataSource;
} }
/*
@Bean(name = "mysqlTaxCollectionJdbcTemplate")
public JdbcTemplate mysqlTaxCollectionJdbcTemplate(@Qualifier("mysqlTaxCollectionDataSource") DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
*/
@Bean(name="taxEntityManagerFactory") @Bean(name="taxEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean taxEntityManagerFactory( public LocalContainerEntityManagerFactoryBean taxEntityManagerFactory(
@Qualifier("mysqlTaxCollectionDataSource") DataSource dataSource) { @Qualifier("mysqlTaxCollectionDataSource") DataSource dataSource) {
@ -112,6 +109,42 @@ public class DataSourceConfig {
} }
} }
//////////////////////////////(For Mayor Petition) ////////////////////////
@Bean(name = "mysqlMayorPetitionDataSource")
public DataSource mysqlMayorPetitionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/mayor_petition");
dataSource.setUsername("root");
dataSource.setPassword("");
return dataSource;
}
//////////////////////////////(For Petition Master) ////////////////////////
@Bean(name = "mysqlPetitionMasterDataSource")
public DataSource mysqlPetitionMasterDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/petition_master");
dataSource.setUsername("root");
dataSource.setPassword("");
return dataSource;
}
//////////////////////////////(For Councillor Petition) ////////////////////////
@Bean(name = "mysqlCouncillorPetitionDataSource")
public DataSource mysqlCouncillorPetitionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/councillor_petition");
dataSource.setUsername("root");
dataSource.setPassword("");
return dataSource;
}
////////////////////////////// ORACLE ////////////////////////
@Bean(name = "oracleDataSource") @Bean(name = "oracleDataSource")
public DataSource oracleDataSource() { public DataSource oracleDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource(); DriverManagerDataSource dataSource = new DriverManagerDataSource();

5
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java

@ -4,6 +4,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
@Configuration @Configuration
public class JacksonConfiguration { public class JacksonConfiguration {
@ -11,7 +12,9 @@ public class JacksonConfiguration {
@Bean @Bean
public ObjectMapper objectMapper() { public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); // Do not fail on empty beans during serialization
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); // Serialize dates as Strings
objectMapper.registerModule(new JavaTimeModule()); // Register JavaTimeModule for Java 8 Date/Time support
return objectMapper; return objectMapper;
} }
} }

16
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java

@ -31,7 +31,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
public void configure(WebSecurity web) throws Exception { public void configure(WebSecurity web) throws Exception {
web web
.ignoring() .ignoring()
.antMatchers("/static/**", "/assets/**", "/api/**","/images/**","/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**");
.antMatchers("/static/**", "/assets/**", "/api/**","/images/**","/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**","/gcc/files/**");
//.antMatchers("/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**"); //.antMatchers("/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**");
//.antMatchers("/assets/**", "/css/**", "/js/**", "/images/**", "/fonts/**"); // Add the paths to your static resources here //.antMatchers("/assets/**", "/css/**", "/js/**", "/images/**", "/fonts/**"); // Add the paths to your static resources here
} }
@ -52,7 +52,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/gcc/error").permitAll() .antMatchers("/gcc/error").permitAll()
.antMatchers("/gcc/login").permitAll() // Add the login URL .antMatchers("/gcc/login").permitAll() // Add the login URL
.antMatchers("/gcc/admin/**").hasRole("ADMIN") // Add the admin URLs .antMatchers("/gcc/admin/**").hasRole("ADMIN") // Add the admin URLs
.antMatchers("/gcc/**").hasAnyRole("USER", "ADMIN") // Add other URLs
.antMatchers("/gcc/**").hasAnyRole("ADMIN","USER") // Add other URLs
//.anyRequest().authenticated()
.and() .and()
.formLogin() .formLogin()
.loginPage("/gcc/login") // Customize the login page URL .loginPage("/gcc/login") // Customize the login page URL
@ -62,10 +63,21 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.logout() .logout()
.logoutUrl("/gcc/logout") // Include the logout URL .logoutUrl("/gcc/logout") // Include the logout URL
.logoutSuccessUrl("/gcc/login") // Include the success logout URL .logoutSuccessUrl("/gcc/login") // Include the success logout URL
.permitAll()
.and() .and()
.sessionManagement() .sessionManagement()
.sessionFixation() .sessionFixation()
.migrateSession(); // or .none(), .newSession() .migrateSession(); // or .none(), .newSession()
/*
// Print role values
http.authorizeRequests().anyRequest().authenticated().and().formLogin().successHandler((request, response, authentication) -> {
System.out.println("User Roles: ");
authentication.getAuthorities().forEach(authority -> System.out.println(authority.getAuthority()));
System.out.println();
response.sendRedirect("/gcc");
});
*/
} }

56
src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java

@ -1,5 +1,6 @@
package in.gov.chennaicorporation.gccoffice.controller; package in.gov.chennaicorporation.gccoffice.controller;
import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -88,6 +89,22 @@ public class APIController {
} }
// Encode to Base64
@GetMapping(value="/encodeBase64")
public static String encodeBase64(@RequestParam String string) {
String value=string;
byte[] encodedBytes = Base64.getEncoder().encode(value.getBytes());
return new String(encodedBytes);
}
// Decode from Base64
@GetMapping(value="/decodeBase64")
public static String decodeBase64(@RequestParam String string) {
String encodedValue=string;
byte[] decodedBytes = Base64.getDecoder().decode(encodedValue);
return new String(decodedBytes);
}
@GetMapping(value="/getAccessTree") @GetMapping(value="/getAccessTree")
public String getAccessTreeHTML(@RequestParam String groupId,@RequestParam String groupName) { public String getAccessTreeHTML(@RequestParam String groupId,@RequestParam String groupName) {
@ -228,6 +245,43 @@ public class APIController {
return ""; return "";
} }
@GetMapping(value="/getUserProfileBasic")
public String getUserProfileBasic(@RequestParam String userId) {
String userHtml ="";
String userProfileHtml ="";
String userProfileTimelineHtml ="";
getAppUserEntities = appUserRepository.showById(userId);
for (AppUserEntity appUserEntity : getAppUserEntities) {
userProfileHtml = ""
+ " "
+ " <div class='card mb-1'>"
+ " <div class='card-body'>"
+ " <div class='text-center'>"
+ " <img src='/assets/images/users/user.jpg' class='rounded' width='150'>\n"
+ " <h4 class='card-title mt-10'>"+appUserEntity.getUserid().getName()+"</h4>\n"
+ " <p class='text-muted'>Front End Developer</p>\n"
+ " </div>\n"
+ " </div>"
+ " <hr class='mb-0 mt-0'> \n"
+ " <div class='card-body'> \n"
+ " <small class='text-muted d-block'>Email address </small>\n"
+ " <h8>"+appUserEntity.getUserid().getEmail()+"</h8> \n"
+ " <small class='text-muted d-block pt-10'>Phone</small>\n"
+ " <h8>"+appUserEntity.getUserid().getPhone()+"</h8> \n"
+ " <small class='text-muted d-block pt-10'>Role</small>\n"
+ " <h8>"+appUserEntity.getRoles()+"</h8>\n"
+ " <small class='text-muted d-block pt-10'>Access Group</small>\n"
+ " <h8>"+appUserEntity.getUsergroup_id().getName()+"</h8>\n"
+ " </div>\n"
+ " </div>\n"
+ " ";
}
return userProfileHtml;
}
@GetMapping(value="/getUserProfile") @GetMapping(value="/getUserProfile")
public String getUserProfile(@RequestParam String userId) { public String getUserProfile(@RequestParam String userId) {
String userHtml =""; String userHtml ="";
@ -334,4 +388,6 @@ public class APIController {
//System.out.println(formattedTimestamp); //System.out.println(formattedTimestamp);
return formattedTimestamp.toUpperCase(); return formattedTimestamp.toUpperCase();
} }
} }

73
src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java

@ -0,0 +1,73 @@
package in.gov.chennaicorporation.gccoffice.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.HandlerMapping;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.servlet.http.HttpServletRequest;
@Controller
public class FileController {
@Value("${file.upload.directory}")
private String uploadDirectory;
@GetMapping("/gcc/files/{directoryPath}/**")
public ResponseEntity<Resource> serveFile(@PathVariable String directoryPath, HttpServletRequest request) {
String fullPath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
System.out.println(fullPath.toString()+"\n"+directoryPath.length()+"\n directoryPath:"+directoryPath);
//String relativePath = fullPath.substring(directoryPath.length() + 1); // Adding 1 for the trailing '/'
String relativePath = fullPath.replace("/gcc/files", "");
String filePath = uploadDirectory + "/" + relativePath;
Path path = Paths.get(filePath).normalize();
System.out.println(path.toString());
Resource resource;
try {
resource = new UrlResource(path.toUri());
if (resource.exists() || resource.isReadable()) {
MediaType mediaType = MediaType.APPLICATION_OCTET_STREAM;
// Determine content type based on file extension
String fileName = resource.getFilename();
if (fileName != null) {
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
switch (fileExtension.toLowerCase()) {
case "jpg":
case "jpeg":
mediaType = MediaType.IMAGE_JPEG;
break;
case "png":
mediaType = MediaType.IMAGE_PNG;
break;
case "gif":
mediaType = MediaType.IMAGE_GIF;
break;
case "pdf":
mediaType = MediaType.APPLICATION_PDF;
break;
// Add more cases for other file types if needed
}
}
return ResponseEntity.ok()
.contentType(mediaType)
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + resource.getFilename() + "\"")
//.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"")
.body(resource);
} else {
return ResponseEntity.notFound().build();
}
} catch (Exception e) {
return ResponseEntity.notFound().build();
}
}
}

7
src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java

@ -20,10 +20,11 @@ public class MainController {
@GetMapping({"", "/", "/index"}) @GetMapping({"", "/", "/index"})
public String main(Model model) { public String main(Model model) {
String userId = LoginUserInfo.getLoginUserId();
if (userId != null && !userId.isEmpty()) {
System.out.println("String UserID: " + userId);
String LoginUserId = LoginUserInfo.getLoginUserId();
if (LoginUserId != null && !LoginUserId.isEmpty()) {
System.out.println("String UserID: " + LoginUserId);
} }
model.addAttribute("LoginUserId",LoginUserId);
return "index"; return "index";
} }

35
src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java

@ -100,7 +100,7 @@ public class AppInterceptor implements HandlerInterceptor {
private boolean hasModuleAccess(String moduleName) { private boolean hasModuleAccess(String moduleName) {
getAppModuleEntities = appModuleRepository.findByModulePath(moduleName); getAppModuleEntities = appModuleRepository.findByModulePath(moduleName);
System.out.println("DataTable Size for the url ("+moduleName+"): "+getAppModuleEntities.size());
//System.out.println("DataTable Size for the url ("+moduleName+"): "+getAppModuleEntities.size());
String moduleid = null; String moduleid = null;
@ -112,6 +112,7 @@ public class AppInterceptor implements HandlerInterceptor {
String userGroupId = LoginUserInfo.getUserGroupId(); String userGroupId = LoginUserInfo.getUserGroupId();
System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid); System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid);
getAppModuleAccessEntities = appModuleAccessRepository.findByAll(userGroupId,moduleid); getAppModuleAccessEntities = appModuleAccessRepository.findByAll(userGroupId,moduleid);
//System.out.println("After Check in(hasModuleAccess):"+getAppModuleAccessEntities.size());
if(getAppModuleAccessEntities.size()>0) { if(getAppModuleAccessEntities.size()>0) {
return true; return true;
} }
@ -125,7 +126,7 @@ public class AppInterceptor implements HandlerInterceptor {
if(!hasModuleAccess(moduleName)) {return false; } if(!hasModuleAccess(moduleName)) {return false; }
getMenuItemEntities = menuItemRepository.findByUrl(url); getMenuItemEntities = menuItemRepository.findByUrl(url);
System.out.println("DataTable Size for the url ("+url+"): "+getMenuItemEntities.size());
//System.out.println("DataTable Size for the url ("+url+"): "+getMenuItemEntities.size());
String moduleid = null; String moduleid = null;
String menuid = null; String menuid = null;
@ -137,7 +138,7 @@ public class AppInterceptor implements HandlerInterceptor {
} }
if(moduleid != null && menuid != null) { if(moduleid != null && menuid != null) {
String userGroupId = LoginUserInfo.getUserGroupId(); String userGroupId = LoginUserInfo.getUserGroupId();
System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid);
//System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid);
getMenuItemAccessEntities = menuItemAccessRepository.findByAll(userGroupId,moduleid,menuid); getMenuItemAccessEntities = menuItemAccessRepository.findByAll(userGroupId,moduleid,menuid);
if(getMenuItemAccessEntities.size()>0) { if(getMenuItemAccessEntities.size()>0) {
return true; return true;
@ -152,7 +153,7 @@ public class AppInterceptor implements HandlerInterceptor {
if(!hasModuleAccess(moduleName)) {return false; } if(!hasModuleAccess(moduleName)) {return false; }
getSubMenuItemEntities = subMenuItemRepository.findByUrl(url); getSubMenuItemEntities = subMenuItemRepository.findByUrl(url);
System.out.println("DataTable Size for the url ("+url+"): "+getSubMenuItemEntities.size());
//System.out.println("DataTable Size for the url ("+url+"): "+getSubMenuItemEntities.size());
String moduleid = null; String moduleid = null;
String menuid = null; String menuid = null;
@ -166,12 +167,12 @@ public class AppInterceptor implements HandlerInterceptor {
} }
if(moduleid != null && menuid != null && submenuid != null) { if(moduleid != null && menuid != null && submenuid != null) {
String userGroupId = LoginUserInfo.getUserGroupId(); String userGroupId = LoginUserInfo.getUserGroupId();
System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid+"\n submenuid : "+submenuid);
//System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid+"\n submenuid : "+submenuid);
getSubMenuItemAccessEntities = subMenuItemAccessRepository.findByAll(userGroupId,moduleid,menuid,submenuid); getSubMenuItemAccessEntities = subMenuItemAccessRepository.findByAll(userGroupId,moduleid,menuid,submenuid);
if(getSubMenuItemAccessEntities.size()>0) { if(getSubMenuItemAccessEntities.size()>0) {
// Check Parent Menu Access (Menu Access) // Check Parent Menu Access (Menu Access)
if(moduleid != null && menuid != null) { if(moduleid != null && menuid != null) {
System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid);
//System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid);
getMenuItemAccessEntities = menuItemAccessRepository.findByAll(userGroupId,moduleid,menuid); getMenuItemAccessEntities = menuItemAccessRepository.findByAll(userGroupId,moduleid,menuid);
if(getMenuItemAccessEntities.size()>0) { if(getMenuItemAccessEntities.size()>0) {
return true; return true;
@ -186,9 +187,11 @@ public class AppInterceptor implements HandlerInterceptor {
private boolean hasAccess(String path) { private boolean hasAccess(String path) {
String userRole = LoginUserInfo.getUserRole(); String userRole = LoginUserInfo.getUserRole();
if (userRole != null && userRole.equals("ADMIN")) { if (userRole != null && userRole.equals("ADMIN")) {
return true; return true;
} }
/* /*
if(LoginUserInfo.getUserRole().equals("ADMIN")) { if(LoginUserInfo.getUserRole().equals("ADMIN")) {
return true; return true;
@ -196,7 +199,9 @@ public class AppInterceptor implements HandlerInterceptor {
*/ */
String url = removeLeadingSlash(path); String url = removeLeadingSlash(path);
System.out.println("Give URL : "+path+" After remove leading slash : "+url);
url = removeStartingString(url); // Remove parent App url "gcc"
//System.out.println("Give URL : "+path+" After remove leading slash : "+url);
// If default home page // If default home page
if(path.equals("/")) { if(path.equals("/")) {
@ -208,7 +213,7 @@ public class AppInterceptor implements HandlerInterceptor {
if(parts.length<=0) {return true;} if(parts.length<=0) {return true;}
System.out.println(parts.length);
//System.out.println("Part Length:"+ parts.length);
if(parts.length>1) { if(parts.length>1) {
int j=0; int j=0;
@ -219,8 +224,9 @@ public class AppInterceptor implements HandlerInterceptor {
String moduleName = ""; String moduleName = "";
String menuName = ""; String menuName = "";
String subMenuName = ""; String subMenuName = "";
if(parts.length==2) { // Check Only Module Access
moduleName = parts[1];
if(parts.length==1) { // Check Only Module Access
moduleName = parts[0];
return hasModuleAccess(moduleName); return hasModuleAccess(moduleName);
} }
else if(parts.length==2) { // Check Module & Menu Access else if(parts.length==2) { // Check Module & Menu Access
@ -237,7 +243,7 @@ public class AppInterceptor implements HandlerInterceptor {
} }
} }
return false;
return true;
} }
public static String removeLeadingSlash(String input) { public static String removeLeadingSlash(String input) {
@ -247,6 +253,13 @@ public class AppInterceptor implements HandlerInterceptor {
return input; return input;
} }
public static String removeStartingString(String input) {
if (input.startsWith("gcc")) {
return removeLeadingSlash(input.substring(3));
}
return input;
}
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String assetsBaseUrl = environment.getProperty("assets.base-url"); String assetsBaseUrl = environment.getProperty("assets.base-url");

156
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java

@ -0,0 +1,156 @@
package in.gov.chennaicorporation.gccoffice.m_petition.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.m_petition.service.Petition;
import in.gov.chennaicorporation.gccoffice.m_petition.service.PetitionMaster;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("gcc/api/m_petition")
@RestController("mpRest") // Mayor Petition Rest
public class APIController {
private PetitionMaster petitionMaster;
private Petition petition;
@Autowired
public APIController(PetitionMaster petitionMaster,Petition petition) {
this.petitionMaster = petitionMaster;
this.petition = petition;
}
@GetMapping(value="/getComplaintTypes")
public List getComplaintTypeList() {
return petitionMaster.getComplaintType();
}
@GetMapping(value="/getOfficerList")
public List getOfficerList() {
return petitionMaster.getOfficerList();
}
@GetMapping(value="/getPetitionTypes")
public List getPetitionTypes() {
return petitionMaster.getPetitionTypes();
}
@GetMapping(value="/getPetitionList")
public List getPetitionList() {
return petition.getPetitionList();
}
@GetMapping(value="/getUnmapPetitionList")
public List getUnmapPetitionList() {
return petition.getUnmapPetitionList();
}
@GetMapping(value="/getPetitionDetails")
public List getPetitionDetails(@RequestParam("petitionNo") String petitionNo) {
return petition.getPetitionDetails(petitionNo);
}
@PostMapping(value="/savePetition")
public String savePetition(
@RequestParam("createdBy") String createdBy,
@RequestParam("petitionType") String petitionType,
@RequestParam("petitionerName") String petitionerName,
@RequestParam("petitionerMobile") String petitionerMobile,
@RequestParam("complaintType") String petitionerComplaint,
@RequestParam("san_page1") MultipartFile page1,
@RequestParam("san_page2") MultipartFile page2,
@RequestParam("san_page3") MultipartFile page3,
@RequestParam("san_page4") MultipartFile page4) {
return petition.savePetition(petitionType, createdBy, petitionerName, petitionerMobile, petitionerComplaint, page1, page2, page3, page4);
}
@PostMapping(value="/updatePetition")
public Boolean updatePetition(
@RequestParam("petitionType") String petitionType,
@RequestParam("petitionNo") String petitionNo,
@RequestParam("createdBy") String createdBy,
@RequestParam("petitionerName") String petitionerName,
@RequestParam("petitionerMobile") String petitionerMobile,
@RequestParam("petitionerAddress") String petitionerAddress,
@RequestParam("petitionerPincode") String petitionerPincode,
@RequestParam("complaintType") String petitionerComplaint,
@RequestParam("complaintNature") String complaintNature) {
return petition.updatePetition(petitionNo, petitionType, createdBy, petitionerName, petitionerMobile, petitionerAddress, petitionerPincode, petitionerComplaint, complaintNature);
}
@PostMapping(value="/mapComplientToOfficer")
public Boolean updatePetition(
@RequestParam("petitionId") String petitionId,
@RequestParam("petitionNo") String petitionNo,
@RequestParam("createdBy") String createdBy,
@RequestParam(value = "", required = false) String mapOfficers) {
String com_mapping = mapOfficers;
// First before Mapping need to unmaps old list
petition.unmapComplient(petitionId, petitionNo);
if(com_mapping!=null) {
String[] com_mapping_parts = com_mapping.split(",");
for (String values : com_mapping_parts) {
String[] com_mapping_val = values.split("_");
if (com_mapping_val.length > 0) {
String complientId = com_mapping_val[0];
String offcierId = com_mapping_val[1];
petition.mapComplientToOfficer(createdBy, petitionId, petitionNo, complientId, offcierId);
}
}
}
return true;
}
@GetMapping(value="/getComplaintMappingDetails")
public List getComplaintMappingDetails(
@RequestParam("petitionId") String petitionId,
@RequestParam("petitionNo") String petitionNo,
@RequestParam("complaintTypeId") String complaintTypeId) {
return petition.getComplaintMappingDetails(petitionNo,petitionId,complaintTypeId);
}
@GetMapping(value="/getComplaintList")
public List getComplaintList() {
return petition.getComplaintList();
}
@GetMapping(value="/getComplaintListByPetitionId")
public List getComplaintList(@RequestParam("petitionId") String petitionId) {
return petition.getComplaintListByPetitionId(petitionId);
}
@GetMapping(value="/getComplaintDetails")
public List<?> getComplaintDetails(@RequestParam("mapId") String mapId) {
return petition.getComplaintDetails(mapId);
}
@GetMapping(value="/getComplaintActionDetails")
public List<?> getComplaintActionDetails(@RequestParam("mapId") String mapId) {
return petition.getComplaintActionDetails(mapId);
}
@PostMapping(value="/saveComplanitStatus")
public String saveComplanitStatus(
@RequestParam("createdBy") String createdBy,
@RequestParam("mapId") String mapId,
@RequestParam("complaintStatus") String complaintStatus,
@RequestParam("complaintActionText") String complaintActionText,
@RequestParam("action_san_page1") MultipartFile actionPage1,
@RequestParam("petitionId") String petitionId,
@RequestParam("petitionNo") String petitionNo) {
return petition.saveComplanitStatus(createdBy, mapId, complaintStatus, complaintActionText, actionPage1, petitionId, petitionNo);
}
}

130
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java

@ -0,0 +1,130 @@
package in.gov.chennaicorporation.gccoffice.m_petition.controller;
import org.hibernate.hql.internal.ast.tree.RestrictableStatement;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import in.gov.chennaicorporation.gccoffice.service.Base64Util;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("/gcc/m_petition")
@Controller("MayorPetitionController")
public class MainController {
private final RestTemplate restTemplate;
private String BasePath = "modules/m_petition/";
@Autowired
public MainController(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
@GetMapping({"", "/", "/index", "/dashboard"})
public String dashboard(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"index";
}
@GetMapping({"/new_petition"})
public String newPetition(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"new_petition";
}
@GetMapping("/petition-ack/{petitionNo}")
public String petitionAck(Model model,@PathVariable("petitionNo") String petitionNo) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_ack";
}
@GetMapping("/petition-list")
public String petitionList(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"petition_list";
}
@GetMapping("/unmapped-petition-list")
public String unMappedPetitionList(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"petition_not_mapped_list";
}
@GetMapping("/update-petition")
public String petitionUpadte(Model model,@RequestParam(value="petitionNo", required = false) String petitionNo) {
if (petitionNo != null && !petitionNo.isEmpty()) {
// Decrypt the encrypted value
petitionNo = Base64Util.decodeBase64(petitionNo);
}
else {
petitionNo = null;
}
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_update";
}
@GetMapping("/view-petition")
public String petitionView(Model model,@RequestParam(value="petitionNo", required = false) String petitionNo) {
if (petitionNo != null && !petitionNo.isEmpty()) {
// Decrypt the encrypted value
petitionNo = Base64Util.decodeBase64(petitionNo);
}
else {
petitionNo = null;
}
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_view";
}
@GetMapping("/view-petition-modal")
public String petitionViewModal(Model model,@RequestParam(value="petitionNo", required = false) String petitionNo) {
if (petitionNo != null && !petitionNo.isEmpty()) {
// Decrypt the encrypted value
petitionNo = Base64Util.decodeBase64(petitionNo);
}
else {
petitionNo = null;
}
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_view_modal_page";
}
@GetMapping("/search-petition")
public String petitionSearch(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
//model.addAttribute("petitionNo",petitionNo);
return BasePath+"petition_update";
}
@GetMapping("/complaint-list")
public String complaintList(Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
return BasePath+"complaint_list";
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.m_petition.controller;

21
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/data/ComplaintType.java

@ -0,0 +1,21 @@
package in.gov.chennaicorporation.gccoffice.m_petition.data;
import java.util.Map;
public class ComplaintType {
private int complaintTypeId;
private String complaintType;
public ComplaintType(Map<String, Object> map) {
this.complaintTypeId = (int) map.get("complaint_typeid");
this.complaintType = (String) map.get("complaint_type");
}
public int getComplaintTypeId() {
return complaintTypeId;
}
public String getComplaintType() {
return complaintType;
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/data/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.m_petition.data;

1
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/entity/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.m_petition.entity;

7
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/package-info.java

@ -0,0 +1,7 @@
/**
*
*/
/**
*
*/
package in.gov.chennaicorporation.gccoffice.m_petition;

1
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/repository/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.m_petition.repository;

671
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java

@ -0,0 +1,671 @@
package in.gov.chennaicorporation.gccoffice.m_petition.service;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.sql.DataSource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import in.gov.chennaicorporation.gccoffice.m_petition.data.ComplaintType;
import in.gov.chennaicorporation.gccoffice.service.Base64Util;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
@Service
public class Petition {
private JdbcTemplate jdbcTemplate;
private final Environment environment;
private PetitionMaster petitionMaster;
@Autowired
public Petition(Environment environment,PetitionMaster petitionMaster) {
this.environment = environment;
this.petitionMaster = petitionMaster;
}
@Autowired
public void setDataSource(@Qualifier("mysqlMayorPetitionDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Transactional(readOnly = true)
public List getComplaintTypeList() {
return petitionMaster.getComplaintType();
}
@Transactional(readOnly = true)
public static List<ComplaintType> convertToComplaintTypes(List<Map<String, Object>> complaintTypeMaps) {
return complaintTypeMaps.stream()
.map(ComplaintType::new)
.collect(Collectors.toList());
}
@Transactional(readOnly = true)
// Method to map complaint type IDs to their respective complaint types
public static String mapComplaintTypes(List<ComplaintType> complaintTypes, String complaint) {
String[] complaintIds = complaint.split(",");
StringBuilder complaintTxtBuilder = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
for (ComplaintType type : complaintTypes) {
if (type.getComplaintTypeId() == id) {
if (complaintTxtBuilder.length() > 0) {
complaintTxtBuilder.append(",");
}
complaintTxtBuilder.append(type.getComplaintType());
break;
}
}
}
return complaintTxtBuilder.toString();
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionList() {
try {
String sqlQuery = "SELECT * FROM petition WHERE (`isactive`=1 AND `isdelete`=0)";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
Base64Util.encodeBase64(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getUnmapPetitionList() {
try {
String sqlQuery = "SELECT "
+ " p.* "
+ "FROM "
+ " `petition` p "
+ "WHERE "
+ " p.`isactive` = 1 AND p.`isdelete` = 0 "
+ " AND NOT EXISTS ("
+ " SELECT 1 "
+ " FROM `petition_mapping` pm "
+ " WHERE (p.`petition_id` = pm.`petition_id`) AND (pm.`isactive` = 1 AND pm.`isdelete` = 0 ) "
+ " )";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionDetails(String petitionNo) {
try {
String sqlQuery = "SELECT * FROM petition WHERE petition_no = ? AND (`isactive`=1 AND `isdelete`=0) LIMIT 1";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, petitionNo);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional
public String savePetition(
String petitionType,
String createdBy,
String petitionerName,
String petitionerMobile,
String petitionerComplaint,
MultipartFile page1,
MultipartFile page2,
MultipartFile page3,
MultipartFile page4) {
//System.out.println("I am from Service Page "+petitionerName);
//String complaintNature = "";
int lastInsertId = 0;
String sqlQuery = "INSERT INTO `petition` "
+ "(`petition_type`,`created_by`, `petitioner_name`, `petitioner_mobile`, "
+ "`petitioner_complaint`, `petitioner_complaint_txt`) "
+ "VALUES (?, ?, ?, ?, ?, ?)";
try {
// Complaint Type List
List complaintTypelist = getComplaintTypeList();
// Convert the list of maps to a list of ComplaintType objects
List<ComplaintType> complaintTypes = convertToComplaintTypes(complaintTypelist);
// Map complaint types
String petitionerComplaint_txt = mapComplaintTypes(complaintTypes, petitionerComplaint);
KeyHolder keyHolder = new GeneratedKeyHolder();
// Use JdbcTemplate's update method to execute the query with parameters
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sqlQuery, Statement.RETURN_GENERATED_KEYS);
ps.setString(1, petitionType);
ps.setString(2, createdBy);
ps.setString(3, petitionerName);
ps.setString(4, petitionerMobile);
ps.setString(5, petitionerComplaint);
ps.setString(6, petitionerComplaint_txt);
return ps;
}, keyHolder);
// Get the last insert ID
lastInsertId = (int) keyHolder.getKey().longValue();
// Get the value of mp_ackno from application.properties
String ackno = environment.getProperty("mp_ackno");
String ackno_prefix = environment.getProperty("mp_ackno_prefix");
// Convert ackno to int if needed
int acknoInt = Integer.parseInt(ackno);
// Calculate the petition number
int petitionNo = (int) (lastInsertId + acknoInt);
// Construct the petition number string
String petitionNoString = ackno_prefix + petitionNo;
// Update the petition number in the database
updatePetitionNumber(lastInsertId, petitionNoString);
// Add Petition Scan File in the database
addPetitionFile(createdBy,lastInsertId, petitionNoString, page1, page2, page3, page4);
return petitionNoString; // If no exception, query executed successfully
} catch (DataAccessException e) {
// Handle exception (e.g., log error)
e.printStackTrace();
return "error"; // Query execution failed
}
}
@Transactional
public boolean updatePetitionNumber(int petitionId,String petitionNoString) {
String sqlQuery = "UPDATE `petition` SET `petition_no`='"+petitionNoString+"' WHERE `petition_id`='"+petitionId+"'";
jdbcTemplate.update(sqlQuery);
return true;
}
@Transactional
public String addPetitionFile(String createdBy,
int petitionId,
String petitionNoString,
MultipartFile page1,
MultipartFile page2,
MultipartFile page3,
MultipartFile page4) {
String fileName="";
for (int i = 1; i <= 4; i++) {
MultipartFile file = null;
switch (i) {
case 1:
file = page1;
fileName = "Scan1";
break;
case 2:
file = page2;
fileName = "Scan2";
break;
case 3:
file = page3;
fileName = "Scan3";
break;
case 4:
file = page4;
fileName = "Scan4";
break;
}
if (file != null && !file.isEmpty()) {
try {
// Get the bytes of the file
byte[] bytes = file.getBytes();
// Set the file path where you want to save it
String uploadDirectory = environment.getProperty("file.upload.directory");
String serviceFolderName = environment.getProperty("mp_foldername");
uploadDirectory = uploadDirectory + serviceFolderName;
// File name
fileName = petitionId + "_" + fileName + "_" + petitionNoString + "_" + file.getOriginalFilename();
//File Size
Long fileSize = file.getSize();
// File Type
String fileType = file.getContentType();
// Create directory if it doesn't exist
Path directoryPath = Paths.get(uploadDirectory);
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
String filePath = uploadDirectory + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
// Write the bytes to the file
Files.write(path, bytes);
// Save the file path to a database
String sqlQuery = "INSERT INTO `pentition_files`(`created_by`, `file_name`, `file_size`, `file_type`, `petition_no`, `petition_id`) "
+ "VALUES ('"+createdBy+"','"+fileName+"','"+fileSize+"','"+fileType+"','"+petitionNoString+"','"+petitionId+"')";
jdbcTemplate.update(sqlQuery);
} catch (IOException e) {
e.printStackTrace();
return "Failed to save file " + file.getOriginalFilename();
}
}
}
return "success";
}
@Transactional
public boolean updatePetition(
String petitionNo,
String petitionType,
String createdBy,
String petitionerName,
String petitionerMobile,
String petitionerAddress,
String petitionerPincode,
String petitionerComplaint,
String complaintNature) {
try {
// Complaint Type List
List complaintTypelist = getComplaintTypeList();
// Convert the list of maps to a list of ComplaintType objects
List<ComplaintType> complaintTypes = convertToComplaintTypes(complaintTypelist);
// Map complaint types
String petitionerComplaint_txt = mapComplaintTypes(complaintTypes, petitionerComplaint);
String sqlQuery = "UPDATE `petition` SET "
+ "`petition_type`='"+petitionType+"', `created_by`='"+createdBy+"', `petitioner_name`='"+petitionerName+"', `petitioner_mobile`='"+petitionerMobile+"', "
+ "`petitioner_address`='"+petitionerAddress+"', `petitioner_pincode`='"+petitionerPincode+"',"
+ "`petitioner_complaint`='"+petitionerComplaint+"', `petitioner_complaint_txt`='"+petitionerComplaint_txt+"', `complaint_nature`='"+complaintNature+"' "
+ "WHERE (`petition_no`='"+petitionNo+"') LIMIT 1";
System.out.println(sqlQuery);
// Use JdbcTemplate's update method to execute the query with parameters
jdbcTemplate.update(sqlQuery);
// Add Petition Scan File in the database
//addPetitionFile(createdBy,lastInsertId, petitionNoString, page1, page2, page3, page4);
return true; // If no exception, query executed successfully
} catch (DataAccessException e) {
// Handle exception (e.g., log error)
e.printStackTrace();
return false; // Query execution failed
}
}
@Transactional
public boolean updatePetitionStatus(String petitionId,String petitionNo) {
String status_value = "close";
List<Map<String, Object>> petitionMappingDetails = getPetitionMappingDetails(petitionNo, petitionId);
for (Map<String, Object> mapping : petitionMappingDetails) {
// Access values from the map using keys
Object status = mapping.get("status");
// Check if status is "close"
if (!"close".equals(status)) {
status_value = "partial";
}
}
String sqlQuery = "UPDATE `petition` SET `status`='"+status_value+"' WHERE `petition_no`='"+petitionNo+"' AND `petition_id`='"+petitionId+"' LIMIT 1";
jdbcTemplate.update(sqlQuery);
System.out.println(sqlQuery);
return true;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionMappingDetails(String petitionNo, String petitionId) {
try {
String sqlQuery = "SELECT * FROM petition_mapping WHERE (`petition_id`= ? AND petition_no = ?) AND (`isactive`=1 AND `isdelete`=0)";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, petitionId, petitionNo);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional
public boolean unmapComplient(String petitionId, String petitionNo) {
String sqlQuery = "UPDATE `petition_mapping` SET `isactive`='0',`isdelete`='1' WHERE `petition_id`='"+petitionId+"' AND `petition_no`='"+petitionNo+"'";
jdbcTemplate.update(sqlQuery);
return true;
}
@Transactional
public boolean mapComplientToOfficer(
String createdBy, String petitionId, String petitionNo, String complaintId, String officerId) {
String sqlQuery = "INSERT INTO `petition_mapping`"
+ "(`created_by`, `off_id`, `petition_no`, `complaint_typeid`, `petition_id`) "
+ "VALUES (?, ?, ?, ?, ?)";
jdbcTemplate.update(sqlQuery, createdBy, officerId, petitionNo, complaintId, petitionId);
return true;
}
@Transactional
public boolean updateMapComplientStatus(String mapId,String status) {
String sqlQuery = "UPDATE `petition_mapping` SET `status`=? WHERE `mapid`=? LIMIT 1";
jdbcTemplate.update(sqlQuery, status, mapId);
System.out.println(sqlQuery);
return true;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintMappingDetails(String petitionNo, String petitionId, String complaintTypeId) {
try {
String sqlQuery = "SELECT * FROM petition_mapping WHERE (`petition_id`= ? AND petition_no = ?) AND `complaint_typeid`= ? AND (`isactive`=1 AND `isdelete`=0) LIMIT 1";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, petitionId, petitionNo,complaintTypeId);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintList() {
try {
String sqlQuery = "SELECT "
+ " p.`petition_id`, p.`cdate`, p.`created_by`, p.`isactive`, p.`isdelete`, p.`petition_no`, "
+ " p.`petitioner_address`, p.`petitioner_complaint`, p.`petitioner_complaint_txt`, "
+ " p.`petitioner_mobile`, p.`petitioner_name`, p.`complaint_nature`, p.`petitioner_pincode`, "
+ " pm.`mapid`, pm.`complaint_typeid`, pm.`off_id`, pm.`status`, om.`off_nm`, ctype.`complaint_type` "
+ " FROM "
+ " `petition` p, `petition_mapping` pm, `petition_master`.`officer_master` om, `petition_master`.`complaint_types` ctype "
+ " WHERE "
+ " (p.`isactive` = 1 AND p.`isdelete` = 0) "
+ " AND (pm.`isactive` = 1 AND pm.`isdelete` = 0) "
+ " AND (om.`isactive` = 1 AND om.`isdelete` = 0) "
+ " AND (om.`off_id` = pm.`off_id`) "
+ " AND (ctype.`complaint_typeid` = pm.`complaint_typeid`) "
+ " AND (p.`petition_id` = pm.`petition_id`)"
+ " ";
System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintListByPetitionId(String petitionId) {
try {
String sqlQuery = "SELECT "
+ " p.`petition_id`, p.`cdate`, p.`created_by`, p.`isactive`, p.`isdelete`, p.`petition_no`, "
+ " p.`petitioner_address`, p.`petitioner_complaint`, p.`petitioner_complaint_txt`, "
+ " p.`petitioner_mobile`, p.`petitioner_name`, p.`complaint_nature`, p.`petitioner_pincode`, p.`status` petition_status, "
+ " pm.`mapid`, pm.`complaint_typeid`, pm.`off_id`, pm.`status` complaint_status, pm.`cdate` mappedOn, om.`off_nm`, ctype.`complaint_type` "
+ " FROM "
+ " `mayor_petition`.`petition` p,`mayor_petition`.`petition_mapping` pm, `petition_master`.`officer_master` om, `petition_master`.`complaint_types` ctype "
+ " WHERE "
+ " (p.`petition_id` = '"+petitionId+"' AND p.`isactive` = 1 AND p.`isdelete` = 0) "
+ " AND (pm.`isactive` = 1 AND pm.`isdelete` = 0) "
+ " AND (om.`isactive` = 1 AND om.`isdelete` = 0) "
+ " AND (om.`off_id` = pm.`off_id`) "
+ " AND (ctype.`complaint_typeid` = pm.`complaint_typeid`) "
+ " AND (p.`petition_id` = pm.`petition_id`)"
+ " ";
System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintDetails(String mapid) {
try {
String sqlQuery = "SELECT "
+ " p.`petition_id`, p.`cdate`, p.`created_by`, p.`isactive`, p.`isdelete`, p.`petition_no`, "
+ " p.`petitioner_address`, p.`petitioner_complaint`, p.`petitioner_complaint_txt`, "
+ " p.`petitioner_mobile`, p.`petitioner_name`, p.`complaint_nature`, p.`petitioner_pincode`, "
+ " pm.`mapid`, pm.`complaint_typeid`, pm.`off_id`, pm.`status`, om.`off_nm`, ctype.`complaint_type` "
+ " FROM "
+ " `petition` p,`petition_mapping` pm, `petition_master`.`officer_master` om, `petition_master`.`complaint_types` ctype "
+ " WHERE "
+ " pm.`mapid`='"+mapid+"' "
+ " AND (p.`isactive` = 1 AND p.`isdelete` = 0) "
+ " AND (pm.`isactive` = 1 AND pm.`isdelete` = 0) "
+ " AND (om.`isactive` = 1 AND om.`isdelete` = 0) "
+ " AND (om.`off_id` = pm.`off_id`) "
+ " AND (ctype.`complaint_typeid` = pm.`complaint_typeid`) "
+ " AND (p.`petition_id` = pm.`petition_id`)"
+ " ";
//System.out.println(sqlQuery);
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery);
// Iterate over the list of maps
for (Map<String, Object> map : result) {
// Get the value of the 'petitionNo' field from the map
String petitionNo = (String) map.get("petition_no");
// Encode the 'petitionNo' value using Base64Util
String petitionNoEncoded = Base64Util.encodeBase64(petitionNo);
// Add the encoded value as 'petitionNoEncode' to the map
map.put("petitionNoEncode", petitionNoEncoded);
}
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintActionDetails(String mapId) {
try {
String sqlQuery = "SELECT * FROM `petition_action_taken` WHERE (`mapid`= ? AND `isactive`=1 AND `isdelete`=0) LIMIT 1";
List<Map<String, Object>> result = jdbcTemplate.queryForList(sqlQuery, mapId);
return result;
} catch (DataAccessException e) {
e.printStackTrace();
return null; // Return null or handle error appropriately
}
}
@Transactional
public String saveComplanitStatus(
String createdBy,
String mapId,
String complaintStatus,
String complaintActionText,
MultipartFile actionPage1,
String petitionId,
String petitionNo) {
//System.out.println("I am from Service Page "+petitionerName);
//String complaintNature = "";
int lastInsertId = 0;
String sqlQuery = "INSERT INTO `petition_action_taken` "
+ "(`created_by`, `off_id`, `mapid`, `status`, "
+ "`comments`) "
+ "VALUES (?, ?, ?, ?, ?)";
try {
KeyHolder keyHolder = new GeneratedKeyHolder();
// Use JdbcTemplate's update method to execute the query with parameters
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sqlQuery, Statement.RETURN_GENERATED_KEYS);
ps.setString(1, createdBy);
ps.setString(2, createdBy);
ps.setString(3, mapId);
ps.setString(4, complaintStatus);
ps.setString(5, complaintActionText);
return ps;
}, keyHolder);
// Get the last insert ID
lastInsertId = (int)keyHolder.getKey().longValue();
String actionID = "error";
if(lastInsertId>0) {
// Update Complaint Status
updateMapComplientStatus(mapId,"close");
// Update Petition Status
updatePetitionStatus(petitionId,petitionNo);
// Add Action Scan File in the database
addActionFile(mapId,lastInsertId, actionPage1);
actionID = ""+lastInsertId;
}
return actionID; // If no exception, query executed successfully
} catch (DataAccessException e) {
// Handle exception (e.g., log error)
e.printStackTrace();
return "error"; // Query execution failed
}
}
@Transactional
public String addActionFile( String mapId, int solmapid,
MultipartFile page1) {
MultipartFile file = page1;
String fileName = "Scan1_"+solmapid;
if (file != null && !file.isEmpty()) {
try {
// Get the bytes of the file
byte[] bytes = file.getBytes();
// Set the file path where you want to save it
String uploadDirectory = environment.getProperty("file.upload.directory");
String serviceFolderName = environment.getProperty("mp_foldername");
String serviceActionFolderName = environment.getProperty("mp_action_Foldername");
uploadDirectory = uploadDirectory + serviceFolderName +"/"+ serviceActionFolderName;
// File name
fileName = mapId + "_" + fileName + "_" + file.getOriginalFilename();
//File Size
Long fileSize = file.getSize();
// File Type
String fileType = file.getContentType();
// Create directory if it doesn't exist
Path directoryPath = Paths.get(uploadDirectory);
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
String filePath = uploadDirectory + "/" + fileName;
// Create a new Path object
Path path = Paths.get(filePath);
// Write the bytes to the file
Files.write(path, bytes);
// Save the file path to a database
String sqlQuery = "UPDATE `petition_action_taken` SET "
+ "`file_name`='"+fileName+"', "
+ "`file_size`='"+fileSize+"', "
+ "`file_type`='"+fileType+"' "
+ "WHERE `solmapid`='"+solmapid+"' LIMIT 1";
jdbcTemplate.update(sqlQuery);
} catch (IOException e) {
e.printStackTrace();
return "Failed to save file " + file.getOriginalFilename();
}
}
return "success";
}
}

58
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/PetitionMaster.java

@ -0,0 +1,58 @@
package in.gov.chennaicorporation.gccoffice.m_petition.service;
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;
@Service
public class PetitionMaster {
private JdbcTemplate jdbcTemplate;
@Autowired
public void setDataSource(@Qualifier("mysqlPetitionMasterDataSource") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getComplaintType(){
String SqlQuery = "";
SqlQuery = "SELECT * FROM `complaint_types` WHERE `isactive`=1 AND `isdelete`=0";
List<Map<String, Object>> result = jdbcTemplate.queryForList(SqlQuery);
return result;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getOfficerList(){
String SqlQuery = "";
SqlQuery = "SELECT * FROM `officer_master` WHERE `isactive`=1 AND `isdelete`=0";
List<Map<String, Object>> result = jdbcTemplate.queryForList(SqlQuery);
return result;
}
@Transactional(readOnly = true)
public List<Map<String,Object>> getPetitionTypes(){
String SqlQuery = "";
SqlQuery = "SELECT * FROM `petition_types` WHERE `isactive`=1 AND `isdelete`=0 ORDER BY `orderby` ASC";
List<Map<String, Object>> result = jdbcTemplate.queryForList(SqlQuery);
return result;
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/package-info.java

@ -0,0 +1 @@
package in.gov.chennaicorporation.gccoffice.m_petition.service;

2
src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java

@ -18,7 +18,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
@RequestMapping("/api/petregistration")
@RequestMapping("/gcc/api/petregistration")
@RestController("petRegistrationRest") @RestController("petRegistrationRest")
public class APIController { public class APIController {
private final RestTemplate restTemplate; private final RestTemplate restTemplate;

2
src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java

@ -20,7 +20,7 @@ import in.gov.chennaicorporation.gccoffice.petregistration.data.PetCountInfo;
import in.gov.chennaicorporation.gccoffice.petregistration.data.RequestList; import in.gov.chennaicorporation.gccoffice.petregistration.data.RequestList;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("/petregistration")
@RequestMapping("/gcc/petregistration")
@Controller("petregistration") @Controller("petregistration")
public class MainController { public class MainController {
private final RestTemplate restTemplate; private final RestTemplate restTemplate;

1
src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java

@ -9,6 +9,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import in.gov.chennaicorporation.gccoffice.pgr.service.PGRCommon; import in.gov.chennaicorporation.gccoffice.pgr.service.PGRCommon;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;

1
src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java

@ -170,6 +170,7 @@ public class PGRCommon {
+ " cs.statusname AS status, " + " cs.statusname AS status, "
+ " usr.user_name, " + " usr.user_name, "
+ " cd.complaintnumber, " + " cd.complaintnumber, "
+ " cd.ID_MODE AS \"MODE\", "
+ " COALESCE(ct.complainttypename, 'Unspecified') AS complainttypename, " + " COALESCE(ct.complainttypename, 'Unspecified') AS complainttypename, "
+ " cg.complaintgroupname " + " cg.complaintgroupname "
+ "FROM eggr_complaintdetails@erp cd " + "FROM eggr_complaintdetails@erp cd "

2
src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java

@ -20,7 +20,7 @@ public interface AppUserRepository extends JpaRepository<AppUserEntity, Integer>
@Query(value = "SELECT * FROM `appusers`", nativeQuery = true) @Query(value = "SELECT * FROM `appusers`", nativeQuery = true)
List<AppUserEntity> showAll(); List<AppUserEntity> showAll();
@Query(value = "SELECT * FROM `appusers` WHERE (id=:userId AND `isdelete`=0)", nativeQuery = true)
@Query(value = "SELECT * FROM `appusers` WHERE (userid=:userId AND `isdelete`=0)", nativeQuery = true)
List<AppUserEntity> showById(String userId); List<AppUserEntity> showById(String userId);
AppUserEntity findByUsername(String username); AppUserEntity findByUsername(String username);

38
src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java

@ -0,0 +1,38 @@
package in.gov.chennaicorporation.gccoffice.service;
import java.util.Base64;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class Base64Util {
// Encode to Base64
public static String encodeBase64(String value) {
if (value != null && !value.isEmpty()) {
byte[] encodedBytes = Base64.getEncoder().encode(value.getBytes());
return new String(encodedBytes);
}
else {
return "";
}
}
// Decode from Base64
public static String decodeBase64(String encodedValue) {
if (encodedValue != null && !encodedValue.isEmpty()) {
try {
byte[] decodedBytes = Base64.getDecoder().decode(encodedValue);
return new String(decodedBytes);
} catch (IllegalArgumentException e) {
// Handle the exception, e.g., log it or return an error message
System.err.println("Error decoding Base64 string: " + e.getMessage());
return "error"; // Or return an error message string
}
} else {
return "";
}
}
}

1
src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java

@ -53,6 +53,7 @@ public class CustomUserDetailsService implements UserDetailsService {
userRole = "ROLE_" + userRole; userRole = "ROLE_" + userRole;
//System.out.println("User Role: "+userRole); //System.out.println("User Role: "+userRole);
} }
// Create a SimpleGrantedAuthority for the user role // Create a SimpleGrantedAuthority for the user role
SimpleGrantedAuthority authority = new SimpleGrantedAuthority(userRole); SimpleGrantedAuthority authority = new SimpleGrantedAuthority(userRole);

2
src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java

@ -23,7 +23,9 @@ public class LoginUserInfo {
public static String getLoginUserId() { public static String getLoginUserId() {
UserDetails userDetails = LoginUserInfo.getCurrentUserDetails(); UserDetails userDetails = LoginUserInfo.getCurrentUserDetails();
if (userDetails instanceof CustomUserDetails) { if (userDetails instanceof CustomUserDetails) {
//System.out.println("User Details : "+userDetails.toString());
CustomUserDetails customUserDetails = (CustomUserDetails) userDetails; CustomUserDetails customUserDetails = (CustomUserDetails) userDetails;
Map<String, Object> additionalAttributes = customUserDetails.getAdditionalAttributes(); Map<String, Object> additionalAttributes = customUserDetails.getAdditionalAttributes();
if (additionalAttributes != null) { if (additionalAttributes != null) {

BIN
src/main/resources/.DS_Store

16
src/main/resources/application.properties

@ -40,14 +40,28 @@ server.servlet.session.tracking-modes=COOKIE
#logging.level.root=DEBUG #logging.level.root=DEBUG
file.upload.directory=${user.dir}/gccoffice_uploads
file.upload.directory=${user.dir}/gccoffice_uploads/
server.address=0.0.0.0 server.address=0.0.0.0
server.servlet.session.timeout=-1 server.servlet.session.timeout=-1
server.servlet.session.cookie.name= GCCONEPORTALSESSION server.servlet.session.cookie.name= GCCONEPORTALSESSION
server.servlet.session.cookie.max-age=-1 server.servlet.session.cookie.max-age=-1
server.servlet.session.cookie.http-only=true
server.servlet.session.cookie.secure=true
#server.servlet.session.timeout:5m #server.servlet.session.timeout:5m
#server.servlet.session.cookie.name: MYSESSIONID #server.servlet.session.cookie.name: MYSESSIONID
#server.servlet.session.cookie.max-age: 10m #server.servlet.session.cookie.max-age: 10m
#///////// For Mayor Petition //////////
mp_ackno_prefix=MP
mp_ackno = 10000000
mp_foldername = m_petition
mp_action_Foldername = m_action_file
#///////// For Councillor Petition //////////
cp_ackno_prefix=CP
cp_ackno = 10000000
cp_foldername = c_petition
cp_action_Foldername = c_action_file

BIN
src/main/resources/static/.DS_Store

BIN
src/main/resources/static/assets/.DS_Store

BIN
src/main/resources/static/assets/dist/.DS_Store

4
src/main/resources/static/assets/dist/css/theme.css

@ -5068,9 +5068,9 @@ body {
.wrapper .header-top .top-menu .nav-link i { .wrapper .header-top .top-menu .nav-link i {
font-size: 16px; } font-size: 16px; }
.wrapper .header-top .top-menu .nav-link .badge { .wrapper .header-top .top-menu .nav-link .badge {
right: -1px;
right: 0px;
position: absolute; position: absolute;
top: -4px;
top: 0px;
padding: 3px; padding: 3px;
width: 17px; width: 17px;
font-size: 11px; font-size: 11px;

BIN
src/main/resources/static/assets/images/.DS_Store

BIN
src/main/resources/templates/.DS_Store

2
src/main/resources/templates/error-403.html

@ -34,7 +34,7 @@
<p class="fs-4 fw-medium text-muted mb-5" th:utext="${errorMessage}"> <p class="fs-4 fw-medium text-muted mb-5" th:utext="${errorMessage}">
Oops, You don`t have permission to access this page. Oops, You don`t have permission to access this page.
</p> </p>
<a class="btn btn-lg btn-alt-danger" href="#" onclick="goBack()">
<a class="btn btn-lg btn-alt-danger" href="#403" onclick="return goBack();">
<i class="fa fa-arrow-left opacity-50 me-1"></i> Back <i class="fa fa-arrow-left opacity-50 me-1"></i> Back
</a> </a>
</div> </div>

2
src/main/resources/templates/error-404.html

@ -34,7 +34,7 @@
<p class="fs-4 fw-medium text-muted mb-5"> <p class="fs-4 fw-medium text-muted mb-5">
We are sorry but the page you are looking for was not found. We are sorry but the page you are looking for was not found.
</p> </p>
<a class="btn btn-lg btn-alt-danger" href="#" onclick="goBack()">
<a class="btn btn-lg btn-alt-danger" href="#404" onclick="return goBack();">
<i class="fa fa-arrow-left opacity-50 me-1"></i> Back <i class="fa fa-arrow-left opacity-50 me-1"></i> Back
</a> </a>
</div> </div>

2
src/main/resources/templates/error-500.html

@ -34,7 +34,7 @@
<p class="fs-4 fw-medium text-muted mb-5"> <p class="fs-4 fw-medium text-muted mb-5">
The server encountered an internal error or misconfiguration and was unable to complete your request The server encountered an internal error or misconfiguration and was unable to complete your request
</p> </p>
<a class="btn btn-lg btn-alt-danger" href="#" onclick="goBack()">
<a class="btn btn-lg btn-alt-danger" href="#500" onclick="return goBack();">
<i class="fa fa-arrow-left opacity-50 me-1"></i> Back <i class="fa fa-arrow-left opacity-50 me-1"></i> Back
</a> </a>
</div> </div>

2
src/main/resources/templates/error.html

@ -34,7 +34,7 @@
<p class="fs-4 fw-medium text-muted mb-5" th:utext="${errorMessage}"> <p class="fs-4 fw-medium text-muted mb-5" th:utext="${errorMessage}">
The server encountered an internal error or misconfiguration and was unable to complete your request The server encountered an internal error or misconfiguration and was unable to complete your request
</p> </p>
<a class="btn btn-lg btn-alt-danger" href="#" onclick="goBack()">
<a class="btn btn-lg btn-alt-danger" href="#error" onclick="return goBack();">
<i class="fa fa-arrow-left opacity-50 me-1"></i> Back <i class="fa fa-arrow-left opacity-50 me-1"></i> Back
</a> </a>
</div> </div>

2
src/main/resources/templates/fragments/modules/base/footer.html

@ -1,5 +1,5 @@
<footer class="footer"> <footer class="footer">
<form id="logout-form" th:action="@{/logout}" method="post" style="display: none;"></form>
<form id="logout-form" th:action="@{/gcc/logout}" method="post" style="display: none;"></form>
<div class="w-100 clearfix"> <div class="w-100 clearfix">
<span class="text-center text-sm-left d-md-inline-block">Copyright &copy; Greater Chennai Corporation | All rights reserved</span> <span class="text-center text-sm-left d-md-inline-block">Copyright &copy; Greater Chennai Corporation | All rights reserved</span>
<span class="float-none float-sm-right mt-1 mt-sm-0 text-center">Coded By BonTon Softwares Pvt Ltd</span> <span class="float-none float-sm-right mt-1 mt-sm-0 text-center">Coded By BonTon Softwares Pvt Ltd</span>

487
src/main/resources/templates/fragments/modules/base/head.html

@ -42,6 +42,108 @@
<link rel="stylesheet" href="dist/css/theme.css"> <link rel="stylesheet" href="dist/css/theme.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script> <script src="js/vendor/modernizr-2.8.3.min.js"></script>
<style> <style>
.text-center {
text-align: center !important;
}
/* Define the keyframes for the ringing animation */
.bell{
padding-top: 12px;
display:block;
font-size: 40px;
/*margin:50px auto 0;*/
/*color: #9e9e9e;*/
-webkit-animation: ring 4s .7s ease-in-out infinite;
-webkit-transform-origin: 50% 4px;
-moz-animation: ring 4s .7s ease-in-out infinite;
-moz-transform-origin: 50% 4px;
animation: ring 4s .7s ease-in-out infinite;
transform-origin: 50% 4px;
}
@-webkit-keyframes ring {
0% { -webkit-transform: rotateZ(0); }
1% { -webkit-transform: rotateZ(30deg); }
3% { -webkit-transform: rotateZ(-28deg); }
5% { -webkit-transform: rotateZ(34deg); }
7% { -webkit-transform: rotateZ(-32deg); }
9% { -webkit-transform: rotateZ(30deg); }
11% { -webkit-transform: rotateZ(-28deg); }
13% { -webkit-transform: rotateZ(26deg); }
15% { -webkit-transform: rotateZ(-24deg); }
17% { -webkit-transform: rotateZ(22deg); }
19% { -webkit-transform: rotateZ(-20deg); }
21% { -webkit-transform: rotateZ(18deg); }
23% { -webkit-transform: rotateZ(-16deg); }
25% { -webkit-transform: rotateZ(14deg); }
27% { -webkit-transform: rotateZ(-12deg); }
29% { -webkit-transform: rotateZ(10deg); }
31% { -webkit-transform: rotateZ(-8deg); }
33% { -webkit-transform: rotateZ(6deg); }
35% { -webkit-transform: rotateZ(-4deg); }
37% { -webkit-transform: rotateZ(2deg); }
39% { -webkit-transform: rotateZ(-1deg); }
41% { -webkit-transform: rotateZ(1deg); }
43% { -webkit-transform: rotateZ(0); }
100% { -webkit-transform: rotateZ(0); }
}
@-moz-keyframes ring {
0% { -moz-transform: rotate(0); }
1% { -moz-transform: rotate(30deg); }
3% { -moz-transform: rotate(-28deg); }
5% { -moz-transform: rotate(34deg); }
7% { -moz-transform: rotate(-32deg); }
9% { -moz-transform: rotate(30deg); }
11% { -moz-transform: rotate(-28deg); }
13% { -moz-transform: rotate(26deg); }
15% { -moz-transform: rotate(-24deg); }
17% { -moz-transform: rotate(22deg); }
19% { -moz-transform: rotate(-20deg); }
21% { -moz-transform: rotate(18deg); }
23% { -moz-transform: rotate(-16deg); }
25% { -moz-transform: rotate(14deg); }
27% { -moz-transform: rotate(-12deg); }
29% { -moz-transform: rotate(10deg); }
31% { -moz-transform: rotate(-8deg); }
33% { -moz-transform: rotate(6deg); }
35% { -moz-transform: rotate(-4deg); }
37% { -moz-transform: rotate(2deg); }
39% { -moz-transform: rotate(-1deg); }
41% { -moz-transform: rotate(1deg); }
43% { -moz-transform: rotate(0); }
100% { -moz-transform: rotate(0); }
}
@keyframes ring {
0% { transform: rotate(0); }
1% { transform: rotate(30deg); }
3% { transform: rotate(-28deg); }
5% { transform: rotate(34deg); }
7% { transform: rotate(-32deg); }
9% { transform: rotate(30deg); }
11% { transform: rotate(-28deg); }
13% { transform: rotate(26deg); }
15% { transform: rotate(-24deg); }
17% { transform: rotate(22deg); }
19% { transform: rotate(-20deg); }
21% { transform: rotate(18deg); }
23% { transform: rotate(-16deg); }
25% { transform: rotate(14deg); }
27% { transform: rotate(-12deg); }
29% { transform: rotate(10deg); }
31% { transform: rotate(-8deg); }
33% { transform: rotate(6deg); }
35% { transform: rotate(-4deg); }
37% { transform: rotate(2deg); }
39% { transform: rotate(-1deg); }
41% { transform: rotate(1deg); }
43% { transform: rotate(0); }
100% { transform: rotate(0); }
}
.showInputValue { .showInputValue {
padding: 0.375rem 0.75rem !important; padding: 0.375rem 0.75rem !important;
margin-bottom: 0.5rem !important; margin-bottom: 0.5rem !important;
@ -141,6 +243,391 @@
} }
.link{ .link{
color:#0d6efd; color:#0d6efd;
}
.swal-title-custom {
font-size: 15px; /* Change the font size as needed */
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
::file-selector-button {
font: inherit;
-webkit-appearance: button;
}
.form-control[type=file] {
overflow: hidden;
}
.form-control[type=file]:not(:disabled):not([readonly]) {
cursor: pointer;
}
.form-control::-webkit-file-upload-button {
padding: 0.375rem 0.75rem;
margin: -0.375rem -0.75rem;
min-height: 40px;
-webkit-margin-end: 0.75rem;
margin-inline-end: 0.75rem;
color: #343a40;
background-color: #edf0f7;
pointer-events: none;
border-color: inherit;
border-style: solid;
border-width: 0;
border-inline-end-width: 1px;
border-radius: 0;
-webkit-transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control::file-selector-button {
padding: 0.375rem 0.75rem;
margin: -0.375rem -0.75rem;
min-height: 40px;
-webkit-margin-end: 0.75rem;
margin-inline-end: 0.75rem;
color: #343a40;
background-color: #edf0f7;
pointer-events: none;
border-color: inherit;
border-style: solid;
border-width: 0;
border-inline-end-width: 1px;
border-radius: 0;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
.form-control::-webkit-file-upload-button {
-webkit-transition: none;
transition: none;
}
.form-control::file-selector-button {
transition: none;
}
}
.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button {
background-color: #e1e4eb;
}
.form-control:hover:not(:disabled):not([readonly])::file-selector-button {
background-color: #e1e4eb;
}
/* For print */
@media print {
.wrapper .page-wrap .main-content {
padding: 0 !important;
background-color: #F6F7FB;
min-height: 0 !important;
margin-top: 0 !important;
padding-right: 0 !important;
padding-left: 0 !important;
}
.header-top,
.app-sidebar,
.page-overlay,
.page-loader,
.page-header,
.footer,
.sidebar,
.side-overlay,
.block-options {
padding: 0 !important;
margin: 0 !important;
display: none !important;
}
.block {
box-shadow: none !important;
}
/*
#ack1table{
margin-top:50px !important;
margin-right:100px !important;
margin-left:100px !important;
}
#ack2table{
margin-top:50px !important;
margin-right:100px !important;
margin-left:100px !important;
}
*/
.ack {
height: 100%; /* Set height to 100% */
}
.ack-container {
display: flex;
justify-content: center; /* Center horizontally */
align-items: center; /* Center vertically */
height: 100%; /* Set height to 100% */
}
#ack1table {
width: 70% !important; /* Set width */
page-break-before: auto; /* Avoid page breaks after ack1table */
}
#ack2table {
width: 70% !important; /* Set width */
page-break-before: auto; /* Avoid page breaks after ack1table */
}
.printack2{
margin-top:250px;
}
.print_no{
display: none !important;
}
}
.ack {
height: 100%; /* Set height to 100% */
}
.ack-container {
display: flex;
justify-content: center; /* Center horizontally */
align-items: center; /* Center vertically */
height: 100%; /* Set height to 100% */
}
#ack1table {
border: 1px solid black; /* Add border */
width: 99%; /* Set width */
height: 100%; /* Set height */
}
#ack2table {
border: 1px solid black; /* Add border */
width: 99%; /* Set width */
height: 100%; /* Set height */
}
</style>
<style>
.ribbon1 {
position: absolute;
top: -6.1px;
right: 10px;
}
.ribbon1:after {
position: absolute;
content: "";
width: 0;
height: 0;
border-left: 53px solid transparent;
border-right: 53px solid transparent;
border-top: 10px solid #F8463F;
}
.ribbon1 span {
position: relative;
display: block;
text-align: center;
background: #F8463F;
font-size: 14px;
line-height: 1;
padding: 12px 8px 10px;
border-top-right-radius: 8px;
width: 90px;
}
.ribbon1 span:before, .ribbon1 span:after {
position: absolute;
content: "";
}
.ribbon1 span:before {
height: 6px;
width: 6px;
left: -6px;
top: 0;
background: #F8463F;
}
.ribbon1 span:after {
height: 6px;
width: 8px;
left: -8px;
top: 0;
border-radius: 8px 8px 0 0;
background: #C02031;
}
.ribbon2 {
width: 60px;
padding: 10px 0;
position: absolute;
top: -6px;
left: 25px;
text-align: center;
border-top-left-radius: 3px;
background: #F47530;
}
.ribbon2:before {
height: 0;
width: 0;
right: -5.5px;
top: 0.1px;
border-bottom: 6px solid #8D5A20;
border-right: 6px solid transparent;
}
.ribbon2:before, .ribbon2:after {
content: "";
position: absolute;
}
.ribbon2:after {
height: 0;
width: 0;
bottom: -29.5px;
left: 0;
border-left: 30px solid #F47530;
border-right: 30px solid #F47530;
border-bottom: 30px solid transparent;
}
.ribbon3 {
width: 150px;
height: 50px;
line-height: 50px;
padding-left: 15px;
position: absolute;
left: -8px;
top: 20px;
background: #59324C;
}
.ribbon3:before, .ribbon3:after {
content: "";
position: absolute;
}
.ribbon3:before {
height: 0;
width: 0;
top: -8.5px;
left: 0.1px;
border-bottom: 9px solid black;
border-left: 9px solid transparent;
}
.ribbon3:after {
height: 0;
width: 0;
right: -14.5px;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
border-left: 15px solid #59324C;
}
.ribbon4 {
position: absolute;
top: 15px;
padding: 8px 10px;
background: #00B3ED;
box-shadow: -1px 2px 3px rgba(0,0,0,.3);
}
.ribbon4:before, .ribbon4:after {
content: "";
position: absolute;
}
.ribbon4:before {
width: 7px;
height: 100%;
top: 0;
left: -6.5px;
padding: 0 0 7px;
background: inherit;
border-radius: 5px 0 0 5px;
}
.ribbon4:after {
width: 5px;
height: 5px;
bottom: -5px;
left: -4.5px;
background: lightblue;
border-radius: 5px 0 0 5px;
}
.ribbon5 {
display: block;
width: calc(100% + 20px);
height: 50px;
line-height: 50px;
text-align: center;
margin-left: -10px;
margin-right: -10px;
background: #EDBA19;
position: relative;
top: 20px;
}
.ribbon5:before, .ribbon5:after {
content: "";
position: absolute;
}
.ribbon5:before {
height: 0;
width: 0;
bottom: -10px;
left: 0;
border-top: 10px solid #cd8d11;
border-left: 10px solid transparent;
}
.ribbon5:after {
height: 0;
width: 0;
right: 0;
bottom: -10px;
border-top: 10px solid #cd8d11;
border-right: 10px solid transparent;
}
.wrap {
width: 100%;
height: 188px;
position: absolute;
top: -8px;
left: 8px;
overflow: hidden;
}
.wrap:before, .wrap:after {
content: "";
position: absolute;
}
.wrap:before {
width: 40px;
height: 8px;
right: 100px;
background: #4D6530;
border-radius: 8px 8px 0px 0px;
}
.wrap:after {
width: 8px;
height: 40px;
right: 0px;
top: 100px;
background: #4D6530;
border-radius: 0px 8px 8px 0px;
}
.ribbon6 {
width: 200px;
height: 40px;
line-height: 40px;
position: absolute;
top: 30px;
right: -50px;
z-index: 2;
overflow: hidden;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
border: 1px dashed;
box-shadow:0 0 0 3px #57DD43, 0px 21px 5px -18px rgba(0,0,0,0.6);
background: #57DD43;
text-align: center;
}
@media (min-width: 500px) {
.ribbons-wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.ribbon {
width: 48%;
}
}
.cursure_poiter{
cursor: pointer;
} }
</style> </style>
</head> </head>

28
src/main/resources/templates/fragments/modules/base/header.html

@ -3,18 +3,21 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="top-menu d-flex align-items-center"> <div class="top-menu d-flex align-items-center">
<button type="button" class="btn-icon mobile-nav-toggle d-lg-none"><span></span></button> <button type="button" class="btn-icon mobile-nav-toggle d-lg-none"><span></span></button>
<div class="header-search">
<!-- <div class="header-search">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon search-close"><i class="ik ik-x"></i></span> <span class="input-group-addon search-close"><i class="ik ik-x"></i></span>
<input type="text" class="form-control"> <input type="text" class="form-control">
<span class="input-group-addon search-btn"><i class="ik ik-search"></i></span> <span class="input-group-addon search-btn"><i class="ik ik-search"></i></span>
</div> </div>
</div> </div>
-->
<button type="button" id="navbar-fullscreen" class="nav-link"><i class="ik ik-maximize"></i></button> <button type="button" id="navbar-fullscreen" class="nav-link"><i class="ik ik-maximize"></i></button>
</div> </div>
<div class="top-menu d-flex align-items-center"> <div class="top-menu d-flex align-items-center">
<div class="dropdown"> <div class="dropdown">
<a class="nav-link dropdown-toggle" href="#" id="notiDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="ik ik-bell"></i><span class="badge bg-danger">3</span></a>
<a class="nav-link dropdown-toggle" href="#" id="notiDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ik ik-bell bell"></i><span class="badge bg-danger">3</span>
</a>
<div class="dropdown-menu dropdown-menu-right notification-dropdown" aria-labelledby="notiDropdown"> <div class="dropdown-menu dropdown-menu-right notification-dropdown" aria-labelledby="notiDropdown">
<h4 class="header">Notifications</h4> <h4 class="header">Notifications</h4>
<div class="notifications-wrap"> <div class="notifications-wrap">
@ -49,25 +52,6 @@
<div class="footer"><a href="javascript:void(0);">See all activity</a></div> <div class="footer"><a href="javascript:void(0);">See all activity</a></div>
</div> </div>
</div> </div>
<button type="button" class="nav-link ml-10 right-sidebar-toggle"><i class="ik ik-message-square"></i><span class="badge bg-success">3</span></button>
<div class="dropdown">
<a class="nav-link dropdown-toggle" href="#" id="menuDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="ik ik-plus"></i></a>
<div class="dropdown-menu dropdown-menu-right menu-grid" aria-labelledby="menuDropdown">
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Dashboard"><i class="ik ik-bar-chart-2"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Message"><i class="ik ik-mail"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Accounts"><i class="ik ik-users"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Sales"><i class="ik ik-shopping-cart"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Purchase"><i class="ik ik-briefcase"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Pages"><i class="ik ik-clipboard"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Chats"><i class="ik ik-message-square"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Contacts"><i class="ik ik-map-pin"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Blocks"><i class="ik ik-inbox"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Events"><i class="ik ik-calendar"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="Notifications"><i class="ik ik-bell"></i></a>
<a class="dropdown-item" href="#" data-toggle="tooltip" data-placement="top" title="More"><i class="ik ik-more-horizontal"></i></a>
</div>
</div>
<button type="button" class="nav-link ml-10" id="apps_modal_btn" data-toggle="modal" data-target="#appsModal"><i class="ik ik-grid"></i></button>
<div class="dropdown"> <div class="dropdown">
<a class="dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -78,7 +62,7 @@
<a class="dropdown-item" href="#"><i class="ik ik-settings dropdown-icon"></i> Settings</a> <a class="dropdown-item" href="#"><i class="ik ik-settings dropdown-icon"></i> Settings</a>
<a class="dropdown-item" href="#"><span class="float-right"><span class="badge badge-primary">6</span></span><i class="ik ik-mail dropdown-icon"></i> Inbox</a> <a class="dropdown-item" href="#"><span class="float-right"><span class="badge badge-primary">6</span></span><i class="ik ik-mail dropdown-icon"></i> Inbox</a>
<a class="dropdown-item" href="#"><i class="ik ik-navigation dropdown-icon"></i> Message</a> <a class="dropdown-item" href="#"><i class="ik ik-navigation dropdown-icon"></i> Message</a>
<a class="dropdown-item" th:href="@{/logout}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"><i class="ik ik-power dropdown-icon"></i> Logout</a>
<a class="dropdown-item" th:href="@{/gcc/logout}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"><i class="ik ik-power dropdown-icon"></i> Logout</a>
</div> </div>
</div> </div>

2
src/main/resources/templates/fragments/modules/base/menu.html

@ -7,7 +7,7 @@
</div> </div>
<span class="text"> GCC APP</span> <span class="text"> GCC APP</span>
</a> </a>
<button type="button" class="nav-toggle"><i data-toggle="expanded" class="ik ik-toggle-right toggle-icon"></i></button>
<!-- <button type="button" class="nav-toggle"><i data-toggle="expanded" class="ik ik-toggle-right toggle-icon"></i></button> -->
<button id="sidebarClose" class="nav-close"><i class="ik ik-x"></i></button> <button id="sidebarClose" class="nav-close"><i class="ik ik-x"></i></button>
</div> </div>

106
src/main/resources/templates/fragments/modules/base/script.html

@ -33,7 +33,7 @@
<script src="node_modules/datatable/StateRestore-1.3.0/js/dataTables.stateRestore.min.js"></script> <script src="node_modules/datatable/StateRestore-1.3.0/js/dataTables.stateRestore.min.js"></script>
<script src="dist/js/theme.js"></script> <script src="dist/js/theme.js"></script>
<script>
<script th:inline="javascript">
// Get the current page URL path // Get the current page URL path
var currentPagePath = window.location.pathname; var currentPagePath = window.location.pathname;
// Remove the leading slash from the current page URL path // Remove the leading slash from the current page URL path
@ -50,15 +50,27 @@
} }
</script> </script>
<script>
<script th:inline="javascript">
$(document).ready(function() { $(document).ready(function() {
/*
// Get the current URL
var currentUrl = window.location.href;
// Remove the query parameter from the URL
var newUrl = currentUrl.split("?")[0];
// Replace the current URL with the modified URL without the query parameter
window.history.replaceState({}, document.title, newUrl);
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
var currentPagePath = window.location.pathname; var currentPagePath = window.location.pathname;
//console.error(currentPagePath);
currentPagePath = "/"+currentPagePath.substr(1); currentPagePath = "/"+currentPagePath.substr(1);
//console.error(currentPagePath);
// Set active class for parent menu items // Set active class for parent menu items
$('.nav-item').each(function() { $('.nav-item').each(function() {
var link = $(this).find('a').attr('href'); var link = $(this).find('a').attr('href');
//console.log(link +" == "+ currentPagePath);
//console.log("Main: "+link +" == "+ currentPagePath);
if (link === currentPagePath || link === currentPagePath) { if (link === currentPagePath || link === currentPagePath) {
$(this).addClass('active'); $(this).addClass('active');
$(this).parents('.has-sub').addClass('active open'); $(this).parents('.has-sub').addClass('active open');
@ -68,7 +80,9 @@
// Set active class for submenu items // Set active class for submenu items
$('.submenu-content .menu-item').each(function() { $('.submenu-content .menu-item').each(function() {
var link = $(this).attr('href'); var link = $(this).attr('href');
//console.log("Sub: "+link +" == "+ currentPagePath);
if (link === currentPagePath || link === currentPagePath) { if (link === currentPagePath || link === currentPagePath) {
//console.error("Sub: "+link +" == "+ currentPagePath);
$(this).addClass('active'); $(this).addClass('active');
$(this).parents('.has-sub').addClass('active open'); $(this).parents('.has-sub').addClass('active open');
} }
@ -125,7 +139,7 @@ function convertdate(date_txt){
return formattedDateTime; return formattedDateTime;
} }
function date_difference(fromdate,todate,type='time'){
function date_difference(fromdate,todate,type='datetime'){
// Parse the date strings into moment objects with the specified format // Parse the date strings into moment objects with the specified format
var startDate = moment(fromdate, 'DD-MM-YYYY hh:mm A'); var startDate = moment(fromdate, 'DD-MM-YYYY hh:mm A');
@ -138,12 +152,34 @@ function date_difference(fromdate,todate,type='time'){
var duration = moment.duration(endDate - startDate); var duration = moment.duration(endDate - startDate);
var hoursDifference = duration.hours(); var hoursDifference = duration.hours();
var minutesDifference = duration.minutes(); var minutesDifference = duration.minutes();
var date_diff_txt ="";
var day_txt = "day";
var hour_txt = "hour";
var days_txt ="";
if(daysDifference>1){
day_txt = "days";
}
if(hoursDifference>1){
hour_txt = "hours";
}
// Display the result // Display the result
//1 day, 1 hour and 34 minutes.
if(type=='days'){ if(type=='days'){
return daysDifference + ' days';
}else{
return (hoursDifference) + ' hours and ' + (minutesDifference) + ' minutes';
date_diff_txt = daysDifference + ' '+day_txt;
}else if(type=='time'){
date_diff_txt = hoursDifference + ' '+ hour_txt +' and ' + minutesDifference + ' minutes';
} }
else{
if(daysDifference>0){
days_txt = daysDifference + ' '+day_txt+', ';
}
date_diff_txt = days_txt + hoursDifference + ' '+ hour_txt +' and ' + minutesDifference + ' minutes';
}
return date_diff_txt;
} }
function nodata(message="Data are not availble at this moment please check later"){ function nodata(message="Data are not availble at this moment please check later"){
@ -179,6 +215,60 @@ function getLoadingMessage() {
// Display the random message // Display the random message
return randomMessage; return randomMessage;
} }
//To convert the file size from bytes
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
/* Check file Exits */
function checkFileExists(url) {
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('File not found');
}
return true;
})
.catch(error => {
console.error('Error checking file existence:', error);
return false;
});
}
/* File Doanload script
* Send fileUrl - Full Path
* var fileUrl = "/gcc/files/m_petition/m_action_file/filename.jpg";
*/
function callDownload(fileUrl,fileName){
checkFileExists(fileUrl).then(exists => {
if (exists) {
//download file - fileUrl
// Create a temporary anchor element
var link = document.createElement("a");
link.href = fileUrl;
link.download = fileName; // Set the download attribute to the file name
link.click(); // Simulate a click on the anchor element to trigger the download
} else {
console.log('File does not exist');
}
});
}
/* encode a string to Base64 */
function encodeBase64(value) {
if (value && value.trim() !== '') {
// Encode the string to Base64
var encodedString = btoa(value);
return encodedString;
} else {
return '';
}
}
</script> </script>
<!-- <!--
<script th:inline="javascript"> <script th:inline="javascript">

116
src/main/resources/templates/fragments/modules/c_petition/modal-box.html

@ -0,0 +1,116 @@
<!-- Box 1 -->
<div class="modal fade" id="ackModalBox" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title m-0" id="ackModalTitle">Modal Title</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="ackModalBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 2 -->
<div class="modal fade" id="ComplaintStatusBox" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title m-0" id="complaint-title">புகார் நிலை / Complaint Status:</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="ComplaintStatusBoxBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 3 -->
<div class="modal fade" id="viewFileBox" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #28a745 !important;">
<h6 class="modal-title m-0" id="viewFileTitle">View File</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="viewFileBoxBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 4 -->
<div class="modal fade" id="viewpetition" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #28a745 !important;">
<h6 class="modal-title m-0" id="viewPetitionTitle">View Petition</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="viewPetitionBoxBody">
<iframe id="iframe" width="100%" height="400px" src=""></iframe>
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 0 common -->
<div class="modal fade" id="forwardModalBox" data-backdrop="static" tabindex="1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #28a745 !important;">
<h6 class="modal-title m-0" id="forwardModalTitle">Modal Title</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="forwardModalBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->

291
src/main/resources/templates/fragments/modules/c_petition/petition_view_script.html

@ -0,0 +1,291 @@
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var petitionNo = /*[[${petitionNo}]]*/'';
var petitionId = 0;
var closedComplaintsList=[];
var complaintTypeList = "";
var officerMasterList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// Call Petition function to fetch the data
get_petition_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Officer Master Data */
function get_officer_master_data(){
get_officer_list().then(function(officers) {
// Handle the officer list
officerMasterList = officers;
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
});
}
// Function to get complaint_type and complaint_typeid by complaint_typeid
function getComplaintTypeById(complaintTypeId) {
for (var i = 0; i < complaintTypeList.length; i++) {
if (complaintTypeList[i].complaint_typeid == complaintTypeId) {
return {
complaint_type: complaintTypeList[i].complaint_type,
complaint_typeid: complaintTypeList[i].complaint_typeid
};
}
}
return null; // Return null if no matching complaint_typeid is found
}
/* Get Petition data */
function get_petition_data(){
get_petition_details().then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint;
petitionId = petitionDetails[0].petition_id;
var complaintArray = complaint.split(",");
$("#complaintType").val(complaintArray);
$('#complaintType').trigger('change');
closedComplaintsList = complaintArray;
$("#cdate_value").html(convertdate(petitionDetails[0].cdate));
$("#petition_no_value").html(petitionDetails[0].petition_no);
$("#petitioner_name_value").html(petitionDetails[0].petitioner_name);
$("#petitioner_mobile_value").html(petitionDetails[0].petitioner_mobile);
$("#petitioner_address_value").html(petitionDetails[0].petitioner_address);
$("#petitioner_pincode_value").html(petitionDetails[0].petitioner_pincode);
$("#complaint_with_maping_value").html(petitionDetails[0].complaint_nature);
var petition_status = petitionDetails[0].status
if(petition_status=='pending' || petition_status=='partial'){
$("#petition_summary_title").html("Pending Summary");
var currentDate = new Date();
var totaldayspending = date_difference(convertdate(petitionDetails[0].cdate),convertdate(currentDate),'');
$("#petition_summary_html").html(`This petition has been pending for more than ${totaldayspending}`);
}
if(petition_status=='close'){
$("#petition_summary_title").html("Close Summary");
var currentDate = new Date();
var totaldayspending = date_difference(convertdate(petitionDetails[0].cdate),convertdate(currentDate),'');
$("#petition_summary_html").html(`The time taken to close this petition is ${totaldayspending}`);
}
petition_status=petition_status.charAt(0).toUpperCase() + petition_status.slice(1);
$("#petition_status_value").html(`<b style="color:red">${petition_status}</b>`);
// Call Complaint list based on Petition No and Id
get_petition_mapping_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition Data ('+petitionNo+'):', error.message);
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
});
}
/* Get Petition details by petition number */
function get_petition_details() {
var formData = new FormData();
formData.append('petitionNo',petitionNo);
var apiUrl = '/gcc/api/c_petition/getPetitionDetails?petitionNo='+petitionNo;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
if(jsonResponse.length>0){
resolve(jsonResponse);
}else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});
});
}
function get_petition_mapping_data(){
get_petition_mapping_list().then(function(mappingDetails) {
// Initialize count
let totalCount = mappingDetails.length;
let completedCount = 0;
let pendingCount = 0;
var tableListHTML = "";
for(j = 0; j < mappingDetails.length; j++){
var complaint_status=mappingDetails[j].complaint_status;
complaint_status=complaint_status.charAt(0).toUpperCase() + complaint_status.slice(1);
tableListHTML += `<tr>
<td>${j+1}</td>
<td>${mappingDetails[j].complaint_type}</td>
<td>${mappingDetails[j].off_nm} (${mappingDetails[j].off_id})</td>
<td>${convertdate(mappingDetails[j].mappedOn)}</td>
<td>${complaint_status}</td>
</tr>`;
// Check if the status is "pending"
if (mappingDetails[j].complaint_status === "pending") {
// Increment the count
pendingCount++;
}
else if(mappingDetails[j].complaint_status === "close"){
completedCount++;
}
}
var listOfComplaintsHTML = `<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th>S.no</th>
<th>Complaint</th>
<th>Assigned To</th>
<th>Assigned On</th>
<th>Status</th>
</tr>
</thead>
<tbody>
${tableListHTML}
</tbody>
</table>`;
$("#listOfComplaintsHTML").html(listOfComplaintsHTML);
$("#total_complaints_value").html(`<b>${totalCount}</b>`);
$("#total_complaints_completed_value").html(`<b style="color:green">${completedCount}</b>`);
$("#total_complaints_pending_value").html(`<b style="color:red">${pendingCount}</b>`);
}).catch(function(error) {
// Handle errors
console.error('Error fetching Mapping Data ('+petitionId+'):', error.message);
});
}
/* Get Petition details by petition number */
function get_petition_mapping_list() {
var formData = new FormData();
var apiUrl = '/gcc/api/c_petition/getComplaintListByPetitionId?petitionId='+petitionId;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
if(jsonResponse.length>0){
resolve(jsonResponse);
}else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});
});
}
function call_petition_search_from(errorTXT){
var errorHTML = "";
if(errorTXT!=""){
errorHTML = `<div class="form-group text-center text-danger">${errorTXT}</div>`;
}
var searchFormHTML = `<form class="search-form" id="search-form" onsubmit="return searchRequest();">
<div class="card-header">
<h3>View Petition Form</h3>
<div class="card-header-right">
<h3 th:utext="'Petition No: '+${petitionNo}+''"></h3>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 text-center">
${errorHTML}
<div class="form-group">
<label for="petitionNoSearch">Petition No / மனு எண் </label>
<input type="text" class="form-control text-center" name="petitionNoSearch" id="petitionNoSearch" autocomplete="off" placeholder="CP00000000" maxlength="10" required>
</div>
</div>
<div class="col-12">
<div class="block-content" id="userinfo2">
<div id="comp_mapping_to_officers" class="row"></div>
</div>
</div>
</div>
</div>
<div class="card-footer text-center">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="searchSubmitBtn"><i class="ik ik-search"></i>Search</button>
</div>
</form>`;
$("#petitionViewtable").html(searchFormHTML);
$("#petitionNoSearch").mask('MP00000000');
}
function searchRequest(){
var searchValue = $('#petitionNoSearch').val();
if (searchValue && searchValue.trim() !== '') {
searchValue = encodeBase64(searchValue);
window.location.href = "/gcc/c_petition/view-petition?petitionNo="+searchValue;
}
else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
return false;
}
</script>
<script>
$(document).ready(function() {
if(petitionNo!=null && petitionNo!="error"){
get_complaint_type_data();
get_officer_master_data();
}
else{
if(petitionNo=="error"){
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
else{
call_petition_search_from("");
}
}
});
</script>

338
src/main/resources/templates/fragments/modules/c_petition/script.html

@ -0,0 +1,338 @@
<script src="node_modules/jquery.mask/1.14.16/jquery.mask.min.js"></script>
<script th:inline="javascript">
var nodata = nodata();
var baseURL = "/gcc/c_petition/";
/* Complaint Type List */
function get_complaint_type_list() {
var apiUrl = '/gcc/api/c_petition/getComplaintTypes';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Officer Master List */
function get_officer_list() {
var apiUrl = '/gcc/api/c_petition/getOfficerList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
function viewAck(petitionNo){
loading_text_msg = getLoadingMessage(); // get Loading random text
$('#ackModalTitle').html("Loading Petition Acknowledgement ("+petitionNo+")");
var loading=searchinfo("<b>"+loading_text_msg+"</b>");
var ackContentHTML=`
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack1table" class="ack-content">
<div id="ack1">${loading}</div>
</div>
</div>
</div>
<div class="col-lg-6 printack2">
<div class="block block-rounded ack ack-container">
<div id="ack2table" class="ack-content">
<div id="ack2">${loading}</div>
</div>
</div>
</div>
<!--<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>-->
</div>`;
$('#ackModalBody').html(ackContentHTML); // Box content (Body)
$("#ackModalBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
get_petition_ack_data(petitionNo);
return false;
}
/* Get Petition data */
function get_petition_ack_data(petitionNo){
get_petition_details_byNo(petitionNo).then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint_txt;
var complaintArray = complaint.split(',');
for(j = 0; j < complaintArray.length; j++){
if(j>0){
complaintHTML+="<br>";
}
complaintHTML+= (j+1)+') '+complaintArray[j];
}
var ack =`
<table class="table table-borderless table-vcenter p-0 m-0">
<tbody>
<tr>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
<td class="fw-semibold text-center">
<b>பெருநகர சென்னை மாநகராட்சி | Greater Chennai Corporation<br>
மக்களை தேடி மேயர் திட்டம்<br>
ஒப்புகை சீட்டு / Acknowledgement Receipt</b>
</td>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
</tr>
</tbody>
</table>
<hr style="margin:0px">
<div class="block-content p-0 m-0">
<table class="table table-borderless table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${convertdate(petitionDetails[0].cdate)}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petition_no}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_name}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_mobile}
</td>
</tr>
<tr style="font-size:12px;">
<th style="padding: 0.45rem 0.45rem;">புகாரின் தன்மை / Nature of complaint:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintHTML}
</td>
</tr>
<tr>
<td scope="row" colspan="2" style="font-size:10px">இம்மனுவின் ஒப்புகைச் சீட்டு எண் மனு தாரரின் கைபேசி எண்ணிற்கு குறுஞ்செய்தி மூலம் அனுப்பி வைக்கப்படும் . இம்மனுவின் நிலை குறித்து https://chennaicorporation.gov.in/MTM/ என்ற இணையதளத்தில் மனுவின் எண்ணை குறிப்பிட்டு அறிந்துகொள்ளலாம்</th>
</tr>
<tr style="text-align: right;">
<th scope="row" colspan="2" style="padding: 0.45rem 0.45rem;">வட்டார அலுவலகம்<br>Office of the Regional Deputy Commissioner</th>
</tr>
</tbody>
</table>
</div>`;
$('#ackModalTitle').html("Acknowledgement Of Petition ("+petitionNo+")");
$("#ack1").html(ack);
$("#ack2").html(ack);
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition details ('+petitionNo+'):', error);
});
}
/* Get Petition details by petition number */
function get_petition_details_byNo(petitionNo) {
var apiUrl = '/gcc/api/c_petition/getPetitionDetails?petitionNo='+petitionNo
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
/* Get Petition details by petition number */
function get_complaint_details_byId(mapId) {
var apiUrl = '/gcc/api/c_petition/getComplaintDetails?mapId='+mapId
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
/* Get Petition details by petition number */
function get_complaint_action_byId(mapId) {
var apiUrl = '/gcc/api/c_petition/getComplaintActionDetails?mapId='+mapId
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
/* File View */
function viewFile(fileOf,fileName,fileType){
$("#viewFileTitle").html("View File ("+fileName+")"); // Title for the Modal Box
var fileUrl = "/gcc/files/c_petition/";
if(fileOf=="petition")
{
fileUrl=fileUrl+fileName;
}
else if(fileOf="action"){
fileUrl=fileUrl+"m_action_file/"+fileName;
}
else{
fileUrl=fileUrl+"invaliedFile.txt"; // For File Not Exits Default file name
}
checkFileExists(fileUrl).then(exists => {
if (exists) {
if(fileType=='application/pdf'){
var fileHTML = `<iframe src="${fileUrl}" type="application/pdf" width="100%" height="600px"></iframe>`;
}
else if(fileType=='application/octet-stream'){
fileHTML =`<p class='text-danger m-0 p-0'>File Preview not avaiable.<br>Try to download and view.</p>`;
}
else{
fileHTML =`<img src="${fileUrl}" alt="${fileType}" width="100%">`;
}
} else {
console.log('File does not exist');
fileHTML = `<p class='text-danger m-0 p-0'>File does not exist</p>`;
}
$("#viewFileBoxBody").html(fileHTML); // Modal Box Body
$("#viewFileBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
});
}
/* Downlaod file */
function downloadFile(fileOf,fileName,fileType){
$("#viewFileTitle").html("View File ("+fileName+")"); // Title for the Modal Box
var fileUrl = "/gcc/files/c_petition/";
if(fileOf=="petition")
{
fileUrl=fileUrl+fileName;
callDownload(fileUrl,fileName);
}
else if(fileOf="action"){
fileUrl=fileUrl+"m_action_file/"+fileName;
callDownload(fileUrl,fileName);
}
else{
fileUrl=fileUrl+"invaliedFile.txt"; // For File Not Exits Default file name
}
}
/* Show Complaint forward Modal */
function forward_compliant(mapId,title){
var compmapHTML =`<div class="col-12" id="comp${mapId}">
<div class="widget mb-0">
<div class="widget-header" style="background-color:#2a807f;color:#fff;">
<h3 class="widget-title" style="font-size:13px;">${title}</h3>
</div>
<div class="widget-body">
<div class="form-group">
<label for="dept${mapId}">Select Department Type</label>
<select name="dept[]" id="dept${mapId}" class="form-control" onchange="javascript:calloffice(this.value,${mapId})">
<option value="0">Select Department</option>
<option value="1">GCC Department</option>
<option value="2">External Department</option>
</select>
</div>
<div id="officedata${mapId}"></div>
<div id="officers${mapId}"></div>
</div>
</div>
</div>`;
$("#forwardModalBody").html(compmapHTML); // Modal Box Body
$("#forwardModalBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
}
</script>

19
src/main/resources/templates/fragments/modules/c_petition/search_form.html

@ -0,0 +1,19 @@
<div class="row">
<div class="col-12 mb-2">
<div class="input-group mb-0">
<span class="input-group-prepend">
<button type="button" id="filter_reset_btn" class="btn btn-success" onclick="callReSetEventId(0);" data-toggle="tooltip" data-animation="true" data-placement="top" data-original-title="Reset" title="Reset">
<i class="ik ik-refresh-ccw"></i>
</button>
</span>
<select class="form-control" id="search_department_id" name="search_department_id">
<option value="0">All Department`s</option>
</select>
<span class="input-group-append">
<button type="button" id="filter_search_btn" class="btn btn-success" onclick="callSetEventId();" data-toggle="tooltip" data-animation="true" data-placement="top" data-original-title="Search" title="Search">
<i class="ik ik-search me-1"></i> Search
</button>
</span>
</div>
</div>
</div>

116
src/main/resources/templates/fragments/modules/m_petition/modal-box.html

@ -0,0 +1,116 @@
<!-- Box 1 -->
<div class="modal fade" id="ackModalBox" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title m-0" id="ackModalTitle">Modal Title</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="ackModalBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 2 -->
<div class="modal fade" id="ComplaintStatusBox" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title m-0" id="complaint-title">புகார் நிலை / Complaint Status:</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="ComplaintStatusBoxBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 3 -->
<div class="modal fade" id="viewFileBox" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #28a745 !important;">
<h6 class="modal-title m-0" id="viewFileTitle">View File</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="viewFileBoxBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 4 -->
<div class="modal fade" id="viewpetition" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #28a745 !important;">
<h6 class="modal-title m-0" id="viewPetitionTitle">View Petition</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="viewPetitionBoxBody">
<iframe id="iframe" width="100%" height="400px" src=""></iframe>
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->
<!-- Box 0 common -->
<div class="modal fade" id="forwardModalBox" data-backdrop="static" tabindex="1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #28a745 !important;">
<h6 class="modal-title m-0" id="forwardModalTitle">Modal Title</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div><!--end modal-header-->
<div class="modal-body">
<div id="forwardModalBody">
</div>
</div><!--end modal-body-->
<div class="modal-footer bg-body">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialog-->
</div><!--end modal-->
<!-- END Page Content -->

291
src/main/resources/templates/fragments/modules/m_petition/petition_view_script.html

@ -0,0 +1,291 @@
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var petitionNo = /*[[${petitionNo}]]*/'';
var petitionId = 0;
var closedComplaintsList=[];
var complaintTypeList = "";
var officerMasterList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// Call Petition function to fetch the data
get_petition_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Officer Master Data */
function get_officer_master_data(){
get_officer_list().then(function(officers) {
// Handle the officer list
officerMasterList = officers;
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
});
}
// Function to get complaint_type and complaint_typeid by complaint_typeid
function getComplaintTypeById(complaintTypeId) {
for (var i = 0; i < complaintTypeList.length; i++) {
if (complaintTypeList[i].complaint_typeid == complaintTypeId) {
return {
complaint_type: complaintTypeList[i].complaint_type,
complaint_typeid: complaintTypeList[i].complaint_typeid
};
}
}
return null; // Return null if no matching complaint_typeid is found
}
/* Get Petition data */
function get_petition_data(){
get_petition_details().then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint;
petitionId = petitionDetails[0].petition_id;
var complaintArray = complaint.split(",");
$("#complaintType").val(complaintArray);
$('#complaintType').trigger('change');
closedComplaintsList = complaintArray;
$("#cdate_value").html(convertdate(petitionDetails[0].cdate));
$("#petition_no_value").html(petitionDetails[0].petition_no);
$("#petitioner_name_value").html(petitionDetails[0].petitioner_name);
$("#petitioner_mobile_value").html(petitionDetails[0].petitioner_mobile);
$("#petitioner_address_value").html(petitionDetails[0].petitioner_address);
$("#petitioner_pincode_value").html(petitionDetails[0].petitioner_pincode);
$("#complaint_with_maping_value").html(petitionDetails[0].complaint_nature);
var petition_status = petitionDetails[0].status
if(petition_status=='pending' || petition_status=='partial'){
$("#petition_summary_title").html("Pending Summary");
var currentDate = new Date();
var totaldayspending = date_difference(convertdate(petitionDetails[0].cdate),convertdate(currentDate),'');
$("#petition_summary_html").html(`This petition has been pending for more than ${totaldayspending}`);
}
if(petition_status=='close'){
$("#petition_summary_title").html("Close Summary");
var currentDate = new Date();
var totaldayspending = date_difference(convertdate(petitionDetails[0].cdate),convertdate(currentDate),'');
$("#petition_summary_html").html(`The time taken to close this petition is ${totaldayspending}`);
}
petition_status=petition_status.charAt(0).toUpperCase() + petition_status.slice(1);
$("#petition_status_value").html(`<b style="color:red">${petition_status}</b>`);
// Call Complaint list based on Petition No and Id
get_petition_mapping_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition Data ('+petitionNo+'):', error.message);
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
});
}
/* Get Petition details by petition number */
function get_petition_details() {
var formData = new FormData();
formData.append('petitionNo',petitionNo);
var apiUrl = '/gcc/api/m_petition/getPetitionDetails?petitionNo='+petitionNo;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
if(jsonResponse.length>0){
resolve(jsonResponse);
}else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});
});
}
function get_petition_mapping_data(){
get_petition_mapping_list().then(function(mappingDetails) {
// Initialize count
let totalCount = mappingDetails.length;
let completedCount = 0;
let pendingCount = 0;
var tableListHTML = "";
for(j = 0; j < mappingDetails.length; j++){
var complaint_status=mappingDetails[j].complaint_status;
complaint_status=complaint_status.charAt(0).toUpperCase() + complaint_status.slice(1);
tableListHTML += `<tr>
<td>${j+1}</td>
<td>${mappingDetails[j].complaint_type}</td>
<td>${mappingDetails[j].off_nm} (${mappingDetails[j].off_id})</td>
<td>${convertdate(mappingDetails[j].mappedOn)}</td>
<td>${complaint_status}</td>
</tr>`;
// Check if the status is "pending"
if (mappingDetails[j].complaint_status === "pending") {
// Increment the count
pendingCount++;
}
else if(mappingDetails[j].complaint_status === "close"){
completedCount++;
}
}
var listOfComplaintsHTML = `<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th>S.no</th>
<th>Complaint</th>
<th>Assigned To</th>
<th>Assigned On</th>
<th>Status</th>
</tr>
</thead>
<tbody>
${tableListHTML}
</tbody>
</table>`;
$("#listOfComplaintsHTML").html(listOfComplaintsHTML);
$("#total_complaints_value").html(`<b>${totalCount}</b>`);
$("#total_complaints_completed_value").html(`<b style="color:green">${completedCount}</b>`);
$("#total_complaints_pending_value").html(`<b style="color:red">${pendingCount}</b>`);
}).catch(function(error) {
// Handle errors
console.error('Error fetching Mapping Data ('+petitionId+'):', error.message);
});
}
/* Get Petition details by petition number */
function get_petition_mapping_list() {
var formData = new FormData();
var apiUrl = '/gcc/api/m_petition/getComplaintListByPetitionId?petitionId='+petitionId;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
if(jsonResponse.length>0){
resolve(jsonResponse);
}else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});
});
}
function call_petition_search_from(errorTXT){
var errorHTML = "";
if(errorTXT!=""){
errorHTML = `<div class="form-group text-center text-danger">${errorTXT}</div>`;
}
var searchFormHTML = `<form class="search-form" id="search-form" onsubmit="return searchRequest();">
<div class="card-header">
<h3>View Petition Form</h3>
<div class="card-header-right">
<h3 th:utext="'Petition No: '+${petitionNo}+''"></h3>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 text-center">
${errorHTML}
<div class="form-group">
<label for="petitionNoSearch">Petition No / மனு எண் </label>
<input type="text" class="form-control text-center" name="petitionNoSearch" id="petitionNoSearch" autocomplete="off" placeholder="MP00000000" maxlength="10" required>
</div>
</div>
<div class="col-12">
<div class="block-content" id="userinfo2">
<div id="comp_mapping_to_officers" class="row"></div>
</div>
</div>
</div>
</div>
<div class="card-footer text-center">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="searchSubmitBtn"><i class="ik ik-search"></i>Search</button>
</div>
</form>`;
$("#petitionViewtable").html(searchFormHTML);
$("#petitionNoSearch").mask('MP00000000');
}
function searchRequest(){
var searchValue = $('#petitionNoSearch').val();
if (searchValue && searchValue.trim() !== '') {
searchValue = encodeBase64(searchValue);
window.location.href = "/gcc/m_petition/view-petition?petitionNo="+searchValue;
}
else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
return false;
}
</script>
<script>
$(document).ready(function() {
if(petitionNo!=null && petitionNo!="error"){
get_complaint_type_data();
get_officer_master_data();
}
else{
if(petitionNo=="error"){
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
else{
call_petition_search_from("");
}
}
});
</script>

360
src/main/resources/templates/fragments/modules/m_petition/script.html

@ -0,0 +1,360 @@
<script src="node_modules/jquery.mask/1.14.16/jquery.mask.min.js"></script>
<script th:inline="javascript">
var nodata = nodata();
var baseURL = "/gcc/m_petition/";
/* Complaint Type List */
function get_complaint_type_list() {
var apiUrl = '/gcc/api/m_petition/getComplaintTypes';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Officer Master List */
function get_officer_list() {
var apiUrl = '/gcc/api/m_petition/getOfficerList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Petition Type List */
function get_petition_type_list() {
var apiUrl = '/gcc/api/m_petition/getPetitionTypes';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
function viewAck(petitionNo){
loading_text_msg = getLoadingMessage(); // get Loading random text
$('#ackModalTitle').html("Loading Petition Acknowledgement ("+petitionNo+")");
var loading=searchinfo("<b>"+loading_text_msg+"</b>");
var ackContentHTML=`
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack1table" class="ack-content">
<div id="ack1">${loading}</div>
</div>
</div>
</div>
<div class="col-lg-6 printack2">
<div class="block block-rounded ack ack-container">
<div id="ack2table" class="ack-content">
<div id="ack2">${loading}</div>
</div>
</div>
</div>
<!--<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>-->
</div>`;
$('#ackModalBody').html(ackContentHTML); // Box content (Body)
$("#ackModalBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
get_petition_ack_data(petitionNo);
return false;
}
/* Get Petition data */
function get_petition_ack_data(petitionNo){
get_petition_details_byNo(petitionNo).then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint_txt;
var complaintArray = complaint.split(',');
for(j = 0; j < complaintArray.length; j++){
if(j>0){
complaintHTML+="<br>";
}
complaintHTML+= (j+1)+') '+complaintArray[j];
}
var ack =`
<table class="table table-borderless table-vcenter p-0 m-0">
<tbody>
<tr>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
<td class="fw-semibold text-center">
<b>பெருநகர சென்னை மாநகராட்சி | Greater Chennai Corporation<br>
மக்களை தேடி மேயர் திட்டம்<br>
ஒப்புகை சீட்டு / Acknowledgement Receipt</b>
</td>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
</tr>
</tbody>
</table>
<hr style="margin:0px">
<div class="block-content p-0 m-0">
<table class="table table-borderless table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${convertdate(petitionDetails[0].cdate)}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petition_no}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_name}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_mobile}
</td>
</tr>
<tr style="font-size:12px;">
<th style="padding: 0.45rem 0.45rem;">புகாரின் தன்மை / Nature of complaint:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintHTML}
</td>
</tr>
<tr>
<td scope="row" colspan="2" style="font-size:10px">இம்மனுவின் ஒப்புகைச் சீட்டு எண் மனு தாரரின் கைபேசி எண்ணிற்கு குறுஞ்செய்தி மூலம் அனுப்பி வைக்கப்படும் . இம்மனுவின் நிலை குறித்து https://chennaicorporation.gov.in/MTM/ என்ற இணையதளத்தில் மனுவின் எண்ணை குறிப்பிட்டு அறிந்துகொள்ளலாம்</th>
</tr>
<tr style="text-align: right;">
<th scope="row" colspan="2" style="padding: 0.45rem 0.45rem;">வட்டார அலுவலகம்<br>Office of the Regional Deputy Commissioner</th>
</tr>
</tbody>
</table>
</div>`;
$('#ackModalTitle').html("Acknowledgement Of Petition ("+petitionNo+")");
$("#ack1").html(ack);
$("#ack2").html(ack);
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition details ('+petitionNo+'):', error);
});
}
/* Get Petition details by petition number */
function get_petition_details_byNo(petitionNo) {
var apiUrl = '/gcc/api/m_petition/getPetitionDetails?petitionNo='+petitionNo
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
/* Get Petition details by petition number */
function get_complaint_details_byId(mapId) {
var apiUrl = '/gcc/api/m_petition/getComplaintDetails?mapId='+mapId
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
/* Get Petition details by petition number */
function get_complaint_action_byId(mapId) {
var apiUrl = '/gcc/api/m_petition/getComplaintActionDetails?mapId='+mapId
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
/* File View */
function viewFile(fileOf,fileName,fileType){
$("#viewFileTitle").html("View File ("+fileName+")"); // Title for the Modal Box
var fileUrl = "/gcc/files/m_petition/";
if(fileOf=="petition")
{
fileUrl=fileUrl+fileName;
}
else if(fileOf="action"){
fileUrl=fileUrl+"m_action_file/"+fileName;
}
else{
fileUrl=fileUrl+"invaliedFile.txt"; // For File Not Exits Default file name
}
checkFileExists(fileUrl).then(exists => {
if (exists) {
if(fileType=='application/pdf'){
var fileHTML = `<iframe src="${fileUrl}" type="application/pdf" width="100%" height="600px"></iframe>`;
}
else if(fileType=='application/octet-stream'){
fileHTML =`<p class='text-danger m-0 p-0'>File Preview not avaiable.<br>Try to download and view.</p>`;
}
else{
fileHTML =`<img src="${fileUrl}" alt="${fileType}" width="100%">`;
}
} else {
console.log('File does not exist');
fileHTML = `<p class='text-danger m-0 p-0'>File does not exist</p>`;
}
$("#viewFileBoxBody").html(fileHTML); // Modal Box Body
$("#viewFileBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
});
}
/* Downlaod file */
function downloadFile(fileOf,fileName,fileType){
$("#viewFileTitle").html("View File ("+fileName+")"); // Title for the Modal Box
var fileUrl = "/gcc/files/m_petition/";
if(fileOf=="petition")
{
fileUrl=fileUrl+fileName;
callDownload(fileUrl,fileName);
}
else if(fileOf="action"){
fileUrl=fileUrl+"m_action_file/"+fileName;
callDownload(fileUrl,fileName);
}
else{
fileUrl=fileUrl+"invaliedFile.txt"; // For File Not Exits Default file name
}
}
/* Show Complaint forward Modal */
function forward_compliant(mapId,title){
var compmapHTML =`<div class="col-12" id="comp${mapId}">
<div class="widget mb-0">
<div class="widget-header" style="background-color:#2a807f;color:#fff;">
<h3 class="widget-title" style="font-size:13px;">${title}</h3>
</div>
<div class="widget-body">
<div class="form-group">
<label for="dept${mapId}">Select Department Type</label>
<select name="dept[]" id="dept${mapId}" class="form-control" onchange="javascript:calloffice(this.value,${mapId})">
<option value="0">Select Department</option>
<option value="1">GCC Department</option>
<option value="2">External Department</option>
</select>
</div>
<div id="officedata${mapId}"></div>
<div id="officers${mapId}"></div>
</div>
</div>
</div>`;
$("#forwardModalBody").html(compmapHTML); // Modal Box Body
$("#forwardModalBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
}
</script>

19
src/main/resources/templates/fragments/modules/m_petition/search_form.html

@ -0,0 +1,19 @@
<div class="row">
<div class="col-12 mb-2">
<div class="input-group mb-0">
<span class="input-group-prepend">
<button type="button" id="filter_reset_btn" class="btn btn-success" onclick="callReSetEventId(0);" data-toggle="tooltip" data-animation="true" data-placement="top" data-original-title="Reset" title="Reset">
<i class="ik ik-refresh-ccw"></i>
</button>
</span>
<select class="form-control" id="search_department_id" name="search_department_id">
<option value="0">All Department`s</option>
</select>
<span class="input-group-append">
<button type="button" id="filter_search_btn" class="btn btn-success" onclick="callSetEventId();" data-toggle="tooltip" data-animation="true" data-placement="top" data-original-title="Search" title="Search">
<i class="ik ik-search me-1"></i> Search
</button>
</span>
</div>
</div>
</div>

2
src/main/resources/templates/fragments/modules/pgr/script.html

@ -1,5 +1,5 @@
<script th:inline="javascript"> <script th:inline="javascript">
var nodata = `<center><img src="/assets/images/nodata_ani.gif" width="40%"><br><p class="text-warning">Data are not availble at this moment please check later</p></center>`;
var nodata = nodata();//`<center><img src="/assets/images/nodata_ani.gif" width="40%"><br><p class="text-warning">Data are not availble at this moment please check later</p></center>`;
var baseURL = "/gcc/pgr/"; var baseURL = "/gcc/pgr/";

163
src/main/resources/templates/index.html

@ -24,8 +24,8 @@
<div class="page-header-title"> <div class="page-header-title">
<i class="ik ik-bar-chart-2 bg-blue"></i> <i class="ik ik-bar-chart-2 bg-blue"></i>
<div class="d-inline"> <div class="d-inline">
<h5>Main Module Name</h5>
<span>Any Discription needed pls add here :) </span>
<h5>Dashboard</h5>
<span>Main Dashboard of GCC App</span>
</div> </div>
</div> </div>
</div> </div>
@ -42,12 +42,50 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3>Page Title</h3>
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="widget">
<div class="widget-header">
<h3 class="widget-title">My Details</h3>
<div class="widget-tools pull-right">
</div>
</div>
<div class="widget-body" style="" id="basicUserProfile">
The body of the widget
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="widget">
<div class="widget-header">
<h3 class="widget-title">தினம் ஒரு திருக்குறள்:</h3>
<div class="widget-tools pull-right text-right">
<img src="/gcc/files/app_uploads/icons/thiruvalluvar.jpeg" width="15%" class="rounded-circle">
</div>
</div> </div>
<div class="card-body">
<div class="widget-body">
<table>
<tr>
<td clas="text-center" width="20%"><img src="/gcc/files/app_uploads/icons/thiruvalluvar.jpeg" width="90%" class="rounded"></td>
<td>
<div class="mb-0" style="font-size:20px;">அகர முதல எழுத்தெல்லாம</div>
<div class="mb-0" style="font-size:20px;">ஆதி பகவன் முதற்றே உலக</div>
<div class="mb-0 text-right">( குறள் எண் : 6 ) | <a href="javascript:void(0);" class="link"> விளக்கம்</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="widget">
<div class="widget-header">
<h3 class="widget-title">Your Info</h3>
<div class="widget-tools pull-right"></div>
</div>
<div class="widget-body" id="">
</div> </div>
</div> </div>
@ -58,20 +96,10 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>Datatable Test</h3>
<h3>User Profile</h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="col-sm-12"><table id="example" class="table table-striped table-bordered table-hover nowrap dataTable" role="grid" aria-describedby="simpletable_info">
<thead class="thead-dark">
<tr role="row"><th class="sorting_asc" tabindex="0" aria-controls="simpletable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 178.258px;">Name</th><th class="sorting" tabindex="0" aria-controls="simpletable" rowspan="1" colspan="1" aria-label="Position: activate to sort column ascending" style="width: 268.727px;">Position</th><th class="sorting" tabindex="0" aria-controls="simpletable" rowspan="1" colspan="1" aria-label="Office: activate to sort column ascending" style="width: 129.852px;">Office</th><th class="sorting" tabindex="0" aria-controls="simpletable" rowspan="1" colspan="1" aria-label="Age: activate to sort column ascending" style="width: 72.1875px;">Age</th><th class="sorting" tabindex="0" aria-controls="simpletable" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="width: 135.57px;">Start date</th><th class="sorting" tabindex="0" aria-controls="simpletable" rowspan="1" colspan="1" aria-label="Salary: activate to sort column ascending" style="width: 96.4062px;">Salary</th></tr>
</theadclass="thead-dark">
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr><th rowspan="1" colspan="1">Name</th><th rowspan="1" colspan="1">Position</th><th rowspan="1" colspan="1">Office</th><th rowspan="1" colspan="1">Age</th><th rowspan="1" colspan="1">Start date</th><th rowspan="1" colspan="1">Salary</th></tr>
</tfoot>
</table></div>
<div class="col-sm-12" id="userProfile"></div>
</div> </div>
</div> </div>
</div> </div>
@ -88,5 +116,102 @@
<script th:replace="~{fragments/modules/base/script :: script}"></script> <script th:replace="~{fragments/modules/base/script :: script}"></script>
<script th:inline="javascript">
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
var createdBy = /*[[${LoginUserId}]]*/'';
//alert(createdBy);
// Loading Div id
const loading = $("#userProfile");
function call_loading(){
loading.html(searchinfo("<b>"+loading_text_msg+"</b>"));
}
function remove_loading(){
loading.html("");
}
/* Get Complaints Data */
function get_user_basic_data(){
var apiUrl = '/gcc/api/getUserProfileBasic?userId='+createdBy;
//alert(apiUrl);
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
/*dataType: 'json',*/
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Complaints List */
function get_user_basic_info(){
get_user_basic_data().then(function(userProfile) {
// Handle the userProfile
$("#basicUserProfile").html(userProfile);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching User Profile:', error.message);
} else {
console.error('An error occurred while fetching user profile:', error);
}
});
}
/* Get Complaints Data */
function get_user_data(){
var apiUrl = '/gcc/api/getUserProfile?userId='+createdBy;
//alert(apiUrl);
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
/*dataType: 'json',*/
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Complaints List */
function get_user_info(){
get_user_data().then(function(userProfile) {
// Handle the userProfile
$("#userProfile").html(userProfile);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching User Profile:', error.message);
} else {
console.error('An error occurred while fetching user profile:', error);
}
});
}
$(document).ready(function() {
call_loading();
get_user_info();
get_user_basic_info();
});
</script>
</body> </body>
</html> </html>

2
src/main/resources/templates/modules/admin/user-group-access.html

@ -238,7 +238,7 @@
var submitCheckedData = function(checkedData, groupId) { var submitCheckedData = function(checkedData, groupId) {
// Perform your AJAX request here using checkedData // Perform your AJAX request here using checkedData
// Replace the URL and other options with your actual API endpoint and data // Replace the URL and other options with your actual API endpoint and data
const apiUrl = "/api/saveGroupAccessData";
const apiUrl = "/gcc/api/saveGroupAccessData";
const selectedGroup = $('#search_groupid'); const selectedGroup = $('#search_groupid');
const selectedGroupName = selectedGroup.find('option:selected').text(); const selectedGroupName = selectedGroup.find('option:selected').text();

2
src/main/resources/templates/modules/admin/user-list.html

@ -202,7 +202,7 @@
} }
function getUserDetails(userid){ function getUserDetails(userid){
const apiUrl = "/api/getUserProfile";
const apiUrl = "/gcc/api/getUserProfile";
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
$.ajax({ $.ajax({
url: apiUrl, url: apiUrl,

750
src/main/resources/templates/modules/c_petition/complaint_list.html

@ -0,0 +1,750 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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>Complaint List</h5>
<span>Councillor 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">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">Complaint 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>
<table id="complaintDatatable" 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">Name</th>
<th class="text-center">Mobile</th>
<th class="text-center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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">Status</th>
<th class="text-center">Department Officer</th>
<th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Petition No.</th>
<th class="text-center">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department Officer</th>
<th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/c_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/c_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("");
}
/* Get Complaints Data */
function get_complaint_data(){
var apiUrl = '/gcc/api/c_petition/getComplaintList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Officer Master Data */
function get_officer_master_data(){
get_officer_list().then(function(officers) {
// Handle the officer list
officerMasterList = officers;
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
});
}
/* Get Complaints List */
function get_complaint_list(){
get_complaint_data().then(function(complaintList) {
// Handle the complaint list
generate_table(complaintList);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching complaint list:', error.message);
} else {
console.error('An error occurred while fetching complaint list:', error);
}
});
}
function viewPetitionSummary(petitionNo){
$("#viewpetition").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
var url = '/gcc/c_petition/view-petition-modal?petitionNo='+petitionNo;
$.ajax({
url: url,
type: 'GET',
dataType: 'html',
success: function(data) {
$('#viewPetitionBoxBody').html(data); // Inject content into modal body
},
error: function(xhr, status, error) {
console.error("Error loading URL:", error);
// Handle error, display a message, etc.
}
});
return false;
}
function updateStatus(mapId){
$("#ComplaintStatusBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
callComplaintDetails(mapId);
return false;
}
function callComplaintDetails(mapId){
loading_text_msg = getLoadingMessage(); // get Loading random text
var loading=searchinfo("<b>"+loading_text_msg+"</b>");
var complaintContentHTML=`
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded">
<div id="leftContainer">${loading}</div>
</div>
</div>
<div class="col-lg-6 printack2">
<div class="block block-rounded">
<div id="rightContainer">${loading}</div>
</div>
</div>
<!--<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>-->
</div>`;
$('#ComplaintStatusBoxBody').html(complaintContentHTML); // Box content (Body)
getComplaintData(mapId);
}
function getComplaintData(mapId){
get_complaint_details_byId(mapId).then(function(complaintDetails) {
var complaintStatus = complaintDetails[0].status;
var statusBadge = complaintStatus.charAt(0).toUpperCase() + complaintStatus.slice(1);
var refRibben = `<div class="card-header-right" style="top:auto;">
Ref ID: ${mapId}
</div>`;
var statusRibben = "";
if(complaintStatus=='pending'){
statusRibben = `<div class="ribbon">
<div class="wrap">
<span class="ribbon6 bg-danger"><div styel="color:#fff;">${statusBadge}</div></span>
</div>
</div>`;
statusRibben = "";
statusBadge = `<span class="badge badge-danger" style="font-size:10px;padding:0.25em 0.4em;">${statusBadge}</span>`;
}
else if(complaintStatus=='close'){
statusBadge = `<span class="badge badge-success" style="font-size:10px;padding:0.25em 0.4em;">${statusBadge}</span>`;
}
var complaintRightBody = "";
var complaintLeftBody = `<div class="card mb-0">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Complaint Details</h3>
${statusRibben}
</div>
<div class="card-body">
<table class="table table-borderless table-vcenter mb-0" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${convertdate(complaintDetails[0].cdate)}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintDetails[0].petition_no}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintDetails[0].petitioner_name}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintDetails[0].petitioner_mobile}
</td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;">புகாரின் தன்மை / Nature of complaint:<br><p class="fw-semibold mb-0" style="font-weight:normal;">${complaintDetails[0].complaint_nature}</p></th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;">
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th>Complaint <i class="fa fa-arrow-right"></i> Status</th>
<th class="text-right" id="complaint_forward_link"><a href="javascript:void(0);" onclick="return forward_compliant(${complaintDetails[0].mapid}, '${complaintDetails[0].complaint_type}');" class="link" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Click here to forward this complaint to another department officer."><i class="far fa-share-square"></i> Click to forward </a></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="fw-semibold">
${complaintDetails[0].complaint_type} <i class="fa fa-arrow-right"></i> ${statusBadge} <i class="fa fa-arrow-right"></i> ${complaintDetails[0].off_nm}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>`;
$('#leftContainer').html(complaintLeftBody);
if(complaintStatus!='close'){
complaintRightBody =`<form class="action-form" id="action-form" onsubmit="return saveandclose();" enctype="multipart/form-data">
<div class="card mb-0">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Complaint Update Details</h3>
${refRibben}
</div>
<div class="card-body">
<div class="form-group">
<label for="complaintActionText">நடவடிக்கை / Action:</label>
<textarea class="form-control" id="complaintActionText" name="complaintActionText" rows="6" maxlength="250" placeholder="புகாரின் தன்மை..." required></textarea>
</div>
<div class="form-group">
<label for="action_san_page1">ஆவணப் பதிவேற்றம் / Document Upload:</label>
<input name="action_san_page1" id="action_san_page1" class="form-control" type="file" capture="camera" accept="application/pdf, image/*" required>
</div>
<div class="form-group mb-0 text-center">
<button type="button" class="btn btn-sm rounded-pill btn-hero btn-success me-1" onclick="javascript:saveandclose(${mapId},${complaintDetails[0].petition_id},'${complaintDetails[0].petition_no}');" id="updatebtn"><i class="ik ik-save"></i> Save and Close </button>
</div>
</div>
</div>
</form>`;
$('#rightContainer').html(complaintRightBody);
}
else{
// first remove forward link
$("#complaint_forward_link").html("");
get_complaint_action_byId(mapId).then(function(complaintAction) {
var fileType = complaintAction[0].file_type;
fileType = fileType.split("/").pop();
var filetypeico = "file-lines";
if(fileType=='pdf'){
filetypeico = "file-pdf";
}
else{
filetypeico = "file-image";
}
complaintRightBody =`<form class="action-form" id="action-form" onsubmit="return saveandclose();" enctype="multipart/form-data">
<div class="card mb-0">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Complaint Update Details</h3>
${refRibben}
</div>
<div class="card-body">
<div>
<b>நடவடிக்கை தேதி / Action Date:</b> ${convertdate(complaintAction[0].cdate)}
<hr>
<b>நடவடிக்கை / Action:</b><br>
<p class="mt-10">${complaintAction[0].comments}</p>
</div>
<hr>
<div class="like-comm mt-20 mb-0">
<b>ஆவணப் பதிவேற்றம் / Document Upload:</b><br>
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th>S.no</th>
<th>File Name</th>
<th>Size</th>
<th>Type</th>
<th><i class="ik ik-more-horizontal"></i></th>
</tr>
</thead>
<tbody>
<tr>
<td class="fw-semibold">1</td>
<td class="fw-semibold">${complaintAction[0].file_name}</td>
<td class="fw-semibold">${formatFileSize(complaintAction[0].file_size)}</td>
<td class="fw-semibold">${fileType}</td>
<td class="fw-semibold">
<a href="javascript:void(0)" class="link mr-10" onclick="downloadFile('action','${complaintAction[0].file_name}','${complaintAction[0].file_type}');" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Download File"><i class="fa fa-fw fa-download" style="font-size: 18px;"></i></a>
<a href="javascript:void(0)" class="link mr-10" onclick="viewFile('action','${complaintAction[0].file_name}','${complaintAction[0].file_type}');" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View File"><i class="far fa-3x fa-${filetypeico}" style="font-size: 18px;"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</form>`;
$('#rightContainer').html(complaintRightBody);
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
}).catch(function(error) {
// Handle errors
console.error('Error fetching action details ('+mapId+'):', error);
});
}
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
}).catch(function(error) {
// Handle errors
console.error('Error fetching Complaint details ('+mapId+'):', error);
});
}
/* Call DataTable function */
function generate_table(data){
var table = $('#complaintDatatable').DataTable( {
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', "orderable": false },
{ targets: 'no-exportable', "exportable": false }
],
lengthMenu: [
[ 50, 100, 200, 500, -1 ],
[ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
],
/*scrollY: '50vh',*/
fixedColumns: {
left: 0,
right: 0
},
buttons: [buttons],
responsive: true,
searching: false,
select: false,
processing: false,
} );
// Clearn Table data
table.clear().draw();
// Add rows to DataTable
var rowNum = 1;
$.each(data, function(index, row) {
var complaint_status=row["status"];
complaint_status=complaint_status.charAt(0).toUpperCase() + complaint_status.slice(1);
actionHTML = `<div class="dropdown d-inline-block show">
<a class="nav-link dropdown-toggle" href="#" id="moreDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="ik ik-more-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="moreDropdown" x-placement="bottom-end">
Action for: `+row['petition_no']+`
<a class="dropdown-item" href="" onclick="return viewAck('`+row['petition_no']+`');" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View Acknowledgement"><i class="ik ik-eye"></i> Acknowledgement</a>
<a class="dropdown-item" href="/gcc/c_petition/petition-ack/`+row['petition_no']+`" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Print Acknowledgement"><i class="ik ik-printer"></i> Acknowledgement</a>
</div>
</div>`
table.row.add([
rowNum++,
'<a href="/gcc/c_petition/update-petition?petitionNo='+row['petitionNoEncode']+'" onclick="return viewPetitionSummary(\''+row['petitionNoEncode']+'\');">'+row['petition_no']+'</a>',
row['petitioner_name'],
row['petitioner_mobile'],
row['petitioner_address'],
row['petitioner_pincode'],
row['complaint_type'],
convertdate(row['cdate']),
'<a href="#" onclick="return updateStatus('+row['mapid']+');" style="text-transform: capitalize;"">'+complaint_status+'</a>',
row['off_nm'],
actionHTML
]).draw(false);
});
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
remove_loading(); // remove Loading
}
// Save New Action
function saveandclose(mapId,petitionId,petitionNo){
// Disable the button to prevent multiple clicks
form_btn_disable();
var comments = $('#complaintActionText');
var textLength = comments.val().length;
comments.removeClass('is-invalid');
var fileInput = $("#action_san_page1");
fileInput.removeClass('is-invalid');
var selectedFile = fileInput.val();
if (textLength>=10 && selectedFile) {
// Serialize form data
var formData = new FormData($('#action-form')[0]);
formData.append('createdBy',createdBy);
formData.append('mapId',mapId);
formData.append('petitionId',petitionId);
formData.append('petitionNo',petitionNo);
formData.append('complaintStatus','close');
saveActionFormData(formData).then(function(response) {
if(response!="error"){
// Handle the response
Swal.fire({
title: 'Complaint action saved successfully.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'success',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
$("#ComplaintStatusBox").modal('hide');
}
});
}
else{
// Handle the response
// if response == "error"
Swal.fire({
title: 'Failed to save complaint action. Please try again!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error on save petition:', error.message);
form_btn_enable();
});
}
else{
if(textLength<10){
comments.addClass('is-invalid');
}
if (!selectedFile) {
fileInput.addClass('is-invalid');
}
form_btn_enable();
}
return false;
}
function saveActionFormData(formData){
var apiUrl = '/gcc/api/c_petition/saveComplanitStatus';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
function form_btn_enable(){
$("#updatebtn").prop("disabled", false);
$("#updatebtn").html('<i class="ik ik-save"></i> Save and Close ');
}
function form_btn_disable(){
$("#updatebtn").prop("disabled", true);
// Show the loading icon on the button
$("#updatebtn").html('<i class="fas fa-spinner fa-spin"></i> Validating your request, please wait...');
}
// For Complient Map Select HTML
function calloffice(val,id){
if(val==1){ // Intenal
var officeSelectHTML = `<div class="mb-4">
<label for="office${id}">Select Office</label>
<select name="office[]" id="office${id}" class="form-control" onchange="javascript:callofficers(this.value,${id})">
<option value="0">Select Office</option>
<option value="1">HQ</option>
<option value="2">Zonal Office</option>
</select>
</div>`;
$("#officedata"+id).html(officeSelectHTML);
}
else if(val==2){ // External
$("#officers"+id).html('');
var ExSelectHTML = getselect(id,"ExSelect");
var departmentSelectHTML = `<div class="mb-4">
<label for="dept3">Select Department</label>
${ExSelectHTML}
</div>`;
$("#officedata"+id).html(departmentSelectHTML);
}
else{
$("#officedata"+id).html('');
$("#officers"+id).html('');
}
$("#officers"+id).html('');
}
function callofficers(val,id){
if(val==1){
// HQ
var HQSelectHTML = getselect(id,"HQSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${HQSelectHTML}</div>`);
}
else if(val==2){
// Zone Office
var ZoneSelectHTML = getselect(id,"ZoneSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${ZoneSelectHTML}</div>`);
}
else{
$("#officers"+id).html('');
}
}
function getselect(comid,type){
var HQSelect = '';
var ZoneSelect = '';
var ExSelect = '';
for (var i = 0; i < officerMasterList.length; i++) {
if(officerMasterList[i].zone_id=="HQ"){
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else if(officerMasterList[i].zone_id=="99"){
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else{
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
// Forward Save Button
var forward_Btn = `<div class="col-12 pt-3 mb-0 pb-0" id="submitdiv">
<label class="form-label" for="forwardcomp">Forward Comments</label>
<textarea class="js-maxlength form-control" id="forwardcomp" name="forwardcomp" rows="6" maxlength="250" placeholder="கருத்துகள்..." data-always-show="true" data-placement="right" th:utext="" required></textarea>
<div class="text-center pt-3">
<button type="button" class="btn btn-sm rounded-pill btn-hero btn-success me-1" onclick="javascript:saveForward(${comid});" id="updatebtn"><i class="si si-rocket me-1"></i> Save and Forward</button>
<div id="forwardFormError" class="text-danger"></div>
</div>
</div>`;
if(type=="HQSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${HQSelect}</select>${forward_Btn}`;
}
if(type=="ZoneSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ZoneSelect}</select>${forward_Btn}`;
}
if(type=="ExSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ExSelect}</select>${forward_Btn}`;
}
return '';
}
$(document).ready(function() {
call_loading();
get_officer_master_data();
get_complaint_list();
});
</script>
</body>
</html>

267
src/main/resources/templates/modules/c_petition/new_petition.html

@ -0,0 +1,267 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>Add New Petition</h5>
<span>Councillor Petition</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="index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item" aria-current="page">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">Add Petition</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="card">
<form class="request-form" id="request-form" onsubmit="return saveRequest();" enctype="multipart/form-data">
<div class="card-header"><h3>New Petition Form</h3></div>
<div class="card-body">
<div class="form-group">
<label for="petitionerName">Petitioner's Name / மனுதாரரின் பெயர்</label>
<input type="text" class="form-control" name="petitionerName" id="petitionerName" autocomplete="off" placeholder="மனுதாரரின் பெயர்" maxlength="250" required>
</div>
<div class="form-group">
<label for="petitionerMobile">Mobile NO / கைபேசி எண்</label>
<input type="text" class="js-maxlength form-control" id="petitionerMobile" name="petitionerMobile" autocomplete="off" placeholder="கைபேசி எண்" maxlength="10" data-always-show="true" data-placement="top" required>
</div>
<div class="form-group">
<label for="complaintType">Type of complaint / புகார் வகை (பலவற்றை தேர்ந்தெடு..) </label>
<select class="select2" id="complaintType" name="complaintType" style="width: 100%;" data-placeholder="பலவற்றை தேர்ந்தெடு.." multiple required>
<option th:each="complaintType : ${complaintTypesList}" th:value="${complaintType.complaintTypeId}" th:text="${complaintType.complaintType}"></option>
</select>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="san_page1">Petition Page 1 / மனு பக்கம் 1</label>
<input name="san_page1" id="san_page1" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="san_page2">Petition Page 2 / மனு பக்கம் 2</label>
<input name="san_page2" id="san_page2" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="san_page3">Petition Page 3 / மனு பக்கம் 3</label>
<input name="san_page3" id="san_page3" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="san_page4">Petition Page 4 / மனு பக்கம் 4</label>
<input name="san_page4" id="san_page4" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
</div>
</div>
<div class="card-footer text-right">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="requestSubmitBtn"><i class="ik ik-save"></i>Save</button>
</div>
</form>
</div>
</div>
<div class="col-md-2"></div>
</div>
</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 th:replace="~{fragments/modules/c_petition/script :: script}"></script>
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var complaintTypeList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// Iterate through the department list and add options to the select element
$.each(complaintTypeList, function(index, complaintType) {
// Create an option element
var option = $('<option>', {
value: complaintType.complaint_typeid, // case-sensitive as per object
text: complaintType.complaint_type
});
// Append the option to the select element
$('#complaintType').append(option);
});
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
// Save New petition
function saveRequest(){
// Disable the button to prevent multiple clicks
form_btn_disable();
var inputElementMobileNo = $('#petitionerMobile');
var mobileNo = inputElementMobileNo.val();
var mobileFormatRegex = /^\d{10}$/; //'0000000000';
inputElementMobileNo.removeClass('is-invalid');
var inputElementComplaintType = $('#complaintType');
var complaintType = inputElementComplaintType.val();
if (mobileNo !== null && mobileFormatRegex.test(mobileNo) && mobileNo.length == 10) {
// Serialize form data
var formData = new FormData($('#request-form')[0]);
formData.append('createdBy',createdBy);
saveFormData(formData).then(function(response) {
if(response!="error"){
// Handle the response
Swal.fire({
title: 'Petition data saved successfully.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'success',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
// Reload the current page
//location.reload();
// Navigate to a Ack page
window.location = "/gcc/c_petition/petition-ack/"+response;
}
});
}
else{
// Handle the response
// if response == "error"
Swal.fire({
title: 'Failed to save petition data. Please try again!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error on save petition:', error.message);
form_btn_enable();
});
}
else{
inputElementMobileNo.addClass('is-invalid');
form_btn_enable();
}
return false;
}
function saveFormData(formData){
var apiUrl = '/gcc/api/c_petition/savePetition';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
function form_btn_enable(){
$("#resetFormBtn").prop("disabled", false);
$("#requestSubmitBtn").prop("disabled", false);
$("#requestSubmitBtn").html('<i class="ik ik-save"></i>Save');
}
function form_btn_disable(){
$("#resetFormBtn").prop("disabled", true);
$("#requestSubmitBtn").prop("disabled", true);
// Show the loading icon on the button
$("#requestSubmitBtn").html('<i class="fas fa-spinner fa-spin"></i> Validating your request, please wait...');
}
$(document).ready(function() {
get_complaint_type_data();
$('#petitionerMobile').mask('0000000000');
});
</script>
</body>
</html>

237
src/main/resources/templates/modules/c_petition/petition_ack.html

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5 th:utext="'Petition Acknowledgement ('+${petitionNo}+')'">Petition Acknowledgement</h5>
<span>Councillor Petition</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="index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item" aria-current="page">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">Petition Acknowledgement</li>
</ol>
</nav>
</div>
</div>
</div>
<hr class="print_no">
<!--
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack1table" style="border: 1px solid black;">
<div id="ack1"></div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack2table" style="border: 1px solid black;">
<div id="ack2"></div>
</div>
</div>
</div>
<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>
</div>
-->
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack1table" class="ack-content">
<div id="ack1">This is ack1</div>
</div>
</div>
</div>
<div class="col-lg-6 printack2">
<div class="block block-rounded ack ack-container">
<div id="ack2table" class="ack-content">
<div id="ack2">This is ack2</div>
</div>
</div>
</div>
<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>
</div>
</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 th:replace="~{fragments/modules/c_petition/script :: script}"></script>
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var petitionNo = /*[[${petitionNo}]]*/'';
var complaintTypeList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// After Complaint Type list created we call petition details
get_petition_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Petition data */
function get_petition_data(){
get_petition_details().then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint_txt;
var complaintArray = complaint.split(',');
for(j = 0; j < complaintArray.length; j++){
if(j>0){
complaintHTML+="<br>";
}
complaintHTML+= (j+1)+') '+complaintArray[j];
}
var ack =`
<table class="table table-borderless table-vcenter p-0 m-0">
<tbody>
<tr>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
<td class="fw-semibold text-center">
<b>பெருநகர சென்னை மாநகராட்சி | Greater Chennai Corporation<br>
மக்களை தேடி மேயர் திட்டம்<br>
ஒப்புகை சீட்டு / Acknowledgement Receipt</b>
</td>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
</tr>
</tbody>
</table>
<hr style="margin:0px">
<div class="block-content p-0 m-0">
<table class="table table-borderless table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${convertdate(petitionDetails[0].cdate)}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petition_no}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_name}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_mobile}
</td>
</tr>
<tr style="font-size:12px;">
<th style="padding: 0.45rem 0.45rem;">புகாரின் தன்மை / Nature of complaint:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintHTML}
</td>
</tr>
<tr>
<td scope="row" colspan="2" style="font-size:10px">இம்மனுவின் ஒப்புகைச் சீட்டு எண் மனு தாரரின் கைபேசி எண்ணிற்கு குறுஞ்செய்தி மூலம் அனுப்பி வைக்கப்படும் . இம்மனுவின் நிலை குறித்து https://chennaicorporation.gov.in/MTM/ என்ற இணையதளத்தில் மனுவின் எண்ணை குறிப்பிட்டு அறிந்துகொள்ளலாம்</th>
</tr>
<tr style="text-align: right;">
<th scope="row" colspan="2" style="padding: 0.45rem 0.45rem;">வட்டார அலுவலகம்<br>Office of the Regional Deputy Commissioner</th>
</tr>
</tbody>
</table>
`;
$("#ack1").html(ack);
$("#ack2").html(ack);
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition details ('+petitionNo+'):', error);
});
}
/* Get Petition details by petition number */
function get_petition_details() {
var formData = new FormData();
formData.append('petitionNo',petitionNo);
var apiUrl = '/gcc/api/c_petition/getPetitionDetails?petitionNo='+petitionNo;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
$(document).ready(function() {
get_complaint_type_data();
});
</script>
</body>
</html>

282
src/main/resources/templates/modules/c_petition/petition_list.html

@ -0,0 +1,282 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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>Petition List</h5>
<span>Councillor 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">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">Petition 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>
<table id="petitionDatatable" 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">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Petition No.</th>
<th class="text-center">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/c_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/c_petition/script :: script}"></script>
<script th:inline="javascript">
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
// 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
}
}
];
function call_loading(){
loading.html(searchinfo("<b>"+loading_text_msg+"</b>"));
}
function remove_loading(){
loading.html("");
}
/* Get Complaints Data */
function get_petitions_data(){
var apiUrl = '/gcc/api/c_petition/getPetitionList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Complaints List */
function get_petitions_list(){
get_petitions_data().then(function(petitionList) {
// Handle the department list
generate_table(petitionList);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching petition list:', error.message);
} else {
console.error('An error occurred while fetching petition list:', error);
}
});
}
/* Call DataTable function */
function generate_table(data){
var table = $('#petitionDatatable').DataTable( {
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', "orderable": false },
{ targets: 'no-exportable', "exportable": false }
],
lengthMenu: [
[ 50, 100, 200, 500, -1 ],
[ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
],
scrollY: '50vh',
fixedColumns: {
left: 0,
right: 0
},
buttons: [buttons],
responsive: true,
searching: false,
select: false,
processing: false,
} );
// Clearn Table data
table.clear().draw();
// Add rows to DataTable
var rowNum = 1;
$.each(data, function(index, row) {
//View Acknowledgement: View the acknowledgement for petition MP10000001.
//Print Acknowledgement: Print the acknowledgement for petition MP10000001.
//View Petition Details: View the details of petition MP10000001.
//View Uploaded Files: View the files uploaded for petition MP10000001.
actionHTML = `<div class="dropdown d-inline-block show">
<a class="nav-link dropdown-toggle" href="#" id="moreDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="ik ik-more-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="moreDropdown" x-placement="bottom-end">
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View the acknowledgement for petition `+row['petition_no']+`."><i class="ik ik-eye"></i> View Acknowledgement</a>
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Print the acknowledgement for petition `+row['petition_no']+`."><i class="ik ik-printer"></i> Print Acknowledgement</a>
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View the details of petition `+row['petition_no']+`."><i class="ik ik-eye"></i> View Petition Details</a>
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View the files uploaded for petition `+row['petition_no']+`."><i class="ik ik-eye"></i> View Uploaded Files</a>
</div>
</div>`
table.row.add([
rowNum++,
'<a href="/gcc/c_petition/update-petition?petitionNo='+row['petitionNoEncode']+'">'+row['petition_no']+'</a>',
row['petitioner_name'],
row['petitioner_mobile'],
row['petitioner_address'],
row['petitioner_pincode'],
row['petitioner_complaint_txt'],
convertdate(row['cdate']),
row['status'],
row['created_by'],
actionHTML
]).draw(false);
});
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
remove_loading(); // remove Loading
}
$(document).ready(function() {
call_loading();
get_petitions_list();
});
</script>
</body>
</html>

267
src/main/resources/templates/modules/c_petition/petition_not_mapped_list.html

@ -0,0 +1,267 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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>Unmapped Petition List</h5>
<span>Councillor 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">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">Unmapped Petition List</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3>These are the petitions that are currently not assigned to any department officer:</h3>
</div>
<div class="card-block">
<div id="tableLoading"></div>
<div>
<table id="petitionDatatable" 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">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Petition No.</th>
<th class="text-center">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/c_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/c_petition/script :: script}"></script>
<script th:inline="javascript">
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
// 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
}
}
];
function call_loading(){
loading.html(searchinfo("<b>"+loading_text_msg+"</b>"));
}
function remove_loading(){
loading.html("");
}
/* Get Complaints Data */
function get_petitions_data(){
var apiUrl = '/gcc/api/c_petition/getUnmapPetitionList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Complaints List */
function get_petitions_list(){
get_petitions_data().then(function(petitionList) {
// Handle the department list
generate_table(petitionList);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching petition list:', error.message);
} else {
console.error('An error occurred while fetching petition list:', error);
}
});
}
/* Call DataTable function */
function generate_table(data){
var table = $('#petitionDatatable').DataTable( {
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', "orderable": false },
{ targets: 'no-exportable', "exportable": false }
],
lengthMenu: [
[ 50, 100, 200, 500, -1 ],
[ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
],
scrollY: '50vh',
fixedColumns: {
left: 0,
right: 0
},
buttons: [buttons],
responsive: true,
searching: false,
select: false,
processing: false,
} );
// Clearn Table data
table.clear().draw();
// Add rows to DataTable
var rowNum = 1;
$.each(data, function(index, row) {
table.row.add([
rowNum++,
'<a href="/gcc/c_petition/update-petition?petitionNo='+row['petitionNoEncode']+'">'+row['petition_no']+'</a>',
row['petitioner_name'],
row['petitioner_mobile'],
row['petitioner_address'],
row['petitioner_pincode'],
row['petitioner_complaint_txt'],
convertdate(row['cdate']),
row['status'],
row['created_by'],
'<a href="" onclick="return viewAck(\''+row['petition_no']+'\');"data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View Ack"><i class="far fa-handshake"></i></a>',
]).draw(false);
});
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
remove_loading(); // remove Loading
}
$(document).ready(function() {
call_loading();
get_petitions_list();
});
</script>
</body>
</html>

719
src/main/resources/templates/modules/c_petition/petition_update.html

@ -0,0 +1,719 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>Edit / Update Petition</h5>
<span>Councillor Petition</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="index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item" aria-current="page">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">Edit/Update Petition</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-12">
<div class="card" id="petitionUpdateForm">
<form class="update-request-form" id="update-request-form" onsubmit="return updateRequest();">
<div class="card-header">
<h3>Edit / Update Petition Form</h3>
<div class="card-header-right">
<h3 th:utext="'Petition No: '+${petitionNo}+''"></h3>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
<div class="form-group">
<label for="petitionerName">Petitioner's Name / மனுதாரரின் பெயர்</label>
<input type="text" class="form-control" name="petitionerName" id="petitionerName" autocomplete="off" placeholder="மனுதாரரின் பெயர்" maxlength="250" required>
</div>
<div class="form-group">
<label for="petitionerMobile">Mobile NO / கைபேசி எண்</label>
<input type="text" class="form-control" id="petitionerMobile" name="petitionerMobile" autocomplete="off" placeholder="கைபேசி எண்" maxlength="10" required>
</div>
<div class="form-group">
<label for="complaintNature">புகாரின் தன்மை / Nature Of Complaint</label>
<textarea class="form-control" id="complaintNature" name="complaintNature" rows="6" maxlength="250" placeholder="புகாரின் தன்மை..."></textarea>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label for="petitionerAddress">Address of petitioner / மனுதாரரின் முகவரி</label>
<textarea class="form-control" id="petitionerAddress" name="petitionerAddress" rows="6" maxlength="250" placeholder="மனுதாரரின் முகவரி..."></textarea>
</div>
<div class="form-group">
<label for="petitionerPincode">Postal code / தபால் குறியீடு</label>
<input type="text" class="form-control" id="petitionerPincode" name="petitionerPincode" placeholder="தபால் குறியீடு" maxlength="6" required>
</div>
<div class="form-group">
<label for="complaintType">Type of complaint / புகார் வகை (பலவற்றை தேர்ந்தெடு..) </label>
<select class="select2" id="complaintType" name="complaintType" style="width: 100%;" data-placeholder="பலவற்றை தேர்ந்தெடு.." multiple required onchange="javascript:load_mapper();">
<option></option>
</select>
</div>
</div>
<div class="col-12">
<div class="block-content" id="userinfo2">
<div id="comp_mapping_to_officers" class="row"></div>
</div>
</div>
</div>
</div>
<div class="card-footer text-right">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="requestSubmitBtn"><i class="ik ik-save"></i>Save</button>
</div>
</form>
</div>
</div>
</div>
</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 th:replace="~{fragments/modules/c_petition/script :: script}"></script>
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var petitionNo = /*[[${petitionNo}]]*/'';
var petitionId = 0;
var closedComplaintsList=[];
var complaintTypeList = "";
var officerMasterList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// Iterate through the Master Complanint Type and add options to the select element
$.each(complaintTypeList, function(index, complaintType) {
// Create an option element
var option = $('<option>', {
value: complaintType.complaint_typeid, // case-sensitive as per object
text: complaintType.complaint_type
});
// Append the option to the select element
$('#complaintType').append(option);
});
// Call Petition function to fetch the data
get_petition_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Officer Master Data */
function get_officer_master_data(){
get_officer_list().then(function(officers) {
// Handle the officer list
officerMasterList = officers;
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
});
}
// Function to get complaint_type and complaint_typeid by complaint_typeid
function getComplaintTypeById(complaintTypeId) {
for (var i = 0; i < complaintTypeList.length; i++) {
if (complaintTypeList[i].complaint_typeid == complaintTypeId) {
return {
complaint_type: complaintTypeList[i].complaint_type,
complaint_typeid: complaintTypeList[i].complaint_typeid
};
}
}
return null; // Return null if no matching complaint_typeid is found
}
// Save New petition
function updateRequest(){
// Disable the button to prevent multiple clicks
form_btn_disable();
var inputElementMobileNo = $('#petitionerMobile');
var mobileNo = inputElementMobileNo.val();
var mobileFormatRegex = /^\d{10}$/; //'0000000000';
inputElementMobileNo.removeClass('is-invalid');
var inputElementComplaintType = $('#complaintType');
var complaintType = inputElementComplaintType.val();
if (mobileNo !== null && mobileFormatRegex.test(mobileNo) && mobileNo.length == 10) {
// Serialize form data
var formData = new FormData($('#update-request-form')[0]);
formData.append('petitionNo',petitionNo);
formData.append('createdBy',createdBy);
formData.append('petitionId',petitionId);
updateFormData(formData).then(function(response) {
// Handle the response
if(response==true){
// Delete Old data in Petition Mapping table
savePetitionMapData(formData).then(function(response) {
if(response==true){
Swal.fire({
title: 'Petition updated successfully!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'success',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
else{
Swal.fire({
title: 'Petition details have been updated, but mapping the complaint to the officer has failed.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'warning',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
form_btn_enable();
});
}
else{
Swal.fire({
title: 'Failed to update petition details!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error on save petition:', error.message);
form_btn_enable();
});
}
else{
inputElementMobileNo.addClass('is-invalid');
form_btn_enable();
}
return false;
}
function updateFormData(formData){
var apiUrl = '/gcc/api/c_petition/updatePetition';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
function savePetitionMapData(formData){
var apiUrl = '/gcc/api/c_petition/mapComplientToOfficer';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
/* Get Petition data */
function get_petition_data(){
get_petition_details().then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint;
petitionId = petitionDetails[0].petition_id;
var complaintArray = complaint.split(",");
$("#complaintType").val(complaintArray);
$('#complaintType').trigger('change');
closedComplaintsList = complaintArray;
$("#petitionerName").val(petitionDetails[0].petitioner_name);
$("#petitionerMobile").val(petitionDetails[0].petitioner_mobile);
$("#petitionerAddress").val(petitionDetails[0].petitioner_address);
$("#petitionerPincode").val(petitionDetails[0].petitioner_pincode);
$("#complaintNature").val(petitionDetails[0].complaint_nature);
//load_mapper(); // Call for Complaint Mapping Form
// IDs of the values you want to prevent from being deselected
var valuesToPreventDeselection = closedComplaintsList;//['value1', 'value2', 'value3'];
$('#complaintType').on('select2:unselect', function (e) {
var deselectedValue = e.params.data.id;
// Check if the deselected value should be prevented from being deselected
if (valuesToPreventDeselection.includes(deselectedValue)) {
// Prevent the deselection
e.preventDefault();
// Re-select the deselected value to prevent it from being deselected
$(this).val(valuesToPreventDeselection).trigger('change.select2');
// Optionally, you can display a message or perform any other action
console.log('Deselection of value ' + deselectedValue + ' prevented');
alert('Deselection of value ' + deselectedValue + ' prevented');
}
});
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition Data ('+petitionNo+'):', error.message);
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
});
}
/* Get Petition details by petition number */
function get_petition_details() {
var formData = new FormData();
formData.append('petitionNo',petitionNo);
var apiUrl = '/gcc/api/c_petition/getPetitionDetails?petitionNo='+petitionNo;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
if(jsonResponse.length>0){
resolve(jsonResponse);
}else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});
});
}
function load_mapper(){
var complaintArray = $("#complaintType").val();
//var complaintArray = complaint.split(',');
var compPetitionNo = petitionNo;
var compPetitionId = petitionId;
var compmapHTML='';
for(j = 0; j < complaintArray.length; j++){
var complaintTypeDetails = getComplaintTypeById(complaintArray[j]); // Pass the complaint_typeid
var title=(j+1)+') '+ complaintTypeDetails.complaint_type; // Map form title
var compID="comp"+j;
var complaintTypeId = complaintTypeDetails.complaint_typeid;
getMappingByComplaintsID(complaintTypeId);
compmapHTML+=`<div class="col-lg-6" id="comp${complaintArray[j]}">
<div class="widget">
<div class="widget-header" style="background-color:#2a807f;color:#fff;">
<h3 class="widget-title" style="font-size:13px;">${title}</h3>
</div>
<div class="widget-body">
<div class="form-group">
<label for="dept${complaintArray[j]}">Select Department Type</label>
<select name="dept[]" id="dept${complaintArray[j]}" class="form-control" onchange="javascript:calloffice(this.value,${complaintArray[j]})">
<option value="0">Select Department</option>
<option value="1">GCC Department</option>
<option value="2">External Department</option>
</select>
</div>
<div id="officedata${complaintArray[j]}"></div>
<div id="officers${complaintArray[j]}"></div>
</div>
</div>
</div>`;
}
$('#comp_mapping_to_officers').html(compmapHTML);
}
</script>
<script>
// For Complient Map Select HTML
function calloffice(val,id){
if(val==1){ // Intenal
var officeSelectHTML = `<div class="mb-4">
<label for="office${id}">Select Office</label>
<select name="office[]" id="office${id}" class="form-control" onchange="javascript:callofficers(this.value,${id})">
<option value="0">Select Office</option>
<option value="1">HQ</option>
<option value="2">Zonal Office</option>
</select>
</div>`;
$("#officedata"+id).html(officeSelectHTML);
}
else if(val==2){ // External
$("#officers"+id).html('');
var ExSelectHTML = getselect(id,"ExSelect");
var departmentSelectHTML = `<div class="mb-4">
<label for="dept3">Select Department</label>
${ExSelectHTML}
</div>`;
$("#officedata"+id).html(departmentSelectHTML);
}
else{
$("#officedata"+id).html('');
$("#officers"+id).html('');
}
$("#officers"+id).html('');
}
function callofficers(val,id){
if(val==1){
// HQ
var HQSelectHTML = getselect(id,"HQSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${HQSelectHTML}</div>`);
}
else if(val==2){
// Zone Office
var ZoneSelectHTML = getselect(id,"ZoneSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${ZoneSelectHTML}</div>`);
}
else{
$("#officers"+id).html('');
}
}
function getselect(comid,type){
var HQSelect = '';
var ZoneSelect = '';
var ExSelect = '';
for (var i = 0; i < officerMasterList.length; i++) {
if(officerMasterList[i].zone_id=="HQ"){
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else if(officerMasterList[i].zone_id=="99"){
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else{
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
if(type=="HQSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${HQSelect}</select>`;
}
if(type=="ZoneSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ZoneSelect}</select>`;
}
if(type=="ExSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ExSelect}</select>`;
}
return '';
}
function form_btn_enable(){
$("#resetFormBtn").prop("disabled", false);
$("#requestSubmitBtn").prop("disabled", false);
$("#requestSubmitBtn").html('<i class="ik ik-save"></i>Save');
}
function form_btn_disable(){
$("#resetFormBtn").prop("disabled", true);
$("#requestSubmitBtn").prop("disabled", true);
// Show the loading icon on the button
$("#requestSubmitBtn").html('<i class="fas fa-spinner fa-spin"></i> Validating your request, please wait...');
}
function getMappingByComplaintsID(complaintTypeId){
$.ajax({
type: "GET",
url: '/gcc/api/c_petition/getComplaintMappingDetails',
data: {
'petitionId': petitionId,
'petitionNo': petitionNo,
'complaintTypeId': complaintTypeId
},
dataType: 'json',
}).done(function(response) {
//console.log(response);
if(response.length>0){
var comid = response[0]["complaint_typeid"];
var offid = response[0]["off_id"];
var mapid = response[0]["mapid"];
loadSelectforUpdate(comid,offid,comid);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
// Log the error and any relevant information
console.error("Error sending request: " + textStatus + " " + errorThrown);
});
}
function loadSelectforUpdate(comid,offid,id){
var type ="NULL";
var HQSelect = '';
var ZoneSelect = '';
var ExSelect = '';
for (var i = 0; i < officerMasterList.length; i++) {
//console.log(officerMasterList[i]);
if(officerMasterList[i].zone_id=="HQ"){
if(offid>0 && officerMasterList[i].off_id == offid){
type = "HQSelect";
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}" selected>${officerMasterList[i].off_nm}</option>`;
}
else{
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
else if(officerMasterList[i].zone_id=="99"){
if(offid>0 && officerMasterList[i].off_id == offid){
type = "ExSelect";
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}" selected>${officerMasterList[i].off_nm}</option>`;
}
else{
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
else{
if(offid>0 && officerMasterList[i].off_id == offid){
type = "ZoneSelect";
//console.log(type + " === "+ officerMasterList[i].offId +" == "+ offid);
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}" selected>${officerMasterList[i].off_nm}</option>`;
}
else{
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
}
//console.log("comid : "+comid +",\noffid : "+offid+",\nid : "+id+",\ntype : "+type);
if(type=="HQSelect"){
//console.log("I am from HQSelect: \n #officers"+id);
$("#officedata"+id).html('<div class="mb-4">' +
'<label for="office$'+id+'">Select Office</label>' +
'<select name="office[]" id="office$'+id+'" class="form-control" onchange="javascript:callofficers(this.value,'+id+')">' +
'<option value="0">Select Office</option>' +
'<option value="1" Selected>HQ</option>' +
'<option value="2">Zonal Office</option>' +
'</select>' +
'</div>');
HQSelectHTML = `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${HQSelect}</select>`;
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${comid}">Select Department</label>${HQSelectHTML}</div>`);
}
if(type=="ZoneSelect"){
//console.log("I am from ZoneSelect: \n #officers"+id);
$("#officedata"+id).html('<div class="mb-4">' +
'<label for="office$'+id+'">Select Office</label>' +
'<select name="office[]" id="office$'+id+'" class="form-control" onchange="javascript:callofficers(this.value,'+id+')">' +
'<option value="0">Select Office</option>' +
'<option value="1">HQ</option>' +
'<option value="2" Selected>Zonal Office</option>' +
'</select>' +
'</div>');
ZoneSelectHTML = `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ZoneSelect}</select>`;
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${comid}">Select Department</label>${ZoneSelectHTML}</div>`);
}
if(type=="ExSelect"){
//console.log("I am from ExSelect: \n #officers"+id);
ExSelectHTML = `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ExSelect}</select>`;
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${comid}">Select Department</label>${ExSelectHTML}</div>`);
}
}
function call_petition_search_from(errorTXT){
var errorHTML = "";
if(errorTXT!=""){
errorHTML = `<div class="form-group text-center text-danger">${errorTXT}</div>`;
}
var searchFormHTML = `<form class="search-form" id="search-form" onsubmit="return searchRequest();">
<div class="card-header">
<h3>Edit / Update Petition Form</h3>
<div class="card-header-right">
<h3 th:utext="'Petition No: '+${petitionNo}+''"></h3>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 text-center">
${errorHTML}
<div class="form-group">
<label for="petitionNoSearch">Petition No / மனு எண் </label>
<input type="text" class="form-control text-center" name="petitionNoSearch" id="petitionNoSearch" autocomplete="off" placeholder="CP00000000" maxlength="10" required>
</div>
</div>
<div class="col-12">
<div class="block-content" id="userinfo2">
<div id="comp_mapping_to_officers" class="row"></div>
</div>
</div>
</div>
</div>
<div class="card-footer text-center">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="searchSubmitBtn"><i class="ik ik-search"></i>Search</button>
</div>
</form>`;
$("#petitionUpdateForm").html(searchFormHTML);
$('#petitionNoSearch').mask('MP00000000');
}
function searchRequest(){
var searchValue = $('#petitionNoSearch').val();
if (searchValue && searchValue.trim() !== '') {
searchValue = encodeBase64(searchValue);
window.location.href = "/gcc/c_petition/update-petition?petitionNo="+searchValue;
}
else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
return false;
}
</script>
<script>
$(document).ready(function() {
if(petitionNo!=null && petitionNo!="error"){
get_complaint_type_data();
get_officer_master_data();
}
else{
if(petitionNo=="error"){
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
else{
call_petition_search_from("");
}
}
});
</script>
</body>
</html>

158
src/main/resources/templates/modules/c_petition/petition_view.html

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>View Petition</h5>
<span>Councillor Petition</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="index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item" aria-current="page">Councillor Petition</li>
<li class="breadcrumb-item active" aria-current="page">View Petition</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-12">
<div class="card mb-0" id="petitionViewtable">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Petition Details</h3>
<div class="card-header-right text-center block-options pt-10" style="padding-right: 20px;">
<a href="javascript:void(0);" onclick="window.print()" class="link"><i class="ik ik-printer"></i> Print</a>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date: </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="cdate_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petition_no_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_name_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_mobile_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Address of petitioner / மனுதாரரின் முகவரி:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_address_value"></td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;">புகாரின் தன்மை / Nature of complaint:<br>
<p class="fw-semibold mb-0" style="font-weight:normal;" id="complaint_nature_value"></p>
</th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;" id="complaint_with_maping_value"></td>
</tr>
</tbody>
</table>
</div>
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">Petition Status: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_status_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total number of complaints in this petition: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Completed:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_completed_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Pending:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_pending_value"></td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th id="petition_summary_title">Pending Summary</th>
</tr>
</thead>
<tbody>
<tr style="background-color:#fbffe0;">
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_summary_html"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card-title">List of Complaints in this Petition and Their Status:</div>
<div id="listOfComplaintsHTML"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</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 th:replace="~{fragments/modules/m_petition/script :: script}"></script>
<script th:replace="~{fragments/modules/m_petition/petition_view_script :: script}"></script>
</body>
</html>

108
src/main/resources/templates/modules/c_petition/petition_view_modal_page.html

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<body>
<div class="row">
<div class="col-12">
<div class="card mb-0" id="petitionViewtable">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Petition Details</h3>
<div class="card-header-right text-center block-options pt-10" style="padding-right: 20px;">
<a href="javascript:void(0);" onclick="window.print()" class="link"><i class="ik ik-printer"></i> Print</a>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date: </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="cdate_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petition_no_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_name_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_mobile_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">மனுதாரரின் முகவரி / Address of petitioner:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_address_value"></td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;">புகாரின் தன்மை / Nature of complaint:<br>
<p class="fw-semibold mb-0" style="font-weight:normal;" id="complaint_nature_value"></p>
</th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;" id="complaint_with_maping_value"></td>
</tr>
</tbody>
</table>
</div>
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">Petition Status: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_status_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total number of complaints in this petition: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Completed:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_completed_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Pending:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_pending_value"></td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th id="petition_summary_title">Pending Summary</th>
</tr>
</thead>
<tbody>
<tr style="background-color:#fbffe0;">
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_summary_html"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card-title">List of Complaints in this Petition and Their Status:</div>
<div id="listOfComplaintsHTML"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script th:replace="~{fragments/modules/c_petition/script :: script}"></script>
<script th:replace="~{fragments/modules/c_petition/petition_view_script :: script}"></script>
</body>
</html>

750
src/main/resources/templates/modules/m_petition/complaint_list.html

@ -0,0 +1,750 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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>Complaint 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">Complaint 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>
<table id="complaintDatatable" 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">Name</th>
<th class="text-center">Mobile</th>
<th class="text-center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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">Status</th>
<th class="text-center">Department Officer</th>
<th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Petition No.</th>
<th class="text-center">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department Officer</th>
<th class="text-center no-sort no-exportable no-print"><i class="ik ik-more-horizontal"></i></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/m_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/m_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("");
}
/* Get Complaints Data */
function get_complaint_data(){
var apiUrl = '/gcc/api/m_petition/getComplaintList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Officer Master Data */
function get_officer_master_data(){
get_officer_list().then(function(officers) {
// Handle the officer list
officerMasterList = officers;
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
});
}
/* Get Complaints List */
function get_complaint_list(){
get_complaint_data().then(function(complaintList) {
// Handle the complaint list
generate_table(complaintList);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching complaint list:', error.message);
} else {
console.error('An error occurred while fetching complaint list:', error);
}
});
}
function viewPetitionSummary(petitionNo){
$("#viewpetition").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
var url = '/gcc/m_petition/view-petition-modal?petitionNo='+petitionNo;
$.ajax({
url: url,
type: 'GET',
dataType: 'html',
success: function(data) {
$('#viewPetitionBoxBody').html(data); // Inject content into modal body
},
error: function(xhr, status, error) {
console.error("Error loading URL:", error);
// Handle error, display a message, etc.
}
});
return false;
}
function updateStatus(mapId){
$("#ComplaintStatusBox").modal({
backdrop: 'static',
keyboard: false
}); // Show Modal Box
callComplaintDetails(mapId);
return false;
}
function callComplaintDetails(mapId){
loading_text_msg = getLoadingMessage(); // get Loading random text
var loading=searchinfo("<b>"+loading_text_msg+"</b>");
var complaintContentHTML=`
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded">
<div id="leftContainer">${loading}</div>
</div>
</div>
<div class="col-lg-6 printack2">
<div class="block block-rounded">
<div id="rightContainer">${loading}</div>
</div>
</div>
<!--<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>-->
</div>`;
$('#ComplaintStatusBoxBody').html(complaintContentHTML); // Box content (Body)
getComplaintData(mapId);
}
function getComplaintData(mapId){
get_complaint_details_byId(mapId).then(function(complaintDetails) {
var complaintStatus = complaintDetails[0].status;
var statusBadge = complaintStatus.charAt(0).toUpperCase() + complaintStatus.slice(1);
var refRibben = `<div class="card-header-right" style="top:auto;">
Ref ID: ${mapId}
</div>`;
var statusRibben = "";
if(complaintStatus=='pending'){
statusRibben = `<div class="ribbon">
<div class="wrap">
<span class="ribbon6 bg-danger"><div styel="color:#fff;">${statusBadge}</div></span>
</div>
</div>`;
statusRibben = "";
statusBadge = `<span class="badge badge-danger" style="font-size:10px;padding:0.25em 0.4em;">${statusBadge}</span>`;
}
else if(complaintStatus=='close'){
statusBadge = `<span class="badge badge-success" style="font-size:10px;padding:0.25em 0.4em;">${statusBadge}</span>`;
}
var complaintRightBody = "";
var complaintLeftBody = `<div class="card mb-0">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Complaint Details</h3>
${statusRibben}
</div>
<div class="card-body">
<table class="table table-borderless table-vcenter mb-0" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${convertdate(complaintDetails[0].cdate)}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintDetails[0].petition_no}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintDetails[0].petitioner_name}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintDetails[0].petitioner_mobile}
</td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;">புகாரின் தன்மை / Nature of complaint:<br><p class="fw-semibold mb-0" style="font-weight:normal;">${complaintDetails[0].complaint_nature}</p></th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;">
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th>Complaint <i class="fa fa-arrow-right"></i> Status</th>
<th class="text-right" id="complaint_forward_link"><a href="javascript:void(0);" onclick="return forward_compliant(${complaintDetails[0].mapid}, '${complaintDetails[0].complaint_type}');" class="link" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Click here to forward this complaint to another department officer."><i class="far fa-share-square"></i> Click to forward </a></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="fw-semibold">
${complaintDetails[0].complaint_type} <i class="fa fa-arrow-right"></i> ${statusBadge} <i class="fa fa-arrow-right"></i> ${complaintDetails[0].off_nm}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>`;
$('#leftContainer').html(complaintLeftBody);
if(complaintStatus!='close'){
complaintRightBody =`<form class="action-form" id="action-form" onsubmit="return saveandclose();" enctype="multipart/form-data">
<div class="card mb-0">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Complaint Update Details</h3>
${refRibben}
</div>
<div class="card-body">
<div class="form-group">
<label for="complaintActionText">நடவடிக்கை / Action:</label>
<textarea class="form-control" id="complaintActionText" name="complaintActionText" rows="6" maxlength="250" placeholder="புகாரின் தன்மை..." required></textarea>
</div>
<div class="form-group">
<label for="action_san_page1">ஆவணப் பதிவேற்றம் / Document Upload:</label>
<input name="action_san_page1" id="action_san_page1" class="form-control" type="file" capture="camera" accept="application/pdf, image/*" required>
</div>
<div class="form-group mb-0 text-center">
<button type="button" class="btn btn-sm rounded-pill btn-hero btn-success me-1" onclick="javascript:saveandclose(${mapId},${complaintDetails[0].petition_id},'${complaintDetails[0].petition_no}');" id="updatebtn"><i class="ik ik-save"></i> Save and Close </button>
</div>
</div>
</div>
</form>`;
$('#rightContainer').html(complaintRightBody);
}
else{
// first remove forward link
$("#complaint_forward_link").html("");
get_complaint_action_byId(mapId).then(function(complaintAction) {
var fileType = complaintAction[0].file_type;
fileType = fileType.split("/").pop();
var filetypeico = "file-lines";
if(fileType=='pdf'){
filetypeico = "file-pdf";
}
else{
filetypeico = "file-image";
}
complaintRightBody =`<form class="action-form" id="action-form" onsubmit="return saveandclose();" enctype="multipart/form-data">
<div class="card mb-0">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Complaint Update Details</h3>
${refRibben}
</div>
<div class="card-body">
<div>
<b>நடவடிக்கை தேதி / Action Date:</b> ${convertdate(complaintAction[0].cdate)}
<hr>
<b>நடவடிக்கை / Action:</b><br>
<p class="mt-10">${complaintAction[0].comments}</p>
</div>
<hr>
<div class="like-comm mt-20 mb-0">
<b>ஆவணப் பதிவேற்றம் / Document Upload:</b><br>
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th>S.no</th>
<th>File Name</th>
<th>Size</th>
<th>Type</th>
<th><i class="ik ik-more-horizontal"></i></th>
</tr>
</thead>
<tbody>
<tr>
<td class="fw-semibold">1</td>
<td class="fw-semibold">${complaintAction[0].file_name}</td>
<td class="fw-semibold">${formatFileSize(complaintAction[0].file_size)}</td>
<td class="fw-semibold">${fileType}</td>
<td class="fw-semibold">
<a href="javascript:void(0)" class="link mr-10" onclick="downloadFile('action','${complaintAction[0].file_name}','${complaintAction[0].file_type}');" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Download File"><i class="fa fa-fw fa-download" style="font-size: 18px;"></i></a>
<a href="javascript:void(0)" class="link mr-10" onclick="viewFile('action','${complaintAction[0].file_name}','${complaintAction[0].file_type}');" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View File"><i class="far fa-3x fa-${filetypeico}" style="font-size: 18px;"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</form>`;
$('#rightContainer').html(complaintRightBody);
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
}).catch(function(error) {
// Handle errors
console.error('Error fetching action details ('+mapId+'):', error);
});
}
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
}).catch(function(error) {
// Handle errors
console.error('Error fetching Complaint details ('+mapId+'):', error);
});
}
/* Call DataTable function */
function generate_table(data){
var table = $('#complaintDatatable').DataTable( {
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', "orderable": false },
{ targets: 'no-exportable', "exportable": false }
],
lengthMenu: [
[ 50, 100, 200, 500, -1 ],
[ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
],
/*scrollY: '50vh',*/
fixedColumns: {
left: 0,
right: 0
},
buttons: [buttons],
responsive: true,
searching: false,
select: false,
processing: false,
} );
// Clearn Table data
table.clear().draw();
// Add rows to DataTable
var rowNum = 1;
$.each(data, function(index, row) {
var complaint_status=row["status"];
complaint_status=complaint_status.charAt(0).toUpperCase() + complaint_status.slice(1);
actionHTML = `<div class="dropdown d-inline-block show">
<a class="nav-link dropdown-toggle" href="#" id="moreDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="ik ik-more-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="moreDropdown" x-placement="bottom-end">
Action for: `+row['petition_no']+`
<a class="dropdown-item" href="" onclick="return viewAck('`+row['petition_no']+`');" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View Acknowledgement"><i class="ik ik-eye"></i> Acknowledgement</a>
<a class="dropdown-item" href="/gcc/m_petition/petition-ack/`+row['petition_no']+`" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Print Acknowledgement"><i class="ik ik-printer"></i> Acknowledgement</a>
</div>
</div>`
table.row.add([
rowNum++,
'<a href="/gcc/m_petition/update-petition?petitionNo='+row['petitionNoEncode']+'" onclick="return viewPetitionSummary(\''+row['petitionNoEncode']+'\');">'+row['petition_no']+'</a>',
row['petitioner_name'],
row['petitioner_mobile'],
row['petitioner_address'],
row['petitioner_pincode'],
row['complaint_type'],
convertdate(row['cdate']),
'<a href="#" onclick="return updateStatus('+row['mapid']+');" style="text-transform: capitalize;"">'+complaint_status+'</a>',
row['off_nm'],
actionHTML
]).draw(false);
});
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
remove_loading(); // remove Loading
}
// Save New Action
function saveandclose(mapId,petitionId,petitionNo){
// Disable the button to prevent multiple clicks
form_btn_disable();
var comments = $('#complaintActionText');
var textLength = comments.val().length;
comments.removeClass('is-invalid');
var fileInput = $("#action_san_page1");
fileInput.removeClass('is-invalid');
var selectedFile = fileInput.val();
if (textLength>=10 && selectedFile) {
// Serialize form data
var formData = new FormData($('#action-form')[0]);
formData.append('createdBy',createdBy);
formData.append('mapId',mapId);
formData.append('petitionId',petitionId);
formData.append('petitionNo',petitionNo);
formData.append('complaintStatus','close');
saveActionFormData(formData).then(function(response) {
if(response!="error"){
// Handle the response
Swal.fire({
title: 'Complaint action saved successfully.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'success',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
$("#ComplaintStatusBox").modal('hide');
}
});
}
else{
// Handle the response
// if response == "error"
Swal.fire({
title: 'Failed to save complaint action. Please try again!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error on save petition:', error.message);
form_btn_enable();
});
}
else{
if(textLength<10){
comments.addClass('is-invalid');
}
if (!selectedFile) {
fileInput.addClass('is-invalid');
}
form_btn_enable();
}
return false;
}
function saveActionFormData(formData){
var apiUrl = '/gcc/api/m_petition/saveComplanitStatus';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
function form_btn_enable(){
$("#updatebtn").prop("disabled", false);
$("#updatebtn").html('<i class="ik ik-save"></i> Save and Close ');
}
function form_btn_disable(){
$("#updatebtn").prop("disabled", true);
// Show the loading icon on the button
$("#updatebtn").html('<i class="fas fa-spinner fa-spin"></i> Validating your request, please wait...');
}
// For Complient Map Select HTML
function calloffice(val,id){
if(val==1){ // Intenal
var officeSelectHTML = `<div class="mb-4">
<label for="office${id}">Select Office</label>
<select name="office[]" id="office${id}" class="form-control" onchange="javascript:callofficers(this.value,${id})">
<option value="0">Select Office</option>
<option value="1">HQ</option>
<option value="2">Zonal Office</option>
</select>
</div>`;
$("#officedata"+id).html(officeSelectHTML);
}
else if(val==2){ // External
$("#officers"+id).html('');
var ExSelectHTML = getselect(id,"ExSelect");
var departmentSelectHTML = `<div class="mb-4">
<label for="dept3">Select Department</label>
${ExSelectHTML}
</div>`;
$("#officedata"+id).html(departmentSelectHTML);
}
else{
$("#officedata"+id).html('');
$("#officers"+id).html('');
}
$("#officers"+id).html('');
}
function callofficers(val,id){
if(val==1){
// HQ
var HQSelectHTML = getselect(id,"HQSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${HQSelectHTML}</div>`);
}
else if(val==2){
// Zone Office
var ZoneSelectHTML = getselect(id,"ZoneSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${ZoneSelectHTML}</div>`);
}
else{
$("#officers"+id).html('');
}
}
function getselect(comid,type){
var HQSelect = '';
var ZoneSelect = '';
var ExSelect = '';
for (var i = 0; i < officerMasterList.length; i++) {
if(officerMasterList[i].zone_id=="HQ"){
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else if(officerMasterList[i].zone_id=="99"){
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else{
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
// Forward Save Button
var forward_Btn = `<div class="col-12 pt-3 mb-0 pb-0" id="submitdiv">
<label class="form-label" for="forwardcomp">Forward Comments</label>
<textarea class="js-maxlength form-control" id="forwardcomp" name="forwardcomp" rows="6" maxlength="250" placeholder="கருத்துகள்..." data-always-show="true" data-placement="right" th:utext="" required></textarea>
<div class="text-center pt-3">
<button type="button" class="btn btn-sm rounded-pill btn-hero btn-success me-1" onclick="javascript:saveForward(${comid});" id="updatebtn"><i class="si si-rocket me-1"></i> Save and Forward</button>
<div id="forwardFormError" class="text-danger"></div>
</div>
</div>`;
if(type=="HQSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${HQSelect}</select>${forward_Btn}`;
}
if(type=="ZoneSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ZoneSelect}</select>${forward_Btn}`;
}
if(type=="ExSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ExSelect}</select>${forward_Btn}`;
}
return '';
}
$(document).ready(function() {
call_loading();
get_officer_master_data();
get_complaint_list();
});
</script>
</body>
</html>

301
src/main/resources/templates/modules/m_petition/new_petition.html

@ -0,0 +1,301 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>Add New Petition</h5>
<span>Mayor Petition</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="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">Add Petition</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="card">
<form class="request-form" id="request-form" onsubmit="return saveRequest();" enctype="multipart/form-data">
<div class="card-header"><h3>New Petition Form</h3></div>
<div class="card-body">
<div class="form-group">
<label for="petitionerName">Petition Type / மனுவின் வகை</label>
<div class="form-radio" id="petition_type">
</div>
</div>
<div class="form-group">
<label for="petitionerName">Petitioner's Name / மனுதாரரின் பெயர்</label>
<input type="text" class="form-control" name="petitionerName" id="petitionerName" autocomplete="off" placeholder="மனுதாரரின் பெயர்" maxlength="250" required>
</div>
<div class="form-group">
<label for="petitionerMobile">Mobile NO / கைபேசி எண்</label>
<input type="text" class="js-maxlength form-control" id="petitionerMobile" name="petitionerMobile" autocomplete="off" placeholder="கைபேசி எண்" maxlength="10" data-always-show="true" data-placement="top" required>
</div>
<div class="form-group">
<label for="complaintType">Type of complaint / புகார் வகை (பலவற்றை தேர்ந்தெடு..) </label>
<select class="select2" id="complaintType" name="complaintType" style="width: 100%;" data-placeholder="பலவற்றை தேர்ந்தெடு.." multiple required>
<option th:each="complaintType : ${complaintTypesList}" th:value="${complaintType.complaintTypeId}" th:text="${complaintType.complaintType}"></option>
</select>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="san_page1">Petition Page 1 / மனு பக்கம் 1</label>
<input name="san_page1" id="san_page1" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="san_page2">Petition Page 2 / மனு பக்கம் 2</label>
<input name="san_page2" id="san_page2" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="san_page3">Petition Page 3 / மனு பக்கம் 3</label>
<input name="san_page3" id="san_page3" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="san_page4">Petition Page 4 / மனு பக்கம் 4</label>
<input name="san_page4" id="san_page4" class="form-control" type="file" capture="camera" accept="application/pdf, image/*">
</div>
</div>
</div>
</div>
<div class="card-footer text-right">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="requestSubmitBtn"><i class="ik ik-save"></i>Save</button>
</div>
</form>
</div>
</div>
<div class="col-md-2"></div>
</div>
</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 th:replace="~{fragments/modules/m_petition/script :: script}"></script>
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var complaintTypeList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// Iterate through the department list and add options to the select element
$.each(complaintTypeList, function(index, complaintType) {
// Create an option element
var option = $('<option>', {
value: complaintType.complaint_typeid, // case-sensitive as per object
text: complaintType.complaint_type
});
// Append the option to the select element
$('#complaintType').append(option);
});
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Petition Type Data */
function get_petition_type_data(){
var petitionTypeHTML="";
get_petition_type_list().then(function(petitionTypes) {
// Handle the Complaint list
petitionTypeList = petitionTypes;
// Iterate through the department list and add options to the select element
$.each(petitionTypeList, function(index, petitionType) {
// Create an option element
petitionTypeHTML +=`<div class="radio radiofill ${petitionType.color_class} radio-inline">
<label class="cursure_poiter">
<input type="radio" name="petitionType" value="${petitionType.petition_type_id}">
<i class="helper"></i>${petitionType.name}
</label>
</div>`;
});
// Append the option to the select element
$('#petition_type').html(petitionTypeHTML);
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition type list:', error);
});
}
// Save New petition
function saveRequest(){
// Disable the button to prevent multiple clicks
form_btn_disable();
var inputElementMobileNo = $('#petitionerMobile');
var mobileNo = inputElementMobileNo.val();
var mobileFormatRegex = /^\d{10}$/; //'0000000000';
inputElementMobileNo.removeClass('is-invalid');
var inputElementComplaintType = $('#complaintType');
var complaintType = inputElementComplaintType.val();
if (mobileNo !== null && mobileFormatRegex.test(mobileNo) && mobileNo.length == 10) {
// Serialize form data
var formData = new FormData($('#request-form')[0]);
formData.append('createdBy',createdBy);
saveFormData(formData).then(function(response) {
if(response!="error"){
// Handle the response
Swal.fire({
title: 'Petition data saved successfully.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'success',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
// Reload the current page
//location.reload();
// Navigate to a Ack page
window.location = "/gcc/m_petition/petition-ack/"+response;
}
});
}
else{
// Handle the response
// if response == "error"
Swal.fire({
title: 'Failed to save petition data. Please try again!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error on save petition:', error.message);
form_btn_enable();
});
}
else{
inputElementMobileNo.addClass('is-invalid');
form_btn_enable();
}
return false;
}
function saveFormData(formData){
var apiUrl = '/gcc/api/m_petition/savePetition';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
function form_btn_enable(){
$("#resetFormBtn").prop("disabled", false);
$("#requestSubmitBtn").prop("disabled", false);
$("#requestSubmitBtn").html('<i class="ik ik-save"></i>Save');
}
function form_btn_disable(){
$("#resetFormBtn").prop("disabled", true);
$("#requestSubmitBtn").prop("disabled", true);
// Show the loading icon on the button
$("#requestSubmitBtn").html('<i class="fas fa-spinner fa-spin"></i> Validating your request, please wait...');
}
$(document).ready(function() {
get_complaint_type_data();
get_petition_type_data();
$('#petitionerMobile').mask('0000000000');
});
</script>
</body>
</html>

237
src/main/resources/templates/modules/m_petition/petition_ack.html

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5 th:utext="'Petition Acknowledgement ('+${petitionNo}+')'">Petition Acknowledgement</h5>
<span>Mayor Petition</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="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">Petition Acknowledgement</li>
</ol>
</nav>
</div>
</div>
</div>
<hr class="print_no">
<!--
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack1table" style="border: 1px solid black;">
<div id="ack1"></div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack2table" style="border: 1px solid black;">
<div id="ack2"></div>
</div>
</div>
</div>
<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>
</div>
-->
<div class="row">
<div class="col-lg-6">
<div class="block block-rounded ack ack-container">
<div id="ack1table" class="ack-content">
<div id="ack1">This is ack1</div>
</div>
</div>
</div>
<div class="col-lg-6 printack2">
<div class="block block-rounded ack ack-container">
<div id="ack2table" class="ack-content">
<div id="ack2">This is ack2</div>
</div>
</div>
</div>
<div class="col-lg-12 text-center block-options pt-10">
<button type="button" class="btn btn-warning btn-rounded btn-block-option" onclick="window.print()"><i class="ik ik-printer"></i> Print</button>
</div>
</div>
</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 th:replace="~{fragments/modules/m_petition/script :: script}"></script>
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var petitionNo = /*[[${petitionNo}]]*/'';
var complaintTypeList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// After Complaint Type list created we call petition details
get_petition_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Petition data */
function get_petition_data(){
get_petition_details().then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint_txt;
var complaintArray = complaint.split(',');
for(j = 0; j < complaintArray.length; j++){
if(j>0){
complaintHTML+="<br>";
}
complaintHTML+= (j+1)+') '+complaintArray[j];
}
var ack =`
<table class="table table-borderless table-vcenter p-0 m-0">
<tbody>
<tr>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
<td class="fw-semibold text-center">
<b>பெருநகர சென்னை மாநகராட்சி | Greater Chennai Corporation<br>
மக்களை தேடி மேயர் திட்டம்<br>
ஒப்புகை சீட்டு / Acknowledgement Receipt</b>
</td>
<td scope="row"><img src="images/logo-sm.png" width="80px"/></td>
</tr>
</tbody>
</table>
<hr style="margin:0px">
<div class="block-content p-0 m-0">
<table class="table table-borderless table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${convertdate(petitionDetails[0].cdate)}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petition_no}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_name}
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${petitionDetails[0].petitioner_mobile}
</td>
</tr>
<tr style="font-size:12px;">
<th style="padding: 0.45rem 0.45rem;">புகாரின் தன்மை / Nature of complaint:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
${complaintHTML}
</td>
</tr>
<tr>
<td scope="row" colspan="2" style="font-size:10px">இம்மனுவின் ஒப்புகைச் சீட்டு எண் மனு தாரரின் கைபேசி எண்ணிற்கு குறுஞ்செய்தி மூலம் அனுப்பி வைக்கப்படும் . இம்மனுவின் நிலை குறித்து https://chennaicorporation.gov.in/MTM/ என்ற இணையதளத்தில் மனுவின் எண்ணை குறிப்பிட்டு அறிந்துகொள்ளலாம்</th>
</tr>
<tr style="text-align: right;">
<th scope="row" colspan="2" style="padding: 0.45rem 0.45rem;">வட்டார அலுவலகம்<br>Office of the Regional Deputy Commissioner</th>
</tr>
</tbody>
</table>
`;
$("#ack1").html(ack);
$("#ack2").html(ack);
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition details ('+petitionNo+'):', error);
});
}
/* Get Petition details by petition number */
function get_petition_details() {
var formData = new FormData();
formData.append('petitionNo',petitionNo);
var apiUrl = '/gcc/api/m_petition/getPetitionDetails?petitionNo='+petitionNo;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error);
reject(error);
}
});
});
}
$(document).ready(function() {
get_complaint_type_data();
});
</script>
</body>
</html>

282
src/main/resources/templates/modules/m_petition/petition_list.html

@ -0,0 +1,282 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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>Petition 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">Petition 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>
<table id="petitionDatatable" 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">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Petition No.</th>
<th class="text-center">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/m_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/m_petition/script :: script}"></script>
<script th:inline="javascript">
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
// 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
}
}
];
function call_loading(){
loading.html(searchinfo("<b>"+loading_text_msg+"</b>"));
}
function remove_loading(){
loading.html("");
}
/* Get Complaints Data */
function get_petitions_data(){
var apiUrl = '/gcc/api/m_petition/getPetitionList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Complaints List */
function get_petitions_list(){
get_petitions_data().then(function(petitionList) {
// Handle the department list
generate_table(petitionList);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching petition list:', error.message);
} else {
console.error('An error occurred while fetching petition list:', error);
}
});
}
/* Call DataTable function */
function generate_table(data){
var table = $('#petitionDatatable').DataTable( {
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', "orderable": false },
{ targets: 'no-exportable', "exportable": false }
],
lengthMenu: [
[ 50, 100, 200, 500, -1 ],
[ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
],
scrollY: '50vh',
fixedColumns: {
left: 0,
right: 0
},
buttons: [buttons],
responsive: true,
searching: false,
select: false,
processing: false,
} );
// Clearn Table data
table.clear().draw();
// Add rows to DataTable
var rowNum = 1;
$.each(data, function(index, row) {
//View Acknowledgement: View the acknowledgement for petition MP10000001.
//Print Acknowledgement: Print the acknowledgement for petition MP10000001.
//View Petition Details: View the details of petition MP10000001.
//View Uploaded Files: View the files uploaded for petition MP10000001.
actionHTML = `<div class="dropdown d-inline-block show">
<a class="nav-link dropdown-toggle" href="#" id="moreDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="ik ik-more-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="moreDropdown" x-placement="bottom-end">
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View the acknowledgement for petition `+row['petition_no']+`."><i class="ik ik-eye"></i> View Acknowledgement</a>
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="Print the acknowledgement for petition `+row['petition_no']+`."><i class="ik ik-printer"></i> Print Acknowledgement</a>
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View the details of petition `+row['petition_no']+`."><i class="ik ik-eye"></i> View Petition Details</a>
<a class="dropdown-item" href="" data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View the files uploaded for petition `+row['petition_no']+`."><i class="ik ik-eye"></i> View Uploaded Files</a>
</div>
</div>`
table.row.add([
rowNum++,
'<a href="/gcc/m_petition/update-petition?petitionNo='+row['petitionNoEncode']+'">'+row['petition_no']+'</a>',
row['petitioner_name'],
row['petitioner_mobile'],
row['petitioner_address'],
row['petitioner_pincode'],
row['petitioner_complaint_txt'],
convertdate(row['cdate']),
row['status'],
row['created_by'],
actionHTML
]).draw(false);
});
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
remove_loading(); // remove Loading
}
$(document).ready(function() {
call_loading();
get_petitions_list();
});
</script>
</body>
</html>

267
src/main/resources/templates/modules/m_petition/petition_not_mapped_list.html

@ -0,0 +1,267 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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>Unmapped Petition 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">Unmapped Petition List</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3>These are the petitions that are currently not assigned to any department officer:</h3>
</div>
<div class="card-block">
<div id="tableLoading"></div>
<div>
<table id="petitionDatatable" 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">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="thead-dark">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Petition No.</th>
<th class="text-center">Name</th>
<th class="text-center">Mobile</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">Status</th>
<th class="text-center">Department</th>
<th class="text-center no-sort no-exportable no-print">Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/m_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/m_petition/script :: script}"></script>
<script th:inline="javascript">
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
// 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
}
}
];
function call_loading(){
loading.html(searchinfo("<b>"+loading_text_msg+"</b>"));
}
function remove_loading(){
loading.html("");
}
/* Get Complaints Data */
function get_petitions_data(){
var apiUrl = '/gcc/api/m_petition/getUnmapPetitionList';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
resolve(jsonResponse);
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
reject(error);
}
});
});
}
/* Get Complaints List */
function get_petitions_list(){
get_petitions_data().then(function(petitionList) {
// Handle the department list
generate_table(petitionList);
}).catch(function(error) {
// Handle errors
if (error && error.message) {
console.error('Error fetching petition list:', error.message);
} else {
console.error('An error occurred while fetching petition list:', error);
}
});
}
/* Call DataTable function */
function generate_table(data){
var table = $('#petitionDatatable').DataTable( {
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', "orderable": false },
{ targets: 'no-exportable', "exportable": false }
],
lengthMenu: [
[ 50, 100, 200, 500, -1 ],
[ '50 rows', '100 rows', '200 rows','500 rows', 'Show all' ]
],
scrollY: '50vh',
fixedColumns: {
left: 0,
right: 0
},
buttons: [buttons],
responsive: true,
searching: false,
select: false,
processing: false,
} );
// Clearn Table data
table.clear().draw();
// Add rows to DataTable
var rowNum = 1;
$.each(data, function(index, row) {
table.row.add([
rowNum++,
'<a href="/gcc/m_petition/update-petition?petitionNo='+row['petitionNoEncode']+'">'+row['petition_no']+'</a>',
row['petitioner_name'],
row['petitioner_mobile'],
row['petitioner_address'],
row['petitioner_pincode'],
row['petitioner_complaint_txt'],
convertdate(row['cdate']),
row['status'],
row['created_by'],
'<a href="" onclick="return viewAck(\''+row['petition_no']+'\');"data-animation="true" data-toggle="tooltip" data-placement="top" data-html="true" title="View Ack"><i class="far fa-handshake"></i></a>',
]).draw(false);
});
// Enable tooltips for all elements with data-toggle="tooltip"
$('[data-toggle="tooltip"]').tooltip();
remove_loading(); // remove Loading
}
$(document).ready(function() {
call_loading();
get_petitions_list();
});
</script>
</body>
</html>

758
src/main/resources/templates/modules/m_petition/petition_update.html

@ -0,0 +1,758 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>Edit / Update Petition</h5>
<span>Mayor Petition</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="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">Edit/Update Petition</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-12">
<div class="card" id="petitionUpdateForm">
<form class="update-request-form" id="update-request-form" onsubmit="return updateRequest();">
<div class="card-header">
<h3>Edit / Update Petition Form</h3>
<div class="card-header-right">
<h3 th:utext="'Petition No: '+${petitionNo}+''"></h3>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="form-group">
<label for="petitionerName">Petition Type / மனுவின் வகை</label>
<div class="form-radio" id="petition_type">
</div>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label for="petitionerName">Petitioner's Name / மனுதாரரின் பெயர்</label>
<input type="text" class="form-control" name="petitionerName" id="petitionerName" autocomplete="off" placeholder="மனுதாரரின் பெயர்" maxlength="250" required>
</div>
<div class="form-group">
<label for="petitionerMobile">Mobile NO / கைபேசி எண்</label>
<input type="text" class="form-control" id="petitionerMobile" name="petitionerMobile" autocomplete="off" placeholder="கைபேசி எண்" maxlength="10" required>
</div>
<div class="form-group">
<label for="complaintNature">புகாரின் தன்மை / Nature Of Complaint</label>
<textarea class="form-control" id="complaintNature" name="complaintNature" rows="6" maxlength="250" placeholder="புகாரின் தன்மை..."></textarea>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label for="petitionerAddress">Address of petitioner / மனுதாரரின் முகவரி</label>
<textarea class="form-control" id="petitionerAddress" name="petitionerAddress" rows="6" maxlength="250" placeholder="மனுதாரரின் முகவரி..."></textarea>
</div>
<div class="form-group">
<label for="petitionerPincode">Postal code / தபால் குறியீடு</label>
<input type="text" class="form-control" id="petitionerPincode" name="petitionerPincode" placeholder="தபால் குறியீடு" maxlength="6" required>
</div>
<div class="form-group">
<label for="complaintType">Type of complaint / புகார் வகை (பலவற்றை தேர்ந்தெடு..) </label>
<select class="select2" id="complaintType" name="complaintType" style="width: 100%;" data-placeholder="பலவற்றை தேர்ந்தெடு.." multiple required onchange="javascript:load_mapper();">
<option></option>
</select>
</div>
</div>
<div class="col-12">
<div class="block-content" id="userinfo2">
<div id="comp_mapping_to_officers" class="row"></div>
</div>
</div>
</div>
</div>
<div class="card-footer text-right">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="requestSubmitBtn"><i class="ik ik-save"></i>Save</button>
</div>
</form>
</div>
</div>
</div>
</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 th:replace="~{fragments/modules/m_petition/script :: script}"></script>
<script th:inline="javascript">
var createdBy = /*[[${LoginUserId}]]*/'';
var petitionNo = /*[[${petitionNo}]]*/'';
var petitionId = 0;
var closedComplaintsList=[];
var complaintTypeList = "";
var officerMasterList = "";
/* Get Complaint Type Data */
function get_complaint_type_data(){
get_complaint_type_list().then(function(complaintTypes) {
// Handle the Complaint list
complaintTypeList = complaintTypes;
// Iterate through the Master Complanint Type and add options to the select element
$.each(complaintTypeList, function(index, complaintType) {
// Create an option element
var option = $('<option>', {
value: complaintType.complaint_typeid, // case-sensitive as per object
text: complaintType.complaint_type
});
// Append the option to the select element
$('#complaintType').append(option);
});
// Call Petition function to fetch the data
get_petition_data();
}).catch(function(error) {
// Handle errors
console.error('Error fetching complaint type list:', error);
});
}
/* Get Petition Type Data */
function get_petition_type_data(){
var petitionTypeHTML="";
get_petition_type_list().then(function(petitionTypes) {
// Handle the Complaint list
petitionTypeList = petitionTypes;
// Iterate through the department list and add options to the select element
$.each(petitionTypeList, function(index, petitionType) {
// Create an option element
petitionTypeHTML +=`<div class="radio radiofill ${petitionType.color_class} radio-inline">
<label class="cursure_poiter">
<input type="radio" name="petitionType" id="petition_type_${petitionType.petition_type_id}" value="${petitionType.petition_type_id}" disable>
<i class="helper"></i>${petitionType.name}
</label>
</div>`;
});
// Append the option to the select element
$('#petition_type').html(petitionTypeHTML);
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition type list:', error);
});
}
/* Get Officer Master Data */
function get_officer_master_data(){
get_officer_list().then(function(officers) {
// Handle the officer list
officerMasterList = officers;
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
});
}
// Function to get complaint_type and complaint_typeid by complaint_typeid
function getComplaintTypeById(complaintTypeId) {
for (var i = 0; i < complaintTypeList.length; i++) {
if (complaintTypeList[i].complaint_typeid == complaintTypeId) {
return {
complaint_type: complaintTypeList[i].complaint_type,
complaint_typeid: complaintTypeList[i].complaint_typeid
};
}
}
return null; // Return null if no matching complaint_typeid is found
}
// Save New petition
function updateRequest(){
// Disable the button to prevent multiple clicks
form_btn_disable();
var inputElementMobileNo = $('#petitionerMobile');
var mobileNo = inputElementMobileNo.val();
var mobileFormatRegex = /^\d{10}$/; //'0000000000';
inputElementMobileNo.removeClass('is-invalid');
var inputElementComplaintType = $('#complaintType');
var complaintType = inputElementComplaintType.val();
if (mobileNo !== null && mobileFormatRegex.test(mobileNo) && mobileNo.length == 10) {
// Serialize form data
var formData = new FormData($('#update-request-form')[0]);
formData.append('petitionNo',petitionNo);
formData.append('createdBy',createdBy);
formData.append('petitionId',petitionId);
updateFormData(formData).then(function(response) {
// Handle the response
if(response==true){
// Delete Old data in Petition Mapping table
savePetitionMapData(formData).then(function(response) {
if(response==true){
Swal.fire({
title: 'Petition updated successfully!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'success',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
else{
Swal.fire({
title: 'Petition details have been updated, but mapping the complaint to the officer has failed.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'warning',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error fetching offcier master data:', error);
form_btn_enable();
});
}
else{
Swal.fire({
title: 'Failed to update petition details!',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
},
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
form_btn_enable();
}
});
}
}).catch(function(error) {
// Handle errors
console.error('Error on save petition:', error.message);
form_btn_enable();
});
}
else{
inputElementMobileNo.addClass('is-invalid');
form_btn_enable();
}
return false;
}
function updateFormData(formData){
var apiUrl = '/gcc/api/m_petition/updatePetition';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
function savePetitionMapData(formData){
var apiUrl = '/gcc/api/m_petition/mapComplientToOfficer';
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
// Handle success response
resolve(response);
},
error: function(xhr, status, error) {
console.error('Error:', error);
// Handle error response
reject(error);
}
});
});
}
/* Get Petition data */
function get_petition_data(){
get_petition_details().then(function(petitionDetails) {
// Handle the Complaint list
var complaintHTML = "";
var complaint = petitionDetails[0].petitioner_complaint;
petitionId = petitionDetails[0].petition_id;
var complaintArray = complaint.split(",");
$("#complaintType").val(complaintArray);
$('#complaintType').trigger('change');
closedComplaintsList = complaintArray;
var petition_type = "#petition_type_"+petitionDetails[0].petition_type;
// Suppose you want to select the radio button with the value 'option2'
$(petition_type).prop('checked', true);
$("#petitionerName").val(petitionDetails[0].petitioner_name);
$("#petitionerMobile").val(petitionDetails[0].petitioner_mobile);
$("#petitionerAddress").val(petitionDetails[0].petitioner_address);
$("#petitionerPincode").val(petitionDetails[0].petitioner_pincode);
$("#complaintNature").val(petitionDetails[0].complaint_nature);
//load_mapper(); // Call for Complaint Mapping Form
// IDs of the values you want to prevent from being deselected
var valuesToPreventDeselection = closedComplaintsList;//['value1', 'value2', 'value3'];
$('#complaintType').on('select2:unselect', function (e) {
var deselectedValue = e.params.data.id;
// Check if the deselected value should be prevented from being deselected
if (valuesToPreventDeselection.includes(deselectedValue)) {
// Prevent the deselection
e.preventDefault();
// Re-select the deselected value to prevent it from being deselected
$(this).val(valuesToPreventDeselection).trigger('change.select2');
// Optionally, you can display a message or perform any other action
console.log('Deselection of value ' + deselectedValue + ' prevented');
alert('Deselection of value ' + deselectedValue + ' prevented');
}
});
}).catch(function(error) {
// Handle errors
console.error('Error fetching petition Data ('+petitionNo+'):', error.message);
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
});
}
/* Get Petition details by petition number */
function get_petition_details() {
var formData = new FormData();
formData.append('petitionNo',petitionNo);
var apiUrl = '/gcc/api/m_petition/getPetitionDetails?petitionNo='+petitionNo;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
url: apiUrl,
type: 'GET',
//data: formData,
dataType: 'json',
success: function(jsonResponse) {
// Resolve the Promise with the department list
if(jsonResponse.length>0){
resolve(jsonResponse);
}else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});
});
}
function load_mapper(){
var complaintArray = $("#complaintType").val();
//var complaintArray = complaint.split(',');
var compPetitionNo = petitionNo;
var compPetitionId = petitionId;
var compmapHTML='';
for(j = 0; j < complaintArray.length; j++){
var complaintTypeDetails = getComplaintTypeById(complaintArray[j]); // Pass the complaint_typeid
var title=(j+1)+') '+ complaintTypeDetails.complaint_type; // Map form title
var compID="comp"+j;
var complaintTypeId = complaintTypeDetails.complaint_typeid;
getMappingByComplaintsID(complaintTypeId);
compmapHTML+=`<div class="col-lg-6" id="comp${complaintArray[j]}">
<div class="widget">
<div class="widget-header" style="background-color:#2a807f;color:#fff;">
<h3 class="widget-title" style="font-size:13px;">${title}</h3>
</div>
<div class="widget-body">
<div class="form-group">
<label for="dept${complaintArray[j]}">Select Department Type</label>
<select name="dept[]" id="dept${complaintArray[j]}" class="form-control" onchange="javascript:calloffice(this.value,${complaintArray[j]})">
<option value="0">Select Department</option>
<option value="1">GCC Department</option>
<option value="2">External Department</option>
</select>
</div>
<div id="officedata${complaintArray[j]}"></div>
<div id="officers${complaintArray[j]}"></div>
</div>
</div>
</div>`;
}
$('#comp_mapping_to_officers').html(compmapHTML);
}
</script>
<script>
// For Complient Map Select HTML
function calloffice(val,id){
if(val==1){ // Intenal
var officeSelectHTML = `<div class="mb-4">
<label for="office${id}">Select Office</label>
<select name="office[]" id="office${id}" class="form-control" onchange="javascript:callofficers(this.value,${id})">
<option value="0">Select Office</option>
<option value="1">HQ</option>
<option value="2">Zonal Office</option>
</select>
</div>`;
$("#officedata"+id).html(officeSelectHTML);
}
else if(val==2){ // External
$("#officers"+id).html('');
var ExSelectHTML = getselect(id,"ExSelect");
var departmentSelectHTML = `<div class="mb-4">
<label for="dept3">Select Department</label>
${ExSelectHTML}
</div>`;
$("#officedata"+id).html(departmentSelectHTML);
}
else{
$("#officedata"+id).html('');
$("#officers"+id).html('');
}
$("#officers"+id).html('');
}
function callofficers(val,id){
if(val==1){
// HQ
var HQSelectHTML = getselect(id,"HQSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${HQSelectHTML}</div>`);
}
else if(val==2){
// Zone Office
var ZoneSelectHTML = getselect(id,"ZoneSelect");
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${id}">Select Department</label>${ZoneSelectHTML}</div>`);
}
else{
$("#officers"+id).html('');
}
}
function getselect(comid,type){
var HQSelect = '';
var ZoneSelect = '';
var ExSelect = '';
for (var i = 0; i < officerMasterList.length; i++) {
if(officerMasterList[i].zone_id=="HQ"){
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else if(officerMasterList[i].zone_id=="99"){
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
else{
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
if(type=="HQSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${HQSelect}</select>`;
}
if(type=="ZoneSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ZoneSelect}</select>`;
}
if(type=="ExSelect"){
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ExSelect}</select>`;
}
return '';
}
function form_btn_enable(){
$("#resetFormBtn").prop("disabled", false);
$("#requestSubmitBtn").prop("disabled", false);
$("#requestSubmitBtn").html('<i class="ik ik-save"></i>Save');
}
function form_btn_disable(){
$("#resetFormBtn").prop("disabled", true);
$("#requestSubmitBtn").prop("disabled", true);
// Show the loading icon on the button
$("#requestSubmitBtn").html('<i class="fas fa-spinner fa-spin"></i> Validating your request, please wait...');
}
function getMappingByComplaintsID(complaintTypeId){
$.ajax({
type: "GET",
url: '/gcc/api/m_petition/getComplaintMappingDetails',
data: {
'petitionId': petitionId,
'petitionNo': petitionNo,
'complaintTypeId': complaintTypeId
},
dataType: 'json',
}).done(function(response) {
//console.log(response);
if(response.length>0){
var comid = response[0]["complaint_typeid"];
var offid = response[0]["off_id"];
var mapid = response[0]["mapid"];
loadSelectforUpdate(comid,offid,comid);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
// Log the error and any relevant information
console.error("Error sending request: " + textStatus + " " + errorThrown);
});
}
function loadSelectforUpdate(comid,offid,id){
var type ="NULL";
var HQSelect = '';
var ZoneSelect = '';
var ExSelect = '';
for (var i = 0; i < officerMasterList.length; i++) {
//console.log(officerMasterList[i]);
if(officerMasterList[i].zone_id=="HQ"){
if(offid>0 && officerMasterList[i].off_id == offid){
type = "HQSelect";
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}" selected>${officerMasterList[i].off_nm}</option>`;
}
else{
HQSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
else if(officerMasterList[i].zone_id=="99"){
if(offid>0 && officerMasterList[i].off_id == offid){
type = "ExSelect";
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}" selected>${officerMasterList[i].off_nm}</option>`;
}
else{
ExSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
else{
if(offid>0 && officerMasterList[i].off_id == offid){
type = "ZoneSelect";
//console.log(type + " === "+ officerMasterList[i].offId +" == "+ offid);
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}" selected>${officerMasterList[i].off_nm}</option>`;
}
else{
ZoneSelect+=`<option value="${comid}_${officerMasterList[i].off_id}">${officerMasterList[i].off_nm}</option>`;
}
}
}
//console.log("comid : "+comid +",\noffid : "+offid+",\nid : "+id+",\ntype : "+type);
if(type=="HQSelect"){
//console.log("I am from HQSelect: \n #officers"+id);
$("#officedata"+id).html('<div class="mb-4">' +
'<label for="office$'+id+'">Select Office</label>' +
'<select name="office[]" id="office$'+id+'" class="form-control" onchange="javascript:callofficers(this.value,'+id+')">' +
'<option value="0">Select Office</option>' +
'<option value="1" Selected>HQ</option>' +
'<option value="2">Zonal Office</option>' +
'</select>' +
'</div>');
HQSelectHTML = `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${HQSelect}</select>`;
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${comid}">Select Department</label>${HQSelectHTML}</div>`);
}
if(type=="ZoneSelect"){
//console.log("I am from ZoneSelect: \n #officers"+id);
$("#officedata"+id).html('<div class="mb-4">' +
'<label for="office$'+id+'">Select Office</label>' +
'<select name="office[]" id="office$'+id+'" class="form-control" onchange="javascript:callofficers(this.value,'+id+')">' +
'<option value="0">Select Office</option>' +
'<option value="1">HQ</option>' +
'<option value="2" Selected>Zonal Office</option>' +
'</select>' +
'</div>');
ZoneSelectHTML = `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ZoneSelect}</select>`;
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${comid}">Select Department</label>${ZoneSelectHTML}</div>`);
}
if(type=="ExSelect"){
//console.log("I am from ExSelect: \n #officers"+id);
ExSelectHTML = `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> &nbsp; </option>${ExSelect}</select>`;
$("#officers"+id).html(`<div class="mb-4"><label for="mapOfficers${comid}">Select Department</label>${ExSelectHTML}</div>`);
}
}
function call_petition_search_from(errorTXT){
var errorHTML = "";
if(errorTXT!=""){
errorHTML = `<div class="form-group text-center text-danger">${errorTXT}</div>`;
}
var searchFormHTML = `<form class="search-form" id="search-form" onsubmit="return searchRequest();">
<div class="card-header">
<h3>Edit / Update Petition Form</h3>
<div class="card-header-right">
<h3 th:utext="'Petition No: '+${petitionNo}+''"></h3>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 text-center">
${errorHTML}
<div class="form-group">
<label for="petitionNoSearch">Petition No / மனு எண் </label>
<input type="text" class="form-control text-center" name="petitionNoSearch" id="petitionNoSearch" autocomplete="off" placeholder="MP00000000" maxlength="10" required>
</div>
</div>
<div class="col-12">
<div class="block-content" id="userinfo2">
<div id="comp_mapping_to_officers" class="row"></div>
</div>
</div>
</div>
</div>
<div class="card-footer text-center">
<button type="reset" class="btn btn-secondary mr-2" id="resetFormBtn"><i class="ik ik-refresh-cw"></i>Reset</button>
<button type="submit" class="btn btn-success" id="searchSubmitBtn"><i class="ik ik-search"></i>Search</button>
</div>
</form>`;
$("#petitionUpdateForm").html(searchFormHTML);
$('#petitionNoSearch').mask('MP00000000');
}
function searchRequest(){
var searchValue = $('#petitionNoSearch').val();
if (searchValue && searchValue.trim() !== '') {
searchValue = encodeBase64(searchValue);
window.location.href = "/gcc/m_petition/update-petition?petitionNo="+searchValue;
}
else{
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
return false;
}
</script>
<script>
$(document).ready(function() {
if(petitionNo!=null && petitionNo!="error"){
get_complaint_type_data();
get_petition_type_data();
get_officer_master_data();
}
else{
if(petitionNo=="error"){
call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
}
else{
call_petition_search_from("");
}
}
});
</script>
</body>
</html>

158
src/main/resources/templates/modules/m_petition/petition_view.html

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<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-8">
<div class="page-header-title">
<i class="far fa-calendar-plus bg-blue"></i>
<div class="d-inline">
<h5>View Petition</h5>
<span>Mayor Petition</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="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">View Petition</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-12">
<div class="card mb-0" id="petitionViewtable">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Petition Details</h3>
<div class="card-header-right text-center block-options pt-10" style="padding-right: 20px;">
<a href="javascript:void(0);" onclick="window.print()" class="link"><i class="ik ik-printer"></i> Print</a>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date: </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="cdate_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petition_no_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_name_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_mobile_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Address of petitioner / மனுதாரரின் முகவரி:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_address_value"></td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;">புகாரின் தன்மை / Nature of complaint:<br>
<p class="fw-semibold mb-0" style="font-weight:normal;" id="complaint_nature_value"></p>
</th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;" id="complaint_with_maping_value"></td>
</tr>
</tbody>
</table>
</div>
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">Petition Status: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_status_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total number of complaints in this petition: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Completed:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_completed_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Pending:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_pending_value"></td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th id="petition_summary_title">Pending Summary</th>
</tr>
</thead>
<tbody>
<tr style="background-color:#fbffe0;">
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_summary_html"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card-title">List of Complaints in this Petition and Their Status:</div>
<div id="listOfComplaintsHTML"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</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 th:replace="~{fragments/modules/m_petition/script :: script}"></script>
<script th:replace="~{fragments/modules/m_petition/petition_view_script :: script}"></script>
</body>
</html>

108
src/main/resources/templates/modules/m_petition/petition_view_modal_page.html

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<body>
<div class="row">
<div class="col-12">
<div class="card mb-0" id="petitionViewtable">
<div class="card-header" style="color: #004085;background-color: #e7eff7;">
<h3>Petition Details</h3>
<div class="card-header-right text-center block-options pt-10" style="padding-right: 20px;">
<a href="javascript:void(0);" onclick="window.print()" class="link"><i class="ik ik-printer"></i> Print</a>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">நாள் / Date: </th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="cdate_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petition_no_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">பெயர் / Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_name_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / Mobile No.</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_mobile_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">மனுதாரரின் முகவரி / Address of petitioner:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="petitioner_address_value"></td>
</tr>
<tr>
<th colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;">புகாரின் தன்மை / Nature of complaint:<br>
<p class="fw-semibold mb-0" style="font-weight:normal;" id="complaint_nature_value"></p>
</th>
</tr>
<tr>
<td colspan="2" style="padding: 0.45rem 0.45rem;border: 0px;" id="complaint_with_maping_value"></td>
</tr>
</tbody>
</table>
</div>
<div class="col-6">
<table class="table table-bordered table-vcenter" style="font-size:12px;">
<tbody>
<tr>
<th style="padding: 0.45rem 0.45rem;">Petition Status: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_status_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total number of complaints in this petition: </th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Completed:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_completed_value"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;">Total Complaints Pending:</th>
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="total_complaints_pending_value"></td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-vcenter mb-0">
<thead>
<tr>
<th id="petition_summary_title">Pending Summary</th>
</tr>
</thead>
<tbody>
<tr style="background-color:#fbffe0;">
<td class="fw-semibold text-center" style="padding: 0.45rem 0.45rem;" id="petition_summary_html"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card-title">List of Complaints in this Petition and Their Status:</div>
<div id="listOfComplaintsHTML"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script th:replace="~{fragments/modules/m_petition/script :: script}"></script>
<script th:replace="~{fragments/modules/m_petition/petition_view_script :: script}"></script>
</body>
</html>

6
src/main/resources/templates/modules/mtm/index.html

@ -128,9 +128,9 @@
<div th:replace="~{fragments/modules/base/app_module_menu_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/base/script :: script}"></script>
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script>
<script src="node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="node_modules/amcharts3/amcharts/serial.js"></script>
<script src="node_modules/amcharts3/amcharts/themes/light.js"></script>
<script> <script>
var chartData = []; var chartData = [];

6
src/main/resources/templates/modules/mtm/officer/index.html

@ -128,9 +128,9 @@
<div th:replace="~{fragments/modules/base/app_module_menu_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/base/script :: script}"></script>
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script>
<script src="node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="node_modules/amcharts3/amcharts/serial.js"></script>
<script src="node_modules/amcharts3/amcharts/themes/light.js"></script>
<script> <script>
var chartData = []; var chartData = [];

16
src/main/resources/templates/modules/petregistration/accepted-list.html

@ -371,7 +371,7 @@
function petimg(mobno,uniqueid){ function petimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetimg',
url: '/gcc/api/pet/getpetimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -391,7 +391,7 @@
function applicantimg(mobno,uniqueid){ function applicantimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getapplicantimg',
url: '/gcc/api/pet/getapplicantimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -410,7 +410,7 @@
function certificateimg(mobno,uniqueid){ function certificateimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getvacimg',
url: '/gcc/api/pet/getvacimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -429,7 +429,7 @@
function proofimg(mobno,uniqueid){ function proofimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getaddproofimg',
url: '/gcc/api/pet/getaddproofimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -459,7 +459,7 @@
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/pet/accept',
url: '/gcc/api/pet/accept',
data: {'id':id}, data: {'id':id},
success: function(bodyMessage) { success: function(bodyMessage) {
if(bodyMessage=="success"){ if(bodyMessage=="success"){
@ -484,7 +484,7 @@
function reject(uniqueid){ function reject(uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetInfo',
url: '/gcc/api/pet/getpetInfo',
data: { data: {
'petid':uniqueid 'petid':uniqueid
}, },
@ -531,7 +531,7 @@
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/pet/reject',
url: '/gcc/api/pet/reject',
data: {'id':id,'reason':reason}, data: {'id':id,'reason':reason},
success: function(bodyMessage) { success: function(bodyMessage) {
if(bodyMessage=="success"){ if(bodyMessage=="success"){
@ -562,7 +562,7 @@
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetOwner',
url: '/gcc/api/pet/getpetOwner',
data: { data: {
'mobilenum':mobilenum, 'mobilenum':mobilenum,
}, },

2
src/main/resources/templates/modules/petregistration/index.html

@ -838,7 +838,7 @@
function getZoneDashboard() { function getZoneDashboard() {
var z = $('#zone').val(); var z = $('#zone').val();
if (z == 0) { if (z == 0) {
window.location.href = "/pet/dashboard";
window.location.href = "gcc/pet/dashboard";
} }
} }
</script> </script>

14
src/main/resources/templates/modules/petregistration/license-issued.html

@ -385,7 +385,7 @@
function petimg(mobno, uniqueid) { function petimg(mobno, uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetimg',
url: '/gcc/api/pet/getpetimg',
data: { data: {
'mobno': mobno, 'mobno': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -403,7 +403,7 @@
function certificateimg(mobno, uniqueid) { function certificateimg(mobno, uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getvacimg',
url: '/gcc/api/pet/getvacimg',
data: { data: {
'mobno': mobno, 'mobno': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -424,7 +424,7 @@
let own; let own;
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetOwner',
url: '/gcc/api/pet/getpetOwner',
data: { 'mobilenum': mobilenum }, data: { 'mobilenum': mobilenum },
success: function (bodyMessage) { success: function (bodyMessage) {
ownercall(bodyMessage); ownercall(bodyMessage);
@ -464,7 +464,7 @@
function licenceInfo(mobno, uniqueid) { function licenceInfo(mobno, uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getlicenseinfo',
url: '/gcc/api/pet/getlicenseinfo',
data: { data: {
'mobilenum': mobno, 'mobilenum': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -492,7 +492,7 @@
//window.open('/owners/getlicensebymobo/'+id+'/'+phone,'_blank'); //window.open('/owners/getlicensebymobo/'+id+'/'+phone,'_blank');
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/owners/ /' + id + '/' + phone,
url: '/gcc/pet/owners/ /' + id + '/' + phone,
success: function (bodyMessage) { success: function (bodyMessage) {
$("#htmldatatxt").html(bodyMessage); $("#htmldatatxt").html(bodyMessage);
$('#getpetlic').modal({ $('#getpetlic').modal({
@ -521,12 +521,12 @@
var x = document.getElementById("fromdate").value; var x = document.getElementById("fromdate").value;
var y = document.getElementById("todate").value; var y = document.getElementById("todate").value;
var url = '/pet/licenseIssued?fromDate=' + x + '&toDate=' + y;
var url = '/gcc/pet/licenseIssued?fromDate=' + x + '&toDate=' + y;
window.location.href = url; window.location.href = url;
} }
function resetDate() { function resetDate() {
var url = '/pet/licenseIssued';
var url = '/gcc/pet/licenseIssued';
window.location.href = url; window.location.href = url;
} }

18
src/main/resources/templates/modules/petregistration/rejected.html

@ -385,7 +385,7 @@ $(document).ready(function() {
function petimg(mobno,uniqueid){ function petimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetimg',
url: '/gcc/api/pet/getpetimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -405,7 +405,7 @@ $(document).ready(function() {
function applicantimg(mobno,uniqueid){ function applicantimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getapplicantimg',
url: '/gcc/api/pet/getapplicantimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -424,7 +424,7 @@ $(document).ready(function() {
function certificateimg(mobno,uniqueid){ function certificateimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getvacimg',
url: '/gcc/api/pet/getvacimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -443,7 +443,7 @@ $(document).ready(function() {
function proofimg(mobno,uniqueid){ function proofimg(mobno,uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getaddproofimg',
url: '/gcc/api/pet/getaddproofimg',
data: { data: {
'mobno':mobno, 'mobno':mobno,
'uniqueid':uniqueid 'uniqueid':uniqueid
@ -473,7 +473,7 @@ $(document).ready(function() {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/accept',
url: '/gcc/api/accept',
data: {'id':id}, data: {'id':id},
success: function(bodyMessage) { success: function(bodyMessage) {
@ -499,7 +499,7 @@ $(document).ready(function() {
function reject(uniqueid){ function reject(uniqueid){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetInfo',
url: '/gcc/api/pet/getpetInfo',
data: { data: {
'petid':uniqueid 'petid':uniqueid
}, },
@ -540,7 +540,7 @@ $(document).ready(function() {
let own; let own;
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetOwner',
url: '/gcc/api/pet/getpetOwner',
data: {'mobilenum':mobilenum }, data: {'mobilenum':mobilenum },
success: function(bodyMessage) { success: function(bodyMessage) {
ownercall(bodyMessage); ownercall(bodyMessage);
@ -594,12 +594,12 @@ $(document).ready(function() {
var x= document.getElementById("fromdate").value; var x= document.getElementById("fromdate").value;
var y= document.getElementById("todate").value; var y= document.getElementById("todate").value;
var url= '/pet/rejectedPets?fromDate='+x+'&toDate='+y;
var url= '/gcc/pet/rejectedPets?fromDate='+x+'&toDate='+y;
window.location.href=url; window.location.href=url;
} }
function resetDate(){ function resetDate(){
var url= '/pet/rejectedPets';
var url= '/gcc/pet/rejectedPets';
window.location.href=url; window.location.href=url;
} }
</script> </script>

18
src/main/resources/templates/modules/petregistration/request-list.html

@ -421,7 +421,7 @@
alert(mobno + " "+uniqueid); alert(mobno + " "+uniqueid);
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/petregistration/getpetimg',
url: '/gcc/api/petregistration/getpetimg',
data: { data: {
'mobno': mobno, 'mobno': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -442,7 +442,7 @@
function applicantimg(mobno, uniqueid) { function applicantimg(mobno, uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/petregistration/getapplicantimg',
url: '/gcc/api/petregistration/getapplicantimg',
data: { data: {
'mobno': mobno, 'mobno': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -461,7 +461,7 @@
function certificateimg(mobno, uniqueid) { function certificateimg(mobno, uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/petregistration/getvaccineimg',
url: '/gcc/api/petregistration/getvaccineimg',
data: { data: {
'mobno': mobno, 'mobno': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -480,7 +480,7 @@
function proofimg(mobno, uniqueid) { function proofimg(mobno, uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/petregistration/getaddressproofimg',
url: '/gcc/api/petregistration/getaddressproofimg',
data: { data: {
'mobno': mobno, 'mobno': mobno,
'uniqueid': uniqueid 'uniqueid': uniqueid
@ -510,7 +510,7 @@
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/accept',
url: '/gcc/api/pet/accept',
data: { 'id': id, 'mobileNo': mobileNo }, data: { 'id': id, 'mobileNo': mobileNo },
success: function (bodyMessage) { success: function (bodyMessage) {
if (bodyMessage == "success") { if (bodyMessage == "success") {
@ -534,7 +534,7 @@
function reject(uniqueid) { function reject(uniqueid) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetInfo',
url: '/gcc/api/pet/getpetInfo',
data: { data: {
'petid': uniqueid 'petid': uniqueid
}, },
@ -616,7 +616,7 @@
let own; let own;
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/api/pet/getpetOwner',
url: '/gcc/api/pet/getpetOwner',
data: { 'mobilenum': mobilenum }, data: { 'mobilenum': mobilenum },
success: function (bodyMessage) { success: function (bodyMessage) {
ownercall(bodyMessage); ownercall(bodyMessage);
@ -673,12 +673,12 @@
var x = document.getElementById("fromdate").value; var x = document.getElementById("fromdate").value;
var y = document.getElementById("todate").value; var y = document.getElementById("todate").value;
var url = '/petregistration/requestlist?fromDate=' + x + '&toDate=' + y;
var url = '/gcc/pet/petregistration/requestlist?fromDate=' + x + '&toDate=' + y;
window.location.href = url; window.location.href = url;
} }
function resetDate() { function resetDate() {
var url = '/petregistration/requestlist';
var url = '/gcc/pet/petregistration/requestlist';
window.location.href = url; window.location.href = url;
} }
</script> </script>

12
src/main/resources/templates/modules/pgr/all-list.html

@ -64,6 +64,8 @@
<th class="text-center">Date</th> <th class="text-center">Date</th>
<th class="text-center">Time</th> <th class="text-center">Time</th>
<th class="text-center">Status</th> <th class="text-center">Status</th>
<th class="text-center">Department</th>
<th class="text-center">Mode</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -81,6 +83,8 @@
<th class="text-center">Date</th> <th class="text-center">Date</th>
<th class="text-center">Time</th> <th class="text-center">Time</th>
<th class="text-center">Status</th> <th class="text-center">Status</th>
<th class="text-center">Department</th>
<th class="text-center">Mode</th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@ -238,8 +242,8 @@
], ],
scrollY: '50vh', scrollY: '50vh',
fixedColumns: { fixedColumns: {
left: 1,
right: 1
left: 0,
right: 0
}, },
buttons: [buttons], buttons: [buttons],
responsive: true, responsive: true,
@ -264,7 +268,9 @@
row['LOCATION'], row['LOCATION'],
row['COMPDATE'], row['COMPDATE'],
row['TIME'], row['TIME'],
row['STATUS']
row['STATUS'],
row['DEPT_NAME'],
row['MODE']
]).draw(false); ]).draw(false);
}); });

52
src/main/resources/templates/modules/pgr/index.html

@ -3,7 +3,7 @@
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head> <head th:replace="~{fragments/modules/base/head :: head}"></head>
<body> <body>
<link rel="stylesheet" href="/assets/node_modules/amcharts3/amcharts/plugins/export/export.css" type="text/css" media="all" />
<link rel="stylesheet" href="node_modules/amcharts3/amcharts/plugins/export/export.css" type="text/css" media="all" />
<!--[if lt IE 8]> <!--[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> <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]--> <![endif]-->
@ -90,13 +90,13 @@
<script th:replace="~{fragments/modules/base/script :: script}"></script> <script th:replace="~{fragments/modules/base/script :: script}"></script>
<script th:replace="~{fragments/modules/pgr/script :: script}"></script> <script th:replace="~{fragments/modules/pgr/script :: script}"></script>
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/plugins/export/export.min.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/pie.js"></script>
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script>
<!-- <script src="/assets/node_modules/fullcalendar/dist/fullcalendar.min.js"></script>-->
<script src="/assets/node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="node_modules/amcharts3/amcharts/serial.js"></script>
<script src="node_modules/amcharts3/amcharts/plugins/export/export.min.js"></script>
<script src="node_modules/amcharts3/amcharts/pie.js"></script>
<script src="node_modules/amcharts3/amcharts/themes/light.js"></script>
<!-- <script src="node_modules/fullcalendar/dist/fullcalendar.min.js"></script>-->
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script>
<script> <script>
var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script var loading_text_msg = getLoadingMessage(); // get Random loading message from base/script
@ -127,31 +127,27 @@
departmentlist = departments; departmentlist = departments;
fetchPie_Data(0); // Dropdown fileter value fetchPie_Data(0); // Dropdown fileter value
fetchData_Bar(0); // Dropdown fileter value fetchData_Bar(0); // Dropdown fileter value
}).catch(function(error) { }).catch(function(error) {
// Handle errors // Handle errors
console.error('Error fetching department list:', error);
});
/*
var apiUrl = '/gcc/api/pgr/getDepartments';
$.ajax({
url: apiUrl,
type: 'GET',
dataType: 'json',
success: function(jsonResponse) {
// Handle the API response data here
console.log('Data from API:', jsonResponse);
departmentlist = jsonResponse;
fetchPie_Data(0); // Dropdown fileter value
fetchData_Bar(0); // Dropdown fileter value
console.error('Error fetching department list:', error.message);
//alert('Failed to fetch department list. Please try again later.');
Swal.fire({
title: 'Failed to fetch data from ERP. Please try again later.',
customClass: {
title: 'swal-title-custom' // Add a custom class for the title
}, },
error: function(xhr, status, error) {
// Handle errors here
console.error('Error fetching data:', status, error);
//text: "Error",
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ok',
}).then(function(result) {
if (result.isConfirmed) {
// Handle after confirmed button (Ok) click
} }
}); });
*/
});
} }
function fetchPie_Data(deptid){ function fetchPie_Data(deptid){

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save