Commit f7e0f931 authored by Prayas Jain's avatar Prayas Jain

Updated Regex for project name and fixed project updation issue

parent 7f66a623
......@@ -79,20 +79,31 @@ public class ProjectController {
@RequestParam(value = "loginEmpId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if (projectService.isProjectExistsById(projectId)) {
if (projectService.isProjectExistsByName(project.getProjectName())) {
Project updatedProject = projectService.updateProject(project, loginEmpId);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), ProjectStatus.UPDATE.getCode(),
ProjectStatus.UPDATE.getMessage(), "Project Updation Description", null,
request.getRequestURI(), "Project Updation details", updatedProject);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
}
ResponseDetails getRespDetails = new ResponseDetails(new Date(), ProjectStatus.PROJECT_NAME_IS_NOT_EXISTS.getCode(),
ProjectStatus.PROJECT_NAME_IS_NOT_EXISTS.getMessage(), "Please provide the valid project name", null,
request.getRequestURI(), "details", project);
Project existedProject = projectService.getProjectByProjectId(projectId);
if(!existedProject.getProjectName().equalsIgnoreCase(project.getProjectName())) {
if (!projectService.isProjectExistsByName(project.getProjectName())) {
Project updatedProject = projectService.updateProject(project, loginEmpId);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), ProjectStatus.UPDATE.getCode(),
ProjectStatus.UPDATE.getMessage(), "Project Updation Description", null,
request.getRequestURI(), "Project Updation details", updatedProject);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
}else {
ResponseDetails getRespDetails = new ResponseDetails(new Date(), ProjectStatus.PROJECT_NAME_IS_NOT_EXISTS.getCode(),
ProjectStatus.PROJECT_NAME_IS_NOT_EXISTS.getMessage(), "Please provide the valid project name", null,
request.getRequestURI(), "details", project);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
}
}else {
Project updatedProject = projectService.updateProject(project, loginEmpId);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), ProjectStatus.UPDATE.getCode(),
ProjectStatus.UPDATE.getMessage(), "Project Updation Description", null,
request.getRequestURI(), "Project Updation details", updatedProject);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
}
}
ResponseDetails getRespDetails = new ResponseDetails(new Date(), ProjectStatus.PROJECTID_IS_NOT_EXISTS.getCode(),
ProjectStatus.PROJECTID_IS_NOT_EXISTS.getMessage(), "Please provide the valid project Id", null,
......
......@@ -274,6 +274,15 @@ public class ReportsController {
return new ResponseEntity<>(empList, HttpStatus.OK);
}
@RequestMapping(value = "/fetchEmployeeDetailsByFGAccountAndBillability",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Reports>> getEmployeesByFGAccountAndBillability(
@RequestParam("fGroup") String fGroup , @RequestParam("billableStatus") String billableStatus,@RequestParam("acccount") String account) throws MyTeamException {
List<Reports> empList=null;
empList = reportService.getEmployeeDetailsByFGAccountAndBillability(fGroup,billableStatus,account);
return new ResponseEntity<>(empList, HttpStatus.OK);
}
@RequestMapping(value = "/getBarChartReport",
......
......@@ -17,5 +17,7 @@ public interface IReportService {
public List<Reports> getEmployeeDetailsByAccountBillability(String account, String billabilityStatus)throws MyTeamException;
public Project getProjectById(String employeeId);
public List<Reports> getEmployeeDetailsByFGAccountAndBillability(String fGroup, String billableStatus, String account);
}
\ No newline at end of file
......@@ -126,7 +126,7 @@ public class ReportService implements IReportService {
List<Employee> employeeList = new ArrayList<>();
List<Project> projects = projectService.getProjectsByAccountId(accountService.getAccountByName(accountName).getAccountId());
projects.stream().forEach(p -> {
resourceService.getResourceByProjectId(p.getProjectId()).stream().filter(r -> r.getBillingEndDate().after(new Date())).
resourceService.getResourceByProjectId(p.getProjectId()).stream().filter(r -> resourceService.isAllocationActiveToday(r)).
forEach(r ->{
Employee employee= employeeService.findByEmployeeIdAndEmpStatus(MyTeamUtils.ACTIVE,r.getEmployeeId());
if(employee!=null)
......@@ -144,6 +144,8 @@ public class ReportService implements IReportService {
return resultantEmployeeWithBillability(employeesByFG,billableStatus);
}
@Override
public List<Reports> getEmployeeDetailsByAccountBillability(String accountName, String billabilityStatus)
throws MyTeamException {
......@@ -230,4 +232,10 @@ public class ReportService implements IReportService {
return projectService.getProjectByProjectId(projectId);
}
@Override
public List<Reports> getEmployeeDetailsByFGAccountAndBillability(String fGroup, String billableStatus, String account) {
List<Employee> empList = getEmployeesByAccAndFG(account,fGroup);
return resultantEmployeeWithBillability(empList,billableStatus);
}
}
......@@ -71,5 +71,5 @@ email.workAnniversary.notification.subject=Happy Work Anniversary
email.workAnniversary.notification.cron=00 00 06 * * 1-7
spring.profiles.active=development
spring.profiles.active=production
message=this is from default configuration
\ No newline at end of file
......@@ -15,7 +15,13 @@ myApp.directive('hcPieChart', function () {
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element," Billability Monthly Trends");
}
else {
reportTypeApiFormat = reportType == "All Functional Group" ? reportType.replace(/\s/g, "") : reportType;
if(reportType=='I&A'){
reportTypeApiFormat = 'I%26A';
}else if(reportType == "All Functional Group"){
reportTypeApiFormat = reportType.replace(/\s/g, "");
}else{
reportTypeApiFormat = reportType;
}
getEmployeeDetails(scope,element[0].baseURI+'reports/getBarChartReport?byType='+reportTypeApiFormat,'column',element,"Billability For "+reportType);
}
}
......@@ -156,6 +162,23 @@ myApp.directive('hcPieChart', function () {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}else {
var fg = $scope.reportType == 'I&A' ? 'I%26A' : $scope.reportType;
$http({
method : "GET",
url : appConfig.appUri + "reports/fetchEmployeeDetailsByFGAccountAndBillability?fGroup="+fg+"&billableStatus="+seriesName+"&acccount="+category
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
if(response.data.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}
};
......
......@@ -23,7 +23,7 @@ myApp.controller("openPoolController", function($scope, $http, myFactory, $mdDia
'Non-Billable'
]
},
{field : 'billingStartDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false, enableFiltering: true,width:'*',cellFilter: 'date:"dd-MMM-yyyy"'},
{field : 'billingStartDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: true, enableFiltering: true,width:'*',cellFilter: 'date:"dd-MMM-yyyy"'},
{ name: 'Actions', displayName: 'Actions', cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false, enableFiltering: false, width:'*' }
],
enableGridMenu: true,
......
......@@ -53,7 +53,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
{ field: 'account', displayName: 'Account ', enableColumnMenu: false, enableSorting: true, enableFiltering: true},
//{field : 'managerId',displayName: 'Manager ID ', enableColumnMenu: false, enableSorting: false},
{ field: 'deliveryLeadIds', displayName: 'Delivery Lead', cellTemplate: '<div ng-repeat= "item in row.entity[col.field]">{{item.employeeName}}<span ng-hide="$last">,</span></div>', enableColumnMenu: false, enableSorting: true, enableFiltering: false },
{ field: 'status', displayName: 'Status ', enableColumnMenu: false, enableSorting: true, enableFiltering: false ,width:100},
{ field: 'status', displayName: 'Status ', enableColumnMenu: false, enableSorting: true, enableFiltering: true ,width:100},
{ name: 'Actions', displayName: 'Actions', cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false, enableFiltering: false, width:120 }
]
};
......@@ -2071,7 +2071,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
data: record
}
$http(req).then(function mySuccess(response) {
if(response.data.message == "Project is already existed"){
if(response.data.statusCode != 700 && response.data.statusCode != 701){
$mdDialog.show($mdDialog.alert({
skipHide: true,
title:'Attention',
......@@ -2109,7 +2109,7 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
return false;
}
function validateTextFields(name){
var pattern = /^[a-zA-Z\s]*$/;
var pattern = /^[a-zA-Z#@.,;:'()\/&\-"!]+( [a-zA-Z#@.,;:'()\/&\-"!]+)*$/;
if(pattern.test(name)){
return true;
}
......
......@@ -105,16 +105,14 @@
</td>
</tr>
</table>
<div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span>
</div>
</div>
</div>
</div>
</md-dialog-content>
<md-dialog-actions layout="row">
<div role="alert">
<span class="error" style="color: red; margin-right:95px">{{alertMsg}}</span>
</div>
<md-button class="md-raised" data-ng-click="validateProjectFields(templateTitle)" style="width:120px;background: cadetblue;color:white;">
<span ng-show="templateTitle == 'Assign' ">Add</span> <span ng-show="templateTitle != 'Assign' ">{{templateTitle}}</span> </md-button>
......
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