Updated remaning columns in db , added validations as per story

parent abbff955
......@@ -208,8 +208,9 @@ public class ProjectServiceImpl implements ProjectService {
for (ProjectTeamMate existingTeammate : existingTeammates) {
existingTeammate.setActive(false);
existingTeammate.setEndDate(project.getProjectEndDate());
projectTeamMatesRepo.save(existingTeammate);
BillingDetails billingDetails = new BillingDetails();
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
billingDetails.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
List<BillingDetails> listBD = getEmployeeActiveBillingDetails(existingTeammate.getEmployeeId(),
existingTeammate.getProjectId());
......@@ -219,6 +220,7 @@ public class ProjectServiceImpl implements ProjectService {
billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting);
}
Project benchProject = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
Date sd = project.getProjectEndDate();
billingDetails.setBillingStartDate(sd);
billingDetails.setAccount(MyTimeUtils.BENCH_ACCOUNT);
......@@ -228,13 +230,18 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setCreateDate(new Date());
billingDetails.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
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);
projectTeamMatesRepo.save(existingTeammate);
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
Project benchProject = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
if (benchProject != null)
newBenchAllocation.setAccountId(benchProject.getAccountId());
newBenchAllocation.setRole(existingTeammate.getRole());
newBenchAllocation.setAccount(MyTimeUtils.BENCH_ACCOUNT);
newBenchAllocation.setShift(existingTeammate.getShift());
newBenchAllocation.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
newBenchAllocation.setDesignation(existingTeammate.getDesignation());
newBenchAllocation.setEmailId(existingTeammate.getEmailId());
......@@ -243,7 +250,6 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
newBenchAllocation.setStartDate(sd);
newBenchAllocation.setProjectName(benchProject.getProjectName());
projectTeamMatesRepo.save(newBenchAllocation);
updateShiftDetails(existingTeammate);
}
......@@ -852,10 +858,12 @@ public class ProjectServiceImpl implements ProjectService {
cal.setTime(d);
cal.add(Calendar.DAY_OF_MONTH, -1);
Date oneDayLess = cal.getTime();
if (teamMate.getNewBillingStartDate().getDate() == projectTeamMate.getNewBillingStartDate().getDate()) {
teamMate.setEndDate(DateUtils.truncate(projectTeamMate.getEndDate(), Calendar.DATE));
} else {
if(null != teamMate.getNewBillingStartDate()){
if (teamMate.getNewBillingStartDate().getDate() == projectTeamMate.getNewBillingStartDate().getDate()) {
teamMate.setEndDate(DateUtils.truncate(projectTeamMate.getEndDate(), Calendar.DATE));
}
}else {
teamMate.setEndDate(DateUtils.truncate(oneDayLess, Calendar.DATE));
}
teamMate.setActive(false);
......
......@@ -34,7 +34,7 @@ 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>' +
'&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>'
......@@ -1135,7 +1135,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
}
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";
}else if($scope.endDate > dataToPass.projectEndDate){
}else if($scope.endDate > new Date(dataToPass.projectEndDate)){
$scope.alertMsg = "End date should not exceed project end date";
}
else {
......@@ -1470,6 +1470,12 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
url: appConfig.appUri + "/projectTeam/getProjectDetails?projectId=" + projectId + "&status=" +status
}).then(function mySuccess(response) {
$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++){
if($scope.gridOptions.data[i].role == 'Lead'){
$scope.gridOptions.data[i].role = "Lead";
......
......@@ -182,11 +182,12 @@ myApp.factory('myFactory', function() {
function sortObjectBasedOnKeys(unordered){
var ordered = {};
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){
......
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