Compare View
Commits (2)
Showing
9 changed files
Show diff stats
app/css/custom.css
... | ... | @@ -69,6 +69,9 @@ table th, td{ |
69 | 69 | background-color: #ff9900 !important; |
70 | 70 | color: #fff !important; |
71 | 71 | border: 1px solid #ff9900 !important; |
72 | + padding: 5px; | |
73 | + font-size: 14px; | |
74 | + border-radius: 0 !important; | |
72 | 75 | } |
73 | 76 | .pull-right-color{ |
74 | 77 | background-image: linear-gradient(to bottom, #1c84c6 0%, #1c84c6 100%); | ... | ... |
app/index.html
... | ... | @@ -184,7 +184,7 @@ |
184 | 184 | <script src="partials/fuelManager/fuelManager.service.js"></script> |
185 | 185 | <script src="partials/pricing/pricing.service.js"></script> |
186 | 186 | <script src="partials/reports/reports.service.js"></script> |
187 | - <script src="partials/scheduler/scheduler.service.js"></script> | |
187 | + | |
188 | 188 | <script src="partials/signup/signup.service.js"></script> |
189 | 189 | <script src="partials/updateFuelManager/updateFuelManager.service.js"></script> |
190 | 190 | <script src="partials/viewCompany/viewCompany.service.js"></script> |
... | ... | @@ -209,8 +209,9 @@ |
209 | 209 | <script type="text/javascript" src="bower_components/fullcalendar/dist/fullcalendar.min.js"></script> |
210 | 210 | <script type="text/javascript" src="bower_components/fullcalendar/dist/gcal.js"></script> |
211 | 211 | |
212 | + <script src="partials/scheduler/scheduler.service.js"></script> | |
212 | 213 | |
213 | - <script src="bower_components/angular/angular.js"></script> | |
214 | + <!-- <script src="bower_components/angular/angular.js"></script> --> | |
214 | 215 | <script src="bower_components/d3/d3.js"></script> |
215 | 216 | <script src="bower_components/nvd3/build/nv.d3.js"></script> <!-- or use another assembly --> |
216 | 217 | ... | ... |
app/js/app.constant.js
... | ... | @@ -4,8 +4,8 @@ |
4 | 4 | angular.module('acufuel') |
5 | 5 | |
6 | 6 | .constant('BASE_URL', { |
7 | - url: 'http://54.149.169.33:8080/ws' | |
8 | - //url: 'http://192.168.2.178:8080/ws' | |
7 | + //url: 'http://54.149.169.33:8080/ws' | |
8 | + url: 'http://192.168.1.175:8080/ws' | |
9 | 9 | //url: 'http://192.168.1.8:8080/ws' |
10 | 10 | |
11 | 11 | }) | ... | ... |
app/partials/scheduler/scheduler.controller.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -//Load controller | |
4 | 3 | angular.module('acufuel') |
5 | 4 | |
6 | - .controller('schedulerController', ['$scope','$compile', 'uiCalendarConfig', function($scope, $compile, uiCalendarConfig) { | |
7 | - | |
8 | - $scope.test = "Testing..."; | |
9 | - | |
10 | - var date = new Date(); | |
11 | - var d = date.getDate(); | |
12 | - var m = date.getMonth(); | |
13 | - var y = date.getFullYear(); | |
14 | - | |
15 | - | |
16 | - $scope.eventList=[ | |
17 | - {title:'Event 1'}, | |
18 | - {title:'Event 2'}, | |
19 | - {title:'Event 3'}, | |
20 | - {title:'Event 4'} | |
21 | - ]; | |
22 | - | |
23 | - $scope.eventSources=[]; | |
24 | - | |
25 | - $scope.events = [ | |
26 | - {title: 'All Day Event', start: new Date(y, m, 1)}, | |
27 | - {title: 'Birthday Party', start: new Date(y, m, d + 1, 19, 0), end: new Date(y, m, d + 1, 22, 30), allDay: false}, | |
28 | - {title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29)} | |
29 | - ]; | |
30 | - | |
31 | - $scope.uiConfig = { | |
32 | - calendar:{ | |
33 | - height: 450, | |
34 | - editable: true, | |
35 | - droppable: true, | |
36 | - drop: function (date, allDay, jsEvent, ui) { | |
37 | - console.log('Here ,but where is the object?'); | |
38 | - }, | |
39 | - header:{ | |
40 | - left: 'title', | |
41 | - center: '', | |
42 | - right: 'today prev,next' | |
43 | - }, | |
44 | - eventResize: true, | |
5 | +.controller('schedulerController', ['$scope','$compile', 'uiCalendarConfig', 'schedulerService', function($scope, $compile, uiCalendarConfig, schedulerService) { | |
6 | + | |
7 | + $scope.showLoader = true; | |
8 | + getEventsList(); | |
9 | + | |
10 | + $scope.events = []; | |
11 | + function getEventsList(){ | |
12 | + schedulerService.getEvents().then(function(result) { | |
13 | + console.log('result', result); | |
14 | + for (var i = 0; i < result.length; i++) { | |
15 | + var newTime = new Date(result[i].deployDate); | |
16 | + var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
17 | + var dday = newTime.getUTCDate(); | |
18 | + var dyear = newTime.getUTCFullYear(); | |
19 | + | |
20 | + $scope.events.push({ | |
21 | + 'id': result[i].id, | |
22 | + 'title': result[i].aircraft, | |
23 | + 'start': dyear+'-'+dmonth+'-'+dday | |
24 | + }) | |
25 | + $scope.showLoader = false; | |
26 | + } | |
27 | + | |
28 | + // $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; | |
29 | + }) | |
30 | + } | |
31 | + | |
32 | + $scope.newEvent = {}; | |
33 | + $scope.addNewEvent = function(){ | |
34 | + console.log('newEvent', $scope.newEvent); | |
35 | + $scope.showLoader = true; | |
36 | + if ($scope.newEvent.deployDate != undefined) { | |
37 | + $scope.newEvent.deployDate = new Date($scope.newEvent.deployDate); | |
38 | + $scope.newEvent.deployDate = $scope.newEvent.deployDate.getTime(); | |
39 | + } | |
40 | + //var data = 'aircraft='+$scope.newEvent.aircraft+'&deployDate='+$scope.newEvent.deployDate; | |
41 | + schedulerService.addNewEventService($scope.newEvent).then(function(response){ | |
42 | + console.log('response', response); | |
43 | + $scope.newEvent = {}; | |
44 | + $('#addEvent').modal('hide'); | |
45 | + getEventsList(); | |
46 | + }) | |
47 | + } | |
48 | + | |
49 | + $scope.cancelAdd = function(){ | |
50 | + $scope.newEvent = {}; | |
51 | + } | |
52 | + $scope.editData = {}; | |
53 | + $scope.editEvent = function(data){ | |
54 | + console.log('data', data); | |
55 | + $scope.editData = data; | |
56 | + console.log('$scope.editData', $scope.editData); | |
57 | + $('#editEvent').modal('show'); | |
58 | + | |
59 | + } | |
60 | + | |
61 | + | |
62 | + | |
63 | + /* code for calendar */ | |
64 | + | |
65 | + var date = new Date(); | |
66 | + var d = date.getDate(); | |
67 | + var m = date.getMonth(); | |
68 | + var y = date.getFullYear(); | |
69 | + | |
70 | + $scope.changeTo = 'Hungarian'; | |
71 | + | |
72 | + $scope.eventSource = {}; | |
73 | + | |
74 | + $scope.eventsF = function (start, end, timezone, callback) { | |
75 | + var s = new Date(start).getTime() / 1000; | |
76 | + var e = new Date(end).getTime() / 1000; | |
77 | + var m = new Date(start).getMonth(); | |
78 | + var events = [{title: 'Feed Me ' + m,start: s + (50000),end: s + (100000),allDay: false, className: ['customFeed']}]; | |
79 | + callback(events); | |
80 | + }; | |
81 | + | |
82 | + $scope.calEventsExt = { | |
83 | + color: '#f00', | |
84 | + textColor: 'yellow', | |
85 | + events: [] | |
86 | + }; | |
87 | + | |
88 | + $scope.alertOnEventClick = function( date, jsEvent, view){ | |
89 | + $scope.alertMessage = (date.title + ' was clicked '); | |
90 | +}; | |
91 | + | |
92 | +$scope.alertOnDrop = function(event, delta, revertFunc, jsEvent, ui, view){ | |
93 | + var dmonth = event.start._d.getUTCMonth() + 1; //months from 1-12 | |
94 | + var dday = event.start._d.getUTCDate(); | |
95 | + var dyear = event.start._d.getUTCFullYear(); | |
96 | + console.log('date', dyear+'-'+dmonth+'-'+dday); | |
97 | + for (var i = 0; i < $scope.events.length; i++) { | |
98 | + if ($scope.events[i].id == event.id) { | |
99 | + console.log('events', $scope.events[i]); | |
100 | + $scope.events[i].start = dyear+'-'+dmonth+'-'+dday; | |
45 | 101 | } |
46 | - }; | |
47 | - | |
48 | - $scope.eventSources = [$scope.events]; | |
49 | - //$scope.eventSources = []; | |
50 | - //$scope.eventSources.push($scope.events); | |
51 | - | |
52 | - $scope.addEvent = function(index) { | |
53 | - console.log('INDEX', index); | |
54 | - console.log('EVENTS', $scope.eventSources); | |
55 | - //$scope.events.push($scope.eventList[index]); | |
56 | 102 | } |
57 | - | |
58 | - console.log($scope.eventSources); | |
103 | + console.log('$scope.events new', $scope.events); | |
104 | + $scope.alertMessage = ('Event Droped to make dayDelta ' + delta); | |
105 | + }; | |
106 | + | |
107 | + $scope.alertOnResize = function(event, delta, revertFunc, jsEvent, ui, view ){ | |
108 | + $scope.alertMessage = ('Event Resized to make dayDelta ' + delta); | |
109 | + }; | |
110 | + | |
111 | + $scope.addRemoveEventSource = function(sources,source) { | |
112 | + var canAdd = 0; | |
113 | + angular.forEach(sources,function(value, key){ | |
114 | + if(sources[key] === source){ | |
115 | + sources.splice(key,1); | |
116 | + canAdd = 1; | |
117 | + } | |
118 | + }); | |
119 | + if(canAdd === 0){ | |
120 | + sources.push(source); | |
121 | + } | |
122 | + }; | |
123 | + | |
124 | + $scope.addEvent = function() { | |
125 | + $scope.events.push({ | |
126 | + title: 'Open Sesame', | |
127 | + start: new Date(y, m, 28), | |
128 | + end: new Date(y, m, 29), | |
129 | + className: ['openSesame'] | |
130 | + }); | |
131 | + }; | |
132 | + | |
133 | + $scope.remove = function(index) { | |
134 | + $scope.events.splice(index,1); | |
135 | + }; | |
136 | + | |
137 | + $scope.changeView = function(view,calendar) { | |
138 | + uiCalendarConfig.calendars[calendar].fullCalendar('changeView',view); | |
139 | + }; | |
140 | + | |
141 | + $scope.renderCalender = function(calendar) { | |
142 | + if(uiCalendarConfig.calendars[calendar]){ | |
143 | + uiCalendarConfig.calendars[calendar].fullCalendar('render'); | |
144 | + } | |
145 | + }; | |
146 | + | |
147 | + $scope.eventRender = function( event, element, view ) { | |
148 | + element.attr({'tooltip': event.title, | |
149 | + 'tooltip-append-to-body': true}); | |
150 | + $compile(element)($scope); | |
151 | + }; | |
152 | + | |
153 | + $scope.uiConfig = { | |
154 | + calendar:{ | |
155 | + height: 450, | |
156 | + editable: true, | |
157 | + droppable: true, | |
158 | + drop: function (event, delta, revertFunc, jsEvent, ui, view) { | |
159 | + }, | |
160 | + header:{ | |
161 | + right: 'month basicWeek basicDay', | |
162 | + center: 'title', | |
163 | + left: 'prev,next, today' | |
164 | + }, | |
165 | + eventClick: $scope.alertOnEventClick, | |
166 | + eventDrop: $scope.alertOnDrop, | |
167 | + eventResize: $scope.alertOnResize, | |
168 | + eventRender: $scope.eventRender | |
169 | + } | |
170 | + }; | |
171 | + | |
172 | + $scope.addEvent = function(index) { | |
173 | + //console.log('INDEX', index); | |
174 | + //console.log('EVENTS', $scope.eventSources); | |
175 | + //$scope.events.push($scope.eventList[index]); | |
176 | + } | |
177 | + | |
178 | + $scope.eventSources = [$scope.events, $scope.eventSource, $scope.eventsF]; | |
179 | + $scope.eventSources2 = [$scope.calEventsExt, $scope.eventsF, $scope.events]; | |
59 | 180 | |
60 | - }]); | |
181 | +}]); | |
61 | 182 | ... | ... |
app/partials/scheduler/scheduler.html
... | ... | @@ -18,7 +18,16 @@ |
18 | 18 | color: #fff; |
19 | 19 | background-color: #ff9900; |
20 | 20 | } |
21 | - | |
21 | + .stacked:after, .stacked:before{ | |
22 | + display: none; | |
23 | + } | |
24 | + .btn-white, .btn-white:hover{ | |
25 | + background-color: #fff; | |
26 | + background-image: none; | |
27 | + } | |
28 | + .fc-day-grid-event .fc-time{ | |
29 | + display: none; | |
30 | + } | |
22 | 31 | |
23 | 32 | /*#wrap { |
24 | 33 | width: 1100px; |
... | ... | @@ -61,30 +70,61 @@ |
61 | 70 | width: 900px; |
62 | 71 | }*/ |
63 | 72 | </style> |
73 | + | |
74 | +<div class="myLoader" ng-show="showLoader"> | |
75 | + <img src="../img/hourglass.gif" width="50px;"> | |
76 | +</div> | |
77 | + | |
64 | 78 | <div class="main"> |
65 | 79 | <div class="container"> |
66 | 80 | <div class="row"> |
67 | 81 | <div class="col-xs-12"> |
68 | - <div id='wrap'> | |
82 | + <div class="col-xs-12 col-md-3"> | |
83 | + <div class="widget stacked"> | |
84 | + <div class="widget-header"> | |
85 | + <i class="fa fa-plane" aria-hidden="true"></i> | |
86 | + <h3>Enter Support Service</h3> | |
87 | + </div> | |
88 | + <div class="widget-content"> | |
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}"> | |
91 | + {{item.title}} | |
92 | + </div> --> | |
93 | + <div class="fc-event"> | |
94 | + {{item.title}} | |
95 | + </div> | |
96 | + </label> | |
97 | + <!-- <p> | |
98 | + <input type='checkbox' id='drop-remove' /> | |
99 | + <label for='drop-remove'>remove after drop</label> | |
100 | + </p> --> | |
101 | + </div> | |
102 | + </div> | |
103 | + <div class="text-right"> | |
104 | + <button class="btn btn-default btn-white" data-toggle="modal" data-target="#addEvent">Add Event</button> | |
105 | + </div> | |
106 | + </div> | |
107 | + | |
108 | + <div class="col-xs-12 col-md-9"> | |
109 | + <div class="widget stacked"> | |
110 | + <div class="widget-header"> | |
111 | + <i class="fa fa-calendar" aria-hidden="true"></i> | |
112 | + <h3>Schedule</h3> | |
113 | + </div> | |
114 | + <div class="widget-content"> | |
115 | + <div ui-calendar="uiConfig.calendar" ng-model="eventSources" data-drop="true"></div> | |
116 | + </div> | |
117 | + </div> | |
118 | + </div> | |
119 | + <div style='clear:both'></div> | |
69 | 120 | |
70 | - <div id='external-events' class="col-xs-12 col-md-3"> | |
71 | - <h4>Draggable Events</h4> | |
72 | - <label ng-repeat="item in eventList" style="width: 100%;"> | |
73 | - <div class="fc-event" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}"> | |
74 | - {{item.title}} | |
75 | - </div> | |
76 | - </label> | |
77 | - <!-- <p> | |
78 | - <input type='checkbox' id='drop-remove' /> | |
79 | - <label for='drop-remove'>remove after drop</label> | |
80 | - </p> --> | |
81 | - </div> | |
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> --> | |
82 | 122 | |
83 | - <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> | |
123 | + | |
84 | 124 | |
85 | - <div style='clear:both'></div> | |
125 | + | |
86 | 126 | |
87 | - </div> | |
127 | + </div> | |
88 | 128 | |
89 | 129 | |
90 | 130 | |
... | ... | @@ -97,4 +137,63 @@ |
97 | 137 | </div> |
98 | 138 | <!-- /container --> |
99 | 139 | </div> |
100 | -<!-- /main --> | |
101 | 140 | \ No newline at end of file |
141 | +<!-- /main --> | |
142 | + | |
143 | + | |
144 | +<div id="addEvent" class="modal fade" role="dialog" data-backdrop="static"> | |
145 | + <div class="modal-dialog"> | |
146 | + <form ng-submit="addNewEvent()"> | |
147 | + <div class="modal-content"> | |
148 | + <div class="modal-header"> | |
149 | + <button type="button" ng-click="cancelAdd()" class="close" data-dismiss="modal">×</button> | |
150 | + <h4 class="modal-title">Schedule New Event</h4> | |
151 | + </div> | |
152 | + <div class="modal-body"> | |
153 | + <div class="col-md-6" style="padding-left: 0;"> | |
154 | + <label>Event Name:</label> | |
155 | + <input type="text" ng-model="newEvent.aircraft" class="form-control"> | |
156 | + </div> | |
157 | + <div class="col-md-6" style="padding-right: 0;"> | |
158 | + <label>Deploy Date:</label> | |
159 | + <input type="text" datepicker ng-model="newEvent.deployDate" class="form-control"> | |
160 | + </div> | |
161 | + <div class="clearfix"></div> | |
162 | + </div> | |
163 | + <div class="modal-footer"> | |
164 | + <input type="submit" value="Add" class="btn btn-primary"> | |
165 | + <button type="button" class="btn btn-default" ng-click="cancelAdd()" data-dismiss="modal">Close</button> | |
166 | + </div> | |
167 | + </div> | |
168 | + </form> | |
169 | + | |
170 | + </div> | |
171 | +</div> | |
172 | + | |
173 | +<div id="editEvent" class="modal fade" role="dialog" data-backdrop="static"> | |
174 | + <div class="modal-dialog"> | |
175 | + <form ng-submit="updateEvent()"> | |
176 | + <div class="modal-content"> | |
177 | + <div class="modal-header"> | |
178 | + <button type="button" ng-click="cancelAdd()" class="close" data-dismiss="modal">×</button> | |
179 | + <h4 class="modal-title">Schedule New Event</h4> | |
180 | + </div> | |
181 | + <div class="modal-body"> | |
182 | + <div class="col-md-6" style="padding-left: 0;"> | |
183 | + <label>Event Name:</label> | |
184 | + <input type="text" ng-model="editData.title" class="form-control"> | |
185 | + </div> | |
186 | + <div class="col-md-6" style="padding-right: 0;"> | |
187 | + <label>Deploy Date:</label> | |
188 | + <input type="text" datepicker ng-model="editData.start" class="form-control"> | |
189 | + </div> | |
190 | + <div class="clearfix"></div> | |
191 | + </div> | |
192 | + <div class="modal-footer"> | |
193 | + <input type="submit" value="Add" class="btn btn-primary"> | |
194 | + <button type="button" class="btn btn-default" ng-click="cancelUpdate()" data-dismiss="modal">Close</button> | |
195 | + </div> | |
196 | + </div> | |
197 | + </form> | |
198 | + | |
199 | + </div> | |
200 | +</div> | |
102 | 201 | \ No newline at end of file | ... | ... |
app/partials/scheduler/scheduler.service.js
1 | 1 | (function(){ |
2 | 2 | 'use strict'; |
3 | 3 | angular.module('acufuel') |
4 | - .service('schedulerService', ['$q', '$http', 'BE', schedulerService]); | |
4 | + .service('schedulerService', ['$q', '$http', 'BASE_URL', schedulerService]); | |
5 | 5 | |
6 | - function schedulerService($q, $http, BE) { | |
6 | + function schedulerService($q, $http, BASE_URL) { | |
7 | 7 | var temp = {}; |
8 | 8 | |
9 | - | |
10 | - | |
9 | + this.getEvents = function() { | |
10 | + var deferred = $q.defer(); | |
11 | + $http({ | |
12 | + method : 'GET', | |
13 | + url : BASE_URL.url +'/user/schedules', | |
14 | + headers : {'Content-Type': 'application/json'}, | |
15 | + }) | |
16 | + .then(function (result){ | |
17 | + deferred.resolve(result.data); | |
18 | + },function (result){ | |
19 | + deferred.resolve(result.data); | |
20 | + }) | |
21 | + return deferred.promise; | |
22 | + } | |
23 | + | |
24 | + this.addNewEventService = function(data) { | |
25 | + var deferred = $q.defer(); | |
26 | + $http({ | |
27 | + method : 'POST', | |
28 | + url : BASE_URL.url +'/scheduler', | |
29 | + headers : {'Content-Type': 'application/json'}, | |
30 | + data: data | |
31 | + }) | |
32 | + .then(function (result){ | |
33 | + deferred.resolve(result.data); | |
34 | + },function (result){ | |
35 | + deferred.resolve(result.data); | |
36 | + }) | |
37 | + return deferred.promise; | |
38 | + } | |
39 | + | |
11 | 40 | } |
12 | 41 | |
13 | 42 | })(); |
14 | 43 | \ No newline at end of file | ... | ... |
app/partials/updateFuelManager/updateFuelManager.controller.js
... | ... | @@ -409,6 +409,7 @@ |
409 | 409 | } |
410 | 410 | |
411 | 411 | $scope.newFuelPricing = {}; |
412 | + $scope.holdFuelPricing = {}; | |
412 | 413 | updateFuelManagerService.getFuelPricingNew().then(function(result) { |
413 | 414 | $scope.newFuelPricing = result; |
414 | 415 | for (var i = 0; i<$scope.newFuelPricing.length; i++) { |
... | ... | @@ -440,26 +441,60 @@ |
440 | 441 | $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; |
441 | 442 | } |
442 | 443 | } |
443 | - } | |
444 | + } | |
444 | 445 | |
445 | 446 | var str =""+ $scope.newFuelPricing[i].name |
446 | - if(str.startsWith("J")){ | |
447 | - $scope.newFuelPricing[i].jeta = true; | |
448 | - var str1 = str.substring(0,5) | |
449 | - var str2 = str.substring(6, str.length) | |
450 | - $scope.newFuelPricing[i].name = str1 | |
451 | - $scope.newFuelPricing[i].namejetrest = str2 | |
452 | - | |
453 | - | |
454 | - }else if(str.startsWith("100")){ | |
455 | - $scope.newFuelPricing[i].avgas = true; | |
456 | - var str1 = str.substring(0,5) | |
457 | - var str2 = str.substring(6, str.length) | |
458 | - $scope.newFuelPricing[i].name = str1 | |
459 | - $scope.newFuelPricing[i].nameavgasrest = str2 | |
460 | - } | |
461 | - } | |
462 | - $scope.showLoader = false; | |
447 | + if(str.startsWith("J")){ | |
448 | + $scope.newFuelPricing[i].jeta = true; | |
449 | + var str1 = str.substring(0,5) | |
450 | + var str2 = str.substring(6, str.length) | |
451 | + $scope.newFuelPricing[i].name = str1 | |
452 | + $scope.newFuelPricing[i].namejetrest = str2 | |
453 | + | |
454 | + | |
455 | + }else if(str.startsWith("100")){ | |
456 | + $scope.newFuelPricing[i].avgas = true; | |
457 | + var str1 = str.substring(0,5) | |
458 | + var str2 = str.substring(6, str.length) | |
459 | + $scope.newFuelPricing[i].name = str1 | |
460 | + $scope.newFuelPricing[i].nameavgasrest = str2 | |
461 | + } | |
462 | + } | |
463 | + | |
464 | + for (var i = 0; i<result.length; i++) { | |
465 | + if (result[i].fuelPricing != null) { | |
466 | + if (result[i].fuelPricing.expirationDate != null && result[i].fuelPricing.expirationDate != '') { | |
467 | + var newTime = new Date(result[i].fuelPricing.expirationDate); | |
468 | + var month = newTime.getUTCMonth() + 1; //months from 1-12 | |
469 | + var day = newTime.getUTCDate(); | |
470 | + var year = newTime.getUTCFullYear(); | |
471 | + result[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; | |
472 | + } | |
473 | + } | |
474 | + if (result[i].futureFuelPricing != null) { | |
475 | + if (result[i].futureFuelPricing != null) { | |
476 | + if (result[i].futureFuelPricing.nextExpiration != null && result[i].futureFuelPricing.nextExpiration != '') { | |
477 | + var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); | |
478 | + var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
479 | + var nextDay = newTime.getUTCDate(); | |
480 | + var nextYear = newTime.getUTCFullYear(); | |
481 | + result[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; | |
482 | + } | |
483 | + } | |
484 | + if (result[i].futureFuelPricing != null) { | |
485 | + if (result[i].futureFuelPricing.deployDate != null && result[i].futureFuelPricing.deployDate != '') { | |
486 | + var newTime = new Date(result[i].futureFuelPricing.deployDate); | |
487 | + var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
488 | + var dday = newTime.getUTCDate(); | |
489 | + var dyear = newTime.getUTCFullYear(); | |
490 | + result[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; | |
491 | + } | |
492 | + } | |
493 | + } | |
494 | + } | |
495 | + | |
496 | + $scope.holdFuelPricing = result; | |
497 | + $scope.showLoader = false; | |
463 | 498 | |
464 | 499 | }) |
465 | 500 | $scope.$watch("fuelPricing.fuelPricing.expirationDate",function(old,newv){ |
... | ... | @@ -545,6 +580,7 @@ |
545 | 580 | } |
546 | 581 | } |
547 | 582 | } |
583 | + | |
548 | 584 | $scope.showLoader = false; |
549 | 585 | }) |
550 | 586 | }) |
... | ... | @@ -642,6 +678,24 @@ |
642 | 678 | } |
643 | 679 | } |
644 | 680 | } |
681 | + | |
682 | + var str =""+ $scope.newFuelPricing[i].name | |
683 | + if(str.startsWith("J")){ | |
684 | + $scope.newFuelPricing[i].jeta = true; | |
685 | + var str1 = str.substring(0,5) | |
686 | + var str2 = str.substring(6, str.length) | |
687 | + $scope.newFuelPricing[i].name = str1 | |
688 | + $scope.newFuelPricing[i].namejetrest = str2 | |
689 | + | |
690 | + | |
691 | + }else if(str.startsWith("100")){ | |
692 | + $scope.newFuelPricing[i].avgas = true; | |
693 | + var str1 = str.substring(0,5) | |
694 | + var str2 = str.substring(6, str.length) | |
695 | + $scope.newFuelPricing[i].name = str1 | |
696 | + $scope.newFuelPricing[i].nameavgasrest = str2 | |
697 | + } | |
698 | + | |
645 | 699 | } |
646 | 700 | $scope.showLoader = false; |
647 | 701 | }) |
... | ... | @@ -650,6 +704,118 @@ |
650 | 704 | |
651 | 705 | } |
652 | 706 | |
707 | + $scope.updateFutureFuelPricingImmediatelyClick = function(){ | |
708 | + $scope.showLoader = true; | |
709 | + for (var i = 0; i<$scope.newFuelPricing.length; i++) { | |
710 | + //console.log(parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin)); | |
711 | + if ($scope.newFuelPricing[i].futureFuelPricing != null) { | |
712 | + if ($scope.newFuelPricing[i].futureFuelPricing.cost != null || $scope.newFuelPricing[i].futureFuelPricing.cost != '' || $scope.newFuelPricing[i].futureFuelPricing.cost != undefined) { | |
713 | + $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); | |
714 | + if ($scope.newFuelPricing[i].futureFuelPricing.cost == null) { | |
715 | + $scope.newFuelPricing[i].futureFuelPricing.cost = ''; | |
716 | + } | |
717 | + if ($scope.newFuelPricing[i].futureFuelPricing.papMargin == null) { | |
718 | + $scope.newFuelPricing[i].futureFuelPricing.papMargin = ''; | |
719 | + } | |
720 | + if ($scope.newFuelPricing[i].futureFuelPricing.papTotal == null) { | |
721 | + $scope.newFuelPricing[i].futureFuelPricing.papTotal = ''; | |
722 | + } | |
723 | + if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration == null) { | |
724 | + $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = ''; | |
725 | + }else{ | |
726 | + $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); | |
727 | + console.log('$scope.newFuelPricing[i].futureFuelPricing.nextExpiration', $scope.newFuelPricing[i].futureFuelPricing.nextExpiration); | |
728 | + $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = $scope.newFuelPricing[i].futureFuelPricing.nextExpiration.getTime(); | |
729 | + } | |
730 | + if ($scope.newFuelPricing[i].futureFuelPricing.deployDate == null) { | |
731 | + $scope.newFuelPricing[i].futureFuelPricing.deployDate = ''; | |
732 | + }else{ | |
733 | + $scope.newFuelPricing[i].futureFuelPricing.deployDate = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); | |
734 | + $scope.newFuelPricing[i].futureFuelPricing.deployDate = $scope.newFuelPricing[i].futureFuelPricing.deployDate.getTime(); | |
735 | + } | |
736 | + | |
737 | + $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].futureFuelPricing.papMargin); | |
738 | + //$scope.newFuelPricing[i].futureFuelPricing.papTotal; | |
739 | + $scope.updateFutureFuelPricing.futureFuelPricingList.push({ | |
740 | + 'cost': $scope.newFuelPricing[i].futureFuelPricing.cost, | |
741 | + 'papMargin': $scope.newFuelPricing[i].futureFuelPricing.papMargin, | |
742 | + //'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal, | |
743 | + 'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal, | |
744 | + 'expirationDate': $scope.newFuelPricing[i].futureFuelPricing.nextExpiration, | |
745 | + 'deployDate': $scope.newFuelPricing[i].futureFuelPricing.deployDate, | |
746 | + 'productId': $scope.newFuelPricing[i].id, | |
747 | + 'id': $scope.newFuelPricing[i].futureFuelPricing.id, | |
748 | + }) | |
749 | + } | |
750 | + }else{ | |
751 | + /*$scope.newFuelPricing[i].futureFuelPricing.cost = ''; | |
752 | + $scope.newFuelPricing[i].futureFuelPricing.papMargin = ''; | |
753 | + $scope.newFuelPricing[i].futureFuelPricing.papTotal = ''; | |
754 | + $scope.newFuelPricing[i].futureFuelPricing.expirationDate = ''; | |
755 | + $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';*/ | |
756 | + } | |
757 | + } | |
758 | + //console.log('$scope.updateFutureFuelPricing', $scope.updateFutureFuelPricing); | |
759 | + updateFuelManagerService.updateFutureFuelPricingImmediatlly($scope.updateFutureFuelPricing).then(function(result) { | |
760 | + toastr.success('Successfully Updated', { | |
761 | + closeButton: true | |
762 | + }) | |
763 | + updateFuelManagerService.getFuelPricingNew().then(function(result) { | |
764 | + $scope.newFuelPricing = result; | |
765 | + for (var i = 0; i<$scope.newFuelPricing.length; i++) { | |
766 | + if ($scope.newFuelPricing[i].fuelPricing != null) { | |
767 | + if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { | |
768 | + var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); | |
769 | + var month = newTime.getUTCMonth() + 1; //months from 1-12 | |
770 | + var day = newTime.getUTCDate(); | |
771 | + var year = newTime.getUTCFullYear(); | |
772 | + $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; | |
773 | + } | |
774 | + } | |
775 | + if ($scope.newFuelPricing[i].futureFuelPricing != null) { | |
776 | + if ($scope.newFuelPricing[i].futureFuelPricing != null) { | |
777 | + if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { | |
778 | + var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); | |
779 | + var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
780 | + var nextDay = newTime.getUTCDate(); | |
781 | + var nextYear = newTime.getUTCFullYear(); | |
782 | + $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; | |
783 | + } | |
784 | + } | |
785 | + if ($scope.newFuelPricing[i].futureFuelPricing != null) { | |
786 | + if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { | |
787 | + var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); | |
788 | + var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
789 | + var dday = newTime.getUTCDate(); | |
790 | + var dyear = newTime.getUTCFullYear(); | |
791 | + $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; | |
792 | + } | |
793 | + } | |
794 | + } | |
795 | + | |
796 | + var str =""+ $scope.newFuelPricing[i].name | |
797 | + if(str.startsWith("J")){ | |
798 | + $scope.newFuelPricing[i].jeta = true; | |
799 | + var str1 = str.substring(0,5) | |
800 | + var str2 = str.substring(6, str.length) | |
801 | + $scope.newFuelPricing[i].name = str1 | |
802 | + $scope.newFuelPricing[i].namejetrest = str2 | |
803 | + | |
804 | + | |
805 | + }else if(str.startsWith("100")){ | |
806 | + $scope.newFuelPricing[i].avgas = true; | |
807 | + var str1 = str.substring(0,5) | |
808 | + var str2 = str.substring(6, str.length) | |
809 | + $scope.newFuelPricing[i].name = str1 | |
810 | + $scope.newFuelPricing[i].nameavgasrest = str2 | |
811 | + } | |
812 | + | |
813 | + } | |
814 | + $scope.showLoader = false; | |
815 | + }) | |
816 | + }) | |
817 | + } | |
818 | + | |
653 | 819 | updateFuelManagerService.getMargin().then(function(result) { |
654 | 820 | $scope.marginList = result; |
655 | 821 | }) | ... | ... |
app/partials/updateFuelManager/updateFuelManager.html
... | ... | @@ -4,6 +4,9 @@ |
4 | 4 | .subnavbar .mainnav > li:nth-child(2) > a{ |
5 | 5 | color: #ff9900; |
6 | 6 | } |
7 | + .extraClasToMerge{ | |
8 | + color: #fff; | |
9 | + } | |
7 | 10 | </style> |
8 | 11 | <div class="myLoader" ng-show="showLoader"> |
9 | 12 | <img src="../img/hourglass.gif" width="50px;"> |
... | ... | @@ -61,7 +64,7 @@ |
61 | 64 | <div class="row" style="margin-left: 0px;"> |
62 | 65 | <div class="col-md-12" style= "text-align: right;"> |
63 | 66 | <div style="float: left;"> |
64 | - <button type="button" class="btn btn-primary btn-xs" ng-click="updateFutureFuelPricingClick()" style= "text-align: center; font-size:12px">Save & Deploy Immediately</button> | |
67 | + <button type="button" class="btn btn-primary btn-xs" ng-click="updateFutureFuelPricingImmediatelyClick()" style= "text-align: center; font-size:12px">Save & Deploy Immediately</button> | |
65 | 68 | |
66 | 69 | <button type="reset" class="btn btn-default btn-xs">Reset All</button> |
67 | 70 | </div> | ... | ... |
app/partials/updateFuelManager/updateFuelManager.service.js
... | ... | @@ -213,6 +213,22 @@ |
213 | 213 | return deferred.promise; |
214 | 214 | } |
215 | 215 | |
216 | + this.updateFutureFuelPricingImmediatlly = function(data){ | |
217 | + var deferred = $q.defer(); | |
218 | + $http({ | |
219 | + method : 'POST', | |
220 | + url : BASE_URL.url +'/fuelPricing/updateImmediateFuelPrice', | |
221 | + headers : {'Content-Type': 'application/json'}, | |
222 | + data: data | |
223 | + }) | |
224 | + .then(function (result){ | |
225 | + deferred.resolve(result.data); | |
226 | + },function (result){ | |
227 | + deferred.resolve(result.data); | |
228 | + }) | |
229 | + return deferred.promise; | |
230 | + } | |
231 | + | |
216 | 232 | this.getMargin = function() { |
217 | 233 | |
218 | 234 | var deferred = $q.defer(); | ... | ... |