Skip to content

Commit

Permalink
template for bo table #3377
Browse files Browse the repository at this point in the history
  • Loading branch information
emilschn committed Dec 9, 2024
1 parent 625b0be commit 8962844
Show file tree
Hide file tree
Showing 14 changed files with 750 additions and 818 deletions.
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' }} fr-cell--multiline" aria-label="{{ tableLabel }}" aria-describedby="{{ tableDescId ?? 'desc-table' }}">
<thead>
<tr>
{{tableHead}}
</tr>
</thead>
<tbody>
{{tableBody}}
</tbody>
</table>
</div>
</div>
</div>
</div>
100 changes: 48 additions & 52 deletions templates/back/account/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -57,59 +57,55 @@
</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">Territoire</th>
<th scope="col">Partenaire</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 %}
{% if user.partner is null %}
{% set classe = 'fr-badge--info' %}
{% set statut = 'aucun' %}
{% elseif user.partner and user.partner.isArchive %}
{% set classe = 'fr-badge--error' %}
{% set statut = 'archivé' %}
{% else %}
{% set classe = 'fr-badge--success' %}
{% set statut = 'actif' %}
{% endif %}
<tr class="user-row">
<td>{{ user.territory ? user.territory.zip ~ ' - ' ~ user.territory.name : 'aucun' }}</td>
<td>{{ user.partner ? user.partner.nom : 'aucun' }}</td>
<td><span class="fr-badge {{ classe }} fr-badge--no-icon fr-ws-nowrap ">{{ statut|upper }}</span></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 %}
</tbody>
</table>
</div>
</div>
</div>

<section class="fr-col-12 fr-pt-0 fr-px-5v">
{% set tableHead %}
<th scope="col">Territoire</th>
<th scope="col">Partenaire</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 %}
{% if user.partner is null %}
{% set classe = 'fr-badge--info' %}
{% set statut = 'aucun' %}
{% elseif user.partner and user.partner.isArchive %}
{% set classe = 'fr-badge--error' %}
{% set statut = 'archivé' %}
{% else %}
{% set classe = 'fr-badge--success' %}
{% set statut = 'actif' %}
{% endif %}
<tr class="user-row">
<td>{{ user.territory ? user.territory.zip ~ ' - ' ~ user.territory.name : 'aucun' }}</td>
<td>{{ user.partner ? user.partner.nom : 'aucun' }}</td>
<td><span class="fr-badge {{ classe }} fr-badge--no-icon fr-ws-nowrap ">{{ statut|upper }}</span></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
168 changes: 82 additions & 86 deletions templates/back/auto-affectation-rule/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,93 +39,89 @@
</div>
</form>
</section>
<section class="fr-grid-row fr-grid-row--middle fr-p-5v">
<h2 class="fr-h2 fr-mb-0" id="desc-table">{{total}} règles d'auto-affectation</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="fr-cell--multiline sortable" aria-label="Liste des règles d'auto-affectation">
<thead>
<tr>
<th scope="col">Territoire</th>
<th scope="col">Statut</th>
<th scope="col">Type de partenaire</th>
<th scope="col">Profil déclarant</th>
<th scope="col">Parc</th>
<th scope="col">Allocataire</th>
<th scope="col">Code insee inclus</th>
<th scope="col">Code insee exclus</th>
<th scope="col">Id partenaires exclus</th>
<th scope="col" class="fr-text--right">Actions</th>
</tr>
</thead>
<tbody>
{% for autoaffectationrule in autoaffectationrules %}
<tr class="autoaffectationrule-row">
<td>{{ autoaffectationrule.territory.zip}} - {{ autoaffectationrule.territory.name}}</td>
<td>
{% if autoaffectationrule.status is same as constant('App\\Entity\\AutoAffectationRule::STATUS_ACTIVE') %}
{% set classe = 'fr-badge--green-emeraude' %}
{% else %}
{% set classe = 'fr-badge--blue-ecume' %}
{% endif %}
<span class="fr-badge {{ classe }} fr-mb-1v">{{ autoaffectationrule.status }}</span></td>
</td>
<td>{{ autoaffectationrule.partnerType.label }}</td>
<td>{{ autoaffectationrule.profileDeclarant }}</td>
<td>{{ autoaffectationrule.parc }}</td>
<td>{{ autoaffectationrule.allocataire }}</td>
<td>
{% if autoaffectationrule.inseeToInclude is same as('all') or autoaffectationrule.inseeToInclude is same as('partner_list') %}
{{ autoaffectationrule.inseeToInclude }}
{% else %}
{% for insee in autoaffectationrule.inseeToInclude|split(',') %}
<div class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ insee }}</div>
{% endfor %}
{% endif %}
</td>
<td>
{% if autoaffectationrule.inseeToExclude %}
{% for insee in autoaffectationrule.inseeToExclude %}
<div class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ insee }}</div>
{% endfor %}
{% else %}
/
{% endif %}
</td>
<td>
{% if autoaffectationrule.partnerToExclude %}
{% for idPartner in autoaffectationrule.partnerToExclude %}
<div class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ idPartner }}</div>
{% endfor %}
{% else %}
/
{% endif %}
</td>
<td class="fr-text--right">
<a class="fr-btn fr-btn--sm fr-fi-edit-line" href="{{ path('back_auto_affectation_rule_edit', {'id': autoaffectationrule.id}) }}"></a>
{% if autoaffectationrule.status is same as constant('App\\Entity\\AutoAffectationRule::STATUS_ACTIVE') %}
<button class="fr-btn fr-btn--danger fr-btn--sm fr-fi-delete-line fr-mt-3v btn-delete-autoaffectationrule"
id="autoaffectationrule_delete_{{ autoaffectationrule.id }}" aria-controls="fr-modal-autoaffectationrule-delete"
data-fr-opened="false" data-autoaffectationrule-id="{{ autoaffectationrule.id }}" data-autoaffectationrule-description="{{ autoaffectationrule.description }}"></button>
{% else %}
<a href="{{ path('back_auto_affectation_rule_reactive', {'id': autoaffectationrule.id}) }}"
class="fr-btn fr-icon-flashlight-fill fr-btn--sm fr-mt-3v" title="Réactiver la règle {{autoaffectationrule.id}}"></a>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="3">Aucune règle d'auto-affectation trouvée</td>
</tr>

