Commit 00486ce3 authored by Prayas Jain's avatar Prayas Jain

Added substatus start date and end date

parent dc2783ce
......@@ -88,6 +88,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData.passportExpiryDate = row.entity.passportExpiryDate;
$scope.parentData.b1ExpiryDate = row.entity.b1ExpiryDate;
$scope.parentData.endDate = row.entity.endDate;
$scope.parentData.subStatusStartDate = row.entity.subStatusStartDate;
$scope.parentData.subStatusEndDate = row.entity.subStatusEndDate;
if(action == "Update")
$scope.assignRole(action, $scope.parentData);
else if(action == "Delete")
......@@ -260,10 +262,12 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.designation;
$scope.empLocation;
$scope.dateOfJoining;
$scope.domain = "";
$scope.isDisabled = false;
$scope.domain = "";
$scope.isDisabled = false;
$scope.hasPassort;
$scope.hasB1;
$scope.subStatusEndDate;
$scope.subStatusStartDate;
}else if(dataToPass.action == "Update") {
$scope.empId = dataToPass.employeeId;
$scope.empName = dataToPass.employeeName;
......@@ -274,6 +278,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.functionalGroup = dataToPass.functionalGroup;
$scope.empStatus = dataToPass.empStatus;
$scope.empSubStatus = dataToPass.empSubStatus;
$scope.subStatusEndDate = (dataToPass.subStatusEndDate == null) ? null : new Date(dataToPass.subStatusEndDate);
$scope.subStatusStartDate = (dataToPass.subStatusStartDate == null) ? null : new Date(dataToPass.subStatusStartDate);
$scope.employmentType = dataToPass.employmentType;
$scope.domain = dataToPass.domain;
$scope.designation = dataToPass.designation;
......@@ -435,6 +441,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}
$scope.validateFields = function(){
console.log($scope.subStatusStartDate)
var today = new Date();
if($scope.templateTitle == "Add"){
......@@ -457,6 +464,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var dateOfBirth = $scope.dateOfBirth;
var b1ExpiryDate = $scope.b1ExpiryDate;
var passportExpiryDate = $scope.passportExpiryDate;
var subStatusStartDate = $scope.subStatusStartDate;
var subStatusEndDate = $scope.subStatusEndDate;
if(searchId == ""){
$scope.alertMsg = "Employee Id is mandatory";
document.getElementById('empId').focus();
......@@ -485,7 +494,16 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
else if(dateOfJoining == undefined){
$scope.alertMsg = "Please select a Date Of Joining";
document.getElementById('dateOfJoining').focus();
}else if(dateOfBirth != undefined && !(today.getFullYear() - dateOfBirth.getFullYear() > 20 )){
}
else if(subStatusStartDate == undefined){
$scope.alertMsg = "Please select a SubStatus start Date";
document.getElementById('subStatusStartDate').focus();
}
else if(subStatusEndDate == undefined){
$scope.alertMsg = "Please select a SubStatus end Date";
document.getElementById('subStatusEndDate').focus();
}
else if(dateOfBirth != undefined && !(today.getFullYear() - dateOfBirth.getFullYear() > 20 )){
$scope.alertMsg = "Please check your date of birth";
document.getElementById('dateOfBirth').focus();
}else if(empStatus == undefined){
......@@ -537,13 +555,16 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
else if($scope.templateTitle != "Add" && $scope.exitDate >= today){
$scope.alertMsg = "Please select the exit date less than or equal to current date";
document.getElementById('hasB1').focus();
}else{
}
else if (subStatusStartDate >= subStatusEndDate){
$scope.alertMsg = "Start date should not be greater than end date";
}else{
$scope.alertMsg = "";
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "gender": $scope.gender,"emailId": $scope.empEmail,
"role": $scope.empRole, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"empStatus": $scope.empStatus,"empSubStatus":$scope.empSubStatus,"employmentType": $scope.employmentType,"dateOfJoining":$scope.dateOfJoining,
"dateOfBirth":$scope.dateOfBirth,"hasPassort":$scope.hasPassort,"hasB1":$scope.hasB1,"passportExpiryDate":$scope.passportExpiryDate,
"b1ExpiryDate":$scope.b1ExpiryDate, "endDate":$scope.exitDate
"b1ExpiryDate":$scope.b1ExpiryDate, "endDate":$scope.exitDate, "subStatusStartDate":$scope.subStatusStartDate,"subStatusEndDate":$scope.subStatusEndDate
};
if($scope.templateTitle == "Add"){
addOrUpdateRole(record, $scope.templateTitle);
......@@ -554,7 +575,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
"role": dataToPass.role, "empLocation": dataToPass.empLocation,"designation": dataToPass.designation,"functionalGroup": dataToPass.functionalGroup,
"empStatus": dataToPass.empStatus,"empSubStatus":dataToPass.empSubStatus, "employmentType": dataToPass.employmentType,"dateOfJoining":new Date(dataToPass.dateOfJoining),
"dateOfBirth":new Date(dataToPass.dateOfBirth),"hasPassort":dataToPass.hasPassort,"hasB1":dataToPass.hasB1,"passportExpiryDate":new Date(dataToPass.passportExpiryDate),
"b1ExpiryDate":new Date(dataToPass.b1ExpiryDate), "endDate":new Date(dataToPass.endDate)
"b1ExpiryDate":new Date(dataToPass.b1ExpiryDate), "endDate":new Date(dataToPass.endDate) , "subStatusStartDate": new Date(dataToPass.subStatusStartDate) ,"subStatusEndDate": new Date(dataToPass.subStatusEndDate)
};
objectConstructionBasedOnParameters(recordFromDb);
objectConstructionBasedOnParameters(record);
......@@ -611,14 +632,14 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
"role": $scope.empRole, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"empStatus": $scope.empStatus, "empSubStatus":$scope.empSubStatus, "employmentType": $scope.employmentType,"dateOfJoining":$scope.dateOfJoining,
"dateOfBirth":$scope.dateOfBirth,"hasPassort":$scope.hasPassort,"hasB1":$scope.hasB1,"passportExpiryDate":$scope.passportExpiryDate,
"b1ExpiryDate":$scope.b1ExpiryDate, "endDate":$scope.exitDate
"b1ExpiryDate":$scope.b1ExpiryDate, "endDate":$scope.exitDate , "subStatusStartDate":$scope.subStatusStartDate,"subStatusEndDate":$scope.subStatusEndDate
};
var recordFromDb = {
"employeeId":dataToPass.employeeId, "employeeName": dataToPass.employeeName, "gender": dataToPass.gender,"emailId": dataToPass.emailId,
"role": dataToPass.role, "empLocation": dataToPass.empLocation,"designation": dataToPass.designation,"functionalGroup": dataToPass.functionalGroup,
"empStatus": dataToPass.empStatus, "empSubStatus":dataToPass.empSubStatus, "employmentType": dataToPass.employmentType,"dateOfJoining":new Date(dataToPass.dateOfJoining),
"dateOfBirth":new Date(dataToPass.dateOfBirth),"hasPassort":dataToPass.hasPassort,"hasB1":dataToPass.hasB1,"passportExpiryDate":new Date(dataToPass.passportExpiryDate),
"b1ExpiryDate":new Date(dataToPass.b1ExpiryDate), "endDate":new Date(dataToPass.endDate)
"b1ExpiryDate":new Date(dataToPass.b1ExpiryDate), "endDate":new Date(dataToPass.endDate) ,"subStatusStartDate": new Date(dataToPass.subStatusStartDate) ,"subStatusEndDate": new Date(dataToPass.subStatusEndDate)
};
objectConstructionBasedOnParameters(recordFromDb);
objectConstructionBasedOnParameters(record);
......
......@@ -72,6 +72,13 @@
ng-value="status" ng-repeat="status in empStatuses">{{status}}</md-option>
</md-optgroup> </md-select></td>
</tr>
<tr ng-show="empStatus == 'In Active'">
<td colspan="4"><b>Employee Exit Date:</b><span class="mandatory"></span></td>
<td colspan="8"><md-datepicker ng-model="exitDate" name="endDate"
md-placeholder="Exit Date" md-min-date="minDate"
md-max-date="maxDate" onkeydown="return false"></md-datepicker>
</td>
</tr>
<tr ng-show="empStatus == 'Active' && templateTitle != 'Add' " >
<td colspan="4"><b>Select Sub Status :</b></td>
<td colspan="8"><md-select ng-model="empSubStatus" name ="empSubStatus"
......@@ -81,11 +88,18 @@
<md-option ng-value="status" ng-repeat="status in empSubStatuses">{{status}}</md-option>
</md-optgroup> </md-select></td>
</tr>
<tr ng-show="empStatus == 'In Active'">
<td colspan="4"><b>Employee Exit Date:</b><span class="mandatory"></span></td>
<td colspan="8"><md-datepicker ng-model="exitDate" name="endDate"
md-placeholder="Exit Date" md-min-date="minDate"
md-max-date="maxDate" onkeydown="return false"></md-datepicker>
<tr ng-show="empSubStatus != null && empSubStatus != '' && empStatus == 'Active' && templateTitle != 'Add'">
<td colspan="4"><b>{{empSubStatus}} Start Date:</b><span class="mandatory"></span></td>
<td colspan="8"><md-datepicker ng-model="subStatusStartDate" name="subStatusStartDate" id="subStatusStartDate"
md-placeholder="Start Date" md-min-date="minDate"
md-max-date="maxDate" onkeydown="return false" ng-blur="validateMessage()"></md-datepicker>
</td>
</tr>
<tr ng-show="empSubStatus != null && empSubStatus != '' && empStatus == 'Active' && templateTitle != 'Add'">
<td colspan="4"><b>{{empSubStatus}} End Date:</b><span class="mandatory"></span></td>
<td colspan="8"><md-datepicker ng-model="subStatusEndDate" name="subStatusEndDate"
md-placeholder="End Date" md-min-date="minDate" id="subStatusEndDate"
md-max-date="maxDate" onkeydown="return false" ng-blur="validateMessage()"></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