Commit a49ef536103f08b085b1b43632493c70935163f9

Authored by Kuldeep Arora
1 parent 562610b62d
Exists in master

dashboard & Scheduler live

app/partials/dashboard/dashboard.controller.js
1 1
2 (function() { 2 (function() {
3 'use strict' 3 'use strict'
4 4
5 angular.module('acufuel') 5 angular.module('acufuel')
6 .controller('dashboardController', [ '$scope', '$filter', '$rootScope', '$state', 'dashboardService', dashboardController]); 6 .controller('dashboardController', [ '$scope', '$filter', '$rootScope', '$state', 'dashboardService', dashboardController]);
7 7
8 function dashboardController($scope, $filter, $rootScope, $state, dashboardService) { 8 function dashboardController($scope, $filter, $rootScope, $state, dashboardService) {
9 $scope.getQuote = true; 9 $scope.getQuote = true;
10 $scope.showQuote = false; 10 $scope.showQuote = false;
11 $scope.getQuote = function () { 11 $scope.getQuote = function () {
12 $scope.getQuote = false; 12 $scope.getQuote = false;
13 $scope.showQuote = true; 13 $scope.showQuote = true;
14 } 14 }
15 15
16 $scope.logout = function () { 16 $scope.logout = function () {
17 localStorage.removeItem("loginStatus"); 17 localStorage.removeItem("loginStatus");
18 $rootScope.path = false; 18 $rootScope.path = false;
19 $state.reload(); 19 $state.reload();
20 } 20 }
21 21
22 $scope.marginList = {} 22 $scope.marginList = {};
23 dashboardService.getMargin().then(function(result) { 23 dashboardService.getMargin().then(function(result) {
24 $scope.marginList = result; 24 $scope.marginList = result;
25 console.log("Margin result", result) 25 console.log("Margin result", result)
26 }) 26 })
27 27
28 $scope.newFuelPricing = {}; 28 $scope.newFuelPricing = {};
29 dashboardService.getFuelPricingNew().then(function(result) { 29 dashboardService.getFuelPricingNew().then(function(result) {
30 $scope.newFuelPricing = result; 30 $scope.newFuelPricing = result;
31 console.log("Fuel Pricing result", result) 31 console.log("Fuel Pricing result", result)
32 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 32 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
33 if ($scope.newFuelPricing[i].fuelPricing != null) { 33 if ($scope.newFuelPricing[i].fuelPricing != null) {
34 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 34 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
35 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 35 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
36 var month = newTime.getUTCMonth() + 1; //months from 1-12 36 var month = newTime.getUTCMonth() + 1; //months from 1-12
37 var day = newTime.getUTCDate(); 37 var day = newTime.getUTCDate();
38 var year = newTime.getUTCFullYear(); 38 var year = newTime.getUTCFullYear();
39 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 39 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
40 } 40 }
41 } 41 }
42 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 42 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
43 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 43 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
44 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 44 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
45 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 45 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
46 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 46 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
47 var nextDay = newTime.getUTCDate(); 47 var nextDay = newTime.getUTCDate();
48 var nextYear = newTime.getUTCFullYear(); 48 var nextYear = newTime.getUTCFullYear();
49 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 49 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
50 } 50 }
51 } 51 }
52 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 52 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
53 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 53 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
54 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 54 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
55 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 55 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
56 var dday = newTime.getUTCDate(); 56 var dday = newTime.getUTCDate();
57 var dyear = newTime.getUTCFullYear(); 57 var dyear = newTime.getUTCFullYear();
58 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 58 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
59 } 59 }
60 } 60 }
61 } 61 }
62 var str =""+ $scope.newFuelPricing[i].name 62 var str =""+ $scope.newFuelPricing[i].name
63 if(str.startsWith("J")){ 63 if(str.startsWith("J")){
64 $scope.newFuelPricing[i].jeta = true; 64 $scope.newFuelPricing[i].jeta = true;
65 var str1 = str.substring(0,5) 65 var str1 = str.substring(0,5)
66 var str2 = str.substring(6, str.length) 66 var str2 = str.substring(6, str.length)
67 $scope.newFuelPricing[i].name = str1 67 $scope.newFuelPricing[i].name = str1
68 $scope.newFuelPricing[i].namejetrest = str2 68 $scope.newFuelPricing[i].namejetrest = str2
69 69
70 70
71 }else if(str.startsWith("100")){ 71 }else if(str.startsWith("100")){
72 $scope.newFuelPricing[i].avgas = true; 72 $scope.newFuelPricing[i].avgas = true;
73 var str1 = str.substring(0,5) 73 var str1 = str.substring(0,5)
74 var str2 = str.substring(6, str.length) 74 var str2 = str.substring(6, str.length)
75 $scope.newFuelPricing[i].name = str1 75 $scope.newFuelPricing[i].name = str1
76 $scope.newFuelPricing[i].nameavgasrest = str2 76 $scope.newFuelPricing[i].nameavgasrest = str2
77 } 77 }
78 } 78 }
79 $scope.showLoader = false; 79 $scope.showLoader = false;
80 }) 80 })
81 81
82 82
83 $scope.updateFuelPricing = {}; 83 $scope.updateFuelPricing = {};
84 $scope.updateFuelPricing.fuelPricingList = []; 84 $scope.updateFuelPricing.fuelPricingList = [];
85 $scope.updateFuelPricing.userProfileId = $scope.userProfileId; 85 $scope.updateFuelPricing.userProfileId = $scope.userProfileId;
86 $scope.updateFuelPricingClick = function(){ 86 $scope.updateFuelPricingClick = function(){
87 $scope.showLoader = true; 87 $scope.showLoader = true;
88 88
89 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 89 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
90 if ($scope.newFuelPricing[i].fuelPricing != null) { 90 if ($scope.newFuelPricing[i].fuelPricing != null) {
91 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 91 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
92 if ($scope.newFuelPricing[i].fuelPricing.cost == null) { 92 if ($scope.newFuelPricing[i].fuelPricing.cost == null) {
93 $scope.newFuelPricing[i].fuelPricing.cost = ''; 93 $scope.newFuelPricing[i].fuelPricing.cost = '';
94 } 94 }
95 if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) { 95 if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) {
96 $scope.newFuelPricing[i].fuelPricing.papMargin = ''; 96 $scope.newFuelPricing[i].fuelPricing.papMargin = '';
97 } 97 }
98 if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) { 98 if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) {
99 $scope.newFuelPricing[i].fuelPricing.papTotal = ''; 99 $scope.newFuelPricing[i].fuelPricing.papTotal = '';
100 } 100 }
101 if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) { 101 if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) {
102 $scope.newFuelPricing[i].fuelPricing.expirationDate = ''; 102 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';
103 }else{ 103 }else{
104 $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 104 $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
105 console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate); 105 console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate);
106 $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime(); 106 $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime();
107 } 107 }
108 108
109 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 109 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
110 $scope.updateFuelPricing.fuelPricingList.push({ 110 $scope.updateFuelPricing.fuelPricingList.push({
111 'cost': $scope.newFuelPricing[i].fuelPricing.cost, 111 'cost': $scope.newFuelPricing[i].fuelPricing.cost,
112 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin, 112 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin,
113 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal, 113 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal,
114 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate, 114 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate,
115 'productId': $scope.newFuelPricing[i].id, 115 'productId': $scope.newFuelPricing[i].id,
116 'id': $scope.newFuelPricing[i].fuelPricing.id, 116 'id': $scope.newFuelPricing[i].fuelPricing.id,
117 }) 117 })
118 118
119 }else{ 119 }else{
120 /*$scope.newFuelPricing[i].fuelPricing.cost = ''; 120 /*$scope.newFuelPricing[i].fuelPricing.cost = '';
121 $scope.newFuelPricing[i].fuelPricing.papMargin = ''; 121 $scope.newFuelPricing[i].fuelPricing.papMargin = '';
122 $scope.newFuelPricing[i].fuelPricing.papTotal = ''; 122 $scope.newFuelPricing[i].fuelPricing.papTotal = '';
123 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';*/ 123 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';*/
124 } 124 }
125 125
126 } 126 }
127 127
128 128
129 129
130 130
131 console.log('result',$scope.marginList) 131 console.log('result',$scope.marginList)
132 dashboardService.updateFuelPricing($scope.updateFuelPricing).then(function(result) { 132 dashboardService.updateFuelPricing($scope.updateFuelPricing).then(function(result) {
133 toastr.success('Successfully Updated', { 133 toastr.success('Successfully Updated', {
134 closeButton: true 134 closeButton: true
135 }) 135 })
136 dashboardService.getFuelPricingNew().then(function(result) { 136 dashboardService.getFuelPricingNew().then(function(result) {
137 $scope.newFuelPricing = result; 137 $scope.newFuelPricing = result;
138 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 138 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
139 if ($scope.newFuelPricing[i].fuelPricing != null) { 139 if ($scope.newFuelPricing[i].fuelPricing != null) {
140 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 140 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
141 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 141 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
142 var month = newTime.getUTCMonth() + 1; //months from 1-12 142 var month = newTime.getUTCMonth() + 1; //months from 1-12
143 var day = newTime.getUTCDate(); 143 var day = newTime.getUTCDate();
144 var year = newTime.getUTCFullYear(); 144 var year = newTime.getUTCFullYear();
145 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 145 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
146 } 146 }
147 } 147 }
148 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 148 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
149 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 149 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
150 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 150 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
151 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 151 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
152 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 152 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
153 var nextDay = newTime.getUTCDate(); 153 var nextDay = newTime.getUTCDate();
154 var nextYear = newTime.getUTCFullYear(); 154 var nextYear = newTime.getUTCFullYear();
155 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 155 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
156 } 156 }
157 } 157 }
158 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 158 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
159 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 159 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
160 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 160 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
161 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 161 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
162 var dday = newTime.getUTCDate(); 162 var dday = newTime.getUTCDate();
163 var dyear = newTime.getUTCFullYear(); 163 var dyear = newTime.getUTCFullYear();
164 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 164 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
165 } 165 }
166 } 166 }
167 } 167 }
168 } 168 }
169 $scope.showLoader = false; 169 $scope.showLoader = false;
170 }) 170 })
171 }) 171 })
172 172
173 } 173 }
174 174
175 175
176 176
177 // $scope.submitLogin = function() { 177 // $scope.submitLogin = function() {
178 // LoginService.setAuth(true); 178 // LoginService.setAuth(true);
179 // toastr.info("Login successfully"); 179 // toastr.info("Login successfully");
180 // $state.go('app.dashboard'); 180 // $state.go('app.dashboard');
181 // /*LoginService.login($scope.username, $scope.password).then(function(result){ 181 // /*LoginService.login($scope.username, $scope.password).then(function(result){
182 // if(typeof result == 'object') { 182 // if(typeof result == 'object') {
183 // LoginService.setAuth(true); 183 // LoginService.setAuth(true);
184 // $rootScope.path = true; 184 // $rootScope.path = true;
185 // var reqPwdChng = localStorage.getItem("requiredChangePwd"); 185 // var reqPwdChng = localStorage.getItem("requiredChangePwd");
186 // if (reqPwdChng && reqPwdChng == "Y") { 186 // if (reqPwdChng && reqPwdChng == "Y") {
187 // $state.go('resetPassword'); 187 // $state.go('resetPassword');
188 // } else { 188 // } else {
189 // $state.go('app.upload'); 189 // $state.go('app.upload');
190 // } 190 // }
191 // } else { 191 // } else {
192 // toastr.info("Error in login. Please check login name and password"); 192 // toastr.info("Error in login. Please check login name and password");
193 // } 193 // }
194 // })*/ 194 // })*/
195 // } 195 // }
196
197 $scope.completeOrderCount = '';
198 $scope.pendingOrderCount= '';
199
200 dashboardService.getFuelordercount().then(function(result) {
201 if(result[0].label=='Completed' && result[1].label=='Pending'){
202 $scope.completeOrderCount=result[0].value;
203 $scope.pendingOrderCount=result[1].value;
204 }
205
206 console.log("=========Order counts========", result[0].label);
207 console.log("=========Order counts========", result[0].value);
208 console.log("=========Order counts========", result[1].label);
209 console.log("=========Order counts========", result[1].value);
210 })
211
212
213 $scope.pendingMessageRecord=[];
214 dashboardService.getPendingMessage().then(function(result) {
215 $scope.pendingMessageRecord=result;
216
217 console.log('=======message====',result);
218 })
219
220
221
222
223
224
225
226
196 } 227 }
197 })(); 228 })();
198 229
app/partials/dashboard/dashboard.html
1 <style> 1 <style>
2 .subnavbar .mainnav > li:first-child > a{ 2 .subnavbar .mainnav > li:first-child > a{
3 color: #ff9900; 3 color: #ff9900;
4 } 4 }
5 </style> 5 </style>
6 6 <!-- <style>
7 table, th , td {
8 border: 1px solid grey;
9 border-collapse: collapse;
10 padding: 5px;
11 }
12 table tr:nth-child(odd) {
13 background-color: #f1f1f1;
14 }
15 table tr:nth-child(even) {
16 background-color: #ffffff;
17 }
18 </style> -->
7 19
8 <div class="main"> 20 <div class="main">
9 <div class="container" ng-if="isAuthenticated"> 21 <div class="container" ng-if="isAuthenticated">
10 <div class="row"> 22 <div class="row">
11 <div class="col-md-7"> 23 <div class="col-md-7">
12 <div class="widget stacked"> 24 <div class="widget stacked">
13 <div class="row"> 25 <div class="row">
14 <div class="col-md-3"> 26 <div class="col-md-3">
15 <div class="widget-header"> 27 <div class="widget-header">
16 <i class="fa fa-tint"></i> &nbsp; Fuel Orders 28 <i class="fa fa-tint"></i> &nbsp; Fuel Orders
17 </div> 29 </div>
18 <div class="custom-widget-content"> 30 <div class="custom-widget-content">
19 <div> 31 <div>
20 <div class="col-xs-12"> 32 <div class="col-xs-12">
21 <span class="pull-left">Completed</span> 33 <span class="pull-left">Completed</span>
22 <button class="btn btn-success btn-xs pull-right"> 34 <button class="btn btn-success btn-xs pull-right" style="cursor: default">
23 <span style="font-size:9px;">Monthly</span> 35 <span style="font-size:9px;">Monthly</span>
24 </button> 36 </button>
25 <div class="clearfix"></div> 37 <div class="clearfix"></div>
26 </div> 38 </div>
27 <div class="clearfix"></div> 39 <div class="clearfix"></div>
28 </div> 40 </div>
29 <hr class="hr"> 41 <hr class="hr">
30 <div class="col-xs-12"> 42 <div class="col-xs-12">
31 <h2 style="margin-bottom: 0px;">280</h2> 43 <h2 style="margin-bottom: 0px;">{{completeOrderCount}}</h2>
32 <span>Fuel Orders</span> 44 <span>Fuel Orders</span>
33 </div> 45 </div>
34 <div class="clearfix"></div> 46 <div class="clearfix"></div>
35 </div> 47 </div>
36 </div> 48 </div>
37 <div class="col-md-3"> 49 <div class="col-md-3">
38 <div class="widget-header"> 50 <div class="widget-header">
39 <i class="fa fa-tint"></i> &nbsp; Fuel Orders 51 <i class="fa fa-tint"></i> &nbsp; Fuel Orders
40 </div> 52 </div>
41 <div class="custom-widget-content"> 53 <div class="custom-widget-content">
42 <div> 54 <div>
43 <div class="col-xs-12"> 55 <div class="col-xs-12">
44 <span class="pull-left">Pending</span> 56 <span class="pull-left">Pending</span>
45 <button class="btn btn-success btn-xs pull-right pull-right-color "> 57 <button class="btn btn-success btn-xs pull-right pull-right-color " style="cursor: default">
46 <span style="font-size:9px;">Monthly</span> 58 <span style="font-size:9px;">Monthly</span>
47 </button> 59 </button>
48 <div class="clearfix"></div> 60 <div class="clearfix"></div>
49 </div> 61 </div>
50 <div class="clearfix"></div> 62 <div class="clearfix"></div>
51 </div> 63 </div>
52 <hr class="hr"> 64 <hr class="hr">
53 <div class="col-xs-12"> 65 <div class="col-xs-12">
54 <h2 style="margin-bottom: 0px;">280</h2> 66 <h2 style="margin-bottom: 0px;">{{pendingOrderCount}}</h2>
55 <span>Fuel Orders</span> 67 <span>Fuel Orders</span>
56 </div> 68 </div>
57 <div class="clearfix"></div> 69 <div class="clearfix"></div>
58 </div> 70 </div>
59 </div> 71 </div>
60 <div class="col-md-6"> 72 <div class="col-md-6">
61 <div class="widget-header"> 73 <div class="widget-header">
62 <i class="fa fa-list-alt "></i> 74 <i class="fa fa-list-alt "></i>
63 <h3>Fuel Order</h3> 75 <h3>Fuel Order</h3>
64 </div> 76 </div>
65 <div class="custom-widget-content"> 77 <div class="custom-widget-content">
66 <div> 78 <div>
67 <div class="col-xs-12"> 79 <div class="col-xs-12">
68 <span class="pull-left">Activity: Airport Operations</span> 80 <span class="pull-left">Activity: Airport Operations</span>
69 <button class="btn btn-primary btn-xs pull-right"> 81 <button class="btn btn-primary btn-xs pull-right" style="cursor: default">
70 <span style="font-size:9px;">Monthly</span> 82 <span style="font-size:9px;">Monthly</span>
71 </button> 83 </button>
72 <div class="clearfix"></div> 84 <div class="clearfix"></div>
73 </div> 85 </div>
74 <div class="clearfix"></div> 86 <div class="clearfix"></div>
75 </div> 87 </div>
76 <hr class="hr"> 88 <hr class="hr">
77 <div class="col-xs-6"> 89 <div class="col-xs-6">
78 <h2 style="margin-bottom:0px;">280</h2> 90 <h2 style="margin-bottom:0px;">280</h2>
79 <span>Based-Aircraft</span> 91 <span>Based-Aircraft</span>
80 </div> 92 </div>
81 <div class="col-xs-6"> 93 <div class="col-xs-6">
82 <h2 style="margin-bottom: 0px;">280</h2> 94 <h2 style="margin-bottom: 0px;">280</h2>
83 <span>Take-offs & Landings</span> 95 <span>Take-offs & Landings</span>
84 </div> 96 </div>
85 <div class="clearfix"></div> 97 <div class="clearfix"></div>
86 </div> 98 </div>
87 </div> 99 </div>
88 </div> 100 </div>
89 </br> 101 </br>
90 <div class="row"> 102 <div class="row">
91 <div class="col-md-12"> 103 <div class="col-md-12">
92 <div class="widget-header"> 104 <div class="widget-header">
93 <i class="fa fa-signal" aria-hidden="true"></i> 105 <i class="fa fa-signal" aria-hidden="true"></i>
94 <h3>Chart</h3> 106 <h3>Chart</h3>
95 </div> 107 </div>
96 <!-- /widget-header --> 108 <!-- /widget-header -->
97 <div class="widget-content"> 109 <div class="widget-content">
98 <div class="stats"> 110 <div class="stats">
99 <div class="stat"> 111 <div class="stat">
100 <span class="stat-value">12,386</span> 112 <span class="stat-value">12,386</span>
101 Site Visits 113 Site Visits
102 </div> 114 </div>
103 <!-- /stat --> 115 <!-- /stat -->
104 <div class="stat"> 116 <div class="stat">
105 <span class="stat-value">9,249</span> 117 <span class="stat-value">9,249</span>
106 Unique Visits 118 Unique Visits
107 </div> 119 </div>
108 <!-- /stat --> 120 <!-- /stat -->
109 <div class="stat"> 121 <div class="stat">
110 <span class="stat-value">70%</span> 122 <span class="stat-value">70%</span>
111 New Visits 123 New Visits
112 </div> 124 </div>
113 <!-- /stat --> 125 <!-- /stat -->
114 </div> 126 </div>
115 <!-- /stats --> 127 <!-- /stats -->
116 <div id="chart-stats" class="stats"> 128 <div id="chart-stats" class="stats">
117 <div class="stat stat-chart"> 129 <div class="stat stat-chart">
118 <!-- <div id="donut-chart" class="chart-holder"></div> --> <!-- #donut --> 130 <!-- <div id="donut-chart" class="chart-holder"></div> --> <!-- #donut -->
119 <div id="area-chart" class="chart-holder" style="height: 250px;"></div> 131 <div id="area-chart" class="chart-holder" style="height: 250px;"></div>
120 <!-- /area-chart --> 132 <!-- /area-chart -->
121 </div> 133 </div>
122 <!-- /substat --> 134 <!-- /substat -->
123 <div class="stat stat-time"> 135 <div class="stat stat-time">
124 <span class="stat-value">00:28:13</span> 136 <span class="stat-value">00:28:13</span>
125 Average Time on Site 137 Average Time on Site
126 </div> 138 </div>
127 <!-- /substat --> 139 <!-- /substat -->
128 </div> 140 </div>
129 <!-- /substats --> 141 <!-- /substats -->
130 </div> 142 </div>
131 <!-- /widget-content --> 143 <!-- /widget-content -->
132 </div> 144 </div>
133 <!-- /widget --> 145 <!-- /widget -->
134 </div> 146 </div>
135 </div> 147 </div>
136 </div> 148 </div>
137 <!-- /span6 --> 149 <!-- /span6 -->
138 <div class="col-md-5"> 150 <div class="col-md-5">
139 <div class="widget stacked"> 151 <div class="widget stacked">
140 <div class="widget-header"> 152 <div class="widget-header">
141 <i class="fa fa-pencil"></i> 153 <i class="fa fa-pencil"></i>
142 <h3>Price Manager</h3> 154 <h3>Price Manager</h3>
143 <select style="float: right; margin: 7px 10px; width: 150px; height: 26px; padding: 0 0;" class="btn btn-primary" class="form-control" ng-model="sendEmail.pricing" ng-change="confirmMail()"> 155 <select style="float: right; margin: 7px 10px; width: 150px; height: 26px; padding: 0 0;" class="btn btn-primary" class="form-control" ng-model="sendEmail.pricing" ng-change="confirmMail()">
144 <option value="" disabled selected="selected">Email All Pricing</option> 156 <option value="" disabled selected="selected">Email All Pricing</option>
145 <option value="JET-A">Email JET-A pricing only</option> 157 <option value="JET-A">Email JET-A pricing only</option>
146 <option value="AVGAS">Email AVGAS pricing only</option> 158 <option value="AVGAS">Email AVGAS pricing only</option>
147 <option disabled>_______________________________</option> 159 <option disabled>_______________________________</option>
148 <option value="all">Distribute All</option> 160 <option value="all">Distribute All</option>
149 </select> 161 </select>
150 </div> 162 </div>
151 <!-- /widget-header --> 163 <!-- /widget-header -->
152 <div class="widget-content"> 164 <div class="widget-content">
153 <h4>Deployed Fuel Prices</h4> 165 <h4>Deployed Fuel Prices</h4>
154 <table class="table"> 166 <table class="table">
155 <thead> 167 <thead>
156 <tr> 168 <tr>
157 <th> Product</th> 169 <th> Product</th>
158 <th> Cost</th> 170 <th> Cost</th>
159 <th> Margin</th> 171 <th> Margin</th>
160 <th> PAP(Total)</th> 172 <th> PAP(Total)</th>
161 <th style="color: #F90;"> Expires</th> 173 <th style="color: #F90;"> Expires</th>
162 </tr> 174 </tr>
163 </thead> 175 </thead>
164 <tbody> 176 <tbody>
165 <tr ng-repeat="fuelPricing in newFuelPricing | filter:{ status: true }"> 177 <tr ng-repeat="fuelPricing in newFuelPricing | filter:{ status: true }">
166 <td> 178 <td>
167 <span style="color: #2196f3" ng-show="fuelPricing.jeta">{{fuelPricing.name}}</span> 179 <span style="color: #2196f3" ng-show="fuelPricing.jeta">{{fuelPricing.name}}</span>
168 <span ng-show="fuelPricing.jeta">{{fuelPricing.namejetrest}}</span> 180 <span ng-show="fuelPricing.jeta">{{fuelPricing.namejetrest}}</span>
169 <span style="color: 39c" ng-show="fuelPricing.avgas">{{fuelPricing.name}}</span> 181 <span style="color: 39c" ng-show="fuelPricing.avgas">{{fuelPricing.name}}</span>
170 <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span> 182 <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span>
171 </td> 183 </td>
172 <td> 184 <td>
173 <span>{{fuelPricing.fuelPricing.cost}}</span> 185 <span>{{fuelPricing.fuelPricing.cost}}</span>
174 </td> 186 </td>
175 <td> 187 <td>
176 <span>{{fuelPricing.fuelPricing.papMargin}}</span> 188 <span>{{fuelPricing.fuelPricing.papMargin}}</span>
177 </td> 189 </td>
178 <td> 190 <td>
179 <span style="line-height: 31px; color: #1ab394;">$ {{fuelPricing.fuelPricing.cost -- fuelPricing.fuelPricing.papMargin | number : 2 }}</span> 191 <span style="line-height: 31px; color: #1ab394;">$ {{fuelPricing.fuelPricing.cost -- fuelPricing.fuelPricing.papMargin | number : 2 }}</span>
180 </td> 192 </td>
181 <td> 193 <td>
182 <span>{{fuelPricing.fuelPricing.expirationDate}}</span> 194 <span>{{fuelPricing.fuelPricing.expirationDate}}</span>
183 </td> 195 </td>
184 </tr> 196 </tr>
185 </tbody> 197 </tbody>
186 </table> 198 </table>
187 199
188 </div> 200 </div>
189 <!-- /widget-content --> 201 <!-- /widget-content -->
190 </div> 202 </div>
191 <!-- /widget --> 203 <!-- /widget -->
192 <div class="widget widget-nopad stacked"> 204 <div class="widget widget-nopad stacked">
193 <div class="widget-header"> 205 <div class="widget-header">
194 <i class="fa fa-comment" aria-hidden="true"></i> 206 <i class="fa fa-comment" aria-hidden="true"></i>
195 <h3>Messages</h3> 207 <h3>Messages</h3>
196 </div> 208 </div>
197 <!-- /widget-header --> 209 <!-- /widget-header -->
198 <div class="widget-content"> 210 <div class="widget-content">
199 <h4 style="padding:10px">Messages</h4> 211 <h4 style="padding:10px">Messages</h4>
200 <hr class="hr"> 212 <hr class="hr">
201 <ul class="news-items"> 213 <table>
214 <tr ng-repeat="msg in pendingMessageRecord">
215
216 <td>Fuel Order is Pending for the company {{ msg[5] }} </td>
217 </tr>
218 </table>
219 <!-- <ul class="news-items">
202 <li> 220 <li>
203 <div class="news-item-detail"> 221 <div class="news-item-detail">
204 <a href="javascript:;" class="news-item-title">Duis aute irure dolor in reprehenderit</a> 222 <a href="javascript:;" class="news-item-title">Duis aute irure dolor in reprehenderit</a>
205 <p class="news-item-preview">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p> 223 <p class="news-item-preview">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
206 </div> 224 </div>
207 <div class="news-item-date"> 225 <div class="news-item-date">
208 <span class="news-item-day">08</span> 226 <span class="news-item-day">08</span>
209 <span class="news-item-month">Mar</span> 227 <span class="news-item-month">Mar</span>
210 </div> 228 </div>
211 </li> 229 </li>
212 <li> 230 <li>
213 <div class="news-item-detail"> 231 <div class="news-item-detail">
214 <a href="javascript:;" class="news-item-title">Duis aute irure dolor in reprehenderit</a> 232 <a href="javascript:;" class="news-item-title">Duis aute irure dolor in reprehenderit</a>
215 <p class="news-item-preview">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p> 233 <p class="news-item-preview">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
216 </div> 234 </div>
217 <div class="news-item-date"> 235 <div class="news-item-date">
218 <span class="news-item-day">08</span> 236 <span class="news-item-day">08</span>
219 <span class="news-item-month">Mar</span> 237 <span class="news-item-month">Mar</span>
220 </div> 238 </div>
221 </li> 239 </li>
222 </ul> 240 </ul> -->
223 </div> 241 </div>
224 <!-- /widget-content --> 242 <!-- /widget-content -->
225 </div> 243 </div>
226 <!-- /widget --> 244 <!-- /widget -->
227 </div> 245 </div>
228 <!-- /span6 --> 246 <!-- /span6 -->
229 </div> 247 </div>
230 <!-- /row --> 248 <!-- /row -->
231 </div> 249 </div>
232 <!-- /container --> 250 <!-- /container -->
233 </div> 251 </div>
234 <!-- /main --> 252 <!-- /main -->
app/partials/dashboard/dashboard.service.js
1 (function(){ 1 (function(){
2 'use strict'; 2 'use strict';
3 angular.module('acufuel') 3 angular.module('acufuel')
4 .service('dashboardService', ['$q', '$http', 'BASE_URL', dashboardService]); 4 .service('dashboardService', ['$q', '$http', 'BASE_URL', dashboardService]);
5 5
6 function dashboardService($q, $http, BASE_URL) { 6 function dashboardService($q, $http, BASE_URL) {
7 var temp = {}; 7 var temp = {};
8 8
9 this.getFuelPricingNew = function() { 9 this.getFuelPricingNew = function() {
10 10
11 var deferred = $q.defer(); 11 var deferred = $q.defer();
12 $http({ 12 $http({
13 method : 'GET', 13 method : 'GET',
14 url : BASE_URL.url +'/user/products', 14 url : BASE_URL.url +'/user/products',
15 headers : {'Content-Type': 'application/json'}, 15 headers : {'Content-Type': 'application/json'},
16 }) 16 })
17 .then(function (result){ 17 .then(function (result){
18 deferred.resolve(result.data); 18 deferred.resolve(result.data);
19 },function (result){ 19 },function (result){
20 deferred.resolve(result.data); 20 deferred.resolve(result.data);
21 }) 21 })
22 return deferred.promise; 22 return deferred.promise;
23 } 23 }
24 24
25 this.getMargin = function() { 25 this.getMargin = function() {
26 26
27 var deferred = $q.defer(); 27 var deferred = $q.defer();
28 $http({ 28 $http({
29 method : 'GET', 29 method : 'GET',
30 url : BASE_URL.url +'/user/margins', 30 url : BASE_URL.url +'/user/margins',
31 headers : {'Content-Type': 'application/json'}, 31 headers : {'Content-Type': 'application/json'},
32 }) 32 })
33 .then(function (result){ 33 .then(function (result){
34 deferred.resolve(result.data); 34 deferred.resolve(result.data);
35 },function (result){ 35 },function (result){
36 deferred.resolve(result.data); 36 deferred.resolve(result.data);
37 }) 37 })
38 return deferred.promise; 38 return deferred.promise;
39 } 39 }
40 40
41 this.updateFuelPricing = function(data){ 41 this.updateFuelPricing = function(data){
42 var deferred = $q.defer(); 42 var deferred = $q.defer();
43 $http({ 43 $http({
44 method : 'POST', 44 method : 'POST',
45 url : BASE_URL.url +'/fuelPricing', 45 url : BASE_URL.url +'/fuelPricing',
46 headers : {'Content-Type': 'application/json'}, 46 headers : {'Content-Type': 'application/json'},
47 data: data 47 data: data
48 }) 48 })
49 .then(function (result){ 49 .then(function (result){
50 deferred.resolve(result.data); 50 deferred.resolve(result.data);
51 },function (result){ 51 },function (result){
52 deferred.resolve(result.data); 52 deferred.resolve(result.data);
53 }) 53 })
54 return deferred.promise; 54 return deferred.promise;
55 } 55 }
56 56
57 } 57 this.getFuelordercount = function() {
58 var deferred = $q.defer();
59 $http({
60 method : 'GET',
61 url : BASE_URL.url +'/fuelOrder/dashboardstatics',
62 headers : {'Content-Type': 'application/json'},
63 })
64 .then(function (result){
65 deferred.resolve(result.data);
66 },function (result){
67 deferred.resolve(result.data);
68 })
69 return deferred.promise;
70 }
71
72 this.getPendingMessage = function() {
73 var deferred = $q.defer();
74 $http({
75 method : 'GET',
76 url : BASE_URL.url +'/fuelOrder/dashboardmessages',
77 headers : {'Content-Type': 'application/json'},
78 })
79 .then(function (result){
80 deferred.resolve(result.data);
81 },function (result){
82 deferred.resolve(result.data);
83 })
84 return deferred.promise;
85 }
86
87
88
89 }
58 90
59 })(); 91 })();
app/partials/scheduler/scheduler.controller.js
1 'use strict'; 1 'use strict';
2 2
3 angular.module('acufuel') 3 angular.module('acufuel')
4 4
5 .controller('schedulerController', ['$scope','$compile', 'uiCalendarConfig', 'schedulerService', function($scope, $compile, uiCalendarConfig, schedulerService) { 5 .controller('schedulerController', ['$scope','$compile', 'uiCalendarConfig', 'schedulerService', function($scope, $compile, uiCalendarConfig, schedulerService) {
6 6
7
7 $scope.showLoader = true; 8 $scope.showLoader = true;
8 getEventsList(); 9 getEventsList();
9 10
11 /*---get events on calendar---*/
10 $scope.events = []; 12 $scope.events = [];
11 function getEventsList(){ 13 function getEventsList(){
12 schedulerService.getEvents().then(function(result) { 14 schedulerService.getEvents().then(function(result) {
15 //console.log('----kd events-------',result);
16
13 for (var i = 0; i < result.length; i++) { 17 for (var i = 0; i < result.length; i++) {
14 var newTime = new Date(result[i].deployDate); 18 var newTime = new Date(result[i].deployDate);
15 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 19 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
16 var dday = newTime.getUTCDate(); 20 var dday = newTime.getUTCDate();
17 var dyear = newTime.getUTCFullYear(); 21 var dyear = newTime.getUTCFullYear();
18 22
19 $scope.events.push({ 23 $scope.events.push({
20 'id': result[i].id, 24 'id': result[i].id,
21 'title': result[i].aircraft, 25 'title': result[i].aircraft +',\n' + result[i].make +'/' + result[i].model +',\n' + result[i].requestedVolume +',' +result[i].priceQuote,
22 'start': dyear+'-'+dmonth+'-'+dday 26 'start': dyear+'-'+dmonth+'-'+dday
23 }) 27 })
24 $scope.showLoader = false; 28 // $scope.showEventsList();
25 } 29 console.log('==kd events after push===', $scope.events)
30 $scope.showLoader = false;
31
32 }
33 $('#my-calendar').fullCalendar('removeEvents');
34 $('#my-calendar').fullCalendar('addEventSource',$scope.events);
35 // $scope.eventSources = [$scope.events, $scope.eventSource, $scope.eventsF];
36
37 // console.log('==eventSource are====',$scope.eventSources);
38 // $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
39 })
40 }
41
26 42
27 // $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
28 })
29 }
30 43
31 $scope.newEvent = {}; 44 $scope.newEvent = {};
32 $scope.addNewEvent = function(){ 45 $scope.addNewEvent = function(){
33 console.log('newEvent', $scope.newEvent); 46 console.log('newEvent', $scope.newEvent);
34 $scope.showLoader = true; 47 $scope.showLoader = true;
35 if ($scope.newEvent.deployDate != undefined) { 48 if ($scope.newEvent.deployDate != undefined) {
36 $scope.newEvent.deployDate = new Date($scope.newEvent.deployDate); 49 $scope.newEvent.deployDate = new Date($scope.newEvent.deployDate);
37 $scope.newEvent.deployDate = $scope.newEvent.deployDate.getTime(); 50 $scope.newEvent.deployDate = $scope.newEvent.deployDate.getTime();
38 } 51 }
39 //var data = 'aircraft='+$scope.newEvent.aircraft+'&deployDate='+$scope.newEvent.deployDate; 52 //var data = 'aircraft='+$scope.newEvent.aircraft+'&deployDate='+$scope.newEvent.deployDate;
40 schedulerService.addNewEventService($scope.newEvent).then(function(response){ 53 schedulerService.addNewEventService($scope.newEvent).then(function(response){
41 $scope.newEvent = {}; 54 $scope.newEvent = {};
42 $('#addEvent').modal('hide'); 55 $('#addEvent').modal('hide');
43 $scope.events = []; 56 $scope.events = [];
44 getEventsList(); 57 getEventsList();
45 }) 58 })
46 } 59 }
47 60
48 $scope.cancelAdd = function(){ 61 $scope.cancelAdd = function(){
49 $scope.newEvent = {}; 62 $scope.newEvent = {};
50 } 63 }
51 64
52 $scope.editData = {}; 65 $scope.editData = {};
53 $scope.editEvent = function(data){ 66 $scope.editEvent = function(data){
54 $scope.editData = data; 67 $scope.editData = data;
55 $('#editEvent').modal('show'); 68 $('#editEvent').modal('show');
56 } 69 }
57 $scope.updateEvent = function(){ 70 $scope.updateEvent = function(){
58 $scope.showLoader = true; 71 $scope.showLoader = true;
59 $scope.updatedData = {}; 72 $scope.updatedData = {};
60 $scope.updatedData.id = $scope.editData.id; 73 $scope.updatedData.id = $scope.editData.id;
61 $scope.updatedData.aircraft = $scope.editData.title; 74 $scope.updatedData.aircraft = $scope.editData.title;
62 $scope.updatedData.deployDate = $scope.editData.start; 75 $scope.updatedData.deployDate = $scope.editData.start;
63 if ($scope.updatedData.deployDate != undefined) { 76 if ($scope.updatedData.deployDate != undefined) {
64 $scope.updatedData.deployDate = new Date($scope.updatedData.deployDate); 77 $scope.updatedData.deployDate = new Date($scope.updatedData.deployDate);
65 $scope.updatedData.deployDate = $scope.updatedData.deployDate.getTime(); 78 $scope.updatedData.deployDate = $scope.updatedData.deployDate.getTime();
66 } 79 }
67 schedulerService.updateScheduledEvent($scope.updatedData).then(function(response){ 80 schedulerService.updateScheduledEvent($scope.updatedData).then(function(response){
68 console.log('response', response); 81 console.log('response', response);
69 $scope.updatedData = {}; 82 $scope.updatedData = {};
70 $('#editEvent').modal('hide'); 83 $('#editEvent').modal('hide');
71 toastr.success('Updated Successfully', { 84 toastr.success('Updated Successfully', {
72 closeButton: true 85 closeButton: true
73 }) 86 })
74 $scope.events = []; 87 $scope.events = [];
75 getEventsList(); 88 getEventsList();
76 }) 89 })
77 } 90 }
78 91
79 92
80 /* code for calendar */ 93 /* code for calendar */
81 94
82 var date = new Date(); 95 var date = new Date();
83 var d = date.getDate(); 96 var d = date.getDate();
84 var m = date.getMonth(); 97 var m = date.getMonth();
85 var y = date.getFullYear(); 98 var y = date.getFullYear();
86 99
87 $scope.changeTo = 'Hungarian'; 100 $scope.changeTo = 'Hungarian';
88 101
89 $scope.eventSource = {}; 102 $scope.eventSource = {};
90 103
91 $scope.eventsF = function (start, end, timezone, callback) { 104 $scope.eventsF = function (start, end, timezone, callback) {
92 var s = new Date(start).getTime() / 1000; 105 var s = new Date(start).getTime() / 1000;
93 var e = new Date(end).getTime() / 1000; 106 var e = new Date(end).getTime() / 1000;
94 var m = new Date(start).getMonth(); 107 var m = new Date(start).getMonth();
95 var events = [{title: 'Feed Me ' + m,start: s + (50000),end: s + (100000),allDay: false, className: ['customFeed']}]; 108 var events = [{title: 'Feed Me ' + m,start: s + (50000),end: s + (100000),allDay: false, className: ['customFeed']}];
96 callback(events); 109 callback(events);
97 }; 110 };
98 111
99 $scope.calEventsExt = { 112 $scope.calEventsExt = {
100 color: '#f00', 113 color: '#f00',
101 textColor: 'yellow', 114 textColor: 'yellow',
102 events: [] 115 events: []
103 }; 116 };
104 117
105 $scope.alertOnEventClick = function( date, jsEvent, view){ 118 $scope.alertOnEventClick = function( date, jsEvent, view){
106 $scope.alertMessage = (date.title + ' was clicked '); 119 $scope.alertMessage = (date.title + ' was clicked ');
107 }; 120 };
108 121
109 $scope.alertOnDrop = function(event, delta, revertFunc, jsEvent, ui, view){ 122 $scope.alertOnDrop = function(event, delta, revertFunc, jsEvent, ui, view){
110 var dmonth = event.start._d.getUTCMonth() + 1; //months from 1-12 123 var dmonth = event.start._d.getUTCMonth() + 1; //months from 1-12
111 var dday = event.start._d.getUTCDate(); 124 var dday = event.start._d.getUTCDate();
112 var dyear = event.start._d.getUTCFullYear(); 125 var dyear = event.start._d.getUTCFullYear();
113 console.log('date', dyear+'-'+dmonth+'-'+dday); 126 console.log('date', dyear+'-'+dmonth+'-'+dday);
114 for (var i = 0; i < $scope.events.length; i++) { 127 for (var i = 0; i < $scope.events.length; i++) {
115 if ($scope.events[i].id == event.id) { 128 if ($scope.events[i].id == event.id) {
116 129
117 console.log('events', $scope.events[i]); 130 console.log('events', $scope.events[i]);
118 //$scope.events[i].start = dyear+'-'+dmonth+'-'+dday; 131 //$scope.events[i].start = dyear+'-'+dmonth+'-'+dday;
119 $scope.showLoader = true; 132 $scope.showLoader = true;
120 $scope.updatedDataDrop = {}; 133 $scope.updatedDataDrop = {};
121 $scope.updatedDataDrop.id = $scope.events[i].id; 134 $scope.updatedDataDrop.id = $scope.events[i].id;
122 $scope.updatedDataDrop.aircraft = $scope.events[i].title; 135 $scope.updatedDataDrop.aircraft = $scope.events[i].title;
123 $scope.updatedDataDrop.deployDate = dyear+'-'+dmonth+'-'+dday; 136 $scope.updatedDataDrop.deployDate = dyear+'-'+dmonth+'-'+dday;
124 if ($scope.updatedDataDrop.deployDate != undefined) { 137 if ($scope.updatedDataDrop.deployDate != undefined) {
125 $scope.updatedDataDrop.deployDate = new Date($scope.updatedDataDrop.deployDate); 138 $scope.updatedDataDrop.deployDate = new Date($scope.updatedDataDrop.deployDate);
126 $scope.updatedDataDrop.deployDate = $scope.updatedDataDrop.deployDate.getTime(); 139 $scope.updatedDataDrop.deployDate = $scope.updatedDataDrop.deployDate.getTime();
127 } 140 }
128 schedulerService.updateScheduledEvent($scope.updatedDataDrop).then(function(response){ 141 schedulerService.updateScheduledEvent($scope.updatedDataDrop).then(function(response){
129 console.log('response', response); 142 console.log('response', response);
130 $scope.updatedDataDrop = {}; 143 $scope.updatedDataDrop = {};
131 $('#editEvent').modal('hide'); 144 $('#editEvent').modal('hide');
132 toastr.success('Updated Successfully', { 145 toastr.success('Updated Successfully', {
133 closeButton: true 146 closeButton: true
134 }) 147 })
135 $scope.events = []; 148 $scope.events = [];
136 getEventsList(); 149 getEventsList();
137 }) 150 })
138 151
139 } 152 }
140 } 153 }
141 console.log('$scope.events new', $scope.events); 154 console.log('$scope.events new', $scope.events);
142 $scope.alertMessage = ('Event Droped to make dayDelta ' + delta); 155 $scope.alertMessage = ('Event Droped to make dayDelta ' + delta);
143 }; 156 };
144 157
145 $scope.alertOnResize = function(event, delta, revertFunc, jsEvent, ui, view ){ 158 $scope.alertOnResize = function(event, delta, revertFunc, jsEvent, ui, view ){
146 $scope.alertMessage = ('Event Resized to make dayDelta ' + delta); 159 $scope.alertMessage = ('Event Resized to make dayDelta ' + delta);
147 }; 160 };
148 161
149 $scope.addRemoveEventSource = function(sources,source) { 162 $scope.addRemoveEventSource = function(sources,source) {
150 var canAdd = 0; 163 var canAdd = 0;
151 angular.forEach(sources,function(value, key){ 164 angular.forEach(sources,function(value, key){
152 if(sources[key] === source){ 165 if(sources[key] === source){
153 sources.splice(key,1); 166 sources.splice(key,1);
154 canAdd = 1; 167 canAdd = 1;
155 } 168 }
156 }); 169 });
157 if(canAdd === 0){ 170 if(canAdd === 0){
158 sources.push(source); 171 sources.push(source);
159 } 172 }
160 }; 173 };
161 174
162 $scope.addEvent = function() { 175 $scope.addEvent = function() {
163 $scope.events.push({ 176 $scope.events.push({
164 title: 'Open Sesame', 177 title: 'Open Sesame',
165 start: new Date(y, m, 28), 178 start: new Date(y, m, 28),
166 end: new Date(y, m, 29), 179 end: new Date(y, m, 29),
167 className: ['openSesame'] 180 className: ['openSesame']
168 }); 181 });
169 }; 182 };
170 183
171 $scope.remove = function(index) { 184 $scope.remove = function(index) {
172 $scope.events.splice(index,1); 185 $scope.events.splice(index,1);
173 }; 186 };
174 187
175 $scope.changeView = function(view,calendar) { 188 $scope.changeView = function(view,calendar) {
176 uiCalendarConfig.calendars[calendar].fullCalendar('changeView',view); 189 uiCalendarConfig.calendars[calendar].fullCalendar('changeView',view);
177 }; 190 };
178 191
179 $scope.renderCalender = function(calendar) { 192 $scope.renderCalender = function(calendar) {
180 if(uiCalendarConfig.calendars[calendar]){ 193 if(uiCalendarConfig.calendars[calendar]){
181 uiCalendarConfig.calendars[calendar].fullCalendar('render'); 194 uiCalendarConfig.calendars[calendar].fullCalendar('render');
182 } 195 }
183 }; 196 };
184 197
185 $scope.eventRender = function( event, element, view ) { 198 $scope.eventRender = function( event, element, view ) {
186 element.attr({'tooltip': event.title, 199 element.attr({'tooltip': event.title,
187 'tooltip-append-to-body': true}); 200 'tooltip-append-to-body': true});
188 $compile(element)($scope); 201 $compile(element)($scope);
189 }; 202 };
190 203
191 $scope.uiConfig = { 204 $scope.uiConfig = {
192 calendar:{ 205 calendar:{
193 height: 450, 206 height: 450,
194 editable: true, 207 editable: true,
195 droppable: true, 208 droppable: true,
196 drop: function (event, delta, revertFunc, jsEvent, ui, view) { 209 drop: function (event, delta, revertFunc, jsEvent, ui, view) {
197 }, 210 },
198 header:{ 211 header:{
199 right: 'month basicWeek basicDay', 212 right: 'month basicWeek basicDay',
200 center: 'title', 213 center: 'title',
201 left: 'prev,next, today' 214 left: 'prev,next, today'
202 }, 215 },
203 eventClick: $scope.alertOnEventClick, 216 eventClick: $scope.alertOnEventClick,
204 eventDrop: $scope.alertOnDrop, 217 eventDrop: $scope.alertOnDrop,
205 eventResize: $scope.alertOnResize, 218 eventResize: $scope.alertOnResize,
206 eventRender: $scope.eventRender 219 eventRender: $scope.eventRender
207 } 220 }
208 }; 221 };
209 222
210 $scope.addEvent = function(index) { 223 $scope.addEvent = function(index) {
211 //console.log('INDEX', index); 224 //console.log('INDEX', index);
212 //console.log('EVENTS', $scope.eventSources); 225 //console.log('EVENTS', $scope.eventSources);
213 //$scope.events.push($scope.eventList[index]); 226 // $scope.events.push($scope.eventList[index]);
214 } 227 }
215 228
216 $scope.eventSources = [$scope.events, $scope.eventSource, $scope.eventsF]; 229 /*$scope.showEventsList = function(){
217 $scope.eventSources2 = [$scope.calEventsExt, $scope.eventsF, $scope.events]; 230 console.log('testing', $scope.eventsF);
218 231
232 };*/
233 $scope.eventSources = [$scope.events, $scope.eventSource, $scope.eventsF];
234
235 $scope.eventSources2 = [$scope.calEventsExt, $scope.eventsF, $scope.events];
app/partials/scheduler/scheduler.html
1 <style type="text/css"> 1 <style type="text/css">
2 .newUlView { 2 .newUlView {
3 padding: 5px; 3 padding: 5px;
4 margin: 3px; 4 margin: 3px;
5 } 5 }
6 .subnavbar .mainnav > li:nth-child(4) > a{ 6 .subnavbar .mainnav > li:nth-child(4) > a{
7 color: #ff9900; 7 color: #ff9900;
8 } 8 }
9 .fc button, .fc-button-group, .fc-time-grid .fc-event .fc-time span{ 9 .fc button, .fc-button-group, .fc-time-grid .fc-event .fc-time span{
10 display: block; 10 display: block;
11 } 11 }
12 .fc-state-default{ 12 .fc-state-default{
13 background-color: #fff; 13 background-color: #fff;
14 background-image: none; 14 background-image: none;
15 } 15 }
16 .fc-state-active, .fc-state-down{ 16 .fc-state-active, .fc-state-down{
17 box-shadow: none; 17 box-shadow: none;
18 color: #fff; 18 color: #fff;
19 background-color: #ff9900; 19 background-color: #ff9900;
20 } 20 }
21 .stacked:after, .stacked:before{ 21 .stacked:after, .stacked:before{
22 display: none; 22 display: none;
23 } 23 }
24 .btn-white, .btn-white:hover{ 24 .btn-white, .btn-white:hover{
25 background-color: #fff; 25 background-color: #fff;
26 background-image: none; 26 background-image: none;
27 } 27 }
28 .fc-day-grid-event .fc-time{ 28 .fc-day-grid-event .fc-time{
29 display: none; 29 display: none;
30 } 30 }
31 31
32 /*#wrap { 32 /*#wrap {
33 width: 1100px; 33 width: 1100px;
34 margin: 0 auto; 34 margin: 0 auto;
35 } 35 }
36 36
37 #external-events { 37 #external-events {
38 float: left; 38 float: left;
39 width: 150px; 39 width: 150px;
40 padding: 0 10px; 40 padding: 0 10px;
41 border: 1px solid #ccc; 41 border: 1px solid #ccc;
42 background: #eee; 42 background: #eee;
43 text-align: left; 43 text-align: left;
44 } 44 }
45 45
46 #external-events h4 { 46 #external-events h4 {
47 font-size: 16px; 47 font-size: 16px;
48 margin-top: 0; 48 margin-top: 0;
49 padding-top: 1em; 49 padding-top: 1em;
50 } 50 }
51 51
52 #external-events .fc-event { 52 #external-events .fc-event {
53 margin: 10px 0; 53 margin: 10px 0;
54 cursor: pointer; 54 cursor: pointer;
55 } 55 }
56 56
57 #external-events p { 57 #external-events p {
58 margin: 1.5em 0; 58 margin: 1.5em 0;
59 font-size: 11px; 59 font-size: 11px;
60 color: #666; 60 color: #666;
61 } 61 }
62 62
63 #external-events p input { 63 #external-events p input {
64 margin: 0; 64 margin: 0;
65 vertical-align: middle; 65 vertical-align: middle;
66 } 66 }
67 67
68 #calendar { 68 #calendar {
69 float: right; 69 float: right;
70 width: 900px; 70 width: 900px;
71 }*/ 71 }*/
72 </style> 72 </style>
73 73
74 <div class="myLoader" ng-show="showLoader"> 74 <div class="myLoader" ng-show="showLoader">
75 <img src="../img/hourglass.gif" width="50px;"> 75 <img src="../img/hourglass.gif" width="50px;">
76 </div> 76 </div>
77 77
78 <div class="main"> 78 <div class="main">
79 <div class="container"> 79 <div class="container">
80 <div class="row"> 80 <div class="row">
81 <div class="col-xs-12"> 81 <div class="col-xs-12">
82 <div class="col-xs-12 col-md-3"> 82 <div class="col-xs-12 col-md-1">
83 <div class="widget stacked"> 83 <!--<div class="widget stacked">
84 <div class="widget-header"> 84 <div class="widget-header">
85 <i class="fa fa-plane" aria-hidden="true"></i> 85 <i class="fa fa-plane" aria-hidden="true"></i>
86 <h3>Enter Support Service</h3> 86 <h3>Enter Support Service</h3>
87 </div> 87 </div>
88 <div class="widget-content"> 88 <div class="widget-content">
89 <label ng-repeat="item in events" ng-click="editEvent(item)" style="width: 100%;"> 89 <label ng-repeat="item in events" ng-click="editEvent(item)" style="width: 100%;">
90 <!-- <div class="fc-event" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}"> 90 <div class="fc-event" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}">
91 {{item.title}} 91 {{item.title}}
92 </div> --> 92 </div>
93 <div class="fc-event"> 93 <div class="fc-event">
94 {{item.title}} 94 {{item.title}}
95 </div> 95 </div>
96 </label> 96 </label>
97 <!-- <p> 97 <p>
98 <input type='checkbox' id='drop-remove' /> 98 <input type='checkbox' id='drop-remove' />
99 <label for='drop-remove'>remove after drop</label> 99 <label for='drop-remove'>remove after drop</label>
100 </p> --> 100 </p>
101 </div> 101 </div>
102 </div> 102 </div>
103 <div class="text-right"> 103 <div class="text-right">
104 <button class="btn btn-default btn-white" data-toggle="modal" data-target="#addEvent">Add Event</button> 104 <button class="btn btn-default btn-white" data-toggle="modal" data-target="#addEvent">Add Event</button>
105 </div> 105 </div> -->
106 </div> 106 </div>
107 107
108 <div class="col-xs-12 col-md-9"> 108 <div class="col-xs-12 col-md-10">
109 <div class="widget stacked"> 109 <div class="widget stacked">
110 <div class="widget-header"> 110 <div class="widget-header">
111 <i class="fa fa-calendar" aria-hidden="true"></i> 111 <i class="fa fa-calendar" aria-hidden="true"></i>
112 <h3>Schedule</h3> 112 <h3>Schedule kd</h3>
113 </div> 113 </div>
114 <div class="widget-content"> 114 <div class="widget-content">
115 <div ui-calendar="uiConfig.calendar" ng-model="eventSources" data-drop="true"></div> 115 <div id="my-calendar" ui-calendar="uiConfig.calendar" ng-model="eventSources" data-drop="true"></div>
116
117
116 </div> 118 </div>
117 </div> 119 </div>
118 </div> 120 </div>
119 <div style='clear:both'></div> 121 <div style='clear:both'></div>
122 <div class="col-xs-12 col-md-1">
123 </div>
120 124
121 <!-- <div ui-calendar="uiConfig.calendar" ng-model="eventSources" class="col-xs-12 col-md-9" data-drop="true" jqyoui-droppable="{multiple:true, onDrop: 'addEvent($index)'}"></div> --> 125 <!-- <div ui-calendar="uiConfig.calendar" ng-model="eventSources" class="col-xs-12 col-md-9" data-drop="true" jqyoui-droppable="{multiple:true, onDrop: 'addEvent($index)'}"></div> -->
122 126
123 127
124 128
125 129
126 130
127 </div> 131 </div>
128 132
129 133
130 134
131 </div> 135 </div>
132 136
133 </div> 137 </div>
134 <div> 138 <div>
135 </div> 139 </div>
136 <!-- /row --> 140 <!-- /row -->
137 </div> 141 </div>
138 <!-- /container --> 142 <!-- /container -->
139 </div> 143 </div>
140 <!-- /main --> 144 <!-- /main -->
141 145
142 146
143 <div id="addEvent" class="modal fade" role="dialog" data-backdrop="static"> 147 <div id="addEvent" class="modal fade" role="dialog" data-backdrop="static">
144 <div class="modal-dialog"> 148 <div class="modal-dialog">
145 <form ng-submit="addNewEvent()"> 149 <form ng-submit="addNewEvent()">
146 <div class="modal-content"> 150 <div class="modal-content">
147 <div class="modal-header"> 151 <div class="modal-header">
148 <button type="button" ng-click="cancelAdd()" class="close" data-dismiss="modal">&times;</button> 152 <button type="button" ng-click="cancelAdd()" class="close" data-dismiss="modal">&times;</button>
149 <h4 class="modal-title">Schedule New Event</h4> 153 <h4 class="modal-title">Schedule New Event</h4>
150 </div> 154 </div>
151 <div class="modal-body"> 155 <div class="modal-body">
152 <div class="col-md-6" style="padding-left: 0;"> 156 <div class="col-md-6" style="padding-left: 0;">
153 <label>Event Name:</label> 157 <label>Event Name:</label>
154 <input type="text" ng-model="newEvent.aircraft" class="form-control"> 158 <input type="text" ng-model="newEvent.aircraft" class="form-control">
155 </div> 159 </div>
156 <div class="col-md-6" style="padding-right: 0;"> 160 <div class="col-md-6" style="padding-right: 0;">
157 <label>Deploy Date:</label> 161 <label>Deploy Date:</label>
158 <input type="text" datepicker ng-model="newEvent.deployDate" class="form-control"> 162 <input type="text" datepicker ng-model="newEvent.deployDate" class="form-control">
159 </div> 163 </div>
160 <div class="clearfix"></div> 164 <div class="clearfix"></div>
161 </div> 165 </div>
162 <div class="modal-footer"> 166 <div class="modal-footer">
163 <input type="submit" value="Add" class="btn btn-primary"> 167 <input type="submit" value="Add" class="btn btn-primary">
164 <button type="button" class="btn btn-default" ng-click="cancelAdd()" data-dismiss="modal">Close</button> 168 <button type="button" class="btn btn-default" ng-click="cancelAdd()" data-dismiss="modal">Close</button>
165 </div> 169 </div>
166 </div> 170 </div>
167 </form> 171 </form>
168 172
169 </div> 173 </div>
170 </div> 174 </div>
171 175
172 <div id="editEvent" class="modal fade" role="dialog" data-backdrop="static"> 176 <div id="editEvent" class="modal fade" role="dialog" data-backdrop="static">
173 <div class="modal-dialog"> 177 <div class="modal-dialog">
174 <form ng-submit="updateEvent()"> 178 <form ng-submit="updateEvent()">
175 <div class="modal-content"> 179 <div class="modal-content">
176 <div class="modal-header"> 180 <div class="modal-header">
177 <button type="button" ng-click="cancelAdd()" class="close" data-dismiss="modal">&times;</button> 181 <button type="button" ng-click="cancelAdd()" class="close" data-dismiss="modal">&times;</button>
178 <h4 class="modal-title">Update Scheduled Event</h4> 182 <h4 class="modal-title">Update Scheduled Event</h4>
179 </div> 183 </div>
180 <div class="modal-body"> 184 <div class="modal-body">
181 <div class="col-md-6" style="padding-left: 0;"> 185 <div class="col-md-6" style="padding-left: 0;">
182 <label>Event Name:</label> 186 <label>Event Name:</label>
183 <input type="text" ng-model="editData.title" class="form-control"> 187 <input type="text" ng-model="editData.title" class="form-control">
184 </div> 188 </div>
185 <div class="col-md-6" style="padding-right: 0;"> 189 <div class="col-md-6" style="padding-right: 0;">
186 <label>Deploy Date:</label> 190 <label>Deploy Date:</label>
187 <input type="text" datepicker ng-model="editData.start" class="form-control"> 191 <input type="text" datepicker ng-model="editData.start" class="form-control">
188 </div> 192 </div>
189 <div class="clearfix"></div> 193 <div class="clearfix"></div>
190 </div> 194 </div>
191 <div class="modal-footer"> 195 <div class="modal-footer">
192 <input type="submit" value="Update" class="btn btn-primary"> 196 <input type="submit" value="Update" class="btn btn-primary">
193 <button type="button" class="btn btn-default" ng-click="cancelUpdate()" data-dismiss="modal">Close</button> 197 <button type="button" class="btn btn-default" ng-click="cancelUpdate()" data-dismiss="modal">Close</button>
194 </div> 198 </div>
195 </div> 199 </div>
196 </form> 200 </form>
197 201
198 </div> 202 </div>
199 </div> 203 </div>