From 64b4d84b54db4b7ac7bbd0be8118d140b7ea7d70 Mon Sep 17 00:00:00 2001 From: Andre Beging Date: Sat, 2 Apr 2022 15:27:51 +0200 Subject: [PATCH] AddInteractionModal, AddProspectModal --- .../Dialogs/AddInteractionModal.razor | 30 +++++++ .../Dialogs/AddInteractionModal.razor.cs | 86 +++++++++++++++++++ .../Dialogs/AddProspectModal.razor | 44 ++++++++++ 3 files changed, 160 insertions(+) create mode 100644 FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor create mode 100644 FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor.cs create mode 100644 FoodsharingSiegen.Server/Dialogs/AddProspectModal.razor diff --git a/FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor b/FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor new file mode 100644 index 0000000..5c792a2 --- /dev/null +++ b/FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor @@ -0,0 +1,30 @@ +@using FoodsharingSiegen.Contracts.Entity + + + + +
@_header
+ +
+ + + + + @if (_showInfo) + { + + + + } + + + + + +
+
\ No newline at end of file diff --git a/FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor.cs b/FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor.cs new file mode 100644 index 0000000..17dd49a --- /dev/null +++ b/FoodsharingSiegen.Server/Dialogs/AddInteractionModal.razor.cs @@ -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 OnAdd { get; set; } + + [Parameter] + public List? 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(); + } + } +} \ No newline at end of file diff --git a/FoodsharingSiegen.Server/Dialogs/AddProspectModal.razor b/FoodsharingSiegen.Server/Dialogs/AddProspectModal.razor new file mode 100644 index 0000000..0240768 --- /dev/null +++ b/FoodsharingSiegen.Server/Dialogs/AddProspectModal.razor @@ -0,0 +1,44 @@ +@using FoodsharingSiegen.Contracts.Entity +@code { + private Modal ModalReference { get; set; } = null!; + + private Prospect Prospect { get; set; } = new(); + + [Parameter] public EventCallback OnAdd { get; set; } + + public async Task Show() + { + Prospect = new(); + await ModalReference.Show(); + } + + private async Task AddProspect() + { + await OnAdd.InvokeAsync(Prospect); + await ModalReference.Hide(); + } +} + + + + + + Neuling hinzufügen + + + + + Name + + + + Foodsharing-ID + + + + + + + + + \ No newline at end of file