Table numbers exclusion: handle saving
This commit is contained in:
@@ -405,6 +405,10 @@
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
.tables-exclusion {
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
/* results section */
|
||||
|
||||
#results-filter {
|
||||
|
@@ -1,12 +1,31 @@
|
||||
let focused = undefined;
|
||||
|
||||
function pair(parts) {
|
||||
api.postJson(`tour/${tour_id}/pair/${activeRound}`, parts)
|
||||
.then(rst => {
|
||||
if (rst !== 'error') {
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
let doWork = () => {
|
||||
api.postJson(`tour/${tour_id}/pair/${activeRound}`, parts)
|
||||
.then(rst => {
|
||||
if (rst !== 'error') {
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let tablesExclusionControl = $('#exclude-tables');
|
||||
let value = tablesExclusionControl[0].value;
|
||||
let origValue = tablesExclusionControl.data('orig');
|
||||
if (value === origValue) {
|
||||
// tables exclusion value did not change
|
||||
doWork();
|
||||
} else {
|
||||
// tables exclusion value has change, we must save it first
|
||||
api.putJson(`tour/${tour_id}`, { round: activeRound, excludeTables: value })
|
||||
.then(rst => {
|
||||
if (rst !== 'error') {
|
||||
doWork();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function unpair(games) {
|
||||
|
@@ -22,6 +22,14 @@
|
||||
<button class="ui floating choose-round next-round button">»</button>
|
||||
</div>
|
||||
<div class="pairing-stats nobreak">( $pairables.size() pairable, $games.size() games )</div>
|
||||
<div class="tables-exclusion">
|
||||
#if($tour.tablesExclusion && $round <= $tour.tablesExclusion.size())
|
||||
#set($tablesExclusion = $!tour.tablesExclusion[$round - 1])
|
||||
#else
|
||||
#set($tablesExclusion = '')
|
||||
#end
|
||||
Exclude table numbers: <input type="text" id="exclude-tables" name="exclude-tables" placeholder="ex: 1-34, 38, 45-77" data-orig="$tablesExclusion" value="$tablesExclusion"/>
|
||||
</div>
|
||||
<div id="pairing-lists">
|
||||
<div id="pairing-left">
|
||||
<div id="pairables" class="multi-select" title="pairable players">
|
||||
|
Reference in New Issue
Block a user