{% extends "passerelle/manage.html" %}
{% load i18n gadjo %}

{% block breadcrumb %}
  {{ block.super }}
  <a href="{{ toulousesmartresource.get_absolute_url }}">{{ toulousesmartresource.title }}</a>
  <a href="#">{% trans 'Intervention types' %}</a>
{% endblock %}

{% block appbar %}
  <h2>{% trans 'Intervention types' %}</h2>
  <span class="actions">
    <a href="{% url "toulouse-smart-type-intervention-as-blocks" slug=toulousesmartresource.slug %}">{% trans "Export to blocks" %}</a>
  </span>
{% endblock %}

{% block content %}
  <table class="main">
    <thead>
      <tr>
        <th>Nom du type d'intervention</th>
        <th>Nom</th>
        <th>Type</th>
        <th>Requis</th>
        <th>Valeur par défaut</th>
      </tr>
    </thead>
    <tbody>
      {% for intervention_type in toulousesmartresource.get_intervention_types %}
        <tr><td colspan="4">{{ intervention_type.order }} - {{ intervention_type.name }}</td></tr>
        {% for property in intervention_type.properties %}
          <tr>
            <td></td>
            <td>{{ property.name }}</td>
            <td>{{ property.type }}{% if property.type == 'item' %} ({% for value in property.restrictedValues %}{% if not forloop.first %}, {% endif %}«{{ value }}»{% endfor %}){% endif %}</td>
            <td title="{{ property.required|lower }}">{{ property.required|yesno:"✔,✘" }}</td>
            <td>{{ property.defaultValue }}</td>
          </tr>
        {% endfor %}
      {% endfor %}
    </tbody>
  </table>

  <!--
{{ toulousesmartresource.get_intervention_types|pprint }}
  -->

{% endblock %}
