From f17b10da3b4820264c0c44f88b72b8ad8dded6cd Mon Sep 17 00:00:00 2001 From: lehmann Date: Sun, 8 Jan 2023 20:39:26 +0100 Subject: [PATCH] =?UTF-8?q?Filtres=20+=20affectation=20non=20affect=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/partition_editor.css | 4 +- app/templates/scolar/partition_editor.html | 51 ++++++++++++---------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/app/static/css/partition_editor.css b/app/static/css/partition_editor.css index ae9adf9a..3d7140e4 100644 --- a/app/static/css/partition_editor.css +++ b/app/static/css/partition_editor.css @@ -338,7 +338,7 @@ body.editionActivated .filtres .nonEditable .move{ } .filtres .unselect { - background: rgba(0, 153, 204, 0.5); + background: rgba(0, 153, 204, 0.5) !important; } /*****************************/ @@ -353,7 +353,7 @@ body.editionActivated .filtres .nonEditable .move{ } #zoneChoix>.autoAffectation>select{ border: none; - padding: 4px 16px; + padding: 4px; border-radius: 4px; } #zoneChoix>.autoAffectation>.affectationGo{ diff --git a/app/templates/scolar/partition_editor.html b/app/templates/scolar/partition_editor.html index 9c300176..f98e0987 100644 --- a/app/templates/scolar/partition_editor.html +++ b/app/templates/scolar/partition_editor.html @@ -227,9 +227,11 @@ document.querySelectorAll('#zonePartitions .filtres>div').forEach(partition => { - output += ``; + output += ` + + `; partition.querySelectorAll('[data-idgroupe]:not([data-idgroupe="aucun"])').forEach(groupe => { - output += ``; + output += ``; }) output += ""; @@ -301,28 +303,11 @@ }) } - /*if (!this.dataset.idgroupe) { - // Partitions - let groupesSelected = []; - this.parentElement.querySelectorAll(":not(.unselect)").forEach(e => { - groupesSelected.push(e.dataset.idpartition); - }) - document.querySelectorAll(` - .etudiants .partition[data-idpartition], - #zoneGroupes [data-idpartition] - `).forEach(e => { - if (groupesSelected.includes(e.dataset.idpartition)) { - e.classList.remove("hide") - } else { - e.classList.add("hide") - } - }) - } else {*/ // Groupes let groupesSelected = {}; - this.parentElement.parentElement.querySelectorAll("[data-idgroupe]:not(.unselect)").forEach(e => { - let idpartition = e.parentElement.dataset.idpartition; + document.querySelectorAll(".filtres [data-idgroupe]:not(.unselect)").forEach(e => { + let idpartition = e.closest("[data-idpartition]").dataset.idpartition; if (!groupesSelected[idpartition]) { groupesSelected[idpartition] = []; } @@ -345,7 +330,6 @@ e.classList.add("hide") } }) - //} } /****************************/ /* Affectation à un groupe */ @@ -358,8 +342,27 @@ return; } - document.querySelectorAll(`#zoneChoix .etudiants [value="${from}"]:checked`).forEach(groupeSelected=>{ - groupeSelected.closest(".grpPartitions").querySelector(`[value="${to}"]`).click(); + let elements = []; + + if(from[0] != "n"){ + elements = document.querySelectorAll(`#zoneChoix .etudiants [value="${from}"]:checked`) + } else { + document.querySelectorAll(`#zoneChoix .etudiants [data-idpartition="${from.split("-")[1]}"]`).forEach(element=>{ + if(!element.querySelector('input:not([value="aucun"]):checked')){ + elements.push(element); + } + }) + } + + console.log(elements); + + elements.forEach(groupeSelected=>{ + if(to[0] != "n"){ + groupeSelected.closest(".grpPartitions").querySelector(`[value="${to}"]`).click(); + }else{ + groupeSelected.closest(".grpPartitions").querySelector(".aucun").click(); + } + }) } function assignment() {