|
189 | 189 | <span class="fas fa-copy"></span>
|
190 | 190 | </a>
|
191 | 191 | {% if not evaluation.has_exam %}
|
192 |
| - <confirmation-modal type="submit" id="exam_creation_modal" name="evaluation_id" value="{{ evaluation.id }}" confirm-button-class="btn-primary" form="exam_creation_form_{{ evaluation.id }}"> |
| 192 | + <confirmation-modal type="submit" name="evaluation_id" value="{{ evaluation.id }}" confirm-button-class="btn-primary" form="exam_creation_form"> |
193 | 193 | <span slot="title">{% translate 'Create exam evaluation' %}</span>
|
194 | 194 | <span slot="action-text" id="submit_button">{% translate 'Create exam evaluation' %}</span>
|
195 | 195 | <span slot="question">
|
|
198 | 198 | {% endblocktranslate %}
|
199 | 199 | </span>
|
200 | 200 | <div slot="extra-inputs">
|
201 |
| - <label for="exam_date">{% translate 'Exam Date:' %}</label> |
202 |
| - <input type="date" id="exam_date" name="exam_date" data-must-before="{{ evaluation.vote_start_datetime }}" class="form-control" required form="exam_creation_form_{{ evaluation.id }}"/> |
| 201 | + <label> |
| 202 | + {% translate 'Exam Date:' %} |
| 203 | + <input type="date" name="exam_date" evaluationDate="{{ evaluation.vote_start_datetime }}" class="form-control" required form="exam_creation_form"/> |
| 204 | + </label> |
203 | 205 | </div>
|
204 | 206 |
|
205 | 207 | <button slot="show-button" type="button" class="btn btn-sm btn-light" title="{% translate 'Create exam evaluation' %}" data-bs-placement="top" data-bs-toggle="tooltip"><span class="fas fa-file-pen fa-fw"></span></button>
|
206 | 208 |
|
207 | 209 | <script type="text/javascript">
|
208 | 210 | document.getElementById('submit_button').addEventListener('click', function(event) {
|
209 | 211 | var inputDate = new Date(document.getElementById('exam_date').value);
|
210 |
| - var evaluationDate = new Date(document.getElementById('exam_date').dataset.mustBefore); |
| 212 | + var evaluationDate = new Date(document.getElementById('exam_date').dataset.evaluationDate); |
211 | 213 |
|
212 | 214 | if (inputDate <= evaluationDate) {
|
213 | 215 | document.getElementById('exam_date').setCustomValidity("{% translate 'The exam date is before the start date of the main evaluation.' %}");
|
|
217 | 219 | });
|
218 | 220 | </script>
|
219 | 221 |
|
220 |
| - <!-- <script type="text/javascript"> |
221 |
| - var examModal = document.currentScript.closest("confirmation-modal"); |
222 |
| -
|
223 |
| - examModal.querySelectorAll("[data-evaluation-date]").forEach(element => { |
224 |
| - element.addEventListener("click", () => { |
225 |
| - var inputDate = new Date(element.value); |
226 |
| - var evaluationDate = new Date(element.dataset.evaluationDate); |
227 |
| - if (inputDate <= evaluationDate) { |
228 |
| - element.setCustomValidity("{% translate 'The exam date is before the start date of the main evaluation.' %}"); |
229 |
| - } else { |
230 |
| - element.setCustomValidity(""); |
231 |
| - } |
232 |
| -
|
233 |
| - element.reportValidity(); |
234 |
| - }); |
235 |
| - element.dispatchEvent(new Event("change")); |
236 |
| - }); |
237 |
| - </script> --> |
238 |
| - |
239 | 222 | </confirmation-modal>
|
240 | 223 | {% endif %}
|
241 | 224 | {% endif %}
|
|
0 commit comments