<div class="">
    <div class="page-title">
        <div class="title_left">
            <h3>Docente <small>{{ $doc->nombre }} {{ $doc->apellido_paterno }}
                    {{ $doc->apellido_materno }}</small></h3>
        </div>
    </div>
    <div class="clearfix"></div>
    @php
    $renglon = count($doc->asignacionMateria) / 2;
    @endphp

    @for ($i = 0; $i < $renglon; $i++) <div class="row">
        @foreach ($doc->asignacionMateria as $m)
        <div class="col-md-6 col-sm-12 col-xs-12">
            <div class="x_panel">
                @if ($loop->iteration % 2 == 0)
                <div class="x_title">
                    <h2>{{ $m->materia->nombre_mat }}</h2>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">
                    <table id="tabla" class="table table-striped jambo_table bulk_action">
                        <thead>
                            <tr class="headings">
                                <th class="column-title text-center">No.</th>
                                <th class="column-title text-center">Documento </th>
                                <th class="column-title text-center">Status </th>
                                <th class="column-title text-center">Avance </th>
                                <th class="column-title text-center no-link last"><span class="nobr">Acción</span>
                                </th>
                                <th class="bulk-actions" colspan="7">
                                    <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>

                            <tr class="even pointer">
                                <td class="text-md-center" data-label="No.">
                                    1
                                </td>
                                <td class="" data-label="Documento">
                                    Instrumentación Didáctica
                                </td>
                                <td class="text-md-center" data-label="Status">

                                </td>
                                <td class="text-md-center" data-label="Avance">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-striped bg-secondary" role="progressbar"
                                            style="width: 100%" aria-valuenow="10" aria-valuemin="0"
                                            aria-valuemax="100">0%
                                        </div>
                                    </div>
                                </td>
                                <td class="py-1 text-md-center" data-label="Acción">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-primary btn-sm"
                                            onclick="crear_instrumentaciondidactica('{{ $m->materia->nombre_mat }}', {{ $doc->id }})"><i
                                                class="fa fa-plus"></i></button>
                                    </div>
                                </td>
                            </tr>
                            <tr class="even pointer">
                                <td class="text-md-center" data-label="No.">
                                    2
                                </td>
                                <td class="" data-label="Documento">
                                    Evaluación Diagnostico
                                </td>
                                <td class="text-md-center" data-label="Status">

                                </td>
                                <td class="text-md-center" data-label="Avance">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-striped bg-secondary" role="progressbar"
                                            style="width: 100%" aria-valuenow="10" aria-valuemin="0"
                                            aria-valuemax="100">0%
                                        </div>
                                    </div>
                                </td>
                                <td class="py-1 text-md-center" data-label="Acción">
                                    <div class="btn-group btn-group-sm">

                                        <button type="button" class="btn btn-primary btn-sm"
                                            onclick="nueva_evaluaciondiagnostico('{{ $m->materia->nombre_mat }}',{{ $doc->id }})"><i
                                                class="fa fa-plus"></i></button>
                                    </div>
                                </td>
                            </tr>
                            <tr class="even pointer">
                                <td class="text-md-center" data-label="No.">
                                    3
                                </td>
                                <td class="" data-label="Documento">
                                    Reporte de Evaluación y Acreditación
                                </td>
                                <td class="text-md-center" data-label="Status">

                                </td>
                                <td class="text-md-center" data-label="Avance">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-striped bg-secondary" role="progressbar"
                                            style="width: 100%" aria-valuenow="10" aria-valuemin="0"
                                            aria-valuemax="100">0%
                                        </div>
                                    </div>
                                </td>
                                <td class="py-1 text-md-center" data-label="Acción">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-primary btn-sm"
                                            onclick="nueva_evaluacionacreditacion({{ $doc->id }})"><i
                                                class="fa fa-plus"></i></button>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                @else
                <div class="x_title">
                    <h2>{{ $m->materia->nombre_mat }}</h2>
                    <div class="clearfix"></div>
                </div>
                <div class="x_contect">
                    <table id="tabla" class="table table-striped jambo_table bulk_action">
                        <thead>
                            <tr class="headings">
                                <th class="column-title text-center">No.</th>
                                <th class="column-title text-center">Documento </th>
                                <th class="column-title text-center">Status </th>
                                <th class="column-title text-center">Avance </th>
                                <th class="column-title text-center no-link last"><span class="nobr">Acción</span>
                                </th>
                                <th class="bulk-actions" colspan="7">
                                    <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>
                            <tr class="even pointer">
                                <?php
                                            $bid = '';
                                            $porid = 0;
                                            $activarid = 0;
                                            $colorid = 'secondary';
                                            ?>
                                @foreach ($banderaID as $ins)
                                @if ($ins->instrumentacionDidactica->cve_mat == $m->materia->cve_mat)
                                @if ($ins->instrumentacionDidactica->estado_instdidac == 'Entregado')
                                <?php
                                                        $bid = $ins->instrumentacionDidactica->estado_instdidac;
                                                        $porid = 100;
                                                        $activarid = 2;
                                                        $colorid = 'primary';
                                                        ?>
                                @else
                                @if ($ins->instrumentacionDidactica->estado_instdidac == 'Firmado')
                                <?php
                                                            $bid = 'Firmado';
                                                            $porid = 100;
                                                            $activarid = 3;

                                                            $colorid = 'primary';
                                                            ?>
                                @else
                                <?php
                                                            $bid = $ins->instrumentacionDidactica->estado_instdidac;
                                                            $porid = 50;
                                                            $activarid = 1;
                                                            $colorid = 'primary';
                                                            ?>
                                @endif
                                @endif
                                @endif
                                @endforeach
                                <td class="text-md-center" data-label="No.">
                                    1
                                </td>
                                <td class="" data-label="Documento">
                                    Instrumentación Didáctica
                                </td>
                                <td class="text-md-center" data-label="Status">
                                    {{ $bid }}
                                </td>
                                <td class="text-md-center" data-label="Avance">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-striped bg-{{ $colorid }}"
                                            role="progressbar" style="width: 100%" aria-valuenow="10" aria-valuemin="0"
                                            aria-valuemax="{{ $porid }}">{{ $porid }}%
                                        </div>
                                    </div>
                                </td>
                                <td class="py-1 text-md-center" data-label="Acción">
                                    @if ($activarid == 3)
                                    <a href="/exportarInstrumentacionDidacticaPdf?ind={{ $ins->cve_instdidac }}">
                                        <button type="button" class="btn btn-danger btn-sm" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="Descargar"><i
                                                class="fa fa-file-pdf-o"></i></button>
                                    </a>
                                    @else
                                    @if ($activarid == 2)
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-success btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Consultar"
                                            onclick="consultar_instrumentaciondidactica({{ $ins->cve_instdidac }})"><i
                                                class="fa fa-eye"></i></button>
                                    </div>
                                    @else
                                    @if ($activarid == 1)
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Modificar"
                                            onclick="edit_instrumentaciondidactica({{ $ins->cve_instdidac }})"><i
                                                class="fa fa-pencil"></i></button>
                                    </div>
                                    @else
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-primary btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Agregar"
                                            onclick="crear_instrumentaciondidactica('{{ $m->materia->nombre_mat }}', {{ $doc->id }})"><i
                                                class="fa fa-plus"></i></button>
                                    </div>
                                    @endif
                                    @endif
                                    @endif
                                </td>
                            </tr>
                            <tr class="even pointer">
                                <?php
                                            $b = '';
                                            $por = 0;
                                            $activar = 0;
                                            $color = 'secondary';
                                            ?>
                                @foreach ($banderaED as $e)
                                @if ($e->evaluacionDiag->cve_mat == $m->materia->cve_mat)
                                @if ($e->evaluacionDiag->estado_evaldiag == 'Entregado')
                                <?php
                                                        $b = $e->evaluacionDiag->estado_evaldiag;
                                                        $por = 100;
                                                        $activar = 2;
                                                        $color = 'primary';
                                                        ?>
                                @else
                                @if ($e->evaluacionDiag->estado_evaldiag == 'Firmado')
                                <?php
                                                            $b = 'Firmado';
                                                            $por = 100;
                                                            $activar = 3;

                                                            $color = 'primary';
                                                            ?>
                                @else
                                <?php
                                                            $b = $e->evaluacionDiag->estado_evaldiag;
                                                            $por = 50;
                                                            $activar = 1;

                                                            $color = 'primary';
                                                            ?>
                                @endif
                                @endif
                                @endif
                                @endforeach
                                <td class="text-md-center" data-label="No.">
                                    2
                                </td>
                                <td class="" data-label="Documento">
                                    Evaluación Diagnostico
                                </td>
                                <td class="text-md-center" data-label="Status">
                                    {{ $b }}
                                </td>
                                <td class="text-md-center" data-label="Avance">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-striped bg-{{ $color }}"
                                            role="progressbar" style="width: 100%" aria-valuenow="10" aria-valuemin="0"
                                            aria-valuemax="{{ $por }}">
                                            {{ $por }}%
                                        </div>
                                    </div>
                                </td>
                                <td class="py-1 text-md-center" data-label="Acción">
                                    @if ($activar == 3)
                                    <a href="/exportarEvaluacionDiagnosticoPdf?evaldiag={{ $e->cve_evaldiag }}">
                                        <button type="button" class="btn btn-danger btn-sm" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="Descargar"><i
                                                class="fa fa-file-pdf-o"></i></button>
                                    </a>
                                    @else
                                    @if ($activar == 2)
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-success btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Consultar"
                                            onclick="consultar_evaluaciondiagnostico({{ $e->cve_evaldiag }})"><i
                                                class="fa fa-eye"></i></button>
                                    </div>
                                    @else
                                    @if ($activar == 1)
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Modificar"
                                            onclick="edit_evaluaciondiagnostico({{ $e->cve_evaldiag }})"><i
                                                class="fa fa-pencil"></i></button>
                                    </div>
                                    @else
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-primary btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Agregar"
                                            onclick="nueva_evaluaciondiagnostico('{{ $m->materia->nombre_mat }}',{{ $doc->id }})"><i
                                                class="fa fa-plus"></i></button>
                                    </div>
                                    @endif
                                    @endif
                                    @endif
                                </td>
                            </tr>
                            <tr class="even pointer">
                                <?php
                                            $bea = '';
                                            $porfea = 0;
                                            $activarea = 0;
                                            $colorea = 'secondary';
                                            ?>
                                @foreach ($banderaEA as $ea)
                                @if ($ea->reporteEvalAcre->estado_repfea == 'Entregado')
                                <?php
                                                    $bea = $ea->reporteEvalAcre->estado_repfea;
                                                    $porfea = 100;
                                                    $activarea = 2;
                                                    $colorea = 'primary';
                                                    ?>
                                @else
                                @if ($ea->reporteEvalAcre->estado_repfea == 'Firmado')
                                <?php
                                                        $bea = $ea->reporteEvalAcre->estado_repfea;
                                                        $porfea = 100;
                                                        $activarea = 3;
                                                        $colorea = 'primary';
                                                        ?>
                                @else
                                <?php
                                                        $bea = $ea->reporteEvalAcre->estado_repfea;
                                                        $porfea = 50;
                                                        $activarea = 1;
                                                        $colorea = 'primary';
                                                        ?>
                                @endif
                                @endif
                                @endforeach
                                <td class="text-md-center" data-label="No.">
                                    3
                                </td>
                                <td class="" data-label="Documento">
                                    Reporte de Evaluación y Acreditación
                                </td>
                                <td class="text-md-center" data-label="Status">
                                    {{ $bea }}
                                </td>
                                <td class="text-md-center" data-label="Avance">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-striped bg-{{ $colorea }}"
                                            role="progressbar" style="width: 100%" aria-valuenow="10" aria-valuemin="0"
                                            aria-valuemax="{{ $porfea }}">
                                            {{ $porfea }}%
                                        </div>
                                    </div>
                                </td>
                                <td class="py-1 text-md-center" data-label="Acción">
                                    @if ($activarea == 3)
                                    <a href="/exportarEvaluacionAcreditacionPdf?evalAcre={{ $ea->cve_repfea }}">
                                        <button type="button" class="btn btn-danger btn-sm" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="Descargar"><i
                                                class="fa fa-file-pdf-o"></i></button>
                                    </a>
                                    @else
                                    @if ($activarea == 2)
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-success btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Consultar"
                                            onclick="consultar_evaluacionacreditacion({{ $ea->reporteEvalAcre->cve_repfea }})"><i
                                                class="fa fa-eye"></i></button>
                                    </div>
                                    @else
                                    @if ($activarea == 1)
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-info btn-sm" data-toggle="tooltip"
                                            data-placement="right" title="" data-original-title="Modificar"
                                            onclick="edit_evaluacionacreditacion({{ $ea->cve_repfea }})"><i
                                                class="fa fa-pencil"></i></button>
                                    </div>
                                    @else
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-primary btn-sm"
                                            onclick="nueva_evaluacionacreditacion({{ $doc->id }})"><i
                                                class="fa fa-plus"></i></button>
                                    </div>
                                    @endif
                                    @endif
                                    @endif
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                @endif
            </div>
        </div>
        @endforeach
</div>
@endfor
<!--
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="mb-1 row">
                    <div class="col-md-3 col-sm-12"></div>
                    <div class="col-md-6 col-sm-12">
                        <div class="row">
                            <div class="col">
                                <button class="btn btn-dark btn-block" type="button"
                                    onclick="listado_asignacion()"><i class=" fa fa-times"></i>
                                    Regresar</button>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3 col-sm-12"></div>
                </div>
            </div>
        </div>
    </div>
    -->
</div>

<script>
    $(document).ready(function() {
        $('[data-toggle="tooltip"]').tooltip();
    });
</script>
<script>
    $(document).ready(function() {
        $('[data-toggle="tooltip"]').click(function() {
            $('[data-toggle="tooltip"]').tooltip("hide");

        });
    });
</script>
