Files
pairgoth/view-webapp/src/main/webapp/tour-standings.inc.html

149 lines
4.9 KiB
HTML

#macro(placement $i, $p)
<span class="info"></span>
<select name="crit-$i" data-initial="$p" class="short-value">
#foreach($crit in $$utils.criteria.entrySet())
<option value="$crit.key" data-tooltip="$crit.value" #if($p == $crit.key)selected#end>$crit.key - $crit.value</option>
#end
</select>
#end
<div class="tab-content" id="standings-tab">
<div id="standings-round" class="active-round-box">
Standings after 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 id="standings-params" class="roundbox">
<form id="params-form" class="ui form">
<div class="inline fields">
#foreach($placement in $tour.pairing.placement)
<div class="criterium field">
#set($num = $foreach.index + 1)
<label>Crit #$num</label>
#placement($num $placement)
</div>
#end
</div>
<div id="params-submit" class="hidden centered inline fields">
<button type="button" class="ui gray floating cancel button">Cancel</button>
<button type="submit" class="ui blue floating button">Change</button>
</div>
</form>
</div>
<div id="standings-container" class="roundbox">
#set($standings = $api.get("tour/${params.id}/standings/$round"))
#if($standings.isObject() && ($standings.error || $standings.message))
#if($standings.error)
#set($error = $standings.error)
#else
#set($error = $standings.message)
#end
<script type="text/javascript">
onLoad(() => {
showError("$error")
});
</script>
#set($standings = [])
#end
#set($smap = {})
#foreach($part in $standings)
#set($smap[$part.num] = $part)
#end
<table id="standings-table" class="ui striped table">
<thead>
<th>Num</th>
<th>Plc</th>
<th>Name</th>
<th>Rank</th>
<th>Ctr</th>
<th>Nbw</th>
#foreach($r in [1..$round])
<th>R$r</th>
#end
#set($criteres = [])
#foreach($crit in $tour.pairing.placement)
#set($junk = $criteres.add($crit))
#end
#if($criteres[0] == 'SCOREX')
#set($junk = $criteres.add(1, 'MMS'))
#end
#foreach($crit in $criteres)
<th>$crit</th>
#end
</thead>
<tbody>
#foreach($part in $standings)
<tr data-id="$part.id">
<td>$part.num</td>
<td>$part.place</td>
<td>$esc.html($part.name)#if($part.firstname) $esc.html($part.firstname)#end</td>
<td data-sort="$part.rank">#rank($part.rank)</td>
<td>#if($part.country)$part.country#end</td>
<td>$number.format('0.#', $part.NBW)</td>
#set($mx = $round - 1)
#foreach($r in [0..$mx])
#set($rst = $part.results[$r])
#set($opp_num = $math.toLong($rst))
#if($opp_num)
#set($opponent = $!smap[$opp_num])
#else
#set($opponent = false)
#end
#if($rst.contains('+'))
#set($rst = "<b>$rst</b>")
#elseif($rst.contains('-'))
#set($rst = "<i>$rst</i>")
#end
<td class="nobreak game-result" #if($opponent)title="$esc.html($opponent.name)#if($opponent.firstname) $esc.html($opponent.firstname)#end #rank($opponent.rank)#if($opponent.country) $opponent.country#end"#end>$rst</td>
#end
#foreach($crit in $criteres)
#set($value = "$number.format('0.#', $part[$crit])")
<td data-sort="$value">$value.replace('.5', '½')</td>
#end
</tr>
#end
</tbody>
</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
</button>
</div>
</div>
<div id="publish-modal" class="popup">
<div class="popup-body">
<div class="popup-header">
Publish standings
</div>
<div class="popup-content">
#if($round < $tour.rounds)
<div class="warning">Warning: publishing partial results at round <span>$round</span> / <span>$tour.rounds</span>!</div>
#end
<form class="ui edit form">
<div class="field">
<label>Choose format</label>
<div class="inline fields">
<button type="button" class="ui blue floating publish-html button">HTML</button>
<button type="button" class="ui blue floating publish-csv button">CSV</button>
<button type="button" class="ui blue floating publish-egf button">EGF</button>
<button type="button" class="ui blue floating publish-ffg button">FFG</button>
</div>
</div>
</form>
</div>
<div class="popup-footer">
<div class="form-actions">
<button type="button" class="ui gray floating close button">Cancel</button>
</div>
</div>
</div>
</div>