Implement standings freezing

This commit is contained in:
Claude Brisson
2024-08-20 11:48:29 +02:00
parent 15257028c0
commit bae30c7465
11 changed files with 98 additions and 54 deletions

View File

@@ -24,6 +24,16 @@ function publishHtml() {
close_modal();
}
function freeze() {
api.put(`tour/${tour_id}/standings/${activeRound}`, {}
).then(resp => {
if (resp.ok) {
document.location.reload();
}
else throw "freeze error"
}).catch(err => showError(err));
}
onLoad(() => {
new Tablesort($('#standings-table')[0]);
$('.criterium').on('click', e => {
@@ -86,4 +96,7 @@ onLoad(() => {
$('.publish-html').on('click', e => {
publishHtml();
});
$('#freeze').on('click', e => {
freeze()
});
});

View File

@@ -105,6 +105,12 @@
</table>
</div>
<div class="right form-actions">
#if(!$tour.frozen && $round == $tour.rounds)
<button id="freeze" class="ui orange floating right labeled icon button">
<i class="snowflake plane outline icon"></i>
Freeze
</button>
#end
<button id="publish" class="ui yellow floating right labeled icon button">
<i class="paper plane outline icon"></i>
Publish