Skip to content

Commit

Permalink
🚸(dashboard) refactor consent management UI and remove unused features
Browse files Browse the repository at this point in the history
Redesigned the consent management interface for improved clarity and usability.
Removed the language switcher and English localization to focus only on French support.
Added a dedicated contact email field, updated error pages with the email contact
Refined consent-related views, templates and tests to reflect this changes.
Added screenshots of the new UI.
  • Loading branch information
ssorin committed Feb 13, 2025
1 parent 7fd1550 commit a756c70
Show file tree
Hide file tree
Showing 25 changed files with 431 additions and 222 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/dashboard/img/0-dashboard-index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/dashboard/img/1-consent-index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/dashboard/img/2-consent-manage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ and this project adheres to
- add core app with Entity and DeliveryPoint models
- add consent app with Consent model
- add ProConnect authentication system
- add internationalization and language switcher
- add dashboard homepage
- add consent form to manage consents of one or many entities
- add an email notification to users (via Brevo) after they have validated their consents.
Expand Down
6 changes: 5 additions & 1 deletion src/dashboard/apps/consent/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ class ConsentForm(forms.Form):
initial=False,
widget=ConsentCheckboxInput(
attrs={
"label": _("J'accepte de donner mon consentement"),
"label": _(
"Je confirme l'exactitude des informations du présent "
"formulaire et consent au traitement de mes données Enedis "
"par la DGEC"
),
},
),
)
Original file line number Diff line number Diff line change
@@ -1,30 +1,62 @@
{% load i18n %}

{% if entities %}
<strong>{% trans "Validated consent for all entities" %}</strong>
<ul class="fr-links-group fr-mb-2w">
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right"
href="{% url "consent:manage" %}"
data-fr-js-link-actionee="true">
{% trans "Validate content for all entities" %}
</a>
</li>
</ul>
<strong class="fr-mt-2w">Autoriser la DGEC à suivre vos unités d’exploitation</strong>

<strong class="fr-mt-2w">{% trans "Validated consent entity by entity" %}</strong>
<ul class="fr-links-group">
{% for entity in entities %}
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right"
href="{% url "consent:manage" entity.slug %}"
data-fr-js-link-actionee="true">
{{ entity.name }} :
{% blocktranslate with consent_total=entity.get_consents.count entity_count=entity.count_awaiting_consents pluralize=entity.count_awaiting_consents|pluralize %}
{{ entity_count }}/{{ consent_total }} consent{{ pluralize }} to validate
{% endblocktranslate %}
</a>
</li>
{% endfor %}
</ul>
<div class="fr-table fr-table--no-caption fr-table--bordered">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">

