Skip to content

Commit b55e1fc

Browse files
committed
project report edit
1 parent 3de5244 commit b55e1fc

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

src/main/java/com/health/controller/HomeController.java

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6801,6 +6801,73 @@ else if (ext.equals(CommonData.UNSUPPORTED_EXTENSION)) {
68016801
return addProjectReportGet(req, principal, model);
68026802
}
68036803

6804+
@GetMapping("/projectReport/edit/{fileType}/{id}")
6805+
public String projectReportEditGet(@PathVariable String fileType, @PathVariable int id, HttpServletRequest req,
6806+
Model model, Principal principal) {
6807+
6808+
User usr = getUser(principal);
6809+
logger.info("{} {} {}", usr.getUsername(), req.getMethod(), req.getRequestURI());
6810+
model.addAttribute("userInfo", usr);
6811+
6812+
ProjectReport pr = projectReportService.findByProjectReportId(id);
6813+
6814+
if (pr == null) {
6815+
6816+
return "redirect:/addProjectReport";
6817+
}
6818+
State state = pr.getStateDistrictMapping().getState();
6819+
District district = pr.getStateDistrictMapping().getDistrict();
6820+
List<State> states = stateService.findAll();
6821+
6822+
List<ProjectReport> projectReportList = new ArrayList<>();
6823+
List<ProjectReport> tempProjectReportList = projectReportService.findAll();
6824+
for (ProjectReport temp : tempProjectReportList) {
6825+
if (ServiceUtility.hasAnyProjectReportFile(temp)) {
6826+
projectReportList.add(temp);
6827+
}
6828+
}
6829+
model.addAttribute("states", states);
6830+
model.addAttribute("projectReportList", projectReportList);
6831+
model.addAttribute("ProjectReport", pr);
6832+
model.addAttribute("state", state);
6833+
model.addAttribute("district", district);
6834+
6835+
model.addAttribute("id", id);
6836+
String filePath = "";
6837+
6838+
if (fileType.equals(CommonData.Doc_OR_ZIP_OF_DOCS)) {
6839+
filePath = pr.getDocPath();
6840+
model.addAttribute("fileType", "Doc");
6841+
6842+
}
6843+
6844+
else if (fileType.equals(CommonData.PDF_OR_ZIP_OF_PDFS)) {
6845+
filePath = pr.getPdfPath();
6846+
model.addAttribute("fileType", "Pdf");
6847+
}
6848+
6849+
else if (fileType.equals(CommonData.image_OR_ZIP_OF_IMAGES)) {
6850+
filePath = pr.getImgPath();
6851+
model.addAttribute("fileType", "Image");
6852+
}
6853+
6854+
else if (fileType.equals(CommonData.Excel_OR_ZIP_OF_EXCELS)) {
6855+
filePath = pr.getExcelPath();
6856+
model.addAttribute("fileType", "Excel");
6857+
}
6858+
6859+
if (filePath.toLowerCase().endsWith(".zip")) {
6860+
model.addAttribute("zipFile", filePath);
6861+
}
6862+
6863+
else {
6864+
model.addAttribute("nonZipFile", filePath);
6865+
6866+
}
6867+
6868+
return "updateProjectReport";
6869+
}
6870+
68046871
/************************ Project Report End ********************************/
68056872

68066873
@GetMapping("/trainingModules")

0 commit comments

Comments
 (0)