{% extends "horizon/common/_modal.html" %}
{% load i18n %}

{% block modal-body %}
  <form>
    {% if openrc_creds %}
      <div class="{% if ec2_creds %}left{% endif %}">
        <div class="form-group">
          <label for="openrc-user">{% trans "User Name" %}</label>
          <input type="text" class="form-control" id="openrc-user" readonly value="{{ openrc_creds.user.username }}">
        </div>
        <div class="form-group">
          <label for="openrc-user">{% trans "User ID" %}</label>
          <input type="text" class="form-control" id="openrc-userid" readonly value="{{ openrc_creds.user.id }}">
        </div>
        {% if "user_domain_name" in openrc_creds %}
        <div class="form-group">
          <label for="openrc-domain">{% trans "Domain Name" %}</label>
          <input type="text" class="form-control" id="openrc-domain" readonly value="{{ openrc_creds.user_domain_name }}">
        </div>
        {% endif %}
        <div class="form-group">
          <label for="openrc-project-name">{% trans "Project Name" %}</label>
          <input type="text" class="form-control" id="openrc-project-name" readonly value="{{ openrc_creds.tenant_name }}">
        </div>
        <div class="form-group">
          <label for="openrc-project-id">{% trans "Project ID" %}</label>
          <input type="text" class="form-control" id="openrc-project-id" readonly value="{{ openrc_creds.tenant_id }}">
        </div>
        <div class="form-group">
          <label for="openrc-auth">{% trans "Authentication URL" %}</label>
          <input type="text" id="openrc-auth" class="form-control" readonly value="{{ openrc_creds.auth_url }}">
        </div>
      </div>
    {% endif %}
    {% if ec2_creds %}
      <div class="{% if openrc_creds %}right{% endif %}">
        <div class="form-group">
          <label for="ec2-url">{% trans "EC2 URL" %}</label>
          <input type="text" id="ec2-url" class="form-control" readonly value="{{ ec2_creds.ec2_endpoint }}">
        </div>
        <div class="form-group">
          <label for="s3-url">{% trans "S3 URL" %}</label>
          <input type="text" id="s3-url" class="form-control" readonly value="{{ ec2_creds.s3_endpoint }}">
        </div>
        {% if ec2_creds.ec2_access_key %}
          <div class="form-group">
            <label for="ec2-access">{% trans "EC2 Access Key" %}</label>
            <input type="text" id="ec2-access" class="form-control" readonly value="{{ ec2_creds.ec2_access_key }}">
          </div>
        {%  endif %}
        {% if ec2_creds.ec2_secret_key %}
          <div class="form-group">
            <label for="ec2-secret">{% trans "EC2 Secret Key" %}</label>
            <input type="password" id="ec2-secret" class="form-control" readonly value="{{ ec2_creds.ec2_secret_key }}">
          </div>
        {% endif %}
      </div>
    {% endif %}
  </form>
{% endblock %}

{% block modal-footer %}
  <a href="{% url 'horizon:project:api_access:index' %}" class="btn btn-default cancel">
    {% trans "Close" %}
  </a>
{% endblock %}
