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 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 string apiUrl = ""; private int currPage = 1; private bool isLoading = false; private List 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 OrderStateList { get => Enum.GetValues(typeof(Enums.BuyOrderStates)) .Cast() .ToList(); } private string ToggleIcon { get => showDetail ? "bi-chevron-up" : "bi-chevron-down"; } #endregion Private Properties #region Private Methods private void ConfInit() { apiUrl = Config.GetValue("ServerConf:ReportUrl") ?? ""; } /// /// Prepara URL x download report /// /// /// /// /// 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; } /// /// Ritorno step Tree /// /// 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 } }