{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}
<!DOCTYPE>
<html>
    <head>
        <title>PV_{{UFR.code}}_{{get_niveau}}_{{get_annee}}</title>
        <style type="text/css">
            .usp-info img{
                width:1124px;
            }
            .table{
                border:1px solid #000000;
                text-align:left;
                font-size:11px;
            }
            .table-2{
                border:1px solid #000000;
                width:80%;
                text-align:left;
                font-size:12px;
            }
            .table tr{
                padding:1px;
            }
            .table td {
              border: 1px solid;
            }
            .table th{
                text-align:left;
                padding:1px;
            }
            .nce{
                width:148px;
            }
            .nom{
                width:160px;
            }
            .ue-content{
                min-width:45px;
            }
            .title{
                font-size:20px;
                text-align: center;
                border:1px solid #000000;
                padding:15px;
            }
            .stat-ue{
                font-size:16px;
                font-weight:bold;
                width:113px;
                padding:3px 2px 1px 2px;
            }
            .stat-ue-2{
                font-size:16px;
                font-weight:bold;
                width:200px;
                padding:3px 2px 1px 2px;
            }
            .bg-orange{
                background-color:#fdc000;
            }
            @page{
                size: a4 landscape;
                margin: 30px;
            }

        </style>
    </head>
    <body>
      <div class="pdf-content">
          <div class="usp-info">
                <img src="static/ac-img/usp-info.png">
          </div>
          <br/>
          <div class="title">
              <span style="font-weight:bold;">UFR: {{UFR}}</span><br/>
              <span style="text-transform: uppercase;">ANNEE UNIVERSITAIRE: {{get_annee}}</span><br/>
              <span style="text-transform: uppercase;">NIVEAU: {{get_niveau}}</span><br/>
              <span style="text-transform: uppercase;">
                  {% if get_semestre.libelle == 'Semestre 1' %}
                    SEMESTRE N<sup>o</sup>1 (S1)
                    {% else %}
                    SEMESTRE N<sup>o</sup>2 (S2)
                  {% endif %}
              </span><br/>
              <span style="font-weight:bold;">PROCES-VERBAL DE DELIBERATIONS</span><br/>
          </div><br/>
       <!--   <p style="text-align:center;font-size:20px;text-transform:uppercase;text-decoration:underline;">RESULTATS
                {% if get_semestre.libelle == 'Semestre 1' %}
                    SEMESTRE 1
                    {% else %}
                    SEMESTRE 2
                  {% endif %}
            </p> -->
          <div style="text-align:center;text-decoration:underline;font-size:14px;font-weight:bold;">Statistiques par Genre</div>
          <div style="margin-leff:200px;"><table class="table-2" width="500px">
              <thead>
                <tr>
                    <th></th>
                    <th></th>
                    <th style="width:75px;font-size:14px;padding-top:2px;"><center>Filles</center></th>
                    <th style="width:75px;font-size:14px;padding-top:2px;"><center>Garçons</center></th>
                    <th style="width:75px;font-size:14px;padding-top:2px;" class="bg-orange">Générale</th>
                    <th></th>
                </tr>
              </thead>
              <tbody>
                <tr>
                    <td rowspan="4" style="border-top:none"></td>
                    <td class="stat-ue-2">Effectifs</td>
                    <th class="ue-content">{{fille}}</th>
                    <th class="ue-content">{{garcon}}</th>
                    <th class="ue-content bg-orange">{{etudiants|length}}</th>
                    <td rowspan="4"></td>
                </tr>
                <tr>
                    <td class="stat-ue-2">Moyennes</td>
                    <th class="ue-content">{{Moy_Garcon|stringformat:".2f"}}</th>
                    <th class="ue-content">{{Moy_Fille|stringformat:".2f"}}</th>
                    <th class="ue-content bg-orange">{{MoyGen|stringformat:".2f"}}</th>
                </tr>
                <tr>
                    <td class="stat-ue-2">Ecart-types</td>
                    <th class="ue-content">{{Ecart_Type_Gar|stringformat:".2f"}}</th>
                    <th class="ue-content">{{Ecart_Type_Fille|stringformat:".2f"}}</th>
                    <th class="ue-content bg-orange">{{EcartGen|stringformat:".2f"}}</th>
                </tr>
                <tr>
                    <td class="stat-ue-2">% de Validation</td>
                    <th class="ue-content">{{Taux_Fille|stringformat:".2f"}}%</th>
                    <th class="ue-content">{{Taux_Garcon|stringformat:".2f"}}%</th>
                    <th class="ue-content bg-orange">{{TauxGen|stringformat:".2f"}}%</th>
                </tr>
              </tbody>
          </table></div><br/>

          <div style="text-align:center;text-decoration:underline;font-size:14px;font-weight:bold;">Statistiques par UE</div>
          <table class="table">
              <thead>
                <tr>
                    <th></th>
                    {% for ue in ues_semestre %}
                    <th class="ue-content"><center>{{ue.code}}</center></th>
                    {% endfor %}
                    <th style="width:75px;" class="bg-orange">Générale</th>
                </tr>
              </thead>
              <tbody >
                <tr>
                    <td class="stat-ue">Moyennes</td>
                    {% for moy in MoyUE %}
                    <th class="ue-content"><center>{{moy|stringformat:".2f"}}</center></th>
                    {% endfor %}
                    <td style="text-align:center;" class="bg-orange">{{MoyGen|stringformat:".2f"}}</td>
                </tr>
                <tr>
                    <td class="stat-ue">Ecart-Types</td>
                    {% for ecart in EcarType %}
                    <th class="ue-content"><center>{{ecart|stringformat:".2f"}}</center></th>
                    {% endfor %}
                    <td style="text-align:center;" class="bg-orange">{{EcartGen|stringformat:".2f"}}</td>
                </tr>
                <tr>
                    <td class="stat-ue">% Validation</td>
                    {% for taux in Taux_valides %}
                    <th class="ue-content"><center>{{taux|stringformat:".2f"}}%</center></th>
                    {% endfor %}
                    <td style="text-align:center;" class="bg-orange">{{TauxGen|stringformat:".2f"}}%</td>
                </tr>
              </tbody>
          </table><br/><br/>
          <center>
          <table class="table">
              <thead>

              <tr>
                    <th style="width:35px;float:left;"></th>
                    <th style="width:150px;text-align:center;">ID ETUDIANT</th>
                    {% for ue in ues_semestre %}
                    <th class="ue-content"><center>{{ue.code}}<br/>{{ue|get_credit_ue}}</center></th>
                    {% endfor %}
                    <th style="width:40px;">
                        <center>Moy.<br/>
                            {% if get_semestre.libelle == 'Semestre 1' %}
                            S1
                            {% else %}
                            S2
                            {% endif %}
                        </center></th>
                    {% if UFR.code != 'MPSI'  %}
                    <th style="width:60px;"><center>TT Cred.<br/> {{total_credit}}</center></th>
                    <th style="width:85px;text-align:center;">Décision</th>
                    {% endif %}

                  <th style="width:45px;text-align:center;"></th>
                </tr>
              </thead>
              <tbody>
              {% for item in datas_etudiant %}
                    <tr>
                        <td style="text-align:center;">{{ forloop.counter }}</td>
                        <td style="padding:3px;">
                            <b>{{ item.0 }}</b><br/>
                            Né(e) le {{ item.0.datenaiss |date:'d/m/Y' }} à {{ item.0.lieunaiss }}<br/>
                            SEXE: {{ item.0.sexe }}<br/>
                            NCE: {{ item.0.nce }}
                        </td>
                        {% for ue in EuAnDataZip %}
                            <td style="
                            background-color:
                            {% if not get_annee|create_list_2_obj:item.0|check_etudiant_if_validate_ue_prev:ue.0 %}
                                {% if item.0|check_session2_ue:ue > 0  %}
                                    {{item.0|get_etudiant_session_2_moy_ue:ue|stringformat:'.2f'|is_validate}}
                                {% else %}
                                     {{item.0|get_etudiant_moyenne_ue_session_1:ue|stringformat:'.2f'|is_validate}}
                                {% endif %}
                            {% else %}
                            grey
                            {% endif %}
                            ">
                                <center>
                                    {% if not get_annee|create_list_2_obj:item.0|check_etudiant_if_validate_ue_prev:ue.0 %}
                                        <span>{{ue.0.code}}</span><br/><br/>
                                        {{item.0|get_etudiant_moyenne_ue_session_1:ue|stringformat:".2f"}}
                                        {% if item.0|check_session2_ue:ue > 0  %}
                                            <br/>
                                            ({{item.0|get_etudiant_session_2_moy_ue:ue|stringformat:".2f"}})
                                        {% endif %}
                                    {% endif %}

                                </center>
                            </td>
                        {% endfor %}

                        <td style="width:40px;background-color:
                        {% if UFR.code == 'MPSI'  %}
                            {{item.1|is_validate_semestre_mpsi}}
                        {% else %}
                            {{item.3|is_validate_semestre}}
                        {% endif %}
                        ;
                        "><center>{{ item.1|stringformat:".2f" }}</center></td>
                        {% if UFR.code == 'MPSI'  %}
                        {% else %}
                        <td style="width:50px;"><center>{{ item.2 }}</center></td>
                        <td style="width:85px;background-color:{{item.3|is_validate_semestre}};">
                            <center>{{ item.3 }}</center>
                        </td>
                        {% endif %}

                        <th style="width:45px;text-align:center;"></th>
                    </tr>
              {% endfor %}
              </tbody>
          </table>
            </center>
      </div>
    </body>
</html>