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

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

{% block title %}{% trans "Add Member to Organization" %} | {{ block.super }}{% endblock %}
{% block sub-header %}{% 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">{% trans "Add Member to Organization" %}</h2>

  {% block new_member_form_template_hook %}{% endblock %}

  {% if is_invite %}
    <p>{% trans "Invite a member to join this organization via their email address. If they do not already have an account, they will first be asked to create one." %}</p>
  {% else %}
    <p>{% trans "You may add a user by their username if they already have an account." %}</p>
  {% endif %}

  <form class="form-stacked" action="" method="post">
    {% csrf_token %}

    {{ form|as_crispy_errors }}

    {% if is_invite %}
      {{ form.email|as_crispy_field }}
    {% else %}
      {{ form.user|as_crispy_field }}
    {% endif %}

    {% include "sentry/partial/members/_roles.html" %}
    {% include "sentry/partial/members/_teams.html" %}

    <div class="form-actions">
      <button type="submit" class="btn btn-primary">{% trans "Add Member" %}</button>
    </div>
  </form>
{% endblock %}
