Commit c6881717 authored by Prayas Jain's avatar Prayas Jain

Updated Reserved and proposed Functionality

parent 3e359ddb
......@@ -231,7 +231,6 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
{field : 'projectStartDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150},
{field : 'projectEndDate',displayName: 'End Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"' ,minWidth : 100,width: 150},
{field : 'projectStatus',displayName: 'Status', enableColumnMenu: false,enableSorting: false,minWidth : 100,width: 150}
]
};
......@@ -281,26 +280,30 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
columnDefs : [
{field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150},
{field : 'accountName',displayName: 'Account', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field: 'billingStartDate',displayName: 'Start Date',
{field: 'billingStartDate',displayName: 'Billing Start Date',
cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150
},
{
field: 'billingEndDate',
displayName: 'End Date',
displayName: 'Billing End Date',
cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150
},
{field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'resourceStatus',displayName: 'Status',enableColumnMenu: false, enableSorting: false,enableCellEdit: false,minWidth : 100,width: 150}
{field : 'billableStatus',displayName: 'Billability Status', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'resourceRole',displayName: 'Role', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'resourceStatus',displayName: 'Allocation Status', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150}
]
};
$http({
method : "GET",
url : appConfig.appUri + "resources/billing?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
$scope.gridOptionsEmpBillability.data = response.data;
if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
......@@ -308,9 +311,13 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
method : "GET",
url : appConfig.appUri + "resources/getMyProjectAllocations?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
$scope.gridOptionsProjectAllocatons.data = response.data.records;
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
......
......@@ -82,6 +82,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.viewTeamDetails(action, $scope.parentData);
}
$scope.refreshPage = function () {
......@@ -403,9 +404,9 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.projectModel;
$scope.isSecondTab = false;
$scope.prjctStses=["Active","Completed","On Hold","Proposed"];
$scope.billableStatuses = ["Billable", "Shadow", "Non-Billable", "Reserved", "Trainee"];
$scope.billableStatuses = ["Billable", "Shadow", "Non-Billable", "Trainee"];
$scope.allocationStatuses = ["Engaged" , "Proposed"];
$scope.empAllocationStatus = 'Engaged';
// $scope.empAllocationStatus = 'Engaged';
$scope.employeeShifts = myFactory.getShifts();
$scope.deliveryLeadIds = dataToPass.deliveryLeadIds;
var allAccounts = myFactory.getAccounts();
......@@ -458,6 +459,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.empBillableStatus = undefined;
$scope.newBillingStartDate = undefined;
$scope.employeeShift = undefined;
$scope.empAllocationStatus = undefined;
$scope.employeeModel = {};
$('.md-datepicker-input')[0].value = null;
$('.md-datepicker-input')[1].value = null;
......@@ -475,11 +477,12 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
};
var removeTab = function (action) {
if(action == "Add"){
if($scope.isSecondTab === true){
if($scope.isSecondTab === true){
$('.md-select-value')[0].childNodes[0].innerHTML = null
$('.md-select-value')[1].childNodes[0].innerHTML = null
$('.md-select-value')[2].childNodes[0].innerHTML = null
// $('.md-select-value')[3].childNodes[0].innerHTML = null
$('.md-select-value')[3].childNodes[0].innerHTML = null
$('.md-datepicker-input')[0].value = null;
$('.md-datepicker-input')[1].value = null;
$('.md-datepicker-input')[2].value = null;
......@@ -487,6 +490,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
}
$scope.selectedTab = 0;
$scope.templateTitle = 'View';
document.getElementsByClassName("md-tab")[1].style.visibility = "hidden" ;
document.getElementsByClassName("md-tab")[2].style.visibility = "hidden" ;
$scope.isSecondTab = !$scope.isSecondTab;
......@@ -836,34 +840,40 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
$scope.changeAllocationStatusToEngaged = function (row) {
var loginEmpId = myFactory.getEmpId();
var record = {"id":row.id,"employeeId":row.employeeId,"projectId":row.projectId,"billableStatus":row.billableStatus,"billingEndDate":row.billingEndDate,"resourceRole":row.resourceRole,"billingStartDate":row.billingStartDate,"status":"Engaged"};
var urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
var req = {
method : 'PUT',
url : urlRequest,
headers : {
"Content-type" : "application/json"
},
data : record
if(row.billableStatus == "Reserved"){
$scope.alertMsg = 'Please Update Your Billability Status From Reserved and then Move to Engage';
}else {
$scope.alertMsg ='';
var loginEmpId = myFactory.getEmpId();
var record = {"id":row.id,"employeeId":row.employeeId,"projectId":row.projectId,"billableStatus":row.billableStatus,"billingEndDate":row.billingEndDate,"resourceRole":row.resourceRole,"billingStartDate":row.billingStartDate,"status":"Engaged"};
var 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 () {
getProjectDetails($scope.projectId, $scope.status);
}, 500);
}
$http(req).then(function mySuccess(response) {
$scope.result = "Success";
if(response.data.message == "Resource updated successfully"){
$timeout(function () {
getProjectDetails($scope.projectId, $scope.status);
}, 500);
}
$mdDialog.show($mdDialog.alert({
skipHide: true,
textContent: response.data.message ,
ok: 'ok'
})).then(function () {
$scope.myForm.$setPristine();
})
}, function myError(response){
$scope.result = "Error";
});
$mdDialog.show($mdDialog.alert({
skipHide: true,
textContent: response.data.message ,
ok: 'ok'
})).then(function () {
$scope.myForm.$setPristine();
})
}, function myError(response){
$scope.result = "Error";
});
}
}
......@@ -997,6 +1007,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.getTeamMates = function(){
getProjectDetails($scope.projectId,$scope.status);
$scope.alertMsg = '';
}
/* $scope.updateTeamMate = function(action, userData){
$scope.updateTab();
......@@ -1186,6 +1197,16 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.endDate = new Date(dataToPass.projectEndDate);
$('.md-datepicker-input')[3].value = new Date(dataToPass.projectEndDate);
}
}
$scope.changeBillableStatusList = function() {
if($scope.empAllocationStatus == 'Proposed') {
$scope.empBillableStatus = 'Reserved' ;
$scope.billableStatuses = ["Reserved"];
}
else if ($scope.empAllocationStatus == 'Engaged'){
$scope.empBillableStatus = null ; //$scope.billableStatuses ;
$scope.billableStatuses = ["Billable", "Shadow", "Non-Billable", "Trainee"];
}
}
/* $scope.getEditTeammate = function(selectedStatus) {
if(selectedStatus) {
......@@ -1459,6 +1480,10 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.alertMsg = "Please select a employee role";
angular.element(document.getElementById('empRole')).focus();
}
else if(action === "Add" && $scope.empAllocationStatus == undefined){
$scope.alertMsg = "Please select a employee Allocation Status";
angular.element(document.getElementById('empAllocationStatus')).focus();
}
else if($scope.empBillableStatus == undefined){
$scope.alertMsg = "Please select a billable status";
angular.element(document.getElementById('empBillableStatus')).focus();
......@@ -1482,9 +1507,9 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
else if(!(($scope.newBillingStartDate >= new Date(dataToPass.projectStartDate)) && ($scope.newBillingStartDate <= $scope.endDate))){
$scope.alertMsg = $scope.empBillableStatus + " start date should be in between project start date and end date";
}
else if (!(($scope.newBillingStartDate >= $scope.parentData.newBillingStartDate) && ($scope.newBillingStartDate <= $scope.endDate)) && action == "Update"){
$scope.alertMsg = $scope.empBillableStatus + " start date should be in between previous Billing start date and end date";
}
// else if (!(($scope.newBillingStartDate >= $scope.parentData.newBillingStartDate) && ($scope.newBillingStartDate <= $scope.endDate)) && action == "Update"){
// $scope.alertMsg = $scope.empBillableStatus + " start date should be in between previous Billing start date and end date";
// }
else if($scope.endDate > new Date(dataToPass.projectEndDate)){
$scope.alertMsg = "End date should not exceed project end date";
}
......
......@@ -195,7 +195,7 @@
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridProjectAllocatons" ui-grid="gridOptionsProjectAllocatons"
class="myGrid" style="width:99%;height:200px;" ng-show="showProjectAllocations">
class="myGrid" style="width:85%;height:200px;" ng-show="showProjectAllocations">
<div class="watermark" ng-show="!gridOptionsProjectAllocatons.data.length">No
data available</div>
</div>
......@@ -206,7 +206,7 @@
<legend style="font-size: 18px;">Billability Details <i style="margin-top:3px;color:blue;cursor:pointer;font-size: 14px;" ng-click="toggleBillability()">{{showOrHideBD}}</i></legend>
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridEmpBillability" ui-grid="gridOptionsEmpBillability"
class="myGrid" style="width:99%;height:200px;" ng-show="showBillable">
class="myGrid" style="width:85%;height:200px;" ng-show="showBillable">
<div class="watermark" ng-show="!gridOptionsEmpBillability.data.length">No
data available</div>
</div>
......
......@@ -140,12 +140,22 @@
</md-select>
</td>
</tr> -->
<tr>
<tr>
<td class="Employee">Allocation Status</td>
<td>
<md-select ng-model="empAllocationStatus " md-selected-text="getSelectedAllocationStatus()" id="empAllocationStatus" name="empAllocationStatus" ng-change="changeBillableStatusList()">
<md-optgroup label="allocation statuses ">
<md-option ng-value="allocationStatus " ng-repeat="allocationStatus in allocationStatuses ">{{allocationStatus}}</md-option>
</md-optgroup>
</md-select>
</td>
</tr>
<tr ng-show="empAllocationStatus">
<td class="Employee">Billability Status</td>
<td>
<md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus" ng-change="changeEmpBillableStatus()">
<md-optgroup label="billable statuses ">
<md-option ng-value="billableStatus " ng-repeat="billableStatus in billableStatuses ">{{billableStatus}}</md-option>
<md-option ng-value="billableStatus " ng-repeat="billableStatus in billableStatuses">{{billableStatus}}</md-option>
</md-optgroup>
</md-select>
</td>
......@@ -172,16 +182,6 @@
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