]> git.parisson.com Git - teleforma.git/commitdiff
Update registration form : https://trackers.pilotsystems.net/prebarreau/0842
authorYoan Le Clanche <yoanl@pilotsystems.net>
Mon, 9 Sep 2024 09:36:49 +0000 (11:36 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Mon, 9 Sep 2024 09:36:49 +0000 (11:36 +0200)
teleforma/forms.py
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/templates/registration/registration_form.html
teleforma/templates/registration/registration_pdf.html

index c5bf15f31ad4223644eeeac20a2ffa1b13fdf76a..a5840ca7d4b8e7424309c038743b07fb11602033 100644 (file)
@@ -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']
index df53a5271f1dccecde066affb170d1168b0ac5b7..ee1f0b27a18e0405e452be3d6b79f7e258783bdb 100644 (file)
@@ -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
index 0d31286ffda78d9f6bb39fe1fe15bb5a79ddc92d..3fb46dc8eb145fd54337fe79fc034f553985139e 100644 (file)
 
     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();
         $("#id_period,  #id_platform_only").change(updateTrainings);
         updateFascicule();
         $("[name='platform_only']").change(updateFascicule);
+        $("[name='training']").change(updateFascicule);
     });
 </script>
 <style>
index 324070b124d59c994b234dfbf1420a0ad3fc8a6b..41361491f89136b92b4db86a3a01f4a74b7a9252 100644 (file)
@@ -82,7 +82,7 @@
                     <td>{% if student.platform_only %}E-learning seulement{% else %}Présentielle{% endif %}</td>
                 </tr>
                 <tr>
-                    <td class="bold">{% trans "Envoi postal des fascicules" %} : </td>
+                    <td class="bold">{% trans "Envoi postal des fascicules de cours" %} : </td>
                     <td>{% if student.fascicule %}Oui{% else %}Non{% endif %}</td>
                 </tr>
                 <tr>