{{/*
  Copyright 2018 Team 254. All Rights Reserved.
  Author: pat@patfairbank.com (Patrick Fairbank)

  UI for testing the game sounds and the LEDs and PLC connected to the field.
*/}}
{{define "title"}}Field Testing{{end}}
{{define "body"}}
<div class="row">
  <div class="col-lg-3">
    <div class="well">
      <legend>Game Sounds</legend>
      {{range $sound := .MatchSounds}}
        <p>
          <button type="button" class="btn btn-sm btn-info btn-game-sound" onclick="playSound('{{$sound.Name}}');">
            <i class="glyphicon glyphicon-play"></i>&nbsp;&nbsp;{{toUpper $sound.Name}}
          </button>
        </p>
      {{end}}
    </div>
  </div>
  <div class="col-lg-7">
    <div class="well">
      <legend>PLC</legend>
      <div class="row">
        <div class="col-lg-4">
          <table class="table">
            <tr>
              <th colspan="2">Inputs</th>
            </tr>
            {{range $i, $name := .InputNames}}
            <tr>
              <td>{{$name}}</td>
              <td id="input{{$i}}" data-plc-value="false"></td>
            </tr>
            {{end}}
          </table>
        </div>
        <div class="col-lg-4">
          <table class="table">
            <tr>
              <th colspan="2">Registers</th>
            </tr>
            {{range $i, $name := .RegisterNames}}
            <tr>
              <td>{{$name}}</td>
              <td id="register{{$i}}"></td>
            </tr>
            {{end}}
          </table>
        </div>
        <div class="col-lg-4">
          <table class="table">
            <tr>
              <th colspan="2">Coils</th>
            </tr>
            {{range $i, $name := .CoilNames}}
            <tr>
              <td>{{$name}}</td>
              <td id="coil{{$i}}" data-plc-value="false"></td>
            </tr>
            {{end}}
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
{{end}}
{{define "script"}}
<script src="/static/js/setup_field_testing.js"></script>
{{end}}
