@extends('layouts.admin')

@section('title')

  Partite giornata {{$day}} {{$type}}

@stop

@section('content')

    <form action="/admin/calendars/games/{{$id}}/{{$day}}/{{$type}}" method="POST">
      {{csrf_field()}}      
	   <div class="row">
        <div class="col-xs-12">
          <div class="box">

            <div class="box-body table-responsive no-padding">
              <table class="table table-striped table-hover">
                <tr>
                  <th>Data</th>
                  <th>In casa</th>
                  <th>Trasferta</th>
                  <th>Risultato</th>                  
                </tr>
                @foreach($games as $gg)
                  <tr>
                    <td>
                      <input name="date_{{$gg->id}}" value="{{date("d/m/Y", strtotime($gg->date))}}" class="form-control" style="width:100px;display:inline;">                      
                    </td>
                    <td>{!!$gg->getHomeTeam()->name!!}</td>
                    <td>{!!$gg->getAwayTeam()->name!!}</td>
                    <td>
                      @if($gg->home_team_id != NULL && $gg->away_team_id != NULL)
                        <input name="home_goals_{{$gg->id}}" type="text" class="form-control" value="{{$gg->home_goals}}" style="width:40px;display:inline;">&nbsp;-&nbsp;<input name="away_goals_{{$gg->id}}" type="text" class="form-control" style="width:40px;display:inline;" value="{{$gg->away_goals}}">
                        @if($gg->played)
                          <input style="margin-left:30px" type="checkbox" name="delete_{{$gg->id}}"> Elimina
                        @endif
                      @endif
                    </td>
                  </tr>
                @endforeach
              </table>
            </div>
          </div>

        </div>
        <div class="col-xs-6">
          <button type="submit" class="btn btn-success">Salva</button>
          <a href="{{ route('calendars.games', array($id)) }}" class="btn btn-info">Indietro</a>
        </div>
        
      </div>
    </form>
@stop
