{% extends "admin/base.html" %}
{% load i18n locale %}

{% block section_body %}
<div id="serverstats" class="module first" lang="{{ LANGUAGE_CODE }}">
  <div class="hd">
    <h2>{% trans "Server Statistics" %}</h2>
  </div>
  <div class="bd">
    <table>
      <tbody>
        <tr>
          <th scope="row">{% trans "Submissions" %}</th>
          <td class="stats-number">{{ server_stats.submission_count }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Pending suggestions" %}</th>
          <td class="stats-number">{{ server_stats.pending_count }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Users" %}</th>
          <td class="stats-number">{{ server_stats.user_count }}</td>
        </tr>
      </tbody>
      <tbody id="server-extra-stats"></tbody>
      <tbody>
        <tr>
          <td colspan="2">
            <a class="slide tiny" data-target="server-extra-stats">{% trans "More..." %}</a>
          </td>
        </tr>
      </tbody>
    </table>
  </div>

  <div class="hd">
    <h2>{% trans "Background Jobs" %}</h2>
  </div>
  <div class="bd">
    <table>
      <tbody>
        <tr>
          <th scope="row">{% trans "Status" %}</th>
          <td class="stats-number">
            <i class="icon-{{ rq_stats.is_running|yesno:'tick,reject' }}"></i>
            {{ rq_stats.status_msg }}
          </td>
        </tr>
        <tr>
          <th scope="row">{% trans "Pending jobs" %}</th>
          <td class="stats-number">{{ rq_stats.job_count }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Failed jobs" %}</th>
          <td class="stats-number">{{ rq_stats.failed_job_count }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

<div id="depchecks" class="module" lang="{{ LANGUAGE_CODE }}">
  <div class="hd">
    <h2>{% trans "System Checks" %}</h2>
  </div>
  <div class="bd">
    <ul>
    {% for check in checks %}
      <li>
        <i class="icon-{% if check.is_serious %}error{% else %}warning{% endif %}"></i>
        {{ check.msg }} <em>{{ check.hint }}</em>
      </li>
    {% empty %}
      <li><i class="icon-tick"></i> {% trans "No issues have been detected. All is good!" %}</li>
    {% endfor %}
    </ul>
  </div>
</div>
{% endblock %}
