diff --git a/app/templates/scolar/partition_editor.html b/app/templates/scolar/partition_editor.html index c27d39946..5dd9d4daf 100644 --- a/app/templates/scolar/partition_editor.html +++ b/app/templates/scolar/partition_editor.html @@ -72,26 +72,33 @@ let outputPartitions = "
"; let outputMasques = ""; let outputGroupes = ""; - Object.entries(partitions).forEach(([idPartition, partition]) => { + let arrayPartitions = Object.values(partitions).sort((a, b) => { + return a.numero - b.numero; + }) + + arrayPartitions.forEach((partition) => { // Filtres - outputPartitions += `
||${partition.partition_name}✏️
`; - outputMasques += `
Non affectés - ${partition.partition_name}
`; + outputPartitions += `
||${partition.partition_name}✏️
`; + outputMasques += `
Non affectés - ${partition.partition_name}
`; // Groupes outputGroupes += ` -
+

${partition.partition_name}

Non affecté(s)
${(() => { + let arrayGroups = Object.values(partition.groups).sort((a, b) => { + return a.numero - b.numero; + }) let output = ""; - Object.entries(partition.groups).forEach(([idGroupe, titreGroupe]) => { + arrayGroups.forEach((groupe) => { /***************/ - outputMasques += `
||${titreGroupe.name}✏️
`; + outputMasques += `
||${groupe.name}✏️
`; /***************/ - output += templateGroupe_zoneGroupes(idGroupe, titreGroupe.name); + output += templateGroupe_zoneGroupes(groupe.id, groupe.name); }) return output; })()} @@ -115,26 +122,29 @@
${etudiant.nom_disp} ${etudiant.prenom}
${etudiant.bac}
${(() => { let output = "
"; - Object.entries(partitions).forEach(([idPartition, dataPartition]) => { + arrayPartitions.forEach((partition) => { output += ` -
-
${dataPartition.partition_name}
+
+
${partition.partition_name}
${(() => { let output = ""; let affected = false; - Object.entries(dataPartition.groups).forEach(([idGroupe, titreGroupe]) => { + let arrayGroups = Object.values(partition.groups).sort((a, b) => { + return a.numero - b.numero; + }) + arrayGroups.forEach((groupe) => { output += ` - `; + `; - if (etudiant.partitions[idPartition] == idGroupe) { + if (etudiant.partitions[partition.id] == groupe.id) { affected = true; - document.querySelector(`#zoneGroupes [data-idgroupe="${idGroupe}"]>.etudiants`).innerHTML += templateEtudiant_zoneGroupes(etudiant); + document.querySelector(`#zoneGroupes [data-idgroupe="${groupe.id}"]>.etudiants`).innerHTML += templateEtudiant_zoneGroupes(etudiant); } }) if (!affected) { - document.querySelector(`#zoneGroupes [data-idpartition="${idPartition}"]>[data-idgroupe="aucun"]>.etudiants`).innerHTML += templateEtudiant_zoneGroupes(etudiant); + document.querySelector(`#zoneGroupes [data-idpartition="${partition.id}"]>[data-idgroupe="aucun"]>.etudiants`).innerHTML += templateEtudiant_zoneGroupes(etudiant); } - return `` + output; + return `` + output; })()}
`; })