diff --git a/MCPackServer/Server/Pages/ProjectsModule/ConsultationsGrid.razor b/MCPackServer/Server/Pages/ProjectsModule/ConsultationsGrid.razor index 2948cba..6065959 100644 --- a/MCPackServer/Server/Pages/ProjectsModule/ConsultationsGrid.razor +++ b/MCPackServer/Server/Pages/ProjectsModule/ConsultationsGrid.razor @@ -22,9 +22,7 @@ Número de proyecto Cliente - Fecha de admisión - Fecha de compromiso - Fecha de entrega + Descripción de proyecto Tipo de proyecto @@ -39,8 +37,6 @@ OnClearButtonClick="() => ClientIdFilter = null" /> - - @@ -54,14 +50,8 @@ @context.ProjectNumber @context.ClientMarketName - - @(context.AdmissionDate?.Date.ToShortDateString() ?? "N/A") - - - @(context.CommitmentDate?.Date.ToShortDateString() ?? "N/A") - - - @(context.DeliveryDate?.Date.ToShortDateString() ?? "N/A") + + @context.Description @context.Type diff --git a/MCPackServer/Server/Pages/ProjectsModule/ProjectDetails.razor b/MCPackServer/Server/Pages/ProjectsModule/ProjectDetails.razor index cca429c..922fb2f 100644 --- a/MCPackServer/Server/Pages/ProjectsModule/ProjectDetails.razor +++ b/MCPackServer/Server/Pages/ProjectsModule/ProjectDetails.razor @@ -33,8 +33,10 @@
PRODUCTOS DE PROYECTO + @*DETAIL: This MudTable has a provisional "OnRowClick="OnSelectedProject""*@ + CustomHeader Striped + ServerData="ProductsServerReload" > @@ -44,10 +46,10 @@ Productos del proyecto - Contraer todo - + *@ Buscar @@ -65,7 +67,7 @@ @context.ProductDescription @context.Quantity - + @* @if (SelectedProducts.Any(x => x.ProductId == context.ProductId)) { @@ -99,7 +101,7 @@ } - + *@ Sin productos encontrados para el proyecto diff --git a/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor b/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor index 5eccd68..d9155d3 100644 --- a/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor +++ b/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor @@ -1,4 +1,4 @@ -@page "/PurchaseOrders" + @page "/PurchaseOrders" @attribute [Authorize (Policy = @Constants.Permissions.PurchaseOrders.View)] @@ -25,31 +25,34 @@ + + Número de órden + Fecha de emisión + Proveedor + Proyecto + Estatus + + - - Número de órden - - - - - Fecha de emisión - + + - - Proveedor - + - - Proyecto - + - - Estatus - + + + + diff --git a/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor.cs b/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor.cs index c27423d..0038cde 100644 --- a/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor.cs +++ b/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersPage.razor.cs @@ -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 @@ -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 ProvidersList = new(); + private List ProjectsList = new(); #endregion #endregion @@ -87,10 +98,49 @@ protected override void OnAfterRender(bool firstRender) #region OrdersTable methods private async Task> PurchaseOrdersServerReload(TableState state) { + List 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"; @@ -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> ProvidersServerReload(string filter) + { + List result = new(); + DataManagerRequest dm = new() + { + Where = new() + { + new WhereFilter { Field = nameof(Providers.LegalName), Operator = Operators.Contains, Value = filter } + } + }; + var items = await _service.GetForGridAsync(dm); + if (null != items) + { + ProvidersList = items.ToList(); + ProvidersList.ForEach(p => result.Add(p.Id.ToString())); + } + return result; + } + + private async Task> ProjectsServerReload(string filter) + { + List result = new(); + DataManagerRequest dm = new() + { + Where = new() + { + new WhereFilter + { Field = nameof(Projects.ProjectNumber), Operator = Operators.Contains, Value=filter } + } + }; + var items = await _service.GetForGridAsync(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; + } } } diff --git a/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersReport.razor b/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersReport.razor index 89c0c74..af05beb 100644 --- a/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersReport.razor +++ b/MCPackServer/Server/Pages/PurchaseOrdersModule/PurchaseOrdersReport.razor @@ -138,7 +138,7 @@ else
@ProjectClient.MarketName
-
+
@OrderProject.Description
@@ -166,22 +166,22 @@ else
- + $@Discount.ToString("n2") @Order.Currency
- + $@Subtotal.ToString("n2") @Order.Currency
- + $@Tax.ToString("n2") @Order.Currency
- + $@Total.ToString("n2") @Order.Currency