Commit a2c38007 authored by Prayas Jain's avatar Prayas Jain

REFACTORED MANAGE_PROJECTS

parent 5ca5306f
......@@ -50,6 +50,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
method : "GET",
url : appConfig.appUri + "accounts"
}).then(function mySuccess(response) {
console.log(response)
if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
......@@ -171,7 +172,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
$scope.getDeliveryManagers = function(){
$http({
method : "GET",
url : appConfig.appUri + "/employees/active/sortByName"
url : appConfig.appUri + "employees/active/sortByName"
}).then(function mySuccess(response) {
$scope.managerDetails=response.data;
}, function myError(response) {
......
......@@ -85,7 +85,7 @@ myApp.controller("domainController",
{
method : "GET",
url : appConfig.appUri
+ "/employees/active/sortByName"
+ "employees/active/sortByName"
})
.then(
function mySuccess(response) {
......@@ -109,7 +109,7 @@ myApp.controller("domainController",
$scope.getDomains = function() {
$http({
method : "GET",
url : appConfig.appUri + "/domains"
url : appConfig.appUri + "domains"
})
.then(
function mySuccess(response) {
......@@ -122,6 +122,7 @@ myApp.controller("domainController",
}
$scope.gridOptions.data = response.data.records;
console.log(response.data.records)
},
function myError(response) {
showAlert("Something went wrong while fetching data!!!");
......@@ -179,7 +180,7 @@ myApp.controller("domainController",
function deleteDomainRow(domainId) {
var req = {
method : 'DELETE',
url : appConfig.appUri + "/domains?domainId="
url : appConfig.appUri + "domains?domainId="
+ domainId
}
$http(req).then(function mySuccess(response) {
......@@ -211,7 +212,7 @@ myApp.controller("domainController",
}
function AddDomainController($scope, $mdDialog, dataToPass,gridOptionsData, employees) {
console.log("employees", employees);
$scope.searchTerm = "";
$scope.updateSearch = function(e) {
e.stopPropagation();
......@@ -241,7 +242,6 @@ myApp.controller("domainController",
function getActiveAccounts(){
var activeAccounts = [];
for (var i in allAccounts.records){
console.log(allAccounts.records[i]);
if(allAccounts.records[i].status == "Active" || allAccounts.records[i].status == "Y"){
activeAccounts.push(allAccounts.records[i]);
}
......@@ -402,7 +402,7 @@ myApp.controller("domainController",
}
$http({
method : methodType,
url : appConfig.appUri + "/domains",
url : appConfig.appUri + "domains",
headers : {
"Content-type" : "application/json"
},
......@@ -469,6 +469,7 @@ myApp.controller("domainController",
"accountId" : $scope.AccountInfo.accountId,
"deliveryManagers" : $scope.deliveryHeads()
};
console.log(record)
$scope.addOrUpdateDomain(record,action);
}
}else{
......@@ -507,6 +508,7 @@ myApp.controller("domainController",
}))
}
else {
console.log(record)
$scope.addOrUpdateDomain(record, action);
}
}
......
......@@ -90,7 +90,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
method : "GET",
url : appConfig.appUri + "accounts"
}).then(function mySuccess(response) {
myFactory.setAccounts(response.data);
myFactory.setAccounts(response.data.records);
}, function myError(response) {
......
......@@ -120,9 +120,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.getManagerDetails = function () {
$http({
method: "GET",
url: appConfig.appUri + "/employees/managers/"
url: appConfig.appUri + "employees/managers/"
}).then(function mySuccess(response) {
$scope.managers = response.data;
$scope.managers = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -289,7 +289,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function deleteTeam(record){
var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "/projectTeam/resources?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "projectTeam/resources?loginEmpId="+loginEmpId;
var req = {
method : 'POST',
url : urlRequest,
......@@ -456,7 +456,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.getEmployeeDetails = function(){
$http({
method : "GET",
url : appConfig.appUri + "/employees/active/sortByName"
url : appConfig.appUri + "employees/active/sortByName"
}).then(function mySuccess(response) {
$scope.employeeList =response.data;
}, function myError(response) {
......@@ -960,9 +960,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function getManagersAssociatedToDomain(id,action){
$http({
method : "GET",
url : appConfig.appUri + "/employees/deliveryLeads/"+id
url : appConfig.appUri + "employees/deliveryLeads/"+id
}).then(function mySuccess(response) {
var result = response.data;
var result = response.data.records;
if(result != "" || result.length != 0){
$scope.managerDetails = result;
}
......
......@@ -65,7 +65,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
$scope.getMyTeamDetails = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getMyTeamDetails?employeeId="+myFactory.getEmpId()
url : appConfig.appUri + "projectTeam/resources/active?employeeId="+myFactory.getEmpId()
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
......@@ -76,7 +76,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
$scope.getEmployeesToTeam = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getEmployeesToTeam"
url : appConfig.appUri + "employees/active/sortByName"
}).then(function mySuccess(response) {
$scope.employees=response.data;
}, function myError(response) {
......@@ -88,7 +88,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
$scope.getProjects = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getProjects?employeeId="+myFactory.getEmpId()
url : appConfig.appUri + "projects?employeeId="+myFactory.getEmpId()
}).then(function mySuccess(response) {
$scope.projects = response.data;
}, function myError(response) {
......@@ -138,7 +138,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
function getEmployeeRoleData(empId){
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeRoleData?empId=" + empId
url : appConfig.appUri + "employees/employeeId/" + empId
}).then(function mySuccess(response) {
if(response.data != "" && response.data.length !=0){
$scope.gridOptions.data.push(response.data);
......@@ -212,7 +212,7 @@ myApp.controller("projectMyTeamController",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;
......@@ -386,14 +386,17 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
function addOrUpdateRole(record, action){
var urlRequest = "";
var requestMethod = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Assign"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "projectTeam/resources?loginEmpId="+loginEmpId;
requestMethod = 'POST';
}else if(action == "Update"){
urlRequest = appConfig.appUri+ "user/updateEmployeeRole";
urlRequest = appConfig.appUri+ "employees/"+loginEmpId;
requestMethod = 'PUT';
}
var req = {
method : 'POST',
method : requestMethod,
url : urlRequest,
headers : {
"Content-type" : "application/json"
......
......@@ -53,7 +53,7 @@ myApp.controller("employeesController", function($scope, $http, myFactory, $mdDi
$scope.getEmployeeDetailsForAutocomplete = function(){
$http({
method : "GET",
url : appConfig.appUri + "/employee/autocomplete"
url : appConfig.appUri + "employee/autocomplete"
}).then(function mySuccess(response) {
if(response.data != "" && response.data.length !=0){
$scope.employeeDetails = response.data;
......@@ -151,7 +151,7 @@ myApp.controller("employeesController", function($scope, $http, myFactory, $mdDi
function getEmployeeIdFromRoles(searchId, searchAttribute, fromDate, toDate, type){
$http({
method : "GET",
url : appConfig.appUri + "/employee/searchCriteria?searchId=" + searchId + "&searchAttribute=" + searchAttribute
url : appConfig.appUri + "employee/searchCriteria?searchId=" + searchId + "&searchAttribute=" + searchAttribute
}).then(function mySuccess(response) {
if(response.data != "" && response.data.length !=0){
getData(response.data.employeeId, fromDate, toDate, type);
......
......@@ -110,7 +110,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
function getEmployeeRoleData(empId){
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeRoleData?empId=" + empId
url : appConfig.appUri + "employees/employeeId/" + empId
}).then(function mySuccess(response) {
if(response.data != "" && response.data.length !=0){
$scope.gridOptions.data.push(response.data);
......@@ -218,7 +218,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
function deleteUserRole(projectId){
var req = {
method : 'DELETE',
url : appConfig.appUri+ "project/deleteProject?projectId="+projectId
url : appConfig.appUri+ "deleteProject?projectId="+projectId
}
$http(req).then(function mySuccess(response) {
$scope.result = response.data;
......@@ -292,7 +292,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
$scope.isDisabled = true;
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getProjectDetails?projectId="+$scope.projectId
url : appConfig.appUri + "projectTeam/resources/project/"+$scope.projectId
}).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
......@@ -327,7 +327,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
$scope.isDisabled = true;
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getUnAssignedEmployees"
url : appConfig.appUri + "projectTeam/getUnAssignedEmployees"
}).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
......@@ -402,7 +402,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
$scope.isDisabled = true;
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getProjectAllocations"
url : appConfig.appUri + "projectTeam/resources/projects/"
}).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
......@@ -533,14 +533,17 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
function addOrUpdateProject(record, action){
var urlRequest = "";
var requestMethod = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Assign"){
urlRequest = appConfig.appUri+ "project/addProject?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "projects?loginEmpId="+loginEmpId;
requestMethod = 'POST';
}else if(action == "Update"){
urlRequest = appConfig.appUri+ "project/updateProject?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "projects?loginEmpId="+loginEmpId;
requestMethod = 'PUT';
}
var req = {
method : 'POST',
method : requestMethod,
url : urlRequest,
headers : {
"Content-type" : "application/json"
......
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