Arreglo entrada APTOCPH
This commit is contained in:
@@ -88,7 +88,85 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<Modal @ref="popupGestionDatos" title="@tituloPopup" IsVerticallyCentered="true" UseStaticBackdrop="true" CloseOnEscape="false">
|
||||
|
||||
<Modal @key="ModalKey"
|
||||
@ref="popupGestionDatos"
|
||||
title="@tituloPopup"
|
||||
IsVerticallyCentered="true"
|
||||
UseStaticBackdrop="true"
|
||||
CloseOnEscape="false">
|
||||
|
||||
<BodyTemplate>
|
||||
@if (renderBody && itemSeleccionado is not null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 formatoCampos">
|
||||
<label class="tituloLbl">Nombre Curso:</label>
|
||||
<InputText required @bind-Value="itemSeleccionado.NOMBRE_CURSO" class="inputForm" maxlength="300"></InputText>
|
||||
</div>
|
||||
|
||||
<div class="col-12 formatoCampos mt-2">
|
||||
<label class="tituloLbl">Centro:</label>
|
||||
<InputText required @bind-Value="itemSeleccionado.CENTRO" class="inputForm" maxlength="100"></InputText>
|
||||
</div>
|
||||
|
||||
<div class="col-12 formatoCampos">
|
||||
<label class="tituloLbl">Fecha Expedicion:</label>
|
||||
<InputDate required @bind-Value="itemSeleccionado.FECHA_EXPEDICION" class="inputForm"></InputDate>
|
||||
</div>
|
||||
|
||||
<div class="col-12 formatoCampos mt-2">
|
||||
<label class="tituloLbl">Duracion:</label>
|
||||
<InputNumber required @bind-Value="itemSeleccionado.DURACION" class="inputForm" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 formatoCampos mt-2">
|
||||
<label class="tituloLbl">Fichero Anterior:</label>
|
||||
<InputText required @bind-Value="itemSeleccionado.RUTA" class="inputForm"></InputText>
|
||||
</div>
|
||||
|
||||
<div class="col-12 formatoCampos mt-2">
|
||||
<label class="tituloLbl">Subir Fichero:</label>
|
||||
<InputFile class="inputForm" OnChange="LoadFile"></InputFile>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<p style="color:red; text-align:center">@mensajeArchivo</p>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center gap-3 mt-2">
|
||||
<label class="tituloLbl">Aprovechamiento:</label>
|
||||
<input type="checkbox" id="chbAPOVECHAMIENTO" checked="@itemSeleccionado.APROVECHAMIENTO" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 d-flex align-items-center gap-3 mt-2">
|
||||
<label class="tituloLbl">Oficial:</label>
|
||||
<input type="checkbox" id="chbOFICIAL" checked="@itemSeleccionado.OFICIAL" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 d-flex align-items-center gap-3 mt-2">
|
||||
<label class="tituloLbl">Apto CPH:</label>
|
||||
<input type="checkbox" id="chbAPTOCPH" checked="@itemSeleccionado.APTOCPH" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</BodyTemplate>
|
||||
|
||||
<FooterTemplate>
|
||||
<Button Color="ButtonColor.Secondary" @onclick="cerrarPopupGestionDatos">Cerrar</Button>
|
||||
|
||||
@if (itemSeleccionado is not null && itemSeleccionado.IDFORMACION != 0)
|
||||
{
|
||||
<Button @onclick="@(() => GestionarDatos("update"))" Color="ButtonColor.Primary">Modificar</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button @onclick="@(() => GestionarDatos("create"))" Color="ButtonColor.Primary">Añadir</Button>
|
||||
}
|
||||
</FooterTemplate>
|
||||
</Modal>
|
||||
|
||||
@* <Modal @ref="popupGestionDatos" title="@tituloPopup" IsVerticallyCentered="true" UseStaticBackdrop="true" CloseOnEscape="false">
|
||||
<BodyTemplate>
|
||||
<div class="row">
|
||||
<div class="col-12 formatoCampos">
|
||||
@@ -118,15 +196,18 @@
|
||||
<div class="col-12"><p style="color:red; text-align:center">@mensajeArchivo</p></div>
|
||||
<div class="col-6 d-flex align-items-center gap-3 mt-2">
|
||||
<label class="tituloLbl">Aprovechamiento:</label>
|
||||
<InputCheckbox required @bind-Value="itemSeleccionado.APROVECHAMIENTO" class="inputForm"></InputCheckbox>
|
||||
<input type="checkbox" @bind="itemSeleccionado.APROVECHAMIENTO" />
|
||||
</div>
|
||||
<div class="col-3 d-flex align-items-center gap-3 mt-2">
|
||||
<label class="tituloLbl">Oficial:</label>
|
||||
<InputCheckbox required @bind-Value="itemSeleccionado.OFICIAL" class="inputForm"></InputCheckbox>
|
||||
<input type="checkbox" @bind="itemSeleccionado.OFICIAL" />
|
||||
|
||||
</div>
|
||||
<div class="col-3 d-flex align-items-center gap-3 mt-2">
|
||||
<div class="col-3 d-flex align-items-center gap-3 mt-2" @key="itemSeleccionado?.IDFORMACION">
|
||||
<label class="tituloLbl">Apto CPH:</label>
|
||||
<InputCheckbox required @bind-Value="itemSeleccionado.APTOCPH" class="inputForm"></InputCheckbox>
|
||||
<input type="checkbox"
|
||||
checked="@itemSeleccionado.APTOCPH"
|
||||
@onchange="OnAptoCphChanged" />
|
||||
</div>
|
||||
</div>
|
||||
</BodyTemplate>
|
||||
@@ -141,7 +222,7 @@
|
||||
<Button @onclick="@(() => GestionarDatos("create"))" Color="ButtonColor.Primary">Añadir</Button>
|
||||
}
|
||||
</FooterTemplate>
|
||||
</Modal>
|
||||
</Modal> *@
|
||||
|
||||
<Modal @ref="popupConfirmarBorrado" title="" IsVerticallyCentered="true" UseStaticBackdrop="true" CloseOnEscape="false">
|
||||
<BodyTemplate>
|
||||
@@ -157,6 +238,7 @@
|
||||
</Modal>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public PERSONAS Persona { get; set; } = new PERSONAS();
|
||||
@@ -176,6 +258,13 @@
|
||||
private List<ENUMERACIONES> listaParentescos = new List<ENUMERACIONES>();
|
||||
|
||||
|
||||
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<List<FORMACION>>(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<bool>("obtenerCheck", idAPTOCPH);
|
||||
string idAPROVECHAMIENTO = "chbAPOVECHAMIENTO";
|
||||
itemSeleccionado.APROVECHAMIENTO = await JS.InvokeAsync<bool>("obtenerCheck", idAPROVECHAMIENTO);
|
||||
string idOFICIAL = "chbOFICIAL";
|
||||
itemSeleccionado.OFICIAL = await JS.InvokeAsync<bool>("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
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user