Commit 7559e41a authored by Prayas Jain's avatar Prayas Jain

Updated open pool controller

parent 64b7b7d9
...@@ -231,7 +231,7 @@ public class EmployeeController { ...@@ -231,7 +231,7 @@ public class EmployeeController {
List<Employee> employeesList = new ArrayList<>(); List<Employee> employeesList = new ArrayList<>();
if (empService.getActiveEmployees() != null) { if (empService.getActiveEmployees() != null) {
employeesList = empService.getActiveEmployees().stream() employeesList = empService.getActiveEmployees().stream()
.sorted((o1, o2) -> o1.getEmployeeName().compareTo(o2.getEmployeeName())) .sorted((o1, o2) -> o1.getEmployeeName().trim().compareTo(o2.getEmployeeName().trim()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
return new ResponseEntity<>(employeesList, HttpStatus.OK); return new ResponseEntity<>(employeesList, HttpStatus.OK);
......
...@@ -151,8 +151,6 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia ...@@ -151,8 +151,6 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia
var newIndex = $scope.gridOptions.data.indexOf(allRows[i].entity) var newIndex = $scope.gridOptions.data.indexOf(allRows[i].entity)
if(newIndex == $scope.previousRowIndex){ if(newIndex == $scope.previousRowIndex){
allRows[i].entity.billableStatus = $scope.previousRow.billableStatus; allRows[i].entity.billableStatus = $scope.previousRow.billableStatus;
allRows[i].entity.billingStartDate = $scope.previousRow.billingStartDate;
allRows[i].entity.billingEndDate = $scope.previousRow.billingEndDate;
$scope.previousRow = angular.copy(row.entity); $scope.previousRow = angular.copy(row.entity);
} }
} }
...@@ -162,32 +160,96 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia ...@@ -162,32 +160,96 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia
$scope.gridOptions.data[index].editrow = false; $scope.gridOptions.data[index].editrow = false;
row.billableStatus = $scope.parentData.billableStatus; row.billableStatus = $scope.parentData.billableStatus;
}; };
// $scope.saveRow = function (row,action) { $scope.DataUpdate = function () {
// var index = $scope.gridOptions.data.indexOf(row); var data = $scope.parentData;
// $scope.gridOptions.data[index].editrow = false; $scope.previousData = {
// $scope.employeeModel = { Billabilitystatus: data.billableStatus,
// 'employeeName': row.employeeName, },
// 'employeeId': row.employeeId, $scope.currentData = {
// 'designation': row.designation Billabilitystatus: $scope.empBillableStatus,
// }; }
// $scope.newBillingStartDate = row.billingStartDate; var predata = JSON.stringify($scope.previousData);
// $scope.endDate = row.billingEndDate; var curdata = JSON.stringify($scope.currentData);
// $scope.employeeRole = row.resourceRole; if (predata == curdata) {
// $scope.empBillableStatus = row.billableStatus; return false;
// $scope.empAllocationStatus = row.status; }
// $scope.aliasResourceName = row.onBehalfOf; return true;
// $scope.id = row.id; }
// if(action == 'Update'){ $scope.saveRow = function (row,action) {
// $scope.validateFields(action,row); var index = $scope.gridOptions.data.indexOf(row);
// if($scope.alertMsg != ""){ $scope.gridOptions.data[index].editrow = false;
// row.billingStartDate = $scope.parentData.newBillingStartDate; $scope.employeeName = row.employeeName;
// row.billingEndDate = $scope.parentData.endDate; $scope.projectId = row.projectId;
// row.resourceRole = $scope.parentData.role; $scope.employeeId = row.employeeId;
// row.billableStatus = $scope.parentData.billableStatus; $scope.designation = row.designation;
// } $scope.billingStartDate = row.billingStartDate;
// $scope.previousRow = angular.copy(row); $scope.billingEndDate = row.billingEndDate;
// } $scope.employeeRole = row.resourceRole;
// } $scope.empBillableStatus = row.billableStatus;
$scope.empAllocationStatus = row.status;
$scope.id = row.id;
var record = {"id":$scope.id,"employeeId":$scope.employeeId,"projectId":$scope.projectId,"billableStatus":$scope.empBillableStatus,"billingEndDate":$scope.billingEndDate,
"resourceRole":$scope.employeeRole,"billingStartDate":$scope.billingStartDate,"status":$scope.empAllocationStatus};
if(action == 'Update'){
if ($scope.DataUpdate() != true) {
$mdDialog.show($mdDialog.alert({
skipHide: true,
title: 'Attention',
textContent: 'There is no data change to Update',
ok: 'ok'
}))
}else {
updateOpenPoolRecord(record, action,row);
}
$scope.previousRow = angular.copy(row);
}
}
function updateOpenPoolRecord(record, action,row){
var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
var req = {
method : 'PUT',
url : urlRequest,
headers : {
"Content-type" : "application/json"
},
data : record
}
$http(req).then(function mySuccess(response) {
$scope.result = "Success";
if(response.data.message == "Resource updated successfully"){
$timeout(function () {
getOpenPoolRecords();
}, 500);
$mdDialog.show($mdDialog.alert({
skipHide: true,
textContent: response.data.message ,
ok: 'ok'
})).then(function () {
$scope.myForm.$setPristine();
})
}else{
$scope.alertMsg=response.data.message;
if($scope.alertMsg && $scope.alertMsg != ""){
row.billableStatus = $scope.parentData.billableStatus;
}
$scope.previousRow = angular.copy(row);
}
}, function myError(response){
$scope.result = "Error";
$mdDialog.show($mdDialog.alert({
skipHide: true,
textContent: "Something Went Wrong !!!" ,
ok: 'ok'
})).then(function () {
$scope.myForm.$setPristine();
})
row.billableStatus = $scope.parentData.billableStatus;
});
}
......
...@@ -657,6 +657,9 @@ cursor: pointer; ...@@ -657,6 +657,9 @@ cursor: pointer;
.manage-employee-efforts { .manage-employee-efforts {
height: calc(100vh - 260px) !important; height: calc(100vh - 260px) !important;
} }
.manage-open-pool {
height: calc(100vh - 230px) !important;
}
.md-datepicker-input-mask { .md-datepicker-input-mask {
height : 0px; height : 0px;
} }
...@@ -687,7 +690,6 @@ cursor: pointer; ...@@ -687,7 +690,6 @@ cursor: pointer;
.substatus-dropdown md-datepicker { .substatus-dropdown md-datepicker {
padding:0; padding:0;
} }
.substatus-dropdown >md-select { .substatus-dropdown >md-select {
margin:0; margin:0;
} }
......
...@@ -15,11 +15,14 @@ ...@@ -15,11 +15,14 @@
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-exporter <div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-exporter
class="myGrid grid-full-view"> class="myGrid manage-open-pool">
<div class="watermark" ng-show="!gridOptions.data.length">No <div class="watermark" ng-show="!gridOptions.data.length">No
data available</div> data available</div>
</div> </div>
</div> </div>
</div> </div>
<div role="alert" class="alertMsg">
<span style="color: red; ">{{alertMsg}}</span>
</div>
</div> </div>
</div> </div>
\ No newline at end of file
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