From a24a96c476a3f2f0b4c5c2aecf814e5055d99781 Mon Sep 17 00:00:00 2001 From: ssorin Date: Mon, 27 Jan 2025 17:38:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8(dashboard)=20refactor=20and=20modu?= =?UTF-8?q?larize=20consent=20management=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split and reorganized the manage consent template into reusable modular components. Introduced new partial templates for representative and company info, authorizations, and consent date/place. Retrieves and displays data of entity, user, control_authority and date and place of signature. Added contractual texts and translates into French. --- .github/workflows/dashboard.yml | 6 +- env.d/dashboard | 5 +- src/dashboard/apps/consent/forms.py | 93 ++++++++++++++- src/dashboard/apps/consent/settings.py | 2 +- .../consent/forms/widgets/checkbox.html | 8 +- .../includes/_manage_authorisations.html | 75 ++++++++++++ .../_manage_company_informations.html | 79 +++++++++++++ .../consent/includes/_manage_consents.html | 62 ++++++++++ .../_manage_consents_control_authority.html | 49 ++++++++ .../includes/_manage_consents_date_place.html | 19 +++ .../consent/includes/_table_row.html | 8 ++ .../consent/templates/consent/manage.html | 108 +++++------------- src/dashboard/apps/consent/views.py | 5 + src/dashboard/dashboard/settings.py | 6 +- 14 files changed, 438 insertions(+), 87 deletions(-) create mode 100644 src/dashboard/apps/consent/templates/consent/includes/_manage_authorisations.html create mode 100644 src/dashboard/apps/consent/templates/consent/includes/_manage_company_informations.html create mode 100644 src/dashboard/apps/consent/templates/consent/includes/_manage_consents.html create mode 100644 src/dashboard/apps/consent/templates/consent/includes/_manage_consents_control_authority.html create mode 100644 src/dashboard/apps/consent/templates/consent/includes/_manage_consents_date_place.html create mode 100644 src/dashboard/apps/consent/templates/consent/includes/_table_row.html diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index f45ad58e..e58e4b82 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -44,7 +44,8 @@ jobs: DASHBOARD_CONTROL_AUTHORITY_CITY: Paris DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY: John Doe DASHBOARD_CONTROL_AUTHORITY_EMAIL: jdoe@exemple.com - DASHBOARD_CONSENT_DONE_AT: Paris + DASHBOARD_CONSENT_SIGNATURE_LOCATION: Paris + DASHBOARD_CONTACT_EMAIL: contact@exemple.com steps: - uses: actions/checkout@v4 - name: Install pipenv @@ -108,4 +109,5 @@ jobs: DASHBOARD_CONTROL_AUTHORITY_CITY: Paris DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY: John Doe DASHBOARD_CONTROL_AUTHORITY_EMAIL: jdoe@exemple.com - DASHBOARD_CONSENT_DONE_AT: Paris + DASHBOARD_CONSENT_SIGNATURE_LOCATION: Paris + DASHBOARD_CONTACT_EMAIL: contact@exemple.com diff --git a/env.d/dashboard b/env.d/dashboard index bea190d9..31d02be3 100644 --- a/env.d/dashboard +++ b/env.d/dashboard @@ -28,4 +28,7 @@ DASHBOARD_CONTROL_AUTHORITY_CITY=Paris DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY=John Doe DASHBOARD_CONTROL_AUTHORITY_EMAIL=jdoe@exemple.com -DASHBOARD_CONSENT_DONE_AT=Paris +DASHBOARD_CONSENT_SIGNATURE_LOCATION=Paris + +# Email to contact the QualiCharge team +DASHBOARD_CONTACT_EMAIL=contact@exemple.com diff --git a/src/dashboard/apps/consent/forms.py b/src/dashboard/apps/consent/forms.py index 3e94e7b0..3b4b8103 100644 --- a/src/dashboard/apps/consent/forms.py +++ b/src/dashboard/apps/consent/forms.py @@ -12,15 +12,102 @@ class ConsentCheckboxInput(CheckboxInput): class ConsentForm(forms.Form): - """Save user consent through a checkbox field.""" + """Save user consent through a checkbox field. + Note: all texts of this form (attributes: `label`, `description`, `help_text`) + are intended to appear in a contract and must therefore be in French and + non-translatable. + """ + + # Specific authorisation checkbox + is_authorized_signatory = forms.BooleanField( + required=True, + initial=False, + widget=ConsentCheckboxInput( + attrs={ + "label": "Le signataire du présent formulaire déclare être dûment " + "habilité par le client pour la signature du présent " + "document.", + }, + ), + ) + + allows_measurements = forms.BooleanField( + required=True, + initial=False, + widget=ConsentCheckboxInput( + attrs={ + "label": "L'historique des mesures, en kWh,", + "description": "du site (et puissances atteintes et dépassements " + "de puissance) : sur la période souhaitée, de 36 mois " + "maximum à compter de la date de la demande " + "(période limitée à la date de début du contrat)", + }, + ), + ) + allows_daily_index_readings = forms.BooleanField( + required=True, + initial=False, + widget=ConsentCheckboxInput( + attrs={ + "label": "L'historique des relevés d'index quotidiens, en kWh, ", + "description": "du site; sur la période souhaitée, de 36 mois maximum " + "à compter de la date de la demande (période limitée " + "à la date de début du contrat)", + }, + ), + ) + allows_max_daily_power = forms.BooleanField( + required=True, + initial=False, + widget=ConsentCheckboxInput( + attrs={ + "label": "L'historique de la puissance maximale quotidienne, en kVA " + "ou kWh,", + "description": "du site ; sur la période souhaitée, de 36 mois maximum " + "à compter de la date de la demande (période limitée à " + "la date de début du contrat)", + }, + ), + ) + allows_load_curve = forms.BooleanField( + required=True, + initial=False, + widget=ConsentCheckboxInput( + attrs={ + "label": "L'historique de courbe de charge, aux pas restitués " + "par Enedis,", + "description": "du site1; sur la période souhaitée, " + "de 24 mois maximum " + "à compter de la date de la demande (période limitée à " + "la date de début du contrat)", + "help_text": "1 Ensembles de valeurs moyennes horodatées " + "de la puissance active ou réactive soutirée, sur des " + "périodes d'intégrations consécutives et de même durée.", + }, + ), + ) + allows_technical_contractual_data = forms.BooleanField( + required=True, + initial=False, + widget=ConsentCheckboxInput( + attrs={ + "label": "Les données techniques et contractuelles disponibles ", + "description": "du site ; Caractéristiques du raccordement, du " + "dispositif de comptage et des informations " + "contractuelles (option tarifaire, puissance " + "souscrite...)", + }, + ), + ) + + # Global authorisation checkbox - this field must be in last position. consent_agreed = forms.BooleanField( required=True, initial=False, widget=ConsentCheckboxInput( attrs={ - "label": _("I agree to give my consent"), - "help_text": _("Please confirm your consent by checking this box."), + "label": _("J'accepte de donner mon consentement"), }, ), ) diff --git a/src/dashboard/apps/consent/settings.py b/src/dashboard/apps/consent/settings.py index ef0542a5..e00ec8d2 100644 --- a/src/dashboard/apps/consent/settings.py +++ b/src/dashboard/apps/consent/settings.py @@ -27,4 +27,4 @@ "email": "", }, ) -CONSENT_DONE_AT = getattr(settings, "CONSENT_DONE_AT", "") +CONSENT_SIGNATURE_LOCATION = getattr(settings, "CONSENT_SIGNATURE_LOCATION", "") diff --git a/src/dashboard/apps/consent/templates/consent/forms/widgets/checkbox.html b/src/dashboard/apps/consent/templates/consent/forms/widgets/checkbox.html index 519a6996..b85c280d 100644 --- a/src/dashboard/apps/consent/templates/consent/forms/widgets/checkbox.html +++ b/src/dashboard/apps/consent/templates/consent/forms/widgets/checkbox.html @@ -2,6 +2,10 @@ + diff --git a/src/dashboard/apps/consent/templates/consent/includes/_manage_authorisations.html b/src/dashboard/apps/consent/templates/consent/includes/_manage_authorisations.html new file mode 100644 index 00000000..292ea90d --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_manage_authorisations.html @@ -0,0 +1,75 @@ +{% load i18n %} + +{% comment %} + Note: all texts of this page are intended to appear in a contract and must + therefore be in French and non-translatable. +{% endcomment %} + +
+ + D. Données à transmettre à la DGEC + + +

