Commit 22332416 authored by Prayas Jain's avatar Prayas Jain

Added Dropdown for allocation status

parent 67fdb580
......@@ -405,6 +405,8 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.isSecondTab = false;
$scope.prjctStses=["Active","Completed","On Hold","Proposed"];
$scope.billableStatuses = ["Billable", "Shadow", "Non-Billable", "Reserved", "Trainee"];
$scope.allocationStatuses = ["Engaged" , "Proposed"];
$scope.empAllocationStatus = 'Engaged';
$scope.employeeShifts = myFactory.getShifts();
$scope.deliveryLeadIds = dataToPass.deliveryLeadIds;
var allAccounts = myFactory.getAccounts();
......@@ -723,12 +725,14 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
"startDate":"",
"endDate":"",
"newBillingStartDate":"",
"empAllocationStatus" : "",
"empBillableStatuses":[]
};
$scope.edit = function (rowd) {
console.log(rowd)
var row = rowd.entity;
var index = $scope.gridOptions.data.indexOf(row);
if($scope.previousRow){
......@@ -766,6 +770,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
};
$scope.parentData.newBillingStartDate = row.billingStartDate;
$scope.parentData.endDate = row.billingEndDate;
$scope.parentData.empAllocationStatus = row.status;
};
$scope.rowCompare = function(row) {
......@@ -847,9 +852,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.endDate = row.billingEndDate;
$scope.employeeRole = row.resourceRole;
$scope.empBillableStatus = row.billableStatus;
$scope.empAllocationStatus = row.status;
$scope.id = row.id;
if(action == 'Update'){
$scope.validateFields(action);
$scope.validateFields(action,row);
if($scope.alertMsg != ""){
row.billingStartDate = $scope.parentData.newBillingStartDate;
row.billingEndDate = $scope.parentData.endDate;
......@@ -1366,7 +1372,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
}
$scope.validateFields = function (action) {
$scope.validateFields = function (action,row) {
var project = $scope.projectId;
var projectName = $scope.projectName;
......@@ -1376,6 +1382,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
var employeeModel = $scope.employeeModel;
var projectModel = $scope.projectModel;
var newBillingStartDate = $scope.newBillingStartDate;
var empAllocationStatus = $scope.empAllocationStatus;
if(action == 'Update'){
$scope.employeeRole == 'Lead' ? $scope.employeeRole ='Lead' : $scope.employeeRole = 'Employee';
}
......@@ -1399,6 +1406,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.alertMsg = "Please select new Billing StartDate";
angular.element(document.getElementById('newBillingStartDate')).focus();
}
else if($scope.empAllocationStatus == undefined){
$scope.alertMsg = "Please select a Allocation Status";
angular.element(document.getElementById('empAllocationStatus')).focus();
}
/* else if(employeeModel != undefined && projectModel != undefined && action == "Add" && getExistingRecordProjectStatus(employeeModel.employeeId, projectModel.projectName)){
$scope.alertMsg = "Employee is already assigned to the selected project";
return false;
......@@ -1415,7 +1426,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
else {
$scope.id = $scope.id ? $scope.id : $scope.objectId;
$scope.alertMsg = "";
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId,"projectId":project,"billableStatus":$scope.empBillableStatus,"billingEndDate":$scope.endDate,"resourceRole":$scope.employeeRole,"billingStartDate":newBillingStartDate,"status":"Engaged"};
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId,"projectId":project,"billableStatus":$scope.empBillableStatus,"billingEndDate":$scope.endDate,"resourceRole":$scope.employeeRole,"billingStartDate":newBillingStartDate,"status":empAllocationStatus};
if(action == "Add"){
addRecord(record,action);
$scope.myForm.$setPristine();
......@@ -1429,7 +1440,8 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}))
}
else {
updateTeamRecord(record, action);
updateTeamRecord(record, action,row);
$scope.myForm.$setPristine();
}
}
......@@ -1672,7 +1684,13 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
return "Please select a billable status";
}
};
$scope.getSelectedAllocationStatus = function(){
if ($scope.empAllocationStatus != undefined ) {
return $scope.empAllocationStatus;
} else {
return "Please select a allocation status";
}
};
function updateGrid(action, record) {
if ($scope.alertMsg == "") {
if ($scope.result == "Success") {
......@@ -1764,7 +1782,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.gridOptions.data = [];
});
}
function updateTeamRecord(record, action){
function updateTeamRecord(record, action,row){
var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
......@@ -1791,15 +1809,23 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
})
}else{
$scope.alertMsg=response.data.message;
if($scope.alertMsg && $scope.alertMsg != ""){
row.billingStartDate = $scope.parentData.newBillingStartDate;
row.billingEndDate = $scope.parentData.endDate;
row.resourceRole = $scope.parentData.role;
row.billableStatus = $scope.parentData.billableStatus;
}
}
// $scope.objectId = response.data.id;
}, function myError(response){
$scope.result = "Error";
});
}, function myError(response){
$scope.result = "Error";
row.billingStartDate = $scope.parentData.newBillingStartDate;
row.billingEndDate = $scope.parentData.endDate;
row.resourceRole = $scope.parentData.role;
row.billableStatus = $scope.parentData.billableStatus;
});
}
}
function addOrUpdateProject(record, action) {
var urlRequest = "";
......
......@@ -673,6 +673,10 @@ cursor: pointer;
.viewTeamDetails{
width:100%;
}
md-content {
overflow : hidden;
.view-team-details-grid {
height: calc(85vh - 243px) !important;
}
.alertMsg{
margin: 10px 0 0 0;
}
\ No newline at end of file
......@@ -46,10 +46,10 @@
<input type="radio" ng-model="status" value="Both" ng-click="getTeamMates()"> Both
</div>
<div id="gridTest" class="grid-half-view" ui-grid="gridOptions " ui-grid-edit ui-grid-pagination style="width:99%;height:230px;margin-left:10px; ">
<div id="gridTest" class="view-team-details-grid" ui-grid="gridOptions " ui-grid-edit ui-grid-pagination style="width:99%;height:230px;margin-left:10px; ">
<div class="watermark " ng-show="!gridOptions.data.length ">No data available</div>
</div>
<div ng-if ='templateTitle == "View"' role="alert">
<div ng-if ='templateTitle == "View"' role="alert" class="alertMsg">
<span style="color: red; ">{{alertMsg}}</span>
</div>
</div>
......@@ -171,6 +171,16 @@
onkeydown="return false " name="endDate"></md-datepicker>
</td>
</tr>
<tr>
<td class="Employee">Allocation Status</td>
<td>
<md-select ng-model="empAllocationStatus " md-selected-text="getSelectedAllocationStatus() " id="empAllocationStatus" name="empAllocationStatus">
<md-optgroup label="allocation statuses ">
<md-option ng-value="allocationStatus " ng-repeat="allocationStatus in allocationStatuses ">{{allocationStatus}}</md-option>
</md-optgroup>
</md-select>
</td>
</tr>
</table>
<div ng-if ='templateTitle == "Add"' role="alert">
......
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