<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('sweet::alert', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

    <div class="portlet light portlet-fit portlet-datatable bordered">
        <div class="portlet-title">
            <div class="caption">
                <a href="<?php echo e(URL::previous()); ?>" class="icon-action-undo"></a>
                <span class="caption-subject font-green sbold uppercase"> Historial de notas del alumno: </span> </br> </br>
                <span class="caption-subject font-green sbold uppercase"
                      style="padding-left: 3%;"> <?php echo e($user->apellido_paterno); ?> <?php echo e($user->apellido_materno); ?>

                    , <?php echo e($user->nombres); ?></span>
            </div>
        </div>
        <div class="portlet-body">
            <div class="Forum-ForumTopicList row" style="margin:20px">
                <div class="col-lg-12" id="divTable">
                    <?php if(count($notasFinal) > 0): ?>
                        <table class="table table-striped table-bordered table-hover table-bg tbNotas"
                               id="tbNotas" width="100%" role="grid" aria-describedby="tbNotas_info">
                            <thead class="thead-default">
                            <tr>
                                <th>Nombre curso</th>
                                <th>Promedio Final</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $notasFinal; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td> <?php echo e($item->nombre); ?></td>
                                    <td style="text-align: right;">
                                        <?php if($item->promedio_final < 11.0): ?>
                                            <a id="<?php echo e($item->cursoID); ?>" onclick="detalleNota(<?php echo e($item->id); ?>,this)" style="color:red;">
                                                <?php echo e($item->promedio_final); ?>

                                            </a>
                                        <?php elseif($item->promedio_final == null): ?>
                                          <strong> --- </strong>
                                        <?php else: ?>
                                            <a id="<?php echo e($item->cursoID); ?>" onclick="detalleNota(<?php echo e($item->id); ?>,this)" style="color: black;">
                                                <?php echo e($item->promedio_final); ?>

                                            </a>
                                        <?php endif; ?>

                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>

                    <?php else: ?>
                        <div class="well" style="text-align: center;"> No se encontraron notas registradas</div>
                    <?php endif; ?>
                </div>
            </div>

        </div>

    </div>

    <div id="modalDetalle" class="modal fade" tabindex="-1" aria-hidden="true" style="display: none; padding-right: 17px;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">Detalle Nota</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div id="mbody"></div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" data-dismiss="modal" class="btn dark btn-outline">cerrar</button>
                </div>
            </div>
        </div>
    </div>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
    <script>

        var tbNotas = $('#tbNotas').DataTable({
            "lengthMenu": [[25, 20, 50, -1], [25, 20, 50, "Todas"]],
            bFilter: false,
            "bLengthChange": false,
            bInfo: false,
            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": false},
            ],
            "columns": [
                {"orderable": true},
                {"orderable": false},
            ],
            dom: 'Bfrtip',
            buttons: [
                {
                    extend: 'excel',
                    title: 'Reporte de historial de notas'
                }, {
                    extend: 'pdf',
                    title: 'Reporte de historial de notas'
                }

            ]
        });

        function detalleNota(id, item) {
            var cursoID = item.id;

            $.ajax({

                url: "<?php echo e(url('reportesnotas/alumnos/detalle/nota')); ?>" + "/" + id + "/" + cursoID,

                success: function (data) {
                    $("#mbody").empty();
                    $("#mbody").html(data);
                }

            });

            $("#modalDetalle").modal('show');
        };


    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('template.layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>