Pagina profilo e modiche al theme
This commit is contained in:
@@ -1,9 +1,113 @@
|
||||
@page "/PersonalInfo"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Authorization.Enum
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Core.Services
|
||||
@using Template.Shared.Core.Utility
|
||||
@using Template.Shared.Interfaces
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFormFactor FormFactor
|
||||
|
||||
<HeaderLayout Title="Profilo" />
|
||||
|
||||
<div class="content">
|
||||
<div class="section-primary-info">
|
||||
<MudAvatar Style="height:85px; width:85px; font-size:2rem;">
|
||||
<MudImage Src="@($"https://ui-avatars.com/api/?name={UserSession.User.Username}&size=80&background={UtilityColor.CalcHexColor(UserSession.User.Username)}&bold=true")"></MudImage>
|
||||
</MudAvatar>
|
||||
|
||||
<div class="personal-info">
|
||||
<span class="info-nome">@UserSession.User.Fullname</span>
|
||||
@if (UserSession.User.KeyGroup is not null)
|
||||
{
|
||||
<span class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-info">
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">Telefono</span>
|
||||
<span class="info-text">000 0000000</span> @*Todo: to implement*@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="info-title">Status</span>
|
||||
@if (NetworkService.IsNetworkAvailable())
|
||||
{
|
||||
<div class="status online">
|
||||
<i class="ri-wifi-line"></i>
|
||||
<span>Online</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="status offline">
|
||||
<i class="ri-wifi-off-line"></i>
|
||||
<span>Offline</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(UserSession.User.Email))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@UserSession.User.Email
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="info-title">Ultima sincronizzazione</span>
|
||||
<span class="info-text">@LastSync.ToString("g")</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="user-button">
|
||||
<span>Impostazioni account</span>
|
||||
</div>
|
||||
|
||||
<div class="user-button logout" @onclick="Logout">
|
||||
<span>Esci</span>
|
||||
<i class="ri-logout-box-line"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool Unavailable { get; set; }
|
||||
private DateTime LastSync { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private void Logout()
|
||||
{
|
||||
AuthenticationStateProvider.SignOut();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Unavailable = FormFactor.IsWeb() || !NetworkService.IsNetworkAvailable();
|
||||
LastSync = LocalStorage.Get<DateTime>("last-sync");
|
||||
});
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user