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..606cf04b2
--- /dev/null
+++ b/lemarche/templates/tenders/_detail_nps_tally_form.html
@@ -0,0 +1,22 @@
+
+
diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html
index dd1838cc8..11600cc51 100644
--- a/lemarche/templates/tenders/detail.html
+++ b/lemarche/templates/tenders/detail.html
@@ -94,27 +94,6 @@
{% endif %}
{% if nps_form_id %}
-
-
+ {% include "tenders/_detail_nps_tally_form.html" %}
{% endif %}
{% endblock %}
diff --git a/lemarche/templates/tenders/survey_transactioned_detail.html b/lemarche/templates/tenders/survey_transactioned_detail.html
index b4d155436..ff9c9483e 100644
--- a/lemarche/templates/tenders/survey_transactioned_detail.html
+++ b/lemarche/templates/tenders/survey_transactioned_detail.html
@@ -98,3 +98,9 @@
{% endblock %}
+
+{% block extra_js %}
+{% if nps_form_id %}
+ {% include "tenders/_detail_nps_tally_form.html" %}
+{% endif %}
+{% endblock %}
diff --git a/lemarche/www/tenders/tests.py b/lemarche/www/tenders/tests.py
index 58354751d..3d4bfef09 100644
--- a/lemarche/www/tenders/tests.py
+++ b/lemarche/www/tenders/tests.py
@@ -1781,7 +1781,7 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_true(self):
url, data={"survey_transactioned_amount": 1000, "survey_transactioned_feedback": "Feedback"}, follow=True
)
self.assertEqual(response.status_code, 200) # redirect
- self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}) + "?nps=true")
+ self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertContains(response, "Merci pour votre réponse")
self.assertTrue(Tender.objects.get(id=self.tender.id).survey_transactioned_answer)
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_amount, 1000)
@@ -1804,7 +1804,7 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_false(self):
# fill in form
response = self.client.post(url, data={"survey_transactioned_feedback": "Feedback"}, follow=True)
self.assertEqual(response.status_code, 200) # redirect
- self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}) + "?nps=true")
+ self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertContains(response, "Merci pour votre réponse")
self.assertFalse(Tender.objects.get(id=self.tender.id).survey_transactioned_answer)
self.assertIsNone(Tender.objects.get(id=self.tender.id).survey_transactioned_amount)
diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py
index 4399eef01..e1f9bfec5 100644
--- a/lemarche/www/tenders/views.py
+++ b/lemarche/www/tenders/views.py
@@ -410,9 +410,6 @@ def get_context_data(self, **kwargs):
)
if show_nps:
context["nps_form_id"] = settings.TALLY_SIAE_NPS_FORM_ID
- elif user.kind == User.KIND_BUYER:
- if show_nps:
- context["nps_form_id"] = settings.TALLY_BUYER_NPS_FORM_ID
elif user.kind == User.KIND_PARTNER:
context["user_partner_can_display_tender_contact_details"] = user.can_display_tender_contact_details
else:
@@ -639,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):
@@ -649,12 +647,10 @@ def get_form_kwargs(self):
def form_valid(self, form):
super().form_valid(form)
messages.add_message(self.request, messages.SUCCESS, self.get_success_message())
- return HttpResponseRedirect(self.get_success_url(survey_was_answered=True))
+ return HttpResponseRedirect(self.get_success_url())
- def get_success_url(self, survey_was_answered=None):
+ def get_success_url(self):
success_url = reverse_lazy("tenders:detail", args=[self.kwargs.get("slug")])
- if survey_was_answered:
- success_url += "?nps=true"
return success_url
def get_success_message(self, already_answered=False):