Pairing and unpairing functional

This commit is contained in:
Claude Brisson
2023-12-21 22:33:15 +01:00
parent 844f7aa699
commit a70e5df576
2 changed files with 40 additions and 12 deletions

View File

@@ -9,6 +9,15 @@ function pair(parts) {
});
}
function unpair(games) {
api.deleteJson(`tour/${tour_id}/pair/${activeRound}`, games)
.then(rst => {
if (rst !== 'error') {
document.location.reload();
}
});
}
onLoad(()=>{
$('.listitem').on('click', e => {
if (e.shiftKey && typeof(focused) !== 'undefined') {
@@ -34,4 +43,8 @@ onLoad(()=>{
let parts = $('#pairables')[0].childNodes.filter('.selected.listitem').map(item => parseInt(item.data("id")));
pair(parts);
});
$('#unpair').on('click', e => {
let games = $('#paired')[0].childNodes.filter('.selected.listitem').map(item => parseInt(item.data("id")));
unpair(games);
});
});