{# -*- mode: jinja-html -*- #}
{# Édition liste UEs APC #}
<div class="formation_list_ues">
    <div class="formation_list_ues_titre">Unités d'Enseignement (UEs)</div>
    {% for semestre_idx in semestre_ids %}
        <div class="formation_list_ues_sem">Semestre S{{semestre_idx}}</div>
        <ul class="apc_ue_list">
            {% for ue in formation.ues.filter_by(semestre_idx=semestre_idx).order_by(
                UniteEns.semestre_idx, UniteEns.numero, UniteEns.acronyme
            ) %}
                <li class="notes_ue_list">
                {% if editable and not loop.first %}
                    <a href="{{ url_for('notes.ue_move', 
                    scodoc_dept=g.scodoc_dept, ue_id=ue.id, after=0 )
                    }}" class="aud">{{icons.arrow_up|safe}}</a>
                {% else %}
                    {{icons.arrow_none|safe}}
                {% endif %}
                {% if editable and not loop.last %}
                    <a href="{{ url_for('notes.ue_move', 
                    scodoc_dept=g.scodoc_dept, ue_id=ue.id, after=1 )
                    }}" class="aud">{{icons.arrow_down|safe}}</a>
                {% else %}
                    {{icons.arrow_none|safe}}
                {% endif %}
                </span>
                
                <a class="smallbutton" href="{{ url_for('notes.ue_delete', 
                    scodoc_dept=g.scodoc_dept, ue_id=ue.id)
                    }}">{% if editable and not ue.modules.count() %}{{icons.delete|safe}}{% else %}{{icons.delete_disabled|safe}}{% endif %}</a>
                
                <span class="ue_type_{{ue.type}}">
                <span class="ue_color_indicator" style="background:{{
                    ue.color if ue.color is not none else 'blue'}}"></span>
                <b>{{ue.acronyme}}</b> <a class="discretelink" href="{{
                    url_for('notes.ue_infos', scodoc_dept=g.scodoc_dept, ue_id=ue.id)}}"
                    >{{ue.titre}}</a>
                </span>

                {% if editable and not ue.is_locked() %}
                    <a class="stdlink" href="{{ url_for('notes.ue_edit', 
                    scodoc_dept=g.scodoc_dept, ue_id=ue.id)
                    }}">modifier</a>
                {% endif %}

                </li>
            {% endfor %}
        </ul>
        {% endfor %}
        {% if editable %}
        <ul>
            <li class="notes_ue_list notes_ue_list_add"><a class="stdlink" href="{{
                url_for('notes.ue_create', 
                        scodoc_dept=g.scodoc_dept, 
                        formation_id=formation.id,
                        )}}"
                    >ajouter une UE</a>
            </li>
        </ul>
        {% endif %}
</div>