{% load i18n %}
{% load static %}

<div class='newsfeed-posted-cont'>
	<div class='newsfeed-posted-info'>
		<div>
			<a href=''>
				<h2>Agent Connections</h2>
			</a>
		</div>
		<div>
			<h5>
				<a href="{% url 'send_invitation' %}">{% trans "Send Connection Invite" %}</a>
                or:
				<a href="{% url 'connection_response' %}?id=0">{% trans "Respond to (External) Invite" %}</a>
                or: 
                <a href="{% url 'check_messages' %}">Poll for Messages on All Connections</a>
            </h5>
		</div>
	</div>
    <div class='newsfeed-post-seperator'></div>

{% for connection in connections %}
    <div class='newsfeed-posted-top-cont'>
        <div class='newsfeed-posted-img-info'>
            <div class='newsfeed-posted-img'>
                <img src="{% static "/indy/accounticon.png" %}">
            </div>
            <div class='newsfeed-posted-info'>
        		<div>
        			<a href=''>
        				<h2>{{ connection.partner_name }}</h2>
        			</a>
        		</div>
        		<div>
        			<h5>Connection Type: {{ connection.connection_type }}</h5>
        		</div>
        		<div>
        			<h5>Connection Status: {{ connection.status }}
        		        {% if connection.status == 'Pending' %}
                            <a href="{% url 'connection_response' %}?id={{connection.id}}"}>Respond</a>
                            <a href="{% url 'connection_qr' token=connection.token %}"}>Mobile QR</a>
        		        {% endif %}
        		        {% if connection.status == 'Sent' %}
        		            <a href="{% url 'check_connection' %}?id={{connection.id}}">Check Status</a>
                            <a href="{% url 'connection_qr' token=connection.token %}"}>Mobile QR</a>
        		        {% endif %}
                        {% if connection.status == 'Active' %}
                          {% if connection.connection_type == 'Outbound' %}
                            <a href="{% url 'select_credential_offer' %}?connection_id={{connection.id}}">Send Credential</a> 
                            or 
                          {% endif %}
                          <a href="{% url 'select_proof_request' %}?connection_id={{connection.id}}">Send Proof Request</a>
                            or
                            <a href="{% url 'check_messages' %}?connection_id={{connection.id}}">Poll for Messages</a>
                        {% endif %}
        			</h5>
        		</div>
            </div>
        </div>
    </div>
    <div class='newsfeed-post-seperator'></div>
{% endfor %}
</div>
