Aggiunto dialog promemoria
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<div class="container container-modal">
|
||||
<div class="c-modal">
|
||||
<div class="exception-header mb-2">
|
||||
<i class="ri-emotion-unhappy-line"></i>
|
||||
<span>Ops</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
@if (Exception != null)
|
||||
{
|
||||
<code>@Message</code>
|
||||
}
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div @onclick="OnRetryClick" class="card-button">
|
||||
<span>Riprova</span>
|
||||
</div>
|
||||
|
||||
<div @onclick="OnContinueClick" class="card-button">
|
||||
<span>Continua</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public Exception? Exception { get; set; }
|
||||
[Parameter] public EventCallback OnRetry { get; set; }
|
||||
[Parameter] public ErrorBoundary? ErrorBoundary { get; set; }
|
||||
|
||||
private string Message { get; set; } = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (Exception == null) return;
|
||||
|
||||
if (Exception.Message.Contains("Failed to connect to"))
|
||||
{
|
||||
var ipPort = Exception.Message.Split("to /")[1];
|
||||
|
||||
Message = $"Impossibile collegarsi al server ({ipPort})";
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = Exception.Message;
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnRetryClick()
|
||||
{
|
||||
await OnRetry.InvokeAsync();
|
||||
}
|
||||
|
||||
private async Task OnContinueClick()
|
||||
{
|
||||
NavigationManager.NavigateTo("/");
|
||||
await OnRetry.InvokeAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
.container-modal {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.c-modal {
|
||||
border-radius: 16px;
|
||||
box-shadow: var(--exception-box-shadow);
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.button-container {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
margin: 1.5rem 0 0 0;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: medium;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card-button {
|
||||
text-align: center;
|
||||
background-color: transparent;
|
||||
padding: .3rem 1rem;
|
||||
font-weight: 700;
|
||||
color: var(--bs-primary-text-emphasis);
|
||||
}
|
||||
|
||||
.exception-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.exception-header > i {
|
||||
font-size: 3rem;
|
||||
line-height: normal;
|
||||
color: var(--bs-danger);
|
||||
}
|
||||
|
||||
.exception-header > span {
|
||||
font-size: x-large;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
code {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
color: var(--bs-gray-dark);
|
||||
}
|
||||
Reference in New Issue
Block a user