{% 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 witness_role %}
            {% 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 subject_role and not presence.role is witness_role %}
            {% 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 files = event | associated_files %}
        {% include 'media.html.j2' %}
    {% endwith %}
{% endblock %}