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

{% set included = True %}

{% block content %}


<form data-name="{{tpl.TPLID}}">
  
  <section data-template="{{tpl.TPLID}}">
    <h4>{{tpl.TPLID}}</h4>
    
  {% for subsystem in tpl %}
    
    {% if (not subsystem=="TPLID") and (not subsystem=="TPLName") %}
    
    <fieldset data-subsystem="{{subsystem}}">
    
    <legend>
      {{subsystem}}
    </legend>
    
    {% for k,v in tpl[subsystem].items() %}
    <div class="row mb-2">
      <label class="col-2 col-form-label" for="{{tpl.TPLID}}-{{k}}">{{k}}</label>
      <div class="col">
        <input class="form-control col"
               id="{{tpl.TPLID}}-{{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 %}
    
    {% endif %}
        
  </fieldset>
  {% endfor %}
  
</section>
  
</form>


{% endblock content %}
