115 lines
4.4 KiB
Plaintext
115 lines
4.4 KiB
Plaintext
@using CommunityToolkit.Mvvm.Messaging
|
|
@using SteUp.Shared.Core.Entities
|
|
@using SteUp.Shared.Core.Interface.IntegryApi
|
|
@using SteUp.Shared.Core.Interface.System.Network
|
|
@using SteUp.Shared.Core.Messages.Ispezione
|
|
@using SteUp.Shared.Core.Messages.Scheda
|
|
@inject INetworkService NetworkService
|
|
@inject IDialogService Dialog
|
|
@inject IMessenger Messenger
|
|
|
|
<div
|
|
class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
|
<nav class="navbar @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
|
<div class="container-navbar">
|
|
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
|
<li class="nav-item">
|
|
<NavLink class="nav-link" href="ispezioni" Match="NavLinkMatch.All">
|
|
<div class="d-flex flex-column">
|
|
<i class="ri-file-list-3-line"></i>
|
|
<span>Ispezioni</span>
|
|
</div>
|
|
</NavLink>
|
|
</li>
|
|
<li class="nav-item">
|
|
<NavLink class="nav-link" href="user" Match="NavLinkMatch.All">
|
|
<div class="d-flex flex-column">
|
|
<i class="ri-user-line"></i>
|
|
<span>Profilo</span>
|
|
</div>
|
|
</NavLink>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
@if (PlusVisible)
|
|
{
|
|
<MudFabMenu ButtonClass="custom-plus-button" MenuClass="custom-menu-fab" OnClick="@OnOpenMenu"
|
|
StartIcon="@Icons.Material.Filled.Add"
|
|
IconColor="Color.Primary" Color="Color.Surface" AlignItems="AlignItems.End"
|
|
Size="Size.Medium" IconSize="Size.Medium">
|
|
@if (SchedaVisible)
|
|
{
|
|
if (ShowCompleteInspection)
|
|
{
|
|
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@CompleteInspection"
|
|
Label="Concludi ispezione" Color="Color.Surface"/>
|
|
}
|
|
|
|
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda"
|
|
Label="Nuova scheda" Color="Color.Surface"/>
|
|
}
|
|
else
|
|
{
|
|
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewActivity"
|
|
Label="Nuova ispezione" Color="Color.Surface"/>
|
|
}
|
|
</MudFabMenu>
|
|
}
|
|
</nav>
|
|
</div>
|
|
|
|
@code
|
|
{
|
|
private bool IsVisible { get; set; } = true;
|
|
private bool PlusVisible { get; set; } = true;
|
|
private bool ShowCompleteInspection { get; set; }
|
|
private bool SchedaVisible { get; set; }
|
|
|
|
protected override Task OnInitializedAsync()
|
|
{
|
|
NavigationManager.LocationChanged += (_, args) =>
|
|
{
|
|
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
|
|
|
var newIsVisible = new List<string> { "ispezioni", "ispezione", "user" }
|
|
.Contains(location);
|
|
|
|
var newPlusVisible = new List<string> { "ispezioni", "ispezione", "user" }
|
|
.Contains(location);
|
|
|
|
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
|
|
|
IsVisible = newIsVisible;
|
|
PlusVisible = newPlusVisible;
|
|
StateHasChanged();
|
|
};
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
private void NewActivity()
|
|
{
|
|
_ = ModalHelper.OpenSelectShop(Dialog);
|
|
}
|
|
|
|
private void CompleteInspection() =>
|
|
Messenger.Send(new CompleteInspectionMessage());
|
|
|
|
private async Task NewScheda()
|
|
{
|
|
var ispezione = SteupDataService.InspectionPageState.Ispezione;
|
|
var modal = await ModalHelper.OpenFormScheda(Dialog, ispezione.CodMdep, ispezione.Data, true);
|
|
|
|
if (modal is { Canceled: false })
|
|
Messenger.Send(new NewSchedaMessage());
|
|
}
|
|
|
|
private void OnOpenMenu()
|
|
{
|
|
var location = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Length);
|
|
|
|
SchedaVisible = new List<string> { "ispezione" }.Contains(location);
|
|
ShowCompleteInspection = !SteupDataService.InspectionPageState.Ispezione.ActivityId.IsNullOrEmpty();
|
|
StateHasChanged();
|
|
}
|
|
} |