Commit 0fb91dc6 authored by Sumith's avatar Sumith

[$umith] MT-65, MT-66 completed

parent 7a39c235
...@@ -216,4 +216,14 @@ public class UserController { ...@@ -216,4 +216,14 @@ public class UserController {
return new ResponseEntity<>(masterDataMap, HttpStatus.OK); return new ResponseEntity<>(masterDataMap, HttpStatus.OK);
} }
@RequestMapping(value = "/getEmployeeByStatus", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeRoles>> getEmployeeByStatus(
@RequestParam("status") String status) {
List<EmployeeRoles> employeesRoles = userService
.getEmployeesByStatus(status);
return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
}
} }
\ No newline at end of file
...@@ -17,4 +17,6 @@ public interface EmployeeRolesRepo ...@@ -17,4 +17,6 @@ public interface EmployeeRolesRepo
List<EmployeeRoles> findByEmpStatusAndFunctionalGroup(String empStatus, List<EmployeeRoles> findByEmpStatusAndFunctionalGroup(String empStatus,
String functionalGroup); String functionalGroup);
List<EmployeeRoles> findByEmpStatusOrderByEmployeeNameAsc(String empStatus);
} }
...@@ -65,4 +65,6 @@ public interface UserService { ...@@ -65,4 +65,6 @@ public interface UserService {
List<MasterData> getMasterData() throws MyTimeException; List<MasterData> getMasterData() throws MyTimeException;
List<EmployeeRoles> getEmployeesByFunctionalGrp(String functionalGrp); List<EmployeeRoles> getEmployeesByFunctionalGrp(String functionalGrp);
List<EmployeeRoles> getEmployeesByStatus(String status);
} }
...@@ -7,6 +7,7 @@ import java.util.List; ...@@ -7,6 +7,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.FindAndModifyOptions; import org.springframework.data.mongodb.core.FindAndModifyOptions;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
...@@ -123,8 +124,7 @@ public class UserServiceImpl implements UserService { ...@@ -123,8 +124,7 @@ public class UserServiceImpl implements UserService {
newBenchAllocation.setEmployeeName(employeeRoles.getEmployeeName()); newBenchAllocation.setEmployeeName(employeeRoles.getEmployeeName());
newBenchAllocation.setProjectId("Nisum0000"); newBenchAllocation.setProjectId("Nisum0000");
newBenchAllocation.setStartDate(employeeRoles.getDateOfJoining() != null newBenchAllocation.setStartDate(employeeRoles.getDateOfJoining() != null
? employeeRoles.getDateOfJoining() ? employeeRoles.getDateOfJoining() : new Date());
: new Date());
Project p = projectRepo.findByProjectId("Nisum0000"); Project p = projectRepo.findByProjectId("Nisum0000");
newBenchAllocation.setProjectName(p.getProjectName()); newBenchAllocation.setProjectName(p.getProjectName());
newBenchAllocation.setManagerId(p.getManagerId()); newBenchAllocation.setManagerId(p.getManagerId());
...@@ -423,4 +423,16 @@ public class UserServiceImpl implements UserService { ...@@ -423,4 +423,16 @@ public class UserServiceImpl implements UserService {
functionalGrp); functionalGrp);
} }
@Override
public List<EmployeeRoles> getEmployeesByStatus(String status) {
if (status.equals("both")) {
return employeeRolesRepo
.findAll(new Sort(Sort.Direction.ASC, "employeeName"));
} else {
return employeeRolesRepo
.findByEmpStatusOrderByEmployeeNameAsc(status);
}
}
} }
myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $http, appConfig, $timeout){ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $http, appConfig, $timeout){
$scope.records = []; $scope.records = [];
$scope.empSearchId = ""; $scope.empSearchId = "";
$scope.status = "Active";
$scope.parentData = { $scope.parentData = {
"employeeId": "", "employeeId": "",
"employeeName": "", "employeeName": "",
"gender": "",
"emailId":"", "emailId":"",
"role": "",
"designation":"", "designation":"",
"action":"", "action":"",
"passportExpiryDate":"" "passportExpiryDate":""
...@@ -17,22 +16,18 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -17,22 +16,18 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.gridOptions = { $scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100], paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10, paginationPageSize : 50,
pageNumber: 1, pageNumber: 1,
pageSize:10, pageSize:10,
enableFiltering: true, enableFiltering: true,
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120}, {field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120,cellClass: 'grid-align'},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true,cellClass: 'grid-align'},
{field : 'gender',displayName: 'Gender', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false,cellClass: 'grid-align'},
{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true,cellClass: 'grid-align'},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true,cellClass: 'grid-align'},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true,cellClass: 'grid-align'},
{field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true}, {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100,cellClass: 'grid-align'}
{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
//{field : 'hasPassort',displayName: 'HasPassort', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
//{field : 'hasB1',displayName: 'HasB1', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
] ]
}; };
$scope.gridOptions.data = $scope.records; $scope.gridOptions.data = $scope.records;
...@@ -45,18 +40,13 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -45,18 +40,13 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120}, {field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'gender',displayName: 'Gender', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
//{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true}, {field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true},
//{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:200},
{field : 'functionalGroup',displayName: 'Functional Org', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:120} {field : 'functionalGroup',displayName: 'Functional Org', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:120}
// {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
] ]
}; };
//$scope.gridOptionsOrgView.data = $scope.records;
$scope.getRowData = function(row, action){ $scope.getRowData = function(row, action){
$scope.parentData.employeeId = row.entity.employeeId; $scope.parentData.employeeId = row.entity.employeeId;
...@@ -89,9 +79,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -89,9 +79,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.empSearchId = ""; $scope.empSearchId = "";
$scope.getUserRoles(); $scope.getUserRoles();
} }
$scope.refreshPageOrg = function(){
$scope.getOrgEmps();
}
var gridOptionsReport = { var gridOptionsReport = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100], paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10, paginationPageSize : 10,
...@@ -101,19 +88,17 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -101,19 +88,17 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120}, {field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'gender',displayName: 'Gender', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false}, {field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true}, {field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true}, {field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true},
{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100} {name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
] ]
}; };
$scope.getUserRoles = function(){ $scope.getUserRoles = function(){
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "user/getUserRoles" url : appConfig.appUri + "user/getEmployeeByStatus?status="+$scope.status
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
}, function myError(response) { }, function myError(response) {
...@@ -121,81 +106,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -121,81 +106,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
}); });
}; };
$scope.getReportData = function(){
$http({
method : "GET",
url : appConfig.appUri + "reports/functioNalGroup"
}).then(function mySuccess(response) {
$scope.reportData= response.data;
alert("reportData"+reportData)
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
alert("reportData1"+reportData)
$scope.reportData = [];
});
};
$scope.getOrgEmps = function(){
$http({
method : "GET",
url : appConfig.appUri + "user/getUserRoles"
}).then(function mySuccess(response) {
$scope.gridOptionsOrgView.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptionsOrgView.data = [];
});
};
$scope.validateEmpId = function(){
var searchId = $scope.empSearchId;
if(searchId !="" && isNaN(searchId)){
showAlert('Please enter only digits');
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else if(searchId != "" && (searchId.length < 5 || searchId.length > 5)){
showAlert('Employee ID should be 5 digits');
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else if(searchId != "" && !checkEmpIdRange(searchId)){
showAlert('Employee ID should be in between '+appConfig.empStartId+' - '+appConfig.empEndId);
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}
};
function checkEmpIdRange(searchId){
return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId;
}
$scope.getEmployeeRole = function(type){
var searchId = $scope.empSearchId;
if(searchId =="" && searchId.length == 0){
showAlert('Employee ID is mandatory');
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else if(searchId != "" && !checkEmpIdRange(searchId)){
showAlert('Employee ID should be in between '+appConfig.empStartId+' - '+appConfig.empEndId);
$scope.empSearchId = "";
document.getElementById('empSearchId').focus();
}else{
$scope.gridOptions.data = [];
getEmployeeRoleData(searchId);
}
};
function getEmployeeRoleData(empId){
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeRoleData?empId=" + empId
}).then(function mySuccess(response) {
if(response.data != "" && response.data.length !=0){
$scope.gridOptions.data.push(response.data);
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.refreshPage();
});
}
function showAlert(message) { function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent( $mdDialog.show($mdDialog.alert().parent(
...@@ -370,25 +280,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -370,25 +280,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}; };
$scope.validateEmpId = function(){
var searchId = $scope.empId;
if(searchId != "" && isNaN(searchId)){
$scope.alertMsg = "Please enter only digits";
document.getElementById('empId').focus();
}else if(searchId != "" && ((searchId.length >0 && searchId.length <5) || searchId.length>5)){
$scope.alertMsg = "Employee ID should be 5 digits";
document.getElementById('empId').focus();
}else if(searchId != "" && !checkRoleEmpIdRange(searchId)){
$scope.alertMsg = 'Employee ID should be in between '+appConfig.empStartId+' - '+appConfig.empEndId;
document.getElementById('empId').focus();
}else if(searchId != "" && checkRoleExistence(searchId)){
$scope.alertMsg = 'Employee ID is already assigned a role';
document.getElementById('empId').focus();
}else{
$scope.alertMsg = "";
}
};
function checkRoleEmpIdRange(searchId){ function checkRoleEmpIdRange(searchId){
return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId; return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId;
} }
...@@ -428,7 +319,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -428,7 +319,6 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var gender = $scope.gender; var gender = $scope.gender;
var empRole = $scope.empRole; var empRole = $scope.empRole;
var empEmail = $scope.empEmail; var empEmail = $scope.empEmail;
// alert("passportExpiryDate::"+$scope.passportExpiryDate)
if(searchId == ""){ if(searchId == ""){
$scope.alertMsg = "Employee ID is mandatory"; $scope.alertMsg = "Employee ID is mandatory";
document.getElementById('empId').focus(); document.getElementById('empId').focus();
......
<style>
.grid-align {
text-align: left;
}
</style>
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;" <div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer" ng-controller="assignRoleController" id="popupContainer" ng-controller="assignRoleController"
ng-init="getUserRoles()"> ng-init="getUserRoles()">
...@@ -17,10 +22,26 @@ ...@@ -17,10 +22,26 @@
</div> </div>
</div> </div>
<br/> <br/>
<div class="form-group col-lg-7 col-md-7 col-sm-7 col-xs-12"></div>
<div class="row col-lg-12" style="margin-left: 0px;">
<input type="radio" ng-model="status" value="Active" ng-click="getUserRoles()"> Active
<input type="radio" ng-model="status" value="In Active" ng-click="getUserRoles()"> Inactive
<input type="radio" ng-model="status" value="both" ng-click="getUserRoles()"> Both
</div>
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group"> <div class="form-group">
<div class="form-inline col-lg-12" style="margin-left: 10px;"> <div class="form-inline col-lg-12" style="margin-left: 10px;">
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12"> <!-- <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="input-group" <div class="input-group"
style=""> style="">
<input type="text" ng-model="empSearchId" id="empSearchId" <input type="text" ng-model="empSearchId" id="empSearchId"
...@@ -36,9 +57,9 @@ ...@@ -36,9 +57,9 @@
</button> </button>
</span> </span>
</div> </div>
</div> </div> -->
<div class="form-group col-lg-7 col-md-7 col-sm-7 col-xs-12"></div> <!-- <div class="form-group col-lg-7 col-md-7 col-sm-7 col-xs-12"></div> -->
<div class="form-group col-lg-2" style="margin-left:0px;"> <div class="form-group col-lg-2" style="margin-top: 30px;margin-left: 355px;">
<label class="" for="submitBtn"><md-button <label class="" for="submitBtn"><md-button
class="md-raised md-primary" class="md-raised md-primary"
style="width:142px;background: cadetblue;margin:0px;" style="width:142px;background: cadetblue;margin:0px;"
...@@ -53,13 +74,4 @@ ...@@ -53,13 +74,4 @@
</div> </div>
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
</div> </div>
\ No newline at end of file
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