From 8c00e7f7ccb4f2f0747067266be06ec245210ede Mon Sep 17 00:00:00 2001 From: agugra Date: Thu, 30 Apr 2026 08:59:20 +0200 Subject: [PATCH 1/2] appsetting --- .../RegistroPersonalAN/appsettings.Production.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Antifraude.Net/RegistroPersonalAN/appsettings.Production.json b/Antifraude.Net/RegistroPersonalAN/appsettings.Production.json index f0f9191..ce2e440 100644 --- a/Antifraude.Net/RegistroPersonalAN/appsettings.Production.json +++ b/Antifraude.Net/RegistroPersonalAN/appsettings.Production.json @@ -1,5 +1,5 @@ { - "AllowedHosts": "rp-antifraude.tecnosis.online;crp-antifraude.tecnosis.online;localhost;127.0.0.1", + "AllowedHosts": "registrodepersonal.antifraudeandalucia.es;rp-antifraude.tecnosis.online;crp-antifraude.tecnosis.online;localhost;127.0.0.1", "SwaggerCC": "http://localhost:103/api/", "SwaggerVB": "http://localhost:888/", "CertificateLogin": { @@ -12,7 +12,9 @@ "Ssl-Client-Cert" ], "AllowedParentOrigins": [ - "https://rp-antifraude.tecnosis.online" + "https://rp-antifraude.tecnosis.online", + "https://registrodepersonal.antifraudeandalucia.es", + "http://192.168.41.122:5000" ] }, "ReverseProxy": { From 83fbcbe80f5abbd2bbe376d25d6ce67505578564 Mon Sep 17 00:00:00 2001 From: Sergio Date: Thu, 30 Apr 2026 09:34:07 +0200 Subject: [PATCH 2/2] Creada parte avanzada y enumeraciones --- .../Components/Layout/MainLayout.razor | 10 + .../Pages/Enumeraciones/Enumeraciones.razor | 306 ++++++++++++++++++ .../Enumeraciones/GruposEnumeraciones.razor | 97 ++++++ 3 files changed, 413 insertions(+) create mode 100644 Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/Enumeraciones.razor create mode 100644 Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/GruposEnumeraciones.razor diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor b/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor index 6db8bba..d9a68b8 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor @@ -121,6 +121,16 @@ + diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/Enumeraciones.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/Enumeraciones.razor new file mode 100644 index 0000000..6893ef8 --- /dev/null +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/Enumeraciones.razor @@ -0,0 +1,306 @@ +@page "/Enumeraciones/" +@page "/Enumeraciones/{cl}" +@using System.Net.Http.Headers +@using System.Linq.Expressions +@using Microsoft.AspNetCore.WebUtilities +@using Newtonsoft.Json +@using System.Text +@using Serialize.Linq.Serializers +@using GestionPersonalWeb.Models +@using BlazorBootstrap +@using bdAntifraude.db +@using Microsoft.AspNetCore.Components +@rendermode InteractiveServer +@inject IJSRuntime JS +@inject NavigationManager NavigationManager +@inject IHttpClientFactory HttpClientFactory +@inject IHttpContextAccessor HttpContextAccessor +@inject UserState UserState + + +
+
+
+
+ Enumeración +
+
+ +
+ + @if (lEnumeraciones == null) + { +
+
+
+ } + else if (!lEnumeraciones.Any()) + { +

No se encontraron datos para mostrar.

+ } + else + { +
+
+
+ +
+ + + + + + + @context.CODIGO + + + @context.DESCRIPCION + + + @context.VALORNUMERICO1 + + + @context.VALORNUMERICO2 + + + @context.VALORNUMERICO3 + + + @context.VALORNUMERICO4 + + + @context.VALORALFABETICO1 + + + @context.VALORALFABETICO2 + + + @context.VALORALFABETICO3 + + + @context.VALORALFABETICO4 + + + @context.VALORALFABETICOLARGO + + + +
+ + + + } +
+ + + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + + +
+
+@code { + [Parameter] + public string? cl { get; set; } = ""; + GRUPOSENUMERACIONES grupo = new GRUPOSENUMERACIONES(); + List lEnumeraciones = new List(); + private string _filter = ""; + + private string tituloPopup = ""; + private Modal popupGestionDatos = default; + private bool EsItemNuevo = false; + private ENUMERACIONES ItemEnEdicion { get; set; } = new ENUMERACIONES(); + + private EditContext? editContext; + List mensajes = new List(); + + + + protected override async Task OnInitializedAsync() + { + var url = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); + var token = UserState.Token; + var cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + editContext = new EditContext(lEnumeraciones); + + if (QueryHelpers.ParseQuery(url.Query).TryGetValue("cl", out var clValue)) + { + cl = clValue; + } + + if (string.IsNullOrEmpty(cl)) + { + //iContrato = new CONTRATOS(); + //mostrarBtn = true; + } + else + { + string idDesencriptado = Utilidades.Desencriptar(cl); + int id = int.Parse(idDesencriptado); + + var response = await cliente.GetAsync($"/api/GRUPOSENUMERACIONES/{id}"); + if (!response.IsSuccessStatusCode) + { + throw new Exception($"Error al obtener los datos. Código: {response.StatusCode}"); + } + var resultContent = await response.Content.ReadAsStringAsync(); + grupo = JsonConvert.DeserializeObject(resultContent) ?? throw new Exception("Error al deserializar los datos."); + + lEnumeraciones = await Utilidades.ObtenerObjeto>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/"+grupo.GRUPO); + + } + } + + private async Task abrirPopupModificacion(ENUMERACIONES objeto, bool esNuevo) + { + ItemEnEdicion = Utilidades.ClonarObjeto(objeto); + EsItemNuevo = esNuevo; + if (!EsItemNuevo) + { + tituloPopup = "Modificando Enumeracion"; + } + else + { + tituloPopup = "Nueva Enumeracion"; + } + + await popupGestionDatos.ShowAsync(); + } + private async Task cerrarPopupModificacion() + { + await popupGestionDatos.HideAsync(); + } + private async Task GuardarCambiosPopup() + { + try + { + ValidarDatos(); + + if (!editContext!.GetValidationMessages().Any()) + { + string accion = EsItemNuevo ? "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 async Task GestionarDatos(string accion) + { + var cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + var copia = new List(lEnumeraciones); + cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + + switch (accion) + { + case "update": + int indice = copia.FindIndex(x => x.IDENUMERACION == ItemEnEdicion.IDENUMERACION); + if (indice > -1) + { + copia[indice] = ItemEnEdicion; + } + var response = await Utilidades.ActualizarObjeto(cliente, "/api/ENUMERACIONES/" + ItemEnEdicion.IDENUMERACION, ItemEnEdicion, mensajes); + + break; + case "create": + copia.Add(ItemEnEdicion); + var responsec = await Utilidades.NuevoObjeto(cliente, "/api/ENUMERACIONES/", ItemEnEdicion, mensajes); + break; + case "delete": + + break; + } + cerrarPopupModificacion(); + lEnumeraciones = copia.ToList(); + await InvokeAsync(StateHasChanged); + } + private void ValidarDatos() + { + + } + private void MostrarErroresPopup() + { + // messageStore?.Clear(); + // foreach (var field in new[] { nameof(descripcionItem) }) + // { + // ValidarYActualizar(new ChangeEventArgs { Value = typeof(enumeraciones).GetProperty(field)?.GetValue(itemSeleccionado) }, field); + // } + } +} + diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/GruposEnumeraciones.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/GruposEnumeraciones.razor new file mode 100644 index 0000000..c1422ad --- /dev/null +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/Enumeraciones/GruposEnumeraciones.razor @@ -0,0 +1,97 @@ +@page "/GruposEnumeraciones" +@using System.Net.Http.Headers +@using System.Linq.Expressions +@using Newtonsoft.Json +@using System.Text +@using Serialize.Linq.Serializers +@using GestionPersonalWeb.Models +@using BlazorBootstrap +@using bdAntifraude.db +@using Microsoft.AspNetCore.Components +@rendermode InteractiveServer +@inject IJSRuntime JS +@inject NavigationManager NavigationManager +@inject IHttpClientFactory HttpClientFactory +@inject IHttpContextAccessor HttpContextAccessor +@inject UserState UserState + + +
+
+
+
+ Grupos Enumeraciones +
+
+
+ + @if (lGrupoEnumeraciones == null) + { +
+
+
+ } + else if (!lGrupoEnumeraciones.Any()) + { +

No se encontraron datos para mostrar.

+ } + else + { +
+
+
+ +
+ + + + @context.GRUPO + + + @context.DESCRIPCION + + + +
+ + + } +
+@code { + List lGrupoEnumeraciones = new List(); + // Bandera que indica si se está en modo "Ver Todos" + private bool verTodosActive = false; + List mensajes = new List(); + + protected override async Task OnInitializedAsync() + { + verTodosActive = false; + var token = UserState.Token; + var cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); + + var resultPersonas = await cliente.GetAsync("/api/GRUPOSENUMERACIONES"); + var resultContent = await resultPersonas.Content.ReadAsStringAsync(); + lGrupoEnumeraciones = JsonConvert.DeserializeObject>(resultContent) ?? new List(); ; + } + + private string HashRed(string id) + { + string link = "/Enumeraciones?cl=" + tsUtilidades.crypt.FEncS( + id, + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", + 875421649); + return link; + } +} +