From dfe96a73287e4965f484c94ba7beacb62a3d2874 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 4 Mar 2024 16:18:06 +0100 Subject: [PATCH 1/4] Conditional hide modals --- lemarche/templates/tenders/detail.html | 12 +++++++++--- lemarche/www/tenders/views.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html index be1fba027..fae70683c 100644 --- a/lemarche/templates/tenders/detail.html +++ b/lemarche/templates/tenders/detail.html @@ -66,9 +66,15 @@ {% endblock %} {% block modals %} -{% include "auth/_login_or_signup_siae_tender_modal.html" %} -{% include "tenders/_detail_contact_click_confirm_modal.html" %} -{% include "tenders/_detail_not_interested_click_confirm_modal.html" %} +{% if not siae_has_detail_contact_click_date %} + {% include "auth/_login_or_signup_siae_tender_modal.html" %} +{% endif %} +{% if not siae_has_detail_cocontracting_click_date %} + {% include "tenders/_detail_contact_click_confirm_modal.html" %} +{% endif %} +{% if not siae_has_detail_not_interested_click_date %} + {% include "tenders/_detail_not_interested_click_confirm_modal.html" %} +{% endif %} {% endblock %} {% block extra_js %} diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index 555c72ed6..f45765aed 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -511,7 +511,7 @@ class TenderDetailNotInterestedClickView(SiaeUserRequiredOrSiaeIdParamMixin, Det Endpoint to handle 'not interested' button click """ - template_name = "tenders/_detail_not_interested_click_confirm.html" + template_name = "tenders/_detail_not_interested_click_confirm_modal.html" model = Tender def get_object(self): From 1632cced236c5d36dfb23b555e2c077a524c4d9d Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 4 Mar 2024 16:18:49 +0100 Subject: [PATCH 2/4] New variable TENDER_NOT_INTERESTED_URL --- lemarche/www/tenders/tasks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lemarche/www/tenders/tasks.py b/lemarche/www/tenders/tasks.py index c693c8bdd..38dc11890 100644 --- a/lemarche/www/tenders/tasks.py +++ b/lemarche/www/tenders/tasks.py @@ -190,6 +190,7 @@ def send_tender_email_to_siae(tender: Tender, siae: Siae, email_subject: str, em "TENDER_AMOUNT": tender.amount_display, "TENDER_DEADLINE_DATE": date_to_string(tender.deadline_date), "TENDER_URL": f"{get_object_share_url(tender)}?siae_id={siae.id}", + "TENDER_NOT_INTERESTED_URL": f"{get_object_share_url(tender)}?siae_id={siae.id}¬_interested=True", } api_mailjet.send_transactional_email_with_template( From f8a78fc1720c5078c8cae4036592f15472eff1ff Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 4 Mar 2024 17:30:57 +0100 Subject: [PATCH 3/4] Show not interested modal if not_interested=True in the url --- lemarche/templates/tenders/detail.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html index fae70683c..0ba8d33af 100644 --- a/lemarche/templates/tenders/detail.html +++ b/lemarche/templates/tenders/detail.html @@ -78,6 +78,19 @@ {% endblock %} {% block extra_js %} +{% if not siae_has_detail_not_interested_click_date %} + +{% endif %} {% if TALLY_NPS_FORM_ID and show_nps %}