Display prospect memo
This commit is contained in:
@@ -20,7 +20,15 @@
|
||||
<a class="invert" href="@(CurrentUser.NetworkLink)/profile/@Prospect?.FsId" target="_blank">Profil öffnen</a>
|
||||
</small>
|
||||
</h5>
|
||||
<div>@Prospect?.Memo</div>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Prospect?.Memo))
|
||||
{
|
||||
<Alert Color="Color.Info" Visible Class="p-2 mb-1">
|
||||
<AlertDescription>@Prospect?.Memo</AlertDescription>
|
||||
</Alert>
|
||||
}
|
||||
|
||||
|
||||
<table>
|
||||
|
||||
<InteractionRow
|
||||
|
||||
@@ -1,64 +1,31 @@
|
||||
@using FoodsharingSiegen.Contracts.Entity
|
||||
@code {
|
||||
private Modal ModalReference { get; set; } = null!;
|
||||
|
||||
private Prospect Prospect { get; set; } = new();
|
||||
|
||||
private string? Header { get; set; }
|
||||
|
||||
private string? SaveButtonText { get; set; }
|
||||
|
||||
private bool IsUpdateMode { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<Prospect> OnAdd { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<Prospect> OnUpdate { get; set; }
|
||||
|
||||
public async Task Show()
|
||||
{
|
||||
Prospect = new Prospect();
|
||||
Header = "Neuling hinzufügen";
|
||||
SaveButtonText = "Hinzufügen";
|
||||
await ModalReference.Show();
|
||||
}
|
||||
|
||||
public async Task Show(Prospect? prospect)
|
||||
{
|
||||
if (prospect == null) return;
|
||||
Prospect = prospect;
|
||||
IsUpdateMode = true;
|
||||
Header = $"{Prospect.Name} bearbeiten";
|
||||
SaveButtonText = "Speichern";
|
||||
await ModalReference.Show();
|
||||
}
|
||||
|
||||
private async Task SaveClick()
|
||||
{
|
||||
if (IsUpdateMode)
|
||||
await OnUpdate.InvokeAsync(Prospect);
|
||||
else
|
||||
await OnAdd.InvokeAsync(Prospect);
|
||||
|
||||
await ModalReference.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<Modal @ref="@ModalReference">
|
||||
<ModalContent Centered Size="ModalSize.Small">
|
||||
<ModalContent Centered Size="ModalSize.Default">
|
||||
<ModalHeader>
|
||||
<ModalTitle>@Header</ModalTitle>
|
||||
<CloseButton/>
|
||||
</ModalHeader>
|
||||
<ModalBody>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<Field>
|
||||
<FieldLabel>Name</FieldLabel>
|
||||
<TextEdit @bind-Text="Prospect.Name"/>
|
||||
</Field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<Field>
|
||||
<FieldLabel>Foodsharing-ID</FieldLabel>
|
||||
<NumericEdit TValue="int" @bind-Value="Prospect.FsId"></NumericEdit>
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Field>
|
||||
<FieldLabel>Memo (optional)</FieldLabel>
|
||||
<TextEdit @bind-Text="Prospect.Memo" Placeholder="Beliebige Info"></TextEdit>
|
||||
</Field>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button Color="Color.Primary" Clicked="@SaveClick">@SaveButtonText</Button>
|
||||
|
||||
103
FoodsharingSiegen.Server/Dialogs/AddProspectModal.razor.cs
Normal file
103
FoodsharingSiegen.Server/Dialogs/AddProspectModal.razor.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// The add prospect modal class (a. beging, 31.05.2022)
|
||||
/// </summary>
|
||||
public partial class AddProspectModal
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the on add (ab)
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Prospect> OnAdd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the on update (ab)
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Prospect> OnUpdate { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the header (ab)
|
||||
/// </summary>
|
||||
private string? Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the is update mode (ab)
|
||||
/// </summary>
|
||||
private bool IsUpdateMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the modal reference (ab)
|
||||
/// </summary>
|
||||
private Modal ModalReference { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the prospect (ab)
|
||||
/// </summary>
|
||||
private Prospect Prospect { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the save button text (ab)
|
||||
/// </summary>
|
||||
private string? SaveButtonText { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Method Show
|
||||
|
||||
/// <summary>
|
||||
/// Shows this instance (a. beging, 31.05.2022)
|
||||
/// </summary>
|
||||
public async Task Show()
|
||||
{
|
||||
Prospect = new Prospect();
|
||||
Header = "Neuling hinzufügen";
|
||||
SaveButtonText = "Hinzufügen";
|
||||
await ModalReference.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows the prospect (a. beging, 31.05.2022)
|
||||
/// </summary>
|
||||
/// <param name="prospect">The prospect</param>
|
||||
public async Task Show(Prospect? prospect)
|
||||
{
|
||||
if (prospect == null) return;
|
||||
Prospect = prospect;
|
||||
IsUpdateMode = true;
|
||||
Header = $"{Prospect.Name} bearbeiten";
|
||||
SaveButtonText = "Speichern";
|
||||
await ModalReference.Show();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method SaveClick
|
||||
|
||||
/// <summary>
|
||||
/// Saves the click (a. beging, 31.05.2022)
|
||||
/// </summary>
|
||||
private async Task SaveClick()
|
||||
{
|
||||
if (IsUpdateMode)
|
||||
await OnUpdate.InvokeAsync(Prospect);
|
||||
else
|
||||
await OnAdd.InvokeAsync(Prospect);
|
||||
|
||||
await ModalReference.Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
<span class="fas fa-tasks mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> Übersicht
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<div class="nav-item px-3 mt-3">
|
||||
<NavLink class="nav-link" href="users" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-users mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> Benutzer
|
||||
</NavLink>
|
||||
|
||||
Reference in New Issue
Block a user