blob: b47de2cced00bba26f55c63761492a26b3638848 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
{% extends "ishtar/wizard/default_wizard.html" %}
{% load i18n range table_form %}
{% block wizard_form %}
<form action="." method="post" name='wizard'{% if wizard.form.file_upload %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
<div class='form'>
{{ wizard.form.media }}
{{ wizard.management_form }}
<table>
<tr class='required'>
<th><label for="id_instruction-{{CURRENT_ACTION}}-in_charge">Dossier suivi par</label></th>
</tr>
<tr class='required'>
<td>{{wizard.form.in_charge|safe}}</td>
</tr>
<tr>
<th><label for="id_instruction-{{CURRENT_ACTION}}-related_file">Dossier lié à</label></th>
</tr>
<tr>
<td>{{wizard.form.related_file|safe}}</td>
</tr>
<tr>
<th><label for="id_instruction-{{CURRENT_ACTION}}-comment">Commentaire</label></th>
</tr>
<tr>
<td>{{wizard.form.comment|safe}}</td>
</tr>
<tr class='required'>
<th><label>État du dossier</label></th>
</tr>
<tr>
<td><input type='radio' name='state' value='open' id='state-open'/> <label for='state-open'>Dossier actif</label></td>
</tr>
<tr>
<td><input type='radio' name='state' value='closed' id='state-closed'/> <label for='state-closed'>Dossier clos / date de clôture</label> : {{wizard.form.end_date|safe}}</td>
</tr>
<tr class='required'>
<th><label for="id_instruction-{{CURRENT_ACTION}}-year">{{wizard.form.numeric_reference.label}}</label></th>
</tr>
<tr>
<td>SRA <span class='small'>{{wizard.form.year|safe}}</span> - <span class='small'>{{wizard.form.numeric_reference|safe}}</span></td>
</tr>
</table>
<input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
{{ previous_fields|safe }}
<div id='validation-bar'>
<input type="submit" id="submit_form" name='validate' value="{% trans "Validate" %}"/>
{% if next_steps %}<input type="submit" id="submit_end_form" name='validate_and_end' value="{% trans "Validate and end" %}"/>{% endif %}
</div>
</div>
</form>
<script type='text/javascript'>
$(function(){
if ($('#id_instruction-{{CURRENT_ACTION}}-end_date').val()){
$("#state-closed").prop('checked', true);
} else {
$("#state-open").prop('checked', true);
}
check_state = function(){
var state = $("input[name=state]:checked").val();
if (state == 'closed'){
$('#id_instruction-{{CURRENT_ACTION}}-end_date').focus();
$('#id_instruction-{{CURRENT_ACTION}}-end_date').prop('disabled', false);
} else if (state == 'open'){
$('#id_instruction-{{CURRENT_ACTION}}-end_date').val('');
$('#id_instruction-{{CURRENT_ACTION}}-end_date').prop('disabled', true);
}
};
$('input[name=state]').click(check_state);
check_state();
$('#submit_form').click(function(){
var state = $("input[name=state]:checked").val();
if (state == 'closed'){
if (!$('#id_instruction-{{CURRENT_ACTION}}-end_date').val()){
alert("Vous devez sélectionner une date de clôture.")
return false;
}
return true;
} else if (state == 'open'){
return true;
} else {
alert("Vous devez choisir un état pour ce dossier.")
return false;
}
return true;
});
});
</script>
{% endblock %}
|