Add institution detail view with stats

This commit is contained in:
Claude Paroz 2013-04-08 14:19:23 +02:00
parent f6ff281d4b
commit 4b6a8d50c3
8 changed files with 147 additions and 3 deletions

View file

@ -2,7 +2,13 @@
{% load i18n admin_static %}
{% load url from future %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />{% endblock %}
{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}">
<style>
ul#main { margin: 1em; }
ul#main li { font-size: 14px; }
</style>
{% endblock %}
{% block coltype %}colMS{% endblock %}
@ -13,6 +19,10 @@
{% block content %}
<div id="content-main">
<ul id="main">
<li><b><a href="{% url 'corporations' %}">Liste des institutions</a></b></li>
</ul>
{% if app_list %}
{% for app in app_list %}
<div class="module">

View file

@ -0,0 +1,56 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block extrastyle %}
<style>
h3 {background-color: #eee; padding: 4px;}
tr.totaux td {font-style: italic;}
tr.dispo td {font-style: italic; color: green;}
</style>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'corporations' %}">Liste des institutions</a>
</div>
{% endblock %}
{% block content %}
<div style="float:right;"><a href="{% url 'admin:stages_corporation_change' corp.pk %}"><img src="{{ STATIC_URL }}img/edit.png" title="Modifier"></a></div>
<h2>{{ corp.name }}</h2>
<table width="100%">
<tr><th rowspan="2">Adresse :</th>
<td rowspan="2">{{ corp.street }}<br>
{{ corp.pcode }} {{ corp.city }}<br>
Tél: {{ corp.tel }}<br>
{% if corp.email %}<a href="mailto:{{ corp.email }}">{{ corp.email }}</a><br>{% endif %}
{% if corp.web %}<a href="{{ corp.web }}">{{ corp.web }}</a><br>{% endif %}
</td>
<th>Type de structure :</th>
<td>{{ corp.typ }}</td>
</tr>
<tr>
<th>Contacts :</th>
<td>{% for cont in corp.corpcontact_set.all %}
<a href="{% url 'admin:stages_corpcontact_change' cont.pk %}">{{ cont.first_name }} {{ cont.last_name }}</a> {% if cont.role %} ({{ cont.role }}){% endif %}{% endfor %}
</td>
</tr>
</table>
{% for year, data in years.items %}
<h3>{{ year }}</h3>
<table>
{% for avail in data.avails %}
<tr class="{% if not avail.training %}dispo{% endif %}">
<td>{{ avail.period.dates }}</td>
<td>{% if not avail.training %}Disponibilité{% else %}{{ avail.training.student }} ({{ avail.training.student.klass }}){% endif %}</td>
<td>{{ avail.period.section }}</td></tr>
{% endfor %}
<tr class="totaux"><td colspan="2" align="right" valign="top">Totaux :</td>
<td>{% for fil, num in data.stats.items %}{{ fil }} : {{ num }} semaine(s)<br>{% endfor %}</td>
</tr>
</table>
{% endfor %}
{% endblock %}

View file

@ -0,0 +1,12 @@
{% extends "admin/base_site.html" %}
{% block content %}
<h2>Liste des institutions</h2>
<table>
{% for corp in object_list %}
<tr class="{% cycle 'row1' 'row2' %}">
<td><a href="{% url 'corporation' corp.pk %}">{{ corp.name }}</a></td><td>{{ corp.pcode }} {{ corp.city }}</td></tr>
{% endfor %}
</table>
{% endblock %}