{% load i18n leprikon_tags %}
<div class="box box-registration">
    <div class="box-header">
        <strong>{% if reg.canceled %}<s>{% endif %}{{ reg.activity.name }}{% if reg.canceled %}</s>{% endif %}</strong>
        <small>({% trans 'registration number' %}: {{ reg.variable_symbol }})</small>
        <a class="btn btn-primary btn-xs" href="{{ reg.get_absolute_url }}" name="{{ reg.slug }}">
            <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
            {% trans 'download' %}
        </a>
        {% if not reg.canceled and not reg.cancelation_requested %}
        <a class="btn btn-primary btn-xs"
            href="{% url_with_back 'leprikon:registration_cancel' reg.id %}"
            title="{% trans 'cancel registration' %}">
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
            {% trans 'cancel' %}
        </a>
        {% endif %}
    </div>

    <div class="box-content">
        <div class="row">
            <label class="col-sm-4">{{ reg.activity.activity_type.name | first_upper }}:</label>
            <div class="col-sm-8">
                <a href="{{ reg.activity.get_absolute_url }}">{{ reg.activity.name }}</a>
            </div>
        </div>
        {% if reg.activity_variant.name and reg.activity_variant.name != reg.activity.name %}
        <div class="row">
            <label class="col-sm-4">{% trans 'Variant' %}:</label>
            <div class="col-sm-8">{{ reg.activity_variant.name }}</div>
        </div>
        {% endif %}
        {% if reg.start_date %}
        <div class="row">
            <label class="col-sm-4">{% trans 'Event date' %}:</label>
            <div class="col-sm-8">
                {{ reg.event_date }}
            </div>
        </div>
        {% elif reg.orderableregistration %}
        <div class="row">
            <label class="col-sm-4">{% trans 'Event date' %}:</label>
            <div class="col-sm-8">
                <strong>{{ reg.orderableregistration.event_date }}</strong>
            </div>
        </div>
        {% endif %}
        <div class="row">
            <label class="col-sm-4">{% trans 'Date and time of registration' %}:</label>
            <div class="col-sm-8">
                {{ reg.created }}
            </div>
        </div>
        <div class="row">
            <label class="col-sm-4">{% trans 'Status' %}:</label>
            <div class="col-sm-8">
                {% if reg.canceled %}
                    {% if reg.approved %}
                        {% blocktrans with d=reg.canceled %}registration canceled on {{ d }}{% endblocktrans %}
                    {% else %}
                        {% blocktrans with d=reg.canceled %}registration refused on {{ d }}{% endblocktrans %}
                    {% endif %}
                {% elif reg.cancelation_requested %}
                    {% blocktrans with d=reg.cancelation_requested %}cancellation requested on {{ d }}{% endblocktrans %}
                {% elif reg.approved %}
                    {% blocktrans with d=reg.approved %}registration approved on {{ d }}{% endblocktrans %}
                {% else %}
                    {% trans 'awaiting approval' %}
                {% endif %}
            </div>
        </div>

        {% for participant in reg.all_participants %}
            <div class="row">
                <label class="col-sm-4">{% trans 'Participant' %}:</label>
                <div class="col-sm-8">
                    {{ participant.full_name }}
                </div>
            </div>
            {% if participant.parents %}
            <div class="row">
                <label class="col-sm-4">{% trans 'Parents' %}:</label>
                <div class="col-sm-8">
                    {{ participant.parents | comma_separated }}
                </div>
            </div>
            {% endif %}
            {% include 'leprikon/registration_participant_presence.html' %}
        {% endfor %}

        {% if reg.activity.registration_type_groups %}
            <div class="row">
                <label class="col-sm-4">{% trans 'Group name' %}:</label>
                <div class="col-sm-8">
                    {{ reg.group.name }}
                </div>
            </div>
            <div class="row">
                <label class="col-sm-4">{% trans 'Contact person' %}:</label>
                <div class="col-sm-8">
                    {{ reg.group.full_name }}
                </div>
            </div>
            {% if reg.activity_variant.require_group_members_list %}
            <div class="row">
                <label class="col-sm-4">{% trans 'Group members' %}:</label>
                <div class="col-sm-8">
                    {{ reg.group_members_list_html }}
                </div>
            </div>
            {% else %}
            <div class="row">
                <label class="col-sm-4">{% trans 'Participants count' %}:</label>
                <div class="col-sm-8">{{ reg.participants_count }}</div>
            </div>
            {% endif %}
        {% endif %}

        {% include 'leprikon/registration_payments.html' %}
    </div>
</div>
