Commit 703a2b20 authored by mduppanapudi-nisum-com's avatar mduppanapudi-nisum-com Committed by rbonthala-nisum-com

Added shifts list and displaying reports based on shifts (#171)

parent 3f8caab7
...@@ -3,6 +3,8 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -3,6 +3,8 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.empId = myFactory.getEmpId(); $scope.empId = myFactory.getEmpId();
$scope.empName = myFactory.getEmpName(); $scope.empName = myFactory.getEmpName();
$scope.empEmailId = myFactory.getEmpEmailId(); $scope.empEmailId = myFactory.getEmpEmailId();
$scope.shifts = myFactory.getShifts();
$scope.shifts.unshift("All");
// Date picker related code // Date picker related code
var today = new Date(); var today = new Date();
$scope.maxDate = today; $scope.maxDate = today;
...@@ -17,7 +19,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -17,7 +19,7 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee Id', enableColumnMenu: false, enableSorting: true,enableFiltering: true}, {field : 'employeeId',displayName: 'Employee Id', enableColumnMenu: false, enableSorting: true,enableFiltering: true},
{field : 'employeeName',displayName: 'Employee Name', enableColumnMenu: false, enableSorting: false, enableFiltering: true}, {field : 'employeeName',displayName: 'Employee Name', enableColumnMenu: false, enableSorting: false, enableFiltering: true},
{field : 'ifPresent',displayName: 'Status', enableColumnMenu: false, enableSorting: false, enableFiltering: false} {field : 'present',displayName: 'Status', enableColumnMenu: false, enableSorting: false, enableFiltering: false}
], ],
enableGridMenu: true, enableGridMenu: true,
enableSelectAll: true, enableSelectAll: true,
...@@ -74,9 +76,15 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -74,9 +76,15 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
console.log(""); console.log("");
} }
var reportDate = getFormattedDate($scope.reportDate); var reportDate = getFormattedDate($scope.reportDate);
var shiftV = $scope.shiftValue;
if(shiftV == undefined || shiftV==""){
shiftV="All";
}
$scope.shiftValue=shiftV;
$scope.selectedshiftValue=shiftV;
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "attendance/attendanciesReport/" + reportDate url : appConfig.appUri + "attendance/attendanciesReport/" + reportDate+"?shift="+shiftV
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$mdDialog.hide(); $mdDialog.hide();
if(response.data.length == 0){ if(response.data.length == 0){
...@@ -91,9 +99,9 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -91,9 +99,9 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.presentArray=[]; $scope.presentArray=[];
$scope.absentArray=[]; $scope.absentArray=[];
angular.forEach(response.data, function(attendance) { angular.forEach(response.data, function(attendance) {
if(attendance.ifPresent =='P'){ if(attendance.present =='P'){
$scope.presentArray.push(attendance); $scope.presentArray.push(attendance);
}else if(attendance.ifPresent =='A'){ }else if(attendance.present =='A'){
$scope.absentArray.push(attendance); $scope.absentArray.push(attendance);
} }
}); });
...@@ -117,6 +125,14 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory ...@@ -117,6 +125,14 @@ myApp.controller("attendanceReportController", function($scope, $http, myFactory
$scope.reportDate = dateValue; $scope.reportDate = dateValue;
}; };
$scope.getSelectedShift = function(){
if ($scope.shiftValue !== undefined) {
return $scope.shiftValue;
} else {
return "Please select a shift";
}
};
$scope.refreshPage = function(){ $scope.refreshPage = function(){
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
$scope.reportDate = today; $scope.reportDate = today;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
<br /> <br />
<div class="text-center"> <div class="text-center">
<div class="row col-lg-12"> <div class="row col-lg-12">
<div class="col-lg-3"></div>
<div class="col-lg-4 col-xs-12"> <div class="col-lg-4 col-xs-12">
<p> <p>
<b>Search Date:</b> <b>Search Date:</b>
...@@ -24,13 +23,23 @@ ...@@ -24,13 +23,23 @@
onkeydown="return false" ng-change="setSearchDate(reportDate)"></md-datepicker> onkeydown="return false" ng-change="setSearchDate(reportDate)"></md-datepicker>
</p> </p>
</div> </div>
<div class="col-lg-2 col-xs-12">
<p style="margin-top: 15px;"><b>Select Shift:</b></p>
</div>
<div class="col-lg-4 col-xs-12">
<md-select ng-model="shiftValue" md-selected-text="getSelectedShift()" id="shiftValue" style="margin:0px;">
<md-optgroup label="shifts">
<md-option ng-value="shiftValue" ng-repeat="shiftValue in shifts">{{shiftValue}}</md-option>
</md-optgroup>
</md-select>
</div>
<div class="col-lg-2 col-xs-12" style="cursor: pointer;" align="right"> <div class="col-lg-2 col-xs-12" style="cursor: pointer;" align="right">
<md-button class="md-raised md-primary" <md-button class="md-raised md-primary"
style="width:100px;background: cadetblue;" ng-click="getEmployeePresent('onclick')"> style="width:100px;background: cadetblue;" ng-click="getEmployeePresent('onclick')">
<i class="fa fa-search fa-2x" <i class="fa fa-search fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Search</md-button> style="margin-top: 5px; font-size: 1.5em; float: left"></i> Search</md-button>
</div> </div>
<div class="col-lg-3"></div>
</div> </div>
<div class="row col-lg-12" style="height: 15px;"></div> <div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12"> <div class="row col-lg-12">
...@@ -66,3 +75,4 @@ ...@@ -66,3 +75,4 @@
data available</div> data available</div>
</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