Commit 7a6fdf36 authored by Prayas Jain's avatar Prayas Jain

Added Utilization Reports Enhancements

parent 2dae5af4
......@@ -165,9 +165,8 @@ public class EmployeeService implements IEmployeeService {
// }
@Override
@Transactional
public Employee updateEmployee(Employee employeeReq, String loginEmpId) throws ParseException {
response.put("messege" , "Employee has been updated");
// update all emp details to inactive if employee is inactive
Query query = new Query(Criteria.where("employeeId").is(employeeReq.getEmployeeId()));
Update update = new Update();
......@@ -245,7 +244,7 @@ public class EmployeeService implements IEmployeeService {
if(employeeReq.getEmpStatus().equals("In Active")){
resourceService.makeResourceInactive(employeeReq.getEmployeeId(),employeeReq.getEndDate());
}
response.put("messege" , "Employee has been updated");
return employeeUpdated;
}
......
......@@ -1142,15 +1142,16 @@ public class ResourceService implements IResourceService {
@Override
public Resource makeResourceInactive(String employeeId,Date endDate){
Resource latestAllocation = this.getLatestResourceByEmpId(employeeId);
Resource currentAllocation = this.getCurrentAllocationIfNotReturnNull(employeeId);
if(Objects.nonNull(latestAllocation) && latestAllocation.getBillingStartDate().compareTo(new Date())>0){
resourceRepo.delete(latestAllocation);
Resource futureAllocation = resourceRepo.findOneByEmployeeIdAndStatus(employeeId, MyTeamUtils.STATUS_PROPOSED);
Resource currentAllocation = resourceRepo.findOneByEmployeeIdAndStatus(employeeId, MyTeamUtils.STATUS_ENGAGED);
if(Objects.nonNull(futureAllocation)){
resourceRepo.delete(futureAllocation);
}
if(Objects.nonNull(currentAllocation)) {
currentAllocation.setBillingEndDate(endDate);
currentAllocation.setStatus(MyTeamUtils.STATUS_RELEASED);
resourceRepo.save(currentAllocation);
}
currentAllocation.setBillingEndDate(endDate);
latestAllocation.setBillingEndDate(endDate);
resourceRepo.save(currentAllocation);
resourceRepo.save(latestAllocation);
return null;
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ myApp.directive('hcPieChart', function () {
if(reportType && searchedDate) {
scope.errorMessage =false;
if(reportType == "Monthly Trends"){
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element," Billability Monthly Trends");
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element,"Billability Monthly Trends");
}
else {
if(reportType=='I&A'){
......@@ -54,7 +54,8 @@ myApp.directive('hcPieChart', function () {
method: "GET",
url: appConfig.appUri + "functionalGroups/getAllFunctionalGroups"
}).then(function mySuccess(response) {
$scope.reportTypeList = $scope.reportTypeList.concat(response.data.records);
let functionalGrpsList = $scope.reportTypeList.concat(response.data.records);
$scope.reportTypeList = functionalGrpsList.filter(e => e !== 'Delivery Org' && e !== 'Global Mobility');
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -126,7 +127,8 @@ myApp.directive('hcPieChart', function () {
$scope.getMyTeamDetails = function(seriesName, category, optionName,title){
let searchedDate = getFormattedDate($scope.searchedReportDate);
if(title.trim() == 'Billability For All Functional Group'){
if(title.trim() == 'Billability For All Functional Group On '+searchedDate ||
title.trim() == 'Billability For All Functional Group On Today' ){
if(category=='I&A'){
category = 'I%26A';
}
......@@ -145,7 +147,8 @@ myApp.directive('hcPieChart', function () {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}else if(title.trim() == 'Billability For Account'){
}else if(title.trim() == 'Billability For Account On '+ searchedDate ||
title.trim() == 'Billability For Account On Today'){
$http({
method : "GET",
url : appConfig.appUri + "reports/fetchEmployeeDetailsByAccountBillability?account="+category+"&billabilityStatus="+seriesName+"&onDate="+searchedDate
......@@ -284,6 +287,14 @@ myApp.directive('hcPieChart', function () {
function getEmployeeDetails(scope,uri,chart,element,title){
var result = [];
var categoriesList = [];
let displayTitle = '';
if(title === 'Billability Monthly Trends') {
displayTitle = title;
}
else {
displayTitle = getFormattedDate(scope.searchedReportDate) == getFormattedDate(new Date()) ? title+ " On Today" : title+ " On " +getFormattedDate(scope.searchedReportDate);
}
Highcharts.ajax({
url: uri,
success: function(data) {
......@@ -294,7 +305,7 @@ var categoriesList = [];
result = data;
categoriesList = data;
}
scope.drawChart(element,chart,result,title,categoriesList);
scope.drawChart(element,chart,result,displayTitle,categoriesList);
}
});
}
......
......@@ -715,14 +715,17 @@ cursor: pointer;
.manage-open-pool {
height: calc(100vh - 239px) !important;
}
.add-space {
margin: 20px 0 10px 0;
.select-report-date-container {
margin: 20px 0 10px 0;
}
.select-report-date-container > div {
margin: 25px 0 10px 0;
}
.search-report-date {
padding-left:0;
}
.search-report-date .md-datepicker-input-container {
width: 74%;
width: 72%;
margin:0;
}
......@@ -732,18 +735,13 @@ margin: 20px 0 10px 0;
.report-type-selectbox{
padding-right:0;
}
.date-container {
margin-top: 25px;
}
.select-report-type md-select {
margin:0;
}
.report-type-label {
padding-right: 0;
}
.report-search-date-label {
padding: 0 0 0 8px;
}
.search-report-btn {
margin-left:15px;
padding:4px;
......
......@@ -8,7 +8,7 @@
<div class ="col-lg-6 col-md-6">
<hc-pie-chart title="Browser usage" data="pieData" options="chartOptions">Placeholder for pie chart</hc-pie-chart>
</div>
<div class="col-lg-6 col-md-6 add-space">
<div class="col-lg-6 col-md-6 select-report-date-container">
<div class="row add-space">
<div class="col-lg-4 col-md-4"></div>
<div class= "col-lg-8 col-md-8">
......@@ -22,7 +22,7 @@
</div>
</div>
</div>
<div class="row date-container">
<div class="row">
<div class="col-lg-4 col-md-4"></div>
<div class="col-lg-8 col-md-8 select-report-type">
<div class="row">
......@@ -38,7 +38,7 @@
</div>
</div>
</div>
<div class="row date-container">
<div class="row">
<div class="col-lg-4 col-md-4"></div>
<div class="col-lg-8 col-md-3">
<div class="row">
......
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