Skip to content

Commit

Permalink
Major Commit: Updated the Client Details and Immigration details info…
Browse files Browse the repository at this point in the history
…rmation and moved the UI pages to respective folders.

 - Created new files for Top Navbar and SideNavbar.
  • Loading branch information
mahi-mullapudi authored and Mahidhar C Mullapudi committed May 18, 2018
1 parent 350cd59 commit 846ad98
Show file tree
Hide file tree
Showing 10 changed files with 647 additions and 599 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/tutorialq/entities/ImmigrationDetails.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.tutorialq.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
Expand All @@ -12,7 +15,6 @@

@Data
@Entity
@EqualsAndHashCode(exclude = {"employee", "immiDetailsId"})
@NoArgsConstructor
@AllArgsConstructor
@ToString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpSession;
Expand All @@ -47,12 +46,13 @@ public class EmployeeDetailsController {


@GetMapping("/employeeDetails")
public ModelAndView getEmployeeDetails(@RequestParam("empId") long empId,
Model model, HttpSession session) throws Exception {
public String getEmployeeDetails(@RequestParam("empId") long empId,
Model model, HttpSession session, RedirectAttributes redirectAttributes) throws Exception {
log.info("Inside getEmployeeDetails method of EmployeeDetails Controller:: empId: " + empId);
Employee employeeDetails = employeeService.getEmployeeByEmployeeId(empId);
model.addAttribute("employeeDetails", employeeDetails);
//Initiating ModelAndView object with the Employee object
return new ModelAndView("employeeDetails", "employeeDetails", employeeDetails);
return "staff/employeeDetails";
}

@PostMapping("/employeeDetails")
Expand All @@ -63,7 +63,7 @@ public String submitEmployeeDetails(@ModelAttribute("employeeDetails") Employee
if (result.hasErrors()) {
model.addAttribute("css", "danger");
model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!");
return "employeeDetails";
return "staff/employeeDetails";
}

log.info("The form has no errors, so persisting the data.");
Expand All @@ -82,7 +82,7 @@ public String submitEmployeeDetails(@ModelAttribute("employeeDetails") Employee
model.addAttribute("css", "danger");
model.addAttribute("msg", "Technical issue while saving the Registration information. " +
"Please contact Admin for more information!!");
return "employeeDetails";
return "staff/employeeDetails";
}
log.info("Successfully Registered the user, forwarding to the Login page.");
redirectAttributes.addFlashAttribute("msg", "You have successfully updated Employee Details.");
Expand All @@ -93,12 +93,12 @@ public String submitEmployeeDetails(@ModelAttribute("employeeDetails") Employee

@GetMapping("/clientDetails")
public String getClientDetails(@RequestParam("empId") long empId,
Model model, HttpSession session) throws Exception {
Model model, HttpSession session, RedirectAttributes redirectAttributes) throws Exception {
log.info("Inside getClientDetails method of EmployeeDetails Controller:: empId: " + empId);
Employee employee = employeeService.getEmployeeByEmployeeId(empId);
model.addAttribute("employeeDetails", employee);
model.addAttribute("clientDetails", employeeService.getClientDetails(empId));
return "clientDetails";
return "staff/clientDetails";
}

@PostMapping("/clientDetails")
Expand All @@ -110,7 +110,7 @@ public String submitClientDetails(
if (result.hasErrors()) {
model.addAttribute("css", "danger");
model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!");
return "clientDetails";
return "staff/clientDetails";
}
try {
log.info("Saving the registration details of the Employee.");
Expand All @@ -132,11 +132,11 @@ public String submitClientDetails(

@GetMapping("/immiDetails")
public String getImmigrationDetails(@RequestParam("empId") long empId,
Model model, HttpSession session) throws Exception {
Model model, HttpSession session, RedirectAttributes redirectAttributes) throws Exception {
log.info("Inside getImmigrationDetails method of EmployeeDetails Controller:: empId: " + empId);
Employee employee = employeeService.getEmployeeByEmployeeId(empId);
model.addAttribute("immigrationDetails", employee.getImmigrationDetails());
return "immigrationDetails";
ImmigrationDetails immigrationDetails = employeeService.getImmigrationDetails(empId);
model.addAttribute("immigrationDetails", immigrationDetails);
return "staff/immigrationDetails";
}

@PostMapping("/immiDetails")
Expand All @@ -148,7 +148,7 @@ public String submitImmigrationDetails(
if (result.hasErrors()) {
model.addAttribute("css", "danger");
model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!");
return "immigrationDetails";
return "staff/immigrationDetails";
}
try {
log.info("Saving the immigration details of the Employee.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ public ResponseEntity<RestResponseEntity> approveTimesheet(
*/
@GetMapping("/rejectTimesheet")
public ResponseEntity<RestResponseEntity> rejectTimesheet(
@RequestParam("timesheetId") long timesheetId, @RequestParam("reviewerName") String reviewerName,
@RequestParam("timesheetId") long timesheetId,
@RequestParam("reviewerName") String reviewerName,
@RequestParam("reviewComments") String reviewComments)
throws Exception {
log.info("Inside rejectTimesheet method of TimesheetRestController:: timesheetId: " + timesheetId
Expand Down

0 comments on commit 846ad98

Please sign in to comment.