Par la signature de ce document, le Client autorise expressément le Tiers à + demander et à recevoir communication auprès d'Enedis, SA à directoire et à + conseil de surveillance, au capital de 270 037 000 euros, immatriculés au R.C.S + de Nanterre sous le numéro 444 608 442 et dont le siège social est situé Tour + Enedis, 34 place des Corolles, 92070 Paris La Défense Cedex, des données + cochées ci-dessous, sous réserve de disponibilité : +

+ + {% for field in form %} + + {% if forloop.last %} + {% comment %} + These paragraphs are located just before the `global consent checkbox`. + Attention: the `consent_agreed` checkbox must always be positioned last in the corresponding forms.py. + {% endcomment %} +

+ Usage des données : Suivi de la mise en œuvre de la politique énergétique. +

+

+ La présente autorisation ne peut être cédée et pourra être retirée à tout moment. + Elle est consentie pour toute la période du contrat ou à défaut pour la durée de + 12 mois à compter de la date de signature. Les données ainsi acquises sont + détruites dès la fin de validité de la présente autorisation. +
+ La présente autorisation est conservée pendant 5 ans à compter + de sa signature conformément à l’article 2224 du code civil et sont destinées à + Enedis qui s’engage à ne pas communiquer ces informations à des tiers sauf + obligation réglementaire. +
+ Conformément à la loi n°78-17 du 6 janvier 1978 modifiée et au règlement (UE) + n°2016/679 du 27 avril 2016, les informations recueillies sont enregistrées dans + un fichier informatisé par ENEDIS en sa qualité de responsable du traitement à + des fins de gestion et de traçabilité des demandes. +
+ Vous disposez d’un droit d’accès à vos données, de rectification, d’opposition et + d’effacement pour motifs légitimes. + Vous disposez, également, d’un droit à la limitation du traitement et à la + portabilité des données à caractère personnel vous concernant. + Vous pouvez exercer vos droits à l’adresse suivante : Enedis, 34 place des + Corolles, 92079 Paris La Défense Cedex. + Conformément à la loi "informatique et libertés", vous disposez de la faculté + d’introduire une réclamation auprès de la CNIL. +

