Skip to content

Commit

Permalink
Correcciones 06/11/2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario González Galindo committed Nov 6, 2023
1 parent 5d665b8 commit 120fcf7
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 42 deletions.
16 changes: 3 additions & 13 deletions MCPackServer/Server/Pages/ProjectsModule/ConsultationsGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<MudTHeadRow>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.ProjectNumber)" T="ProjectsView">Número de proyecto</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.ClientId)" T="ProjectsView">Cliente</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.AdmissionDate)" T="ProjectsView">Fecha de admisión</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.CommitmentDate)" T="ProjectsView">Fecha de compromiso</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.DeliveryDate)" T="ProjectsView">Fecha de entrega</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.Description)" T="ProjectsView">Descripción de proyecto</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="@nameof(ProjectsView.Type)" T="ProjectsView">Tipo de proyecto</MudTableSortLabel></MudTh>
<MudTh></MudTh>
</MudTHeadRow>
Expand All @@ -39,8 +37,6 @@
OnClearButtonClick="() => ClientIdFilter = null" />
</MudTh>
<MudTh />
<MudTh />
<MudTh />
<MudTh>
<MudSelect @bind-Value="TypeFilter" T="string" Placeholder="Buscar por tipo" Clearable >
<MudSelectItem T="string" Value="@("Proyecto")" />
Expand All @@ -54,14 +50,8 @@
<RowTemplate>
<MudTd DataLabel="ID">@context.ProjectNumber</MudTd>
<MudTd DataLabel="Cliente">@context.ClientMarketName</MudTd>
<MudTd DataLabel="Fecha de ingreso">
@(context.AdmissionDate?.Date.ToShortDateString() ?? "N/A")
</MudTd>
<MudTd DataLabel="Fecha de compromiso de entrega">
@(context.CommitmentDate?.Date.ToShortDateString() ?? "N/A")
</MudTd>
<MudTd DataLabel="Fecha de entrega estimada">
@(context.DeliveryDate?.Date.ToShortDateString() ?? "N/A")
<MudTd DataLabel="Descripción de proyecto">
@context.Description
</MudTd>
<MudTd DataLabel="Condiciones de pago">@context.Type</MudTd>
<MudTd>
Expand Down
12 changes: 7 additions & 5 deletions MCPackServer/Server/Pages/ProjectsModule/ProjectDetails.razor
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@

<div class="m-3">
<MudText Typo="Typo.h4" Align="Align.Start">PRODUCTOS DE PROYECTO</MudText>
@*DETAIL: This MudTable has a provisional "OnRowClick="OnSelectedProject""*@
<MudTable @ref="ProductsTable" T="ProjectProductsView" Dense Hover FixedHeader
CustomHeader Striped OnRowClick="OnSelectedProduct" ServerData="ProductsServerReload" >
CustomHeader Striped
ServerData="ProductsServerReload" >
<ColGroup>
<col style="width: 15%" />
<col style="width: 50%" />
Expand All @@ -44,10 +46,10 @@
<ToolBarContent>
<MudText Typo="Typo.h6">Productos del proyecto</MudText>
<MudSpacer />
<MudButton Variant="Variant.Outlined" Class="ml-1"
@*<MudButton Variant="Variant.Outlined" Class="ml-1"
OnClick="() => SelectedProducts.Clear()">
Contraer todo
</MudButton>
</MudButton>*@
<MudButton Variant="Variant.Outlined" Class="ml-1"
OnClick="async () => await ProductsTable.ReloadServerData()">
<MudIcon Icon="@Icons.Material.Filled.Search" /> Buscar
Expand All @@ -65,7 +67,7 @@
<MudTd DataLabel="Descripción">@context.ProductDescription</MudTd>
<MudTd DataLabel="Cantidad">@context.Quantity</MudTd>
</RowTemplate>
<ChildRowContent>
@*<ChildRowContent>
@if (SelectedProducts.Any(x => x.ProductId == context.ProductId))
{
<MudTr>
Expand Down Expand Up @@ -99,7 +101,7 @@
</td>
</MudTr>
}
</ChildRowContent>
</ChildRowContent>*@
<NoRecordsContent>
<MudText>Sin productos encontrados para el proyecto</MudText>
</NoRecordsContent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/PurchaseOrders"
@page "/PurchaseOrders"

