{% if not included %}
{% extends 'index.html' %}
{% endif %}

{% set included = True %}

{% block content %}

<form>
  
  <h4>{{tpl.name}}</h4>
  
  {% for d in tpl.content %}
  <fieldset data-template="{{d.template}}",
            data-instance="{{loop.index}}">
    
    <legend>
      {{d.template}}
    </legend>
    
    {% for k,v in d.params.items() %}
    <div class="row mb-2">
      <label class="col-2 col-form-label"
             for="{{d.template}}{{loop.index}}-{{k}}">{{k}}</label>
      <div class="col">
        <input class="form-control col"
               id="{{d.template}}{{loop.index}}-{{k}}"
               name="{{k}}"
               data-{{k}}="{{v}}"
               value="{{v}}"
               {% if v is number %}
               type="number"
               {% elif v is boolean %}
               type="checkbox"
               {% else %}
               type="text"
               {% endif %}
               >
      </div>
    </div>
    {% endfor %}
    
  </fieldset>
  {% endfor %}
  
</form>



{% endblock content %}

