{% extends "base.html" %}
{% block title %}Statistics{% endblock %}
{% block javascript_includes %}
    <script type="text/javascript" src="{{ url_for ('static', filename='js/statistics.js') }}"></script>
{% endblock %}
{% block javascript_init %}
    <script type="text/javascript" charset="utf-8">
        function accordianCreate (event, ui)
        {
            var workflowStats = '{{ workflow_stats|tojson|safe }}';
            workflowStats = JSON.parse (workflowStats);
            render_workflow_stats (ui.panel, workflowStats);
        }

        function loadSummaryStats ()
        {
            var workflowSummaryStats = '{{ summary_stats|tojson|safe }}';
            workflowSummaryStats = JSON.parse (workflowSummaryStats);
            render_workflow_summary_stats ($ ('#workflow_summary_stats'), workflowSummaryStats);
        }

        function init ()
        {
            loadSummaryStats ();

            var statistics = $ ("#statistics_container");
            statistics.accordion ({ heightStyle: "content", autoHeight: false, activate: activateEventHandler, create : accordianCreate });

            //var newHeader = { newHeader: $ ('h3[title="workflow_stats"]') };
            //activateEventHandler (null, newHeader);
        }

        $ (document).ready (function ()
        {
            init ();
        });
    </script>
{% endblock %}
{% block navigation_bar %}
    <li><a href="{{ url_for ('.workflow', root_wf_id = root_wf_id, wf_id = wf_id) }}">Workflow</a></li>
    <li class="active">Statistics</li>
{% endblock %}
{% block title_header %}Statistics{% endblock %}
{% block content %}
    <section class="row">
        <div id="workflow_summary_stats" class="col-xs-12"
             href="{{ url_for ('.workflow_summary_stats', root_wf_id = root_wf_id, wf_id = wf_id) }}">
        </div>
    </section>
    <section class="row">
        <div class="col-xs-12">
            <div id="statistics_container">
                <h3 href="{{ url_for ('.workflow_stats', root_wf_id = root_wf_id, wf_id = wf_id) }}" title="workflow_stats">
                    Workflow Statistics
                </h3>
                <div id="workflow_stats"></div>

                <h3 href="{{ url_for ('.job_breakdown_stats', root_wf_id = root_wf_id, wf_id = wf_id) }}"
                    title="job_breakdown_stats">Job Breakdown Statistics
                </h3>
                <div id="job_breakdown_stats"></div>

                <h3 href="{{ url_for ('.job_stats', root_wf_id = root_wf_id, wf_id = wf_id) }}" title="job_stats">Job
                    Statistics
                </h3>
                <div id="job_stats"></div>

                <h3 href="{{ url_for ('.integrity_stats', root_wf_id = root_wf_id, wf_id = wf_id) }}" title="int_stats">
                    Integrity Statistics
                </h3>
                <div id="int_stats"></div>
            </div>
        </div>
    </section>
{% endblock %}
