97 lines
2.4 KiB
C#
97 lines
2.4 KiB
C#
using EgwCoreLib.Lux.Data.DbModel.Supplier;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
namespace Lux.UI.Components.Compo.Warehouse
|
|
{
|
|
public partial class BuyOrderList
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public List<BuyOrderModel> AllRecords { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public EventCallback<BuyOrderModel> EC_SaveBuyOrder { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
isLoading = true;
|
|
totalCount = AllRecords.Count;
|
|
UpdateTable();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private int currPage = 1;
|
|
|
|
private bool isLoading = false;
|
|
private List<BuyOrderModel> ListRecords = new List<BuyOrderModel>();
|
|
|
|
private int numRecord = 10;
|
|
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
private Enums.BuyOrderStates searchVal { get; set; } = Enums.BuyOrderStates.Created;
|
|
|
|
private Enums.BuyOrderStates SearchVal
|
|
{
|
|
get => searchVal;
|
|
set
|
|
{
|
|
if (searchVal != value)
|
|
{
|
|
searchVal = value;
|
|
UpdateTable();
|
|
}
|
|
}
|
|
}
|
|
|
|
private List<Enums.BuyOrderStates> OrderStateList
|
|
{
|
|
get => Enum.GetValues(typeof(Enums.BuyOrderStates))
|
|
.Cast<Enums.BuyOrderStates>()
|
|
.ToList();
|
|
}
|
|
|
|
#region Private Methods
|
|
|
|
private void SaveNumRec(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
currPage = 1;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void SavePage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void UpdateTable()
|
|
{
|
|
// fix paginazione
|
|
ListRecords = AllRecords
|
|
.Where(x => x.OrderState.Equals(SearchVal))
|
|
.OrderBy(x => x.BuyOrderCode)
|
|
.Skip(numRecord * (currPage - 1))
|
|
.Take(numRecord)
|
|
.ToList();
|
|
isLoading = false;
|
|
}
|
|
|
|
private Task SaveBuyOrder(BuyOrderModel item)
|
|
{
|
|
return EC_SaveBuyOrder.InvokeAsync(item);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |