New validation as per requirement

parent df3921de
...@@ -352,26 +352,37 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -352,26 +352,37 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
return obj; return obj;
}; };
var today = new Date();
$scope.addTab = function () { $scope.addTab = function () {
if($scope.isSecondTab === false){ if(! (new Date(dataToPass.projectEndDate) > today) ){
$scope.templateTitle = "Add"; $mdDialog.show($mdDialog.alert({
$scope.employeeRole = undefined; skipHide: true,
$scope.empBillableStatus = undefined; title:"Attention",
$scope.newBillingStartDate = undefined; textContent: 'Employee cannot be add to completed Project',
$scope.employeeShift = undefined; ok: 'ok'
$scope.employeeModel = {}; }));
$('.md-datepicker-input')[0].value = null;
$('.md-datepicker-input')[1].value = null;
$('.md-datepicker-input')[2].value = null;
$scope.startDate = (dataToPass.projectStartDate == null) ? null : new Date(dataToPass.projectStartDate);
$scope.endDate = (dataToPass.projectStartDate == null) ? null : new Date(dataToPass.projectEndDate);
document.getElementsByClassName("md-tab")[1].style.visibility = "visible" ;
document.getElementsByClassName("md-tab")[2].style.visibility = "hidden" ;
$scope.isSecondTab = true;
$scope.selectedTab = 1;
$scope.searchTerm = "";
} }
else{
if($scope.isSecondTab === false){
$scope.templateTitle = "Add";
$scope.employeeRole = undefined;
$scope.empBillableStatus = undefined;
$scope.newBillingStartDate = undefined;
$scope.employeeShift = undefined;
$scope.employeeModel = {};
$('.md-datepicker-input')[0].value = null;
$('.md-datepicker-input')[1].value = null;
$('.md-datepicker-input')[2].value = null;
$scope.startDate = (dataToPass.projectStartDate == null) ? null : new Date(dataToPass.projectStartDate);
$scope.endDate = (dataToPass.projectStartDate == null) ? null : new Date(dataToPass.projectEndDate);
document.getElementsByClassName("md-tab")[1].style.visibility = "visible" ;
document.getElementsByClassName("md-tab")[2].style.visibility = "hidden" ;
$scope.isSecondTab = true;
$scope.selectedTab = 1;
$scope.searchTerm = "";
}
}
}; };
var removeTab = function (action) { var removeTab = function (action) {
if(action == "Add"){ if(action == "Add"){
......
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