168 lines
4.1 KiB
C#
168 lines
4.1 KiB
C#
using EgwCoreLib.Lux.Data.DbModel.Supplier;
|
|
|
|
namespace Lux.UI.Components.Compo.Warehouse
|
|
{
|
|
public partial class BuyOrderDetail
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public BuyOrderModel CurrRec { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public EventCallback<BuyOrderModel> EC_SaveBuyOrder { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
ConfInit();
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
totalCount = CurrRec.BuyOrderRowNav.Count;
|
|
UpdateTable();
|
|
base.OnParametersSet();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private bool allSelected = false;
|
|
|
|
private string apiUrl = "";
|
|
|
|
private int currPage = 1;
|
|
|
|
private bool isLoading = false;
|
|
|
|
private List<BuyOrderRowModel> ListRecords = new();
|
|
|
|
private int numRecord = 5;
|
|
|
|
private bool showDetail = false;
|
|
|
|
private int totalCount = 0;
|
|
|
|
private bool descriptEdit = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private IConfiguration Config { get; set; } = default!;
|
|
|
|
private List<Enums.BuyOrderStates> OrderStateList
|
|
{
|
|
get => Enum.GetValues(typeof(Enums.BuyOrderStates))
|
|
.Cast<Enums.BuyOrderStates>()
|
|
.ToList();
|
|
}
|
|
|
|
private string ToggleIcon
|
|
{
|
|
get => showDetail ? "bi-chevron-down" : "bi-chevron-right";
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void ConfInit()
|
|
{
|
|
apiUrl = Config.GetValue<string>("ServerConf:ReportUrl") ?? "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prepara URL x download report
|
|
/// </summary>
|
|
/// <param name="currId"></param>
|
|
/// <param name="objType"></param>
|
|
/// <param name="envir"></param>
|
|
/// <returns></returns>
|
|
private string DownloadUrl(int currId, string RepType = "BuyOrder", string SelFile = "BuyOrder_01")
|
|
{
|
|
return $"{apiUrl}/download?ReqId={currId}&RepType={RepType}&SelFile={SelFile}.repx";
|
|
}
|
|
|
|
private void SaveNumRec(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void SavePage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void ToggleGruppo()
|
|
{
|
|
showDetail = !showDetail;
|
|
}
|
|
|
|
private void UpdateTable()
|
|
{
|
|
// fix paginazione
|
|
ListRecords = CurrRec.BuyOrderRowNav
|
|
.OrderBy(x => x.ItemNav?.Description)
|
|
.Skip(numRecord * (currPage - 1))
|
|
.Take(numRecord)
|
|
.ToList();
|
|
isLoading = false;
|
|
}
|
|
|
|
private bool selectOptPrint = false;
|
|
private int currId = 0;
|
|
private void SelectOptPrint(int reqId)
|
|
{
|
|
selectOptPrint = true;
|
|
currId = reqId;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ritorno step Tree
|
|
/// </summary>
|
|
/// <param name="args"></param>
|
|
private void ClosePrintModal(bool args)
|
|
{
|
|
selectOptPrint = false;
|
|
}
|
|
|
|
private async Task SaveEditDescript(BuyOrderModel item)
|
|
{
|
|
if (descriptEdit && item != null)
|
|
{
|
|
await EC_SaveBuyOrder.InvokeAsync(item);
|
|
descriptEdit = false;
|
|
}
|
|
}
|
|
|
|
private void CancelEditDescript()
|
|
{
|
|
descriptEdit = false;
|
|
}
|
|
private void SetEditDescript()
|
|
{
|
|
descriptEdit = true;
|
|
}
|
|
|
|
private string hederTabCss()
|
|
{
|
|
string ans = "col-11";
|
|
if (CurrRec.BuyOrderRowNav.First().ClassCode.Equals("WindowHardware"))
|
|
{
|
|
ans = "col-6";
|
|
}
|
|
return ans;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |