dossiers: manage printing for the waiting queue and shorter paginated pages.

* Waiting queue page is similar to the quotation page. Since commit
      2c6641c8 printing is done differently. So it has been adapted to
      the waiting queue page.

    * Pages quotations and waiting queue paginated for 25 lines instead of
      50 (mainly done for a faster page display).
This commit is contained in:
Mikaël Ates 2014-12-17 12:47:00 +01:00
parent 37cdace1c1
commit affeff8742
4 changed files with 56 additions and 45 deletions

View File

@ -4,7 +4,7 @@
{% block appbar %}
<h2>Dossiers sur liste d'attente{% if len_patient_records %} : {{ len_patient_records }}{% endif %}</h2>
<a href=".">Retourner aux dossiers</a>
<button id='print-button'>Imprimer</button>
<button id='print-button' class='icon-print'>Imprimer</button>
{% endblock %}
{% block content %}
@ -30,43 +30,11 @@
</div>
</div>
<div class="content">
<table id="dossiers" class="main">
<thead>
<tr>
<th colspan="2">N° dossier
</th><th rowspan="2">Nom</th>
<th rowspan="2">Prénom</th>
<th rowspan="2">Position</th>
<th rowspan="2">Date d'accueil</th>
<th rowspan="2">Prochain rendez-vous</th>
<th rowspan="2">Intervenant(s)</th>
<th rowspan="2">Commentaire</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.position }}</td>
<td>{{ patient_record.object.last_state.date_selected|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ patient_record.object.get_next_rdv.start_datetime|date:"d/m/Y H:i" }} {{ patient_record.object.get_next_rdv.act_type }}</td>
<td>{% for participant in patient_record.object.get_next_rdv.participants.all %}{{ participant.last_name }} {% endfor %}</td>
<td>{{ patient_record.object.last_state.comment|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
<table id="dossiers" class="main screen-only">
{% include "dossiers/waiting_queue_table_content.html" %}
</table>
<div class="pagination">
<div class="pagination screen-only">
<span class="step-links">
{% if paginate_patient_records.has_previous %}
<a href="?{{ query }}&page={{ paginate_patient_records.previous_page_number }}">««</a>

View File

@ -0,0 +1,3 @@
<table class="main print-only">
{% include "dossiers/waiting_queue_table_content.html" %}
</table>

View File

@ -0,0 +1,33 @@
<thead>
<tr>
<th colspan="2">N° dossier
</th><th rowspan="2">Nom</th>
<th rowspan="2">Prénom</th>
<th rowspan="2">Position</th>
<th rowspan="2">Date d'accueil</th>
<th rowspan="2">Prochain rendez-vous</th>
<th rowspan="2">Intervenant(s)</th>
<th rowspan="2">Commentaire</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.position }}</td>
<td>{{ patient_record.object.last_state.date_selected|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ patient_record.object.get_next_rdv.start_datetime|date:"d/m/Y H:i" }} {{ patient_record.object.get_next_rdv.act_type }}</td>
<td>{% for participant in patient_record.object.get_next_rdv.participants.all %}{{ participant.last_name }} {% endfor %}</td>
<td>{{ patient_record.object.last_state.comment|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>

View File

@ -933,7 +933,7 @@ class PatientRecordsQuotationsView(cbv.ListView):
ctx['all'] = all
self.template_name = 'dossiers/quotations_print.html'
else:
paginator = Paginator(ctx['object_list'].filter(), 50)
paginator = Paginator(ctx['object_list'].filter(), 25)
try:
patient_records = paginator.page(page)
except PageNotAnInteger:
@ -1038,13 +1038,21 @@ class PatientRecordsWaitingQueueView(cbv.ListView):
service=self.service)
patient_records = []
page = self.request.GET.get('page')
paginator = Paginator(ctx['object_list'].filter(), 50)
try:
paginate_patient_records = paginator.page(page)
except PageNotAnInteger:
paginate_patient_records = paginator.page(1)
except EmptyPage:
paginate_patient_records = paginator.page(paginator.num_pages)
all = 'all' in self.request.GET
if all:
paginate_patient_records = ctx['object_list']
ctx['all'] = all
self.template_name = 'dossiers/waiting_queue_print.html'
else:
paginator = Paginator(ctx['object_list'].filter(), 25)
try:
paginate_patient_records = paginator.page(page)
except PageNotAnInteger:
paginate_patient_records = paginator.page(1)
except EmptyPage:
paginate_patient_records = paginator.page(paginator.num_pages)
ctx['paginate_patient_records'] = paginate_patient_records
all_patient_records = PatientRecord.objects.filter(
service=self.service,
@ -1052,7 +1060,6 @@ class PatientRecordsWaitingQueueView(cbv.ListView):
'last_state__date_selected', 'created')
ctx['patient_records'] = self._get_search_result(
paginate_patient_records, all_patient_records)
ctx['paginate_patient_records'] = paginate_patient_records
ctx['len_patient_records'] = all_patient_records.count()
query = self.request.GET.copy()