using EgwCoreLib.Lux.Core.Generic; using EgwCoreLib.Lux.Data.Services.General; namespace Lux.UI.Components.Pages { public partial class ProdPlanner { #region Protected Methods protected override void OnParametersSet() { // preparo sel periodo custom (traduzioni)... CustomSelDict = Enum.GetValues(typeof(DtUtils.PeriodSet)) .Cast() .ToDictionary(e => e, e => Traduci("periodo_" + e.ToString())); } protected override Task OnParametersSetAsync() { isLoading = true; return ReloadDataAsync(); } #endregion Protected Methods #region Private Fields /// /// Periodo selezionato attuale /// private DtUtils.Periodo PeriodoSel = new DtUtils.Periodo(DtUtils.PeriodSet.ThisYear); /// /// Periodo custom selezione valori /// private Dictionary? CustomSelDict = new(); private List? ListOdl = null; private bool isLoading = false; private bool showDetail = false; #endregion Private Fields #region Private Properties [Inject] private IDataLayerServices DLService { get; set; } = null!; [Inject] private IProductionOdlService POService { get; set; } = null!; private List ListEventi { get; set; } = new(); private string CssDetail => showDetail ? "fa-chevron-up" : "fa-chevron-down"; #endregion Private Properties #region Private Methods /// /// Legge i dati dei record completi /// private async Task ReloadDataAsync() { var rawData = await DLService.PlannerGetEventsAsync(PeriodoSel.Inizio, PeriodoSel.Fine); if (rawData != null && rawData.Count > 0) { ListEventi.Clear(); // x ora copio i vari blocchi... foreach (var item in rawData) { ListEventi.AddRange(item.Value); } } ListOdl = await POService.GetUnassignOdlDtoAsync(); isLoading = false; } /// /// Imposta periodo da filtro /// /// /// private Task SetPeriodo(DtUtils.Periodo newPeriod) { PeriodoSel = newPeriod; return ReloadDataAsync(); } private void ToggleDetail() { showDetail = !showDetail; } private string ButtonEspandi() { string ans = ""; if (showDetail) ans = Traduci("caricoMac_riduci"); else ans = Traduci("caricoMac_espandi"); return ans; } #endregion Private Methods } }