303 lines
14 KiB
Plaintext
303 lines
14 KiB
Plaintext
@page "/NomPers"
|
|
@* @page "/NomPers/{cl}" *@
|
|
@using System.Net.Http.Headers
|
|
@using System.Linq.Expressions
|
|
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
|
@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 ProtectedSessionStorage ProtectedSessionStore
|
|
@inject UserState UserState
|
|
<p class="tituloCaja">Varios</p>
|
|
<div class="row mb-3" style=" padding: 20px;border:solid 1px grey">
|
|
<div class="col-md-6">
|
|
<label for="txtApellidos" class="fw-bold widthLabel li-height50">Apellidos: </label>
|
|
<input class="form-control" disabled id="txtApellidos" @bind-value="@Persona.APELLIDOS" />
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="txtNombre" class="fw-bold widthLabel li-height50">Nombre: </label>
|
|
<input class="form-control" disabled id="txtNombre" @bind-value="@Persona.NOMBRE" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">DNI: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Persona.NIF" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtsexo" class="fw-bold widthLabel li-height50">Sexo: </label>
|
|
<InputSelect @bind-Value="Persona.IDSEXO" class="form-select">
|
|
<option value="">Seleccionar</option>
|
|
@if (lSexo != null)
|
|
{
|
|
@foreach (var enumera in lSexo)
|
|
{
|
|
<option value="@enumera.IDENUMERACION">@enumera.DESCRIPCION</option>
|
|
}
|
|
}
|
|
</InputSelect>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtTiCont" class="fw-bold widthLabel li-height50">Tipo Contrato: </label>
|
|
<InputSelect @bind-Value="Persona.IDCONTRATO" class="form-select">
|
|
<option value="">Seleccionar</option>
|
|
@if (lTipoContra != null)
|
|
{
|
|
@foreach (var enumera in lTipoContra)
|
|
{
|
|
<option value="@enumera.IDCONTRATO"> @enumera.CODIGO - @enumera.DESCRIPCION</option>
|
|
}
|
|
}
|
|
</InputSelect>
|
|
@* <input class="form-control" id="txtTiCont" disabled value="@persona.IDCONTRATONavigation?.DESCRIPCION" /> *@
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<Tabs @ref=tabsDtsPer style="margin-top:25px; font-size:12px; gap:0;" OnShown="@(args => OnTabShownAsync(args))">
|
|
<Tab Title="Nómina" Name="tabNomina">
|
|
<Content>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<label for="txtCodigo" class="fw-bold widthLabel li-height50">Código: </label>
|
|
@if (Nomina.IDNOMINANavigation != null){
|
|
<input class="form-control" disabled id="txtCodigo" @bind-value="@Nomina.IDNOMINANavigation.DESCRIPCION" />
|
|
}
|
|
else
|
|
{
|
|
<input class="form-control" disabled id="txtCodigo" />
|
|
}
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Fecha: </label>
|
|
<input type="date" class="form-control" disabled id="txtFecha" @bind-value="@Nomina.FECHA" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Nº Pluriempleo: </label>
|
|
<input class="form-control" disabled id="txtFecha" @bind-value="@Nomina.NUMEROPLURIEMPLEO" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Grupo: </label>
|
|
@if(Nomina.IDGRUPOFUNCIONARIONavigation != null){
|
|
<input class="form-control" disabled id="txtFecha" @bind-value="@Nomina.IDGRUPOFUNCIONARIONavigation.DESCRIPCION" />
|
|
}
|
|
else
|
|
{
|
|
<input class="form-control" disabled id="txtFecha" />
|
|
}
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Nivel: </label>
|
|
<input class="form-control" disabled id="txtFecha" @bind-value="@Nomina.NIVEL" />
|
|
</div>
|
|
<div class="col-md-4"></div>
|
|
<div class="col-md-11">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Observaciones: </label>
|
|
<input class="form-control" disabled id="txtFecha" @bind-value="@Nomina.OBSERVACIONES" />
|
|
</div>
|
|
<div class="col-md-1 d-flex gap-2 align-items-end">
|
|
<label for="txtFecha" class="fw-bold widthLabel align-content-end">Acumulada: </label>
|
|
<input type="checkbox" class="" disabled id="txtFecha" @bind-value="@Nomina.ACUMULADA" />
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Sindicato 1: </label>
|
|
<InputSelect @bind-Value="Nomina.IDSINDICATO1" class="form-select">
|
|
<option value="">Seleccionar</option>
|
|
@if (lSindicato != null)
|
|
{
|
|
@foreach (var enumera in lSindicato)
|
|
{
|
|
<option value="@enumera.IDENUMERACION">@enumera.DESCRIPCION</option>
|
|
}
|
|
}
|
|
</InputSelect>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Valor Sindicato 1: </label>
|
|
@if(Nomina.IDSINDICATO1Navigation != null){
|
|
<input class="form-control" disabled id="txtFecha" @bind-value="@Nomina.IDSINDICATO1Navigation.VALORNUMERICO1" />
|
|
}
|
|
else
|
|
{
|
|
<input class="form-control" disabled />
|
|
}
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Sindicato 2: </label>
|
|
<InputSelect @bind-Value="Nomina.IDSINDICATO2" class="form-select">
|
|
<option value="">Seleccionar</option>
|
|
@if (lSindicato != null)
|
|
{
|
|
@foreach (var enumera in lSindicato)
|
|
{
|
|
<option value="@enumera.IDENUMERACION">@enumera.DESCRIPCION</option>
|
|
}
|
|
}
|
|
</InputSelect>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="txtFecha" class="fw-bold widthLabel li-height50">Valor Sindicato 2: </label>
|
|
@if (Nomina.IDSINDICATO2Navigation != null)
|
|
{
|
|
<input class="form-control" disabled id="txtFecha" @bind-value="@Nomina.IDSINDICATO2Navigation.VALORNUMERICO1" />
|
|
}
|
|
else
|
|
{
|
|
<input class="form-control" disabled />
|
|
}
|
|
</div>
|
|
|
|
</div>
|
|
</Content>
|
|
</Tab>
|
|
<Tab Title="Porcentajes" Name="tabPorcentajes">
|
|
<Content>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">Pluriempleo: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Nomina.PLURIEMPLEO" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">Reducción Jornada: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Nomina.REDUCCIONJORNADA" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">Trabajo Tiempo Parcial: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Nomina.TRABAJOTIEMPOPARCIAL" />
|
|
</div>
|
|
</div>
|
|
</Content>
|
|
</Tab>
|
|
<Tab Title="" Name="tabPorcentajes">
|
|
<Content>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">Pluriempleo: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Nomina.PLURIEMPLEO" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">Reducción Jornada: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Nomina.REDUCCIONJORNADA" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="txtNIF" class="fw-bold widthLabel li-height50">Trabajo Tiempo Parcial: </label>
|
|
<input class="form-control" disabled id="txtNIF" @bind-value="@Nomina.TRABAJOTIEMPOPARCIAL" />
|
|
</div>
|
|
</div>
|
|
</Content>
|
|
</Tab>
|
|
</Tabs>
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
|
[Parameter]
|
|
public PERSONAS Persona { get; set; } = new PERSONAS();
|
|
public NOMINATRABAJADORCABECERA Nomina { get; set; } = new NOMINATRABAJADORCABECERA();
|
|
private HttpClient cliente = new HttpClient();
|
|
[Parameter]
|
|
public EventCallback OnPersonaActualizada { get; set; }
|
|
private List<ENUMERACIONES> lSexo = new List<ENUMERACIONES>();
|
|
private List<CONTRATOS> lTipoContra = new List<CONTRATOS>();
|
|
private List<ENUMERACIONES> lSindicato= new List<ENUMERACIONES>();
|
|
|
|
private ValidationMessageStore? messageStore;
|
|
private string errorMessage = "";
|
|
public string? cl { get; set; } = "";
|
|
public string? cn { get; set; } = "";
|
|
private Tabs tabsDtsPer { get; set; } = new Tabs();
|
|
private async Task OnTabShownAsync(TabsEventArgs args)
|
|
{
|
|
var panelActivo = args.ActiveTabName;
|
|
|
|
await ProtectedSessionStore.SetAsync("ultiTabNom", panelActivo);
|
|
|
|
}
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
var url = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
|
|
|
if (QueryHelpers.ParseQuery(url.Query).TryGetValue("cl", out var clValue))
|
|
{
|
|
cl = clValue;
|
|
}
|
|
// if (QueryHelpers.ParseQuery(url.Query).TryGetValue("cn", out var cnValue))
|
|
// {
|
|
// cn = cnValue;
|
|
// }
|
|
|
|
cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory);
|
|
// ListaSexos = await Utilidades.ObtenerObjeto<List<ENUMERACIONES>>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/SEXO");
|
|
string clDesencriptado = tsUtilidades.crypt.FEncS(cl,
|
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*",
|
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*",
|
|
-875421649);
|
|
|
|
var clCn = clDesencriptado.Split("-");
|
|
var nifDesencriptado = clCn[0];
|
|
var NominaDesencriptada = Int32.Parse(clCn[1]);
|
|
// int NominaDesencriptada = Int32.Parse(tsUtilidades.crypt.FEncS(cn,
|
|
// "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*",
|
|
// "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*",
|
|
// -875421649));
|
|
|
|
|
|
|
|
|
|
var response = await cliente.GetAsync($"/api/PERSONAS/PersonaNominaNif/{nifDesencriptado}");
|
|
if (!response.IsSuccessStatusCode)
|
|
{
|
|
throw new Exception($"Error al obtener los datos de la persona. Código: {response.StatusCode}");
|
|
}
|
|
|
|
var resultContent = await response.Content.ReadAsStringAsync();
|
|
Persona = JsonConvert.DeserializeObject<PERSONAS>(resultContent) ?? throw new Exception("Error al deserializar los datos de la persona.");
|
|
Nomina = Persona.NOMINATRABAJADORCABECERA?.FirstOrDefault(x => x.IDNOMINA == NominaDesencriptada);
|
|
// lblNombre = persona.NOMBRE + " " + Persona.APELLIDOS;
|
|
|
|
|
|
|
|
await CargarSelects();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errorMessage = ex.Message;
|
|
Console.WriteLine($"Error durante la inicialización: {ex.Message}");
|
|
}
|
|
}
|
|
|
|
|
|
private async Task CargarSelects()
|
|
{
|
|
try
|
|
{
|
|
|
|
lSexo = await Utilidades.ObtenerObjeto<List<ENUMERACIONES>>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/SEXO");
|
|
lSindicato = await Utilidades.ObtenerObjeto<List<ENUMERACIONES>>(cliente, "/api/ENUMERACIONES/EnumeracionesGrupo/SIND");
|
|
// lTipoContra = await Utilidades.ObtenerObjeto<List<CONTRATOS>>(cliente, "/api/CONTRATOS");
|
|
var responseTipCon = await cliente.GetAsync("/api/CONTRATOS/");
|
|
if (responseTipCon.IsSuccessStatusCode) { lTipoContra = JsonConvert.DeserializeObject<List<CONTRATOS>>(await responseTipCon.Content.ReadAsStringAsync()); }
|
|
|
|
StateHasChanged();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errorMessage = ex.Message;
|
|
Console.WriteLine($"Error durante la inicialización: {ex.Message}");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|