<section class="fr-col-12 fr-p-5v">
<h2 class="fr-mb-0" id="desc-table">{{total}} règles d'auto-affectation</h2>
</section>

<section class="fr-col-12 fr-pt-0 fr-px-5v">
{% set tableHead %}
<th scope="col">Territoire</th>
<th scope="col">Statut</th>
<th scope="col">Type de partenaire</th>
<th scope="col">Profil déclarant</th>
<th scope="col">Parc</th>
<th scope="col">Allocataire</th>
<th scope="col">Code insee inclus</th>
<th scope="col">Code insee exclus</th>
<th scope="col">Id partenaires exclus</th>
<th scope="col" class="fr-text--right">Actions</th>
{% endset %}

{% set tableBody %}
{% for autoaffectationrule in autoaffectationrules %}
<tr class="autoaffectationrule-row">
<td>{{ autoaffectationrule.territory.zip}} - {{ autoaffectationrule.territory.name}}</td>
<td>
{% if autoaffectationrule.status is same as constant('App\\Entity\\AutoAffectationRule::STATUS_ACTIVE') %}
{% set classe = 'fr-badge--green-emeraude' %}
{% else %}
{% set classe = 'fr-badge--blue-ecume' %}
{% endif %}
<span class="fr-badge {{ classe }} fr-mb-1v">{{ autoaffectationrule.status }}</span></td>
</td>
<td>{{ autoaffectationrule.partnerType.label }}</td>
<td>{{ autoaffectationrule.profileDeclarant }}</td>
<td>{{ autoaffectationrule.parc }}</td>
<td>{{ autoaffectationrule.allocataire }}</td>
<td>
{% if autoaffectationrule.inseeToInclude is same as('all') or autoaffectationrule.inseeToInclude is same as('partner_list') %}
{{ autoaffectationrule.inseeToInclude }}
{% else %}
{% for insee in autoaffectationrule.inseeToInclude|split(',') %}
<div class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ insee }}</div>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</td>
<td>
{% if autoaffectationrule.inseeToExclude %}
{% for insee in autoaffectationrule.inseeToExclude %}
<div class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ insee }}</div>
{% endfor %}
{% else %}
/
{% endif %}
</td>
<td>
{% if autoaffectationrule.partnerToExclude %}
{% for idPartner in autoaffectationrule.partnerToExclude %}
<div class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ idPartner }}</div>
{% endfor %}
{% else %}
/
{% endif %}
</td>
<td class="fr-text--right">
<a class="fr-btn fr-btn--sm fr-fi-edit-line" href="{{ path('back_auto_affectation_rule_edit', {'id': autoaffectationrule.id}) }}"></a>
{% if autoaffectationrule.status is same as constant('App\\Entity\\AutoAffectationRule::STATUS_ACTIVE') %}
<button class="fr-btn fr-btn--danger fr-btn--sm fr-fi-delete-line fr-mt-3v btn-delete-autoaffectationrule"
id="autoaffectationrule_delete_{{ autoaffectationrule.id }}" aria-controls="fr-modal-autoaffectationrule-delete"
data-fr-opened="false" data-autoaffectationrule-id="{{ autoaffectationrule.id }}" data-autoaffectationrule-description="{{ autoaffectationrule.description }}"></button>
{% else %}
<a href="{{ path('back_auto_affectation_rule_reactive', {'id': autoaffectationrule.id}) }}"
class="fr-btn fr-icon-flashlight-fill fr-btn--sm fr-mt-3v" title="Réactiver la règle {{autoaffectationrule.id}}"></a>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="10">Aucune règle d'auto-affectation trouvée</td>
</tr>
{% endfor %}
{% endset %}

{% include '_partials/back/table.html.twig' with { 'tableLabel': 'Liste des règles d\'auto-affectation', 'tableHead': tableHead, 'tableBody': tableBody } %}

<div class="fr-grid-row fr-mt-2v fr-grid-row--center" id="autoaffectation-rule-pagination">
{% import '_partials/macros.html.twig' as macros %}
{{ macros.customPagination(pages, page, 'back_auto_affectation_rule_index', {territory: (currentTerritory ? currentTerritory.id : null)}) }}
Expand Down
Loading

0 comments on commit 8962844

Please sign in to comment.