<div class="row">
  <div class="col-12">
    <h1><%= test.name %></h1>
  </div>

  <div class="col-12">
    <p><a href="/test/<%= test.id %>/edit">Edit</a></p>
  </div>

  <div class="col-12">
    <p>Hardware tested: <a href="/hardware/<%= test.hardware.id %>"><%= test.hardware.name %></a></p>
  </div>

  <div class="col-12">
    <p><%= test.description %></p>
  </div>
</div>

<hr>

<div class="row">
  <div class="col-12">
    <form action="/result/add" method="post">
      <input type="hidden" name="result_test" value="<%= test.id %>">
      <input type="hidden" name="result_referrer" value="test">

      <div class="row">
        <div class="col-12 col-md-5 mb-3 mb-md-0">
          <label for="result_benchmark">Add benchmark result:</label>
          <select class="form-select" id="result_benchmark" name="result_benchmark">
            <% test.benchmark_profiles.each do |b| %>
              <option value="<%= b.id %>"><%= b.display_name %></option>
            <% end %>
          </select>
        </div>

        <div class="col-4 col-md-2">
          <label for="result_average">Average score:</label>
          <input id="result_average" class="form-control" type="text" name="result_average" value="">
        </div>

        <div class="col-4 col-md-2">
          <label for="result_minimum">Minimum score:</label>
          <input id="result_minimum" class="form-control" type="text" name="result_minimum" value="">
        </div>

        <div class="col-4 col-md-2 mb-3 mb-md-0">
          <label for="result_maximum">Maximum score:</label>
          <input id="result_maximum" class="form-control" type="text" name="result_maximum" value="">
        </div>

        <div class="col-12 col-md-1 d-flex align-items-stretch mb-3 mb-md-0">
          <input class="btn btn-primary w-100" type="submit" value="Submit">
        </div>
      </div>
    </form>

    <hr>

    <h4>Benchmark results for this test:</h4>

    <table id="results-table" class="table table-hover table-responsive" data-test-id="<%= test.id %>">
      <thead class="table-light">
        <tr>
          <th>Benchmark name</th>
          <th>Scoring type</th>
          <th># results</th>
          <th>Average</th>
          <th>Minimum</th>
          <th>Maximum</th>
        </tr>
      </thead>
      <tbody>
        <% test.benchmark_profiles.each do |bp| %>
          <tr data-benchmark-id="<%= bp.id %>"></tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>

<!-- load test data fetching functionality -->
<script src="/js/test.js" charset="utf-8"></script>
