Commit 7a8ddf80 authored by Prayas Jain's avatar Prayas Jain

Refactored Accounts_Shifts_MyProfile

parent 8f8e6b01
...@@ -358,11 +358,16 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo ...@@ -358,11 +358,16 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
}; };
addOrUpdateAccount = function(record,action,flag){ addOrUpdateAccount = function(record,action,flag){
var urlRequest = ""; var urlRequest = "";
if(action == "Add" || action == "Update"){ var requestMethod = "";
urlRequest = appConfig.appUri+"accounts?action="+flag ; if(action == "Add"){
urlRequest = appConfig.appUri+ "accounts";
requestMethod ='POST';
}else if (action == "Update"){
urlRequest = appConfig.appUri+ "accounts/" + record.accountId;
requestMethod = 'PUT';
} }
var req = { var req = {
method : 'POST', method : requestMethod,
url : urlRequest, url : urlRequest,
headers : { headers : {
"Content-type" : "application/json" "Content-type" : "application/json"
......
...@@ -624,15 +624,18 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -624,15 +624,18 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
} }
function addOrUpdateRole(record, action){ function addOrUpdateRole(record, action){
var requestMethod = "";
var empId = myFactory.getEmpId(); var empId = myFactory.getEmpId();
var urlRequest = ""; var urlRequest = "";
if(action == " "){ if(action == "Add"){
urlRequest = appConfig.appUri+ "employees/"+empId; urlRequest = appConfig.appUri+ "employees/"+empId;
requestMethod ='POST';
}else if(action == "Update"){ }else if(action == "Update"){
urlRequest = appConfig.appUri+ "employees/"+empId; urlRequest = appConfig.appUri+ "employees/"+empId;
requestMethod = 'PUT';
} }
var req = { var req = {
method : 'POST', method : requestMethod,
url : urlRequest, url : urlRequest,
headers : { headers : {
"Content-type" : "application/json" "Content-type" : "application/json"
......
...@@ -254,7 +254,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -254,7 +254,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}; };
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "projectTeam/getEmployeeBillingDetailsAll?employeeId="+$scope.profile.employeeId url : appConfig.appUri + "billing?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//alert("response"+response); //alert("response"+response);
// alert("response"+response.data); // alert("response"+response.data);
...@@ -264,7 +264,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -264,7 +264,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}); });
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "projectTeam/getMyProjectAllocations?employeeId="+$scope.profile.employeeId url : appConfig.appUri + "getMyProjectAllocations?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//alert("response"+response); //alert("response"+response);
// alert("response"+response.data); // alert("response"+response.data);
...@@ -274,7 +274,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -274,7 +274,7 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}); });
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "user/getEmployeeLocations?employeeId="+$scope.profile.employeeId url : appConfig.appUri + "employees/locations/"+$scope.profile.employeeId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
//alert("response"+response); //alert("response"+response);
// alert("response"+response.data); // alert("response"+response.data);
......
...@@ -8,9 +8,9 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial ...@@ -8,9 +8,9 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial
var empId = $scope.empId; var empId = $scope.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) {
$scope.profile = response.data; $scope.profile = response.data.records;
}, function myError(response) { }, function myError(response) {
showAlert("Something went wrong while fetching data!!!"); showAlert("Something went wrong while fetching data!!!");
}); });
...@@ -68,7 +68,7 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial ...@@ -68,7 +68,7 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":myFactory.getEmpId(), "mobileNumber": mobileNumber, "alternateMobileNumber": $scope.alternateMobileNumber, "personalEmailId": $scope.personalEmailId, "baseTechnology": $scope.baseTechnology, "technologyKnown": $scope.technologyKnown}; var record = {"employeeId":myFactory.getEmpId(), "mobileNumber": mobileNumber, "alternateMobileNumber": $scope.alternateMobileNumber, "personalEmailId": $scope.personalEmailId, "baseTechnology": $scope.baseTechnology, "technologyKnown": $scope.technologyKnown};
var urlRequest = ""; var urlRequest = "";
urlRequest = appConfig.appUri+ "user/updateProfile"; urlRequest = appConfig.appUri+ "/employees/updateProfile";
var req = { var req = {
method : 'POST', method : 'POST',
......
...@@ -64,7 +64,7 @@ myApp.controller("myProjectAllocationsController",function($scope, myFactory, $m ...@@ -64,7 +64,7 @@ myApp.controller("myProjectAllocationsController",function($scope, myFactory, $m
$scope.getMyProjectAllocations = function(){ $scope.getMyProjectAllocations = function(){
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/projectTeam/getMyProjectAllocations?employeeId="+myFactory.getEmpId() url : appConfig.appUri + "getMyProjectAllocations?employeeId="+myFactory.getEmpId()
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
if(response.data.length > 10){ if(response.data.length > 10){
...@@ -128,7 +128,7 @@ myApp.controller("myProjectAllocationsController",function($scope, myFactory, $m ...@@ -128,7 +128,7 @@ myApp.controller("myProjectAllocationsController",function($scope, myFactory, $m
$scope.isDisabled = true; $scope.isDisabled = true;
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/projectTeam/getProjectDetails?projectId="+$scope.projectId url : appConfig.appUri + "resources/project/"+$scope.projectId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
if(response.data.length > 10){ if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true; $scope.gridOptions.enablePaginationControls = true;
......
...@@ -102,7 +102,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -102,7 +102,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
var deliveryLeadEmpId = ((role == "Delivery Lead") ? empId : undefined); var deliveryLeadEmpId = ((role == "Delivery Lead") ? empId : undefined);
$http({ $http({
method: "GET", method: "GET",
url: appConfig.appUri + "project/getProjects?empId="+deliveryLeadEmpId url: appConfig.appUri + "projects/?empId="+deliveryLeadEmpId
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
if(response.data.length > 10){ if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true; $scope.gridOptions.enablePaginationControls = true;
...@@ -168,7 +168,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -168,7 +168,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
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);
...@@ -276,7 +276,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -276,7 +276,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
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;
...@@ -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/deleteTeammate?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 + "projectTeam/getEmployeesToTeam" 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) {
...@@ -553,7 +553,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -553,7 +553,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
} }
$http({ $http({
method: "GET", method: "GET",
url: appConfig.appUri + "/projectTeam/getProjectDetails?projectId=" + $scope.projectId + "&status=" + $scope.status url: appConfig.appUri + "projectTeam/resources/project/"+ $scope.projectId + "?status=" + $scope.status
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
if(response.data.length > 10){ if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true; $scope.gridOptions.enablePaginationControls = true;
...@@ -750,7 +750,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -750,7 +750,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$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.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
}, function myError(response) { }, function myError(response) {
...@@ -821,7 +821,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -821,7 +821,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$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.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
}, function myError(response) { }, function myError(response) {
...@@ -865,7 +865,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -865,7 +865,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function getDomainsAssoicatedToAccount(id,action){ function getDomainsAssoicatedToAccount(id,action){
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/user/getDomains?accountId="+id url : appConfig.appUri + "domains/"+id
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
var result = response.data; var result = response.data;
if(result != "" || result.length != 0){ if(result != "" || result.length != 0){
...@@ -960,7 +960,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -960,7 +960,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function getManagersAssociatedToDomain(id,action){ function getManagersAssociatedToDomain(id,action){
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/user/getDeliveryLeads?domainId="+id url : appConfig.appUri + "/employees/deliveryLeads/"+id
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
var result = response.data; var result = response.data;
if(result != "" || result.length != 0){ if(result != "" || result.length != 0){
...@@ -1471,7 +1471,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1471,7 +1471,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function getProjectDetails(projectId,status){ function getProjectDetails(projectId,status){
$http({ $http({
method: "GET", method: "GET",
url: appConfig.appUri + "/projectTeam/getProjectDetails?projectId=" + projectId + "&status=" +status url: appConfig.appUri + "projectTeam/resources/project/"+ $scope.projectId + "?status=" + $scope.status
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
if(status == "InActive" || status == "Both"|| dataToPass.status == "InActive"){ if(status == "InActive" || status == "Both"|| dataToPass.status == "InActive"){
...@@ -1495,9 +1495,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1495,9 +1495,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
function updateTeamRecord(record, action){ function updateTeamRecord(record, action){
var urlRequest = ""; var urlRequest = "";
var loginEmpId = myFactory.getEmpId(); var loginEmpId = myFactory.getEmpId();
urlRequest = appConfig.appUri+ "/projectTeam/updateTeammate?loginEmpId="+loginEmpId; urlRequest = appConfig.appUri+ "projectTeam/resources?loginEmpId="+loginEmpId;
var req = { var req = {
method : 'POST', method : 'PUT',
url : urlRequest, url : urlRequest,
headers : { headers : {
"Content-type" : "application/json" "Content-type" : "application/json"
...@@ -1529,14 +1529,17 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS ...@@ -1529,14 +1529,17 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
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"
......
...@@ -82,7 +82,7 @@ myApp.controller("shiftDetailsController",function($scope, myFactory,exportUiGri ...@@ -82,7 +82,7 @@ myApp.controller("shiftDetailsController",function($scope, myFactory,exportUiGri
$scope.selectedshiftValue=shiftV; $scope.selectedshiftValue=shiftV;
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/projectTeam/getShiftDetails?shift="+shiftV url : appConfig.appUri + "projectTeam/resources/"+shiftV
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
$scope.shiftCount=response.data.length; $scope.shiftCount=response.data.length;
......
...@@ -62,7 +62,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid ...@@ -62,7 +62,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
$scope.getManagerDetails = function(){ $scope.getManagerDetails = function(){
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/user/getManagers" url : appConfig.appUri + "employees/managers/"
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.managers=response.data; $scope.managers=response.data;
}, function myError(response) { }, function myError(response) {
......
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