Files
SteUP_Dotnet/SteUp.Shared/Core/Helpers/ModalHelper.cs
2026-02-23 16:22:55 +01:00

89 lines
2.5 KiB
C#

using MudBlazor;
using SteUp.Shared.Components.SingleElements.Modal;
using SteUp.Shared.Core.Dto;
using SteUp.Shared.Core.Entities;
namespace SteUp.Shared.Core.Helpers;
public abstract class ModalHelper
{
public static async Task<DialogResult?> OpenSelectShop(IDialogService dialog)
{
var modal = await dialog.ShowAsync<ModalSelectShop>(
"ModalSelectShop",
new DialogParameters(),
new DialogOptions
{
FullScreen = false,
CloseButton = false,
NoHeader = true,
BackdropClick = true
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenFormScheda(IDialogService dialog, string codMdep, DateOnly data,
bool isNew = false, Scheda? scheda = null)
{
scheda = isNew && scheda == null ? new Scheda() : scheda;
var modal = await dialog.ShowAsync<ModalFormScheda>(
"ModalFormScheda",
new DialogParameters<ModalFormScheda>
{
{ x => x.CodMdep, codMdep },
{ x => x.Data, data },
{ x => x.IsNew, isNew },
{ x => x.Scheda, scheda }
},
new DialogOptions
{
FullScreen = true,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenAddAttached(IDialogService dialog)
{
var modal = await dialog.ShowAsync<ModalAddAttached>(
"Add attached",
new DialogParameters(),
new DialogOptions
{
FullScreen = false,
CloseButton = false,
NoHeader = true,
BackdropClick = false
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenSuggestActivityDescription(IDialogService dialog,
List<StbActivityTyperDto>? activityTypers)
{
var modal = await dialog.ShowAsync<ModalSuggestDescription>(
"Suggest activity description",
new DialogParameters<ModalSuggestDescription>
{
{ x => x.ActivityTypers, activityTypers }
},
new DialogOptions
{
FullScreen = false,
CloseButton = false,
NoHeader = true,
BackdropClick = true
}
);
return await modal.Result;
}
}