{% macro stats_box(title='', subtitle='', label='', label_tooltip='', classes='') %}
    <div class="i-box
                {%- if classes %} {{ classes }}{% endif %}">
        {%- if title or label %}
            <div class="i-box-header">
                {% if title -%}
                    <div class="i-box-title">{{ title }}</div>
                {%- endif %}
                {% if label -%}
                    <span class="i-label right"
                          {%- if label_tooltip %} title="{{ label_tooltip }}"{% endif -%}>
                        {{- label -}}
                    </span>
                {%- endif %}
                {% if subtitle -%}
                    <br><div class="i-box-description">{{ subtitle|safe }}</div>
                {%- endif %}
            </div>
        {% endif %}
        <div class="i-box-content">{{ caller() }}</div>
    </div>
{% endmacro %}

{% macro stats_badge(label, value) %}
    <div class="i-badge i-badge-disabled">
        <div class="i-badge-content">
            {% if value is none %}
                <span class="i-badge-value">&ndash;</span>
            {% else %}
                <span class="i-badge-value" data-value="{{ value }}"></span>
            {% endif %}
            <span class="i-badge-title">{{ label}}</span>
        </div>
    </div>
{% endmacro %}


{% macro stats_badges(badges, classes='') %}
    <div class="i-badges-list-space-evenly{% if classes %} {{ classes }}{%  endif %}">
        {% for label, value in badges %}
            {{ stats_badge(label, value) }}
        {% endfor %}
    </div>
{% endmacro %}
