74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
@using FoodsharingSiegen.Contracts.Entity
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
public Prospect Prospect { get; set; }
|
|
|
|
[Parameter]
|
|
public InteractionType Type { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback AddClick { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<Guid> RemoveClick { get; set; }
|
|
|
|
[Parameter]
|
|
public string Caption { get; set; }
|
|
|
|
[Parameter]
|
|
public string ButtonText { get; set; }
|
|
|
|
[Parameter]
|
|
public string IconClass { get; set; }
|
|
|
|
[Parameter]
|
|
public bool Multiple { get; set; }
|
|
|
|
[Parameter]
|
|
public int Minimum { get; set; } = 1;
|
|
|
|
private List<Interaction> Interactions => Prospect?.Interactions?.Where(x => x.Type == Type).ToList() ?? new List<Interaction>();
|
|
|
|
private bool Done => Interactions.Count >= Minimum;
|
|
}
|
|
|
|
@{
|
|
var rowClass = "";
|
|
if (Done) rowClass += "done";
|
|
}
|
|
|
|
<tr class="@rowClass" style="border-top: 5px solid transparent;">
|
|
<th class="text-center align-top pr-2">
|
|
<i class="@IconClass"></i>
|
|
</th>
|
|
<th class="pr-2 align-top">@Caption:</th>
|
|
<td class="align-top">
|
|
@if (Interactions.Count > 0)
|
|
{
|
|
foreach (var interaction in Interactions)
|
|
{
|
|
<div>
|
|
@interaction.User.Name (@interaction.Date.ToShortDateString())
|
|
@if (!string.IsNullOrWhiteSpace(interaction.Info))
|
|
{
|
|
<span>(<i>@interaction.Info</i>)</span>
|
|
}
|
|
|
|
@if (!Prospect.Complete || interaction.Type == InteractionType.Complete)
|
|
{
|
|
<span> <a href=""><i class="fa-solid fa-square-xmark" @onclick="async () => await RemoveClick.InvokeAsync(interaction.Id)" @onclick:preventDefault></i></a></span>
|
|
}
|
|
|
|
</div>
|
|
}
|
|
}
|
|
|
|
@if (!Prospect.Complete && (Interactions.Count == 0 || Multiple))
|
|
{
|
|
if (Multiple) ButtonText = "+";
|
|
<Button Size="Size.Small" Clicked="AddClick">@ButtonText</Button>
|
|
}
|
|
</td>
|
|
</tr> |