{% extends "admin/header.html" %}

{% load i18n %}
{% load admin_tags %}
{% load lib_tags %}

{% block leftcol %}
  <ul class="nav nav-sidebar">
    {% identities_menu user "identities" False %}
  </ul>

  {% get_extra_admin_content user "leftcol" selection %}
{% endblock %}

{% block apparea %}
  <h2>{{ object }}{% if not object.is_active %} <small>{% trans "(disabled)" %}</small>{% endif %}</h2>
  <hr>
  <div class="row">
    <div class="col-sm-6">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h3 class="panel-title">{% trans "Summary" %}</h3>
        </div>
        <table class="table">
          <tr>
            <th>{% trans "Full name" %}</th><td>{{ object.fullname }}</td>
          </tr>
          <tr>
            <th>{% trans "Role" %}</th><td>{{ object.get_role_display }}</td>
          </tr>
          <tr>
            <th>{% trans "Created" %}</th><td>{{ object.date_joined|date:"SHORT_DATETIME_FORMAT" }}</td>
          </tr>
          <tr>
            <th>{% trans "Last login" %}</th><td>{{ object.last_login|date:"SHORT_DATETIME_FORMAT" }}</td>
          </tr>
          <tr>
            <th>{% trans "Secondary email" %}</th><td>{{ object.secondary_email|default:_("Not defined") }}</td>
          </tr>
          <tr>
            <th>{% trans "Phone number" %}</th><td>{{ object.phone_number|default:_("Not defined") }}</td>
          </tr>
          {% if object.mailbox %}
            <tr>
              <th>{% trans "Quota" %}</th>
              <td>{% include "common/progressbar.html" with id='quotabar' value=object.mailbox.get_quota_in_percent %}</td>
            </tr>
          {% endif %}
        </table>
      </div>

      {% if domains %}
      <div class="panel panel-info">
        <div class="panel-heading">
          <h3 class="panel-title">{% trans "Administered domains" %}</h3>
        </div>
        <table class="table">
          {% for domain in domains %}
            <tr><td>{{ domain }}</td></tr>
          {% empty %}
            <tr><td>{% trans "No domain defined." %}</td></tr>
          {% endfor %}          
        </table>
      </div>
      {% endif %}

      {% for template in templates.left %}
        {% include template %}
      {% endfor %}
    </div>
    <div class="col-sm-6">
      {% if object.mailbox %}
        <div class="panel panel-info">
          <div class="panel-heading">
            <h3 class="panel-title">{% trans "Aliases" %}</h3>
          </div>
          <table class="table">
            {% for alias in object.mailbox.alias_addresses %}
              <tr><td>{{ alias }}</td></tr>
            {% empty %}
              <tr><td>{% trans "No alias defined" %}</td></tr>
            {% endfor %}
          </table>
        </div>
        <div class="panel panel-info">
          <div class="panel-heading">
            <h3 class="panel-title">{% trans "Additional sender addresses" %}</h3>
          </div>
          <table class="table">
            {% for saddress in object.mailbox.senderaddress_set.all %}
              <tr><td>{{ saddress }}</td></tr>
            {% empty %}
              <tr><td>{% trans "No sender address defined" %}</td></tr>
            {% endfor %}
          </table>
        </div>
      {% endif %}
      {% for template in templates.right %}
        {% include template %}
      {% endfor %}
    </div>
  </div>
{% endblock %}
