10 Commits
014f177c1f
...
d4e31e1509
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
d4e31e1509 |
added on common based : Data encode Date Difference , filesize format and download file script
Base64 data encode : encodeBase64(value), formatFileSize(bytes), date_difference(fromdate,todate,type='datetime') and callDownload(fileUrl,fileName). |
3 years ago |
|
|
7c2f7e70bc |
URL Changed Based on Domain and nginx
For domain access, we utilize Nginx, which functions as both a web server and a reverse proxy. It directs base URL requests to the localhost server URL and facilitates access to files outside the web server based on the specified path (such as for uploading files). |
3 years ago |
|
|
e32683bb81 |
Nodata hardcoded to function
The hardcoded value changed to common Function |
3 years ago |
|
|
e5894a8383 |
Base Head Bell & Ribbon CSS
Bell Notification Animation and Ribbon extra CSS added |
3 years ago |
|
|
c7fd787de5 |
Error Page
Error Page GoBack Url #value added |
3 years ago |
|
|
2c46f58820 |
DataSource Config added
For Petition Master, Mayor Petition and Councillor Petition |
3 years ago |
|
|
8a9f3d6653 |
Module Url Changed
Qr Asset , mtm and Garbage Url Change |
3 years ago |
|
|
78f77049b2 |
New Mayor Petition Module
Mayor Petition module added. |
3 years ago |
|
|
e0e3aef4b5 |
New Councillor Petition Module
New module added for Councillor`s to add view update petition`s |
3 years ago |
|
|
cbd1b2a323 |
SQL DateTime dependency
SQL DateTime dependency added (jackson Datatype) Com.fasterxml.jackson.datatype |
3 years ago |
101 changed files with 10433 additions and 177 deletions
-
BIN.DS_Store
-
34pom.xml
-
BINsrc/.DS_Store
-
BINsrc/main/.DS_Store
-
BINsrc/main/java/.DS_Store
-
BINsrc/main/java/in/.DS_Store
-
BINsrc/main/java/in/gov/.DS_Store
-
BINsrc/main/java/in/gov/chennaicorporation/.DS_Store
-
BINsrc/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store
-
151src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/APIController.java
-
130src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/MainController.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/controller/package-info.java
-
21src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/data/ComplaintType.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/data/package-info.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/entity/package-info.java
-
7src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/package-info.java
-
671src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/Petition.java
-
58src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/PetitionMaster.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/c_petition/service/package-info.java
-
7src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java
-
45src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
-
5src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java
-
16src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java
-
56src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java
-
73src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java
-
7src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java
-
35src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java
-
156src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java
-
130src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/package-info.java
-
21src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/data/ComplaintType.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/data/package-info.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/entity/package-info.java
-
7src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/package-info.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/repository/package-info.java
-
671src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java
-
58src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/PetitionMaster.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/package-info.java
-
2src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java
-
2src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java
-
1src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java
-
2src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java
-
38src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java
-
3src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java
-
2src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java
-
BINsrc/main/resources/.DS_Store
-
18src/main/resources/application.properties
-
BINsrc/main/resources/static/.DS_Store
-
BINsrc/main/resources/static/assets/.DS_Store
-
BINsrc/main/resources/static/assets/dist/.DS_Store
-
4src/main/resources/static/assets/dist/css/theme.css
-
BINsrc/main/resources/static/assets/images/.DS_Store
-
BINsrc/main/resources/templates/.DS_Store
-
2src/main/resources/templates/error-403.html
-
2src/main/resources/templates/error-404.html
-
2src/main/resources/templates/error-500.html
-
2src/main/resources/templates/error.html
-
2src/main/resources/templates/fragments/modules/base/footer.html
-
487src/main/resources/templates/fragments/modules/base/head.html
-
30src/main/resources/templates/fragments/modules/base/header.html
-
2src/main/resources/templates/fragments/modules/base/menu.html
-
106src/main/resources/templates/fragments/modules/base/script.html
-
116src/main/resources/templates/fragments/modules/c_petition/modal-box.html
-
291src/main/resources/templates/fragments/modules/c_petition/petition_view_script.html
-
338src/main/resources/templates/fragments/modules/c_petition/script.html
-
19src/main/resources/templates/fragments/modules/c_petition/search_form.html
-
116src/main/resources/templates/fragments/modules/m_petition/modal-box.html
-
291src/main/resources/templates/fragments/modules/m_petition/petition_view_script.html
-
360src/main/resources/templates/fragments/modules/m_petition/script.html
-
19src/main/resources/templates/fragments/modules/m_petition/search_form.html
-
2src/main/resources/templates/fragments/modules/pgr/script.html
-
163src/main/resources/templates/index.html
-
2src/main/resources/templates/modules/admin/user-group-access.html
-
2src/main/resources/templates/modules/admin/user-list.html
-
750src/main/resources/templates/modules/c_petition/complaint_list.html
-
267src/main/resources/templates/modules/c_petition/new_petition.html
-
237src/main/resources/templates/modules/c_petition/petition_ack.html
-
282src/main/resources/templates/modules/c_petition/petition_list.html
-
267src/main/resources/templates/modules/c_petition/petition_not_mapped_list.html
-
719src/main/resources/templates/modules/c_petition/petition_update.html
-
158src/main/resources/templates/modules/c_petition/petition_view.html
-
108src/main/resources/templates/modules/c_petition/petition_view_modal_page.html
-
750src/main/resources/templates/modules/m_petition/complaint_list.html
-
301src/main/resources/templates/modules/m_petition/new_petition.html
-
237src/main/resources/templates/modules/m_petition/petition_ack.html
-
282src/main/resources/templates/modules/m_petition/petition_list.html
-
267src/main/resources/templates/modules/m_petition/petition_not_mapped_list.html
-
758src/main/resources/templates/modules/m_petition/petition_update.html
-
158src/main/resources/templates/modules/m_petition/petition_view.html
-
108src/main/resources/templates/modules/m_petition/petition_view_modal_page.html
-
6src/main/resources/templates/modules/mtm/index.html
-
6src/main/resources/templates/modules/mtm/officer/index.html
-
16src/main/resources/templates/modules/petregistration/accepted-list.html
-
2src/main/resources/templates/modules/petregistration/index.html
-
14src/main/resources/templates/modules/petregistration/license-issued.html
-
18src/main/resources/templates/modules/petregistration/rejected.html
-
18src/main/resources/templates/modules/petregistration/request-list.html
-
12src/main/resources/templates/modules/pgr/all-list.html
-
56src/main/resources/templates/modules/pgr/index.html
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.c_petition.controller; |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.c_petition.data; |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.c_petition.entity; |
||||
@ -0,0 +1,7 @@ |
|||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
package in.gov.chennaicorporation.gccoffice.c_petition; |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.c_petition.service; |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.m_petition.controller; |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.m_petition.data; |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.m_petition.entity; |
||||
@ -0,0 +1,7 @@ |
|||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
package in.gov.chennaicorporation.gccoffice.m_petition; |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.m_petition.repository; |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
package in.gov.chennaicorporation.gccoffice.m_petition.service; |
||||
@ -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,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 © Greater Chennai Corporation | All rights reserved</span> |
<span class="text-center text-sm-left d-md-inline-block">Copyright © 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> |
||||
|
|||||
@ -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">×</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">×</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">×</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">×</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">×</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 --> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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">×</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">×</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">×</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">×</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">×</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 --> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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"> 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> |
||||
|
</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"> </option>${HQSelect}</select>${forward_Btn}`; |
||||
|
} |
||||
|
if(type=="ZoneSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </option>${ZoneSelect}</select>${forward_Btn}`; |
||||
|
} |
||||
|
if(type=="ExSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </option>${ExSelect}</select>${forward_Btn}`; |
||||
|
} |
||||
|
return ''; |
||||
|
} |
||||
|
$(document).ready(function() { |
||||
|
call_loading(); |
||||
|
get_officer_master_data(); |
||||
|
get_complaint_list(); |
||||
|
|
||||
|
}); |
||||
|
</script> |
||||
|
</body> |
||||
|
</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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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"> </option>${HQSelect}</select>`; |
||||
|
} |
||||
|
if(type=="ZoneSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </option>${ZoneSelect}</select>`; |
||||
|
} |
||||
|
if(type=="ExSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </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"> </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"> </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"> </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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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"> 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> |
||||
|
</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"> </option>${HQSelect}</select>${forward_Btn}`; |
||||
|
} |
||||
|
if(type=="ZoneSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </option>${ZoneSelect}</select>${forward_Btn}`; |
||||
|
} |
||||
|
if(type=="ExSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </option>${ExSelect}</select>${forward_Btn}`; |
||||
|
} |
||||
|
return ''; |
||||
|
} |
||||
|
$(document).ready(function() { |
||||
|
call_loading(); |
||||
|
get_officer_master_data(); |
||||
|
get_complaint_list(); |
||||
|
|
||||
|
}); |
||||
|
</script> |
||||
|
</body> |
||||
|
</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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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"> </option>${HQSelect}</select>`; |
||||
|
} |
||||
|
if(type=="ZoneSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </option>${ZoneSelect}</select>`; |
||||
|
} |
||||
|
if(type=="ExSelect"){ |
||||
|
return `<select name="mapOfficers" id="mapOfficers${comid}" class="form-control"> <option value="0"> </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"> </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"> </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"> </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> |
||||
@ -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> |
||||
@ -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> |
||||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue