forked from ScoDoc/DocScoDoc
Tri partitions et groupes
This commit is contained in:
parent
ee93cf1e9b
commit
3dfe15ee17
@ -72,26 +72,33 @@
|
||||
let outputPartitions = "<div>";
|
||||
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 += `<div data-idpartition="${idPartition}"><span class="editing move">||</span><span>${partition.partition_name}</span><span class="editing modif">✏️</span><span class="editing suppr">❌</span></div>`;
|
||||
outputMasques += `<div data-idpartition="${idPartition}"><div data-idpartition="${idPartition}" data-idgroupe=aucun>Non affectés - ${partition.partition_name}</div>`;
|
||||
outputPartitions += `<div data-idpartition="${partition.id}"><span class="editing move">||</span><span>${partition.partition_name}</span><span class="editing modif">✏️</span><span class="editing suppr">❌</span></div>`;
|
||||
outputMasques += `<div data-idpartition="${partition.id}"><div data-idpartition="${partition.id}" data-idgroupe=aucun>Non affectés - ${partition.partition_name}</div>`;
|
||||
|
||||
// Groupes
|
||||
outputGroupes += `
|
||||
<div class=partition data-idpartition="${idPartition}">
|
||||
<div class=partition data-idpartition="${partition.id}">
|
||||
<h3>${partition.partition_name}</h3>
|
||||
<div class=groupe data-idgroupe=aucun>
|
||||
<div>Non affecté(s)</div>
|
||||
<div class=etudiants></div>
|
||||
</div>
|
||||
${(() => {
|
||||
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 += `<div data-idgroupe="${idGroupe}"><span class="editing move">||</span><span>${titreGroupe.name}</span><span class="editing modif">✏️</span><span class="editing suppr">❌</span></div>`;
|
||||
outputMasques += `<div data-idgroupe="${groupe.id}"><span class="editing move">||</span><span>${groupe.name}</span><span class="editing modif">✏️</span><span class="editing suppr">❌</span></div>`;
|
||||
/***************/
|
||||
output += templateGroupe_zoneGroupes(idGroupe, titreGroupe.name);
|
||||
output += templateGroupe_zoneGroupes(groupe.id, groupe.name);
|
||||
})
|
||||
return output;
|
||||
})()}
|
||||
@ -115,26 +122,29 @@
|
||||
<div class=nom data-etudid="${etudiant.etudid}" data-nom="${etudiant.nom_disp}" data-prenom="${etudiant.prenom}">${etudiant.nom_disp} ${etudiant.prenom}<br><small>${etudiant.bac}</small></div>
|
||||
${(() => {
|
||||
let output = "<div class=grpPartitions>";
|
||||
Object.entries(partitions).forEach(([idPartition, dataPartition]) => {
|
||||
arrayPartitions.forEach((partition) => {
|
||||
output += `
|
||||
<div class=partition data-idpartition="${idPartition}">
|
||||
<div>${dataPartition.partition_name}</div>
|
||||
<div class=partition data-idpartition="${partition.id}">
|
||||
<div>${partition.partition_name}</div>
|
||||
${(() => {
|
||||
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 += `
|
||||
<label><input type=radio name="${idPartition}-${etudiant.etudid}" value="${idGroupe}" ${(etudiant.partitions[idPartition] == idGroupe) ? "checked" : ""}><span>${titreGroupe.name}</span></label>`;
|
||||
<label><input type=radio name="${partition.id}-${etudiant.etudid}" value="${groupe.id}" ${(etudiant.partitions[partition.id] == groupe.id) ? "checked" : ""}><span>${groupe.name}</span></label>`;
|
||||
|
||||
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 `<label title="Aucun groupe"><input type=radio name="${idPartition}-${etudiant.etudid}" value="aucun" ${(!affected) ? "checked" : ""}><span class=aucun>❌</span></label>` + output;
|
||||
return `<label title="Aucun groupe"><input type=radio name="${partition.id}-${etudiant.etudid}" value="aucun" ${(!affected) ? "checked" : ""}><span class=aucun>❌</span></label>` + output;
|
||||
})()}
|
||||
</div>`;
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user