diff --git a/lemarche/templates/tenders/survey_transactioned_detail.html b/lemarche/templates/tenders/survey_transactioned_detail.html index 7bb7ebcf0..b4d155436 100644 --- a/lemarche/templates/tenders/survey_transactioned_detail.html +++ b/lemarche/templates/tenders/survey_transactioned_detail.html @@ -12,7 +12,7 @@ @@ -43,6 +43,14 @@

+
+ +
{% if tender.survey_transactioned_answer == None or tender.survey_transactioned_answer == True %} diff --git a/lemarche/www/tenders/forms.py b/lemarche/www/tenders/forms.py index ee2d5787e..076d65c5f 100644 --- a/lemarche/www/tenders/forms.py +++ b/lemarche/www/tenders/forms.py @@ -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 = [ @@ -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() diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index 10486cc15..058765d23 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -32,6 +32,7 @@ TenderCreateStepDetailForm, TenderCreateStepGeneralForm, TenderCreateStepSurveyForm, + TenderSiaeSurveyTransactionedForm, TenderSurveyTransactionedForm, ) from lemarche.www.tenders.tasks import ( # , send_tender_emails_to_siaes @@ -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): @@ -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) @@ -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):