@page "/user" @attribute [Authorize] @using SteUp.Shared.Components.Layout @using SteUp.Shared.Components.Layout.Overlay @using SteUp.Shared.Components.SingleElements @using SteUp.Shared.Core.Authorization.Enum @using SteUp.Shared.Core.Dto @using SteUp.Shared.Core.Interface.IntegryApi @using SteUp.Shared.Core.Interface.System @using SteUp.Shared.Core.Services @using SteUp.Shared.Core.Utility @inject AppAuthenticationStateProvider AuthenticationStateProvider @inject INetworkService NetworkService @inject IGenericSystemService GenericSystemService @inject IFileManager FileManager @inject IIntegryApiService IntegryApiService @if (IsLoggedIn) {
@UtilityString.ExtractInitials(UserSession.User.Fullname)
@UserSession.User.Fullname @if (UserSession.User.KeyGroup is not null) { @(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable()) }
Esporta log
Sincronizza ispezioni esportate
Esci
} @code { private bool IsLoggedIn { get; set; } private bool VisibleOverlay { get; set; } private string? CodHash { get; set; } = ""; protected override async Task OnInitializedAsync() { IsLoggedIn = await UserSession.IsLoggedIn(); CodHash = LocalStorage.GetString("codHash"); StateHasChanged(); } private async Task ExportLog() { VisibleOverlay = true; StateHasChanged(); var profiloAzienda = LocalStorage.GetString("codHash"); var email = new SendEmailDto { FromName = "Integry Log", To = "developer@integry.it", Subject = $"SteUP - Log del {DateTime.Today:d} di {UserSession.User.Username}", IsHtml = true, MsgText = $"Username: {UserSession.User.Username}
" + $"Profilo azienda: {profiloAzienda}
" + $"ProfileDb: {UserSession.ProfileDb}
" + $"Versione app: {GenericSystemService.GetCurrentAppVersion()}", Attachments = FileManager.GetFileForExport() }; await IntegryApiService.SendEmail(email); VisibleOverlay = false; StateHasChanged(); } private async Task UpdateDb() { VisibleOverlay = true; StateHasChanged(); await SteupDataService.CheckAndUpdateStatus(); VisibleOverlay = false; StateHasChanged(); } private async Task Logout() { await AuthenticationStateProvider.SignOut(); IsLoggedIn = await UserSession.IsLoggedIn(); StateHasChanged(); } }