diff --git a/GPS/Shipments.aspx b/GPS/Shipments.aspx index bc9ead148..9a6391624 100644 --- a/GPS/Shipments.aspx +++ b/GPS/Shipments.aspx @@ -8,14 +8,6 @@ display: flex; align-items: center; } - - #DivShipment { - z-index: 1999; - } - - #DivStop { - z-index: 2000; - } @@ -257,11 +249,13 @@ -
- - - -
+
+
+ + + +
+
@@ -306,19 +300,27 @@
-
- - - +
+
+
+ + + +
+

-
- - - +
+
+
+ + + +
+
@@ -346,9 +348,16 @@
-
- - +
+
+
+ + +
+
+
+ +
@@ -510,6 +519,9 @@ var markersEvent = []; var markerEvent; + var searchBox; + var searchBoxEvent; + $(document).ready(function () { initMap(); Sys.Application.add_load(function (s, e) { @@ -517,9 +529,10 @@ }); }); - $('#DivShipment').on('hidden.bs.modal', function () { - return false; - }); + + //$("form").submit(function (event) { + // event.preventDefault(); + //}); function initMap() { @@ -544,65 +557,23 @@ directionsDisplayEvent.setOptions({ suppressMarkers: true }); directionsDisplayEvent.setMap(mapEvent); - var searchBox = new google.maps.places.SearchBox(document.getElementById("<%= TxtLoc.ClientID%>")); - var searchBoxEvent = new google.maps.places.SearchBox(document.getElementById("<%= TxtLoc2.ClientID%>")); + searchBox = new google.maps.places.SearchBox(document.getElementById("<%= TxtLoc.ClientID%>")); + searchBoxEvent = new google.maps.places.SearchBox(document.getElementById("<%= TxtLoc2.ClientID%>")); + $("#<%= TxtLoc.ClientID%>").bind('keypress', function (e) { + if (e.keyCode == 13) { + return false; + } + }); + $("#<%= TxtLoc2.ClientID%>").bind('keypress', function (e) { + if (e.keyCode == 13) { + return false; + } + }); searchBox.addListener('places_changed', function () { - var places = searchBox.getPlaces(); - if (places.length == 0) { - return; - } - var bounds = new google.maps.LatLngBounds(); - places.forEach(function (place) { - if (!place.geometry) { - console.log("Returned place contains no geometry"); - return; - } - var lat = place.geometry.location.lat(); - var lng = place.geometry.location.lng(); - - $("#<%= TxtLatLong.ClientID%>").val(lat + ',' + lng); - - getDirecciones(lat, lng); - - var icon = { - url: 'http://maps.google.com/mapfiles/ms/micons/truck.png', - size: new google.maps.Size(71, 71), - origin: new google.maps.Point(0, 0), - anchor: new google.maps.Point(17, 34), - scaledSize: new google.maps.Size(25, 25) - }; - - marker = new google.maps.Marker({ - map: map, - icon: icon, - title: place.name, - position: place.geometry.location, - draggable: true, - animation: google.maps.Animation.DROP - }); - - google.maps.event.addListener(marker, 'dragend', function () { - var pos = marker.getPosition(); - getDirecciones(pos.lat(), pos.lng()); - }); - // Create a marker for each place. - deleteMarkers(markers); - markers.push(marker); - - if (place.geometry.viewport) { - // Only geocodes have viewport. - bounds.union(place.geometry.viewport); - } else { - bounds.extend(place.geometry.location); - } - - map.fitBounds(bounds); - map.setCenter(bounds.getCenter()); - - }); - + var places = searchBox.getPlaces(); + BuscarDireccion(places); }); searchBoxEvent.addListener('places_changed', function () { @@ -632,6 +603,67 @@ }); } + function BtnBuscar() { + var input = document.getElementById("<%= TxtLoc.ClientID%>"); + + google.maps.event.trigger(input, 'focus', {}); + google.maps.event.trigger(input, 'keydown', { keyCode: 13 }); + google.maps.event.trigger(this, 'focus', {}); + } + function BuscarDireccion(places) { + if (places.length == 0) { + return; + } + var bounds = new google.maps.LatLngBounds(); + places.forEach(function (place) { + if (!place.geometry) { + console.log("Returned place contains no geometry"); + return; + } + var lat = place.geometry.location.lat(); + var lng = place.geometry.location.lng(); + + $("#<%= TxtLatLong.ClientID%>").val(lat + ',' + lng); + + getDirecciones(lat, lng); + + var icon = { + url: 'http://maps.google.com/mapfiles/ms/micons/truck.png', + size: new google.maps.Size(71, 71), + origin: new google.maps.Point(0, 0), + anchor: new google.maps.Point(17, 34), + scaledSize: new google.maps.Size(25, 25) + }; + + marker = new google.maps.Marker({ + map: map, + icon: icon, + title: place.name, + position: place.geometry.location, + draggable: true, + animation: google.maps.Animation.DROP + }); + + google.maps.event.addListener(marker, 'dragend', function () { + var pos = marker.getPosition(); + getDirecciones(pos.lat(), pos.lng()); + }); + // Create a marker for each place. + deleteMarkers(markers); + markers.push(marker); + + if (place.geometry.viewport) { + // Only geocodes have viewport. + bounds.union(place.geometry.viewport); + } else { + bounds.extend(place.geometry.location); + } + + map.fitBounds(bounds); + map.setCenter(bounds.getCenter()); + + }); + } function cargapin(lat, lng) { setTimeout(function () { SetMapPinEvent(lat, lng) }, 1000); } @@ -682,22 +714,21 @@ } markers = []; } + function getDirecciones(lat, lng) { var url = '<%= ClsPaginas.UrlDirecciones%>' + 'nominatim/reverse.php?format=jsonv2&zoom=18&addressdetails=1&lat=' + lat + '&lon=' + lng; $.getJSON(url, function (data) { if (typeof (data.error) === 'undefined') { $("#<%= TxtLatLong.ClientID%>").val(lat + ',' + lng); - $("#<%= TxtAddress.ClientID%>").val(data.display_name); - $("#<%= TxtCity.ClientID%>").val(data.address.city); - $("#<%= TxtState.ClientID%>").val(data.address.state); - $("#<%= TxtContry.ClientID%>").val(data.address.country); - $("#<%= TxtPostalCode.ClientID%>").val(data.address.postcode); - - $('#DivShipment').modal({ backdrop: 'static', keyboard: false }); - } - }); - } + $("#<%= TxtAddress.ClientID%>").val(data.display_name); + $("#<%= TxtCity.ClientID%>").val(data.address.city); + $("#<%= TxtState.ClientID%>").val(data.address.state); + $("#<%= TxtContry.ClientID%>").val(data.address.country); + $("#<%= TxtPostalCode.ClientID%>").val(data.address.postcode); + } + }); + }