Display previous stages on attribution view
This commit is contained in:
parent
93b84289fe
commit
26452f9068
6 changed files with 35 additions and 4 deletions
BIN
stages/static/img/closed.png
Normal file
BIN
stages/static/img/closed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 263 B |
BIN
stages/static/img/open.png
Normal file
BIN
stages/static/img/open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 211 B |
|
|
@ -128,7 +128,15 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('#student_select').change(function(ev) {
|
||||
$('#student_detail').load('/student/' + $(this).val() + '/summary/').addClass("filled");
|
||||
$('#student_detail').load('/student/' + $(this).val() + '/summary/', function() {
|
||||
$('div#previous_stages_head').toggle(function() {
|
||||
$('ul#previous_stages_list').toggle();
|
||||
$(this).find('img').attr('src', static_url + 'img/open.png');
|
||||
}, function() {
|
||||
$('ul#previous_stages_list').toggle();
|
||||
$(this).find('img').attr('src', static_url + 'img/closed.png');
|
||||
});
|
||||
}).addClass("filled");
|
||||
current_student = $(this).val();
|
||||
if (current_avail !== null) $('input#valid_training').show()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ class StudentSummaryView(DetailView):
|
|||
model = Student
|
||||
template_name = 'student_summary.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(StudentSummaryView, self).get_context_data(**kwargs)
|
||||
context['previous_stages'] = self.object.training_set.all(
|
||||
).select_related('availability__corporation').order_by('availability__period__end_date')
|
||||
return context
|
||||
|
||||
|
||||
class AvailabilitySummaryView(DetailView):
|
||||
model = Availability
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
select#corp_select, select#corp_filter { width: 100%; }
|
||||
|
||||
div#student_detail { float:left; width: 40%; margin: 1em; padding: 0.5em; border: 3px solid red; min-height: 4em; border-radius: 8px; }
|
||||
div#previous_stages { background-color: #EEE; border-radius: 4px; }
|
||||
ul#previous_stages_list { display: none; padding-left: 1.5em;}
|
||||
|
||||
div#corp_detail { float:right; width: 40%; margin: 1em; padding: 0.5em; border: 3px solid red; min-height: 4em; border-radius: 8px; }
|
||||
div#corp_total, div#student_total { font-style: italic; color: gray; }
|
||||
div.filled { border-color: green !important; }
|
||||
|
|
@ -33,6 +36,7 @@
|
|||
{% block extrahead %}
|
||||
<script type="text/javascript" src="{% static "admin/js/jquery.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "js/attribution.js" %}"></script>
|
||||
<script type="text/javascript">var static_url = '{{ STATIC_URL }}';</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
{{ object.first_name }} {{ object.last_name }}<br>
|
||||
{{ object.pcode }} {{ object.city }}<br>
|
||||
Date de naissance: {{ object.birth_date }}
|
||||
<div id="previous_stages">
|
||||
<div id="previous_stages_head">
|
||||
<em><img src="{{ STATIC_URL }}img/closed.png"> Stages précédents ({{ previous_stages|length }}) :</em>
|
||||
</div>
|
||||
<ul id="previous_stages_list">
|
||||
{% for stage in previous_stages %}
|
||||
<li>{{ stage.availability.period.dates }}: {{ stage.availability.corporation }} ({{ stage.availability.corporation.city }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="summary">
|
||||
{{ object.first_name }} {{ object.last_name }}<br>
|
||||
{{ object.pcode }} {{ object.city }}<br>
|
||||
Date de naissance: {{ object.birth_date }}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue