Handle clicks on participation disks
This commit is contained in:
@@ -101,6 +101,7 @@
|
|||||||
.participation {
|
.participation {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
.ui.label {
|
.ui.label {
|
||||||
|
cursor: pointer;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
min-width: 2em;
|
min-width: 2em;
|
||||||
min-height: 2em;
|
min-height: 2em;
|
||||||
|
@@ -249,7 +249,7 @@ onLoad(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#players > tbody > tr').on('click', e => {
|
$('#players > tbody > tr').on('click', e => {
|
||||||
let regStatus = e.target.closest('td.reg-status');
|
let regStatus = e.target.closest('td.reg-status, td.participating');
|
||||||
if (regStatus) return;
|
if (regStatus) return;
|
||||||
let id = e.target.closest('tr').attr('data-id');
|
let id = e.target.closest('tr').attr('data-id');
|
||||||
api.getJson(`tour/${tour_id}/part/${id}`)
|
api.getJson(`tour/${tour_id}/part/${id}`)
|
||||||
@@ -472,4 +472,25 @@ onLoad(() => {
|
|||||||
$('.player-fields').on('change input', e => {
|
$('.player-fields').on('change input', e => {
|
||||||
$('#register').removeClass('disabled');
|
$('#register').removeClass('disabled');
|
||||||
});
|
});
|
||||||
|
$('.participation label').on('click', e => {
|
||||||
|
let part = e.target;
|
||||||
|
let id = part.closest('tr').data('id');
|
||||||
|
let round = parseInt(part.text());
|
||||||
|
let skip = new Set(part.closest('.participation').find('label.red').map(it => parseInt(it.innerText)));
|
||||||
|
if (skip.has(round)) skip.delete(round);
|
||||||
|
else skip.add(round);
|
||||||
|
api.putJson(`tour/${tour_id}/part/${id}`, {
|
||||||
|
id: id,
|
||||||
|
skip: Array.from(skip)
|
||||||
|
}).then(player => {
|
||||||
|
if (player !== 'error') {
|
||||||
|
part.toggleClass('red');
|
||||||
|
part.toggleClass('green');
|
||||||
|
standingsUpToDate = false;
|
||||||
|
pairablesUpToDate = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user