@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 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 Interactions => Prospect?.Interactions?.Where(x => x.Type == Type).ToList() ?? new List(); private bool Done => Interactions.Count >= Minimum; private bool NotNeeded => Interactions.Any(x => x.NotNeeded); private bool Alert => Interactions.Any(x => x.Alert); } @{ var rowClass = ""; if (Done) rowClass += " done"; if (NotNeeded) rowClass += " notneeded"; if (Alert) rowClass += " fs-alert"; } @Caption: @if (Interactions.Count > 0) { foreach (var interaction in Interactions) {
@interaction.User.Name (@interaction.Date.ToShortDateString()) @if (!string.IsNullOrWhiteSpace(interaction.Info)) { (@interaction.Info) } @if (!Prospect.Complete || interaction.Type == InteractionType.Complete) {   }
} } @if (!Prospect.Complete && (Interactions.Count == 0 || Multiple)) { if (Multiple) ButtonText = "+"; }