Compare commits
2 Commits
ad6f28023e
...
297a7c60bd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
297a7c60bd | ||
|
|
8e5a37a0c9 |
@@ -73,6 +73,12 @@
|
||||
IconClass="fa-solid fa-handshake-simple">
|
||||
</InteractionRow>
|
||||
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<hr style="margin: 10px 0;">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@if (!AppSettings.DisableStepIn)
|
||||
{
|
||||
<InteractionRow
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
@using FoodsharingSiegen.Contracts.Enums
|
||||
@using FoodsharingSiegen.Contracts.Model
|
||||
@inherits FsBase
|
||||
@code {
|
||||
|
||||
[Parameter] public ProspectFilter Filter { get; set; } = new();
|
||||
|
||||
[Parameter] public EventCallback<ProspectFilter> FilterChanged { get; set; }
|
||||
|
||||
[Parameter] public ProspectStateFilter StateFilter { get; set; }
|
||||
|
||||
|
||||
private async Task WithoutStepInBriefingChangedAsync(bool arg)
|
||||
{
|
||||
Filter.WithoutStepInBriefing = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task TextChanged(string arg)
|
||||
{
|
||||
Filter.Text = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task WithoutIdCheckChangedAsync(bool arg)
|
||||
{
|
||||
Filter.WithoutIdCheck = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task NoActivityChangedAsync(bool arg)
|
||||
{
|
||||
Filter.NoActivity = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task DeletedOnlyChangedAsync(bool arg)
|
||||
{
|
||||
Filter.DeletedOnly = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task RecentActivityChangedAsync(bool arg)
|
||||
{
|
||||
Filter.RecentActivity = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header" style="padding: .5rem;">
|
||||
<i class="fa-solid fa-filter"></i> Suchfilter
|
||||
</div>
|
||||
<div class="card-body" style="padding: .5rem;">
|
||||
|
||||
@if (!AppSettings.DisableStepIn)
|
||||
{
|
||||
@* WITHOUT STEP IN BRIEFING *@
|
||||
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Completed }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="Filter.WithoutStepInBriefing" CheckedChanged="WithoutStepInBriefingChangedAsync" Color="Color.Primary">Ohne @AppSettings.Terms.StepInName</Switch>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@* WITHOUT ID CHECK *@
|
||||
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.Verification, ProspectStateFilter.Completed }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="Filter.WithoutIdCheck" CheckedChanged="WithoutIdCheckChangedAsync" Color="Color.Primary">Perso noch nicht geprüft</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
@* RECENT ACTIVITY *@
|
||||
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="Filter.RecentActivity" CheckedChanged="RecentActivityChangedAsync" Color="Color.Primary">Kürzlich geändert (< 6 Monate)</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
@* NO ACTIVITY *@
|
||||
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="Filter.NoActivity" CheckedChanged="NoActivityChangedAsync" Color="Color.Primary">Lange keine Aktivität (> 6 Monate)</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
@* DELETED ONLY *@
|
||||
@if (new[] { ProspectStateFilter.All }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="Filter.DeletedOnly" CheckedChanged="DeletedOnlyChangedAsync" Color="Color.Primary">Gelöschte</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
<TextEdit Text="@Filter.Text" TextChanged="TextChanged" Placeholder="Suchen..." Debounce="true" DebounceInterval="200"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@
|
||||
[Parameter] public Func<Task>? OnDataChanged { get; set; }
|
||||
|
||||
}
|
||||
<h5>@(Prospects?.Count ?? 0) Einträge</h5>
|
||||
<h6>@(Prospects?.Count ?? 0) Ergebnisse</h6>
|
||||
|
||||
@if (Prospects?.Any() == true)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,52 @@
|
||||
@using FoodsharingSiegen.Contracts.Enums
|
||||
@inherits FoodsharingSiegen.Server.BaseClasses.FsBase
|
||||
|
||||
<Button Color="Color.Primary"
|
||||
Width="Width.Px(50)"
|
||||
Height="Height.Px(50)"
|
||||
title="Sortieren"
|
||||
style="min-width: auto;"
|
||||
Clicked="@OpenSortDialogAsync">
|
||||
<i class="fa-solid fa-sort"></i>
|
||||
</Button>
|
||||
<Button Color="Color.Primary"
|
||||
Width="Width.Px(50)"
|
||||
Height="Height.Px(50)"
|
||||
title="Sortieren"
|
||||
style="min-width: auto;"
|
||||
Clicked="@OpenSortDialogAsync">
|
||||
<i class="fa-solid fa-sort"></i>
|
||||
</Button>
|
||||
|
||||
<div class="badge-row mt-2">
|
||||
<Button Color="Color.Primary"
|
||||
Width="Width.Px(50)"
|
||||
Height="Height.Px(50)"
|
||||
title="Filtern"
|
||||
style="min-width: auto;"
|
||||
Clicked="@OpenFilterDialogAsync">
|
||||
<i class="fa-solid fa-filter"></i>
|
||||
</Button>
|
||||
|
||||
<div style="flex-grow: 1;" class="mt-3">
|
||||
<TextEdit Text="@Filter.Text" TextChanged="TextChangedAsync" Placeholder="Suchen..." Debounce="true" DebounceInterval="200" />
|
||||
</div>
|
||||
|
||||
<div class="badge-row mt-1 mb-3">
|
||||
@if (HasCustomSort)
|
||||
{
|
||||
<Badge Color="Color.Primary" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, ResetSortAsync)">@CurrentSortText</Badge>
|
||||
<Badge class="mr-1" Color="Color.Primary" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, ResetSortAsync)">@CurrentSortText</Badge>
|
||||
}
|
||||
|
||||
@if (Filter.WithoutStepInBriefing)
|
||||
{
|
||||
<Badge class="mr-1 mb-1" Color="Color.Info" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, () => DisableFilterAsync(nameof(Filter.WithoutStepInBriefing)))">Ohne @AppSettings.Terms.StepInName</Badge>
|
||||
}
|
||||
@if (Filter.WithoutIdCheck)
|
||||
{
|
||||
<Badge class="mr-1 mb-1" Color="Color.Info" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, () => DisableFilterAsync(nameof(Filter.WithoutIdCheck)))">Perso noch nicht geprüft</Badge>
|
||||
}
|
||||
@if (Filter.RecentActivity)
|
||||
{
|
||||
<Badge class="mr-1 mb-1" Color="Color.Info" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, () => DisableFilterAsync(nameof(Filter.RecentActivity)))">Kürzlich geändert</Badge>
|
||||
}
|
||||
@if (Filter.NoActivity)
|
||||
{
|
||||
<Badge class="mr-1 mb-1" Color="Color.Info" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, () => DisableFilterAsync(nameof(Filter.NoActivity)))">Lange keine Aktivität</Badge>
|
||||
}
|
||||
@if (Filter.DeletedOnly)
|
||||
{
|
||||
<Badge class="mr-1 mb-1" Color="Color.Info" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, () => DisableFilterAsync(nameof(Filter.DeletedOnly)))">Gelöschte</Badge>
|
||||
}
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Enums;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using FoodsharingSiegen.Server.Service;
|
||||
@@ -26,6 +27,10 @@ public partial class ProspectSortControl
|
||||
[Parameter]
|
||||
public string? StorageKey { get; set; }
|
||||
|
||||
[Parameter] public ProspectFilter Filter { get; set; } = new();
|
||||
[Parameter] public EventCallback<ProspectFilter> FilterChanged { get; set; }
|
||||
[Parameter] public ProspectStateFilter StateFilter { get; set; } = ProspectStateFilter.All;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(StorageKey))
|
||||
@@ -48,6 +53,35 @@ public partial class ProspectSortControl
|
||||
});
|
||||
}
|
||||
|
||||
private async Task OpenFilterDialogAsync()
|
||||
{
|
||||
await ProspectFilterDialog.ShowAsync(ModalService, Filter, StateFilter, async (f) =>
|
||||
{
|
||||
Filter = f;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task TextChangedAsync(string text)
|
||||
{
|
||||
Filter.Text = text;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task DisableFilterAsync(string filterPropName)
|
||||
{
|
||||
switch (filterPropName)
|
||||
{
|
||||
case nameof(Filter.WithoutStepInBriefing): Filter.WithoutStepInBriefing = false; break;
|
||||
case nameof(Filter.WithoutIdCheck): Filter.WithoutIdCheck = false; break;
|
||||
case nameof(Filter.RecentActivity): Filter.RecentActivity = false; break;
|
||||
case nameof(Filter.NoActivity): Filter.NoActivity = false; break;
|
||||
case nameof(Filter.DeletedOnly): Filter.DeletedOnly = false; break;
|
||||
}
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private bool HasCustomSort => CurrentSort != ProspectSortOption.NameAscending;
|
||||
|
||||
private string CurrentSortText => CurrentSort switch
|
||||
|
||||
49
FoodsharingSiegen.Server/Dialogs/ProspectFilterDialog.razor
Normal file
49
FoodsharingSiegen.Server/Dialogs/ProspectFilterDialog.razor
Normal file
@@ -0,0 +1,49 @@
|
||||
@inherits FsBase
|
||||
@using FoodsharingSiegen.Contracts.Enums
|
||||
|
||||
<div class="d-grid gap-2">
|
||||
@if (!AppSettings.DisableStepIn && new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Completed }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="ModalFilter.WithoutStepInBriefing" CheckedChanged="(v) => { ModalFilter.WithoutStepInBriefing = v; StateHasChanged(); }" Color="Color.Primary">
|
||||
Ohne @AppSettings.Terms.StepInName
|
||||
</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.Verification, ProspectStateFilter.Completed }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="ModalFilter.WithoutIdCheck" CheckedChanged="(v) => { ModalFilter.WithoutIdCheck = v; StateHasChanged(); }" Color="Color.Primary">
|
||||
Perso noch nicht geprüft
|
||||
</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter))
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="ModalFilter.RecentActivity" CheckedChanged="(v) => { ModalFilter.RecentActivity = v; StateHasChanged(); }" Color="Color.Primary">
|
||||
Kürzlich geändert (< 6 Monate)
|
||||
</Switch>
|
||||
</div>
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="ModalFilter.NoActivity" CheckedChanged="(v) => { ModalFilter.NoActivity = v; StateHasChanged(); }" Color="Color.Primary">
|
||||
Lange keine Aktivität (> 6 Monate)
|
||||
</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (StateFilter == ProspectStateFilter.All)
|
||||
{
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="ModalFilter.DeletedOnly" CheckedChanged="(v) => { ModalFilter.DeletedOnly = v; StateHasChanged(); }" Color="Color.Primary">
|
||||
Gelöschte
|
||||
</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-end mt-3">
|
||||
<Button Color="Color.Primary" Clicked="ApplyAsync" Block="true">Anwenden</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Enums;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.BaseClasses;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Dialogs
|
||||
{
|
||||
public partial class ProspectFilterDialog : FsBase
|
||||
{
|
||||
[Parameter] public ProspectFilter CurrentFilter { get; set; } = new();
|
||||
[Parameter] public ProspectStateFilter StateFilter { get; set; } = ProspectStateFilter.All;
|
||||
[Parameter] public Func<ProspectFilter, Task>? OnFilterApplied { get; set; }
|
||||
|
||||
public ProspectFilter ModalFilter { get; set; } = new();
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// Clone the filter so changes are not immediately mapped to the parent until "Anwenden" is pressed
|
||||
ModalFilter = new ProspectFilter
|
||||
{
|
||||
Text = CurrentFilter.Text,
|
||||
WithoutStepInBriefing = CurrentFilter.WithoutStepInBriefing,
|
||||
WithoutIdCheck = CurrentFilter.WithoutIdCheck,
|
||||
NoActivity = CurrentFilter.NoActivity,
|
||||
RecentActivity = CurrentFilter.RecentActivity,
|
||||
DeletedOnly = CurrentFilter.DeletedOnly
|
||||
};
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
public static async Task ShowAsync(IModalService modalService, ProspectFilter currentFilter, ProspectStateFilter stateFilter, Func<ProspectFilter, Task> onFilterApplied)
|
||||
{
|
||||
await modalService.Show<ProspectFilterDialog>("Filtern", p =>
|
||||
{
|
||||
p.Add(nameof(CurrentFilter), currentFilter);
|
||||
p.Add(nameof(StateFilter), stateFilter);
|
||||
p.Add(nameof(OnFilterApplied), onFilterApplied);
|
||||
}, new ModalInstanceOptions
|
||||
{
|
||||
Size = ModalSize.Small,
|
||||
});
|
||||
}
|
||||
|
||||
private async Task ApplyAsync()
|
||||
{
|
||||
if (OnFilterApplied != null) await OnFilterApplied(ModalFilter);
|
||||
await ModalService.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,17 +25,16 @@
|
||||
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||
><i class="fa-solid fa-plus"></i>
|
||||
</Button>
|
||||
|
|
||||
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspects" OnSortChanged="StateHasChanged" />
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspects" OnSortChanged="StateHasChanged" Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.OnBoarding" />
|
||||
|
||||
@{
|
||||
var filterList = ProspectList.ApplyFilter(Filter);
|
||||
var sortList = filterList.ApplySort(CurrentSort);
|
||||
}
|
||||
|
||||
<hr/>
|
||||
<ProspectFilterControl Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.OnBoarding"></ProspectFilterControl>
|
||||
<hr />
|
||||
|
||||
<ProspectGrid
|
||||
Prospects="sortList"
|
||||
OnDataChanged="@LoadProspects"
|
||||
|
||||
@@ -14,16 +14,13 @@
|
||||
<div class="alert alert-danger"><strong>TESTMODUS!</strong> Änderungen werden wieder gelöscht.</div>
|
||||
}
|
||||
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspectsAll" OnSortChanged="StateHasChanged" />
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspectsAll" OnSortChanged="StateHasChanged" Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.All" />
|
||||
|
||||
@{
|
||||
var filterList = ProspectList.ApplyFilter(Filter);
|
||||
var sortList = filterList.ApplySort(CurrentSort);
|
||||
}
|
||||
|
||||
<hr/>
|
||||
<ProspectFilterControl Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.All"></ProspectFilterControl>
|
||||
<hr />
|
||||
<ProspectGrid
|
||||
Prospects="sortList"
|
||||
OnDataChanged="@LoadProspects"
|
||||
|
||||
@@ -13,16 +13,13 @@
|
||||
<div class="alert alert-danger"><strong>TESTMODUS!</strong> Änderungen werden wieder gelöscht.</div>
|
||||
}
|
||||
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspectsDone" OnSortChanged="StateHasChanged" />
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspectsDone" OnSortChanged="StateHasChanged" Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.Completed" />
|
||||
|
||||
@{
|
||||
var filterList = ProspectList.ApplyFilter(Filter);
|
||||
var sortList = filterList.ApplySort(CurrentSort);
|
||||
}
|
||||
|
||||
<hr />
|
||||
<ProspectFilterControl Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.Completed"></ProspectFilterControl>
|
||||
<hr />
|
||||
<ProspectGrid
|
||||
Prospects="sortList"
|
||||
OnDataChanged="@LoadProspects"
|
||||
|
||||
@@ -13,16 +13,14 @@
|
||||
<div class="alert alert-danger"><strong>TESTMODUS!</strong> Änderungen werden wieder gelöscht.</div>
|
||||
}
|
||||
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspectsVerify" OnSortChanged="StateHasChanged" />
|
||||
<ProspectSortControl @bind-CurrentSort="CurrentSort" StorageKey="@StorageKeys.SortProspectsVerify" OnSortChanged="StateHasChanged" Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.Verification" />
|
||||
|
||||
@{
|
||||
var filterList = ProspectList.ApplyFilter(Filter);
|
||||
var sortList = filterList.ApplySort(CurrentSort);
|
||||
}
|
||||
|
||||
<hr/>
|
||||
<ProspectFilterControl Filter="Filter" FilterChanged="FilterChangedAsync" StateFilter="ProspectStateFilter.Verification"></ProspectFilterControl>
|
||||
<hr />
|
||||
|
||||
<ProspectGrid
|
||||
Prospects="sortList"
|
||||
OnDataChanged="@LoadProspects"
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info" style="font-size: 0.85rem;">
|
||||
<i class="fas fa-info-circle mr-1"></i> Dein Passwort muss mindestens 8 Zeichen lang sein und eine Zahl enthalten.
|
||||
</div>
|
||||
|
||||
<Validation Validator="ValidationHelper.ValidatePassword" @bind-Status="@IsValidPassword">
|
||||
<Field>
|
||||
<FieldLabel>Neues Passwort</FieldLabel>
|
||||
|
||||
Reference in New Issue
Block a user