Aggiunto messaggio per completamento ispezione

This commit is contained in:
2026-03-02 13:00:35 +01:00
parent 63368748ab
commit 8fbeaf8637
3 changed files with 24 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
@using CommunityToolkit.Mvvm.Messaging @using CommunityToolkit.Mvvm.Messaging
@using SteUp.Shared.Components.SingleElements.MessageBox
@using SteUp.Shared.Core.Messages.Ispezione @using SteUp.Shared.Core.Messages.Ispezione
@using SteUp.Shared.Core.Messages.Scheda @using SteUp.Shared.Core.Messages.Scheda
@inject INetworkService NetworkService @inject INetworkService NetworkService
@@ -39,7 +40,7 @@
{ {
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda" <MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda"
Label="Nuova scheda" Color="Color.Surface"/> Label="Nuova scheda" Color="Color.Surface"/>
if (ShowCompleteInspection) if (ShowCompleteInspection)
{ {
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@CompleteInspection" <MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@CompleteInspection"
@@ -56,6 +57,9 @@
</nav> </nav>
</div> </div>
<ConfirmMessageBox @ref="_messageBox" NoText="No" YesText="Si" YesColor="Color.Primary"
Message="Completando l'ispezione non sarà più possibile editarla o aggiungere ulteriori segnalazioni. Procedere?"/>
@code @code
{ {
private bool IsVisible { get; set; } = true; private bool IsVisible { get; set; } = true;
@@ -63,6 +67,8 @@
private bool ShowCompleteInspection { get; set; } private bool ShowCompleteInspection { get; set; }
private bool SchedaVisible { get; set; } private bool SchedaVisible { get; set; }
private ConfirmMessageBox _messageBox = null!;
protected override Task OnInitializedAsync() protected override Task OnInitializedAsync()
{ {
NavigationManager.LocationChanged += (_, args) => NavigationManager.LocationChanged += (_, args) =>
@@ -96,8 +102,13 @@
} }
} }
private void CompleteInspection() => private async Task CompleteInspection()
Messenger.Send(new CompleteInspectionMessage()); {
var result = await _messageBox.ShowAsync();
if (result is true)
Messenger.Send(new CompleteInspectionMessage());
}
private async Task NewScheda() private async Task NewScheda()
{ {

View File

@@ -49,7 +49,8 @@
</div> </div>
<SpinnerOverlay VisibleOverlay="VisibleOverlay"/> <SpinnerOverlay VisibleOverlay="VisibleOverlay"/>
<ConfirmDeleteMessageBox @ref="_deleteMessageBox" Message="Confermi la cancellazione della scheda corrente?"/> <ConfirmMessageBox @ref="_messageBox" YesText="Cancella" YesColor="Color.Error"
Message="Confermi la cancellazione della scheda corrente?"/>
@code{ @code{
[Parameter] public string CodMdep { get; set; } = string.Empty; [Parameter] public string CodMdep { get; set; } = string.Empty;
@@ -60,7 +61,7 @@
private bool VisibleOverlay { get; set; } private bool VisibleOverlay { get; set; }
private ConfirmDeleteMessageBox _deleteMessageBox = null!; private ConfirmMessageBox _messageBox = null!;
private async Task UpdateScheda() private async Task UpdateScheda()
{ {
@@ -70,7 +71,7 @@
private async Task DeleteScheda() private async Task DeleteScheda()
{ {
var result = await _deleteMessageBox.ShowAsync(); var result = await _messageBox.ShowAsync();
if (result is true) if (result is true)
{ {

View File

@@ -1,10 +1,10 @@
<MudMessageBox @ref="_confirmDelete" Title="Attenzione!" CancelText="Annulla"> <MudMessageBox @ref="_confirmDelete" Title="Attenzione!" CancelText="@NoText">
<MessageContent> <MessageContent>
@Message @Message
</MessageContent> </MessageContent>
<YesButton> <YesButton>
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"> <MudButton Size="Size.Small" Variant="Variant.Filled" Color="YesColor">
Cancella @YesText
</MudButton> </MudButton>
</YesButton> </YesButton>
</MudMessageBox> </MudMessageBox>
@@ -12,6 +12,9 @@
@code @code
{ {
[Parameter] public string Message { get; set; } = string.Empty; [Parameter] public string Message { get; set; } = string.Empty;
[Parameter] public string YesText { get; set; } = string.Empty;
[Parameter] public string NoText { get; set; } = "Annulla";
[Parameter] public Color YesColor { get; set; } = Color.Primary;
private MudMessageBox? _confirmDelete; private MudMessageBox? _confirmDelete;