@extends('layouts.admin')

@section('title')

  Pubblicità Evento {{$event->name}}

@stop

@section('content')

    @foreach($aDatas as $idx => $data)
    <div class="row"> 
    <div class="col-xs-2">
      <h2>{{$idx}}</h2>
     </div>
     <div class="col-xs-10 text-right">
      <br><a href="{{ route('events.advs.create', $event) }}?position={{$idx}}" class="btn btn-success">Aggiungi</a>
     </div>
    </div>
    <div class="row">
     <div class="col-xs-2">
       <img src="/images/{{str_replace(" ", "", $idx)}}.png" style="max-width:180px">
     </div>
     <div class="col-xs-10">
	      <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>Nome</th>
                  <th>Google</th>
                  <th>Immagine</th>
                  <th>Online</th>
                  <th width="50"></th>
                  <th width="50"></th>
                </tr>
                @foreach($data as $adv)
                  <tr>
                    <td>{{$adv->name}}</td>
                    <td>{{$adv->google_code}}</td>
                    <td>
                      @if($adv->image != '')
                        <img src="/files/adv/{{$adv->image}}" style="max-width:250px" />
                      @endif
                    </td>
                    <td>{{$adv->online ? 'Si' : 'No'}}</td>
                    <td>
                        <a href="{{ route('events.advs.edit', array($event, $adv->id)) }}" type="button" class="btn btn-w-m btn-primary">Modifica</a>
                    </td>
                    <td>
                      {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('events.advs.destroy', $event, $adv->id))) !!}
                          <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
                      {!! Form::close() !!}
                    </td>
                	</tr>
                @endforeach
              </table>
            </div>

          </div>

        </div>
      </div>
     </div>
        @endforeach

        
        
      

        <div class="col-xs-2" style="margin-top:50px">
          
        <a href="{{ route('events.index') }}" class="btn btn-info">Elenco eventi</a>
      </div>
@stop
