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

{% block title %} Partenaire {% 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">Partenaire</h1>
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item">Partenaire</li>
    </ol>
</div>




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

    <a href="{{ path('backend_admin_partenaire_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 un nouveau partenaire</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 partenaires</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>Prénom</th>
                            <th>Email</th>
                            <th>Télé</th>
                            <th>Role</th>
                            <th>Sociéte</th>
                            <th>Date Ajoute</th>
                            <th>Activer Par</th>
                            <th>Etat</th>
                            <th>Gestion</th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>#</th>
                            <th>Nom</th>
                            <th>Prénom</th>
                            <th>Email</th>
                            <th>Télé</th>
                            <th>Role</th>
                            <th>Sociéte</th>
                            <th>Date Ajoute</th>
                            <th>Activer Par</th>
                            <th>Etat</th>
                            <th>Gestion</th>
                        </tr>
                    </tfoot>
                    <tbody>
                        {% for partenaire in partenaires %}
                            {% set user = partenaire.getPartenaire() %}
                            {% set societe = partenaire.getSociete() %}
                            {% set admin = partenaire.getAdmin() %}
                            <tr>
                                <td>{{ partenaire.id }}</td>
                                <td>{{ user.getFirstname() }}</td>
                                <td>{{ user.getLastname() }}</td>
                                <td>{{ user.getEmail() }}</td>
                                <td>{{ user.getPhoneNumber() }}</td>
                                <td>{{ partenaire.role }}</td>
                                <td>{{ societe.getNom() }}</td>
                                <td>{{ partenaire.getDateAdd()|date("d/m/Y H:i") }}</td>
                                <td>{% if admin is not null %} {{ admin.getFullName() }}{% endif %}</td>
                                <td>
                                    {% if partenaire.isActive() %} 
                                        <center><font color="#26a269"><i class="fa-solid fa-circle-check fa-xl"></i></font></center>
                                    {% else %} 
                                        <center><font color="red"><i class="fa-solid fa-circle-xmark fa-xl"></i></font></center>
                                    {% endif %}
                                </td>
                                <td>    
                                    <a href="" title="modifier" class="btn btn-info btn-action"><i class="fa fa-edit"></i></a>
                                    {% if partenaire.isActive() %} 
                                        <a href="{{ path('backend_admin_partenaire_activated', {id:partenaire.id, 'active':0}) }}" title="déactiver ce partenaire" class="btn btn-danger"><i class="fa-solid fa-circle-xmark"></i></a>
                                    {% else %} 
                                        <a href="{{ path('backend_admin_partenaire_activated', {id:partenaire.id, 'active':1}) }}" title="activer ce partenaire" 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 %}