Revision 477e1b65
Added by Frédéric Péters over 12 years ago
calebasse/agenda/managers.py | ||
---|---|---|
90 | 90 |
date: may be either a datetime.datetime, datetime.date object, or |
91 | 91 |
``None``. If ``None``, default to the current day. |
92 | 92 |
participants: a list of CalebasseUser |
93 |
services: a list of services |
|
94 |
event_type: a single, or a list of, event types |
|
93 | 95 |
''' |
94 | 96 |
date = date or datetime.now() |
95 | 97 |
start = datetime(date.year, date.month, date.day) |
... | ... | |
114 | 116 |
if services: |
115 | 117 |
qs = qs.filter(event__services__in=services) |
116 | 118 |
if event_type: |
117 |
qs = qs.filter(event__event_type=event_type) |
|
119 |
if type(event_type) is list: |
|
120 |
qs = qs.filter(event__event_type__in=event_type) |
|
121 |
else: |
|
122 |
qs = qs.filter(event__event_type=event_type) |
|
118 | 123 |
return qs |
119 | 124 |
|
120 | 125 |
def daily_disponiblity(self, date, occurrences, participants, time_tables): |
calebasse/agenda/templates/agenda/service-activity.html | ||
---|---|---|
14 | 14 |
|
15 | 15 |
<table class="main" id="activity"> |
16 | 16 |
<thead> |
17 |
<tr> <th>Heure</th> <th>Durée</th> <th>Patient</th> <th>Thérapeute(s)</th> <th>Acte</th> </tr>
|
|
17 |
<tr> <th>Heure</th> <th>Libellé</th> <th>Type acte</th> <th>Thérapeute(s)</th> </tr>
|
|
18 | 18 |
</thead> |
19 | 19 |
<tbody> |
20 | 20 |
{% for row_appointments in appointments_times %} |
... | ... | |
24 | 24 |
{% if forloop.counter != 1 %} |
25 | 25 |
<tr> |
26 | 26 |
{% endif %} |
27 |
<td>{{ appointment.length }}</td>
|
|
28 |
<td>{{ appointment.patient }}</td>
|
|
27 |
<td {% if appointment.type == 2 %}colspan="2"{% endif %}>{{ appointment.label }}</td>
|
|
28 |
{% if appointment.type != 2 %}<td>{{ appointment.act }}</td>{% endif %}
|
|
29 | 29 |
<td>{{ appointment.therapists }}</td> |
30 |
<td>{{ appointment.act }}</td> |
|
31 | 30 |
</tr> |
32 | 31 |
{% endfor %} |
33 | 32 |
</tr> |
calebasse/agenda/views.py | ||
---|---|---|
76 | 76 |
|
77 | 77 |
appointments_times = dict() |
78 | 78 |
appoinment_type = EventType.objects.get(id=1) |
79 |
meeting_type = EventType.objects.get(id=2) |
|
79 | 80 |
occurrences = Occurrence.objects.daily_occurrences(context['date'], |
80 | 81 |
services=[self.service], |
81 |
event_type=appoinment_type)
|
|
82 |
event_type=[appoinment_type, meeting_type])
|
|
82 | 83 |
for occurrence in occurrences: |
83 | 84 |
start_time = occurrence.start_time.strftime("%H:%M") |
84 | 85 |
if not appointments_times.has_key(start_time): |
... | ... | |
90 | 91 |
if length.seconds: |
91 | 92 |
length = length.seconds / 60 |
92 | 93 |
appointment['length'] = "%sm" % length |
93 |
event_act = occurrence.event.eventact |
|
94 |
appointment['patient'] = event_act.patient.display_name |
|
94 |
if occurrence.event.event_type == EventType.objects.get(id=1): |
|
95 |
appointment['type'] = 1 |
|
96 |
event_act = occurrence.event.eventact |
|
97 |
appointment['label'] = event_act.patient.display_name |
|
98 |
appointment['act'] = event_act.act_type.name |
|
99 |
elif occurrence.event.event_type == EventType.objects.get(id=2): |
|
100 |
appointment['type'] = 2 |
|
101 |
appointment['label'] = '%s - %s' % (occurrence.event.event_type.label, |
|
102 |
occurrence.event.title) |
|
103 |
else: |
|
104 |
appointment['type'] = 0 |
|
105 |
appointment['label'] = '???' |
|
95 | 106 |
appointment['therapists'] = "" |
96 | 107 |
for participant in occurrence.event.participants.all(): |
97 | 108 |
appointment['therapists'] += participant.display_name + "; " |
98 | 109 |
if appointment['therapists']: |
99 | 110 |
appointment['therapists'] = appointment['therapists'][:-2] |
100 |
appointment['act'] = event_act.act_type.name |
|
101 | 111 |
appointments_times[start_time]['row'] += 1 |
102 | 112 |
appointments_times[start_time]['appointments'].append(appointment) |
103 | 113 |
context['appointments_times'] = sorted(appointments_times.items()) |
calebasse/static/css/style.css | ||
---|---|---|
981 | 981 |
top: 0px; |
982 | 982 |
} |
983 | 983 |
|
984 |
table#activity td { |
|
985 |
text-align: left; |
|
986 |
padding-left: 1ex; |
|
987 |
} |
|
988 |
|
|
989 |
table#activity td.hour { |
|
990 |
padding: 0; |
|
991 |
text-align: center; |
|
992 |
} |
|
993 |
|
|
984 | 994 |
table#activity tr:nth-child(odd) td { |
985 | 995 |
} |
986 | 996 |
|
Also available in: Unified diff
agenda: fix service activity columns (#2085)