{% 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>
  </section>


<div class="card mb-3">
    <div class="card-header">
        <i class="fas fa-table"></i>
        PUBLICATIONS
        <button class="btn btn-primary btn-sm" style="float:right;" data-toggle="modal" data-target="#addTypCours"><i class="fa fa-plus"></i>&nbsp;Ajouter</button>
        {% include "enseignant/modal/modal_add_pub.html" %}
    </div>
    <div class="card-body">
        <div class="table-responsive">

            <table class="table table-bordered table-striped" id="dataTable" width="100%" cellspacing="0">
                <thead>
                <tr>
                    <th style="width:50px;"></th>
                    <th>Année</th>
                    <th>Titre</th>
                    <th>Type</th>
                    <th>Référence</th>
                    <th>Action</th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <th style="width:50px;"></th>
                    <th>Année</th>
                    <th>Titre</th>
                    <th>Type</th>
                    <th>Référence</th>
                    <th>Action</th>
                </tr>
                </tfoot>
                <tbody>
                {% for typCour in pub %}
                <tr>
                    <td>{{forloop.counter}}</td>
                    <td>{{typCour.annee}}</td>
                    <td>{{typCour.titre}}</td>
                    <td>{{typCour.typub}}</td>
                    <td>{{typCour.reference}}</td>
                    <td style="width:120px;">
                        <button class="btn btn-success btn-sm text-white" data-toggle="modal" data-target="#addSupp{{typCour.id}}"><i class="fa fa-plus"></i><i class="fa fa-file"></i></button>
                        <a class="btn btn-primary btn-sm text-white" href="{% url 'EspaceEnseignant:pub_edit' typCour.id %}"><i class="fa fa-pen"></i></a>
                        <button class="btn btn-danger btn-sm text-white" data-toggle="modal" data-target="#deleteTypCour{{typCour.id}}"><i class="fa fa-trash"></i>&nbsp;</button>
                    </td>
                    {% include "enseignant/modal/modal_delete_pub.html" %}
                    {% include "enseignant/modal/modal_add_support.html" %}
                </tr>
              {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock content %}

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