<table>
<caption>Autoriser la DGEC à suivre vos unités d’exploitation</caption>
<thead>
<tr>
<th>
<div class="fr-cell__title">Unités d’exploitation</div>
</th>
<th>
<div class="fr-cell__title fr-cell--center">
Nombre de points de livraison en attente
</div>
</th>
<th>
<div class="fr-cell__title fr-cell--center">
Action
</div>
</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
{% if entity.count_awaiting_consents %}
<tr id="undefined-row-key-{{ forloop.counter }}" data-row-key="forloop.counter">
<td>
{# todo: change entity.name with the "unité fonctionnel" id#}
<p>{{ entity.name }}</p>
</td>
<td class="fr-cell--center">
<p class="fr-badge fr-badge--new">
{% with consent_total=entity.get_consents.count entity_count=entity.count_awaiting_consents pluralize=entity.count_awaiting_consents|pluralize %}
{{ entity_count }} PDL en attente sur {{ consent_total }}
{% endwith %}
</p>
</td>
<td class="fr-cell--center">
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right"
href="{% url "consent:manage" entity.slug %}"
data-fr-js-link-actionee="true">
Gérer les autorisations
</a>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

</div>
</div>
</div>
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,60 @@

<div class="fr-card">
<div class="fr-card__body">

<div class="fr-card__content">
<h3 class="fr-card__title">
{{ resume_title }}
</h3>

{% if resume_description %}
<p class="fr-card__desc">
{{ resume_description }}
</p>
{% endif %}

{# awaiting consent - no items #}
{% if resume_awaiting and not has_awaiting_consent %}
<div class="fr-card__desc fr-highlight">
<p class="fr-card__desc">
Aucune autorisation en attente.
<br />
Si vous pensez qu'il s'agit d'une erreur, merci de contacter l'équipe QualiCharge.
<a class="fr-link fr-card__desc"
href="mailto:{{ contact_email }}?subject=[QualiCharge] Aucune autorisation en attente dans le Dashboard." target="_blank">
{{ contact_email }}
</a>
</p>
</div>
{% endif %}

{# validated consent - no items #}
{% if resume_validated and not has_validated_consent %}
<div class="fr-card__desc fr-highlight">
<p class="fr-card__desc">
Aucune station suivie.
<br />
Si vous pensez qu'il s'agit d'une erreur, merci de contacter l'équipe QualiCharge.
<a class="fr-link fr-card__desc"
href="mailto:{{ contact_email }}?subject=[QualiCharge] Aucune station suivie dans le Dashboard." target="_blank">
{{ contact_email }}
</a>
</p>
</div>
{% endif %}
</div>

<div class="fr-card__footer">
{% if resume_validated %}
{% include "consent/includes/_consent_summary_validated.html" %}
{% endif %}
{# awaiting consent #}
{% if resume_awaiting %}
{% include "consent/includes/_consent_summary_awaiting.html" %}
{% endif %}

{# validated consent #}
{% if resume_validated %}
{% include "consent/includes/_consent_summary_validated.html" %}
{% endif %}
</div>

</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,14 +1,62 @@
{% load i18n %}

{% if entities %}
<ul class="fr-links-group">
{% for entity in entities %}
<li>
{{ entity.name }}:
{% blocktranslate with consent_total=entity.get_consents.count consent_count=entity.count_validated_consents pluralize=entity.count_validated_consents|pluralize %}
{{ consent_count }}/{{ consent_total }} consent{{ pluralize }} validated
{% endblocktranslate %}
</li>
{% endfor %}
</ul>
<div class="fr-table fr-table--no-caption fr-table--bordered">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">

<table>
<caption>Stations suivies</caption>

<thead>
<tr>
<th scope="col">
<div class="fr-cell__title">Unités d’exploitation</div>
</th>
<th scope="col">
<div class="fr-cell__title fr-cell--center">
Nombre de points de livraison suivis
</div>
</th>
<th scope="col">
<div class="fr-cell__title fr-cell--center">
Consulter la liste
</div>
</th>
</tr>
</thead>

<tbody>
{% for entity in entities %}
{% if entity.count_validated_consents %}
<tr id="undefined-row-key-{{ forloop.counter }}" data-row-key="forloop.counter">
<td>
{# todo: change entity.name with the "unité fonctionnel" id#}
<p>{{ entity.name }}</p>
</td>
<td class="fr-cell--center">
<p class="fr-badge fr-badge--success">
{% with consent_total=entity.get_consents.count consent_count=entity.count_validated_consents pluralize=entity.count_validated_consents|pluralize %}
{{ consent_count }} PDL suivi{{ pluralize }}
{% endwith %}
</p>
</td>
<td class="fr-cell--center">
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right"
href="{% url "consent:manage" entity.slug %}"
data-fr-js-link-actionee="true">
Consulter la liste
</a>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

</div>
</div>
</div>
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
<br />
En cas d'informations erronées, merci de nous contacter :
<a class="fr-link fr-link--icon-left fr-icon-mail-line"
href="mailto:{{ mailto }}?subject=[QualiCharge] Informations erronées dans le formulaire de gestion des autorisations">
{{ mailto }}
href="mailto:{{ contact_email }}?subject=[QualiCharge] Informations erronées dans le formulaire de gestion des autorisations" target="_blank">
{{ contact_email }}
</a>
</p>

<div class="fr-table fr-table--bordered" id="table-bordered-component">
{% with row_number=0 %}
<div class="fr-table fr-table--bordered" id="table-company-bordered-component">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">
<table>
<caption class="fr-text--md">
Informations sur l'entreprise et le représentant
Informations sur l'entreprise
</caption>
<thead>
<tr>
Expand All @@ -42,38 +43,53 @@
</tr>
</thead>
<tbody>
{% with row_number=0 %}
<tr class="fr-table__section">
<td colspan="2"><strong>Informations sur la structure</strong></td>
</tr>
{% include "consent/includes/_table_row.html" with label="Dénomination sociale" value=entity.name row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Type de structure" value=entity.company_type row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Type de structure" value=entity.get_company_type_display row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Forme juridique" value=entity.legal_form row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Nom commercial" value=entity.trade_name row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="N° d'identification SIRET" value=entity.siret row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Activité NAF" value=entity.naf row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Adresse" value=entity.address_1 row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Complément d'adresse" value=entity.address_2 row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Code Postale" value=entity.address_zip_code row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Code postal" value=entity.address_zip_code row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Commune" value=entity.address_city row_number=row_number|add:"1" %}
{# todo: add a field to retrieve this information (+ email and phone) if it doesn't exist #}
{# todo: add a form field to retrieve this information (+ email and phone) if it doesn't exist #}
{% include "consent/includes/_table_row.html" with label="Nom du titulaire du contrat" value="-" row_number=row_number|add:"1" %}
</tbody>
</table>
</div>
</div>
</div>
</div>

<tr class="fr-table__section">
<td colspan="2">
<strong>Informations sur le signataire du présent formulaire</strong>
</td>
</tr>
<div class="fr-table fr-table--bordered" id="table-representative-bordered-component">
<div class="fr-table__wrapper">
<div class="fr-table__container">
<div class="fr-table__content">
<table>
<caption class="fr-text--md">
Informations sur le représentant de l'entreprise
</caption>
<thead>
<tr>
<th scope="col">
Libellé
</th>
<th scope="col">
Valeur
</th>
</tr>
</thead>
<tbody>
{% include "consent/includes/_table_row.html" with label="Nom" value=request.user.last_name row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="Prénom" value=request.user.first_name row_number=row_number|add:"1" %}
{% include "consent/includes/_table_row.html" with label="E-mail" value=request.user.email row_number=row_number|add:"1" %}
{% endwith %}
</tbody>
</table>
</div>
</div>
</div>
</div>

{% endwith %}
</div>
{% endfor %}
Loading

0 comments on commit a756c70

Please sign in to comment.