{% extends "base.html" %}

{% block actions %}
  <a class="btn btn-danger" href="{% url 'trainings:training_contents' training_id=training.id %}">Retour contenu de la formation</a>
{% endblock %}

{% block subtitle %}
  Modification du graphe <span class="text-info">{{evaluation_graph_properties.name}}</span> de la formation <span class="text-info">{{training.name}}</span>
{% endblock %}

{% block head %}
  <link rel="stylesheet" href="{{ STATIC_URL }}trainings/css/django-admin-widgets.css" type="text/css" media="screen" charset="utf-8" />

  <script type="text/javascript" src="{{ STATIC_URL }}trainings/js/ui/jquery-ui.js"></script>

  <script type="text/javascript" src="{{ STATIC_URL }}trainings/js/django-admin.multiselect.js"></script>
  <script type="text/javascript">
    $(function(){
       jQuery.each($("select[multiple]"), function () {
        // "Locations" can be any label you want
        SelectFilter.init(this.id, "Locations", 0, "/static/admin/");
       });
    });
  </script>
{% endblock %}

{% block main %}
<form action="" method="post" enctype="multipart/form-data" >{% csrf_token %}
<table class="table table-hover">
<tbody>
{% for field in formEvaluationGraphProperties %}
<tr {% if field.errors %}class="error"{% endif %}>
  <td>
  {{ field.label_tag }}
  </td>
  <td>
    <div>{{field.errors}}</div>
  {{ field }}
  </td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="well text-center">
<input class="btn btn-primary" type="submit" value="Enregistrer" />
</div>
</form>
<h3>Axe du graphe:</h3>
{% if not evaluation_graph_properties.master %}
<div class="well text-center">
<a href="{% url 'evaluations:axis_add' evaluation_graph_properties_id=evaluation_graph_properties.id %}" class="btn" >Ajouter un axe</a>
</div>
{% endif %}

{% if evaluation_axis %}
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span1">
      <h4>Ordre</h4>
    </div>
    <div class="span5">
      <h4>Titre</h4>
    </div>
    <div class="span2">
      {% if user.is_superuser %}
      <h4>Modifier</h4>
      {% else %}
      <h4>Voir</h4>
      {% endif %}
    </div>
    {% if user.is_superuser %}
    <div class="span2">
      <h4>Supprimer</h4>
    </div>
    {% endif %}
  </div>

  {% for axis in evaluation_axis %}
  <div class="row-fluid">
    <div class="span1">
      {{axis.order}}
    </div>
    <div class="span5">
      {{axis.name}}
    </div>
    <div class="span2">
      <a class="btn" href="{% url 'evaluations:axis_detail' evaluation_graph_properties_id=evaluation_graph_properties.id evaluation_axis_id=axis.id %}"><i class="icon-edit"></i></a>
    </div>
    {% if user.is_superuser %}
    <div class="span2">
      <a class="btn" href="{% url 'evaluations:axis_delete' evaluation_graph_properties_id=evaluation_graph_properties.id evaluation_axis_id=axis.id %}"><i class="icon-remove"></i></a>
    </div>
    {% endif %}
  </div>
  {% endfor %}
</div>
{% endif %}
{% endblock %}
