{% macro time_window_selector(details, number_sorted_columns) -%}
{% set days_1_checked = 'checked' if not details.is_request_valid or details.time_window == '1' else '' %}
{% set days_7_checked = 'checked' if details.time_window == '7' else '' %}
{% set days_30_checked = 'checked' if details.time_window == '30' else '' %}
{% set running_checked = 'checked' if not details.is_request_valid or details.is_include_running == True else '' %}
{% set processed_checked = 'checked' if details.is_include_processed == True else '' %}
{% set noop_checked = 'checked' if details.is_include_noop == True else '' %}
{% set failed_checked = 'checked' if not details.is_request_valid or details.is_include_failed == True else '' %}
{% set disabled_checked = 'checked' if details.is_include_disabled == True else '' %}

<form data-form_initial_load="{{ 'true' if details.is_request_valid else 'false' }}" style="text-align: center" method="get" id="form_time_window">
    <label><input type="radio" name="time_window" id="days_1" value="1" {{ days_1_checked }} />today</label>
    <label><input type="radio" name="time_window" id="days_7" value="7" {{ days_7_checked }} />last 7 days</label>
    <label><input type="radio" name="time_window" id="days_30" value="30" {{ days_30_checked }} />last 30 days</label>
    <br/>
    <label><input type="checkbox" name="include_running" id="include_running" {{ running_checked }} />running</label>
    <label><input type="checkbox" name="include_processed" id="include_processed" {{ processed_checked }} />processed</label>
    <label><input type="checkbox" name="include_noop" id="include_noop" {{ noop_checked }} />noop</label>
    <label><input type="checkbox" name="include_failed" id="include_failed" {{ failed_checked }} />failed</label>
    <label><input type="checkbox" name="include_disabled" id="include_disabled" {{ disabled_checked }} />disabled</label>
    <input type="submit" class="action_button fa-input" title="Refresh" value="&#xf021;&nbsp;Refresh"/>
</form>

{% set sorted_columns = [] %}
{%- for i in range(number_sorted_columns) %}
    {% do sorted_columns.append([i + 1, "asc"]) %}
{%- endfor %}

<script type="text/javascript">
    $(document).ready(function () {
        load_dataset('#form_time_window', 'form_initial_load', {{ sorted_columns|safe }});
    });
</script>
{%- endmacro %}
