AddInteractionModal, AddProspectModal
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Dialogs
|
||||
{
|
||||
public partial class AddInteractionModal
|
||||
{
|
||||
private Modal ModalReference { get; set; } = null!;
|
||||
|
||||
private Interaction Interaction { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<Interaction> OnAdd { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<User>? Users { get; set; }
|
||||
|
||||
public Guid SelectedUser { get; set; }
|
||||
|
||||
private string _header;
|
||||
private string _infoName;
|
||||
private bool _showInfo;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (Users?.Any() == true)SelectedUser = Users.First().Id;
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
public async Task Show(InteractionType type, Guid? prospectId)
|
||||
{
|
||||
if (prospectId == null) return;
|
||||
_showInfo = false;
|
||||
_infoName = "Kommentar";
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case InteractionType.EinAb:
|
||||
_header = "Einführung eintragen";
|
||||
_showInfo = true;
|
||||
_infoName = "Betrieb";
|
||||
break;
|
||||
case InteractionType.Welcome:
|
||||
_header = "Begrüßung eintragen";
|
||||
break;
|
||||
case InteractionType.IdCheck:
|
||||
_header = "Ausweisprüfung eintragen";
|
||||
_showInfo = true;
|
||||
break;
|
||||
case InteractionType.PrintPass:
|
||||
_header = "FS-Ausweis (Print)";
|
||||
_showInfo = true;
|
||||
break;
|
||||
case InteractionType.PdfPass:
|
||||
_header = "FS-Ausweis (PDF)";
|
||||
_showInfo = true;
|
||||
break;
|
||||
case InteractionType.Verify:
|
||||
_header = "Verifizierung eintragen";
|
||||
break;
|
||||
case InteractionType.Complete:
|
||||
_header = "Als fertig markieren";
|
||||
_showInfo = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Interaction = new Interaction
|
||||
{
|
||||
Type = type,
|
||||
Date = DateTime.UtcNow,
|
||||
ProspectId = prospectId.Value
|
||||
};
|
||||
await ModalReference.Show();
|
||||
}
|
||||
|
||||
private async Task AddInteraction()
|
||||
{
|
||||
Interaction.UserId = SelectedUser;
|
||||
|
||||
await OnAdd.InvokeAsync(Interaction);
|
||||
await ModalReference.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user