Darstellung der Prospects fragmentiert
This commit is contained in:
9
FoodsharingSiegen.Contracts/Model/Parameters.cs
Normal file
9
FoodsharingSiegen.Contracts/Model/Parameters.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
|
||||
namespace FoodsharingSiegen.Contracts.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// The get prospects parameter
|
||||
/// </summary>
|
||||
public record GetProspectsParameter(List<InteractionType>? MustHaveInteractions = null, List<InteractionType>? CannotHaveInteractions = null);
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
flex-grow: 1;
|
||||
max-width: 480px;
|
||||
border: 1px solid #533a20;
|
||||
border-radius: 15px;
|
||||
border-radius: 7px;
|
||||
margin: 5px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using FoodsharingSiegen.Contracts;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Auth;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -103,12 +104,18 @@ namespace FoodsharingSiegen.Server.Data.Service
|
||||
/// Gets the users (a. beging, 01.04.2022)
|
||||
/// </summary>
|
||||
/// <returns>A task containing an operation result of list prospect</returns>
|
||||
public async Task<OperationResult<List<Prospect>>> GetProspectsAsync(InteractionType? filterType = null)
|
||||
public async Task<OperationResult<List<Prospect>>> GetProspectsAsync(GetProspectsParameter parameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
var prospectsQuery = Context.Prospects!.AsNoTracking().Include(x => x.Interactions.OrderBy(i => i.Date)).ThenInclude(x => x.User).OrderBy(x => x.Name).AsQueryable();
|
||||
if(filterType != null) prospectsQuery = prospectsQuery.Where(x => x.Interactions.Any(i => i.Type == filterType));
|
||||
|
||||
if(parameter.MustHaveInteractions != null && parameter.MustHaveInteractions.Any())
|
||||
prospectsQuery = prospectsQuery.Where(x => x.Interactions.Any(i => parameter.MustHaveInteractions.Contains(i.Type)));
|
||||
|
||||
if(parameter.CannotHaveInteractions != null && parameter.CannotHaveInteractions.Any())
|
||||
prospectsQuery = prospectsQuery.Where(x => x.Interactions.All(i => !parameter.CannotHaveInteractions.Contains(i.Type)));
|
||||
|
||||
var prospects = await prospectsQuery.ToListAsync();
|
||||
|
||||
return new OperationResult<List<Prospect>>(prospects);
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
@page "/"
|
||||
@page "/prospect"
|
||||
@page "/prospects"
|
||||
@using FoodsharingSiegen.Server.Dialogs
|
||||
@using FoodsharingSiegen.Server.Controls
|
||||
@using FoodsharingSiegen.Contracts.Entity
|
||||
@using FoodsharingSiegen.Contracts.Helper
|
||||
@using FoodsharingSiegen.Server.BaseClasses
|
||||
|
||||
@inherits FsBase
|
||||
|
||||
<PageTitle>Einarbeitungen</PageTitle>
|
||||
|
||||
<PageTitle>Aktuelle Einarbeitungen</PageTitle>
|
||||
<h2>Aktuelle Einarbeitungen</h2>
|
||||
|
||||
<Button
|
||||
@@ -19,35 +13,17 @@
|
||||
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||
>Hinzufügen</Button>
|
||||
|
||||
@{
|
||||
var activeProspects = ProspectList?.Where(x => x.Interactions.All(i => i.Type != InteractionType.Complete));
|
||||
}
|
||||
@if (activeProspects?.Any() == true)
|
||||
|
||||
@if (ProspectList?.Any() == true)
|
||||
{
|
||||
<hr />
|
||||
<h3>Aktuell:</h3>
|
||||
<h5>@ProspectList.Count Einträge</h5>
|
||||
<div class="row m-0">
|
||||
<Repeater Items="@activeProspects">
|
||||
<Repeater Items="@ProspectList">
|
||||
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@{
|
||||
var completedProspects = ProspectList?.Where(x => x.Interactions.Any(i => i.Type == InteractionType.Complete));
|
||||
}
|
||||
@if (completedProspects?.Any() == true)
|
||||
{
|
||||
<hr />
|
||||
<h3>Abgeschlossen:</h3>
|
||||
<div class="row m-0">
|
||||
<Repeater Items="@completedProspects">
|
||||
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<AddProspectModal @ref="ProspectModal" OnAdd="OnAddProspect" OnUpdate="OnUpdateProspect"></AddProspectModal>
|
||||
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>
|
||||
@@ -1,5 +1,6 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -88,7 +89,11 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
/// </summary>
|
||||
private async Task LoadProspects()
|
||||
{
|
||||
var prospectsR = await ProspectService.GetProspectsAsync();
|
||||
var parameter = new GetProspectsParameter
|
||||
{
|
||||
CannotHaveInteractions = new List<InteractionType> { InteractionType.Complete, InteractionType.Verify }
|
||||
};
|
||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
17
FoodsharingSiegen.Server/Pages/ProspectsDone.razor
Normal file
17
FoodsharingSiegen.Server/Pages/ProspectsDone.razor
Normal file
@@ -0,0 +1,17 @@
|
||||
@page "/done"
|
||||
|
||||
@inherits FsBase
|
||||
|
||||
<PageTitle>Abgeschlossene Einarbeitungen</PageTitle>
|
||||
<h2>Abgeschlossene Einarbeitungen</h2>
|
||||
|
||||
@if (ProspectList?.Any() == true)
|
||||
{
|
||||
<hr />
|
||||
<h5>@ProspectList.Count Einträge</h5>
|
||||
<div class="row m-0">
|
||||
<Repeater Items="@ProspectList">
|
||||
<ProspectContainer Prospect="context" RemoveInteraction="RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
}
|
||||
93
FoodsharingSiegen.Server/Pages/ProspectsDone.razor.cs
Normal file
93
FoodsharingSiegen.Server/Pages/ProspectsDone.razor.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// The prospects done class (a. beging, 07.02.2023)
|
||||
/// </summary>
|
||||
public partial class ProspectsTodo
|
||||
{
|
||||
#region Dependencies
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the prospect service (ab)
|
||||
/// </summary>
|
||||
[Inject] public ProspectService ProspectService { get; set; } = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the prospect list (ab)
|
||||
/// </summary>
|
||||
private List<Prospect>? ProspectList { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Override OnAfterRenderAsync
|
||||
|
||||
/// <summary>
|
||||
/// Ons the after render using the specified first render (a. beging, 11.04.2022)
|
||||
/// </summary>
|
||||
/// <param name="firstRender">The first render</param>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
await LoadProspects();
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method LoadProspects
|
||||
|
||||
/// <summary>
|
||||
/// Loads the prospects (a. beging, 11.04.2022)
|
||||
/// </summary>
|
||||
private async Task LoadProspects()
|
||||
{
|
||||
var parameter = new GetProspectsParameter
|
||||
{
|
||||
CannotHaveInteractions = new List<InteractionType> { InteractionType.Complete },
|
||||
MustHaveInteractions = new List<InteractionType> { InteractionType.Verify }
|
||||
};
|
||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method RemoveInteraction
|
||||
|
||||
/// <summary>
|
||||
/// Removes the interaction using the specified arg (a. beging, 11.04.2022)
|
||||
/// </summary>
|
||||
/// <param name="arg">The arg</param>
|
||||
private async Task RemoveInteraction(Guid arg)
|
||||
{
|
||||
var confirm = await Message.Confirm("Interaktion wirklich löschen?", "Bestätigen", o =>
|
||||
{
|
||||
o.ConfirmButtonText = "Ja, wirklich!";
|
||||
o.CancelButtonText = "Abbrechen";
|
||||
o.ShowMessageIcon = false;
|
||||
});
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
await ProspectService.RemoveInteraction(arg);
|
||||
await LoadProspects();
|
||||
}
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
19
FoodsharingSiegen.Server/Pages/ProspectsTodo.razor
Normal file
19
FoodsharingSiegen.Server/Pages/ProspectsTodo.razor
Normal file
@@ -0,0 +1,19 @@
|
||||
@page "/todo"
|
||||
|
||||
@inherits FsBase
|
||||
|
||||
<PageTitle>Wartende Einarbeitungen</PageTitle>
|
||||
|
||||
<h2>Wartende Einarbeitungen</h2>
|
||||
|
||||
@if (ProspectList?.Any() == true)
|
||||
{
|
||||
<hr />
|
||||
<h5>@ProspectList.Count Einträge</h5>
|
||||
<div class="text-center font-weight-bold">Bereits verifiziert, aber noch nicht abgeschlossen. Zum Beispiel, wenn noch der Druck-Ausweis fehlt o.ä.</div>
|
||||
<div class="row m-0">
|
||||
<Repeater Items="@ProspectList">
|
||||
<ProspectContainer Prospect="context" RemoveInteraction="RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
}
|
||||
89
FoodsharingSiegen.Server/Pages/ProspectsTodo.razor.cs
Normal file
89
FoodsharingSiegen.Server/Pages/ProspectsTodo.razor.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// The prospects done class (a. beging, 07.02.2023)
|
||||
/// </summary>
|
||||
public partial class ProspectsDone
|
||||
{
|
||||
#region Dependencies
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the prospect service (ab)
|
||||
/// </summary>
|
||||
[Inject] public ProspectService ProspectService { get; set; } = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the prospect list (ab)
|
||||
/// </summary>
|
||||
private List<Prospect>? ProspectList { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Override OnAfterRenderAsync
|
||||
|
||||
/// <summary>
|
||||
/// Ons the after render using the specified first render (a. beging, 11.04.2022)
|
||||
/// </summary>
|
||||
/// <param name="firstRender">The first render</param>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
await LoadProspects();
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method LoadProspects
|
||||
|
||||
/// <summary>
|
||||
/// Loads the prospects (a. beging, 11.04.2022)
|
||||
/// </summary>
|
||||
private async Task LoadProspects()
|
||||
{
|
||||
var parameter = new GetProspectsParameter {MustHaveInteractions = new List<InteractionType> { InteractionType.Complete }};
|
||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method RemoveInteraction
|
||||
|
||||
/// <summary>
|
||||
/// Removes the interaction using the specified arg (a. beging, 11.04.2022)
|
||||
/// </summary>
|
||||
/// <param name="arg">The arg</param>
|
||||
private async Task RemoveInteraction(Guid arg)
|
||||
{
|
||||
var confirm = await Message.Confirm("Interaktion wirklich löschen?", "Bestätigen", o =>
|
||||
{
|
||||
o.ConfirmButtonText = "Ja, wirklich!";
|
||||
o.CancelButtonText = "Abbrechen";
|
||||
o.ShowMessageIcon = false;
|
||||
});
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
await ProspectService.RemoveInteraction(arg);
|
||||
await LoadProspects();
|
||||
}
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<nav class="flex-column">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-logo"></div>
|
||||
<div class="row px-3">
|
||||
<div class="col">
|
||||
@@ -18,14 +18,29 @@
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-tasks mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> Übersicht
|
||||
<span class="fas fa-user-plus mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> Neue Foodsaver
|
||||
</NavLink>
|
||||
</div>
|
||||
<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
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="todo" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-user-clock mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> ToDo
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="done" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-user-shield mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> Abgeschlossen
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
@if (CurrentUser.IsAdmin())
|
||||
{
|
||||
<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>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="audit" Match="NavLinkMatch.All">
|
||||
<span class="fa-solid fa-clock-rotate-left mr-1" aria-hidden="true" style="font-size: 1.4em;"></span> Aktivitäten
|
||||
|
||||
43
FoodsharingSiegen.Server/Shared/NavMenu.razor.cs
Normal file
43
FoodsharingSiegen.Server/Shared/NavMenu.razor.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Server.Auth;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// The nav menu class (a. beging, 07.02.2023)
|
||||
/// </summary>
|
||||
public partial class NavMenu
|
||||
{
|
||||
#region Dependencies
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the auth service (ab)
|
||||
/// </summary>
|
||||
[Inject] protected AuthService AuthService { get; set; } = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the current user (ab)
|
||||
/// </summary>
|
||||
private User CurrentUser => AuthService.User ?? new User();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Override OnInitializedAsync
|
||||
|
||||
/// <summary>
|
||||
/// Ons the initialized (a. beging, 07.02.2023)
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await AuthService.Initialize();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,9 @@
|
||||
@using FoodsharingSiegen.Server.Shared
|
||||
@using Blazorise
|
||||
@using Blazorise.DataGrid
|
||||
@using Blazorise.Components
|
||||
@using Blazorise.Components
|
||||
@using FoodsharingSiegen.Server.BaseClasses
|
||||
@using FoodsharingSiegen.Server.Dialogs
|
||||
@using FoodsharingSiegen.Server.Controls
|
||||
@using FoodsharingSiegen.Contracts.Entity
|
||||
@using FoodsharingSiegen.Contracts.Helper
|
||||
Reference in New Issue
Block a user