Skip to content

Commit

Permalink
Improve breadcrumb, add tender context
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Feb 8, 2024
1 parent 078eba7 commit d50ccef
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
10 changes: 9 additions & 1 deletion lemarche/templates/tenders/survey_transactioned_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'tenders:list' %}">Mes besoins</a></li>
<li class="breadcrumb-item"><a href="{% url 'tenders:list' %}">{{ parent_title }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'tenders:detail' tender.slug %}" title="{{ tender.title }}">{{ tender.title|truncatechars:25 }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Avez-vous contractualisé ?</li>
</ol>
Expand Down Expand Up @@ -43,6 +43,14 @@ <h1 class="h1 mb-3 mb-lg-5">
</fieldset>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="alert alert-info mt-3 mt-lg-0" role="alert">
<p class="mb-0">
<i class="ri-information-line ri-lg"></i>
Pour le besoin <strong>{{ tender.title }}</strong>
</p>
</div>
</div>
</div>

{% if tender.survey_transactioned_answer == None or tender.survey_transactioned_answer == True %}
Expand Down
17 changes: 13 additions & 4 deletions lemarche/www/tenders/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def __init__(self, tender_survey_transactioned_answer=None, *args, **kwargs):
self.fields["survey_transactioned_amount"].widget = forms.HiddenInput()


class TenderSiaeSurveyTransactionedForm(TenderSurveyTransactionedForm):
class TenderSiaeSurveyTransactionedForm(forms.ModelForm):
class Meta:
model = TenderSiae
fields = [
Expand All @@ -328,6 +328,15 @@ class Meta:

def __init__(self, tender_survey_transactioned_answer=None, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields[
"survey_transactioned_answer"
].label = "Avez-vous contractualisé avec un acheteur trouvé via le Marché de l'inclusion ?"
self.fields["survey_transactioned_answer"].label = "Avez-vous contractualisé avec le client ?"
self.fields["survey_transactioned_amount"].label = "Quel est le montant de la transaction ? (facultatif)"
self.fields["survey_transactioned_feedback"].label = "Partagez-nous votre retour d'expérience (facultatif)"
self.fields["survey_transactioned_feedback"].widget.attrs.update(
{
"placeholder": "Lors de mon expérience avec le Marché de l'inclusion :\n- j'ai apprécié ...\n- j'ai moins aimé ...\n- vous pourriez vous améliorer dans ..." # noqa
}
)
if tender_survey_transactioned_answer is not None:
self.fields["survey_transactioned_answer"].disabled = True
if tender_survey_transactioned_answer is False:
self.fields["survey_transactioned_amount"].widget = forms.HiddenInput()
5 changes: 4 additions & 1 deletion lemarche/www/tenders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
TenderCreateStepDetailForm,
TenderCreateStepGeneralForm,
TenderCreateStepSurveyForm,
TenderSiaeSurveyTransactionedForm,
TenderSurveyTransactionedForm,
)
from lemarche.www.tenders.tasks import ( # , send_tender_emails_to_siaes
Expand Down Expand Up @@ -625,6 +626,7 @@ def get(self, request, *args, **kwargs):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["tender"] = self.object
context["parent_title"] = TITLE_DETAIL_PAGE_OTHERS
return context

def get_form_kwargs(self):
Expand Down Expand Up @@ -653,7 +655,7 @@ class TenderDetailSiaeSurveyTransactionedView(SesameSiaeMemberRequiredMixin, Upd
"""

template_name = "tenders/survey_transactioned_detail.html" # same template as author survey
form_class = TenderSurveyTransactionedForm
form_class = TenderSiaeSurveyTransactionedForm
queryset = TenderSiae.objects.all()
# success_message (see get_success_message() below)
# success_url (see get_success_url() below)
Expand Down Expand Up @@ -696,6 +698,7 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["tender"] = self.tender
context["siae"] = self.siae
context["parent_title"] = TITLE_DETAIL_PAGE_SIAE
return context

def get_form_kwargs(self):
Expand Down

0 comments on commit d50ccef

Please sign in to comment.