From 82e3e14324186affa80f89e3c125b3d78493da74 Mon Sep 17 00:00:00 2001 From: SebastienReuiller Date: Fri, 8 Mar 2024 11:43:02 +0100 Subject: [PATCH] feat(Besoins): Mesure du NPS des acheteurs (#1119) --- config/settings/base.py | 3 ++- .../tenders/_detail_nps_tally_form.html | 24 ++++++++++++++++++ lemarche/templates/tenders/detail.html | 25 +------------------ .../tenders/survey_transactioned_detail.html | 4 +++ lemarche/utils/settings_context_processors.py | 1 - lemarche/www/tenders/views.py | 3 ++- 6 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 lemarche/templates/tenders/_detail_nps_tally_form.html diff --git a/config/settings/base.py b/config/settings/base.py index 00aa710da..c605472d1 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -813,7 +813,8 @@ FORM_PARTENAIRES = ( "https://docs.google.com/forms/d/e/1FAIpQLScx1k-UJ-962_rSgPJGabc327gGjFUho6ypgcZHCubuwTl7Lg/viewform" ) -TALLY_NPS_FORM_ID = env.str("TALLY_NPS_FORM_ID", "") +TALLY_BUYER_NPS_FORM_ID = env.str("TALLY_BUYER_NPS_FORM_ID", "") +TALLY_SIAE_NPS_FORM_ID = env.str("TALLY_SIAE_NPS_FORM_ID", "") PARTNER_APPROCH_USER_ID = env.int("PARTNER_APPROCH_USER_ID", 0) diff --git a/lemarche/templates/tenders/_detail_nps_tally_form.html b/lemarche/templates/tenders/_detail_nps_tally_form.html new file mode 100644 index 000000000..1ce2c2d93 --- /dev/null +++ b/lemarche/templates/tenders/_detail_nps_tally_form.html @@ -0,0 +1,24 @@ +{% if nps_form_id %} + + +{% endif %} diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html index 8516c3d3f..62ae35514 100644 --- a/lemarche/templates/tenders/detail.html +++ b/lemarche/templates/tenders/detail.html @@ -93,28 +93,5 @@ } {% endif %} -{% if TALLY_NPS_FORM_ID and show_nps %} - - -{% endif %} +{% include "tenders/_detail_nps_tally_form.html" %} {% endblock %} diff --git a/lemarche/templates/tenders/survey_transactioned_detail.html b/lemarche/templates/tenders/survey_transactioned_detail.html index b4d155436..1719446a8 100644 --- a/lemarche/templates/tenders/survey_transactioned_detail.html +++ b/lemarche/templates/tenders/survey_transactioned_detail.html @@ -98,3 +98,7 @@

{% endblock %} + +{% block extra_js %} + {% include "tenders/_detail_nps_tally_form.html" %} +{% endblock %} diff --git a/lemarche/utils/settings_context_processors.py b/lemarche/utils/settings_context_processors.py index b08872163..05384e499 100644 --- a/lemarche/utils/settings_context_processors.py +++ b/lemarche/utils/settings_context_processors.py @@ -28,6 +28,5 @@ def expose_settings(request): "TYPEFORM_BESOIN_ACHAT_RECHERCHE": settings.TYPEFORM_BESOIN_ACHAT_RECHERCHE, "TYPEFORM_GROUPEMENT_AJOUT": settings.TYPEFORM_GROUPEMENT_AJOUT, "FORM_PARTENAIRES": settings.FORM_PARTENAIRES, - "TALLY_NPS_FORM_ID": settings.TALLY_NPS_FORM_ID, "MTCAPTCHA_PUBLIC_KEY": settings.MTCAPTCHA_PUBLIC_KEY, } diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index f45765aed..e1f9bfec5 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -409,7 +409,7 @@ def get_context_data(self, **kwargs): ).exists() ) if show_nps: - context["show_nps"] = True + context["nps_form_id"] = settings.TALLY_SIAE_NPS_FORM_ID elif user.kind == User.KIND_PARTNER: context["user_partner_can_display_tender_contact_details"] = user.can_display_tender_contact_details else: @@ -636,6 +636,7 @@ def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["tender"] = self.object context["parent_title"] = TITLE_DETAIL_PAGE_OTHERS + context["nps_form_id"] = settings.TALLY_BUYER_NPS_FORM_ID return context def get_form_kwargs(self):