Commit 2150ab95 authored by Prayas Jain's avatar Prayas Jain

Added allocation change screen and updated reserved report screen

parent a803632a
myApp.controller("allocationChangeReportController",function($scope,exportUiGridService, myFactory, $mdDialog, $http, appConfig, $timeout, $element, $window){
$scope.records = [];
var today = new Date();
var priorDt = new Date(today.getTime() - ( 30 * 24 * 60 * 60 * 1000));
$scope.maxDate = today;
$scope.toDate = today;
$scope.fromDate = priorDt;
......@@ -87,12 +91,56 @@ myApp.controller("allocationChangeReportController",function($scope,exportUiGrid
$scope.gridOptions.data = [];
});
}*/
$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);
}
});
......@@ -9,14 +9,14 @@ myApp.controller("reservedReportsController",function($scope,exportUiGridService
columnDefs : [
{field : 'employeeId',displayName: 'Employee Id', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'employeeName',displayName: 'Employee Name', enableColumnMenu: false, enableSorting: true,enableFiltering: true,cellClass:function(grid,row,col){
if(daysBetween(row.entity.reservedStartDate,row.entity.reservedEndDate) > '14') {
if(daysBetween(row.entity.billingStartDate,row.entity.billingEndDate) > '14') {
return 'red';
}
}},
{name : 'accountName', displayName: 'Client', enableColumnMenu: false, enableSorting: false, enableFiltering:false},
{field : 'projectName',displayName: 'Project Name', enableColumnMenu: false, enableSorting: true,enableFiltering: true},
{name : 'reservedStartDate', displayName: 'Reserved Start Date', enableColumnMenu: false,cellFilter: 'date:"dd-MMM-yyyy"', enableSorting: false, enableFiltering:false},
{name : 'reservedEndDate', displayName: 'Reserved End Date', enableColumnMenu: false,cellFilter: 'date:"dd-MMM-yyyy"', enableSorting: false, enableFiltering:false}
{name : 'billingStartDate', displayName: 'Reserved Start Date', enableColumnMenu: false,cellFilter: 'date:"dd-MMM-yyyy"', enableSorting: false, enableFiltering:false},
{name : 'billingEndDate', displayName: 'Reserved End Date', enableColumnMenu: false,cellFilter: 'date:"dd-MMM-yyyy"', enableSorting: false, enableFiltering:false}
],
enableGridMenu: true,
enableSelectAll: true,
......@@ -59,15 +59,14 @@ myApp.controller("reservedReportsController",function($scope,exportUiGridService
}
]
};
$scope.gridOptions.data = [{employeeId:"16727",employeeName : "Prayas" , accountName : 'Nisum India' ,projectName : 'Bench',reservedStartDate:1559563534000 ,reservedEndDate:1559996723000},{employeeId:"16728",employeeName : "Abhijeet" , accountName : 'Macys' ,projectName : 'MyProject',reservedStartDate:1559563534000 ,reservedEndDate:1560860723000}];
/* $scope.getReservedEnployeesData = function(){
$scope.getReservedEnployeesData = function(){
$http({
method : "GET",
url : appConfig.appUri + "employeeEfforts/getWeeklyReport?fromDate=" + fromDate + "&toDate=" +toDate
url : appConfig.appUri + 'resources/reports?resourceStatus=Reserved'
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
if(response.data.length > 10){
$scope.gridOptions.data = response.data.records;
if(response.data.records.length > 10){
$scope.gridOptions.enablePaginationControls = true;
}
else{
......@@ -77,7 +76,7 @@ myApp.controller("reservedReportsController",function($scope,exportUiGridService
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}*/
}
function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent(
angular.element(document.querySelector('#popupContainer')))
......
......@@ -13,6 +13,27 @@
</div>
</div>
<div class="form-horizontal">
<div class="form-group">
<div class="form-inline">
<div class="col-lg-4 col-md-4">
<label class="" for="toDate">From Date: <md-datepicker ng-model="fromDate" md-placeholder="Enter date"
md-max-date="maxDate" onkeydown="return false"
ng-change="validateDates(fromDate, 'FromDate')"></md-datepicker></label>
</div>
<div class="col-lg-4 col-md-4">
<label class="" for="toDate">To Date: <md-datepicker ng-model="toDate" md-placeholder="Enter date"
md-max-date="maxDate" onkeydown="return false"
ng-change="validateDates(toDate, 'ToDate')"></md-datepicker></label>
</div>
<div class="col-lg-2 col-md-2">
<label class="" for="submitBtn"><md-button
class="md-raised md-primary"
ng-click="getAllocationChangeData('click');"> <i
class="fa fa-search fa-1x"></i>
Search</md-button></label>
</div>
</div>
</div>
<div class="form-group">
<div class="form-inline col-lg-12">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-exporter
......
......@@ -10,31 +10,6 @@
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="row col-lg-12">
<div class="col-lg-4" style="float: left;padding-left:20px;">
<!-- <md-button class="md-raised md-primary"
style="width:182px;background: cadetblue;"
ng-click="getUnAssignedEmployees('UnAssigned', parentData)"> <i
class="fa fa-crosshairs fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i>Bench Employees</md-button> -->
</div>
<div class="col-lg-4" style="float: left;padding-left:20px;">
<!-- <md-button class="md-raised md-primary"
style="width:182px;background: cadetblue;"
ng-click="getAllocatedEmployees('allocated', parentData)"> <i
class="fa fa-product-hunt fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i>Project Allocations</md-button> -->
</div>
<div class="col-lg-1"
style="cursor: pointer; float: right; right: 75px;">
<!-- <md-button class="md-raised md-primary"
style="width:142px;background: cadetblue;"
ng-click="addProject('Assign', parentData)"> <i
class="fa fa-plus-circle fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left"></i> Add
Project</md-button> -->
</div>
</div>
<div class="row">
<div class="col-lg-12">
......
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