Revize fb12df6d
Přidáno uživatelem Jan Kohlíček před téměř 7 roky(ů)
backend/app/Http/Controllers/DeviceController.php | ||
---|---|---|
98 | 98 |
return Zaznam::findByDevice($deviceId, $dateFrom, $dateTo, $timeFrom, $timeTo, $direction); |
99 | 99 |
} |
100 | 100 |
|
101 |
public function findDayAverageTrafficByDevice(Request $request, $deviceId) { |
|
101 |
public function findDayAverageTrafficByDevice(Request $request, $deviceId) |
|
102 |
{ |
|
102 | 103 |
// nacti parametry |
103 | 104 |
$params = $this->loadDateTimeDirectionConstraints($request); |
104 | 105 |
$dateFrom = $params[self::DATE_FROM_PARAM]; |
... | ... | |
146 | 147 |
* @param integer $id Id zarizeni. |
147 | 148 |
* @return Mixed_ |
148 | 149 |
*/ |
149 |
public function getTrafficAverageByDeviceCsv(Request $request, $id) { |
|
150 |
public function getTrafficAverageByDeviceCsv(Request $request, $id) |
|
151 |
{ |
|
150 | 152 |
return $this->createCsvFileForDeviceData( |
151 | 153 |
$this->findDeviceByIdSetDates($request, $id), |
152 | 154 |
$this->findDayAverageTrafficByDevice($request, $id), |
153 |
'doprava-prumery-export-' |
|
154 |
);
|
|
155 |
'doprava-casove-prumery-export-'
|
|
156 |
); |
|
155 | 157 |
} |
156 | 158 |
|
157 | 159 |
/** |
... | ... | |
161 | 163 |
* @param $deviceId Id zarizeni. |
162 | 164 |
* @return Mixed_ |
163 | 165 |
*/ |
164 |
public function findTrafficAverageByDevice(Request $request, $deviceId) { |
|
166 |
public function findTrafficAverageByDevice(Request $request, $deviceId) |
|
167 |
{ |
|
165 | 168 |
// nacti parametry |
166 | 169 |
$params = $this->loadDateTimeDirectionConstraints($request); |
167 | 170 |
$dateFrom = $params[self::DATE_FROM_PARAM]; |
... | ... | |
282 | 285 |
* @param $df Ukazatel na soubor. |
283 | 286 |
* @param $array Pole. |
284 | 287 |
*/ |
285 |
private function addArrayToCsvFile($df, $array) { |
|
288 |
private function addArrayToCsvFile($df, $array) |
|
289 |
{ |
|
286 | 290 |
if ($array != null && count($array) > 0) { |
287 | 291 |
$row = $this->stdClassToArray($array[0]); |
288 | 292 |
fputcsv($df, array_keys($row)); |
... | ... | |
304 | 308 |
* @param integer $id id zarizeni. |
305 | 309 |
* @return Mixed_ |
306 | 310 |
*/ |
307 |
private function findDeviceByIdSetDates(Request $request, $id) { |
|
311 |
private function findDeviceByIdSetDates(Request $request, $id) |
|
312 |
{ |
|
308 | 313 |
// nacteni parametru |
309 | 314 |
$params = $this->loadDateTimeDirectionConstraints($request); |
310 | 315 |
$dateFrom = $params[self::DATE_FROM_PARAM]; |
... | ... | |
332 | 337 |
* @param string $namePrefix Prefix jmena stahovaneho souboru. |
333 | 338 |
* @return Mixed_ |
334 | 339 |
*/ |
335 |
private function createCsvFileForDeviceData($device, $traffic, $namePrefix) { |
|
340 |
private function createCsvFileForDeviceData($device, $traffic, $namePrefix) |
|
341 |
{ |
|
336 | 342 |
|
337 | 343 |
if ($device != null) { |
338 | 344 |
$devArray = json_decode(json_encode($device), true); |
backend/app/Model/Zarizeni.php | ||
---|---|---|
62 | 62 |
$query = DB::table('zarizeni') |
63 | 63 |
->join('ulice', 'zarizeni.ulice_id', '=', 'ulice.id') |
64 | 64 |
->join('mesto', 'ulice.mesto_id', '=', 'mesto.id') |
65 |
->join('zaznam_cas', 'zaznam_cas.zarizeni_id', '=', 'zarizeni.id') |
|
66 |
->select('zarizeni.id as id', |
|
67 |
'zarizeni.smer_popis as name', |
|
68 |
'ulice.nazev as street', |
|
69 |
'ulice.id as street_id', |
|
70 |
'ulice.zem_sirka as lat', |
|
71 |
'ulice.zem_delka as lng', |
|
72 |
'mesto.nazev as town', |
|
73 |
'mesto.id as town_id', |
|
74 |
$showDirection ? 'zaznam_cas.smer as direction' : DB::Raw('null as direction')) |
|
75 |
->where('ulice.nazev', 'like', '%' . $address . '%') |
|
76 |
->orWhere('mesto.nazev', 'like', '%' . $address . '%') |
|
77 |
->orWhere('zarizeni.smer_popis', 'like', '%' . $address . '%'); |
|
65 |
->select(DB::Raw('zarizeni.id as id, |
|
66 |
zarizeni.smer_popis as name, |
|
67 |
ulice.nazev as street, |
|
68 |
ulice.id as street_id, |
|
69 |
ulice.zem_sirka as lat, |
|
70 |
ulice.zem_delka as lng, |
|
71 |
mesto.nazev as town, |
|
72 |
mesto.id as town_id,' . |
|
73 |
($showDirection ? 'zaznam_cas.smer as direction' : 'null as direction'))); |
|
78 | 74 |
|
79 |
if (!$showDirection) {
|
|
80 |
$query = $query->groupBy('zarizeni.id');
|
|
81 |
} else {
|
|
82 |
$query = $query->groupBy('zarizeni.id', 'zaznam_cas.smer');
|
|
75 |
if (!empty($address)) {
|
|
76 |
$query = $query->where('ulice.nazev', 'like', '%' . $address . '%')
|
|
77 |
->orWhere('mesto.nazev', 'like', '%' . $address . '%')
|
|
78 |
->orWhere('zarizeni.smer_popis', 'like', '%' . $address . '%');
|
|
83 | 79 |
} |
84 | 80 |
|
81 |
if ($showDirection) { |
|
82 |
$query = $query->join('zaznam_cas', 'zaznam_cas.zarizeni_id', '=', 'zarizeni.id') |
|
83 |
->groupBy('zarizeni.id', 'zaznam_cas.smer'); |
|
84 |
} |
|
85 | 85 |
|
86 | 86 |
return $query->get(); |
87 | 87 |
} |
backend/app/Model/Zaznam.php | ||
---|---|---|
81 | 81 |
->select(DB::raw(" |
82 | 82 |
date_format(datum.od, '%H:%i') as timeFrom, |
83 | 83 |
date_format(datum.do, '%H:%i') as timeTo, |
84 |
ROUND(avg(zaznam.rychlost_prumer),0) as speedAverage,
|
|
85 |
CAST(sum(zaznam.vozidla_pocet) as UNSIGNED) as numberVehicle,
|
|
86 |
ROUND(avg(zaznam.vozidla_pocet),0) as numberVehicleAverage,
|
|
84 |
ROUND(AVG(zaznam.rychlost_prumer), 0) as speedAverage,
|
|
85 |
CAST(SUM(zaznam.vozidla_pocet) as UNSIGNED) as numberVehicle,
|
|
86 |
ROUND(AVG(zaznam.vozidla_pocet), 0) as numberVehicleAverage,
|
|
87 | 87 |
zaznam.vozidlo_id as typeVehicleId |
88 | 88 |
")) |
89 | 89 |
->whereDate('datum.od', '>=', $dateFrom == null ? $lastDate : $dateFrom) |
90 |
->whereDate('datum.do', '<=', $dateTo == null ? $lastDate : $dateTo)
|
|
90 |
->whereDate('datum.od', '<=', $dateTo == null ? $lastDate : $dateTo)
|
|
91 | 91 |
->whereTime('datum.od', '>=', $timeFrom == null ? '08:00:00' : $timeFrom) |
92 | 92 |
->whereTime('datum.od', '<=', $timeTo == null ? '23:59:59' : $timeTo) |
93 | 93 |
->where('zaznam_cas.zarizeni_id', '=', $deviceId); |
... | ... | |
137 | 137 |
->join('datum', 'zaznam_prum_den.datum_id', '=', 'datum.id') |
138 | 138 |
->select(DB::raw(" |
139 | 139 |
date_format(datum.od, '%Y-%m-%d') as date, |
140 |
zaznam_prum_den.rychlost_prumer as speedAverage,
|
|
141 |
zaznam_prum_den.vozidla_pocet as numberVehicle,
|
|
142 |
zaznam_prum_den.vozidlo_id as typeVehicle |
|
140 |
ROUND(AVG(zaznam_prum_den.rychlost_prumer), 0) as speedAverage,
|
|
141 |
CAST(SUM(zaznam_prum_den.vozidla_pocet) as UNSIGNED) as numberVehicle,
|
|
142 |
zaznam_prum_den.vozidlo_id as typeVehicleId
|
|
143 | 143 |
")) |
144 | 144 |
->whereDate('datum.od', '>=', $dateFrom == null ? $lastDateFrom : $dateFrom) |
145 |
->whereDate('datum.do', '<=', $dateTo == null ? $lastDateTo : $dateTo)
|
|
145 |
->whereDate('datum.od', '<=', $dateTo == null ? $lastDateTo : $dateTo)
|
|
146 | 146 |
->where('zaznam_prum_den.zarizeni_id', '=', $deviceId); |
147 | 147 |
|
148 | 148 |
if ($direction != null) { |
... | ... | |
151 | 151 |
|
152 | 152 |
// pridat grouping a razeni nakonec |
153 | 153 |
$query = $query |
154 |
->groupBy('date', 'typeVehicle')
|
|
154 |
->groupBy('date', 'zaznam_prum_den.vozidlo_id')
|
|
155 | 155 |
->orderBy('date', 'asc') |
156 | 156 |
->orderBy('zaznam_prum_den.vozidlo_id', 'asc'); |
157 | 157 |
|
frontend/.stylelintrc | ||
---|---|---|
1 |
{ |
|
2 |
"rules": { |
|
3 |
}, |
|
4 |
"extends": [ |
|
5 |
"stylelint-config-standard", |
|
6 |
"stylelint-config-rational-order" |
|
7 |
] |
|
8 |
} |
frontend/app.js | ||
---|---|---|
2 | 2 |
|
3 | 3 |
app.constant('config', { |
4 | 4 |
APP_NAME: 'PVPK', |
5 |
APP_VERSION: 1.0,
|
|
5 |
APP_VERSION: '1.2.0',
|
|
6 | 6 |
API_URL: API_URL, |
7 | 7 |
API_TOKEN: API_TOKEN, |
8 | 8 |
DEFAULT_POSITION: {LAT: 49.53, LNG: 13.3}, |
9 |
DEFAULT_ZOOM: 10 |
|
9 |
DEFAULT_ZOOM: 10, |
|
10 |
DEFAULT_ZOOM_MAX: 7, |
|
10 | 11 |
}); |
11 | 12 |
|
12 |
//PRIPRAVA PRO REFAKTORING |
|
13 |
// app.config(function($stateProvider, $locationProvider) { |
|
14 |
// // $stateProvider |
|
15 |
// // .state('report',{ |
|
16 |
// // views: { |
|
17 |
// // 'search': { |
|
18 |
// // templateUrl: 'report-filters.html', |
|
19 |
// // controller: searchController |
|
20 |
// // }, |
|
21 |
// // 'graph': { |
|
22 |
// // templateUrl: 'report-table.html', |
|
23 |
// // controller: graphController |
|
24 |
// // }, |
|
25 |
// // 'map': { |
|
26 |
// // templateUrl: 'report-graph.html', |
|
27 |
// // controller: mapController |
|
28 |
// // } |
|
29 |
// // } |
|
30 |
// // }); |
|
31 |
// $locationProvider.html5Mode(true); |
|
32 |
// }); |
|
33 |
|
|
34 |
|
|
35 | 13 |
app.controller('mainController', function ($rootScope, $scope, $location, $window) { |
36 | 14 |
|
37 | 15 |
this.$onInit = function () { |
38 |
|
|
16 |
$scope.showLoadingScreen = true; |
|
39 | 17 |
}; |
40 | 18 |
|
41 | 19 |
$window.onload = function () { |
42 | 20 |
let params = $location.search(); |
43 | 21 |
if (params.deviceId) { |
44 |
$rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction}); |
|
45 | 22 |
$rootScope.$emit('activeMarker', {id: params.deviceId}); |
46 | 23 |
} |
47 | 24 |
|
48 |
$scope.showLoadingScreen = false; |
|
25 |
$scope.$apply(function () { |
|
26 |
$scope.showLoadingScreen = false; |
|
27 |
}); |
|
49 | 28 |
}; |
50 | 29 |
|
51 | 30 |
$rootScope.$on('$locationChangeSuccess', function (event, newUrl, oldUrl) { |
31 |
let params = $location.search(); |
|
52 | 32 |
|
53 | 33 |
if (newUrl !== oldUrl && $scope.historyUrl) { |
54 |
let params = $location.search(); |
|
55 |
|
|
56 | 34 |
if ($scope.historyUrl.q !== $scope.historyUrl.q || $scope.historyUrl.isDirection != params.isDirection) { |
57 | 35 |
$rootScope.$emit('setSearchFromUrl', null); |
58 | 36 |
} |
... | ... | |
66 | 44 |
} else if (params.deviceId && ($scope.historyUrl.deviceId !== params.deviceId || $scope.historyUrl.direction !== params.direction)) { |
67 | 45 |
$rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction}); |
68 | 46 |
$rootScope.$emit('activeMarker', {id: params.deviceId}); |
69 |
}else if(!params.deviceId && $scope.historyUrl.deviceId){
|
|
47 |
} else if (!params.deviceId && $scope.historyUrl.deviceId) {
|
|
70 | 48 |
$rootScope.selectDevice = null; |
71 | 49 |
$rootScope.$emit('setDefaultMap', null); |
72 | 50 |
} |
51 |
} else if (params.deviceId) { |
|
52 |
$rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction}); |
|
73 | 53 |
} |
74 | 54 |
|
75 | 55 |
$scope.historyUrl = $location.search(); |
... | ... | |
133 | 113 |
app.controller('searchController', function ($rootScope, $scope, $location, config, Device) { |
134 | 114 |
|
135 | 115 |
this.$onInit = function () { |
116 |
$scope.config = config; |
|
136 | 117 |
$scope.locations = []; |
137 | 118 |
$scope.showSearchLoading = false; |
138 | 119 |
|
... | ... | |
140 | 121 |
}; |
141 | 122 |
|
142 | 123 |
$scope.searchLocations = function () { |
124 |
let params = $location.search(); |
|
125 |
params.q = $scope.search.q; |
|
126 |
params.isDirection = $scope.search.isDirection ? 1 : null; |
|
127 |
$location.search(params); |
|
128 |
|
|
143 | 129 |
if (!$scope.search.q || $scope.search.q.length <= 1) { |
144 | 130 |
$scope.locations = []; |
145 | 131 |
return; |
... | ... | |
147 | 133 |
|
148 | 134 |
$scope.showSearchLoading = true; |
149 | 135 |
|
150 |
let params = $location.search(); |
|
151 |
params.q = $scope.search.q; |
|
152 |
params.isDirection = $scope.search.isDirection ? 1 : 0; |
|
153 |
$location.search(params); |
|
154 |
|
|
155 | 136 |
Device.query({ |
156 | 137 |
address: $scope.search.q, |
157 | 138 |
showDirection: $scope.search.isDirection ? 1 : 0 |
... | ... | |
167 | 148 |
|
168 | 149 |
$rootScope.$on('setSearchFromUrl', function (event, args) { |
169 | 150 |
let params = $location.search(); |
170 |
|
|
171 | 151 |
$scope.search = { |
172 | 152 |
q: params.q, |
173 | 153 |
isDirection: params.isDirection ? !!+params.isDirection : false |
... | ... | |
189 | 169 |
$rootScope.selectDevice = null; |
190 | 170 |
$scope.showInfoLoading = false; |
191 | 171 |
$scope.vehicles = []; |
192 |
$scope.typeVehicle = null; |
|
193 | 172 |
$scope.filterVehicles = []; |
194 | 173 |
|
195 | 174 |
Vehicle.query(null, function (data) { |
... | ... | |
211 | 190 |
fromDate: moment(params.fromDate, 'YYYY-MM-DD').isValid() ? moment(params.fromDate).toDate() : defaultRange.fromDate.toDate(), |
212 | 191 |
toDate: moment(params.toDate, 'YYYY-MM-DD').isValid() ? moment(params.toDate).toDate() : defaultRange.toDate.toDate(), |
213 | 192 |
fromTime: moment(params.fromTime, 'HH:mm').isValid() ? moment(params.fromTime, 'HH:mm').toDate() : defaultRange.fromTime.toDate(), |
214 |
toTime: moment(params.toTime, 'HH:mm').isValid() ? moment(params.toTime, 'HH:mm').toDate() : defaultRange.toTime.toDate() |
|
193 |
toTime: moment(params.toTime, 'HH:mm').isValid() ? moment(params.toTime, 'HH:mm').toDate() : defaultRange.toTime.toDate(), |
|
194 |
isTime: params.isTime == 0 ? false : defaultRange.isTime |
|
215 | 195 |
}; |
216 | 196 |
|
217 | 197 |
}); |
... | ... | |
226 | 206 |
|
227 | 207 |
let range = $scope.getRange(); |
228 | 208 |
|
209 |
// if (!$rootScope.selectDevice || args.id !== $rootScope.selectDevice.id) |
|
210 |
// $rootScope.selectDevice = {name: '...', street: '...', town: '...'}; |
|
211 |
|
|
212 |
|
|
229 | 213 |
Device.get({ |
214 |
period: range.isTime ? 'time-period' : 'day-period', |
|
230 | 215 |
id: args.id, |
231 | 216 |
direction: args.direction, |
232 | 217 |
dateFrom: range.fromDate.format('YYYY-MM-DD'), |
233 | 218 |
dateTo: range.toDate.format('YYYY-MM-DD'), |
234 |
timeFrom: range.fromTime.format('HH:mm'),
|
|
235 |
timeTo: range.toTime.format('HH:mm'),
|
|
219 |
timeFrom: range.isTime ? range.fromTime.format('HH:mm') : null,
|
|
220 |
timeTo: range.isTime ? range.toTime.format('HH:mm') : null,
|
|
236 | 221 |
}, function (data) { |
237 | 222 |
$rootScope.selectDevice = data; |
238 | 223 |
|
239 |
$scope.typeVehicle = null; |
|
240 | 224 |
$scope.renderGraphAverageSpeed(); |
241 | 225 |
$scope.renderGraphNumberVehicles(); |
242 | 226 |
|
... | ... | |
250 | 234 |
|
251 | 235 |
}); |
252 | 236 |
|
237 |
|
|
253 | 238 |
$scope.changeRange = function () { |
254 |
if ($scope.range.fromDate >= $scope.range.toDate || $scope.range.fromTime >= $scope.range.toTime) {
|
|
239 |
if ($scope.range.fromDate >= $scope.range.toDate || ($scope.range.isTime && $scope.range.fromTime >= $scope.range.toTime)) {
|
|
255 | 240 |
$rootScope.selectDevice.traffics = []; |
256 | 241 |
return; |
257 | 242 |
} |
... | ... | |
261 | 246 |
let params = $location.search(); |
262 | 247 |
params.fromDate = range.fromDate.format('YYYY-MM-DD'); |
263 | 248 |
params.toDate = range.toDate.format('YYYY-MM-DD'); |
264 |
params.fromTime = range.fromTime.format('HH:mm'); |
|
265 |
params.toTime = range.toTime.format('HH:mm'); |
|
249 |
params.fromTime = range.isTime ? range.fromTime.format('HH:mm') : null; |
|
250 |
params.toTime = range.isTime ? range.toTime.format('HH:mm') : null; |
|
251 |
params.isTime = range.isTime ? null : 0; |
|
266 | 252 |
$location.search(params); |
267 | 253 |
|
268 | 254 |
if ($rootScope.selectDevice) |
... | ... | |
279 | 265 |
fromDate: moment($scope.range.fromDate).isValid() ? moment($scope.range.fromDate) : defaultRange.fromDate, |
280 | 266 |
toDate: moment($scope.range.toDate).isValid() ? moment($scope.range.toDate) : defaultRange.toDate, |
281 | 267 |
fromTime: moment($scope.range.fromTime).isValid() ? moment($scope.range.fromTime) : defaultRange.fromTime, |
282 |
toTime: moment($scope.range.toTime).isValid() ? moment($scope.range.toTime) : defaultRange.toTime |
|
268 |
toTime: moment($scope.range.toTime).isValid() ? moment($scope.range.toTime) : defaultRange.toTime, |
|
269 |
isTime: $scope.range.isTime ? true : false |
|
283 | 270 |
}; |
284 | 271 |
}; |
285 | 272 |
|
... | ... | |
288 | 275 |
fromDate: moment().day(-30), |
289 | 276 |
toDate: moment().day(-1), |
290 | 277 |
fromTime: moment({hour: 7}), |
291 |
toTime: moment({hour: 16}) |
|
278 |
toTime: moment({hour: 16}), |
|
279 |
isTime: true |
|
292 | 280 |
}; |
293 | 281 |
}; |
294 | 282 |
|
295 |
|
|
296 | 283 |
$scope.renderGraphAverageSpeed = function () { |
297 | 284 |
|
298 | 285 |
let t = $rootScope.selectDevice.traffics.reduce(function (l, r) { |
299 |
let key = r.timeFrom;
|
|
286 |
let key = $scope.range.isTime ? r.timeFrom : r.date;
|
|
300 | 287 |
if (typeof l[key] === 'undefined') { |
301 | 288 |
l[key] = { |
302 | 289 |
numberVehicle: 0, |
... | ... | |
312 | 299 |
}, {}); |
313 | 300 |
|
314 | 301 |
let labels = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) { |
315 |
return d.timeFrom;
|
|
302 |
return $scope.range.isTime ? d.timeFrom : moment(d.date, 'YYYY-MM-DD').format('D.M.YYYY');
|
|
316 | 303 |
})); |
317 | 304 |
let data = Object.values(t).map(function (d) { |
318 | 305 |
return Math.round(d.speedSum / d.numberVehicle); |
319 | 306 |
}); |
320 | 307 |
|
321 |
|
|
322 | 308 |
let canvasGraphAverageSpeed = document.getElementById('graphAverageSpeed').getContext('2d'); |
323 | 309 |
|
324 | 310 |
if ($scope.graphAverageSpeed) |
... | ... | |
336 | 322 |
backgroundColor: 'rgba(0, 123, 255, 0.3)', |
337 | 323 |
borderColor: 'rgba(0, 123, 255,1)', |
338 | 324 |
cubicInterpolationMode: 'monotone', |
339 |
radius: 0
|
|
325 |
pointRadius: 0
|
|
340 | 326 |
}] |
341 | 327 |
}, |
342 | 328 |
options: { |
343 | 329 |
responsive: true, |
344 | 330 |
pointDot: false, |
331 |
legend: { |
|
332 |
display: false |
|
333 |
}, |
|
345 | 334 |
scales: { |
346 | 335 |
xAxes: [{ |
347 | 336 |
ticks: { |
... | ... | |
355 | 344 |
labelString: 'km/h' |
356 | 345 |
}, |
357 | 346 |
ticks: { |
358 |
beginAtZero: true |
|
347 |
beginAtZero: true, |
|
348 |
max: Math.max(Math.round((Math.max.apply(null, data) + 10) / 10) * 10, 70) |
|
359 | 349 |
} |
360 | 350 |
}] |
361 | 351 |
}, |
362 | 352 |
tooltips: { |
363 |
enabled: true,
|
|
364 |
mode: 'single',
|
|
353 |
mode: 'index',
|
|
354 |
intersect: false,
|
|
365 | 355 |
callbacks: { |
366 | 356 |
label: function (tooltipItems) { |
367 | 357 |
return tooltipItems.yLabel + ' km/h'; |
... | ... | |
380 | 370 |
|
381 | 371 |
|
382 | 372 |
let labels = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) { |
383 |
return d.timeFrom;
|
|
373 |
return $scope.range.isTime ? d.timeFrom : moment(d.date, 'YYYY-MM-DD').format('D.M.YYYY');
|
|
384 | 374 |
})); |
385 | 375 |
|
386 | 376 |
let useVehiclesIds = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) { |
... | ... | |
393 | 383 |
|
394 | 384 |
let datasets = []; |
395 | 385 |
for (let i = 0, vehicle; vehicle = $scope.filterVehicles[i]; i++) { |
396 |
if ($scope.typeVehicle == null || $scope.typeVehicle === vehicle.id) { |
|
397 |
let dataset = { |
|
398 |
label: vehicle.name, |
|
399 |
backgroundColor: color[vehicle.id].replace("#alpha", "0.3"), |
|
400 |
borderColor: color[vehicle.id].replace("#alpha", "1"), |
|
401 |
borderWidth: 2, |
|
402 |
data: [] |
|
403 |
}; |
|
404 |
|
|
405 |
let l = 0; |
|
406 |
for (let j = 0, traffic; traffic = $rootScope.selectDevice.traffics[j]; j++) { |
|
407 |
if (labels[l] !== traffic.timeFrom) { |
|
408 |
l++; |
|
409 |
if (dataset.data.length < l) { |
|
410 |
dataset.data.push(0); |
|
411 |
} |
|
412 |
} |
|
413 |
if (traffic.typeVehicleId === vehicle.id) { |
|
414 |
dataset.data.push(traffic.numberVehicleAverage); |
|
386 |
let dataset = { |
|
387 |
label: vehicle.name, |
|
388 |
backgroundColor: color[vehicle.id].replace("#alpha", "0.3"), |
|
389 |
borderColor: color[vehicle.id].replace("#alpha", "1"), |
|
390 |
borderWidth: 2, |
|
391 |
data: [] |
|
392 |
}; |
|
393 |
|
|
394 |
let l = 0; |
|
395 |
for (let j = 0, traffic; traffic = $rootScope.selectDevice.traffics[j]; j++) { |
|
396 |
if (($scope.range.isTime && labels[l] !== traffic.timeFrom) || (!$scope.range.isTime && labels[l] !== moment(traffic.date, 'YYYY-MM-DD').format('D.M.YYYY'))) { |
|
397 |
l++; |
|
398 |
if (dataset.data.length < l) { |
|
399 |
dataset.data.push(0); |
|
415 | 400 |
} |
416 | 401 |
} |
417 |
datasets.push(dataset); |
|
402 |
if (traffic.typeVehicleId === vehicle.id) { |
|
403 |
dataset.data.push($scope.range.isTime ? traffic.numberVehicleAverage : traffic.numberVehicle); |
|
404 |
} |
|
418 | 405 |
} |
406 |
datasets.push(dataset); |
|
419 | 407 |
} |
420 | 408 |
|
421 | 409 |
let canvasGraphNumberVehicles = document.getElementById('graphNumberVehicles').getContext('2d'); |
... | ... | |
430 | 418 |
datasets: datasets |
431 | 419 |
}, |
432 | 420 |
options: { |
433 |
tooltips: { |
|
434 |
mode: 'index', |
|
435 |
intersect: false |
|
436 |
}, |
|
437 | 421 |
responsive: true, |
422 |
onResize: function (chart, size) { |
|
423 |
chart.options.legend.display = size.height > 240; |
|
424 |
chart.update(); |
|
425 |
}, |
|
426 |
legend: { |
|
427 |
position: 'bottom', |
|
428 |
}, |
|
438 | 429 |
scales: { |
439 | 430 |
xAxes: [{ |
440 | 431 |
stacked: true, |
... | ... | |
450 | 441 |
}, |
451 | 442 |
stacked: true |
452 | 443 |
}] |
444 |
}, |
|
445 |
tooltips: { |
|
446 |
mode: 'index', |
|
447 |
intersect: false |
|
453 | 448 |
} |
454 | 449 |
} |
455 | 450 |
}); |
456 | 451 |
}; |
457 | 452 |
|
458 |
|
|
459 | 453 |
$scope.infoClose = function () { |
460 | 454 |
$rootScope.selectDevice = null; |
461 | 455 |
|
... | ... | |
472 | 466 |
app.controller('mapController', function ($rootScope, $scope, config, Device) { |
473 | 467 |
|
474 | 468 |
this.$onInit = function () { |
469 |
$scope.markers = []; |
|
475 | 470 |
|
476 |
$scope.map = new GMaps({ |
|
477 |
div: '#map', |
|
471 |
$scope.map = new google.maps.Map(document.getElementById('map'), { |
|
472 |
center: {lat: config.DEFAULT_POSITION.LAT, lng: config.DEFAULT_POSITION.LNG}, |
|
473 |
zoom: config.DEFAULT_ZOOM, |
|
474 |
minZoom: config.DEFAULT_ZOOM_MAX, |
|
478 | 475 |
zoomControl: true, |
479 | 476 |
mapTypeControl: false, |
480 | 477 |
scaleControl: false, |
481 | 478 |
streetViewControl: false, |
482 | 479 |
rotateControl: false, |
483 | 480 |
fullscreenControl: false, |
484 |
mapTypeId: 'roadmap', |
|
485 |
zoom: config.DEFAULT_ZOOM, |
|
486 |
lat: config.DEFAULT_POSITION.LAT, |
|
487 |
lng: config.DEFAULT_POSITION.LNG, |
|
488 |
// styles: [ |
|
489 |
// { |
|
490 |
// featureType: "poi", |
|
491 |
// elementType: "labels", |
|
492 |
// stylers: [{ visibility: "off" }] |
|
493 |
// } |
|
494 |
// ] |
|
481 |
mapTypeId: google.maps.MapTypeId.ROADMAP |
|
495 | 482 |
}); |
496 | 483 |
|
497 | 484 |
Device.query({showDirection: 0}, function (data) { |
... | ... | |
504 | 491 |
}); |
505 | 492 |
}; |
506 | 493 |
|
507 |
|
|
508 | 494 |
$scope.createMarker = function (lctn) { |
509 | 495 |
if (lctn.lat && lctn.lng) { |
510 |
$scope.map.addMarker({
|
|
511 |
lat: lctn.lat,
|
|
512 |
lng: lctn.lng,
|
|
496 |
let marker = new google.maps.Marker({
|
|
497 |
map: $scope.map,
|
|
498 |
position: {lat: lctn.lat, lng: lctn.lng},
|
|
513 | 499 |
title: lctn.name, |
514 |
click: function () { |
|
515 |
$rootScope.$emit('infoLocation', {id: lctn.id}); |
|
516 |
}, |
|
517 |
infoWindow: { |
|
500 |
infoWindow: new google.maps.InfoWindow({ |
|
518 | 501 |
content: '<h6 class="mb-1">' + lctn.name + '</h6>' |
519 | 502 |
+ '<address>' + lctn.street + ', ' + lctn.town + '</address>' |
520 |
}, |
|
503 |
}),
|
|
521 | 504 |
id: lctn.id |
522 | 505 |
}); |
506 |
|
|
507 |
marker.addListener('click', function () { |
|
508 |
$scope.closeInfoWindows(); |
|
509 |
marker.infoWindow.open($scope.map, marker); |
|
510 |
$rootScope.$emit('infoLocation', {id: lctn.id}); |
|
511 |
}); |
|
512 |
|
|
513 |
$scope.markers.push(marker); |
|
523 | 514 |
} |
524 | 515 |
}; |
525 | 516 |
|
526 | 517 |
$rootScope.$on('activeMarker', function (event, args) { |
527 | 518 |
let id = args.id; |
528 |
for (let i = 0, marker; marker = $scope.map.markers[i]; i++) {
|
|
519 |
for (let i = 0, marker; marker = $scope.markers[i]; i++) { |
|
529 | 520 |
if (marker.id && marker.id === id && marker.infoWindow) { |
530 |
$scope.map.setCenter(marker.position.lat(), marker.position.lng());
|
|
521 |
$scope.map.setCenter(marker.getPosition());
|
|
531 | 522 |
$scope.map.setZoom(12); |
532 |
$scope.map.hideInfoWindows(); |
|
533 | 523 |
marker.infoWindow.open($scope.map, marker); |
534 |
return; |
|
524 |
} else { |
|
525 |
marker.infoWindow.close(); |
|
535 | 526 |
} |
536 | 527 |
} |
537 | 528 |
}); |
538 | 529 |
|
539 | 530 |
$rootScope.$on('setDefaultMap', function (event, args) { |
540 |
$scope.map.setCenter(config.DEFAULT_POSITION.LAT, config.DEFAULT_POSITION.LNG);
|
|
531 |
$scope.map.setCenter({lat: config.DEFAULT_POSITION.LAT, lng: config.DEFAULT_POSITION.LNG});
|
|
541 | 532 |
$scope.map.setZoom(config.DEFAULT_ZOOM); |
542 |
$scope.map.hideInfoWindows();
|
|
533 |
$scope.closeInfoWindows();
|
|
543 | 534 |
}); |
535 |
|
|
536 |
$scope.closeInfoWindows = function () { |
|
537 |
for (let i = 0, marker; marker = $scope.markers[i]; i++) { |
|
538 |
marker.infoWindow.close(); |
|
539 |
} |
|
540 |
}; |
|
544 | 541 |
}); |
545 | 542 |
|
546 | 543 |
|
547 | 544 |
app.factory('Device', function ($resource, config) { |
548 |
return $resource(config.API_URL + '/devices/:id', {id: '@id'}, { |
|
545 |
return $resource(config.API_URL + '/devices/:id', {id: '@id', period: '@period'}, {
|
|
549 | 546 |
'get': { |
550 |
url: config.API_URL + '/devices/:id/time-period',
|
|
547 |
url: config.API_URL + '/devices/:id/:period',
|
|
551 | 548 |
method: 'GET', |
552 | 549 |
headers: { |
553 | 550 |
'Content-Type': 'application/json', |
frontend/assets/css/main.css | ||
---|---|---|
1 |
* { |
|
2 |
padding: 0; |
|
3 |
margin: 0; |
|
4 |
} |
|
5 |
|
|
6 |
html, body { |
|
7 |
min-height: 100% !important; |
|
8 |
width: 100%; |
|
9 |
height: 100%; |
|
10 |
padding: 0; |
|
11 |
margin: 0; |
|
12 |
} |
|
13 |
|
|
14 |
#search { |
|
15 |
min-height: 100%; |
|
16 |
background: #CFD8DC; |
|
17 |
box-shadow: 0px 0px 10px 0px rgba(50, 50, 50, 0.75); |
|
18 |
z-index: 20; |
|
19 |
overflow: auto; |
|
20 |
} |
|
21 |
|
|
22 |
#search header h1 { |
|
23 |
line-height: 1rem; |
|
24 |
font-size: 1rem; |
|
25 |
font-weight: bold; |
|
26 |
} |
|
27 |
|
|
28 |
.searchWrapper { |
|
29 |
min-height: calc(100% - 40px); |
|
30 |
float: left; |
|
31 |
} |
|
32 |
|
|
33 |
#info { |
|
34 |
min-height: 100%; |
|
35 |
box-shadow: 0px 0px 10px 0px rgba(50, 50, 50, 0.75); |
|
36 |
z-index: 10; |
|
37 |
overflow: auto; |
|
38 |
} |
|
39 |
|
|
40 |
#info header address { |
|
41 |
margin: 0; |
|
42 |
} |
|
43 |
|
|
44 |
#map { |
|
45 |
padding: 0; |
|
46 |
margin: 0; |
|
47 |
overflow: hidden; |
|
48 |
min-height: 100%; |
|
49 |
} |
|
50 |
|
|
51 |
/* LOADING */ |
|
52 |
.loading { |
|
53 |
border: 6px solid white; /* Light grey */ |
|
54 |
border-top: 6px solid #007bff; /* Blue */ |
|
55 |
border-radius: 50%; |
|
56 |
width: 50px; |
|
57 |
height: 50px; |
|
58 |
animation: spin 2s linear infinite; |
|
59 |
margin: 0 auto; |
|
60 |
} |
|
61 |
|
|
62 |
@keyframes spin { |
|
63 |
0% { |
|
64 |
transform: rotate(0deg); |
|
65 |
} |
|
66 |
100% { |
|
67 |
transform: rotate(360deg); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
#loadingScreen { |
|
72 |
width: 100%; |
|
73 |
height: 100%; |
|
74 |
z-index: 1000; |
|
75 |
position: fixed; |
|
76 |
top: 0; |
|
77 |
left: 0; |
|
78 |
right: 0; |
|
79 |
bottom: 0; |
|
80 |
background-color: #CFD8DC; |
|
81 |
} |
|
82 |
|
|
83 |
#loadingScreen .loading { |
|
84 |
border: 12px solid white; |
|
85 |
border-top: 12px solid #007bff; |
|
86 |
border-radius: 50%; |
|
87 |
width: 100px; |
|
88 |
height: 100px; |
|
89 |
animation: spin 2s linear infinite; |
|
90 |
margin: auto auto; |
|
91 |
position: fixed; |
|
92 |
top: 0; |
|
93 |
bottom: 0; |
|
94 |
left: 0; |
|
95 |
right: 0; |
|
96 |
} |
|
97 |
|
|
98 |
#loadingScreen #logo { |
|
99 |
width: 100%; |
|
100 |
height: 50px; |
|
101 |
position: fixed; |
|
102 |
top: -160px; |
|
103 |
bottom: 0; |
|
104 |
left: 0; |
|
105 |
right: 0; |
|
106 |
margin: auto 0; |
|
107 |
text-align: center; |
|
108 |
font-size: 1.4rem; |
|
109 |
} |
|
110 |
|
|
111 |
#loadingScreen #noscript { |
|
112 |
width: 100%; |
|
113 |
height: 110px; |
|
114 |
position: fixed; |
|
115 |
top: 0; |
|
116 |
bottom: 0; |
|
117 |
left: 0; |
|
118 |
right: 0; |
|
119 |
margin: auto 0; |
|
120 |
text-align: center; |
|
121 |
font-size: 1rem; |
|
122 |
background-color: #CFD8DC; |
|
123 |
} |
|
124 |
|
|
125 |
/*GRAPH */ |
|
126 |
#graphAverageSpeed, #graphAverageSpeed{ |
|
127 |
width: 100% !important; |
|
128 |
max-height: 575px !important; |
|
129 |
|
|
130 |
} |
|
131 |
|
|
132 |
/*SCROLLBAR*/ |
|
133 |
|
|
134 |
::-webkit-scrollbar-track { |
|
135 |
background-color: whitesmoke; |
|
136 |
} |
|
137 |
|
|
138 |
::-webkit-scrollbar { |
|
139 |
width: 8px; |
|
140 |
background-color: whitesmoke; |
|
141 |
} |
|
142 |
|
|
143 |
::-webkit-scrollbar-thumb { |
|
144 |
background-color: rgba(0, 123, 255, 0.75); |
|
145 |
} |
|
146 |
|
|
147 |
/*BOOTSTRAP*/ |
|
148 |
.custom-checkbox .custom-control-label::before { |
|
149 |
background-color: white; |
|
150 |
} |
frontend/assets/css/styles.min.css | ||
---|---|---|
1 |
*{margin:0;padding:0}html,body{width:100%;height:100%;min-height:100% !important;margin:0;padding:0}#search{z-index:20;float:left;min-height:100%;max-height:100%;overflow:auto;background-color:#cfd8dc;box-shadow:0 0 10px 0 rgba(50,50,50,0.75)}#search header h1{font-weight:bold;font-size:1rem;line-height:1rem}#search footer{float:left}.searchWrapper{float:left;min-height:calc(100% - 40px)}.searchWrapper .custom-control-label::before{background-color:white}#info{z-index:10;min-height:100%;max-height:100%;overflow:auto;box-shadow:0 0 10px 0 rgba(50,50,50,0.75)}#info header address{margin:0}@media (max-width: 991.98px){#info,#search{height:auto;min-height:auto;max-height:none;overflow:hidden;box-shadow:none}}#map{min-height:100%;max-height:100%;margin:0;padding:0;overflow:hidden}.loading{width:50px;height:50px;margin:0 auto;border:6px solid #fff;border-top:6px solid #007bff;border-radius:50%;animation:spin 2s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}#loadingScreen{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;width:100%;height:100%;background-color:#cfd8dc}#loadingScreen .loading{position:fixed;top:0;right:0;bottom:0;left:0;width:100px;height:100px;margin:auto auto;border:12px solid #fff;border-top:12px solid #007bff;border-radius:50%;animation:spin 2s linear infinite}#loadingScreen #logo{position:fixed;top:-160px;right:0;bottom:0;left:0;width:100%;height:50px;margin:auto 0;font-size:1.4rem;text-align:center}#loadingScreen #noscript{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:110px;margin:auto 0;font-size:1rem;text-align:center;background-color:#cfd8dc}#graphAverageSpeed,#graphNumberVehicles{width:100%;background-color:white}::-webkit-scrollbar-track{background-color:#f5f5f5}::-webkit-scrollbar{width:8px;background-color:#f5f5f5}::-webkit-scrollbar-thumb{background-color:rgba(0,123,255,0.75)} |
|
2 |
|
|
3 |
/*# sourceMappingURL=styles.min.css.map */ |
frontend/assets/css/styles.min.css.map | ||
---|---|---|
1 |
{"version":3,"file":"styles.min.css","sources":["styles.scss","_variables.scss"],"sourcesContent":["@import './variables';\r\n\r\n* {\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\nhtml,\r\nbody {\r\n width: 100%;\r\n height: 100%;\r\n min-height: 100% !important;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n#search {\r\n z-index: 20;\r\n float: left;\r\n min-height: 100%;\r\n max-height: 100%;\r\n overflow: auto;\r\n background-color: $primary-background-color;\r\n box-shadow: 0 0 10px 0 rgba(50, 50, 50, 0.75);\r\n\r\n header h1 {\r\n font-weight: bold;\r\n font-size: 1rem;\r\n line-height: 1rem;\r\n }\r\n\r\n footer {\r\n float: left;\r\n }\r\n}\r\n\r\n.searchWrapper {\r\n float: left;\r\n min-height: calc(100% - 40px);\r\n\r\n .custom-control-label::before {\r\n background-color: white;\r\n }\r\n}\r\n\r\n#info {\r\n z-index: 10;\r\n min-height: 100%;\r\n max-height: 100%;\r\n overflow: auto;\r\n box-shadow: 0 0 10px 0 rgba(50, 50, 50, 0.75);\r\n\r\n header address {\r\n margin: 0;\r\n }\r\n}\r\n\r\n@media (max-width: 991.98px) {\r\n #info,\r\n #search {\r\n height: auto;\r\n min-height: auto;\r\n max-height: none;\r\n overflow: hidden;\r\n box-shadow: none;\r\n }\r\n}\r\n\r\n#map {\r\n min-height: 100%;\r\n max-height: 100%;\r\n margin: 0;\r\n padding: 0;\r\n overflow: hidden;\r\n}\r\n\r\n/* LOADING */\r\n.loading {\r\n width: 50px;\r\n height: 50px;\r\n margin: 0 auto;\r\n border: 6px solid $loading-second-color;\r\n border-top: 6px solid $loading-first-color;\r\n border-radius: 50%;\r\n animation: spin 2s linear infinite;\r\n}\r\n\r\n@keyframes spin {\r\n 0% {\r\n transform: rotate(0deg);\r\n }\r\n\r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n\r\n#loadingScreen {\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n z-index: 1000;\r\n width: 100%;\r\n height: 100%;\r\n background-color: $primary-background-color;\r\n\r\n .loading {\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n width: 100px;\r\n height: 100px;\r\n margin: auto auto;\r\n border: 12px solid $loading-second-color;\r\n border-top: 12px solid $loading-first-color;\r\n border-radius: 50%;\r\n animation: spin 2s linear infinite;\r\n }\r\n\r\n #logo {\r\n position: fixed;\r\n top: -160px;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 50px;\r\n margin: auto 0;\r\n font-size: 1.4rem;\r\n text-align: center;\r\n }\r\n\r\n #noscript {\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 110px;\r\n margin: auto 0;\r\n font-size: 1rem;\r\n text-align: center;\r\n background-color: $primary-background-color;\r\n }\r\n}\r\n\r\n/* GRAPH */\r\n\r\n#graphAverageSpeed,\r\n#graphNumberVehicles {\r\n width: 100%;\r\n background-color: white;\r\n}\r\n\r\n/* SCROLLBAR */\r\n\r\n::-webkit-scrollbar-track {\r\n background-color: $scrollbar-background-color;\r\n}\r\n\r\n::-webkit-scrollbar {\r\n width: 8px;\r\n background-color: $scrollbar-background-color;\r\n}\r\n\r\n::-webkit-scrollbar-thumb {\r\n background-color: rgba($scrollbar-color, 0.75);\r\n}\r\n\r\n","$primary-background-color: #cfd8dc;\r\n\r\n$loading-first-color: #007bff;\r\n$loading-second-color: white;\r\n\r\n$scrollbar-background-color: whitesmoke;\r\n$scrollbar-color: #007bff;\r\n"],"names":[],"mappings":"AAEA,AAAA,CAAC,AAAC,CACA,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACX,AAED,AAAA,IAAI,CACJ,IAAI,AAAC,CACH,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,UAAU,CAAE,eAAe,CAC3B,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACX,AAED,AAAA,OAAO,AAAC,CACN,OAAO,CAAE,EAAE,CACX,KAAK,CAAE,IAAI,CACX,UAAU,CAAE,IAAI,CAChB,UAAU,CAAE,IAAI,CAChB,QAAQ,CAAE,IAAI,CACd,gBAAgB,CCtBS,OAAO,CDuBhC,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAsB,CAW9C,AAlBD,AASE,OATK,CASL,MAAM,CAAC,EAAE,AAAC,CACR,WAAW,CAAE,IAAI,CACjB,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CAClB,AAbH,AAeE,OAfK,CAeL,MAAM,AAAC,CACL,KAAK,CAAE,IAAI,CACZ,AAGH,AAAA,cAAc,AAAC,CACb,KAAK,CAAE,IAAI,CACX,UAAU,CAAE,iBAAiB,CAK9B,AAPD,AAIE,cAJY,CAIZ,qBAAqB,AAAA,QAAQ,AAAC,CAC5B,gBAAgB,CAAE,KAAK,CACxB,AAGH,AAAA,KAAK,AAAC,CACJ,OAAO,CAAE,EAAE,CACX,UAAU,CAAE,IAAI,CAChB,UAAU,CAAE,IAAI,CAChB,QAAQ,CAAE,IAAI,CACd,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAsB,CAK9C,AAVD,AAOE,KAPG,CAOH,MAAM,CAAC,OAAO,AAAC,CACb,MAAM,CAAE,CAAC,CACV,AAGH,MAAM,EAAE,SAAS,EAAE,QAAQ,EACzB,AAAA,KAAK,CACL,OAAO,AAAC,CACN,MAAM,CAAE,IAAI,CACZ,UAAU,CAAE,IAAI,CAChB,UAAU,CAAE,IAAI,CAChB,QAAQ,CAAE,MAAM,CAChB,UAAU,CAAE,IAAI,CACjB,CAGH,AAAA,IAAI,AAAC,CACH,UAAU,CAAE,IAAI,CAChB,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACV,QAAQ,CAAE,MAAM,CACjB,AAGD,AAAA,QAAQ,AAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,MAAM,CAAE,MAAM,CACd,MAAM,CAAE,GAAG,CAAC,KAAK,CC9EI,IAAK,CD+E1B,UAAU,CAAE,GAAG,CAAC,KAAK,CChFD,OAAO,CDiF3B,aAAa,CAAE,GAAG,CAClB,SAAS,CAAE,uBAAuB,CACnC,AAED,UAAU,CAAV,IAAU,CACR,EAAE,CACA,SAAS,CAAE,YAAY,CAGzB,IAAI,CACF,SAAS,CAAE,cAAc,EAI7B,AAAA,cAAc,AAAC,CACb,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,CAAC,CACN,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,CAAC,CACT,IAAI,CAAE,CAAC,CACP,OAAO,CAAE,IAAI,CACb,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,gBAAgB,CC1GS,OAAO,CDqJjC,AApDD,AAWE,cAXY,CAWZ,QAAQ,AAAC,CACP,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,CAAC,CACN,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,CAAC,CACT,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,KAAK,CACZ,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,SAAS,CACjB,MAAM,CAAE,IAAI,CAAC,KAAK,CClHC,IAAK,CDmHxB,UAAU,CAAE,IAAI,CAAC,KAAK,CCpHJ,OAAO,CDqHzB,aAAa,CAAE,GAAG,CAClB,SAAS,CAAE,uBAAuB,CACnC,AAxBH,AA0BE,cA1BY,CA0BZ,KAAK,AAAC,CACJ,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,MAAM,CACX,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,CAAC,CACT,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,MAAM,CAAE,MAAM,CACd,SAAS,CAAE,MAAM,CACjB,UAAU,CAAE,MAAM,CACnB,AArCH,AAuCE,cAvCY,CAuCZ,SAAS,AAAC,CACR,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,CAAC,CACN,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,CAAC,CACT,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,MAAM,CACd,SAAS,CAAE,IAAI,CACf,UAAU,CAAE,MAAM,CAClB,gBAAgB,CCnJO,OAAO,CDoJ/B,AAKH,AAAA,kBAAkB,CAClB,oBAAoB,AAAC,CACnB,KAAK,CAAE,IAAI,CACX,gBAAgB,CAAE,KAAK,CACxB,AAID,AAAA,yBAAyB,AAAC,CACxB,gBAAgB,CC7JW,OAAU,CD8JtC,AAED,AAAA,mBAAmB,AAAC,CAClB,KAAK,CAAE,GAAG,CACV,gBAAgB,CClKW,OAAU,CDmKtC,AAED,AAAA,yBAAyB,AAAC,CACxB,gBAAgB,CCrKA,oBAAO,CDsKxB"} |
frontend/assets/libs/gmaps.min.js | ||
---|---|---|
1 |
"use strict";!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(["jquery","googlemaps!"],b):a.GMaps=b()}(this,function(){var a=function(a,b){var c;if(a===b)return a;for(c in b)void 0!==b[c]&&(a[c]=b[c]);return a},b=function(a,b){var c,d=Array.prototype.slice.call(arguments,2),e=[],f=a.length;if(Array.prototype.map&&a.map===Array.prototype.map)e=Array.prototype.map.call(a,function(a){var c=d.slice(0);return c.splice(0,0,a),b.apply(this,c)});else for(c=0;c<f;c++)callback_params=d,callback_params.splice(0,0,a[c]),e.push(b.apply(this,callback_params));return e},c=function(a){var b,c=[];for(b=0;b<a.length;b++)c=c.concat(a[b]);return c},d=function(a,b){var c=a[0],d=a[1];return b&&(c=a[1],d=a[0]),new google.maps.LatLng(c,d)},f=function(a,b){var c;for(c=0;c<a.length;c++)a[c]instanceof google.maps.LatLng||(a[c].length>0&&"object"==typeof a[c][0]?a[c]=f(a[c],b):a[c]=d(a[c],b));return a},g=function(a,b){var c=a.replace(".","");return"jQuery"in this&&b?$("."+c,b)[0]:document.getElementsByClassName(c)[0]},h=function(a,b){var a=a.replace("#","");return"jQuery"in window&&b?$("#"+a,b)[0]:document.getElementById(a)},i=function(a){var b=0,c=0;if(a.getBoundingClientRect){var d=a.getBoundingClientRect(),e=-(window.scrollX?window.scrollX:window.pageXOffset),f=-(window.scrollY?window.scrollY:window.pageYOffset);return[d.left-e,d.top-f]}if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return[b,c]},j=function(b){var c=document,d=function(b){if("object"!=typeof window.google||!window.google.maps)return"object"==typeof window.console&&window.console.error&&console.error("Google Maps API is required. Please register the following JavaScript library https://maps.googleapis.com/maps/api/js."),function(){};if(!this)return new d(b);b.zoom=b.zoom||15,b.mapType=b.mapType||"roadmap";var e,f=function(a,b){return void 0===a?b:a},j=this,k=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],l=["mousemove","mouseout","mouseover"],m=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],n=b.el||b.div,o=b.markerClusterer,p=google.maps.MapTypeId[b.mapType.toUpperCase()],q=new google.maps.LatLng(b.lat,b.lng),r=f(b.zoomControl,!0),s=b.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},t=s.style||"DEFAULT",u=s.position||"TOP_LEFT",v=f(b.panControl,!0),w=f(b.mapTypeControl,!0),x=f(b.scaleControl,!0),y=f(b.streetViewControl,!0),z=f(z,!0),A={},B={zoom:this.zoom,center:q,mapTypeId:p},C={panControl:v,zoomControl:r,zoomControlOptions:{style:google.maps.ZoomControlStyle[t],position:google.maps.ControlPosition[u]},mapTypeControl:w,scaleControl:x,streetViewControl:y,overviewMapControl:z};if("string"==typeof b.el||"string"==typeof b.div?n.indexOf("#")>-1?this.el=h(n,b.context):this.el=g.apply(this,[n,b.context]):this.el=n,void 0===this.el||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[j.el.id]={},this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=b.zoom,this.registered_events={},this.el.style.width=b.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=b.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=b.enableNewStyle,e=0;e<m.length;e++)delete b[m[e]];for(1!=b.disableDefaultUI&&(B=a(B,C)),A=a(B,b),e=0;e<k.length;e++)delete A[k[e]];for(e=0;e<l.length;e++)delete A[l[e]];this.map=new google.maps.Map(this.el,A),o&&(this.markerClusterer=o.apply(this,[this.map]));var D=function(a,b){var c="",d=window.context_menu[j.el.id][a];for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];c+='<li><a id="'+a+"_"+e+'" href="#">'+f.title+"</a></li>"}if(h("gmaps_context_menu")){var g=h("gmaps_context_menu");g.innerHTML=c;var e,k=g.getElementsByTagName("a"),l=k.length;for(e=0;e<l;e++){var m=k[e],n=function(c){c.preventDefault(),d[this.id.replace(a+"_","")].action.apply(j,[b]),j.hideContextMenu()};google.maps.event.clearListeners(m,"click"),google.maps.event.addDomListenerOnce(m,"click",n,!1)}var o=i.apply(this,[j.el]),p=o[0]+b.pixel.x-15,q=o[1]+b.pixel.y-15;g.style.left=p+"px",g.style.top=q+"px"}};this.buildContextMenu=function(a,b){if("marker"===a){b.pixel={};var c=new google.maps.OverlayView;c.setMap(j.map),c.draw=function(){var d=c.getProjection(),e=b.marker.getPosition();b.pixel=d.fromLatLngToContainerPixel(e),D(a,b)}}else D(a,b);var d=h("gmaps_context_menu");setTimeout(function(){d.style.display="block"},0)},this.setContextMenu=function(a){window.context_menu[j.el.id][a.control]={};var b,d=c.createElement("ul");for(b in a.options)if(a.options.hasOwnProperty(b)){var e=a.options[b];window.context_menu[j.el.id][a.control][e.name]={title:e.title,action:e.action}}d.id="gmaps_context_menu",d.style.display="none",d.style.position="absolute",d.style.minWidth="100px",d.style.background="white",d.style.listStyle="none",d.style.padding="8px",d.style.boxShadow="2px 2px 6px #ccc",h("gmaps_context_menu")||c.body.appendChild(d);var f=h("gmaps_context_menu");google.maps.event.addDomListener(f,"mouseout",function(a){a.relatedTarget&&this.contains(a.relatedTarget)||window.setTimeout(function(){f.style.display="none"},400)},!1)},this.hideContextMenu=function(){var a=h("gmaps_context_menu");a&&(a.style.display="none")};var E=function(a,c){google.maps.event.addListener(a,c,function(a){void 0==a&&(a=this),b[c].apply(this,[a]),j.hideContextMenu()})};google.maps.event.addListener(this.map,"zoom_changed",this.hideContextMenu);for(var F=0;F<k.length;F++){var G=k[F];G in b&&E(this.map,G)}for(var F=0;F<l.length;F++){var G=l[F];G in b&&E(this.map,G)}google.maps.event.addListener(this.map,"rightclick",function(a){b.rightclick&&b.rightclick.apply(this,[a]),void 0!=window.context_menu[j.el.id].map&&j.buildContextMenu("map",a)}),this.refresh=function(){google.maps.event.trigger(this.map,"resize")},this.fitZoom=function(){var a,b=[],c=this.markers.length;for(a=0;a<c;a++)"boolean"==typeof this.markers[a].visible&&this.markers[a].visible&&b.push(this.markers[a].getPosition());this.fitLatLngBounds(b)},this.fitLatLngBounds=function(a){var b,c=a.length,d=new google.maps.LatLngBounds;for(b=0;b<c;b++)d.extend(a[b]);this.map.fitBounds(d)},this.setCenter=function(a,b,c){this.map.panTo(new google.maps.LatLng(a,b)),c&&c()},this.getElement=function(){return this.el},this.zoomIn=function(a){a=a||1,this.zoom=this.map.getZoom()+a,this.map.setZoom(this.zoom)},this.zoomOut=function(a){a=a||1,this.zoom=this.map.getZoom()-a,this.map.setZoom(this.zoom)};var H,I=[];for(H in this.map)"function"!=typeof this.map[H]||this[H]||I.push(H);for(e=0;e<I.length;e++)!function(a,b,c){a[c]=function(){return b[c].apply(b,arguments)}}(this,this.map,I[e])};return d}(this);j.prototype.createControl=function(a){var b=document.createElement("div");b.style.cursor="pointer",a.disableDefaultStyles!==!0&&(b.style.fontFamily="Roboto, Arial, sans-serif",b.style.fontSize="11px",b.style.boxShadow="rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px");for(var c in a.style)b.style[c]=a.style[c];a.id&&(b.id=a.id),a.title&&(b.title=a.title),a.classes&&(b.className=a.classes),a.content&&("string"==typeof a.content?b.innerHTML=a.content:a.content instanceof HTMLElement&&b.appendChild(a.content)),a.position&&(b.position=google.maps.ControlPosition[a.position.toUpperCase()]);for(var d in a.events)!function(b,c){google.maps.event.addDomListener(b,c,function(){a.events[c].apply(this,[this])})}(b,d);return b.index=1,b},j.prototype.addControl=function(a){var b=this.createControl(a);return this.controls.push(b),this.map.controls[b.position].push(b),b},j.prototype.removeControl=function(a){var b,c=null;for(b=0;b<this.controls.length;b++)this.controls[b]==a&&(c=this.controls[b].position,this.controls.splice(b,1));if(c)for(b=0;b<this.map.controls.length;b++){var d=this.map.controls[a.position];if(d.getAt(b)==a){d.removeAt(b);break}}return a},j.prototype.createMarker=function(b){if(void 0==b.lat&&void 0==b.lng&&void 0==b.position)throw"No latitude or longitude defined.";var c=this,d=b.details,e=b.fences,f=b.outside,g={position:new google.maps.LatLng(b.lat,b.lng),map:null},h=a(g,b);delete h.lat,delete h.lng,delete h.fences,delete h.outside;var i=new google.maps.Marker(h);if(i.fences=e,b.infoWindow){i.infoWindow=new google.maps.InfoWindow(b.infoWindow);for(var j=["closeclick","content_changed","domready","position_changed","zindex_changed"],k=0;k<j.length;k++)!function(a,c){b.infoWindow[c]&&google.maps.event.addListener(a,c,function(a){b.infoWindow[c].apply(this,[a])})}(i.infoWindow,j[k])}for(var l=["animation_changed","clickable_changed","cursor_changed","draggable_changed","flat_changed","icon_changed","position_changed","shadow_changed","shape_changed","title_changed","visible_changed","zindex_changed"],m=["dblclick","drag","dragend","dragstart","mousedown","mouseout","mouseover","mouseup"],k=0;k<l.length;k++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(){b[c].apply(this,[this])})}(i,l[k]);for(var k=0;k<m.length;k++)!function(a,c,d){b[d]&&google.maps.event.addListener(c,d,function(c){c.pixel||(c.pixel=a.getProjection().fromLatLngToPoint(c.latLng)),b[d].apply(this,[c])})}(this.map,i,m[k]);return google.maps.event.addListener(i,"click",function(){this.details=d,b.click&&b.click.apply(this,[this]),i.infoWindow&&(c.hideInfoWindows(),i.infoWindow.open(c.map,i))}),google.maps.event.addListener(i,"rightclick",function(a){a.marker=this,b.rightclick&&b.rightclick.apply(this,[a]),void 0!=window.context_menu[c.el.id].marker&&c.buildContextMenu("marker",a)}),i.fences&&google.maps.event.addListener(i,"dragend",function(){c.checkMarkerGeofence(i,function(a,b){f(a,b)})}),i},j.prototype.addMarker=function(a){var b;if(a.hasOwnProperty("gm_accessors_"))b=a;else{if(!(a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")||a.position))throw"No latitude or longitude defined.";b=this.createMarker(a)}return b.setMap(this.map),this.markerClusterer&&this.markerClusterer.addMarker(b),this.markers.push(b),j.fire("marker_added",b,this),b},j.prototype.addMarkers=function(a){for(var b,c=0;b=a[c];c++)this.addMarker(b);return this.markers},j.prototype.hideInfoWindows=function(){for(var a,b=0;a=this.markers[b];b++)a.infoWindow&&a.infoWindow.close()},j.prototype.removeMarker=function(a){for(var b=0;b<this.markers.length;b++)if(this.markers[b]===a){this.markers[b].setMap(null),this.markers.splice(b,1),this.markerClusterer&&this.markerClusterer.removeMarker(a),j.fire("marker_removed",a,this);break}return a},j.prototype.removeMarkers=function(a){var b=[];if(void 0===a){for(var c=0;c<this.markers.length;c++){var d=this.markers[c];d.setMap(null),j.fire("marker_removed",d,this)}this.markerClusterer&&this.markerClusterer.clearMarkers&&this.markerClusterer.clearMarkers(),this.markers=b}else{for(var c=0;c<a.length;c++){var e=this.markers.indexOf(a[c]);if(e>-1){var d=this.markers[e];d.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(d),j.fire("marker_removed",d,this)}}for(var c=0;c<this.markers.length;c++){var d=this.markers[c];null!=d.getMap()&&b.push(d)}this.markers=b}},j.prototype.drawOverlay=function(a){var b=new google.maps.OverlayView,c=!0;return b.setMap(this.map),null!=a.auto_show&&(c=a.auto_show),b.onAdd=function(){var c=document.createElement("div");c.style.borderStyle="none",c.style.borderWidth="0px",c.style.position="absolute",c.style.zIndex=100,c.innerHTML=a.content,b.el=c,a.layer||(a.layer="overlayLayer");var d=this.getPanes(),e=d[a.layer],f=["contextmenu","DOMMouseScroll","dblclick","mousedown"];e.appendChild(c);for(var g=0;g<f.length;g++)!function(a,b){google.maps.event.addDomListener(a,b,function(a){navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all?(a.cancelBubble=!0,a.returnValue=!1):a.stopPropagation()})}(c,f[g]);a.click&&(d.overlayMouseTarget.appendChild(b.el),google.maps.event.addDomListener(b.el,"click",function(){a.click.apply(b,[b])})),google.maps.event.trigger(this,"ready")},b.draw=function(){var d=this.getProjection(),e=d.fromLatLngToDivPixel(new google.maps.LatLng(a.lat,a.lng));a.horizontalOffset=a.horizontalOffset||0,a.verticalOffset=a.verticalOffset||0;var f=b.el,g=f.children[0],h=g.clientHeight,i=g.clientWidth;switch(a.verticalAlign){case"top":f.style.top=e.y-h+a.verticalOffset+"px";break;default:case"middle":f.style.top=e.y-h/2+a.verticalOffset+"px";break;case"bottom":f.style.top=e.y+a.verticalOffset+"px"}switch(a.horizontalAlign){case"left":f.style.left=e.x-i+a.horizontalOffset+"px";break;default:case"center":f.style.left=e.x-i/2+a.horizontalOffset+"px";break;case"right":f.style.left=e.x+a.horizontalOffset+"px"}f.style.display=c?"block":"none",c||a.show.apply(this,[f])},b.onRemove=function(){var c=b.el;a.remove?a.remove.apply(this,[c]):(b.el.parentNode.removeChild(b.el),b.el=null)},this.overlays.push(b),b},j.prototype.removeOverlay=function(a){for(var b=0;b<this.overlays.length;b++)if(this.overlays[b]===a){this.overlays[b].setMap(null),this.overlays.splice(b,1);break}},j.prototype.removeOverlays=function(){for(var a,b=0;a=this.overlays[b];b++)a.setMap(null);this.overlays=[]},j.prototype.drawPolyline=function(a){var b=[],c=a.path;if(c.length)if(void 0===c[0][0])b=c;else for(var d,e=0;d=c[e];e++)b.push(new google.maps.LatLng(d[0],d[1]));var f={map:this.map,path:b,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight,geodesic:a.geodesic,clickable:!0,editable:!1,visible:!0};a.hasOwnProperty("clickable")&&(f.clickable=a.clickable),a.hasOwnProperty("editable")&&(f.editable=a.editable),a.hasOwnProperty("icons")&&(f.icons=a.icons),a.hasOwnProperty("zIndex")&&(f.zIndex=a.zIndex);for(var g=new google.maps.Polyline(f),h=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],i=0;i<h.length;i++)!function(b,c){a[c]&&google.maps.event.addListener(b,c,function(b){a[c].apply(this,[b])})}(g,h[i]);return this.polylines.push(g),j.fire("polyline_added",g,this),g},j.prototype.removePolyline=function(a){for(var b=0;b<this.polylines.length;b++)if(this.polylines[b]===a){this.polylines[b].setMap(null),this.polylines.splice(b,1),j.fire("polyline_removed",a,this);break}},j.prototype.removePolylines=function(){for(var a,b=0;a=this.polylines[b];b++)a.setMap(null);this.polylines=[]},j.prototype.drawCircle=function(b){b=a({map:this.map,center:new google.maps.LatLng(b.lat,b.lng)},b),delete b.lat,delete b.lng;for(var c=new google.maps.Circle(b),d=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],e=0;e<d.length;e++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(c,d[e]);return this.polygons.push(c),c},j.prototype.drawRectangle=function(b){b=a({map:this.map},b);var c=new google.maps.LatLngBounds(new google.maps.LatLng(b.bounds[0][0],b.bounds[0][1]),new google.maps.LatLng(b.bounds[1][0],b.bounds[1][1]));b.bounds=c;for(var d=new google.maps.Rectangle(b),e=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],f=0;f<e.length;f++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(d,e[f]);return this.polygons.push(d),d},j.prototype.drawPolygon=function(d){var e=!1;d.hasOwnProperty("useGeoJSON")&&(e=d.useGeoJSON),delete d.useGeoJSON,d=a({map:this.map},d),0==e&&(d.paths=[d.paths.slice(0)]),d.paths.length>0&&d.paths[0].length>0&&(d.paths=c(b(d.paths,f,e)));for(var g=new google.maps.Polygon(d),h=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],i=0;i<h.length;i++)!function(a,b){d[b]&&google.maps.event.addListener(a,b,function(a){d[b].apply(this,[a])})}(g,h[i]);return this.polygons.push(g),j.fire("polygon_added",g,this),g},j.prototype.removePolygon=function(a){for(var b=0;b<this.polygons.length;b++)if(this.polygons[b]===a){this.polygons[b].setMap(null),this.polygons.splice(b,1),j.fire("polygon_removed",a,this);break}},j.prototype.removePolygons=function(){for(var a,b=0;a=this.polygons[b];b++)a.setMap(null);this.polygons=[]},j.prototype.getFromFusionTables=function(a){var b=a.events;delete a.events;var c=a,d=new google.maps.FusionTablesLayer(c);for(var e in b)!function(a,c){google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(d,e);return this.layers.push(d),d},j.prototype.loadFromFusionTables=function(a){var b=this.getFromFusionTables(a);return b.setMap(this.map),b},j.prototype.getFromKML=function(a){var b=a.url,c=a.events;delete a.url,delete a.events;var d=a,e=new google.maps.KmlLayer(b,d);for(var f in c)!function(a,b){google.maps.event.addListener(a,b,function(a){c[b].apply(this,[a])})}(e,f);return this.layers.push(e),e},j.prototype.loadFromKML=function(a){var b=this.getFromKML(a);return b.setMap(this.map),b},j.prototype.addLayer=function(a,b){b=b||{};var c;switch(a){case"weather":this.singleLayers.weather=c=new google.maps.weather.WeatherLayer;break;case"clouds":this.singleLayers.clouds=c=new google.maps.weather.CloudLayer;break;case"traffic":this.singleLayers.traffic=c=new google.maps.TrafficLayer;break;case"transit":this.singleLayers.transit=c=new google.maps.TransitLayer;break;case"bicycling":this.singleLayers.bicycling=c=new google.maps.BicyclingLayer;break;case"panoramio":this.singleLayers.panoramio=c=new google.maps.panoramio.PanoramioLayer,c.setTag(b.filter),delete b.filter,b.click&&google.maps.event.addListener(c,"click",function(a){b.click(a),delete b.click});break;case"places":if(this.singleLayers.places=c=new google.maps.places.PlacesService(this.map),b.search||b.nearbySearch||b.radarSearch){var d={bounds:b.bounds||null,keyword:b.keyword||null,location:b.location||null,name:b.name||null,radius:b.radius||null,rankBy:b.rankBy||null,types:b.types||null};b.radarSearch&&c.radarSearch(d,b.radarSearch),b.search&&c.search(d,b.search),b.nearbySearch&&c.nearbySearch(d,b.nearbySearch)}if(b.textSearch){var e={bounds:b.bounds||null,location:b.location||null,query:b.query||null,radius:b.radius||null};c.textSearch(e,b.textSearch)}}if(void 0!==c)return"function"==typeof c.setOptions&&c.setOptions(b),"function"==typeof c.setMap&&c.setMap(this.map),c},j.prototype.removeLayer=function(a){if("string"==typeof a&&void 0!==this.singleLayers[a])this.singleLayers[a].setMap(null),delete this.singleLayers[a];else for(var b=0;b<this.layers.length;b++)if(this.layers[b]===a){this.layers[b].setMap(null),this.layers.splice(b,1);break}};var k,l;return j.prototype.getRoutes=function(b){switch(b.travelMode){case"bicycling":k=google.maps.TravelMode.BICYCLING;break;case"transit":k=google.maps.TravelMode.TRANSIT;break;case"driving":k=google.maps.TravelMode.DRIVING;break;default:k=google.maps.TravelMode.WALKING}l="imperial"===b.unitSystem?google.maps.UnitSystem.IMPERIAL:google.maps.UnitSystem.METRIC;var c={avoidHighways:!1,avoidTolls:!1,optimizeWaypoints:!1,waypoints:[]},d=a(c,b);d.origin=/string/.test(typeof b.origin)?b.origin:new google.maps.LatLng(b.origin[0],b.origin[1]),d.destination=/string/.test(typeof b.destination)?b.destination:new google.maps.LatLng(b.destination[0],b.destination[1]),d.travelMode=k,d.unitSystem=l,delete d.callback,delete d.error;var e=[];(new google.maps.DirectionsService).route(d,function(a,c){if(c===google.maps.DirectionsStatus.OK){for(var d in a.routes)a.routes.hasOwnProperty(d)&&e.push(a.routes[d]);b.callback&&b.callback(e,a,c)}else b.error&&b.error(a,c)})},j.prototype.removeRoutes=function(){this.routes.length=0},j.prototype.getElevations=function(d){d=a({locations:[],path:!1,samples:256},d),d.locations.length>0&&d.locations[0].length>0&&(d.locations=c(b([d.locations],f,!1)));var e=d.callback;delete d.callback;var g=new google.maps.ElevationService;if(d.path){var h={path:d.locations,samples:d.samples};g.getElevationAlongPath(h,function(a,b){e&&"function"==typeof e&&e(a,b)})}else delete d.path,delete d.samples,g.getElevationForLocations(d,function(a,b){e&&"function"==typeof e&&e(a,b)})},j.prototype.cleanRoute=j.prototype.removePolylines,j.prototype.renderRoute=function(b,c){var d,e="string"==typeof c.panel?document.getElementById(c.panel.replace("#","")):c.panel;c.panel=e,c=a({map:this.map},c),d=new google.maps.DirectionsRenderer(c),this.getRoutes({origin:b.origin,destination:b.destination,travelMode:b.travelMode,waypoints:b.waypoints,unitSystem:b.unitSystem,error:b.error,avoidHighways:b.avoidHighways,avoidTolls:b.avoidTolls,optimizeWaypoints:b.optimizeWaypoints,callback:function(a,b,c){c===google.maps.DirectionsStatus.OK&&d.setDirections(b)}})},j.prototype.drawRoute=function(a){var b=this;this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,unitSystem:a.unitSystem,error:a.error,avoidHighways:a.avoidHighways,avoidTolls:a.avoidTolls,optimizeWaypoints:a.optimizeWaypoints,callback:function(c){if(c.length>0){var d={path:c[c.length-1].overview_path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(d.icons=a.icons),b.drawPolyline(d),a.callback&&a.callback(c[c.length-1])}}})},j.prototype.travelRoute=function(a){if(a.origin&&a.destination)this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,unitSystem:a.unitSystem,error:a.error,callback:function(b){if(b.length>0&&a.start&&a.start(b[b.length-1]),b.length>0&&a.step){var c=b[b.length-1];if(c.legs.length>0)for(var d,e=c.legs[0].steps,f=0;d=e[f];f++)d.step_number=f,a.step(d,c.legs[0].steps.length-1)}b.length>0&&a.end&&a.end(b[b.length-1])}});else if(a.route&&a.route.legs.length>0)for(var b,c=a.route.legs[0].steps,d=0;b=c[d];d++)b.step_number=d,a.step(b)},j.prototype.drawSteppedRoute=function(a){var b=this;if(a.origin&&a.destination)this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,error:a.error,callback:function(c){if(c.length>0&&a.start&&a.start(c[c.length-1]),c.length>0&&a.step){var d=c[c.length-1];if(d.legs.length>0)for(var e,f=d.legs[0].steps,g=0;e=f[g];g++){e.step_number=g;var h={path:e.path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(h.icons=a.icons),b.drawPolyline(h),a.step(e,d.legs[0].steps.length-1)}}c.length>0&&a.end&&a.end(c[c.length-1])}});else if(a.route&&a.route.legs.length>0)for(var c,d=a.route.legs[0].steps,e=0;c=d[e];e++){c.step_number=e;var f={path:c.path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(f.icons=a.icons),b.drawPolyline(f),a.step(c)}},j.Route=function(a){this.origin=a.origin,this.destination=a.destination,this.waypoints=a.waypoints,this.map=a.map,this.route=a.route,this.step_count=0,this.steps=this.route.legs[0].steps,this.steps_length=this.steps.length;var b={path:new google.maps.MVCArray,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(b.icons=a.icons),this.polyline=this.map.drawPolyline(b).getPath()},j.Route.prototype.getRoute=function(a){var b=this;this.map.getRoutes({origin:this.origin,destination:this.destination,travelMode:a.travelMode,waypoints:this.waypoints||[],error:a.error,callback:function(){b.route=e[0],a.callback&&a.callback.call(b)}})},j.Route.prototype.back=function(){if(this.step_count>0){this.step_count--;var a=this.route.legs[0].steps[this.step_count].path;for(var b in a)a.hasOwnProperty(b)&&this.polyline.pop()}},j.Route.prototype.forward=function(){if(this.step_count<this.steps_length){var a=this.route.legs[0].steps[this.step_count].path;for(var b in a)a.hasOwnProperty(b)&&this.polyline.push(a[b]);this.step_count++}},j.prototype.checkGeofence=function(a,b,c){return c.containsLatLng(new google.maps.LatLng(a,b))},j.prototype.checkMarkerGeofence=function(a,b){if(a.fences)for(var c,d=0;c=a.fences[d];d++){var e=a.getPosition();this.checkGeofence(e.lat(),e.lng(),c)||b(a,c)}},j.prototype.toImage=function(a){var a=a||{},b={};if(b.size=a.size||[this.el.clientWidth,this.el.clientHeight],b.lat=this.getCenter().lat(),b.lng=this.getCenter().lng(),this.markers.length>0){b.markers=[];for(var c=0;c<this.markers.length;c++)b.markers.push({lat:this.markers[c].getPosition().lat(),lng:this.markers[c].getPosition().lng()})}if(this.polylines.length>0){var d=this.polylines[0];b.polyline={},b.polyline.path=google.maps.geometry.encoding.encodePath(d.getPath()),b.polyline.strokeColor=d.strokeColor,b.polyline.strokeOpacity=d.strokeOpacity,b.polyline.strokeWeight=d.strokeWeight}return j.staticMapURL(b)},j.staticMapURL=function(a){function b(a,b){if("#"===a[0]&&(a=a.replace("#","0x"),b)){if(b=parseFloat(b),0===(b=Math.min(1,Math.max(b,0))))return"0x00000000";b=(255*b).toString(16),1===b.length&&(b+=b),a=a.slice(0,8)+b}return a}var c,d=[],e=("file:"===location.protocol?"http:":location.protocol)+"//maps.googleapis.com/maps/api/staticmap";a.url&&(e=a.url,delete a.url),e+="?";var f=a.markers;delete a.markers,!f&&a.marker&&(f=[a.marker],delete a.marker);var g=a.styles;delete a.styles;var h=a.polyline;if(delete a.polyline,a.center)d.push("center="+a.center),delete a.center;else if(a.address)d.push("center="+a.address),delete a.address;else if(a.lat)d.push(["center=",a.lat,",",a.lng].join("")),delete a.lat,delete a.lng;else if(a.visible){var i=encodeURI(a.visible.join("|"));d.push("visible="+i)}var j=a.size;j?(j.join&&(j=j.join("x")),delete a.size):j="630x300",d.push("size="+j),a.zoom||a.zoom===!1||(a.zoom=15);var k=!a.hasOwnProperty("sensor")||!!a.sensor;delete a.sensor,d.push("sensor="+k);for(var l in a)a.hasOwnProperty(l)&&d.push(l+"="+a[l]);if(f)for(var m,n,o=0;c=f[o];o++){m=[],c.size&&"normal"!==c.size?(m.push("size:"+c.size),delete c.size):c.icon&&(m.push("icon:"+encodeURI(c.icon)),delete c.icon),c.color&&(m.push("color:"+c.color.replace("#","0x")),delete c.color),c.label&&(m.push("label:"+c.label[0].toUpperCase()),delete c.label),n=c.address?c.address:c.lat+","+c.lng,delete c.address,delete c.lat,delete c.lng;for(var l in c)c.hasOwnProperty(l)&&m.push(l+":"+c[l]);m.length||0===o?(m.push(n),m=m.join("|"),d.push("markers="+encodeURI(m))):(m=d.pop()+encodeURI("|"+n),d.push(m))}if(g)for(var o=0;o<g.length;o++){var p=[];g[o].featureType&&p.push("feature:"+g[o].featureType.toLowerCase()),g[o].elementType&&p.push("element:"+g[o].elementType.toLowerCase());for(var q=0;q<g[o].stylers.length;q++)for(var r in g[o].stylers[q]){var s=g[o].stylers[q][r];"hue"!=r&&"color"!=r||(s="0x"+s.substring(1)),p.push(r+":"+s)}var t=p.join("|");""!=t&&d.push("style="+t)}if(h){if(c=h,h=[],c.strokeWeight&&h.push("weight:"+parseInt(c.strokeWeight,10)),c.strokeColor){var u=b(c.strokeColor,c.strokeOpacity);h.push("color:"+u)}if(c.fillColor){var v=b(c.fillColor,c.fillOpacity);h.push("fillcolor:"+v)}var w=c.path;if(w.join)for(var x,q=0;x=w[q];q++)h.push(x.join(","));else h.push("enc:"+w);h=h.join("|"),d.push("path="+encodeURI(h))}var y=window.devicePixelRatio||1;return d.push("scale="+y),d=d.join("&"),e+d},j.prototype.addMapType=function(a,b){if(!b.hasOwnProperty("getTileUrl")||"function"!=typeof b.getTileUrl)throw"'getTileUrl' function required.";b.tileSize=b.tileSize||new google.maps.Size(256,256);var c=new google.maps.ImageMapType(b);this.map.mapTypes.set(a,c)},j.prototype.addOverlayMapType=function(a){if(!a.hasOwnProperty("getTile")||"function"!=typeof a.getTile)throw"'getTile' function required.";var b=a.index;delete a.index,this.map.overlayMapTypes.insertAt(b,a)},j.prototype.removeOverlayMapType=function(a){this.map.overlayMapTypes.removeAt(a)},j.prototype.addStyle=function(a){var b=new google.maps.StyledMapType(a.styles,{name:a.styledMapName});this.map.mapTypes.set(a.mapTypeId,b)},j.prototype.setStyle=function(a){this.map.setMapTypeId(a)},j.prototype.createPanorama=function(a){return a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")||(a.lat=this.getCenter().lat(),a.lng=this.getCenter().lng()),this.panorama=j.createPanorama(a),this.map.setStreetView(this.panorama),this.panorama},j.createPanorama=function(b){var c=h(b.el,b.context);b.position=new google.maps.LatLng(b.lat,b.lng),delete b.el,delete b.context,delete b.lat,delete b.lng;for(var d=["closeclick","links_changed","pano_changed","position_changed","pov_changed","resize","visible_changed"],e=a({visible:!0},b),f=0;f<d.length;f++)delete e[d[f]];for(var g=new google.maps.StreetViewPanorama(c,e),f=0;f<d.length;f++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(){b[c].apply(this)})}(g,d[f]);return g},j.prototype.on=function(a,b){return j.on(a,this,b)},j.prototype.off=function(a){j.off(a,this)},j.prototype.once=function(a,b){return j.once(a,this,b)},j.custom_events=["marker_added","marker_removed","polyline_added","polyline_removed","polygon_added","polygon_removed","geolocated","geolocation_failed"],j.on=function(a,b,c){if(j.custom_events.indexOf(a)==-1)return b instanceof j&&(b=b.map),google.maps.event.addListener(b,a,c);var d={handler:c,eventName:a};return b.registered_events[a]=b.registered_events[a]||[],b.registered_events[a].push(d),d},j.off=function(a,b){j.custom_events.indexOf(a)==-1?(b instanceof j&&(b=b.map),google.maps.event.clearListeners(b,a)):b.registered_events[a]=[]},j.once=function(a,b,c){if(j.custom_events.indexOf(a)==-1)return b instanceof j&&(b=b.map),google.maps.event.addListenerOnce(b,a,c)},j.fire=function(a,b,c){if(j.custom_events.indexOf(a)==-1)google.maps.event.trigger(b,a,Array.prototype.slice.apply(arguments).slice(2));else if(a in c.registered_events)for(var d=c.registered_events[a],e=0;e<d.length;e++)!function(a,b,c){a.apply(b,[c])}(d[e].handler,c,b)},j.geolocate=function(a){var b=a.always||a.complete;navigator.geolocation?navigator.geolocation.getCurrentPosition(function(c){a.success(c),b&&b()},function(c){a.error(c),b&&b()},a.options):(a.not_supported(),b&&b())},j.geocode=function(a){this.geocoder=new google.maps.Geocoder;var b=a.callback;a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")&&(a.latLng=new google.maps.LatLng(a.lat,a.lng)),delete a.lat,delete a.lng,delete a.callback,this.geocoder.geocode(a,function(a,c){b(a,c)})},"object"==typeof window.google&&window.google.maps&&(google.maps.Polygon.prototype.getBounds||(google.maps.Polygon.prototype.getBounds=function(a){for(var b,c=new google.maps.LatLngBounds,d=this.getPaths(),e=0;e<d.getLength();e++){b=d.getAt(e);for(var f=0;f<b.getLength();f++)c.extend(b.getAt(f))}return c}),google.maps.Polygon.prototype.containsLatLng||(google.maps.Polygon.prototype.containsLatLng=function(a){var b=this.getBounds();if(null!==b&&!b.contains(a))return!1;for(var c=!1,d=this.getPaths().getLength(),e=0;e<d;e++)for(var f=this.getPaths().getAt(e),g=f.getLength(),h=g-1,i=0;i<g;i++){var j=f.getAt(i),k=f.getAt(h);(j.lng()<a.lng()&&k.lng()>=a.lng()||k.lng()<a.lng()&&j.lng()>=a.lng())&&j.lat()+(a.lng()-j.lng())/(k.lng()-j.lng())*(k.lat()-j.lat())<a.lat()&&(c=!c),h=i}return c}),google.maps.Circle.prototype.containsLatLng||(google.maps.Circle.prototype.containsLatLng=function(a){return!google.maps.geometry||google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(),a)<=this.getRadius()}),google.maps.Rectangle.prototype.containsLatLng=function(a){return this.getBounds().contains(a)},google.maps.LatLngBounds.prototype.containsLatLng=function(a){return this.contains(a)},google.maps.Marker.prototype.setFences=function(a){this.fences=a},google.maps.Marker.prototype.addFence=function(a){this.fences.push(a)},google.maps.Marker.prototype.getId=function(){return this.__gm_id}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);e<c;e++)if(e in b&&b[e]===a)return e;return-1}),j}); |
|
2 |
//# sourceMappingURL=gmaps.min.js.map |
frontend/assets/sass/_variables.scss | ||
---|---|---|
1 |
$primary-background-color: #cfd8dc; |
|
2 |
|
|
3 |
$loading-first-color: #007bff; |
|
4 |
$loading-second-color: white; |
|
5 |
|
|
6 |
$scrollbar-background-color: whitesmoke; |
|
7 |
$scrollbar-color: #007bff; |
frontend/assets/sass/styles.scss | ||
---|---|---|
1 |
@import './variables'; |
|
2 |
|
|
3 |
* { |
|
4 |
margin: 0; |
|
5 |
padding: 0; |
|
6 |
} |
|
7 |
|
|
8 |
html, |
|
9 |
body { |
|
10 |
width: 100%; |
|
11 |
height: 100%; |
|
12 |
min-height: 100% !important; |
|
13 |
margin: 0; |
|
14 |
padding: 0; |
|
15 |
} |
|
16 |
|
|
17 |
#search { |
|
18 |
z-index: 20; |
|
19 |
float: left; |
|
20 |
min-height: 100%; |
|
21 |
max-height: 100%; |
|
22 |
overflow: auto; |
|
23 |
background-color: $primary-background-color; |
|
24 |
box-shadow: 0 0 10px 0 rgba(50, 50, 50, 0.75); |
|
25 |
|
|
26 |
header h1 { |
|
27 |
font-weight: bold; |
|
28 |
font-size: 1rem; |
|
29 |
line-height: 1rem; |
|
30 |
} |
|
31 |
|
|
32 |
footer { |
|
33 |
float: left; |
|
34 |
} |
|
35 |
} |
|
36 |
|
|
37 |
.searchWrapper { |
|
38 |
float: left; |
|
39 |
min-height: calc(100% - 40px); |
|
40 |
|
|
41 |
.custom-control-label::before { |
|
42 |
background-color: white; |
|
43 |
} |
|
44 |
} |
|
45 |
|
|
46 |
#info { |
|
47 |
z-index: 10; |
|
48 |
min-height: 100%; |
|
49 |
max-height: 100%; |
|
50 |
overflow: auto; |
|
51 |
box-shadow: 0 0 10px 0 rgba(50, 50, 50, 0.75); |
|
52 |
|
|
53 |
header address { |
|
54 |
margin: 0; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
@media (max-width: 991.98px) { |
|
59 |
#info, |
|
60 |
#search { |
|
61 |
height: auto; |
|
62 |
min-height: auto; |
|
63 |
max-height: none; |
|
64 |
overflow: hidden; |
|
65 |
box-shadow: none; |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
#map { |
|
70 |
min-height: 100%; |
|
71 |
max-height: 100%; |
|
72 |
margin: 0; |
|
73 |
padding: 0; |
|
74 |
overflow: hidden; |
|
75 |
} |
|
76 |
|
|
77 |
/* LOADING */ |
|
78 |
.loading { |
|
79 |
width: 50px; |
|
80 |
height: 50px; |
|
81 |
margin: 0 auto; |
|
82 |
border: 6px solid $loading-second-color; |
|
83 |
border-top: 6px solid $loading-first-color; |
|
84 |
border-radius: 50%; |
|
85 |
animation: spin 2s linear infinite; |
|
86 |
} |
|
87 |
|
|
88 |
@keyframes spin { |
|
89 |
0% { |
|
90 |
transform: rotate(0deg); |
|
91 |
} |
|
92 |
|
|
93 |
100% { |
|
94 |
transform: rotate(360deg); |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
#loadingScreen { |
|
99 |
position: fixed; |
|
100 |
top: 0; |
|
101 |
right: 0; |
|
102 |
bottom: 0; |
|
103 |
left: 0; |
|
104 |
z-index: 1000; |
|
105 |
width: 100%; |
|
106 |
height: 100%; |
|
107 |
background-color: $primary-background-color; |
|
108 |
|
|
109 |
.loading { |
|
110 |
position: fixed; |
|
111 |
top: 0; |
|
112 |
right: 0; |
|
113 |
bottom: 0; |
|
114 |
left: 0; |
|
115 |
width: 100px; |
|
116 |
height: 100px; |
|
117 |
margin: auto auto; |
|
118 |
border: 12px solid $loading-second-color; |
|
119 |
border-top: 12px solid $loading-first-color; |
|
120 |
border-radius: 50%; |
|
121 |
animation: spin 2s linear infinite; |
|
122 |
} |
|
123 |
|
|
124 |
#logo { |
|
125 |
position: fixed; |
|
126 |
top: -160px; |
|
127 |
right: 0; |
|
128 |
bottom: 0; |
|
129 |
left: 0; |
|
130 |
width: 100%; |
|
131 |
height: 50px; |
|
132 |
margin: auto 0; |
|
133 |
font-size: 1.4rem; |
|
134 |
text-align: center; |
|
135 |
} |
|
136 |
|
|
137 |
#noscript { |
|
138 |
position: fixed; |
|
139 |
top: 0; |
|
140 |
right: 0; |
|
141 |
bottom: 0; |
|
142 |
left: 0; |
|
143 |
width: 100%; |
|
144 |
height: 110px; |
|
145 |
margin: auto 0; |
|
146 |
font-size: 1rem; |
|
147 |
text-align: center; |
|
148 |
background-color: $primary-background-color; |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
/* GRAPH */ |
|
153 |
|
|
154 |
#graphAverageSpeed, |
|
155 |
#graphNumberVehicles { |
|
156 |
width: 100%; |
|
157 |
background-color: white; |
|
158 |
} |
|
159 |
|
|
160 |
/* SCROLLBAR */ |
|
161 |
|
|
162 |
::-webkit-scrollbar-track { |
|
163 |
background-color: $scrollbar-background-color; |
|
164 |
} |
|
165 |
|
|
166 |
::-webkit-scrollbar { |
|
167 |
width: 8px; |
|
168 |
background-color: $scrollbar-background-color; |
|
169 |
} |
|
170 |
|
|
171 |
::-webkit-scrollbar-thumb { |
|
172 |
background-color: rgba($scrollbar-color, 0.75); |
|
173 |
} |
|
174 |
|
frontend/gulpfile.js | ||
---|---|---|
1 |
var gulp = require('gulp'); |
|
2 |
var sass = require('gulp-sass'); |
|
3 |
var sourcemaps = require('gulp-sourcemaps'); |
|
4 |
var rename = require("gulp-rename"); |
|
5 |
|
|
6 |
gulp.task('sass', function () { |
|
7 |
return gulp.src('./assets/sass/**/*.scss') |
|
8 |
.pipe(sourcemaps.init()) |
|
9 |
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) |
|
10 |
.pipe(rename({ |
|
11 |
suffix: ".min" |
|
12 |
})) |
|
13 |
.pipe(sourcemaps.write('./')) |
|
14 |
.pipe(gulp.dest('./assets/css')); |
|
15 |
}); |
|
16 |
|
|
17 |
gulp.task('fix-sass', function fixCssTask() { |
|
18 |
const gulpStylelint = require('gulp-stylelint'); |
|
19 |
|
|
20 |
return gulp.src('./assets/sass/**/*.scss') |
|
21 |
.pipe(gulpStylelint({ |
|
22 |
fix: true |
|
23 |
})) |
|
24 |
.pipe(gulp.dest('./assets/sass/')); |
|
25 |
}); |
|
26 |
|
|
27 |
gulp.task('lint-sass', function lintCssTask() { |
|
28 |
const gulpStylelint = require('gulp-stylelint'); |
|
29 |
|
|
30 |
return gulp.src('./assets/sass/**/*.scss') |
|
31 |
.pipe(gulpStylelint({ |
|
32 |
reporters: [ |
|
33 |
{formatter: 'string', console: true} |
|
34 |
] |
|
35 |
})); |
|
36 |
}); |
|
37 |
|
|
38 |
gulp.task('styles', gulp.series('fix-sass', 'sass')); |
|
39 |
|
|
40 |
gulp.task('default', gulp.parallel('styles')); |
frontend/index.php | ||
---|---|---|
13 | 13 |
|
14 | 14 |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" |
15 | 15 |
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> |
16 |
<link rel="stylesheet" media="screen" href="./assets/css/main.css">
|
|
16 |
<link rel="stylesheet" media="screen" href="./assets/css/styles.min.css">
|
|
17 | 17 |
|
18 | 18 |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.10/angular.min.js"></script> |
19 | 19 |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.10/angular-route.min.js"></script> |
... | ... | |
21 | 21 |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.10/angular-sanitize.min.js"></script> |
22 | 22 |
|
23 | 23 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js"></script> |
24 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
|
|
24 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
|
|
25 | 25 |
|
26 | 26 |
|
27 | 27 |
<script> |
... | ... | |
55 | 55 |
<div class="row h-100" ng-init="load()"> |
56 | 56 |
|
57 | 57 |
<!--SEARCH section--> |
58 |
<section class="search col-12 col-sm-6 col-lg-3" id="search" ng-controller="searchController" |
|
59 |
ng-class="{ 'col-sm-12': $root.selectDevice==null, 'col-sm-6': $root.selectDevice!=null }"> |
|
58 |
<section class="search col-12 col-lg-3" id="search" ng-controller="searchController"> |
|
60 | 59 |
|
61 | 60 |
<div class="w-100 searchWrapper"> |
62 | 61 |
<header class="mt-2"> |
... | ... | |
76 | 75 |
ng-model-options="{debounce: 600}"> |
77 | 76 |
</div> |
78 | 77 |
<div class="custom-control custom-checkbox mb-3"> |
79 |
<input type="checkbox" id="searchDirection" name="searchDirection" class="custom-control-input"
|
|
78 |
<input type="checkbox" id="searchIsDirection" name="searchIsDirection" class="custom-control-input"
|
|
80 | 79 |
checked required |
81 | 80 |
ng-model="search.isDirection" |
82 | 81 |
ng-change="searchLocations()" |
83 | 82 |
ng-model-options="{debounce: 600}"> |
84 |
<label for="searchDirection" class="custom-control-label">Rozlišovat směr</label> |
|
83 |
<label for="searchIsDirection" class="custom-control-label">Rozlišovat směr</label>
|
|
85 | 84 |
</div> |
86 | 85 |
</form> |
87 | 86 |
|
... | ... | |
114 | 113 |
</div> |
115 | 114 |
</div> |
116 | 115 |
<footer class="text-center mb-2 mt-2 w-100"> |
117 |
<small class="text-muted">2018 © FAV, ZČU</small>
|
|
116 |
<small class="text-muted">© 2018 FAV, ZČU • version: {{ config.APP_VERSION }}</small>
|
|
118 | 117 |
</footer> |
119 | 118 |
</section> |
120 | 119 |
|
121 | 120 |
|
122 | 121 |
<!--INFO section--> |
123 |
<section class="info col-12 col-sm-6 col-lg-4" id="info" ng-show="$root.selectDevice!=null"
|
|
122 |
<section class="info col-12 col-lg-5" id="info" ng-show="$root.selectDevice!=null"
|
|
124 | 123 |
ng-controller="infoController"> |
125 | 124 |
|
126 | 125 |
<header class="mt-2"> |
... | ... | |
163 | 162 |
</div> |
164 | 163 |
</div> |
165 | 164 |
|
165 |
|
|
166 | 166 |
<div class="form-row"> |
167 | 167 |
<div class="form-group col"> |
168 |
<label for="rangehFromTime">Časové rozmezí dne</label> |
|
168 |
<label for="rangeFromTime"> |
|
169 |
<div class="custom-control custom-checkbox"> |
|
170 |
<input type="checkbox" id="rangeIsTime" name="rangeIsTime" class="custom-control-input" |
|
171 |
checked required |
|
172 |
ng-model="range.isTime" |
|
173 |
ng-model-options="{debounce: 300}" |
|
174 |
ng-change="changeRange()"> |
|
175 |
<label for="rangeIsTime" class="custom-control-label">Zobrazit časové rozmezí dne</label> |
|
176 |
</div> |
|
177 |
</label> |
|
169 | 178 |
<input type="time" id="rangeFromTime" class="form-control form-control-sm" |
170 | 179 |
ng-model="range.fromTime" required |
171 | 180 |
ng-class="{'is-invalid': range.fromTime>=range.toTime}" |
172 | 181 |
ng-change="changeRange()" |
173 |
ng-model-options="{debounce: 600}"> |
|
174 |
<div class="invalid-feedback"> |
|
182 |
ng-model-options="{debounce: 600}" |
|
183 |
ng-show="range.isTime"> |
|
184 |
<div class="invalid-feedback" ng-show="range.isTime"> |
|
175 | 185 |
Tento čas musí být menší. |
176 | 186 |
</div> |
177 | 187 |
</div> |
... | ... | |
182 | 192 |
ng-model="range.toTime" required |
183 | 193 |
ng-class="{'is-invalid': range.fromTime>=range.toTime}" |
184 | 194 |
ng-change="changeRange()" |
185 |
ng-model-options="{debounce: 600}"> |
|
186 |
<div class="invalid-feedback"> |
|
195 |
ng-model-options="{debounce: 600}" |
|
196 |
ng-show="range.isTime"> |
|
197 |
<div class="invalid-feedback" ng-show="range.isTime"> |
|
187 | 198 |
Tento čas musí být vetší. |
188 | 199 |
</div> |
189 | 200 |
</div> |
190 | 201 |
</div> |
191 | 202 |
</div> |
192 | 203 |
|
193 |
|
|
194 | 204 |
<div class="loading" ng-show="showInfoLoading"></div> |
195 | 205 |
|
196 | 206 |
<div id="graphs" ng-show="$root.selectDevice!=null && $root.selectDevice.traffics.length>0 && !showInfoLoading"> |
197 | 207 |
<h4 class="mt-4">Průměrná rychlost</h4> |
198 | 208 |
<canvas id="graphAverageSpeed"></canvas> |
199 | 209 |
|
200 |
|
|
201 | 210 |
<h4 class="mt-4">Počet vozidel</h4> |
202 |
<form> |
|
203 |
<div class="form-group"> |
|
204 |
<select id="typeVehicle" class="custom-select custom-select-sm" |
|
205 |
ng-model="typeVehicle" |
|
206 |
ng-change="renderGraphNumberVehicles()" |
|
207 |
ng-options="vehicle.id as vehicle.name for vehicle in filterVehicles"> |
|
208 |
<option value="">Všechna vozidla</option> |
|
209 |
</select> |
|
210 |
</div> |
|
211 |
</form> |
|
212 |
<canvas id="graphNumberVehicles"></canvas> |
|
211 |
<canvas id="graphNumberVehicles" class="mb-5"></canvas> |
|
213 | 212 |
|
213 |
<div class="text-center mb-2 mt-2 w-100"> |
|
214 |
<small class="text-muted">zdroj dat: <a target="_blank" href="https://doprava.plzensky-kraj.cz">doprava.plzensky-kraj.cz</a> |
|
215 |
</small> |
|
216 |
</div> |
|
214 | 217 |
</div> |
215 | 218 |
|
216 | 219 |
<div ng-show="$root.selectDevice && $root.selectDevice.traffics.length==0 && !showInfoLoading"> |
217 | 220 |
<small class="form-text text-muted text-center">Data nejsou k dispozici</small> |
218 | 221 |
</div> |
219 |
|
|
220 |
|
|
221 | 222 |
</section> |
222 | 223 |
|
223 |
|
|
224 | 224 |
<!--MAP section--> |
225 |
<section class="map col-12 col-sm-12 " id="map"
|
|
226 |
ng-class="{ 'col-lg-9': $root.selectDevice==null, 'col-lg-5': $root.selectDevice!=null }"
|
|
225 |
<section class="map col-12" id="map" |
|
226 |
ng-class="{ 'col-lg-9': $root.selectDevice==null, 'col-lg-4': $root.selectDevice!=null }"
|
|
227 | 227 |
ng-controller="mapController"> |
228 | 228 |
</section> |
229 | 229 |
</div> |
... | ... | |
257 | 257 |
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCSx7hyAzQiG5uocJTeZgf1Z3lpDy4kpEk" |
258 | 258 |
type="text/javascript"></script> |
259 | 259 |
|
260 |
<script type="text/javascript" src="./assets/libs/gmaps.min.js"></script> |
|
261 |
|
|
262 | 260 |
</body> |
263 | 261 |
</html> |
frontend/package.json | ||
---|---|---|
1 |
{ |
|
2 |
"name": "PVPK", |
|
3 |
"version": "1.2.0", |
|
4 |
"dependencies": { |
|
5 |
"gulp": "^4.0.0", |
|
6 |
"gulp-sass": "^4.0.1", |
|
7 |
"gulp-sourcemaps": "^2.6.4", |
|
8 |
"gulp-stylelint": "^7.0.0", |
|
9 |
"gulp-rename":"^1.2.3", |
|
10 |
"stylelint": "^9.2.1", |
|
11 |
"stylelint-order": "^0.8.1", |
|
12 |
"stylelint-config-rational-order": "^0.0.2", |
|
13 |
"stylelint-config-standard": "^18.2.0", |
|
14 |
"stylelint-config-recommended-scss": "^3.2.0" |
|
15 |
} |
|
16 |
} |
Také k dispozici: Unified diff
refs #7014: přidané grafy denní průměry, optimalizace API, styly převedeny do SASS, zvětšený prostor pro grafy