Commit d7214f87 authored by rammula-nisum-com's avatar rammula-nisum-com Committed by rbonthala-nisum-com

issues in project team module (#115)

parent a75a4d1a
......@@ -358,8 +358,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.employeeRole = undefined;
$scope.empBillableStatus = undefined;
$scope.newBillingStartDate = undefined;
$scope.startDate = undefined;
$scope.endDate = undefined;
$scope.startDate = new Date(dataToPass.projectStartDate);
$scope.endDate = new Date(dataToPass.projectEndDate);
$scope.employeeShift = undefined;
$scope.employeeModel = {};
$('.md-datepicker-input')[0].value = null;
......@@ -581,6 +581,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.parentData.employeeId = row.entity.employeeId;
$scope.parentData.employeeName = row.entity.employeeName;
$scope.parentData.emailId = row.entity.emailId;
$scope.parentData.id = row.entity.id;
$scope.parentData.role = row.entity.role;
$scope.parentData.shift = row.entity.shift;
$scope.parentData.projectId = row.entity.projectId;
......@@ -816,6 +817,15 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
return "Please select project status";
}
};
$scope.changeEmpBillableStatus = function(){
$scope.newBillingStartDate = null;
if($scope.templateTitle == "Add"){
$('.md-datepicker-input')[0].value = null;
}
else{
$('.md-datepicker-input')[3].value = null;
}
}
var noDomainError = function(){
$mdDialog.show($mdDialog.alert({
......@@ -1011,8 +1021,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
var projectStartDate = $scope.projectStartDate;
var projectEndDate = $scope.projectEndDate;
var projectStatus = $scope.projectStatus;
// var projectStartedDate = $scope.startDate;
if(action === "Add" || action =="Update"){
if(employeeModel == undefined){
if(employeeModel == undefined || employeeModel.employeeName == undefined){
$scope.alertMsg = "Please select a employee";
angular.element(document.getElementById('selectEmp')).focus();
}else if($scope.employeeRole == undefined){
......@@ -1022,35 +1033,46 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.alertMsg = "Please select a employee shift";
angular.element(document.getElementById('empShift')).focus();
}
else if($scope.empBillableStatus == undefined){
else if($scope.empBillableStatus == undefined){
$scope.alertMsg = "Please select a billable status";
angular.element(document.getElementById('empBillableStatus')).focus();
}else if($scope.startDate == undefined) {
$scope.alertMsg = "Please select Start Date";
angular.element(document.getElementById('startDate')).focus();
}
// else if($scope.endDate == undefined) {
// $scope.alertMsg = "Please select End Date";
// angular.element(document.getElementById('endDate')).focus();
// }
else if($scope.endDate == undefined) {
$scope.alertMsg = "Please select End Date";
angular.element(document.getElementById('endDate')).focus();
}
else if($scope.newBillingStartDate == undefined){
$scope.alertMsg = "Please select new Billing StartDate";
angular.element(document.getElementById('newBillingStartDate')).focus();
}
else if(action =="Add" && ($scope.newBillingStartDate > $scope.endDate)){
$scope.alertMsg = "Assignment End Date should be less than New Billability Start Date ";
}
else if (action == "Update" && (($scope.endDate < $scope.startDate) && ($scope.startDate <= $scope.newBillingStartDate) && ($scope.endDate < $scope.newBillingStartDate))) {
$scope.alertMsg = "EndDate should be greater than StartDate and new BillingStartDate ";
}
// else if(action =="Add" && ($scope.newBillingStartDate > $scope.endDate)){
// $scope.alertMsg = "Assignment End Date should be less than New Billability Start Date ";
// }
// else if (action == "Update" && (($scope.endDate < $scope.startDate) && ($scope.startDate <= $scope.newBillingStartDate) && ($scope.endDate < $scope.newBillingStartDate))) {
// $scope.alertMsg = "EndDate should be greater than StartDate and new BillingStartDate ";
// }
// else if (action == "Add"){
// if (!(($scope.newBillingStartDate >= new Date(dataToPass.projectStartDate)) && ($scope.newBillingStartDate <= $scope.endDate))){
// $scope.alertMsg = $scope.empBillableStatus + "start date should be in between start date and end date";
// }
// }
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;
}
// else if (action == "Update"){
// if (!(($scope.newBillingStartDate >= $scope.startDate) && ($scope.newBillingStartDate <= $scope.endDate))){
// $scope.alertMsg = $scope.empBillableStatus + "start date should be in between start date and end date";
// }
// }
else {
$scope.alertMsg = "";
var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "designation":employeeModel.designation,"projectId":project,"projectName":projectName,"managerId":managerId,"managerName":managerName,"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate,"account":account,"role":$scope.employeeRole,"newBillingStartDate":newBillingStartDate,"accountId":$scope.accountId,"domainId":$scope.domainId,"shift":$scope.employeeShift,"projectStartDate":$scope.startDate,"projectEndDate":$scope.endDate};
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "designation":employeeModel.designation,"projectId":project,"projectName":projectName,"managerId":managerId,"managerName":managerName,"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate,"account":account,"role":$scope.employeeRole,"newBillingStartDate":newBillingStartDate,"accountId":$scope.accountId,"domainId":$scope.domainId,"shift":$scope.employeeShift,"projectStartDate":$scope.startDate,"projectEndDate":$scope.endDate};
if(action == "Add"){
addRecord(record,action);
}else if(action == "Update"){
......
......@@ -133,7 +133,7 @@
<tr>
<td class="Employee">Billability Status</td>
<td>
<md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus">
<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-optgroup>
......@@ -258,7 +258,7 @@
<tr>
<td class="Employee">Billability Status</td>
<td>
<md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus">
<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-optgroup>
......@@ -270,7 +270,7 @@
<td>{{empBillableStatus}} Start Date </td>
<td>
<md-datepicker ng-model="newBillingStartDate" md-placeholder="Plase select Date " id="newBillingStartDate " md-min-date="minDate "
md-max-date="maxDate " onkeydown="return false " ng-change="currentBillabilityDateChange()"
md-max-date="maxDate " onkeydown="return false "
name="newBillingStartDate"></md-datepicker>
</td>
</tr>
......
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