Buildversion and FilterHelper
This commit is contained in:
@@ -106,7 +106,7 @@ namespace FoodsharingSiegen.Server.Auth
|
|||||||
{
|
{
|
||||||
Name = "Andre",
|
Name = "Andre",
|
||||||
Mail = "fs@beging.de",
|
Mail = "fs@beging.de",
|
||||||
GroupsList = new List<UserGroup> { UserGroup.Ambassador },
|
GroupsList = [UserGroup.Ambassador],
|
||||||
Type = UserType.Admin,
|
Type = UserType.Admin,
|
||||||
Created = DateTime.UtcNow,
|
Created = DateTime.UtcNow,
|
||||||
EncryptedPassword = "qSIxTZo7J8M="
|
EncryptedPassword = "qSIxTZo7J8M="
|
||||||
|
|||||||
@@ -4,8 +4,18 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<BuildDate>$([System.DateTime]::Now.ToString("yyyyMMdd"))</BuildDate>
|
||||||
|
<PublishDir>..\Publish\Server</PublishDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Target Name="GenerateBuildInfo" BeforeTargets="Build">
|
||||||
|
<WriteLinesToFile File="$(ProjectDir)wwwroot\buildinfo.txt" Lines="$(BuildDate)" Overwrite="true" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FoodsharingSiegen.Contracts\FoodsharingSiegen.Contracts.csproj" />
|
<ProjectReference Include="..\FoodsharingSiegen.Contracts\FoodsharingSiegen.Contracts.csproj" />
|
||||||
<ProjectReference Include="..\FoodsharingSiegen.Shared\FoodsharingSiegen.Shared.csproj" />
|
<ProjectReference Include="..\FoodsharingSiegen.Shared\FoodsharingSiegen.Shared.csproj" />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
@page "/prospect"
|
@page "/prospect"
|
||||||
@page "/prospects"
|
@page "/prospects"
|
||||||
|
|
||||||
|
@using FoodsharingSiegen.Shared.Helper
|
||||||
@inherits FsBase
|
@inherits FsBase
|
||||||
|
|
||||||
<PageTitle>Neue Foodsaver - @AppSettings.Title</PageTitle>
|
<PageTitle>Neue Foodsaver - @AppSettings.Title</PageTitle>
|
||||||
@@ -15,28 +16,15 @@
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
var filterListQ = ProspectList?.AsQueryable();
|
var filterList = ProspectList.ApplyFilter(Filter);
|
||||||
if (!string.IsNullOrWhiteSpace(Filter.Text))
|
|
||||||
{
|
|
||||||
filterListQ = filterListQ?
|
|
||||||
.Where(x =>
|
|
||||||
x.Name.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
|
||||||
x.FsId.ToString().Contains(Filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Filter.WithoutStepInBriefing)
|
|
||||||
filterListQ = filterListQ?.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
|
||||||
|
|
||||||
var filterList = filterListQ?.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
||||||
<hr />
|
<hr />
|
||||||
<h5>@(filterList?.Count ?? 0) Einträge</h5>
|
<h5>@(filterList.Count) Einträge</h5>
|
||||||
|
|
||||||
@if (filterList?.Any() == true)
|
@if (filterList.Any())
|
||||||
{
|
{
|
||||||
<div class="row m-0">
|
<div class="row m-0">
|
||||||
<Repeater Items="@filterList">
|
<Repeater Items="@filterList">
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ namespace FoodsharingSiegen.Server.Pages
|
|||||||
{
|
{
|
||||||
CannotHaveInteractions = [InteractionType.Complete, InteractionType.Verify, InteractionType.ReleasedForVerification]
|
CannotHaveInteractions = [InteractionType.Complete, InteractionType.Verify, InteractionType.ReleasedForVerification]
|
||||||
};
|
};
|
||||||
|
|
||||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,20 @@
|
|||||||
@page "/done"
|
@page "/done"
|
||||||
|
|
||||||
|
@using FoodsharingSiegen.Shared.Helper
|
||||||
@inherits FsBase
|
@inherits FsBase
|
||||||
|
|
||||||
<PageTitle>Abgeschlossene Einarbeitungen - @AppSettings.Title</PageTitle>
|
<PageTitle>Abgeschlossene Einarbeitungen - @AppSettings.Title</PageTitle>
|
||||||
<h2>Abgeschlossene Einarbeitungen</h2>
|
<h2>Abgeschlossene Einarbeitungen</h2>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
var filterListQ = ProspectList?.AsQueryable();
|
var filterList = ProspectList.ApplyFilter(Filter);
|
||||||
if (!string.IsNullOrWhiteSpace(Filter.Text))
|
|
||||||
{
|
|
||||||
filterListQ = filterListQ?
|
|
||||||
.Where(x =>
|
|
||||||
x.Name.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
|
||||||
x.FsId.ToString().Contains(Filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Filter.WithoutStepInBriefing)
|
|
||||||
filterListQ = filterListQ?.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
|
||||||
|
|
||||||
var filterList = filterListQ?.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
||||||
<hr />
|
<hr />
|
||||||
<h5>@(filterList?.Count ?? 0) Einträge</h5>
|
<h5>@(filterList.Count) Einträge</h5>
|
||||||
@if (filterList?.Any() == true)
|
@if (filterList.Any())
|
||||||
{
|
{
|
||||||
|
|
||||||
<div class="row m-0">
|
<div class="row m-0">
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
@page "/todo"
|
|
||||||
|
|
||||||
@inherits FsBase
|
|
||||||
|
|
||||||
<PageTitle>Freischalten - @AppSettings.Title</PageTitle>
|
|
||||||
|
|
||||||
<h2>Freischalten</h2>
|
|
||||||
|
|
||||||
@{
|
|
||||||
var filterListQ = ProspectList?.AsQueryable();
|
|
||||||
if (!string.IsNullOrWhiteSpace(Filter.Text))
|
|
||||||
{
|
|
||||||
filterListQ = filterListQ?
|
|
||||||
.Where(x =>
|
|
||||||
x.Name.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
|
||||||
x.FsId.ToString().Contains(Filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Filter.WithoutStepInBriefing)
|
|
||||||
filterListQ = filterListQ?.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
|
||||||
|
|
||||||
var filterList = filterListQ?.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
|
||||||
<hr />
|
|
||||||
<h5>@(filterList?.Count ?? 0) Einträge</h5>
|
|
||||||
@if (filterList?.Any() == true)
|
|
||||||
{
|
|
||||||
<div class="row m-0">
|
|
||||||
<Repeater Items="@filterList">
|
|
||||||
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction" StateFilter="ProspectStateFilter.Verification"></ProspectContainer>
|
|
||||||
</Repeater>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<AddProspectModal @ref="ProspectModal" OnUpdate="OnUpdateProspect"></AddProspectModal>
|
|
||||||
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>
|
|
||||||
28
FoodsharingSiegen.Server/Pages/ProspectsVerify.razor
Normal file
28
FoodsharingSiegen.Server/Pages/ProspectsVerify.razor
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
@page "/verify"
|
||||||
|
|
||||||
|
@using FoodsharingSiegen.Shared.Helper
|
||||||
|
@inherits FsBase
|
||||||
|
|
||||||
|
<PageTitle>Freischalten - @AppSettings.Title</PageTitle>
|
||||||
|
|
||||||
|
<h2>Freischalten</h2>
|
||||||
|
|
||||||
|
@{
|
||||||
|
var filterList = ProspectList.ApplyFilter(Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
||||||
|
<hr />
|
||||||
|
<h5>@(filterList.Count) Einträge</h5>
|
||||||
|
@if (filterList.Any())
|
||||||
|
{
|
||||||
|
<div class="row m-0">
|
||||||
|
<Repeater Items="@filterList">
|
||||||
|
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction" StateFilter="ProspectStateFilter.Verification"></ProspectContainer>
|
||||||
|
</Repeater>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<AddProspectModal @ref="ProspectModal" OnUpdate="OnUpdateProspect"></AddProspectModal>
|
||||||
|
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>
|
||||||
@@ -9,7 +9,7 @@ namespace FoodsharingSiegen.Server.Pages
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The prospects done class (a. beging, 07.02.2023)
|
/// The prospects done class (a. beging, 07.02.2023)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ProspectsTodo
|
public partial class ProspectsVerify
|
||||||
{
|
{
|
||||||
#region Dependencies
|
#region Dependencies
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<nav class="flex-column">
|
<nav class="d-flex flex-column h-100">
|
||||||
<div class="nav-logo"></div>
|
<div class="nav-logo"></div>
|
||||||
<div class="d-flex px-3 justify-content-center text-center font-weight-bold">
|
<div class="d-flex px-3 justify-content-center text-center font-weight-bold">
|
||||||
Einarbeitungen<br/>
|
Einarbeitungen<br/>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<div @onclick="NavLinkClickedAsync">
|
<div @onclick="NavLinkClickedAsync">
|
||||||
<NavLink class="nav-link" href="todo" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="verify" Match="NavLinkMatch.All">
|
||||||
<span class="fas fa-user-pen mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Freischalten
|
<span class="fas fa-user-pen mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Freischalten
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
@@ -31,12 +31,24 @@
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (CurrentUser.IsAdmin())
|
||||||
|
{
|
||||||
|
<hr/>
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
<div @onclick="NavLinkClickedAsync">
|
||||||
|
<NavLink class="nav-link" href="done" Match="NavLinkMatch.All">
|
||||||
|
<span class="fas fa-user-shield mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Alle (Admin)
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
@if (CurrentUser.IsAdmin())
|
@if (CurrentUser.IsAdmin())
|
||||||
{
|
{
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3 pb-0">
|
||||||
<div @onclick="NavLinkClickedAsync">
|
<div @onclick="NavLinkClickedAsync">
|
||||||
<NavLink class="nav-link" href="users" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="users" Match="NavLinkMatch.All">
|
||||||
<span class="fas fa-users mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Benutzer
|
<span class="fas fa-users mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Benutzer
|
||||||
@@ -45,14 +57,6 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
|
||||||
<div @onclick="NavLinkClickedAsync">
|
|
||||||
<NavLink class="nav-link" href="profile" Match="NavLinkMatch.All">
|
|
||||||
<span class="fas fa-user mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Profil
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<div @onclick="NavLinkClickedAsync">
|
<div @onclick="NavLinkClickedAsync">
|
||||||
<NavLink class="nav-link" href="audit" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="audit" Match="NavLinkMatch.All">
|
||||||
@@ -61,6 +65,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-grow-1"></div>
|
||||||
|
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
<div @onclick="NavLinkClickedAsync">
|
||||||
|
<NavLink class="nav-link" href="profile" Match="NavLinkMatch.All">
|
||||||
|
<span class="fas fa-user mr-2" aria-hidden="true" style="font-size: 1.4em;"></span> Mein Profil
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<div @onclick="NavLinkClickedAsync">
|
<div @onclick="NavLinkClickedAsync">
|
||||||
<NavLink class="nav-link" href="logout" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="logout" Match="NavLinkMatch.All">
|
||||||
@@ -68,4 +82,6 @@
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pb-1 text-center small">@($"v{Version ?? "0"}")</div>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -12,9 +12,6 @@ namespace FoodsharingSiegen.Server.Shared
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class NavMenu
|
public partial class NavMenu
|
||||||
{
|
{
|
||||||
[Inject]
|
|
||||||
private IJSRuntime JsRuntime { get; set; } = null!;
|
|
||||||
|
|
||||||
#region Dependencies
|
#region Dependencies
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
@@ -23,6 +20,12 @@ namespace FoodsharingSiegen.Server.Shared
|
|||||||
[Inject]
|
[Inject]
|
||||||
protected AuthService AuthService { get; set; } = null!;
|
protected AuthService AuthService { get; set; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IWebHostEnvironment Env { get; set; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IJSRuntime JsRuntime { get; set; } = null!;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Properties
|
#region Private Properties
|
||||||
@@ -32,6 +35,8 @@ namespace FoodsharingSiegen.Server.Shared
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private User CurrentUser => AuthService.User ?? new User();
|
private User CurrentUser => AuthService.User ?? new User();
|
||||||
|
|
||||||
|
private string? Version { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Protected Properties
|
#region Protected Properties
|
||||||
@@ -50,14 +55,22 @@ namespace FoodsharingSiegen.Server.Shared
|
|||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await AuthService.Initialize();
|
await AuthService.Initialize();
|
||||||
|
|
||||||
|
var filePath = Path.Combine(Env.WebRootPath, "buildinfo.txt");
|
||||||
|
if (File.Exists(filePath)) Version = await File.ReadAllTextAsync(filePath);
|
||||||
|
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Private Method NavLinkClickedAsync
|
||||||
|
|
||||||
private async Task NavLinkClickedAsync()
|
private async Task NavLinkClickedAsync()
|
||||||
{
|
{
|
||||||
await JsRuntime.InvokeVoidAsync("eval", "document.getElementById('menu-toggler').checked=false;");
|
await JsRuntime.InvokeVoidAsync("eval", "document.getElementById('menu-toggler').checked=false;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
42
FoodsharingSiegen.Shared/Helper/FilterHelper.cs
Normal file
42
FoodsharingSiegen.Shared/Helper/FilterHelper.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using FoodsharingSiegen.Contracts.Entity;
|
||||||
|
using FoodsharingSiegen.Contracts.Model;
|
||||||
|
|
||||||
|
namespace FoodsharingSiegen.Shared.Helper
|
||||||
|
{
|
||||||
|
public static class FilterHelper
|
||||||
|
{
|
||||||
|
#region Public Method ApplyFilter
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filters the given prospect list based on the provided filter criteria.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prospectList">
|
||||||
|
/// The list of prospects to be filtered. Can be null.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="filter">
|
||||||
|
/// The filter criteria used to narrow down the prospect list.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// A filtered list of prospects that meet the criteria specified in the filter.
|
||||||
|
/// </returns>
|
||||||
|
public static List<Prospect> ApplyFilter(this List<Prospect>? prospectList, ProspectFilter filter)
|
||||||
|
{
|
||||||
|
if (prospectList == null) return [];
|
||||||
|
|
||||||
|
var filterListQ = prospectList.AsQueryable();
|
||||||
|
if (!string.IsNullOrWhiteSpace(filter.Text))
|
||||||
|
filterListQ = filterListQ
|
||||||
|
.Where(x =>
|
||||||
|
x.Name.Contains(filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
||||||
|
x.FsId.ToString().Contains(filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
||||||
|
|
||||||
|
if (filter.WithoutStepInBriefing)
|
||||||
|
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
||||||
|
|
||||||
|
return filterListQ.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user