{% extends "base.html" %}
{% import "macros.html" as utils %}

{% block title %}Bioregistry - {{ contributor.name }}{% endblock %}

{% block scripts %}
    {{ super() }}
    <script type="text/javascript">
        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        })
    </script>
{% endblock %}

{% block container %}
    <div class="card">
        <div class="card-header">
            <div class="row align-items-center">
                <div class="col-8">
                    <h5 style="margin: 0">
                        <a href="{{ url_for('ui.contributors') }}">Contributors</a>
                        <i class="fas fa-angle-right"></i> {{ contributor.name }}
                    </h5>
                </div>
                <div class="col-4 text-right">
                    <div class="dropdown">
                        <button class="btn btn-sm btn-outline-dark dropdown-toggle" type="button"
                                id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true"
                                aria-expanded="false">
                            Download
                        </button>
                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                            {% for label, key in formats %}
                                <a class="dropdown-item"
                                   href="{{ url_for('api.contributor', orcid=contributor.orcid, format=key) }}">
                                    {{ label }} <i class="fas fa-download"></i>
                                </a>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card-body">
            <dl>
                <dt>Name</dt>
                <dd>{{ contributor.name }}</dd>
                <dt>ORCID</dt>
                <dd>
                    <a href="https://orcid.org/{{ contributor.orcid }}">
                        {{ contributor.orcid }} <i class="fab fa-orcid"></i>
                    </a>
                </dd>
                {#
                {% if contributor.email %}
                    <dt>Email</dt>
                    <dd><a href="mailto:{{ contributor.email }}">{{ contributor.email }}</a></dd>
                {% endif %}
                #}
                {% if prefix_contributions %}
                    <dt>Prefixes Contributed</dt>
                    <dd>
                        <ul>
                            {% for prefix, resource in prefix_contributions %}
                                <li>
                                    <a href="{{ url_for('ui.resource', prefix=prefix) }}"><code>{{ prefix }}</code></a>
                                </li>
                            {% endfor %}
                        </ul>
                    </dd>
                {% endif %}
                {% if prefix_reviews %}
                    <dt>Prefixes Reviewed</dt>
                    <dd>
                        <ul>
                            {% for prefix, resource in prefix_reviews %}
                                <li>
                                    <a href="{{ url_for('ui.resource', prefix=prefix) }}"><code>{{ prefix }}</code></a>
                                    for
                                    <a href="{{ url_for('ui.contributor', orcid=resource.contributor.orcid) }}">{{ resource.contributor.name }}</a>
                                </li>
                            {% endfor %}
                        </ul>
                    </dd>
                {% endif %}
                {% if collections %}
                    <dt>Collections Contributed</dt>
                    <dd>
                        <ul>
                            {% for collection, resource in collections %}
                                <li>
                                    <a href="{{ url_for("ui.collection", identifier=collection) }}">
                                        {{ resource.name }}
                                    </a>
                                </li>
                            {% endfor %}
                        </ul>
                    </dd>
                {% endif %}
            </dl>
        </div>
    </div>
{% endblock %}
