Commit d8962e07 authored by Muneer Alam's avatar Muneer Alam

Time picker implementation changes

parent bca82fc0
...@@ -74,12 +74,14 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial ...@@ -74,12 +74,14 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
} }
var parentData = { var parentData = {
"empId": "", "empId" : "",
"fromDate": getFormattedDate($scope.fromDate), "fromDate" : getFormattedDate($scope.fromDate),
"toDate": getFormattedDate($scope.toDate), "toDate" : getFormattedDate($scope.toDate),
"toEmail": [], "fromTime" : $scope.fromTime,
"ccEmail": [], "toTime" : $scope.toTime,
"bccEmail": [] "toEmail" : [],
"ccEmail" : [],
"bccEmail" : []
}; };
$scope.validateEmpId = function(){ $scope.validateEmpId = function(){
...@@ -102,6 +104,13 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial ...@@ -102,6 +104,13 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
function checkEmpIdRange(searchId){ function checkEmpIdRange(searchId){
return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId; return parseInt(searchId) >= appConfig.empStartId && parseInt(searchId) <= appConfig.empEndId;
} }
$scope.showOrHide = function() {
if (!$scope.isOverride) {
$scope.fromTime = "";
$scope.toTime = "";
}
}
$scope.generateReport = function(){ $scope.generateReport = function(){
debugger; debugger;
...@@ -111,14 +120,33 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial ...@@ -111,14 +120,33 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
parentData.empId = $scope.searchId; parentData.empId = $scope.searchId;
parentData.fromDate = getFormattedDate($scope.fromDate); parentData.fromDate = getFormattedDate($scope.fromDate);
parentData.toDate = getFormattedDate($scope.toDate); parentData.toDate = getFormattedDate($scope.toDate);
parentData.fromTime= $scope.fromTime; parentData.fromTime = changeTime($scope.fromTime);
parentData.toTime= $scope.toTime; parentData.toTime = changeTime($scope.toTime);
parentData.isOverride= $scope.isOverride; parentData.isOverride= $scope.isOverride;
generatePdfReport(parentData); generatePdfReport(parentData);
showProgressDialog(); showProgressDialog();
$timeout(function(){previewPdfReport();},6000); $timeout(function(){previewPdfReport();},6000);
}; };
function changeTime(time) {
var today = new Date(time);
var hours = today.getHours();
var minutes = Math.round(today.getMinutes());
var ampm = hours >= 12 ? 'PM' : 'AM';
var time = hours + ':' + minutes;
return changeTimeFormat(time, ampm) + ' ' + ampm;
}
function changeTimeFormat(time, ampm) {
function appendZero(n) {
return (n < 10 ? '0' : '') + n;
}
var bits = time.split(':');
if (ampm == 'PM') {
bits[0] = bits[0] - 12;
}
return appendZero(bits[0]) + ':' + appendZero(bits[1]);
}
function deletePreviousReport(){ function deletePreviousReport(){
var empId = ""; var empId = "";
if(parentData.empId != ""){ if(parentData.empId != ""){
...@@ -189,7 +217,6 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial ...@@ -189,7 +217,6 @@ myApp.controller("reportsController", function($scope, $http, myFactory, $mdDial
}); });
} }
function getFormattedDate(date){ function getFormattedDate(date){
var day = date.getDate(); var day = date.getDate();
var month = date.getMonth() + 1; var month = date.getMonth() + 1;
......
...@@ -55,19 +55,17 @@ ...@@ -55,19 +55,17 @@
<div class="form-group col-lg-4"> <div class="form-group col-lg-4">
<label>Override Timings</label> <label>Override Timings</label>
<input type="checkbox" ng-value="isOverride" ng-model="isOverride"/> <input type="checkbox" ng-value="isOverride" ng-model="isOverride" ng-change="showOrHide()"/>
{{isOverride}}
</div> </div>
<div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12" > <div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12" ng-show="isOverride">
<label for=""> FromTime:<input type="time" ng-model="fromTime" id="Hours" <label for="fromTime"> FromTime:<input type="time" ng-model="fromTime" id="Hours"
placeholder="Enter Hours" class="form-control" placeholder="HH:mm aa" class="form-control"/>
/></label> </label>
</div> </div>
<div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12" > <div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12" ng-show="isOverride">
<label for="">ToTime:<input type="time" ng-model="toTime" id="Hours" <label for="toTime">ToTime:<input type="time" ng-model="toTime" id="Hours"
placeholder="Enter Hours" class="form-control" placeholder="HH:mm aa" class="form-control"/>
/></label> </label>
</div> </div>
</div> </div>
......
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