<?php
function fecha_alreves($fecha)
{
    $fechaA = '';
    $f = explode(' ', $fecha);
    $f = explode('-', $f[0]);
    //return var_dump($f);
    foreach ($f as $fp) {
        $fechaA = $fp . '-' . $fechaA;
    }
    $fechaA = substr($fechaA, 0, -1);
    return $fechaA;
}

?>

<div class="">

    <div class="page-title">

        <div class="title_left">

            <h3>LINEAMIENTOS</h3>

        </div>

    </div>



    <div class="clearfix"></div>



    <div class="row">

        <div class="col-md-12 col-sm-12 col-xs-12">

            <div class="x_panel">

                <div class="x_title">

                    <h2>Listado Lineamientos</h2>

                    <div class="clearfix"></div>

                </div>

                <div class="x_content">



                    <!--filtrado en caso de ir-->
                    @if (count($Lineamientos)>0)

                    <div class="">

                        <table class="table table-striped bulk_action borde-tabla " id="tabla">

                            <thead class="fondo-tabla">

                                <tr class="headings">

                                    <th class="column-title text-center">No.</th>

                                    <th class="column-title text-center">Documento </th>

                                    <th class="column-titl text-center">Nombre </th>

                                    <th class="column-title text-center">Subido </th>

                                    <th class="column-title no-link last text-center"><span
                                            class="nobr">Acciones</span>

                                    </th>

                                    <th class="bulk-actions" colspan="5">

                                        <a class="antoo" style="color:#fff; font-weight:500;">Bulk Actions (

                                            <span class="action-cnt"> </span> ) <i class="fa fa-chevron-down"></i></a>

                                    </th>

                                </tr>

                            </thead>



                            <tbody>



                                @foreach ($Lineamientos as $lin)
                                    <?php
                                    
                                    $interar = $loop->iteration;
                                    
                                    ?>

                                    <tr class="even pointer">

                                        <td class="text-center" data-label="No.: ">{{ $loop->iteration }}</td>
                                        <td class="text-center" data-label="Documento: ">
                                            <button type="button" class="btn btn-primary btn-xs" title="Dcumento"
                                                data-toggle="modal"
                                                data-target=".bs-example-modal-ig-documento{{ $loop->iteration }}"><span
                                                    class="fa fa-file-pdf-o"></span></button>

                                            <div class="modal fade bs-example-modal-ig-documento{{ $loop->iteration }}"
                                                tabindex="-1" role="dialog" aria-hidden="true">

                                                <div class="modal-dialog modal-lg">

                                                    <div class="modal-content">



                                                        <div class="modal-header">

                                                            <button type="button" class="close"
                                                                data-dismiss="modal"><span aria-hidden="true">×</span>

                                                            </button>

                                                            <h4 class="modal-title" id="myModalLabel">

                                                                Documento</h4>

                                                        </div>

                                                        <div class="modal-body">

                                                            <iframe src="pdf/lineamientos/{{ $lin->documento }}"
                                                                width="100%" height="450px"></iframe>

                                                        </div>

                                                        <div class="modal-footer">

                                                            <button type="button" class="btn btn-info"
                                                                data-dismiss="modal">Cerrar</button>

                                                            <!--<button type="button" class="btn btn-primary">Save changes</button>-->

                                                        </div>



                                                    </div>

                                                </div>

                                            </div>
                                        </td>
                                        <td class="" data-label="Nombre: ">
                                            {{ $lin->nombre }}</td>
                                        <td class="text-center" data-label="Subido: ">
                                            {{ fecha_alreves($lin->created_at) }}</td>
                                        <td class="text-center" data-label="Acciones: ">


                                            <div class="btn-group">

                                                @if ($lin->estado == 1)
                                                    <!-- Small modal -->
                                                    <button type="button" class="btn btn-danger btn-xs"
                                                        title="Eliminar lineamiento"
                                                        onclick="modalConfirmacion('Eliminar lineamiento','<p>¿Está seguro de eliminarlo?</p>','delete_lineamientos2({{ $lin->id }});');"><span
                                                            class="fa fa-trash-o"></span></button>
                                                @endif
                                            </div>



                                        </td>

                                    </tr>
                                @endforeach

                            </tbody>

                        </table>

                    </div>
                    @else
                    <p class="text-center">No se encontraron registros.</p>
                    @endif
                </div>

            </div>

        </div>

    </div>

</div>
