diff --git a/MagMan.UI/Components/MacStatusMan.razor.cs b/MagMan.UI/Components/MacStatusMan.razor.cs index 51ee76e..68fd0e6 100644 --- a/MagMan.UI/Components/MacStatusMan.razor.cs +++ b/MagMan.UI/Components/MacStatusMan.razor.cs @@ -11,7 +11,7 @@ using Microsoft.JSInterop; namespace MagMan.UI.Components { - public partial class MacStatusMan + public partial class MacStatusMan : IDisposable { #region Public Properties @@ -23,6 +23,15 @@ namespace MagMan.UI.Components #endregion Public Properties + #region Public Methods + + public void Dispose() + { + AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated; + } + + #endregion Public Methods + #region Protected Properties [Inject] @@ -34,6 +43,8 @@ namespace MagMan.UI.Components [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + protected int maxRec { get; set; } = 1000; + [Inject] protected MTAdminService MTService { get; set; } = null!; @@ -43,35 +54,54 @@ namespace MagMan.UI.Components protected TenantService TService { get; set; } = null!; #endregion Protected Properties - private List MachineList = new List(); - private List? SearchRecords = null; - private List? ListRecords = null; - private string currSearch = ""; - private bool sortAsc = true; - private string sortField = ""; - private int currPage { get; set; } = 1; - private bool isLoading { get; set; } = false; - private int machIdSel = 0; - private int MachineIdSel + + #region Protected Methods + + protected string CheckSel(LogMachineModel curItem) { - get => machIdSel; - set + string answ = ""; +#if false + if (CurrItem != null) { - if (machIdSel != value) - { - machIdSel = value; - InvokeAsync(ReloadData); - } + answ = curItem.ProjDbId == CurrItem.ProjDbId ? "table-info" : ""; } + else + { + answ = curItem.ProjDbId == ProjDbId ? "table-info" : ""; + } +#endif + return answ; } - private int numRecord { get; set; } = 10; + protected void DoSelect(LogMachineModel? selItem) + { +#if false + if (selItem != null) + { + ProjDbId = selItem.ProjDbId; + } + else + { + ProjDbId = 0; + } + E_ProjSel.InvokeAsync(selItem); +#endif + } + + protected async Task ForceReload(bool force) + { +#if false + CurrItem = null; +#endif + await ReloadData(); + } protected override void OnInitialized() { currSearch = ""; AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated; } + protected override async Task OnParametersSetAsync() { await ReloadData(); @@ -90,57 +120,58 @@ namespace MagMan.UI.Components DoSelect(null); InvokeAsync(ReloadData); } + protected async Task SortRequested(Sorter.SortCallBack e) { sortField = e.ParamName; sortAsc = e.IsAscending; await ReloadData(); } - protected void DoSelect(LogMachineModel? selItem) + + #endregion Protected Methods + + #region Private Fields + + private string currSearch = ""; + private List? ListRecords = null; + private int machIdSel = 0; + private List MachineList = new List(); + private List? SearchRecords = null; + private bool sortAsc = true; + private string sortField = ""; + + #endregion Private Fields + + #region Private Properties + + private int currPage { get; set; } = 1; + private bool isLoading { get; set; } = false; + + private int MachineIdSel { -#if false - if (selItem != null) + get => machIdSel; + set { - ProjDbId = selItem.ProjDbId; + if (machIdSel != value) + { + machIdSel = value; + InvokeAsync(ReloadData); + } } - else - { - ProjDbId = 0; - } - E_ProjSel.InvokeAsync(selItem); -#endif } - protected async Task ForceReload(bool force) - { -#if false - CurrItem = null; -#endif - await ReloadData(); - } - protected string CheckSel(LogMachineModel curItem) - { - string answ = ""; -#if false - if (CurrItem != null) - { - answ = curItem.ProjDbId == CurrItem.ProjDbId ? "table-info" : ""; - } - else - { - answ = curItem.ProjDbId == ProjDbId ? "table-info" : ""; - } -#endif - return answ; - } + private int numRecord { get; set; } = 10; + + #endregion Private Properties + + #region Private Methods + private async void AppMService_EA_SearchUpdated() { currSearch = AppMService.SearchVal; await ReloadData(); } - protected int maxRec { get; set; } = 1000; - private async Task ReloadData() { isLoading = true; @@ -163,6 +194,7 @@ namespace MagMan.UI.Components isLoading = false; await InvokeAsync(StateHasChanged); } + private void SortTable() { if (SearchRecords != null) @@ -296,7 +328,7 @@ namespace MagMan.UI.Components default: break; - } + } #endif } @@ -311,5 +343,7 @@ namespace MagMan.UI.Components ListRecords = new List(); } } + + #endregion Private Methods } } \ No newline at end of file diff --git a/MagMan.UI/Components/MovMag.razor.cs b/MagMan.UI/Components/MovMag.razor.cs index d2f7c6f..d00af58 100644 --- a/MagMan.UI/Components/MovMag.razor.cs +++ b/MagMan.UI/Components/MovMag.razor.cs @@ -7,15 +7,13 @@ using Microsoft.JSInterop; namespace MagMan.UI.Components { - public partial class MovMag + public partial class MovMag : IDisposable { - #region Public Properties [Parameter] public int CustomerId { get; set; } = 0; - [Parameter] public int KeyNum { get; set; } = 0; @@ -24,6 +22,15 @@ namespace MagMan.UI.Components #endregion Public Properties + #region Public Methods + + public void Dispose() + { + AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated; + } + + #endregion Public Methods + #region Protected Properties [Inject] @@ -58,7 +65,6 @@ namespace MagMan.UI.Components return answ; } - #if false protected async Task CreateNew() { @@ -105,7 +111,7 @@ namespace MagMan.UI.Components RawItemId = 0; } E_RawItemSel.InvokeAsync(RawItemId); - } + } #endif protected async Task ForceReload(bool force) @@ -267,6 +273,7 @@ namespace MagMan.UI.Components SearchRecords = SearchRecords.OrderByDescending(x => x.Note).ToList(); } break; + case "UserId": if (sortAsc) { diff --git a/MagMan.UI/Components/ProjectMan.razor b/MagMan.UI/Components/ProjectMan.razor index 03aff09..8c81c47 100644 --- a/MagMan.UI/Components/ProjectMan.razor +++ b/MagMan.UI/Components/ProjectMan.razor @@ -162,10 +162,8 @@ - - @* @($"{item.ProgPerc:P2}") *@ - - @* *@ + @* *@ + @if (item.ProcTimeReal > 0) diff --git a/MagMan.UI/Components/ProjectMan.razor.cs b/MagMan.UI/Components/ProjectMan.razor.cs index 43b12fd..7faf6ee 100644 --- a/MagMan.UI/Components/ProjectMan.razor.cs +++ b/MagMan.UI/Components/ProjectMan.razor.cs @@ -1,5 +1,4 @@ using EgwCoreLib.Razor; -using k8s.Models; using MagMan.Core.Services; using MagMan.Data.Admin.DbModels; using MagMan.Data.Admin.Services; @@ -10,7 +9,7 @@ using Microsoft.JSInterop; namespace MagMan.UI.Components { - public partial class ProjectMan + public partial class ProjectMan : IDisposable { #region Public Properties @@ -25,6 +24,15 @@ namespace MagMan.UI.Components #endregion Public Properties + #region Public Methods + + public void Dispose() + { + AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated; + } + + #endregion Public Methods + #region Protected Properties [Inject] @@ -93,6 +101,8 @@ namespace MagMan.UI.Components { currSearch = ""; AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated; + yLim = Configuration.GetValue("OptConf:projProgYLim"); + rLim = Configuration.GetValue("OptConf:projProgRLim"); } protected override async Task OnParametersSetAsync() @@ -174,6 +184,10 @@ namespace MagMan.UI.Components private int numRecord { get; set; } = 10; + private double rLim { get; set; } = 0.4; + + private double yLim { get; set; } = 0.8; + #endregion Private Properties #region Private Methods @@ -373,13 +387,6 @@ namespace MagMan.UI.Components return isActive ? "text-dark" : "text-secondary text-decoration-line-through"; } - private Random rnd = new Random(); - - private double randPerc - { - get => rnd.NextDouble(); - } - #endregion Private Methods } } \ No newline at end of file diff --git a/MagMan.UI/Components/ResourcesAct.razor.cs b/MagMan.UI/Components/ResourcesAct.razor.cs index e1aeb14..e7ffb34 100644 --- a/MagMan.UI/Components/ResourcesAct.razor.cs +++ b/MagMan.UI/Components/ResourcesAct.razor.cs @@ -8,7 +8,7 @@ using Microsoft.JSInterop; namespace MagMan.UI.Components { - public partial class ResourcesAct + public partial class ResourcesAct : IDisposable { #region Public Properties @@ -20,6 +20,15 @@ namespace MagMan.UI.Components #endregion Public Properties + #region Public Methods + + public void Dispose() + { + AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated; + } + + #endregion Public Methods + #region Protected Properties [Inject] diff --git a/MagMan.UI/Components/ResourcesEstim.razor.cs b/MagMan.UI/Components/ResourcesEstim.razor.cs index ba0c39d..74600e6 100644 --- a/MagMan.UI/Components/ResourcesEstim.razor.cs +++ b/MagMan.UI/Components/ResourcesEstim.razor.cs @@ -7,7 +7,7 @@ using Microsoft.JSInterop; namespace MagMan.UI.Components { - public partial class ResourcesEstim + public partial class ResourcesEstim : IDisposable { #region Public Properties @@ -19,6 +19,15 @@ namespace MagMan.UI.Components #endregion Public Properties + #region Public Methods + + public void Dispose() + { + AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated; + } + + #endregion Public Methods + #region Protected Properties [Inject] diff --git a/MagMan.UI/Components/UserMan.razor.cs b/MagMan.UI/Components/UserMan.razor.cs index 65a01b9..938df8d 100644 --- a/MagMan.UI/Components/UserMan.razor.cs +++ b/MagMan.UI/Components/UserMan.razor.cs @@ -143,6 +143,9 @@ namespace MagMan.UI.Components #region Protected Properties + [Inject] + protected UserManager _UserManager { get; set; } = null!; + [Inject] protected MessageService AppMService { get; set; } = null!; @@ -172,15 +175,6 @@ namespace MagMan.UI.Components #endif } - /// - /// Abilitazoine gestione ROLES multipli - /// - private bool MultiRoleEnab = false; - /// - /// Abilitazoine gestione CLAIM multipli - /// - private bool MultiClaimEnab = false; - protected override async Task OnInitializedAsync() { currSearch = ""; @@ -218,8 +212,11 @@ namespace MagMan.UI.Components #region Private Fields private const string ADMIN_ROLE = "SuperAdmin"; + private const string STD_CLAIM = "None"; + private const string STD_CLAIM_VAL = "0"; + private const string UNDEF_ROLE = "Undef"; /// @@ -232,6 +229,16 @@ namespace MagMan.UI.Components private string currSearch = ""; + /// + /// Abilitazoine gestione CLAIM multipli + /// + private bool MultiClaimEnab = false; + + /// + /// Abilitazoine gestione ROLES multipli + /// + private bool MultiRoleEnab = false; + /// /// User corrente /// @@ -267,6 +274,19 @@ namespace MagMan.UI.Components private string _CurrClaimType { get; set; } = "None"; private string _filtUserRole { get; set; } = "0"; + [Inject] + private IConfiguration Configuration { get; set; } = null!; + + private Claim CurrentUserClaim + { + get => new Claim(CurrentUserClaimType, CurrentUserClaimVal); + } + + /// + /// Claims attuali utente + /// + private List CurrentUserClaims { get; set; } = new List(); + /// /// Claim di default (Tipo) /// @@ -294,19 +314,13 @@ namespace MagMan.UI.Components /// private string CurrentUserRole { get; set; } = "User"; + private int currPage { get; set; } = 1; /// /// Ruoli correnti utente /// private string[] CurrUserRoles { get; set; } = new string[] { "User" }; - /// - /// Claims attuali utente - /// - private List CurrentUserClaims { get; set; } = new List(); - - private int currPage { get; set; } = 1; - /// /// Gestione filtraggio dati /// @@ -380,11 +394,6 @@ namespace MagMan.UI.Components // Refresh Users await GetUsers(); } - [Inject] - protected UserManager _UserManager { get; set; } = null!; - - [Inject] - private IConfiguration Configuration { get; set; } = null!; private void EditUser(IdentityUser _IdentityUser) { @@ -518,11 +527,6 @@ namespace MagMan.UI.Components isLoading = false; } - private Claim CurrentUserClaim - { - get => new Claim(CurrentUserClaimType, CurrentUserClaimVal); - } - private async Task SaveUser() { try @@ -694,6 +698,7 @@ namespace MagMan.UI.Components } } + #endregion Private Methods #if false protected async Task AddClaim(string rawClaim) @@ -716,9 +721,7 @@ namespace MagMan.UI.Components await InvokeAsync(StateHasChanged); } } - } + } #endif - - #endregion Private Methods } } \ No newline at end of file diff --git a/MagMan.UI/Pages/MachineStatus.razor.cs b/MagMan.UI/Pages/MachineStatus.razor.cs index f69d861..d421daf 100644 --- a/MagMan.UI/Pages/MachineStatus.razor.cs +++ b/MagMan.UI/Pages/MachineStatus.razor.cs @@ -8,8 +8,17 @@ using Microsoft.AspNetCore.Components; namespace MagMan.UI.Pages { - public partial class MachineStatus + public partial class MachineStatus : IDisposable { + #region Public Methods + + public void Dispose() + { + AppMService.EA_CustomerSel -= AppMService_EA_CustomerSel; + } + + #endregion Public Methods + #region Protected Fields protected int nKey = 0; diff --git a/MagMan.UI/Pages/ProjectsStatus.razor.cs b/MagMan.UI/Pages/ProjectsStatus.razor.cs index 9f1d5d9..257da23 100644 --- a/MagMan.UI/Pages/ProjectsStatus.razor.cs +++ b/MagMan.UI/Pages/ProjectsStatus.razor.cs @@ -5,8 +5,17 @@ using Microsoft.AspNetCore.Components; namespace MagMan.UI.Pages { - public partial class ProjectsStatus + public partial class ProjectsStatus : IDisposable { + #region Public Methods + + public void Dispose() + { + AppMService.EA_CustomerSel -= AppMService_EA_CustomerSel; + } + + #endregion Public Methods + #region Protected Fields protected int nKey = 0; @@ -42,7 +51,6 @@ namespace MagMan.UI.Pages await ReloadData(); } - protected void SaveProj(ProjModel? newRec) { ProjSel = newRec; diff --git a/MagMan.UI/Shared/MainLayout.razor.cs b/MagMan.UI/Shared/MainLayout.razor.cs index 851ce66..bdd7584 100644 --- a/MagMan.UI/Shared/MainLayout.razor.cs +++ b/MagMan.UI/Shared/MainLayout.razor.cs @@ -11,6 +11,7 @@ namespace MagMan.UI.Shared { AppMService.EA_ShowSearch -= OnShowSearch; AppMService.EA_ShowSearch -= OnHideSearch; + AppMService.EA_ShowCustomers -= AppMService_EA_ShowCustomers; } public void OnHideSearch() @@ -52,11 +53,6 @@ namespace MagMan.UI.Shared AppMService.EA_ShowCustomers += AppMService_EA_ShowCustomers; } - private void AppMService_EA_ShowCustomers(bool obj) - { - ShowCustomers = obj; - } - protected void UpdateNavDisplay() { navLarge = !navLarge; @@ -67,10 +63,19 @@ namespace MagMan.UI.Shared #region Private Properties - private bool ShowSearch { get; set; } = false; - private bool ShowCustomers { get; set; } = false; + private bool ShowSearch { get; set; } = false; + #endregion Private Properties + + #region Private Methods + + private void AppMService_EA_ShowCustomers(bool obj) + { + ShowCustomers = obj; + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/MagMan.UI/appsettings.json b/MagMan.UI/appsettings.json index b9939c0..227c11b 100644 --- a/MagMan.UI/appsettings.json +++ b/MagMan.UI/appsettings.json @@ -31,7 +31,9 @@ "CodModulo": "MagMan", "MultiRoleEnab": false, "MultiClaimEnab": true, - "ScanOpDelay": 3000 + "ScanOpDelay": 3000, + "projProgRLim": 0.4, + "projProgYLim": 0.8 }, "AlarmDest": "samuele.locatelli@egalware.com, ceo@steamware.net", "MailKitMailSettings": {