fix ordinamento per codice fornitore

This commit is contained in:
zaccaria.majid
2023-02-15 09:36:40 +01:00
parent bba472fde3
commit c7e9063458
2 changed files with 66 additions and 10 deletions
+36 -6
View File
@@ -27,12 +27,42 @@ else
<th>
DESC. ARTICOLO
</th>
<th @onclick="()=>orderByCodForn()">
COD. FORNITORE
</th>
<th @onclick="()=>orderByStock()">
STOCK
</th>
@if (orderType == orderTypeEnum.codExtAscending)
{
<th @onclick="()=>orderByCodForn()" style="background-color: rgb(0, 105, 92); color: #fff;">
COD. FORNITORE
</th>
}
else if (orderType == orderTypeEnum.codExtDescending)
{
<th @onclick="()=>orderByCodForn()" style="background-color: rgb(175, 180, 43)">
COD. FORNITORE
</th>
}
else
{
<th @onclick="()=>orderByCodForn()" style="background-color: rgba(0, 105, 92, 0.5)">
COD. FORNITORE
</th>
}
@if (orderType == orderTypeEnum.stockAscending)
{
<th @onclick="()=>orderByStock()" style="background-color: rgb(142, 68, 173); color: #fff;">
STOCK
</th>
}
else if (orderType == orderTypeEnum.stockDescending)
{
<th @onclick="()=>orderByStock()" style="background-color: rgb(41, 128, 185)">
STOCK
</th>
}
else
{
<th @onclick="()=>orderByStock()" style="background-color: rgba(41, 128, 185, 0.5)">
STOCK
</th>
}
<th>
VALORE UNIT.
</th>
+30 -4
View File
@@ -78,6 +78,7 @@ namespace StockMan.CORE.Components
private IConfiguration Configuration { get; set; } = null!;
protected bool isLoading = false;
protected orderTypeEnum orderType = orderTypeEnum.none;
protected bool isStockAscending = false;
protected bool isCodExtAscending = false;
@@ -93,19 +94,19 @@ namespace StockMan.CORE.Components
SearchRecords = await SDService.ItemsGetAll();
}
totalCount = SearchRecords.Count;
if (isStockAscending)
if ( orderType == orderTypeEnum.stockAscending)
{
SearchRecords = SearchRecords.OrderBy(x => x.QtaBatch).ToList();
}
else if (!isStockAscending)
else if (orderType == orderTypeEnum.stockDescending)
{
SearchRecords = SearchRecords.OrderByDescending(x => x.QtaBatch).ToList();
}
else if (isCodExtAscending)
else if (orderType == orderTypeEnum.codExtAscending)
{
SearchRecords = SearchRecords.OrderBy(x => x.CodExt).ToList();
}
else if (!isCodExtAscending)
else if (orderType == orderTypeEnum.stockDescending)
{
SearchRecords = SearchRecords.OrderByDescending(x => x.CodExt).ToList();
}
@@ -122,14 +123,39 @@ namespace StockMan.CORE.Components
NavManager.NavigateTo(rawCode, true);
}
protected enum orderTypeEnum
{
none = 1,
stockAscending,
stockDescending,
codExtAscending,
codExtDescending
}
protected async Task orderByStock()
{
isStockAscending = !isStockAscending;
if (isStockAscending)
{
orderType = orderTypeEnum.stockAscending;
}
else
{
orderType = orderTypeEnum.stockDescending;
}
await reloadData();
}
protected async Task orderByCodForn()
{
isCodExtAscending = !isCodExtAscending;
if (isCodExtAscending)
{
orderType = orderTypeEnum.codExtAscending;
}
else
{
orderType = orderTypeEnum.codExtDescending;
}
await reloadData();
}
protected async Task addNewItem()