From 53973c303fd04e8730e664e2afb677adadca2fd9 Mon Sep 17 00:00:00 2001 From: Serghei MIHAI Date: Mon, 15 Sep 2014 17:13:53 +0200 Subject: [PATCH 2/2] agenda: arrivals and departures design improvings Closes #5466 --- calebasse/agenda/appointments.py | 18 +++++++++------ .../agenda/templates/agenda/ajax-worker-tab.html | 26 ++++++++++++++++++++-- calebasse/static/css/agenda.css | 12 ++++++++++ 3 files changed, 47 insertions(+), 9 deletions(-) diff --git a/calebasse/agenda/appointments.py b/calebasse/agenda/appointments.py index b9f9195..fe4e355 100644 --- a/calebasse/agenda/appointments.py +++ b/calebasse/agenda/appointments.py @@ -38,6 +38,7 @@ class Appointment(object): self.holiday = False self.services_names = [] self.event = False + self.timetable_type = None self.__set_time(begin_time) def __set_time(self, time): @@ -125,13 +126,14 @@ class Appointment(object): self.init_busy_time(title, length, begin_time, description) self.holiday = True - def init_start_stop(self, title, time, type): + def init_start_stop(self, title, time, type, kind): """ title: Arrivee ou Depart """ - self.type = type + self.type = kind self.title = title self.__set_time(time) + self.timetable_type = type def get_daily_appointments(date, worker, service, time_tables, events, holidays): """ @@ -191,7 +193,6 @@ def get_daily_appointments(date, worker, service, time_tables, events, holidays) appointment.type = 'busy-elsewhere' appointment.other_services_names = [s.slug for s in services if s != service] appointments.append(appointment) - print "time tables: %s" % time_tables for time_table in time_tables: interval_set = IntervalSet.between(time_table.to_interval(date).lower_bound.time(), time_table.to_interval(date).upper_bound.time()) @@ -207,18 +208,21 @@ def get_daily_appointments(date, worker, service, time_tables, events, holidays) services = time_table.services.all() common_service = service in services services = [s.slug for s in services if s != service] + appointment_kind = 'timetable ' if common_service: - appointment_type = 'info' + appointment_kind += 'info' else: - appointment_type = 'busy-elsewhere' + appointment_kind += 'busy-elsewhere' appointment = Appointment() appointment.other_services_names = services - appointment.init_start_stop(u"Arrivée", start_time, appointment_type) + appointment.init_start_stop(u"Arrivée", start_time, 'arrival', + appointment_kind) activity['arrival'] = start_time appointment.weight = 1 appointments.append(appointment) appointment = Appointment() - appointment.init_start_stop(u"Départ", end_time, appointment_type) + appointment.init_start_stop(u"Départ", end_time, 'departure', + appointment_kind) appointment.other_services_names = services activity['departure'] = end_time appointment.weight = -1 diff --git a/calebasse/agenda/templates/agenda/ajax-worker-tab.html b/calebasse/agenda/templates/agenda/ajax-worker-tab.html index ffa25d6..45aa988 100644 --- a/calebasse/agenda/templates/agenda/ajax-worker-tab.html +++ b/calebasse/agenda/templates/agenda/ajax-worker-tab.html @@ -7,8 +7,26 @@ {% if appointment.act_absence %}title="{{appointment.act_absence}}"{% endif %}> {{ appointment.begin_hour }} {% if appointment.length %}{% if appointment.length|str_length_lt:3 %} {% endif %}{{ appointment.length }} min{% endif %} - {% if appointment.title %}{{ appointment.title }}{% endif %} - {% if appointment.patient.paper_id %} {{ appointment.patient.paper_id }} {% endif %} + + {% if appointment.title %} + {{ appointment.title }} + {% if appointment.timetable_type and appointment.other_services_names %} + {% if appointment.timetable_type == 'arrival' %} + dans le{{appointment.other_services_names|pluralize}} + {% else %} + d{{appointment.other_services_names|pluralize:'u,es'}} + {% endif %} + service{{ appointment.other_services_names|pluralize }} + {% for service_name in appointment.other_services_names %} + {{ service_name }}{% if not forloop.last %},{% endif %} + {% endfor %} + {% endif %} + + {% endif %} + {% if appointment.patient.paper_id %} + {{ appointment.patient.paper_id }} + {% endif %} + {% if appointment.len_workers > 4 %} {% if appointment.workers_absent %}{% endif %} @@ -38,9 +56,13 @@ {% if appointment.workers_absent %} {% endif %} + {% if appointment.timetable_type %} + + {% else %} {% for service_name in appointment.other_services_names %} {% endfor %} + {% endif %} {% if appointment.event_id %} {% if appointment.is_recurrent %} R {% endif %} diff --git a/calebasse/static/css/agenda.css b/calebasse/static/css/agenda.css index d2921d4..c73457c 100644 --- a/calebasse/static/css/agenda.css +++ b/calebasse/static/css/agenda.css @@ -266,4 +266,16 @@ h3 .icon-comment { .frame.acte:target, div.changed { box-shadow: 2px 2px .5em 5px #db9595; +} + +h3.timetable { + font-size: .8em !important; +} + +.icon-arrival:before { + content: "\f090"; +} + +.icon-departure:before { + content: "\f08b"; } \ No newline at end of file -- 2.1.0