@extends('layouts.admin')

@section('title')

  Eventi

@stop

@section('content')

	   <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-body">  
            <div class="box-body table-responsive no-padding">
              <table class="table table-striped table-hover" id="dtTable">
                <thead>
                <tr>
                  <th>Titolo</th>
                  <th>Online</th>
                  <th class="hidden-xs" width="50"></th>
                  <th class="hidden-xs" width="50"></th>
                  <th class="hidden-xs" width="50"></th>
                  <th width="50"></th>
                </tr>
              </thead>
                @foreach($events as $event)
                	<tr>
                    <td><a href="{{ route('events.edit', array($event->id)) }}" >{{$event->title}}</a></td>
                    <td>{{$event->online ? 'Si' : 'No'}}</td>
                    <td class="hidden-xs">
                      <a href="{{ route('events.advs.index', array($event->id)) }}" type="button" class="btn btn-w-m btn-primary">Pubblicità</a>
                    </td>
                    <td class="hidden-xs">
                      <a href="{{ route('events.layout', array($event->id)) }}" type="button" class="btn btn-w-m btn-primary">Gestione Evento</a>
                    </td>
                    <td class="hidden-xs">
                        <a href="{{ route('events.edit', array($event->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.destroy', $event->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 class="col-xs-2">
          <a href="{{ route('events.create') }}" class="btn btn-success">Aggiungi</a>
        </div>
        
      </div>
@stop


@section('extra_css')

  <link rel="stylesheet" href="/plugins/datatables/dataTables.bootstrap.css">
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css">

@stop

@section('extra_js')

  <script src="/plugins/datatables/jquery.dataTables.min.js"></script>
  <script src="/plugins/datatables/dataTables.bootstrap.min.js"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js"></script>

  <script type="text/javascript">
    
    $( document ).ready(function() {

      $("#dtTable").DataTable(
        {
          eventLength: 50,
          dom: 'Bfrtip',
          buttons: [
              /*'copy', 'csv', 'excel', 'pdf', 'print',
              {
                extend: 'pdfHtml5',
                orientation: 'landscape',
                eventSize: 'LEGAL'
              }*/
          ]
        },
        
      );
    });
  </script>

@stop