Commit 13fe6835 authored by Rajeshekar's avatar Rajeshekar

[Rajeshekar] MT-48:Capture Date of Joining and Date of Birth and show

Date of Joining in Dashboard
MT-51: Capture the project team mate status with dates
parent ae8613d6
......@@ -20,24 +20,25 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "TeamMateBilling")
public class TeamMateBilling implements Serializable {
@Document(collection = "BillingDetails")
public class BillingDetails implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String employeeId;
private String employeeName;
@Id
private ObjectId id;
private String employeeId;
private String employeeName;
private String projectId;
private String projectName;
@DateTimeFormat(iso = ISO.DATE)
private Date billingStartDate;
@DateTimeFormat(iso = ISO.DATE)
private Date billingEndDate;
private String comments;
private boolean active;
@DateTimeFormat(iso = ISO.DATE)
private Date createDate;
private String billableStatus;
@DateTimeFormat(iso = ISO.DATE)
private Date billingStartDate;
@DateTimeFormat(iso = ISO.DATE)
private Date billingEndDate;
private String comments;
private boolean active;
@DateTimeFormat(iso = ISO.DATE)
private Date createDate;
}
......@@ -5,6 +5,8 @@ import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;
import lombok.AllArgsConstructor;
import lombok.Getter;
......@@ -17,7 +19,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "EmployeeRoles")
@Document(collection = "EmployeeDetails")
public class EmployeeRoles implements Serializable {
/**
......@@ -43,6 +45,10 @@ public class EmployeeRoles implements Serializable {
private String functionalGroup;
private String empStatus;
private String employmentType;
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfJoining;
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfBirth;
private Date createdOn;
private Date lastModifiedOn;
......
......@@ -18,20 +18,19 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "Projects")
@Document(collection = "Team")
public class Project implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String projectId;
private String projectName;
private String managerId;
private String managerName;
private String account;
private String status;
private List<String> employeeIds;
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String projectId;
private String projectName;
private String managerId;
private String managerName;
private String account;
private String status;
private List<String> employeeIds;
}
......@@ -20,31 +20,31 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "ProjectTeamMate")
@Document(collection = "TeamDetails")
public class ProjectTeamMate implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String employeeId;
private String employeeName;
private String emailId;
private String role;
private String shift;
private String projectId;
private String projectName;
private String account;
private String managerId;
private String managerName;
private String experience;
private String designation;
private String billableStatus;
private String mobileNumber;
@DateTimeFormat(iso = ISO.DATE)
private Date startDate;
@DateTimeFormat(iso = ISO.DATE)
private Date endDate;
private boolean active;
@Id
private ObjectId id;
private String employeeId;
private String employeeName;
private String emailId;
private String role;
private String shift;
private String projectId;
private String projectName;
private String account;
private String managerId;
private String managerName;
private String experience;
private String designation;
private String billableStatus;
private String mobileNumber;
@DateTimeFormat(iso = ISO.DATE)
private Date startDate;
@DateTimeFormat(iso = ISO.DATE)
private Date endDate;
private boolean active;
}
......@@ -5,16 +5,16 @@ import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.TeamMateBilling;
import com.nisum.mytime.model.BillingDetails;
public interface TeamMatesBillingRepo extends MongoRepository<TeamMateBilling, String> {
public interface TeamMatesBillingRepo extends MongoRepository<BillingDetails, String> {
List<TeamMateBilling> findByProjectId(String projectId);
List<BillingDetails> findByProjectId(String projectId);
List<TeamMateBilling> findByEmployeeId(String employeeId);
List<BillingDetails> findByEmployeeId(String employeeId);
TeamMateBilling findById(ObjectId id);
BillingDetails findById(ObjectId id);
List<TeamMateBilling> findByEmployeeIdAndProjectId(String employeeId, String projectId);
List<BillingDetails> findByEmployeeIdAndProjectId(String employeeId, String projectId);
}
......@@ -5,58 +5,67 @@ import java.util.List;
import org.bson.types.ObjectId;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeDashboardVO;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.model.TeamMateBilling;
public interface ProjectService {
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate,
String toDate) throws MyTimeException;
List<Project> getProjects() throws MyTimeException;
List<Project> getProjects() throws MyTimeException;
Project addProject(Project project) throws MyTimeException;
Project addProject(Project project) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate)
throws MyTimeException;
EmployeeRoles getEmployeesRole(String emailId);
EmployeeRoles getEmployeesRole(String emailId);
void deleteProject(String projectId);
void deleteProject(String projectId);
Project updateProject(Project project);
Project updateProject(Project project);
EmployeeRoles getEmployeesRoleData(String empId);
EmployeeRoles getEmployeesRoleData(String empId);
List<ProjectTeamMate> getTeamDetails(String empId);
List<ProjectTeamMate> getTeamDetails(String empId);
public ProjectTeamMate addProjectTeamMate(ProjectTeamMate projectTeamMate) throws MyTimeException;
public ProjectTeamMate addProjectTeamMate(ProjectTeamMate projectTeamMate)
throws MyTimeException;
ProjectTeamMate updateTeammate(ProjectTeamMate projectTeamMate);
ProjectTeamMate updateTeammate(ProjectTeamMate projectTeamMate);
void deleteTeammate(String empId, String projectId,ObjectId id);
void deleteTeammate(String empId, String projectId, ObjectId id);
List<Project> getProjects(String managerId) throws MyTimeException;
List<Project> getProjects(String managerId) throws MyTimeException;
List<ProjectTeamMate> getMyTeamDetails(String empId);
List<ProjectTeamMate> getMyTeamDetails(String empId);
List<EmployeeRoles> getUnAssignedEmployees();
List<ProjectTeamMate> getShiftDetails(String shift);
List<ProjectTeamMate> getAllProjectDetails();
List<ProjectTeamMate> getProjectDetails(String projectId);
public List<ProjectTeamMate> getMyProjectAllocations(String empId);
List<TeamMateBilling> getEmployeeBillingDetails(String empId,String projectId);
List<EmployeeRoles> getUnAssignedEmployees();
TeamMateBilling addEmployeeBillingDetails(TeamMateBilling teamMate);
List<ProjectTeamMate> getShiftDetails(String shift);
TeamMateBilling updateEmployeeBilling(TeamMateBilling teamMate);
public List<EmployeeDashboardVO> getEmployeesDashBoard();
List<ProjectTeamMate> getAllProjectDetails();
List<ProjectTeamMate> getProjectDetails(String projectId);
public List<ProjectTeamMate> getMyProjectAllocations(String empId);
List<BillingDetails> getEmployeeBillingDetails(String empId,
String projectId);
BillingDetails addEmployeeBillingDetails(BillingDetails teamMate);
BillingDetails updateEmployeeBilling(BillingDetails teamMate);
void deleteEmployeeBilling(BillingDetails teamMate);
public List<EmployeeDashboardVO> getEmployeesDashBoard();
List<BillingDetails> getEmployeeActiveBillingDetails(String empId,
String projectId);
}
......@@ -129,6 +129,8 @@ public class UserServiceImpl implements UserService {
update.set("empLocation", employeeRoles.getEmpLocation());
update.set("domain", employeeRoles.getDomain());
update.set("designation", employeeRoles.getDesignation());
update.set("dateOfBirth", employeeRoles.getDateOfBirth());
update.set("dateOfJoining", employeeRoles.getDateOfJoining());
update.set("lastModifiedOn", new Date());
FindAndModifyOptions options = new FindAndModifyOptions();
options.returnNew(true);
......
......@@ -63,6 +63,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData.empStatus = row.entity.empStatus;
$scope.parentData.employmentType = row.entity.employmentType;
$scope.parentData.domain = row.entity.domain;
$scope.parentData.dateOfJoining = row.entity.dateOfJoining;
$scope.parentData.dateOfBirth = row.entity.dateOfBirth;
if(action == "Update")
$scope.assignRole(action, $scope.parentData);
else if(action == "Delete")
......@@ -246,6 +249,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.employmentType = dataToPass.employmentType;
$scope.domain = dataToPass.domain;
$scope.designation = dataToPass.designation;
$scope.dateOfJoining = new Date(dataToPass.dateOfJoining);
$scope.dateOfBirth = new Date(dataToPass.dateOfBirth);;
$scope.isDisabled = true;
}
$scope.domains = myFactory.getDomains();
......@@ -381,7 +386,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
document.getElementById('empRole').focus();
}else{
$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};
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};
addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500);
}
......
......@@ -93,7 +93,6 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
method : "GET",
url : appConfig.appUri + "user/getMasterData"
}).then(function mySuccess(response) {
myFactory.setTechnologies(response.data);
myFactory.setEmployementTypes(response.data['EmpType']);
myFactory.setFunctionalgroups(response.data['FunctionalGrp'])
myFactory.setEmployeeStatus(response.data['EmployeeStatus']);
......
......@@ -17,6 +17,8 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
"designation":"",
"billableStatus":"",
"mobileNumber":"",
"startDate":"",
"endDate":"",
"action":""
};
$scope.employees = [];
......@@ -85,6 +87,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.parentData.designation = row.entity.designation;
$scope.parentData.billableStatus = row.entity.billableStatus;
$scope.parentData.mobileNumber = row.entity.mobileNumber;
$scope.parentData.startDate = row.entity.startDate;
$scope.parentData.endDate = row.entity.endDate;
if(action == "Update"){
$scope.updateEmployee(action, $scope.parentData);
}
......@@ -326,6 +331,8 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.mobileNumber = dataToPass.mobileNumber;
$scope.experience = dataToPass.experience;
$scope.designation = dataToPass.designation;
$scope.startDate = new Date(dataToPass.startDate);
$scope.endDate = new Date(dataToPass.endDate);
$scope.isDisabled = true;
$scope.projectModel = {
'projectName': dataToPass.projectName,
......@@ -389,6 +396,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
type: 'info'
});
};
$scope.toggleBillability = function() {
$scope.showBillable = !$scope.showBillable;
};
......@@ -405,6 +413,10 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
}else if(action == "Update"){
urlRequest = appConfig.appUri+ "projectTeam/updateEmployeeBilling";
}
else if(action == "Delete"){
urlRequest = appConfig.appUri+ "projectTeam/deleteEmployeeBilling";
}
var req = {
method : 'POST',
url : urlRequest,
......@@ -421,6 +433,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
url : appConfig.appUri + "/projectTeam/getEmployeeBillingDetails?employeeId="+record.employeeId+"&projectId="+record.projectId
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -428,11 +441,11 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
if(action == "Add"){
$scope.toggleBillability();
}
alert("Billability added successfully!!!")
alert("Billability details modifed successfully!!!")
//showAlert("Billability added successfully!!!");
}, function myError(response){
$scope.result = "Error";
alert("Error Adding billability!!!")
alert("Error modifying billability!!!")
//showAlert("Error Adding billability!!!");
});
};
......@@ -446,6 +459,15 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.gridOptions.data[index].editrow = false;
addOrUpdateBilling(row,"Update");
};
$scope.deleteRow = function (row) {
//get the index of selected row
var index = $scope.gridOptions.data.indexOf(row);
//Remove the edit mode when user click on Save button
$scope.gridOptions.data[index].editrow = false;
addOrUpdateBilling(row,"Delete");
};
var getCellActiveTemplateBilling='<div ng-show="COL_FIELD==true"><p class="col-lg-12">Y</P></div><div ng-show="COL_FIELD==false"><p class="col-lg-12">N</p></div>';
$scope.gridOptions = {
......@@ -480,6 +502,8 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
columnDefs : [
{name : 'id',displayName: 'Id', enableColumnMenu: false, enableSorting: false,cellTemplate: '<div>{{rowRenderIndex + 1}}</div>',enableCellEdit: false},
// {field : 'billingStartDate',displayName: 'Start Date', enableColumnMenu: false,enableSorting: false,cellTemplate: '<div ng-if="!row.entity.editrow">{{COL_FIELD|date:"dd-MMM-yyyy"}}</div> <div ng-if="row.entity.editrow"><input ng-class="\'colt\' + col.index" datepicker-popup is-open="false" ng-model="COL_FIELD" /></div>'},
{field : 'billableStatus',displayName: 'Billable Status', enableColumnMenu: false, enableSorting: false},
{
field: 'billingStartDate',
displayName: 'Start Date',
......@@ -502,6 +526,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
cellTemplate: '<div><button ng-show="!row.entity.editrow" ng-click="grid.appScope.edit(row.entity)"><i class="fa fa-edit"></i></button>' + //Edit Button
'<button ng-show="row.entity.editrow" ng-click="grid.appScope.saveRow(row.entity)"><i class="fa fa-floppy-o"></i></button>' +//Save Button
'<button ng-show="row.entity.editrow" ng-click="grid.appScope.cancelEdit(row.entity)"><i class="fa fa-times"></i></button>' + //Cancel Button
'<button ng-show="!row.entity.editrow" ng-click="grid.appScope.deleteRow(row.entity)"><i class="fa fa-minus-circle"></i></button>' +//Delete Button
'</div>', width: 100
}
],rowStyle: function(row){/*
......@@ -597,13 +622,13 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.alertMsg = "Employee is already assigned to the selected project";
} else {
$scope.alertMsg = "";
var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "role": employeeModel.role, "designation":employeeModel.designation,"shift": employeeModel.shift,"projectId":projectModel.projectId,"projectName":projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"mobileNumber":employeeModel.mobileNumber,"active":true};
var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "role": employeeModel.role, "designation":employeeModel.designation,"shift": employeeModel.shift,"projectId":projectModel.projectId,"projectName":projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate};
addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500);
}
}else{
$scope.alertMsg = "";
var record = {"id":$scope.id,"employeeId":$scope.employeeId, "employeeName":$scope.employeeName, "emailId": $scope.emailId, "role": $scope.role, "shift": $scope.shift,"projectId":$scope.projectModel.projectId,"projectName":$scope.projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"designation":$scope.empDesignation,"billableStatus":$scope.empBillableStatus,"experience":$scope.experience,"mobileNumber":$scope.mobileNumber};
var record = {"id":$scope.id,"employeeId":$scope.employeeId, "employeeName":$scope.employeeName, "emailId": $scope.emailId, "role": $scope.role, "shift": $scope.shift,"projectId":$scope.projectModel.projectId,"projectName":$scope.projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"designation":$scope.empDesignation,"billableStatus":$scope.empBillableStatus,"experience":$scope.experience,"mobileNumber":$scope.mobileNumber,"startDate":$scope.startDate,"endDate":$scope.endDate};
addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500);
}
......
......@@ -35,6 +35,14 @@
<md-select ng-model="empBillableStatus" md-selected-text="getSelectedBillableStatus()" id="empBillableStatus">
<md-optgroup label="billable statuses"> <md-option ng-value="billableStatus"
ng-repeat="billableStatus in billableStatuses">{{billableStatus}}</md-option> </md-optgroup> </md-select>
<md-datepicker ng-model="startDate" md-placeholder="Start Date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
<md-datepicker ng-model="endDate" md-placeholder="Projected End Date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
<!-- <input type="text" class="form-control" id="experience"
name="experience" ng-model="experience" placeholder="Experience" /><br>
<input type="text" class="form-control" id="mobileNumber"
......
......@@ -38,7 +38,7 @@
<div class="row col-lg-12" style="margin-left: -25px;">
<div class="col-xs-4" style="margin-left: 0px;">
<md-button class="md-raised" ng-click="toggleBillability()" style="width:220px;background: cadetblue;color:white;">Add Billability </md-button>
<!-- <md-button class="md-raised" ng-click="toggleBillability()" style="width:220px;background: cadetblue;color:white;">Add Billability </md-button> -->
</div>
</div>
......
......@@ -93,6 +93,24 @@
<md-optgroup label="Employment Status"> <md-option ng-value="status"
ng-repeat="status in empStatuses">{{status}}</md-option> </md-optgroup> </md-select>
</td>
</tr>
<tr>
<td colspan="4">
<b >Date of Joining</b></td>
<td colspan="8"> <md-datepicker ng-model="dateOfJoining" md-placeholder="Date of Joining"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
</td>
</tr>
<tr>
<td colspan="4">
<b >Date of Birth</b></td>
<td colspan="8"> <md-datepicker ng-model="dateOfBirth" md-placeholder="Date of Birth"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
</td>
</tr>
<tr>
<td colspan="12">
......@@ -103,7 +121,10 @@
</tr>
</table>
<!--
<!-- <md-datepicker ng-model="expiryDate" md-placeholder="Expiry date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6" >
<p>
......
<md-dialog aria-label="Role Template" style="width:520px;height:440px;" ng-init="getProjects()">
<md-dialog aria-label="Role Template" style="width:520px;height:800px;" ng-init="getProjects()">
<form ng-cloak name="myForm">
<md-toolbar>
<div class="md-toolbar-tools"
......@@ -25,6 +25,17 @@
<output>Email Id : {{employeeModel.emailId}}</output>
<output>Role : {{employeeModel.role}}</output>
<output>Designation : {{employeeModel.designation}}</output>
<md-select ng-model="empBillableStatus" md-selected-text="getSelectedBillableStatus()" id="empBillableStatus">
<md-optgroup label="billable statuses"> <md-option ng-value="billableStatus"
ng-repeat="billableStatus in billableStatuses">{{billableStatus}}</md-option> </md-optgroup> </md-select>
<md-datepicker ng-model="startDate" md-placeholder="Start Date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker></br>
<md-datepicker ng-model="endDate" md-placeholder="Projected End Date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
></md-datepicker>
<div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span>
......
......@@ -229,7 +229,37 @@
</div>
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6">
<p>
<b>Date of Joining</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
<b>:</b> {{profile.dateOfJoining | date:'dd-MMM-yyyy'}}
</p>
</div>
</div>
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6">
<p>
<b>Date of Birth</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
<b>:</b> {{profile.dateOfBirth | date:'dd-MMM-yyyy'}}
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-2" style="cursor: pointer; float: left;">
<md-button class="md-raised md-primary"
......
......@@ -58,7 +58,8 @@ public class ProjectControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", null, null, "user@nisum.com", null,
null, null, null, null, null, null, null, null, null, null,
null, null, new Date(2017 - 11 - 12), new Date(2017 - 12 - 12));
null, null, new Date(2017 - 11 - 12), new Date(2017 - 12 - 12),
null, null);
when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -131,7 +132,8 @@ public class ProjectControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", "16127", null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, new Date(2017 - 11 - 18), new Date(2017 - 12 - 18));
null, new Date(2017 - 11 - 18), new Date(2017 - 12 - 18), null,
null);
when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole);
mockMvc.perform(
......
......@@ -27,7 +27,7 @@ import com.nisum.mytime.controller.ProjectTeamController;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.model.TeamMateBilling;
import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.service.ProjectService;
import com.nisum.mytime.service.UserService;
......@@ -56,7 +56,8 @@ public class ProjectTeamControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", null, null, null, null, null, null,
null, null, null, null, null, null, "user@nisum.com", null,
null, null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23));
null, null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23),
null, null);
when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -91,7 +92,7 @@ public class ProjectTeamControllerTest {
"vsingh@nisum.com", "Manager", null, "09:00-06:00", "Java/J2EE",
"Testing", "8755672341", "8800543678", "vsingh@gmail.com", null,
null, null, null, null, new Date(2017 - 11 - 29),
new Date(2017 - 12 - 20));
new Date(2017 - 12 - 20), null, null);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeesRoles2);
when(userService.updateEmployeeRole(any())).thenReturn(employeesRoles2);
......@@ -115,7 +116,8 @@ public class ProjectTeamControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", "16127", null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23));
null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23), null,
null);
when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -273,7 +275,7 @@ public class ProjectTeamControllerTest {
@Test
public void testgetEmployeeBillingDetails() throws Exception {
List<TeamMateBilling> billings = CreateTeamMateBilling();
List<BillingDetails> billings = CreateTeamMateBilling();
System.out.println(billings);
when(projectService.getEmployeeBillingDetails("16127", "101"))
.thenReturn(billings);
......@@ -283,10 +285,10 @@ public class ProjectTeamControllerTest {
verify(projectService).getEmployeeBillingDetails("16127", "101");
}
private List<TeamMateBilling> CreateTeamMateBilling() {
List<TeamMateBilling> data = new ArrayList<>();
private List<BillingDetails> CreateTeamMateBilling() {
List<BillingDetails> data = new ArrayList<>();
TeamMateBilling team1 = new TeamMateBilling();
BillingDetails team1 = new BillingDetails();
team1.setId(new ObjectId("5976ef15874c902c98b8a05d"));
team1.setEmployeeId("16127");
team1.setEmployeeName("Employee1");
......@@ -297,7 +299,7 @@ public class ProjectTeamControllerTest {
team1.setActive(true);
data.add(team1);
TeamMateBilling team2 = new TeamMateBilling();
BillingDetails team2 = new BillingDetails();
team2.setId(new ObjectId("1976ef15874c902c98b8a05d"));
team2.setEmployeeId("16128");
team2.setEmployeeName("Employee2");
......
......@@ -55,7 +55,8 @@ public class UserControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", null, null, "user@nisum.com", null,
null, null, null, null, null, null, null, null, null, null,
null, null, new Date(2017 - 11 - 20), new Date(2017 - 12 - 23));
null, null, new Date(2017 - 11 - 20), new Date(2017 - 12 - 23),
null, null);
when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -71,7 +72,7 @@ public class UserControllerTest {
"user1@nisum.com", "HR", "Human Resource Lead", "06:00-09:00",
"Java/J2EE", "Spring", "8767893452", "5687234567",
"user1@gmail.com", null, null, null, null, null,
new Date(2017 - 11 - 20), new Date(2017 - 12 - 23));
new Date(2017 - 11 - 20), new Date(2017 - 12 - 23), null, null);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole);
when(userService.assigingEmployeeRole(anyObject()))
......@@ -90,7 +91,7 @@ public class UserControllerTest {
"user2@nisum.com", "Manager", "Senior Software Engineer",
"09:00am-06:00am", "php", "Hibernate", "9878678956",
"9989782210", "user2@gmail.com", null, null, null, null, null,
new Date(2017 - 11 - 20), new Date(2017 - 12 - 23));
new Date(2017 - 11 - 20), new Date(2017 - 12 - 23), null, null);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole2);
when(userService.updateEmployeeRole(anyObject()))
......@@ -124,7 +125,8 @@ public class UserControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", "16127", null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20));
null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20), null,
null);
when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole);
mockMvc.perform(get("/user/getEmployeeRoleData").param("empId", "16127")
......@@ -140,7 +142,8 @@ public class UserControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", "16209", null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20));
null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20), null,
null);
when(userService.getEmployeeRoleDataForSearchCriteria("dummy@nisum.com",
"emailId")).thenReturn(employeesRole);
mockMvc.perform(get("/user/getEmployeeRoleDataForSearchCriteria")
......@@ -160,7 +163,8 @@ public class UserControllerTest {
EmployeeRoles employeesRole = new EmployeeRoles(
"5976ef15874c902c98b8a05d", "16209", null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20));
null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20), null,
null);
when(userService.getEmployeeRoleDataForSearchCriteria(
"Mahesh Kumar Gutam", "employeeName"))
.thenReturn(employeesRole);
......@@ -247,7 +251,8 @@ public class UserControllerTest {
"msrivastava@nisum.com", "Employee", "Software Engineer",
"09:00-06:00", "Java/J2EE", "Spring", "8765588388",
"9978567723", "msrivastava@gmail.com", null, null, null, null,
null, new Date(2017 - 01 - 01), new Date(2017 - 03 - 01));
null, new Date(2017 - 01 - 01), new Date(2017 - 03 - 01), null,
null);
System.out.println(employeeRole);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole);
......
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