{% load definition_form_tags %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ form_definition.name }}</title>
</head>
<body>
<h1>{{ form_definition.name }}</h1>

{% block submission_source %}
    {% if form_submission.source %}
        <fieldset>
            <legend>{{ _('Source') }}</legend>
            <div class="form-row">
                <div class="field-box">
                    <label>{{ _('Source') }}</label>
                    <p>{{ form_submission.source }}</p>
                </div>
                <div class="form-row">
                    <div class="field-box">
                        <label>{{ _('Source page') }}</label>:
                        <a href="{{ form_submission.source_url }}">{{ form_submission.source_url }}</a>
                    </div>
                </div>
            </div>
        </fieldset>
    {% endif %}
{% endblock %}

{% block submission_pages %}
    {% definition_pages form_definition as pages %}

    {% for page in pages %}
        {% if page.name %}
            <h2>{{ page.name }}</h2>
        {% endif %}
        {% for fieldset in page.fieldsets %}
            <fieldset>
                {% if fieldset.legend %}
                    <legend>{{ fieldset.legend }}</legend>
                {% endif %}
                {% for row in fieldset.rows %}
                    <div class="form-row">
                        {% for field in row.fields %}
                            <div class="field-box">
                                <label>{{ field.label }}</label>
                                {% field_value field.name form_submission.submission as value %}
                                <p class="{{ field.type|lower }}">
                                    {% if field.is_boolean_valued %}
                                        {{ value|yesno }}
                                    {% elif field.is_multi_valued %}
                                        {# Translators: Default display value for an empty list #}
                                        {{ value|join:', '|default:_('&lt;none&gt;') }}
                                    {% else %}
                                        {# Translators: Default display value for an empty value #}
                                        {{ value|default:_('&lt;empty&gt;') }}
                                    {% endif %}
                                </p>
                            </div>
                        {% endfor %}
                    </div>
                {% endfor %}
            </fieldset>
        {% endfor %}
    {% endfor %}
{% endblock %}

</body>
</html>
