{% load projectroles_common_tags %}
{% load siteinfo_tags %}

{% if pl_data.stats or pl_data.error %}
  <div class="card" id="sodar-si-{{ plugin.name }}-app-stats-card">
    <div class="card-header">
      <h4>
        <i class="iconify" data-icon="{{ plugin.icon }}"></i>
        {{ plugin.title }} Statistics
      </h4>
    </div>
    <div class="card-body">
      <dl class="row">
        {% if pl_data.stats %}
          {% for stat_key, stat in pl_data.stats.items %}
            <dt class="col-md-3">{{ stat.label }}
              {% if stat.description %}
                {% get_info_link stat.description as info_link %}
                {{ info_link | safe }}
              {% endif %}
            </dt>
            {% if stat.url %}
              <dd class="col-md-9"><a href="{{ stat.url }}">{{ stat.value }}</a></dd>
            {% else %}
              <dd class="{% get_info_cls stat.value %}">{% get_info_val stat.value %}</dd>
            {% endif %}
           {% endfor %}
         {% elif pl_data.error %}
           <dd class="col-md-12 text-danger">
             Unable to retrieve app statistics: {{ pl_data.error }}
           </dd>
         {% endif %}
       </dl>
    </div>
  </div>
{% endif %}
