Options de configuration partitions

This commit is contained in:
Sébastien Lehmann 2023-02-15 21:27:00 +01:00
parent abcb3d0fd2
commit 3536710974
2 changed files with 64 additions and 1 deletions

View File

@ -297,6 +297,33 @@ body.editionActivated .filtres>div>div>div>div {
border-radius: 8px; border-radius: 8px;
margin-bottom: 8px; margin-bottom: 8px;
position: relative; position: relative;
display: grid;
grid-template-columns: 1fr auto;
}
#zonePartitions .filtres .config {
grid-row: 1 / span 2;
grid-column: 2 / 3;
background: #424242;
color: #fff;
border-radius: 4px;
margin-left: 4px;
padding: 4px;
display: none;
}
.editionActivated #zonePartitions .filtres .config {
display: block;
}
#zonePartitions .filtres .config label{
display: block;
background: #ddd;
border-radius: 4px;
padding: 2px;
color: #000;
margin-top: 2px;
cursor: pointer;
} }
#zonePartitions .filtres .groupes { #zonePartitions .filtres .groupes {

View File

@ -182,7 +182,20 @@
Non affectés Non affectés
</div> </div>
<div class="editing ajoutGroupe">+</div> <div class="editing ajoutGroupe">+</div>
</div>`; </div>
<!-- Config -->
<div class=config>
Configuration
<hr>
<label>
<input class=rang type=checkbox ${partition.bul_show_rank?"checked":""} data-attr=bul_show_rank> Rang bulletins
</label>
<label>
<input class=groupe type=checkbox ${partition.show_in_lists?"checked":""} data-attr=show_in_lists> Groupes bulletins et tableaux
</label>
</div>
`;
div.querySelector(".move").addEventListener("mousedown", moveStart); div.querySelector(".move").addEventListener("mousedown", moveStart);
div.querySelector(".modif").addEventListener("click", editText); div.querySelector(".modif").addEventListener("click", editText);
@ -190,6 +203,8 @@
div.querySelector(".onoff").addEventListener("click", masquerPartitions); div.querySelector(".onoff").addEventListener("click", masquerPartitions);
div.querySelector("[data-idgroupe]").addEventListener("click", filtre); div.querySelector("[data-idgroupe]").addEventListener("click", filtre);
div.querySelector(".ajoutGroupe").addEventListener("click", addGroupe); div.querySelector(".ajoutGroupe").addEventListener("click", addGroupe);
div.querySelector(".rang").addEventListener("input", setAttribute);
div.querySelector(".groupe").addEventListener("input", setAttribute);
return div; return div;
} }
@ -797,6 +812,27 @@
}) })
} }
/*****************/
/* Config */
/*****************/
function setAttribute() {
fetch("partition_set_attr",
{
method: "post",
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: `partition_id=${this.closest("[data-idpartition]").dataset.idpartition}&attr=${this.dataset.attr}&value=${this.checked?1:0}`
}
).then(function(response) {
return response.text();
})
.then(function(txt) {
message(txt);
});
}
/*************************/ /*************************/
/* Message */ /* Message */
/*************************/ /*************************/