Aggiunto dialog promemoria

This commit is contained in:
2025-07-03 16:50:00 +02:00
parent ca6be0c0a8
commit c2da42a51b
7 changed files with 86 additions and 9 deletions

View File

@@ -154,12 +154,26 @@
</MudButton>
</YesButton>
</MudMessageBox>
<MudMessageBox @ref="ConfirmMemo" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
<MessageContent>
Vuoi creare un promemoria?
</MessageContent>
<YesButton>
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
StartIcon="@Icons.Material.Filled.DeleteForever">
Crea
</MudButton>
</YesButton>
</MudMessageBox>
</DialogContent>
</MudDialog>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeEsito"/>
<AddMemo @bind-IsSheetVisible="OpenAddMemo" />
@code {
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
@@ -186,12 +200,17 @@
private bool VisibleOverlay { get; set; }
private bool SuccessAnimation { get; set; }
private bool OpenEsito { get; set; } = false;
private bool OpenEsito { get; set; }
private bool OpenAddMemo { get; set; }
//MessageBox
private MudMessageBox ConfirmDelete { get; set; }
private MudMessageBox ConfirmMemo { get; set; }
protected override async Task OnInitializedAsync()
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
_ = LoadData();
LabelSave = IsNew ? "Aggiungi" : null;
@@ -243,7 +262,6 @@
private bool CheckPreSave()
{
Snackbar.Clear();
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
Snackbar.Add("Tipo attività obbligatorio!", Severity.Error);
@@ -317,9 +335,23 @@
}
}
private async Task OnAfterChangeEsito()
{
OnAfterChangeValue();
var result = await ConfirmMemo.ShowAsync();
if (result is true)
OpenAddMemo = !OpenAddMemo;
}
private void OpenSelectEsito()
{
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username))) return;
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username)))
{
Snackbar.Add("Non puoi inserire un esito per un'attività che non ti è stata assegnata.", Severity.Info);
return;
}
OpenEsito = !OpenEsito;
StateHasChanged();