Skip to content

Commit

Permalink
adapt impact calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Jul 30, 2024
1 parent 7282318 commit 48ab991
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 75 deletions.
2 changes: 1 addition & 1 deletion lemarche/templates/dashboard/_api_key_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ <h3 class="fr-card__title">
}
});
</script>
{% endblock %}
{% endblock extra_js %}
147 changes: 74 additions & 73 deletions lemarche/templates/pages/impact-calculator.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
{% extends BASE_TEMPLATE %}
{% load bootstrap4 static humanize wagtailcore_tags advert_cms %}
{% load dsfr_tags process_dict static humanize wagtailcore_tags advert_cms %}

{% block title %}Calibrer votre achat socialement responsable{{ block.super }}{% endblock %}
{% block title %}Calibrer votre achat socialement responsable{{ block.super }}{% endblock title %}
{% block meta_description %}
<meta name="description" content="Identifier rapidement le nombre total de prestataires inclusifs pouvant répondre à votre besoin et mesurer leur capacité globale de production.">
{% endblock %}
{% endblock meta_description %}

{% block breadcrumbs %}
<section>
<div class="fr-container">
<div class="fr-grid-row">
<div class="fr-col-12">
<nav class="c-breadcrumb c-breadcrumb--marche" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ HOME_PAGE_PATH }}">Accueil</a></li>
<li class="breadcrumb-item active" aria-current="page">Calibrer votre achat socialement responsable</li>
</ol>
</nav>
</div>
</div>
</div>
</section>
{% endblock %}
{% block breadcrumb %}
{% process_dict root_dir=HOME_PAGE_PATH current="Calibrer votre achat socialement responsable" as breadcrumb_data %}
{% dsfr_breadcrumb breadcrumb_data %}
{% endblock breadcrumb %}

{% block content %}
<section class="has-illustration-bg-01">
<section>
<div class="fr-container">
<div class="fr-grid-row align-items-center">
<div class="fr-grid-row">
<div class="fr-col-12 fr-col-lg-10">
<h1 class="h1-hero">
<strong>Calibrer votre achat socialement responsable</strong>
<h1>
Calibrer votre achat socialement responsable
</h1>
<h2 class="mb-0">
<h2>
Identifier rapidement le nombre total de prestataires inclusifs pouvant répondre à votre besoin,
et mesurer leur capacité globale de production.
</h2>
Expand All @@ -40,77 +28,90 @@ <h2 class="mb-0">
</div>
</section>

<section class="">
<section>
<div class="fr-container">
{% block htmx %}
<div class="fr-grid-row" id="calculatorImpact">
<div class="fr-grid-row fr-grid-row--gutters" id="calculatorImpact">
<div class="fr-col-12 fr-col-lg-7">
<div class="c-form mb-5 mb-lg-0">
<form hx-get="{{ request.path }}" hx-push-url="true" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' hx-target="#calculatorImpact" hx-swap="outerHTML">
{% bootstrap_form_errors form type="all" %}
<fieldset>
{% bootstrap_field form.sectors form_group_class="form-group use-multiselect" %}
<div class="form-group form-group-required {% if form.perimeters.errors %}is-invalid{% endif %}">
<label for="id_perimeters">{{ form.perimeters.label }}</label>
<form hx-get="{{ request.path }}" hx-push-url="true" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' hx-target="#calculatorImpact" hx-swap="outerHTML">
{% if form.non_field_errors %}
<section class="fr-my-4v fr-input-group fr-input-group--error">
{{ form.non_field_errors }}
</section>
{% endif %}
<fieldset class="fr-fieldset">
<div class="fr-fieldset__element">
{% dsfr_form_field form.sectors %}
</div>
<div class="fr-fieldset__element">
<div class="fr-input-group{% if form.perimeters.errors %} fr-input-group--error{% endif %}">
<label for="id_perimeters" class="fr-label fr-mb-2v">{{ form.perimeters.label }}</label>
<div id="dir_form_perimeters" data-input-name="{{ form.perimeters.name }}"></div>
<small class="form-text text-muted">{{ form.perimeters.help_text }}</small>
<div class="invalid-feedback">Ce champ est obligatoire.</div>
<div id="perimeters-selected" class="mt-2"></div>
<div id="perimeters-selected" class="fr-mt-2v"></div>
{{ current_perimeters|json_script:"current-perimeters" }}
</div>
{% bootstrap_field form.presta_type form_group_class="form-group use-multiselect" %}
</fieldset>
<hr class="mb-3">
<div class="fr-grid-row">
<div class="fr-col-12">
<div class="form-row align-items-center justify-content-end">
{% if results %}
<div class="form-group fr-col-12 fr-col-lg-auto">
<button hx-get="{{ request.path }}" hx-target="#calculatorImpact" hx-swap="outerHTML" class="btn btn-block btn-ico btn-outline-primary">
<i class="ri-close-fill ri-lg"></i>
<span>Annuler</span>
</button>
</div>
{% endif %}
<div class="form-group fr-col-12 fr-col-lg-auto">
<button type="submit" id="calibrate-calculator-submit-btn" class="btn btn-ico btn-block btn-primary">
<i class="ri-search-line ri-lg"></i>
<span>Lancer la recherche</span>
</button>
</div>
{% if form.perimeters.errors %}
<div id="id_perimeters-description-desc-error">
<ul class="errorlist">
<li class="fr-error-text">
Ce champ est obligatoire.
</li>
</ul>
</div>
{% endif %}
</div>
</div>
</form>
</div>
<div class="fr-fieldset__element">
{% dsfr_form_field form.presta_type %}
</div>
</fieldset>

