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

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

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

{% block org_apikeys_nav %}active{% endblock %}

{% block main %}
  <h3>{% trans "API Key Settings" %}</h3>

  <hr>
  <form class="form-stacked api-key-detail" 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 }}

    <fieldset>
      <div class="row">
        <div class="col-md-6">
          <div class="control-group">
            {{ form.label|as_crispy_field }}
          </div>
        </div>
        <div class="col-md-6">
          <div class="control-group">
            <label for="api-key">{% trans "Key" %}</label>
            <div class="form-control disabled auto-select">{{ key.key }}</div>
          </div>
        </div>
      </div>

      <div class="row scopes">
        <div class="col-md-12">
        {{ form.scopes|as_crispy_field }}
        </div>
      </div>

      {{ form.allowed_origins|as_crispy_field }}

    </fieldset>

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