{% extends "base.html" %}

{% block title %}{{ _('Subscriber Details') }} - {{ email }}{% endblock %}

{% block content %}
<h2>{{ _('Subscriber Details') }}</h2>

<p>{{ _('Email Address') }}: <strong>{{ email }}</strong></p>

{%- include "flash.html" %} {# Show flash messages #}

{%- from "macros.html" import subscriber_list_buttons %}
{{ subscriber_list_buttons(email) }}

<h3>{{ _('Subscribed to Lists') }}</h3>
{% if subscriber_lists %}
<table class="striped">
    <thead>
        <tr>
            <th>{{ _('List Name') }}</th>
            <th>{{ _('Subscriber Name') }}</th>
            <th>{{ _('Comment') }}</th>
            <th>{{ _('Actions') }}</th>
        </tr>
    </thead>
    <tbody>
        {% for item in subscriber_lists %}
        <tr>
            <td>
                <a href="{{ url_for('lists.subscribers_manage', list_id=item.list.id) }}">{{ item.list.display }}</a>
                {%- if item.list.deleted %} ({{ _('Deactivated') }}){% endif %}
            </td>
            <td>{{ item.subscriber.name or "" }}</td>
            <td>{{ item.subscriber.comment or "" }}</td>
            <td>
                <a href="{{ url_for('lists.subscriber_edit', list_id=item.list.id, subscriber_email=item.subscriber.email) }}" role="button">{{ _('Edit') }}</a>
                <a href="{{ url_for('lists.subscriber_delete', list_id=item.list.id, subscriber_email=item.subscriber.email) }}" role="button" class="danger" onclick="return confirm('{{ _('Are you sure you want to delete subscriber') }} {{ item.subscriber.name or email }} {{ _('from') }} {{ item.list.display }} <{{ item.list.address }}>?')">{{ _('Remove from this List') }}</a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% else %}
<p><em>{{ _('Not subscribed to any lists.') }}</em></p>
{% endif %}
{% endblock %}
