Commit 9aea9226345f5cbbb4c4b867739392b584f3ba4b

Authored by Kuldeep Arora
1 parent c77753c21b
Exists in master

Added local and UTC Timezone clock

... ... @@ -249,5 +249,10 @@
249 249 <script src="https://code.highcharts.com/maps/js/modules/exporting.js"></script>
250 250 <script src="https://code.highcharts.com/mapdata/countries/us/us-all.js"></script>
251 251  
  252 + <!--for local time and UTC time-->
  253 + <script src="bower_components/angular-ui-clock/dist/angular-clock.js"></script>
  254 + <link rel="stylesheet" href="bower_components/angular-ui-clock/dist/angular-clock.css">
  255 + <link href="//fonts.googleapis.com/css?family=Syncopate:400,700" rel="stylesheet" type="text/css">
  256 +
252 257 </body>
253 258 </html>
254 259 \ No newline at end of file
... ...
1 1 'use strict';
2 2  
3 3  
4   - angular.module('acufuel', ['nvd3', 'ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ngAnimate', 'ui.bootstrap', 'xeditable', 'ui.toggle', 'ngTable', 'ui.select2', 'ckeditor', 'ui.calendar', 'ngDragDrop', 'ui.select'])
  4 + angular.module('acufuel', ['nvd3', 'ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ngAnimate', 'ui.bootstrap', 'xeditable', 'ui.toggle', 'ngTable', 'ui.select2', 'ckeditor', 'ui.calendar', 'ngDragDrop', 'ui.select','ds.clock'])
5 5  
6 6 .config(['$httpProvider', function($httpProvider) {
7 7 $httpProvider.defaults.withCredentials = true;
... ... @@ -9,7 +9,7 @@
9 9 $httpProvider.interceptors.push('httpRequestInterceptor');
10 10 }])
11 11  
12   -
  12 +
