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

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

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

{% block modal_header_link %}
  {% url 'sentry-organization-members' organization.slug %}
{% endblock %}

{% block modal_header_extra %}
  <span class="back-to">Back to Member List</span>
{% endblock %}

{% block main %}
  <h2 class="p-b-1 m-b-1 b-b-1">
    {{ member.get_display_name }}
    <br><small>Member Settings</small>
  </h2>

  <div class="box">
    <div class="box-header">
      <h3>{% trans "Basics" %}</h3>
    </div>

    <div class="box-content with-padding">
      <div class="row" style="margin-bottom:10px">
        <div class="col-md-6">
          <div class="control-group">
            <label>{% trans "Email" %}</label>
            <div class="controls">
              <a href="mailto:{{ member.get_email }}">{{ member.get_email }}</a>
            </div>
          </div>
        </div>
        <div class="col-md-3">
          <div class="control-group">
            <label>{% trans "Status" %}</label>
            <div class="controls">
              {% if member.is_pending %}
                Invited
              {% else %}
                Active
              {% endif %}
            </div>
          </div>
        </div>
        <div class="col-md-3">
          <div class="control-group">
            <label>{% trans "Added" %}</label>
            <div class="controls">
              {{ member.date_added|date }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="box">
    <div class="box-header">
      <h3>{% trans "Role" %}</h3>
    </div>
    <div class="box-content with-padding">
      <ul class="radio-inputs">
        {% for role in role_list %}
          <li class="radio disabled">
            <label>
              <input type="radio" name="role" value="{{ role.id }}"
                     disabled {% if role.id == member.role %} checked{% endif %} />
              {{ role.name }}
              <div class="help-block">{{ role.desc|linebreaksbr }}</div>
            </label>
          </li>
        {% endfor %}
      </ul>
    </div>
  </div>

  <div class="box">
    <div class="box-header">
      <h3>{% trans "Teams" %}</h3>
    </div>
    <div class="box-content with-padding">
      <fieldset class="team-choices row">
        {% for team in all_teams %}
          <div class="control-group col-md-4">
            <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>
    </div>
  </div>

  <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 you do not have the right permissions.</p>
      {% endif %}
    </div>
  </div>
{% endblock %}
