@page "/"
@page "/prospect"
@page "/prospects"

@using FoodsharingSiegen.Contracts
@using FoodsharingSiegen.Contracts.Enums
@using FoodsharingSiegen.Shared.Helper
@inherits FsBase

<PageTitle>Neue Foodsaver - @AppSettings.Terms.Title</PageTitle>
<h2>Neue Foodsaver</h2>

@if (AppSettings.TestMode)
{
    <div class="alert alert-danger"><strong>TESTMODUS!</strong> Änderungen werden wieder gelöscht.</div>
}

<Button
    Color="Color.Primary"
    Height="Height.Px(50)"
    title="Hinzufügen"
    style="min-width: auto;"
    Clicked="@CreateProspectAsync"
    Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
><i class="fa-solid fa-plus"></i> Neu
</Button>
|

<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);
}


<ProspectGrid
    Prospects="sortList"
    OnDataChanged="@LoadProspects"
    StateFilter="ProspectStateFilter.OnBoarding">
</ProspectGrid>