2014-09-06 17:38:21 -07:00
|
|
|
|
{{/*
|
|
|
|
|
|
Copyright 2014 Team 254. All Rights Reserved.
|
|
|
|
|
|
Author: pat@patfairbank.com (Patrick Fairbank)
|
|
|
|
|
|
|
|
|
|
|
|
UI for generating a match schedule.
|
|
|
|
|
|
*/}}
|
2014-06-08 21:47:31 -07:00
|
|
|
|
{{define "title"}}Match Scheduling{{end}}
|
|
|
|
|
|
{{define "body"}}
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
{{if .ErrorMessage}}
|
|
|
|
|
|
<div class="alert alert-dismissable alert-danger">
|
|
|
|
|
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
|
|
|
|
{{.ErrorMessage}}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{{end}}
|
|
|
|
|
|
<div class="col-lg-5">
|
|
|
|
|
|
<div class="well">
|
|
|
|
|
|
<form id="scheduleForm" class="form-horizontal" action="/setup/schedule/save" method="POST">
|
|
|
|
|
|
<fieldset>
|
|
|
|
|
|
<legend>Schedule Parameters</legend>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-lg-5 control-label">Match Type</label>
|
|
|
|
|
|
<div class="col-lg-7">
|
|
|
|
|
|
<div class="radio">
|
|
|
|
|
|
<label>
|
|
|
|
|
|
<input type="radio" name="matchType" value="practice"
|
|
|
|
|
|
{{if eq .MatchType "practice"}}checked{{end}}>
|
|
|
|
|
|
Practice
|
|
|
|
|
|
</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="radio">
|
|
|
|
|
|
<label>
|
|
|
|
|
|
<input type="radio" name="matchType" value="qualification"
|
|
|
|
|
|
{{if eq .MatchType "qualification"}}checked{{end}}>
|
|
|
|
|
|
Qualification
|
|
|
|
|
|
</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="blockContainer"></div>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
<b>Total match count: <span id="totalNumMatches">0</span></b><br />
|
|
|
|
|
|
<b>Matches per team: <span id="matchesPerTeam">0</span></b><br />
|
|
|
|
|
|
<b>Excess matches: <span id="numExcessMatches">0</span></b><br />
|
|
|
|
|
|
<b>Matches needed for +1 per team: <span id="nextLevelMatches">0</span></b>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<div class="col-lg-12">
|
2014-06-28 22:03:30 -07:00
|
|
|
|
<button type="button" class="btn btn-default" onclick="addBlock();">Add Block</button>
|
|
|
|
|
|
<button type="button" class="btn btn-info" onclick="generateSchedule();">
|
2014-06-08 21:47:31 -07:00
|
|
|
|
Generate Schedule
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button type="submit" class="btn btn-primary">Save Schedule</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2016-10-06 15:00:14 -07:00
|
|
|
|
{{if .EventSettings.TbaPublishingEnabled}}
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
|
<button type="button" class="btn btn-info" onclick="$('#confirmPublishSchedule').modal('show');">
|
|
|
|
|
|
Publish Schedule to TBA
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{{end}}
|
2014-06-08 21:47:31 -07:00
|
|
|
|
</fieldset>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-lg-5">
|
|
|
|
|
|
<table class="table table-striped table-hover ">
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<th>Match</th>
|
|
|
|
|
|
<th>Type</th>
|
|
|
|
|
|
<th>Time</th>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
{{range $match := .Matches}}
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>{{$match.DisplayName}}</td>
|
|
|
|
|
|
<td>{{$match.Type}}</td>
|
|
|
|
|
|
<td>{{$match.Time}}</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
{{end}}
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-lg-2">
|
|
|
|
|
|
<table class="table table-striped table-hover ">
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<th>Team</th>
|
|
|
|
|
|
<th>First Match</th>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
{{range $team, $firstMatch := .TeamFirstMatches}}
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>{{$team}}</td>
|
|
|
|
|
|
<td>{{$firstMatch}}</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
{{end}}
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="blockTemplate" style="display: none;">
|
|
|
|
|
|
<div class="well well-sm" id="block{{"{{blockNumber}}"}}">
|
|
|
|
|
|
<b>Block {{"{{blockNumber}}"}}</b>
|
|
|
|
|
|
<button type="button" class="close" onclick="deleteBlock({{"{{blockNumber}}"}});">×</button><br /><br />
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-lg-4 control-label">Start Time</label>
|
|
|
|
|
|
<div class="col-lg-8">
|
|
|
|
|
|
<div class="input-group date" id="startTimePicker{{"{{blockNumber}}"}}"
|
|
|
|
|
|
data-date-format="YYYY-MM-DD hh:mm:ss A" onchange="updateBlock({{"{{blockNumber}}"}});">
|
2014-06-10 21:56:58 -07:00
|
|
|
|
<input type="text" class="form-control input-sm" id="startTime{{"{{blockNumber}}"}}"
|
2014-06-08 21:47:31 -07:00
|
|
|
|
onchange="updateBlock({{"{{blockNumber}}"}});">
|
2014-06-10 21:56:58 -07:00
|
|
|
|
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
|
2014-06-08 21:47:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-lg-4 control-label">End Time</label>
|
|
|
|
|
|
<div class="col-lg-8">
|
|
|
|
|
|
<div class="input-group date" id="endTimePicker{{"{{blockNumber}}"}}"
|
|
|
|
|
|
data-date-format="YYYY-MM-DD hh:mm:ss A" onchange="updateBlock({{"{{blockNumber}}"}});">
|
2014-06-10 21:56:58 -07:00
|
|
|
|
<input type="text" class="form-control input-sm" id="endTime{{"{{blockNumber}}"}}"
|
2014-06-08 21:47:31 -07:00
|
|
|
|
onchange="updateBlock({{"{{blockNumber}}"}});">
|
2014-06-10 21:56:58 -07:00
|
|
|
|
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
|
2014-06-08 21:47:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
2015-03-28 18:22:06 -07:00
|
|
|
|
<label class="col-lg-4 control-label">Cycle Time (m:s)</label>
|
2014-06-08 21:47:31 -07:00
|
|
|
|
<div class="col-lg-8">
|
2015-03-28 18:22:06 -07:00
|
|
|
|
<input type="text" class="form-control input-sm" id="matchSpacingMinSec{{"{{blockNumber}}"}}"
|
|
|
|
|
|
value="{{"{{matchSpacingMinSec}}"}}" placeholder="6:00" onchange="updateBlock({{"{{blockNumber}}"}});">
|
2014-06-08 21:47:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<div class="col-lg-5">Match count: <span id="numMatches{{"{{blockNumber}}"}}"></span></div>
|
|
|
|
|
|
<div class="col-lg-7">Actual end time: <span id="actualEndTime{{"{{blockNumber}}"}}"></span></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2016-10-06 15:00:14 -07:00
|
|
|
|
<div id="confirmPublishSchedule" 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 publish the schedule to The Blue Alliance? This will overwrite any
|
|
|
|
|
|
existing matches and their data.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
|
<form class="form-horizontal" action="/setup/schedule/republish" method="POST">
|
|
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
|
|
|
|
<button type="submit" class="btn btn-primary">Publish Schedule</button>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2014-06-08 21:47:31 -07:00
|
|
|
|
{{end}}
|
|
|
|
|
|
{{define "script"}}
|
|
|
|
|
|
<script>var numTeams = {{.NumTeams}};</script>
|
|
|
|
|
|
<script src="/static/js/setup_schedule.js"></script>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
{{range $block := .ScheduleBlocks}}
|
|
|
|
|
|
addBlock(moment(Date.parse({{$block.StartTime}})), {{$block.NumMatches}}, {{$block.MatchSpacingSec}});
|
|
|
|
|
|
{{end}}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
{{end}}
|