diff --git a/app/static/css/partition_editor.css b/app/static/css/partition_editor.css index ae9adf9ad5..3d7140e407 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 9c30017655..f98e0987e2 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() {