{% extends 'entity/page.html.j2' %}
{% set event = event | default(entity) %}
{% set page_title %}
    {% with embedded=True %}
        {% include 'entity/label--event.html.j2' %}
    {% endwith %}
{% endset %}
{% block page_content %}
    {% include 'entity/meta--event.html.j2' %}

    {% if event.place %}
        {% with entities=[event.place], map_hides_list = true %}
            {% include 'entity/list--place.html.j2' %}
        {% endwith %}
    {% endif %}

    {% with notes = event.notes %}
        {% include 'section-notes.html.j2' %}
    {% endwith %}

    {% set ns = namespace(witnesses=[]) %}
    {% for presence in event.presences | select('public') %}
        {% if presence.role is presence_role_plugin('witness') %}
            {% set ns.witnesses = ns.witnesses + [presence.person] %}
        {% endif %}
    {% endfor %}
    {% if ns.witnesses | length > 0 %}
        <h2>{% trans %}Witnesses{% endtrans %}</h2>
        <ul>
            {% for witness in ns.witnesses %}
                <li typeof="foaf:Person" property="rel:knowsOf">{% with person=witness %}{% include 'entity/label--person.html.j2' %}{% endwith %}</li>
            {% endfor %}
        </ul>
    {% endif %}

    {% set ns = namespace(attendees=[]) %}
    {% for presence in event.presences | select('public') %}
        {% if not presence.role is presence_role_plugin('subject') and not presence.role is presence_role_plugin('witness') %}
            {% set ns.attendees = ns.attendees + [presence.person] %}
        {% endif %}
    {% endfor %}
    {% if ns.attendees | length > 0 %}
        <h2>{% trans %}Other attendees{% endtrans %}</h2>
        <ul>
            {% for attendee in ns.attendees %}
                <li typeof="foaf:Person" property="rel:knowsOf">{% with person=attendee %}{% include 'entity/label--person.html.j2' %}{% endwith %}</li>
            {% endfor %}
        </ul>
    {% endif %}

    {% with file_references = event | associated_file_references %}
        {% include 'media.html.j2' %}
    {% endwith %}
{% endblock %}