using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data.DbModels; using MP.SPEC.Components; using MP.SPEC.Data; using EgwCoreLib.Razor; namespace MP.SPEC.Pages { public partial class DOSS { #region Protected Fields protected DataPager? pagerODL = null!; #endregion Protected Fields #region Protected Properties [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; [Inject] protected MpDataService MDService { get; set; } = null!; #endregion Protected Properties #region Protected Methods protected void ForceReload(int newNum) { numRecord = newNum; } protected void ForceReloadPage(int newNum) { currPage = newNum; StateHasChanged(); } protected override async Task OnInitializedAsync() { isLoading = true; isFiltering = true; // fix pagina await Task.Delay(1); var modFilter = currFilter; modFilter.CurrPage = 1; currFilter = modFilter; await Task.Delay(1); isFiltering = false; } protected async Task selRecordDoss(DossierModel selDoss) { currRecordDoss = selDoss; await Task.Delay(1); } protected void updateTotal(int newTotCount) { totalCount = newTotCount; } protected void UpdateTotCount(int newTotCount) { totalCount = newTotCount; } #endregion Protected Methods #region Private Properties private SelectDossierParams currFilter { get; set; } = new SelectDossierParams(); private int currPage { get => currFilter.CurrPage; set => currFilter.CurrPage = value; } private DossierModel? currRecordDoss { get; set; } = null; private bool isEditing { get => currFilter.isEditing; set => currFilter.isEditing = value; } private bool isFiltering { get; set; } = false; private bool isLoading { get; set; } = true; private int numRecord { get => currFilter.NumRec; set => currFilter.NumRec = value; } private int totalCount { get => currFilter.TotCount; set => currFilter.TotCount = value; } #endregion Private Properties #region Private Methods private string css() { string answ = ""; if (isEditing == false) { answ = "hidden"; } else { answ = "visible"; } return answ; } private void enableEditing() { isEditing = true; } private async Task updateFilter(SelectDossierParams newParams) { isFiltering = false; isLoading = true; await Task.Delay(1); currPage = 1; await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); currFilter = newParams; isLoading = false; } #endregion Private Methods } }