Unverified Commit 260287c4 authored by mshaik-nisum-com's avatar mshaik-nisum-com Committed by GitHub

Merge pull request #165 from nisum-inc/MT-173

Updated remaning columns in db , added validations as per story
parents abbff955 8b874918
...@@ -208,8 +208,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -208,8 +208,9 @@ public class ProjectServiceImpl implements ProjectService {
for (ProjectTeamMate existingTeammate : existingTeammates) { for (ProjectTeamMate existingTeammate : existingTeammates) {
existingTeammate.setActive(false); existingTeammate.setActive(false);
existingTeammate.setEndDate(project.getProjectEndDate()); existingTeammate.setEndDate(project.getProjectEndDate());
projectTeamMatesRepo.save(existingTeammate);
BillingDetails billingDetails = new BillingDetails(); BillingDetails billingDetails = new BillingDetails();
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
billingDetails.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS); billingDetails.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
List<BillingDetails> listBD = getEmployeeActiveBillingDetails(existingTeammate.getEmployeeId(), List<BillingDetails> listBD = getEmployeeActiveBillingDetails(existingTeammate.getEmployeeId(),
existingTeammate.getProjectId()); existingTeammate.getProjectId());
...@@ -219,6 +220,7 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -219,6 +220,7 @@ public class ProjectServiceImpl implements ProjectService {
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting);
} }
Project benchProject = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
Date sd = project.getProjectEndDate(); Date sd = project.getProjectEndDate();
billingDetails.setBillingStartDate(sd); billingDetails.setBillingStartDate(sd);
billingDetails.setAccount(MyTimeUtils.BENCH_ACCOUNT); billingDetails.setAccount(MyTimeUtils.BENCH_ACCOUNT);
...@@ -228,13 +230,18 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -228,13 +230,18 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setCreateDate(new Date()); billingDetails.setCreateDate(new Date());
billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID); billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
billingDetails.setProjectName(MyTimeUtils.FREE_POLL); billingDetails.setProjectName(MyTimeUtils.FREE_POLL);
if (benchProject != null) {
billingDetails.setBillingEndDate(benchProject.getProjectEndDate());
newBenchAllocation.setAccountId(benchProject.getAccountId());
newBenchAllocation.setProjectName(benchProject.getProjectName());
newBenchAllocation.setDomainId(benchProject.getDomainId());
newBenchAllocation.setEndDate(benchProject.getProjectEndDate());
}
addEmployeeBillingDetails(billingDetails); addEmployeeBillingDetails(billingDetails);
projectTeamMatesRepo.save(existingTeammate); newBenchAllocation.setRole(existingTeammate.getRole());
ProjectTeamMate newBenchAllocation = new ProjectTeamMate(); newBenchAllocation.setAccount(MyTimeUtils.BENCH_ACCOUNT);
Project benchProject = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID); newBenchAllocation.setShift(existingTeammate.getShift());
if (benchProject != null)
newBenchAllocation.setAccountId(benchProject.getAccountId());
newBenchAllocation.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS); newBenchAllocation.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
newBenchAllocation.setDesignation(existingTeammate.getDesignation()); newBenchAllocation.setDesignation(existingTeammate.getDesignation());
newBenchAllocation.setEmailId(existingTeammate.getEmailId()); newBenchAllocation.setEmailId(existingTeammate.getEmailId());
...@@ -243,7 +250,6 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -243,7 +250,6 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName()); newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId(MyTimeUtils.BENCH_PROJECT_ID); newBenchAllocation.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
newBenchAllocation.setStartDate(sd); newBenchAllocation.setStartDate(sd);
newBenchAllocation.setProjectName(benchProject.getProjectName());
projectTeamMatesRepo.save(newBenchAllocation); projectTeamMatesRepo.save(newBenchAllocation);
updateShiftDetails(existingTeammate); updateShiftDetails(existingTeammate);
} }
...@@ -852,10 +858,12 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -852,10 +858,12 @@ public class ProjectServiceImpl implements ProjectService {
cal.setTime(d); cal.setTime(d);
cal.add(Calendar.DAY_OF_MONTH, -1); cal.add(Calendar.DAY_OF_MONTH, -1);
Date oneDayLess = cal.getTime(); Date oneDayLess = cal.getTime();
if (teamMate.getNewBillingStartDate().getDate() == projectTeamMate.getNewBillingStartDate().getDate()) { if(null != teamMate.getNewBillingStartDate()){
teamMate.setEndDate(DateUtils.truncate(projectTeamMate.getEndDate(), Calendar.DATE)); if (teamMate.getNewBillingStartDate().getDate() == projectTeamMate.getNewBillingStartDate().getDate()) {
} else { teamMate.setEndDate(DateUtils.truncate(projectTeamMate.getEndDate(), Calendar.DATE));
}
}else {
teamMate.setEndDate(DateUtils.truncate(oneDayLess, Calendar.DATE)); teamMate.setEndDate(DateUtils.truncate(oneDayLess, Calendar.DATE));
} }
teamMate.setActive(false); teamMate.setActive(false);
......
...@@ -33,8 +33,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -33,8 +33,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-users fa-2x" aria-hidden="true" style="font-size:1.4em;margin-top:3px;cursor:pointer;" data-placement="center" title="View" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.getRowData(row,\'View\')" ></i>' + var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-users fa-2x" aria-hidden="true" style="font-size:1.4em;margin-top:3px;cursor:pointer;" ng-class="{ \'my-css-class\': grid.appScope.rowFormatter( row ) }" data-placement="center" title="View" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.getRowData(row,\'View\')" ></i>' +
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i ng-show="row.entity.projectName == \'Bench\'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</i><i ng-show="row.entity.projectName != \'Bench\'" class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="center" title="Edit" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.getRowData(row,\'Update\')"></i></p>' ; '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i ng-show="row.entity.projectName != \'Bench\' && row.entity.status == \'Active\'" class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="center" title="Edit" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.getRowData(row,\'Update\')"></i></p>' ;
// '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="left" title="Delete" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>' // '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="left" title="Delete" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>'
...@@ -56,7 +56,11 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -56,7 +56,11 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
] ]
}; };
$scope.gridOptions.data = $scope.records; $scope.gridOptions.data = $scope.records;
$scope.rowFormatter = function( row ) {
return (row.entity.status == 'Active' && row.entity.projectName != "Bench");
};
$scope.getRowData = function (row, action) { $scope.getRowData = function (row, action) {
console.log(row.entity); console.log(row.entity);
$scope.parentData.projectId = row.entity.projectId; $scope.parentData.projectId = row.entity.projectId;
...@@ -1135,7 +1139,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1135,7 +1139,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
} }
else if (!(($scope.newBillingStartDate >= $scope.startDate) && ($scope.newBillingStartDate <= $scope.endDate)) && action == "Update"){ else if (!(($scope.newBillingStartDate >= $scope.startDate) && ($scope.newBillingStartDate <= $scope.endDate)) && action == "Update"){
$scope.alertMsg = $scope.empBillableStatus + " start date should be in between start date and end date"; $scope.alertMsg = $scope.empBillableStatus + " start date should be in between start date and end date";
}else if($scope.endDate > dataToPass.projectEndDate){ }else if($scope.endDate > new Date(dataToPass.projectEndDate)){
$scope.alertMsg = "End date should not exceed project end date"; $scope.alertMsg = "End date should not exceed project end date";
} }
else { else {
...@@ -1470,6 +1474,12 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1470,6 +1474,12 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
url: appConfig.appUri + "/projectTeam/getProjectDetails?projectId=" + projectId + "&status=" +status url: appConfig.appUri + "/projectTeam/getProjectDetails?projectId=" + projectId + "&status=" +status
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
if(status == "InActive" || status == "Both"|| dataToPass.status == "InActive"){
$scope.gridOptions.columnDefs[5].visible = false;
}
else{
$scope.gridOptions.columnDefs[5].visible = true;
}
for(i=0;i<$scope.gridOptions.data.length;i++){ for(i=0;i<$scope.gridOptions.data.length;i++){
if($scope.gridOptions.data[i].role == 'Lead'){ if($scope.gridOptions.data[i].role == 'Lead'){
$scope.gridOptions.data[i].role = "Lead"; $scope.gridOptions.data[i].role = "Lead";
......
...@@ -232,4 +232,7 @@ md-select { ...@@ -232,4 +232,7 @@ md-select {
.manageGroup{ .manageGroup{
padding-left: 15px; padding-left: 15px;
list-style: none; list-style: none;
}
.my-css-class{
margin-left: 20px;
} }
\ No newline at end of file
...@@ -182,11 +182,12 @@ myApp.factory('myFactory', function() { ...@@ -182,11 +182,12 @@ myApp.factory('myFactory', function() {
function sortObjectBasedOnKeys(unordered){ function sortObjectBasedOnKeys(unordered){
var ordered = {}; var ordered = {};
Object.keys(unordered).sort().forEach(function(key) { Object.keys(unordered).sort().forEach(function(key) {
ordered[key] = unordered[key]; if(Array.isArray(unordered[key])){
ordered[key] = unordered[key].sort();
}
ordered[key] = unordered[key];
}); });
console.log(ordered); return ordered;
return ordered;
} }
function addFormDataCheck(form){ function addFormDataCheck(form){
......
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