Files
pairgoth/view-webapp/src/main/webapp/tour-pairing.inc.html
Claude Brisson d4a937a2f6 Review printing
2024-06-17 12:09:56 +02:00

179 lines
6.4 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)
#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 id="pairing-lists">
<div id="pairing-left">
<div id="pairables" class="multi-select" title="pairable players">
#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 players">
#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>
<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="white vs. black">
#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>
<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>
<div class="handicap" data-value="$game.h">#if($game.h)h$game.h#{else}&nbsp;#end</div>
</div>
#end
</div>
<div class="result-sheets"><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></div>
</div>
</div>
</div>
</div>
#if($games.size())
<div id="print-pairings">
<table class="ui striped table">
<thead>
<tr>
<th>Tbl</th>
<th>White</th>
<th>Black</th>
<th>Hd</th>
</tr>
</thead>
<tbody>
#foreach($game in $games)
#set($white = $pmap[$game.w])
#set($black = $pmap[$game.b])
<tr>
<td>${game.t}</td>
<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>
<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"/>
<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>