Skip to content

Commit

Permalink
Major Commit: Fixed some minor issues for adding the Role dscription …
Browse files Browse the repository at this point in the history
…while saving the Registration information for the Staff.

 - Updated the js files to use the CreatedAt date instead of dateCreated which is being used to display the submitted date for the Timesheet information.
  • Loading branch information
mahi-mullapudi authored and Mahidhar C Mullapudi committed Sep 6, 2018
1 parent 9f85f65 commit 15252da
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
public class ApplicationSessionConfiguration {
@Bean
public ServletListenerRegistrationBean<HttpSessionListener> sessionListener() {
return new ServletListenerRegistrationBean<HttpSessionListener>(new SessionListener());
return new ServletListenerRegistrationBean<>(new SessionListener());
}
}
1 change: 0 additions & 1 deletion src/main/java/com/tutorialq/config/MailingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import java.io.IOException;
import java.util.Properties;

@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public class ApplicationConstants implements Serializable {

public static final String INIT_VECTOR_RANDOM_KEY = "RandomInitVector"; // 16 bytes IV any random String with 16 characters can be used.

public static final String MAX_UPLOAD_FILE_SIZE = "1000000"; // 5MB file limit.
public static final String MAX_UPLOAD_FILE_SIZE = "1000000"; // 10MB file limit.

public static final String fromAddress = "admin@tutorialq.com";
public static final String fromAddress = "admin@geeksoft.com";

public static final Map<String, String> skillMap = ImmutableMap.<String, String>builder()
.put("java", "Java")
Expand All @@ -76,6 +76,7 @@ public class ApplicationConstants implements Serializable {
.put("qa", "Quality Assurance")
.put("ba", "Business Analyst")
.build();

public static final Map<String, String> companyNamesMap = ImmutableMap.<String, String>builder()
.put("geeksoft", "Geeksoft LLC.,")
.put("datasols", "DataSols LLC.,")
Expand Down
30 changes: 0 additions & 30 deletions src/main/java/com/tutorialq/models/TimesheetActivity.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public class RegistrationController {
public ModelAndView getRegistration() {
log.info("Inside getRegistration method of Registration Controller.");
Employee employeeRegistration = new Employee();
employeeRegistration.setEmployeeRoleId(100);
employeeRegistration.setEmployeeRoleDesc("EMPLOYEE");
employeeRegistration.setEmployeeRoleId(ApplicationConstants.USER_ROLE_EMPLOYEE_ID);
employeeRegistration.setEmployeeRoleDesc(ApplicationConstants.USER_ROLE_EMPLOYEE);
log.info("Completed setting required parameter values.");
//Initiating ModelAndView object with the Employee object
return new ModelAndView("registration", "employee", employeeRegistration);
Expand All @@ -62,11 +62,7 @@ public ModelAndView getRegistration() {
@GetMapping("/staffRegistration")
public ModelAndView getStaffRegistration(ModelMap modelMap) {
log.info("Inside getStaffRegistration method of Registration Controller.");
Map<Integer, String> roleIdDescMap = new TreeMap<>();
roleIdDescMap.put(ApplicationConstants.USER_ROLE_SUPERVISOR_ID, ApplicationConstants.USER_ROLE_SUPERVISOR);
roleIdDescMap.put(ApplicationConstants.USER_ROLE_ADMIN_ID, ApplicationConstants.USER_ROLE_ADMIN);

modelMap.addAttribute("roleIdDescMap", roleIdDescMap);
modelMap.addAttribute("employee", new Employee());
//Initiating ModelAndView object with the Employee object
return new ModelAndView("registration-staff", modelMap);
Expand All @@ -87,6 +83,10 @@ public ModelAndView submitRegistration(@ModelAttribute("employee") Employee empl
try {
employeeRegistration.setAccountStatusFlag(ApplicationConstants.REGISTRATION_STATUS_ACTIVE);
employeeRegistration.setNameCreated(employeeRegistration.getEmployeeFullName());
if (employeeRegistration.getEmployeeRoleId() != ApplicationConstants.USER_ROLE_EMPLOYEE_ID) {
Map<Integer, String> roleDescMap = getRoleDescMap();
employeeRegistration.setEmployeeRoleDesc(roleDescMap.get(employeeRegistration.getEmployeeRoleId()));
}
log.info("Saving the registration details of the Employee.");
registrationService.saveRegistrationDetails(employeeRegistration);
emailService.sendPlainTextMailWithoutAttachment(ApplicationConstants.fromAddress, employeeRegistration.getEmployeeEmailId(),
Expand Down Expand Up @@ -292,6 +292,15 @@ public ModelAndView updatePassword(@ModelAttribute("employee") Employee employee

}

@ModelAttribute("roleIdDescMap")
public Map<Integer, String> getRoleDescMap() {
Map<Integer, String> roleIdDescMap = new TreeMap<>();
roleIdDescMap.put(ApplicationConstants.USER_ROLE_SUPERVISOR_ID, ApplicationConstants.USER_ROLE_SUPERVISOR);
roleIdDescMap.put(ApplicationConstants.USER_ROLE_ADMIN_ID, ApplicationConstants.USER_ROLE_ADMIN);

return roleIdDescMap;
}


}

4 changes: 2 additions & 2 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ NotValid.registration.phoneNum=Please enter a 10 digit valid Phone Number.
Duplicate.registration.email=An account exists for this EmailId. Please login using this Email Id or use a different Email for Registration.
Error.checking.registration.email=An unexpected error occurred while checking for EmailId. Please contact Admin to resolve the issue.
###ClientDetails page Validation Messages ###
NotEmpty.clientDetails.clientName=Please enter Client Name.
NotEmpty.clientDetails.clientAddress=Please enter Client Address.
NotEmpty.clientDetails.clientName=Please enter Client Name.
NotEmpty.clientDetails.clientAddress=Please enter Client Address.
NotEmpty.clientDetails.clientCity=Please enter Client City.
NotEmpty.clientDetails.clientState=Please enter Client State.
NotEmpty.clientDetails.confirm.clientZip=Please enter Client Zip.
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/addTimesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function populateTimesheetInfo(timesheetObj) {
//Populate the HTML information.
$('#timesheetStatus').html(timesheetObj.timesheetStatus != null ? timesheetObj.timesheetStatus : '');
$('#submitterName').html(timesheetObj.nameCreated !== null ? timesheetObj.nameCreated : '');
$('#submittedDate').html(timesheetObj.dateCreated !== null ? moment(timesheetObj.dateCreated).format("MM/DD/YYYY hh:mm a") : '');
$('#submittedDate').html(timesheetObj.createdAt !== null ? moment(timesheetObj.createdAt).format("MM/DD/YYYY hh:mm a") : '');
$('#approverName').html(timesheetObj.nameApproved !== null ? timesheetObj.nameApproved : '');
$('#approvalDate').html(timesheetObj.dateApproved !== null ? moment(timesheetObj.dateApproved).format("MM/DD/YYYY hh:mm a") : '');
//Populate the input values.
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/static/js/dashboard-staff.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ function populateViewTimesheet(timesheetObj, confirmMessageFlag) {
$('#extraHours').html(timesheetObj.extraHours != null ? timesheetObj.extraHours : 0.0);
$('#totalHours').html(timesheetObj.regularHours + timesheetObj.extraHours);
$('#submitterName').html(timesheetObj.nameCreated);
$('#submittedDate').html(timesheetObj.dateCreated != null ?
moment(timesheetObj.dateCreated).format("MM/DD/YYYY hh:mm a") : '');
$('#submittedDate').html(timesheetObj.createdAt != null ?
moment(timesheetObj.createdAt).format("MM/DD/YYYY hh:mm a") : '');
$('#approvalDate').html(timesheetObj.dateApproved != null ?
moment(timesheetObj.dateApproved).format("MM/DD/YYYY hh:mm a") : '');
$('#timesheetComments').html(timesheetObj.dscComments);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function populateViewTimesheet(timesheetObj) {
$('#extraHours').html(timesheetObj.extraHours);
$('#totalHours').html(timesheetObj.regularHours + timesheetObj.extraHours);
$('#submitterName').html(timesheetObj.nameCreated);
$('#submittedDate').html(timesheetObj.dateCreated != null ? moment(timesheetObj.dateCreated).format("MM/DD/YYYY hh:mm a") : '');
$('#submittedDate').html(timesheetObj.createdAt != null ? moment(timesheetObj.createdAt).format("MM/DD/YYYY hh:mm a") : '');
$('#approvalDate').html(timesheetObj.dateApproved != null ? moment(timesheetObj.dateApproved).format("MM/DD/YYYY hh:mm a") : '');
$('#timesheetComments').html(timesheetObj.dscComments);
$('#uploadedTimesheetName').html(timesheetObj.dscFileName);
Expand Down

0 comments on commit 15252da

Please sign in to comment.