From 00f66be1c541882c6019b95e874b81667fcc9a6d Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Fri, 24 Jun 2022 12:00:08 +0200
Subject: [PATCH] Table jury BUT: pas de colonnes rangs et admissions

---
 app/but/jury_but_recap.py    |  2 +-
 app/static/js/table_recap.js | 44 +++++++++++++++++++++---------------
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/app/but/jury_but_recap.py b/app/but/jury_but_recap.py
index 346b89e5e..47f826083 100644
--- a/app/but/jury_but_recap.py
+++ b/app/but/jury_but_recap.py
@@ -86,7 +86,7 @@ def build_table_jury_but_html(
     """assemble la table html"""
     footer_rows = []  # inutile pour l'instant, à voir XXX
     H = [
-        f"""<div class="table_recap"><table class="table_recap apc jury"
+        f"""<div class="table_recap"><table class="table_recap apc jury table_jury_but"
             data-filename="{filename}">"""
     ]
     # header
diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js
index fd5068e60..0c87ecdaa 100644
--- a/app/static/js/table_recap.js
+++ b/app/static/js/table_recap.js
@@ -22,16 +22,21 @@ $(function () {
                     dt.buttons('toggle_partitions:name').text(visible ? "Montrer groupes" : "Cacher les groupes");
                 }
             },
-            {
-                name: "toggle_partitions_rangs",
-                text: "Rangs groupes",
-                action: function (e, dt, node, config) {
-                    let rangs_visible = dt.columns(".partition_rangs").visible()[0];
-                    dt.columns(".partition_rangs").visible(!rangs_visible);
-                    dt.buttons('toggle_partitions_rangs:name').text(rangs_visible ? "Rangs groupes" : "Cacher rangs groupes");
-                }
-            },
         ];
+        // Bouton "rangs groupes", sauf pour table jury BUT
+        if (!$('table.table_recap').hasClass("table_jury_but")) {
+            buttons.push(
+                {
+                    name: "toggle_partitions_rangs",
+                    text: "Rangs groupes",
+                    action: function (e, dt, node, config) {
+                        let rangs_visible = dt.columns(".partition_rangs").visible()[0];
+                        dt.columns(".partition_rangs").visible(!rangs_visible);
+                        dt.buttons('toggle_partitions_rangs:name').text(rangs_visible ? "Rangs groupes" : "Cacher rangs groupes");
+                    }
+                });
+        }
+
         if (!$('table.table_recap').hasClass("jury")) {
             buttons.push(
                 $('table.table_recap').hasClass("apc") ?
@@ -80,15 +85,18 @@ $(function () {
                 }
             })
         }
-        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");
-            }
-        })
+        // Boutons admission, sauf pour table jury BUT
+        if (!$('table.table_recap').hasClass("table_jury_but")) {
+            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");
+                }
+            });
+        }
         $('table.table_recap').DataTable(
             {
                 paging: false,
-- 
GitLab