292 lines
14 KiB
Plaintext
292 lines
14 KiB
Plaintext
@page "/ConceptoGeneral"
|
|
@page "/ConceptoGeneral/{cl}"
|
|
@using BlazorBootstrap
|
|
@using GestionPersonalWeb.Components.Pages.FicherosMaestros.TipoPuestoTrabajoComponents
|
|
@using Newtonsoft.Json
|
|
@using GestionPersonalWeb.Components.Layout
|
|
@using Microsoft.AspNetCore.WebUtilities
|
|
@using GestionPersonalWeb.Components.Pages.InfoPersComponents
|
|
@using GestionPersonalWeb.Models
|
|
@using System.Linq.Expressions
|
|
@using Serialize.Linq.Serializers
|
|
@using System.Net.Http.Headers
|
|
@using bdAntifraude.clases
|
|
@using bdAntifraude.db
|
|
@using System.Reflection
|
|
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
|
@inject IJSRuntime JSRuntime
|
|
@inject IJSRuntime JS
|
|
@rendermode InteractiveServer
|
|
@inject NavigationManager NavigationManager
|
|
@inject IHttpClientFactory HttpClientFactory
|
|
@inject IHttpContextAccessor HttpContextAccessor
|
|
@inject UserState UserState
|
|
@inject ProtectedSessionStorage ProtectedSessionStore
|
|
@inject NavigationManager Navigation
|
|
|
|
|
|
@* <div class="Cabecera">
|
|
<h6><small><i class="fas fa-user"></i><b> Tipo puesto de trabajo: @puestoTrabajo.DESCRIPCION </b></small></h6>
|
|
</div> *@
|
|
<Toasts class="p-3 font-weight-bold" Style="color:white;" AutoHide="true" Delay="4000" Messages="mensajes" Placement="ToastsPlacement.BottomCenter" />
|
|
<div class="datos-personales-container mt-3">
|
|
<div>
|
|
<div>
|
|
<div><input type="button" class="btnOAAFAzul mb-2" value="Guardar Concepto General" @onclick="GuardarPuestoTrabajo" /></div>
|
|
<div class="" style=" padding: 20px;border:solid 1px grey">
|
|
<div class="col-md-12 mb-3">
|
|
<h6><b> Concepto </b></h6>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Nombre: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.NOMBRE" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Descripcion: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.DESCRIPCION" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Interviene en pago directo: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.INTERVIENEENPAGODIRECTO" @bind-value="@Concepto.INTERVIENEENPAGODIRECTO" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Retribuciones: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.RETRIBUCIONES" @bind-value="@Concepto.RETRIBUCIONES" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Concepto de Nomina: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.PERTENECENOMINA" @bind-value="@Concepto.PERTENECENOMINA" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Cotiza Seguridad Social: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.COTIZASEGURIDADSOCIAL" @bind-value="@Concepto.COTIZASEGURIDADSOCIAL" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Deducciones: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.DEDUCCIONES" @bind-value="@Concepto.DEDUCCIONES" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Concepto de Liquidación: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.PERTENECELIQUIDACIONES" @bind-value="@Concepto.PERTENECELIQUIDACIONES" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Cotiza IRPF: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.COTIZAIRPF" @bind-value="@Concepto.COTIZAIRPF" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="" class="fw-bold">Extra: </label>
|
|
<input type="checkbox" class="form-check" id="chkERetribuciones" checked="@Concepto.EXTRA" @bind-value="@Concepto.EXTRA" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="mt-3" style=" padding: 20px;border:solid 1px grey">
|
|
<div class="col-md-12 mb-3">
|
|
<h6><b> Aplicaciones Presupuestarias </b></h6>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Nombre: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.CONCEPTOAPLPRES" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Eventual: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESEVENTUAL" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Altos Cargos: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESALTOSCARGOS" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Laboral: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESLABORAL" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="mt-3" style=" padding: 20px;border:solid 1px grey">
|
|
<div class="col-md-12 mb-3">
|
|
<h6><b> Funcionario </b></h6>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">A1: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESFUNCIONARIOA1" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">A2: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESFUNCIONARIOA2" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">B: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESFUNCIONARIOB" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">C1: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESFUNCIONARIOC1" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">C2: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESFUNCIONARIOC2" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">E: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.APLPRESFUNCIONARIOE" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="mt-3 mb-5" style=" padding: 20px;border:solid 1px grey">
|
|
<div class="col-md-12 mb-3">
|
|
<h6><b> Varios </b></h6>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Tipo: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.TIPO" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtdni" class="fw-bold">Orden: </label>
|
|
<input class="form-control" id="txtdni" @bind-value="@Concepto.ORDEN" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string? cl { get; set; } = "";
|
|
private static bdAntifraude.db.CONCEPTOSGENERALES Concepto = new CONCEPTOSGENERALES();
|
|
private EditContext editContext = new EditContext(Concepto);
|
|
|
|
private HttpClient cliente = new HttpClient();
|
|
private ValidationMessageStore? messageStore;
|
|
private string errorMessage = "";
|
|
List<ToastMessage> mensajes = new List<ToastMessage>();
|
|
public bool mostrar { get; set; } = true;
|
|
public bool mostrarBtn { get; set; } = false;
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
var url = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
|
cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory);
|
|
|
|
if (QueryHelpers.ParseQuery(url.Query).TryGetValue("cl", out var clValue))
|
|
{
|
|
cl = clValue;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(cl))
|
|
{
|
|
Concepto = new CONCEPTOSGENERALES();
|
|
mostrarBtn = true;
|
|
}
|
|
else
|
|
{
|
|
// ListaSexos = await Utilidades.ObtenerObjeto<List<ENUMERACIONES>>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/SEXO");
|
|
string idDesencriptado = Utilidades.Desencriptar(cl);
|
|
int id = int.Parse(idDesencriptado);
|
|
|
|
var response = await cliente.GetAsync($"/api/CONCEPTOSGENERALES/{id}");
|
|
if (!response.IsSuccessStatusCode)
|
|
{
|
|
throw new Exception($"Error al obtener los datos del Tipo de Trabajo. Código: {response.StatusCode}");
|
|
}
|
|
var resultContent = await response.Content.ReadAsStringAsync();
|
|
Concepto = JsonConvert.DeserializeObject<CONCEPTOSGENERALES>(resultContent) ?? throw new Exception("Error al deserializar los datos de la persona.");
|
|
}
|
|
editContext = new EditContext(Concepto);
|
|
messageStore = new ValidationMessageStore(editContext);
|
|
|
|
mostrar = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errorMessage = ex.Message;
|
|
Console.WriteLine($"Error durante la inicialización: {ex.Message}");
|
|
mostrar = false;
|
|
}
|
|
finally
|
|
{
|
|
mostrar = false;
|
|
}
|
|
}
|
|
|
|
private async Task GuardarPuestoTrabajo()
|
|
{
|
|
cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory);
|
|
if (!editContext.GetValidationMessages().Any())
|
|
{
|
|
if (Concepto.IDCONCEPTOSGENERALES == 0)//Nuevo
|
|
{
|
|
var response = await Utilidades.NuevoObjeto(cliente, "/api/CONCEPTOSGENERALES", Concepto, mensajes);
|
|
if (response != null)
|
|
{
|
|
Concepto = response;
|
|
}
|
|
else
|
|
{
|
|
mensajes.Add(new ToastMessage
|
|
{
|
|
Type = ToastType.Success,
|
|
Message = $"Guardado Correctamente.",
|
|
});
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
else//Guardar
|
|
{
|
|
var response = await Utilidades.ActualizarObjeto(cliente, "/api/CONCEPTOSGENERALES/" + Concepto.IDCONCEPTOSGENERALES, Concepto, mensajes);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mensajes.Add(new ToastMessage
|
|
{
|
|
Type = ToastType.Danger,
|
|
Message = Utilidades.ListaErroresHtml(editContext.GetValidationMessages()),
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
}
|