<div class="row">
  <div class="col-xs-10">
    <div class="page-header">
      <h1>Tier {{currentTier}} <small>poule {{currentPoule}}</small></h1>
    </div>
  </div>
  <div class="col-xs-2">
    <div class="checkbox">
      <label>
        <input type="checkbox" ng-model="currentCyclingSetting" name="cyclingcheckbox" ng-change="setCyclingPouleView(currentCyclingSetting)" ng-true-value="true" ng-false-value="false"]><small>Cycle poules</small>
      </label>
      <small>in</small> <input type="number" ng-model="cycletime" min="5" max="300" required="string" ng-change="cyclingPouleTimeChanged(cycletime)"> <small>s</small>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-sm-12">
    <div class="team-col pull-left" ng-repeat="team in teamsInPoule" ng-style="{'width':(100/teamsInPoule.length)+'%'}">
      <h2>{{team.teamname}}</h2>
      <div ng-repeat="race in team.races">

        <div class="panel panel-default" ng-class="{'panel-success':bestOfTwo(race, team.races)=='best', 'panel-danger':bestOfTwo(race, team.races)=='notthebest'}">
          <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-flag-o"></i> Race {{$index+1}}</h3>
          </div>
          <div class="panel-body">
            <div ng-show="race.laptimes.length>0" ng-repeat="laptime in race.laptimes | orderBy:'lapnr'">
              <span><small>{{laptime.lapnr}}:</small> {{laptime.laptime | secondsToString}} <span ng-show="laptime.totalpenalty>0" class="label label-danger">+{{laptime.totalpenalty}}s</span></span>
            </div>
            <div ng-show="race.laptimes.length==0" class="text-center"><span class="glyphicon glyphicon-glass"> </span></div>
          </div>
          <div class="panel-footer" ng-show="race.laptimes.length>0">
            <strong><small>Racetijd:</small> {{race.sumlaptime | secondsToString}}</strong>
          </div>
        </div>
      </div>

      <!-- block to show average of best of two -->
      <div ng-show="getAverageOfBestOfTwo(team.races)!=undefined" class="alert alert-info" role="alert"><i class="fa fa-flag-checkered fa-lg"></i>  Eindgemiddelde: <strong>{{getAverageOfBestOfTwo(team.races)|secondsToString}}</strong></div>
    </div>
  </div>
</div
