Files
TaskHybrid/salesbook.Shared/Core/Helpers/ModalHelpers.cs
2025-07-30 18:27:24 +02:00

82 lines
2.2 KiB
C#

using MudBlazor;
using salesbook.Shared.Components.SingleElements.Modal;
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Helpers;
public class ModalHelpers
{
public static async Task<DialogResult?> OpenActivityForm(IDialogService dialog, ActivityDTO? activity, string? id)
{
var modal = await dialog.ShowAsync<ActivityForm>(
"Activity form",
new DialogParameters<ActivityForm>
{
{ x => x.Id, id },
{ x => x.ActivityCopied, activity }
},
new DialogOptions
{
FullScreen = true,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, ContactDTO? anag)
{
var modal = await dialog.ShowAsync<ContactForm>(
"User form",
new DialogParameters<ContactForm>
{
{ x => x.OriginalModel, anag }
},
new DialogOptions
{
FullScreen = true,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif)
{
var modal = await dialog.ShowAsync<PersRifForm>(
"Pers rif form",
new DialogParameters<PersRifForm>
{
{ x => x.OriginalModel, persRif }
},
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<AddAttached>(
"Add attached",
new DialogParameters<AddAttached>(),
new DialogOptions
{
FullScreen = false,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
}