351 lines
16 KiB
Plaintext
351 lines
16 KiB
Plaintext
<%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="InicioGPS.aspx.vb" Inherits="GPS_PruebaMaster" %>
|
|
|
|
<%@ MasterType VirtualPath="~/SiteGPS.master" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
|
<style>
|
|
html, body {
|
|
width: 100%;
|
|
height: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
#map {
|
|
width: 100%;
|
|
height: calc(100% - 51px);
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
|
|
#map {
|
|
position: fixed !important;
|
|
}
|
|
|
|
.pac-container.pac-logo {
|
|
z-index: 100000;
|
|
}
|
|
</style>
|
|
</asp:Content>
|
|
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
|
<div id="map"></div>
|
|
<asp:UpdatePanel runat="server" ID="UP">
|
|
<ContentTemplate>
|
|
<asp:HiddenField ID="HdnCveDipositivo" runat="server" ClientIDMode="Static" />
|
|
<asp:Button runat="server" ID="BtnCargar" />
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
|
|
<div id="divComandos" class="modal ADS fade" role="dialog">
|
|
<div class="modal-dialog">
|
|
<asp:UpdatePanel ID="UpAgregar" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
<h4 class="modal-title" id="myModalLabel">Comandos para vehículo: </h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<asp:UpdatePanel ID="UpBodyTipoEquipo" UpdateMode="Conditional" runat="server">
|
|
<ContentTemplate>
|
|
<asp:Button runat="server" ID="BtnCargaComandos" Style="display: none" />
|
|
<asp:GridView ID="GvComandos" runat="server" DataKeyNames="CveComando, RequiereValor" Style="table-layout: fixed" AutoGenerateColumns="False" ShowHeader="True" EmptyDataText="No se encontraron comandos para este modelo" GridLines="none" ToolTip="Listado de Comandos" data-sort="false" CssClass="table table-striped table-hover Widthall ScrollAD">
|
|
<Columns>
|
|
<asp:TemplateField ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
|
|
<ItemTemplate>
|
|
<asp:Button ID="BtnEnviar" runat="server" CssClass="btn btn-primary" CommandName="EnviarComando" CommandArgument="<%# CType(Container, GridViewRow).RowIndex %>" Text="Enviar" />
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
<asp:BoundField HeaderText="Comando" DataField="Comando" ItemStyle-Width="40%" FooterStyle-HorizontalAlign="Left" />
|
|
<asp:TemplateField ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center">
|
|
<HeaderTemplate>Valor</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:TextBox ID="TxtValor" Visible="false" Width="99px" runat="server" Text=""></asp:TextBox>
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
<asp:BoundField DataField="UltimaFechaEjecucion" ItemStyle-Width="20%" HeaderText="Última Ejecución" ItemStyle-HorizontalAlign="center" />
|
|
<asp:BoundField DataField="FechaRespuesta" ItemStyle-Width="20%" HeaderText="Última Respuesta" ItemStyle-HorizontalAlign="center" />
|
|
</Columns>
|
|
</asp:GridView>
|
|
<%--<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 15px;">
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnApagarMotor" CssClass="btn btn-danger" Text="Apagar Motor" />
|
|
</div>
|
|
|
|
<div class="col-md-4" style="padding-right: 0px">
|
|
<asp:TextBox ID="TxtTelefonoPanico" runat="server" Style="width: 150px; height: 100%; float: right;" Type="number" MaxLength="10" />
|
|
<asp:RequiredFieldValidator ID="RFVTelefonoPanico" runat="server" ControlToValidate="TxtTelefonoPanico" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Telefono''</b> es necesario, por favor ingréselo." ValidationGroup="GrpBotonPanico"></asp:RequiredFieldValidator>
|
|
<ajax:ValidatorCalloutExtender ID="VCETelefonoPanico" runat="server" HighlightCssClass="vco" TargetControlID="RFVTelefonoPanico" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnTelefonoPanico" CssClass="btn btn-danger" Text="Telefono Panico" ValidationGroup="GrpBotonPanico" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 15px;">
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnEncenderMotor" CssClass="btn btn-success" Text="Encender Motor" />
|
|
</div>
|
|
|
|
<div class="col-md-4" style="padding-right: 0px">
|
|
<asp:DropDownList CssClass="form-control input-sm" Style="float: right; height: 100%;" ID="DdlTipoBateria" runat="server" Width="150px">
|
|
<asp:ListItem Value="0" Text="ST Solo en Movimiento"></asp:ListItem>
|
|
<asp:ListItem Value="1" Text="Intervalos de Tiempo" Selected="True"></asp:ListItem>
|
|
</asp:DropDownList>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnAhorroBateria" CssClass="btn btn-success" Text="Ahorro Bateria" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 15px;">
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnProbarEncendido" CssClass="btn btn-primary" Text="Abrir Compuerta" />
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnInfoDispositivo" CssClass="btn btn-primary" Text="Cerrar Compuerta" />
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnReinicio" CssClass="btn btn-primary" Text="Reiniciar" />
|
|
</div>
|
|
</div>--%>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
</div>
|
|
<%--<div class="modal-footer">
|
|
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<asp:LinkButton ID="BtnBuscarEquipoC" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='fa fa-search '></i> Buscar</asp:LinkButton>
|
|
<button id="btnCancelar" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
</div>--%>
|
|
</div>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
</div>
|
|
</div>
|
|
</asp:Content>
|
|
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
|
<script>
|
|
var image = '/Imagenes/rsz_11rsz_car.png';
|
|
var geocoder;
|
|
var uluru = { lat: 24.6345, lng: -102.5528 };
|
|
var map;
|
|
var directionsService;
|
|
var directionsDisplay;
|
|
|
|
|
|
|
|
function initMap() {
|
|
|
|
map = new google.maps.Map(document.getElementById('map'), {
|
|
center: uluru,
|
|
zoom: 7
|
|
});
|
|
|
|
google.maps.event.addListener(map, "click", function (event) {
|
|
closeLastOpenedInfoWindow();
|
|
});
|
|
|
|
directionsService = new google.maps.DirectionsService;
|
|
directionsDisplay = new google.maps.DirectionsRenderer;
|
|
directionsDisplay.setOptions({ suppressMarkers: true });
|
|
geocoder = new google.maps.Geocoder();
|
|
directionsDisplay.setMap(map);
|
|
|
|
|
|
var upControlDiv = document.createElement('div');
|
|
var upControl = new ControlLabels(upControlDiv, map);
|
|
|
|
upControlDiv.index = 1;
|
|
map.controls[google.maps.ControlPosition.TOP_LEFT].push(upControlDiv);
|
|
|
|
//var trafficLayer = new google.maps.TrafficLayer();
|
|
//trafficLayer.setMap(map);
|
|
}
|
|
|
|
var markers = [];
|
|
var lastOpenedInfoWindow;
|
|
function CreaMarcador(coords, nomEquipo, ContentString, imagen) {
|
|
if (typeof imagen === 'undefined') { imagen = image; }
|
|
|
|
var markerIcon = {
|
|
url: imagen,
|
|
labelOrigin: new google.maps.Point(26, 43)
|
|
};
|
|
|
|
var marker = new google.maps.Marker({
|
|
position: coords,
|
|
title: nomEquipo,
|
|
map: map,
|
|
icon: markerIcon
|
|
});
|
|
|
|
marker.Nombre = nomEquipo;
|
|
|
|
var infowindow = new google.maps.InfoWindow({
|
|
content: ContentString
|
|
});
|
|
marker.addListener('click', function () {
|
|
closeLastOpenedInfoWindow();
|
|
GetDirecciones(coords, infowindow, marker);
|
|
infowindow.open(map, marker);
|
|
lastOpenedInfoWindow = infowindow;
|
|
});
|
|
markers.push(marker);
|
|
map.setCenter(coords);
|
|
}
|
|
|
|
function fitBoundsToVisibleMarkers() {
|
|
|
|
var bounds = new google.maps.LatLngBounds();
|
|
|
|
for (var i = 0; i < markers.length; i++) {
|
|
if (markers[i].getVisible()) {
|
|
bounds.extend(markers[i].getPosition());
|
|
}
|
|
}
|
|
map.fitBounds(bounds);
|
|
|
|
}
|
|
|
|
function closeLastOpenedInfoWindow() {
|
|
if (lastOpenedInfoWindow) {
|
|
lastOpenedInfoWindow.close();
|
|
}
|
|
}
|
|
function DeleteMarkers() {
|
|
for (var i = 0; i < markers.length; i++) {
|
|
markers[i].setMap(null);
|
|
}
|
|
markers = [];
|
|
directionsDisplay.setMap(null);
|
|
}
|
|
|
|
|
|
$(document).ready(function () {
|
|
initMap();
|
|
$('#C_BtnCargar').click();
|
|
});
|
|
|
|
function CargaComandos(Vehiculo, CveDispositivo) {
|
|
$("#HdnCveDipositivo").val(CveDispositivo)
|
|
// if (open) { FNShowDiv(); }
|
|
$("#myModalLabel").text("Comando para vehículo: " + Vehiculo)
|
|
closeLastOpenedInfoWindow();
|
|
$("#divComandos").modal()
|
|
$("#C_BtnCargaComandos").click()
|
|
|
|
}
|
|
|
|
function ControlLabels(controlDiv, map) {
|
|
|
|
// Set CSS for the control border.
|
|
var controlUI = document.createElement('div');
|
|
controlUI.style.marginLeft = '10px';
|
|
controlUI.style.zIndex = '0';
|
|
controlUI.style.cursor = 'pointer';
|
|
// controlUI.style.position = 'absolute';
|
|
controlUI.style.left = "0px";
|
|
controlUI.style.width = "150px";
|
|
controlUI.style.marginTop = "10px"
|
|
controlUI.style.top = "0px";
|
|
controlUI.className = 'gmnoprint';
|
|
|
|
controlDiv.appendChild(controlUI);
|
|
|
|
var ControlSub1 = document.createElement('div')
|
|
ControlSub1.style.float = 'left';
|
|
ControlSub1.className = 'gm-style-mtc'
|
|
controlUI.appendChild(ControlSub1)
|
|
|
|
var ControlSub2 = document.createElement('div')
|
|
ControlSub2.style.direction = 'ltr';
|
|
ControlSub2.style.overflow = 'hidden';
|
|
ControlSub2.id = "LnkEtiquetas"
|
|
ControlSub2.style.textAlign = 'center';
|
|
ControlSub2.style.position = 'relative';
|
|
ControlSub2.style.color = 'rgb(0,0,0)';
|
|
ControlSub2.style.fontFamily = ' "Open Sans", sans-serif; ';
|
|
ControlSub2.style.msUserSelect = 'none;';
|
|
ControlSub2.style.fontSize = '11px'
|
|
ControlSub2.style.backgroundColor = 'rgb(255,255,255)'
|
|
ControlSub2.style.padding = '11px'
|
|
ControlSub2.style.backgroundClip = 'padding-box'
|
|
ControlSub2.style.minWidth = '28px'
|
|
ControlSub2.style.fontWeight = '500'
|
|
ControlSub2.style.boxShadow = '0 1px 4px -1px rgba(0,0,0,.3)';
|
|
ControlSub2.innerHTML = 'Mostrar Etiquetas'
|
|
ControlSub1.appendChild(ControlSub2)
|
|
|
|
|
|
ControlSub1.addEventListener('click', function () {
|
|
EscondeLabels();
|
|
});
|
|
|
|
}
|
|
var visible = false
|
|
function EscondeLabels() {
|
|
if (visible) {
|
|
for (var i = 0; i < markers.length; i++) {
|
|
markers[i].setLabel(null);
|
|
}
|
|
visible = false
|
|
} else {
|
|
for (var i = 0; i < markers.length; i++) {
|
|
var label = {
|
|
text: markers[i].Nombre,
|
|
fontSize: "12px",
|
|
color: 'black',
|
|
fontWeight: 'bolder'
|
|
}
|
|
markers[i].setLabel(label);
|
|
}
|
|
visible = true
|
|
}
|
|
}
|
|
|
|
function GetDirecciones(posicion, infowindow, marker) {
|
|
if (marker.formatted_address) { return false; }
|
|
else if (marker.formatted_addressrow) {
|
|
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'>" + "Dirección: " + marker.formatted_addressrow + "</div>");
|
|
marker.formatted_address = marker.formatted_addressrow
|
|
}
|
|
else {
|
|
var lat = posicion.lat
|
|
var lng = posicion.lng
|
|
var url = '<%= ClsPaginas.UrlDirecciones%>' + 'nominatim/reverse.php?format=jsonv2&lat=' + lat + '&lon=' + lng;
|
|
|
|
$.getJSON(url, function (data) {
|
|
if (typeof (data.error) === 'undefined') {
|
|
marker.formatted_address = data.display_name
|
|
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'>" + "Dirección: " + data.display_name + "</div>");
|
|
|
|
} else {
|
|
marker.formatted_address = "Dirección no encontrada";
|
|
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'> Dirección: No Encontrada </div>");
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
<script
|
|
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAF7s8wwhzCVXDUYopc9mXxqaWB33cDro4&libraries=places">
|
|
</script>
|
|
<%--<script
|
|
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAJnZ1CoEUX425C20aqzFw4dYxFL_LfThk&libraries=places">
|
|
</script>--%>
|
|
</asp:Content>
|
|
|