Commit b6f5ec3d authored by Prayas Jain's avatar Prayas Jain

Url Refactored in Accounts and Assign Role Controller

parent 62eb6ba1
......@@ -40,10 +40,10 @@ public class EmployeeController {
private IEmployeeRoleService employeeRoleService;
@RequestMapping(value = "/employees/{empId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createEmployee(@Valid @RequestBody Employee employeeReq,
public ResponseEntity<?> createEmployee( @RequestBody Employee employeeReq,
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if (!empService.isEmployeeExistsById(loginEmpId)) {
if (empService.isEmployeeExistsById(loginEmpId)) {
Employee employeePersisted = empService.createEmployee(employeeReq, loginEmpId);
ResponseDetails createRespDetails = new ResponseDetails(new Date(), 901, "Employee has been created",
......
......@@ -72,12 +72,12 @@ public class Employee implements Serializable {
@ExcelCellName("Skills")
private String technologyKnown;
@NotBlank
@Pattern(regexp="(^$|[0-9]{10})",message="Invalid mobile number")
@ExcelCellName("Primary Mobile")
private String mobileNumber;
@NotBlank
@Pattern(regexp="(^$|[0-9]{10})",message="Invalid alternate mobile number")
@ExcelCellName("Alternate Mobile")
private String alternateMobileNumber;
......
......@@ -56,7 +56,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
else{
$scope.gridOptions.enablePaginationControls = false;
}
$scope.gridOptions.data=response.data;
$scope.gridOptions.data=response.data.records;
myFactory.setAccounts(response.data);
for(i=0;i<response.data.length;i++){
if(response.data[i].status == 'Y'){
......@@ -112,7 +112,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
function deleteAccountRole(accountId){
var req = {
method : 'DELETE',
url : appConfig.appUri+ "accounts?accountId="+accountId
url : appConfig.appUri+ "accounts/"+accountId
}
$http(req).then(function mySuccess(response) {
$scope.result = "Success";
......@@ -171,7 +171,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
$scope.getDeliveryManagers = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getEmployeesToTeam"
url : appConfig.appUri + "/employees/active/sortByName"
}).then(function mySuccess(response) {
$scope.managerDetails=response.data;
}, function myError(response) {
......@@ -359,7 +359,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
addOrUpdateAccount = function(record,action,flag){
var urlRequest = "";
if(action == "Add" || action == "Update"){
urlRequest = appConfig.appUri+"account/accounts?action="+flag ;
urlRequest = appConfig.appUri+"accounts?action="+flag ;
}
var req = {
method : 'POST',
......
......@@ -102,7 +102,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.getUserRoles = function(){
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeByStatus?status="+$scope.status
url : appConfig.appUri + "employees/?status="+$scope.status
}).then(function mySuccess(response) {
if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true;
......@@ -116,7 +116,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
else{
$scope.gridOptions.columnDefs[6].visible = true;
}
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -126,9 +126,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.getOrgEmps = function(){
$http({
method : "GET",
url : appConfig.appUri + "user/getUserRoles"
url : appConfig.appUri + "employees/active"
}).then(function mySuccess(response) {
$scope.gridOptionsOrgView.data = response.data;
$scope.gridOptionsOrgView.data = response.data.records;
if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
......@@ -189,7 +189,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
function deleteUserRole(empId){
var req = {
method : 'DELETE',
url : appConfig.appUri+ "user/deleteEmployee?empId="+empId
url : appConfig.appUri+ "employees/"+empId
}
$http(req).then(function mySuccess(response) {
$scope.result = response.data;
......@@ -626,10 +626,10 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
function addOrUpdateRole(record, action){
var empId = myFactory.getEmpId();
var urlRequest = "";
if(action == "Add"){
urlRequest = appConfig.appUri+ "user/assignEmployeeRole?empId="+empId;
if(action == " "){
urlRequest = appConfig.appUri+ "employees/"+empId;
}else if(action == "Update"){
urlRequest = appConfig.appUri+ "user/updateEmployeeRole?empId="+empId;
urlRequest = appConfig.appUri+ "employees/"+empId;
}
var req = {
method : 'POST',
......
......@@ -31,9 +31,9 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
function getUserRole(profile){
$http({
method : "GET",
url : appConfig.appUri + "employees?emailId="+profile.getEmail()
url : appConfig.appUri + "employees/emailId/"+profile.getEmail()
}).then(function mySuccess(response) {
var result = response.data;
var result = response.data.records;
if(result == "" || result.length == 0){
showRegisterEmployeeScreen(profile);
}else{
......@@ -78,9 +78,9 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
function getAllLocations(){
$http({
method : "GET",
url : appConfig.appUri + "employees/locations/"
url : appConfig.appUri +"/organization/locations/"
}).then(function mySuccess(response) {
myFactory.setLocations(response.data);
myFactory.setLocations(response.data.records);
}, function myError(response) {
});
......@@ -93,6 +93,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
myFactory.setAccounts(response.data);
}, function myError(response) {
});
};
function showRegisterEmployeeScreen(profile){
......
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