{% extends 'vice_president/base_vpr.html' %}
{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}
{% block page_title %}{% endblock page_title %}
{% block content %}
{% load unicorn %}
{% unicorn_scripts %}
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div style="text-align:center;">
                    <h4>ETABLISSEMENT: <span style="color:red">{{etudiant.ufr.code}}</span> | ANNEE: <span style="color:red">{{AnUniv}}</span> | NIVEAU: <span style="color:red">{{niveau}}</span></h4>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title">MATI&Egrave;RES | <span style="font-weight:bold;">({{etudiant.nce}}) </span><span>{{etudiant}}</span></h3>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-bordered table-striped" id="dataTables" width="100%" cellspacing="0">
                            {% for semestre in semestres %}
                            <thead>
                            <tr>
                                <th colspan="6" class="antd h4" style="background-color:#FBEEE6;text-transform:uppercase;text-align:center">
                                     {{ semestre }} | {% if AnUniv %} {{AnUniv}}{% endif %}
                                </th>
                            </tr>
                            {% if etudiant.ufr.code != 'MPSI' and EtudAn|check_all_ue_delib:semestre == 0 %}
                            <tr>
                                <td colspan="6" style="
                                {% if EtudAn|get_decision_annuelle_etudiant:semestre == 'ADMIS(E)' %}
                                    background-color:green;
                                {% elif EtudAn|get_decision_annuelle_etudiant:semestre == 'AUTORISE(E)' %}
                                    background-color:#9CFF33;
                                {% elif EtudAn|get_decision_annuelle_etudiant:semestre == 'REFUSE(E)' %}
                                    background-color:#FF5733;
                                {% else %}
                                {% endif %}
                                    text-align:center;color:#fff;font-size:20px;">
                                    DECISION : {{ EtudAn|get_decision_annuelle_etudiant:semestre}}
                                </td>
                            </tr>
                            {% endif %}

                            <tr>
                                 <th>CODE</th>
                                <th>LIBELLE</th>
                                <th>COEFFICIENTS</th>
                                <th>MOYENNE</th>
                                <th>DECISION</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for item in UfrAn|get_ue_by_ufr_and_semestre_set:semestre.id %}
                                <tr>
                                    <td><b>{{ item.code }}</b></td>
                                    <td style="text-transform:uppercase;">{{ item.libelle }} </td>
                                    <td style="text-transform:uppercase;text-align:center;">{{ item|get_credit_ue }}</td>
                                    <td style="text-align:center;">
                                    {% if item.id|check_deliberation_ue_an:AnUniv == 'Oui' %}
                                        {{ EtudAn|get_etudiant_moyenne_ue3:item |stringformat:".2f" }}
                                    {% else %}
                                        <span class="badge badge-secondary"> en attente...</span>
                                    {% endif %}
                                    </td>
                                    <td>
                                    {% if item.id|check_deliberation_ue_an:AnUniv == 'Oui' %}
                                        {% if EtudAn|get_etudiant_moyenne_ue3:item >= item|get_note_delib_ue:AnUniv and item|get_note_delib_ue:AnUniv > 0 %}
                                        <span class="badge badge-success"> validée</span>
                                        {% else %}
                                        <span class="badge badge-danger"> ajournée</span>
                                        {% endif %}
                                    {% else %}
                                        <span class="badge badge-secondary"> en attente...</span>
                                    {% endif %}
                                    </td>

                                </tr>
                                {% endfor %}
                            </tbody>
                            {% endfor %}
                        </table><br/>

                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock content %}

{% block custom_js %}
{% endblock custom_js %}