Skip to content

Commit

Permalink
add table template on 2 bo tables #3377
Browse files Browse the repository at this point in the history
  • Loading branch information
emilschn committed Dec 9, 2024
1 parent 10a4703 commit 68fc9f0
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 143 deletions.
2 changes: 1 addition & 1 deletion templates/_partials/back/table.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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' }}">
<table class="{{ cancelSortable is defined ? '' : 'sortable' }} {{ cancelMultiline is defined ? '' : 'fr-cell--multiline' }}" aria-label="{{ tableLabel }}" aria-describedby="{{ tableDescId ?? 'desc-table' }}">
<thead>
<tr>
{{tableHead}}
Expand Down
2 changes: 1 addition & 1 deletion templates/back/expired-account/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<th scope="col">E-mail</th>
{% endset %}

{% set tableBody %}
{% set tableBody %}
{% for user in expiredUsagers %}
<tr class="user-row">
<td>{{ user.nom}}</td>
Expand Down
158 changes: 75 additions & 83 deletions templates/back/partner/view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<div id="tabpanel-agents-panel" class="fr-tabs__panel fr-tabs__panel" role="tabpanel" aria-labelledby="tabpanel-agents" tabindex="0">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-6">
<h2>Agents du partenaire</h2>
<h2 id="desc-table">Agents du partenaire</h2>
</div>
<div class="fr-col-6 fr-text--right">
<a href="#" class="fr-btn fr-btn--success fr-btn--icon-left fr-btn--md fr-fi-add-line fr-btn-add-user"
Expand All @@ -200,90 +200,82 @@
un utilisateur</a>
</div>
</div>
<div class="fr-table">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">
<table class="fr-cell--multiline" aria-label="Liste des utilisateurs du partenaire">
<thead>
<tr>
<th scope="col">Dernière connexion</th>
<th scope="col">Nom</th>
<th scope="col">Prénom</th>
<th scope="col">Courriel</th>
<th scope="col">Notif. e-mails</th>
<th scope="col">Statut</th>
<th scope="col">Rôle</th>

{% set tableHead %}
<th scope="col">Dernière connexion</th>
<th scope="col">Nom</th>
<th scope="col">Prénom</th>
<th scope="col">Courriel</th>
<th scope="col">Notif. e-mails</th>
<th scope="col">Statut</th>
<th scope="col">Rôle</th>
{% if platform.feature_permission_affectation and is_granted('ASSIGN_PERMISSION_AFFECTATION', partner) %}
<th scope="col">Droits d'affectation</th>
{% endif %}
<th scope="col" class="fr-text--right">Actions</th>
{% endset %}

