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

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

{% block org_settings_nav %}active{% endblock %}

{% block main %}
  <h3>Organization Settings</h3>

  <div class="box">
    <div class="box-content with-padding">
      <form class="form-stacked" action="" method="post">
        {% csrf_token %}

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

        {{ form|as_crispy_errors }}

        <legend style="margin-top: 0">General</legend>

        {{ form.name|as_crispy_field }}
        {{ form.slug|as_crispy_field }}
        {{ form.early_adopter|as_crispy_field }}

        <legend>Membership</legend>

        {% if form.default_role %}
          {{ form.default_role|as_crispy_field }}
        {% endif %}
        {{ form.allow_joinleave|as_crispy_field }}

        <legend>Security &amp; Privacy</legend>

        {{ form.allow_shared_issues|as_crispy_field }}
        {{ form.enhanced_privacy|as_crispy_field }}
        {{ form.require_scrub_data|as_crispy_field }}
        {{ form.require_scrub_defaults|as_crispy_field }}
        {{ form.sensitive_fields|as_crispy_field }}
        {{ form.safe_fields|as_crispy_field }}
        {{ form.require_scrub_ip_address|as_crispy_field }}

        <fieldset class="form-actions">
          <button type="submit" class="btn btn-primary btn-lg">{% trans "Save Changes" %}</button>
        </fieldset>
      </form>
    </div>
  </div>

  {% if ACCESS.org_delete and not organization.is_default %}
  <div class="box">
    <div class="box-header">
      <h3>{% trans "Remove Organization" %}</h3>
    </div>
    <div class="box-content with-padding">
      <p>Removing this organization will delete all data including projects and their associated events.</p>

      <fieldset class="form-actions">
        <a href="{% url 'sentry-remove-organization' organization.slug %}" class="btn btn-danger">{% trans "Remove Organization" %}</a>
      </fieldset>
    </div>
  </div>
  {% endif %}
{% endblock %}
