From 3372b23f3b06b4ce29854ee15ded2430833f9f8d Mon Sep 17 00:00:00 2001 From: Alejandro Date: Fri, 13 Feb 2026 13:20:49 +0100 Subject: [PATCH] Arreglo entrada APTOCPH --- .../FormacionGrid.razor | 155 ++++++++++++++++-- 1 file changed, 143 insertions(+), 12 deletions(-) diff --git a/Antifraude.Net/RegistroPersonalAN/Components/Pages/InfoPersonasComponents/FormacionGrid.razor b/Antifraude.Net/RegistroPersonalAN/Components/Pages/InfoPersonasComponents/FormacionGrid.razor index 1951dd5..da019a0 100644 --- a/Antifraude.Net/RegistroPersonalAN/Components/Pages/InfoPersonasComponents/FormacionGrid.razor +++ b/Antifraude.Net/RegistroPersonalAN/Components/Pages/InfoPersonasComponents/FormacionGrid.razor @@ -88,7 +88,85 @@ - + + + + + @if (renderBody && itemSeleccionado is not null) + { +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+

@mensajeArchivo

+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ } +
+ + + + + @if (itemSeleccionado is not null && itemSeleccionado.IDFORMACION != 0) + { + + } + else + { + + } + +
+ +@*
@@ -118,15 +196,18 @@

@mensajeArchivo

- +
- -
-
+ + +
+
- +
@@ -141,7 +222,7 @@ } - + *@ @@ -157,6 +238,7 @@ + @code { [Parameter] public PERSONAS Persona { get; set; } = new PERSONAS(); @@ -176,6 +258,13 @@ private List listaParentescos = new List(); + private void OnAptoCphChanged(ChangeEventArgs e) + { + // e.Value suele venir como "true"/"false" en checkboxes + if (e?.Value is bool b) itemSeleccionado.APTOCPH = b; + else if (e?.Value is string s && bool.TryParse(s, out var bb)) itemSeleccionado.APTOCPH = bb; + } + protected override async Task OnInitializedAsync() { if (Persona?.IDPERSONA != null && Persona.IDPERSONA > 0) @@ -198,39 +287,77 @@ formacionItems = await Utilidades.ObtenerObjeto>(cliente, "/api/FORMACION/filtrar", filtro); formacionItems = formacionItems.OrderByDescending(x => x.FECHA_EXPEDICION).ToList(); } + // private async Task abrirPopupGestionDatos(FORMACION objeto) + // { + // itemSeleccionado = objeto; + + // if (idItem != 0) + // { + // tituloPopup = "Modificar Formación"; + // } + // else + // { + // tituloPopup = "Nueva Formación"; + // } + // await popupGestionDatos.ShowAsync(); + // } + private object ModalKey = new(); + private bool renderBody; + private async Task abrirPopupGestionDatos(FORMACION objeto) { itemSeleccionado = objeto; if (idItem != 0) - { tituloPopup = "Modificar Formación"; - } else - { tituloPopup = "Nueva Formación"; - } + + ModalKey = itemSeleccionado?.IDFORMACION != 0 ? itemSeleccionado.IDFORMACION : Guid.NewGuid(); + + renderBody = false; + StateHasChanged(); + + await Task.Yield(); + + renderBody = true; + StateHasChanged(); + await popupGestionDatos.ShowAsync(); } + // private async Task cerrarPopupGestionDatos() + // { + // await popupGestionDatos.HideAsync(); + // } private async Task cerrarPopupGestionDatos() { + renderBody = false; + StateHasChanged(); + await Task.Yield(); await popupGestionDatos.HideAsync(); } private async Task GestionarDatos(string accion) { itemSeleccionado.IDPERSONA = Persona.IDPERSONA; itemSeleccionado.NIF = Persona.NIF; + string idAPTOCPH = "chbAPTOCPH"; + itemSeleccionado.APTOCPH = await JS.InvokeAsync("obtenerCheck", idAPTOCPH); + string idAPROVECHAMIENTO = "chbAPOVECHAMIENTO"; + itemSeleccionado.APROVECHAMIENTO = await JS.InvokeAsync("obtenerCheck", idAPROVECHAMIENTO); + string idOFICIAL = "chbOFICIAL"; + itemSeleccionado.OFICIAL = await JS.InvokeAsync("obtenerCheck", idOFICIAL); switch (accion) { case "update": var responsea = await Utilidades.ActualizarObjeto(cliente, "/api/FORMACION/" + itemSeleccionado.IDFORMACION, itemSeleccionado); await SubirArchivo(itemSeleccionado); - + await cerrarPopupGestionDatos(); break; case "create": var response = await Utilidades.NuevoObjeto(cliente, "/api/FORMACION", itemSeleccionado); await SubirArchivo(response); + await cerrarPopupGestionDatos(); break; case "delete": @@ -392,4 +519,8 @@ link.click(); document.body.removeChild(link); }; + + function obtenerCheck(id){ + return $("#"+id)[0].checked + } \ No newline at end of file