From cd223b97edf7131a34d855d29718b3ff6d66067a Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Mon, 9 Sep 2024 11:36:49 +0200 Subject: [PATCH] Update registration form : https://trackers.pilotsystems.net/prebarreau/0842 --- teleforma/forms.py | 15 ++++++++------- teleforma/locale/fr/LC_MESSAGES/django.po | 2 +- .../templates/registration/registration_form.html | 6 +++++- .../templates/registration/registration_pdf.html | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/teleforma/forms.py b/teleforma/forms.py index c5bf15f3..a5840ca7 100644 --- a/teleforma/forms.py +++ b/teleforma/forms.py @@ -84,6 +84,12 @@ class UserForm(ModelForm): training = ModelChoiceField(label='Formation', queryset=Training.objects.filter(available=True)) + + fascicule = forms.ChoiceField(choices=TRUE_FALSE_CHOICES, + label='Envoi postal des fascicules de cours', + required=False, + widget=forms.Select()) + procedure = ModelChoiceField(label=_('Procedure'), help_text="Matière de procédure", queryset=Course.objects.filter(procedure=True)) @@ -101,11 +107,6 @@ class UserForm(ModelForm): choices=payment_schedule_choices, required=True) - fascicule = forms.ChoiceField(choices=TRUE_FALSE_CHOICES, - label='Envoi postal des fascicules', - required=False, - widget=forms.Select()) - # no model captcha = ReCaptchaField() accept = BooleanField() @@ -123,8 +124,8 @@ class UserForm(ModelForm): self.fields['email'].required = True self.user_fields = ['first_name', 'last_name', 'email', 'address', 'address_detail', 'postal_code', 'city', 'country', 'telephone', 'birthday', 'portrait'] - self.training_fields = ['level', 'iej', 'period', 'platform_only', 'fascicule', - 'training', 'procedure', 'written_speciality', 'oral_1'] + self.training_fields = ['level', 'iej', 'period', 'platform_only', + 'training', 'fascicule', 'procedure', 'written_speciality', 'oral_1'] def clean_portrait(self): image = self.cleaned_data['portrait'] diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index df53a527..ee1f0b27 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -2172,7 +2172,7 @@ msgid "Training type" msgstr "Type de formation" #: teleforma/templates/registration/registration_pdf.html:85 -msgid "Envoi postal des fascicules" +msgid "Envoi postal des fascicules de cours" msgstr "" #: teleforma/templates/registration/registration_pdf.html:89 diff --git a/teleforma/templates/registration/registration_form.html b/teleforma/templates/registration/registration_form.html index 0d31286f..3fb46dc8 100644 --- a/teleforma/templates/registration/registration_form.html +++ b/teleforma/templates/registration/registration_form.html @@ -159,7 +159,10 @@ function updateFascicule() { var platformOnly = $("[name='platform_only']").val() === 'True' ? true : false; - if (platformOnly) + var training = $("[name='training'] option:selected").text(); + var showFasc = training.indexOf("Séminaires de correction") === -1 && training.indexOf("----") === -1; + + if (platformOnly && showFasc) $("[name='fascicule']").parent().show(); else $("[name='fascicule']").parent().hide(); @@ -171,6 +174,7 @@ $("#id_period, #id_platform_only").change(updateTrainings); updateFascicule(); $("[name='platform_only']").change(updateFascicule); + $("[name='training']").change(updateFascicule); });