Commit e8fb3db6 authored by Prayas Jain's avatar Prayas Jain

Refactored Manage Projects

parent c4eda0cf
......@@ -123,18 +123,18 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
$scope.getEmployeesDashBoardData = function(){
$http({
method : "GET",
url : appConfig.appUri + "/getEmployeesDashBoard"
url : appConfig.appUri + "getEmployeesDashBoard"
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
if(response.data.length > 10){
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
......
......@@ -130,13 +130,13 @@ myApp.controller("myProjectAllocationsController",function($scope, myFactory, $m
method : "GET",
url : appConfig.appUri + "resources/project/"+$scope.projectId
}).then(function mySuccess(response) {
if(response.data.length > 10){
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......
......@@ -104,7 +104,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
method: "GET",
url: appConfig.appUri + "projects/employeeId/"+empId
}).then(function mySuccess(response) {
if(response.data.length > 10){
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
......@@ -555,15 +555,15 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
method: "GET",
url: appConfig.appUri + "resources/project/"+ $scope.projectId + "?status=" + $scope.status
}).then(function mySuccess(response) {
if(response.data.length > 10){
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
$scope.gridOptions.data = response.data;
for(i=0;i<response.data.length;i++){
if(response.data[i].role == 'Lead'){
$scope.gridOptions.data = response.data.records;
for(i=0;i<response.data.records.length;i++){
if(response.data.records[i].role == 'Lead'){
$scope.gridOptions.data[i].role = "Lead";
}else{
$scope.gridOptions.data[i].role = "Individual Contributor";
......@@ -750,9 +750,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.isDisabled = true;
$http({
method: "GET",
url: appConfig.appUri + "resources/getUnAssignedEmployees"
url: appConfig.appUri + "resources/unAssignedEmployees"
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -823,7 +823,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
method: "GET",
url: appConfig.appUri + "resources/projects"
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -1143,6 +1143,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$scope.alertMsg = "End date should not exceed project end date";
}
else {
$scope.id = $scope.id ? $scope.id : $scope.objectId;
$scope.alertMsg = "";
var record = {"id":$scope.id,"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "designation":employeeModel.designation,"projectId":project,"projectName":projectName,"managerId":managerId,"managerName":managerName,"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate,"account":account,"role":$scope.employeeRole,"newBillingStartDate":newBillingStartDate,"accountId":$scope.accountId,"domainId":$scope.domainId,"shift":$scope.employeeShift,"projectStartDate":$scope.startDate,"projectEndDate":$scope.endDate};
if(action == "Add"){
......@@ -1449,8 +1450,9 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$http(req).then(function mySuccess(response) {
$scope.result = "Success";
var titleOfModel = "Attention";
// $scope.objectId = response.data.id;
if(response.data =="TeamMate added successfuly"){
$scope.objectId = response.data.records.id;
console.log($scope.id,response.data.records.id ,"$scope.id ");
if(response.data.message =="TeamMate added successfuly"){
titleOfModel = "";
$timeout(function(){
updateGrid(action,record);
......@@ -1460,7 +1462,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
$mdDialog.show($mdDialog.alert({
skipHide: true,
title:titleOfModel,
textContent: response.data,
textContent: response.data.message,
ok: 'ok'
}));
......@@ -1473,7 +1475,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
method: "GET",
url: appConfig.appUri + "resources/project/"+ $scope.projectId + "?status=" + $scope.status
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
if(status == "InActive" || status == "Both"|| dataToPass.status == "InActive"){
$scope.gridOptions.columnDefs[5].visible = false;
}
......@@ -1505,9 +1507,8 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
data : record
}
$http(req).then(function mySuccess(response) {
console.log("Hi I am Here");
$scope.result = "Success";
if(response.data == "TeamMate updated successfuly" || response.data.includes("Resource Successfully moved from") ){
if(response.data.message == "TeamMate updated successfuly"){
$timeout(function () {
getProjectDetails($scope.projectId, $scope.status);
removeTab('Add');
......@@ -1515,7 +1516,7 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
}
$mdDialog.show($mdDialog.alert({
skipHide: true,
textContent: response.data,
textContent: response.data.message ,
ok: 'ok'
})).then(function () {
$scope.myForm.$setPristine();
......
......@@ -67,7 +67,7 @@ myApp.controller("projectMyTeamController",function($scope, myFactory, $mdDialog
method : "GET",
url : appConfig.appUri + "resources/active?employeeId="+myFactory.getEmpId()
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......
......@@ -121,9 +121,9 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.getUserRoles = function(){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getTeamDetails?employeeId="+myFactory.getEmpId()
url : appConfig.appUri + "resources/deliverylead/="+myFactory.getEmpId()
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -132,7 +132,7 @@ myApp.controller("projectTeamController",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) {
......@@ -258,7 +258,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
var loginEmpId = myFactory.getEmpId();
var req = {
method : 'POST',
url : appConfig.appUri+ "projectTeam/deleteTeammate?loginEmpId="+loginEmpId,
url : appConfig.appUri+ "resources?loginEmpId="+loginEmpId,
headers : {
"Content-type" : "application/json"
},
......@@ -327,7 +327,7 @@ myApp.controller("projectTeamController",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.projectList = response.data;
}, function myError(response) {
......@@ -400,7 +400,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getTeamDetails?employeeId="+dataToPass.employeeId
url : appConfig.appUri + "resources/deliverylead/"+dataToPass.employeeId
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
......@@ -446,19 +446,22 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
};
function addOrUpdateBilling(record, action){
var requestMethod = "";
var urlRequest = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Add"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeBilling?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "billing?loginEmpId="+loginEmpId;
requestMethod = 'POST';
}else if(action == "Update"){
urlRequest = appConfig.appUri+ "projectTeam/updateEmployeeBilling?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "billing?loginEmpId="+loginEmpId;
requestMethod = 'PUT';
}
else if(action == "Delete"){
urlRequest = appConfig.appUri+ "projectTeam/deleteEmployeeBilling";
urlRequest = appConfig.appUri+ "billing";
requestMethod = 'DELETE';
}
var req = {
method : 'POST',
method : requestMethod,
url : urlRequest,
headers : {
"Content-type" : "application/json"
......@@ -470,7 +473,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.objectId = response.data.id;
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getEmployeeBillingDetails?employeeId="+record.employeeId+"&projectId="+record.projectId
url : appConfig.appUri + "billing/project/" + record.projectId + "? employeeId=" +record.employeeId
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
......@@ -595,14 +598,14 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
};
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getEmployeeBillingDetails?employeeId="+dataToPass.employeeId+"&projectId="+dataToPass.projectId
url : appConfig.appUri + "billing/project/" + dataToPass.projectId + "? employeeId=" +dataToPass.employeeId
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}
$scope.designations = myFactory.getDesignations();
......@@ -620,7 +623,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
//MT-72
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getEmployeeProjectInfo?empId="+$scope.employeeModel.employeeId
url : appConfig.appUri + "resources/employeeId/"+$scope.employeeModel.employeeId
}).then(function mySuccess(response) {
$scope.projectInfoList = response.data;
}, function myError(response) {
......@@ -832,14 +835,17 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
function addOrUpdateRole(record, action){
var urlRequest = "";
var requestMethod = "";
var loginEmpId = myFactory.getEmpId();
if(action == "Add"){
urlRequest = appConfig.appUri+ "projectTeam/addEmployeeToTeam?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
requestMethod = 'POST';
}else if(action == "Update"){
urlRequest = appConfig.appUri+ "projectTeam/updateTeammate?loginEmpId="+loginEmpId;
urlRequest = appConfig.appUri+ "resources?loginEmpId="+loginEmpId;
requestMethod = 'PUT';
}
var req = {
method : 'POST',
method : requestMethod,
url : urlRequest,
headers : {
"Content-type" : "application/json"
......
......@@ -84,9 +84,9 @@ myApp.controller("shiftDetailsController",function($scope, myFactory,exportUiGri
method : "GET",
url : appConfig.appUri + "resources/shifts/"+shiftV
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
$scope.shiftCount=response.data.length;
if(response.data.length > 10){
$scope.gridOptions.data = response.data.records;
$scope.shiftCount=response.data.records.length;
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
......
......@@ -296,7 +296,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
}).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......@@ -406,7 +406,7 @@ myApp.controller("viewProjectController",function($scope, myFactory,exportUiGrid
}).then(function mySuccess(response) {
//$scope.teamdetails=response.data;
//$scope.gridOptions.data.push(response.data);
$scope.gridOptions.data = response.data;
$scope.gridOptions.data = response.data.records;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
......
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