{% extends 'enseignant/base_profile.html' %}
{% load static %}
{% load widget_tweaks %}
{% load unicorn %}
{% unicorn_scripts %}
{% block custom_css %}
<style>
        #loading {
            background: red;
            position: fixed;
            top: 0;
            width: 100%;
            height: 100%;
        }

    </style>
{% endblock custom_css %}
{% block page_title %}{{page_title}}{% endblock page_title %}
{% block content %}
<section class="content">
    <div class="container-fluid">
        <!-- Small boxes (Stat box)-->
        {% include "enseignant/parts/stats_seance.html" %}
        <div class="container">
            <div style="text-align:center;">
                <h4>ANNEE : <span style="color:red">{{AnUniv}}</span></h4>
            </div>
        </div>

    </div>
  </section>


<div class="card mb-3">
    <div class="card-header">
        <i class="fas fa-table"></i>
        MATI&Egrave;RES ENSEIGN&Eacute;ES
    </div>
    <div class="card-body">
        <div class="table-responsive">
            <form action="#" method="post" id="sForm">
                 {% csrf_token %}
            <div class="row">
                <div class="col-md-2" hidden>
                    {% if Ue %}
                    <a href="{% url 'EspaceEnseignant:resultat_ue_pdf' Ue.id AnUniv.id %}" target="_blank" class="btn btn-primary btn-sm"><i class="fa fa-print"></i> Résultat </a><!--onclick="generatePDF()"-->
                    {% else %}
                    <button class="btn btn-primary btn-sm" disabled><i class="fa fa-print"></i> Résultat </button>
                    {% endif %}
                    {% include 'EspaceEnseignant/modal.html' %}{% include 'EspaceEnseignant/modal_import_note.html' %}<br/><br/>

                </div>
                <div class="col-md-2">
                    <select class="form-control" name="libelle" id="sField">
                        {% for annee in annees %}
                        <option value="{{annee.id}}">{{annee}}</option>
                        {% endfor %}
                    </select>

                </div>
                <div class="col-md-2" hidden>
                    <button type="submit" name="AnneeFilter" id="sForm1" class='btn btn-primary btn-sm'><i class="fa fa-filter"></i></button>
                </div>

            </div>
            </form><hr/>
            <table class="table table-bordered table-striped" id="dataTable" width="100%" cellspacing="0">
                <thead>
                <tr>
                    <th style="width:100px;">Code</th>
                    <th>Libellé</th>
                    <th>Coefficients</th>
                   <!-- <th>TD</th>
                    <th>TP</th>
                    <th>AEM</th>-->
                    <th>Action</th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <th style="width:100px;">Code </th>
                    <th>Libellé</th>
                    <th>Coefficients</th>
                   <!-- <th>TD</th>
                    <th>TP</th>
                    <th>AEM</th>-->
                    <th>Action</th>
                </tr>
                </tfoot>
                <tbody>
                {% for enseignantUe in EnseignantUes %}
                <tr>
                    <td>{{enseignantUe.ecue.ue.semestre}}</td>
                    <td class="lue">
                      <a href="{% url 'EspaceEnseignant:syllabus_ecue_home' enseignantUe.ecue.id %}" style="text-decoration:underline;">{{enseignantUe.ecue.libelle}}</a>
                    </td>
                    <td width="100">{{enseignantUe.ecue.credit}}</td>
                    <td style="width:200px;">
                        <a class="btn btn-primary btn-sm text-white" href="{% url 'EspaceEnseignant:add_note_views' enseignantUe.ecue.id AnUniv.id %}"><i class="fa fa-plus"></i> Noter</a>
                        <a class="btn btn-warning btn-sm text-white" href="{% url 'EspaceEnseignant:marquer_absence' enseignantUe.ecue.id AnUniv.id %}"><i class="fa fa-hand-pointer"></i> Faire l'appel</a>
                       <!-- <a href="{% url 'EspaceEnseignant:syllabus_ecue_home' enseignantUe.ecue.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-print"></i>&nbsp; Syllabus</a> -->
                    </td>
                </tr>
              {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock content %}

{% block custom_js %}
<script>
    $('#sField').change(function(){
        $('#sForm').submit()
    });
</script>
{% endblock custom_js %}