0001-agenda-display-a-summary-of-service-activity.patch
calebasse/agenda/appointments.py | ||
---|---|---|
138 | 138 |
""" |
139 | 139 |
""" |
140 | 140 |
appointments = [] |
141 |
activity = {'absences': []} |
|
141 | 142 | |
142 | 143 |
timetables_set = IntervalSet((t.to_interval(date) for t in time_tables)) |
143 | 144 |
holidays_set = IntervalSet((h.to_interval(date) for h in holidays)) |
... | ... | |
158 | 159 |
validation_states.pop('VALIDE') |
159 | 160 |
validation_states.pop('ACT_LOST') |
160 | 161 |
validation_states = vs + sorted(validation_states.items(), key=lambda tup: tup[0]) |
162 | ||
163 |
events.sort(key=lambda event: event.start_datetime) |
|
164 | ||
165 |
# get first and last events start times |
|
166 |
if events: |
|
167 |
activity['first_appointment'], activity['last_appointment'] = (e.start_datetime.time() for e in (events[0], events[-1])) |
|
168 | ||
161 | 169 |
for event in events: |
162 | 170 |
appointment = Appointment() |
163 | 171 |
appointment.init_from_event(event, service, validation_states) |
... | ... | |
173 | 181 |
label = u"Absence de groupe : %s" % holiday.holiday_type.name |
174 | 182 |
else: |
175 | 183 |
label = u"Absence indiv. : %s" % holiday.holiday_type.name |
184 | ||
176 | 185 |
appointment.init_holiday_time(label, |
177 | 186 |
delta_minutes, |
178 | 187 |
time(interval.lower_bound.hour, interval.lower_bound.minute), |
179 | 188 |
description=holiday.comment) |
189 |
activity['absences'].append(label) |
|
180 | 190 |
services = holiday.services.all() |
181 | 191 |
if service not in services: |
182 | 192 |
appointment.type = 'busy-elsewhere' |
... | ... | |
195 | 205 |
end_time = interval_set.upper_bound() |
196 | 206 |
appointment = Appointment() |
197 | 207 |
appointment.init_start_stop(u"Arrivée", start_time) |
208 |
activity['arrival'] = start_time |
|
198 | 209 |
appointment.weight = -1 |
199 | 210 |
appointments.append(appointment) |
200 | 211 |
appointment = Appointment() |
201 | 212 |
appointment.init_start_stop(u"Départ", end_time) |
213 |
activity['departure'] = end_time |
|
202 | 214 |
appointment.weight = 1 |
203 | 215 |
appointments.append(appointment) |
204 | 216 | |
205 |
return sorted(appointments, key=lambda app: (app.begin_time, app.weight, app.event_id)) |
|
217 |
return activity, sorted(appointments, key=lambda app: (app.begin_time, app.weight, app.event_id))
|
|
206 | 218 | |
207 | 219 |
def get_daily_usage(date, ressource, service, occurrences): |
208 | 220 |
""" |
calebasse/agenda/templates/agenda/agendas-therapeutes.html | ||
---|---|---|
5 | 5 |
{% block appbar %} |
6 | 6 |
<h2>Tous les agendas des intervenants du {{ service_name }} - {{ date|date:"DATE_FORMAT"|title }}</h2> |
7 | 7 |
<a href="..">Retourner à l'agenda</a> |
8 |
<button id='print-button-therapeutes'>Imprimer</button> |
|
9 | 8 |
{% endblock %} |
10 | 9 | |
11 | 10 | |
12 | 11 |
{% block agenda-content %} |
13 |
<button id="uncheck-all" type="button">Tout décocher</button> |
|
14 |
<button id="check-all" type="button" style="display: none">Tout cocher</button> |
|
15 | ||
12 |
<div id="activity" class="screen-only"> |
|
13 |
<span class="actions screen-only"><button id='print-button-therapeutes-activity' class="icon-print screen-only">Imprimer</button></span> |
|
14 |
<br class="clear" /> |
|
15 |
<span class="header"><strong>{{ service_name }}:</strong> {{ date|date:"DATE_FORMAT"|title }}</span> |
|
16 |
<h3>Activité du personnel</h4> |
|
17 |
<table> |
|
18 |
<thead> |
|
19 |
<tr> |
|
20 |
<th>Nom</th><th>Arrivée</th><th>Premier rendez-vous</th> |
|
21 |
<th>Dernier rendez-vous</th><th>Départ</th><th>Absences</th> |
|
22 |
</tr> |
|
23 |
</thead> |
|
24 |
<tbody> |
|
25 |
{% for worker_agenda in workers_agenda %} |
|
26 |
<tr> |
|
27 |
<td>{{ worker_agenda.worker.first_name}} <span class="lastname">{{ worker_agenda.worker.last_name }}</span></td> |
|
28 |
<td>{{ worker_agenda.activity.arrival }}</td><td>{{ worker_agenda.activity.first_appointment }}</td> |
|
29 |
<td>{{ worker_agenda.activity.last_appointment }}</td><td>{{ worker_agenda.activity.departure }}</td> |
|
30 |
<td>{% for absence in worker_agenda.activity.absences %} |
|
31 |
{{ absence }}<br /> |
|
32 |
{% endfor %} |
|
33 |
</td> |
|
34 |
</tr> |
|
35 |
{% endfor %} |
|
36 |
</tbody> |
|
37 |
</table> |
|
38 |
</div> |
|
39 |
<br class="clear" /> |
|
40 |
<span class="actions screen-only"> |
|
41 |
<button id="uncheck-all" type="button" class="icon-uncheck screen-only">Tout décocher</button> |
|
42 |
<button id="check-all" type="button" style="display: none" class="icon-check screen-only">Tout cocher</button> |
|
43 |
<button id='print-button-therapeutes' class="icon-print screen-only">Imprimer</button> |
|
44 |
</span> |
|
16 | 45 |
{% for worker_agenda in workers_agenda %} |
17 | 46 |
{% if worker_agenda.appointments %} |
18 | 47 |
<div class="worker-agenda"> |
... | ... | |
88 | 117 |
update_page_break(); |
89 | 118 | |
90 | 119 |
$('button#print-button-therapeutes').click(function() { |
120 |
$('div#activity').addClass('screen-only'); |
|
91 | 121 |
$.each($(".printable"), function(k, v) { |
92 | 122 |
if ($(v).is(':checked')) { |
93 | 123 |
$(v).parents('.worker-agenda').removeClass('screen-only'); |
... | ... | |
99 | 129 |
window.print(); |
100 | 130 |
}); |
101 | 131 | |
132 |
$('button#print-button-therapeutes-activity').click(function() { |
|
133 |
$('div#activity').removeClass('screen-only'); |
|
134 |
$.each($('.content div:not(#activity)'), function(k, v) { |
|
135 |
$(v).addClass('screen-only'); |
|
136 |
}); |
|
137 |
update_page_break(); |
|
138 |
window.print(); |
|
139 |
}); |
|
140 | ||
102 | 141 |
$('#uncheck-all').on('click', function () { |
103 | 142 |
$('.printable').attr('checked', false); |
104 | 143 |
$('.printable').trigger('change'); |
calebasse/agenda/views.py | ||
---|---|---|
509 | 509 |
events_workers[worker.id] = events_worker |
510 | 510 |
time_tables_workers[worker.id] = time_tables_worker |
511 | 511 |
holidays_workers[worker.id] = holidays_worker |
512 |
daily_appointments = get_daily_appointments(context['date'], worker, self.service, |
|
512 |
activity, daily_appointments = get_daily_appointments(context['date'], worker, self.service,
|
|
513 | 513 |
time_tables_worker, events_worker, holidays_worker) |
514 | 514 |
if all(map(lambda x: x.holiday, daily_appointments)): |
515 | 515 |
continue |
516 | ||
516 | 517 |
context['workers_agenda'].append({'worker': worker, |
517 | 518 |
'appointments': daily_appointments, |
519 |
'activity': activity, |
|
518 | 520 |
'has_events': True if events_worker else False}) |
519 | 521 | |
520 | 522 |
for worker_agenda in context.get('workers_agenda', []): |
... | ... | |
584 | 586 |
'exceptions', 'participants') |
585 | 587 |
events = [ e.today_occurrence(self.date) for e in events ] \ |
586 | 588 |
+ [ e.today_occurrence(self.date) for e in eventswithact ] |
589 |
activity, appointments = get_daily_appointments(context['date'], worker, |
|
590 |
self.service, time_tables_worker, |
|
591 |
events, holidays_worker) |
|
587 | 592 | |
588 | 593 |
context['worker_agenda'] = {'worker': worker, |
589 |
'appointments': get_daily_appointments(context['date'], worker, self.service, |
|
590 |
time_tables_worker, events, holidays_worker)} |
|
594 |
'appointments': appointments} |
|
591 | 595 | |
592 | 596 |
if settings.RTF_TEMPLATES_DIRECTORY: |
593 | 597 |
context['mail'] = True |
calebasse/static/css/agenda.css | ||
---|---|---|
1 |
br.clear { |
|
2 |
clear: both; |
|
3 |
} |
|
4 | ||
1 | 5 |
td#dispos { |
2 | 6 |
vertical-align: top; |
3 | 7 |
} |
... | ... | |
27 | 31 |
display: block; |
28 | 32 |
} |
29 | 33 | |
34 |
.icon-print:before { |
|
35 |
content: "\f02f"; |
|
36 |
margin-right: 5px; |
|
37 |
} |
|
38 | ||
39 |
.icon-check:before { |
|
40 |
content: "\f046"; |
|
41 |
margin-right: 5px; |
|
42 |
} |
|
43 | ||
44 |
.icon-uncheck:before { |
|
45 |
content: "\f096"; |
|
46 |
margin-right: 5px; |
|
47 |
} |
|
48 | ||
30 | 49 |
#users .icon-toggle { |
31 | 50 |
float: right; |
32 | 51 |
display: none; |
... | ... | |
222 | 241 | |
223 | 242 |
button.screen-only { |
224 | 243 |
margin: 1em 0; |
225 |
float: right;
|
|
244 |
/* float: right; */
|
|
226 | 245 |
} |
227 | 246 | |
228 | 247 |
h3 .icon-comment { |
... | ... | |
231 | 250 | |
232 | 251 |
.worker-agenda { |
233 | 252 |
margin-top: 2em; |
253 |
} |
|
254 | ||
255 |
#activity { |
|
256 |
float: right; |
|
257 |
font-size: .8em; |
|
258 |
margin-bottom: 2em; |
|
259 |
} |
|
260 | ||
261 |
#activity h3 { |
|
262 |
background: #eee; |
|
263 |
border: 1px solid #aaa; |
|
264 |
padding: 2px 5px; |
|
265 |
margin:0; |
|
266 |
border-bottom: 0; |
|
267 |
} |
|
268 | ||
269 |
#activity table { |
|
270 |
border-collapse: collapse; |
|
271 |
} |
|
272 | ||
273 |
#activity .header { |
|
274 |
display: none; |
|
275 |
} |
|
276 | ||
277 |
#activity table td, #activity table th { |
|
278 |
border: 1px solid #bbb; |
|
279 |
padding: 2px 5px; |
|
280 |
} |
|
281 | ||
282 |
#activity #print-button-therapeutes-activity { |
|
283 |
float: right; |
|
234 | 284 |
} |
calebasse/static/css/print.css | ||
---|---|---|
43 | 43 |
font-size: 70%; |
44 | 44 |
} |
45 | 45 | |
46 |
table#activity{ |
|
46 |
table#activity, div#activity {
|
|
47 | 47 |
font-size: 80%; |
48 | 48 |
} |
49 | 49 | |
... | ... | |
82 | 82 |
position: fixed; |
83 | 83 |
top: 0; |
84 | 84 |
} |
85 | ||
86 |
div#activity { |
|
87 |
float: left; |
|
88 |
} |
|
89 | ||
90 |
div#activity .header { |
|
91 |
display: block; |
|
92 |
} |
|
85 |
- |