{% from 'message_box.html' import message_box %}

{% macro render_regform_info(regform) %}
    <div class="infogrid condensed">
        {% if regform.is_scheduled and (not regform.has_started or regform.end_dt) %}
            <div class="infoline date">
                <i class="icon icon-time"></i>
                <div class="text">
                    <div>
                        {% if regform.is_open %}
                            <span class="label">
                                {% trans %}Registration is open{% endtrans %}
                            </span>
                        {% else %}
                            <span class="label">
                                {% if regform.has_ended %}
                                    {% trans %}Opened{% endtrans %}
                                {% else %}
                                    {% trans %}Opens{% endtrans %}
                                {% endif %}
                            </span>
                            <span class="datetime">
                                {{ regform.start_dt|format_date(timezone=regform.event.tzinfo) }}
                            </span>
                        {% endif %}
                    </div>
                    <div>
                        <span class="label">
                            {% if regform.is_open %}
                                {% trans %}Deadline{% endtrans %}
                            {% elif regform.has_ended %}
                                {% trans %}Closed{% endtrans %}
                            {% else %}
                                {% trans %}Closes{% endtrans %}
                            {% endif %}
                        </span>
                        <span class="datetime">
                            {% if regform.end_dt %}
                                {{ regform.end_dt|format_date(timezone=regform.event.tzinfo) }}
                            {% else %}
                                <em>{% trans %}Not specified{% endtrans %}</em>
                            {% endif %}
                        </span>
                    </div>
                </div>
            </div>
        {% endif %}
        {% if regform.base_price -%}
            <div class="infoline">
                <i class="icon icon-coins"></i>
                <div class="text">
                    <div class="label">
                        {% trans %}Registration fee{% endtrans %}
                    </div>
                    <div>{{ regform.render_base_price() }}</div>
                </div>
            </div>
        {%- endif %}
        {% if regform.contact_info %}
            <div class="infoline">
                <i class="icon icon-phone"></i>
                <div class="text">
                    <div class="label">
                        {% trans %}Contact info{% endtrans %}
                    </div>
                    <div>{{ regform.contact_info }}</div>
                </div>
            </div>
        {% endif %}
    </div>

    {% if regform.introduction %}
        {{ message_box('info', regform.introduction | markdown) }}
    {% endif %}
{% endmacro %}
