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