diff --git a/StockMan.CORE/Components/ItemList.razor b/StockMan.CORE/Components/ItemList.razor
index d1fb754..58d04c2 100644
--- a/StockMan.CORE/Components/ItemList.razor
+++ b/StockMan.CORE/Components/ItemList.razor
@@ -27,12 +27,42 @@ else
DESC. ARTICOLO
|
- orderByCodForn()">
- COD. FORNITORE
- |
- orderByStock()">
- STOCK
- |
+ @if (orderType == orderTypeEnum.codExtAscending)
+ {
+ orderByCodForn()" style="background-color: rgb(0, 105, 92); color: #fff;">
+ COD. FORNITORE
+ |
+ }
+ else if (orderType == orderTypeEnum.codExtDescending)
+ {
+ orderByCodForn()" style="background-color: rgb(175, 180, 43)">
+ COD. FORNITORE
+ |
+ }
+ else
+ {
+ orderByCodForn()" style="background-color: rgba(0, 105, 92, 0.5)">
+ COD. FORNITORE
+ |
+ }
+ @if (orderType == orderTypeEnum.stockAscending)
+ {
+ orderByStock()" style="background-color: rgb(142, 68, 173); color: #fff;">
+ STOCK
+ |
+ }
+ else if (orderType == orderTypeEnum.stockDescending)
+ {
+ orderByStock()" style="background-color: rgb(41, 128, 185)">
+ STOCK
+ |
+ }
+ else
+ {
+ orderByStock()" style="background-color: rgba(41, 128, 185, 0.5)">
+ STOCK
+ |
+ }
VALORE UNIT.
|
diff --git a/StockMan.CORE/Components/ItemList.razor.cs b/StockMan.CORE/Components/ItemList.razor.cs
index 8ff0d51..b56495e 100644
--- a/StockMan.CORE/Components/ItemList.razor.cs
+++ b/StockMan.CORE/Components/ItemList.razor.cs
@@ -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()