@inherits ViewBase

@code {
    private string searchExpression;
    private string selectTrackSetKey="main";
}

<div class="row">
    <div class="col">
        <fieldset class="border rounded-3 p-2">
            <legend class="float-none w-auto px-2 d-flex flex-row align-items-center">
                <span>Filter</span>
            </legend>
            <div class="input-group">
                <div class="form-floating">
                    <InputText type="search" class="form-control" placeholder="Search expression"
                               Value="@searchExpression"
                               ValueExpression="@(()=>searchExpression)"
                               @oninput="SearchChanged"
                               onsearch="@SearchDone">
                    </InputText>
                    <label>Search expression</label>
                </div>
                <button @onclick="@SearchDone" class="btn btn-outline-secondary" type="button">Search</button>
            </div>
            <div class="row mt-3">
                <label for="staticEmail" class="col-sm-2 col-form-label">Track set</label>
                <div class="col-sm-10">
                    <InputRadioGroup @bind-Value="selectTrackSetKey">
                        <div class="btn-group" role="group" aria-label="Basic radio toggle button group">
                            @foreach (var item in (DataSet.AllTracksSet.GroupBy(p => p.Key).Select(p => new { p.Key, Name = p.Select(q => q.Name).First() }).ToArray()).KeepNoEmpty().WithIndex())
                            {
                                <InputRadio class="btn-check" id="@("stk-"+item.index)" Value="item.item?.Key"></InputRadio>
                                <label class="btn btn-outline-primary" for="@("stk-"+item.index)">@(item.item?.Name)</label>
                            }
                        </div>
                    </InputRadioGroup>
                </div>
            </div>
        </fieldset>
    </div>
</div>

@code {
    private void SearchChanged(ChangeEventArgs e)
    {
        searchExpression = e.Value.ToString().Trim();
        StateHasChanged();
    }

    private void SearchDone()
    {

    }
}