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

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

{% block title %}{% trans "Team Settings" %} | {{ block.super }}{% endblock %}

{% block team_settings_nav %} class="active"{% endblock %}

{% block inner %}
  <div class="page-header">
    <div class="pull-right">
      <a href="{% url 'sentry-organization-home' organization.slug %}">Back to Organization Home</a>
    </div>
    <h2>
      Settings for {{ team.name }}
    </h2>
  </div>

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

    {% if form.errors %}
      <div class="alert alert-error">{% trans "Please correct the errors below." %}</div>
    {% endif %}

    {{ form|as_crispy_errors }}

    <fieldset>
      {% for field in form %}
        {% if field.name != 'owner' %}
          {{ field|as_crispy_field }}
        {% endif %}
      {% endfor %}
    </fieldset>

    {% if form.owner %}
      <fieldset>
        <p>If you wish to transfer ownership of this project, enter the new owner's username:</p>
          {{ form.owner|as_crispy_field }}
      </fieldset>
    {% endif %}

    <fieldset class="form-actions">
      <button type="submit" class="btn btn-primary">{% trans "Save Changes" %}</button>
      {% if can_remove_team %}
          <a href="{% url 'sentry-remove-team' organization.slug team.slug %}" class="btn btn-danger">{% trans "Remove Team" %}</a>
      {% endif %}
    </fieldset>
  </form>

  <script type="text/javascript">
  new app.TeamDetailsPage();
  </script>

{% endblock %}
