cambios para multi url y generica
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
@inject UserState userState
|
||||
@inject IJSRuntime JS
|
||||
@using bdHerramientaCACOA.db
|
||||
@inject UserState UserState
|
||||
|
||||
|
||||
<head>
|
||||
@@ -46,7 +47,7 @@
|
||||
</button>
|
||||
<a class="navbar-brand" href="@urlWeb">
|
||||
@* <img src="Content/Imagenes/logo_CACOA_alta.jpg" style="height: 40px" class="logoCacoa" /> *@
|
||||
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" style="height: 50px; width:220px;" class="logoCacoa" />
|
||||
<img src="data:image/png;base64, @System.Convert.ToBase64String(logoColegioArray)" style="height: 50px; width:220px;" class="logoCacoa" />
|
||||
|
||||
</a>
|
||||
</div>
|
||||
@@ -108,8 +109,8 @@
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
// protected override async Task OnInitializedAsync()
|
||||
// {
|
||||
@@ -148,28 +149,17 @@
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||
|
||||
if (!string.IsNullOrEmpty(urlAnterior))
|
||||
if (!UserState.PuedeAcceder)
|
||||
{
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
if (!UtilidadesCASA.UrlPermitida(urlAnterior, bd))
|
||||
{
|
||||
if (urlColegio != null && !urlAnterior.Contains(urlColegio))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
else if (userState.idUser == 0)
|
||||
{
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
|
||||
if (userState.idUser == 0)
|
||||
{
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
46
HerramientaCASA/Components/Layout/DenegadoLayout.razor
Normal file
46
HerramientaCASA/Components/Layout/DenegadoLayout.razor
Normal file
@@ -0,0 +1,46 @@
|
||||
@inherits LayoutComponentBase
|
||||
@using BlazorBootstrap;
|
||||
@using HerramientaCASA.Model
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@inject UserState UserState
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JS
|
||||
@using bdHerramientaCACOA.db
|
||||
|
||||
|
||||
<head>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
|
||||
<link href="_content/Blazor.Bootstrap/blazor.bootstrap.css" rel="stylesheet" />
|
||||
<link href="_content/Blazor.Bootstrap/Blazor.Bootstrap.bundle.scp.css" rel="stylesheet" />
|
||||
<link href="Content/Site.css?v=0.70" rel="stylesheet" />
|
||||
<link href="Content/all.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<script src="Scripts/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.2.0/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
|
||||
<script src="_content/Blazor.Bootstrap/blazor.bootstrap.js"></script>
|
||||
<script src="Scripts/popper.min.js"></script>
|
||||
<script src="Scripts/all.min.js"></script>
|
||||
<script src="Scripts/Util.js"></script>
|
||||
</head>
|
||||
|
||||
|
||||
<div class="main" style="position: absolute;width: 100%;top: 0px;">
|
||||
<div class="">
|
||||
@Body
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JS
|
||||
@using bdHerramientaCACOA.db
|
||||
|
||||
@inject UserState UserState
|
||||
|
||||
<head>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
@@ -53,32 +53,14 @@
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||
|
||||
if (!string.IsNullOrEmpty(urlAnterior))
|
||||
{
|
||||
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (urlColegio != null && !urlAnterior.Contains(urlColegio))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (urlColegio != null)
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
//urlAnterior = "https://www.cacoa.es";
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
if (!UtilidadesCASA.UrlPermitida(urlAnterior,bd))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
@inject UserState userState
|
||||
@inject IJSRuntime JS
|
||||
@using bdHerramientaCACOA.db
|
||||
@inject UserState UserState
|
||||
|
||||
|
||||
<head>
|
||||
@@ -47,9 +48,12 @@
|
||||
<a href="https://cacoa.es/">
|
||||
<img src="Content/Imagenes/logo_CACOA_alta.jpg" style="height: 40px" class="logoCacoa" />
|
||||
</a>
|
||||
<a href="@urlWeb">
|
||||
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" style="max-height: 40px;" class="logoCacoa" />
|
||||
</a>
|
||||
@if (nombreColegio != "CACOA")
|
||||
{
|
||||
<a href="@urlWeb">
|
||||
<img src="data:image/png;base64, @System.Convert.ToBase64String(logoColegioArray)" style="max-height: 40px;" class="logoCacoa" />
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="topMenu">
|
||||
@if (!MostrarExtra)
|
||||
@@ -124,39 +128,27 @@
|
||||
string rutaActual = "";
|
||||
string urlWeb = "";
|
||||
private byte[] logoColegioArray = [];
|
||||
|
||||
private string nombreColegio = "";
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||
|
||||
if (!string.IsNullOrEmpty(urlAnterior))
|
||||
{
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (urlColegio != null && !urlAnterior.Contains(urlColegio))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
|
||||
if (userState.idUser == 0 )
|
||||
{
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
StateHasChanged();
|
||||
if (!UserState.PuedeAcceder)
|
||||
{
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
if (!UtilidadesCASA.UrlPermitida(urlAnterior, bd))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
else if (userState.idUser == 0)
|
||||
{
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,8 +156,7 @@
|
||||
{
|
||||
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
// Redirigir al home si no hay token y la ruta no es pública
|
||||
nombreColegio = bd.enumeraciones.First(x => x.Codigo == "CW.NOMBRECOLEGIO").ValorAlfabetico1;
|
||||
logoColegioArray = bd.ficheros.Where(x => x.NombreFichero == "LogoColegio").Select(x => x.Fichero).First();
|
||||
|
||||
urlWeb = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLWEBCOLEGIO")).ValorAlfabetico1;
|
||||
|
||||
@@ -98,6 +98,13 @@
|
||||
</div>
|
||||
</Content>
|
||||
</Tab>
|
||||
<Tab Title="Urls Permitidas" Name="tabUrlsPerm">
|
||||
<Content>
|
||||
<div class="CajaTab p-2">
|
||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EnumeracionesTabs.UrlsPermitidas></HerramientaCASA.Components.Pages.ConfiguracionPages.EnumeracionesTabs.UrlsPermitidas>
|
||||
</div>
|
||||
</Content>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
@inject NavigationManager Navigation
|
||||
@layout ConfiguracionLayout
|
||||
@using BlazorBootstrap
|
||||
@using System.Globalization
|
||||
@using bdHerramientaCACOA.db
|
||||
|
||||
<Toasts class="p-3 font-weight-bold" Style="color:white;" AutoHide="true" Delay="4000" Messages="mensajes" Placement="ToastsPlacement.BottomCenter" />
|
||||
|
||||
<Modal @ref="popupConfirmarBorrado" title="" IsVerticallyCentered="true" UseStaticBackdrop="true" CloseOnEscape="false">
|
||||
<BodyTemplate>
|
||||
<div class="col-12 formatoCampos">
|
||||
¿Estás seguro que desea eliminarlo?
|
||||
</div>
|
||||
</BodyTemplate>
|
||||
<FooterTemplate>
|
||||
<Button Color="ButtonColor.Secondary" @onclick="cerrarPopupConfirmarBorrado">Cerrar</Button>
|
||||
<Button @onclick="@(() => BorrarItem())" Color="ButtonColor.Danger">Eliminar</Button>
|
||||
</FooterTemplate>
|
||||
</Modal>
|
||||
|
||||
<EditForm EditContext="@editContext" OnValidSubmit="guardarFormulario" OnInvalidSubmit="@MostrarErrores" FormName="UrlsPermForm">
|
||||
<DataAnnotationsValidator></DataAnnotationsValidator>
|
||||
<Modal @ref="popupGestionDatos" title="@tituloPopup" IsVerticallyCentered="true" UseStaticBackdrop="true" CloseOnEscape="false">
|
||||
<BodyTemplate>
|
||||
<div class="row">
|
||||
<div class="col-12 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Descripción:</label>
|
||||
<InputText MaxLength="40" @bind-Value="descripcionItem" @oninput="e => ValidarYActualizar(e, nameof(descripcionItem))" class="inputForm"></InputText>
|
||||
</div>
|
||||
<div class="validation-message">@GetExternalValidationMessage(nameof(descripcionItem))</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Url:</label>
|
||||
<InputText MaxLength="40" @bind-Value="urlItem" @oninput="e => ValidarYActualizar(e, nameof(urlItem))" class="inputForm"></InputText>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</BodyTemplate>
|
||||
<FooterTemplate>
|
||||
<Button Color="ButtonColor.Secondary" @onclick="cerrarPopupGestionDatos">Cerrar</Button>
|
||||
<Button Type="ButtonType.Submit" Color="ButtonColor.Primary">@(nuevoElemento ? "Añadir" : "Modificar")</Button>
|
||||
</FooterTemplate>
|
||||
</Modal>
|
||||
</EditForm>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
<div class="d-flex justify-content-between mt-3">
|
||||
<small><b class="Fuente2"></b>Estas son las urls que pueden redireccionar a la web, si no aparece aqui devuelve un acceso denegado</small>
|
||||
<button @onclick="@(() => abrirPopupGestionDatos(new bdHerramientaCACOA.db.urlspermitidas(), true))" class="btnBlue d-flex align-items-center"> <i class="fas fa-plus-square pe-1"></i> Nueva urls permitida</button>
|
||||
</div>
|
||||
|
||||
<Grid TItem="bdHerramientaCACOA.db.urlspermitidas"
|
||||
Class="tablaCACOA table"
|
||||
Data="listadoUrls"
|
||||
AllowFiltering="false"
|
||||
PageSize="10"
|
||||
FixedHeader="true"
|
||||
Height="750"
|
||||
Unit="Unit.Px"
|
||||
EmptyText="No hay registros."
|
||||
PageSizeSelectorVisible="false"
|
||||
Responsive="true">
|
||||
<GridColumns>
|
||||
<GridColumn TItem="bdHerramientaCACOA.db.urlspermitidas" HeaderTextAlignment="Alignment.Center" HeaderText="Descripción">
|
||||
<span>@context.descripcion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="bdHerramientaCACOA.db.urlspermitidas" Class="text-end" HeaderTextAlignment="Alignment.Center" HeaderText="URL">
|
||||
<span>@context.url</span>
|
||||
</GridColumn>
|
||||
<GridColumn TItem="bdHerramientaCACOA.db.urlspermitidas" Class="botonesTabla" HeaderText="">
|
||||
<div class="btnTablasEspaciado">
|
||||
<span @onclick="@(() => abrirPopupGestionDatos(@context,false))" class="btnBorrarGuardar">
|
||||
<Icon CustomIconName="fas fa-edit"></Icon>
|
||||
</span>
|
||||
<span @onclick="@(() => abrirPopupConfirmarBorrado(@context))" class="btnBorrarGuardar">
|
||||
<Icon CustomIconName="fas fa-trash"></Icon>
|
||||
</span>
|
||||
</div>
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
</Grid>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
public List<bdHerramientaCACOA.db.urlspermitidas> listadoUrls { get; set; } = new List<bdHerramientaCACOA.db.urlspermitidas>();
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
private urlspermitidas itemSeleccionado { get; set; } = new bdHerramientaCACOA.db.urlspermitidas();
|
||||
|
||||
private string tituloPopup = "";
|
||||
private Modal popupGestionDatos = default!;
|
||||
private Modal popupConfirmarBorrado = default!;
|
||||
|
||||
private bool nuevoElemento;
|
||||
|
||||
private string descripcionItem = "";
|
||||
private string urlItem = "";
|
||||
|
||||
List<ToastMessage> mensajes = new List<ToastMessage>();
|
||||
|
||||
private EditContext? editContext;
|
||||
private ValidationMessageStore? messageStore;
|
||||
public tsHerramientasCACOA bd;
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
editContext = new EditContext(itemSeleccionado);
|
||||
messageStore = new ValidationMessageStore(editContext);
|
||||
|
||||
listadoUrls = bd.urlspermitidas.ToList();
|
||||
}
|
||||
|
||||
|
||||
private async Task abrirPopupGestionDatos(bdHerramientaCACOA.db.urlspermitidas objeto, bool esNuevo)
|
||||
{
|
||||
itemSeleccionado = objeto;
|
||||
|
||||
if (esNuevo)
|
||||
{
|
||||
nuevoElemento = true;
|
||||
descripcionItem = "";
|
||||
urlItem = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
nuevoElemento = false;
|
||||
descripcionItem = objeto.descripcion;
|
||||
urlItem = objeto.url;
|
||||
}
|
||||
|
||||
if (!nuevoElemento)
|
||||
{
|
||||
tituloPopup = "Modificar Url";
|
||||
}
|
||||
else
|
||||
{
|
||||
tituloPopup = "Nueva Url";
|
||||
}
|
||||
|
||||
await popupGestionDatos.ShowAsync();
|
||||
}
|
||||
private async Task cerrarPopupGestionDatos()
|
||||
{
|
||||
await popupGestionDatos.HideAsync();
|
||||
}
|
||||
|
||||
private void ValidarYActualizar(ChangeEventArgs e, string fieldName)
|
||||
{
|
||||
var value = e.Value?.ToString();
|
||||
var field = new FieldIdentifier(itemSeleccionado, fieldName);
|
||||
|
||||
switch (fieldName)
|
||||
{
|
||||
case nameof(descripcionItem):
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
|
||||
descripcionItem = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
descripcionItem = "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
messageStore?.Clear(field);
|
||||
if (fieldName == nameof(descripcionItem) && descripcionItem == "")
|
||||
{
|
||||
messageStore?.Add(field, "La descripción no puede estar vacía.");
|
||||
}
|
||||
|
||||
editContext?.NotifyValidationStateChanged();
|
||||
}
|
||||
|
||||
private void ValidarTodo()
|
||||
{
|
||||
ValidarYActualizar(new ChangeEventArgs { Value = descripcionItem }, nameof(descripcionItem));
|
||||
}
|
||||
|
||||
private string GetExternalValidationMessage(string fieldName)
|
||||
{
|
||||
var field = new FieldIdentifier(itemSeleccionado, fieldName);
|
||||
return messageStore?[field].FirstOrDefault() ?? string.Empty;
|
||||
}
|
||||
|
||||
private async Task GestionarDatos(string accion)
|
||||
{
|
||||
var urlExistente = bd.urlspermitidas.Where(x => x.idUrlsPermitidas == itemSeleccionado.idUrlsPermitidas).FirstOrDefault();
|
||||
switch (accion)
|
||||
{
|
||||
case "update":
|
||||
urlExistente.descripcion = descripcionItem;
|
||||
urlExistente.url = urlItem;
|
||||
bd.urlspermitidas.Update(urlExistente);
|
||||
|
||||
await cerrarPopupGestionDatos();
|
||||
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Primary,
|
||||
Message = $"Actualizado correctamente.",
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case "create":
|
||||
itemSeleccionado.descripcion = descripcionItem;
|
||||
itemSeleccionado.url = urlItem;
|
||||
bd.urlspermitidas.Add(itemSeleccionado);
|
||||
await cerrarPopupGestionDatos();
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Primary,
|
||||
Message = $"Guardado correctamente.",
|
||||
});
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
bd.urlspermitidas.Remove(urlExistente);
|
||||
await cerrarPopupConfirmarBorrado();
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Primary,
|
||||
Message = $"Eliminado correctamente.",
|
||||
});
|
||||
break;
|
||||
}
|
||||
bd.SaveChanges();
|
||||
listadoUrls = bd.urlspermitidas.ToList();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
private async Task BorrarItem()
|
||||
{
|
||||
await GestionarDatos("delete");
|
||||
}
|
||||
//////// PopUp eliminar registro
|
||||
private async Task abrirPopupConfirmarBorrado(bdHerramientaCACOA.db.urlspermitidas objeto)
|
||||
{
|
||||
itemSeleccionado = objeto;
|
||||
await popupConfirmarBorrado.ShowAsync();
|
||||
}
|
||||
private async Task cerrarPopupConfirmarBorrado()
|
||||
{
|
||||
await popupConfirmarBorrado.HideAsync();
|
||||
}
|
||||
|
||||
// GUARDAR
|
||||
private async Task guardarFormulario()
|
||||
{
|
||||
try
|
||||
{
|
||||
ValidarTodo();
|
||||
|
||||
if (!editContext!.GetValidationMessages().Any())
|
||||
{
|
||||
string accion = nuevoElemento ? "create" : "update";
|
||||
await GestionarDatos(accion);
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Warning,
|
||||
Message = $"Debe rellenar los campos obligatorios.",
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Danger,
|
||||
Message = $"Error al guardar.",
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MostrarErrores()
|
||||
{
|
||||
messageStore?.Clear();
|
||||
foreach (var field in new[] { nameof(descripcionItem)})
|
||||
{
|
||||
ValidarYActualizar(new ChangeEventArgs { Value = typeof(enumeraciones).GetProperty(field)?.GetValue(itemSeleccionado) }, field);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="back">
|
||||
<div class="div-center">
|
||||
<div class="content">
|
||||
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||
<img src="data:image/png;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||
<h4 class="mt-5">Clave Generada correctamente</h4>
|
||||
<hr />
|
||||
<p>Se ha generado su clave para utilizar la herramienta.Guarde su clave y contraseña en un lugar seguro. NO PUEDE RECUPERARSE</p>
|
||||
|
||||
@@ -3,18 +3,38 @@
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@rendermode InteractiveServer
|
||||
@layout LoginLayout
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject NavigationManager Navigation
|
||||
@inject UserState UserState
|
||||
@layout DenegadoLayout
|
||||
|
||||
|
||||
<head>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
|
||||
<link href="_content/Blazor.Bootstrap/blazor.bootstrap.css" rel="stylesheet" />
|
||||
<link href="_content/Blazor.Bootstrap/Blazor.Bootstrap.bundle.scp.css" rel="stylesheet" />
|
||||
<link href="Content/Site.css?v=0.70" rel="stylesheet" />
|
||||
<link href="Content/all.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<script src="Scripts/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.2.0/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
|
||||
<script src="_content/Blazor.Bootstrap/blazor.bootstrap.js"></script>
|
||||
<script src="Scripts/popper.min.js"></script>
|
||||
<script src="Scripts/all.min.js"></script>
|
||||
<script src="Scripts/Util.js"></script>
|
||||
</head>
|
||||
<div class="fondo">
|
||||
<div class="back">
|
||||
<div class="div-center">
|
||||
<div class="d-block mt-4">
|
||||
@* <img src="Content/Imagenes/CACOA-6.png" height="49" /> *@
|
||||
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||
<img src="data:image/png;base64,@System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||
|
||||
<h4 class="mt-2">Acceso Denegado</h4>
|
||||
<hr />
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
<div class="content">
|
||||
<div class="d-flex">
|
||||
<img src="Content/Imagenes/CACOA-6.png" height="45" class="me-3" />
|
||||
<div class="ms-auto">
|
||||
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="45" />
|
||||
</div>
|
||||
@if(nombreColegio!="CACOA")
|
||||
{
|
||||
<div class="ms-auto">
|
||||
<img src="data:image/png;base64, @System.Convert.ToBase64String(logoColegioArray)" height="45" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<h4 class="mt-2">Acceso a la Herramienta</h4>
|
||||
@@ -75,13 +78,13 @@
|
||||
string rutaActual = "";
|
||||
|
||||
private byte[] logoColegioArray = [];
|
||||
|
||||
private string nombreColegio = "";
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
nombreColegio = bd.enumeraciones.First(x => x.Codigo == "CW.NOMBRECOLEGIO").ValorAlfabetico1;
|
||||
logoColegioArray = bd.ficheros.Where(x => x.NombreFichero == "LogoColegio").Select(x => x.Fichero).First();
|
||||
|
||||
await ProtectedLocalStore.SetAsync("idUsuario", 0);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="back">
|
||||
<div class="div-center">
|
||||
<div class="content">
|
||||
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||
<img src="data:image/png;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||
<h4 class="mt-2">Crear Clave de acceso</h4>
|
||||
<hr />
|
||||
<p>Se va a generar una clave de acceso para acceder a la herramienta, tenga en cuenta que como no se almacena ningún dato de caracter personal le recomendamos que guarde la clave y contraseña para poder utilizarla.</p>
|
||||
|
||||
@@ -12,6 +12,7 @@ using HerramientaCASA.ViewModel;
|
||||
using IbanNet;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Text;
|
||||
using tsUtilidades;
|
||||
using static bdHerramientaCACOA.CASA;
|
||||
using static HerramientaCASA.Components.Pages.ConfiguracionPages.ConvenioColectivo;
|
||||
|
||||
@@ -19,6 +20,30 @@ namespace HerramientaCASA
|
||||
{
|
||||
public class UtilidadesCASA
|
||||
{
|
||||
internal static List<string> ListaUrls=new List<string>();
|
||||
|
||||
public static void CargarListaUrls(tsHerramientasCACOA bd) {
|
||||
List<urlspermitidas> urlspermitidas=bd.urlspermitidas.ToList();
|
||||
foreach (var urls in urlspermitidas) {
|
||||
ListaUrls.Add(urls.url);
|
||||
}
|
||||
}
|
||||
public static bool UrlPermitida(String url, tsHerramientasCACOA bd) {
|
||||
if (UtilidadesCASA.ListaUrls.Count==0)
|
||||
{
|
||||
UtilidadesCASA.CargarListaUrls(bd);
|
||||
}
|
||||
if (url == null && ListaUrls.Count > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(ListaUrls.Count == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ListaUrls.Any(s => url.Contains(s));
|
||||
}
|
||||
|
||||
public static int crearObjeto(tsHerramientasCACOA bd, TiposSimulaciones tipoSimulacion, string jsonObjeto, string descripcion, string nombreFichero, int idUsuario)
|
||||
{
|
||||
int idtipoFichero = bd.enumeraciones.First(x => x.Codigo == "TIPFIC.JSON").idEnumeracion;
|
||||
@@ -144,6 +169,7 @@ namespace HerramientaCASA
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void actualizarFactorCorrecion(tsHerramientasCACOA bd, factorescorreccion factorCorrecc, factorescorreccion facturaEdit)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -6,13 +6,17 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
//"WriteConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;",
|
||||
//"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;"
|
||||
"WriteConnection": "Server=localhost;Port=22222;Database=herramientascoaaragon;User Id=cacoa;Password=cacoa2018-;",
|
||||
"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascoaaragon;User Id=cacoa;Password=cacoa2018-;"
|
||||
|
||||
// CONEXIÓN CACOA
|
||||
//"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;",
|
||||
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;"
|
||||
|
||||
// CONEXIÓN Herramienta Cacoa Generica
|
||||
//"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoagenerica;User Id=cacoa;Password=cacoa2018-;",
|
||||
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoagenerica;User Id=cacoa;Password=cacoa2018-;",
|
||||
|
||||
// CONEXIÓN COACYLE
|
||||
//"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;",
|
||||
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;"
|
||||
@@ -30,8 +34,8 @@
|
||||
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoarioja;User Id=cacoa;Password=cacoa2018-;",
|
||||
|
||||
// CONEXIÓN COAAragon
|
||||
"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoaaragon;User Id=cacoa;Password=cacoa2018-;",
|
||||
"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoaaragon;User Id=cacoa;Password=cacoa2018-;"
|
||||
//"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoaaragon;User Id=cacoa;Password=cacoa2018-;",
|
||||
//"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoaaragon;User Id=cacoa;Password=cacoa2018-;"
|
||||
|
||||
//??
|
||||
//"WriteConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;",
|
||||
|
||||
13
bdHerramientaCACOA/db/urlspermitidas.cs
Normal file
13
bdHerramientaCACOA/db/urlspermitidas.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace bdHerramientaCACOA.db;
|
||||
|
||||
public partial class urlspermitidas
|
||||
{
|
||||
public int idUrlsPermitidas { get; set; }
|
||||
|
||||
public string? descripcion { get; set; }
|
||||
|
||||
public string url { get; set; } = null!;
|
||||
}
|
||||
@@ -52,6 +52,8 @@ public partial class herramientascacoaContext : DbContext
|
||||
|
||||
public virtual DbSet<tipoproyectos> tipoproyectos { get; set; }
|
||||
|
||||
public virtual DbSet<urlspermitidas> urlspermitidas { get; set; }
|
||||
|
||||
public virtual DbSet<usuarios> usuarios { get; set; }
|
||||
|
||||
public virtual DbSet<v_tipoproyecto_documentacion> v_tipoproyecto_documentacion { get; set; }
|
||||
@@ -238,6 +240,8 @@ public partial class herramientascacoaContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.idTipo, "IX_FK_fichero_tipo");
|
||||
|
||||
entity.HasIndex(e => e.NombreFichero, "NombreFichero");
|
||||
|
||||
entity.HasIndex(e => e.idFichero, "idFichero").IsUnique();
|
||||
|
||||
entity.Property(e => e.idFichero).HasColumnType("int(11)");
|
||||
@@ -397,6 +401,15 @@ public partial class herramientascacoaContext : DbContext
|
||||
.HasConstraintName("FK_tipoproyectos_enumeraciones");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<urlspermitidas>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.idUrlsPermitidas).HasName("PRIMARY");
|
||||
|
||||
entity.Property(e => e.idUrlsPermitidas).HasColumnType("int(11)");
|
||||
entity.Property(e => e.descripcion).HasMaxLength(45);
|
||||
entity.Property(e => e.url).HasMaxLength(250);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<usuarios>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.idUsuario).HasName("PRIMARY");
|
||||
|
||||
@@ -4,15 +4,18 @@
|
||||
"ContextNamespace": null,
|
||||
"FilterSchemas": false,
|
||||
"IncludeConnectionString": false,
|
||||
"MinimumProductVersion": "2.6.1080",
|
||||
"IrregularWords": null,
|
||||
"MinimumProductVersion": "2.6.1382",
|
||||
"ModelNamespace": null,
|
||||
"OutputContextPath": "dbcontext",
|
||||
"OutputPath": "db",
|
||||
"PluralRules": null,
|
||||
"PreserveCasingWithRegex": true,
|
||||
"ProjectRootNamespace": "bdHerramientaCACOA",
|
||||
"Schemas": null,
|
||||
"SelectedHandlebarsLanguage": 2,
|
||||
"SelectedToBeGenerated": 0,
|
||||
"SingularRules": null,
|
||||
"T4TemplatePath": null,
|
||||
"Tables": [
|
||||
{
|
||||
@@ -95,6 +98,10 @@
|
||||
"Name": "tipoproyectos",
|
||||
"ObjectType": 0
|
||||
},
|
||||
{
|
||||
"Name": "urlspermitidas",
|
||||
"ObjectType": 0
|
||||
},
|
||||
{
|
||||
"Name": "usuarios",
|
||||
"ObjectType": 0
|
||||
@@ -130,5 +137,6 @@
|
||||
"UseSchemaNamespaces": false,
|
||||
"UseSpatial": false,
|
||||
"UseT4": true,
|
||||
"UseT4Split": false
|
||||
"UseT4Split": false,
|
||||
"UseTypedTvpParameters": true
|
||||
}
|
||||
Reference in New Issue
Block a user