@page "/query-builder"
@inject IStringLocalizer<QueryBuilders> Localizer

<h3>@Localizer["QueryBuilderTitle"]</h3>

<h4>@Localizer["QueryBuilderSubTitle"]</h4>

<DemoBlock Title="@Localizer["QueryBuilderNormalTitle"]"
           Introduction="@Localizer["QueryBuilderNormalIntro"]"
           Name="Normal">
    <QueryBuilder TModel="Foo" @bind-Value="_filter1">
        <QueryColumn @bind-Field="@context.Name" Operator="@FilterAction.Equal"></QueryColumn>

        <QueryGroup Logic="@FilterLogic.Or">
            <QueryColumn @bind-Field="@context.Address" Operator="@FilterAction.Contains"></QueryColumn>
            <QueryColumn @bind-Field="@context.Education" Operator="@FilterAction.Equal"></QueryColumn>
        </QueryGroup>

        <QueryColumn @bind-Field="@context.Complete" Operator="@FilterAction.Equal"></QueryColumn>
        <QueryColumn @bind-Field="@context.DateTime" Operator="@FilterAction.GreaterThanOrEqual"></QueryColumn>
    </QueryBuilder>

    <Divider Text="Nest"></Divider>

    <QueryBuilder TModel="Foo" @bind-Value="_filter2" class="mt-3">
        <QueryColumn @bind-Field="@context.Name" Operator="@FilterAction.Equal"></QueryColumn>

        <QueryGroup Logic="@FilterLogic.Or">
            <QueryColumn @bind-Field="@context.Address" Operator="@FilterAction.Contains"></QueryColumn>
            <QueryColumn @bind-Field="@context.Education" Operator="@FilterAction.Equal"></QueryColumn>

            <QueryGroup Logic="@FilterLogic.And">
                <QueryColumn @bind-Field="@context.DateTime" Operator="@FilterAction.GreaterThanOrEqual"></QueryColumn>
                <QueryColumn @bind-Field="@context.Complete" Operator="@FilterAction.Equal"></QueryColumn>
            </QueryGroup>
        </QueryGroup>
    </QueryBuilder>
</DemoBlock>

<DemoBlock Title="@Localizer["QueryBuilderHeaderTitle"]"
           Introduction="@Localizer["QueryBuilderHeaderIntro"]"
           Name="ShowHeader">
    <QueryBuilder TModel="Foo" @bind-Value="_filter3" ShowHeader="false">
        <QueryColumn @bind-Field="@context.Name" Operator="@FilterAction.Equal"></QueryColumn>

        <QueryGroup Logic="@FilterLogic.Or">
            <QueryColumn @bind-Field="@context.Address" Operator="@FilterAction.Contains"></QueryColumn>
            <QueryColumn @bind-Field="@context.Education" Operator="@FilterAction.Equal"></QueryColumn>

            <QueryGroup Logic="@FilterLogic.And">
                <QueryColumn @bind-Field="@context.DateTime" Operator="@FilterAction.GreaterThanOrEqual"></QueryColumn>
                <QueryColumn @bind-Field="@context.Complete" Operator="@FilterAction.Equal"></QueryColumn>
            </QueryGroup>
        </QueryGroup>
    </QueryBuilder>
</DemoBlock>
