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;
import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.service.AttendanceService;
import com.nisum.mytime.service.UserService;
@RestController
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private UserService userService;
@Autowired
private AttendanceService attendanceService;
@RequestMapping(value = "employeeLoginsBasedOnDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmpLoginData>> employeeLoginsBasedOnDate(@RequestParam("empId") long id,
@RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate) throws MyTimeException {
List<EmpLoginData> message = userService.employeeLoginsBasedOnDate(id, fromDate, toDate);
return new ResponseEntity<>(message, HttpStatus.OK);
}
@RequestMapping(value = "generatePdfReport/{id}/{fromDate}/{toDate}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> generatePdfReport(@PathVariable("id") long id,
@PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate) throws MyTimeException {
String result = userService.generatePdfReport(id, fromDate, toDate);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "attendanciesReport/{reportDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<AttendenceData>> attendanciesReport(@PathVariable("reportDate") String reportDate)
throws MyTimeException, SQLException {
List<AttendenceData> lisOfAttendenceData = attendanceService.getAttendanciesReport(reportDate);
return new ResponseEntity<>(lisOfAttendenceData, HttpStatus.OK);
}
@RequestMapping(value = "employeesDataSave/{searchDate}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> employeesDataSave(@PathVariable("searchDate") String searchDate)
throws MyTimeException {
Boolean result = userService.fetchEmployeesData(searchDate);
return new ResponseEntity<>(result, HttpStatus.OK);
}
package com.nisum.mytime.controller;
import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.service.AttendanceService;
import com.nisum.mytime.service.UserService;
@RestController
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private UserService userService;
@Autowired
private AttendanceService attendanceService;
@RequestMapping(value = "employeeLoginsBasedOnDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmpLoginData>> employeeLoginsBasedOnDate(@RequestParam("empId") long id,
@RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate) throws MyTimeException {
List<EmpLoginData> message = userService.employeeLoginsBasedOnDate(id, fromDate, toDate);
return new ResponseEntity<>(message, HttpStatus.OK);
}
@RequestMapping(value = "generatePdfReport/{id}/{fromDate}/{toDate}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> generatePdfReport(@PathVariable("id") long id,
@PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate) throws MyTimeException {
String result = userService.generatePdfReport(id, fromDate, toDate);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "attendanciesReport/{reportDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<AttendenceData>> attendanciesReport(@PathVariable("reportDate") String reportDate)
throws MyTimeException, SQLException {
List<AttendenceData> lisOfAttendenceData = attendanceService.getAttendanciesReport(reportDate);
return new ResponseEntity<>(lisOfAttendenceData, HttpStatus.OK);
}
@RequestMapping(value = "employeesDataSave/{searchDate}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> employeesDataSave(@PathVariable("searchDate") String searchDate)
throws MyTimeException {
Boolean result = userService.fetchEmployeesData(searchDate);
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;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.service.ProjectService;
import com.nisum.mytime.service.UserService;
......@@ -26,7 +28,8 @@ public class ProjectController {
private UserService userService;
@Autowired
private ProjectService projectService;
@Autowired
private AccountRepo accountRepo;
@RequestMapping(value = "/employee", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> getEmployeeRole(@RequestParam("emailId") String emailId)
throws MyTimeException {
......@@ -35,8 +38,16 @@ public class ProjectController {
}
@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 {
Project project = projectService.addProject(employeeRoles);
public ResponseEntity<Project> addProject(@RequestBody Project projectAdded) throws MyTimeException {
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);
}
......
......@@ -27,6 +27,7 @@ public class ProjectTeamController {
@Autowired
private UserService userService;
@Autowired
private ProjectService projectService;
......@@ -121,18 +122,21 @@ public class ProjectTeamController {
List<EmployeeRoles> employeesRoles = projectService.getUnAssignedEmployees();
return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
}
@RequestMapping(value = "/getShiftDetails", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> getShiftDetails(@RequestParam("shift") String shift)
throws MyTimeException {
List<ProjectTeamMate> employeesRoles = projectService.getShiftDetails(shift);
return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
}
@RequestMapping(value = "/getProjectAllocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> getProjectAllocations()
throws MyTimeException {
List<ProjectTeamMate> employeesRoles = projectService.getAllProjectDetails();
return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
}
@RequestMapping(value = "/getProjectDetails", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> getProjectDetails(@RequestParam("projectId") String projectId)
throws MyTimeException {
......
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;
import java.io.Serializable;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
......@@ -21,7 +20,6 @@ import lombok.ToString;
@Document(collection = "Designations")
public class Designation implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......
......@@ -32,7 +32,13 @@ public class EmployeeRoles implements Serializable {
private String emailId;
private String role;
private String shift;
private String baseTechnology;
private String technologyKnown;
private String mobileNumber;
private String alternateMobileNumber;
private String personalEmailId;
private Date createdOn;
private Date lastModifiedOn;
}
......@@ -30,6 +30,7 @@ public class Project implements Serializable {
private String projectName;
private String managerId;
private String managerName;
private String account;
private String status;
private List<String> employeeIds;
......
......@@ -31,6 +31,7 @@ public class ProjectTeamMate implements Serializable {
private String shift;
private String projectId;
private String projectName;
private String account;
private String managerId;
private String managerName;
private String experience;
......
package com.nisum.mytime.model;
import java.io.Serializable;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
......@@ -21,7 +20,6 @@ import lombok.ToString;
@Document(collection = "Shifts")
public class Shift implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......@@ -30,5 +28,4 @@ public class Shift implements Serializable {
private String shiftName;
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;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Designation;
public interface DesignationRepo extends MongoRepository<Designation, String> {
}
\ No newline at end of file
package com.nisum.mytime.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
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;
import java.sql.SQLException;
import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
public interface AttendanceService {
List<AttendenceData> getAttendanciesReport(String reportDate) throws MyTimeException, SQLException;
}
package com.nisum.mytime.service;
import java.sql.SQLException;
import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
public interface AttendanceService {
List<AttendenceData> getAttendanciesReport(String reportDate) throws MyTimeException, SQLException;
Boolean copyRemoteMdbFileToLocal() throws MyTimeException;
}
......@@ -39,7 +39,10 @@ public interface ProjectService {
List<ProjectTeamMate> getMyTeamDetails(String empId);
List<EmployeeRoles> getUnAssignedEmployees();
public List<ProjectTeamMate> getShiftDetails(String shift);
public List<ProjectTeamMate> getAllProjectDetails();
public List<ProjectTeamMate> getProjectDetails(String projectId);
List<ProjectTeamMate> getShiftDetails(String shift);
List<ProjectTeamMate> getAllProjectDetails();
List<ProjectTeamMate> getProjectDetails(String projectId);
}
......@@ -78,13 +78,26 @@ public class ProjectServiceImpl implements ProjectService {
public Project updateProject(Project project) {
Query query = new Query(Criteria.where("projectId").is(project.getProjectId()));
Update update = new Update();
update.set("projectName", project.getProjectName());
update.set("managerId", project.getManagerId());
update.set("managerName", project.getManagerName());
update.set("account", project.getAccount());
update.set("status", project.getStatus());
FindAndModifyOptions options = new FindAndModifyOptions();
options.returnNew(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
......@@ -115,7 +128,15 @@ public class ProjectServiceImpl implements ProjectService {
existingTeammate.setBillableStatus(projectTeamMate.getBillableStatus());
existingTeammate.setMobileNumber(projectTeamMate.getMobileNumber());
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
......
package com.nisum.mytime.service;
import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Shift;
public interface UserService {
Boolean fetchEmployeesData(String perticularDate) throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
List<EmployeeRoles> getEmployeeRoles() throws MyTimeException;
EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
EmployeeRoles getEmployeesRole(String emailId);
void deleteEmployee(String empId);
EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles);
EmployeeRoles getEmployeesRoleData(String empId);
List<Shift> getAllShifts() throws MyTimeException;
List<Designation> getAllDesignations() throws MyTimeException;
}
package com.nisum.mytime.service;
import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Shift;
import com.nisum.mytime.model.Skill;
public interface UserService {
Boolean fetchEmployeesData(String perticularDate) throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
List<EmployeeRoles> getEmployeeRoles() throws MyTimeException;
EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
EmployeeRoles getEmployeesRole(String emailId);
void deleteEmployee(String empId);
EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles);
EmployeeRoles getEmployeesRoleData(String empId);
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;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.FindAndModifyOptions;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Shift;
import com.nisum.mytime.repository.DesignationRepo;
import com.nisum.mytime.repository.EmployeeRolesRepo;
import com.nisum.mytime.repository.ShiftRepo;
import com.nisum.mytime.utils.PdfReportGenerator;
@Service("userService")
public class UserServiceImpl implements UserService {
@Autowired
private EmployeeRolesRepo employeeRolesRepo;
@Autowired
private ShiftRepo shiftRepo;
@Autowired
private DesignationRepo designationRepo;
@Autowired
private EmployeeDataService employeeDataBaseService;
@Autowired
private PdfReportGenerator pdfReportGenerator;
@Autowired
private MongoTemplate mongoTemplate;
@Override
public Boolean fetchEmployeesData(String perticularDate) throws MyTimeException {
return employeeDataBaseService.fetchEmployeesData(perticularDate);
}
@Override
public List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate)
throws MyTimeException {
return employeeDataBaseService.fetchEmployeeLoginsBasedOnDates(id, fromDate, toDate);
}
@Override
public String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException {
return pdfReportGenerator.generateEmployeeReport(id, fromDate, toDate);
}
@Override
public List<EmployeeRoles> getEmployeeRoles() throws MyTimeException {
return employeeRolesRepo.findAll();
}
@Override
public EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException {
employeeRoles.setCreatedOn(new Date());
return employeeRolesRepo.save(employeeRoles);
}
@Override
public EmployeeRoles getEmployeesRole(String emailId) {
return employeeRolesRepo.findByEmailId(emailId);
}
@Override
public void deleteEmployee(String employeeId) {
EmployeeRoles role = employeeRolesRepo.findByEmployeeId(employeeId);
employeeRolesRepo.delete(role);
}
@Override
public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles) {
Query query = new Query(Criteria.where("employeeId").is(employeeRoles.getEmployeeId()));
Update update = new Update();
update.set("employeeName", employeeRoles.getEmployeeName());
update.set("emailId", employeeRoles.getEmailId());
update.set("role", employeeRoles.getRole());
update.set("shift", employeeRoles.getShift());
update.set("lastModifiedOn", new Date());
FindAndModifyOptions options = new FindAndModifyOptions();
options.returnNew(true);
options.upsert(true);
return mongoTemplate.findAndModify(query, update, options, EmployeeRoles.class);
}
@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();
}
}
package com.nisum.mytime.service;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.FindAndModifyOptions;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.model.Shift;
import com.nisum.mytime.model.Skill;
import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.repository.DesignationRepo;
import com.nisum.mytime.repository.EmployeeRolesRepo;
import com.nisum.mytime.repository.ProjectTeamMatesRepo;
import com.nisum.mytime.repository.ShiftRepo;
import com.nisum.mytime.repository.TechnologyRepo;
import com.nisum.mytime.utils.PdfReportGenerator;
@Service("userService")
public class UserServiceImpl implements UserService {
@Autowired
private EmployeeRolesRepo employeeRolesRepo;
@Autowired
private ProjectTeamMatesRepo projectTeamMatesRepo;
@Autowired
private ShiftRepo shiftRepo;
@Autowired
private DesignationRepo designationRepo;
@Autowired
private AccountRepo accountRepo;
@Autowired
private TechnologyRepo technologyRepo;
@Autowired
private EmployeeDataService employeeDataBaseService;
@Autowired
private PdfReportGenerator pdfReportGenerator;
@Autowired
private MongoTemplate mongoTemplate;
@Override
public Boolean fetchEmployeesData(String perticularDate) throws MyTimeException {
return employeeDataBaseService.fetchEmployeesData(perticularDate);
}
@Override
public List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate)
throws MyTimeException {
return employeeDataBaseService.fetchEmployeeLoginsBasedOnDates(id, fromDate, toDate);
}
@Override
public String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException {
return pdfReportGenerator.generateEmployeeReport(id, fromDate, toDate);
}
@Override
public List<EmployeeRoles> getEmployeeRoles() throws MyTimeException {
return employeeRolesRepo.findAll();
}
@Override
public EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException {
employeeRoles.setCreatedOn(new Date());
return employeeRolesRepo.save(employeeRoles);
}
@Override
public EmployeeRoles getEmployeesRole(String emailId) {
return employeeRolesRepo.findByEmailId(emailId);
}
@Override
public void deleteEmployee(String employeeId) {
EmployeeRoles role = employeeRolesRepo.findByEmployeeId(employeeId);
employeeRolesRepo.delete(role);
}
@Override
public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles) {
Query query = new Query(Criteria.where("employeeId").is(employeeRoles.getEmployeeId()));
Update update = new Update();
update.set("employeeName", employeeRoles.getEmployeeName());
update.set("emailId", employeeRoles.getEmailId());
update.set("role", employeeRoles.getRole());
update.set("shift", employeeRoles.getShift());
update.set("lastModifiedOn", new Date());
FindAndModifyOptions options = new FindAndModifyOptions();
options.returnNew(true);
options.upsert(true);
return mongoTemplate.findAndModify(query, update, options, EmployeeRoles.class);
}
@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
#Local configuration purpose
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
spring.mail.host=smtp.gmail.com
......@@ -33,3 +33,6 @@ spring.mail.password=nisum@123
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=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, $
"employeeName": "",
"emailId":"",
"role": "",
"shift": "",
"action":""
};
......@@ -23,7 +22,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false},
{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}
]
};
......@@ -34,7 +32,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData.employeeName = row.entity.employeeName;
$scope.parentData.emailId = row.entity.emailId;
$scope.parentData.role = row.entity.role;
$scope.parentData.shift = row.entity.shift;
if(action == "Update")
$scope.assignRole(action, $scope.parentData);
else if(action == "Delete")
......@@ -117,6 +114,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}
$scope.assignRole = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddRoleController,
......@@ -138,7 +136,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
};
$scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure want to delete the role?')
.ok('Ok')
.cancel('Cancel');
......@@ -183,19 +183,16 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.empId = "";
$scope.empName = "";
$scope.empRole;
$scope.empShift;
$scope.empEmail = "";
$scope.isDisabled = false;
}else if(dataToPass.action == "Update"){
$scope.empId = dataToPass.employeeId;
$scope.empName = dataToPass.employeeName;
$scope.empRole = dataToPass.role;
$scope.empShift = dataToPass.shift;
$scope.empEmail = dataToPass.emailId;
$scope.isDisabled = true;
}
$scope.roles = ["HR","Manager","Employee","HR Manager","Director","Lead"];
$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.roles = ["Director","Employee","HR","HR Manager","Lead","Manager"];
$scope.getSelectedRole = function(){
if ($scope.empRole !== undefined) {
return $scope.empRole;
......@@ -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(){
var searchId = $scope.empId;
if(searchId != "" && isNaN(searchId)){
......@@ -268,7 +257,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var searchId = $scope.empId;
var empName = $scope.empName;
var empRole = $scope.empRole;
var empShift = $scope.empShift;
var empEmail = $scope.empEmail;
if(searchId == ""){
$scope.alertMsg = "Employee ID is mandatory";
......@@ -288,12 +276,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}else if(empRole == undefined){
$scope.alertMsg = "Please select a role";
document.getElementById('empRole').focus();
}else if(empShift == undefined){
$scope.alertMsg = "Please select a shift";
document.getElementById('empShift').focus();
}else{
$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);
$timeout(function(){updateGrid($scope.templateTitle, record)},500);
}
......
......@@ -62,6 +62,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.gridOptions.data = [];
$scope.getEmployeePresent = function(type){
$mdDialog.hide();
if(type == "onload"){
showProgressDialog("Fetching data please wait...");
}
......@@ -83,7 +84,6 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.gridOptions.data = response.data;
$scope.totalPresent = response.data[0].totalPresent;
$scope.totalAbsent = response.data[0].totalAbsent;
$scope.totalEmployees = response.data[0].totalPresent + response.data[0].totalAbsent;
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
......@@ -121,6 +121,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
}
function showProgressDialog(msg){
$('#home').addClass('md-scroll-mask');
$mdDialog.show({
templateUrl: 'templates/progressDialog.html',
controller: ProgressController,
......
......@@ -13,6 +13,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
getAllUserRoles();
getAllShifts();
getAllDesignations();
getAllTechnologies();
getAllAccounts();
}
function onFailure(error){
......@@ -64,7 +66,6 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}).then(function mySuccess(response) {
myFactory.setShifts(response.data);
}, function myError(response) {
$scope.shifts = [];
});
};
function getAllDesignations(){
......@@ -74,7 +75,26 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}).then(function mySuccess(response) {
myFactory.setDesignations(response.data);
}, 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){
......@@ -106,14 +126,13 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
$scope.empName = dataToPass.getName();
$scope.empEmail = dataToPass.getEmail();
$scope.empShift;
$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.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.getSelectedShift = function(){
if ($scope.empShift !== undefined) {
return $scope.empShift;
} else {
return "Please select a shift";
return "Please select primary skill";
}
};
......@@ -153,6 +172,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
var searchId = $scope.empId;
var empName = $scope.empName;
var empShift = $scope.empShift;
var mobileNumber = $scope.mobileNumber;
if(searchId == ""){
$scope.alertMsg = "Employee ID is mandatory";
document.getElementById('empId').focus();
......@@ -165,12 +186,15 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}else if(empName == ""){
$scope.alertMsg = "Employee Name is mandatory";
document.getElementById('empName').focus();
}else if(mobileNumber == undefined || mobileNumber == ""){
$scope.alertMsg = "Mobile Number is mandatory";
document.getElementById('mobileNumber').focus();
}else if(empShift == undefined){
$scope.alertMsg = "Please select a shift";
$scope.alertMsg = "Please select a primary skill";
document.getElementById('empShift').focus();
}else{
$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);
}
};
......@@ -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" : "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" : "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"){
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" : "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"){
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 Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
}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" : "Employee Details","icon" : "fa fa-users fa-2x","path" : "templates/employees.html"});
......@@ -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" : "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" : "My Profile","icon" : "fa fa-address-card-o fa-2x","path" : "templates/profile.html"});
}else if(role == "Lead"){
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" : "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);
......
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'));
}
});
......@@ -157,6 +157,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
}
$scope.assignRole = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddRoleController,
......@@ -173,6 +174,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
});
};
$scope.updateEmployee = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddRoleController,
......@@ -193,7 +195,9 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
};
$scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure want to delete the role?')
.ok('Ok')
.cancel('Cancel');
......
......@@ -134,6 +134,7 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
}
function showProgressDialog(){
$('#home').addClass('md-scroll-mask');
$mdDialog.show({
templateUrl: 'templates/progressDialog.html',
controller: ProgressController,
......@@ -189,6 +190,7 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
}
$scope.sendEmail = function(ev){
$('#home').addClass('md-scroll-mask');
parentData.toEmail = [];
parentData.ccEmail = [];
$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
}
$scope.addProject = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddProjectController,
......@@ -147,6 +148,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
});
};
$scope.viewTeamDetails = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddProjectController,
......@@ -163,6 +165,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
});
};
$scope.getUnAssignedEmployees = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddProjectController,
......@@ -179,6 +182,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
});
};
$scope.getAllocatedEmployees = function(action, userData){
$('#home').addClass('md-scroll-mask');
userData.action = action;
$mdDialog.show({
controller: AddProjectController,
......@@ -199,7 +203,9 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
};
$scope.deleteRole = function(row){
$('#home').addClass('md-scroll-mask');
var confirm = $mdDialog.confirm()
.clickOutsideToClose(true)
.textContent('Are you sure you want to delete this project?')
.ok('Ok')
.cancel('Cancel');
......@@ -242,7 +248,8 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
$scope.isDisabled = false;
$scope.result = "";
$scope.managerDetails = managers;
$scope.prjctStses=["Active","On Hold","Proposed","Completed"];
$scope.prjctStses=["Active","Completed","On Hold","Proposed"];
if(dataToPass.action == "Assign"){
$scope.projectId = "";
$scope.projectName = "";
......
......@@ -30,7 +30,9 @@ myApp.factory('myFactory', function() {
var templateUrl = "";
var profileUrl = "";
var designations="";
var technologies="";
var shifts="";
var accounts="";
function setEmpId(id) {
empId = id;
}
......@@ -74,6 +76,21 @@ myApp.factory('myFactory', function() {
function getDesignations() {
return designations;
}
function setAccounts(accounts1) {
accounts = accounts1;
}
function getAccounts() {
return accounts;
}
function setTechnologies(technologies1) {
technologies = technologies1;
}
function getTechnologies() {
return technologies;
}
function setShifts(shifts1) {
shifts = shifts1;
}
......@@ -110,6 +127,10 @@ myApp.factory('myFactory', function() {
getMenuItems : getMenuItems,
setDesignations : setDesignations,
getDesignations : getDesignations,
setAccounts : setAccounts,
getAccounts : getAccounts,
setTechnologies : setTechnologies,
getTechnologies : getTechnologies,
setShifts : setShifts,
getShifts : getShifts,
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">
<md-toolbar>
<div class="md-toolbar-tools" style="background: cadetblue;">
......
......@@ -32,11 +32,6 @@
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12">
<div class="col-xs-2">
<p>
<b>Total Employees:</b> {{totalEmployees}}
</p>
</div>
<div class="col-xs-2">
<p>
<b>Total Present:</b> {{totalPresent}}
......@@ -63,7 +58,7 @@
</div>
</div>
<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
data available</div>
</div>
......
......@@ -57,7 +57,7 @@
<b>Average Login hours:&nbsp;&nbsp;</b> {{avgLoginHrs}}
</p>
<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
by Employee ID</div>
</div>
......
......@@ -8,6 +8,7 @@
<meta name="author" content=""></meta>
<base href="/myTime/"></base>
<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/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-cookies.js"></script>
......@@ -28,7 +29,6 @@
<link rel="stylesheet" href="css/default-styles.css"></link>
<script src="js/bootstrap.min.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/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.9.12/xlsx.full.min.js"></script>
......@@ -53,7 +53,8 @@
<script src="controllers/AttendanceReportController.js"></script>
<script src="controllers/ShiftDetailsController.js"></script>
<script src="controllers/ViewProjectController.js"></script>
<script src="controllers/MyProfileController.js"></script>
<script src="controllers/ResyncDataController.js"></script>
</head>
<body>
<ng-include src="'templates/login.html'" id="home"></ng-include>
......
......@@ -18,34 +18,16 @@
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12">
<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 class="col-lg-1"
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 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
class="myGrid">
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</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">
<md-toolbar>
<div class="md-toolbar-tools"
......@@ -15,9 +15,12 @@
<div class="md-dialog-content">
<div class="form-group">
<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"
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-optgroup label="managers"> <md-option ng-value="manager"
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">
<md-toolbar>
<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">
<md-toolbar>
<div class="md-toolbar-tools"
style="background: cadetblue;">
<h2>{{templateTitle}} Employee </h2>
<h2>{{templateTitle}} Team Mate </h2>
<span flex></span>
<md-button class="md-icon-button" ng-click="cancel()"> <i
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;"
id="popupContainer" ng-controller="projectTeamController"
ng-init="getUserRoles();getEmployeesToTeam();getProjects();">
ng-init="getUserRoles();getEmployeesToTeam();">
<div class="container-fluid mainDivHeaderClass">
<div class="row">
<div class="col-lg-12">
......@@ -18,34 +18,21 @@
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12">
<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 class="col-lg-1"
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
ng-click="assignRole('Add', parentData)"> <i
class="fa fa-plus-circle fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Assign
Employee</md-button>
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Add Team Mate</md-button>
</div>
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="margin-left: 0px;">
<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
data available</div>
</div>
......
......@@ -45,7 +45,7 @@
<div class="row col-lg-12" style="margin-left: 0px;">
<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
data available</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">
<md-toolbar style="height:40px">
<div class="md-toolbar-tools"
......@@ -19,9 +19,11 @@
<input type="text" class="form-control" id="empName" name="empName"
ng-model="empName" placeholder="Employee Name" /><br>
<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-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>
<div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span>
......
......@@ -57,7 +57,7 @@
<b>Average Login hours:&nbsp;&nbsp;</b> {{avgLoginHrs}}
</p>
<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
by Employee ID</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 @@
<div class="row col-lg-12" style="margin-left: 0px;">
<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
data available</div>
</div>
......
......@@ -54,7 +54,7 @@
<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
class="myGrid">
class="myGrid" style="width:99%;height:350px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</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 @@
<div class="col-lg-2"
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 class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="margin-left: 0px;">
<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
data available</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