Commit ef3dd39a authored by Rajeshekar's avatar Rajeshekar

MT-55[Rajeshekar]:Added shift history

parent cd729356
...@@ -5,6 +5,7 @@ import static org.springframework.data.mongodb.core.aggregation.Aggregation.newA ...@@ -5,6 +5,7 @@ import static org.springframework.data.mongodb.core.aggregation.Aggregation.newA
import static org.springframework.data.mongodb.core.aggregation.Aggregation.project; import static org.springframework.data.mongodb.core.aggregation.Aggregation.project;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.sort; import static org.springframework.data.mongodb.core.aggregation.Aggregation.sort;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
...@@ -21,11 +22,13 @@ import org.springframework.data.mongodb.core.aggregation.AggregationResults; ...@@ -21,11 +22,13 @@ import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.MatchOperation; import org.springframework.data.mongodb.core.aggregation.MatchOperation;
import org.springframework.data.mongodb.core.aggregation.ProjectionOperation; import org.springframework.data.mongodb.core.aggregation.ProjectionOperation;
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.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.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.RestController; import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
...@@ -34,6 +37,7 @@ import com.nisum.mytime.model.BillingDetails; ...@@ -34,6 +37,7 @@ import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.model.ColumnChartData; import com.nisum.mytime.model.ColumnChartData;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.GroupByCount; import com.nisum.mytime.model.GroupByCount;
import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.model.ReportSeriesRecord; import com.nisum.mytime.model.ReportSeriesRecord;
import com.nisum.mytime.repository.EmployeeVisaRepo; import com.nisum.mytime.repository.EmployeeVisaRepo;
import com.nisum.mytime.repository.TeamMatesBillingRepo; import com.nisum.mytime.repository.TeamMatesBillingRepo;
...@@ -335,4 +339,52 @@ public class ReportsController { ...@@ -335,4 +339,52 @@ public class ReportsController {
return new ResponseEntity<>(list, HttpStatus.OK); return new ResponseEntity<>(list, HttpStatus.OK);
} }
@RequestMapping(value = "/fetchEmployeeDetailsByFG",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeRoles>> getEmployeesByFG(
@RequestParam("fGroup") String fGroup) throws MyTimeException {
List<EmployeeRoles> empList = new ArrayList<>();
empList = userService.getEmployeesByFunctionalGrp(fGroup);
return new ResponseEntity<>(empList, HttpStatus.OK);
}
@RequestMapping(value = "/fetchEmployeeDetailsByAccountBillability",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> fetchEmployeeDetailsByAccountBillability(
@RequestParam("account") String account,
@RequestParam("billabilityStatus") String billabilityStatus,
@RequestParam("reportDate") String reportDateString)
throws MyTimeException {
List<ProjectTeamMate> empList = new ArrayList<>();
if (account != null && !account.isEmpty()) {
empList = projectService.findByAccountAndActiveAndBillableStatus(
account, true, billabilityStatus);
} else if (reportDateString != null && !reportDateString.isEmpty()) {
String pattern = "MM-dd-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
Date reportDateValue = new Date();
try {
reportDateValue = simpleDateFormat.parse(reportDateString);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Criteria criteriaV1 = Criteria.where("billingStartDate")
.lt(reportDateValue);
Criteria criteriaV21 = Criteria.where("billingEndDate").is(null);
Criteria criteriaV22 = Criteria.where("billingEndDate")
.gt(reportDateValue);
Criteria criteriaV221 = criteriaV1.orOperator(criteriaV21,
criteriaV22);
Query query = new Query();
query.addCriteria(criteriaV221);
empList = mongoTemplate.find(query, ProjectTeamMate.class);
}
return new ResponseEntity<>(empList, HttpStatus.OK);
}
} }
\ No newline at end of file
package com.nisum.mytime.model;
import java.util.Date;
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 = "EmpShiftDetails")
public class EmpShiftDetails {
@Id
private String id;
private String employeeId;
private String employeeName;
private String shift;
private Date createDate;
private Date updatedDate;
private boolean active;
}
...@@ -94,7 +94,7 @@ public class EmployeeRoles implements Serializable { ...@@ -94,7 +94,7 @@ public class EmployeeRoles implements Serializable {
private String hasB1; private String hasB1;
@ExcelCellName("B1 Expiry Date") @ExcelCellName("B1 Expiry Date")
private Date B1ExpiryDate; private Date b1ExpiryDate;
@ExcelCellName("Created") @ExcelCellName("Created")
private Date createdOn; private Date createdOn;
......
package com.nisum.mytime.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmpShiftDetails;
public interface EmpShiftDetailsRepo extends MongoRepository<EmpShiftDetails, 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.EmployeeRoles; import com.nisum.mytime.model.EmployeeRoles;
public interface EmployeeRolesRepo extends MongoRepository<EmployeeRoles, String> { public interface EmployeeRolesRepo
extends MongoRepository<EmployeeRoles, String> {
EmployeeRoles findByEmailId(String emailId); EmployeeRoles findByEmailId(String emailId);
EmployeeRoles findByEmployeeId(String employeeId); EmployeeRoles findByEmployeeId(String employeeId);
EmployeeRoles findByEmployeeName(String employeeName); EmployeeRoles findByEmployeeName(String employeeName);
List<EmployeeRoles> findByFunctionalGroup(String functionalGroup);
} }
...@@ -30,4 +30,7 @@ public interface ProjectTeamMatesRepo ...@@ -30,4 +30,7 @@ public interface ProjectTeamMatesRepo
List<ProjectTeamMate> findByEmployeeIdAndProjectIdAndActive( List<ProjectTeamMate> findByEmployeeIdAndProjectIdAndActive(
String employeeId, String projectId, boolean status); String employeeId, String projectId, boolean status);
List<ProjectTeamMate> findByAccountAndActiveAndBillableStatus(
String account, boolean status, String billableStatus);
} }
...@@ -72,4 +72,12 @@ public interface ProjectService { ...@@ -72,4 +72,12 @@ public interface ProjectService {
List<BillingDetails> getEmployeeActiveNisumBench(String empId); List<BillingDetails> getEmployeeActiveNisumBench(String empId);
List<BillingDetails> getEmployeeBillingDetailsAll(String empId); List<BillingDetails> getEmployeeBillingDetailsAll(String empId);
public void updateShiftDetails(ProjectTeamMate existingTeammate);
public void addShiftDetails(ProjectTeamMate projectTeamMate);
List<ProjectTeamMate> findByAccountAndActiveAndBillableStatus(
String account, boolean status, String billableStatus);
} }
...@@ -23,10 +23,12 @@ import org.springframework.stereotype.Service; ...@@ -23,10 +23,12 @@ import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.BillingDetails; import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.model.EmpLoginData; import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmpShiftDetails;
import com.nisum.mytime.model.EmployeeDashboardVO; import com.nisum.mytime.model.EmployeeDashboardVO;
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.model.ProjectTeamMate; import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.repository.EmpShiftDetailsRepo;
import com.nisum.mytime.repository.EmployeeRolesRepo; import com.nisum.mytime.repository.EmployeeRolesRepo;
import com.nisum.mytime.repository.ProjectRepo; import com.nisum.mytime.repository.ProjectRepo;
import com.nisum.mytime.repository.ProjectTeamMatesRepo; import com.nisum.mytime.repository.ProjectTeamMatesRepo;
...@@ -54,6 +56,8 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -54,6 +56,8 @@ public class ProjectServiceImpl implements ProjectService {
@Autowired @Autowired
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Autowired
private EmpShiftDetailsRepo empShiftDetailsRepo;
@Override @Override
public List<EmpLoginData> employeeLoginsBasedOnDate(long id, public List<EmpLoginData> employeeLoginsBasedOnDate(long id,
...@@ -162,6 +166,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -162,6 +166,7 @@ public class ProjectServiceImpl implements ProjectService {
billings.setCreateDate(new Date()); billings.setCreateDate(new Date());
addEmployeeBillingDetails(billings); addEmployeeBillingDetails(billings);
addShiftDetails(projectTeamMate);
if (projectTeamMate.getProjectId() != null && !projectTeamMate if (projectTeamMate.getProjectId() != null && !projectTeamMate
.getProjectId().equalsIgnoreCase("Nisum0000")) { .getProjectId().equalsIgnoreCase("Nisum0000")) {
List<ProjectTeamMate> activeBenchProject = projectTeamMatesRepo List<ProjectTeamMate> activeBenchProject = projectTeamMatesRepo
...@@ -231,65 +236,59 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -231,65 +236,59 @@ public class ProjectServiceImpl implements ProjectService {
return teamMate; return teamMate;
} }
public void updateShiftDetails(ProjectTeamMate existingTeammate) {
Query getQuery = new Query();
getQuery.addCriteria(new Criteria().andOperator(
Criteria.where("active").is(true), Criteria.where("employeeId")
.is(existingTeammate.getEmployeeId())));
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
EmpShiftDetails existingShift = mongoTemplate.findOne(getQuery,
EmpShiftDetails.class);
if (existingShift != null) {
existingShift.setActive(false);
existingShift.setUpdatedDate(new Date());
mongoTemplate.save(existingShift);
}
}
public void addShiftDetails(ProjectTeamMate projectTeamMate) {
EmpShiftDetails empShiftDetails = new EmpShiftDetails();
empShiftDetails.setUpdatedDate(new Date());
empShiftDetails.setEmployeeName(projectTeamMate.getEmployeeName());
empShiftDetails.setEmployeeId(projectTeamMate.getEmployeeId());
empShiftDetails.setShift(projectTeamMate.getShift());
empShiftDetails.setActive(true);
empShiftDetailsRepo.save(empShiftDetails);
}
@Override @Override
public void deleteTeammate(String empId, String projectId, ObjectId id) { public void deleteTeammate(String empId, String projectId, ObjectId id) {
ProjectTeamMate existingTeammate = projectTeamMatesRepo.findById(id); ProjectTeamMate existingTeammate = projectTeamMatesRepo.findById(id);
existingTeammate.setActive(false); existingTeammate.setActive(false);
Calendar c = Calendar.getInstance(); existingTeammate.setEndDate(new Date());
c.add(Calendar.DAY_OF_MONTH, -1); BillingDetails billingDetails = new BillingDetails();
existingTeammate.setEndDate(c.getTime()); billingDetails.setBillableStatus("Bench");
/* billingDetails.setBillingStartDate(new Date());
* BillingDetails billingDetails = new BillingDetails(); billingDetails.setActive(true);
* billingDetails.setBillableStatus("Bench"); billingDetails.setEmployeeId(existingTeammate.getEmployeeId());
* billingDetails.setBillingStartDate(new Date()); billingDetails.setEmployeeName(existingTeammate.getEmployeeName());
* billingDetails.setActive(true); billingDetails.setCreateDate(new Date());
* billingDetails.setEmployeeId(existingTeammate.getEmployeeId()); billingDetails.setProjectId("Nisum0000");
* billingDetails.setEmployeeName(existingTeammate.getEmployeeName()); billingDetails.setProjectName("Free Pool");
* billingDetails.setCreateDate(new Date()); addEmployeeBillingDetails(billingDetails);
* billingDetails.setProjectId("Nisum0000");
* billingDetails.setProjectName("Free Pool");
* addEmployeeBillingDetails(billingDetails);
*/
List<BillingDetails> listBD = getEmployeeActiveBillingDetails(empId, List<BillingDetails> listBD = getEmployeeActiveBillingDetails(empId,
projectId); projectId);
if (listBD != null && !listBD.isEmpty()) { if (listBD != null && !listBD.isEmpty()) {
BillingDetails billingDetailsExisting = listBD.get(0); BillingDetails billingDetailsExisting = listBD.get(0);
Date d = new Date(); Date d = new Date();
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
billingDetailsExisting billingDetailsExisting.setBillingEndDate(d);
.setBillingEndDate(DateUtils.truncate(d, Calendar.DATE));
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting);
} }
projectTeamMatesRepo.save(existingTeammate); projectTeamMatesRepo.save(existingTeammate);
updateShiftDetails(existingTeammate);
List<ProjectTeamMate> activeProjects = projectTeamMatesRepo
.findByEmployeeIdAndActive(existingTeammate.getEmployeeId(),
true);
if (activeProjects == null || activeProjects.size() == 0) {
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
newBenchAllocation.setAccount("Nisum");
newBenchAllocation.setBillableStatus("Non-Billable");
newBenchAllocation
.setDesignation(existingTeammate.getDesignation());
newBenchAllocation.setEmailId(existingTeammate.getEmailId());
newBenchAllocation.setEmployeeId(existingTeammate.getEmployeeId());
newBenchAllocation
.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId("Nisum0000");
newBenchAllocation.setStartDate(new Date());
Project p = projectRepo.findByProjectId("Nisum0000");
newBenchAllocation.setProjectName(p.getProjectName());
newBenchAllocation.setManagerId(p.getManagerId());
newBenchAllocation.setManagerName(p.getManagerName());
try {
addProjectTeamMate(newBenchAllocation);
} catch (MyTimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
@Override @Override
...@@ -594,4 +593,11 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -594,4 +593,11 @@ public class ProjectServiceImpl implements ProjectService {
return employeeDashboard; return employeeDashboard;
} }
@Override
public List<ProjectTeamMate> findByAccountAndActiveAndBillableStatus(
String account, boolean status, String billableStatus) {
return projectTeamMatesRepo.findByAccountAndActiveAndBillableStatus(
account, status, billableStatus);
}
} }
...@@ -63,4 +63,6 @@ public interface UserService { ...@@ -63,4 +63,6 @@ public interface UserService {
List<String> getEmployeeDetailsForAutocomplete(); List<String> getEmployeeDetailsForAutocomplete();
List<MasterData> getMasterData() throws MyTimeException; List<MasterData> getMasterData() throws MyTimeException;
List<EmployeeRoles> getEmployeesByFunctionalGrp(String functionalGrp);
} }
...@@ -174,6 +174,7 @@ public class UserServiceImpl implements UserService { ...@@ -174,6 +174,7 @@ public class UserServiceImpl implements UserService {
update.set("employeeName", employeeRoles.getEmployeeName()); update.set("employeeName", employeeRoles.getEmployeeName());
update.set("emailId", employeeRoles.getEmailId()); update.set("emailId", employeeRoles.getEmailId());
update.set("role", employeeRoles.getRole()); update.set("role", employeeRoles.getRole());
update.set("gender", employeeRoles.getGender());
update.set("functionalGroup", employeeRoles.getFunctionalGroup()); update.set("functionalGroup", employeeRoles.getFunctionalGroup());
update.set("empStatus", employeeRoles.getEmpStatus()); update.set("empStatus", employeeRoles.getEmpStatus());
update.set("employmentType", employeeRoles.getEmploymentType()); update.set("employmentType", employeeRoles.getEmploymentType());
...@@ -183,6 +184,10 @@ public class UserServiceImpl implements UserService { ...@@ -183,6 +184,10 @@ public class UserServiceImpl implements UserService {
update.set("dateOfBirth", employeeRoles.getDateOfBirth()); update.set("dateOfBirth", employeeRoles.getDateOfBirth());
update.set("dateOfJoining", employeeRoles.getDateOfJoining()); update.set("dateOfJoining", employeeRoles.getDateOfJoining());
update.set("lastModifiedOn", new Date()); update.set("lastModifiedOn", new Date());
update.set("hasPassort", employeeRoles.getHasPassort());
update.set("hasB1", employeeRoles.getHasB1());
update.set("passportExpiryDate", employeeRoles.getPassportExpiryDate());
update.set("b1ExpiryDate", employeeRoles.getB1ExpiryDate());
// update employee location // update employee location
if (employeeRoles.getEmpLocation() != null if (employeeRoles.getEmpLocation() != null
&& !employeeRoles.getEmpLocation().equals("")) { && !employeeRoles.getEmpLocation().equals("")) {
...@@ -410,4 +415,11 @@ public class UserServiceImpl implements UserService { ...@@ -410,4 +415,11 @@ public class UserServiceImpl implements UserService {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return employeeLocationDetailsRepo.findByEmployeeId(empId); return employeeLocationDetailsRepo.findByEmployeeId(empId);
} }
@Override
public List<EmployeeRoles> getEmployeesByFunctionalGrp(
String functionalGrp) {
return employeeRolesRepo.findByFunctionalGroup(functionalGrp);
}
} }
...@@ -4,10 +4,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -4,10 +4,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData = { $scope.parentData = {
"employeeId": "", "employeeId": "",
"employeeName": "", "employeeName": "",
"gender": "",
"emailId":"", "emailId":"",
"role": "", "role": "",
"designation":"", "designation":"",
"action":"" "action":"",
"passportExpiryDate":""
}; };
var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Update\')"></i>'+ var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Update\')"></i>'+
...@@ -22,11 +24,14 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -22,11 +24,14 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120}, {field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'gender',displayName: 'Gender', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false}, {field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true}, {field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true},
{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100}, {field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
//{field : 'hasPassort',displayName: 'HasPassort', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
//{field : 'hasB1',displayName: 'HasB1', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100} {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
] ]
}; };
...@@ -40,6 +45,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -40,6 +45,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120}, {field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'gender',displayName: 'Gender', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
//{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false}, //{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
...@@ -55,6 +61,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -55,6 +61,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.getRowData = function(row, action){ $scope.getRowData = function(row, action){
$scope.parentData.employeeId = row.entity.employeeId; $scope.parentData.employeeId = row.entity.employeeId;
$scope.parentData.employeeName = row.entity.employeeName; $scope.parentData.employeeName = row.entity.employeeName;
$scope.parentData.gender = row.entity.gender;
$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.empLocation = row.entity.empLocation; $scope.parentData.empLocation = row.entity.empLocation;
...@@ -65,6 +72,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -65,6 +72,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData.domain = row.entity.domain; $scope.parentData.domain = row.entity.domain;
$scope.parentData.dateOfJoining = row.entity.dateOfJoining; $scope.parentData.dateOfJoining = row.entity.dateOfJoining;
$scope.parentData.dateOfBirth = row.entity.dateOfBirth; $scope.parentData.dateOfBirth = row.entity.dateOfBirth;
$scope.parentData.hasPassort = row.entity.hasPassort;
$scope.parentData.hasB1 = row.entity.hasB1;
$scope.parentData.passportExpiryDate = row.entity.passportExpiryDate;
$scope.parentData.b1ExpiryDate = row.entity.b1ExpiryDate;
if(action == "Update") if(action == "Update")
$scope.assignRole(action, $scope.parentData); $scope.assignRole(action, $scope.parentData);
...@@ -88,6 +101,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -88,6 +101,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120}, {field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'gender',displayName: 'Gender', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false}, {field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
...@@ -259,6 +273,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -259,6 +273,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
if(dataToPass.action == "Add"){ if(dataToPass.action == "Add"){
$scope.empId = ""; $scope.empId = "";
$scope.empName = ""; $scope.empName = "";
$scope.gender = "";
$scope.empRole; $scope.empRole;
$scope.empEmail = ""; $scope.empEmail = "";
$scope.empLocation = ""; $scope.empLocation = "";
...@@ -268,9 +283,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -268,9 +283,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.designation = ""; $scope.designation = "";
$scope.domain = ""; $scope.domain = "";
$scope.isDisabled = false; $scope.isDisabled = false;
}else if(dataToPass.action == "Update"){ $scope.hasPassort = "";
$scope.hasB1 = "";
}else if(dataToPass.action == "Update") {
$scope.empId = dataToPass.employeeId; $scope.empId = dataToPass.employeeId;
$scope.empName = dataToPass.employeeName; $scope.empName = dataToPass.employeeName;
$scope.gender = dataToPass.gender;
$scope.empRole = dataToPass.role; $scope.empRole = dataToPass.role;
$scope.empEmail = dataToPass.emailId; $scope.empEmail = dataToPass.emailId;
$scope.empLocation = dataToPass.empLocation; $scope.empLocation = dataToPass.empLocation;
...@@ -280,8 +298,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -280,8 +298,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.domain = dataToPass.domain; $scope.domain = dataToPass.domain;
$scope.designation = dataToPass.designation; $scope.designation = dataToPass.designation;
$scope.dateOfJoining = new Date(dataToPass.dateOfJoining); $scope.dateOfJoining = new Date(dataToPass.dateOfJoining);
$scope.dateOfBirth = new Date(dataToPass.dateOfBirth);; $scope.dateOfBirth = new Date(dataToPass.dateOfBirth);
$scope.isDisabled = true; $scope.isDisabled = true;
$scope.hasPassort = dataToPass.hasPassort;
$scope.hasB1 = dataToPass.hasB1;
$scope.passportExpiryDate = new Date(dataToPass.passportExpiryDate);
$scope.b1ExpiryDate = new Date(dataToPass.b1ExpiryDate);
} }
$scope.domains = myFactory.getDomains(); $scope.domains = myFactory.getDomains();
$scope.roles = myFactory.getRoles(); $scope.roles = myFactory.getRoles();
...@@ -339,6 +361,15 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -339,6 +361,15 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
return "Please select a employee status"; return "Please select a employee status";
} }
}; };
$scope.getSelectedGender = function() {
if ($scope.gender !== undefined) {
return $scope.gender;
} else {
return "Please select a Gender";
}
};
$scope.validateEmpId = function(){ $scope.validateEmpId = function(){
var searchId = $scope.empId; var searchId = $scope.empId;
if(searchId != "" && isNaN(searchId)){ if(searchId != "" && isNaN(searchId)){
...@@ -394,8 +425,10 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -394,8 +425,10 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.validateFields = function(){ $scope.validateFields = function(){
var searchId = $scope.empId; var searchId = $scope.empId;
var empName = $scope.empName; var empName = $scope.empName;
var gender = $scope.gender;
var empRole = $scope.empRole; var empRole = $scope.empRole;
var empEmail = $scope.empEmail; var empEmail = $scope.empEmail;
// alert("passportExpiryDate::"+$scope.passportExpiryDate)
if(searchId == ""){ if(searchId == ""){
$scope.alertMsg = "Employee ID is mandatory"; $scope.alertMsg = "Employee ID is mandatory";
document.getElementById('empId').focus(); document.getElementById('empId').focus();
...@@ -408,7 +441,10 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -408,7 +441,10 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}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(empEmail == ""){ }else if(gender == "") {
$scope.alertMsg = "Gender is mandatory";
document.getElementById('gender').focus();
}else if(empEmail == "") {
$scope.alertMsg = "Email ID is mandatory"; $scope.alertMsg = "Email ID is mandatory";
document.getElementById('empEmail').focus(); document.getElementById('empEmail').focus();
}else if(empRole == undefined){ }else if(empRole == undefined){
...@@ -417,7 +453,13 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -417,7 +453,13 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}else{ }else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": $scope.empRole, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,"empStatus": $scope.empStatus,"employmentType": $scope.employmentType,"domain": $scope.domain,"dateOfJoining":$scope.dateOfJoining,"dateOfBirth":$scope.dateOfBirth}; var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "gender": $scope.gender,"emailId": $scope.empEmail,
"role": $scope.empRole, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"empStatus": $scope.empStatus,"employmentType": $scope.employmentType,"domain": $scope.domain,"dateOfJoining":$scope.dateOfJoining,
"dateOfBirth":$scope.dateOfBirth,"hasPassort":$scope.hasPassort,"hasB1":$scope.hasB1,"passportExpiryDate":$scope.passportExpiryDate,
"b1ExpiryDate":$scope.b1ExpiryDate
};
addOrUpdateRole(record, $scope.templateTitle); addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
......
...@@ -30,6 +30,16 @@ ...@@ -30,6 +30,16 @@
</td> </td>
</tr> </tr>
<tr>
<td colspan="-10">
<b >Gender</b></td>
<td colspan="8"><md-select ng-model="gender" md-selected-text="getSelectedGender()" id="gender" >
<md-option ng-model="gender" value="Male">Male </md-option>
<md-option ng-model="gender" value="Female">Female</md-option>
</md-select>
</td>
</tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<b >Email</b></td> <b >Email</b></td>
...@@ -78,6 +88,45 @@ ...@@ -78,6 +88,45 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="1">
<b >HasPassport</b></td>
<td colspan="8"><md-select ng-model="hasPassort" id="hasPassort">
<md-option ng-model="hasPassort" value="Yes">Yes </md-option>
<md-option ng-model="hasPassort" value="No">No</md-option>
</md-select>
</td>
</tr>
<tr ng-if="hasPassort == 'Yes'">
<td colspan="4">
<b >Passport Expiry Date</b></td>
<td colspan="8"> <md-datepicker ng-model="passportExpiryDate" md-placeholder="Passport Expiry Date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
</td>
</tr>
<tr>
<td colspan="1">
<b >Has B1 Visa</b></td>
<td colspan="8"><md-select ng-model="hasB1" id="hasB1" >
<md-option ng-model="hasB1" value="Yes">Yes </md-option>
<md-option ng-model="hasB1" value="No">No</md-option>
</md-select>
</td>
</tr>
<tr ng-if="hasB1 == 'Yes'">
<td colspan="4">
<b >B1 Expiry Date</b></td>
<td colspan="8"> <md-datepicker ng-model="b1ExpiryDate" md-placeholder="B1 Expiry Date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
</td>
</tr>
<tr>
<td colspan="4"> <td colspan="4">
<b >Employment Type</b></td> <b >Employment Type</b></td>
<td colspan="8"> <md-select ng-model="employmentType" md-selected-text="getSelectedEmploymentType()" id="employmentType"> <td colspan="8"> <md-select ng-model="employmentType" md-selected-text="getSelectedEmploymentType()" id="employmentType">
......
...@@ -244,6 +244,20 @@ ...@@ -244,6 +244,20 @@
</div> </div>
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6">
<p>
<b>Passport Expiry Date</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
<b>:</b> {{profile.passportExpiryDate | date:'dd-MMM-yyyy'}}
</p>
</div>
</div>
<div class="row col-lg-12 col-xs-12"> <div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6"> <div class="col-lg-5 col-xs-6">
<p> <p>
......
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