Commit d40cd400 authored by Prayas Jain's avatar Prayas Jain

Added Substatus Report Screen

parent e392dd8e
......@@ -285,7 +285,7 @@ public class EmployeeController {
@RequestMapping(value = "/employeesBasedOnSubStatusForGivenDates", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> employeesBasedOnSubStatusForGivenDates(@RequestParam("fromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) Date fromDate ,
@RequestParam("fromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) Date toDate,
@RequestParam("toDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) Date toDate,
@RequestParam("subStatus") String subStatus ,
HttpServletRequest request){
List<EmployeeSubStatusVO> employees = subStatusService.employeesBasedOnSubStatusForGivenDates(fromDate,toDate,subStatus);
......
......@@ -266,6 +266,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "Employee Efforts","icon" : "fa fa-user-circle-o fa-2x","path" : "templates/employeeEfforts.html"});
menuItems.push({"menu" : "Reserved Reports","icon" : "fa fa-file-pdf-o fa-2x","path" : "templates/reservedReport.html"});
menuItems.push({"menu" : "Allocation Change","icon" : "fa fa-file-excel-o fa-2x","path" : "templates/allocationChangeReport.html"});
menuItems.push({"menu" : "SubStatus Report","icon" : "fa fa-file-excel-o fa-2x","path" : "templates/subStatusReport.html"});
}else if(role == "Delivery Lead"){
//menuItems.push({"menu" : "Manage Employees","icon" : "fa fa-user-plus fa-2x","path" : "templates/roles.html"});
//menuItems.push({"menu" : "Manage Team","icon" : "fa fa-sitemap fa-2x","path" : "templates/projectDetails.html"});
......@@ -304,6 +305,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "Employee Efforts ","icon" : "fa fa-user-circle-o fa-2x","path" : "templates/employeeEfforts.html"});
menuItems.push({"menu" : "Reserved Reports","icon" : "fa fa-file-pdf-o fa-2x","path" : "templates/reservedReport.html"});
menuItems.push({"menu" : "Allocation Change","icon" : "fa fa-file-excel-o fa-2x","path" : "templates/allocationChangeReport.html"});
menuItems.push({"menu" : "SubStatus Report","icon" : "fa fa-file-excel-o fa-2x","path" : "templates/subStatusReport.html"});
}else if(role == "Lead"){
menuItems.push({"menu" : "My Team","icon" : "fa fa-futbol-o fa-2x","path" : "templates/myTeam.html"});
menuItems.push({"menu" : "Reportee Login Details","icon" : "fa fa-users fa-2x","path" : "templates/reportees.html"});
......@@ -335,6 +337,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "Employee Efforts","icon" : "fa fa-user-circle-o fa-2x","path" : "templates/employeeEfforts.html"});
menuItems.push({"menu" : "Reserved Reports","icon" : "fa fa-file-pdf-o fa-2x","path" : "templates/reservedReport.html"});
menuItems.push({"menu" : "Allocation Change","icon" : "fa fa-file-excel-o fa-2x","path" : "templates/allocationChangeReport.html"});
menuItems.push({"menu" : "SubStatus Report","icon" : "fa fa-file-excel-o fa-2x","path" : "templates/subStatusReport.html"});
}else{
menuItems.push({"menu" : "My Team","icon" : "fa fa-futbol-o fa-2x","path" : "templates/myTeam.html"});
menuItems.push({"menu" : "My Project Allocations","icon" : "fa fa-life-ring fa-2x","path" : "templates/myProjectAllocations.html"});
......
myApp.controller("subStatusController", function($scope, $http, myFactory, $mdDialog, appConfig) {
$scope.records = [];
$scope.empSubStatuses = myFactory.getEmployeeSubStatus();
if($scope.empSubStatuses.indexOf("All") == "-1"){
$scope.empSubStatuses.unshift("All");
}
// Date picker related code
var today = new Date();
var priorDt = today;
$scope.maxDate = today;
$scope.fromDate = priorDt;
$scope.toDate = today;
$scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10,
pageNumber: 1,
pageSize:10,
enableFiltering:true,
columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true, enableFiltering: true,width:'*'},
{field : 'employeeName',displayName: 'Employee Name', enableColumnMenu: false, enableSorting: false, enableFiltering: true,width:'*'},
{field : 'subStatus',displayName: 'Sub Status', enableColumnMenu: false, enableSorting: false,enableFiltering: true,width:'*'},
{field : 'subStatusStartDate',displayName: 'From Date', enableColumnMenu: false,enableFiltering: false, cellFilter: 'date:"dd-MMM-yyyy"',width:'*'},
{field : 'subStatusEndDate',displayName: 'To Date', enableColumnMenu: false,enableSorting: false,enableFiltering: false , cellFilter: 'date:"dd-MMM-yyyy"',width:'*'},
{field : 'functionalGroup',displayName: 'Functional Group', enableColumnMenu: false, enableSorting: false,enableFiltering: false, enableFiltering: true,width:'*'}
],
enableGridMenu: true,
enableSelectAll: true,
exporterMenuExcel:false,
exporterMenuCsv:false,
exporterCsvFilename: 'SubStatusReport.csv',
exporterExcelFilename:'SubStatusReport',
exporterPdfDefaultStyle: {fontSize: 9},
exporterPdfTableStyle: {margin: [15, 15, 15, 15]},
exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
exporterPdfHeader: { text: "Employee SubStatus Report", style: 'headerStyle' },
exporterPdfFooter: function ( currentPage, pageCount ) {
return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
},
exporterPdfCustomFormatter: function ( docDefinition ) {
docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
return docDefinition;
},
exporterPdfOrientation: 'portrait',
exporterPdfPageSize: 'LETTER',
exporterPdfMaxGridWidth: 500,
exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
onRegisterApi: function(gridApi){
$scope.gridApi = gridApi;
},
gridMenuCustomItems: [{
title: 'Export all data as EXCEL',
action: function ($event) {
exportUiGridService.exportToExcel('sheet 1', $scope.gridApi, 'all', 'all');
},
order: 110
},
{
title: 'Export visible data as EXCEL',
action: function ($event) {
exportUiGridService.exportToExcel('sheet 1', $scope.gridApi, 'visible', 'visible');
},
order: 111
}
]
};
$scope.gridOptions.data = [];
$scope.getSubStatusDetails = function(){
var fromDate = getFormattedDate($scope.fromDate);
var toDate = getFormattedDate($scope.toDate);
var empSubStatusV = $scope.empSubStatusValue;
if(empSubStatusV == undefined || empSubStatusV==""){
empSubStatusV="All";
}
$scope.empSubStatusValue=empSubStatusV;
$http({
method : "GET",
url : appConfig.appUri + 'employeesBasedOnSubStatusForGivenDates?fromDate='+fromDate+'&toDate='+toDate+'&subStatus='+$scope.empSubStatusValue
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data.records;
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
$scope.gridOptions.enablePaginationControls = false;
}
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
};
$scope.getSelectedSubStatus = function(){
if ($scope.empSubStatusValue !== undefined) {
return $scope.empSubStatusValue;
} else {
return "Please select a shift";
}
};
$scope.validateDates = function(dateValue, from) {
if(from == "FromDate"){
var toDat = $scope.toDate;
var difference = daysBetween(dateValue, toDat);
if(difference < 0 ){
showAlert('From Date should not be greater than To Date');
$scope.fromDate = priorDt;
$scope.toDate = today;
}else{
$scope.fromDate = dateValue;
$scope.toDate = toDat;
}
}else if(from == "ToDate"){
var fromDat = $scope.fromDate;
var differene = daysBetween(fromDat, dateValue);
if(differene < 0 ){
showAlert('To Date should not be less than From Date');
$scope.fromDate = priorDt;
$scope.toDate = today;
}else{
$scope.fromDate = fromDat;
$scope.toDate = dateValue;
}
}
};
function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent(
angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true).textContent(message).ariaLabel(
'Alert Dialog').ok('Ok'));
}
function getFormattedDate(date){
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
return year + '-' + (month < 10 ? "0" + month : month) + '-'
+ (day < 10 ? "0" + day : day);
}
function treatAsUTC(date) {
var result = new Date(date);
result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
return result;
}
function daysBetween(fromDate, toDate) {
var millisecondsPerDay = 24 * 60 * 60 * 1000;
return Math.round((treatAsUTC(toDate) - treatAsUTC(fromDate)) / millisecondsPerDay);
}
});
......@@ -182,7 +182,7 @@ i.fa.fa-refresh:hover {
background: transparent;
}
#sidebar-wrapper .sidebar-nav li ul.reportsGroup {
max-height: 291px;
max-height: 332px;
height: auto;
overflow: hidden;
padding: 0;
......@@ -680,3 +680,13 @@ cursor: pointer;
.alertMsg{
margin: 10px 0 0 0;
}
.substatus-dropdown > label {
padding-left:0;
}
.substatus-dropdown >md-select {
margin:0;
padding:0;
}
.substatus-report-grid {
height: calc(85vh - 243px) !important;
}
\ No newline at end of file
......@@ -73,6 +73,7 @@
<script src="controllers/MyProfileController.js"></script>
<script src="controllers/ResyncDataController.js"></script>
<script src="controllers/MyProjectAllocations.js"></script>
<script src="controllers/SubStatusReportController.js"></script>
<script src="controllers/DashboardController.js"></script>
<script src="controllers/VisaController.js"></script>
......
<div class="md-padding" id="popupContainer" ng-controller="subStatusController" ng-init="getSubStatusDetails()">
<div class="container-fluid mainDivHeaderClass">
<div class="row">
<div class="col-lg-12">
<h1 class="no-padding">Employee SubStatus Report
<span class="right">
<i class="fa fa-refresh" aria-hidden="true" ng-click="refreshPage()"></i>
</span>
</h1>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="form-horizontal">
<div class="form-group">
<div class="form-inline col-lg-12">
<div class="form-group row col-lg-6 col-sm-4">
<label class="" for="fromDate">From Date: <md-datepicker
ng-model="fromDate" md-placeholder="Enter date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
ng-change="validateDates(fromDate, 'FromDate')"></md-datepicker></label>
</div>
<div class="form-group row col-lg-6 col-sm-5">
<label class="" for="toDate">To Date: <md-datepicker
ng-model="toDate" md-placeholder="Enter date"
md-min-date="minDate" md-max-date="maxDate"
onkeydown="return false"
ng-change="validateDates(toDate, 'ToDate')"></md-datepicker></label>
</div>
</div>
</div>
<div class="form-group">
<div class="form-inline col-lg-12">
<div class="form-group row col-lg-6 col-sm-5 d-flex substatus-dropdown">
<label class="col-lg-2" for="fromDate">SubStatus: </label>
<md-select class="col-lg-4 " ng-model="empSubStatusValue" md-selected-text="getSelectedSubStatus() " id="empSubStatus" name="empSubStatus">
<md-optgroup label="Employee SubStatus ">
<md-option ng-value="empSubStatusValue " ng-repeat="empSubStatusValue in empSubStatuses">{{empSubStatusValue}}</md-option>
</md-optgroup>
</md-select>
</div>
<div class="form-group row col-lg-6 col-sm-2">
<label for="submitBtn"> <md-button
class="md-raised md-primary"
ng-click="getSubStatusDetails('click')"> <i
class="fa fa-search fa-2x"></i> Search</md-button></label>
</div>
</div>
</div>
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-exporter
class="mygrid substatus-report-grid">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
</div>
\ No newline at end of file
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