commit 2c6641c85c883e02aec580e8241ca91352f3892b
Author: Serghei MIHAI <smihai@entrouvert.com>
Date:   Tue Jul 29 17:52:47 2014 +0200

    dossiers: print all quotations
    
    font-awesome styles added for icons effects
    
    Closes #5012

diff --git a/calebasse/dossiers/templates/dossiers/quotations.html b/calebasse/dossiers/templates/dossiers/quotations.html
index 893bfdb8..b4dbbbe3 100644
--- a/calebasse/dossiers/templates/dossiers/quotations.html
+++ b/calebasse/dossiers/templates/dossiers/quotations.html
@@ -4,7 +4,7 @@
 {% block appbar %}
 <h2>Dossiers</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 %}
@@ -46,7 +46,7 @@
   </div>
 </div>
 <div class="content">
-  <table id="dossiers" class="main">
+  <table id="dossiers" class="main screen-only">
     <thead>
       <tr>
         <th colspan="2">N° dossier
@@ -72,14 +72,14 @@
         <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:"SHORT_DATE_FORMAT" }}</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:"DATETIME_FORMAT" }}
+          {{ 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:"DATETIME_FORMAT" }}
+          {{ 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>
@@ -90,7 +90,7 @@
   </table>
 
   {% if request.GET %}
-  <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>
diff --git a/calebasse/dossiers/views.py b/calebasse/dossiers/views.py
index c1153add..f929b74f 100644
--- a/calebasse/dossiers/views.py
+++ b/calebasse/dossiers/views.py
@@ -909,16 +909,22 @@ class PatientRecordsQuotationsView(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)
-
-        ctx['patient_records'] = self._get_search_result(paginate_patient_records)
-        ctx['paginate_patient_records'] = paginate_patient_records
+        all = 'all' in self.request.GET
+        if all:
+            patient_records = ctx['object_list']
+            ctx['all'] = all
+            self.template_name = 'dossiers/quotations_print.html'
+        else:
+            paginator = Paginator(ctx['object_list'].filter(), 50)
+            try:
+                patient_records = paginator.page(page)
+            except PageNotAnInteger:
+                patient_records = paginator.page(1)
+            except EmptyPage:
+                patient_records = paginator.page(paginator.num_pages)
+            ctx['paginate_patient_records'] = patient_records
+
+        ctx['patient_records'] = self._get_search_result(patient_records)
 
         query = self.request.GET.copy()
         if 'page' in query:
diff --git a/calebasse/static/css/print.css b/calebasse/static/css/print.css
index e594e296..92877878 100644
--- a/calebasse/static/css/print.css
+++ b/calebasse/static/css/print.css
@@ -89,4 +89,15 @@ div#activity {
 
 div#activity .header {
     display: block;
+}
+
+/* quotations printing */
+
+table.main {
+    border-collapse: collapse;
+}
+
+table.main td, table.main th {
+    border: 1px solid #555;
+    padding: 0 .5em;
 }
\ No newline at end of file
diff --git a/calebasse/static/css/style.css b/calebasse/static/css/style.css
index ad5a1f83..69e6886b 100644
--- a/calebasse/static/css/style.css
+++ b/calebasse/static/css/style.css
@@ -1288,6 +1288,14 @@ div.pagination {
 .icon-uncheck:before {content: "\f096";margin-right: 5px;}
 .icon-car:before {content: "\f1b9";margin-right: 5px;}
 .icon-phone:before { content: "\f095"; margin-right: 3px;}
+.icon-wip:before {
+    content: "\f110";
+    margin-right: 3px;
+    -webkit-animation: spin 2s infinite linear;
+    -moz-animation: spin 2s infinite linear;
+    -o-animation: spin 2s infinite linear;
+    animation: spin 2s infinite linear;
+}
 
 /* periodic event search form */
 
diff --git a/calebasse/static/js/calebasse.dossiers.js b/calebasse/static/js/calebasse.dossiers.js
index 80490738..1388a681 100644
--- a/calebasse/static/js/calebasse.dossiers.js
+++ b/calebasse/static/js/calebasse.dossiers.js
@@ -375,7 +375,21 @@ function load_tab8_medical() {
         window.location.href = window.location.pathname;
         return false;
     });
-    $('#print-button').click(function() { window.print(); });
+    $('#print-button').click(function() {
+        var button = $(this);
+        var title = button.html();
+        button.html('Préparation de l\'impression en cours');
+        button.attr({disabled: 'disabled'});
+        button.toggleClass('icon-wip');
+        $('.pagination').next().remove();
+        $.get(window.location + '&all', function(data) {
+            button.toggleClass('icon-wip');
+            button.removeAttr('disabled');
+            button.html(title);
+            $('.content').append(data);
+            window.print();
+        });
+    });
 
     $('#new-patientrecord').click(function() {
         generic_ajaxform_dialog('new', 'Nouveau dossier',
diff --git a/calebasse/templates/calebasse/base.html b/calebasse/templates/calebasse/base.html
index 826492fa..584ee4b5 100644
--- a/calebasse/templates/calebasse/base.html
+++ b/calebasse/templates/calebasse/base.html
@@ -6,6 +6,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
     <title>{% block title %}{{ service_name }}{% endblock %}</title>
     <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/style.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/font-awesome.min.css" />
     <link rel="stylesheet" type="text/css" media="print" href="{{ STATIC_URL }}css/print.css"/>
     <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/smoothness/jquery-ui-1.8.21.custom.css"/>
     <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/ajax_select.css"/>
