commit
08cd62444a
87 changed files with 54916 additions and 0 deletions
-
56backend/pensioner/controller/CompletedApiController.java
-
241backend/pensioner/controller/DashboardApiController.java
-
129backend/pensioner/controller/DepartmentForwardApiController.java
-
719backend/pensioner/controller/DepartmentMainController.java
-
172backend/pensioner/controller/DepartmentReceivedApiController.java
-
189backend/pensioner/controller/DeptAuditApiController.java
-
110backend/pensioner/controller/DeptPartiallyCompApiController.java
-
46backend/pensioner/controller/DropdownApiController.java
-
119backend/pensioner/controller/FileClosingApiController.java
-
59backend/pensioner/controller/FileClosingMainController.java
-
335backend/pensioner/controller/NewEntryAPIController.java
-
199backend/pensioner/controller/PendencyAutoConversionApiController.java
-
134backend/pensioner/controller/PensionAuditApiController.java
-
110backend/pensioner/controller/PensionPartiallyCompApiController.java
-
94backend/pensioner/controller/PensionReceivedApiController.java
-
624backend/pensioner/controller/PensionerMainController.java
-
145backend/pensioner/controller/ReceivedDeptProvisionalApiController.java
-
140backend/pensioner/controller/ReportApiController.java
-
129backend/pensioner/controller/ReturnFromAuditApiController.java
-
188backend/pensioner/scheduler/PendencyAutoConversionScheduler.java
-
177backend/pensioner/service/CompletedService.java
-
392backend/pensioner/service/DashboardApiService.java
-
214backend/pensioner/service/DepartmentForwardService.java
-
644backend/pensioner/service/DepartmentReceivedService.java
-
299backend/pensioner/service/DeptAuditService.java
-
354backend/pensioner/service/DeptPartiallyCompService.java
-
45backend/pensioner/service/DropdownService.java
-
194backend/pensioner/service/FileClosingService.java
-
762backend/pensioner/service/NewEntryService.java
-
264backend/pensioner/service/PendencyAutoConversionService.java
-
228backend/pensioner/service/PensionAuditService.java
-
326backend/pensioner/service/PensionPartiallyCompService.java
-
377backend/pensioner/service/PensionReceivedService.java
-
238backend/pensioner/service/ReceivedDeptProvisionalService.java
-
449backend/pensioner/service/ReportApiService.java
-
213backend/pensioner/service/ReturnFromAuditService.java
-
749frontend/pensioner/department/audit/familypension.html
-
731frontend/pensioner/department/audit/pendency.html
-
646frontend/pensioner/department/audit/retirement.html
-
1132frontend/pensioner/department/closedList.html
-
685frontend/pensioner/department/completed/contributorypensionscheme.html
-
814frontend/pensioner/department/completed/familypension.html
-
547frontend/pensioner/department/completed/gis.html
-
820frontend/pensioner/department/completed/pendency.html
-
695frontend/pensioner/department/completed/provisionalretirement.html
-
771frontend/pensioner/department/completed/retirement.html
-
934frontend/pensioner/department/dashboard.html
-
1230frontend/pensioner/department/fileclosing.html
-
946frontend/pensioner/department/newentry/contributorypensionscheme.html
-
886frontend/pensioner/department/newentry/familypension.html
-
1013frontend/pensioner/department/newentry/gis.html
-
758frontend/pensioner/department/newentry/pendency.html
-
849frontend/pensioner/department/newentry/provisionalretirement.html
-
802frontend/pensioner/department/newentry/retirement.html
-
1190frontend/pensioner/department/partial/familypension.html
-
1186frontend/pensioner/department/partial/pendency.html
-
1158frontend/pensioner/department/partial/retirement.html
-
997frontend/pensioner/department/received/familypension.html
-
972frontend/pensioner/department/received/pendency.html
-
909frontend/pensioner/department/received/provisionalretirement.html
-
917frontend/pensioner/department/received/retirement.html
-
1150frontend/pensioner/department/reports.html
-
727frontend/pensioner/department/return/familypension.html
-
720frontend/pensioner/department/return/pendency.html
-
613frontend/pensioner/department/return/retirement.html
-
742frontend/pensioner/pensioner/audit/familypension.html
-
733frontend/pensioner/pensioner/audit/pendency.html
-
614frontend/pensioner/pensioner/audit/retirement.html
-
687frontend/pensioner/pensioner/completed/contributorypensionscheme.html
-
807frontend/pensioner/pensioner/completed/familypension.html
-
546frontend/pensioner/pensioner/completed/gis.html
-
807frontend/pensioner/pensioner/completed/pendency.html
-
716frontend/pensioner/pensioner/completed/provisionalretirement.html
-
770frontend/pensioner/pensioner/completed/retirement.html
-
915frontend/pensioner/pensioner/dashboard.html
-
731frontend/pensioner/pensioner/forward/familypension.html
-
725frontend/pensioner/pensioner/forward/pendency.html
-
595frontend/pensioner/pensioner/forward/retirement.html
-
1190frontend/pensioner/pensioner/partial/familypension.html
-
1184frontend/pensioner/pensioner/partial/pendency.html
-
1184frontend/pensioner/pensioner/partial/retirement.html
-
1373frontend/pensioner/pensioner/received/familypension.html
-
726frontend/pensioner/pensioner/received/gis.html
-
1348frontend/pensioner/pensioner/received/pendency.html
-
1000frontend/pensioner/pensioner/received/provisionalretirement.html
-
1306frontend/pensioner/pensioner/received/retirement.html
-
1556frontend/pensioner/pensioner/reports.html
@ -0,0 +1,56 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.Map; |
|||
import java.util.List; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.CompletedService; |
|||
|
|||
@RequestMapping("gcc/api/department/completed") |
|||
@RestController |
|||
public class CompletedApiController { |
|||
|
|||
@Autowired |
|||
private CompletedService completedService; |
|||
|
|||
@Autowired |
|||
public CompletedApiController(CompletedService completedService) { |
|||
this.completedService = completedService; |
|||
} |
|||
|
|||
// Combined method to handle both cases (with and without emp_no parameter) |
|||
@GetMapping("/cpslist") |
|||
public ResponseEntity<?> getCPSList(@RequestParam(value = "emp_no", required = false) String empNo, |
|||
@RequestParam(required = false)Integer file_cat, |
|||
@RequestParam(required = false)Integer deptId) { |
|||
try { |
|||
List<Map<String, Object>> cpsList; |
|||
|
|||
// If emp_no is provided, fetch filtered records |
|||
if (empNo != null && !empNo.isEmpty()) { |
|||
cpsList = completedService.getCPSListByEmpNo(empNo); |
|||
} else { |
|||
// If emp_no is not provided, fetch all records |
|||
cpsList = completedService.getCPSList(file_cat,deptId); |
|||
} |
|||
|
|||
// Return response based on the data |
|||
if (cpsList.isEmpty()) { |
|||
return ResponseEntity.noContent().build(); // No records found |
|||
} |
|||
|
|||
return ResponseEntity.ok(cpsList); // Return the records |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Error occurred while fetching completed service records."); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,241 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DashboardApiService; |
|||
@RestController |
|||
public class DashboardApiController { |
|||
@Autowired |
|||
private DashboardApiService dashboardApiService; |
|||
|
|||
@GetMapping("/dashboard") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getDashboardData() { |
|||
|
|||
return dashboardApiService.fetchCategoryCounts(); |
|||
} |
|||
/*@GetMapping("/dashboardsearch") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> fetchDashboardData( |
|||
@RequestParam(required = false) String startdate, |
|||
@RequestParam(required = false) String enddate) { |
|||
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate); |
|||
try { |
|||
return dashboardApiService.fetchCategorysearchCounts(startdate, enddate); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs |
|||
throw e; // Rethrow the exception to propagate the 500 error |
|||
} |
|||
} |
|||
@GetMapping("/categoryCounts") |
|||
public List<Map<String, Object>> getCategoryCounts() { |
|||
return dashboardApiService.fetchCategoryCounts(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getEmpNoByFileName") |
|||
public List<Map<String, Object>> getEmployeeDetails(@RequestParam("file_id") String FileId) { |
|||
System.out.println("before fetch"); |
|||
return dashboardApiService.getEmployeeDetails(FileId); |
|||
} |
|||
@GetMapping("/stageWiseCounts") |
|||
public ResponseEntity<List<Map<String, Object>>> getStageWiseCounts() { |
|||
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getStageWiseCounts(); |
|||
return ResponseEntity.ok(stageWiseCounts); |
|||
}*/ |
|||
|
|||
@GetMapping("/getDepartments") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getDepartment() { |
|||
return dashboardApiService.getDepartment(); |
|||
} |
|||
@GetMapping("/getEmpNoByFileName") |
|||
public List<Map<String, Object>> getEmployeeDetails(@RequestParam("file_id") String FileId) { |
|||
System.out.println("before fetch"); |
|||
return dashboardApiService.getEmployeeDetails(FileId); |
|||
} |
|||
|
|||
|
|||
//department |
|||
|
|||
@GetMapping("/deparmentdashboard") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getDepartmentDashboardData(@RequestParam(required = false) String deptId) { |
|||
System.out.println("deptid"+ deptId); |
|||
return dashboardApiService.DepartmenfetchCategoryCounts(deptId); |
|||
} |
|||
|
|||
|
|||
/* @GetMapping("/deparmentcategoryCounts") |
|||
public List<Map<String, Object>> getDepartmenCategoryCounts(@RequestParam(required = false) String deptId) { |
|||
return dashboardApiService.DepartmenfetchCategoryCounts(deptId); |
|||
} |
|||
//DepartmentstageWiseCounts |
|||
|
|||
@GetMapping("/DepartmentstageWiseCounts") |
|||
public ResponseEntity<List<Map<String, Object>>> getDepartmentStageWiseCounts(@RequestParam(required = false) String deptId) { |
|||
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getDepartmentStageWiseCounts(deptId); |
|||
return ResponseEntity.ok(stageWiseCounts); |
|||
}*/ |
|||
|
|||
|
|||
@GetMapping("/stageWiseCounts") |
|||
public ResponseEntity<List<Map<String, Object>>> getDepartmentStageWiseCounts( |
|||
@RequestParam(required = false) String deptId, |
|||
@RequestParam(required = false) String startDate, |
|||
@RequestParam(required = false) String endDate) { |
|||
|
|||
if(startDate.isEmpty()) |
|||
{ |
|||
startDate=null; |
|||
} |
|||
if(endDate.isEmpty()) |
|||
{ |
|||
endDate=null; |
|||
} |
|||
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getStageWiseCounts(deptId, startDate, endDate); |
|||
return ResponseEntity.ok(stageWiseCounts); |
|||
} |
|||
@GetMapping("/categoryCounts") |
|||
public List<Map<String, Object>> getDepartmenCategoryCounts( |
|||
@RequestParam(required = false) String deptId, |
|||
@RequestParam(required = false) String startDate, |
|||
@RequestParam(required = false) String endDate) { |
|||
|
|||
if(startDate.isEmpty()) |
|||
{ |
|||
startDate=null; |
|||
} |
|||
if(endDate.isEmpty()) |
|||
{ |
|||
endDate=null; |
|||
} |
|||
|
|||
return dashboardApiService.fetchchartCategoryCounts(deptId, startDate, endDate); |
|||
} |
|||
|
|||
@GetMapping("/dashboardsearch") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> fetchDeparmentDashboardData( |
|||
@RequestParam(required = false) String startdate, |
|||
@RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) { |
|||
if(deptId.isEmpty()) |
|||
{ |
|||
deptId=null; |
|||
} |
|||
|
|||
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate); |
|||
try { |
|||
return dashboardApiService.fetchCategorysearchCounts(startdate, enddate,deptId); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs |
|||
throw e; // Rethrow the exception to propagate the 500 error |
|||
} |
|||
} |
|||
|
|||
//pension |
|||
|
|||
@GetMapping("/pensiondashboard") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getPensionDashboardData(@RequestParam(required = false) String deptId) { |
|||
System.out.println("deptid"+ deptId); |
|||
return dashboardApiService.DepartmenfetchCategoryCounts(deptId); |
|||
} |
|||
/* @GetMapping("/pensiondashboardsearch") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> fetchpensionDashboardData( |
|||
@RequestParam(required = false) String startdate, |
|||
@RequestParam(required = false) String enddate,@RequestParam(required = false) String deptId) { |
|||
|
|||
if(deptId.isEmpty()) |
|||
{ |
|||
deptId=null; |
|||
} |
|||
|
|||
|
|||
System.out.println("Endpoint hit with startdate: " + startdate + ", enddate: " + enddate); |
|||
try { |
|||
return dashboardApiService.fetchDeparmentCategorysearchCounts(startdate, enddate,deptId); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Print fetchCategoryCounts stack trace to the logs |
|||
throw e; // Rethrow the exception to propagate the 500 error |
|||
} |
|||
}*/ |
|||
|
|||
|
|||
/* @GetMapping("/pensioncategoryCounts") |
|||
public List<Map<String, Object>> getpensionCategoryCounts( |
|||
@RequestParam(required = false) String deptId, |
|||
@RequestParam(required = false) String startDate, |
|||
@RequestParam(required = false) String endDate) { |
|||
|
|||
if(startDate.isEmpty()) |
|||
{ |
|||
startDate=null; |
|||
} |
|||
if(endDate.isEmpty()) |
|||
{ |
|||
endDate=null; |
|||
} |
|||
|
|||
return dashboardApiService.DepartmenfetchDepartmentCategoryCounts(deptId, startDate, endDate); |
|||
}*/ |
|||
|
|||
|
|||
/* @GetMapping("/pensionstageWiseCounts") |
|||
public ResponseEntity<List<Map<String, Object>>> getpensionStageWiseCounts( |
|||
@RequestParam(required = false) String deptId, |
|||
@RequestParam(required = false) String startDate, |
|||
@RequestParam(required = false) String endDate) { |
|||
|
|||
if(startDate.isEmpty()) |
|||
{ |
|||
startDate=null; |
|||
} |
|||
if(endDate.isEmpty()) |
|||
{ |
|||
endDate=null; |
|||
} |
|||
List<Map<String, Object>> stageWiseCounts = dashboardApiService.getDepartmentStageWiseCounts(deptId, startDate, endDate); |
|||
return ResponseEntity.ok(stageWiseCounts); |
|||
}*/ |
|||
|
|||
@GetMapping("/fetchEmpDetails") |
|||
public List<Map<String, Object>> getEmpDetails(@RequestParam(required = false) String Empcode) { |
|||
System.out.println("checking"); |
|||
System.out.println(Empcode); |
|||
|
|||
return dashboardApiService.getEmpDetails(Empcode); |
|||
} |
|||
|
|||
@GetMapping("/fetchPensionEmpDetails") |
|||
public List<Map<String, Object>> getPensionEmpDetails(@RequestParam(required = false) String Empcode) { |
|||
System.out.println("checking"); |
|||
System.out.println(Empcode); |
|||
|
|||
return dashboardApiService.getPensionEmpDetails(Empcode); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/fetchTempDetails") |
|||
public List<Map<String, Object>> getTempEmpDetails(@RequestParam(required = false) String tempId) { |
|||
System.out.println("checking"); |
|||
System.out.println(tempId); |
|||
|
|||
return dashboardApiService.getTempEmpDetails(tempId); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentForwardService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
|
|||
@RequestMapping("gcc/api/pension/forward") |
|||
@RestController |
|||
public class DepartmentForwardApiController { |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
private DepartmentForwardService departmentForwardService; |
|||
|
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
boolean isSaved = departmentForwardService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=departmentForwardService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File Forward to Department successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
//family pension |
|||
@PostMapping("/updateForwardFamilyPension") |
|||
public ResponseEntity<String> updateForwardFamilyPension(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = departmentForwardService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=departmentForwardService.saveFamilyPensionForwardHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File Forward to Department successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
@PostMapping("/updateForwardPendency") |
|||
public ResponseEntity<String> updateForwardPendency(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = departmentForwardService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=departmentForwardService.savePendencyForwardHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File Forward to Department successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,719 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
|
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.CompletedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentForwardService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentReceivedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptPartiallyCompService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReturnFromAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
|||
|
|||
@RequestMapping("/gcc/department") |
|||
@Controller("gccpensioner") |
|||
public class DepartmentMainController { |
|||
|
|||
@Autowired |
|||
private NewEntryService newEntryService; |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
private ReturnFromAuditService returnFromAuditService; |
|||
|
|||
@Autowired |
|||
private PensionAuditService pensionAuditService; |
|||
|
|||
@Autowired |
|||
private DepartmentForwardService departmentForwardService; |
|||
|
|||
@Autowired |
|||
private PensionReceivedService pensionReceivedService; |
|||
|
|||
@Autowired |
|||
private DepartmentReceivedService departmentReceivedService; |
|||
|
|||
@Autowired |
|||
private ReceivedDeptProvisionalService receivedDeptProvisionalService; |
|||
|
|||
@Autowired |
|||
private CompletedService completedService; |
|||
|
|||
@Autowired |
|||
public DeptPartiallyCompService deptPartiallyCompleteService; |
|||
|
|||
|
|||
|
|||
//////////////////////department pages///////////////////////////////// |
|||
|
|||
//yogi |
|||
@GetMapping("/newentry/retirement") |
|||
public String newentryretirement( Model model) { |
|||
|
|||
|
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
return "modules/pensioner/department/newentry/retirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/newentry/familypension") |
|||
public String newentryfamilypension(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
return "modules/pensioner/department/newentry/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/newentry/pendency") |
|||
public String newentrypendency(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
return "modules/pensioner/department/newentry/pendency"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/newentry/gis") |
|||
public String newentrygis(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getGISFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
return "modules/pensioner/department/newentry/gis"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/newentry/provisionalretirement") |
|||
public String newentryprovisional(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getPRFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
return "modules/pensioner/department/newentry/provisionalretirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/newentry/contributorypensionscheme") |
|||
public String newentrycontributory(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getCPSFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
return "modules/pensioner/department/newentry/contributorypensionscheme"; |
|||
} |
|||
|
|||
|
|||
//sanjay//////////////AUDIT LIST PAGES////////////////// |
|||
|
|||
@GetMapping("/audit/retirement") |
|||
public String auditretirement(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>auditlist=deptAuditService.fetchEmployeeDetailsByTable(deptId,file_cat); |
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/department/audit/retirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/audit/familypension") |
|||
public String auditfamilypension(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
|
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>auditlist=deptAuditService.fetchEmployeeDetailsByTable(deptId,file_cat); |
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
|
|||
return "modules/pensioner/department/audit/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/audit/pendency") |
|||
public String auditpendency(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
|
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
|
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>auditlist=deptAuditService.fetchEmployeeDetailsByTable(deptId,file_cat); |
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/department/audit/pendency"; |
|||
} |
|||
|
|||
|
|||
///////////////////PARTIAL LIST PAGES////////////////////// |
|||
|
|||
@GetMapping("/partial/retirement") |
|||
public String partialretirement(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>auditlist=deptPartiallyCompleteService.fetchDepatmentPartialEmpfiles(deptId,file_cat); |
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/department/partial/retirement"; |
|||
} |
|||
|
|||
@GetMapping("/partial/familypension") |
|||
public String partialfamilypension(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>auditlist=deptPartiallyCompleteService.fetchDepatmentPartialEmpfiles(deptId,file_cat); |
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/department/partial/familypension"; |
|||
} |
|||
|
|||
@GetMapping("/partial/pendency") |
|||
public String partialpendency(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>auditlist=deptPartiallyCompleteService.fetchDepatmentPartialEmpfiles(deptId,file_cat); |
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/department/partial/pendency"; |
|||
} |
|||
|
|||
|
|||
|
|||
//dizho/////////////RETURN LIST PAGES////////////////// |
|||
|
|||
@GetMapping("/return/retirement") |
|||
public String returnretirement(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>returnlist=returnFromAuditService.fetchReturnEmpfiles(deptId,file_cat); |
|||
System.out.println("returnlist===="+returnlist); |
|||
model.addAttribute("returnlist", returnlist); |
|||
|
|||
return "modules/pensioner/department/return/retirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/return/familypension") |
|||
public String returnfamilypension(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>returnlist=returnFromAuditService.fetchReturnEmpfiles(deptId,file_cat); |
|||
System.out.println("returnlist===="+returnlist); |
|||
model.addAttribute("returnlist", returnlist); |
|||
|
|||
return "modules/pensioner/department/return/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/return/pendency") |
|||
public String returnpendency(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
|
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
|
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>returnlist=returnFromAuditService.fetchReturnEmpfiles(deptId,file_cat); |
|||
System.out.println("returnlist===="+returnlist); |
|||
model.addAttribute("returnlist", returnlist); |
|||
|
|||
return "modules/pensioner/department/return/pendency"; |
|||
} |
|||
|
|||
//////////////////RECEIVED LIST PAGES///////////////////// |
|||
|
|||
|
|||
@GetMapping("/received/retirement") |
|||
public String receivedretirement(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>receivedlist=pensionReceivedService.fetchReceivedDepartmentEmpfiles(deptId,file_cat); |
|||
System.out.println("receivedlist===="+receivedlist); |
|||
model.addAttribute("receivedlist", receivedlist); |
|||
|
|||
return "modules/pensioner/department/received/retirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/received/familypension") |
|||
public String receivedfamilypension(Model model) { |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>receivedlist=pensionReceivedService.fetchReceivedDepartmentEmpfiles(deptId,file_cat); |
|||
System.out.println("receivedlist===="+receivedlist); |
|||
model.addAttribute("receivedlist", receivedlist); |
|||
|
|||
return "modules/pensioner/department/received/familypension"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/received/pendency") |
|||
public String receivedpendency(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
List<Map<String, Object>>receivedlist=pensionReceivedService.fetchReceivedDepartmentEmpfiles(deptId,file_cat); |
|||
System.out.println("receivedlist===="+receivedlist); |
|||
model.addAttribute("receivedlist", receivedlist); |
|||
|
|||
return "modules/pensioner/department/received/pendency"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/received/provisionalretirement") |
|||
public String receivedprovisionalretirement(Model model) { |
|||
int file_cat= newEntryService.getPRFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>provisionallist= receivedDeptProvisionalService.fetchDetailsProvisionalDepartment(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+provisionallist); |
|||
model.addAttribute("provisionallist", provisionallist); |
|||
|
|||
return "modules/pensioner/department/received/provisionalretirement"; |
|||
} |
|||
|
|||
|
|||
////////////////COMPLETED LIST PAGES///////////////////////////// |
|||
|
|||
@GetMapping("/completed/retirement") |
|||
public String completedretirement(Model model) { |
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>retirementcompletedlist= completedService.fetchDetailsCompletedRetirement(file_cat,deptId); |
|||
|
|||
System.out.println("provisionallist"+retirementcompletedlist); |
|||
model.addAttribute("provisionallist", retirementcompletedlist); |
|||
|
|||
return "modules/pensioner/department/completed/retirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/completed/familypension") |
|||
public String completedfamilypension(Model model) { |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>familypensioncompletedlist= completedService.fetchDetailsCompletedFamilyPension(file_cat,deptId); |
|||
|
|||
System.out.println("provisionallist===="+familypensioncompletedlist); |
|||
model.addAttribute("provisionallist", familypensioncompletedlist); |
|||
|
|||
return "modules/pensioner/department/completed/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/completed/pendency") |
|||
public String completedpendency(Model model) { |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>pendencycompletedlist= completedService.fetchDetailsCompletedPendency(file_cat,deptId); |
|||
|
|||
System.out.println("provisionallist===="+pendencycompletedlist); |
|||
model.addAttribute("provisionallist", pendencycompletedlist); |
|||
|
|||
return "modules/pensioner/department/completed/pendency"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/completed/gis") |
|||
public String completedgis(Model model) { |
|||
int file_cat= newEntryService.getGISFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>gislist= completedService.fetchDetailsForrecivedGiscompleted(file_cat,deptId); |
|||
|
|||
System.out.println("auditlist===="+gislist); |
|||
model.addAttribute("auditlist", gislist); |
|||
|
|||
return "modules/pensioner/department/completed/gis"; |
|||
} |
|||
|
|||
@GetMapping("/completed/provisionalretirement") |
|||
public String completedprovisionalretirement(Model model) { |
|||
int file_cat= newEntryService.getPRFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>provisionallist= completedService.fetchDetailsProvisionalDepartmentCompleted(file_cat,deptId); |
|||
|
|||
System.out.println("provisionallist===="+provisionallist); |
|||
model.addAttribute("provisionallist", provisionallist); |
|||
|
|||
return "modules/pensioner/department/completed/provisionalretirement"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/completed/contributorypensionscheme") |
|||
public String completedContributoryPensionScheme( |
|||
|
|||
Model model) { |
|||
// Get logged-in user details |
|||
|
|||
int file_cat= newEntryService.getCPSFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>completedCPSList= completedService.getCPSList(file_cat,deptId); |
|||
|
|||
System.out.println("provisionallist===="+completedCPSList); |
|||
model.addAttribute("provisionallist", completedCPSList); |
|||
// Add the list to the model |
|||
model.addAttribute("completedCPSList", completedCPSList); |
|||
|
|||
return "modules/pensioner/department/completed/contributorypensionscheme"; |
|||
} |
|||
|
|||
|
|||
|
|||
//Ajith ////////////////REPORTS LIST PAGES////////////////////// |
|||
|
|||
@GetMapping("/reports") |
|||
public String reports(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
return "modules/pensioner/department/reports"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/dashboard") |
|||
public String dashboard(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
|
|||
return "modules/pensioner/department/dashboard"; |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,172 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentReceivedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
|
|||
@RequestMapping("gcc/api/pension/received") |
|||
@RestController |
|||
public class DepartmentReceivedApiController { |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
private DepartmentReceivedService departmentReceivedService; |
|||
|
|||
@PostMapping("/updateforretirementcompleted") |
|||
public ResponseEntity<String> updateRetirementEmployeeDetailsCompleted(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Extract request parameters |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
int file_Status = 0; // Initialize file_status |
|||
|
|||
// Call service method to save the details |
|||
boolean isSaved = departmentReceivedService.updateEntryCompletedDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
// Fetch employee details |
|||
List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:" + emp_details); |
|||
|
|||
// Fetch pension benefits details |
|||
List<Map<String, Object>> pension_details = departmentReceivedService.fetchPensionbenefitsById(tempId); |
|||
System.out.println("pension_details:==:" + pension_details); |
|||
|
|||
// Save retirement completed history |
|||
boolean updated = departmentReceivedService.saveRetirementCompletedhistory(emp_details, pension_details, filemovedby); |
|||
|
|||
// Retrieve file_status from emp_details |
|||
if (!emp_details.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = emp_details.get(0); |
|||
Object fileStatusObj = firstEmployeeDetails.get("file_status"); |
|||
|
|||
if (fileStatusObj != null) { |
|||
try { |
|||
file_Status = Integer.parseInt(fileStatusObj.toString()); |
|||
System.out.println("Parsed file_status: " + file_Status); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_status: " + fileStatusObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_status is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
// Final response logic |
|||
if (updated && file_Status != 0) { |
|||
if (file_Status == 11) { |
|||
return ResponseEntity.ok("File Completed successfully!"); |
|||
} else { |
|||
//return ResponseEntity.ok("File Moved Department to Complete Pending fields!"); |
|||
return ResponseEntity.ok("File Moved to Partially Completed!"); |
|||
} |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Failed to save details in history or invalid file_status."); |
|||
} |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details for completed."); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
@PostMapping("/updateforretirementpending") |
|||
public ResponseEntity<String> updateRetirementEmployeeDetailsPending(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Extract request parameters |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
|
|||
|
|||
// Call service method to save the details |
|||
boolean isSaved = departmentReceivedService.updateEntryPendingDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
// Fetch employee details |
|||
List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:" + emp_details); |
|||
|
|||
// Fetch pension benefits details |
|||
List<Map<String, Object>> pension_details = departmentReceivedService.fetchPensionbenefitsById(tempId); |
|||
System.out.println("pension_details:==:" + pension_details); |
|||
|
|||
// Save retirement completed history |
|||
boolean updated = departmentReceivedService.saveRetirementPendinghistory(emp_details, pension_details, filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File is Pending!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details for pending."); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
@PostMapping("/updateforretirementreturn") |
|||
public ResponseEntity<String> updateRetirementEmployeeDetailsReturn(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Extract request parameters |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
|
|||
|
|||
// Call service method to save the details |
|||
boolean isSaved = departmentReceivedService.updateEntryReturnDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
// Fetch employee details |
|||
List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:" + emp_details); |
|||
|
|||
// Save retirement completed history |
|||
boolean updated = departmentReceivedService.saveRetirementreturnhistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File Returned to Department!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details for pending."); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,189 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
|
|||
@RequestMapping("gcc/api/department/audit") |
|||
@RestController |
|||
public class DeptAuditApiController { |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
|
|||
@GetMapping("/getemployeedetails") |
|||
public List<Map<String, Object>> getEmployeedetailsbyCode( |
|||
@RequestParam String tempId) { |
|||
|
|||
List<Map<String, Object>> employeeDetails = deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("employeeDetails==="+employeeDetails); |
|||
return employeeDetails; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/getemployeedetailscps") |
|||
public List<Map<String, Object>> getEmployeedetailsbyCodeCps( |
|||
@RequestParam String tempId) { |
|||
|
|||
List<Map<String, Object>> employeeDetails = deptAuditService.fetchEmployeeByIdCps(tempId); |
|||
System.out.println("employeeDetails==="+employeeDetails); |
|||
return employeeDetails; |
|||
} |
|||
|
|||
@GetMapping("/getzonebenefitsdetails") |
|||
public List<Map<String, Object>> getdetailsWithZonebenefits( |
|||
@RequestParam String tempId) { |
|||
|
|||
List<Map<String, Object>> zoneBenefitDetails = deptAuditService.fetchDetailsWithZoneBenefitsById(tempId); |
|||
System.out.println("zoneBenefitDetails==="+zoneBenefitDetails); |
|||
return zoneBenefitDetails; |
|||
} |
|||
|
|||
@GetMapping("/getfilependingbenefits") |
|||
public List<Map<String, Object>> getAllBenefitsDetails( |
|||
@RequestParam String tempId) { |
|||
|
|||
List<Map<String, Object>> allBenefitDetails = deptAuditService.fetchFilePendingBenefits(tempId); |
|||
System.out.println("allBenefitDetails==="+allBenefitDetails); |
|||
return allBenefitDetails; |
|||
} |
|||
|
|||
@GetMapping("/getpartialdetails") |
|||
public List<Map<String, Object>> getAllPartialDetails( |
|||
@RequestParam String tempId) { |
|||
|
|||
List<Map<String, Object>> partialDetails = deptAuditService.fetchPartialCompleted(tempId); |
|||
System.out.println("partialDetails==="+partialDetails); |
|||
return partialDetails; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/fileMovementhistory") |
|||
public List<Map<String, Object>> getFileMovementHistory(@RequestParam String tempId) { |
|||
List<Map<String, Object>> fileHistory = deptAuditService.fetchFileMovementHistory(tempId); |
|||
|
|||
return fileHistory; |
|||
} |
|||
|
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = deptAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=deptAuditService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
//update the family pension details |
|||
|
|||
@PostMapping("/updateFamilyPensionDetails") |
|||
public ResponseEntity<String> updateFamilyPensionDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = deptAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=deptAuditService.saveFamilyPensionHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
//pendency |
|||
@PostMapping("/updatePendencyDetails") |
|||
public ResponseEntity<String> updatePendencyDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = deptAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=deptAuditService.savePendencyHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,110 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptPartiallyCompService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
|||
|
|||
@RequestMapping("gcc/api/department/partial") |
|||
@RestController |
|||
public class DeptPartiallyCompApiController { |
|||
|
|||
@Autowired |
|||
public DeptPartiallyCompService deptPartiallyCompleteService; |
|||
|
|||
@Autowired |
|||
public DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
public PensionReceivedService pensionReceivedService; |
|||
|
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
int fs1=0; |
|||
|
|||
boolean isSaved = deptPartiallyCompleteService.updateEntryCompletedDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchPartialCompleted(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
|
|||
|
|||
List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId); |
|||
System.out.println("zone_benefits:==:"+zone_benefits); |
|||
|
|||
List<Map<String, Object>> pension_benefits=pensionReceivedService.fetchPensionbenefitsById(tempId); |
|||
System.out.println("pension_benefits:==:"+pension_benefits); |
|||
|
|||
|
|||
boolean updated=deptPartiallyCompleteService.saveHistory(emp_details,zone_benefits,pension_benefits,filemovedby); |
|||
|
|||
if (!emp_details.isEmpty()) { // Ensure list is not empty |
|||
Map<String, Object> empDetailMap = emp_details.get(0); // Get first map from the list |
|||
|
|||
// Ensure the key exists in the map |
|||
if (empDetailMap.containsKey("file_status")) { |
|||
Object fileStatusObj = empDetailMap.get("file_status"); |
|||
|
|||
if (fileStatusObj != null) { |
|||
String fs = fileStatusObj.toString(); // Convert to String safely |
|||
fs1 = Integer.parseInt(fs); // Convert to integer if needed |
|||
System.out.println("file_status: " + fs1); |
|||
} else { |
|||
System.out.println("file_status is null"); |
|||
} |
|||
} else { |
|||
System.out.println("Key 'file_status' not found in emp_details"); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details list is empty"); |
|||
} |
|||
|
|||
|
|||
if(updated) |
|||
{ |
|||
if(fs1==11 && fs1!=0) |
|||
{ |
|||
return ResponseEntity.ok("File Completed successfully!"); |
|||
} |
|||
else if(fs1==9 && fs1!=0) { |
|||
return ResponseEntity.ok("File Partially Completed!"); |
|||
} |
|||
else if(fs1==10 && fs1!=0){ |
|||
return ResponseEntity.ok("File Moved to Pension for Complete!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.ok("File Status is 0!"); |
|||
} |
|||
|
|||
|
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DropdownService; |
|||
|
|||
@RequestMapping("gcc/api") |
|||
@Controller |
|||
public class DropdownApiController { |
|||
|
|||
@Autowired |
|||
private DropdownService dropdownService; |
|||
|
|||
@GetMapping("/getRetrimentTypes") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getRetrimentTypes() { |
|||
return dropdownService.getRetrimentTypes(); |
|||
} |
|||
|
|||
@GetMapping("/getCategoryTypes") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getCategoryTypes() { |
|||
return dropdownService.getCategoryTypes(); |
|||
} |
|||
|
|||
@GetMapping("/getProvisionalReasonTypes") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getProvisionalReasonTypes() { |
|||
return dropdownService.getProvisionalReasonTypes(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getGisEntryTypes") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getGisEntryTypes() { |
|||
return dropdownService.getGisEntryTypes(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,119 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.FileClosingService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
|||
|
|||
@RequestMapping("gcc/api/fileclosing") |
|||
@RestController |
|||
public class FileClosingApiController { |
|||
|
|||
|
|||
@Autowired |
|||
private FileClosingService fileClosingService; |
|||
|
|||
|
|||
@Autowired |
|||
private NewEntryService newEntryService; |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@GetMapping("/getdetails") |
|||
public List<Map<String, Object>> getEmployeedetailsbyCode( @RequestParam String empCode, @RequestParam String deptId){ |
|||
|
|||
int dept_id=Integer.parseInt(deptId); |
|||
|
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
System.out.println("file_cat>>>>>>"+file_cat); |
|||
String tempId=fileClosingService.getTempId(empCode,dept_id,file_cat); |
|||
|
|||
System.out.println("empCode>>>>>"+empCode); |
|||
System.out.println("deptId>>>>>>"+dept_id); |
|||
System.out.println("tempId>>>>>>"+tempId); |
|||
|
|||
List<Map<String, Object>> employeeDetails = fileClosingService.fetchEmployeeByTempId(tempId); |
|||
System.out.println("employeeDetails==="+employeeDetails); |
|||
|
|||
return employeeDetails; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getemployeedetails") |
|||
public List<Map<String, Object>> getEmployeedetailsbyCode( |
|||
@RequestParam String tempId) { |
|||
|
|||
System.out.println("temporary==="+tempId); |
|||
|
|||
List<Map<String, Object>> employeeDetails = fileClosingService.fetchEmployeeById(tempId); |
|||
System.out.println("employeeDetails==="+employeeDetails); |
|||
return employeeDetails; |
|||
} |
|||
|
|||
|
|||
@PostMapping("/updateDetails") |
|||
public ResponseEntity<String> updateDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
System.out.println("data"+requestData); |
|||
|
|||
boolean isSaved = fileClosingService.updateEntryDetails(requestData); |
|||
|
|||
|
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=fileClosingService.saveclosinghistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Return from Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
//closed list api |
|||
|
|||
@GetMapping("/getcloseddetails") |
|||
public List<Map<String, Object>> getClosedEmployeedetails(){ |
|||
|
|||
List<Map<String, Object>> employeeDetails = fileClosingService.fetchClosingEmployee(); |
|||
System.out.println("employeeDetails==="+employeeDetails); |
|||
|
|||
return employeeDetails; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
|||
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
|||
|
|||
|
|||
@RequestMapping("/gcc/departmentfileclosing") |
|||
@Controller("gccpensionerfileclosing") |
|||
|
|||
|
|||
public class FileClosingMainController { |
|||
|
|||
|
|||
@Autowired |
|||
|
|||
private NewEntryService newEntryService; |
|||
|
|||
|
|||
@GetMapping("/fileclosing") |
|||
public String searchEmployee(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
|
|||
return "modules/pensioner/department/fileclosing"; |
|||
} |
|||
|
|||
@GetMapping("/closedlist") |
|||
public String closedEmployeeList(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
|
|||
return "modules/pensioner/department/closedList"; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,335 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.time.format.DateTimeParseException; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.xmlbeans.impl.xb.xsdschema.Public; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
|||
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
|||
|
|||
@RequestMapping("gcc/api/department/newentry") |
|||
@RestController |
|||
public class NewEntryAPIController { |
|||
|
|||
@Autowired |
|||
private NewEntryService newEntryService; |
|||
|
|||
@Autowired |
|||
public NewEntryAPIController(NewEntryService newEntryService) { |
|||
this.newEntryService = newEntryService; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/retirementdetails") |
|||
public Map<String, Object> getRetriedDetails( |
|||
@RequestParam(value = "deptId", required = false) Integer deptId, |
|||
@RequestParam(value = "file_category", required = false) Integer file_category, |
|||
@RequestParam(value = "fromDate", required = false) String fromDate1, |
|||
@RequestParam(value = "toDate", required = false) String toDate1) |
|||
{ |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
if (deptId == null) { |
|||
response.put("status", "deptid"); |
|||
response.put("message", "Department Id is null"); |
|||
return response; |
|||
|
|||
} |
|||
|
|||
System.out.println("Received deptId: " + deptId); |
|||
System.out.println("Received fromDate: " + fromDate1); |
|||
System.out.println("Received toDate: " + toDate1); |
|||
|
|||
LocalDate fromDate; |
|||
LocalDate toDate ; |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
|||
|
|||
LocalDate now = LocalDate.now(); |
|||
int currentYear = now.getYear(); |
|||
|
|||
if(fromDate1.isEmpty()) { |
|||
fromDate = LocalDate.of(currentYear, 4, 1); |
|||
} |
|||
|
|||
if(toDate1.isEmpty()) { |
|||
toDate = LocalDate.of(currentYear + 1, 3, 31); // March 31 of the next year |
|||
} |
|||
|
|||
if(fromDate1.isEmpty() && toDate1.isEmpty()) { |
|||
fromDate = LocalDate.of(currentYear, 4, 1); // April 1 of the current year |
|||
toDate = LocalDate.of(currentYear + 1, 3, 31); // March 31 of the next year |
|||
|
|||
} |
|||
else { |
|||
try { |
|||
|
|||
// Check if the input date is in yyyy-MM-dd format |
|||
if (fromDate1.matches("\\d{4}-\\d{2}-\\d{2}") && toDate1.matches("\\d{4}-\\d{2}-\\d{2}")) { |
|||
// Parse from yyyy-MM-dd format |
|||
fromDate = LocalDate.parse(fromDate1); |
|||
toDate = LocalDate.parse(toDate1); |
|||
} else { |
|||
// Parse from dd-MM-yyyy format |
|||
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
|||
fromDate = LocalDate.parse(fromDate1, formatter1); |
|||
toDate = LocalDate.parse(toDate1, formatter1); |
|||
} |
|||
|
|||
} catch (DateTimeParseException e) { |
|||
response.put("status", "error"); |
|||
response.put("message", "Invalid date format. Expected format: dd-MM-yyyy"); |
|||
return response; |
|||
} |
|||
|
|||
} |
|||
// Format the dates if needed (e.g., for logging or passing in a specific format) |
|||
|
|||
String formattedFromDate = fromDate.format(formatter); |
|||
String formattedToDate = toDate.format(formatter); |
|||
|
|||
System.out.println("Received deptId after date: " + deptId); |
|||
System.out.println("Fetching data from " + formattedFromDate + " to " + formattedToDate); |
|||
|
|||
|
|||
Map<String, Object> datalist = newEntryService.fetchEmplyeeDetails(formattedFromDate, formattedToDate, deptId); |
|||
System.out.println("datalist="+datalist); |
|||
List<Map<String, Object>> emps= newEntryService.getRegisteredEmps(deptId,file_category); |
|||
|
|||
// Format the dates for frontend in "yyyy-MM-dd" |
|||
DateTimeFormatter frontendFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|||
String frontendFromDate = fromDate.format(frontendFormatter); |
|||
String frontendToDate = toDate.format(frontendFormatter); |
|||
response.put("fromDate", frontendFromDate); |
|||
response.put("toDate", frontendToDate); |
|||
|
|||
// Extract emp_no values from emps |
|||
Set<String> empNos = emps.stream() |
|||
.map(emp -> (String) emp.get("emp_no")) |
|||
.collect(Collectors.toSet()); |
|||
|
|||
//System.out.println("rrrrrrrrrrrr"); |
|||
if (datalist.containsKey("list") && datalist.get("list") instanceof List) { |
|||
List<?> list = (List<?>) datalist.get("list"); |
|||
if (list.isEmpty()) { |
|||
System.out.println("inside>>>>>"); |
|||
response.put("status", "nodata"); |
|||
response.put("message", "No data available for the selected date range"); |
|||
} |
|||
else { |
|||
//System.out.println("ttttttttttttt"); |
|||
// Filter the datalist "list" to exclude matching EMPLOYEE_CODE values |
|||
List<Map<String, Object>> filteredList = ((List<Map<String, Object>>) datalist.get("list")).stream() |
|||
.filter(employee -> !empNos.contains(employee.get("EMPLOYEE_CODE"))) |
|||
.collect(Collectors.toList()); |
|||
|
|||
if (filteredList.isEmpty()) { |
|||
response.put("status", "nodata"); |
|||
response.put("message", "No data available for the selected date range"); |
|||
} else { |
|||
datalist.put("list", filteredList); |
|||
response.put("status", "success"); |
|||
response.put("details", datalist); |
|||
System.out.println("Received datalist:"+datalist); |
|||
System.out.println("Received filteredList:"+filteredList); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
return response; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/employeedetails") |
|||
public ResponseEntity<Map<String, Object>> getEmployeedetailsbyCode( |
|||
@RequestParam String empCode) { |
|||
|
|||
Map<String, Object> datalistbycode = newEntryService.fetchEmplyeeDetailsbyCode(empCode); |
|||
return ResponseEntity.ok(datalistbycode); |
|||
} |
|||
|
|||
@PostMapping("/saveEmployeeDetails") |
|||
public ResponseEntity<String> saveRetirementEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save details |
|||
boolean isSaved = newEntryService.saveRetirementEmployeeDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
return ResponseEntity.ok("File moved to Audit successfully!"); |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
//family pension |
|||
@PostMapping("/saveFamilyPensionDetails") |
|||
public ResponseEntity<String> saveFamilyPensionDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
|
|||
// Call service method to save details |
|||
boolean isSaved = newEntryService.saveFamilyPensionDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
return ResponseEntity.ok("File moved to Audit successfully!"); |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
//pendency api |
|||
|
|||
@PostMapping("/savePendecnyDetails") |
|||
public ResponseEntity<String> savePendecnyDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save detailstypeOfRetirement |
|||
boolean isSaved = newEntryService.savePendencyDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
return ResponseEntity.ok("File moved to Audit successfully!"); |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
//gis saving api controller |
|||
@PostMapping("/saveEmployeeDetailsGis") |
|||
public ResponseEntity<String> saveEmployeeDetailsingis(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Extract data from the request body |
|||
|
|||
|
|||
// Call service method to save details |
|||
boolean isSaved = newEntryService.savenewEntryDetailsGis(requestData); |
|||
|
|||
if (isSaved) { |
|||
return ResponseEntity.ok("File moved to Pension successfully!"); |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//provsionalretirement saving api controller |
|||
@PostMapping("/saveEmployeeDetailsProvisionalretirement") |
|||
public ResponseEntity<String> saveEmployeeDetailsProvisionalretirement(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Extract data from the request body |
|||
|
|||
|
|||
// Call service method to save details |
|||
boolean isSaved = newEntryService.savenewEntryDetailsProvisionalretirement(requestData); |
|||
|
|||
if (isSaved) { |
|||
return ResponseEntity.ok("File moved to Pension successfully!"); |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
//cps saving api controller |
|||
@PostMapping("/saveEmployeeDetailsPensionScheme") |
|||
public ResponseEntity<String> saveEmployeeDetailspensionscheme(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Extract data from the request body |
|||
|
|||
|
|||
// Call service method to save details |
|||
boolean isSaved = newEntryService.savenewEntryDetailspensionscheme(requestData); |
|||
|
|||
if (isSaved) { |
|||
return ResponseEntity.ok("File Submitted successfully!"); |
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/exists") |
|||
public ResponseEntity<Map<String, Boolean>> checkEmployeeExists(@RequestParam String empCode) { |
|||
boolean exists = newEntryService.doesEmployeeExist(empCode); |
|||
Map<String, Boolean> response = new HashMap<>(); |
|||
response.put("exists", exists); |
|||
return ResponseEntity.ok(response); |
|||
} |
|||
|
|||
@GetMapping("/cpsexists") |
|||
public ResponseEntity<Map<String, Boolean>> checkEmployeeExistsCps(@RequestParam String empCode) { |
|||
boolean exists = newEntryService.doesEmployeeExistgis(empCode); |
|||
Map<String, Boolean> response = new HashMap<>(); |
|||
response.put("exists", exists); |
|||
return ResponseEntity.ok(response); |
|||
} |
|||
|
|||
@GetMapping("/prexists") |
|||
public ResponseEntity<Map<String, Boolean>> checkEmployeeExistsRpr(@RequestParam String empCode) { |
|||
boolean exists = newEntryService.doesEmployeeExistRPR(empCode); |
|||
Map<String, Boolean> response = new HashMap<>(); |
|||
response.put("exists", exists); |
|||
return ResponseEntity.ok(response); |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/familypensionexists") |
|||
public ResponseEntity<Map<String, Boolean>> checkEmployeeExistsfp(@RequestParam String empCode) { |
|||
boolean exists = newEntryService.doesEmployeeExistfp(empCode); |
|||
Map<String, Boolean> response = new HashMap<>(); |
|||
response.put("exists", exists); |
|||
return ResponseEntity.ok(response); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,199 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.Period; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.time.temporal.ChronoUnit; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
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.scheduling.annotation.Scheduled; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PendencyAutoConversionService; |
|||
|
|||
@RequestMapping("gcc/api/pensioner/autoconversion") |
|||
@RestController |
|||
public class PendencyAutoConversionApiController { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
// @Autowired |
|||
// private DeptAuditService deptAuditService; |
|||
// |
|||
// @Autowired |
|||
// public PendencyAutoConversionService pendencyAutoConversionService; |
|||
// |
|||
// @GetMapping("/updateintopendency") |
|||
// public boolean updateIfRetirementDateCrossed() { |
|||
// try { |
|||
// List<Map<String, Object>> covertList = pendencyAutoConversionService.getConvertingTempIds(); |
|||
// System.out.println("covertList===" + covertList); |
|||
// |
|||
// if (!covertList.isEmpty()) { |
|||
// for (Map<String, Object> tempIdMap : covertList) { |
|||
// try { |
|||
// // Extract temp_id and convert it to a String |
|||
// Object tempIdRaw = tempIdMap.get("temp_id"); |
|||
// String tempId = tempIdRaw != null ? String.valueOf(tempIdRaw) : null; |
|||
// |
|||
// System.out.println("Converted tempId: " + tempId); |
|||
// |
|||
// // Ensure tempId is not null before processing |
|||
// if (tempId != null && !tempId.trim().isEmpty()) { |
|||
// |
|||
// String fileMovedBy=pendencyAutoConversionService.getFileMovedByTempId(tempId); |
|||
// |
|||
// if(fileMovedBy!=null) { |
|||
// boolean isProcessed = pendencyAutoConversionService.updateEntryDetails(tempId); |
|||
// |
|||
// if (isProcessed) { |
|||
// List<Map<String, Object>> emp_details = deptAuditService.fetchEmployeeById(tempId); |
|||
// System.out.println("emp_details: " + emp_details); |
|||
// |
|||
// boolean updated = pendencyAutoConversionService.saveHistory(emp_details,fileMovedBy); |
|||
// |
|||
// if (!updated) { |
|||
// System.out.println("Failed to save history for tempId: " + tempId); |
|||
// continue; |
|||
// } |
|||
// } |
|||
// } |
|||
// else { |
|||
// System.out.println("fileMovedBy is NUll for temp_id="+tempId); |
|||
// } |
|||
// |
|||
// } |
|||
// } catch (Exception innerEx) { |
|||
// System.err.println("Error processing tempId: " + tempIdMap.get("temp_id")); |
|||
// innerEx.printStackTrace(); |
|||
// continue; // Continue processing the next record |
|||
// } |
|||
// } |
|||
// return true; |
|||
// } else { |
|||
// System.out.println("No records found for processing."); |
|||
// return false; |
|||
// } |
|||
// } catch (Exception e) { |
|||
// System.err.println("Exception in updateIfRetirementDateCrossed: " + e.getMessage()); |
|||
// e.printStackTrace(); |
|||
// return false; |
|||
// } |
|||
// } |
|||
|
|||
@Scheduled(cron = "*/40 * * * * ?") // Runs every 40 seconds |
|||
public void scheduledPendencyUpdate() { |
|||
System.out.println("Scheduled Task Started: Updating Pensioner Pending Duration 40"); |
|||
|
|||
Map<String, Object> result = GetRecordsUpdatePendencyDuration(); |
|||
|
|||
System.out.println("Scheduled Task Completed: " + result); |
|||
|
|||
// Fetch the pending pensioners count after the update |
|||
int pendingCount = getPendingPensionersCount(); |
|||
System.out.println("Total pending pensioners after update: " + pendingCount); |
|||
} |
|||
|
|||
public Map<String, Object> GetRecordsUpdatePendencyDuration() { |
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
// Lists to store tempIds based on update success or failure |
|||
List<String> successfulUpdates = new ArrayList<>(); |
|||
List<String> failedUpdates = new ArrayList<>(); |
|||
|
|||
String sqlQuery = "SELECT * FROM pensioner_details WHERE file_category=3 AND pending_duration='yes' AND file_status < 11"; |
|||
List<Map<String, Object>> details = jdbcTemplate.queryForList(sqlQuery); |
|||
|
|||
for (Map<String, Object> tempIdMap : details) { |
|||
String tempId = tempIdMap.get("temp_id") != null ? String.valueOf(tempIdMap.get("temp_id")) : null; |
|||
String retirementDateStr = tempIdMap.get("retirement_date") != null ? String.valueOf(tempIdMap.get("retirement_date")) : null; |
|||
|
|||
if (retirementDateStr != null && !retirementDateStr.trim().isEmpty()) { |
|||
try { |
|||
// Convert retirement_date to LocalDate |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|||
LocalDate startDate = LocalDate.parse(retirementDateStr, formatter); |
|||
LocalDate endDate = LocalDate.now(); // Current date |
|||
|
|||
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId, startDate, endDate); |
|||
|
|||
// Calculate duration |
|||
String updateDuration = calculatePendingDuration(startDate, endDate); |
|||
System.out.println("Updated Duration: " + updateDuration); |
|||
|
|||
// Update the record in the database |
|||
boolean isUpdated = updatePendingDuration(updateDuration, tempId); |
|||
|
|||
// Add tempId to the respective list |
|||
if (isUpdated) { |
|||
successfulUpdates.add(tempId); |
|||
} else { |
|||
failedUpdates.add(tempId); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
System.err.println("Error parsing retirement_date for tempId " + tempId + ": " + e.getMessage()); |
|||
} |
|||
} else { |
|||
System.out.println("Skipping: Retirement date is null or empty for tempId: " + tempId); |
|||
} |
|||
} |
|||
|
|||
response.put("status", "Success"); |
|||
response.put("message", "Pendency duration updated"); |
|||
response.put("total_records_processed", details.size()); |
|||
response.put("successful_updates_count", successfulUpdates.size()); |
|||
response.put("failed_updates_count", failedUpdates.size()); |
|||
response.put("successful_updates", successfulUpdates); |
|||
response.put("failed_updates", failedUpdates); |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public String calculatePendingDuration(LocalDate startDate, LocalDate endDate) { |
|||
Period period = Period.between(startDate, endDate); |
|||
|
|||
int years = period.getYears(); |
|||
int months = period.getMonths(); |
|||
int days = period.getDays(); |
|||
|
|||
return (years > 0 ? years + " year " : "") + |
|||
(months > 0 ? months + " month " : "") + |
|||
(days > 0 ? days + " day" : ""); |
|||
} |
|||
|
|||
public boolean updatePendingDuration(String updateDuration, String tempId) { |
|||
String sqlQuery = "UPDATE pensioner_details SET reason_for_pending=? WHERE temp_id=?"; |
|||
int rowsUpdated = jdbcTemplate.update(sqlQuery, updateDuration, tempId); |
|||
System.out.println("Temp ID: " + tempId + " | Rows Updated: " + rowsUpdated); |
|||
return rowsUpdated > 0; |
|||
} |
|||
|
|||
// New method to get the count of pending pensioners |
|||
public int getPendingPensionersCount() { |
|||
String sqlQuery = "SELECT COUNT(*) FROM pensioner_details WHERE file_category=3 AND pending_duration='yes' AND file_status < 11"; |
|||
Integer count = jdbcTemplate.queryForObject(sqlQuery, Integer.class); |
|||
return count != null ? count : 0; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,134 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionAuditService; |
|||
|
|||
@RequestMapping("gcc/api/pensioner/audit") |
|||
@RestController |
|||
public class PensionAuditApiController { |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
private PensionAuditService pensionAuditService; |
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = pensionAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=pensionAuditService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("Audit Certificate Received successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
@PostMapping("/updateFamilyPensionDetails") |
|||
public ResponseEntity<String> updateFamilyPensionDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = pensionAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=pensionAuditService.saveFamilyPensionHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("Audit Certificate Received successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
//pendency |
|||
@PostMapping("/updatePendencyDetails") |
|||
public ResponseEntity<String> updatePendencyDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = pensionAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=pensionAuditService.savePendencyHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("Audit Certificate Received successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,110 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptPartiallyCompService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionPartiallyCompService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
|||
|
|||
@RequestMapping("gcc/api/pensioner/partial") |
|||
@RestController |
|||
public class PensionPartiallyCompApiController { |
|||
|
|||
@Autowired |
|||
public DeptPartiallyCompService deptPartiallyCompleteService; |
|||
|
|||
@Autowired |
|||
public DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
public PensionReceivedService pensionReceivedService; |
|||
|
|||
@Autowired |
|||
public PensionPartiallyCompService pensionPartiallyCompService; |
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
int fs1=0; |
|||
|
|||
boolean isSaved = pensionPartiallyCompService.updateEntryCompletedDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchPartialCompleted(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
|
|||
|
|||
List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId); |
|||
System.out.println("zone_benefits:==:"+zone_benefits); |
|||
|
|||
List<Map<String, Object>> pension_benefits=pensionReceivedService.fetchPensionbenefitsById(tempId); |
|||
System.out.println("pension_benefits:==:"+pension_benefits); |
|||
|
|||
|
|||
boolean updated=pensionPartiallyCompService.saveHistory(emp_details,zone_benefits,pension_benefits,filemovedby); |
|||
|
|||
if (!emp_details.isEmpty()) { // Ensure list is not empty |
|||
Map<String, Object> empDetailMap = emp_details.get(0); // Get first map from the list |
|||
|
|||
// Ensure the key exists in the map |
|||
if (empDetailMap.containsKey("file_status")) { |
|||
Object fileStatusObj = empDetailMap.get("file_status"); |
|||
|
|||
if (fileStatusObj != null) { |
|||
String fs = fileStatusObj.toString(); // Convert to String safely |
|||
fs1 = Integer.parseInt(fs); // Convert to integer if needed |
|||
System.out.println("file_status: " + fs1); |
|||
} else { |
|||
System.out.println("file_status is null"); |
|||
} |
|||
} else { |
|||
System.out.println("Key 'file_status' not found in emp_details"); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details list is empty"); |
|||
} |
|||
|
|||
|
|||
if(updated) |
|||
{ |
|||
if(fs1==11 && fs1!=0) |
|||
{ |
|||
return ResponseEntity.ok("File Completed successfully!"); |
|||
} |
|||
else if(fs1==10 && fs1!=0){ |
|||
return ResponseEntity.ok("File Partially Completed!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.ok("File Status is 0!"); |
|||
} |
|||
|
|||
|
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
|||
|
|||
@RequestMapping("gcc/api/department/received") |
|||
@RestController |
|||
public class PensionReceivedApiController { |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
private PensionReceivedService pensionReceivedService; |
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
// Call service method to save |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
boolean isSaved = pensionReceivedService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
List<Map<String, Object>> zone_benefits=pensionReceivedService.fetchZonebenefitsById(tempId); |
|||
System.out.println("zone_benefits:==:"+zone_benefits); |
|||
|
|||
boolean updated=pensionReceivedService.saveHistory(emp_details,zone_benefits,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Pension successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
//gis |
|||
@PostMapping("/updateEmployeeDetailsgis") |
|||
public ResponseEntity<String> updateEmployeeDetailsGis(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
boolean isSaved = pensionReceivedService.updateEntryGisDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=pensionReceivedService.savehistoryGis(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File Saved successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,624 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.CompletedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentForwardService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DepartmentReceivedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.NewEntryService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionPartiallyCompService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PensionReceivedService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReportApiService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReturnFromAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; |
|||
|
|||
@Controller |
|||
@RequestMapping("/gcc/pensioner") |
|||
public class PensionerMainController { |
|||
|
|||
|
|||
@Autowired |
|||
private NewEntryService newEntryService; |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@Autowired |
|||
private ReturnFromAuditService returnFromAuditService; |
|||
|
|||
@Autowired |
|||
private PensionAuditService pensionAuditService; |
|||
|
|||
@Autowired |
|||
private DepartmentForwardService departmentForwardService; |
|||
|
|||
@Autowired |
|||
private PensionReceivedService pensionReceivedService; |
|||
|
|||
@Autowired |
|||
private DepartmentReceivedService departmentReceivedService; |
|||
|
|||
@Autowired |
|||
private ReceivedDeptProvisionalService receivedDeptProvisionalService; |
|||
|
|||
@Autowired |
|||
private CompletedService completedService; |
|||
|
|||
@Autowired |
|||
private PensionPartiallyCompService pensionPartiallyCompService; |
|||
|
|||
@Autowired |
|||
private ReportApiService reportApiService; |
|||
|
|||
|
|||
//////////////////////////////Pensioner pages//////////////////////////////// |
|||
|
|||
//yogi |
|||
@GetMapping("/audit/retirement") |
|||
public String pensionerauditretirment(Model model) { |
|||
|
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>auditlist= pensionAuditService.fetchDetailsForAudit(file_cat); |
|||
|
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/pensioner/audit/retirement"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/audit/familypension") |
|||
public String pensionerfamilypension(Model model) { |
|||
|
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
|
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
|
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
List<Map<String, Object>>auditlist= pensionAuditService.fetchDetailsForAudit(file_cat); |
|||
|
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/pensioner/audit/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/audit/pendency") |
|||
public String pensionerpendency(Model model) { |
|||
|
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
|
|||
|
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
|
|||
|
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
List<Map<String, Object>>auditlist= pensionAuditService.fetchDetailsForAudit(file_cat); |
|||
|
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/pensioner/audit/pendency"; |
|||
} |
|||
|
|||
|
|||
///////////////////COMPLETED LIST PAGES////////////// |
|||
|
|||
@GetMapping("/completed/retirement") |
|||
public String pensionerretirement(Model model) { |
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>provisionallist= completedService.fetchDetailsCompletedRetirementPensionside(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+provisionallist); |
|||
model.addAttribute("provisionallist", provisionallist); |
|||
|
|||
return "modules/pensioner/pensioner/completed/retirement"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/completed/familypension") |
|||
public String pensionercompleted(Model model) { |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>familypensioncompletedlist= completedService.fetchDetailsCompletedFamilyPensionPensionSide(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+familypensioncompletedlist); |
|||
model.addAttribute("provisionallist", familypensioncompletedlist); |
|||
|
|||
return "modules/pensioner/pensioner/completed/familypension"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/completed/pendency") |
|||
public String pensionercompletedpendency(Model model) { |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>pendencycompletedlist= completedService.fetchDetailsCompletedPendencyPensionSide(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+pendencycompletedlist); |
|||
model.addAttribute("provisionallist", pendencycompletedlist); |
|||
|
|||
return "modules/pensioner/pensioner/completed/pendency"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/completed/gis") |
|||
public String pensionercompletedgis(Model model) { |
|||
int file_cat= newEntryService.getGISFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>gislist= completedService.fetchDetailsForrecivedGiscompletedPensionside(file_cat); |
|||
|
|||
System.out.println("auditlist===="+gislist); |
|||
model.addAttribute("auditlist", gislist); |
|||
|
|||
return "modules/pensioner/pensioner/completed/gis"; |
|||
} |
|||
|
|||
@GetMapping("/completed/provisionalretirement") |
|||
public String pensionercompletedretirement(Model model) { |
|||
int file_cat= newEntryService.getPRFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>provisionallist= completedService.fetchDetailsProvisionalDepartmentPensionside(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+provisionallist); |
|||
model.addAttribute("provisionallist", provisionallist); |
|||
|
|||
|
|||
return "modules/pensioner/pensioner/completed/provisionalretirement"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/completed/contributorypensionscheme") |
|||
public String pensionercompletedcontributory( |
|||
Model model) { |
|||
int file_cat= newEntryService.getCPSFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>completedCPSList= completedService.getCPSListPensionside(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+completedCPSList); |
|||
model.addAttribute("provisionallist", completedCPSList); |
|||
// Add the list to the model |
|||
model.addAttribute("completedCPSList", completedCPSList); |
|||
|
|||
return "modules/pensioner/pensioner/completed/contributorypensionscheme"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//Ajith |
|||
|
|||
@GetMapping("/forward/retirement") |
|||
public String pensioneretirement(Model model) { |
|||
|
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>forwardlist= departmentForwardService.fetchDepatmentForwardEmpfiles(file_cat); |
|||
|
|||
System.out.println("forwardlist===="+forwardlist); |
|||
model.addAttribute("forwardlist", forwardlist); |
|||
|
|||
return "modules/pensioner/pensioner/forward/retirement"; |
|||
} |
|||
|
|||
@GetMapping("/forward/familypension") |
|||
public String pensionfamily(Model model) { |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>forwardlist= departmentForwardService.fetchDepatmentForwardEmpfiles(file_cat); |
|||
|
|||
System.out.println("forwardlist===="+forwardlist); |
|||
model.addAttribute("forwardlist", forwardlist); |
|||
|
|||
return "modules/pensioner/pensioner/forward/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/forward/pendency") |
|||
public String pensionerforward(Model model) { |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>forwardlist= departmentForwardService.fetchDepatmentForwardEmpfiles(file_cat); |
|||
|
|||
System.out.println("forwardlist===="+forwardlist); |
|||
model.addAttribute("forwardlist", forwardlist); |
|||
|
|||
return "modules/pensioner/pensioner/forward/pendency"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//dizho |
|||
|
|||
@GetMapping("/received/retirement") |
|||
public String pensionerreceivedretirement(Model model) { |
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>forwardlist= departmentReceivedService.fetchPensionReceivedEmpfiles(file_cat); |
|||
|
|||
System.out.println("forwardlist===="+forwardlist); |
|||
model.addAttribute("forwardlist", forwardlist); |
|||
|
|||
return "modules/pensioner/pensioner/received/retirement"; |
|||
} |
|||
|
|||
@GetMapping("/received/familypension") |
|||
public String pensionerreceivedfamilypension(Model model) { |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>forwardlist= departmentReceivedService.fetchPensionReceivedEmpfiles(file_cat); |
|||
|
|||
System.out.println("forwardlist===="+forwardlist); |
|||
model.addAttribute("forwardlist", forwardlist); |
|||
|
|||
return "modules/pensioner/pensioner/received/familypension"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/received/pendency") |
|||
public String pensionerreceived(Model model) { |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>forwardlist= departmentReceivedService.fetchPensionReceivedEmpfiles(file_cat); |
|||
|
|||
System.out.println("forwardlist===="+forwardlist); |
|||
model.addAttribute("forwardlist", forwardlist); |
|||
|
|||
return "modules/pensioner/pensioner/received/pendency"; |
|||
} |
|||
|
|||
@GetMapping("/received/gis") |
|||
public String pensionerreceivedgis(Model model) { |
|||
int file_cat= newEntryService.getGISFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>gislist= pensionAuditService.fetchDetailsForrecivedGis(file_cat); |
|||
|
|||
System.out.println("auditlist===="+gislist); |
|||
model.addAttribute("auditlist", gislist); |
|||
|
|||
return "modules/pensioner/pensioner/received/gis"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@GetMapping("/received/provisionalretirement") |
|||
public String pensionerprovisionalretirement(Model model) { |
|||
|
|||
int file_cat= newEntryService.getPRFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>provisionallist= receivedDeptProvisionalService.fetchDetailsProvisionalPension(file_cat); |
|||
|
|||
System.out.println("provisionallist===="+provisionallist); |
|||
model.addAttribute("provisionallist", provisionallist); |
|||
|
|||
return "modules/pensioner/pensioner/received/provisionalretirement"; |
|||
} |
|||
|
|||
|
|||
//sanjay |
|||
|
|||
@GetMapping("/partial/pendency") |
|||
public String pensionerpartial(Model model) { |
|||
int file_cat= newEntryService.getPendencyFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>auditlist= pensionPartiallyCompService.fetchPensionPartialEmpfiles(file_cat); |
|||
|
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/pensioner/partial/pendency"; |
|||
} |
|||
|
|||
@GetMapping("/partial/retirement") |
|||
public String pensionerpartialretirement(Model model) { |
|||
int file_cat= newEntryService.getRetirementFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>auditlist= pensionPartiallyCompService.fetchPensionPartialEmpfiles(file_cat); |
|||
|
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
|
|||
|
|||
|
|||
return "modules/pensioner/pensioner/partial/retirement"; |
|||
} |
|||
|
|||
@GetMapping("/partial/familypension") |
|||
public String pensionerpartialfamily(Model model) { |
|||
int file_cat= newEntryService.getFamilyPensionFileCategoryId(); |
|||
model.addAttribute("filecategory", file_cat); |
|||
|
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
String deptname=newEntryService.getDeptNameById(deptId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
System.out.println("deptId:"+ deptId); |
|||
model.addAttribute("deptId", deptId); |
|||
model.addAttribute("deptname", deptname); |
|||
model.addAttribute("userId", userId); |
|||
|
|||
List<Map<String, Object>>auditlist= pensionPartiallyCompService.fetchPensionPartialEmpfiles(file_cat); |
|||
|
|||
System.out.println("auditlist===="+auditlist); |
|||
model.addAttribute("auditlist", auditlist); |
|||
|
|||
return "modules/pensioner/pensioner/partial/familypension"; |
|||
} |
|||
|
|||
@GetMapping("/reports") |
|||
public String report(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
Integer deptId = newEntryService.getloginuserDeptId(userId); |
|||
model.addAttribute("deptId", deptId); |
|||
|
|||
return "modules/pensioner/pensioner/reports"; |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/dashboard") |
|||
public String pensionerdashboardpage(Model model) { |
|||
String LoginUserId = LoginUserInfo.getLoginUserId(); |
|||
int userId = Integer.parseInt(LoginUserId); |
|||
model.addAttribute("LoginUserId",LoginUserId); |
|||
String UserRole = LoginUserInfo.getUserRole(); |
|||
|
|||
return "modules/pensioner/pensioner/dashboard"; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,145 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReceivedDeptProvisionalService; |
|||
|
|||
@RestController |
|||
@RequestMapping("gcc/api/pensioner/received/provisional") |
|||
public class ReceivedDeptProvisionalApiController { |
|||
|
|||
@Autowired |
|||
private ReceivedDeptProvisionalService receivedDeptProvisionalService; |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
|
|||
@Autowired |
|||
public ReceivedDeptProvisionalApiController(ReceivedDeptProvisionalService receivedDeptProvisionalService) { |
|||
this.receivedDeptProvisionalService = receivedDeptProvisionalService; |
|||
} |
|||
|
|||
//sent to completed list |
|||
@PostMapping("/updateEmployeeDetailsCompleted") |
|||
public ResponseEntity<String> updateEmployeeDetailsCompleted(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = receivedDeptProvisionalService.updateEntryDetailsCompleted(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=receivedDeptProvisionalService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File Completed successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
// returned from pension to department |
|||
@PostMapping("/updateEmployeeDetailsReturn") |
|||
public ResponseEntity<String> updateEmployeeDetailsReturn(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = receivedDeptProvisionalService.updateEntryDetailsReturntoDepartment(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=receivedDeptProvisionalService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Department successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
//sent again to pension from department |
|||
@PostMapping("/updateEmployeeDetailsSentToPension") |
|||
public ResponseEntity<String> updateEntryDetailsSenttoPension(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = receivedDeptProvisionalService.updateEntryDetailsSenttoPension(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=receivedDeptProvisionalService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File moved to Pension successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,140 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.hibernate.internal.build.AllowSysOut; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReportApiService; |
|||
|
|||
@Controller |
|||
public class ReportApiController { |
|||
@Autowired |
|||
private ReportApiService reportApiService; |
|||
|
|||
|
|||
|
|||
//pensioner and report side common dropdown |
|||
@GetMapping("/getFileCategories") |
|||
@ResponseBody |
|||
public ResponseEntity<?> getFileCategories() { |
|||
try { |
|||
List<Map<String, Object>> categories = reportApiService.getFileCategories(); |
|||
return ResponseEntity.ok(categories); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body(Collections.singletonMap("error", "Failed to fetch categories")); |
|||
} |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getReportData") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getReportData(@RequestParam String startDate, |
|||
@RequestParam String endDate, |
|||
@RequestParam String deptId |
|||
) { |
|||
return reportApiService.getReportData(startDate, endDate, deptId); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@GetMapping("/getReportDetails") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getReportDetails(@RequestParam String startDate, |
|||
@RequestParam String endDate, |
|||
@RequestParam Integer deptId, |
|||
@RequestParam Integer fileCatId, |
|||
@RequestParam(required = false) List<String> fileStatus |
|||
) { |
|||
System.out.println("startdate>>>>>"+startDate); |
|||
System.out.println("endDate>>>>>"+endDate); |
|||
System.out.println("deptId>>>>>"+deptId); |
|||
System.out.println("fileCatId>>>>>"+fileCatId); |
|||
System.out.println("fileStatus>>>>>"+fileStatus); |
|||
|
|||
|
|||
return reportApiService.getReportDetails(startDate, endDate, deptId,fileCatId,fileStatus); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
//pensioner side report dropdown |
|||
|
|||
@GetMapping("/getdepartment") |
|||
@ResponseBody |
|||
public ResponseEntity<?> getdepartment() { |
|||
try { |
|||
List<Map<String, Object>> categories = reportApiService.getdepartment(); |
|||
return ResponseEntity.ok(categories); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body(Collections.singletonMap("error", "Failed to fetch categories")); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/getstatus") |
|||
@ResponseBody |
|||
public ResponseEntity<?> getstatus() { |
|||
try { |
|||
List<Map<String, Object>> categories = reportApiService.getstatus(); |
|||
return ResponseEntity.ok(categories); |
|||
} catch (Exception e) { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|||
.body(Collections.singletonMap("error", "Failed to fetch categories")); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
@GetMapping("/getReportDatapension") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getReportDatapension(@RequestParam String startDate, |
|||
@RequestParam String endDate, |
|||
@RequestParam(required = true) String fileCategoryId) |
|||
{ |
|||
System.out.println("fileCategoryId ========>"+fileCategoryId); |
|||
return reportApiService.getReportDatapension(startDate, endDate, fileCategoryId); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@GetMapping("/getReportDetailspension") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getReportDetailspension(@RequestParam String startDate, |
|||
@RequestParam String endDate, |
|||
@RequestParam List<String> deptIds, |
|||
@RequestParam Integer fileCatId, |
|||
@RequestParam(required = false) List<String> fileStatus) { |
|||
|
|||
System.out.println("startdate>>>>>"+startDate); |
|||
System.out.println("endDate>>>>>"+endDate); |
|||
System.out.println("deptIds: " + deptIds); |
|||
System.out.println("fileCatId>>>>>"+fileCatId); |
|||
System.out.println("fileStatus>>>>>"+fileStatus); |
|||
|
|||
return reportApiService.getReportDetailspension(startDate, endDate, deptIds, fileCatId, fileStatus); |
|||
} |
|||
|
|||
@GetMapping("/getPensionerDetails") |
|||
@ResponseBody |
|||
public List<Map<String, Object>> getDepartmentpending(@RequestParam int file_category ) { |
|||
return reportApiService.getDepartmentpending(file_category); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.DeptAuditService; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.ReturnFromAuditService; |
|||
|
|||
@RequestMapping("gcc/api/department/return") |
|||
@RestController |
|||
public class ReturnFromAuditApiController { |
|||
|
|||
@Autowired |
|||
private ReturnFromAuditService returnFromAuditService; |
|||
|
|||
@Autowired |
|||
private DeptAuditService deptAuditService; |
|||
|
|||
@PostMapping("/updateEmployeeDetails") |
|||
public ResponseEntity<String> updateEmployeeDetails(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
boolean isSaved = returnFromAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=returnFromAuditService.savehistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File sent to Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
@PostMapping("/updateReturnFamilyPension") |
|||
public ResponseEntity<String> updateReturnFamilyPension(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = returnFromAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=returnFromAuditService.saveFamilyPensionReturnHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File sent to Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
|
|||
@PostMapping("/updateReturnPendency") |
|||
public ResponseEntity<String> updatePendencyPension(@RequestBody Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Call service method to save |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
|
|||
|
|||
boolean isSaved = returnFromAuditService.updateEntryDetails(requestData); |
|||
|
|||
if (isSaved) { |
|||
List<Map<String, Object>> emp_details=deptAuditService.fetchEmployeeById(tempId); |
|||
System.out.println("emp_details:==:"+emp_details); |
|||
boolean updated=returnFromAuditService.savePendencyHistory(emp_details,filemovedby); |
|||
|
|||
if(updated) |
|||
{ |
|||
return ResponseEntity.ok("File sent Audit successfully!"); |
|||
} |
|||
else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details in history."); |
|||
} |
|||
|
|||
} else { |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to save details."); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error occurred while saving details."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,188 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.scheduler; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.Period; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
import in.gov.chennaicorporation.gccoffice.pensioner.service.PendencyAutoConversionService; |
|||
|
|||
@Component |
|||
public class PendencyAutoConversionScheduler { |
|||
|
|||
|
|||
@Autowired |
|||
private PendencyAutoConversionService pendencyAutoConversionService; |
|||
|
|||
/** |
|||
* Scheduled method that runs every 60 seconds to process auto-conversion tasks. |
|||
*/ |
|||
@Scheduled(cron = "*/20 * * * * ?") // Runs every 60 seconds |
|||
public void executeAutoConversion() { |
|||
try { |
|||
System.out.println(" Running scheduled auto-conversion task..."); |
|||
|
|||
// Step 1: Fetch temp IDs that need processing |
|||
List<Map<String, Object>> tempIds = pendencyAutoConversionService.getConvertingTempIds(); |
|||
|
|||
if (tempIds == null || tempIds.isEmpty()) { |
|||
System.out.println(" No records found for auto-conversion."); |
|||
return; |
|||
} |
|||
|
|||
System.out.println(" Found " + tempIds.size() + " records for processing."); |
|||
|
|||
// Step 2: Process each tempId |
|||
for (Map<String, Object> tempIdMap : tempIds) { |
|||
String tempId = tempIdMap.get("temp_id") != null ? tempIdMap.get("temp_id").toString() : null; |
|||
|
|||
if (tempId == null || tempId.trim().isEmpty()) { |
|||
System.out.println(" Skipping empty temp_id."); |
|||
continue; |
|||
} |
|||
|
|||
System.out.println(" Processing tempId: " + tempId); |
|||
|
|||
// Step 3: Call service method to process auto-conversion |
|||
boolean success = pendencyAutoConversionService.processAutoConversionForTempId(tempId); |
|||
|
|||
if (success) { |
|||
System.out.println(" Auto-conversion completed for tempId: " + tempId); |
|||
} else { |
|||
System.out.println(" Auto-conversion failed for tempId: " + tempId); |
|||
} |
|||
} |
|||
} catch (Exception e) { |
|||
System.err.println(" Error during auto-conversion task: " + e.getMessage()); |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
|
|||
@Scheduled(cron = "*/40 * * * * ?") // Runs every 40 seconds |
|||
public void scheduledPendencyUpdate() { |
|||
System.out.println("Scheduled Task Started: Updating Pensioner Pending Duration 30"); |
|||
|
|||
Map<String, Object> result = GetRecordsUpdatePendencyDuration(); |
|||
|
|||
System.out.println("Scheduled Task Completed: " + result); |
|||
|
|||
// Fetch the pending pensioners count after the update |
|||
int pendingCount = pendencyAutoConversionService.getPendingPensionersCount(); |
|||
System.out.println("Total pending pensioners after update: " + pendingCount); |
|||
} |
|||
|
|||
public Map<String, Object> GetRecordsUpdatePendencyDuration() { |
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
// Lists to store tempIds based on update success or failure |
|||
List<String> successfulUpdates = new ArrayList<>(); |
|||
List<String> failedUpdates = new ArrayList<>(); |
|||
|
|||
List<Map<String, Object>> details = pendencyAutoConversionService.getPendencyUpdatingDuration(); |
|||
|
|||
if(!details.isEmpty()) { |
|||
|
|||
for (Map<String, Object> tempIdMap : details) { |
|||
String tempId = tempIdMap.get("temp_id") != null ? String.valueOf(tempIdMap.get("temp_id")) : null; |
|||
String retirementDateStr = tempIdMap.get("retirement_date") != null ? String.valueOf(tempIdMap.get("retirement_date")) : null; |
|||
String serviceDeathDate = tempIdMap.get("service_death") != null ? String.valueOf(tempIdMap.get("service_death")) : null; |
|||
// Corrected parsing for file_category |
|||
int fileCat = tempIdMap.get("file_category") != null ? Integer.parseInt(tempIdMap.get("file_category").toString()) : null; |
|||
|
|||
if(fileCat==3) { |
|||
|
|||
if (retirementDateStr != null && !retirementDateStr.trim().isEmpty()) { |
|||
try { |
|||
// Convert retirement_date to LocalDate |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|||
LocalDate startDate = LocalDate.parse(retirementDateStr, formatter); |
|||
LocalDate endDate = LocalDate.now(); // Current date |
|||
|
|||
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId, startDate, endDate); |
|||
|
|||
// Calculate duration |
|||
String updateDuration = pendencyAutoConversionService.calculatePendingDuration(startDate, endDate); |
|||
System.out.println("Updated Duration: " + updateDuration); |
|||
|
|||
// Update the record in the database |
|||
boolean isUpdated = pendencyAutoConversionService.updatePendingDuration(updateDuration, tempId); |
|||
|
|||
// Add tempId to the respective list |
|||
if (isUpdated) { |
|||
successfulUpdates.add(tempId); |
|||
} else { |
|||
failedUpdates.add(tempId); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
System.err.println("Error parsing retirement_date for tempId " + tempId + ": " + e.getMessage()); |
|||
} |
|||
} else { |
|||
System.out.println("Skipping: Retirement date is null or empty for tempId: " + tempId); |
|||
} |
|||
} |
|||
|
|||
|
|||
if(fileCat==2) { |
|||
|
|||
if (serviceDeathDate != null && !serviceDeathDate.trim().isEmpty()) { |
|||
try { |
|||
// Convert retirement_date to LocalDate |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|||
LocalDate startDate = LocalDate.parse(serviceDeathDate, formatter); |
|||
LocalDate endDate = LocalDate.now(); // Current date |
|||
|
|||
System.out.printf("Processing Temp ID: %s | Start Date: %s | End Date: %s%n", tempId, startDate, endDate); |
|||
|
|||
// Calculate duration |
|||
String updateDuration = pendencyAutoConversionService.calculatePendingDuration(startDate, endDate); |
|||
System.out.println("Updated Duration: " + updateDuration); |
|||
|
|||
// Update the record in the database |
|||
boolean isUpdated = pendencyAutoConversionService.updatePendingDuration(updateDuration, tempId); |
|||
|
|||
// Add tempId to the respective list |
|||
if (isUpdated) { |
|||
successfulUpdates.add(tempId); |
|||
} else { |
|||
failedUpdates.add(tempId); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
System.err.println("Error parsing service death date for tempId " + tempId + ": " + e.getMessage()); |
|||
} |
|||
} else { |
|||
System.out.println("Skipping: service death date is null or empty for tempId: " + tempId); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
response.put("status", "Success"); |
|||
response.put("message", "Pendency duration updated"); |
|||
response.put("total_records_processed", details.size()); |
|||
response.put("successful_updates_count", successfulUpdates.size()); |
|||
response.put("failed_updates_count", failedUpdates.size()); |
|||
response.put("successful_updates", successfulUpdates); |
|||
response.put("failed_updates", failedUpdates); |
|||
|
|||
} |
|||
|
|||
response.put("status", "No Data"); |
|||
response.put("message", "No Updation in Pending Duration"); |
|||
|
|||
return response; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,177 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class CompletedService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public CompletedService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getCPSList(Integer file_cat,Integer deptId) { |
|||
String query = "SELECT * FROM cps_pensioner_details where file_category = ? and dept_id=? and file_status=11 "; |
|||
|
|||
try { |
|||
return jdbcTemplate.queryForList(query,file_cat,deptId); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
|
|||
///////////////////CPS completed list method/////////// |
|||
|
|||
public List<Map<String, Object>> getCPSListPensionside(Integer file_cat) { |
|||
String query = "SELECT * FROM cps_pensioner_details where file_category = ? and file_status=11 "; |
|||
|
|||
try { |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getCPSListByEmpNo(String empNo) { |
|||
String query = "SELECT * FROM cps_pensioner_details WHERE emp_no = ?"; |
|||
|
|||
try { |
|||
return jdbcTemplate.queryForList(query, empNo); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
|
|||
|
|||
//////////////////////////// |
|||
|
|||
|
|||
|
|||
|
|||
////////Retirement completed list method/////////////////// |
|||
public List<Map<String, Object>> fetchDetailsCompletedRetirement(Integer file_cat,Integer deptId) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND dept_id=? and file_status=11 AND is_closed=0"; |
|||
return jdbcTemplate.queryForList(query,file_cat,deptId); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchDetailsCompletedRetirementPensionside(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? and file_status=11 AND is_closed=0"; |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
///////////////////////// |
|||
|
|||
|
|||
|
|||
///////////////////Family pension completed list method////////////// |
|||
public List<Map<String, Object>> fetchDetailsCompletedFamilyPension(Integer file_cat,Integer deptId) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND dept_id=? and file_status=11"; |
|||
return jdbcTemplate.queryForList(query,file_cat,deptId); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchDetailsCompletedFamilyPensionPensionSide(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? and file_status=11"; |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
////////////////////////// |
|||
|
|||
|
|||
|
|||
///////////////Pendency completed method//////////////// |
|||
public List<Map<String, Object>> fetchDetailsCompletedPendency(Integer file_cat,Integer deptId) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND dept_id=? and file_status=11"; |
|||
return jdbcTemplate.queryForList(query,file_cat,deptId); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchDetailsCompletedPendencyPensionSide(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? and file_status=11"; |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
////////////////////// |
|||
|
|||
|
|||
|
|||
////////////Gis completed list method |
|||
|
|||
public List<Map<String, Object>> fetchDetailsForrecivedGiscompleted(Integer file_cat,Integer deptId) { |
|||
String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND dept_id=? AND file_status = 11"; |
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat,deptId); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchDetailsForrecivedGiscompletedPensionside(Integer file_cat) { |
|||
String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND file_status = 11"; |
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
|
|||
|
|||
////////////////Provisional retirement completed list method |
|||
|
|||
public List<Map<String, Object>> fetchDetailsProvisionalDepartmentCompleted(Integer file_cat,Integer deptId) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND dept_id=? and file_status=11"; |
|||
return jdbcTemplate.queryForList(query,file_cat,deptId); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchDetailsProvisionalDepartmentPensionside(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? and file_status=11"; |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
} |
|||
@ -0,0 +1,392 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
|
|||
@Service |
|||
public class DashboardApiService { |
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
public List<Map<String, Object>> getTempEmpDetails(String tempId) { |
|||
System.out.println("service"); |
|||
System.out.println(tempId); |
|||
|
|||
String sql = "SELECT MH.file_moved_date,sm.file_status,MH.remarks FROM gcc_pensioner.file_movement_history MH" |
|||
+ " inner join gcc_pensioner.file_status_master sm on MH.file_status= sm.id where temp_id=? order by MH.file_moved_date desc "; |
|||
|
|||
return jdbcTemplate.queryForList(sql, tempId); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getEmpDetails(String empNo) { |
|||
System.out.println("service"); |
|||
System.out.println(empNo); |
|||
|
|||
String sql = "SELECT dm.dept_name,fm.file_name, sm.file_status ,pd.temp_id " + |
|||
"FROM gcc_pensioner.pensioner_details pd " + |
|||
"INNER JOIN gcc_pensioner.file_category_master fm ON pd.file_category = fm.id " + |
|||
"INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = pd.file_status " + |
|||
"inner join gcc_pensioner.department_master dm on dm.id=pd.dept_id "+ |
|||
|
|||
"WHERE pd.emp_no = ? " + |
|||
|
|||
"UNION " + |
|||
"SELECT dm.dept_name,fm.file_name, sm.file_status ,cps.temp_id " + |
|||
"FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
"INNER JOIN gcc_pensioner.file_category_master fm ON cps.file_category = fm.id " + |
|||
"INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = cps.file_status " + |
|||
"inner join gcc_pensioner.department_master dm on dm.id=cps.dept_id "+ |
|||
|
|||
"WHERE cps.emp_no = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, empNo, empNo); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getPensionEmpDetails(String empNo) { |
|||
System.out.println("service"); |
|||
System.out.println(empNo); |
|||
|
|||
String sql = "SELECT dm.dept_name,fm.file_name, sm.file_status ,pd.temp_id " + |
|||
"FROM gcc_pensioner.pensioner_details pd " + |
|||
"INNER JOIN gcc_pensioner.file_category_master fm ON pd.file_category = fm.id " + |
|||
"INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = pd.file_status " + |
|||
"inner join gcc_pensioner.department_master dm on dm.id=pd.dept_id "+ |
|||
"WHERE pd.emp_no = ? " + |
|||
"UNION " + |
|||
"SELECT dm.dept_name,fm.file_name, sm.file_status ,cps.temp_id " + |
|||
"FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
"INNER JOIN gcc_pensioner.file_category_master fm ON cps.file_category = fm.id " + |
|||
"INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = cps.file_status " + |
|||
"inner join gcc_pensioner.department_master dm on dm.id=cps.dept_id "+ |
|||
"WHERE cps.emp_no = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, empNo, empNo); |
|||
} |
|||
|
|||
|
|||
|
|||
/* public List<Map<String, Object>> getEmployeeDetailss(String fileName) { |
|||
|
|||
|
|||
String sql = "SELECT emp_no FROM gcc_pensioner.pensioner_details pd " + |
|||
"INNER JOIN gcc_pensioner.file_category_master cm ON pd.file_category = cm.id " + |
|||
"WHERE cm.file_name = ?"; |
|||
return jdbcTemplate .queryForList(sql, new Object[]{fileName}); |
|||
}*/ |
|||
/* public List<Map<String, Object>> getStageWiseCounts() { |
|||
String sql = |
|||
"SELECT category, SUM(category_count) AS category_count FROM (" + |
|||
" SELECT " + |
|||
" CASE " + |
|||
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
|||
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
|||
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
|||
" WHEN sm.id = 11 THEN 'Completed' " + |
|||
|
|||
" END AS category, " + |
|||
" COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.pensioner_details pd " + |
|||
" INNER JOIN gcc_pensioner.file_status_master sm ON pd.file_status = sm.id " + |
|||
" GROUP BY category " + |
|||
|
|||
" UNION ALL " + |
|||
|
|||
" SELECT " + |
|||
" CASE " + |
|||
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
|||
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
|||
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
|||
" WHEN sm.id = 11 THEN 'Completed' " + |
|||
|
|||
" END AS category, " + |
|||
" COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" INNER JOIN gcc_pensioner.file_status_master sm ON cps.file_status = sm.id " + |
|||
" GROUP BY category " + |
|||
") AS combined_results " + |
|||
"GROUP BY category;"; |
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
|
|||
}*/ |
|||
|
|||
public List<Map<String, Object>> getEmployeeDetails(String FileId) { |
|||
String query; |
|||
|
|||
switch (FileId) { |
|||
case "1": |
|||
case "2": |
|||
case "3": |
|||
case "4": |
|||
case "5": |
|||
query = "SELECT pd.emp_no " + |
|||
"FROM gcc_pensioner.pensioner_details pd " + |
|||
"INNER JOIN gcc_pensioner.file_category_master cm " + |
|||
"ON pd.file_category = cm.id " + |
|||
"WHERE cm.id = ?"; |
|||
break; |
|||
|
|||
case "6": |
|||
query = "SELECT cps.emp_no " + |
|||
"FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
"INNER JOIN gcc_pensioner.file_category_master cm " + |
|||
"ON cps.file_category = cm.id " + |
|||
"WHERE cm.id = ?"; |
|||
break; |
|||
|
|||
default: |
|||
return Collections.emptyList(); |
|||
} |
|||
|
|||
return jdbcTemplate.queryForList(query, FileId); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchCategoryCounts() { |
|||
String sql = "SELECT file_name, id, COALESCE(SUM(category_count), 0) AS category_count " + |
|||
"FROM ( " + |
|||
" SELECT cm.file_name, cm.id,COUNT(pd.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
|||
" ON pd.file_category = cm.id " + |
|||
" AND pd.is_closed='0' " + |
|||
|
|||
|
|||
" GROUP BY cm.file_name,cm.id" + |
|||
" UNION ALL " + |
|||
" SELECT cm.file_name, cm.id,COUNT(cps.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
|||
" ON cps.file_category = cm.id " + |
|||
|
|||
|
|||
" GROUP BY cm.file_name ,cm.id " + |
|||
") combined_counts " + |
|||
"GROUP BY file_name,id"; |
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
/* |
|||
public List<Map<String, Object>> fetchCategorysearchCounts(String startdate, String enddate) { |
|||
String sql = "SELECT cm.file_name, COALESCE(SUM(category_count), 0) AS category_count " + |
|||
"FROM ( " + |
|||
" SELECT cm.file_name, COUNT(pd.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
|||
" ON pd.file_category = cm.id " + |
|||
" AND (? IS NULL OR (? = ? AND DATE(pd.created_date) = ?) OR (DATE(pd.created_date) >= ? AND DATE(pd.created_date) <= ?)) " + |
|||
|
|||
" GROUP BY cm.file_name " + |
|||
" UNION ALL " + |
|||
" SELECT cm.file_name, COUNT(cps.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
|||
" ON cps.file_category = cm.id " + |
|||
" AND (? IS NULL OR (? = ? AND DATE(cps.created_date) = ?) OR (DATE(cps.created_date) >= ? AND DATE(cps.created_date) <= ?)) " + |
|||
|
|||
" GROUP BY cm.file_name " + |
|||
") combined_counts " + |
|||
"RIGHT JOIN gcc_pensioner.file_category_master cm " + |
|||
"ON combined_counts.file_name = cm.file_name " + |
|||
|
|||
"GROUP BY cm.file_name"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, new Object[]{ |
|||
startdate, startdate, enddate, startdate, // For `pd.created_date` exact match or range |
|||
startdate, enddate, // For `pd.created_date` range |
|||
startdate, startdate, enddate, startdate, // For `cps.created_date` exact match or range |
|||
startdate, enddate // For `cps.created_date` range |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
}//department*/ |
|||
public List<Map<String, Object>> getDepartment() { |
|||
String sql = "SELECT dept_id,dept_name FROM gcc_pensioner.department_master;"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> DepartmenfetchCategoryCounts(String deptId) { |
|||
String sql = "SELECT cm.file_name, cm.id, " + |
|||
" COALESCE(pd.category_count, 0) + COALESCE(cps.category_count, 0) AS category_count " + |
|||
"FROM gcc_pensioner.file_category_master cm " + |
|||
"LEFT JOIN ( " + |
|||
" SELECT file_category, COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.pensioner_details " + |
|||
" WHERE (? IS NULL OR dept_id = ?) " + |
|||
" AND is_closed='0' " + |
|||
" GROUP BY file_category " + |
|||
") pd ON cm.id = pd.file_category " + |
|||
"LEFT JOIN ( " + |
|||
" SELECT file_category, COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.cps_pensioner_details " + |
|||
" WHERE (? IS NULL OR dept_id = ?) " + |
|||
" GROUP BY file_category " + |
|||
") cps ON cm.id = cps.file_category"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, deptId, deptId, deptId, deptId); |
|||
|
|||
|
|||
} public List<Map<String, Object>> fetchchartCategoryCounts(String deptId, String startDate, String endDate) { |
|||
String sql = "SELECT cm.file_name, cm.id, " + |
|||
" COALESCE(pd.category_count, 0) + COALESCE(cps.category_count, 0) AS category_count " + |
|||
"FROM gcc_pensioner.file_category_master cm " + |
|||
"LEFT JOIN ( " + |
|||
" SELECT file_category, COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.pensioner_details " + |
|||
" WHERE (? IS NULL OR dept_id = ?) " + |
|||
" AND (? IS NULL OR date(created_date) >= ?) " + |
|||
" AND (? IS NULL OR date(created_date) <= ?) " + |
|||
" AND is_closed='0' " + |
|||
" GROUP BY file_category " + |
|||
") pd ON cm.id = pd.file_category " + |
|||
"LEFT JOIN ( " + |
|||
" SELECT file_category, COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.cps_pensioner_details " + |
|||
" WHERE (? IS NULL OR dept_id = ?) " + |
|||
" AND (? IS NULL OR date(created_date) >= ?) " + |
|||
" AND (? IS NULL OR date(created_date) <= ?) " + |
|||
" GROUP BY file_category " + |
|||
") cps ON cm.id = cps.file_category"; |
|||
|
|||
return jdbcTemplate.queryForList( |
|||
sql, deptId, deptId, startDate, startDate, endDate, endDate, |
|||
deptId, deptId, startDate, startDate, endDate, endDate |
|||
); |
|||
} |
|||
public List<Map<String, Object>> getStageWiseCounts(String deptId, String startDate, String endDate) { |
|||
String sql = |
|||
"WITH categories AS (" + |
|||
" SELECT 'Audit Pending' AS category UNION ALL " + |
|||
" SELECT 'Department Pending' UNION ALL " + |
|||
" SELECT 'Pension Pending' UNION ALL " + |
|||
" SELECT 'Completed' " + |
|||
") " + |
|||
"SELECT c.category, COALESCE(SUM(cr.category_count), 0) AS category_count " + |
|||
"FROM categories c " + |
|||
"LEFT JOIN ( " + |
|||
" SELECT category, SUM(category_count) AS category_count FROM ( " + |
|||
" SELECT " + |
|||
" CASE " + |
|||
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
|||
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
|||
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
|||
" WHEN sm.id = 11 THEN 'Completed' " + |
|||
" END AS category, " + |
|||
" COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.pensioner_details pd " + |
|||
" INNER JOIN gcc_pensioner.file_status_master sm ON pd.file_status = sm.id " + |
|||
" WHERE (? IS NULL OR pd.dept_id = ?) " + |
|||
" AND (? IS NULL OR DATE(pd.created_date) >= ?) " + |
|||
" AND (? IS NULL OR DATE(pd.created_date) <= ?) " + |
|||
" AND pd.is_closed='0' " + |
|||
" GROUP BY category " + |
|||
|
|||
" UNION ALL " + |
|||
|
|||
" SELECT " + |
|||
" CASE " + |
|||
" WHEN sm.id IN (1, 3) THEN 'Audit Pending' " + |
|||
" WHEN sm.id IN (2, 5, 6, 9) THEN 'Department Pending' " + |
|||
" WHEN sm.id IN (4, 7, 8, 10) THEN 'Pension Pending' " + |
|||
" WHEN sm.id = 11 THEN 'Completed' " + |
|||
" END AS category, " + |
|||
" COUNT(*) AS category_count " + |
|||
" FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" INNER JOIN gcc_pensioner.file_status_master sm ON cps.file_status = sm.id " + |
|||
" WHERE (? IS NULL OR cps.dept_id = ?) " + |
|||
" AND (? IS NULL OR DATE(cps.created_date) >= ?) " + |
|||
" AND (? IS NULL OR DATE(cps.created_date) <= ?) " + |
|||
" GROUP BY category " + |
|||
" ) AS combined_results " + |
|||
" GROUP BY category " + |
|||
") cr ON c.category = cr.category " + |
|||
"GROUP BY c.category;"; |
|||
|
|||
return jdbcTemplate.queryForList( |
|||
sql, deptId, deptId, startDate, startDate, endDate, endDate, |
|||
deptId, deptId, startDate, startDate, endDate, endDate |
|||
); |
|||
} |
|||
|
|||
|
|||
|
|||
//simple |
|||
public List<Map<String, Object>> fetchCategorysearchCounts(String startdate, String enddate,String deptId) { |
|||
String sql = "SELECT cm.file_name, COALESCE(SUM(category_count), 0) AS category_count " + |
|||
"FROM gcc_pensioner.file_category_master cm " + |
|||
"LEFT JOIN ( " + |
|||
" SELECT pd.file_category, COUNT(pd.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE (? IS NULL OR DATE(pd.created_date) = ? OR (DATE(pd.created_date) BETWEEN ? AND ?)) " + |
|||
" AND (? IS NULL OR pd.dept_id = ?) " + |
|||
" AND pd.is_closed='0' " + |
|||
" GROUP BY pd.file_category " + |
|||
|
|||
" UNION ALL " + |
|||
" SELECT cps.file_category, COUNT(cps.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" WHERE (? IS NULL OR DATE(cps.created_date) = ? OR (DATE(cps.created_date) BETWEEN ? AND ?)) " + |
|||
" AND (? IS NULL OR cps.dept_id = ?) " + |
|||
" GROUP BY cps.file_category " + |
|||
") combined_counts ON cm.id = combined_counts.file_category " + |
|||
"GROUP BY cm.file_name"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, new Object[]{ |
|||
startdate, startdate, startdate, enddate, deptId, deptId, // For `pd.created_date` and `dept_id` |
|||
startdate, startdate, startdate, enddate, deptId, deptId // For `cps.created_date` and `dept_id` |
|||
}); |
|||
|
|||
} |
|||
} |
|||
//total 5 changes for is_closed=0 |
|||
/* this is with pendency file category |
|||
* "SELECT file_name, SUM(category_count) AS category_count " + |
|||
"FROM ( " + |
|||
" SELECT cm.file_name, COUNT(pd.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
|||
" ON pd.file_category = cm.id " + |
|||
" GROUP BY cm.file_name " + |
|||
" UNION ALL " + |
|||
" SELECT cm.file_name, COUNT(cps.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
|||
" ON cps.file_category = cm.id " + |
|||
" GROUP BY cm.file_name " + |
|||
") combined_counts " + |
|||
"GROUP BY file_name";--------------------------------------------------------------------------"SELECT cm.file_name, COALESCE(SUM(category_count), 0) AS category_count " + |
|||
"FROM ( " + |
|||
" SELECT cm.file_name, COUNT(pd.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.pensioner_details pd " + |
|||
" ON pd.file_category = cm.id " + |
|||
" AND (? IS NULL OR (? = ? AND DATE(pd.created_date) = ?) OR (DATE(pd.created_date) >= ? AND DATE(pd.created_date) <= ?)) " + |
|||
" GROUP BY cm.file_name " + |
|||
" UNION ALL " + |
|||
" SELECT cm.file_name, COUNT(cps.file_category) AS category_count " + |
|||
" FROM gcc_pensioner.file_category_master cm " + |
|||
" LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + |
|||
" ON cps.file_category = cm.id " + |
|||
" AND (? IS NULL OR (? = ? AND DATE(cps.created_date) = ?) OR (DATE(cps.created_date) >= ? AND DATE(cps.created_date) <= ?)) " + |
|||
" GROUP BY cm.file_name " + |
|||
") combined_counts " + |
|||
"RIGHT JOIN gcc_pensioner.file_category_master cm " + |
|||
"ON combined_counts.file_name = cm.file_name " + |
|||
"GROUP BY cm.file_name"; */ |
|||
@ -0,0 +1,214 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class DepartmentForwardService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public DepartmentForwardService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchDepatmentForwardEmpfiles(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_status=4 AND file_category=? AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean updateEntryDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 5; |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,dateToAudit, remarks,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
@Transactional |
|||
public boolean savehistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String retirement_date = emp.get("retirement_date").toString(); |
|||
String retirement_class = emp.get("retirement_class").toString(); |
|||
String type_of_retirement = emp.get("type_of_retirement").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,retirement_class,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,type_of_retirement,retirement_date,retirement_class,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
//save the updatedfamilypensionReturn |
|||
@Transactional |
|||
public boolean saveFamilyPensionForwardHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
String sericeDeath = emp.get("service_death").toString(); |
|||
String relationshipDeceased = emp.get("relationship_deceased").toString(); |
|||
String sanctionedGis = emp.get("sanctioned_gis_amount").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death,relationship_deceased ,sanctioned_gis_amount,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,sericeDeath,relationshipDeceased,sanctionedGis,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
//update save pendency history |
|||
@Transactional |
|||
public boolean savePendencyForwardHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String retirementClass = emp.get("retirement_class").toString(); |
|||
String retirementDate=emp.get("retirement_date").toString(); |
|||
//String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
|
|||
String typeOfCategory=emp.get("file_category_name").toString(); |
|||
String typeOfRetirement=emp.get("type_of_retirement").toString(); |
|||
|
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,retirement_class,retirement_date,file_category_name,type_of_retirement,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,retirementClass,retirementDate,typeOfCategory,typeOfRetirement,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,644 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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.dao.DataAccessException; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class DepartmentReceivedService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public DepartmentReceivedService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchPensionReceivedEmpfiles(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND (file_status=7 OR file_status=8) AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchPensionbenefitsById(String tempId) { |
|||
String query = "SELECT * " + |
|||
"FROM pension_benefits " + |
|||
"WHERE temp_id=?"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,tempId); |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean updateEntryCompletedDetails(Map<String, Object> requestData) { |
|||
try { |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
String file_pending = (String) requestData.get("file_pending"); |
|||
String pension_number = (String) requestData.get("pension_number"); |
|||
String ledger_number = (String) requestData.get("ledger_number"); |
|||
String benefit_pension = (String) requestData.get("benefit_pension"); |
|||
String benefit_dcrg = requestData.get("benefit_dcrg") != null ? requestData.get("benefit_dcrg").toString() : null; |
|||
String benefit_commutation = (String) requestData.get("benefit_commutation"); |
|||
|
|||
String benefit_pension_amount = (String) requestData.get("benefit_pension_amount"); |
|||
String benefit_dcrg_amount = requestData.get("benefit_dcrg_amount") != null ? requestData.get("benefit_dcrg_amount").toString() : null; |
|||
String benefit_commutation_amount = (String) requestData.get("benefit_commutation_amount"); |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus; |
|||
String file_entry_type=""; |
|||
|
|||
boolean check = checkTempPresent(tempId); |
|||
|
|||
if ("yes".equalsIgnoreCase(benefit_dcrg)) { |
|||
filestatus = CheckFieldsInDept(tempId) ? 11 : 9; //noted |
|||
file_entry_type="FILE_COMPLETED"; |
|||
} |
|||
else if(benefit_dcrg==null) |
|||
{ |
|||
filestatus = 9; |
|||
file_entry_type="DEPARTMENT_PARTIAL"; |
|||
} |
|||
else { |
|||
filestatus = 9; |
|||
file_entry_type="DEPARTMENT_PARTIAL"; |
|||
} |
|||
|
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_entry_type=?,file_status = ?, file_moved_date = ?, remarks = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,file_entry_type, filestatus, dateToAudit, remarks, tempId); |
|||
|
|||
if (rowsUpdated > 0) { |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks, temp_id) VALUES (?, ?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1 = jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks, tempId); |
|||
|
|||
if (rowsUpdated1 > 0) { |
|||
if (check) { |
|||
String updateQuery1 = "UPDATE pension_benefits SET file_pending = ?, pension_number = ?, ledger_number = ?, benefit_pension = ?, benefit_pension_amount = ?, benefit_dcrg = ?, benefit_dcrg_amount = ?, benefit_commutation = ?, benefit_commutation_amount = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
int rowsUpdated3 = jdbcTemplate.update(updateQuery1, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount, tempId); |
|||
} else { |
|||
String benefitQuery = "INSERT INTO pension_benefits (emp_no, temp_id, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
int rowsUpdated2 = jdbcTemplate.update(benefitQuery, empNo, tempId, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount); |
|||
} |
|||
return true; |
|||
} |
|||
} |
|||
return false; |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Error parsing department ID: " + e.getMessage()); |
|||
return false; |
|||
} catch (DataAccessException e) { |
|||
System.err.println("Database operation failed: " + e.getMessage()); |
|||
return false; |
|||
} catch (Exception e) { |
|||
System.err.println("Unexpected error: " + e.getMessage()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
private boolean checkTempPresent(String tempId) { |
|||
String query = "SELECT EXISTS (SELECT 1 FROM pension_benefits WHERE temp_id = ?)"; |
|||
|
|||
return Boolean.TRUE.equals(jdbcTemplate.queryForObject(query, Boolean.class, tempId)); |
|||
} |
|||
|
|||
private boolean CheckFieldsInDept(String tempId) { |
|||
|
|||
// Define the SQL query |
|||
String sql = "SELECT CASE " + |
|||
"WHEN gpf = 'yes' AND spfgs = 'yes' AND private_affairs = 'yes' AND dcrg = 'yes' THEN true " + |
|||
"ELSE false END AS allYes " + |
|||
"FROM zone_benefits " + |
|||
"WHERE temp_id = ?"; |
|||
|
|||
|
|||
try { |
|||
// Use queryForObject to get a single boolean result |
|||
Boolean result = jdbcTemplate.queryForObject(sql, Boolean.class, tempId); |
|||
return result != null && result; // Return the result if not null |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Log the exception if needed |
|||
} |
|||
|
|||
return false; // Return false if an exception occurs |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean saveRetirementCompletedhistory(List<Map<String, Object>> emp_details,List<Map<String, Object>> pension_details,String filemovedby) { |
|||
|
|||
try { |
|||
|
|||
int file_Cat=0; |
|||
|
|||
if (!emp_details.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = emp_details.get(0); |
|||
Object fileCatObj = firstEmployeeDetails.get("file_category"); |
|||
|
|||
if (fileCatObj != null) { |
|||
try { |
|||
file_Cat = Integer.parseInt(fileCatObj.toString()); |
|||
System.out.println("Parsed file_category: " + file_Cat); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_category: " + fileCatObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_category is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
// Batch update for employee details |
|||
if(file_Cat==1) { |
|||
String empInsertQuery = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, filemovedby); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
}); |
|||
} |
|||
|
|||
if(file_Cat==2) |
|||
{ |
|||
String empInsertQuery1 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death, " + |
|||
"relationship_deceased, sanctioned_gis_amount, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery1, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("service_death").toString()); |
|||
ps.setString(6, emp.get("relationship_deceased").toString()); |
|||
ps.setString(7, emp.get("sanctioned_gis_amount").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, filemovedby); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration").toString()); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for family Pension"); |
|||
} |
|||
|
|||
if(file_Cat==3) |
|||
{ |
|||
String empInsertQuery2 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement, " + |
|||
"file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending,retirement_class,retirement_date) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery2, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("file_moved_date").toString()); |
|||
ps.setString(7, emp.get("remarks").toString()); |
|||
ps.setInt(8, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(9, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(10, emp.get("file_entry_type").toString()); |
|||
ps.setString(11, filemovedby); |
|||
ps.setInt(12, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(13, emp.get("file_category_name").toString()); |
|||
ps.setString(14, emp.get("temp_id").toString()); |
|||
ps.setString(15, emp.get("pending_duration").toString()); |
|||
ps.setString(16, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
ps.setString(17, emp.get("retirement_class").toString()); |
|||
ps.setString(18, emp.get("retirement_date").toString()); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for pending"); |
|||
} |
|||
|
|||
String pensionInsertQuery = |
|||
"INSERT INTO pension_benefits_history (emp_no,temp_id,file_pending,pension_number,ledger_number,benefit_pension,benefit_pension_amount,benefit_dcrg,benefit_dcrg_amount,benefit_commutation,benefit_commutation_amount,file_moved_by) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(pensionInsertQuery, pension_details, pension_details.size(), (ps, pension) -> { |
|||
ps.setString(1, pension.get("emp_no").toString()); |
|||
ps.setString(2, pension.get("temp_id").toString()); |
|||
ps.setString(3, pension.get("file_pending").toString()); |
|||
ps.setString(4, pension.get("pension_number").toString()); |
|||
ps.setString(5, pension.get("ledger_number").toString()); |
|||
ps.setString(6, pension.get("benefit_pension").toString()); |
|||
ps.setString(7, pension.get("benefit_pension_amount") != null ? pension.get("benefit_pension_amount").toString() : null); |
|||
ps.setString(8, pension.get("benefit_dcrg") != null ? pension.get("benefit_dcrg").toString() : null); |
|||
ps.setString(9, pension.get("benefit_dcrg_amount") != null ? pension.get("benefit_dcrg_amount").toString() : null); |
|||
ps.setString(10, pension.get("benefit_commutation").toString()); |
|||
ps.setString(11, pension.get("benefit_commutation_amount") != null ? pension.get("benefit_commutation_amount").toString() : null); |
|||
ps.setString(12, filemovedby); |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
System.out.println("rows inserted in pension history for family Pension"); |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean updateEntryPendingDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
String file_pending = (String) requestData.get("file_pending"); |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus=8; |
|||
|
|||
String file_entry_type="FILE_PENDING"; |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?,file_entry_type=?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,file_entry_type,dateToAudit, remarks,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
if(rowsUpdated1>0) |
|||
{ |
|||
// Insert into zone benefits |
|||
String benefitQuery="INSERT INTO pension_benefits (emp_no,temp_id,file_pending) VALUES (?,?,?)"; |
|||
int rowsUpdated2=jdbcTemplate.update(benefitQuery,empNo,tempId,file_pending); |
|||
System.out.println("Rows inserted in pb1:"+rowsUpdated2); |
|||
return true; |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
@Transactional |
|||
public boolean saveRetirementPendinghistory(List<Map<String, Object>> emp_details,List<Map<String, Object>> pension_details,String filemovedby) { |
|||
try { |
|||
|
|||
int file_Cat=0; |
|||
|
|||
if (!emp_details.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = emp_details.get(0); |
|||
Object fileCatObj = firstEmployeeDetails.get("file_category"); |
|||
|
|||
if (fileCatObj != null) { |
|||
try { |
|||
file_Cat = Integer.parseInt(fileCatObj.toString()); |
|||
System.out.println("Parsed file_category: " + file_Cat); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_category: " + fileCatObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_category is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
// Batch update for employee details |
|||
if(file_Cat==1) { |
|||
String empInsertQuery = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, filemovedby); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
}); |
|||
} |
|||
|
|||
if(file_Cat==2) |
|||
{ |
|||
String empInsertQuery1 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death, " + |
|||
"relationship_deceased, sanctioned_gis_amount, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery1, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("service_death").toString()); |
|||
ps.setString(6, emp.get("relationship_deceased").toString()); |
|||
ps.setString(7, emp.get("sanctioned_gis_amount").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, filemovedby); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration").toString()); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for family Pension"); |
|||
} |
|||
|
|||
if(file_Cat==3) |
|||
{ |
|||
String empInsertQuery2 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement, " + |
|||
"file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery2, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("file_moved_date").toString()); |
|||
ps.setString(7, emp.get("remarks").toString()); |
|||
ps.setInt(8, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(9, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(10, emp.get("file_entry_type").toString()); |
|||
ps.setString(11, filemovedby); |
|||
ps.setInt(12, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(13, emp.get("file_category_name").toString()); |
|||
ps.setString(14, emp.get("temp_id").toString()); |
|||
ps.setString(15, emp.get("pending_duration").toString()); |
|||
ps.setString(16, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for pending"); |
|||
} |
|||
|
|||
String pensionInsertQuery = |
|||
"INSERT INTO pension_benefits_history (emp_no,temp_id,file_pending,file_moved_by) VALUES (?,?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(pensionInsertQuery, pension_details, pension_details.size(), (ps, pension) -> { |
|||
ps.setString(1, pension.get("emp_no").toString()); |
|||
ps.setString(2, pension.get("temp_id").toString()); |
|||
ps.setString(3, pension.get("file_pending").toString()); |
|||
ps.setString(4, filemovedby); |
|||
|
|||
}); |
|||
System.out.println("rows inserted in pension history for family Pension"); |
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean updateEntryReturnDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
String file_entry_type="FILE_RETURNED"; |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus=6; |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?,file_entry_type=?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,file_entry_type,dateToAudit, remarks,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
return true; |
|||
|
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
@Transactional |
|||
public boolean saveRetirementreturnhistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
|
|||
int file_Cat=0; |
|||
|
|||
if (!emp_details.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = emp_details.get(0); |
|||
Object fileCatObj = firstEmployeeDetails.get("file_category"); |
|||
|
|||
if (fileCatObj != null) { |
|||
try { |
|||
file_Cat = Integer.parseInt(fileCatObj.toString()); |
|||
System.out.println("Parsed file_category: " + file_Cat); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_category: " + fileCatObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_category is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
// Batch update for employee details |
|||
if(file_Cat==1) { |
|||
String empInsertQuery = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, filemovedby); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
}); |
|||
} |
|||
|
|||
if(file_Cat==2) |
|||
{ |
|||
String empInsertQuery1 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death, " + |
|||
"relationship_deceased, sanctioned_gis_amount, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery1, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("service_death").toString()); |
|||
ps.setString(6, emp.get("relationship_deceased").toString()); |
|||
ps.setString(7, emp.get("sanctioned_gis_amount").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, filemovedby); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration").toString()); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for family Pension"); |
|||
} |
|||
|
|||
if(file_Cat==3) |
|||
{ |
|||
String empInsertQuery2 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement, " + |
|||
"file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery2, emp_details, emp_details.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("file_moved_date").toString()); |
|||
ps.setString(7, emp.get("remarks").toString()); |
|||
ps.setInt(8, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(9, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(10, emp.get("file_entry_type").toString()); |
|||
ps.setString(11, filemovedby); |
|||
ps.setInt(12, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(13, emp.get("file_category_name").toString()); |
|||
ps.setString(14, emp.get("temp_id").toString()); |
|||
ps.setString(15, emp.get("pending_duration").toString()); |
|||
ps.setString(16, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for pending"); |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,299 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
|
|||
@Service |
|||
public class DeptAuditService { |
|||
|
|||
|
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public DeptAuditService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchEmployeeDetailsByTable(Integer deptId,Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE dept_id=? AND file_category=? AND (file_status=1 OR file_status=3) AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,deptId,file_cat); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchEmployeeById(String tempId) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE temp_id=?"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,tempId); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchEmployeeByIdCps(String tempId) { |
|||
String query = "SELECT * " + |
|||
"FROM cps_pensioner_details " + |
|||
"WHERE temp_id=?"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,tempId); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchDetailsWithZoneBenefitsById(String tempId) { |
|||
String query = "SELECT pd.*, zb.gpf, zb.gpf_amount, zb.spfgs, zb.spfgs_amount, zb.dcrg, " + |
|||
"zb.private_affairs, zb.private_affairs_amount, zb.recovery_emp " + |
|||
"FROM pensioner_details pd " + |
|||
"LEFT JOIN zone_benefits zb ON pd.temp_id = zb.temp_id " + |
|||
"WHERE pd.temp_id = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(query, tempId); |
|||
}// |
|||
|
|||
public List<Map<String, Object>> fetchFilePendingBenefits(String tempId) { |
|||
|
|||
String query = "SELECT pd.*, zb.gpf, zb.gpf_amount, zb.spfgs, zb.spfgs_amount, zb.dcrg, " + |
|||
"zb.private_affairs, zb.private_affairs_amount, zb.recovery_emp,pb.file_pending " + |
|||
"FROM pensioner_details pd " + |
|||
"LEFT JOIN zone_benefits zb ON pd.temp_id = zb.temp_id " + |
|||
"LEFT JOIN pension_benefits pb ON pd.temp_id = pb.temp_id " + |
|||
"WHERE pd.temp_id = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(query, tempId); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchPartialCompleted(String tempId) { |
|||
|
|||
String query = "SELECT pd.*, zb.gpf, zb.gpf_amount, zb.spfgs, zb.spfgs_amount, zb.dcrg, " + |
|||
"zb.private_affairs, zb.private_affairs_amount, zb.recovery_emp,pb.file_pending," + |
|||
"pb.pension_number,pb.ledger_number,pb.benefit_pension,pb.benefit_pension_amount,pb.benefit_dcrg,pb.benefit_dcrg_amount,pb.benefit_commutation,pb.benefit_commutation_amount " + |
|||
"FROM pensioner_details pd " + |
|||
"LEFT JOIN zone_benefits zb ON pd.temp_id = zb.temp_id " + |
|||
"LEFT JOIN pension_benefits pb ON pd.temp_id = pb.temp_id " + |
|||
"WHERE pd.temp_id = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(query, tempId); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchFileMovementHistory(String tempId) { |
|||
// Query to fetch file movement history |
|||
String query = "SELECT fh.file_moved_date AS fileMovedDateHistory, " + |
|||
"fm.file_status AS fileStatusHistory, " + |
|||
"fh.remarks AS remarksHistory " + |
|||
"FROM file_movement_history fh " + |
|||
"JOIN file_status_master fm ON fh.file_status = fm.id " + |
|||
"WHERE fh.temp_id = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(query,tempId); |
|||
} |
|||
|
|||
|
|||
@Transactional |
|||
public boolean updateEntryDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 2; |
|||
String file_entry_type="AUDIT_RETURNED"; |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?, file_entry_type =?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,file_entry_type,dateToAudit, remarks,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
@Transactional |
|||
public boolean savehistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String retirement_date = emp.get("retirement_date").toString(); |
|||
String retirement_class = emp.get("retirement_class").toString(); |
|||
String type_of_retirement = emp.get("type_of_retirement").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,retirement_class,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,type_of_retirement,retirement_date,retirement_class,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
//save the updatedfamilypension details |
|||
@Transactional |
|||
public boolean saveFamilyPensionHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
String serviceDeath = emp.get("service_death").toString(); |
|||
String relationshipDeceased = emp.get("relationship_deceased").toString(); |
|||
String sanctionedGis = emp.get("sanctioned_gis_amount").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death,relationship_deceased ,sanctioned_gis_amount,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,serviceDeath,relationshipDeceased,sanctionedGis,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
//save the pendency details |
|||
@Transactional |
|||
public boolean savePendencyHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String retirementClass = emp.get("retirement_class").toString(); |
|||
String retirementDate=emp.get("retirement_date").toString(); |
|||
//String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
|
|||
String typeOfCategory=emp.get("file_category_name").toString(); |
|||
String typeOfRetirement=emp.get("type_of_retirement").toString(); |
|||
|
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,retirement_class,retirement_date,file_category_name,type_of_retirement,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,retirementClass,retirementDate,typeOfCategory,typeOfRetirement,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,354 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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.dao.DataAccessException; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class DeptPartiallyCompService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public DeptPartiallyCompService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchDepatmentPartialEmpfiles(Integer deptId,Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_status=9 AND dept_id=? AND file_category=? AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,deptId,file_cat); |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean updateEntryCompletedDetails(Map<String, Object> requestData) { |
|||
try { |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
|
|||
String gpf = (String) requestData.get("gpf"); |
|||
String private_affairs = (String) requestData.get("private_affairs"); |
|||
String spfgs = (String) requestData.get("spfgs"); |
|||
String recovery_emp = requestData.get("recovery_emp") != null ? requestData.get("recovery_emp").toString() : null; |
|||
String dcrg = (String) requestData.get("dcrg"); |
|||
|
|||
String gpfAmount = requestData.get("gpfAmount") != null ? requestData.get("gpfAmount").toString() : null; |
|||
String private_affairs_amount = requestData.get("private_affairs_amount") != null ? requestData.get("private_affairs_amount").toString() : null; |
|||
String spfgs_amount = requestData.get("spfgs_amount") != null ? requestData.get("spfgs_amount").toString() : null; |
|||
|
|||
|
|||
String pension_number = (String) requestData.get("pension_number"); |
|||
String ledger_number = (String) requestData.get("ledger_number"); |
|||
String benefit_pension = (String) requestData.get("benefit_pension"); |
|||
String benefit_dcrg = (String) requestData.get("benefit_dcrg"); |
|||
String benefit_commutation = (String) requestData.get("benefit_commutation"); |
|||
|
|||
String benefit_pension_amount = requestData.get("benefit_pension_amount")!= null ? requestData.get("benefit_pension_amount").toString() : null; |
|||
String benefit_dcrg_amount = requestData.get("benefit_dcrg_amount") != null ? requestData.get("benefit_dcrg_amount").toString() : null; |
|||
String benefit_commutation_amount = requestData.get("benefit_commutation_amount") != null ? requestData.get("benefit_commutation_amount").toString() : null; |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus; |
|||
String file_entry_type=""; |
|||
|
|||
|
|||
|
|||
String updateQuery1 = "UPDATE zone_benefits SET gpf = ?, gpf_amount = ?, spfgs = ?, spfgs_amount = ?, dcrg = ?, private_affairs = ?, private_affairs_amount = ?, recovery_emp = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
int rowsUpdated3 = jdbcTemplate.update(updateQuery1, gpf, gpfAmount, spfgs, spfgs_amount, dcrg, private_affairs, private_affairs_amount, recovery_emp, tempId); |
|||
System.out.println("Rows updated in zb: " + rowsUpdated3); |
|||
|
|||
if (rowsUpdated3 > 0) { |
|||
|
|||
// String updateQuery2 = "UPDATE pension_benefits SET pension_number = ?, ledger_number = ?, benefit_pension = ?, benefit_pension_amount = ?, benefit_dcrg = ?, benefit_dcrg_amount = ?, benefit_commutation = ?, benefit_commutation_amount = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
// int rowsUpdated2 = jdbcTemplate.update(updateQuery2, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount, tempId); |
|||
// System.out.println("Rows updated in pb: " + rowsUpdated2); |
|||
|
|||
filestatus = CheckFieldsforComplete(tempId) ? 11 : CheckFieldsforDept(tempId) ? 10 : 9; |
|||
System.out.println("filestatus inside service="+filestatus); |
|||
|
|||
if(filestatus==11) |
|||
{ |
|||
file_entry_type="FILE_COMPLETED"; |
|||
} |
|||
if(filestatus==9) { |
|||
file_entry_type="DEPARTMENT_PARTIAL"; |
|||
} |
|||
if(filestatus==10) { |
|||
file_entry_type="PENSION_PARTIAL"; |
|||
} |
|||
|
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_entry_type=?,file_status = ?, file_moved_date = ?, remarks = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,file_entry_type, filestatus, dateToAudit, remarks, tempId); |
|||
System.out.println("Rows updated in pd: " + rowsUpdated); |
|||
|
|||
if (rowsUpdated > 0) { |
|||
|
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks, temp_id) VALUES (?, ?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1 = jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks, tempId); |
|||
System.out.println("Rows updated in fmh: " + rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
} |
|||
return false; |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Error parsing department ID: " + e.getMessage()); |
|||
return false; |
|||
} catch (DataAccessException e) { |
|||
System.err.println("Database operation failed: " + e.getMessage()); |
|||
return false; |
|||
} catch (Exception e) { |
|||
System.err.println("Unexpected error: " + e.getMessage()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
@Transactional |
|||
public boolean saveHistory(List<Map<String, Object>> empDetails, List<Map<String, Object>> zoneBenefits, List<Map<String, Object>> pension_details, String fileMovedBy) { |
|||
try { |
|||
int file_Cat=0; |
|||
|
|||
if (!empDetails.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = empDetails.get(0); |
|||
Object fileCatObj = firstEmployeeDetails.get("file_category"); |
|||
|
|||
if (fileCatObj != null) { |
|||
try { |
|||
file_Cat = Integer.parseInt(fileCatObj.toString()); |
|||
System.out.println("Parsed file_category: " + file_Cat); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_category: " + fileCatObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_category is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
// Batch update for employee details |
|||
if(file_Cat==1) { |
|||
String empInsertQuery = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
}); |
|||
} |
|||
|
|||
if(file_Cat==2) |
|||
{ |
|||
String empInsertQuery1 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death, " + |
|||
"relationship_deceased, sanctioned_gis_amount, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery1, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("service_death").toString()); |
|||
ps.setString(6, emp.get("relationship_deceased").toString()); |
|||
ps.setString(7, emp.get("sanctioned_gis_amount").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration").toString()); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for family Pension"); |
|||
} |
|||
|
|||
if(file_Cat==3) |
|||
{ |
|||
String empInsertQuery2 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement, " + |
|||
"file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending,retirement_class,retirement_date) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery2, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("file_moved_date").toString()); |
|||
ps.setString(7, emp.get("remarks").toString()); |
|||
ps.setInt(8, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(9, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(10, emp.get("file_entry_type").toString()); |
|||
ps.setString(11, fileMovedBy); |
|||
ps.setInt(12, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(13, emp.get("file_category_name").toString()); |
|||
ps.setString(14, emp.get("temp_id").toString()); |
|||
ps.setString(15, emp.get("pending_duration").toString()); |
|||
ps.setString(16, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
ps.setString(17, emp.get("retirement_class").toString()); |
|||
ps.setString(18, emp.get("retirement_date").toString()); |
|||
|
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for pendency"); |
|||
} |
|||
|
|||
// Batch update for zone benefits |
|||
String zoneInsertQuery = |
|||
"INSERT INTO zone_benefits_history (emp_no, temp_id, gpf, gpf_amount, spfgs, spfgs_amount, dcrg, " + |
|||
"private_affairs, private_affairs_amount, recovery_emp, file_moved_by) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(zoneInsertQuery, zoneBenefits, zoneBenefits.size(), (ps, zone) -> { |
|||
ps.setString(1, zone.get("emp_no").toString()); |
|||
ps.setString(2, zone.get("temp_id").toString()); |
|||
ps.setString(3, zone.get("gpf").toString()); |
|||
ps.setString(4, zone.get("gpf_amount") != null ? zone.get("gpf_amount").toString() : null); |
|||
ps.setString(5, zone.get("spfgs").toString()); |
|||
ps.setString(6, zone.get("spfgs_amount") != null ? zone.get("spfgs_amount").toString() : null); |
|||
ps.setString(7, zone.get("dcrg").toString()); |
|||
ps.setString(8, zone.get("private_affairs").toString()); |
|||
ps.setString(9, zone.get("private_affairs_amount") != null ? zone.get("private_affairs_amount").toString() : null); |
|||
ps.setString(10, zone.get("recovery_emp") != null ? zone.get("recovery_emp").toString() : null); |
|||
ps.setString(11, fileMovedBy); |
|||
}); |
|||
|
|||
// Batch update for pension benefits |
|||
// String pensionInsertQuery = |
|||
// "INSERT INTO pension_benefits_history (emp_no,temp_id,file_pending,pension_number,ledger_number,benefit_pension,benefit_pension_amount,benefit_dcrg,benefit_dcrg_amount,benefit_commutation,benefit_commutation_amount,file_moved_by) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; |
|||
// |
|||
// jdbcTemplate.batchUpdate(pensionInsertQuery, pension_details, pension_details.size(), (ps, pension) -> { |
|||
// ps.setString(1, pension.get("emp_no").toString()); |
|||
// ps.setString(2, pension.get("temp_id").toString()); |
|||
// ps.setString(3, pension.get("file_pending").toString()); |
|||
// ps.setString(4, pension.get("pension_number").toString()); |
|||
// ps.setString(5, pension.get("ledger_number").toString()); |
|||
// ps.setString(6, pension.get("benefit_pension").toString()); |
|||
// ps.setString(7, pension.get("benefit_pension_amount") != null ? pension.get("benefit_pension_amount").toString() : null); |
|||
// ps.setString(8, pension.get("benefit_dcrg").toString()); |
|||
// ps.setString(9, pension.get("benefit_dcrg_amount") != null ? pension.get("benefit_dcrg_amount").toString() : null); |
|||
// ps.setString(10, pension.get("benefit_commutation").toString()); |
|||
// ps.setString(11, pension.get("benefit_commutation_amount") != null ? pension.get("benefit_commutation_amount").toString() : null); |
|||
// ps.setString(12, fileMovedBy); |
|||
// |
|||
// }); |
|||
|
|||
return true; // All insertions succeeded |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
private boolean CheckFieldsforComplete(String tempId) { |
|||
|
|||
// Define the SQL query |
|||
String sql = "SELECT \r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN zb.gpf = 'yes' AND zb.spfgs = 'yes' AND zb.private_affairs = 'yes' AND zb.dcrg = 'yes' \r\n" |
|||
+ " AND pb.benefit_pension = 'yes' AND pb.benefit_dcrg = 'yes' AND pb.benefit_commutation = 'yes' THEN 1 ELSE 0 \r\n" |
|||
+ " END AS allYes \r\n" |
|||
+ "FROM zone_benefits AS zb\r\n" |
|||
+ "JOIN pension_benefits AS pb ON zb.temp_id = pb.temp_id \r\n" |
|||
+ "WHERE zb.temp_id = ? "; |
|||
|
|||
|
|||
try { |
|||
// Use queryForObject to get a single boolean result |
|||
Boolean result = jdbcTemplate.queryForObject(sql, Boolean.class, tempId); |
|||
|
|||
System.out.println("result============ "+result); |
|||
|
|||
return result != null && result; // Return the result if not null |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Log the exception if needed |
|||
} |
|||
|
|||
return false; // Return false if an exception occurs |
|||
} |
|||
|
|||
private boolean CheckFieldsforDept(String tempId) { |
|||
|
|||
// Define the SQL query |
|||
String sql = "SELECT \r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN zb.gpf = 'yes' AND zb.spfgs = 'yes' AND zb.private_affairs = 'yes' AND zb.dcrg = 'yes' \r\n" |
|||
+ " THEN 1 ELSE 0 \r\n" |
|||
+ " END AS allYes\r\n" |
|||
+ "FROM zone_benefits AS zb\r\n" |
|||
+ "WHERE zb.temp_id = ?"; |
|||
|
|||
|
|||
try { |
|||
// Use queryForObject to get a single boolean result |
|||
Boolean result = jdbcTemplate.queryForObject(sql, Boolean.class, tempId); |
|||
|
|||
return result != null && result; // Return the result if not null |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Log the exception if needed |
|||
} |
|||
|
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
|
|||
@Service |
|||
public class DropdownService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getRetrimentTypes() { |
|||
String sql = "SELECT id,retriment_type FROM type_of_retriment"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getCategoryTypes() { |
|||
String sql = "SELECT id,category_type FROM type_of_category"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getProvisionalReasonTypes() { |
|||
String sql = "SELECT id,provisional_reason FROM reason_for_provisional"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getGisEntryTypes() { |
|||
String sql = "SELECT id,gis_entry FROM gis_entry_type"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
} |
|||
@ -0,0 +1,194 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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.dao.EmptyResultDataAccessException; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class FileClosingService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public FileClosingService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchEmployeeByTempId(String tempId) { |
|||
|
|||
System.out.println("inside"); |
|||
|
|||
String sql = "SELECT * " + |
|||
"FROM pensioner_details pd " + |
|||
"where pd.file_category=1 and pd.file_status < 11 and pd.temp_id = ? and pd.is_closed=0 " ; |
|||
|
|||
|
|||
System.out.println("outside"); |
|||
System.out.println(sql); |
|||
|
|||
return jdbcTemplate.queryForList(sql,tempId); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
public String getTempId(String empCode,Integer deptId,Integer file_cat) { |
|||
String query = "SELECT temp_id FROM pensioner_details WHERE emp_no = ? AND file_category = ? AND dept_id = ?"; |
|||
|
|||
try { |
|||
return jdbcTemplate.queryForObject(query, String.class,empCode,file_cat,deptId); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchEmployeeById(String tempId) { |
|||
|
|||
String sql = "SELECT pd.*, zb.gpf, zb.gpf_amount, zb.spfgs, zb.spfgs_amount, zb.dcrg, " + |
|||
"zb.private_affairs, zb.private_affairs_amount, zb.recovery_emp, " + |
|||
"pb.file_pending, pb.pension_number, pb.ledger_number, pb.benefit_pension, " + |
|||
"pb.benefit_pension_amount, pb.benefit_dcrg, pb.benefit_dcrg_amount " + |
|||
"FROM pensioner_details pd " + |
|||
"LEFT JOIN zone_benefits zb ON pd.temp_id = zb.temp_id " + |
|||
"LEFT JOIN pension_benefits pb ON pd.temp_id = pb.temp_id "+ |
|||
"where pd.temp_id = ? "; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(sql,tempId); |
|||
} |
|||
|
|||
|
|||
public boolean updateEntryDetails(Map<String, Object> requestData) { |
|||
|
|||
System.out.println("requestdata"+requestData); |
|||
|
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
String serviceDeath =(String)requestData.get("serviceDeath"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus=12; |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "update pensioner_details set service_death=?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP,is_closed=1 WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,serviceDeath,dateToAudit, remarks,tempId); |
|||
|
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
// save fileclosing details |
|||
|
|||
public boolean saveclosinghistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
|
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String serviceDeath=emp.get("service_death").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String retirement_date = emp.get("retirement_date").toString(); |
|||
String retirement_class = emp.get("retirement_class").toString(); |
|||
String type_of_retirement = emp.get("type_of_retirement").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,serviceDeath,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
//closed list |
|||
|
|||
public List<Map<String, Object>> fetchClosingEmployee() { |
|||
|
|||
System.out.println("inside"); |
|||
|
|||
String sql = "SELECT * " + |
|||
"FROM pensioner_details pd " + |
|||
"where pd.file_category=1 and pd.file_status < 11 and pd.is_closed=1 "; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,762 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
|||
|
|||
import java.text.ParseException; |
|||
import java.text.SimpleDateFormat; |
|||
import java.time.LocalDate; |
|||
import java.time.LocalDateTime; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.time.format.DateTimeParseException; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import java.util.Comparator; |
|||
import java.util.Date; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.dao.EmptyResultDataAccessException; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.JsonNode; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class NewEntryService { |
|||
|
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public NewEntryService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
|
|||
public Map<String, Object> fetchEmplyeeDetails(String fromDate, String toDate, Integer deptId) { |
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
String apiUrl = appconfig.qaqcurl + "serviceId=common_api" |
|||
+ "&jsonResp=Yes" |
|||
+ "&subService=getEmpPenDetDuration" |
|||
+ "&fromDate=" + fromDate |
|||
+ "&toDate=" + toDate |
|||
+ "&deptId=" + deptId; |
|||
|
|||
System.out.println("url: " + apiUrl); |
|||
System.out.println("deptId:" + deptId); |
|||
try { |
|||
String rawResponse = restTemplate.getForObject(apiUrl, String.class); |
|||
System.out.println("Raw Response: " + rawResponse); // Debugging step |
|||
|
|||
if (isValidJson(rawResponse)) { |
|||
JsonNode jsonResponse = objectMapper.readTree(rawResponse); |
|||
|
|||
// Extract the "ListResult" array |
|||
JsonNode details = jsonResponse.path("ListResult"); |
|||
|
|||
if (details.isArray() && details.size() > 0) { |
|||
List<Map<String, String>> list = new ArrayList<>(); |
|||
for (JsonNode detail : details) { |
|||
Map<String, String> listResult = new HashMap<>(); |
|||
listResult.put("RETIREMENT_DATE", getNonNullValue(detail.path("RETIREMENT_DATE"))); |
|||
listResult.put("DEATH_DATE", getNonNullValue(detail.path("DEATH_DATE"))); |
|||
listResult.put("COMMUNITY_NAME", getNonNullValue(detail.path("COMMUNITY_NAME"))); |
|||
listResult.put("GROUP_TYPE", getNonNullValue(detail.path("GROUP_TYPE"))); |
|||
listResult.put("ID_DEPT", getNonNullValue(detail.path("ID_DEPT"))); |
|||
listResult.put("EMPLOYEE_CODE", getNonNullValue(detail.path("EMPLOYEE_CODE"))); |
|||
listResult.put("FUNCTIONARY", getNonNullValue(detail.path("FUNCTIONARY"))); |
|||
listResult.put("IS_HANDICAPPED", getNonNullValue(detail.path("IS_HANDICAPPED"))); |
|||
listResult.put("GENDER", getNonNullValue(detail.path("GENDER"))); |
|||
listResult.put("DATE_OF_BIRTH", getNonNullValue(detail.path("DATE_OF_BIRTH"))); |
|||
listResult.put("DATE_OF_APPOINTMENT", getNonNullValue(detail.path("DATE_OF_APPOINTMENT"))); |
|||
listResult.put("DESIGNATION", getNonNullValue(detail.path("DESIGNATION"))); |
|||
listResult.put("EMPLOYEE_NAME", getNonNullValue(detail.path("EMPLOYEE_NAME"))); |
|||
listResult.put("DEPARTMENT", getNonNullValue(detail.path("DEPARTMENT"))); |
|||
list.add(listResult); |
|||
} |
|||
// Sort the list by RETIREMENT_DATE in ascending order |
|||
list.sort(Comparator.comparing(map -> parseDate(((Map<String, String>) map).get("RETIREMENT_DATE")))); |
|||
|
|||
response.put("list", list); |
|||
|
|||
} else { |
|||
response.put("list", Collections.emptyList()); |
|||
} |
|||
} else { |
|||
System.err.println("Invalid JSON Response: " + rawResponse); |
|||
response.put("list", Collections.emptyList()); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
response.put("list", Collections.emptyList()); |
|||
} |
|||
return response; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public Map<String, Object> fetchEmplyeeDetailsbyCode(String empCode) { |
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
String apiUrl = appconfig.qaqcurl + "serviceId=common_api" |
|||
+ "&jsonResp=Yes" |
|||
+ "&subService=getEmpPenDet" |
|||
+ "&empCode=" + empCode; |
|||
|
|||
System.out.println("url: " + apiUrl); |
|||
System.out.println("empCode:" + empCode); |
|||
try { |
|||
String rawResponse = restTemplate.getForObject(apiUrl, String.class); |
|||
System.out.println("Raw Response: " + rawResponse); // Debugging step |
|||
|
|||
if (isValidJson(rawResponse)) { |
|||
JsonNode jsonResponse = objectMapper.readTree(rawResponse); |
|||
|
|||
// Extract the "ListResult" array |
|||
JsonNode details = jsonResponse.path("ListResult"); |
|||
|
|||
if (details.isArray() && details.size() > 0) { |
|||
List<Map<String, String>> list = new ArrayList<>(); |
|||
for (JsonNode detail : details) { |
|||
Map<String, String> listResult = new HashMap<>(); |
|||
listResult.put("RETIREMENT_DATE", formatToISODate(getNonNullValue(detail.path("RETIREMENT_DATE")))); |
|||
listResult.put("DEATH_DATE", getNonNullValue(detail.path("DEATH_DATE"))); |
|||
listResult.put("COMMUNITY_NAME", getNonNullValue(detail.path("COMMUNITY_NAME"))); |
|||
listResult.put("GROUP_TYPE", getNonNullValue(detail.path("GROUP_TYPE"))); |
|||
listResult.put("ID_DEPT", getNonNullValue(detail.path("ID_DEPT"))); |
|||
listResult.put("EMPLOYEE_CODE", getNonNullValue(detail.path("EMPLOYEE_CODE"))); |
|||
listResult.put("FUNCTIONARY", getNonNullValue(detail.path("FUNCTIONARY"))); |
|||
listResult.put("IS_HANDICAPPED", getNonNullValue(detail.path("IS_HANDICAPPED"))); |
|||
listResult.put("GENDER", getNonNullValue(detail.path("GENDER"))); |
|||
listResult.put("DATE_OF_BIRTH", getNonNullValue(detail.path("DATE_OF_BIRTH"))); |
|||
listResult.put("DATE_OF_APPOINTMENT", getNonNullValue(detail.path("DATE_OF_APPOINTMENT"))); |
|||
listResult.put("DESIGNATION", getNonNullValue(detail.path("DESIGNATION"))); |
|||
listResult.put("EMPLOYEE_NAME", getNonNullValue(detail.path("EMPLOYEE_NAME"))); |
|||
listResult.put("DEPARTMENT", getNonNullValue(detail.path("DEPARTMENT"))); |
|||
list.add(listResult); |
|||
} |
|||
// Sort the list by RETIREMENT_DATE in ascending order |
|||
list.sort(Comparator.comparing(map -> parseDate(((Map<String, String>) map).get("RETIREMENT_DATE")))); |
|||
response.put("list", list); |
|||
|
|||
} else { |
|||
response.put("list", Collections.emptyList()); |
|||
} |
|||
} else { |
|||
System.err.println("Invalid JSON Response: " + rawResponse); |
|||
response.put("list", Collections.emptyList()); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
response.put("list", Collections.emptyList()); |
|||
} |
|||
return response; |
|||
} |
|||
|
|||
|
|||
// Utility method to convert DD-MM-YYYY to YYYY-MM-DD |
|||
private String formatToISODate(String date) { |
|||
if (date == null || date.isEmpty()) { |
|||
return ""; |
|||
} |
|||
try { |
|||
SimpleDateFormat inputFormat = new SimpleDateFormat("dd-MM-yyyy"); |
|||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|||
Date parsedDate = inputFormat.parse(date); |
|||
return outputFormat.format(parsedDate); |
|||
} catch (ParseException e) { |
|||
System.err.println("Date parsing error: " + e.getMessage()); |
|||
return date; // Return original date if parsing fails |
|||
} |
|||
} |
|||
|
|||
|
|||
//getting deptId from login |
|||
public Integer getloginuserDeptId(int userId) { |
|||
String query = "select emp_dept_id from login_details where gcc_login_id = ?"; |
|||
try { |
|||
// Use queryForObject to return a single value |
|||
return jdbcTemplate.queryForObject(query, Integer.class, userId); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
// Log the issue and handle the case when no result is found |
|||
System.out.println("No department found for user ID: " + userId); |
|||
return null; // Or return a default value if required |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
private LocalDate parseDate(String date) { |
|||
if (date == null || date.isEmpty()) { |
|||
return LocalDate.MIN; // Use a minimum value for invalid or empty dates |
|||
} |
|||
try { |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); // Adjust format as needed |
|||
return LocalDate.parse(date, formatter); |
|||
} catch (DateTimeParseException e) { |
|||
e.printStackTrace(); |
|||
return LocalDate.MIN; // Fallback for invalid dates |
|||
} |
|||
} |
|||
|
|||
|
|||
private boolean isValidJson(String json) { |
|||
try { |
|||
objectMapper.readTree(json); |
|||
return true; |
|||
} catch (Exception e) { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
private String getNonNullValue(JsonNode node) { |
|||
//String value = node.isMissingNode() || node.isNull() || node.asText().isEmpty() ? "N/A" : node.asText(); |
|||
String value = node.isMissingNode() || node.isNull() || node.asText().isEmpty() || node.asText().isBlank() ? "N/A" : node.asText(); |
|||
//2024-565EAT |
|||
return "null".equals(value) ? "N/A" : value; // Check for string "null" |
|||
} |
|||
|
|||
public String getDeptNameById(Integer deptId) { |
|||
String query = "SELECT dept_name FROM department_master WHERE dept_id=? AND isactive=1 AND isdelete=0"; |
|||
|
|||
try { |
|||
// Query execution and returning the department name |
|||
return jdbcTemplate.queryForObject(query, new Object[]{deptId}, String.class); |
|||
} catch (Exception e) { |
|||
// Handle exception if deptId is not found or query fails |
|||
e.printStackTrace(); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
@Transactional |
|||
public boolean saveRetirementEmployeeDetails(Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
String empNo = (String) requestData.get("empNo"); |
|||
String empName = (String) requestData.get("empName"); |
|||
String deptName = (String) requestData.get("deptName"); |
|||
String designation = (String) requestData.get("designation"); |
|||
String typeOfRetirement = (String) requestData.get("typeOfRetirement"); |
|||
String retirementdate = (String) requestData.get("retirementdate"); |
|||
String retirementclass = (String) requestData.get("retirementclass"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
String file_category = (String) requestData.get("filecategory"); |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
|
|||
int filecategory = Integer.parseInt(file_category); |
|||
// Execute a query to fetch the required String based on filecategory |
|||
String additionalDataQuery = "SELECT file_name FROM file_category_master WHERE id = ?"; |
|||
String fc_name = jdbcTemplate.queryForObject(additionalDataQuery, |
|||
String.class, |
|||
filecategory |
|||
); |
|||
System.out.println("fc_name==="+fc_name); |
|||
|
|||
int filestatus = 1; |
|||
String fileentrytype ="NEW"; |
|||
|
|||
System.out.println("filemovedby====="+filemovedby); |
|||
|
|||
// Generate the variable (PR + current date + current time) |
|||
String currentTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyyHHmmss")); |
|||
String temp_id = "PR" + currentTimestamp; |
|||
|
|||
String query = "INSERT INTO pensioner_details (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,retirement_class,file_moved_date, remarks,file_category,file_status,file_entry_type,dept_id,file_category_name,temp_id) VALUES (?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?)"; |
|||
int rowsInserted = jdbcTemplate.update(query, empNo, empName, deptName, designation, typeOfRetirement,retirementdate ,retirementclass,dateToAudit, remarks,filecategory,filestatus,fileentrytype,deptId,fc_name,temp_id); |
|||
|
|||
String query1 = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,retirement_class,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?)"; |
|||
int rowsInsertedHistory = jdbcTemplate.update(query1, empNo, empName, deptName, designation, typeOfRetirement,retirementdate ,retirementclass,dateToAudit, remarks,filecategory,filestatus,fileentrytype,filemovedby,deptId,fc_name,temp_id); |
|||
|
|||
String query2 = "INSERT INTO file_movement_history (emp_no,file_moved_date,file_status,file_moved_by,remarks,temp_id) VALUES (?, ?, ?, ?, ?,?)"; |
|||
int rowsInsertedFileMovement = jdbcTemplate.update(query2, empNo,dateToAudit,filestatus,filemovedby,remarks,temp_id); |
|||
|
|||
|
|||
return rowsInserted > 0 && rowsInsertedHistory > 0 && rowsInsertedFileMovement > 0; |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getRegisteredEmps(Integer deptId,Integer file_category) { |
|||
String query="select distinct emp_no from pensioner_details where dept_id=?"; |
|||
|
|||
List<Map<String, Object>>emps= jdbcTemplate.queryForList(query,deptId); |
|||
System.out.println("emps===="+emps); |
|||
if(emps.isEmpty()) |
|||
{ |
|||
return Collections.emptyList(); |
|||
} |
|||
else |
|||
{ |
|||
return emps; |
|||
} |
|||
|
|||
} |
|||
|
|||
public Integer getRetirementFileCategoryId() { |
|||
String query = "SELECT id FROM file_category_master WHERE file_name = 'Retirement'"; |
|||
try { |
|||
return jdbcTemplate.queryForObject(query, Integer.class); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
} |
|||
|
|||
public Integer getFamilyPensionFileCategoryId() { |
|||
String query = "SELECT id FROM file_category_master WHERE file_name = 'Family Pension'"; |
|||
try { |
|||
return jdbcTemplate.queryForObject(query, Integer.class); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
} |
|||
|
|||
public Integer getPendencyFileCategoryId() { |
|||
String query = "SELECT id FROM file_category_master WHERE file_name = 'Pendency'"; |
|||
try { |
|||
return jdbcTemplate.queryForObject(query, Integer.class); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
} |
|||
|
|||
public Integer getGISFileCategoryId() { |
|||
String query = "SELECT id FROM file_category_master WHERE file_name = 'GIS'"; |
|||
try { |
|||
return jdbcTemplate.queryForObject(query, Integer.class); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
} |
|||
|
|||
public Integer getPRFileCategoryId() { |
|||
String query = "SELECT id FROM file_category_master WHERE file_name = 'Provisional Retirement'"; |
|||
try { |
|||
return jdbcTemplate.queryForObject(query, Integer.class); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
} |
|||
|
|||
public Integer getCPSFileCategoryId() { |
|||
String query = "SELECT id FROM file_category_master WHERE file_name = 'Contributory Pension Scheme'"; |
|||
try { |
|||
return jdbcTemplate.queryForObject(query, Integer.class); |
|||
} catch (EmptyResultDataAccessException e) { |
|||
return null; // or handle as needed |
|||
} |
|||
} |
|||
|
|||
|
|||
@Transactional |
|||
public boolean saveFamilyPensionDetails(Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Extract data from the request body |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String empName = (String) requestData.get("empName"); |
|||
String deptName = (String) requestData.get("deptName"); |
|||
String designation = (String) requestData.get("designation"); |
|||
String sanctionedgis = (String) requestData.get("sanctionedgis"); |
|||
String serviceDeath =(String) requestData.get("serviceDeath"); |
|||
String deceased =(String) requestData.get("deceased"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
String pendingDuration = (String) requestData.get("pendingDuration"); |
|||
String reasonPending = (("yes".equals(pendingDuration) || "no".equals(pendingDuration)) |
|||
&& requestData.get("reasonPending") != null) ? requestData.get("reasonPending").toString() : null; |
|||
|
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
int deptId = Integer.parseInt(dept_Id); |
|||
|
|||
String file_category = (String) requestData.get("filecategory"); |
|||
int filecategory = Integer.parseInt(file_category); |
|||
|
|||
// Execute a query to fetch the required String based on filecategory |
|||
String additionalDataQuery = "SELECT file_name FROM file_category_master WHERE id = ?"; |
|||
String fc_name = jdbcTemplate.queryForObject(additionalDataQuery, new Object[]{filecategory}, String.class); |
|||
System.out.println("fc_name==="+fc_name); |
|||
|
|||
|
|||
int filestatus = 1; |
|||
String fileentrytype ="NEW"; |
|||
int rowsInserted=0; |
|||
|
|||
// Generate the variable (PR + current date + current time) |
|||
String currentTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyyHHmmss")); |
|||
String temp_id = "PF" + currentTimestamp; |
|||
|
|||
String query = "INSERT INTO pensioner_details (emp_no, emp_name, dept_name, designation, sanctioned_gis_amount,service_death,relationship_deceased,file_moved_date, remarks,dept_id,file_category,file_status,file_entry_type,file_category_name,temp_id,pending_duration,reason_for_pending) VALUES (?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
rowsInserted = jdbcTemplate.update(query, empNo, empName, deptName, designation, sanctionedgis,serviceDeath ,deceased,dateToAudit, remarks,deptId,filecategory,filestatus,fileentrytype,fc_name,temp_id, pendingDuration,reasonPending); |
|||
|
|||
String query1 = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, sanctioned_gis_amount,service_death,relationship_deceased,file_moved_date, remarks,dept_id,file_category,file_status,file_entry_type,file_moved_by,file_category_name,temp_id,pending_duration,reason_for_pending) VALUES (?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)"; |
|||
rowsInserted = jdbcTemplate.update(query1, empNo, empName, deptName, designation, sanctionedgis,serviceDeath ,deceased,dateToAudit, remarks,deptId,filecategory,filestatus,fileentrytype,filemovedby,fc_name,temp_id, pendingDuration,reasonPending); |
|||
|
|||
String query2 = "INSERT INTO file_movement_history (emp_no,file_moved_date,file_status,file_moved_by,remarks,temp_id) VALUES (?, ?, ?, ?, ?,?)"; |
|||
rowsInserted = jdbcTemplate.update(query2, empNo,dateToAudit,filestatus,filemovedby,remarks,temp_id); |
|||
|
|||
|
|||
return rowsInserted > 0; |
|||
|
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
|
|||
|
|||
///gis saving method service |
|||
@Transactional |
|||
public boolean savenewEntryDetailsGis(Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
|
|||
String empNo = (String) requestData.get("empNo"); |
|||
String empName = (String) requestData.get("empName"); |
|||
String deptName = (String) requestData.get("deptName"); |
|||
String designation = (String) requestData.get("designation"); |
|||
String dateToPension = (String) requestData.get("dateToPension"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String serviceDeath =(String) requestData.get("serviceDeath"); |
|||
String deceased =(String) requestData.get("deceased"); |
|||
String gisentry = (String) requestData.get("gisentry"); |
|||
String gisAdvanceamount =(String) requestData.get("gisAdvanceamount"); |
|||
String gisAdvance = (String) requestData.get("gisAdvance"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
int deptId = Integer.parseInt(dept_Id); |
|||
|
|||
String file_category = (String) requestData.get("filecategory"); |
|||
int filecategory = Integer.parseInt(file_category); |
|||
// Execute a query to fetch the required String based on filecategory |
|||
String additionalDataQuery = "SELECT file_name FROM file_category_master WHERE id = ?"; |
|||
String fc_name = jdbcTemplate.queryForObject(additionalDataQuery, new Object[]{filecategory}, String.class); |
|||
System.out.println("fc_name==="+fc_name); |
|||
|
|||
int filestatus = 7; |
|||
String fileentrytype ="NEW"; |
|||
|
|||
System.out.println("filemovedby====="+filemovedby); |
|||
|
|||
// Generate the variable (PR + current date + current time) |
|||
String currentTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyyHHmmss")); |
|||
String temp_id = "PG" + currentTimestamp; |
|||
|
|||
String query = "INSERT INTO pensioner_details (emp_no, emp_name, dept_name, designation,file_moved_date, remarks,service_death,relationship_deceased,gis_entry,gis_advance_amount,gis_advance ,file_category,file_status,file_entry_type,dept_id,file_category_name,temp_id) VALUES (?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
int rowsInserted = jdbcTemplate.update(query, empNo, empName, deptName, designation, dateToPension, remarks,serviceDeath,deceased,gisentry,gisAdvanceamount,gisAdvance,filecategory,filestatus,fileentrytype,deptId,fc_name,temp_id); |
|||
|
|||
String query1 = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,file_moved_date, remarks,service_death,relationship_deceased,gis_entry,gis_advance_amount,gis_advance ,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)"; |
|||
int rowsInsertedHistory = jdbcTemplate.update(query1, empNo, empName, deptName, designation,dateToPension, remarks,serviceDeath,deceased,gisentry,gisAdvanceamount,gisAdvance,filecategory,filestatus,fileentrytype,filemovedby,deptId,fc_name,temp_id); |
|||
|
|||
String query2 = "INSERT INTO file_movement_history (emp_no,file_moved_date,file_status,file_moved_by,remarks,temp_id) VALUES (?, ?, ?, ?, ?,?)"; |
|||
int rowsInsertedFileMovement = jdbcTemplate.update(query2, empNo,dateToPension,filestatus,filemovedby,remarks,temp_id); |
|||
// |
|||
|
|||
return rowsInserted > 0 && rowsInsertedHistory > 0 && rowsInsertedFileMovement > 0; |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
//provisional retirement method service |
|||
@Transactional |
|||
public boolean savenewEntryDetailsProvisionalretirement(Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
String empNo = (String) requestData.get("empNo"); |
|||
String empName = (String) requestData.get("empName"); |
|||
String deptName = (String) requestData.get("deptName"); |
|||
String designation = (String) requestData.get("designation"); |
|||
String typeOfRetirement = (String) requestData.get("typeOfRetirement"); |
|||
|
|||
String ReasonofPension = (String) requestData.get("ReasonofPension"); |
|||
String retirementClass = (String) requestData.get("retirementClass"); |
|||
String retirementDate = (String) requestData.get("retirementDate"); |
|||
String pendingDuration = (String) requestData.get("pendingDuration"); |
|||
String reasonofPending = (String) requestData.get("reasonofPending"); |
|||
String dp = (String) requestData.get("dp"); |
|||
String otherReason = (String) requestData.get("otherReason"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
int deptId = Integer.parseInt(dept_Id); |
|||
|
|||
String file_category = (String) requestData.get("filecategory"); |
|||
int filecategory = Integer.parseInt(file_category); |
|||
// Execute a query to fetch the required String based on filecategory |
|||
String additionalDataQuery = "SELECT file_name FROM file_category_master WHERE id = ?"; |
|||
String fc_name = jdbcTemplate.queryForObject(additionalDataQuery, new Object[]{filecategory}, String.class); |
|||
System.out.println("fc_name==="+fc_name); |
|||
|
|||
int filestatus = 7; |
|||
String fileentrytype ="NEW"; |
|||
|
|||
System.out.println("filemovedby====="+filemovedby); |
|||
|
|||
// Generate the variable (PR + current date + current time) |
|||
String currentTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyyHHmmss")); |
|||
String temp_id = "PPR" + currentTimestamp; |
|||
|
|||
String query = "INSERT INTO pensioner_details (emp_no, emp_name, dept_name, designation,type_of_retirement,retirement_class,retirement_date , reason_for_provisional_pension,file_moved_date, pending_duration,reason_for_pending,dp,remarks,file_category,file_status,file_entry_type,dept_id,file_category_name,others_provisional_pension,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?)"; |
|||
int rowsInserted = jdbcTemplate.update(query, empNo, empName, deptName, designation, typeOfRetirement,retirementClass ,retirementDate , ReasonofPension,dateToAudit,pendingDuration,reasonofPending,dp,remarks,filecategory,filestatus,fileentrytype,deptId,fc_name,otherReason,temp_id); |
|||
|
|||
String query1 = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement,retirement_class, retirement_date,reason_for_provisional_pension ,file_moved_date, remarks,pending_duration,reason_for_pending,dp ,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,others_provisional_pension,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
|||
int rowsInsertedHistory = jdbcTemplate.update(query1, empNo, empName, deptName, designation,typeOfRetirement,retirementClass,retirementDate ,ReasonofPension,dateToAudit,pendingDuration,reasonofPending,dp,remarks,filecategory,filestatus,fileentrytype,filemovedby,deptId,fc_name,otherReason,temp_id); |
|||
|
|||
String query2 = "INSERT INTO file_movement_history (emp_no,file_moved_date,file_status,file_moved_by,remarks,temp_id) VALUES (?, ?, ?, ?, ?,?)"; |
|||
int rowsInsertedFileMovement = jdbcTemplate.update(query2, empNo,dateToAudit,filestatus,filemovedby,remarks,temp_id); |
|||
// |
|||
|
|||
return rowsInserted > 0 && rowsInsertedHistory > 0 && rowsInsertedFileMovement > 0; |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
|
|||
//cps saving method: |
|||
@Transactional |
|||
public boolean savenewEntryDetailspensionscheme(Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
// Safely extract input values from requestData |
|||
String empNo = requestData.get("empNo") != null ? requestData.get("empNo").toString() : null; |
|||
String empName = requestData.get("empName") != null ? requestData.get("empName").toString() : null; |
|||
String deptName = requestData.get("deptName") != null ? requestData.get("deptName").toString() : null; |
|||
String designation = requestData.get("designation") != null ? requestData.get("designation").toString() : null; |
|||
String classes = requestData.get("classes") != null ? requestData.get("classes").toString() : null; |
|||
String fileMovedBy = requestData.get("fileMovedBy") != null ? requestData.get("fileMovedBy").toString() : null; |
|||
String remarks = requestData.get("remarks") != null ? requestData.get("remarks").toString() : null; |
|||
String retirementType = requestData.get("retirementType") != null ? requestData.get("retirementType").toString() : null; |
|||
|
|||
String uac = (String) requestData.get("uac"); |
|||
String uacDate = "yes".equals(uac) && requestData.get("uacDate") != null ? requestData.get("uacDate").toString() : null; |
|||
|
|||
String pendingDuration = (String) requestData.get("pendingDuration"); |
|||
String reasonPending = "yes".equals(pendingDuration) && requestData.get("reasonPending") != null |
|||
? requestData.get("reasonPending").toString() : null; |
|||
|
|||
String cps =(String) requestData.get("cps"); |
|||
String cpsAmount = "yes".equals(cps) && requestData.get("cpsAmount") != null ? requestData.get("cpsAmount").toString() : null; |
|||
|
|||
String elOrLpa = (String)requestData.get("elOrLpa"); |
|||
String elOrLpaAmount = "yes".equals(elOrLpa) && requestData.get("elOrLpaAmount") != null ? requestData.get("elOrLpaAmount").toString() : null; |
|||
|
|||
String spfgs = (String) requestData.get("spfgs"); |
|||
String spfgsAmount = "yes".equals(spfgs) && requestData.get("spfgsAmount") != null ? requestData.get("spfgsAmount").toString() : null; |
|||
|
|||
int deptId = requestData.get("deptId") != null ? Integer.parseInt(requestData.get("deptId").toString()) : 0; |
|||
|
|||
// Default static values |
|||
String file_category = (String) requestData.get("filecategory"); |
|||
int filecategory = Integer.parseInt(file_category); |
|||
int fileStatus = 11; |
|||
String fileEntryType = "FILE_COMPLETED"; |
|||
|
|||
// Fetch file_category_name dynamically |
|||
String fileCategoryQuery = "SELECT file_name FROM file_category_master WHERE id = ?"; |
|||
String fileCategoryName = jdbcTemplate.queryForObject(fileCategoryQuery, new Object[]{filecategory}, String.class); |
|||
|
|||
// Generate the variable (PR + current date + current time) |
|||
String currentTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyyHHmmss")); |
|||
String temp_id = "PC" + currentTimestamp; |
|||
|
|||
// Insert into cps_pensioner_details |
|||
String queryDetails = "INSERT INTO cps_pensioner_details " + |
|||
"(emp_no, emp_name, dept_name, designation, file_category, retirement_class, type_of_retirement, uac, uac_date, " + |
|||
"pending_duration,reason_for_pending ,cps, cps_amount, el_or_lpa, el_or_lpa_amount, spfgs, spfgs_amount, remarks, " + |
|||
"file_status, file_entry_type, dept_id, file_category_name,temp_id) " + |
|||
"VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)"; |
|||
int rowsInsertedDetails = jdbcTemplate.update(queryDetails, |
|||
empNo, empName, deptName, designation, filecategory, classes, retirementType, uac, uacDate, |
|||
pendingDuration,reasonPending ,cps, cpsAmount, elOrLpa, elOrLpaAmount, spfgs, spfgsAmount, remarks, |
|||
fileStatus, fileEntryType, deptId, fileCategoryName,temp_id); |
|||
|
|||
// Insert into cps_pensioner_details_history |
|||
String queryHistory = "INSERT INTO cps_pensioner_details_history " + |
|||
"(emp_no, emp_name, dept_name, designation, file_category, retirement_class, type_of_retirement, uac, uac_date, " + |
|||
"pending_duration,reason_for_pending ,cps, cps_amount, el_or_lpa, el_or_lpa_amount, spfgs, spfgs_amount, remarks, " + |
|||
"file_status, file_entry_type, file_moved_by, dept_id, file_category_name,temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
int rowsInsertedHistory = jdbcTemplate.update(queryHistory, |
|||
empNo, empName, deptName, designation, filecategory, classes, retirementType, uac, uacDate, |
|||
pendingDuration, reasonPending,cps, cpsAmount, elOrLpa, elOrLpaAmount, spfgs, spfgsAmount, remarks, |
|||
fileStatus, fileEntryType, fileMovedBy, deptId, fileCategoryName,temp_id); |
|||
|
|||
// Current date and time |
|||
LocalDateTime fileMovedDate = LocalDateTime.now(); |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|||
String formattedFileMovedDate = fileMovedDate.format(formatter); |
|||
|
|||
// Insert into file_movement_history |
|||
String queryFileMovement = "INSERT INTO file_movement_history (emp_no, file_status,file_moved_date, file_moved_by, remarks,temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?,?)"; |
|||
int rowsInsertedFileMovement = jdbcTemplate.update(queryFileMovement, empNo, fileStatus, formattedFileMovedDate, fileMovedBy, remarks,temp_id); |
|||
|
|||
// Return true if all inserts were successful |
|||
return rowsInsertedDetails > 0 && rowsInsertedHistory > 0 && rowsInsertedFileMovement > 0; |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
|
|||
|
|||
//pendency saving method |
|||
@Transactional |
|||
public boolean savePendencyDetails(Map<String, Object> requestData) { |
|||
try { |
|||
|
|||
String empNo = (String) requestData.get("empNo"); |
|||
String empName = (String) requestData.get("empName"); |
|||
String deptName = (String) requestData.get("deptName"); |
|||
String designation = (String) requestData.get("designation"); |
|||
String retirementclass = (String) requestData.get("retirementclass"); |
|||
String typeOfRetirement = (String) requestData.get("typeOfRetirement"); |
|||
String retirementDate = (String) requestData.get("retirementDate"); |
|||
//String pendencyCategory=(String)requestData.get("pendencyCategory"); |
|||
String pendencyCategory="Retirement"; |
|||
|
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
|
|||
String pendingDuration = (String) requestData.get("pendingDuration"); |
|||
|
|||
String reasonPending =requestData.get("reasonPending") != null ? requestData.get("reasonPending").toString() : null; |
|||
|
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
System.out.println("dept_Id = "+dept_Id); |
|||
int deptId = Integer.parseInt(dept_Id); |
|||
|
|||
String file_category = (String) requestData.get("filecategory"); |
|||
int filecategory = Integer.parseInt(file_category); |
|||
int filestatus = 1; |
|||
String fileentrytype ="NEW"; |
|||
int rowsInserted = 0; |
|||
|
|||
// Generate the variable (PR + current date + current time) |
|||
String currentTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyyHHmmss")); |
|||
String temp_id = "PP" + currentTimestamp; |
|||
|
|||
|
|||
String query = "INSERT INTO pensioner_details (emp_no, emp_name, dept_name, designation, retirement_class,retirement_date,pending_duration,reason_for_pending,file_moved_date,dept_id,remarks,file_category,file_status,file_entry_type,file_category_name,type_of_retirement,temp_id) VALUES (?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
rowsInserted = jdbcTemplate.update(query, empNo, empName, deptName, designation, retirementclass,retirementDate,pendingDuration,reasonPending,dateToAudit, deptId,remarks,filecategory,filestatus,fileentrytype,pendencyCategory,typeOfRetirement,temp_id); |
|||
|
|||
String query1 = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, retirement_class,retirement_date,pending_duration,reason_for_pending,file_moved_date,dept_id,remarks,file_category,file_status,file_entry_type,file_category_name,type_of_retirement,file_moved_by,temp_id) VALUES (?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)"; |
|||
rowsInserted = jdbcTemplate.update(query1, empNo, empName, deptName, designation, retirementclass,retirementDate,pendingDuration,reasonPending,dateToAudit, deptId,remarks,filecategory,filestatus,fileentrytype,pendencyCategory,typeOfRetirement,filemovedby,temp_id); |
|||
|
|||
String query2 = "INSERT INTO file_movement_history (emp_no,file_moved_date,file_status,file_moved_by,remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
rowsInserted = jdbcTemplate.update(query2, empNo,dateToAudit,filestatus,filemovedby,remarks,temp_id); |
|||
|
|||
|
|||
return rowsInserted > 0; |
|||
|
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false if an exception occurs |
|||
} |
|||
} |
|||
|
|||
public boolean doesEmployeeExistRPR(String empCode) { |
|||
String sql = "SELECT COUNT(*) FROM ( " + |
|||
" SELECT emp_no FROM pensioner_details WHERE emp_no = ? AND file_category IN (1,2,3,4,5,6) " + |
|||
" UNION ALL " + |
|||
" SELECT emp_no FROM cps_pensioner_details WHERE emp_no = ? AND file_category IN (6) " + |
|||
") AS combined"; |
|||
// Note: Pass empCode twice since there are two placeholders. |
|||
Integer count = jdbcTemplate.queryForObject(sql, new Object[]{empCode, empCode}, Integer.class); |
|||
return count != null && count > 0; |
|||
} |
|||
|
|||
|
|||
public boolean doesEmployeeExist(String empCode) { |
|||
|
|||
String sql = "SELECT COUNT(*) FROM ( " + |
|||
" SELECT emp_no FROM pensioner_details WHERE emp_no = ? AND file_category IN (1,3,5) "+ |
|||
" UNION ALL " + |
|||
" SELECT emp_no FROM cps_pensioner_details WHERE emp_no = ? AND file_category IN (6) " + |
|||
") AS combined"; |
|||
// Note: Pass empCode twice since there are two placeholders. |
|||
Integer count = jdbcTemplate.queryForObject(sql, new Object[]{empCode, empCode},Integer.class); |
|||
System.out.println("count<<<<<<<<<<<"+count); |
|||
return count != null && count > 0; |
|||
} |
|||
|
|||
|
|||
public boolean doesEmployeeExistgis(String empCode) { |
|||
String sql = "SELECT COUNT(*) FROM ( " + |
|||
" SELECT emp_no FROM pensioner_details WHERE emp_no = ? AND file_category IN (1,2,3,5,6) " + |
|||
" UNION ALL " + |
|||
" SELECT emp_no FROM cps_pensioner_details WHERE emp_no = ? AND file_category IN (6) " + |
|||
") AS combined"; |
|||
// Note: Pass empCode twice since there are two placeholders. |
|||
Integer count = jdbcTemplate.queryForObject(sql, new Object[]{empCode, empCode}, Integer.class); |
|||
return count != null && count > 0; |
|||
} |
|||
|
|||
|
|||
public boolean doesEmployeeExistfp(String empCode) { |
|||
|
|||
String sql = "SELECT COUNT(*) FROM ( " + |
|||
|
|||
" SELECT emp_no FROM pensioner_details WHERE emp_no = ? AND file_category IN (1,2,3,5) AND is_closed IN (0)" + |
|||
" UNION ALL " + |
|||
|
|||
" SELECT emp_no FROM cps_pensioner_details WHERE emp_no = ? AND file_category IN (6) " + |
|||
") AS combined"; |
|||
|
|||
// Note: Pass empCode twice since there are two placeholders. |
|||
Integer count = jdbcTemplate.queryForObject(sql, new Object[]{empCode, empCode}, Integer.class); |
|||
return count != null && count > 0; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,264 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.Period; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.time.temporal.ChronoUnit; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
@Transactional |
|||
public class PendencyAutoConversionService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
private AppConfig appConfig; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
/** |
|||
* Main method to process auto-conversion logic. |
|||
* - Fetch records where retirement date has crossed. |
|||
* - Update pensioner details. |
|||
* - Fetch employee details. |
|||
* - Save data into pensioner_details_history and file_movement_history. |
|||
*/ |
|||
@Transactional |
|||
public boolean processAutoConversion() { |
|||
try { |
|||
// Step 1: Fetch temp IDs that need processing |
|||
List<Map<String, Object>> tempList = getConvertingTempIds(); |
|||
if (tempList.isEmpty()) { |
|||
System.out.println("No records found for auto-conversion."); |
|||
return false; |
|||
} |
|||
|
|||
for (Map<String, Object> tempIdMap : tempList) { |
|||
String tempId = tempIdMap.get("temp_id") != null ? String.valueOf(tempIdMap.get("temp_id")) : null; |
|||
if (tempId == null || tempId.trim().isEmpty()) { |
|||
System.out.println("Skipping null/empty temp_id."); |
|||
continue; |
|||
} |
|||
|
|||
System.out.println("Processing tempId: " + tempId); |
|||
|
|||
// Step 2: Get file_moved_by value |
|||
String fileMovedBy = getFileMovedByTempId(tempId); |
|||
if (fileMovedBy == null) { |
|||
System.out.println("Skipping tempId " + tempId + " as fileMovedBy is NULL."); |
|||
continue; |
|||
} |
|||
|
|||
// Step 3: Update pensioner_details table |
|||
boolean updated = updateEntryDetails(tempId); |
|||
if (!updated) { |
|||
System.out.println("Failed to update pensioner_details for tempId: " + tempId); |
|||
continue; |
|||
} |
|||
|
|||
// Step 4: Fetch employee details |
|||
List<Map<String, Object>> empDetails = fetchEmployeeDetails(tempId); |
|||
if (empDetails.isEmpty()) { |
|||
System.out.println("No employee details found for tempId: " + tempId); |
|||
continue; |
|||
} |
|||
|
|||
// Step 5: Save history data |
|||
boolean historySaved = saveHistory(empDetails, fileMovedBy); |
|||
if (!historySaved) { |
|||
System.out.println("Failed to save history for tempId: " + tempId); |
|||
} |
|||
} |
|||
|
|||
System.out.println("Auto-conversion process completed."); |
|||
return true; |
|||
} catch (Exception e) { |
|||
System.err.println("Exception in processAutoConversion: " + e.getMessage()); |
|||
e.printStackTrace(); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public List<Map<String, Object>> getConvertingTempIds() { |
|||
String sql = "SELECT temp_id FROM pensioner_details WHERE file_category=1 AND file_status <=8 AND retirement_date <= CURDATE() - 1"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
private boolean updateEntryDetails(String tempId) { |
|||
try { |
|||
LocalDate datefield = LocalDate.now(); |
|||
String formattedDate = datefield.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
|||
String remarks = "Auto_Conversion"; |
|||
int fileCategory = 3; |
|||
String pendingDuration = "yes"; |
|||
String reasonForPending = "Retirement Date Crossed while file in Auditing"; |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET reason_for_pending=?, pending_duration=?, file_category=?, file_moved_date=?, remarks=?, updated_date=CURRENT_TIMESTAMP WHERE temp_id=?"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery, reasonForPending, pendingDuration, fileCategory, formattedDate, remarks, tempId); |
|||
|
|||
System.out.println("Updated pensioner_details for tempId: " + tempId + " - Rows affected: " + rowsUpdated); |
|||
return rowsUpdated > 0; |
|||
} catch (Exception e) { |
|||
System.err.println("Exception in updateEntryDetails: " + e.getMessage()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
private List<Map<String, Object>> fetchEmployeeDetails(String tempId) { |
|||
String sql = "SELECT * FROM pensioner_details WHERE temp_id=?"; |
|||
return jdbcTemplate.queryForList(sql, tempId); |
|||
} |
|||
|
|||
|
|||
@Transactional |
|||
private boolean saveHistory(List<Map<String, Object>> empDetails, String fileMovedBy) { |
|||
try { |
|||
String empInsertQuery = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id, pending_duration, reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy != null ? fileMovedBy : ""); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration") != null ? emp.get("pending_duration").toString() : null); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks, temp_id) VALUES (?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(historyQuery, empDetails, empDetails.size(), (ps, his) -> { |
|||
ps.setString(1, his.get("emp_no").toString()); |
|||
ps.setString(2, his.get("file_moved_date").toString()); |
|||
ps.setString(3, his.get("file_status").toString()); |
|||
ps.setString(4, fileMovedBy != null ? fileMovedBy : ""); |
|||
ps.setString(5, his.get("remarks").toString()); |
|||
ps.setString(6, his.get("temp_id").toString()); |
|||
}); |
|||
|
|||
System.out.println("Successfully saved history for " + empDetails.size() + " records."); |
|||
return true; |
|||
} catch (Exception e) { |
|||
System.err.println("Exception in saveHistory: " + e.getMessage()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
private String getFileMovedByTempId(String tempId) { |
|||
String sql = "SELECT file_moved_by FROM pensioner_details_history WHERE temp_id=? ORDER BY created_date ASC LIMIT 1"; |
|||
return jdbcTemplate.queryForObject(sql, String.class, tempId); |
|||
} |
|||
|
|||
|
|||
public boolean processAutoConversionForTempId(String tempId) { |
|||
try { |
|||
System.out.println("Running auto-conversion for tempId: " + tempId); |
|||
|
|||
// Step 1: Get fileMovedBy |
|||
String fileMovedBy = getFileMovedByTempId(tempId); |
|||
if (fileMovedBy == null) { |
|||
System.out.println("Skipping tempId " + tempId + " as fileMovedBy is NULL."); |
|||
return false; |
|||
} |
|||
|
|||
// Step 2: Update pensioner details |
|||
boolean updated = updateEntryDetails(tempId); |
|||
if (!updated) { |
|||
System.out.println("Failed to update pensioner_details for tempId: " + tempId); |
|||
return false; |
|||
} |
|||
|
|||
// Step 3: Fetch employee details |
|||
List<Map<String, Object>> empDetails = fetchEmployeeDetails(tempId); |
|||
if (empDetails.isEmpty()) { |
|||
System.out.println("No employee details found for tempId: " + tempId); |
|||
return false; |
|||
} |
|||
|
|||
// Step 4: Save history |
|||
boolean historySaved = saveHistory(empDetails, fileMovedBy); |
|||
if (!historySaved) { |
|||
System.out.println("Failed to save history for tempId: " + tempId); |
|||
return false; |
|||
} |
|||
|
|||
System.out.println("Successfully processed tempId: " + tempId); |
|||
return true; |
|||
} catch (Exception e) { |
|||
System.err.println("Error processing tempId: " + tempId + " - " + e.getMessage()); |
|||
e.printStackTrace(); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public List<Map<String, Object>> getPendencyUpdatingDuration(){ |
|||
|
|||
String sqlQuery = "SELECT * FROM pensioner_details WHERE file_category IN (2,3) AND pending_duration='yes' AND file_status < 11"; |
|||
List<Map<String, Object>> details = jdbcTemplate.queryForList(sqlQuery); |
|||
|
|||
return details; |
|||
|
|||
} |
|||
|
|||
public String calculatePendingDuration(LocalDate startDate, LocalDate endDate) { |
|||
Period period = Period.between(startDate, endDate); |
|||
|
|||
int years = period.getYears(); |
|||
int months = period.getMonths(); |
|||
int days = period.getDays(); |
|||
|
|||
if (years == 0 && months == 0 && days == 0) { |
|||
return "0 days"; // or "Same day" |
|||
} |
|||
|
|||
return (years > 0 ? years + " year " : "") + |
|||
(months > 0 ? months + " month " : "") + |
|||
(days > 0 ? days + " day" : ""); |
|||
} |
|||
|
|||
public boolean updatePendingDuration(String updateDuration, String tempId) { |
|||
String sqlQuery = "UPDATE pensioner_details SET reason_for_pending=? WHERE temp_id=?"; |
|||
int rowsUpdated = jdbcTemplate.update(sqlQuery, updateDuration, tempId); |
|||
System.out.println("Temp ID: " + tempId + " | Rows Updated: " + rowsUpdated); |
|||
return rowsUpdated > 0; |
|||
} |
|||
|
|||
// New method to get the count of pending pensioners |
|||
public int getPendingPensionersCount() { |
|||
String sqlQuery = "SELECT COUNT(*) FROM pensioner_details WHERE file_category=3 AND pending_duration='yes' AND file_status < 11"; |
|||
Integer count = jdbcTemplate.queryForObject(sqlQuery, Integer.class); |
|||
return count != null ? count : 0; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,228 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
@Transactional |
|||
public class PensionAuditService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public PensionAuditService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchDetailsForAudit(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND (file_status=1 OR file_status=3) AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
public boolean updateEntryDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 4; |
|||
|
|||
String file_entry_type="AUDIT_CLEARED"; |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?,file_entry_type=?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,file_entry_type,dateToAudit, remarks,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
public boolean savehistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String retirement_date = emp.get("retirement_date").toString(); |
|||
String retirement_class = emp.get("retirement_class").toString(); |
|||
String type_of_retirement = emp.get("type_of_retirement").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,retirement_class,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,type_of_retirement,retirement_date,retirement_class,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
//gis |
|||
public List<Map<String, Object>> fetchDetailsForrecivedGis(Integer file_cat) { |
|||
String query = "SELECT * FROM pensioner_details WHERE file_category = ? AND file_status = 7"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
public boolean saveFamilyPensionHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
String serviceDeath = emp.get("service_death").toString(); |
|||
String relationshipDeceased = emp.get("relationship_deceased").toString(); |
|||
String sanctionedGis = emp.get("sanctioned_gis_amount").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death,relationship_deceased ,sanctioned_gis_amount,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,serviceDeath,relationshipDeceased,sanctionedGis,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public boolean savePendencyHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String retirementClass = emp.get("retirement_class").toString(); |
|||
String retirementDate=emp.get("retirement_date").toString(); |
|||
|
|||
//String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
|
|||
String typeOfCategory=emp.get("file_category_name").toString(); |
|||
String typeOfRetirement=emp.get("type_of_retirement").toString(); |
|||
|
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,retirement_class,retirement_date,file_category_name,type_of_retirement,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,retirementClass,retirementDate, typeOfCategory,typeOfRetirement,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,326 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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.dao.DataAccessException; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
@Transactional |
|||
public class PensionPartiallyCompService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public PensionPartiallyCompService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchPensionPartialEmpfiles(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_status=10 AND file_category=? AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
public boolean updateEntryCompletedDetails(Map<String, Object> requestData) { |
|||
try { |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
|
|||
String gpf = (String) requestData.get("gpf"); |
|||
String private_affairs = (String) requestData.get("private_affairs"); |
|||
String spfgs = (String) requestData.get("spfgs"); |
|||
String recovery_emp = requestData.get("recovery_emp") != null ? requestData.get("recovery_emp").toString() : null; |
|||
String dcrg = (String) requestData.get("dcrg"); |
|||
|
|||
String gpfAmount = requestData.get("gpfAmount") != null ? requestData.get("gpfAmount").toString() : null; |
|||
String private_affairs_amount = requestData.get("private_affairs_amount") != null ? requestData.get("private_affairs_amount").toString() : null; |
|||
String spfgs_amount = requestData.get("spfgs_amount") != null ? requestData.get("spfgs_amount").toString() : null; |
|||
|
|||
|
|||
String pension_number = (String) requestData.get("pension_number"); |
|||
String ledger_number = (String) requestData.get("ledger_number"); |
|||
String benefit_pension = (String) requestData.get("benefit_pension"); |
|||
String benefit_dcrg = (String) requestData.get("benefit_dcrg"); |
|||
String benefit_commutation = (String) requestData.get("benefit_commutation"); |
|||
|
|||
String benefit_pension_amount = requestData.get("benefit_pension_amount")!= null ? requestData.get("benefit_pension_amount").toString() : null; |
|||
String benefit_dcrg_amount = requestData.get("benefit_dcrg_amount") != null ? requestData.get("benefit_dcrg_amount").toString() : null; |
|||
String benefit_commutation_amount = requestData.get("benefit_commutation_amount") != null ? requestData.get("benefit_commutation_amount").toString() : null; |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus; |
|||
String file_entry_type=""; |
|||
|
|||
|
|||
|
|||
// String updateQuery1 = "UPDATE zone_benefits SET gpf = ?, gpf_amount = ?, spfgs = ?, spfgs_amount = ?, dcrg = ?, private_affairs = ?, private_affairs_amount = ?, recovery_emp = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
// int rowsUpdated3 = jdbcTemplate.update(updateQuery1, gpf, gpfAmount, spfgs, spfgs_amount, dcrg, private_affairs, private_affairs_amount, recovery_emp, tempId); |
|||
// System.out.println("Rows updated in zb: " + rowsUpdated3); |
|||
|
|||
|
|||
|
|||
String updateQuery2 = "UPDATE pension_benefits SET pension_number = ?, ledger_number = ?, benefit_pension = ?, benefit_pension_amount = ?, benefit_dcrg = ?, benefit_dcrg_amount = ?, benefit_commutation = ?, benefit_commutation_amount = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
int rowsUpdated2 = jdbcTemplate.update(updateQuery2, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount, tempId); |
|||
System.out.println("Rows updated in pb: " + rowsUpdated2); |
|||
|
|||
filestatus = CheckFieldsforPension(tempId) ? 11 : 10; |
|||
System.out.println("filestatus inside service="+filestatus); |
|||
|
|||
if(filestatus==11) |
|||
{ |
|||
file_entry_type="FILE_COMPLETED"; |
|||
} |
|||
if(filestatus==10) { |
|||
file_entry_type="PENSION_PARTIAL"; |
|||
} |
|||
|
|||
if (rowsUpdated2 > 0) { |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_entry_type=?,file_status = ?, file_moved_date = ?, remarks = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,file_entry_type, filestatus, dateToAudit, remarks, tempId); |
|||
System.out.println("Rows updated in fpd: " + rowsUpdated); |
|||
|
|||
if (rowsUpdated > 0) { |
|||
|
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks, temp_id) VALUES (?, ?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1 = jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks, tempId); |
|||
System.out.println("Rows updated in fmh: " + rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
return false; |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Error parsing department ID: " + e.getMessage()); |
|||
return false; |
|||
} catch (DataAccessException e) { |
|||
System.err.println("Database operation failed: " + e.getMessage()); |
|||
return false; |
|||
} catch (Exception e) { |
|||
System.err.println("Unexpected error: " + e.getMessage()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
public boolean saveHistory(List<Map<String, Object>> empDetails, List<Map<String, Object>> zoneBenefits, List<Map<String, Object>> pension_details, String fileMovedBy) { |
|||
try { |
|||
int file_Cat=0; |
|||
|
|||
if (!empDetails.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = empDetails.get(0); |
|||
Object fileCatObj = firstEmployeeDetails.get("file_category"); |
|||
|
|||
if (fileCatObj != null) { |
|||
try { |
|||
file_Cat = Integer.parseInt(fileCatObj.toString()); |
|||
System.out.println("Parsed file_category: " + file_Cat); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_category: " + fileCatObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_category is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
// Batch update for employee details |
|||
if(file_Cat==1) { |
|||
String empInsertQuery = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
}); |
|||
} |
|||
|
|||
if(file_Cat==2) |
|||
{ |
|||
String empInsertQuery1 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death, " + |
|||
"relationship_deceased, sanctioned_gis_amount, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery1, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("service_death").toString()); |
|||
ps.setString(6, emp.get("relationship_deceased").toString()); |
|||
ps.setString(7, emp.get("sanctioned_gis_amount").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration").toString()); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for family Pension"); |
|||
} |
|||
|
|||
if(file_Cat==3) |
|||
{ |
|||
String empInsertQuery2 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement, " + |
|||
"file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending,retirement_class,retirement_date) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery2, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("file_moved_date").toString()); |
|||
ps.setString(7, emp.get("remarks").toString()); |
|||
ps.setInt(8, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(9, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(10, emp.get("file_entry_type").toString()); |
|||
ps.setString(11, fileMovedBy); |
|||
ps.setInt(12, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(13, emp.get("file_category_name").toString()); |
|||
ps.setString(14, emp.get("temp_id").toString()); |
|||
ps.setString(15, emp.get("pending_duration").toString()); |
|||
ps.setString(16, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
ps.setString(17, emp.get("retirement_class").toString()); |
|||
ps.setString(18, emp.get("retirement_date").toString()); |
|||
|
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for pendency"); |
|||
} |
|||
|
|||
// Batch update for zone benefits |
|||
// String zoneInsertQuery = |
|||
// "INSERT INTO zone_benefits_history (emp_no, temp_id, gpf, gpf_amount, spfgs, spfgs_amount, dcrg, " + |
|||
// "private_affairs, private_affairs_amount, recovery_emp, file_moved_by) " + |
|||
// "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
// |
|||
// jdbcTemplate.batchUpdate(zoneInsertQuery, zoneBenefits, zoneBenefits.size(), (ps, zone) -> { |
|||
// ps.setString(1, zone.get("emp_no").toString()); |
|||
// ps.setString(2, zone.get("temp_id").toString()); |
|||
// ps.setString(3, zone.get("gpf").toString()); |
|||
// ps.setString(4, zone.get("gpf_amount") != null ? zone.get("gpf_amount").toString() : null); |
|||
// ps.setString(5, zone.get("spfgs").toString()); |
|||
// ps.setString(6, zone.get("spfgs_amount") != null ? zone.get("spfgs_amount").toString() : null); |
|||
// ps.setString(7, zone.get("dcrg").toString()); |
|||
// ps.setString(8, zone.get("private_affairs").toString()); |
|||
// ps.setString(9, zone.get("private_affairs_amount") != null ? zone.get("private_affairs_amount").toString() : null); |
|||
// ps.setString(10, zone.get("recovery_emp") != null ? zone.get("recovery_emp").toString() : null); |
|||
// ps.setString(11, fileMovedBy); |
|||
// }); |
|||
|
|||
// Batch update for pension benefits |
|||
String pensionInsertQuery = |
|||
"INSERT INTO pension_benefits_history (emp_no,temp_id,file_pending,pension_number,ledger_number,benefit_pension,benefit_pension_amount,benefit_dcrg,benefit_dcrg_amount,benefit_commutation,benefit_commutation_amount,file_moved_by) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(pensionInsertQuery, pension_details, pension_details.size(), (ps, pension) -> { |
|||
ps.setString(1, pension.get("emp_no").toString()); |
|||
ps.setString(2, pension.get("temp_id").toString()); |
|||
ps.setString(3, pension.get("file_pending").toString()); |
|||
ps.setString(4, pension.get("pension_number").toString()); |
|||
ps.setString(5, pension.get("ledger_number").toString()); |
|||
ps.setString(6, pension.get("benefit_pension").toString()); |
|||
ps.setString(7, pension.get("benefit_pension_amount") != null ? pension.get("benefit_pension_amount").toString() : null); |
|||
ps.setString(8, pension.get("benefit_dcrg").toString()); |
|||
ps.setString(9, pension.get("benefit_dcrg_amount") != null ? pension.get("benefit_dcrg_amount").toString() : null); |
|||
ps.setString(10, pension.get("benefit_commutation").toString()); |
|||
ps.setString(11, pension.get("benefit_commutation_amount") != null ? pension.get("benefit_commutation_amount").toString() : null); |
|||
ps.setString(12, fileMovedBy); |
|||
|
|||
}); |
|||
|
|||
return true; // All insertions succeeded |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
private boolean CheckFieldsforPension(String tempId) { |
|||
|
|||
// Define the SQL query |
|||
String sql = "SELECT " + |
|||
"CASE " + |
|||
"WHEN pb.benefit_pension = 'yes' AND pb.benefit_dcrg = 'yes' AND pb.benefit_commutation = 'yes' " + |
|||
"THEN 1 ELSE 0 " + |
|||
"END AS allYes " + |
|||
"FROM pension_benefits AS pb " + |
|||
"WHERE pb.temp_id = ? "; |
|||
|
|||
|
|||
try { |
|||
// Use queryForObject to get a single boolean result |
|||
Boolean result = jdbcTemplate.queryForObject(sql, Boolean.class, tempId); |
|||
|
|||
return result != null && result; // Return the result if not null |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); // Log the exception if needed |
|||
} |
|||
|
|||
return false; // Return false if an exception occurs |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,377 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
@Transactional |
|||
public class PensionReceivedService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public PensionReceivedService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchReceivedDepartmentEmpfiles(Integer deptId,Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE dept_id=? AND file_category=? AND (file_status=5 OR file_status=6) AND is_closed=0"; |
|||
|
|||
return jdbcTemplate.queryForList(query,deptId,file_cat); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchZonebenefitsById(String tempId) { |
|||
String query = "SELECT * " + |
|||
"FROM zone_benefits " + |
|||
"WHERE temp_id=?"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,tempId); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchPensionbenefitsById(String tempId) { |
|||
String query = "SELECT * " + |
|||
"FROM pension_benefits " + |
|||
"WHERE temp_id=?"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,tempId); |
|||
} |
|||
|
|||
public boolean updateEntryDetails(Map<String, Object> requestData) { |
|||
try { |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
|
|||
String dateToAudit = (String) requestData.get("file_moved_date"); |
|||
String filemovedby = (String) requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
int deptId = (dept_Id != null && !dept_Id.isEmpty()) ? Integer.parseInt(dept_Id) : 0; |
|||
int filestatus = 7; |
|||
|
|||
String gpf = (String) requestData.get("gpf"); |
|||
String private_affairs = (String) requestData.get("private_affairs"); |
|||
String spfgs = (String) requestData.get("spfgs"); |
|||
String recovery_emp = (String) requestData.get("recovery_emp"); |
|||
String dcrg = (String) requestData.get("dcrg"); |
|||
|
|||
String gpfAmount = requestData.get("gpfAmount") != null ? requestData.get("gpfAmount").toString() : null; |
|||
String private_affairs_amount = requestData.get("private_affairs_amount") != null ? requestData.get("private_affairs_amount").toString() : null; |
|||
String spfgs_amount = requestData.get("spfgs_amount") != null ? requestData.get("spfgs_amount").toString() : null; |
|||
|
|||
boolean check = checkTempIdInZoneBenefits(tempId); |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?, file_moved_date = ?, remarks = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery, filestatus, dateToAudit, remarks, tempId); |
|||
System.out.println("Rows updated in pensioner_details: " + rowsUpdated); |
|||
|
|||
if (rowsUpdated > 0) { |
|||
// Insert into file movement history |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks, temp_id) VALUES (?, ?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1 = jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks, tempId); |
|||
System.out.println("Rows inserted in file_movement_history: " + rowsUpdated1); |
|||
|
|||
if (rowsUpdated1 > 0) { |
|||
if (check) { |
|||
// Update zone benefits |
|||
String updateQuery1 = "UPDATE zone_benefits SET gpf = ?, gpf_amount = ?, spfgs = ?, spfgs_amount = ?, dcrg = ?, private_affairs = ?, private_affairs_amount = ?, recovery_emp = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?"; |
|||
int rowsUpdated3 = jdbcTemplate.update(updateQuery1, gpf, gpfAmount, spfgs, spfgs_amount, dcrg, private_affairs, private_affairs_amount, recovery_emp, tempId); |
|||
System.out.println("Rows updated in zone_benefits: " + rowsUpdated3); |
|||
} else { |
|||
// Insert into zone benefits |
|||
String benefitQuery = "INSERT INTO zone_benefits (emp_no, temp_id, gpf, gpf_amount, spfgs, spfgs_amount, dcrg, private_affairs, private_affairs_amount, recovery_emp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
int rowsUpdated2 = jdbcTemplate.update(benefitQuery, empNo, tempId, gpf, gpfAmount, spfgs, spfgs_amount, dcrg, private_affairs, private_affairs_amount, recovery_emp); |
|||
System.out.println("Rows inserted in zone_benefits: " + rowsUpdated2); |
|||
} |
|||
return true; |
|||
} else { |
|||
System.out.println("Failed to insert into file_movement_history"); |
|||
return false; |
|||
} |
|||
} else { |
|||
System.out.println("Failed to update pensioner_details"); |
|||
return false; |
|||
} |
|||
} catch (Exception e) { |
|||
System.err.println("Exception in updateEntryDetails: " + e.getMessage()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
public boolean saveHistory(List<Map<String, Object>> empDetails, List<Map<String, Object>> zoneBenefits, String fileMovedBy) { |
|||
try { |
|||
// Batch update for employee details |
|||
int file_Cat=0; |
|||
|
|||
if (!empDetails.isEmpty()) { |
|||
Map<String, Object> firstEmployeeDetails = empDetails.get(0); |
|||
Object fileCatObj = firstEmployeeDetails.get("file_category"); |
|||
|
|||
if (fileCatObj != null) { |
|||
try { |
|||
file_Cat = Integer.parseInt(fileCatObj.toString()); |
|||
System.out.println("Parsed file_category: " + file_Cat); |
|||
} catch (NumberFormatException e) { |
|||
System.err.println("Failed to parse file_category: " + fileCatObj); |
|||
} |
|||
} else { |
|||
System.out.println("file_category is null in emp_details."); |
|||
} |
|||
} else { |
|||
System.out.println("emp_details is empty."); |
|||
} |
|||
|
|||
|
|||
if(file_Cat==1) { |
|||
String empInsertQuery = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement, " + |
|||
"retirement_date, retirement_class, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("retirement_date").toString()); |
|||
ps.setString(7, emp.get("retirement_class").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for retirement"); |
|||
|
|||
} |
|||
|
|||
if(file_Cat==2) |
|||
{ |
|||
String empInsertQuery1 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death, " + |
|||
"relationship_deceased, sanctioned_gis_amount, file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery1, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("service_death").toString()); |
|||
ps.setString(6, emp.get("relationship_deceased").toString()); |
|||
ps.setString(7, emp.get("sanctioned_gis_amount").toString()); |
|||
ps.setString(8, emp.get("file_moved_date").toString()); |
|||
ps.setString(9, emp.get("remarks").toString()); |
|||
ps.setInt(10, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(11, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(12, emp.get("file_entry_type").toString()); |
|||
ps.setString(13, fileMovedBy); |
|||
ps.setInt(14, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(15, emp.get("file_category_name").toString()); |
|||
ps.setString(16, emp.get("temp_id").toString()); |
|||
ps.setString(17, emp.get("pending_duration").toString()); |
|||
ps.setString(18, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for family Pension"); |
|||
} |
|||
|
|||
if(file_Cat==3) |
|||
{ |
|||
String empInsertQuery2 = |
|||
"INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,type_of_retirement, " + |
|||
"file_moved_date, remarks, file_category, file_status, " + |
|||
"file_entry_type, file_moved_by, dept_id, file_category_name, temp_id,pending_duration,reason_for_pending,retirement_class,retirement_date) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(empInsertQuery2, empDetails, empDetails.size(), (ps, emp) -> { |
|||
ps.setString(1, emp.get("emp_no").toString()); |
|||
ps.setString(2, emp.get("emp_name").toString()); |
|||
ps.setString(3, emp.get("dept_name").toString()); |
|||
ps.setString(4, emp.get("designation").toString()); |
|||
ps.setString(5, emp.get("type_of_retirement").toString()); |
|||
ps.setString(6, emp.get("file_moved_date").toString()); |
|||
ps.setString(7, emp.get("remarks").toString()); |
|||
ps.setInt(8, Integer.parseInt(emp.get("file_category").toString())); |
|||
ps.setInt(9, Integer.parseInt(emp.get("file_status").toString())); |
|||
ps.setString(10, emp.get("file_entry_type").toString()); |
|||
ps.setString(11, fileMovedBy); |
|||
ps.setInt(12, Integer.parseInt(emp.get("dept_id").toString())); |
|||
ps.setString(13, emp.get("file_category_name").toString()); |
|||
ps.setString(14, emp.get("temp_id").toString()); |
|||
ps.setString(15, emp.get("pending_duration").toString()); |
|||
ps.setString(16, emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null); |
|||
ps.setString(17, emp.get("retirement_class").toString()); |
|||
ps.setString(18, emp.get("retirement_date").toString()); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in pd history for pendency"); |
|||
} |
|||
|
|||
// Batch update for zone benefits |
|||
String zoneInsertQuery = |
|||
"INSERT INTO zone_benefits_history (emp_no, temp_id, gpf, gpf_amount, spfgs, spfgs_amount, dcrg, " + |
|||
"private_affairs, private_affairs_amount, recovery_emp, file_moved_by) " + |
|||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
jdbcTemplate.batchUpdate(zoneInsertQuery, zoneBenefits, zoneBenefits.size(), (ps, zone) -> { |
|||
ps.setString(1, zone.get("emp_no").toString()); |
|||
ps.setString(2, zone.get("temp_id").toString()); |
|||
ps.setString(3, zone.get("gpf").toString()); |
|||
ps.setString(4, zone.get("gpf_amount") != null ? zone.get("gpf_amount").toString() : null); |
|||
ps.setString(5, zone.get("spfgs").toString()); |
|||
ps.setString(6, zone.get("spfgs_amount") != null ? zone.get("spfgs_amount").toString() : null); |
|||
ps.setString(7, zone.get("dcrg").toString()); |
|||
ps.setString(8, zone.get("private_affairs").toString()); |
|||
ps.setString(9, zone.get("private_affairs_amount") != null ? zone.get("private_affairs_amount").toString() : null); |
|||
ps.setString(10, zone.get("recovery_emp") != null ? zone.get("recovery_emp").toString() : null); |
|||
ps.setString(11, fileMovedBy); |
|||
}); |
|||
|
|||
System.out.println("rows inserted in zone history for family Pension"); |
|||
|
|||
return true; // All insertions succeeded |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
/* |
|||
*/ |
|||
|
|||
|
|||
public boolean checkTempIdInZoneBenefits(String tempId) { |
|||
String query = "SELECT EXISTS (SELECT 1 FROM zone_benefits WHERE temp_id = ?)"; |
|||
|
|||
return Boolean.TRUE.equals(jdbcTemplate.queryForObject(query, Boolean.class, tempId)); |
|||
} |
|||
|
|||
|
|||
|
|||
//gis |
|||
|
|||
public boolean updateEntryGisDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
String sanctional_gis_date = (String) requestData.get("sanctional_gis_date"); |
|||
String sanctional_gis_amount = (String) requestData.get("sanctional_gis_amount"); |
|||
String lic_date = (String) requestData.get("lic_date"); |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 11; |
|||
String fileentrytype = "FILE_COMPLETED"; |
|||
|
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?, file_moved_date = ?, remarks = ?, sanctional_gis_date = ?, sanctional_gis_amount = ?, lic_date = ?,file_entry_type=? ,updated_date = CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery, filestatus, dateToAudit, remarks, sanctional_gis_date, sanctional_gis_amount, lic_date,fileentrytype ,tempId); |
|||
|
|||
//int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,dateToAudit, remarks,sanctional_gis_date,sanctional_gis_amount,lic_date,tempId); |
|||
System.out.println(dateToAudit); |
|||
System.out.println(sanctional_gis_date); |
|||
System.out.println(sanctional_gis_amount); |
|||
System.out.println(lic_date); |
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
public boolean savehistoryGis(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String sanctional_gis_date=emp.get("sanctional_gis_date").toString(); |
|||
String sanctional_gis_amount=emp.get("sanctional_gis_amount").toString(); |
|||
String lic_date=emp.get("lic_date").toString(); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, file_moved_date, remarks, file_category, file_status, file_entry_type, file_moved_by, dept_id, file_category_name, temp_id, sanctional_gis_date, sanctional_gis_amount, lic_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|||
|
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id,sanctional_gis_date,sanctional_gis_amount,lic_date); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,238 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
@Service |
|||
@Transactional |
|||
public class ReceivedDeptProvisionalService { |
|||
|
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
|
|||
public ReceivedDeptProvisionalService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchDetailsProvisionalPension(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND file_status=7"; |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchDetailsProvisionalDepartment(Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_category=? AND file_status=6"; |
|||
return jdbcTemplate.queryForList(query,file_cat); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//updated entry details |
|||
public boolean updateEntryDetailsCompleted(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
String pramount = (String) requestData.get("pramount"); |
|||
String prpercentage = (String) requestData.get("prpercentage"); |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 11; |
|||
String file_entry_type="FILE_COMPLETED"; |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?,file_moved_date=?,remarks=?,pr_amount=?,pr_percentage=?,file_entry_type=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,dateToAudit, remarks,pramount,prpercentage,file_entry_type,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
// return to department |
|||
public boolean updateEntryDetailsReturntoDepartment(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
// String pramount = (String) requestData.get("pramount"); |
|||
// String prpercentage = (String) requestData.get("prpercentage"); |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 6; |
|||
String file_entry_type="FILE_RETURNED"; |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?, file_entry_type =?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,file_entry_type,dateToAudit,remarks,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
// sent to pension |
|||
public boolean updateEntryDetailsSenttoPension(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
String ReasonofPension = (String) requestData.get("ReasonofPension"); |
|||
String pendingDuration = (String) requestData.get("pendingDuration"); |
|||
String reasonofPending = (String) requestData.get("reasonofPending"); |
|||
String Dp = (String) requestData.get("Dp"); |
|||
String otherReason = (String) requestData.get("otherReason"); |
|||
|
|||
// String pramount = (String) requestData.get("pramount"); |
|||
// String prpercentage = (String) requestData.get("prpercentage"); |
|||
|
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 7; |
|||
String file_entry_type="FILE_RETURNED"; |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?, file_entry_type =?,file_moved_date=?,remarks=?,reason_for_provisional_pension=?,pending_duration=?,reason_for_pending=?,dp=?,others_provisional_pension=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,file_entry_type,dateToAudit,remarks,ReasonofPension,pendingDuration,reasonofPending,Dp,otherReason ,tempId); |
|||
|
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
public boolean savehistory(List<Map<String, Object>> emp_details, String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Safely extract individual fields from the map with default values |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String retirement_class = emp.get("retirement_class").toString(); |
|||
String type_of_retirement = emp.get("type_of_retirement").toString(); |
|||
String retirementDate = emp.get("retirement_date").toString(); |
|||
String ReasonofPension = emp.get("reason_for_provisional_pension").toString(); |
|||
String pendingDuration = emp.get("pending_duration").toString(); |
|||
String reasonofPending = emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
//String Dp = emp.get("dp").toString(); |
|||
String Dp = emp.get("dp") != null ? emp.get("dp").toString() : "hello"; |
|||
String otherReason = emp.get("others_provisional_pension") != null ? emp.get("others_provisional_pension").toString() : null; |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
String pramount = emp.get("pr_amount") != null && !emp.get("pr_amount").toString().trim().isEmpty() ? emp.get("pr_amount").toString() : null; |
|||
String prpercentage = emp.get("pr_percentage") != null && !emp.get("pr_percentage").toString().trim().isEmpty() ? emp.get("pr_percentage").toString() : null; |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); // Default to 0 |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); // Default to 0 |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); // Default to 0 |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery = "INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,reason_for_provisional_pension, pending_duration, dp, others_provisional_pension, reason_for_pending, retirement_class, file_moved_date, remarks, pr_amount, pr_percentage, file_category, file_status, file_entry_type, file_moved_by, dept_id, file_category_name, temp_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName, designation, type_of_retirement,retirementDate ,ReasonofPension, pendingDuration, Dp, otherReason, reasonofPending, retirement_class, fileMovedDate, remarks, pramount, prpercentage, file_category, fileStatus, fileEntryType, filemovedby, dept_id, fileCategoryName, temp_id); |
|||
System.out.println("Rows inserted in pdh: " + rowsInserted); |
|||
|
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,449 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
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.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class ReportApiService { |
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public ReportApiService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getFileCategories() { |
|||
String sql = "SELECT id,file_name FROM gcc_pensioner.file_category_master"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
// String sql = "SELECT fm.file_name, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status IN (1,3) THEN 1 ELSE 0 END), 0) AS audit_pending, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status IN (2,5,6,9) THEN 1 ELSE 0 END), 0) AS department_pending, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status IN (4,7,8,10) THEN 1 ELSE 0 END), 0) AS pension_pending, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status = 11 THEN 1 ELSE 0 END), 0) AS completed " + |
|||
// "FROM gcc_pensioner.file_category_master fm " + |
|||
// "LEFT JOIN gcc_pensioner.pensioner_details pd " + |
|||
// "ON pd.file_category = fm.id " + |
|||
// "AND pd.created_date BETWEEN ? AND ? " + |
|||
// "AND pd.dept_id = ? " + |
|||
// "AND pd.is_closed = 0 " + // Ensure only active records are considered |
|||
// "GROUP BY fm.file_name"; |
|||
|
|||
|
|||
public List<Map<String, Object>> getReportData(String startDate, String endDate, String deptId) { |
|||
String sql = "SELECT fm.id, " + |
|||
" fm.file_name AS file_name, " + |
|||
|
|||
// Audit Pending Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status IN (1,3) AND pd.dept_id = ? " + |
|||
" AND pd.file_category=fm.id "+ |
|||
" AND pd.is_closed = 0 " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS audit_pending, " + |
|||
|
|||
// Department Pending Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status IN (2,5,6,9) AND pd.dept_id = ? " + |
|||
" AND pd.file_category=fm.id "+ |
|||
" AND pd.is_closed = 0 " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS department_pending, " + |
|||
|
|||
// Pension Pending Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status IN (4,7,8,10) AND pd.dept_id = ? " + |
|||
" AND pd.file_category=fm.id "+ |
|||
" AND pd.is_closed = 0 " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS pension_pending, " + |
|||
|
|||
// Completed Count (SUM of two tables) |
|||
" (COALESCE((SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status = 11 AND pd.dept_id = ? " + |
|||
" AND pd.file_category=fm.id "+ |
|||
" AND pd.is_closed = 0 " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)), 0) " + |
|||
" + " + |
|||
" COALESCE((SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" WHERE cps.file_status = 11 AND cps.dept_id = ? " + |
|||
" AND cps.file_category=fm.id "+ |
|||
" AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)), 0)) AS completed, " + |
|||
|
|||
// Total Files Count (SUM of two tables) |
|||
" (COALESCE((SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.dept_id = ? " + |
|||
" AND pd.file_category=fm.id "+ |
|||
" AND pd.is_closed = 0 " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)), 0) " + |
|||
" + " + |
|||
" COALESCE((SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" WHERE cps.dept_id = ? " + |
|||
" AND cps.file_category=fm.id "+ |
|||
" AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)), 0)) AS total_files " + |
|||
|
|||
"FROM gcc_pensioner.file_category_master fm " + |
|||
"GROUP BY fm.id, fm.file_name " + // Correct placement of GROUP BY |
|||
"ORDER BY fm.id"; // ORDER BY after GROUP BY |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
// Adding parameters in the correct order for each subquery |
|||
for (int i = 0; i < 7; i++) { // 6 subqueries that use deptId, startDate, endDate |
|||
params.add(deptId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
} |
|||
|
|||
return jdbcTemplate.queryForList(sql, params.toArray()); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getReportDetails(String startDate, String endDate, Integer deptId, Integer fileCatId, List<String> fileStatus) { |
|||
String sql = ""; |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
// Construct fileStatus condition |
|||
String fileStatusCondition = (fileStatus != null && !fileStatus.isEmpty()) |
|||
? " AND pd.file_status IN (" + String.join(",", Collections.nCopies(fileStatus.size(), "?")) + ")" |
|||
: ""; // Skip condition if fileStatus is empty or null |
|||
|
|||
if (fileCatId == 6) { |
|||
sql = "SELECT pd.emp_no, pd.emp_name, pd.designation, pd.type_of_retirement, pd.reason_for_pending, " + |
|||
"fm.file_status AS fst, pd.file_category_name, pd.remarks, DATE(pd.created_date) AS created_date " + |
|||
"FROM cps_pensioner_details pd " + |
|||
"INNER JOIN file_status_master fm ON pd.file_status = fm.id " + |
|||
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First date filter |
|||
"AND pd.dept_id = ? " + // Next deptId |
|||
"AND pd.file_category = ? " + // Next fileCatId |
|||
fileStatusCondition; // Last fileStatus condition |
|||
|
|||
} else { |
|||
sql = "SELECT pd.*, fm.file_status AS fst " + |
|||
"FROM pensioner_details pd " + |
|||
"INNER JOIN file_status_master fm ON pd.file_status = fm.id " + |
|||
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First date filter |
|||
"AND pd.dept_id = ? " + // Next deptId |
|||
"AND pd.file_category = ? " + // Next fileCatId |
|||
fileStatusCondition; // Last fileStatus condition |
|||
} |
|||
|
|||
// Add date range parameters first |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
// Add deptId and fileCatId parameters |
|||
params.add(deptId); |
|||
params.add(fileCatId); |
|||
|
|||
// Add fileStatus parameters if present |
|||
if (fileStatus != null && !fileStatus.isEmpty()) { |
|||
params.addAll(fileStatus); |
|||
} |
|||
|
|||
System.out.println("Executing SQL Query: " + sql); |
|||
System.out.println("Query Parameters: " + params); |
|||
|
|||
return jdbcTemplate.queryForList(sql, params.toArray()); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
//pensioner side reorts methods |
|||
|
|||
public List<Map<String, Object>> getstatus() { |
|||
String sql = "select id , file_status from gcc_pensioner.file_status_master"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getdepartment() { |
|||
String sql = "select id ,dept_name from gcc_pensioner.department_master"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
|
|||
// public List<Map<String, Object>> getReportDatapension(String startDate, String endDate, String fileCategoryId) { |
|||
// String sql = "SELECT fm.file_name, " + |
|||
// "fm.id AS file_category_id, " + |
|||
// "COALESCE(dm.dept_name, 'All Departments') AS dept_name, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status IN (1,3) OR cps.file_status IN (1,3) THEN 1 ELSE 0 END), 0) AS audit_pending, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status IN (2,5,6,9) OR cps.file_status IN (2,5,6,9) THEN 1 ELSE 0 END), 0) AS department_pending, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status IN (4,7,8,10) OR cps.file_status IN (4,7,8,10) THEN 1 ELSE 0 END), 0) AS pension_pending, " + |
|||
// "COALESCE(SUM(CASE WHEN pd.file_status = 11 OR cps.file_status = 11 THEN 1 ELSE 0 END), 0) AS completed, " + |
|||
// "COALESCE(COUNT(pd.id) + COUNT(cps.id), 0) AS total_files " + |
|||
// "FROM gcc_pensioner.file_category_master fm " + |
|||
// "LEFT JOIN gcc_pensioner.cps_pensioner_details cps ON cps.file_category = fm.id " + |
|||
// "LEFT JOIN gcc_pensioner.pensioner_details pd ON pd.file_category = fm.id " + |
|||
// "LEFT JOIN gcc_pensioner.department_master dm ON dm.dept_id = COALESCE(pd.dept_id, cps.dept_id) " + |
|||
// "WHERE (pd.created_date BETWEEN ? AND ? OR cps.created_date BETWEEN ? AND ?) " + |
|||
// (fileCategoryId != null && !fileCategoryId.isEmpty() ? "AND fm.id = ? " : "") + |
|||
// "GROUP BY fm.id, fm.file_name, dm.dept_name " + |
|||
// "ORDER BY fm.id, dm.dept_name, fm.file_name"; |
|||
// |
|||
// System.out.println("Executing SQL: " + sql); |
|||
// |
|||
// List<Object> params = new ArrayList<>(); |
|||
// params.add(startDate); |
|||
// params.add(endDate); |
|||
// params.add(startDate); // Date filter applies to both `pd` and `cps` |
|||
// params.add(endDate); |
|||
// |
|||
// if (fileCategoryId != null && !fileCategoryId.isEmpty()) { |
|||
// params.add(fileCategoryId); |
|||
// } |
|||
// |
|||
// return jdbcTemplate.queryForList(sql, params.toArray()); |
|||
// } |
|||
|
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getReportDatapension(String startDate, String endDate, String fileCategoryId) { |
|||
String sql = "SELECT dm.dept_id, " + |
|||
" dm.dept_name AS dept_name, " + |
|||
|
|||
// Audit Pending Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status IN (1,3) AND pd.dept_id = dm.dept_id " + |
|||
" AND pd.is_closed = 0 " + // Added condition |
|||
" AND ( ? IS NULL OR pd.file_category = ? ) " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS audit_pending, " + |
|||
|
|||
// Department Pending Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status IN (2,5,6,9) AND pd.dept_id = dm.dept_id " + |
|||
" AND pd.is_closed = 0 " + // Added condition |
|||
" AND ( ? IS NULL OR pd.file_category = ? ) " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS department_pending, " + |
|||
|
|||
// Pension Pending Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status IN (4,7,8,10) AND pd.dept_id = dm.dept_id " + |
|||
" AND pd.is_closed = 0 " + // Added condition |
|||
" AND ( ? IS NULL OR pd.file_category = ? ) " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS pension_pending, " + |
|||
|
|||
// Completed Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.file_status = 11 AND pd.dept_id = dm.dept_id " + |
|||
" AND pd.is_closed = 0 " + // Added condition |
|||
" AND ( ? IS NULL OR pd.file_category = ? ) " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) " + |
|||
" + " + |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" WHERE cps.file_status = 11 AND cps.dept_id = dm.dept_id " + |
|||
" AND ( ? IS NULL OR cps.file_category = ? ) " + |
|||
" AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)) AS completed, " + |
|||
|
|||
// Total Files Count |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + |
|||
" WHERE pd.dept_id = dm.dept_id " + |
|||
" AND pd.is_closed = 0 " + // Added condition |
|||
" AND ( ? IS NULL OR pd.file_category = ? ) " + |
|||
" AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) " + |
|||
" + " + |
|||
" (SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + |
|||
" WHERE cps.dept_id = dm.dept_id " + |
|||
" AND ( ? IS NULL OR cps.file_category = ? ) " + |
|||
" AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)) AS total_files " + |
|||
|
|||
"FROM gcc_pensioner.department_master dm " + |
|||
"ORDER BY dm.dept_id"; |
|||
|
|||
System.out.println("Executing SQL: " + sql); |
|||
|
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
// Adding parameters explicitly without a loop |
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
params.add(fileCategoryId != null && !fileCategoryId.isEmpty() ? fileCategoryId : null); |
|||
params.add(fileCategoryId); |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
return jdbcTemplate.queryForList(sql, params.toArray()); |
|||
} |
|||
|
|||
|
|||
// public List<Map<String, Object>> getReportDetailspension(String startDate, String endDate, List<String> deptIds, Integer fileCatId, List<String> fileStatus) { |
|||
// String sql = ""; |
|||
// List<Object> params = new ArrayList<>(); |
|||
// |
|||
// boolean selectAll = deptIds.contains("ALL"); |
|||
// |
|||
// // ✅ If "ALL" is selected, remove department filtering |
|||
// String deptCondition = selectAll ? "1=1" : "pd.dept_id IN (" + String.join(",", Collections.nCopies(deptIds.size(), "?")) + ")"; |
|||
// |
|||
// // ✅ Handle fileStatus as multiple values in IN clause |
|||
// String fileStatusCondition = (fileStatus != null && !fileStatus.isEmpty()) |
|||
// ? " AND pd.file_status IN (" + String.join(",", Collections.nCopies(fileStatus.size(), "?")) + ")" |
|||
// : ""; // Skip condition if fileStatus is empty or null |
|||
// |
|||
// if (fileCatId == 6) { |
|||
// sql = "SELECT pd.emp_no, pd.emp_name, pd.designation, pd.type_of_retirement, pd.reason_for_pending, " + |
|||
// "fm.file_status AS fst, pd.file_category_name, pd.remarks, DATE(pd.created_date) AS created_date " + |
|||
// "FROM cps_pensioner_details pd " + |
|||
// "INNER JOIN file_status_master fm ON pd.file_status = fm.id " + |
|||
// "WHERE " + deptCondition + " AND pd.file_category = ?" + fileStatusCondition; |
|||
// |
|||
// if (!selectAll) { |
|||
// params.addAll(deptIds); |
|||
// } |
|||
// params.add(fileCatId); |
|||
// if (fileStatus != null && !fileStatus.isEmpty()) { |
|||
// params.addAll(fileStatus); |
|||
// } |
|||
// } |
|||
// else { |
|||
// sql = "SELECT pd.*, fm.file_status as fst FROM pensioner_details pd " + |
|||
// "INNER JOIN file_status_master fm ON pd.file_status = fm.id " + |
|||
// "WHERE " + deptCondition + " AND pd.file_category = ?" + fileStatusCondition; |
|||
// |
|||
// if (!selectAll) { |
|||
// params.addAll(deptIds); |
|||
// } |
|||
// params.add(fileCatId); |
|||
// if (fileStatus != null && !fileStatus.isEmpty()) { |
|||
// params.addAll(fileStatus); |
|||
// } |
|||
// } |
|||
// |
|||
// System.out.println("Executing SQL Query: " + sql); |
|||
// System.out.println("Query Parameters: " + params); |
|||
// |
|||
// return jdbcTemplate.queryForList(sql, params.toArray()); |
|||
// } |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getReportDetailspension(String startDate, String endDate, List<String> deptIds, Integer fileCatId, List<String> fileStatus) { |
|||
String sql = ""; |
|||
List<Object> params = new ArrayList<>(); |
|||
|
|||
boolean selectAll = deptIds.contains("ALL"); |
|||
|
|||
// ✅ If "ALL" is selected, remove department filtering |
|||
String deptCondition = selectAll ? "1=1" : "pd.dept_id IN (" + String.join(",", Collections.nCopies(deptIds.size(), "?")) + ")"; |
|||
|
|||
// ✅ Handle fileStatus as multiple values in IN clause |
|||
String fileStatusCondition = (fileStatus != null && !fileStatus.isEmpty()) |
|||
? " AND pd.file_status IN (" + String.join(",", Collections.nCopies(fileStatus.size(), "?")) + ")" |
|||
: ""; // Skip condition if fileStatus is empty or null |
|||
|
|||
if (fileCatId == 6) { |
|||
sql = "SELECT pd.emp_no, pd.emp_name, pd.designation, pd.type_of_retirement, pd.reason_for_pending, " + |
|||
"fm.file_status AS fst, pd.file_category_name, pd.remarks, DATE(pd.created_date) AS created_date " + |
|||
"FROM cps_pensioner_details pd " + |
|||
"INNER JOIN file_status_master fm ON pd.file_status = fm.id " + |
|||
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First: Date filter |
|||
"AND pd.file_category = ? " + // Second: File category filter |
|||
"AND " + deptCondition + // Third: Department condition |
|||
fileStatusCondition; // Last: File status condition |
|||
|
|||
} else { |
|||
sql = "SELECT pd.*, fm.file_status as fst " + |
|||
"FROM pensioner_details pd " + |
|||
"INNER JOIN file_status_master fm ON pd.file_status = fm.id " + |
|||
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First: Date filter |
|||
"AND pd.file_category = ? " + // Second: File category filter |
|||
"AND " + deptCondition + // Third: Department condition |
|||
fileStatusCondition; // Last: File status condition |
|||
} |
|||
|
|||
// Add date range parameters first |
|||
params.add(startDate); |
|||
params.add(endDate); |
|||
|
|||
// Add file category next |
|||
params.add(fileCatId); |
|||
|
|||
// Add department filter parameters if not "ALL" |
|||
if (!selectAll) { |
|||
params.addAll(deptIds); |
|||
} |
|||
|
|||
// Add fileStatus parameters if present |
|||
if (fileStatus != null && !fileStatus.isEmpty()) { |
|||
params.addAll(fileStatus); |
|||
} |
|||
|
|||
System.out.println("Executing SQL Query: " + sql); |
|||
System.out.println("Query Parameters: " + params); |
|||
|
|||
return jdbcTemplate.queryForList(sql, params.toArray()); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getDepartmentpending(int file_category) { |
|||
|
|||
String sql = "SELECT dept_name, emp_name, emp_no, file_category_name, file_status, file_moved_date, remarks " + |
|||
"FROM pensioner_details WHERE file_status IN (2, 5, 6, 9) AND file_category=?"; |
|||
|
|||
List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, file_category); |
|||
|
|||
return jdbcTemplate.queryForList(sql, file_category); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,213 @@ |
|||
package in.gov.chennaicorporation.gccoffice.pensioner.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; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; |
|||
|
|||
@Service |
|||
@Transactional |
|||
public class ReturnFromAuditService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
|
|||
private RestTemplate restTemplate; |
|||
private ObjectMapper objectMapper; |
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
public ReturnFromAuditService(RestTemplate restTemplate, ObjectMapper objectMapper) { |
|||
this.restTemplate = restTemplate; |
|||
this.objectMapper = objectMapper; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchReturnEmpfiles(Integer deptId,Integer file_cat) { |
|||
String query = "SELECT * " + |
|||
"FROM pensioner_details " + |
|||
"WHERE file_status=2 AND dept_id=? AND file_category=? AND is_closed=0"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(query,deptId,file_cat); |
|||
} |
|||
|
|||
public boolean updateEntryDetails(Map<String, Object> requestData) { |
|||
// TODO Auto-generated method stub |
|||
String empNo = (String) requestData.get("empNo"); |
|||
String tempId = (String) requestData.get("tempId"); |
|||
String dateToAudit = (String) requestData.get("dateToAudit"); |
|||
String filemovedby =(String)requestData.get("filemovedby"); |
|||
String remarks = (String) requestData.get("remarks"); |
|||
String dept_Id = (String) requestData.get("deptId"); |
|||
|
|||
int deptId = Integer.parseInt(dept_Id); |
|||
int filestatus = 3; |
|||
|
|||
// Update file_status in pensioner_details |
|||
String updateQuery = "UPDATE pensioner_details SET file_status = ?,file_moved_date=?,remarks=?,updated_date= CURRENT_TIMESTAMP WHERE temp_id = ? LIMIT 1"; |
|||
int rowsUpdated = jdbcTemplate.update(updateQuery,filestatus,dateToAudit, remarks,tempId); |
|||
System.out.println("Rows inserted in pd:"+rowsUpdated); |
|||
if(rowsUpdated>0) |
|||
{ |
|||
// Optional: Insert into file movement history for auditing |
|||
String historyQuery = "INSERT INTO file_movement_history (emp_no, file_moved_date, file_status, file_moved_by, remarks,temp_id) VALUES (?,?, ?, ?, ?, ?)"; |
|||
int rowsUpdated1=jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks,tempId); |
|||
System.out.println("Rows inserted in fmh:"+rowsUpdated1); |
|||
|
|||
return true; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
public boolean savehistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String retirement_date = emp.get("retirement_date").toString(); |
|||
String retirement_class = emp.get("retirement_class").toString(); |
|||
String type_of_retirement = emp.get("type_of_retirement").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, type_of_retirement,retirement_date ,retirement_class,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,type_of_retirement,retirement_date,retirement_class,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
//save the updatedfamilypensionReturn |
|||
|
|||
public boolean saveFamilyPensionReturnHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending").toString(); |
|||
String sericeDeath = emp.get("service_death").toString(); |
|||
String relationshipDeceased = emp.get("relationship_deceased").toString(); |
|||
String sanctionedGis = emp.get("sanctioned_gis_amount").toString(); |
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation, service_death,relationship_deceased ,sanctioned_gis_amount,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,file_category_name,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,sericeDeath,relationshipDeceased,sanctionedGis,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,fileCategoryName,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
|
|||
//update save pendency history |
|||
public boolean savePendencyHistory(List<Map<String, Object>> emp_details,String filemovedby) { |
|||
try { |
|||
// Loop through the list of employee details |
|||
for (Map<String, Object> emp : emp_details) { |
|||
// Extract individual fields from the map |
|||
String empNo = emp.get("emp_no").toString(); |
|||
String empName = emp.get("emp_name").toString(); |
|||
String deptName = emp.get("dept_name").toString(); |
|||
String designation = emp.get("designation").toString(); |
|||
String retirementClass = emp.get("retirement_class").toString(); |
|||
String retirementDate=emp.get("retirement_date").toString(); |
|||
//String fileCategoryName = emp.get("file_category_name").toString(); |
|||
String pendingDuration=emp.get("pending_duration").toString(); |
|||
String pendingReason=emp.get("reason_for_pending") != null ? emp.get("reason_for_pending").toString() : null; |
|||
|
|||
String typeOfCategory=emp.get("file_category_name").toString(); |
|||
String typeOfRetirement=emp.get("type_of_retirement").toString(); |
|||
|
|||
String fileMovedDate = emp.get("file_moved_date").toString(); |
|||
String remarks = emp.get("remarks").toString(); |
|||
int fileStatus = Integer.parseInt(emp.get("file_status").toString()); |
|||
String fileEntryType = emp.get("file_entry_type").toString(); |
|||
int file_category = Integer.parseInt(emp.get("file_category").toString()); |
|||
int dept_id = Integer.parseInt(emp.get("dept_id").toString()); |
|||
String temp_id = emp.get("temp_id").toString(); |
|||
|
|||
// Prepare the insert query |
|||
String insertQuery ="INSERT INTO pensioner_details_history (emp_no, emp_name, dept_name, designation,retirement_class,retirement_date,file_category_name,type_of_retirement,file_moved_date, remarks,file_category,file_status,file_entry_type,file_moved_by,dept_id,temp_id,pending_duration,reason_for_pending) VALUES (?,?,?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
// Execute the query |
|||
int rowsInserted = jdbcTemplate.update(insertQuery, empNo, empName, deptName,designation,retirementClass,retirementDate,typeOfCategory,typeOfRetirement,fileMovedDate,remarks,file_category,fileStatus,fileEntryType,filemovedby,dept_id,temp_id,pendingDuration,pendingReason); |
|||
System.out.println("Rows inserted in pdh:"+rowsInserted); |
|||
// Check if the insertion was successful |
|||
if (rowsInserted <= 0) { |
|||
return false; // Return false if any insertion fails |
|||
} |
|||
} |
|||
|
|||
return true; // Return true if all insertions succeed |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return false; // Return false in case of any exception |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,749 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
|
|||
.is-invalid { |
|||
border: 1px solid red; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Family Pension</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Audit- Family Pension</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnfamilypensiondetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Audit - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- pending duration--> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- While in Service Death --> |
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While in Service Death </label> |
|||
<input type="text" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Relationship of Deceased --> |
|||
<div class="col-md-6"> |
|||
<label for="relationship" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="relationship" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS </label> |
|||
<input type="text" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Returned From Audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile" class="form-label fw-bold">Date File Received From Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
|
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#relationship').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
|
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnfamilypensiondetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnfamilypensiondetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnfamilypensiondetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/updateFamilyPensionDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
window.location.href = "/gcc/department/audit/familypension"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,731 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Pendency</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;">Audit - Pendency</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Category Type</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_category_name']}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnpendencydetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Audit -Pendency(<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6" id="retirementDetailsContainer" style="display: none; margin-top: 10px;"> |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement </label> |
|||
<input type="text" id="retirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="text" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<!-- file history --> |
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Returned From Audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Date File Received From Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly > |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeeno').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#typeofcategory').val(employeeDetails.file_category_name); |
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
let typeOfCategory=employeeDetails.file_category_name; |
|||
let typeOfRetirement=employeeDetails.type_of_retirement; |
|||
|
|||
if (typeOfCategory === "Retirement") { |
|||
$('#retirementDetailsContainer').show(); // Show the text box |
|||
$('#retirement').val(typeOfRetirement); // Populate the input field |
|||
} else { |
|||
$('#retirementDetailsContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnpendencydetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeeno').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit:convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/updatePendencyDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
window.location.href = "/gcc/department/audit/pendency"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,646 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Retirement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;">Audit- Retirement</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']}, data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- page loader--> |
|||
|
|||
|
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Audit - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement <span class="text-danger">*</span></label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Returned From Audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Date File Received From Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditsubmit">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditsubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditsubmit').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo:empNo, |
|||
tempId: tempId, // Pass the stored tempId value |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditsubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditsubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditsubmit').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/department/audit/retirement"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditsubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
1132
frontend/pensioner/department/closedList.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,685 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#completedDetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#completedDetailsModal label{ |
|||
padding-top: 3%; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Contributory Pension Scheme</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Contributory Pension Scheme</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Completed Contributory Pension Scheme</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="completedCPSTable"> |
|||
<table id="CompletedCPSDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name</th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Created Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="cps, iterStat : ${completedCPSList}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${cps['emp_no']}" class="text-center"></td> |
|||
<td th:text="${cps['emp_name']}" class="text-center"></td> |
|||
<td th:text="${cps['dept_name']}" class="text-center"></td> |
|||
<td th:text="${cps['designation']}" class="text-center"></td> |
|||
<td th:text="${cps['created_date'] != null ? #dates.format(cps['created_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${cps['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" |
|||
th:attr="data-id=${cps['emp_no']}, data-temp-id=${cps['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box for CompletedDetails --> |
|||
<!-- Modal Box for CompletedDetails --> |
|||
<div class="modal fade" id="completedDetailsModal" tabindex="-1" role="dialog" aria-labelledby="completedDetailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="completedDetailsModalLabel"> |
|||
Completed Details (<span id="completedModalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
<label for="completedEmployeeNo" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedEmployeeNo" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedEmployeeName" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedEmployeeName" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedDepartment" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedDepartment" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedDesignation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedDesignation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="completedClass" class="form-label fw-bold">Class <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedClass" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedType" class="form-label fw-bold">Type of Retirement <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedType" class="form-control" readonly> |
|||
</div> |
|||
<!-- UAC Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold" for="uac">Whether File Sent UAC Date <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="uacYes" name="uac" class="form-check-input" value="Yes" > |
|||
<label for="uacYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="uacNo" name="uac" class="form-check-input" value="No" > |
|||
<label for="uacNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="uacInputDiv" style="display: none;"> |
|||
<input type="date" id="uacDate" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="pendingDurationYes" name="pendingDuration" value="yes" class="form-check-input"> |
|||
<label for="pendingDurationYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="pendingDurationNo" name="pendingDuration" value="no" class="form-check-input"> |
|||
<label for="pendingDurationNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- CPS Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold">Whether CPS Amount Settled</label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="cpsYes" name="cps" class="form-check-input" value="Yes" > |
|||
<label for="cpsYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="cpsNo" name="cps" class="form-check-input" value="No"> |
|||
<label for="cpsNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="cpsInputDiv" style="display: none;"> |
|||
<input type="text" id="cpsAmount" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- EL/LPA Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold">Whether EL/LPA Amount Settled <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="elLpaYes" name="el_or_lpa" class="form-check-input" value="yes" > |
|||
<label for="elLpaYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="elLpaNo" name="el_or_lpa" class="form-check-input" value="no" > |
|||
<label for="elLpaNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="elLpaInputDiv" style="display: none;"> |
|||
<input type="text" id="elLpaAmount" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold">Whether SPFGS Amount Settled <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="spfgsYes" name="spfgs" class="form-check-input" value="yes" > |
|||
<label for="spfgsYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="spfgsNo" name="spfgs" class="form-check-input" value="no" > |
|||
<label for="spfgsNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="spfgsInputDiv" style="display: none;"> |
|||
<input type="text" id="spfgsAmount" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="completedRemarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="completedRemarks" class="form-control" rows="4" placeholder="Enter remarks" readonly></textarea> |
|||
</div> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="completedBackButton">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
|
|||
|
|||
<script> |
|||
|
|||
const table = $('#CompletedCPSDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
// Handle view button click to fetch completed details |
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); |
|||
const tempId = $(this).data('temp-id'); |
|||
|
|||
if (!tempId) { |
|||
console.error("tempId is missing!"); |
|||
return; |
|||
} |
|||
|
|||
console.log("empCode:", empCode || "Not Provided"); |
|||
console.log("tempId:", tempId); |
|||
|
|||
fetchCPSDetails(tempId); |
|||
loadFileHistory(tempId); |
|||
}); |
|||
|
|||
// Initialize modal |
|||
$('#completedDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false |
|||
}); |
|||
|
|||
// Handle Close and Back button click |
|||
$('.close, #back').click(function () { |
|||
$('#completedDetailsModal').modal('hide'); |
|||
//clearFields(); |
|||
}); |
|||
|
|||
|
|||
function fetchCPSDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetailscps', |
|||
type: 'GET', |
|||
data: { tempId: tempId }, |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
let cpsDetails = response[0]; // Access the first object in the array |
|||
console.log("response:", response); |
|||
|
|||
// Populate modal fields with CPS details |
|||
$('#completedModalEmployeeCode').text(cpsDetails.emp_no); |
|||
$('#completedEmployeeNo').val(cpsDetails.emp_no); |
|||
$('#completedEmployeeName').val(cpsDetails.emp_name); |
|||
$('#completedDepartment').val(cpsDetails.dept_name); |
|||
$('#completedDesignation').val(cpsDetails.designation); |
|||
$('#completedClass').val(cpsDetails.retirement_class); |
|||
$('#completedType').val(cpsDetails.type_of_retirement); |
|||
$('#completedRemarks').val(cpsDetails.remarks); |
|||
|
|||
// Populate UAC Section |
|||
if (cpsDetails.uac === "yes") { |
|||
$('#uacYes').prop('checked', true); // Check Yes radio button |
|||
$('#uacNo').prop('disabled', true); // Disable No radio button |
|||
$('#uacInputDiv').show(); // Show date input field |
|||
$('#uacDate').val(cpsDetails.uac_date || '').prop('readonly', true); // Set UAC date and make readonly |
|||
} else if (cpsDetails.uac_sent === "no") { |
|||
$('#uacNo').prop('checked', true); // Check No radio button |
|||
$('#uacYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#uacInputDiv').hide(); // Hide date input field |
|||
} |
|||
|
|||
// Populate Pending Duration and Reason for Pending pendingDurationYes pendingDurationNo pendingDurationInputContainer pendingDurationInput |
|||
if (cpsDetails.pending_duration === "yes") { |
|||
$('#pendingDurationYes').prop('checked', true); |
|||
$('#pendingDurationNo').prop('disabled', true); // Disable the other option |
|||
$('#pendingDurationInputContainer').show(); // Hide reason input |
|||
$('#pendingDurationInput').val(cpsDetails.reason_for_pending || '').prop('readonly', true); |
|||
} else if (cpsDetails.pending_duration === "no") { |
|||
$('#pendingDurationYes').prop('disabled', true); |
|||
$('#pendingDurationNo').prop('checked', true); |
|||
$('#pendingDurationInputContainer').hide(); // Show reason input field |
|||
|
|||
} |
|||
|
|||
// Populate CPS Section based on response or data |
|||
if (cpsDetails.cps === "yes") { |
|||
$('#cpsYes').prop('checked', true); // Check Yes radio button |
|||
$('#cpsNo').prop('disabled', true); // Disable No radio button |
|||
$('#cpsInputDiv').show(); // Show CPS amount input field |
|||
$('#cpsAmount').val(cpsDetails.cps_amount || '').prop('readonly', true); // Set CPS amount and make readonly |
|||
} else if (cpsDetails.cps === "no") { |
|||
$('#cpsNo').prop('checked', true); // Check No radio button |
|||
$('#cpsYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#cpsInputDiv').hide(); // Hide CPS amount input field |
|||
} |
|||
|
|||
// Populate EL or LPA Section based on response or data |
|||
if (cpsDetails.el_or_lpa === "yes") { |
|||
$('#elLpaYes').prop('checked', true); // Check Yes radio button |
|||
$('#elLpaNo').prop('disabled', true); // Disable No radio button |
|||
$('#elLpaInputDiv').show(); // Show input field for EL or LPA Amount |
|||
$('#elLpaAmount').val(cpsDetails.el_or_lpa_amount || '').prop('readonly', true); // Set the amount and make readonly |
|||
} else if (cpsDetails.el_or_lpa === "no") { |
|||
$('#elLpaNo').prop('checked', true); // Check No radio button |
|||
$('#elLpaYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#elLpaInputDiv').hide(); // Hide input field for EL or LPA Amount |
|||
} |
|||
|
|||
// Populate SPFGS Section based on response or data |
|||
if (cpsDetails.spfgs === "yes") { |
|||
$('#spfgsYes').prop('checked', true); // Check Yes radio button |
|||
$('#spfgsNo').prop('disabled', true); // Disable No radio button |
|||
$('#spfgsInputDiv').show(); // Show SPFGS amount input field |
|||
$('#spfgsAmount').val(cpsDetails.spfgs_amount || '').prop('readonly', true); // Set SPFGS amount and make readonly |
|||
} else if (cpsDetails.spfgs === "no") { |
|||
$('#spfgsNo').prop('checked', true); // Check No radio button |
|||
$('#spfgsYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#spfgsInputDiv').hide(); // Hide SPFGS amount input field |
|||
} |
|||
|
|||
// Handle SPFGS changes |
|||
$('#spfgsYes').change(function () { |
|||
if ($(this).is(':checked')) { |
|||
$('#spfgsNo').prop('disabled', true); // Disable No radio button |
|||
$('#spfgsInputDiv').show(); // Show SPFGS amount input field |
|||
} |
|||
}); |
|||
|
|||
$('#spfgsNo').change(function () { |
|||
if ($(this).is(':checked')) { |
|||
$('#spfgsYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#spfgsInputDiv').hide(); // Hide SPFGS amount input field |
|||
} |
|||
}); |
|||
|
|||
// Show the modal after fetching details |
|||
$('#completedDetailsModal').modal('show'); |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected CPS record.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch CPS details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
$('#completedBackButton').on('click', function () { |
|||
$('#completedDetailsModal').modal('hide'); // Replace 'yourModalId' with the actual modal ID |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
///history function to show in modal |
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,814 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#sec1 .col-md-4,.col-md-12{ |
|||
padding-top: 1%; |
|||
} |
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.col-md-6 .form-check{ |
|||
width: 25%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5> Family Pension</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Family Pension</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Completed - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row" id="sec1"> |
|||
|
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- pending duration--> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- While in Service Death --> |
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While in Service Death </label> |
|||
<input type="text" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Relationship of Deceased --> |
|||
<div class="col-md-6"> |
|||
<label for="relationship" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="relationship" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS</label> |
|||
<input type="text" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Completed </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Department Benefits</span> |
|||
</div> |
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF</label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes" disabled> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no" disabled> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90" disabled> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount</label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes" disabled> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no" disabled> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount</label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes" disabled> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no" disabled> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount</label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready</label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</span> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="pensionNumber" class="form-label">Pension Number</label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number</label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes" disabled> |
|||
<label class="form-check-label" for="bpYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no" disabled> |
|||
<label class="form-check-label" for="bpNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="PbAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount</label> |
|||
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="DcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="DcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="dcrgAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount</label> |
|||
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes" disabled> |
|||
<label class="form-check-label" for="commutationYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no" disabled> |
|||
<label class="form-check-label" for="commutationNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="CommutationAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount</label> |
|||
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getpartialdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#relationship').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
//$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
//$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
$('#pensionNumber').val(employeeDetails.pension_number); |
|||
$('#ledgerNumber').val(employeeDetails.ledger_number); |
|||
|
|||
$('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_pension === "yes") { |
|||
$('#PbAmountDiv').show(); |
|||
$('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount); |
|||
} else { |
|||
$('#PbAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_dcrg === "yes") { |
|||
$('#dcrgAmountDiv').show(); |
|||
$('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount); |
|||
} else { |
|||
$('#dcrgAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_commutation === "yes") { |
|||
$('#CommutationAmountDiv').show(); |
|||
$('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount); |
|||
} else { |
|||
$('#CommutationAmountDiv').hide(); |
|||
} |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,547 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>GIS</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">GIS</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Completed-GIS</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="GISDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']}, data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
GIS - Completed (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No</label> |
|||
<input type="text" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">While in service Death </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="gisentry" class="form-label fw-bold">GIS Entry Type<span class="text-danger">*</span></label> |
|||
<input type="text" id="gisentry" class="form-control" readonly> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="gisamount" class="form-label fw-bold"> |
|||
Sanctioned GIS Advance |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="gisyes" name="gisamount" class="form-check-input" value="Yes"> |
|||
<label for="gisyes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="gisno" name="gisamount" class="form-check-input" value="No"> |
|||
<label for="gisno" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="gisAmountInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="gisAmountInput" class="form-control" readonly> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionalGISDate " class="form-label fw-bold">Sanctional GIS Date</label> |
|||
<input type="date" id="sanctionalGISDate" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="sanctionalGisAmount " class="form-label fw-bold">Sanctional GIS Amount </label> |
|||
<input type="number" id="sanctionalGisAmount" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="licDate " class="form-label fw-bold">File Forward To LIC On</label> |
|||
<input type="date" id="licDate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">File Completed Date </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
// Initialize DataTable |
|||
const table = $('#GISDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#gisentry').val(employeeDetails.gis_entry); |
|||
|
|||
$('#classes').val(employeeDetails.relationship_deceased); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.service_death); |
|||
|
|||
$('#sanctionalGISDate').val(employeeDetails.sanctional_gis_date); |
|||
$('#sanctionalGisAmount').val(employeeDetails.sanctional_gis_amount); |
|||
$('#licDate').val(employeeDetails.lic_date); |
|||
|
|||
/* gisyes |
|||
gisno |
|||
gisAmountInputContainer |
|||
gisAmountInput */ |
|||
|
|||
|
|||
// Populate gis advance Section based on response or data |
|||
if (employeeDetails.gis_advance === "yes") { |
|||
$('#gisyes').prop('checked', true); // Check Yes radio button |
|||
$('#gisno').prop('disabled', true); // Disable No radio button |
|||
$('#gisAmountInputContainer').show(); // Show CPS amount input field |
|||
$('#gisAmountInput').val(employeeDetails.gis_advance_amount || '').prop('readonly', true); // Set CPS amount and make readonly |
|||
} else if (employeeDetails.gis_advance === "no") { |
|||
$('#gisno').prop('checked', true); // Check No radio button |
|||
$('#gisyes').prop('disabled', true); // Disable Yes radio button |
|||
$('#gisAmountInputContainer').hide(); // Hide CPS amount input field |
|||
} |
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditsubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,820 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#sec1 .col-md-4,.col-md-12{ |
|||
padding-top: 1%; |
|||
} |
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.col-md-6 .form-check{ |
|||
width: 25%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5> Pendency</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Pendency</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Completed - Pendency (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row" id="sec1"> |
|||
|
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="classes" class="form-label fw-bold">Class</label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="text" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-4"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Completed </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Department Benefits</span> |
|||
</div> |
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF</label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes" disabled> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no" disabled> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90" disabled> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount</label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes" disabled> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no" disabled> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount</label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes" disabled> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no" disabled> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount</label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready</label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</span> |
|||
</div> |
|||
|
|||
<!-- <div class="col-md-6 mt-2 mb-2"> |
|||
<label for="pensionNumber" class="form-label">Pension Number</label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number</label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> --> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="pensionNumber" class="form-label">Pension Number</label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number</label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes" disabled> |
|||
<label class="form-check-label" for="bpYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no" disabled> |
|||
<label class="form-check-label" for="bpNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="PbAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount</label> |
|||
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="DcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="DcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="dcrgAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount</label> |
|||
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes" disabled> |
|||
<label class="form-check-label" for="commutationYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no" disabled> |
|||
<label class="form-check-label" for="commutationNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="CommutationAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount</label> |
|||
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getpartialdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
$('#pensionNumber').val(employeeDetails.pension_number); |
|||
$('#ledgerNumber').val(employeeDetails.ledger_number); |
|||
|
|||
$('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_pension === "yes") { |
|||
$('#PbAmountDiv').show(); |
|||
$('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount); |
|||
} else { |
|||
$('#PbAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_dcrg === "yes") { |
|||
$('#dcrgAmountDiv').show(); |
|||
$('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount); |
|||
} else { |
|||
$('#dcrgAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_commutation === "yes") { |
|||
$('#CommutationAmountDiv').show(); |
|||
$('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount); |
|||
} else { |
|||
$('#CommutationAmountDiv').hide(); |
|||
} |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,695 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Provisional Retirement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Provisional Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Provisional Retirement</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="receivedprovisionalModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Received From Department - Provisional Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type Of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
<!-- Reason For Provisional Pension is given --> |
|||
<!-- provisionalreason |
|||
otherReason --> |
|||
<div class="col-md-6"> |
|||
<label for="provisionalreason" class="form-label fw-bold">Reason For Provisional Pension is given <span class="text-danger">*</span></label> |
|||
<input type="text" id="provisionalreason" class="form-control" readonly> |
|||
<div id="otherReasonDiv" style="display: none; margin-top: 10px;"> |
|||
<label for="otherReason" class="form-label">Please specify:</label> |
|||
<input type="text" id="otherReason" class="form-control" placeholder="Enter reason" readonly> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Pension Section --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension Section <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly onclick="this.showPicker()"> |
|||
</div> |
|||
|
|||
<!-- Pending Duration --> |
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold">Pending Duration <span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" disabled> |
|||
<label for="yespen" class="form-check-label">yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" disabled> |
|||
<label for="nopen" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
<div id="clickyesdiv" style="display: none; margin-top: 10px;"> |
|||
<label for="clickyes" class="form-label">Please specify:</label> |
|||
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- dp --> |
|||
<div class="col-md-6"> |
|||
<label for="DP" class="form-label fw-bold">DP<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check " style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="DP" value="yes" class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">yes</label> |
|||
</div> |
|||
<br> |
|||
<div class="form-check" > |
|||
<input type="radio" id="no" name="DP" value="no" class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label" >no</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Retirement Amount --> |
|||
<div class="col-md-6"> |
|||
<label for="RetirementAmount" class="form-label fw-bold"> |
|||
Provisional Retirement Amount <span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="fifty" name="RetirementAmount" value="50" class="form-check-input" disabled> |
|||
<label for="fifty" class="form-check-label">50%</label> |
|||
</div> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="seventyfive" name="RetiremesntAmount" value="75" class="form-check-input" disabled> |
|||
<label for="seventyfive" class="form-check-label">75%</label> |
|||
</div> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="hundred" name="RetirementAmount" value="100" class="form-check-input" disabled> |
|||
<label for="hundred" class="form-check-label">100%</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Additional Input Field --> |
|||
<div class="mt-3" id="additionalInputDiv" style="display: none;"> |
|||
<input type="number" id="additionalInput" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="2" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#receivedprovisionalModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
// Handle Close button click |
|||
$('.close').click(function () { |
|||
$('#receivedprovisionalModal').modal('hide'); // Hide the modal |
|||
clearFields(); // Clear input fields |
|||
}); |
|||
|
|||
// Handle Back button click |
|||
$('#back').click(function () { |
|||
$('#receivedprovisionalModal').modal('hide'); // Hide the modal |
|||
clearFields(); // Clear input fields |
|||
}); |
|||
|
|||
// Function to clear input fields |
|||
/* function clearFields() { |
|||
$('#datefile').val(''); // Clear date input |
|||
$('#remarks').val(''); // Clear textarea |
|||
} */ |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#provisionalreason').val(employeeDetails.reason_for_provisional_pension); |
|||
|
|||
// Ensure employeeDetails exists |
|||
if (employeeDetails) { |
|||
let prPercentage = employeeDetails.pr_percentage; |
|||
let prAmount = employeeDetails.pr_amount || ''; |
|||
|
|||
// Convert pr_percentage to string to avoid type mismatches |
|||
prPercentage = prPercentage ? prPercentage.toString() : ''; |
|||
|
|||
// Reset any previously selected radio buttons (in case of multiple calls) |
|||
$('#fifty').prop('checked', false).prop('disabled', false); |
|||
$('#seventyfive').prop('checked', false).prop('disabled', false); |
|||
$('#hundred').prop('checked', false).prop('disabled', false); |
|||
|
|||
// Hide the additional input field initially |
|||
$('#additionalInputDiv').hide(); |
|||
|
|||
// Check if pr_percentage is a valid percentage |
|||
if (prPercentage === "50") { |
|||
// Select 50% radio button and disable all |
|||
$('#fifty').prop('checked', true).prop('disabled', true); |
|||
$('#seventyfive').prop('disabled', true); |
|||
$('#hundred').prop('disabled', true); |
|||
} else if (prPercentage === "75" || prPercentage === "75.00") { |
|||
// Select 75% radio button and disable all |
|||
$('#seventyfive').prop('checked', true).prop('disabled', true); |
|||
$('#fifty').prop('disabled', true); |
|||
$('#hundred').prop('disabled', true); |
|||
|
|||
// If pr_amount exists, set it in the additional input |
|||
$('#additionalInputDiv').show(); |
|||
$('#additionalInput').val(prAmount).prop('readonly', true); |
|||
} else if (prPercentage === "100") { |
|||
// Select 100% radio button and disable all |
|||
$('#hundred').prop('checked', true).prop('disabled', true); |
|||
$('#fifty').prop('disabled', true); |
|||
$('#seventyfive').prop('disabled', true); |
|||
} else { |
|||
// If pr_percentage is NOT 50, 75, or 100, show the additional input field |
|||
$('#additionalInputDiv').show(); |
|||
$('#additionalInput').val(prAmount).prop('readonly', true); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
// Populate Pending Duration and Reason fields |
|||
if (employeeDetails.pending_duration === "Yes") { |
|||
$('#yespen').prop('checked', true); // Check the Yes radio button |
|||
$('#clickyesdiv').show(); // Show the reason input |
|||
$('#Clickyes').val(employeeDetails.reason_for_pending || '').prop('readonly' ,true); // Set reason and make readonly |
|||
} else if (employeeDetails.pending_duration === "No") { |
|||
$('#nopen').prop('checked', true); // Check the No radio button |
|||
$('#clickyesdiv').hide(); // Hide the reason input |
|||
} |
|||
//populate reason for provisional pension |
|||
if (employeeDetails.reason_for_provisional_pension === "Others") { |
|||
$('#otherReasonDiv').show(); // Show the input field for 'Others' |
|||
$('#otherReason') |
|||
.val(employeeDetails.others_provisional_pension || '') |
|||
.prop('readonly' ,true); // Populate and make readonly |
|||
} else { |
|||
$('#otherReasonDiv').hide(); // Hide the input field if reason is not 'Others' |
|||
} |
|||
|
|||
// Handle DP value |
|||
if (employeeDetails.dp === "yes") { |
|||
$('#yes').prop('checked', true); // Select 'yes' radio button |
|||
} else if (employeeDetails.dp === "no") { |
|||
$('#no').prop('checked', true); // Select 'no' radio button |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#receivedprovisionalModal').modal('show'); |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
///history function to show in modal |
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,771 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#sec1 .col-md-4,.col-md-12{ |
|||
padding-top: 1%; |
|||
} |
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.col-md-6 .form-check{ |
|||
width: 25%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5> Retirement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Retirement</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Completed - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row" id="sec1"> |
|||
|
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-4"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-4"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Completed </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Department Benefits</span> |
|||
</div> |
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF</label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes" disabled> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no" disabled> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90" disabled> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount</label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes" disabled> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no" disabled> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount</label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes" disabled> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no" disabled> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount</label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready</label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</span> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="pensionNumber" class="form-label">Pension Number</label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number</label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes" disabled> |
|||
<label class="form-check-label" for="bpYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no" disabled> |
|||
<label class="form-check-label" for="bpNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="PbAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount</label> |
|||
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="DcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="DcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="dcrgAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount</label> |
|||
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation</label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes" disabled> |
|||
<label class="form-check-label" for="commutationYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no" disabled> |
|||
<label class="form-check-label" for="commutationNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="CommutationAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount</label> |
|||
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getpartialdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
$('#pensionNumber').val(employeeDetails.pension_number); |
|||
$('#ledgerNumber').val(employeeDetails.ledger_number); |
|||
|
|||
$('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_pension === "yes") { |
|||
$('#PbAmountDiv').show(); |
|||
$('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount); |
|||
} else { |
|||
$('#PbAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_dcrg === "yes") { |
|||
$('#dcrgAmountDiv').show(); |
|||
$('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount); |
|||
} else { |
|||
$('#dcrgAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_commutation === "yes") { |
|||
$('#CommutationAmountDiv').show(); |
|||
$('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount); |
|||
} else { |
|||
$('#CommutationAmountDiv').hide(); |
|||
} |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,934 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
/* Base Layout and Styling */ |
|||
|
|||
/* Base Layout and Styling */ |
|||
body { |
|||
font-family: 'Arial', sans-serif; |
|||
background-color: #f8f9fa; |
|||
} |
|||
|
|||
/* Card Styling */ |
|||
.card-box { |
|||
border-radius: 12px; |
|||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); |
|||
background-color: #ffffff; |
|||
padding: 20px; |
|||
transition: transform 0.3s ease-in-out; |
|||
} |
|||
|
|||
.card-box:hover { |
|||
transform: translateY(-5px); |
|||
} |
|||
|
|||
/* Title Styling */ |
|||
h3 { |
|||
font-size: 1.2rem; |
|||
color: #444; |
|||
} |
|||
|
|||
/* Styling for Overall Pendency and Stage Wise Sections */ |
|||
.charts { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
gap: 30px; /* Increased gap between charts */ |
|||
margin-top: 30px; /* Increased margin-top */ |
|||
} |
|||
|
|||
.chart { |
|||
flex: 1; |
|||
background: #ffffff; /* White background */ |
|||
padding: 20px; |
|||
border-radius: 8px; |
|||
border: 2px solid #1e90ff; /* Add a colored border */ |
|||
width: 100%; |
|||
box-sizing: border-box; |
|||
text-align: center; |
|||
transition: all 0.3s ease-in-out; |
|||
} |
|||
|
|||
.chart:hover { |
|||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.chart h3 { |
|||
font-size: 1.2rem; |
|||
color: #333; |
|||
margin-bottom: 15px; |
|||
} |
|||
|
|||
.chart canvas { |
|||
display: block; |
|||
max-width: 100%; |
|||
height: auto; |
|||
} |
|||
|
|||
/* Stats Cards */ |
|||
.stats { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
justify-content: center; |
|||
gap: 30px; /* Increased gap between stats cards */ |
|||
margin-top: 30px; /* Increased margin-top */ |
|||
} |
|||
|
|||
.stat-card { |
|||
background: #ffffff; |
|||
border: 2px solid #1e90ff; |
|||
padding: 20px; |
|||
border-radius: 8px; |
|||
text-align: center; |
|||
flex: 1; |
|||
margin: 10px; /* Reduced margin for cleaner look */ |
|||
} |
|||
|
|||
.stat-card:hover { |
|||
transform: scale(1.05); |
|||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.stat-card h2 { |
|||
margin: 0; |
|||
font-size: 36px; |
|||
color: #007bff; |
|||
} |
|||
|
|||
.stat-card p { |
|||
margin: 5px 0 0; |
|||
font-size: 13px; |
|||
color: #555; |
|||
font-weight:bold; |
|||
} |
|||
|
|||
/* Buttons */ |
|||
.btn-primary:hover { |
|||
background-color: #0056b3; |
|||
} |
|||
|
|||
.btn-warning:hover { |
|||
background-color: #e0a800; |
|||
} |
|||
|
|||
/* Container Styling */ |
|||
.container { |
|||
max-width: 1200px; |
|||
margin: 20px auto; |
|||
padding: 20px; |
|||
background: #fff; |
|||
border-radius: 8px; |
|||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); |
|||
} |
|||
|
|||
/* Date Input Row */ |
|||
.row.mt-3.ml-2 { |
|||
margin-top: 20px; /* Increased margin-top */ |
|||
} |
|||
|
|||
/* Responsive Design */ |
|||
@media (min-width: 768px) { |
|||
.charts { |
|||
flex-direction: row; |
|||
} |
|||
|
|||
.charts .chart { |
|||
width: calc(50% - 15px); /* Increased gap between charts */ |
|||
} |
|||
|
|||
.stats { |
|||
flex-direction: row; |
|||
} |
|||
} |
|||
|
|||
@media (max-width: 576px) { |
|||
.charts, |
|||
.stats { |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.stat-card { |
|||
margin: 15px 0; /* Increased margin for better spacing */ |
|||
} |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
#EmpcodeDetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
|
|||
<body> |
|||
<div class="wrapper"> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<div class="page-wrap"> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Dashboard</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item">Department Entries</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Dashboard</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row mt-4"> |
|||
<div class="col-md-12"> |
|||
|
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
|
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<div class="d-flex justify-content-end align-items-center"> |
|||
<label for="EmpCode" style="font-weight: bold; margin-right: 10px;" class="mb-0">EmpCode:</label> |
|||
<input type="text" id="EmpCode" name="EmpCode" class="form-control" style="width: auto; min-width: 150px; margin-right: 10px;"> |
|||
<button id="searchEmpButton" class="btn btn-primary">Search</button> |
|||
</div> |
|||
|
|||
<div class="row mt-3 ml-2 "> |
|||
<div class="col-md-3"> |
|||
<label for="startDate" class="form-label">From Date:</label> |
|||
<input type="date" id="startDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="endDate" class="form-label">To Date:</label> |
|||
<input type="date" id="endDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-12 d-flex justify-content-center mt-3"> |
|||
<button id="searchButton" class="btn btn-primary mx-2">Search</button> |
|||
<input type="reset" class="btn btn-warning mx-2" value="Reset"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="stats" class="stats"></div> |
|||
|
|||
<div class="charts"> |
|||
<div class="chart"> |
|||
<h3>File Category - Overall</h3> |
|||
<div id="overallPieChart" style="width: 100%; height: 400px;"></div> |
|||
|
|||
</div> |
|||
<div class="chart"> |
|||
<h3>File Category Stages Wise</h3> |
|||
<div id="stagesBarChart" style="width: 100%; height: 400px;"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
<!-- Modal --> |
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" |
|||
role="dialog" aria-labelledby="zoneDetailsModalLabel" |
|||
aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div id="zone-details-content"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="EmpcodeDetailsModal" tabindex="-1" |
|||
role="dialog" aria-labelledby="zoneDetailsModalLabel" |
|||
aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div id="emp-details-content"> |
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
File History will be dynamically loaded here |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
|||
|
|||
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script> |
|||
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script> |
|||
|
|||
<script src="/assets/node_modules/amcharts3/amcharts/pie.js"></script> |
|||
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script> |
|||
|
|||
<script> |
|||
document.addEventListener('DOMContentLoaded', function () { |
|||
// Function to fetch data from /dashboard endpoint |
|||
|
|||
$('#searchEmpButton').on('click', function () { |
|||
const Empcode = document.getElementById('EmpCode').value.trim(); |
|||
if (!Empcode) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Enter Employee Code", |
|||
text: "Please enter an Employee Code before searching.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// First API call to fetch employee details |
|||
$.ajax({ |
|||
url: `/fetchEmpDetails?Empcode=${Empcode}`, |
|||
type: 'GET', |
|||
success: function (response) { |
|||
if (!response || response.length === 0) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No records found for the entered Employee Code.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
const isGISEmployee = response.some(emp => emp.file_name === "GIS"); |
|||
|
|||
// Second API call to check department validity (only if not GIS) |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', |
|||
type: 'GET', |
|||
data: { empCode: Empcode }, |
|||
success: function (deptResponse) { |
|||
if (deptResponse.list && deptResponse.list.length > 0) { |
|||
let employeeDetails = deptResponse.list[0]; |
|||
const loggedInDeptId = $('#deptId').text().trim(); |
|||
|
|||
if (employeeDetails.ID_DEPT !== loggedInDeptId) { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Access Denied", |
|||
text: "This employee does not belong to your department.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} else { |
|||
renderEmpDetailsModal(response); |
|||
} |
|||
} else { |
|||
if (isGISEmployee) { |
|||
renderEmpDetailsModal(response); |
|||
} else { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching department details.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr) { |
|||
console.error("Error fetching employee details:", xhr.status, xhr.responseText); |
|||
} |
|||
}); |
|||
}); |
|||
function renderEmpDetailsModal(data) { |
|||
const Empcode = document.getElementById('EmpCode').value.trim(); |
|||
|
|||
|
|||
let modalContent = ` |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Employee Details for ${Empcode}</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="table-responsive"> |
|||
<table id="DashboardDatatable" class="table table-striped table-bordered table-hover dataTable"> |
|||
<thead class="thead-dark"> |
|||
<tr> |
|||
<th class="text-center">S.NO</th> |
|||
<th class="text-center">Department Name</th> |
|||
<th class="text-center">File Name</th> |
|||
<th class="text-center">File Status</th> |
|||
<th class="text-center">History</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
${data.map((item, index) => ` |
|||
<tr data-temp-id="${item.temp_id}"> |
|||
<td>${index + 1}</td> |
|||
<td>${item.dept_name}</td> |
|||
<td>${item.file_name}</td> |
|||
<td>${item.file_status}</td> |
|||
<td class="file-history-column" id="history-${item.temp_id}">Loading...</td> |
|||
</tr> |
|||
`).join('')} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
`; |
|||
|
|||
document.getElementById('emp-details-content').innerHTML = modalContent; |
|||
|
|||
|
|||
let fetchPromises = data.map(item => fetchDetailsByTempId(item.temp_id)); |
|||
|
|||
Promise.all(fetchPromises).then(() => { |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
|
|||
// **Initialize DataTable AFTER Data is Loaded** |
|||
setTimeout(() => { |
|||
let table = $('#DashboardDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [{ targets: 'no-sort', orderable: false }], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
|
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ |
|||
extend: 'copyHtml5', |
|||
text: 'Copy', |
|||
className: 'btn btn-secondary', |
|||
exportOptions: { columns: ':visible', modifier: { page: 'all' } } |
|||
}, |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Excel', |
|||
className: 'btn btn-secondary', |
|||
customize: function (xlsx) { |
|||
let sheet = xlsx.xl.worksheets['sheet1.xml']; |
|||
$('row c[r]', sheet).attr('s', '55'); // Apply word-wrap formatting |
|||
} |
|||
}, |
|||
{ |
|||
extend: 'csvHtml5', |
|||
text: 'CSV', |
|||
className: 'btn btn-secondary', |
|||
exportOptions: { columns: ':visible' } |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
className: 'btn btn-secondary', |
|||
orientation: 'landscape', |
|||
pageSize: 'A4', |
|||
customize: function (doc) { |
|||
doc.styles.tableBodyEven.alignment = 'left'; |
|||
doc.styles.tableBodyOdd.alignment = 'left'; |
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.fontSize = 9; |
|||
doc.styles.tableHeader.fontSize = 10; |
|||
doc.content[1].table.widths = Array(doc.content[1].table.body[0].length + 1).join('*').split(''); |
|||
} |
|||
} |
|||
], |
|||
responsive: false, |
|||
processing: false |
|||
}); |
|||
|
|||
// ✅ Adjust column width after table is fully initialized |
|||
|
|||
}, 200); |
|||
}); |
|||
} |
|||
|
|||
// **Ensure Header Aligns Properly When Modal is Opened** |
|||
|
|||
|
|||
// **Fetch History & Update Table** |
|||
function fetchDetailsByTempId(tempId) { |
|||
return new Promise((resolve, reject) => { |
|||
$.ajax({ |
|||
url: `/fetchTempDetails?tempId=${tempId}`, |
|||
type: 'GET', |
|||
success: function (response) { |
|||
let historyContainer = $(`#history-${tempId}`); |
|||
if (response.length > 0) { |
|||
let historyHtml = response.map(item => ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.file_moved_date)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.file_status}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarks || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`).join(''); |
|||
historyContainer.html(historyHtml); |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
$('#EmpcodeDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#EmpcodeDetailsModal').modal('hide'); |
|||
}); |
|||
} else { |
|||
historyContainer.html('<p>No file history available.</p>'); |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
$('#EmpcodeDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#EmpcodeDetailsModal').modal('hide'); |
|||
}); |
|||
} |
|||
resolve(); |
|||
}, |
|||
error: function () { |
|||
$(`#history-${tempId}`).html('<p>Failed to load file history.</p>'); |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
$('#EmpcodeDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#EmpcodeDetailsModal').modal('hide'); |
|||
}); |
|||
resolve(); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
// **Helper Function to Format Date** |
|||
function formatDateTime(dateString) { |
|||
const options = { day: '2-digit', month: '2-digit', year: 'numeric' }; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
function loadDashboardData() { |
|||
const deptId = $('#deptId').text().trim(); |
|||
console.log(deptId); |
|||
|
|||
$.ajax({ |
|||
url: `/deparmentdashboard?deptId=${encodeURIComponent(deptId)}`, |
|||
type: 'GET', |
|||
contentType: 'application/json', |
|||
success: function (data) { |
|||
const statsDiv = document.getElementById('stats'); |
|||
statsDiv.innerHTML = ''; // Clear previous stats |
|||
|
|||
data.forEach(item => { |
|||
const statCard = document.createElement('div'); |
|||
statCard.className = 'stat-card'; |
|||
statCard.innerHTML = ` |
|||
<h2>${item.category_count}</h2> |
|||
<p>${item.file_name}</p> |
|||
`; |
|||
statsDiv.appendChild(statCard); |
|||
}); |
|||
|
|||
// Call renderCharts after data is loaded |
|||
renderCharts(); |
|||
}, |
|||
error: function (xhr) { |
|||
console.error('Error fetching dashboard data:', xhr.status, xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to handle search button click |
|||
document.getElementById('searchButton').addEventListener('click', function () { |
|||
const startDate = document.getElementById('startDate').value; |
|||
const endDate = document.getElementById('endDate').value; |
|||
const deptId = $('#deptId').text().trim(); |
|||
|
|||
if (!startDate || !endDate) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Incomplete Search", |
|||
text: "Please select the Date Before searching", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} else { |
|||
$.ajax({ |
|||
url: `/dashboardsearch?startdate=${startDate}&enddate=${endDate}&deptId=${encodeURIComponent(deptId)}`, |
|||
type: 'GET', |
|||
success: function (data) { |
|||
const statsDiv = document.getElementById('stats'); |
|||
statsDiv.innerHTML = data.map(item => ` |
|||
<div class='stat-card'> |
|||
<h2>${item.category_count}</h2> |
|||
<p>${item.file_name}</p> |
|||
</div> |
|||
`).join(''); |
|||
|
|||
// Re-render charts after search results load |
|||
renderCharts(startDate, endDate); |
|||
}, |
|||
error: function (xhr) { |
|||
console.error('Error fetching search data:', xhr.status, xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
// Function to validate and set min-date for endDate |
|||
function validateEndDate() { |
|||
const startDate = document.getElementById('startDate').value; |
|||
const endDateInput = document.getElementById('endDate'); |
|||
|
|||
if (startDate) { |
|||
const startDateObj = new Date(startDate); |
|||
const minEndDateISO = startDateObj.toISOString().split('T')[0]; |
|||
endDateInput.setAttribute('min', minEndDateISO); |
|||
|
|||
// Clear endDate if it's less than startDate |
|||
if (endDateInput.value && new Date(endDateInput.value) < startDateObj) { |
|||
endDateInput.value = ''; |
|||
} |
|||
} |
|||
} |
|||
|
|||
document.getElementById('startDate').addEventListener('change', validateEndDate); |
|||
|
|||
function renderCharts(startDate = null, endDate = null) { |
|||
const deptId = $('#deptId').text().trim(); |
|||
|
|||
// Dispose existing amCharts instances |
|||
disposeExistingCharts(); |
|||
|
|||
function disposeExistingCharts() { |
|||
if (window.chart1) { |
|||
window.chart1.clear(); |
|||
window.chart1 = null; |
|||
} |
|||
if (window.chart2) { |
|||
window.chart2.clear(); |
|||
window.chart2 = null; |
|||
} |
|||
} |
|||
|
|||
// Render pie chart |
|||
const fixedColors = { |
|||
"Retirement": "#6A0572", // Deep Purple |
|||
"Family Pension": "#2C3E50", // Dark Blue-Gray |
|||
"Pendency": "#A569BD", // Soft Lavender |
|||
"GIS": "#17A589", // Teal Green |
|||
"Provisional Retirement": "#D35400", // Warm Orange |
|||
"Contributory Pension Scheme": "#5D6D7E" // Muted Gray-Blue |
|||
}; |
|||
|
|||
$.ajax({ |
|||
url: `/categoryCounts`, |
|||
type: 'GET', |
|||
data: { deptId, startDate, endDate }, |
|||
dataType: 'json', |
|||
success: function (data) { |
|||
const chartData = data.map((item, index) => ({ |
|||
category: item.file_name, |
|||
value: item.category_count, |
|||
color: fixedColors[item.file_name], // Assign colors cyclically |
|||
id: item.id |
|||
})); |
|||
|
|||
window.chart1 = AmCharts.makeChart("overallPieChart", { |
|||
type: "pie", |
|||
theme: "dark", |
|||
dataProvider: chartData, |
|||
valueField: "value", |
|||
titleField: "category", |
|||
colorField: "color", |
|||
radius: "40%", |
|||
innerRadius: "50%", |
|||
labelText: "[[[[title]]]] - [[[[value]]]]", |
|||
fontSize: 14, |
|||
|
|||
labelsEnabled: true, |
|||
pullOutRadius: 0, |
|||
|
|||
gradientRatio: [-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, 0, 0.1, 0.2, 0.1, 0, -0.2, -0.5], |
|||
export: { |
|||
enabled: true, |
|||
}, |
|||
responsive: { |
|||
enabled: true, |
|||
}, |
|||
|
|||
legend: { |
|||
position: "bottom", |
|||
markerType: "circle", |
|||
valueText: "[[[[value]]]]", |
|||
switchable: false, |
|||
markerSize: 12, |
|||
fontSize: 12 |
|||
|
|||
|
|||
}, |
|||
balloon: { |
|||
fixedPosition: true |
|||
}, |
|||
listeners: [ |
|||
{ |
|||
event: "clickSlice", |
|||
method: function (event) { |
|||
const FileId = event.dataItem.dataContext.id; |
|||
const FileNumber = event.dataItem.dataContext.category; |
|||
fetchempno(FileId, FileNumber); |
|||
} |
|||
} |
|||
] |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("AJAX Request Failed:", status, error); |
|||
console.error("Response Text:", xhr.responseText); |
|||
} |
|||
}); |
|||
|
|||
function fetchempno(FileId, FileNumber) { |
|||
$.ajax({ |
|||
url: `/getEmpNoByFileName?file_id=${FileId}`, |
|||
type: 'GET', |
|||
success: function (response) { |
|||
renderEmpNoModal(FileNumber, response); |
|||
}, |
|||
error: function (xhr) { |
|||
console.error("Error fetching region details:", xhr.status, xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function renderEmpNoModal(FileNumber, empNos) { |
|||
console.log(empNos); |
|||
const modalContent = ` |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Employee Numbers for ${FileNumber}</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<table class="table table-bordered"> |
|||
<thead> |
|||
<tr><th>Employee Number</th></tr> |
|||
</thead> |
|||
<tbody> |
|||
${empNos.map(empNo => `<tr><td>${empNo.emp_no}</td></tr>`).join('')} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
`; |
|||
|
|||
document.getElementById('zone-details-content').innerHTML = modalContent; |
|||
// $('#zoneDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#zoneDetailsModal').modal('hide'); |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
function getRandomColor() { |
|||
const letters = '0123456789ABCDEF'; |
|||
let color = '#'; |
|||
for (let i = 0; i < 6; i++) { |
|||
color += letters[Math.floor(Math.random() * 16)]; |
|||
} |
|||
return color; |
|||
} |
|||
|
|||
// Render bar chart |
|||
$.ajax({ |
|||
url: `/stageWiseCounts`, |
|||
type: 'GET', |
|||
data: { deptId, startDate, endDate }, |
|||
dataType: 'json', |
|||
success: function (data) { |
|||
const colorMapping = { |
|||
"Audit Pending": "#FF5733", |
|||
"Department Pending": "#FFC300", |
|||
"Pension Pending": "#28B463", |
|||
"Completed": "#3498DB" |
|||
}; |
|||
|
|||
const chartData = data.map(item => ({ |
|||
category: item.category, |
|||
value: item.category_count, |
|||
color: colorMapping[item.category] || '#D3D3D3' |
|||
})); |
|||
|
|||
window.chart2 = AmCharts.makeChart("stagesBarChart", { |
|||
type: "serial", |
|||
theme: "light", |
|||
dataProvider: chartData, |
|||
depth3D: 2, |
|||
angle: 10, |
|||
valueAxes: [{ |
|||
axisAlpha: 0, |
|||
gridAlpha: 0, |
|||
labelsEnabled: false, |
|||
dashLength: 0 |
|||
}], |
|||
startDuration: 1, |
|||
startEffect: "easeInSine", |
|||
graphs: [{ |
|||
balloonText: "[[[[category]]]]: [[[[value]]]]", |
|||
fillAlphas: 0.8, |
|||
lineAlpha: 0.3, |
|||
topRadius: 1, |
|||
type: "column", |
|||
valueField: "value", |
|||
fillColorsField: "color", |
|||
columnWidth: 0.5, |
|||
labelText: "[[[[value]]]]", |
|||
labelPosition: "right", |
|||
fontSize: 14, |
|||
color: "#000000" |
|||
|
|||
}], |
|||
categoryField: "category", |
|||
categoryAxis: { |
|||
gridPosition: "start", |
|||
gridAlpha: 0, |
|||
autoWrap: false, |
|||
axisAlpha: 0, |
|||
fontSize: 14, // Increases the category label size |
|||
// Makes category labels bold |
|||
labelRotation: 0 |
|||
|
|||
}, |
|||
rotate: true, |
|||
export: { |
|||
enabled: true, |
|||
position: "bottom-right" |
|||
} |
|||
}); |
|||
|
|||
console.log("Stages Bar Chart Data:", chartData); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("AJAX Request Failed:", status, error); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Initial data load |
|||
loadDashboardData(); |
|||
document.querySelector("input[type='reset']").addEventListener('click', function () { |
|||
window.location.href = "/gcc/department/dashboard"; |
|||
}); |
|||
|
|||
}) |
|||
|
|||
|
|||
</script> |
|||
</body> |
|||
|
|||
</html> |
|||
1230
frontend/pensioner/department/fileclosing.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,946 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
.card-block { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.form-label { |
|||
margin-bottom: 0.5rem; |
|||
} |
|||
|
|||
input.form-control { |
|||
padding: 10px; |
|||
} |
|||
.form-select { |
|||
padding: 10px; |
|||
height: 40px; |
|||
} |
|||
|
|||
#employeeCard label{ |
|||
padding-top: 2%; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Department Entries</h5> |
|||
<span>Contributory Pension Scheme</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">NewEntry</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Contributory Pension Scheme</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4" > |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">New Entry - Contributory Pension</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div class="row mb-4"> |
|||
|
|||
<!-- Input Fields for Year Selection --> |
|||
<!-- Start Year Dropdown as Button Dropdown --> |
|||
<div class="col-md-4" > |
|||
<label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label> |
|||
|
|||
<div class="dropdown"> |
|||
<input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required> |
|||
<small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mt-20"> |
|||
<button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button> |
|||
<!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="row mb-4" id="employeeCard" style="display: none;"> |
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">New Entry - Contributory Pension - <span id="EmployeeCode"></span></h5> |
|||
<hr> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Designation" class="form-label fw-bold">Designation<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label> |
|||
<div class="dropdown" > |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<div class="dropdown" > |
|||
<select id="retirement" class="form-select" style="width: 100%;" required> |
|||
|
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="filesentuac" class="form-label fw-bold"> |
|||
Whether file sent to UAC (if yes, Date) |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="filesentuac" class="form-check-input" value="yes"> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<br> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="filesentuac" class="form-check-input" value="no"> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="dropdown" id="dateInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="date" id="dateInput" name="filesentuac_date" class="form-control" onclick="this.showPicker()" > |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="pendingDurationYes" name="pendingDuration" value="yes" class="form-check-input"> |
|||
<label for="pendingDurationYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="pendingDurationNo" name="pendingDuration" value="no" class="form-check-input"> |
|||
<label for="pendingDurationNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="cpsamount" class="form-label fw-bold"> |
|||
Whether CPS Amount Settled |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes1" name="cpsamount" class="form-check-input" value="yes"> |
|||
<label for="yes1" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no1" name="cpsamount" class="form-check-input" value="no"> |
|||
<label for="no1" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="cpsAmountInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="number" id="cpsAmountInput" name="cpsamount_value" class="form-control" |
|||
placeholder="Enter CPS Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="elamount" class="form-label fw-bold"> |
|||
Whether EL/LPA Amount Settled |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes2" name="elamount" class="form-check-input" value="yes"> |
|||
<label for="yes2" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no2" name="elamount" class="form-check-input" value="no"> |
|||
<label for="no2" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="elAmountInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="number" id="elAmountInput" name="elamount_value" class="form-control" |
|||
placeholder="Enter EL/LPA Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="spfgsamount" class="form-label fw-bold"> |
|||
Whether SPFGS Amount Settled |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes3" name="spfgsamount" class="form-check-input" value="yes"> |
|||
<label for="yes3" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no3" name="spfgsamount" class="form-check-input" value="no"> |
|||
<label for="no3" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="spfgsAmountInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="number" id="spfgsAmountInput" name="spfgsamount_value" class="form-control" |
|||
placeholder="Enter SPFGS Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12"> |
|||
<label for="Remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here" required></textarea> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-12 d-flex justify-content-center"> |
|||
<button id="lfauditButton" class="btn btn-primary mt-2 mx-2">Submit</button> |
|||
<button id="cancelButton" class="btn btn-secondary mt-2">Cancel</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function (){ |
|||
|
|||
// Handle Search button click |
|||
$('#searchButton').on('click', function () { |
|||
const empCode = $('#empCode').val(); |
|||
|
|||
console.log("empCode",empCode); |
|||
|
|||
if (empCode) { |
|||
$('#pageLoader').show(); |
|||
document.getElementById("employeeCard").style.display = "block"; |
|||
}else{ |
|||
|
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
//document.getElementById("newemployeeCard").style.display = "block"; |
|||
return; // Stop further execution if empCode is not provided |
|||
} |
|||
|
|||
// Format dates to dd-MM-yyyy |
|||
|
|||
$('#pageLoader').show(); |
|||
$('#employeeCard').hide(); |
|||
$('#newemployeeCard').hide(); |
|||
|
|||
$('#retirement').val(''); |
|||
$('#dateInput').val(''); |
|||
$('#remarks').val(''); |
|||
$('#pendingDurationInput').val(''); |
|||
$('#cpsAmountInput').val(''); |
|||
$('#elAmountInput').val(''); |
|||
$('#spfgsAmountInput').val(''); |
|||
$('input[name="filesentuac"]').prop('checked', false); |
|||
$('input[name="pendingDuration"]').prop('checked', false); |
|||
$('input[name="cpsamount"]').prop('checked', false); |
|||
$('input[name="elamount"]').prop('checked', false); |
|||
$('input[name="spfgsamount"]').prop('checked', false); |
|||
// Call the API |
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/cpsexists', // Endpoint to check existence |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (existsResponse) { |
|||
console.log("Exists API Response:", existsResponse); |
|||
$('#pageLoader').hide(); // Hide loader after the first API response |
|||
|
|||
if (existsResponse && existsResponse.exists) { |
|||
console.log(`Employee Code ${empCode} exists in the database.`); |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Already Exists", |
|||
text: "This employee number already exists.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; // Exit if employee already exists |
|||
} |
|||
|
|||
|
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', // Correct API URL |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
console.log("response:", response.list); |
|||
if (response.list && response.list.length > 0) { |
|||
// Clear existing data |
|||
let employeeDetails = response.list[0]; |
|||
console.log("employeedetails",response); |
|||
|
|||
const loggedInDeptId = $('#deptId').text().trim(); // Get logged-in deptId dynamically |
|||
|
|||
// Validate department ID |
|||
if (employeeDetails.ID_DEPT !== loggedInDeptId) { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Access Denied", |
|||
text: "This employee does not belong to your department. Please try again with a valid employee code.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-danger" |
|||
} |
|||
}); |
|||
return; // Exit if the department does not match |
|||
} |
|||
|
|||
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|||
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); |
|||
$('#department').val(employeeDetails.DEPARTMENT); |
|||
$('#designation').val(employeeDetails.DESIGNATION); |
|||
$('#classes').val(employeeDetails.GROUP_TYPE); |
|||
$('#retrirementdate').val(employeeDetails.RETIREMENT_DATE); |
|||
|
|||
$('#EmployeeCode').text(empCode); |
|||
//show the modal |
|||
$('#employeeCard').show(); |
|||
|
|||
|
|||
} else { |
|||
//$('#pageLoader').hide(); |
|||
//document.getElementById("newemployeeCard").style.display = "block"; |
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
|
|||
} |
|||
}); |
|||
|
|||
//document.getElementById("newemployeeCard").style.display = "block"; // Show the new employee card |
|||
} |
|||
|
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); // Hide loader on error |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
}) |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
function loadRetirementTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getRetrimentTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#retirement"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
if (entry.retriment_type !== "Provisional") { // Exclude "Provisional" |
|||
dropdown.append($('<option></option>').attr('value', entry.retriment_type).text(entry.retriment_type)); |
|||
} |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementTypes(); |
|||
}); |
|||
|
|||
|
|||
// Trigger search on pressing Enter key |
|||
$('#empCode').on('keydown', function (event) { |
|||
if (event.key === 'Enter') { |
|||
event.preventDefault(); // Prevent default form submission or page reload |
|||
|
|||
const empCode = $('#empCode').val(); // Get the value of empCode |
|||
if (!empCode) { |
|||
// Show Swal alert if the employee number is missing |
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
return; // Stop further execution |
|||
} |
|||
|
|||
$('#searchButton').click(); // Trigger the click event of the search button |
|||
} |
|||
}); |
|||
|
|||
// Handle close button click |
|||
$('#cancelButton').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
document.getElementById('dateInputContainer').style.display = 'none'; |
|||
document.getElementById('pendingDurationInputContainer').style.display = 'none'; |
|||
document.getElementById('cpsAmountInputContainer').style.display = 'none'; |
|||
document.getElementById('elAmountInputContainer').style.display = 'none'; |
|||
document.getElementById('spfgsAmountInputContainer').style.display = 'none'; |
|||
// Hide the card |
|||
$('#employeeCard').hide(); |
|||
}); |
|||
|
|||
// Handle close button click |
|||
$('#cancelButtonnew').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
|
|||
$('#newemployeeCard').hide(); |
|||
}); |
|||
|
|||
// Set the max attribute to today's date to disable future dates |
|||
document.addEventListener("DOMContentLoaded", function () { |
|||
let today = new Date().toISOString().split("T")[0]; |
|||
document.getElementById("dateInput").setAttribute("max", today); |
|||
}); |
|||
|
|||
document.querySelectorAll('input[name="filesentuac"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const dateInputContainer = document.getElementById('dateInputContainer'); |
|||
if (this.value === 'yes') { |
|||
dateInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
dateInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('dateInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
document.querySelectorAll('input[name="pendingDuration"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const pendingDurationInputContainer = document.getElementById('pendingDurationInputContainer'); |
|||
if (this.value === 'yes') { |
|||
pendingDurationInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
pendingDurationInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('pendingDurationInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
document.querySelectorAll('input[name="cpsamount"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const cpsAmountInputContainer = document.getElementById('cpsAmountInputContainer'); |
|||
if (this.value === 'yes') { |
|||
cpsAmountInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
cpsAmountInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('cpsAmountInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
document.querySelectorAll('input[name="elamount"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const elAmountInputContainer = document.getElementById('elAmountInputContainer'); |
|||
if (this.value === 'yes') { |
|||
elAmountInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
elAmountInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('elAmountInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
document.querySelectorAll('input[name="spfgsamount"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const spfgsAmountInputContainer = document.getElementById('spfgsAmountInputContainer'); |
|||
if (this.value === 'yes') { |
|||
spfgsAmountInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
spfgsAmountInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('spfgsAmountInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function validatePositiveNumber(input) { |
|||
if (input.value < 1) { |
|||
input.value = ""; |
|||
} |
|||
} |
|||
|
|||
function saveNewEntryDetailsPensionScheme() { |
|||
|
|||
let selecteduacValue = $('input[name="filesentuac"]:checked').val(); |
|||
let uacDate = null; |
|||
|
|||
if (selecteduacValue === 'yes') { |
|||
uacDate = $('#dateInput').val(); |
|||
if (!uacDate) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please Enter UAC Date', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; // Stop further execution if validation fails |
|||
} |
|||
} |
|||
|
|||
let pendingDuration= $('input[name="pendingDuration"]:checked').val(); |
|||
let pendingDurationReason=null; |
|||
if (pendingDuration === 'yes' ) { |
|||
pendingDurationReason = $('#pendingDurationInput').val(); // Retrieve the amount if available, else null |
|||
if (!pendingDurationReason) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please Enter Pending Reason', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; // Stop further execution if validation fails |
|||
} |
|||
} |
|||
|
|||
|
|||
let selcpsamount = $('input[name="cpsamount"]:checked').val(); |
|||
let selcpsamountval = null; |
|||
|
|||
if (selcpsamount === 'yes') { |
|||
selcpsamountval = $('#cpsAmountInput').val(); |
|||
if (!selcpsamountval || selcpsamountval <= 0) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please enter a valid CPS Amount greater than zero', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return ; // Stop further execution |
|||
} |
|||
} |
|||
|
|||
let selelamount = $('input[name="elamount"]:checked').val(); |
|||
let selelamountval = null; |
|||
|
|||
if (selelamount === 'yes') { |
|||
selelamountval = $('#elAmountInput').val(); |
|||
if (!selelamountval || selelamountval <= 0) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please enter a valid EL/LPA Amount greater than zero', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return ; // Stop further execution |
|||
} |
|||
} |
|||
|
|||
|
|||
let selspfgsamount = $('input[name="spfgsamount"]:checked').val(); |
|||
let selspfgsamountval = null; |
|||
|
|||
if (selspfgsamount === 'yes') { |
|||
selspfgsamountval = $('#spfgsAmountInput').val().trim(); // Trim input to remove spaces |
|||
|
|||
if (!selspfgsamountval || selspfgsamountval <= 0) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please enter a valid SPFGS Amount greater than zero', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; // Stop further execution if validation fails |
|||
} |
|||
} |
|||
|
|||
|
|||
// Collecting input values |
|||
let entryDetails = { |
|||
empNo: $('#employeeno').val(), |
|||
empName: $('#employeename').val(), |
|||
deptName: $('#department').val(), |
|||
designation: $('#designation').val(), |
|||
classes: $('#classes').val(), |
|||
fileMovedBy: $('#userId').text().trim(), |
|||
remarks: $('#remarks').val(), |
|||
retirementType: $('#retirement').val(), |
|||
uac: selecteduacValue, |
|||
uacDate: uacDate, |
|||
|
|||
pendingDuration: pendingDuration, |
|||
reasonPending: pendingDurationReason, |
|||
cps: selcpsamount, |
|||
cpsAmount: selcpsamountval, |
|||
elOrLpa: selelamount, |
|||
elOrLpaAmount:selelamountval, |
|||
spfgs: selspfgsamount, |
|||
spfgsAmount: selspfgsamountval, |
|||
deptId: $('#deptId').text().trim(), |
|||
filecategory:$('#filecategory').text().trim() |
|||
}; |
|||
|
|||
|
|||
if(!entryDetails.retirementType){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Type of Retirement is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if(!entryDetails.uac){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'uac is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if(!entryDetails.pendingDuration){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Pending Duration is required!.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if(!entryDetails.cps){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'CPS is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if(!entryDetails.elOrLpa){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'EL/LPA is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if(!entryDetails.spfgs){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if(!entryDetails.remarks){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
console.log("entrydetails:>>", entryDetails); |
|||
|
|||
$('#lfauditButton').prop('disabled', true).text('Processing...'); |
|||
|
|||
// AJAX call to save data |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/saveEmployeeDetailsPensionScheme', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#lfauditButton').prop('disabled', false).text('Submit'); |
|||
console.log("saveddetails:",entryDetails); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#lfauditButton').prop('disabled', false).text('Submit'); |
|||
window.location.href = '/gcc/department/newentry/contributorypensionscheme'; |
|||
console.log('Continue clicked'); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#lfauditButton').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
$('#lfauditButton').off('click').on('click', saveNewEntryDetailsPensionScheme); |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,886 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
.card-block { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.form-label { |
|||
margin-bottom: 0.5rem; |
|||
} |
|||
|
|||
input.form-control { |
|||
padding: 10px; |
|||
} |
|||
.form-select { |
|||
padding: 10px; |
|||
height: 40px; |
|||
} |
|||
|
|||
#employeeCard label{ |
|||
padding-top: 2%; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Department Entries</h5> |
|||
<span>Family Pension</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">NewEntry</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4" > |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> New Entry - Family Pension</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div class="row mb-4"> |
|||
|
|||
<!-- Input Fields for Year Selection --> |
|||
|
|||
<!-- Start Year Dropdown as Button Dropdown --> |
|||
<!-- Start Year Dropdown as Button Dropdown --> |
|||
<div class="col-md-4" > |
|||
<label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label> |
|||
|
|||
<div class="dropdown"> |
|||
<input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required> |
|||
<small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mt-20" > |
|||
<button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button> |
|||
<!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="row mb-4" id="employeeCard" style="display: none;"> |
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">New Entry - Family Pension - <span id="EmployeeCode"></span></h5> |
|||
<hr> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Designation" class="form-label fw-bold">Designation<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- pending duration--> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input"> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input"> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While In Service Death <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="date" id="servicedeath" class="form-control" onclick="this.showPicker()" > |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="deceased" class="form-label fw-bold">Relationship of Deceased<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="deceased" class="form-control" > |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="number" id="sanctionedgis" class="form-control" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Audit File" class="form-label fw-bold">Date file sent to Audit<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="filesentdate" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12"> |
|||
<label for="Remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here" required></textarea> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-12 d-flex justify-content-center"> |
|||
<button id="lfauditButton" class="btn btn-primary mt-2 mx-2">Mark as sent audit</button> |
|||
<button id="cancelButton" class="btn btn-secondary mt-2">Cancel</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function (){ |
|||
|
|||
// Handle Search button click |
|||
/* $('#searchButton').on('click', function () { |
|||
const empCode = $('#empCode').val(); |
|||
|
|||
console.log("empCode",empCode); |
|||
|
|||
if (empCode) { |
|||
$('#pageLoader').show(); |
|||
document.getElementById("employeeCard").style.display = "block"; |
|||
}else{ |
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Format dates to dd-MM-yyyy |
|||
|
|||
//$('#pageLoader').show(); |
|||
$('#pageLoader').show(); |
|||
$('#employeeCard').hide(); |
|||
$('#newemployeeCard').hide(); |
|||
|
|||
$('#servicedeath').val(''); |
|||
$('#sanctionedgis').val(''); |
|||
$('#deceased').val(''); |
|||
//$('#filesentdate').val(''); |
|||
$('#remarks').val(''); |
|||
// Call the API |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', // Correct API URL |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
console.log("response:", response.list); |
|||
if (response.list && response.list.length > 0) { |
|||
// Clear existing data |
|||
let employeeDetails = response.list[0]; |
|||
console.log("employeedetails",response); |
|||
// Check if the employee code is null or not found |
|||
const loggedInDeptId = $('#deptId').text().trim(); // Get logged-in deptId dynamically |
|||
|
|||
// Validate department ID |
|||
if (employeeDetails.ID_DEPT !== loggedInDeptId) { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Access Denied", |
|||
text: "This employee does not belong to your department. Please try again with a valid employee code.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-danger" |
|||
} |
|||
}); |
|||
return; // Exit if the department does not match |
|||
} |
|||
|
|||
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|||
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); |
|||
$('#department').val(employeeDetails.DEPARTMENT); |
|||
$('#designation').val(employeeDetails.DESIGNATION); |
|||
$('#classes').val(employeeDetails.GROUP_TYPE); |
|||
$('#retrirementdate').val(employeeDetails.RETIREMENT_DATE); |
|||
|
|||
$('#EmployeeCode').text(empCode); |
|||
//show the modal |
|||
$('#employeeCard').show(); |
|||
|
|||
|
|||
|
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
|
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number. Please create a new one to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
|
|||
//document.getElementById("newemployeeCard").style.display = "block"; // Show the new employee card |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}); */ |
|||
|
|||
/* document.getElementById('lfauditButton').addEventListener('click', function () { |
|||
// Trigger the save function when the button is clicked |
|||
saveFamilyPensionDetails(); |
|||
}); */ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
$('#searchButton').on('click', function () { |
|||
const empCode = $('#empCode').val().trim(); |
|||
console.log("empCode:", empCode); |
|||
|
|||
if (!empCode) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
console.log("No Employee Code provided. Aborting search."); |
|||
return; |
|||
} |
|||
|
|||
// Show loader and hide any existing employee cards |
|||
$('#pageLoader').show(); |
|||
$('#employeeCard').hide(); |
|||
$('#newemployeeCard').hide(); |
|||
|
|||
// Clear any form fields that need resetting |
|||
$('#servicedeath').val(''); |
|||
$('#sanctionedgis').val(''); |
|||
$('#deceased').val(''); |
|||
//$('#filesentdate').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// STEP 1: Check if the employee already exists in the database |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/familypensionexists', // Endpoint to check existence |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (existsResponse) { |
|||
console.log("Exists API Response:", existsResponse); |
|||
$('#pageLoader').hide(); // Hide loader after the first API response |
|||
|
|||
if (existsResponse && existsResponse.exists) { |
|||
console.log(`Employee Code ${empCode} exists in the database.`); |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Already Exists", |
|||
text: "This employee number already exists.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; // Exit if employee already exists |
|||
} |
|||
|
|||
// STEP 2: Since the employee does not exist, fetch employee details |
|||
$('#pageLoader').show(); // Show loader for the second API call |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', // Correct API URL |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
console.log("Employee Details API Response:", response.list); |
|||
if (response.list && response.list.length > 0) { |
|||
// Extract employee details |
|||
let employeeDetails = response.list[0]; |
|||
console.log("Employee Details:", employeeDetails); |
|||
|
|||
|
|||
// Validate department ID |
|||
const loggedInDeptId = $('#deptId').text().trim(); // Get logged-in deptId dynamically |
|||
if (employeeDetails.ID_DEPT !== loggedInDeptId) { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Access Denied", |
|||
text: "This employee does not belong to your department. Please try again with a valid employee code.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-danger" |
|||
} |
|||
}); |
|||
return; // Exit if the department does not match |
|||
} |
|||
|
|||
|
|||
const currentDate = $('#filesentdate').val().trim(); |
|||
|
|||
if(employeeDetails.RETIREMENT_DATE <= currentDate){ |
|||
|
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Not Applicable", |
|||
text: "This employee not applicable for this familypension.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Populate the form fields with the employee details |
|||
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|||
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); |
|||
$('#department').val(employeeDetails.DEPARTMENT); |
|||
$('#designation').val(employeeDetails.DESIGNATION); |
|||
$('#classes').val(employeeDetails.GROUP_TYPE); |
|||
$('#retrirementdate').val(employeeDetails.RETIREMENT_DATE); |
|||
$('#EmployeeCode').text(empCode); |
|||
|
|||
// Show the employee details card/modal |
|||
$('#employeeCard').show(); |
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
// Optionally, show the new employee card: |
|||
// document.getElementById("newemployeeCard").style.display = "block"; |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while checking the employee. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
//$('#lfauditButton').one('click', saveFamilyPensionDetails); |
|||
|
|||
$('#lfauditButton').off('click').on('click', saveFamilyPensionDetails); |
|||
|
|||
}) |
|||
|
|||
|
|||
function validatePositiveNumber(input) { |
|||
if (input.value < 1) { |
|||
input.value = ""; |
|||
} |
|||
} |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("filesentdate").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
// Trigger search on pressing Enter key |
|||
$('#empCode').on('keydown', function (event) { |
|||
if (event.key === 'Enter') { |
|||
event.preventDefault(); // Prevent default form submission or page reload |
|||
|
|||
const empCode = $('#empCode').val(); // Get the value of empCode |
|||
if (!empCode) { |
|||
// Show Swal alert if the employee number is missing |
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
return; // Stop further execution |
|||
} |
|||
|
|||
$('#searchButton').click(); // Trigger the click event of the search button |
|||
} |
|||
}); |
|||
|
|||
// Handle close button click |
|||
$('#cancelButton').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
|
|||
// Hide the card |
|||
$('#employeeCard').hide(); |
|||
}); |
|||
|
|||
// Handle close button click |
|||
$('#cancelButtonnew').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
|
|||
$('#newemployeeCard').hide(); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
function saveFamilyPensionDetails() { |
|||
|
|||
|
|||
let pendingDuration= $('input[name="pendingDuration"]:checked').val(); |
|||
let pendingDurationReason=null; |
|||
if (pendingDuration === 'yes' ) { |
|||
pendingDurationReason = $('#pendingDurationInput').val(); // Retrieve the amount if available, else null |
|||
if (!pendingDurationReason) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please Enter Pending Duration', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; // Stop further execution if validation fails |
|||
} |
|||
} |
|||
|
|||
|
|||
let entryDetails = { |
|||
empNo: $('#employeeno').val(), |
|||
empName: $('#employeename').val(), |
|||
deptName: $('#department').val(), |
|||
designation: $('#designation').val(), |
|||
serviceDeath: $('#servicedeath').val(), |
|||
sanctionedgis: $('#sanctionedgis').val(), |
|||
deceased: $('#deceased').val(), |
|||
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
pendingDuration: pendingDuration, |
|||
reasonPending: pendingDurationReason, |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim(), |
|||
filecategory:$('#filecategory').text().trim() |
|||
|
|||
|
|||
}; |
|||
|
|||
|
|||
console.log("entrydetails..",entryDetails); |
|||
|
|||
if(!entryDetails.pendingDuration) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Pending Duration is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.serviceDeath) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Service Death is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.sanctionedgis) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Sanctioned GIS is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.deceased) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Deceased is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
// Collect missing fields |
|||
/* let missingFields = []; |
|||
if (!entryDetails.sanctionedgis) missingFields.push("Sanctioned GIS"); |
|||
if (!entryDetails.serviceDeath) missingFields.push("Service Death"); |
|||
if (!entryDetails.deceased) missingFields.push("Deceased"); |
|||
if (!entryDetails.remarks) missingFields.push("Remarks"); |
|||
if (!entryDetails.dateToAudit) missingFields.push("Date to Audit"); |
|||
|
|||
// Show warning if any fields are missing |
|||
if (missingFields.length > 0) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
html: `<strong style="display:block; text-align:center; font-size:18px;">Please fill the following mandatory fields:</strong> |
|||
<ul style="color:red; text-align:center; list-style:none; padding:0;"> |
|||
${missingFields.map(field => `<li>${field}</li>`).join('')} |
|||
</ul>`, |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} */ |
|||
|
|||
|
|||
|
|||
$('#lfauditButton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/saveFamilyPensionDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#lfauditButton').prop('disabled', false).text('Mark as sent audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#lfauditButton').prop('disabled', false).text('Mark as sent audit'); |
|||
window.location.href = "/gcc/department/newentry/familypension"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#lfauditButton').prop('disabled', false).text('Mark as sent audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
document.querySelectorAll('input[name="pendingDuration"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const pendingDurationInputContainer = document.getElementById('pendingDurationInputContainer'); |
|||
if (this.value === 'yes') { |
|||
pendingDurationInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
pendingDurationInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('pendingDurationInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
//service death date field |
|||
|
|||
document.addEventListener("DOMContentLoaded", function () { |
|||
let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format |
|||
let servicedeathInput = document.getElementById("servicedeath"); |
|||
|
|||
// Set max attribute to disable future dates |
|||
servicedeathInput.setAttribute("max", today); |
|||
|
|||
// Prevent manual future date entry |
|||
servicedeathInput.addEventListener("change", function () { |
|||
if (this.value > today) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Invalid Date', |
|||
text: 'Future dates are not allowed.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
this.value = ""; // Clear the invalid input |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
1013
frontend/pensioner/department/newentry/gis.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -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> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
.card-block { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.form-label { |
|||
margin-bottom: 0.5rem; |
|||
} |
|||
|
|||
input.form-control { |
|||
padding: 10px; |
|||
} |
|||
.form-select { |
|||
padding: 10px; |
|||
height: 40px; |
|||
} |
|||
|
|||
#employeeCard label{ |
|||
padding-top: 2%; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Department Entries</h5> |
|||
<span>Pendency</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">NewEntry</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4" > |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
|
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> New Entry - Pendency</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div class="row mb-4"> |
|||
|
|||
<div class="col-md-4" > |
|||
<label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label> |
|||
|
|||
<div class="dropdown"> |
|||
<input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required> |
|||
<small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mt-20"> |
|||
<button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button> |
|||
<!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="row mb-4" id="employeeCard" style="display: none;"> |
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">New Entry - Pendency - <span id="EmployeeCode"></span></h5> |
|||
<hr> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Designation" class="form-label fw-bold">Designation<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label> |
|||
<div class="dropdown" > |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<select id="retirement" class="form-select" style="width: 100%;height: 40px;" required> |
|||
|
|||
</select> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<!-- pending duration--> |
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input"> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input"> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
<label for="Audit File" class="form-label fw-bold">Date file sent to Audit<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="filesentdate" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here" required></textarea> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-12 d-flex justify-content-center"> |
|||
<button id="lfauditButton" class="btn btn-primary mt-2 mx-2">Mark as sent Audit</button> |
|||
<button id="cancelButton" class="btn btn-secondary mt-2">Cancel</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
|
|||
$(document).ready(function (){ |
|||
|
|||
$('#searchButton').on('click', function () { |
|||
const empCode = $('#empCode').val().trim(); // Trim any extra spaces |
|||
console.log("empCode:", empCode); |
|||
|
|||
// If empCode is missing, show a warning and abort. |
|||
if (!empCode) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
console.log("No Employee Code provided. Aborting search."); |
|||
return; |
|||
} |
|||
|
|||
// Show loader and hide any previously displayed cards |
|||
$('#pageLoader').show(); |
|||
$('#employeeCard').hide(); |
|||
$('#newemployeeCard').hide(); |
|||
|
|||
// Clear/reset form fields |
|||
$('#typeofcategory').val(''); |
|||
$('#retirement').val(''); |
|||
$('#pendingDurationInput').val(''); |
|||
$('#remarks').val(''); |
|||
$('input[name="pendingDuration"]').prop('checked', false); |
|||
document.getElementById("pendingDurationInputContainer").style.display = "none"; |
|||
|
|||
// STEP 1: Check if the employee already exists in the database. |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/prexists', // Endpoint to check existence |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (existsResponse) { |
|||
console.log("Exists API Response:", existsResponse); |
|||
$('#pageLoader').hide(); |
|||
|
|||
// If the employee exists, show a warning and stop processing. |
|||
if (existsResponse && existsResponse.exists) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Already Exists", |
|||
text: "This employee number already exists.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// STEP 2: If the employee does not exist, fetch employee details. |
|||
$('#pageLoader').show(); // Show loader for the second API call |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', // Correct API URL for employee details |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
console.log("Employee Details API Response:", response.list); |
|||
|
|||
if (response.list && response.list.length > 0) { |
|||
// Retrieve the first (and presumably only) employee details record. |
|||
let employeeDetails = response.list[0]; |
|||
console.log("Employee Details:", employeeDetails); |
|||
// Optional: Validate department ID if needed. |
|||
const loggedInDeptId = $('#deptId').text().trim(); |
|||
const currentDate = $('#filesentdate').val().trim(); |
|||
|
|||
if(employeeDetails.RETIREMENT_DATE >= currentDate){ |
|||
|
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Not Applicable", |
|||
text: "This employee not applicable for this pendency.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// If the returned data is invalid, show a warning. |
|||
if (!employeeDetails || !employeeDetails.EMPLOYEE_CODE) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if (employeeDetails.ID_DEPT !== loggedInDeptId) { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Access Denied", |
|||
text: "This employee does not belong to your department. Please try again with a valid employee code.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-danger" |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Populate the form fields with the fetched employee details. |
|||
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|||
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); |
|||
$('#department').val(employeeDetails.DEPARTMENT); |
|||
$('#designation').val(employeeDetails.DESIGNATION); |
|||
$('#classes').val(employeeDetails.GROUP_TYPE); |
|||
$('#retirementdate').val(employeeDetails.RETIREMENT_DATE); |
|||
$('#EmployeeCode').text(empCode); |
|||
|
|||
// Finally, display the employee card/modal. |
|||
$('#employeeCard').show(); |
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK" |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while checking the employee. Please try again.", |
|||
confirmButtonText: "OK" |
|||
}); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
/* document.getElementById('lfauditButton').addEventListener('click', function () { |
|||
// Trigger the save function when the button is clicked |
|||
saveEntryDetails(); |
|||
}); */ |
|||
|
|||
//$('#lfauditButton').one('click', saveEntryDetails); |
|||
|
|||
$('#lfauditButton').off('click').on('click', saveEntryDetails); |
|||
}) |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#cancelButton').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
|
|||
// Hide the card |
|||
$('#employeeCard').hide(); |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#cancelButtonnew').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
|
|||
// Hide the card |
|||
$('#newemployeeCard').hide(); |
|||
}); |
|||
|
|||
|
|||
// Trigger search on pressing Enter key |
|||
$('#empCode').on('keydown', function (event) { |
|||
if (event.key === 'Enter') { |
|||
event.preventDefault(); // Prevent default form submission or page reload |
|||
|
|||
const empCode = $('#empCode').val(); // Get the value of empCode |
|||
if (!empCode) { |
|||
// Show Swal alert if the employee number is missing |
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
return; // Stop further execution |
|||
} |
|||
|
|||
$('#searchButton').click(); // Trigger the click event of the search button |
|||
} |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
function loadRetirementTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getRetrimentTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#retirement"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
if (entry.retriment_type !== "Provisional") { // Exclude "Provisional" |
|||
dropdown.append($('<option></option>').attr('value', entry.retriment_type).text(entry.retriment_type)); |
|||
} |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementTypes(); |
|||
}); |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("filesentdate").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
function saveEntryDetails() { |
|||
|
|||
let pendingDuration= $('input[name="pendingDuration"]:checked').val(); |
|||
let pendingDurationReason=null; |
|||
if (pendingDuration === 'yes' ) { |
|||
pendingDurationReason = $('#pendingDurationInput').val(); // Retrieve the amount if available, else null |
|||
if (!pendingDurationReason) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please Enter Pending Reason', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; // Stop further execution if validation fails |
|||
} |
|||
} |
|||
|
|||
//pendencyCategory:$('#typeofcategory').val(), |
|||
|
|||
let entryDetails = { |
|||
|
|||
empNo: $('#employeeno').val(), |
|||
empName: $('#employeename').val(), |
|||
deptName: $('#department').val(), |
|||
designation: $('#designation').val(), |
|||
retirementclass: $('#classes').val(), |
|||
typeOfRetirement: $('#retirement').val(), |
|||
retirementDate:$('#retirementdate').val(), |
|||
pendingDuration: pendingDuration, |
|||
reasonPending: pendingDurationReason, |
|||
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim(), |
|||
filecategory:$('#filecategory').text().trim() |
|||
}; |
|||
|
|||
console.log("entrydetails..",entryDetails); |
|||
|
|||
|
|||
|
|||
if (!entryDetails.pendingDuration) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Pending Duration.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if (!entryDetails.typeOfRetirement) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Type of Retirement.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
$('#lfauditButton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/savePendecnyDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#lfauditButton').prop('disabled', false).text('Mark as sent Audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#lfauditButton').prop('disabled', false).text('Mark as sent Audit'); |
|||
window.location.href = "/gcc/department/newentry/pendency"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#lfauditButton').prop('disabled', false).text('Mark as sent Audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
function handleCategoryChange() { |
|||
const categoryDropdown = document.getElementById('typeofcategory'); |
|||
const retirementDetailsContainer = document.getElementById('retirementDetailsContainer'); |
|||
|
|||
// Show or hide the retirement details dropdown based on the selection |
|||
if (categoryDropdown.value === 'Retirement') { |
|||
retirementDetailsContainer.style.display = 'block'; // Show retirement dropdown |
|||
} else { |
|||
retirementDetailsContainer.style.display = 'none'; // Hide retirement dropdown |
|||
} |
|||
} |
|||
|
|||
|
|||
document.querySelectorAll('input[name="pendingDuration"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const pendingDurationInputContainer = document.getElementById('pendingDurationInputContainer'); |
|||
if (this.value === 'yes') { |
|||
pendingDurationInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
pendingDurationInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('pendingDurationInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,849 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
.card-block { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.form-label { |
|||
margin-bottom: 0.5rem; |
|||
} |
|||
|
|||
input.form-control { |
|||
padding: 10px; |
|||
} |
|||
.form-select { |
|||
padding: 10px; |
|||
height: 40px; |
|||
} |
|||
#employeeCard label{ |
|||
padding-top: 2%; |
|||
} |
|||
|
|||
|
|||
|
|||
.is-invalid { |
|||
border: 1px solid red; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Department Entries</h5> |
|||
<span>Provisional Retirement</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">NewEntry</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Provisional Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4" > |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span> New Entry - Provisional Retirement</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div class="row mb-4"> |
|||
|
|||
<div class="col-md-4" > |
|||
<label for="empCode" class="form-label fw-bold">Search by Employee No <span class="text-danger">*</span></label> |
|||
|
|||
<div class="dropdown"> |
|||
<input type="number" id="empCode" class="form-control" pattern="^[A-Za-z0-9]+$" placeholder="Enter Employee No" required> |
|||
<small id="employeenoHelp" class="form-text text-muted">Only numeric characters (numbers) are allowed.</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mt-20"> |
|||
<button id="searchButton" class="btn btn-primary mt-2" Style="height:38px;">Search</button> |
|||
<!-- <button id="resetButton" class="btn btn-secondary mt-2">Reset</button> --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="row mb-4" id="employeeCard" style="display: none;"> |
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">New Entry - Provisional Retirement - <span id="EmployeeCode"></span></h5> |
|||
<hr> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Designation" class="form-label fw-bold">Designation<span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label> |
|||
<div class="dropdown" > |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<select id="retirement" class="form-select" style="width: 100%;" required> |
|||
<option value="" selected>-- Select Option --</option> |
|||
</select> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="reason" class="form-label fw-bold">Reason For Provisional Pension Given<span class="text-danger">*</span></label> |
|||
<select id="reason" class="form-select" style="width: 100%;" required> |
|||
<option value="" selected>-- Select Option --</option> |
|||
</select> |
|||
<div id="otherReasonDiv" style="display: none; margin-top: 10px;"> |
|||
<label for="otherReason" class="form-label">Please specify:</label> |
|||
<input type="text" id="otherReason" class="form-control" placeholder="Enter reason"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="Audit File" class="form-label fw-bold"> |
|||
Date file sent to Pension Section <span class="text-danger">*</span> |
|||
</label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="filesentdate" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold">Pending Duration <span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" onclick="toggleInputField(this)"> |
|||
<label for="yespen" class="form-check-label">yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" onclick="toggleInputField(this)"> |
|||
<label for="nopen" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
<div id="clickyesdiv" style="display: none; margin-top: 10px;"> |
|||
<label for="clickyes" class="form-label">Please specify:<span class="text-danger">*</span></label> |
|||
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="DP" class="form-label fw-bold">DP<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check " style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="DP" value="yes" class="form-check-input"> |
|||
<label for="yes" class="form-check-label">yes</label> |
|||
</div> |
|||
<br> |
|||
<div class="form-check" > |
|||
<input type="radio" id="No" name="DP" value="no" class="form-check-input"> |
|||
<label for="No" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="Remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<div class="dropdown"> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here" required></textarea> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-12 d-flex justify-content-center"> |
|||
<button id="submitButton" class="btn btn-primary mt-2 mx-2">Mark as Forward to Pension</button> |
|||
<button id="cancelButton" class="btn btn-secondary mt-2">Cancel</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function (){ |
|||
|
|||
|
|||
// Handle Search button click |
|||
$('#searchButton').on('click', function () { |
|||
const empCode = $('#empCode').val(); |
|||
|
|||
console.log("empCode",empCode); |
|||
|
|||
if (empCode) { |
|||
$('#pageLoader').show(); |
|||
document.getElementById("employeeCard").style.display = "block"; |
|||
}else{ |
|||
|
|||
|
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
//document.getElementById("newemployeeCard").style.display = "block"; |
|||
return; |
|||
} |
|||
|
|||
// Format dates to dd-MM-yyyy |
|||
|
|||
$('#pageLoader').show(); |
|||
$('#employeeCard').hide(); |
|||
$('#newemployeeCard').hide(); |
|||
|
|||
$('#retirement').val(''); |
|||
$('#reason').val(''); |
|||
$('#otherReason').val(''); |
|||
// $('#filesentdate').val(''); |
|||
$('#remarks').val(''); |
|||
$('input[name="pendingDuration"]').prop('checked', false); // Clear "pendingDuration" radio buttons |
|||
$('input[name="DP"]').prop('checked', false); // Clear "DP" radio buttons |
|||
|
|||
|
|||
// Step 1: Check if employee exists in the database and fetch employee details if not |
|||
$('#pageLoader').show(); // Show loader before starting AJAX requests |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/prexists', // Endpoint to check existence |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (existsResponse) { |
|||
console.log("Exists API Response:", existsResponse); |
|||
$('#pageLoader').hide(); // Hide loader after the first API response |
|||
|
|||
if (existsResponse && existsResponse.exists) { |
|||
console.log(`Employee Code ${empCode} exists in the database.`); |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Already Exists", |
|||
text: "This employee number already exists.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
return; // Exit if employee already exists |
|||
} |
|||
|
|||
// If employee does not exist, proceed to fetch details |
|||
$('#pageLoader').show(); // Show loader for the second API call |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', // Correct API URL |
|||
type: 'GET', |
|||
data: { empCode: empCode }, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); // Hide loader after the second API response |
|||
console.log("Employee Details API Response:", response.list); |
|||
|
|||
if (response.list && response.list.length > 0) { |
|||
// Extract employee details |
|||
let employeeDetails = response.list[0]; |
|||
console.log("Employee Details:", employeeDetails); |
|||
|
|||
const loggedInDeptId = $('#deptId').text().trim(); // Get logged-in deptId dynamically |
|||
|
|||
// Validate department ID |
|||
if (employeeDetails.ID_DEPT !== loggedInDeptId) { |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Access Denied", |
|||
text: "This employee does not belong to your department. Please try again with a valid employee code.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-danger" |
|||
} |
|||
}); |
|||
return; // Exit if the department does not match |
|||
} |
|||
|
|||
// Populate employee details in the form |
|||
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|||
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); |
|||
$('#department').val(employeeDetails.DEPARTMENT); |
|||
$('#designation').val(employeeDetails.DESIGNATION); |
|||
$('#classes').val(employeeDetails.GROUP_TYPE); |
|||
$('#retirementdate').val(employeeDetails.RETIREMENT_DATE); |
|||
|
|||
$('#EmployeeCode').text(empCode); |
|||
|
|||
// Show the employee card |
|||
$('#employeeCard').show(); |
|||
|
|||
|
|||
} else { |
|||
// No details found for the employee |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No details found for this employee number.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" |
|||
} |
|||
}); |
|||
|
|||
document.getElementById("newemployeeCard").style.display = "block"; // Show the new employee card |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); // Hide loader on error |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
error: function () { |
|||
$('#pageLoader').hide(); // Hide loader on error |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while checking the employee. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
}) |
|||
|
|||
// Attach event listener to the submit button |
|||
/* document.getElementById('submitButton').addEventListener('click', function () { |
|||
saveEntryDetails(); // Trigger save function when clicked |
|||
}); */ |
|||
|
|||
//$('#submitButton').one('click', saveEntryDetails); |
|||
|
|||
$('#submitButton').off('click').on('click', saveEntryDetails); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("filesentdate").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
// Dropdown for Type of Retriment |
|||
$(document).ready(function () { |
|||
function loadRetirementTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getRetrimentTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#retirement"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
dropdown.append($('<option></option>').attr('value', entry.retriment_type).text(entry.retriment_type)); |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementTypes(); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
//Dropdown for Reason of Provisional |
|||
$(document).ready(function () { |
|||
function loadRetirementReasonTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getProvisionalReasonTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#reason"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
dropdown.append($('<option></option>').attr('value', entry.provisional_reason).text(entry.provisional_reason)); |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementReasonTypes(); |
|||
}); |
|||
|
|||
|
|||
document.getElementById('reason').addEventListener('change', function () { |
|||
const otherReasonDiv = document.getElementById('otherReasonDiv'); // Get the div to show/hide |
|||
if (this.value === 'Others') { |
|||
otherReasonDiv.style.display = 'block'; // Show the input field if "Others" is selected |
|||
} else { |
|||
otherReasonDiv.style.display = 'none'; // Hide the input field otherwise |
|||
document.getElementById('otherReason').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
function toggleInputField(radio) { |
|||
const inputFieldDiv = document.getElementById('clickyesdiv'); |
|||
if (radio.value === "Yes") { |
|||
inputFieldDiv.style.display = 'block'; |
|||
} else { |
|||
inputFieldDiv.style.display = 'none'; |
|||
document.getElementById('Clickyes').value = ''; // Clear the input field |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
// Trigger search on pressing Enter key |
|||
$('#empCode').on('keydown', function (event) { |
|||
if (event.key === 'Enter') { |
|||
event.preventDefault(); // Prevent default form submission or page reload |
|||
|
|||
const empCode = $('#empCode').val(); // Get the value of empCode |
|||
if (!empCode) { |
|||
// Show Swal alert if the employee number is missing |
|||
Swal.fire({ |
|||
icon: "warning", // Display a warning icon |
|||
title: "Missing Employee Number", |
|||
text: "Please enter an employee number to proceed.", |
|||
confirmButtonText: "OK", |
|||
customClass: { |
|||
confirmButton: "btn btn-primary" // Optional styling for the button |
|||
} |
|||
}); |
|||
return; // Stop further execution |
|||
} |
|||
|
|||
$('#searchButton').click(); // Trigger the click event of the search button |
|||
} |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#cancelButton').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
document.getElementById('otherReasonDiv').style.display = 'none'; |
|||
// Hide the card |
|||
$('#employeeCard').hide(); |
|||
}); |
|||
|
|||
// Handle close button click |
|||
$('#cancelButtonnew').click(function () { |
|||
// Clear the input field value |
|||
$('#empCode').val(''); |
|||
|
|||
$('#newemployeeCard').hide(); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
function saveEntryDetails() { |
|||
let selectedDPValue = $('input[name="DP"]:checked').val(); |
|||
let selectedPendingDurationValue = $('input[name="pendingDuration"]:checked').val(); |
|||
let selectedReasonValue = $('#reason').val(); |
|||
let selectedOtherReason = null; |
|||
let selectedReasonPending = null; |
|||
|
|||
// Check for "Others" in Reason of Pension |
|||
if (selectedReasonValue === 'Others') { |
|||
selectedOtherReason = $('#otherReason').val()?.trim() || null; |
|||
if (!selectedOtherReason) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please specify the reason for selecting "Others".', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Check for "Yes" in Pending Duration |
|||
if (selectedPendingDurationValue === 'Yes') { |
|||
selectedReasonPending = $('#Clickyes').val()?.trim() || null; |
|||
if (!selectedReasonPending) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please specify the reason for selecting "Yes" for Pending Duration.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Create the entryDetails object |
|||
let entryDetails = { |
|||
empNo: $('#employeeno').val()?.trim(), |
|||
empName: $('#employeename').val()?.trim(), |
|||
deptName: $('#department').val()?.trim(), |
|||
designation: $('#designation').val()?.trim(), |
|||
retirementClass: $('#classes').val()?.trim(), |
|||
retirementDate: $('#retirementdate').val()?.trim(), |
|||
typeOfRetirement: $('#retirement').val()?.trim(), |
|||
ReasonofPension: selectedReasonValue || null, |
|||
// Convert DD-MM-YYYY to YYYY-MM-DD |
|||
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), |
|||
//dateToAudit: $('#filesentdate').val()?.trim(), |
|||
pendingDuration: selectedPendingDurationValue, |
|||
reasonofPending: selectedReasonPending || null, |
|||
dp: selectedDPValue, |
|||
otherReason: selectedOtherReason, |
|||
remarks: $('#remarks').val()?.trim(), |
|||
deptId: $('#deptId').text()?.trim(), |
|||
filemovedby: $('#userId').text()?.trim(), |
|||
filecategory: $('#filecategory').text()?.trim() |
|||
}; |
|||
|
|||
|
|||
// Validate each required field separately |
|||
|
|||
if (!entryDetails.typeOfRetirement) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Type of Retirement is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Type of Retirement"); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.ReasonofPension) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Reason of Pension is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Reason of Pension"); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.pendingDuration) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Pending Duration is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Pending Duration"); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.dp) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'DP is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing DP"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
console.log("entryDetails==", entryDetails); |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#submitButton').prop('disabled', true).text('Processing...'); |
|||
|
|||
// Make AJAX POST request |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/saveEmployeeDetailsProvisionalretirement', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#submitButton').prop('disabled', false).text('Mark as Forward to Pension'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
window.location.href = "/gcc/department/newentry/provisionalretirement"; |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#submitButton').prop('disabled', false).text('Mark as Forward to Pension'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,802 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
.modal-body label{ |
|||
padding-top: 10px; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Retirement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">NewEntry</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}"></span> Department</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> New Entry - Retirement</h5> |
|||
<div class="row mb-4"> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="fromDate" class="form-label fw-bold">From Date<span class="text-danger">*</span></label> |
|||
<input type="date" id="fromDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-4"> |
|||
<label for="toDate" class="form-label fw-bold">To Date<span class="text-danger">*</span></label> |
|||
<input type="date" id="toDate" class="form-control" onclick="this.showPicker()" > |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-12 d-flex justify-content-center"> |
|||
<button id="searchButton" class="btn btn-primary mx-2" >Search</button> |
|||
<button id="resetButton" class="btn btn-secondary">Reset</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div id="employeedetails"> |
|||
<table id="FollowupDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">DOB</th> |
|||
<th class="text-center">Retirement Date</th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
<!-- Modal --> |
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
New Entry - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-sm-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-sm-6"> |
|||
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-sm-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="classes" class="form-label fw-bold">Class <span class="text-danger">*</span></label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="typeretirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<select id="typeretirement" class="form-select" style="width: 100%;height: 30px;" required> |
|||
|
|||
</select> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="datefile" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="2" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mt-4"> |
|||
<div class="col-12 d-flex justify-content-center"> |
|||
<button id="auditsubmit" class="btn btn-primary mx-2">Mark as sent audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="close">Close</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
|
|||
// Initialize DataTable |
|||
// Helper function to convert yyyy-MM-dd to dd-MM-yyyy for API calls |
|||
function formatDateForAPI(dateStr) { |
|||
const [year, month, day] = dateStr.split('-'); |
|||
return `${day}-${month}-${year}`; // Convert to dd-MM-yyyy |
|||
} |
|||
|
|||
document.getElementById('resetButton').addEventListener('click', function () { |
|||
event.preventDefault(); |
|||
|
|||
window.location.href="/gcc/department/newentry/retirement"; |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
//Function to convert date to dd/mm/yyyy format |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#FollowupDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: false, // Disable searching as it's custom |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
// Update To Date's min attribute when From Date changes |
|||
$('#fromDate').on('change', function () { |
|||
const fromDate = $(this).val(); |
|||
$('#toDate').attr('min', fromDate); // Update min attribute for To Date |
|||
|
|||
// If To Date is earlier than the new From Date, adjust it |
|||
const toDate = $('#toDate').val(); |
|||
if (new Date(toDate) < new Date(fromDate)) { |
|||
$('#toDate').val(fromDate); |
|||
} |
|||
}); |
|||
|
|||
// Update From Date's max attribute when To Date changes |
|||
$('#toDate').on('change', function () { |
|||
const toDate = $(this).val(); |
|||
$('#fromDate').attr('max', toDate); // Update max attribute for From Date |
|||
|
|||
// If From Date is later than the new To Date, adjust it |
|||
const fromDate = $('#fromDate').val(); |
|||
if (new Date(fromDate) > new Date(toDate)) { |
|||
$('#fromDate').val(toDate); |
|||
} |
|||
}); |
|||
|
|||
getstart(dataTable); |
|||
|
|||
document.getElementById('searchButton').addEventListener('click', function () { |
|||
event.preventDefault(); |
|||
|
|||
getstart(dataTable); |
|||
|
|||
}); |
|||
|
|||
function getstart(dataTable) |
|||
{ |
|||
const fromDate=$('#fromDate').val(); |
|||
const toDate=$('#toDate').val(); |
|||
const deptId = $('#deptId').text().trim(); // Default department ID |
|||
const file_category = $('#filecategory').text().trim(); |
|||
|
|||
console.log("fromDate==",fromDate); |
|||
console.log("toDate==",toDate); |
|||
console.log("deptId", deptId); |
|||
|
|||
|
|||
/* if (!fromDate && !toDate) { |
|||
Swal.fire({ |
|||
icon: "info", |
|||
title: "Info", |
|||
text: "Select Both Date for Searching", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
return; |
|||
} */ |
|||
|
|||
if (!deptId) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Error", |
|||
text: "Department ID is Missing", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
$('#pageLoader').show(); |
|||
// Call the API |
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/retirementdetails', // Correct API URL |
|||
type: 'GET', |
|||
data: { deptId: deptId, |
|||
file_category:file_category, |
|||
fromDate:fromDate, |
|||
toDate:toDate |
|||
}, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
console.log("response:", response.details); |
|||
fromDate1 = response.fromDate; // Extract the fromDate |
|||
toDate1 = response.toDate; // Extract the toDate |
|||
|
|||
|
|||
// Set formatted date values |
|||
$('#fromDate').val(fromDate1); |
|||
$('#toDate').val(toDate1); |
|||
|
|||
if (response.status === "success") { |
|||
|
|||
// Clear existing data |
|||
dataTable.clear(); |
|||
|
|||
let table = $('#FollowupDatatable').DataTable({ |
|||
destroy: true, |
|||
searching: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
paging: true, |
|||
info: true, |
|||
data: response.details.list, |
|||
|
|||
columns: [ |
|||
{ |
|||
data: null, |
|||
render: (data, type, row, meta) => meta.row + 1, |
|||
className: 'text-center' |
|||
}, |
|||
|
|||
{ data: 'EMPLOYEE_CODE', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'EMPLOYEE_NAME', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'DATE_OF_BIRTH', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'RETIREMENT_DATE', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'DEPARTMENT', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'DESIGNATION', defaultContent: '-', className: 'text-center' }, |
|||
{ |
|||
data: 'EMPLOYEE_CODE', |
|||
render: function(data, type, row) { |
|||
return ` |
|||
<td class="text-center"> |
|||
<button type="button" class="btn btn-info" data-employee-code="${data}"> |
|||
View |
|||
</button> |
|||
</td>`; |
|||
}, |
|||
className: 'text-center' |
|||
} |
|||
|
|||
], |
|||
dom: 'Bfrtip', |
|||
buttons: [ |
|||
{ |
|||
extend: 'pageLength', |
|||
className: 'btn btn-warning' |
|||
}, |
|||
{ |
|||
title: 'Data export', |
|||
extend: 'copyHtml5', |
|||
text: 'Copy', |
|||
className: 'btn btn-secondary', |
|||
id: 'copyBtn' |
|||
}, |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Excel', |
|||
className: 'btn btn-secondary', |
|||
id: 'excelBtn' |
|||
}, |
|||
{ |
|||
extend: 'csvHtml5', |
|||
text: 'CSV', |
|||
className: 'btn btn-secondary', |
|||
id: 'csvBtn' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
className: 'btn btn-secondary', |
|||
id: 'pdfBtn' |
|||
} |
|||
], |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
fixedColumns: { |
|||
left: 1, |
|||
right: 1 |
|||
} |
|||
}); |
|||
|
|||
} |
|||
else if (response.status === "deptid") { |
|||
// Display the error message for missing department ID |
|||
dataTable.clear().draw(); |
|||
$('#FollowupDatatable tbody').html(` |
|||
<tr> |
|||
<td colspan="8" class="text-center text-danger">${response.message}</td> |
|||
</tr> |
|||
`); |
|||
} else if (response.status === "nodata") { |
|||
// Display the no data message |
|||
dataTable.clear().draw(); |
|||
$('#FollowupDatatable tbody').html(` |
|||
<tr> |
|||
<td colspan="8" class="text-center text-danger">${response.message}</td> |
|||
</tr> |
|||
`); |
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
dataTable.clear().draw(); |
|||
Swal.fire({ |
|||
icon: "info", |
|||
title: "No Data", |
|||
text: "No data available for the selected date range.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#pageLoader').hide(); |
|||
Swal.fire({ |
|||
icon: "error", |
|||
title: "Error", |
|||
text: "An error occurred while fetching data. Please try again.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
function loadRetirementTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getRetrimentTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#typeretirement"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
if (entry.retriment_type !== "Provisional") { // Exclude "Provisional" |
|||
dropdown.append($('<option></option>').attr('value', entry.retriment_type).text(entry.retriment_type)); |
|||
} |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementTypes(); |
|||
}); |
|||
|
|||
// Fetch count on page load |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.btn-info', function () { |
|||
const empCode = $(this).data('employee-code'); // Get EMPLOYEE_CODE from button |
|||
fetchEmployeeDetails(empCode); // Call the function to fetch employee details |
|||
}); |
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function fetchEmployeeDetails(empCode) { |
|||
|
|||
// Clear previous values in the modal fields |
|||
$('#employeeno').val(''); |
|||
$('#employeename').val(''); |
|||
$('#department').val(''); |
|||
$('#designation').val(''); |
|||
$('#retirementdate').val(''); |
|||
$('#classes').val(''); |
|||
$('#typeretirement').val('').prop('selected', true); // Reset the dropdown to default |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/employeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { empCode: empCode }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response.list && response.list.length > 0) { |
|||
|
|||
let employeeDetails = response.list[0]; |
|||
console.log("employeecode",response); |
|||
|
|||
// Populate modal fields |
|||
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); |
|||
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); |
|||
$('#department').val(employeeDetails.DEPARTMENT); |
|||
$('#designation').val(employeeDetails.DESIGNATION); |
|||
$('#classes').val(employeeDetails.GROUP_TYPE); |
|||
$('#retirementdate').val(employeeDetails.RETIREMENT_DATE); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(empCode); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
//$('#auditsubmit').one('click', saveEntryDetails); |
|||
|
|||
$('#auditsubmit').off('click').on('click', saveEntryDetails); |
|||
|
|||
/* document.getElementById('auditsubmit').addEventListener('click', function () { |
|||
// Trigger the save function when the button is clicked |
|||
saveEntryDetails(); |
|||
}); */ |
|||
|
|||
|
|||
|
|||
function saveEntryDetails() { |
|||
let entryDetails = { |
|||
empNo: $('#employeeno').val(), |
|||
empName: $('#employeename').val(), |
|||
deptName: $('#department').val(), |
|||
designation: $('#designation').val(), |
|||
typeOfRetirement: $('#typeretirement').val(), |
|||
retirementdate: $('#retirementdate').val(), |
|||
retirementclass: $('#classes').val(), |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId: $('#deptId').text().trim(), |
|||
filemovedby: $('#userId').text().trim(), |
|||
filecategory: $('#filecategory').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:", entryDetails); |
|||
|
|||
|
|||
if(!entryDetails.typeOfRetirement){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Type of Retirement.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if(!entryDetails.remarks){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditsubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/newentry/saveEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditsubmit').prop('disabled', false).text('Mark as sent audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditsubmit').prop('disabled', false).text('Mark as sent audit'); |
|||
window.location.href = "/gcc/department/newentry/retirement"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditsubmit').prop('disabled', false).text('Mark as sent audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
1190
frontend/pensioner/department/partial/familypension.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1186
frontend/pensioner/department/partial/pendency.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1158
frontend/pensioner/department/partial/retirement.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,997 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-4,.col-md-12{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.form-check-label{ |
|||
padding-top: 4%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Department Entries</h5> |
|||
<span>Family Pension</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Received From Pension</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Received From Pension - Family Pension</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="returnretriedtable"> |
|||
<table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="received, iterStat : ${receivedlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${received['emp_no']}" class="text-center"></td> |
|||
<td th:text="${received['emp_name']}" class="text-center"></td> |
|||
<td th:text="${received['dept_name']}" class="text-center"></td> |
|||
<td th:text="${received['designation']}" class="text-center"></td> |
|||
<td th:text="${received['file_moved_date'] != null ? #dates.format(received['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${received['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${received['emp_no']}, data-temp-id=${received['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Received From Pension - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="servicedeath" class="form-label fw-bold">While In Service Death </label> |
|||
<div class="dropdown"> |
|||
<input type="date" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="deceased" class="form-label fw-bold">Relationship of Deceased</label> |
|||
<div class="dropdown"> |
|||
<input type="text" id="deceased" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS</label> |
|||
<div class="dropdown"> |
|||
<input type="number" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">File Forward to Department Date </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Add Zone/Department Benefits</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes"> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no"> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90"> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes"> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no"> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes"> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no"> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee"> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes"> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no"> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<!-- Date File Forwarded to Pension --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile" class="form-label fw-bold">Date File Forwarded to Pension <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="sendtopension">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function () { |
|||
// Initialize DataTable |
|||
const table = $('#ReturnRetriedDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
|
|||
// Listen for changes on the GPF radio buttons |
|||
document.querySelectorAll('input[name="gpf"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const gpfAmountDiv = document.getElementById('gpfAmountDiv'); |
|||
if (this.value === 'yes' || this.value === '90') { |
|||
gpfAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
gpfAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('gpfAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
// Listen for changes on the private affaires radio buttons |
|||
document.querySelectorAll('input[name="earnedleave"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv'); |
|||
if (this.value === 'yes') { |
|||
earnedleaveAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
earnedleaveAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('earnedleaveAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
// Listen for changes on the spfgs radio buttons |
|||
document.querySelectorAll('input[name="spfgs"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const spfgsAmountDiv = document.getElementById('spfgsAmountDiv'); |
|||
if (this.value === 'yes') { |
|||
spfgsAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
spfgsAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('spfgsAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getzonebenefitsdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
// Show Pending Duration and Input based on the value |
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#deceased').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
|
|||
//pendingDuration,yes,no,servicedeath,deceased,sanctionedgis |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
let status=employeeDetails.file_status; |
|||
console.log("status=:"+status); |
|||
|
|||
|
|||
|
|||
$('#submitbutton').off('click').on('click', function() { |
|||
if (status === 6) { |
|||
$('#receivedcard').show(); |
|||
|
|||
// GPF |
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
} |
|||
|
|||
if (status === 5) { |
|||
$('#gpfAmount').val(''); |
|||
$('#earnedleaveAmount').val(''); |
|||
$('#spfgsAmount').val(''); |
|||
$('#recoveryemployeevalue').val(''); |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
$('input[name="gpf"]').prop('checked', false); |
|||
$('input[name="earnedleave"]').prop('checked', false); |
|||
$('input[name="spfgs"]').prop('checked', false); |
|||
$('input[name="dcrg"]').prop('checked', false); |
|||
|
|||
$('#gpfAmountDiv').hide(); |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
$('#spfgsAmountDiv').hide(); |
|||
|
|||
$('#receivedcard').show(); |
|||
} |
|||
}); |
|||
|
|||
/* document.getElementById('sendtopension').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
|
|||
$('#sendtopension').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
|
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
// Get the selected GPF value |
|||
let selectedGpfValue = $('input[name="gpf"]:checked').val(); // Get the selected radio button value |
|||
let gpfAmount = null; |
|||
|
|||
if (selectedGpfValue === 'yes' || selectedGpfValue === '90') { |
|||
gpfAmount = $('#gpfAmount').val(); // Retrieve the amount if available, else null |
|||
if(!gpfAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'GPF amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
let selectedElValue = $('input[name="earnedleave"]:checked').val(); |
|||
let earnedleaveAmount=null; |
|||
|
|||
if (selectedElValue === 'yes') { |
|||
earnedleaveAmount = $('#earnedleaveAmount').val(); // Retrieve the amount if available, else null |
|||
if(!earnedleaveAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Earned Leave Amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
let selectedspfgsValue = $('input[name="spfgs"]:checked').val(); |
|||
let spfgsAmount=null; |
|||
if (selectedspfgsValue === 'yes') { |
|||
spfgsAmount = $('#spfgsAmount').val(); // Retrieve the amount if available, else null |
|||
|
|||
if(!spfgsAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
// Check if GPF Amount input is visible and get its value |
|||
/* if (selectedGpfValue === 'yes' || selectedGpfValue === '90') { |
|||
gpfAmount = $('#gpfAmount').val() || null; // Retrieve the amount if available, else null |
|||
} |
|||
|
|||
|
|||
let selectedElValue = $('input[name="earnedleave"]:checked').val(); |
|||
let earnedleaveAmount=null; |
|||
|
|||
if (selectedElValue === 'yes') { |
|||
earnedleaveAmount = $('#earnedleaveAmount').val() || null; // Retrieve the amount if available, else null |
|||
} |
|||
|
|||
|
|||
let selectedspfgsValue = $('input[name="spfgs"]:checked').val(); |
|||
let spfgsAmount=null; |
|||
if (selectedspfgsValue === 'yes') { |
|||
spfgsAmount = $('#spfgsAmount').val() || null; // Retrieve the amount if available, else null |
|||
} */ |
|||
|
|||
|
|||
|
|||
//dcrf |
|||
let selecteddcrgValue = $('input[name="dcrg"]:checked').val(); |
|||
|
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId:tempId, |
|||
file_moved_date: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim(), |
|||
gpf: selectedGpfValue, // Add GPF value (null if none selected) |
|||
gpfAmount: gpfAmount || null, // Include the GPF amount |
|||
private_affairs:selectedElValue, |
|||
private_affairs_amount:earnedleaveAmount || null, |
|||
spfgs:selectedspfgsValue, |
|||
spfgs_amount:spfgsAmount || null, |
|||
recovery_emp:$('#recoveryemployeevalue').val()|| null, |
|||
dcrg:selecteddcrgValue |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.dcrg) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'DCRG are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.spfgs) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.private_affairs) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Private affairs are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if (!entryDetails.gpf) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'GPF are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
$('#sendtopension').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/received/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/department/received/familypension"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
document.querySelectorAll('input[name="pendingDuration"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const pendingDurationInputContainer = document.getElementById('pendingDurationInputContainer'); |
|||
if (this.value === 'yes') { |
|||
pendingDurationInputContainer.style.display = 'block'; // Show the input field |
|||
} else { |
|||
pendingDurationInputContainer.style.display = 'none'; // Hide the input field |
|||
document.getElementById('pendingDurationInput').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
//amount field validation |
|||
|
|||
function validatePositiveNumber(input) { |
|||
if (input.value < 1) { |
|||
input.value = ""; |
|||
} |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,972 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-4,.col-md-12{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.form-check-label{ |
|||
padding-top: 4%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Pendency</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Received From Pension</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Received From Pension - Pendency</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="returnretriedtable"> |
|||
<table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="received, iterStat : ${receivedlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${received['emp_no']}" class="text-center"></td> |
|||
<td th:text="${received['emp_name']}" class="text-center"></td> |
|||
<td th:text="${received['dept_name']}" class="text-center"></td> |
|||
<td th:text="${received['designation']}" class="text-center"></td> |
|||
<td th:text="${received['file_moved_date'] != null ? #dates.format(received['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${received['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${received['emp_no']}, data-temp-id=${received['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Received From Pension - Pendency (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-4"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-4"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-4"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">File Forward to Department Date </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Add Zone/Department Benefits</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes"> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no"> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90"> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes"> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no"> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes"> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no"> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee"> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes"> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no"> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<!-- Date File Forwarded to Pension --> |
|||
<div class="col-md-4"> |
|||
<label for="filedate" class="form-label fw-bold">Date File Forwarded to Pension <span class="text-danger">*</span></label> |
|||
<input type="text" id="filedate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="sendtopension">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function () { |
|||
// Initialize DataTable |
|||
const table = $('#ReturnRetriedDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#filedate').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
|
|||
// Listen for changes on the GPF radio buttons |
|||
document.querySelectorAll('input[name="gpf"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const gpfAmountDiv = document.getElementById('gpfAmountDiv'); |
|||
if (this.value === 'yes' || this.value === '50') { |
|||
gpfAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
gpfAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('gpfAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
// Listen for changes on the private affaires radio buttons |
|||
document.querySelectorAll('input[name="earnedleave"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv'); |
|||
if (this.value === 'yes') { |
|||
earnedleaveAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
earnedleaveAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('earnedleaveAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
// Listen for changes on the spfgs radio buttons |
|||
document.querySelectorAll('input[name="spfgs"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const spfgsAmountDiv = document.getElementById('spfgsAmountDiv'); |
|||
if (this.value === 'yes') { |
|||
spfgsAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
spfgsAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('spfgsAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getzonebenefitsdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
let status=employeeDetails.file_status; |
|||
console.log("status=:"+status); |
|||
|
|||
|
|||
|
|||
|
|||
$('#submitbutton').off('click').on('click', function() { |
|||
if (status === 6) { |
|||
$('#receivedcard').show(); |
|||
|
|||
// GPF |
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "50") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
//$('#filedate').val(''); |
|||
$('#remarks').val(''); |
|||
} |
|||
|
|||
if (status === 5) { |
|||
$('#gpfAmount').val(''); |
|||
$('#earnedleaveAmount').val(''); |
|||
$('#spfgsAmount').val(''); |
|||
$('#recoveryemployeevalue').val(''); |
|||
//$('#filedate').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
$('input[name="gpf"]').prop('checked', false); |
|||
$('input[name="earnedleave"]').prop('checked', false); |
|||
$('input[name="spfgs"]').prop('checked', false); |
|||
$('input[name="dcrg"]').prop('checked', false); |
|||
|
|||
$('#gpfAmountDiv').hide(); |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
$('#spfgsAmountDiv').hide(); |
|||
|
|||
$('#receivedcard').show(); |
|||
} |
|||
}); |
|||
|
|||
/* document.getElementById('sendtopension').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
|
|||
$('#sendtopension').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
|
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
// Get the selected GPF value |
|||
let selectedGpfValue = $('input[name="gpf"]:checked').val(); // Get the selected radio button value |
|||
let gpfAmount = null; |
|||
|
|||
if (selectedGpfValue === 'yes' || selectedGpfValue === '90') { |
|||
gpfAmount = $('#gpfAmount').val(); // Retrieve the amount if available, else null |
|||
if(!gpfAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'GPF amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
let selectedElValue = $('input[name="earnedleave"]:checked').val(); |
|||
let earnedleaveAmount=null; |
|||
|
|||
if (selectedElValue === 'yes') { |
|||
earnedleaveAmount = $('#earnedleaveAmount').val(); // Retrieve the amount if available, else null |
|||
if(!earnedleaveAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Earned Leave Amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
let selectedspfgsValue = $('input[name="spfgs"]:checked').val(); |
|||
let spfgsAmount=null; |
|||
if (selectedspfgsValue === 'yes') { |
|||
spfgsAmount = $('#spfgsAmount').val(); // Retrieve the amount if available, else null |
|||
|
|||
if(!spfgsAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Check if GPF Amount input is visible and get its value |
|||
/* if (selectedGpfValue === 'yes' || selectedGpfValue === '90') { |
|||
gpfAmount = $('#gpfAmount').val() || null; // Retrieve the amount if available, else null |
|||
} |
|||
|
|||
|
|||
let selectedElValue = $('input[name="earnedleave"]:checked').val(); |
|||
let earnedleaveAmount=null; |
|||
|
|||
if (selectedElValue === 'yes') { |
|||
earnedleaveAmount = $('#earnedleaveAmount').val() || null; // Retrieve the amount if available, else null |
|||
} |
|||
|
|||
|
|||
let selectedspfgsValue = $('input[name="spfgs"]:checked').val(); |
|||
let spfgsAmount=null; |
|||
if (selectedspfgsValue === 'yes') { |
|||
spfgsAmount = $('#spfgsAmount').val() || null; // Retrieve the amount if available, else null |
|||
} */ |
|||
|
|||
|
|||
|
|||
//dcrf |
|||
let selecteddcrgValue = $('input[name="dcrg"]:checked').val(); |
|||
|
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId:tempId, |
|||
file_moved_date:convertDateFormat($('#filedate').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim(), |
|||
gpf: selectedGpfValue, // Add GPF value (null if none selected) |
|||
gpfAmount: gpfAmount || null, // Include the GPF amount |
|||
private_affairs:selectedElValue, |
|||
private_affairs_amount:earnedleaveAmount || null, |
|||
spfgs:selectedspfgsValue, |
|||
spfgs_amount:spfgsAmount || null, |
|||
recovery_emp:$('#recoveryemployeevalue').val()|| null, |
|||
dcrg:selecteddcrgValue |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
|
|||
|
|||
if (!entryDetails.dcrg) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'DCRG are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.spfgs) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.private_affairs) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Private affairs are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if (!entryDetails.gpf) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'GPF are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
// Validate required fields |
|||
/* if (!entryDetails.file_moved_date || !entryDetails.gpf || !entryDetails.private_affairs || !entryDetails.spfgs || !entryDetails.dcrg || !entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Fill All Fields', |
|||
text: 'Please fill all mandatory fields.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} */ |
|||
|
|||
$('#sendtopension').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/received/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/department/received/pendency"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("filedate").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,909 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Provisional Retriement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Received From Pension</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Provisional Retriement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}"></span> Department</h5><span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Received From Pension - Provisional Retirement</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="receivedprovisionalModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Received From Department - Provisional Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class</label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type Of Retirement typeofretirement--> |
|||
<div class="col-sm-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<select id="typeofretirement" class="form-select" style="width: 100%; height:34px;" required> |
|||
<option value="" selected>-- Select Option --</option> |
|||
</select> |
|||
</div> |
|||
|
|||
|
|||
<!-- Reason For Provisional Pension is given --> |
|||
<!-- |
|||
otherReason --> |
|||
<div class="col-sm-6"> |
|||
<label for="provisionalreason" class="form-label fw-bold">Reason For Provisional Pension Given<span class="text-danger">*</span></label> |
|||
<select id="provisionalreason" class="form-select" style="width: 100%; height: 35px;" required> |
|||
<option value="" selected>-- Select Option --</option> |
|||
</select> |
|||
<div id="otherReasonDiv" style="display: none; margin-top: 10px;"> |
|||
<label for="otherReason" class="form-label">Please specify:</label> |
|||
<input type="text" id="otherReason" class="form-control" placeholder="Enter reason"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Pension Section --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension Section<span class="text-danger">*</span> </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Pending Duration --> |
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold">Pending Duration <span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" onclick="toggleInputField(this)"> |
|||
<label for="yespen" class="form-check-label">yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" onclick="toggleInputField(this)"> |
|||
<label for="nopen" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
<div id="clickyesdiv" style="display: none; margin-top: 10px;"> |
|||
<label for="clickyes" class="form-label">Please specify:<span class="text-danger">*</span></label> |
|||
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- dp --> |
|||
<div class="col-md-6"> |
|||
<label for="DP" class="form-label fw-bold">DP<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check " style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="DP" value="yes" class="form-check-input" > |
|||
<label for="yes" class="form-check-label">yes</label> |
|||
</div> |
|||
<br> |
|||
<div class="form-check" > |
|||
<input type="radio" id="no" name="DP" value="no" class="form-check-input" > |
|||
<label for="no" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span> </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="2" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">File Received date<span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton" >Rectify & Forward to Pension</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#receivedprovisionalModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
// Handle Close button click |
|||
$('.close').click(function () { |
|||
$('#receivedprovisionalModal').modal('hide'); // Hide the modal |
|||
clearFields(); // Clear input fields |
|||
}); |
|||
|
|||
// Handle Back button click |
|||
$('#back').click(function () { |
|||
$('#receivedprovisionalModal').modal('hide'); // Hide the modal |
|||
clearFields(); // Clear input fields |
|||
}); |
|||
|
|||
// Function to clear input fields |
|||
function clearFields() { |
|||
//$('#datefile').val(''); // Clear date input |
|||
$('#remarks').val(''); // Clear textarea |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
document.getElementById('provisionalreason').addEventListener('change', function () { |
|||
const otherReasonDiv = document.getElementById('otherReasonDiv'); // Get the div to show/hide |
|||
if (this.value === 'Others') { |
|||
otherReasonDiv.style.display = 'block'; // Show the input field if "Others" is selected |
|||
} else { |
|||
otherReasonDiv.style.display = 'none'; // Hide the input field otherwise |
|||
document.getElementById('otherReason').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
|
|||
function toggleInputField(radio) { |
|||
const inputFieldDiv = document.getElementById('clickyesdiv'); |
|||
if (radio.value === "Yes") { |
|||
inputFieldDiv.style.display = 'block'; |
|||
} else { |
|||
inputFieldDiv.style.display = 'none'; |
|||
document.getElementById('Clickyes').value = ''; // Clear the input field |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#provisionalreason').val(employeeDetails.reason_for_provisional_pension); |
|||
|
|||
|
|||
// Populate Pending Duration and Reason fields |
|||
if (employeeDetails.pending_duration === "Yes") { |
|||
$('#yespen').prop('checked', true); // Check the Yes radio button |
|||
$('#clickyesdiv').show(); // Show the reason input |
|||
$('#Clickyes').val(employeeDetails.reason_for_pending || '').prop( true); // Set reason and make readonly |
|||
} else if (employeeDetails.pending_duration === "No") { |
|||
$('#nopen').prop('checked', true); // Check the No radio button |
|||
$('#clickyesdiv').hide(); // Hide the reason input |
|||
} |
|||
//populate reason for provisional pension |
|||
if (employeeDetails.reason_for_provisional_pension === "Others") { |
|||
$('#otherReasonDiv').show(); // Show the input field for 'Others' |
|||
$('#otherReason') |
|||
.val(employeeDetails.others_provisional_pension || '') |
|||
.prop( true); // Populate and make readonly |
|||
} else { |
|||
$('#otherReasonDiv').hide(); // Hide the input field if reason is not 'Others' |
|||
} |
|||
|
|||
// Handle DP value |
|||
if (employeeDetails.dp === "yes") { |
|||
$('#yes').prop('checked', true); // Select 'yes' radio button |
|||
} else if (employeeDetails.dp === "no") { |
|||
$('#no').prop('checked', true); // Select 'no' radio button |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#receivedprovisionalModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
$(document).on('click', '#submitbutton', function () { |
|||
|
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
//typeofretirement,provisionalreason |
|||
|
|||
// Dropdown for Type of Retriment |
|||
$(document).ready(function () { |
|||
function loadRetirementTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getRetrimentTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#typeofretirement"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
dropdown.append($('<option></option>').attr('value', entry.retriment_type).text(entry.retriment_type)); |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementTypes(); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
//Dropdown for Reason of Provisional |
|||
$(document).ready(function () { |
|||
function loadRetirementReasonTypes() { |
|||
$.ajax({ |
|||
url: "/gcc/api/getProvisionalReasonTypes", |
|||
type: "GET", |
|||
success: function (data) { |
|||
var dropdown = $("#provisionalreason"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
|
|||
$.each(data, function (key, entry) { |
|||
dropdown.append($('<option></option>').attr('value', entry.provisional_reason).text(entry.provisional_reason)); |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Call function on page load |
|||
loadRetirementReasonTypes(); |
|||
}); |
|||
|
|||
|
|||
///history function to show in modal |
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
function saveEntryDetails(tempId, empCode) { |
|||
let selectedDPValue = $('input[name="DP"]:checked').val(); |
|||
let selectedPendingDurationValue = $('input[name="pendingDuration"]:checked').val(); |
|||
let selectedReasonValue = $('#provisionalreason').val(); |
|||
let selectedOtherReason = null; |
|||
let selectedReasonPending = null; |
|||
|
|||
// Check for "Others" in Reason of Pension |
|||
if (selectedReasonValue === 'Others') { |
|||
selectedOtherReason = $('#otherReason').val()?.trim() || null; |
|||
if (!selectedOtherReason) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please specify the reason for selecting "Others".', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Check for "Yes" in Pending Duration |
|||
if (selectedPendingDurationValue === 'Yes') { |
|||
selectedReasonPending = $('#Clickyes').val()?.trim() || null; |
|||
if (!selectedReasonPending) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error', |
|||
text: 'Please specify the reason for selecting "Yes" for Pending Duration.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
// Create the entryDetails object |
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId: tempId, |
|||
empName: $('#employeename').val(), |
|||
deptName: $('#department').val(), |
|||
designation: $('#designation').val(), |
|||
retirementClass: $('#classes').val(), |
|||
typeOfRetirement: $('#typeofretirement').val(), |
|||
ReasonofPension: selectedReasonValue || null, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
pendingDuration: selectedPendingDurationValue, |
|||
reasonofPending: selectedReasonPending || null, |
|||
Dp: selectedDPValue, |
|||
otherReason: selectedOtherReason, |
|||
remarks: $('#remarks').val(), |
|||
deptId: $('#deptId').text()?.trim(), |
|||
filemovedby: $('#userId').text()?.trim(), |
|||
filecategory: $('#filecategory').text()?.trim() |
|||
}; |
|||
|
|||
|
|||
if (!entryDetails.typeOfRetirement) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Type of Retirement is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Type of Retirement"); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.ReasonofPension) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Reason of Pension is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Reason of Pension"); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.pendingDuration) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Pending Duration is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Pending Duration"); |
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.Dp) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'DP is required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing DP"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
console.log("entryDetails==", entryDetails); |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#submitbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
// Make AJAX POST request |
|||
$.ajax({ |
|||
url: '/gcc/api/pensioner/received/provisional/updateEmployeeDetailsSentToPension', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#submitbutton').prop('disabled', false).text('Rectify & Forward to Pension'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
window.location.href = "/gcc/department/received/provisionalretirement"; |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#submitbutton').prop('disabled', false).text('Rectify & Forward to Pension'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,917 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-4,.col-md-12{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.form-check-label{ |
|||
padding-top: 4%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Retirement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Received From Pension</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Received From Pension - Retirement</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="returnretriedtable"> |
|||
<table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="received, iterStat : ${receivedlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${received['emp_no']}" class="text-center"></td> |
|||
<td th:text="${received['emp_name']}" class="text-center"></td> |
|||
<td th:text="${received['dept_name']}" class="text-center"></td> |
|||
<td th:text="${received['designation']}" class="text-center"></td> |
|||
<td th:text="${received['file_moved_date'] != null ? #dates.format(received['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${received['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${received['emp_no']}, data-temp-id=${received['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Received From Pension - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-4"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-4"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-4"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">File Forward to Department Date </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Add Zone/Department Benefits</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes"> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no"> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90"> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes"> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no"> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes"> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no"> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee"> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes"> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no"> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<!-- Date File Forwarded to Pension --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile" class="form-label fw-bold">Date File Forwarded to Pension <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="sendtopension">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function () { |
|||
// Initialize DataTable |
|||
const table = $('#ReturnRetriedDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
// Listen for changes on the GPF radio buttons |
|||
document.querySelectorAll('input[name="gpf"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const gpfAmountDiv = document.getElementById('gpfAmountDiv'); |
|||
if (this.value === 'yes' || this.value === '90') { |
|||
gpfAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
gpfAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('gpfAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
// Listen for changes on the private affaires radio buttons |
|||
document.querySelectorAll('input[name="earnedleave"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const earnedleaveAmountDiv = document.getElementById('earnedleaveAmountDiv'); |
|||
if (this.value === 'yes') { |
|||
earnedleaveAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
earnedleaveAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('earnedleaveAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
// Listen for changes on the spfgs radio buttons |
|||
document.querySelectorAll('input[name="spfgs"]').forEach(radio => { |
|||
radio.addEventListener('change', function () { |
|||
const spfgsAmountDiv = document.getElementById('spfgsAmountDiv'); |
|||
if (this.value === 'yes') { |
|||
spfgsAmountDiv.style.display = 'block'; // Show the input field |
|||
} else { |
|||
spfgsAmountDiv.style.display = 'none'; // Hide the input field |
|||
document.getElementById('spfgsAmount').value = ''; // Clear the input field |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getzonebenefitsdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
let status=employeeDetails.file_status; |
|||
console.log("status=:"+status); |
|||
|
|||
|
|||
|
|||
|
|||
$('#submitbutton').off('click').on('click', function() { |
|||
if (status === 6) { |
|||
$('#receivedcard').show(); |
|||
|
|||
// GPF |
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
} |
|||
|
|||
if (status === 5) { |
|||
$('#gpfAmount').val(''); |
|||
$('#earnedleaveAmount').val(''); |
|||
$('#spfgsAmount').val(''); |
|||
$('#recoveryemployeevalue').val(''); |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
$('input[name="gpf"]').prop('checked', false); |
|||
$('input[name="earnedleave"]').prop('checked', false); |
|||
$('input[name="spfgs"]').prop('checked', false); |
|||
$('input[name="dcrg"]').prop('checked', false); |
|||
|
|||
$('#gpfAmountDiv').hide(); |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
$('#spfgsAmountDiv').hide(); |
|||
|
|||
$('#receivedcard').show(); |
|||
} |
|||
}); |
|||
|
|||
/* document.getElementById('sendtopension').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#sendtopension').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
|
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
// Get the selected GPF value |
|||
let selectedGpfValue = $('input[name="gpf"]:checked').val(); // Get the selected radio button value |
|||
let gpfAmount = null; |
|||
|
|||
// Check if GPF Amount input is visible and get its value |
|||
if (selectedGpfValue === 'yes' || selectedGpfValue === '90') { |
|||
gpfAmount = $('#gpfAmount').val(); // Retrieve the amount if available, else null |
|||
if(!gpfAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'GPF amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
let selectedElValue = $('input[name="earnedleave"]:checked').val(); |
|||
let earnedleaveAmount=null; |
|||
|
|||
if (selectedElValue === 'yes') { |
|||
earnedleaveAmount = $('#earnedleaveAmount').val(); // Retrieve the amount if available, else null |
|||
if(!earnedleaveAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Earned Leave Amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
let selectedspfgsValue = $('input[name="spfgs"]:checked').val(); |
|||
let spfgsAmount=null; |
|||
if (selectedspfgsValue === 'yes') { |
|||
spfgsAmount = $('#spfgsAmount').val(); // Retrieve the amount if available, else null |
|||
|
|||
if(!spfgsAmount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
//dcrf |
|||
let selecteddcrgValue = $('input[name="dcrg"]:checked').val(); |
|||
|
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId:tempId, |
|||
file_moved_date:convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim(), |
|||
gpf: selectedGpfValue, // Add GPF value (null if none selected) |
|||
gpfAmount: gpfAmount || null, // Include the GPF amount |
|||
private_affairs:selectedElValue, |
|||
private_affairs_amount:earnedleaveAmount || null, |
|||
spfgs:selectedspfgsValue, |
|||
spfgs_amount:spfgsAmount || null, |
|||
recovery_emp:$('#recoveryemployeevalue').val()|| null, |
|||
dcrg:selecteddcrgValue |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.dcrg) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'DCRG are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.spfgs) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'SPFGS are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.private_affairs) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Private affairs are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
if (!entryDetails.gpf) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'GPF are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
$('#sendtopension').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/received/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/department/received/retirement"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#sendtopension').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//amount field validation |
|||
|
|||
function validatePositiveNumber(input) { |
|||
if (input.value < 1) { |
|||
input.value = ""; |
|||
} |
|||
} |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
1150
frontend/pensioner/department/reports.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,727 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
|
|||
#returnfamilydetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Family Pension</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Return from Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Return from Audit - Family Pension</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
|
|||
<div id="returnfamilytable"> |
|||
<table id="ReturnFamilyDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="return, iterStat : ${returnlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${return['emp_no']}" class="text-center"></td> |
|||
<td th:text="${return['emp_name']}" class="text-center"></td> |
|||
<td th:text="${return['dept_name']}" class="text-center"></td> |
|||
<td th:text="${return['designation']}" class="text-center"></td> |
|||
<td th:text="${return['file_moved_date'] != null ? #dates.format(return['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${return['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${return['emp_no']}, data-temp-id=${return['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="returnfamilydetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Returned From Audit - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- pending duration--> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- While in Service Death --> |
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While in Service Death </label> |
|||
<input type="text" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Relationship of Deceased --> |
|||
<div class="col-md-6"> |
|||
<label for="relationship" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="relationship" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Sanctioned GIS --> |
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS </label> |
|||
<input type="text" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile" class="form-control" readonly > |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks" class="form-control" rows="2" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Rectify & Submit for Audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefiles" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefiles" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarkss" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="rectifysubmit">Submit</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
$(document).ready(function () { |
|||
// Initialize DataTable |
|||
const table = $('#ReturnFamilyDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
}); |
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefiles").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeeno').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#relationship').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
$('#datefile').val(employeeDetails.file_moved_date); |
|||
$('#remarks').val(employeeDetails.remarks); |
|||
|
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnfamilydetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefiles').val(''); |
|||
$('#remarkss').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('rectifysubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeeno').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#rectifysubmit').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilydetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnfamilydetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnfamilydetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefiles').val()?.trim()), |
|||
remarks: $('#remarkss').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#rectifysubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/return/updateReturnFamilyPension', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#rectifysubmit').prop('disabled', false).text('Rectify & Submit for Audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#rectifysubmit').prop('disabled', false).text('Rectify & Submit for Audit'); |
|||
window.location.href = "/gcc/department/return/familypension"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#rectifysubmit').prop('disabled', false).text('Rectify & Submit for Audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,720 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
|
|||
#returnPendencydetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Pendency</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Return from Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Return from Audit - Pendency</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
|
|||
<div id="returnpendencytable"> |
|||
<table id="ReturnPendencyDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">File Category Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="return, iterStat : ${returnlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${return['emp_no']}" class="text-center"></td> |
|||
<td th:text="${return['emp_name']}" class="text-center"></td> |
|||
<td th:text="${return['dept_name']}" class="text-center"></td> |
|||
<td th:text="${return['designation']}" class="text-center"></td> |
|||
<td th:text="${return['file_moved_date'] != null ? #dates.format(return['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${return['file_category_name']}" class="text-center"></td> |
|||
<td th:text="${return['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${return['emp_no']}, data-temp-id=${return['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="returnpendencydetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Return from Audit -Pendency(<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6" id="retirementDetailsContainer" style="display: none; margin-top: 10px;"> |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement </label> |
|||
<input type="text" id="retirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="text" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<!-- file history --> |
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Rectify & Submit for Audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly > |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#ReturnPendencyDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeeno').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#typeofcategory').val(employeeDetails.file_category_name); |
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
let typeOfCategory=employeeDetails.file_category_name; |
|||
let typeOfRetirement=employeeDetails.type_of_retirement; |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnpendencydetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeeno').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/return/updateReturnPendency', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
window.location.href = "/gcc/department/return/pendency"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,613 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Retirement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Return from Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;"> <span th:text="${deptname}" id="deptname"></span> Department</h5> |
|||
<h5 style="font-weight:bold;">Return from Audit - Retirement</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="returnretriedtable"> |
|||
<table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="return, iterStat : ${returnlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${return['emp_no']}" class="text-center"></td> |
|||
<td th:text="${return['emp_name']}" class="text-center"></td> |
|||
<td th:text="${return['dept_name']}" class="text-center"></td> |
|||
<td th:text="${return['designation']}" class="text-center"></td> |
|||
<td th:text="${return['file_moved_date'] != null ? #dates.format(return['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${return['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${return['emp_no']}, data-temp-id=${return['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Returned From Audit - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Rectify & Submit for Audit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="rectifysubmit">Submit</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize DataTable |
|||
const table = $('#ReturnRetriedDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('rectifysubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#rectifysubmit').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#rectifysubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/return/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#rectifysubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#rectifysubmit').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/department/return/retirement"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#rectifysubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
@ -0,0 +1,742 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Family Pension</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Audit- Family Pension</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnfamilypensiondetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Audit - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- pending duration--> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- While in Service Death --> |
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While in Service Death </label> |
|||
<input type="text" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Relationship of Deceased --> |
|||
<div class="col-md-6"> |
|||
<label for="relationship" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="relationship" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS</label> |
|||
<input type="text" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Submit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile" class="form-label fw-bold">Audit Certificate Received Date<span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Mark As Audit Certificate Received</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
|
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#relationship').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
|
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnfamilypensiondetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnfamilypensiondetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnfamilypensiondetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/pensioner/audit/updateFamilyPensionDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Audit Certificate Received'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Audit Certificate Received'); |
|||
window.location.href = "/gcc/pensioner/audit/familypension"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Audit Certificate Received'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,733 @@ |
|||
|
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Pendency</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Audit- Pendency</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Category Type</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_category_name']}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnpendencydetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Audit -Pendency(<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6" > |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement</label> |
|||
<input type="text" id="retirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="text" id="pendingDurationInputContainer" style="margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Remarks</label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<!-- file history --> |
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Submit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Audit Certificate Received Date<span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly > |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Mark As Audit Certificate Received</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeeno').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirement').val(employeeDetails.type_of_retirement); |
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnpendencydetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeeno').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/pensioner/audit/updatePendencyDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Audit Certificate Received'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Audit Certificate Received'); |
|||
window.location.href = "/gcc/pensioner/audit/pendency"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Mark As Returned From Audit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,614 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Retirement</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Audit- Retirement</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']}, data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Audit - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Mark As Audit Certificate Received</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Audit Certificate Received Date<span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks<span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditsubmit">Submit</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditsubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditsubmit').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditsubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/pensioner/audit/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditsubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditsubmit').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/pensioner/audit/retirement"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditsubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,687 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#completedDetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#completedDetailsModal label{ |
|||
padding-top: 3%; |
|||
} |
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Contributory Pension Scheme</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Contributory Pension Scheme</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Completed Contributory Pension Scheme</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="completedCPSTable"> |
|||
<table id="CompletedCPSDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name</th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Created Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="cps, iterStat : ${completedCPSList}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${cps['emp_no']}" class="text-center"></td> |
|||
<td th:text="${cps['emp_name']}" class="text-center"></td> |
|||
<td th:text="${cps['dept_name']}" class="text-center"></td> |
|||
<td th:text="${cps['designation']}" class="text-center"></td> |
|||
<td th:text="${cps['created_date'] != null ? #dates.format(cps['created_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${cps['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" |
|||
th:attr="data-id=${cps['emp_no']}, data-temp-id=${cps['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box for CompletedDetails --> |
|||
<!-- Modal Box for CompletedDetails --> |
|||
<div class="modal fade" id="completedDetailsModal" tabindex="-1" role="dialog" aria-labelledby="completedDetailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="completedDetailsModalLabel"> |
|||
Completed Details (<span id="completedModalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
<label for="completedEmployeeNo" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedEmployeeNo" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedEmployeeName" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedEmployeeName" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedDepartment" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedDepartment" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedDesignation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedDesignation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="completedClass" class="form-label fw-bold">Class <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedClass" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="completedType" class="form-label fw-bold">Type of Completion <span class="text-danger">*</span></label> |
|||
<input type="text" id="completedType" class="form-control" readonly> |
|||
</div> |
|||
<!-- UAC Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold" for="uac">Whether File Sent UAC Date <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="uacYes" name="uac" class="form-check-input" value="Yes" > |
|||
<label for="uacYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="uacNo" name="uac" class="form-check-input" value="No" > |
|||
<label for="uacNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="uacInputDiv" style="display: none;"> |
|||
<input type="date" id="uacDate" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Pending Duration Section --> |
|||
<!-- <div class="col-md-6"> |
|||
<label class="form-label fw-bold">Pending Duration <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="oneYear" name="pendingDuration" class="form-check-input" value="ONE_YEAR" disabled> |
|||
<label for="oneYear" class="form-check-label">yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="moreThanOneYear" name="pendingDuration" class="form-check-input" value="MORETHAN_ONE_YEAR" disabled> |
|||
<label for="moreThanOneYear" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="reasonForPendingDiv" style="display: none;"> |
|||
<input type="text" id="reasonForPending" class="form-control" readonly> |
|||
</div> |
|||
</div> --> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="pendingDurationYes" name="pendingDuration" value="yes" class="form-check-input"> |
|||
<label for="pendingDurationYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="pendingDurationNo" name="pendingDuration" value="no" class="form-check-input"> |
|||
<label for="pendingDurationNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- CPS Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold">Whether CPS Amount Settled <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="cpsYes" name="cps" class="form-check-input" value="Yes" > |
|||
<label for="cpsYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="cpsNo" name="cps" class="form-check-input" value="No"> |
|||
<label for="cpsNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="cpsInputDiv" style="display: none;"> |
|||
<input type="text" id="cpsAmount" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- EL/LPA Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold">Whether EL/LPA Amount Settled <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="elLpaYes" name="el_or_lpa" class="form-check-input" value="yes" > |
|||
<label for="elLpaYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="elLpaNo" name="el_or_lpa" class="form-check-input" value="no" > |
|||
<label for="elLpaNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="elLpaInputDiv" style="display: none;"> |
|||
<input type="text" id="elLpaAmount" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS Section --> |
|||
<div class="col-md-6"> |
|||
<label class="form-label fw-bold">Whether SPFGS Amount Settled <span class="text-danger">*</span></label> |
|||
<div class="d-flex"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="spfgsYes" name="spfgs" class="form-check-input" value="yes" > |
|||
<label for="spfgsYes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="spfgsNo" name="spfgs" class="form-check-input" value="no" > |
|||
<label for="spfgsNo" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="mt-3" id="spfgsInputDiv" style="display: none;"> |
|||
<input type="text" id="spfgsAmount" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="completedRemarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="completedRemarks" class="form-control" rows="4" placeholder="Enter remarks" readonly></textarea> |
|||
</div> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="completedBackButton">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
|
|||
|
|||
<script> |
|||
|
|||
const table = $('#CompletedCPSDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
// Handle view button click to fetch completed details |
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); |
|||
const tempId = $(this).data('temp-id'); |
|||
|
|||
if (!tempId) { |
|||
console.error("tempId is missing!"); |
|||
return; |
|||
} |
|||
|
|||
console.log("empCode:", empCode || "Not Provided"); |
|||
console.log("tempId:", tempId); |
|||
|
|||
fetchCPSDetails(tempId); |
|||
loadFileHistory(tempId); |
|||
}); |
|||
|
|||
// Initialize modal |
|||
$('#completedDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false |
|||
}); |
|||
|
|||
// Handle Close and Back button click |
|||
$('.close, #back').click(function () { |
|||
$('#completedDetailsModal').modal('hide'); |
|||
//clearFields(); |
|||
}); |
|||
|
|||
|
|||
function fetchCPSDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetailscps', |
|||
type: 'GET', |
|||
data: { tempId: tempId }, |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
let cpsDetails = response[0]; // Access the first object in the array |
|||
console.log("response:", response); |
|||
|
|||
// Populate modal fields with CPS details |
|||
$('#completedModalEmployeeCode').text(cpsDetails.emp_no); |
|||
$('#completedEmployeeNo').val(cpsDetails.emp_no); |
|||
$('#completedEmployeeName').val(cpsDetails.emp_name); |
|||
$('#completedDepartment').val(cpsDetails.dept_name); |
|||
$('#completedDesignation').val(cpsDetails.designation); |
|||
$('#completedClass').val(cpsDetails.retirement_class); |
|||
$('#completedType').val(cpsDetails.type_of_retirement); |
|||
$('#completedRemarks').val(cpsDetails.remarks); |
|||
|
|||
// Populate UAC Section |
|||
if (cpsDetails.uac === "yes") { |
|||
$('#uacYes').prop('checked', true); // Check Yes radio button |
|||
$('#uacNo').prop('disabled', true); // Disable No radio button |
|||
$('#uacInputDiv').show(); // Show date input field |
|||
$('#uacDate').val(cpsDetails.uac_date || '').prop('readonly', true); // Set UAC date and make readonly |
|||
} else if (cpsDetails.uac_sent === "no") { |
|||
$('#uacNo').prop('checked', true); // Check No radio button |
|||
$('#uacYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#uacInputDiv').hide(); // Hide date input field |
|||
} |
|||
|
|||
// Populate Pending Duration and Reason for Pending pendingDurationYes pendingDurationNo pendingDurationInputContainer pendingDurationInput |
|||
if (cpsDetails.pending_duration === "yes") { |
|||
$('#pendingDurationYes').prop('checked', true); |
|||
$('#pendingDurationNo').prop('disabled', true); // Disable the other option |
|||
$('#pendingDurationInputContainer').show(); // Hide reason input |
|||
$('#pendingDurationInput').val(cpsDetails.reason_for_pending || '').prop('readonly', true); |
|||
} else if (cpsDetails.pending_duration === "no") { |
|||
$('#pendingDurationYes').prop('disabled', true); |
|||
$('#pendingDurationNo').prop('checked', true); |
|||
$('#pendingDurationInputContainer').hide(); // Show reason input field |
|||
|
|||
} |
|||
|
|||
// Populate CPS Section based on response or data |
|||
if (cpsDetails.cps === "yes") { |
|||
$('#cpsYes').prop('checked', true); // Check Yes radio button |
|||
$('#cpsNo').prop('disabled', true); // Disable No radio button |
|||
$('#cpsInputDiv').show(); // Show CPS amount input field |
|||
$('#cpsAmount').val(cpsDetails.cps_amount || '').prop('readonly', true); // Set CPS amount and make readonly |
|||
} else if (cpsDetails.cps === "no") { |
|||
$('#cpsNo').prop('checked', true); // Check No radio button |
|||
$('#cpsYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#cpsInputDiv').hide(); // Hide CPS amount input field |
|||
} |
|||
|
|||
// Populate EL or LPA Section based on response or data |
|||
if (cpsDetails.el_or_lpa === "yes") { |
|||
$('#elLpaYes').prop('checked', true); // Check Yes radio button |
|||
$('#elLpaNo').prop('disabled', true); // Disable No radio button |
|||
$('#elLpaInputDiv').show(); // Show input field for EL or LPA Amount |
|||
$('#elLpaAmount').val(cpsDetails.el_or_lpa_amount || '').prop('readonly', true); // Set the amount and make readonly |
|||
} else if (cpsDetails.el_or_lpa === "no") { |
|||
$('#elLpaNo').prop('checked', true); // Check No radio button |
|||
$('#elLpaYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#elLpaInputDiv').hide(); // Hide input field for EL or LPA Amount |
|||
} |
|||
|
|||
// Populate SPFGS Section based on response or data |
|||
if (cpsDetails.spfgs === "yes") { |
|||
$('#spfgsYes').prop('checked', true); // Check Yes radio button |
|||
$('#spfgsNo').prop('disabled', true); // Disable No radio button |
|||
$('#spfgsInputDiv').show(); // Show SPFGS amount input field |
|||
$('#spfgsAmount').val(cpsDetails.spfgs_amount || '').prop('readonly', true); // Set SPFGS amount and make readonly |
|||
} else if (cpsDetails.spfgs === "no") { |
|||
$('#spfgsNo').prop('checked', true); // Check No radio button |
|||
$('#spfgsYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#spfgsInputDiv').hide(); // Hide SPFGS amount input field |
|||
} |
|||
|
|||
// Handle SPFGS changes |
|||
$('#spfgsYes').change(function () { |
|||
if ($(this).is(':checked')) { |
|||
$('#spfgsNo').prop('disabled', true); // Disable No radio button |
|||
$('#spfgsInputDiv').show(); // Show SPFGS amount input field |
|||
} |
|||
}); |
|||
|
|||
$('#spfgsNo').change(function () { |
|||
if ($(this).is(':checked')) { |
|||
$('#spfgsYes').prop('disabled', true); // Disable Yes radio button |
|||
$('#spfgsInputDiv').hide(); // Hide SPFGS amount input field |
|||
} |
|||
}); |
|||
|
|||
// Show the modal after fetching details |
|||
$('#completedDetailsModal').modal('show'); |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected CPS record.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch CPS details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
$('#completedBackButton').on('click', function () { |
|||
$('#completedDetailsModal').modal('hide'); // Replace 'yourModalId' with the actual modal ID |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
///history function to show in modal |
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,807 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#sec1 .col-md-4,.col-md-12{ |
|||
padding-top: 1%; |
|||
} |
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.col-md-6 .form-check{ |
|||
width: 25%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5> Family Pension</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Family Pension</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Completed - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row" id="sec1"> |
|||
|
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- While in Service Death --> |
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While in Service Death <span class="text-danger">*</span></label> |
|||
<input type="text" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Relationship of Deceased --> |
|||
<div class="col-md-6"> |
|||
<label for="relationship" class="form-label fw-bold">Relationship of Deceased <span class="text-danger">*</span></label> |
|||
<input type="text" id="relationship" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS<span class="text-danger">*</span></label> |
|||
<input type="text" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Department Benefits</span> |
|||
</div> |
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes" disabled> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no" disabled> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90" disabled> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes" disabled> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no" disabled> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes" disabled> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no" disabled> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</span> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="pensionNumber" class="form-label">Pension Number<span class="text-danger">*</span></label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number<span class="text-danger">*</span></label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes" disabled> |
|||
<label class="form-check-label" for="bpYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no" disabled> |
|||
<label class="form-check-label" for="bpNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="PbAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="DcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="DcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="dcrgAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes" disabled> |
|||
<label class="form-check-label" for="commutationYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no" disabled> |
|||
<label class="form-check-label" for="commutationNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="CommutationAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getpartialdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#relationship').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
|
|||
|
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
$('#pensionNumber').val(employeeDetails.pension_number); |
|||
$('#ledgerNumber').val(employeeDetails.ledger_number); |
|||
|
|||
$('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_pension === "yes") { |
|||
$('#PbAmountDiv').show(); |
|||
$('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount); |
|||
} else { |
|||
$('#PbAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_dcrg === "yes") { |
|||
$('#dcrgAmountDiv').show(); |
|||
$('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount); |
|||
} else { |
|||
$('#dcrgAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_commutation === "yes") { |
|||
$('#CommutationAmountDiv').show(); |
|||
$('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount); |
|||
} else { |
|||
$('#CommutationAmountDiv').hide(); |
|||
} |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,546 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>GIS</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">GIS</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Completed-GIS</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="GISDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']}, data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
GIS - Completed (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No</label> |
|||
<input type="text" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">While in service Death </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="gisentry" class="form-label fw-bold">GIS Entry Type<span class="text-danger">*</span></label> |
|||
<input type="text" id="gisentry" class="form-control" readonly> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="gisamount" class="form-label fw-bold"> |
|||
Sanctioned GIS Advance |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="gisyes" name="gisamount" class="form-check-input" value="Yes"> |
|||
<label for="gisyes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="gisno" name="gisamount" class="form-check-input" value="No"> |
|||
<label for="gisno" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="gisAmountInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="gisAmountInput" class="form-control" readonly> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionalGISDate " class="form-label fw-bold">Sanctional GIS Date</label> |
|||
<input type="date" id="sanctionalGISDate" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="sanctionalGisAmount " class="form-label fw-bold">Sanctional GIS Amount </label> |
|||
<input type="number" id="sanctionalGisAmount" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="licDate " class="form-label fw-bold">File Forward To LIC On</label> |
|||
<input type="date" id="licDate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">File Completed Date </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
// Initialize DataTable |
|||
const table = $('#GISDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#gisentry').val(employeeDetails.gis_entry); |
|||
|
|||
$('#classes').val(employeeDetails.relationship_deceased); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.service_death); |
|||
|
|||
$('#sanctionalGISDate').val(employeeDetails.sanctional_gis_date); |
|||
$('#sanctionalGisAmount').val(employeeDetails.sanctional_gis_amount); |
|||
$('#licDate').val(employeeDetails.lic_date); |
|||
|
|||
/* gisyes |
|||
gisno |
|||
gisAmountInputContainer |
|||
gisAmountInput */ |
|||
|
|||
|
|||
// Populate gis advance Section based on response or data |
|||
if (employeeDetails.gis_advance === "yes") { |
|||
$('#gisyes').prop('checked', true); // Check Yes radio button |
|||
$('#gisno').prop('disabled', true); // Disable No radio button |
|||
$('#gisAmountInputContainer').show(); // Show CPS amount input field |
|||
$('#gisAmountInput').val(employeeDetails.gis_advance_amount || '').prop('readonly', true); // Set CPS amount and make readonly |
|||
} else if (employeeDetails.gis_advance === "no") { |
|||
$('#gisno').prop('checked', true); // Check No radio button |
|||
$('#gisyes').prop('disabled', true); // Disable Yes radio button |
|||
$('#gisAmountInputContainer').hide(); // Hide CPS amount input field |
|||
} |
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditsubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,807 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#sec1 .col-md-4,.col-md-12{ |
|||
padding-top: 1%; |
|||
} |
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.col-md-6 .form-check{ |
|||
width: 25%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5> Pendency</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Pendency</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Completed - Pendency (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row" id="sec1"> |
|||
|
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-4"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement <span class="text-danger">*</span></label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
<span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="text" id="pendingDurationInputContainer" style="margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Department Benefits</span> |
|||
</div> |
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes" disabled> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no" disabled> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90" disabled> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes" disabled> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no" disabled> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes" disabled> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no" disabled> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</span> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="pensionNumber" class="form-label">Pension Number<span class="text-danger">*</span></label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number<span class="text-danger">*</span></label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes" disabled> |
|||
<label class="form-check-label" for="bpYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no" disabled> |
|||
<label class="form-check-label" for="bpNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="PbAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="DcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="DcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="dcrgAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes" disabled> |
|||
<label class="form-check-label" for="commutationYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no" disabled> |
|||
<label class="form-check-label" for="commutationNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="CommutationAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getpartialdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
$('#pensionNumber').val(employeeDetails.pension_number); |
|||
$('#ledgerNumber').val(employeeDetails.ledger_number); |
|||
|
|||
$('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_pension === "yes") { |
|||
$('#PbAmountDiv').show(); |
|||
$('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount); |
|||
} else { |
|||
$('#PbAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_dcrg === "yes") { |
|||
$('#dcrgAmountDiv').show(); |
|||
$('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount); |
|||
} else { |
|||
$('#dcrgAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_commutation === "yes") { |
|||
$('#CommutationAmountDiv').show(); |
|||
$('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount); |
|||
} else { |
|||
$('#CommutationAmountDiv').hide(); |
|||
} |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,716 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Provisional Retriement</h5> |
|||
<span>Department Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Department Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Provisional Retriement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Provisional Retirement</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="receivedprovisionalModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Received From Department - Provisional Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class<span class="text-danger">*</span></label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type Of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type Of Retirement<span class="text-danger">*</span></label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Reason For Provisional Pension is given --> |
|||
<!-- provisionalreason |
|||
otherReason --> |
|||
<div class="col-md-6"> |
|||
<label for="provisionalreason" class="form-label fw-bold">Reason For Provisional Pension is given <span class="text-danger">*</span></label> |
|||
<input type="text" id="provisionalreason" class="form-control" readonly> |
|||
<div id="otherReasonDiv" style="display: none; margin-top: 10px;"> |
|||
<label for="otherReason" class="form-label">Please specify:</label> |
|||
<input type="text" id="otherReason" class="form-control" placeholder="Enter reason" readonly> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Pension Section --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension Section <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly onclick="this.showPicker()"> |
|||
</div> |
|||
|
|||
<!-- Pending Duration --> |
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold">Pending Duration <span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" disabled> |
|||
<label for="yespen" class="form-check-label">yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" disabled> |
|||
<label for="nopen" class="form-check-label">no</label> |
|||
</div> |
|||
</div> |
|||
<div id="clickyesdiv" style="display: none; margin-top: 10px;"> |
|||
<label for="clickyes" class="form-label">Please specify:</label> |
|||
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason"> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- dp --> |
|||
<div class="col-md-6"> |
|||
<label for="DP" class="form-label fw-bold">DP<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check " style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="DP" value="yes" class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">yes</label> |
|||
</div> |
|||
<br> |
|||
<div class="form-check" > |
|||
<input type="radio" id="no" name="DP" value="no" class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label" >no</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Retirement Amount --> |
|||
<div class="col-md-6"> |
|||
<label for="RetirementAmount" class="form-label fw-bold"> |
|||
Provisional Retirement Amount <span class="text-danger">*</span> |
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="fifty" name="RetirementAmount" value="50" class="form-check-input" disabled> |
|||
<label for="fifty" class="form-check-label">50%</label> |
|||
</div> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="seventyfive" name="RetirementAmount" value="75" class="form-check-input" disabled> |
|||
<label for="seventyfive" class="form-check-label">75%</label> |
|||
</div> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="hundred" name="RetirementAmount" value="100" class="form-check-input" disabled> |
|||
<label for="hundred" class="form-check-label">100%</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Additional Input Field --> |
|||
<div class="mt-3" id="additionalInputDiv" style="display: none;"> |
|||
<input type="number" id="additionalInput" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="2" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#receivedprovisionalModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
// Handle Close button click |
|||
$('.close').click(function () { |
|||
$('#receivedprovisionalModal').modal('hide'); // Hide the modal |
|||
clearFields(); // Clear input fields |
|||
}); |
|||
|
|||
// Handle Back button click |
|||
$('#back').click(function () { |
|||
$('#receivedprovisionalModal').modal('hide'); // Hide the modal |
|||
clearFields(); // Clear input fields |
|||
}); |
|||
|
|||
// Function to clear input fields |
|||
function clearFields() { |
|||
$('#datefile').val(''); // Clear date input |
|||
$('#remarks').val(''); // Clear textarea |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#provisionalreason').val(employeeDetails.reason_for_provisional_pension); |
|||
|
|||
// Ensure employeeDetails exists |
|||
if (employeeDetails) { |
|||
let prPercentage = employeeDetails.pr_percentage; |
|||
let prAmount = employeeDetails.pr_amount || ''; |
|||
|
|||
// Convert pr_percentage to string to avoid type mismatches |
|||
prPercentage = prPercentage ? prPercentage.toString() : ''; |
|||
|
|||
// Reset any previously selected radio buttons (in case of multiple calls) |
|||
$('#fifty').prop('checked', false).prop('disabled', false); |
|||
$('#seventyfive').prop('checked', false).prop('disabled', false); |
|||
$('#hundred').prop('checked', false).prop('disabled', false); |
|||
|
|||
// Hide the additional input field initially |
|||
$('#additionalInputDiv').hide(); |
|||
|
|||
// Check if pr_percentage is a valid percentage |
|||
if (prPercentage === "50") { |
|||
// Select 50% radio button and disable all |
|||
$('#fifty').prop('checked', true).prop('disabled', true); |
|||
$('#seventyfive').prop('disabled', true); |
|||
$('#hundred').prop('disabled', true); |
|||
} else if (prPercentage === "75" || prPercentage === "75.00") { |
|||
// Select 75% radio button and disable all |
|||
$('#seventyfive').prop('checked', true).prop('disabled', true); |
|||
$('#fifty').prop('disabled', true); |
|||
$('#hundred').prop('disabled', true); |
|||
|
|||
// If pr_amount exists, set it in the additional input |
|||
$('#additionalInputDiv').show(); |
|||
$('#additionalInput').val(prAmount).prop('readonly', true); |
|||
} else if (prPercentage === "100") { |
|||
// Select 100% radio button and disable all |
|||
$('#hundred').prop('checked', true).prop('disabled', true); |
|||
$('#fifty').prop('disabled', true); |
|||
$('#seventyfive').prop('disabled', true); |
|||
} else { |
|||
// If pr_percentage is NOT 50, 75, or 100, show the additional input field |
|||
$('#additionalInputDiv').show(); |
|||
$('#additionalInput').val(prAmount).prop('readonly', true); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// Populate Pending Duration and Reason fields |
|||
if (employeeDetails.pending_duration === "Yes") { |
|||
$('#yespen').prop('checked', true); // Check the Yes radio button |
|||
$('#clickyesdiv').show(); // Show the reason input |
|||
$('#Clickyes').val(employeeDetails.reason_for_pending || '').prop('readonly' ,true); // Set reason and make readonly |
|||
} else if (employeeDetails.pending_duration === "No") { |
|||
$('#nopen').prop('checked', true); // Check the No radio button |
|||
$('#clickyesdiv').hide(); // Hide the reason input |
|||
} |
|||
//populate reason for provisional pension |
|||
if (employeeDetails.reason_for_provisional_pension === "Others") { |
|||
$('#otherReasonDiv').show(); // Show the input field for 'Others' |
|||
$('#otherReason') |
|||
.val(employeeDetails.others_provisional_pension || '') |
|||
.prop('readonly' ,true); // Populate and make readonly |
|||
} else { |
|||
$('#otherReasonDiv').hide(); // Hide the input field if reason is not 'Others' |
|||
} |
|||
|
|||
// Handle DP value |
|||
if (employeeDetails.dp === "yes") { |
|||
$('#yes').prop('checked', true); // Select 'yes' radio button |
|||
} else if (employeeDetails.dp === "no") { |
|||
$('#no').prop('checked', true); // Select 'no' radio button |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#receivedprovisionalModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
$(document).on('click', '#submitbutton', function () { |
|||
|
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
///history function to show in modal |
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,770 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#receivedprovisionalModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
#sec1 .col-md-4,.col-md-12{ |
|||
padding-top: 1%; |
|||
} |
|||
.col-md-4 .form-check{ |
|||
width: 25%; |
|||
} |
|||
.col-md-6 .form-check{ |
|||
width: 25%; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5> Retirement</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Completed</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<span th:text="${filecategory}" id="filecategory" style="display:none"></span> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span>Completed - Retirement</h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="provisional, iterStat : ${provisionallist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_no']}" class="text-center"></td> |
|||
<td th:text="${provisional['emp_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['dept_name']}" class="text-center"></td> |
|||
<td th:text="${provisional['designation']}" class="text-center"></td> |
|||
<td th:text="${provisional['file_moved_date'] != null ? #dates.format(provisional['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${provisional['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${provisional['emp_no']}, data-temp-id=${provisional['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Completed - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row" id="sec1"> |
|||
|
|||
<!-- Employee No --> |
|||
<div class="col-md-4"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No <span class="text-danger">*</span></label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-4"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name <span class="text-danger">*</span></label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-4"> |
|||
<label for="department" class="form-label fw-bold">Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-4"> |
|||
<label for="designation" class="form-label fw-bold">Designation <span class="text-danger">*</span></label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date <span class="text-danger">*</span></label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-4"> |
|||
<label for="classes" class="form-label fw-bold">Class <span class="text-danger">*</span></label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-4"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement <span class="text-danger">*</span></label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-4"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Audit <span class="text-danger">*</span></label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Department Benefits</span> |
|||
</div> |
|||
<!-- GPF --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">GPF<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfYes" name="gpf" value="yes" disabled> |
|||
<label class="form-check-label" for="gpfYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpfNo" name="gpf" value="no" disabled> |
|||
<label class="form-check-label" for="gpfNo">No</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="gpf50" name="gpf" value="90" disabled> |
|||
<label class="form-check-label" for="gpf50">90%</label> |
|||
</div> |
|||
</div> |
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="gpfAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="gpfAmount" class="form-label">Enter GPF Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="gpfAmount" class="form-control" placeholder="Enter GPF amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Earned Leave & Leave on Private Affairs --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Earned Leave & Leave on Private Affairs<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveYes" name="earnedleave" value="yes" disabled> |
|||
<label class="form-check-label" for="earnedleaveYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="earnedleaveNo" name="earnedleave" value="no" disabled> |
|||
<label class="form-check-label" for="earnedleaveNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="earnedleaveAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="earnedleaveAmount" class="form-label">Enter EL and LPA Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="earnedleaveAmount" class="form-control" placeholder="Enter Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- SPFGS --> |
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">SPFGS<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsYes" name="spfgs" value="yes" disabled> |
|||
<label class="form-check-label" for="spfgsYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="spfgsNo" name="spfgs" value="no" disabled> |
|||
<label class="form-check-label" for="spfgsNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="spfgsAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="spfgsAmount" class="form-label">Enter SPFGS Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="spfgsAmount" class="form-control" placeholder="Enter spfgs Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label for="recoveryemployeevalue" class="form-label fw-bold">Recovery From Employee</label> |
|||
<input type="text" id="recoveryemployeevalue" class="form-control" placeholder="Enter Recovery From Employee" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- DCRF File is Ready --> |
|||
<div class="col-md-4"> |
|||
<label class="form-label fw-bold">DCRG File is Ready<span class="text-danger">*</span></label> |
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgYes" name="dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="dcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="dcrgNo" name="dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="dcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-12 "> |
|||
<span style="font-weight: bold;font-size: medium;text-decoration: underline;">Pension Benefits</span> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="pensionNumber" class="form-label">Pension Number<span class="text-danger">*</span></label> |
|||
<input type="number" id="pensionNumber" class="form-control" placeholder="Enter Employee Pension Number" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6 mt-2 mb-2"> |
|||
<label for="ledgerNumber" class="form-label">Ledger Number<span class="text-danger">*</span></label> |
|||
<input type="number" id="ledgerNumber" class="form-control" placeholder="Enter Ledger Number" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Pension<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpYes" name="benefit_pension" value="yes" disabled> |
|||
<label class="form-check-label" for="bpYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="bpNo" name="benefit_pension" value="no" disabled> |
|||
<label class="form-check-label" for="bpNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="PbAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_pension_amount" class="form-label">Enter Pensions Benefit Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_pension_amount" class="form-control" placeholder="Enter Pensions Benefit Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-DCRG<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgYes" name="benefit_dcrg" value="yes" disabled> |
|||
<label class="form-check-label" for="DcrgYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="DcrgNo" name="benefit_dcrg" value="no" disabled> |
|||
<label class="form-check-label" for="DcrgNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="dcrgAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_dcrg_amount" class="form-label">Enter Benefit DCRG Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_dcrg_amount" class="form-control" placeholder="Enter Pensions Benefit DCRG Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-md-4 mb-2"> |
|||
<label class="form-label fw-bold">Sanctions Pensions Benefit-Commutation<span class="text-danger">*</span></label> |
|||
|
|||
<div class="d-flex align-items-center gap-5"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationYes" name="benefit_commutation" value="yes" disabled> |
|||
<label class="form-check-label" for="commutationYes">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="radio" id="commutationNo" name="benefit_commutation" value="no" disabled> |
|||
<label class="form-check-label" for="commutationNo">No</label> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Placeholder for dynamically added input --> |
|||
<div id="CommutationAmountDiv" class="mt-3" style="display: none;"> |
|||
<label for="benefit_commutation_amount" class="form-label">Enter Benefit Commutation Amount<span class="text-danger">*</span></label> |
|||
<input type="number" id="benefit_commutation_amount" class="form-control" placeholder="Enter Pensions Benefit Commutation Amount" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
|
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
|
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
// Initialize DataTable |
|||
const table = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getpartialdetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
|
|||
|
|||
$('input[name="gpf"][value="' + employeeDetails.gpf + '"]').prop('checked', true); |
|||
if (employeeDetails.gpf === "yes" || employeeDetails.gpf === "90") { |
|||
$('#gpfAmountDiv').show(); |
|||
$('#gpfAmount').val(employeeDetails.gpf_amount); |
|||
} else { |
|||
$('#gpfAmountDiv').hide(); |
|||
} |
|||
|
|||
// Earned Leave & Leave on Private Affairs |
|||
$('input[name="earnedleave"][value="' + employeeDetails.private_affairs + '"]').prop('checked', true); |
|||
if (employeeDetails.private_affairs === "yes") { |
|||
$('#earnedleaveAmountDiv').show(); |
|||
$('#earnedleaveAmount').val(employeeDetails.private_affairs_amount); |
|||
} else { |
|||
$('#earnedleaveAmountDiv').hide(); |
|||
} |
|||
|
|||
// SPFGS |
|||
$('input[name="spfgs"][value="' + employeeDetails.spfgs + '"]').prop('checked', true); |
|||
if (employeeDetails.spfgs === "yes") { |
|||
$('#spfgsAmountDiv').show(); |
|||
$('#spfgsAmount').val(employeeDetails.spfgs_amount); |
|||
} else { |
|||
$('#spfgsAmountDiv').hide(); |
|||
} |
|||
|
|||
// DCRG File |
|||
$('input[name="dcrg"][value="' + employeeDetails.dcrg + '"]').prop('checked', true); |
|||
|
|||
$('#pensionNumber').val(employeeDetails.pension_number); |
|||
$('#ledgerNumber').val(employeeDetails.ledger_number); |
|||
|
|||
$('input[name="benefit_pension"][value="' + employeeDetails.benefit_pension + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_pension === "yes") { |
|||
$('#PbAmountDiv').show(); |
|||
$('#benefit_pension_amount').val(employeeDetails.benefit_pension_amount); |
|||
} else { |
|||
$('#PbAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_dcrg"][value="' + employeeDetails.benefit_dcrg + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_dcrg === "yes") { |
|||
$('#dcrgAmountDiv').show(); |
|||
$('#benefit_dcrg_amount').val(employeeDetails.benefit_dcrg_amount); |
|||
} else { |
|||
$('#dcrgAmountDiv').hide(); |
|||
} |
|||
|
|||
$('input[name="benefit_commutation"][value="' + employeeDetails.benefit_commutation + '"]').prop('checked', true); |
|||
if (employeeDetails.benefit_commutation === "yes") { |
|||
$('#CommutationAmountDiv').show(); |
|||
$('#benefit_commutation_amount').val(employeeDetails.benefit_commutation_amount); |
|||
} else { |
|||
$('#CommutationAmountDiv').hide(); |
|||
} |
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
console.log("empCode====="+empCode); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,915 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
/* Base Layout and Styling */ |
|||
|
|||
body { |
|||
font-family: 'Arial', sans-serif; |
|||
background-color: #f8f9fa; |
|||
} |
|||
|
|||
/* Card Styling */ |
|||
.card-box { |
|||
border-radius: 12px; |
|||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); |
|||
background-color: #ffffff; |
|||
padding: 20px; |
|||
transition: transform 0.3s ease-in-out; |
|||
} |
|||
|
|||
.card-box:hover { |
|||
transform: translateY(-5px); |
|||
} |
|||
|
|||
/* Title Styling */ |
|||
h3 { |
|||
font-size: 1.2rem; |
|||
color: #444; |
|||
} |
|||
|
|||
/* Styling for Overall Pendency and Stage Wise Sections */ |
|||
.charts { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
gap: 30px; /* Increased gap between charts */ |
|||
margin-top: 30px; /* Increased margin-top */ |
|||
} |
|||
|
|||
.chart { |
|||
flex: 1; |
|||
background: #ffffff; /* White background */ |
|||
padding: 20px; |
|||
border-radius: 8px; |
|||
border: 2px solid #1e90ff; /* Add a colored border */ |
|||
width: 100%; |
|||
box-sizing: border-box; |
|||
text-align: center; |
|||
transition: all 0.3s ease-in-out; |
|||
} |
|||
|
|||
.chart:hover { |
|||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.chart h3 { |
|||
font-size: 1.2rem; |
|||
color: #333; |
|||
margin-bottom: 15px; |
|||
} |
|||
|
|||
.chart canvas { |
|||
display: block; |
|||
max-width: 100%; |
|||
height: auto; |
|||
} |
|||
|
|||
/* Stats Cards */ |
|||
.stats { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
justify-content: center; |
|||
gap: 30px; /* Increased gap between stats cards */ |
|||
margin-top: 30px; /* Increased margin-top */ |
|||
} |
|||
|
|||
.stat-card { |
|||
background: #ffffff; |
|||
border: 2px solid #1e90ff; |
|||
padding: 20px; |
|||
border-radius: 8px; |
|||
text-align: center; |
|||
flex: 1; |
|||
margin: 10px; /* Reduced margin for cleaner look */ |
|||
} |
|||
|
|||
.stat-card:hover { |
|||
transform: scale(1.05); |
|||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.stat-card h2 { |
|||
margin: 0; |
|||
font-size: 36px; |
|||
color: #007bff; |
|||
} |
|||
|
|||
.stat-card p { |
|||
margin: 5px 0 0; |
|||
font-size: 13px; |
|||
color: #555; |
|||
font-weight:bold; |
|||
} |
|||
|
|||
/* Buttons */ |
|||
.btn-primary:hover { |
|||
background-color: #0056b3; |
|||
} |
|||
|
|||
.btn-warning:hover { |
|||
background-color: #e0a800; |
|||
} |
|||
|
|||
/* Container Styling */ |
|||
.container { |
|||
max-width: 1200px; |
|||
margin: 20px auto; |
|||
padding: 20px; |
|||
background: #fff; |
|||
border-radius: 8px; |
|||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); |
|||
} |
|||
|
|||
/* Date Input Row */ |
|||
.row.mt-3.ml-2 { |
|||
margin-top: 20px; /* Increased margin-top */ |
|||
} |
|||
|
|||
/* Responsive Design */ |
|||
@media (min-width: 768px) { |
|||
.charts { |
|||
flex-direction: row; |
|||
} |
|||
|
|||
.charts .chart { |
|||
width: calc(50% - 15px); /* Increased gap between charts */ |
|||
} |
|||
|
|||
.stats { |
|||
flex-direction: row; |
|||
} |
|||
} |
|||
|
|||
@media (max-width: 576px) { |
|||
.charts, |
|||
.stats { |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.stat-card { |
|||
margin: 15px 0; /* Increased margin for better spacing */ |
|||
} |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
table.dataTable td { |
|||
white-space: normal !important; |
|||
word-wrap: break-word !important; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
|
|||
<body> |
|||
<div class="wrapper"> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<div class="page-wrap"> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Dashboard</h5> |
|||
<span>Pension Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item">Pension Entries</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Dashboard</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row mt-4"> |
|||
<div class="col-md-12"> |
|||
|
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight: bold;">Pension Department</h5> |
|||
|
|||
<div class="d-flex justify-content-end align-items-center"> |
|||
<label for="EmpCode" style="font-weight: bold; margin-right: 10px;" class="mb-0">EmpCode:</label> |
|||
<input type="text" id="EmpCode" name="EmpCode" class="form-control" style="width: auto; min-width: 150px; margin-right: 10px;"> |
|||
<button id="searchEmpButton" class="btn btn-primary">Search</button> |
|||
</div> |
|||
|
|||
<div class="row mt-3 ml-2 "> |
|||
<div class="col-md-3"> |
|||
<label for="startDate" class="form-label">From Date:</label> |
|||
<input type="date" id="startDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="endDate" class="form-label">To Date:</label> |
|||
<input type="date" id="endDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="deptId" class="form-label fw-bold">Department Name:</label> |
|||
<div class="dropdown"> |
|||
<select id="deptId" class="form-control" style="width: 100%;" required> |
|||
<option value="" selected>-- Select Option --</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Centering the Buttons --> |
|||
<div class="col-12 d-flex justify-content-center mt-3"> |
|||
<button id="searchButton" class="btn btn-primary mx-2">Search</button> |
|||
<input type="reset" class="btn btn-warning mx-2" value="Reset"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="stats" class="stats"></div> |
|||
<div class="charts"> |
|||
<div class="chart"> |
|||
<h3>File Category - Overall</h3> |
|||
<div id="overallPieChart" style="width: 100%; height: 400px;"></div> |
|||
|
|||
</div> |
|||
<div class="chart"> |
|||
<h3>File Category Stages Wise</h3> |
|||
<div id="stagesBarChart" style="width: 100%; height: 400px;"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
<!-- Modal --> |
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" |
|||
role="dialog" aria-labelledby="zoneDetailsModalLabel" |
|||
aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div id="zone-details-content"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="modal fade" id="EmpcodeDetailsModal" tabindex="-1" |
|||
role="dialog" aria-labelledby="zoneDetailsModalLabel" |
|||
aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div id="emp-details-content"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
|||
|
|||
<script src="/assets/node_modules/amcharts3/amcharts/amcharts.js"></script> |
|||
<script src="/assets/node_modules/amcharts3/amcharts/serial.js"></script> |
|||
|
|||
<script src="/assets/node_modules/amcharts3/amcharts/pie.js"></script> |
|||
<script src="/assets/node_modules/amcharts3/amcharts/themes/light.js"></script> |
|||
|
|||
<script> |
|||
document.addEventListener('DOMContentLoaded', function () { |
|||
$('#searchEmpButton').on('click', function () { // Ensure there's a button with id "searchButton" |
|||
const Empcode = document.getElementById('EmpCode').value.trim(); // Get input value |
|||
console.log("empcode",Empcode); |
|||
|
|||
//fetch details |
|||
if (Empcode) { |
|||
$.ajax({ |
|||
url: `/fetchPensionEmpDetails?Empcode=${Empcode}`, // Backend API route |
|||
type: 'GET', |
|||
success: function (response) { |
|||
console.log(response); |
|||
|
|||
if (!response || response.length === 0) { // Check if response is empty |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "No Data Found", |
|||
text: "No records found for the entered Employee Code.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} else { |
|||
renderEmpDetailsModal(response); |
|||
} |
|||
}, |
|||
error: function (xhr) { |
|||
console.error("Error fetching employee details:", xhr.status, xhr.responseText); |
|||
} |
|||
}); |
|||
} else { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Enter Employee Code", |
|||
text: "Please enter an Employee Code before searching.", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} |
|||
}) |
|||
|
|||
|
|||
|
|||
function renderEmpDetailsModal(data) { |
|||
const Empcode = document.getElementById('EmpCode').value.trim(); |
|||
|
|||
let modalContent = ` |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Employee Details for ${Empcode}</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="table-responsive"> |
|||
<table id="DashboardDatatable" class="table table-striped table-bordered table-hover dataTable"> |
|||
<thead class="thead-dark"> |
|||
<tr> |
|||
<th class="text-center">S.NO</th> |
|||
<th class="text-center">Department Name</th> |
|||
<th class="text-center">File Name</th> |
|||
<th class="text-center">File Status</th> |
|||
<th class="text-center">History</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
${data.map((item, index) => ` |
|||
<tr data-temp-id="${item.temp_id}"> |
|||
<td>${index + 1}</td> |
|||
<td>${item.dept_name}</td> |
|||
<td>${item.file_name}</td> |
|||
<td>${item.file_status}</td> |
|||
<td class="file-history-column" id="history-${item.temp_id}">Loading...</td> |
|||
</tr> |
|||
`).join('')} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
`; |
|||
|
|||
document.getElementById('emp-details-content').innerHTML = modalContent; |
|||
|
|||
// **Fetch History Before Initializing DataTable** |
|||
let fetchPromises = data.map(item => fetchDetailsByTempId(item.temp_id)); |
|||
|
|||
Promise.all(fetchPromises).then(() => { |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
|
|||
// **Initialize DataTable AFTER Data is Loaded and reason for intialize** |
|||
setTimeout(() => { |
|||
let table = $('#DashboardDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [{ targets: 'no-sort', orderable: false }], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
// ✅ Prevents automatic column width issues |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ |
|||
extend: 'copyHtml5', |
|||
text: 'Copy', |
|||
className: 'btn btn-secondary', |
|||
exportOptions: { columns: ':visible', modifier: { page: 'all' } } |
|||
}, |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Excel', |
|||
className: 'btn btn-secondary', |
|||
customize: function (xlsx) { |
|||
let sheet = xlsx.xl.worksheets['sheet1.xml']; |
|||
$('row c[r]', sheet).attr('s', '55'); // Apply word-wrap formatting |
|||
} |
|||
}, |
|||
{ |
|||
extend: 'csvHtml5', |
|||
text: 'CSV', |
|||
className: 'btn btn-secondary', |
|||
exportOptions: { columns: ':visible' } |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'PDF', |
|||
className: 'btn btn-secondary', |
|||
orientation: 'landscape', |
|||
pageSize: 'A4', |
|||
customize: function (doc) { |
|||
doc.styles.tableBodyEven.alignment = 'left'; |
|||
doc.styles.tableBodyOdd.alignment = 'left'; |
|||
doc.styles.tableHeader.alignment = 'center'; |
|||
doc.defaultStyle.fontSize = 9; |
|||
doc.styles.tableHeader.fontSize = 10; |
|||
doc.content[1].table.widths = Array(doc.content[1].table.body[0].length + 1).join('*').split(''); |
|||
} |
|||
} |
|||
], |
|||
|
|||
responsive: false, |
|||
processing: false |
|||
}); |
|||
|
|||
// ✅ Adjust column width after table is fully initialized |
|||
|
|||
}, 200); |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
// **Fetch History & Update Table** |
|||
function fetchDetailsByTempId(tempId) { |
|||
return new Promise((resolve, reject) => { |
|||
$.ajax({ |
|||
url: `/fetchTempDetails?tempId=${tempId}`, |
|||
type: 'GET', |
|||
success: function (response) { |
|||
let historyContainer = $(`#history-${tempId}`); |
|||
if (response.length > 0) { |
|||
let historyHtml = response.map(item => ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.file_moved_date)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.file_status}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarks || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`).join(''); |
|||
historyContainer.html(historyHtml); |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
$('#EmpcodeDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#EmpcodeDetailsModal').modal('hide'); |
|||
}); |
|||
} else { |
|||
historyContainer.html('<p>No file history available.</p>'); |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
$('#EmpcodeDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#EmpcodeDetailsModal').modal('hide'); |
|||
}); |
|||
} |
|||
resolve(); |
|||
}, |
|||
error: function () { |
|||
$(`#history-${tempId}`).html('<p>Failed to load file history.</p>'); |
|||
$('#EmpcodeDetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false |
|||
}); |
|||
$('#EmpcodeDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#EmpcodeDetailsModal').modal('hide'); |
|||
}); |
|||
resolve(); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
// **Helper Function to Format Date** |
|||
function formatDateTime(dateString) { |
|||
const options = { day: '2-digit', month: '2-digit', year: 'numeric' }; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); |
|||
} |
|||
|
|||
|
|||
|
|||
$.ajax({ |
|||
url: "/getDepartments", |
|||
type: "GET", |
|||
|
|||
success: function (data) { |
|||
var dropdown = $("#deptId"); |
|||
dropdown.empty(); |
|||
dropdown.append('<option value="" selected>-- Select Option --</option>'); |
|||
$.each(data, function (key, entry) { |
|||
//console.log(entry); |
|||
dropdown.append($('<option></option>').attr('value', entry.dept_id).text(entry.dept_name)); |
|||
}); |
|||
}, |
|||
error: function () { |
|||
console.log("Error loading dropdown data."); |
|||
} |
|||
}); |
|||
// Function to fetch data from /dashboard endpoint |
|||
function loadDashboardData() { |
|||
|
|||
$.ajax({ |
|||
url: `/dashboard`, |
|||
type: 'GET', |
|||
contentType: 'application/json', |
|||
success: function (data) { |
|||
const statsDiv = document.getElementById('stats'); |
|||
statsDiv.innerHTML = ''; // Clear previous stats |
|||
|
|||
data.forEach(item => { |
|||
const statCard = document.createElement('div'); |
|||
statCard.className = 'stat-card'; |
|||
statCard.innerHTML = ` |
|||
<h2>${item.category_count}</h2> |
|||
<p>${item.file_name}</p> |
|||
`; |
|||
statsDiv.appendChild(statCard); |
|||
}); |
|||
|
|||
// Call renderCharts after data is loaded |
|||
console.log("Dashboard data loaded, rendering charts..."); |
|||
renderCharts(); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error('Error fetching dashboard data:', status, error); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to handle search button click |
|||
document.getElementById('searchButton').addEventListener('click', function () { |
|||
const startDate = document.getElementById('startDate').value; |
|||
const endDate = document.getElementById('endDate').value; |
|||
const deptId= document.getElementById('deptId').value; |
|||
|
|||
console.log(deptId); |
|||
if (!startDate || !endDate ) { |
|||
Swal.fire({ |
|||
icon: "warning", |
|||
title: "Incomplete Search", |
|||
text: "Please select the Date Before searching", |
|||
confirmButtonText: "OK", |
|||
}); |
|||
} else { |
|||
|
|||
$.ajax({ |
|||
url: `/dashboardsearch?startdate=${startDate}&enddate=${endDate}&deptId=${encodeURIComponent(deptId)}`, |
|||
type: 'GET', |
|||
|
|||
dataType: 'json', |
|||
success: function (data) { |
|||
const statsDiv = document.getElementById('stats'); |
|||
statsDiv.innerHTML = data.map(item => ` |
|||
<div class='stat-card'> |
|||
<h2>${item.category_count}</h2> |
|||
<p>${item.file_name}</p> |
|||
</div> |
|||
`).join(''); |
|||
|
|||
// Re-render charts after search results load |
|||
renderCharts(startDate, endDate); |
|||
}, |
|||
error: function () { |
|||
console.error('Error fetching search data.'); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
// Function to validate and set min-date for endDate |
|||
function validateEndDate() { |
|||
const startDate = document.getElementById('startDate').value; |
|||
const endDateInput = document.getElementById('endDate'); |
|||
|
|||
if (startDate) { |
|||
const startDateObj = new Date(startDate); |
|||
const minEndDateISO = startDateObj.toISOString().split('T')[0]; |
|||
|
|||
endDateInput.setAttribute('min', minEndDateISO); |
|||
|
|||
// Clear endDate if it's less than startDate |
|||
if (endDateInput.value && new Date(endDateInput.value) < startDateObj) { |
|||
endDateInput.value = ''; |
|||
} |
|||
} |
|||
} |
|||
|
|||
document.getElementById('startDate').addEventListener('change', validateEndDate); |
|||
function renderCharts(startDate = null, endDate = null) { |
|||
const deptId= document.getElementById('deptId').value; |
|||
const dataParams = deptId ? { deptId, startDate, endDate } : { startDate, endDate }; |
|||
console.log("deptId",deptId); |
|||
disposeExistingCharts(); |
|||
|
|||
// Dispose existing amCharts instances (amCharts v3 doesn't have a built-in registry) |
|||
function disposeExistingCharts() { |
|||
if (window.chart1) { |
|||
window.chart1.clear(); |
|||
window.chart1 = null; |
|||
} |
|||
if (window.chart2) { |
|||
window.chart2.clear(); |
|||
window.chart2 = null; |
|||
} |
|||
} |
|||
|
|||
// Function to render charts using amCharts v3 |
|||
const fixedColors = { |
|||
"Retirement": "#6A0572", // Deep Purple |
|||
"Family Pension": "#2C3E50", // Dark Blue-Gray |
|||
"Pendency": "#A569BD", // Soft Lavender |
|||
"GIS": "#17A589", // Teal Green |
|||
"Provisional Retirement": "#D35400", // Warm Orange |
|||
"Contributory Pension Scheme": "#5D6D7E" // Muted Gray-Blue |
|||
}; |
|||
$.ajax({ |
|||
url: `/categoryCounts`, |
|||
type: 'GET', |
|||
data: dataParams, |
|||
dataType: 'json', |
|||
success: function (data,index) { |
|||
const chartData = data.map(item => ({ |
|||
category: item.file_name, |
|||
value: item.category_count, |
|||
color: fixedColors[item.file_name] , |
|||
id:item.id |
|||
})); |
|||
|
|||
window.chart1 = AmCharts.makeChart("overallPieChart", { |
|||
type: "pie", |
|||
theme: "dark", |
|||
dataProvider: chartData, |
|||
valueField: "value", |
|||
titleField: "category", |
|||
colorField: "color", |
|||
radius: "40%", // Outer radius |
|||
innerRadius: "50%", // Inner radius to create the donut shape |
|||
labelText: "[[[[title]]]] - [[[[value]]]]",// this is to show the values on the piechart |
|||
fontSize: 14, |
|||
labelsEnabled: true, |
|||
pullOutRadius:0, |
|||
gradientRatio: [-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, 0, 0.1, 0.2, 0.1, 0, -0.2, -0.5],//this is to show the piechart in better look |
|||
export: { |
|||
enabled: true, |
|||
}, |
|||
responsive: { |
|||
enabled: true, |
|||
}, |
|||
legend: { |
|||
position: "bottom", |
|||
markerType: "circle", |
|||
valueText: "[[[[value]]]]", |
|||
switchable: false, |
|||
markerSize: 12, |
|||
fontSize: 12 |
|||
}, |
|||
balloon: { |
|||
fixedPosition: true |
|||
}, |
|||
listeners: [ |
|||
{ |
|||
event: "clickSlice", |
|||
method: function (event) { |
|||
const FileId = event.dataItem.dataContext.id; |
|||
const FileNumber = event.dataItem.dataContext.category; |
|||
// Fetch emp_no from the server based on file_name |
|||
fetchempno(FileId,FileNumber); |
|||
} |
|||
} |
|||
] |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("AJAX Request Failed:", status, error); |
|||
console.error("Response Text:", xhr.responseText); |
|||
} |
|||
}); |
|||
function fetchempno(FileId,FileNumber){ |
|||
$.ajax({ |
|||
url: `/getEmpNoByFileName?file_id=${FileId}`, |
|||
type: 'GET', |
|||
success: function (response) { |
|||
// Render the modal with emp_no data |
|||
renderEmpNoModal(FileNumber, response); |
|||
}, |
|||
error: function(error) { |
|||
console.error("Error fetching region details:", error); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function renderEmpNoModal(FileNumber, empNos) { |
|||
console.log(empNos); |
|||
const modalContent = ` |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Employee Numbers for ${FileNumber}</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<table class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th>Employee Number</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
${empNos.map(empNo => `<tr><td>${empNo.emp_no}</td></tr>`).join('')} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
`; |
|||
|
|||
document.getElementById('zone-details-content').innerHTML = modalContent; |
|||
//$('#zoneDetailsModal').modal('show'); |
|||
$('.close').click(function () { |
|||
$('#zoneDetailsModal').modal('hide'); |
|||
|
|||
}); |
|||
} |
|||
|
|||
function getRandomColor() { |
|||
const letters = '0123456789ABCDEF'; |
|||
let color = '#'; |
|||
for (let i = 0; i < 6; i++) { |
|||
color += letters[Math.floor(Math.random() * 16)]; |
|||
} |
|||
return color; |
|||
} |
|||
|
|||
// Bar Chart - Pendency Stages Wise |
|||
$.ajax({ |
|||
url: `/stageWiseCounts`, |
|||
type: 'GET', |
|||
data: dataParams, |
|||
|
|||
success: function (data) { |
|||
const colorMapping = { |
|||
"Audit Pending": "#FF5733", |
|||
"Department Pending": "#FFC300", |
|||
"Pension Pending": "#28B463", |
|||
"Completed": "#3498DB" |
|||
}; |
|||
|
|||
const chartData = data.map(item => ({ |
|||
category: item.category, |
|||
value: item.category_count, |
|||
color: colorMapping[item.category] // Default gray color if no match |
|||
})); |
|||
|
|||
window.chart2 = AmCharts.makeChart("stagesBarChart", { |
|||
type: "serial", |
|||
theme: "light", |
|||
dataProvider: chartData, |
|||
depth3D: 2, |
|||
angle: 10, |
|||
valueAxes: [{ |
|||
axisAlpha: 0, |
|||
gridAlpha: 0, |
|||
labelsEnabled: false, |
|||
dashLength: 0 |
|||
}], |
|||
startDuration: 1, |
|||
startEffect: "easeInSine", |
|||
graphs: [{ |
|||
balloonText: "[[[[category]]]]: [[[[value]]]]", |
|||
fillAlphas: 0.8, |
|||
lineAlpha: 0.2, |
|||
topRadius: 1, |
|||
type: "column", |
|||
valueField: "value", |
|||
fillColorsField: "color", |
|||
columnWidth: 0.5, |
|||
labelText: "[[[[value]]]]", |
|||
labelPosition: "right", |
|||
fontSize: 14, |
|||
color: "#000000" |
|||
}], |
|||
categoryField: "category", |
|||
categoryAxis: { |
|||
gridPosition: "start", |
|||
gridAlpha: 0, |
|||
autoWrap: false, |
|||
axisAlpha: 0, |
|||
fontSize: 14 |
|||
}, |
|||
rotate: true, |
|||
export: { |
|||
enabled: true, |
|||
position: "bottom-right" |
|||
} |
|||
}); |
|||
|
|||
console.log("Stages Bar Chart Data:", chartData); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("AJAX Request Failed:", status, error); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
// Initial data load |
|||
loadDashboardData(); |
|||
document.querySelector("input[type='reset']").addEventListener('click', function () { |
|||
window.location.href = "/gcc/pensioner/dashboard"; |
|||
}); |
|||
|
|||
|
|||
// Initial chart rendering |
|||
}) |
|||
|
|||
|
|||
</script> |
|||
</body> |
|||
|
|||
</html> |
|||
@ -0,0 +1,731 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Family Pension</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Forward to Department</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Family Pension</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Forward to Department- Family Pension</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${forwardlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnfamilypensiondetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Forward to Department - Family Pension (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- pending duration--> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="pendingDurationInputContainer" style="margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- While in Service Death --> |
|||
<div class="col-md-6"> |
|||
<label for="servicedeath" class="form-label fw-bold">While in Service Death </label> |
|||
<input type="text" id="servicedeath" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Relationship of Deceased --> |
|||
<div class="col-md-6"> |
|||
<label for="relationship" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="relationship" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionedgis" class="form-label fw-bold">Sanctioned GIS</label> |
|||
<input type="text" id="sanctionedgis" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Audit Certificate Received Date</label> |
|||
<input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Submit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile" class="form-label fw-bold">Enter Date File Forward to Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Forward To Department</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
|
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#servicedeath').val(employeeDetails.service_death); |
|||
$('#relationship').val(employeeDetails.relationship_deceased); |
|||
$('#sanctionedgis').val(employeeDetails.sanctioned_gis_amount); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
|
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnfamilypensiondetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnfamilypensiondetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnfamilypensiondetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/pension/forward/updateForwardFamilyPension', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Forward To Department'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Forward To Department'); |
|||
window.location.href = "/gcc/pensioner/forward/familypension"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Forward To Department'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,725 @@ |
|||
|
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
#modalBody h4 { |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
.comment { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.comment p { |
|||
margin: 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
/* Limit the height of the dropdown menu and make it scrollable */ |
|||
.dropdown-menu { |
|||
max-height: 200px; /* Adjust this value as needed */ |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
|
|||
.col-4 { |
|||
font-weight: bold; |
|||
text-align: right; |
|||
} |
|||
|
|||
.col-8 { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
.comment { |
|||
padding: 10px 0; |
|||
} |
|||
|
|||
.comment .text-muted { |
|||
font-size: 0.9em; |
|||
color: #6c757d; |
|||
} |
|||
|
|||
.comment hr { |
|||
border-top: 1px solid #ccc; |
|||
} |
|||
|
|||
.comment .btn-link { |
|||
font-size: 0.9em; |
|||
text-decoration: underline; |
|||
color: #007bff; |
|||
} |
|||
/* Make the modal body scrollable */ |
|||
#detailsModal .modal-body { |
|||
max-height: 70vh; /* Limit the height to 70% of the viewport */ |
|||
overflow-y: auto; /* Enable vertical scrolling */ |
|||
} |
|||
|
|||
.card-box { |
|||
border-radius: 20px; |
|||
box-shadow: rgba(0, 0, 0, 0.5) 0px 3px 8px; |
|||
} |
|||
|
|||
#followupCard { |
|||
transition: transform 0.2s ease; /* Smooth scaling transition */ |
|||
cursor: pointer; /* Default cursor change */ |
|||
} |
|||
|
|||
#followupCard:hover { |
|||
transform: scale(1.05); /* Slightly scale up on hover */ |
|||
cursor: pointer; /* Change cursor to hand symbol */ |
|||
} |
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
|
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
|
|||
|
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Pendency</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Forward to Department</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Pendency</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Forward to Department- Pendency</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="AuditDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Category Type</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${forwardlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_category_name']}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']},data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnpendencydetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-xl" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Forward to Department -Pendency(<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeeno" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeeno" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6" > |
|||
<label for="retirement" class="form-label fw-bold">Type Of Retirement</label> |
|||
<input type="text" id="retirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-6"> |
|||
<label for="pendingDuration" class="form-label fw-bold"> |
|||
Pending Duration |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="yes" name="pendingDuration" value="yes"class="form-check-input" disabled> |
|||
<label for="yes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="no" name="pendingDuration" value="no"class="form-check-input" disabled> |
|||
<label for="no" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="text" id="pendingDurationInputContainer" style="margin-top: 10px;"> |
|||
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" readonly> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Audit Certificate Received Date</label> |
|||
<input type="date" id="datefile_modal" class="form-control" onclick="this.showPicker()" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
|
|||
<!-- file history --> |
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Submit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Enter Date File Forward to Department<span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="auditbutton">Forward To Department</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize the DataTable |
|||
const dataTable = $('#AuditDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
paging: true, |
|||
info: true, |
|||
ordering: false, |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
console.log("employeecode:",tempId); |
|||
|
|||
// Populate modal fields |
|||
$('#employeeno').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirement').val(employeeDetails.type_of_retirement); |
|||
|
|||
// Show Pending Duration and Input based on the value |
|||
|
|||
let pendingDuration = employeeDetails.pending_duration; // Assuming this comes from the response |
|||
let pendingReason = employeeDetails.reason_for_pending; // Assuming this comes from the response |
|||
|
|||
if (pendingDuration === "yes") { |
|||
$('#pendingDurationInputContainer').show(); // Show the text box |
|||
$('#pendingDurationInput').val(pendingReason); // Populate the input field |
|||
} else { |
|||
$('#pendingDurationInputContainer').hide(); // Hide the text box |
|||
} |
|||
|
|||
// Update radio button selection |
|||
if (pendingDuration === "yes") { |
|||
$('#yes').prop('checked', true); |
|||
} else { |
|||
$('#no').prop('checked', true); |
|||
} |
|||
|
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnpendencydetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('auditbutton').addEventListener('click', function () { |
|||
let employeeNo = $('#employeeno').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#auditbutton').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
const tempId = $(this).data('temp-id'); |
|||
console.log("empCode====="+empCode); |
|||
console.log("tempId====="+tempId); |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
|
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnfamilypensiondetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnpendencydetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empNo) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empNo, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.warn("Validation error: Missing Remarks"); |
|||
return; |
|||
} |
|||
|
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditbutton').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/pension/forward/updateForwardPendency', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditbutton').prop('disabled', false).text('Forward To Department'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditbutton').prop('disabled', false).text('Forward To Department'); |
|||
window.location.href = "/gcc/pensioner/forward/pendency"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditbutton').prop('disabled', false).text('Forward To Department'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
@ -0,0 +1,595 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>Retirement</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Forward to Department</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Forward To Department - Retirement</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="returnretriedtable"> |
|||
<table id="ReturnRetriedDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="forward, iterStat : ${forwardlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${forward['emp_no']}" class="text-center"></td> |
|||
<td th:text="${forward['emp_name']}" class="text-center"></td> |
|||
<td th:text="${forward['dept_name']}" class="text-center"></td> |
|||
<td th:text="${forward['designation']}" class="text-center"></td> |
|||
<td th:text="${forward['file_moved_date'] != null ? #dates.format(forward['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${forward['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${forward['emp_no']}, data-temp-id=${forward['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Modal Box --> |
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
Forward to Department - Retirement (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="number" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">Retirement Date </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Class </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="typeofretirement" class="form-label fw-bold">Type of Retirement </label> |
|||
<input type="text" id="typeofretirement" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Audit Certificate Received Date </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Forward To Department</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">Enter Date File Forward to Department <span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary" id="forwardsubmit">Submit</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
$(document).ready(function () { |
|||
// Initialize DataTable |
|||
const table = $('#ReturnRetriedDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
// $('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#typeofretirement').val(employeeDetails.type_of_retirement); |
|||
$('#classes').val(employeeDetails.retirement_class); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.retirement_date); |
|||
|
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
/* document.getElementById('forwardsubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); */ |
|||
|
|||
$('#forwardsubmit').off('click').on('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Get the employee number |
|||
saveEntryDetails(tempId, employeeNo); // Call function with parameters |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#forwardsubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/pension/forward/updateEmployeeDetails', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#forwardsubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#forwardsubmit').prop('disabled', false).text('Submit'); |
|||
window.location.href = "/gcc/pensioner/forward/retirement"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#forwardsubmit').prop('disabled', false).text('Submit'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
console.error('Error:', xhr.responseText); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
1190
frontend/pensioner/pensioner/partial/familypension.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1184
frontend/pensioner/pensioner/partial/pendency.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1184
frontend/pensioner/pensioner/partial/retirement.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1373
frontend/pensioner/pensioner/received/familypension.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,726 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" dir=""> |
|||
<html xmlns:th="http://www.thymeleaf.org"> |
|||
<head th:replace="~{fragments/modules/base/head :: head}"></head> |
|||
<style> |
|||
.required{ |
|||
color: red; |
|||
} |
|||
|
|||
#modalBody p { |
|||
margin: 5px 0; |
|||
} |
|||
|
|||
#modalBody hr { |
|||
margin: 15px 0; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #ccc; |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
h5 { |
|||
|
|||
font-size: bold; |
|||
} |
|||
|
|||
|
|||
#returnretrieddetailsModal .modal-body{ |
|||
max-height:80vh; |
|||
overflow-y:auto; |
|||
} |
|||
|
|||
#returnretrieddetailsModal .col-md-6{ |
|||
padding-bottom: 10px; |
|||
} |
|||
.file-history-list { |
|||
margin-top: 10px; |
|||
padding-left: 0; |
|||
} |
|||
|
|||
|
|||
.file-history-item { |
|||
display: flex; |
|||
padding: 5px 10px; |
|||
font-family: Arial, sans-serif; |
|||
align-items: flex-start; |
|||
position: relative; /* For vertical line positioning */ |
|||
margin-bottom: 1px; /* Add space between items */ |
|||
} |
|||
|
|||
.file-history-item::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
bottom: 0; |
|||
left: 120px; /* Position of the vertical line */ |
|||
width: 1px; |
|||
background-color: #ddd; |
|||
} |
|||
|
|||
.file-history-date { |
|||
margin-top: 10px; |
|||
flex: 0 0 100px; |
|||
font-weight: bold; |
|||
font-size: 0.8rem; |
|||
color: #333; |
|||
text-align: center; |
|||
white-space: nowrap; /* Prevent wrapping */ |
|||
} |
|||
|
|||
.file-history-content { |
|||
flex: 5; |
|||
padding-left: 20px; /* Adds space after the vertical line */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 5px; /* Adds spacing between status and remarks */ |
|||
white-space: pre-wrap; /* Prevents wrapping */ |
|||
overflow: visible; /* Prevents content overflow */ |
|||
text-overflow: ellipsis; /* Adds ellipsis if content exceeds container width */ |
|||
} |
|||
|
|||
.file-history-status { |
|||
font-size: 0.8rem; |
|||
font-weight: bold; |
|||
color: #555; |
|||
white-space:pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.file-history-remarks { |
|||
font-size: 0.8rem; |
|||
color: #777; |
|||
white-space: pre-wrap; /* Prevent wrapping */ |
|||
overflow: visible; |
|||
text-overflow: ellipsis; |
|||
} |
|||
</style> |
|||
<body> |
|||
<!--[if lt IE 8]> |
|||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
|
|||
<div class="wrapper"> |
|||
<!-- header top menu Start --> |
|||
<header th:replace="~{fragments/modules/base/header :: header}"></header> |
|||
<!-- header top menu end --> |
|||
|
|||
<div class="page-wrap"> |
|||
<!--=============== Left Menu side Start ================--> |
|||
<div th:replace="~{fragments/modules/base/menu :: menu}"></div> |
|||
<!--=============== Left side End ================--> |
|||
<div class="main-content"> |
|||
<div class="container-fluid"> |
|||
<div class="page-header mb-2"> |
|||
<div class="row align-items-end"> |
|||
<div class="col-lg-8"> |
|||
<div class="page-header-title"> |
|||
<i class="fa fa-list-alt bg-blue"></i> |
|||
<div class="d-inline"> |
|||
<h5>GIS</h5> |
|||
<span>Pensioner Entries</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<nav class="breadcrumb-container" aria-label="breadcrumb"> |
|||
<ol class="breadcrumb"> |
|||
<li class="breadcrumb-item"><a href="/gcc/index"><i class="ik ik-home"></i></a></li> |
|||
<li class="breadcrumb-item" aria-current="page">Pensioner Entries</li> |
|||
<li class="breadcrumb-item" aria-current="page">Audit</li> |
|||
<li class="breadcrumb-item active" aria-current="page">Retirement</li> |
|||
</ol> |
|||
</nav> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row mt-4"> |
|||
|
|||
<div class="col-md-12"> |
|||
<div class="card"> |
|||
<div class="card-block"> |
|||
<h5 style="font-weight:bold;">Received From Department-GIS</h5> |
|||
<h5 style="font-weight:bold;"><span th:text="${deptId}" id="deptId" style="display:none"></span></h5> |
|||
<span th:text="${userId}" id="userId" style="display:none"></span> |
|||
<div id="audittable"> |
|||
<table id="GISDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid"> |
|||
<thead class="thead-dark"> |
|||
<tr role="row"> |
|||
<th class="text-center">S.No</th> |
|||
<th class="text-center">Employee Code</th> |
|||
<th class="text-center">Name </th> |
|||
<th class="text-center">Department</th> |
|||
<th class="text-center">Designation</th> |
|||
<th class="text-center">File Sent Date</th> |
|||
<th class="text-center">File Type</th> |
|||
<th class="text-center">View</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="text-align:center;"> |
|||
|
|||
<!-- Thymeleaf loop to populate data --> |
|||
<tr th:each="audit, iterStat : ${auditlist}"> |
|||
<td th:text="${iterStat.index + 1}" class="text-center"></td> |
|||
<td th:text="${audit['emp_no']}" class="text-center"></td> |
|||
<td th:text="${audit['emp_name']}" class="text-center"></td> |
|||
<td th:text="${audit['dept_name']}" class="text-center"></td> |
|||
<td th:text="${audit['designation']}" class="text-center"></td> |
|||
<td th:text="${audit['file_moved_date'] != null ? #dates.format(audit['file_moved_date'], 'dd-MM-yyyy') : 'N/A'}" class="text-center"></td> |
|||
<td th:text="${audit['file_entry_type']}" class="text-center"></td> |
|||
<td class="text-center"> |
|||
<button class="btn btn-primary btn-sm view-btn" th:attr="data-id=${audit['emp_no']}, data-temp-id=${audit['temp_id']}"> |
|||
View |
|||
</button> |
|||
</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Modal Box --> |
|||
|
|||
<div class="modal fade" id="returnretrieddetailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
|||
<div class="modal-dialog modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="detailsModalLabel"> |
|||
GIS - Received (<span id="modalEmployeeCode"></span>) |
|||
</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<!-- Employee No --> |
|||
<div class="col-md-6"> |
|||
<label for="employeenomodel" class="form-label fw-bold">Employee No </label> |
|||
<input type="text" id="employeenomodel" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Employee Name --> |
|||
<div class="col-md-6"> |
|||
<label for="employeename" class="form-label fw-bold">Employee Name </label> |
|||
<input type="text" id="employeename" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Department --> |
|||
<div class="col-md-6"> |
|||
<label for="department" class="form-label fw-bold">Department </label> |
|||
<input type="text" id="department" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Designation --> |
|||
<div class="col-md-6"> |
|||
<label for="designation" class="form-label fw-bold">Designation </label> |
|||
<input type="text" id="designation" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-sm-6"> |
|||
<label for="retirementdate" class="form-label fw-bold">While in service Death </label> |
|||
<input type="date" id="retirementdate" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Class --> |
|||
<div class="col-md-6"> |
|||
<label for="classes" class="form-label fw-bold">Relationship of Deceased </label> |
|||
<input type="text" id="classes" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="gisentry" class="form-label fw-bold">GIS Entry Type<span class="text-danger">*</span></label> |
|||
<input type="text" id="gisentry" class="form-control" readonly> |
|||
|
|||
</div> |
|||
<!-- Type of Retirement --> |
|||
<div class="col-md-6"> |
|||
<label for="gisamount" class="form-label fw-bold"> |
|||
Sanctioned GIS Advance |
|||
|
|||
</label> |
|||
<div class="d-flex align-items-center"> |
|||
<div class="form-check" style="padding-right:10px;"> |
|||
<input type="radio" id="gisyes" name="gisamount" class="form-check-input" value="Yes"> |
|||
<label for="gisyes" class="form-check-label">Yes</label> |
|||
</div> |
|||
<div class="form-check"> |
|||
<input type="radio" id="gisno" name="gisamount" class="form-check-input" value="No"> |
|||
<label for="gisno" class="form-check-label">No</label> |
|||
</div> |
|||
</div> |
|||
<div class="dropdown" id="gisAmountInputContainer" style="display: none; margin-top: 10px;"> |
|||
<input type="text" id="gisAmountInput" class="form-control" readonly> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<!-- Date File Sent to Audit --> |
|||
<div class="col-md-6"> |
|||
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension </label> |
|||
<input type="date" id="datefile_modal" class="form-control" readonly> |
|||
</div> |
|||
|
|||
<!-- Remarks --> |
|||
<div class="col-md-12"> |
|||
<label for="remarks_modal" class="form-label fw-bold">Comments/Remarks </label> |
|||
<textarea id="remarks_modal" class="form-control" rows="4" placeholder="Enter your remarks here" readonly></textarea> |
|||
</div> |
|||
|
|||
<!-- new --> |
|||
|
|||
<div class="col-md-12 mt-4"> |
|||
<h5>File History</h5> |
|||
<div id="fileHistoryContainer" class="file-history-list"> |
|||
<!-- File History will be dynamically loaded here --> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-primary mx-2" id="submitbutton">Submit</button> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="back">Back</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="display :none" id="receivedcard"> |
|||
<div class="row"> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionalGISDate " class="form-label fw-bold">Sanctional GIS Date<span class="text-danger">*</span></label> |
|||
<input type="date" id="sanctionalGISDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<label for="sanctionalGisAmount " class="form-label fw-bold">Total Sanctional GIS Amount <span class="text-danger">*</span></label> |
|||
<input type="number" id="sanctionalGisAmount" class="form-control" placeholder="Enter Amount" min="1" oninput="validatePositiveNumber(this)"> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="licDate " class="form-label fw-bold">File Forward To LIC on<span class="text-danger">*</span></label> |
|||
<input type="date" id="licDate" class="form-control" onclick="this.showPicker()"> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="datefile " class="form-label fw-bold">File Sent Date<span class="text-danger">*</span></label> |
|||
<input type="text" id="datefile" class="form-control" readonly> |
|||
</div> |
|||
<div class="col-md-12"> |
|||
<label for="remarks" class="form-label fw-bold">Comments/Remarks <span class="text-danger">*</span></label> |
|||
<textarea id="remarks" class="form-control" rows="4" placeholder="Enter your remarks here"></textarea> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
<div class="row mb-2 mt-2"> |
|||
<div class="col-md-12 d-flex justify-content-center"> |
|||
<button type="button" class="btn btn-success" id="auditsubmit">Approved</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div> |
|||
|
|||
<script th:replace="~{fragments/modules/base/script :: script}"></script> |
|||
<script src="node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.min.js"></script> |
|||
<!-- Bootstrap 5 JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
// Initialize DataTable |
|||
const table = $('#GISDatatable').DataTable({ |
|||
dom: 'Bftip', |
|||
columnDefs: [ |
|||
{ targets: 'no-sort', orderable: false } |
|||
], |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '50vh', |
|||
buttons: [ |
|||
{ extend: 'pageLength', className: 'btn btn-warning' }, |
|||
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary' }, |
|||
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary' }, |
|||
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary' }, |
|||
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary' } |
|||
], |
|||
fixedHeader: true, |
|||
autoWidth: true, |
|||
responsive: true, |
|||
searching: true, |
|||
select: false, |
|||
processing: false |
|||
}); |
|||
|
|||
document.addEventListener("DOMContentLoaded", function() { |
|||
// Get today's date |
|||
const today = new Date(); |
|||
|
|||
// Format the date as DD-MM-YYYY for display |
|||
const day = String(today.getDate()).padStart(2, '0'); |
|||
const month = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based |
|||
const year = today.getFullYear(); |
|||
|
|||
// Combine into DD-MM-YYYY format for display |
|||
const formattedDateDisplay = `${day}-${month}-${year}`; |
|||
|
|||
// Set the value of the input field to the current date (in DD-MM-YYYY format for display) |
|||
document.getElementById("datefile").value = formattedDateDisplay; |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function convertDateFormat(dateString) { |
|||
if (!dateString) return ''; |
|||
let [day, month, year] = dateString.split('-'); |
|||
return `${year}-${month}-${day}`; |
|||
} |
|||
|
|||
|
|||
|
|||
document.getElementById("submitbutton").addEventListener("click", function () { |
|||
// Clear the inputs in the receivedcard section |
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
|
|||
// Make the receivedcard section visible |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
// Scroll the receivedcard section into view |
|||
document.getElementById("receivedcard").scrollIntoView({ |
|||
behavior: "smooth", // Smooth scrolling effect |
|||
block: "center" // Aligns the element to the center of the viewport |
|||
}); |
|||
}); |
|||
|
|||
//model function |
|||
function fetchEmployeeDetails(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/getemployeedetails', // API to fetch employee details |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass EMPLOYEE_CODE as a parameter |
|||
success: function (response) { |
|||
if (response && response.length > 0) { |
|||
|
|||
let employeeDetails = response[0]; // Access the first object in the array |
|||
console.log("response:",response); |
|||
|
|||
|
|||
// Populate modal fields |
|||
$('#employeenomodel').val(employeeDetails.emp_no); |
|||
$('#employeename').val(employeeDetails.emp_name); |
|||
$('#department').val(employeeDetails.dept_name); |
|||
$('#designation').val(employeeDetails.designation); |
|||
$('#gisentry').val(employeeDetails.gis_entry); |
|||
$('#classes').val(employeeDetails.relationship_deceased); |
|||
$('#datefile_modal').val(employeeDetails.file_moved_date); |
|||
$('#remarks_modal').val(employeeDetails.remarks); |
|||
$('#retirementdate').val(employeeDetails.service_death); |
|||
|
|||
|
|||
// Populate gis advance Section based on response or data |
|||
if (employeeDetails.gis_advance === "yes") { |
|||
$('#gisyes').prop('checked', true); // Check Yes radio button |
|||
$('#gisno').prop('disabled', true); // Disable No radio button |
|||
$('#gisAmountInputContainer').show(); // Show CPS amount input field |
|||
$('#gisAmountInput').val(employeeDetails.gis_advance_amount || '').prop('readonly', true); // Set CPS amount and make readonly |
|||
} else if (employeeDetails.gis_advance === "no") { |
|||
$('#gisno').prop('checked', true); // Check No radio button |
|||
$('#gisyes').prop('disabled', true); // Disable Yes radio button |
|||
$('#gisAmountInputContainer').hide(); // Hide CPS amount input field |
|||
} |
|||
|
|||
// Update the modal title with the employee code |
|||
$('#modalEmployeeCode').text(employeeDetails.emp_no); |
|||
|
|||
// Show the modal |
|||
$('#returnretrieddetailsModal').modal('show'); |
|||
|
|||
//additional card display function |
|||
document.getElementById("submitbutton").addEventListener("click", function() { |
|||
|
|||
//$('#datefile').val(''); |
|||
$('#remarks').val(''); |
|||
document.getElementById("receivedcard").style.display = "block"; |
|||
|
|||
}); |
|||
|
|||
document.getElementById('auditsubmit').addEventListener('click', function () { |
|||
let employeeNo = $('#employeenomodel').val(); // Using jQuery to get the value |
|||
|
|||
// Trigger the save function and pass the value |
|||
saveEntryDetails(tempId,employeeNo); |
|||
}); |
|||
|
|||
|
|||
|
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No details found for the selected employee.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
} |
|||
}, |
|||
error: function () { |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to fetch employee details. Please try again.', |
|||
confirmButtonText: 'OK', |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$(document).on('click', '.view-btn', function () { |
|||
const empCode = $(this).data('id'); // Fetch `data-id` value |
|||
console.log("empCode====="+empCode); |
|||
const tempId = $(this).data('temp-id'); // Fetch `data-temp-id` value |
|||
// Hide the receivedcard section before showing the modal |
|||
$("#receivedcard").hide(); |
|||
fetchEmployeeDetails(tempId); // Call the function to fetch employee details |
|||
loadFileHistory(tempId); // Load the file history for the selected employee |
|||
}); |
|||
|
|||
|
|||
// Initialize the modal with static backdrop and disabled keyboard closing |
|||
$('#returnretrieddetailsModal').modal({ |
|||
backdrop: 'static', |
|||
keyboard: false, |
|||
show: false // Ensure it doesn't auto-show on page load |
|||
}); |
|||
|
|||
|
|||
// Handle close button click |
|||
$('#back').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
|
|||
$('.close').click(function () { |
|||
$('#returnretrieddetailsModal').modal('hide'); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
function loadFileHistory(tempId) { |
|||
$.ajax({ |
|||
url: '/gcc/api/department/audit/fileMovementhistory', // API endpoint |
|||
type: 'GET', |
|||
data: { tempId: tempId }, // Pass empCode as a parameter |
|||
success: function (response) { |
|||
if (response.length > 0) { |
|||
let historyHtml = ''; |
|||
response.forEach(item => { |
|||
historyHtml += ` |
|||
<div class="file-history-item"> |
|||
<div class="file-history-date">${formatDateTime(item.fileMovedDateHistory)}</div> |
|||
<div class="file-history-content"> |
|||
<div class="file-history-status">${item.fileStatusHistory}</div> |
|||
<div class="file-history-remarks">Comments/Remarks: ${item.remarksHistory || 'N/A'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#fileHistoryContainer').html(historyHtml); |
|||
} else { |
|||
$('#fileHistoryContainer').html('<p>No file history available.</p>'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
$('#fileHistoryContainer').html('<p>Failed to load file history. Please try again later.</p>'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// Function to format date and time |
|||
function formatDateTime(dateString) { |
|||
const options = { |
|||
day: '2-digit', |
|||
month: '2-digit', |
|||
year: 'numeric', |
|||
}; |
|||
return new Date(dateString).toLocaleDateString('en-GB', options); // Formats as dd-mm-yyyy |
|||
} |
|||
|
|||
function saveEntryDetails(tempId,empCode) { |
|||
//console.log("emp_no inside=="+empCode); |
|||
|
|||
|
|||
let entryDetails = { |
|||
empNo: empCode, |
|||
tempId: tempId, |
|||
dateToAudit: convertDateFormat($('#datefile').val()?.trim()), |
|||
remarks: $('#remarks').val(), |
|||
deptId:$('#deptId').text().trim(), |
|||
sanctional_gis_date:$('#sanctionalGISDate').val(), |
|||
sanctional_gis_amount:$('#sanctionalGisAmount').val(), |
|||
lic_date:$('#licDate').val(), |
|||
filemovedby:$('#userId').text().trim() |
|||
}; |
|||
|
|||
console.log("entryDetails:",entryDetails); |
|||
|
|||
|
|||
if(!entryDetails.sanctional_gis_date){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Sanctional GIS Date are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
|
|||
if(!entryDetails.sanctional_gis_amount){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Sanctional GIS amount are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
if(!entryDetails.lic_date){ |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'LIC Date are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
if (!entryDetails.remarks) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Validation Error!', |
|||
text: 'Remarks are required.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
return; |
|||
} |
|||
|
|||
// Disable the button to prevent multiple submissions |
|||
$('#auditsubmit').prop('disabled', true).text('Processing...'); |
|||
|
|||
$.ajax({ |
|||
url: '/gcc/api/department/received/updateEmployeeDetailsgis', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
data: JSON.stringify(entryDetails), |
|||
success: function (response) { |
|||
$('#auditsubmit').prop('disabled', false).text('Approved'); |
|||
Swal.fire({ |
|||
icon: 'success', |
|||
title: 'Success', |
|||
text: response, |
|||
allowOutsideClick: false, |
|||
allowEscapeKey: false, |
|||
allowEnterKey: false, |
|||
confirmButtonText: 'OK' |
|||
}).then((result) => { |
|||
if (result.isConfirmed) { |
|||
$('#auditsubmit').prop('disabled', false).text('Approved'); |
|||
window.location.href = "/gcc/pensioner/received/gis"; |
|||
console.log("Continue clicked"); |
|||
} |
|||
}); |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#auditsubmit').prop('disabled', false).text('Approved'); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Failed to save details. Please try again.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//amount field validation |
|||
|
|||
function validatePositiveNumber(input) { |
|||
if (input.value < 1) { |
|||
input.value = ""; |
|||
} |
|||
} |
|||
|
|||
|
|||
// file forward lic date |
|||
document.addEventListener("DOMContentLoaded", function () { |
|||
let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format |
|||
let servicedeathInput = document.getElementById("licDate"); |
|||
|
|||
// Set max attribute to disable future dates |
|||
servicedeathInput.setAttribute("max", today); |
|||
|
|||
// Prevent manual future date entry |
|||
servicedeathInput.addEventListener("change", function () { |
|||
if (this.value > today) { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Invalid Date', |
|||
text: 'Future dates are not allowed.', |
|||
confirmButtonText: 'OK' |
|||
}); |
|||
this.value = ""; // Clear the invalid input |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
1348
frontend/pensioner/pensioner/received/pendency.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1000
frontend/pensioner/pensioner/received/provisionalretirement.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1306
frontend/pensioner/pensioner/received/retirement.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1556
frontend/pensioner/pensioner/reports.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue