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

{% block title %} Sociéte {% endblock %}

{% block content %}
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-gray-800">Sociétés</h1>
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item">Société</li>
    </ol>
</div>




<!-- Begin Page Content -->
<div class="container-fluid">
    
    {% include 'backend_admin/basic/notice.html.twig' %}

    <a href="{{ path('backend_admin_societe_add') }}" class="btn btn-info btn-icon-split mb-4">
        <span class="icon text-white"><i class="fa-regular fa-square-plus"></i></span>
        <span class="text text-white">Ajouter une nouvelle Société</span>
    </a>

    <!-- DataTales Example -->
    <div class="card shadow mb-4">
       
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary">Liste des sociétés</h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="dataTablesSociete" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Nom</th>
                            <th>Adresse</th>
                            <th>Email</th>
                            <th>Téléphone</th>
                            <th>Partenaires</th>
                            <th>Modifier</th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>#</th>
                            <th>Nom</th>
                            <th>Adresse</th>
                            <th>Email</th>
                            <th>Téléphone</th>
                            <th>Partenaires</th>
                            <th>Modifier</th>
                        </tr>
                    </tfoot>
                    <tbody>
                        {% for societe in societes %}
                            <tr>
                                <td>{{ societe.id }}</td>
                                <td>{{ societe.nom }}</td>
                                <td>{{ societe.adresse }}</td>
                                <td>{{ societe.email }}</td>
                                <td>{{ societe.telephone }}</td>
                                <td align="center">{{ societe.getPartenaires()|length }}</td>
                                <td align="center">    
                                    <a href="{{ path('backend_admin_societe_update',{id:societe.id}) }}" title="modifier" class="btn btn-info btn-action"><i class="fa fa-edit"></i></a>
                                    {% if societe.isActive() %} 
                                        <a href="{{ path('backend_admin_societe_activated', {id:societe.id, 'active':0}) }}" title="déactiver cette sociéte" class="btn btn-danger"><i class="fa-solid fa-circle-xmark"></i></a>
                                    {% else %} 
                                        <a href="{{ path('backend_admin_societe_activated', {id:societe.id, 'active':1}) }}" title="activer cette sociéte" class="btn btn-success"><i class="fa-solid fa-circle-check"></i></a>
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    {{ encore_entry_script_tags('app_backend_other') }}
{% endblock %}