{# TODO: This file is just kinda weird to format. Probably can be approved. #}
{% load adminlte_filters %}


{% for field in hidden_fields %}
  {{ field }}
{% endfor %}


{% for field in visible_fields %}
  <div class="form-group {% if field.errors %}has-error{% endif %}">

    {% if field|fieldtype == "CheckboxInput" %}
      <div class="col-sm-offset-2 col-sm-10">
        {% include "adminlte2/partials/_form/_checkbox.html" %}
      </div>

    {% elif field|fieldtype == "Select" or field|fieldtype == "NullBooleanSelect" or field|fieldtype == "SelectMultiple" %}

      {% if labels %}
        <label
          for="{{ field.id_for_label }}"
          class="col-sm-2 control-label {% if bold_required and field.field.required %}required{% endif %}"
        >
          {{ field.label }}:{% if asterisk_required and field.field.required %}*{% endif %}
        </label>
      {% endif %}
      <div class="col-sm-10 {% if not labels %} col-sm-offset-2 {% endif %}">
        {% include "adminlte2/partials/_form/_select.html" %}
      </div>

    {% elif field|fieldtype == "RadioSelect" %}

      {% if labels %}
        <label
          for="{{ field.id_for_label }}"
          class="col-sm-2 control-label {% if bold_required and field.field.required %}required{% endif %}"
        >
          {{ field.label }}:{% if asterisk_required and field.field.required %}*{% endif %}
        </label>
      {% endif %}
      <div class="col-sm-10 {% if not labels %} col-sm-offset-2 {% endif %}">
        {% include "adminlte2/partials/_form/_radio.html" %}
      </div>

    {% elif field|fieldtype == "CheckboxSelectMultiple" %}

      {% if labels %}
        <label
          for="{{ field.id_for_label }}"
          class="col-sm-2 control-label {% if bold_required and field.field.required %}required{% endif %}"
        >
          {{ field.label }}:{% if asterisk_required and field.field.required %}*{% endif %}
        </label>
      {% endif %}
      <div class="col-sm-10 {% if not labels %} col-sm-offset-2 {% endif %}">
        {% include "adminlte2/partials/_form/_checkbox_select.html" %}
      </div>

    {% elif field|fieldtype == "ClearableFileInput" %}

      {% if labels %}
        <label
          for="{{ field.id_for_label }}"
          class="col-sm-2 control-label {% if bold_required and field.field.required %}required{% endif %}"
        >
          {{ field.label }}:{% if asterisk_required and field.field.required %}*{% endif %}
        </label>
      {% endif %}
      <div class="col-sm-10 {% if not labels %} col-sm-offset-2{% endif %}">
        {% include "adminlte2/partials/_form/_file.html" %}
      </div>

    {% else %}

      {% if labels %}
        <label
          for="{{ field.id_for_label }}"
          class="col-sm-2 control-label {% if bold_required and field.field.required %}required{% endif %}"
        >
          {{ field.label }}:{% if asterisk_required and field.field.required %}*{% endif %}
        </label>
      {% endif %}
      <div class="col-sm-10 {% if not labels %} col-sm-offset-2 {% endif %}">
        {% include "adminlte2/partials/_form/_text.html" %}
      </div>

    {% endif %}
  </div>
{% endfor %}


{{ media|default:"" }}
