Files
pairgoth/view-webapp/src/main/webapp/tour-pairing.inc.html
Claude Brisson 9a379052e5 Add user preference for black vs white display order
- Gear icon in header opens settings modal
- Preference stored in cookie for server-side Velocity rendering
- ViewServlet reads blackFirst cookie into Velocity context
- Velocity conditionals in pairing, results, and result-sheets templates
2025-11-30 10:54:52 +01:00

221 lines
8.5 KiB
HTML

#set($roundPairing = $api.get("tour/${params.id}/pair/$round"))
#if($roundPairing.error)
<script type="text/javascript">
onLoad(() => {
showError("$roundPairing.error")
});
</script>
#set($pairables = [])
#set($games = [])
#set($unpairables = [])
#else
#set($pairables = $roundPairing.pairables)
#set($games = $roundPairing.games)
#set($unpairables = $roundPairing.unpairables)
#if($tour.type.startsWith('TEAM'))
#set($individualGames = $roundPairing.individualGames)
#else
#set($individualGames = $games)
#end
#end
<div class="tab-content" id="pairing-tab">
<div id="pairing-content">
<div id="pairing-round" class="active-round-box">
Pairings for round
<button class="ui floating choose-round prev-round button">&laquo;</button>
<span class="active-round">$round</span>
<button class="ui floating choose-round next-round button">&raquo;</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 #if($tour.type == 'INDIVIDUAL')players#{else}teams#end">
#foreach($p in $pairables)
#set($part = $pmap[$p])
<div data-id="$part.id" class="listitem pairable"><span class="name">$part.name#if($part.firstname) $part.firstname#end</span><span>#rank($part.rank)#if($part.country) $part.country#end</span></div>
#end
</div>
<div id="unpairables" class="multi-select" title="unpairable #if($tour.type == 'INDIVIDUAL')players#{else}teams#end">
#foreach($p in $unpairables)
#set($part = $pmap[$p])
<div data-id="$part.id" class="listitem unpairable"><span class="name">$part.name#if($part.firstname) $part.firstname#end</span><span>#rank($part.rank)#if($part.country) $part.country#end</span></div>
#end
</div>
<div id="previous_games" class="hidden multi-select">
</div>
</div>
<div id="pairing-right">
<div class="pairing-buttons">
<button id="pair" class="ui blue right labeled icon floating button">
<i class="angle double right icon"></i>
Pair
</button>
<button id="unpair" class="ui orange right labeled icon floating button">
<i class="angle double left icon"></i>
Unpair
</button>
<button id="renumber-tables" class="ui right labeled icon floating button">
<i class="sync alternate icon"></i>
Renumber
</button>
</div>
<div>
<div id="paired" class="multi-select" title="#if($blackFirst)black vs. white#{else}white vs. black#end">##
#foreach($game in $games)
#set($white = $pmap[$game.w])
#set($black = $pmap[$game.b])
<div class="listitem game" data-id="$game.id">
<div class="table" data-value="$game.t">${game.t}.</div>
#if($blackFirst)
<div class="black" data-id="$game.b">#if($black)$black.name#if($black.firstname) $black.firstname#end#{else}BIP#end</div>
<div class="levels">#if($black)#rank($black.rank)#end&nbsp;/&nbsp;#if($white)#rank($white.rank)#end</div>
<div class="white" data-id="$game.w">#if($white)$white.name#if($white.firstname) $white.firstname#end#{else}BIP#end</div>
#else
<div class="white" data-id="$game.w">#if($white)$white.name#if($white.firstname) $white.firstname#end#{else}BIP#end</div>
<div class="levels">#if($white)#rank($white.rank)#end&nbsp;/&nbsp;#if($black)#rank($black.rank)#end</div>
<div class="black" data-id="$game.b">#if($black)$black.name#if($black.firstname) $black.firstname#end#{else}BIP#end</div>
#end
<div class="handicap" data-value="$game.h">#if($game.h)h$game.h#{else}&nbsp;#end</div>
</div>
#end##
#* *#</div>
#if(!$tour.type.startsWith('TEAM'))
<div class="pairing-post-actions">
<a href="result-sheets?id=${tour.id}&round=${round}" target="_blank" class="ui mini floating icon button">result sheets <i class="fa fa-external-link"></i></a>
<a href="explain?id=${tour.id}&round=${round}" target="_blank" class="ui mini floating icon button">explain pairing <i class="fa fa-external-link"></i></a>
</div>
#end
</div>
</div>
</div>
</div>
#if($games.size())
<div id="print-pairings">
<table class="ui striped table">
<thead>
<tr>
<th>Tbl</th>
#if($blackFirst)
<th>Black</th>
<th>White</th>
#else
<th>White</th>
<th>Black</th>
#end
<th>Hd</th>
</tr>
</thead>
<tbody>
#foreach($game in $games)
#set($white = $pmap[$game.w])
#set($black = $pmap[$game.b])
<tr>
<td class="t" data-table="${game.t}">${game.t}</td>
#if($blackFirst)
<td class="left">#if($black)${black.name} $!{black.firstname} (#rank($black.rank) $!black.country $!black.club)#{else}BIP#end</td>
<td class="left">#if($white)${white.name} $!{white.firstname} (#rank($white.rank) $!white.country $!white.club)#{else}BIP#end</td>
#else
<td class="left">#if($white)${white.name} $!{white.firstname} (#rank($white.rank) $!white.country $!white.club)#{else}BIP#end</td>
<td class="left">#if($black)${black.name} $!{black.firstname} (#rank($black.rank) $!black.country $!black.club)#{else}BIP#end</td>
#end
<td>${game.h}</td>
</tr>
#end
</tbody>
</table>
</div>
#end
</div>
<div id="edit-pairing" class="popup">
<div class="popup-body">
<form id="pairing-form" class="ui form edit">
<input type="hidden" name="id"/>
<input type="hidden" name="prev-table"/>
<div class="popup-content">
<div class="inline fields">
<div class="field">
<label>Tbl</label>
<span class="nobreak">#<input name="t" type="number"/></span>
</div>
<div class="field">
<label>White</label>
<input type="hidden" name="w"/>
<div id="edit-pairing-white"></div>
</div>
<div class="field">
<button id="pairing-exchange" type="button" class="ui icon button">
<i class="fa fa-exchange"></i>
</button>
</div>
<div class="field">
<label>Black</label>
<input type="hidden" name="b"/>
<div id="edit-pairing-black"></div>
</div>
<div class="field">
<label>Hd</label>
<select name="h">
#foreach($h in [0..9])
<option value="$h">$h</option>
#end
</select>
</div>
</div>
</div>
<div class="popup-footer">
<button id="cancel-pairing" type="button" class="ui gray right labeled icon floating close button">
<i class="times icon"></i>
Cancel
</button>
<button id="update-pairing" type="button" class="ui green right labeled icon floating button">
<i class="check icon"></i>
Update
</button>
</div>
</form>
</div>
</div>
<div id="edit-pairable" class="popup">
<div class="popup-body">
<form id="pairable-form" class="ui form edit">
<input type="hidden" name="id"/>
<div class="popup-content">
<div id="edit-pairable-disp"></div>
<div class="inline fields">
<div class="field">
<label>
Pairable for round $round?
<input type="checkbox" name="pairable"/>
</label>
</div>
</div>
</div>
<div class="popup-footer">
<button id="cancel-edit-pairable" type="button" class="ui gray right labeled icon floating close button">
<i class="times icon"></i>
Cancel
</button>
<button id="update-pairable" type="button" class="ui green right labeled icon floating button">
<i class="check icon"></i>
Update
</button>
</div>
</form>
</div>
</div>
## For dynamic texts to be translated, they must be somewhere in the html source.
## TODO - gather all "text only" nodes like this somewhere
<div id="previous_games_prefix" class="hidden">Games of </div>
<div id="previous_games_postfix" class="hidden"></div>