Commit d19eb1de authored by Rajeshekar's avatar Rajeshekar

MT-51: Added Dashboard show billable details

parent b89c156d
......@@ -220,6 +220,17 @@ public class ProjectTeamController {
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,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
......
......@@ -24,74 +24,74 @@ import lombok.ToString;
@Document(collection = "EmployeeDetails")
public class EmployeeRoles implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@Id
private String id;
@Id
private String id;
@ExcelCellName("Employee ID")
private String employeeId;
@ExcelCellName("Employee ID")
private String employeeId;
@ExcelCellName("Employee Name")
private String employeeName;
@ExcelCellName("Employee Name")
private String employeeName;
@ExcelCellName("Email ID")
private String emailId;
@ExcelCellName("Email ID")
private String emailId;
@ExcelCellName("Role")
private String role;
@ExcelCellName("Role")
private String role;
@ExcelCellName("Designation")
private String designation;
@ExcelCellName("Designation")
private String designation;
@ExcelCellName("Shift")
private String shift;
@ExcelCellName("Shift")
private String shift;
@ExcelCellName("Primary Skill")
private String baseTechnology;
@ExcelCellName("Primary Skill")
private String baseTechnology;
@ExcelCellName("Domain")
private String domain;
@ExcelCellName("Domain")
private String domain;
@ExcelCellName("Location")
private String empLocation;
@ExcelCellName("Location")
private String empLocation;
@ExcelCellName("Skills")
private String technologyKnown;
@ExcelCellName("Skills")
private String technologyKnown;
@ExcelCellName("Primary Mobile")
private String mobileNumber;
@ExcelCellName("Primary Mobile")
private String mobileNumber;
@ExcelCellName("Alternate Mobile")
private String alternateMobileNumber;
@ExcelCellName("Alternate Mobile")
private String alternateMobileNumber;
@ExcelCellName("Personal Email")
private String personalEmailId;
@ExcelCellName("Personal Email")
private String personalEmailId;
@ExcelCellName("Functional Group")
private String functionalGroup;
@ExcelCellName("Functional Group")
private String functionalGroup;
@ExcelCellName("Employment Status")
private String empStatus;
@ExcelCellName("Employment Status")
private String empStatus;
@ExcelCellName("Employment Type")
private String employmentType;
@ExcelCellName("Employment Type")
private String employmentType;
@ExcelCellName("Date Of Joining")
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfJoining;
@ExcelCellName("Date Of Joining")
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfJoining;
@ExcelCellName("Date Of Birth")
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfBirth;
@ExcelCellName("Date Of Birth")
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfBirth;
@ExcelCellName("Created")
private Date createdOn;
@ExcelCellName("Gender")
private String gender;
@ExcelCellName("Last Modified")
private Date lastModifiedOn;
@ExcelCellName("Created")
private Date createdOn;
@ExcelCellName("Last Modified")
private Date lastModifiedOn;
}
......@@ -70,4 +70,6 @@ public interface ProjectService {
String projectId);
List<BillingDetails> getEmployeeActiveNisumBench(String empId);
List<BillingDetails> getEmployeeBillingDetailsAll(String empId);
}
......@@ -351,6 +351,26 @@ public class ProjectServiceImpl implements ProjectService {
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
public List<BillingDetails> getEmployeeActiveBillingDetails(String empId,
String projectId) {
......
......@@ -11,35 +11,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
"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 = [];
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
function ViewEmpController($scope, $mdDialog,dataToPass) {
$scope.profile = dataToPass;
$scope.showOrHidePA="Show";
$scope.showOrHidePV="Show";
$scope.showOrHideBD="Show";
......@@ -198,8 +171,8 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
{field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false},
{field : 'managerName',displayName: 'Manager Name', enableColumnMenu: false, enableSorting: false},
{field : 'billableStatus',displayName: 'Billability', enableColumnMenu: false, enableSorting: false},
{field : 'startDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false},
{field : 'endDate',displayName: 'End 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, cellFilter: 'date:"dd-MMM-yyyy"' },
{field : 'active',displayName: 'Active', enableColumnMenu: false,cellTemplate:getCellActiveTemplate,enableSorting: false}
]
};
......@@ -237,22 +210,45 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
},
{
field: 'billingEndDate',
displayName: 'End Date'
displayName: 'End Date',
cellFilter: 'date:"dd-MMM-yyyy"'
},
{field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false},
{field : 'active',displayName: 'Active',enableColumnMenu: false, enableSorting: false,cellTemplate:getCellActiveTemplateBilling,enableCellEdit: false}
]
};
$scope.gridOptionsProjectAllocatons.data = $scope.dataToPass;
$scope.gridOptionsEmpBillability.data = $scope.dataToPass;
$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.cancel = function() {
$mdDialog.hide();
};
$scope.toggleBillability = function() {
$scope.showBillable = !$scope.showBillable;
if($scope.showOrHideBD=="Show"){
$scope.showBillable = !$scope.showBillable;
if($scope.showOrHideBD=="Show"){
$scope.showOrHideBD="Hide";
}else {
$scope.showOrHideBD="Show";
......
......@@ -179,9 +179,10 @@
</div>
</div>
</div><br/><br/>
<div id="gridEmpVisa" ui-grid="gridOptionsVisaDetails"
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>
</div>
</div>
......@@ -195,7 +196,7 @@
<div id="gridProjectAllocatons" ui-grid="gridOptionsProjectAllocatons"
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>
</div>
</div>
......@@ -203,18 +204,20 @@
</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>
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridEmpBillability" ui-grid="gridOptionsEmpBillability"
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>
</div>
</div>
<br/><br/>
</fieldset>
</div>
</div>
</div>
</div>
</md-dialog-content>
......
......@@ -59,7 +59,7 @@ public class ProjectControllerTest {
"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);
null, null, null);
when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -133,7 +133,7 @@ public class ProjectControllerTest {
"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,
null);
null, null);
when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole);
mockMvc.perform(
......
......@@ -24,10 +24,10 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.nisum.mytime.controller.ProjectTeamController;
import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.service.ProjectService;
import com.nisum.mytime.service.UserService;
......@@ -57,7 +57,7 @@ public class ProjectTeamControllerTest {
"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);
null, null, null);
when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -92,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), null, null);
new Date(2017 - 12 - 20), null, null, null);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeesRoles2);
when(userService.updateEmployeeRole(any())).thenReturn(employeesRoles2);
......@@ -117,7 +117,7 @@ public class ProjectTeamControllerTest {
"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,
null);
null, null);
when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole);
mockMvc.perform(
......
......@@ -56,7 +56,7 @@ public class UserControllerTest {
"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);
null, null, null);
when(userService.getEmployeesRole("user@nisum.com"))
.thenReturn(employeesRole);
mockMvc.perform(
......@@ -72,7 +72,8 @@ 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), null, null);
new Date(2017 - 11 - 20), new Date(2017 - 12 - 23), null, null,
null);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole);
when(userService.assigingEmployeeRole(anyObject()))
......@@ -91,7 +92,8 @@ 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), null, null);
new Date(2017 - 11 - 20), new Date(2017 - 12 - 23), null, null,
null);
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(employeeRole2);
when(userService.updateEmployeeRole(anyObject()))
......@@ -126,7 +128,7 @@ public class UserControllerTest {
"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,
null);
null, null);
when(userService.getEmployeesRoleData("16127"))
.thenReturn(employeesRole);
mockMvc.perform(get("/user/getEmployeeRoleData").param("empId", "16127")
......@@ -143,7 +145,7 @@ public class UserControllerTest {
"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,
null);
null, null);
when(userService.getEmployeeRoleDataForSearchCriteria("dummy@nisum.com",
"emailId")).thenReturn(employeesRole);
mockMvc.perform(get("/user/getEmployeeRoleDataForSearchCriteria")
......@@ -164,7 +166,7 @@ public class UserControllerTest {
"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,
null);
null, null);
when(userService.getEmployeeRoleDataForSearchCriteria(
"Mahesh Kumar Gutam", "employeeName"))
.thenReturn(employeesRole);
......@@ -252,7 +254,7 @@ public class UserControllerTest {
"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,
null);
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