commit e142f6841cd8d48aeb3ebe5a1d5f0d8f4503f6db
Author: kohlicekjan <kohlicekjan@gmail.com>
Date:   Sun Oct 21 00:49:06 2018 +0200

    Closes #8 období nemusí být v rosahu min a max

diff --git a/frontend/app.js b/frontend/app.js
index f90ad70..fbfb22a 100644
--- a/frontend/app.js
+++ b/frontend/app.js
@@ -166,13 +166,6 @@ angular.module('pvpk')
                 return;
             }
 
-            if (!($scope.range.fromDate >= $scope.range.minDate && $scope.range.toDate <= $scope.range.maxDate
-                && $scope.range.toDate >= $scope.range.minDate && $scope.range.fromDate <= $scope.range.maxDate)) {
-                $rootScope.selectDevice.traffics = [];
-                return;
-            }
-
-
             var range = $scope.getRange();
 
             var params = $location.search();
diff --git a/frontend/app.min.js b/frontend/app.min.js
index f0a3c32..bb29be0 100644
--- a/frontend/app.min.js
+++ b/frontend/app.min.js
@@ -1,2 +1,2 @@
-angular.module("pvpk",["ngResource"]),angular.module("pvpk").constant("config",{APP_NAME:"PVPK",APP_VERSION:"1.3.3",API_URL:API_URL,API_TOKEN:API_TOKEN,DEFAULT_POSITION:{lat:49.53,lng:13.3},DEFAULT_ZOOM:10,DEFAULT_ZOOM_MIN:7,DEFAULT_RANGE_DATE_DAY:{from:-30,to:-1},DEFAULT_RANGE_TIME_HOUR:{from:7,to:16}}),angular.module("pvpk").factory("Device",["$resource","config",function(e,o){return e(o.API_URL+"/devices/:id",{id:"@id",period:"@period"},{get:{url:o.API_URL+"/devices/:id/:period",method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}},query:{url:o.API_URL+"/devices",method:"GET",isArray:!0,headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}}})}]),angular.module("pvpk").factory("Range",["$resource","config",function(e,o){return e(o.API_URL+"/range",null,{get:{url:o.API_URL+"/range",method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}}})}]),angular.module("pvpk").factory("Vehicle",["$resource","config",function(e,o){return e(o.API_URL+"/vehicles",null,{query:{url:o.API_URL+"/vehicles",method:"GET",isArray:!0,headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}}})}]),angular.module("pvpk").controller("infoController",["$rootScope","$scope","$location","config","Device","Vehicle","Range",function(u,g,i,a,r,e,n){this.$onInit=function(){u.selectDevice=null,g.showInfoLoading=!1,g.vehicles=[],g.urlExportCsv=null,g.directions=[{id:void 0,name:"po směru i proti směru"},{id:1,name:"po směru"},{id:2,name:"proti směru"}],g.isLoadRange=!1,e.query(null,function(e){g.vehicles=e},function(e){u.graphShow=!1,console.log("Error api all Vehicles"),u.handleErrorResponse(e)}),u.$emit("setRangeFromUrl",null)},u.$on("setRangeFromUrl",function(e,o){var t=i.search();g.range={fromDate:moment(t.fromDate,"YYYY-MM-DD").isValid()?moment(t.fromDate).toDate():moment().add(a.DEFAULT_RANGE_DATE_DAY.from,"d").toDate(),toDate:moment(t.toDate,"YYYY-MM-DD").isValid()?moment(t.toDate).toDate():moment().add(a.DEFAULT_RANGE_DATE_DAY.to,"d").toDate(),fromTime:moment(t.fromTime,"HH:mm").isValid()?moment(t.fromTime,"HH:mm").toDate():moment({hour:a.DEFAULT_RANGE_TIME_HOUR.from}).toDate(),toTime:moment(t.toTime,"HH:mm").isValid()?moment(t.toTime,"HH:mm").toDate():moment({hour:a.DEFAULT_RANGE_TIME_HOUR.to}).toDate(),isTime:0!=t.isTime,maxDate:null==g.range?null:g.range.maxDate,minDate:null==g.range?null:g.range.minDate},g.isLoadRange||n.get(null,function(e){g.range.fromDate=moment.max(moment(e.last_date).add(a.DEFAULT_RANGE_DATE_DAY.from,"d"),moment(e.first_date)).toDate(),g.range.toDate=moment.min(moment(g.range.toDate),moment(e.last_date)).toDate(),g.range.maxDate=moment(e.last_date).toDate(),g.range.minDate=moment(e.first_date).toDate(),g.isLoadRange=!0},function(e){console.log("Error api get Range"),u.handleErrorResponse(e)})}),u.$on("infoLocation",function(e,o){g.showInfoLoading=!0;var t=i.search();t.deviceId=o.id,t.direction=o.direction,i.search(t);var a=g.getRange(),n={period:a.isTime?"time-period":"day-period",id:o.id,direction:o.direction,dateFrom:a.fromDate.format("YYYY-MM-DD"),dateTo:a.toDate.format("YYYY-MM-DD"),timeFrom:a.isTime?a.fromTime.format("HH:mm"):null,timeTo:a.isTime?a.toTime.format("HH:mm"):null};r.get(n,function(e){u.selectDevice=e,g.renderGraph(),g.urlExportCsv=g.generateUrlExportCsv(n),g.showInfoLoading=!1},function(e){u.selectDevice=null,g.showInfoLoading=!1,console.log("Error api get Devices"),u.handleErrorResponse(e)})}),g.generateUrlExportCsv=function(e){var o="/devices/:id/:period/csv?".replace(":id",e.id).replace(":period",e.period);delete e.id,delete e.period;var t=jQuery.param(e);return a.API_URL+o+t},g.changeRange=function(){if(g.range.fromDate>=g.range.toDate||g.range.isTime&&g.range.fromTime>=g.range.toTime)u.selectDevice.traffics=[];else if(g.range.fromDate>=g.range.minDate&&g.range.toDate<=g.range.maxDate&&g.range.toDate>=g.range.minDate&&g.range.fromDate<=g.range.maxDate){var e=g.getRange(),o=i.search();o.fromDate=e.fromDate.format("YYYY-MM-DD"),o.toDate=e.toDate.format("YYYY-MM-DD"),o.fromTime=e.isTime?e.fromTime.format("HH:mm"):null,o.toTime=e.isTime?e.toTime.format("HH:mm"):null,o.isTime=e.isTime?null:0,i.search(o),u.selectDevice&&u.$emit("infoLocation",{id:u.selectDevice.id,direction:u.selectDevice.direction})}else u.selectDevice.traffics=[]},g.changeDirection=function(){u.$emit("infoLocation",{id:u.selectDevice.id,direction:u.selectDevice.direction})},g.getRange=function(){return{fromDate:moment(g.range.fromDate).isValid()?moment(g.range.fromDate):moment().add(a.DEFAULT_RANGE_DATE_DAY.from,"d"),toDate:moment(g.range.toDate).isValid()?moment(g.range.toDate):moment().add(a.DEFAULT_RANGE_DATE_DAY.to,"d"),fromTime:moment(g.range.fromTime).isValid()?moment(g.range.fromTime):moment({hour:a.DEFAULT_RANGE_TIME_HOUR.from}),toTime:moment(g.range.toTime).isValid()?moment(g.range.toTime):moment({hour:a.DEFAULT_RANGE_TIME_HOUR.to}),isTime:!!g.range.isTime}},g.renderGraph=function(){for(var e,o=["rgba(158, 158, 158, #alpha)","rgba(213, 0, 0, #alpha)","rgba(0, 123, 255, #alpha)","rgba(170, 0, 255, #alpha)","rgba(0, 200, 83, #alpha)","rgba(255, 214, 0, #alpha)","rgba(255, 109, 0, #alpha)","rgba(174, 234, 0, #alpha)","rgba(98, 0, 234, #alpha)","rgba(255, 171, 0, #alpha)","rgba(100, 221, 23, #alpha)","rgba(0, 184, 212, #alpha)"],t=jQuery.unique(u.selectDevice.traffics.map(function(e){return g.range.isTime?e.timeFrom:moment(e.date,"YYYY-MM-DD").format("D.M.YYYY")})),a=jQuery.unique(u.selectDevice.traffics.map(function(e){return e.typeVehicleId})),n=jQuery.grep(g.vehicles,function(e){return 0<=a.indexOf(e.id)}),i=[],r=[],l=0;e=n[l];l++){for(var c,s={label:e.name,backgroundColor:o[e.id].replace("#alpha","0.3"),borderColor:o[e.id].replace("#alpha","1"),borderWidth:2,data:[]},m={data:[],borderWidth:2,label:e.name,fill:!1,backgroundColor:o[e.id].replace("#alpha","0.3"),borderColor:o[e.id].replace("#alpha","1"),cubicInterpolationMode:"monotone",pointRadius:0},d=0,p=0;c=u.selectDevice.traffics[p];p++)(g.range.isTime&&t[d]!==c.timeFrom||!g.range.isTime&&t[d]!==moment(c.date,"YYYY-MM-DD").format("D.M.YYYY"))&&(d++,s.data.length<d&&(s.data.push(0),m.data.push(0))),c.typeVehicleId===e.id&&(s.data.push(g.range.isTime?c.numberVehicleAverage:c.numberVehicle),m.data.push(c.speedAverage<=0?0:c.speedAverage));i.push(s),r.push(m)}u.$emit("renderGraphNumberVehicles",{data:{labels:t,datasets:i}}),u.$emit("renderGraphAverageSpeed",{data:{labels:t,datasets:r}})},g.infoClose=function(){u.selectDevice=null;var e=i.search();e.deviceId=null,e.direction=null,i.search(e),u.$emit("setDefaultMap",null)}}]),angular.module("pvpk").controller("mainController",["$rootScope","$scope","$location","$window",function(n,i,r,e){this.$onInit=function(){i.showLoadingScreen=!0},e.onload=function(){var e=r.search();e.deviceId&&n.$emit("activeMarker",{id:e.deviceId}),i.$apply(function(){i.showLoadingScreen=!1})},n.$on("$locationChangeSuccess",function(e,o,t){var a=r.search();o!==t&&i.historyUrl?(i.historyUrl.q==i.historyUrl.q&&i.historyUrl.isDirection==a.isDirection||n.$emit("setSearchFromUrl",null),i.historyUrl.fromDate!==a.fromDate||i.historyUrl.toDate!==a.toDate||i.historyUrl.fromTime!==a.fromTime||i.historyUrl.toTime!==a.toTime?(n.$emit("setRangeFromUrl",null),a.deviceId&&n.$emit("infoLocation",{id:a.deviceId,direction:a.direction})):!a.deviceId||i.historyUrl.deviceId===a.deviceId&&i.historyUrl.direction===a.direction?!a.deviceId&&i.historyUrl.deviceId&&(n.selectDevice=null,n.$emit("setDefaultMap",null)):(n.$emit("infoLocation",{id:a.deviceId,direction:a.direction}),n.$emit("activeMarker",{id:a.deviceId}))):a.deviceId&&n.$emit("infoLocation",{id:a.deviceId,direction:a.direction}),i.historyUrl=r.search()}),n.handleErrorResponse=function(e){var o=jQuery("#modalError");switch(e.status){case 400:console.log("API ERROR 400"),i.modalError={title:"Neplatný požadavek",body:"Požadavek nemůže být vyřízen, poněvadž byl syntakticky nesprávně zapsán.",button:"OK"},o.modal("show");break;case 401:i.modalError={title:"Platnost webové aplikace vypršela",body:"Pro obnovení platnosti stačí stisknout tlačítko Obnovit.",button:"Obnovit",clickButton:i.reloadApp},o.modal({backdrop:"static",keyboard:!1});break;case 404:console.log("API ERROR 404"),i.modalError={title:"Nenalezen",body:"Záznam nebyl nalezen.",button:"OK"},o.modal("show");break;case 500:console.log("API ERROR 500"),i.modalError={title:"Chyba",body:"Chyba serveru. Zopakujte akci později.",button:"OK"},o.modal("show");break;case-1:console.log("API NOT CONNECTED"),i.modalError={title:"Připojení k internetu",body:"Nejste připojeni k internetu. Zkontrolujte připojení.",button:"OK"},o.modal("show");break;default:console.log("API UNKNOWN ERROR"),i.modalError={title:"Neočekávaná chyba",body:"Nastala neočekávaná chyba.",button:"OK"},o.modal("show")}},i.reloadApp=function(){e.location.reload()}}]),angular.module("pvpk").controller("mapController",["$rootScope","$scope","config","Device",function(t,n,a,e){this.$onInit=function(){n.markers=[],n.map=new google.maps.Map(document.getElementById("map"),{center:a.DEFAULT_POSITION,zoom:a.DEFAULT_ZOOM,minZoom:a.DEFAULT_ZOOM_MIN,zoomControl:!0,mapTypeControl:!1,scaleControl:!1,streetViewControl:!1,rotateControl:!1,fullscreenControl:!1,mapTypeId:google.maps.MapTypeId.ROADMAP}),e.query({showDirection:0},function(e){for(var o,t=0;o=e[t];t++)n.createMarker(o)},function(e){console.log("Error api all Devices"),t.handleErrorResponse(e)})},n.createMarker=function(e){if(e.lat&&e.lng){var o=new google.maps.Marker({map:n.map,position:{lat:e.lat,lng:e.lng},title:e.name,infoWindow:new google.maps.InfoWindow({content:'<h6 class="mb-1">'+e.name+"</h6><address>"+e.street+", "+e.town+"</address>"}),id:e.id});o.addListener("click",function(){n.closeInfoWindows(),o.infoWindow.open(n.map,o),t.$emit("infoLocation",{id:e.id})}),n.markers.push(o)}},t.$on("activeMarker",function(e,o){for(var t,a=0;t=n.markers[a];a++)t.id&&t.id===o.id&&t.infoWindow?(n.map.setCenter(t.getPosition()),n.map.setZoom(12),t.infoWindow.open(n.map,t)):t.infoWindow.close()}),t.$on("setDefaultMap",function(e,o){n.map.setCenter(a.DEFAULT_POSITION),n.map.setZoom(a.DEFAULT_ZOOM),n.closeInfoWindows()}),n.closeInfoWindows=function(){for(var e,o=0;e=n.markers[o];o++)e.infoWindow.close()}}]),angular.module("pvpk").controller("searchController",["$rootScope","$scope","$location","config","Device",function(t,a,n,e,o){this.$onInit=function(){a.config=e,a.locations=[],a.showSearchLoading=!1,t.$emit("setSearchFromUrl",null)},a.searchLocations=function(){var e=n.search();e.q=a.search.q,e.isDirection=a.search.isDirection?1:null,n.search(e),!a.search.q||a.search.q.length<=1?a.locations=[]:(a.showSearchLoading=!0,o.query({address:a.search.q,showDirection:a.search.isDirection?1:0},function(e){a.locations=e,a.showSearchLoading=!1},function(e){a.showSearchLoading=!1,console.log("Error api all Devices"),t.handleErrorResponse(e)}))},t.$on("setSearchFromUrl",function(e,o){var t=n.search();a.search={q:t.q,isDirection:!!t.isDirection&&!!+t.isDirection},a.searchLocations()}),a.selectDevice=function(e,o){t.$emit("activeMarker",{id:e}),t.$emit("infoLocation",{id:e,direction:o})}}]),angular.module("pvpk").component("graphAverageSpeed",{template:'<div><canvas id="graphAverageSpeed" class="graph-size mb-5"></canvas></div>',controller:["$rootScope","$scope",function(e,a){e.$on("renderGraphAverageSpeed",function(e,o){var t=document.getElementById("graphAverageSpeed").getContext("2d");a.graphLine&&a.graphLine.destroy(),a.graphLine=new Chart(t,{type:"line",data:o.data,options:{responsive:!0,pointDot:!1,legend:{position:"bottom"},scales:{xAxes:[{ticks:{autoSkip:!0,maxTicksLimit:15}}],yAxes:[{scaleLabel:{display:!0,labelString:"km/h"},ticks:{beginAtZero:!0,suggestedMax:70}}]},tooltips:{mode:"index",intersect:!1,callbacks:{label:function(e){return e.yLabel+" km/h"}}}}})})}]}),angular.module("pvpk").component("graphNumberVehicles",{template:'<div><canvas id="graphNumberVehicles" class="graph-size mb-5"></canvas></div>',controller:["$rootScope","$scope",function(e,a){e.$on("renderGraphNumberVehicles",function(e,o){var t=document.getElementById("graphNumberVehicles").getContext("2d");a.graphNumberVehicles&&a.graphNumberVehicles.destroy(),a.graphNumberVehicles=new Chart(t,{type:"bar",data:o.data,options:{responsive:!0,onResize:function(e,o){e.options.legend.display=240<o.height,e.update()},legend:{position:"bottom"},scales:{xAxes:[{stacked:!0,ticks:{autoSkip:!0,maxTicksLimit:15}}],yAxes:[{scaleLabel:{display:!0,labelString:"počet vozidel"},stacked:!0}]},tooltips:{mode:"index",intersect:!1}}})})}]});
+angular.module("pvpk",["ngResource"]),angular.module("pvpk").constant("config",{APP_NAME:"PVPK",APP_VERSION:"1.3.3",API_URL:API_URL,API_TOKEN:API_TOKEN,DEFAULT_POSITION:{lat:49.53,lng:13.3},DEFAULT_ZOOM:10,DEFAULT_ZOOM_MIN:7,DEFAULT_RANGE_DATE_DAY:{from:-30,to:-1},DEFAULT_RANGE_TIME_HOUR:{from:7,to:16}}),angular.module("pvpk").factory("Device",["$resource","config",function(e,o){return e(o.API_URL+"/devices/:id",{id:"@id",period:"@period"},{get:{url:o.API_URL+"/devices/:id/:period",method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}},query:{url:o.API_URL+"/devices",method:"GET",isArray:!0,headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}}})}]),angular.module("pvpk").factory("Range",["$resource","config",function(e,o){return e(o.API_URL+"/range",null,{get:{url:o.API_URL+"/range",method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}}})}]),angular.module("pvpk").factory("Vehicle",["$resource","config",function(e,o){return e(o.API_URL+"/vehicles",null,{query:{url:o.API_URL+"/vehicles",method:"GET",isArray:!0,headers:{"Content-Type":"application/json",Accept:"application/json",jwt:o.API_TOKEN}}})}]),angular.module("pvpk").controller("infoController",["$rootScope","$scope","$location","config","Device","Vehicle","Range",function(u,h,i,a,r,e,n){this.$onInit=function(){u.selectDevice=null,h.showInfoLoading=!1,h.vehicles=[],h.urlExportCsv=null,h.directions=[{id:void 0,name:"po směru i proti směru"},{id:1,name:"po směru"},{id:2,name:"proti směru"}],h.isLoadRange=!1,e.query(null,function(e){h.vehicles=e},function(e){u.graphShow=!1,console.log("Error api all Vehicles"),u.handleErrorResponse(e)}),u.$emit("setRangeFromUrl",null)},u.$on("setRangeFromUrl",function(e,o){var t=i.search();h.range={fromDate:moment(t.fromDate,"YYYY-MM-DD").isValid()?moment(t.fromDate).toDate():moment().add(a.DEFAULT_RANGE_DATE_DAY.from,"d").toDate(),toDate:moment(t.toDate,"YYYY-MM-DD").isValid()?moment(t.toDate).toDate():moment().add(a.DEFAULT_RANGE_DATE_DAY.to,"d").toDate(),fromTime:moment(t.fromTime,"HH:mm").isValid()?moment(t.fromTime,"HH:mm").toDate():moment({hour:a.DEFAULT_RANGE_TIME_HOUR.from}).toDate(),toTime:moment(t.toTime,"HH:mm").isValid()?moment(t.toTime,"HH:mm").toDate():moment({hour:a.DEFAULT_RANGE_TIME_HOUR.to}).toDate(),isTime:0!=t.isTime,maxDate:null==h.range?null:h.range.maxDate,minDate:null==h.range?null:h.range.minDate},h.isLoadRange||n.get(null,function(e){h.range.fromDate=moment.max(moment(e.last_date).add(a.DEFAULT_RANGE_DATE_DAY.from,"d"),moment(e.first_date)).toDate(),h.range.toDate=moment.min(moment(h.range.toDate),moment(e.last_date)).toDate(),h.range.maxDate=moment(e.last_date).toDate(),h.range.minDate=moment(e.first_date).toDate(),h.isLoadRange=!0},function(e){console.log("Error api get Range"),u.handleErrorResponse(e)})}),u.$on("infoLocation",function(e,o){h.showInfoLoading=!0;var t=i.search();t.deviceId=o.id,t.direction=o.direction,i.search(t);var a=h.getRange(),n={period:a.isTime?"time-period":"day-period",id:o.id,direction:o.direction,dateFrom:a.fromDate.format("YYYY-MM-DD"),dateTo:a.toDate.format("YYYY-MM-DD"),timeFrom:a.isTime?a.fromTime.format("HH:mm"):null,timeTo:a.isTime?a.toTime.format("HH:mm"):null};r.get(n,function(e){u.selectDevice=e,h.renderGraph(),h.urlExportCsv=h.generateUrlExportCsv(n),h.showInfoLoading=!1},function(e){u.selectDevice=null,h.showInfoLoading=!1,console.log("Error api get Devices"),u.handleErrorResponse(e)})}),h.generateUrlExportCsv=function(e){var o="/devices/:id/:period/csv?".replace(":id",e.id).replace(":period",e.period);delete e.id,delete e.period;var t=jQuery.param(e);return a.API_URL+o+t},h.changeRange=function(){if(h.range.fromDate>=h.range.toDate||h.range.isTime&&h.range.fromTime>=h.range.toTime)u.selectDevice.traffics=[];else{var e=h.getRange(),o=i.search();o.fromDate=e.fromDate.format("YYYY-MM-DD"),o.toDate=e.toDate.format("YYYY-MM-DD"),o.fromTime=e.isTime?e.fromTime.format("HH:mm"):null,o.toTime=e.isTime?e.toTime.format("HH:mm"):null,o.isTime=e.isTime?null:0,i.search(o),u.selectDevice&&u.$emit("infoLocation",{id:u.selectDevice.id,direction:u.selectDevice.direction})}},h.changeDirection=function(){u.$emit("infoLocation",{id:u.selectDevice.id,direction:u.selectDevice.direction})},h.getRange=function(){return{fromDate:moment(h.range.fromDate).isValid()?moment(h.range.fromDate):moment().add(a.DEFAULT_RANGE_DATE_DAY.from,"d"),toDate:moment(h.range.toDate).isValid()?moment(h.range.toDate):moment().add(a.DEFAULT_RANGE_DATE_DAY.to,"d"),fromTime:moment(h.range.fromTime).isValid()?moment(h.range.fromTime):moment({hour:a.DEFAULT_RANGE_TIME_HOUR.from}),toTime:moment(h.range.toTime).isValid()?moment(h.range.toTime):moment({hour:a.DEFAULT_RANGE_TIME_HOUR.to}),isTime:!!h.range.isTime}},h.renderGraph=function(){for(var e,o=["rgba(158, 158, 158, #alpha)","rgba(213, 0, 0, #alpha)","rgba(0, 123, 255, #alpha)","rgba(170, 0, 255, #alpha)","rgba(0, 200, 83, #alpha)","rgba(255, 214, 0, #alpha)","rgba(255, 109, 0, #alpha)","rgba(174, 234, 0, #alpha)","rgba(98, 0, 234, #alpha)","rgba(255, 171, 0, #alpha)","rgba(100, 221, 23, #alpha)","rgba(0, 184, 212, #alpha)"],t=jQuery.unique(u.selectDevice.traffics.map(function(e){return h.range.isTime?e.timeFrom:moment(e.date,"YYYY-MM-DD").format("D.M.YYYY")})),a=jQuery.unique(u.selectDevice.traffics.map(function(e){return e.typeVehicleId})),n=jQuery.grep(h.vehicles,function(e){return 0<=a.indexOf(e.id)}),i=[],r=[],l=0;e=n[l];l++){for(var c,s={label:e.name,backgroundColor:o[e.id].replace("#alpha","0.3"),borderColor:o[e.id].replace("#alpha","1"),borderWidth:2,data:[]},m={data:[],borderWidth:2,label:e.name,fill:!1,backgroundColor:o[e.id].replace("#alpha","0.3"),borderColor:o[e.id].replace("#alpha","1"),cubicInterpolationMode:"monotone",pointRadius:0},d=0,p=0;c=u.selectDevice.traffics[p];p++)(h.range.isTime&&t[d]!==c.timeFrom||!h.range.isTime&&t[d]!==moment(c.date,"YYYY-MM-DD").format("D.M.YYYY"))&&(d++,s.data.length<d&&(s.data.push(0),m.data.push(0))),c.typeVehicleId===e.id&&(s.data.push(h.range.isTime?c.numberVehicleAverage:c.numberVehicle),m.data.push(c.speedAverage<=0?0:c.speedAverage));i.push(s),r.push(m)}u.$emit("renderGraphNumberVehicles",{data:{labels:t,datasets:i}}),u.$emit("renderGraphAverageSpeed",{data:{labels:t,datasets:r}})},h.infoClose=function(){u.selectDevice=null;var e=i.search();e.deviceId=null,e.direction=null,i.search(e),u.$emit("setDefaultMap",null)}}]),angular.module("pvpk").controller("mainController",["$rootScope","$scope","$location","$window",function(n,i,r,e){this.$onInit=function(){i.showLoadingScreen=!0},e.onload=function(){var e=r.search();e.deviceId&&n.$emit("activeMarker",{id:e.deviceId}),i.$apply(function(){i.showLoadingScreen=!1})},n.$on("$locationChangeSuccess",function(e,o,t){var a=r.search();o!==t&&i.historyUrl?(i.historyUrl.q==i.historyUrl.q&&i.historyUrl.isDirection==a.isDirection||n.$emit("setSearchFromUrl",null),i.historyUrl.fromDate!==a.fromDate||i.historyUrl.toDate!==a.toDate||i.historyUrl.fromTime!==a.fromTime||i.historyUrl.toTime!==a.toTime?(n.$emit("setRangeFromUrl",null),a.deviceId&&n.$emit("infoLocation",{id:a.deviceId,direction:a.direction})):!a.deviceId||i.historyUrl.deviceId===a.deviceId&&i.historyUrl.direction===a.direction?!a.deviceId&&i.historyUrl.deviceId&&(n.selectDevice=null,n.$emit("setDefaultMap",null)):(n.$emit("infoLocation",{id:a.deviceId,direction:a.direction}),n.$emit("activeMarker",{id:a.deviceId}))):a.deviceId&&n.$emit("infoLocation",{id:a.deviceId,direction:a.direction}),i.historyUrl=r.search()}),n.handleErrorResponse=function(e){var o=jQuery("#modalError");switch(e.status){case 400:console.log("API ERROR 400"),i.modalError={title:"Neplatný požadavek",body:"Požadavek nemůže být vyřízen, poněvadž byl syntakticky nesprávně zapsán.",button:"OK"},o.modal("show");break;case 401:i.modalError={title:"Platnost webové aplikace vypršela",body:"Pro obnovení platnosti stačí stisknout tlačítko Obnovit.",button:"Obnovit",clickButton:i.reloadApp},o.modal({backdrop:"static",keyboard:!1});break;case 404:console.log("API ERROR 404"),i.modalError={title:"Nenalezen",body:"Záznam nebyl nalezen.",button:"OK"},o.modal("show");break;case 500:console.log("API ERROR 500"),i.modalError={title:"Chyba",body:"Chyba serveru. Zopakujte akci později.",button:"OK"},o.modal("show");break;case-1:console.log("API NOT CONNECTED"),i.modalError={title:"Připojení k internetu",body:"Nejste připojeni k internetu. Zkontrolujte připojení.",button:"OK"},o.modal("show");break;default:console.log("API UNKNOWN ERROR"),i.modalError={title:"Neočekávaná chyba",body:"Nastala neočekávaná chyba.",button:"OK"},o.modal("show")}},i.reloadApp=function(){e.location.reload()}}]),angular.module("pvpk").controller("mapController",["$rootScope","$scope","config","Device",function(t,n,a,e){this.$onInit=function(){n.markers=[],n.map=new google.maps.Map(document.getElementById("map"),{center:a.DEFAULT_POSITION,zoom:a.DEFAULT_ZOOM,minZoom:a.DEFAULT_ZOOM_MIN,zoomControl:!0,mapTypeControl:!1,scaleControl:!1,streetViewControl:!1,rotateControl:!1,fullscreenControl:!1,mapTypeId:google.maps.MapTypeId.ROADMAP}),e.query({showDirection:0},function(e){for(var o,t=0;o=e[t];t++)n.createMarker(o)},function(e){console.log("Error api all Devices"),t.handleErrorResponse(e)})},n.createMarker=function(e){if(e.lat&&e.lng){var o=new google.maps.Marker({map:n.map,position:{lat:e.lat,lng:e.lng},title:e.name,infoWindow:new google.maps.InfoWindow({content:'<h6 class="mb-1">'+e.name+"</h6><address>"+e.street+", "+e.town+"</address>"}),id:e.id});o.addListener("click",function(){n.closeInfoWindows(),o.infoWindow.open(n.map,o),t.$emit("infoLocation",{id:e.id})}),n.markers.push(o)}},t.$on("activeMarker",function(e,o){for(var t,a=0;t=n.markers[a];a++)t.id&&t.id===o.id&&t.infoWindow?(n.map.setCenter(t.getPosition()),n.map.setZoom(12),t.infoWindow.open(n.map,t)):t.infoWindow.close()}),t.$on("setDefaultMap",function(e,o){n.map.setCenter(a.DEFAULT_POSITION),n.map.setZoom(a.DEFAULT_ZOOM),n.closeInfoWindows()}),n.closeInfoWindows=function(){for(var e,o=0;e=n.markers[o];o++)e.infoWindow.close()}}]),angular.module("pvpk").controller("searchController",["$rootScope","$scope","$location","config","Device",function(t,a,n,e,o){this.$onInit=function(){a.config=e,a.locations=[],a.showSearchLoading=!1,t.$emit("setSearchFromUrl",null)},a.searchLocations=function(){var e=n.search();e.q=a.search.q,e.isDirection=a.search.isDirection?1:null,n.search(e),!a.search.q||a.search.q.length<=1?a.locations=[]:(a.showSearchLoading=!0,o.query({address:a.search.q,showDirection:a.search.isDirection?1:0},function(e){a.locations=e,a.showSearchLoading=!1},function(e){a.showSearchLoading=!1,console.log("Error api all Devices"),t.handleErrorResponse(e)}))},t.$on("setSearchFromUrl",function(e,o){var t=n.search();a.search={q:t.q,isDirection:!!t.isDirection&&!!+t.isDirection},a.searchLocations()}),a.selectDevice=function(e,o){t.$emit("activeMarker",{id:e}),t.$emit("infoLocation",{id:e,direction:o})}}]),angular.module("pvpk").component("graphAverageSpeed",{template:'<div><canvas id="graphAverageSpeed" class="graph-size mb-5"></canvas></div>',controller:["$rootScope","$scope",function(e,a){e.$on("renderGraphAverageSpeed",function(e,o){var t=document.getElementById("graphAverageSpeed").getContext("2d");a.graphLine&&a.graphLine.destroy(),a.graphLine=new Chart(t,{type:"line",data:o.data,options:{responsive:!0,pointDot:!1,legend:{position:"bottom"},scales:{xAxes:[{ticks:{autoSkip:!0,maxTicksLimit:15}}],yAxes:[{scaleLabel:{display:!0,labelString:"km/h"},ticks:{beginAtZero:!0,suggestedMax:70}}]},tooltips:{mode:"index",intersect:!1,callbacks:{label:function(e){return e.yLabel+" km/h"}}}}})})}]}),angular.module("pvpk").component("graphNumberVehicles",{template:'<div><canvas id="graphNumberVehicles" class="graph-size mb-5"></canvas></div>',controller:["$rootScope","$scope",function(e,a){e.$on("renderGraphNumberVehicles",function(e,o){var t=document.getElementById("graphNumberVehicles").getContext("2d");a.graphNumberVehicles&&a.graphNumberVehicles.destroy(),a.graphNumberVehicles=new Chart(t,{type:"bar",data:o.data,options:{responsive:!0,onResize:function(e,o){e.options.legend.display=240<o.height,e.update()},legend:{position:"bottom"},scales:{xAxes:[{stacked:!0,ticks:{autoSkip:!0,maxTicksLimit:15}}],yAxes:[{scaleLabel:{display:!0,labelString:"počet vozidel"},stacked:!0}]},tooltips:{mode:"index",intersect:!1}}})})}]});
 //# sourceMappingURL=app.min.js.map
