Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Améliorer le badge de clôture du DDB #1095

Merged
merged 6 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lemarche/templates/tenders/_card_list_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<time class="fs-sm d-block" aria-label="Date de clôture">
<span>{{ tender.deadline_date|default:"" }}</span>
{% if tender.deadline_date_is_outdated_annotated %}
<span class="badge badge-xs badge-base badge-pill badge-pilotage float-right">Clôturé</span>
<span class="badge badge-xs badge-base badge-pill badge-{{ tender.kind|lower }} float-right">Clôturé</span>
{% endif %}
{% if tender.is_draft %}
<span class="badge badge-xs badge-base badge-pill badge-outline-warning float-right">
Expand Down
4 changes: 4 additions & 0 deletions lemarche/templates/tenders/_closed_badge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<span class="badge badge-xs badge-base badge-pill badge-{{ tender.kind|lower }}">
{{ tender_kind_display|default:tender.get_kind_display }} clôturé{% if tender.kind == "QUOTE" %}e{% endif %}
le {{ tender.deadline_date|default:"" }}
</span>
8 changes: 2 additions & 6 deletions lemarche/templates/tenders/_detail_card.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
{% load bootstrap4 static humanize array_choices_display %}

<div class="card c-card c-card--marche siae-card rounded-lg shadow-lg">
<div class="card-header text-right bg-marche text-white fs-sm rounded-top rounded-lg p-3 mb-0">
Date limite de réponse : {{ tender.deadline_date|default:"" }}
{% if not source_form and tender.deadline_date_outdated %}
<span class="badge badge-xs badge-base badge-pill badge-pilotage">Clôturé</span>
{% endif %}
<div class="card-header fs-sm rounded-top rounded-lg px-5">
{% include "tenders/_closed_badge.html" with tender=tender %}
</div>
<div class="card-body pb-5 px-5">
<!-- title & header -->
<div class="row py-4">
<div class="col-md-12">
<h1>
{{ tender.title }}
<span class="fs-sm badge badge-base badge-pill badge-{{ tender.kind|lower }} float-right" aria-hidden="true">{{ tender_kind_display|default:tender.get_kind_display }}</span>
</h1>
</div>
</div>
Expand Down
5 changes: 1 addition & 4 deletions lemarche/templates/tenders/_list_item_buyer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
<div class="row">
<div class="col-md-8" style="border-right:1px solid;">
<p class="mb-1">
Date de clôture : {{ tender.deadline_date|default:"" }}
{% if tender.deadline_date_is_outdated_annotated %}
<span class="badge badge-sm badge-base badge-pill badge-pilotage">Clôturé</span>
{% endif %}
{% include "tenders/_closed_badge.html" with tender=tender %}
madjid-asa marked this conversation as resolved.
Show resolved Hide resolved
{% if tender.is_draft %}
<span class="badge badge-sm badge-base badge-pill badge-outline-warning float-right">
<i class="ri-draft-fill"></i>Brouillon
Expand Down
12 changes: 1 addition & 11 deletions lemarche/templates/tenders/_list_item_network.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
<div class="row">
<div class="col-md-12">
<p class="mb-1">
Date de clôture : {{ tender.deadline_date|default:"" }}
{% if tender.deadline_date_is_outdated_annotated %}
<span class="badge badge-sm badge-base badge-pill badge-pilotage">Clôturé</span>
{% endif %}
<span class="float-right badge badge-base badge-pill badge-emploi">
{% if tender.kind == "PROJ" %}
{{ title_kind_sourcing_siae|default:tender.get_kind_display }}
{% else %}
{{ tender.get_kind_display }}
{% endif %}
</span>
{% include "tenders/_closed_badge.html" with tender=tender %}
</p>
</div>
</div>
Expand Down
18 changes: 0 additions & 18 deletions lemarche/www/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,17 +806,6 @@ def test_tender_amount_display(self):
self.assertContains(response, "Montant du marché")
self.assertContains(response, tender_constants.ACCEPT_SHARE_AMOUNT_FALSE)

def test_tender_deadline_date_display(self):
# tender is not outdated by default
url = reverse("tenders:detail", kwargs={"slug": self.tender_1.slug})
response = self.client.get(url)
self.assertNotContains(response, "Clôturé")
# new tender with outdated deadline_date
tender_2 = TenderFactory(deadline_date=timezone.now() - timedelta(days=1))
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, "Clôturé")

def test_tender_author_has_additional_stats(self):
self.client.force_login(self.user_buyer_1)
url = reverse("tenders:detail", kwargs={"slug": self.tender_1.slug})
Expand Down Expand Up @@ -849,7 +838,6 @@ def test_tender_contact_display(self):
# anonymous user
url = reverse("tenders:detail", kwargs={"slug": self.tender_1.slug})
response = self.client.get(url)
self.assertNotContains(response, "Clôturé")
self.assertContains(response, "Cet appel d'offres vous intéresse ?")
self.assertContains(response, "Répondre en co-traitance ?")
self.assertContains(response, "Cette demande ne vous intéresse pas ?")
Expand Down Expand Up @@ -908,7 +896,6 @@ def test_tender_response_is_anonymous_contact_display(self):
# anonymous user
url = reverse("tenders:detail", kwargs={"slug": self.tender_3_response_is_anonymous.slug})
response = self.client.get(url)
self.assertNotContains(response, "Clôturé")
self.assertContains(response, "Cet appel d'offres vous intéresse ?")
self.assertContains(response, "Répondre en co-traitance ?")
self.assertContains(response, "Cette demande ne vous intéresse pas ?")
Expand Down Expand Up @@ -970,33 +957,28 @@ def test_tender_outdated_contact_display(self):
# anonymous user
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, "Clôturé")
self.assertNotContains(response, "Répondre à cette opportunité")
# siae user interested
self.client.force_login(self.siae_user_1)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, "Clôturé")
self.assertNotContains(response, "Contactez le client dès maintenant")
self.assertNotContains(response, "Répondre à cette opportunité")
# siae user not concerned
self.client.force_login(self.siae_user_6)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, "Clôturé")
self.assertNotContains(response, "Répondre à cette opportunité")
# siae user without siae
self.client.force_login(self.siae_user_without_siae)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, "Clôturé")
self.assertNotContains(response, "veuillez d'abord vous")
self.assertNotContains(response, "Répondre à cette opportunité")
# author
self.client.force_login(self.user_buyer_1)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, "Clôturé")
self.assertContains(response, "Coordonnées")
self.assertNotContains(response, "Contactez le client dès maintenant")
self.assertNotContains(response, "Répondre à cette opportunité")
Expand Down
Loading