{% extends "_layout_events_search.html" %}

{% block sectionabout %}
                    <p>
                        {{ _('This module displays various statistics of IDEA events calculated for given network and optional time interval and with emphasis on said event timelines. These statistics are calculated directly from IDEA event database, so depending on the size of the selected network, the interval and number of related IDEA events these visualisations may take some time, even on the order of minutes. Please, be patient. Events are included into the result based on their detection time.') | safe }}
                    </p>
{% endblock sectionabout %}

{% block sectionsearchresult %}

            <div class="card overflow-hidden">
                <div class="card-header">
                    <h5 class="card-title mb-0">{{ _('Result summary') }}</h5>
                </div>
                <table class="table">
                    <tr>
                        <th>{{ _('Number of events') }}:</th>
                        <td>{{ babel_format_decimal(items_count) }}</td>
                    </tr>
                    <tr>
                        <th>{{ _('Time interval') }}:</th>
                        <td>{{ babel_format_datetime(statistics['timeline_cfg'].t_from) }} - {{ babel_format_datetime(statistics['timeline_cfg'].t_to) }}</td>
                    </tr>
                    <tr>
                        <th>{{ _('Time interval delta') }}:</th>
                        <td>{{ babel_format_timedelta(statistics['timeline_cfg'].t_to - statistics['timeline_cfg'].t_from) }}</td>
                    </tr>
                    {%- if permission_can('admin') and 'timeline_cfg' in statistics %}
                    <tr>
                        <th><span class="float-end">{{ get_icon('role-admin') }}</span>{{ _('Timeline steps') }}:</th>
                        <td>{{ babel_format_decimal(statistics['timeline_cfg'].count) }} x {{ statistics['timeline_cfg'].step.__str__() }}</td>
                    </tr>
                    {%- endif %}
                </table>
            </div>

            <p class="my-3"><strong>{{ macros_site.render_endpoint_link('events.search', query_params, label = _("View these results on event search page"), with_icon = True) }}</strong></p>

            {%- set active_section = form_data['section'] %}
            <ul class="nav nav-tabs nav-tabs-tooltipped" role="tablist">
            {{
                macros_chart.render_dashboard_nav(
                    chart_sections,
                    'stats',
                    render_empty = True,
                    active_section_key = form_data.get('section'),
                    get_url_func = get_search_url
                )
            }}
            </ul>
            <!-- Tab navigation - END ----------------------------------------->

            <!-- Tab panels - BEGIN ------------------------------------------->
            <div class="tab-content">
            {{
                macros_chart.render_dashboard_panels(
                    chart_sections,
                    'stats',
                    render_empty = True,
                    active_section_key = form_data.get('section')
                )
            }}
            </div>
            <!-- Tab panels - END --------------------------------------------->

            {%- if permission_can('developer') %}
            <hr>
            {{ macros_site.render_raw_var('search_result', search_result) }}
            {{ macros_site.render_raw_var('statistics', statistics) }}
            {%- endif %}

{% endblock sectionsearchresult %}
