Commit 75ca5ce0 authored by Prayas Jain's avatar Prayas Jain

Addded validation in Billing start date and end date

parent dc7b673f
......@@ -226,14 +226,14 @@ public class ResourceService implements IResourceService {
Project project = projectService.getProjectByProjectId(resource.getProjectId());
log.info("Project::" + project);
if (!resource.getBillingStartDate().after(project.getProjectStartDate())) {
if (!(resource.getBillingStartDate().compareTo(project.getProjectStartDate())>=0)) {
log.info("Billing start date should be after Project start date");
respMap.put("statusCode", 811);
respMap.put("message", "Billing start date should be after Project start date");
isValid = false;
}
if (!resource.getBillingStartDate().before(resource.getBillingEndDate())) {
if (!(resource.getBillingStartDate().compareTo(resource.getBillingEndDate())<=0)) {
log.info("Billing start date should be before Billing End Date.");
respMap.put("statusCode", 812);
respMap.put("message", "Billing start date should be before Billing End Date.");
......
......@@ -661,9 +661,9 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
'Trainee' ]
},
{ name: 'billingStartDate',width:"*", displayName: 'Start Date', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false,width:160,
cellTemplate: '<div class="ui-grid-cell-contents" ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" md-placeholder="Select Date" id="newBillingStartDate" name="newBillingStartDate" md-min-date="grid.appScope.minBillingDate" md-max-date="grid.appScope.maxBillingDate"></md-datepicker></div>'},
cellTemplate: '<div class="ui-grid-cell-contents" ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" md-placeholder="Select Date" id="newBillingStartDate" name="newBillingStartDate" md-min-date="grid.appScope.minBillingStartDate" md-max-date="grid.appScope.maxBillingStartDate"></md-datepicker></div>'},
{ field: 'billingEndDate',width:"*", displayName: 'End Date', enableColumnMenu: false, enableSorting: false , cellFilter:'date:"dd-MMM-yyyy"',enableFiltering:false,width:160,
cellTemplate: '<div class="ui-grid-cell-contents" ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" md-placeholder="Select Date" id="endDate" name="endDate" md-min-date="row.entity.billingStartDate" md-max-date="grid.appScope.maxBillingDate"></md-datepicker></div>'},
cellTemplate: '<div class="ui-grid-cell-contents" ng-if="!row.entity.editrow">{{COL_FIELD | date:"dd-MMM-yyyy"}}</div><div ng-if="row.entity.editrow"><md-datepicker ng-model="MODEL_COL_FIELD" md-placeholder="Select Date" id="endDate" name="endDate" md-min-date="row.entity.billingStartDate" md-max-date="grid.appScope.maxBillingEndDate"></md-datepicker></div>'},
{name : 'Actions',width:140, displayName: 'Actions',cellTemplate: getCellTemplate1, enableColumnMenu: false, enableSorting: false,enableFiltering: false}
]
};
......@@ -747,6 +747,9 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
$scope.edit = function (rowd) {
$scope.minBillingStartDate = new Date($scope.projectStartDate);
$scope.maxBillingStartDate = new Date($scope.projectEndDate);
$scope.maxBillingEndDate = new Date($scope.projectEndDate);
var row = rowd.entity;
var index = $scope.gridOptions.data.indexOf(row);
if($scope.previousRow){
......@@ -1219,12 +1222,19 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
$scope.changeBillableStatusList = function() {
if($scope.empAllocationStatus == 'Proposed') {
$scope.empBillableStatus = 'Reserved' ;
$scope.billableStatuses = ["Reserved"];
}
$scope.minBillingStartDate = new Date();
$scope.maxBillingStartDate = new Date($scope.projectEndDate);
$scope.maxBillingEndDate = new Date($scope.projectEndDate)
}
else if ($scope.empAllocationStatus == 'Engaged'){
$scope.empBillableStatus = null ; //$scope.billableStatuses ;
$scope.billableStatuses = ["Billable", "Shadow", "Non-Billable", "Trainee"];
$scope.minBillingStartDate = new Date($scope.projectStartDate);
$scope.maxBillingStartDate =new Date();
$scope.maxBillingEndDate = new Date($scope.projectEndDate);
}
}
/* $scope.getEditTeammate = function(selectedStatus) {
......@@ -2001,7 +2011,6 @@ myApp.controller("projectController", function ($scope,uiGridConstants, myFactor
}
return false;
}
$scope.minBillingDate = new Date($scope.projectStartDate);
$scope.maxBillingDate = new Date($scope.projectEndDate);
}
});
......@@ -163,8 +163,8 @@
<tr ng-show="empBillableStatus">
<td class="Employee">{{empBillableStatus}} Start Date </td>
<td>
<md-datepicker ng-model="newBillingStartDate" md-placeholder="Please select Date " id="newBillingStartDate " md-min-date="minBillingDate"
md-max-date="maxBillingDate" onkeydown="return false " ng-change="currentBillabilityDateChange()" name="newBillingStartDate"></md-datepicker>
<md-datepicker ng-model="newBillingStartDate" md-placeholder="Please select Date " id="newBillingStartDate " md-min-date="minBillingStartDate"
md-max-date="maxBillingStartDate" onkeydown="return false " ng-change="currentBillabilityDateChange()" name="newBillingStartDate"></md-datepicker>
</td>
</tr>
<!-- <tr>
......@@ -178,7 +178,7 @@
<tr ng-show="empBillableStatus">
<td class="Employee">{{empBillableStatus}} End Date</td>
<td>
<md-datepicker ng-model="endDate" md-placeholder="Please select Date" id="endDate " md-min-date="newBillingStartDate " md-max-date="maxBillingDate"
<md-datepicker ng-model="endDate" md-placeholder="Please select Date" id="endDate " md-min-date="newBillingStartDate " md-max-date="maxBillingEndDate"
onkeydown="return false " name="endDate"></md-datepicker>
</td>
</tr>
......
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