Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BO - Tableaux] Template Twig pour les tableaux du BO #3405

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions templates/_partials/back/table.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="fr-table">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">
<table class="{{ cancelSortable is defined ? '' : 'sortable' }} {{ cancelMultiline is defined ? '' : 'fr-cell--multiline' }}" aria-label="{{ tableLabel }}" aria-describedby="{{ tableDescId ?? 'desc-table' }}">
<thead>
<tr>
{{tableHead}}
</tr>
</thead>
<tbody>
{{tableBody}}
</tbody>
</table>
</div>
</div>
</div>
</div>
152 changes: 74 additions & 78 deletions templates/back/account/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -57,86 +57,82 @@
</form>
</section>
{% endif %}
<section class="fr-grid-row fr-grid-row--middle fr-p-5v">
<h1 class="fr-h2 fr-mb-0" id="desc-table">{{total}} comptes archivés ou sans territoires et/ou partenaires trouvés</h1>

<section class="fr-col-12 fr-p-5v">
<h2 class="fr-mb-0" id="desc-table">{{total}} comptes archivés ou sans territoires et/ou partenaires trouvés</h2>
</section>
<section class="fr-col-12 fr-table fr-pt-0 fr-px-5v">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">
<table class="sortable" aria-label="Liste des comptes archivés ou sans territoires et/ou partenaires" aria-describedby="desc-table">
<thead>
<tr>
<th scope="col">Partenaire</th>
<th scope="col">Territoire</th>
<th scope="col">Statut part.</th>
<th scope="col">E-mail</th>
<th scope="col">Nom</th>
<th scope="col">Prénom</th>
<th scope="col" class="fr-text--right"></th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr class="user-row">
<td>
{% if user.partners.isEmpty%}
aucun
{% else %}
{% for partner in user.partners %}
{{ partner.nom }}
{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<td>
{% if user.partners.isEmpty %}
aucun
{% else %}
{% for partner in user.partners %}
{% if partner.territory %}
{{ partner.territory.zip ~ ' - ' ~ partner.territory.name }}
{% else %}
aucun
{% endif %}
{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<td>
{% if user.partners.isEmpty %}
<span class="fr-badge fr-badge--info fr-badge--no-icon fr-ws-nowrap ">AUCUN</span>
{% else %}
{% for partner in user.partners %}
{% set classe = 'fr-badge--success' %}
{% set statut = 'actif' %}
{% if partner.isArchive %}
{% set classe = 'fr-badge--error' %}
{% set statut = 'archivé' %}
{% endif %}
<span class="fr-badge {{ classe }} fr-badge--no-icon fr-ws-nowrap ">{{ statut|upper }}</span>
{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<td>{{ user.email|clean_tagged_text(constant('App\\Entity\\User::SUFFIXE_ARCHIVED'), 'left') }}</ail td>
<td>{{ user.nom}}</ail td>
<td>{{ user.prenom}}</ail td>
<td class="fr-text--right">
<a href="{{ path('back_account_reactiver', {'id': user.id}) }}"
class="fr-btn fr-icon-flashlight-fill fr-btn--sm" title="Réactiver le compte {{user.email|clean_tagged_text(constant('App\\Entity\\User::SUFFIXE_ARCHIVED'), 'left')}}"></a>
</td>
</tr>

<section class="fr-col-12 fr-pt-0 fr-px-5v">
{% set tableHead %}
<th scope="col">Partenaire</th>
<th scope="col">Territoire</th>
<th scope="col">Statut part.</th>
<th scope="col">E-mail</th>
<th scope="col">Nom</th>
<th scope="col">Prénom</th>
<th scope="col" class="fr-text--right">Actions</th>
{% endset %}

{% set tableBody %}
{% for user in users %}
<tr class="user-row">
<td>
{% if user.partners.isEmpty%}
aucun
{% else %}
<tr>
<td colspan="7">Aucun utilisateur trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% for partner in user.partners %}
{{ partner.nom }}
{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<td>
{% if user.partners.isEmpty %}
aucun
{% else %}
{% for partner in user.partners %}
{% if partner.territory %}
{{ partner.territory.zip ~ ' - ' ~ partner.territory.name }}
{% else %}
aucun
{% endif %}
{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<td>
{% if user.partners.isEmpty %}
<span class="fr-badge fr-badge--info fr-badge--no-icon fr-ws-nowrap ">AUCUN</span>
{% else %}
{% for partner in user.partners %}
{% set classe = 'fr-badge--success' %}
{% set statut = 'actif' %}
{% if partner.isArchive %}
{% set classe = 'fr-badge--error' %}
{% set statut = 'archivé' %}
{% endif %}
<span class="fr-badge {{ classe }} fr-badge--no-icon fr-ws-nowrap ">{{ statut|upper }}</span>
{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<td>{{ user.email|clean_tagged_text(constant('App\\Entity\\User::SUFFIXE_ARCHIVED'), 'left') }}</ail td>
<td>{{ user.nom}}</ail td>
<td>{{ user.prenom}}</ail td>
<td class="fr-text--right">
<a href="{{ path('back_account_reactiver', {'id': user.id}) }}"
class="fr-btn fr-icon-flashlight-fill fr-btn--sm" title="Réactiver le compte {{user.email|clean_tagged_text(constant('App\\Entity\\User::SUFFIXE_ARCHIVED'), 'left')}}"></a>
</td>
</tr>
{% else %}
<tr>
<td colspan="7">Aucun utilisateur trouvé</td>
</tr>
{% endfor %}
{% endset %}

{% include '_partials/back/table.html.twig' with { 'tableLabel': 'Liste des comptes archivés ou sans territoires et/ou partenaires', 'tableHead': tableHead, 'tableBody': tableBody } %}

<div class="fr-grid-row fr-mt-2v fr-grid-row--center">
{% import '_partials/macros.html.twig' as macros %}
{{ macros.customPagination(pages, page, 'back_account_index', {territory: (currentTerritory ? currentTerritory.id : (isNoneTerritory ? 'none' : null)), partner: (currentPartner ? currentPartner.id : (isNonePartner ? 'none' : null)), userTerms: userTerms}) }}
Expand Down
Loading
Loading