11<!-- Modal -->
2-
2+ {% from 'macro.html' import form_field, submit %}
33< div class ="modal fade show " id ="new_coureur_modal " tabindex ="-2 " aria-labelledby ="new_edition_label "
44 aria-hidden ='true '>
55 < div class ="modal-dialog ">
@@ -11,105 +11,15 @@ <h5 class="modal-title" id="new_edition_label">{{ _('admin.editions.dossard.addn
1111 < div class ="modal-body ">
1212 < form action ="" method ="post " id ="add_new_coureur ">
1313 {{ form.hidden_tag() }}
14- < fieldset class ="form-group ">
15- < div class ="form-group " id ="name ">
16- {{ form.name.label(class="form-control-label") }}
17- {% if form.name.errors %}
18- {{ form.name(class="form-control form-control-lg is-invalid") }}
19- < div class ="invalid-feedback ">
20- {% for error in form.name.errors %}
21- < span > {{ error }}</ span >
22- {% endfor %}
23- </ div >
24- {% else %}
25- {{ form.name(class="form-control form-control-lg") }}
26- {% endif %}
27- </ div >
28- < div class ="form-group " id ="lastname ">
29- {{ form.lastname.label(class="form-control-label") }}
30- {% if form.lastname.errors %}
31- {{ form.lastname(class="form-control form-control-lg is-invalid") }}
32- < div class ="invalid-feedback ">
33- {% for error in form.lastname.errors %}
34- < span > {{ error }}</ span >
35- {% endfor %}
36- </ div >
37- {% else %}
38- {{ form.lastname(class="form-control form-control-lg") }}
39- {% endif %}
40- </ div >
41-
42- < div class ="form-group " id ="username ">
43- {{ form.username.label(class="form-control-label") }}
44- {% if form.username.errors %}
45- {{ form.username(class="form-control form-control-lg is-invalid") }}
46- < div class ="invalid-feedback ">
47- {% for error in form.username.errors %}
48- < span > {{ error }}</ span >
49- {% endfor %}
50- </ div >
51- {% else %}
52- {{ form.username(class="form-control form-control-lg") }}
53- {% endif %}
54- </ div >
55- < div class ="form-group " id ="email ">
56- {{ form.email.label(class="form-control-label") }}
57- {% if form.email.errors %}
58- {{ form.email(class="form-control form-control-lg is-invalid") }}
59- < div class ="invalid-feedback ">
60- {% for error in form.email.errors %}
61- < span > {{ error }}</ span >
62- {% endfor %}
63- </ div >
64- {% else %}
65- {{ form.email(class="form-control form-control-lg") }}
66- {% endif %}
67- </ div >
68- < div class ="form-group " id ="phone ">
69- {{ form.phone.label(class="form-control-label") }}
70- {% if form.phone.errors %}
71- {{ form.phone(class="form-control form-control-lg is-invalid") }}
72- < div class ="invalid-feedback ">
73- {% for error in form.phone.errors %}
74- < span > {{ error }}</ span >
75- {% endfor %}
76- </ div >
77- {% else %}
78- {{ form.phone(class="form-control form-control-lg") }}
79- {% endif %}
80- </ div >
81- < div class ="form-group " id ="datenaiss ">
82- {{ form.datenaiss.label(class="form-control-label") }}
83- {% if form.datenaiss.errors %}
84- {{ form.datenaiss(class="form-control form-control-lg is-invalid") }}
85- < div class ="invalid-feedback ">
86- {% for error in form.datenaiss.errors %}
87- < span > {{ error }}</ span >
88- {% endfor %}
89- </ div >
90- {% else %}
91- {{ form.datenaiss(class="form-control form-control-lg") }}
92- {% endif %}
93- </ div >
94- </ fieldset >
95- < fieldset class ="form-group ">
96- < div class ="form-group " id ="parcours ">
97- {{ form.parcours.label(class="form-control-label") }}
98- {% if form.parcours.errors %}
99- {{ form.parcours(class="form-control form-control-lg is-invalid list-group") }}
100- < div class ="invalid-feedback ">
101- {% for error in form.parcours.errors %}
102- < span > {{ error }}</ span >
103- {% endfor %}
104- </ div >
105- {% else %}
106- {{ form.parcours(class="form-control form-control-lg list-group") }}
107- {% endif %}
108- </ div >
109- </ fieldset >
14+ {{ form_field(form.name) }}
15+ {{ form_field(form.lastname) }}
16+ {{ form_field(form.username) }}
17+ {{ form_field(form.email) }}
18+ {{ form_field(form.phone) }}
19+ {{ form_field(form.datenaiss) }}
20+ {{ form_field(form.parcours) }}
11021 < input type ="text " name ="user_id " class ="d-none ">
11122 </ form >
112-
11323 </ div >
11424 < div class ="modal-footer ">
11525 < button type ="button " class ="btn btn-secondary " data-bs-dismiss ="modal ">
@@ -157,24 +67,6 @@ <h5 class="modal-title" id="new_edition_label">{{
15767 </ div >
15868 </ div >
15969 </ div >
160- {% if validate_form %}
161- < form class ="d-none " id ="validate_form "
162- action ="{{ url_for('admin.editions.dossard.validate_new_user', event_name=event_data.name, edition_name=edition_data.name) }} "
163- method ="post ">
164- {{validate_form.hidden_tag()}}
165- {{ validate_form.user_id }}
166-
167- {{ validate_form.name }}
168- {{ validate_form.lastname }}
169- {{ validate_form.username }}
170- {{ validate_form.email }}
171- {{ validate_form.phone }}
172- {{ validate_form.datenaiss }}
173-
174- {{ validate_form.parcours(id='parcours modal2') }}
175-
176- </ form >
177- {% endif %}
17870 < script >
17971 $ ( '#validation_new_coureur_modal' ) . on ( 'shown.bs.modal' , function ( ) {
18072 $ ( '#new_coureur_modal' ) . addClass ( 'modal-backdrop' ) ;
@@ -185,32 +77,10 @@ <h5 class="modal-title" id="new_edition_label">{{
18577 } ) ;
18678 validate_modal = new bootstrap . Modal ( document . getElementById ( 'validation_new_coureur_modal' ) )
18779 { % if validate_form % }
188- validate_modal . show ( )
80+ validate_modal . show ( )
18981 { % endif % }
190- validate_form = document . getElementById ( 'validate_form' )
19182 form = document . getElementById ( 'add_new_coureur' )
19283 async function validate_user ( id ) {
193- /*validate_form['user_id'].value = id
194- validate_form['name'].value = form['name'].value
195- validate_form['lastname'].value = form['lastname'].value
196- validate_form['username'].value = form['username'].value
197- validate_form['email'].value = form['email'].value
198- validate_form['phone'].value = form['phone'].value
199- validate_form['datenaiss'].value = form['datenaiss'].value
200-
201- let parcours = document.getElementById('parcours modal2')
202- form['parcours'].forEach((checkbox) => {
203- const newInput = document.createElement('input');
204- newInput.type = 'checkbox';
205- newInput.value = checkbox.value;
206- newInput.checked = checkbox.checked;
207-
208- const newLi = document.createElement('li');
209- newLi.appendChild(newInput);
210-
211- parcours.appendChild(newLi);
212- });
213- validate_form.submit()*/
21484 form [ 'user_id' ] . value = id
21585 form . action = '{{ url_for(' admin . editions . dossard . validate_new_user ', event_name=event_data.name, edition_name=edition_data.name) }}'
21686 form . submit ( )
0 commit comments