From 66d2b0e63856b60b73d09fe990fcb9fb81409af8 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 22 Jan 2024 12:29:26 +0100 Subject: [PATCH] Try to simplify a bit --- .../templates/tenders/_detail_sidebar.html | 113 ++++++++++-------- 1 file changed, 60 insertions(+), 53 deletions(-) diff --git a/lemarche/templates/tenders/_detail_sidebar.html b/lemarche/templates/tenders/_detail_sidebar.html index dfea062b2..1b2a981ec 100644 --- a/lemarche/templates/tenders/_detail_sidebar.html +++ b/lemarche/templates/tenders/_detail_sidebar.html @@ -1,13 +1,13 @@ -{% comment %} admin info {% endcomment %} + {% if is_admin %} {% include "tenders/_detail_admin_extra_info.html" with tender=tender %} {% endif %} -{% comment %} details author {% endcomment %} + {% if user == tender.author %} {% include "tenders/_detail_side_infos_author.html" %} {% else %} {% if not tender.deadline_date_outdated %} - {% comment %} stats of views {% endcomment %} + {% if tender.siae_email_link_click_date_or_detail_display_date_count > 0 %} {% endif %} - {% if user.is_authenticated and not tender.response_is_anonymous %} - {% comment %} infos for partner {% endcomment %} - {% if user.kind == user.KIND_PARTNER %} - {% if not user_partner_can_display_tender_contact_details %} - + {% if not tender.response_is_anonymous %} + + {% if user.is_authenticated %} + + {% if user.kind == user.KIND_PARTNER %} + {% if not user_partner_can_display_tender_contact_details %} + + {% endif %} + + {% elif user.kind == user.KIND_SIAE %} + {% if not user.has_siae %} + + {% elif not siae_has_detail_contact_click_date %} + {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True %} + {% include "tenders/_detail_cta_cocontracting.html" with tender=tender %} + {% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=True %} + {% endif %} {% endif %} - {% comment %} infos for siaes {% endcomment %} - {% elif user.kind == user.KIND_SIAE %} - {% if not user.has_siae %} - - {% elif not siae_has_detail_contact_click_date %} - {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True %} - {% include "tenders/_detail_cta_cocontracting.html" with tender=tender %} - {% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=True %} + + {% elif siae_id %} + {% if not siae_has_detail_contact_click_date %} + {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True siae_id=siae_id %} + {% include "tenders/_detail_cta_cocontracting.html" with tender=tender siae_id=siae_id %} + {% include "tenders/_detail_cta_not_interested.html" with tender=tender siae_id=siae_id %} + {% else %} + {% include "tenders/_detail_contact.html" with tender=tender %} {% endif %} {% endif %} - {% comment %} if siae_id {% endcomment %} - {% elif siae_id and not tender.response_is_anonymous %} - {% if not siae_has_detail_contact_click_date %} - {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True siae_id=siae_id %} - {% include "tenders/_detail_cta_cocontracting.html" with tender=tender siae_id=siae_id %} - {% include "tenders/_detail_cta_not_interested.html" with tender=tender siae_id=siae_id %} - {% else %} - {% include "tenders/_detail_contact.html" with tender=tender %} - {% endif %} - {% comment %} for anonymous tenders {% endcomment %} - {% elif tender.response_is_anonymous and siae_id or tender.response_is_anonymous and user.is_authenticated %} - {% if not siae_has_detail_contact_click_date %} - {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True tender_is_anonymous=True %} - {% else %} - {% include "tenders/_detail_success_contact.html" %} - {% endif %} + {% else %} + {% if user.is_authenticated or siae_id %} + {% if not siae_has_detail_contact_click_date %} + {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True tender_is_anonymous=True %} + {% else %} + {% include "tenders/_detail_success_contact.html" %} + {% endif %} + {% endif %} + {% endif %} + + {% if not user.is_authenticated and not siae_id %} {% include "tenders/_detail_cta.html" with tender=tender user_can_click=False %} {% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=False %} {% endif %}