Skip to content

Commit

Permalink
manage anonymous consultations
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Nov 2, 2023
1 parent a73704a commit 0231167
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
15 changes: 11 additions & 4 deletions lemarche/templates/tenders/_detail_cta.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<div class="card c-card rounded-lg shadow-lg">
<div class="card-body">
<h3>{{ tender.cta_card_title_text|safe }}</h3>

<p>{{ tender.cta_card_paragraph_text|safe }}</p>

{% if user_can_click %}
<button type="button" id="show-tender-contact-modal-btn" class="btn btn-primary btn-block" data-toggle="modal" data-target="#detail_contact_click_confirm_modal" data-siae-id="{{ siae_id }}" title="{{ tender.cta_card_button_text|safe }}">
{{ tender.cta_card_button_text|safe }}
</button>
{% if tender_is_anonymous %}
<form method="POST" action="{% url 'tenders:detail-contact-click-stat' tender.slug %}?siae_id={{ siae_id }}">
{% csrf_token %}
<button type="submit" class="btn btn-primary btn-block" name="detail_contact_click_confirm" value="true">{{ tender.cta_card_button_text|safe }}</button>
</form>
{% else %}
<button type="button" id="show-tender-contact-modal-btn" class="btn btn-primary btn-block" data-toggle="modal" data-target="#detail_contact_click_confirm_modal" data-siae-id="{{ siae_id }}" title="{{ tender.cta_card_button_text|safe }}">
{{ tender.cta_card_button_text|safe }}
</button>
{% endif %}
{% else %}
<a href="#" id="show-tender-contact-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_card_button_text|safe }}</span>
Expand Down
8 changes: 8 additions & 0 deletions lemarche/templates/tenders/_detail_success_contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="card c-card rounded-lg shadow-lg">
<div class="card-body">
<h3>Votre intérêt a été signalé au client</h3>

<p>S’il est intéressé, il vous recontactera via vos coordonnées de contact présentes sur votre fiche commerciale (<a href="{% url 'dashboard:home' %}">Vérifier votre fiche</a>).</p>

</div>
</div>
18 changes: 11 additions & 7 deletions lemarche/templates/tenders/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
{% if not tender.deadline_date_outdated and not tender.response_is_anonymous %}
{% if user_siae_has_detail_contact_click_date or siae_has_detail_contact_click_date %}
<div class="row">
<div class="col-12 col-lg-8">
<div class="alert alert-info fade show" role="status">
{% include "tenders/_detail_contact.html" with tender=tender source="alert" %}
{% if not tender.response_is_anonymous %}
<div class="col-12 col-lg-8">
<div class="alert alert-info fade show" role="status">
{% include "tenders/_detail_contact.html" with tender=tender source="alert" %}
</div>
</div>
</div>
{% endif %}
<div class="col-12 col-lg-4">
<div class="alert alert-info mt-3 mt-lg-0" role="alert">
<p class="mb-1">
Expand Down Expand Up @@ -121,9 +123,11 @@
{% include "tenders/_detail_contact.html" with tender=tender %}
{% endif %}
{% comment %} for anonymous tenders {% endcomment %}
{% elif tender.response_is_anonymous and (siae_id or user.is_authenticated) %}
{% if not siae_has_detail_contact_click_date %}
{% include "tenders/_detail_cta.html" with tender=tender user_can_click=False %}
{% 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 and not user_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 %}
{% include "tenders/_detail_cta.html" with tender=tender user_can_click=False %}
Expand Down
2 changes: 2 additions & 0 deletions lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ def cta_card_paragraph_text(self):
def cta_card_button_text(self):
if self.kind == tender_constants.KIND_TENDER:
return "Voir l'appel d'offres"
elif self.kind == tender_constants.KIND_PROJECT and self.response_is_anonymous:
return "Je suis intéressé !"
return "Accéder aux coordonnées"

@cached_property
Expand Down

0 comments on commit 0231167

Please sign in to comment.