13 13 .factory('httpRequestInterceptor', ['$q', '$rootScope', '$location', function($q, $rootScope, $location) {
14 14 return {
15 15 request: function($config) {
... ...
app/partials/accountSetting/accountSetting.Controller.js
... ... @@ -16,15 +16,31 @@
16 16 }
17 17  
18 18 $scope.userid = JSON.parse(localStorage.getItem('userProfileId'));
19   - if($scope.userid && $scope.userid != null && $scope.userid != undefined){
20   - var id = $scope.userid;
21   - AccountSettingService.loginUserData(id).then(function(result) {
22   - $scope.userData = result;
23   - $scope.userData.status = $scope.userData.account.user.status.toLowerCase();
24   - $scope.userData.userType = $scope.userData.userType.type.toLowerCase();
25   - })
  19 +
  20 + //call this function after upload data
  21 + function getLoginUserData(){
  22 +
  23 + if($scope.userid && $scope.userid != null && $scope.userid != undefined){
  24 + var id = $scope.userid;
  25 + AccountSettingService.loginUserData(id).then(function(result) {
  26 + if(result.userTimeZone.slice(0,1)==="P"){
  27 +
  28 + result.userTimeZone = result.userTimeZone.replace("P","+");
  29 +
  30 + }else if(result.userTimeZone.slice(0,1)==="M"){
  31 +
  32 + result.userTimeZone = result.userTimeZone.replace("M","-");
  33 + }
  34 + $scope.userData = result;
  35 + $scope.userData.status = $scope.userData.account.user.status.toLowerCase();
  36 + $scope.userData.userType = $scope.userData.userType.type.toLowerCase();
  37 + })
  38 + }
26 39 }
27 40  
  41 + getLoginUserData();
  42 +
  43 +
28 44 AccountSettingService.getProducts().then(function(result) {
29 45 $scope.productList = result;
30 46 for(var i=0;i<$scope.productList.length;i++){
... ... @@ -45,17 +61,29 @@
45 61 $scope.addArray[index].name = productlist[index].name;
46 62 $scope.addArray[index].status = productlist[index].status;
47 63 $scope.productData.productList = $scope.addArray;
48   - console.log($scope.productData)
  64 + // console.log($scope.productData)
49 65 }
50 66  
51 67 $scope.updateUser = function(){
52 68  
  69 + window.localStorage.setItem('userTimeZone',JSON.stringify($scope.userData.userTimeZone));
  70 + //Database not save the = and - sign of timezone offset
  71 + if($scope.userData.userTimeZone.slice(0,1)==="+"){
  72 +
  73 + $scope.userData.userTimeZone = $scope.userData.userTimeZone.replace("+","P");
  74 +
  75 + }else if($scope.userData.userTimeZone.slice(0,1)==="-"){
  76 +
  77 + $scope.userData.userTimeZone = $scope.userData.userTimeZone.replace("-","M");
  78 + }
  79 +
53 80 var updateData = "companyName=" + $scope.userData.companyName + "&username=" + $scope.userData.username + "&firstName=" + $scope.userData.firstName
54 81 + "&lastName=" + $scope.userData.lastName + "&phone=" + $scope.userData.phone + "&mobile=" + $scope.userData.mobile
55   - + "&status=" + $scope.userData.status + "&userType=" + $scope.userData.userType + "&userTypeId=" + $scope.userData.userType.id + "&userProfileId=" + $scope.userid;
  82 + + "&status=" + $scope.userData.status + "&userType=" + $scope.userData.userType + "&userTypeId=" + $scope.userData.userType.id + "&userProfileId=" + $scope.userid + "&userTimeZone=" + $scope.userData.userTimeZone;
56 83  
  84 + // console.log("======updateData===",updateData)
57 85 AccountSettingService.updateUserProfile(updateData).then(function(result) {
58   -
  86 +
59 87 AccountSettingService.updateProducts($scope.productData).then(function(result) {
60 88 toastr.success(''+result.success+'', {
61 89 closeButton: true
... ... @@ -63,8 +91,12 @@
63 91 window.localStorage.setItem('currentUserName', JSON.stringify($scope.userData.firstName +' '+ $scope.userData.lastName));
64 92 window.localStorage.setItem('companyName', JSON.stringify($scope.userData.companyName));
65 93 $scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName'));
66   - $scope.companyName= JSON.parse(localStorage.getItem('companyName'))
  94 + $scope.companyName= JSON.parse(localStorage.getItem('companyName'));
  95 + $scope.userTimeZone = JSON.parse(localStorage.getItem('userTimeZone'));
  96 + //console.log("====value after update===",$scope.userTimeZone )
  97 + window.localStorage.removeItem('userTime');
67 98 $scope.testFunction();
  99 + getLoginUserData();
68 100 })
69 101  
70 102 })
... ... @@ -84,7 +116,7 @@
84 116 }
85 117  
86 118 $scope.checkEmail = function(email, type) {
87   - console.log(type)
  119 + //console.log(type)
88 120 AccountSettingService.checkEmail(email).then(function(result) {
89 121 if(result.status == 'ACTIVE'){
90 122 toastr.error('Email already exists.', {
... ... @@ -106,8 +138,7 @@
106 138 })
107 139 }else{
108 140 if (validateEmail($scope.accountdata.userName)) {
109   - console.log("checkbox",$scope.accountdata.allowEpd ,$scope.accountdata.allowFma
110   -)
  141 + //console.log("checkbox",$scope.accountdata.allowEpd ,$scope.accountdata.allowFma)
111 142 AccountSettingService.addAdditionalAccount($scope.accountdata).then(function(result) {
112 143 getAdditionalAccounts();
113 144 $scope.accountdata = {};
... ... @@ -163,13 +194,14 @@
163 194 }
164 195 })
165 196 }
  197 +
166 198  
167 199 $scope.cancelDelete = function(){
168 200 $('#delete1').css('display', 'none');
169 201 }
170 202  
171 203 $scope.resetPassword = function(email) {
172   - console.log("emailid",email)
  204 + //console.log("emailid",email)
173 205 AccountSettingService.resetPassword(email).then(function(result){
174 206 if(typeof result == 'object') {
175 207 toastr.info("Password generated successfully. Please check your email for new password");
... ... @@ -181,7 +213,46 @@
181 213 })
182 214 }
183 215  
  216 +
  217 + $scope.timeZoneList = [{name:'(GMT-12:00) International Date Line West',value:'-12.00'},
  218 + {name:'(GMT-11:00) Midway Island, Samoa',value:'-11.00'},
  219 + {name:'(GMT-10:00) Hawaii',value :'-10.00'},
  220 + {name:'(GMT-09:30) Pacific/Marquesas (French Polynesia)',value :'-09.30'},
  221 + {name:'(GMT-09:00) Pacific/Gambier(French Polynesia)(US)',value :'-09.00'},
  222 + {name:'(GMT-08:00) Alaska',value :'-08.00'},
  223 + {name:'(GMT-07:00) Arizona,(US and Canada)',value :'-07.00'},
  224 + {name:'(GMT-06:00) (Central America),Chihuahua,Saskatchewan,Ecuador',value :'-06.00'},
  225 + {name:'(GMT-05:00) Central Time (US and Canada) Bogota, Mexico City,Lima,Brazil, Quito',value :'-05.00'},
  226 + {name:'(GMT-04:00) Eastern Time (US and Canada),Caracas, La Paz,Indiana (East)',value :'-04.00'},
  227 + {name:'(GMT-03:00) Atlantic Time (Canada),Santiago,Brasilia,Buenos Aires',value :'-03.00'},
  228 + {name:'(GMT-02:30) Newfoundland and Labrador,(Canada)',value :'-02.30'},
  229 + {name:'(GMT-02:00) Mid-Atlantic,Greenland',value :'-02.00'},
  230 + {name:'(GMT-01:00) Cape Verde Islands',value :'-01.00'},
  231 + {name:'(GMT) Azores,Dublin, Edinburgh, Lisbon, London',value :'00.00'},
  232 + {name:'(GMT+01:00) West Central Africa,Canary Islands,Casablanca, Monrovia',value :'+01.00'},
  233 + {name:'(GMT+02:00) Brussels,Amsterdam,Harare,Madrid,Paris,Cairo,Belgrade',value :'+02.00'},
  234 + {name:'(GMT+03:00) Moscow,Jerusalem,St.Petersburg, Athens,Baghdad,Kuwait,Helsinki,Nairobi',value :'+03.00'},
  235 + {name:'(GMT+04:00) Armenia,Azerbaijan,UAE,(Russia)',value :'+04.00'},
  236 + {name:'(GMT+04:30) Kabul,(Afghanistan)',value :'+04.30'},
  237 + {name:'(GMT+05:00) Islamabad, Karachi, Tashkent (Pakistan)',value :'+05.00'},
  238 + {name:'(GMT+05:30) Chennai,New Delhi(India),(Sri Lanka)',value :'+05.30'},
  239 + {name:'(GMT+05:45) Kathmandu (Nepal)',value :'+05.45'},
  240 + {name:'(GMT+06:00) Astana,Kazakhstan,Dhaka(Bangladesh),(Bhutan),(Russia)',value :'+06.00'},
  241 + {name:'(GMT+06:30) Yangon Rangoon (Myanmar)',value :'+06.30'},
  242 + {name:'(GMT+07:00) Laos,Krasnoyarsk,Hanoi,Bangkok(Thailand),Jakarta(Indonesia)',value :'+07.00'},
  243 + {name:'(GMT+08:00) Perth(Western Australia),Beijing(China),Kuala Lumpur(Singapore),(Malaysia)',value :'+08.00'},
  244 + {name:'(GMT+08:45) Australia/Eucla',value :'+08.45'},
  245 + {name:'(GMT+09:00) Japan/North Korea/South Korea/East Timor',value :'+09.00'},
  246 + {name:'(GMT+09:30) Adelaide/Darwin(Australia)',value :'+09.30' },
  247 + {name:'(GMT+10:00) Guam, Port Moresby,Hobart,Vladivostok,Brisbane,Melbourne(Australia),Papua New Guinea',value :'+10.00'},
  248 + {name:'(GMT+10:30) Australia/Lord_Howe',value :'+10.30'},
  249 + {name:'(GMT+11:00) Magadan, Solomon Islands, New Caledonia',value :'+11.00'},
  250 + {name:'(GMT+12:00) Auckland, Wellington,Fiji Islands, Kamchatka, Marshall Islands',value :'+12.00'},
  251 + {name:'(GMT+12:45) Pacific/Chatham, New Zealand',value :'+12.45'},
  252 + {name:'(GMT+13:00) Nuku alofa,Samoa,Tonga',value :'+13.00'},
  253 + {name:'(GMT+14:00) Pacific/Kiritimati',value :'+14.00'}]
184 254  
  255 +
185 256 }
186 257 })();
187 258  
... ...
app/partials/accountSetting/accountSetting.html
... ... @@ -27,16 +27,27 @@
27 27 <div class="col-xs-12">
28 28 <div class="form-group">
29 29 <div class="row">
30   - <div class="col-md-5">
31   - <label class="new-input-label"><b>Fuel Types Offered&nbsp;</b></label>
  30 + <div class="col-md-6">
  31 + <label class="new-input-label"><b>FBO Time Zone&nbsp;</b></label>
  32 +
  33 + <!-- <ds-widget-clock gmt-offset="gmtValue" data-show-digital digital-format="'HH:mm:ss'" show-gmt-info style="width: 200px"></ds-widget-clock> -->
  34 + <select class="form-control" ng-model="userData.userTimeZone" style="width:180px">
  35 + <option value="" selected disabled>Select Timezone</option>
  36 + <option ng-repeat="tz in timeZoneList" value="{{tz.value}}">{{tz.name}}
  37 + </option>
  38 + </select>
32 39 </div>
33   - <div class="col-md-7" >
34   - <label ng-repeat="product in productList" style="width: 100%; font-weight: normal;">
  40 + <div class="col-sm-6">
  41 + <label class="new-input-label"><b>Fuel Types Offered&nbsp;</b></label>
  42 + <!-- </div>
  43 + <div class="col-md-6" > -->
  44 + <label ng-repeat="product in productList" style="width: 100%; font-weight: normal;">
35 45 <!-- <input type="checkbox" ng-model="product.status" ng-click="checkProduct(product)"> {{product.name}}<br> -->
36 46 <input type="checkbox" id="Weekdays" ng-model="product.status" ng-click="checkProduct(productList, product, $index)">{{product.name}}
37 47 </label>
  48 +
38 49 </div>
39   - </div>
  50 + </div>
40 51 </div>
41 52 </div>
42 53 </div>
... ... @@ -261,4 +272,5 @@
261 272 </div>
262 273 </div>
263 274  
264   -
265 275 \ No newline at end of file
  276 +
  277 +
266 278 \ No newline at end of file
... ...
app/partials/login/login.controller.js
... ... @@ -34,12 +34,14 @@
34 34 $state.go('resetPassword');
35 35 } else {
36 36 LoginService.authenticate().then(function(result){
  37 + window.localStorage.setItem("userTime", JSON.stringify(result.userProfile.userTimeZone));
  38 +
37 39 var currentUserDetail = JSON.parse(window.localStorage.getItem("currentUser"));
38 40 if(currentUserDetail.type === 'ADDITIONAL'){
39 41 var email = $scope.data.username;
40 42 //console.log("hi",email)
41 43 LoginService.getAdditionalAccess(email).then(function(result){
42   - console.log("getaccess",result)
  44 + // console.log("getaccess",result)
43 45 window.localStorage.setItem("EPDAccess", JSON.stringify(result.allowEpd));
44 46 window.localStorage.setItem("FMAAccess", JSON.stringify(result.allowFma));
45 47 })
... ...
app/partials/main/main.controller.js
... ... @@ -5,18 +5,41 @@
5 5 .controller('MainController', [ '$scope', '$filter','$rootScope','$state', '$window', '$interval', MainController]);
6 6  
7 7 function MainController($scope, $filter, $rootScope,$state, $window, $interval) {
8   -
  8 +
9 9 $scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName'));
10 10 $scope.companyName = JSON.parse(localStorage.getItem('companyName'));
11 11 var User = JSON.parse(localStorage.getItem('currentUser'));
  12 +
  13 + //for login userTime from GetAPI timezone
  14 + var tempuserTime = JSON.parse(localStorage.getItem('userTime'));
  15 +
  16 + if (tempuserTime != null) {
  17 + if (tempuserTime.slice(0, 1) === "P") {
  18 + $scope.userTimeZone = tempuserTime.replace("P", "+");
  19 + console.log("==p===",$scope.userTimeZone)
  20 + } else if (tempuserTime.slice(0, 1) === "M") {
  21 + $scope.userTimeZone = tempuserTime.replace("M", "-");
  22 + console.log("==M===",$scope.userTimeZone)
  23 + }
  24 +
  25 + } else {
  26 +
  27 + $scope.userTimeZone = JSON.parse(localStorage.getItem('userTimeZone'));
  28 + console.log("===$scope.userTimeZone==",$scope.userTimeZone)
  29 + }
  30 +
12 31  
13 32 if(User.type === 'ADDITIONAL'){
14 33 $scope.companyName = $scope.currentUserName;
15 34 }
16 35  
  36 +
17 37 $scope.testFunction = function(){
18 38 $scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName'));
19 39 $scope.companyName = JSON.parse(localStorage.getItem('companyName'));
  40 + $scope.userTimeZone = JSON.parse(localStorage.getItem('userTimeZone'));
  41 + console.log("===$scope.userTimeZone test==",$scope.userTimeZone)
  42 +
20 43 }
21 44  
22 45 $scope.logout = function(){
... ...
app/partials/main/main.html
1 1  
  2 +<style>
  3 + .hours{
  4 + color: #ca5c6a;
  5 + font-size: 15px;
  6 + font-weight: bold;
  7 + }
  8 +</style>
2 9 <nav class="navbar navbar-inverse" role="navigation">
3 10 <div class="container">
4 11 <!-- Brand and toggle get grouped for better mobile display -->
... ... @@ -118,7 +125,18 @@
118 125 <span>Flight Tracking</span>
119 126 </a>
120 127 </li>
121   -
  128 + <li>
  129 + <div style="text-align: center;padding-top: 15px;" >
  130 + <label style="font-weight: bold;font-size: 15px;color: #ca5c6a;">Time(Local)</label>
  131 + <ds-widget-clock gmt-offset="userTimeZone" data-show-digital digital-format="'HH:mm:ss'" style="width: 15px"></ds-widget-clock>
  132 + </div>
  133 + </li>
  134 + <li>
  135 + <div style="text-align: center;padding-top: 15px;" >
  136 + <label style="font-weight: bold;font-size: 15px;color: #ca5c6a;">Time(UTC)</label>
  137 + <ds-widget-clock gmt-offset="0" data-show-digital digital-format="'HH:mm:ss'" style="width: 15px"></ds-widget-clock>
  138 + </div>
  139 + </li>
122 140 <li ng-if="!isAuthenticated">
123 141 <a ui-sref="app.flightDepDashboard">
124 142 <i class="fa fa-search"></i>
... ...
... ... @@ -40,6 +40,7 @@
40 40 "angular-dragdrop": "^1.0.13",
41 41 "angular-nvd3": "^1.0.9",
42 42 "angular-ui-select": "~0.19.8",
43   - "angular-sanitize": "~1.6.6"
  43 + "angular-sanitize": "~1.6.6",
  44 + "angular-ui-clock": "^0.7.0"
44 45 }
45 46 }
... ...