2022-03-26 23:33:57 +01:00
|
|
|
// Tableau recap notes
|
|
|
|
$(function () {
|
|
|
|
$(function () {
|
2022-03-28 18:13:51 +02:00
|
|
|
// Les boutons dépendent du mode BUT ou classique:
|
|
|
|
let buttons = [
|
|
|
|
{
|
|
|
|
name: "toggle_ident",
|
|
|
|
text: "Civ/Nom/Prénom",
|
|
|
|
action: function (e, dt, node, config) {
|
|
|
|
let visible = dt.columns(".identite_detail").visible()[0];
|
|
|
|
dt.columns(".identite_detail").visible(!visible);
|
|
|
|
dt.columns(".identite_court").visible(visible);
|
|
|
|
dt.buttons('toggle_ident:name').text(visible ? "Civ/Nom/Prénom" : "Nom");
|
|
|
|
}
|
|
|
|
},
|
2022-03-29 00:03:38 +02:00
|
|
|
{
|
|
|
|
name: "toggle_partitions",
|
|
|
|
text: "Toutes les partitions",
|
|
|
|
action: function (e, dt, node, config) {
|
|
|
|
let visible = dt.columns(".partition_aux").visible()[0];
|
|
|
|
dt.columns(".partition_aux").visible(!visible);
|
|
|
|
dt.buttons('toggle_partitions:name').text(visible ? "Toutes les partitions" : "Cacher les partitions");
|
|
|
|
}
|
2022-04-07 23:31:08 +02:00
|
|
|
}];
|
|
|
|
if (!$('table.table_recap').hasClass("jury")) {
|
|
|
|
buttons.push(
|
|
|
|
$('table.table_recap').hasClass("apc") ?
|
|
|
|
{
|
|
|
|
name: "toggle_res",
|
|
|
|
text: "Cacher les ressources",
|
|
|
|
action: function (e, dt, node, config) {
|
|
|
|
let visible = dt.columns(".col_res").visible()[0];
|
|
|
|
dt.columns(".col_res").visible(!visible);
|
|
|
|
dt.columns(".col_ue_bonus").visible(!visible);
|
|
|
|
dt.columns(".col_malus").visible(!visible);
|
|
|
|
dt.buttons('toggle_res:name').text(visible ? "Montrer les ressources" : "Cacher les ressources");
|
|
|
|
}
|
|
|
|
} : {
|
|
|
|
name: "toggle_mod",
|
|
|
|
text: "Cacher les modules",
|
|
|
|
action: function (e, dt, node, config) {
|
|
|
|
let visible = dt.columns(".col_mod:not(.col_empty)").visible()[0];
|
|
|
|
dt.columns(".col_mod:not(.col_empty)").visible(!visible);
|
|
|
|
dt.columns(".col_ue_bonus").visible(!visible);
|
|
|
|
dt.columns(".col_malus").visible(!visible);
|
|
|
|
dt.buttons('toggle_mod:name').text(visible ? "Montrer les modules" : "Cacher les modules");
|
|
|
|
visible = dt.columns(".col_empty").visible()[0];
|
|
|
|
dt.buttons('toggle_col_empty:name').text(visible ? "Cacher mod. vides" : "Montrer mod. vides");
|
|
|
|
}
|
2022-03-28 18:13:51 +02:00
|
|
|
}
|
2022-04-07 23:31:08 +02:00
|
|
|
);
|
|
|
|
if ($('table.table_recap').hasClass("apc")) {
|
|
|
|
buttons.push({
|
|
|
|
name: "toggle_sae",
|
|
|
|
text: "Cacher les SAÉs",
|
2022-03-28 18:13:51 +02:00
|
|
|
action: function (e, dt, node, config) {
|
2022-04-07 23:31:08 +02:00
|
|
|
let visible = dt.columns(".col_sae").visible()[0];
|
|
|
|
dt.columns(".col_sae").visible(!visible);
|
|
|
|
dt.buttons('toggle_sae:name').text(visible ? "Montrer les SAÉs" : "Cacher les SAÉs");
|
2022-03-28 18:13:51 +02:00
|
|
|
}
|
2022-04-07 23:31:08 +02:00
|
|
|
})
|
|
|
|
}
|
2022-03-28 18:13:51 +02:00
|
|
|
buttons.push({
|
2022-04-07 23:31:08 +02:00
|
|
|
name: "toggle_col_empty",
|
|
|
|
text: "Montrer mod. vides",
|
2022-03-28 18:13:51 +02:00
|
|
|
action: function (e, dt, node, config) {
|
2022-04-07 23:31:08 +02:00
|
|
|
let visible = dt.columns(".col_empty").visible()[0];
|
|
|
|
dt.columns(".col_empty").visible(!visible);
|
|
|
|
dt.buttons('toggle_col_empty:name').text(visible ? "Montrer mod. vides" : "Cacher mod. vides");
|
2022-03-28 18:13:51 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2022-03-29 00:03:38 +02:00
|
|
|
buttons.push({
|
|
|
|
name: "toggle_admission",
|
|
|
|
text: "Montrer infos admission",
|
|
|
|
action: function (e, dt, node, config) {
|
|
|
|
let visible = dt.columns(".admission").visible()[0];
|
|
|
|
dt.columns(".admission").visible(!visible);
|
|
|
|
dt.buttons('toggle_admission:name').text(visible ? "Montrer infos admission" : "Cacher infos admission");
|
|
|
|
}
|
|
|
|
})
|
2022-03-26 23:33:57 +01:00
|
|
|
$('table.table_recap').DataTable(
|
|
|
|
{
|
|
|
|
paging: false,
|
|
|
|
searching: true,
|
|
|
|
info: false,
|
|
|
|
autoWidth: false,
|
|
|
|
fixedHeader: {
|
|
|
|
header: true,
|
2022-03-28 18:13:51 +02:00
|
|
|
footer: false
|
2022-03-26 23:33:57 +01:00
|
|
|
},
|
|
|
|
orderCellsTop: true, // cellules ligne 1 pour tri
|
|
|
|
aaSorting: [], // Prevent initial sorting
|
|
|
|
colReorder: true,
|
|
|
|
"columnDefs": [
|
|
|
|
{
|
2022-04-04 09:35:52 +02:00
|
|
|
// cache les codes, le détail de l'identité, les groupes, les colonnes admission et les vides
|
|
|
|
targets: ["codes", "identite_detail", "partition_aux", "admission", "col_empty"],
|
|
|
|
visible: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Elimine les 0 à gauche pour les exports excel et les "copy"
|
2022-05-10 10:06:51 +02:00
|
|
|
targets: ["col_mod", "col_moy_gen", "col_ue", "col_res", "col_sae", "evaluation"],
|
2022-04-04 09:35:52 +02:00
|
|
|
render: function (data, type, row) {
|
|
|
|
return type === 'export' ? data.replace(/0(\d\..*)/, '$1') : data;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Elimine les décorations (fleches bonus/malus) pour les exports
|
|
|
|
targets: ["col_ue_bonus", "col_malus"],
|
|
|
|
render: function (data, type, row) {
|
|
|
|
return type === 'export' ? data.replace(/.*(\d\d\.\d\d)/, '$1').replace(/0(\d\..*)/, '$1') : data;
|
|
|
|
}
|
2022-03-26 23:33:57 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
dom: 'Bfrtip',
|
2022-04-04 09:35:52 +02:00
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
extend: 'copyHtml5',
|
|
|
|
text: 'Copier',
|
|
|
|
exportOptions: { orthogonal: 'export' }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
extend: 'excelHtml5',
|
|
|
|
exportOptions: { orthogonal: 'export' },
|
|
|
|
title: document.querySelector('table.table_recap').dataset.filename
|
|
|
|
},
|
2022-03-26 23:33:57 +01:00
|
|
|
{
|
|
|
|
extend: 'collection',
|
2022-03-29 00:03:38 +02:00
|
|
|
text: 'Colonnes affichées',
|
2022-03-26 23:33:57 +01:00
|
|
|
autoClose: true,
|
2022-03-28 18:13:51 +02:00
|
|
|
buttons: buttons,
|
2022-03-29 00:03:38 +02:00
|
|
|
},
|
2022-03-26 23:33:57 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
2022-03-27 18:49:15 +02:00
|
|
|
$('table.table_recap tbody').on('click', 'tr', function () {
|
|
|
|
if ($(this).hasClass('selected')) {
|
|
|
|
$(this).removeClass('selected');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('table.table_recap tr.selected').removeClass('selected');
|
|
|
|
$(this).addClass('selected');
|
|
|
|
}
|
|
|
|
});
|
2022-04-07 23:31:08 +02:00
|
|
|
// Pour montrer et highlihter l'étudiant sélectionné:
|
|
|
|
$(function () {
|
|
|
|
document.querySelector("#row_selected").scrollIntoView();
|
|
|
|
window.scrollBy(0, -50);
|
|
|
|
document.querySelector("#row_selected").classList.add("selected");
|
|
|
|
});
|
2022-03-26 23:33:57 +01:00
|
|
|
});
|