@attribute [Authorize (Policy = @Constants.Permissions.PurchaseOrders.View)]

Expand All @@ -25,31 +25,34 @@
</MudButton>
</ToolBarContent>
<HeaderContent>
<MudTHeadRow>
<MudTh><MudTableSortLabel SortLabel="OrderNumber" T="PurchaseOrdersView">Número de órden</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="IssuedDate" T="PurchaseOrdersView">Fecha de emisión</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="ProviderLegalName" T="PurchaseOrdersView">Proveedor</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="ProjectNumber" T="PurchaseOrdersView">Proyecto</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortLabel="Status" T="PurchaseOrdersView">Estatus</MudTableSortLabel></MudTh>
<MudTh />
</MudTHeadRow>
<MudTHeadRow>
<MudTh>
<MudTableSortLabel SortLabel="@nameof(PurchaseOrdersView.OrderNumber)" T="PurchaseOrdersView">
Número de órden
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="@nameof(PurchaseOrdersView.IssuedDate)" T="PurchaseOrdersView">
Fecha de emisión
</MudTableSortLabel>
<MudTextField T="string" @bind-Value="OrderNumberFilter" Clearable Placeholder="Buscar por número de orden" />
</MudTh>
<MudTh />
<MudTh>
<MudTableSortLabel SortLabel="@nameof(PurchaseOrdersView.ProviderId)" T="PurchaseOrdersView">
Proveedor
</MudTableSortLabel>
<MudAutocomplete T="string" @bind-Value="ProviderIdFilter" SearchFunc="async (f) => await ProvidersServerReload(f)"
ToStringFunc="new Func<string, string>(GetProviderLegalName)" Clearable OnClearButtonClick="() => ProviderIdFilter = string.Empty"
Placeholder="Buscar por proveedor" />
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="@nameof(PurchaseOrdersView.ProjectId)" T="PurchaseOrdersView">
Proyecto
</MudTableSortLabel>
<MudAutocomplete T="string" @bind-Value="ProjectIdFilter" SearchFunc="async (f) => await ProjectsServerReload(f)"
ToStringFunc="new Func<string, string>(GetProjectNumber)" Clearable OnClearButtonClick="() => ProjectIdFilter = string.Empty"
Placeholder="Buscar por proyecto" />
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="@nameof(PurchaseOrdersView.Status)" T="PurchaseOrdersView">
Estatus
</MudTableSortLabel>
<MudSelect T="string" @bind-Value="StatusFilter" Clearable Placeholder="Buscar por estatus">
<MudSelectItem T="string" Value="@("Pendiente")" />
<MudSelectItem T="string" Value="@("RECIBIDA")" />
</MudSelect>
</MudTh>
<MudTh />
</MudTHeadRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MudBlazor;
using System.Linq;
using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Asn1.Pkcs;
using System.Text.Json;

namespace MCPackServer.Pages.PurchaseOrdersModule
Expand Down Expand Up @@ -45,7 +47,16 @@ public partial class PurchaseOrdersPage

#region API elements
#region Search Filters
private string OrderNumberFilter = string.Empty;
private string StatusFilter = string.Empty;
private string ProviderIdFilter = string.Empty;
private string ProjectIdFilter = string.Empty;
private string IssuedDateFilter = string.Empty;
#endregion

#region Autocomplete filters
private List<Providers> ProvidersList = new();
private List<Projects> ProjectsList = new();
#endregion
#endregion

