Interactions als Notneeded markieren

This commit is contained in:
Andre Beging
2022-04-04 16:31:18 +02:00
parent c71d677b75
commit c70fb6426c
5 changed files with 54 additions and 16 deletions

View File

@@ -32,11 +32,14 @@
private List<Interaction> Interactions => Prospect?.Interactions?.Where(x => x.Type == Type).ToList() ?? new List<Interaction>();
private bool Done => Interactions.Count >= Minimum;
private bool NotNeeded => Interactions.Any(x => x.NotNeeded);
}
@{
var rowClass = "";
if (Done) rowClass += " done";
if (NotNeeded) rowClass += " notneeded";
}
<tr class="@rowClass" style="border-top: 5px solid transparent;">

View File

@@ -1,3 +1,7 @@
tr.done th {
color: #64ae24;
}
tr.notneeded {
filter: grayscale(100%);
}

View File

@@ -7,11 +7,22 @@
<CloseButton/>
</ModalHeader>
<ModalBody>
@if (_showNotNeeded)
{
<div class="row">
<div class="col">
<Field>
<Switch TValue="bool" @bind-Checked="Interaction.NotNeeded" >Nicht benötigt</Switch>
</Field>
</div>
</div>
}
<div class="row">
<div class="col">
<Field>
<FieldLabel>Wer?</FieldLabel>
<Select TValue="Guid" @bind-SelectedValue="SelectedUser" id="aim-userselect">
<Select TValue="Guid" @bind-SelectedValue="SelectedUser">
@foreach (var user in Users ?? new List<User>())
{
<SelectItem Value="@user.Id">@user.Name</SelectItem>
@@ -30,7 +41,8 @@
@if (_showInfo)
{
<Field>
<MemoEdit @bind-Text="Interaction.Info" Placeholder="@_infoName" Rows="5"/>
<FieldLabel>@_infoName</FieldLabel>
<TextEdit @bind-Text="Interaction.Info"></TextEdit>
</Field>
}
</ModalBody>

View File

@@ -21,6 +21,7 @@ namespace FoodsharingSiegen.Server.Dialogs
private string _header;
private string _infoName;
private bool _showInfo;
private bool _showNotNeeded;
protected override async Task OnParametersSetAsync()
{
@@ -40,7 +41,7 @@ namespace FoodsharingSiegen.Server.Dialogs
case InteractionType.EinAb:
_header = "Einführung eintragen";
_showInfo = true;
_infoName = "Betrieb";
_infoName = "Welcher Betrieb?";
break;
case InteractionType.Welcome:
_header = "Begrüßung eintragen";
@@ -51,10 +52,12 @@ namespace FoodsharingSiegen.Server.Dialogs
break;
case InteractionType.PrintPass:
_header = "FS-Ausweis (Print)";
_showNotNeeded = true;
_showInfo = true;
break;
case InteractionType.PdfPass:
_header = "FS-Ausweis (PDF)";
_showNotNeeded = true;
_showInfo = true;
break;
case InteractionType.Verify:

View File

@@ -11,19 +11,35 @@
<Button Color="Color.Primary" Clicked="() => ProspectModal.Show()">Hinzufügen</Button>
<div class="row">
<Repeater Items="@ProspectList?.Where(x => x.Interactions.All(i => i.Type != InteractionType.Complete))">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
</Repeater>
</div>
@{
var activeProspects = ProspectList?.Where(x => x.Interactions.All(i => i.Type != InteractionType.Complete));
}
@if (activeProspects?.Any() == true)
{
<hr />
<h4>Abgeschlossen</h4>
<h4>Aktuell:</h4>
<div class="row">
<Repeater Items="@ProspectList?.Where(x => x.Interactions.Any(i => i.Type == InteractionType.Complete))">
<Repeater Items="@activeProspects">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
</Repeater>
</div>
}
@{
var completedProspects = ProspectList?.Where(x => x.Interactions.Any(i => i.Type == InteractionType.Complete));
}
@if (completedProspects?.Any() == true)
{
<hr />
<h4>Abgeschlossen:</h4>
<div class="row">
<Repeater Items="@completedProspects">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" RemoveInteraction="@RemoveInteraction"></ProspectContainer>
</Repeater>
</div>
}
<AddProspectModal @ref="ProspectModal" OnAdd="OnAddProspect"></AddProspectModal>
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>