Skip to content

Commit

Permalink
feat(Besoins): Mesure du NPS des acheteurs (#1119)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller authored Mar 8, 2024
1 parent 236b75e commit 82e3e14
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
3 changes: 2 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
24 changes: 24 additions & 0 deletions lemarche/templates/tenders/_detail_nps_tally_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% if nps_form_id %}
<script async type="text/javascript" src="https://tally.so/widgets/embed.js"></script>
<script type="text/javascript">
window.TallyConfig = {
"formId": "{{ nps_form_id }}",
"popup": {
"width": 400,
"emoji": {
"text": "👋",
"animation": "wave"
},
"open": {
"trigger": "time",
"ms": 2000
},
// "showOnce": true, // show the popup only once to the same visitor (even if he didn't submit)
"doNotShowAfterSubmit": true, // after the visitor submits the form, don't show the popup again
"autoClose": 0, // automatically hide the popup after the form is submitted. optionally set a delay in seconds.
"hideTitle": true,
"layout": "modal" // display in the center instead of bottom right corner
},
};
</script>
{% endif %}
25 changes: 1 addition & 24 deletions lemarche/templates/tenders/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,5 @@
}
</script>
{% endif %}
{% if TALLY_NPS_FORM_ID and show_nps %}
<script async type="text/javascript" src="https://tally.so/widgets/embed.js"></script>
<script type="text/javascript">
window.TallyConfig = {
"formId": "{{ TALLY_NPS_FORM_ID }}",
"popup": {
"width": 400,
"emoji": {
"text": "👋",
"animation": "wave"
},
"open": {
"trigger": "time",
"ms": 2000
},
// "showOnce": true, // show the popup only once to the same visitor (even if he didn't submit)
"doNotShowAfterSubmit": true, // after the visitor submits the form, don't show the popup again
"autoClose": 0, // automatically hide the popup after the form is submitted. optionally set a delay in seconds.
"hideTitle": true,
"layout": "modal" // display in the center instead of bottom right corner
},
};
</script>
{% endif %}
{% include "tenders/_detail_nps_tally_form.html" %}
{% endblock %}
4 changes: 4 additions & 0 deletions lemarche/templates/tenders/survey_transactioned_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ <h1 class="h1 mb-3 mb-lg-5">
</div>
</section>
{% endblock %}

{% block extra_js %}
{% include "tenders/_detail_nps_tally_form.html" %}
{% endblock %}
1 change: 0 additions & 1 deletion lemarche/utils/settings_context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
3 changes: 2 additions & 1 deletion lemarche/www/tenders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 82e3e14

Please sign in to comment.