Commit d19eb1de authored by Rajeshekar's avatar Rajeshekar

MT-51: Added Dashboard show billable details

parent b89c156d
...@@ -220,6 +220,17 @@ public class ProjectTeamController { ...@@ -220,6 +220,17 @@ public class ProjectTeamController {
return new ResponseEntity<>(billings, HttpStatus.OK); return new ResponseEntity<>(billings, HttpStatus.OK);
} }
@RequestMapping(value = "/getEmployeeBillingDetailsAll",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<BillingDetails>> getEmployeeBillingDetailsAll(
@RequestParam("employeeId") String employeeId)
throws MyTimeException {
List<BillingDetails> billings = projectService
.getEmployeeBillingDetailsAll(employeeId);
return new ResponseEntity<>(billings, HttpStatus.OK);
}
@RequestMapping(value = "/addEmployeeBilling", method = RequestMethod.POST, @RequestMapping(value = "/addEmployeeBilling", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
......
...@@ -24,9 +24,6 @@ import lombok.ToString; ...@@ -24,9 +24,6 @@ import lombok.ToString;
@Document(collection = "EmployeeDetails") @Document(collection = "EmployeeDetails")
public class EmployeeRoles implements Serializable { public class EmployeeRoles implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
...@@ -88,6 +85,9 @@ public class EmployeeRoles implements Serializable { ...@@ -88,6 +85,9 @@ public class EmployeeRoles implements Serializable {
@DateTimeFormat(iso = ISO.DATE) @DateTimeFormat(iso = ISO.DATE)
private Date dateOfBirth; private Date dateOfBirth;
@ExcelCellName("Gender")
private String gender;
@ExcelCellName("Created") @ExcelCellName("Created")
private Date createdOn; private Date createdOn;
......
...@@ -70,4 +70,6 @@ public interface ProjectService { ...@@ -70,4 +70,6 @@ public interface ProjectService {
String projectId); String projectId);
List<BillingDetails> getEmployeeActiveNisumBench(String empId); List<BillingDetails> getEmployeeActiveNisumBench(String empId);
List<BillingDetails> getEmployeeBillingDetailsAll(String empId);
} }
...@@ -351,6 +351,26 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -351,6 +351,26 @@ public class ProjectServiceImpl implements ProjectService {
return billingsSorted; return billingsSorted;
} }
@Override
public List<BillingDetails> getEmployeeBillingDetailsAll(String empId) {
List<BillingDetails> billings = teamMatesBillingRepo
.findByEmployeeId(empId);
List<BillingDetails> billingsSorted = billings;
try {
billingsSorted = (billings == null || billings.size() == 0)
? billings
: billings.stream()
.sorted(Comparator
.comparing(BillingDetails::getCreateDate)
.reversed())
.collect(Collectors.toList());
} catch (Exception e) {
// TODO: handle exception
}
return billingsSorted;
}
@Override @Override
public List<BillingDetails> getEmployeeActiveBillingDetails(String empId, public List<BillingDetails> getEmployeeActiveBillingDetails(String empId,
String projectId) { String projectId) {
......
...@@ -11,35 +11,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -11,35 +11,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
"action":"" "action":""
}; };
/*private String employeeId;
private String employeeName;
private String emailId;
private String baseTechnology;
private String technologyKnown;
private String alternateMobileNumber;
private String personalEmailId;
private Date createdOn;
private Date lastModifiedOn;
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;
private boolean projectAssigned;
private boolean hasB1Visa;
private boolean hasH1Visa;
private boolean hasPassport*/
$scope.managers = []; $scope.managers = [];
var getCellActiveTemplate='<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>'; var getCellActiveTemplate='<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>';
...@@ -167,6 +139,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -167,6 +139,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
function ViewEmpController($scope, $mdDialog,dataToPass) { function ViewEmpController($scope, $mdDialog,dataToPass) {
$scope.profile = dataToPass; $scope.profile = dataToPass;
$scope.showOrHidePA="Show"; $scope.showOrHidePA="Show";
$scope.showOrHidePV="Show"; $scope.showOrHidePV="Show";
$scope.showOrHideBD="Show"; $scope.showOrHideBD="Show";
...@@ -198,8 +171,8 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -198,8 +171,8 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
{field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false}, {field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false},
{field : 'managerName',displayName: 'Manager Name', enableColumnMenu: false, enableSorting: false}, {field : 'managerName',displayName: 'Manager Name', enableColumnMenu: false, enableSorting: false},
{field : 'billableStatus',displayName: 'Billability', enableColumnMenu: false, enableSorting: false}, {field : 'billableStatus',displayName: 'Billability', enableColumnMenu: false, enableSorting: false},
{field : 'startDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false}, {field : 'startDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"'},
{field : 'endDate',displayName: 'End Date', enableColumnMenu: false, enableSorting: false}, {field : 'endDate',displayName: 'End Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"' },
{field : 'active',displayName: 'Active', enableColumnMenu: false,cellTemplate:getCellActiveTemplate,enableSorting: false} {field : 'active',displayName: 'Active', enableColumnMenu: false,cellTemplate:getCellActiveTemplate,enableSorting: false}
] ]
}; };
...@@ -237,21 +210,44 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -237,21 +210,44 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}, },
{ {
field: 'billingEndDate', field: 'billingEndDate',
displayName: 'End Date' displayName: 'End Date',
cellFilter: 'date:"dd-MMM-yyyy"'
}, },
{field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false}, {field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false},
{field : 'active',displayName: 'Active',enableColumnMenu: false, enableSorting: false,cellTemplate:getCellActiveTemplateBilling,enableCellEdit: false} {field : 'active',displayName: 'Active',enableColumnMenu: false, enableSorting: false,cellTemplate:getCellActiveTemplateBilling,enableCellEdit: false}
] ]
}; };
$http({
method : "GET",
url : appConfig.appUri + "projectTeam/getEmployeeBillingDetailsAll?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
$scope.gridOptionsEmpBillability.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
$http({
method : "GET",
url : appConfig.appUri + "projectTeam/getMyProjectAllocations?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
$scope.gridOptionsProjectAllocatons.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
//$scope.gridOptionsProjectAllocatons.data = $scope.dataToPass;
//$scope.gridOptionsEmpBillability.data = $scope.dataToPass;
// $scope.gridOptionsVisaDetails.data = $scope.dataToPass;
$scope.gridOptionsProjectAllocatons.data = $scope.dataToPass;
$scope.gridOptionsEmpBillability.data = $scope.dataToPass;
$scope.cancel = function() { $scope.cancel = function() {
$mdDialog.hide(); $mdDialog.hide();
}; };
$scope.toggleBillability = function() { $scope.toggleBillability = function() {
$scope.showBillable = !$scope.showBillable; $scope.showBillable = !$scope.showBillable;
if($scope.showOrHideBD=="Show"){ if($scope.showOrHideBD=="Show"){
$scope.showOrHideBD="Hide"; $scope.showOrHideBD="Hide";
}else { }else {
......
...@@ -179,9 +179,10 @@ ...@@ -179,9 +179,10 @@
</div> </div>
</div> </div>
</div><br/><br/> </div><br/><br/>
<div id="gridEmpVisa" ui-grid="gridOptionsVisaDetails" <div id="gridEmpVisa" ui-grid="gridOptionsVisaDetails"
class="myGrid" style="width:99%;height:200px;"> class="myGrid" style="width:99%;height:200px;">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptionsVisaDetails.data.length">No
data available</div> data available</div>
</div> </div>
</div> </div>
...@@ -195,7 +196,7 @@ ...@@ -195,7 +196,7 @@
<div id="gridProjectAllocatons" ui-grid="gridOptionsProjectAllocatons" <div id="gridProjectAllocatons" ui-grid="gridOptionsProjectAllocatons"
class="myGrid" style="width:99%;height:200px;" ng-show="showProjectAllocations"> class="myGrid" style="width:99%;height:200px;" ng-show="showProjectAllocations">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptionsProjectAllocatons.data.length">No
data available</div> data available</div>
</div> </div>
</div> </div>
...@@ -203,18 +204,20 @@ ...@@ -203,18 +204,20 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend style="font-size: 18px;">Billability Details <i style="margin-top:3px;color:blue;cursor:pointer;font-size: 14px;" ng-click="toggleBillability()">{{showOrHideBD}}</i></legend> <legend style="font-size: 18px;">Billability Details <i style="margin-top:3px;color:blue;cursor:pointer;font-size: 14px;" ng-click="toggleBillability()">{{showOrHideBD}}</i></legend>
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridEmpBillability" ui-grid="gridOptionsEmpBillability" <div id="gridEmpBillability" ui-grid="gridOptionsEmpBillability"
class="myGrid" style="width:99%;height:200px;" ng-show="showBillable"> class="myGrid" style="width:99%;height:200px;" ng-show="showBillable">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptionsEmpBillability.data.length">No
data available</div> data available</div>
</div> </div>
</div>
<br/><br/> <br/><br/>
</fieldset> </fieldset>
</div> </div>
</div>
</div>
</div> </div>
</md-dialog-content> </md-dialog-content>
......
...@@ -59,7 +59,7 @@ public class ProjectControllerTest { ...@@ -59,7 +59,7 @@ public class ProjectControllerTest {
"5976ef15874c902c98b8a05d", null, null, "user@nisum.com", null, "5976ef15874c902c98b8a05d", null, null, "user@nisum.com", null,
null, null, null, null, null, null, null, null, null, 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); null, null, null);
when(userService.getEmployeesRole("user@nisum.com")) when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
mockMvc.perform( mockMvc.perform(
...@@ -133,7 +133,7 @@ public class ProjectControllerTest { ...@@ -133,7 +133,7 @@ public class ProjectControllerTest {
"5976ef15874c902c98b8a05d", "16127", null, null, null, null, "5976ef15874c902c98b8a05d", "16127", null, null, null, null,
null, null, null, null, null, null, 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, null, new Date(2017 - 11 - 18), new Date(2017 - 12 - 18), null,
null); null, null);
when(userService.getEmployeesRoleData("16127")) when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
mockMvc.perform( mockMvc.perform(
......
...@@ -24,10 +24,10 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; ...@@ -24,10 +24,10 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.nisum.mytime.controller.ProjectTeamController; import com.nisum.mytime.controller.ProjectTeamController;
import com.nisum.mytime.model.BillingDetails;
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.model.BillingDetails;
import com.nisum.mytime.service.ProjectService; import com.nisum.mytime.service.ProjectService;
import com.nisum.mytime.service.UserService; import com.nisum.mytime.service.UserService;
...@@ -57,7 +57,7 @@ public class ProjectTeamControllerTest { ...@@ -57,7 +57,7 @@ public class ProjectTeamControllerTest {
"5976ef15874c902c98b8a05d", null, null, null, null, null, null, "5976ef15874c902c98b8a05d", null, null, null, null, null, null,
null, null, null, null, null, null, "user@nisum.com", 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); null, null, null);
when(userService.getEmployeesRole("user@nisum.com")) when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
mockMvc.perform( mockMvc.perform(
...@@ -92,7 +92,7 @@ public class ProjectTeamControllerTest { ...@@ -92,7 +92,7 @@ public class ProjectTeamControllerTest {
"vsingh@nisum.com", "Manager", null, "09:00-06:00", "Java/J2EE", "vsingh@nisum.com", "Manager", null, "09:00-06:00", "Java/J2EE",
"Testing", "8755672341", "8800543678", "vsingh@gmail.com", null, "Testing", "8755672341", "8800543678", "vsingh@gmail.com", null,
null, null, null, null, new Date(2017 - 11 - 29), null, null, null, null, new Date(2017 - 11 - 29),
new Date(2017 - 12 - 20), null, null); new Date(2017 - 12 - 20), null, null, null);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeesRoles2); String jsonString = mapper.writeValueAsString(employeesRoles2);
when(userService.updateEmployeeRole(any())).thenReturn(employeesRoles2); when(userService.updateEmployeeRole(any())).thenReturn(employeesRoles2);
...@@ -117,7 +117,7 @@ public class ProjectTeamControllerTest { ...@@ -117,7 +117,7 @@ public class ProjectTeamControllerTest {
"5976ef15874c902c98b8a05d", "16127", null, null, null, null, "5976ef15874c902c98b8a05d", "16127", null, null, null, null,
null, null, null, null, null, null, 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, null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23), null,
null); null, null);
when(userService.getEmployeesRoleData("16127")) when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
mockMvc.perform( mockMvc.perform(
......
...@@ -56,7 +56,7 @@ public class UserControllerTest { ...@@ -56,7 +56,7 @@ public class UserControllerTest {
"5976ef15874c902c98b8a05d", null, null, "user@nisum.com", null, "5976ef15874c902c98b8a05d", null, null, "user@nisum.com", null,
null, null, null, null, null, null, null, null, null, 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); null, null, null);
when(userService.getEmployeesRole("user@nisum.com")) when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
mockMvc.perform( mockMvc.perform(
...@@ -72,7 +72,8 @@ public class UserControllerTest { ...@@ -72,7 +72,8 @@ public class UserControllerTest {
"user1@nisum.com", "HR", "Human Resource Lead", "06:00-09:00", "user1@nisum.com", "HR", "Human Resource Lead", "06:00-09:00",
"Java/J2EE", "Spring", "8767893452", "5687234567", "Java/J2EE", "Spring", "8767893452", "5687234567",
"user1@gmail.com", null, null, null, null, null, "user1@gmail.com", 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,
null);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole); String jsonString = mapper.writeValueAsString(employeeRole);
when(userService.assigingEmployeeRole(anyObject())) when(userService.assigingEmployeeRole(anyObject()))
...@@ -91,7 +92,8 @@ public class UserControllerTest { ...@@ -91,7 +92,8 @@ public class UserControllerTest {
"user2@nisum.com", "Manager", "Senior Software Engineer", "user2@nisum.com", "Manager", "Senior Software Engineer",
"09:00am-06:00am", "php", "Hibernate", "9878678956", "09:00am-06:00am", "php", "Hibernate", "9878678956",
"9989782210", "user2@gmail.com", null, null, null, null, null, "9989782210", "user2@gmail.com", 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,
null);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole2); String jsonString = mapper.writeValueAsString(employeeRole2);
when(userService.updateEmployeeRole(anyObject())) when(userService.updateEmployeeRole(anyObject()))
...@@ -126,7 +128,7 @@ public class UserControllerTest { ...@@ -126,7 +128,7 @@ public class UserControllerTest {
"5976ef15874c902c98b8a05d", "16127", null, null, null, null, "5976ef15874c902c98b8a05d", "16127", null, null, null, null,
null, null, null, null, null, null, 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, null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20), null,
null); null, null);
when(userService.getEmployeesRoleData("16127")) when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
mockMvc.perform(get("/user/getEmployeeRoleData").param("empId", "16127") mockMvc.perform(get("/user/getEmployeeRoleData").param("empId", "16127")
...@@ -143,7 +145,7 @@ public class UserControllerTest { ...@@ -143,7 +145,7 @@ public class UserControllerTest {
"5976ef15874c902c98b8a05d", "16209", null, null, null, null, "5976ef15874c902c98b8a05d", "16209", null, null, null, null,
null, null, null, null, null, null, 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, null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20), null,
null); null, null);
when(userService.getEmployeeRoleDataForSearchCriteria("dummy@nisum.com", when(userService.getEmployeeRoleDataForSearchCriteria("dummy@nisum.com",
"emailId")).thenReturn(employeesRole); "emailId")).thenReturn(employeesRole);
mockMvc.perform(get("/user/getEmployeeRoleDataForSearchCriteria") mockMvc.perform(get("/user/getEmployeeRoleDataForSearchCriteria")
...@@ -164,7 +166,7 @@ public class UserControllerTest { ...@@ -164,7 +166,7 @@ public class UserControllerTest {
"5976ef15874c902c98b8a05d", "16209", null, null, null, null, "5976ef15874c902c98b8a05d", "16209", null, null, null, null,
null, null, null, null, null, null, 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, null, new Date(2017 - 11 - 13), new Date(2017 - 12 - 20), null,
null); null, null);
when(userService.getEmployeeRoleDataForSearchCriteria( when(userService.getEmployeeRoleDataForSearchCriteria(
"Mahesh Kumar Gutam", "employeeName")) "Mahesh Kumar Gutam", "employeeName"))
.thenReturn(employeesRole); .thenReturn(employeesRole);
...@@ -252,7 +254,7 @@ public class UserControllerTest { ...@@ -252,7 +254,7 @@ public class UserControllerTest {
"09:00-06:00", "Java/J2EE", "Spring", "8765588388", "09:00-06:00", "Java/J2EE", "Spring", "8765588388",
"9978567723", "msrivastava@gmail.com", null, null, null, null, "9978567723", "msrivastava@gmail.com", null, null, null, null,
null, new Date(2017 - 01 - 01), new Date(2017 - 03 - 01), null, null, new Date(2017 - 01 - 01), new Date(2017 - 03 - 01), null,
null); null, null);
System.out.println(employeeRole); System.out.println(employeeRole);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole); 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