{% load static %}
{% load custom_tag %}
<!DOCTYPE>
<html>
    <head>
        <title>SEANCE DU {{debut}} AU {{fin}}</title>
        <style type="text/css">
            .usp-info img{
                width:1124px;
            }
            .table{
                border:1px solid #000000;
                text-align:left;
                font-size:12px;
                border-collapse: collapse;
            }
            .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 portrait;
                margin: 400px 25px 90px 25px;
                @frame header_frame {           /* Static Frame */
                        -pdf-frame-content: header_content;
                        left: 20pt; width: 562pt; top: 20pt;
                    }

                    @frame footer_frame {           /* Another static Frame */
                        -pdf-frame-content: footer_content;
                        left: 50pt; width: 512pt; top: 800pt; height: 20pt;
                    }
            }

        </style>
    </head>
    <body>
        <!-- Content for Static Frame 'header_frame' -->
        <div id="header_content">
            <div class="usp-info">
                <img src="static/ac-img/usp-info.png">
          </div>
          <br/>
          <div class="title">
              {% if user.profile %}
              {% else %}
              <span style="font-weight:bold;">UFR: {{ufr}}</span><br/>
              {% endif %}
              <span style="text-transform: uppercase;">PERIODE: du {{debut}} au {{fin}}</span><br/>
              <span style="text-transform: uppercase;">ENSEIGNANT: {% if ens_obj %}{{ens_obj}}{% else %}{{ens}}{% endif %}</span><br/>
              <span style="text-transform: uppercase;">ECUE: {% if ecue_obj %}({{ecue_obj.code}}) {{ecue_obj.libelle}}{% else %}{{ecue}}{% endif %}</span><br/>
              <span style="#">STATUS: {{status}}</span><br/>
          </div><br/>
          <p style="text-align:center;font-size:20px;text-transform:uppercase;text-decoration:underline;">
              LISTE DES SEANCES
            </p>

        </div><!-- END STATIC FRAME -->

        <!-- Content for Static Frame 'footer_frame' -->
        <div id="footer_content">
            <pdf:pagenumber>/<pdf:pagecount>
        </div>
      <div class="pdf-content">

          <table class="table">
              <thead>
                   <th style="width:35px;text-align:center;"></th>
                    <th style="width:75px;text-align:center;">DATE</th>
                    <th style="width:40px;text-align:center;">TYPE</th>
                    <th style="width:125px;text-align:center;">DUREE</th>
                    <th style="width:45px;text-align:center;">SALLE</th>
                    <th style="width:70px;text-align:center;">ECUE</th>
                    <th style="text-align:center;">ENSEIGNANT</th>
                    <th style="width:70px;text-align:center;">DELEGUE</th>
                    <th style="width:70px;text-align:center;">ADMIN</th>
              </thead>
              <tbody>
              {% for seance in seances %}
                    <tr style="padding:4px 0px 0px 2px;">
                        <td style="text-align:center;">{{ forloop.counter }}</td>
                        <td style="padding:4px 0px 0px 3px;">{{ seance.date|date:'d-m-Y' }}</td>
                        <td style="text-align:center;">{{ seance.type_cours }}</td>
                        <td style="padding-left:3px;">{{ seance.debut|time:'G:i' }} - {{ seance.fin|time:'G:i' }}  &nbsp;({{seance|get_duration_between}})</td>
                        <td style="text-align:center;">{{ seance.salle.libelle }}</td>
                        <td style="padding-left:3px;">{{ seance.ecue.code }}</td>
                        <td style="padding-left:3px;">{{ seance.enseignant }}</td>
                        <td style="text-align:center;">
                            {% if seance.etudiant_valid %}
                            <span style="color:green;">validée</span>
                            {% else %}
                            <span>en attente</span>
                            {% endif %}
                        </td>
                        <td style="text-align:center;">
                            {% if seance.admin_valid %}
                            <span style="color:green;">validée</span>
                            {% else %}
                            <span>en attente...</span>
                            {% endif %}
                        </td>
                    </tr>
              {% endfor %}
              </tbody>
          </table>
      </div>
    </body>
</html>