{% extends 'CmBundle:Z:baseDos.html.twig' %}

{% block stylesheet %}
{% endblock %}

{% block javascripts %}
{% endblock %}


{% block content %}
    <div class="container-fluid">
        {% for flashMessage in app.session.flashbag.get('mensaje') %}
            <script>
                swal("", "{{ flashMessage }}", "success");
            </script>
        {% endfor %}
        {% set tipoUsuario = app.session.get('rol') %}
        {% set externo = app.session.get('externo') %}

        <h1 class="mt-4">Repositorio</h1>
        <ol class="breadcrumb mb-2">
            <li class="breadcrumb-item"><a href="{{ path('cm_homepage') }}">Tablero</a></li>
            <li class="breadcrumb-item active">Repositorio</li>
        </ol>
        <div class="row">
            <div class="col-lg-6">
                <div class="card border-info mb-1">
                    <div class="card-header bg-info border-info">
                        <i class="fas fa-file mr-1"></i>
                        NUEVO
                    </div>
                    <div class="card-body">
                        <form class="row small" action="{{ path('repositorio') }}" method="POST"
                              id="formularioRepositorio"
                              enctype="multipart/form-data">
                            <div class="row small pb-2">
                                <div class="col-lg-6">
                                    <label for="nomRep" class="control-label">NOMBRE DOCUMENTO</label>
                                    <input type="text" name="nomRep" id="nomRep" required
                                           class="form-control form-control-sm">
                                </div>
                                <div class="col-lg-6">
                                    <label for="rutaArchivo" class="control-label">ARCHIVO</label>
                                    <input type="file" name="rutaArchivo" id="rutaArchivo" required
                                           class="form-control-file form-control form-control-sm">
                                </div>
                                <div class="col-lg-12">
                                    <label for="desRep" class="control-label">DESCRIPCIÓN</label>
                                    <textarea name="desRep" id="desRep" rows="3" style="width: 100%"
                                              class="form-text form-control"></textarea>
                                </div>
                            </div>

                            <div class="row small pb-2">
                                <div class="col-lg-6" id="contenedor-archivos-adjuntos">
                                    *******
                                </div>
                            </div>
                            <div class="row small pb-2">
                                <button type="submit" class="btn btn-success btn-block btn-sm">REGISTRAR</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- fin col-lg-12    -->
            <div class="col-lg-6">
                <div class="card border-info mb-1">
                    <div class="card-header bg-info border-info">
                        <i class="fas fa-file mr-1"></i>
                        CATÁLOGO REPOSITORIO
                    </div>
                    <div class="card-body">
                        <div class="row small pb-2 table-responsive">
                            <table class="table table-bordered table-condensed table-striped table-hover">
                                <thead>
                                <tr>
                                    <th>N.C.</th>
                                    <th>NOMBRE ARCHIVO</th>
                                    <th>RUTA</th>
                                    <th>*</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for m in catalogoRepositorio %}
                                    <tr>
                                        <td>
                                            {{ loop.index }}
                                        </td>
                                        <td>
                                            {{ m[0].nomRep }}
                                        </td>
                                        <td>
                                            {% for mm in m[1] %}
                                                {{ mm.rutaArchivo }}
                                            {% else %}
                                                SD
                                            {% endfor %}
                                        </td>
                                        <td>

                                        </td>
                                    </tr>
                                {% else %}
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div><!-- fin col-lg-12    -->
        </div>
    </div>

{% endblock %}