Expand Down Expand Up @@ -87,10 +98,49 @@ protected override void OnAfterRender(bool firstRender)
#region OrdersTable methods
private async Task<TableData<PurchaseOrdersView>> PurchaseOrdersServerReload(TableState state)
{
List<WhereFilter> filters = new()
{
new WhereFilter
{
Field = "OrderNumber",
Value = OrderNumberFilter,
Operator = Operators.Contains,
Condition = Conditions.And
},
new WhereFilter
{
Field = nameof(PurchaseOrders.ProjectId),
Value = ProjectIdFilter,
Operator = Operators.Contains,
Condition = Conditions.And
},
new WhereFilter
{
Field = nameof(PurchaseOrders.ProviderId),
Value = ProviderIdFilter,
Operator = Operators.Contains,
Condition = Conditions.And
},
new WhereFilter
{
Field = nameof(PurchaseOrders.IssuedDate),
Value = IssuedDateFilter,
Operator = Operators.Contains,
Condition = Conditions.And
},
new WhereFilter
{
Field = "Status",
Value = StatusFilter,
Operator = Operators.Contains,
Condition = Conditions.And
}
};
DataManagerRequest request = new()
{
Take = state.PageSize,
Skip = state.PageSize * state.Page
Skip = state.PageSize * state.Page,
Where = filters
};
string field = state.SortLabel ?? "IssuedDate";
string order = state.SortDirection == SortDirection.Ascending ? "ASC" : "DESC";
Expand Down Expand Up @@ -297,5 +347,66 @@ private void RemoveTab(MudTabPanel? tabPanel = null, ArticlesToPurchaseView? art
var selectedArticle = article ?? SelectedArticles.FirstOrDefault(p => id == p.QuoteId);
if (null != selectedArticle) SelectedArticles.Remove(selectedArticle);
}

private async Task<List<string>> ProvidersServerReload(string filter)
{
List<string> result = new();
DataManagerRequest dm = new()
{
Where = new()
{
new WhereFilter { Field = nameof(Providers.LegalName), Operator = Operators.Contains, Value = filter }
}
};
var items = await _service.GetForGridAsync<Providers>(dm);
if (null != items)
{
ProvidersList = items.ToList();
ProvidersList.ForEach(p => result.Add(p.Id.ToString()));
}
return result;
}

private async Task<List<string>> ProjectsServerReload(string filter)
{
List<string> result = new();
DataManagerRequest dm = new()
{
Where = new()
{
new WhereFilter
{ Field = nameof(Projects.ProjectNumber), Operator = Operators.Contains, Value=filter }
}
};
var items = await _service.GetForGridAsync<Projects>(dm);
if (null != items)
{
ProjectsList = items.ToList();
ProjectsList.ForEach(p => result.Add(p.Id.ToString()));
}
return result;
}

private string GetProviderLegalName(string Id)
{
string result = string.Empty;
if (!string.IsNullOrEmpty(Id))
{
var match = ProvidersList.FirstOrDefault(p => Id == p.Id.ToString());
if (null != match) result = match.LegalName;
}
return result;
}

private string GetProjectNumber(string Id)
{
string result = string.Empty;
if (!string.IsNullOrEmpty(Id))
{
var match = ProjectsList.FirstOrDefault(p => Id == p.Id.ToString());
if (null != match) result = match.ProjectNumber;
}
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ else
<div style="position: absolute; left: 100px; width: 75px; padding: 5px 0px 0px 5px; ">
@ProjectClient.MarketName
</div>
<div style="position: absolute; left: 200px; width: 200px; padding: 5px 0px 0px 5px; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow:hidden;">
<div style="position: absolute; left: 200px; width: 200px; padding: 5px 0px 0px 5px; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow:hidden; text-overflow: inherit">
@OrderProject.Description
</div>
</div>
Expand Down Expand Up @@ -166,22 +166,22 @@ else
</div>
<div style="position: absolute; left: 506px; right: 5px; top: 20%; bottom: 20%; text-align: right; vertical-align: central;">
<div>
<span style="color: black">
<span style="color: black; font-size: 12pt;">
$@Discount.ToString("n2") @Order.Currency
</span>
</div>
<div>
<span style="color: black">
<span style="color: black; font-size: 12pt;">
$@Subtotal.ToString("n2") @Order.Currency
</span>
</div>
<div>
<span style="color: black">
<span style="color: black; font-size: 12pt;">
$@Tax.ToString("n2") @Order.Currency
</span>
</div>
<div>
<span style="color: black">
<span style="color: black; font-size: 12pt;">
$@Total.ToString("n2") @Order.Currency
</span>
</div>
Expand Down

0 comments on commit 120fcf7

Please sign in to comment.