{% extends "idhub/base.html" %}
{% load i18n %}

{% block content %}
<div class="row">
  <div class="col">
    <h3>
      <i class="{{ icon }}"></i>
      {{ subtitle }}
    </h3>
  </div>
  {% if object.status == 2 %}
    {% if object.eidas1_did and admin_validated %}
    <div class="col text-end">
      <a class="btn btn-green-user me-2" href="{{ url_ca }}">{% trans 'Download as PDF (Catalan)' %}</a>
    </div>
    <div class="col text-end">
      <a class="btn btn-green-user me-2" href="{{ url_es }}">{% trans 'Download as PDF (Spanish)' %}</a>
    </div>
    {% endif %}
  {% endif %}
  <div class="col text-end">
    {% if object.status == 2 %}
      {% if object.eidas1_did and admin_validated %}
      {% endif %}
      <a class="btn btn-green-user" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Download as JSON' %}</a>
    {% endif %}
    {% if object.status == 1 %}
      <a class="btn btn-green-user" href="{% url 'idhub:user_credentials_request' %}">{% trans 'Request credential' %}</a>
    {% endif %}
  </div>
</div>
<div class="row">
  <div class="col-3">
  </div>
  <div class="col">
    {% for k, v in object.get_datas %}
    <div class="row mt-3">
      <div class="col-3 text-end">
      <strong>{{ k|capfirst }}:</strong>
      </div>
      <div class="col bg-light text-secondary">
        {{ v }}
      </div>
    </div>
    {% endfor %}
    <div class="row mt-3">
      <div class="col-3 text-end">
      <strong>{% trans 'Issuance date' %}:</strong>
      </div>
      <div class="col bg-light text-secondary">
        {{ object.issued_on|default_if_none:"" }}
      </div>
    </div>
    <div class="row mt-3">
      <div class="col-3 text-end">
      <strong>{% trans 'Status' %}:</strong>
      </div>
      <div class="col bg-light text-secondary">
        {{ object.get_status }}
      </div>
    </div>
  </div>
</div>
</div>
{% endblock %}
