diff --git a/calebasse/agenda/appointments.py b/calebasse/agenda/appointments.py index b64ea5e..713cbb4 100644 --- a/calebasse/agenda/appointments.py +++ b/calebasse/agenda/appointments.py @@ -6,6 +6,7 @@ from datetime import time as datetime_time from interval import Interval, IntervalSet from calebasse.actes.validation_states import VALIDATION_STATES +from .models import EventWithAct class Appointment(object): @@ -36,6 +37,7 @@ class Appointment(object): self.validation = None self.holiday = False self.services_names = [] + self.event = False self.__set_time(begin_time) def __set_time(self, time): @@ -47,6 +49,7 @@ class Appointment(object): def init_from_event(self, event, service, validation_states=None): delta = event.end_datetime - event.start_datetime + self.event = isinstance(event, EventWithAct) self.event_id = event.id self.length = delta.seconds / 60 self.title = event.title diff --git a/calebasse/agenda/templates/agenda/agendas-therapeutes.html b/calebasse/agenda/templates/agenda/agendas-therapeutes.html index 6d61a1f..c49d5ab 100644 --- a/calebasse/agenda/templates/agenda/agendas-therapeutes.html +++ b/calebasse/agenda/templates/agenda/agendas-therapeutes.html @@ -34,6 +34,17 @@ {% for appointment in worker_agenda.appointments %} {{ appointment.begin_hour }} + {% if not CURRENT_SERVICE_EVENTS_ONLY and not appointment.holiday and appointment.type != 'info' and appointment.other_services_names %} + + {% if appointment.event %}Evenement{% else %}Rendez-vous{% endif %} + {% with services=appointment.other_services_names|length %} + dans le{{ services|pluralize }} service{{ services|pluralize }} + {% endwith %} + {% for service in appointment.other_services_names %} + {{ service|upper }}{% if not forloop.last %}, {% endif %} + {% endfor %} + + {% else %} {% if appointment.length %}{{ appointment.length }}min{% endif %} {% if appointment.patient_record_id %} @@ -58,6 +69,7 @@ {% endfor %} {% endif %} + {% endif %} {% endfor %} diff --git a/calebasse/agenda/views.py b/calebasse/agenda/views.py index 0d261d7..05f8fe7 100644 --- a/calebasse/agenda/views.py +++ b/calebasse/agenda/views.py @@ -489,6 +489,9 @@ class AgendasTherapeutesView(AgendaHomepageView): 'patient__service', 'act_set__actvalidationstate_set', 'exceptions', 'participants') + + context['CURRENT_SERVICE_EVENTS_ONLY'] = settings.CURRENT_SERVICE_EVENTS_ONLY + events = [ e.today_occurrence(self.date) for e in events ] \ + [ e.today_occurrence(self.date) for e in eventswithact ] for e in events: diff --git a/calebasse/settings.py b/calebasse/settings.py index 1ee7a4f..b524325 100644 --- a/calebasse/settings.py +++ b/calebasse/settings.py @@ -291,6 +291,9 @@ RTF_REPOSITORY_DIRECTORY = None # Invoicing file saving directory INVOICING_DIRECTORY = None +# display events only for current service +CURRENT_SERVICE_EVENTS_ONLY = True + #CSV_ENCODING = 'cp1252' #For windows : windows-1252/Winlatin1 #CSVPROFILE = {\ # 'delimiter' : ';',