<div class="fr-grid-row fr-mt-8v">
<div class="fr-col-12">
<ul class="fr-btns-group fr-btns-group--inline fr-btns-group--right fr-btns-group--icon-right">
{% if results %}
<li>
<button hx-get="{{ request.path }}" hx-target="#calculatorImpact" hx-swap="outerHTML" class="fr-btn fr-btn--secondary fr-icon-close-circle-line">
<span>Annuler</span>
</button>
</li>
{% endif %}
<li>
<button type="submit" id="calibrate-calculator-submit-btn" class="fr-btn fr-icon-search-line">
<span>Lancer la recherche</span>
</button>
</li>
</ul>
</div>
</div>
</form>
</div>
{% if results %}
<div class="fr-col-12 fr-col-lg-5">
<h3>Résultats</h3>
<p>
Il y a <b>{{ results.count }}</b> prestataires inclusifs positionnés sur les secteurs d'activités <i>{{current_sectors_pretty|join:", "}}</i>
Il y a <b>{{ results.count }}</b> prestataires inclusifs positionnés sur les secteurs d'activités <i>{{ current_sectors_pretty|join:", " }}</i>
pouvant intervenir sur <i>{{ current_perimeters_pretty|join:", " }}</i>.
</p>
{% if results.count > 0 %}
<p>
Ces <b>{{ results.count }}</b> prestataires inclusifs représentent plus de <b>{{ results_aggregated.ca_declared__sum|intcomma }}</b> € de chiffres d'affaires cumulé
et plus de <b>{{ results_aggregated.employees_insertion__sum|intcomma }}</b> salariés en insertion.
</p>
<div class="d-block d-lg-inline-block">
<a href="{% url 'siae:search_results' %}?{{ current_search_query }}#searchResults" id="calibrate-calculator-siae-list-btn" class="btn btn-block btn-outline-primary btn-ico" target="_blank">
<span>Découvrir ces prestataires</span>
<i class="ri-arrow-right-s-line ri-lg"></i>
<p>
<a href="{% url 'siae:search_results' %}?{{ current_search_query }}#searchResults" id="calibrate-calculator-siae-list-btn" class="fr-btn fr-btn--secondary" target="_blank">
Découvrir ces prestataires
</a>
</div>
</p>
{% endif %}
<div class="fs-xs mt-3 mt-lg-5">
<p class="mb-0">Ces données sont issues de plusieurs sources :</p>
<ul>
<li>les informations déclarées par les prestataires inclusifs eux-mêmes</li>
<li><a href="https://pilotage.inclusion.beta.gouv.fr/" target="_blank" rel="noopener noreferrer">la plateforme Le Pilotage de l'inclusion</a></li>
<li><a href="https://api.gouv.fr/" target="_blank" rel="noopener noreferrer">api.gouv.fr</a></li>
</ul>
</div>
<p class="fr-mb-0 fr-text--xs">
Ces données sont issues de plusieurs sources :
</p>
<ul class="fr-text--xs">
<li>les informations déclarées par les prestataires inclusifs eux-mêmes</li>
<li><a href="https://pilotage.inclusion.beta.gouv.fr/" target="_blank" rel="noopener noreferrer">la plateforme Le Pilotage de l'inclusion</a></li>
<li><a href="https://api.gouv.fr/" target="_blank" rel="noopener noreferrer">api.gouv.fr</a></li>
</ul>
</div>
{% endif %}
</div>
Expand All @@ -120,7 +121,7 @@ <h3>Résultats</h3>

{% cms_advert %}

{% endblock %}
{% endblock content %}

{% block extra_js %}
<script type="text/javascript" src="{% static 'js/perimeter_autocomplete_field.js' %}"></script>
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/pages/social-impact-for-buyers.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{% block content %}
<section>
<div class="fr-container">
<div class="fr-grid-row align-items-center">
<div class="fr-grid-row">
<div class="fr-col-12 fr-col-lg-10">
<h1>
Calculer l'impact social d'un achat inclusif
Expand Down

0 comments on commit 48ab991

Please sign in to comment.