{% load i18n  %}

<div class="detail">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd data-display="{{ application_credential.name }}" class="word-wrap">{{ application_credential.name }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ application_credential.id }}</dd>
    <dt>{% trans "Project ID" %}</dt>
    <dd>{{ application_credential.project_id }}</dd>
    <dt>{% trans "Description" %}</dt>
    <dd>{{ application_credential.description | default:_("-") }}</dd>
    <dt>{% trans "Roles" %}</dt>
    <dd>
      <table class="table table-striped table-hover">
        <thead>
          <tr>
            <th><strong>{% trans "Name" %}</strong></th>
            <th><strong>{% trans "ID" %}</strong></th>
            <th><strong>{% trans "Domain" %}</strong></th>
          </tr>
        </thead>
        <tbody>
        {% for role in application_credential.roles %}
          <tr>
            <td class="word-wrap">{{ role.name }}</td>
            <td>{{ role.id }}</td>
            <td>{{ role.domain_id | default:_("-") }}</td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </dd>
    <dt>{% trans "Access Rules" %}</dt>
    {% if application_credential.access_rules %}
    <dd>
      <table class="table table-striped table-hover">
        <thead>
          <tr>
            <th><strong>{% trans "Service" %}</strong></th>
            <th><strong>{% trans "Method" %}</strong></th>
            <th><strong>{% trans "Path" %}</strong></th>
          </tr>
        </thead>
        <tbody>
        {% for rule in application_credential.access_rules %}
          <tr>
            <td>{{ rule.service }}</td>
            <td>{{ rule.method }}</td>
            <td>{{ rule.path }}</td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </dd>
    {% else %}
    <dd>{{ _("-")}}</dd>
    {% endif %}
    <dt>{% trans "Expires" %}</dt>
    <dd>{{ application_credential.expires_at | default:_("-") }}</dd>
    <dt>{% trans "Unrestricted" %}</dt>
    <dd>{{ application_credential.unrestricted | yesno }}</dd>
  </dl>
</div>