+ + {% include "consent/includes/_manage_consents_date_place.html" %} + {% endif %} + +
+
+ {{ field }} + +
+
+ {% endfor %} +
diff --git a/src/dashboard/apps/consent/templates/consent/includes/_manage_company_informations.html b/src/dashboard/apps/consent/templates/consent/includes/_manage_company_informations.html new file mode 100644 index 00000000..9d61c3af --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_manage_company_informations.html @@ -0,0 +1,79 @@ +{% load i18n %} + +{% comment %} + Note: all texts of this page are intended to appear in a contract and must + therefore be in French and non-translatable. +{% endcomment %} + +{% for entity in entities %} +
+ + + B. Client raccordé + + +

+ Merci de vérifier l’exactitude des informations concernant votre structure et le + signataire du présent formulaire. +
+ En cas d'informations erronées, merci de nous contacter : + + {{ mailto }} + +

+ +
+
+
+
+ + + + + + + + + + {% with row_number=0 %} + + + + {% 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="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="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 #} + {% include "consent/includes/_table_row.html" with label="Nom du titulaire du contrat" value="-" row_number=row_number|add:"1" %} + + + + + {% 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 %} + +
+ Informations sur l'entreprise et le représentant +
+ Libellé + + Valeur +
Informations sur la structure
+ Informations sur le signataire du présent formulaire +
+
+
+
+
+ +
+{% endfor %} diff --git a/src/dashboard/apps/consent/templates/consent/includes/_manage_consents.html b/src/dashboard/apps/consent/templates/consent/includes/_manage_consents.html new file mode 100644 index 00000000..eae47025 --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_manage_consents.html @@ -0,0 +1,62 @@ +{% load i18n %} + +{% comment %} + Note: all texts of this page are intended to appear in a contract and must + therefore be in French and non-translatable. +{% endcomment %} + +
+ + A. Points de livraison à valider + + +

+ Cochez les lignes correspondant aux PRMs pour lesquelles vous autorisez expressément + la DGEC à demander et à recevoir la communication des données mentionnées au point D. +

+ + {# toggle button #} +
+ + +
+ + {# delivery points #} + + +
diff --git a/src/dashboard/apps/consent/templates/consent/includes/_manage_consents_control_authority.html b/src/dashboard/apps/consent/templates/consent/includes/_manage_consents_control_authority.html new file mode 100644 index 00000000..107d66a3 --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_manage_consents_control_authority.html @@ -0,0 +1,49 @@ +{% load i18n %} + +{% comment %} + Note: all texts of this page are intended to appear in a contract and must + therefore be in French and non-translatable. +{% endcomment %} + +
+ + + C. Tiers + + +
+
+
+
+ + + + + + + + + + {% with row_number=0 %} + {% include "consent/includes/_table_row.html" with label="Dénomination sociale" value=control_authority.name row_number=row_number|add:"1" %} + {% with control_authority.address_1|add:"
"|add:control_authority.address_2|add:"
"|add:control_authority.zip_code|add:" "|add:control_authority.city as control_authority_address %} + {% include "consent/includes/_table_row.html" with label="Adresse" value=control_authority_address|safe row_number=row_number|add:"1" %} + {% endwith %} + {% include "consent/includes/_table_row.html" with label="Représenté par" value=control_authority.represented_by row_number=row_number|add:"1" %} + {% include "consent/includes/_table_row.html" with label="E-mail" value=control_authority.email row_number=row_number|add:"1" %} + {% endwith %} + +
+ Informations sur le tiers +
+ Libellé + + Valeur +
+
+
+
+
+ +
+ diff --git a/src/dashboard/apps/consent/templates/consent/includes/_manage_consents_date_place.html b/src/dashboard/apps/consent/templates/consent/includes/_manage_consents_date_place.html new file mode 100644 index 00000000..dff5bbd2 --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_manage_consents_date_place.html @@ -0,0 +1,19 @@ +{% load i18n %} + +{% comment %} + Note: all texts of this page are intended to appear in a contract and must + therefore be in French and non-translatable. +{% endcomment %} + +

+ Fait à : {{ signature_location }} +
+ Le : {% now "d/m/Y" %} +

+ + diff --git a/src/dashboard/apps/consent/templates/consent/includes/_table_row.html b/src/dashboard/apps/consent/templates/consent/includes/_table_row.html new file mode 100644 index 00000000..c7efb768 --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_table_row.html @@ -0,0 +1,8 @@ + + + {{ label }} + + + {{ value }} + + diff --git a/src/dashboard/apps/consent/templates/consent/manage.html b/src/dashboard/apps/consent/templates/consent/manage.html index d29a7dd4..66b791d6 100644 --- a/src/dashboard/apps/consent/templates/consent/manage.html +++ b/src/dashboard/apps/consent/templates/consent/manage.html @@ -1,89 +1,43 @@ {% extends "consent/base.html" %} +{% comment %} + Note: all texts of this page are intended to appear in a contract and must + therefore be in French and non-translatable. +{% endcomment %} + {% load i18n static %} {% block dashboard_content %} -

{% trans "Manage consents" %}

- -{% if entities %} -
- {% csrf_token %} - -
- {% if form.errors %} -
-

- {% trans "The form contains errors" %} -

-
- {% endif %} -
- - {# toggle button #} -
-
- - -
-
+

Gérer les autorisations

-