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

Updated open pool controller

parent 64b7b7d9
......@@ -231,7 +231,7 @@ public class EmployeeController {
List<Employee> employeesList = new ArrayList<>();
if (empService.getActiveEmployees() != null) {
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());
}
return new ResponseEntity<>(employeesList, HttpStatus.OK);
......
......@@ -151,8 +151,6 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia
var newIndex = $scope.gridOptions.data.indexOf(allRows[i].entity)
if(newIndex == $scope.previousRowIndex){
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);
}
}
......@@ -162,32 +160,96 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia
$scope.gridOptions.data[index].editrow = false;
row.billableStatus = $scope.parentData.billableStatus;
};
// $scope.saveRow = function (row,action) {
// var index = $scope.gridOptions.data.indexOf(row);
// $scope.gridOptions.data[index].editrow = false;
// $scope.employeeModel = {
// 'employeeName': row.employeeName,
// 'employeeId': row.employeeId,
// 'designation': row.designation
// };
// $scope.newBillingStartDate = row.billingStartDate;
// $scope.endDate = row.billingEndDate;
// $scope.employeeRole = row.resourceRole;
// $scope.empBillableStatus = row.billableStatus;
// $scope.empAllocationStatus = row.status;
// $scope.aliasResourceName = row.onBehalfOf;
// $scope.id = row.id;
// if(action == 'Update'){
// $scope.validateFields(action,row);
// if($scope.alertMsg != ""){
// row.billingStartDate = $scope.parentData.newBillingStartDate;
// row.billingEndDate = $scope.parentData.endDate;
// row.resourceRole = $scope.parentData.role;
// row.billableStatus = $scope.parentData.billableStatus;
// }
// $scope.previousRow = angular.copy(row);
// }
// }
$scope.DataUpdate = function () {
var data = $scope.parentData;
$scope.previousData = {
Billabilitystatus: data.billableStatus,
},
$scope.currentData = {
Billabilitystatus: $scope.empBillableStatus,
}
var predata = JSON.stringify($scope.previousData);
var curdata = JSON.stringify($scope.currentData);
if (predata == curdata) {
return false;
}
return true;
}
$scope.saveRow = function (row,action) {
var index = $scope.gridOptions.data.indexOf(row);
$scope.gridOptions.data[index].editrow = false;
$scope.employeeName = row.employeeName;
$scope.projectId = row.projectId;
$scope.employeeId = row.employeeId;
$scope.designation = row.designation;
$scope.billingStartDate = row.billingStartDate;
$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;
.manage-employee-efforts {
height: calc(100vh - 260px) !important;
}
.manage-open-pool {
height: calc(100vh - 230px) !important;
}
.md-datepicker-input-mask {
height : 0px;
}
......@@ -687,7 +690,6 @@ cursor: pointer;
.substatus-dropdown md-datepicker {
padding:0;
}
.substatus-dropdown >md-select {
margin:0;
}
......
......@@ -15,11 +15,14 @@
<div class="row">
<div class="col-lg-12">
<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
data available</div>
</div>
</div>
</div>
<div role="alert" class="alertMsg">
<span style="color: red; ">{{alertMsg}}</span>
</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