@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
@Scheda.ActivityTypeId
0
0
Modifica
Cancella
@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 OnSchedaModified { get; set; }
[Parameter] public EventCallback OnSchedaDeleted { get; set; }
private ConfirmDeleteMessageBox _deleteMessageBox = null!;
private async Task UpdateScheda()
{
var modal = await ModalHelper.OpenFormScheda(Dialog, CodMdep, Data, false, 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);
}
}
}