diff --git a/Models/Repositories/PhSQuoteRepository.cs b/Models/Repositories/PhSQuoteRepository.cs index 757c3e4..f1af0f6 100644 --- a/Models/Repositories/PhSQuoteRepository.cs +++ b/Models/Repositories/PhSQuoteRepository.cs @@ -112,7 +112,8 @@ namespace Models.Repositories if (!string.IsNullOrWhiteSpace(status)) query = query.Where(q => q.Status == status); - // 3) Execute paged query + // 3) Order by most recent and execute paged query + query = query.OrderByDescending(q => q.Issuedate); var pagedEntities = await query.ToPagedResultAsync(page, pageSize); // 4) Project to DTOs diff --git a/phronCare.UIBlazor/Layout/NavMenu.razor b/phronCare.UIBlazor/Layout/NavMenu.razor index 34b1f31..955e23b 100644 --- a/phronCare.UIBlazor/Layout/NavMenu.razor +++ b/phronCare.UIBlazor/Layout/NavMenu.razor @@ -65,7 +65,7 @@ diff --git a/phronCare.UIBlazor/Pages/Sales/Quotes/QuoteDashboard.razor b/phronCare.UIBlazor/Pages/Sales/Quotes/QuoteDashboard.razor new file mode 100644 index 0000000..a350158 --- /dev/null +++ b/phronCare.UIBlazor/Pages/Sales/Quotes/QuoteDashboard.razor @@ -0,0 +1,198 @@ +@page "/quotes/dashboard" +@using PSC.Blazor.Components.Chartjs +@using PSC.Blazor.Components.Chartjs.Models.Pie +@using PSC.Blazor.Components.Chartjs.Models.Bar +@using PSC.Blazor.Components.Chartjs.Models.Line +@using PSC.Blazor.Components.Chartjs.Models.Common +@inject NavigationManager Navigation +
+ + +
+

Dashboard Operativo de Presupuestos

+
+ + +
+
+
+ +
+
120
+
Total Quotes
+
+
+
+
+
+ +
+
65%
+
Approval Rate
+
+
+
+
+
+ +
+
$150,000
+
Total Quoted
+
+
+
+
+
+ +
+
$2,500
+
Average Quote
+
+
+
+
+ + +
+ + + + + +
+ + +
+
+
+
Quotes by Status
+ +
+
+ +
+
+
Top Productos Presupuestados
+ +
+
+ +
+
+
Quoted Amount Over Time
+ +
+
+
+
+ +@code { + private PieChartConfig _pieChartConfig; + private BarChartConfig _barChartConfig; + private LineChartConfig _lineChartConfig; + + protected override void OnInitialized() + { + InitPieChart(); + InitBarChart(); + InitLineChart(); + } + + private void InitPieChart() + { + _pieChartConfig = new PieChartConfig + { + Options = new PieOptions + { + Plugins = new Plugins + { + Legend = new Legend + { + Display = true, + Position = LegendPosition.Bottom + } + } + }, + Data = new PieData + { + Labels = new List { "Aprobado", "Pendiente", "Rechazado" }, + Datasets = new List + { + new PieDataset + { + Data = new List { 60, 25, 15 }, + BackgroundColor = new List { "#4CAF50", "#FFC107", "#F44336" } + } + } + } + }; + } + + private void InitBarChart() + { + _barChartConfig = new BarChartConfig + { + Options = new Options + { + Plugins = new Plugins { Legend = new Legend { Display = false } }, + Scales = new Dictionary + { + ["x"] = new Axis { Title = new AxesTitle { Display = true, Text = "Producto" } }, + ["y"] = new Axis { Title = new AxesTitle { Display = true, Text = "Cantidad" } } + } + }, + Data = new BarData + { + Labels = new List { "Prod A", "Prod B", "Prod C", "Prod D", "Prod E" }, + Datasets = new List + { + new BarDataset + { + Data = new List { 10, 8, 6, 5, 4 }, + BackgroundColor = Enumerable.Repeat("#2196F3", 5).ToList() + } + } + } + }; + } + + private void InitLineChart() + { + _lineChartConfig = new LineChartConfig + { + Options = new Options + { + Plugins = new Plugins { Legend = new Legend { Display = true } }, + Scales = new Dictionary + { + ["x"] = new Axis { Title = new AxesTitle { Display = true, Text = "Mes" } }, + ["y"] = new Axis { Title = new AxesTitle { Display = true, Text = "Monto ($)" } } + } + }, + Data = new LineData + { + Labels = new List { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio" }, + Datasets = new List + { + new LineDataset + { + Label = "Total Presupuestado", + Data = new List { 10000, 12000, 13000, 14000, 16000, 20000 }, + Fill = false, + BorderColor = "#4CAF50", + Tension = 0.3m + } + } + } + }; + } +} diff --git a/phronCare.UIBlazor/Pages/Sales/Quotes/QuoteDashboard.razor.css b/phronCare.UIBlazor/Pages/Sales/Quotes/QuoteDashboard.razor.css new file mode 100644 index 0000000..7beb87a --- /dev/null +++ b/phronCare.UIBlazor/Pages/Sales/Quotes/QuoteDashboard.razor.css @@ -0,0 +1,33 @@ +.quote-action-button { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.6rem 1.2rem; + background-color: #fff; + border: 1px solid #ccc; + border-radius: 10px; + box-shadow: 0 2px 6px rgba(0,0,0,0.05); + font-size: 0.95rem; + font-weight: 500; + color: #333; + transition: all 0.2s ease-in-out; +} + + .quote-action-button i { + font-size: 1.2rem; + } + + .quote-action-button:hover { + background-color: #f8f9fa; + transform: translateY(-1px); + box-shadow: 0 4px 10px rgba(0,0,0,0.07); + } + + .quote-action-button.success { + border-color: #198754; + color: #198754; + } + + .quote-action-button.success:hover { + background-color: #e8f5e9; + } diff --git a/phronCare.UIBlazor/Pages/Sales/Quotes/Quotes.razor b/phronCare.UIBlazor/Pages/Sales/Quotes/Quotes.razor index 14b13a4..cc73a84 100644 --- a/phronCare.UIBlazor/Pages/Sales/Quotes/Quotes.razor +++ b/phronCare.UIBlazor/Pages/Sales/Quotes/Quotes.razor @@ -113,10 +113,10 @@ @if (quote.Status?.ToLower() == "emitido") { - } @@ -259,19 +259,19 @@