CREAR PUNTO DE INTERES EN RASTREO

This commit is contained in:
2020-02-05 18:35:33 -07:00
parent ef8a2a74d1
commit 603dc66866
2 changed files with 1403 additions and 1201 deletions

View File

@@ -255,7 +255,7 @@
<li> <li>
<asp:UpdatePanel runat="server" UpdateMode="conditional"> <asp:UpdatePanel runat="server" UpdateMode="conditional">
<ContentTemplate> <ContentTemplate>
<asp:LinkButton ID="LnkDibujo" OnClientClick="PreparaDibujado();" CommandArgument="KM" Text="<i class='fa fa-pencil-square-o'></i><span>Dibujar GeoReferencia</span>" runat="server"> <asp:LinkButton ID="LnkDibujo" OnClientClick="PreparaDibujado();" CommandArgument="KM" Text="<i class='fa fa-pencil-square-o'></i><span>Dibujar GeoReferencia/Punto de Interés</span>" runat="server">
</asp:LinkButton> </asp:LinkButton>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
@@ -274,6 +274,7 @@
<asp:HiddenField ID="GeoRutaHistorico" runat="server" ClientIDMode="Static" /> <asp:HiddenField ID="GeoRutaHistorico" runat="server" ClientIDMode="Static" />
<asp:HiddenField ID="HdnOpcion" ClientIDMode="static" runat="server" /> <asp:HiddenField ID="HdnOpcion" ClientIDMode="static" runat="server" />
<asp:HiddenField ID="HdnDirecciones" ClientIDMode="static" runat="server" /> <asp:HiddenField ID="HdnDirecciones" ClientIDMode="static" runat="server" />
<asp:HiddenField ID="HdnGrupo" runat="server" Value="-1" ClientIDMode="Static" />
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatosMapa" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpDatosMapa" runat="server" UpdateMode="Conditional">
@@ -860,6 +861,48 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
</div> </div>
<div id="DivAgregarPuntoInteres" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpAgregarPuntoInteres" 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">&times;</span>
</button>
<h4 class="modal-title">Agregar Punto(s) de interés</h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtNombrePI" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVNombrePI" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtNombrePI" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Nombre''</b> es necesario, por favor ingréselo." ValidationGroup="GrpPuntoInteres"></asp:RequiredFieldValidator>
<label id="lblPuntos" for="<%= TxtNombrePI.ClientID.ToString()%>">Nombre Punto De Interés:</label>
</div>
<div class="form-group form-md-line-input input-iconright" style="width: 80%; margin-bottom: 20px;">
<asp:TextBox ID="TxtDescripcion" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtDescripcion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo." ValidationGroup="GrpPuntoInteres"></asp:RequiredFieldValidator>
<label for="<%= TxtDescripcion.ClientID.ToString()%>">Descripción:</label>
</div>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px">
<input type="text" id="TxtGVGrupo" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtGVGrupo','{0}')", GvGrupos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtGVGrupo','{0}')", GvGrupos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<asp:GridView ID="GvGrupos" runat="server" GridLines="None" DataKeyNames="CvePuntoDeInteresGrupo,PuntoDeInteresGrupo,Descripcion" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-height="150" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<Columns>
<asp:BoundField DataField="PuntoDeInteresGrupo" ItemStyle-Width="45%" HeaderText="Agregar a Grupo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Descripcion" ItemStyle-Width="45%" HeaderText="Descripcion" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
</div>
<div class="modal-footer">
<asp:LinkButton ID="BtnAgregarPunto" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpPuntoInteres"> <i class='material-icons'>done_all</i> Agregar</asp:LinkButton>
<button class="btn btn-default" data-dismiss="modal" value="Cancelar">Cancelar </button>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div runat="server" class="row" style="margin: 0px 0px 10px 0px; display: none"> <div runat="server" class="row" style="margin: 0px 0px 10px 0px; display: none">
<asp:Button runat="server" OnClick="btnImprimir_Click" ID="btnImprimir" CommandArgument="PDF" ToolTip="Imprimir en PDF" CssClass="btn btn-circle mysmallbtn grey" Text="<i class='fa fa-print' aria-hidden='true'></i>"></asp:Button> <asp:Button runat="server" OnClick="btnImprimir_Click" ID="btnImprimir" CommandArgument="PDF" ToolTip="Imprimir en PDF" CssClass="btn btn-circle mysmallbtn grey" Text="<i class='fa fa-print' aria-hidden='true'></i>"></asp:Button>
<asp:Button runat="server" OnClick="btnImprimir_Click" ID="BtnImprimirEX" CommandArgument="EXCEL" ToolTip="Imprimir en EXCEL" CssClass="btn btn-circle btn-xs mysmallbtn green" Text="<i class='fa fa-file-excel-o' aria-hidden='true'></i>"></asp:Button> <asp:Button runat="server" OnClick="btnImprimir_Click" ID="BtnImprimirEX" CommandArgument="EXCEL" ToolTip="Imprimir en EXCEL" CssClass="btn btn-circle btn-xs mysmallbtn green" Text="<i class='fa fa-file-excel-o' aria-hidden='true'></i>"></asp:Button>
@@ -2147,6 +2190,16 @@
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(routeControlDiv); map.controls[google.maps.ControlPosition.TOP_RIGHT].push(routeControlDiv);
} }
if ($("#DvGuardarPI").length <= 0) {
var routeControlDiv = document.createElement('div');
var routeControl = new ControlGuardarPuntoInteres(routeControlDiv, map);
routeControlDiv.id = "DvGuardarPI"
if (typeof (index) !== 'undefined') {
routeControlDiv.index = index + 1;
}
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(routeControlDiv);
}
} }
function PreparaDibujadoHistorico() { function PreparaDibujadoHistorico() {
if ($("#DvGuardarHistorico").length <= 0) { if ($("#DvGuardarHistorico").length <= 0) {
@@ -2216,7 +2269,7 @@
controlUI.style.cursor = 'pointer'; controlUI.style.cursor = 'pointer';
// controlUI.style.position = 'absolute'; // controlUI.style.position = 'absolute';
controlUI.style.left = "0px"; controlUI.style.left = "0px";
controlUI.style.width = "150px"; controlUI.style.width = "300px";
controlUI.style.marginTop = "10px" controlUI.style.marginTop = "10px"
controlUI.style.top = "0px"; controlUI.style.top = "0px";
controlUI.className = 'gmnoprint'; controlUI.className = 'gmnoprint';
@@ -2272,8 +2325,36 @@
ControlSub4.innerHTML = 'Georuta' ControlSub4.innerHTML = 'Georuta'
ControlSub3.appendChild(ControlSub4) ControlSub3.appendChild(ControlSub4)
var ControlSub5 = document.createElement('div')
ControlSub5.style.float = 'left';
ControlSub5.className = 'gm-style-mtc'
controlUI.appendChild(ControlSub5)
var ControlSub6 = document.createElement('div')
ControlSub6.style.direction = 'ltr';
ControlSub6.style.overflow = 'hidden';
ControlSub6.style.textAlign = 'center';
ControlSub6.id = "PuntoInteres"
ControlSub6.style.position = 'relative';
ControlSub6.style.color = 'rgb(86,86,86)';
ControlSub6.style.fontFamily = ' "Open Sans", sans-serif; ';
ControlSub6.style.msUserSelect = 'none;';
ControlSub6.style.fontSize = '11px'
ControlSub6.style.backgroundColor = 'rgb(255,255,255)'
ControlSub6.style.padding = '11px'
ControlSub6.style.backgroundClip = 'padding-box'
ControlSub6.style.minWidth = '38px'
ControlSub6.style.fontWeight = '500'
ControlSub6.style.boxShadow = '0 1px 4px -1px rgba(0,0,0,.3)';
ControlSub6.style.borderLeft = '0px;'
ControlSub6.innerHTML = 'Punto de Interés'
ControlSub5.appendChild(ControlSub6)
// Setup the click event listeners: simply set the map to Chicago. // Setup the click event listeners: simply set the map to Chicago.
ControlSub5.addEventListener('click', function () {
CambiaTipo('PuntoInteres');
});
ControlSub3.addEventListener('click', function () { ControlSub3.addEventListener('click', function () {
CambiaTipo('Georuta'); CambiaTipo('Georuta');
}); });
@@ -2444,22 +2525,89 @@
} }
function ControlGuardarPuntoInteres(controlDiv, map) {
// Set CSS for the control border.
var controlUI = document.createElement('div');
controlUI.id = "btnGuardarPuntoInteres"
controlUI.style.display = 'none';
controlUI.style.backgroundColor = '#4B77BE';
controlUI.style.color = "#fff";
controlUI.style.borderRadius = '3px';
controlUI.style.width = '165px'
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
controlUI.style.cursor = 'pointer';
controlUI.style.marginRight = '5px';
controlUI.style.marginTop = '5px';
controlUI.style.marginBottom = '22px';
controlUI.style.textAlign = 'center';
controlUI.title = 'Guardar el punto de interés';
controlDiv.appendChild(controlUI);
// Set CSS for the control interior.
var controlText = document.createElement('div');
controlText.style.color = '#fff';
controlText.style.fontFamily = ' "Open Sans", sans-serif; ';
controlText.style.fontSize = '14px';
controlText.style.lineHeight = '38px';
controlText.style.paddingLeft = '5px';
controlText.style.paddingRight = '5px';
controlText.innerHTML = 'Guardar Punto de Interés';
controlUI.appendChild(controlText);
// Setup the click event listeners: simply set the map to Chicago.
controlUI.addEventListener('click', function () {
$("#C_TxtNombrePI").val("")
$("#C_TxtDescripcion").val("")
$("#HdnGrupo").val("-1");
$("#GeoCerca").val("");
if (markersg.length > 0) {
var punto = "(" + markersg[0].position.lng() + ' ' + markersg[0].position.lat() + ")";
$("#GeoCerca").val(punto);
$("#DivAgregarPuntoInteres").modal({ backdrop: 'static', keyboard: false });
} else {
alert("No hay puntos de interés en el mapa");
}
});
}
var indiceAnterior = 0;
function CargaDatosSeleccionados(indice, valor) {
var columnaSeleccionada = 2 + indice;
$('#HdnGrupo').val(valor);
$('#C_GvGrupos tr').filter(':nth-child(' + indiceAnterior + ')').css('background-color', 'initial');
$('#C_GvGrupos tr').filter(':nth-child(' + columnaSeleccionada + ')').css('background-color', '#F5B27A');
indiceAnterior = columnaSeleccionada;
}
function CambiaTipo(Tipo) { function CambiaTipo(Tipo) {
DeleteMarkersG(); DeleteMarkersG();
if (Tipo === 'Geocerca') { if (Tipo === 'Geocerca') {
$("#HdnTipo").val('Geocerca') $("#HdnTipo").val('Geocerca')
$("#Geocerca").css("font-weight", "bold") $("#Geocerca").css("font-weight", "bold")
$("#Georuta").css("font-weight", "normal") $("#Georuta").css("font-weight", "normal")
$("#PuntoInteres").css("font-weight", "normal")
} else if (Tipo === 'Georuta') { } else if (Tipo === 'Georuta') {
$("#HdnTipo").val('Georuta') $("#HdnTipo").val('Georuta')
$("#Geocerca").css("font-weight", "normal") $("#Geocerca").css("font-weight", "normal")
$("#Georuta").css("font-weight", "bold") $("#Georuta").css("font-weight", "bold")
$("#PuntoInteres").css("font-weight", "normal")
} else if (Tipo === 'PuntoInteres') {
$("#HdnTipo").val('PuntoInteres')
$("#Geocerca").css("font-weight", "normal")
$("#Georuta").css("font-weight", "normal")
$("#PuntoInteres").css("font-weight", "bold")
} }
} }
function addLatLng(event) { function addLatLng(event) {
// var path = poly.getPath(); //SOLO SE PUEDE AGREGAR UN PUNTO DE INTERES A LA VEZ
// path.push(event.latLng); if (markersg.length >= 1 && $("#HdnTipo").val() === 'PuntoInteres') {
$("#btnGuardarPuntoInteres").css("display", "")
return;
}
var lat = event.latLng.lat(); var lat = event.latLng.lat();
var lng = event.latLng.lng(); var lng = event.latLng.lng();
mcoords.push(event.latLng) mcoords.push(event.latLng)
@@ -2477,6 +2625,7 @@
marker.addListener('click', function () { marker.addListener('click', function () {
info.open(map, marker); info.open(map, marker);
}); });
if ($("#HdnTipo").val() === 'Georuta') { if ($("#HdnTipo").val() === 'Georuta') {
if (markersg.length > 1) { if (markersg.length > 1) {
CreaRuta(); CreaRuta();
@@ -2496,6 +2645,10 @@
var path = polygon.getPath(); var path = polygon.getPath();
path.push(event.latLng) path.push(event.latLng)
} }
} else if ($("#HdnTipo").val() === 'PuntoInteres') {
if (markersg.length > 0) {
$("#btnGuardarPuntoInteres").css("display", "")
}
} }
} }
@@ -2558,12 +2711,12 @@
markersg[markersg.length - 1].setMap(null) markersg[markersg.length - 1].setMap(null)
markersg.splice((markersg.length - 1), 1); markersg.splice((markersg.length - 1), 1);
mcoords.splice((mcoords.length - 1), 1); mcoords.splice((mcoords.length - 1), 1);
if ($("#HdnTipo").val() === 'Georuta') { if ($("#HdnTipo").val() === 'Georuta') {
if (markersg.length >= 2) { if (markersg.length >= 2) {
CreaRuta(); CreaRuta();
} else { directionsDisplay.setMap(null); $("#btnGuardarRuta").css("display", "none"); } } else { directionsDisplay.setMap(null); $("#btnGuardarRuta").css("display", "none"); }
} } else if ($("#HdnTipo").val() === 'Geocerca') {
else if ($("#HdnTipo").val() === 'Geocerca') {
if (typeof polygon != 'undefined') { if (typeof polygon != 'undefined') {
polygon.setMap(null); polygon.setMap(null);
if (markersg.length >= 3) { if (markersg.length >= 3) {
@@ -2583,6 +2736,10 @@
$('#CommandArg').val(lng + " " + lat) $('#CommandArg').val(lng + " " + lat)
} }
} }
} else if ($("#HdnTipo").val() === 'PuntoInteres') {
if (markersg.length <= 0) {
$("#btnGuardarPuntoInteres").css("display", "none")
}
} }
} }
} }
@@ -2598,7 +2755,8 @@
if (typeof polygon != 'undefined') { if (typeof polygon != 'undefined') {
polygon.setMap(null); polygon.setMap(null);
} }
$("#btnGuardarRuta").css("display", "none") $("#btnGuardarRuta").css("display", "none");
$("#btnGuardarPuntoInteres").css("display", "none");
} }
function CambiaColor() { function CambiaColor() {

View File

@@ -127,6 +127,7 @@ Partial Class GPS_Rastreo
CargaDispositivos() CargaDispositivos()
CargaEventos() CargaEventos()
CargaGrupos() CargaGrupos()
CargaGruposPI()
CreaTmpDTDetalle() CreaTmpDTDetalle()
IndiceGV = 0 IndiceGV = 0
End If End If
@@ -144,6 +145,16 @@ Partial Class GPS_Rastreo
RegistraScript("$('#C_GvDispositivos_chkSelectAll').click(function () { $("".ChkAllEvt input"").not(this).prop('checked',$(this).is(':checked')); });", "1") RegistraScript("$('#C_GvDispositivos_chkSelectAll').click(function () { $("".ChkAllEvt input"").not(this).prop('checked',$(this).is(':checked')); });", "1")
End Sub End Sub
Private Sub CargaGruposPI()
Dim ObjGPS As New ClsGPS
If ObjGPS.PuntoDeInteresGrupoGet(-1, 1) Then
GvGrupos.DataSource = ObjGPS.DtResultados
End If
ObjGPS.Dispose()
GvGrupos.DataBind()
UpAgregarPuntoInteres.Update()
End Sub
Private Sub CargaEventos() Private Sub CargaEventos()
Dim GPS As New ClsGPS Dim GPS As New ClsGPS
@@ -2177,4 +2188,37 @@ Partial Class GPS_Rastreo
End Sub End Sub
#End Region #End Region
Protected Sub GvGrupos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvGrupos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onClick", $"CargaDatosSeleccionados({e.Row.RowIndex}, '{e.Row.DBCampo("CvePuntoDeInteresGrupo").ToString}');")
End If
End Sub
Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click
Dim HuboError = False
Dim ObjGPS As New ClsGPS
ObjGPS.IniciaTransacSQL()
Try
Dim GEOM As String = $"POINT{GeoCerca.Value}"
If Not ObjGPS.PuntoDeInteresAdd(TxtNombrePI.Text, UsuarioActual.CveCliente, GEOM, True, TxtDescripcion.Text, HdnGrupo.Value.ToEntero) Then
HuboError = True
End If
Catch ex As Exception
HuboError = True
OnError("Ocurrió un error al agregar el punto de interés", ex)
End Try
If HuboError Then
ObjGPS.RollBack()
Else
ObjGPS.Commit()
TxtDescripcion.Text = ""
TxtNombre.Text = ""
Alert("El punto de interés se agregó correctamente", TipoMensaje.MsgInformacion)
RegistraScript("$('#DivAgregarPuntoInteres').modal('hide');DeleteMarkersG();", "1")
End If
UpAgregarPuntoInteres.Update()
End Sub
End Class End Class