{% set tableBody %}
{% for user in partner.users|filter(user => user.id is not null) %}
<tr class="user-row">
<td>{{ user.getLastLoginAtStr('d/m/Y') }}</td>
<td>{{ user.nom }}</td>
<td>{{ user.prenom }}</td>
<td>{{ user.email }}</td>
<td><span class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ user.isMailingActive ? 'OUI' : 'NON' }}</span></td>
<td>{% if user.statut == 0 %}
{% set classe = 'fr-badge--orange-terre-battue' %}
{% set label = 'INACTIF' %}
{% elseif user.statut == 1 %}
{% set classe = 'fr-badge--green-emeraude' %}
{% set label = 'ACTIF' %}
{% elseif user.statut == 2 %}
{% set classe = 'fr-badge--blue-ecume' %}
{% set label = 'ARCHIVE' %}
{% endif %}
<span class="fr-badge {{ classe }} fr-mb-1v">{{ label }}</span></td>
<td>
{{ user.roleLabel() }}
</td>
{% if platform.feature_permission_affectation and is_granted('ASSIGN_PERMISSION_AFFECTATION', partner) %}
<td>{{ user.isSuperAdmin() or user.isTerritoryAdmin() or user.hasPermissionAffectation() ? 'Oui' : 'Non' }}</td>
{% endif %}
<td class="fr-text--right">
{% if is_granted('USER_EDIT', user) %}
<a href="#" class="fr-btn fr-fi-edit-line fr-mt-3v btn-edit-partner-user"
id="partner_users_edit_{{ user.id }}" aria-controls="fr-modal-user-edit"
data-fr-opened="false"
data-usernom="{{ user.nom }}"
data-userprenom="{{ user.prenom }}"
data-userrole="{{ user.roles[0] }}"
{% if platform.feature_permission_affectation and is_granted('ASSIGN_PERMISSION_AFFECTATION', partner) %}
<th scope="col">Droits d'affectation</th>
data-userpermissionaffectation="{{ user.hasPermissionAffectation() ? '1' : '0' }}"
{% endif %}
<th scope="col" class="fr-text--right">Actions</th>
</tr>
</thead>
<tbody>
{% for user in partner.users|filter(user => user.id is not null) %}
<tr class="user-row">
<td>{{ user.getLastLoginAtStr('d/m/Y') }}</td>
<td>{{ user.nom }}</td>
<td>{{ user.prenom }}</td>
<td>{{ user.email }}</td>
<td><span class="fr-badge fr-badge--blue-ecume fr-mb-1v">{{ user.isMailingActive ? 'OUI' : 'NON' }}</span></td>
<td>{% if user.statut == 0 %}
{% set classe = 'fr-badge--orange-terre-battue' %}
{% set label = 'INACTIF' %}
{% elseif user.statut == 1 %}
{% set classe = 'fr-badge--green-emeraude' %}
{% set label = 'ACTIF' %}
{% elseif user.statut == 2 %}
{% set classe = 'fr-badge--blue-ecume' %}
{% set label = 'ARCHIVE' %}
{% endif %}
<span class="fr-badge {{ classe }} fr-mb-1v">{{ label }}</span></td>
<td>
{{ user.roleLabel() }}
</td>
{% if platform.feature_permission_affectation and is_granted('ASSIGN_PERMISSION_AFFECTATION', partner) %}
<td>{{ user.isSuperAdmin() or user.isTerritoryAdmin() or user.hasPermissionAffectation() ? 'Oui' : 'Non' }}</td>
{% endif %}
<td class="fr-text--right">
{% if is_granted('USER_EDIT', user) %}
<a href="#" class="fr-btn fr-fi-edit-line fr-mt-3v btn-edit-partner-user"
id="partner_users_edit_{{ user.id }}" aria-controls="fr-modal-user-edit"
data-fr-opened="false"
data-usernom="{{ user.nom }}"
data-userprenom="{{ user.prenom }}"
data-userrole="{{ user.roles[0] }}"
{% if platform.feature_permission_affectation and is_granted('ASSIGN_PERMISSION_AFFECTATION', partner) %}
data-userpermissionaffectation="{{ user.hasPermissionAffectation() ? '1' : '0' }}"
{% endif %}
data-userismailingactive="{{ user.isMailingActive }}"
data-userid="{{ user.id }}"
data-useremail="{{ user.email }}">
</a>
{% endif %}
{% if is_granted('USER_TRANSFER', user) and app.request.get('_route') is not same as('back_partner_new') %}
<a href="#" class="fr-btn fr-btn--orange fr-fi-upload-2-fill fr-mt-3v btn-transfer-partner-user"
id="partner_users_transfer_{{ user.id }}" aria-controls="fr-modal-user-transfer"
data-fr-opened="false" data-username="{{ user.nomComplet }}" data-userid="{{ user.id }}"></a>
{% endif %}
{% if is_granted('USER_DELETE', user) and app.request.get('_route') is not same as('back_partner_new') %}
<a href="#" class="fr-btn fr-btn--danger fr-fi-delete-line fr-mt-3v btn-delete-partner-user"
id="partner_users_delete_{{ user.id }}" aria-controls="fr-modal-user-delete"
data-fr-opened="false" data-username="{{ user.nomComplet }}" data-userid="{{ user.id }}" data-useremail="{{ user.email }}"></a>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="3">Aucun agent trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
data-userismailingactive="{{ user.isMailingActive }}"
data-userid="{{ user.id }}"
data-useremail="{{ user.email }}">
</a>
{% endif %}
{% if is_granted('USER_TRANSFER', user) and app.request.get('_route') is not same as('back_partner_new') %}
<a href="#" class="fr-btn fr-btn--orange fr-fi-upload-2-fill fr-mt-3v btn-transfer-partner-user"
id="partner_users_transfer_{{ user.id }}" aria-controls="fr-modal-user-transfer"
data-fr-opened="false" data-username="{{ user.nomComplet }}" data-userid="{{ user.id }}"></a>
{% endif %}
{% if is_granted('USER_DELETE', user) and app.request.get('_route') is not same as('back_partner_new') %}
<a href="#" class="fr-btn fr-btn--danger fr-fi-delete-line fr-mt-3v btn-delete-partner-user"
id="partner_users_delete_{{ user.id }}" aria-controls="fr-modal-user-delete"
data-fr-opened="false" data-username="{{ user.nomComplet }}" data-userid="{{ user.id }}" data-useremail="{{ user.email }}"></a>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="3">Aucun agent trouvé</td>
</tr>
{% endfor %}
{% endset %}

