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

issues in project module validation (#118)

parent 2da1f9e2
...@@ -1021,7 +1021,6 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1021,7 +1021,6 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
var projectStartDate = $scope.projectStartDate; var projectStartDate = $scope.projectStartDate;
var projectEndDate = $scope.projectEndDate; var projectEndDate = $scope.projectEndDate;
var projectStatus = $scope.projectStatus; var projectStatus = $scope.projectStatus;
// var projectStartedDate = $scope.startDate;
if(action === "Add" || action =="Update"){ if(action === "Add" || action =="Update"){
if(employeeModel == undefined || employeeModel.employeeName == undefined){ if(employeeModel == undefined || employeeModel.employeeName == undefined){
$scope.alertMsg = "Please select a employee"; $scope.alertMsg = "Please select a employee";
...@@ -1048,28 +1047,16 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1048,28 +1047,16 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$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(action =="Add" && ($scope.newBillingStartDate > $scope.endDate)){ else if(employeeModel != undefined && projectModel != undefined && action == "Add" && getExistingRecordProjectStatus(employeeModel.employeeId, projectModel.projectName)){
// $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"; $scope.alertMsg = "Employee is already assigned to the selected project";
return false; return false;
} }
// else if (action == "Update"){ else if(!(($scope.newBillingStartDate >= new Date(dataToPass.projectStartDate)) && ($scope.newBillingStartDate <= $scope.endDate))){
// if (!(($scope.newBillingStartDate >= $scope.startDate) && ($scope.newBillingStartDate <= $scope.endDate))){ $scope.alertMsg = $scope.empBillableStatus + " start date should be in between start date and end date";
// $scope.alertMsg = $scope.empBillableStatus + "start date should be in between start date and end date"; }
// } else if (!(($scope.newBillingStartDate >= $scope.startDate) && ($scope.newBillingStartDate <= $scope.endDate)) && action == "Update"){
// } $scope.alertMsg = $scope.empBillableStatus + " start date should be in between start date and end date";
}
else { else {
$scope.alertMsg = ""; $scope.alertMsg = "";
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}; 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};
...@@ -1086,16 +1073,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1086,16 +1073,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
ok: 'ok' ok: 'ok'
})); }));
},500); },500);
} }
// addRecord(record,action);
} }
} }
//          if(project == ""){
//              $scope.alertMsg = "Project ID is mandatory";
//              document.getElementById('projectId').focus();
//          }else
else{ else{
if (projectName == "") { if (projectName == "") {
$scope.alertMsg = "Project Name is mandatory"; $scope.alertMsg = "Project Name is mandatory";
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
<tr> <tr>
<td class="Employee">Billability Status</td> <td class="Employee">Billability Status</td>
<td> <td>
<md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus" ng-change="changeEmpBillableStatus()> <md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus" ng-change="changeEmpBillableStatus()">
<md-optgroup label="billable statuses "> <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-optgroup>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
<tr> <tr>
<td class="Employee">Billability Status</td> <td class="Employee">Billability Status</td>
<td> <td>
<md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus" ng-change="changeEmpBillableStatus()"> <md-select ng-model="empBillableStatus " md-selected-text="getSelectedBillableStatus() " id="empBillableStatus" name="empBillableStatus" ng-change="changeEmpBillableStatus()" >
<md-optgroup label="billable statuses "> <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-optgroup>
......
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