@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.Info"
            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 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>
    }
    @if(Filter.IdCheckPossible)
    {
        <Badge class="mr-1 mb-1" Color="Color.Info" Closable="true" CloseClicked="@EventCallback.Factory.Create(this, () => DisableFilterAsync(nameof(Filter.IdCheckPossible)))">Perso-Prüfung möglich</Badge>
    }
</div>