{# @var \App\Entity\Entreprise entity #}
<div class="mt-2">
{% include 'backend/partials/_table_result_header.html.twig' with {
entityName: 'Entreprise(s)',
count: advancedSearchResults.getTotalItemCount,
showExportButtons: searchParams.is_exportable,
buttons: [{
display: is_granted('ROLE_ADD_ENTITY') ? true : false,
url: path('create_enterprise'),
class: 'btn btn-sm btn-success',
icon: 'fas fa-plus',
label: 'Ajouter'
}]
} %}
<div class="table-responsive">
<table class="table" id="table-result">
<thead>
<tr>
<th>Raison Sociale</th>
<th>Type</th>
<th>Adhésion</th>
<th>Département</th>
<th>Région</th>
<th>Code postal</th>
<th>Commune/Ville</th>
<th>Syndicat de rattachement</th>
<th>Région de rattachement</th>
<th>Date cessation</th>
<th>#</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
{% for key, entity in advancedSearchResults %}
<tr>
<td>
<a href="{{ path('show_entreprise', {'id': entity.id }) }}">
{{ entity.raisonSocial|upper }}
</a>
</td>
<td>{{ entity.firmType ? entity.firmType.name }}</td>
<td>
<span class="mx-2 badge bg-{{ entity.isMember ? 'success' : 'danger' }} p-2">
{{ (entity.isMember ? 'adhésion payée' : 'adhésion non payée')|upper }}
</span>
</td>
<td>
{% if entity.departement %}
{{ entity.departement.nom }}
{% endif %}
</td>
<td>
{{ entity.departement is not null and entity.departement.regions is not null ? entity.departement.regions.first.nom : '' }}
{#
{{ entity.homeRegion ? entity.homeRegion.nom : '' }}
{% if entity.departement %}
{% for region in entity.departement.regions %}
{{ region.nom }}
{% endfor %}
{% endif %}
#}
</td>
<td>
{% if entity.codePostal %}
{{ entity.codePostal }}
{% endif %}
</td>
<td>
{% if entity.ville %}
{{ entity.ville }}
{% endif %}
</td>
<td>
{% if entity.syndicat %}
{{ entity.syndicat.nom }}
{% endif %}
</td>
<td>{{ entity.homeRegion ? entity.homeRegion.nom : '' }}</td>
<td>{{ entity.dateCessation ? entity.dateCessation|date('d/m/Y') }}</td>
<td>{{ entity.id }}</td>
<td class="text-center">
<button class="btn btn-outline-secondary btn-icon btn-rounded dropdown-toggle custom-dropdown" type="button" id="dropdownMenu_{{ key }}" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-ellipsis"></i>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu_{{ key }}">
<li>
<a class="dropdown-item" href="{{ path('show_entreprise', {'id': entity.id }) }}">
<i class="fas fa-eye"></i> Consulter
</a>
</li>
{% if is_granted('ROLE_UPDATE_ENTITY') %}
<li>
<a class="dropdown-item" href="{{ path('edit_entreprise', {'id': entity.id }) }}">
<i class="fas fa-edit"></i> Editer
</a>
</li>
{% endif %}
{% if is_granted('ROLE_DELETE_ENTITY') %}
<li>
<a
class="dropdown-item"
href="#"
data-controller="confirm-delete"
data-confirm-delete-url-value="{{ path('archive_enterprise', {id: entity.id}) }}"
data-confirm-delete-message-value="Etes-vous sûr de vouloir archiver cet entreprise ?"
data-confirm-delete-token-value="{{ csrf_token('entreprise_' ~ entity.id) }}"
data-confirm-delete-action-value="reload"
>
<i class="fas fa-archive"></i> Archiver
</a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="navigation mt-4 text-end">
{{ knp_pagination_render(advancedSearchResults) }}
</div>
</div>
</div>