templates/manager_students_list.html
{% extends "layout.html" %}
{% load static %}
{% load i18n %}
{% comment "License" %}
* OSIS stands for Open Student Information System. It's an application
* designed to manage the core business of higher education institutions,
* such as universities, faculties, institutes and professional schools.
* The core business involves the administration of students, teachers,
* courses, programs and so on.
*
* Copyright (C) 2015-2019 Université catholique de Louvain (http://www.uclouvain.be)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of this license - GNU General Public License - is available
* at the root of the source code of this program. If not,
* see http://www.gnu.org/licenses/.
{% endcomment %}
{% block style %}
<link rel="stylesheet" href="{% static 'css/dataTables.bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'css/dissertation_style.css' %}">
{% endblock %}
{% block breadcrumb %}
<li><a href="{% url 'studies' %}" id="lnk_studies">{% trans "Students' path" %}</a></li>
<li id="lnk_cohorts_management"><a href="{% url 'cohorts_management' %}">{% trans "Cohorts management" %}</a></li>
<li><a href="{% url 'dissertations' %}" id="lnk_dissertations">{% trans 'Dissertations' %}</a></li>
<li class="active">{% trans 'For students' %}{{ students_title|title }}</li>
{% endblock %}
{% block content %}
<div class="page-header">
<h2>{% trans 'For students' %}{{ students_title|title }}</h2>
</div>
<div class="panel panel-default">
<div class="panel-body table-responsive">
<table class="table table-hover" id="students-list">
<thead>
<tr>
<th>{% trans 'Student' %}</th>
<th>{% trans 'Programs and enrollements status'%}</th>
<th>{% trans 'Status' context 'dissertation' %}</th>
<th>{% trans 'Dissertation' %}</th>
</thead>
<tbody>
{% for student in students %}
<tr>
<td>{{ student }}</td>
<td>
{% for offerenrollment in student.offerenrollment_set.all %}
{% if offerenrollment.enrollment_state %}
<div class="div_in_datatable">
<span class="label label-default">
{{ offerenrollment.education_group_year.acronym}}.
{{ offerenrollment.education_group_year.academic_year }}.
{{ offerenrollment.enrollment_state }}
</span>
</div>
{% endif %}
{% endfor %}
</td>
<td>
{% for dissertation in student.dissertation_set.all %}
{% if forloop.first %}
<dl class="dl-horizontal">
{% endif %}
<div class="div_in_datatable">
<dt style="text-align: left;">
{% if dissertation.status == 'DIR_SUBMIT' %}
<span class="label label-warning">
{% elif dissertation.status == 'COM_SUBMIT' or dissertation.status == 'EVA_SUBMIT' %}
<span class="label label-primary">
{% elif dissertation.status == 'DIR_KO' or dissertation.status == 'DRAFT' or dissertation.status == 'COM_KO' or dissertation.status == 'EVA_KO' %}
<span class="label label-danger">
{% elif dissertation.status == 'COM_OK' or dissertation.status == 'EVA_OK' or dissertation.status == 'TO_RECEIVE' or dissertation.status == 'TO_DEFEND' %}
<span class="label label-default">
{% else %}
<span class="label label-success">
{% endif %}
{{ dissertation.get_status_display }}
</span>
</dt>
</div>
{% empty %}
<span class="label label-danger">Pas de mémoire</span>
{% if forloop.last %}
</dl>
{% endif %}
<br>
{% endfor %}
</td>
<td>
{% for dissertation in student.dissertation_set.all %}
<div class="div_in_datatable">
<a href="{% url 'manager_dissertations_detail' pk=dissertation.pk %}" title="{{ dissertation }}" target="_blank">
{{ dissertation|truncatechars:60 }}</a>
<span class="label label-default pull-right">[{{ dissertation.education_group_year}}]</span>
<br>
</div>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot id="foot-list">
<tr>
<th>{{ students_title|title }}</th>
<th>{% trans 'Programs' %}</th>
<th>{% trans 'Status' context 'dissertation' %}</th>
<th>{% trans 'Dissertation' %}</th>
</tr>
</tfoot>
</table>
</div>
</div>
{% endblock %}
{% block script %}
<script type="text/javascript" src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.dataTables.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/bootstrap.min.js'%}"></script>
<script type="text/javascript" src="{% static 'js/dataTables.bootstrap.min.js'%}"></script>
<script>
$(document).ready(function()
{
var table =$('#students-list').DataTable(
{
"pageLength": 25,
"paging" : true,
"ordering" : true,
"info" : false,
"searching" : true,
"language": {
"sProcessing": "{% trans 'Processing...'%}",
"sSearch": "{% trans 'Search:'%}",
"sLengthMenu": " _MENU_ éléments",
"sInfo": "{% trans 'Showing _START_ to _END_ of _TOTAL_ entries'%}",
"sInfoEmpty": "{% trans 'Showing 0 to 0 of 0 entries'%}",
"sInfoFiltered": "{% trans '(filtered from _MAX_ total entries)'%}",
"sInfoPostFix": "{% trans 'datatable_infopostfix'%}",
"sLoadingRecords": "{% trans 'Loading...'%}",
"sZeroRecords": "{% trans 'No matching records found'%}",
"sEmptyTable": "{% trans 'No data available in table'%}",
"oPaginate": {
"sFirst": "{% trans 'First'%}",
"sPrevious": "{% trans 'Previous'%}",
"sNext": "{% trans 'Next'%}",
"sLast": "{% trans 'Last'%}"
},
"oAria": {
"sSortAscending": "{% trans ': activate to sort column ascending'%}",
"sSortDescending": "{% trans ': activate to sort column descending'%}",
}
},
"columns":[
null,
null,
null,
null
],
initComplete: function () {
this.api().columns([0]).every( function () {
var column = this;
var select = $('<select class="search_select_filter form-control input-sm"><option value="" selected>{% trans 'filter by students'%}</option></select>')
.appendTo( $('#students-list_filter'))
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
var val = $('<div/>').html(d).text();
select.append( '<option value="' + val + '">' + val + '</option>' );
} );
} );
}
});
});
</script>
{% endblock %}