Commit b05c283f authored by Srikanth Gajula's avatar Srikanth Gajula

MT-01:[Srikanth] Sync with new changes with mytime

parent b8078dbd
package com.nisum.mytime.controller; package com.nisum.mytime.controller;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData; import com.nisum.mytime.model.AttendenceData;
import com.nisum.mytime.model.EmpLoginData; import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.service.AttendanceService; import com.nisum.mytime.service.AttendanceService;
import com.nisum.mytime.service.UserService; import com.nisum.mytime.service.UserService;
@RestController @RestController
@RequestMapping("/attendance") @RequestMapping("/attendance")
public class AttendanceController { public class AttendanceController {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired @Autowired
private AttendanceService attendanceService; private AttendanceService attendanceService;
@RequestMapping(value = "employeeLoginsBasedOnDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "employeeLoginsBasedOnDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmpLoginData>> employeeLoginsBasedOnDate(@RequestParam("empId") long id, public ResponseEntity<List<EmpLoginData>> employeeLoginsBasedOnDate(@RequestParam("empId") long id,
@RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate) throws MyTimeException { @RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate) throws MyTimeException {
List<EmpLoginData> message = userService.employeeLoginsBasedOnDate(id, fromDate, toDate); List<EmpLoginData> message = userService.employeeLoginsBasedOnDate(id, fromDate, toDate);
return new ResponseEntity<>(message, HttpStatus.OK); return new ResponseEntity<>(message, HttpStatus.OK);
} }
@RequestMapping(value = "generatePdfReport/{id}/{fromDate}/{toDate}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) @RequestMapping(value = "generatePdfReport/{id}/{fromDate}/{toDate}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> generatePdfReport(@PathVariable("id") long id, public ResponseEntity<String> generatePdfReport(@PathVariable("id") long id,
@PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate) throws MyTimeException { @PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate) throws MyTimeException {
String result = userService.generatePdfReport(id, fromDate, toDate); String result = userService.generatePdfReport(id, fromDate, toDate);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@RequestMapping(value = "attendanciesReport/{reportDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "attendanciesReport/{reportDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<AttendenceData>> attendanciesReport(@PathVariable("reportDate") String reportDate) public ResponseEntity<List<AttendenceData>> attendanciesReport(@PathVariable("reportDate") String reportDate)
throws MyTimeException, SQLException { throws MyTimeException, SQLException {
List<AttendenceData> lisOfAttendenceData = attendanceService.getAttendanciesReport(reportDate); List<AttendenceData> lisOfAttendenceData = attendanceService.getAttendanciesReport(reportDate);
return new ResponseEntity<>(lisOfAttendenceData, HttpStatus.OK); return new ResponseEntity<>(lisOfAttendenceData, HttpStatus.OK);
} }
@RequestMapping(value = "employeesDataSave/{searchDate}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "employeesDataSave/{searchDate}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> employeesDataSave(@PathVariable("searchDate") String searchDate) public ResponseEntity<Boolean> employeesDataSave(@PathVariable("searchDate") String searchDate)
throws MyTimeException { throws MyTimeException {
Boolean result = userService.fetchEmployeesData(searchDate); Boolean result = userService.fetchEmployeesData(searchDate);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@RequestMapping(value = "copyRemoteMdbFileToLocal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> copyRemoteMdbFileToLocal()
throws MyTimeException {
Boolean result = attendanceService.copyRemoteMdbFileToLocal();
return new ResponseEntity<>(result, HttpStatus.OK);
}
} }
\ No newline at end of file
...@@ -13,8 +13,10 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,8 +13,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Project; import com.nisum.mytime.model.Project;
import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.service.ProjectService; import com.nisum.mytime.service.ProjectService;
import com.nisum.mytime.service.UserService; import com.nisum.mytime.service.UserService;
...@@ -26,7 +28,8 @@ public class ProjectController { ...@@ -26,7 +28,8 @@ public class ProjectController {
private UserService userService; private UserService userService;
@Autowired @Autowired
private ProjectService projectService; private ProjectService projectService;
@Autowired
private AccountRepo accountRepo;
@RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId) public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId)
throws MyTimeException { throws MyTimeException {
...@@ -35,8 +38,16 @@ public class ProjectController { ...@@ -35,8 +38,16 @@ public class ProjectController {
} }
@RequestMapping(value = "/addProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/addProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Project> addProject(@RequestBody Project employeeRoles) throws MyTimeException { public ResponseEntity<Project> addProject(@RequestBody Project projectAdded) throws MyTimeException {
Project project = projectService.addProject(employeeRoles); String accountName=projectAdded.getAccount();
Account account= accountRepo.findByAccountName(accountName);
int sequenceNumber= account.getAccountProjectSequence();
account.setAccountProjectSequence(sequenceNumber+1);
accountRepo.save(account);
String projectId= accountName+String.format("%04d", sequenceNumber+1);
projectAdded.setProjectId(projectId);
Project project = projectService.addProject(projectAdded);
System.out.println(project.getProjectId());
return new ResponseEntity<>(project, HttpStatus.OK); return new ResponseEntity<>(project, HttpStatus.OK);
} }
......
...@@ -27,6 +27,7 @@ public class ProjectTeamController { ...@@ -27,6 +27,7 @@ public class ProjectTeamController {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired @Autowired
private ProjectService projectService; private ProjectService projectService;
...@@ -121,18 +122,21 @@ public class ProjectTeamController { ...@@ -121,18 +122,21 @@ public class ProjectTeamController {
List<EmployeeRoles> employeesRoles = projectService.getUnAssignedEmployees(); List<EmployeeRoles> employeesRoles = projectService.getUnAssignedEmployees();
return new ResponseEntity<>(employeesRoles, HttpStatus.OK); return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
} }
@RequestMapping(value = "/getShiftDetails", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/getShiftDetails", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> getShiftDetails(@RequestParam("shift") String shift) public ResponseEntity<List<ProjectTeamMate>> getShiftDetails(@RequestParam("shift") String shift)
throws MyTimeException { throws MyTimeException {
List<ProjectTeamMate> employeesRoles = projectService.getShiftDetails(shift); List<ProjectTeamMate> employeesRoles = projectService.getShiftDetails(shift);
return new ResponseEntity<>(employeesRoles, HttpStatus.OK); return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
} }
@RequestMapping(value = "/getProjectAllocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/getProjectAllocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> getProjectAllocations() public ResponseEntity<List<ProjectTeamMate>> getProjectAllocations()
throws MyTimeException { throws MyTimeException {
List<ProjectTeamMate> employeesRoles = projectService.getAllProjectDetails(); List<ProjectTeamMate> employeesRoles = projectService.getAllProjectDetails();
return new ResponseEntity<>(employeesRoles, HttpStatus.OK); return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
} }
@RequestMapping(value = "/getProjectDetails", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/getProjectDetails", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> getProjectDetails(@RequestParam("projectId") String projectId) public ResponseEntity<List<ProjectTeamMate>> getProjectDetails(@RequestParam("projectId") String projectId)
throws MyTimeException { throws MyTimeException {
......
package com.nisum.mytime.controller; package com.nisum.mytime.controller;
import java.util.ArrayList; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.Shift; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.service.UserService; import com.nisum.mytime.model.Shift;
import com.nisum.mytime.model.Skill;
@RestController import com.nisum.mytime.service.UserService;
@RequestMapping("/user")
public class UserController { @RestController
@RequestMapping("/user")
@Autowired public class UserController {
private UserService userService;
@Autowired
@RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) private UserService userService;
public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId)
throws MyTimeException { @RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
EmployeeRoles employeesRole = userService.getEmployeesRole(emailId); public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId)
return new ResponseEntity<>(employeesRole, HttpStatus.OK); throws MyTimeException {
} EmployeeRoles employeesRole = userService.getEmployeesRole(emailId);
return new ResponseEntity<>(employeesRole, HttpStatus.OK);
@RequestMapping(value = "/assignEmployeeRole", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) }
public ResponseEntity<EmployeeRoles> assigingEmployeeRole(@RequestBody EmployeeRoles employeeRoles) throws MyTimeException {
EmployeeRoles employeeRole = userService.assigingEmployeeRole(employeeRoles); @RequestMapping(value = "/assignEmployeeRole", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
return new ResponseEntity<>(employeeRole, HttpStatus.OK); public ResponseEntity<EmployeeRoles> assigingEmployeeRole(@RequestBody EmployeeRoles employeeRoles)
} throws MyTimeException {
EmployeeRoles employeeRole = userService.assigingEmployeeRole(employeeRoles);
@RequestMapping(value = "/updateEmployeeRole", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) return new ResponseEntity<>(employeeRole, HttpStatus.OK);
public ResponseEntity<EmployeeRoles> updateEmployeeRole(@RequestBody EmployeeRoles employeeRoles) throws MyTimeException { }
EmployeeRoles employeeRole = userService.updateEmployeeRole(employeeRoles);
return new ResponseEntity<>(employeeRole, HttpStatus.OK); @RequestMapping(value = "/updateEmployeeRole", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
} public ResponseEntity<EmployeeRoles> updateEmployeeRole(@RequestBody EmployeeRoles employeeRoles)
throws MyTimeException {
@RequestMapping(value = "/deleteEmployee", method = RequestMethod.DELETE, produces = MediaType.TEXT_PLAIN_VALUE) EmployeeRoles employeeRole = userService.updateEmployeeRole(employeeRoles);
public ResponseEntity<String> deleteEmployee(@RequestParam("empId") String empId) throws MyTimeException { return new ResponseEntity<>(employeeRole, HttpStatus.OK);
userService.deleteEmployee(empId); }
return new ResponseEntity<>("Success", HttpStatus.OK);
} @RequestMapping(value = "/deleteEmployee", method = RequestMethod.DELETE, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> deleteEmployee(@RequestParam("empId") String empId) throws MyTimeException {
@RequestMapping(value = "/getUserRoles", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) userService.deleteEmployee(empId);
public ResponseEntity<List<EmployeeRoles>> getUserRoles() throws MyTimeException { return new ResponseEntity<>("Success", HttpStatus.OK);
List<EmployeeRoles> employeesRoles = userService.getEmployeeRoles(); }
return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
} @RequestMapping(value = "/getUserRoles", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeRoles>> getUserRoles() throws MyTimeException {
@RequestMapping(value = "/getEmployeeRoleData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) List<EmployeeRoles> employeesRoles = userService.getEmployeeRoles();
public ResponseEntity<EmployeeRoles> getEmployeeRoleData(@RequestParam("empId") String empId) return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
throws MyTimeException { }
EmployeeRoles employeesRole = userService.getEmployeesRoleData(empId);
return new ResponseEntity<>(employeesRole, HttpStatus.OK); @RequestMapping(value = "/getEmployeeRoleData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
} public ResponseEntity<EmployeeRoles> getEmployeeRoleData(@RequestParam("empId") String empId)
@RequestMapping(value = "/getManagers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) throws MyTimeException {
public ResponseEntity<List<EmployeeRoles>> getManagers() throws MyTimeException { EmployeeRoles employeesRole = userService.getEmployeesRoleData(empId);
List<EmployeeRoles> employeesRoles = userService.getEmployeeRoles(); return new ResponseEntity<>(employeesRole, HttpStatus.OK);
List<EmployeeRoles> managers = employeesRoles.stream().filter(e -> (e.getRole().equalsIgnoreCase("Manager")||e.getRole().equalsIgnoreCase("HR Manager")||e.getRole().equalsIgnoreCase("Lead"))).collect(Collectors.toList()); }
return new ResponseEntity<>(managers, HttpStatus.OK);
} @RequestMapping(value = "/getManagers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/getAllShifts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<List<EmployeeRoles>> getManagers() throws MyTimeException {
public ResponseEntity<List<String>> getAllShifts() throws MyTimeException { List<EmployeeRoles> employeesRoles = userService.getEmployeeRoles();
List<String> shifts = new ArrayList<>(); List<EmployeeRoles> managers = employeesRoles
.stream().filter(e -> ("Manager".equalsIgnoreCase(e.getRole())
shifts = userService.getAllShifts().stream().filter(e -> e.getActiveStatus().equalsIgnoreCase("Y")).map(Shift::getShiftName) .collect(Collectors.toList()); || "HR Manager".equalsIgnoreCase(e.getRole()) || "Lead".equalsIgnoreCase(e.getRole())))
.sorted(Comparator.comparing(EmployeeRoles::getEmployeeName)).collect(Collectors.toList());
return new ResponseEntity<>(shifts, HttpStatus.OK); return new ResponseEntity<>(managers, HttpStatus.OK);
} }
@RequestMapping(value = "/getAllDesignations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getAllDesignations() throws MyTimeException { @RequestMapping(value = "/getAllShifts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
List<String> designations = new ArrayList<>(); public ResponseEntity<List<String>> getAllShifts() throws MyTimeException {
List<String> shifts = userService.getAllShifts().stream().filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus()))
designations = userService.getAllDesignations().stream().filter(e -> e.getActiveStatus().equalsIgnoreCase("Y")).map(Designation::getDesignationName) .collect(Collectors.toList()); .map(Shift::getShiftName).sorted().collect(Collectors.toList());
return new ResponseEntity<>(shifts, HttpStatus.OK);
return new ResponseEntity<>(designations, HttpStatus.OK); }
}
@RequestMapping(value = "/getAllDesignations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getAllDesignations() throws MyTimeException {
List<String> designations = userService.getAllDesignations().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Designation::getDesignationName).sorted()
.collect(Collectors.toList());
return new ResponseEntity<>(designations, HttpStatus.OK);
}
@RequestMapping(value = "/getSkills", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getTechnologies() throws MyTimeException {
List<String> technologies = userService.getTechnologies().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Skill::getSkillName).sorted()
.collect(Collectors.toList());
return new ResponseEntity<>(technologies, HttpStatus.OK);
}
@RequestMapping(value = "/updateProfile", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> updateProfile(@RequestBody EmployeeRoles employeeRoles)
throws MyTimeException {
EmployeeRoles employeeDB = userService.getEmployeesRoleData(employeeRoles.getEmployeeId());
employeeDB.setMobileNumber(employeeRoles.getMobileNumber());
employeeDB.setAlternateMobileNumber(employeeRoles.getAlternateMobileNumber());
employeeDB.setPersonalEmailId(employeeRoles.getPersonalEmailId());
employeeDB.setBaseTechnology(employeeRoles.getBaseTechnology());
employeeDB.setTechnologyKnown(employeeRoles.getTechnologyKnown());
EmployeeRoles employeeRole = userService.updateProfile(employeeDB);
return new ResponseEntity<>(employeeRole, HttpStatus.OK);
}
@RequestMapping(value = "/getAccounts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getAccounts() throws MyTimeException {
List<String> technologies = userService.getAccounts().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getStatus())).map(Account::getAccountName).sorted()
.collect(Collectors.toList());
System.out.println("technologies"+technologies);
return new ResponseEntity<>(technologies, HttpStatus.OK);
}
} }
\ No newline at end of file
package com.nisum.mytime.model;
import java.io.Serializable;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "Accounts")
public class Account implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String accountId;
private String accountName;
private int accountProjectSequence;
private String status;
}
package com.nisum.mytime.model; package com.nisum.mytime.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
...@@ -21,7 +20,6 @@ import lombok.ToString; ...@@ -21,7 +20,6 @@ import lombok.ToString;
@Document(collection = "Designations") @Document(collection = "Designations")
public class Designation implements Serializable { public class Designation implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
......
...@@ -32,7 +32,13 @@ public class EmployeeRoles implements Serializable { ...@@ -32,7 +32,13 @@ public class EmployeeRoles implements Serializable {
private String emailId; private String emailId;
private String role; private String role;
private String shift; private String shift;
private String baseTechnology;
private String technologyKnown;
private String mobileNumber;
private String alternateMobileNumber;
private String personalEmailId;
private Date createdOn; private Date createdOn;
private Date lastModifiedOn; private Date lastModifiedOn;
} }
...@@ -30,6 +30,7 @@ public class Project implements Serializable { ...@@ -30,6 +30,7 @@ public class Project implements Serializable {
private String projectName; private String projectName;
private String managerId; private String managerId;
private String managerName; private String managerName;
private String account;
private String status; private String status;
private List<String> employeeIds; private List<String> employeeIds;
......
...@@ -31,6 +31,7 @@ public class ProjectTeamMate implements Serializable { ...@@ -31,6 +31,7 @@ public class ProjectTeamMate implements Serializable {
private String shift; private String shift;
private String projectId; private String projectId;
private String projectName; private String projectName;
private String account;
private String managerId; private String managerId;
private String managerName; private String managerName;
private String experience; private String experience;
......
package com.nisum.mytime.model; package com.nisum.mytime.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
...@@ -21,7 +20,6 @@ import lombok.ToString; ...@@ -21,7 +20,6 @@ import lombok.ToString;
@Document(collection = "Shifts") @Document(collection = "Shifts")
public class Shift implements Serializable { public class Shift implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
...@@ -30,5 +28,4 @@ public class Shift implements Serializable { ...@@ -30,5 +28,4 @@ public class Shift implements Serializable {
private String shiftName; private String shiftName;
private String activeStatus; private String activeStatus;
} }
package com.nisum.mytime.model;
import java.io.Serializable;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "Skills")
public class Skill implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String skillId;
private String skillName;
private String activeStatus;
}
package com.nisum.mytime.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Account;
public interface AccountRepo extends MongoRepository<Account, String> {
Account findByAccountName(String accontName);
}
\ No newline at end of file
package com.nisum.mytime.repository; package com.nisum.mytime.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Designation;
public interface DesignationRepo extends MongoRepository<Designation, String> { public interface DesignationRepo extends MongoRepository<Designation, String> {
} }
\ No newline at end of file
package com.nisum.mytime.repository; package com.nisum.mytime.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Shift; import com.nisum.mytime.model.Shift;
......
package com.nisum.mytime.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Skill;
public interface TechnologyRepo extends MongoRepository<Skill, String> {
}
\ No newline at end of file
package com.nisum.mytime.service; package com.nisum.mytime.service;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData; import com.nisum.mytime.model.AttendenceData;
public interface AttendanceService { public interface AttendanceService {
List<AttendenceData> getAttendanciesReport(String reportDate) throws MyTimeException, SQLException; List<AttendenceData> getAttendanciesReport(String reportDate) throws MyTimeException, SQLException;
} Boolean copyRemoteMdbFileToLocal() throws MyTimeException;
}
package com.nisum.mytime.service; package com.nisum.mytime.service;
import java.io.File; import java.io.File;
import java.sql.Connection; import java.io.FileOutputStream;
import java.sql.ResultSet; import java.io.InputStream;
import java.sql.SQLException; import java.sql.Connection;
import java.sql.Statement; import java.sql.ResultSet;
import java.util.ArrayList; import java.sql.SQLException;
import java.util.Calendar; import java.sql.Statement;
import java.util.Date; import java.util.ArrayList;
import java.util.GregorianCalendar; import java.util.Calendar;
import java.util.List; import java.util.Date;
import java.util.stream.Collectors; import java.util.GregorianCalendar;
import java.util.List;
import org.apache.commons.lang.time.DateUtils; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.apache.commons.lang.time.DateUtils;
import org.springframework.data.mongodb.core.MongoTemplate; import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import com.mongodb.BasicDBObject; import org.springframework.data.mongodb.core.MongoTemplate;
import com.mongodb.DBCursor; import org.springframework.stereotype.Service;
import com.mongodb.DBObject;
import com.nisum.mytime.configuration.DbConnection; import com.mongodb.BasicDBObject;
import com.nisum.mytime.exception.handler.MyTimeException; import com.mongodb.DBCursor;
import com.nisum.mytime.model.AttendenceData; import com.mongodb.DBObject;
import com.nisum.mytime.utils.MyTimeLogger; import com.nisum.mytime.configuration.DbConnection;
import com.nisum.mytime.utils.MyTimeUtils; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
@Service import com.nisum.mytime.utils.MyTimeLogger;
public class AttendanceServiceImpl implements AttendanceService { import com.nisum.mytime.utils.MyTimeUtils;
@Value("${mytime.attendance.fileName}") import jcifs.smb.SmbFile;
private String mdbFile;
@Service
@Value("${mytime.localFile.directory}") public class AttendanceServiceImpl implements AttendanceService {
private String localFileDirectory;
@Value("${mytime.attendance.fileName}")
@Autowired private String mdbFile;
private MongoTemplate mongoTemplate;
@Value("${mytime.localFile.directory}")
private Connection connection = null; private String localFileDirectory;
private Statement statement = null;
private ResultSet resultSet = null; @Value("${mytime.remote.directory}")
private File finalfile = null; private String remoteFilesDirectory;
private Calendar calendar = new GregorianCalendar();
private int month = (calendar.get(Calendar.MONTH)) + 1; @Value("${mytime.remote.connection}")
private int year = calendar.get(Calendar.YEAR); private String remotePath;
private Date toDay = calendar.getTime();
private String queryMonthDecider = null; @Autowired
private MongoTemplate mongoTemplate;
@Override
public List<AttendenceData> getAttendanciesReport(String reportDate) throws MyTimeException, SQLException { private Connection connection = null;
long start_ms = System.currentTimeMillis(); private Statement statement = null;
List<AttendenceData> listOfAbsentEmployees = null; private ResultSet resultSet = null;
try { private File finalfile = null;
File dir = new File(localFileDirectory); private Calendar calendar = new GregorianCalendar();
for (File file : dir.listFiles()) { private int month = (calendar.get(Calendar.MONTH)) + 1;
if (file.getCanonicalPath().contains(mdbFile)) { private int year = calendar.get(Calendar.YEAR);
finalfile = new File(file.getCanonicalPath()); private Date toDay = calendar.getTime();
} private String queryMonthDecider = null;
}
if (null != finalfile) { @Override
int dayOftoDay = calendar.get(Calendar.DAY_OF_MONTH); public List<AttendenceData> getAttendanciesReport(String reportDate) throws MyTimeException, SQLException {
Date selectedDate = MyTimeUtils.dfmt.parse(reportDate); long start_ms = System.currentTimeMillis();
calendar.setTime(MyTimeUtils.dfmt.parse(reportDate)); List<AttendenceData> listOfAbsentEmployees = null;
int dayOfSelectedDate = calendar.get(Calendar.DAY_OF_MONTH); try {
File dir = new File(localFileDirectory);
if (dayOfSelectedDate == dayOftoDay && month == (calendar.get(Calendar.MONTH)) + 1 for (File file : dir.listFiles()) {
&& year == calendar.get(Calendar.YEAR)) { if (file.getCanonicalPath().contains(mdbFile)) {
listOfAbsentEmployees = fecthRecordsFromMDb(); finalfile = new File(file.getCanonicalPath());
} else if (selectedDate.before(toDay)) { }
calendar.setTime(selectedDate); }
listOfAbsentEmployees = fecthRecordsFromMongoDb(reportDate); if (null != finalfile) {
} int dayOftoDay = calendar.get(Calendar.DAY_OF_MONTH);
MyTimeLogger.getInstance().info("Time Taken for " + (System.currentTimeMillis() - start_ms)); Date selectedDate = MyTimeUtils.dfmt.parse(reportDate);
} calendar.setTime(MyTimeUtils.dfmt.parse(reportDate));
} catch (Exception e) { int dayOfSelectedDate = calendar.get(Calendar.DAY_OF_MONTH);
MyTimeLogger.getInstance().error("Exception occured due to : ", e);
throw new MyTimeException(e.getMessage()); if (dayOfSelectedDate == dayOftoDay && month == (calendar.get(Calendar.MONTH)) + 1
} finally { && year == calendar.get(Calendar.YEAR)) {
if (null != connection) { listOfAbsentEmployees = fecthRecordsFromMDb();
connection.close(); } else if (selectedDate.before(toDay)) {
statement.close(); calendar.setTime(selectedDate);
resultSet.close(); listOfAbsentEmployees = fecthRecordsFromMongoDb(reportDate);
} }
} MyTimeLogger.getInstance().info("Time Taken for " + (System.currentTimeMillis() - start_ms));
return listOfAbsentEmployees; }
} } catch (Exception e) {
MyTimeLogger.getInstance().error("Exception occured due to : ", e);
private String createDbStatementWithFile() throws MyTimeException { throw new MyTimeException(e.getMessage());
StringBuilder queryMonthDecider = null; } finally {
try { if (null != connection) {
queryMonthDecider = new StringBuilder(); connection.close();
String dbURL = MyTimeUtils.driverUrl + finalfile.getCanonicalPath(); statement.close();
MyTimeLogger.getInstance().info(dbURL); resultSet.close();
connection = DbConnection.getDBConnection(dbURL); }
statement = connection.createStatement(); }
return listOfAbsentEmployees;
Calendar calendar1 = Calendar.getInstance(); }
calendar1.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH), 6, 00, 00); private String createDbStatementWithFile() throws MyTimeException {
Date dayStartsTime = calendar1.getTime(); StringBuilder queryMonthDecider = null;
try {
Date maxTimeToLogin = DateUtils.addHours(dayStartsTime, 12); queryMonthDecider = new StringBuilder();
String dbURL = MyTimeUtils.driverUrl + finalfile.getCanonicalPath();
queryMonthDecider.append(MyTimeUtils.USERID_QUERY); MyTimeLogger.getInstance().info(dbURL);
queryMonthDecider.append(month); connection = DbConnection.getDBConnection(dbURL);
queryMonthDecider.append(MyTimeUtils.UNDER_SCORE); statement = connection.createStatement();
queryMonthDecider.append(year);
queryMonthDecider.append(MyTimeUtils.WHERE_COND); Calendar calendar1 = Calendar.getInstance();
queryMonthDecider.append(MyTimeUtils.df.format(dayStartsTime) + MyTimeUtils.SINGLE_QUOTE); calendar1.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
queryMonthDecider.append(MyTimeUtils.AND_COND); calendar.get(Calendar.DAY_OF_MONTH), 6, 00, 00);
queryMonthDecider.append(MyTimeUtils.df.format(maxTimeToLogin) + MyTimeUtils.SINGLE_QUOTE); Date dayStartsTime = calendar1.getTime();
MyTimeLogger.getInstance().info(queryMonthDecider.toString()); Date maxTimeToLogin = DateUtils.addHours(dayStartsTime, 12);
} catch (Exception e) { queryMonthDecider.append(MyTimeUtils.USERID_QUERY);
MyTimeLogger.getInstance().error("Exception occured due to: ", e); queryMonthDecider.append(calendar.get(Calendar.MONTH) + 1);
throw new MyTimeException(e.getMessage()); queryMonthDecider.append(MyTimeUtils.UNDER_SCORE);
} queryMonthDecider.append(calendar.get(Calendar.YEAR));
return queryMonthDecider.toString(); queryMonthDecider.append(MyTimeUtils.WHERE_COND);
} queryMonthDecider.append(MyTimeUtils.df.format(dayStartsTime) + MyTimeUtils.SINGLE_QUOTE);
queryMonthDecider.append(MyTimeUtils.AND_COND);
private List<AttendenceData> fecthRecordsFromMDb() throws MyTimeException { queryMonthDecider.append(MyTimeUtils.df.format(maxTimeToLogin) + MyTimeUtils.SINGLE_QUOTE);
List<String> presentiesList = null;
List<String> listOfPresentEmployees = new ArrayList<>(); MyTimeLogger.getInstance().info(queryMonthDecider.toString());
List<AttendenceData> listOfAbsentEmployees = null;
try { } catch (Exception e) {
queryMonthDecider = createDbStatementWithFile(); MyTimeLogger.getInstance().error("Exception occured due to: ", e);
resultSet = statement.executeQuery(queryMonthDecider); throw new MyTimeException(e.getMessage());
while (resultSet.next()) { }
if (resultSet.getString(1).length() >= 5) { return queryMonthDecider.toString();
listOfPresentEmployees.add(resultSet.getString(1)); }
}
} private List<AttendenceData> fecthRecordsFromMDb() throws MyTimeException {
presentiesList = listOfPresentEmployees.stream().distinct().collect(Collectors.toList()); List<String> presentiesList = null;
listOfAbsentEmployees = fetchAbsenteesListFromDb(presentiesList); List<String> listOfPresentEmployees = new ArrayList<>();
} catch (Exception e) { List<AttendenceData> listOfAbsentEmployees = null;
MyTimeLogger.getInstance().error("Exception occured due to: ", e); try {
throw new MyTimeException(e.getMessage()); queryMonthDecider = createDbStatementWithFile();
} resultSet = statement.executeQuery(queryMonthDecider);
return listOfAbsentEmployees; while (resultSet.next()) {
} if (resultSet.getString(1).length() >= 5) {
listOfPresentEmployees.add(resultSet.getString(1));
private List<AttendenceData> fecthRecordsFromMongoDb(String reportDate) throws MyTimeException { }
List<String> presentiesList = null; }
List<String> listOfPresentEmployees = new ArrayList<>(); presentiesList = listOfPresentEmployees.stream().distinct().collect(Collectors.toList());
List<AttendenceData> listOfAbsentEmployees = null; listOfAbsentEmployees = fetchAbsenteesListFromDb(presentiesList);
DBCursor cursor = null; } catch (Exception e) {
queryMonthDecider = createDbStatementWithFile(); MyTimeLogger.getInstance().error("Exception occured due to: ", e);
BasicDBObject gtQuery = new BasicDBObject(); throw new MyTimeException(e.getMessage());
gtQuery.put(MyTimeUtils.DATE_OF_LOGIN, reportDate); }
listOfPresentEmployees.clear(); return listOfAbsentEmployees;
cursor = mongoTemplate.getCollection(MyTimeUtils.EMPLOYEE_COLLECTION).find(gtQuery) }
.sort(new BasicDBObject(MyTimeUtils.EMPLOYEE_ID, 1));
while (cursor.hasNext()) { private List<AttendenceData> fecthRecordsFromMongoDb(String reportDate) throws MyTimeException {
DBObject dbObject = cursor.next(); List<String> presentiesList = null;
listOfPresentEmployees.add(dbObject.get(MyTimeUtils.EMPLOYEE_ID).toString()); List<String> listOfPresentEmployees = new ArrayList<>();
} List<AttendenceData> listOfAbsentEmployees = null;
presentiesList = listOfPresentEmployees.stream().distinct().collect(Collectors.toList()); DBCursor cursor = null;
listOfAbsentEmployees = fetchAbsenteesListFromDb(presentiesList); queryMonthDecider = createDbStatementWithFile();
return listOfAbsentEmployees; BasicDBObject gtQuery = new BasicDBObject();
} gtQuery.put(MyTimeUtils.DATE_OF_LOGIN, reportDate);
listOfPresentEmployees.clear();
private List<AttendenceData> fetchAbsenteesListFromDb(List<String> presentiesList) throws MyTimeException { cursor = mongoTemplate.getCollection(MyTimeUtils.EMPLOYEE_COLLECTION).find(gtQuery)
List<AttendenceData> listOfAbsentEmployees = new ArrayList<>(); .sort(new BasicDBObject(MyTimeUtils.EMPLOYEE_ID, 1));
try { while (cursor.hasNext()) {
if (!presentiesList.isEmpty()) { DBObject dbObject = cursor.next();
StringBuilder absentiesQuery = new StringBuilder(); listOfPresentEmployees.add(dbObject.get(MyTimeUtils.EMPLOYEE_ID).toString());
absentiesQuery.append(MyTimeUtils.ABESENT_QUERY); }
absentiesQuery.append(queryMonthDecider); presentiesList = listOfPresentEmployees.stream().distinct().collect(Collectors.toList());
absentiesQuery.append(MyTimeUtils.ABESENT_QUERY1); listOfAbsentEmployees = fetchAbsenteesListFromDb(presentiesList);
MyTimeLogger.getInstance().info(absentiesQuery.toString()); return listOfAbsentEmployees;
}
resultSet = statement.executeQuery(absentiesQuery.toString());
listOfAbsentEmployees.clear(); private List<AttendenceData> fetchAbsenteesListFromDb(List<String> presentiesList) throws MyTimeException {
while (resultSet.next()) { List<AttendenceData> listOfAbsentEmployees = new ArrayList<>();
if (resultSet.getString(3).length() >= 5) { try {
AttendenceData attendenceData = new AttendenceData(); if (!presentiesList.isEmpty()) {
attendenceData.setEmployeeName(resultSet.getString(2)); StringBuilder absentiesQuery = new StringBuilder();
attendenceData.setEmployeeId(resultSet.getString(3)); absentiesQuery.append(MyTimeUtils.ABESENT_QUERY);
attendenceData.setIfPresent(MyTimeUtils.ABESENT); absentiesQuery.append(queryMonthDecider);
listOfAbsentEmployees.add(attendenceData); absentiesQuery.append(MyTimeUtils.ABESENT_QUERY1);
} MyTimeLogger.getInstance().info(absentiesQuery.toString());
}
if (!listOfAbsentEmployees.isEmpty()) { resultSet = statement.executeQuery(absentiesQuery.toString());
listOfAbsentEmployees.get(0).setTotalPresent(presentiesList.size()); listOfAbsentEmployees.clear();
listOfAbsentEmployees.get(0).setTotalAbsent(listOfAbsentEmployees.size()); while (resultSet.next()) {
} if (resultSet.getString(3).length() >= 5) {
AttendenceData attendenceData = new AttendenceData();
} attendenceData.setEmployeeName(resultSet.getString(2));
attendenceData.setEmployeeId(resultSet.getString(3));
} catch (Exception e) { attendenceData.setIfPresent(MyTimeUtils.ABESENT);
MyTimeLogger.getInstance().error("Exception occured due to: ", e); listOfAbsentEmployees.add(attendenceData);
throw new MyTimeException(e.getMessage()); }
} }
return listOfAbsentEmployees; if (!listOfAbsentEmployees.isEmpty()) {
listOfAbsentEmployees.get(0).setTotalPresent(presentiesList.size());
} listOfAbsentEmployees.get(0).setTotalAbsent(listOfAbsentEmployees.size());
} }
}
} catch (Exception e) {
MyTimeLogger.getInstance().error("Exception occured due to: ", e);
throw new MyTimeException(e.getMessage());
}
return listOfAbsentEmployees;
}
public Boolean copyRemoteMdbFileToLocal() throws MyTimeException {
File Finalfile = null;
boolean result = false;
try {
SmbFile[] smbFiles = new SmbFile(remotePath).listFiles();
for (SmbFile file : smbFiles) {
if (file.getCanonicalPath().contains(mdbFile)) {
Finalfile = new File(localFileDirectory + file.getName());
try (InputStream in = file.getInputStream();
FileOutputStream out = new FileOutputStream(Finalfile)) {
IOUtils.copy(in, out);
result = true;
}
}
}
} catch (Exception e) {
MyTimeLogger.getInstance().error(e.getMessage());
throw new MyTimeException(e.getMessage());
}
return result;
}
}
...@@ -39,7 +39,10 @@ public interface ProjectService { ...@@ -39,7 +39,10 @@ public interface ProjectService {
List<ProjectTeamMate> getMyTeamDetails(String empId); List<ProjectTeamMate> getMyTeamDetails(String empId);
List<EmployeeRoles> getUnAssignedEmployees(); List<EmployeeRoles> getUnAssignedEmployees();
public List<ProjectTeamMate> getShiftDetails(String shift);
public List<ProjectTeamMate> getAllProjectDetails(); List<ProjectTeamMate> getShiftDetails(String shift);
public List<ProjectTeamMate> getProjectDetails(String projectId);
List<ProjectTeamMate> getAllProjectDetails();
List<ProjectTeamMate> getProjectDetails(String projectId);
} }
...@@ -78,13 +78,26 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -78,13 +78,26 @@ public class ProjectServiceImpl implements ProjectService {
public Project updateProject(Project project) { public Project updateProject(Project project) {
Query query = new Query(Criteria.where("projectId").is(project.getProjectId())); Query query = new Query(Criteria.where("projectId").is(project.getProjectId()));
Update update = new Update(); Update update = new Update();
update.set("projectName", project.getProjectName());
update.set("managerId", project.getManagerId()); update.set("managerId", project.getManagerId());
update.set("managerName", project.getManagerName()); update.set("managerName", project.getManagerName());
update.set("account", project.getAccount());
update.set("status", project.getStatus()); update.set("status", project.getStatus());
FindAndModifyOptions options = new FindAndModifyOptions(); FindAndModifyOptions options = new FindAndModifyOptions();
options.returnNew(true); options.returnNew(true);
options.upsert(true); options.upsert(true);
return mongoTemplate.findAndModify(query, update, options, Project.class); Project projectDB= mongoTemplate.findAndModify(query, update, options, Project.class);
List<ProjectTeamMate> employeeDetails= projectTeamMatesRepo.findByProjectId(project.getProjectId());
if(employeeDetails!=null&&projectDB!=null) {
for (ProjectTeamMate emp : employeeDetails) {
emp.setManagerId(projectDB.getManagerId());
emp.setManagerName(projectDB.getManagerName());
emp.setAccount(projectDB.getAccount());
emp.setProjectName(projectDB.getProjectName());
projectTeamMatesRepo.save(emp);
}
}
return projectDB;
} }
@Override @Override
...@@ -115,7 +128,15 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -115,7 +128,15 @@ public class ProjectServiceImpl implements ProjectService {
existingTeammate.setBillableStatus(projectTeamMate.getBillableStatus()); existingTeammate.setBillableStatus(projectTeamMate.getBillableStatus());
existingTeammate.setMobileNumber(projectTeamMate.getMobileNumber()); existingTeammate.setMobileNumber(projectTeamMate.getMobileNumber());
existingTeammate.setShift(projectTeamMate.getShift()); existingTeammate.setShift(projectTeamMate.getShift());
return projectTeamMatesRepo.save(existingTeammate); ProjectTeamMate teamMate= projectTeamMatesRepo.save(existingTeammate);
try {
EmployeeRoles employeeDB= employeeRolesRepo.findByEmployeeId(teamMate.getEmployeeId());
employeeDB.setShift(teamMate.getShift());
employeeDB.setMobileNumber(teamMate.getMobileNumber());
employeeRolesRepo.save(employeeDB);
}
catch(Exception e) {}
return teamMate;
} }
@Override @Override
......
package com.nisum.mytime.service; package com.nisum.mytime.service;
import java.util.List; import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.EmpLoginData; import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.Shift; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Shift;
public interface UserService { import com.nisum.mytime.model.Skill;
Boolean fetchEmployeesData(String perticularDate) throws MyTimeException; public interface UserService {
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException; Boolean fetchEmployeesData(String perticularDate) throws MyTimeException;
List<EmployeeRoles> getEmployeeRoles() throws MyTimeException; List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException; List<EmployeeRoles> getEmployeeRoles() throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException; EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException;
EmployeeRoles getEmployeesRole(String emailId); String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
void deleteEmployee(String empId); EmployeeRoles getEmployeesRole(String emailId);
EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles); void deleteEmployee(String empId);
EmployeeRoles getEmployeesRoleData(String empId); EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles);
List<Shift> getAllShifts() throws MyTimeException; EmployeeRoles getEmployeesRoleData(String empId);
List<Designation> getAllDesignations() throws MyTimeException;
} List<Shift> getAllShifts() throws MyTimeException;
List<Designation> getAllDesignations() throws MyTimeException;
List<Skill> getTechnologies() throws MyTimeException;
public EmployeeRoles updateProfile(EmployeeRoles employeeRoles) throws MyTimeException;
public List<Account> getAccounts() throws MyTimeException;
}
package com.nisum.mytime.service; package com.nisum.mytime.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.FindAndModifyOptions; import org.springframework.data.mongodb.core.FindAndModifyOptions;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.EmpLoginData; import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.Shift; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.repository.DesignationRepo; import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.repository.EmployeeRolesRepo; import com.nisum.mytime.model.Shift;
import com.nisum.mytime.repository.ShiftRepo; import com.nisum.mytime.model.Skill;
import com.nisum.mytime.utils.PdfReportGenerator; import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.repository.DesignationRepo;
@Service("userService") import com.nisum.mytime.repository.EmployeeRolesRepo;
public class UserServiceImpl implements UserService { import com.nisum.mytime.repository.ProjectTeamMatesRepo;
import com.nisum.mytime.repository.ShiftRepo;
@Autowired import com.nisum.mytime.repository.TechnologyRepo;
private EmployeeRolesRepo employeeRolesRepo; import com.nisum.mytime.utils.PdfReportGenerator;
@Autowired @Service("userService")
private ShiftRepo shiftRepo; public class UserServiceImpl implements UserService {
@Autowired @Autowired
private DesignationRepo designationRepo; private EmployeeRolesRepo employeeRolesRepo;
@Autowired
@Autowired private ProjectTeamMatesRepo projectTeamMatesRepo;
private EmployeeDataService employeeDataBaseService; @Autowired
private ShiftRepo shiftRepo;
@Autowired
private PdfReportGenerator pdfReportGenerator; @Autowired
private DesignationRepo designationRepo;
@Autowired
private MongoTemplate mongoTemplate; @Autowired
private AccountRepo accountRepo;
@Override
public Boolean fetchEmployeesData(String perticularDate) throws MyTimeException { @Autowired
return employeeDataBaseService.fetchEmployeesData(perticularDate); private TechnologyRepo technologyRepo;
}
@Autowired
@Override private EmployeeDataService employeeDataBaseService;
public List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate)
throws MyTimeException { @Autowired
return employeeDataBaseService.fetchEmployeeLoginsBasedOnDates(id, fromDate, toDate); private PdfReportGenerator pdfReportGenerator;
}
@Autowired
@Override private MongoTemplate mongoTemplate;
public String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException {
return pdfReportGenerator.generateEmployeeReport(id, fromDate, toDate); @Override
} public Boolean fetchEmployeesData(String perticularDate) throws MyTimeException {
return employeeDataBaseService.fetchEmployeesData(perticularDate);
@Override }
public List<EmployeeRoles> getEmployeeRoles() throws MyTimeException {
return employeeRolesRepo.findAll(); @Override
} public List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate)
throws MyTimeException {
@Override return employeeDataBaseService.fetchEmployeeLoginsBasedOnDates(id, fromDate, toDate);
public EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException { }
employeeRoles.setCreatedOn(new Date());
return employeeRolesRepo.save(employeeRoles); @Override
} public String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException {
return pdfReportGenerator.generateEmployeeReport(id, fromDate, toDate);
@Override }
public EmployeeRoles getEmployeesRole(String emailId) {
return employeeRolesRepo.findByEmailId(emailId); @Override
public List<EmployeeRoles> getEmployeeRoles() throws MyTimeException {
} return employeeRolesRepo.findAll();
}
@Override
public void deleteEmployee(String employeeId) { @Override
EmployeeRoles role = employeeRolesRepo.findByEmployeeId(employeeId); public EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException {
employeeRolesRepo.delete(role); employeeRoles.setCreatedOn(new Date());
} return employeeRolesRepo.save(employeeRoles);
}
@Override
public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles) { @Override
Query query = new Query(Criteria.where("employeeId").is(employeeRoles.getEmployeeId())); public EmployeeRoles getEmployeesRole(String emailId) {
Update update = new Update(); return employeeRolesRepo.findByEmailId(emailId);
update.set("employeeName", employeeRoles.getEmployeeName());
update.set("emailId", employeeRoles.getEmailId()); }
update.set("role", employeeRoles.getRole());
update.set("shift", employeeRoles.getShift()); @Override
update.set("lastModifiedOn", new Date()); public void deleteEmployee(String employeeId) {
FindAndModifyOptions options = new FindAndModifyOptions(); EmployeeRoles role = employeeRolesRepo.findByEmployeeId(employeeId);
options.returnNew(true); employeeRolesRepo.delete(role);
options.upsert(true); }
return mongoTemplate.findAndModify(query, update, options, EmployeeRoles.class);
} @Override
public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles) {
@Override Query query = new Query(Criteria.where("employeeId").is(employeeRoles.getEmployeeId()));
public EmployeeRoles getEmployeesRoleData(String employeeId) { Update update = new Update();
return employeeRolesRepo.findByEmployeeId(employeeId); update.set("employeeName", employeeRoles.getEmployeeName());
} update.set("emailId", employeeRoles.getEmailId());
update.set("role", employeeRoles.getRole());
@Override update.set("shift", employeeRoles.getShift());
public List<Shift> getAllShifts() throws MyTimeException { update.set("lastModifiedOn", new Date());
return shiftRepo.findAll(); FindAndModifyOptions options = new FindAndModifyOptions();
} options.returnNew(true);
options.upsert(true);
@Override return mongoTemplate.findAndModify(query, update, options, EmployeeRoles.class);
public List<Designation> getAllDesignations() throws MyTimeException { }
return designationRepo.findAll();
} @Override
public EmployeeRoles getEmployeesRoleData(String employeeId) {
} return employeeRolesRepo.findByEmployeeId(employeeId);
}
@Override
public List<Shift> getAllShifts() throws MyTimeException {
return shiftRepo.findAll();
}
@Override
public List<Designation> getAllDesignations() throws MyTimeException {
return designationRepo.findAll();
}
@Override
public List<Account> getAccounts() throws MyTimeException {
return accountRepo.findAll();
}
@Override
public List<Skill> getTechnologies() throws MyTimeException {
return technologyRepo.findAll();
}
@Override
public EmployeeRoles updateProfile(EmployeeRoles employeeRoles) throws MyTimeException {
boolean mobileNumberChnaged=false;
employeeRoles.setLastModifiedOn(new Date());
EmployeeRoles existingEmployee=employeeRolesRepo.findByEmployeeId(employeeRoles.getEmployeeId());
String newMobileNumber=employeeRoles.getMobileNumber();
if(newMobileNumber!=null&&!newMobileNumber.equalsIgnoreCase("")) {
if((existingEmployee!=null&&existingEmployee.getMobileNumber()!=null&&!existingEmployee.getMobileNumber().equalsIgnoreCase(newMobileNumber) )|| (existingEmployee.getMobileNumber()==null )){
mobileNumberChnaged=true;
}
}
EmployeeRoles employeeRolesDB= employeeRolesRepo.save(employeeRoles);
if(mobileNumberChnaged) {
try {
List<ProjectTeamMate> employeeProfiles= projectTeamMatesRepo.findByEmployeeId(employeeRoles.getEmployeeId());
if(employeeProfiles!=null&&!employeeProfiles.isEmpty()) {
for(ProjectTeamMate profile:employeeProfiles){
profile.setMobileNumber(employeeRolesDB.getMobileNumber());
projectTeamMatesRepo.save(profile);
}
}}catch(Exception e) {}
}
return employeeRolesDB;
}
}
...@@ -23,7 +23,7 @@ mytime.attendance.fileName=eTimeTrackLite1.mdb ...@@ -23,7 +23,7 @@ mytime.attendance.fileName=eTimeTrackLite1.mdb
#Local configuration purpose #Local configuration purpose
mytime.remote.connection=smb://MyTime:nisum@192.168.15.67/eTimeTrackLite/ mytime.remote.connection=smb://MyTime:nisum@192.168.15.67/eTimeTrackLite/
mytime.localFile.directory=/Users/nisum/Documents/ mytime.localFile.directory=/home/nisum/Documents/
#Mail configuration #Mail configuration
spring.mail.host=smtp.gmail.com spring.mail.host=smtp.gmail.com
...@@ -33,3 +33,6 @@ spring.mail.password=nisum@123 ...@@ -33,3 +33,6 @@ spring.mail.password=nisum@123
spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true spring.mail.properties.mail.smtp.starttls.required=true
#Spring boot favicon related
spring.mvc.favicon.enabled = false
\ No newline at end of file
...@@ -6,7 +6,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -6,7 +6,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
"employeeName": "", "employeeName": "",
"emailId":"", "emailId":"",
"role": "", "role": "",
"shift": "",
"action":"" "action":""
}; };
...@@ -23,7 +22,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -23,7 +22,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false},
{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: false, width:100}, {field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: false, width:100},
//{field : 'shift',displayName: 'Shift', enableColumnMenu: false, enableSorting: false},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false, width:100} {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false, width:100}
] ]
}; };
...@@ -34,7 +32,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -34,7 +32,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData.employeeName = row.entity.employeeName; $scope.parentData.employeeName = row.entity.employeeName;
$scope.parentData.emailId = row.entity.emailId; $scope.parentData.emailId = row.entity.emailId;
$scope.parentData.role = row.entity.role; $scope.parentData.role = row.entity.role;
$scope.parentData.shift = row.entity.shift;
if(action == "Update") if(action == "Update")
$scope.assignRole(action, $scope.parentData); $scope.assignRole(action, $scope.parentData);
else if(action == "Delete") else if(action == "Delete")
...@@ -117,6 +114,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -117,6 +114,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
} }
$scope.assignRole = function(action, userData){ $scope.assignRole = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddRoleController, controller: AddRoleController,
...@@ -138,7 +136,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -138,7 +136,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}; };
$scope.deleteRole = function(row){ $scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm() var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure want to delete the role?') .textContent('Are you sure want to delete the role?')
.ok('Ok') .ok('Ok')
.cancel('Cancel'); .cancel('Cancel');
...@@ -183,19 +183,16 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -183,19 +183,16 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.empId = ""; $scope.empId = "";
$scope.empName = ""; $scope.empName = "";
$scope.empRole; $scope.empRole;
$scope.empShift;
$scope.empEmail = ""; $scope.empEmail = "";
$scope.isDisabled = false; $scope.isDisabled = false;
}else if(dataToPass.action == "Update"){ }else if(dataToPass.action == "Update"){
$scope.empId = dataToPass.employeeId; $scope.empId = dataToPass.employeeId;
$scope.empName = dataToPass.employeeName; $scope.empName = dataToPass.employeeName;
$scope.empRole = dataToPass.role; $scope.empRole = dataToPass.role;
$scope.empShift = dataToPass.shift;
$scope.empEmail = dataToPass.emailId; $scope.empEmail = dataToPass.emailId;
$scope.isDisabled = true; $scope.isDisabled = true;
} }
$scope.roles = ["HR","Manager","Employee","HR Manager","Director","Lead"]; $scope.roles = ["Director","Employee","HR","HR Manager","Lead","Manager"];
$scope.shifts = myFactory.getShifts();//["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"];
$scope.getSelectedRole = function(){ $scope.getSelectedRole = function(){
if ($scope.empRole !== undefined) { if ($scope.empRole !== undefined) {
return $scope.empRole; return $scope.empRole;
...@@ -204,14 +201,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -204,14 +201,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
} }
}; };
$scope.getSelectedShift = function(){
if ($scope.empShift !== undefined) {
return $scope.empShift;
} else {
return "Please select a shift";
}
};
$scope.validateEmpId = function(){ $scope.validateEmpId = function(){
var searchId = $scope.empId; var searchId = $scope.empId;
if(searchId != "" && isNaN(searchId)){ if(searchId != "" && isNaN(searchId)){
...@@ -268,7 +257,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -268,7 +257,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var searchId = $scope.empId; var searchId = $scope.empId;
var empName = $scope.empName; var empName = $scope.empName;
var empRole = $scope.empRole; var empRole = $scope.empRole;
var empShift = $scope.empShift;
var empEmail = $scope.empEmail; var empEmail = $scope.empEmail;
if(searchId == ""){ if(searchId == ""){
$scope.alertMsg = "Employee ID is mandatory"; $scope.alertMsg = "Employee ID is mandatory";
...@@ -288,12 +276,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -288,12 +276,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}else if(empRole == undefined){ }else if(empRole == undefined){
$scope.alertMsg = "Please select a role"; $scope.alertMsg = "Please select a role";
document.getElementById('empRole').focus(); document.getElementById('empRole').focus();
}else if(empShift == undefined){
$scope.alertMsg = "Please select a shift";
document.getElementById('empShift').focus();
}else{ }else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": $scope.empRole, "shift": $scope.empShift}; var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": $scope.empRole};
addOrUpdateRole(record, $scope.templateTitle); addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
......
...@@ -62,6 +62,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -62,6 +62,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
$scope.getEmployeePresent = function(type){ $scope.getEmployeePresent = function(type){
$mdDialog.hide();
if(type == "onload"){ if(type == "onload"){
showProgressDialog("Fetching data please wait..."); showProgressDialog("Fetching data please wait...");
} }
...@@ -83,7 +84,6 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -83,7 +84,6 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
$scope.totalPresent = response.data[0].totalPresent; $scope.totalPresent = response.data[0].totalPresent;
$scope.totalAbsent = response.data[0].totalAbsent; $scope.totalAbsent = response.data[0].totalAbsent;
$scope.totalEmployees = response.data[0].totalPresent + response.data[0].totalAbsent;
} }
}, function myError(response) { }, function myError(response) {
showAlert("Something went wrong while fetching data!!!"); showAlert("Something went wrong while fetching data!!!");
...@@ -121,6 +121,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -121,6 +121,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
} }
function showProgressDialog(msg){ function showProgressDialog(msg){
$('#home').addClass('md-scroll-mask');
$mdDialog.show({ $mdDialog.show({
templateUrl: 'templates/progressDialog.html', templateUrl: 'templates/progressDialog.html',
controller: ProgressController, controller: ProgressController,
......
...@@ -13,6 +13,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -13,6 +13,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
getAllUserRoles(); getAllUserRoles();
getAllShifts(); getAllShifts();
getAllDesignations(); getAllDesignations();
getAllTechnologies();
getAllAccounts();
} }
function onFailure(error){ function onFailure(error){
...@@ -64,7 +66,6 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -64,7 +66,6 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
myFactory.setShifts(response.data); myFactory.setShifts(response.data);
}, function myError(response) { }, function myError(response) {
$scope.shifts = [];
}); });
}; };
function getAllDesignations(){ function getAllDesignations(){
...@@ -74,7 +75,26 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -74,7 +75,26 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
myFactory.setDesignations(response.data); myFactory.setDesignations(response.data);
}, function myError(response) { }, function myError(response) {
$scope.shifts = []; });
};
function getAllTechnologies(){
$http({
method : "GET",
url : appConfig.appUri + "user/getSkills"
}).then(function mySuccess(response) {
myFactory.setTechnologies(response.data);
}, function myError(response) {
});
};
function getAllAccounts(){
$http({
method : "GET",
url : appConfig.appUri + "user/getAccounts"
}).then(function mySuccess(response) {
myFactory.setAccounts(response.data);
}, function myError(response) {
}); });
}; };
function showRegisterEmployeeScreen(profile){ function showRegisterEmployeeScreen(profile){
...@@ -106,14 +126,13 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -106,14 +126,13 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
$scope.empName = dataToPass.getName(); $scope.empName = dataToPass.getName();
$scope.empEmail = dataToPass.getEmail(); $scope.empEmail = dataToPass.getEmail();
$scope.empShift; $scope.empShift;
$scope.shifts = myFactory.getTechnologies(); //["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"];
$scope.shifts = myFactory.getShifts(); //["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"];
$scope.getSelectedShift = function(){ $scope.getSelectedShift = function(){
if ($scope.empShift !== undefined) { if ($scope.empShift !== undefined) {
return $scope.empShift; return $scope.empShift;
} else { } else {
return "Please select a shift"; return "Please select primary skill";
} }
}; };
...@@ -153,6 +172,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -153,6 +172,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
var searchId = $scope.empId; var searchId = $scope.empId;
var empName = $scope.empName; var empName = $scope.empName;
var empShift = $scope.empShift; var empShift = $scope.empShift;
var mobileNumber = $scope.mobileNumber;
if(searchId == ""){ if(searchId == ""){
$scope.alertMsg = "Employee ID is mandatory"; $scope.alertMsg = "Employee ID is mandatory";
document.getElementById('empId').focus(); document.getElementById('empId').focus();
...@@ -165,12 +186,15 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -165,12 +186,15 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}else if(empName == ""){ }else if(empName == ""){
$scope.alertMsg = "Employee Name is mandatory"; $scope.alertMsg = "Employee Name is mandatory";
document.getElementById('empName').focus(); document.getElementById('empName').focus();
}else if(mobileNumber == undefined || mobileNumber == ""){
$scope.alertMsg = "Mobile Number is mandatory";
document.getElementById('mobileNumber').focus();
}else if(empShift == undefined){ }else if(empShift == undefined){
$scope.alertMsg = "Please select a shift"; $scope.alertMsg = "Please select a primary skill";
document.getElementById('empShift').focus(); document.getElementById('empShift').focus();
}else{ }else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": "Employee", "shift": $scope.empShift}; var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": "Employee", "shift": "Shift 1(09:00 AM - 06:00 PM)","mobileNumber":$scope.mobileNumber,"baseTechnology": $scope.empShift};
addEmployee(record); addEmployee(record);
} }
}; };
...@@ -214,14 +238,18 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -214,14 +238,18 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "Manage Projects","icon" : "fa fa-tasks fa-2x","path" : "templates/projects.html"}); menuItems.push({"menu" : "Manage Projects","icon" : "fa fa-tasks fa-2x","path" : "templates/projects.html"});
menuItems.push({"menu" : "Attendance Report","icon" : "fa fa-bar-chart fa-2x","path" : "templates/attendanceReport.html"}); menuItems.push({"menu" : "Attendance Report","icon" : "fa fa-bar-chart fa-2x","path" : "templates/attendanceReport.html"});
menuItems.push({"menu" : "Shift Details","icon" : "fa fa-superpowers fa-2x","path" : "templates/shiftdetails.html"}); menuItems.push({"menu" : "Shift Details","icon" : "fa fa-superpowers fa-2x","path" : "templates/shiftdetails.html"});
menuItems.push({"menu" : "ReSync Data","icon" : "fa fa-recycle fa-2x","path" : "templates/resyncData.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
}else if(role == "Manager"){ }else if(role == "Manager"){
menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"}); menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"});
menuItems.push({"menu" : "Reportee Details","icon" : "fa fa-users fa-2x","path" : "templates/reportees.html"}); menuItems.push({"menu" : "Reportee Details","icon" : "fa fa-users fa-2x","path" : "templates/reportees.html"});
menuItems.push({"menu" : "Manage Team","icon" : "fa fa-sitemap fa-2x","path" : "templates/projectDetails.html"}); menuItems.push({"menu" : "Manage Team","icon" : "fa fa-sitemap fa-2x","path" : "templates/projectDetails.html"});
menuItems.push({"menu" : "View Projects","icon" : "fa fa-compass fa-2x","path" : "templates/viewProjects.html"}); menuItems.push({"menu" : "View Projects","icon" : "fa fa-tasks fa-2x","path" : "templates/viewProjects.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
}else if(role == "Employee"){ }else if(role == "Employee"){
menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"}); menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"});
menuItems.push({"menu" : "My Team","icon" : "fa fa-futbol-o fa-2x","path" : "templates/myTeam.html"}); menuItems.push({"menu" : "My Team","icon" : "fa fa-futbol-o fa-2x","path" : "templates/myTeam.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
}else if(role == "HR Manager" || role == "Director"){ }else if(role == "HR Manager" || role == "Director"){
menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"}); menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"});
menuItems.push({"menu" : "Employee Details","icon" : "fa fa-users fa-2x","path" : "templates/employees.html"}); menuItems.push({"menu" : "Employee Details","icon" : "fa fa-users fa-2x","path" : "templates/employees.html"});
...@@ -231,10 +259,12 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -231,10 +259,12 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "Manage Projects","icon" : "fa fa-tasks fa-2x","path" : "templates/projects.html"}); menuItems.push({"menu" : "Manage Projects","icon" : "fa fa-tasks fa-2x","path" : "templates/projects.html"});
menuItems.push({"menu" : "Attendance Report","icon" : "fa fa-bar-chart fa-2x","path" : "templates/attendanceReport.html"}); menuItems.push({"menu" : "Attendance Report","icon" : "fa fa-bar-chart fa-2x","path" : "templates/attendanceReport.html"});
menuItems.push({"menu" : "Shift Details","icon" : "fa fa-superpowers fa-2x","path" : "templates/shiftdetails.html"}); menuItems.push({"menu" : "Shift Details","icon" : "fa fa-superpowers fa-2x","path" : "templates/shiftdetails.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
}else if(role == "Lead"){ }else if(role == "Lead"){
menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"}); menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"});
menuItems.push({"menu" : "Reportee Details","icon" : "fa fa-users fa-2x","path" : "templates/reportees.html"}); menuItems.push({"menu" : "Reportee Details","icon" : "fa fa-users fa-2x","path" : "templates/reportees.html"});
menuItems.push({"menu" : "Manage Team","icon" : "fa fa-sitemap fa-2x","path" : "templates/projectDetails.html"}); menuItems.push({"menu" : "Manage Team","icon" : "fa fa-sitemap fa-2x","path" : "templates/projectDetails.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
} }
myFactory.setMenuItems(menuItems); myFactory.setMenuItems(menuItems);
......
myApp.controller("profileController", function($scope, $http, myFactory, $mdDialog, appConfig) {
$scope.records = [];
$scope.empId = myFactory.getEmpId();
$scope.empName = myFactory.getEmpName();
$scope.empEmailId = myFactory.getEmpEmailId();
$scope.getProfileData = function(){
var empId = $scope.empId;
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeRoleData?empId=" + empId
}).then(function mySuccess(response) {
$scope.profile = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
}
$scope.refreshPage = function(){
$scope.getProfileData();
};
$scope.updateProfile = function(){
$('#home').addClass('md-scroll-mask');
$mdDialog.show({
controller: UpdateProfileController,
templateUrl: 'templates/updateProfile.html',
parent: angular.element(document.body),
clickOutsideToClose:true,
locals:{dataToPass: $scope.profile},
})
.then(function(result) {
if(result == "Success") showAlert('Profile updated successfully');
else if(result == "Error") showAlert('Profile updation failed!!!');
$scope.refreshPage();
});
};
function UpdateProfileController($scope, $mdDialog, dataToPass) {
$scope.profile = dataToPass;
$scope.technologies=myFactory.getTechnologies();
$scope.baseTechnology=(dataToPass.baseTechnology == null ? undefined: dataToPass.baseTechnology);
$scope.mobileNumber=dataToPass.mobileNumber;
$scope.alternateMobileNumber=dataToPass.alternateMobileNumber;
$scope.personalEmailId=dataToPass.personalEmailId;
$scope.technologyKnown=dataToPass.technologyKnown;
$scope.cancel = function() {
$mdDialog.hide();
};
$scope.getSelectedTech = function(){
if ($scope.baseTechnology !== undefined) {
return $scope.baseTechnology;
} else {
return "Please select primary skill";
}
};
$scope.validateFields = function(){
var mobileNumber = $scope.mobileNumber;
$scope.alertMsg = "";
var record = {"employeeId":myFactory.getEmpId(), "mobileNumber": mobileNumber, "alternateMobileNumber": $scope.alternateMobileNumber, "personalEmailId": $scope.personalEmailId, "baseTechnology": $scope.baseTechnology, "technologyKnown": $scope.technologyKnown};
var urlRequest = "";
urlRequest = appConfig.appUri+ "user/updateProfile";
var req = {
method : 'POST',
url : urlRequest,
headers : {
"Content-type" : "application/json"
},
data : record
}
$http(req).then(function mySuccess(response) {
$mdDialog.hide('Success');
$scope.dataToPass=response.data;
}, function myError(response){
$mdDialog.hide('Error');
});
};
}
function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent(
angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true).textContent(message).ariaLabel(
'Alert Dialog').ok('Ok'));
}
});
...@@ -4,6 +4,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -4,6 +4,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.parentData = { $scope.parentData = {
"projectId": "", "projectId": "",
"projectName": "", "projectName": "",
"account": "",
"managerId":"", "managerId":"",
"managerName": "", "managerName": "",
"status": "", "status": "",
...@@ -24,7 +25,8 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -24,7 +25,8 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
columnDefs : [ columnDefs : [
{field : 'projectId',displayName: 'Project ID', enableColumnMenu: true, enableSorting: true, width:120}, {field : 'projectId',displayName: 'Project ID', enableColumnMenu: true, enableSorting: true, width:120},
{field : 'projectName',displayName: 'Project ', enableColumnMenu: false, enableSorting: false}, {field : 'projectName',displayName: 'Project ', enableColumnMenu: false, enableSorting: false},
{field : 'managerId',displayName: 'Manager ID ', enableColumnMenu: false, enableSorting: false}, {field : 'account',displayName: 'Account ', enableColumnMenu: false, enableSorting: false},
//{field : 'managerId',displayName: 'Manager ID ', enableColumnMenu: false, enableSorting: false},
{field : 'managerName',displayName: 'Manager Name ', enableColumnMenu: false, enableSorting: false}, {field : 'managerName',displayName: 'Manager Name ', enableColumnMenu: false, enableSorting: false},
{field : 'status',displayName: 'Status ', enableColumnMenu: false, enableSorting: false}, {field : 'status',displayName: 'Status ', enableColumnMenu: false, enableSorting: false},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false, width:130} {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false, width:130}
...@@ -35,6 +37,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -35,6 +37,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.getRowData = function(row, action){ $scope.getRowData = function(row, action){
$scope.parentData.projectId = row.entity.projectId; $scope.parentData.projectId = row.entity.projectId;
$scope.parentData.projectName = row.entity.projectName; $scope.parentData.projectName = row.entity.projectName;
$scope.parentData.account = row.entity.account;
$scope.parentData.managerId = row.entity.managerId; $scope.parentData.managerId = row.entity.managerId;
$scope.parentData.managerName = row.entity.managerName; $scope.parentData.managerName = row.entity.managerName;
$scope.parentData.status = row.entity.status; $scope.parentData.status = row.entity.status;
...@@ -133,6 +136,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -133,6 +136,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
} }
$scope.addProject = function(action, userData){ $scope.addProject = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -142,13 +146,14 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -142,13 +146,14 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
locals:{dataToPass: userData,gridOptionsData: $scope.gridOptions.data, managers: $scope.managers}, locals:{dataToPass: userData,gridOptionsData: $scope.gridOptions.data, managers: $scope.managers},
}) })
.then(function(result) { .then(function(result) {
if(result == "Assign") showAlert('Project created successfully'); if(result == "Assign"){ $scope.refreshPage();showAlert('Project created successfully');}
else if(result == "Update") showAlert('Project updated successfully'); else if(result == "Update"){ $scope.refreshPage(); showAlert('Project updated successfully');}
else if(result == "Cancelled") console.log(result); else if(result == "Cancelled") console.log(result);
else showAlert('Project assigning/updation failed!!!'); else showAlert('Project assigning/updation failed!!!');
}); });
}; };
$scope.viewTeamDetails = function(action, userData){ $scope.viewTeamDetails = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -165,6 +170,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -165,6 +170,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
}); });
}; };
$scope.getUnAssignedEmployees = function(action, userData){ $scope.getUnAssignedEmployees = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -181,6 +187,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -181,6 +187,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
}); });
}; };
$scope.getAllocatedEmployees = function(action, userData){ $scope.getAllocatedEmployees = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -201,7 +208,9 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -201,7 +208,9 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
}; };
$scope.deleteRole = function(row){ $scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm() var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure you want to delete this project?') .textContent('Are you sure you want to delete this project?')
.ok('Ok') .ok('Ok')
.cancel('Cancel'); .cancel('Cancel');
...@@ -244,7 +253,8 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -244,7 +253,8 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.isDisabled = false; $scope.isDisabled = false;
$scope.result = ""; $scope.result = "";
$scope.managerDetails = managers; $scope.managerDetails = managers;
$scope.prjctStses=["Active","On Hold","Proposed","Completed"]; $scope.prjctStses=["Active","Completed","On Hold","Proposed"];
$scope.accounts=myFactory.getAccounts();
if(dataToPass.action == "Assign"){ if(dataToPass.action == "Assign"){
$scope.projectId = ""; $scope.projectId = "";
$scope.projectName = ""; $scope.projectName = "";
...@@ -252,22 +262,17 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -252,22 +262,17 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.managerName = ""; $scope.managerName = "";
$scope.isDisabled = false; $scope.isDisabled = false;
}else if(dataToPass.action == "Update"){ }else if(dataToPass.action == "Update"){
//alert("dataToPass"+dataToPass)
$scope.projectId = dataToPass.projectId; $scope.projectId = dataToPass.projectId;
$scope.projectName = dataToPass.projectName; $scope.projectName = dataToPass.projectName;
$scope.managerId = dataToPass.managerId; $scope.managerId = dataToPass.managerId;
$scope.managerName = dataToPass.managerName; $scope.managerName = dataToPass.managerName;
$scope.account = dataToPass.account;
$scope.projectStatus = dataToPass.status; $scope.projectStatus = dataToPass.status;
$scope.managerModel = { $scope.managerModel = {
'employeeName': dataToPass.managerName, 'employeeName': dataToPass.managerName,
'employeeId': dataToPass.managerId 'employeeId': dataToPass.managerId
}; };
$scope.managerDetails = managers; $scope.managerDetails = managers;
// $scope.managerModel.managerId=$scope.managerId;
// $scope.managerModel.employeeName=$scope.managerName;
//alert('$scope.managers'+$scope.managerDetails)
//alert('$scope.managerModel'+$scope.managerModel)
//$scope.managerModel.employeeName=dataToPass.managerName;
$scope.isDisabled = true; $scope.isDisabled = true;
}else if(dataToPass.action == "View"){ }else if(dataToPass.action == "View"){
$scope.projectId = dataToPass.projectId; $scope.projectId = dataToPass.projectId;
...@@ -275,8 +280,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -275,8 +280,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.managerId = dataToPass.managerId; $scope.managerId = dataToPass.managerId;
$scope.managerName = dataToPass.managerName; $scope.managerName = dataToPass.managerName;
$scope.projectStatus = dataToPass.status; $scope.projectStatus = dataToPass.status;
// $scope.managerModel = dataToPass.managerModel; $scope.gridOptions = {
$scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100], paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10, paginationPageSize : 10,
pageNumber: 1, pageNumber: 1,
...@@ -285,32 +289,22 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -285,32 +289,22 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
{field : 'employeeId',displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:100}, {field : 'employeeId',displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:100},
{field : 'employeeName',displayName: 'Empl Name ', enableColumnMenu: false, enableSorting: false}, {field : 'employeeName',displayName: 'Empl Name ', enableColumnMenu: false, enableSorting: false},
{field : 'emailId',displayName: 'Email Id ', enableColumnMenu: false, enableSorting: false}, {field : 'emailId',displayName: 'Email Id ', enableColumnMenu: false, enableSorting: false},
//{field : 'projectName',displayName: 'Project ', enableColumnMenu: false, enableSorting: false},
//{field : 'managerName',displayName: 'Manager ', enableColumnMenu: false, enableSorting: false},
{field : 'experience',displayName: 'Exp', enableColumnMenu: true, enableSorting: true,width:80}, {field : 'experience',displayName: 'Exp', enableColumnMenu: true, enableSorting: true,width:80},
{field : 'designation',displayName: 'Designation ', enableColumnMenu: false, enableSorting: false}, {field : 'designation',displayName: 'Designation ', enableColumnMenu: false, enableSorting: false},
{field : 'billableStatus',displayName: 'Billability ', enableColumnMenu: false, enableSorting: false}, {field : 'billableStatus',displayName: 'Billability ', enableColumnMenu: false, enableSorting: false},
] ]
}; };
//$scope.gridOptions.data = $scope.records;
$scope.isDisabled = true; $scope.isDisabled = true;
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/projectTeam/getProjectDetails?projectId="+$scope.projectId url : appConfig.appUri + "/projectTeam/getProjectDetails?projectId="+$scope.projectId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
}, function myError(response) { }, function myError(response) {
showAlert("Something went wrong while fetching data!!!"); showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
}); });
}else if(dataToPass.action == "UnAssigned"){ }else if(dataToPass.action == "UnAssigned"){
//$scope.projectId = dataToPass.projectId;
//$scope.projectName = dataToPass.projectName;
//$scope.managerId = dataToPass.managerId;
//$scope.managerName = dataToPass.managerName;
// $scope.managerModel = dataToPass.managerModel;
$scope.gridOptions = { $scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100], paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10, paginationPageSize : 10,
...@@ -320,32 +314,19 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -320,32 +314,19 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
{field : 'employeeId',displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:100}, {field : 'employeeId',displayName: 'Emp ID', enableColumnMenu: true, enableSorting: true, width:100},
{field : 'employeeName',displayName: 'Empl Name ', enableColumnMenu: false, enableSorting: false}, {field : 'employeeName',displayName: 'Empl Name ', enableColumnMenu: false, enableSorting: false},
{field : 'emailId',displayName: 'Email Id ', enableColumnMenu: false, enableSorting: false}, {field : 'emailId',displayName: 'Email Id ', enableColumnMenu: false, enableSorting: false},
//{field : 'projectName',displayName: 'Project ', enableColumnMenu: false, enableSorting: false},
//{field : 'managerName',displayName: 'Manager ', enableColumnMenu: false, enableSorting: false},
//{field : 'experience',displayName: 'Exp', enableColumnMenu: true, enableSorting: true,width:50},
//{field : 'designation',displayName: 'Designation ', enableColumnMenu: false, enableSorting: false},
//{field : 'billableStatus',displayName: 'Billability ', enableColumnMenu: false, enableSorting: false},
] ]
}; };
//$scope.gridOptions.data = $scope.records;
$scope.isDisabled = true; $scope.isDisabled = true;
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/projectTeam/getUnAssignedEmployees" url : appConfig.appUri + "/projectTeam/getUnAssignedEmployees"
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
}, function myError(response) { }, function myError(response) {
showAlert("Something went wrong while fetching data!!!"); showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
}); });
}else if(dataToPass.action == "allocated"){ }else if(dataToPass.action == "allocated"){
//$scope.projectId = dataToPass.projectId;
//$scope.projectName = dataToPass.projectName;
//$scope.managerId = dataToPass.managerId;
//$scope.managerName = dataToPass.managerName;
// $scope.managerModel = dataToPass.managerModel;
$scope.gridOptions = { $scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100], paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10, paginationPageSize : 10,
...@@ -402,22 +383,17 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -402,22 +383,17 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
} }
] ]
}; };
//$scope.gridOptions.data = $scope.records;
$scope.isDisabled = true; $scope.isDisabled = true;
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/projectTeam/getProjectAllocations" url : appConfig.appUri + "/projectTeam/getProjectAllocations"
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
}, function myError(response) { }, function myError(response) {
showAlert("Something went wrong while fetching data!!!"); showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
}); });
} }
//$scope.roles = ["HR","Manager","Employee"];
//$scope.shifts = ["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 PM)"];
$scope.getManagers = function(){ $scope.getManagers = function(){
if ($scope.managerModel !== undefined) { if ($scope.managerModel !== undefined) {
return $scope.managerModel.employeeName; return $scope.managerModel.employeeName;
...@@ -432,13 +408,16 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -432,13 +408,16 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
return "Please select project status"; return "Please select project status";
} }
}; };
// $scope.getSelectedShift = function(){
// if ($scope.empShift !== undefined) {
// return $scope.empShift;
// } else { $scope.getAccountText = function(){
// return "Please select a shift"; if ($scope.account !== undefined) {
// } return $scope.account;
// }; } else {
return "Please select account";
}
};
$scope.validateEmpId = function(){ $scope.validateEmpId = function(){
var searchId = $scope.empId; var searchId = $scope.empId;
...@@ -497,18 +476,22 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -497,18 +476,22 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
var projectName = $scope.projectName; var projectName = $scope.projectName;
var managerModel = $scope.managerModel; var managerModel = $scope.managerModel;
if(project == ""){ // if(project == ""){
$scope.alertMsg = "Project ID is mandatory"; // $scope.alertMsg = "Project ID is mandatory";
document.getElementById('projectId').focus(); // document.getElementById('projectId').focus();
}else if(projectName == ""){ // }else
if(projectName == ""){
$scope.alertMsg = "Project Name is mandatory"; $scope.alertMsg = "Project Name is mandatory";
document.getElementById('projectName').focus(); document.getElementById('projectName').focus();
}else if(account == undefined || account == ""){
$scope.alertMsg = "Account is mandatory";
document.getElementById('account').focus();
} }
else if(managerModel == undefined){ else if(managerModel == undefined){
$scope.alertMsg = "Please select a manager"; $scope.alertMsg = "Please select a manager";
}else{ }else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"projectId":$scope.projectId, "projectName": $scope.projectName, "managerId": $scope.managerModel.employeeId, "managerName": $scope.managerModel.employeeName, "status": $scope.projectStatus}; var record = {"projectId":$scope.projectId, "projectName": $scope.projectName, "managerId": $scope.managerModel.employeeId, "managerName": $scope.managerModel.employeeName, "status": $scope.projectStatus,"account": $scope.account};
addOrUpdateProject(record, $scope.templateTitle); addOrUpdateProject(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
...@@ -554,7 +537,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -554,7 +537,7 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
} }
$http(req).then(function mySuccess(response) { $http(req).then(function mySuccess(response) {
$scope.result = "Success"; $scope.result = "Success";
}, function myError(response){ }, function myError(response){
$scope.result = "Error"; $scope.result = "Error";
}); });
} }
......
...@@ -157,6 +157,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog ...@@ -157,6 +157,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
} }
$scope.assignRole = function(action, userData){ $scope.assignRole = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddRoleController, controller: AddRoleController,
...@@ -173,6 +174,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog ...@@ -173,6 +174,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
}); });
}; };
$scope.updateEmployee = function(action, userData){ $scope.updateEmployee = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddRoleController, controller: AddRoleController,
...@@ -193,7 +195,9 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog ...@@ -193,7 +195,9 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
}; };
$scope.deleteRole = function(row){ $scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm() var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure want to delete the role?') .textContent('Are you sure want to delete the role?')
.ok('Ok') .ok('Ok')
.cancel('Cancel'); .cancel('Cancel');
......
...@@ -16,7 +16,6 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -16,7 +16,6 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
"designation":"", "designation":"",
"billableStatus":"", "billableStatus":"",
"mobileNumber":"", "mobileNumber":"",
"experience":"",
"action":"" "action":""
}; };
$scope.employees = []; $scope.employees = [];
...@@ -90,69 +89,6 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -90,69 +89,6 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}); });
}; };
$scope.getProjects = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getProjects?employeeId="+myFactory.getEmpId()
}).then(function mySuccess(response) {
$scope.projects = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
};
$scope.validateEmpId = function(){
var searchId = $scope.empSearchId;
if(searchId !="" && isNaN(searchId)){
showAlert('Please enter only digits');
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else if(searchId != "" && (searchId.length < 5 || searchId.length > 5)){
showAlert('Employee ID should be 5 digits');
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else if(searchId != "" && !checkEmpIdRange(searchId)){
showAlert('Employee ID should be in between '+appConfig.empStartId+' - '+appConfig.empEndId);
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}
};
function checkEmpIdRange(searchId){
return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId;
}
$scope.getEmployeeRole = function(type){
var searchId = $scope.empSearchId;
if(searchId =="" && searchId.length == 0){
showAlert('Employee ID is mandatory');
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else if(searchId != "" && !checkEmpIdRange(searchId)){
showAlert('Employee ID should be in between '+appConfig.empStartId+' - '+appConfig.empEndId);
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else{
$scope.gridOptions.data = [];
getEmployeeRoleData(searchId);
}
};
function getEmployeeRoleData(empId){
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeRoleData?empId=" + empId
}).then(function mySuccess(response) {
if(response.data != "" && response.data.length !=0){
$scope.gridOptions.data.push(response.data);
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.refreshPage();
});
}
function showAlert(message) { function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent( $mdDialog.show($mdDialog.alert().parent(
...@@ -162,32 +98,35 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -162,32 +98,35 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
} }
$scope.assignRole = function(action, userData){ $scope.assignRole = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectTeamController, controller: AddProjectTeamController,
templateUrl: 'templates/newTeamMate.html', templateUrl: 'templates/newTeamMate.html',
parent: angular.element(document.body), parent: angular.element(document.body),
clickOutsideToClose:true, clickOutsideToClose:true,
locals:{dataToPass: userData, gridOptionsData: $scope.gridOptions.data, employees: $scope.employees, projects: $scope.projects}, locals:{dataToPass: userData, gridOptionsData: $scope.gridOptions.data, employees: $scope.employees},
}) })
.then(function(result) { .then(function(result) {
if(result == "Assign") showAlert('New Teammate assigned successfully'); if(result == "Add") showAlert('New Teammate assigned successfully');
else if(result == "Update") showAlert('Teammate updated successfully'); else if(result == "Update") showAlert('Teammate updated successfully');
else if(result == "Cancelled") console.log(result); else if(result == "Cancelled") console.log(result);
else showAlert('Teammate assigning/updation failed!!!'); else showAlert('Teammate assigning/updation failed!!!');
}); });
}; };
$scope.updateEmployee = function(action, userData){ $scope.updateEmployee = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectTeamController, controller: AddProjectTeamController,
templateUrl: 'templates/UpdateTeamMate.html', templateUrl: 'templates/UpdateTeamMate.html',
parent: angular.element(document.body), parent: angular.element(document.body),
clickOutsideToClose:true, clickOutsideToClose:true,
locals:{dataToPass: userData, gridOptionsData: $scope.gridOptions.data, employees: $scope.employees, projects: $scope.projects}, locals:{dataToPass: userData, gridOptionsData: $scope.gridOptions.data, employees: $scope.employees},
}) })
.then(function(result) { .then(function(result) {
if(result == "Assign") showAlert('New Teammate assigned successfully'); if(result == "Add") showAlert('New Teammate assigned successfully');
else if(result == "Update") { else if(result == "Update") {
$scope.refreshPage(); $scope.refreshPage();
showAlert('Teammate updated successfully'); showAlert('Teammate updated successfully');
...@@ -202,7 +141,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -202,7 +141,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}; };
$scope.deleteRole = function(row){ $scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm() var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure you want to delete the teammate?') .textContent('Are you sure you want to delete the teammate?')
.ok('Ok') .ok('Ok')
.cancel('Cancel'); .cancel('Cancel');
...@@ -237,16 +178,28 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -237,16 +178,28 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
} }
} }
function AddProjectTeamController($scope, $mdDialog, dataToPass, gridOptionsData,employees,projects) { function AddProjectTeamController($scope, $mdDialog, dataToPass, gridOptionsData,employees) {
$scope.templateTitle = dataToPass.action; $scope.templateTitle = dataToPass.action;
$scope.alertMsg = ""; $scope.alertMsg = "";
$scope.isDisabled = false; $scope.isDisabled = false;
$scope.result = ""; $scope.result = "";
$scope.employeeList = employees; $scope.employeeList = employees;
$scope.projectList = projects; $scope.projectList = [];
$scope.employeeModel; $scope.employeeModel;
$scope.projectModel; $scope.projectModel;
if(dataToPass.action == "Assign"){
$scope.getProjects = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getProjects?employeeId="+myFactory.getEmpId()
}).then(function mySuccess(response) {
$scope.projectList = response.data;
}, function myError(response) {
$scope.projectList = [];
});
};
if(dataToPass.action == "Add"){
$scope.empId = ""; $scope.empId = "";
$scope.empName = ""; $scope.empName = "";
$scope.empRole; $scope.empRole;
...@@ -273,9 +226,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -273,9 +226,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
'projectId': dataToPass.projectId 'projectId': dataToPass.projectId
}; };
} }
$scope.designations =myFactory.getDesignations(); $scope.designations = myFactory.getDesignations();
$scope.billableStatuses = ["Billable","Shadow","Bench"]; $scope.billableStatuses = ["Billable","Shadow","Bench"];
$scope.shifts =myFactory.getShifts();// ["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"]; $scope.shifts =myFactory.getShifts();
$scope.getSelectedDesignation = function(){ $scope.getSelectedDesignation = function(){
if ($scope.empDesignation !== undefined) { if ($scope.empDesignation !== undefined) {
return $scope.empDesignation; return $scope.empDesignation;
...@@ -314,60 +267,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -314,60 +267,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
} }
}; };
$scope.validateEmpId = function(){
var searchId = $scope.empId;
if(searchId != "" && isNaN(searchId)){
$scope.alertMsg = "Please enter only digits";
document.getElementById('empId').focus();
}else if(searchId != "" && ((searchId.length >0 && searchId.length <5) || searchId.length>5)){
$scope.alertMsg = "Employee ID should be 5 digits";
document.getElementById('empId').focus();
}else if(searchId != "" && !checkRoleEmpIdRange(searchId)){
$scope.alertMsg = 'Employee ID should be in between '+appConfig.empStartId+' - '+appConfig.empEndId;
document.getElementById('empId').focus();
}else if(searchId != "" && checkRoleExistence(searchId)){
$scope.alertMsg = 'Employee ID is already assigned a role';
document.getElementById('empId').focus();
}else{
$scope.alertMsg = "";
}
};
function checkRoleEmpIdRange(searchId){
return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId;
}
function checkRoleExistence(searchId){
for(var i in gridOptionsData){
if(gridOptionsData[i].employeeId == searchId){
return true;
}
}
return false;
}
$scope.validateEmailId = function(){
var emailId = $scope.empEmail;
if(emailId != "" && !validateEmail(emailId)){
$scope.alertMsg = "Please enter a valid nisum email id";
document.getElementById('empEmail').focus();
}else{
$scope.alertMsg = "";
}
}
function validateEmail(emailId){
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(re.test(emailId)){
if(emailId.indexOf("@nisum.com", emailId.length - "@nisum.com".length) !== -1){
return true;
}
}
return false;
}
$scope.validateFields = function(action){ $scope.validateFields = function(action){
if(action == "Assign"){ if(action == "Add"){
var employeeModel = $scope.employeeModel; var employeeModel = $scope.employeeModel;
var projectModel = $scope.projectModel; var projectModel = $scope.projectModel;
if(employeeModel == undefined){ if(employeeModel == undefined){
...@@ -378,13 +280,13 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -378,13 +280,13 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
document.getElementById('selectProject').focus(); document.getElementById('selectProject').focus();
} else { } else {
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "role": employeeModel.role, "shift": employeeModel.shift,"projectId":projectModel.projectId,"projectName":projectModel.projectName,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName()}; var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "role": employeeModel.role, "shift": employeeModel.shift,"projectId":projectModel.projectId,"projectName":projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"mobileNumber":employeeModel.mobileNumber};
addOrUpdateRole(record, $scope.templateTitle); addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
}else{ }else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":$scope.employeeId, "employeeName":$scope.employeeName, "emailId": $scope.emailId, "role": $scope.role, "shift": $scope.shift,"projectId":$scope.projectModel.projectId,"projectName":$scope.projectModel.projectName,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"designation":$scope.empDesignation,"billableStatus":$scope.empBillableStatus,"experience":$scope.experience,"mobileNumber":$scope.mobileNumber}; var record = {"employeeId":$scope.employeeId, "employeeName":$scope.employeeName, "emailId": $scope.emailId, "role": $scope.role, "shift": $scope.shift,"projectId":$scope.projectModel.projectId,"projectName":$scope.projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"designation":$scope.empDesignation,"billableStatus":$scope.empBillableStatus,"experience":$scope.experience,"mobileNumber":$scope.mobileNumber};
addOrUpdateRole(record, $scope.templateTitle); addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
...@@ -399,7 +301,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -399,7 +301,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
function updateGrid(action, record){ function updateGrid(action, record){
if($scope.alertMsg == ""){ if($scope.alertMsg == ""){
if($scope.result == "Success"){ if($scope.result == "Success"){
if(action == "Assign"){ if(action == "Add"){
gridOptionsData.push(record); gridOptionsData.push(record);
}else if(action == "Update"){ }else if(action == "Update"){
var existingRecord = getRowEntity($scope.empId); var existingRecord = getRowEntity($scope.empId);
...@@ -416,7 +318,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -416,7 +318,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
function addOrUpdateRole(record, action){ function addOrUpdateRole(record, action){
var urlRequest = ""; var urlRequest = "";
if(action == "Assign"){ if(action == "Add"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam"; urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam";
}else if(action == "Update"){ }else if(action == "Update"){
urlRequest = appConfig.appUri+ "projectTeam/updateTeammate"; urlRequest = appConfig.appUri+ "projectTeam/updateTeammate";
......
...@@ -134,6 +134,7 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial ...@@ -134,6 +134,7 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
} }
function showProgressDialog(){ function showProgressDialog(){
$('#home').addClass('md-scroll-mask');
$mdDialog.show({ $mdDialog.show({
templateUrl: 'templates/progressDialog.html', templateUrl: 'templates/progressDialog.html',
controller: ProgressController, controller: ProgressController,
...@@ -189,6 +190,7 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial ...@@ -189,6 +190,7 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
} }
$scope.sendEmail = function(ev){ $scope.sendEmail = function(ev){
$('#home').addClass('md-scroll-mask');
parentData.toEmail = []; parentData.toEmail = [];
parentData.ccEmail = []; parentData.ccEmail = [];
$mdDialog.show({ $mdDialog.show({
......
myApp.controller("resyncDataController",function($scope, myFactory, $mdDialog, appConfig, $http, $timeout){
// Date picker related code
var today = new Date();
$scope.maxDate = today;
$scope.searchDate = today;
$scope.setSearchDate = function(dateValue){
$scope.searchDate = dateValue;
};
$scope.resyncData = function(){
showProgressDialog("Performing data resync!!! Please wait...");
var searchDate = getFormattedDate($scope.searchDate);
$http({
method : "POST",
url : appConfig.appUri + "attendance/employeesDataSave/" + searchDate
}).then(function mySuccess(response) {
$mdDialog.hide();
if(response.data == true){
$timeout(function(){showAlert('Data resync successful.');},600);
}else{
$timeout(function(){showAlert('Data resync failed.');},600);
}
}, function myError(response) {
showAlert("Something went wrong while data resync!!!");
});
};
function getFormattedDate(date){
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
return year + '-' + (month < 10 ? "0" + month : month) + '-'
+ (day < 10 ? "0" + day : day);
}
function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent(
angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true).textContent(message).ariaLabel(
'Alert Dialog').ok('Ok'));
}
function showProgressDialog(msg){
$mdDialog.show({
templateUrl: 'templates/progressDialog.html',
controller: ProgressController,
parent: angular.element(document.body),
clickOutsideToClose:false,
locals: {dataToPass:msg}
});
}
function ProgressController($scope, dataToPass) {
$scope.progressText = dataToPass;
}
});
\ No newline at end of file
...@@ -131,6 +131,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -131,6 +131,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
} }
$scope.addProject = function(action, userData){ $scope.addProject = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -147,6 +148,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -147,6 +148,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
}); });
}; };
$scope.viewTeamDetails = function(action, userData){ $scope.viewTeamDetails = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -163,6 +165,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -163,6 +165,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
}); });
}; };
$scope.getUnAssignedEmployees = function(action, userData){ $scope.getUnAssignedEmployees = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -179,6 +182,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -179,6 +182,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
}); });
}; };
$scope.getAllocatedEmployees = function(action, userData){ $scope.getAllocatedEmployees = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action; userData.action = action;
$mdDialog.show({ $mdDialog.show({
controller: AddProjectController, controller: AddProjectController,
...@@ -199,7 +203,9 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -199,7 +203,9 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
}; };
$scope.deleteRole = function(row){ $scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm() var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure you want to delete this project?') .textContent('Are you sure you want to delete this project?')
.ok('Ok') .ok('Ok')
.cancel('Cancel'); .cancel('Cancel');
...@@ -242,7 +248,8 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -242,7 +248,8 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
$scope.isDisabled = false; $scope.isDisabled = false;
$scope.result = ""; $scope.result = "";
$scope.managerDetails = managers; $scope.managerDetails = managers;
$scope.prjctStses=["Active","On Hold","Proposed","Completed"]; $scope.prjctStses=["Active","Completed","On Hold","Proposed"];
if(dataToPass.action == "Assign"){ if(dataToPass.action == "Assign"){
$scope.projectId = ""; $scope.projectId = "";
$scope.projectName = ""; $scope.projectName = "";
......
...@@ -30,7 +30,9 @@ myApp.factory('myFactory', function() { ...@@ -30,7 +30,9 @@ myApp.factory('myFactory', function() {
var templateUrl = ""; var templateUrl = "";
var profileUrl = ""; var profileUrl = "";
var designations=""; var designations="";
var technologies="";
var shifts=""; var shifts="";
var accounts="";
function setEmpId(id) { function setEmpId(id) {
empId = id; empId = id;
} }
...@@ -74,6 +76,21 @@ myApp.factory('myFactory', function() { ...@@ -74,6 +76,21 @@ myApp.factory('myFactory', function() {
function getDesignations() { function getDesignations() {
return designations; return designations;
} }
function setAccounts(accounts1) {
accounts = accounts1;
}
function getAccounts() {
return accounts;
}
function setTechnologies(technologies1) {
technologies = technologies1;
}
function getTechnologies() {
return technologies;
}
function setShifts(shifts1) { function setShifts(shifts1) {
shifts = shifts1; shifts = shifts1;
} }
...@@ -110,6 +127,10 @@ myApp.factory('myFactory', function() { ...@@ -110,6 +127,10 @@ myApp.factory('myFactory', function() {
getMenuItems : getMenuItems, getMenuItems : getMenuItems,
setDesignations : setDesignations, setDesignations : setDesignations,
getDesignations : getDesignations, getDesignations : getDesignations,
setAccounts : setAccounts,
getAccounts : getAccounts,
setTechnologies : setTechnologies,
getTechnologies : getTechnologies,
setShifts : setShifts, setShifts : setShifts,
getShifts : getShifts, getShifts : getShifts,
setTemplateUrl : setTemplateUrl, setTemplateUrl : setTemplateUrl,
......
app.factory('exportUiGridService', exportUiGridService);
exportUiGridService.inject = ['uiGridExporterService'];
function exportUiGridService(uiGridExporterService) {
var service = {
exportToExcel: exportToExcel
};
return service;
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function exportToExcel(sheetName, gridApi, rowTypes, colTypes) {
var columns = gridApi.grid.options.showHeader ? uiGridExporterService.getColumnHeaders(gridApi.grid, colTypes) : [];
var data = uiGridExporterService.getData(gridApi.grid, rowTypes, colTypes);
var fileName = gridApi.grid.options.exporterExcelFilename ? gridApi.grid.options.exporterExcelFilename : 'dokuman';
fileName += '.xlsx';
var wb = new Workbook(),
ws = sheetFromArrayUiGrid(data, columns);
wb.SheetNames.push(sheetName);
wb.Sheets[sheetName] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: 'application/octet-stream'
}), fileName);
}
function sheetFromArrayUiGrid(data, columns) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
var C = 0;
columns.forEach(function (c) {
var v = c.displayName || c.value || columns[i].name;
addCell(range, v, 0, C, ws);
C++;
}, this);
var R = 1;
data.forEach(function (ds) {
C = 0;
ds.forEach(function (d) {
var v = d.value;
addCell(range, v, R, C, ws);
C++;
});
R++;
}, this);
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
/**
*
* @param {*} data
* @param {*} columns
*/
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
function addCell(range, value, row, col, ws) {
if (range.s.r > row) range.s.r = row;
if (range.s.c > col) range.s.c = col;
if (range.e.r < row) range.e.r = row;
if (range.e.c < col) range.e.c = col;
var cell = {
v: value
};
if (cell.v == null) cell.v = '-';
var cell_ref = XLSX.utils.encode_cell({
c: col,
r: row
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
\ No newline at end of file
<md-dialog aria-label="Role Template" style="width:400px;height:800px;"> <md-dialog aria-label="Role Template" style="width:400px;height:800px;" ng-init="getProjects()">
<form ng-cloak name="myForm"> <form ng-cloak name="myForm">
<md-toolbar> <md-toolbar>
<div class="md-toolbar-tools" style="background: cadetblue;"> <div class="md-toolbar-tools" style="background: cadetblue;">
......
...@@ -32,11 +32,6 @@ ...@@ -32,11 +32,6 @@
</div> </div>
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12"> <div class="row col-lg-12">
<div class="col-xs-2">
<p>
<b>Total Employees:</b> {{totalEmployees}}
</p>
</div>
<div class="col-xs-2"> <div class="col-xs-2">
<p> <p>
<b>Total Present:</b> {{totalPresent}} <b>Total Present:</b> {{totalPresent}}
...@@ -63,7 +58,7 @@ ...@@ -63,7 +58,7 @@
</div> </div>
</div> </div>
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-selection ui-grid-exporter <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-selection ui-grid-exporter
class="myGrid"> class="myGrid" style="width:99%;height:330px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<b>Average Login hours:&nbsp;&nbsp;</b> {{avgLoginHrs}} <b>Average Login hours:&nbsp;&nbsp;</b> {{avgLoginHrs}}
</p> </p>
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:370px;">
<div class="watermark" ng-show="!gridOptions.data.length">Search <div class="watermark" ng-show="!gridOptions.data.length">Search
by Employee ID</div> by Employee ID</div>
</div> </div>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<meta name="author" content=""></meta> <meta name="author" content=""></meta>
<base href="/myTime/"></base> <base href="/myTime/"></base>
<title>My Time</title> <title>My Time</title>
<link rel="icon" type="image/png" href="images/favicon.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-cookies.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-cookies.js"></script>
...@@ -28,7 +29,6 @@ ...@@ -28,7 +29,6 @@
<link rel="stylesheet" href="css/default-styles.css"></link> <link rel="stylesheet" href="css/default-styles.css"></link>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="http://ui-grid.info/release/ui-grid.js"></script> <script src="http://ui-grid.info/release/ui-grid.js"></script>
<!-- <script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script> -->
<script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script> <script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script>
<script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script> <script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.9.12/xlsx.full.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.9.12/xlsx.full.min.js"></script>
...@@ -53,7 +53,8 @@ ...@@ -53,7 +53,8 @@
<script src="controllers/AttendanceReportController.js"></script> <script src="controllers/AttendanceReportController.js"></script>
<script src="controllers/ShiftDetailsController.js"></script> <script src="controllers/ShiftDetailsController.js"></script>
<script src="controllers/ViewProjectController.js"></script> <script src="controllers/ViewProjectController.js"></script>
<script src="controllers/MyProfileController.js"></script>
<script src="controllers/ResyncDataController.js"></script>
</head> </head>
<body> <body>
<ng-include src="'templates/login.html'" id="home"></ng-include> <ng-include src="'templates/login.html'" id="home"></ng-include>
......
...@@ -18,34 +18,16 @@ ...@@ -18,34 +18,16 @@
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12"> <div class="row col-lg-12">
<div class="col-lg-1" style="float: left;padding-left:20px;"> <div class="col-lg-1" style="float: left;padding-left:20px;">
<!-- <div class="input-group" style="box-shadow: 1px 1px 1px 1px rgba(0,0,0,.26);">
<input type="text" ng-model="empSearchId" id="empSearchId"
ng-blur="validateEmpId()" class="form-control"
placeholder="Employee ID" style="width:120px;border-radius:0px;">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button"
ng-click="getEmployeeRole()" style="border: 1px solid #ccc;border-radius:0px;">
<i class="fa fa-search fa-2x" style="font-size: 1.3em;"
aria-hidden="true"></i>
</button>
</span>
</div> -->
</div> </div>
<div class="col-lg-1" <div class="col-lg-1"
style="cursor: pointer; float: right; right: 75px;"> style="cursor: pointer; float: right; right: 75px;">
<!-- <md-button class="md-raised md-primary"
style="width:142px;background: cadetblue;"
ng-click="assignRole('Assign', parentData)"> <i
class="fa fa-plus-circle fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Assign
Employee</md-button> -->
</div> </div>
</div> </div>
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="margin-left: 0px;"> <div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
<md-dialog aria-label="Role Template" style="width:520px;height:440px;"> <md-dialog aria-label="Role Template" style="width:520px;height:450px;">
<form ng-cloak name="myForm"> <form ng-cloak name="myForm">
<md-toolbar> <md-toolbar>
<div class="md-toolbar-tools" <div class="md-toolbar-tools"
...@@ -15,9 +15,12 @@ ...@@ -15,9 +15,12 @@
<div class="md-dialog-content"> <div class="md-dialog-content">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" id="projectId" name="projectId" <input type="text" class="form-control" id="projectId" name="projectId"
ng-model="projectId" placeholder="Project Id" ng-blur="" ng-disabled="isDisabled"/> <br> ng-model="projectId" placeholder="Project Id Auto Generated" ng-blur="" ng-disabled="true"/> <br>
<input type="text" class="form-control" id="projectName" name="projectName" <input type="text" class="form-control" id="projectName" name="projectName"
ng-model="projectName" placeholder="Project Name" /><br> ng-model="projectName" placeholder="Project Name" /><br>
<md-select ng-model="account" md-selected-text="getAccountText()" id="account">
<md-optgroup label="account"> <md-option ng-value="account"
ng-repeat="account in accounts">{{account}}</md-option> </md-optgroup> </md-select>
<md-select ng-model="managerModel" md-selected-text="getManagers()" > <md-select ng-model="managerModel" md-selected-text="getManagers()" >
<md-optgroup label="managers"> <md-option ng-value="manager" <md-optgroup label="managers"> <md-option ng-value="manager"
ng-repeat="manager in managerDetails">{{manager.employeeName}}</md-option> </md-optgroup> </md-select> ng-repeat="manager in managerDetails">{{manager.employeeName}}</md-option> </md-optgroup> </md-select>
......
<md-dialog aria-label="Role Template" style="width:520px;height:440px;"> <md-dialog aria-label="Role Template" style="width:520px;height:390px;">
<form ng-cloak name="myForm"> <form ng-cloak name="myForm">
<md-toolbar> <md-toolbar>
<div class="md-toolbar-tools" <div class="md-toolbar-tools"
......
<md-dialog aria-label="Role Template" style="width:520px;height:440px;"> <md-dialog aria-label="Role Template" style="width:520px;height:440px;" ng-init="getProjects()">
<form ng-cloak name="myForm"> <form ng-cloak name="myForm">
<md-toolbar> <md-toolbar>
<div class="md-toolbar-tools" <div class="md-toolbar-tools"
style="background: cadetblue;"> style="background: cadetblue;">
<h2>{{templateTitle}} Employee </h2> <h2>{{templateTitle}} Team Mate </h2>
<span flex></span> <span flex></span>
<md-button class="md-icon-button" ng-click="cancel()"> <i <md-button class="md-icon-button" ng-click="cancel()"> <i
class="fa fa-times fa-2x" class="fa fa-times fa-2x"
......
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer" ng-controller="profileController"
ng-init="getProfileData()">
<div class="container-fluid mainDivHeaderClass">
<div class="row">
<div class="col-lg-12">
<p align="center" class="col-xs-11"
style="vertical-align: middle; font-weight: bold; font-size: 30px;">My
Profile</p>
<p align="right" class="col-xs-1"
style="vertical-align: middle; font-weight: bold; font-size: 1.5em; margin-top: 8px; cursor: pointer;">
<i class="fa fa-refresh" aria-hidden="true"
ng-click="refreshPage()"></i>
</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<br />
<div class="row col-lg-12" style="padding-top:5%">
<div class="container col-lg-8" style="float: left; padding-left: 100px;">
<div class="row col-lg-12">
<div class="col-xs-4" style="text-align: left;">
<p>
<b>Employee ID:</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.employeeId}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Employee Name</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.employeeName}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Email ID</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.emailId}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Role</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.role}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Mobile Number:</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.mobileNumber}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Alt Mobile Number</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.alternateMobileNumber}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Personal EmailId</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.personalEmailId}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Shift</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.shift}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Primary Skill</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.baseTechnology}}
</p>
</div>
</div>
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Technologies Known</b>
</p>
</div>
<div class="col-xs-6">
<p>
<b>:</b> {{profile.technologyKnown}}
</p>
</div>
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
</div>
<div class="col-lg-2"
style="cursor: pointer; float: left; ">
<md-button class="md-raised md-primary"
style="width:142px;background: cadetblue;"
ng-click="updateProfile()"> <i
class="fa fa-pencil-square-o fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Update
Profile</md-button>
</div>
</div>
</div>
\ No newline at end of file
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;" <div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer" ng-controller="projectTeamController" id="popupContainer" ng-controller="projectTeamController"
ng-init="getUserRoles();getEmployeesToTeam();getProjects();"> ng-init="getUserRoles();getEmployeesToTeam();">
<div class="container-fluid mainDivHeaderClass"> <div class="container-fluid mainDivHeaderClass">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
...@@ -18,34 +18,21 @@ ...@@ -18,34 +18,21 @@
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12"> <div class="row col-lg-12">
<div class="col-lg-1" style="float: left;padding-left:20px;"> <div class="col-lg-1" style="float: left;padding-left:20px;">
<!-- <div class="input-group" style="box-shadow: 1px 1px 1px 1px rgba(0,0,0,.26);">
<input type="text" ng-model="empSearchId" id="empSearchId"
ng-blur="validateEmpId()" class="form-control"
placeholder="Employee ID" style="width:120px;border-radius:0px;">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button"
ng-click="getEmployeeRole()" style="border: 1px solid #ccc;border-radius:0px;">
<i class="fa fa-search fa-2x" style="font-size: 1.3em;"
aria-hidden="true"></i>
</button>
</span>
</div> -->
</div> </div>
<div class="col-lg-1" <div class="col-lg-1"
style="cursor: pointer; float: right; right: 75px;"> style="cursor: pointer; float: right; right: 75px;">
<md-button class="md-raised md-primary" <md-button class="md-raised md-primary"
style="width:142px;background: cadetblue;" style="width:142px;background: cadetblue;"
ng-click="assignRole('Assign', parentData)"> <i ng-click="assignRole('Add', parentData)"> <i
class="fa fa-plus-circle fa-2x" class="fa fa-plus-circle fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Assign style="margin-top: 5px; font-size: 1.5em; float: left"></i> Add Team Mate</md-button>
Employee</md-button>
</div> </div>
</div> </div>
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="margin-left: 0px;"> <div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:380px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<div class="row col-lg-12" style="margin-left: 0px;"> <div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
<md-dialog aria-label="Registration Template" style="width:440px;height:380px;"> <md-dialog aria-label="Registration Template" style="width:440px;height:500px;">
<form ng-cloak name="myForm"> <form ng-cloak name="myForm">
<md-toolbar style="height:40px"> <md-toolbar style="height:40px">
<div class="md-toolbar-tools" <div class="md-toolbar-tools"
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
<input type="text" class="form-control" id="empName" name="empName" <input type="text" class="form-control" id="empName" name="empName"
ng-model="empName" placeholder="Employee Name" /><br> ng-model="empName" placeholder="Employee Name" /><br>
<input type="text" class="form-control" id="empEmail" name="empEmail" <input type="text" class="form-control" id="empEmail" name="empEmail"
ng-model="empEmail" placeholder="Email ID" ng-disabled="true"/> ng-model="empEmail" placeholder="Email ID" ng-disabled="true"/><br>
<input type="text" class="form-control" id="mobileNumber" name="mobileNumber"
ng-model="mobileNumber" placeholder="Mobile No" />
<md-select ng-model="empShift" md-selected-text="getSelectedShift()" id="empShift"> <md-select ng-model="empShift" md-selected-text="getSelectedShift()" id="empShift">
<md-optgroup label="shifts"> <md-option ng-value="shift" <md-optgroup label="skills"> <md-option ng-value="shift"
ng-repeat="shift in shifts">{{shift}}</md-option> </md-optgroup> </md-select> ng-repeat="shift in shifts">{{shift}}</md-option> </md-optgroup> </md-select>
<div role="alert"> <div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span> <span class="error" style="color: red;">{{alertMsg}}</span>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<b>Average Login hours:&nbsp;&nbsp;</b> {{avgLoginHrs}} <b>Average Login hours:&nbsp;&nbsp;</b> {{avgLoginHrs}}
</p> </p>
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:370px;">
<div class="watermark" ng-show="!gridOptions.data.length">Search <div class="watermark" ng-show="!gridOptions.data.length">Search
by Employee ID</div> by Employee ID</div>
</div> </div>
......
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px; text-align:center;"
id="popupContainer" ng-controller="resyncDataController">
<div class="container-fluid mainDivHeaderClass">
<div class="row">
<div class="col-lg-12">
<p align="center" class="col-xs-11"
style="vertical-align: middle; font-weight: bold; font-size: 30px;">Resync Data</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<br />
<div class="container" style="top:25%;left:35%;position:fixed;">
<div class="row col-lg-12">
<div class="col-xs-4">
<p>
<b>Select Date:</b>
<md-datepicker ng-model="searchDate" md-placeholder="Enter date"
md-max-date="maxDate"
onkeydown="return false" ng-change="setSearchDate(searchDate)"></md-datepicker>
</p>
</div>
<div class="col-xs-2" style="cursor: pointer;" align="right">
<md-button class="md-raised md-primary"
style="width:100px;background: cadetblue;" ng-click="resyncData()">
<i class="fa fa-retweet fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Resync</md-button>
</div>
</div>
</div>
</div>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<div class="row col-lg-12" style="margin-left: 0px;"> <div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<div class="row col-lg-12" style="margin-left: 0px;"> <div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-selection ui-grid-exporter <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-selection ui-grid-exporter
class="myGrid"> class="myGrid" style="width:99%;height:350px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
<md-dialog aria-label="Role Template" style="width:400px;height:550px;">
<form ng-cloak name="myForm">
<md-toolbar>
<div class="md-toolbar-tools"
style="background: cadetblue;">
<h2>Update Profile </h2>
<span flex></span>
<md-button class="md-icon-button" ng-click="cancel()"> <i
class="fa fa-times fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> </md-button>
</div>
</md-toolbar>
<md-dialog-content>
<div class="md-dialog-content">
<div class="form-group">
<input type="text" class="form-control" id="mobileNumber" name="mobileNumber"
ng-model="mobileNumber" placeholder="Mobile Number" alt="Mobile Number"/> <br>
<input type="text" class="form-control" id="alternateMobileNumber" name="alternateMobileNumber"
ng-model="alternateMobileNumber" placeholder="Alternate Mobile Number" /> <br>
<input type="text" class="form-control" id="personalEmailId" name="personalEmailId"
ng-model="personalEmailId" placeholder="Personal EmailId" /> <br>
<md-select ng-model="baseTechnology" md-selected-text="getSelectedTech()" id="baseTechnology" >
<md-optgroup label="skills"> <md-option ng-value="tech"
ng-repeat="tech in technologies">{{tech}}</md-option> </md-optgroup> </md-select>
<textarea rows="4" cols="10" class="form-control" id="technologyKnown" name="technologyKnown"
ng-model="technologyKnown" placeholder="Technologies Known" /> <br>
<div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span>
</div>
</div>
</md-dialog-content>
<md-dialog-actions layout="row"> <md-button
class="md-raised" data-ng-click="validateFields()" style="width:120px;background: cadetblue;color:white;">
Update </md-button> <md-button class="md-raised" ng-click="cancel()" style="width:120px;background: cadetblue;color:white;">
Cancel </md-button> </md-dialog-actions>
</form>
</md-dialog>
...@@ -27,18 +27,13 @@ ...@@ -27,18 +27,13 @@
<div class="col-lg-2" <div class="col-lg-2"
style="cursor: pointer; float: right; right: 75px;"> style="cursor: pointer; float: right; right: 75px;">
<!-- <md-button class="md-raised md-primary"
style="width:182px;background: cadetblue;"
ng-click="getAllocatedEmployees('allocated', parentData)"> <i
class="fa fa-product-hunt fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i>Project Allocations</md-button> -->
</div> </div>
</div> </div>
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="margin-left: 0px;"> <div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid"> class="myGrid" style="width:99%;height:370px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment