commit fbfab2cc4d5d846129422899421b3bcf6c4371ae
Author: Serghei MIHAI <smihai@entrouvert.com>
Date:   Tue Aug 19 14:33:26 2014 +0200

    agenda: ressource appointment view redesigned to look like worker's
    
    Closes #5284

diff --git a/calebasse/agenda/templates/agenda/ajax-ressource-tab.html b/calebasse/agenda/templates/agenda/ajax-ressource-tab.html
index 19d56ec4..430fcd62 100644
--- a/calebasse/agenda/templates/agenda/ajax-ressource-tab.html
+++ b/calebasse/agenda/templates/agenda/ajax-ressource-tab.html
@@ -10,19 +10,19 @@
     {% if appointment.length %}<span class="length">{{ appointment.length }} min</span> {% endif %}
     {% if appointment.act_type %}<span class="act_type">{{ appointment.act_type }}</span>{% endif %}
     <span class="participants">
-    {% if appointment.len_workers > 4 %}
-    {% if appointment.workers_absent %}<span class="absent" title="Au moins un intervenant est absent">{% endif %}
+      {% if appointment.len_workers > 4 %}
+      {% if appointment.workers_absent %}<span class="absent" title="Au moins un intervenant est absent">{% endif %}
         {{ appointment.len_workers }} inter.
         {% if appointment.workers_absent %}</span>{% endif %}
-    {% else %}
-    {% if appointment.workers %}
-    {% for worker in appointment.workers %}
-    {% if worker in appointment.workers_absent %}<span class="absent" title="Absent">{% endif %}
+      {% else %}
+      {% if appointment.workers %}
+      {% for worker in appointment.workers %}
+      {% if worker in appointment.workers_absent %}<span class="absent" title="Absent">{% endif %}
         {{ worker.worker.initials }}{% if not forloop.last %} {% endif %}
         {% if worker in appointment.workers_absent %}</span>{% endif %}
-    {% endfor %}
-    {% endif %}
-    {% endif %}
+      {% endfor %}
+      {% endif %}
+      {% endif %}
     </span>
 
     <span class="right">
@@ -33,17 +33,16 @@
       {% if appointment.event_id %}
       {% if appointment.is_recurrent %} R {% endif %}
       {% if service in appointment.services_names %}
-        {% if appointment.patient_record_id %}
-           <button title="Éditer un rendez-vous" class="edit-appointment icon-edit" data-event-id="{{ appointment.event_id }}"></button>
-        {% else %}
-           <button title="Éditer un événement" class="edit-event icon-edit" data-event-id="{{ appointment.event_id }}">
+      {% if appointment.patient_record_id %}
+      <button title="Éditer un rendez-vous" class="edit-appointment icon-edit" data-event-id="{{ appointment.event_id }}"></button>
+      {% else %}
+      <button title="Éditer un événement" class="edit-event icon-edit" data-event-id="{{ appointment.event_id }}">
+        {% endif %}
+        <button class="remove-appointment icon-remove-sign" title="Supprimer un rendez-vous" data-url="{% url 'delete-occurrence' date=date service=service pk=appointment.event_id %}" data-rdv="{{ appointment.title }}"></button>
         {% endif %}
-           <button class="remove-appointment icon-remove-sign" title="Supprimer un rendez-vous" data-url="{% url 'delete-occurrence' date=date service=service pk=appointment.event_id %}" data-rdv="{{ appointment.title }}"></button>
         {% endif %}
-     {% endif %}
     </span>
   </h3>
-
   <div>
     {% if appointment.type == 'free' %}
     <button class='newrdv' data-url="{% url 'nouveau-rdv' service=service date=date %}" data-hour="{{ appointment.begin_hour }}" data-duration="{{ appointment.length }}">Nouveau rendez-vous patient</button>
@@ -57,55 +56,71 @@
       {{ worker.first_name }} <span class="lastname">{{ worker.last_name }}</span>{% if forloop.last %}.{% else %}, {% endif %}
       {% endfor %}
     </p>
+    <p class="phones">
+    {% if appointment.patient.mobile %}
+    <span title="{{ appointment.patient.first_name }} {{ appointment.patient.last_name|upper }} (Patient - Perso)" class="icon-user-space">
+    {{ appointment.patient.mobile }}
+    </span>
     {% endif %}
-      {% if service in appointment.services_names %}
-        <div class="tabs-ressource-{{ ressource_agenda.ressource.id }} textedit">
-          <span></span>
-          <textarea>{{ appointment.description }}</textarea>
-          <button disabled="disabled" data-event-id="{{ appointment.event_id }}" data-date="{{ date|date:"Y-m-d" }}">✔</button>
-        </div>
-      {% else %}
-        <p>{{ appointment.description }}</p>
-      {% endif %}
+    {% if appointment.patient.phone %}
+    <span title="{{ appointment.patient.first_name }} {{ appointment.patient.last_name|upper }} (Patient - Pro)" class="icon-user-space">
+    {{ appointment.patient.phone }}
+    </span>
     {% endif %}
