Merge pull request #865 from rasika/geo-fence-issues

Fixing geo fencing issues
revert-70aa11f8
Madhawa Perera 7 years ago committed by GitHub
commit 5bc3a98b12

@ -79,7 +79,7 @@ deviceModule = function () {
var fromDate = new Date();
fromDate.setHours(fromDate.getHours() - 2);
var toDate = new Date();
var serviceUrl = devicemgtProps["httpsURL"] + '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + fromDate + '&to=' + toDate;
var serviceUrl = devicemgtProps["httpsURL"] + '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + fromDate.getTime() + '&to=' + toDate.getTime();
serviceInvokers.XMLHttp.get(serviceUrl,
function (backendResponse) {
if (backendResponse.status === 200 && backendResponse.responseText) {

@ -530,11 +530,21 @@
</div>
<div id="dateRangePopup">
<div>
<label> From: <input id="timeFrom" type="text"> </label>
<label> To: <input id="timeTo" type="text"> </label>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnHistorySpatialObject(document.getElementById('objectId').innerHTML, document.getElementById('timeFrom').value, document.getElementById('timeTo').value);return false;">Full History</button>
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-3">From:</label>
<div class="col-sm-9">
<input id="timeFromCal" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3">To:</label>
<div class="col-sm-9">
<input id="timeToCal" type="text">
</div>
</div>
</div>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnHistorySpatialObject(document.getElementById('objectId').innerHTML, document.getElementById('timeFromCal').value, document.getElementById('timeToCal').value);return false;">Full History</button>
</div>
<div id="markerPopupStop" class="popover top">
@ -707,7 +717,7 @@
{{js "js/leaflet/Leaflet.fullscreen.min.js" }}
{{js "js/leaflet/Marker.Rotate.js" }}
{{js "js/leaflet/leaflet.draw.js" }}
{{js "js/jquery/jquery-ui.min.js" }}
{{!js "js/jquery/jquery-ui.min.js" }}
<!-- Leaflet plugins libries -->
{{js "js/firstTemp.js" }}
@ -749,6 +759,10 @@
'Add Geofence Exit Alert', 'glyphicon glyphicon-log-out', geoToolsMenu);
{{/if}}
}
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('#dateRangePopup').dialog('close');
})
});
</script>
{{/zone}}

@ -254,7 +254,7 @@ function focusOnSpatialObject(objectId) {
// TODO: check the map._layersMaxZoom and set the zoom level accordingly
spatialObject.marker.openPopup();
getAlertsHistory(deviceType, deviceId, new Date($('#timeFrom').val()).getTime(), new Date($('#timeTo').val()).getTime());
getAlertsHistory(deviceType, deviceId, new Date($('#timeFromCal').val()).getTime(), new Date($('#timeToCal').val()).getTime());
spatialObject.drawPath();
if (speedGraphControl) {
setTimeout(function () {
@ -504,7 +504,7 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
// TODO: check the map._layersMaxZoom and set the zoom level accordingly
spatialObject.marker.openPopup();
getAlertsHistory(deviceType, deviceId, new Date($('#timeFrom').val()).getTime(), new Date($('#timeTo').val()).getTime());
getAlertsHistory(deviceType, deviceId, new Date($('#timeFromCal').val()).getTime(), new Date($('#timeToCal').val()).getTime());
spatialObject.drawPath();
if (speedGraphControl) {
setTimeout(function () {

@ -1,8 +1,8 @@
$(function() {
$("#timeFrom").datepicker({
$("#timeFromCal").datepicker({
orientation: 'top'
});
$("#timeTo").datepicker({
$("#timeToCal").datepicker({
orientation: 'top'
});
});

@ -185,6 +185,9 @@ function setSpeedAlert() {
if (speedAlertValue == null || speedAlertValue === undefined || speedAlertValue == "") {
var message = "Speed cannot be empty.";
noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else {
data = {
'parseData': JSON.stringify({'speedAlertValue': speedAlertValue, 'deviceId': deviceId}), // parseKey : parseValue pair , this key pair is replace with the key in the template file
@ -235,6 +238,9 @@ function setWithinAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else {
var data = {
'parseData': JSON.stringify({
@ -288,6 +294,9 @@ function setExitAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else {
var data = {
'parseData': JSON.stringify({
@ -348,6 +357,9 @@ function setStationeryAlert(leafletId) {
if (stationeryName == null || stationeryName === undefined || stationeryName == "") {
var message = "Stationery Name cannot be empty.";
noty({text: message, type : 'error' });
} else if (stationeryName.indexOf(" ") > -1) {
var message = "Stationery Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else if (fluctuationRadius == null || fluctuationRadius === undefined || fluctuationRadius == "") {
var message = "Fluctuation Radius cannot be empty.";
noty({text: message, type : 'error' });
@ -462,6 +474,9 @@ function setTrafficAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else {
var data = {
'parseData': JSON.stringify({

Loading…
Cancel
Save