<commit_before>{% extends "hqadmin/bootstrap2/faceted_report.html" %}
{% load hq_shared_tags %}
{% load hqstyle_tags %}
{% load i18n %}

{% block js %}{{ block.super }}
    <link href="{% static 'hqwebapp/js/lib/nvd3/nv.d3.css' %}" rel="stylesheet">
    <script src="{% static 'hqwebapp/js/lib/nvd3/lib/d3.v2.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/nvd3/lib/fisheye.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/nvd3/nv.d3.min.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/history-1.7.1.js' %}"></script>
{% endblock %}

{% block js-inline %} {{ block.super }}
    <script src="{% static 'hqwebapp/js/hash-tab.js' %}"></script>
    <script src='{% static 'hqadmin/js/nvd3_charts_helper.js' %}' type='text/javascript'></script>
    <script src='{% static 'hqadmin/js/visualizations.js' %}' type='text/javascript'></script>
    <script type="text/javascript">
        var visualizations = {
            forms: {name: "forms", xaxis_label: "# form submissions", viz: null},
            cases: {name: "cases", xaxis_label: "# case creations", viz: null},
            users: {name: "users", xaxis_label: "# mobile workers created", viz: null},
            domains: {name: "domains", xaxis_label: "# domains created", viz: null }
        };

        function parse_url_params() {
            var result = {}, queryString = location.search.slice(1),
                re = /([^&=]+)=([^&]*)/g, m;

            while (m = re.exec(queryString)) {
                var param = decodeURIComponent(m[1]), val = decodeURIComponent(m[2]);
                if (result.hasOwnProperty(param)) {
                    result[param].push.apply(result[param], [val]);
                } else {
                    result[param] = [val];
                }
            }

            return result;
        }
        var url_params = parse_url_params();

        for (var key in visualizations) {
            if (visualizations.hasOwnProperty(key)) {
                visualizations[key].viz = new HQVisualizations({
                    chart_name: key,
                    histogram_type: key,
                    xaxis_label: visualizations[key].xaxis_label,
                    ajax_url: "{% url "admin_stats_data" %}",
                    data: url_params,
                    interval: "{{ interval }}"
                });
                visualizations[key].viz.init();
            }
        }

        $(function() {
            $("#all-charts-filter").on("submit", function() {
                var $this = $(this);
                var startdate = $this.find('[name="startdate"]').val();
                var enddate = $this.find('[name="enddate"]').val();
                var interval = $this.find('[name="interval"]').val();

                $('.startdate-input').val(startdate);
                $('.enddate-input').val(enddate);
                $('.interval-input').val(interval);

                $('.reload-graph-form').submit();

                return false;
            });
        });

    </script>
{% endblock %}
{% block main_column %}{{ block.super }}
    <hr />
    <form id="all-charts-filter" style="margin: 0;" class="form-inline">
        <span>
            <h4 style="display: inline-block;">{% trans "Filters for All Charts: " %}</h4>
            <label for="all-charts-interval" class="sub-label">{% trans 'Interval' %}</label>
            <select id="all-charts-interval" name="interval" class="input-small">
                <option {% if interval == 'day' %}selected {% endif %}value="day">{% trans 'Day' %}</option>
                <option {% if interval == 'week' %}selected {% endif %}value="week">{% trans 'Week' %}</option>
                <option {% if interval == 'month' %}selected {% endif %}value="month">{% trans 'Month' %}</option>
                <option {% if interval == 'year' %}selected {% endif %}value="year">{% trans 'Year' %}</option>
            </select>
            <label for="all-charts-startdate" class="sub-label">{% trans 'From' %}</label>
            <input type="text" id="all-charts-startdate" name="startdate" value="{{ startdate }}" class="date-picker input-small">
            <label for="all-charts-enddate" class="sub-label">{% trans 'To' %}</label>
            <input type="text" id="all-charts-enddate" name="enddate" value="{{ enddate }}" class="date-picker input-small">
            <button type="submit" class="btn btn-info">{% trans "Apply to All Charts" %}</button>
        </span>
    </form>

    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Project Spaces" %}</h2>
        </div>
        <div class="panel-body">
        {% include "hqadmin/bootstrap3/partials/visualizations.html" with chart_name="domains" date_field_opts=domain_datefields %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Forms" %}</h2>
        </div>
        <div class="panel-body">
        {% include "hqadmin/bootstrap3/partials/visualizations.html" with chart_name="forms" %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Cases" %}</h2>
        </div>
        <div class="panel-body">
        {% include "hqadmin/bootstrap3/partials/visualizations.html" with chart_name="cases" %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Users" %}</h2>
        </div>
        <div class="panel-body"><commit_msg>update domain faceted report styling<commit_after>{% extends "hqadmin/bootstrap3/faceted_report.html" %}
{% load hq_shared_tags %}
{% load hqstyle_tags %}
{% load compress %}
{% load i18n %}

{% block stylesheets %}{{ block.super }}
<style type="text/css">
    .chart-tab-container {
        position: relative;
    }
    .panel-chart-heading {
        padding: 20px 15px;
    }
    .reload-graph-form {
        top: -59px;
        position: absolute;
        right: 0px;
    }
    .chart-tab-container {
        height: 360px;
    }
</style>
{% endblock %}

{% block js %}{{ block.super }}
    <script src="{% new_static 'hqwebapp/js/lib/history-1.7.1.js' %}"></script>
{% endblock %}

{% block js-inline %} {{ block.super }}
    <script src="{% new_static 'hqwebapp/js/hash-tab.js' %}"></script>
    <script src='{% new_static 'hqadmin/js/nvd3_charts_helper.js' %}' type='text/javascript'></script>
    <script src='{% new_static 'hqadmin/js/visualizations.js' %}' type='text/javascript'></script>
    <script type="text/javascript">
        var visualizations = {
            forms: {name: "forms", xaxis_label: "# form submissions", viz: null},
            cases: {name: "cases", xaxis_label: "# case creations", viz: null},
            users: {name: "users", xaxis_label: "# mobile workers created", viz: null},
            domains: {name: "domains", xaxis_label: "# domains created", viz: null }
        };

        function parse_url_params() {
            var result = {}, queryString = location.search.slice(1),
                re = /([^&=]+)=([^&]*)/g, m;

            while (m = re.exec(queryString)) {
                var param = decodeURIComponent(m[1]), val = decodeURIComponent(m[2]);
                if (result.hasOwnProperty(param)) {
                    result[param].push.apply(result[param], [val]);
                } else {
                    result[param] = [val];
                }
            }

            return result;
        }
        var url_params = parse_url_params();

        for (var key in visualizations) {
            if (visualizations.hasOwnProperty(key)) {
                visualizations[key].viz = new HQVisualizations({
                    chart_name: key,
                    histogram_type: key,
                    xaxis_label: visualizations[key].xaxis_label,
                    ajax_url: "{% url "admin_stats_data" %}",
                    data: url_params,
                    interval: "{{ interval }}"
                });
                visualizations[key].viz.init();
            }
        }

        $(function() {
            $("#all-charts-filter").on("submit", function() {
                var $this = $(this);
                var startdate = $this.find('[name="startdate"]').val();
                var enddate = $this.find('[name="enddate"]').val();
                var interval = $this.find('[name="interval"]').val();

                $('.startdate-input').val(startdate);
                $('.enddate-input').val(enddate);
                $('.interval-input').val(interval);

                $('.reload-graph-form').submit();

                return false;
            });
        });

    </script>
{% endblock %}

{% block page_content %}{{ block.super }}
    <div class="well">
        <form id="all-charts-filter" style="margin: 0;" class="form-inline">
            <h3>{% trans "Filters for All Charts Below" %}</h3>
            <label for="all-charts-interval" class="sub-label">{% trans 'Interval' %}</label>
            <select id="all-charts-interval" name="interval" class="form-control">
                <option {% if interval == 'day' %}selected {% endif %}value="day">{% trans 'Day' %}</option>
                <option {% if interval == 'week' %}selected {% endif %}value="week">{% trans 'Week' %}</option>
                <option {% if interval == 'month' %}selected {% endif %}value="month">{% trans 'Month' %}</option>
                <option {% if interval == 'year' %}selected {% endif %}value="year">{% trans 'Year' %}</option>
            </select>
            <label for="all-charts-startdate" class="sub-label">{% trans 'From' %}</label>
            <input type="text" id="all-charts-startdate" name="startdate" value="{{ startdate }}" class="date-picker form-control">
            <label for="all-charts-enddate" class="sub-label">{% trans 'To' %}</label>
            <input type="text" id="all-charts-enddate" name="enddate" value="{{ enddate }}" class="date-picker form-control">
            <button type="submit" class="btn btn-info">{% trans "Apply to All Charts" %}</button>

        </form>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Project Spaces" %}</h2>
        </div>
        <div class="panel-body">
        {% include "hqadmin/bootstrap3/partials/visualizations.html" with chart_name="domains" date_field_opts=domain_datefields %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Forms" %}</h2>
        </div>
        <div class="panel-body">
        {% include "hqadmin/bootstrap3/partials/visualizations.html" with chart_name="forms" %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Cases" %}</h2>
        </div>
        <div class="panel-body">
        {% include "hqadmin/bootstrap3/partials/visualizations.html" with chart_name="cases" %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading panel-chart-heading">
            <h2 class="panel-title">{% trans "Users" %}</h2>
        </div>
        <div class="panel-body">
{'fraction_non_alphanumeric': 0.18175517629732305, 'fraction_numerical': 0.005717751017932946, 'mean_word_length': 2.239057239057239, 'pattern_counts': {'":': 0, '<': 145, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6271655', 'n_tokens_mistral': 3655, 'n_tokens_neox': 3394, 'n_words': 718}