Ancora update selezione valori pareto

This commit is contained in:
Samuele Locatelli
2026-04-10 12:16:35 +02:00
parent 43fd04e289
commit 2b8a5313cd
3 changed files with 48 additions and 3 deletions
+7 -3
View File
@@ -7,12 +7,16 @@
<ul class="list-group">
@foreach (var itemDet in ListPaged)
{
<li class="list-group-item d-flex justify-content-between align-items-start small py-1">
<div>
<li class="list-group-item @CheckSelect(itemDet.Label) d-flex justify-content-between align-items-start small py-1">
<div class="fs-6 align-items-center">
<button class="btn btn-sm btn-info" @onclick="() => DoSelect(itemDet.Label)">
<i class="fa-solid fa-magnifying-glass"></i>
</button>
@itemDet.Label
</div>
<div class="">
<div class="text-end">
<b>@($"{itemDet.Value:N0}")</b>
<div class="small">@($"({valPerc(itemDet.Value):P2})")</div>
</div>
</li>
}
@@ -7,6 +7,9 @@ namespace MP.IOC.Components.Compo
{
#region Public Properties
[Parameter]
public EventCallback<string> EC_Selected { get; set; }
[Parameter]
public List<StatDataDTO> ParetoList { get; set; } = null!;
@@ -21,13 +24,25 @@ namespace MP.IOC.Components.Compo
{
//base.OnParametersSet();
totalCount = ParetoList.Count();
grandTotal = ParetoList.Sum(x => x.Value);
if (grandTotal == 0)
{
grandTotal = 1;
}
UpdateTable();
}
protected double valPerc(double valore)
{
return valore / grandTotal;
}
#endregion Protected Methods
#region Private Fields
private string currSelect = "";
private double grandTotal = 1;
private List<StatDataDTO> ListPaged = new();
private int numRecPage = 10;
@@ -40,6 +55,24 @@ namespace MP.IOC.Components.Compo
#region Private Methods
private string CheckSelect(string curKey)
{
return !string.IsNullOrEmpty(currSelect) && currSelect == curKey ? "bg-dark text-light bg-gradient" : "";
}
private void DoReset()
{
currSelect = "";
}
private void DoSelect(string reqKey)
{
if (ParetoList.Any(x => x.Label == reqKey))
{
currSelect = reqKey;
}
}
private void SaveNumRec(int newNum)
{
numRecPage = newNum;
@@ -31,8 +31,11 @@ namespace MP.IOC.Components.Pages
#region Private Fields
private List<StatDataDTO> currData = new();
private string currSelect = "";
private string currTitle = "";
private Dictionary<string, List<StatDataDTO>> ParetoDay = new();
#endregion Private Fields
@@ -65,6 +68,11 @@ namespace MP.IOC.Components.Pages
#region Private Methods
private string CheckSelect(string curKey)
{
return !string.IsNullOrEmpty(currSelect) && currSelect == curKey ? "active" : "";
}
private void DoReset()
{
currSelect = "";