@extends('template.layout')

@section('content')
    @include('sweet::alert')
    <h1 class="page-title">
        Trámites por periodo académico
    </h1>
    <div class="portlet light portlet-fit portlet-datatable bordered">

        <div class="portlet-body">

            <div class="Forum-ForumTopicList row" style="margin:20px">
                <div class="col-lg-12" id="divTable">
                    @if(count($periodo) > 0)
                        @php($count = 1)
                        <table class="table table-hover nowrap dataTable dtr-inline collapsed tbperiodo"
                               id="tbperiodo"
                               width="100%" role="grid" aria-describedby="tbperiodo_info">
                            <thead class="thead-default">
                            <tr>
                                <th>N°</th>
                                <th>Nombre del periodo</th>
                                <th>Tramites realizados</th>
                            </tr>
                            </thead>
                            <tbody>

                            @foreach($periodo as $item)
                                <tr>
                                    <td> {{ $count}} </td>
                                    <td> {{ $item->nombre }} </td>
                                    <td> <a href="{{url('reportestramite/periodo/tramites',['id'=>$item->id])}}" class="btn btn-outline btn-circle btn-sm purple">
                                            Ver tramites
                                        </a> </td>
                                    @php($count++)
                                </tr>

                            @endforeach

                            </tbody>
                        </table>
                    @else
                        <div class="well" style="text-align: center;"> No se encontraron periodos registrados</div>
                    @endif
                </div>
            </div>


        </div>

    </div>

@endsection
@section('scripts')
    <script>

        var tbperiodo = $('#tbperiodo').DataTable({
            "lengthMenu": [[25, 20, 50, -1], [25, 20, 50, "Todas"]],
            bFilter: true,
            "bLengthChange": false,
            bInfo: true,
            responsive: true,
            "autoWidth": true,
            "language": {
                "lengthMenu": "Mostrar _MENU_ Entradas",
                "zeroRecords": "No se encontraron registros",
                "info": "Mostrando la página _PAGE_ de _PAGES_",
                "infoEmpty": "No hay registros disponibles",
                "infoFiltered": "(filtrado de _MAX_ registros totales)",
                "search": "Buscar: ",
                "paginate": {
                    "first": "Primero",
                    "last": "Último",
                    "next": "Siguiente",
                    "previous": "Anterior"
                },
            },
            "order": [],
            "aoColumns": [
                {"bSearchable": false},
                {"bSearchable": true},
                {"bSearchable": false},
            ],
            "columns": [
                {"orderable": false},
                {"orderable": true},
                {"orderable": false},
            ],
        });

    </script>
@endsection
