diff --git a/app_new/planning/schedules.py b/app_new/planning/schedules.py index 7e2a487..445754a 100644 --- a/app_new/planning/schedules.py +++ b/app_new/planning/schedules.py @@ -162,6 +162,12 @@ def index(): entry = time_entries.get(d) actual_minutes = entry.actual_minutes if entry else 0 fmt = lambda minutes: f"{minutes // 60}h{minutes % 60:02d}" + deviation_hours = None + deviation_class = None + if entry and entry.entry_type == 'retard' and actual_minutes: + deviation_hours, deviation_class = f"-{fmt(actual_minutes)}", 'text-danger' + elif entry and entry.entry_type == 'supplementaire' and actual_minutes: + deviation_hours, deviation_class = f"+{fmt(actual_minutes)}", 'text-success' week.append({ 'day': day, @@ -175,6 +181,8 @@ def index(): 'leave_type': 'congé' if leave else None, 'worked_hours': fmt(actual_minutes), 'planned_hours': fmt(planned_minutes), + 'deviation_hours': deviation_hours, + 'deviation_class': deviation_class, 'events': events_by_date.get(d, []), }) diff --git a/app_new/templates/planning/calendar.html b/app_new/templates/planning/calendar.html index 6308f74..61279c7 100644 --- a/app_new/templates/planning/calendar.html +++ b/app_new/templates/planning/calendar.html @@ -118,7 +118,7 @@ title="{{ day_info.vacation_name if day_info.vacation_name else '' }}"> {{ day_info.day }} - {{ day_info.worked_hours }} / {{ day_info.planned_hours }} + {% if day_info.deviation_hours %}{{ day_info.deviation_hours }}{% endif %} {% if day_info.events %}