{% load i18n fobi_tags %}

{% comment %}
<div class="alert-box secondary alert-box-larger">
    {% blocktrans %}Fields marked with <span class="required-field">*</span> are required{% endblocktrans %}
</div>
{% endcomment %}

{% for field in form %}
{% get_form_field_type field as form_field_type %}
<div class="form-row{% if form_field_type.is_radio %} radiolist{% endif %}{% if form.fields|length_is:'1' and form.errors %} errors{% endif %}{% for field in form %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
    {% if form.fields|length_is:'1' %}{{ form.errors }}{% endif %}
    
    <div{% if not form.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
        {% if not form.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
        {% if form_field_type.is_checkbox %}
            {{ field }}{{ field.label_tag }}
        {% else %}
            {{ field.label_tag }}
            {% if field.is_readonly %}
                <p>{{ field.contents|linebreaksbr }}</p>
            {% else %}
                {{ field }}
            {% endif %}
        {% endif %}
        {% if field.field.help_text %}
            <p class="help">{{ field.field.help_text|safe }}</p>
        {% endif %}
    </div>

</div>
{% endfor %}
