@extends('template.layout')

@section('content')

    <div class="portlet light portlet-fit portlet-datatable bordered">
        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject font-green sbold uppercase"> Mis cursos </span>
            </div>
        </div>
        <div class="portlet-body">

            <div class="Forum-ForumTopicList row" style="margin:20px">
                <div class="col-lg-12" id="divTable">
                    <table class="table table-striped table-bordered table-hover table-bg tbCursos"
                           id="tbCursos"
                           width="100%" role="grid" aria-describedby="tbCursos_info">
                        <thead class="thead-default">
                        <tr>
                            <th>Código curso</th>
                            <th>Nombre curso</th>
                            <th>Sección</th>
                            <th>Ver notas</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($cursos as $item)
                            <tr>
                                <td> {{ $item->CodigoCurso }}</td>
                                <td> {{ $item->Curso }}</td>
                                <td> {{ $item->Seccion }}</td>
                                <td>
                                    <a href="{{url('reportesnotas/cursos/alumnos',['id' => $item->id ])}}"
                                       class="btn btn-outline btn-circle btn-sm blue">
                                        Ver notas
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            </div>


        </div>

    </div>


@endsection

@section('scripts')
    <script>

        var tbCursos = $('#tbCursos').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": true},
                {"bSearchable": true},
                {"bSearchable": true},
                {"bSearchable": false},
            ],
            "columns": [
                {"orderable": true},
                {"orderable": true},
                {"orderable": true},
                {"orderable": false},
            ],
            dom: 'Bfrtip',
            buttons: [
                {
                    extend: 'excel',
                    exportOptions: {
                        columns: [0, 1, 2]
                    },
                    title: 'Reporte de cursos profesor'
                }, {
                    extend: 'pdf',
                    exportOptions: {
                        columns: [0, 1, 2]
                    },
                    pageSize: 'LEGAL',
                    customize: function (doc) {
                        //pageMargins [left, top, right, bottom]
                        doc.pageMargins = [120, 20, 20, 20];
                    },
                    title: 'Reporte de cursos profesor'
                }

            ]
        });



    </script>
@endsection
