{% extends 'base.html.twig' %}

{% block title%}
    WONDER-Empresa
{% endblock %}
{% block titulo %}
    GESTIÓN DE EMPRESA
{% endblock %}
{% block bread %}
    Empresa
{% endblock %}

{% block body %}
    <style>

        .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
            padding: 3px 12px;
        }
        body {
            font: 14px/1.5 sans-serif;
        }
        .btn {
            font-size: 10px;
            padding: .2rem 1.2rem;
        }
    </style>
    <div class="row">
        {#{% if is_granted('ROLE_SUPER')%}#}
        <div class="col-sm-12">
            {% include 'messages/success.html.twig' %}
            {% include 'messages/danger.html.twig' %}
            <div class="white-box">
                <h3 class="box-title m-b-0">LISTADO DE EMPRESAS</h3>
                <div class="clearfix">
                    <div class=" tableTools-container">
                        {% if is_granted('ROLE_ADMINISTRADOR') or is_granted('ROLE_TECNICO')%}
                            <a href="{{ path('tempresa_new') }}" class="btn btn-outline btn-rounded btn-success pull-right" title='Nuevo Registro' style="font-size: 18px">Agregar Registro</a>
                        {% endif %}
                    </div>
                </div>
                <hr>
                <div class="table-responsive">
                    <table id="myTable" class="table table-striped">
                        <thead>
                        <tr>
                            <th>Nombre de Empresa</th>
                            <th>NIT</th>
                            <th>Estado</th>
                            <th class="text-right">Acciones</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for entity in tempresas %}
                            <tr data-id="{{ entity.idempresa }}" >
                                <td>{{ entity.nombre }}</td>
                                <td>{{ entity.nit }}</td>
                                <td>{% include 'if/activo.html.twig' %}</td>
                                <td class="action-buttons text-right">
                                    {#<a class="fcbtn btn btn-success btn-outline btn-1b" href="{{ path('tcarrera_show', { 'idUsuario': entity.idcarrera }) }}" title="Ver"><i class="fa fa-eye"></i></a>#}
                                    {#</a>#}
                                    {% if is_granted('ROLE_ADMINISTRADOR') or is_granted('ROLE_TECNICO')%}
                                        <a class="fcbtn btn btn-warning btn-outline btn-1b" href="{{ path('tempresa_edit', { 'idempresa': entity.idempresa }) }}" title="Editar"><i class="fa fa-edit"></i></a>
                                    {% endif %}

                                    {% if is_granted('ROLE_ADMINISTRADOR')%}
                                        <a class="fcbtn btn btn-danger btn-outline btn-1b btn-delete" href="javascript:void(0)" title="Eliminar"><i class="fa fa-trash"></i></a>
                                        </a>
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </table>
                </div>
            </div>
        </div>
        {#{% endif %}#}
    </div>
    <!-- /.row -->
    {{ include ('forms/delete.html.twig', { form: delete_form_ajax, message: 'Estás seguro de borrar el registro?', id:'form-delete', with_submit:false }) }}

{% endblock %}

{% block javascripts %}
    <script>
        $(document).ready(function () {
            // Basic
            $('.dropify').dropify();
            $('#myTable').DataTable({
                "pageLength": 25,
                "language": {
                    "url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/Spanish.json"
                },
                dom: 'Bfrtip',
                buttons: [
                    { extend: 'copy', text: 'Copiar' },
                    { extend: 'excel', text: 'Excel' },
                    { extend: 'print', text: 'Imprimir' }
                ]
            });
        });
    </script>

{% endblock %}