{% include '_partials/back/table.html.twig' with { 'tableLabel': 'Liste des utilisateurs du partenaire', 'tableDescId': 'desc-table', 'tableHead': tableHead, 'tableBody': tableBody, 'cancelSortable': true } %}
</div>
</div>

Expand Down
108 changes: 50 additions & 58 deletions templates/back/signalement_export/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,65 +68,57 @@
<li><strong>Logement social :</strong> s'il s'agit d'un logement social ou non</li>
</ul>

<div class="fr-table fr-table--bordered" id="table-select-export-col">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">
<table id="table-selectable">
<caption>
Infos à sélectionner
<div class="fr-table__caption__desc">
Dans le tableau ci-dessous, sélectionnez les colonnes à ajouter à votre fichier.
<br>
Cliquez sur la case dans l'en-tête pour tout sélectionner.
<br>
Si vous ne cochez aucune case, seule les informations obligatoires vous seront transmises.
</div>
</caption>
<thead>
<tr>
<th class="fr-cell--fixed" role="columnheader">
<div class="fr-checkbox-group fr-checkbox-group--sm">
<input id="table-select-checkbox-all" type="checkbox">
<label class="fr-label" for="table-select-checkbox-all">
Nom de la colonne
</label>
</div>
</th>
<th scope="col">
Nom de la colonne
</th>
<th scope="col">
Détails
</th>
</tr>
</thead>
<tbody>
{% for colId, col in selectable_cols %}
<tr data-row-key="{{ loop.index }}">
<th class="fr-cell--fixed" scope="row">
<div class="fr-checkbox-group fr-checkbox-group--sm">
<input name="cols[]" value="{{ colId }}" id="table-select-checkbox-{{ colId }}" type="checkbox" class="checkbox-column"
{% if colId in selected_cols %}checked="checked"{% endif %}>
<label class="fr-label" for="table-select-checkbox-{{ colId }}">
{{ col.name }}
</label>
</div>
</th>
<td>
{{ col.name }}
</td>
<td>
{{ col.description }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<h2 class="fr-mb-0" id="desc-table">
Infos à sélectionner
<div class="fr-text--sm fr-text--light">
Dans le tableau ci-dessous, sélectionnez les colonnes à ajouter à votre fichier.
<br>
Cliquez sur la case dans l'en-tête pour tout sélectionner.
<br>
Si vous ne cochez aucune case, seule les informations obligatoires vous seront transmises.
</div>
</div>
</h2>

{% set tableHead %}
<th class="fr-cell--fixed" role="columnheader">
<div class="fr-checkbox-group fr-checkbox-group--sm">
<input id="table-select-checkbox-all" type="checkbox">
<label class="fr-label" for="table-select-checkbox-all">
Nom de la colonne
</label>
</div>
</th>
<th scope="col">
Nom de la colonne
</th>
<th scope="col">
Détails
</th>
{% endset %}

{% set tableBody %}
{% for colId, col in selectable_cols %}
<tr data-row-key="{{ loop.index }}">
<th class="fr-cell--fixed" scope="row">
<div class="fr-checkbox-group fr-checkbox-group--sm">
<input name="cols[]" value="{{ colId }}" id="table-select-checkbox-{{ colId }}" type="checkbox" class="checkbox-column"
{% if colId in selected_cols %}checked="checked"{% endif %}>
<label class="fr-label" for="table-select-checkbox-{{ colId }}">
{{ col.name }}
</label>
</div>
</th>
<td>
{{ col.name }}
</td>
<td>
{{ col.description }}
</td>
</tr>
{% endfor %}
{% endset %}

{% include '_partials/back/table.html.twig' with { 'tableLabel': 'Liste des colonnes à exporter', 'tableDescId': 'desc-table-expired', 'tableHead': tableHead, 'tableBody': tableBody, 'cancelSortable': true, 'cancelMultiline': true } %}

<ul class="fr-btns-group fr-btns-group--inline-lg fr-btns-group--right fr-btns-group--icon-left">
<li>
Expand Down

0 comments on commit 68fc9f0

Please sign in to comment.