summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Ates <mates@entrouvert.com>2014-11-20 10:58:32 (GMT)
committerMikaël Ates <mates@entrouvert.com>2014-11-20 10:59:35 (GMT)
commit97fbc1322c59815127df172dfb7c73232aebb681 (patch)
tree362d7ddb5fbf2b4b4b125280b6077b148a38a4ea
parent99a62b84f271b837acd95d5539ea135111f66c4e (diff)
downloadcalebasse-97fbc1322c59815127df172dfb7c73232aebb681.zip
calebasse-97fbc1322c59815127df172dfb7c73232aebb681.tar.gz
calebasse-97fbc1322c59815127df172dfb7c73232aebb681.tar.bz2
dossiers: add state date on quotation page and a bit of refactoring (fixes #5977).
-rw-r--r--calebasse/dossiers/templates/dossiers/quotations.html41
-rw-r--r--calebasse/dossiers/templates/dossiers/quotations_patients_table_content.html38
-rw-r--r--calebasse/dossiers/templates/dossiers/quotations_print.html39
-rw-r--r--calebasse/dossiers/views.py5
4 files changed, 41 insertions, 82 deletions
diff --git a/calebasse/dossiers/templates/dossiers/quotations.html b/calebasse/dossiers/templates/dossiers/quotations.html
index 23554c8..8a18acf 100644
--- a/calebasse/dossiers/templates/dossiers/quotations.html
+++ b/calebasse/dossiers/templates/dossiers/quotations.html
@@ -48,46 +48,7 @@
</div>
<div class="content">
<table id="dossiers" class="main screen-only">
- <thead>
- <tr>
- <th colspan="2">N° dossier
- </th><th rowspan="2">Nom</th>
- <th rowspan="2">Prénom</th>
- <th rowspan="2">Date de naissance</th>
- <th rowspan="2">État du dossier</th>
- <th rowspan="2">Date du prochain rendez-vou</th>
- <th rowspan="2">Date du dernier rendez-vous</th>
- <th rowspan="2">Mises</th>
- <th rowspan="2">ANAP</th>
- </tr>
- <tr>
- <th>papier</th>
- <th>inform.</th>
- </tr>
- </thead>
- <tbody>
-
- {% for patient_record in patient_records %}
- <tr style="display: table-row;" class="pr-line {{ patient_record.state_class }}" data-link="{{ patient_record.object.id }}/view">
- <td>{{ patient_record.object.paper_id|default_if_none:"" }}</td>
- <td>{{ patient_record.object.id }}</td>
- <td><span class="lastname">{{ patient_record.object.last_name }}</span></td>
- <td>{{ patient_record.object.first_name }}</td>
- <td>{{ patient_record.object.birthdate|date:"d-m-Y" }}</td>
- <td class="{{ patient_record.state_class }}">{{ patient_record.state }}</td>
- <td>{% if patient_record.next_rdv_date %}
- {{ patient_record.next_rdv_date|date:"d-m-Y, H:i" }}
- {% endif %}
- </td>
- <td>{% if patient_record.last_rdv_date %}
- {{ patient_record.last_rdv_date|date:"d-m-Y, H:i" }}
- {% endif %}</td>
- <td>{% if patient_record.mises %}<span class="icon-ok"></span>{% endif %}</td>
- <td>{% if patient_record.anap %}<span class="icon-ok"></span>{% endif %}</td>
- </tr>
- {% endfor %}
-
- </tbody>
+ {% include "dossiers/quotations_patients_table_content.html" %}
</table>
{% if request.GET %}
diff --git a/calebasse/dossiers/templates/dossiers/quotations_patients_table_content.html b/calebasse/dossiers/templates/dossiers/quotations_patients_table_content.html
new file mode 100644
index 0000000..88efcf7
--- /dev/null
+++ b/calebasse/dossiers/templates/dossiers/quotations_patients_table_content.html
@@ -0,0 +1,38 @@
+<thead>
+ <tr>
+ <th colspan="2">N° dossier
+ </th><th rowspan="2">Nom</th>
+ <th rowspan="2">Prénom</th>
+ <th rowspan="2">Date de naissance</th>
+ <th rowspan="2">État du dossier</th>
+ <th rowspan="2">Date du prochain rendez-vou</th>
+ <th rowspan="2">Date du dernier rendez-vous</th>
+ <th rowspan="2">Mises</th>
+ <th rowspan="2">ANAP</th>
+ </tr>
+ <tr>
+ <th>papier</th>
+ <th>inform.</th>
+ </tr>
+</thead>
+<tbody>
+ {% for patient_record in patient_records %}
+ <tr style="display: table-row;" class="pr-line {{ patient_record.state.status.type|lower }}" data-link="{{ patient_record.object.id }}/view">
+ <td>{{ patient_record.object.paper_id|default_if_none:"" }}</td>
+ <td>{{ patient_record.object.id }}</td>
+ <td><span class="lastname">{{ patient_record.object.last_name }}</span></td>
+ <td>{{ patient_record.object.first_name }}</td>
+ <td>{{ patient_record.object.birthdate|date:"d-m-Y" }}</td>
+ <td class="{{ patient_record.state.status.type|lower }}">{{ patient_record.state.status.name }} le {{ patient_record.state.date_selected|date:"d-m-Y" }}</td>
+ <td>{% if patient_record.next_rdv_date %}
+ {{ patient_record.next_rdv_date|date:"d-m-Y, H:i" }}
+ {% endif %}
+ </td>
+ <td>{% if patient_record.last_rdv_date %}
+ {{ patient_record.last_rdv_date|date:"d-m-Y, H:i" }}
+ {% endif %}</td>
+ <td>{% if patient_record.mises %}<span class="icon-ok"></span>{% endif %}</td>
+ <td>{% if patient_record.anap %}<span class="icon-ok"></span>{% endif %}</td>
+ </tr>
+ {% endfor %}
+</tbody>
diff --git a/calebasse/dossiers/templates/dossiers/quotations_print.html b/calebasse/dossiers/templates/dossiers/quotations_print.html
index 0c87dbf..0df5ecc 100644
--- a/calebasse/dossiers/templates/dossiers/quotations_print.html
+++ b/calebasse/dossiers/templates/dossiers/quotations_print.html
@@ -1,40 +1,3 @@
<table class="main print-only">
- <thead>
- <tr>
- <th colspan="2">N° dossier
- </th><th rowspan="2">Nom</th>
- <th rowspan="2">Prénom</th>
- <th rowspan="2">Date de naissance</th>
- <th rowspan="2">État du dossier</th>
- <th rowspan="2">Date du prochain rendez-vou</th>
- <th rowspan="2">Date du dernier rendez-vous</th>
- <th rowspan="2">Mises</th>
- <th rowspan="2">ANAP</th>
- </tr>
- <tr>
- <th>papier</th>
- <th>inform.</th>
- </tr>
- </thead>
- <tbody>
- {% for patient_record in patient_records %}
- <tr style="display: table-row;" class="pr-line {{ patient_record.state_class }}">
- <td>{{ patient_record.object.paper_id|default_if_none:"" }}</td>
- <td>{{ patient_record.object.id }}</td>
- <td><span class="lastname">{{ patient_record.object.last_name }}</span></td>
- <td>{{ patient_record.object.first_name }}</td>
- <td>{{ patient_record.object.birthdate|date:"d-m-Y" }}</td>
- <td class="{{ patient_record.state_class }}">{{ patient_record.state }}</td>
- <td>{% if patient_record.next_rdv_date %}
- {{ patient_record.next_rdv_date|date:"d-m-Y, H:i" }}
- {% endif %}
- </td>
- <td>{% if patient_record.last_rdv_date %}
- {{ patient_record.last_rdv_date|date:"d-m-Y, H:i" }}
- {% endif %}</td>
- <td>{% if patient_record.mises %}<span class="icon-ok"></span>{% endif %}</td>
- <td>{% if patient_record.anap %}<span class="icon-ok"></span>{% endif %}</td>
- </tr>
- {% endfor %}
- </tbody>
+ {% include "dossiers/quotations_patients_table_content.html" %}
</table>
diff --git a/calebasse/dossiers/views.py b/calebasse/dossiers/views.py
index 8f792d2..91f0469 100644
--- a/calebasse/dossiers/views.py
+++ b/calebasse/dossiers/views.py
@@ -863,8 +863,6 @@ class PatientRecordsQuotationsView(cbv.ListView):
patient_records = []
for patient_record in paginate_patient_records:
current_state = patient_record.get_current_state() or patient_record.get_state()
- state = current_state.status.name
- state_class = current_state.status.type.lower()
deficiencies = [getattr(patient_record, field) \
for field in self.model.DEFICIENCY_FIELDS]
anap = any(deficiencies)
@@ -883,8 +881,7 @@ class PatientRecordsQuotationsView(cbv.ListView):
patient_records.append(
{
'object': patient_record,
- 'state': state,
- 'state_class': state_class,
+ 'state': current_state,
'anap': anap,
'mises': mises,
'next_rdv_date': next_rdv_datetime,