diff --git a/lemarche/templates/tenders/_detail_card.html b/lemarche/templates/tenders/_detail_card.html index 26e0a6464..25fc853a0 100644 --- a/lemarche/templates/tenders/_detail_card.html +++ b/lemarche/templates/tenders/_detail_card.html @@ -40,7 +40,7 @@

{% elif user_partner_can_display_tender_contact_details %}
{% include "tenders/_detail_contact.html" with tender=tender %} - {% elif user_siae_has_detail_contact_click_date and not tender.deadline_date_outdated %} + {% elif siae_has_detail_contact_click_date and not tender.deadline_date_outdated %} {% endif %} {% endif %} diff --git a/lemarche/templates/tenders/_detail_cta.html b/lemarche/templates/tenders/_detail_cta.html index 9891c8a7b..3fa063cba 100644 --- a/lemarche/templates/tenders/_detail_cta.html +++ b/lemarche/templates/tenders/_detail_cta.html @@ -1,13 +1,20 @@

{{ tender.cta_card_title_text|safe }}

- +

{{ tender.cta_card_paragraph_text|safe }}

{% if user_can_click %} - + {% if tender_is_anonymous %} +
+ {% csrf_token %} + +
+ {% else %} + + {% endif %} {% else %} {{ tender.cta_card_button_text|safe }} diff --git a/lemarche/templates/tenders/_detail_side_infos_author.html b/lemarche/templates/tenders/_detail_side_infos_author.html new file mode 100644 index 000000000..d98847e18 --- /dev/null +++ b/lemarche/templates/tenders/_detail_side_infos_author.html @@ -0,0 +1,52 @@ +{% if tender.is_draft %} +
+
+
+ +
+
+

Votre {{ tender_kind_display|default:tender.get_kind_display }} est encore en brouillon. Modifiez-le pour le publier.

+
+
+
+
+ + Modifier + +{% endif %} +{% if tender.is_pending_validation %} +
+
+
+ +
+
+

Votre {{ tender_kind_display|default:tender.get_kind_display }} est en cours de validation.

+
+
+
+{% endif %} +{% if tender.is_validated %} +
+
+
+ +
+
+

Votre {{ tender_kind_display|default:tender.get_kind_display }} est validé et envoyé !

+
+
+
+ + + {{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }} + + + + {{ tender.siae_email_link_click_date_or_detail_display_date_count }} prestataire{{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize }} qui {{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize:'a,ont' }} vu + + + + {{ tender.siae_detail_contact_click_date_count }} prestataire{{ tender.siae_detail_contact_click_date_count|pluralize }} intéressé{{ tender.siae_detail_contact_click_date_count|pluralize }} + +{% endif %} \ No newline at end of file diff --git a/lemarche/templates/tenders/_detail_success_contact.html b/lemarche/templates/tenders/_detail_success_contact.html new file mode 100644 index 000000000..9ab89b439 --- /dev/null +++ b/lemarche/templates/tenders/_detail_success_contact.html @@ -0,0 +1,8 @@ +
+
+

Votre intérêt a été signalé au client

+ +

S’il est intéressé, il vous recontactera via vos coordonnées de contact présentes sur votre fiche commerciale (Vérifier votre fiche).

