@extends('layouts.admin')

@section('title')

  Pubblicità Sezione {{$section->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('sections.advs.create', $section) }}?position={{$idx}}" class="btn btn-success">Aggiungi</a>
       </div>
      </div>
      <div class="row">
       <div class="col-xs-2">
         
       </div>
       <div class="col-xs-12">
        <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></th>
                  <th></th>
                </tr>
                @foreach($data as $adv)
                  <tr>
                    <td>{{$adv->name}}</td>
                    <td>{{$adv->google_code}}</td>
                    <td>
                      @if($adv->image != '')
                        <img class="hidden-xs"src="/files/adv/{{$adv->image}}" style="max-width:250px" />
                        <img class="hidden-md hidden-lg" src="/files/adv/{{$adv->image}}" style="max-width:50px" />

                      @endif
                    </td>
                    <td>{{$adv->online ? 'Si' : 'No'}}</td>
                    <td>
                        <a href="{{ route('sections.advs.edit', array($section, $adv->id)) }}" type="button" class="btn btn-w-m btn-primary"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
                    </td>
                    <td>
                      {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('sections.advs.destroy', $section, $adv->id))) !!}
                          <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')"><i class="fa fa-trash" aria-hidden="true"></i></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('sections.index') }}" class="btn btn-info">Torna a Gestione layout, news a banner</a>
      </div>
@stop
