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