Refactoring
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 21m21s

This commit is contained in:
Leandro Hernan Rojas 2025-05-13 19:13:59 -03:00
parent 474c90423c
commit c9bfaca76d
2 changed files with 19 additions and 64 deletions

View File

@ -27,17 +27,17 @@
</button> </button>
</div> </div>
<hr /> <hr />
<div> <div style="zoom:.9;">
@if (TablaProductos != null && TablaProductos.Any()) @if (TablaProductos != null && TablaProductos.Any())
{ {
<PhTable Columns="TableColumns" <PhTable Columns="TableColumns"
Data="TablaProductos" Data="TablaProductos"
SelectionField="Id" SelectionField="Id"
RowsPerPage=SearchParams.PageSize RowsPerPage=SearchParams.PageSize
RenderButtons="true" Buttons="botones" RenderButtons="true" Buttons="botones"
ShowPageButtons="false" ShowPageButtons="false"
ShowQuickSearch="false" ShowQuickSearch="false"
RenderSelect="false" /> RenderSelect="false" />
} }
else else
{ {
@ -108,6 +108,7 @@
private async Task CargarProductos() private async Task CargarProductos()
{ {
SearchParams.PageSize = 8;
PagedResult = await productService.SearchProductsAsync(SearchParams); PagedResult = await productService.SearchProductsAsync(SearchParams);
if (PagedResult?.Items is not null) if (PagedResult?.Items is not null)
{ {

View File

@ -3,9 +3,9 @@
@using Core.Dtos @using Core.Dtos
@using Domain.Generics @using Domain.Generics
@using phronCare.UIBlazor.Services.Sales.Quotes @using phronCare.UIBlazor.Services.Sales.Quotes
@inject IToastService toastService
@inject NavigationManager Navigation @inject NavigationManager Navigation
@inject QuoteService quoteService @inject QuoteService quoteService
@inject IToastService toastService
<div class="card" style="zoom:80%"> <div class="card" style="zoom:80%">
<div class="card-header d-flex justify-content-center align-items-center"> <div class="card-header d-flex justify-content-center align-items-center">
@ -17,7 +17,7 @@
<div class="mb-3 row g-2 align-items-end"> <div class="mb-3 row g-2 align-items-end">
<div class="col-sm"> <div class="col-sm">
<label for="quotenumber">Presupuesto</label> <label for="quotenumber">Presupuesto</label>
<input id="quotenumber" @bind="Filters.QuoteNumber" class="form-control form-control-sm" placeholder="Q-00000001" /> <input id="quotenumber" @bind="Filters.QuoteNumber" class="form-control form-control-sm" placeholder="Q-0000000X" />
</div> </div>
<div class="col-sm"> <div class="col-sm">
<label for="customer">Cliente</label> <label for="customer">Cliente</label>
@ -47,7 +47,6 @@
<option value="Cerrado">Cerrado</option> <option value="Cerrado">Cerrado</option>
</select> </select>
</div> </div>
<div class="col-sm"> <div class="col-sm">
<label for="datefrom">Desde</label> <label for="datefrom">Desde</label>
<InputDate id="datefrom" @bind-Value="Filters.IssueDateFrom" class="form-control form-control-sm" /> <InputDate id="datefrom" @bind-Value="Filters.IssueDateFrom" class="form-control form-control-sm" />
@ -83,7 +82,7 @@
<th>Médico</th> <th>Médico</th>
<th>Hospital</th> <th>Hospital</th>
<th>Paciente</th> <th>Paciente</th>
<th>Unidad Negocio</th> <th>Unidad</th>
<th>Moneda</th> <th>Moneda</th>
<th>Total</th> <th>Total</th>
<th>Estado</th> <th>Estado</th>
@ -121,7 +120,6 @@
{ {
<!-- BACKDROP semitransparente --> <!-- BACKDROP semitransparente -->
<div class="position-fixed top-0 start-0 w-100 h-100" style="background: rgba(0,0,0,0.4);"></div> <div class="position-fixed top-0 start-0 w-100 h-100" style="background: rgba(0,0,0,0.4);"></div>
<!-- DRAWER LATERAL --> <!-- DRAWER LATERAL -->
<div class="position-fixed top-0 end-0 h-100 bg-white shadow" style="width: 45%; z-index:1050;"> <div class="position-fixed top-0 end-0 h-100 bg-white shadow" style="width: 45%; z-index:1050;">
<!-- CABECERA --> <!-- CABECERA -->
@ -129,23 +127,6 @@
<h5 class="m-0">Detalle Presupuesto @SelectedQuote?.Quotenumber</h5> <h5 class="m-0">Detalle Presupuesto @SelectedQuote?.Quotenumber</h5>
<button class="btn-close" @onclick="() => SelectedQuote = null"></button> <button class="btn-close" @onclick="() => SelectedQuote = null"></button>
</div> </div>
@* <!-- TABS -->
<ul class="nav nav-tabs px-3 mt-2" role="tablist">
<li class="nav-item">
<button class="nav-link @((activeTab == "Datos") ? "active" : "")"
@onclick='() => activeTab = "Datos"'>
Datos
</button>
</li>
<li class="nav-item">
<button class="nav-link @(activeTab == "Items" ? "active" : "")"
@onclick='() => activeTab = "Items"'>
Items
</button>
</li>
</ul> *@
<!-- CONTENIDO --> <!-- CONTENIDO -->
<div class="p-3"> <div class="p-3">
<ul class="nav nav-tabs mb-3" role="tablist"> <ul class="nav nav-tabs mb-3" role="tablist">
@ -256,7 +237,6 @@
</div> </div>
</div> </div>
} }
} }
else if (IsLoading) else if (IsLoading)
{ {
@ -266,7 +246,6 @@
{ {
<p>No hay resultados.</p> <p>No hay resultados.</p>
} }
</div> </div>
<!-- FOOTER: PAGINACIÓN --> <!-- FOOTER: PAGINACIÓN -->
@ -300,25 +279,17 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@code { @code {
private QuoteSearchParams Filters = new(); private QuoteSearchParams Filters = new();
private PagedResult<QuoteDto>? PagedQuotes; private PagedResult<QuoteDto>? PagedQuotes;
private QuoteDto? SelectedQuote { get; set; }
private bool IsLoading; private bool IsLoading;
private int PaginaDeseada = 1; private int PaginaDeseada = 1;
private QuoteDto? SelectedQuote { get; set; }
// private List<QuoteItemDto>? SelectedQuoteItems => SelectedQuote?.Items;
// private List<QuoteTaxDto>? SelectedQuoteTaxes => SelectedQuote?.Taxes;
private string activeTab = "Datos"; private string activeTab = "Datos";
// protected override async Task OnInitializedAsync()
// {
// await Search();
// }
private async Task Search() private async Task Search()
{ {
try try
@ -332,7 +303,6 @@
Filters.PatientId, Filters.PatientText, Filters.Status, Filters.PatientId, Filters.PatientText, Filters.Status,
Filters.IssueDateFrom, Filters.IssueDateTo, Filters.IssueDateFrom, Filters.IssueDateTo,
Filters.Page, Filters.PageSize); Filters.Page, Filters.PageSize);
PaginaDeseada = Filters.Page; PaginaDeseada = Filters.Page;
} }
catch (Exception ex) catch (Exception ex)
@ -381,6 +351,12 @@
toastService.ShowWarning("Número de página fuera de rango."); toastService.ShowWarning("Número de página fuera de rango.");
} }
} }
private bool PuedeRetroceder => PagedQuotes != null && Filters.Page > 1;
private bool PuedeAvanzar => PagedQuotes != null && Filters.Page < TotalPaginas;
private int TotalPaginas => PagedQuotes is null ? 1 :
(int)Math.Ceiling((double)(PagedQuotes.TotalItems) / Filters.PageSize);
private void Create() private void Create()
{ {
Navigation.NavigateTo("/quote/create/"); Navigation.NavigateTo("/quote/create/");
@ -391,12 +367,6 @@
PagedQuotes = null; PagedQuotes = null;
PaginaDeseada = 1; PaginaDeseada = 1;
} }
private bool PuedeRetroceder => PagedQuotes != null && Filters.Page > 1;
private bool PuedeAvanzar => PagedQuotes != null && Filters.Page < TotalPaginas;
private int TotalPaginas => PagedQuotes is null ? 1 :
(int)Math.Ceiling((double)(PagedQuotes.TotalItems) / Filters.PageSize);
private string GetStatusBadge(string status) => status switch private string GetStatusBadge(string status) => status switch
{ {
"Emitido" => "bg-primary text-white", "Emitido" => "bg-primary text-white",
@ -412,20 +382,4 @@
{ {
// lógica de impresión... // lógica de impresión...
} }
public class QuoteSearchParams : PagedRequest
{
public int? CustomerId { get; set; }
public string? CustomerText { get; set; }
public string? QuoteNumber { get; set; }
public int? ProfessionalId { get; set; }
public string? ProfessionalText { get; set; }
public int? InstitutionId { get; set; }
public string? InstitutionText { get; set; }
public int? PatientId { get; set; }
public string? PatientText { get; set; }
public DateTime? IssueDateFrom { get; set; }
public DateTime? IssueDateTo { get; set; }
public string? Status { get; set; }
}
} }