Merge pull request 'Options de configuration partitions' (#600) from lehmann/ScoDoc-Front:master into master

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/600
This commit is contained in:
Emmanuel Viennet 2023-02-15 21:54:18 +01:00
commit cc977da44e
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;
margin-bottom: 8px;
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 {

View File

@ -182,7 +182,20 @@
Non affectés
</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(".modif").addEventListener("click", editText);
@ -190,6 +203,8 @@
div.querySelector(".onoff").addEventListener("click", masquerPartitions);
div.querySelector("[data-idgroupe]").addEventListener("click", filtre);
div.querySelector(".ajoutGroupe").addEventListener("click", addGroupe);
div.querySelector(".rang").addEventListener("input", setAttribute);
div.querySelector(".groupe").addEventListener("input", setAttribute);
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 */
/*************************/