Gestite azioni in pagina ispezione
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Components.Layout.Overlay
|
||||
@using SteUp.Shared.Components.SingleElements.MessageBox
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Core.Interface.LocalDb
|
||||
@inject IIspezioniService IspezioniService
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="scheda-card">
|
||||
<div class="scheda-body-section">
|
||||
@@ -6,7 +11,7 @@
|
||||
<MudText Class="scheda-title" Typo="Typo.subtitle1">
|
||||
<b>@Scheda.ActivityTypeId</b>
|
||||
</MudText>
|
||||
|
||||
|
||||
<div class="sub-info-section">
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.PhotoCamera" Size="Size.Small" Color="Color.Default">
|
||||
0
|
||||
@@ -16,15 +21,46 @@
|
||||
</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="scheda-card-action">
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Edit" Color="Color.Info" Size="Size.Small">Modifica</MudButton>
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Delete" Color="Color.Error" Size="Size.Small">Cancella</MudButton>
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Edit"
|
||||
Color="Color.Info" Size="Size.Small" OnClick="@UpdateScheda">
|
||||
Modifica
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Delete"
|
||||
Color="Color.Error" Size="Size.Small" OnClick="@DeleteScheda">
|
||||
Cancella
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ConfirmDeleteMessageBox @ref="_deleteMessageBox" Message="Confermi la cancellazione della scheda corrente?"/>
|
||||
|
||||
@code{
|
||||
[Parameter] public string CodMdep { get; set; } = string.Empty;
|
||||
[Parameter] public DateOnly Data { get; set; }
|
||||
[Parameter] public required Scheda Scheda { get; set; }
|
||||
[Parameter] public EventCallback<Scheda> OnSchedaModified { get; set; }
|
||||
[Parameter] public EventCallback<Scheda> OnSchedaDeleted { get; set; }
|
||||
|
||||
private ConfirmDeleteMessageBox _deleteMessageBox = null!;
|
||||
|
||||
private async Task UpdateScheda()
|
||||
{
|
||||
var modal = await ModalHelper.OpenFormScheda(Dialog, CodMdep, Data, Scheda);
|
||||
if (modal is { Canceled: false, Data: Scheda scheda }) await OnSchedaModified.InvokeAsync(scheda);
|
||||
}
|
||||
|
||||
private async Task DeleteScheda()
|
||||
{
|
||||
var result = await _deleteMessageBox.ShowAsync();
|
||||
|
||||
if (result is true)
|
||||
{
|
||||
var deleteScheda = await IspezioniService.DeleteSchedaAsync(Scheda.Id);
|
||||
if (deleteScheda) await OnSchedaDeleted.InvokeAsync(Scheda);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user