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

View File

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

View File

@@ -7,11 +7,22 @@
<CloseButton/> <CloseButton/>
</ModalHeader> </ModalHeader>
<ModalBody> <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="row">
<div class="col"> <div class="col">
<Field> <Field>
<FieldLabel>Wer?</FieldLabel> <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>()) @foreach (var user in Users ?? new List<User>())
{ {
<SelectItem Value="@user.Id">@user.Name</SelectItem> <SelectItem Value="@user.Id">@user.Name</SelectItem>
@@ -30,7 +41,8 @@
@if (_showInfo) @if (_showInfo)
{ {
<Field> <Field>
<MemoEdit @bind-Text="Interaction.Info" Placeholder="@_infoName" Rows="5"/> <FieldLabel>@_infoName</FieldLabel>
<TextEdit @bind-Text="Interaction.Info"></TextEdit>
</Field> </Field>
} }
</ModalBody> </ModalBody>

View File

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

View File

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