Files
cheesy-arena-lite/templates/match_play.html
2014-07-10 23:03:03 -07:00

157 lines
6.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{define "title"}}Match Play{{end}}
{{define "body"}}
<div class="row">
<div class="col-lg-4">
<a href="/match_play/0/load"><b class="btn btn-info">Load Test Match</b></a><br /><br />
<ul class="nav nav-tabs" style="margin-bottom: 15px;">
<li{{if eq .CurrentMatchType "practice" }} class="active"{{end}}>
<a href="#practice" data-toggle="tab">Practice</a>
</li>
<li{{if eq .CurrentMatchType "qualification" }} class="active"{{end}}>
<a href="#qualification" data-toggle="tab">Qualification</a>
</li>
<li{{if eq .CurrentMatchType "elimination" }} class="active"{{end}}>
<a href="#elimination" data-toggle="tab">Elimination</a>
</li>
</ul>
<div class="tab-content">
{{range $type, $matches := .MatchesByType}}
<div class="tab-pane {{if eq $.CurrentMatchType $type }} active{{end}}" id="{{$type}}">
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>Match</th>
<th>Time</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{{range $match := $matches}}
<tr class="{{$match.ColorClass}}">
<td>{{$match.DisplayName}}</td>
<td>{{$match.Time}}</td>
<td style="white-space: nowrap;">
<a href="/match_play/{{$match.Id}}/load">
<b class="btn btn-info btn-xs">Load</b>
</a>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
</div>
</div>
<div class="col-lg-8 text-center">
<div class="row">
<div id="matchState" class="col-lg-2 col-lg-offset-4 well well-sm">&nbsp;</div>
<div id="matchTime" class="col-lg-2 well well-sm">&nbsp;</div>
</div>
<div class="row">
<div class="col-lg-6 well well-darkblue">
<div class="row form-group">
<div class="col-lg-4">Blue Teams</div>
<div class="col-lg-2" data-toggle="tooltip" title="Driver Station">DS</div>
<div class="col-lg-2" data-toggle="tooltip" title="Robot">R</div>
<div class="col-lg-2" data-toggle="tooltip" title="Battery">B</div>
<div class="col-lg-2" data-toggle="tooltip" title="Bypass/Disable">Byp</div>
</div>
{{template "matchPlayTeam" dict "team" .Match.Blue1 "color" "B" "position" 1 "data" .}}
{{template "matchPlayTeam" dict "team" .Match.Blue2 "color" "B" "position" 2 "data" .}}
{{template "matchPlayTeam" dict "team" .Match.Blue3 "color" "B" "position" 3 "data" .}}
</div>
<div class="col-lg-6 well well-darkred">
<div class="row form-group">
<div class="col-lg-4">Red Teams</div>
<div class="col-lg-2" data-toggle="tooltip" title="Driver Station">DS</div>
<div class="col-lg-2" data-toggle="tooltip" title="Robot">R</div>
<div class="col-lg-2" data-toggle="tooltip" title="Battery">B</div>
<div class="col-lg-2" data-toggle="tooltip" title="Bypass/Disable">Byp</div>
</div>
{{template "matchPlayTeam" dict "team" .Match.Red3 "color" "R" "position" 3 "data" .}}
{{template "matchPlayTeam" dict "team" .Match.Red2 "color" "R" "position" 2 "data" .}}
{{template "matchPlayTeam" dict "team" .Match.Red1 "color" "R" "position" 1 "data" .}}
</div>
</div>
<div>
<button type="button" id="startMatch" class="btn btn-success btn-lg btn-match-play"
onclick="startMatch();" disabled>
Start Match
</button>
<button type="button" id="abortMatch" class="btn btn-primary btn-lg btn-match-play"
onclick="abortMatch();" disabled>
Abort Match
</button>
<button type="button" id="commitResults" class="btn btn-info btn-lg btn-match-play"
onclick="{{if .IsReplay}}$('#confirmCommitResults').modal('show');{{else}}commitResults();{{end}}"
disabled>
Commit Results
</button>
<button type="button" id="discardResults" class="btn btn-danger btn-lg btn-match-play"
onclick="$('#confirmDiscardResults').modal('show');" disabled>
Discard Results
</button>
</div>
</div>
</div>
<div id="confirmCommitResults" class="modal" style="top: 20%;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Confirm</h4>
</div>
<div class="modal-body">
<p>This is a replay of Match {{.Match.DisplayName}}. Are you sure you want to overwrite the previous
results?</p>
</div>
<div class="modal-footer">
<form class="form-horizontal" action="/setup/teams/clear" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" onclick="discardResults();">Overwrite Results</button>
</form>
</div>
</div>
</div>
</div>
<div id="confirmDiscardResults" class="modal" style="top: 20%;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Confirm</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to discard the results for this match?</p>
</div>
<div class="modal-footer">
<form class="form-horizontal" action="/setup/teams/clear" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" onclick="discardResults();">Discard Results</button>
</form>
</div>
</div>
</div>
</div>
{{end}}
{{define "script"}}
<script src="/static/js/match_play.js"></script>
{{end}}
{{define "matchPlayTeam"}}
<div class="row form-group" id="status{{.color}}{{.position}}">
<div class="col-lg-1">{{.position}} </div>
<div class="col-lg-3">
<input type="text" class="form-control input-sm" value="{{if ne 0 .team}}{{.team}}{{end}}"
onblur="substituteTeam($(this).val(), '{{.color}}{{.position}}');"
{{if not .data.AllowSubstitution}}disabled{{end}}>
</div>
<div class="col-lg-2 col-no-padding"><div class="ds-status"></div></div>
<div class="col-lg-2 col-no-padding"><div class="robot-status"></div></div>
<div class="col-lg-2 col-no-padding"><div class="battery-status"></div></div>
<div class="col-lg-2 col-no-padding">
<div class="bypass-status" onclick="toggleBypass('{{.color}}{{.position}}');"></div>
</div>
</div>
{{end}}