Skip to content

Commit

Permalink
Dépôt de besoin : Détail : cacher les CTA en fonction de l'intérêt en…
Browse files Browse the repository at this point in the history
… co-traitance du prestataire (#1055)

* Add siae_has_detail_cocontracting_click_date. Add tests

* Final changes to make contact & cocontracting work together
  • Loading branch information
raphodn authored Jan 29, 2024
1 parent 0b1b9b8 commit 506dd6a
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="alert alert-success mt-3 mt-lg-0" role="alert">
<p class="mb-0 fs-sm">
Votre intérêt a bien été signalé au client.
<strong>Co-traitance</strong> : votre intérêt a bien été signalé au client.
</p>
</div>
32 changes: 17 additions & 15 deletions lemarche/templates/tenders/_detail_cta_cocontracting.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<div id="detail_cocontracting_container" class="mt-3">
{% if not tender.siae_detail_cocontracting_click_date_count %}
<div class="card c-card rounded-lg shadow-lg">
<div class="card-body">
<h3>Répondre en co-traitance ?</h3>
<p>
Cette demande vous intéresse mais vous ne pouvez pas répondre seul ? Signalez au client que vous souhaiteriez répondre en co-traitance.
</p>
<div class="card c-card rounded-lg shadow-lg">
<div class="card-body">
<h3>Répondre en co-traitance ?</h3>
<p>
Cette demande vous intéresse mais vous ne pouvez pas répondre seul ? Signalez au client que vous souhaiteriez répondre en co-traitance.
</p>
{% if user_can_click %}
{% if user.is_authenticated %}
<button type="button" class="btn btn-primary btn-block" title="Répondre en co-traitance" hx-post="{% url 'tenders:detail-cocontracting-click' tender.slug %}" hx-target="#detail_cocontracting_container">
Répondre en co-traitance
<button type="button" class="btn btn-primary btn-block" title="{{ tender.cta_cocontracting_card_button_text|safe }}" hx-post="{% url 'tenders:detail-cocontracting-click' tender.slug %}" hx-target="#detail_cocontracting_container">
<span>{{ tender.cta_cocontracting_card_button_text|safe }}</span>
</button>
{% elif siae_id %}
<button type="button" class="btn btn-primary btn-block" title="Répondre en co-traitance" hx-post="{% url 'tenders:detail-cocontracting-click' tender.slug %}?siae_id={{siae_id}}" hx-target="#detail_cocontracting_container">
Répondre en co-traitance
<button type="button" class="btn btn-primary btn-block" title="{{ tender.cta_cocontracting_card_button_text|safe }}" hx-post="{% url 'tenders:detail-cocontracting-click' tender.slug %}?siae_id={{siae_id}}" hx-target="#detail_cocontracting_container">
<span>{{ tender.cta_cocontracting_card_button_text|safe }}</span>
</button>
{% endif %}
</div>
{% else %}
<a href="#" id="show-tender-cocontracting-modal-btn" class="btn btn-primary btn-block" data-toggle="modal" data-target="#login_or_signup_siae_tender_modal" data-next-params="{% url 'tenders:detail' tender.slug %}">
<span>{{ tender.cta_cocontracting_card_button_text|safe }}</span>
</a>
{% endif %}
</div>
{% else %}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% endif %}
</div>
</div>
2 changes: 1 addition & 1 deletion lemarche/templates/tenders/_detail_cta_not_interested.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h3>Pas intéressé ?</h3>
Cette demande ne vous intéresse pas ? Dites-le nous !
</p>
{% if user_can_click %}
<button type="button" id="show-tender-contact-modal-btn" class="btn btn-warning btn-block" data-toggle="modal" data-target="#detail_not_interested_click_confirm_modal" data-siae-id="{{ siae_id }}" title="{{ tender.cta_not_interested_card_button_text|safe }}">
<button type="button" id="show-tender-not-interested-modal-btn" class="btn btn-warning btn-block" data-toggle="modal" data-target="#detail_not_interested_click_confirm_modal" data-siae-id="{{ siae_id }}" title="{{ tender.cta_not_interested_card_button_text|safe }}">
{{ tender.cta_not_interested_card_button_text|safe }}
</button>
{% else %}
Expand Down
43 changes: 37 additions & 6 deletions lemarche/templates/tenders/_detail_sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,43 @@
{% elif user.kind == user.KIND_SIAE %}
{% if not user.has_siae %}
{% include "tenders/_detail_siae_user_without_siae.html" %}
{% elif siae_has_detail_contact_click_date %}
{% elif siae_has_detail_contact_click_date or siae_has_detail_cocontracting_click_date %}
{% if siae_has_detail_contact_click_date and not siae_has_detail_cocontracting_click_date %}
{# contact info displayed in _detail_contact.html #}
{% include "tenders/_detail_cta_cocontracting.html" with tender=tender user_can_click=True %}
{% elif not siae_has_detail_contact_click_date and siae_has_detail_cocontracting_click_date %}
{% include "tenders/_detail_cta.html" with tender=tender user_can_click=True %}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% else %}
{# contact info displayed in _detail_contact.html #}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% endif %}
{% elif siae_has_detail_not_interested_click_date %}
{% include "tenders/_detail_not_interested_click_confirm.html" %}
{% else %}
{% 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_cocontracting.html" with tender=tender user_can_click=True %}
{% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=True %}
{% endif %}
{% endif %}
<!-- anonymous user but siae_id in url -->
{% elif siae_id %}
{% if siae_has_detail_contact_click_date %}
{% if siae_has_detail_contact_click_date or siae_has_detail_cocontracting_click_date %}
{% if siae_has_detail_contact_click_date and not siae_has_detail_cocontracting_click_date %}
{# contact info displayed in _detail_contact.html #}
{% include "tenders/_detail_cta_cocontracting.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% elif not siae_has_detail_contact_click_date and siae_has_detail_cocontracting_click_date %}
{% include "tenders/_detail_cta.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% else %}
{# contact info displayed in _detail_contact.html #}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% endif %}
{% elif siae_has_detail_not_interested_click_date %}
{% include "tenders/_detail_not_interested_click_confirm.html" %}
{% else %}
{% 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_cocontracting.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% endif %}
{% endif %}
Expand All @@ -63,19 +83,30 @@
{% if user.is_authenticated or siae_id %}
{% if user.is_authenticated and not user.has_siae %}
{% include "tenders/_detail_siae_user_without_siae.html" %}
{% elif siae_has_detail_contact_click_date %}
{% include "tenders/_detail_contact_click_confirm_tender_response_is_anonymous.html" %}
{% elif siae_has_detail_contact_click_date or siae_has_detail_cocontracting_click_date %}
{% if siae_has_detail_contact_click_date and not siae_has_detail_cocontracting_click_date %}
{% include "tenders/_detail_contact_click_confirm_tender_response_is_anonymous.html" %}
{% include "tenders/_detail_cta_cocontracting.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% elif not siae_has_detail_contact_click_date and siae_has_detail_cocontracting_click_date %}
{% include "tenders/_detail_cta.html" with tender=tender user_can_click=True siae_id=siae_id tender_response_is_anonymous=True %}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% else %}
{% include "tenders/_detail_contact_click_confirm_tender_response_is_anonymous.html" %}
{% include "tenders/_detail_cocontracting_click_confirm.html" %}
{% endif %}
{% elif siae_has_detail_not_interested_click_date %}
{% include "tenders/_detail_not_interested_click_confirm.html" %}
{% else %}
{% include "tenders/_detail_cta.html" with tender=tender user_can_click=True siae_id=siae_id tender_response_is_anonymous=True %}
{% include "tenders/_detail_cta_cocontracting.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=True siae_id=siae_id %}
{% endif %}
{% endif %}
{% endif %}
<!-- anonymous user: action buttons show login modal -->
{% 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_cocontracting.html" with tender=tender user_can_click=False %}
{% include "tenders/_detail_cta_not_interested.html" with tender=tender user_can_click=False %}
{% endif %}
{% endif %}
Expand Down
4 changes: 4 additions & 0 deletions lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ def cta_card_button_text(self):
return "Je suis intéressé !"
return "Accéder aux coordonnées"

@property
def cta_cocontracting_card_button_text(self):
return "Répondre en co-traitance"

@property
def cta_not_interested_card_button_text(self):
return "Je ne suis pas intéressé"
Expand Down
Loading

0 comments on commit 506dd6a

Please sign in to comment.