-    {% if appointment.patient_record_id %}
-    <p class="phones">
-      {% for address in appointment.patient.addresses.all %}
-      {% if address.place_of_life and address.phone %}
-      <span title="{{ address.number }} {{ address.street }} {{ address.zip_code }} {{ address.city }}" class="icon-home-space">{{ address.phone }}</span>
-      {% for contact in address.patientcontact_set.all  %}
-        {% if contact.mobile %}
-          <span title="{{ contact.first_name }} {{ contact.last_name|upper }}" class="icon-user-space">{{ contact.mobile }}</span>
-        {% endif %}
-      {% endfor %}
+    {% for address in appointment.patient.addresses.all %}
+      {% if address.place_of_life %}
+        {% if address.phone %}<span title="{{ address.display_name }}" class="icon-home-space">{{ address.phone }}</span>{% endif %}
+        {% for contact in address.patientcontact_set.all  %}
+          {% if contact.id != appointment.patient.id %}
+          {% if contact.mobile %}<span title="{{ contact.first_name }} {{ contact.last_name|upper }} (Perso)" class="icon-user-space">{{ contact.mobile }}</span>{% endif %}
+          {% if contact.phone %}<span title="{{ contact.first_name }} {{ contact.last_name|upper }} (Pro)" class="icon-user-space">{{ contact.phone }}</span>{% endif %}
+          {% endif %}
+        {% endfor %}
       {% endif %}
-      {% endfor %}
+    {% endfor %}
     </p>
+    {% endif %}
+    {% endif %}
+
+    {% if appointment.patient_record_id %}
     <a href="/{{ service }}/dossiers/{{ appointment.patient_record_id }}/view" target="_blank">Dossier patient</a> -
     <a href="/{{ service }}/dossiers/{{ appointment.patient_record_id }}/view#tab=5" target="_blank">Prochains rendez-vous</a> -
     <a href="#" class="generate-mail-btn" data-dossier-id="{{ appointment.patient_record_id }}" data-date="{{date|date:"Y-m-d"}}" data-event-id="{{ appointment.event_id }}" data-next-url="{{ request.get_full_path }}">Courrier</a>
     {% endif %}
+
     {% if appointment.validation %}
-    <div><span>{% if appointment.validation.1 %}<strong>{{ appointment.validation.2 }}</strong>, le {{ appointment.validation.1.created }} par {{ appointment.validation.1.author }}
+    <div>
+      <span>{% if appointment.validation.1 %}<strong>{{ appointment.validation.2 }}</strong>, le {{ appointment.validation.1.created }} par {{ appointment.validation.1.author }}
         {% if appointment.validation.1.auto %}(par validation automatique){% endif %}. {% if appointment.validation.0.is_billed %}<strong>Acte facturé</strong>{% endif %}
         {% else %}
         Non pointé.
         {% endif %}
       </span>
-      {% if not appointment.validation.0.validation_locked and appointment.validation.3 %}
-      <form method="post" class="inline-form">
-        {% csrf_token %}
-        <input type="hidden" value="{{appointment.validation.0.id}}" name="acte-id">
-        <select data-previous="{{ last_status.state_name }}" name="act_state">
-          {% for state_name, display_state_name in appointment.validation.3.items %}
-          <option value="{{ state_name }}" {% if state_name == appointment.validation.1.state_name %}selected{% endif %}>{{ display_state_name }}</option>
-          {% endfor %}
-        </select>
-        <button>Pointer</button>
-      </form>
-      {% endif %}
     </div>
     {% endif %}
+
+    {% if not appointment.validation.0.validation_locked and appointment.validation.3 %}
+    <form method="post" class="inline-form">
+      {% csrf_token %}
+      <input type="hidden" value="{{appointment.validation.0.id}}" name="acte-id">
+      <select data-previous="{{ last_status.state_name }}" name="act_state">
+        {% for state_name, display_state_name in appointment.validation.3.items %}
+        <option value="{{ state_name }}" {% if state_name == appointment.validation.1.state_name %}selected{% endif %}>{{ display_state_name }}</option>
+        {% endfor %}
+      </select>
+      <button>Pointer</button>
+    </form>
+    {% endif %}
+
+    {% if service in appointment.services_names %}
+    <div class="tabs-ressource-{{ ressource_agenda.ressource.id }} textedit">
+      <span></span>
+      <textarea>{{ appointment.description }}</textarea>
+      <button disabled="disabled" data-event-id="{{ appointment.event_id }}" data-date="{{ date|date:"Y-m-d" }}">✔</button>
+    </div>
+    {% else %}
+    <p>{{ appointment.description }}</p>
+    {% endif %}
   </div>
   {% endfor %}
 </div>
