{% extends "sentry/bases/modal.html" %}

{% load crispy_forms_tags %}
{% load i18n %}
{% load sentry_helpers %}

{% block title %}{% trans "Member Details" %} | {{ block.super }}{% endblock %}

{% block inner %}
  <div class="page-header">
    <div class="pull-right">
      <a href="{% url 'sentry-organization-members' organization.slug %}">Back to Organization Members</a>
    </div>
    <h2>
      Member Details
      <small>{{ member.get_display_name }}</small>
    </h2>
  </div>

  <fieldset>
    <div class="control-group">
      <label>{% trans "Email" %}</label>
      <div class="controls">
        <a href="mailto:{{ member.get_email }}">{{ member.get_email }}</a>
      </div>
    </div>

    <div class="control-group">
      <label>{% trans "Status" %}</label>
      <div class="controls">
        {% if member.is_pending %}
          Invited
        {% else %}
          Active
        {% endif %}
      </div>
    </div>

    <div class="control-group">
      <label>{% trans "Membership Type" %}</label>
      <div class="controls">
        {{ member.get_type_display }}
      </div>
    </div>
  </fieldset>

  <fieldset>
    <h2>{% trans "Teams" %}</h2>

    <div class="control-group">
      <div class="controls">
        <label class="checkbox">
          <input type="checkbox" class="checkboxinput"
                 disabled="disabled"{% if member.has_global_access %} checked="checked'{% endif %}">
          This member should have access to all teams within the organization.
        </label>
      </div>
    </div>

    <fieldset class="team-choices">
      {% for team in all_teams %}
        <div class="control-group">
          <div class="controls">
            <label class="checkbox">
              <input type="checkbox" disabled="disabled"
                     class="checkboxinput"{% if team in enabled_teams %} checked="checked"{% endif %}>
                {{ team.name }}
              </label>
          </div>
        </div>
      {% endfor %}
    </fieldset>
  </fieldset>

  <div class="form-actions">
    <div class="alert alert-block alert-info">
      {% if member.user == user %}
        <p>You cannot make changes to your own membership.</p>
      {% else %}
        <p>You cannot make changes to this member as they have more access than you.</p>
      {% endif %}
    </div>
  </div>

{% endblock %}
