{% macro form_input_field(field, errors=[]) %}
<div class="control block">
    {{ field.label(class='label')}}
    {{ field(class='input' + (' is-danger' if errors else ' is_success'), type="text") }}
    {% for error in errors %}
      <p class="help is-danger">{{ error }}</p>
    {% endfor %}
</div>
{% endmacro %}


{% macro form_bool_field(field) %}
<div class="control block">
    {{ field(class='checkbox', type="checkbox", style="display: inline") }}
    {{ field.label(class='label')}}
    {% for error in errors %}
      <p class="help is-danger">{{ error }}</p>
    {% endfor %}
</div>
{% endmacro %}

{% macro form_datetime_field(field, errors=[]) %}
<div class="control block">
    {{ field.label(class='label')}}
    {{ field(id='butterbox_date', class='input', type="text") }}
    {% for error in errors %}
      <p class="help is-danger">{{ error }}</p>
    {% endfor %}
</div>
{% endmacro %}

{% macro form_password_field(field, errors=[]) %}
<div class="control block">
    {{ field.label(class='label')}}
    {{ field(class='input', type="password") }}
    {% for error in errors %}
      <p class="help is-danger">{{ error }}</p>
    {% endfor %}
</div>
{% endmacro %}

{% macro field_errors(errors) %}
    {% for error in errors %}
      <p class="help is-danger">{{ error }}</p>
    {% endfor %}
{% endmacro %}

{% macro form_radio_field(field, setting, errors=[]) %}
<div class="control block">
<label class="label">{{ field.label }} {{setting}}</label>
 {% for subfield in field %}
    <label class="radio">
       {% if setting == subfield._value() %}
         <input id='{{ subfield.id }}' type="radio" name='{{ subfield.name }}' value='{{ subfield._value() }}'/> # to debug. checked here is not rendered as a word, but rendered as 'checked="", so we can't use the macro yet'
         {% else %}
         <input id='{{ subfield.id }}' type='radio' name='{{ subfield.name }}' value='{{ subfield._value() }}'/>
         {% endif %}
        {{ subfield.label }}
    </label>
{% endfor %}
    {% for error in errors %}
      <p class="help is-danger">{{ error }}</p>
    {% endfor %}
</div>{% endmacro %}