diff --git a/frontend/app.min.js.map b/frontend/app.min.js.map
index 8e6f09b..2cdf2c1 100644
--- a/frontend/app.min.js.map
+++ b/frontend/app.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["app.module.js","app.config.js","DeviceService.js","RangeService.js","VehicleService.js","infoController.js","mainController.js","mapController.js","searchController.js","graphAverageSpeed.js","graphNumberVehicles.js"],"names":["angular","module","constant","APP_NAME","APP_VERSION","API_URL","API_TOKEN","DEFAULT_POSITION","lat","lng","DEFAULT_ZOOM","DEFAULT_ZOOM_MIN","DEFAULT_RANGE_DATE_DAY","from","to","DEFAULT_RANGE_TIME_HOUR","factory","$resource","config","id","period","get","url","method","headers","Content-Type","Accept","jwt","query","isArray","controller","$rootScope","$scope","$location","Device","Vehicle","Range","this","$onInit","selectDevice","showInfoLoading","vehicles","urlExportCsv","directions","undefined","name","isLoadRange","data","response","graphShow","console","log","handleErrorResponse","$emit","$on","event","args","params","search","range","fromDate","moment","isValid","toDate","add","fromTime","hour","toTime","isTime","maxDate","minDate","max","last_date","first_date","min","deviceId","direction","getRange","dateFrom","format","dateTo","timeFrom","timeTo","renderGraph","generateUrlExportCsv","relativeUrl","replace","paramsUrl","jQuery","param","changeRange","traffics","changeDirection","vehicle","color","labels","unique","map","d","date","useVehiclesIds","typeVehicleId","filterVehicles","grep","n","indexOf","datasetsNumberVehicles","datasetsAverageSpeed","i","traffic","datasetNumberVehicles","label","backgroundColor","borderColor","borderWidth","datasetAverageSpeed","fill","cubicInterpolationMode","pointRadius","l","j","length","push","numberVehicleAverage","numberVehicle","speedAverage","datasets","infoClose","$window","showLoadingScreen","onload","$apply","newUrl","oldUrl","historyUrl","q","isDirection","modalError","status","title","body","button","modal","clickButton","reloadApp","backdrop","keyboard","location","reload","markers","google","maps","Map","document","getElementById","center","zoom","minZoom","zoomControl","mapTypeControl","scaleControl","streetViewControl","rotateControl","fullscreenControl","mapTypeId","MapTypeId","ROADMAP","showDirection","lctn","createMarker","marker","Marker","position","infoWindow","InfoWindow","content","street","town","addListener","closeInfoWindows","open","setCenter","getPosition","setZoom","close","locations","showSearchLoading","searchLocations","address","component","template","canvas","getContext","graphLine","destroy","Chart","type","options","responsive","pointDot","legend","scales","xAxes","ticks","autoSkip","maxTicksLimit","yAxes","scaleLabel","display","labelString","beginAtZero","suggestedMax","tooltips","mode","intersect","callbacks","tooltipItems","yLabel","canvasGraphNumberVehicles","graphNumberVehicles","onResize","chart","size","height","update","stacked"],"mappings":"AAAAA,QAAAC,OAAA,OAAA,CAAA,eCAAD,QAAAC,OAAA,QACAC,SAAA,SAAA,CACAC,SAAA,OACAC,YAAA,QACAC,QAAAA,QACAC,UAAAA,UACAC,iBAAA,CAAAC,IAAA,MAAAC,IAAA,MACAC,aAAA,GACAC,iBAAA,EACAC,uBAAA,CAAAC,MAAA,GAAAC,IAAA,GACAC,wBAAA,CAAAF,KAAA,EAAAC,GAAA,MCVAd,QAAAC,OAAA,QACAe,QAAA,SAAA,CAAA,YAAA,SAAA,SAAAC,EAAAC,GACA,OAAAD,EAAAC,EAAAb,QAAA,eAAA,CAAAc,GAAA,MAAAC,OAAA,WAAA,CACAC,IAAA,CACAC,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AAA,QACA4L,UAAA,sBAAA,CACAC,SAAA,gFACAhK,WAAA,CAAA,aAAA,SAAA,SAAAC,EAAAC,GAEAD,EAAAuB,IAAA,4BAAA,SAAAC,EAAAC,GACA,IAAAkK,EAAAjE,SAAAC,eAAA,uBAAAsC,WAAA,MAEAhK,EAAA2L,qBACA3L,EAAA2L,oBAAAzB,UAEAlK,EAAA2L,oBAAA,IAAAxB,MAAAuB,EAAA,CACAtB,KAAA,MACArJ,KAAAS,EAAAT,KACAsJ,QAAA,CACAC,YAAA,EACAsB,SAAA,SAAAC,EAAAC,GACAD,EAAAxB,QAAAG,OAAAQ,QAAA,IAAAc,EAAAC,OACAF,EAAAG,UAEAxB,OAAA,CACA5B,SAAA,UAEA6B,OAAA,CACAC,MAAA,CAAA,CACAuB,SAAA,EACAtB,MAAA,CACAC,UAAA,EACAC,cAAA,MAGAC,MAAA,CAAA,CACAC,WAAA,CACAC,SAAA,EACAC,YAAA,iBAEAgB,SAAA,KAGAb,SAAA,CACAC,KAAA,QACAC,WAAA","file":"app.min.js","sourcesContent":["angular.module('pvpk', ['ngResource']);","angular.module('pvpk')\r\n    .constant('config', {\r\n        APP_NAME: 'PVPK',\r\n        APP_VERSION: '1.3.3',\r\n        API_URL: API_URL,\r\n        API_TOKEN: API_TOKEN,\r\n        DEFAULT_POSITION: {lat: 49.53, lng: 13.3},\r\n        DEFAULT_ZOOM: 10,\r\n        DEFAULT_ZOOM_MIN: 7,\r\n        DEFAULT_RANGE_DATE_DAY: {from: -30, to: -1},\r\n        DEFAULT_RANGE_TIME_HOUR: {from: 7, to: 16}\r\n    });","angular.module('pvpk')\r\n    .factory('Device', ['$resource', 'config', function ($resource, config) {\r\n        return $resource(config.API_URL + '/devices/:id', {id: '@id', period: '@period'}, {\r\n            'get': {\r\n                url: config.API_URL + '/devices/:id/:period',\r\n                method: 'GET',\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            },\r\n            'query': {\r\n                url: config.API_URL + '/devices',\r\n                method: 'GET',\r\n                isArray: true,\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            }\r\n        });\r\n    }]);","angular.module('pvpk')\r\n    .factory('Range', ['$resource', 'config', function ($resource, config) {\r\n        return $resource(config.API_URL + '/range', null, {\r\n            'get': {\r\n                url: config.API_URL + '/range',\r\n                method: 'GET',\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            }\r\n        });\r\n    }]);","angular.module('pvpk')\r\n    .factory('Vehicle', ['$resource', 'config', function ($resource, config) {\r\n        return $resource(config.API_URL + '/vehicles', null, {\r\n            'query': {\r\n                url: config.API_URL + '/vehicles',\r\n                method: 'GET',\r\n                isArray: true,\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            }\r\n        });\r\n    }]);","angular.module('pvpk')\r\n    .controller('infoController', ['$rootScope', '$scope', '$location', 'config', 'Device', 'Vehicle', 'Range', function ($rootScope, $scope, $location, config, Device, Vehicle, Range) {\r\n\r\n        this.$onInit = function () {\r\n            $rootScope.selectDevice = null;\r\n            $scope.showInfoLoading = false;\r\n            $scope.vehicles = [];\r\n            $scope.urlExportCsv = null;\r\n            $scope.directions = [\r\n                {id: undefined, name: 'po směru i proti směru'},\r\n                {id: 1, name: 'po směru'},\r\n                {id: 2, name: 'proti směru'}];\r\n            $scope.isLoadRange = false;\r\n\r\n            Vehicle.query(null, function (data) {\r\n                $scope.vehicles = data;\r\n            }, function (response) {\r\n                $rootScope.graphShow = false;\r\n                console.log('Error api all Vehicles');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n\r\n            $rootScope.$emit('setRangeFromUrl', null);\r\n        };\r\n\r\n        $rootScope.$on('setRangeFromUrl', function (event, args) {\r\n            var params = $location.search();\r\n\r\n            $scope.range = {\r\n                fromDate: moment(params.fromDate, 'YYYY-MM-DD').isValid() ? moment(params.fromDate).toDate() : moment().add(config.DEFAULT_RANGE_DATE_DAY.from, 'd').toDate(),\r\n                toDate: moment(params.toDate, 'YYYY-MM-DD').isValid() ? moment(params.toDate).toDate() : moment().add(config.DEFAULT_RANGE_DATE_DAY.to, 'd').toDate(),\r\n                fromTime: moment(params.fromTime, 'HH:mm').isValid() ? moment(params.fromTime, 'HH:mm').toDate() : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.from}).toDate(),\r\n                toTime: moment(params.toTime, 'HH:mm').isValid() ? moment(params.toTime, 'HH:mm').toDate() : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.to}).toDate(),\r\n                isTime: params.isTime == 0 ? false : true,\r\n                maxDate: $scope.range == null ? null : $scope.range.maxDate,\r\n                minDate: $scope.range == null ? null : $scope.range.minDate\r\n            };\r\n\r\n            if (!$scope.isLoadRange) {\r\n                Range.get(null, function (data) {\r\n                    $scope.range.fromDate = moment.max(moment(data.last_date).add(config.DEFAULT_RANGE_DATE_DAY.from, 'd'), moment(data.first_date)).toDate();\r\n                    $scope.range.toDate = moment.min(moment($scope.range.toDate), moment(data.last_date)).toDate();\r\n                    $scope.range.maxDate = moment(data.last_date).toDate();\r\n                    $scope.range.minDate = moment(data.first_date).toDate();\r\n                    $scope.isLoadRange = true;\r\n                }, function (response) {\r\n                    console.log('Error api get Range');\r\n                    $rootScope.handleErrorResponse(response);\r\n                });\r\n            }\r\n        });\r\n\r\n        $rootScope.$on('infoLocation', function (event, args) {\r\n            $scope.showInfoLoading = true;\r\n\r\n            var params = $location.search();\r\n            params.deviceId = args.id;\r\n            params.direction = args.direction;\r\n            $location.search(params);\r\n\r\n            var range = $scope.getRange();\r\n\r\n            var query = {\r\n                period: range.isTime ? 'time-period' : 'day-period',\r\n                id: args.id,\r\n                direction: args.direction,\r\n                dateFrom: range.fromDate.format('YYYY-MM-DD'),\r\n                dateTo: range.toDate.format('YYYY-MM-DD'),\r\n                timeFrom: range.isTime ? range.fromTime.format('HH:mm') : null,\r\n                timeTo: range.isTime ? range.toTime.format('HH:mm') : null\r\n            };\r\n\r\n            Device.get(query, function (data) {\r\n                $rootScope.selectDevice = data;\r\n                $scope.renderGraph();\r\n                $scope.urlExportCsv = $scope.generateUrlExportCsv(query);\r\n\r\n                $scope.showInfoLoading = false;\r\n            }, function (response) {\r\n                $rootScope.selectDevice = null;\r\n                $scope.showInfoLoading = false;\r\n                console.log('Error api get Devices');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n\r\n        });\r\n\r\n        $scope.generateUrlExportCsv = function (query) {\r\n            var relativeUrl = '/devices/:id/:period/csv?'.replace(':id', query.id).replace(':period', query.period);\r\n            delete query.id;\r\n            delete query.period;\r\n\r\n            var paramsUrl = jQuery.param(query);\r\n            return config.API_URL + relativeUrl + paramsUrl;\r\n        };\r\n\r\n        $scope.changeRange = function () {\r\n            if ($scope.range.fromDate >= $scope.range.toDate || ($scope.range.isTime && $scope.range.fromTime >= $scope.range.toTime)) {\r\n                $rootScope.selectDevice.traffics = [];\r\n                return;\r\n            }\r\n\r\n            if (!($scope.range.fromDate >= $scope.range.minDate && $scope.range.toDate <= $scope.range.maxDate\r\n                && $scope.range.toDate >= $scope.range.minDate && $scope.range.fromDate <= $scope.range.maxDate)) {\r\n                $rootScope.selectDevice.traffics = [];\r\n                return;\r\n            }\r\n\r\n\r\n            var range = $scope.getRange();\r\n\r\n            var params = $location.search();\r\n            params.fromDate = range.fromDate.format('YYYY-MM-DD');\r\n            params.toDate = range.toDate.format('YYYY-MM-DD');\r\n            params.fromTime = range.isTime ? range.fromTime.format('HH:mm') : null;\r\n            params.toTime = range.isTime ? range.toTime.format('HH:mm') : null;\r\n            params.isTime = range.isTime ? null : 0;\r\n            $location.search(params);\r\n\r\n            if ($rootScope.selectDevice)\r\n                $rootScope.$emit('infoLocation', {\r\n                    id: $rootScope.selectDevice.id,\r\n                    direction: $rootScope.selectDevice.direction\r\n                });\r\n        };\r\n\r\n        $scope.changeDirection = function () {\r\n\r\n            $rootScope.$emit('infoLocation', {\r\n                id: $rootScope.selectDevice.id,\r\n                direction: $rootScope.selectDevice.direction\r\n            });\r\n        };\r\n\r\n        $scope.getRange = function () {\r\n            return {\r\n                fromDate: moment($scope.range.fromDate).isValid() ? moment($scope.range.fromDate) : moment().add(config.DEFAULT_RANGE_DATE_DAY.from, 'd'),\r\n                toDate: moment($scope.range.toDate).isValid() ? moment($scope.range.toDate) : moment().add(config.DEFAULT_RANGE_DATE_DAY.to, 'd'),\r\n                fromTime: moment($scope.range.fromTime).isValid() ? moment($scope.range.fromTime) : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.from}),\r\n                toTime: moment($scope.range.toTime).isValid() ? moment($scope.range.toTime) : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.to}),\r\n                isTime: $scope.range.isTime ? true : false\r\n            };\r\n        };\r\n\r\n        $scope.renderGraph = function () {\r\n            var color = ['rgba(158, 158, 158, #alpha)', 'rgba(213, 0, 0, #alpha)', 'rgba(0, 123, 255, #alpha)', 'rgba(170, 0, 255, #alpha)',\r\n                'rgba(0, 200, 83, #alpha)', 'rgba(255, 214, 0, #alpha)', 'rgba(255, 109, 0, #alpha)',\r\n                'rgba(174, 234, 0, #alpha)', 'rgba(98, 0, 234, #alpha)', 'rgba(255, 171, 0, #alpha)', 'rgba(100, 221, 23, #alpha)', 'rgba(0, 184, 212, #alpha)'];\r\n\r\n            var labels = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) {\r\n                return $scope.range.isTime ? d.timeFrom : moment(d.date, 'YYYY-MM-DD').format('D.M.YYYY');\r\n            }));\r\n\r\n            var useVehiclesIds = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) {\r\n                return d.typeVehicleId;\r\n            }));\r\n\r\n            var filterVehicles = jQuery.grep($scope.vehicles, function (n) {\r\n                return useVehiclesIds.indexOf(n.id) >= 0;\r\n            });\r\n\r\n            var datasetsNumberVehicles = [];\r\n            var datasetsAverageSpeed = [];\r\n\r\n            for (var i = 0, vehicle; vehicle = filterVehicles[i]; i++) {\r\n                var datasetNumberVehicles = {\r\n                    label: vehicle.name,\r\n                    backgroundColor: color[vehicle.id].replace(\"#alpha\", \"0.3\"),\r\n                    borderColor: color[vehicle.id].replace(\"#alpha\", \"1\"),\r\n                    borderWidth: 2,\r\n                    data: []\r\n                };\r\n\r\n                var datasetAverageSpeed = {\r\n                    data: [],\r\n                    borderWidth: 2,\r\n                    label: vehicle.name,\r\n                    fill: false,\r\n                    backgroundColor: color[vehicle.id].replace(\"#alpha\", \"0.3\"),\r\n                    borderColor: color[vehicle.id].replace(\"#alpha\", \"1\"),\r\n                    cubicInterpolationMode: 'monotone',\r\n                    pointRadius: 0\r\n                };\r\n\r\n                var l = 0;\r\n                for (var j = 0, traffic; traffic = $rootScope.selectDevice.traffics[j]; j++) {\r\n                    if (($scope.range.isTime && labels[l] !== traffic.timeFrom) || (!$scope.range.isTime && labels[l] !== moment(traffic.date, 'YYYY-MM-DD').format('D.M.YYYY'))) {\r\n                        l++;\r\n                        if (datasetNumberVehicles.data.length < l) {\r\n                            datasetNumberVehicles.data.push(0);\r\n                            datasetAverageSpeed.data.push(0);\r\n                        }\r\n                    }\r\n                    if (traffic.typeVehicleId === vehicle.id) {\r\n                        datasetNumberVehicles.data.push($scope.range.isTime ? traffic.numberVehicleAverage : traffic.numberVehicle);\r\n                        datasetAverageSpeed.data.push(traffic.speedAverage <= 0 ? 0 : traffic.speedAverage);\r\n                    }\r\n                }\r\n                datasetsNumberVehicles.push(datasetNumberVehicles);\r\n                datasetsAverageSpeed.push(datasetAverageSpeed);\r\n            }\r\n\r\n            $rootScope.$emit('renderGraphNumberVehicles', {\r\n                data: {\r\n                    labels: labels,\r\n                    datasets: datasetsNumberVehicles\r\n                }\r\n            });\r\n\r\n            $rootScope.$emit('renderGraphAverageSpeed', {\r\n                data: {\r\n                    labels: labels,\r\n                    datasets: datasetsAverageSpeed\r\n                }\r\n            });\r\n        };\r\n\r\n        $scope.infoClose = function () {\r\n            $rootScope.selectDevice = null;\r\n\r\n            var params = $location.search();\r\n            params.deviceId = null;\r\n            params.direction = null;\r\n            $location.search(params);\r\n\r\n            $rootScope.$emit('setDefaultMap', null);\r\n        };\r\n    }]);\r\n","angular.module('pvpk')\r\n    .controller('mainController', ['$rootScope', '$scope', '$location', '$window', function ($rootScope, $scope, $location, $window) {\r\n\r\n        this.$onInit = function () {\r\n            $scope.showLoadingScreen = true;\r\n        };\r\n\r\n        $window.onload = function () {\r\n            var params = $location.search();\r\n            if (params.deviceId) {\r\n                $rootScope.$emit('activeMarker', {id: params.deviceId});\r\n            }\r\n\r\n            $scope.$apply(function () {\r\n                $scope.showLoadingScreen = false;\r\n            });\r\n        };\r\n\r\n        $rootScope.$on('$locationChangeSuccess', function (event, newUrl, oldUrl) {\r\n            var params = $location.search();\r\n\r\n            if (newUrl !== oldUrl && $scope.historyUrl) {\r\n                if ($scope.historyUrl.q !== $scope.historyUrl.q || $scope.historyUrl.isDirection != params.isDirection) {\r\n                    $rootScope.$emit('setSearchFromUrl', null);\r\n                }\r\n\r\n                if ($scope.historyUrl.fromDate !== params.fromDate || $scope.historyUrl.toDate !== params.toDate ||\r\n                    $scope.historyUrl.fromTime !== params.fromTime || $scope.historyUrl.toTime !== params.toTime) {\r\n                    $rootScope.$emit('setRangeFromUrl', null);\r\n                    if (params.deviceId) {\r\n                        $rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction});\r\n                    }\r\n                } else if (params.deviceId && ($scope.historyUrl.deviceId !== params.deviceId || $scope.historyUrl.direction !== params.direction)) {\r\n                    $rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction});\r\n                    $rootScope.$emit('activeMarker', {id: params.deviceId});\r\n                } else if (!params.deviceId && $scope.historyUrl.deviceId) {\r\n                    $rootScope.selectDevice = null;\r\n                    $rootScope.$emit('setDefaultMap', null);\r\n                }\r\n            } else if (params.deviceId) {\r\n                $rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction});\r\n            }\r\n\r\n            $scope.historyUrl = $location.search();\r\n        });\r\n\r\n        $rootScope.handleErrorResponse = function (response) {\r\n\r\n            var modalError = jQuery('#modalError');\r\n            switch (response.status) {\r\n                case 400:\r\n                    console.log('API ERROR 400');\r\n                    $scope.modalError = {\r\n                        title: 'Neplatný požadavek',\r\n                        body: 'Požadavek nemůže být vyřízen, poněvadž byl syntakticky nesprávně zapsán.',\r\n                        button: 'OK'\r\n                    };\r\n                    modalError.modal('show');\r\n                    break;\r\n                case 401:\r\n                    $scope.modalError = {\r\n                        title: 'Platnost webové aplikace vypršela',\r\n                        body: 'Pro obnovení platnosti stačí stisknout tlačítko Obnovit.',\r\n                        button: 'Obnovit',\r\n                        clickButton: $scope.reloadApp\r\n                    };\r\n                    modalError.modal({backdrop: 'static', keyboard: false});\r\n                    break;\r\n                case 404:\r\n                    console.log('API ERROR 404');\r\n                    $scope.modalError = {title: 'Nenalezen', body: 'Záznam nebyl nalezen.', button: 'OK'};\r\n                    modalError.modal('show');\r\n                    break;\r\n                case 500:\r\n                    console.log('API ERROR 500');\r\n                    $scope.modalError = {title: 'Chyba', body: 'Chyba serveru. Zopakujte akci později.', button: 'OK'};\r\n                    modalError.modal('show');\r\n                    break;\r\n                case -1:\r\n                    console.log('API NOT CONNECTED');\r\n                    $scope.modalError = {\r\n                        title: 'Připojení k internetu',\r\n                        body: 'Nejste připojeni k internetu. Zkontrolujte připojení.',\r\n                        button: 'OK'\r\n                    };\r\n                    modalError.modal('show');\r\n                    break;\r\n                default:\r\n                    console.log('API UNKNOWN ERROR');\r\n                    $scope.modalError = {title: 'Neočekávaná chyba', body: 'Nastala neočekávaná chyba.', button: 'OK'};\r\n                    modalError.modal('show');\r\n                    break;\r\n            }\r\n        };\r\n\r\n        $scope.reloadApp = function () {\r\n            $window.location.reload();\r\n        }\r\n    }]);","angular.module('pvpk')\r\n    .controller('mapController', ['$rootScope', '$scope', 'config', 'Device', function ($rootScope, $scope, config, Device) {\r\n\r\n        this.$onInit = function () {\r\n            $scope.markers = [];\r\n\r\n            $scope.map = new google.maps.Map(document.getElementById('map'), {\r\n                center: config.DEFAULT_POSITION,\r\n                zoom: config.DEFAULT_ZOOM,\r\n                minZoom: config.DEFAULT_ZOOM_MIN,\r\n                zoomControl: true,\r\n                mapTypeControl: false,\r\n                scaleControl: false,\r\n                streetViewControl: false,\r\n                rotateControl: false,\r\n                fullscreenControl: false,\r\n                mapTypeId: google.maps.MapTypeId.ROADMAP\r\n            });\r\n\r\n            Device.query({showDirection: 0}, function (data) {\r\n                for (var i = 0, lctn; lctn = data[i]; i++) {\r\n                    $scope.createMarker(lctn);\r\n                }\r\n            }, function (response) {\r\n                console.log('Error api all Devices');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n        };\r\n\r\n        $scope.createMarker = function (lctn) {\r\n            if (lctn.lat && lctn.lng) {\r\n                var marker = new google.maps.Marker({\r\n                    map: $scope.map,\r\n                    position: {lat: lctn.lat, lng: lctn.lng},\r\n                    title: lctn.name,\r\n                    infoWindow: new google.maps.InfoWindow({\r\n                        content: '<h6 class=\"mb-1\">' + lctn.name + '</h6>'\r\n                        + '<address>' + lctn.street + ', ' + lctn.town + '</address>'\r\n                    }),\r\n                    id: lctn.id\r\n                });\r\n\r\n                marker.addListener('click', function () {\r\n                    $scope.closeInfoWindows();\r\n                    marker.infoWindow.open($scope.map, marker);\r\n                    $rootScope.$emit('infoLocation', {id: lctn.id});\r\n                });\r\n\r\n                $scope.markers.push(marker);\r\n            }\r\n        };\r\n\r\n        $rootScope.$on('activeMarker', function (event, args) {\r\n            for (var i = 0, marker; marker = $scope.markers[i]; i++) {\r\n                if (marker.id && marker.id === args.id && marker.infoWindow) {\r\n                    $scope.map.setCenter(marker.getPosition());\r\n                    $scope.map.setZoom(12);\r\n                    marker.infoWindow.open($scope.map, marker);\r\n                } else {\r\n                    marker.infoWindow.close();\r\n                }\r\n            }\r\n        });\r\n\r\n        $rootScope.$on('setDefaultMap', function (event, args) {\r\n            $scope.map.setCenter(config.DEFAULT_POSITION);\r\n            $scope.map.setZoom(config.DEFAULT_ZOOM);\r\n            $scope.closeInfoWindows();\r\n        });\r\n\r\n        $scope.closeInfoWindows = function () {\r\n            for (var i = 0, marker; marker = $scope.markers[i]; i++) {\r\n                marker.infoWindow.close();\r\n            }\r\n        };\r\n    }]);","angular.module('pvpk')\r\n    .controller('searchController', ['$rootScope', '$scope', '$location', 'config', 'Device', function ($rootScope, $scope, $location, config, Device) {\r\n\r\n        this.$onInit = function () {\r\n            $scope.config = config;\r\n            $scope.locations = [];\r\n            $scope.showSearchLoading = false;\r\n\r\n            $rootScope.$emit('setSearchFromUrl', null);\r\n        };\r\n\r\n        $scope.searchLocations = function () {\r\n            var params = $location.search();\r\n            params.q = $scope.search.q;\r\n            params.isDirection = $scope.search.isDirection ? 1 : null;\r\n            $location.search(params);\r\n\r\n            if (!$scope.search.q || $scope.search.q.length <= 1) {\r\n                $scope.locations = [];\r\n                return;\r\n            }\r\n\r\n            $scope.showSearchLoading = true;\r\n\r\n            Device.query({\r\n                address: $scope.search.q,\r\n                showDirection: $scope.search.isDirection ? 1 : 0\r\n            }, function (data) {\r\n                $scope.locations = data;\r\n                $scope.showSearchLoading = false;\r\n            }, function (response) {\r\n                $scope.showSearchLoading = false;\r\n                console.log('Error api all Devices');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n        };\r\n\r\n        $rootScope.$on('setSearchFromUrl', function (event, args) {\r\n            var params = $location.search();\r\n            $scope.search = {\r\n                q: params.q,\r\n                isDirection: params.isDirection ? !!+params.isDirection : false\r\n            };\r\n            $scope.searchLocations();\r\n        });\r\n\r\n        $scope.selectDevice = function (id, direction) {\r\n            $rootScope.$emit('activeMarker', {id: id});\r\n            $rootScope.$emit('infoLocation', {id: id, direction: direction});\r\n        };\r\n\r\n    }]);","angular.module('pvpk')\r\n    .component('graphAverageSpeed', {\r\n        template: '<div><canvas id=\"graphAverageSpeed\" class=\"graph-size mb-5\"></canvas></div>',\r\n        controller: ['$rootScope', '$scope', function ($rootScope, $scope) {\r\n\r\n            $rootScope.$on('renderGraphAverageSpeed', function (event, args) {\r\n                var canvas = document.getElementById('graphAverageSpeed').getContext('2d');\r\n\r\n                if ($scope.graphLine)\r\n                    $scope.graphLine.destroy();\r\n\r\n                $scope.graphLine = new Chart(canvas, {\r\n                    type: 'line',\r\n                    data: args.data,\r\n                    options: {\r\n                        responsive: true,\r\n                        pointDot: false,\r\n                        legend: {\r\n                            position: 'bottom'\r\n                        },\r\n                        scales: {\r\n                            xAxes: [{\r\n                                ticks: {\r\n                                    autoSkip: true,\r\n                                    maxTicksLimit: 15\r\n                                }\r\n                            }],\r\n                            yAxes: [{\r\n                                scaleLabel: {\r\n                                    display: true,\r\n                                    labelString: 'km/h'\r\n                                },\r\n                                ticks: {\r\n                                    beginAtZero: true,\r\n                                    suggestedMax: 70\r\n                                }\r\n                            }]\r\n                        },\r\n                        tooltips: {\r\n                            mode: 'index',\r\n                            intersect: false,\r\n                            callbacks: {\r\n                                label: function (tooltipItems) {\r\n                                    return tooltipItems.yLabel + ' km/h';\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                });\r\n\r\n            });\r\n\r\n        }]\r\n    });","angular.module('pvpk')\r\n    .component('graphNumberVehicles', {\r\n        template: '<div><canvas id=\"graphNumberVehicles\" class=\"graph-size mb-5\"></canvas></div>',\r\n        controller: ['$rootScope', '$scope', function ($rootScope, $scope) {\r\n\r\n            $rootScope.$on('renderGraphNumberVehicles', function (event, args) {\r\n                var canvasGraphNumberVehicles = document.getElementById('graphNumberVehicles').getContext('2d');\r\n\r\n                if ($scope.graphNumberVehicles)\r\n                    $scope.graphNumberVehicles.destroy();\r\n\r\n                $scope.graphNumberVehicles = new Chart(canvasGraphNumberVehicles, {\r\n                    type: 'bar',\r\n                    data: args.data,\r\n                    options: {\r\n                        responsive: true,\r\n                        onResize: function (chart, size) {\r\n                            chart.options.legend.display = size.height > 240;\r\n                            chart.update();\r\n                        },\r\n                        legend: {\r\n                            position: 'bottom'\r\n                        },\r\n                        scales: {\r\n                            xAxes: [{\r\n                                stacked: true,\r\n                                ticks: {\r\n                                    autoSkip: true,\r\n                                    maxTicksLimit: 15\r\n                                }\r\n                            }],\r\n                            yAxes: [{\r\n                                scaleLabel: {\r\n                                    display: true,\r\n                                    labelString: \"počet vozidel\"\r\n                                },\r\n                                stacked: true\r\n                            }]\r\n                        },\r\n                        tooltips: {\r\n                            mode: 'index',\r\n                            intersect: false\r\n                        }\r\n                    }\r\n                });\r\n\r\n            });\r\n\r\n        }]\r\n    });"]}
\ No newline at end of file
+{"version":3,"sources":["app.module.js","app.config.js","DeviceService.js","RangeService.js","VehicleService.js","infoController.js","mainController.js","mapController.js","searchController.js","graphAverageSpeed.js","graphNumberVehicles.js"],"names":["angular","module","constant","APP_NAME","APP_VERSION","API_URL","API_TOKEN","DEFAULT_POSITION","lat","lng","DEFAULT_ZOOM","DEFAULT_ZOOM_MIN","DEFAULT_RANGE_DATE_DAY","from","to","DEFAULT_RANGE_TIME_HOUR","factory","$resource","config","id","period","get","url","method","headers","Content-Type","Accept","jwt","query","isArray","controller","$rootScope","$scope","$location","Device","Vehicle","Range","this","$onInit","selectDevice","showInfoLoading","vehicles","urlExportCsv","directions","undefined","name","isLoadRange","data","response","graphShow","console","log","handleErrorResponse","$emit","$on","event","args","params","search","range","fromDate","moment","isValid","toDate","add","fromTime","hour","toTime","isTime","maxDate","minDate","max","last_date","first_date","min","deviceId","direction","getRange","dateFrom","format","dateTo","timeFrom","timeTo","renderGraph","generateUrlExportCsv","relativeUrl","replace","paramsUrl","jQuery","param","changeRange","traffics","changeDirection","vehicle","color","labels","unique","map","d","date","useVehiclesIds","typeVehicleId","filterVehicles","grep","n","indexOf","datasetsNumberVehicles","datasetsAverageSpeed","i","traffic","datasetNumberVehicles","label","backgroundColor","borderColor","borderWidth","datasetAverageSpeed","fill","cubicInterpolationMode","pointRadius","l","j","length","push","numberVehicleAverage","numberVehicle","speedAverage","datasets","infoClose","$window","showLoadingScreen","onload","$apply","newUrl","oldUrl","historyUrl","q","isDirection","modalError","status","title","body","button","modal","clickButton","reloadApp","backdrop","keyboard","location","reload","markers","google","maps","Map","document","getElementById","center","zoom","minZoom","zoomControl","mapTypeControl","scaleControl","streetViewControl","rotateControl","fullscreenControl","mapTypeId","MapTypeId","ROADMAP","showDirection","lctn","createMarker","marker","Marker","position","infoWindow","InfoWindow","content","street","town","addListener","closeInfoWindows","open","setCenter","getPosition","setZoom","close","locations","showSearchLoading","searchLocations","address","component","template","canvas","getContext","graphLine","destroy","Chart","type","options","responsive","pointDot","legend","scales","xAxes","ticks","autoSkip","maxTicksLimit","yAxes","scaleLabel","display","labelString","beginAtZero","suggestedMax","tooltips","mode","intersect","callbacks","tooltipItems","yLabel","canvasGraphNumberVehicles","graphNumberVehicles","onResize","chart","size","height","update","stacked"],"mappings":"AAAAA,QAAAC,OAAA,OAAA,CAAA,eCAAD,QAAAC,OAAA,QACAC,SAAA,SAAA,CACAC,SAAA,OACAC,YAAA,QACAC,QAAAA,QACAC,UAAAA,UACAC,iBAAA,CAAAC,IAAA,MAAAC,IAAA,MACAC,aAAA,GACAC,iBAAA,EACAC,uBAAA,CAAAC,MAAA,GAAAC,IAAA,GACAC,wBAAA,CAAAF,KAAA,EAAAC,GAAA,MCVAd,QAAAC,OAAA,QACAe,QAAA,SAAA,CAAA,YAAA,SAAA,SAAAC,EAAAC,GACA,OAAAD,EAAAC,EAAAb,QAAA,eAAA,CAAAc,GAAA,MAAAC,OAAA,WAAA,CACAC,IAAA,CACAC,IAAAJ,EAAAb,QAAA,uBACAkB,OAAA,MACAC,QAAA,CACAC,eAAA,mBACAC,OAAA,mBACAC,IAAAT,EAAAZ,YAGAsB,MAAA,CACAN,IAAAJ,EAAAb,QAAA,WACAkB,OAAA,MACAM,SAAA,EACAL,QAAA,CACAC,eAAA,mBACAC,OAAA,m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AA,CACA5B,SAAA,UAEA6B,OAAA,CACAC,MAAA,CAAA,CACAuB,SAAA,EACAtB,MAAA,CACAC,UAAA,EACAC,cAAA,MAGAC,MAAA,CAAA,CACAC,WAAA,CACAC,SAAA,EACAC,YAAA,iBAEAgB,SAAA,KAGAb,SAAA,CACAC,KAAA,QACAC,WAAA","file":"app.min.js","sourcesContent":["angular.module('pvpk', ['ngResource']);","angular.module('pvpk')\r\n    .constant('config', {\r\n        APP_NAME: 'PVPK',\r\n        APP_VERSION: '1.3.3',\r\n        API_URL: API_URL,\r\n        API_TOKEN: API_TOKEN,\r\n        DEFAULT_POSITION: {lat: 49.53, lng: 13.3},\r\n        DEFAULT_ZOOM: 10,\r\n        DEFAULT_ZOOM_MIN: 7,\r\n        DEFAULT_RANGE_DATE_DAY: {from: -30, to: -1},\r\n        DEFAULT_RANGE_TIME_HOUR: {from: 7, to: 16}\r\n    });","angular.module('pvpk')\r\n    .factory('Device', ['$resource', 'config', function ($resource, config) {\r\n        return $resource(config.API_URL + '/devices/:id', {id: '@id', period: '@period'}, {\r\n            'get': {\r\n                url: config.API_URL + '/devices/:id/:period',\r\n                method: 'GET',\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            },\r\n            'query': {\r\n                url: config.API_URL + '/devices',\r\n                method: 'GET',\r\n                isArray: true,\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            }\r\n        });\r\n    }]);","angular.module('pvpk')\r\n    .factory('Range', ['$resource', 'config', function ($resource, config) {\r\n        return $resource(config.API_URL + '/range', null, {\r\n            'get': {\r\n                url: config.API_URL + '/range',\r\n                method: 'GET',\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            }\r\n        });\r\n    }]);","angular.module('pvpk')\r\n    .factory('Vehicle', ['$resource', 'config', function ($resource, config) {\r\n        return $resource(config.API_URL + '/vehicles', null, {\r\n            'query': {\r\n                url: config.API_URL + '/vehicles',\r\n                method: 'GET',\r\n                isArray: true,\r\n                headers: {\r\n                    'Content-Type': 'application/json',\r\n                    'Accept': 'application/json',\r\n                    'jwt': config.API_TOKEN\r\n                }\r\n            }\r\n        });\r\n    }]);","angular.module('pvpk')\r\n    .controller('infoController', ['$rootScope', '$scope', '$location', 'config', 'Device', 'Vehicle', 'Range', function ($rootScope, $scope, $location, config, Device, Vehicle, Range) {\r\n\r\n        this.$onInit = function () {\r\n            $rootScope.selectDevice = null;\r\n            $scope.showInfoLoading = false;\r\n            $scope.vehicles = [];\r\n            $scope.urlExportCsv = null;\r\n            $scope.directions = [\r\n                {id: undefined, name: 'po směru i proti směru'},\r\n                {id: 1, name: 'po směru'},\r\n                {id: 2, name: 'proti směru'}];\r\n            $scope.isLoadRange = false;\r\n\r\n            Vehicle.query(null, function (data) {\r\n                $scope.vehicles = data;\r\n            }, function (response) {\r\n                $rootScope.graphShow = false;\r\n                console.log('Error api all Vehicles');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n\r\n            $rootScope.$emit('setRangeFromUrl', null);\r\n        };\r\n\r\n        $rootScope.$on('setRangeFromUrl', function (event, args) {\r\n            var params = $location.search();\r\n\r\n            $scope.range = {\r\n                fromDate: moment(params.fromDate, 'YYYY-MM-DD').isValid() ? moment(params.fromDate).toDate() : moment().add(config.DEFAULT_RANGE_DATE_DAY.from, 'd').toDate(),\r\n                toDate: moment(params.toDate, 'YYYY-MM-DD').isValid() ? moment(params.toDate).toDate() : moment().add(config.DEFAULT_RANGE_DATE_DAY.to, 'd').toDate(),\r\n                fromTime: moment(params.fromTime, 'HH:mm').isValid() ? moment(params.fromTime, 'HH:mm').toDate() : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.from}).toDate(),\r\n                toTime: moment(params.toTime, 'HH:mm').isValid() ? moment(params.toTime, 'HH:mm').toDate() : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.to}).toDate(),\r\n                isTime: params.isTime == 0 ? false : true,\r\n                maxDate: $scope.range == null ? null : $scope.range.maxDate,\r\n                minDate: $scope.range == null ? null : $scope.range.minDate\r\n            };\r\n\r\n            if (!$scope.isLoadRange) {\r\n                Range.get(null, function (data) {\r\n                    $scope.range.fromDate = moment.max(moment(data.last_date).add(config.DEFAULT_RANGE_DATE_DAY.from, 'd'), moment(data.first_date)).toDate();\r\n                    $scope.range.toDate = moment.min(moment($scope.range.toDate), moment(data.last_date)).toDate();\r\n                    $scope.range.maxDate = moment(data.last_date).toDate();\r\n                    $scope.range.minDate = moment(data.first_date).toDate();\r\n                    $scope.isLoadRange = true;\r\n                }, function (response) {\r\n                    console.log('Error api get Range');\r\n                    $rootScope.handleErrorResponse(response);\r\n                });\r\n            }\r\n        });\r\n\r\n        $rootScope.$on('infoLocation', function (event, args) {\r\n            $scope.showInfoLoading = true;\r\n\r\n            var params = $location.search();\r\n            params.deviceId = args.id;\r\n            params.direction = args.direction;\r\n            $location.search(params);\r\n\r\n            var range = $scope.getRange();\r\n\r\n            var query = {\r\n                period: range.isTime ? 'time-period' : 'day-period',\r\n                id: args.id,\r\n                direction: args.direction,\r\n                dateFrom: range.fromDate.format('YYYY-MM-DD'),\r\n                dateTo: range.toDate.format('YYYY-MM-DD'),\r\n                timeFrom: range.isTime ? range.fromTime.format('HH:mm') : null,\r\n                timeTo: range.isTime ? range.toTime.format('HH:mm') : null\r\n            };\r\n\r\n            Device.get(query, function (data) {\r\n                $rootScope.selectDevice = data;\r\n                $scope.renderGraph();\r\n                $scope.urlExportCsv = $scope.generateUrlExportCsv(query);\r\n\r\n                $scope.showInfoLoading = false;\r\n            }, function (response) {\r\n                $rootScope.selectDevice = null;\r\n                $scope.showInfoLoading = false;\r\n                console.log('Error api get Devices');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n\r\n        });\r\n\r\n        $scope.generateUrlExportCsv = function (query) {\r\n            var relativeUrl = '/devices/:id/:period/csv?'.replace(':id', query.id).replace(':period', query.period);\r\n            delete query.id;\r\n            delete query.period;\r\n\r\n            var paramsUrl = jQuery.param(query);\r\n            return config.API_URL + relativeUrl + paramsUrl;\r\n        };\r\n\r\n        $scope.changeRange = function () {\r\n            if ($scope.range.fromDate >= $scope.range.toDate || ($scope.range.isTime && $scope.range.fromTime >= $scope.range.toTime)) {\r\n                $rootScope.selectDevice.traffics = [];\r\n                return;\r\n            }\r\n\r\n            var range = $scope.getRange();\r\n\r\n            var params = $location.search();\r\n            params.fromDate = range.fromDate.format('YYYY-MM-DD');\r\n            params.toDate = range.toDate.format('YYYY-MM-DD');\r\n            params.fromTime = range.isTime ? range.fromTime.format('HH:mm') : null;\r\n            params.toTime = range.isTime ? range.toTime.format('HH:mm') : null;\r\n            params.isTime = range.isTime ? null : 0;\r\n            $location.search(params);\r\n\r\n            if ($rootScope.selectDevice)\r\n                $rootScope.$emit('infoLocation', {\r\n                    id: $rootScope.selectDevice.id,\r\n                    direction: $rootScope.selectDevice.direction\r\n                });\r\n        };\r\n\r\n        $scope.changeDirection = function () {\r\n\r\n            $rootScope.$emit('infoLocation', {\r\n                id: $rootScope.selectDevice.id,\r\n                direction: $rootScope.selectDevice.direction\r\n            });\r\n        };\r\n\r\n        $scope.getRange = function () {\r\n            return {\r\n                fromDate: moment($scope.range.fromDate).isValid() ? moment($scope.range.fromDate) : moment().add(config.DEFAULT_RANGE_DATE_DAY.from, 'd'),\r\n                toDate: moment($scope.range.toDate).isValid() ? moment($scope.range.toDate) : moment().add(config.DEFAULT_RANGE_DATE_DAY.to, 'd'),\r\n                fromTime: moment($scope.range.fromTime).isValid() ? moment($scope.range.fromTime) : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.from}),\r\n                toTime: moment($scope.range.toTime).isValid() ? moment($scope.range.toTime) : moment({hour: config.DEFAULT_RANGE_TIME_HOUR.to}),\r\n                isTime: $scope.range.isTime ? true : false\r\n            };\r\n        };\r\n\r\n        $scope.renderGraph = function () {\r\n            var color = ['rgba(158, 158, 158, #alpha)', 'rgba(213, 0, 0, #alpha)', 'rgba(0, 123, 255, #alpha)', 'rgba(170, 0, 255, #alpha)',\r\n                'rgba(0, 200, 83, #alpha)', 'rgba(255, 214, 0, #alpha)', 'rgba(255, 109, 0, #alpha)',\r\n                'rgba(174, 234, 0, #alpha)', 'rgba(98, 0, 234, #alpha)', 'rgba(255, 171, 0, #alpha)', 'rgba(100, 221, 23, #alpha)', 'rgba(0, 184, 212, #alpha)'];\r\n\r\n            var labels = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) {\r\n                return $scope.range.isTime ? d.timeFrom : moment(d.date, 'YYYY-MM-DD').format('D.M.YYYY');\r\n            }));\r\n\r\n            var useVehiclesIds = jQuery.unique($rootScope.selectDevice.traffics.map(function (d) {\r\n                return d.typeVehicleId;\r\n            }));\r\n\r\n            var filterVehicles = jQuery.grep($scope.vehicles, function (n) {\r\n                return useVehiclesIds.indexOf(n.id) >= 0;\r\n            });\r\n\r\n            var datasetsNumberVehicles = [];\r\n            var datasetsAverageSpeed = [];\r\n\r\n            for (var i = 0, vehicle; vehicle = filterVehicles[i]; i++) {\r\n                var datasetNumberVehicles = {\r\n                    label: vehicle.name,\r\n                    backgroundColor: color[vehicle.id].replace(\"#alpha\", \"0.3\"),\r\n                    borderColor: color[vehicle.id].replace(\"#alpha\", \"1\"),\r\n                    borderWidth: 2,\r\n                    data: []\r\n                };\r\n\r\n                var datasetAverageSpeed = {\r\n                    data: [],\r\n                    borderWidth: 2,\r\n                    label: vehicle.name,\r\n                    fill: false,\r\n                    backgroundColor: color[vehicle.id].replace(\"#alpha\", \"0.3\"),\r\n                    borderColor: color[vehicle.id].replace(\"#alpha\", \"1\"),\r\n                    cubicInterpolationMode: 'monotone',\r\n                    pointRadius: 0\r\n                };\r\n\r\n                var l = 0;\r\n                for (var j = 0, traffic; traffic = $rootScope.selectDevice.traffics[j]; j++) {\r\n                    if (($scope.range.isTime && labels[l] !== traffic.timeFrom) || (!$scope.range.isTime && labels[l] !== moment(traffic.date, 'YYYY-MM-DD').format('D.M.YYYY'))) {\r\n                        l++;\r\n                        if (datasetNumberVehicles.data.length < l) {\r\n                            datasetNumberVehicles.data.push(0);\r\n                            datasetAverageSpeed.data.push(0);\r\n                        }\r\n                    }\r\n                    if (traffic.typeVehicleId === vehicle.id) {\r\n                        datasetNumberVehicles.data.push($scope.range.isTime ? traffic.numberVehicleAverage : traffic.numberVehicle);\r\n                        datasetAverageSpeed.data.push(traffic.speedAverage <= 0 ? 0 : traffic.speedAverage);\r\n                    }\r\n                }\r\n                datasetsNumberVehicles.push(datasetNumberVehicles);\r\n                datasetsAverageSpeed.push(datasetAverageSpeed);\r\n            }\r\n\r\n            $rootScope.$emit('renderGraphNumberVehicles', {\r\n                data: {\r\n                    labels: labels,\r\n                    datasets: datasetsNumberVehicles\r\n                }\r\n            });\r\n\r\n            $rootScope.$emit('renderGraphAverageSpeed', {\r\n                data: {\r\n                    labels: labels,\r\n                    datasets: datasetsAverageSpeed\r\n                }\r\n            });\r\n        };\r\n\r\n        $scope.infoClose = function () {\r\n            $rootScope.selectDevice = null;\r\n\r\n            var params = $location.search();\r\n            params.deviceId = null;\r\n            params.direction = null;\r\n            $location.search(params);\r\n\r\n            $rootScope.$emit('setDefaultMap', null);\r\n        };\r\n    }]);\r\n","angular.module('pvpk')\r\n    .controller('mainController', ['$rootScope', '$scope', '$location', '$window', function ($rootScope, $scope, $location, $window) {\r\n\r\n        this.$onInit = function () {\r\n            $scope.showLoadingScreen = true;\r\n        };\r\n\r\n        $window.onload = function () {\r\n            var params = $location.search();\r\n            if (params.deviceId) {\r\n                $rootScope.$emit('activeMarker', {id: params.deviceId});\r\n            }\r\n\r\n            $scope.$apply(function () {\r\n                $scope.showLoadingScreen = false;\r\n            });\r\n        };\r\n\r\n        $rootScope.$on('$locationChangeSuccess', function (event, newUrl, oldUrl) {\r\n            var params = $location.search();\r\n\r\n            if (newUrl !== oldUrl && $scope.historyUrl) {\r\n                if ($scope.historyUrl.q !== $scope.historyUrl.q || $scope.historyUrl.isDirection != params.isDirection) {\r\n                    $rootScope.$emit('setSearchFromUrl', null);\r\n                }\r\n\r\n                if ($scope.historyUrl.fromDate !== params.fromDate || $scope.historyUrl.toDate !== params.toDate ||\r\n                    $scope.historyUrl.fromTime !== params.fromTime || $scope.historyUrl.toTime !== params.toTime) {\r\n                    $rootScope.$emit('setRangeFromUrl', null);\r\n                    if (params.deviceId) {\r\n                        $rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction});\r\n                    }\r\n                } else if (params.deviceId && ($scope.historyUrl.deviceId !== params.deviceId || $scope.historyUrl.direction !== params.direction)) {\r\n                    $rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction});\r\n                    $rootScope.$emit('activeMarker', {id: params.deviceId});\r\n                } else if (!params.deviceId && $scope.historyUrl.deviceId) {\r\n                    $rootScope.selectDevice = null;\r\n                    $rootScope.$emit('setDefaultMap', null);\r\n                }\r\n            } else if (params.deviceId) {\r\n                $rootScope.$emit('infoLocation', {id: params.deviceId, direction: params.direction});\r\n            }\r\n\r\n            $scope.historyUrl = $location.search();\r\n        });\r\n\r\n        $rootScope.handleErrorResponse = function (response) {\r\n\r\n            var modalError = jQuery('#modalError');\r\n            switch (response.status) {\r\n                case 400:\r\n                    console.log('API ERROR 400');\r\n                    $scope.modalError = {\r\n                        title: 'Neplatný požadavek',\r\n                        body: 'Požadavek nemůže být vyřízen, poněvadž byl syntakticky nesprávně zapsán.',\r\n                        button: 'OK'\r\n                    };\r\n                    modalError.modal('show');\r\n                    break;\r\n                case 401:\r\n                    $scope.modalError = {\r\n                        title: 'Platnost webové aplikace vypršela',\r\n                        body: 'Pro obnovení platnosti stačí stisknout tlačítko Obnovit.',\r\n                        button: 'Obnovit',\r\n                        clickButton: $scope.reloadApp\r\n                    };\r\n                    modalError.modal({backdrop: 'static', keyboard: false});\r\n                    break;\r\n                case 404:\r\n                    console.log('API ERROR 404');\r\n                    $scope.modalError = {title: 'Nenalezen', body: 'Záznam nebyl nalezen.', button: 'OK'};\r\n                    modalError.modal('show');\r\n                    break;\r\n                case 500:\r\n                    console.log('API ERROR 500');\r\n                    $scope.modalError = {title: 'Chyba', body: 'Chyba serveru. Zopakujte akci později.', button: 'OK'};\r\n                    modalError.modal('show');\r\n                    break;\r\n                case -1:\r\n                    console.log('API NOT CONNECTED');\r\n                    $scope.modalError = {\r\n                        title: 'Připojení k internetu',\r\n                        body: 'Nejste připojeni k internetu. Zkontrolujte připojení.',\r\n                        button: 'OK'\r\n                    };\r\n                    modalError.modal('show');\r\n                    break;\r\n                default:\r\n                    console.log('API UNKNOWN ERROR');\r\n                    $scope.modalError = {title: 'Neočekávaná chyba', body: 'Nastala neočekávaná chyba.', button: 'OK'};\r\n                    modalError.modal('show');\r\n                    break;\r\n            }\r\n        };\r\n\r\n        $scope.reloadApp = function () {\r\n            $window.location.reload();\r\n        }\r\n    }]);","angular.module('pvpk')\r\n    .controller('mapController', ['$rootScope', '$scope', 'config', 'Device', function ($rootScope, $scope, config, Device) {\r\n\r\n        this.$onInit = function () {\r\n            $scope.markers = [];\r\n\r\n            $scope.map = new google.maps.Map(document.getElementById('map'), {\r\n                center: config.DEFAULT_POSITION,\r\n                zoom: config.DEFAULT_ZOOM,\r\n                minZoom: config.DEFAULT_ZOOM_MIN,\r\n                zoomControl: true,\r\n                mapTypeControl: false,\r\n                scaleControl: false,\r\n                streetViewControl: false,\r\n                rotateControl: false,\r\n                fullscreenControl: false,\r\n                mapTypeId: google.maps.MapTypeId.ROADMAP\r\n            });\r\n\r\n            Device.query({showDirection: 0}, function (data) {\r\n                for (var i = 0, lctn; lctn = data[i]; i++) {\r\n                    $scope.createMarker(lctn);\r\n                }\r\n            }, function (response) {\r\n                console.log('Error api all Devices');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n        };\r\n\r\n        $scope.createMarker = function (lctn) {\r\n            if (lctn.lat && lctn.lng) {\r\n                var marker = new google.maps.Marker({\r\n                    map: $scope.map,\r\n                    position: {lat: lctn.lat, lng: lctn.lng},\r\n                    title: lctn.name,\r\n                    infoWindow: new google.maps.InfoWindow({\r\n                        content: '<h6 class=\"mb-1\">' + lctn.name + '</h6>'\r\n                        + '<address>' + lctn.street + ', ' + lctn.town + '</address>'\r\n                    }),\r\n                    id: lctn.id\r\n                });\r\n\r\n                marker.addListener('click', function () {\r\n                    $scope.closeInfoWindows();\r\n                    marker.infoWindow.open($scope.map, marker);\r\n                    $rootScope.$emit('infoLocation', {id: lctn.id});\r\n                });\r\n\r\n                $scope.markers.push(marker);\r\n            }\r\n        };\r\n\r\n        $rootScope.$on('activeMarker', function (event, args) {\r\n            for (var i = 0, marker; marker = $scope.markers[i]; i++) {\r\n                if (marker.id && marker.id === args.id && marker.infoWindow) {\r\n                    $scope.map.setCenter(marker.getPosition());\r\n                    $scope.map.setZoom(12);\r\n                    marker.infoWindow.open($scope.map, marker);\r\n                } else {\r\n                    marker.infoWindow.close();\r\n                }\r\n            }\r\n        });\r\n\r\n        $rootScope.$on('setDefaultMap', function (event, args) {\r\n            $scope.map.setCenter(config.DEFAULT_POSITION);\r\n            $scope.map.setZoom(config.DEFAULT_ZOOM);\r\n            $scope.closeInfoWindows();\r\n        });\r\n\r\n        $scope.closeInfoWindows = function () {\r\n            for (var i = 0, marker; marker = $scope.markers[i]; i++) {\r\n                marker.infoWindow.close();\r\n            }\r\n        };\r\n    }]);","angular.module('pvpk')\r\n    .controller('searchController', ['$rootScope', '$scope', '$location', 'config', 'Device', function ($rootScope, $scope, $location, config, Device) {\r\n\r\n        this.$onInit = function () {\r\n            $scope.config = config;\r\n            $scope.locations = [];\r\n            $scope.showSearchLoading = false;\r\n\r\n            $rootScope.$emit('setSearchFromUrl', null);\r\n        };\r\n\r\n        $scope.searchLocations = function () {\r\n            var params = $location.search();\r\n            params.q = $scope.search.q;\r\n            params.isDirection = $scope.search.isDirection ? 1 : null;\r\n            $location.search(params);\r\n\r\n            if (!$scope.search.q || $scope.search.q.length <= 1) {\r\n                $scope.locations = [];\r\n                return;\r\n            }\r\n\r\n            $scope.showSearchLoading = true;\r\n\r\n            Device.query({\r\n                address: $scope.search.q,\r\n                showDirection: $scope.search.isDirection ? 1 : 0\r\n            }, function (data) {\r\n                $scope.locations = data;\r\n                $scope.showSearchLoading = false;\r\n            }, function (response) {\r\n                $scope.showSearchLoading = false;\r\n                console.log('Error api all Devices');\r\n                $rootScope.handleErrorResponse(response);\r\n            });\r\n        };\r\n\r\n        $rootScope.$on('setSearchFromUrl', function (event, args) {\r\n            var params = $location.search();\r\n            $scope.search = {\r\n                q: params.q,\r\n                isDirection: params.isDirection ? !!+params.isDirection : false\r\n            };\r\n            $scope.searchLocations();\r\n        });\r\n\r\n        $scope.selectDevice = function (id, direction) {\r\n            $rootScope.$emit('activeMarker', {id: id});\r\n            $rootScope.$emit('infoLocation', {id: id, direction: direction});\r\n        };\r\n\r\n    }]);","angular.module('pvpk')\r\n    .component('graphAverageSpeed', {\r\n        template: '<div><canvas id=\"graphAverageSpeed\" class=\"graph-size mb-5\"></canvas></div>',\r\n        controller: ['$rootScope', '$scope', function ($rootScope, $scope) {\r\n\r\n            $rootScope.$on('renderGraphAverageSpeed', function (event, args) {\r\n                var canvas = document.getElementById('graphAverageSpeed').getContext('2d');\r\n\r\n                if ($scope.graphLine)\r\n                    $scope.graphLine.destroy();\r\n\r\n                $scope.graphLine = new Chart(canvas, {\r\n                    type: 'line',\r\n                    data: args.data,\r\n                    options: {\r\n                        responsive: true,\r\n                        pointDot: false,\r\n                        legend: {\r\n                            position: 'bottom'\r\n                        },\r\n                        scales: {\r\n                            xAxes: [{\r\n                                ticks: {\r\n                                    autoSkip: true,\r\n                                    maxTicksLimit: 15\r\n                                }\r\n                            }],\r\n                            yAxes: [{\r\n                                scaleLabel: {\r\n                                    display: true,\r\n                                    labelString: 'km/h'\r\n                                },\r\n                                ticks: {\r\n                                    beginAtZero: true,\r\n                                    suggestedMax: 70\r\n                                }\r\n                            }]\r\n                        },\r\n                        tooltips: {\r\n                            mode: 'index',\r\n                            intersect: false,\r\n                            callbacks: {\r\n                                label: function (tooltipItems) {\r\n                                    return tooltipItems.yLabel + ' km/h';\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                });\r\n\r\n            });\r\n\r\n        }]\r\n    });","angular.module('pvpk')\r\n    .component('graphNumberVehicles', {\r\n        template: '<div><canvas id=\"graphNumberVehicles\" class=\"graph-size mb-5\"></canvas></div>',\r\n        controller: ['$rootScope', '$scope', function ($rootScope, $scope) {\r\n\r\n            $rootScope.$on('renderGraphNumberVehicles', function (event, args) {\r\n                var canvasGraphNumberVehicles = document.getElementById('graphNumberVehicles').getContext('2d');\r\n\r\n                if ($scope.graphNumberVehicles)\r\n                    $scope.graphNumberVehicles.destroy();\r\n\r\n                $scope.graphNumberVehicles = new Chart(canvasGraphNumberVehicles, {\r\n                    type: 'bar',\r\n                    data: args.data,\r\n                    options: {\r\n                        responsive: true,\r\n                        onResize: function (chart, size) {\r\n                            chart.options.legend.display = size.height > 240;\r\n                            chart.update();\r\n                        },\r\n                        legend: {\r\n                            position: 'bottom'\r\n                        },\r\n                        scales: {\r\n                            xAxes: [{\r\n                                stacked: true,\r\n                                ticks: {\r\n                                    autoSkip: true,\r\n                                    maxTicksLimit: 15\r\n                                }\r\n                            }],\r\n                            yAxes: [{\r\n                                scaleLabel: {\r\n                                    display: true,\r\n                                    labelString: \"počet vozidel\"\r\n                                },\r\n                                stacked: true\r\n                            }]\r\n                        },\r\n                        tooltips: {\r\n                            mode: 'index',\r\n                            intersect: false\r\n                        }\r\n                    }\r\n                });\r\n\r\n            });\r\n\r\n        }]\r\n    });"]}
\ No newline at end of file
diff --git a/frontend/app/controllers/infoController.js b/frontend/app/controllers/infoController.js
index 504b27f..84f2ee8 100644
--- a/frontend/app/controllers/infoController.js
+++ b/frontend/app/controllers/infoController.js
@@ -100,13 +100,6 @@ angular.module('pvpk')
                 return;
             }
 
-            if (!($scope.range.fromDate >= $scope.range.minDate && $scope.range.toDate <= $scope.range.maxDate
-                && $scope.range.toDate >= $scope.range.minDate && $scope.range.fromDate <= $scope.range.maxDate)) {
-                $rootScope.selectDevice.traffics = [];
-                return;
-            }
-
-
             var range = $scope.getRange();
 
             var params = $location.search();
