Skip to content

Commit

Permalink
Dsfr recap demande (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarjolaineLB authored Sep 18, 2024
2 parents e9e9ad1 + 78dade3 commit bbad781
Show file tree
Hide file tree
Showing 26 changed files with 453 additions and 130 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
details.request-card-details {
height: 100%;
position: relative;
}

details.request-card-details * {
box-sizing: border-box;
}

details.request-card-details summary {
flex-wrap: nowrap;
height: 100%;
min-height: 4rem;
position: relative;
z-index: 10;
}

details.request-card-details[open] .details-summary-header {
display: none;
}

details.request-card-details[open] .fr-icon-arrow-up-s-line::before {
-webkit-mask-image: url(/static/dsfr/dist/icons/system/arrow-down-s-line.svg);
mask-image: url(/static/dsfr/dist/icons/system/arrow-down-s-line.svg);
}

details.request-card-details .details-content {
padding: inherit;
position: absolute;
width: 100%;
z-index: 0;
}

details.request-card-details .details-content .fr-btns-group .fr-btn {
margin-bottom: 0;
margin-top: 0;
}
2 changes: 1 addition & 1 deletion aidants_connect_common/static/css/main.css

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion aidants_connect_common/static/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ p:last-child {
justify-content: space-between;
}

.flex-column {
flex-direction: column;
}

.width-100 {
width: 100%;
width: 100% !important;
}

.spacer {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% load static ac_common ac_extras %}

{# Prevent messing with the absolute positionning of the design #}
{# See https://stackoverflow.com/questions/17115344/absolute-positioning-ignoring-padding-of-parent #}
<div class="fr-col-12 fr-col-md-6 request-card" {% block container_args %}{% endblock %}>
<details {% if habilitation_request.details_id %}id="{{ habilitation_request.details_id }}" {% endif %}class="request-card-details">
{% block details_introduction %}{% endblock %}
<summary
class="fr-grid-row fr-grid-row--middle fr-grid-row--gap-2v fr-tile--shadow fr-py-2v fr-px-4v"
title="{{ habilitation_request.user.full_name }} {{ habilitation_request.user.email }}"
>
<img src="{% static "images/avatar.svg" %}" width="36" height="36" alt="" />
<span class="fr-grid-row--center fr-text--overflow-hidden spacer">
<p class="fr-m-0 fr-text--bold">{{ habilitation_request.user.full_name }}</p>
{% if habilitation_request.user.email %}
<p class="details-summary-header fr-m-0 fr-text--overflow-hidden">{{ habilitation_request.user.email }}</p>
{% endif %}
</span>
<span
type="button"
class="fr-btn fr-btn--tertiary fr-btn--sm fr-icon-arrow-up-s-line"
aria-hidden="true"
></span>
</summary>
<div class="details-content fr-p-4v fr-tile--shadow">
<section class="user-informations">
{% for field in habilitation_request.user.details_fields %}
<section class="fr-my-4v">
<p class="fr-text--sm fr-text-mention--grey">{{ field.label }}</p>
{{ field.value }}
</section>
{% endfor %}
</section>
<ul class="fr-btns-group fr-btns-group--sm fr-btns-group--right fr-btns-group--inline">
<li>
{% block action_buttons %}
<a
href="{{ habilitation_request.user.edit_href }}"
{% if habilitation_request.details_id %}id="edit-button-{{ habilitation_request.details_id }}"{% endif %}
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-edit-fill"
>
Éditer
</a>
{% endblock %}
</li>
</ul>
</div>
</details>
</div>
2 changes: 2 additions & 0 deletions aidants_connect_habilitation/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class OrganisationRequestAdmin(VisibleToAdminMetier, ReverseModelAdmin):
"mission_description",
"avg_nb_demarches",
"cgu",
"not_free",
"dpo",
"without_elected",
"professionals_only",
Expand All @@ -223,6 +224,7 @@ class OrganisationRequestAdmin(VisibleToAdminMetier, ReverseModelAdmin):
"mission_description",
"avg_nb_demarches",
"cgu",
"not_free",
"dpo",
"without_elected",
"professionals_only",
Expand Down
7 changes: 6 additions & 1 deletion aidants_connect_habilitation/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,14 @@ def save(self, commit=True) -> Tuple[Manager, List[AidantRequest]]:
class ValidationForm(PatchedForm):
cgu = BooleanField(
required=True,
label='J’ai pris connaissance des <a href="{url}">'
label='J’ai pris connaissance des <a href="{url}" class="fr-link">'
"conditions générales d’utilisation</a> et je les valide.",
)
not_free = BooleanField(
required=True,
label="Je confirme avoir compris que la formation est payante "
"et je me suis renseigné(e) sur les modalités de financements disponibles.",
)
dpo = BooleanField(
required=True,
label="Je confirme que le délégué à la protection des données "
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 4.2.15 on 2024-09-11 09:45

from django.db import migrations, models


def migrate_not_free_field(apps, _):
OrganisationRequest = apps.get_model(
"aidants_connect_habilitation", "OrganisationRequest"
)

OrganisationRequest.objects.update(not_free=True)

class Migration(migrations.Migration):

dependencies = [
("aidants_connect_habilitation", "0031_organisationrequest_legal_category"),
]

operations = [
migrations.AddField(
model_name="organisationrequest",
name="not_free",
field=models.BooleanField(default=False, verbose_name="La formation est payante"),
),
migrations.RunPython(migrate_not_free_field, migrations.RunPython.noop),
migrations.AddConstraint(
model_name="organisationrequest",
constraint=models.CheckConstraint(check=models.Q(("status", "NEW"), models.Q(models.Q(("status", "NEW"), _negated=True), ("not_free", True)), _connector="OR"), name="not_free_checked"),
),
]
7 changes: 7 additions & 0 deletions aidants_connect_habilitation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ class OrganisationRequest(models.Model):

# Checkboxes
cgu = models.BooleanField("J'accepte les CGU", default=False)
not_free = models.BooleanField("La formation est payante", default=False)
dpo = models.BooleanField("Le DPO est informé", default=False)
professionals_only = models.BooleanField(
"La structure ne contient que des aidants professionnels", default=False
Expand Down Expand Up @@ -396,6 +397,7 @@ def notify_issuer_request_modified(self):

def prepare_request_for_ac_validation(self, form_data: dict):
self.cgu = form_data["cgu"]
self.not_free = form_data["not_free"]
self.dpo = form_data["dpo"]
self.professionals_only = form_data["professionals_only"]
self.without_elected = form_data["without_elected"]
Expand Down Expand Up @@ -578,6 +580,11 @@ class Meta:
| (~Q(status=RequestStatusConstants.NEW.name) & Q(cgu=True)),
name="cgu_checked",
),
models.CheckConstraint(
check=Q(status=RequestStatusConstants.NEW.name)
| (~Q(status=RequestStatusConstants.NEW.name) & Q(not_free=True)),
name="not_free_checked",
),
models.CheckConstraint(
check=Q(status=RequestStatusConstants.NEW.name)
| (~Q(status=RequestStatusConstants.NEW.name) & Q(dpo=True)),
Expand Down
2 changes: 1 addition & 1 deletion aidants_connect_habilitation/static/css/autocomplete.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions aidants_connect_habilitation/templates/_recap_general_info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<h2>Information générales</h2>
<div class="fr-grid-row fr-grid-row--gutters fr-mb-4v">
<div class="fr-col-12 fr-col-md-4">
<h3 class="fr-h5">Personne effectuant la demande</h3>
</div>
<div class="fr-col-12 fr-col-md-8">
<h3 class="fr-h5">Structure</h3>
</div>
<div class="fr-col-12 fr-col-md-4">
<div class="fr-bordered fr-p-4w flex flex-between flex-column fr-height-100 ">
<div>
<p>
<strong>{{ issuer.get_full_name }}</strong><br/>
<span class="fr-text-mention--grey fr-text--sm">{{ issuer.profession }}</span>
</p>
<p class="fr-text--sm">
{{ issuer.email }}<br>{{ issuer.phone }}
</p>
</div>
{% if show_edit_buttons %}
<div class="fr-mt-3w flex flex-right fr-link">
<a
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-pencil-fill"
href="{% url 'habilitation_modify_issuer' issuer_id=issuer.issuer_id %}"
>
Éditer
</a>
</div>
{% endif %}
</div>
</div>
<div class="fr-col-12 fr-col-md-8">
<div class="fr-bordered fr-p-4w">
<div class="fr-grid-row fr-grid-row--gutters fr-text--sm">
<div class="fr-col-12 fr-col-md-6">
<div class="fr-grid-row">
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">Type de Structure</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text--md"><strong>{{ organisation.type }}</strong></div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">Nom</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text--md"><strong>{{ organisation.name }}</strong></div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">Adresse postale</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w">
{{ organisation.address|linebreaksbr }}<br/>
{{ organisation.zipcode }}
{{ organisation.city }}
</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">SIRET</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w">{{ organisation.siret }}</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">Site web</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w">{{ organisation.web_site}}</div>
</div>
</div>
<div class="fr-col-12 fr-col-md-6">
<div class="fr-grid-row">
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">Structure privée</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w">{{ organisation.is_private_org|yesno:"Oui,Non" }}</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w fr-text-mention--grey">Label France Services</div>
<div class="fr-col-12 fr-col-md-6 fr-mb-2w">{{ organisation.france_services_label|yesno:"Oui,Non" }}</div>
</div>
<div class="fr-text-mention--grey">Missions</div>
<div>{{ organisation.mission_description|linebreaksbr }}</div>
</div>
</div>
<div class="fr-mt-3w flex flex-right fr-link">
<a
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-pencil-fill"
href="{% url 'habilitation_modify_organisation' issuer_id=issuer.issuer_id uuid=organisation.uuid %}"
>
Éditer
</a>
</div>
</div>
</div>
</div>
Loading

0 comments on commit bbad781

Please sign in to comment.