Commit fbbc47e2 authored by Soumya Gouri's avatar Soumya Gouri

Added dropdown for alias resource

parent 1439d978
......@@ -430,6 +430,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
// code added
$scope.searchTerm = "";
$scope.searchAliasTerm = "";
$scope.updateSearch = function (e) {
e.stopPropagation();
}
......@@ -440,6 +441,13 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
return obj;
};
$scope.aliasFilter = function (obj) {
if($scope.searchAliasTerm.length > 3){
var re = new RegExp($scope.searchAliasTerm, 'i');
return !$scope.searchAliasTerm || re.test(obj.employeeName);
}
return obj;
};
var today = new Date();
$scope.addTab = function () {
......@@ -461,6 +469,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.employeeShift = undefined;
$scope.empAllocationStatus = undefined;
$scope.employeeModel = {};
$scope.aliasModel = {};
$('.md-datepicker-input')[0].value = null;
$('.md-datepicker-input')[1].value = null;
$('.md-datepicker-input')[2].value = null;
......@@ -487,6 +496,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$('.md-datepicker-input')[1].value = null;
$('.md-datepicker-input')[2].value = null;
$scope.employeeModel = {};
$scope.aliasModel = {};
}
}
$scope.selectedTab = 0;
......@@ -610,6 +620,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
};
$scope.status = "Active";
var employeeModel = $scope.employeeModel;
var aliasModel = $scope.aliasModel;
var getCellTemplate1 = '<p class="col-lg-12"><i ng-show="grid.appScope.showEditIcon(row.entity)" class="fa fa-pencil-square-o fa-2x" data-placement="center" title="Edit" onmouseenter="$(this).tooltip(\'show\')" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.edit(row)"></i>'+
'<i ng-show="row.entity.editrow" class="fa fa-save fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="center" title="Save" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.saveRow(row.entity,\'Update\')"></i>'
+'&nbsp;&nbsp;&nbsp;<i ng-show="row.entity.editrow" id="cancelEdit" class="fa fa-times fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" data-placement="center" title="Cancel" onmouseenter="$(this).tooltip(\'show\')" ng-click="grid.appScope.cancelEdit(row.entity)"></i>'
......@@ -1495,6 +1506,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
var managerId=$scope.managerId;
var managerName=$scope.managerName;
var employeeModel = $scope.employeeModel;
var aliasModel = $scope.aliasModel;
var projectModel = $scope.projectModel;
var newBillingStartDate = $scope.newBillingStartDate;
var empAllocationStatus = $scope.empAllocationStatus;
......@@ -1509,6 +1521,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.alertMsg = "Please select a employee role";
angular.element(document.getElementById('empRole')).focus();
}
else if(employeeModel != undefined && employeeModel.employeeName != undefined && employeeModel.employeeName == aliasModel.employeeName){
$scope.alertMsg = "Both Resource could not be same";
angular.element(document.getElementById('selectAlias')).focus();
}
else if(action === "Add" && $scope.empAllocationStatus == undefined){
$scope.alertMsg = "Please select a employee Allocation Status";
angular.element(document.getElementById('empAllocationStatus')).focus();
......@@ -1548,7 +1564,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":empAllocationStatus};
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId,"onBehalfOf":aliasModel.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();
......@@ -1773,6 +1789,20 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
return "Please select a employee";
}
};
$scope.getSelectedAlias = function(){
if ($scope.aliasModel != undefined ) {
if(Object.keys($scope.aliasModel).length > 1){
$scope.alias=$scope.aliasModel;
return $scope.aliasModel.employeeName;
}
else {
return "Please select a Alias Resource";
}
} else {
return "Please select a Alias Resource";
}
};
$scope.getSelectedEmpRole = function(){
if ($scope.employeeRole != undefined ) {
return $scope.employeeRole;
......
......@@ -150,6 +150,24 @@
</md-select>
</td>
</tr>
<tr>
<tr>
<td>Alias For </td>
<td>
<md-select ng-model="aliasModel" data-md-container-class="selectHeader" md-selected-text="getSelectedAlias() " id="selectAlias"
name="aliasModel">
<md-select-header class="selectHeaderChild header-spacing" layout="column">
<input ng-model="searchAliasTerm" type="search" id="search" ng-keydown="updateSearch($event)" ng-model-options="{debounce: {'default': 500, 'blur': 0}}"
placeholder="Please search for an alias resource" class="searchBoxHeader demo-header-searchbox md-text search-spacingleft"
/>
<span class="glyphicon glyphicon-remove close-mdselect" ng-click="closeSelectBox()"></span>
</md-select-header>
<md-optgroup label="Alias " class="optionScroll">
<md-option ng-value="alias " ng-repeat="alias in employeeList | filter:aliasFilter">{{alias.employeeName}}</md-option>
</md-optgroup>
</md-select>
</td>
</tr>
<tr ng-show="empAllocationStatus">
<td class="Employee">Billability Status</td>
<td>
......
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