142 lines
6.0 KiB
Plaintext
142 lines
6.0 KiB
Plaintext
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeBehind="gestDelegados.aspx.vb" Async="true" Inherits="WebIntranet.gestDelegados" %>
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="server">
|
|
<div class="row pag">
|
|
<div id="CambioRol" runat="server" class="col" style="">
|
|
<h2 class="titularOpcControlHorario mb-4 mt-4">Gestionar delegados</h2>
|
|
<div style="display: flex; justify-content: center;">
|
|
<select id="deparSelect" runat="server" style="display: none" onchange="CargarDelegados()" class="selectIn"></select>
|
|
</div>
|
|
<p style="text-align: center; font-weight: bold" id="mensajeDelegados"></p>
|
|
<div class="row" style="margin: 0px; padding-inline: 50px">
|
|
<div id="SeleccionPersonas" class="col colorFondoSeleccionPersonas">
|
|
<p style="margin-top: 10px; margin-left: 10px; font-weight: bold; color: var(--AzulOscuro); font-size: 18px">Personas</p>
|
|
<div id="cajaPersonas" style="max-height: 65vh; text-transform: capitalize; overflow: auto" class="row" runat="server">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div style="display: flex; justify-content: center; margin-top: 25px">
|
|
<input type="button" value="Guardar cambios" class="btnAlargado btnAzul" onclick="GuardarCambiosDelegados()" style="width: 400px; margin-top: 50px;" />
|
|
</div>
|
|
<div>
|
|
<div id="mensajeErrorRolDiv" style="position: fixed; top: 0; left: 0; height: 100vh; width: 100%; background-color: #000000d1; z-index: 20; display: none">
|
|
<div style="max-width: 500px; padding: 20px; background-color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-inline: auto; margin-top: 300px;">
|
|
<p id="mensajeErrorUsuarioRol" style="color: red; font-weight: bold; font-size: 20px; text-align: center; margin-block: 10px;"></p>
|
|
<input type="button" value="Continuar" onclick="$('#mensajeErrorUsuarioDiv').css('display','none')" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
window.addEventListener("load", function (event) {
|
|
|
|
if (sessionStorage.getItem("msj") != null) {
|
|
var msj = this.sessionStorage.getItem("msj")
|
|
var clr = this.sessionStorage.getItem("clr")
|
|
MostrarMensaje(msj, clr)
|
|
this.sessionStorage.removeItem("msj")
|
|
this.sessionStorage.removeItem("clr")
|
|
}
|
|
|
|
})
|
|
|
|
function CargarDelegados() {
|
|
var departamento = $("#deparSelect").val()
|
|
|
|
$.ajax({
|
|
type: "post",
|
|
url: "/gestDelegados.aspx/cargarPersonasDelegados",
|
|
data: '{"dep":"' + departamento + '"}',
|
|
async: true,
|
|
contentType: "application/json; charset=utf-8",
|
|
success: function (result) {
|
|
if (result.d != "") {
|
|
if (result.d.includes("ERROR--")) {
|
|
compEr(result.d)
|
|
return
|
|
}
|
|
$("#cajaPersonas").html(result.d)
|
|
}
|
|
},
|
|
error: function (result) {
|
|
alert('error occured');
|
|
//alert(result.responseText);
|
|
},
|
|
});
|
|
|
|
}
|
|
CargarDelegados()
|
|
function GuardarCambiosDelegados() {
|
|
var CheckUsuarioDel = $(".divUsuarioDel")
|
|
var checksmarcados = ""
|
|
var cont = 0
|
|
|
|
var campoActivo = ($("#deparSelect").val() == "SUPTODO") ? 'DelegadoSupervisordeTodo' : 'Delegado';
|
|
var campoInactivo = ($("#deparSelect").val() == "SUPTODO") ? 'Delegado' : 'DelegadoSupervisordeTodo';
|
|
|
|
|
|
for (var i = 0; i < CheckUsuarioDel.length; i++) {
|
|
if (cont > 0) {
|
|
checksmarcados += ","
|
|
}
|
|
if (CheckUsuarioDel[i].children[1].checked == true) {
|
|
checksmarcados += "{'Nif':'" + CheckUsuarioDel[i].id + "','Delegado':'True'}"
|
|
}
|
|
else {
|
|
checksmarcados += "{'Nif':'" + CheckUsuarioDel[i].id + "','Delegado':'False'}"
|
|
}
|
|
cont += 1
|
|
|
|
}
|
|
checksmarcados = "[" + checksmarcados + "]"
|
|
|
|
$.ajax({
|
|
type: "post",
|
|
contentType: "application/json",
|
|
url: "/gestDelegados.aspx/GuardarCambiosDelegado",
|
|
data: '{"personas":"' + checksmarcados + '"}',
|
|
dataType: "json",
|
|
success: function (result) {
|
|
if (result.d != "") {
|
|
if (result.d.Result.includes("ERROR--")) {
|
|
compEr(result.d.Result)
|
|
return
|
|
}
|
|
var resultado = JSON.parse(result.d.Result)
|
|
if (resultado.Resultado == "0") {
|
|
sessionStorage.setItem("msj", resultado.Mensaje.toUpperCase())
|
|
sessionStorage.setItem("clr", "#02bd02")
|
|
location.reload()
|
|
//$("#mensajeDelegados").text(resultado.Mensaje.toUpperCase())
|
|
//$("#mensajeDelegados").css("color", "#02bd02")
|
|
//CargarDelegados()
|
|
}
|
|
else {
|
|
sessionStorage.setItem("msj", resultado.Mensaje.toUpperCase())
|
|
sessionStorage.setItem("clr", "red")
|
|
location.reload()
|
|
//$("#mensajeDelegados").text(resultado.Mensaje.toUpperCase())
|
|
//$("#mensajeDelegados").css("color", "red")
|
|
}
|
|
}
|
|
},
|
|
error: function (result) {
|
|
alert('error occured');
|
|
//alert(result.responseText);
|
|
},
|
|
|
|
});
|
|
|
|
|
|
}
|
|
function MostrarMensaje(mensaje, color) {
|
|
$("#mensajeDelegados").text(mensaje.toUpperCase())
|
|
$("#mensajeDelegados").css("color", color)
|
|
}
|
|
</script>
|
|
|
|
</asp:Content>
|