+ +
+
diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html index c17462c55..be39238f8 100644 --- a/lemarche/templates/tenders/detail.html +++ b/lemarche/templates/tenders/detail.html @@ -28,14 +28,16 @@
{# Afficher les contacts en haut + conseil #} - {% if not tender.deadline_date_outdated %} - {% if user_siae_has_detail_contact_click_date or siae_has_detail_contact_click_date %} + {% if not tender.deadline_date_outdated and not tender.response_is_anonymous %} + {% if siae_has_detail_contact_click_date %}
-
-
- {% include "tenders/_detail_contact.html" with tender=tender source="alert" %} + {% if not tender.response_is_anonymous %} +
+
+ {% include "tenders/_detail_contact.html" with tender=tender source="alert" %} +
-
+ {% endif %}
{# Sidebar with actions #}
+ {% 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 %} - {% if tender.is_draft %} -
-
-
- -
-
-

Votre {{ tender_kind_display|default:tender.get_kind_display }} est encore en brouillon. Modifiez-le pour le publier.

-
-
-
- - - Modifier - - {% endif %} - {% if tender.is_pending_validation %} -
-
-
- -
-
-

Votre {{ tender_kind_display|default:tender.get_kind_display }} est en cours de validation.

-
-
-
- {% endif %} - {% if tender.is_validated %} -
-
-
- -
-
-

Votre {{ tender_kind_display|default:tender.get_kind_display }} est validé et envoyé !

-
-
-
- - - {{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }} - - - - {{ tender.siae_email_link_click_date_or_detail_display_date_count }} prestataire{{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize }} qui {{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize:'a,ont' }} vu - - - - {{ tender.siae_detail_contact_click_date_count }} prestataire{{ tender.siae_detail_contact_click_date_count|pluralize }} intéressé{{ tender.siae_detail_contact_click_date_count|pluralize }} - - {% endif %} + {% 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 %} + {% 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 %} {% endif %} + {% comment %} infos for siaes {% endcomment %} {% elif user.kind == user.KIND_SIAE %} {% if not user.has_siae %} - {% elif not user_siae_has_detail_contact_click_date %} + {% 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 %} {% endif %} {% endif %} - {% elif siae_id %} + {% 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 %} {% 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 %} {% include "tenders/_detail_cta.html" with tender=tender user_can_click=False %} {% endif %} diff --git a/lemarche/tenders/admin.py b/lemarche/tenders/admin.py index 8882e14ed..99197f88e 100644 --- a/lemarche/tenders/admin.py +++ b/lemarche/tenders/admin.py @@ -1,5 +1,6 @@ from ckeditor.widgets import CKEditorWidget from django import forms +from django.conf import settings from django.contrib import admin from django.contrib.contenttypes.admin import GenericTabularInline from django.db import models @@ -488,7 +489,8 @@ def response_change(self, request, obj: Tender): if request.POST.get("_validate_tender"): update_and_send_tender_task(tender=obj) self.message_user(request, "Ce dépôt de besoin a été validé et envoyé aux structures") - api_hubspot.create_deal_from_tender(tender=obj) + if settings.BITOUBI_ENV == "prod": + api_hubspot.create_deal_from_tender(tender=obj) return HttpResponseRedirect(".") elif request.POST.get("_restart_tender"): diff --git a/lemarche/tenders/models.py b/lemarche/tenders/models.py index 184677fef..149d02be5 100644 --- a/lemarche/tenders/models.py +++ b/lemarche/tenders/models.py @@ -545,6 +545,8 @@ def cta_card_paragraph_text(self): return "Accéder à l'appel d'offres afin d'y répondre." elif self.kind == tender_constants.KIND_QUOTE: return "Accéder aux coordonnées du client afin de lui envoyer un devis." + elif self.kind == tender_constants.KIND_PROJECT and self.response_is_anonymous: + return "Manifestez votre intérêt au client. S’il est intéressé, le client vous recontactera via les coordonnées présentes sur votre fiche commerciale." # noqa elif self.kind == tender_constants.KIND_PROJECT: return "Accéder aux coordonnées du client afin de lui présenter vos services et produits." # just in case @@ -554,6 +556,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 diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index d72129349..fa25fc823 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -376,7 +376,7 @@ def get_context_data(self, **kwargs): ).exists() if user.is_authenticated: if user.kind == User.KIND_SIAE: - context["user_siae_has_detail_contact_click_date"] = TenderSiae.objects.filter( + context["siae_has_detail_contact_click_date"] = TenderSiae.objects.filter( tender=self.object, siae__in=user.siaes.all(), detail_contact_click_date__isnull=False ).exists() if show_nps: